@navikt/ds-react 2.1.6 → 2.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/README.md +4 -5
- package/_docs.json +316 -295
- package/cjs/accordion/AccordionContent.js +2 -2
- package/cjs/accordion/AccordionHeader.js +2 -2
- package/cjs/alert/Alert.js +2 -2
- package/cjs/chat/Chat.js +3 -3
- package/cjs/date/hooks/useRangeDatepicker.js +1 -1
- package/cjs/toggle-group/ToggleGroup.js +2 -2
- package/esm/accordion/AccordionContent.js +1 -1
- package/esm/accordion/AccordionContent.js.map +1 -1
- package/esm/accordion/AccordionHeader.js +1 -1
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/accordion/index.d.ts +1 -1
- package/esm/accordion/index.js.map +1 -1
- package/esm/alert/Alert.js +1 -1
- package/esm/alert/Alert.js.map +1 -1
- package/esm/alert/index.d.ts +1 -1
- package/esm/button/Button.d.ts +1 -1
- package/esm/button/Button.js.map +1 -1
- package/esm/button/index.d.ts +1 -1
- package/esm/chat/Chat.js +1 -1
- package/esm/chat/Chat.js.map +1 -1
- package/esm/chat/index.d.ts +1 -1
- package/esm/chat/index.js.map +1 -1
- package/esm/chips/Removable.d.ts +1 -1
- package/esm/chips/Toggle.d.ts +1 -1
- package/esm/chips/index.d.ts +1 -1
- package/esm/chips/index.js.map +1 -1
- package/esm/date/hooks/useRangeDatepicker.js +1 -1
- package/esm/date/hooks/useRangeDatepicker.js.map +1 -1
- package/esm/date/index.d.ts +6 -6
- package/esm/date/utils/index.d.ts +1 -1
- package/esm/date/utils/index.js.map +1 -1
- package/esm/form/Fieldset/index.d.ts +1 -1
- package/esm/form/checkbox/index.d.ts +2 -2
- package/esm/form/checkbox/index.js +1 -1
- package/esm/form/checkbox/index.js.map +1 -1
- package/esm/form/error-summary/index.d.ts +1 -1
- package/esm/form/index.d.ts +10 -10
- package/esm/form/index.js +1 -1
- package/esm/form/index.js.map +1 -1
- package/esm/form/radio/index.d.ts +2 -2
- package/esm/form/radio/index.js.map +1 -1
- package/esm/form/search/index.d.ts +1 -1
- package/esm/form/search/index.js +1 -1
- package/esm/form/search/index.js.map +1 -1
- package/esm/grid/index.d.ts +3 -3
- package/esm/grid/index.js.map +1 -1
- package/esm/guide-panel/index.d.ts +2 -2
- package/esm/guide-panel/index.js.map +1 -1
- package/esm/help-text/index.d.ts +1 -1
- package/esm/link/Link.d.ts +1 -1
- package/esm/link/index.d.ts +1 -1
- package/esm/link-panel/LinkPanelTitle.d.ts +1 -1
- package/esm/link-panel/index.d.ts +1 -1
- package/esm/loader/index.d.ts +1 -1
- package/esm/modal/index.d.ts +2 -2
- package/esm/modal/index.js.map +1 -1
- package/esm/pagination/index.d.ts +1 -1
- package/esm/pagination/index.js.map +1 -1
- package/esm/panel/Panel.d.ts +1 -1
- package/esm/panel/index.d.ts +1 -1
- package/esm/popover/index.d.ts +2 -2
- package/esm/popover/index.js.map +1 -1
- package/esm/read-more/index.d.ts +1 -1
- package/esm/stepper/index.d.ts +1 -1
- package/esm/stepper/index.js.map +1 -1
- package/esm/table/index.d.ts +8 -8
- package/esm/table/index.js.map +1 -1
- package/esm/tabs/index.d.ts +4 -4
- package/esm/tabs/index.js.map +1 -1
- package/esm/tag/index.d.ts +1 -1
- package/esm/tag/index.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.d.ts +5 -0
- package/esm/toggle-group/ToggleGroup.js +2 -2
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/toggle-group/index.d.ts +2 -2
- package/esm/toggle-group/index.js.map +1 -1
- package/esm/tooltip/index.d.ts +1 -1
- package/esm/tooltip/index.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/ErrorMessage.d.ts +1 -1
- package/esm/typography/Heading.d.ts +1 -1
- package/esm/typography/Ingress.d.ts +1 -1
- package/esm/typography/Label.d.ts +1 -1
- package/esm/typography/index.d.ts +7 -7
- package/esm/typography/index.js +1 -1
- package/esm/typography/index.js.map +1 -1
- package/package.json +3 -3
- package/src/accordion/AccordionContent.tsx +1 -1
- package/src/accordion/AccordionHeader.tsx +1 -1
- package/src/accordion/accordion.stories.tsx +16 -14
- package/src/accordion/index.ts +1 -1
- package/src/alert/Alert.tsx +1 -1
- package/src/alert/alert.stories.tsx +48 -28
- package/src/alert/index.ts +1 -1
- package/src/button/Button.tsx +8 -1
- package/src/button/button.stories.tsx +118 -84
- package/src/button/index.ts +1 -1
- package/src/chat/Chat.tsx +1 -1
- package/src/chat/chat.stories.tsx +27 -25
- package/src/chat/index.ts +1 -1
- package/src/chips/Removable.tsx +1 -1
- package/src/chips/Toggle.tsx +1 -1
- package/src/chips/chips.stories.tsx +32 -29
- package/src/chips/index.ts +1 -1
- package/src/date/datepicker/datepicker.stories.tsx +87 -81
- package/src/date/hooks/useRangeDatepicker.tsx +1 -1
- package/src/date/index.ts +8 -8
- package/src/date/monthpicker/monthpicker.stories.tsx +13 -11
- package/src/date/utils/index.ts +1 -1
- package/src/form/Fieldset/index.ts +1 -1
- package/src/form/checkbox/checkbox.stories.tsx +66 -61
- package/src/form/checkbox/index.ts +5 -2
- package/src/form/error-summary/error-summary.stories.tsx +16 -14
- package/src/form/error-summary/index.ts +1 -1
- package/src/form/index.ts +16 -11
- package/src/form/radio/index.ts +2 -2
- package/src/form/radio/radio.stories.tsx +39 -34
- package/src/form/search/index.ts +5 -1
- package/src/form/search/search.stories.tsx +26 -23
- package/src/form/stories/confirmation-panel.stories.tsx +19 -17
- package/src/form/stories/fieldset.stories.tsx +13 -11
- package/src/form/stories/select.stories.tsx +12 -10
- package/src/form/stories/switch.stories.tsx +9 -7
- package/src/form/stories/text-field.stories.tsx +8 -6
- package/src/form/stories/textarea.stories.tsx +16 -14
- package/src/grid/index.ts +3 -3
- package/src/guide-panel/guidepanel.stories.tsx +21 -19
- package/src/guide-panel/index.ts +2 -2
- package/src/help-text/help-text.stories.tsx +11 -9
- package/src/help-text/index.ts +1 -1
- package/src/link/Link.tsx +1 -1
- package/src/link/index.ts +1 -1
- package/src/link/link.stories.tsx +24 -22
- package/src/link-panel/LinkPanelTitle.tsx +1 -1
- package/src/link-panel/index.ts +1 -1
- package/src/link-panel/link-panel.stories.tsx +19 -17
- package/src/loader/index.ts +1 -1
- package/src/loader/loader.stories.tsx +8 -6
- package/src/modal/index.ts +2 -2
- package/src/modal/modal.stories.tsx +35 -30
- package/src/pagination/index.ts +1 -1
- package/src/pagination/pagination.stories.tsx +41 -36
- package/src/panel/Panel.tsx +1 -1
- package/src/panel/index.ts +1 -1
- package/src/panel/panel.stories.tsx +17 -15
- package/src/popover/index.ts +2 -2
- package/src/popover/popover.stories.tsx +25 -19
- package/src/read-more/index.ts +1 -1
- package/src/read-more/readmore.stories.tsx +20 -17
- package/src/stepper/index.ts +1 -1
- package/src/stepper/stepper.stories.tsx +44 -41
- package/src/table/index.ts +8 -8
- package/src/tabs/Tabs.stories.tsx +24 -22
- package/src/tabs/index.ts +4 -4
- package/src/tag/index.ts +1 -1
- package/src/tag/tag.stories.tsx +10 -7
- package/src/toggle-group/ToggleGroup.stories.tsx +50 -18
- package/src/toggle-group/ToggleGroup.tsx +11 -1
- package/src/toggle-group/index.ts +2 -2
- package/src/tooltip/index.ts +1 -1
- package/src/tooltip/tooltip.stories.tsx +22 -20
- package/src/typography/BodyLong.tsx +1 -1
- package/src/typography/BodyShort.tsx +1 -1
- package/src/typography/Detail.tsx +1 -1
- package/src/typography/ErrorMessage.tsx +1 -1
- package/src/typography/Heading.tsx +1 -1
- package/src/typography/Ingress.tsx +1 -1
- package/src/typography/Label.tsx +1 -1
- package/src/typography/heading.stories.tsx +5 -3
- package/src/typography/index.ts +10 -7
- package/src/typography/typography.stories.tsx +0 -44
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
1
2
|
import React, { useState } from "react";
|
|
2
3
|
import { ReadMore } from ".";
|
|
3
4
|
|
|
@@ -14,25 +15,27 @@ export default {
|
|
|
14
15
|
},
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
export const Default =
|
|
18
|
-
|
|
18
|
+
export const Default = {
|
|
19
|
+
render: (props) => {
|
|
20
|
+
const [state, setState] = useState(false);
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
22
|
+
return (
|
|
23
|
+
<ReadMore
|
|
24
|
+
open={props.controlled ? state : undefined}
|
|
25
|
+
onClick={() => setState((x) => !x)}
|
|
26
|
+
header="Grunnen til at vi spør om dette og i tillegg ber om vedlegg"
|
|
27
|
+
size={props.size}
|
|
28
|
+
>
|
|
29
|
+
Command station, this is ST 321. Code Clearance Blue. We're starting our
|
|
30
|
+
approach. Deactivate the security shield.
|
|
31
|
+
</ReadMore>
|
|
32
|
+
);
|
|
33
|
+
},
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
args: {
|
|
36
|
+
controlled: false,
|
|
37
|
+
size: "medium",
|
|
38
|
+
},
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
export const Small = () => (
|
package/src/stepper/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Stepper, StepperProps } from "./Stepper";
|
|
1
|
+
export { default as Stepper, type StepperProps } from "./Stepper";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
+
import { Meta } from "@storybook/react";
|
|
2
3
|
import React, { useState } from "react";
|
|
3
4
|
import { BodyLong } from "..";
|
|
4
5
|
import Stepper from "./Stepper";
|
|
@@ -31,49 +32,51 @@ const storyTexts = [
|
|
|
31
32
|
"Move the needle a loss a day will keep you focus yet can you put it into a banner that is not alarming, but eye catching and not too giant or strategic fit, nor it is all exactly as i said, but i don't like it or streamline. We've bootstrapped the model. This proposal is a win-win situation which will cause a stellar paradigm shift, and produce a multi-fold increase in deliverables the horse is out of the barn usabiltiy, for going forward but going forward.",
|
|
32
33
|
];
|
|
33
34
|
|
|
34
|
-
export const Default =
|
|
35
|
-
|
|
35
|
+
export const Default = {
|
|
36
|
+
render: ({ asButton, ...props }) => {
|
|
37
|
+
const [activeStep, setActiveStep] = useState(1);
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const newProps = {
|
|
40
|
+
onClick: (e) => e.preventDefault(),
|
|
41
|
+
...(asButton ? { as: "button" } : { href: "#" }),
|
|
42
|
+
};
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
44
|
+
return (
|
|
45
|
+
<div style={{ display: "flex", gap: "10rem", flexDirection: "column" }}>
|
|
46
|
+
<Stepper
|
|
47
|
+
aria-labelledby="stepper-heading"
|
|
48
|
+
activeStep={activeStep}
|
|
49
|
+
onStepChange={setActiveStep}
|
|
50
|
+
orientation="vertical"
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
<Stepper.Step {...newProps} completed={props.completed}>
|
|
54
|
+
Start søknad
|
|
55
|
+
</Stepper.Step>
|
|
56
|
+
<Stepper.Step {...newProps}>Personopplysninger</Stepper.Step>
|
|
57
|
+
<Stepper.Step {...newProps} completed={props.completed}>
|
|
58
|
+
Saksopplysninger
|
|
59
|
+
</Stepper.Step>
|
|
60
|
+
<Stepper.Step {...newProps} completed={props.completed}>
|
|
61
|
+
Søknadstekst for en veldig spesifikk prosess i NAV som må beskrives
|
|
62
|
+
og forklares i sitt fulle i denne labelen
|
|
63
|
+
</Stepper.Step>
|
|
64
|
+
<Stepper.Step {...newProps}>Vedlegg</Stepper.Step>
|
|
65
|
+
<Stepper.Step {...newProps}>Oppsummering</Stepper.Step>
|
|
66
|
+
<Stepper.Step {...newProps}>Innsending</Stepper.Step>
|
|
67
|
+
</Stepper>
|
|
68
|
+
<BodyLong style={{ marginTop: "5rem" }}>
|
|
69
|
+
{storyTexts[activeStep]}
|
|
70
|
+
</BodyLong>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
},
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
args: {
|
|
76
|
+
asButton: false,
|
|
77
|
+
interactive: true,
|
|
78
|
+
completed: false,
|
|
79
|
+
},
|
|
77
80
|
};
|
|
78
81
|
|
|
79
82
|
export const Horizontal = () => {
|
package/src/table/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
1
|
+
export { default as Table, type TableProps, type SortState } from "./Table";
|
|
2
|
+
export { type BodyProps } from "./Body";
|
|
3
|
+
export { type ColumnHeaderProps } from "./ColumnHeader";
|
|
4
|
+
export { type DataCellProps } from "./DataCell";
|
|
5
|
+
export { type ExpandableRowProps } from "./ExpandableRow";
|
|
6
|
+
export { type HeaderProps } from "./Header";
|
|
7
|
+
export { type HeaderCellProps } from "./HeaderCell";
|
|
8
|
+
export { type RowProps } from "./Row";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Cup, Dishwasher, Freezer } from "@navikt/ds-icons";
|
|
2
|
-
import { Meta } from "@storybook/react
|
|
2
|
+
import { Meta } from "@storybook/react";
|
|
3
3
|
import React, { useState } from "react";
|
|
4
4
|
import { Tabs } from ".";
|
|
5
5
|
|
|
@@ -54,28 +54,30 @@ const Panel = () => {
|
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
export const Default =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<Tabs.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
57
|
+
export const Default = {
|
|
58
|
+
render: (props) => {
|
|
59
|
+
return (
|
|
60
|
+
<Tabs
|
|
61
|
+
defaultValue="test2"
|
|
62
|
+
size={props?.size}
|
|
63
|
+
selectionFollowsFocus={props?.selectionFollowsFocus}
|
|
64
|
+
loop={props?.loop}
|
|
65
|
+
iconPosition={props?.iconPosition}
|
|
66
|
+
>
|
|
67
|
+
<Tabs.List>
|
|
68
|
+
<Tabs.Tab value="test1" icon={<Cup />} label="Skap" />
|
|
69
|
+
<Tabs.Tab value="test2" label="Oppvaskmaskin" icon={<Dishwasher />} />
|
|
70
|
+
<Tabs.Tab value="test3" icon={<Freezer />} label="Fryser" />
|
|
71
|
+
</Tabs.List>
|
|
72
|
+
<Panel />
|
|
73
|
+
</Tabs>
|
|
74
|
+
);
|
|
75
|
+
},
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
args: {
|
|
78
|
+
selectionFollowsFocus: false,
|
|
79
|
+
loop: false,
|
|
80
|
+
},
|
|
79
81
|
};
|
|
80
82
|
|
|
81
83
|
export const Small = () => {
|
package/src/tabs/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export { default as Tabs, type TabsProps } from "./Tabs";
|
|
2
|
+
export { type TabProps } from "./Tab";
|
|
3
|
+
export { type TabListProps } from "./TabList";
|
|
4
|
+
export { type TabPanelProps } from "./TabPanel";
|
package/src/tag/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Tag, TagProps } from "./Tag";
|
|
1
|
+
export { default as Tag, type TagProps } from "./Tag";
|
package/src/tag/tag.stories.tsx
CHANGED
|
@@ -75,14 +75,17 @@ const variants: Array<
|
|
|
75
75
|
"alt3-filled",
|
|
76
76
|
];
|
|
77
77
|
|
|
78
|
-
export const Default =
|
|
79
|
-
|
|
80
|
-
{props.
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
export const Default = {
|
|
79
|
+
render: (props) => (
|
|
80
|
+
<Tag variant={props.variant} size={props.size}>
|
|
81
|
+
{props.children}
|
|
82
|
+
</Tag>
|
|
83
|
+
),
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
args: {
|
|
86
|
+
children: "Id elit esse",
|
|
87
|
+
variant: "info",
|
|
88
|
+
},
|
|
86
89
|
};
|
|
87
90
|
|
|
88
91
|
export const Small = () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
1
2
|
import { Email, EmailOpened, Send } from "@navikt/ds-icons";
|
|
2
|
-
import { Meta } from "@storybook/react
|
|
3
|
+
import { Meta } from "@storybook/react";
|
|
3
4
|
import React, { useState } from "react";
|
|
4
5
|
import { ToggleGroup } from "../index";
|
|
5
6
|
export default {
|
|
@@ -12,6 +13,12 @@ export default {
|
|
|
12
13
|
options: ["medium", "small"],
|
|
13
14
|
},
|
|
14
15
|
},
|
|
16
|
+
variant: {
|
|
17
|
+
control: {
|
|
18
|
+
type: "radio",
|
|
19
|
+
options: ["action", "neutral"],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
15
22
|
},
|
|
16
23
|
} as Meta;
|
|
17
24
|
|
|
@@ -47,24 +54,26 @@ const Items = (icon?: boolean, both?: boolean) => (
|
|
|
47
54
|
</>
|
|
48
55
|
);
|
|
49
56
|
|
|
50
|
-
export const Default =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
export const Default = {
|
|
58
|
+
render: (props) => {
|
|
59
|
+
const [activeValue, setActiveValue] = useState("ulest");
|
|
60
|
+
return (
|
|
61
|
+
<ToggleGroup
|
|
62
|
+
size={props?.size}
|
|
63
|
+
value={activeValue}
|
|
64
|
+
onChange={setActiveValue}
|
|
65
|
+
label={props.label ? "Proident minim dolor pariatur." : undefined}
|
|
66
|
+
>
|
|
67
|
+
{Items(!!props?.icon, !!props?.text && props.icon)}
|
|
68
|
+
</ToggleGroup>
|
|
69
|
+
);
|
|
70
|
+
},
|
|
63
71
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
args: {
|
|
73
|
+
icon: true,
|
|
74
|
+
text: true,
|
|
75
|
+
label: false,
|
|
76
|
+
},
|
|
68
77
|
};
|
|
69
78
|
|
|
70
79
|
export const Compositions = () => {
|
|
@@ -85,6 +94,29 @@ export const Compositions = () => {
|
|
|
85
94
|
);
|
|
86
95
|
};
|
|
87
96
|
|
|
97
|
+
export const Variants = () => {
|
|
98
|
+
const [activeValue, setActiveValue] = useState("ulest");
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div className="colgap">
|
|
102
|
+
<ToggleGroup
|
|
103
|
+
variant="action"
|
|
104
|
+
value={activeValue}
|
|
105
|
+
onChange={setActiveValue}
|
|
106
|
+
>
|
|
107
|
+
{Items(true, true)}
|
|
108
|
+
</ToggleGroup>
|
|
109
|
+
<ToggleGroup
|
|
110
|
+
variant="neutral"
|
|
111
|
+
value={activeValue}
|
|
112
|
+
onChange={setActiveValue}
|
|
113
|
+
>
|
|
114
|
+
{Items(true, true)}
|
|
115
|
+
</ToggleGroup>
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
88
120
|
export const Small = () => {
|
|
89
121
|
const [activeValue, setActiveValue] = useState("ulest");
|
|
90
122
|
|
|
@@ -36,6 +36,11 @@ export interface ToggleGroupProps
|
|
|
36
36
|
* Label describing ToggleGroup
|
|
37
37
|
*/
|
|
38
38
|
label?: React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Changes design and interaction-visuals
|
|
41
|
+
* @default "action"
|
|
42
|
+
*/
|
|
43
|
+
variant?: "action" | "neutral";
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
interface ToggleGroupComponent
|
|
@@ -65,6 +70,7 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
|
65
70
|
defaultValue,
|
|
66
71
|
id,
|
|
67
72
|
"aria-describedby": desc,
|
|
73
|
+
variant = "action",
|
|
68
74
|
...rest
|
|
69
75
|
},
|
|
70
76
|
ref
|
|
@@ -114,7 +120,11 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
|
114
120
|
value={value ?? groupValue}
|
|
115
121
|
defaultValue={defaultValue}
|
|
116
122
|
ref={ref}
|
|
117
|
-
className={cl(
|
|
123
|
+
className={cl(
|
|
124
|
+
"navds-toggle-group",
|
|
125
|
+
`navds-toggle-group--${size}`,
|
|
126
|
+
`navds-toggle-group--${variant}`
|
|
127
|
+
)}
|
|
118
128
|
{...(describeBy && { "aria-describedby": describeBy })}
|
|
119
129
|
role="radiogroup"
|
|
120
130
|
type="single"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as ToggleGroup, ToggleGroupProps } from "./ToggleGroup";
|
|
2
|
-
export { ToggleItemProps } from "./ToggleItem";
|
|
1
|
+
export { default as ToggleGroup, type ToggleGroupProps } from "./ToggleGroup";
|
|
2
|
+
export { type ToggleItemProps } from "./ToggleItem";
|
package/src/tooltip/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Tooltip, TooltipProps } from "./Tooltip";
|
|
1
|
+
export { default as Tooltip, type TooltipProps } from "./Tooltip";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta } from "@storybook/react
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Tooltip, Alert, Button, Search } from "..";
|
|
4
4
|
|
|
@@ -42,26 +42,28 @@ export const Demo = () => (
|
|
|
42
42
|
</div>
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
export const Default =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
export const Default = {
|
|
46
|
+
render: (props) => {
|
|
47
|
+
return (
|
|
48
|
+
<Tooltip
|
|
49
|
+
content="Tooltip example"
|
|
50
|
+
open={props?.open}
|
|
51
|
+
keys={props?.keys ? ["Cmd", "K"] : undefined}
|
|
52
|
+
placement={props?.placement}
|
|
53
|
+
arrow={props?.arrow}
|
|
54
|
+
delay={props?.delay}
|
|
55
|
+
offset={props?.offset}
|
|
56
|
+
>
|
|
57
|
+
<Button aria-describedby="test123">Tooltip</Button>
|
|
58
|
+
</Tooltip>
|
|
59
|
+
);
|
|
60
|
+
},
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
args: {
|
|
63
|
+
keys: false,
|
|
64
|
+
arrow: true,
|
|
65
|
+
delay: 150,
|
|
66
|
+
},
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
export const Placement = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import { OverridableComponent } from "
|
|
3
|
+
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
4
|
|
|
5
5
|
export interface BodyLongProps
|
|
6
6
|
extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import { OverridableComponent } from "
|
|
3
|
+
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
4
|
|
|
5
5
|
export interface BodyShortProps
|
|
6
6
|
extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import { OverridableComponent } from "
|
|
3
|
+
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
4
|
|
|
5
5
|
export interface DetailProps
|
|
6
6
|
extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import { OverridableComponent } from "
|
|
3
|
+
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
4
|
|
|
5
5
|
export interface ErrorMessageProps
|
|
6
6
|
extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import { OverridableComponent } from "
|
|
3
|
+
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
4
|
|
|
5
5
|
export interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import { OverridableComponent } from "
|
|
3
|
+
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
4
|
|
|
5
5
|
export interface IngressProps
|
|
6
6
|
extends React.HTMLAttributes<HTMLParagraphElement> {
|
package/src/typography/Label.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import { OverridableComponent } from "
|
|
3
|
+
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
4
|
|
|
5
5
|
export interface LabelProps
|
|
6
6
|
extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
@@ -25,10 +25,12 @@ export default {
|
|
|
25
25
|
|
|
26
26
|
const lorem = "Veniam consequat cillum";
|
|
27
27
|
|
|
28
|
-
export const Default =
|
|
28
|
+
export const Default = {
|
|
29
|
+
render: (props) => <Heading {...props}>{lorem}</Heading>,
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
args: {
|
|
32
|
+
spacing: false,
|
|
33
|
+
},
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
export const Sizes = () => (
|
package/src/typography/index.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export { BodyLongProps, default as BodyLong } from "./BodyLong";
|
|
2
|
-
export { BodyShortProps, default as BodyShort } from "./BodyShort";
|
|
3
|
-
export { default as Detail, DetailProps } from "./Detail";
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export { type BodyLongProps, default as BodyLong } from "./BodyLong";
|
|
2
|
+
export { type BodyShortProps, default as BodyShort } from "./BodyShort";
|
|
3
|
+
export { default as Detail, type DetailProps } from "./Detail";
|
|
4
|
+
export {
|
|
5
|
+
default as ErrorMessage,
|
|
6
|
+
type ErrorMessageProps,
|
|
7
|
+
} from "./ErrorMessage";
|
|
8
|
+
export { default as Heading, type HeadingProps } from "./Heading";
|
|
9
|
+
export { default as Ingress, type IngressProps } from "./Ingress";
|
|
10
|
+
export { default as Label, type LabelProps } from "./Label";
|
|
@@ -19,52 +19,8 @@ export default {
|
|
|
19
19
|
DsIngress,
|
|
20
20
|
DsLabel,
|
|
21
21
|
},
|
|
22
|
-
argTypes: {
|
|
23
|
-
size: {
|
|
24
|
-
defaultValue: "large",
|
|
25
|
-
control: {
|
|
26
|
-
type: "radio",
|
|
27
|
-
options: ["medium", "small"],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
component: {
|
|
31
|
-
defaultValue: "BodyLong",
|
|
32
|
-
control: {
|
|
33
|
-
type: "radio",
|
|
34
|
-
options: [
|
|
35
|
-
"BodyLong",
|
|
36
|
-
"BodyShort",
|
|
37
|
-
"Detail",
|
|
38
|
-
"Ingress",
|
|
39
|
-
"Label",
|
|
40
|
-
"ErrorMessage",
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
22
|
} as Meta;
|
|
46
23
|
|
|
47
|
-
const lorem =
|
|
48
|
-
"Velit quis in laborum occaecat laborum magna id nisi veniam aliqua velit amet non. In quis sit proident dolore reprehenderit laborum aliquip";
|
|
49
|
-
|
|
50
|
-
const compMap = {
|
|
51
|
-
BodyLong: DsBodyLong,
|
|
52
|
-
BodyShort: DsBodyShort,
|
|
53
|
-
Detail: DsDetail,
|
|
54
|
-
Ingress: DsIngress,
|
|
55
|
-
Label: DsLabel,
|
|
56
|
-
ErrorMessage: DsErrorMessage,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const Default = (props) => {
|
|
60
|
-
const Comp = compMap[props.component];
|
|
61
|
-
return <Comp {...props}>{lorem}</Comp>;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
Default.args = {
|
|
65
|
-
spacing: false,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
24
|
export const Ingress = () => (
|
|
69
25
|
<>
|
|
70
26
|
<DsIngress spacing>
|