@navikt/ds-react 0.18.3 → 0.18.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/_docs.json +152 -192
- package/esm/accordion/Accordion.d.ts +1 -1
- package/esm/accordion/AccordionContent.d.ts +3 -1
- package/esm/accordion/AccordionContent.js.map +1 -1
- package/esm/accordion/AccordionHeader.d.ts +1 -1
- package/esm/accordion/AccordionItem.d.ts +6 -5
- package/esm/accordion/AccordionItem.js.map +1 -1
- package/esm/alert/Alert.d.ts +3 -2
- package/esm/alert/Alert.js.map +1 -1
- package/esm/button/Button.d.ts +1 -2
- package/esm/button/Button.js.map +1 -1
- package/esm/form/ConfirmationPanel.d.ts +1 -1
- package/esm/form/Fieldset/Fieldset.d.ts +4 -1
- package/esm/form/Fieldset/Fieldset.js.map +1 -1
- package/esm/form/Select.d.ts +2 -2
- package/esm/form/Switch.d.ts +1 -0
- package/esm/form/Switch.js.map +1 -1
- package/esm/form/TextField.d.ts +4 -4
- package/esm/form/Textarea.d.ts +10 -3
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/Checkbox.d.ts +2 -2
- package/esm/form/checkbox/CheckboxGroup.d.ts +2 -2
- package/esm/form/error-summary/ErrorSummary.d.ts +2 -2
- package/esm/form/radio/Radio.d.ts +1 -1
- package/esm/form/radio/RadioGroup.d.ts +4 -4
- package/esm/form/search/Search.d.ts +2 -2
- package/esm/form/useFormField.d.ts +1 -0
- package/esm/form/useFormField.js.map +1 -1
- package/esm/help-text/HelpText.d.ts +12 -1
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/link-panel/LinkPanel.d.ts +2 -1
- package/esm/link-panel/LinkPanel.js.map +1 -1
- package/esm/loader/Loader.d.ts +6 -2
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.d.ts +4 -4
- package/esm/pagination/Pagination.d.ts +1 -0
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/panel/Panel.d.ts +1 -1
- package/esm/popover/Popover.d.ts +7 -6
- package/esm/popover/Popover.js.map +1 -1
- package/esm/speech-bubble/SpeechBubble.d.ts +3 -3
- package/esm/step-indicator/Step.d.ts +2 -0
- package/esm/step-indicator/Step.js.map +1 -1
- package/esm/stepper/Step.d.ts +2 -1
- package/esm/stepper/Step.js.map +1 -1
- package/esm/table/ColumnHeader.d.ts +1 -1
- package/esm/table/DataCell.d.ts +1 -1
- package/esm/table/ExpandableRow.d.ts +1 -1
- package/esm/table/HeaderCell.d.ts +1 -1
- package/esm/tabs/Tab.d.ts +2 -2
- package/esm/tabs/TabList.d.ts +1 -1
- package/esm/tabs/TabPanel.d.ts +1 -1
- package/esm/tabs/Tabs.d.ts +1 -4
- package/esm/tabs/Tabs.js.map +1 -1
- package/esm/tag/Tag.d.ts +3 -4
- package/esm/tag/Tag.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.d.ts +1 -1
- package/esm/tooltip/Tooltip.d.ts +8 -6
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/BodyLong.d.ts +1 -1
- package/esm/typography/BodyShort.d.ts +1 -1
- package/esm/typography/Detail.d.ts +1 -1
- package/esm/typography/Heading.d.ts +2 -2
- package/esm/typography/Ingress.d.ts +1 -1
- package/esm/typography/Label.d.ts +1 -1
- package/package.json +2 -2
- package/src/accordion/Accordion.tsx +1 -1
- package/src/accordion/AccordionContent.tsx +3 -1
- package/src/accordion/AccordionHeader.tsx +1 -1
- package/src/accordion/AccordionItem.tsx +6 -5
- package/src/alert/Alert.tsx +3 -2
- package/src/button/Button.tsx +1 -2
- package/src/form/ConfirmationPanel.tsx +1 -1
- package/src/form/Fieldset/Fieldset.tsx +4 -1
- package/src/form/Select.tsx +2 -2
- package/src/form/Switch.tsx +1 -0
- package/src/form/TextField.tsx +4 -4
- package/src/form/Textarea.tsx +10 -3
- package/src/form/checkbox/Checkbox.tsx +2 -2
- package/src/form/checkbox/CheckboxGroup.tsx +2 -2
- package/src/form/error-summary/ErrorSummary.tsx +2 -2
- package/src/form/radio/Radio.tsx +1 -1
- package/src/form/radio/RadioGroup.tsx +4 -4
- package/src/form/search/Search.tsx +2 -2
- package/src/form/useFormField.ts +1 -0
- package/src/help-text/HelpText.tsx +12 -1
- package/src/link-panel/LinkPanel.tsx +2 -1
- package/src/loader/Loader.tsx +5 -4
- package/src/modal/Modal.tsx +4 -4
- package/src/pagination/Pagination.tsx +1 -0
- package/src/panel/Panel.tsx +1 -1
- package/src/popover/Popover.tsx +7 -6
- package/src/speech-bubble/SpeechBubble.tsx +3 -3
- package/src/step-indicator/Step.tsx +2 -0
- package/src/stepper/Step.tsx +2 -1
- package/src/table/ColumnHeader.tsx +1 -1
- package/src/table/DataCell.tsx +1 -1
- package/src/table/ExpandableRow.tsx +1 -1
- package/src/table/HeaderCell.tsx +1 -1
- package/src/tabs/Tab.tsx +2 -2
- package/src/tabs/TabList.tsx +1 -1
- package/src/tabs/TabPanel.tsx +1 -1
- package/src/tabs/Tabs.tsx +1 -4
- package/src/tag/Tag.tsx +3 -4
- package/src/toggle-group/ToggleGroup.tsx +1 -1
- package/src/tooltip/Tooltip.tsx +8 -6
- package/src/typography/BodyLong.tsx +1 -1
- package/src/typography/BodyShort.tsx +1 -1
- package/src/typography/Detail.tsx +1 -1
- package/src/typography/Heading.tsx +2 -2
- package/src/typography/Ingress.tsx +1 -1
- package/src/typography/Label.tsx +1 -1
|
@@ -5,7 +5,7 @@ import ErrorSummaryItem, { ErrorSummaryItemType } from "./ErrorSummaryItem";
|
|
|
5
5
|
|
|
6
6
|
export interface ErrorSummaryProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Collectipn of ErrorSummary.Item
|
|
9
9
|
*/
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
/**
|
|
@@ -18,7 +18,7 @@ export interface ErrorSummaryProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
18
18
|
*/
|
|
19
19
|
heading?: React.ReactNode;
|
|
20
20
|
/**
|
|
21
|
-
* Allows setting a different HTML
|
|
21
|
+
* Allows setting a different HTML h-tag
|
|
22
22
|
* @default "h2"
|
|
23
23
|
*/
|
|
24
24
|
headingTag?: React.ElementType<any>;
|
package/src/form/radio/Radio.tsx
CHANGED
|
@@ -21,7 +21,7 @@ export interface RadioGroupProps
|
|
|
21
21
|
"onChange" | "errorPropagation" | "defaultValue"
|
|
22
22
|
> {
|
|
23
23
|
/**
|
|
24
|
-
* Collection of <Radio
|
|
24
|
+
* Collection of <Radio />-elements
|
|
25
25
|
*/
|
|
26
26
|
children: React.ReactNode;
|
|
27
27
|
/**
|
|
@@ -29,15 +29,15 @@ export interface RadioGroupProps
|
|
|
29
29
|
*/
|
|
30
30
|
name?: string;
|
|
31
31
|
/**
|
|
32
|
-
* Default checked
|
|
32
|
+
* Default checked Radio
|
|
33
33
|
*/
|
|
34
34
|
defaultValue?: any;
|
|
35
35
|
/**
|
|
36
|
-
* Controlled state for
|
|
36
|
+
* Controlled state for Radio
|
|
37
37
|
*/
|
|
38
38
|
value?: any;
|
|
39
39
|
/**
|
|
40
|
-
* Returns current checked
|
|
40
|
+
* Returns current checked Radio in group
|
|
41
41
|
*/
|
|
42
42
|
onChange?: (value: any) => void;
|
|
43
43
|
/**
|
|
@@ -26,7 +26,7 @@ export interface SearchProps
|
|
|
26
26
|
children?: React.ReactNode;
|
|
27
27
|
/**
|
|
28
28
|
* Search label
|
|
29
|
-
* @
|
|
29
|
+
* @note Will be hidden by default, is required for accessibility reasons.
|
|
30
30
|
*/
|
|
31
31
|
label: React.ReactNode;
|
|
32
32
|
/**
|
|
@@ -53,7 +53,7 @@ export interface SearchProps
|
|
|
53
53
|
*/
|
|
54
54
|
clearButton?: boolean;
|
|
55
55
|
/**
|
|
56
|
-
* Changes button-variant
|
|
56
|
+
* Changes button-variant, "simple" removes button
|
|
57
57
|
* @default "primary"
|
|
58
58
|
*/
|
|
59
59
|
variant?: "primary" | "secondary" | "simple";
|
package/src/form/useFormField.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Helptext as HelpTextIcon } from "@navikt/ds-icons";
|
|
2
|
+
import { Placement } from "@popperjs/core";
|
|
2
3
|
import cl from "classnames";
|
|
3
4
|
import React, { forwardRef, useRef, useState } from "react";
|
|
4
5
|
import mergeRefs from "react-merge-refs";
|
|
@@ -8,9 +9,19 @@ export interface HelpTextProps
|
|
|
8
9
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
9
10
|
Pick<PopoverProps, "strategy" | "placement"> {
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Helptext-dialog content
|
|
12
13
|
*/
|
|
13
14
|
children: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Adds a title-tooltip with the given text
|
|
17
|
+
* @default "hjelp"
|
|
18
|
+
*/
|
|
19
|
+
title?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Default dialog-placement on open
|
|
22
|
+
* @default "top"
|
|
23
|
+
*/
|
|
24
|
+
placement?: Placement;
|
|
14
25
|
}
|
|
15
26
|
|
|
16
27
|
export const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(
|
package/src/loader/Loader.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { useId } from "..";
|
|
|
4
4
|
|
|
5
5
|
export interface LoaderProps extends SVGProps<SVGSVGElement> {
|
|
6
6
|
/**
|
|
7
|
-
* Changes
|
|
7
|
+
* Changes Loader width/height
|
|
8
8
|
* 64px | 40px | 32px | 24px | 20px | 16px
|
|
9
9
|
* @default "medium"
|
|
10
10
|
*/
|
|
@@ -14,12 +14,13 @@ export interface LoaderProps extends SVGProps<SVGSVGElement> {
|
|
|
14
14
|
* @default "venter..."
|
|
15
15
|
*/
|
|
16
16
|
title?: React.ReactNode;
|
|
17
|
-
|
|
18
|
-
*
|
|
17
|
+
/**
|
|
18
|
+
* Sets svg-background to transparent
|
|
19
|
+
* @default false
|
|
19
20
|
*/
|
|
20
21
|
transparent?: boolean;
|
|
21
22
|
/**
|
|
22
|
-
* Colored variants for
|
|
23
|
+
* Colored variants for Loader
|
|
23
24
|
* @default "neutral"
|
|
24
25
|
*/
|
|
25
26
|
variant?: "neutral" | "interaction" | "inverted";
|
package/src/modal/Modal.tsx
CHANGED
|
@@ -16,11 +16,11 @@ export interface ModalProps {
|
|
|
16
16
|
*/
|
|
17
17
|
open: boolean;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Callback for modal wanting to close
|
|
20
20
|
*/
|
|
21
21
|
onClose: () => void;
|
|
22
22
|
/**
|
|
23
|
-
* If modal should close on overlay click
|
|
23
|
+
* If modal should close on overlay click (click outside Modal)
|
|
24
24
|
* @default true
|
|
25
25
|
*/
|
|
26
26
|
shouldCloseOnOverlayClick?: boolean;
|
|
@@ -29,12 +29,12 @@ export interface ModalProps {
|
|
|
29
29
|
*/
|
|
30
30
|
className?: string;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Removes close-button(X) when false
|
|
33
33
|
* @default true
|
|
34
34
|
*/
|
|
35
35
|
closeButton?: boolean;
|
|
36
36
|
/**
|
|
37
|
-
* Callback for
|
|
37
|
+
* Callback for setting parent element modal will attach to
|
|
38
38
|
*/
|
|
39
39
|
parentSelector?(): HTMLElement;
|
|
40
40
|
"aria-labelledby"?: string;
|
package/src/panel/Panel.tsx
CHANGED
package/src/popover/Popover.tsx
CHANGED
|
@@ -13,6 +13,10 @@ import { useClientLayoutEffect } from "..";
|
|
|
13
13
|
import PopoverContent, { PopoverContentType } from "./PopoverContent";
|
|
14
14
|
|
|
15
15
|
export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
16
|
+
/**
|
|
17
|
+
* Popover content
|
|
18
|
+
*/
|
|
19
|
+
children: React.ReactNode;
|
|
16
20
|
/**
|
|
17
21
|
* Element popover anchors to
|
|
18
22
|
*/
|
|
@@ -25,18 +29,15 @@ export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
25
29
|
* onClose callback
|
|
26
30
|
*/
|
|
27
31
|
onClose: () => void;
|
|
28
|
-
/**
|
|
29
|
-
* Popover content
|
|
30
|
-
*/
|
|
31
|
-
children: React.ReactNode;
|
|
32
32
|
/**
|
|
33
33
|
* Orientation for popover
|
|
34
|
+
* @note Try to keep general usage to "top", "bottom", "left", "right"
|
|
34
35
|
* @default "right"
|
|
35
36
|
*/
|
|
36
37
|
placement?: Placement;
|
|
37
38
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
39
|
+
* Adds a arrow from dialog to anchor when true
|
|
40
|
+
* @default true
|
|
40
41
|
*/
|
|
41
42
|
arrow?: boolean;
|
|
42
43
|
/**
|
|
@@ -4,7 +4,7 @@ import Bubble, { BubbleType } from "./Bubble";
|
|
|
4
4
|
|
|
5
5
|
export interface SpeechBubbleProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
6
|
/**
|
|
7
|
-
* Children of type <Bubble />
|
|
7
|
+
* Children of type <SpeechBubble.Bubble />
|
|
8
8
|
*/
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
/**
|
|
@@ -12,11 +12,11 @@ export interface SpeechBubbleProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
12
12
|
*/
|
|
13
13
|
topText?: React.ReactNode;
|
|
14
14
|
/**
|
|
15
|
-
* Illustration for messenger
|
|
15
|
+
* Illustration for messenger. Regular text for initials works to
|
|
16
16
|
*/
|
|
17
17
|
illustration: React.ReactNode;
|
|
18
18
|
/**
|
|
19
|
-
* Background color bubbles
|
|
19
|
+
* Background color on bubbles
|
|
20
20
|
*/
|
|
21
21
|
backgroundColor?: string;
|
|
22
22
|
/**
|
|
@@ -11,10 +11,12 @@ export interface StepIndicatorStepProps
|
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
/**
|
|
13
13
|
* Disables interaction with element
|
|
14
|
+
* @note We recommend not using disabled if possible
|
|
14
15
|
*/
|
|
15
16
|
disabled?: boolean;
|
|
16
17
|
/**
|
|
17
18
|
* Handled by StepIndicator
|
|
19
|
+
* @private
|
|
18
20
|
*/
|
|
19
21
|
index?: number;
|
|
20
22
|
}
|
package/src/stepper/Step.tsx
CHANGED
|
@@ -6,11 +6,12 @@ import { Label, OverridableComponent } from "..";
|
|
|
6
6
|
export interface StepperStepProps
|
|
7
7
|
extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
8
8
|
/**
|
|
9
|
-
* Text content
|
|
9
|
+
* Text content by indicator
|
|
10
10
|
*/
|
|
11
11
|
children: string;
|
|
12
12
|
/**
|
|
13
13
|
* Handled by Stepper
|
|
14
|
+
* @private
|
|
14
15
|
*/
|
|
15
16
|
index?: number;
|
|
16
17
|
}
|
package/src/table/DataCell.tsx
CHANGED
package/src/table/HeaderCell.tsx
CHANGED
package/src/tabs/Tab.tsx
CHANGED
|
@@ -7,11 +7,11 @@ import { TabsContext } from "./Tabs";
|
|
|
7
7
|
export interface TabProps
|
|
8
8
|
extends Omit<React.HTMLAttributes<HTMLButtonElement>, "children"> {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Tab label
|
|
11
11
|
*/
|
|
12
12
|
label?: React.ReactNode;
|
|
13
13
|
/**
|
|
14
|
-
* Icon
|
|
14
|
+
* Tab Icon
|
|
15
15
|
*/
|
|
16
16
|
icon?: React.ReactNode;
|
|
17
17
|
/**
|
package/src/tabs/TabList.tsx
CHANGED
package/src/tabs/TabPanel.tsx
CHANGED
package/src/tabs/Tabs.tsx
CHANGED
|
@@ -7,9 +7,6 @@ import TabPanel, { TabPanelType } from "./TabPanel";
|
|
|
7
7
|
|
|
8
8
|
export interface TabsProps
|
|
9
9
|
extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "dir"> {
|
|
10
|
-
/**
|
|
11
|
-
* Tabs elements
|
|
12
|
-
*/
|
|
13
10
|
children: React.ReactNode;
|
|
14
11
|
/**
|
|
15
12
|
* Changes padding and font-size
|
|
@@ -17,7 +14,7 @@ export interface TabsProps
|
|
|
17
14
|
*/
|
|
18
15
|
size?: "medium" | "small";
|
|
19
16
|
/**
|
|
20
|
-
* onChange
|
|
17
|
+
* onChange callback for selected Tab
|
|
21
18
|
*/
|
|
22
19
|
onChange?: (value: string) => void;
|
|
23
20
|
/**
|
package/src/tag/Tag.tsx
CHANGED
|
@@ -4,16 +4,15 @@ import { BodyShort, Detail } from "..";
|
|
|
4
4
|
|
|
5
5
|
export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
6
6
|
/**
|
|
7
|
-
* Tag
|
|
7
|
+
* Tag label
|
|
8
8
|
*/
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
/**
|
|
11
|
-
* Changes background
|
|
12
|
-
*
|
|
11
|
+
* Changes background and border color
|
|
13
12
|
*/
|
|
14
13
|
variant: "warning" | "error" | "info" | "success";
|
|
15
14
|
/**
|
|
16
|
-
* Changes
|
|
15
|
+
* Changes padding and font-sizes
|
|
17
16
|
* @default "medium"
|
|
18
17
|
*/
|
|
19
18
|
size?: "medium" | "small";
|
package/src/tooltip/Tooltip.tsx
CHANGED
|
@@ -25,6 +25,7 @@ import { useId } from "../util";
|
|
|
25
25
|
export interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
|
|
26
26
|
/**
|
|
27
27
|
* Element tooltip anchors to
|
|
28
|
+
* @note Needs to be React.ReactElement, does not support multiple children/react fragment
|
|
28
29
|
*/
|
|
29
30
|
children: React.ReactElement & React.RefAttributes<HTMLElement>;
|
|
30
31
|
/**
|
|
@@ -32,7 +33,8 @@ export interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
32
33
|
*/
|
|
33
34
|
open?: boolean;
|
|
34
35
|
/**
|
|
35
|
-
* Tells tooltip to start in open state
|
|
36
|
+
* Tells tooltip to start in open state.
|
|
37
|
+
* Use sparingly synce hover/focus on other elements will close it
|
|
36
38
|
* @note "open"-prop overwrites this
|
|
37
39
|
*/
|
|
38
40
|
defaultOpen?: boolean;
|
|
@@ -42,8 +44,8 @@ export interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
42
44
|
*/
|
|
43
45
|
placement?: "top" | "right" | "bottom" | "left";
|
|
44
46
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
+
* Toggles rendering of arrow
|
|
48
|
+
* @default true
|
|
47
49
|
*/
|
|
48
50
|
arrow?: boolean;
|
|
49
51
|
/**
|
|
@@ -52,17 +54,17 @@ export interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
52
54
|
*/
|
|
53
55
|
offset?: number;
|
|
54
56
|
/**
|
|
55
|
-
*
|
|
57
|
+
* Text-content inside tooltip
|
|
56
58
|
*/
|
|
57
59
|
content: string;
|
|
58
60
|
/**
|
|
59
|
-
* Sets max allowed character length
|
|
61
|
+
* Sets max allowed character length.
|
|
60
62
|
* @default 80
|
|
61
63
|
*/
|
|
62
64
|
maxChar?: number;
|
|
63
65
|
/**
|
|
64
66
|
* Adds a delay in milliseconds before opening tooltip
|
|
65
|
-
* @default
|
|
67
|
+
* @default 150
|
|
66
68
|
*/
|
|
67
69
|
delay?: number;
|
|
68
70
|
/**
|
|
@@ -9,7 +9,7 @@ export interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
|
9
9
|
*/
|
|
10
10
|
level?: "1" | "2" | "3" | "4" | "5" | "6";
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Changes text-sizing
|
|
13
13
|
*/
|
|
14
14
|
size: "xlarge" | "large" | "medium" | "small" | "xsmall";
|
|
15
15
|
/**
|
|
@@ -17,7 +17,7 @@ export interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
|
17
17
|
*/
|
|
18
18
|
children: React.ReactNode;
|
|
19
19
|
/**
|
|
20
|
-
* Adds
|
|
20
|
+
* Adds margin-bottom
|
|
21
21
|
* @default false
|
|
22
22
|
*/
|
|
23
23
|
spacing?: boolean;
|