@amsterdam/design-system-react 0.1.4 → 0.1.5

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.
Files changed (49) hide show
  1. package/README.md +21 -4
  2. package/dist/Blockquote/Blockquote.d.ts +15 -0
  3. package/dist/Blockquote/Blockquote.test.d.ts +1 -0
  4. package/dist/Blockquote/index.d.ts +2 -0
  5. package/dist/Breadcrumb/Breadcrumb.d.ts +11 -0
  6. package/dist/Breadcrumb/Breadcrumb.test.d.ts +1 -0
  7. package/dist/Breadcrumb/index.d.ts +2 -0
  8. package/dist/Checkbox/Checkbox.d.ts +12 -0
  9. package/dist/Checkbox/Checkbox.test.d.ts +1 -0
  10. package/dist/Checkbox/index.d.ts +2 -0
  11. package/dist/Footer/Footer.d.ts +23 -0
  12. package/dist/Footer/Footer.test.d.ts +1 -0
  13. package/dist/Footer/index.d.ts +1 -0
  14. package/dist/Grid/GridCell.d.ts +18 -0
  15. package/dist/Grid/PageGrid.d.ts +10 -0
  16. package/dist/Grid/index.d.ts +4 -0
  17. package/dist/Heading/Heading.d.ts +5 -0
  18. package/dist/Link/Link.d.ts +12 -6
  19. package/dist/OrderedList/OrderedList.d.ts +17 -0
  20. package/dist/OrderedList/OrderedList.test.d.ts +1 -0
  21. package/dist/OrderedList/index.d.ts +2 -0
  22. package/dist/PageHeading/PageHeading.d.ts +15 -0
  23. package/dist/PageHeading/PageHeading.test.d.ts +1 -0
  24. package/dist/PageHeading/index.d.ts +2 -0
  25. package/dist/PageMenu/PageMenu.d.ts +20 -0
  26. package/dist/PageMenu/PageMenu.test.d.ts +1 -0
  27. package/dist/PageMenu/index.d.ts +2 -0
  28. package/dist/Paragraph/Paragraph.d.ts +7 -1
  29. package/dist/Testula/Testula.d.ts +8 -0
  30. package/dist/Testula/Testula.test.d.ts +1 -0
  31. package/dist/Testula/index.d.ts +2 -0
  32. package/dist/TopTaskLink/TopTaskLink.d.ts +10 -0
  33. package/dist/TopTaskLink/TopTaskLink.test.d.ts +1 -0
  34. package/dist/TopTaskLink/index.d.ts +1 -0
  35. package/dist/UnorderedList/UnorderedList.d.ts +8 -5
  36. package/dist/UnorderedList/index.d.ts +1 -0
  37. package/dist/VisuallyHidden/VisuallyHidden.d.ts +8 -0
  38. package/dist/VisuallyHidden/VisuallyHidden.test.d.ts +1 -0
  39. package/dist/VisuallyHidden/index.d.ts +1 -0
  40. package/dist/index.cjs.js +493 -73
  41. package/dist/index.cjs.js.map +1 -1
  42. package/dist/index.d.ts +20 -9
  43. package/dist/index.esm.js +483 -74
  44. package/dist/index.esm.js.map +1 -1
  45. package/dist/tsconfig.test.tsbuildinfo +1 -0
  46. package/dist/tsconfig.tsbuildinfo +1 -0
  47. package/dist/unstyled/index.d.ts +22 -0
  48. package/package.json +20 -21
  49. package/dist/List.d.ts +0 -8
package/README.md CHANGED
@@ -4,7 +4,9 @@
4
4
 
5
5
  The `@amsterdam/design-system-react` package contains React implementations of various components. You can use this package in React apps.
6
6
 
7
- The CSS components that implement the Utrecht design system class names are published in a separate npm package, so don't forget to install and include `@amsterdam/design-system-css` too for the styling of the white-label components, as well as a package with design tokens for your theme. TODO: make this easier?
7
+ The design tokens used in these components are published in a separate npm package, so don't forget to install and include `@amsterdam/design-system-tokens` too.
8
+
9
+ <!-- TODO: make this easier? -->
8
10
 
9
11
  ## Stability of the components
10
12
 
@@ -12,20 +14,19 @@ The React components are released as _alpha_ version, which means the components
12
14
 
13
15
  Make sure you specify the exact version as dependency, so you can schedule to upgrade to the latest version when you have time to test for regression bugs.
14
16
 
15
- TODO: add alpha, beta and production statuses to components. Also show in Storybook
17
+ <!-- TODO: add alpha, beta and production statuses to components. Also show in Storybook -->
16
18
 
17
19
  ## Getting started
18
20
 
19
21
  Install the packages you need, for instance:
20
22
 
21
- `npm install @amsterdam/design-system-react @amsterdam/design-system-css @amsterdam/design-system-tokens @amsterdam/design-system-assets`
23
+ `npm install @amsterdam/design-system-react @amsterdam/design-system-tokens @amsterdam/design-system-assets`
22
24
 
23
25
  Import the packages you need.
24
26
 
25
27
  ```javascript
26
28
  import { Paragraph } from "@amsterdam/design-system-react";
27
29
 
28
- import "@amsterdam/design-system-css/dist/paragraph/paragraph.css";
29
30
  import "@amsterdam/design-system-tokens/dist/root.css";
30
31
  import "@amsterdam/design-system-assets/font/index.css";
31
32
 
@@ -35,3 +36,19 @@ function App() {
35
36
 
36
37
  export default App;
37
38
  ```
39
+
40
+ ## Unstyled components
41
+
42
+ If you need unstyled React components (if you completely want to restyle them yourself, or you can't use style injection in your project because of a strict CSP for example), you can import these as well.
43
+
44
+ For example, to import an unstyled Paragraph component:
45
+
46
+ ```javascript
47
+ import { Paragraph } from "@amsterdam/design-system-react/unstyled";
48
+ ```
49
+
50
+ If you do want to style unstyled React components using our css, you can add the component css from our `@amsterdam/design-system-css` package, like so:
51
+
52
+ ```javascript
53
+ import "@amsterdam/design-system-css/dist/paragraph/paragraph.css";
54
+ ```
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { BlockquoteHTMLAttributes } from 'react';
6
+ export interface BlockquoteProps extends BlockquoteHTMLAttributes<HTMLQuoteElement> {
7
+ /**
8
+ * De kleur van het citaat.
9
+ * Gebruik deze property om het citaat in tegenovergestelde kleur te tonen.
10
+ */
11
+ inverseColor?: boolean;
12
+ }
13
+ export declare const Blockquote: import("react").ForwardRefExoticComponent<BlockquoteProps & {
14
+ children?: import("react").ReactNode;
15
+ } & import("react").RefAttributes<HTMLQuoteElement>>;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,2 @@
1
+ export { Blockquote } from './Blockquote';
2
+ export type { BlockquoteProps } from './Blockquote';
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { HTMLAttributes, PropsWithChildren } from 'react';
3
+ interface BreadcrumbComponent extends React.ForwardRefExoticComponent<PropsWithChildren<HTMLAttributes<HTMLElement>> & React.RefAttributes<HTMLElement>> {
4
+ Item: typeof BreadcrumbItem;
5
+ }
6
+ export declare const Breadcrumb: BreadcrumbComponent;
7
+ export interface BreadcrumbItemProps extends PropsWithChildren<HTMLAttributes<HTMLLIElement>> {
8
+ href: string;
9
+ }
10
+ declare const BreadcrumbItem: React.ForwardRefExoticComponent<BreadcrumbItemProps & React.RefAttributes<HTMLLIElement>>;
11
+ export {};
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,2 @@
1
+ export { Breadcrumb } from './Breadcrumb';
2
+ export type { BreadcrumbItemProps } from './Breadcrumb';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { InputHTMLAttributes } from 'react';
6
+ export interface CheckboxProps extends InputHTMLAttributes<HTMLInputElement> {
7
+ invalid?: boolean;
8
+ indeterminate?: boolean;
9
+ }
10
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & {
11
+ children?: import("react").ReactNode;
12
+ } & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,2 @@
1
+ export { Checkbox } from './Checkbox';
2
+ export type { CheckboxProps } from './Checkbox';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react';
6
+ import { GridCellProps } from '../Grid';
7
+ export declare const FooterTop: ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
8
+ children?: import("react").ReactNode;
9
+ } & RefAttributes<HTMLDivElement>>;
10
+ export type FooterColumnProps = HTMLAttributes<HTMLDivElement> & GridCellProps;
11
+ export declare const FooterColumn: ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & GridCellProps & {
12
+ children?: import("react").ReactNode;
13
+ } & RefAttributes<HTMLDivElement>>;
14
+ export declare const FooterBottom: ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
15
+ children?: import("react").ReactNode;
16
+ } & RefAttributes<HTMLDivElement>>;
17
+ interface FooterComponent extends ForwardRefExoticComponent<PropsWithChildren<HTMLAttributes<HTMLElement>> & RefAttributes<HTMLElement>> {
18
+ Top: typeof FooterTop;
19
+ Bottom: typeof FooterBottom;
20
+ Column: typeof FooterColumn;
21
+ }
22
+ export declare const Footer: FooterComponent;
23
+ export {};
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ export { Footer } from './Footer';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { HTMLAttributes } from 'react';
6
+ import { PageGridColumnNumber } from './PageGrid';
7
+ type GridColumns = PageGridColumnNumber | {
8
+ start?: PageGridColumnNumber;
9
+ span: PageGridColumnNumber;
10
+ };
11
+ export interface GridCellProps extends HTMLAttributes<HTMLDivElement> {
12
+ gridColumns?: GridColumns;
13
+ }
14
+ export declare const gridColumnClassNames: (gridColumns?: GridColumns) => string;
15
+ export declare const GridCell: import("react").ForwardRefExoticComponent<GridCellProps & {
16
+ children?: import("react").ReactNode;
17
+ } & import("react").RefAttributes<HTMLDivElement>>;
18
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { HTMLAttributes, PropsWithChildren } from 'react';
6
+ export type PageGridColumnNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
7
+ export type PageGridProps = PropsWithChildren<HTMLAttributes<HTMLDivElement>>;
8
+ export declare const PageGrid: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
9
+ children?: import("react").ReactNode;
10
+ } & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,4 @@
1
+ export type { GridCellProps } from './GridCell';
2
+ export type { PageGridProps } from './PageGrid';
3
+ export * from './GridCell';
4
+ export * from './PageGrid';
@@ -16,6 +16,11 @@ export interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
16
16
  * Voeg dit toe om de titel groter of kleiner weer te geven zonder de semantische betekenis te veranderen.
17
17
  */
18
18
  size?: Size;
19
+ /**
20
+ * De kleur van de titel
21
+ * Gebruik deze property om de titel in tegenovergestelde kleur te tonen.
22
+ */
23
+ inverseColor?: boolean;
19
24
  }
20
25
  export declare function getHeadingElement(level: HeadingLevel): "h2" | "h3" | "h4" | "h1";
21
26
  export declare const Heading: import("react").ForwardRefExoticComponent<HeadingProps & {
@@ -2,14 +2,20 @@
2
2
  * @license EUPL-1.2+
3
3
  * Copyright (c) 2023 Gemeente Amsterdam
4
4
  */
5
- import { AnchorHTMLAttributes } from 'react';
5
+ import { AnchorHTMLAttributes, PropsWithChildren } from 'react';
6
6
  type LinkOnBackground = 'default' | 'light' | 'dark';
7
- type LinkVariant = 'standalone' | 'standaloneBold' | 'inline' | 'inList';
8
- export interface LinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'placeholder'> {
7
+ type LinkVariant = 'standalone' | 'inline' | 'inList';
8
+ interface CommonProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'placeholder'> {
9
9
  variant?: LinkVariant;
10
10
  onBackground?: LinkOnBackground;
11
11
  }
12
- export declare const Link: import("react").ForwardRefExoticComponent<LinkProps & {
13
- children?: import("react").ReactNode;
14
- } & import("react").RefAttributes<HTMLAnchorElement>>;
12
+ type ConditionalProps = {
13
+ variant?: 'standalone' | 'inline';
14
+ icon?: never;
15
+ } | {
16
+ variant?: 'inList';
17
+ icon?: Function;
18
+ };
19
+ export type LinkProps = CommonProps & ConditionalProps;
20
+ export declare const Link: import("react").ForwardRefExoticComponent<PropsWithChildren<LinkProps> & import("react").RefAttributes<HTMLAnchorElement>>;
15
21
  export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { ForwardRefExoticComponent, LiHTMLAttributes, OlHTMLAttributes, PropsWithChildren, RefAttributes } from 'react';
6
+ export interface OrderedListProps extends PropsWithChildren<OlHTMLAttributes<HTMLOListElement>> {
7
+ markers?: boolean;
8
+ }
9
+ interface OrderedListComponent extends ForwardRefExoticComponent<OrderedListProps & RefAttributes<HTMLOListElement>> {
10
+ Item: typeof OrderedListItem;
11
+ }
12
+ export declare const OrderedList: OrderedListComponent;
13
+ export type OrderedListItemProps = LiHTMLAttributes<HTMLLIElement>;
14
+ export declare const OrderedListItem: ForwardRefExoticComponent<OrderedListItemProps & {
15
+ children?: import("react").ReactNode;
16
+ } & RefAttributes<HTMLLIElement>>;
17
+ export {};
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,2 @@
1
+ export { OrderedList } from './OrderedList';
2
+ export type { OrderedListProps } from './OrderedList';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { HTMLAttributes } from 'react';
6
+ export interface PageHeadingProps extends HTMLAttributes<HTMLHeadingElement> {
7
+ /**
8
+ * De kleur van de titel
9
+ * Gebruik deze property om de titel in tegenovergestelde kleur te tonen.
10
+ */
11
+ inverseColor?: boolean;
12
+ }
13
+ export declare const PageHeading: import("react").ForwardRefExoticComponent<PageHeadingProps & {
14
+ children?: import("react").ReactNode;
15
+ } & import("react").RefAttributes<HTMLHeadingElement>>;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,2 @@
1
+ export { PageHeading } from './PageHeading';
2
+ export type { PageHeadingProps } from './PageHeading';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { AnchorHTMLAttributes, ButtonHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react';
6
+ type PageMenuProps = PropsWithChildren<HTMLAttributes<HTMLUListElement>>;
7
+ interface PageMenuComponent extends ForwardRefExoticComponent<PageMenuProps & RefAttributes<HTMLElement>> {
8
+ Link: typeof PageMenuLink;
9
+ Button: typeof PageMenuButton;
10
+ }
11
+ export declare const PageMenu: PageMenuComponent;
12
+ export interface PageMenuLinkProps extends PropsWithChildren<AnchorHTMLAttributes<HTMLAnchorElement>> {
13
+ icon?: Function;
14
+ }
15
+ export interface PageMenuButtonProps extends PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>> {
16
+ icon?: Function;
17
+ }
18
+ declare const PageMenuLink: ForwardRefExoticComponent<PageMenuLinkProps & RefAttributes<HTMLAnchorElement>>;
19
+ declare const PageMenuButton: ForwardRefExoticComponent<PageMenuButtonProps & RefAttributes<HTMLButtonElement>>;
20
+ export {};
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,2 @@
1
+ export { PageMenu } from './PageMenu';
2
+ export type { PageMenuLinkProps } from './PageMenu';
@@ -4,8 +4,14 @@
4
4
  * Copyright (c) 2023 Gemeente Amsterdam
5
5
  */
6
6
  import { HTMLAttributes } from 'react';
7
- export interface ParagraphProps extends HTMLAttributes<HTMLParagraphElement> {
7
+ import { GridCellProps } from '../Grid';
8
+ export interface ParagraphProps extends HTMLAttributes<HTMLParagraphElement>, GridCellProps {
8
9
  size?: 'small' | 'large';
10
+ /**
11
+ * De kleur van de paragraaf
12
+ * Gebruik deze property om de paragraaf in tegenovergestelde kleur te tonen.
13
+ */
14
+ inverseColor?: boolean;
9
15
  }
10
16
  export declare const Paragraph: import("react").ForwardRefExoticComponent<ParagraphProps & {
11
17
  children?: import("react").ReactNode;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { HTMLAttributes, PropsWithChildren } from 'react';
6
+ export interface TestulaProps extends PropsWithChildren<HTMLAttributes<HTMLElement>> {
7
+ }
8
+ export declare const Testula: import("react").ForwardRefExoticComponent<TestulaProps & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,2 @@
1
+ export { Testula } from './Testula';
2
+ export type { TestulaProps } from './Testula';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { AnchorHTMLAttributes } from 'react';
6
+ export interface TopTaskLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
7
+ label: string;
8
+ description?: string;
9
+ }
10
+ export declare const TopTaskLink: import("react").ForwardRefExoticComponent<TopTaskLinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ export { TopTaskLink } from './TopTaskLink';
@@ -2,13 +2,16 @@
2
2
  * @license EUPL-1.2+
3
3
  * Copyright (c) 2023 Gemeente Amsterdam
4
4
  */
5
- import React, { HTMLAttributes, LiHTMLAttributes, PropsWithChildren } from 'react';
6
- interface UnorderedListComponent extends React.ForwardRefExoticComponent<PropsWithChildren<HTMLAttributes<HTMLElement>> & React.RefAttributes<HTMLElement>> {
5
+ import { ForwardRefExoticComponent, HTMLAttributes, LiHTMLAttributes, PropsWithChildren, RefAttributes } from 'react';
6
+ export interface UnorderedListProps extends PropsWithChildren<HTMLAttributes<HTMLUListElement>> {
7
+ markers?: boolean;
8
+ }
9
+ interface UnorderedListComponent extends ForwardRefExoticComponent<UnorderedListProps & RefAttributes<HTMLUListElement>> {
7
10
  Item: typeof UnorderedListItem;
8
11
  }
9
12
  export declare const UnorderedList: UnorderedListComponent;
10
13
  export type UnorderedListItemProps = LiHTMLAttributes<HTMLLIElement>;
11
- export declare const UnorderedListItem: React.ForwardRefExoticComponent<UnorderedListItemProps & {
12
- children?: React.ReactNode;
13
- } & React.RefAttributes<HTMLLIElement>>;
14
+ export declare const UnorderedListItem: ForwardRefExoticComponent<UnorderedListItemProps & {
15
+ children?: import("react").ReactNode;
16
+ } & RefAttributes<HTMLLIElement>>;
14
17
  export {};
@@ -1 +1,2 @@
1
1
  export { UnorderedList } from './UnorderedList';
2
+ export type { UnorderedListProps } from './UnorderedList';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { HTMLAttributes } from 'react';
6
+ export declare const VisuallyHidden: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
7
+ children?: import("react").ReactNode;
8
+ } & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ export { VisuallyHidden } from './VisuallyHidden';