@navikt/ds-react 5.5.0 → 5.6.0-beta.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/_docs.json +446 -888
- package/cjs/accordion/AccordionItem.js +3 -2
- package/cjs/date/datepicker/DatePickerStandalone.js +2 -2
- package/cjs/date/hooks/useDatepicker.js +2 -2
- package/cjs/date/hooks/useMonthPicker.js +2 -2
- package/cjs/date/hooks/useRangeDatepicker.js +3 -3
- package/cjs/date/monthpicker/MonthSelector.js +1 -1
- package/cjs/dropdown/Toggle.js +2 -2
- package/cjs/dropdown/index.js +0 -15
- package/cjs/form/Select.js +1 -1
- package/cjs/form/checkbox/useCheckbox.js +3 -4
- package/cjs/form/combobox/Combobox.js +1 -1
- package/cjs/form/combobox/Input/Input.js +1 -1
- package/cjs/form/search/Search.js +3 -1
- package/cjs/layout/bleed/Bleed.js +49 -0
- package/cjs/layout/bleed/index.js +8 -0
- package/cjs/layout/bleed/package.json +6 -0
- package/cjs/layout/content-box/ContentBox.js +56 -0
- package/cjs/layout/content-box/index.js +8 -0
- package/cjs/layout/content-box/package.json +6 -0
- package/cjs/layout/page-demo/AvatarPanel.js +18 -0
- package/cjs/layout/page-demo/Filter.js +21 -0
- package/cjs/layout/page-demo/Header.js +48 -0
- package/cjs/layout/page-demo/Intro.js +36 -0
- package/cjs/layout/page-demo/Sidebar.js +49 -0
- package/cjs/layout/sidemal-test/AvatarPanel.js +18 -0
- package/cjs/layout/sidemal-test/Content.js +66 -0
- package/cjs/layout/sidemal-test/Filter.js +48 -0
- package/cjs/layout/sidemal-test/Header.js +48 -0
- package/cjs/layout/sidemal-test/Intro.js +36 -0
- package/cjs/layout/sidemal-test/Sidebar.js +49 -0
- package/cjs/layout/sidemal-test/content-box/ContentBox.js +65 -0
- package/cjs/layout/sidemal-test/content-box/index.js +8 -0
- package/cjs/layout/sidemal-test/content-box/package.json +6 -0
- package/cjs/layout/stack/Stack.js +2 -2
- package/cjs/layout/stack/index.js +3 -1
- package/cjs/loader/Loader.js +2 -2
- package/cjs/modal/dialog-polyfill.js +2 -0
- package/cjs/popover/Popover.js +3 -2
- package/cjs/tabs/TabList.js +6 -7
- package/cjs/timeline/Pin.js +20 -20
- package/cjs/timeline/Timeline.js +4 -4
- package/cjs/timeline/period/ClickablePeriod.js +19 -19
- package/cjs/timeline/period/index.js +1 -1
- package/cjs/timeline/utils/timeline.js +3 -3
- package/cjs/toggle-group/ToggleGroup.js +1 -1
- package/cjs/tooltip/Tooltip.js +1 -1
- package/cjs/typography/Heading.js +1 -1
- package/cjs/util/RandomIcon.js +1 -0
- package/cjs/util/Slot.js +88 -0
- package/cjs/util/useId.js +2 -4
- package/esm/accordion/AccordionItem.js +3 -2
- package/esm/accordion/AccordionItem.js.map +1 -1
- package/esm/date/datepicker/DatePickerStandalone.js +2 -2
- package/esm/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/esm/date/hooks/useDatepicker.js +2 -2
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/date/hooks/useMonthPicker.js +2 -2
- package/esm/date/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/hooks/useRangeDatepicker.js +3 -3
- package/esm/date/hooks/useRangeDatepicker.js.map +1 -1
- package/esm/date/monthpicker/MonthButton.d.ts +2 -2
- package/esm/date/monthpicker/MonthPicker.d.ts +1 -1
- package/esm/date/monthpicker/MonthSelector.js +1 -1
- package/esm/date/monthpicker/MonthSelector.js.map +1 -1
- package/esm/date/utils/navigation.d.ts +1 -1
- package/esm/date/utils/navigation.js.map +1 -1
- package/esm/dropdown/Toggle.js +1 -1
- package/esm/dropdown/Toggle.js.map +1 -1
- package/esm/dropdown/index.d.ts +1 -2
- package/esm/dropdown/index.js +0 -1
- package/esm/dropdown/index.js.map +1 -1
- package/esm/form/Fieldset/useFieldset.d.ts +1 -1
- package/esm/form/Select.js +1 -1
- package/esm/form/Select.js.map +1 -1
- package/esm/form/checkbox/useCheckbox.d.ts +2 -2
- package/esm/form/checkbox/useCheckbox.js +3 -4
- package/esm/form/checkbox/useCheckbox.js.map +1 -1
- package/esm/form/combobox/Combobox.d.ts +1 -1
- package/esm/form/combobox/Combobox.js +1 -1
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/Input/Input.d.ts +0 -2
- package/esm/form/combobox/Input/Input.js +1 -1
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/radio/useRadio.d.ts +1 -1
- package/esm/form/search/Search.js +3 -1
- package/esm/form/search/Search.js.map +1 -1
- package/esm/layout/bleed/Bleed.d.ts +8 -0
- package/esm/layout/bleed/Bleed.js +21 -0
- package/esm/layout/bleed/Bleed.js.map +1 -0
- package/esm/layout/bleed/index.d.ts +1 -0
- package/esm/layout/bleed/index.js +2 -0
- package/esm/layout/bleed/index.js.map +1 -0
- package/esm/layout/box/Box.d.ts +1 -2
- package/esm/layout/box/Box.js.map +1 -1
- package/esm/layout/content-box/ContentBox.d.ts +8 -0
- package/esm/layout/content-box/ContentBox.js +28 -0
- package/esm/layout/content-box/ContentBox.js.map +1 -0
- package/esm/layout/content-box/index.d.ts +1 -0
- package/esm/layout/content-box/index.js +2 -0
- package/esm/layout/content-box/index.js.map +1 -0
- package/esm/layout/page-demo/AvatarPanel.d.ts +4 -0
- package/esm/layout/page-demo/AvatarPanel.js +12 -0
- package/esm/layout/page-demo/AvatarPanel.js.map +1 -0
- package/esm/layout/page-demo/Filter.d.ts +2 -0
- package/esm/layout/page-demo/Filter.js +15 -0
- package/esm/layout/page-demo/Filter.js.map +1 -0
- package/esm/layout/page-demo/Header.d.ts +2 -0
- package/esm/layout/page-demo/Header.js +42 -0
- package/esm/layout/page-demo/Header.js.map +1 -0
- package/esm/layout/page-demo/Intro.d.ts +2 -0
- package/esm/layout/page-demo/Intro.js +30 -0
- package/esm/layout/page-demo/Intro.js.map +1 -0
- package/esm/layout/page-demo/Sidebar.d.ts +4 -0
- package/esm/layout/page-demo/Sidebar.js +41 -0
- package/esm/layout/page-demo/Sidebar.js.map +1 -0
- package/esm/layout/sidemal-test/AvatarPanel.d.ts +4 -0
- package/esm/layout/sidemal-test/AvatarPanel.js +12 -0
- package/esm/layout/sidemal-test/AvatarPanel.js.map +1 -0
- package/esm/layout/sidemal-test/Content.d.ts +2 -0
- package/esm/layout/sidemal-test/Content.js +60 -0
- package/esm/layout/sidemal-test/Content.js.map +1 -0
- package/esm/layout/sidemal-test/Filter.d.ts +2 -0
- package/esm/layout/sidemal-test/Filter.js +22 -0
- package/esm/layout/sidemal-test/Filter.js.map +1 -0
- package/esm/layout/sidemal-test/Header.d.ts +2 -0
- package/esm/layout/sidemal-test/Header.js +42 -0
- package/esm/layout/sidemal-test/Header.js.map +1 -0
- package/esm/layout/sidemal-test/Intro.d.ts +2 -0
- package/esm/layout/sidemal-test/Intro.js +30 -0
- package/esm/layout/sidemal-test/Intro.js.map +1 -0
- package/esm/layout/sidemal-test/Sidebar.d.ts +4 -0
- package/esm/layout/sidemal-test/Sidebar.js +41 -0
- package/esm/layout/sidemal-test/Sidebar.js.map +1 -0
- package/esm/layout/sidemal-test/content-box/ContentBox.d.ts +8 -0
- package/esm/layout/sidemal-test/content-box/ContentBox.js +37 -0
- package/esm/layout/sidemal-test/content-box/ContentBox.js.map +1 -0
- package/esm/layout/sidemal-test/content-box/index.d.ts +1 -0
- package/esm/layout/sidemal-test/content-box/index.js +2 -0
- package/esm/layout/sidemal-test/content-box/index.js.map +1 -0
- package/esm/layout/stack/Stack.d.ts +7 -3
- package/esm/layout/stack/Stack.js +3 -3
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/layout/stack/index.d.ts +1 -0
- package/esm/layout/stack/index.js +1 -0
- package/esm/layout/stack/index.js.map +1 -1
- package/esm/layout/utilities/css.js.map +1 -1
- package/esm/loader/Loader.js +3 -3
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/dialog-polyfill.js +2 -0
- package/esm/modal/dialog-polyfill.js.map +1 -1
- package/esm/popover/Popover.js +3 -2
- package/esm/popover/Popover.js.map +1 -1
- package/esm/tabs/TabList.js +6 -7
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/timeline/Pin.js +21 -21
- package/esm/timeline/Pin.js.map +1 -1
- package/esm/timeline/Timeline.js +4 -4
- package/esm/timeline/Timeline.js.map +1 -1
- package/esm/timeline/TimelineRow.js.map +1 -1
- package/esm/timeline/hooks/usePeriodContext.d.ts +1 -1
- package/esm/timeline/period/ClickablePeriod.js +20 -20
- package/esm/timeline/period/ClickablePeriod.js.map +1 -1
- package/esm/timeline/period/index.d.ts +2 -2
- package/esm/timeline/period/index.js +1 -1
- package/esm/timeline/period/index.js.map +1 -1
- package/esm/timeline/utils/timeline.js +3 -3
- package/esm/timeline/utils/timeline.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.js +1 -1
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/tooltip/Tooltip.js +1 -1
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/Heading.js +1 -1
- package/esm/typography/Heading.js.map +1 -1
- package/esm/util/RandomIcon.js +1 -0
- package/esm/util/RandomIcon.js.map +1 -1
- package/esm/util/Slot.d.ts +6 -0
- package/esm/util/Slot.js +60 -0
- package/esm/util/Slot.js.map +1 -0
- package/esm/util/mergeRefs.d.ts +1 -1
- package/esm/util/useId.js +2 -4
- package/esm/util/useId.js.map +1 -1
- package/package.json +3 -4
- package/src/accordion/AccordionItem.tsx +3 -5
- package/src/accordion/accordion.stories.tsx +21 -34
- package/src/alert/alert.stories.tsx +2 -2
- package/src/chips/chips.stories.tsx +29 -32
- package/src/date/datepicker/DatePickerStandalone.tsx +1 -3
- package/src/date/datepicker/datepicker.stories.tsx +1 -1
- package/src/date/datepicker/datepicker.test.tsx +5 -4
- package/src/date/hooks/useDatepicker.tsx +2 -2
- package/src/date/hooks/useMonthPicker.tsx +2 -2
- package/src/date/hooks/useRangeDatepicker.test.tsx +11 -11
- package/src/date/hooks/useRangeDatepicker.tsx +3 -3
- package/src/date/monthpicker/MonthButton.tsx +2 -2
- package/src/date/monthpicker/MonthPicker.tsx +1 -1
- package/src/date/monthpicker/MonthSelector.tsx +3 -3
- package/src/date/monthpicker/monthpicker.stories.tsx +1 -1
- package/src/date/utils/__tests__/get-initial-year.test.ts +0 -12
- package/src/date/utils/__tests__/is-match.test.ts +3 -3
- package/src/date/utils/__tests__/parse-dates.test.ts +4 -2
- package/src/date/utils/navigation.ts +3 -3
- package/src/dropdown/Toggle.tsx +1 -1
- package/src/dropdown/dropdown.stories.tsx +25 -28
- package/src/dropdown/index.ts +1 -2
- package/src/expansion-card/expansion-card.stories.tsx +143 -161
- package/src/form/ConfirmationPanel.test.tsx +5 -5
- package/src/form/Select.tsx +1 -1
- package/src/form/checkbox/Checkbox.test.tsx +14 -26
- package/src/form/checkbox/checkbox.stories.tsx +66 -71
- package/src/form/checkbox/useCheckbox.ts +3 -4
- package/src/form/combobox/Combobox.tsx +2 -3
- package/src/form/combobox/Input/Input.tsx +1 -3
- package/src/form/combobox/combobox.stories.tsx +20 -23
- package/src/form/combobox/combobox.test.tsx +22 -20
- package/src/form/radio/radio.stories.tsx +39 -44
- package/src/form/search/Search.tsx +1 -0
- package/src/form/search/search.stories.tsx +22 -26
- package/src/form/stories/fieldset.stories.tsx +1 -1
- package/src/layout/box/Box.stories.tsx +251 -256
- package/src/layout/box/Box.tsx +1 -1
- package/src/layout/sidemal-test/AvatarPanel.tsx +27 -0
- package/src/layout/sidemal-test/Content.tsx +129 -0
- package/src/layout/sidemal-test/Filter.tsx +46 -0
- package/src/layout/sidemal-test/Header.tsx +96 -0
- package/src/layout/sidemal-test/Intro.tsx +91 -0
- package/src/layout/sidemal-test/Sidebar.tsx +77 -0
- package/src/layout/sidemal-test/content-box/ContentBox.tsx +46 -0
- package/src/layout/sidemal-test/content-box/index.ts +1 -0
- package/src/layout/sidemal-test/navno-sidemal.stories.mdx +29 -0
- package/src/layout/sidemal-test/navno-sidemal.stories.tsx +65 -0
- package/src/layout/sidemal-test/styling.css +43 -0
- package/src/layout/stack/Stack.tsx +14 -8
- package/src/layout/stack/index.ts +1 -0
- package/src/layout/stack/stack.stories.tsx +23 -1
- package/src/layout/utilities/css.ts +0 -1
- package/src/loader/Loader.tsx +2 -3
- package/src/modal/dialog-polyfill.ts +2 -0
- package/src/pagination/pagination.stories.tsx +35 -42
- package/src/popover/Popover.test.tsx +21 -35
- package/src/popover/Popover.tsx +2 -2
- package/src/popover/popover.stories.tsx +25 -41
- package/src/react-css.d.ts +0 -1
- package/src/read-more/readmore.stories.tsx +35 -36
- package/src/stepper/stepper.stories.tsx +45 -52
- package/src/table/stories/table-expandable.stories.tsx +59 -63
- package/src/tabs/TabList.tsx +4 -6
- package/src/tabs/Tabs.stories.tsx +3 -3
- package/src/tag/tag.stories.tsx +4 -4
- package/src/timeline/Pin.tsx +44 -39
- package/src/timeline/Timeline.tsx +6 -6
- package/src/timeline/TimelineRow.tsx +1 -0
- package/src/timeline/hooks/usePeriodContext.tsx +1 -1
- package/src/timeline/period/ClickablePeriod.tsx +42 -38
- package/src/timeline/period/index.tsx +5 -4
- package/src/timeline/timeline.stories.tsx +11 -10
- package/src/timeline/utils/timeline.ts +3 -3
- package/src/toggle-group/ToggleGroup.stories.tsx +25 -29
- package/src/toggle-group/ToggleGroup.tsx +0 -1
- package/src/tooltip/Tooltip.test.tsx +40 -54
- package/src/tooltip/Tooltip.tsx +1 -1
- package/src/typography/Heading.tsx +1 -1
- package/src/util/RandomIcon.tsx +1 -0
- package/src/util/Slot.tsx +69 -0
- package/src/util/__tests__/Slot.test.tsx +98 -0
- package/src/util/mergeRefs.tsx +1 -1
- package/src/util/useId.ts +1 -3
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
1
|
import { Meta } from "@storybook/react";
|
|
3
2
|
import React, { useState } from "react";
|
|
4
3
|
import { BodyLong } from "..";
|
|
5
4
|
import Stepper from "./Stepper";
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
const meta: Meta<typeof Stepper> = {
|
|
8
7
|
title: "ds-react/Stepper",
|
|
9
8
|
component: Stepper,
|
|
10
9
|
argTypes: {
|
|
11
10
|
orientation: {
|
|
12
|
-
control: {
|
|
13
|
-
type: "radio",
|
|
14
|
-
},
|
|
11
|
+
control: { type: "radio" },
|
|
15
12
|
options: ["horizontal", "vertical"],
|
|
16
13
|
},
|
|
17
14
|
activeStep: {
|
|
18
|
-
control: {
|
|
19
|
-
type: "number",
|
|
20
|
-
},
|
|
15
|
+
control: { type: "number" },
|
|
21
16
|
},
|
|
22
17
|
},
|
|
23
|
-
}
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
24
20
|
|
|
25
21
|
const storyTexts = [
|
|
26
22
|
"Minimize backwards overflow agile. Horsehead offer commitment to the cause nor copy and paste from stack overflow problem territories, innovation is hot right now for can you slack it to me?. High touch client table the discussion , and get buy-in so manage expectations loop back, please advise soonest. We need a paradigm shift dogpile that, and i need to pee and then go to another meeting for let's prioritize the low-hanging fruit.",
|
|
@@ -32,51 +28,48 @@ const storyTexts = [
|
|
|
32
28
|
"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.",
|
|
33
29
|
];
|
|
34
30
|
|
|
35
|
-
export const Default = {
|
|
36
|
-
|
|
37
|
-
const [activeStep, setActiveStep] = useState(1);
|
|
38
|
-
|
|
39
|
-
const newProps = {
|
|
40
|
-
onClick: (e) => e.preventDefault(),
|
|
41
|
-
...(asButton ? { as: "button" } : { href: "#" }),
|
|
42
|
-
};
|
|
31
|
+
export const Default = ({ asButton, ...props }) => {
|
|
32
|
+
const [activeStep, setActiveStep] = useState(1);
|
|
43
33
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
},
|
|
34
|
+
const newProps = {
|
|
35
|
+
onClick: (e) => e.preventDefault(),
|
|
36
|
+
...(asButton ? { as: "button" } : { href: "#" }),
|
|
37
|
+
};
|
|
74
38
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
39
|
+
return (
|
|
40
|
+
<div style={{ display: "flex", gap: "10rem", flexDirection: "column" }}>
|
|
41
|
+
<Stepper
|
|
42
|
+
aria-labelledby="stepper-heading"
|
|
43
|
+
activeStep={activeStep}
|
|
44
|
+
onStepChange={setActiveStep}
|
|
45
|
+
orientation="vertical"
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
<Stepper.Step {...newProps} completed={props.completed}>
|
|
49
|
+
Start søknad
|
|
50
|
+
</Stepper.Step>
|
|
51
|
+
<Stepper.Step {...newProps}>Personopplysninger</Stepper.Step>
|
|
52
|
+
<Stepper.Step {...newProps} completed={props.completed}>
|
|
53
|
+
Saksopplysninger
|
|
54
|
+
</Stepper.Step>
|
|
55
|
+
<Stepper.Step {...newProps} completed={props.completed}>
|
|
56
|
+
Søknadstekst for en veldig spesifikk prosess i NAV som må beskrives og
|
|
57
|
+
forklares i sitt fulle i denne labelen
|
|
58
|
+
</Stepper.Step>
|
|
59
|
+
<Stepper.Step {...newProps}>Vedlegg</Stepper.Step>
|
|
60
|
+
<Stepper.Step {...newProps}>Oppsummering</Stepper.Step>
|
|
61
|
+
<Stepper.Step {...newProps}>Innsending</Stepper.Step>
|
|
62
|
+
</Stepper>
|
|
63
|
+
<BodyLong style={{ marginTop: "5rem" }}>
|
|
64
|
+
{storyTexts[activeStep]}
|
|
65
|
+
</BodyLong>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
Default.args = {
|
|
70
|
+
asButton: false,
|
|
71
|
+
interactive: true,
|
|
72
|
+
completed: false,
|
|
80
73
|
};
|
|
81
74
|
|
|
82
75
|
export const Horizontal = () => {
|
|
@@ -147,7 +147,7 @@ const data = [
|
|
|
147
147
|
status: "Inaktiv",
|
|
148
148
|
content: (
|
|
149
149
|
<>
|
|
150
|
-
Ola Conny Brakkestad sier
|
|
150
|
+
Ola Conny Brakkestad sier hei. Her er litt innhold med en{" "}
|
|
151
151
|
<Link href="#">link.</Link>
|
|
152
152
|
</>
|
|
153
153
|
),
|
|
@@ -162,7 +162,7 @@ const data = [
|
|
|
162
162
|
status: <Link href="http://example.com">Hissig</Link>,
|
|
163
163
|
content: (
|
|
164
164
|
<>
|
|
165
|
-
Henriette Kristensen sier
|
|
165
|
+
Henriette Kristensen sier hei. Her er litt innhold med en{" "}
|
|
166
166
|
<Link href="http://example.com">lenke</Link>. I forhold til en betydelig
|
|
167
167
|
avveining synliggjøres potensialet med sikte på satsingsområdet. Gitt en
|
|
168
168
|
manglende avveining synliggjøres instrumentet på bakgrunn av forholdene.
|
|
@@ -183,7 +183,7 @@ const data = [
|
|
|
183
183
|
status: "Deaktivert",
|
|
184
184
|
content: (
|
|
185
185
|
<>
|
|
186
|
-
Suki Clydesdale sier
|
|
186
|
+
Suki Clydesdale sier hei. Her er litt innhold med en{" "}
|
|
187
187
|
<Link href="http://example.com">link</Link>.
|
|
188
188
|
</>
|
|
189
189
|
),
|
|
@@ -198,7 +198,7 @@ const data = [
|
|
|
198
198
|
status: <Link href="#">Starter</Link>,
|
|
199
199
|
content: (
|
|
200
200
|
<>
|
|
201
|
-
Hans-Hermann Hoppe sier
|
|
201
|
+
Hans-Hermann Hoppe sier hei. Her er litt innhold med en{" "}
|
|
202
202
|
<Link href="http://example.com">link</Link>.
|
|
203
203
|
</>
|
|
204
204
|
),
|
|
@@ -213,7 +213,7 @@ const data = [
|
|
|
213
213
|
status: <Link href="#">Eksplodert</Link>,
|
|
214
214
|
content: (
|
|
215
215
|
<>
|
|
216
|
-
Max Kraft sier
|
|
216
|
+
Max Kraft sier hei. Her er litt innhold med en{" "}
|
|
217
217
|
<Link href="http://example.com">link</Link>.
|
|
218
218
|
</>
|
|
219
219
|
),
|
|
@@ -228,7 +228,7 @@ const data = [
|
|
|
228
228
|
status: <Link href="#">Gunstig</Link>,
|
|
229
229
|
content: (
|
|
230
230
|
<>
|
|
231
|
-
Pat Ole sier
|
|
231
|
+
Pat Ole sier hei. Her er litt innhold med en{" "}
|
|
232
232
|
<Link href="http://example.com">lenke</Link>.
|
|
233
233
|
</>
|
|
234
234
|
),
|
|
@@ -265,62 +265,58 @@ export const ExpandableOpen = () => {
|
|
|
265
265
|
);
|
|
266
266
|
};
|
|
267
267
|
|
|
268
|
-
export const ClickableRow = {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const [isRowOpen1, setIsRowOpen1] = useState(false);
|
|
272
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
273
|
-
const [isRowOpen2, setIsRowOpen2] = useState(false);
|
|
268
|
+
export const ClickableRow = () => {
|
|
269
|
+
const [isRowOpen1, setIsRowOpen1] = useState(false);
|
|
270
|
+
const [isRowOpen2, setIsRowOpen2] = useState(false);
|
|
274
271
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
},
|
|
272
|
+
return (
|
|
273
|
+
<>
|
|
274
|
+
<Table zebraStripes>
|
|
275
|
+
<Table.Header>
|
|
276
|
+
<Table.Row>
|
|
277
|
+
<Table.HeaderCell>Navn</Table.HeaderCell>
|
|
278
|
+
<Table.HeaderCell>Info</Table.HeaderCell>
|
|
279
|
+
<Table.HeaderCell aria-hidden />
|
|
280
|
+
</Table.Row>
|
|
281
|
+
</Table.Header>
|
|
282
|
+
<Table.Body>
|
|
283
|
+
<Table.ExpandableRow
|
|
284
|
+
content={<div>placeholder row 1</div>}
|
|
285
|
+
togglePlacement="right"
|
|
286
|
+
onOpenChange={setIsRowOpen1}
|
|
287
|
+
data-testid="row1"
|
|
288
|
+
open={isRowOpen1}
|
|
289
|
+
expandOnRowClick
|
|
290
|
+
>
|
|
291
|
+
<Table.DataCell>Ola</Table.DataCell>
|
|
292
|
+
<Table.DataCell>
|
|
293
|
+
<Button
|
|
294
|
+
size="xsmall"
|
|
295
|
+
onClick={() => {
|
|
296
|
+
alert("Mer info");
|
|
297
|
+
}}
|
|
298
|
+
>
|
|
299
|
+
Mer info
|
|
300
|
+
</Button>
|
|
301
|
+
</Table.DataCell>
|
|
302
|
+
</Table.ExpandableRow>
|
|
303
|
+
<Table.ExpandableRow
|
|
304
|
+
content={<div>placeholder row 2</div>}
|
|
305
|
+
togglePlacement="right"
|
|
306
|
+
onOpenChange={setIsRowOpen2}
|
|
307
|
+
data-testid="row2"
|
|
308
|
+
open={isRowOpen2}
|
|
309
|
+
expandOnRowClick
|
|
310
|
+
>
|
|
311
|
+
<Table.DataCell>Hans</Table.DataCell>
|
|
312
|
+
<Table.DataCell>
|
|
313
|
+
<Checkbox hideLabel size="small">
|
|
314
|
+
Sett
|
|
315
|
+
</Checkbox>
|
|
316
|
+
</Table.DataCell>
|
|
317
|
+
</Table.ExpandableRow>
|
|
318
|
+
</Table.Body>
|
|
319
|
+
</Table>
|
|
320
|
+
</>
|
|
321
|
+
);
|
|
326
322
|
};
|
package/src/tabs/TabList.tsx
CHANGED
|
@@ -34,13 +34,10 @@ export const TabList = forwardRef<HTMLDivElement, TabListProps>(
|
|
|
34
34
|
debounce(() => {
|
|
35
35
|
if (!listRef?.current) return;
|
|
36
36
|
const { scrollWidth, clientWidth } = listRef.current;
|
|
37
|
-
|
|
38
|
-
let showEndScroll;
|
|
39
|
-
|
|
40
|
-
const scrollLeft = listRef?.current?.scrollLeft;
|
|
37
|
+
const scrollLeft = listRef.current.scrollLeft;
|
|
41
38
|
// use 1 for the potential rounding error with browser zooms.
|
|
42
|
-
showStartScroll = scrollLeft > 1;
|
|
43
|
-
showEndScroll = scrollLeft < scrollWidth - clientWidth - 1;
|
|
39
|
+
const showStartScroll = scrollLeft > 1;
|
|
40
|
+
const showEndScroll = scrollLeft < scrollWidth - clientWidth - 1;
|
|
44
41
|
|
|
45
42
|
setDisplayScroll((displayScroll) =>
|
|
46
43
|
showStartScroll === displayScroll.start &&
|
|
@@ -89,6 +86,7 @@ export const TabList = forwardRef<HTMLDivElement, TabListProps>(
|
|
|
89
86
|
dir: 1 | -1;
|
|
90
87
|
hidden: boolean;
|
|
91
88
|
}) => (
|
|
89
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
92
90
|
<div
|
|
93
91
|
className={cl("navds-tabs__scroll-button", {
|
|
94
92
|
"navds-tabs__scroll-button--hidden": hidden,
|
|
@@ -8,19 +8,19 @@ export default {
|
|
|
8
8
|
component: Tabs,
|
|
9
9
|
argTypes: {
|
|
10
10
|
size: {
|
|
11
|
+
options: ["medium", "small"],
|
|
11
12
|
control: {
|
|
12
13
|
type: "radio",
|
|
13
|
-
options: ["medium", "small"],
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
iconPosition: {
|
|
17
|
+
options: ["top", "left"],
|
|
17
18
|
control: {
|
|
18
19
|
type: "radio",
|
|
19
|
-
options: ["top", "left"],
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
|
-
}
|
|
23
|
+
} satisfies Meta<typeof Tabs>;
|
|
24
24
|
|
|
25
25
|
const Panel = () => {
|
|
26
26
|
return (
|
package/src/tag/tag.stories.tsx
CHANGED
|
@@ -66,7 +66,7 @@ export const Default = {
|
|
|
66
66
|
export const Small = () => {
|
|
67
67
|
return (
|
|
68
68
|
<div className="rowgap rowgap-wrap">
|
|
69
|
-
{variants.map((variant
|
|
69
|
+
{variants.map((variant) => (
|
|
70
70
|
<Tag key={variant} variant={variant} size="small">
|
|
71
71
|
{variant}
|
|
72
72
|
</Tag>
|
|
@@ -75,10 +75,10 @@ export const Small = () => {
|
|
|
75
75
|
);
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
export const
|
|
78
|
+
export const XSmall = () => {
|
|
79
79
|
return (
|
|
80
80
|
<div className="rowgap rowgap-wrap">
|
|
81
|
-
{variants.map((variant
|
|
81
|
+
{variants.map((variant) => (
|
|
82
82
|
<Tag key={variant} variant={variant} size="xsmall">
|
|
83
83
|
{variant}
|
|
84
84
|
</Tag>
|
|
@@ -90,7 +90,7 @@ export const xSmall = () => {
|
|
|
90
90
|
export const Variants = () => {
|
|
91
91
|
return (
|
|
92
92
|
<div className="rowgap rowgap-wrap">
|
|
93
|
-
{variants.map((variant
|
|
93
|
+
{variants.map((variant) => (
|
|
94
94
|
<Tag key={variant} variant={variant}>
|
|
95
95
|
{variant}
|
|
96
96
|
</Tag>
|
package/src/timeline/Pin.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
FloatingFocusManager,
|
|
2
3
|
autoUpdate,
|
|
3
4
|
arrow as flArrow,
|
|
4
5
|
flip,
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
useFocus,
|
|
11
12
|
useHover,
|
|
12
13
|
useInteractions,
|
|
14
|
+
useRole,
|
|
13
15
|
} from "@floating-ui/react";
|
|
14
16
|
import { format } from "date-fns";
|
|
15
17
|
import React, { forwardRef, useMemo, useRef, useState } from "react";
|
|
@@ -51,25 +53,32 @@ export const Pin = forwardRef<HTMLButtonElement, TimelinePinProps>(
|
|
|
51
53
|
floatingStyles,
|
|
52
54
|
} = useFloating({
|
|
53
55
|
placement: "top",
|
|
54
|
-
open
|
|
55
|
-
onOpenChange: setOpen,
|
|
56
|
+
open,
|
|
57
|
+
onOpenChange: (_open) => setOpen(_open),
|
|
58
|
+
whileElementsMounted: autoUpdate,
|
|
56
59
|
middleware: [
|
|
57
60
|
offset(16),
|
|
58
61
|
shift(),
|
|
59
62
|
flip({ padding: 5, fallbackPlacements: ["bottom", "top"] }),
|
|
60
63
|
flArrow({ element: arrowRef, padding: 5 }),
|
|
61
64
|
],
|
|
62
|
-
whileElementsMounted: autoUpdate,
|
|
63
65
|
});
|
|
64
66
|
|
|
67
|
+
const hover = useHover(context, {
|
|
68
|
+
handleClose: safePolygon(),
|
|
69
|
+
restMs: 25,
|
|
70
|
+
delay: { open: 1000 },
|
|
71
|
+
move: false,
|
|
72
|
+
});
|
|
73
|
+
const focus = useFocus(context);
|
|
74
|
+
const dismiss = useDismiss(context);
|
|
75
|
+
const role = useRole(context, { role: "dialog" });
|
|
76
|
+
|
|
65
77
|
const { getFloatingProps, getReferenceProps } = useInteractions([
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}),
|
|
71
|
-
useFocus(context),
|
|
72
|
-
useDismiss(context),
|
|
78
|
+
hover,
|
|
79
|
+
focus,
|
|
80
|
+
dismiss,
|
|
81
|
+
role,
|
|
73
82
|
]);
|
|
74
83
|
|
|
75
84
|
const mergedRef = useMemo(
|
|
@@ -109,37 +118,33 @@ export const Pin = forwardRef<HTMLButtonElement, TimelinePinProps>(
|
|
|
109
118
|
})}
|
|
110
119
|
/>
|
|
111
120
|
</div>
|
|
112
|
-
{children && (
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
{...getFloatingProps({
|
|
119
|
-
tabIndex: -1,
|
|
120
|
-
onBlur: (e) =>
|
|
121
|
-
e.target.previousSibling !== document.activeElement &&
|
|
122
|
-
open &&
|
|
123
|
-
setOpen(false),
|
|
124
|
-
})}
|
|
125
|
-
style={{
|
|
126
|
-
...floatingStyles,
|
|
127
|
-
display: open ? undefined : "none",
|
|
128
|
-
}}
|
|
121
|
+
{children && open && (
|
|
122
|
+
<FloatingFocusManager
|
|
123
|
+
context={context}
|
|
124
|
+
modal={false}
|
|
125
|
+
initialFocus={-1}
|
|
126
|
+
returnFocus={false}
|
|
129
127
|
>
|
|
130
|
-
<div className="navds-timeline__popover-content">{children}</div>
|
|
131
128
|
<div
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
129
|
+
className="navds-timeline__popover"
|
|
130
|
+
data-placement={placement}
|
|
131
|
+
ref={refs.setFloating}
|
|
132
|
+
{...getFloatingProps()}
|
|
133
|
+
tabIndex={undefined}
|
|
134
|
+
style={floatingStyles}
|
|
135
|
+
>
|
|
136
|
+
{children}
|
|
137
|
+
<div
|
|
138
|
+
ref={arrowRef}
|
|
139
|
+
style={{
|
|
140
|
+
...(arrowX != null ? { left: arrowX } : {}),
|
|
141
|
+
...(arrowY != null ? { top: arrowY } : {}),
|
|
142
|
+
...(staticSide ? { [staticSide]: "-0.5rem" } : {}),
|
|
143
|
+
}}
|
|
144
|
+
className="navds-timeline__popover-arrow"
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
</FloatingFocusManager>
|
|
143
148
|
)}
|
|
144
149
|
</>
|
|
145
150
|
);
|
|
@@ -104,9 +104,9 @@ export const Timeline = forwardRef<HTMLDivElement, TimelineProps>(
|
|
|
104
104
|
(c: any) => c?.type?.componentType === "row"
|
|
105
105
|
);
|
|
106
106
|
|
|
107
|
-
const pins = React.Children.toArray(children)
|
|
108
|
-
(c: any) => c?.type?.componentType === "pin"
|
|
109
|
-
|
|
107
|
+
const pins = React.Children.toArray(children)
|
|
108
|
+
.filter((c: any) => c?.type?.componentType === "pin")
|
|
109
|
+
.map((x) => () => x);
|
|
110
110
|
|
|
111
111
|
const zoomComponent = React.Children.toArray(children).find(
|
|
112
112
|
(c: any) => c?.type?.componentType === "zoom"
|
|
@@ -212,9 +212,9 @@ export const Timeline = forwardRef<HTMLDivElement, TimelineProps>(
|
|
|
212
212
|
<div className="navds-timeline">
|
|
213
213
|
<AxisLabels templates={axisLabelTemplates} />
|
|
214
214
|
|
|
215
|
-
{pins.map((
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
{pins.map((Pin, i) => (
|
|
216
|
+
<Pin key={`pin-${i}`} />
|
|
217
|
+
))}
|
|
218
218
|
|
|
219
219
|
{processedRows.map((row, i) => {
|
|
220
220
|
return (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
FloatingFocusManager,
|
|
2
3
|
autoUpdate,
|
|
3
4
|
arrow as flArrow,
|
|
4
5
|
flip,
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
useFocus,
|
|
11
12
|
useHover,
|
|
12
13
|
useInteractions,
|
|
14
|
+
useRole,
|
|
13
15
|
} from "@floating-ui/react";
|
|
14
16
|
import cl from "clsx";
|
|
15
17
|
import React, { useMemo, useRef, useState } from "react";
|
|
@@ -60,24 +62,31 @@ const ClickablePeriod = React.memo(
|
|
|
60
62
|
} = useFloating({
|
|
61
63
|
placement: "top",
|
|
62
64
|
open: open,
|
|
63
|
-
onOpenChange: setOpen,
|
|
65
|
+
onOpenChange: (_open) => setOpen(_open),
|
|
66
|
+
whileElementsMounted: autoUpdate,
|
|
64
67
|
middleware: [
|
|
65
68
|
offset(16),
|
|
66
69
|
shift(),
|
|
67
70
|
flip({ padding: 5, fallbackPlacements: ["bottom", "top"] }),
|
|
68
71
|
flArrow({ element: arrowRef, padding: 5 }),
|
|
69
72
|
],
|
|
70
|
-
whileElementsMounted: autoUpdate,
|
|
71
73
|
});
|
|
72
74
|
|
|
75
|
+
const hover = useHover(context, {
|
|
76
|
+
handleClose: safePolygon(),
|
|
77
|
+
restMs: 25,
|
|
78
|
+
delay: { open: 1000 },
|
|
79
|
+
move: false,
|
|
80
|
+
});
|
|
81
|
+
const focus = useFocus(context);
|
|
82
|
+
const dismiss = useDismiss(context);
|
|
83
|
+
const role = useRole(context, { role: "dialog" });
|
|
84
|
+
|
|
73
85
|
const { getFloatingProps, getReferenceProps } = useInteractions([
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}),
|
|
79
|
-
useFocus(context),
|
|
80
|
-
useDismiss(context),
|
|
86
|
+
hover,
|
|
87
|
+
focus,
|
|
88
|
+
dismiss,
|
|
89
|
+
role,
|
|
81
90
|
]);
|
|
82
91
|
|
|
83
92
|
const mergedRef = useMemo(
|
|
@@ -141,37 +150,32 @@ const ClickablePeriod = React.memo(
|
|
|
141
150
|
>
|
|
142
151
|
<span className="navds-timeline__period--inner">{icon}</span>
|
|
143
152
|
</button>
|
|
144
|
-
{children && (
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
{...getFloatingProps({
|
|
151
|
-
tabIndex: -1,
|
|
152
|
-
onBlur: (e) =>
|
|
153
|
-
e.target.previousSibling !== document.activeElement &&
|
|
154
|
-
open &&
|
|
155
|
-
setOpen(false),
|
|
156
|
-
})}
|
|
157
|
-
style={{
|
|
158
|
-
...floatingStyles,
|
|
159
|
-
display: open ? undefined : "none",
|
|
160
|
-
}}
|
|
153
|
+
{children && open && (
|
|
154
|
+
<FloatingFocusManager
|
|
155
|
+
context={context}
|
|
156
|
+
modal={false}
|
|
157
|
+
initialFocus={-1}
|
|
158
|
+
returnFocus={false}
|
|
161
159
|
>
|
|
162
|
-
<div className="navds-timeline__popover-content">{children}</div>
|
|
163
160
|
<div
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
161
|
+
className="navds-timeline__popover"
|
|
162
|
+
data-placement={placement}
|
|
163
|
+
ref={refs.setFloating}
|
|
164
|
+
{...getFloatingProps()}
|
|
165
|
+
style={floatingStyles}
|
|
166
|
+
>
|
|
167
|
+
{children}
|
|
168
|
+
<div
|
|
169
|
+
ref={arrowRef}
|
|
170
|
+
style={{
|
|
171
|
+
...(arrowX != null ? { left: arrowX } : {}),
|
|
172
|
+
...(arrowY != null ? { top: arrowY } : {}),
|
|
173
|
+
...(staticSide ? { [staticSide]: "-0.5rem" } : {}),
|
|
174
|
+
}}
|
|
175
|
+
className="navds-timeline__popover-arrow"
|
|
176
|
+
/>
|
|
177
|
+
</div>
|
|
178
|
+
</FloatingFocusManager>
|
|
175
179
|
)}
|
|
176
180
|
</>
|
|
177
181
|
);
|