@navikt/ds-react 5.13.0 → 5.14.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 +206 -135
- package/cjs/accordion/AccordionHeader.js +2 -4
- package/cjs/button/Button.js +11 -12
- package/cjs/chips/Removable.js +3 -6
- package/cjs/copybutton/CopyButton.js +4 -5
- package/cjs/date/datepicker/DatePicker.js +4 -2
- package/cjs/date/datepicker/parts/WeekRow.js +2 -2
- package/cjs/date/monthpicker/MonthPicker.js +4 -3
- package/cjs/date/parts/DateWrapper.js +2 -2
- package/cjs/dropdown/Menu/GroupedList/GroupedItem.js +3 -6
- package/cjs/dropdown/Menu/List/Item.js +3 -6
- package/cjs/dropdown/Toggle.js +6 -5
- package/cjs/form/ConfirmationPanel.js +2 -2
- package/cjs/form/Textarea.js +2 -1
- package/cjs/form/checkbox/Checkbox.js +3 -2
- package/cjs/form/combobox/Combobox.js +2 -2
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +3 -4
- package/cjs/form/combobox/Input/inputContext.js +2 -2
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +2 -5
- package/cjs/form/error-summary/ErrorSummary.js +2 -2
- package/cjs/form/radio/Radio.js +3 -2
- package/cjs/form/radio/RadioGroup.js +2 -2
- package/cjs/form/search/Search.js +2 -1
- package/cjs/form/search/SearchButton.js +2 -4
- package/cjs/form/useFormField.js +2 -2
- package/cjs/guide-panel/Illustration.js +2 -2
- package/cjs/help-text/HelpText.js +5 -7
- package/cjs/help-text/HelpTextIcon.js +2 -2
- package/cjs/list/List.js +2 -2
- package/cjs/loader/Loader.js +2 -1
- package/cjs/modal/Modal.js +21 -18
- package/cjs/popover/Popover.js +6 -5
- package/cjs/read-more/ReadMore.js +2 -4
- package/cjs/stepper/Step.js +6 -6
- package/cjs/table/DataCell.js +2 -2
- package/cjs/table/ExpandableRow.js +9 -9
- package/cjs/table/HeaderCell.js +2 -1
- package/cjs/tabs/TabList.js +2 -1
- package/cjs/tag/Tag.js +4 -2
- package/cjs/timeline/Pin.js +2 -2
- package/cjs/timeline/period/ClickablePeriod.js +2 -2
- package/cjs/toggle-group/ToggleGroup.js +2 -2
- package/cjs/tooltip/Tooltip.js +6 -5
- package/cjs/util/Slot.js +2 -5
- package/cjs/util/TextareaAutoSize.js +7 -5
- package/cjs/util/composeEventHandlers.js +17 -0
- package/cjs/util/hooks/index.js +19 -0
- package/cjs/util/hooks/package.json +6 -0
- package/cjs/util/hooks/useClientLayoutEffect.js +7 -0
- package/cjs/util/hooks/useMergeRefs.js +37 -0
- package/cjs/util/{usePrevious.js → hooks/usePrevious.js} +2 -1
- package/cjs/util/index.js +7 -7
- package/cjs/util/types/index.js +2 -0
- package/cjs/util/types/package.json +6 -0
- package/esm/accordion/AccordionHeader.js +2 -4
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/button/Button.d.ts +1 -1
- package/esm/button/Button.js +12 -13
- package/esm/button/Button.js.map +1 -1
- package/esm/chips/Chips.d.ts +1 -1
- package/esm/chips/Removable.js +3 -6
- package/esm/chips/Removable.js.map +1 -1
- package/esm/chips/Toggle.d.ts +1 -1
- package/esm/copybutton/CopyButton.js +4 -5
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/datepicker/DatePicker.js +5 -3
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/parts/WeekRow.js +1 -1
- package/esm/date/datepicker/parts/WeekRow.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.js +4 -3
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/date/parts/DateWrapper.js +1 -1
- package/esm/date/parts/DateWrapper.js.map +1 -1
- package/esm/dropdown/Menu/GroupedList/GroupedItem.d.ts +1 -1
- package/esm/dropdown/Menu/GroupedList/GroupedItem.js +3 -6
- package/esm/dropdown/Menu/GroupedList/GroupedItem.js.map +1 -1
- package/esm/dropdown/Menu/GroupedList/index.d.ts +1 -1
- package/esm/dropdown/Menu/List/Item.d.ts +1 -1
- package/esm/dropdown/Menu/List/Item.js +3 -6
- package/esm/dropdown/Menu/List/Item.js.map +1 -1
- package/esm/dropdown/Menu/List/index.d.ts +1 -1
- package/esm/dropdown/Toggle.js +6 -5
- package/esm/dropdown/Toggle.js.map +1 -1
- package/esm/expansion-card/ExpansionCard.d.ts +1 -1
- package/esm/expansion-card/ExpansionCardTitle.d.ts +1 -1
- package/esm/form/ConfirmationPanel.js +1 -1
- package/esm/form/ConfirmationPanel.js.map +1 -1
- package/esm/form/Textarea.js +2 -1
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/Checkbox.js +2 -1
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/combobox/Combobox.js +3 -3
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +1 -2
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/Input/inputContext.js +1 -1
- package/esm/form/combobox/Input/inputContext.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/esm/form/error-summary/ErrorSummary.js +1 -1
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/form/error-summary/ErrorSummaryItem.d.ts +1 -1
- package/esm/form/radio/Radio.js +2 -1
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/radio/RadioGroup.js +1 -1
- package/esm/form/radio/RadioGroup.js.map +1 -1
- package/esm/form/search/Search.js +4 -3
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/search/SearchButton.js +2 -4
- package/esm/form/search/SearchButton.js.map +1 -1
- package/esm/form/useFormField.js +1 -1
- package/esm/form/useFormField.js.map +1 -1
- package/esm/guide-panel/Illustration.js +1 -1
- package/esm/guide-panel/Illustration.js.map +1 -1
- package/esm/help-text/HelpText.d.ts +0 -5
- package/esm/help-text/HelpText.js +6 -8
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/help-text/HelpTextIcon.js +1 -1
- package/esm/internal-header/InternalHeader.d.ts +1 -1
- package/esm/internal-header/InternalHeaderButton.d.ts +1 -1
- package/esm/internal-header/InternalHeaderTitle.d.ts +1 -1
- package/esm/internal-header/InternalHeaderUserButton.d.ts +1 -1
- package/esm/layout/box/Box.d.ts +1 -1
- package/esm/layout/page/parts/PageBlock.d.ts +1 -1
- package/esm/layout/stack/HStack.d.ts +1 -1
- package/esm/layout/stack/Stack.d.ts +1 -1
- package/esm/layout/stack/VStack.d.ts +1 -1
- package/esm/link/Link.d.ts +1 -1
- package/esm/link-panel/LinkPanel.d.ts +1 -1
- package/esm/link-panel/LinkPanelTitle.d.ts +1 -1
- package/esm/list/List.js +1 -1
- package/esm/loader/Loader.js +2 -1
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.js +21 -18
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/types.d.ts +1 -1
- package/esm/pagination/PaginationItem.d.ts +1 -1
- package/esm/panel/Panel.d.ts +1 -1
- package/esm/popover/Popover.d.ts +1 -1
- package/esm/popover/Popover.js +4 -3
- package/esm/popover/Popover.js.map +1 -1
- package/esm/read-more/ReadMore.js +2 -4
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/stepper/Step.d.ts +1 -1
- package/esm/stepper/Step.js +6 -6
- package/esm/stepper/Step.js.map +1 -1
- package/esm/table/AnimateHeight.js.map +1 -0
- package/esm/table/DataCell.d.ts +4 -0
- package/esm/table/DataCell.js +2 -2
- package/esm/table/DataCell.js.map +1 -1
- package/esm/table/ExpandableRow.js +8 -8
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/table/HeaderCell.d.ts +4 -0
- package/esm/table/HeaderCell.js +2 -1
- package/esm/table/HeaderCell.js.map +1 -1
- package/esm/tabs/Tab.d.ts +1 -1
- package/esm/tabs/TabList.js +3 -2
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +1 -1
- package/esm/tag/Tag.d.ts +4 -0
- package/esm/tag/Tag.js +4 -2
- package/esm/tag/Tag.js.map +1 -1
- package/esm/timeline/Pin.js +3 -3
- package/esm/timeline/Pin.js.map +1 -1
- package/esm/timeline/period/ClickablePeriod.js +3 -3
- package/esm/timeline/period/ClickablePeriod.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 +6 -5
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/BodyLong.d.ts +1 -1
- package/esm/typography/BodyShort.d.ts +1 -1
- package/esm/typography/Detail.d.ts +1 -1
- package/esm/typography/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/util/Slot.js +1 -1
- package/esm/util/Slot.js.map +1 -1
- package/esm/util/TextareaAutoSize.js +5 -3
- package/esm/util/TextareaAutoSize.js.map +1 -1
- package/esm/util/composeEventHandlers.d.ts +8 -0
- package/esm/util/composeEventHandlers.js +14 -0
- package/esm/util/composeEventHandlers.js.map +1 -0
- package/esm/util/hooks/index.d.ts +8 -0
- package/esm/util/hooks/index.js +9 -0
- package/esm/util/hooks/index.js.map +1 -0
- package/esm/util/hooks/useClientLayoutEffect.js +5 -0
- package/esm/util/hooks/useClientLayoutEffect.js.map +1 -0
- package/esm/util/{useEventListener.d.ts → hooks/useEventListener.d.ts} +1 -1
- package/esm/util/hooks/useEventListener.js.map +1 -0
- package/esm/util/hooks/useId.js.map +1 -0
- package/esm/util/hooks/useMedia.js.map +1 -0
- package/esm/util/hooks/useMergeRefs.d.ts +15 -0
- package/esm/util/hooks/useMergeRefs.js +30 -0
- package/esm/util/hooks/useMergeRefs.js.map +1 -0
- package/esm/util/hooks/usePrevious.d.ts +1 -0
- package/esm/util/{usePrevious.js → hooks/usePrevious.js} +1 -2
- package/esm/util/hooks/usePrevious.js.map +1 -0
- package/esm/util/index.d.ts +4 -5
- package/esm/util/index.js +3 -5
- package/esm/util/index.js.map +1 -1
- package/esm/util/types/OverridableComponent.js.map +1 -0
- package/esm/util/types/index.d.ts +1 -0
- package/esm/util/types/index.js +2 -0
- package/esm/util/types/index.js.map +1 -0
- package/package.json +3 -3
- package/src/accordion/AccordionHeader.tsx +2 -4
- package/src/accordion/AccordionItem.tsx +2 -2
- package/src/alert/alert.stories.tsx +1 -2
- package/src/button/Button.tsx +14 -19
- package/src/chips/Chips.tsx +1 -1
- package/src/chips/Removable.tsx +3 -4
- package/src/chips/Toggle.tsx +1 -1
- package/src/copybutton/CopyButton.tsx +4 -5
- package/src/copybutton/copy-button.stories.tsx +1 -1
- package/src/date/datepicker/DatePicker.tsx +5 -3
- package/src/date/datepicker/parts/WeekRow.tsx +1 -1
- package/src/date/monthpicker/MonthPicker.tsx +4 -3
- package/src/date/parts/DateWrapper.tsx +1 -1
- package/src/dropdown/Menu/GroupedList/GroupedItem.tsx +23 -23
- package/src/dropdown/Menu/GroupedList/index.tsx +1 -1
- package/src/dropdown/Menu/List/Item.tsx +23 -23
- package/src/dropdown/Menu/List/index.tsx +1 -1
- package/src/dropdown/Toggle.tsx +10 -6
- package/src/expansion-card/ExpansionCard.tsx +1 -1
- package/src/expansion-card/ExpansionCardTitle.tsx +1 -1
- package/src/form/ConfirmationPanel.tsx +1 -1
- package/src/form/Textarea.tsx +2 -1
- package/src/form/checkbox/Checkbox.tsx +2 -1
- package/src/form/combobox/Combobox.tsx +3 -6
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +1 -2
- package/src/form/combobox/Input/inputContext.tsx +1 -1
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +1 -1
- package/src/form/combobox/combobox.stories.tsx +10 -11
- package/src/form/error-summary/ErrorSummary.tsx +1 -1
- package/src/form/error-summary/ErrorSummaryItem.tsx +1 -1
- package/src/form/radio/Radio.tsx +2 -1
- package/src/form/radio/RadioGroup.tsx +1 -1
- package/src/form/search/Search.tsx +3 -3
- package/src/form/search/SearchButton.tsx +2 -4
- package/src/form/useFormField.ts +1 -1
- package/src/guide-panel/Illustration.tsx +1 -1
- package/src/help-text/HelpText.tsx +7 -25
- package/src/help-text/HelpTextIcon.tsx +1 -1
- package/src/help-text/help-text.stories.tsx +58 -68
- package/src/internal-header/InternalHeader.tsx +1 -1
- package/src/internal-header/InternalHeaderButton.tsx +1 -1
- package/src/internal-header/InternalHeaderTitle.tsx +1 -1
- package/src/internal-header/InternalHeaderUserButton.tsx +1 -1
- package/src/layout/box/Box.tsx +1 -1
- package/src/layout/page/parts/PageBlock.tsx +1 -1
- package/src/layout/stack/HStack.tsx +1 -1
- package/src/layout/stack/Stack.tsx +1 -1
- package/src/layout/stack/VStack.tsx +1 -1
- package/src/link/Link.tsx +1 -1
- package/src/link/{link.stories.tsx → stories/link.stories.tsx} +2 -2
- package/src/link-panel/LinkPanel.tsx +1 -1
- package/src/link-panel/LinkPanelTitle.tsx +1 -1
- package/src/list/List.tsx +1 -1
- package/src/loader/Loader.tsx +2 -1
- package/src/modal/Modal.tsx +30 -30
- package/src/modal/types.ts +1 -1
- package/src/pagination/PaginationItem.tsx +1 -1
- package/src/panel/Panel.tsx +1 -1
- package/src/popover/Popover.tsx +4 -7
- package/src/read-more/ReadMore.tsx +2 -4
- package/src/stepper/Step.tsx +8 -5
- package/src/table/DataCell.tsx +6 -1
- package/src/table/ExpandableRow.tsx +11 -6
- package/src/table/HeaderCell.tsx +6 -1
- package/src/table/stories/table.stories.tsx +43 -29
- package/src/table/stories/tests/table.stories.tsx +2 -3
- package/src/tabs/Tab.tsx +1 -1
- package/src/tabs/TabList.tsx +4 -2
- package/src/tabs/Tabs.tsx +1 -1
- package/src/tag/Tag.tsx +9 -2
- package/src/tag/tag.stories.tsx +27 -1
- package/src/timeline/Pin.tsx +3 -6
- package/src/timeline/period/ClickablePeriod.tsx +3 -6
- package/src/toggle-group/ToggleGroup.tsx +1 -1
- package/src/tooltip/Tooltip.tsx +11 -22
- 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/stories/bodylong.stories.tsx +1 -2
- package/src/typography/stories/bodyshort.stories.tsx +1 -2
- package/src/typography/stories/detail.stories.tsx +1 -2
- package/src/typography/stories/error-message.stories.tsx +1 -2
- package/src/typography/stories/heading.stories.tsx +1 -2
- package/src/typography/stories/ingress.stories.tsx +1 -2
- package/src/typography/stories/label.stories.tsx +1 -2
- package/src/util/Slot.tsx +1 -1
- package/src/util/TextareaAutoSize.tsx +7 -3
- package/src/util/__tests__/useMedia.test.tsx +1 -1
- package/src/util/composeEventHandlers.ts +19 -0
- package/src/util/hooks/index.ts +8 -0
- package/src/util/hooks/useCallbackRef.ts +1 -1
- package/src/util/hooks/useClientLayoutEffect.ts +5 -0
- package/src/util/hooks/useControllableState.ts +1 -1
- package/src/util/hooks/useMergeRefs.ts +32 -0
- package/src/util/{usePrevious.ts → hooks/usePrevious.ts} +1 -4
- package/src/util/index.ts +4 -5
- package/src/util/types/index.ts +1 -0
- package/cjs/util/RandomIcon.js +0 -38
- package/cjs/util/mergeRefs.js +0 -16
- package/cjs/util/useClientLayoutEffect.js +0 -10
- package/esm/util/AnimateHeight.js.map +0 -1
- package/esm/util/OverridableComponent.js.map +0 -1
- package/esm/util/RandomIcon.d.ts +0 -2
- package/esm/util/RandomIcon.js +0 -9
- package/esm/util/RandomIcon.js.map +0 -1
- package/esm/util/mergeRefs.d.ts +0 -2
- package/esm/util/mergeRefs.js +0 -14
- package/esm/util/mergeRefs.js.map +0 -1
- package/esm/util/useClientLayoutEffect.js +0 -8
- package/esm/util/useClientLayoutEffect.js.map +0 -1
- package/esm/util/useEventListener.js.map +0 -1
- package/esm/util/useId.js.map +0 -1
- package/esm/util/useMedia.js.map +0 -1
- package/esm/util/usePrevious.d.ts +0 -2
- package/esm/util/usePrevious.js.map +0 -1
- package/src/util/mergeRefs.tsx +0 -16
- package/src/util/useClientLayoutEffect.ts +0 -11
- /package/cjs/{util → table}/AnimateHeight.js +0 -0
- /package/cjs/util/{useEventListener.js → hooks/useEventListener.js} +0 -0
- /package/cjs/util/{useId.js → hooks/useId.js} +0 -0
- /package/cjs/util/{useMedia.js → hooks/useMedia.js} +0 -0
- /package/cjs/util/{OverridableComponent.js → types/OverridableComponent.js} +0 -0
- /package/esm/{util → table}/AnimateHeight.d.ts +0 -0
- /package/esm/{util → table}/AnimateHeight.js +0 -0
- /package/esm/util/{useClientLayoutEffect.d.ts → hooks/useClientLayoutEffect.d.ts} +0 -0
- /package/esm/util/{useEventListener.js → hooks/useEventListener.js} +0 -0
- /package/esm/util/{useId.d.ts → hooks/useId.d.ts} +0 -0
- /package/esm/util/{useId.js → hooks/useId.js} +0 -0
- /package/esm/util/{useMedia.d.ts → hooks/useMedia.d.ts} +0 -0
- /package/esm/util/{useMedia.js → hooks/useMedia.js} +0 -0
- /package/esm/util/{OverridableComponent.d.ts → types/OverridableComponent.d.ts} +0 -0
- /package/esm/util/{OverridableComponent.js → types/OverridableComponent.js} +0 -0
- /package/src/{util → link/stories}/RandomIcon.tsx +0 -0
- /package/src/{util → table}/AnimateHeight.tsx +0 -0
- /package/src/util/{useEventListener.ts → hooks/useEventListener.ts} +0 -0
- /package/src/util/{useId.ts → hooks/useId.ts} +0 -0
- /package/src/util/{useMedia.ts → hooks/useMedia.ts} +0 -0
- /package/src/util/{OverridableComponent.ts → types/OverridableComponent.ts} +0 -0
|
@@ -41,34 +41,34 @@ exports.ExpandableRow = void 0;
|
|
|
41
41
|
const clsx_1 = __importDefault(require("clsx"));
|
|
42
42
|
const react_1 = __importStar(require("react"));
|
|
43
43
|
const aksel_icons_1 = require("@navikt/aksel-icons");
|
|
44
|
-
const
|
|
45
|
-
const
|
|
44
|
+
const composeEventHandlers_1 = require("../util/composeEventHandlers");
|
|
45
|
+
const hooks_1 = require("../util/hooks");
|
|
46
46
|
const useControllableState_1 = require("../util/hooks/useControllableState");
|
|
47
|
+
const AnimateHeight_1 = __importDefault(require("./AnimateHeight"));
|
|
47
48
|
const DataCell_1 = __importDefault(require("./DataCell"));
|
|
48
49
|
const Row_1 = __importDefault(require("./Row"));
|
|
49
50
|
exports.ExpandableRow = (0, react_1.forwardRef)((_a, ref) => {
|
|
50
|
-
var { className, children, content, togglePlacement = "left", defaultOpen = false, open, onOpenChange, expansionDisabled = false, expandOnRowClick = false, colSpan = 999 } = _a, rest = __rest(_a, ["className", "children", "content", "togglePlacement", "defaultOpen", "open", "onOpenChange", "expansionDisabled", "expandOnRowClick", "colSpan"]);
|
|
51
|
+
var { className, children, content, togglePlacement = "left", defaultOpen = false, open, onOpenChange, expansionDisabled = false, expandOnRowClick = false, colSpan = 999, onClick } = _a, rest = __rest(_a, ["className", "children", "content", "togglePlacement", "defaultOpen", "open", "onOpenChange", "expansionDisabled", "expandOnRowClick", "colSpan", "onClick"]);
|
|
51
52
|
const [_open, _setOpen] = (0, useControllableState_1.useControllableState)({
|
|
52
53
|
defaultValue: defaultOpen,
|
|
53
54
|
value: open,
|
|
54
55
|
onChange: onOpenChange,
|
|
55
56
|
});
|
|
56
|
-
const id = (0,
|
|
57
|
+
const id = (0, hooks_1.useId)();
|
|
57
58
|
const expansionHandler = (e) => {
|
|
58
59
|
_setOpen((x) => !x);
|
|
59
60
|
e.stopPropagation();
|
|
60
61
|
};
|
|
61
62
|
const onRowClick = (e) => !isInteractiveTarget(e.target) && expansionHandler(e);
|
|
63
|
+
const handleRowClick = (e) => {
|
|
64
|
+
!expansionDisabled && expandOnRowClick && onRowClick(e);
|
|
65
|
+
};
|
|
62
66
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
63
67
|
react_1.default.createElement(Row_1.default, Object.assign({}, rest, { ref: ref, className: (0, clsx_1.default)("navds-table__expandable-row", className, {
|
|
64
68
|
"navds-table__expandable-row--open": _open,
|
|
65
69
|
"navds-table__expandable-row--expansion-disabled": expansionDisabled,
|
|
66
70
|
"navds-table__expandable-row--clickable": expandOnRowClick,
|
|
67
|
-
}), onClick: (
|
|
68
|
-
var _a;
|
|
69
|
-
!expansionDisabled && expandOnRowClick && onRowClick(e);
|
|
70
|
-
(_a = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, e);
|
|
71
|
-
} }),
|
|
71
|
+
}), onClick: (0, composeEventHandlers_1.composeEventHandlers)(onClick, handleRowClick) }),
|
|
72
72
|
togglePlacement === "right" && children,
|
|
73
73
|
react_1.default.createElement(DataCell_1.default, { className: (0, clsx_1.default)("navds-table__toggle-expand-cell", {
|
|
74
74
|
"navds-table__toggle-expand-cell--open": _open,
|
package/cjs/table/HeaderCell.js
CHANGED
|
@@ -41,9 +41,10 @@ exports.HeaderCell = void 0;
|
|
|
41
41
|
const clsx_1 = __importDefault(require("clsx"));
|
|
42
42
|
const react_1 = __importStar(require("react"));
|
|
43
43
|
exports.HeaderCell = (0, react_1.forwardRef)((_a, ref) => {
|
|
44
|
-
var { className, children, align } = _a, rest = __rest(_a, ["className", "children", "align"]);
|
|
44
|
+
var { className, children, align, textSize } = _a, rest = __rest(_a, ["className", "children", "align", "textSize"]);
|
|
45
45
|
return (react_1.default.createElement("th", Object.assign({ ref: ref, className: (0, clsx_1.default)("navds-table__header-cell", "navds-label", className, {
|
|
46
46
|
[`navds-table__header-cell--align-${align}`]: align,
|
|
47
|
+
"navds-label--small": textSize === "small",
|
|
47
48
|
}) }, rest), children));
|
|
48
49
|
});
|
|
49
50
|
exports.default = exports.HeaderCell;
|
package/cjs/tabs/TabList.js
CHANGED
|
@@ -43,12 +43,13 @@ const clsx_1 = __importDefault(require("clsx"));
|
|
|
43
43
|
const react_1 = __importStar(require("react"));
|
|
44
44
|
const aksel_icons_1 = require("@navikt/aksel-icons");
|
|
45
45
|
const util_1 = require("../util");
|
|
46
|
+
const useMergeRefs_1 = require("../util/hooks/useMergeRefs");
|
|
46
47
|
const context_1 = require("./context");
|
|
47
48
|
exports.TabList = (0, react_1.forwardRef)((_a, ref) => {
|
|
48
49
|
var { className } = _a, rest = __rest(_a, ["className"]);
|
|
49
50
|
const context = (0, react_1.useContext)(context_1.TabsContext);
|
|
50
51
|
const listRef = (0, react_1.useRef)(null);
|
|
51
|
-
const mergedRef = (0,
|
|
52
|
+
const mergedRef = (0, useMergeRefs_1.useMergeRefs)(listRef, ref);
|
|
52
53
|
const [displayScroll, setDisplayScroll] = (0, react_1.useState)({
|
|
53
54
|
start: false,
|
|
54
55
|
end: false,
|
package/cjs/tag/Tag.js
CHANGED
|
@@ -53,7 +53,9 @@ const typography_1 = require("../typography");
|
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
55
|
exports.Tag = (0, react_1.forwardRef)((_a, ref) => {
|
|
56
|
-
var { className, variant, size = "medium" } = _a, rest = __rest(_a, ["className", "variant", "size"]);
|
|
57
|
-
return (react_1.default.createElement(typography_1.BodyShort, Object.assign({}, rest, { ref: ref, as: "span", size: size === "medium" ? "medium" : "small", className: (0, clsx_1.default)("navds-tag", className, `navds-tag--${variant}`, `navds-tag--${size}`) })
|
|
56
|
+
var { children, className, variant, size = "medium", icon } = _a, rest = __rest(_a, ["children", "className", "variant", "size", "icon"]);
|
|
57
|
+
return (react_1.default.createElement(typography_1.BodyShort, Object.assign({}, rest, { ref: ref, as: "span", size: size === "medium" ? "medium" : "small", className: (0, clsx_1.default)("navds-tag", className, `navds-tag--${variant}`, `navds-tag--${size}`) }),
|
|
58
|
+
icon && react_1.default.createElement("span", { className: "navds-tag__icon--left" }, icon),
|
|
59
|
+
children));
|
|
58
60
|
});
|
|
59
61
|
exports.default = exports.Tag;
|
package/cjs/timeline/Pin.js
CHANGED
|
@@ -38,7 +38,7 @@ exports.Pin = void 0;
|
|
|
38
38
|
const react_1 = require("@floating-ui/react");
|
|
39
39
|
const date_fns_1 = require("date-fns");
|
|
40
40
|
const react_2 = __importStar(require("react"));
|
|
41
|
-
const
|
|
41
|
+
const useMergeRefs_1 = require("../util/hooks/useMergeRefs");
|
|
42
42
|
const useTimelineContext_1 = require("./hooks/useTimelineContext");
|
|
43
43
|
const calc_1 = require("./utils/calc");
|
|
44
44
|
exports.Pin = (0, react_2.forwardRef)((_a, ref) => {
|
|
@@ -73,7 +73,7 @@ exports.Pin = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
73
73
|
dismiss,
|
|
74
74
|
role,
|
|
75
75
|
]);
|
|
76
|
-
const mergedRef = (0,
|
|
76
|
+
const mergedRef = (0, useMergeRefs_1.useMergeRefs)(refs.setReference, ref);
|
|
77
77
|
const staticSide = {
|
|
78
78
|
top: "bottom",
|
|
79
79
|
right: "left",
|
|
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
const react_1 = require("@floating-ui/react");
|
|
30
30
|
const clsx_1 = __importDefault(require("clsx"));
|
|
31
31
|
const react_2 = __importStar(require("react"));
|
|
32
|
-
const
|
|
32
|
+
const useMergeRefs_1 = require("../../util/hooks/useMergeRefs");
|
|
33
33
|
const usePeriodContext_1 = require("../hooks/usePeriodContext");
|
|
34
34
|
const useRowContext_1 = require("../hooks/useRowContext");
|
|
35
35
|
const useTimelineContext_1 = require("../hooks/useTimelineContext");
|
|
@@ -67,7 +67,7 @@ const ClickablePeriod = react_2.default.memo(({ onSelectPeriod, start, end, stat
|
|
|
67
67
|
dismiss,
|
|
68
68
|
role,
|
|
69
69
|
]);
|
|
70
|
-
const mergedRef = (0,
|
|
70
|
+
const mergedRef = (0, useMergeRefs_1.useMergeRefs)(refs.setReference, periodRef);
|
|
71
71
|
const staticSide = {
|
|
72
72
|
top: "bottom",
|
|
73
73
|
right: "left",
|
|
@@ -42,7 +42,7 @@ const RadixToggleGroup = __importStar(require("@radix-ui/react-toggle-group"));
|
|
|
42
42
|
const clsx_1 = __importDefault(require("clsx"));
|
|
43
43
|
const react_1 = __importStar(require("react"));
|
|
44
44
|
const typography_1 = require("../typography");
|
|
45
|
-
const
|
|
45
|
+
const hooks_1 = require("../util/hooks");
|
|
46
46
|
const ToggleItem_1 = __importDefault(require("./ToggleItem"));
|
|
47
47
|
const context_1 = require("./context");
|
|
48
48
|
/**
|
|
@@ -63,7 +63,7 @@ const context_1 = require("./context");
|
|
|
63
63
|
exports.ToggleGroup = (0, react_1.forwardRef)((_a, ref) => {
|
|
64
64
|
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"]);
|
|
65
65
|
const [groupValue, setGroupValue] = (0, react_1.useState)(defaultValue);
|
|
66
|
-
const labelId = (0,
|
|
66
|
+
const labelId = (0, hooks_1.useId)();
|
|
67
67
|
const handleValueChange = (v) => {
|
|
68
68
|
if (v !== "") {
|
|
69
69
|
setGroupValue(v);
|
package/cjs/tooltip/Tooltip.js
CHANGED
|
@@ -44,8 +44,9 @@ const react_2 = __importStar(require("react"));
|
|
|
44
44
|
const ModalContext_1 = require("../modal/ModalContext");
|
|
45
45
|
const provider_1 = require("../provider");
|
|
46
46
|
const typography_1 = require("../typography");
|
|
47
|
-
const
|
|
47
|
+
const hooks_1 = require("../util/hooks");
|
|
48
48
|
const useControllableState_1 = require("../util/hooks/useControllableState");
|
|
49
|
+
const useMergeRefs_1 = require("../util/hooks/useMergeRefs");
|
|
49
50
|
/**
|
|
50
51
|
* A component that displays a tooltip when the user hovers over its child element.
|
|
51
52
|
*
|
|
@@ -96,9 +97,9 @@ exports.Tooltip = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
96
97
|
(0, react_1.useFocus)(context),
|
|
97
98
|
(0, react_1.useDismiss)(context),
|
|
98
99
|
]);
|
|
99
|
-
const ariaId = (0,
|
|
100
|
-
const mergedRef = (0,
|
|
101
|
-
const childMergedRef = (0,
|
|
100
|
+
const ariaId = (0, hooks_1.useId)(id);
|
|
101
|
+
const mergedRef = (0, useMergeRefs_1.useMergeRefs)(ref, refs.setFloating);
|
|
102
|
+
const childMergedRef = (0, useMergeRefs_1.useMergeRefs)(children.ref, refs.setReference);
|
|
102
103
|
if (!children ||
|
|
103
104
|
(children === null || children === void 0 ? void 0 : children.type) === react_2.default.Fragment ||
|
|
104
105
|
children === react_2.default.Fragment) {
|
|
@@ -120,7 +121,7 @@ exports.Tooltip = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
120
121
|
visibility: referenceHidden ? "hidden" : "visible",
|
|
121
122
|
}, role: "tooltip", id: ariaId, className: (0, clsx_1.default)("navds-tooltip", "navds-detail navds-detail--small", className) })), { "data-side": placement }),
|
|
122
123
|
content,
|
|
123
|
-
keys && (react_2.default.createElement("span", { className: "navds-tooltip__keys" }, keys.map((key) => (react_2.default.createElement(typography_1.Detail, {
|
|
124
|
+
keys && (react_2.default.createElement("span", { className: "navds-tooltip__keys" }, keys.map((key) => (react_2.default.createElement(typography_1.Detail, { as: "kbd", key: key, className: "navds-tooltip__key" }, key))))),
|
|
124
125
|
_arrow && (react_2.default.createElement("div", { ref: (node) => {
|
|
125
126
|
arrowRef.current = node;
|
|
126
127
|
}, className: "navds-tooltip__arrow", style: {
|
package/cjs/util/Slot.js
CHANGED
|
@@ -33,19 +33,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
33
33
|
}
|
|
34
34
|
return t;
|
|
35
35
|
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
37
|
exports.Slot = void 0;
|
|
41
38
|
// https://github.com/radix-ui/primitives/blob/main/packages/react/slot/src/Slot.tsx
|
|
42
39
|
const React = __importStar(require("react"));
|
|
43
|
-
const
|
|
40
|
+
const useMergeRefs_1 = require("./hooks/useMergeRefs");
|
|
44
41
|
exports.Slot = React.forwardRef((props, forwardedRef) => {
|
|
45
42
|
const { children } = props, slotProps = __rest(props, ["children"]);
|
|
46
43
|
if (React.isValidElement(children)) {
|
|
47
44
|
return React.cloneElement(children, Object.assign(Object.assign({}, mergeProps(slotProps, children.props)), { ref: forwardedRef
|
|
48
|
-
? (0,
|
|
45
|
+
? (0, useMergeRefs_1.mergeRefs)([forwardedRef, children.ref])
|
|
49
46
|
: children.ref }));
|
|
50
47
|
}
|
|
51
48
|
if (React.Children.count(children) > 1) {
|
|
@@ -40,7 +40,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
40
|
/* https://github.com/mui/material-ui/blob/master/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx */
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
42
|
const react_dom_1 = __importDefault(require("react-dom"));
|
|
43
|
-
const
|
|
43
|
+
const hooks_1 = require("../util/hooks");
|
|
44
|
+
const debounce_1 = __importDefault(require("./debounce"));
|
|
45
|
+
const useMergeRefs_1 = require("./hooks/useMergeRefs");
|
|
44
46
|
const updateState = (prevState, newState, renders) => {
|
|
45
47
|
const { outerHeightStyle, overflow } = newState;
|
|
46
48
|
// Need a large enough difference to update the height.
|
|
@@ -81,7 +83,7 @@ const TextareaAutosize = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
81
83
|
var { className, onChange, maxRows, minRows = 1, autoScrollbar, style, value } = _a, other = __rest(_a, ["className", "onChange", "maxRows", "minRows", "autoScrollbar", "style", "value"]);
|
|
82
84
|
const { current: isControlled } = (0, react_1.useRef)(value != null);
|
|
83
85
|
const inputRef = (0, react_1.useRef)(null);
|
|
84
|
-
const handleRef = (0,
|
|
86
|
+
const handleRef = (0, useMergeRefs_1.useMergeRefs)(inputRef, ref);
|
|
85
87
|
const shadowRef = (0, react_1.useRef)(null);
|
|
86
88
|
const renders = (0, react_1.useRef)(0);
|
|
87
89
|
const [state, setState] = (0, react_1.useState)({ outerHeightStyle: 0 });
|
|
@@ -133,7 +135,7 @@ const TextareaAutosize = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
133
135
|
}
|
|
134
136
|
setState((prevState) => updateState(prevState, newState, renders));
|
|
135
137
|
}, [getUpdatedState]);
|
|
136
|
-
(0,
|
|
138
|
+
(0, hooks_1.useClientLayoutEffect)(() => {
|
|
137
139
|
const syncHeightWithFlushSync = () => {
|
|
138
140
|
const newState = getUpdatedState();
|
|
139
141
|
if (isEmpty(newState)) {
|
|
@@ -160,7 +162,7 @@ const TextareaAutosize = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
160
162
|
}
|
|
161
163
|
syncHeightWithFlushSync();
|
|
162
164
|
};
|
|
163
|
-
const debounceHandleResize = (0,
|
|
165
|
+
const debounceHandleResize = (0, debounce_1.default)(handleResize);
|
|
164
166
|
const input = inputRef.current;
|
|
165
167
|
const containerWindow = ownerWindow(input);
|
|
166
168
|
containerWindow.addEventListener("resize", debounceHandleResize);
|
|
@@ -177,7 +179,7 @@ const TextareaAutosize = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
177
179
|
}
|
|
178
180
|
};
|
|
179
181
|
}, [getUpdatedState]);
|
|
180
|
-
(0,
|
|
182
|
+
(0, hooks_1.useClientLayoutEffect)(() => {
|
|
181
183
|
syncHeight();
|
|
182
184
|
});
|
|
183
185
|
(0, react_1.useEffect)(() => {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* https://github.com/radix-ui/primitives/blob/main/packages/core/primitive/src/primitive.tsx#L1 */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.composeEventHandlers = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Utility to consistently call original eventhandler, often from props and internal eventhandler
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
10
|
+
return function handleEvent(event) {
|
|
11
|
+
originalEventHandler === null || originalEventHandler === void 0 ? void 0 : originalEventHandler(event);
|
|
12
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
13
|
+
return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.composeEventHandlers = composeEventHandlers;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePrevious = exports.useMedia = exports.useId = exports.useEventListener = exports.useMergeRefs = exports.useControllableState = exports.useClientLayoutEffect = exports.useCallbackRef = void 0;
|
|
4
|
+
var useCallbackRef_1 = require("./useCallbackRef");
|
|
5
|
+
Object.defineProperty(exports, "useCallbackRef", { enumerable: true, get: function () { return useCallbackRef_1.useCallbackRef; } });
|
|
6
|
+
var useClientLayoutEffect_1 = require("./useClientLayoutEffect");
|
|
7
|
+
Object.defineProperty(exports, "useClientLayoutEffect", { enumerable: true, get: function () { return useClientLayoutEffect_1.useClientLayoutEffect; } });
|
|
8
|
+
var useControllableState_1 = require("./useControllableState");
|
|
9
|
+
Object.defineProperty(exports, "useControllableState", { enumerable: true, get: function () { return useControllableState_1.useControllableState; } });
|
|
10
|
+
var useMergeRefs_1 = require("./useMergeRefs");
|
|
11
|
+
Object.defineProperty(exports, "useMergeRefs", { enumerable: true, get: function () { return useMergeRefs_1.useMergeRefs; } });
|
|
12
|
+
var useEventListener_1 = require("./useEventListener");
|
|
13
|
+
Object.defineProperty(exports, "useEventListener", { enumerable: true, get: function () { return useEventListener_1.useEventListener; } });
|
|
14
|
+
var useId_1 = require("./useId");
|
|
15
|
+
Object.defineProperty(exports, "useId", { enumerable: true, get: function () { return useId_1.useId; } });
|
|
16
|
+
var useMedia_1 = require("./useMedia");
|
|
17
|
+
Object.defineProperty(exports, "useMedia", { enumerable: true, get: function () { return useMedia_1.useMedia; } });
|
|
18
|
+
var usePrevious_1 = require("./usePrevious");
|
|
19
|
+
Object.defineProperty(exports, "usePrevious", { enumerable: true, get: function () { return usePrevious_1.usePrevious; } });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useClientLayoutEffect = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.useClientLayoutEffect = (globalThis === null || globalThis === void 0 ? void 0 : globalThis.document)
|
|
6
|
+
? react_1.useLayoutEffect
|
|
7
|
+
: () => { };
|
|
@@ -0,0 +1,37 @@
|
|
|
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.useMergeRefs = exports.mergeRefs = void 0;
|
|
7
|
+
/* https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/composeRefs.tsx */
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
// https://github.com/gregberge/react-merge-refs
|
|
10
|
+
/**
|
|
11
|
+
* Use `useMergeRefs`
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
function mergeRefs(refs) {
|
|
15
|
+
return (value) => {
|
|
16
|
+
refs.forEach((ref) => {
|
|
17
|
+
if (typeof ref === "function") {
|
|
18
|
+
ref(value);
|
|
19
|
+
}
|
|
20
|
+
else if (ref !== null && ref !== undefined) {
|
|
21
|
+
ref.current = value;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.mergeRefs = mergeRefs;
|
|
27
|
+
/**
|
|
28
|
+
* Merges refs within useCallback
|
|
29
|
+
* @internal
|
|
30
|
+
* @param ...refs: React.Ref<T> | undefined
|
|
31
|
+
* @returns React.useCallback(mergeRefs(refs), refs)
|
|
32
|
+
*/
|
|
33
|
+
function useMergeRefs(...refs) {
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
return react_1.default.useCallback(mergeRefs(refs), refs);
|
|
36
|
+
}
|
|
37
|
+
exports.useMergeRefs = useMergeRefs;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePrevious = void 0;
|
|
3
4
|
const react_1 = require("react");
|
|
4
5
|
/*
|
|
5
6
|
* usePrevious hook
|
|
@@ -15,4 +16,4 @@ const usePrevious = (value) => {
|
|
|
15
16
|
}, [value]);
|
|
16
17
|
return ref.current;
|
|
17
18
|
};
|
|
18
|
-
exports.
|
|
19
|
+
exports.usePrevious = usePrevious;
|
package/cjs/util/index.js
CHANGED
|
@@ -17,13 +17,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
21
|
-
__exportStar(require("./OverridableComponent"), exports);
|
|
20
|
+
exports.useId = exports.useEventListener = exports.useClientLayoutEffect = exports.debounce = void 0;
|
|
22
21
|
var debounce_1 = require("./debounce");
|
|
23
22
|
Object.defineProperty(exports, "debounce", { enumerable: true, get: function () { return __importDefault(debounce_1).default; } });
|
|
24
|
-
var mergeRefs_1 = require("./mergeRefs");
|
|
25
|
-
Object.defineProperty(exports, "mergeRefs", { enumerable: true, get: function () { return __importDefault(mergeRefs_1).default; } });
|
|
26
23
|
__exportStar(require("./omit"), exports);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
var useClientLayoutEffect_1 = require("./hooks/useClientLayoutEffect");
|
|
25
|
+
Object.defineProperty(exports, "useClientLayoutEffect", { enumerable: true, get: function () { return useClientLayoutEffect_1.useClientLayoutEffect; } });
|
|
26
|
+
var useEventListener_1 = require("./hooks/useEventListener");
|
|
27
|
+
Object.defineProperty(exports, "useEventListener", { enumerable: true, get: function () { return useEventListener_1.useEventListener; } });
|
|
28
|
+
var useId_1 = require("./hooks/useId");
|
|
29
|
+
Object.defineProperty(exports, "useId", { enumerable: true, get: function () { return useId_1.useId; } });
|
|
@@ -13,6 +13,7 @@ import cl from "clsx";
|
|
|
13
13
|
import React, { forwardRef, useContext } from "react";
|
|
14
14
|
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
15
15
|
import { Heading } from "../typography";
|
|
16
|
+
import { composeEventHandlers } from "../util/composeEventHandlers";
|
|
16
17
|
import { AccordionContext } from "./AccordionContext";
|
|
17
18
|
import { AccordionItemContext } from "./AccordionItem";
|
|
18
19
|
const AccordionHeader = forwardRef((_a, ref) => {
|
|
@@ -24,10 +25,7 @@ const AccordionHeader = forwardRef((_a, ref) => {
|
|
|
24
25
|
console.error("<Accordion.Header> has to be used within an <Accordion.Item>, which in turn must be within an <Accordion>");
|
|
25
26
|
return null;
|
|
26
27
|
}
|
|
27
|
-
return (React.createElement("button", Object.assign({ ref: ref }, rest, { className: cl("navds-accordion__header", className), onClick: (
|
|
28
|
-
itemContext.toggleOpen();
|
|
29
|
-
onClick && onClick(e);
|
|
30
|
-
}, "aria-expanded": itemContext.open, type: "button" }),
|
|
28
|
+
return (React.createElement("button", Object.assign({ ref: ref }, rest, { className: cl("navds-accordion__header", className), onClick: composeEventHandlers(onClick, itemContext.toggleOpen), "aria-expanded": itemContext.open, type: "button" }),
|
|
31
29
|
React.createElement("span", { className: "navds-accordion__icon-wrapper" },
|
|
32
30
|
React.createElement(ChevronDownIcon, { className: "navds-accordion__header-chevron", title: "Vis mer", "aria-hidden": true })),
|
|
33
31
|
React.createElement(Heading, { size: (_b = accordionContext === null || accordionContext === void 0 ? void 0 : accordionContext.headingSize) !== null && _b !== void 0 ? _b : "small", as: "span", className: "navds-accordion__header-content" }, children)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionHeader.js","sourceRoot":"","sources":["../../src/accordion/AccordionHeader.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAUvD,MAAM,eAAe,GAAG,UAAU,CAChC,CAAC,EAAyC,EAAE,GAAG,EAAE,EAAE;;QAAlD,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,OAAW,EAAN,IAAI,cAAvC,oCAAyC,CAAF;IACtC,MAAM,WAAW,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACrD,MAAM,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAEtD,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CACX,2GAA2G,CAC5G,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,8CACE,GAAG,EAAE,GAAG,IACJ,IAAI,IACR,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,EACnD,OAAO,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"AccordionHeader.js","sourceRoot":"","sources":["../../src/accordion/AccordionHeader.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,O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CAAC"}
|
package/esm/button/Button.d.ts
CHANGED
package/esm/button/Button.js
CHANGED
|
@@ -10,10 +10,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import cl from "clsx";
|
|
13
|
-
import React, { forwardRef,
|
|
13
|
+
import React, { forwardRef, useRef, useState } from "react";
|
|
14
14
|
import { Loader } from "../loader";
|
|
15
15
|
import { Label } from "../typography";
|
|
16
|
-
import {
|
|
16
|
+
import { omit } from "../util";
|
|
17
|
+
import { composeEventHandlers } from "../util/composeEventHandlers";
|
|
18
|
+
import { useClientLayoutEffect } from "../util/hooks";
|
|
19
|
+
import { useMergeRefs } from "../util/hooks/useMergeRefs";
|
|
17
20
|
/**
|
|
18
21
|
* A button component
|
|
19
22
|
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/button)
|
|
@@ -28,7 +31,7 @@ export const Button = forwardRef((_a, ref) => {
|
|
|
28
31
|
var { as: Component = "button", variant = "primary", className, children, size = "medium", loading = false, disabled, style, icon, iconPosition = "left" } = _a, rest = __rest(_a, ["as", "variant", "className", "children", "size", "loading", "disabled", "style", "icon", "iconPosition"]);
|
|
29
32
|
const buttonRef = useRef(null);
|
|
30
33
|
const [widthOverride, setWidthOverride] = useState();
|
|
31
|
-
const mergedRef =
|
|
34
|
+
const mergedRef = useMergeRefs(buttonRef, ref);
|
|
32
35
|
useClientLayoutEffect(() => {
|
|
33
36
|
if (loading) {
|
|
34
37
|
const requestID = window.requestAnimationFrame(() => {
|
|
@@ -42,16 +45,12 @@ export const Button = forwardRef((_a, ref) => {
|
|
|
42
45
|
}
|
|
43
46
|
}, [loading, children]);
|
|
44
47
|
const filterProps = (disabled !== null && disabled !== void 0 ? disabled : widthOverride) ? omit(rest, ["href"]) : rest;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
!e.isDefaultPrevented()) {
|
|
52
|
-
e.currentTarget.click();
|
|
53
|
-
}
|
|
54
|
-
}, className: cl(className, "navds-button", `navds-button--${variant}`, `navds-button--${size}`, {
|
|
48
|
+
const handleKeyUp = (e) => {
|
|
49
|
+
if (e.key === " " && !disabled && !widthOverride) {
|
|
50
|
+
e.currentTarget.click();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return (React.createElement(Component, Object.assign({}, (Component !== "button" ? { role: "button" } : {}), filterProps, { ref: mergedRef, onKeyUp: composeEventHandlers(filterProps.onKeyUp, handleKeyUp), className: cl(className, "navds-button", `navds-button--${variant}`, `navds-button--${size}`, {
|
|
55
54
|
"navds-button--loading": widthOverride,
|
|
56
55
|
"navds-button--icon-only": !!icon && !children,
|
|
57
56
|
"navds-button--disabled": disabled !== null && disabled !== void 0 ? disabled : widthOverride,
|
package/esm/button/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/button/Button.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/button/Button.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AA+C1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AO,IAAI,CACnC,8BAAM,SAAS,EAAC,oBAAoB,IAAE,IAAI,CAAQ,CACnD,CACA,CACJ,CACS,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,eAAe,MAAM,CAAC"}
|
package/esm/chips/Chips.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from "react";
|
|
2
|
-
import { OverridableComponent } from "../util";
|
|
2
|
+
import { OverridableComponent } from "../util/types";
|
|
3
3
|
import { RemovableChipsProps } from "./Removable";
|
|
4
4
|
import { ToggleChipsProps } from "./Toggle";
|
|
5
5
|
export interface ChipsProps extends HTMLAttributes<HTMLUListElement> {
|
package/esm/chips/Removable.js
CHANGED
|
@@ -12,13 +12,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import cl from "clsx";
|
|
13
13
|
import React, { forwardRef } from "react";
|
|
14
14
|
import { XMarkIcon } from "@navikt/aksel-icons";
|
|
15
|
+
import { composeEventHandlers } from "../util/composeEventHandlers";
|
|
15
16
|
export const RemovableChips = forwardRef((_a, ref) => {
|
|
16
|
-
var { className, children, variant = "action", removeLabel = "slett", onDelete, type = "button" } = _a, rest = __rest(_a, ["className", "children", "variant", "removeLabel", "onDelete", "type"]);
|
|
17
|
-
return (React.createElement("button", Object.assign({}, rest, { ref: ref, type: type, className: cl("navds-chips__chip navds-chips__removable navds-chips--icon-right", className, `navds-chips__removable--${variant}`), "aria-label": `${children} ${removeLabel}`, onClick: (
|
|
18
|
-
var _a;
|
|
19
|
-
onDelete === null || onDelete === void 0 ? void 0 : onDelete();
|
|
20
|
-
(_a = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, e);
|
|
21
|
-
} }),
|
|
17
|
+
var { className, children, variant = "action", removeLabel = "slett", onDelete, type = "button", onClick } = _a, rest = __rest(_a, ["className", "children", "variant", "removeLabel", "onDelete", "type", "onClick"]);
|
|
18
|
+
return (React.createElement("button", Object.assign({}, rest, { ref: ref, type: type, className: cl("navds-chips__chip navds-chips__removable navds-chips--icon-right", className, `navds-chips__removable--${variant}`), "aria-label": `${children} ${removeLabel}`, onClick: composeEventHandlers(onClick, onDelete) }),
|
|
22
19
|
React.createElement("span", { className: "navds-chips__chip-text" }, children),
|
|
23
20
|
React.createElement("span", { className: "navds-chips__removable-icon" },
|
|
24
21
|
React.createElement(XMarkIcon, { "aria-hidden": true }))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Removable.js","sourceRoot":"","sources":["../../src/chips/Removable.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"Removable.js","sourceRoot":"","sources":["../../src/chips/Removable.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAqBpE,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAItC,CACE,EASC,EACD,GAAG,EACH,EAAE;QAXF,EACE,SAAS,EACT,QAAQ,EACR,OAAO,GAAG,QAAQ,EAClB,WAAW,GAAG,OAAO,EACrB,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,OAAO,OAER,EADI,IAAI,cART,kFASC,CADQ;IAIT,OAAO,CACL,gDACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CACX,kEAAkE,EAClE,SAAS,EACT,2BAA2B,OAAO,EAAE,CACrC,gBACW,GAAG,QAAQ,IAAI,WAAW,EAAE,EACxC,OAAO,EAAE,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC;QAEhD,8BAAM,SAAS,EAAC,wBAAwB,IAAE,QAAQ,CAAQ;QAC1D,8BAAM,SAAS,EAAC,6BAA6B;YAC3C,oBAAC,SAAS,0BAAe,CACpB,CACA,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/esm/chips/Toggle.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import cl from "clsx";
|
|
|
13
13
|
import React, { forwardRef, useEffect, useRef, useState, } from "react";
|
|
14
14
|
import { CheckmarkIcon, FilesIcon } from "@navikt/aksel-icons";
|
|
15
15
|
import { Label } from "../typography";
|
|
16
|
+
import { composeEventHandlers } from "../util/composeEventHandlers";
|
|
16
17
|
import copy from "../util/copy";
|
|
17
18
|
/**
|
|
18
19
|
* A button component that copies text to the clipboard when clicked.
|
|
@@ -26,7 +27,7 @@ import copy from "../util/copy";
|
|
|
26
27
|
* ```
|
|
27
28
|
*/
|
|
28
29
|
export const CopyButton = forwardRef((_a, ref) => {
|
|
29
|
-
var { className, copyText, text, activeText = "Kopiert!", variant = "neutral", size = "medium", onActiveChange, icon, activeIcon, activeDuration = 2000, title = "Kopier", activeTitle = "Kopiert", iconPosition = "left" } = _a, rest = __rest(_a, ["className", "copyText", "text", "activeText", "variant", "size", "onActiveChange", "icon", "activeIcon", "activeDuration", "title", "activeTitle", "iconPosition"]);
|
|
30
|
+
var { className, copyText, text, activeText = "Kopiert!", variant = "neutral", size = "medium", onActiveChange, icon, activeIcon, activeDuration = 2000, title = "Kopier", activeTitle = "Kopiert", iconPosition = "left", onClick } = _a, rest = __rest(_a, ["className", "copyText", "text", "activeText", "variant", "size", "onActiveChange", "icon", "activeIcon", "activeDuration", "title", "activeTitle", "iconPosition", "onClick"]);
|
|
30
31
|
const [active, setActive] = useState(false);
|
|
31
32
|
const timeoutRef = useRef();
|
|
32
33
|
useEffect(() => {
|
|
@@ -34,13 +35,11 @@ export const CopyButton = forwardRef((_a, ref) => {
|
|
|
34
35
|
timeoutRef.current && clearTimeout(timeoutRef.current);
|
|
35
36
|
};
|
|
36
37
|
}, []);
|
|
37
|
-
const handleClick = (
|
|
38
|
-
var _a;
|
|
38
|
+
const handleClick = () => {
|
|
39
39
|
timeoutRef.current && clearTimeout(timeoutRef.current);
|
|
40
40
|
copy(copyText);
|
|
41
41
|
setActive(true);
|
|
42
42
|
onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(true);
|
|
43
|
-
(_a = rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, event);
|
|
44
43
|
timeoutRef.current = window.setTimeout(() => {
|
|
45
44
|
setActive(false);
|
|
46
45
|
onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(false);
|
|
@@ -53,7 +52,7 @@ export const CopyButton = forwardRef((_a, ref) => {
|
|
|
53
52
|
"navds-copybutton--icon-only": !text,
|
|
54
53
|
"navds-copybutton--icon-right": iconPosition === "right",
|
|
55
54
|
"navds-copybutton--active": active,
|
|
56
|
-
}), onClick: handleClick }),
|
|
55
|
+
}), onClick: composeEventHandlers(onClick, handleClick) }),
|
|
57
56
|
React.createElement("span", { className: "navds-copybutton__content" },
|
|
58
57
|
iconPosition === "left" && copyIcon,
|
|
59
58
|
text &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyButton.js","sourceRoot":"","sources":["../../src/copybutton/CopyButton.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAEZ,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,IAAI,MAAM,cAAc,CAAC;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