@navikt/ds-react 6.3.1 → 6.3.3
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/cjs/date/hooks/useDatepicker.js +1 -1
- package/cjs/date/hooks/useDatepicker.js.map +1 -1
- package/cjs/form/checkbox/types.d.ts +1 -1
- package/cjs/form/file-upload/i18n/i18n.context.d.ts +1 -1
- package/cjs/form/file-upload/i18n/i18n.context.js +2 -2
- package/cjs/form/file-upload/i18n/i18n.context.js.map +1 -1
- package/cjs/form/file-upload/i18n/i18n.types.d.ts +1 -1
- package/cjs/form/file-upload/i18n/locales/nb.d.ts +21 -0
- package/cjs/form/file-upload/i18n/locales/nb.js +23 -0
- package/cjs/form/file-upload/i18n/locales/nb.js.map +1 -0
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js +1 -1
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/cjs/form/file-upload/parts/item/Item.d.ts +4 -2
- package/cjs/form/file-upload/parts/item/Item.js.map +1 -1
- package/cjs/form/radio/types.d.ts +3 -3
- package/cjs/form/search/Search.d.ts +14 -10
- package/cjs/form/search/Search.js +1 -1
- package/cjs/form/search/Search.js.map +1 -1
- package/cjs/form/switch/Switch.d.ts +1 -1
- package/cjs/form/useFormField.d.ts +2 -2
- package/esm/date/hooks/useDatepicker.js +1 -1
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/form/checkbox/types.d.ts +1 -1
- package/esm/form/file-upload/i18n/i18n.context.d.ts +1 -1
- package/esm/form/file-upload/i18n/i18n.context.js +1 -1
- package/esm/form/file-upload/i18n/i18n.context.js.map +1 -1
- package/esm/form/file-upload/i18n/i18n.types.d.ts +1 -1
- package/esm/form/file-upload/i18n/locales/nb.d.ts +21 -0
- package/esm/form/file-upload/i18n/locales/nb.js +21 -0
- package/esm/form/file-upload/i18n/locales/nb.js.map +1 -0
- package/esm/form/file-upload/parts/dropzone/Dropzone.js +1 -1
- package/esm/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/esm/form/file-upload/parts/item/Item.d.ts +4 -2
- package/esm/form/file-upload/parts/item/Item.js.map +1 -1
- package/esm/form/radio/types.d.ts +3 -3
- package/esm/form/search/Search.d.ts +14 -10
- package/esm/form/search/Search.js +1 -1
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/switch/Switch.d.ts +1 -1
- package/esm/form/useFormField.d.ts +2 -2
- package/package.json +3 -3
- package/src/date/datepicker/datepicker.stories.tsx +1 -0
- package/src/date/hooks/useDatepicker.tsx +1 -1
- package/src/dropdown/dropdown.stories.tsx +56 -20
- package/src/form/checkbox/types.ts +1 -1
- package/src/form/error-summary/error-summary.stories.tsx +47 -11
- package/src/form/fieldset/fieldset.stories.tsx +111 -76
- package/src/form/file-upload/i18n/i18n.context.ts +1 -1
- package/src/form/file-upload/i18n/i18n.types.ts +1 -1
- package/src/form/file-upload/i18n/locales/nb.ts +20 -0
- package/src/form/file-upload/parts/dropzone/Dropzone.tsx +1 -1
- package/src/form/file-upload/parts/item/Item.tsx +4 -2
- package/src/form/radio/radio.stories.tsx +1 -0
- package/src/form/radio/types.ts +3 -3
- package/src/form/search/Search.tsx +15 -11
- package/src/form/switch/Switch.tsx +1 -1
- package/src/form/switch/switch.stories.tsx +96 -57
- package/src/form/useFormField.ts +2 -2
- package/cjs/form/file-upload/i18n/locales/nb.json +0 -20
- package/esm/form/file-upload/i18n/locales/nb.json +0 -20
- package/src/form/file-upload/i18n/locales/nb.json +0 -20
|
@@ -13,43 +13,47 @@ export interface SearchProps extends Omit<FormFieldProps, "readOnly">, Omit<Inpu
|
|
|
13
13
|
/**
|
|
14
14
|
* Search label.
|
|
15
15
|
*
|
|
16
|
-
* Will be hidden by default
|
|
16
|
+
* Will be hidden by default and is required for WCAG compliance.
|
|
17
17
|
*/
|
|
18
18
|
label: React.ReactNode;
|
|
19
19
|
/**
|
|
20
|
-
* Shows label and description for screenreaders
|
|
20
|
+
* Shows label and description for screenreaders only.
|
|
21
21
|
* @default true
|
|
22
22
|
*/
|
|
23
23
|
hideLabel?: boolean;
|
|
24
24
|
/**
|
|
25
|
-
* Callback for value-change in input
|
|
25
|
+
* Callback for value-change in input.
|
|
26
26
|
*/
|
|
27
27
|
onChange?: (value: string) => void;
|
|
28
28
|
/**
|
|
29
|
-
* Callback for click on clear-button or Escape keydown
|
|
29
|
+
* Callback for click on clear-button or Escape keydown.
|
|
30
30
|
*/
|
|
31
31
|
onClear?: (e: SearchClearEvent) => void;
|
|
32
32
|
/**
|
|
33
|
-
* Callback for Search-button submit
|
|
33
|
+
* Callback for Search-button submit.
|
|
34
34
|
*/
|
|
35
35
|
onSearchClick?: (value: string) => void;
|
|
36
36
|
/**
|
|
37
|
-
* aria-label
|
|
37
|
+
* Sets the `aria-label` for the clear button.
|
|
38
38
|
* @default "Tøm"
|
|
39
39
|
*/
|
|
40
40
|
clearButtonLabel?: string;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Removes clear-button if `false`.
|
|
43
43
|
* @default true
|
|
44
44
|
*/
|
|
45
45
|
clearButton?: boolean;
|
|
46
46
|
/**
|
|
47
|
-
* Changes button-variant
|
|
47
|
+
* Changes button-variant.
|
|
48
|
+
*
|
|
49
|
+
* - "primary": When this is the main function of the page.
|
|
50
|
+
* - "secondary": This is probably the one you want if in doubt.
|
|
51
|
+
* - "simple": Removes the search button.
|
|
48
52
|
* @default "primary"
|
|
49
53
|
*/
|
|
50
54
|
variant?: "primary" | "secondary" | "simple";
|
|
51
55
|
/**
|
|
52
|
-
* Exposes the HTML size attribute
|
|
56
|
+
* Exposes the HTML size attribute. Specifies the width of the element, in characters.
|
|
53
57
|
*/
|
|
54
58
|
htmlSize?: number | string;
|
|
55
59
|
role?: string;
|
|
@@ -65,7 +69,7 @@ interface SearchComponent extends React.ForwardRefExoticComponent<SearchProps &
|
|
|
65
69
|
*
|
|
66
70
|
* @example
|
|
67
71
|
* ```jsx
|
|
68
|
-
* <form>
|
|
72
|
+
* <form role="search">
|
|
69
73
|
* <Search label="Søk alle NAV sine sider" variant="primary" />
|
|
70
74
|
* </form>
|
|
71
75
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.js","sourceRoot":"","sources":["../../../src/form/search/Search.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAEZ,UAAU,EACV,WAAW,EACX,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAkB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,YAAkC,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Search.js","sourceRoot":"","sources":["../../../src/form/search/Search.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAEZ,UAAU,EACV,WAAW,EACX,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAkB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA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BAAM,SAAS,EAAC,eAAe,IAC5B,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,CACvC;oBACP,oBAAC,SAAS,0BAAe,CAClB,CACV,CACG;YACN,oBAAC,aAAa,CAAC,QAAQ,IACrB,KAAK,EAAE;oBACL,IAAI;oBACJ,QAAQ,EAAE,UAAU,CAAC,QAAQ;oBAC7B,OAAO;oBACP,WAAW;iBACZ,IAEA,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,KAAK,QAAQ,IAAI,oBAAC,YAAY,OAAG,CACxC,CACrB;QACN,6BACE,SAAS,EAAC,yBAAyB,EACnC,EAAE,EAAE,OAAO,mBACG,oBAAoB,eACxB,QAAQ,IAEjB,YAAY,IAAI,CACf,oBAAC,YAAY,IAAC,IAAI,EAAE,IAAI,IAAG,KAAK,CAAC,KAAK,CAAgB,CACvD,CACG,CACF,CACP,CAAC;AACJ,CAAC,CACiB,CAAC;AAErB,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC;AAE7B,eAAe,MAAM,CAAC"}
|
|
@@ -19,7 +19,7 @@ export interface SwitchProps extends Omit<FormFieldProps, "error" | "errorId">,
|
|
|
19
19
|
*/
|
|
20
20
|
position?: "left" | "right";
|
|
21
21
|
/**
|
|
22
|
-
* Adds a description to extend
|
|
22
|
+
* Adds a description to extend labeling of Switch.
|
|
23
23
|
*/
|
|
24
24
|
description?: string;
|
|
25
25
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export interface FormFieldProps {
|
|
3
3
|
/**
|
|
4
|
-
* Adds a description to extend
|
|
4
|
+
* Adds a description to extend labeling of the field.
|
|
5
5
|
* Error message for element.
|
|
6
6
|
*/
|
|
7
7
|
error?: React.ReactNode;
|
|
@@ -20,7 +20,7 @@ export interface FormFieldProps {
|
|
|
20
20
|
*/
|
|
21
21
|
disabled?: boolean;
|
|
22
22
|
/**
|
|
23
|
-
* Adds a description to extend
|
|
23
|
+
* Adds a description to extend labeling of a field.
|
|
24
24
|
*/
|
|
25
25
|
description?: React.ReactNode;
|
|
26
26
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.3",
|
|
4
4
|
"description": "React components from the Norwegian Labour and Welfare Administration.",
|
|
5
5
|
"author": "Aksel, a team part of the Norwegian Labour and Welfare Administration.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -562,8 +562,8 @@
|
|
|
562
562
|
},
|
|
563
563
|
"dependencies": {
|
|
564
564
|
"@floating-ui/react": "0.25.4",
|
|
565
|
-
"@navikt/aksel-icons": "^6.3.
|
|
566
|
-
"@navikt/ds-tokens": "^6.3.
|
|
565
|
+
"@navikt/aksel-icons": "^6.3.3",
|
|
566
|
+
"@navikt/ds-tokens": "^6.3.3",
|
|
567
567
|
"@radix-ui/react-tabs": "1.0.0",
|
|
568
568
|
"@radix-ui/react-toggle-group": "1.0.0",
|
|
569
569
|
"clsx": "^2.1.0",
|
|
@@ -272,7 +272,7 @@ export const useDatepicker = (
|
|
|
272
272
|
) {
|
|
273
273
|
updateDate(undefined);
|
|
274
274
|
updateValidation({
|
|
275
|
-
isInvalid: isValidDate(day),
|
|
275
|
+
isInvalid: !isValidDate(day),
|
|
276
276
|
isWeekend: disableWeekends && isWeekend(day),
|
|
277
277
|
isDisabled: disabled && isMatch(day, disabled),
|
|
278
278
|
isValidDate: false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta } from "@storybook/react";
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
import { Button } from "../button";
|
|
4
4
|
import Dropdown from "./Dropdown";
|
|
@@ -6,10 +6,15 @@ import Dropdown from "./Dropdown";
|
|
|
6
6
|
export default {
|
|
7
7
|
title: "ds-react/Dropdown",
|
|
8
8
|
component: Dropdown,
|
|
9
|
-
|
|
9
|
+
parameters: {
|
|
10
|
+
chromatic: { disable: true },
|
|
11
|
+
},
|
|
12
|
+
} satisfies Meta<typeof Dropdown>;
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
type Story = StoryObj<typeof Dropdown>;
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
render: () => (
|
|
13
18
|
<Dropdown onSelect={(event) => console.log(event)}>
|
|
14
19
|
<Dropdown.Toggle>Toggle</Dropdown.Toggle>
|
|
15
20
|
<Dropdown.Menu strategy="fixed">
|
|
@@ -33,10 +38,10 @@ export const Default = () => {
|
|
|
33
38
|
</Dropdown.Menu.List>
|
|
34
39
|
</Dropdown.Menu>
|
|
35
40
|
</Dropdown>
|
|
36
|
-
)
|
|
41
|
+
),
|
|
37
42
|
};
|
|
38
43
|
|
|
39
|
-
export const DefaultOpen = {
|
|
44
|
+
export const DefaultOpen: Story = {
|
|
40
45
|
render: () => (
|
|
41
46
|
<Dropdown onSelect={(event) => console.log(event)} defaultOpen>
|
|
42
47
|
<Button as={Dropdown.Toggle}>Toggle</Button>
|
|
@@ -57,20 +62,41 @@ export const DefaultOpen = {
|
|
|
57
62
|
</Dropdown.Menu>
|
|
58
63
|
</Dropdown>
|
|
59
64
|
),
|
|
60
|
-
args: { chromatic: { delay: 300 } },
|
|
61
65
|
};
|
|
62
66
|
|
|
63
|
-
export const ControlledOpen =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<
|
|
68
|
-
Toggle
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
export const ControlledOpen: Story = {
|
|
68
|
+
render: () => {
|
|
69
|
+
const [openState, setOpenState] = useState(true);
|
|
70
|
+
return (
|
|
71
|
+
<Dropdown onSelect={(event) => console.log(event)} open={openState}>
|
|
72
|
+
<Button as={Dropdown.Toggle} onClick={() => setOpenState(!openState)}>
|
|
73
|
+
Toggle
|
|
74
|
+
</Button>
|
|
75
|
+
<Dropdown.Menu
|
|
76
|
+
strategy="fixed"
|
|
77
|
+
onClose={() => console.log("ONCLOSE CONTROLLED")}
|
|
78
|
+
>
|
|
79
|
+
<Dropdown.Menu.GroupedList>
|
|
80
|
+
<Dropdown.Menu.GroupedList.Heading>
|
|
81
|
+
Systemer og oppslagsverk
|
|
82
|
+
</Dropdown.Menu.GroupedList.Heading>
|
|
83
|
+
<Dropdown.Menu.GroupedList.Item
|
|
84
|
+
onClick={() => console.log("GroupedList.Item-click")}
|
|
85
|
+
>
|
|
86
|
+
Gosys
|
|
87
|
+
</Dropdown.Menu.GroupedList.Item>
|
|
88
|
+
</Dropdown.Menu.GroupedList>
|
|
89
|
+
</Dropdown.Menu>
|
|
90
|
+
</Dropdown>
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const Chromatic: Story = {
|
|
96
|
+
render: () => (
|
|
97
|
+
<Dropdown onSelect={(event) => console.log(event)} open>
|
|
98
|
+
<Dropdown.Toggle>Toggle</Dropdown.Toggle>
|
|
99
|
+
<Dropdown.Menu strategy="fixed">
|
|
74
100
|
<Dropdown.Menu.GroupedList>
|
|
75
101
|
<Dropdown.Menu.GroupedList.Heading>
|
|
76
102
|
Systemer og oppslagsverk
|
|
@@ -81,8 +107,18 @@ export const ControlledOpen = () => {
|
|
|
81
107
|
Gosys
|
|
82
108
|
</Dropdown.Menu.GroupedList.Item>
|
|
83
109
|
</Dropdown.Menu.GroupedList>
|
|
110
|
+
<Dropdown.Menu.Divider />
|
|
111
|
+
<Dropdown.Menu.List>
|
|
112
|
+
<Dropdown.Menu.List.Item onClick={() => console.log("Item-click")}>
|
|
113
|
+
Gosys
|
|
114
|
+
</Dropdown.Menu.List.Item>
|
|
115
|
+
<Dropdown.Menu.List.Item>Psys</Dropdown.Menu.List.Item>
|
|
116
|
+
<Dropdown.Menu.List.Item disabled>Infotrygd</Dropdown.Menu.List.Item>
|
|
117
|
+
</Dropdown.Menu.List>
|
|
84
118
|
</Dropdown.Menu>
|
|
85
119
|
</Dropdown>
|
|
86
|
-
)
|
|
120
|
+
),
|
|
121
|
+
parameters: {
|
|
122
|
+
chromatic: { disable: false, delay: 300 },
|
|
123
|
+
},
|
|
87
124
|
};
|
|
88
|
-
ControlledOpen.args = { chromatic: { delay: 300 } };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Meta } from "@storybook/react";
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { VStack } from "../../layout/stack";
|
|
3
4
|
import { ErrorSummary } from "./ErrorSummary";
|
|
4
5
|
|
|
5
6
|
export default {
|
|
@@ -18,9 +19,14 @@ export default {
|
|
|
18
19
|
},
|
|
19
20
|
},
|
|
20
21
|
},
|
|
21
|
-
|
|
22
|
+
parameters: {
|
|
23
|
+
chromatic: { disable: true },
|
|
24
|
+
},
|
|
25
|
+
} satisfies Meta<typeof ErrorSummary>;
|
|
26
|
+
|
|
27
|
+
type Story = StoryObj<typeof ErrorSummary>;
|
|
22
28
|
|
|
23
|
-
export const Default = {
|
|
29
|
+
export const Default: Story = {
|
|
24
30
|
render: (props) => (
|
|
25
31
|
<ErrorSummary
|
|
26
32
|
heading="Feiloppsummering komponent"
|
|
@@ -35,11 +41,41 @@ export const Default = {
|
|
|
35
41
|
),
|
|
36
42
|
};
|
|
37
43
|
|
|
38
|
-
export const Small =
|
|
39
|
-
|
|
40
|
-
<ErrorSummary
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
export const Small: Story = {
|
|
45
|
+
render: () => (
|
|
46
|
+
<ErrorSummary heading="Feiloppsummering komponent" size="small">
|
|
47
|
+
<ErrorSummary.Item href="#1">Checkbox må fylles ut</ErrorSummary.Item>
|
|
48
|
+
<ErrorSummary.Item href="#2">
|
|
49
|
+
Tekstfeltet må ha en godkjent e-mail
|
|
50
|
+
</ErrorSummary.Item>
|
|
51
|
+
</ErrorSummary>
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Chromatic: Story = {
|
|
56
|
+
render: () => (
|
|
57
|
+
<VStack gap="4">
|
|
58
|
+
<div>
|
|
59
|
+
<h2>Default</h2>
|
|
60
|
+
<ErrorSummary heading="Feiloppsummering komponent">
|
|
61
|
+
<ErrorSummary.Item href="#1">Checkbox må fylles ut</ErrorSummary.Item>
|
|
62
|
+
<ErrorSummary.Item href="#2">
|
|
63
|
+
Tekstfeltet må ha en godkjent e-mail
|
|
64
|
+
</ErrorSummary.Item>
|
|
65
|
+
</ErrorSummary>
|
|
66
|
+
</div>
|
|
67
|
+
<div>
|
|
68
|
+
<h2>Small</h2>
|
|
69
|
+
<ErrorSummary heading="Feiloppsummering komponent" size="small">
|
|
70
|
+
<ErrorSummary.Item href="#1">Checkbox må fylles ut</ErrorSummary.Item>
|
|
71
|
+
<ErrorSummary.Item href="#2">
|
|
72
|
+
Tekstfeltet må ha en godkjent e-mail
|
|
73
|
+
</ErrorSummary.Item>
|
|
74
|
+
</ErrorSummary>
|
|
75
|
+
</div>
|
|
76
|
+
</VStack>
|
|
77
|
+
),
|
|
78
|
+
parameters: {
|
|
79
|
+
chromatic: { disable: false },
|
|
80
|
+
},
|
|
81
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Meta } from "@storybook/react";
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { VStack } from "../../layout/stack";
|
|
3
4
|
import TextField from "../textfield/TextField";
|
|
4
5
|
import { Fieldset } from "./index";
|
|
5
6
|
|
|
@@ -26,7 +27,12 @@ export default {
|
|
|
26
27
|
type: "boolean",
|
|
27
28
|
},
|
|
28
29
|
},
|
|
29
|
-
|
|
30
|
+
parameters: {
|
|
31
|
+
chromatic: { disable: true },
|
|
32
|
+
},
|
|
33
|
+
} satisfies Meta<typeof Fieldset>;
|
|
34
|
+
|
|
35
|
+
type Story = StoryObj<typeof Fieldset>;
|
|
30
36
|
|
|
31
37
|
const content = (
|
|
32
38
|
<>
|
|
@@ -35,88 +41,117 @@ const content = (
|
|
|
35
41
|
</>
|
|
36
42
|
);
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
},
|
|
44
|
+
const contentWithError = (
|
|
45
|
+
<>
|
|
46
|
+
<TextField label="Textfield label" hideLabel error="Må være fylt ut" />
|
|
47
|
+
<TextField label="Textfield label" hideLabel />
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
46
50
|
|
|
51
|
+
export const Default: Story = {
|
|
47
52
|
args: {
|
|
53
|
+
legend: "Mollit eiusmod",
|
|
54
|
+
description:
|
|
55
|
+
"Do ullamco amet mollit labore tempor minim cupidatat dolore voluptate velit irure.",
|
|
48
56
|
errorPropagation: true,
|
|
57
|
+
children: content,
|
|
49
58
|
},
|
|
50
59
|
};
|
|
51
60
|
|
|
52
|
-
export const Small =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
export const Small: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
legend: "Mollit eiusmod",
|
|
64
|
+
description:
|
|
65
|
+
"Do ullamco amet mollit labore tempor minim cupidatat dolore voluptate velit irure.",
|
|
66
|
+
errorPropagation: true,
|
|
67
|
+
children: content,
|
|
68
|
+
size: "small",
|
|
69
|
+
},
|
|
70
|
+
};
|
|
61
71
|
|
|
62
|
-
export const
|
|
63
|
-
|
|
64
|
-
legend
|
|
65
|
-
description
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<TextField
|
|
72
|
-
label="Textfield label"
|
|
73
|
-
description="Enim et occaecat voluptate labore sit do exercitation laborum non "
|
|
74
|
-
/>
|
|
75
|
-
</Fieldset>
|
|
76
|
-
);
|
|
72
|
+
export const ErrorPropagation: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
legend: "Mollit eiusmod",
|
|
75
|
+
description:
|
|
76
|
+
"Do ullamco amet mollit labore tempor minim cupidatat dolore voluptate velit irure.",
|
|
77
|
+
errorPropagation: false,
|
|
78
|
+
children: contentWithError,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
77
81
|
|
|
78
|
-
export const
|
|
79
|
-
|
|
80
|
-
legend
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
);
|
|
82
|
+
export const Error: Story = {
|
|
83
|
+
args: {
|
|
84
|
+
legend: "Mollit eiusmod",
|
|
85
|
+
description:
|
|
86
|
+
"Do ullamco amet mollit labore tempor minim cupidatat dolore voluptate velit irure.",
|
|
87
|
+
children: content,
|
|
88
|
+
error: "Laborum officia nisi aliqua esse minim in amet.",
|
|
89
|
+
},
|
|
90
|
+
};
|
|
88
91
|
|
|
89
|
-
export const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
size="small"
|
|
99
|
-
legend="Mollit eiusmod"
|
|
100
|
-
error="Laborum officia nisi aliqua esse minim in amet."
|
|
101
|
-
>
|
|
102
|
-
{content}
|
|
103
|
-
</Fieldset>
|
|
104
|
-
</div>
|
|
105
|
-
);
|
|
92
|
+
export const Disabled: Story = {
|
|
93
|
+
args: {
|
|
94
|
+
legend: "Mollit eiusmod",
|
|
95
|
+
description:
|
|
96
|
+
"Do ullamco amet mollit labore tempor minim cupidatat dolore voluptate velit irure.",
|
|
97
|
+
children: content,
|
|
98
|
+
disabled: true,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
106
101
|
|
|
107
|
-
export const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
);
|
|
102
|
+
export const HideLegend: Story = {
|
|
103
|
+
args: {
|
|
104
|
+
legend: "Mollit eiusmod",
|
|
105
|
+
description:
|
|
106
|
+
"Do ullamco amet mollit labore tempor minim cupidatat dolore voluptate velit irure.",
|
|
107
|
+
children: content,
|
|
108
|
+
hideLegend: true,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
117
111
|
|
|
118
|
-
export const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
export const Chromatic: Story = {
|
|
113
|
+
render: () => {
|
|
114
|
+
return (
|
|
115
|
+
<VStack gap="4">
|
|
116
|
+
<div>
|
|
117
|
+
<h2>Default</h2>
|
|
118
|
+
{/* @ts-expect-error Args are Partial here */}
|
|
119
|
+
<Fieldset {...Default.args} />
|
|
120
|
+
</div>
|
|
121
|
+
<div>
|
|
122
|
+
<h2>Small</h2>
|
|
123
|
+
{/* @ts-expect-error Args are Partial here */}
|
|
124
|
+
<Fieldset {...Small.args} />
|
|
125
|
+
</div>
|
|
126
|
+
<div>
|
|
127
|
+
<h2>ErrorPropagation</h2>
|
|
128
|
+
{/* @ts-expect-error Args are Partial here */}
|
|
129
|
+
<Fieldset {...ErrorPropagation.args} />
|
|
130
|
+
</div>
|
|
131
|
+
<div>
|
|
132
|
+
<h2>Error</h2>
|
|
133
|
+
{/* @ts-expect-error Args are Partial here */}
|
|
134
|
+
<Fieldset {...Error.args} />
|
|
135
|
+
</div>
|
|
136
|
+
<div>
|
|
137
|
+
<h2>Error small</h2>
|
|
138
|
+
{/* @ts-expect-error Args are Partial here */}
|
|
139
|
+
<Fieldset {...Error.args} size="small" />
|
|
140
|
+
</div>
|
|
141
|
+
<div>
|
|
142
|
+
<h2>Disabled</h2>
|
|
143
|
+
{/* @ts-expect-error Args are Partial here */}
|
|
144
|
+
<Fieldset {...Disabled.args} />
|
|
145
|
+
</div>
|
|
146
|
+
<div>
|
|
147
|
+
<h2>HideLegend</h2>
|
|
148
|
+
{/* @ts-expect-error Args are Partial here */}
|
|
149
|
+
<Fieldset {...HideLegend.args} />
|
|
150
|
+
</div>
|
|
151
|
+
</VStack>
|
|
152
|
+
);
|
|
153
|
+
},
|
|
154
|
+
parameters: {
|
|
155
|
+
chromatic: { disable: false },
|
|
156
|
+
},
|
|
157
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
FileUpload: {
|
|
3
|
+
dropzone: {
|
|
4
|
+
button: "Velg fil",
|
|
5
|
+
buttonMultiple: "Velg filer",
|
|
6
|
+
dragAndDrop: "Dra og slipp filen her",
|
|
7
|
+
dragAndDropMultiple: "Dra og slipp filer her",
|
|
8
|
+
drop: "Slipp",
|
|
9
|
+
or: "eller",
|
|
10
|
+
disabled: "Filopplasting er deaktivert",
|
|
11
|
+
disabledFilelimit: "Du kan ikke laste opp flere filer",
|
|
12
|
+
},
|
|
13
|
+
item: {
|
|
14
|
+
retryButtonTitle: "Prøv å laste opp filen på nytt",
|
|
15
|
+
deleteButtonTitle: "Slett filen",
|
|
16
|
+
uploading: "Laster opp…",
|
|
17
|
+
downloading: "Laster ned…",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -129,7 +129,7 @@ const Dropzone = forwardRef<HTMLInputElement, FileUploadDropzoneProps>(
|
|
|
129
129
|
<BodyShort as="div">{translate("dropzone.or")}</BodyShort>
|
|
130
130
|
</div>
|
|
131
131
|
<Button
|
|
132
|
-
{...omit(rest, ["errorId"])}
|
|
132
|
+
{...omit(rest, ["errorId", "id"])}
|
|
133
133
|
{...inputPropsRest}
|
|
134
134
|
aria-describedby={cl(labelId, ariaDescribedby)}
|
|
135
135
|
className="navds-dropzone__area-button"
|
|
@@ -24,12 +24,14 @@ export interface FileItemBaseProps {
|
|
|
24
24
|
file: FileItem;
|
|
25
25
|
/**
|
|
26
26
|
* onClick on the file name.
|
|
27
|
-
*
|
|
27
|
+
*
|
|
28
|
+
* If neither this nor `href` is set, and the `file` prop is a native file, onClick will download the file.
|
|
28
29
|
*/
|
|
29
30
|
onFileClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
30
31
|
/**
|
|
31
32
|
* href on the file name.
|
|
32
|
-
*
|
|
33
|
+
*
|
|
34
|
+
* If neither this nor `onFileClick` is set, and the `file` prop is a native file, onClick will download the file.
|
|
33
35
|
*/
|
|
34
36
|
href?: string;
|
|
35
37
|
/**
|