@amsterdam/design-system-react 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion/Accordion.d.ts +3 -3
- package/dist/Accordion/AccordionSection.d.ts +5 -5
- package/dist/App/App.d.ts +12 -0
- package/dist/App/App.js +8 -0
- package/dist/App/App.test.d.ts +5 -0
- package/dist/App/App.test.js +33 -0
- package/dist/App/index.d.ts +6 -0
- package/dist/App/index.js +5 -0
- package/dist/AppNavigation/AppNavigation.d.ts +45 -0
- package/dist/AppNavigation/AppNavigation.js +18 -0
- package/dist/AppNavigation/AppNavigation.test.d.ts +5 -0
- package/dist/AppNavigation/AppNavigation.test.js +33 -0
- package/dist/AppNavigation/AppNavigationButton.d.ts +18 -0
- package/dist/AppNavigation/AppNavigationButton.js +17 -0
- package/dist/AppNavigation/AppNavigationLink.d.ts +19 -0
- package/dist/AppNavigation/AppNavigationLink.js +19 -0
- package/dist/AppNavigation/AppNavigationMenu.d.ts +9 -0
- package/dist/AppNavigation/AppNavigationMenu.js +5 -0
- package/dist/AppNavigation/index.d.ts +6 -0
- package/dist/AppNavigation/index.js +5 -0
- package/dist/Badge/Badge.d.ts +4 -4
- package/dist/Blockquote/Blockquote.d.ts +5 -5
- package/dist/Breakout/BreakoutCell.d.ts +2 -2
- package/dist/Button/Button.d.ts +7 -5
- package/dist/Button/Button.js +1 -0
- package/dist/Card/Card.d.ts +9 -9
- package/dist/Card/CardHeading.d.ts +4 -4
- package/dist/Card/CardHeadingGroup.d.ts +5 -5
- package/dist/Card/CardImage.d.ts +2 -2
- package/dist/Checkbox/Checkbox.d.ts +5 -5
- package/dist/Column/Column.d.ts +5 -5
- package/dist/DateInput/DateInput.d.ts +4 -4
- package/dist/DescriptionList/DescriptionList.d.ts +5 -5
- package/dist/Dialog/Dialog.d.ts +6 -7
- package/dist/Field/Field.d.ts +5 -5
- package/dist/FieldSet/FieldSet.d.ts +20 -10
- package/dist/FieldSet/FieldSet.js +4 -3
- package/dist/FieldSet/FieldSet.test.js +7 -0
- package/dist/Figure/Figure.d.ts +3 -3
- package/dist/Figure/FigureCaption.d.ts +5 -5
- package/dist/FileList/FileList.d.ts +2 -2
- package/dist/FileList/FileListItem.d.ts +4 -4
- package/dist/Grid/Grid.d.ts +2 -2
- package/dist/Grid/GridCell.d.ts +2 -2
- package/dist/Heading/Heading.d.ts +10 -11
- package/dist/Heading/Heading.js +1 -0
- package/dist/Icon/Icon.d.ts +0 -4
- package/dist/IconButton/IconButton.d.ts +4 -2
- package/dist/IconButton/IconButton.js +1 -0
- package/dist/Image/Image.d.ts +5 -5
- package/dist/ImageSlider/ImageSlider.d.ts +4 -4
- package/dist/ImageSlider/ImageSlider.js +1 -1
- package/dist/ImageSlider/ImageSliderItem.d.ts +5 -5
- package/dist/ImageSlider/ImageSliderItem.js +1 -1
- package/dist/ImageSlider/ImageSliderThumbnails.d.ts +5 -5
- package/dist/InvalidFormAlert/InvalidFormAlertWithErrors.d.ts +2 -2
- package/dist/Label/Label.d.ts +14 -6
- package/dist/Label/Label.js +3 -2
- package/dist/Label/Label.test.js +5 -0
- package/dist/Link/Link.d.ts +4 -4
- package/dist/LinkList/LinkListLink.d.ts +9 -4
- package/dist/LinkList/LinkListLink.js +2 -0
- package/dist/Logo/Logo.d.ts +2 -2
- package/dist/Menu/Menu.d.ts +31 -10
- package/dist/Menu/Menu.js +6 -1
- package/dist/Menu/Menu.test.js +28 -11
- package/dist/Menu/MenuLink.d.ts +8 -2
- package/dist/Menu/MenuLink.test.js +1 -1
- package/dist/OrderedList/OrderedList.d.ts +5 -5
- package/dist/PageHeader/PageHeader.d.ts +7 -7
- package/dist/PageHeader/PageHeader.test.js +0 -4
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.d.ts +1 -1
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.js +0 -4
- package/dist/PageHeader/PageHeaderMenuLink.d.ts +6 -6
- package/dist/PageHeader/PageHeaderMenuLink.js +0 -4
- package/dist/PageHeading/PageHeading.d.ts +5 -5
- package/dist/Pagination/LinkItem.d.ts +3 -3
- package/dist/Pagination/Pagination.d.ts +4 -4
- package/dist/Paragraph/Paragraph.d.ts +5 -9
- package/dist/PasswordInput/PasswordInput.d.ts +4 -4
- package/dist/Radio/Radio.d.ts +5 -5
- package/dist/Row/Row.d.ts +5 -5
- package/dist/SearchField/SearchField.d.ts +3 -3
- package/dist/SearchField/SearchField.test.js +2 -19
- package/dist/SearchField/SearchFieldButton.js +1 -1
- package/dist/SearchField/SearchFieldButton.test.d.ts +5 -0
- package/dist/SearchField/SearchFieldButton.test.js +47 -0
- package/dist/SearchField/SearchFieldInput.d.ts +2 -2
- package/dist/Select/Select.d.ts +5 -5
- package/dist/Spotlight/Spotlight.d.ts +6 -6
- package/dist/Spotlight/Spotlight.js +0 -4
- package/dist/StandaloneLink/StandaloneLink.d.ts +4 -4
- package/dist/Table/TableCaption.d.ts +0 -4
- package/dist/TableOfContents/TableOfContents.d.ts +7 -7
- package/dist/TableOfContents/TableOfContentsLink.d.ts +4 -4
- package/dist/Tabs/Tabs.d.ts +11 -11
- package/dist/Tabs/TabsButton.d.ts +5 -5
- package/dist/Tabs/TabsPanel.d.ts +5 -5
- package/dist/TextArea/TextArea.d.ts +12 -6
- package/dist/TextInput/TextInput.d.ts +4 -4
- package/dist/TimeInput/TimeInput.d.ts +4 -4
- package/dist/UnorderedList/UnorderedList.d.ts +5 -5
- package/dist/common/useIsAfterBreakpoint.d.ts +4 -0
- package/dist/common/useIsAfterBreakpoint.js +4 -4
- package/dist/index.cjs.js +39 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +61 -1860
- package/dist/index.esm.js +39 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -20
package/dist/Menu/Menu.d.ts
CHANGED
|
@@ -3,22 +3,43 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
-
export type MenuProps =
|
|
6
|
+
export type MenuProps = {
|
|
7
|
+
/**
|
|
8
|
+
* A name for this menu, which screen readers will announce.
|
|
9
|
+
* Only applies to the `inWideWindow` appearance: otherwise, the menu is in the Page Header, which ensures accessibility itself.
|
|
10
|
+
* @default Hoofdnavigatie
|
|
11
|
+
*/
|
|
7
12
|
accessibleName?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
/** Hides the component on narrow windows. */
|
|
14
|
+
inWideWindow?: boolean;
|
|
15
|
+
} & PropsWithChildren<HTMLAttributes<HTMLElement>>;
|
|
16
|
+
export declare const MenuRoot: import("react").ForwardRefExoticComponent<{
|
|
17
|
+
/**
|
|
18
|
+
* A name for this menu, which screen readers will announce.
|
|
19
|
+
* Only applies to the `inWideWindow` appearance: otherwise, the menu is in the Page Header, which ensures accessibility itself.
|
|
20
|
+
* @default Hoofdnavigatie
|
|
21
|
+
*/
|
|
12
22
|
accessibleName?: string;
|
|
13
|
-
|
|
23
|
+
/** Hides the component on narrow windows. */
|
|
24
|
+
inWideWindow?: boolean;
|
|
25
|
+
} & HTMLAttributes<HTMLElement> & {
|
|
26
|
+
children?: import("react").ReactNode | undefined;
|
|
27
|
+
} & import("react").RefAttributes<any>>;
|
|
14
28
|
/**
|
|
15
29
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-navigation-menu--docs Menu docs at Amsterdam Design System}
|
|
16
30
|
*/
|
|
17
|
-
export declare const Menu: import("react").ForwardRefExoticComponent<
|
|
18
|
-
|
|
19
|
-
|
|
31
|
+
export declare const Menu: import("react").ForwardRefExoticComponent<{
|
|
32
|
+
/**
|
|
33
|
+
* A name for this menu, which screen readers will announce.
|
|
34
|
+
* Only applies to the `inWideWindow` appearance: otherwise, the menu is in the Page Header, which ensures accessibility itself.
|
|
35
|
+
* @default Hoofdnavigatie
|
|
36
|
+
*/
|
|
20
37
|
accessibleName?: string;
|
|
21
|
-
|
|
38
|
+
/** Hides the component on narrow windows. */
|
|
39
|
+
inWideWindow?: boolean;
|
|
40
|
+
} & HTMLAttributes<HTMLElement> & {
|
|
41
|
+
children?: import("react").ReactNode | undefined;
|
|
42
|
+
} & import("react").RefAttributes<any>> & {
|
|
22
43
|
Link: import("react").ForwardRefExoticComponent<{
|
|
23
44
|
color?: "contrast" | "inverse";
|
|
24
45
|
icon: import("..").IconProps["svg"];
|
package/dist/Menu/Menu.js
CHANGED
|
@@ -2,7 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { MenuLink } from './MenuLink';
|
|
5
|
-
export const MenuRoot = forwardRef(({ accessibleName = 'Hoofdnavigatie', children, className, ...restProps }, ref) =>
|
|
5
|
+
export const MenuRoot = forwardRef(({ accessibleName = 'Hoofdnavigatie', children, className, inWideWindow, ...restProps }, ref) => {
|
|
6
|
+
// In a medium or narrow window, the Menu is a child of the `nav` of Page Header.
|
|
7
|
+
// In a wide window, we render a `nav` element and the related accessibility features.
|
|
8
|
+
const Tag = inWideWindow ? 'nav' : 'div';
|
|
9
|
+
return (_jsxs(Tag, { ...restProps, "aria-labelledby": inWideWindow ? 'primary-navigation' : undefined, className: clsx('ams-menu', inWideWindow && `ams-menu--in-wide-window`, className), ref: ref, children: [inWideWindow && (_jsx("h2", { className: "ams-visually-hidden", id: "primary-navigation", children: accessibleName })), _jsx("ul", { className: "ams-menu__list", children: children })] }));
|
|
10
|
+
});
|
|
6
11
|
MenuRoot.displayName = 'Menu';
|
|
7
12
|
/**
|
|
8
13
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-navigation-menu--docs Menu docs at Amsterdam Design System}
|
package/dist/Menu/Menu.test.js
CHANGED
|
@@ -9,30 +9,47 @@ import { Menu } from './Menu';
|
|
|
9
9
|
import '@testing-library/jest-dom';
|
|
10
10
|
describe('Menu', () => {
|
|
11
11
|
it('renders', () => {
|
|
12
|
-
render(_jsx(Menu, {}));
|
|
13
|
-
const component =
|
|
12
|
+
const { container } = render(_jsx(Menu, {}));
|
|
13
|
+
const component = container.querySelector(':only-child');
|
|
14
|
+
const list = screen.getByRole('list');
|
|
14
15
|
expect(component).toBeInTheDocument();
|
|
15
16
|
expect(component).toBeVisible();
|
|
17
|
+
expect(component).toContainElement(list);
|
|
16
18
|
});
|
|
17
19
|
it('renders a design system BEM class name', () => {
|
|
18
|
-
render(_jsx(Menu, {}));
|
|
19
|
-
const component =
|
|
20
|
+
const { container } = render(_jsx(Menu, {}));
|
|
21
|
+
const component = container.querySelector(':only-child');
|
|
20
22
|
expect(component).toHaveClass('ams-menu');
|
|
21
23
|
});
|
|
22
24
|
it('renders an extra class name', () => {
|
|
23
|
-
render(_jsx(Menu, { className: "extra" }));
|
|
24
|
-
const component =
|
|
25
|
+
const { container } = render(_jsx(Menu, { className: "extra" }));
|
|
26
|
+
const component = container.querySelector(':only-child');
|
|
25
27
|
expect(component).toHaveClass('ams-menu extra');
|
|
26
28
|
});
|
|
29
|
+
it('renders a `nav` element with the `inWideWindow` prop', () => {
|
|
30
|
+
render(_jsx(Menu, { inWideWindow: true }));
|
|
31
|
+
const component = screen.getByRole('navigation');
|
|
32
|
+
expect(component).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
it('renders the class name for the `inWideWindow` prop', () => {
|
|
35
|
+
const { container } = render(_jsx(Menu, { inWideWindow: true }));
|
|
36
|
+
const component = container.querySelector(':only-child');
|
|
37
|
+
expect(component).toHaveClass('ams-menu--in-wide-window');
|
|
38
|
+
});
|
|
27
39
|
it('supports ForwardRef in React', () => {
|
|
28
40
|
const ref = createRef();
|
|
29
|
-
render(_jsx(Menu, { ref: ref }));
|
|
30
|
-
const component =
|
|
41
|
+
const { container } = render(_jsx(Menu, { ref: ref }));
|
|
42
|
+
const component = container.querySelector(':only-child');
|
|
31
43
|
expect(ref.current).toBe(component);
|
|
32
44
|
});
|
|
33
|
-
it('renders a custom accessible name
|
|
34
|
-
render(_jsx(Menu, { accessibleName: "Custom accessible name" }));
|
|
35
|
-
const component = screen.getByRole('
|
|
45
|
+
it('renders a custom accessible name', () => {
|
|
46
|
+
render(_jsx(Menu, { accessibleName: "Custom accessible name", inWideWindow: true }));
|
|
47
|
+
const component = screen.getByRole('navigation', { name: 'Custom accessible name' });
|
|
36
48
|
expect(component).toBeInTheDocument();
|
|
37
49
|
});
|
|
50
|
+
it('doesn’t render a custom accessible name if not in a wide window', () => {
|
|
51
|
+
render(_jsx(Menu, { accessibleName: "Custom accessible name" }));
|
|
52
|
+
const component = screen.queryByRole('navigation', { name: 'Custom accessible name' });
|
|
53
|
+
expect(component).not.toBeInTheDocument();
|
|
54
|
+
});
|
|
38
55
|
});
|
package/dist/Menu/MenuLink.d.ts
CHANGED
|
@@ -5,13 +5,19 @@
|
|
|
5
5
|
import type { AnchorHTMLAttributes, PropsWithChildren } from 'react';
|
|
6
6
|
import type { IconProps } from '../Icon';
|
|
7
7
|
export type MenuLinkProps = {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Changes the text colour for readability on a light or dark background.
|
|
10
|
+
* @deprecated The menu has a dark background now, so this is no longer needed.
|
|
11
|
+
*/
|
|
9
12
|
color?: 'contrast' | 'inverse';
|
|
10
13
|
/** An icon to display instead of the default chevron. Don’t mix custom icons with chevrons in one list. */
|
|
11
14
|
icon: IconProps['svg'];
|
|
12
15
|
} & PropsWithChildren<AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
13
16
|
export declare const MenuLink: import("react").ForwardRefExoticComponent<{
|
|
14
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Changes the text colour for readability on a light or dark background.
|
|
19
|
+
* @deprecated The menu has a dark background now, so this is no longer needed.
|
|
20
|
+
*/
|
|
15
21
|
color?: "contrast" | "inverse";
|
|
16
22
|
/** An icon to display instead of the default chevron. Don’t mix custom icons with chevrons in one list. */
|
|
17
23
|
icon: IconProps["svg"];
|
|
@@ -8,7 +8,7 @@ import { DocumentIcon, StarIcon } from '@amsterdam/design-system-react-icons';
|
|
|
8
8
|
import { render, screen } from '@testing-library/react';
|
|
9
9
|
import { createRef } from 'react';
|
|
10
10
|
import { Menu } from './Menu';
|
|
11
|
-
describe('Menu
|
|
11
|
+
describe('Menu Link', () => {
|
|
12
12
|
it('renders', () => {
|
|
13
13
|
const { container } = render(_jsx(Menu.Link, { href: "#", icon: DocumentIcon }));
|
|
14
14
|
const listItem = screen.getByRole('listitem');
|
|
@@ -3,26 +3,26 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { OlHTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
-
export type OrderedListProps =
|
|
6
|
+
export type OrderedListProps = {
|
|
7
7
|
/** Changes the text colour for readability on a dark background. */
|
|
8
8
|
color?: 'inverse';
|
|
9
9
|
/** Whether the list items show a marker. */
|
|
10
10
|
markers?: boolean;
|
|
11
11
|
/** The size of the text. */
|
|
12
12
|
size?: 'small';
|
|
13
|
-
}
|
|
13
|
+
} & PropsWithChildren<OlHTMLAttributes<HTMLOListElement>>;
|
|
14
14
|
/**
|
|
15
15
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-text-ordered-list--docs Ordered List docs at Amsterdam Design System}
|
|
16
16
|
*/
|
|
17
|
-
export declare const OrderedList: import("react").ForwardRefExoticComponent<
|
|
18
|
-
children?: import("react").ReactNode | undefined;
|
|
19
|
-
} & {
|
|
17
|
+
export declare const OrderedList: import("react").ForwardRefExoticComponent<{
|
|
20
18
|
/** Changes the text colour for readability on a dark background. */
|
|
21
19
|
color?: "inverse";
|
|
22
20
|
/** Whether the list items show a marker. */
|
|
23
21
|
markers?: boolean;
|
|
24
22
|
/** The size of the text. */
|
|
25
23
|
size?: "small";
|
|
24
|
+
} & OlHTMLAttributes<HTMLOListElement> & {
|
|
25
|
+
children?: import("react").ReactNode | undefined;
|
|
26
26
|
} & import("react").RefAttributes<HTMLOListElement>> & {
|
|
27
27
|
Item: import("react").ForwardRefExoticComponent<import("react").LiHTMLAttributes<HTMLLIElement> & {
|
|
28
28
|
children?: import("react").ReactNode | undefined;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { AnchorHTMLAttributes, ComponentType, HTMLAttributes, ReactNode } from 'react';
|
|
6
6
|
import type { LogoBrand } from '../Logo';
|
|
7
|
-
export type PageHeaderProps =
|
|
7
|
+
export type PageHeaderProps = {
|
|
8
8
|
/** The name of the application. */
|
|
9
9
|
brandName?: string;
|
|
10
10
|
/** The accessible name of the logo. */
|
|
@@ -25,11 +25,11 @@ export type PageHeaderProps = HTMLAttributes<HTMLElement> & {
|
|
|
25
25
|
navigationLabel?: string;
|
|
26
26
|
/** Whether the menu button is visible on wide screens. */
|
|
27
27
|
noMenuButtonOnWideWindow?: boolean;
|
|
28
|
-
}
|
|
28
|
+
} & HTMLAttributes<HTMLElement>;
|
|
29
29
|
/**
|
|
30
30
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-containers-page-header--docs Page Header docs at Amsterdam Design System}
|
|
31
31
|
*/
|
|
32
|
-
export declare const PageHeader: import("react").ForwardRefExoticComponent<
|
|
32
|
+
export declare const PageHeader: import("react").ForwardRefExoticComponent<{
|
|
33
33
|
/** The name of the application. */
|
|
34
34
|
brandName?: string;
|
|
35
35
|
/** The accessible name of the logo. */
|
|
@@ -50,11 +50,11 @@ export declare const PageHeader: import("react").ForwardRefExoticComponent<HTMLA
|
|
|
50
50
|
navigationLabel?: string;
|
|
51
51
|
/** Whether the menu button is visible on wide screens. */
|
|
52
52
|
noMenuButtonOnWideWindow?: boolean;
|
|
53
|
-
} & import("react").RefAttributes<HTMLElement>> & {
|
|
53
|
+
} & HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>> & {
|
|
54
54
|
GridCellNarrowWindowOnly: import("react").ForwardRefExoticComponent<import("..").GridCellProps & import("react").RefAttributes<HTMLElement>>;
|
|
55
|
-
MenuLink: import("react").ForwardRefExoticComponent<
|
|
56
|
-
children?: ReactNode | undefined;
|
|
57
|
-
} & {
|
|
55
|
+
MenuLink: import("react").ForwardRefExoticComponent<{
|
|
58
56
|
fixed?: boolean;
|
|
57
|
+
} & AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
58
|
+
children?: ReactNode | undefined;
|
|
59
59
|
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
60
60
|
};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
2
|
import { render, screen } from '@testing-library/react';
|
|
7
3
|
import userEvent from '@testing-library/user-event';
|
|
8
4
|
import { createRef } from 'react';
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* @license EUPL-1.2+
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
|
-
import { GridCellProps } from '../Grid';
|
|
5
|
+
import type { GridCellProps } from '../Grid';
|
|
6
6
|
export declare const PageHeaderGridCellNarrowWindowOnly: import("react").ForwardRefExoticComponent<GridCellProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @license EUPL-1.2+
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
|
-
import { AnchorHTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
-
export type PageHeaderMenuLinkProps =
|
|
5
|
+
import type { AnchorHTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export type PageHeaderMenuLinkProps = {
|
|
7
7
|
fixed?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare const PageHeaderMenuLink: import("react").ForwardRefExoticComponent<
|
|
10
|
-
children?: import("react").ReactNode | undefined;
|
|
11
|
-
} & {
|
|
8
|
+
} & PropsWithChildren<AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
9
|
+
export declare const PageHeaderMenuLink: import("react").ForwardRefExoticComponent<{
|
|
12
10
|
fixed?: boolean;
|
|
11
|
+
} & AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
12
|
+
children?: import("react").ReactNode | undefined;
|
|
13
13
|
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
2
|
import { clsx } from 'clsx';
|
|
7
3
|
import { forwardRef } from 'react';
|
|
8
4
|
export const PageHeaderMenuLink = forwardRef(({ children, className, fixed, ...restProps }, ref) => (_jsx("li", { className: clsx('ams-page-header__menu-item', fixed && 'ams-page-header__menu-item--fixed'), children: _jsx("a", { ...restProps, className: clsx('ams-page-header__menu-link', className), ref: ref, children: children }) })));
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
-
export type PageHeadingProps =
|
|
6
|
+
export type PageHeadingProps = {
|
|
7
7
|
/** Changes the text colour for readability on a dark background. */
|
|
8
8
|
color?: 'inverse';
|
|
9
|
-
}
|
|
9
|
+
} & PropsWithChildren<HTMLAttributes<HTMLHeadingElement>>;
|
|
10
10
|
/**
|
|
11
11
|
* @deprecated We no longer use this size of headings. Use `Heading` with level 1 instead.
|
|
12
12
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-text-page-heading--docs Page Heading docs at Amsterdam Design System}
|
|
13
13
|
*/
|
|
14
|
-
export declare const PageHeading: import("react").ForwardRefExoticComponent<
|
|
15
|
-
children?: import("react").ReactNode | undefined;
|
|
16
|
-
} & {
|
|
14
|
+
export declare const PageHeading: import("react").ForwardRefExoticComponent<{
|
|
17
15
|
/** Changes the text colour for readability on a dark background. */
|
|
18
16
|
color?: "inverse";
|
|
17
|
+
} & HTMLAttributes<HTMLHeadingElement> & {
|
|
18
|
+
children?: import("react").ReactNode | undefined;
|
|
19
19
|
} & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @license EUPL-1.2+
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
|
-
import { PaginationProps } from './Pagination';
|
|
6
|
-
type LinkItemProps =
|
|
5
|
+
import type { PaginationProps } from './Pagination';
|
|
6
|
+
type LinkItemProps = {
|
|
7
7
|
currentPage: PaginationProps['page'];
|
|
8
8
|
pageNumber: number;
|
|
9
|
-
}
|
|
9
|
+
} & Pick<PaginationProps, 'linkComponent' | 'linkTemplate'>;
|
|
10
10
|
export declare const LinkItem: ({ currentPage, linkComponent, linkTemplate, pageNumber }: LinkItemProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
11
|
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { AnchorHTMLAttributes, ComponentType, HTMLAttributes } from 'react';
|
|
6
|
-
export type PaginationProps =
|
|
6
|
+
export type PaginationProps = {
|
|
7
7
|
/** The accessible name for the Pagination component. */
|
|
8
8
|
accessibleName?: string;
|
|
9
9
|
/**
|
|
@@ -50,11 +50,11 @@ export type PaginationProps = HTMLAttributes<HTMLElement> & {
|
|
|
50
50
|
* Note: must be unique for the page.
|
|
51
51
|
*/
|
|
52
52
|
visuallyHiddenLabelId?: string;
|
|
53
|
-
}
|
|
53
|
+
} & HTMLAttributes<HTMLElement>;
|
|
54
54
|
/**
|
|
55
55
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-navigation-pagination--docs Pagination docs at Amsterdam Design System}
|
|
56
56
|
*/
|
|
57
|
-
export declare const Pagination: import("react").ForwardRefExoticComponent<
|
|
57
|
+
export declare const Pagination: import("react").ForwardRefExoticComponent<{
|
|
58
58
|
/** The accessible name for the Pagination component. */
|
|
59
59
|
accessibleName?: string;
|
|
60
60
|
/**
|
|
@@ -101,4 +101,4 @@ export declare const Pagination: import("react").ForwardRefExoticComponent<HTMLA
|
|
|
101
101
|
* Note: must be unique for the page.
|
|
102
102
|
*/
|
|
103
103
|
visuallyHiddenLabelId?: string;
|
|
104
|
-
} & import("react").RefAttributes<HTMLElement>>;
|
|
104
|
+
} & HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license EUPL-1.2+
|
|
3
|
-
* Copyright Gemeente Amsterdam
|
|
4
|
-
*/
|
|
5
1
|
/**
|
|
6
2
|
* @license EUPL-1.2+
|
|
7
3
|
* Copyright (c) 2021 Robbert Broersma
|
|
8
4
|
* Copyright Gemeente Amsterdam
|
|
9
5
|
*/
|
|
10
6
|
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
11
|
-
export type ParagraphProps =
|
|
7
|
+
export type ParagraphProps = {
|
|
12
8
|
/** Changes the text colour for readability on a dark background. */
|
|
13
9
|
color?: 'inverse';
|
|
14
10
|
/** The size of the text. */
|
|
15
11
|
size?: 'small' | 'large';
|
|
16
|
-
}
|
|
12
|
+
} & PropsWithChildren<HTMLAttributes<HTMLParagraphElement>>;
|
|
17
13
|
/**
|
|
18
14
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-text-paragraph--docs Paragraph docs at Amsterdam Design System}
|
|
19
15
|
*/
|
|
20
|
-
export declare const Paragraph: import("react").ForwardRefExoticComponent<
|
|
21
|
-
children?: import("react").ReactNode | undefined;
|
|
22
|
-
} & {
|
|
16
|
+
export declare const Paragraph: import("react").ForwardRefExoticComponent<{
|
|
23
17
|
/** Changes the text colour for readability on a dark background. */
|
|
24
18
|
color?: "inverse";
|
|
25
19
|
/** The size of the text. */
|
|
26
20
|
size?: "small" | "large";
|
|
21
|
+
} & HTMLAttributes<HTMLParagraphElement> & {
|
|
22
|
+
children?: import("react").ReactNode | undefined;
|
|
27
23
|
} & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { InputHTMLAttributes } from 'react';
|
|
6
|
-
export type PasswordInputProps =
|
|
6
|
+
export type PasswordInputProps = {
|
|
7
7
|
/** Whether the value fails a validation rule. */
|
|
8
8
|
invalid?: boolean;
|
|
9
|
-
}
|
|
9
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'aria-invalid' | 'autoCapitalize' | 'autoCorrect' | 'spellCheck' | 'type'>;
|
|
10
10
|
/**
|
|
11
11
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-password-input--docs Password Input docs at Amsterdam Design System}
|
|
12
12
|
*/
|
|
13
|
-
export declare const PasswordInput: import("react").ForwardRefExoticComponent<
|
|
13
|
+
export declare const PasswordInput: import("react").ForwardRefExoticComponent<{
|
|
14
14
|
/** Whether the value fails a validation rule. */
|
|
15
15
|
invalid?: boolean;
|
|
16
|
-
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
16
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "aria-invalid" | "autoCapitalize" | "spellCheck" | "autoCorrect"> & import("react").RefAttributes<HTMLInputElement>>;
|
package/dist/Radio/Radio.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { InputHTMLAttributes, PropsWithChildren, ReactNode } from 'react';
|
|
6
|
-
export type RadioProps =
|
|
6
|
+
export type RadioProps = {
|
|
7
7
|
/**
|
|
8
8
|
* An icon to display instead of the default icon.
|
|
9
9
|
* @default RadioIcon
|
|
@@ -11,13 +11,11 @@ export type RadioProps = PropsWithChildren<Omit<InputHTMLAttributes<HTMLInputEle
|
|
|
11
11
|
icon?: Function | ReactNode;
|
|
12
12
|
/** Whether the value fails a validation rule. */
|
|
13
13
|
invalid?: boolean;
|
|
14
|
-
}
|
|
14
|
+
} & PropsWithChildren<Omit<InputHTMLAttributes<HTMLInputElement>, 'aria-invalid' | 'type'>>;
|
|
15
15
|
/**
|
|
16
16
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-radio--docs Radio docs at Amsterdam Design System}
|
|
17
17
|
*/
|
|
18
|
-
export declare const Radio: import("react").ForwardRefExoticComponent<
|
|
19
|
-
children?: ReactNode | undefined;
|
|
20
|
-
} & {
|
|
18
|
+
export declare const Radio: import("react").ForwardRefExoticComponent<{
|
|
21
19
|
/**
|
|
22
20
|
* An icon to display instead of the default icon.
|
|
23
21
|
* @default RadioIcon
|
|
@@ -25,4 +23,6 @@ export declare const Radio: import("react").ForwardRefExoticComponent<Omit<Input
|
|
|
25
23
|
icon?: Function | ReactNode;
|
|
26
24
|
/** Whether the value fails a validation rule. */
|
|
27
25
|
invalid?: boolean;
|
|
26
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "aria-invalid"> & {
|
|
27
|
+
children?: ReactNode | undefined;
|
|
28
28
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
package/dist/Row/Row.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const rowTags: readonly ["article", "div", "section"];
|
|
|
8
8
|
type RowTag = (typeof rowTags)[number];
|
|
9
9
|
export declare const rowGapSizes: readonly ["none", "x-small", "small", "large", "x-large"];
|
|
10
10
|
type RowGap = (typeof rowGapSizes)[number];
|
|
11
|
-
export type RowProps =
|
|
11
|
+
export type RowProps = {
|
|
12
12
|
/**
|
|
13
13
|
* The horizontal alignment of the items in the row.
|
|
14
14
|
* @default start
|
|
@@ -34,13 +34,11 @@ export type RowProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {
|
|
|
34
34
|
* @default false
|
|
35
35
|
*/
|
|
36
36
|
wrap?: boolean;
|
|
37
|
-
}
|
|
37
|
+
} & PropsWithChildren<HTMLAttributes<HTMLElement>>;
|
|
38
38
|
/**
|
|
39
39
|
* @see {@link https://designsystem.amsterdam/?path=/docs/components-layout-row--docs Row docs at Amsterdam Design System}
|
|
40
40
|
*/
|
|
41
|
-
export declare const Row: import("react").ForwardRefExoticComponent<
|
|
42
|
-
children?: import("react").ReactNode | undefined;
|
|
43
|
-
} & {
|
|
41
|
+
export declare const Row: import("react").ForwardRefExoticComponent<{
|
|
44
42
|
/**
|
|
45
43
|
* The horizontal alignment of the items in the row.
|
|
46
44
|
* @default start
|
|
@@ -66,5 +64,7 @@ export declare const Row: import("react").ForwardRefExoticComponent<HTMLAttribut
|
|
|
66
64
|
* @default false
|
|
67
65
|
*/
|
|
68
66
|
wrap?: boolean;
|
|
67
|
+
} & HTMLAttributes<HTMLElement> & {
|
|
68
|
+
children?: import("react").ReactNode | undefined;
|
|
69
69
|
} & import("react").RefAttributes<unknown>>;
|
|
70
70
|
export {};
|
|
@@ -14,6 +14,7 @@ export declare const SearchField: import("react").ForwardRefExoticComponent<HTML
|
|
|
14
14
|
children?: import("react").ReactNode;
|
|
15
15
|
className?: string | undefined | undefined;
|
|
16
16
|
color?: string | undefined | undefined;
|
|
17
|
+
type?: "submit" | "reset" | "button" | undefined | undefined;
|
|
17
18
|
defaultChecked?: boolean | undefined | undefined;
|
|
18
19
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
19
20
|
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
@@ -279,7 +280,6 @@ export declare const SearchField: import("react").ForwardRefExoticComponent<HTML
|
|
|
279
280
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
280
281
|
form?: string | undefined | undefined;
|
|
281
282
|
value?: string | number | readonly string[] | undefined;
|
|
282
|
-
type?: "submit" | "reset" | "button" | undefined | undefined;
|
|
283
283
|
disabled?: boolean | undefined | undefined;
|
|
284
284
|
formAction?: string | undefined;
|
|
285
285
|
formEncType?: string | undefined | undefined;
|
|
@@ -288,8 +288,8 @@ export declare const SearchField: import("react").ForwardRefExoticComponent<HTML
|
|
|
288
288
|
formTarget?: string | undefined | undefined;
|
|
289
289
|
name?: string | undefined | undefined;
|
|
290
290
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
291
|
-
Input: import("react").ForwardRefExoticComponent<
|
|
291
|
+
Input: import("react").ForwardRefExoticComponent<{
|
|
292
292
|
invalid?: boolean;
|
|
293
293
|
label?: string;
|
|
294
|
-
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
294
|
+
} & import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
|
|
295
295
|
};
|
|
@@ -8,30 +8,13 @@ import { createRef } from 'react';
|
|
|
8
8
|
import { SearchField } from './SearchField';
|
|
9
9
|
import '@testing-library/jest-dom';
|
|
10
10
|
describe('Search field', () => {
|
|
11
|
-
it('renders the
|
|
11
|
+
it('renders the form', () => {
|
|
12
12
|
render(_jsx(SearchField, {}));
|
|
13
13
|
const component = screen.getByRole('search');
|
|
14
14
|
expect(component).toBeInTheDocument();
|
|
15
15
|
expect(component).toBeVisible();
|
|
16
16
|
});
|
|
17
|
-
it('renders the
|
|
18
|
-
render(_jsx(SearchField.Input, {}));
|
|
19
|
-
const component = screen.getByRole('searchbox');
|
|
20
|
-
expect(component).toBeInTheDocument();
|
|
21
|
-
expect(component).toBeVisible();
|
|
22
|
-
});
|
|
23
|
-
it('renders the button', () => {
|
|
24
|
-
render(_jsx(SearchField.Button, {}));
|
|
25
|
-
const component = screen.getByRole('button');
|
|
26
|
-
expect(component).toBeInTheDocument();
|
|
27
|
-
expect(component).toBeVisible();
|
|
28
|
-
});
|
|
29
|
-
it('renders the button with a label', () => {
|
|
30
|
-
render(_jsx(SearchField.Button, { children: "Search" }));
|
|
31
|
-
const component = screen.getByRole('button', { name: 'Search' });
|
|
32
|
-
expect(component).toBeInTheDocument();
|
|
33
|
-
});
|
|
34
|
-
it('renders the outer container design system BEM class name', () => {
|
|
17
|
+
it('renders the design system BEM class name', () => {
|
|
35
18
|
render(_jsx(SearchField, {}));
|
|
36
19
|
const component = screen.getByRole('search');
|
|
37
20
|
expect(component).toHaveClass('ams-search-field');
|
|
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { SearchIcon } from '@amsterdam/design-system-react-icons';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { Button } from '../Button';
|
|
5
|
-
export const SearchFieldButton = forwardRef(({ children = 'Zoeken', ...restProps }, ref) => (_jsx(Button, { ...restProps, icon: SearchIcon, iconOnly: true, ref: ref, children: children })));
|
|
5
|
+
export const SearchFieldButton = forwardRef(({ children = 'Zoeken', ...restProps }, ref) => (_jsx(Button, { ...restProps, icon: SearchIcon, iconOnly: true, ref: ref, type: "submit", children: children })));
|
|
6
6
|
SearchFieldButton.displayName = 'SearchField.Button';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @license EUPL-1.2+
|
|
4
|
+
* Copyright Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import '@testing-library/jest-dom';
|
|
7
|
+
import { render, screen } from '@testing-library/react';
|
|
8
|
+
import { createRef } from 'react';
|
|
9
|
+
import { SearchField } from './SearchField';
|
|
10
|
+
describe('Search Field Button', () => {
|
|
11
|
+
it('renders a submit button', () => {
|
|
12
|
+
render(_jsx(SearchField.Button, { children: "Click me!" }));
|
|
13
|
+
const button = screen.getByRole('button', {
|
|
14
|
+
name: 'Click me!',
|
|
15
|
+
});
|
|
16
|
+
expect(button).toBeInTheDocument();
|
|
17
|
+
expect(button).toBeVisible();
|
|
18
|
+
expect(button).toHaveAttribute('type', 'submit');
|
|
19
|
+
});
|
|
20
|
+
it('renders a default label', () => {
|
|
21
|
+
render(_jsx(SearchField.Button, {}));
|
|
22
|
+
const button = screen.getByRole('button');
|
|
23
|
+
expect(button).toHaveTextContent('Zoeken');
|
|
24
|
+
});
|
|
25
|
+
it('renders the primary variant of the Button component', () => {
|
|
26
|
+
render(_jsx(SearchField.Button, { children: "Click me!" }));
|
|
27
|
+
const button = screen.getByRole('button', {
|
|
28
|
+
name: 'Click me!',
|
|
29
|
+
});
|
|
30
|
+
expect(button).toHaveClass('ams-button ams-button--primary');
|
|
31
|
+
});
|
|
32
|
+
it('renders an extra class name', () => {
|
|
33
|
+
render(_jsx(SearchField.Button, { className: "extra", children: "Click me!" }));
|
|
34
|
+
const button = screen.getByRole('button', {
|
|
35
|
+
name: 'Click me!',
|
|
36
|
+
});
|
|
37
|
+
expect(button).toHaveClass('ams-button extra');
|
|
38
|
+
});
|
|
39
|
+
it('is able to pass a React ref', () => {
|
|
40
|
+
const ref = createRef();
|
|
41
|
+
render(_jsx(SearchField.Button, { ref: ref, children: "Click me!" }));
|
|
42
|
+
const button = screen.getByRole('button', {
|
|
43
|
+
name: 'Click me!',
|
|
44
|
+
});
|
|
45
|
+
expect(ref.current).toBe(button);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright Gemeente Amsterdam
|
|
4
4
|
*/
|
|
5
5
|
import type { InputHTMLAttributes } from 'react';
|
|
6
|
-
export declare const SearchFieldInput: import("react").ForwardRefExoticComponent<
|
|
6
|
+
export declare const SearchFieldInput: import("react").ForwardRefExoticComponent<{
|
|
7
7
|
/** Whether the value fails a validation rule. */
|
|
8
8
|
invalid?: boolean;
|
|
9
9
|
/** Describes the field for screen readers. */
|
|
10
10
|
label?: string;
|
|
11
|
-
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
11
|
+
} & InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
|