@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
package/src/tooltip/Tooltip.tsx
CHANGED
|
@@ -18,14 +18,14 @@ import React, {
|
|
|
18
18
|
cloneElement,
|
|
19
19
|
forwardRef,
|
|
20
20
|
useContext,
|
|
21
|
-
useMemo,
|
|
22
21
|
useRef,
|
|
23
22
|
} from "react";
|
|
24
23
|
import { ModalContext } from "../modal/ModalContext";
|
|
25
24
|
import { useProvider } from "../provider";
|
|
26
25
|
import { Detail } from "../typography";
|
|
27
|
-
import {
|
|
26
|
+
import { useId } from "../util/hooks";
|
|
28
27
|
import { useControllableState } from "../util/hooks/useControllableState";
|
|
28
|
+
import { useMergeRefs } from "../util/hooks/useMergeRefs";
|
|
29
29
|
|
|
30
30
|
export interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
|
|
31
31
|
/**
|
|
@@ -113,7 +113,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
113
113
|
maxChar = 80,
|
|
114
114
|
...rest
|
|
115
115
|
},
|
|
116
|
-
ref
|
|
116
|
+
ref,
|
|
117
117
|
) => {
|
|
118
118
|
const [_open, _setOpen] = useControllableState({
|
|
119
119
|
defaultValue: defaultOpen,
|
|
@@ -166,14 +166,8 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
166
166
|
|
|
167
167
|
const ariaId = useId(id);
|
|
168
168
|
|
|
169
|
-
const mergedRef =
|
|
170
|
-
|
|
171
|
-
[refs.setFloating, ref]
|
|
172
|
-
);
|
|
173
|
-
const childMergedRef = useMemo(
|
|
174
|
-
() => mergeRefs([(children as any).ref, refs.setReference]),
|
|
175
|
-
[children, refs.setReference]
|
|
176
|
-
);
|
|
169
|
+
const mergedRef = useMergeRefs(ref, refs.setFloating);
|
|
170
|
+
const childMergedRef = useMergeRefs(children.ref, refs.setReference);
|
|
177
171
|
|
|
178
172
|
if (
|
|
179
173
|
!children ||
|
|
@@ -181,7 +175,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
181
175
|
(children as any) === React.Fragment
|
|
182
176
|
) {
|
|
183
177
|
console.error(
|
|
184
|
-
"<Tooltip> children needs to be a single ReactElement and not: <React.Fragment/> | <></>"
|
|
178
|
+
"<Tooltip> children needs to be a single ReactElement and not: <React.Fragment/> | <></>",
|
|
185
179
|
);
|
|
186
180
|
return null;
|
|
187
181
|
}
|
|
@@ -189,7 +183,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
189
183
|
if (content?.length > maxChar) {
|
|
190
184
|
_open &&
|
|
191
185
|
console.warn(
|
|
192
|
-
`Because of strict accessibility concers we encourage all Tooltips to have less than 80 characters. Can be overwritten with the maxChar-prop\n\nLength:${content.length}\nTooltip-content: ${content}
|
|
186
|
+
`Because of strict accessibility concers we encourage all Tooltips to have less than 80 characters. Can be overwritten with the maxChar-prop\n\nLength:${content.length}\nTooltip-content: ${content}`,
|
|
193
187
|
);
|
|
194
188
|
}
|
|
195
189
|
|
|
@@ -203,7 +197,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
203
197
|
"aria-describedby": _open
|
|
204
198
|
? cl(ariaId, children?.props["aria-describedby"])
|
|
205
199
|
: children?.props["aria-describedby"],
|
|
206
|
-
})
|
|
200
|
+
}),
|
|
207
201
|
)}
|
|
208
202
|
<FloatingPortal root={rootElement}>
|
|
209
203
|
{_open && (
|
|
@@ -222,7 +216,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
222
216
|
className: cl(
|
|
223
217
|
"navds-tooltip",
|
|
224
218
|
"navds-detail navds-detail--small",
|
|
225
|
-
className
|
|
219
|
+
className,
|
|
226
220
|
),
|
|
227
221
|
})}
|
|
228
222
|
data-side={placement}
|
|
@@ -231,12 +225,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
231
225
|
{keys && (
|
|
232
226
|
<span className="navds-tooltip__keys">
|
|
233
227
|
{keys.map((key) => (
|
|
234
|
-
<Detail
|
|
235
|
-
size="small"
|
|
236
|
-
as="kbd"
|
|
237
|
-
key={key}
|
|
238
|
-
className="navds-tooltip__key"
|
|
239
|
-
>
|
|
228
|
+
<Detail as="kbd" key={key} className="navds-tooltip__key">
|
|
240
229
|
{key}
|
|
241
230
|
</Detail>
|
|
242
231
|
))}
|
|
@@ -267,7 +256,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
267
256
|
</FloatingPortal>
|
|
268
257
|
</>
|
|
269
258
|
);
|
|
270
|
-
}
|
|
259
|
+
},
|
|
271
260
|
);
|
|
272
261
|
|
|
273
262
|
export default Tooltip;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
|
|
5
5
|
export interface IngressProps
|
|
6
6
|
extends React.HTMLAttributes<HTMLParagraphElement> {
|
package/src/typography/Label.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { BodyLong } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { BodyShort } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { Detail } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { ErrorMessage } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import { default as React } from "react";
|
|
5
4
|
import { Heading } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { Ingress } from "..";
|
|
6
5
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { Label } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
package/src/util/Slot.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// https://github.com/radix-ui/primitives/blob/main/packages/react/slot/src/Slot.tsx
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import mergeRefs from "./
|
|
3
|
+
import { mergeRefs } from "./hooks/useMergeRefs";
|
|
4
4
|
|
|
5
5
|
interface SlotProps extends React.HTMLAttributes<HTMLElement> {
|
|
6
6
|
children?: React.ReactNode;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* https://github.com/mui/material-ui/blob/master/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx */
|
|
2
|
-
import React, { forwardRef, useEffect,
|
|
2
|
+
import React, { forwardRef, useEffect, useRef, useState } from "react";
|
|
3
3
|
import ReactDOM from "react-dom";
|
|
4
|
-
import {
|
|
4
|
+
import { useClientLayoutEffect } from "../util/hooks";
|
|
5
|
+
import debounce from "./debounce";
|
|
6
|
+
import { useMergeRefs } from "./hooks/useMergeRefs";
|
|
5
7
|
|
|
6
8
|
type State = {
|
|
7
9
|
outerHeightStyle: number;
|
|
@@ -90,7 +92,9 @@ const TextareaAutosize = forwardRef<HTMLTextAreaElement, TextareaAutosizeProps>(
|
|
|
90
92
|
) => {
|
|
91
93
|
const { current: isControlled } = useRef(value != null);
|
|
92
94
|
const inputRef = useRef<HTMLTextAreaElement>(null);
|
|
93
|
-
|
|
95
|
+
|
|
96
|
+
const handleRef = useMergeRefs(inputRef, ref);
|
|
97
|
+
|
|
94
98
|
const shadowRef = useRef<HTMLTextAreaElement>(null);
|
|
95
99
|
const renders = useRef(0);
|
|
96
100
|
const [state, setState] = useState<State>({ outerHeightStyle: 0 });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { render, screen } from "@testing-library/react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { useMedia } from "../
|
|
3
|
+
import { useMedia } from "../hooks";
|
|
4
4
|
|
|
5
5
|
function TestComponent({ fallback }: { fallback?: boolean }) {
|
|
6
6
|
const media = useMedia("screen and (min-width: 1024px)", fallback);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* https://github.com/radix-ui/primitives/blob/main/packages/core/primitive/src/primitive.tsx#L1 */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Utility to consistently call original eventhandler, often from props and internal eventhandler
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export function composeEventHandlers<T extends React.SyntheticEvent>(
|
|
8
|
+
originalEventHandler?: (event: T) => void,
|
|
9
|
+
ourEventHandler?: (event: T) => void,
|
|
10
|
+
{ checkForDefaultPrevented = true } = {},
|
|
11
|
+
) {
|
|
12
|
+
return function handleEvent(event: T) {
|
|
13
|
+
originalEventHandler?.(event);
|
|
14
|
+
|
|
15
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
16
|
+
return ourEventHandler?.(event);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { useCallbackRef } from "./useCallbackRef";
|
|
2
|
+
export { useClientLayoutEffect } from "./useClientLayoutEffect";
|
|
3
|
+
export { useControllableState } from "./useControllableState";
|
|
4
|
+
export { useMergeRefs } from "./useMergeRefs";
|
|
5
|
+
export { useEventListener } from "./useEventListener";
|
|
6
|
+
export { useId } from "./useId";
|
|
7
|
+
export { useMedia } from "./useMedia";
|
|
8
|
+
export { usePrevious } from "./usePrevious";
|
|
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useRef } from "react";
|
|
|
7
7
|
*/
|
|
8
8
|
export function useCallbackRef<T extends (...args: any[]) => any>(
|
|
9
9
|
callback: T | undefined,
|
|
10
|
-
deps: React.DependencyList = []
|
|
10
|
+
deps: React.DependencyList = [],
|
|
11
11
|
) {
|
|
12
12
|
const callbackRef = useRef(callback);
|
|
13
13
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/composeRefs.tsx */
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
type PossibleRef<T> = React.Ref<T> | undefined;
|
|
5
|
+
|
|
6
|
+
// https://github.com/gregberge/react-merge-refs
|
|
7
|
+
/**
|
|
8
|
+
* Use `useMergeRefs`
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export function mergeRefs<T>(refs: PossibleRef<T>[]): React.RefCallback<T> {
|
|
12
|
+
return (value) => {
|
|
13
|
+
refs.forEach((ref) => {
|
|
14
|
+
if (typeof ref === "function") {
|
|
15
|
+
ref(value);
|
|
16
|
+
} else if (ref !== null && ref !== undefined) {
|
|
17
|
+
(ref as React.MutableRefObject<T | null>).current = value;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Merges refs within useCallback
|
|
25
|
+
* @internal
|
|
26
|
+
* @param ...refs: React.Ref<T> | undefined
|
|
27
|
+
* @returns React.useCallback(mergeRefs(refs), refs)
|
|
28
|
+
*/
|
|
29
|
+
export function useMergeRefs<T>(...refs: PossibleRef<T>[]) {
|
|
30
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
|
+
return React.useCallback(mergeRefs(refs), refs);
|
|
32
|
+
}
|
|
@@ -7,13 +7,10 @@ import { useEffect, useRef } from "react";
|
|
|
7
7
|
* https://usehooks.com/usePrevious/
|
|
8
8
|
* https://blog.logrocket.com/accessing-previous-props-state-react-hooks/
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
const usePrevious = <T>(value: T): T | undefined => {
|
|
10
|
+
export const usePrevious = <T>(value: T): T | undefined => {
|
|
12
11
|
const ref = useRef<T>(value);
|
|
13
12
|
useEffect(() => {
|
|
14
13
|
ref.current = value;
|
|
15
14
|
}, [value]);
|
|
16
15
|
return ref.current;
|
|
17
16
|
};
|
|
18
|
-
|
|
19
|
-
export default usePrevious;
|
package/src/util/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export type * from "./types";
|
|
2
2
|
export { default as debounce } from "./debounce";
|
|
3
|
-
export { default as mergeRefs } from "./mergeRefs";
|
|
4
3
|
export * from "./omit";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
4
|
+
export { useClientLayoutEffect } from "./hooks/useClientLayoutEffect";
|
|
5
|
+
export { useEventListener } from "./hooks/useEventListener";
|
|
6
|
+
export { useId } from "./hooks/useId";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { OverridableComponent } from "./OverridableComponent";
|
package/cjs/util/RandomIcon.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.RandomIcon = void 0;
|
|
30
|
-
const react_1 = __importDefault(require("react"));
|
|
31
|
-
const AllIcons = __importStar(require("@navikt/aksel-icons"));
|
|
32
|
-
// eslint-disable-next-line import/namespace
|
|
33
|
-
const icons = Object.keys(AllIcons).map((key) => AllIcons[key]);
|
|
34
|
-
const RandomIcon = () => {
|
|
35
|
-
const Icon = icons[Math.floor(Math.random() * icons.length)];
|
|
36
|
-
return react_1.default.createElement(Icon, null);
|
|
37
|
-
};
|
|
38
|
-
exports.RandomIcon = RandomIcon;
|
package/cjs/util/mergeRefs.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// https://github.com/gregberge/react-merge-refs
|
|
4
|
-
function mergeRefs(refs) {
|
|
5
|
-
return (value) => {
|
|
6
|
-
refs.forEach((ref) => {
|
|
7
|
-
if (typeof ref === "function") {
|
|
8
|
-
ref(value);
|
|
9
|
-
}
|
|
10
|
-
else if (ref !== null && ref !== undefined) {
|
|
11
|
-
ref.current = value;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
exports.default = mergeRefs;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useClientLayoutEffect = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const canUseDOM = () => {
|
|
6
|
-
return (typeof window !== "undefined" &&
|
|
7
|
-
typeof window.document !== "undefined" &&
|
|
8
|
-
typeof window.document.createElement !== "undefined");
|
|
9
|
-
};
|
|
10
|
-
exports.useClientLayoutEffect = canUseDOM() ? react_1.useLayoutEffect : () => { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnimateHeight.js","sourceRoot":"","sources":["../../src/util/AnimateHeight.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,0EAA0E;AAC1E,OAAO,KAAK,EAAE,EAAiB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQ1E,6BAA6B;AAE7B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AAK,EAAE,cAAc;QACzD,4CACe,UAAU,EACvB,SAAS,EAAE,cAAc,EACzB,GAAG,EAAE,cAAc,IAElB,QAAQ,CACL,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OverridableComponent.js","sourceRoot":"","sources":["../../src/util/OverridableComponent.ts"],"names":[],"mappings":""}
|
package/esm/util/RandomIcon.d.ts
DELETED
package/esm/util/RandomIcon.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import * as AllIcons from "@navikt/aksel-icons";
|
|
3
|
-
// eslint-disable-next-line import/namespace
|
|
4
|
-
const icons = Object.keys(AllIcons).map((key) => AllIcons[key]);
|
|
5
|
-
export const RandomIcon = () => {
|
|
6
|
-
const Icon = icons[Math.floor(Math.random() * icons.length)];
|
|
7
|
-
return React.createElement(Icon, null);
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=RandomIcon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RandomIcon.js","sourceRoot":"","sources":["../../src/util/RandomIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,4CAA4C;AAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7D,OAAO,oBAAC,IAAI,OAAG,CAAC;AAClB,CAAC,CAAC"}
|
package/esm/util/mergeRefs.d.ts
DELETED
package/esm/util/mergeRefs.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// https://github.com/gregberge/react-merge-refs
|
|
2
|
-
export default function mergeRefs(refs) {
|
|
3
|
-
return (value) => {
|
|
4
|
-
refs.forEach((ref) => {
|
|
5
|
-
if (typeof ref === "function") {
|
|
6
|
-
ref(value);
|
|
7
|
-
}
|
|
8
|
-
else if (ref !== null && ref !== undefined) {
|
|
9
|
-
ref.current = value;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=mergeRefs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mergeRefs.js","sourceRoot":"","sources":["../../src/util/mergeRefs.tsx"],"names":[],"mappings":"AAEA,gDAAgD;AAChD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,IAA2D;IAE3D,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;gBAC9B,GAAG,CAAC,KAAK,CAAC,CAAC;YACb,CAAC;iBAAM,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBAC5C,GAAwC,CAAC,OAAO,GAAG,KAAK,CAAC;YAC5D,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { useLayoutEffect } from "react";
|
|
2
|
-
const canUseDOM = () => {
|
|
3
|
-
return (typeof window !== "undefined" &&
|
|
4
|
-
typeof window.document !== "undefined" &&
|
|
5
|
-
typeof window.document.createElement !== "undefined");
|
|
6
|
-
};
|
|
7
|
-
export const useClientLayoutEffect = canUseDOM() ? useLayoutEffect : () => { };
|
|
8
|
-
//# sourceMappingURL=useClientLayoutEffect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useClientLayoutEffect.js","sourceRoot":"","sources":["../../src/util/useClientLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,SAAS,GAAG,GAAY,EAAE;IAC9B,OAAO,CACL,OAAO,MAAM,KAAK,WAAW;QAC7B,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW;QACtC,OAAO,MAAM,CAAC,QAAQ,CAAC,aAAa,KAAK,WAAW,CACrD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useEventListener.js","sourceRoot":"","sources":["../../src/util/useEventListener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgBlC,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,IAAkD,EAClD,OAAqD,EACrD,SAA4B,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EACnE,EAAE;IACR,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;QACT,CAAC;QACD,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxC,OAAO,GAAG,EAAE;YACV,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC"}
|
package/esm/util/useId.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useId.js","sourceRoot":"","sources":["../../src/util/useId.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,SAAS,WAAW,CAAC,UAAmB;IACtC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IACvD,MAAM,EAAE,GAAG,UAAU,IAAI,SAAS,CAAC;IACnC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;YACtB,6CAA6C;YAC7C,6DAA6D;YAC7D,+BAA+B;YAC/B,wHAAwH;YACxH,QAAQ,IAAI,CAAC,CAAC;YACd,YAAY,CAAC,YAAY,QAAQ,EAAE,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAChB,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,eAAe,GAAgC,KAAa,CAChE,OAAO,GAAG,EAAE,CAAC,iEAAiE;CAC/E,CAAC;AACF;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,UAAmB;;IACvC,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;QAClC,OAAO,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,0FAA0F;IAC1F,OAAO,MAAA,WAAW,CAAC,UAAU,CAAC,mCAAI,EAAE,CAAC;AACvC,CAAC"}
|
package/esm/util/useMedia.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMedia.js","sourceRoot":"","sources":["../../src/util/useMedia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,CAAC,MAAM,YAAY,GACvB,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,KAAa,EACb,QAAkB,EACG,EAAE;IACvB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QACD,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAEhD,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAEnC,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE;YAC5C,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC,CAAC;QAEF,cAAc,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAEpD,OAAO,GAAG,EAAE;YACV,cAAc,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACzD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePrevious.js","sourceRoot":"","sources":["../../src/util/usePrevious.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C;;;;;;GAMG;AAEH,MAAM,WAAW,GAAG,CAAI,KAAQ,EAAiB,EAAE;IACjD,MAAM,GAAG,GAAG,MAAM,CAAI,KAAK,CAAC,CAAC;IAC7B,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/src/util/mergeRefs.tsx
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
// https://github.com/gregberge/react-merge-refs
|
|
4
|
-
export default function mergeRefs<T>(
|
|
5
|
-
refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>,
|
|
6
|
-
): React.RefCallback<T> {
|
|
7
|
-
return (value) => {
|
|
8
|
-
refs.forEach((ref) => {
|
|
9
|
-
if (typeof ref === "function") {
|
|
10
|
-
ref(value);
|
|
11
|
-
} else if (ref !== null && ref !== undefined) {
|
|
12
|
-
(ref as React.MutableRefObject<T | null>).current = value;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useLayoutEffect } from "react";
|
|
2
|
-
|
|
3
|
-
const canUseDOM = (): boolean => {
|
|
4
|
-
return (
|
|
5
|
-
typeof window !== "undefined" &&
|
|
6
|
-
typeof window.document !== "undefined" &&
|
|
7
|
-
typeof window.document.createElement !== "undefined"
|
|
8
|
-
);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const useClientLayoutEffect = canUseDOM() ? useLayoutEffect : () => {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|