@amsterdam/design-system-react 3.1.0 → 3.2.1
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 +2 -2
- 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 +6 -2
- package/dist/ImageSlider/ImageSlider.js +2 -4
- package/dist/ImageSlider/ImageSliderSlide.d.ts +14 -0
- package/dist/ImageSlider/ImageSliderSlide.js +19 -0
- package/dist/ImageSlider/ImageSliderThumbnails.d.ts +1 -1
- package/dist/ImageSlider/ImageSliderThumbnails.js +2 -2
- 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 +10 -0
- 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 +24 -4
- package/dist/ProgressList/ProgressList.js +7 -3
- package/dist/ProgressList/ProgressListContext.d.ts +2 -0
- package/dist/ProgressList/ProgressListStep.js +2 -1
- package/dist/ProgressList/ProgressListSubstep.js +2 -1
- 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 +1993 -2299
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +45 -11
- package/dist/index.esm.js +1993 -2299
- package/dist/index.esm.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +16 -18
- package/dist/PageHeader/matchMedia.mock.d.ts +0 -4
- package/dist/PageHeader/matchMedia.mock.js +0 -19
- package/dist/common/useIsAfterBreakpoint.d.ts +0 -11
|
@@ -4,7 +4,7 @@ import { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
|
4
4
|
import { useKeyboardFocus } from '../common/useKeyboardFocus';
|
|
5
5
|
import { AccordionContext } from './AccordionContext';
|
|
6
6
|
import { AccordionSection } from './AccordionSection';
|
|
7
|
-
const AccordionRoot = forwardRef(({ children, className, headingLevel, sectionAs = 'section' }, ref) => {
|
|
7
|
+
const AccordionRoot = forwardRef(({ children, className, headingLevel, sectionAs = 'section', ...restProps }, ref) => {
|
|
8
8
|
const innerRef = useRef(null);
|
|
9
9
|
// use a passed ref if it's there, otherwise use innerRef
|
|
10
10
|
useImperativeHandle(ref, () => innerRef.current);
|
|
@@ -12,7 +12,7 @@ const AccordionRoot = forwardRef(({ children, className, headingLevel, sectionAs
|
|
|
12
12
|
focusableElements: ['.ams-accordion__button:not([disabled])'],
|
|
13
13
|
rotating: true,
|
|
14
14
|
});
|
|
15
|
-
return (_jsx(AccordionContext.Provider, { value: { headingLevel: headingLevel, sectionAs: sectionAs }, children: _jsx("div", { className: clsx('ams-accordion', className), onKeyDown: keyDown, ref: innerRef, children: children }) }));
|
|
15
|
+
return (_jsx(AccordionContext.Provider, { value: { headingLevel: headingLevel, sectionAs: sectionAs }, children: _jsx("div", { ...restProps, className: clsx('ams-accordion', className), onKeyDown: keyDown, ref: innerRef, children: children }) }));
|
|
16
16
|
});
|
|
17
17
|
AccordionRoot.displayName = 'Accordion';
|
|
18
18
|
/**
|
|
@@ -6,5 +6,5 @@ import { Icon } from '../Icon';
|
|
|
6
6
|
/**
|
|
7
7
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-error-message--docs Error Message docs at Amsterdam Design System}
|
|
8
8
|
*/
|
|
9
|
-
export const ErrorMessage = forwardRef(({ children, className, icon = WarningIcon, prefix = 'Invoerfout', ...restProps }, ref) => (_jsxs("p", { ...restProps, className: clsx('ams-error-message', className), ref: ref, children: [_jsx(Icon, { svg: icon }), _jsx("span", { className: "ams-visually-hidden", children: `${prefix}: ` }), children] })));
|
|
9
|
+
export const ErrorMessage = forwardRef(({ children, className, icon = WarningIcon, prefix = 'Invoerfout', ...restProps }, ref) => (_jsxs("p", { ...restProps, className: clsx('ams-error-message', className), ref: ref, children: [_jsx(Icon, { svg: icon }), prefix && _jsx("span", { className: "ams-visually-hidden", children: `${prefix}: ` }), children] })));
|
|
10
10
|
ErrorMessage.displayName = 'ErrorMessage';
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Copyright Gemeente Amsterdam
|
|
5
5
|
*/
|
|
6
6
|
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
7
|
-
export declare const
|
|
8
|
-
type
|
|
7
|
+
export declare const headingLevels: readonly [1, 2, 3, 4];
|
|
8
|
+
type HeadingLevel = (typeof headingLevels)[number];
|
|
9
9
|
export type HeadingProps = {
|
|
10
10
|
/** Changes the text colour for readability on a dark background. */
|
|
11
11
|
color?: 'inverse';
|
|
12
12
|
/** The hierarchical level within the document. */
|
|
13
|
-
level:
|
|
13
|
+
level: HeadingLevel;
|
|
14
14
|
/**
|
|
15
15
|
* Uses larger or smaller text without changing its position in the heading hierarchy.
|
|
16
16
|
* The value ‘level-6’ is deprecated. Use level 5 instead.
|
|
@@ -24,7 +24,7 @@ export declare const Heading: import("react").ForwardRefExoticComponent<{
|
|
|
24
24
|
/** Changes the text colour for readability on a dark background. */
|
|
25
25
|
color?: "inverse";
|
|
26
26
|
/** The hierarchical level within the document. */
|
|
27
|
-
level:
|
|
27
|
+
level: HeadingLevel;
|
|
28
28
|
/**
|
|
29
29
|
* Uses larger or smaller text without changing its position in the heading hierarchy.
|
|
30
30
|
* The value ‘level-6’ is deprecated. Use level 5 instead.
|
package/dist/Heading/Heading.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { getHeadingTag } from './getHeadingTag';
|
|
5
|
-
export const
|
|
5
|
+
export const headingLevels = [1, 2, 3, 4];
|
|
6
6
|
/**
|
|
7
7
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-text-heading--docs Heading docs at Amsterdam Design System}
|
|
8
8
|
*/
|
|
@@ -4,13 +4,17 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { HTMLAttributes } from 'react';
|
|
6
6
|
import type { ImageProps } from '../Image/Image';
|
|
7
|
+
export type ImageSliderImageProps = {
|
|
8
|
+
/** An optional caption displayed below the image. */
|
|
9
|
+
caption?: string;
|
|
10
|
+
} & ImageProps;
|
|
7
11
|
export type ImageSliderProps = {
|
|
8
12
|
/** Display buttons to navigate to the previous or next image. */
|
|
9
13
|
controls?: boolean;
|
|
10
14
|
/** Label for the image if you need to translate the alt text. */
|
|
11
15
|
imageLabel?: string;
|
|
12
16
|
/** The set of images to display. */
|
|
13
|
-
images:
|
|
17
|
+
images: ImageSliderImageProps[];
|
|
14
18
|
/** The label for the ‘next’ button */
|
|
15
19
|
nextLabel?: string;
|
|
16
20
|
/** The label for the ‘previous’ button */
|
|
@@ -25,7 +29,7 @@ export declare const ImageSlider: import("react").ForwardRefExoticComponent<{
|
|
|
25
29
|
/** Label for the image if you need to translate the alt text. */
|
|
26
30
|
imageLabel?: string;
|
|
27
31
|
/** The set of images to display. */
|
|
28
|
-
images:
|
|
32
|
+
images: ImageSliderImageProps[];
|
|
29
33
|
/** The label for the ‘next’ button */
|
|
30
34
|
nextLabel?: string;
|
|
31
35
|
/** The label for the ‘previous’ button */
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ChevronBackwardIcon, ChevronForwardIcon } from '@amsterdam/design-system-react-icons';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { forwardRef, useEffect, useRef, useState } from 'react';
|
|
5
|
-
import { Image } from '../Image/Image';
|
|
6
5
|
import { ImageSliderControl } from './ImageSliderControl';
|
|
6
|
+
import { ImageSliderSlide } from './ImageSliderSlide';
|
|
7
7
|
import { ImageSliderThumbnails } from './ImageSliderThumbnails';
|
|
8
8
|
import { debounce, scrollToCurrentSlideOnResize, scrollToSlide, setCurrentSlideIdToVisibleSlide } from './utils';
|
|
9
9
|
/**
|
|
@@ -35,8 +35,6 @@ export const ImageSlider = forwardRef(({ className, controls, imageLabel = 'Afbe
|
|
|
35
35
|
}, [currentSlideId]);
|
|
36
36
|
return (_jsxs("div", { ...restProps, "aria-roledescription": "carousel", className: clsx('ams-image-slider',
|
|
37
37
|
// The 'ams-image-slider--controls' class is @deprecated and will be removed in a future release.
|
|
38
|
-
controls && 'ams-image-slider--controls', className), ref: ref, children: [controls && (_jsxs("div", { className: "ams-image-slider__controls", children: [_jsx(ImageSliderControl, { disabled: isAtStart, icon: ChevronBackwardIcon, iconOnly: true, onClick: () => scrollToSlide(currentSlideId - 1, scrollerRef), children: previousLabel }), _jsx(ImageSliderControl, { disabled: isAtEnd, icon: ChevronForwardIcon, iconOnly: true, onClick: () => scrollToSlide(currentSlideId + 1, scrollerRef), children: nextLabel })] })), _jsx("div", { "aria-live": "polite", className: "ams-image-slider__scroller", ref: scrollerRef, role: "group", tabIndex: 0, children: images.map((
|
|
39
|
-
// The 'ams-image-slider__item--in-view' class is @deprecated and will be removed in a future release.
|
|
40
|
-
index === currentSlideId && 'ams-image-slider__item--in-view'), sizes: sizes, src: src, srcSet: srcSet }, `${index}-${src}`))) }), _jsx(ImageSliderThumbnails, { currentSlideId: currentSlideId, imageLabel: imageLabel, scrollToSlide: (id) => scrollToSlide(id, scrollerRef), thumbnails: images })] }));
|
|
38
|
+
controls && 'ams-image-slider--controls', className), ref: ref, children: [controls && (_jsxs("div", { className: "ams-image-slider__controls", children: [_jsx(ImageSliderControl, { disabled: isAtStart, icon: ChevronBackwardIcon, iconOnly: true, onClick: () => scrollToSlide(currentSlideId - 1, scrollerRef), children: previousLabel }), _jsx(ImageSliderControl, { disabled: isAtEnd, icon: ChevronForwardIcon, iconOnly: true, onClick: () => scrollToSlide(currentSlideId + 1, scrollerRef), children: nextLabel })] })), _jsx("div", { "aria-live": "polite", className: "ams-image-slider__scroller", ref: scrollerRef, role: "group", tabIndex: 0, children: images.map((image, index) => (_jsx(ImageSliderSlide, { ...image, currentSlideId: currentSlideId, index: index }, `${index}-${image.src}`))) }), _jsx(ImageSliderThumbnails, { currentSlideId: currentSlideId, imageLabel: imageLabel, scrollToSlide: (id) => scrollToSlide(id, scrollerRef), thumbnails: images })] }));
|
|
41
39
|
});
|
|
42
40
|
ImageSlider.displayName = 'ImageSlider';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { ImageSliderImageProps } from './ImageSlider';
|
|
6
|
+
type ImageSliderSlideProps = {
|
|
7
|
+
currentSlideId: number;
|
|
8
|
+
index: number;
|
|
9
|
+
} & ImageSliderImageProps;
|
|
10
|
+
export declare const ImageSliderSlide: {
|
|
11
|
+
({ alt, aspectRatio, caption, className, currentSlideId, index, sizes, src, srcSet, ...restProps }: ImageSliderSlideProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, 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 { Figure } from '../Figure/Figure';
|
|
8
|
+
import { Image } from '../Image/Image';
|
|
9
|
+
export const ImageSliderSlide = ({ alt, aspectRatio, caption, className, currentSlideId, index, sizes, src, srcSet, ...restProps }) => {
|
|
10
|
+
const isCurrentSlide = index === currentSlideId;
|
|
11
|
+
const slideProps = {
|
|
12
|
+
'aria-hidden': isCurrentSlide ? undefined : true,
|
|
13
|
+
// The `ams-image-slider__item` and `ams-image-slider__item--in-view` classes are @deprecated and will be removed in a future release.
|
|
14
|
+
className: clsx('ams-image-slider__slide ams-image-slider__item', isCurrentSlide && 'ams-image-slider__item--in-view', className),
|
|
15
|
+
};
|
|
16
|
+
const imageProps = { alt, aspectRatio, sizes, src, srcSet };
|
|
17
|
+
return caption ? (_jsxs(Figure, { ...restProps, ...slideProps, className: clsx(slideProps.className, 'ams-image-slider__figure'), children: [_jsx(Image, { ...imageProps }), _jsx(Figure.Caption, { className: "ams-image-slider__caption", children: caption })] })) : (_jsx(Image, { ...restProps, ...imageProps, ...slideProps }));
|
|
18
|
+
};
|
|
19
|
+
ImageSliderSlide.displayName = 'ImageSliderSlide';
|
|
@@ -10,4 +10,4 @@ export type ImageSliderThumbnailsProps = {
|
|
|
10
10
|
scrollToSlide: (id: number) => void;
|
|
11
11
|
thumbnails: ImageSliderProps['images'];
|
|
12
12
|
} & HTMLAttributes<HTMLElement>;
|
|
13
|
-
export declare const ImageSliderThumbnails: ({ currentSlideId, imageLabel, scrollToSlide, thumbnails, }: ImageSliderThumbnailsProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const ImageSliderThumbnails: ({ currentSlideId, imageLabel, scrollToSlide, thumbnails, ...restProps }: ImageSliderThumbnailsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { generateAspectRatioClass } from '../Image/generateAspectRatioClass';
|
|
4
|
-
export const ImageSliderThumbnails = ({ currentSlideId, imageLabel, scrollToSlide, thumbnails, }) => {
|
|
4
|
+
export const ImageSliderThumbnails = ({ currentSlideId, imageLabel, scrollToSlide, thumbnails, ...restProps }) => {
|
|
5
5
|
const handleKeyDown = (event) => {
|
|
6
6
|
const element = event.currentTarget.children[currentSlideId];
|
|
7
7
|
if (event.key === 'ArrowRight') {
|
|
@@ -19,5 +19,5 @@ export const ImageSliderThumbnails = ({ currentSlideId, imageLabel, scrollToSlid
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
return (_jsx("nav", { className: "ams-image-slider__thumbnails", onKeyDown: handleKeyDown, role: "tablist", children: thumbnails.map(({ alt, aspectRatio, src }, index) => (_jsx("button", { "aria-label": `${imageLabel} ${index + 1}: ${alt}`, "aria-posinset": index + 1, "aria-selected": currentSlideId === index ? 'true' : 'false', "aria-setsize": thumbnails.length, className: clsx('ams-image-slider__thumbnail', currentSlideId === index && 'ams-image-slider__thumbnail--in-view', generateAspectRatioClass(aspectRatio)), onClick: () => scrollToSlide(index), role: "tab", style: { backgroundImage: `url(${src})` }, tabIndex: currentSlideId === index ? 0 : -1, type: "button" }, `${index}-${src}`))) }));
|
|
22
|
+
return (_jsx("nav", { ...restProps, className: "ams-image-slider__thumbnails", onKeyDown: handleKeyDown, role: "tablist", children: thumbnails.map(({ alt, aspectRatio, src }, index) => (_jsx("button", { "aria-label": `${imageLabel} ${index + 1}: ${alt}`, "aria-posinset": index + 1, "aria-selected": currentSlideId === index ? 'true' : 'false', "aria-setsize": thumbnails.length, className: clsx('ams-image-slider__thumbnail', currentSlideId === index && 'ams-image-slider__thumbnail--in-view', generateAspectRatioClass(aspectRatio)), onClick: () => scrollToSlide(index), role: "tab", style: { backgroundImage: `url(${src})` }, tabIndex: currentSlideId === index ? 0 : -1, type: "button" }, `${index}-${src}`))) }));
|
|
23
23
|
};
|
package/dist/Logo/Logo.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { ComponentType, SVGProps } from 'react';
|
|
6
|
-
export declare const logoBrands: readonly ["amsterdam", "ggd-amsterdam", "museum-weesp", "stadsarchief", "stadsbank-van-lening", "vga-verzekeringen"];
|
|
6
|
+
export declare const logoBrands: readonly ["amsterdam", "amsterdam-english", "ggd-amsterdam", "museum-weesp", "stadsarchief", "stadsbank-van-lening", "vga-verzekeringen"];
|
|
7
7
|
export type LogoBrand = (typeof logoBrands)[number];
|
|
8
8
|
export type LogoProps = {
|
|
9
9
|
/** The name of the brand for which to display the logo, or configuration for a custom logo. */
|
package/dist/Logo/Logo.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import { LogoAmsterdam, LogoGgdAmsterdam, LogoMuseumWeesp, LogoStadsarchief, LogoStadsbankVanLening, LogoVgaVerzekeringen, } from './brand';
|
|
4
|
+
import { LogoAmsterdam, LogoAmsterdamEnglish, LogoGgdAmsterdam, LogoMuseumWeesp, LogoStadsarchief, LogoStadsbankVanLening, LogoVgaVerzekeringen, } from './brand';
|
|
5
5
|
export const logoBrands = [
|
|
6
6
|
'amsterdam',
|
|
7
|
+
'amsterdam-english',
|
|
7
8
|
'ggd-amsterdam',
|
|
8
9
|
'museum-weesp',
|
|
9
10
|
'stadsarchief',
|
|
@@ -15,6 +16,10 @@ const logoConfig = {
|
|
|
15
16
|
label: 'Gemeente Amsterdam logo',
|
|
16
17
|
svg: LogoAmsterdam,
|
|
17
18
|
},
|
|
19
|
+
'amsterdam-english': {
|
|
20
|
+
label: 'City of Amsterdam logo',
|
|
21
|
+
svg: LogoAmsterdamEnglish,
|
|
22
|
+
},
|
|
18
23
|
'ggd-amsterdam': {
|
|
19
24
|
label: 'GGD Amsterdam logo',
|
|
20
25
|
svg: LogoGgdAmsterdam,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { SVGProps } from 'react';
|
|
6
|
+
declare const LogoAmsterdamEnglish: import("react").ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
7
|
+
export default LogoAmsterdamEnglish;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
const LogoAmsterdamEnglish = forwardRef((props, ref) => (_jsxs("svg", { className: "ams-logo", focusable: "false", height: "2.5rem" // Height for when CSS does not load, gets overridden when it does
|
|
4
|
+
, ref: ref, role: "img", viewBox: "0 0 115 40", xmlns: "http://www.w3.org/2000/svg", ...props, children: [_jsx("path", { className: "ams-logo__emblem", d: "m0 37.683 3.532-3.532L0 30.62l2.355-2.355 3.532 3.532 3.532-3.532 2.355 2.355-3.532 3.532 3.532 3.532L9.419 40l-3.532-3.532-3.532 3.532zM0 9.406l3.532-3.532-3.532-3.532L2.355-0.013l3.532 3.532 3.532-3.532 2.355 2.354-3.532 3.532 3.532 3.532-2.355 2.355-3.532-3.532L2.355 11.76zM0 23.557l3.532-3.532L0 16.493l2.355-2.355 3.532 3.532 3.532-3.532 2.355 2.355-3.532 3.532 3.532 3.532-2.355 2.355-3.532-3.532L2.355 25.911z", fill: "#EC0000" }), _jsx("path", { className: "ams-logo__text-primary", d: "M16.456 8.579c0-3.795 2.613-6.408 6.389-6.408 1.812 0 3.376 0.648 4.558 1.869l-1.659 1.602c-0.706-0.801-1.717-1.24-2.88-1.24-2.251 0-3.815 1.717-3.815 4.196 0 2.46 1.583 4.196 3.834 4.196 1.183 0 2.27-0.458 2.956-1.24l1.64 1.583c-1.125 1.221-2.746 1.888-4.616 1.888-3.776 0-6.408-2.632-6.408-6.447M30.455 4.174c-0.82 0-1.411-0.572-1.411-1.373s0.591-1.373 1.411-1.373c0.82 0 1.411 0.572 1.411 1.373s-0.591 1.373-1.411 1.373m-1.183 1.202h2.365V14.797h-2.365zM34.803 11.421V7.34h-1.621v-1.965h0.858c0.782 0 1.087-0.305 1.087-1.087V2.819h2.022v2.556h2.289v1.965h-2.289v4.082c0 0.915 0.477 1.43 1.354 1.43 0.267 0 0.591-0.038 0.782-0.095v1.984c-0.286 0.076-0.82 0.133-1.24 0.133-2.136 0-3.242-1.182-3.242-3.452M40.983 17.048l1.488-1.488c0.534 0.629 1.335 0.954 2.346 0.954 1.392 0 2.213-0.801 2.213-2.155v-1.411h-0.038c-0.42 0.935-1.278 1.507-2.327 1.507-2.308 0-3.49-1.335-3.49-3.948V5.375h2.365v4.692c0 1.583 0.553 2.327 1.698 2.327 1.163 0 1.812-0.858 1.812-2.384V5.375h2.365V14.454c0 2.518-1.774 4.101-4.558 4.101-1.717 0-3.033-0.515-3.872-1.507M56.126 10.086c0-2.88 2.098-4.94 5.016-4.94 2.918 0 5.016 2.06 5.016 4.94S64.06 15.026 61.142 15.026c-2.918 0-5.016-2.06-5.016-4.94m5.016 2.88c1.526 0 2.594-1.182 2.594-2.88s-1.068-2.88-2.594-2.88c-1.526 0-2.594 1.183-2.594 2.88s1.068 2.88 2.594 2.88M68.676 7.34h-1.602v-1.965h1.602v-1.221c0-2.155 1.278-3.414 3.471-3.414 0.267 0 0.668 0.038 0.877 0.076v2.041c-0.229-0.057-0.553-0.095-0.82-0.095-0.744 0-1.163 0.496-1.163 1.392v1.221h2.289v1.965h-2.289v7.457h-2.365zM20.9 25.287h2.861l4.959 12.397h-2.651l-1.03-2.727H19.527l-1.03 2.727h-2.556zm-0.629 7.61h4.005l-1.984-5.226h-0.038zM30.284 28.262h2.212v1.278h0.038c0.477-0.973 1.316-1.507 2.403-1.507 1.221 0 2.136 0.534 2.708 1.602 0.572-1.03 1.621-1.602 2.956-1.602 2.327 0 3.452 1.297 3.452 3.948v5.703h-2.365v-5.302c0-1.545-0.534-2.289-1.64-2.289-1.106 0-1.697 0.82-1.697 2.365v5.226h-2.365v-5.302c0-1.564-0.515-2.289-1.64-2.289-1.087 0-1.697 0.839-1.697 2.365v5.226h-2.365zM48.402 33.736c-1.278-0.381-2.518-1.068-2.518-2.785 0-1.736 1.45-2.918 3.605-2.918 1.449 0 2.575 0.515 3.204 1.469l-1.354 1.354c-0.477-0.591-1.125-0.916-1.831-0.916-0.801 0-1.297 0.362-1.297 0.935 0 0.763 0.801 0.896 1.965 1.259 1.278 0.381 2.518 1.068 2.518 2.785 0 1.774-1.526 2.994-3.776 2.994-1.469 0-2.651-0.515-3.338-1.488l1.354-1.354c0.515 0.61 1.202 0.935 1.965 0.935 0.916 0 1.469-0.382 1.469-1.011 0-0.763-0.801-0.896-1.965-1.259M55.192 34.308v-4.082h-1.621v-1.965h0.858c0.782 0 1.087-0.305 1.087-1.087v-1.469h2.022v2.556h2.289v1.965h-2.289v4.082c0 0.916 0.477 1.43 1.354 1.43 0.267 0 0.591-0.038 0.782-0.095v1.984c-0.286 0.076-0.82 0.134-1.24 0.134-2.136 0-3.242-1.183-3.242-3.452M60.99 32.973c0-2.918 1.964-4.94 4.768-4.94s4.749 2.003 4.749 4.883c0 0.229-0.038 0.591-0.076 0.839h-7.057c0.172 1.278 1.259 2.136 2.651 2.136 1.03 0 1.926-0.381 2.518-1.068l1.43 1.392c-0.858 1.106-2.346 1.698-4.063 1.698-2.899 0-4.921-2.041-4.921-4.94m2.384-0.954h4.749c-0.153-1.24-1.106-2.079-2.384-2.079-1.278 0-2.231 0.839-2.365 2.079M72.472 28.262h2.231v1.564h0.038c0.458-1.068 1.297-1.64 2.403-1.64 0.286 0 0.687 0.038 0.839 0.095v2.251c-0.267-0.076-0.782-0.133-1.163-0.133-1.202 0-1.984 0.916-1.984 2.327v4.959h-2.365zM78.651 33.011c0-2.918 1.926-4.978 4.654-4.978 1.259 0 2.289 0.553 2.937 1.564h0.038V23.856h2.365v13.828h-2.232v-1.469h-0.038c-0.61 1.068-1.755 1.698-3.071 1.698-2.727 0-4.654-2.041-4.654-4.902m7.629-0.038c0-1.697-1.049-2.823-2.594-2.823-1.564 0-2.613 1.144-2.613 2.823s1.049 2.823 2.613 2.823c1.545 0 2.594-1.125 2.594-2.823M90.457 34.995c0-1.812 1.507-2.899 4.024-2.918l1.831-0.019v-0.305c0-1.106-0.706-1.678-1.984-1.678-0.839 0-1.583 0.324-2.098 0.915l-1.43-1.392c0.82-1.011 2.136-1.564 3.757-1.564 2.518 0 4.12 1.373 4.12 3.567v3.738c0 0.343 0.153 0.496 0.534 0.496h0.172v1.85h-1.106c-0.896 0-1.507-0.42-1.697-1.106h-0.038c-0.591 0.858-1.564 1.335-2.746 1.335-1.984 0-3.338-1.183-3.338-2.918m5.855-0.82v-0.534l-1.564 0.019c-1.24 0.019-1.907 0.458-1.907 1.278 0 0.725 0.572 1.24 1.373 1.24 1.24 0 2.098-0.82 2.098-2.003M101.233 28.262h2.212v1.278h0.038c0.477-0.973 1.316-1.507 2.403-1.507 1.221 0 2.136 0.534 2.708 1.602 0.572-1.03 1.621-1.602 2.956-1.602 2.327 0 3.452 1.297 3.452 3.948v5.703h-2.365v-5.302c0-1.545-0.534-2.289-1.64-2.289-1.106 0-1.698 0.82-1.698 2.365v5.226h-2.365v-5.302c0-1.564-0.515-2.289-1.64-2.289-1.087 0-1.697 0.839-1.697 2.365v5.226h-2.365z", fill: "#EC0000" })] })));
|
|
5
|
+
LogoAmsterdamEnglish.displayName = 'LogoAmsterdamEnglish';
|
|
6
|
+
export default LogoAmsterdamEnglish;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
export { default as LogoAmsterdam } from './LogoAmsterdam';
|
|
6
|
+
export { default as LogoAmsterdamEnglish } from './LogoAmsterdamEnglish';
|
|
6
7
|
export { default as LogoGgdAmsterdam } from './LogoGgdAmsterdam';
|
|
7
8
|
export { default as LogoMuseumWeesp } from './LogoMuseumWeesp';
|
|
8
9
|
export { default as LogoStadsarchief } from './LogoStadsarchief';
|
package/dist/Logo/brand/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
export { default as LogoAmsterdam } from './LogoAmsterdam';
|
|
6
|
+
export { default as LogoAmsterdamEnglish } from './LogoAmsterdamEnglish';
|
|
6
7
|
export { default as LogoGgdAmsterdam } from './LogoGgdAmsterdam';
|
|
7
8
|
export { default as LogoMuseumWeesp } from './LogoMuseumWeesp';
|
|
8
9
|
export { default as LogoStadsarchief } from './LogoStadsarchief';
|
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 }))] }));
|
|
@@ -9,6 +9,11 @@ import type { LogoBrandConfig } from '../Logo/Logo';
|
|
|
9
9
|
export type PageHeaderProps = {
|
|
10
10
|
/** The name of the application. */
|
|
11
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;
|
|
12
17
|
/** The accessible name of the logo. */
|
|
13
18
|
logoAccessibleName?: string;
|
|
14
19
|
/** The name of the brand for which to display the logo. */
|
|
@@ -40,6 +45,11 @@ export type PageHeaderProps = {
|
|
|
40
45
|
export declare const PageHeader: import("react").ForwardRefExoticComponent<{
|
|
41
46
|
/** The name of the application. */
|
|
42
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;
|
|
43
53
|
/** The accessible name of the logo. */
|
|
44
54
|
logoAccessibleName?: string;
|
|
45
55
|
/** The name of the brand for which to display the logo. */
|
|
@@ -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}` : ''}`, menuButtonIcon, 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
|
+
};
|
|
@@ -3,24 +3,44 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
-
export declare const
|
|
7
|
-
type
|
|
6
|
+
export declare const progressListHeadingLevels: (2 | 3 | 4)[];
|
|
7
|
+
type ProgressListHeadingLevel = (typeof progressListHeadingLevels)[number];
|
|
8
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;
|
|
9
19
|
/**
|
|
10
20
|
* The hierarchical level of this Progress List’s Headings within the document.
|
|
11
21
|
* There is no default value; determine the correct level for this instance.
|
|
12
22
|
*/
|
|
13
|
-
headingLevel:
|
|
23
|
+
headingLevel: ProgressListHeadingLevel;
|
|
14
24
|
} & PropsWithChildren<HTMLAttributes<HTMLOListElement>>;
|
|
15
25
|
/**
|
|
16
26
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-containers-progress-list--docs Progress List docs at Amsterdam Design System}
|
|
17
27
|
*/
|
|
18
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;
|
|
19
39
|
/**
|
|
20
40
|
* The hierarchical level of this Progress List’s Headings within the document.
|
|
21
41
|
* There is no default value; determine the correct level for this instance.
|
|
22
42
|
*/
|
|
23
|
-
headingLevel:
|
|
43
|
+
headingLevel: ProgressListHeadingLevel;
|
|
24
44
|
} & HTMLAttributes<HTMLOListElement> & {
|
|
25
45
|
children?: import("react").ReactNode | undefined;
|
|
26
46
|
} & import("react").RefAttributes<HTMLOListElement>> & {
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { headingLevels } from '../Heading/Heading';
|
|
5
5
|
import { ProgressListContext } from './ProgressListContext';
|
|
6
6
|
import { ProgressListStep } from './ProgressListStep';
|
|
7
7
|
import { ProgressListSubstep } from './ProgressListSubstep';
|
|
8
8
|
import { ProgressListSubsteps } from './ProgressListSubsteps';
|
|
9
|
-
export const
|
|
10
|
-
const ProgressListRoot = forwardRef(({ children, className, headingLevel, ...restProps }, ref) => (_jsx(ProgressListContext.Provider, { value: {
|
|
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 }) })));
|
|
11
15
|
/**
|
|
12
16
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-containers-progress-list--docs Progress List docs at Amsterdam Design System}
|
|
13
17
|
*/
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { ProgressListProps } from './ProgressList';
|
|
6
6
|
type ProgressListContextValue = {
|
|
7
|
+
completedAccessibleText?: ProgressListProps['completedAccessibleText'];
|
|
8
|
+
currentAccessibleText?: ProgressListProps['currentAccessibleText'];
|
|
7
9
|
headingLevel: ProgressListProps['headingLevel'];
|
|
8
10
|
};
|
|
9
11
|
export declare const ProgressListContext: import("react").Context<ProgressListContextValue>;
|
|
@@ -4,9 +4,10 @@ import { clsx } from 'clsx';
|
|
|
4
4
|
import { forwardRef, useContext } from 'react';
|
|
5
5
|
import { Heading } from '../Heading';
|
|
6
6
|
import { Icon } from '../Icon';
|
|
7
|
+
import { AccessibleStatusText } from './AccessibleStatusText';
|
|
7
8
|
import { ProgressListContext } from './ProgressListContext';
|
|
8
9
|
export const ProgressListStep = forwardRef(({ children, className, hasSubsteps, heading, status, ...restProps }, ref) => {
|
|
9
10
|
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: [
|
|
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] })] }));
|
|
11
12
|
});
|
|
12
13
|
ProgressListStep.displayName = 'ProgressList.Step';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
+
import { AccessibleStatusText } from './AccessibleStatusText';
|
|
4
5
|
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" })] }),
|
|
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] })] }));
|
|
6
7
|
});
|
|
7
8
|
ProgressListSubstep.displayName = 'ProgressList.Substep';
|
|
@@ -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;
|