@amsterdam/design-system-react 0.1.6 → 0.1.8

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 (98) hide show
  1. package/README.md +3 -18
  2. package/dist/Accordion/Accordion.d.ts +1 -2
  3. package/dist/Alert/Alert.d.ts +13 -0
  4. package/dist/Alert/index.d.ts +2 -0
  5. package/dist/AspectRatio/AspectRatio.d.ts +1 -1
  6. package/dist/Breadcrumb/Breadcrumb.d.ts +3 -4
  7. package/dist/Card/Card.d.ts +4 -3
  8. package/dist/Footer/Footer.d.ts +0 -6
  9. package/dist/Grid/Grid.d.ts +40 -0
  10. package/dist/Grid/GridCell.d.ts +16 -12
  11. package/dist/Grid/gridCellClasses.d.ts +2 -0
  12. package/dist/Grid/index.d.ts +2 -3
  13. package/dist/Highlight/Highlight.d.ts +10 -0
  14. package/dist/Highlight/index.d.ts +2 -0
  15. package/dist/Image/Image.d.ts +8 -0
  16. package/dist/Image/index.d.ts +2 -0
  17. package/dist/Pagination/Pagination.d.ts +24 -0
  18. package/dist/Pagination/index.d.ts +2 -0
  19. package/dist/Paragraph/Paragraph.d.ts +1 -2
  20. package/dist/Screen/Screen.d.ts +11 -0
  21. package/dist/Screen/index.d.ts +2 -0
  22. package/dist/TopTaskLink/TopTaskLink.d.ts +1 -1
  23. package/dist/index.cjs.js +514 -234
  24. package/dist/index.cjs.js.map +1 -1
  25. package/dist/index.d.ts +26 -20
  26. package/dist/index.esm.js +508 -235
  27. package/dist/index.esm.js.map +1 -1
  28. package/package.json +22 -22
  29. package/dist/Grid/PageGrid.d.ts +0 -10
  30. package/dist/Hero/Hero.d.ts +0 -15
  31. package/dist/Hero/index.d.ts +0 -1
  32. package/dist/Testula/Testula.d.ts +0 -8
  33. package/dist/Testula/index.d.ts +0 -2
  34. package/dist/buttons/Button/Button.d.ts +0 -12
  35. package/dist/buttons/Button/index.d.ts +0 -2
  36. package/dist/containers/Accordion/Accordion.d.ts +0 -17
  37. package/dist/containers/Accordion/AccordionContext.d.ts +0 -8
  38. package/dist/containers/Accordion/AccordionSection.d.ts +0 -12
  39. package/dist/containers/Accordion/index.d.ts +0 -3
  40. package/dist/containers/Accordion/useFocusWithArrow.test.d.ts +0 -1
  41. package/dist/containers/Accordion/useFocusWithArrows.d.ts +0 -24
  42. package/dist/containers/Footer/Footer.d.ts +0 -23
  43. package/dist/containers/Footer/index.d.ts +0 -1
  44. package/dist/containers/VisuallyHidden/VisuallyHidden.d.ts +0 -8
  45. package/dist/containers/VisuallyHidden/index.d.ts +0 -1
  46. package/dist/forms/Checkbox/Checkbox.d.ts +0 -12
  47. package/dist/forms/Checkbox/Checkbox.test.d.ts +0 -1
  48. package/dist/forms/Checkbox/index.d.ts +0 -2
  49. package/dist/forms/FormLabel/FormLabel.d.ts +0 -9
  50. package/dist/forms/FormLabel/FormLabel.test.d.ts +0 -1
  51. package/dist/forms/FormLabel/index.d.ts +0 -1
  52. package/dist/layout/GridCell/GridCell.d.ts +0 -18
  53. package/dist/layout/GridCell/index.d.ts +0 -2
  54. package/dist/layout/PageGrid/PageGrid.d.ts +0 -10
  55. package/dist/layout/PageGrid/index.d.ts +0 -2
  56. package/dist/media/Icon/Icon.d.ts +0 -12
  57. package/dist/media/Icon/Icon.test.d.ts +0 -1
  58. package/dist/media/Icon/index.d.ts +0 -2
  59. package/dist/navigation/Breadcrumb/Breadcrumb.d.ts +0 -11
  60. package/dist/navigation/Breadcrumb/Breadcrumb.test.d.ts +0 -1
  61. package/dist/navigation/Breadcrumb/index.d.ts +0 -2
  62. package/dist/navigation/Link/Link.d.ts +0 -21
  63. package/dist/navigation/Link/Link.test.d.ts +0 -1
  64. package/dist/navigation/Link/index.d.ts +0 -2
  65. package/dist/navigation/PageMenu/PageMenu.d.ts +0 -20
  66. package/dist/navigation/PageMenu/PageMenu.test.d.ts +0 -1
  67. package/dist/navigation/PageMenu/index.d.ts +0 -2
  68. package/dist/navigation/TopTaskLink/TopTaskLink.d.ts +0 -10
  69. package/dist/navigation/TopTaskLink/TopTaskLink.test.d.ts +0 -1
  70. package/dist/navigation/TopTaskLink/index.d.ts +0 -1
  71. package/dist/text/Blockquote/Blockquote.d.ts +0 -15
  72. package/dist/text/Blockquote/Blockquote.test.d.ts +0 -1
  73. package/dist/text/Blockquote/index.d.ts +0 -2
  74. package/dist/text/Heading/Heading.d.ts +0 -29
  75. package/dist/text/Heading/Heading.test.d.ts +0 -1
  76. package/dist/text/Heading/index.d.ts +0 -2
  77. package/dist/text/OrderedList/OrderedList.d.ts +0 -17
  78. package/dist/text/OrderedList/OrderedList.test.d.ts +0 -1
  79. package/dist/text/OrderedList/index.d.ts +0 -2
  80. package/dist/text/PageHeading/PageHeading.d.ts +0 -15
  81. package/dist/text/PageHeading/PageHeading.test.d.ts +0 -1
  82. package/dist/text/PageHeading/index.d.ts +0 -2
  83. package/dist/text/Paragraph/Paragraph.d.ts +0 -18
  84. package/dist/text/Paragraph/Paragraph.test.d.ts +0 -1
  85. package/dist/text/Paragraph/index.d.ts +0 -2
  86. package/dist/text/UnorderedList/UnorderedList.d.ts +0 -17
  87. package/dist/text/UnorderedList/UnorderedList.test.d.ts +0 -1
  88. package/dist/text/UnorderedList/index.d.ts +0 -2
  89. package/dist/tsconfig.test.tsbuildinfo +0 -1
  90. package/dist/tsconfig.tsbuildinfo +0 -1
  91. package/dist/unstyled/index.d.ts +0 -22
  92. /package/dist/{Hero/Hero.test.d.ts → Alert/Alert.test.d.ts} +0 -0
  93. /package/dist/{Testula/Testula.test.d.ts → Grid/Grid.test.d.ts} +0 -0
  94. /package/dist/{buttons/Button/Button.test.d.ts → Grid/GridCell.test.d.ts} +0 -0
  95. /package/dist/{containers/Accordion/Accordion.test.d.ts → Highlight/Highlight.test.d.ts} +0 -0
  96. /package/dist/{containers/Accordion/AccordionSection.test.d.ts → Image/Image.test.d.ts} +0 -0
  97. /package/dist/{containers/Footer/Footer.test.d.ts → Pagination/Pagination.test.d.ts} +0 -0
  98. /package/dist/{containers/VisuallyHidden/VisuallyHidden.test.d.ts → Screen/Screen.test.d.ts} +0 -0
package/README.md CHANGED
@@ -4,7 +4,7 @@
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 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.
7
+ The design tokens and css used in these components are published in separate npm packages, so don't forget to install and include `@amsterdam/design-system-tokens` and `@amsterdam/design-system-css` too.
8
8
 
9
9
  <!-- TODO: make this easier? -->
10
10
 
@@ -20,7 +20,7 @@ Make sure you specify the exact version as dependency, so you can schedule to up
20
20
 
21
21
  Install the packages you need, for instance:
22
22
 
23
- `npm install @amsterdam/design-system-react @amsterdam/design-system-tokens @amsterdam/design-system-assets`
23
+ `npm install @amsterdam/design-system-react @amsterdam/design-system-tokens @amsterdam/design-system-assets @amsterdam/design-system-css`
24
24
 
25
25
  Import the packages you need.
26
26
 
@@ -29,6 +29,7 @@ import { Paragraph } from "@amsterdam/design-system-react";
29
29
 
30
30
  import "@amsterdam/design-system-tokens/dist/root.css";
31
31
  import "@amsterdam/design-system-assets/font/index.css";
32
+ import "@amsterdam/design-system-css/dist/index.css";
32
33
 
33
34
  function App() {
34
35
  return <Paragraph>Hello world</Paragraph>;
@@ -36,19 +37,3 @@ function App() {
36
37
 
37
38
  export default App;
38
39
  ```
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
- ```
@@ -2,8 +2,7 @@
2
2
  * @license EUPL-1.2+
3
3
  * Copyright (c) 2023 Gemeente Amsterdam
4
4
  */
5
- import type { ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
6
- import { HTMLAttributes, PropsWithChildren } from 'react';
5
+ import { ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, ReactNode, RefAttributes } from 'react';
7
6
  import { AccordionSection } from './AccordionSection';
8
7
  import { HeadingLevel } from '../Heading/Heading';
9
8
  export interface AccordionProps extends HTMLAttributes<HTMLDivElement> {
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { HTMLAttributes, PropsWithChildren } from 'react';
6
+ export interface AlertProps extends PropsWithChildren<HTMLAttributes<HTMLDivElement>> {
7
+ title?: string;
8
+ severity?: undefined | 'error' | 'success';
9
+ closeable?: boolean;
10
+ icon?: boolean;
11
+ onClose?: () => void;
12
+ }
13
+ export declare const Alert: import("react").ForwardRefExoticComponent<AlertProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ export { Alert } from './Alert';
2
+ export type { AlertProps } from './Alert';
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) 2023 Gemeente Amsterdam
4
4
  */
5
5
  import { HTMLAttributes, PropsWithChildren } from 'react';
6
- export type Ratio = 'extra-tall' | 'tall' | 'square' | 'wide' | 'extra-wide';
6
+ export type Ratio = 'x-tall' | 'tall' | 'square' | 'wide' | 'x-wide' | '2x-wide';
7
7
  export interface AspectRatioProps extends PropsWithChildren<HTMLAttributes<HTMLDivElement>> {
8
8
  ratio?: Ratio;
9
9
  }
@@ -1,11 +1,10 @@
1
- import React from 'react';
2
- import type { HTMLAttributes, PropsWithChildren } from 'react';
3
- interface BreadcrumbComponent extends React.ForwardRefExoticComponent<PropsWithChildren<HTMLAttributes<HTMLElement>> & React.RefAttributes<HTMLElement>> {
1
+ import { ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react';
2
+ interface BreadcrumbComponent extends ForwardRefExoticComponent<PropsWithChildren<HTMLAttributes<HTMLElement>> & RefAttributes<HTMLElement>> {
4
3
  Item: typeof BreadcrumbItem;
5
4
  }
6
5
  export declare const Breadcrumb: BreadcrumbComponent;
7
6
  export interface BreadcrumbItemProps extends PropsWithChildren<HTMLAttributes<HTMLLIElement>> {
8
7
  href: string;
9
8
  }
10
- declare const BreadcrumbItem: React.ForwardRefExoticComponent<BreadcrumbItemProps & React.RefAttributes<HTMLLIElement>>;
9
+ declare const BreadcrumbItem: ForwardRefExoticComponent<BreadcrumbItemProps & RefAttributes<HTMLLIElement>>;
11
10
  export {};
@@ -3,9 +3,10 @@
3
3
  * Copyright (c) 2023 Gemeente Amsterdam
4
4
  */
5
5
  import { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react';
6
- export declare const CardHeadingGroup: ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
7
- children?: import("react").ReactNode;
8
- } & RefAttributes<HTMLElement>>;
6
+ export interface CardHeadingProps extends PropsWithChildren<HTMLAttributes<HTMLElement>> {
7
+ tagline: string;
8
+ }
9
+ export declare const CardHeadingGroup: ForwardRefExoticComponent<CardHeadingProps & RefAttributes<HTMLElement>>;
9
10
  export declare const CardLink: ForwardRefExoticComponent<AnchorHTMLAttributes<HTMLAnchorElement> & {
10
11
  children?: import("react").ReactNode;
11
12
  } & RefAttributes<HTMLAnchorElement>>;
@@ -3,21 +3,15 @@
3
3
  * Copyright (c) 2023 Gemeente Amsterdam
4
4
  */
5
5
  import { ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react';
6
- import { GridCellProps } from '../Grid';
7
6
  export declare const FooterTop: ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
8
7
  children?: import("react").ReactNode;
9
8
  } & 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
9
  export declare const FooterBottom: ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
15
10
  children?: import("react").ReactNode;
16
11
  } & RefAttributes<HTMLDivElement>>;
17
12
  interface FooterComponent extends ForwardRefExoticComponent<PropsWithChildren<HTMLAttributes<HTMLElement>> & RefAttributes<HTMLElement>> {
18
13
  Top: typeof FooterTop;
19
14
  Bottom: typeof FooterBottom;
20
- Column: typeof FooterColumn;
21
15
  }
22
16
  export declare const Footer: FooterComponent;
23
17
  export {};
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { ForwardRefExoticComponent, HTMLAttributes, PropsWithChildren, RefAttributes } from 'react';
6
+ import { GridCell } from './GridCell';
7
+ export type GridColumnNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
8
+ export type GridColumnNumbers = {
9
+ narrow: GridColumnNumber;
10
+ medium: GridColumnNumber;
11
+ wide: GridColumnNumber;
12
+ };
13
+ type GridDensity = 'low' | 'high';
14
+ type GridPaddingSize = 'small' | 'medium' | 'large';
15
+ type GridPaddingVerticalProp = {
16
+ paddingBottom?: never;
17
+ paddingTop?: never;
18
+ /** The amount of vertical whitespace above and below the grid. */
19
+ paddingVertical?: GridPaddingSize;
20
+ };
21
+ type GridPaddingTopAndBottomProps = {
22
+ /** The amount of vertical whitespace below the grid. */
23
+ paddingBottom?: GridPaddingSize;
24
+ /** The amount of vertical whitespace above the grid. */
25
+ paddingTop?: GridPaddingSize;
26
+ paddingVertical?: never;
27
+ };
28
+ export type GridProps = {
29
+ /**
30
+ * The density of the grid: low (for websites) or high (for applications).
31
+ * Adjusts the pace with which columns get wider, and the start width as well.
32
+ * This is to be implemented more generally – it will be moved into a theme soon.
33
+ */
34
+ density?: GridDensity;
35
+ } & (GridPaddingVerticalProp | GridPaddingTopAndBottomProps) & PropsWithChildren<HTMLAttributes<HTMLDivElement>>;
36
+ interface GridComponent extends ForwardRefExoticComponent<GridProps & RefAttributes<HTMLDivElement>> {
37
+ Cell: typeof GridCell;
38
+ }
39
+ export declare const Grid: GridComponent;
40
+ export {};
@@ -2,17 +2,21 @@
2
2
  * @license EUPL-1.2+
3
3
  * Copyright (c) 2023 Gemeente Amsterdam
4
4
  */
5
- import { HTMLAttributes } from 'react';
6
- import { PageGridColumnNumber } from './PageGrid';
7
- type GridColumns = PageGridColumnNumber | {
8
- start?: PageGridColumnNumber;
9
- span: PageGridColumnNumber;
5
+ import { HTMLAttributes, PropsWithChildren } from 'react';
6
+ import type { GridColumnNumber, GridColumnNumbers } from './Grid';
7
+ type GridCellFullWidthProp = {
8
+ /** Whether the cell spans the full width of the grid. */
9
+ fullWidth?: boolean;
10
+ span?: never;
11
+ start?: never;
10
12
  };
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>>;
13
+ type GridCellColumnProps = {
14
+ fullWidth?: never;
15
+ /** The amount of grid columns the cell spans. */
16
+ span?: GridColumnNumber | GridColumnNumbers;
17
+ /** The index of the grid column the cell starts at. */
18
+ start?: GridColumnNumber | GridColumnNumbers;
19
+ };
20
+ export type GridCellProps = (GridCellFullWidthProp | GridCellColumnProps) & PropsWithChildren<HTMLAttributes<HTMLDivElement>>;
21
+ export declare const GridCell: import("react").ForwardRefExoticComponent<GridCellProps & import("react").RefAttributes<HTMLDivElement>>;
18
22
  export {};
@@ -0,0 +1,2 @@
1
+ import { GridCellProps } from './GridCell';
2
+ export declare const gridCellClasses: (span?: GridCellProps['span'], start?: GridCellProps['start']) => string[];
@@ -1,4 +1,3 @@
1
- export type { GridCellProps } from './GridCell';
2
- export type { PageGridProps } from './PageGrid';
1
+ export * from './Grid';
3
2
  export * from './GridCell';
4
- export * from './PageGrid';
3
+ export type { GridCellProps } from './GridCell';
@@ -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 interface HighlightProps extends PropsWithChildren<HTMLAttributes<HTMLElement>> {
7
+ as?: 'article' | 'aside' | 'div' | 'footer' | 'section';
8
+ color?: 'blue' | 'dark-green' | 'green' | 'light-blue' | 'magenta' | 'orange' | 'purple' | 'yellow';
9
+ }
10
+ export declare const Highlight: import("react").ForwardRefExoticComponent<HighlightProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ export { Highlight } from './Highlight';
2
+ export type { HighlightProps } from './Highlight';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { ImgHTMLAttributes } from 'react';
6
+ export interface ImageProps extends ImgHTMLAttributes<HTMLImageElement> {
7
+ }
8
+ export declare const Image: import("react").ForwardRefExoticComponent<ImageProps & import("react").RefAttributes<HTMLImageElement>>;
@@ -0,0 +1,2 @@
1
+ export { Image } from './Image';
2
+ export type { ImageProps } from './Image';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { HTMLAttributes } from 'react';
6
+ export interface PaginationProps extends HTMLAttributes<HTMLElement> {
7
+ /**
8
+ * The maximum amount of pages shown. This has a lower limit of 5
9
+ */
10
+ maxVisiblePages?: number;
11
+ /**
12
+ * Callback triggered when interaction changes the page number.
13
+ */
14
+ onPageChange?: (page: number) => void;
15
+ /**
16
+ * The current page number.
17
+ */
18
+ page?: number;
19
+ /**
20
+ * The total number of pages.
21
+ */
22
+ totalPages: number;
23
+ }
24
+ export declare const Pagination: import("react").ForwardRefExoticComponent<PaginationProps & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,2 @@
1
+ export { Pagination } from './Pagination';
2
+ export type { PaginationProps } from './Pagination';
@@ -4,8 +4,7 @@
4
4
  * Copyright (c) 2023 Gemeente Amsterdam
5
5
  */
6
6
  import { HTMLAttributes } from 'react';
7
- import { GridCellProps } from '../Grid';
8
- export interface ParagraphProps extends HTMLAttributes<HTMLParagraphElement>, GridCellProps {
7
+ export interface ParagraphProps extends HTMLAttributes<HTMLParagraphElement> {
9
8
  size?: 'small' | 'large';
10
9
  /**
11
10
  * De kleur van de paragraaf
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license EUPL-1.2+
3
+ * Copyright (c) 2023 Gemeente Amsterdam
4
+ */
5
+ import { HTMLAttributes, PropsWithChildren } from 'react';
6
+ type ScreenMaxWidth = 'wide' | 'x-wide';
7
+ export interface ScreenProps extends PropsWithChildren<HTMLAttributes<HTMLDivElement>> {
8
+ maxWidth?: ScreenMaxWidth;
9
+ }
10
+ export declare const Screen: import("react").ForwardRefExoticComponent<ScreenProps & import("react").RefAttributes<HTMLDivElement>>;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ export { Screen } from './Screen';
2
+ export type { ScreenProps } from './Screen';
@@ -5,6 +5,6 @@
5
5
  import { AnchorHTMLAttributes } from 'react';
6
6
  export interface TopTaskLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
7
7
  label: string;
8
- description?: string;
8
+ description: string;
9
9
  }
10
10
  export declare const TopTaskLink: import("react").ForwardRefExoticComponent<TopTaskLinkProps & import("react").RefAttributes<HTMLAnchorElement>>;