@amsterdam/design-system-react 0.15.0 → 0.16.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 +4 -1
- package/dist/Accordion/Accordion.test.js +19 -3
- package/dist/Accordion/AccordionSection.test.js +1 -1
- package/dist/ActionGroup/ActionGroup.test.js +1 -1
- package/dist/Alert/Alert.test.js +1 -1
- package/dist/Avatar/Avatar.test.js +1 -1
- package/dist/Badge/Badge.test.js +1 -1
- package/dist/Blockquote/Blockquote.test.js +3 -4
- package/dist/Breadcrumb/Breadcrumb.test.js +1 -1
- package/dist/Breadcrumb/BreadcrumbLink.test.js +1 -1
- package/dist/Breakout/Breakout.test.js +11 -19
- package/dist/Breakout/BreakoutCell.d.ts +3 -1
- package/dist/Breakout/BreakoutCell.js +1 -0
- package/dist/Breakout/BreakoutCell.test.js +20 -16
- package/dist/Button/Button.test.js +8 -1
- package/dist/Card/Card.d.ts +10 -0
- package/dist/Card/Card.js +8 -1
- package/dist/Card/Card.test.js +1 -1
- package/dist/Card/CardHeading.d.ts +11 -0
- package/dist/Card/CardHeading.js +10 -0
- package/dist/Card/CardHeading.test.js +34 -0
- package/dist/Card/CardHeadingGroup.test.js +1 -1
- package/dist/Card/CardImage.d.ts +7 -0
- package/dist/Card/CardImage.js +10 -0
- package/dist/{Footer/FooterSpotlight.test.js → Card/CardImage.test.js} +9 -9
- package/dist/Card/CardLink.test.js +1 -1
- package/dist/CharacterCount/CharacterCount.test.js +1 -1
- package/dist/Checkbox/Checkbox.test.js +2 -3
- package/dist/Column/Column.d.ts +4 -3
- package/dist/Column/Column.js +2 -1
- package/dist/Column/Column.test.js +10 -12
- package/dist/DateInput/DateInput.test.js +1 -1
- package/dist/DescriptionList/DescriptionList.test.js +1 -1
- package/dist/DescriptionList/DescriptionListDescription.test.js +1 -1
- package/dist/DescriptionList/DescriptionListSection.test.js +1 -1
- package/dist/DescriptionList/DescriptionListTerm.test.js +1 -1
- package/dist/Dialog/Dialog.test.js +1 -1
- package/dist/ErrorMessage/ErrorMessage.test.js +1 -1
- package/dist/Field/Field.test.js +1 -1
- package/dist/FieldSet/FieldSet.test.js +1 -1
- package/dist/Figure/Figure.test.js +1 -1
- package/dist/Figure/FigureCaption.test.js +1 -1
- package/dist/FileInput/FileInput.test.js +1 -1
- package/dist/FileList/FileList.test.js +1 -1
- package/dist/FileList/FileListItem.test.js +1 -1
- package/dist/Grid/Grid.d.ts +8 -5
- package/dist/Grid/Grid.js +2 -0
- package/dist/Grid/Grid.test.js +13 -29
- package/dist/Grid/GridCell.test.js +2 -8
- package/dist/Grid/paddingClasses.d.ts +2 -2
- package/dist/Heading/Heading.test.js +17 -11
- package/dist/Hint/Hint.test.js +1 -1
- package/dist/Icon/Icon.d.ts +1 -1
- package/dist/Icon/Icon.test.js +3 -4
- package/dist/IconButton/IconButton.js +1 -1
- package/dist/IconButton/IconButton.test.js +1 -1
- package/dist/Image/Image.d.ts +4 -8
- package/dist/Image/Image.test.js +1 -1
- package/dist/ImageSlider/ImageSlider.test.js +1 -1
- package/dist/ImageSlider/ImageSliderItem.test.js +1 -1
- package/dist/ImageSlider/ImageSliderScroller.test.js +1 -1
- package/dist/ImageSlider/ImageSliderThumbnails.js +1 -1
- package/dist/ImageSlider/ImageSliderThumbnails.test.js +1 -1
- package/dist/InvalidFormAlert/InvalidFormAlert.test.js +1 -1
- package/dist/Label/Label.test.js +3 -4
- package/dist/Link/Link.d.ts +0 -6
- package/dist/Link/Link.js +1 -1
- package/dist/Link/Link.test.js +22 -29
- package/dist/LinkList/LinkList.test.js +1 -1
- package/dist/LinkList/LinkListLink.test.js +1 -1
- package/dist/Logo/Logo.test.js +2 -3
- package/dist/Mark/Mark.test.js +1 -1
- package/dist/OrderedList/OrderedList.test.js +1 -1
- package/dist/OrderedList/OrderedListItem.test.js +1 -1
- package/dist/Overlap/Overlap.test.js +1 -1
- package/dist/{Footer/FooterSpotlight.d.ts → Page/Page.d.ts} +2 -2
- package/dist/Page/Page.js +9 -0
- package/dist/{MegaMenu/MegaMenu.test.js → Page/Page.test.js} +9 -9
- package/dist/Page/index.d.ts +2 -0
- package/dist/Page/index.js +1 -0
- package/dist/{Footer/Footer.d.ts → PageFooter/PageFooter.d.ts} +2 -2
- package/dist/PageFooter/PageFooter.js +17 -0
- package/dist/{Footer/Footer.test.js → PageFooter/PageFooter.test.js} +9 -9
- package/dist/{Footer/FooterMenu.d.ts → PageFooter/PageFooterMenu.d.ts} +2 -2
- package/dist/PageFooter/PageFooterMenu.js +9 -0
- package/dist/{Footer/FooterMenu.test.js → PageFooter/PageFooterMenu.test.js} +9 -9
- package/dist/{Footer/FooterMenuLink.d.ts → PageFooter/PageFooterMenuLink.d.ts} +2 -2
- package/dist/PageFooter/PageFooterMenuLink.js +9 -0
- package/dist/{Footer/FooterMenuLink.test.js → PageFooter/PageFooterMenuLink.test.js} +9 -9
- package/dist/PageFooter/PageFooterSpotlight.d.ts +9 -0
- package/dist/PageFooter/PageFooterSpotlight.js +9 -0
- package/dist/{MegaMenu/MegaMenuListCategory.test.js → PageFooter/PageFooterSpotlight.test.js} +9 -9
- package/dist/PageFooter/index.d.ts +5 -0
- package/dist/PageFooter/index.js +1 -0
- package/dist/{Header/Header.d.ts → PageHeader/PageHeader.d.ts} +4 -4
- package/dist/PageHeader/PageHeader.js +31 -0
- package/dist/{Header/Header.test.js → PageHeader/PageHeader.test.js} +37 -38
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.d.ts +2 -0
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.js +6 -0
- package/dist/{Header/HeaderGridCellNarrowWindowOnly.test.js → PageHeader/PageHeaderGridCellNarrowWindowOnly.test.js} +10 -10
- package/dist/PageHeader/PageHeaderMenuIcon.d.ts +2 -0
- package/dist/PageHeader/PageHeaderMenuIcon.js +2 -0
- package/dist/{Header/HeaderMenuLink.d.ts → PageHeader/PageHeaderMenuLink.d.ts} +2 -2
- package/dist/PageHeader/PageHeaderMenuLink.js +5 -0
- package/dist/{Header/HeaderMenuLink.test.js → PageHeader/PageHeaderMenuLink.test.js} +13 -13
- package/dist/PageHeader/index.d.ts +3 -0
- package/dist/PageHeader/index.js +1 -0
- package/dist/PageHeading/PageHeading.test.js +2 -3
- package/dist/Pagination/Pagination.test.js +1 -1
- package/dist/Paragraph/Paragraph.test.js +1 -1
- package/dist/PasswordInput/PasswordInput.test.js +1 -1
- package/dist/Radio/Radio.test.js +1 -1
- package/dist/Row/Row.d.ts +4 -3
- package/dist/Row/Row.js +2 -1
- package/dist/Row/Row.test.js +10 -12
- package/dist/SearchField/SearchField.d.ts +2 -0
- package/dist/SearchField/SearchField.test.js +2 -3
- package/dist/SearchField/SearchFieldInput.test.js +2 -3
- package/dist/Select/Select.test.js +1 -1
- package/dist/Select/SelectOption.test.js +1 -1
- package/dist/Select/SelectOptionGroup.test.js +1 -1
- package/dist/SkipLink/SkipLink.test.js +1 -1
- package/dist/Spotlight/Spotlight.d.ts +4 -2
- package/dist/Spotlight/Spotlight.js +1 -0
- package/dist/Spotlight/Spotlight.test.js +11 -9
- package/dist/StandaloneLink/StandaloneLink.d.ts +17 -0
- package/dist/StandaloneLink/StandaloneLink.js +10 -0
- package/dist/StandaloneLink/StandaloneLink.test.js +40 -0
- package/dist/StandaloneLink/index.d.ts +2 -0
- package/dist/StandaloneLink/index.js +1 -0
- package/dist/Switch/Switch.test.js +1 -1
- package/dist/Table/Table.test.js +1 -1
- package/dist/Table/TableBody.test.js +1 -1
- package/dist/Table/TableCaption.test.js +1 -1
- package/dist/Table/TableCell.test.js +1 -1
- package/dist/Table/TableFooter.test.js +1 -1
- package/dist/Table/TableHeader.test.js +1 -1
- package/dist/Table/TableHeaderCell.test.js +1 -1
- package/dist/Table/TableRow.test.js +1 -1
- package/dist/TableOfContents/TableOfContents.test.js +1 -1
- package/dist/TableOfContents/TableOfContentsLink.test.js +1 -1
- package/dist/TableOfContents/TableOfContentsList.test.js +1 -1
- package/dist/Tabs/Tabs.d.ts +6 -6
- package/dist/Tabs/Tabs.js +4 -5
- package/dist/Tabs/Tabs.test.js +21 -6
- package/dist/Tabs/TabsButton.d.ts +4 -4
- package/dist/Tabs/TabsButton.js +4 -4
- package/dist/Tabs/TabsButton.test.js +10 -10
- package/dist/Tabs/TabsContext.d.ts +2 -7
- package/dist/Tabs/TabsContext.js +0 -1
- package/dist/Tabs/TabsList.js +1 -1
- package/dist/Tabs/TabsList.test.js +1 -1
- package/dist/Tabs/TabsPanel.d.ts +4 -4
- package/dist/Tabs/TabsPanel.js +4 -4
- package/dist/Tabs/TabsPanel.test.js +10 -12
- package/dist/TextArea/TextArea.test.js +1 -1
- package/dist/TextInput/TextInput.test.js +2 -3
- package/dist/TimeInput/TimeInput.test.js +1 -1
- package/dist/UnorderedList/UnorderedList.test.js +1 -1
- package/dist/UnorderedList/UnorderedListItem.test.js +1 -1
- package/dist/common/accessibility.d.ts +9 -1
- package/dist/index.cjs.js +1000 -1057
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +164 -194
- package/dist/index.esm.js +998 -1053
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/dist/Footer/Footer.js +0 -17
- package/dist/Footer/FooterMenu.js +0 -9
- package/dist/Footer/FooterMenuLink.js +0 -9
- package/dist/Footer/FooterSpotlight.js +0 -9
- package/dist/Footer/index.d.ts +0 -5
- package/dist/Footer/index.js +0 -1
- package/dist/Header/Header.js +0 -31
- package/dist/Header/HeaderGridCellNarrowWindowOnly.d.ts +0 -2
- package/dist/Header/HeaderGridCellNarrowWindowOnly.js +0 -6
- package/dist/Header/HeaderMenuIcon.d.ts +0 -2
- package/dist/Header/HeaderMenuIcon.js +0 -2
- package/dist/Header/HeaderMenuLink.js +0 -5
- package/dist/Header/index.d.ts +0 -3
- package/dist/Header/index.js +0 -1
- package/dist/MegaMenu/MegaMenu.d.ts +0 -14
- package/dist/MegaMenu/MegaMenu.js +0 -12
- package/dist/MegaMenu/MegaMenuListCategory.d.ts +0 -9
- package/dist/MegaMenu/MegaMenuListCategory.js +0 -9
- package/dist/MegaMenu/index.d.ts +0 -3
- package/dist/MegaMenu/index.js +0 -1
- package/dist/PageMenu/PageMenu.d.ts +0 -25
- package/dist/PageMenu/PageMenu.js +0 -12
- package/dist/PageMenu/PageMenu.test.js +0 -45
- package/dist/PageMenu/PageMenuLink.d.ts +0 -13
- package/dist/PageMenu/PageMenuLink.js +0 -10
- package/dist/PageMenu/PageMenuLink.test.js +0 -40
- package/dist/PageMenu/index.d.ts +0 -3
- package/dist/PageMenu/index.js +0 -1
- package/dist/Screen/Screen.d.ts +0 -21
- package/dist/Screen/Screen.js +0 -9
- package/dist/Screen/Screen.test.d.ts +0 -1
- package/dist/Screen/Screen.test.js +0 -40
- package/dist/Screen/index.d.ts +0 -2
- package/dist/Screen/index.js +0 -1
- package/dist/TopTaskLink/TopTaskLink.d.ts +0 -17
- package/dist/TopTaskLink/TopTaskLink.js +0 -9
- package/dist/TopTaskLink/TopTaskLink.test.d.ts +0 -1
- package/dist/TopTaskLink/TopTaskLink.test.js +0 -42
- package/dist/TopTaskLink/index.d.ts +0 -1
- package/dist/TopTaskLink/index.js +0 -1
- /package/dist/{Footer/Footer.test.d.ts → Card/CardHeading.test.d.ts} +0 -0
- /package/dist/{Footer/FooterMenu.test.d.ts → Card/CardImage.test.d.ts} +0 -0
- /package/dist/{Footer/FooterMenuLink.test.d.ts → Page/Page.test.d.ts} +0 -0
- /package/dist/{Footer/FooterSpotlight.test.d.ts → PageFooter/PageFooter.test.d.ts} +0 -0
- /package/dist/{Header/HeaderGridCellNarrowWindowOnly.test.d.ts → PageFooter/PageFooterMenu.test.d.ts} +0 -0
- /package/dist/{Header/HeaderMenuLink.test.d.ts → PageFooter/PageFooterMenuLink.test.d.ts} +0 -0
- /package/dist/{MegaMenu/MegaMenu.test.d.ts → PageFooter/PageFooterSpotlight.test.d.ts} +0 -0
- /package/dist/{Header/Header.test.d.ts → PageHeader/PageHeader.test.d.ts} +0 -0
- /package/dist/{MegaMenu/MegaMenuListCategory.test.d.ts → PageHeader/PageHeaderGridCellNarrowWindowOnly.test.d.ts} +0 -0
- /package/dist/{PageMenu/PageMenu.test.d.ts → PageHeader/PageHeaderMenuLink.test.d.ts} +0 -0
- /package/dist/{Header → PageHeader}/matchMedia.mock.d.ts +0 -0
- /package/dist/{Header → PageHeader}/matchMedia.mock.js +0 -0
- /package/dist/{PageMenu/PageMenuLink.test.d.ts → StandaloneLink/StandaloneLink.test.d.ts} +0 -0
|
@@ -15,7 +15,7 @@ describe('Description List', () => {
|
|
|
15
15
|
const component = container.querySelector(':only-child');
|
|
16
16
|
expect(component).toHaveClass('ams-description-list');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
const { container } = render(_jsx(DescriptionList, { className: "extra" }));
|
|
20
20
|
const component = container.querySelector(':only-child');
|
|
21
21
|
expect(component).toHaveClass('ams-description-list extra');
|
|
@@ -15,7 +15,7 @@ describe('Description List Description', () => {
|
|
|
15
15
|
const component = screen.getByRole('definition');
|
|
16
16
|
expect(component).toHaveClass('ams-description-list__description');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
render(_jsx(DescriptionList.Description, { className: "extra", children: "Test" }));
|
|
20
20
|
const component = screen.getByRole('definition');
|
|
21
21
|
expect(component).toHaveClass('ams-description-list__description extra');
|
|
@@ -15,7 +15,7 @@ describe('Description List Section', () => {
|
|
|
15
15
|
const component = container.querySelector(':only-child');
|
|
16
16
|
expect(component).toHaveClass('ams-description-list__section');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
const { container } = render(_jsx(DescriptionList.Section, { className: "extra", children: "Test" }));
|
|
20
20
|
const component = container.querySelector(':only-child');
|
|
21
21
|
expect(component).toHaveClass('ams-description-list__section extra');
|
|
@@ -15,7 +15,7 @@ describe('Description List Term', () => {
|
|
|
15
15
|
const component = screen.getByRole('term');
|
|
16
16
|
expect(component).toHaveClass('ams-description-list__term');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
render(_jsx(DescriptionList.Term, { className: "extra", children: "Test" }));
|
|
20
20
|
const component = screen.getByRole('term');
|
|
21
21
|
expect(component).toHaveClass('ams-description-list__term extra');
|
|
@@ -15,7 +15,7 @@ describe('Dialog', () => {
|
|
|
15
15
|
const component = screen.getByRole('dialog', { hidden: true });
|
|
16
16
|
expect(component).toHaveClass('ams-dialog');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
render(_jsx(Dialog, { className: "extra", heading: "Test heading" }));
|
|
20
20
|
const component = screen.getByRole('dialog', { hidden: true });
|
|
21
21
|
expect(component).toHaveClass('ams-dialog extra');
|
|
@@ -15,7 +15,7 @@ describe('Error message', () => {
|
|
|
15
15
|
const component = screen.getByRole('paragraph');
|
|
16
16
|
expect(component).toHaveClass('ams-error-message');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
render(_jsx(ErrorMessage, { className: "extra" }));
|
|
20
20
|
const component = screen.getByRole('paragraph');
|
|
21
21
|
expect(component).toHaveClass('ams-error-message extra');
|
package/dist/Field/Field.test.js
CHANGED
|
@@ -15,7 +15,7 @@ describe('Field', () => {
|
|
|
15
15
|
const component = container.querySelector(':only-child');
|
|
16
16
|
expect(component).toHaveClass('ams-field');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
const { container } = render(_jsx(Field, { className: "extra" }));
|
|
20
20
|
const component = container.querySelector(':only-child');
|
|
21
21
|
expect(component).toHaveClass('ams-field extra');
|
|
@@ -15,7 +15,7 @@ describe('FieldSet', () => {
|
|
|
15
15
|
const component = screen.getByRole('group', { name: 'Test' });
|
|
16
16
|
expect(component).toHaveClass('ams-field-set');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
render(_jsx(FieldSet, { className: "extra", legend: "Test" }));
|
|
20
20
|
const component = screen.getByRole('group', { name: 'Test' });
|
|
21
21
|
expect(component).toHaveClass('ams-field-set extra');
|
|
@@ -15,7 +15,7 @@ describe('Figure', () => {
|
|
|
15
15
|
const component = screen.getByRole('figure');
|
|
16
16
|
expect(component).toHaveClass('ams-figure');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
render(_jsx(Figure, { className: "extra" }));
|
|
20
20
|
const component = screen.getByRole('figure');
|
|
21
21
|
expect(component).toHaveClass('ams-figure extra');
|
|
@@ -20,7 +20,7 @@ describe('Figure Caption', () => {
|
|
|
20
20
|
const component = container.querySelector(':only-child');
|
|
21
21
|
expect(component).toHaveClass('ams-figure__caption--inverse');
|
|
22
22
|
});
|
|
23
|
-
it('renders an
|
|
23
|
+
it('renders an extra class name', () => {
|
|
24
24
|
const { container } = render(_jsx(FigureCaption, { className: "extra" }));
|
|
25
25
|
const component = container.querySelector(':only-child');
|
|
26
26
|
expect(component).toHaveClass('ams-figure__caption extra');
|
|
@@ -15,7 +15,7 @@ describe('File input', () => {
|
|
|
15
15
|
const component = container.querySelector('input[type="file"]');
|
|
16
16
|
expect(component).toHaveClass('ams-file-input');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
const { container } = render(_jsx(FileInput, { className: "extra" }));
|
|
20
20
|
const component = container.querySelector('input[type="file"]');
|
|
21
21
|
expect(component).toHaveClass('ams-file-input extra');
|
|
@@ -15,7 +15,7 @@ describe('FileList', () => {
|
|
|
15
15
|
const component = screen.getByRole('list');
|
|
16
16
|
expect(component).toHaveClass('ams-file-list');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
render(_jsx(FileList, { className: "extra" }));
|
|
20
20
|
const component = screen.getByRole('list');
|
|
21
21
|
expect(component).toHaveClass('ams-file-list extra');
|
|
@@ -16,7 +16,7 @@ describe('FileListItem', () => {
|
|
|
16
16
|
const component = screen.getByRole('listitem');
|
|
17
17
|
expect(component).toHaveClass('ams-file-list__item');
|
|
18
18
|
});
|
|
19
|
-
it('renders an
|
|
19
|
+
it('renders an extra class name', () => {
|
|
20
20
|
render(_jsx(FileListItem, { className: "extra", file: file }));
|
|
21
21
|
const component = screen.getByRole('listitem');
|
|
22
22
|
expect(component).toHaveClass('ams-file-list__item extra');
|
package/dist/Grid/Grid.d.ts
CHANGED
|
@@ -9,27 +9,30 @@ export type GridColumnNumbers = {
|
|
|
9
9
|
medium: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
10
10
|
wide: GridColumnNumber;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export declare const gridGaps: readonly ["none", "large", "2x-large"];
|
|
13
|
+
export type GridGap = (typeof gridGaps)[number];
|
|
14
|
+
export declare const gridPaddings: readonly ["large", "x-large", "2x-large"];
|
|
15
|
+
export type GridPadding = (typeof gridPaddings)[number];
|
|
13
16
|
export declare const gridTags: readonly ["article", "aside", "div", "footer", "header", "main", "nav", "section"];
|
|
14
17
|
export type GridTag = (typeof gridTags)[number];
|
|
15
18
|
type GridPaddingVerticalProp = {
|
|
16
19
|
paddingBottom?: never;
|
|
17
20
|
paddingTop?: never;
|
|
18
21
|
/** The amount of space above and below. */
|
|
19
|
-
paddingVertical?:
|
|
22
|
+
paddingVertical?: GridPadding;
|
|
20
23
|
};
|
|
21
24
|
type GridPaddingTopAndBottomProps = {
|
|
22
25
|
/** The amount of space below. */
|
|
23
|
-
paddingBottom?:
|
|
26
|
+
paddingBottom?: GridPadding;
|
|
24
27
|
/** The amount of space above. */
|
|
25
|
-
paddingTop?:
|
|
28
|
+
paddingTop?: GridPadding;
|
|
26
29
|
paddingVertical?: never;
|
|
27
30
|
};
|
|
28
31
|
export type GridProps = {
|
|
29
32
|
/** The HTML tag to use. */
|
|
30
33
|
as?: GridTag;
|
|
31
34
|
/** The amount of space between rows. */
|
|
32
|
-
gapVertical?:
|
|
35
|
+
gapVertical?: GridGap;
|
|
33
36
|
} & (GridPaddingVerticalProp | GridPaddingTopAndBottomProps) & PropsWithChildren<HTMLAttributes<HTMLDivElement>>;
|
|
34
37
|
export declare const Grid: import("react").ForwardRefExoticComponent<GridProps & import("react").RefAttributes<any>> & {
|
|
35
38
|
Cell: import("react").ForwardRefExoticComponent<import("./GridCell").GridCellProps & import("react").RefAttributes<unknown>>;
|
package/dist/Grid/Grid.js
CHANGED
|
@@ -7,6 +7,8 @@ import clsx from 'clsx';
|
|
|
7
7
|
import { forwardRef } from 'react';
|
|
8
8
|
import { GridCell } from './GridCell';
|
|
9
9
|
import { paddingClasses } from './paddingClasses';
|
|
10
|
+
export const gridGaps = ['none', 'large', '2x-large'];
|
|
11
|
+
export const gridPaddings = ['large', 'x-large', '2x-large'];
|
|
10
12
|
export const gridTags = ['article', 'aside', 'div', 'footer', 'header', 'main', 'nav', 'section'];
|
|
11
13
|
const GridRoot = forwardRef(({ as: Tag = 'div', children, className, gapVertical, paddingBottom, paddingTop, paddingVertical, ...restProps }, ref) => (_jsx(Tag, { ...restProps, className: clsx('ams-grid', gapVertical && `ams-grid--gap-vertical--${gapVertical}`, paddingClasses('grid', paddingBottom, paddingTop, paddingVertical), className), ref: ref, children: children })));
|
|
12
14
|
GridRoot.displayName = 'Grid';
|
package/dist/Grid/Grid.test.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { createRef } from 'react';
|
|
4
|
-
import { Grid, gridTags } from './Grid';
|
|
4
|
+
import { Grid, gridGaps, gridPaddings, gridTags } from './Grid';
|
|
5
5
|
import { ariaRoleForTag } from '../common/accessibility';
|
|
6
6
|
import '@testing-library/jest-dom';
|
|
7
|
-
const paddingSizes = ['small', 'medium', 'large'];
|
|
8
7
|
describe('Grid', () => {
|
|
9
8
|
it('renders', () => {
|
|
10
9
|
const { container } = render(_jsx(Grid, {}));
|
|
@@ -17,42 +16,33 @@ describe('Grid', () => {
|
|
|
17
16
|
const component = container.querySelector(':only-child');
|
|
18
17
|
expect(component).toHaveClass('ams-grid');
|
|
19
18
|
});
|
|
20
|
-
it('renders an
|
|
19
|
+
it('renders an extra class name', () => {
|
|
21
20
|
const { container } = render(_jsx(Grid, { className: "extra" }));
|
|
22
21
|
const component = container.querySelector(':only-child');
|
|
23
|
-
expect(component).toHaveClass('extra');
|
|
24
|
-
expect(component).toHaveClass('ams-grid');
|
|
25
|
-
});
|
|
26
|
-
it('renders the correct class name for a zero gap', () => {
|
|
27
|
-
const { container } = render(_jsx(Grid, { gapVertical: "none" }));
|
|
28
|
-
const component = container.querySelector(':only-child');
|
|
29
|
-
expect(component).toHaveClass('ams-grid--gap-vertical--none');
|
|
30
|
-
});
|
|
31
|
-
it(`renders the correct class name for a small gap`, () => {
|
|
32
|
-
const { container } = render(_jsx(Grid, { gapVertical: "small" }));
|
|
33
|
-
const component = container.querySelector(':only-child');
|
|
34
|
-
expect(component).toHaveClass('ams-grid--gap-vertical--small');
|
|
22
|
+
expect(component).toHaveClass('ams-grid extra');
|
|
35
23
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
gridGaps.forEach((size) => {
|
|
25
|
+
it(`renders the correct class name for a ${size} vertical gap`, () => {
|
|
26
|
+
const { container } = render(_jsx(Grid, { gapVertical: size }));
|
|
27
|
+
const component = container.querySelector(':only-child');
|
|
28
|
+
expect(component).toHaveClass(`ams-grid--gap-vertical--${size}`);
|
|
29
|
+
});
|
|
40
30
|
});
|
|
41
|
-
|
|
31
|
+
gridPaddings.forEach((size) => {
|
|
42
32
|
it(`renders the correct class name for a ${size} bottom padding`, () => {
|
|
43
33
|
const { container } = render(_jsx(Grid, { paddingBottom: size }));
|
|
44
34
|
const component = container.querySelector(':only-child');
|
|
45
35
|
expect(component).toHaveClass(`ams-grid--padding-bottom--${size}`);
|
|
46
36
|
});
|
|
47
37
|
});
|
|
48
|
-
|
|
38
|
+
gridPaddings.forEach((size) => {
|
|
49
39
|
it(`renders the correct class name for a ${size} top padding`, () => {
|
|
50
40
|
const { container } = render(_jsx(Grid, { paddingTop: size }));
|
|
51
41
|
const component = container.querySelector(':only-child');
|
|
52
42
|
expect(component).toHaveClass(`ams-grid--padding-top--${size}`);
|
|
53
43
|
});
|
|
54
44
|
});
|
|
55
|
-
|
|
45
|
+
gridPaddings.forEach((size) => {
|
|
56
46
|
it(`renders the correct class name for a ${size} vertical padding`, () => {
|
|
57
47
|
const { container } = render(_jsx(Grid, { paddingVertical: size }));
|
|
58
48
|
const component = container.querySelector(':only-child');
|
|
@@ -62,13 +52,7 @@ describe('Grid', () => {
|
|
|
62
52
|
gridTags.forEach((tag) => {
|
|
63
53
|
it(`renders with a custom ${tag} tag`, () => {
|
|
64
54
|
const { container } = render(_jsx(Grid, { "aria-label": tag === 'section' ? 'Accessible name' : undefined, as: tag }));
|
|
65
|
-
|
|
66
|
-
if (tag === 'div') {
|
|
67
|
-
component = container.querySelector(tag);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
component = screen.getByRole(ariaRoleForTag[tag]);
|
|
71
|
-
}
|
|
55
|
+
const component = tag === 'div' ? container.querySelector(tag) : screen.getByRole(ariaRoleForTag[tag]);
|
|
72
56
|
expect(component).toBeInTheDocument();
|
|
73
57
|
});
|
|
74
58
|
});
|
|
@@ -17,7 +17,7 @@ describe('Grid cell', () => {
|
|
|
17
17
|
const component = container.querySelector(':only-child');
|
|
18
18
|
expect(component).toHaveClass('ams-grid__cell');
|
|
19
19
|
});
|
|
20
|
-
it('renders an
|
|
20
|
+
it('renders an extra class name', () => {
|
|
21
21
|
const { container } = render(_jsx(Grid.Cell, { className: "extra" }));
|
|
22
22
|
const component = container.querySelector(':only-child');
|
|
23
23
|
expect(component).toHaveClass('ams-grid__cell extra');
|
|
@@ -67,13 +67,7 @@ describe('Grid cell', () => {
|
|
|
67
67
|
gridCellTags.forEach((tag) => {
|
|
68
68
|
it(`renders with a custom ${tag} tag`, () => {
|
|
69
69
|
const { container } = render(_jsx(Grid.Cell, { "aria-label": tag === 'section' ? 'Accessible name' : undefined, as: tag }));
|
|
70
|
-
|
|
71
|
-
if (tag === 'div') {
|
|
72
|
-
component = container.querySelector(tag);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
component = screen.getByRole(ariaRoleForTag[tag]);
|
|
76
|
-
}
|
|
70
|
+
const component = tag === 'div' ? container.querySelector(tag) : screen.getByRole(ariaRoleForTag[tag]);
|
|
77
71
|
expect(component).toBeInTheDocument();
|
|
78
72
|
});
|
|
79
73
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const paddingClasses: (componentName: string, paddingBottom?:
|
|
1
|
+
import type { GridPadding } from './Grid';
|
|
2
|
+
export declare const paddingClasses: (componentName: string, paddingBottom?: GridPadding, paddingTop?: GridPadding, paddingVertical?: GridPadding) => string[];
|
|
@@ -12,16 +12,28 @@ describe('Heading', () => {
|
|
|
12
12
|
expect(heading).toBeInTheDocument();
|
|
13
13
|
expect(heading).toBeVisible();
|
|
14
14
|
});
|
|
15
|
-
it('renders
|
|
16
|
-
render(
|
|
15
|
+
it('renders a design system BEM class name', () => {
|
|
16
|
+
render(_jsx(Heading, { level: 1 }));
|
|
17
|
+
const heading = screen.getByRole('heading');
|
|
18
|
+
expect(heading).toHaveClass('ams-heading');
|
|
19
|
+
});
|
|
20
|
+
it('renders an extra class name', () => {
|
|
21
|
+
render(_jsx(Heading, { className: "extra", level: 1 }));
|
|
22
|
+
const heading = screen.getByRole('heading');
|
|
23
|
+
expect(heading).toHaveClass('ams-heading extra');
|
|
24
|
+
});
|
|
25
|
+
it('renders the allowed levels correctly', () => {
|
|
26
|
+
render(_jsxs(_Fragment, { children: [_jsx(Heading, { level: 1, children: "Heading 1" }), _jsx(Heading, { level: 2, children: "Heading 2" }), _jsx(Heading, { level: 3, children: "Heading 3" }), _jsx(Heading, { level: 4, children: "Heading 4" })] }));
|
|
27
|
+
const h1 = screen.getByRole('heading', { level: 1, name: 'Heading 1' });
|
|
17
28
|
const h2 = screen.getByRole('heading', { level: 2, name: 'Heading 2' });
|
|
18
29
|
const h3 = screen.getByRole('heading', { level: 3, name: 'Heading 3' });
|
|
19
30
|
const h4 = screen.getByRole('heading', { level: 4, name: 'Heading 4' });
|
|
31
|
+
expect(h1).toBeInTheDocument();
|
|
20
32
|
expect(h2).toBeInTheDocument();
|
|
21
33
|
expect(h3).toBeInTheDocument();
|
|
22
34
|
expect(h4).toBeInTheDocument();
|
|
23
35
|
});
|
|
24
|
-
it('renders the correct
|
|
36
|
+
it('renders the correct size level class', () => {
|
|
25
37
|
render(_jsxs(_Fragment, { children: [_jsx(Heading, { level: 1, size: "level-1", children: "Size level 1" }), _jsx(Heading, { level: 1, size: "level-2", children: "Size level 2" }), _jsx(Heading, { level: 1, size: "level-3", children: "Size level 3" }), _jsx(Heading, { level: 1, size: "level-4", children: "Size level 4" }), _jsx(Heading, { level: 1, size: "level-5", children: "Size level 5" }), _jsx(Heading, { level: 1, size: "level-6", children: "Size level 6" })] }));
|
|
26
38
|
const sizeLevel1 = screen.getByRole('heading', { level: 1, name: 'Size level 1' });
|
|
27
39
|
const sizeLevel2 = screen.getByRole('heading', { level: 1, name: 'Size level 2' });
|
|
@@ -47,16 +59,10 @@ describe('Heading', () => {
|
|
|
47
59
|
const inlineMarkup = heading.querySelector('strong');
|
|
48
60
|
expect(inlineMarkup).toBeInTheDocument();
|
|
49
61
|
});
|
|
50
|
-
it('renders an additional class name', () => {
|
|
51
|
-
const { container } = render(_jsx(Heading, { className: "large", level: 1 }));
|
|
52
|
-
const heading = container.querySelector(':only-child');
|
|
53
|
-
expect(heading).toHaveClass('large');
|
|
54
|
-
expect(heading).toHaveClass('ams-heading');
|
|
55
|
-
});
|
|
56
62
|
it('is able to pass a React ref', () => {
|
|
57
63
|
const ref = createRef();
|
|
58
|
-
|
|
59
|
-
const heading =
|
|
64
|
+
render(_jsx(Heading, { level: 1, ref: ref }));
|
|
65
|
+
const heading = screen.getByRole('heading');
|
|
60
66
|
expect(ref.current).toBe(heading);
|
|
61
67
|
});
|
|
62
68
|
});
|
package/dist/Hint/Hint.test.js
CHANGED
|
@@ -15,7 +15,7 @@ describe('Hint', () => {
|
|
|
15
15
|
const component = container.querySelector(':only-child');
|
|
16
16
|
expect(component).toHaveClass('ams-hint');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
const { container } = render(_jsx(Hint, { className: "extra", optional: true }));
|
|
20
20
|
const component = container.querySelector(':only-child');
|
|
21
21
|
expect(component).toHaveClass('ams-hint extra');
|
package/dist/Icon/Icon.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Copyright Gemeente Amsterdam
|
|
6
6
|
*/
|
|
7
7
|
import type { HTMLAttributes, ReactNode } from 'react';
|
|
8
|
-
export declare const iconSizes:
|
|
8
|
+
export declare const iconSizes: readonly ["small", "large", "heading-3", "heading-4", "heading-5", "heading-6"];
|
|
9
9
|
type IconSize = (typeof iconSizes)[number];
|
|
10
10
|
export type IconProps = {
|
|
11
11
|
/** Changes the icon colour for readability on a dark background. */
|
package/dist/Icon/Icon.test.js
CHANGED
|
@@ -37,11 +37,10 @@ describe('Icon', () => {
|
|
|
37
37
|
const icon = container.querySelector('span:only-child');
|
|
38
38
|
expect(icon).toHaveClass('ams-icon--inverse');
|
|
39
39
|
});
|
|
40
|
-
it('renders an
|
|
41
|
-
const { container } = render(_jsx(Icon, { className: "
|
|
40
|
+
it('renders an extra class name', () => {
|
|
41
|
+
const { container } = render(_jsx(Icon, { className: "extra", svg: AlertIcon }));
|
|
42
42
|
const icon = container.querySelector(':only-child');
|
|
43
|
-
expect(icon).toHaveClass('
|
|
44
|
-
expect(icon).toHaveClass('ams-icon');
|
|
43
|
+
expect(icon).toHaveClass('ams-icon extra');
|
|
45
44
|
});
|
|
46
45
|
it('supports ForwardRef in React', () => {
|
|
47
46
|
const ref = createRef();
|
|
@@ -7,5 +7,5 @@ import { CloseIcon } from '@amsterdam/design-system-react-icons';
|
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import { forwardRef } from 'react';
|
|
9
9
|
import { Icon } from '../Icon';
|
|
10
|
-
export const IconButton = forwardRef(({ className, color, label, size, svg = CloseIcon, ...restProps }, ref) => (_jsxs("button", { ...restProps, className: clsx('ams-icon-button', color && `ams-icon-button--${color}`, className), ref: ref, children: [_jsx("span", { className: "ams-visually-hidden", children: label }), _jsx(Icon, { size: size, square: true, svg: svg })] })));
|
|
10
|
+
export const IconButton = forwardRef(({ className, color, label, size, svg = CloseIcon, type, ...restProps }, ref) => (_jsxs("button", { ...restProps, className: clsx('ams-icon-button', color && `ams-icon-button--${color}`, className), ref: ref, type: type || 'button', children: [_jsx("span", { className: "ams-visually-hidden", children: label }), _jsx(Icon, { size: size, square: true, svg: svg })] })));
|
|
11
11
|
IconButton.displayName = 'IconButton';
|
|
@@ -15,7 +15,7 @@ describe('Icon button', () => {
|
|
|
15
15
|
const component = screen.getByRole('button');
|
|
16
16
|
expect(component).toHaveClass('ams-icon-button');
|
|
17
17
|
});
|
|
18
|
-
it('renders an
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
19
|
render(_jsx(IconButton, { className: "extra", label: "Test" }));
|
|
20
20
|
const component = screen.getByRole('button');
|
|
21
21
|
expect(component).toHaveClass('ams-icon-button extra');
|
package/dist/Image/Image.d.ts
CHANGED
|
@@ -5,14 +5,10 @@
|
|
|
5
5
|
import type { ImgHTMLAttributes } from 'react';
|
|
6
6
|
import { AspectRatioProps } from '../common/types';
|
|
7
7
|
export type ImageProps = {
|
|
8
|
-
/**
|
|
9
|
-
* A textual description of the content of the image.
|
|
10
|
-
*/
|
|
8
|
+
/** A textual description of the content of the image. */
|
|
11
9
|
alt: string;
|
|
12
|
-
} & AspectRatioProps & ImgHTMLAttributes<HTMLImageElement>;
|
|
10
|
+
} & AspectRatioProps & Omit<ImgHTMLAttributes<HTMLImageElement>, 'children'>;
|
|
13
11
|
export declare const Image: import("react").ForwardRefExoticComponent<{
|
|
14
|
-
/**
|
|
15
|
-
* A textual description of the content of the image.
|
|
16
|
-
*/
|
|
12
|
+
/** A textual description of the content of the image. */
|
|
17
13
|
alt: string;
|
|
18
|
-
} & AspectRatioProps & ImgHTMLAttributes<HTMLImageElement> & import("react").RefAttributes<HTMLImageElement>>;
|
|
14
|
+
} & AspectRatioProps & Omit<ImgHTMLAttributes<HTMLImageElement>, "children"> & import("react").RefAttributes<HTMLImageElement>>;
|
package/dist/Image/Image.test.js
CHANGED
|
@@ -17,7 +17,7 @@ describe('Image', () => {
|
|
|
17
17
|
const component = container.querySelector(':only-child');
|
|
18
18
|
expect(component).toHaveClass('ams-image');
|
|
19
19
|
});
|
|
20
|
-
it('renders an
|
|
20
|
+
it('renders an extra class name', () => {
|
|
21
21
|
const { container } = render(_jsx(Image, { alt: "", className: "extra" }));
|
|
22
22
|
const component = container.querySelector(':only-child');
|
|
23
23
|
expect(component).toHaveClass('ams-image extra');
|
|
@@ -48,7 +48,7 @@ describe('Image Slider', () => {
|
|
|
48
48
|
const component = container.querySelector(':only-child');
|
|
49
49
|
expect(component).toHaveClass('ams-image-slider');
|
|
50
50
|
});
|
|
51
|
-
it('renders an
|
|
51
|
+
it('renders an extra class name', () => {
|
|
52
52
|
const { container } = render(_jsx(ImageSlider, { className: "extra", images: images }));
|
|
53
53
|
const component = container.querySelector(':only-child');
|
|
54
54
|
expect(component).toHaveClass('ams-image-slider extra');
|
|
@@ -19,7 +19,7 @@ describe('Image Slider Item', () => {
|
|
|
19
19
|
const component = container.querySelector(':only-child');
|
|
20
20
|
expect(component).toHaveClass('ams-image-slider__item');
|
|
21
21
|
});
|
|
22
|
-
it('renders an
|
|
22
|
+
it('renders an extra class name', () => {
|
|
23
23
|
const { container } = render(_jsx(ImageSliderItem, { className: "extra", slideId: 0 }));
|
|
24
24
|
const component = container.querySelector(':only-child');
|
|
25
25
|
expect(component).toHaveClass('ams-image-slider__item extra');
|
|
@@ -19,7 +19,7 @@ describe('Image Slider Scroller', () => {
|
|
|
19
19
|
const component = container.querySelector(':only-child');
|
|
20
20
|
expect(component).toHaveClass('ams-image-slider__scroller');
|
|
21
21
|
});
|
|
22
|
-
it('renders an
|
|
22
|
+
it('renders an extra class name', () => {
|
|
23
23
|
const { container } = render(_jsx(ImageSliderScroller, { className: "extra" }));
|
|
24
24
|
const component = container.querySelector(':only-child');
|
|
25
25
|
expect(component).toHaveClass('ams-image-slider__scroller extra');
|
|
@@ -26,7 +26,7 @@ export const ImageSliderThumbnails = forwardRef(({ className, imageLabel, thumbn
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}, [currentSlideId, goToNextSlide, goToPreviousSlide]);
|
|
29
|
-
const renderThumbnails = useMemo(() => 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: () => goToSlideId(index), role: "tab", style: { backgroundImage: `url(${src})` }, tabIndex: currentSlideId === index ? 0 : -1 }, index))), [currentSlideId, goToSlideId, imageLabel, thumbnails]);
|
|
29
|
+
const renderThumbnails = useMemo(() => 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: () => goToSlideId(index), role: "tab", style: { backgroundImage: `url(${src})` }, tabIndex: currentSlideId === index ? 0 : -1, type: "button" }, index))), [currentSlideId, goToSlideId, imageLabel, thumbnails]);
|
|
30
30
|
return (_jsx("nav", { ...restProps, className: clsx('ams-image-slider__thumbnails', className), onKeyDown: handleKeyDown, ref: ref, role: "tablist", children: renderThumbnails }));
|
|
31
31
|
});
|
|
32
32
|
ImageSliderThumbnails.displayName = 'ImageSlider.Thumbnails';
|
|
@@ -34,7 +34,7 @@ describe('Image Slider Thumbnails', () => {
|
|
|
34
34
|
const component = container.querySelector(':only-child');
|
|
35
35
|
expect(component).toHaveClass('ams-image-slider__thumbnails');
|
|
36
36
|
});
|
|
37
|
-
it('renders an
|
|
37
|
+
it('renders an extra class name', () => {
|
|
38
38
|
const { container } = render(_jsx(ImageSliderThumbnails, { className: "extra", thumbnails: thumbnails }));
|
|
39
39
|
const component = container.querySelector(':only-child');
|
|
40
40
|
expect(component).toHaveClass('ams-image-slider__thumbnails extra');
|
|
@@ -24,7 +24,7 @@ describe('Invalid Form Alert', () => {
|
|
|
24
24
|
const component = container.querySelector(':only-child');
|
|
25
25
|
expect(component).toHaveClass('ams-invalid-form-alert');
|
|
26
26
|
});
|
|
27
|
-
it('renders an
|
|
27
|
+
it('renders an extra class name', () => {
|
|
28
28
|
const { container } = render(_jsx(InvalidFormAlert, { className: "extra", errors: testErrors, headingLevel: 2 }));
|
|
29
29
|
const component = container.querySelector(':only-child');
|
|
30
30
|
expect(component).toHaveClass('ams-invalid-form-alert extra');
|
package/dist/Label/Label.test.js
CHANGED
|
@@ -39,11 +39,10 @@ describe('Label', () => {
|
|
|
39
39
|
const label = container.querySelector(':only-child');
|
|
40
40
|
expect(label).not.toBeVisible();
|
|
41
41
|
});
|
|
42
|
-
it('renders an
|
|
43
|
-
const { container } = render(_jsx(Label, { className: "
|
|
42
|
+
it('renders an extra class name', () => {
|
|
43
|
+
const { container } = render(_jsx(Label, { className: "extra", htmlFor: "form-control" }));
|
|
44
44
|
const label = container.querySelector(':only-child');
|
|
45
|
-
expect(label).toHaveClass('
|
|
46
|
-
expect(label).toHaveClass('ams-label');
|
|
45
|
+
expect(label).toHaveClass('ams-label extra');
|
|
47
46
|
});
|
|
48
47
|
it('supports ForwardRef in React', () => {
|
|
49
48
|
const ref = createRef();
|
package/dist/Link/Link.d.ts
CHANGED
|
@@ -3,17 +3,11 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { AnchorHTMLAttributes } from 'react';
|
|
6
|
-
type LinkVariant = 'standalone' | 'inline';
|
|
7
6
|
export type LinkProps = {
|
|
8
7
|
/** Changes the text colour for readability on a light or dark background. */
|
|
9
8
|
color?: 'contrast' | 'inverse';
|
|
10
|
-
/** Whether the link is inline or stands alone. */
|
|
11
|
-
variant?: LinkVariant;
|
|
12
9
|
} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'placeholder'>;
|
|
13
10
|
export declare const Link: import("react").ForwardRefExoticComponent<{
|
|
14
11
|
/** Changes the text colour for readability on a light or dark background. */
|
|
15
12
|
color?: "contrast" | "inverse";
|
|
16
|
-
/** Whether the link is inline or stands alone. */
|
|
17
|
-
variant?: LinkVariant;
|
|
18
13
|
} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "placeholder"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
19
|
-
export {};
|
package/dist/Link/Link.js
CHANGED
|
@@ -5,5 +5,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
*/
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { forwardRef } from 'react';
|
|
8
|
-
export const Link = forwardRef(({ children, className, color,
|
|
8
|
+
export const Link = forwardRef(({ children, className, color, ...restProps }, ref) => (_jsx("a", { ...restProps, className: clsx('ams-link', color && `ams-link--${color}`, className), ref: ref, children: children })));
|
|
9
9
|
Link.displayName = 'Link';
|
package/dist/Link/Link.test.js
CHANGED
|
@@ -1,46 +1,39 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { createRef } from 'react';
|
|
4
4
|
import { Link } from './Link';
|
|
5
5
|
import '@testing-library/jest-dom';
|
|
6
6
|
describe('Link', () => {
|
|
7
|
-
const linktext = 'Linktext';
|
|
8
7
|
it('renders with href attribute', () => {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
expect(
|
|
12
|
-
expect(
|
|
8
|
+
render(_jsx(Link, { href: "#" }));
|
|
9
|
+
const component = screen.getByRole('link');
|
|
10
|
+
expect(component).toBeInTheDocument();
|
|
11
|
+
expect(component).toHaveAttribute('href', '#');
|
|
13
12
|
});
|
|
14
|
-
it('renders
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
expect(
|
|
13
|
+
it('renders a design system BEM class name', () => {
|
|
14
|
+
render(_jsx(Link, { href: "#" }));
|
|
15
|
+
const component = screen.getByRole('link');
|
|
16
|
+
expect(component).toHaveClass('ams-link');
|
|
18
17
|
});
|
|
19
|
-
it('renders
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
expect(
|
|
23
|
-
});
|
|
24
|
-
it('renders an additional class name', () => {
|
|
25
|
-
const { container } = render(_jsx(Link, { className: "large" }));
|
|
26
|
-
const link = container.querySelector(':only-child');
|
|
27
|
-
expect(link).toHaveClass('large');
|
|
28
|
-
expect(link).toHaveClass('ams-link');
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
|
+
render(_jsx(Link, { className: "extra", href: "#" }));
|
|
20
|
+
const component = screen.getByRole('link');
|
|
21
|
+
expect(component).toHaveClass('ams-link extra');
|
|
29
22
|
});
|
|
30
23
|
it('renders the class name for contrast color', () => {
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
expect(
|
|
24
|
+
render(_jsx(Link, { color: "contrast", href: "#" }));
|
|
25
|
+
const component = screen.getByRole('link');
|
|
26
|
+
expect(component).toHaveClass('ams-link ams-link--contrast');
|
|
34
27
|
});
|
|
35
28
|
it('renders the class name for inverse color', () => {
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
expect(
|
|
29
|
+
render(_jsx(Link, { color: "inverse", href: "#" }));
|
|
30
|
+
const component = screen.getByRole('link');
|
|
31
|
+
expect(component).toHaveClass('ams-link ams-link--inverse');
|
|
39
32
|
});
|
|
40
33
|
it('supports ForwardRef in React', () => {
|
|
41
34
|
const ref = createRef();
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
expect(ref.current).toBe(
|
|
35
|
+
render(_jsx(Link, { href: "#", ref: ref }));
|
|
36
|
+
const component = screen.getByRole('link');
|
|
37
|
+
expect(ref.current).toBe(component);
|
|
45
38
|
});
|
|
46
39
|
});
|