@amsterdam/design-system-react 1.1.0 → 2.0.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.d.ts +7 -7
- package/dist/Accordion/Accordion.js +2 -6
- package/dist/Accordion/Accordion.test.js +4 -4
- package/dist/Accordion/AccordionContext.d.ts +1 -2
- package/dist/Accordion/AccordionContext.js +3 -2
- package/dist/Accordion/AccordionSection.d.ts +5 -5
- package/dist/Accordion/AccordionSection.js +6 -9
- package/dist/Accordion/AccordionSection.test.js +18 -5
- package/dist/ActionGroup/ActionGroup.js +1 -5
- package/dist/Alert/Alert.d.ts +16 -4
- package/dist/Alert/Alert.js +3 -7
- package/dist/Alert/Alert.test.js +24 -13
- package/dist/Avatar/Avatar.js +1 -5
- package/dist/Avatar/Avatar.test.js +2 -1
- package/dist/Badge/Badge.d.ts +4 -4
- package/dist/Badge/Badge.js +1 -5
- package/dist/Blockquote/Blockquote.d.ts +5 -5
- package/dist/Blockquote/Blockquote.js +1 -5
- package/dist/Breadcrumb/Breadcrumb.js +0 -4
- package/dist/Breadcrumb/Breadcrumb.test.js +1 -1
- package/dist/Breadcrumb/BreadcrumbLink.js +0 -4
- package/dist/Breakout/Breakout.js +2 -6
- package/dist/Breakout/Breakout.test.js +1 -1
- package/dist/Breakout/BreakoutCell.d.ts +3 -3
- package/dist/Breakout/BreakoutCell.js +1 -5
- package/dist/Breakout/BreakoutCell.test.js +2 -2
- package/dist/Button/Button.d.ts +4 -4
- package/dist/Button/Button.js +1 -5
- package/dist/CallToActionLink/CallToActionLink.d.ts +12 -0
- package/dist/CallToActionLink/CallToActionLink.js +8 -0
- package/dist/CallToActionLink/CallToActionLink.test.d.ts +5 -0
- package/dist/CallToActionLink/CallToActionLink.test.js +33 -0
- package/dist/CallToActionLink/index.d.ts +6 -0
- package/dist/CallToActionLink/index.js +5 -0
- package/dist/Card/Card.d.ts +8 -8
- package/dist/Card/Card.js +1 -5
- package/dist/Card/CardHeading.d.ts +3 -3
- package/dist/Card/CardHeading.js +2 -6
- package/dist/Card/CardHeading.test.js +1 -1
- package/dist/Card/CardHeadingGroup.d.ts +5 -5
- package/dist/Card/CardHeadingGroup.js +1 -5
- package/dist/Card/CardImage.d.ts +2 -2
- package/dist/Card/CardImage.js +1 -5
- package/dist/Card/CardLink.js +1 -5
- package/dist/CharacterCount/CharacterCount.d.ts +4 -4
- package/dist/CharacterCount/CharacterCount.js +1 -5
- package/dist/Checkbox/Checkbox.d.ts +15 -9
- package/dist/Checkbox/Checkbox.js +4 -8
- package/dist/Checkbox/Checkbox.test.js +9 -0
- package/dist/Column/Column.d.ts +5 -5
- package/dist/Column/Column.js +1 -5
- package/dist/Column/Column.test.js +1 -1
- package/dist/DateInput/DateInput.d.ts +4 -4
- package/dist/DateInput/DateInput.js +1 -5
- package/dist/DescriptionList/DescriptionList.d.ts +5 -5
- package/dist/DescriptionList/DescriptionList.js +1 -5
- package/dist/DescriptionList/DescriptionListDescription.js +1 -5
- package/dist/DescriptionList/DescriptionListSection.js +1 -5
- package/dist/DescriptionList/DescriptionListTerm.js +1 -5
- package/dist/DescriptionList/index.d.ts +1 -1
- package/dist/Dialog/Dialog.d.ts +6 -6
- package/dist/Dialog/Dialog.js +2 -6
- package/dist/ErrorMessage/ErrorMessage.d.ts +11 -4
- package/dist/ErrorMessage/ErrorMessage.js +2 -6
- package/dist/Field/Field.d.ts +5 -5
- package/dist/Field/Field.js +1 -5
- package/dist/FieldSet/FieldSet.d.ts +7 -7
- package/dist/FieldSet/FieldSet.js +1 -5
- package/dist/Figure/Figure.d.ts +3 -3
- package/dist/Figure/Figure.js +1 -5
- package/dist/Figure/FigureCaption.d.ts +5 -5
- package/dist/Figure/FigureCaption.js +1 -5
- package/dist/FileInput/FileInput.js +1 -5
- package/dist/FileList/FileList.d.ts +3 -3
- package/dist/FileList/FileList.js +1 -5
- package/dist/FileList/FileListItem.d.ts +4 -4
- package/dist/FileList/FileListItem.js +2 -6
- package/dist/Grid/Grid.d.ts +2 -2
- package/dist/Grid/Grid.js +1 -5
- package/dist/Grid/Grid.test.js +1 -1
- package/dist/Grid/GridCell.d.ts +2 -2
- package/dist/Grid/GridCell.js +1 -5
- package/dist/Grid/GridCell.test.js +1 -1
- package/dist/Heading/Heading.d.ts +18 -7
- package/dist/Heading/Heading.js +1 -10
- package/dist/Heading/Heading.test.js +1 -3
- package/dist/Hint/Hint.d.ts +3 -3
- package/dist/Hint/Hint.js +1 -5
- package/dist/Icon/Icon.d.ts +15 -3
- package/dist/Icon/Icon.js +14 -13
- package/dist/Icon/Icon.test.js +5 -0
- package/dist/IconButton/IconButton.js +1 -5
- package/dist/Image/Image.d.ts +4 -4
- package/dist/Image/Image.js +2 -6
- package/dist/Image/Image.test.js +2 -2
- package/dist/Image/index.d.ts +1 -1
- package/dist/Image/index.js +1 -1
- package/dist/ImageSlider/ImageSlider.d.ts +3 -3
- package/dist/ImageSlider/ImageSlider.js +2 -6
- package/dist/ImageSlider/ImageSliderControls.js +2 -6
- package/dist/ImageSlider/ImageSliderItem.d.ts +5 -5
- package/dist/ImageSlider/ImageSliderItem.js +1 -5
- package/dist/ImageSlider/ImageSliderScroller.js +1 -5
- package/dist/ImageSlider/ImageSliderThumbnails.d.ts +4 -4
- package/dist/ImageSlider/ImageSliderThumbnails.js +2 -6
- package/dist/InvalidFormAlert/InvalidFormAlert.d.ts +4 -4
- package/dist/InvalidFormAlert/InvalidFormAlert.js +0 -4
- package/dist/InvalidFormAlert/InvalidFormAlertWithErrors.js +5 -6
- package/dist/Label/Label.d.ts +10 -5
- package/dist/Label/Label.js +1 -10
- package/dist/Link/Link.d.ts +4 -4
- package/dist/Link/Link.js +1 -5
- package/dist/LinkList/LinkList.d.ts +1 -1
- package/dist/LinkList/LinkList.js +1 -5
- package/dist/LinkList/LinkListLink.d.ts +13 -4
- package/dist/LinkList/LinkListLink.js +3 -7
- package/dist/LinkList/LinkListLink.test.js +1 -1
- package/dist/Logo/Logo.d.ts +2 -2
- package/dist/Logo/Logo.js +1 -5
- package/dist/Logo/brand/LogoAmsterdam.js +2 -5
- package/dist/Logo/brand/LogoGgdAmsterdam.js +2 -5
- package/dist/Logo/brand/LogoMuseumWeesp.js +2 -5
- package/dist/Logo/brand/LogoStadsarchief.js +2 -5
- package/dist/Logo/brand/LogoStadsbankVanLening.js +2 -5
- package/dist/Logo/brand/LogoVgaVerzekeringen.js +2 -5
- package/dist/Logo/index.d.ts +1 -1
- package/dist/Mark/Mark.js +1 -5
- package/dist/Menu/Menu.d.ts +28 -0
- package/dist/Menu/Menu.js +10 -0
- package/dist/Menu/Menu.test.d.ts +5 -0
- package/dist/Menu/Menu.test.js +38 -0
- package/dist/Menu/MenuLink.d.ts +20 -0
- package/dist/Menu/MenuLink.js +8 -0
- package/dist/Menu/MenuLink.test.d.ts +5 -0
- package/dist/Menu/MenuLink.test.js +56 -0
- package/dist/Menu/index.d.ts +7 -0
- package/dist/Menu/index.js +5 -0
- package/dist/OrderedList/OrderedList.d.ts +5 -5
- package/dist/OrderedList/OrderedList.js +1 -5
- package/dist/OrderedList/OrderedList.test.js +1 -1
- package/dist/OrderedList/OrderedListItem.js +1 -5
- package/dist/Overlap/Overlap.js +1 -5
- package/dist/Page/Page.js +1 -5
- package/dist/PageFooter/PageFooter.js +1 -5
- package/dist/PageFooter/PageFooterMenu.js +1 -5
- package/dist/PageFooter/PageFooterMenuLink.js +1 -5
- package/dist/PageFooter/PageFooterSpotlight.js +1 -5
- package/dist/PageHeader/PageHeader.d.ts +7 -7
- package/dist/PageHeader/PageHeader.js +3 -7
- package/dist/PageHeader/PageHeader.test.js +1 -1
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.js +1 -1
- package/dist/PageHeader/PageHeaderMenuLink.d.ts +5 -5
- package/dist/PageHeader/PageHeaderMenuLink.js +1 -1
- package/dist/PageHeading/PageHeading.d.ts +6 -5
- package/dist/PageHeading/PageHeading.js +2 -5
- package/dist/Pagination/Pagination.d.ts +52 -10
- package/dist/Pagination/Pagination.js +5 -9
- package/dist/Pagination/Pagination.test.js +23 -10
- package/dist/Pagination/getRange.js +4 -2
- package/dist/Paragraph/Paragraph.d.ts +10 -5
- package/dist/Paragraph/Paragraph.js +1 -10
- package/dist/PasswordInput/PasswordInput.d.ts +4 -4
- package/dist/PasswordInput/PasswordInput.js +1 -5
- package/dist/PasswordInput/PasswordInput.test.js +1 -1
- package/dist/Radio/Radio.d.ts +15 -9
- package/dist/Radio/Radio.js +4 -8
- package/dist/Radio/Radio.test.js +9 -0
- package/dist/Row/Row.d.ts +5 -5
- package/dist/Row/Row.js +1 -5
- package/dist/Row/Row.test.js +1 -1
- package/dist/SearchField/SearchField.d.ts +3 -5
- package/dist/SearchField/SearchField.js +1 -5
- package/dist/SearchField/SearchFieldButton.js +0 -4
- package/dist/SearchField/SearchFieldInput.d.ts +2 -2
- package/dist/SearchField/SearchFieldInput.js +1 -5
- package/dist/Select/Select.d.ts +5 -5
- package/dist/Select/Select.js +1 -5
- package/dist/Select/SelectOption.js +1 -5
- package/dist/Select/SelectOptionGroup.js +1 -5
- package/dist/SkipLink/SkipLink.js +1 -5
- package/dist/Spotlight/Spotlight.d.ts +5 -5
- package/dist/Spotlight/Spotlight.js +1 -1
- package/dist/Spotlight/Spotlight.test.js +1 -1
- package/dist/StandaloneLink/StandaloneLink.d.ts +15 -8
- package/dist/StandaloneLink/StandaloneLink.js +4 -6
- package/dist/StandaloneLink/StandaloneLink.test.js +6 -4
- package/dist/Switch/Switch.js +1 -5
- package/dist/Table/Table.js +1 -5
- package/dist/Table/TableBody.js +1 -5
- package/dist/Table/TableCaption.d.ts +5 -0
- package/dist/Table/TableCaption.js +1 -10
- package/dist/Table/TableCell.js +1 -5
- package/dist/Table/TableFooter.js +1 -5
- package/dist/Table/TableHeader.js +1 -5
- package/dist/Table/TableHeaderCell.js +1 -5
- package/dist/Table/TableRow.js +1 -5
- package/dist/TableOfContents/TableOfContents.d.ts +9 -9
- package/dist/TableOfContents/TableOfContents.js +4 -7
- package/dist/TableOfContents/TableOfContentsLink.d.ts +4 -4
- package/dist/TableOfContents/TableOfContentsLink.js +0 -4
- package/dist/TableOfContents/TableOfContentsList.js +1 -5
- package/dist/TableOfContents/TableOfContentsList.test.js +1 -1
- package/dist/Tabs/Tabs.d.ts +11 -11
- package/dist/Tabs/Tabs.js +1 -5
- package/dist/Tabs/TabsButton.d.ts +5 -5
- package/dist/Tabs/TabsButton.js +1 -5
- package/dist/Tabs/TabsList.js +1 -5
- package/dist/Tabs/TabsPanel.d.ts +5 -5
- package/dist/Tabs/TabsPanel.js +1 -5
- package/dist/Tabs/index.d.ts +2 -2
- package/dist/TextArea/TextArea.d.ts +4 -4
- package/dist/TextArea/TextArea.js +1 -5
- package/dist/TextInput/TextInput.d.ts +4 -4
- package/dist/TextInput/TextInput.js +1 -5
- package/dist/TimeInput/TimeInput.d.ts +4 -4
- package/dist/TimeInput/TimeInput.js +1 -5
- package/dist/UnorderedList/UnorderedList.d.ts +5 -5
- package/dist/UnorderedList/UnorderedList.js +1 -5
- package/dist/UnorderedList/UnorderedList.test.js +1 -1
- package/dist/UnorderedList/UnorderedListItem.js +1 -5
- package/dist/common/formatFileType.d.ts +1 -1
- package/dist/common/formatFileType.js +10 -10
- package/dist/common/useKeyboardFocus.js +6 -6
- package/dist/common/useKeyboardFocus.test.js +2 -6
- package/dist/index.cjs.js +731 -619
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +394 -267
- package/dist/index.esm.js +633 -523
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -23
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* @see {@link https://designsystem.amsterdam/?path=/docs/components-navigation-call-to-action-link--docs CallToActionLink docs at Amsterdam Design System}
|
|
6
|
+
*/
|
|
7
|
+
export const CallToActionLink = forwardRef(({ children, className, ...restProps }, ref) => (_jsx("a", { ...restProps, className: clsx('ams-call-to-action-link', className), ref: ref, children: children })));
|
|
8
|
+
CallToActionLink.displayName = 'CallToActionLink';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @license EUPL-1.2+
|
|
4
|
+
* Copyright Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import { render, screen } from '@testing-library/react';
|
|
7
|
+
import { createRef } from 'react';
|
|
8
|
+
import { CallToActionLink } from './CallToActionLink';
|
|
9
|
+
import '@testing-library/jest-dom';
|
|
10
|
+
describe('Call to Action Link', () => {
|
|
11
|
+
it('renders with href attribute', () => {
|
|
12
|
+
render(_jsx(CallToActionLink, { href: "#" }));
|
|
13
|
+
const component = screen.getByRole('link');
|
|
14
|
+
expect(component).toBeInTheDocument();
|
|
15
|
+
expect(component).toHaveAttribute('href', '#');
|
|
16
|
+
});
|
|
17
|
+
it('renders a design system BEM class name', () => {
|
|
18
|
+
render(_jsx(CallToActionLink, { href: "#" }));
|
|
19
|
+
const component = screen.getByRole('link');
|
|
20
|
+
expect(component).toHaveClass('ams-call-to-action-link');
|
|
21
|
+
});
|
|
22
|
+
it('renders an extra class name', () => {
|
|
23
|
+
render(_jsx(CallToActionLink, { className: "extra", href: "#" }));
|
|
24
|
+
const component = screen.getByRole('link');
|
|
25
|
+
expect(component).toHaveClass('ams-call-to-action-link extra');
|
|
26
|
+
});
|
|
27
|
+
it('supports ForwardRef in React', () => {
|
|
28
|
+
const ref = createRef();
|
|
29
|
+
render(_jsx(CallToActionLink, { href: "#", ref: ref }));
|
|
30
|
+
const component = screen.getByRole('link');
|
|
31
|
+
expect(ref.current).toBe(component);
|
|
32
|
+
});
|
|
33
|
+
});
|
package/dist/Card/Card.d.ts
CHANGED
|
@@ -10,21 +10,21 @@ export type CardProps = PropsWithChildren<HTMLAttributes<HTMLElement>>;
|
|
|
10
10
|
export declare const Card: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
11
11
|
children?: import("react").ReactNode | undefined;
|
|
12
12
|
} & import("react").RefAttributes<HTMLElement>> & {
|
|
13
|
-
Heading: import("react").ForwardRefExoticComponent<{
|
|
13
|
+
Heading: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & {
|
|
14
|
+
children?: import("react").ReactNode | undefined;
|
|
15
|
+
} & {
|
|
14
16
|
color?: "inverse";
|
|
15
17
|
level: 1 | 2 | 3 | 4;
|
|
16
18
|
size?: "level-1" | "level-2" | "level-3" | "level-4" | "level-5" | "level-6";
|
|
17
|
-
} & HTMLAttributes<HTMLHeadingElement> & {
|
|
18
|
-
children?: import("react").ReactNode | undefined;
|
|
19
19
|
} & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
20
|
-
HeadingGroup: import("react").ForwardRefExoticComponent<{
|
|
21
|
-
tagline: string;
|
|
22
|
-
} & HTMLAttributes<HTMLElement> & {
|
|
20
|
+
HeadingGroup: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
23
21
|
children?: import("react").ReactNode | undefined;
|
|
22
|
+
} & {
|
|
23
|
+
tagline: string;
|
|
24
24
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
25
|
-
Image: import("react").ForwardRefExoticComponent<{
|
|
25
|
+
Image: import("react").ForwardRefExoticComponent<import("../common/types").AspectRatioProps & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, "children"> & {
|
|
26
26
|
alt: string;
|
|
27
|
-
} & import("
|
|
27
|
+
} & import("react").RefAttributes<HTMLImageElement>>;
|
|
28
28
|
Link: import("react").ForwardRefExoticComponent<import("react").AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
29
29
|
children?: import("react").ReactNode | undefined;
|
|
30
30
|
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
package/dist/Card/Card.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import clsx from 'clsx';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
import { CardHeading } from './CardHeading';
|
|
9
5
|
import { CardHeadingGroup } from './CardHeadingGroup';
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @license EUPL-1.2+
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
|
-
export declare const CardHeading: import("react").ForwardRefExoticComponent<{
|
|
5
|
+
export declare const CardHeading: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLHeadingElement> & {
|
|
6
|
+
children?: import("react").ReactNode | undefined;
|
|
7
|
+
} & {
|
|
6
8
|
color?: "inverse";
|
|
7
9
|
level: 1 | 2 | 3 | 4;
|
|
8
10
|
size?: "level-1" | "level-2" | "level-3" | "level-4" | "level-5" | "level-6";
|
|
9
|
-
} & import("react").HTMLAttributes<HTMLHeadingElement> & {
|
|
10
|
-
children?: import("react").ReactNode | undefined;
|
|
11
11
|
} & import("react").RefAttributes<HTMLHeadingElement>>;
|
package/dist/Card/CardHeading.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import clsx from 'clsx';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
import { Heading } from '../Heading';
|
|
9
|
-
export const CardHeading = forwardRef(({ children, className, size = 'level-
|
|
5
|
+
export const CardHeading = forwardRef(({ children, className, size = 'level-3', ...restProps }, ref) => (_jsx(Heading, { ...restProps, className: clsx('ams-card__heading', className), ref: ref, size: size, children: children })));
|
|
10
6
|
CardHeading.displayName = 'Card.Heading';
|
|
@@ -25,7 +25,7 @@ describe('Card Heading', () => {
|
|
|
25
25
|
expect(component).toHaveClass('ams-card__heading extra');
|
|
26
26
|
});
|
|
27
27
|
it('renders the correct size level class', () => {
|
|
28
|
-
render(_jsx(CardHeading, { level:
|
|
28
|
+
render(_jsx(CardHeading, { level: 3, size: "level-1", children: "Size level 1" }));
|
|
29
29
|
const component = screen.getByRole('heading');
|
|
30
30
|
expect(component).toHaveClass('ams-heading--1');
|
|
31
31
|
});
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
-
export type CardHeadingGroupProps = {
|
|
6
|
+
export type CardHeadingGroupProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {
|
|
7
7
|
/** A short phrase of text, e.g. to categorise the card. Displayed above the card heading. */
|
|
8
8
|
tagline: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const CardHeadingGroup: import("react").ForwardRefExoticComponent<{
|
|
9
|
+
};
|
|
10
|
+
export declare const CardHeadingGroup: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
11
|
+
children?: import("react").ReactNode | undefined;
|
|
12
|
+
} & {
|
|
11
13
|
/** A short phrase of text, e.g. to categorise the card. Displayed above the card heading. */
|
|
12
14
|
tagline: string;
|
|
13
|
-
} & HTMLAttributes<HTMLElement> & {
|
|
14
|
-
children?: import("react").ReactNode | undefined;
|
|
15
15
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
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';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
import { Paragraph } from '../Paragraph';
|
|
9
5
|
export const CardHeadingGroup = forwardRef(({ children, className, tagline, ...restProps }, ref) => (_jsxs("hgroup", { ...restProps, className: clsx('ams-card__heading-group', className), ref: ref, children: [children, _jsx(Paragraph, { size: "small", children: tagline })] })));
|
package/dist/Card/CardImage.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* @license EUPL-1.2+
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
|
-
export declare const CardImage: import("react").ForwardRefExoticComponent<{
|
|
5
|
+
export declare const CardImage: import("react").ForwardRefExoticComponent<import("../common/types").AspectRatioProps & Omit<import("react").ImgHTMLAttributes<HTMLImageElement>, "children"> & {
|
|
6
6
|
alt: string;
|
|
7
|
-
} & import("
|
|
7
|
+
} & import("react").RefAttributes<HTMLImageElement>>;
|
package/dist/Card/CardImage.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import clsx from 'clsx';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
import { Image } from '../Image';
|
|
9
5
|
export const CardImage = forwardRef(({ className, ...restProps }, ref) => (_jsx(Image, { ...restProps, className: clsx('ams-card__image', className), ref: ref })));
|
package/dist/Card/CardLink.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import clsx from 'clsx';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
export const CardLink = forwardRef(({ children, className, ...restProps }, ref) => (_jsx("a", { ...restProps, className: clsx('ams-card__link', className), ref: ref, children: children })));
|
|
9
5
|
CardLink.displayName = 'Card.Link';
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { HTMLAttributes } from 'react';
|
|
6
|
-
export type CharacterCountProps =
|
|
6
|
+
export type CharacterCountProps = {
|
|
7
7
|
/** The current length of the field’s value. */
|
|
8
8
|
length: number;
|
|
9
9
|
/** The maximum length of the field’s value. */
|
|
10
10
|
maxLength: number;
|
|
11
|
-
}
|
|
11
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
12
12
|
/**
|
|
13
13
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-character-count--docs Character Count docs at Amsterdam Design System}
|
|
14
14
|
*/
|
|
15
|
-
export declare const CharacterCount: import("react").ForwardRefExoticComponent<
|
|
15
|
+
export declare const CharacterCount: import("react").ForwardRefExoticComponent<{
|
|
16
16
|
/** The current length of the field’s value. */
|
|
17
17
|
length: number;
|
|
18
18
|
/** The maximum length of the field’s value. */
|
|
19
19
|
maxLength: number;
|
|
20
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
|
+
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import clsx from 'clsx';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
/**
|
|
9
5
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-character-count--docs Character Count docs at Amsterdam Design System}
|
|
@@ -3,24 +3,30 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { InputHTMLAttributes, PropsWithChildren, ReactNode } from 'react';
|
|
6
|
-
export type CheckboxProps = {
|
|
7
|
-
/**
|
|
8
|
-
|
|
6
|
+
export type CheckboxProps = PropsWithChildren<Omit<InputHTMLAttributes<HTMLInputElement>, 'aria-invalid' | 'type'>> & {
|
|
7
|
+
/**
|
|
8
|
+
* An icon to display instead of the default icon.
|
|
9
|
+
* @default CheckboxIcon
|
|
10
|
+
*/
|
|
11
|
+
icon?: Function | ReactNode;
|
|
9
12
|
/** Allows being neither checked nor unchecked. */
|
|
10
13
|
indeterminate?: boolean;
|
|
11
14
|
/** Whether the value fails a validation rule. */
|
|
12
15
|
invalid?: boolean;
|
|
13
|
-
}
|
|
16
|
+
};
|
|
14
17
|
/**
|
|
15
18
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-checkbox--docs Checkbox docs at Amsterdam Design System}
|
|
16
19
|
*/
|
|
17
|
-
export declare const Checkbox: import("react").ForwardRefExoticComponent<{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "aria-invalid" | "type"> & {
|
|
21
|
+
children?: ReactNode | undefined;
|
|
22
|
+
} & {
|
|
23
|
+
/**
|
|
24
|
+
* An icon to display instead of the default icon.
|
|
25
|
+
* @default CheckboxIcon
|
|
26
|
+
*/
|
|
27
|
+
icon?: Function | ReactNode;
|
|
20
28
|
/** Allows being neither checked nor unchecked. */
|
|
21
29
|
indeterminate?: boolean;
|
|
22
30
|
/** Whether the value fails a validation rule. */
|
|
23
31
|
invalid?: boolean;
|
|
24
|
-
} & Omit<InputHTMLAttributes<HTMLInputElement>, "aria-invalid" | "type"> & {
|
|
25
|
-
children?: ReactNode | undefined;
|
|
26
32
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
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';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef, useEffect, useId, useImperativeHandle, useRef } from 'react';
|
|
8
4
|
import CheckboxIcon from './CheckboxIcon';
|
|
9
5
|
/**
|
|
10
6
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-checkbox--docs Checkbox docs at Amsterdam Design System}
|
|
11
7
|
*/
|
|
12
|
-
export const Checkbox = forwardRef(({ children, className, icon, indeterminate, invalid, ...restProps }, ref) => {
|
|
13
|
-
const
|
|
8
|
+
export const Checkbox = forwardRef(({ children, className, icon = CheckboxIcon, id, indeterminate, invalid, ...restProps }, ref) => {
|
|
9
|
+
const inputId = id || useId();
|
|
14
10
|
const innerRef = useRef(null);
|
|
15
11
|
// use a passed ref if it's there, otherwise use innerRef
|
|
16
12
|
useImperativeHandle(ref, () => innerRef.current);
|
|
@@ -23,6 +19,6 @@ export const Checkbox = forwardRef(({ children, className, icon, indeterminate,
|
|
|
23
19
|
return (
|
|
24
20
|
// This div is here because NVDA doesn't match the input to the label
|
|
25
21
|
// without a containing element
|
|
26
|
-
_jsxs("div", { className: clsx('ams-checkbox', className), children: [_jsx("input", { ...restProps, "aria-invalid": invalid || undefined, className: "ams-checkbox__input", id:
|
|
22
|
+
_jsxs("div", { className: clsx('ams-checkbox', className), children: [_jsx("input", { ...restProps, "aria-invalid": invalid || undefined, className: "ams-checkbox__input", id: inputId, ref: innerRef, type: "checkbox" }), _jsxs("label", { className: "ams-checkbox__label", htmlFor: inputId, children: [_jsx("span", { className: "ams-checkbox__icon-container", hidden: true, children: typeof icon === 'function' ? icon() : icon }), children] })] }));
|
|
27
23
|
});
|
|
28
24
|
Checkbox.displayName = 'Checkbox';
|
|
@@ -119,6 +119,15 @@ describe('Checkbox', () => {
|
|
|
119
119
|
label?.click();
|
|
120
120
|
expect(handleChange).toHaveBeenCalled();
|
|
121
121
|
});
|
|
122
|
+
it('can use a custom id', () => {
|
|
123
|
+
const handleChange = jest.fn();
|
|
124
|
+
const { container } = render(_jsx(Checkbox, { id: "test-id", onChange: handleChange }));
|
|
125
|
+
const input = screen.getByRole('checkbox');
|
|
126
|
+
expect(input).toHaveAttribute('id', 'test-id');
|
|
127
|
+
const label = container.querySelector('label');
|
|
128
|
+
label?.click();
|
|
129
|
+
expect(handleChange).toHaveBeenCalled();
|
|
130
|
+
});
|
|
122
131
|
it('shows a custom icon', () => {
|
|
123
132
|
const { container } = render(_jsx(Checkbox, { icon: _jsx(StarIcon, { className: "test-class" }) }));
|
|
124
133
|
const icon = container.querySelector('svg');
|
package/dist/Column/Column.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const columnTags: readonly ["article", "div", "section"];
|
|
|
8
8
|
type ColumnTag = (typeof columnTags)[number];
|
|
9
9
|
export declare const columnGapSizes: readonly ["none", "x-small", "small", "large", "x-large"];
|
|
10
10
|
type ColumnGap = (typeof columnGapSizes)[number];
|
|
11
|
-
export type ColumnProps = {
|
|
11
|
+
export type ColumnProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {
|
|
12
12
|
/**
|
|
13
13
|
* The vertical alignment of the items in the column.
|
|
14
14
|
* @default start
|
|
@@ -29,11 +29,13 @@ export type ColumnProps = {
|
|
|
29
29
|
* @default medium
|
|
30
30
|
*/
|
|
31
31
|
gap?: ColumnGap;
|
|
32
|
-
}
|
|
32
|
+
};
|
|
33
33
|
/**
|
|
34
34
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-layout-column--docs Column docs at Amsterdam Design System}
|
|
35
35
|
*/
|
|
36
|
-
export declare const Column: import("react").ForwardRefExoticComponent<{
|
|
36
|
+
export declare const Column: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
37
|
+
children?: import("react").ReactNode | undefined;
|
|
38
|
+
} & {
|
|
37
39
|
/**
|
|
38
40
|
* The vertical alignment of the items in the column.
|
|
39
41
|
* @default start
|
|
@@ -54,7 +56,5 @@ export declare const Column: import("react").ForwardRefExoticComponent<{
|
|
|
54
56
|
* @default medium
|
|
55
57
|
*/
|
|
56
58
|
gap?: ColumnGap;
|
|
57
|
-
} & HTMLAttributes<HTMLElement> & {
|
|
58
|
-
children?: import("react").ReactNode | undefined;
|
|
59
59
|
} & import("react").RefAttributes<unknown>>;
|
|
60
60
|
export {};
|
package/dist/Column/Column.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import clsx from 'clsx';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
export const columnTags = ['article', 'div', 'section'];
|
|
9
5
|
export const columnGapSizes = ['none', 'x-small', 'small', 'large', 'x-large'];
|
|
@@ -5,9 +5,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
*/
|
|
6
6
|
import { render, screen } from '@testing-library/react';
|
|
7
7
|
import { createRef } from 'react';
|
|
8
|
-
import { Column, columnGapSizes, columnTags } from './Column';
|
|
9
8
|
import { ariaRoleForTag } from '../common/accessibility';
|
|
10
9
|
import { crossAlignOptionsForColumn, mainAlignOptions } from '../common/types';
|
|
10
|
+
import { Column, columnGapSizes, columnTags } from './Column';
|
|
11
11
|
import '@testing-library/jest-dom';
|
|
12
12
|
describe('Column', () => {
|
|
13
13
|
it('renders', () => {
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
import type { InputHTMLAttributes } from 'react';
|
|
6
6
|
export declare const dateInputTypes: readonly ["date", "datetime-local"];
|
|
7
7
|
type DateInputType = (typeof dateInputTypes)[number];
|
|
8
|
-
export type DateInputProps = {
|
|
8
|
+
export type DateInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'aria-invalid' | 'type'> & {
|
|
9
9
|
/** Whether the value fails a validation rule. */
|
|
10
10
|
invalid?: boolean;
|
|
11
11
|
/** The kind of data that the user should provide. */
|
|
12
12
|
type?: DateInputType;
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
/**
|
|
15
15
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-date-input--docs Date Input docs at Amsterdam Design System}
|
|
16
16
|
*/
|
|
17
|
-
export declare const DateInput: import("react").ForwardRefExoticComponent<{
|
|
17
|
+
export declare const DateInput: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "aria-invalid" | "type"> & {
|
|
18
18
|
/** Whether the value fails a validation rule. */
|
|
19
19
|
invalid?: boolean;
|
|
20
20
|
/** The kind of data that the user should provide. */
|
|
21
21
|
type?: DateInputType;
|
|
22
|
-
} &
|
|
22
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
23
23
|
export {};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import clsx from 'clsx';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
export const dateInputTypes = ['date', 'datetime-local'];
|
|
9
5
|
/**
|
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
6
|
export declare const descriptionListTermsWidths: readonly ["narrow", "medium", "wide"];
|
|
7
7
|
type DescriptionListTermsWidth = (typeof descriptionListTermsWidths)[number];
|
|
8
|
-
export type DescriptionListProps = {
|
|
8
|
+
export type DescriptionListProps = PropsWithChildren<HTMLAttributes<HTMLDListElement>> & {
|
|
9
9
|
/** Changes the text colour for readability on a dark background. */
|
|
10
10
|
color?: 'inverse';
|
|
11
11
|
termsWidth?: DescriptionListTermsWidth;
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
13
|
/**
|
|
14
14
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-text-description-list--docs Description List docs at Amsterdam Design System}
|
|
15
15
|
*/
|
|
16
|
-
export declare const DescriptionList: import("react").ForwardRefExoticComponent<{
|
|
16
|
+
export declare const DescriptionList: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDListElement> & {
|
|
17
|
+
children?: import("react").ReactNode | undefined;
|
|
18
|
+
} & {
|
|
17
19
|
/** Changes the text colour for readability on a dark background. */
|
|
18
20
|
color?: "inverse";
|
|
19
21
|
termsWidth?: DescriptionListTermsWidth;
|
|
20
|
-
} & HTMLAttributes<HTMLDListElement> & {
|
|
21
|
-
children?: import("react").ReactNode | undefined;
|
|
22
22
|
} & import("react").RefAttributes<HTMLDListElement>> & {
|
|
23
23
|
Description: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
24
24
|
children?: import("react").ReactNode | undefined;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import clsx from 'clsx';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
import { DescriptionListDescription } from './DescriptionListDescription';
|
|
9
5
|
import { DescriptionListSection } from './DescriptionListSection';
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import clsx from 'clsx';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
export const DescriptionListDescription = forwardRef(({ children, className, ...restProps }, ref) => (_jsx("dd", { ...restProps, className: clsx('ams-description-list__description', className), ref: ref, children: children })));
|
|
9
5
|
DescriptionListDescription.displayName = 'DescriptionList.Description';
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import clsx from 'clsx';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
export const DescriptionListSection = forwardRef(({ children, className, ...restProps }, ref) => (_jsx("div", { ...restProps, className: clsx('ams-description-list__section', className), ref: ref, children: children })));
|
|
9
5
|
DescriptionListSection.displayName = 'DescriptionList.Section';
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import clsx from 'clsx';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
export const DescriptionListTerm = forwardRef(({ children, className, ...restProps }, ref) => (_jsx("dt", { ...restProps, className: clsx('ams-description-list__term', className), ref: ref, children: children })));
|
|
9
5
|
DescriptionListTerm.displayName = 'DescriptionList.Term';
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { DescriptionList } from './DescriptionList';
|
|
6
6
|
export type { DescriptionListProps } from './DescriptionList';
|
|
7
|
-
export type { DescriptionListTermProps } from './DescriptionListTerm';
|
|
8
7
|
export type { DescriptionListDescriptionProps } from './DescriptionListDescription';
|
|
8
|
+
export type { DescriptionListTermProps } from './DescriptionListTerm';
|
package/dist/Dialog/Dialog.d.ts
CHANGED
|
@@ -2,28 +2,28 @@
|
|
|
2
2
|
* @license EUPL-1.2+
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
|
-
import { MouseEvent } from 'react';
|
|
6
5
|
import type { DialogHTMLAttributes, PropsWithChildren, ReactNode } from 'react';
|
|
7
|
-
|
|
6
|
+
import { MouseEvent } from 'react';
|
|
7
|
+
export type DialogProps = PropsWithChildren<DialogHTMLAttributes<HTMLDialogElement>> & {
|
|
8
8
|
/** The label for the button that dismisses the Dialog. */
|
|
9
9
|
closeButtonLabel?: string;
|
|
10
10
|
/** Content for the footer, often one Button or an Action Group containing more of them. */
|
|
11
11
|
footer?: ReactNode;
|
|
12
12
|
/** The text for the Heading. */
|
|
13
13
|
heading: string;
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
15
|
/**
|
|
16
16
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-containers-dialog--docs Dialog docs at Amsterdam Design System}
|
|
17
17
|
*/
|
|
18
|
-
export declare const Dialog: import("react").ForwardRefExoticComponent<{
|
|
18
|
+
export declare const Dialog: import("react").ForwardRefExoticComponent<DialogHTMLAttributes<HTMLDialogElement> & {
|
|
19
|
+
children?: ReactNode | undefined;
|
|
20
|
+
} & {
|
|
19
21
|
/** The label for the button that dismisses the Dialog. */
|
|
20
22
|
closeButtonLabel?: string;
|
|
21
23
|
/** Content for the footer, often one Button or an Action Group containing more of them. */
|
|
22
24
|
footer?: ReactNode;
|
|
23
25
|
/** The text for the Heading. */
|
|
24
26
|
heading: string;
|
|
25
|
-
} & DialogHTMLAttributes<HTMLDialogElement> & {
|
|
26
|
-
children?: ReactNode | undefined;
|
|
27
27
|
} & import("react").RefAttributes<HTMLDialogElement>> & {
|
|
28
28
|
close: (event: MouseEvent<HTMLButtonElement>) => void | undefined;
|
|
29
29
|
open: (id: string) => void;
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
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';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
import { Heading } from '../Heading';
|
|
9
5
|
import { IconButton } from '../IconButton';
|
|
10
6
|
const closeDialog = (event) => event.currentTarget.closest('dialog')?.close();
|
|
11
7
|
const openDialog = (id) => document.querySelector(id)?.showModal();
|
|
12
|
-
const DialogRoot = forwardRef(({ children, className, closeButtonLabel = 'Sluiten', footer, heading, ...restProps }, ref) => (_jsxs("dialog", { ...restProps, className: clsx('ams-dialog', className), ref: ref, children: [_jsxs("header", { className: "ams-dialog__header", children: [_jsx(Heading, { level: 1, size: "level-
|
|
8
|
+
const DialogRoot = forwardRef(({ children, className, closeButtonLabel = 'Sluiten', footer, heading, ...restProps }, ref) => (_jsxs("dialog", { ...restProps, className: clsx('ams-dialog', className), ref: ref, children: [_jsxs("header", { className: "ams-dialog__header", children: [_jsx(Heading, { level: 1, size: "level-3", children: heading }), _jsx(IconButton, { label: closeButtonLabel, onClick: closeDialog, size: "heading-3", type: "button" })] }), _jsx("div", { className: "ams-dialog__body", children: children }), footer && _jsx("footer", { className: "ams-dialog__footer", children: footer })] })));
|
|
13
9
|
DialogRoot.displayName = 'Dialog';
|
|
14
10
|
/**
|
|
15
11
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-containers-dialog--docs Dialog docs at Amsterdam Design System}
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
import type { IconProps } from '../Icon';
|
|
6
7
|
export type ErrorMessageProps = {
|
|
7
|
-
/**
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* An icon to display instead of the default icon.
|
|
10
|
+
* @default WarningIcon
|
|
11
|
+
*/
|
|
12
|
+
icon?: IconProps['svg'];
|
|
9
13
|
/** An accessible phrase that screen readers announce before the error message. Should translate to something like ‘input error’. */
|
|
10
14
|
prefix?: string;
|
|
11
15
|
} & PropsWithChildren<HTMLAttributes<HTMLParagraphElement>>;
|
|
@@ -13,8 +17,11 @@ export type ErrorMessageProps = {
|
|
|
13
17
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-error-message--docs Error Message docs at Amsterdam Design System}
|
|
14
18
|
*/
|
|
15
19
|
export declare const ErrorMessage: import("react").ForwardRefExoticComponent<{
|
|
16
|
-
/**
|
|
17
|
-
|
|
20
|
+
/**
|
|
21
|
+
* An icon to display instead of the default icon.
|
|
22
|
+
* @default WarningIcon
|
|
23
|
+
*/
|
|
24
|
+
icon?: IconProps["svg"];
|
|
18
25
|
/** An accessible phrase that screen readers announce before the error message. Should translate to something like ‘input error’. */
|
|
19
26
|
prefix?: string;
|
|
20
27
|
} & HTMLAttributes<HTMLParagraphElement> & {
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
2
|
import { WarningIcon } from '@amsterdam/design-system-react-icons';
|
|
7
|
-
import clsx from 'clsx';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
8
4
|
import { forwardRef } from 'react';
|
|
9
5
|
import { Icon } from '../Icon';
|
|
10
6
|
/**
|
|
11
7
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-error-message--docs Error Message docs at Amsterdam Design System}
|
|
12
8
|
*/
|
|
13
|
-
export const ErrorMessage = forwardRef(({ children, className, icon, prefix = 'Invoerfout', ...restProps }, ref) => (_jsxs("p", { ...restProps, className: clsx('ams-error-message', className), ref: ref, children: [_jsx(Icon, {
|
|
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] })));
|
|
14
10
|
ErrorMessage.displayName = 'ErrorMessage';
|