@arbeidstilsynet/design-react 0.3.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 +241 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +249 -156
- 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/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 +17 -13
|
@@ -2,4 +2,7 @@ import { HTMLAttributes } from 'react';
|
|
|
2
2
|
import { DefaultProps } from '../../types';
|
|
3
3
|
export interface FilePickerErrorsProps extends DefaultProps<HTMLDivElement>, HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* Displays errors passed to the parent `FilePicker` component.
|
|
7
|
+
*/
|
|
5
8
|
export declare function FilePickerErrors({ className, ...rest }: FilePickerErrorsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -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
|
}
|
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.
|
|
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
48
|
"@types/node": "22.18.6",
|
|
46
|
-
"@types/react": "19.1.
|
|
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.
|
|
58
|
+
"eslint-plugin-storybook": "9.1.8",
|
|
56
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.44.
|
|
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",
|