@amsterdam/design-system-react 2.2.0 → 3.1.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/README.md +1 -1
- package/dist/Accordion/Accordion.js +1 -1
- 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/Column/Column.d.ts +1 -1
- package/dist/Grid/Grid.d.ts +1 -1
- package/dist/Grid/GridCell.d.ts +1 -1
- package/dist/ImageSlider/ImageSlider.d.ts +3 -22
- package/dist/ImageSlider/ImageSlider.js +31 -86
- package/dist/ImageSlider/ImageSliderControl.d.ts +2 -0
- package/dist/ImageSlider/ImageSliderControl.js +5 -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 +10 -5
- package/dist/Logo/Logo.js +17 -9
- package/dist/PageFooter/PageFooter.d.ts +4 -1
- package/dist/PageFooter/PageFooterMenu.d.ts +27 -2
- package/dist/PageFooter/PageFooterMenu.js +6 -2
- package/dist/PageHeader/PageHeader.d.ts +19 -5
- package/dist/PageHeader/PageHeader.js +3 -2
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.js +2 -1
- package/dist/Paragraph/Paragraph.d.ts +2 -2
- package/dist/Paragraph/Paragraph.js +8 -1
- package/dist/ProgressList/ProgressList.d.ts +43 -0
- package/dist/ProgressList/ProgressList.js +19 -0
- package/dist/ProgressList/ProgressListContext.d.ts +10 -0
- package/dist/ProgressList/ProgressListContext.js +11 -0
- package/dist/ProgressList/ProgressListStep.d.ts +23 -0
- package/dist/ProgressList/ProgressListStep.js +12 -0
- package/dist/ProgressList/ProgressListSubstep.d.ts +16 -0
- package/dist/ProgressList/ProgressListSubstep.js +7 -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/ProgressList/index.js +5 -0
- package/dist/Radio/Radio.d.ts +5 -4
- package/dist/Row/Row.d.ts +1 -1
- package/dist/Spotlight/Spotlight.d.ts +1 -1
- package/dist/common/useIsAfterBreakpoint.d.ts +4 -4
- package/dist/common/useIsAfterBreakpoint.js +12 -13
- package/dist/index.cjs.js +734 -663
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +150 -77
- package/dist/index.esm.js +736 -666
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +13 -18
- 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
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
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 } from 'react';
|
|
4
|
-
|
|
4
|
+
import { getHeadingTag } from '../Heading/getHeadingTag';
|
|
5
|
+
export const PageFooterMenu = forwardRef(({ children, className, heading = 'Over deze website', headingLevel = 2, ...restProps }, ref) => {
|
|
6
|
+
const HeadingTag = getHeadingTag(headingLevel);
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsx(HeadingTag, { className: "ams-visually-hidden", children: heading }), _jsx("ul", { ...restProps, className: clsx('ams-page-footer__menu', className), ref: ref, children: children })] }));
|
|
8
|
+
});
|
|
5
9
|
PageFooterMenu.displayName = 'PageFooter.Menu';
|
|
@@ -3,22 +3,30 @@
|
|
|
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';
|
|
8
|
+
import type { LogoBrandConfig } from '../Logo/Logo';
|
|
7
9
|
export type PageHeaderProps = {
|
|
8
10
|
/** The name of the application. */
|
|
9
11
|
brandName?: string;
|
|
10
12
|
/** The accessible name of the logo. */
|
|
11
13
|
logoAccessibleName?: string;
|
|
12
14
|
/** The name of the brand for which to display the logo. */
|
|
13
|
-
logoBrand?: LogoBrand;
|
|
15
|
+
logoBrand?: LogoBrand | LogoBrandConfig;
|
|
14
16
|
/** The url for the link on the logo. */
|
|
15
17
|
logoLink?: string;
|
|
16
18
|
/** The React component to use for the logo link. */
|
|
17
19
|
logoLinkComponent?: ComponentType<AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
18
20
|
/** The accessible text for the link on the logo. */
|
|
19
21
|
logoLinkTitle?: string;
|
|
20
|
-
/**
|
|
22
|
+
/** An icon to display instead of the default icon. */
|
|
23
|
+
menuButtonIcon?: IconProps['svg'];
|
|
24
|
+
/** The visible text for the menu button. */
|
|
21
25
|
menuButtonText?: string;
|
|
26
|
+
/** The text for screen readers when the button hides the menu. */
|
|
27
|
+
menuButtonTextForHide?: string;
|
|
28
|
+
/** The text for screen readers when the button shows the menu. */
|
|
29
|
+
menuButtonTextForShow?: string;
|
|
22
30
|
/** A slot for the menu items. Use PageHeader.MenuLink here. */
|
|
23
31
|
menuItems?: ReactNode;
|
|
24
32
|
/** The accessible label for the navigation section. */
|
|
@@ -35,15 +43,21 @@ export declare const PageHeader: import("react").ForwardRefExoticComponent<{
|
|
|
35
43
|
/** The accessible name of the logo. */
|
|
36
44
|
logoAccessibleName?: string;
|
|
37
45
|
/** The name of the brand for which to display the logo. */
|
|
38
|
-
logoBrand?: LogoBrand;
|
|
46
|
+
logoBrand?: LogoBrand | LogoBrandConfig;
|
|
39
47
|
/** The url for the link on the logo. */
|
|
40
48
|
logoLink?: string;
|
|
41
49
|
/** The React component to use for the logo link. */
|
|
42
50
|
logoLinkComponent?: ComponentType<AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
43
51
|
/** The accessible text for the link on the logo. */
|
|
44
52
|
logoLinkTitle?: string;
|
|
45
|
-
/**
|
|
53
|
+
/** An icon to display instead of the default icon. */
|
|
54
|
+
menuButtonIcon?: IconProps["svg"];
|
|
55
|
+
/** The visible text for the menu button. */
|
|
46
56
|
menuButtonText?: string;
|
|
57
|
+
/** The text for screen readers when the button hides the menu. */
|
|
58
|
+
menuButtonTextForHide?: string;
|
|
59
|
+
/** The text for screen readers when the button shows the menu. */
|
|
60
|
+
menuButtonTextForShow?: string;
|
|
47
61
|
/** A slot for the menu items. Use PageHeader.MenuLink here. */
|
|
48
62
|
menuItems?: ReactNode;
|
|
49
63
|
/** The accessible label for the navigation section. */
|
|
@@ -54,7 +68,7 @@ export declare const PageHeader: import("react").ForwardRefExoticComponent<{
|
|
|
54
68
|
GridCellNarrowWindowOnly: import("react").ForwardRefExoticComponent<import("..").GridCellProps & import("react").RefAttributes<HTMLElement>>;
|
|
55
69
|
MenuLink: import("react").ForwardRefExoticComponent<{
|
|
56
70
|
fixed?: boolean;
|
|
57
|
-
icon?:
|
|
71
|
+
icon?: IconProps["svg"];
|
|
58
72
|
} & AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
59
73
|
children?: ReactNode | undefined;
|
|
60
74
|
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
@@ -8,7 +8,7 @@ import { PageHeaderGridCellNarrowWindowOnly } from './PageHeaderGridCellNarrowWi
|
|
|
8
8
|
import { PageHeaderMenuIcon } from './PageHeaderMenuIcon';
|
|
9
9
|
import { PageHeaderMenuLink } from './PageHeaderMenuLink';
|
|
10
10
|
const LogoLinkContent = ({ brandName, logoAccessibleName, logoBrand, }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: clsx(logoBrand === 'amsterdam' && Boolean(brandName) && 'ams-page-header__logo-container'), children: _jsx(Logo, { "aria-label": logoAccessibleName, brand: logoBrand }) }), brandName && (_jsx("span", { "aria-hidden": "true", className: "ams-page-header__brand-name", children: brandName }))] }));
|
|
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', menuItems, navigationLabel = 'Hoofdnavigatie', noMenuButtonOnWideWindow, ...restProps }, ref) => {
|
|
11
|
+
const PageHeaderRoot = forwardRef(({ brandName, children, className, logoAccessibleName, logoBrand = 'amsterdam', logoLink = '/', logoLinkComponent = (props) => _jsx("a", { ...props }), logoLinkTitle = `Ga naar de homepage${brandName ? ` van ${brandName}` : ''}`, menuButtonIcon, menuButtonText = 'Menu', menuButtonTextForHide = 'Verberg navigatiemenu', menuButtonTextForShow = 'Laat navigatiemenu zien', menuItems, navigationLabel = 'Hoofdnavigatie', noMenuButtonOnWideWindow, ...restProps }, ref) => {
|
|
12
12
|
const [open, setOpen] = useState(false);
|
|
13
13
|
const Link = logoLinkComponent;
|
|
14
14
|
const hasMegaMenu = Boolean(children);
|
|
@@ -19,7 +19,8 @@ const PageHeaderRoot = forwardRef(({ brandName, children, className, logoAccessi
|
|
|
19
19
|
setOpen(false);
|
|
20
20
|
}
|
|
21
21
|
}, [isWideWindow]);
|
|
22
|
-
return (_jsxs("header", { ...restProps, className: clsx('ams-page-header', className), ref: ref, children: [_jsxs(Link, { className: "ams-page-header__logo-link", href: logoLink, children: [_jsx(LogoLinkContent, { brandName: brandName, logoAccessibleName: logoAccessibleName, logoBrand: logoBrand }), _jsx("span", { className: "ams-visually-hidden", children: ` ${logoLinkTitle}` })] }), (hasMegaMenu || menuItems) && (_jsxs("nav", { "aria-labelledby": "primary-navigation", className: "ams-page-header__navigation", children: [_jsx("h2", { "aria-hidden": true, className: "ams-visually-hidden", id: "primary-navigation", children: navigationLabel }), _jsx("div", { "aria-hidden": true, className: "ams-page-header__logo-link ams-page-header__logo-link--hidden", hidden: true, children: _jsx(LogoLinkContent, { brandName: brandName, logoBrand: logoBrand }) }), _jsxs("ul", { className: "ams-page-header__menu", children: [menuItems, hasMegaMenu && (_jsx("li", { className: clsx(
|
|
22
|
+
return (_jsxs("header", { ...restProps, className: clsx('ams-page-header', className), ref: ref, children: [_jsxs(Link, { className: "ams-page-header__logo-link", href: logoLink, children: [_jsx(LogoLinkContent, { brandName: brandName, logoAccessibleName: logoAccessibleName, logoBrand: logoBrand }), _jsx("span", { className: "ams-visually-hidden", children: ` ${logoLinkTitle}` })] }), (hasMegaMenu || menuItems) && (_jsxs("nav", { "aria-labelledby": "primary-navigation", className: "ams-page-header__navigation", children: [_jsx("h2", { "aria-hidden": true, className: "ams-visually-hidden", id: "primary-navigation", children: navigationLabel }), _jsx("div", { "aria-hidden": true, className: "ams-page-header__logo-link ams-page-header__logo-link--hidden", hidden: true, children: _jsx(LogoLinkContent, { brandName: brandName, logoBrand: logoBrand }) }), _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.
|
|
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("span", { "aria-hidden": "true", className: "ams-page-header__mega-menu-button-hidden-label", children: menuButtonText }), _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 }))] }))] }));
|
|
23
24
|
});
|
|
24
25
|
PageHeaderRoot.displayName = 'PageHeader';
|
|
25
26
|
/**
|
|
@@ -2,5 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { Grid } from '../Grid';
|
|
5
|
-
export const PageHeaderGridCellNarrowWindowOnly = forwardRef(({ children, className, ...restProps }, ref) => (_jsx(Grid.Cell, { ...restProps, className: clsx('ams-page-header__grid-cell-narrow-window-only', className),
|
|
5
|
+
export const PageHeaderGridCellNarrowWindowOnly = forwardRef(({ children, className, ...restProps }, ref) => (_jsx(Grid.Cell, { ...restProps, className: clsx('ams-page-header__grid-cell-narrow-window-only', className), hidden // Hide until its CSS loads; this cell duplicates the non-fixed links in the Page Header Menu.
|
|
6
|
+
: true, ref: ref, children: children })));
|
|
6
7
|
PageHeaderGridCellNarrowWindowOnly.displayName = 'PageHeader.GridCellNarrowWindowOnly';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 Robbert Broersma
|
|
4
4
|
* Copyright Gemeente Amsterdam
|
|
5
5
|
*/
|
|
6
|
-
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
import type { HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
|
|
7
7
|
export type ParagraphProps = {
|
|
8
8
|
/** Changes the text colour for readability on a dark background. */
|
|
9
9
|
color?: 'inverse';
|
|
@@ -19,5 +19,5 @@ export declare const Paragraph: import("react").ForwardRefExoticComponent<{
|
|
|
19
19
|
/** The size of the text. */
|
|
20
20
|
size?: "small" | "large";
|
|
21
21
|
} & HTMLAttributes<HTMLParagraphElement> & {
|
|
22
|
-
children?:
|
|
22
|
+
children?: ReactNode | undefined;
|
|
23
23
|
} & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
+
const wrapChildren = (size, children) => {
|
|
5
|
+
if (size === 'large')
|
|
6
|
+
return _jsx("b", { className: "ams-paragraph__b", children: children });
|
|
7
|
+
if (size === 'small')
|
|
8
|
+
return _jsx("small", { className: "ams-paragraph__small", children: children });
|
|
9
|
+
return children;
|
|
10
|
+
};
|
|
4
11
|
/**
|
|
5
12
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-text-paragraph--docs Paragraph docs at Amsterdam Design System}
|
|
6
13
|
*/
|
|
7
|
-
export const Paragraph = forwardRef(({ children, className, color, size, ...restProps }, ref) => (_jsx("p", { className: clsx('ams-paragraph', color && `ams-paragraph--${color}`, size && `ams-paragraph--${size}`, className), ref: ref, ...restProps, children: children })));
|
|
14
|
+
export const Paragraph = forwardRef(({ children, className, color, size, ...restProps }, ref) => (_jsx("p", { className: clsx('ams-paragraph', color && `ams-paragraph--${color}`, size && `ams-paragraph--${size}`, className), ref: ref, ...restProps, children: wrapChildren(size, children) })));
|
|
8
15
|
Paragraph.displayName = 'Paragraph';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export declare const progressListHeadingSizes: (2 | 3 | 4)[];
|
|
7
|
+
type ProgressListHeadingSize = (typeof progressListHeadingSizes)[number];
|
|
8
|
+
export type ProgressListProps = {
|
|
9
|
+
/**
|
|
10
|
+
* The hierarchical level of this Progress List’s Headings within the document.
|
|
11
|
+
* There is no default value; determine the correct level for this instance.
|
|
12
|
+
*/
|
|
13
|
+
headingLevel: ProgressListHeadingSize;
|
|
14
|
+
} & PropsWithChildren<HTMLAttributes<HTMLOListElement>>;
|
|
15
|
+
/**
|
|
16
|
+
* @see {@link https://designsystem.amsterdam/?path=/docs/components-containers-progress-list--docs Progress List docs at Amsterdam Design System}
|
|
17
|
+
*/
|
|
18
|
+
export declare const ProgressList: import("react").ForwardRefExoticComponent<{
|
|
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: ProgressListHeadingSize;
|
|
24
|
+
} & HTMLAttributes<HTMLOListElement> & {
|
|
25
|
+
children?: import("react").ReactNode | undefined;
|
|
26
|
+
} & import("react").RefAttributes<HTMLOListElement>> & {
|
|
27
|
+
Step: import("react").ForwardRefExoticComponent<{
|
|
28
|
+
hasSubsteps?: boolean;
|
|
29
|
+
heading: string;
|
|
30
|
+
status?: "current" | "completed";
|
|
31
|
+
} & HTMLAttributes<HTMLElement> & {
|
|
32
|
+
children?: import("react").ReactNode | undefined;
|
|
33
|
+
} & import("react").RefAttributes<HTMLLIElement>>;
|
|
34
|
+
Substep: import("react").ForwardRefExoticComponent<{
|
|
35
|
+
status?: import("./ProgressListStep").ProgressListStepProps["status"];
|
|
36
|
+
} & HTMLAttributes<HTMLElement> & {
|
|
37
|
+
children?: import("react").ReactNode | undefined;
|
|
38
|
+
} & import("react").RefAttributes<HTMLLIElement>>;
|
|
39
|
+
Substeps: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLOListElement> & {
|
|
40
|
+
children?: import("react").ReactNode | undefined;
|
|
41
|
+
} & import("react").RefAttributes<HTMLOListElement>>;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { headingSizes } 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 progressListHeadingSizes = headingSizes.filter((size) => size !== 1);
|
|
10
|
+
const ProgressListRoot = forwardRef(({ children, className, headingLevel, ...restProps }, ref) => (_jsx(ProgressListContext.Provider, { value: { headingLevel: headingLevel }, children: _jsx("ol", { ...restProps, className: clsx('ams-progress-list', `ams-progress-list--heading-${headingLevel}`, className), ref: ref, children: children }) })));
|
|
11
|
+
/**
|
|
12
|
+
* @see {@link https://designsystem.amsterdam/?path=/docs/components-containers-progress-list--docs Progress List docs at Amsterdam Design System}
|
|
13
|
+
*/
|
|
14
|
+
export const ProgressList = Object.assign(ProgressListRoot, {
|
|
15
|
+
Step: ProgressListStep,
|
|
16
|
+
Substep: ProgressListSubstep,
|
|
17
|
+
Substeps: ProgressListSubsteps,
|
|
18
|
+
});
|
|
19
|
+
ProgressListRoot.displayName = 'ProgressList';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { ProgressListProps } from './ProgressList';
|
|
6
|
+
type ProgressListContextValue = {
|
|
7
|
+
headingLevel: ProgressListProps['headingLevel'];
|
|
8
|
+
};
|
|
9
|
+
export declare const ProgressListContext: import("react").Context<ProgressListContextValue>;
|
|
10
|
+
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,12 @@
|
|
|
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 { ProgressListContext } from './ProgressListContext';
|
|
8
|
+
export const ProgressListStep = forwardRef(({ children, className, hasSubsteps, heading, status, ...restProps }, ref) => {
|
|
9
|
+
const { headingLevel } = useContext(ProgressListContext);
|
|
10
|
+
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: [_jsx(Heading, { className: "ams-progress-list__heading", level: headingLevel, children: heading }), children] })] }));
|
|
11
|
+
});
|
|
12
|
+
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,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
export const ProgressListSubstep = forwardRef(({ children, className, status, ...restProps }, ref) => {
|
|
5
|
+
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" })] }), _jsx("div", { className: "ams-progress-list-substeps__content", children: children })] }));
|
|
6
|
+
});
|
|
7
|
+
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>>;
|
package/dist/Row/Row.d.ts
CHANGED
|
@@ -66,5 +66,5 @@ export declare const Row: import("react").ForwardRefExoticComponent<{
|
|
|
66
66
|
wrap?: boolean;
|
|
67
67
|
} & HTMLAttributes<HTMLElement> & {
|
|
68
68
|
children?: import("react").ReactNode | undefined;
|
|
69
|
-
} & import("react").RefAttributes<
|
|
69
|
+
} & import("react").RefAttributes<any>>;
|
|
70
70
|
export {};
|
|
@@ -23,5 +23,5 @@ export declare const Spotlight: import("react").ForwardRefExoticComponent<{
|
|
|
23
23
|
color?: SpotlightColor;
|
|
24
24
|
} & HTMLAttributes<HTMLElement> & {
|
|
25
25
|
children?: import("react").ReactNode | undefined;
|
|
26
|
-
} & import("react").RefAttributes<
|
|
26
|
+
} & import("react").RefAttributes<any>>;
|
|
27
27
|
export {};
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
export declare const BREAKPOINTS: {
|
|
6
|
-
medium:
|
|
7
|
-
wide:
|
|
6
|
+
readonly medium: "37.5rem";
|
|
7
|
+
readonly wide: "72.5rem";
|
|
8
8
|
};
|
|
9
|
-
type
|
|
10
|
-
declare const useIsAfterBreakpoint: (breakpoint:
|
|
9
|
+
type Breakpoint = keyof typeof BREAKPOINTS;
|
|
10
|
+
declare const useIsAfterBreakpoint: (breakpoint: Breakpoint) => boolean;
|
|
11
11
|
export default useIsAfterBreakpoint;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license EUPL-1.2+
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
6
|
// TODO: we should set the breakpoint in JS somewhere and render this and the sass variables from that
|
|
7
7
|
export const BREAKPOINTS = {
|
|
8
8
|
medium: '37.5rem',
|
|
@@ -10,19 +10,18 @@ export const BREAKPOINTS = {
|
|
|
10
10
|
};
|
|
11
11
|
const useIsAfterBreakpoint = (breakpoint) => {
|
|
12
12
|
const [matches, setMatches] = useState(false);
|
|
13
|
-
|
|
13
|
+
useEffect(() => {
|
|
14
14
|
// Check for window object to avoid SSR issues
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}, [matches, breakpoint]);
|
|
15
|
+
if (typeof window === 'undefined')
|
|
16
|
+
return undefined;
|
|
17
|
+
const query = `(min-width: ${BREAKPOINTS[breakpoint]})`;
|
|
18
|
+
const media = window.matchMedia(query);
|
|
19
|
+
const listener = () => setMatches(media.matches);
|
|
20
|
+
// Set initial state
|
|
21
|
+
setMatches(media.matches);
|
|
22
|
+
media.addEventListener('change', listener);
|
|
23
|
+
return () => media.removeEventListener('change', listener);
|
|
24
|
+
}, [breakpoint]);
|
|
26
25
|
return matches;
|
|
27
26
|
};
|
|
28
27
|
export default useIsAfterBreakpoint;
|