@arbeidstilsynet/design-react 0.2.0 → 0.3.1
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/index.cjs +613 -229
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +621 -237
- package/dist/index.js.map +1 -1
- package/dist/src/components/filepicker/filepickerDropzone.d.ts +14 -6
- package/dist/src/components/filepicker/filepickerErrors.d.ts +3 -0
- package/dist/src/components/filepicker/filepickerFiles.d.ts +13 -2
- package/dist/src/components/filepicker/index.d.ts +4 -3
- package/dist/src/components/filepicker/types.d.ts +2 -2
- package/dist/src/components/header/headerTitle.d.ts +1 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/logo/lightdarklogo.d.ts +19 -0
- package/dist/src/components/logo/logoblack.d.ts +2 -1
- package/dist/src/components/logo/logogreen.d.ts +2 -1
- package/dist/src/components/logo/logowhite.d.ts +2 -1
- package/dist/src/docs-components/CssVariables.d.ts +5 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/types.d.ts +1 -0
- package/package.json +19 -15
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
import { DefaultProps } from '../../types';
|
|
3
|
-
export interface FilePickerFilesProps extends DefaultProps<
|
|
3
|
+
export interface FilePickerFilesProps extends DefaultProps<HTMLTableElement>, HTMLAttributes<HTMLTableElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Custom column names for the file table.
|
|
6
|
+
*/
|
|
7
|
+
columnNames?: [string, string, string];
|
|
8
|
+
/**
|
|
9
|
+
* Custom label for the remove button.
|
|
10
|
+
*/
|
|
11
|
+
removeButtonLabel?: string;
|
|
4
12
|
}
|
|
5
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Displays files added to the parent `FilePicker` component.
|
|
15
|
+
*/
|
|
16
|
+
export declare function FilePickerFiles({ className, columnNames, removeButtonLabel, ...rest }: Readonly<FilePickerFilesProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -3,21 +3,22 @@ import { FilePickerDropzone } from './filepickerDropzone';
|
|
|
3
3
|
import { FilePickerErrors } from './filepickerErrors';
|
|
4
4
|
import { FilePickerFiles } from './filepickerFiles';
|
|
5
5
|
/**
|
|
6
|
-
* Controlled component for managing file uploads.
|
|
6
|
+
* Controlled component for managing file uploads or processing.
|
|
7
7
|
* You should perform validation in `onAdd`/`onRemove` callbacks and pass a list of errors in props.
|
|
8
8
|
*
|
|
9
9
|
* Uses [react-dropzone](https://react-dropzone.js.org/) for drag-and-drop functionality.
|
|
10
10
|
*
|
|
11
11
|
* Note: the default label text is only an example. File types are not enforced by the component, but can be done in your validation logic as needed.
|
|
12
12
|
*
|
|
13
|
-
* FilePicker has no internal state and can be fully controlled as needed with a combination of `files`, `errors`, `disabled`, `isWaiting` props as well as using the subcomponents as desired.
|
|
13
|
+
* FilePicker has no internal state and can be fully controlled as needed with a combination of `files`, `errors`, `disabled`, `isWaiting` props as well as using the subcomponents as desired.
|
|
14
|
+
* For example, you can change the order of the subcomponents or only use some of them. You decide if the `files` prop only contains accepted files or all including errors, and you can use the `errors` prop to display validation errors in your UI.
|
|
14
15
|
*
|
|
15
16
|
* Usage:
|
|
16
17
|
* ```tsx
|
|
17
18
|
* <FilePicker files={files} errors={errors} onAdd={handleAddFiles} onRemove={handleRemoveFile}>
|
|
18
19
|
* <FilePicker.Dropzone defaultLabelText={["Upload here!"]} />
|
|
19
|
-
* <FilePicker.Files />
|
|
20
20
|
* <FilePicker.Errors />
|
|
21
|
+
* <FilePicker.Files />
|
|
21
22
|
* </FilePicker>
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
@@ -22,6 +22,6 @@ export interface FilePickerItem<TFileId extends string | number = string | numbe
|
|
|
22
22
|
id: TFileId;
|
|
23
23
|
/** The file itself. See: https://developer.mozilla.org/en-US/docs/Web/API/File */
|
|
24
24
|
file: File;
|
|
25
|
-
/**
|
|
26
|
-
|
|
25
|
+
/** If this file has an error. Consider passing details in `errors` to `FilePicker` to show the cause. */
|
|
26
|
+
hasError?: boolean | null;
|
|
27
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DefaultProps } from '../../types';
|
|
2
1
|
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { DefaultProps } from '../../types';
|
|
3
3
|
export interface HeaderTitleProps extends DefaultProps<HTMLDivElement>, HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
fagsystemNavn?: string;
|
|
5
5
|
brukernavn?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './filepicker';
|
|
2
2
|
export * from './header';
|
|
3
|
+
export { LightDarkLogo, type LightDarkLogoProps } from './logo/lightdarklogo';
|
|
3
4
|
export { LogoBlack } from './logo/logoblack';
|
|
4
5
|
export { LogoGreen } from './logo/logogreen';
|
|
5
6
|
export { LogoWhite } from './logo/logowhite';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
export interface LightDarkLogoProps extends SVGProps<SVGSVGElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Width of the logo. Default is "100%".
|
|
5
|
+
*/
|
|
6
|
+
width?: string | number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Displays the Arbeidstilsynet logo with automatic switching between
|
|
10
|
+
* black and white variants based on the current color scheme.
|
|
11
|
+
*
|
|
12
|
+
* You can alternatively import `LogoBlack`, `LogoWhite` or `LogoGreen` directly.
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <LightDarkLogo width="150px" />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function LightDarkLogo({ width, ...rest }: LightDarkLogoProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
export declare const LogoBlack: ({ width }: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
export declare const LogoGreen: ({ width }: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
export declare const LogoWhite: ({ width }: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbeidstilsynet/design-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "React implementation of Designsystemet",
|
|
5
5
|
"author": "Arbeidstilsynet",
|
|
6
6
|
"repository": {
|
|
@@ -30,36 +30,40 @@
|
|
|
30
30
|
"react-dom": "^19.1.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@digdir/designsystemet-react": "1.
|
|
34
|
-
"@navikt/aksel-icons": "^7.
|
|
33
|
+
"@digdir/designsystemet-react": "1.6.0",
|
|
34
|
+
"@navikt/aksel-icons": "^7.31.0",
|
|
35
|
+
"@radix-ui/react-slot": "^1.2.3",
|
|
35
36
|
"clsx": "^2.1.1",
|
|
36
|
-
"react-dropzone": "^14.3.8"
|
|
37
|
-
"@radix-ui/react-slot": "^1.2.3"
|
|
37
|
+
"react-dropzone": "^14.3.8"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@eslint/js": "9.
|
|
40
|
+
"@eslint/js": "9.36.0",
|
|
41
|
+
"@storybook/addon-docs": "9.1.8",
|
|
42
|
+
"@storybook/addon-vitest": "9.1.8",
|
|
43
|
+
"@storybook/react-vite": "9.1.8",
|
|
41
44
|
"@testing-library/jest-dom": "6.8.0",
|
|
42
45
|
"@testing-library/react": "16.3.0",
|
|
43
46
|
"@testing-library/user-event": "14.6.1",
|
|
44
47
|
"@types/eslint-plugin-jsx-a11y": "6.10.0",
|
|
45
|
-
"@types/node": "22.18.
|
|
46
|
-
"@types/react": "19.1.
|
|
48
|
+
"@types/node": "22.18.6",
|
|
49
|
+
"@types/react": "19.1.15",
|
|
47
50
|
"@types/react-dom": "19.1.9",
|
|
48
|
-
"@vitejs/plugin-react": "5.0.
|
|
51
|
+
"@vitejs/plugin-react": "5.0.4",
|
|
49
52
|
"babel-plugin-react-compiler": "19.1.0-rc.3",
|
|
50
|
-
"eslint": "9.
|
|
53
|
+
"eslint": "9.36.0",
|
|
51
54
|
"eslint-config-prettier": "10.1.8",
|
|
52
55
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
53
56
|
"eslint-plugin-react": "7.37.5",
|
|
54
57
|
"eslint-plugin-react-hooks": "6.0.0-rc1",
|
|
55
|
-
"eslint-plugin-storybook": "9.1.
|
|
56
|
-
"jsdom": "
|
|
58
|
+
"eslint-plugin-storybook": "9.1.8",
|
|
59
|
+
"jsdom": "27.0.0",
|
|
57
60
|
"react": "19.1.1",
|
|
58
61
|
"react-dom": "19.1.1",
|
|
59
62
|
"typescript": "5.9.2",
|
|
60
|
-
"typescript-eslint": "8.
|
|
61
|
-
"vite": "7.1.
|
|
62
|
-
"vite-plugin-dts": "4.5.4"
|
|
63
|
+
"typescript-eslint": "8.44.1",
|
|
64
|
+
"vite": "7.1.7",
|
|
65
|
+
"vite-plugin-dts": "4.5.4",
|
|
66
|
+
"@arbeidstilsynet/design-css": "0.3.1"
|
|
63
67
|
},
|
|
64
68
|
"scripts": {
|
|
65
69
|
"build": "vite build",
|