@navikt/ds-react 6.1.1 → 6.2.0
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/accordion/Accordion.d.ts +4 -4
- package/cjs/alert/Alert.d.ts +12 -10
- package/cjs/alert/Alert.js.map +1 -1
- package/cjs/button/Button.d.ts +9 -8
- package/cjs/button/Button.js.map +1 -1
- package/cjs/chat/Chat.d.ts +6 -6
- package/cjs/chips/Chips.d.ts +2 -2
- package/cjs/copybutton/CopyButton.d.ts +14 -12
- package/cjs/copybutton/CopyButton.js.map +1 -1
- package/cjs/date/datepicker/types.d.ts +7 -6
- package/cjs/date/hooks/useDatepicker.d.ts +4 -3
- package/cjs/date/hooks/useDatepicker.js.map +1 -1
- package/cjs/date/hooks/useMonthPicker.d.ts +4 -3
- package/cjs/date/hooks/useMonthPicker.js.map +1 -1
- package/cjs/date/monthpicker/types.d.ts +2 -1
- package/cjs/date/parts/DateInput.d.ts +1 -1
- package/cjs/expansion-card/ExpansionCardTitle.d.ts +1 -1
- package/cjs/form/checkbox/CheckboxGroup.d.ts +3 -3
- package/cjs/form/checkbox/types.d.ts +4 -4
- package/cjs/form/combobox/types.d.ts +15 -15
- package/cjs/form/error-summary/ErrorSummary.d.ts +5 -5
- package/cjs/form/radio/RadioGroup.d.ts +1 -1
- package/cjs/form/search/Search.d.ts +3 -2
- package/cjs/form/search/Search.js.map +1 -1
- package/cjs/form/select/Select.d.ts +9 -9
- package/cjs/form/switch/Switch.d.ts +5 -5
- package/cjs/form/textarea/Textarea.d.ts +5 -4
- package/cjs/form/textarea/Textarea.js.map +1 -1
- package/cjs/form/useFormField.d.ts +10 -8
- package/cjs/form/useFormField.js.map +1 -1
- package/cjs/layout/bleed/Bleed.d.ts +9 -1
- package/cjs/layout/bleed/Bleed.js.map +1 -1
- package/cjs/layout/box/Box.d.ts +5 -5
- package/cjs/layout/grid/HGrid.d.ts +1 -3
- package/cjs/layout/grid/HGrid.js.map +1 -1
- package/cjs/layout/page/Page.d.ts +2 -2
- package/cjs/layout/responsive/Responsive.d.ts +2 -4
- package/cjs/layout/responsive/Responsive.js.map +1 -1
- package/cjs/layout/stack/Stack.d.ts +18 -4
- package/cjs/layout/stack/Stack.js.map +1 -1
- package/cjs/list/types.d.ts +1 -1
- package/cjs/loader/Loader.d.ts +1 -0
- package/cjs/loader/Loader.js.map +1 -1
- package/cjs/modal/Modal.js +2 -2
- package/cjs/modal/types.d.ts +8 -8
- package/cjs/pagination/Pagination.d.ts +3 -2
- package/cjs/pagination/Pagination.js.map +1 -1
- package/cjs/pagination/PaginationItem.d.ts +1 -1
- package/cjs/popover/Popover.d.ts +2 -1
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/read-more/ReadMore.d.ts +7 -7
- package/cjs/stepper/Step.d.ts +4 -4
- package/cjs/stepper/Stepper.d.ts +7 -5
- package/cjs/stepper/Stepper.js.map +1 -1
- package/cjs/table/AnimateHeight.d.ts +1 -1
- package/cjs/tabs/TabList.d.ts +1 -1
- package/cjs/tabs/Tabs.d.ts +7 -7
- package/cjs/timeline/Timeline.d.ts +6 -3
- package/cjs/timeline/Timeline.js +2 -1
- package/cjs/timeline/Timeline.js.map +1 -1
- package/cjs/timeline/period/index.d.ts +3 -2
- package/cjs/timeline/period/index.js.map +1 -1
- package/cjs/tooltip/Tooltip.d.ts +19 -12
- package/cjs/tooltip/Tooltip.js.map +1 -1
- package/esm/accordion/Accordion.d.ts +4 -4
- package/esm/alert/Alert.d.ts +12 -10
- package/esm/alert/Alert.js.map +1 -1
- package/esm/button/Button.d.ts +9 -8
- package/esm/button/Button.js.map +1 -1
- package/esm/chat/Chat.d.ts +6 -6
- package/esm/chips/Chips.d.ts +2 -2
- package/esm/copybutton/CopyButton.d.ts +14 -12
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/datepicker/types.d.ts +7 -6
- package/esm/date/hooks/useDatepicker.d.ts +4 -3
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/date/hooks/useMonthPicker.d.ts +4 -3
- package/esm/date/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/monthpicker/types.d.ts +2 -1
- package/esm/date/parts/DateInput.d.ts +1 -1
- package/esm/expansion-card/ExpansionCardTitle.d.ts +1 -1
- package/esm/form/checkbox/CheckboxGroup.d.ts +3 -3
- package/esm/form/checkbox/types.d.ts +4 -4
- package/esm/form/combobox/types.d.ts +15 -15
- package/esm/form/error-summary/ErrorSummary.d.ts +5 -5
- package/esm/form/radio/RadioGroup.d.ts +1 -1
- package/esm/form/search/Search.d.ts +3 -2
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/select/Select.d.ts +9 -9
- package/esm/form/switch/Switch.d.ts +5 -5
- package/esm/form/textarea/Textarea.d.ts +5 -4
- package/esm/form/textarea/Textarea.js.map +1 -1
- package/esm/form/useFormField.d.ts +10 -8
- package/esm/form/useFormField.js.map +1 -1
- package/esm/layout/bleed/Bleed.d.ts +9 -1
- package/esm/layout/bleed/Bleed.js.map +1 -1
- package/esm/layout/box/Box.d.ts +5 -5
- package/esm/layout/grid/HGrid.d.ts +1 -3
- package/esm/layout/grid/HGrid.js.map +1 -1
- package/esm/layout/page/Page.d.ts +2 -2
- package/esm/layout/responsive/Responsive.d.ts +2 -4
- package/esm/layout/responsive/Responsive.js.map +1 -1
- package/esm/layout/stack/Stack.d.ts +18 -4
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/list/types.d.ts +1 -1
- package/esm/loader/Loader.d.ts +1 -0
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.js +2 -2
- package/esm/modal/types.d.ts +8 -8
- package/esm/pagination/Pagination.d.ts +3 -2
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/pagination/PaginationItem.d.ts +1 -1
- package/esm/popover/Popover.d.ts +2 -1
- package/esm/popover/Popover.js.map +1 -1
- package/esm/read-more/ReadMore.d.ts +7 -7
- package/esm/stepper/Step.d.ts +4 -4
- package/esm/stepper/Stepper.d.ts +7 -5
- package/esm/stepper/Stepper.js.map +1 -1
- package/esm/table/AnimateHeight.d.ts +1 -1
- package/esm/tabs/TabList.d.ts +1 -1
- package/esm/tabs/Tabs.d.ts +7 -7
- package/esm/timeline/Timeline.d.ts +6 -3
- package/esm/timeline/Timeline.js +2 -1
- package/esm/timeline/Timeline.js.map +1 -1
- package/esm/timeline/period/index.d.ts +3 -2
- package/esm/timeline/period/index.js.map +1 -1
- package/esm/tooltip/Tooltip.d.ts +19 -12
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/package.json +3 -3
- package/src/accordion/Accordion.tsx +4 -4
- package/src/accordion/accordion.stories.tsx +0 -2
- package/src/alert/Alert.tsx +12 -10
- package/src/button/Button.tsx +9 -8
- package/src/chat/Chat.tsx +6 -6
- package/src/chips/Chips.tsx +2 -2
- package/src/copybutton/CopyButton.tsx +14 -12
- package/src/date/datepicker/datepicker.stories.tsx +0 -1
- package/src/date/datepicker/types.ts +7 -6
- package/src/date/hooks/useDatepicker.tsx +4 -3
- package/src/date/hooks/useMonthPicker.tsx +4 -3
- package/src/date/monthpicker/types.ts +2 -1
- package/src/date/parts/DateInput.tsx +1 -1
- package/src/expansion-card/ExpansionCardTitle.tsx +1 -1
- package/src/form/checkbox/CheckboxGroup.tsx +3 -3
- package/src/form/checkbox/types.ts +4 -4
- package/src/form/combobox/types.ts +15 -15
- package/src/form/error-summary/ErrorSummary.tsx +5 -5
- package/src/form/radio/RadioGroup.tsx +1 -1
- package/src/form/search/Search.tsx +3 -2
- package/src/form/select/Select.tsx +9 -9
- package/src/form/select/select.stories.tsx +32 -37
- package/src/form/switch/Switch.tsx +5 -5
- package/src/form/textarea/Textarea.tsx +5 -4
- package/src/form/useFormField.ts +10 -8
- package/src/layout/bleed/Bleed.tsx +9 -1
- package/src/layout/box/Box.tsx +5 -5
- package/src/layout/grid/HGrid.tsx +1 -3
- package/src/layout/page/Page.tsx +2 -2
- package/src/layout/responsive/Responsive.tsx +2 -4
- package/src/layout/stack/Stack.tsx +18 -4
- package/src/list/types.ts +1 -1
- package/src/loader/Loader.tsx +1 -0
- package/src/modal/Modal.tsx +2 -2
- package/src/modal/types.ts +8 -8
- package/src/pagination/Pagination.tsx +3 -2
- package/src/pagination/PaginationItem.tsx +1 -1
- package/src/popover/Popover.tsx +2 -1
- package/src/read-more/ReadMore.tsx +7 -7
- package/src/stepper/Step.tsx +4 -4
- package/src/stepper/Stepper.tsx +7 -5
- package/src/table/AnimateHeight.tsx +1 -1
- package/src/tabs/TabList.tsx +1 -1
- package/src/tabs/Tabs.tsx +7 -7
- package/src/timeline/Timeline.tsx +6 -3
- package/src/timeline/period/index.tsx +3 -2
- package/src/tooltip/Tooltip.tsx +19 -12
|
@@ -6,20 +6,20 @@ import ErrorSummaryItem, { ErrorSummaryItemType } from "./ErrorSummaryItem";
|
|
|
6
6
|
|
|
7
7
|
export interface ErrorSummaryProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Collection of `ErrorSummary.Item`.
|
|
10
10
|
*/
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
/**
|
|
13
|
-
* Changes padding and font-sizes
|
|
13
|
+
* Changes padding and font-sizes.
|
|
14
14
|
* @default "medium"
|
|
15
15
|
*/
|
|
16
16
|
size?: "medium" | "small";
|
|
17
17
|
/**
|
|
18
|
-
* Heading above links
|
|
18
|
+
* Heading above links.
|
|
19
19
|
*/
|
|
20
20
|
heading?: React.ReactNode;
|
|
21
21
|
/**
|
|
22
|
-
* Allows setting a different HTML h-tag
|
|
22
|
+
* Allows setting a different HTML h-tag.
|
|
23
23
|
* @default "h2"
|
|
24
24
|
*/
|
|
25
25
|
headingTag?: React.ElementType<any>;
|
|
@@ -30,7 +30,7 @@ interface ErrorSummaryComponent
|
|
|
30
30
|
ErrorSummaryProps & React.RefAttributes<HTMLDivElement>
|
|
31
31
|
> {
|
|
32
32
|
/**
|
|
33
|
-
* Link to error
|
|
33
|
+
* Link to error.
|
|
34
34
|
*
|
|
35
35
|
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
|
36
36
|
*
|
|
@@ -26,8 +26,9 @@ export interface SearchProps
|
|
|
26
26
|
Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange" | "type"> {
|
|
27
27
|
children?: React.ReactNode;
|
|
28
28
|
/**
|
|
29
|
-
* Search label
|
|
30
|
-
*
|
|
29
|
+
* Search label.
|
|
30
|
+
*
|
|
31
|
+
* Will be hidden by default, is required for accessibility reasons.
|
|
31
32
|
*/
|
|
32
33
|
label: React.ReactNode;
|
|
33
34
|
/**
|
|
@@ -8,27 +8,27 @@ import { FormFieldProps, useFormField } from "../useFormField";
|
|
|
8
8
|
|
|
9
9
|
export interface SelectProps
|
|
10
10
|
extends FormFieldProps,
|
|
11
|
-
Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> {
|
|
11
|
+
Omit<SelectHTMLAttributes<HTMLSelectElement>, "size" | "multiple"> {
|
|
12
12
|
/**
|
|
13
|
-
* Collection of <option />-elements
|
|
13
|
+
* Collection of <option />-elements.
|
|
14
14
|
*/
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
/**
|
|
17
|
-
* Exposes the HTML size attribute
|
|
17
|
+
* Exposes the HTML size attribute.
|
|
18
18
|
*/
|
|
19
19
|
htmlSize?: number;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Sets inline-style on select wrapper.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Label for select.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
label: React.ReactNode;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Shows label and description for screenreaders only.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
hideLabel?: boolean;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -1,36 +1,15 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import Select from "./Select";
|
|
3
|
+
import Select, { SelectProps } from "./Select";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const meta: Meta<typeof Select> = {
|
|
6
6
|
title: "ds-react/Select",
|
|
7
7
|
component: Select,
|
|
8
|
-
argTypes: {
|
|
9
|
-
size: {
|
|
10
|
-
control: {
|
|
11
|
-
type: "radio",
|
|
12
|
-
options: ["medium", "small"],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
description: {
|
|
16
|
-
type: "string",
|
|
17
|
-
},
|
|
18
|
-
error: {
|
|
19
|
-
type: "string",
|
|
20
|
-
},
|
|
21
|
-
hideLabel: {
|
|
22
|
-
type: "boolean",
|
|
23
|
-
},
|
|
24
|
-
disabled: {
|
|
25
|
-
type: "boolean",
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
8
|
parameters: {
|
|
29
9
|
chromatic: { disable: true },
|
|
30
10
|
},
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
type Story = StoryObj<typeof Select>;
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
34
13
|
|
|
35
14
|
const content = (
|
|
36
15
|
<>
|
|
@@ -40,16 +19,32 @@ const content = (
|
|
|
40
19
|
</>
|
|
41
20
|
);
|
|
42
21
|
|
|
43
|
-
export const Default =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
22
|
+
export const Default: StoryFn<Omit<SelectProps, "children">> = (props) => (
|
|
23
|
+
<Select {...props}>{content}</Select>
|
|
24
|
+
);
|
|
25
|
+
Default.args = {
|
|
26
|
+
label: "Ipsum enim quis culpa",
|
|
27
|
+
};
|
|
28
|
+
Default.argTypes = {
|
|
29
|
+
description: {
|
|
30
|
+
type: "string",
|
|
31
|
+
},
|
|
32
|
+
size: {
|
|
33
|
+
control: { type: "radio" },
|
|
34
|
+
options: ["medium", "small"],
|
|
35
|
+
},
|
|
36
|
+
error: {
|
|
37
|
+
type: "string",
|
|
38
|
+
},
|
|
39
|
+
hideLabel: {
|
|
40
|
+
type: "boolean",
|
|
41
|
+
},
|
|
42
|
+
disabled: {
|
|
43
|
+
type: "boolean",
|
|
44
|
+
},
|
|
45
|
+
readOnly: {
|
|
46
|
+
type: "boolean",
|
|
50
47
|
},
|
|
51
|
-
|
|
52
|
-
args: {},
|
|
53
48
|
};
|
|
54
49
|
|
|
55
50
|
export const Small = () => {
|
|
@@ -138,12 +133,12 @@ export const Readonly = () => {
|
|
|
138
133
|
);
|
|
139
134
|
};
|
|
140
135
|
|
|
141
|
-
export const Chromatic:
|
|
136
|
+
export const Chromatic: StoryObj<typeof Select> = {
|
|
142
137
|
render: () => (
|
|
143
138
|
<div>
|
|
144
139
|
<div>
|
|
145
140
|
<h2>Default</h2>
|
|
146
|
-
|
|
141
|
+
<Default label="Ipsum enim quis culpa" />
|
|
147
142
|
</div>
|
|
148
143
|
<div>
|
|
149
144
|
<h2>Small</h2>
|
|
@@ -36,24 +36,24 @@ export interface SwitchProps
|
|
|
36
36
|
extends Omit<FormFieldProps, "error" | "errorId">,
|
|
37
37
|
Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
38
38
|
/**
|
|
39
|
-
* Switch-label
|
|
39
|
+
* Switch-label.
|
|
40
40
|
*/
|
|
41
41
|
children: React.ReactNode;
|
|
42
42
|
/**
|
|
43
|
-
* If enabled shows the label and description for screenreaders only
|
|
43
|
+
* If enabled shows the label and description for screenreaders only.
|
|
44
44
|
*/
|
|
45
45
|
hideLabel?: boolean;
|
|
46
46
|
/**
|
|
47
|
-
* Toggles loading state with loader-component on switch
|
|
47
|
+
* Toggles loading state with loader-component on switch.
|
|
48
48
|
*/
|
|
49
49
|
loading?: boolean;
|
|
50
50
|
/**
|
|
51
|
-
* Positions switch on left/right side of label
|
|
51
|
+
* Positions switch on left/right side of label.
|
|
52
52
|
* @default "left"
|
|
53
53
|
*/
|
|
54
54
|
position?: "left" | "right";
|
|
55
55
|
/**
|
|
56
|
-
* Adds a description to extend labling of Switch
|
|
56
|
+
* Adds a description to extend labling of Switch.
|
|
57
57
|
*/
|
|
58
58
|
description?: string;
|
|
59
59
|
}
|
|
@@ -17,7 +17,8 @@ export interface TextareaProps
|
|
|
17
17
|
React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
18
18
|
/**
|
|
19
19
|
* Allowed character-count for content
|
|
20
|
-
*
|
|
20
|
+
*
|
|
21
|
+
* This is just a visual indicator! You will still need to handle actual character-limits/validation if needed.
|
|
21
22
|
*/
|
|
22
23
|
maxLength?: number;
|
|
23
24
|
/**
|
|
@@ -37,15 +38,15 @@ export interface TextareaProps
|
|
|
37
38
|
*/
|
|
38
39
|
minRows?: number;
|
|
39
40
|
/**
|
|
40
|
-
* Textarea label
|
|
41
|
+
* Textarea label.
|
|
41
42
|
*/
|
|
42
43
|
label: React.ReactNode;
|
|
43
44
|
/**
|
|
44
|
-
* If enabled shows the label and description for screenreaders only
|
|
45
|
+
* If enabled shows the label and description for screenreaders only.
|
|
45
46
|
*/
|
|
46
47
|
hideLabel?: boolean;
|
|
47
48
|
/**
|
|
48
|
-
* Enables resizing of field
|
|
49
|
+
* Enables resizing of field.
|
|
49
50
|
*/
|
|
50
51
|
resize?: boolean | "vertical" | "horizontal";
|
|
51
52
|
/**
|
package/src/form/useFormField.ts
CHANGED
|
@@ -5,32 +5,34 @@ import { FieldsetContext } from "./fieldset/context";
|
|
|
5
5
|
|
|
6
6
|
export interface FormFieldProps {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Adds a description to extend labling of the field.
|
|
9
|
+
* Error message for element.
|
|
9
10
|
*/
|
|
10
11
|
error?: React.ReactNode;
|
|
11
12
|
/**
|
|
12
|
-
* Override internal errorId
|
|
13
|
+
* Override internal errorId.
|
|
13
14
|
*/
|
|
14
15
|
errorId?: string;
|
|
15
16
|
/**
|
|
16
|
-
* Changes font-size, padding and gaps
|
|
17
|
+
* Changes font-size, padding and gaps.
|
|
17
18
|
*/
|
|
18
19
|
size?: "medium" | "small";
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* **Avoid using if possible for accessibility purposes**.
|
|
22
|
+
*
|
|
23
|
+
* Disables element.
|
|
22
24
|
*/
|
|
23
25
|
disabled?: boolean;
|
|
24
26
|
/**
|
|
25
|
-
* Adds a description to extend labling of a field
|
|
27
|
+
* Adds a description to extend labling of a field.
|
|
26
28
|
*/
|
|
27
29
|
description?: React.ReactNode;
|
|
28
30
|
/**
|
|
29
|
-
* Override internal id
|
|
31
|
+
* Override internal id.
|
|
30
32
|
*/
|
|
31
33
|
id?: string;
|
|
32
34
|
/**
|
|
33
|
-
* Read
|
|
35
|
+
* Read-only state.
|
|
34
36
|
*/
|
|
35
37
|
readOnly?: boolean;
|
|
36
38
|
}
|
|
@@ -9,7 +9,11 @@ export type BleedSpacingBlock = "0" | "px" | SpacingScale;
|
|
|
9
9
|
|
|
10
10
|
export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
11
|
/** **Negative** horizontal margin around children.
|
|
12
|
-
*
|
|
12
|
+
* Accepts a spacing token or an object of spacing tokens for different breakpoints.
|
|
13
|
+
*
|
|
14
|
+
* The `px` value is useful to nudge by just 1px.
|
|
15
|
+
* The `full` value is used to extend the margin to the full width of the parent.
|
|
16
|
+
*
|
|
13
17
|
* @example
|
|
14
18
|
* marginInline='4'
|
|
15
19
|
* marginInline='4 5'
|
|
@@ -20,6 +24,10 @@ export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
20
24
|
>;
|
|
21
25
|
/** **Negative** vertical margin around children.
|
|
22
26
|
* Accepts a spacing token or an object of spacing tokens for different breakpoints.
|
|
27
|
+
*
|
|
28
|
+
* The `px` value is useful to nudge by just 1px.
|
|
29
|
+
* This prop does **not** accept the `full` value.
|
|
30
|
+
*
|
|
23
31
|
* @example
|
|
24
32
|
* marginBlock='4'
|
|
25
33
|
* marginBlock='4 5'
|
package/src/layout/box/Box.tsx
CHANGED
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
} from "../utilities/types";
|
|
14
14
|
|
|
15
15
|
export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
|
-
/**
|
|
16
|
+
/** CSS `background-color` property. Accepts a color token. */
|
|
17
17
|
background?: BackgroundToken;
|
|
18
|
-
/**
|
|
18
|
+
/** CSS `border-color` property. Accepts a color token. */
|
|
19
19
|
borderColor?: BorderColorToken;
|
|
20
|
-
/**
|
|
20
|
+
/** CSS `border-radius` property. Accepts a radius token, or an object of radius tokens for different breakpoints.
|
|
21
21
|
* @example
|
|
22
22
|
* borderRadius='full'
|
|
23
23
|
* borderRadius='0 full large small'
|
|
@@ -25,13 +25,13 @@ export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
25
25
|
*/
|
|
26
26
|
borderRadius?: ResponsiveProp<SpaceDelimitedAttribute<BorderRadiiToken>>;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* CSS `border-width` property. If this is not set there will be no border.
|
|
29
29
|
* @example
|
|
30
30
|
* borderWidth='2'
|
|
31
31
|
* borderWidth='1 2 3 4'
|
|
32
32
|
*/
|
|
33
33
|
borderWidth?: SpaceDelimitedAttribute<"0" | "1" | "2" | "3" | "4" | "5">;
|
|
34
|
-
/**
|
|
34
|
+
/** Padding around children. Accepts a spacing token or an object of spacing tokens for different breakpoints.
|
|
35
35
|
* @example
|
|
36
36
|
* padding='4'
|
|
37
37
|
* padding={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
@@ -6,13 +6,11 @@ import { ResponsiveProp, SpacingScale } from "../utilities/types";
|
|
|
6
6
|
export interface HGridProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/**
|
|
9
|
-
* Number of columns to display. Can be a number, a string with a unit or tokens for
|
|
9
|
+
* Number of columns to display. Can be a number, a string with a unit, or tokens for specific breakpoints.
|
|
10
10
|
* Sets `grid-template-columns`, so `fr`, `minmax` etc. works.
|
|
11
11
|
* @example
|
|
12
12
|
* columns={{ sm: 1, md: 1, lg: "1fr auto", xl: "1fr auto"}}
|
|
13
|
-
* @example
|
|
14
13
|
* columns={3}
|
|
15
|
-
* @example
|
|
16
14
|
* columns="repeat(3, minmax(0, 1fr))"
|
|
17
15
|
*/
|
|
18
16
|
columns?: ResponsiveProp<number | string>;
|
package/src/layout/page/Page.tsx
CHANGED
|
@@ -12,7 +12,7 @@ export interface PageProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
12
12
|
as?: "div" | "body";
|
|
13
13
|
/**
|
|
14
14
|
* Background color. Accepts a color token.
|
|
15
|
-
* @default bg-default
|
|
15
|
+
* @default "bg-default"
|
|
16
16
|
*/
|
|
17
17
|
background?: keyof typeof bgColors.a | "surface-subtle";
|
|
18
18
|
/**
|
|
@@ -25,7 +25,7 @@ export interface PageProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
25
25
|
footerPosition?: "belowFold";
|
|
26
26
|
/**
|
|
27
27
|
* Adds a standardised padding of 4rem between content and footer
|
|
28
|
-
* @default
|
|
28
|
+
* @default "end"
|
|
29
29
|
*/
|
|
30
30
|
contentBlockPadding?: "end" | "none";
|
|
31
31
|
}
|
|
@@ -6,13 +6,11 @@ import { BreakpointsAlias } from "../utilities/types";
|
|
|
6
6
|
export interface ResponsiveProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* above='md'
|
|
9
|
+
* Will show/hide element above breakpoint (inclusive)
|
|
11
10
|
*/
|
|
12
11
|
above?: Exclude<BreakpointsAlias, "xs">;
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
15
|
-
* below='md'
|
|
13
|
+
* Will show/hide element below breakpoint (inclusive)
|
|
16
14
|
*/
|
|
17
15
|
below?: Exclude<BreakpointsAlias, "xs">;
|
|
18
16
|
/**
|
|
@@ -7,7 +7,11 @@ import { ResponsiveProp, SpacingScale } from "../utilities/types";
|
|
|
7
7
|
export interface StackProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* CSS `justify-content` property.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* justify='center'
|
|
14
|
+
* justify={{xs: 'start', sm: 'center', md: 'end', lg: 'space-around', xl: 'space-between'}}
|
|
11
15
|
*/
|
|
12
16
|
justify?: ResponsiveProp<
|
|
13
17
|
| "start"
|
|
@@ -18,22 +22,32 @@ export interface StackProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
18
22
|
| "space-evenly"
|
|
19
23
|
>;
|
|
20
24
|
/**
|
|
21
|
-
*
|
|
25
|
+
* CSS `align-items` property.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* align='center'
|
|
29
|
+
* align={{xs: 'start', sm: 'center', md: 'end', lg: 'baseline', xl: 'stretch'}}
|
|
22
30
|
*/
|
|
23
31
|
align?: ResponsiveProp<"start" | "center" | "end" | "baseline" | "stretch">;
|
|
24
32
|
/**
|
|
25
|
-
* flex-wrap
|
|
33
|
+
* Sets the CSS `flex-wrap` property.
|
|
26
34
|
*/
|
|
27
35
|
wrap?: boolean;
|
|
28
36
|
/**
|
|
37
|
+
* CSS `gap` property.
|
|
38
|
+
*
|
|
29
39
|
* @example
|
|
30
40
|
* gap='4'
|
|
31
41
|
* gap={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
32
42
|
*/
|
|
33
43
|
gap?: ResponsiveProp<SpacingScale>;
|
|
34
44
|
/**
|
|
35
|
-
* flex-direction
|
|
45
|
+
* CSS `flex-direction` property.
|
|
36
46
|
* @default "row"
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* direction='row'
|
|
50
|
+
* direction={{xs: 'row', sm: 'column'}}
|
|
37
51
|
*/
|
|
38
52
|
direction?: ResponsiveProp<"row" | "column">;
|
|
39
53
|
}
|
package/src/list/types.ts
CHANGED
package/src/loader/Loader.tsx
CHANGED
|
@@ -35,6 +35,7 @@ export interface LoaderProps extends Omit<SVGProps<SVGSVGElement>, "ref"> {
|
|
|
35
35
|
/**
|
|
36
36
|
* Allows getting a ref to the component instance.
|
|
37
37
|
* Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
|
|
38
|
+
*
|
|
38
39
|
* @see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom
|
|
39
40
|
*/
|
|
40
41
|
ref?: React.Ref<SVGSVGElement>;
|
package/src/modal/Modal.tsx
CHANGED
|
@@ -165,7 +165,7 @@ export const Modal = forwardRef<HTMLDialogElement, ModalProps>(
|
|
|
165
165
|
const shouldHandleModalClick = closeOnBackdropClick && !needPolyfill;
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
*
|
|
168
|
+
* `closeOnBackdropClick` has issues on polyfill when nesting modals (DatePicker)
|
|
169
169
|
*/
|
|
170
170
|
const handleModalClick = (
|
|
171
171
|
endEvent: React.MouseEvent<HTMLDialogElement>,
|
|
@@ -191,7 +191,7 @@ export const Modal = forwardRef<HTMLDialogElement, ModalProps>(
|
|
|
191
191
|
};
|
|
192
192
|
|
|
193
193
|
/**
|
|
194
|
-
*
|
|
194
|
+
* onCancel fires when you press `Esc`
|
|
195
195
|
*/
|
|
196
196
|
const handleModalCancel = (
|
|
197
197
|
event: React.SyntheticEvent<HTMLDialogElement, Event>,
|
package/src/modal/types.ts
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
interface ModalPropsBase extends React.DialogHTMLAttributes<HTMLDialogElement> {
|
|
2
2
|
/**
|
|
3
|
-
* Content for the header. Alteratively you can use
|
|
4
|
-
* but then you have to set `aria-label` or `aria-labelledby` on the modal manually.
|
|
3
|
+
* Content for the header. Alteratively you can use `<Modal.Header>` instead for more control, but then you have to set `aria-label` or `aria-labelledby` on the modal manually.
|
|
5
4
|
*/
|
|
6
5
|
header?: {
|
|
7
6
|
label?: string;
|
|
8
7
|
icon?: React.ReactNode;
|
|
9
8
|
heading: string;
|
|
10
9
|
/**
|
|
11
|
-
* Heading size
|
|
10
|
+
* Heading size.
|
|
12
11
|
* @default "medium"
|
|
13
12
|
* */
|
|
14
13
|
size?: "medium" | "small";
|
|
15
14
|
/**
|
|
16
|
-
* Removes close-button (X) when false
|
|
15
|
+
* Removes close-button (X) when false.
|
|
17
16
|
* @default true
|
|
18
17
|
*/
|
|
19
18
|
closeButton?: boolean;
|
|
20
19
|
};
|
|
21
20
|
/**
|
|
22
|
-
* Modal content
|
|
21
|
+
* Modal content.
|
|
23
22
|
*/
|
|
24
23
|
children: React.ReactNode;
|
|
25
24
|
/**
|
|
@@ -36,12 +35,13 @@ interface ModalPropsBase extends React.DialogHTMLAttributes<HTMLDialogElement> {
|
|
|
36
35
|
* Called when the user tries to close the modal by one of the built-in methods.
|
|
37
36
|
* Used if you want to ask the user for confirmation before closing.
|
|
38
37
|
* @warning Will not always be called when pressing Esc. See `onCancel` for more info.
|
|
39
|
-
* @returns Whether to close the modal
|
|
38
|
+
* @returns Whether to close the modal or not
|
|
40
39
|
*/
|
|
41
40
|
onBeforeClose?: () => boolean;
|
|
42
41
|
/**
|
|
43
|
-
* *
|
|
44
|
-
*
|
|
42
|
+
* _Sometimes*_ called when the user presses the Esc key.
|
|
43
|
+
*
|
|
44
|
+
* *: Some browsers does not always trigger this event. Chrome only triggers it if you have
|
|
45
45
|
* interacted with the modal, and will not trigger it a second time if you press Esc twice in a row.
|
|
46
46
|
*/
|
|
47
47
|
onCancel?: React.ReactEventHandler<HTMLDialogElement>;
|
|
@@ -9,8 +9,9 @@ import PaginationItem, {
|
|
|
9
9
|
|
|
10
10
|
export interface PaginationProps extends React.HTMLAttributes<HTMLElement> {
|
|
11
11
|
/**
|
|
12
|
-
* Current page
|
|
13
|
-
*
|
|
12
|
+
* Current page.
|
|
13
|
+
*
|
|
14
|
+
* Pagination indexing starts at 1.
|
|
14
15
|
*/
|
|
15
16
|
page: number;
|
|
16
17
|
/**
|
package/src/popover/Popover.tsx
CHANGED
|
@@ -42,7 +42,8 @@ export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
42
42
|
onClose: () => void;
|
|
43
43
|
/**
|
|
44
44
|
* Default orientation of popover
|
|
45
|
-
*
|
|
45
|
+
*
|
|
46
|
+
* Try to keep general usage to "top", "bottom", "left", "right".
|
|
46
47
|
* @default "top"
|
|
47
48
|
*/
|
|
48
49
|
placement?:
|
|
@@ -8,20 +8,20 @@ import { useControllableState } from "../util/hooks/useControllableState";
|
|
|
8
8
|
export interface ReadMoreProps
|
|
9
9
|
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
10
|
/**
|
|
11
|
-
* Content inside ReadMore
|
|
11
|
+
* Content inside ReadMore.
|
|
12
12
|
*/
|
|
13
13
|
children: React.ReactNode;
|
|
14
14
|
/**
|
|
15
|
-
* ReadMore header content
|
|
15
|
+
* ReadMore header content.
|
|
16
16
|
*/
|
|
17
17
|
header: React.ReactNode;
|
|
18
18
|
/**
|
|
19
|
-
* Opens component if
|
|
20
|
-
* Using this prop removes automatic control of open-state
|
|
19
|
+
* Opens component if `true`, closes if `false`.
|
|
20
|
+
* Using this prop removes automatic control of open-state.
|
|
21
21
|
*/
|
|
22
22
|
open?: boolean;
|
|
23
23
|
/**
|
|
24
|
-
* Initially open
|
|
24
|
+
* Initially open.
|
|
25
25
|
* @default false
|
|
26
26
|
*/
|
|
27
27
|
defaultOpen?: boolean;
|
|
@@ -30,8 +30,8 @@ export interface ReadMoreProps
|
|
|
30
30
|
*/
|
|
31
31
|
onOpenChange?: (open: boolean) => void;
|
|
32
32
|
/**
|
|
33
|
-
* Changes fontsize for content
|
|
34
|
-
* @default medium
|
|
33
|
+
* Changes fontsize for content.
|
|
34
|
+
* @default "medium"
|
|
35
35
|
*/
|
|
36
36
|
size?: "medium" | "small";
|
|
37
37
|
}
|
package/src/stepper/Step.tsx
CHANGED
|
@@ -8,21 +8,21 @@ import { StepperContext } from "./context";
|
|
|
8
8
|
export interface StepperStepProps
|
|
9
9
|
extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
10
10
|
/**
|
|
11
|
-
* Text content by indicator
|
|
11
|
+
* Text content by indicator.
|
|
12
12
|
*/
|
|
13
13
|
children: string;
|
|
14
14
|
/**
|
|
15
|
-
* Handled by Stepper, overwriting may break component logic
|
|
15
|
+
* Handled by Stepper, overwriting may break component logic.
|
|
16
16
|
* @private
|
|
17
17
|
*/
|
|
18
18
|
unsafe_index?: number;
|
|
19
19
|
/**
|
|
20
|
-
* Makes step-indicator a checkmark
|
|
20
|
+
* Makes step-indicator a checkmark.
|
|
21
21
|
* @default false
|
|
22
22
|
*/
|
|
23
23
|
completed?: boolean;
|
|
24
24
|
/**
|
|
25
|
-
* Makes step non-interactive if false. Step will be set to a
|
|
25
|
+
* Makes step non-interactive if false. Step will be set to a `<div>`, overriding `as`-prop.
|
|
26
26
|
* @default true
|
|
27
27
|
*/
|
|
28
28
|
interactive?: boolean;
|