@navikt/ds-react 7.35.3 → 7.37.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/accordion/AccordionContent.js +1 -1
- package/cjs/accordion/AccordionContent.js.map +1 -1
- package/cjs/accordion/AccordionHeader.js +1 -1
- package/cjs/accordion/AccordionHeader.js.map +1 -1
- package/cjs/alert/base-alert/content/BaseAlertContent.js +1 -1
- package/cjs/alert/base-alert/content/BaseAlertContent.js.map +1 -1
- package/cjs/alert/base-alert/root/BaseAlertRoot.context.d.ts +3 -2
- package/cjs/alert/base-alert/root/BaseAlertRoot.context.js +2 -3
- package/cjs/alert/base-alert/root/BaseAlertRoot.context.js.map +1 -1
- package/cjs/chips/Removable.js +1 -1
- package/cjs/chips/Removable.js.map +1 -1
- package/cjs/chips/Toggle.js +1 -1
- package/cjs/chips/Toggle.js.map +1 -1
- package/cjs/collapsible/Collapsible.context.d.ts +3 -2
- package/cjs/collapsible/Collapsible.context.js +3 -3
- package/cjs/collapsible/Collapsible.context.js.map +1 -1
- package/cjs/copybutton/CopyButton.js +5 -5
- package/cjs/copybutton/CopyButton.js.map +1 -1
- package/cjs/date/Date.Dialog.js +1 -1
- package/cjs/date/Date.Dialog.js.map +1 -1
- package/cjs/date/Date.Input.d.ts +3 -2
- package/cjs/date/Date.Input.js +4 -3
- package/cjs/date/Date.Input.js.map +1 -1
- package/cjs/date/Date.locale.d.ts +3 -2
- package/cjs/date/Date.locale.js +4 -2
- package/cjs/date/Date.locale.js.map +1 -1
- package/cjs/date/datepicker/parts/DatePicker.DayButton.d.ts +1 -1
- package/cjs/date/datepicker/parts/DatePicker.DayButton.js +1 -1
- package/cjs/date/datepicker/parts/DatePicker.DayButton.js.map +1 -1
- package/cjs/date/datepicker/parts/DatePicker.RDP.js +12 -2
- package/cjs/date/datepicker/parts/DatePicker.RDP.js.map +1 -1
- package/cjs/date/monthpicker/MonthPicker.context.d.ts +1 -1
- package/cjs/date/monthpicker/MonthPicker.context.js +2 -2
- package/cjs/date/monthpicker/MonthPicker.context.js.map +1 -1
- package/cjs/date/monthpicker/MonthPicker.js +1 -2
- package/cjs/date/monthpicker/MonthPicker.js.map +1 -1
- package/cjs/dialog/backdrop/DialogBackdropInternal.d.ts +5 -0
- package/cjs/dialog/backdrop/DialogBackdropInternal.js +59 -0
- package/cjs/dialog/backdrop/DialogBackdropInternal.js.map +1 -0
- package/cjs/dialog/body/DialogBody.d.ts +18 -0
- package/cjs/{link/stories/RandomIcon.js → dialog/body/DialogBody.js} +33 -13
- package/cjs/dialog/body/DialogBody.js.map +1 -0
- package/cjs/dialog/close-trigger/DialogCloseTrigger.d.ts +20 -0
- package/cjs/dialog/close-trigger/DialogCloseTrigger.js +76 -0
- package/cjs/dialog/close-trigger/DialogCloseTrigger.js.map +1 -0
- package/cjs/dialog/description/DialogDescription.d.ts +19 -0
- package/cjs/dialog/description/DialogDescription.js +73 -0
- package/cjs/dialog/description/DialogDescription.js.map +1 -0
- package/cjs/dialog/footer/DialogFooter.d.ts +20 -0
- package/cjs/dialog/footer/DialogFooter.js +71 -0
- package/cjs/dialog/footer/DialogFooter.js.map +1 -0
- package/cjs/dialog/header/DialogHeader.d.ts +25 -0
- package/cjs/dialog/header/DialogHeader.js +77 -0
- package/cjs/dialog/header/DialogHeader.js.map +1 -0
- package/cjs/dialog/index.d.ts +18 -0
- package/cjs/dialog/index.js +23 -0
- package/cjs/dialog/index.js.map +1 -0
- package/cjs/dialog/popup/DialogPopup.d.ts +22 -0
- package/cjs/dialog/popup/DialogPopup.js +75 -0
- package/cjs/dialog/popup/DialogPopup.js.map +1 -0
- package/cjs/dialog/popup/DialogPopupInternal.d.ts +60 -0
- package/cjs/dialog/popup/DialogPopupInternal.js +166 -0
- package/cjs/dialog/popup/DialogPopupInternal.js.map +1 -0
- package/cjs/dialog/root/DialogRoot.context.d.ts +84 -0
- package/cjs/dialog/root/DialogRoot.context.js +11 -0
- package/cjs/dialog/root/DialogRoot.context.js.map +1 -0
- package/cjs/dialog/root/DialogRoot.d.ts +179 -0
- package/cjs/dialog/root/DialogRoot.js +133 -0
- package/cjs/dialog/root/DialogRoot.js.map +1 -0
- package/cjs/dialog/title/DialogTitle.d.ts +18 -0
- package/cjs/dialog/title/DialogTitle.js +80 -0
- package/cjs/dialog/title/DialogTitle.js.map +1 -0
- package/cjs/dialog/trigger/DialogTrigger.d.ts +20 -0
- package/cjs/dialog/trigger/DialogTrigger.js +71 -0
- package/cjs/dialog/trigger/DialogTrigger.js.map +1 -0
- package/cjs/expansion-card/ExpansionCardContent.js +1 -1
- package/cjs/expansion-card/ExpansionCardContent.js.map +1 -1
- package/cjs/form/checkbox/Checkbox.js +1 -1
- package/cjs/form/checkbox/Checkbox.js.map +1 -1
- package/cjs/form/combobox/ComboboxWrapper.js +3 -1
- package/cjs/form/combobox/ComboboxWrapper.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +2 -4
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +1 -1
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +2 -2
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/cjs/form/combobox/Input/Input.context.d.ts +1 -1
- package/cjs/form/combobox/Input/Input.context.js +2 -2
- package/cjs/form/combobox/Input/Input.context.js.map +1 -1
- package/cjs/form/combobox/Input/InputController.js.map +1 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +1 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +4 -2
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/cjs/form/combobox/customOptionsContext.d.ts +1 -1
- package/cjs/form/combobox/customOptionsContext.js +2 -2
- package/cjs/form/combobox/customOptionsContext.js.map +1 -1
- package/cjs/form/error-summary/ErrorSummary.js +3 -1
- package/cjs/form/error-summary/ErrorSummary.js.map +1 -1
- package/cjs/form/file-upload/FileUpload.context.d.ts +3 -2
- package/cjs/form/file-upload/FileUpload.context.js +4 -2
- package/cjs/form/file-upload/FileUpload.context.js.map +1 -1
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js +2 -0
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/cjs/form/radio/Radio.js +1 -1
- package/cjs/form/radio/Radio.js.map +1 -1
- package/cjs/form/search/Search.js +3 -2
- package/cjs/form/search/Search.js.map +1 -1
- package/cjs/guide-panel/GuidePanel.js +1 -1
- package/cjs/guide-panel/GuidePanel.js.map +1 -1
- package/cjs/help-text/HelpText.js +1 -1
- package/cjs/help-text/HelpText.js.map +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +3 -1
- package/cjs/index.js.map +1 -1
- package/cjs/inline-message/root/InlineMessage.js +1 -1
- package/cjs/inline-message/root/InlineMessage.js.map +1 -1
- package/cjs/internal-header/InternalHeader.js +1 -1
- package/cjs/internal-header/InternalHeader.js.map +1 -1
- package/cjs/internal-header/InternalHeaderUser.d.ts +2 -2
- package/cjs/internal-header/InternalHeaderUser.js +1 -1
- package/cjs/internal-header/InternalHeaderUser.js.map +1 -1
- package/cjs/layout/base/BasePrimitive.js +1 -1
- package/cjs/layout/base/BasePrimitive.js.map +1 -1
- package/cjs/layout/bleed/Bleed.js +1 -1
- package/cjs/layout/bleed/Bleed.js.map +1 -1
- package/cjs/layout/box/Box.js +1 -1
- package/cjs/layout/box/Box.js.map +1 -1
- package/cjs/layout/grid/HGrid.js +1 -1
- package/cjs/layout/grid/HGrid.js.map +1 -1
- package/cjs/layout/page/Page.js +1 -1
- package/cjs/layout/page/Page.js.map +1 -1
- package/cjs/layout/stack/Stack.js +1 -1
- package/cjs/layout/stack/Stack.js.map +1 -1
- package/cjs/link/Link.js +1 -1
- package/cjs/link/Link.js.map +1 -1
- package/cjs/link-card/LinkCard.js +2 -2
- package/cjs/link-card/LinkCard.js.map +1 -1
- package/cjs/list/List.js +1 -1
- package/cjs/list/List.js.map +1 -1
- package/cjs/modal/Modal.context.d.ts +4 -3
- package/cjs/modal/Modal.context.js +3 -3
- package/cjs/modal/Modal.context.js.map +1 -1
- package/cjs/modal/Modal.js +1 -1
- package/cjs/modal/Modal.js.map +1 -1
- package/cjs/overlays/action-menu/ActionMenu.js +6 -4
- package/cjs/overlays/action-menu/ActionMenu.js.map +1 -1
- package/cjs/overlays/dismissablelayer/DismissableLayer.d.ts +16 -4
- package/cjs/overlays/dismissablelayer/DismissableLayer.js +34 -5
- package/cjs/overlays/dismissablelayer/DismissableLayer.js.map +1 -1
- package/cjs/overlays/dismissablelayer/util/dispatchCustomEvent.d.ts +3 -2
- package/cjs/overlays/dismissablelayer/util/dispatchCustomEvent.js +1 -0
- package/cjs/overlays/dismissablelayer/util/dispatchCustomEvent.js.map +1 -1
- package/cjs/overlays/dismissablelayer/util/useEscapeKeydown.js +2 -2
- package/cjs/overlays/dismissablelayer/util/useEscapeKeydown.js.map +1 -1
- package/cjs/overlays/dismissablelayer/util/useFocusOutside.js +2 -2
- package/cjs/overlays/dismissablelayer/util/useFocusOutside.js.map +1 -1
- package/cjs/overlays/dismissablelayer/util/usePointerDownOutside.d.ts +2 -2
- package/cjs/overlays/dismissablelayer/util/usePointerDownOutside.js +2 -2
- package/cjs/overlays/dismissablelayer/util/usePointerDownOutside.js.map +1 -1
- package/cjs/overlays/dismissablelayer/util/usePointerUpOutside.d.ts +10 -0
- package/cjs/overlays/dismissablelayer/util/usePointerUpOutside.js +79 -0
- package/cjs/overlays/dismissablelayer/util/usePointerUpOutside.js.map +1 -0
- package/cjs/overlays/floating/Floating.d.ts +3 -2
- package/cjs/overlays/floating/Floating.js +9 -12
- package/cjs/overlays/floating/Floating.js.map +1 -1
- package/cjs/overlays/floating-menu/Menu.js +15 -19
- package/cjs/overlays/floating-menu/Menu.js.map +1 -1
- package/cjs/overlays/floating-menu/parts/RovingFocus.js +2 -1
- package/cjs/overlays/floating-menu/parts/RovingFocus.js.map +1 -1
- package/cjs/pagination/PaginationItem.js +1 -1
- package/cjs/pagination/PaginationItem.js.map +1 -1
- package/cjs/popover/Popover.js +28 -6
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/portal/Portal.js +1 -1
- package/cjs/portal/Portal.js.map +1 -1
- package/cjs/process/Process.js +2 -4
- package/cjs/process/Process.js.map +1 -1
- package/cjs/progress-bar/ProgressBar.js +4 -8
- package/cjs/progress-bar/ProgressBar.js.map +1 -1
- package/cjs/stepper/context.d.ts +3 -2
- package/cjs/stepper/context.js +3 -5
- package/cjs/stepper/context.js.map +1 -1
- package/cjs/tabs/Tabs.context.d.ts +4 -3
- package/cjs/tabs/Tabs.context.js +3 -5
- package/cjs/tabs/Tabs.context.js.map +1 -1
- package/cjs/theme/Theme.d.ts +2 -2
- package/cjs/theme/Theme.js +4 -8
- package/cjs/theme/Theme.js.map +1 -1
- package/cjs/timeline/period/ClickablePeriod.js +1 -1
- package/cjs/timeline/period/ClickablePeriod.js.map +1 -1
- package/cjs/timeline/period/index.js +1 -1
- package/cjs/timeline/period/index.js.map +1 -1
- package/cjs/toggle-group/ToggleGroup.context.d.ts +4 -3
- package/cjs/toggle-group/ToggleGroup.context.js +3 -5
- package/cjs/toggle-group/ToggleGroup.context.js.map +1 -1
- package/cjs/toggle-group/ToggleGroup.js +1 -1
- package/cjs/toggle-group/ToggleGroup.js.map +1 -1
- package/cjs/tooltip/Tooltip.js +3 -1
- package/cjs/tooltip/Tooltip.js.map +1 -1
- package/cjs/util/composition-warning/CompositionWarning.d.ts +3 -2
- package/cjs/util/composition-warning/CompositionWarning.js +3 -2
- package/cjs/util/composition-warning/CompositionWarning.js.map +1 -1
- package/cjs/util/create-strict-context.d.ts +40 -0
- package/cjs/util/{create-context.js → create-strict-context.js} +21 -19
- package/cjs/util/create-strict-context.js.map +1 -0
- package/cjs/util/focus-boundary/FocusBoundary.d.ts +1 -1
- package/cjs/util/focus-boundary/FocusBoundary.js +59 -16
- package/cjs/util/focus-boundary/FocusBoundary.js.map +1 -1
- package/cjs/util/hideNonTargetElements.js +2 -2
- package/cjs/util/hooks/descendants/useDescendant.d.ts +1 -1
- package/cjs/util/hooks/descendants/useDescendant.js +2 -2
- package/cjs/util/hooks/descendants/useDescendant.js.map +1 -1
- package/cjs/util/hooks/index.d.ts +0 -1
- package/cjs/util/hooks/index.js +1 -3
- package/cjs/util/hooks/index.js.map +1 -1
- package/{esm/overlays/overlay → cjs/util}/hooks/useAnimationsFinished.d.ts +1 -1
- package/cjs/{overlays/overlay → util}/hooks/useAnimationsFinished.js +7 -8
- package/cjs/util/hooks/useAnimationsFinished.js.map +1 -0
- package/cjs/util/hooks/useControllableState.js +4 -4
- package/cjs/util/hooks/useControllableState.js.map +1 -1
- package/cjs/util/hooks/useEventCallback.d.ts +2 -5
- package/cjs/util/hooks/useEventCallback.js +2 -3
- package/cjs/util/hooks/useEventCallback.js.map +1 -1
- package/cjs/util/hooks/useId.js +4 -1
- package/cjs/util/hooks/useId.js.map +1 -1
- package/cjs/util/hooks/useMergeRefs.js +2 -1
- package/cjs/util/hooks/useMergeRefs.js.map +1 -1
- package/cjs/{overlays/overlay → util}/hooks/useOpenChangeAnimationComplete.js +3 -3
- package/cjs/util/hooks/useOpenChangeAnimationComplete.js.map +1 -0
- package/cjs/util/hooks/usePrevious.js.map +1 -1
- package/cjs/util/hooks/useScrollLock.js.map +1 -1
- package/cjs/{overlays/overlay → util}/hooks/useTransitionStatus.d.ts +6 -1
- package/cjs/{overlays/overlay → util}/hooks/useTransitionStatus.js +15 -4
- package/cjs/util/hooks/useTransitionStatus.js.map +1 -0
- package/cjs/util/hooks/useValueAsRef.d.ts +6 -0
- package/cjs/util/hooks/{useLatestRef.js → useValueAsRef.js} +3 -3
- package/cjs/util/hooks/useValueAsRef.js.map +1 -0
- package/cjs/util/link-anchor/LinkAnchor.js +2 -2
- package/cjs/util/link-anchor/LinkAnchor.js.map +1 -1
- package/cjs/util/resolveRef.d.ts +8 -0
- package/cjs/util/resolveRef.js +16 -0
- package/cjs/util/resolveRef.js.map +1 -0
- package/cjs/util/virtualfocus/Context.d.ts +4 -3
- package/cjs/util/virtualfocus/Context.js +4 -2
- package/cjs/util/virtualfocus/Context.js.map +1 -1
- package/esm/accordion/AccordionContent.js +1 -1
- package/esm/accordion/AccordionContent.js.map +1 -1
- package/esm/accordion/AccordionHeader.js +1 -1
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/alert/base-alert/content/BaseAlertContent.js +1 -1
- package/esm/alert/base-alert/content/BaseAlertContent.js.map +1 -1
- package/esm/alert/base-alert/root/BaseAlertRoot.context.d.ts +3 -2
- package/esm/alert/base-alert/root/BaseAlertRoot.context.js +2 -3
- package/esm/alert/base-alert/root/BaseAlertRoot.context.js.map +1 -1
- package/esm/chips/Removable.js +1 -1
- package/esm/chips/Removable.js.map +1 -1
- package/esm/chips/Toggle.js +1 -1
- package/esm/chips/Toggle.js.map +1 -1
- package/esm/collapsible/Collapsible.context.d.ts +3 -2
- package/esm/collapsible/Collapsible.context.js +2 -2
- package/esm/collapsible/Collapsible.context.js.map +1 -1
- package/esm/copybutton/CopyButton.js +5 -5
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/Date.Dialog.js +1 -1
- package/esm/date/Date.Dialog.js.map +1 -1
- package/esm/date/Date.Input.d.ts +3 -2
- package/esm/date/Date.Input.js +3 -2
- package/esm/date/Date.Input.js.map +1 -1
- package/esm/date/Date.locale.d.ts +3 -2
- package/esm/date/Date.locale.js +4 -2
- package/esm/date/Date.locale.js.map +1 -1
- package/esm/date/datepicker/parts/DatePicker.DayButton.d.ts +1 -1
- package/esm/date/datepicker/parts/DatePicker.DayButton.js +1 -1
- package/esm/date/datepicker/parts/DatePicker.DayButton.js.map +1 -1
- package/esm/date/datepicker/parts/DatePicker.RDP.js +12 -2
- package/esm/date/datepicker/parts/DatePicker.RDP.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.context.d.ts +1 -1
- package/esm/date/monthpicker/MonthPicker.context.js +2 -2
- package/esm/date/monthpicker/MonthPicker.context.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.js +1 -2
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/dialog/backdrop/DialogBackdropInternal.d.ts +5 -0
- package/esm/dialog/backdrop/DialogBackdropInternal.js +23 -0
- package/esm/dialog/backdrop/DialogBackdropInternal.js.map +1 -0
- package/esm/dialog/body/DialogBody.d.ts +18 -0
- package/esm/dialog/body/DialogBody.js +33 -0
- package/esm/dialog/body/DialogBody.js.map +1 -0
- package/esm/dialog/close-trigger/DialogCloseTrigger.d.ts +20 -0
- package/esm/dialog/close-trigger/DialogCloseTrigger.js +40 -0
- package/esm/dialog/close-trigger/DialogCloseTrigger.js.map +1 -0
- package/esm/dialog/description/DialogDescription.d.ts +19 -0
- package/esm/dialog/description/DialogDescription.js +37 -0
- package/esm/dialog/description/DialogDescription.js.map +1 -0
- package/esm/dialog/footer/DialogFooter.d.ts +20 -0
- package/esm/dialog/footer/DialogFooter.js +35 -0
- package/esm/dialog/footer/DialogFooter.js.map +1 -0
- package/esm/dialog/header/DialogHeader.d.ts +25 -0
- package/esm/dialog/header/DialogHeader.js +41 -0
- package/esm/dialog/header/DialogHeader.js.map +1 -0
- package/esm/dialog/index.d.ts +18 -0
- package/esm/dialog/index.js +11 -0
- package/esm/dialog/index.js.map +1 -0
- package/esm/dialog/popup/DialogPopup.d.ts +22 -0
- package/esm/dialog/popup/DialogPopup.js +39 -0
- package/esm/dialog/popup/DialogPopup.js.map +1 -0
- package/esm/dialog/popup/DialogPopupInternal.d.ts +60 -0
- package/esm/dialog/popup/DialogPopupInternal.js +130 -0
- package/esm/dialog/popup/DialogPopupInternal.js.map +1 -0
- package/esm/dialog/root/DialogRoot.context.d.ts +84 -0
- package/esm/dialog/root/DialogRoot.context.js +7 -0
- package/esm/dialog/root/DialogRoot.context.js.map +1 -0
- package/esm/dialog/root/DialogRoot.d.ts +179 -0
- package/esm/dialog/root/DialogRoot.js +97 -0
- package/esm/dialog/root/DialogRoot.js.map +1 -0
- package/esm/dialog/title/DialogTitle.d.ts +18 -0
- package/esm/dialog/title/DialogTitle.js +44 -0
- package/esm/dialog/title/DialogTitle.js.map +1 -0
- package/esm/dialog/trigger/DialogTrigger.d.ts +20 -0
- package/esm/dialog/trigger/DialogTrigger.js +35 -0
- package/esm/dialog/trigger/DialogTrigger.js.map +1 -0
- package/esm/expansion-card/ExpansionCardContent.js +1 -1
- package/esm/expansion-card/ExpansionCardContent.js.map +1 -1
- package/esm/form/checkbox/Checkbox.js +1 -1
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/combobox/ComboboxWrapper.js +3 -1
- package/esm/form/combobox/ComboboxWrapper.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js +2 -4
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +2 -2
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/Input/Input.context.d.ts +1 -1
- package/esm/form/combobox/Input/Input.context.js +2 -2
- package/esm/form/combobox/Input/Input.context.js.map +1 -1
- package/esm/form/combobox/Input/InputController.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +4 -2
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/esm/form/combobox/customOptionsContext.d.ts +1 -1
- package/esm/form/combobox/customOptionsContext.js +2 -2
- package/esm/form/combobox/customOptionsContext.js.map +1 -1
- package/esm/form/error-summary/ErrorSummary.js +3 -1
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/form/file-upload/FileUpload.context.d.ts +3 -2
- package/esm/form/file-upload/FileUpload.context.js +4 -2
- package/esm/form/file-upload/FileUpload.context.js.map +1 -1
- package/esm/form/file-upload/parts/dropzone/Dropzone.js +2 -0
- package/esm/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/esm/form/radio/Radio.js +1 -1
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/search/Search.js +3 -2
- package/esm/form/search/Search.js.map +1 -1
- package/esm/guide-panel/GuidePanel.js +1 -1
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/help-text/HelpText.js +1 -1
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/inline-message/root/InlineMessage.js +1 -1
- package/esm/inline-message/root/InlineMessage.js.map +1 -1
- package/esm/internal-header/InternalHeader.js +1 -1
- package/esm/internal-header/InternalHeader.js.map +1 -1
- package/esm/internal-header/InternalHeaderUser.d.ts +2 -2
- package/esm/internal-header/InternalHeaderUser.js +1 -1
- package/esm/internal-header/InternalHeaderUser.js.map +1 -1
- package/esm/layout/base/BasePrimitive.js +1 -1
- package/esm/layout/base/BasePrimitive.js.map +1 -1
- package/esm/layout/bleed/Bleed.js +1 -1
- package/esm/layout/bleed/Bleed.js.map +1 -1
- package/esm/layout/box/Box.js +1 -1
- package/esm/layout/box/Box.js.map +1 -1
- package/esm/layout/grid/HGrid.js +1 -1
- package/esm/layout/grid/HGrid.js.map +1 -1
- package/esm/layout/page/Page.js +1 -1
- package/esm/layout/page/Page.js.map +1 -1
- package/esm/layout/stack/Stack.js +1 -1
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/link/Link.js +1 -1
- package/esm/link/Link.js.map +1 -1
- package/esm/link-card/LinkCard.js +2 -2
- package/esm/link-card/LinkCard.js.map +1 -1
- package/esm/list/List.js +1 -1
- package/esm/list/List.js.map +1 -1
- package/esm/modal/Modal.context.d.ts +4 -3
- package/esm/modal/Modal.context.js +2 -2
- package/esm/modal/Modal.context.js.map +1 -1
- package/esm/modal/Modal.js +1 -1
- package/esm/modal/Modal.js.map +1 -1
- package/esm/overlays/action-menu/ActionMenu.js +6 -4
- package/esm/overlays/action-menu/ActionMenu.js.map +1 -1
- package/esm/overlays/dismissablelayer/DismissableLayer.d.ts +16 -4
- package/esm/overlays/dismissablelayer/DismissableLayer.js +34 -5
- package/esm/overlays/dismissablelayer/DismissableLayer.js.map +1 -1
- package/esm/overlays/dismissablelayer/util/dispatchCustomEvent.d.ts +3 -2
- package/esm/overlays/dismissablelayer/util/dispatchCustomEvent.js +1 -0
- package/esm/overlays/dismissablelayer/util/dispatchCustomEvent.js.map +1 -1
- package/esm/overlays/dismissablelayer/util/useEscapeKeydown.js +2 -2
- package/esm/overlays/dismissablelayer/util/useEscapeKeydown.js.map +1 -1
- package/esm/overlays/dismissablelayer/util/useFocusOutside.js +2 -2
- package/esm/overlays/dismissablelayer/util/useFocusOutside.js.map +1 -1
- package/esm/overlays/dismissablelayer/util/usePointerDownOutside.d.ts +2 -2
- package/esm/overlays/dismissablelayer/util/usePointerDownOutside.js +2 -2
- package/esm/overlays/dismissablelayer/util/usePointerDownOutside.js.map +1 -1
- package/esm/overlays/dismissablelayer/util/usePointerUpOutside.d.ts +10 -0
- package/esm/overlays/dismissablelayer/util/usePointerUpOutside.js +76 -0
- package/esm/overlays/dismissablelayer/util/usePointerUpOutside.js.map +1 -0
- package/esm/overlays/floating/Floating.d.ts +3 -2
- package/esm/overlays/floating/Floating.js +9 -12
- package/esm/overlays/floating/Floating.js.map +1 -1
- package/esm/overlays/floating-menu/Menu.js +16 -20
- package/esm/overlays/floating-menu/Menu.js.map +1 -1
- package/esm/overlays/floating-menu/parts/RovingFocus.js +3 -2
- package/esm/overlays/floating-menu/parts/RovingFocus.js.map +1 -1
- package/esm/pagination/PaginationItem.js +1 -1
- package/esm/pagination/PaginationItem.js.map +1 -1
- package/esm/popover/Popover.js +28 -6
- package/esm/popover/Popover.js.map +1 -1
- package/esm/portal/Portal.js +1 -1
- package/esm/portal/Portal.js.map +1 -1
- package/esm/process/Process.js +2 -4
- package/esm/process/Process.js.map +1 -1
- package/esm/progress-bar/ProgressBar.js +4 -8
- package/esm/progress-bar/ProgressBar.js.map +1 -1
- package/esm/stepper/context.d.ts +3 -2
- package/esm/stepper/context.js +2 -4
- package/esm/stepper/context.js.map +1 -1
- package/esm/tabs/Tabs.context.d.ts +4 -3
- package/esm/tabs/Tabs.context.js +2 -4
- package/esm/tabs/Tabs.context.js.map +1 -1
- package/esm/theme/Theme.d.ts +2 -2
- package/esm/theme/Theme.js +4 -8
- package/esm/theme/Theme.js.map +1 -1
- package/esm/timeline/period/ClickablePeriod.js +1 -1
- package/esm/timeline/period/ClickablePeriod.js.map +1 -1
- package/esm/timeline/period/index.js +1 -1
- package/esm/timeline/period/index.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.context.d.ts +4 -3
- package/esm/toggle-group/ToggleGroup.context.js +2 -4
- package/esm/toggle-group/ToggleGroup.context.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.js +1 -1
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/tooltip/Tooltip.js +3 -1
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/util/composition-warning/CompositionWarning.d.ts +3 -2
- package/esm/util/composition-warning/CompositionWarning.js +3 -2
- package/esm/util/composition-warning/CompositionWarning.js.map +1 -1
- package/esm/util/create-strict-context.d.ts +40 -0
- package/esm/util/{create-context.js → create-strict-context.js} +22 -19
- package/esm/util/create-strict-context.js.map +1 -0
- package/esm/util/focus-boundary/FocusBoundary.d.ts +1 -1
- package/esm/util/focus-boundary/FocusBoundary.js +57 -14
- package/esm/util/focus-boundary/FocusBoundary.js.map +1 -1
- package/esm/util/hideNonTargetElements.js +2 -2
- package/esm/util/hooks/descendants/useDescendant.d.ts +1 -1
- package/esm/util/hooks/descendants/useDescendant.js +2 -2
- package/esm/util/hooks/descendants/useDescendant.js.map +1 -1
- package/esm/util/hooks/index.d.ts +0 -1
- package/esm/util/hooks/index.js +0 -1
- package/esm/util/hooks/index.js.map +1 -1
- package/{cjs/overlays/overlay → esm/util}/hooks/useAnimationsFinished.d.ts +1 -1
- package/esm/{overlays/overlay → util}/hooks/useAnimationsFinished.js +7 -8
- package/esm/util/hooks/useAnimationsFinished.js.map +1 -0
- package/esm/util/hooks/useControllableState.js +4 -4
- package/esm/util/hooks/useControllableState.js.map +1 -1
- package/esm/util/hooks/useEventCallback.d.ts +2 -5
- package/esm/util/hooks/useEventCallback.js +4 -4
- package/esm/util/hooks/useEventCallback.js.map +1 -1
- package/esm/util/hooks/useId.js +4 -1
- package/esm/util/hooks/useId.js.map +1 -1
- package/esm/util/hooks/useMergeRefs.js +2 -1
- package/esm/util/hooks/useMergeRefs.js.map +1 -1
- package/esm/{overlays/overlay → util}/hooks/useOpenChangeAnimationComplete.js +3 -3
- package/esm/util/hooks/useOpenChangeAnimationComplete.js.map +1 -0
- package/esm/util/hooks/usePrevious.js.map +1 -1
- package/esm/util/hooks/useScrollLock.js.map +1 -1
- package/esm/{overlays/overlay → util}/hooks/useTransitionStatus.d.ts +6 -1
- package/esm/{overlays/overlay → util}/hooks/useTransitionStatus.js +12 -2
- package/esm/util/hooks/useTransitionStatus.js.map +1 -0
- package/esm/util/hooks/useValueAsRef.d.ts +6 -0
- package/esm/util/hooks/{useLatestRef.js → useValueAsRef.js} +3 -2
- package/esm/util/hooks/useValueAsRef.js.map +1 -0
- package/esm/util/link-anchor/LinkAnchor.js +2 -2
- package/esm/util/link-anchor/LinkAnchor.js.map +1 -1
- package/esm/util/resolveRef.d.ts +8 -0
- package/esm/util/resolveRef.js +14 -0
- package/esm/util/resolveRef.js.map +1 -0
- package/esm/util/virtualfocus/Context.d.ts +4 -3
- package/esm/util/virtualfocus/Context.js +4 -2
- package/esm/util/virtualfocus/Context.js.map +1 -1
- package/package.json +13 -3
- package/src/accordion/AccordionContent.tsx +1 -1
- package/src/accordion/AccordionHeader.tsx +1 -1
- package/src/alert/base-alert/content/BaseAlertContent.tsx +1 -1
- package/src/alert/base-alert/root/BaseAlertRoot.context.tsx +5 -5
- package/src/chips/Removable.tsx +1 -1
- package/src/chips/Toggle.tsx +1 -1
- package/src/collapsible/Collapsible.context.tsx +9 -7
- package/src/copybutton/CopyButton.tsx +5 -5
- package/src/date/Date.Dialog.tsx +0 -1
- package/src/date/Date.Input.tsx +8 -5
- package/src/date/Date.locale.ts +7 -3
- package/src/date/datepicker/parts/DatePicker.DayButton.tsx +1 -1
- package/src/date/datepicker/parts/DatePicker.RDP.tsx +12 -2
- package/src/date/monthpicker/MonthPicker.context.tsx +9 -7
- package/src/date/monthpicker/MonthPicker.tsx +1 -2
- package/src/dialog/backdrop/DialogBackdropInternal.tsx +29 -0
- package/src/dialog/body/DialogBody.tsx +36 -0
- package/src/dialog/close-trigger/DialogCloseTrigger.tsx +51 -0
- package/src/dialog/description/DialogDescription.tsx +44 -0
- package/src/dialog/footer/DialogFooter.tsx +38 -0
- package/src/dialog/header/DialogHeader.tsx +62 -0
- package/src/dialog/index.ts +19 -0
- package/src/dialog/popup/DialogPopup.tsx +61 -0
- package/src/dialog/popup/DialogPopupInternal.tsx +285 -0
- package/src/dialog/root/DialogRoot.context.ts +89 -0
- package/src/dialog/root/DialogRoot.tsx +296 -0
- package/src/dialog/title/DialogTitle.tsx +52 -0
- package/src/dialog/trigger/DialogTrigger.tsx +47 -0
- package/src/expansion-card/ExpansionCardContent.tsx +1 -1
- package/src/form/checkbox/Checkbox.tsx +1 -1
- package/src/form/combobox/ComboboxWrapper.tsx +1 -0
- package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +1 -2
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +9 -7
- package/src/form/combobox/Input/Input.context.tsx +3 -3
- package/src/form/combobox/Input/InputController.tsx +1 -0
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +7 -3
- package/src/form/combobox/customOptionsContext.tsx +9 -7
- package/src/form/error-summary/ErrorSummary.tsx +1 -0
- package/src/form/file-upload/FileUpload.context.tsx +7 -3
- package/src/form/file-upload/parts/dropzone/Dropzone.tsx +6 -4
- package/src/form/radio/Radio.tsx +1 -1
- package/src/form/search/Search.tsx +3 -2
- package/src/guide-panel/GuidePanel.tsx +1 -1
- package/src/help-text/HelpText.tsx +1 -1
- package/src/index.ts +12 -0
- package/src/inline-message/root/InlineMessage.tsx +2 -1
- package/src/internal-header/InternalHeader.tsx +1 -1
- package/src/internal-header/InternalHeaderUser.tsx +4 -4
- package/src/layout/base/BasePrimitive.tsx +1 -1
- package/src/layout/bleed/Bleed.tsx +1 -1
- package/src/layout/box/Box.tsx +1 -1
- package/src/layout/grid/HGrid.tsx +1 -1
- package/src/layout/page/Page.tsx +1 -1
- package/src/layout/stack/Stack.tsx +1 -1
- package/src/link/Link.tsx +1 -1
- package/src/link-card/LinkCard.tsx +3 -3
- package/src/list/List.tsx +1 -1
- package/src/modal/Modal.context.ts +4 -4
- package/src/modal/Modal.tsx +1 -1
- package/src/overlays/action-menu/ActionMenu.tsx +7 -5
- package/src/overlays/dismissablelayer/DismissableLayer.tsx +65 -13
- package/src/overlays/dismissablelayer/util/dispatchCustomEvent.ts +3 -2
- package/src/overlays/dismissablelayer/util/useEscapeKeydown.ts +2 -2
- package/src/overlays/dismissablelayer/util/useFocusOutside.ts +2 -2
- package/src/overlays/dismissablelayer/util/usePointerDownOutside.ts +4 -4
- package/src/overlays/dismissablelayer/util/usePointerUpOutside.ts +95 -0
- package/src/overlays/floating/Floating.tsx +15 -20
- package/src/overlays/floating-menu/Menu.tsx +25 -26
- package/src/overlays/floating-menu/parts/RovingFocus.tsx +3 -2
- package/src/pagination/PaginationItem.tsx +1 -1
- package/src/popover/Popover.tsx +35 -6
- package/src/portal/Portal.tsx +1 -1
- package/src/process/Process.tsx +3 -5
- package/src/progress-bar/ProgressBar.tsx +2 -4
- package/src/stepper/context.ts +8 -8
- package/src/tabs/Tabs.context.ts +7 -8
- package/src/theme/Theme.tsx +15 -17
- package/src/timeline/period/ClickablePeriod.tsx +1 -1
- package/src/timeline/period/index.tsx +2 -1
- package/src/toggle-group/ToggleGroup.context.ts +8 -8
- package/src/toggle-group/ToggleGroup.tsx +1 -1
- package/src/tooltip/Tooltip.tsx +3 -1
- package/src/util/composition-warning/CompositionWarning.tsx +4 -3
- package/src/util/create-strict-context.tsx +91 -0
- package/src/util/focus-boundary/FocusBoundary.tsx +76 -17
- package/src/util/hideNonTargetElements.ts +2 -2
- package/src/util/hooks/descendants/useDescendant.tsx +5 -4
- package/src/util/hooks/index.ts +0 -1
- package/src/{overlays/overlay → util}/hooks/useAnimationsFinished.ts +8 -9
- package/src/util/hooks/useControllableState.ts +10 -13
- package/src/util/hooks/useEventCallback.ts +5 -6
- package/src/util/hooks/useId.ts +6 -1
- package/src/util/hooks/useMergeRefs.ts +3 -1
- package/src/{overlays/overlay → util}/hooks/useOpenChangeAnimationComplete.ts +3 -3
- package/src/util/hooks/usePrevious.ts +1 -0
- package/src/util/hooks/useScrollLock.ts +0 -1
- package/src/{overlays/overlay → util}/hooks/useTransitionStatus.ts +14 -2
- package/src/util/hooks/{useLatestRef.ts → useValueAsRef.ts} +3 -1
- package/src/util/link-anchor/LinkAnchor.tsx +7 -5
- package/src/util/resolveRef.ts +20 -0
- package/src/util/virtualfocus/Context.tsx +8 -6
- package/cjs/link/stories/RandomIcon.d.ts +0 -2
- package/cjs/link/stories/RandomIcon.js.map +0 -1
- package/cjs/overlays/overlay/hooks/useAnimationsFinished.js.map +0 -1
- package/cjs/overlays/overlay/hooks/useOpenChangeAnimationComplete.js.map +0 -1
- package/cjs/overlays/overlay/hooks/useTransitionStatus.js.map +0 -1
- package/cjs/util/create-context.d.ts +0 -20
- package/cjs/util/create-context.js.map +0 -1
- package/cjs/util/hooks/useCallbackRef.d.ts +0 -6
- package/cjs/util/hooks/useCallbackRef.js +0 -18
- package/cjs/util/hooks/useCallbackRef.js.map +0 -1
- package/cjs/util/hooks/useLatestRef.d.ts +0 -5
- package/cjs/util/hooks/useLatestRef.js.map +0 -1
- package/esm/link/stories/RandomIcon.d.ts +0 -2
- package/esm/link/stories/RandomIcon.js +0 -9
- package/esm/link/stories/RandomIcon.js.map +0 -1
- package/esm/overlays/overlay/hooks/useAnimationsFinished.js.map +0 -1
- package/esm/overlays/overlay/hooks/useOpenChangeAnimationComplete.js.map +0 -1
- package/esm/overlays/overlay/hooks/useTransitionStatus.js.map +0 -1
- package/esm/util/create-context.d.ts +0 -20
- package/esm/util/create-context.js.map +0 -1
- package/esm/util/hooks/useCallbackRef.d.ts +0 -6
- package/esm/util/hooks/useCallbackRef.js +0 -15
- package/esm/util/hooks/useCallbackRef.js.map +0 -1
- package/esm/util/hooks/useLatestRef.d.ts +0 -5
- package/esm/util/hooks/useLatestRef.js.map +0 -1
- package/src/link/stories/RandomIcon.tsx +0 -10
- package/src/util/create-context.tsx +0 -79
- package/src/util/hooks/useCallbackRef.ts +0 -20
- /package/cjs/{overlays/overlay → util}/hooks/useOpenChangeAnimationComplete.d.ts +0 -0
- /package/esm/{overlays/overlay → util}/hooks/useOpenChangeAnimationComplete.d.ts +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { XMarkIcon } from "@navikt/aksel-icons";
|
|
3
|
+
import { Button } from "../../button";
|
|
4
|
+
import { useRenameCSS } from "../../theme/Theme";
|
|
5
|
+
import { useI18n } from "../../util/i18n/i18n.hooks";
|
|
6
|
+
import { DialogCloseTrigger } from "../close-trigger/DialogCloseTrigger";
|
|
7
|
+
|
|
8
|
+
interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
/**
|
|
10
|
+
* Whether to show a close button in the header.
|
|
11
|
+
* Will trigger `onOpenChange` when clicked.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
withClosebutton?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @see 🏷️ {@link DialogHeaderProps}
|
|
19
|
+
* @example
|
|
20
|
+
* ```jsx
|
|
21
|
+
* <Dialog>
|
|
22
|
+
* <Dialog.Popup>
|
|
23
|
+
* <Dialog.Header>
|
|
24
|
+
* <Dialog.Title>Dialog title</Dialog.Title>
|
|
25
|
+
* </Dialog.Header>
|
|
26
|
+
* </Dialog.Popup>
|
|
27
|
+
* </Dialog>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
const DialogHeader = forwardRef<HTMLDivElement, DialogHeaderProps>(
|
|
31
|
+
(
|
|
32
|
+
{ className, children, withClosebutton = true, ...restProps },
|
|
33
|
+
forwardedRef,
|
|
34
|
+
) => {
|
|
35
|
+
const { cn } = useRenameCSS();
|
|
36
|
+
const translate = useI18n("global");
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
{...restProps}
|
|
41
|
+
ref={forwardedRef}
|
|
42
|
+
className={cn("navds-dialog__header", className)}
|
|
43
|
+
>
|
|
44
|
+
{withClosebutton && (
|
|
45
|
+
<DialogCloseTrigger>
|
|
46
|
+
<Button
|
|
47
|
+
type="button"
|
|
48
|
+
className={cn("navds-dialog__close-button")}
|
|
49
|
+
size="small"
|
|
50
|
+
variant="tertiary-neutral"
|
|
51
|
+
icon={<XMarkIcon title={translate("close")} />}
|
|
52
|
+
/>
|
|
53
|
+
</DialogCloseTrigger>
|
|
54
|
+
)}
|
|
55
|
+
{children}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export { DialogHeader };
|
|
62
|
+
export type { DialogHeaderProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export { Dialog } from "./root/DialogRoot";
|
|
3
|
+
export type { DialogProps } from "./root/DialogRoot";
|
|
4
|
+
export { DialogTrigger } from "./trigger/DialogTrigger";
|
|
5
|
+
export type { DialogTriggerProps } from "./trigger/DialogTrigger";
|
|
6
|
+
export { DialogPopup } from "./popup/DialogPopup";
|
|
7
|
+
export type { DialogPopupProps } from "./popup/DialogPopup";
|
|
8
|
+
export { DialogCloseTrigger } from "./close-trigger/DialogCloseTrigger";
|
|
9
|
+
export type { DialogCloseTriggerProps } from "./close-trigger/DialogCloseTrigger";
|
|
10
|
+
export { DialogHeader } from "./header/DialogHeader";
|
|
11
|
+
export type { DialogHeaderProps } from "./header/DialogHeader";
|
|
12
|
+
export { DialogFooter } from "./footer/DialogFooter";
|
|
13
|
+
export type { DialogFooterProps } from "./footer/DialogFooter";
|
|
14
|
+
export { DialogTitle } from "./title/DialogTitle";
|
|
15
|
+
export type { DialogTitleProps } from "./title/DialogTitle";
|
|
16
|
+
export { DialogDescription } from "./description/DialogDescription";
|
|
17
|
+
export type { DialogDescriptionProps } from "./description/DialogDescription";
|
|
18
|
+
export { DialogBody } from "./body/DialogBody";
|
|
19
|
+
export type { DialogBodyProps } from "./body/DialogBody";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { Portal, type PortalProps } from "../../portal";
|
|
3
|
+
import { DialogBackdropInternal } from "../backdrop/DialogBackdropInternal";
|
|
4
|
+
import { useDialogContext } from "../root/DialogRoot.context";
|
|
5
|
+
import {
|
|
6
|
+
DialogPopupInternal,
|
|
7
|
+
type DialogPopupInternalProps,
|
|
8
|
+
} from "./DialogPopupInternal";
|
|
9
|
+
|
|
10
|
+
type DialogPopupProps = DialogPopupInternalProps &
|
|
11
|
+
Pick<PortalProps, "rootElement"> & {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @see 🏷️ {@link DialogPopupProps}
|
|
17
|
+
* @example
|
|
18
|
+
* ```jsx
|
|
19
|
+
* <Dialog>
|
|
20
|
+
* <Dialog.Popup>
|
|
21
|
+
* ...
|
|
22
|
+
* </Dialog.Popup>
|
|
23
|
+
* </Dialog>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
const DialogPopup = forwardRef<HTMLDivElement, DialogPopupProps>(
|
|
27
|
+
(
|
|
28
|
+
{
|
|
29
|
+
modal = true,
|
|
30
|
+
withBackdrop = modal === true,
|
|
31
|
+
rootElement,
|
|
32
|
+
position,
|
|
33
|
+
...restProps
|
|
34
|
+
},
|
|
35
|
+
forwardedRef,
|
|
36
|
+
) => {
|
|
37
|
+
const { mounted, nested } = useDialogContext();
|
|
38
|
+
|
|
39
|
+
if (!mounted) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Portal rootElement={rootElement}>
|
|
45
|
+
{withBackdrop && position !== "fullscreen" && !nested && (
|
|
46
|
+
<DialogBackdropInternal />
|
|
47
|
+
)}
|
|
48
|
+
<DialogPopupInternal
|
|
49
|
+
ref={forwardedRef}
|
|
50
|
+
{...restProps}
|
|
51
|
+
position={position}
|
|
52
|
+
withBackdrop={withBackdrop && position !== "fullscreen"}
|
|
53
|
+
modal={modal}
|
|
54
|
+
/>
|
|
55
|
+
</Portal>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export { DialogPopup };
|
|
61
|
+
export type { DialogPopupProps };
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { BoxNew, type BoxNewProps } from "../../layout/box";
|
|
3
|
+
import { DismissableLayer } from "../../overlays/dismissablelayer/DismissableLayer";
|
|
4
|
+
import { useRenameCSS } from "../../theme/Theme";
|
|
5
|
+
import { FocusBoundary } from "../../util/focus-boundary/FocusBoundary";
|
|
6
|
+
import { FocusGuards } from "../../util/focus-guards/FocusGuards";
|
|
7
|
+
import { useMergeRefs } from "../../util/hooks";
|
|
8
|
+
import { useOpenChangeAnimationComplete } from "../../util/hooks/useOpenChangeAnimationComplete";
|
|
9
|
+
import { useScrollLock } from "../../util/hooks/useScrollLock";
|
|
10
|
+
import { createTransitionStatusAttribute } from "../../util/hooks/useTransitionStatus";
|
|
11
|
+
import { useDialogContext } from "../root/DialogRoot.context";
|
|
12
|
+
|
|
13
|
+
type DialogPosition = "center" | "bottom" | "left" | "right" | "fullscreen";
|
|
14
|
+
|
|
15
|
+
interface DialogPopupInternalProps
|
|
16
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
17
|
+
/**
|
|
18
|
+
* Determines if the dialog enters a modal state when open.
|
|
19
|
+
* - `true`: user interaction is limited to just the dialog: focus is trapped, document page scroll is locked, and pointer interactions on outside elements are disabled.
|
|
20
|
+
* - `'trap-focus'`: focus is trapped inside the dialog, but document page scroll is not locked and pointer interactions outside of it remain enabled.
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
modal?: true | "trap-focus";
|
|
24
|
+
/**
|
|
25
|
+
* Determines if the dialog should close on outside clicks.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
closeOnOutsideClick?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Will try to focus the given element on mount.
|
|
31
|
+
*
|
|
32
|
+
* If not provided, Dialog will focus the popup itself.
|
|
33
|
+
*/
|
|
34
|
+
initialFocusTo?:
|
|
35
|
+
| React.RefObject<HTMLElement | null>
|
|
36
|
+
| (() => HTMLElement | null | undefined);
|
|
37
|
+
/**
|
|
38
|
+
* Will try to focus the given element on unmount.
|
|
39
|
+
*
|
|
40
|
+
* If not provided, Dialog will try to focus the `Dialog.Trigger` element
|
|
41
|
+
* or the last focused element before the dialog opened.
|
|
42
|
+
*/
|
|
43
|
+
returnFocusTo?:
|
|
44
|
+
| React.RefObject<HTMLElement | null>
|
|
45
|
+
| (() => HTMLElement | null | undefined);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The position of the dialog relative to the viewport.
|
|
49
|
+
* @default "center"
|
|
50
|
+
*/
|
|
51
|
+
position?: "center" | "bottom" | "left" | "right" | "fullscreen";
|
|
52
|
+
/**
|
|
53
|
+
* CSS `width`
|
|
54
|
+
*
|
|
55
|
+
* Has no effect when `position` is set to `fullscreen`.
|
|
56
|
+
*
|
|
57
|
+
* @default "medium"
|
|
58
|
+
*/
|
|
59
|
+
width?: (string & {}) | "small" | "medium" | "large";
|
|
60
|
+
/**
|
|
61
|
+
* CSS `height`
|
|
62
|
+
*
|
|
63
|
+
* Has no effect when `position` is set to `fullscreen`, `left` or `right`.
|
|
64
|
+
*/
|
|
65
|
+
height?: (string & {}) | "small" | "medium" | "large";
|
|
66
|
+
/**
|
|
67
|
+
* Adds a backdrop behind the dialog popup.
|
|
68
|
+
* @default true if `modal={true}`, else `false`
|
|
69
|
+
*/
|
|
70
|
+
withBackdrop?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* ARIA role for the dialog popup.
|
|
73
|
+
* @default "dialog"
|
|
74
|
+
*/
|
|
75
|
+
role?: "dialog" | "alertdialog";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const DialogPopupInternal = forwardRef<
|
|
79
|
+
HTMLDivElement,
|
|
80
|
+
DialogPopupInternalProps
|
|
81
|
+
>(
|
|
82
|
+
(
|
|
83
|
+
{
|
|
84
|
+
className,
|
|
85
|
+
modal,
|
|
86
|
+
closeOnOutsideClick = true,
|
|
87
|
+
initialFocusTo,
|
|
88
|
+
returnFocusTo,
|
|
89
|
+
position = "center",
|
|
90
|
+
width = "medium",
|
|
91
|
+
height,
|
|
92
|
+
id,
|
|
93
|
+
style,
|
|
94
|
+
"aria-labelledby": ariaLabelledbyProp,
|
|
95
|
+
withBackdrop,
|
|
96
|
+
role = "dialog",
|
|
97
|
+
...restProps
|
|
98
|
+
},
|
|
99
|
+
forwardedRef,
|
|
100
|
+
) => {
|
|
101
|
+
const { cn } = useRenameCSS();
|
|
102
|
+
const {
|
|
103
|
+
mounted,
|
|
104
|
+
popupRef,
|
|
105
|
+
setPopupElement,
|
|
106
|
+
triggerElement,
|
|
107
|
+
setOpen,
|
|
108
|
+
open,
|
|
109
|
+
transitionStatus,
|
|
110
|
+
popupElement,
|
|
111
|
+
nestedOpenDialogCount: nestedOpenDialogCountProp,
|
|
112
|
+
nested,
|
|
113
|
+
size,
|
|
114
|
+
titleId,
|
|
115
|
+
popupId,
|
|
116
|
+
onOpenChangeComplete,
|
|
117
|
+
setMounted,
|
|
118
|
+
} = useDialogContext();
|
|
119
|
+
|
|
120
|
+
const mergedRefs = useMergeRefs(forwardedRef, popupRef, setPopupElement);
|
|
121
|
+
|
|
122
|
+
useScrollLock({
|
|
123
|
+
enabled: open && modal === true,
|
|
124
|
+
mounted,
|
|
125
|
+
open,
|
|
126
|
+
referenceElement: popupElement,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
useOpenChangeAnimationComplete({
|
|
130
|
+
open,
|
|
131
|
+
ref: popupRef,
|
|
132
|
+
onComplete() {
|
|
133
|
+
if (open) {
|
|
134
|
+
onOpenChangeComplete?.(true);
|
|
135
|
+
} else {
|
|
136
|
+
setMounted(false);
|
|
137
|
+
onOpenChangeComplete?.(false);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const resolvedInitialFocus = initialFocusTo ?? popupRef;
|
|
143
|
+
|
|
144
|
+
const resolvedReturnFocus = () => {
|
|
145
|
+
if (returnFocusTo) {
|
|
146
|
+
return typeof returnFocusTo === "function"
|
|
147
|
+
? returnFocusTo()
|
|
148
|
+
: returnFocusTo.current;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (isFocusable(triggerElement)) {
|
|
152
|
+
return triggerElement;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return true;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<FocusGuards>
|
|
160
|
+
<FocusBoundary
|
|
161
|
+
loop
|
|
162
|
+
trapped={open}
|
|
163
|
+
initialFocus={resolvedInitialFocus}
|
|
164
|
+
returnFocus={resolvedReturnFocus}
|
|
165
|
+
modal
|
|
166
|
+
>
|
|
167
|
+
<DismissableLayer
|
|
168
|
+
asChild
|
|
169
|
+
safeZone={{
|
|
170
|
+
anchor: triggerElement,
|
|
171
|
+
}}
|
|
172
|
+
onDismiss={(event) => {
|
|
173
|
+
open && setOpen(false, event);
|
|
174
|
+
}}
|
|
175
|
+
disableOutsidePointerEvents={modal === true || withBackdrop}
|
|
176
|
+
onInteractOutside={(event) => {
|
|
177
|
+
/**
|
|
178
|
+
* Since trigger might be set up to close the dialog on click,
|
|
179
|
+
* we need to prevent dismissing when clicking the trigger to avoid double close events (potentially re-triggering open)
|
|
180
|
+
*/
|
|
181
|
+
const target = event.target as HTMLElement;
|
|
182
|
+
const targetIsTrigger = triggerElement?.contains(target);
|
|
183
|
+
if (targetIsTrigger) {
|
|
184
|
+
event.preventDefault();
|
|
185
|
+
}
|
|
186
|
+
}}
|
|
187
|
+
/**
|
|
188
|
+
* Only close dialog on pointerUp pointerEvents
|
|
189
|
+
*/
|
|
190
|
+
onPointerDownOutside={(event) => {
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
}}
|
|
193
|
+
onFocusOutside={(event) => {
|
|
194
|
+
/**
|
|
195
|
+
* Focus-events are tricky when dealing with portals and nested dialogs.
|
|
196
|
+
* If multiple dialogs are open, initial auto-focus might cause
|
|
197
|
+
* onFocusOutside to trigger on the parent dialog when focusing the child dialog.
|
|
198
|
+
*/
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
}}
|
|
201
|
+
enablePointerUpOutside
|
|
202
|
+
onPointerUpOutside={(event) => {
|
|
203
|
+
!closeOnOutsideClick && event.preventDefault();
|
|
204
|
+
}}
|
|
205
|
+
>
|
|
206
|
+
<BoxNew
|
|
207
|
+
aria-labelledby={ariaLabelledbyProp ?? titleId}
|
|
208
|
+
id={id ?? popupId}
|
|
209
|
+
{...restProps}
|
|
210
|
+
ref={mergedRefs}
|
|
211
|
+
className={cn("navds-dialog__popup", className)}
|
|
212
|
+
role={role}
|
|
213
|
+
aria-modal="true"
|
|
214
|
+
{...createTransitionStatusAttribute(transitionStatus)}
|
|
215
|
+
data-position={position}
|
|
216
|
+
data-size={size}
|
|
217
|
+
width={translateWidth(width, position)}
|
|
218
|
+
height={translateHeight(height, position)}
|
|
219
|
+
style={{
|
|
220
|
+
...style,
|
|
221
|
+
"--__axc-nested-level": nestedOpenDialogCountProp,
|
|
222
|
+
}}
|
|
223
|
+
data-nested-dialog-open={!!nestedOpenDialogCountProp}
|
|
224
|
+
data-nested={!!nested}
|
|
225
|
+
/>
|
|
226
|
+
</DismissableLayer>
|
|
227
|
+
</FocusBoundary>
|
|
228
|
+
</FocusGuards>
|
|
229
|
+
);
|
|
230
|
+
},
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
function translateWidth(
|
|
234
|
+
width: DialogPopupInternalProps["width"],
|
|
235
|
+
position: DialogPosition,
|
|
236
|
+
): BoxNewProps["width"] {
|
|
237
|
+
if (position === "fullscreen") {
|
|
238
|
+
return undefined;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
switch (width) {
|
|
242
|
+
case "small":
|
|
243
|
+
return "480px";
|
|
244
|
+
case "medium":
|
|
245
|
+
return "640px";
|
|
246
|
+
case "large":
|
|
247
|
+
return "800px";
|
|
248
|
+
default:
|
|
249
|
+
return width;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function translateHeight(
|
|
254
|
+
height: DialogPopupInternalProps["height"],
|
|
255
|
+
position: DialogPosition,
|
|
256
|
+
): BoxNewProps["height"] {
|
|
257
|
+
if (
|
|
258
|
+
position === "fullscreen" ||
|
|
259
|
+
position === "left" ||
|
|
260
|
+
position === "right"
|
|
261
|
+
) {
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return height;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function isFocusable(element: Element | null) {
|
|
269
|
+
if (!element || !element.isConnected) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Baselined in 2024
|
|
275
|
+
* @see https://caniuse.com/?search=checkvisibility
|
|
276
|
+
*/
|
|
277
|
+
if (typeof element.checkVisibility === "function") {
|
|
278
|
+
return element.checkVisibility();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return getComputedStyle(element).display !== "none";
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export { DialogPopupInternal };
|
|
285
|
+
export type { DialogPopupInternalProps };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createStrictContext } from "../../util/create-strict-context";
|
|
2
|
+
import type { TransitionStatus } from "../../util/hooks/useTransitionStatus";
|
|
3
|
+
|
|
4
|
+
interface DialogContextProps {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the dialog is currently open.
|
|
7
|
+
*/
|
|
8
|
+
open: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Event handler called when the dialog is opened or closed.
|
|
11
|
+
*/
|
|
12
|
+
setOpen: (open: boolean, originalEvent: Event) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Setter for whether the dialog is mounted.
|
|
15
|
+
*/
|
|
16
|
+
setMounted: React.Dispatch<React.SetStateAction<boolean>>;
|
|
17
|
+
/**
|
|
18
|
+
* Event handler called after any animations complete when the dialog is opened or closed.
|
|
19
|
+
*/
|
|
20
|
+
onOpenChangeComplete?: (open: boolean) => void;
|
|
21
|
+
/**
|
|
22
|
+
* The transition status of the dialog
|
|
23
|
+
*/
|
|
24
|
+
transitionStatus: TransitionStatus;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the dialog should be mounted (opened)
|
|
27
|
+
*/
|
|
28
|
+
mounted: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The ref to the Popup element.
|
|
31
|
+
*/
|
|
32
|
+
popupRef: React.RefObject<HTMLElement | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Callback to register the Popup element DOM node.
|
|
35
|
+
*/
|
|
36
|
+
setPopupElement: React.Dispatch<React.SetStateAction<HTMLElement | null>>;
|
|
37
|
+
/**
|
|
38
|
+
* The Popup element DOM node.
|
|
39
|
+
*/
|
|
40
|
+
popupElement: HTMLElement | null;
|
|
41
|
+
/**
|
|
42
|
+
* ID of the popup element
|
|
43
|
+
*/
|
|
44
|
+
popupId: string;
|
|
45
|
+
/**
|
|
46
|
+
* Callback to register the Trigger element DOM node.
|
|
47
|
+
*/
|
|
48
|
+
setTriggerElement: React.Dispatch<React.SetStateAction<HTMLElement | null>>;
|
|
49
|
+
/**
|
|
50
|
+
* The Trigger element DOM node.
|
|
51
|
+
*/
|
|
52
|
+
triggerElement: HTMLElement | null;
|
|
53
|
+
/**
|
|
54
|
+
* Declares if this dialog is nested inside another dialog.
|
|
55
|
+
*/
|
|
56
|
+
nested: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Handles nested dialog opened event.
|
|
59
|
+
*/
|
|
60
|
+
nestedDialogOpened: (nestedCount: number) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Handles nested dialog closing event.
|
|
63
|
+
*/
|
|
64
|
+
nestedDialogClosed: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* Number of currently opened nested dialogs.
|
|
67
|
+
*/
|
|
68
|
+
nestedOpenDialogCount: number | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Dialog size
|
|
71
|
+
*/
|
|
72
|
+
size: "small" | "medium";
|
|
73
|
+
/**
|
|
74
|
+
* ID of the dialog title element.
|
|
75
|
+
*/
|
|
76
|
+
titleId?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Setter for the dialog title ID.
|
|
79
|
+
*/
|
|
80
|
+
setTitleId: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const { Provider: DialogContextProvider, useContext: useDialogContext } =
|
|
84
|
+
createStrictContext<DialogContextProps>({
|
|
85
|
+
name: "DialogContext",
|
|
86
|
+
errorMessage: "useDialogContext must be used within Dialog",
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export { DialogContextProvider, useDialogContext };
|