@digdir/designsystemet-react 1.0.0-rc.12 → 1.0.0-rc.13
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/dist/cjs/components/Accordion/AccordionContent.js +5 -0
- package/dist/cjs/components/Accordion/AccordionHeading.js +5 -0
- package/dist/cjs/components/Accordion/AccordionItem.js +8 -0
- package/dist/cjs/components/Accordion/AccordionRoot.js +3 -0
- package/dist/cjs/components/Accordion/index.js +10 -0
- package/dist/cjs/components/Alert/Alert.js +7 -2
- package/dist/cjs/components/Button/Button.js +2 -0
- package/dist/cjs/components/Card/Card.js +9 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuContent.js +2 -2
- package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.js +12 -0
- package/dist/cjs/components/DropdownMenu/index.js +11 -0
- package/dist/cjs/components/ErrorSummary/index.js +9 -0
- package/dist/cjs/components/Pagination/PaginationEllipsis.js +0 -4
- package/dist/cjs/components/Pagination/PaginationItem.js +0 -4
- package/dist/cjs/components/Pagination/PaginationRoot.js +0 -4
- package/dist/cjs/components/Pagination/index.js +6 -6
- package/dist/cjs/components/Popover/PopoverContent.js +2 -2
- package/dist/cjs/components/Skeleton/Circle/Circle.js +1 -1
- package/dist/cjs/components/Skeleton/Rectangle/Rectangle.js +1 -1
- package/dist/cjs/components/Skeleton/Text/Text.js +1 -1
- package/dist/cjs/components/Spinner/Spinner.js +1 -1
- package/dist/cjs/components/Tabs/Tab.js +7 -2
- package/dist/cjs/components/Tabs/TabContent.js +7 -0
- package/dist/cjs/components/Tabs/TabList.js +14 -2
- package/dist/cjs/components/Tabs/TabsRoot.js +17 -1
- package/dist/cjs/components/Tabs/index.js +16 -0
- package/dist/cjs/components/Tag/Tag.js +5 -0
- package/dist/cjs/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.js +8 -3
- package/dist/cjs/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.js +6 -4
- package/dist/cjs/components/ToggleGroup/ToggleGroupRoot.js +4 -5
- package/dist/cjs/components/ToggleGroup/index.js +11 -0
- package/dist/cjs/components/Tooltip/Tooltip.js +8 -1
- package/dist/cjs/components/Typography/Heading/Heading.js +6 -1
- package/dist/cjs/components/Typography/Ingress/Ingress.js +6 -1
- package/dist/cjs/components/Typography/Label/Label.js +6 -1
- package/dist/cjs/components/Typography/Paragraph/Paragraph.js +6 -1
- package/dist/cjs/components/form/Checkbox/Checkbox.js +2 -2
- package/dist/cjs/components/form/Combobox/Combobox.js +6 -6
- package/dist/cjs/components/form/Combobox/Custom.js +2 -6
- package/dist/cjs/components/form/Combobox/Empty.js +0 -3
- package/dist/cjs/components/form/Combobox/Option/Description.js +1 -4
- package/dist/cjs/components/form/Combobox/Option/Option.js +2 -2
- package/dist/cjs/components/form/Combobox/Option/SelectedIcon.js +0 -3
- package/dist/cjs/components/form/Combobox/Option/useComboboxOption.js +4 -4
- package/dist/cjs/components/form/Combobox/internal/ComboboxChips.js +1 -4
- package/dist/cjs/components/form/Combobox/internal/ComboboxClearButton.js +1 -4
- package/dist/cjs/components/form/Combobox/internal/ComboboxError.js +2 -5
- package/dist/cjs/components/form/Combobox/internal/ComboboxInput.js +9 -8
- package/dist/cjs/components/form/Combobox/internal/ComboboxLabel.js +1 -4
- package/dist/cjs/components/form/Combobox/internal/ComboboxNative.js +1 -4
- package/dist/cjs/components/form/Combobox/useCombobox.js +11 -4
- package/dist/cjs/components/form/Combobox/useComboboxKeyboard.js +2 -2
- package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +2 -2
- package/dist/cjs/components/form/NativeSelect/NativeSelect.js +2 -2
- package/dist/cjs/components/form/Radio/Radio.js +2 -2
- package/dist/cjs/components/form/Search/Search.js +3 -4
- package/dist/cjs/components/form/Switch/Switch.js +2 -2
- package/dist/cjs/components/form/Textarea/Textarea.js +2 -2
- package/dist/cjs/components/form/Textfield/Textfield.js +2 -2
- package/dist/cjs/index.js +15 -5
- package/dist/cjs/node_modules/@floating-ui/{react-dom/node_modules/@floating-ui/dom → dom}/dist/floating-ui.dom.js +3 -3
- package/dist/cjs/node_modules/@floating-ui/react/dist/floating-ui.react.js +1 -1
- package/dist/cjs/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +1 -1
- package/dist/cjs/utilities/AnimateHeight/AnimateHeight.js +2 -2
- package/dist/cjs/utilities/{RovingTabIndex/RovingTabindexItem.js → RovingFocus/RovingFocusItem.js} +6 -6
- package/dist/cjs/utilities/{RovingTabIndex/RovingTabindexRoot.js → RovingFocus/RovingFocusRoot.js} +11 -7
- package/dist/cjs/utilities/{RovingTabIndex/useRovingTabindex.js → RovingFocus/useRovingFocus.js} +5 -5
- package/dist/cjs/utilities/{useDebounce.js → hooks/useDebounceCallback/useDebounceCallback.js} +2 -2
- package/dist/cjs/utilities/hooks/useMediaQuery/useMediaQuery.js +49 -0
- package/dist/esm/components/Accordion/AccordionContent.js +5 -0
- package/dist/esm/components/Accordion/AccordionHeading.js +5 -0
- package/dist/esm/components/Accordion/AccordionItem.js +8 -0
- package/dist/esm/components/Accordion/AccordionRoot.js +3 -0
- package/dist/esm/components/Accordion/index.js +10 -0
- package/dist/esm/components/Alert/Alert.js +7 -2
- package/dist/esm/components/Button/Button.js +2 -0
- package/dist/esm/components/Card/Card.js +9 -0
- package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +2 -2
- package/dist/esm/components/DropdownMenu/DropdownMenuRoot.js +12 -0
- package/dist/esm/components/DropdownMenu/index.js +11 -0
- package/dist/esm/components/ErrorSummary/index.js +9 -0
- package/dist/esm/components/Pagination/PaginationEllipsis.js +1 -2
- package/dist/esm/components/Pagination/PaginationItem.js +1 -2
- package/dist/esm/components/Pagination/PaginationRoot.js +1 -2
- package/dist/esm/components/Pagination/index.js +3 -3
- package/dist/esm/components/Popover/PopoverContent.js +2 -2
- package/dist/esm/components/Skeleton/Circle/Circle.js +1 -1
- package/dist/esm/components/Skeleton/Rectangle/Rectangle.js +1 -1
- package/dist/esm/components/Skeleton/Text/Text.js +1 -1
- package/dist/esm/components/Spinner/Spinner.js +1 -1
- package/dist/esm/components/Tabs/Tab.js +7 -2
- package/dist/esm/components/Tabs/TabContent.js +7 -0
- package/dist/esm/components/Tabs/TabList.js +15 -3
- package/dist/esm/components/Tabs/TabsRoot.js +17 -1
- package/dist/esm/components/Tabs/index.js +16 -0
- package/dist/esm/components/Tag/Tag.js +5 -0
- package/dist/esm/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.js +8 -3
- package/dist/esm/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.js +7 -5
- package/dist/esm/components/ToggleGroup/ToggleGroupRoot.js +4 -5
- package/dist/esm/components/ToggleGroup/index.js +11 -0
- package/dist/esm/components/Tooltip/Tooltip.js +8 -1
- package/dist/esm/components/Typography/Heading/Heading.js +6 -1
- package/dist/esm/components/Typography/Ingress/Ingress.js +6 -1
- package/dist/esm/components/Typography/Label/Label.js +6 -1
- package/dist/esm/components/Typography/Paragraph/Paragraph.js +6 -1
- package/dist/esm/components/form/Checkbox/Checkbox.js +1 -1
- package/dist/esm/components/form/Combobox/Combobox.js +5 -5
- package/dist/esm/components/form/Combobox/Custom.js +2 -3
- package/dist/esm/components/form/Combobox/Empty.js +1 -1
- package/dist/esm/components/form/Combobox/Option/Description.js +1 -1
- package/dist/esm/components/form/Combobox/Option/Option.js +1 -1
- package/dist/esm/components/form/Combobox/Option/SelectedIcon.js +1 -1
- package/dist/esm/components/form/Combobox/Option/useComboboxOption.js +4 -4
- package/dist/esm/components/form/Combobox/internal/ComboboxChips.js +1 -1
- package/dist/esm/components/form/Combobox/internal/ComboboxClearButton.js +1 -1
- package/dist/esm/components/form/Combobox/internal/ComboboxError.js +2 -2
- package/dist/esm/components/form/Combobox/internal/ComboboxInput.js +7 -3
- package/dist/esm/components/form/Combobox/internal/ComboboxLabel.js +1 -1
- package/dist/esm/components/form/Combobox/internal/ComboboxNative.js +1 -1
- package/dist/esm/components/form/Combobox/useCombobox.js +12 -5
- package/dist/esm/components/form/Combobox/useComboboxKeyboard.js +2 -2
- package/dist/esm/components/form/Combobox/useFloatingCombobox.js +2 -2
- package/dist/esm/components/form/NativeSelect/NativeSelect.js +1 -1
- package/dist/esm/components/form/Radio/Radio.js +1 -1
- package/dist/esm/components/form/Search/Search.js +3 -4
- package/dist/esm/components/form/Switch/Switch.js +1 -1
- package/dist/esm/components/form/Textarea/Textarea.js +1 -1
- package/dist/esm/components/form/Textfield/Textfield.js +1 -1
- package/dist/esm/index.js +9 -5
- package/dist/esm/node_modules/@floating-ui/{react-dom/node_modules/@floating-ui/dom → dom}/dist/floating-ui.dom.js +4 -4
- package/dist/esm/node_modules/@floating-ui/react/dist/floating-ui.react.js +2 -2
- package/dist/esm/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +2 -2
- package/dist/esm/utilities/AnimateHeight/AnimateHeight.js +2 -2
- package/dist/esm/utilities/{RovingTabIndex/RovingTabindexItem.js → RovingFocus/RovingFocusItem.js} +6 -6
- package/dist/esm/utilities/{RovingTabIndex/RovingTabindexRoot.js → RovingFocus/RovingFocusRoot.js} +11 -7
- package/dist/esm/utilities/{RovingTabIndex/useRovingTabindex.js → RovingFocus/useRovingFocus.js} +5 -5
- package/dist/esm/utilities/{useDebounce.js → hooks/useDebounceCallback/useDebounceCallback.js} +2 -2
- package/dist/esm/utilities/hooks/useMediaQuery/useMediaQuery.js +47 -0
- package/dist/types/components/Accordion/AccordionContent.d.ts +8 -9
- package/dist/types/components/Accordion/AccordionContent.d.ts.map +1 -1
- package/dist/types/components/Accordion/AccordionHeading.d.ts +5 -0
- package/dist/types/components/Accordion/AccordionHeading.d.ts.map +1 -1
- package/dist/types/components/Accordion/AccordionItem.d.ts +22 -3
- package/dist/types/components/Accordion/AccordionItem.d.ts.map +1 -1
- package/dist/types/components/Accordion/AccordionRoot.d.ts +15 -4
- package/dist/types/components/Accordion/AccordionRoot.d.ts.map +1 -1
- package/dist/types/components/Accordion/index.d.ts +10 -0
- package/dist/types/components/Accordion/index.d.ts.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +21 -10
- package/dist/types/components/Alert/Alert.d.ts.map +1 -1
- package/dist/types/components/Button/Button.d.ts +18 -4
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Card/Card.d.ts +9 -0
- package/dist/types/components/Card/Card.d.ts.map +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuRoot.d.ts +12 -0
- package/dist/types/components/DropdownMenu/DropdownMenuRoot.d.ts.map +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts +4 -2
- package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts.map +1 -1
- package/dist/types/components/DropdownMenu/index.d.ts +11 -0
- package/dist/types/components/DropdownMenu/index.d.ts.map +1 -1
- package/dist/types/components/ErrorSummary/index.d.ts +9 -0
- package/dist/types/components/ErrorSummary/index.d.ts.map +1 -1
- package/dist/types/components/Modal/ModalTrigger.d.ts +4 -2
- package/dist/types/components/Modal/ModalTrigger.d.ts.map +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +2 -1
- package/dist/types/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationEllipsis.d.ts +2 -2
- package/dist/types/components/Pagination/PaginationEllipsis.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationItem.d.ts +2 -2
- package/dist/types/components/Pagination/PaginationItem.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationNextPrev.d.ts +3 -2
- package/dist/types/components/Pagination/PaginationNextPrev.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationRoot.d.ts +2 -2
- package/dist/types/components/Pagination/PaginationRoot.d.ts.map +1 -1
- package/dist/types/components/Pagination/index.d.ts +7 -7
- package/dist/types/components/Pagination/index.d.ts.map +1 -1
- package/dist/types/components/Popover/PopoverTrigger.d.ts +4 -2
- package/dist/types/components/Popover/PopoverTrigger.d.ts.map +1 -1
- package/dist/types/components/Table/index.d.ts +7 -0
- package/dist/types/components/Table/index.d.ts.map +1 -1
- package/dist/types/components/Tabs/Tab.d.ts +7 -2
- package/dist/types/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/types/components/Tabs/TabContent.d.ts +7 -0
- package/dist/types/components/Tabs/TabContent.d.ts.map +1 -1
- package/dist/types/components/Tabs/TabList.d.ts +10 -0
- package/dist/types/components/Tabs/TabList.d.ts.map +1 -1
- package/dist/types/components/Tabs/TabsRoot.d.ts +14 -13
- package/dist/types/components/Tabs/TabsRoot.d.ts.map +1 -1
- package/dist/types/components/Tabs/index.d.ts +16 -0
- package/dist/types/components/Tabs/index.d.ts.map +1 -1
- package/dist/types/components/Tag/Tag.d.ts +9 -2
- package/dist/types/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/components/Tag/index.d.ts +1 -2
- package/dist/types/components/Tag/index.d.ts.map +1 -1
- package/dist/types/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.d.ts +13 -2
- package/dist/types/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.d.ts.map +1 -1
- package/dist/types/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.d.ts +2 -1
- package/dist/types/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.d.ts.map +1 -1
- package/dist/types/components/ToggleGroup/ToggleGroupRoot.d.ts +2 -3
- package/dist/types/components/ToggleGroup/ToggleGroupRoot.d.ts.map +1 -1
- package/dist/types/components/ToggleGroup/index.d.ts +11 -0
- package/dist/types/components/ToggleGroup/index.d.ts.map +1 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +23 -6
- package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/components/Typography/Heading/Heading.d.ts +14 -3
- package/dist/types/components/Typography/Heading/Heading.d.ts.map +1 -1
- package/dist/types/components/Typography/Ingress/Ingress.d.ts +6 -1
- package/dist/types/components/Typography/Ingress/Ingress.d.ts.map +1 -1
- package/dist/types/components/Typography/Label/Label.d.ts +16 -9
- package/dist/types/components/Typography/Label/Label.d.ts.map +1 -1
- package/dist/types/components/Typography/Paragraph/Paragraph.d.ts +10 -5
- package/dist/types/components/Typography/Paragraph/Paragraph.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Custom.d.ts +2 -2
- package/dist/types/components/form/Combobox/Custom.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Empty.d.ts +2 -2
- package/dist/types/components/form/Combobox/Empty.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Option/Description.d.ts +1 -1
- package/dist/types/components/form/Combobox/Option/Description.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Option/Option.d.ts +2 -1
- package/dist/types/components/form/Combobox/Option/Option.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Option/SelectedIcon.d.ts +2 -2
- package/dist/types/components/form/Combobox/Option/SelectedIcon.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxChips.d.ts +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxChips.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxClearButton.d.ts +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxClearButton.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxError.d.ts +2 -2
- package/dist/types/components/form/Combobox/internal/ComboboxError.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxLabel.d.ts +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxLabel.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/useCombobox.d.ts.map +1 -1
- package/dist/types/components/form/Search/Search.d.ts +2 -2
- package/dist/types/components/form/Search/Search.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/Portal.d.ts +1 -1
- package/dist/types/utilities/RovingFocus/RovingFocusItem.d.ts +16 -0
- package/dist/types/utilities/RovingFocus/RovingFocusItem.d.ts.map +1 -0
- package/dist/types/utilities/{RovingTabIndex/RovingTabindexRoot.d.ts → RovingFocus/RovingFocusRoot.d.ts} +9 -9
- package/dist/types/utilities/RovingFocus/RovingFocusRoot.d.ts.map +1 -0
- package/dist/types/utilities/RovingFocus/index.d.ts +4 -0
- package/dist/types/utilities/RovingFocus/index.d.ts.map +1 -0
- package/dist/types/utilities/{RovingTabIndex/useRovingTabindex.d.ts → RovingFocus/useRovingFocus.d.ts} +7 -9
- package/dist/types/utilities/RovingFocus/useRovingFocus.d.ts.map +1 -0
- package/dist/types/{hooks → utilities/hooks}/index.d.ts +4 -3
- package/dist/types/utilities/hooks/index.d.ts.map +1 -0
- package/dist/types/utilities/hooks/useDebounceCallback/useDebounceCallback.d.ts +4 -0
- package/dist/types/utilities/hooks/useDebounceCallback/useDebounceCallback.d.ts.map +1 -0
- package/dist/types/utilities/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/dist/types/utilities/hooks/useMediaQuery/useMediaQuery.d.ts +7 -0
- package/dist/types/utilities/hooks/useMediaQuery/useMediaQuery.d.ts.map +1 -0
- package/dist/types/utilities/hooks/usePrevious.d.ts.map +1 -0
- package/dist/types/utilities/hooks/useSynchronizedAnimation/useSynchronizedAnimation.d.ts.map +1 -0
- package/dist/types/utilities/index.d.ts +3 -1
- package/dist/types/utilities/index.d.ts.map +1 -1
- package/dist/types/utilities/{objectUtils.d.ts → omit/omit.d.ts} +1 -1
- package/dist/types/utilities/omit/omit.d.ts.map +1 -0
- package/package.json +9 -5
- package/dist/cjs/hooks/useMediaQuery.js +0 -27
- package/dist/esm/hooks/useMediaQuery.js +0 -25
- package/dist/types/hooks/index.d.ts.map +0 -1
- package/dist/types/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts.map +0 -1
- package/dist/types/hooks/useMediaQuery.d.ts +0 -2
- package/dist/types/hooks/useMediaQuery.d.ts.map +0 -1
- package/dist/types/hooks/usePrevious.d.ts.map +0 -1
- package/dist/types/hooks/useSynchronizedAnimation/useSynchronizedAnimation.d.ts.map +0 -1
- package/dist/types/utilities/RovingTabIndex/RovingTabindexItem.d.ts +0 -16
- package/dist/types/utilities/RovingTabIndex/RovingTabindexItem.d.ts.map +0 -1
- package/dist/types/utilities/RovingTabIndex/RovingTabindexRoot.d.ts.map +0 -1
- package/dist/types/utilities/RovingTabIndex/index.d.ts +0 -4
- package/dist/types/utilities/RovingTabIndex/index.d.ts.map +0 -1
- package/dist/types/utilities/RovingTabIndex/useRovingTabindex.d.ts.map +0 -1
- package/dist/types/utilities/objectUtils.d.ts.map +0 -1
- package/dist/types/utilities/useDebounce.d.ts +0 -4
- package/dist/types/utilities/useDebounce.d.ts.map +0 -1
- /package/dist/cjs/{hooks → utilities/hooks}/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +0 -0
- /package/dist/cjs/{hooks → utilities/hooks}/usePrevious.js +0 -0
- /package/dist/cjs/{hooks → utilities/hooks}/useSynchronizedAnimation/useSynchronizedAnimation.js +0 -0
- /package/dist/cjs/utilities/{objectUtils.js → omit/omit.js} +0 -0
- /package/dist/esm/{hooks → utilities/hooks}/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +0 -0
- /package/dist/esm/{hooks → utilities/hooks}/usePrevious.js +0 -0
- /package/dist/esm/{hooks → utilities/hooks}/useSynchronizedAnimation/useSynchronizedAnimation.js +0 -0
- /package/dist/esm/utilities/{objectUtils.js → omit/omit.js} +0 -0
- /package/dist/types/{hooks → utilities/hooks}/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +0 -0
- /package/dist/types/{hooks → utilities/hooks}/usePrevious.d.ts +0 -0
- /package/dist/types/{hooks → utilities/hooks}/useSynchronizedAnimation/useSynchronizedAnimation.d.ts +0 -0
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
3
|
+
import { forwardRef, useContext } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
|
-
import {
|
|
5
|
+
import { TabsContext } from './TabsRoot.js';
|
|
6
|
+
import { RovingFocusRoot } from '../../utilities/RovingFocus/RovingFocusRoot.js';
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* The container for all `Tab` components.
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Tabs.List>
|
|
13
|
+
* <Tabs.Tab value='1'>Tab 1</Tabs.Tab>
|
|
14
|
+
* <Tabs.Tab value='2'>Tab 2</Tabs.Tab>
|
|
15
|
+
* </Tabs.List>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
7
18
|
const TabList = forwardRef(({ children, className, ...rest }, ref) => {
|
|
8
|
-
|
|
19
|
+
const { value } = useContext(TabsContext);
|
|
20
|
+
return (jsx(RovingFocusRoot, { role: 'tablist', activeValue: value, className: clsx('ds-tabs__tablist', className), ref: ref, ...rest, children: children }));
|
|
9
21
|
});
|
|
10
22
|
TabList.displayName = 'TabList';
|
|
11
23
|
|
|
@@ -4,6 +4,22 @@ import { createContext, forwardRef, useState } from 'react';
|
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
|
|
6
6
|
const TabsContext = createContext({});
|
|
7
|
+
/**
|
|
8
|
+
* Display a group of tabs that can be toggled between.
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <Tabs.Root onChange={(value) => console.log(value)}>
|
|
12
|
+
* <Tabs.List>
|
|
13
|
+
* <Tabs.Tab value='1'>Tab 1</Tabs.Tab>
|
|
14
|
+
* <Tabs.Tab value='2'>Tab 2</Tabs.Tab>
|
|
15
|
+
* <Tabs.Tab value='3'>Tab 3</Tabs.Tab>
|
|
16
|
+
* </Tabs.List>
|
|
17
|
+
* <Tabs.Content value='1'>content 1</Tabs.Content>
|
|
18
|
+
* <Tabs.Content value='2'>content 2</Tabs.Content>
|
|
19
|
+
* <Tabs.Content value='3'>content 3</Tabs.Content>
|
|
20
|
+
* </Tabs.Root>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
7
23
|
const TabsRoot = forwardRef(({ size = 'md', children, value, defaultValue, className, onChange, ...rest }, ref) => {
|
|
8
24
|
const isControlled = value !== undefined;
|
|
9
25
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
@@ -20,7 +36,7 @@ const TabsRoot = forwardRef(({ size = 'md', children, value, defaultValue, class
|
|
|
20
36
|
defaultValue,
|
|
21
37
|
onChange: onValueChange,
|
|
22
38
|
size,
|
|
23
|
-
}, children: jsx("div", { className: clsx(`ds-tabs--${size}`, className), ref: ref, ...rest, children: children }) }));
|
|
39
|
+
}, children: jsx("div", { className: clsx('ds-tabs', `ds-tabs--${size}`, className), ref: ref, ...rest, children: children }) }));
|
|
24
40
|
});
|
|
25
41
|
TabsRoot.displayName = 'TabsRoot';
|
|
26
42
|
|
|
@@ -4,6 +4,22 @@ import { Tab } from './Tab.js';
|
|
|
4
4
|
import { TabList } from './TabList.js';
|
|
5
5
|
import { TabContent } from './TabContent.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Display a group of tabs that can be toggled between.
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <Tabs.Root onChange={(value) => console.log(value)}>
|
|
12
|
+
* <Tabs.List>
|
|
13
|
+
* <Tabs.Tab value='1'>Tab 1</Tabs.Tab>
|
|
14
|
+
* <Tabs.Tab value='2'>Tab 2</Tabs.Tab>
|
|
15
|
+
* <Tabs.Tab value='3'>Tab 3</Tabs.Tab>
|
|
16
|
+
* </Tabs.List>
|
|
17
|
+
* <Tabs.Content value='1'>content 1</Tabs.Content>
|
|
18
|
+
* <Tabs.Content value='2'>content 2</Tabs.Content>
|
|
19
|
+
* <Tabs.Content value='3'>content 3</Tabs.Content>
|
|
20
|
+
* </Tabs.Root>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
7
23
|
const Tabs = {};
|
|
8
24
|
Tabs.Root = TabsRoot;
|
|
9
25
|
Tabs.Tab = Tab;
|
|
@@ -4,6 +4,11 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Use `Tag` to display a small piece of information.
|
|
9
|
+
* @example
|
|
10
|
+
* <Tag color='success'>Success</Tag>
|
|
11
|
+
*/
|
|
7
12
|
const Tag = forwardRef(({ size = 'md', color = 'neutral', children, className, ...rest }, ref) => {
|
|
8
13
|
return (jsx(Paragraph, { asChild: true, size: size, children: jsx("span", { className: clsx('ds-tag', `ds-tag--${color}`, `ds-tag--${size}`, className), ref: ref, ...rest, children: children }) }));
|
|
9
14
|
});
|
|
@@ -3,13 +3,18 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { useToggleGroupItem } from './useToggleGroupitem.js';
|
|
6
|
-
import {
|
|
6
|
+
import { RovingFocusItem } from '../../../utilities/RovingFocus/RovingFocusItem.js';
|
|
7
7
|
import { Button } from '../../Button/Button.js';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A single item in a ToggleGroup.
|
|
11
|
+
* @example
|
|
12
|
+
* <ToggleGroup.Item value='1'>Toggle 1</ToggleGroup.Item>
|
|
13
|
+
*/
|
|
9
14
|
const ToggleGroupItem = forwardRef((props, ref) => {
|
|
10
15
|
const { children, icon, className, ...rest } = props;
|
|
11
|
-
const { active, size = 'md', buttonProps } = useToggleGroupItem(props);
|
|
12
|
-
return (jsx(
|
|
16
|
+
const { active, size = 'md', buttonProps, value } = useToggleGroupItem(props);
|
|
17
|
+
return (jsx(RovingFocusItem, { asChild: true, value: value, children: jsx(Button, { className: clsx('ds-togglegroup__item', className), icon: icon, variant: active ? 'primary' : 'tertiary', size: size, ref: ref, ...rest, ...buttonProps, children: children }) }));
|
|
13
18
|
});
|
|
14
19
|
ToggleGroupItem.displayName = 'ToggleGroupItem';
|
|
15
20
|
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { useId, useContext } from 'react';
|
|
3
3
|
import { ToggleGroupContext } from '../ToggleGroupRoot.js';
|
|
4
4
|
|
|
5
|
-
/** Handles props for `ToggleGroup.Item` in context with `ToggleGroup` and `
|
|
5
|
+
/** Handles props for `ToggleGroup.Item` in context with `ToggleGroup` and `RovingFocus` */
|
|
6
6
|
const useToggleGroupItem = (props) => {
|
|
7
7
|
const { ...rest } = props;
|
|
8
|
+
const genValue = useId();
|
|
8
9
|
const toggleGroup = useContext(ToggleGroupContext);
|
|
9
|
-
const
|
|
10
|
-
const active = toggleGroup.value ==
|
|
10
|
+
const value = props.value ?? genValue;
|
|
11
|
+
const active = toggleGroup.value == value;
|
|
11
12
|
const buttonId = `togglegroup-item-${useId()}`;
|
|
12
13
|
return {
|
|
13
14
|
...rest,
|
|
14
15
|
active: active,
|
|
15
16
|
size: toggleGroup?.size,
|
|
17
|
+
value,
|
|
16
18
|
buttonProps: {
|
|
17
19
|
id: buttonId,
|
|
18
20
|
'aria-checked': active,
|
|
@@ -20,7 +22,7 @@ const useToggleGroupItem = (props) => {
|
|
|
20
22
|
role: 'radio',
|
|
21
23
|
name: toggleGroup.name,
|
|
22
24
|
onClick: () => {
|
|
23
|
-
toggleGroup.onChange?.(
|
|
25
|
+
toggleGroup.onChange?.(value);
|
|
24
26
|
},
|
|
25
27
|
},
|
|
26
28
|
};
|
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, forwardRef, useId, useState } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
|
-
import {
|
|
5
|
+
import { RovingFocusRoot } from '../../utilities/RovingFocus/RovingFocusRoot.js';
|
|
6
6
|
|
|
7
7
|
const ToggleGroupContext = createContext({});
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Display a group of buttons that can be toggled between.
|
|
9
10
|
* @example
|
|
10
|
-
* ```tsx
|
|
11
11
|
* <ToggleGroup.Root onChange={(value) => console.log(value)}>
|
|
12
12
|
* <ToggleGroup.Item value='1'>Toggle 1</ToggleGroup.Item>
|
|
13
13
|
* <ToggleGroup.Item value='2'>Toggle 2</ToggleGroup.Item>
|
|
14
14
|
* <ToggleGroup.Item value='3'>Toggle 3</ToggleGroup.Item>
|
|
15
15
|
* </ToggleGroup.Root>
|
|
16
|
-
* ```
|
|
17
16
|
*/
|
|
18
17
|
const ToggleGroupRoot = forwardRef(({ size = 'md', children, value, defaultValue, onChange, name, className, ...rest }, ref) => {
|
|
19
18
|
const nameId = useId();
|
|
@@ -33,7 +32,7 @@ const ToggleGroupRoot = forwardRef(({ size = 'md', children, value, defaultValue
|
|
|
33
32
|
name: name ?? `togglegroup-name-${nameId}`,
|
|
34
33
|
onChange: onValueChange,
|
|
35
34
|
size,
|
|
36
|
-
}, children: [name && (jsx("input", { className: 'ds-togglegroup__input', name: name, value: value })), jsx(
|
|
35
|
+
}, children: [name && (jsx("input", { className: 'ds-togglegroup__input', name: name, value: value })), jsx(RovingFocusRoot, { asChild: true, activeValue: value, children: jsx("div", { className: 'ds-togglegroup__content', role: 'radiogroup', children: children }) })] }) }));
|
|
37
36
|
});
|
|
38
37
|
ToggleGroupRoot.displayName = 'ToggleGroupRoot';
|
|
39
38
|
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
import { ToggleGroupRoot } from './ToggleGroupRoot.js';
|
|
3
3
|
import { ToggleGroupItem } from './ToggleGroupItem/ToggleGroupItem.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Display a group of buttons that can be toggled between.
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <ToggleGroup.Root onChange={(value) => console.log(value)}>
|
|
10
|
+
* <ToggleGroup.Item value='1'>Toggle 1</ToggleGroup.Item>
|
|
11
|
+
* <ToggleGroup.Item value='2'>Toggle 2</ToggleGroup.Item>
|
|
12
|
+
* <ToggleGroup.Item value='3'>Toggle 3</ToggleGroup.Item>
|
|
13
|
+
* </ToggleGroup.Root>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
5
16
|
const ToggleGroup = {};
|
|
6
17
|
ToggleGroup.Root = ToggleGroupRoot;
|
|
7
18
|
ToggleGroup.Item = ToggleGroupItem;
|
|
@@ -4,13 +4,20 @@ import * as React from 'react';
|
|
|
4
4
|
import { forwardRef, useState, cloneElement } from 'react';
|
|
5
5
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
6
6
|
import { useFloating, useTransitionStyles, useInteractions, useHover, useFocus, useDismiss, useRole, useMergeRefs, FloatingArrow, FloatingPortal } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
7
|
-
import { autoUpdate, flip, shift } from '../../node_modules/@floating-ui/
|
|
7
|
+
import { autoUpdate, flip, shift } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
|
|
8
8
|
import { offset } from '../../node_modules/@floating-ui/core/dist/floating-ui.core.js';
|
|
9
9
|
import { arrow } from '../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js';
|
|
10
10
|
import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
|
|
11
11
|
|
|
12
12
|
const ARROW_HEIGHT = 7;
|
|
13
13
|
const ARROW_GAP = 4;
|
|
14
|
+
/**
|
|
15
|
+
* Tooltip component that displays a small piece of information when hovering or focusing on an element.
|
|
16
|
+
* @example
|
|
17
|
+
* <Tooltip content='This is a tooltip'>
|
|
18
|
+
* <button>Hover me</button>
|
|
19
|
+
* </Tooltip>
|
|
20
|
+
*/
|
|
14
21
|
const Tooltip = forwardRef(({ children, content, placement = 'top', delay = 150, open: userOpen, defaultOpen = false, portal = false, className, style, ...rest }, ref) => {
|
|
15
22
|
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
16
23
|
const Container = portal ? FloatingPortal : React.Fragment;
|
|
@@ -4,7 +4,12 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Use `Heading` to render h1-6 elements with heading text styles.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <Heading size='lg' level={2}>Heading</Heading>
|
|
12
|
+
*/
|
|
8
13
|
const Heading = forwardRef(({ size = 'xl', level = 1, spacing = false, className, asChild, ...rest }, ref) => {
|
|
9
14
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : `h${level ?? 1}`;
|
|
10
15
|
return (jsx(Component, { ref: ref, className: clsx('ds-heading', `ds-heading--${size}`, spacing && 'ds-heading--spacing', className), ...rest }));
|
|
@@ -4,7 +4,12 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Use `Ingress` to display text as ingress.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <Ingress size='lg'>Ingress</Ingress>
|
|
12
|
+
*/
|
|
8
13
|
const Ingress = forwardRef(({ size = 'md', className, spacing, asChild, ...rest }, ref) => {
|
|
9
14
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'p';
|
|
10
15
|
return (jsx(Component, { ref: ref, className: clsx(`ds-ingress`, `ds-ingress--${size}`, spacing && 'ds-ingress--spacing', className), ...rest }));
|
|
@@ -4,7 +4,12 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Use `Label` for labels.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <Label size='lg'>Label</Label>
|
|
12
|
+
*/
|
|
8
13
|
const Label = forwardRef(({ className, spacing, size = 'md', weight = 'medium', asChild, ...rest }, ref) => {
|
|
9
14
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'label';
|
|
10
15
|
return (jsx(Component, { ref: ref, className: clsx('ds-label', `ds-label--${size}`, spacing && 'ds-label--spacing', weight && `ds-font-weight--${weight}`, className), ...rest }));
|
|
@@ -9,7 +9,12 @@ const lineHeightMap = {
|
|
|
9
9
|
default: 'ds-line-height--md',
|
|
10
10
|
long: 'ds-line-height--lg',
|
|
11
11
|
};
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Use `Paragraph` to display text with paragraph text styles.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <Paragraph size='lg'>Paragraph</Paragraph>
|
|
17
|
+
*/
|
|
13
18
|
const Paragraph = forwardRef(({ className, spacing, size = 'md', asChild, variant, ...rest }, ref) => {
|
|
14
19
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'p';
|
|
15
20
|
return (jsx(Component, { ref: ref, className: clsx('ds-paragraph', spacing && 'ds-paragraph--spacing', `ds-paragraph--${size}`, lineHeightMap[variant ?? 'default'], className), ...rest }));
|
|
@@ -5,7 +5,7 @@ import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
|
5
5
|
import { useMergeRefs } from '../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
6
6
|
import { useCheckbox } from './useCheckbox.js';
|
|
7
7
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
8
|
-
import { omit } from '../../../utilities/
|
|
8
|
+
import { omit } from '../../../utilities/omit/omit.js';
|
|
9
9
|
import { Label } from '../../Typography/Label/Label.js';
|
|
10
10
|
|
|
11
11
|
const Checkbox = forwardRef((props, ref) => {
|
|
@@ -5,20 +5,20 @@ import { FloatingPortal, FloatingFocusManager } from '../../../node_modules/@flo
|
|
|
5
5
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
6
6
|
import { useVirtualizer } from '../../../node_modules/@tanstack/react-virtual/dist/esm/index.js';
|
|
7
7
|
import { useFormField } from '../useFormField.js';
|
|
8
|
-
import useDebounce from '../../../utilities/useDebounce.js';
|
|
9
8
|
import useCombobox, { prefix, removePrefix } from './useCombobox.js';
|
|
10
9
|
import ComboboxInput from './internal/ComboboxInput.js';
|
|
11
10
|
import ComboboxLabel from './internal/ComboboxLabel.js';
|
|
12
11
|
import ComboboxError from './internal/ComboboxError.js';
|
|
13
12
|
import ComboboxNative from './internal/ComboboxNative.js';
|
|
14
|
-
import ComboboxCustom from './Custom.js';
|
|
13
|
+
import { ComboboxCustom } from './Custom.js';
|
|
15
14
|
import { useFloatingCombobox } from './useFloatingCombobox.js';
|
|
16
15
|
import { useComboboxKeyboard } from './useComboboxKeyboard.js';
|
|
17
16
|
import { ComboboxIdProvider } from './ComboboxIdContext.js';
|
|
18
17
|
import { ComboboxContext } from './ComboboxContext.js';
|
|
19
18
|
import { Box } from '../../Box/Box.js';
|
|
20
19
|
import { Spinner } from '../../Spinner/Spinner.js';
|
|
21
|
-
import {
|
|
20
|
+
import { useDebounceCallback } from '../../../utilities/hooks/useDebounceCallback/useDebounceCallback.js';
|
|
21
|
+
import { omit } from '../../../utilities/omit/omit.js';
|
|
22
22
|
|
|
23
23
|
const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange, label, hideLabel = false, description, multiple = false, disabled = false, readOnly = false, hideChips = false, clearButtonLabel = 'Fjern alt', hideClearButton = false, error, errorId, id, name, portal = true, htmlSize = 0, virtual = false, children, style, size = 'md', loading, loadingLabel = 'Laster...', filter, chipSrLabel = (option) => 'Slett ' + option.label, className, ...rest }, forwareddRef) => {
|
|
24
24
|
const inputRef = useRef(null);
|
|
@@ -110,7 +110,7 @@ const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange,
|
|
|
110
110
|
!multiple && setOpen(false);
|
|
111
111
|
refs.domReference.current?.focus();
|
|
112
112
|
};
|
|
113
|
-
const debouncedHandleSelectOption =
|
|
113
|
+
const debouncedHandleSelectOption = useDebounceCallback(handleSelectOption, 50);
|
|
114
114
|
const handleKeyDown = useComboboxKeyboard({
|
|
115
115
|
filteredOptions,
|
|
116
116
|
selectedOptions,
|
|
@@ -168,7 +168,7 @@ const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange,
|
|
|
168
168
|
listRef,
|
|
169
169
|
forwareddRef,
|
|
170
170
|
setListRef: (index, node) => {
|
|
171
|
-
listRef.current[index] = node;
|
|
171
|
+
return (listRef.current[index] = node);
|
|
172
172
|
},
|
|
173
173
|
}, children: [jsxs(Box, { className: clsx('ds-combobox', `ds-combobox--${size}`, disabled && 'ds-combobox__disabled', className), style: style, ref: portalRef, children: [name && (jsx(ComboboxNative, { name: name, selectedOptions: selectedOptions, multiple: multiple })), jsx(ComboboxLabel, { label: label, description: description, size: size, readOnly: readOnly, hideLabel: hideLabel, formFieldProps: formFieldProps }), jsx(ComboboxInput, { ...omit(['inputValue'], rest), hideClearButton: hideClearButton, listId: listId, error: error, hideChips: hideChips, handleKeyDown: handleKeyDown, "aria-busy": loading }), jsx(ComboboxError, { size: size, error: error, formFieldProps: formFieldProps })] }), open && (jsx(FloatingPortal, { root: portal ? null : portalRef, children: jsx(FloatingFocusManager, { context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: jsxs(Box, { id: listId, shadow: 'md', borderRadius: 'md', borderColor: 'default', "aria-labelledby": formFieldProps.inputProps.id, "aria-autocomplete": 'list', tabIndex: -1, ...getFloatingProps({
|
|
174
174
|
ref: refs.setFloating,
|
|
@@ -7,7 +7,7 @@ import { useMergeRefs } from '../../../node_modules/@floating-ui/react/dist/floa
|
|
|
7
7
|
import { ComboboxContext } from './ComboboxContext.js';
|
|
8
8
|
import { useComboboxId } from './ComboboxIdContext.js';
|
|
9
9
|
import { Label } from '../../Typography/Label/Label.js';
|
|
10
|
-
import { omit } from '../../../utilities/
|
|
10
|
+
import { omit } from '../../../utilities/omit/omit.js';
|
|
11
11
|
|
|
12
12
|
const ComboboxCustom = forwardRef(({ asChild, interactive, id, className, ...rest }, ref) => {
|
|
13
13
|
if (interactive && !id) {
|
|
@@ -30,6 +30,5 @@ const ComboboxCustom = forwardRef(({ asChild, interactive, id, className, ...res
|
|
|
30
30
|
]);
|
|
31
31
|
return (jsx(Label, { size: size, asChild: true, children: jsx(Component, { ref: combinedRef, tabIndex: -1, className: clsx('ds-combobox__custom', className), id: id || randomId, role: 'option', "aria-selected": activeIndex === index, "data-active": activeIndex === index, ...omit(['interactive'], rest), ...omit(['onClick', 'onPointerLeave'], getItemProps()) }) }));
|
|
32
32
|
});
|
|
33
|
-
var ComboboxCustom$1 = ComboboxCustom;
|
|
34
33
|
|
|
35
|
-
export { ComboboxCustom
|
|
34
|
+
export { ComboboxCustom };
|
|
@@ -9,4 +9,4 @@ const ComboboxOptionDescription = forwardRef(({ children, className, ...rest },
|
|
|
9
9
|
ComboboxOptionDescription.displayName = 'ComboboxOptionDescription';
|
|
10
10
|
var ComboboxOptionDescription$1 = ComboboxOptionDescription;
|
|
11
11
|
|
|
12
|
-
export { ComboboxOptionDescription
|
|
12
|
+
export { ComboboxOptionDescription$1 as default };
|
|
@@ -7,7 +7,7 @@ import { SelectedIcon } from './SelectedIcon.js';
|
|
|
7
7
|
import ComboboxOptionDescription from './Description.js';
|
|
8
8
|
import useComboboxOption from './useComboboxOption.js';
|
|
9
9
|
import { Label } from '../../../Typography/Label/Label.js';
|
|
10
|
-
import { omit } from '../../../../utilities/
|
|
10
|
+
import { omit } from '../../../../utilities/omit/omit.js';
|
|
11
11
|
|
|
12
12
|
const ComboboxOption = memo(forwardRef(({ value, description, children, className, ...rest }, forwardedRef) => {
|
|
13
13
|
const labelId = useId();
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { useId, useContext, useMemo, useEffect } from 'react';
|
|
3
3
|
import { useMergeRefs } from '../../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
4
4
|
import { ComboboxContext } from '../ComboboxContext.js';
|
|
5
|
-
import useDebounce from '../../../../utilities/useDebounce.js';
|
|
6
5
|
import { useComboboxId, useComboboxIdDispatch } from '../ComboboxIdContext.js';
|
|
7
6
|
import { prefix } from '../useCombobox.js';
|
|
7
|
+
import { useDebounceCallback } from '../../../../utilities/hooks/useDebounceCallback/useDebounceCallback.js';
|
|
8
8
|
|
|
9
9
|
function useComboboxOption({ id, ref, value, }) {
|
|
10
10
|
const generatedId = useId();
|
|
@@ -15,11 +15,11 @@ function useComboboxOption({ id, ref, value, }) {
|
|
|
15
15
|
if (!context) {
|
|
16
16
|
throw new Error('ComboboxOption must be used within a Combobox');
|
|
17
17
|
}
|
|
18
|
-
const { selectedOptions, onOptionClick,
|
|
18
|
+
const { selectedOptions, onOptionClick, setListRef, customIds, filteredOptions, } = context;
|
|
19
19
|
const index = useMemo(() => filteredOptions.indexOf(prefix(String(value))) + customIds.length, [customIds.length, filteredOptions, value]);
|
|
20
20
|
const combinedRef = useMergeRefs([
|
|
21
21
|
(node) => {
|
|
22
|
-
|
|
22
|
+
setListRef(index, node);
|
|
23
23
|
},
|
|
24
24
|
ref,
|
|
25
25
|
]);
|
|
@@ -33,7 +33,7 @@ function useComboboxOption({ id, ref, value, }) {
|
|
|
33
33
|
dispatch?.({ type: 'SET_ACTIVE_INDEX', payload: index });
|
|
34
34
|
}
|
|
35
35
|
}, [generatedId, id, dispatch, active, index]);
|
|
36
|
-
const onOptionClickDebounced =
|
|
36
|
+
const onOptionClickDebounced = useDebounceCallback(() => onOptionClick(value), 50);
|
|
37
37
|
return {
|
|
38
38
|
id: newId,
|
|
39
39
|
ref: combinedRef,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { ErrorMessage } from '../../../Typography/ErrorMessage/ErrorMessage.js';
|
|
4
4
|
|
|
5
|
-
const ComboboxError = ({ size, error, formFieldProps
|
|
5
|
+
const ComboboxError = ({ size, error, formFieldProps }) => {
|
|
6
6
|
return (jsx("div", { className: 'ds-combobox__error-message', id: formFieldProps.errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', children: error && jsx(ErrorMessage, { size: size, children: error }) }));
|
|
7
7
|
};
|
|
8
8
|
ComboboxError.displayName = 'ComboboxError';
|
|
9
9
|
var ComboboxError$1 = ComboboxError;
|
|
10
10
|
|
|
11
|
-
export { ComboboxError
|
|
11
|
+
export { ComboboxError$1 as default };
|
|
@@ -6,11 +6,12 @@ import { ChevronUpIcon, ChevronDownIcon } from '@navikt/aksel-icons';
|
|
|
6
6
|
import { useMergeRefs } from '../../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
7
7
|
import { ComboboxContext } from '../ComboboxContext.js';
|
|
8
8
|
import { useComboboxIdDispatch } from '../ComboboxIdContext.js';
|
|
9
|
+
import { prefix } from '../useCombobox.js';
|
|
9
10
|
import ComboboxChips from './ComboboxChips.js';
|
|
10
11
|
import ComboboxClearButton from './ComboboxClearButton.js';
|
|
11
12
|
import { Box } from '../../../Box/Box.js';
|
|
12
13
|
import { Paragraph } from '../../../Typography/Paragraph/Paragraph.js';
|
|
13
|
-
import { omit } from '../../../../utilities/
|
|
14
|
+
import { omit } from '../../../../utilities/omit/omit.js';
|
|
14
15
|
|
|
15
16
|
const ComboboxInput = ({ hideClearButton, listId, error, hideChips, handleKeyDown, ...rest }) => {
|
|
16
17
|
const context = useContext(ComboboxContext);
|
|
@@ -31,11 +32,14 @@ const ComboboxInput = ({ hideClearButton, listId, error, hideChips, handleKeyDow
|
|
|
31
32
|
// check if input value is the same as a label, if so, select it
|
|
32
33
|
Object.values(options).forEach((option) => {
|
|
33
34
|
if (option.label.toLowerCase() === value.toLowerCase()) {
|
|
35
|
+
/* if option is already selected, discard selecting it, since it would de-select */
|
|
36
|
+
if (selectedOptions[prefix(option.value)])
|
|
37
|
+
return;
|
|
34
38
|
handleSelectOption({ option: option });
|
|
35
39
|
}
|
|
36
40
|
});
|
|
37
41
|
};
|
|
38
|
-
const showClearButton =
|
|
42
|
+
const showClearButton = !hideClearButton && Object.keys(selectedOptions).length > 0;
|
|
39
43
|
/* Props from floating-ui */
|
|
40
44
|
const props = getReferenceProps({
|
|
41
45
|
ref: refs?.setReference,
|
|
@@ -71,4 +75,4 @@ const ComboboxInput = ({ hideClearButton, listId, error, hideChips, handleKeyDow
|
|
|
71
75
|
ComboboxInput.displayName = 'ComboboxInput';
|
|
72
76
|
var ComboboxInput$1 = ComboboxInput;
|
|
73
77
|
|
|
74
|
-
export { ComboboxInput
|
|
78
|
+
export { ComboboxInput$1 as default };
|
|
@@ -11,4 +11,4 @@ const ComboboxLabel = ({ label, description, hideLabel, size, readOnly, formFiel
|
|
|
11
11
|
ComboboxLabel.displayName = 'ComboboxLabel';
|
|
12
12
|
var ComboboxLabel$1 = ComboboxLabel;
|
|
13
13
|
|
|
14
|
-
export { ComboboxLabel
|
|
14
|
+
export { ComboboxLabel$1 as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useMemo, Children, useState, isValidElement } from 'react';
|
|
2
|
+
import { useCallback, useMemo, Children, useState, isValidElement } from 'react';
|
|
3
3
|
import { ComboboxOption } from './Option/Option.js';
|
|
4
|
-
import ComboboxCustom from './Custom.js';
|
|
4
|
+
import { ComboboxCustom } from './Custom.js';
|
|
5
5
|
|
|
6
6
|
const isOption = (option) => !!option;
|
|
7
7
|
function isComboboxOption(child) {
|
|
@@ -28,6 +28,7 @@ const removePrefix = (value) => {
|
|
|
28
28
|
function useCombobox({ children, inputValue, multiple, filter = (inputValue, option) => {
|
|
29
29
|
return option.label.toLowerCase().startsWith(inputValue.toLowerCase());
|
|
30
30
|
}, initialValue, }) {
|
|
31
|
+
const filterCallback = useCallback(filter, [filter]);
|
|
31
32
|
const { optionsChildren, customIds, restChildren, interactiveChildren } = useMemo(() => {
|
|
32
33
|
const allChildren = Children.toArray(children);
|
|
33
34
|
const result = allChildren.reduce((acc, child) => {
|
|
@@ -104,7 +105,7 @@ function useCombobox({ children, inputValue, multiple, filter = (inputValue, opt
|
|
|
104
105
|
filteredOptions.push(option);
|
|
105
106
|
return optionsChildren[index];
|
|
106
107
|
}
|
|
107
|
-
if (
|
|
108
|
+
if (filterCallback(inputValue, options[option])) {
|
|
108
109
|
filteredOptions.push(option);
|
|
109
110
|
return optionsChildren[index];
|
|
110
111
|
}
|
|
@@ -112,8 +113,14 @@ function useCombobox({ children, inputValue, multiple, filter = (inputValue, opt
|
|
|
112
113
|
})
|
|
113
114
|
.filter((child) => child);
|
|
114
115
|
return { filteredOptions, filteredOptionsChildren };
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
}, [
|
|
117
|
+
filterCallback,
|
|
118
|
+
inputValue,
|
|
119
|
+
multiple,
|
|
120
|
+
options,
|
|
121
|
+
optionsChildren,
|
|
122
|
+
selectedOptions,
|
|
123
|
+
]);
|
|
117
124
|
return {
|
|
118
125
|
filteredOptionsChildren,
|
|
119
126
|
filteredOptions,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import useDebounce from '../../../utilities/useDebounce.js';
|
|
3
2
|
import { useComboboxId } from './ComboboxIdContext.js';
|
|
3
|
+
import { useDebounceCallback } from '../../../utilities/hooks/useDebounceCallback/useDebounceCallback.js';
|
|
4
4
|
|
|
5
5
|
const useComboboxKeyboard = ({ readOnly, disabled, interactiveChildren, filteredOptions, inputValue, selectedOptions, multiple, open, options, setOpen, handleSelectOption, }) => {
|
|
6
6
|
const { activeIndex } = useComboboxId();
|
|
@@ -67,7 +67,7 @@ const useComboboxKeyboard = ({ readOnly, disabled, interactiveChildren, filtered
|
|
|
67
67
|
break;
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
-
const handleKeyDown =
|
|
70
|
+
const handleKeyDown = useDebounceCallback(handleKeyDownFunc, 20);
|
|
71
71
|
return handleKeyDown;
|
|
72
72
|
};
|
|
73
73
|
|
|
@@ -3,7 +3,7 @@ import { useFloating, useRole, useDismiss, useListNavigation, useInteractions }
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { flushSync } from 'react-dom';
|
|
5
5
|
import { useComboboxId, useComboboxIdDispatch } from './ComboboxIdContext.js';
|
|
6
|
-
import { autoUpdate, flip, size } from '../../../node_modules/@floating-ui/
|
|
6
|
+
import { autoUpdate, flip, size } from '../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
|
|
7
7
|
import { offset } from '../../../node_modules/@floating-ui/core/dist/floating-ui.core.js';
|
|
8
8
|
|
|
9
9
|
const useFloatingCombobox = ({ listRef }) => {
|
|
@@ -37,7 +37,7 @@ const useFloatingCombobox = ({ listRef }) => {
|
|
|
37
37
|
apply({ rects, elements }) {
|
|
38
38
|
requestAnimationFrame(() => {
|
|
39
39
|
Object.assign(elements.floating.style, {
|
|
40
|
-
width:
|
|
40
|
+
width: `${rects.reference.width}px`,
|
|
41
41
|
maxHeight: `200px`,
|
|
42
42
|
});
|
|
43
43
|
});
|
|
@@ -5,7 +5,7 @@ import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
|
5
5
|
import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
|
|
6
6
|
import { useNativeSelect } from './useNativeSelect.js';
|
|
7
7
|
import { Label } from '../../Typography/Label/Label.js';
|
|
8
|
-
import { omit } from '../../../utilities/
|
|
8
|
+
import { omit } from '../../../utilities/omit/omit.js';
|
|
9
9
|
import { ErrorMessage } from '../../Typography/ErrorMessage/ErrorMessage.js';
|
|
10
10
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { useRadio } from './useRadio.js';
|
|
6
6
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
7
|
-
import { omit } from '../../../utilities/
|
|
7
|
+
import { omit } from '../../../utilities/omit/omit.js';
|
|
8
8
|
import { Label } from '../../Typography/Label/Label.js';
|
|
9
9
|
|
|
10
10
|
const Radio = forwardRef((props, ref) => {
|