@amsterdam/design-system-react 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion/Accordion.js +3 -3
- package/dist/Accordion/AccordionContext.d.ts +1 -2
- package/dist/Accordion/AccordionContext.js +3 -4
- package/dist/Accordion/AccordionSection.js +1 -1
- package/dist/Badge/Badge.d.ts +5 -0
- package/dist/Badge/Badge.js +3 -2
- package/dist/Checkbox/Checkbox.d.ts +5 -4
- package/dist/ErrorMessage/ErrorMessage.js +1 -1
- package/dist/Heading/Heading.d.ts +4 -4
- package/dist/Heading/Heading.js +1 -1
- package/dist/ImageSlider/ImageSlider.d.ts +5 -20
- package/dist/ImageSlider/ImageSlider.js +30 -87
- package/dist/ImageSlider/ImageSliderControl.d.ts +2 -0
- package/dist/ImageSlider/ImageSliderControl.js +5 -0
- package/dist/ImageSlider/ImageSliderSlide.d.ts +14 -0
- package/dist/ImageSlider/ImageSliderSlide.js +19 -0
- package/dist/ImageSlider/ImageSliderThumbnails.d.ts +5 -6
- package/dist/ImageSlider/ImageSliderThumbnails.js +7 -12
- package/dist/ImageSlider/index.d.ts +0 -1
- package/dist/ImageSlider/utils/debounce.d.ts +1 -0
- package/dist/ImageSlider/utils/debounce.js +8 -0
- package/dist/ImageSlider/utils/index.d.ts +4 -0
- package/dist/ImageSlider/utils/index.js +4 -0
- package/dist/ImageSlider/utils/scrollToCurrentSlideOnResize.d.ts +7 -0
- package/dist/ImageSlider/utils/scrollToCurrentSlideOnResize.js +11 -0
- package/dist/ImageSlider/utils/scrollToSlide.d.ts +2 -0
- package/dist/ImageSlider/utils/scrollToSlide.js +9 -0
- package/dist/ImageSlider/utils/setCurrentSlideIdToVisibleSlide.d.ts +8 -0
- package/dist/ImageSlider/utils/setCurrentSlideIdToVisibleSlide.js +10 -0
- package/dist/Logo/Logo.d.ts +1 -1
- package/dist/Logo/Logo.js +6 -1
- package/dist/Logo/brand/LogoAmsterdamEnglish.d.ts +7 -0
- package/dist/Logo/brand/LogoAmsterdamEnglish.js +6 -0
- package/dist/Logo/brand/index.d.ts +1 -0
- package/dist/Logo/brand/index.js +1 -0
- package/dist/Menu/Menu.js +3 -2
- package/dist/PageHeader/LogoLinkContent.d.ts +13 -0
- package/dist/PageHeader/LogoLinkContent.js +8 -0
- package/dist/PageHeader/PageHeader.d.ts +16 -1
- package/dist/PageHeader/PageHeader.js +16 -12
- package/dist/ProgressList/AccessibleStatusText.d.ts +10 -0
- package/dist/ProgressList/AccessibleStatusText.js +13 -0
- package/dist/ProgressList/ProgressList.d.ts +63 -0
- package/dist/ProgressList/ProgressList.js +23 -0
- package/dist/ProgressList/ProgressListContext.d.ts +12 -0
- package/dist/ProgressList/ProgressListContext.js +11 -0
- package/dist/ProgressList/ProgressListStep.d.ts +23 -0
- package/dist/ProgressList/ProgressListStep.js +13 -0
- package/dist/ProgressList/ProgressListSubstep.d.ts +16 -0
- package/dist/ProgressList/ProgressListSubstep.js +8 -0
- package/dist/ProgressList/ProgressListSubsteps.d.ts +9 -0
- package/dist/ProgressList/ProgressListSubsteps.js +5 -0
- package/dist/ProgressList/index.d.ts +9 -0
- package/dist/{PageHeader/matchMedia.mock.d.ts → ProgressList/index.js} +1 -0
- package/dist/Radio/Radio.d.ts +5 -4
- package/dist/SearchField/SearchFieldInput.js +3 -3
- package/dist/common/useViewportHasMinWidth.d.ts +22 -0
- package/dist/common/{useIsAfterBreakpoint.js → useViewportHasMinWidth.js} +13 -2
- package/dist/index.cjs.js +2122 -2389
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +144 -60
- package/dist/index.esm.js +2124 -2392
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +17 -19
- package/dist/ImageSlider/ImageSliderContext.d.ts +0 -13
- package/dist/ImageSlider/ImageSliderContext.js +0 -14
- package/dist/ImageSlider/ImageSliderControls.d.ts +0 -17
- package/dist/ImageSlider/ImageSliderControls.js +0 -13
- package/dist/ImageSlider/ImageSliderItem.d.ts +0 -15
- package/dist/ImageSlider/ImageSliderItem.js +0 -11
- package/dist/ImageSlider/ImageSliderScroller.d.ts +0 -9
- package/dist/ImageSlider/ImageSliderScroller.js +0 -5
- package/dist/PageHeader/matchMedia.mock.js +0 -19
- package/dist/common/useIsAfterBreakpoint.d.ts +0 -11
package/dist/Menu/Menu.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
3
|
+
import { forwardRef, useId } from 'react';
|
|
4
4
|
import { MenuLink } from './MenuLink';
|
|
5
5
|
export const MenuRoot = forwardRef(({ accessibleName = 'Hoofdnavigatie', children, className, inWideWindow, ...restProps }, ref) => {
|
|
6
6
|
// In a medium or narrow window, the Menu is a child of the `nav` of Page Header.
|
|
7
7
|
// In a wide window, we render a `nav` element and the related accessibility features.
|
|
8
8
|
const Tag = inWideWindow ? 'nav' : 'div';
|
|
9
|
-
|
|
9
|
+
const accessibleLabelId = useId();
|
|
10
|
+
return (_jsxs(Tag, { ...restProps, "aria-labelledby": inWideWindow ? accessibleLabelId : undefined, className: clsx('ams-menu', inWideWindow && `ams-menu--in-wide-window`, className), ref: ref, children: [inWideWindow && (_jsx("h2", { className: "ams-visually-hidden", id: accessibleLabelId, children: accessibleName })), _jsx("ul", { className: "ams-menu__list", children: children })] }));
|
|
10
11
|
});
|
|
11
12
|
MenuRoot.displayName = 'Menu';
|
|
12
13
|
/**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { PageHeaderProps } from './PageHeader';
|
|
6
|
+
type LogoLinkContentProps = {
|
|
7
|
+
brandNameFullOrShort?: PageHeaderProps['brandName'] | PageHeaderProps['brandNameShort'];
|
|
8
|
+
brandNameShort?: PageHeaderProps['brandNameShort'];
|
|
9
|
+
logoAccessibleName?: PageHeaderProps['logoAccessibleName'];
|
|
10
|
+
logoBrand: PageHeaderProps['logoBrand'];
|
|
11
|
+
};
|
|
12
|
+
export declare const LogoLinkContent: ({ brandNameFullOrShort, brandNameShort, logoAccessibleName, logoBrand, }: LogoLinkContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @license EUPL-1.2+
|
|
4
|
+
* Copyright Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import { clsx } from 'clsx';
|
|
7
|
+
import { Logo } from '../Logo';
|
|
8
|
+
export const LogoLinkContent = ({ brandNameFullOrShort, brandNameShort, logoAccessibleName, logoBrand, }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: clsx(logoBrand === 'amsterdam' && brandNameFullOrShort && 'ams-page-header__logo-container'), children: _jsx(Logo, { "aria-label": logoAccessibleName, brand: logoBrand }) }), brandNameShort && (_jsx("span", { "aria-hidden": "true", className: "ams-page-header__brand-name-short", children: brandNameShort })), brandNameFullOrShort && (_jsx("span", { "aria-hidden": "true", className: "ams-page-header__brand-name", children: brandNameFullOrShort }))] }));
|
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { AnchorHTMLAttributes, ComponentType, HTMLAttributes, ReactNode } from 'react';
|
|
6
|
+
import type { IconProps } from '../Icon';
|
|
6
7
|
import type { LogoBrand } from '../Logo';
|
|
7
8
|
import type { LogoBrandConfig } from '../Logo/Logo';
|
|
8
9
|
export type PageHeaderProps = {
|
|
9
10
|
/** The name of the application. */
|
|
10
11
|
brandName?: string;
|
|
12
|
+
/**
|
|
13
|
+
* A shorter form of the name of the application.
|
|
14
|
+
* Provide this only together with a `brandName`.
|
|
15
|
+
*/
|
|
16
|
+
brandNameShort?: string;
|
|
11
17
|
/** The accessible name of the logo. */
|
|
12
18
|
logoAccessibleName?: string;
|
|
13
19
|
/** The name of the brand for which to display the logo. */
|
|
@@ -18,6 +24,8 @@ export type PageHeaderProps = {
|
|
|
18
24
|
logoLinkComponent?: ComponentType<AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
19
25
|
/** The accessible text for the link on the logo. */
|
|
20
26
|
logoLinkTitle?: string;
|
|
27
|
+
/** An icon to display instead of the default icon. */
|
|
28
|
+
menuButtonIcon?: IconProps['svg'];
|
|
21
29
|
/** The visible text for the menu button. */
|
|
22
30
|
menuButtonText?: string;
|
|
23
31
|
/** The text for screen readers when the button hides the menu. */
|
|
@@ -37,6 +45,11 @@ export type PageHeaderProps = {
|
|
|
37
45
|
export declare const PageHeader: import("react").ForwardRefExoticComponent<{
|
|
38
46
|
/** The name of the application. */
|
|
39
47
|
brandName?: string;
|
|
48
|
+
/**
|
|
49
|
+
* A shorter form of the name of the application.
|
|
50
|
+
* Provide this only together with a `brandName`.
|
|
51
|
+
*/
|
|
52
|
+
brandNameShort?: string;
|
|
40
53
|
/** The accessible name of the logo. */
|
|
41
54
|
logoAccessibleName?: string;
|
|
42
55
|
/** The name of the brand for which to display the logo. */
|
|
@@ -47,6 +60,8 @@ export declare const PageHeader: import("react").ForwardRefExoticComponent<{
|
|
|
47
60
|
logoLinkComponent?: ComponentType<AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
48
61
|
/** The accessible text for the link on the logo. */
|
|
49
62
|
logoLinkTitle?: string;
|
|
63
|
+
/** An icon to display instead of the default icon. */
|
|
64
|
+
menuButtonIcon?: IconProps["svg"];
|
|
50
65
|
/** The visible text for the menu button. */
|
|
51
66
|
menuButtonText?: string;
|
|
52
67
|
/** The text for screen readers when the button hides the menu. */
|
|
@@ -63,7 +78,7 @@ export declare const PageHeader: import("react").ForwardRefExoticComponent<{
|
|
|
63
78
|
GridCellNarrowWindowOnly: import("react").ForwardRefExoticComponent<import("..").GridCellProps & import("react").RefAttributes<HTMLElement>>;
|
|
64
79
|
MenuLink: import("react").ForwardRefExoticComponent<{
|
|
65
80
|
fixed?: boolean;
|
|
66
|
-
icon?:
|
|
81
|
+
icon?: IconProps["svg"];
|
|
67
82
|
} & AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
68
83
|
children?: ReactNode | undefined;
|
|
69
84
|
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { forwardRef, useEffect, useState } from 'react';
|
|
4
|
-
import
|
|
3
|
+
import { forwardRef, useEffect, useId, useState } from 'react';
|
|
4
|
+
import useViewportHasMinWidth from '../common/useViewportHasMinWidth';
|
|
5
5
|
import { Icon } from '../Icon';
|
|
6
|
-
import {
|
|
6
|
+
import { LogoLinkContent } from './LogoLinkContent';
|
|
7
7
|
import { PageHeaderGridCellNarrowWindowOnly } from './PageHeaderGridCellNarrowWindowOnly';
|
|
8
8
|
import { PageHeaderMenuIcon } from './PageHeaderMenuIcon';
|
|
9
9
|
import { PageHeaderMenuLink } from './PageHeaderMenuLink';
|
|
10
|
-
const
|
|
11
|
-
const PageHeaderRoot = forwardRef(({ brandName, children, className, logoAccessibleName, logoBrand = 'amsterdam', logoLink = '/', logoLinkComponent = (props) => _jsx("a", { ...props }), logoLinkTitle = `Ga naar de homepage${brandName ? ` van ${brandName}` : ''}`, menuButtonText = 'Menu', menuButtonTextForHide = 'Verberg navigatiemenu', menuButtonTextForShow = 'Laat navigatiemenu zien', menuItems, navigationLabel = 'Hoofdnavigatie', noMenuButtonOnWideWindow, ...restProps }, ref) => {
|
|
10
|
+
const PageHeaderRoot = forwardRef(({ brandName, brandNameShort, children, className, logoAccessibleName, logoBrand = 'amsterdam', logoLink = '/', logoLinkComponent = (props) => _jsx("a", { ...props }), logoLinkTitle, menuButtonIcon, menuButtonText = 'Menu', menuButtonTextForHide = 'Verberg navigatiemenu', menuButtonTextForShow = 'Laat navigatiemenu zien', menuItems, navigationLabel = 'Hoofdnavigatie', noMenuButtonOnWideWindow, ...restProps }, ref) => {
|
|
12
11
|
const [open, setOpen] = useState(false);
|
|
13
|
-
const
|
|
12
|
+
const viewportHasMinWidth = useViewportHasMinWidth('wide');
|
|
13
|
+
const accessibleLabelId = useId();
|
|
14
14
|
const hasMegaMenu = Boolean(children);
|
|
15
|
-
const
|
|
15
|
+
const hasMegaMenuOnWideWindow = hasMegaMenu && viewportHasMinWidth;
|
|
16
|
+
const LogoLink = logoLinkComponent;
|
|
17
|
+
// Use short brand name if no full brand name is (invalidly) provided
|
|
18
|
+
const brandNameFullOrShort = brandName || brandNameShort;
|
|
19
|
+
const logoLinkContentProps = { brandNameFullOrShort, brandNameShort, logoAccessibleName, logoBrand };
|
|
16
20
|
useEffect(() => {
|
|
17
21
|
// Close the menu when the menu button disappears
|
|
18
|
-
if (noMenuButtonOnWideWindow &&
|
|
22
|
+
if (noMenuButtonOnWideWindow && hasMegaMenuOnWideWindow) {
|
|
19
23
|
setOpen(false);
|
|
20
24
|
}
|
|
21
|
-
}, [
|
|
22
|
-
return (_jsxs("header", { ...restProps, className: clsx('ams-page-header', className), ref: ref, children: [_jsxs(
|
|
23
|
-
: true, children: _jsxs("button", { "aria-controls": "ams-page-header-mega-menu", "aria-expanded": open, className: "ams-page-header__mega-menu-button", onClick: () => setOpen(!open), type: "button", children: [_jsx("span", { "aria-hidden": "true", className: "ams-page-header__mega-menu-button-label", children: menuButtonText }), _jsx("span", { className: "ams-visually-hidden", children: open ? menuButtonTextForHide : menuButtonTextForShow }), _jsx(
|
|
25
|
+
}, [hasMegaMenuOnWideWindow, noMenuButtonOnWideWindow]);
|
|
26
|
+
return (_jsxs("header", { ...restProps, className: clsx('ams-page-header', className), ref: ref, children: [_jsxs(LogoLink, { className: "ams-page-header__logo-link", href: logoLink, children: [_jsx(LogoLinkContent, { ...logoLinkContentProps }), _jsx("span", { className: "ams-visually-hidden", children: logoLinkTitle ?? `Ga naar de homepage${brandNameFullOrShort ? ' van ' + brandNameFullOrShort : ''}` })] }), (hasMegaMenu || menuItems) && (_jsxs("nav", { "aria-labelledby": accessibleLabelId, className: "ams-page-header__navigation", children: [_jsx("h2", { "aria-hidden": true, className: "ams-visually-hidden", id: accessibleLabelId, children: navigationLabel }), _jsx("div", { "aria-hidden": true, className: "ams-page-header__logo-link ams-page-header__logo-link--hidden", hidden: true, children: _jsx(LogoLinkContent, { ...logoLinkContentProps, logoAccessibleName: undefined }) }), _jsxs("ul", { className: "ams-page-header__menu", children: [menuItems, hasMegaMenu && (_jsx("li", { className: clsx('ams-page-header__mega-menu-button-item', noMenuButtonOnWideWindow && 'ams-page-header__mega-menu-button-item--hide-on-wide-window'), hidden // Hide the list item containing the menu button until its CSS loads. If it doesn't load, the menu will always be visible.
|
|
27
|
+
: true, children: _jsxs("button", { "aria-controls": "ams-page-header-mega-menu", "aria-expanded": open, className: "ams-page-header__mega-menu-button", onClick: () => setOpen(!open), type: "button", children: [_jsx("span", { "aria-hidden": "true", className: "ams-page-header__mega-menu-button-label", children: menuButtonText }), _jsx("span", { className: "ams-visually-hidden", children: open ? menuButtonTextForHide : menuButtonTextForShow }), _jsx(Icon, { svg: menuButtonIcon ?? (_jsx(PageHeaderMenuIcon, { className: clsx('ams-page-header__menu-icon', open && 'ams-page-header__menu-icon--open') })) })] }) }))] }), hasMegaMenu && (_jsx("div", { className: clsx('ams-page-header__mega-menu', !open && 'ams-page-header__mega-menu--closed'), id: "ams-page-header-mega-menu", children: children }))] }))] }));
|
|
24
28
|
});
|
|
25
29
|
PageHeaderRoot.displayName = 'PageHeader';
|
|
26
30
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { ProgressListStepProps } from './ProgressListStep';
|
|
6
|
+
type AccessibleStatusTextProps = {
|
|
7
|
+
status?: ProgressListStepProps['status'];
|
|
8
|
+
};
|
|
9
|
+
export declare const AccessibleStatusText: ({ status }: AccessibleStatusTextProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @license EUPL-1.2+
|
|
4
|
+
* Copyright Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import { useContext } from 'react';
|
|
7
|
+
import { ProgressListContext } from './ProgressListContext';
|
|
8
|
+
export const AccessibleStatusText = ({ status }) => {
|
|
9
|
+
const { completedAccessibleText, currentAccessibleText } = useContext(ProgressListContext);
|
|
10
|
+
if (!status)
|
|
11
|
+
return null;
|
|
12
|
+
return (_jsxs("span", { className: "ams-visually-hidden", children: [status === 'completed' && completedAccessibleText && `${completedAccessibleText}: `, status === 'current' && currentAccessibleText && `${currentAccessibleText}: `] }));
|
|
13
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export declare const progressListHeadingLevels: (2 | 3 | 4)[];
|
|
7
|
+
type ProgressListHeadingLevel = (typeof progressListHeadingLevels)[number];
|
|
8
|
+
export type ProgressListProps = {
|
|
9
|
+
/**
|
|
10
|
+
* An accessible phrase that screen readers announce before a completed step heading.
|
|
11
|
+
* @default Klaar
|
|
12
|
+
*/
|
|
13
|
+
completedAccessibleText?: string;
|
|
14
|
+
/**
|
|
15
|
+
* An accessible phrase that screen readers announce before a current step heading.
|
|
16
|
+
* @default Bezig
|
|
17
|
+
*/
|
|
18
|
+
currentAccessibleText?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The hierarchical level of this Progress List’s Headings within the document.
|
|
21
|
+
* There is no default value; determine the correct level for this instance.
|
|
22
|
+
*/
|
|
23
|
+
headingLevel: ProgressListHeadingLevel;
|
|
24
|
+
} & PropsWithChildren<HTMLAttributes<HTMLOListElement>>;
|
|
25
|
+
/**
|
|
26
|
+
* @see {@link https://designsystem.amsterdam/?path=/docs/components-containers-progress-list--docs Progress List docs at Amsterdam Design System}
|
|
27
|
+
*/
|
|
28
|
+
export declare const ProgressList: import("react").ForwardRefExoticComponent<{
|
|
29
|
+
/**
|
|
30
|
+
* An accessible phrase that screen readers announce before a completed step heading.
|
|
31
|
+
* @default Klaar
|
|
32
|
+
*/
|
|
33
|
+
completedAccessibleText?: string;
|
|
34
|
+
/**
|
|
35
|
+
* An accessible phrase that screen readers announce before a current step heading.
|
|
36
|
+
* @default Bezig
|
|
37
|
+
*/
|
|
38
|
+
currentAccessibleText?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The hierarchical level of this Progress List’s Headings within the document.
|
|
41
|
+
* There is no default value; determine the correct level for this instance.
|
|
42
|
+
*/
|
|
43
|
+
headingLevel: ProgressListHeadingLevel;
|
|
44
|
+
} & HTMLAttributes<HTMLOListElement> & {
|
|
45
|
+
children?: import("react").ReactNode | undefined;
|
|
46
|
+
} & import("react").RefAttributes<HTMLOListElement>> & {
|
|
47
|
+
Step: import("react").ForwardRefExoticComponent<{
|
|
48
|
+
hasSubsteps?: boolean;
|
|
49
|
+
heading: string;
|
|
50
|
+
status?: "current" | "completed";
|
|
51
|
+
} & HTMLAttributes<HTMLElement> & {
|
|
52
|
+
children?: import("react").ReactNode | undefined;
|
|
53
|
+
} & import("react").RefAttributes<HTMLLIElement>>;
|
|
54
|
+
Substep: import("react").ForwardRefExoticComponent<{
|
|
55
|
+
status?: import("./ProgressListStep").ProgressListStepProps["status"];
|
|
56
|
+
} & HTMLAttributes<HTMLElement> & {
|
|
57
|
+
children?: import("react").ReactNode | undefined;
|
|
58
|
+
} & import("react").RefAttributes<HTMLLIElement>>;
|
|
59
|
+
Substeps: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLOListElement> & {
|
|
60
|
+
children?: import("react").ReactNode | undefined;
|
|
61
|
+
} & import("react").RefAttributes<HTMLOListElement>>;
|
|
62
|
+
};
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { headingLevels } from '../Heading/Heading';
|
|
5
|
+
import { ProgressListContext } from './ProgressListContext';
|
|
6
|
+
import { ProgressListStep } from './ProgressListStep';
|
|
7
|
+
import { ProgressListSubstep } from './ProgressListSubstep';
|
|
8
|
+
import { ProgressListSubsteps } from './ProgressListSubsteps';
|
|
9
|
+
export const progressListHeadingLevels = headingLevels.filter((level) => level !== 1);
|
|
10
|
+
const ProgressListRoot = forwardRef(({ children, className, completedAccessibleText, currentAccessibleText, headingLevel, ...restProps }, ref) => (_jsx(ProgressListContext.Provider, { value: {
|
|
11
|
+
completedAccessibleText: completedAccessibleText ?? 'Klaar',
|
|
12
|
+
currentAccessibleText: currentAccessibleText ?? 'Bezig',
|
|
13
|
+
headingLevel,
|
|
14
|
+
}, children: _jsx("ol", { ...restProps, className: clsx('ams-progress-list', `ams-progress-list--heading-${headingLevel}`, className), ref: ref, children: children }) })));
|
|
15
|
+
/**
|
|
16
|
+
* @see {@link https://designsystem.amsterdam/?path=/docs/components-containers-progress-list--docs Progress List docs at Amsterdam Design System}
|
|
17
|
+
*/
|
|
18
|
+
export const ProgressList = Object.assign(ProgressListRoot, {
|
|
19
|
+
Step: ProgressListStep,
|
|
20
|
+
Substep: ProgressListSubstep,
|
|
21
|
+
Substeps: ProgressListSubsteps,
|
|
22
|
+
});
|
|
23
|
+
ProgressListRoot.displayName = 'ProgressList';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { ProgressListProps } from './ProgressList';
|
|
6
|
+
type ProgressListContextValue = {
|
|
7
|
+
completedAccessibleText?: ProgressListProps['completedAccessibleText'];
|
|
8
|
+
currentAccessibleText?: ProgressListProps['currentAccessibleText'];
|
|
9
|
+
headingLevel: ProgressListProps['headingLevel'];
|
|
10
|
+
};
|
|
11
|
+
export declare const ProgressListContext: import("react").Context<ProgressListContextValue>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import { createContext } from 'react';
|
|
6
|
+
const defaultValues = {
|
|
7
|
+
// Default value for type safety.
|
|
8
|
+
// The actual value is always provided via ProgressList’s required headingLevel prop.
|
|
9
|
+
headingLevel: 2,
|
|
10
|
+
};
|
|
11
|
+
export const ProgressListContext = createContext(defaultValues);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export type ProgressListStepProps = {
|
|
7
|
+
/** Whether the step contains a list of substeps. This is needed to draw the connecting lines correctly. */
|
|
8
|
+
hasSubsteps?: boolean;
|
|
9
|
+
/** The heading text for this step. */
|
|
10
|
+
heading: string;
|
|
11
|
+
/** The current progress state of the step. */
|
|
12
|
+
status?: 'current' | 'completed';
|
|
13
|
+
} & PropsWithChildren<HTMLAttributes<HTMLElement>>;
|
|
14
|
+
export declare const ProgressListStep: import("react").ForwardRefExoticComponent<{
|
|
15
|
+
/** Whether the step contains a list of substeps. This is needed to draw the connecting lines correctly. */
|
|
16
|
+
hasSubsteps?: boolean;
|
|
17
|
+
/** The heading text for this step. */
|
|
18
|
+
heading: string;
|
|
19
|
+
/** The current progress state of the step. */
|
|
20
|
+
status?: "current" | "completed";
|
|
21
|
+
} & HTMLAttributes<HTMLElement> & {
|
|
22
|
+
children?: import("react").ReactNode | undefined;
|
|
23
|
+
} & import("react").RefAttributes<HTMLLIElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowForwardIcon } from '@amsterdam/design-system-react-icons';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { forwardRef, useContext } from 'react';
|
|
5
|
+
import { Heading } from '../Heading';
|
|
6
|
+
import { Icon } from '../Icon';
|
|
7
|
+
import { AccessibleStatusText } from './AccessibleStatusText';
|
|
8
|
+
import { ProgressListContext } from './ProgressListContext';
|
|
9
|
+
export const ProgressListStep = forwardRef(({ children, className, hasSubsteps, heading, status, ...restProps }, ref) => {
|
|
10
|
+
const { headingLevel } = useContext(ProgressListContext);
|
|
11
|
+
return (_jsxs("li", { "aria-current": status === 'current' ? 'step' : undefined, className: clsx(className, 'ams-progress-list__step', hasSubsteps && 'ams-progress-list__step--has-substeps', status && `ams-progress-list__step--${status}`), ref: ref, ...restProps, children: [_jsxs("div", { className: "ams-progress-list__indicator", children: [_jsx("div", { className: "ams-progress-list__marker", children: _jsx("span", { className: "ams-progress-list__marker-shape", children: status === 'current' && _jsx(Icon, { color: "inverse", svg: ArrowForwardIcon }) }) }), _jsx("span", { className: "ams-progress-list__connector" })] }), _jsxs("div", { className: "ams-progress-list__content", children: [_jsxs(Heading, { className: "ams-progress-list__heading", level: headingLevel, children: [_jsx(AccessibleStatusText, { status: status }), heading] }), children] })] }));
|
|
12
|
+
});
|
|
13
|
+
ProgressListStep.displayName = 'ProgressList.Step';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
import type { ProgressListStepProps } from './ProgressListStep';
|
|
7
|
+
export type ProgressListSubstepProps = {
|
|
8
|
+
/** The current progress state of the substep. */
|
|
9
|
+
status?: ProgressListStepProps['status'];
|
|
10
|
+
} & PropsWithChildren<HTMLAttributes<HTMLElement>>;
|
|
11
|
+
export declare const ProgressListSubstep: import("react").ForwardRefExoticComponent<{
|
|
12
|
+
/** The current progress state of the substep. */
|
|
13
|
+
status?: ProgressListStepProps["status"];
|
|
14
|
+
} & HTMLAttributes<HTMLElement> & {
|
|
15
|
+
children?: import("react").ReactNode | undefined;
|
|
16
|
+
} & import("react").RefAttributes<HTMLLIElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { AccessibleStatusText } from './AccessibleStatusText';
|
|
5
|
+
export const ProgressListSubstep = forwardRef(({ children, className, status, ...restProps }, ref) => {
|
|
6
|
+
return (_jsxs("li", { "aria-current": status === 'current' ? 'step' : undefined, className: clsx('ams-progress-list-substeps__step', status && `ams-progress-list-substeps__step--${status}`, className), ref: ref, ...restProps, children: [_jsxs("div", { className: "ams-progress-list-substeps__indicator", children: [_jsx("div", { className: "ams-progress-list-substeps__marker", children: _jsx("span", { className: "ams-progress-list-substeps__marker-shape" }) }), _jsx("span", { className: "ams-progress-list-substeps__connector" })] }), _jsxs("div", { className: "ams-progress-list-substeps__content", children: [_jsx(AccessibleStatusText, { status: status }), children] })] }));
|
|
7
|
+
});
|
|
8
|
+
ProgressListSubstep.displayName = 'ProgressList.Substep';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export type ProgressListSubstepsProps = PropsWithChildren<HTMLAttributes<HTMLOListElement>>;
|
|
7
|
+
export declare const ProgressListSubsteps: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLOListElement> & {
|
|
8
|
+
children?: import("react").ReactNode | undefined;
|
|
9
|
+
} & import("react").RefAttributes<HTMLOListElement>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
export const ProgressListSubsteps = forwardRef(({ children, className, ...restProps }, ref) => (_jsx("ol", { ...restProps, className: clsx('ams-progress-list-substeps', className), ref: ref, children: children })));
|
|
5
|
+
ProgressListSubsteps.displayName = 'ProgressList.Substeps';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
export { ProgressList } from './ProgressList';
|
|
6
|
+
export type { ProgressListProps } from './ProgressList';
|
|
7
|
+
export type { ProgressListStepProps } from './ProgressListStep';
|
|
8
|
+
export type { ProgressListSubstepProps } from './ProgressListSubstep';
|
|
9
|
+
export type { ProgressListSubstepsProps } from './ProgressListSubsteps';
|
package/dist/Radio/Radio.d.ts
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* @license EUPL-1.2+
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
|
-
import type { InputHTMLAttributes, PropsWithChildren
|
|
5
|
+
import type { InputHTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
import type { IconProps } from '../Icon';
|
|
6
7
|
export type RadioProps = {
|
|
7
8
|
/**
|
|
8
9
|
* An icon to display instead of the default icon.
|
|
9
10
|
* @default RadioIcon
|
|
10
11
|
*/
|
|
11
|
-
icon?:
|
|
12
|
+
icon?: IconProps['svg'];
|
|
12
13
|
/** Whether the value fails a validation rule. */
|
|
13
14
|
invalid?: boolean;
|
|
14
15
|
} & PropsWithChildren<Omit<InputHTMLAttributes<HTMLInputElement>, 'aria-invalid' | 'type'>>;
|
|
@@ -20,9 +21,9 @@ export declare const Radio: import("react").ForwardRefExoticComponent<{
|
|
|
20
21
|
* An icon to display instead of the default icon.
|
|
21
22
|
* @default RadioIcon
|
|
22
23
|
*/
|
|
23
|
-
icon?:
|
|
24
|
+
icon?: IconProps["svg"];
|
|
24
25
|
/** Whether the value fails a validation rule. */
|
|
25
26
|
invalid?: boolean;
|
|
26
27
|
} & Omit<InputHTMLAttributes<HTMLInputElement>, "aria-invalid" | "type"> & {
|
|
27
|
-
children?: ReactNode | undefined;
|
|
28
|
+
children?: import("react").ReactNode | undefined;
|
|
28
29
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { forwardRef, useId } from 'react';
|
|
4
|
-
export const SearchFieldInput = forwardRef(({ className, dir, invalid, label = 'Zoeken', ...restProps }, ref) => {
|
|
5
|
-
const
|
|
6
|
-
return (_jsxs(_Fragment, { children: [_jsx("label", { className: "ams-visually-hidden", htmlFor:
|
|
4
|
+
export const SearchFieldInput = forwardRef(({ className, dir, id, invalid, label = 'Zoeken', ...restProps }, ref) => {
|
|
5
|
+
const inputId = id ?? useId();
|
|
6
|
+
return (_jsxs(_Fragment, { children: [_jsx("label", { className: "ams-visually-hidden", htmlFor: inputId, children: label }), _jsx("input", { ...restProps, "aria-invalid": invalid || undefined, autoComplete: "off", className: clsx('ams-search-field__input', className), dir: dir ?? 'auto', enterKeyHint: "search", id: inputId, ref: ref, spellCheck: "false", type: "search" })] }));
|
|
7
7
|
});
|
|
8
8
|
SearchFieldInput.displayName = 'SearchField.Input';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
export declare const BREAKPOINTS: {
|
|
6
|
+
readonly medium: "37.5rem";
|
|
7
|
+
readonly wide: "72.5rem";
|
|
8
|
+
};
|
|
9
|
+
type Breakpoint = keyof typeof BREAKPOINTS;
|
|
10
|
+
/**
|
|
11
|
+
* Hook to determine if the viewport width is at or beyond a given breakpoint.
|
|
12
|
+
*
|
|
13
|
+
* **Prefer CSS media queries over this hook.** Use this only when viewport-dependent
|
|
14
|
+
* logic must run in JavaScript, e.g. for interactions or dynamic behaviour that cannot
|
|
15
|
+
* be expressed in CSS. CSS media queries are more performant, better supported across
|
|
16
|
+
* stacks, and easier to maintain.
|
|
17
|
+
*
|
|
18
|
+
* @param breakpoint - The breakpoint to match against: `'medium'` or `'wide'`.
|
|
19
|
+
* @returns `true` if the viewport width meets or exceeds the breakpoint, `false` otherwise.
|
|
20
|
+
*/
|
|
21
|
+
declare const useViewportHasMinWidth: (breakpoint: Breakpoint) => boolean;
|
|
22
|
+
export default useViewportHasMinWidth;
|
|
@@ -8,7 +8,18 @@ export const BREAKPOINTS = {
|
|
|
8
8
|
medium: '37.5rem',
|
|
9
9
|
wide: '72.5rem',
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Hook to determine if the viewport width is at or beyond a given breakpoint.
|
|
13
|
+
*
|
|
14
|
+
* **Prefer CSS media queries over this hook.** Use this only when viewport-dependent
|
|
15
|
+
* logic must run in JavaScript, e.g. for interactions or dynamic behaviour that cannot
|
|
16
|
+
* be expressed in CSS. CSS media queries are more performant, better supported across
|
|
17
|
+
* stacks, and easier to maintain.
|
|
18
|
+
*
|
|
19
|
+
* @param breakpoint - The breakpoint to match against: `'medium'` or `'wide'`.
|
|
20
|
+
* @returns `true` if the viewport width meets or exceeds the breakpoint, `false` otherwise.
|
|
21
|
+
*/
|
|
22
|
+
const useViewportHasMinWidth = (breakpoint) => {
|
|
12
23
|
const [matches, setMatches] = useState(false);
|
|
13
24
|
useEffect(() => {
|
|
14
25
|
// Check for window object to avoid SSR issues
|
|
@@ -24,4 +35,4 @@ const useIsAfterBreakpoint = (breakpoint) => {
|
|
|
24
35
|
}, [breakpoint]);
|
|
25
36
|
return matches;
|
|
26
37
|
};
|
|
27
|
-
export default
|
|
38
|
+
export default useViewportHasMinWidth;
|