@navikt/ds-react 6.7.0 → 6.8.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/cjs/chat/Chat.d.ts +2 -1
- package/cjs/chat/Chat.js +2 -1
- package/cjs/chat/Chat.js.map +1 -1
- package/cjs/collapsible/parts/Collapsible.Trigger.d.ts +4 -0
- package/cjs/collapsible/parts/Collapsible.Trigger.js +1 -1
- package/cjs/collapsible/parts/Collapsible.Trigger.js.map +1 -1
- package/cjs/date/datepicker/parts/DropdownCaption.js +1 -1
- package/cjs/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/cjs/date/monthpicker/MonthCaption.js +1 -1
- package/cjs/date/utils/labels.d.ts +2 -2
- package/cjs/form/ReadOnlyIcon.d.ts +2 -2
- package/cjs/form/combobox/Combobox.js +7 -22
- package/cjs/form/combobox/Combobox.js.map +1 -1
- package/cjs/form/combobox/ComboboxProvider.js +2 -2
- package/cjs/form/combobox/ComboboxProvider.js.map +1 -1
- package/cjs/form/combobox/ComboboxWrapper.d.ts +1 -2
- package/cjs/form/combobox/ComboboxWrapper.js +4 -2
- package/cjs/form/combobox/ComboboxWrapper.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +4 -4
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +4 -4
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +13 -15
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/cjs/form/combobox/Input/{inputContext.d.ts → Input.context.d.ts} +7 -5
- package/cjs/form/combobox/Input/{inputContext.js → Input.context.js} +22 -22
- package/cjs/form/combobox/Input/Input.context.js.map +1 -0
- package/cjs/form/combobox/Input/Input.js +2 -2
- package/cjs/form/combobox/Input/Input.js.map +1 -1
- package/cjs/form/combobox/Input/InputController.d.ts +3 -0
- package/cjs/form/combobox/Input/InputController.js +70 -0
- package/cjs/form/combobox/Input/InputController.js.map +1 -0
- package/cjs/form/combobox/{ToggleListButton.js → Input/ToggleListButton.js} +1 -1
- package/cjs/form/combobox/Input/ToggleListButton.js.map +1 -0
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js +2 -2
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +4 -4
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +7 -13
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/cjs/form/combobox/customOptionsContext.d.ts +4 -4
- package/cjs/form/combobox/customOptionsContext.js +10 -13
- package/cjs/form/combobox/customOptionsContext.js.map +1 -1
- package/cjs/form/combobox/types.d.ts +1 -1
- package/cjs/form/file-upload/FileUpload.context.d.ts +1 -1
- package/cjs/form/file-upload/FileUpload.d.ts +1 -1
- package/cjs/form/file-upload/FileUpload.js.map +1 -1
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js +1 -1
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/cjs/form/file-upload/parts/dropzone/dropzone.types.d.ts +1 -1
- package/cjs/form/file-upload/parts/item/Item.d.ts +1 -1
- package/cjs/form/file-upload/parts/item/Item.js +1 -1
- package/cjs/form/file-upload/parts/item/Item.js.map +1 -1
- package/cjs/form/form-progress/FormProgress.d.ts +66 -0
- package/cjs/form/form-progress/FormProgress.js +85 -0
- package/cjs/form/form-progress/FormProgress.js.map +1 -0
- package/cjs/form/form-progress/index.d.ts +1 -0
- package/cjs/form/form-progress/index.js +11 -0
- package/cjs/form/form-progress/index.js.map +1 -0
- package/cjs/help-text/HelpTextIcon.d.ts +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +3 -1
- package/cjs/index.js.map +1 -1
- package/cjs/overlay/dismiss/DismissableLayer.d.ts +70 -0
- package/cjs/overlay/dismiss/DismissableLayer.js +253 -0
- package/cjs/overlay/dismiss/DismissableLayer.js.map +1 -0
- package/cjs/overlay/dismiss/util/dispatchCustomEvent.d.ts +50 -0
- package/cjs/overlay/dismiss/util/dispatchCustomEvent.js +65 -0
- package/cjs/overlay/dismiss/util/dispatchCustomEvent.js.map +1 -0
- package/cjs/overlay/dismiss/util/useEscapeKeydown.d.ts +1 -0
- package/cjs/overlay/dismiss/util/useEscapeKeydown.js +19 -0
- package/cjs/overlay/dismiss/util/useEscapeKeydown.js.map +1 -0
- package/cjs/overlay/dismiss/util/useFocusOutside.d.ts +8 -0
- package/cjs/overlay/dismiss/util/useFocusOutside.js +42 -0
- package/cjs/overlay/dismiss/util/useFocusOutside.js.map +1 -0
- package/cjs/overlay/dismiss/util/usePointerDownOutside.d.ts +10 -0
- package/cjs/overlay/dismiss/util/usePointerDownOutside.js +84 -0
- package/cjs/overlay/dismiss/util/usePointerDownOutside.js.map +1 -0
- package/cjs/overlays/floating/Floating.d.ts +53 -0
- package/cjs/overlays/floating/Floating.js +215 -0
- package/cjs/overlays/floating/Floating.js.map +1 -0
- package/cjs/overlays/floating/Floating.utils.d.ts +18 -0
- package/cjs/overlays/floating/Floating.utils.js +52 -0
- package/cjs/overlays/floating/Floating.utils.js.map +1 -0
- package/cjs/popover/Popover.js +13 -28
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/progress-bar/ProgressBar.d.ts +20 -8
- package/cjs/progress-bar/ProgressBar.js +19 -9
- package/cjs/progress-bar/ProgressBar.js.map +1 -1
- package/cjs/stepper/Step.js +1 -1
- package/cjs/stepper/Step.js.map +1 -1
- package/cjs/stepper/Stepper.d.ts +1 -1
- package/cjs/stepper/Stepper.js +1 -1
- package/cjs/tabs/Tabs.context.d.ts +7 -3
- package/cjs/tabs/Tabs.context.js +1 -0
- package/cjs/tabs/Tabs.context.js.map +1 -1
- package/cjs/timeline/AxisLabels.d.ts +1 -1
- package/cjs/toggle-group/ToggleGroup.context.d.ts +7 -3
- package/cjs/toggle-group/ToggleGroup.context.js +1 -0
- package/cjs/toggle-group/ToggleGroup.context.js.map +1 -1
- package/cjs/util/hooks/descendants/useDescendant.d.ts +2 -2
- package/cjs/util/hooks/descendants/useDescendant.js +49 -52
- package/cjs/util/hooks/descendants/useDescendant.js.map +1 -1
- package/cjs/util/i18n/get.js.map +1 -0
- package/cjs/util/i18n/i18n.context.js.map +1 -0
- package/cjs/util/i18n/i18n.types.js.map +1 -0
- package/{esm/form/file-upload → cjs/util}/i18n/locales/nb.d.ts +5 -0
- package/cjs/{form/file-upload → util}/i18n/locales/nb.js +5 -0
- package/cjs/util/i18n/locales/nb.js.map +1 -0
- package/cjs/util/i18n/merge.js.map +1 -0
- package/cjs/util/types/AsChild.d.ts +14 -0
- package/cjs/util/types/AsChild.js +3 -0
- package/cjs/util/types/AsChild.js.map +1 -0
- package/esm/chat/Chat.d.ts +2 -1
- package/esm/chat/Chat.js +1 -0
- package/esm/chat/Chat.js.map +1 -1
- package/esm/collapsible/parts/Collapsible.Trigger.d.ts +4 -0
- package/esm/collapsible/parts/Collapsible.Trigger.js +1 -1
- package/esm/collapsible/parts/Collapsible.Trigger.js.map +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/esm/date/monthpicker/MonthCaption.js +1 -1
- package/esm/date/utils/labels.d.ts +2 -2
- package/esm/form/ReadOnlyIcon.d.ts +2 -2
- package/esm/form/combobox/Combobox.js +8 -23
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/ComboboxProvider.js +1 -1
- package/esm/form/combobox/ComboboxProvider.js.map +1 -1
- package/esm/form/combobox/ComboboxWrapper.d.ts +1 -2
- package/esm/form/combobox/ComboboxWrapper.js +4 -2
- package/esm/form/combobox/ComboboxWrapper.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js +3 -3
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +4 -4
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +15 -16
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/Input/{inputContext.d.ts → Input.context.d.ts} +7 -5
- package/esm/form/combobox/Input/{inputContext.js → Input.context.js} +22 -21
- package/esm/form/combobox/Input/Input.context.js.map +1 -0
- package/esm/form/combobox/Input/Input.js +1 -1
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/Input/InputController.d.ts +3 -0
- package/esm/form/combobox/Input/InputController.js +41 -0
- package/esm/form/combobox/Input/InputController.js.map +1 -0
- package/esm/form/combobox/{ToggleListButton.js → Input/ToggleListButton.js} +1 -1
- package/esm/form/combobox/Input/ToggleListButton.js.map +1 -0
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js +1 -1
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +4 -4
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +9 -14
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/esm/form/combobox/customOptionsContext.d.ts +4 -4
- package/esm/form/combobox/customOptionsContext.js +10 -12
- package/esm/form/combobox/customOptionsContext.js.map +1 -1
- package/esm/form/combobox/types.d.ts +1 -1
- package/esm/form/file-upload/FileUpload.context.d.ts +1 -1
- package/esm/form/file-upload/FileUpload.d.ts +1 -1
- package/esm/form/file-upload/FileUpload.js.map +1 -1
- package/esm/form/file-upload/parts/dropzone/Dropzone.js +1 -1
- package/esm/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/esm/form/file-upload/parts/dropzone/dropzone.types.d.ts +1 -1
- package/esm/form/file-upload/parts/item/Item.d.ts +1 -1
- package/esm/form/file-upload/parts/item/Item.js +1 -1
- package/esm/form/file-upload/parts/item/Item.js.map +1 -1
- package/esm/form/form-progress/FormProgress.d.ts +66 -0
- package/esm/form/form-progress/FormProgress.js +56 -0
- package/esm/form/form-progress/FormProgress.js.map +1 -0
- package/esm/form/form-progress/index.d.ts +1 -0
- package/esm/form/form-progress/index.js +3 -0
- package/esm/form/form-progress/index.js.map +1 -0
- package/esm/help-text/HelpTextIcon.d.ts +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/overlay/dismiss/DismissableLayer.d.ts +70 -0
- package/esm/overlay/dismiss/DismissableLayer.js +226 -0
- package/esm/overlay/dismiss/DismissableLayer.js.map +1 -0
- package/esm/overlay/dismiss/util/dispatchCustomEvent.d.ts +50 -0
- package/esm/overlay/dismiss/util/dispatchCustomEvent.js +58 -0
- package/esm/overlay/dismiss/util/dispatchCustomEvent.js.map +1 -0
- package/esm/overlay/dismiss/util/useEscapeKeydown.d.ts +1 -0
- package/esm/overlay/dismiss/util/useEscapeKeydown.js +15 -0
- package/esm/overlay/dismiss/util/useEscapeKeydown.js.map +1 -0
- package/esm/overlay/dismiss/util/useFocusOutside.d.ts +8 -0
- package/esm/overlay/dismiss/util/useFocusOutside.js +38 -0
- package/esm/overlay/dismiss/util/useFocusOutside.js.map +1 -0
- package/esm/overlay/dismiss/util/usePointerDownOutside.d.ts +10 -0
- package/esm/overlay/dismiss/util/usePointerDownOutside.js +80 -0
- package/esm/overlay/dismiss/util/usePointerDownOutside.js.map +1 -0
- package/esm/overlays/floating/Floating.d.ts +53 -0
- package/esm/overlays/floating/Floating.js +188 -0
- package/esm/overlays/floating/Floating.js.map +1 -0
- package/esm/overlays/floating/Floating.utils.d.ts +18 -0
- package/esm/overlays/floating/Floating.utils.js +48 -0
- package/esm/overlays/floating/Floating.utils.js.map +1 -0
- package/esm/popover/Popover.js +16 -31
- package/esm/popover/Popover.js.map +1 -1
- package/esm/progress-bar/ProgressBar.d.ts +20 -8
- package/esm/progress-bar/ProgressBar.js +20 -10
- package/esm/progress-bar/ProgressBar.js.map +1 -1
- package/esm/stepper/Step.js +1 -1
- package/esm/stepper/Step.js.map +1 -1
- package/esm/stepper/Stepper.d.ts +1 -1
- package/esm/stepper/Stepper.js +1 -1
- package/esm/tabs/Tabs.context.d.ts +7 -3
- package/esm/tabs/Tabs.context.js +1 -0
- package/esm/tabs/Tabs.context.js.map +1 -1
- package/esm/timeline/AxisLabels.d.ts +1 -1
- package/esm/toggle-group/ToggleGroup.context.d.ts +7 -3
- package/esm/toggle-group/ToggleGroup.context.js +1 -0
- package/esm/toggle-group/ToggleGroup.context.js.map +1 -1
- package/esm/util/hooks/descendants/useDescendant.d.ts +2 -2
- package/esm/util/hooks/descendants/useDescendant.js +49 -52
- package/esm/util/hooks/descendants/useDescendant.js.map +1 -1
- package/esm/util/i18n/get.js.map +1 -0
- package/esm/util/i18n/i18n.context.js.map +1 -0
- package/esm/util/i18n/i18n.types.js.map +1 -0
- package/{cjs/form/file-upload → esm/util}/i18n/locales/nb.d.ts +5 -0
- package/esm/{form/file-upload → util}/i18n/locales/nb.js +5 -0
- package/esm/util/i18n/locales/nb.js.map +1 -0
- package/esm/util/i18n/merge.js.map +1 -0
- package/esm/util/types/AsChild.d.ts +14 -0
- package/esm/util/types/AsChild.js +2 -0
- package/esm/util/types/AsChild.js.map +1 -0
- package/package.json +16 -5
- package/src/chat/Chat.tsx +2 -1
- package/src/collapsible/parts/Collapsible.Trigger.tsx +5 -1
- package/src/date/datepicker/parts/DropdownCaption.tsx +5 -1
- package/src/date/monthpicker/MonthCaption.tsx +1 -1
- package/src/form/combobox/Combobox.tsx +6 -76
- package/src/form/combobox/ComboboxProvider.tsx +1 -1
- package/src/form/combobox/ComboboxWrapper.tsx +4 -3
- package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +3 -3
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +19 -29
- package/src/form/combobox/Input/{inputContext.tsx → Input.context.tsx} +30 -33
- package/src/form/combobox/Input/Input.tsx +1 -1
- package/src/form/combobox/Input/InputController.tsx +102 -0
- package/src/form/combobox/{ToggleListButton.tsx → Input/ToggleListButton.tsx} +1 -1
- package/src/form/combobox/SelectedOptions/SelectedOptions.tsx +1 -1
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +12 -26
- package/src/form/combobox/{combobox-utils.test.ts → __tests__/combobox-utils.test.ts} +1 -1
- package/src/form/combobox/{combobox.test.tsx → __tests__/combobox.test.tsx} +2 -3
- package/src/form/combobox/customOptionsContext.tsx +14 -18
- package/src/form/combobox/types.ts +3 -1
- package/src/form/file-upload/FileUpload.context.tsx +1 -1
- package/src/form/file-upload/FileUpload.tsx +1 -1
- package/src/form/file-upload/parts/dropzone/Dropzone.tsx +1 -1
- package/src/form/file-upload/parts/dropzone/dropzone.types.ts +1 -1
- package/src/form/file-upload/parts/item/Item.tsx +2 -2
- package/src/form/form-progress/FormProgress.tsx +152 -0
- package/src/form/form-progress/index.ts +7 -0
- package/src/index.ts +1 -0
- package/src/overlay/README.md +5 -0
- package/src/overlay/dismiss/DismissableLayer.tsx +368 -0
- package/src/overlay/dismiss/util/dispatchCustomEvent.ts +77 -0
- package/src/overlay/dismiss/util/useEscapeKeydown.ts +21 -0
- package/src/overlay/dismiss/util/useFocusOutside.ts +52 -0
- package/src/overlay/dismiss/util/usePointerDownOutside.ts +95 -0
- package/src/overlays/floating/Floating.tsx +399 -0
- package/src/overlays/floating/Floating.utils.ts +63 -0
- package/src/popover/Popover.tsx +38 -70
- package/src/progress-bar/ProgressBar.tsx +45 -20
- package/src/stepper/Step.tsx +1 -1
- package/src/stepper/Stepper.tsx +1 -1
- package/src/tabs/Tabs.context.ts +2 -0
- package/src/toggle-group/ToggleGroup.context.ts +1 -0
- package/src/util/hooks/descendants/useDescendant.tsx +55 -68
- package/src/{form/file-upload → util}/i18n/locales/nb.ts +5 -0
- package/src/util/types/AsChild.ts +15 -0
- package/cjs/form/combobox/ClearButton.d.ts +0 -7
- package/cjs/form/combobox/ClearButton.js +0 -28
- package/cjs/form/combobox/ClearButton.js.map +0 -1
- package/cjs/form/combobox/FilteredOptions/CheckIcon.d.ts +0 -3
- package/cjs/form/combobox/FilteredOptions/CheckIcon.js +0 -12
- package/cjs/form/combobox/FilteredOptions/CheckIcon.js.map +0 -1
- package/cjs/form/combobox/Input/inputContext.js.map +0 -1
- package/cjs/form/combobox/ToggleListButton.js.map +0 -1
- package/cjs/form/file-upload/i18n/get.js.map +0 -1
- package/cjs/form/file-upload/i18n/i18n.context.js.map +0 -1
- package/cjs/form/file-upload/i18n/i18n.types.js.map +0 -1
- package/cjs/form/file-upload/i18n/locales/nb.js.map +0 -1
- package/cjs/form/file-upload/i18n/merge.js.map +0 -1
- package/esm/form/combobox/ClearButton.d.ts +0 -7
- package/esm/form/combobox/ClearButton.js +0 -21
- package/esm/form/combobox/ClearButton.js.map +0 -1
- package/esm/form/combobox/FilteredOptions/CheckIcon.d.ts +0 -3
- package/esm/form/combobox/FilteredOptions/CheckIcon.js +0 -7
- package/esm/form/combobox/FilteredOptions/CheckIcon.js.map +0 -1
- package/esm/form/combobox/Input/inputContext.js.map +0 -1
- package/esm/form/combobox/ToggleListButton.js.map +0 -1
- package/esm/form/file-upload/i18n/get.js.map +0 -1
- package/esm/form/file-upload/i18n/i18n.context.js.map +0 -1
- package/esm/form/file-upload/i18n/i18n.types.js.map +0 -1
- package/esm/form/file-upload/i18n/locales/nb.js.map +0 -1
- package/esm/form/file-upload/i18n/merge.js.map +0 -1
- package/src/form/combobox/ClearButton.tsx +0 -29
- package/src/form/combobox/FilteredOptions/CheckIcon.tsx +0 -23
- /package/cjs/form/combobox/{ToggleListButton.d.ts → Input/ToggleListButton.d.ts} +0 -0
- /package/cjs/{form/file-upload → util}/i18n/get.d.ts +0 -0
- /package/cjs/{form/file-upload → util}/i18n/get.js +0 -0
- /package/cjs/{form/file-upload → util}/i18n/i18n.context.d.ts +0 -0
- /package/cjs/{form/file-upload → util}/i18n/i18n.context.js +0 -0
- /package/cjs/{form/file-upload → util}/i18n/i18n.types.d.ts +0 -0
- /package/cjs/{form/file-upload → util}/i18n/i18n.types.js +0 -0
- /package/cjs/{form/file-upload → util}/i18n/merge.d.ts +0 -0
- /package/cjs/{form/file-upload → util}/i18n/merge.js +0 -0
- /package/esm/form/combobox/{ToggleListButton.d.ts → Input/ToggleListButton.d.ts} +0 -0
- /package/esm/{form/file-upload → util}/i18n/get.d.ts +0 -0
- /package/esm/{form/file-upload → util}/i18n/get.js +0 -0
- /package/esm/{form/file-upload → util}/i18n/i18n.context.d.ts +0 -0
- /package/esm/{form/file-upload → util}/i18n/i18n.context.js +0 -0
- /package/esm/{form/file-upload → util}/i18n/i18n.types.d.ts +0 -0
- /package/esm/{form/file-upload → util}/i18n/i18n.types.js +0 -0
- /package/esm/{form/file-upload → util}/i18n/merge.d.ts +0 -0
- /package/esm/{form/file-upload → util}/i18n/merge.js +0 -0
- /package/src/{form/file-upload → util}/i18n/get.ts +0 -0
- /package/src/{form/file-upload → util}/i18n/i18n.context.test.tsx +0 -0
- /package/src/{form/file-upload → util}/i18n/i18n.context.ts +0 -0
- /package/src/{form/file-upload → util}/i18n/i18n.types.ts +0 -0
- /package/src/{form/file-upload → util}/i18n/merge.ts +0 -0
|
@@ -7,14 +7,18 @@ interface ToggleContextProps {
|
|
|
7
7
|
export declare const ToggleGroupContext: import("react").Context<ToggleContextProps | null>;
|
|
8
8
|
export declare const ToggleGroupDescendantsProvider: import("react").Provider<import("../util/hooks/descendants/descendant.js").DescendantsManager<HTMLButtonElement, {
|
|
9
9
|
value: string;
|
|
10
|
-
}>>, useToggleGroupDescendantsContext: () => import("../util/hooks/descendants/descendant.js").DescendantsManager<HTMLButtonElement, {
|
|
10
|
+
}>>, useToggleGroupDescendantsContext: <S extends boolean = true>(strict?: S) => S extends true ? import("../util/hooks/descendants/descendant.js").DescendantsManager<HTMLButtonElement, {
|
|
11
11
|
value: string;
|
|
12
|
-
}
|
|
12
|
+
}> : import("../util/hooks/descendants/descendant.js").DescendantsManager<HTMLButtonElement, {
|
|
13
|
+
value: string;
|
|
14
|
+
}> | undefined, useToggleGroupDescendants: () => import("../util/hooks/descendants/descendant.js").DescendantsManager<HTMLButtonElement, {
|
|
13
15
|
value: string;
|
|
14
16
|
}>, useToggleGroupDescendant: (options?: import("../util/hooks/descendants/descendant.js").DescendantOptions<{
|
|
15
17
|
value: string;
|
|
16
18
|
}> | undefined) => {
|
|
17
|
-
descendants: import("../util/hooks/descendants/descendant.js").DescendantsManager<
|
|
19
|
+
descendants: import("../util/hooks/descendants/descendant.js").DescendantsManager<HTMLButtonElement, {
|
|
20
|
+
value: string;
|
|
21
|
+
}>;
|
|
18
22
|
index: number;
|
|
19
23
|
enabledIndex: number;
|
|
20
24
|
register: (instance: HTMLButtonElement | null) => void;
|
|
@@ -8,5 +8,6 @@ export const [ToggleGroupProvider, useToggleGroupContext] = createContext({
|
|
|
8
8
|
name: "ToggleGroupContext",
|
|
9
9
|
hookName: "useToggleGroupContext",
|
|
10
10
|
providerName: "ToggleGroupProvider",
|
|
11
|
+
errorMessage: "<ToggleGroup.Item> needs to be wrapped within <ToggleGroup>",
|
|
11
12
|
});
|
|
12
13
|
//# sourceMappingURL=ToggleGroup.context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleGroup.context.js","sourceRoot":"","sources":["../../src/toggle-group/ToggleGroup.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAQlF,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAClD,IAAI,CACL,CAAC;AAEF,MAAM,CAAC,MAAM,CACX,8BAA8B,EAC9B,gCAAgC,EAChC,yBAAyB,EACzB,wBAAwB,EACzB,GAAG,uBAAuB,EAAwC,CAAC;AAKpE,mBAAmB;AACnB,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,GACvD,aAAa,CAA2B;IACtC,IAAI,EAAE,oBAAoB;IAC1B,QAAQ,EAAE,uBAAuB;IACjC,YAAY,EAAE,qBAAqB;
|
|
1
|
+
{"version":3,"file":"ToggleGroup.context.js","sourceRoot":"","sources":["../../src/toggle-group/ToggleGroup.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAQlF,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAClD,IAAI,CACL,CAAC;AAEF,MAAM,CAAC,MAAM,CACX,8BAA8B,EAC9B,gCAAgC,EAChC,yBAAyB,EACzB,wBAAwB,EACzB,GAAG,uBAAuB,EAAwC,CAAC;AAKpE,mBAAmB;AACnB,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,GACvD,aAAa,CAA2B;IACtC,IAAI,EAAE,oBAAoB;IAC1B,QAAQ,EAAE,uBAAuB;IACjC,YAAY,EAAE,qBAAqB;IACnC,YAAY,EAAE,6DAA6D;CAC5E,CAAC,CAAC"}
|
|
@@ -6,8 +6,8 @@ import { DescendantOptions, DescendantsManager } from "./descendant.js";
|
|
|
6
6
|
/**
|
|
7
7
|
* Provides strongly typed versions of the context provider and hooks above.
|
|
8
8
|
*/
|
|
9
|
-
export declare function createDescendantContext<T extends HTMLElement = HTMLElement, K extends Record<string, any> = object>(): readonly [React.Provider<DescendantsManager<T, K>>, () => DescendantsManager<T, K
|
|
10
|
-
descendants: DescendantsManager<
|
|
9
|
+
export declare function createDescendantContext<T extends HTMLElement = HTMLElement, K extends Record<string, any> = object>(): readonly [React.Provider<DescendantsManager<T, K>>, <S extends boolean = true>(strict?: S) => S extends true ? DescendantsManager<T, K> : DescendantsManager<T, K> | undefined, () => DescendantsManager<T, K>, (options?: DescendantOptions<K>) => {
|
|
10
|
+
descendants: DescendantsManager<T, K>;
|
|
11
11
|
index: number;
|
|
12
12
|
enabledIndex: number;
|
|
13
13
|
register: (instance: T | null) => void;
|
|
@@ -7,67 +7,64 @@ import { useClientLayoutEffect } from "../useClientLayoutEffect.js";
|
|
|
7
7
|
import { mergeRefs } from "../useMergeRefs.js";
|
|
8
8
|
import { DescendantsManager } from "./descendant.js";
|
|
9
9
|
import { cast } from "./utils.js";
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
* Initializing DescendantsManager
|
|
13
|
-
*/
|
|
14
|
-
function useDescendants() {
|
|
15
|
-
const descendants = useRef(new DescendantsManager()).current;
|
|
16
|
-
return descendants;
|
|
17
|
-
}
|
|
18
|
-
const [DescendantsContextProvider, useDescendantsContext] = createContext({
|
|
19
|
-
name: "DescendantsProvider",
|
|
20
|
-
errorMessage: "useDescendantsContext must be used within DescendantsProvider",
|
|
21
|
-
});
|
|
22
|
-
/**
|
|
23
|
-
* @internal
|
|
24
|
-
* This hook provides information to descendant component:
|
|
25
|
-
* - Index compared to other descendants
|
|
26
|
-
* - ref callback to register the descendant
|
|
27
|
-
* - Its enabled index compared to other enabled descendants
|
|
28
|
-
*/
|
|
29
|
-
function useDescendant(options) {
|
|
30
|
-
const descendants = useDescendantsContext();
|
|
31
|
-
const [index, setIndex] = useState(-1);
|
|
32
|
-
const ref = useRef(null);
|
|
33
|
-
useClientLayoutEffect(() => {
|
|
34
|
-
return () => {
|
|
35
|
-
if (!ref.current)
|
|
36
|
-
return;
|
|
37
|
-
descendants.unregister(ref.current);
|
|
38
|
-
};
|
|
39
|
-
}, []);
|
|
40
|
-
useClientLayoutEffect(() => {
|
|
41
|
-
if (!ref.current)
|
|
42
|
-
return;
|
|
43
|
-
const dataIndex = Number(ref.current.dataset["index"]);
|
|
44
|
-
if (index != dataIndex && !Number.isNaN(dataIndex)) {
|
|
45
|
-
setIndex(dataIndex);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
const refCallback = options
|
|
49
|
-
? cast(descendants.register(options))
|
|
50
|
-
: cast(descendants.register);
|
|
51
|
-
return {
|
|
52
|
-
descendants,
|
|
53
|
-
index,
|
|
54
|
-
enabledIndex: descendants.enabledIndexOf(ref.current),
|
|
55
|
-
register: mergeRefs([refCallback, ref]),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
10
|
/**
|
|
59
11
|
* Provides strongly typed versions of the context provider and hooks above.
|
|
60
12
|
*/
|
|
61
13
|
export function createDescendantContext() {
|
|
14
|
+
const [DescendantsContextProvider, useDescendantsContext] = createContext({
|
|
15
|
+
name: "DescendantsProvider",
|
|
16
|
+
errorMessage: "useDescendantsContext must be used within DescendantsProvider",
|
|
17
|
+
});
|
|
62
18
|
const ContextProvider = cast((props) => (React.createElement(DescendantsContextProvider, Object.assign({}, props.value), props.children)));
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
* This hook provides information to descendant component:
|
|
22
|
+
* - Index compared to other descendants
|
|
23
|
+
* - ref callback to register the descendant
|
|
24
|
+
* - Its enabled index compared to other enabled descendants
|
|
25
|
+
*/
|
|
26
|
+
function _useDescendant(options) {
|
|
27
|
+
const descendants = useDescendantsContext();
|
|
28
|
+
const [index, setIndex] = useState(-1);
|
|
29
|
+
const ref = useRef(null);
|
|
30
|
+
useClientLayoutEffect(() => {
|
|
31
|
+
return () => {
|
|
32
|
+
if (!ref.current)
|
|
33
|
+
return;
|
|
34
|
+
descendants.unregister(ref.current);
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
37
|
+
useClientLayoutEffect(() => {
|
|
38
|
+
if (!ref.current)
|
|
39
|
+
return;
|
|
40
|
+
const dataIndex = Number(ref.current.dataset["index"]);
|
|
41
|
+
if (index != dataIndex && !Number.isNaN(dataIndex)) {
|
|
42
|
+
setIndex(dataIndex);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const refCallback = options
|
|
46
|
+
? cast(descendants.register(options))
|
|
47
|
+
: cast(descendants.register);
|
|
48
|
+
return {
|
|
49
|
+
descendants,
|
|
50
|
+
index,
|
|
51
|
+
enabledIndex: descendants.enabledIndexOf(ref.current),
|
|
52
|
+
register: mergeRefs([refCallback, ref]),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
* Initializing DescendantsManager
|
|
58
|
+
*/
|
|
59
|
+
function _useDescendants() {
|
|
60
|
+
const descendants = useRef(new DescendantsManager()).current;
|
|
61
|
+
return descendants;
|
|
62
|
+
}
|
|
66
63
|
return [
|
|
67
64
|
// context provider
|
|
68
65
|
ContextProvider,
|
|
69
66
|
// call this when you need to read from context
|
|
70
|
-
|
|
67
|
+
useDescendantsContext,
|
|
71
68
|
// descendants state information, to be called and passed to `ContextProvider`
|
|
72
69
|
_useDescendants,
|
|
73
70
|
// descendant index information
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDescendant.js","sourceRoot":"","sources":["../../../../src/util/hooks/descendants/useDescendant.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAqB,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B
|
|
1
|
+
{"version":3,"file":"useDescendant.js","sourceRoot":"","sources":["../../../../src/util/hooks/descendants/useDescendant.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,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js","sourceRoot":"","sources":["../../../src/util/i18n/i18n.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nb.js","sourceRoot":"","sources":["../../../../src/util/i18n/locales/nb.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,MAAM,EAAE,UAAU;YAClB,cAAc,EAAE,YAAY;YAC5B,WAAW,EAAE,wBAAwB;YACrC,mBAAmB,EAAE,wBAAwB;YAC7C,IAAI,EAAE,OAAO;YACb,EAAE,EAAE,OAAO;YACX,QAAQ,EAAE,6BAA6B;YACvC,iBAAiB,EAAE,mCAAmC;SACvD;QACD,IAAI,EAAE;YACJ,gBAAgB,EAAE,gCAAgC;YAClD,iBAAiB,EAAE,aAAa;YAChC,SAAS,EAAE,aAAa;YACxB,WAAW,EAAE,aAAa;SAC3B;KACF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,mCAAmC;QACzC,YAAY,EAAE,eAAe;QAC7B,YAAY,EAAE,iBAAiB;KAChC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../../src/util/i18n/merge.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,KAAK,CAAC,GAAG,IAA6B;IACpD,IAAI,KAAK,GAA0B,EAAE,CAAC;IAEtC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,KAAK,GAAG,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,gBAAgB,CACvB,IAAO,EACP,IAA+C;IAE/C,MAAM,OAAO,qBAAQ,IAAI,CAAE,CAAC;IAE5B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC;YACnB,SAAS;QACX,CAAC;QAED,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAEpB,IAAI,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type AsChild = {
|
|
3
|
+
children: React.ReactElement;
|
|
4
|
+
/**
|
|
5
|
+
* Renders the children as a child of the component. Merges the props of the component with the props of the child.
|
|
6
|
+
*/
|
|
7
|
+
asChild: true;
|
|
8
|
+
} | {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Renders the children as a child of the component. Merges the props of the component with the props of the child.
|
|
12
|
+
*/
|
|
13
|
+
asChild?: false;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsChild.js","sourceRoot":"","sources":["../../../src/util/types/AsChild.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.0",
|
|
4
4
|
"description": "React components from the Norwegian Labour and Welfare Administration.",
|
|
5
5
|
"author": "Aksel, a team part of the Norwegian Labour and Welfare Administration.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -570,6 +570,16 @@
|
|
|
570
570
|
"default": "./cjs/form/form-summary/index.js"
|
|
571
571
|
}
|
|
572
572
|
},
|
|
573
|
+
"./FormProgress": {
|
|
574
|
+
"import": {
|
|
575
|
+
"types": "./esm/form/form-progress/index.d.ts",
|
|
576
|
+
"default": "./esm/form/form-progress/index.js"
|
|
577
|
+
},
|
|
578
|
+
"require": {
|
|
579
|
+
"types": "./cjs/form/form-progress/index.d.ts",
|
|
580
|
+
"default": "./cjs/form/form-progress/index.js"
|
|
581
|
+
}
|
|
582
|
+
},
|
|
573
583
|
"./package.json": "./package.json"
|
|
574
584
|
},
|
|
575
585
|
"scripts": {
|
|
@@ -583,16 +593,17 @@
|
|
|
583
593
|
},
|
|
584
594
|
"dependencies": {
|
|
585
595
|
"@floating-ui/react": "0.25.4",
|
|
586
|
-
"@
|
|
587
|
-
"@navikt/
|
|
596
|
+
"@floating-ui/react-dom": "^2.0.9",
|
|
597
|
+
"@navikt/aksel-icons": "^6.8.0",
|
|
598
|
+
"@navikt/ds-tokens": "^6.8.0",
|
|
588
599
|
"clsx": "^2.1.0",
|
|
589
600
|
"date-fns": "^3.0.0",
|
|
590
601
|
"react-day-picker": "8.10.0"
|
|
591
602
|
},
|
|
592
603
|
"devDependencies": {
|
|
593
|
-
"@testing-library/dom": "
|
|
604
|
+
"@testing-library/dom": "9.3.4",
|
|
594
605
|
"@testing-library/jest-dom": "^5.16.0",
|
|
595
|
-
"@testing-library/react": "^
|
|
606
|
+
"@testing-library/react": "^15.0.7",
|
|
596
607
|
"@testing-library/user-event": "^14.2.0",
|
|
597
608
|
"@types/faker": "5.5.8",
|
|
598
609
|
"concurrently": "7.2.1",
|
package/src/chat/Chat.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import React, { HTMLAttributes, forwardRef } from "react";
|
|
|
3
3
|
import { BodyLong } from "../typography";
|
|
4
4
|
import Bubble from "./Bubble";
|
|
5
5
|
|
|
6
|
+
export const VARIANTS = ["subtle", "info", "neutral"] as const;
|
|
6
7
|
export const POSITIONS = ["left", "right"] as const;
|
|
7
8
|
export const SIZES = ["medium", "small"] as const;
|
|
8
9
|
|
|
@@ -28,7 +29,7 @@ export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
28
29
|
* Avoid using the same background as the surface behind Chat.
|
|
29
30
|
* @default "neutral"
|
|
30
31
|
*/
|
|
31
|
-
variant?:
|
|
32
|
+
variant?: (typeof VARIANTS)[number];
|
|
32
33
|
/**
|
|
33
34
|
* Positions avatar and bubbles.
|
|
34
35
|
* @default "left"
|
|
@@ -13,6 +13,10 @@ export interface CollapsibleTriggerProps
|
|
|
13
13
|
* @default false
|
|
14
14
|
*/
|
|
15
15
|
asChild?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* You may disable aria-expanded if the accessable name of the trigger is changed when toggled, e.g. "Show"/"Hide".
|
|
18
|
+
*/
|
|
19
|
+
"aria-expanded"?: undefined;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
export const CollapsibleTrigger = forwardRef<
|
|
@@ -29,10 +33,10 @@ export const CollapsibleTrigger = forwardRef<
|
|
|
29
33
|
type="button"
|
|
30
34
|
data-state={ctx.state}
|
|
31
35
|
onClick={composeEventHandlers(onClick, ctx.onOpenToggle)}
|
|
36
|
+
aria-expanded={ctx.open}
|
|
32
37
|
{...rest}
|
|
33
38
|
id={ctx.triggerId}
|
|
34
39
|
aria-controls={ctx.open ? ctx.contentId : undefined}
|
|
35
|
-
aria-expanded={ctx.open}
|
|
36
40
|
>
|
|
37
41
|
{children}
|
|
38
42
|
</Comp>
|
|
@@ -37,7 +37,11 @@ export const DropdownCaption = ({ displayMonth, id }: CaptionProps) => {
|
|
|
37
37
|
const handleMonthChange: React.ChangeEventHandler<HTMLSelectElement> = (e) =>
|
|
38
38
|
goToMonth(setMonth(startOfMonth(displayMonth), Number(e.target.value)));
|
|
39
39
|
|
|
40
|
-
const years = getYears(
|
|
40
|
+
const years = getYears(
|
|
41
|
+
fromDate,
|
|
42
|
+
toDate,
|
|
43
|
+
displayMonth.getFullYear(),
|
|
44
|
+
).reverse();
|
|
41
45
|
const months = getMonths(fromDate, toDate, displayMonth);
|
|
42
46
|
|
|
43
47
|
const previousLabel = labelPrevious(previousMonth, { locale });
|
|
@@ -35,7 +35,7 @@ export const MonthCaption = () => {
|
|
|
35
35
|
if (!years.map((x) => x.getFullYear()).includes(year.getFullYear())) {
|
|
36
36
|
years.push(setYear(startOfYear(new Date()), year.getFullYear()));
|
|
37
37
|
}
|
|
38
|
-
years.sort((a, b) =>
|
|
38
|
+
years.sort((a, b) => b.getFullYear() - a.getFullYear());
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const handleYearChange = (e) =>
|
|
@@ -1,57 +1,31 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, { forwardRef
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
import { BodyShort, ErrorMessage, Label } from "../../typography";
|
|
4
|
-
import { useMergeRefs } from "../../util/hooks/useMergeRefs";
|
|
5
|
-
import ClearButton from "./ClearButton";
|
|
6
4
|
import ComboboxWrapper from "./ComboboxWrapper";
|
|
7
5
|
import FilteredOptions from "./FilteredOptions/FilteredOptions";
|
|
8
6
|
import { useFilteredOptionsContext } from "./FilteredOptions/filteredOptionsContext";
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import SelectedOptions from "./SelectedOptions/SelectedOptions";
|
|
12
|
-
import { useSelectedOptionsContext } from "./SelectedOptions/selectedOptionsContext";
|
|
13
|
-
import ToggleListButton from "./ToggleListButton";
|
|
7
|
+
import { useInputContext } from "./Input/Input.context";
|
|
8
|
+
import { InputController } from "./Input/InputController";
|
|
14
9
|
import { ComboboxProps } from "./types";
|
|
15
10
|
|
|
16
11
|
export const Combobox = forwardRef<
|
|
17
12
|
HTMLInputElement,
|
|
18
13
|
Omit<ComboboxProps, "onChange" | "options" | "size" | "onClear" | "value">
|
|
19
14
|
>((props, ref) => {
|
|
20
|
-
const {
|
|
21
|
-
className,
|
|
22
|
-
hideLabel = false,
|
|
23
|
-
description,
|
|
24
|
-
label,
|
|
25
|
-
clearButton = true,
|
|
26
|
-
clearButtonLabel,
|
|
27
|
-
toggleListButton = true,
|
|
28
|
-
toggleListButtonLabel,
|
|
29
|
-
inputClassName,
|
|
30
|
-
shouldShowSelectedOptions = true,
|
|
31
|
-
...rest
|
|
32
|
-
} = props;
|
|
33
|
-
|
|
34
|
-
const toggleListButtonRef = useRef<HTMLButtonElement>(null);
|
|
15
|
+
const { className, hideLabel = false, description, label, ...rest } = props;
|
|
35
16
|
|
|
36
|
-
const {
|
|
37
|
-
const { selectedOptions } = useSelectedOptionsContext();
|
|
17
|
+
const { toggleIsListOpen } = useFilteredOptionsContext();
|
|
38
18
|
|
|
39
19
|
const {
|
|
40
|
-
clearInput,
|
|
41
20
|
error,
|
|
42
21
|
errorId,
|
|
43
|
-
focusInput,
|
|
44
22
|
hasError,
|
|
45
23
|
inputDescriptionId,
|
|
46
24
|
inputProps,
|
|
47
|
-
inputRef,
|
|
48
|
-
value,
|
|
49
25
|
showErrorMsg,
|
|
50
26
|
size = "medium",
|
|
51
27
|
} = useInputContext();
|
|
52
28
|
|
|
53
|
-
const mergedInputRef = useMergeRefs(inputRef, ref);
|
|
54
|
-
|
|
55
29
|
return (
|
|
56
30
|
<ComboboxWrapper
|
|
57
31
|
className={className}
|
|
@@ -59,7 +33,6 @@ export const Combobox = forwardRef<
|
|
|
59
33
|
inputProps={inputProps}
|
|
60
34
|
inputSize={size}
|
|
61
35
|
toggleIsListOpen={toggleIsListOpen}
|
|
62
|
-
toggleListButtonRef={toggleListButtonRef}
|
|
63
36
|
>
|
|
64
37
|
<Label
|
|
65
38
|
htmlFor={inputProps.id}
|
|
@@ -83,50 +56,7 @@ export const Combobox = forwardRef<
|
|
|
83
56
|
</BodyShort>
|
|
84
57
|
)}
|
|
85
58
|
<div className="navds-combobox__wrapper">
|
|
86
|
-
{
|
|
87
|
-
<div
|
|
88
|
-
className={cl(
|
|
89
|
-
"navds-combobox__wrapper-inner navds-text-field__input",
|
|
90
|
-
{
|
|
91
|
-
"navds-combobox__wrapper-inner--virtually-unfocused":
|
|
92
|
-
activeDecendantId !== undefined,
|
|
93
|
-
},
|
|
94
|
-
)}
|
|
95
|
-
onClick={focusInput}
|
|
96
|
-
>
|
|
97
|
-
{!shouldShowSelectedOptions ? (
|
|
98
|
-
<Input
|
|
99
|
-
id={inputProps.id}
|
|
100
|
-
ref={mergedInputRef}
|
|
101
|
-
inputClassName={inputClassName}
|
|
102
|
-
{...rest}
|
|
103
|
-
/>
|
|
104
|
-
) : (
|
|
105
|
-
<SelectedOptions selectedOptions={selectedOptions} size={size}>
|
|
106
|
-
<Input
|
|
107
|
-
id={inputProps.id}
|
|
108
|
-
ref={mergedInputRef}
|
|
109
|
-
inputClassName={inputClassName}
|
|
110
|
-
{...rest}
|
|
111
|
-
/>
|
|
112
|
-
</SelectedOptions>
|
|
113
|
-
)}
|
|
114
|
-
<div>
|
|
115
|
-
{value && clearButton && (
|
|
116
|
-
<ClearButton
|
|
117
|
-
handleClear={clearInput}
|
|
118
|
-
clearButtonLabel={clearButtonLabel}
|
|
119
|
-
tabIndex={-1}
|
|
120
|
-
/>
|
|
121
|
-
)}
|
|
122
|
-
{toggleListButton && (
|
|
123
|
-
<ToggleListButton
|
|
124
|
-
toggleListButtonLabel={toggleListButtonLabel}
|
|
125
|
-
ref={toggleListButtonRef}
|
|
126
|
-
/>
|
|
127
|
-
)}
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
59
|
+
<InputController ref={ref} {...rest} />
|
|
130
60
|
<FilteredOptions />
|
|
131
61
|
</div>
|
|
132
62
|
<div
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import Combobox from "./Combobox";
|
|
3
3
|
import { FilteredOptionsProvider } from "./FilteredOptions/filteredOptionsContext";
|
|
4
|
-
import { InputContextProvider } from "./Input/
|
|
4
|
+
import { InputContextProvider } from "./Input/Input.context";
|
|
5
5
|
import { SelectedOptionsProvider } from "./SelectedOptions/selectedOptionsContext";
|
|
6
6
|
import { mapToComboboxOptionArray } from "./combobox-utils";
|
|
7
7
|
import { CustomOptionsProvider } from "./customOptionsContext";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { useRef, useState } from "react";
|
|
3
|
+
import { useInputContext } from "./Input/Input.context";
|
|
3
4
|
|
|
4
5
|
type ComboboxWrapperProps = {
|
|
5
6
|
children: any;
|
|
@@ -10,7 +11,6 @@ type ComboboxWrapperProps = {
|
|
|
10
11
|
};
|
|
11
12
|
inputSize: string;
|
|
12
13
|
toggleIsListOpen: (isListOpen: boolean) => void;
|
|
13
|
-
toggleListButtonRef: React.RefObject<HTMLButtonElement>;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const ComboboxWrapper = ({
|
|
@@ -20,15 +20,16 @@ const ComboboxWrapper = ({
|
|
|
20
20
|
inputProps,
|
|
21
21
|
inputSize,
|
|
22
22
|
toggleIsListOpen,
|
|
23
|
-
toggleListButtonRef,
|
|
24
23
|
}: ComboboxWrapperProps) => {
|
|
24
|
+
const { toggleOpenButtonRef } = useInputContext();
|
|
25
|
+
|
|
25
26
|
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
|
26
27
|
const [hasFocusWithin, setHasFocusWithin] = useState(false);
|
|
27
28
|
|
|
28
29
|
function onFocusInsideWrapper(e) {
|
|
29
30
|
if (
|
|
30
31
|
!wrapperRef.current?.contains(e.relatedTarget) &&
|
|
31
|
-
|
|
32
|
+
toggleOpenButtonRef?.current !== e.target
|
|
32
33
|
) {
|
|
33
34
|
toggleIsListOpen(true);
|
|
34
35
|
setHasFocusWithin(true);
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { CheckmarkIcon, PlusIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { Loader } from "../../../loader";
|
|
5
5
|
import { BodyShort, Label } from "../../../typography";
|
|
6
|
-
import { useInputContext } from "../Input/
|
|
6
|
+
import { useInputContext } from "../Input/Input.context";
|
|
7
7
|
import { useSelectedOptionsContext } from "../SelectedOptions/selectedOptionsContext";
|
|
8
8
|
import { isInList, toComboboxOption } from "../combobox-utils";
|
|
9
9
|
import { ComboboxOption } from "../types";
|
|
@@ -38,7 +38,7 @@ const FilteredOptions = () => {
|
|
|
38
38
|
const shouldRenderNonSelectables =
|
|
39
39
|
maxSelected?.isLimitReached || // Render maxSelected message
|
|
40
40
|
isLoading || // Render loading message
|
|
41
|
-
(!isLoading && filteredOptions.length === 0); // Render no hits message
|
|
41
|
+
(!isLoading && filteredOptions.length === 0 && !allowNewValues); // Render no hits message
|
|
42
42
|
|
|
43
43
|
const shouldRenderFilteredOptionsList =
|
|
44
44
|
(allowNewValues && isValueNew && !maxSelected?.isLimitReached) || // Render add new option
|
|
@@ -72,7 +72,7 @@ const FilteredOptions = () => {
|
|
|
72
72
|
<Loader title="Søker..." />
|
|
73
73
|
</div>
|
|
74
74
|
)}
|
|
75
|
-
{!isLoading && filteredOptions.length === 0 && (
|
|
75
|
+
{!isLoading && filteredOptions.length === 0 && !allowNewValues && (
|
|
76
76
|
<div
|
|
77
77
|
className="navds-combobox__list-item--no-options"
|
|
78
78
|
id={filteredOptionsUtil.getNoHitsId(id)}
|