@amsterdam/design-system-react 0.1.2 → 0.1.4
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 +3 -6
- package/dist/Accordion/Accordion.d.ts +17 -0
- package/dist/Accordion/Accordion.test.d.ts +1 -0
- package/dist/Accordion/AccordionContext.d.ts +8 -0
- package/dist/Accordion/AccordionSection.d.ts +12 -0
- package/dist/Accordion/AccordionSection.test.d.ts +1 -0
- package/dist/Accordion/index.d.ts +3 -0
- package/dist/Accordion/useFocusWithArrow.test.d.ts +1 -0
- package/dist/Accordion/useFocusWithArrows.d.ts +24 -0
- package/dist/Button/Button.d.ts +12 -0
- package/dist/Button/Button.test.d.ts +1 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/FormLabel/FormLabel.d.ts +9 -0
- package/dist/FormLabel/FormLabel.test.d.ts +1 -0
- package/dist/FormLabel/index.d.ts +1 -0
- package/dist/Heading/Heading.d.ts +24 -0
- package/dist/Heading/Heading.test.d.ts +1 -0
- package/dist/Heading/index.d.ts +2 -0
- package/dist/Icon/Icon.d.ts +12 -0
- package/dist/Icon/Icon.test.d.ts +1 -0
- package/dist/Icon/index.d.ts +2 -0
- package/dist/Link/Link.d.ts +15 -0
- package/dist/Link/Link.test.d.ts +1 -0
- package/dist/Link/index.d.ts +2 -0
- package/dist/List.d.ts +8 -5
- package/dist/{Paragraph.d.ts → Paragraph/Paragraph.d.ts} +12 -10
- package/dist/Paragraph/Paragraph.test.d.ts +1 -0
- package/dist/Paragraph/index.d.ts +2 -0
- package/dist/UnorderedList/UnorderedList.d.ts +14 -0
- package/dist/UnorderedList/UnorderedList.test.d.ts +1 -0
- package/dist/UnorderedList/index.d.ts +1 -0
- package/dist/index.cjs.js +313 -93
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +13 -10
- package/dist/index.esm.js +312 -94
- package/dist/index.esm.js.map +1 -1
- package/package.json +30 -30
- package/dist/Grid.d.ts +0 -5
- package/dist/GridItem.d.ts +0 -11
- package/dist/Heading.d.ts +0 -13
- package/dist/Icon.d.ts +0 -5
- package/dist/Link.d.ts +0 -9
- package/dist/tsconfig.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ The CSS components that implement the Utrecht design system class names are publ
|
|
|
8
8
|
|
|
9
9
|
## Stability of the components
|
|
10
10
|
|
|
11
|
-
The React components are released as _alpha_ version, which means the components are still work in progress and it is likely that some APIs will between releases.
|
|
11
|
+
The React components are released as _alpha_ version, which means the components are still work in progress and it is likely that some APIs will change between releases.
|
|
12
12
|
|
|
13
13
|
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
14
|
|
|
@@ -16,21 +16,18 @@ TODO: add alpha, beta and production statuses to components. Also show in Storyb
|
|
|
16
16
|
|
|
17
17
|
## Getting started
|
|
18
18
|
|
|
19
|
-
TODO: These packages haven't been published yet, so the following doesn't work at the moment. You can currently only use these instructions when locally linking the packages to a consumer project.
|
|
20
|
-
|
|
21
19
|
Install the packages you need, for instance:
|
|
22
20
|
|
|
23
|
-
`npm install @amsterdam/design-system-react @amsterdam/design-system-css @amsterdam/design-system-tokens @amsterdam/design-system-
|
|
21
|
+
`npm install @amsterdam/design-system-react @amsterdam/design-system-css @amsterdam/design-system-tokens @amsterdam/design-system-assets`
|
|
24
22
|
|
|
25
23
|
Import the packages you need.
|
|
26
24
|
|
|
27
25
|
```javascript
|
|
28
26
|
import { Paragraph } from "@amsterdam/design-system-react";
|
|
29
27
|
|
|
30
|
-
import "@amsterdam/design-system-css/dist/document/document.css";
|
|
31
28
|
import "@amsterdam/design-system-css/dist/paragraph/paragraph.css";
|
|
32
29
|
import "@amsterdam/design-system-tokens/dist/root.css";
|
|
33
|
-
import "@amsterdam/design-system-font/
|
|
30
|
+
import "@amsterdam/design-system-assets/font/index.css";
|
|
34
31
|
|
|
35
32
|
function App() {
|
|
36
33
|
return <Paragraph>Hello world</Paragraph>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2023 Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
6
|
+
import { HTMLAttributes, PropsWithChildren } from 'react';
|
|
7
|
+
import { AccordionSection } from './AccordionSection';
|
|
8
|
+
import { HeadingLevel } from '../Heading/Heading';
|
|
9
|
+
export interface AccordionProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
headingLevel: HeadingLevel;
|
|
12
|
+
section?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface AccordionComponent extends ForwardRefExoticComponent<PropsWithChildren<HTMLAttributes<HTMLDivElement>> & RefAttributes<HTMLDivElement> & AccordionProps> {
|
|
15
|
+
Section: typeof AccordionSection;
|
|
16
|
+
}
|
|
17
|
+
export declare const Accordion: AccordionComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { HeadingLevel } from '../Heading/Heading';
|
|
3
|
+
export interface AccordionContextValue {
|
|
4
|
+
headingLevel: HeadingLevel;
|
|
5
|
+
section?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const AccordionContext: import("react").Context<AccordionContextValue>;
|
|
8
|
+
export default AccordionContext;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2023 Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import { HTMLAttributes } from 'react';
|
|
6
|
+
export interface AccordionSectionProps extends HTMLAttributes<HTMLElement> {
|
|
7
|
+
label: string;
|
|
8
|
+
expanded?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const AccordionSection: import("react").ForwardRefExoticComponent<AccordionSectionProps & {
|
|
11
|
+
children?: import("react").ReactNode;
|
|
12
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2023 Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { KeyboardEvent, RefObject } from 'react';
|
|
6
|
+
export declare const KeyboardKeys: {
|
|
7
|
+
ArrowUp: string;
|
|
8
|
+
ArrowDown: string;
|
|
9
|
+
ArrowRight: string;
|
|
10
|
+
ArrowLeft: string;
|
|
11
|
+
Home: string;
|
|
12
|
+
End: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Focus on children with arrow keys and home / end buttons.
|
|
16
|
+
*
|
|
17
|
+
* @param ref Component ref
|
|
18
|
+
* @param rotating Jump to first item from last or vice versa
|
|
19
|
+
* @param horizontally In case you need to navigate horizontally, using left / right arrow buttons
|
|
20
|
+
*/
|
|
21
|
+
declare const useFocusWithArrows: (ref: RefObject<HTMLDivElement>, rotating?: boolean, horizontally?: boolean) => {
|
|
22
|
+
keyDown: (e: KeyboardEvent) => void;
|
|
23
|
+
};
|
|
24
|
+
export default useFocusWithArrows;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
* Copyright (c) 2023 Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
7
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
8
|
+
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
9
|
+
}
|
|
10
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & {
|
|
11
|
+
children?: import("react").ReactNode;
|
|
12
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
* Copyright (c) 2023 Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import { LabelHTMLAttributes } from 'react';
|
|
7
|
+
export declare const FormLabel: import("react").ForwardRefExoticComponent<LabelHTMLAttributes<HTMLLabelElement> & {
|
|
8
|
+
children?: import("react").ReactNode;
|
|
9
|
+
} & import("react").RefAttributes<HTMLLabelElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormLabel } from './FormLabel';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
* Copyright (c) 2023 Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import { HTMLAttributes } from 'react';
|
|
7
|
+
export type HeadingLevel = 1 | 2 | 3 | 4;
|
|
8
|
+
type Size = 'level-1' | 'level-2' | 'level-3' | 'level-4';
|
|
9
|
+
export interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Het hiërarchische niveau van de titel.
|
|
12
|
+
*/
|
|
13
|
+
level?: HeadingLevel;
|
|
14
|
+
/**
|
|
15
|
+
* De visuele grootte van de titel.
|
|
16
|
+
* Voeg dit toe om de titel groter of kleiner weer te geven zonder de semantische betekenis te veranderen.
|
|
17
|
+
*/
|
|
18
|
+
size?: Size;
|
|
19
|
+
}
|
|
20
|
+
export declare function getHeadingElement(level: HeadingLevel): "h2" | "h3" | "h4" | "h1";
|
|
21
|
+
export declare const Heading: import("react").ForwardRefExoticComponent<HeadingProps & {
|
|
22
|
+
children?: import("react").ReactNode;
|
|
23
|
+
} & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2021 Gemeente Utrecht
|
|
4
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
5
|
+
* Copyright (c) 2023 Gemeente Amsterdam
|
|
6
|
+
*/
|
|
7
|
+
import { HTMLAttributes } from 'react';
|
|
8
|
+
export interface IconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
9
|
+
size?: 'level-3' | 'level-4' | 'level-5' | 'level-6' | 'level-7';
|
|
10
|
+
svg: Function;
|
|
11
|
+
}
|
|
12
|
+
export declare const Icon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2023 Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import { AnchorHTMLAttributes } from 'react';
|
|
6
|
+
type LinkOnBackground = 'default' | 'light' | 'dark';
|
|
7
|
+
type LinkVariant = 'standalone' | 'standaloneBold' | 'inline' | 'inList';
|
|
8
|
+
export interface LinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'placeholder'> {
|
|
9
|
+
variant?: LinkVariant;
|
|
10
|
+
onBackground?: LinkOnBackground;
|
|
11
|
+
}
|
|
12
|
+
export declare const Link: import("react").ForwardRefExoticComponent<LinkProps & {
|
|
13
|
+
children?: import("react").ReactNode;
|
|
14
|
+
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
package/dist/List.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license EUPL-1.2
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2023 Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import { HTMLAttributes } from 'react';
|
|
6
|
+
export declare const List: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLUListElement> & {
|
|
7
|
+
children?: import("react").ReactNode;
|
|
8
|
+
} & import("react").RefAttributes<HTMLUListElement>>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license EUPL-1.2
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
* Copyright (c) 2023 Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import { HTMLAttributes } from 'react';
|
|
7
|
+
export interface ParagraphProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
8
|
+
size?: 'small' | 'large';
|
|
9
|
+
}
|
|
10
|
+
export declare const Paragraph: import("react").ForwardRefExoticComponent<ParagraphProps & {
|
|
11
|
+
children?: import("react").ReactNode;
|
|
12
|
+
} & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2023 Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import React, { HTMLAttributes, LiHTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
interface UnorderedListComponent extends React.ForwardRefExoticComponent<PropsWithChildren<HTMLAttributes<HTMLElement>> & React.RefAttributes<HTMLElement>> {
|
|
7
|
+
Item: typeof UnorderedListItem;
|
|
8
|
+
}
|
|
9
|
+
export declare const UnorderedList: UnorderedListComponent;
|
|
10
|
+
export type UnorderedListItemProps = LiHTMLAttributes<HTMLLIElement>;
|
|
11
|
+
export declare const UnorderedListItem: React.ForwardRefExoticComponent<UnorderedListItemProps & {
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
} & React.RefAttributes<HTMLLIElement>>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UnorderedList } from './UnorderedList';
|