@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
|
@@ -8,8 +8,9 @@ import React, {
|
|
|
8
8
|
import { Slot } from "../../slot/Slot";
|
|
9
9
|
import { useClientLayoutEffect, useMergeRefs } from "../../util/hooks";
|
|
10
10
|
import { hideNonTargetElements } from "../hideNonTargetElements";
|
|
11
|
-
import {
|
|
11
|
+
import { useValueAsRef } from "../hooks/useValueAsRef";
|
|
12
12
|
import { ownerDocument } from "../owner";
|
|
13
|
+
import { resolveRef } from "../resolveRef";
|
|
13
14
|
|
|
14
15
|
/* -------------------------------------------------------------------------- */
|
|
15
16
|
/* FocusBoundary */
|
|
@@ -59,7 +60,10 @@ interface FocusBoundaryProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
59
60
|
*
|
|
60
61
|
* Set to `false` to not focus anything.
|
|
61
62
|
*/
|
|
62
|
-
returnFocus?:
|
|
63
|
+
returnFocus?:
|
|
64
|
+
| boolean
|
|
65
|
+
| React.MutableRefObject<HTMLElement | null>
|
|
66
|
+
| (() => boolean | HTMLElement | null | undefined);
|
|
63
67
|
/**
|
|
64
68
|
* Hides all outside content from screen readers when true.
|
|
65
69
|
* @default false
|
|
@@ -79,8 +83,8 @@ const FocusBoundary = forwardRef<HTMLDivElement, FocusBoundaryProps>(
|
|
|
79
83
|
}: FocusBoundaryProps,
|
|
80
84
|
forwardedRef,
|
|
81
85
|
) => {
|
|
82
|
-
const initialFocusRef =
|
|
83
|
-
const returnFocusRef =
|
|
86
|
+
const initialFocusRef = useValueAsRef(initialFocus);
|
|
87
|
+
const returnFocusRef = useValueAsRef(returnFocus);
|
|
84
88
|
|
|
85
89
|
const lastFocusedElementRef = useRef<HTMLElement | null>(null);
|
|
86
90
|
const [container, setContainer] = useState<HTMLElement | null>(null);
|
|
@@ -121,7 +125,6 @@ const FocusBoundary = forwardRef<HTMLDivElement, FocusBoundaryProps>(
|
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
const relatedTarget = event.relatedTarget as HTMLElement | null;
|
|
124
|
-
|
|
125
128
|
/*
|
|
126
129
|
* `focusout` event with a `null` `relatedTarget` will happen in a few known cases:
|
|
127
130
|
* 1. When the user switches app/tabs/windows/the browser itself loses focus.
|
|
@@ -181,6 +184,11 @@ const FocusBoundary = forwardRef<HTMLDivElement, FocusBoundaryProps>(
|
|
|
181
184
|
return;
|
|
182
185
|
}
|
|
183
186
|
|
|
187
|
+
const ownerDoc = ownerDocument(container);
|
|
188
|
+
const activeElement = ownerDoc.activeElement;
|
|
189
|
+
const closestContainer = activeElement?.closest("[data-focus-boundary]");
|
|
190
|
+
|
|
191
|
+
addPreviouslyFocusedElement(ownerDoc.activeElement, closestContainer);
|
|
184
192
|
focusBoundarysStack.add(focusBoundary);
|
|
185
193
|
|
|
186
194
|
return () => {
|
|
@@ -190,6 +198,17 @@ const FocusBoundary = forwardRef<HTMLDivElement, FocusBoundaryProps>(
|
|
|
190
198
|
};
|
|
191
199
|
}, [container, focusBoundary]);
|
|
192
200
|
|
|
201
|
+
/**
|
|
202
|
+
* On unmount, we need to clean up previously focused elements associated with this container
|
|
203
|
+
* This makes sure we don't accidentally try to focus elements that are no longer relevant
|
|
204
|
+
* or will be removed from the DOM.
|
|
205
|
+
*/
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
return () => {
|
|
208
|
+
container && deleteContainerAndPreviouslyFocusedElements(container);
|
|
209
|
+
};
|
|
210
|
+
}, [container]);
|
|
211
|
+
|
|
193
212
|
useEffect(() => {
|
|
194
213
|
if (!container || !modal) {
|
|
195
214
|
return;
|
|
@@ -253,10 +272,14 @@ const FocusBoundary = forwardRef<HTMLDivElement, FocusBoundaryProps>(
|
|
|
253
272
|
return;
|
|
254
273
|
}
|
|
255
274
|
const ownerDoc = ownerDocument(container);
|
|
256
|
-
const previouslyFocusedElement = ownerDoc.activeElement;
|
|
257
275
|
|
|
258
276
|
function getReturnElement() {
|
|
259
|
-
|
|
277
|
+
const resolvedReturnFocusValueOrFn = returnFocusRef.current;
|
|
278
|
+
|
|
279
|
+
let resolvedReturnFocusValue =
|
|
280
|
+
typeof resolvedReturnFocusValueOrFn === "function"
|
|
281
|
+
? resolvedReturnFocusValueOrFn()
|
|
282
|
+
: resolvedReturnFocusValueOrFn;
|
|
260
283
|
|
|
261
284
|
if (
|
|
262
285
|
resolvedReturnFocusValue === undefined ||
|
|
@@ -271,11 +294,11 @@ const FocusBoundary = forwardRef<HTMLDivElement, FocusBoundaryProps>(
|
|
|
271
294
|
}
|
|
272
295
|
|
|
273
296
|
if (typeof resolvedReturnFocusValue === "boolean") {
|
|
274
|
-
const el =
|
|
297
|
+
const el = getPreviouslyFocusedElement();
|
|
275
298
|
return el?.isConnected ? el : ownerDoc.body;
|
|
276
299
|
}
|
|
277
300
|
|
|
278
|
-
const fallback =
|
|
301
|
+
const fallback = getPreviouslyFocusedElement() || ownerDoc.body;
|
|
279
302
|
|
|
280
303
|
return resolveRef(resolvedReturnFocusValue) || fallback;
|
|
281
304
|
}
|
|
@@ -354,6 +377,7 @@ const FocusBoundary = forwardRef<HTMLDivElement, FocusBoundaryProps>(
|
|
|
354
377
|
{...restProps}
|
|
355
378
|
ref={mergedRefs}
|
|
356
379
|
onKeyDown={handleKeyDown}
|
|
380
|
+
data-focus-boundary
|
|
357
381
|
/>
|
|
358
382
|
);
|
|
359
383
|
},
|
|
@@ -508,16 +532,51 @@ function removeLinks(items: HTMLElement[]) {
|
|
|
508
532
|
return items.filter((item) => item.tagName !== "A");
|
|
509
533
|
}
|
|
510
534
|
|
|
535
|
+
const LIST_LIMIT = 10;
|
|
536
|
+
let previouslyFocusedElements: Element[] = [];
|
|
537
|
+
const focusedElementsByContainer = new WeakMap<Element, Element[]>();
|
|
538
|
+
|
|
539
|
+
function clearDisconnectedPreviouslyFocusedElements() {
|
|
540
|
+
previouslyFocusedElements = previouslyFocusedElements.filter(
|
|
541
|
+
(el) => el.isConnected,
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
|
|
511
545
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
* Non-generic to safely handle refs whose `.current` may be `null`.
|
|
546
|
+
* Removes "will be" unmounted elements from previouslyFocusedElements,
|
|
547
|
+
* and deletes the container from focusedElementsByContainer.
|
|
516
548
|
*/
|
|
517
|
-
function
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
549
|
+
function deleteContainerAndPreviouslyFocusedElements(container: HTMLElement) {
|
|
550
|
+
const nestedElements = focusedElementsByContainer.get(container) || [];
|
|
551
|
+
previouslyFocusedElements = previouslyFocusedElements.filter((el) => {
|
|
552
|
+
return !nestedElements.includes(el);
|
|
553
|
+
});
|
|
554
|
+
focusedElementsByContainer.delete(container);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function addPreviouslyFocusedElement(
|
|
558
|
+
element: Element | null,
|
|
559
|
+
container: Element | null | undefined,
|
|
560
|
+
) {
|
|
561
|
+
clearDisconnectedPreviouslyFocusedElements();
|
|
562
|
+
if (element && element?.nodeName !== "BODY") {
|
|
563
|
+
previouslyFocusedElements.push(element);
|
|
564
|
+
|
|
565
|
+
if (container) {
|
|
566
|
+
const nestedElements = focusedElementsByContainer.get(container) || [];
|
|
567
|
+
nestedElements.push(element);
|
|
568
|
+
focusedElementsByContainer.set(container, nestedElements);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
if (previouslyFocusedElements.length > LIST_LIMIT) {
|
|
572
|
+
previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function getPreviouslyFocusedElement() {
|
|
578
|
+
clearDisconnectedPreviouslyFocusedElements();
|
|
579
|
+
return previouslyFocusedElements[previouslyFocusedElements.length - 1];
|
|
521
580
|
}
|
|
522
581
|
|
|
523
582
|
export { FocusBoundary };
|
|
@@ -169,11 +169,11 @@ function hideNonTargetElements(avoidElements: Element[]): UndoFn {
|
|
|
169
169
|
* Assume that elements with `aria-live` or `script` tags should not be hidden.
|
|
170
170
|
* This ensures that live regions and scripts continue to function properly.
|
|
171
171
|
*/
|
|
172
|
-
const
|
|
172
|
+
const ignoredElements = Array.from(
|
|
173
173
|
body.querySelectorAll("[aria-live], script"),
|
|
174
174
|
);
|
|
175
175
|
|
|
176
|
-
return applyAttributeToOthers(avoidElements.concat(
|
|
176
|
+
return applyAttributeToOthers(avoidElements.concat(ignoredElements), body);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
export { hideNonTargetElements };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* https://github.com/chakra-ui/chakra-ui/tree/5ec0be610b5a69afba01a9c22365155c1b519136/packages/components/descendant
|
|
3
3
|
*/
|
|
4
4
|
import React, { useRef, useState } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { createStrictContext } from "../../create-strict-context";
|
|
6
6
|
import { useClientLayoutEffect } from "../useClientLayoutEffect";
|
|
7
7
|
import { mergeRefs } from "../useMergeRefs";
|
|
8
8
|
import { DescendantOptions, DescendantsManager } from "./descendant";
|
|
@@ -15,9 +15,10 @@ export function createDescendantContext<
|
|
|
15
15
|
T extends HTMLElement = HTMLElement,
|
|
16
16
|
K extends Record<string, any> = object,
|
|
17
17
|
>() {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const {
|
|
19
|
+
Provider: DescendantsContextProvider,
|
|
20
|
+
useContext: useDescendantsContext,
|
|
21
|
+
} = createStrictContext<ReturnType<typeof useDescendants>>({
|
|
21
22
|
name: "DescendantsProvider",
|
|
22
23
|
errorMessage:
|
|
23
24
|
"useDescendantsContext must be used within DescendantsProvider",
|
package/src/util/hooks/index.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useEffect } from "react";
|
|
4
4
|
import ReactDOM from "react-dom";
|
|
5
|
-
import {
|
|
5
|
+
import { resolveRef } from "../resolveRef";
|
|
6
|
+
import { useEventCallback } from "./useEventCallback";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Returns a stable function that, when invoked, waits for all current CSS/Web Animations
|
|
@@ -15,7 +16,7 @@ import { useEventCallback } from "../../../util/hooks/useEventCallback";
|
|
|
15
16
|
*
|
|
16
17
|
* Mechanics:
|
|
17
18
|
* 1. Resolves the concrete `HTMLElement` (direct element or from ref) – early no-op if missing.
|
|
18
|
-
* 2. If `getAnimations` is unsupported or animations are globally disabled (`
|
|
19
|
+
* 2. If `getAnimations` is unsupported or animations are globally disabled (`AKSEL_NO_EXIT_ANIMATIONS`),
|
|
19
20
|
* runs the callback immediately.
|
|
20
21
|
* 3. Schedules a frame so style/animation changes applied this render are committed.
|
|
21
22
|
* 4. Optionally schedules an additional frame (`waitForNextTick=true`) to catch animations that
|
|
@@ -66,12 +67,8 @@ export function useAnimationsFinished(
|
|
|
66
67
|
// Cancel any in-flight scheduling from a previous invocation (next-frame debounce semantics)
|
|
67
68
|
cancelScheduled();
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
70
|
+
const element = resolveRef(elementOrRef);
|
|
72
71
|
|
|
73
|
-
const element =
|
|
74
|
-
"current" in elementOrRef ? elementOrRef.current : elementOrRef;
|
|
75
72
|
if (element == null) {
|
|
76
73
|
return;
|
|
77
74
|
}
|
|
@@ -80,7 +77,7 @@ export function useAnimationsFinished(
|
|
|
80
77
|
if (
|
|
81
78
|
typeof element.getAnimations !== "function" ||
|
|
82
79
|
// Flag hook for test envs.
|
|
83
|
-
(globalThis as any).
|
|
80
|
+
(globalThis as any).AKSEL_NO_EXIT_ANIMATIONS
|
|
84
81
|
) {
|
|
85
82
|
fnToExecute();
|
|
86
83
|
return;
|
|
@@ -96,7 +93,9 @@ export function useAnimationsFinished(
|
|
|
96
93
|
Promise.allSettled(
|
|
97
94
|
element.getAnimations().map((anim) => anim.finished),
|
|
98
95
|
).then(() => {
|
|
99
|
-
if (signal?.aborted)
|
|
96
|
+
if (signal?.aborted) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
100
99
|
// Ensure any state updates inside the callback are flushed synchronously,
|
|
101
100
|
// guaranteeing that dependent logic observes the current
|
|
102
101
|
// tree rather than a stale in-progress update.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// https://github.com/chakra-ui/chakra-ui/tree/5ec0be610b5a69afba01a9c22365155c1b519136/packages/hooks/use-controllable-state
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useEventCallback } from "./useEventCallback";
|
|
4
4
|
|
|
5
5
|
export interface UseControllableStateProps<T> {
|
|
6
6
|
value?: T;
|
|
@@ -16,25 +16,22 @@ export function useControllableState<T>({
|
|
|
16
16
|
defaultValue,
|
|
17
17
|
onChange,
|
|
18
18
|
}: UseControllableStateProps<T>) {
|
|
19
|
-
const onChangeProp =
|
|
19
|
+
const onChangeProp = useEventCallback(onChange);
|
|
20
20
|
|
|
21
21
|
const [uncontrolledState, setUncontrolledState] = useState(defaultValue);
|
|
22
22
|
const controlled = valueProp !== undefined;
|
|
23
23
|
const value = controlled ? valueProp : uncontrolledState;
|
|
24
24
|
|
|
25
|
-
const setValue =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const nextValue = typeof next === "function" ? setter(value) : next;
|
|
25
|
+
const setValue = useEventCallback((next: React.SetStateAction<T>) => {
|
|
26
|
+
const setter = next as (prevState?: T) => T;
|
|
27
|
+
const nextValue = typeof next === "function" ? setter(value) : next;
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
if (!controlled) {
|
|
30
|
+
setUncontrolledState(nextValue);
|
|
31
|
+
}
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
[controlled, onChangeProp, value],
|
|
37
|
-
);
|
|
33
|
+
onChangeProp(nextValue);
|
|
34
|
+
});
|
|
38
35
|
|
|
39
36
|
return [value, setValue] as const;
|
|
40
37
|
}
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Guarantees: stable identity; latest logic executed; no calls from uncommitted renders; dev
|
|
16
16
|
* error if invoked during render; safe when `callback` is undefined (no-op).
|
|
17
|
+
*
|
|
18
|
+
* This hook is a more permissive version of React 19.2's `React.useEffectEvent` in that it can be passed through contexts and called in event handler props, not just effects.
|
|
17
19
|
*/
|
|
18
20
|
import React, { useLayoutEffect } from "react";
|
|
19
21
|
import { useRefWithInit } from "./useRefWithInit";
|
|
@@ -42,12 +44,7 @@ type Stable<T extends Callback> = {
|
|
|
42
44
|
effect: () => void;
|
|
43
45
|
};
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
* TODO: Long term, replace `useCallbackRef` with this hook.
|
|
47
|
-
*/
|
|
48
|
-
export function useEventCallback<T extends Callback>(
|
|
49
|
-
callback: T | undefined,
|
|
50
|
-
): T {
|
|
47
|
+
function useEventCallback<T extends Callback>(callback: T | undefined): T {
|
|
51
48
|
const stable = useRefWithInit(createStableCallback).current as Stable<T>;
|
|
52
49
|
stable.next = callback;
|
|
53
50
|
useSafeInsertionEffect(stable.effect);
|
|
@@ -71,3 +68,5 @@ function assertNotCalled() {
|
|
|
71
68
|
throw new Error("Aksel: Cannot call an event handler while rendering.");
|
|
72
69
|
}
|
|
73
70
|
}
|
|
71
|
+
|
|
72
|
+
export { useEventCallback };
|
package/src/util/hooks/useId.ts
CHANGED
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
//https://github.com/mui/material-ui/blob/master/packages/mui-utils/src/useId.ts
|
|
4
4
|
import React, { useEffect, useState } from "react";
|
|
5
5
|
|
|
6
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
7
|
+
|
|
6
8
|
let globalId = 0;
|
|
7
9
|
function useGlobalId(idOverride?: string): string | undefined {
|
|
10
|
+
// biome-ignore lint/correctness/useHookAtTopLevel: At runtime, `useGlobalId` is invariant.
|
|
8
11
|
const [defaultId, setDefaultId] = useState(idOverride);
|
|
9
12
|
const id = idOverride || defaultId;
|
|
13
|
+
|
|
14
|
+
// biome-ignore lint/correctness/useHookAtTopLevel: At runtime, `useGlobalId` is invariant.
|
|
10
15
|
useEffect(() => {
|
|
11
16
|
if (defaultId == null) {
|
|
12
17
|
// Fallback to this default id when possible.
|
|
@@ -34,6 +39,6 @@ export function useId(idOverride?: string): string {
|
|
|
34
39
|
const reactId = maybeReactUseId();
|
|
35
40
|
return idOverride ?? reactId.replace(/(:)/g, "");
|
|
36
41
|
}
|
|
37
|
-
//
|
|
42
|
+
// biome-ignore lint/correctness/useHookAtTopLevel: `useId` is invariant at runtime.
|
|
38
43
|
return useGlobalId(idOverride) ?? "";
|
|
39
44
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
+
|
|
1
3
|
/* https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/composeRefs.tsx */
|
|
2
4
|
import React from "react";
|
|
3
5
|
|
|
@@ -27,6 +29,6 @@ export function mergeRefs<T>(refs: PossibleRef<T>[]) {
|
|
|
27
29
|
* @returns React.useCallback(mergeRefs(refs), refs)
|
|
28
30
|
*/
|
|
29
31
|
export function useMergeRefs<T>(...refs: PossibleRef<T>[]) {
|
|
30
|
-
//
|
|
32
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: we want to only update if refs change
|
|
31
33
|
return React.useCallback(mergeRefs(refs), refs);
|
|
32
34
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
|
-
import { useEventCallback } from "../../../util/hooks/useEventCallback";
|
|
5
|
-
import { useLatestRef } from "../../../util/hooks/useLatestRef";
|
|
6
4
|
import { useAnimationsFinished } from "./useAnimationsFinished";
|
|
5
|
+
import { useEventCallback } from "./useEventCallback";
|
|
6
|
+
import { useValueAsRef } from "./useValueAsRef";
|
|
7
7
|
|
|
8
8
|
interface useOpenChangeAnimationCompleteParameters {
|
|
9
9
|
/**
|
|
@@ -44,7 +44,7 @@ export function useOpenChangeAnimationComplete(
|
|
|
44
44
|
onComplete: onCompleteParam,
|
|
45
45
|
} = parameters;
|
|
46
46
|
|
|
47
|
-
const openRef =
|
|
47
|
+
const openRef = useValueAsRef(open);
|
|
48
48
|
const onComplete = useEventCallback(onCompleteParam);
|
|
49
49
|
const runOnceAnimationsFinish = useAnimationsFinished(ref, open);
|
|
50
50
|
|
|
@@ -107,7 +107,6 @@ function preventScrollStandard(referenceElement: Element | null) {
|
|
|
107
107
|
const supportsStableScrollbarGutter =
|
|
108
108
|
typeof CSS !== "undefined" &&
|
|
109
109
|
CSS.supports?.("scrollbar-gutter", "stable");
|
|
110
|
-
|
|
111
110
|
/*
|
|
112
111
|
* DOM writes:
|
|
113
112
|
* Do not read the DOM past this point!
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
4
|
import ReactDOM from "react-dom";
|
|
5
|
-
import { useClientLayoutEffect } from "
|
|
5
|
+
import { useClientLayoutEffect } from "./useClientLayoutEffect";
|
|
6
6
|
|
|
7
7
|
type TransitionStatus = "entering" | "exiting" | "idle" | undefined;
|
|
8
8
|
|
|
@@ -141,5 +141,17 @@ function useTransitionStatus(
|
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Creates a single data attribute with optional suffix
|
|
146
|
+
* (e.g., data-entering-style, data-exiting-style, data-idle-style)
|
|
147
|
+
*/
|
|
148
|
+
function createTransitionStatusAttribute(value?: string): Record<string, true> {
|
|
149
|
+
if (!value) {
|
|
150
|
+
return {};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return { [`data-${value}-style`]: true };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { useTransitionStatus, createTransitionStatusAttribute };
|
|
145
157
|
export type { TransitionStatus };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { useClientLayoutEffect } from "./useClientLayoutEffect";
|
|
4
4
|
import { useRefWithInit } from "./useRefWithInit";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function useValueAsRef<T>(value: T) {
|
|
7
7
|
const latest = useRefWithInit(createLatestRef, value).current!;
|
|
8
8
|
|
|
9
9
|
latest.next = value;
|
|
@@ -24,3 +24,5 @@ function createLatestRef<T>(value: T) {
|
|
|
24
24
|
};
|
|
25
25
|
return latest;
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
export { useValueAsRef };
|
|
@@ -9,7 +9,7 @@ import { ArrowRightIcon } from "@navikt/aksel-icons";
|
|
|
9
9
|
import { Slot } from "../../slot/Slot";
|
|
10
10
|
import { useRenameCSS } from "../../theme/Theme";
|
|
11
11
|
import { composeEventHandlers } from "../composeEventHandlers";
|
|
12
|
-
import {
|
|
12
|
+
import { createStrictContext } from "../create-strict-context";
|
|
13
13
|
import { useMergeRefs } from "../hooks/useMergeRefs";
|
|
14
14
|
import { ownerWindow } from "../owner";
|
|
15
15
|
import { AsChildProps } from "../types";
|
|
@@ -18,10 +18,12 @@ type LinkAnchorOverlayContextProps = {
|
|
|
18
18
|
anchorRef: React.RefObject<HTMLAnchorElement | null>;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const {
|
|
22
|
+
Provider: LinkAnchorContextProvider,
|
|
23
|
+
useContext: useLinkAnchorContext,
|
|
24
|
+
} = createStrictContext<LinkAnchorOverlayContextProps>({
|
|
25
|
+
name: "LinkAnchorOverlayContext",
|
|
26
|
+
});
|
|
25
27
|
|
|
26
28
|
type LinkAnchorOverlayProps = HTMLAttributes<HTMLDivElement> & AsChildProps;
|
|
27
29
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If the provided argument is a ref object, returns its `current` value.
|
|
3
|
+
* Otherwise, returns the argument itself.
|
|
4
|
+
*
|
|
5
|
+
* Non-generic to safely handle refs whose `.current` may be `null`.
|
|
6
|
+
*/
|
|
7
|
+
function resolveRef(
|
|
8
|
+
maybeRef:
|
|
9
|
+
| HTMLElement
|
|
10
|
+
| React.RefObject<HTMLElement | null | undefined>
|
|
11
|
+
| null,
|
|
12
|
+
): HTMLElement | null | undefined {
|
|
13
|
+
if (maybeRef === null) {
|
|
14
|
+
return maybeRef;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return "current" in maybeRef ? maybeRef.current : maybeRef;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { resolveRef };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { createStrictContext } from "../create-strict-context";
|
|
3
3
|
import { createDescendantContext } from "../hooks/descendants/useDescendant";
|
|
4
4
|
import { SlottedDivElementRef } from "./SlottedDivElement";
|
|
5
5
|
|
|
@@ -16,12 +16,14 @@ export const [
|
|
|
16
16
|
}
|
|
17
17
|
>();
|
|
18
18
|
|
|
19
|
-
export const
|
|
20
|
-
VirtualFocusInternalContextProvider,
|
|
21
|
-
useVirtualFocusInternalContext,
|
|
22
|
-
|
|
19
|
+
export const {
|
|
20
|
+
Provider: VirtualFocusInternalContextProvider,
|
|
21
|
+
useContext: useVirtualFocusInternalContext,
|
|
22
|
+
} = createStrictContext<{
|
|
23
23
|
virtualFocusIdx: number;
|
|
24
24
|
setVirtualFocusIdx: Dispatch<SetStateAction<number>>;
|
|
25
25
|
loop: boolean;
|
|
26
26
|
uniqueId: string;
|
|
27
|
-
}>(
|
|
27
|
+
}>({
|
|
28
|
+
name: "VirtualFocusInternalContext",
|
|
29
|
+
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RandomIcon.js","sourceRoot":"","sources":["../../../src/link/stories/RandomIcon.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,8DAAgD;AAEhD,4CAA4C;AAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAEzD,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7D,OAAO,8BAAC,IAAI,OAAG,CAAC;AAClB,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnimationsFinished.js","sourceRoot":"","sources":["../../../../src/overlays/overlay/hooks/useAnimationsFinished.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+Bb,sDAqFC;AAlHD,+CAAsD;AACtD,0DAAiC;AACjC,2EAAwE;AAExE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,qBAAqB,CACnC,YAAsE,EACtE,eAAe,GAAG,KAAK;IAEvB,MAAM,YAAY,GAAG,eAAK,CAAC,MAAM,CAAgB,IAAI,CAAC,CAAC;IACvD,MAAM,cAAc,GAAG,eAAK,CAAC,MAAM,CAAgB,IAAI,CAAC,CAAC;IAEzD,MAAM,eAAe,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QACvC,KAAK,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,EAAE,CAAC;YACjD,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;gBACzB,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAClC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,qBAAqB;IACrB,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE,CAAC,eAAe,EAAE,CAAC;IACjC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAEtB,OAAO,IAAA,mCAAgB,EACrB;IACE;;OAEG;IACH,WAAuB;IACvB;;;;OAIG;IACH,SAA6B,IAAI,EACjC,EAAE;QACF,6FAA6F;QAC7F,eAAe,EAAE,CAAC;QAElB,IAAI,YAAY,IAAI,IAAI,EAAE,CAAC;YACzB,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GACX,SAAS,IAAI,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC;QAClE,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,4EAA4E;QAC5E,IACE,OAAO,OAAO,CAAC,aAAa,KAAK,UAAU;YAC3C,2BAA2B;YAC1B,UAAkB,CAAC,yBAAyB,EAC7C,CAAC;YACD,WAAW,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QAED,YAAY,CAAC,OAAO,GAAG,qBAAqB,CAAC,GAAG,EAAE;YAChD,SAAS,IAAI;gBACX,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,OAAO;gBACT,CAAC;gBACD,2EAA2E;gBAC3E,0EAA0E;gBAC1E,OAAO,CAAC,UAAU,CAChB,OAAO,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CACrD,CAAC,IAAI,CAAC,GAAG,EAAE;oBACV,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO;wBAAE,OAAO;oBAC5B,0EAA0E;oBAC1E,yDAAyD;oBACzD,+CAA+C;oBAC/C,mBAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;gBAClC,CAAC,CAAC,CAAC;YACL,CAAC;YAED,2EAA2E;YAC3E,2DAA2D;YAC3D,IAAI,eAAe,EAAE,CAAC;gBACpB,cAAc,CAAC,OAAO,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;YACvD,CAAC;iBAAM,CAAC;gBACN,IAAI,EAAE,CAAC;YACT,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOpenChangeAnimationComplete.js","sourceRoot":"","sources":["../../../../src/overlays/overlay/hooks/useOpenChangeAnimationComplete.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAoCb,wEA6BC;AA/DD,iCAAyC;AACzC,2EAAwE;AACxE,mEAAgE;AAChE,mEAAgE;AAyBhE;;;;;GAKG;AACH,SAAgB,8BAA8B,CAC5C,UAAoD;IAEpD,MAAM,EACJ,OAAO,GAAG,IAAI,EACd,IAAI,EACJ,GAAG,GAAG,IAAI,EACV,UAAU,EAAE,eAAe,GAC5B,GAAG,UAAU,CAAC;IAEf,MAAM,OAAO,GAAG,IAAA,2BAAY,EAAC,IAAI,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,IAAA,mCAAgB,EAAC,eAAe,CAAC,CAAC;IACrD,MAAM,uBAAuB,GAAG,IAAA,6CAAqB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEjE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QAED;;;WAGG;QACH,uBAAuB,CAAC,GAAG,EAAE;YAC3B,IAAI,IAAI,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC7B,UAAU,EAAE,CAAC;YACf,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,uBAAuB,EAAE,OAAO,CAAC,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTransitionStatus.js","sourceRoot":"","sources":["../../../../src/overlays/overlay/hooks/useTransitionStatus.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;AA+IJ,kDAAmB;AA7I5B,iCAA0C;AAC1C,0DAAiC;AACjC,wCAAsD;AAItD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAS,mBAAmB,CAC1B,IAAa,EACb,kBAA2B,KAAK,EAChC,oBAA6B,KAAK;IAElC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,EACtD,IAAI,IAAI,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAC7C,CAAC;IAEF,6EAA6E;IAC7E,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACrB,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAED,0DAA0D;IAC1D,IACE,CAAC,IAAI;QACL,OAAO;QACP,gBAAgB,KAAK,SAAS;QAC9B,CAAC,iBAAiB,EAClB,CAAC;QACD,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,0EAA0E;IAC1E,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACxD,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,uFAAuF;IACvF,IAAA,4BAAqB,EAAC,GAAG,EAAE;QACzB,IACE,CAAC,IAAI;YACL,OAAO;YACP,gBAAgB,KAAK,SAAS;YAC9B,iBAAiB,EACjB,CAAC;YACD,MAAM,KAAK,GAAG,qBAAqB,CAAC,GAAG,EAAE;gBACvC,mBAAmB,CAAC,SAAS,CAAC,CAAC;YACjC,CAAC,CAAC,CAAC;YAEH,OAAO,GAAG,EAAE;gBACV,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEzD,qFAAqF;IACrF,IAAA,4BAAqB,EAAC,GAAG,EAAE;QACzB,IAAI,CAAC,IAAI,IAAI,eAAe,EAAE,CAAC;YAC7B,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,KAAK,GAAG,qBAAqB,CAAC,GAAG,EAAE;YACvC,mBAAQ,CAAC,SAAS,CAAC,GAAG,EAAE;gBACtB,mBAAmB,CAAC,SAAS,CAAC,CAAC;YACjC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC;IAE5B,IAAA,4BAAqB,EAAC,GAAG,EAAE;QACzB,IAAI,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAC9B,OAAO,SAAS,CAAC;QACnB,CAAC;QAED;;;WAGG;QACH,IAAI,IAAI,IAAI,OAAO,IAAI,gBAAgB,KAAK,MAAM,EAAE,CAAC;YACnD,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAClC,CAAC;QAED;;;;WAIG;QACH,MAAM,KAAK,GAAG,qBAAqB,CAAC,GAAG,EAAE;YACvC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE5E,OAAO,IAAA,eAAO,EACZ,GAAG,EAAE,CAAC,CAAC;QACL,OAAO;QACP,UAAU;QACV,gBAAgB;KACjB,CAAC,EACF,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom createContext to consolidate context-implementation across the system
|
|
3
|
-
* Inspired by:
|
|
4
|
-
* - https://github.com/radix-ui/primitives/blob/main/packages/react/context/src/createContext.tsx
|
|
5
|
-
* - https://github.com/chakra-ui/chakra-ui/blob/5ec0be610b5a69afba01a9c22365155c1b519136/packages/hooks/context/src/index.ts
|
|
6
|
-
*/
|
|
7
|
-
import React from "react";
|
|
8
|
-
export interface CreateContextOptions<T> {
|
|
9
|
-
hookName?: string;
|
|
10
|
-
providerName?: string;
|
|
11
|
-
errorMessage?: string;
|
|
12
|
-
name?: string;
|
|
13
|
-
defaultValue?: T;
|
|
14
|
-
}
|
|
15
|
-
type ProviderProps<T> = T & {
|
|
16
|
-
children: React.ReactNode;
|
|
17
|
-
};
|
|
18
|
-
export declare function createContext<T>(options?: CreateContextOptions<T>): readonly [React.ForwardRefExoticComponent<React.PropsWithoutRef<ProviderProps<T>> & React.RefAttributes<unknown>>, <S extends boolean = true>(strict?: S) => Context<S, T>];
|
|
19
|
-
type Context<S, T> = S extends true ? T : T | undefined;
|
|
20
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-context.js","sourceRoot":"","sources":["../../src/util/create-context.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,sCAkDC;AA5ED;;;;;GAKG;AACH,+CAIe;AAYf,SAAS,eAAe,CAAC,IAAY,EAAE,QAAgB;IACrD,OAAO,GAAG,IAAI,sEAAsE,QAAQ,EAAE,CAAC;AACjG,CAAC;AAED,SAAgB,aAAa,CAAI,UAAmC,EAAE;IACpE,MAAM,EACJ,IAAI,EACJ,QAAQ,GAAG,YAAY,EACvB,YAAY,GAAG,UAAU,EACzB,YAAY,EACZ,YAAY,GACb,GAAG,OAAO,CAAC;IAEZ,MAAM,OAAO,GAAG,IAAA,qBAAkB,EAAgB,YAAY,CAAC,CAAC;IAEhE;;;OAGG;IACH,MAAM,QAAQ,GAAG,IAAA,kBAAU,EACzB,CAAC,EAAwB,EAAE,GAAG,EAAE,EAAE;QAChC,0CAA0C;YAD3C,EAAE,QAAQ,OAAc,EAAT,OAAO,cAAtB,YAAwB,CAAF;QAGrB,6GAA6G;QAC7G,MAAM,KAAK,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAM,CAAC,CAAC,kDAAkD;QAE3H,OAAO,CACL,8BAAC,OAAO,CAAC,QAAQ,IAAC,KAAK,EAAE,GAAG,CAAC,CAAC,iCAAM,KAAK,KAAE,GAAG,IAAG,CAAC,CAAC,KAAK,IACrD,QAAQ,CACQ,CACpB,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,SAAS,UAAU,CACjB,SAAY,IAAS;;QAErB,MAAM,OAAO,GAAG,IAAA,kBAAe,EAAC,OAAO,CAAC,CAAC;QAEzC,IAAI,CAAC,OAAO,IAAI,MAAM,EAAE,CAAC;YACvB,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,CACxD,CAAC;YACF,KAAK,CAAC,IAAI,GAAG,cAAc,CAAC;YAC5B,MAAA,KAAK,CAAC,iBAAiB,sDAAG,KAAK,EAAE,UAAU,CAAC,CAAC;YAC7C,MAAM,KAAK,CAAC;QACd,CAAC;QAED,OAAO,OAAwB,CAAC;IAClC,CAAC;IAED,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAE3B,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAU,CAAC;AACzC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
3
|
-
* prop or avoid re-executing effects when passed as a dependency
|
|
4
|
-
* https://github.com/radix-ui/primitives/blob/main/packages/react/use-callback-ref/src/useCallbackRef.tsx
|
|
5
|
-
*/
|
|
6
|
-
export declare function useCallbackRef<T extends (...args: any[]) => any>(callback: T | undefined, deps?: React.DependencyList): T;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useCallbackRef = useCallbackRef;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
7
|
-
* prop or avoid re-executing effects when passed as a dependency
|
|
8
|
-
* https://github.com/radix-ui/primitives/blob/main/packages/react/use-callback-ref/src/useCallbackRef.tsx
|
|
9
|
-
*/
|
|
10
|
-
function useCallbackRef(callback, deps = []) {
|
|
11
|
-
const callbackRef = (0, react_1.useRef)(callback);
|
|
12
|
-
(0, react_1.useEffect)(() => {
|
|
13
|
-
callbackRef.current = callback;
|
|
14
|
-
});
|
|
15
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
-
return (0, react_1.useCallback)(((...args) => { var _a; return (_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, ...args); }), deps);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=useCallbackRef.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCallbackRef.js","sourceRoot":"","sources":["../../../src/util/hooks/useCallbackRef.ts"],"names":[],"mappings":";;AAOA,wCAYC;AAnBD,iCAAuD;AAEvD;;;;GAIG;AACH,SAAgB,cAAc,CAC5B,QAAuB,EACvB,OAA6B,EAAE;IAE/B,MAAM,WAAW,GAAG,IAAA,cAAM,EAAC,QAAQ,CAAC,CAAC;IAErC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,uDAAuD;IACvD,OAAO,IAAA,mBAAW,EAAC,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,WAAC,OAAA,MAAA,WAAW,CAAC,OAAO,4DAAG,GAAG,IAAI,CAAC,CAAA,EAAA,CAAM,EAAE,IAAI,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLatestRef.js","sourceRoot":"","sources":["../../../src/util/hooks/useLatestRef.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAKb,oCASC;AAZD,mEAAgE;AAChE,qDAAkD;AAElD,SAAgB,YAAY,CAAI,KAAQ;IACtC,MAAM,MAAM,GAAG,IAAA,+BAAc,EAAC,eAAe,EAAE,KAAK,CAAC,CAAC,OAAQ,CAAC;IAE/D,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC;IAEpB,uDAAuD;IACvD,IAAA,6CAAqB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,eAAe,CAAI,KAAQ;IAClC,MAAM,MAAM,GAAG;QACb,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,GAAG,EAAE;YACX,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC;QAC/B,CAAC;KACF,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|