@navikt/ds-react 5.5.0 → 5.6.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 +507 -106
- package/cjs/accordion/Accordion.js +1 -0
- package/cjs/accordion/AccordionContext.js +1 -1
- package/cjs/accordion/AccordionHeader.js +2 -2
- package/cjs/accordion/AccordionItem.js +6 -2
- package/cjs/date/datepicker/DatePicker.js +30 -34
- package/cjs/date/datepicker/DatePickerStandalone.js +23 -26
- package/cjs/date/datepicker/parts/Caption.js +28 -0
- package/cjs/date/datepicker/{DayButton.js → parts/DayButton.js} +1 -2
- package/cjs/date/datepicker/{caption → parts}/DropdownCaption.js +13 -7
- package/cjs/date/datepicker/parts/HeadRow.js +36 -0
- package/cjs/date/datepicker/parts/Row.js +23 -0
- package/cjs/date/datepicker/{TableHead.js → parts/TableHead.js} +4 -3
- package/cjs/date/datepicker/parts/WeekNumber.js +35 -0
- package/cjs/date/datepicker/parts/WeekRow.js +34 -0
- 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/date/utils/get-month-weeks.js +46 -0
- package/cjs/date/utils/labels.js +40 -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/index.js +1 -0
- package/cjs/layout/bleed/Bleed.js +69 -0
- package/cjs/layout/bleed/index.js +5 -0
- package/cjs/layout/bleed/package.json +6 -0
- package/cjs/layout/box/Box.js +1 -1
- package/cjs/layout/responsive/Responsive.js +8 -6
- 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/layout/utilities/css.js +37 -14
- 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/Accordion.js +1 -0
- package/esm/accordion/Accordion.js.map +1 -1
- package/esm/accordion/AccordionContext.d.ts +1 -0
- package/esm/accordion/AccordionContext.js +1 -1
- package/esm/accordion/AccordionContext.js.map +1 -1
- package/esm/accordion/AccordionHeader.js +2 -2
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/accordion/AccordionItem.js +6 -2
- package/esm/accordion/AccordionItem.js.map +1 -1
- package/esm/date/datepicker/DatePicker.d.ts +14 -5
- package/esm/date/datepicker/DatePicker.js +29 -33
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/DatePickerStandalone.d.ts +3 -2
- package/esm/date/datepicker/DatePickerStandalone.js +22 -25
- package/esm/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/esm/date/datepicker/{caption → parts}/Caption.d.ts +3 -0
- package/esm/date/datepicker/parts/Caption.js +22 -0
- package/esm/date/datepicker/parts/Caption.js.map +1 -0
- package/esm/date/datepicker/parts/DayButton.d.ts +4 -0
- package/esm/date/datepicker/{DayButton.js → parts/DayButton.js} +2 -1
- package/esm/date/datepicker/parts/DayButton.js.map +1 -0
- package/esm/date/datepicker/{caption → parts}/DropdownCaption.d.ts +3 -0
- package/esm/date/datepicker/parts/DropdownCaption.js +44 -0
- package/esm/date/datepicker/parts/DropdownCaption.js.map +1 -0
- package/esm/date/datepicker/parts/HeadRow.d.ts +11 -0
- package/esm/date/datepicker/parts/HeadRow.js +29 -0
- package/esm/date/datepicker/parts/HeadRow.js.map +1 -0
- package/esm/date/datepicker/parts/Row.d.ts +17 -0
- package/esm/date/datepicker/parts/Row.js +19 -0
- package/esm/date/datepicker/parts/Row.js.map +1 -0
- package/esm/date/datepicker/parts/TableHead.d.ts +6 -0
- package/esm/date/datepicker/{TableHead.js → parts/TableHead.js} +5 -2
- package/esm/date/datepicker/parts/TableHead.js.map +1 -0
- package/esm/date/datepicker/parts/WeekNumber.d.ts +13 -0
- package/esm/date/datepicker/parts/WeekNumber.js +31 -0
- package/esm/date/datepicker/parts/WeekNumber.js.map +1 -0
- package/esm/date/datepicker/parts/WeekRow.d.ts +5 -0
- package/esm/date/datepicker/parts/WeekRow.js +30 -0
- package/esm/date/datepicker/parts/WeekRow.js.map +1 -0
- 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/get-month-weeks.d.ts +16 -0
- package/esm/date/utils/get-month-weeks.js +42 -0
- package/esm/date/utils/get-month-weeks.js.map +1 -0
- package/esm/date/utils/labels.d.ts +9 -0
- package/esm/date/utils/labels.js +36 -0
- package/esm/date/utils/labels.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/Select.js +1 -1
- package/esm/form/Select.js.map +1 -1
- package/esm/form/checkbox/useCheckbox.d.ts +1 -1
- 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/search/Search.js +3 -1
- package/esm/form/search/Search.js.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/layout/bleed/Bleed.d.ts +47 -0
- package/esm/layout/bleed/Bleed.js +41 -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 +1 -1
- package/esm/layout/box/Box.js.map +1 -1
- package/esm/layout/responsive/Responsive.d.ts +8 -4
- package/esm/layout/responsive/Responsive.js +8 -6
- package/esm/layout/responsive/Responsive.js.map +1 -1
- 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.d.ts +1 -1
- package/esm/layout/utilities/css.js +37 -14
- 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 +4 -4
- package/src/accordion/Accordion.tsx +1 -0
- package/src/accordion/AccordionContext.tsx +2 -1
- package/src/accordion/AccordionHeader.tsx +2 -2
- package/src/accordion/AccordionItem.tsx +7 -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/DatePicker.tsx +63 -58
- package/src/date/datepicker/DatePickerStandalone.tsx +36 -39
- package/src/date/datepicker/datepicker.stories.tsx +67 -2
- package/src/date/datepicker/datepicker.test.tsx +5 -4
- package/src/date/datepicker/{caption → parts}/Caption.tsx +19 -17
- package/src/date/datepicker/{DayButton.tsx → parts/DayButton.tsx} +3 -1
- package/src/date/datepicker/parts/DropdownCaption.tsx +113 -0
- package/src/date/datepicker/parts/HeadRow.tsx +56 -0
- package/src/date/datepicker/parts/Row.tsx +47 -0
- package/src/date/datepicker/{TableHead.tsx → parts/TableHead.tsx} +6 -2
- package/src/date/datepicker/parts/WeekNumber.tsx +79 -0
- package/src/date/datepicker/parts/WeekRow.tsx +60 -0
- 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__/get-month-weeks.test.ts +113 -0
- 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/get-month-weeks.ts +93 -0
- package/src/date/utils/labels.ts +51 -0
- 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/index.ts +1 -0
- package/src/layout/bleed/Bleed.stories.tsx +381 -0
- package/src/layout/bleed/Bleed.tsx +130 -0
- package/src/layout/bleed/index.ts +1 -0
- package/src/layout/box/Box.stories.tsx +251 -256
- package/src/layout/box/Box.tsx +2 -1
- package/src/layout/responsive/Responsive.tsx +21 -6
- package/src/layout/responsive/hide.stories.tsx +35 -0
- package/src/layout/responsive/show.stories.tsx +35 -0
- 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 +59 -20
- 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
- package/cjs/date/datepicker/caption/Caption.js +0 -23
- package/cjs/date/datepicker/caption/index.js +0 -10
- package/cjs/date/datepicker/caption/package.json +0 -6
- package/esm/date/datepicker/DayButton.d.ts +0 -3
- package/esm/date/datepicker/DayButton.js.map +0 -1
- package/esm/date/datepicker/TableHead.d.ts +0 -3
- package/esm/date/datepicker/TableHead.js.map +0 -1
- package/esm/date/datepicker/caption/Caption.js +0 -17
- package/esm/date/datepicker/caption/Caption.js.map +0 -1
- package/esm/date/datepicker/caption/DropdownCaption.js +0 -38
- package/esm/date/datepicker/caption/DropdownCaption.js.map +0 -1
- package/esm/date/datepicker/caption/index.d.ts +0 -2
- package/esm/date/datepicker/caption/index.js +0 -3
- package/esm/date/datepicker/caption/index.js.map +0 -1
- package/src/date/datepicker/caption/DropdownCaption.tsx +0 -108
- package/src/date/datepicker/caption/index.ts +0 -2
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.ContentBox = void 0;
|
|
41
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
43
|
+
exports.ContentBox = (0, react_1.forwardRef)((_a, ref) => {
|
|
44
|
+
var { as: Component = "div", className, maxWidth = "xl" } = _a, rest = __rest(_a, ["as", "className", "maxWidth"]);
|
|
45
|
+
const getMaxWidth = () => {
|
|
46
|
+
return maxWidth === "3xl"
|
|
47
|
+
? "1920px"
|
|
48
|
+
: maxWidth === "2xl"
|
|
49
|
+
? "1440px"
|
|
50
|
+
: maxWidth === "xl"
|
|
51
|
+
? "1280px"
|
|
52
|
+
: "1024px";
|
|
53
|
+
};
|
|
54
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
55
|
+
react_1.default.createElement(Component, Object.assign({}, rest, { ref: ref, style: { "--__ac-contentbox--max-width": getMaxWidth() }, className: (0, clsx_1.default)("navds-contentbox", className) })),
|
|
56
|
+
react_1.default.createElement("style", null, `
|
|
57
|
+
.navds-contentbox {
|
|
58
|
+
--__ac-contentbox--max-width: initial;
|
|
59
|
+
|
|
60
|
+
margin: 0 auto;
|
|
61
|
+
max-width: var(--__ac-contentbox--max-width);
|
|
62
|
+
}
|
|
63
|
+
`)));
|
|
64
|
+
});
|
|
65
|
+
exports.default = exports.ContentBox;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ContentBox = void 0;
|
|
7
|
+
var ContentBox_1 = require("./ContentBox");
|
|
8
|
+
Object.defineProperty(exports, "ContentBox", { enumerable: true, get: function () { return __importDefault(ContentBox_1).default; } });
|
|
@@ -42,8 +42,8 @@ const clsx_1 = __importDefault(require("clsx"));
|
|
|
42
42
|
const react_1 = __importStar(require("react"));
|
|
43
43
|
const css_1 = require("../utilities/css");
|
|
44
44
|
exports.Stack = (0, react_1.forwardRef)((_a, ref) => {
|
|
45
|
-
var { as: Component = "div", className, align, justify, wrap = true, gap, style: _style, direction } = _a, rest = __rest(_a, ["as", "className", "align", "justify", "wrap", "gap", "style", "direction"]);
|
|
46
|
-
const style = Object.assign(Object.assign(Object.assign({}, _style), { "--__ac-stack-
|
|
45
|
+
var { as: Component = "div", className, align, justify, wrap = true, gap, style: _style, direction = "row" } = _a, rest = __rest(_a, ["as", "className", "align", "justify", "wrap", "gap", "style", "direction"]);
|
|
46
|
+
const style = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, _style), { "--__ac-stack-wrap": wrap ? "wrap" : "nowrap" }), (0, css_1.getResponsiveProps)(`stack`, "gap", "spacing", gap)), (0, css_1.getResponsiveValue)(`stack`, "direction", direction)), (0, css_1.getResponsiveValue)(`stack`, "align", align)), (0, css_1.getResponsiveValue)(`stack`, "justify", justify));
|
|
47
47
|
return (react_1.default.createElement(Component, Object.assign({}, rest, { ref: ref, style: style, className: (0, clsx_1.default)("navds-stack", className, {
|
|
48
48
|
"navds-vstack": direction === "column",
|
|
49
49
|
"navds-hstack": direction === "row",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Spacer = exports.VStack = exports.HStack = void 0;
|
|
3
|
+
exports.Spacer = exports.Stack = exports.VStack = exports.HStack = void 0;
|
|
4
4
|
var HStack_1 = require("./HStack");
|
|
5
5
|
Object.defineProperty(exports, "HStack", { enumerable: true, get: function () { return HStack_1.HStack; } });
|
|
6
6
|
var VStack_1 = require("./VStack");
|
|
7
7
|
Object.defineProperty(exports, "VStack", { enumerable: true, get: function () { return VStack_1.VStack; } });
|
|
8
|
+
var Stack_1 = require("./Stack");
|
|
9
|
+
Object.defineProperty(exports, "Stack", { enumerable: true, get: function () { return Stack_1.Stack; } });
|
|
8
10
|
var Spacer_1 = require("./Spacer");
|
|
9
11
|
Object.defineProperty(exports, "Spacer", { enumerable: true, get: function () { return Spacer_1.Spacer; } });
|
|
@@ -16,26 +16,49 @@ function getResponsiveValue(componentName, componentProp, responsiveProp) {
|
|
|
16
16
|
]));
|
|
17
17
|
}
|
|
18
18
|
exports.getResponsiveValue = getResponsiveValue;
|
|
19
|
-
|
|
19
|
+
const translateExceptionToCSS = (exception) => {
|
|
20
|
+
switch (exception) {
|
|
21
|
+
case "px":
|
|
22
|
+
return "1px";
|
|
23
|
+
}
|
|
24
|
+
return exception;
|
|
25
|
+
};
|
|
26
|
+
const translateTokenStringToCSS = (componentProp, tokenString, tokenSubgroup, tokenExceptions, invert) => {
|
|
27
|
+
return tokenString
|
|
28
|
+
.split(" ")
|
|
29
|
+
.map((x, _, arr) => {
|
|
30
|
+
if (componentProp === "margin-inline" && x === "full") {
|
|
31
|
+
const width = 100 / arr.length;
|
|
32
|
+
return `calc((100vw - ${width}%)/-2)`;
|
|
33
|
+
}
|
|
34
|
+
let output = `var(--a-${tokenSubgroup}-${x})`;
|
|
35
|
+
if (tokenExceptions.includes(x)) {
|
|
36
|
+
output = translateExceptionToCSS(x);
|
|
37
|
+
}
|
|
38
|
+
if (invert) {
|
|
39
|
+
if (x === "0") {
|
|
40
|
+
return `0`;
|
|
41
|
+
}
|
|
42
|
+
return `calc(-1 * ${output})`;
|
|
43
|
+
}
|
|
44
|
+
return output;
|
|
45
|
+
})
|
|
46
|
+
.join(" ");
|
|
47
|
+
};
|
|
48
|
+
function getResponsiveProps(componentName, componentProp, tokenSubgroup, responsiveProp, invert = false, tokenExceptions = []) {
|
|
20
49
|
if (!responsiveProp) {
|
|
21
50
|
return {};
|
|
22
51
|
}
|
|
23
52
|
if (typeof responsiveProp === "string") {
|
|
24
53
|
return {
|
|
25
|
-
[`--__ac-${componentName}-${componentProp}-xs`]: responsiveProp
|
|
26
|
-
.split(" ")
|
|
27
|
-
.map((x) => tokenExceptions.includes(x) ? x : `var(--a-${tokenSubgroup}-${x})`)
|
|
28
|
-
.join(" "),
|
|
54
|
+
[`--__ac-${componentName}-${componentProp}-xs`]: translateTokenStringToCSS(componentProp, responsiveProp, tokenSubgroup, tokenExceptions, invert),
|
|
29
55
|
};
|
|
30
56
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
aliasOrScale
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.join(" "),
|
|
38
|
-
];
|
|
39
|
-
}));
|
|
57
|
+
const styleProps = {};
|
|
58
|
+
Object.entries(responsiveProp).forEach(([breakpointAlias, aliasOrScale]) => {
|
|
59
|
+
styleProps[`--__ac-${componentName}-${componentProp}-${breakpointAlias}`] =
|
|
60
|
+
translateTokenStringToCSS(componentProp, aliasOrScale, tokenSubgroup, tokenExceptions, invert);
|
|
61
|
+
});
|
|
62
|
+
return styleProps;
|
|
40
63
|
}
|
|
41
64
|
exports.getResponsiveProps = getResponsiveProps;
|
package/cjs/loader/Loader.js
CHANGED
|
@@ -53,11 +53,11 @@ const __1 = require("..");
|
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
55
|
exports.Loader = (0, react_1.forwardRef)((_a, ref) => {
|
|
56
|
-
var {
|
|
56
|
+
var { className, size = "medium", title = "venter...", transparent = false, variant = "neutral", id } = _a, rest = __rest(_a, ["className", "size", "title", "transparent", "variant", "id"]);
|
|
57
57
|
const internalId = (0, __1.useId)();
|
|
58
58
|
return (react_1.default.createElement("svg", Object.assign({ "aria-labelledby": id !== null && id !== void 0 ? id : `loader-${internalId}`, ref: ref, className: (0, clsx_1.default)("navds-loader", className, `navds-loader--${size}`, `navds-loader--${variant}`, {
|
|
59
59
|
"navds-loader--transparent": transparent,
|
|
60
|
-
}), focusable: "false", viewBox: "0 0 50 50", preserveAspectRatio: "xMidYMid" }, rest),
|
|
60
|
+
}), focusable: "false", viewBox: "0 0 50 50", preserveAspectRatio: "xMidYMid" }, (0, __1.omit)(rest, ["children"])),
|
|
61
61
|
react_1.default.createElement("title", { id: id !== null && id !== void 0 ? id : `loader-${internalId}` }, title),
|
|
62
62
|
react_1.default.createElement("circle", { className: "navds-loader__background", xmlns: "http://www.w3.org/2000/svg", cx: "25", cy: "25", r: "20", fill: "none" }),
|
|
63
63
|
react_1.default.createElement("circle", { className: "navds-loader__foreground", cx: "25", cy: "25", r: "20", fill: "none", strokeDasharray: "50 155" })));
|
package/cjs/popover/Popover.js
CHANGED
|
@@ -74,7 +74,7 @@ exports.Popover = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
74
74
|
strategy: chosenStrategy,
|
|
75
75
|
placement,
|
|
76
76
|
open: open,
|
|
77
|
-
onOpenChange: onClose,
|
|
77
|
+
onOpenChange: () => onClose(),
|
|
78
78
|
middleware: [
|
|
79
79
|
(0, react_1.offset)(offset !== null && offset !== void 0 ? offset : (arrow ? 16 : 4)),
|
|
80
80
|
(0, react_1.flip)({ padding: 5, fallbackPlacements: ["bottom", "top"] }),
|
|
@@ -115,13 +115,14 @@ exports.Popover = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
115
115
|
}[flPlacement.split("-")[0]];
|
|
116
116
|
return (react_2.default.createElement("div", Object.assign({ className: (0, clsx_1.default)("navds-popover", className, {
|
|
117
117
|
"navds-popover--hidden": !open || !anchorEl,
|
|
118
|
-
}), "data-placement": flPlacement, "aria-hidden": !open || !anchorEl
|
|
118
|
+
}), "data-placement": flPlacement, "aria-hidden": !open || !anchorEl }, getFloatingProps({
|
|
119
119
|
ref: floatingRef,
|
|
120
120
|
style: {
|
|
121
121
|
position: strategy,
|
|
122
122
|
top: y !== null && y !== void 0 ? y : 0,
|
|
123
123
|
left: x !== null && x !== void 0 ? x : 0,
|
|
124
124
|
},
|
|
125
|
+
tabIndex: undefined,
|
|
125
126
|
}), rest),
|
|
126
127
|
children,
|
|
127
128
|
arrow && (react_2.default.createElement("div", { ref: (node) => {
|
package/cjs/tabs/TabList.js
CHANGED
|
@@ -54,16 +54,13 @@ exports.TabList = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
54
54
|
end: false,
|
|
55
55
|
});
|
|
56
56
|
const updateScrollButtonState = (0, react_1.useMemo)(() => (0, __1.debounce)(() => {
|
|
57
|
-
var _a;
|
|
58
57
|
if (!(listRef === null || listRef === void 0 ? void 0 : listRef.current))
|
|
59
58
|
return;
|
|
60
59
|
const { scrollWidth, clientWidth } = listRef.current;
|
|
61
|
-
|
|
62
|
-
let showEndScroll;
|
|
63
|
-
const scrollLeft = (_a = listRef === null || listRef === void 0 ? void 0 : listRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft;
|
|
60
|
+
const scrollLeft = listRef.current.scrollLeft;
|
|
64
61
|
// use 1 for the potential rounding error with browser zooms.
|
|
65
|
-
showStartScroll = scrollLeft > 1;
|
|
66
|
-
showEndScroll = scrollLeft < scrollWidth - clientWidth - 1;
|
|
62
|
+
const showStartScroll = scrollLeft > 1;
|
|
63
|
+
const showEndScroll = scrollLeft < scrollWidth - clientWidth - 1;
|
|
67
64
|
setDisplayScroll((displayScroll) => showStartScroll === displayScroll.start &&
|
|
68
65
|
showEndScroll === displayScroll.end
|
|
69
66
|
? displayScroll
|
|
@@ -94,7 +91,9 @@ exports.TabList = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
94
91
|
updateScrollButtonState.clear();
|
|
95
92
|
};
|
|
96
93
|
}, [updateScrollButtonState]);
|
|
97
|
-
const ScrollButton = ({ dir, hidden, }) => (
|
|
94
|
+
const ScrollButton = ({ dir, hidden, }) => (
|
|
95
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
96
|
+
react_1.default.createElement("div", { className: (0, clsx_1.default)("navds-tabs__scroll-button", {
|
|
98
97
|
"navds-tabs__scroll-button--hidden": hidden,
|
|
99
98
|
}), onClick: () => {
|
|
100
99
|
if (!listRef.current)
|
package/cjs/timeline/Pin.js
CHANGED
|
@@ -48,24 +48,30 @@ exports.Pin = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
48
48
|
const arrowRef = (0, react_2.useRef)(null);
|
|
49
49
|
const { context, placement, middlewareData: { arrow: { x: arrowX, y: arrowY } = {} }, refs, floatingStyles, } = (0, react_1.useFloating)({
|
|
50
50
|
placement: "top",
|
|
51
|
-
open
|
|
52
|
-
onOpenChange: setOpen,
|
|
51
|
+
open,
|
|
52
|
+
onOpenChange: (_open) => setOpen(_open),
|
|
53
|
+
whileElementsMounted: react_1.autoUpdate,
|
|
53
54
|
middleware: [
|
|
54
55
|
(0, react_1.offset)(16),
|
|
55
56
|
(0, react_1.shift)(),
|
|
56
57
|
(0, react_1.flip)({ padding: 5, fallbackPlacements: ["bottom", "top"] }),
|
|
57
58
|
(0, react_1.arrow)({ element: arrowRef, padding: 5 }),
|
|
58
59
|
],
|
|
59
|
-
whileElementsMounted: react_1.autoUpdate,
|
|
60
60
|
});
|
|
61
|
+
const hover = (0, react_1.useHover)(context, {
|
|
62
|
+
handleClose: (0, react_1.safePolygon)(),
|
|
63
|
+
restMs: 25,
|
|
64
|
+
delay: { open: 1000 },
|
|
65
|
+
move: false,
|
|
66
|
+
});
|
|
67
|
+
const focus = (0, react_1.useFocus)(context);
|
|
68
|
+
const dismiss = (0, react_1.useDismiss)(context);
|
|
69
|
+
const role = (0, react_1.useRole)(context, { role: "dialog" });
|
|
61
70
|
const { getFloatingProps, getReferenceProps } = (0, react_1.useInteractions)([
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}),
|
|
67
|
-
(0, react_1.useFocus)(context),
|
|
68
|
-
(0, react_1.useDismiss)(context),
|
|
71
|
+
hover,
|
|
72
|
+
focus,
|
|
73
|
+
dismiss,
|
|
74
|
+
role,
|
|
69
75
|
]);
|
|
70
76
|
const mergedRef = (0, react_2.useMemo)(() => (0, util_1.mergeRefs)([refs.setReference, ref]), [ref, refs.setReference]);
|
|
71
77
|
const staticSide = {
|
|
@@ -88,16 +94,10 @@ exports.Pin = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
88
94
|
}
|
|
89
95
|
},
|
|
90
96
|
})))),
|
|
91
|
-
children && (react_2.default.createElement(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
setOpen(false),
|
|
96
|
-
}), { style: Object.assign(Object.assign({}, floatingStyles), { display: open ? undefined : "none" }) }),
|
|
97
|
-
react_2.default.createElement("div", { className: "navds-timeline__popover-content" }, children),
|
|
98
|
-
react_2.default.createElement("div", { ref: (node) => {
|
|
99
|
-
arrowRef.current = node;
|
|
100
|
-
}, style: Object.assign(Object.assign(Object.assign({}, (arrowX != null ? { left: arrowX } : {})), (arrowY != null ? { top: arrowY } : {})), (staticSide ? { [staticSide]: "-0.5rem" } : {})), className: "navds-timeline__popover-arrow" })))));
|
|
97
|
+
children && open && (react_2.default.createElement(react_1.FloatingFocusManager, { context: context, modal: false, initialFocus: -1, returnFocus: false },
|
|
98
|
+
react_2.default.createElement("div", Object.assign({ className: "navds-timeline__popover", "data-placement": placement, ref: refs.setFloating }, getFloatingProps(), { tabIndex: undefined, style: floatingStyles }),
|
|
99
|
+
children,
|
|
100
|
+
react_2.default.createElement("div", { ref: arrowRef, style: Object.assign(Object.assign(Object.assign({}, (arrowX != null ? { left: arrowX } : {})), (arrowY != null ? { top: arrowY } : {})), (staticSide ? { [staticSide]: "-0.5rem" } : {})), className: "navds-timeline__popover-arrow" }))))));
|
|
101
101
|
});
|
|
102
102
|
exports.Pin.componentType = "pin";
|
|
103
103
|
exports.default = exports.Pin;
|
package/cjs/timeline/Timeline.js
CHANGED
|
@@ -75,7 +75,9 @@ exports.Timeline = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
75
75
|
children = [children];
|
|
76
76
|
}
|
|
77
77
|
const rowChildren = react_1.default.Children.toArray(children).filter((c) => { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.type) === null || _a === void 0 ? void 0 : _a.componentType) === "row"; });
|
|
78
|
-
const pins = react_1.default.Children.toArray(children)
|
|
78
|
+
const pins = react_1.default.Children.toArray(children)
|
|
79
|
+
.filter((c) => { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.type) === null || _a === void 0 ? void 0 : _a.componentType) === "pin"; })
|
|
80
|
+
.map((x) => () => x);
|
|
79
81
|
const zoomComponent = react_1.default.Children.toArray(children).find((c) => { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.type) === null || _a === void 0 ? void 0 : _a.componentType) === "zoom"; });
|
|
80
82
|
const rowsRaw = (0, react_1.useMemo)(() => {
|
|
81
83
|
return (0, timeline_1.parseRows)(rowChildren);
|
|
@@ -159,9 +161,7 @@ exports.Timeline = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
159
161
|
react_1.default.createElement("div", Object.assign({}, rest, { ref: ref }),
|
|
160
162
|
react_1.default.createElement("div", { className: "navds-timeline" },
|
|
161
163
|
react_1.default.createElement(AxisLabels_1.AxisLabels, { templates: axisLabelTemplates }),
|
|
162
|
-
pins.map((
|
|
163
|
-
return pin;
|
|
164
|
-
}),
|
|
164
|
+
pins.map((Pin, i) => (react_1.default.createElement(Pin, { key: `pin-${i}` }))),
|
|
165
165
|
processedRows.map((row, i) => {
|
|
166
166
|
return (react_1.default.createElement(useRowContext_1.RowContext.Provider, { key: `row-${row.id}`, value: {
|
|
167
167
|
periods: row.periods,
|
|
@@ -43,23 +43,29 @@ const ClickablePeriod = react_2.default.memo(({ onSelectPeriod, start, end, stat
|
|
|
43
43
|
const { context, placement, middlewareData: { arrow: { x: arrowX, y: arrowY } = {} }, refs, floatingStyles, } = (0, react_1.useFloating)({
|
|
44
44
|
placement: "top",
|
|
45
45
|
open: open,
|
|
46
|
-
onOpenChange: setOpen,
|
|
46
|
+
onOpenChange: (_open) => setOpen(_open),
|
|
47
|
+
whileElementsMounted: react_1.autoUpdate,
|
|
47
48
|
middleware: [
|
|
48
49
|
(0, react_1.offset)(16),
|
|
49
50
|
(0, react_1.shift)(),
|
|
50
51
|
(0, react_1.flip)({ padding: 5, fallbackPlacements: ["bottom", "top"] }),
|
|
51
52
|
(0, react_1.arrow)({ element: arrowRef, padding: 5 }),
|
|
52
53
|
],
|
|
53
|
-
whileElementsMounted: react_1.autoUpdate,
|
|
54
54
|
});
|
|
55
|
+
const hover = (0, react_1.useHover)(context, {
|
|
56
|
+
handleClose: (0, react_1.safePolygon)(),
|
|
57
|
+
restMs: 25,
|
|
58
|
+
delay: { open: 1000 },
|
|
59
|
+
move: false,
|
|
60
|
+
});
|
|
61
|
+
const focus = (0, react_1.useFocus)(context);
|
|
62
|
+
const dismiss = (0, react_1.useDismiss)(context);
|
|
63
|
+
const role = (0, react_1.useRole)(context, { role: "dialog" });
|
|
55
64
|
const { getFloatingProps, getReferenceProps } = (0, react_1.useInteractions)([
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}),
|
|
61
|
-
(0, react_1.useFocus)(context),
|
|
62
|
-
(0, react_1.useDismiss)(context),
|
|
65
|
+
hover,
|
|
66
|
+
focus,
|
|
67
|
+
dismiss,
|
|
68
|
+
role,
|
|
63
69
|
]);
|
|
64
70
|
const mergedRef = (0, react_2.useMemo)(() => (0, util_1.mergeRefs)([refs.setReference, periodRef]), [periodRef, refs.setReference]);
|
|
65
71
|
const staticSide = {
|
|
@@ -103,15 +109,9 @@ const ClickablePeriod = react_2.default.memo(({ onSelectPeriod, start, end, stat
|
|
|
103
109
|
},
|
|
104
110
|
})),
|
|
105
111
|
react_2.default.createElement("span", { className: "navds-timeline__period--inner" }, icon)),
|
|
106
|
-
children && (react_2.default.createElement(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
setOpen(false),
|
|
111
|
-
}), { style: Object.assign(Object.assign({}, floatingStyles), { display: open ? undefined : "none" }) }),
|
|
112
|
-
react_2.default.createElement("div", { className: "navds-timeline__popover-content" }, children),
|
|
113
|
-
react_2.default.createElement("div", { ref: (node) => {
|
|
114
|
-
arrowRef.current = node;
|
|
115
|
-
}, style: Object.assign(Object.assign(Object.assign({}, (arrowX != null ? { left: arrowX } : {})), (arrowY != null ? { top: arrowY } : {})), (staticSide ? { [staticSide]: "-0.5rem" } : {})), className: "navds-timeline__popover-arrow" })))));
|
|
112
|
+
children && open && (react_2.default.createElement(react_1.FloatingFocusManager, { context: context, modal: false, initialFocus: -1, returnFocus: false },
|
|
113
|
+
react_2.default.createElement("div", Object.assign({ className: "navds-timeline__popover", "data-placement": placement, ref: refs.setFloating }, getFloatingProps(), { style: floatingStyles }),
|
|
114
|
+
children,
|
|
115
|
+
react_2.default.createElement("div", { ref: arrowRef, style: Object.assign(Object.assign(Object.assign({}, (arrowX != null ? { left: arrowX } : {})), (arrowY != null ? { top: arrowY } : {})), (staticSide ? { [staticSide]: "-0.5rem" } : {})), className: "navds-timeline__popover-arrow" }))))));
|
|
116
116
|
});
|
|
117
117
|
exports.default = ClickablePeriod;
|
|
@@ -40,7 +40,7 @@ exports.Period = (0, react_1.forwardRef)(({ icon }, ref) => {
|
|
|
40
40
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
41
41
|
}
|
|
42
42
|
const { start, endInclusive, width, horizontalPosition, status = "neutral", onSelectPeriod, cropped, direction, children, isActive, statusLabel, } = period;
|
|
43
|
-
return onSelectPeriod || children ? (react_1.default.createElement(ClickablePeriod_1.default, { periodRef: ref, start: start, end: endInclusive, status: status, onSelectPeriod: onSelectPeriod, cropped: cropped || "", direction: direction, width: width, left: horizontalPosition, icon: icon,
|
|
43
|
+
return onSelectPeriod || children ? (react_1.default.createElement(ClickablePeriod_1.default, { periodRef: ref, start: start, end: endInclusive, status: status, onSelectPeriod: onSelectPeriod, cropped: cropped || "", direction: direction, width: width, left: horizontalPosition, icon: icon, isActive: isActive, statusLabel: statusLabel, restProps: restProps }, children)) : (react_1.default.createElement(NonClickablePeriod_1.default, { periodRef: ref, start: start, end: endInclusive, status: status, cropped: cropped || "", direction: direction, width: width, left: horizontalPosition, icon: icon, statusLabel: statusLabel, restProps: restProps }));
|
|
44
44
|
});
|
|
45
45
|
exports.Period.componentType = "period";
|
|
46
46
|
exports.default = exports.Period;
|
|
@@ -7,10 +7,10 @@ exports.parseRows = void 0;
|
|
|
7
7
|
const util_1 = require("../../util");
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const parseRows = (rowChildren) => {
|
|
10
|
-
|
|
10
|
+
const parsedChildren = [];
|
|
11
11
|
rowChildren === null || rowChildren === void 0 ? void 0 : rowChildren.forEach((r) => {
|
|
12
12
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
13
|
-
|
|
13
|
+
const periods = [];
|
|
14
14
|
if (react_1.default.isValidElement(r) && ((_a = r === null || r === void 0 ? void 0 : r.props) === null || _a === void 0 ? void 0 : _a.children)) {
|
|
15
15
|
if (Array.isArray(r.props.children)) {
|
|
16
16
|
for (let i = 0; i < r.props.children.length; i++) {
|
|
@@ -68,7 +68,7 @@ const parseRows = (rowChildren) => {
|
|
|
68
68
|
label: r.props.label,
|
|
69
69
|
icon: r.props.icon,
|
|
70
70
|
headingTag: r.props.headingTag,
|
|
71
|
-
periods
|
|
71
|
+
periods,
|
|
72
72
|
restProps: (0, util_1.omit)(r.props, ["label", "icon", "headingTag"]),
|
|
73
73
|
ref: r === null || r === void 0 ? void 0 : r.ref,
|
|
74
74
|
});
|
|
@@ -60,7 +60,7 @@ exports.ToggleGroupContext = (0, react_1.createContext)(null);
|
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
62
|
exports.ToggleGroup = (0, react_1.forwardRef)((_a, ref) => {
|
|
63
|
-
var { className, children, onChange, size = "medium", label, value, defaultValue,
|
|
63
|
+
var { className, children, onChange, size = "medium", label, value, defaultValue, "aria-describedby": desc, variant = "action" } = _a, rest = __rest(_a, ["className", "children", "onChange", "size", "label", "value", "defaultValue", "aria-describedby", "variant"]);
|
|
64
64
|
const [groupValue, setGroupValue] = (0, react_1.useState)(defaultValue);
|
|
65
65
|
const labelId = (0, __1.useId)();
|
|
66
66
|
const handleValueChange = (v) => {
|
package/cjs/tooltip/Tooltip.js
CHANGED
|
@@ -65,7 +65,7 @@ exports.Tooltip = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
65
65
|
const { x, y, strategy, context, placement, middlewareData: { arrow: { x: arrowX, y: arrowY } = {}, hide: { referenceHidden } = {}, }, refs, } = (0, react_1.useFloating)({
|
|
66
66
|
placement: _placement,
|
|
67
67
|
open: userOpen !== null && userOpen !== void 0 ? userOpen : open,
|
|
68
|
-
onOpenChange: setOpen,
|
|
68
|
+
onOpenChange: (_open) => setOpen(_open),
|
|
69
69
|
middleware: [
|
|
70
70
|
(0, react_1.offset)(_offset ? _offset : _arrow ? 10 : 2),
|
|
71
71
|
(0, react_1.shift)(),
|
|
@@ -57,7 +57,7 @@ const util_1 = require("./util");
|
|
|
57
57
|
*/
|
|
58
58
|
exports.Heading = (0, react_1.forwardRef)((_a, ref) => {
|
|
59
59
|
var { level = "1", size, className, as, spacing, align, visuallyHidden, textColor } = _a, rest = __rest(_a, ["level", "size", "className", "as", "spacing", "align", "visuallyHidden", "textColor"]);
|
|
60
|
-
|
|
60
|
+
const HeadingTag = as !== null && as !== void 0 ? as : `h${level}`;
|
|
61
61
|
return (react_1.default.createElement(HeadingTag, Object.assign({}, rest, { ref: ref, className: (0, clsx_1.default)(className, "navds-heading", `navds-heading--${size}`, (0, util_1.typoClassNames)({
|
|
62
62
|
spacing,
|
|
63
63
|
align,
|
package/cjs/util/RandomIcon.js
CHANGED
|
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.RandomIcon = void 0;
|
|
30
30
|
const AllIcons = __importStar(require("@navikt/aksel-icons"));
|
|
31
31
|
const react_1 = __importDefault(require("react"));
|
|
32
|
+
// eslint-disable-next-line import/namespace
|
|
32
33
|
const icons = Object.keys(AllIcons).map((key) => AllIcons[key]);
|
|
33
34
|
const RandomIcon = () => {
|
|
34
35
|
const Icon = icons[Math.floor(Math.random() * icons.length)];
|
package/cjs/util/Slot.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.Slot = void 0;
|
|
41
|
+
// https://github.com/radix-ui/primitives/blob/main/packages/react/slot/src/Slot.tsx
|
|
42
|
+
const React = __importStar(require("react"));
|
|
43
|
+
const mergeRefs_1 = __importDefault(require("./mergeRefs"));
|
|
44
|
+
exports.Slot = React.forwardRef((props, forwardedRef) => {
|
|
45
|
+
const { children } = props, slotProps = __rest(props, ["children"]);
|
|
46
|
+
if (React.isValidElement(children)) {
|
|
47
|
+
return React.cloneElement(children, Object.assign(Object.assign({}, mergeProps(slotProps, children.props)), { ref: forwardedRef
|
|
48
|
+
? (0, mergeRefs_1.default)([forwardedRef, children.ref])
|
|
49
|
+
: children.ref }));
|
|
50
|
+
}
|
|
51
|
+
if (React.Children.count(children) > 1) {
|
|
52
|
+
console.error("Aksel: Components using 'asChild' expects to recieve a single React element child.");
|
|
53
|
+
return React.Children.only(null);
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
});
|
|
57
|
+
function mergeProps(slotProps, childProps) {
|
|
58
|
+
// all child props should override
|
|
59
|
+
const overrideProps = Object.assign({}, childProps);
|
|
60
|
+
for (const propName in childProps) {
|
|
61
|
+
const slotPropValue = slotProps[propName];
|
|
62
|
+
const childPropValue = childProps[propName];
|
|
63
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
64
|
+
if (isHandler) {
|
|
65
|
+
// if the handler exists on both, we compose them
|
|
66
|
+
if (slotPropValue && childPropValue) {
|
|
67
|
+
overrideProps[propName] = (...args) => {
|
|
68
|
+
childPropValue(...args);
|
|
69
|
+
slotPropValue(...args);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// but if it exists only on the slot, we use only this one
|
|
73
|
+
else if (slotPropValue) {
|
|
74
|
+
overrideProps[propName] = slotPropValue;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// if it's `style`, we merge them
|
|
78
|
+
else if (propName === "style") {
|
|
79
|
+
overrideProps[propName] = Object.assign(Object.assign({}, slotPropValue), childPropValue);
|
|
80
|
+
}
|
|
81
|
+
else if (propName === "className") {
|
|
82
|
+
overrideProps[propName] = [slotPropValue, childPropValue]
|
|
83
|
+
.filter(Boolean)
|
|
84
|
+
.join(" ");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return Object.assign(Object.assign({}, slotProps), overrideProps);
|
|
88
|
+
}
|
package/cjs/util/useId.js
CHANGED
|
@@ -42,10 +42,8 @@ function useGlobalId(idOverride) {
|
|
|
42
42
|
}, [defaultId]);
|
|
43
43
|
return id;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// eslint-disable-next-line no-useless-concat
|
|
48
|
-
"useId" + ""];
|
|
45
|
+
const maybeReactUseId = react_1.default["useId" + "" // Workaround for https://github.com/webpack/webpack/issues/14814
|
|
46
|
+
];
|
|
49
47
|
/**
|
|
50
48
|
*
|
|
51
49
|
* @example <div id={useId()} />
|
|
@@ -41,6 +41,7 @@ export const Accordion = forwardRef((_a, ref) => {
|
|
|
41
41
|
variant,
|
|
42
42
|
headingSize,
|
|
43
43
|
size,
|
|
44
|
+
mounted: true,
|
|
44
45
|
} },
|
|
45
46
|
React.createElement("div", Object.assign({}, rest, { className: cl("navds-accordion", className, `navds-accordion--${size}`, { "navds-accordion--indent": indent }), ref: ref }))));
|
|
46
47
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/accordion/Accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,aAAqC,MAAM,iBAAiB,CAAC;AACpE,OAAO,gBAA2C,MAAM,oBAAoB,CAAC;AAC7E,OAAO,eAAyC,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAkDtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CACjC,CACE,EAOC,EACD,GAAG,EACH,EAAE;QATF,EACE,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,WAAW,GAAG,OAAO,EACrB,IAAI,GAAG,QAAQ,EACf,MAAM,GAAG,IAAI,OAEd,EADI,IAAI,cANT,yDAOC,CADQ;IAIT,OAAO,CACL,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,EAAE;YACL,OAAO;YACP,WAAW;YACX,IAAI;
|
|
1
|
+
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/accordion/Accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,aAAqC,MAAM,iBAAiB,CAAC;AACpE,OAAO,gBAA2C,MAAM,oBAAoB,CAAC;AAC7E,OAAO,eAAyC,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAkDtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CACjC,CACE,EAOC,EACD,GAAG,EACH,EAAE;QATF,EACE,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,WAAW,GAAG,OAAO,EACrB,IAAI,GAAG,QAAQ,EACf,MAAM,GAAG,IAAI,OAEd,EADI,IAAI,cANT,yDAOC,CADQ;IAIT,OAAO,CACL,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,EAAE;YACL,OAAO;YACP,WAAW;YACX,IAAI;YACJ,OAAO,EAAE,IAAI;SACd;QAED,6CACM,IAAI,IACR,SAAS,EAAE,EAAE,CACX,iBAAiB,EACjB,SAAS,EACT,oBAAoB,IAAI,EAAE,EAC1B,EAAE,yBAAyB,EAAE,MAAM,EAAE,CACtC,EACD,GAAG,EAAE,GAAG,IACR,CACwB,CAC7B,CAAC;AACJ,CAAC,CACoB,CAAC;AAExB,SAAS,CAAC,MAAM,GAAG,eAAe,CAAC;AACnC,SAAS,CAAC,OAAO,GAAG,gBAAgB,CAAC;AACrC,SAAS,CAAC,IAAI,GAAG,aAAa,CAAC;AAE/B,eAAe,SAAS,CAAC"}
|
|
@@ -4,5 +4,6 @@ export type AccordionContextProps = {
|
|
|
4
4
|
headingSize?: "large" | "medium" | "small" | "xsmall";
|
|
5
5
|
size?: "large" | "medium" | "small";
|
|
6
6
|
openItems?: number[];
|
|
7
|
+
mounted: boolean;
|
|
7
8
|
};
|
|
8
9
|
export declare const AccordionContext: import("react").Context<AccordionContextProps | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionContext.js","sourceRoot":"","sources":["../../src/accordion/AccordionContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AccordionContext.js","sourceRoot":"","sources":["../../src/accordion/AccordionContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAUtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAA+B;IAC1E,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,KAAK;CACf,CAAC,CAAC"}
|