@digdir/designsystemet-react 1.0.0-next.15 → 1.0.0-next.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Accordion/index.js +2 -2
- package/dist/cjs/components/Breadcrumbs/BreadcrumbsItem.js +11 -0
- package/dist/cjs/components/Breadcrumbs/BreadcrumbsLink.js +12 -0
- package/dist/cjs/components/Breadcrumbs/BreadcrumbsList.js +23 -0
- package/dist/cjs/components/Breadcrumbs/BreadcrumbsNav.js +11 -0
- package/dist/cjs/components/Breadcrumbs/BreadcrumbsRoot.js +11 -0
- package/dist/cjs/components/Breadcrumbs/index.js +43 -0
- package/dist/cjs/components/Divider/Divider.js +3 -4
- package/dist/cjs/components/DropdownMenu/DropdownMenuContent.js +2 -2
- package/dist/cjs/components/Modal/ModalDialog.js +1 -2
- package/dist/cjs/components/Modal/ModalHeader.js +2 -2
- package/dist/cjs/components/Modal/index.js +1 -0
- package/dist/cjs/components/Popover/PopoverContent.js +3 -4
- package/dist/cjs/components/Tabs/TabList.js +1 -1
- package/dist/cjs/components/ToggleGroup/ToggleGroupRoot.js +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +3 -4
- package/dist/cjs/components/form/Checkbox/{Group/Group.js → CheckboxGroup.js} +3 -2
- package/dist/cjs/components/form/Checkbox/index.js +3 -3
- package/dist/cjs/components/form/Checkbox/useCheckbox.js +2 -2
- package/dist/cjs/components/form/Combobox/Combobox.js +2 -2
- package/dist/cjs/components/form/Combobox/Option/Description.js +1 -2
- package/dist/cjs/components/form/Combobox/internal/ComboboxChips.js +1 -2
- package/dist/cjs/components/form/Combobox/internal/ComboboxClearButton.js +1 -2
- package/dist/cjs/components/form/Combobox/internal/ComboboxError.js +1 -2
- package/dist/cjs/components/form/Combobox/internal/ComboboxInput.js +5 -6
- package/dist/cjs/components/form/Combobox/internal/ComboboxLabel.js +1 -2
- package/dist/cjs/components/form/Combobox/internal/ComboboxNative.js +1 -2
- package/dist/cjs/components/form/Combobox/useCombobox.js +5 -0
- package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +4 -4
- package/dist/cjs/components/form/NativeSelect/NativeSelect.js +2 -2
- package/dist/cjs/components/form/NativeSelect/useNativeSelect.js +19 -1
- package/dist/cjs/components/form/Radio/{Group/Group.js → RadioGroup.js} +3 -3
- package/dist/cjs/components/form/Radio/index.js +3 -3
- package/dist/cjs/components/form/Radio/useRadio.js +2 -2
- package/dist/cjs/components/form/Switch/useSwitch.js +2 -2
- package/dist/cjs/index.js +50 -36
- package/dist/cjs/node_modules/@floating-ui/core/dist/floating-ui.core.js +23 -9
- package/dist/cjs/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +39 -24
- package/dist/cjs/node_modules/@floating-ui/react/dist/floating-ui.react.js +848 -729
- package/dist/cjs/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +1 -1
- package/dist/cjs/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +68 -0
- package/dist/cjs/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +11 -0
- package/dist/cjs/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +97 -45
- package/dist/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +17 -6
- package/dist/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +14 -5
- package/dist/cjs/node_modules/@radix-ui/react-compose-refs/dist/index.js +10 -14
- package/dist/cjs/node_modules/@radix-ui/react-slot/dist/index.js +88 -69
- package/dist/cjs/node_modules/@tanstack/virtual-core/dist/esm/index.js +134 -62
- package/dist/cjs/node_modules/@tanstack/virtual-core/dist/esm/utils.js +3 -5
- package/dist/cjs/utilities/AnimateHeight/AnimateHeight.js +4 -1
- package/dist/cjs/utilities/RovingFocus/RovingFocusItem.js +34 -6
- package/dist/cjs/utilities/RovingFocus/RovingFocusRoot.js +3 -1
- package/dist/cjs/utilities/RovingFocus/useRovingFocus.js +2 -1
- package/dist/esm/components/Accordion/index.js +2 -2
- package/dist/esm/components/Box/Box.js +2 -2
- package/dist/esm/components/Breadcrumbs/BreadcrumbsItem.js +9 -0
- package/dist/esm/components/Breadcrumbs/BreadcrumbsLink.js +10 -0
- package/dist/esm/components/Breadcrumbs/BreadcrumbsList.js +21 -0
- package/dist/esm/components/Breadcrumbs/BreadcrumbsNav.js +9 -0
- package/dist/esm/components/Breadcrumbs/BreadcrumbsRoot.js +9 -0
- package/dist/esm/components/Breadcrumbs/index.js +36 -0
- package/dist/esm/components/Button/Button.js +2 -2
- package/dist/esm/components/Card/Card.js +2 -2
- package/dist/esm/components/Card/CardContent.js +2 -2
- package/dist/esm/components/Card/CardFooter.js +2 -2
- package/dist/esm/components/Card/CardHeader.js +2 -2
- package/dist/esm/components/Card/CardMedia.js +2 -2
- package/dist/esm/components/Divider/Divider.js +3 -4
- package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +2 -2
- package/dist/esm/components/DropdownMenu/DropdownMenuTrigger.js +2 -2
- package/dist/esm/components/ErrorSummary/ErrorSummaryRoot.js +2 -2
- package/dist/esm/components/Link/Link.js +2 -2
- package/dist/esm/components/List/ListItem.js +2 -2
- package/dist/esm/components/List/ListRoot.js +2 -2
- package/dist/esm/components/List/Lists.js +3 -3
- package/dist/esm/components/Modal/ModaContent.js +2 -2
- package/dist/esm/components/Modal/ModalDialog.js +5 -6
- package/dist/esm/components/Modal/ModalFooter.js +2 -2
- package/dist/esm/components/Modal/ModalHeader.js +4 -4
- package/dist/esm/components/Modal/ModalTrigger.js +2 -2
- package/dist/esm/components/Modal/index.js +1 -1
- package/dist/esm/components/Pagination/PaginationContent.js +2 -2
- package/dist/esm/components/Pagination/PaginationItem.js +2 -2
- package/dist/esm/components/Pagination/PaginationRoot.js +2 -2
- package/dist/esm/components/Popover/PopoverContent.js +2 -3
- package/dist/esm/components/Popover/PopoverTrigger.js +2 -2
- package/dist/esm/components/Tabs/TabList.js +1 -1
- package/dist/esm/components/ToggleGroup/ToggleGroupRoot.js +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +2 -3
- package/dist/esm/components/Typography/ErrorMessage/ErrorMessage.js +2 -2
- package/dist/esm/components/Typography/Heading/Heading.js +2 -2
- package/dist/esm/components/Typography/Ingress/Ingress.js +2 -2
- package/dist/esm/components/Typography/Label/Label.js +2 -2
- package/dist/esm/components/Typography/Paragraph/Paragraph.js +2 -2
- package/dist/esm/components/form/Checkbox/{Group/Group.js → CheckboxGroup.js} +3 -2
- package/dist/esm/components/form/Checkbox/index.js +1 -1
- package/dist/esm/components/form/Checkbox/useCheckbox.js +1 -1
- package/dist/esm/components/form/Combobox/Combobox.js +2 -2
- package/dist/esm/components/form/Combobox/Custom.js +2 -2
- package/dist/esm/components/form/Combobox/Option/Description.js +1 -2
- package/dist/esm/components/form/Combobox/internal/ComboboxChips.js +1 -2
- package/dist/esm/components/form/Combobox/internal/ComboboxClearButton.js +1 -2
- package/dist/esm/components/form/Combobox/internal/ComboboxError.js +1 -2
- package/dist/esm/components/form/Combobox/internal/ComboboxInput.js +5 -6
- package/dist/esm/components/form/Combobox/internal/ComboboxLabel.js +1 -2
- package/dist/esm/components/form/Combobox/internal/ComboboxNative.js +1 -2
- package/dist/esm/components/form/Combobox/useCombobox.js +5 -0
- package/dist/esm/components/form/Combobox/useFloatingCombobox.js +2 -2
- package/dist/esm/components/form/NativeSelect/NativeSelect.js +2 -2
- package/dist/esm/components/form/NativeSelect/useNativeSelect.js +19 -1
- package/dist/esm/components/form/Radio/{Group/Group.js → RadioGroup.js} +3 -3
- package/dist/esm/components/form/Radio/index.js +1 -1
- package/dist/esm/components/form/Radio/useRadio.js +1 -1
- package/dist/esm/components/form/Switch/useSwitch.js +1 -1
- package/dist/esm/index.js +9 -2
- package/dist/esm/node_modules/@floating-ui/core/dist/floating-ui.core.js +24 -10
- package/dist/esm/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +41 -26
- package/dist/esm/node_modules/@floating-ui/react/dist/floating-ui.react.js +830 -712
- package/dist/esm/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +1 -1
- package/dist/esm/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +57 -0
- package/dist/esm/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +9 -0
- package/dist/esm/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +96 -45
- package/dist/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +17 -7
- package/dist/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +14 -5
- package/dist/esm/node_modules/@radix-ui/react-compose-refs/dist/index.js +10 -14
- package/dist/esm/node_modules/@radix-ui/react-slot/dist/index.js +71 -71
- package/dist/esm/node_modules/@tanstack/virtual-core/dist/esm/index.js +134 -62
- package/dist/esm/node_modules/@tanstack/virtual-core/dist/esm/utils.js +3 -5
- package/dist/esm/utilities/AnimateHeight/AnimateHeight.js +4 -1
- package/dist/esm/utilities/RovingFocus/RovingFocusItem.js +36 -8
- package/dist/esm/utilities/RovingFocus/RovingFocusRoot.js +5 -3
- package/dist/esm/utilities/RovingFocus/useRovingFocus.js +2 -1
- package/dist/types/components/Accordion/AccordionHeading.d.ts +1 -1
- package/dist/types/components/Accordion/AccordionHeading.d.ts.map +1 -1
- package/dist/types/components/Accordion/AccordionItem.d.ts +2 -2
- package/dist/types/components/Accordion/AccordionItem.d.ts.map +1 -1
- package/dist/types/components/Accordion/AccordionRoot.d.ts +2 -2
- package/dist/types/components/Accordion/AccordionRoot.d.ts.map +1 -1
- package/dist/types/components/Accordion/index.d.ts +2 -2
- package/dist/types/components/Accordion/index.d.ts.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +3 -3
- package/dist/types/components/Alert/Alert.d.ts.map +1 -1
- package/dist/types/components/Badge/Badge.d.ts +93 -0
- package/dist/types/components/Badge/Badge.d.ts.map +1 -0
- package/dist/types/components/Badge/index.d.ts +3 -0
- package/dist/types/components/Badge/index.d.ts.map +1 -0
- package/dist/types/components/Box/Box.d.ts +5 -5
- package/dist/types/components/Box/Box.d.ts.map +1 -1
- package/dist/types/components/Breadcrumbs/BreadcrumbsItem.d.ts +4 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsItem.d.ts.map +1 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsLink.d.ts +10 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsLink.d.ts.map +1 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsList.d.ts +4 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsList.d.ts.map +1 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsNav.d.ts +14 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsNav.d.ts.map +1 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsRoot.d.ts +16 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsRoot.d.ts.map +1 -0
- package/dist/types/components/Breadcrumbs/index.d.ts +44 -0
- package/dist/types/components/Breadcrumbs/index.d.ts.map +1 -0
- package/dist/types/components/Button/Button.d.ts +6 -6
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Card/Card.d.ts +3 -3
- package/dist/types/components/Card/Card.d.ts.map +1 -1
- package/dist/types/components/Card/CardContent.d.ts +1 -1
- package/dist/types/components/Card/CardContent.d.ts.map +1 -1
- package/dist/types/components/Card/CardFooter.d.ts +1 -1
- package/dist/types/components/Card/CardFooter.d.ts.map +1 -1
- package/dist/types/components/Card/CardHeader.d.ts +1 -1
- package/dist/types/components/Card/CardHeader.d.ts.map +1 -1
- package/dist/types/components/Card/CardMedia.d.ts +1 -1
- package/dist/types/components/Card/CardMedia.d.ts.map +1 -1
- package/dist/types/components/Card/index.d.ts.map +1 -1
- package/dist/types/components/Chip/Group/Group.d.ts +1 -1
- package/dist/types/components/Chip/Removable/Removable.d.ts +1 -1
- package/dist/types/components/Chip/Toggle/Toggle.d.ts +3 -3
- package/dist/types/components/Chip/Toggle/Toggle.d.ts.map +1 -1
- package/dist/types/components/Divider/Divider.d.ts +1 -1
- package/dist/types/components/Divider/Divider.d.ts.map +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuContent.d.ts.map +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuGroup.d.ts.map +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts +7 -7
- package/dist/types/components/DropdownMenu/index.d.ts.map +1 -1
- package/dist/types/components/ErrorSummary/ErrorSummaryRoot.d.ts +1 -1
- package/dist/types/components/ErrorSummary/index.d.ts.map +1 -1
- package/dist/types/components/Link/Link.d.ts +4 -4
- package/dist/types/components/Link/Link.d.ts.map +1 -1
- package/dist/types/components/List/ListHeading.d.ts +4 -4
- package/dist/types/components/List/ListItem.d.ts +1 -1
- package/dist/types/components/List/ListItem.d.ts.map +1 -1
- package/dist/types/components/List/ListRoot.d.ts +2 -2
- package/dist/types/components/List/ListRoot.d.ts.map +1 -1
- package/dist/types/components/List/Lists.d.ts +2 -2
- package/dist/types/components/List/Lists.d.ts.map +1 -1
- package/dist/types/components/Modal/ModaContent.d.ts +1 -1
- package/dist/types/components/Modal/ModaContent.d.ts.map +1 -1
- package/dist/types/components/Modal/ModalDialog.d.ts +4 -4
- package/dist/types/components/Modal/ModalDialog.d.ts.map +1 -1
- package/dist/types/components/Modal/ModalFooter.d.ts +1 -1
- package/dist/types/components/Modal/ModalFooter.d.ts.map +1 -1
- package/dist/types/components/Modal/ModalHeader.d.ts +19 -3
- package/dist/types/components/Modal/ModalHeader.d.ts.map +1 -1
- package/dist/types/components/Modal/ModalTrigger.d.ts +7 -7
- package/dist/types/components/Modal/index.d.ts +1 -1
- package/dist/types/components/Modal/index.d.ts.map +1 -1
- package/dist/types/components/Modal/useModalState.d.ts.map +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +4 -4
- package/dist/types/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationButton.d.ts +1 -1
- package/dist/types/components/Pagination/PaginationButton.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationContent.d.ts +1 -1
- package/dist/types/components/Pagination/PaginationContent.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationItem.d.ts +1 -1
- package/dist/types/components/Pagination/PaginationItem.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationNextPrev.d.ts +2 -2
- package/dist/types/components/Pagination/PaginationRoot.d.ts +3 -3
- package/dist/types/components/Pagination/PaginationRoot.d.ts.map +1 -1
- package/dist/types/components/Pagination/index.d.ts.map +1 -1
- package/dist/types/components/Popover/PopoverContent.d.ts.map +1 -1
- package/dist/types/components/Popover/PopoverRoot.d.ts +10 -10
- package/dist/types/components/Popover/PopoverRoot.d.ts.map +1 -1
- package/dist/types/components/Popover/PopoverTrigger.d.ts +7 -7
- package/dist/types/components/Popover/index.d.ts.map +1 -1
- package/dist/types/components/SkipLink/SkipLink.d.ts.map +1 -1
- package/dist/types/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/types/components/Table/Table.d.ts +4 -4
- package/dist/types/components/Table/Table.d.ts.map +1 -1
- package/dist/types/components/Table/TableHeaderCell.d.ts +3 -3
- package/dist/types/components/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/types/components/Table/index.d.ts.map +1 -1
- package/dist/types/components/Tabs/TabList.d.ts.map +1 -1
- package/dist/types/components/Tabs/TabsRoot.d.ts +4 -4
- package/dist/types/components/Tabs/TabsRoot.d.ts.map +1 -1
- package/dist/types/components/Tag/Tag.d.ts +1 -1
- package/dist/types/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.d.ts +1 -1
- package/dist/types/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.d.ts.map +1 -1
- package/dist/types/components/ToggleGroup/ToggleGroupRoot.d.ts +5 -5
- package/dist/types/components/ToggleGroup/ToggleGroupRoot.d.ts.map +1 -1
- package/dist/types/components/ToggleGroup/index.d.ts.map +1 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +4 -4
- package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/components/Typography/ErrorMessage/ErrorMessage.d.ts +4 -4
- package/dist/types/components/Typography/ErrorMessage/ErrorMessage.d.ts.map +1 -1
- package/dist/types/components/Typography/Heading/Heading.d.ts +4 -4
- package/dist/types/components/Typography/Heading/Heading.d.ts.map +1 -1
- package/dist/types/components/Typography/Ingress/Ingress.d.ts +3 -3
- package/dist/types/components/Typography/Ingress/Ingress.d.ts.map +1 -1
- package/dist/types/components/Typography/Label/Label.d.ts +4 -4
- package/dist/types/components/Typography/Label/Label.d.ts.map +1 -1
- package/dist/types/components/Typography/Paragraph/Paragraph.d.ts +4 -4
- package/dist/types/components/Typography/Paragraph/Paragraph.d.ts.map +1 -1
- package/dist/types/components/form/CharacterCounter.d.ts.map +1 -1
- package/dist/types/components/form/Checkbox/Checkbox.d.ts +1 -1
- package/dist/types/components/form/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/types/components/form/Checkbox/{Group/Group.d.ts → CheckboxGroup.d.ts} +5 -5
- package/dist/types/components/form/Checkbox/CheckboxGroup.d.ts.map +1 -0
- package/dist/types/components/form/Checkbox/index.d.ts +2 -2
- package/dist/types/components/form/Checkbox/index.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Combobox.d.ts +42 -42
- package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/ComboboxIdContext.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Empty.d.ts +1 -1
- package/dist/types/components/form/Combobox/Empty.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Option/Option.d.ts +2 -2
- package/dist/types/components/form/Combobox/Option/Option.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts +1 -1
- package/dist/types/components/form/Combobox/index.d.ts +3 -0
- package/dist/types/components/form/Combobox/index.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/useCombobox.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/useFloatingCombobox.d.ts +9 -9
- package/dist/types/components/form/Fieldset/Fieldset.d.ts +3 -3
- package/dist/types/components/form/Fieldset/Fieldset.d.ts.map +1 -1
- package/dist/types/components/form/Fieldset/useFieldset.d.ts +2 -2
- package/dist/types/components/form/NativeSelect/NativeSelect.d.ts +6 -6
- package/dist/types/components/form/NativeSelect/NativeSelect.d.ts.map +1 -1
- package/dist/types/components/form/NativeSelect/useNativeSelect.d.ts +1 -1
- package/dist/types/components/form/NativeSelect/useNativeSelect.d.ts.map +1 -1
- package/dist/types/components/form/Radio/{Group/Group.d.ts → RadioGroup.d.ts} +7 -7
- package/dist/types/components/form/Radio/RadioGroup.d.ts.map +1 -0
- package/dist/types/components/form/Radio/index.d.ts +2 -2
- package/dist/types/components/form/Radio/index.d.ts.map +1 -1
- package/dist/types/components/form/Radio/useRadio.d.ts.map +1 -1
- package/dist/types/components/form/Search/Search.d.ts +7 -7
- package/dist/types/components/form/Search/Search.d.ts.map +1 -1
- package/dist/types/components/form/Switch/Switch.d.ts +2 -2
- package/dist/types/components/form/Switch/Switch.d.ts.map +1 -1
- package/dist/types/components/form/Textarea/Textarea.d.ts +7 -7
- package/dist/types/components/form/Textarea/Textarea.d.ts.map +1 -1
- package/dist/types/components/form/Textfield/Textfield.d.ts +7 -7
- package/dist/types/components/form/Textfield/Textfield.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/utilities/AnimateHeight/AnimateHeight.d.ts.map +1 -1
- package/dist/types/utilities/RovingFocus/RovingFocusItem.d.ts +2 -2
- package/dist/types/utilities/RovingFocus/RovingFocusItem.d.ts.map +1 -1
- package/dist/types/utilities/RovingFocus/RovingFocusRoot.d.ts +10 -2
- package/dist/types/utilities/RovingFocus/RovingFocusRoot.d.ts.map +1 -1
- package/dist/types/utilities/RovingFocus/useRovingFocus.d.ts +11 -10
- package/dist/types/utilities/RovingFocus/useRovingFocus.d.ts.map +1 -1
- package/package.json +18 -8
- package/dist/cjs/node_modules/@babel/runtime/helpers/esm/extends.js +0 -19
- package/dist/esm/node_modules/@babel/runtime/helpers/esm/extends.js +0 -17
- package/dist/types/components/form/Checkbox/Group/Group.d.ts.map +0 -1
- package/dist/types/components/form/Checkbox/Group/index.d.ts +0 -2
- package/dist/types/components/form/Checkbox/Group/index.d.ts.map +0 -1
- package/dist/types/components/form/Radio/Group/Group.d.ts.map +0 -1
- package/dist/types/components/form/Radio/Group/index.d.ts +0 -2
- package/dist/types/components/form/Radio/Group/index.d.ts.map +0 -1
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var floatingUi_react_utils = require('./floating-ui.react.utils.js');
|
|
6
|
-
var floatingUi_utils = require('
|
|
7
|
-
var
|
|
8
|
-
var floatingUi_utils_dom = require('../../utils/dist/floating-ui.utils.dom.js');
|
|
6
|
+
var floatingUi_utils = require('../node_modules/@floating-ui/utils/dist/floating-ui.utils.js');
|
|
7
|
+
var floatingUi_utils_dom$1 = require('../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js');
|
|
9
8
|
var index_esm = require('../../../tabbable/dist/index.esm.js');
|
|
10
9
|
var ReactDOM = require('react-dom');
|
|
11
|
-
var
|
|
10
|
+
var floatingUi_reactDom = require('../../react-dom/dist/floating-ui.react-dom.js');
|
|
11
|
+
var floatingUi_utils_dom = require('../../utils/dist/floating-ui.utils.dom.js');
|
|
12
12
|
|
|
13
13
|
function _interopNamespaceDefault(e) {
|
|
14
14
|
var n = Object.create(null);
|
|
@@ -28,6 +28,7 @@ function _interopNamespaceDefault(e) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
31
|
+
var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* Merges an array of refs into a single memoized callback ref or `null`.
|
|
@@ -105,14 +106,10 @@ function findNonDisabledIndex(listRef, _temp) {
|
|
|
105
106
|
amount = 1
|
|
106
107
|
} = _temp === void 0 ? {} : _temp;
|
|
107
108
|
const list = listRef.current;
|
|
108
|
-
const isDisabledIndex = disabledIndices ? index => disabledIndices.includes(index) : index => {
|
|
109
|
-
const element = list[index];
|
|
110
|
-
return element == null || element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true';
|
|
111
|
-
};
|
|
112
109
|
let index = startingIndex;
|
|
113
110
|
do {
|
|
114
111
|
index += decrement ? -amount : amount;
|
|
115
|
-
} while (index >= 0 && index <= list.length - 1 &&
|
|
112
|
+
} while (index >= 0 && index <= list.length - 1 && isDisabled(list, index, disabledIndices));
|
|
116
113
|
return index;
|
|
117
114
|
}
|
|
118
115
|
function getGridNavigatedIndex(elementsRef, _ref) {
|
|
@@ -208,8 +205,8 @@ function getGridNavigatedIndex(elementsRef, _ref) {
|
|
|
208
205
|
if (prevIndex % cols !== 0) {
|
|
209
206
|
nextIndex = findNonDisabledIndex(elementsRef, {
|
|
210
207
|
startingIndex: prevIndex,
|
|
211
|
-
|
|
212
|
-
|
|
208
|
+
decrement: true,
|
|
209
|
+
disabledIndices
|
|
213
210
|
});
|
|
214
211
|
if (loop && isDifferentRow(nextIndex, cols, prevRow)) {
|
|
215
212
|
nextIndex = findNonDisabledIndex(elementsRef, {
|
|
@@ -288,13 +285,20 @@ function buildCellMap(sizes, cols, dense) {
|
|
|
288
285
|
function getCellIndexOfCorner(index, sizes, cellMap, cols, corner) {
|
|
289
286
|
if (index === -1) return -1;
|
|
290
287
|
const firstCellIndex = cellMap.indexOf(index);
|
|
288
|
+
const sizeItem = sizes[index];
|
|
291
289
|
switch (corner) {
|
|
292
290
|
case 'tl':
|
|
293
291
|
return firstCellIndex;
|
|
294
292
|
case 'tr':
|
|
295
|
-
|
|
293
|
+
if (!sizeItem) {
|
|
294
|
+
return firstCellIndex;
|
|
295
|
+
}
|
|
296
|
+
return firstCellIndex + sizeItem.width - 1;
|
|
296
297
|
case 'bl':
|
|
297
|
-
|
|
298
|
+
if (!sizeItem) {
|
|
299
|
+
return firstCellIndex;
|
|
300
|
+
}
|
|
301
|
+
return firstCellIndex + (sizeItem.height - 1) * cols;
|
|
298
302
|
case 'br':
|
|
299
303
|
return cellMap.lastIndexOf(index);
|
|
300
304
|
}
|
|
@@ -304,6 +308,13 @@ function getCellIndexOfCorner(index, sizes, cellMap, cols, corner) {
|
|
|
304
308
|
function getCellIndices(indices, cellMap) {
|
|
305
309
|
return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);
|
|
306
310
|
}
|
|
311
|
+
function isDisabled(list, index, disabledIndices) {
|
|
312
|
+
if (disabledIndices) {
|
|
313
|
+
return disabledIndices.includes(index);
|
|
314
|
+
}
|
|
315
|
+
const element = list[index];
|
|
316
|
+
return element == null || element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true';
|
|
317
|
+
}
|
|
307
318
|
|
|
308
319
|
let rafId = 0;
|
|
309
320
|
function enqueueFocus(el, options) {
|
|
@@ -434,6 +445,16 @@ const FloatingArrow = /*#__PURE__*/React__namespace.forwardRef(function Floating
|
|
|
434
445
|
}
|
|
435
446
|
}
|
|
436
447
|
const clipPathId = useId();
|
|
448
|
+
const [isRTL, setIsRTL] = React__namespace.useState(false);
|
|
449
|
+
|
|
450
|
+
// https://github.com/floating-ui/floating-ui/issues/2932
|
|
451
|
+
index(() => {
|
|
452
|
+
if (!floating) return;
|
|
453
|
+
const isRTL = floatingUi_utils_dom$1.getComputedStyle(floating).direction === 'rtl';
|
|
454
|
+
if (isRTL) {
|
|
455
|
+
setIsRTL(true);
|
|
456
|
+
}
|
|
457
|
+
}, [floating]);
|
|
437
458
|
if (!floating) {
|
|
438
459
|
return null;
|
|
439
460
|
}
|
|
@@ -445,7 +466,6 @@ const FloatingArrow = /*#__PURE__*/React__namespace.forwardRef(function Floating
|
|
|
445
466
|
const svgX = width / 2 * (tipRadius / -8 + 1);
|
|
446
467
|
const svgY = height / 2 * tipRadius / 4;
|
|
447
468
|
const [side, alignment] = placement.split('-');
|
|
448
|
-
const isRTL = floatingUi_dom.platform.isRTL(floating);
|
|
449
469
|
const isCustomShape = !!d;
|
|
450
470
|
const isVerticalSide = side === 'top' || side === 'bottom';
|
|
451
471
|
const yOffsetProp = staticOffset && alignment === 'end' ? 'bottom' : 'top';
|
|
@@ -568,11 +588,7 @@ function useHover(context, props) {
|
|
|
568
588
|
onOpenChange,
|
|
569
589
|
dataRef,
|
|
570
590
|
events,
|
|
571
|
-
elements
|
|
572
|
-
domReference,
|
|
573
|
-
floating
|
|
574
|
-
},
|
|
575
|
-
refs
|
|
591
|
+
elements
|
|
576
592
|
} = context;
|
|
577
593
|
const {
|
|
578
594
|
enabled = true,
|
|
@@ -586,10 +602,11 @@ function useHover(context, props) {
|
|
|
586
602
|
const parentId = useFloatingParentNodeId();
|
|
587
603
|
const handleCloseRef = useLatestRef(handleClose);
|
|
588
604
|
const delayRef = useLatestRef(delay);
|
|
605
|
+
const openRef = useLatestRef(open);
|
|
589
606
|
const pointerTypeRef = React__namespace.useRef();
|
|
590
|
-
const timeoutRef = React__namespace.useRef();
|
|
607
|
+
const timeoutRef = React__namespace.useRef(-1);
|
|
591
608
|
const handlerRef = React__namespace.useRef();
|
|
592
|
-
const restTimeoutRef = React__namespace.useRef();
|
|
609
|
+
const restTimeoutRef = React__namespace.useRef(-1);
|
|
593
610
|
const blockMouseMoveRef = React__namespace.useRef(true);
|
|
594
611
|
const performedPointerEventsMutationRef = React__namespace.useRef(false);
|
|
595
612
|
const unbindMouseMoveRef = React__namespace.useRef(() => {});
|
|
@@ -602,9 +619,7 @@ function useHover(context, props) {
|
|
|
602
619
|
// When closing before opening, clear the delay timeouts to cancel it
|
|
603
620
|
// from showing.
|
|
604
621
|
React__namespace.useEffect(() => {
|
|
605
|
-
if (!enabled)
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
622
|
+
if (!enabled) return;
|
|
608
623
|
function onOpenChange(_ref) {
|
|
609
624
|
let {
|
|
610
625
|
open
|
|
@@ -621,20 +636,20 @@ function useHover(context, props) {
|
|
|
621
636
|
};
|
|
622
637
|
}, [enabled, events]);
|
|
623
638
|
React__namespace.useEffect(() => {
|
|
624
|
-
if (!enabled
|
|
625
|
-
|
|
626
|
-
|
|
639
|
+
if (!enabled) return;
|
|
640
|
+
if (!handleCloseRef.current) return;
|
|
641
|
+
if (!open) return;
|
|
627
642
|
function onLeave(event) {
|
|
628
643
|
if (isHoverOpen()) {
|
|
629
644
|
onOpenChange(false, event, 'hover');
|
|
630
645
|
}
|
|
631
646
|
}
|
|
632
|
-
const html = floatingUi_react_utils.getDocument(floating).documentElement;
|
|
647
|
+
const html = floatingUi_react_utils.getDocument(elements.floating).documentElement;
|
|
633
648
|
html.addEventListener('mouseleave', onLeave);
|
|
634
649
|
return () => {
|
|
635
650
|
html.removeEventListener('mouseleave', onLeave);
|
|
636
651
|
};
|
|
637
|
-
}, [floating, open, onOpenChange, enabled, handleCloseRef, isHoverOpen]);
|
|
652
|
+
}, [elements.floating, open, onOpenChange, enabled, handleCloseRef, isHoverOpen]);
|
|
638
653
|
const closeWithDelay = React__namespace.useCallback(function (event, runElseBranch, reason) {
|
|
639
654
|
if (runElseBranch === void 0) {
|
|
640
655
|
runElseBranch = true;
|
|
@@ -645,64 +660,62 @@ function useHover(context, props) {
|
|
|
645
660
|
const closeDelay = getDelay(delayRef.current, 'close', pointerTypeRef.current);
|
|
646
661
|
if (closeDelay && !handlerRef.current) {
|
|
647
662
|
clearTimeout(timeoutRef.current);
|
|
648
|
-
timeoutRef.current = setTimeout(() => onOpenChange(false, event, reason), closeDelay);
|
|
663
|
+
timeoutRef.current = window.setTimeout(() => onOpenChange(false, event, reason), closeDelay);
|
|
649
664
|
} else if (runElseBranch) {
|
|
650
665
|
clearTimeout(timeoutRef.current);
|
|
651
666
|
onOpenChange(false, event, reason);
|
|
652
667
|
}
|
|
653
668
|
}, [delayRef, onOpenChange]);
|
|
654
|
-
const cleanupMouseMoveHandler =
|
|
669
|
+
const cleanupMouseMoveHandler = useEffectEvent(() => {
|
|
655
670
|
unbindMouseMoveRef.current();
|
|
656
671
|
handlerRef.current = undefined;
|
|
657
|
-
}
|
|
658
|
-
const clearPointerEvents =
|
|
672
|
+
});
|
|
673
|
+
const clearPointerEvents = useEffectEvent(() => {
|
|
659
674
|
if (performedPointerEventsMutationRef.current) {
|
|
660
|
-
const body = floatingUi_react_utils.getDocument(
|
|
675
|
+
const body = floatingUi_react_utils.getDocument(elements.floating).body;
|
|
661
676
|
body.style.pointerEvents = '';
|
|
662
677
|
body.removeAttribute(safePolygonIdentifier);
|
|
663
678
|
performedPointerEventsMutationRef.current = false;
|
|
664
679
|
}
|
|
665
|
-
}
|
|
680
|
+
});
|
|
666
681
|
|
|
667
682
|
// Registering the mouse events on the reference directly to bypass React's
|
|
668
683
|
// delegation system. If the cursor was on a disabled element and then entered
|
|
669
684
|
// the reference (no gap), `mouseenter` doesn't fire in the delegation system.
|
|
670
685
|
React__namespace.useEffect(() => {
|
|
671
|
-
if (!enabled)
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
686
|
+
if (!enabled) return;
|
|
674
687
|
function isClickLikeOpenEvent() {
|
|
675
688
|
return dataRef.current.openEvent ? ['click', 'mousedown'].includes(dataRef.current.openEvent.type) : false;
|
|
676
689
|
}
|
|
677
690
|
function onMouseEnter(event) {
|
|
678
691
|
clearTimeout(timeoutRef.current);
|
|
679
692
|
blockMouseMoveRef.current = false;
|
|
680
|
-
if (mouseOnly && !floatingUi_react_utils.isMouseLikePointerType(pointerTypeRef.current) || restMs > 0 && getDelay(delayRef.current, 'open')
|
|
693
|
+
if (mouseOnly && !floatingUi_react_utils.isMouseLikePointerType(pointerTypeRef.current) || restMs > 0 && !getDelay(delayRef.current, 'open')) {
|
|
681
694
|
return;
|
|
682
695
|
}
|
|
683
696
|
const openDelay = getDelay(delayRef.current, 'open', pointerTypeRef.current);
|
|
684
697
|
if (openDelay) {
|
|
685
|
-
timeoutRef.current = setTimeout(() => {
|
|
686
|
-
|
|
698
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
699
|
+
if (!openRef.current) {
|
|
700
|
+
onOpenChange(true, event, 'hover');
|
|
701
|
+
}
|
|
687
702
|
}, openDelay);
|
|
688
703
|
} else {
|
|
689
704
|
onOpenChange(true, event, 'hover');
|
|
690
705
|
}
|
|
691
706
|
}
|
|
692
707
|
function onMouseLeave(event) {
|
|
693
|
-
if (isClickLikeOpenEvent())
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
708
|
+
if (isClickLikeOpenEvent()) return;
|
|
696
709
|
unbindMouseMoveRef.current();
|
|
697
|
-
const doc = floatingUi_react_utils.getDocument(floating);
|
|
710
|
+
const doc = floatingUi_react_utils.getDocument(elements.floating);
|
|
698
711
|
clearTimeout(restTimeoutRef.current);
|
|
699
|
-
if (handleCloseRef.current) {
|
|
712
|
+
if (handleCloseRef.current && dataRef.current.floatingContext) {
|
|
700
713
|
// Prevent clearing `onScrollMouseLeave` timeout.
|
|
701
714
|
if (!open) {
|
|
702
715
|
clearTimeout(timeoutRef.current);
|
|
703
716
|
}
|
|
704
717
|
handlerRef.current = handleCloseRef.current({
|
|
705
|
-
...
|
|
718
|
+
...dataRef.current.floatingContext,
|
|
706
719
|
tree,
|
|
707
720
|
x: event.clientX,
|
|
708
721
|
y: event.clientY,
|
|
@@ -723,7 +736,7 @@ function useHover(context, props) {
|
|
|
723
736
|
// Allow interactivity without `safePolygon` on touch devices. With a
|
|
724
737
|
// pointer, a short close delay is an alternative, so it should work
|
|
725
738
|
// consistently.
|
|
726
|
-
const shouldClose = pointerTypeRef.current === 'touch' ? !floatingUi_react_utils.contains(floating, event.relatedTarget) : true;
|
|
739
|
+
const shouldClose = pointerTypeRef.current === 'touch' ? !floatingUi_react_utils.contains(elements.floating, event.relatedTarget) : true;
|
|
727
740
|
if (shouldClose) {
|
|
728
741
|
closeWithDelay(event);
|
|
729
742
|
}
|
|
@@ -733,11 +746,10 @@ function useHover(context, props) {
|
|
|
733
746
|
// did not move.
|
|
734
747
|
// https://github.com/floating-ui/floating-ui/discussions/1692
|
|
735
748
|
function onScrollMouseLeave(event) {
|
|
736
|
-
if (isClickLikeOpenEvent())
|
|
737
|
-
|
|
738
|
-
}
|
|
749
|
+
if (isClickLikeOpenEvent()) return;
|
|
750
|
+
if (!dataRef.current.floatingContext) return;
|
|
739
751
|
handleCloseRef.current == null || handleCloseRef.current({
|
|
740
|
-
...
|
|
752
|
+
...dataRef.current.floatingContext,
|
|
741
753
|
tree,
|
|
742
754
|
x: event.clientX,
|
|
743
755
|
y: event.clientY,
|
|
@@ -748,24 +760,26 @@ function useHover(context, props) {
|
|
|
748
760
|
}
|
|
749
761
|
})(event);
|
|
750
762
|
}
|
|
751
|
-
if (floatingUi_utils_dom.isElement(domReference)) {
|
|
752
|
-
|
|
763
|
+
if (floatingUi_utils_dom$1.isElement(elements.domReference)) {
|
|
764
|
+
var _elements$floating;
|
|
765
|
+
const ref = elements.domReference;
|
|
753
766
|
open && ref.addEventListener('mouseleave', onScrollMouseLeave);
|
|
754
|
-
floating == null || floating.addEventListener('mouseleave', onScrollMouseLeave);
|
|
767
|
+
(_elements$floating = elements.floating) == null || _elements$floating.addEventListener('mouseleave', onScrollMouseLeave);
|
|
755
768
|
move && ref.addEventListener('mousemove', onMouseEnter, {
|
|
756
769
|
once: true
|
|
757
770
|
});
|
|
758
771
|
ref.addEventListener('mouseenter', onMouseEnter);
|
|
759
772
|
ref.addEventListener('mouseleave', onMouseLeave);
|
|
760
773
|
return () => {
|
|
774
|
+
var _elements$floating2;
|
|
761
775
|
open && ref.removeEventListener('mouseleave', onScrollMouseLeave);
|
|
762
|
-
floating == null ||
|
|
776
|
+
(_elements$floating2 = elements.floating) == null || _elements$floating2.removeEventListener('mouseleave', onScrollMouseLeave);
|
|
763
777
|
move && ref.removeEventListener('mousemove', onMouseEnter);
|
|
764
778
|
ref.removeEventListener('mouseenter', onMouseEnter);
|
|
765
779
|
ref.removeEventListener('mouseleave', onMouseLeave);
|
|
766
780
|
};
|
|
767
781
|
}
|
|
768
|
-
}, [
|
|
782
|
+
}, [elements, enabled, context, mouseOnly, restMs, move, closeWithDelay, cleanupMouseMoveHandler, clearPointerEvents, onOpenChange, open, openRef, tree, delayRef, handleCloseRef, dataRef]);
|
|
769
783
|
|
|
770
784
|
// Block pointer-events of every element other than the reference and floating
|
|
771
785
|
// while the floating element is open and has a `handleClose` handler. Also
|
|
@@ -773,30 +787,29 @@ function useHover(context, props) {
|
|
|
773
787
|
// https://github.com/floating-ui/floating-ui/issues/1722
|
|
774
788
|
index(() => {
|
|
775
789
|
var _handleCloseRef$curre;
|
|
776
|
-
if (!enabled)
|
|
777
|
-
return;
|
|
778
|
-
}
|
|
790
|
+
if (!enabled) return;
|
|
779
791
|
if (open && (_handleCloseRef$curre = handleCloseRef.current) != null && _handleCloseRef$curre.__options.blockPointerEvents && isHoverOpen()) {
|
|
780
|
-
const body = floatingUi_react_utils.getDocument(floating).body;
|
|
792
|
+
const body = floatingUi_react_utils.getDocument(elements.floating).body;
|
|
781
793
|
body.setAttribute(safePolygonIdentifier, '');
|
|
782
794
|
body.style.pointerEvents = 'none';
|
|
783
795
|
performedPointerEventsMutationRef.current = true;
|
|
784
|
-
|
|
796
|
+
const floatingEl = elements.floating;
|
|
797
|
+
if (floatingUi_utils_dom$1.isElement(elements.domReference) && floatingEl) {
|
|
785
798
|
var _tree$nodesRef$curren;
|
|
786
|
-
const ref = domReference;
|
|
799
|
+
const ref = elements.domReference;
|
|
787
800
|
const parentFloating = tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find(node => node.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren.elements.floating;
|
|
788
801
|
if (parentFloating) {
|
|
789
802
|
parentFloating.style.pointerEvents = '';
|
|
790
803
|
}
|
|
791
804
|
ref.style.pointerEvents = 'auto';
|
|
792
|
-
|
|
805
|
+
floatingEl.style.pointerEvents = 'auto';
|
|
793
806
|
return () => {
|
|
794
807
|
ref.style.pointerEvents = '';
|
|
795
|
-
|
|
808
|
+
floatingEl.style.pointerEvents = '';
|
|
796
809
|
};
|
|
797
810
|
}
|
|
798
811
|
}
|
|
799
|
-
}, [enabled, open, parentId,
|
|
812
|
+
}, [enabled, open, parentId, elements, tree, handleCloseRef, isHoverOpen]);
|
|
800
813
|
index(() => {
|
|
801
814
|
if (!open) {
|
|
802
815
|
pointerTypeRef.current = undefined;
|
|
@@ -811,48 +824,50 @@ function useHover(context, props) {
|
|
|
811
824
|
clearTimeout(restTimeoutRef.current);
|
|
812
825
|
clearPointerEvents();
|
|
813
826
|
};
|
|
814
|
-
}, [enabled, domReference, cleanupMouseMoveHandler, clearPointerEvents]);
|
|
815
|
-
|
|
816
|
-
if (!enabled) {
|
|
817
|
-
return {};
|
|
818
|
-
}
|
|
827
|
+
}, [enabled, elements.domReference, cleanupMouseMoveHandler, clearPointerEvents]);
|
|
828
|
+
const reference = React__namespace.useMemo(() => {
|
|
819
829
|
function setPointerRef(event) {
|
|
820
830
|
pointerTypeRef.current = event.pointerType;
|
|
821
831
|
}
|
|
822
832
|
return {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
if (mouseOnly && !floatingUi_react_utils.isMouseLikePointerType(pointerTypeRef.current)) {
|
|
833
|
-
return;
|
|
834
|
-
}
|
|
835
|
-
if (open || restMs === 0) {
|
|
836
|
-
return;
|
|
837
|
-
}
|
|
838
|
-
clearTimeout(restTimeoutRef.current);
|
|
839
|
-
if (pointerTypeRef.current === 'touch') {
|
|
840
|
-
handleMouseMove();
|
|
841
|
-
} else {
|
|
842
|
-
restTimeoutRef.current = setTimeout(handleMouseMove, restMs);
|
|
833
|
+
onPointerDown: setPointerRef,
|
|
834
|
+
onPointerEnter: setPointerRef,
|
|
835
|
+
onMouseMove(event) {
|
|
836
|
+
const {
|
|
837
|
+
nativeEvent
|
|
838
|
+
} = event;
|
|
839
|
+
function handleMouseMove() {
|
|
840
|
+
if (!blockMouseMoveRef.current && !openRef.current) {
|
|
841
|
+
onOpenChange(true, nativeEvent, 'hover');
|
|
843
842
|
}
|
|
844
843
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
844
|
+
if (mouseOnly && !floatingUi_react_utils.isMouseLikePointerType(pointerTypeRef.current)) {
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
if (open || restMs === 0) {
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
clearTimeout(restTimeoutRef.current);
|
|
851
|
+
if (pointerTypeRef.current === 'touch') {
|
|
852
|
+
handleMouseMove();
|
|
853
|
+
} else {
|
|
854
|
+
restTimeoutRef.current = window.setTimeout(handleMouseMove, restMs);
|
|
852
855
|
}
|
|
853
856
|
}
|
|
854
857
|
};
|
|
855
|
-
}, [
|
|
858
|
+
}, [mouseOnly, onOpenChange, open, openRef, restMs]);
|
|
859
|
+
const floating = React__namespace.useMemo(() => ({
|
|
860
|
+
onMouseEnter() {
|
|
861
|
+
clearTimeout(timeoutRef.current);
|
|
862
|
+
},
|
|
863
|
+
onMouseLeave(event) {
|
|
864
|
+
closeWithDelay(event.nativeEvent, false);
|
|
865
|
+
}
|
|
866
|
+
}), [closeWithDelay]);
|
|
867
|
+
return React__namespace.useMemo(() => enabled ? {
|
|
868
|
+
reference,
|
|
869
|
+
floating
|
|
870
|
+
} : {}, [enabled, reference, floating]);
|
|
856
871
|
}
|
|
857
872
|
|
|
858
873
|
function getAncestors(nodes, id) {
|
|
@@ -947,7 +962,8 @@ function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, iner
|
|
|
947
962
|
if (!parent || elementsToStop.has(parent)) {
|
|
948
963
|
return;
|
|
949
964
|
}
|
|
950
|
-
|
|
965
|
+
[].forEach.call(parent.children, node => {
|
|
966
|
+
if (floatingUi_utils_dom$1.getNodeName(node) === 'script') return;
|
|
951
967
|
if (elementsToKeep.has(node)) {
|
|
952
968
|
deep(node);
|
|
953
969
|
} else {
|
|
@@ -1054,6 +1070,32 @@ function enableFocusInside(container) {
|
|
|
1054
1070
|
}
|
|
1055
1071
|
});
|
|
1056
1072
|
}
|
|
1073
|
+
function getClosestTabbableElement(tabbableElements, element, floating) {
|
|
1074
|
+
const elementIndex = tabbableElements.indexOf(element);
|
|
1075
|
+
function traverseTabbableElements(next) {
|
|
1076
|
+
const attr = createAttribute('focus-guard');
|
|
1077
|
+
let index = elementIndex + (next ? 1 : 0);
|
|
1078
|
+
let currentElement = tabbableElements[index];
|
|
1079
|
+
while (currentElement && (!currentElement.isConnected || currentElement.hasAttribute(attr) || floatingUi_react_utils.contains(floating, currentElement))) {
|
|
1080
|
+
if (next) {
|
|
1081
|
+
index++;
|
|
1082
|
+
} else {
|
|
1083
|
+
index--;
|
|
1084
|
+
}
|
|
1085
|
+
currentElement = tabbableElements[index];
|
|
1086
|
+
}
|
|
1087
|
+
return currentElement;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
// First, try to find the next tabbable element
|
|
1091
|
+
const next = traverseTabbableElements(true);
|
|
1092
|
+
if (next) {
|
|
1093
|
+
return next;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
// If we can't find a next tabbable element, try to find the previous one
|
|
1097
|
+
return traverseTabbableElements(false);
|
|
1098
|
+
}
|
|
1057
1099
|
|
|
1058
1100
|
// See Diego Haz's Sandbox for making this logic work well on Safari/iOS:
|
|
1059
1101
|
// https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/FocusTrap.tsx
|
|
@@ -1108,7 +1150,6 @@ const FocusGuard = /*#__PURE__*/React__namespace.forwardRef(function FocusGuard(
|
|
|
1108
1150
|
|
|
1109
1151
|
const PortalContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
1110
1152
|
const attr = /*#__PURE__*/createAttribute('portal');
|
|
1111
|
-
|
|
1112
1153
|
/**
|
|
1113
1154
|
* @see https://floating-ui.com/docs/FloatingPortal#usefloatingportalnode
|
|
1114
1155
|
*/
|
|
@@ -1136,6 +1177,10 @@ function useFloatingPortalNode(props) {
|
|
|
1136
1177
|
};
|
|
1137
1178
|
}, [portalNode]);
|
|
1138
1179
|
index(() => {
|
|
1180
|
+
// Wait for the uniqueId to be generated before creating the portal node in
|
|
1181
|
+
// React <18 (using `useFloatingId` instead of the native `useId`).
|
|
1182
|
+
// https://github.com/floating-ui/floating-ui/issues/2778
|
|
1183
|
+
if (!uniqueId) return;
|
|
1139
1184
|
if (portalNodeRef.current) return;
|
|
1140
1185
|
const existingIdRoot = id ? document.getElementById(id) : null;
|
|
1141
1186
|
if (!existingIdRoot) return;
|
|
@@ -1147,9 +1192,10 @@ function useFloatingPortalNode(props) {
|
|
|
1147
1192
|
setPortalNode(subRoot);
|
|
1148
1193
|
}, [id, uniqueId]);
|
|
1149
1194
|
index(() => {
|
|
1195
|
+
if (!uniqueId) return;
|
|
1150
1196
|
if (portalNodeRef.current) return;
|
|
1151
1197
|
let container = root || (portalContext == null ? void 0 : portalContext.portalNode);
|
|
1152
|
-
if (container && !floatingUi_utils_dom.isElement(container)) container = container.current;
|
|
1198
|
+
if (container && !floatingUi_utils_dom$1.isElement(container)) container = container.current;
|
|
1153
1199
|
container = container || document.body;
|
|
1154
1200
|
let idWrapper = null;
|
|
1155
1201
|
if (id) {
|
|
@@ -1250,7 +1296,7 @@ function FloatingPortal(props) {
|
|
|
1250
1296
|
}), shouldRenderGuards && portalNode && /*#__PURE__*/React__namespace.createElement("span", {
|
|
1251
1297
|
"aria-owns": portalNode.id,
|
|
1252
1298
|
style: HIDDEN_STYLES
|
|
1253
|
-
}), portalNode && /*#__PURE__*/
|
|
1299
|
+
}), portalNode && /*#__PURE__*/ReactDOM__namespace.createPortal(children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/React__namespace.createElement(FocusGuard, {
|
|
1254
1300
|
"data-type": "outside",
|
|
1255
1301
|
ref: afterOutsideRef,
|
|
1256
1302
|
onFocus: event => {
|
|
@@ -1272,11 +1318,12 @@ let previouslyFocusedElements = [];
|
|
|
1272
1318
|
function addPreviouslyFocusedElement(element) {
|
|
1273
1319
|
previouslyFocusedElements = previouslyFocusedElements.filter(el => el.isConnected);
|
|
1274
1320
|
let tabbableEl = element;
|
|
1275
|
-
if (!tabbableEl || floatingUi_utils_dom.getNodeName(tabbableEl) === 'body') return;
|
|
1321
|
+
if (!tabbableEl || floatingUi_utils_dom$1.getNodeName(tabbableEl) === 'body') return;
|
|
1276
1322
|
if (!index_esm.isTabbable(tabbableEl, getTabbableOptions())) {
|
|
1277
1323
|
const tabbableChild = index_esm.tabbable(tabbableEl, getTabbableOptions())[0];
|
|
1278
|
-
if (
|
|
1279
|
-
|
|
1324
|
+
if (tabbableChild) {
|
|
1325
|
+
tabbableEl = tabbableChild;
|
|
1326
|
+
}
|
|
1280
1327
|
}
|
|
1281
1328
|
previouslyFocusedElements.push(tabbableEl);
|
|
1282
1329
|
if (previouslyFocusedElements.length > LIST_LIMIT) {
|
|
@@ -1307,6 +1354,7 @@ function FloatingFocusManager(props) {
|
|
|
1307
1354
|
guards: _guards = true,
|
|
1308
1355
|
initialFocus = 0,
|
|
1309
1356
|
returnFocus = true,
|
|
1357
|
+
restoreFocus = false,
|
|
1310
1358
|
modal = true,
|
|
1311
1359
|
visuallyHiddenDismiss = false,
|
|
1312
1360
|
closeOnFocusOut = true
|
|
@@ -1318,6 +1366,7 @@ function FloatingFocusManager(props) {
|
|
|
1318
1366
|
onOpenChange,
|
|
1319
1367
|
events,
|
|
1320
1368
|
dataRef,
|
|
1369
|
+
floatingId,
|
|
1321
1370
|
elements: {
|
|
1322
1371
|
domReference,
|
|
1323
1372
|
floating
|
|
@@ -1342,31 +1391,37 @@ function FloatingFocusManager(props) {
|
|
|
1342
1391
|
const endDismissButtonRef = React__namespace.useRef(null);
|
|
1343
1392
|
const preventReturnFocusRef = React__namespace.useRef(false);
|
|
1344
1393
|
const isPointerDownRef = React__namespace.useRef(false);
|
|
1394
|
+
const tabbableIndexRef = React__namespace.useRef(-1);
|
|
1345
1395
|
const isInsidePortal = portalContext != null;
|
|
1346
|
-
const
|
|
1396
|
+
const firstElementChild = floating == null ? void 0 : floating.firstElementChild;
|
|
1397
|
+
// If the floating element is acting as a positioning wrapper rather than the
|
|
1398
|
+
// element that receives aria props, use it as the focus root instead.
|
|
1399
|
+
const floatingFocusNode = (firstElementChild == null ? void 0 : firstElementChild.id) === floatingId ? firstElementChild : floating;
|
|
1400
|
+
const getTabbableContent = useEffectEvent(function (container) {
|
|
1347
1401
|
if (container === void 0) {
|
|
1348
|
-
container =
|
|
1402
|
+
container = floatingFocusNode;
|
|
1349
1403
|
}
|
|
1350
1404
|
return container ? index_esm.tabbable(container, getTabbableOptions()) : [];
|
|
1351
|
-
}
|
|
1352
|
-
const getTabbableElements =
|
|
1405
|
+
});
|
|
1406
|
+
const getTabbableElements = useEffectEvent(container => {
|
|
1353
1407
|
const content = getTabbableContent(container);
|
|
1354
1408
|
return orderRef.current.map(type => {
|
|
1355
1409
|
if (domReference && type === 'reference') {
|
|
1356
1410
|
return domReference;
|
|
1357
1411
|
}
|
|
1358
|
-
if (
|
|
1359
|
-
return
|
|
1412
|
+
if (floatingFocusNode && type === 'floating') {
|
|
1413
|
+
return floatingFocusNode;
|
|
1360
1414
|
}
|
|
1361
1415
|
return content;
|
|
1362
1416
|
}).filter(Boolean).flat();
|
|
1363
|
-
}
|
|
1417
|
+
});
|
|
1364
1418
|
React__namespace.useEffect(() => {
|
|
1365
|
-
if (disabled
|
|
1419
|
+
if (disabled) return;
|
|
1420
|
+
if (!modal) return;
|
|
1366
1421
|
function onKeyDown(event) {
|
|
1367
1422
|
if (event.key === 'Tab') {
|
|
1368
1423
|
// The focus guards have nothing to focus, so we need to stop the event.
|
|
1369
|
-
if (floatingUi_react_utils.contains(
|
|
1424
|
+
if (floatingUi_react_utils.contains(floatingFocusNode, floatingUi_react_utils.activeElement(floatingUi_react_utils.getDocument(floatingFocusNode))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) {
|
|
1370
1425
|
floatingUi_react_utils.stopEvent(event);
|
|
1371
1426
|
}
|
|
1372
1427
|
const els = getTabbableElements();
|
|
@@ -1379,20 +1434,37 @@ function FloatingFocusManager(props) {
|
|
|
1379
1434
|
enqueueFocus(els[1]);
|
|
1380
1435
|
}
|
|
1381
1436
|
}
|
|
1382
|
-
if (orderRef.current[1] === 'floating' && target ===
|
|
1437
|
+
if (orderRef.current[1] === 'floating' && target === floatingFocusNode && event.shiftKey) {
|
|
1383
1438
|
floatingUi_react_utils.stopEvent(event);
|
|
1384
1439
|
enqueueFocus(els[0]);
|
|
1385
1440
|
}
|
|
1386
1441
|
}
|
|
1387
1442
|
}
|
|
1388
|
-
const doc = floatingUi_react_utils.getDocument(
|
|
1443
|
+
const doc = floatingUi_react_utils.getDocument(floatingFocusNode);
|
|
1389
1444
|
doc.addEventListener('keydown', onKeyDown);
|
|
1390
1445
|
return () => {
|
|
1391
1446
|
doc.removeEventListener('keydown', onKeyDown);
|
|
1392
1447
|
};
|
|
1393
|
-
}, [disabled, domReference,
|
|
1448
|
+
}, [disabled, domReference, floatingFocusNode, modal, orderRef, isUntrappedTypeableCombobox, getTabbableContent, getTabbableElements]);
|
|
1449
|
+
React__namespace.useEffect(() => {
|
|
1450
|
+
if (disabled) return;
|
|
1451
|
+
if (!floating) return;
|
|
1452
|
+
function handleFocusIn(event) {
|
|
1453
|
+
const target = floatingUi_react_utils.getTarget(event);
|
|
1454
|
+
const tabbableContent = getTabbableContent();
|
|
1455
|
+
const tabbableIndex = tabbableContent.indexOf(target);
|
|
1456
|
+
if (tabbableIndex !== -1) {
|
|
1457
|
+
tabbableIndexRef.current = tabbableIndex;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
floating.addEventListener('focusin', handleFocusIn);
|
|
1461
|
+
return () => {
|
|
1462
|
+
floating.removeEventListener('focusin', handleFocusIn);
|
|
1463
|
+
};
|
|
1464
|
+
}, [disabled, floating, getTabbableContent]);
|
|
1394
1465
|
React__namespace.useEffect(() => {
|
|
1395
|
-
if (disabled
|
|
1466
|
+
if (disabled) return;
|
|
1467
|
+
if (!closeOnFocusOut) return;
|
|
1396
1468
|
|
|
1397
1469
|
// In Safari, buttons lose focus when pressing them.
|
|
1398
1470
|
function handlePointerDown() {
|
|
@@ -1412,9 +1484,25 @@ function FloatingFocusManager(props) {
|
|
|
1412
1484
|
return ((_node$context3 = node.context) == null ? void 0 : _node$context3.elements.floating) === relatedTarget || ((_node$context4 = node.context) == null ? void 0 : _node$context4.elements.domReference) === relatedTarget;
|
|
1413
1485
|
})));
|
|
1414
1486
|
|
|
1487
|
+
// Restore focus to the previous tabbable element index to prevent
|
|
1488
|
+
// focus from being lost outside the floating tree.
|
|
1489
|
+
if (restoreFocus && movedToUnrelatedNode && floatingUi_react_utils.activeElement(floatingUi_react_utils.getDocument(floatingFocusNode)) === floatingUi_react_utils.getDocument(floatingFocusNode).body) {
|
|
1490
|
+
// Let `FloatingPortal` effect knows that focus is still inside the
|
|
1491
|
+
// floating tree.
|
|
1492
|
+
if (floatingUi_utils_dom$1.isHTMLElement(floatingFocusNode)) {
|
|
1493
|
+
floatingFocusNode == null || floatingFocusNode.focus();
|
|
1494
|
+
}
|
|
1495
|
+
const prevTabbableIndex = tabbableIndexRef.current;
|
|
1496
|
+
const tabbableContent = getTabbableContent();
|
|
1497
|
+
const nodeToFocus = tabbableContent[prevTabbableIndex] || tabbableContent[tabbableContent.length - 1] || floatingFocusNode;
|
|
1498
|
+
if (floatingUi_utils_dom$1.isHTMLElement(nodeToFocus)) {
|
|
1499
|
+
nodeToFocus.focus();
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1415
1503
|
// Focus did not move inside the floating tree, and there are no tabbable
|
|
1416
1504
|
// portal guards to handle closing.
|
|
1417
|
-
if (relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current &&
|
|
1505
|
+
if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current &&
|
|
1418
1506
|
// Fix React 18 Strict Mode returnFocus due to double rendering.
|
|
1419
1507
|
relatedTarget !== getPreviouslyFocusedElement()) {
|
|
1420
1508
|
preventReturnFocusRef.current = true;
|
|
@@ -1422,17 +1510,17 @@ function FloatingFocusManager(props) {
|
|
|
1422
1510
|
}
|
|
1423
1511
|
});
|
|
1424
1512
|
}
|
|
1425
|
-
if (floating && floatingUi_utils_dom.isHTMLElement(domReference)) {
|
|
1513
|
+
if (floating && floatingUi_utils_dom$1.isHTMLElement(domReference)) {
|
|
1426
1514
|
domReference.addEventListener('focusout', handleFocusOutside);
|
|
1427
1515
|
domReference.addEventListener('pointerdown', handlePointerDown);
|
|
1428
|
-
|
|
1516
|
+
floating.addEventListener('focusout', handleFocusOutside);
|
|
1429
1517
|
return () => {
|
|
1430
1518
|
domReference.removeEventListener('focusout', handleFocusOutside);
|
|
1431
1519
|
domReference.removeEventListener('pointerdown', handlePointerDown);
|
|
1432
|
-
|
|
1520
|
+
floating.removeEventListener('focusout', handleFocusOutside);
|
|
1433
1521
|
};
|
|
1434
1522
|
}
|
|
1435
|
-
}, [disabled, domReference, floating, modal, nodeId, tree, portalContext, onOpenChange, closeOnFocusOut]);
|
|
1523
|
+
}, [disabled, domReference, floating, floatingFocusNode, modal, nodeId, tree, portalContext, onOpenChange, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox]);
|
|
1436
1524
|
React__namespace.useEffect(() => {
|
|
1437
1525
|
var _portalContext$portal;
|
|
1438
1526
|
if (disabled) return;
|
|
@@ -1448,39 +1536,45 @@ function FloatingFocusManager(props) {
|
|
|
1448
1536
|
}
|
|
1449
1537
|
}, [disabled, domReference, floating, modal, orderRef, portalContext, isUntrappedTypeableCombobox, guards]);
|
|
1450
1538
|
index(() => {
|
|
1451
|
-
if (disabled || !
|
|
1452
|
-
const doc = floatingUi_react_utils.getDocument(
|
|
1539
|
+
if (disabled || !floatingUi_utils_dom$1.isHTMLElement(floatingFocusNode)) return;
|
|
1540
|
+
const doc = floatingUi_react_utils.getDocument(floatingFocusNode);
|
|
1453
1541
|
const previouslyFocusedElement = floatingUi_react_utils.activeElement(doc);
|
|
1454
1542
|
|
|
1455
1543
|
// Wait for any layout effect state setters to execute to set `tabIndex`.
|
|
1456
1544
|
queueMicrotask(() => {
|
|
1457
|
-
const focusableElements = getTabbableElements(
|
|
1545
|
+
const focusableElements = getTabbableElements(floatingFocusNode);
|
|
1458
1546
|
const initialFocusValue = initialFocusRef.current;
|
|
1459
|
-
const elToFocus = (typeof initialFocusValue === 'number' ? focusableElements[initialFocusValue] : initialFocusValue.current) ||
|
|
1460
|
-
const focusAlreadyInsideFloatingEl = floatingUi_react_utils.contains(
|
|
1547
|
+
const elToFocus = (typeof initialFocusValue === 'number' ? focusableElements[initialFocusValue] : initialFocusValue.current) || floatingFocusNode;
|
|
1548
|
+
const focusAlreadyInsideFloatingEl = floatingUi_react_utils.contains(floatingFocusNode, previouslyFocusedElement);
|
|
1461
1549
|
if (!ignoreInitialFocus && !focusAlreadyInsideFloatingEl && open) {
|
|
1462
1550
|
enqueueFocus(elToFocus, {
|
|
1463
|
-
preventScroll: elToFocus ===
|
|
1551
|
+
preventScroll: elToFocus === floatingFocusNode
|
|
1464
1552
|
});
|
|
1465
1553
|
}
|
|
1466
1554
|
});
|
|
1467
|
-
}, [disabled, open,
|
|
1555
|
+
}, [disabled, open, floatingFocusNode, ignoreInitialFocus, getTabbableElements, initialFocusRef]);
|
|
1468
1556
|
index(() => {
|
|
1469
|
-
if (disabled || !
|
|
1557
|
+
if (disabled || !floatingFocusNode) return;
|
|
1470
1558
|
let preventReturnFocusScroll = false;
|
|
1471
|
-
const doc = floatingUi_react_utils.getDocument(
|
|
1559
|
+
const doc = floatingUi_react_utils.getDocument(floatingFocusNode);
|
|
1472
1560
|
const previouslyFocusedElement = floatingUi_react_utils.activeElement(doc);
|
|
1473
1561
|
const contextData = dataRef.current;
|
|
1562
|
+
let openEvent = contextData.openEvent;
|
|
1563
|
+
const domReference = refs.domReference.current;
|
|
1474
1564
|
addPreviouslyFocusedElement(previouslyFocusedElement);
|
|
1475
1565
|
|
|
1476
1566
|
// Dismissing via outside press should always ignore `returnFocus` to
|
|
1477
1567
|
// prevent unwanted scrolling.
|
|
1478
1568
|
function onOpenChange(_ref) {
|
|
1479
1569
|
let {
|
|
1570
|
+
open,
|
|
1480
1571
|
reason,
|
|
1481
1572
|
event,
|
|
1482
1573
|
nested
|
|
1483
1574
|
} = _ref;
|
|
1575
|
+
if (open) {
|
|
1576
|
+
openEvent = event;
|
|
1577
|
+
}
|
|
1484
1578
|
if (reason === 'escape-key' && refs.domReference.current) {
|
|
1485
1579
|
addPreviouslyFocusedElement(refs.domReference.current);
|
|
1486
1580
|
}
|
|
@@ -1503,34 +1597,40 @@ function FloatingFocusManager(props) {
|
|
|
1503
1597
|
var _node$context5;
|
|
1504
1598
|
return floatingUi_react_utils.contains((_node$context5 = node.context) == null ? void 0 : _node$context5.elements.floating, activeEl);
|
|
1505
1599
|
});
|
|
1506
|
-
const shouldFocusReference = isFocusInsideFloatingTree ||
|
|
1600
|
+
const shouldFocusReference = isFocusInsideFloatingTree || openEvent && ['click', 'mousedown'].includes(openEvent.type);
|
|
1507
1601
|
if (shouldFocusReference && refs.domReference.current) {
|
|
1508
1602
|
addPreviouslyFocusedElement(refs.domReference.current);
|
|
1509
1603
|
}
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
//
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1604
|
+
const returnContextElement = domReference || previouslyFocusedElement;
|
|
1605
|
+
const tabbableElements = index_esm.tabbable(floatingUi_react_utils.getDocument(returnContextElement).body, getTabbableOptions());
|
|
1606
|
+
|
|
1607
|
+
// Wait for the return element to get potentially disconnected before
|
|
1608
|
+
// checking.
|
|
1609
|
+
queueMicrotask(() => {
|
|
1610
|
+
let returnElement = getPreviouslyFocusedElement();
|
|
1611
|
+
if (!returnElement && floatingUi_utils_dom$1.isHTMLElement(returnContextElement) && floating) {
|
|
1612
|
+
returnElement = getClosestTabbableElement(tabbableElements, returnContextElement, floating);
|
|
1613
|
+
}
|
|
1614
|
+
if (
|
|
1615
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1616
|
+
returnFocusRef.current && !preventReturnFocusRef.current && floatingUi_utils_dom$1.isHTMLElement(returnElement) && (
|
|
1617
|
+
// If the focus moved somewhere else after mount, avoid returning focus
|
|
1618
|
+
// since it likely entered a different element which should be
|
|
1619
|
+
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
|
1620
|
+
returnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) {
|
|
1621
|
+
returnElement.focus({
|
|
1622
|
+
preventScroll: preventReturnFocusScroll
|
|
1623
|
+
});
|
|
1624
|
+
}
|
|
1625
|
+
});
|
|
1527
1626
|
};
|
|
1528
|
-
}, [disabled, floating, returnFocusRef, dataRef, refs, events, tree, nodeId]);
|
|
1627
|
+
}, [disabled, floating, floatingFocusNode, returnFocusRef, dataRef, refs, events, tree, nodeId]);
|
|
1529
1628
|
|
|
1530
1629
|
// Synchronize the `context` & `modal` value to the FloatingPortal context.
|
|
1531
1630
|
// It will decide whether or not it needs to render its own guards.
|
|
1532
1631
|
index(() => {
|
|
1533
|
-
if (disabled
|
|
1632
|
+
if (disabled) return;
|
|
1633
|
+
if (!portalContext) return;
|
|
1534
1634
|
portalContext.setFocusManagerState({
|
|
1535
1635
|
modal,
|
|
1536
1636
|
closeOnFocusOut,
|
|
@@ -1543,22 +1643,29 @@ function FloatingFocusManager(props) {
|
|
|
1543
1643
|
};
|
|
1544
1644
|
}, [disabled, portalContext, modal, open, onOpenChange, refs, closeOnFocusOut]);
|
|
1545
1645
|
index(() => {
|
|
1546
|
-
if (disabled
|
|
1547
|
-
|
|
1548
|
-
|
|
1646
|
+
if (disabled) return;
|
|
1647
|
+
if (!floatingFocusNode) return;
|
|
1648
|
+
if (typeof MutationObserver !== 'function') return;
|
|
1649
|
+
if (ignoreInitialFocus) return;
|
|
1549
1650
|
const handleMutation = () => {
|
|
1550
|
-
const tabIndex =
|
|
1551
|
-
|
|
1651
|
+
const tabIndex = floatingFocusNode.getAttribute('tabindex');
|
|
1652
|
+
const tabbableContent = getTabbableContent();
|
|
1653
|
+
const activeEl = floatingUi_react_utils.activeElement(floatingUi_react_utils.getDocument(floating));
|
|
1654
|
+
const tabbableIndex = tabbableContent.indexOf(activeEl);
|
|
1655
|
+
if (tabbableIndex !== -1) {
|
|
1656
|
+
tabbableIndexRef.current = tabbableIndex;
|
|
1657
|
+
}
|
|
1658
|
+
if (orderRef.current.includes('floating') || activeEl !== refs.domReference.current && tabbableContent.length === 0) {
|
|
1552
1659
|
if (tabIndex !== '0') {
|
|
1553
|
-
|
|
1660
|
+
floatingFocusNode.setAttribute('tabindex', '0');
|
|
1554
1661
|
}
|
|
1555
1662
|
} else if (tabIndex !== '-1') {
|
|
1556
|
-
|
|
1663
|
+
floatingFocusNode.setAttribute('tabindex', '-1');
|
|
1557
1664
|
}
|
|
1558
1665
|
};
|
|
1559
1666
|
handleMutation();
|
|
1560
1667
|
const observer = new MutationObserver(handleMutation);
|
|
1561
|
-
observer.observe(
|
|
1668
|
+
observer.observe(floatingFocusNode, {
|
|
1562
1669
|
childList: true,
|
|
1563
1670
|
subtree: true,
|
|
1564
1671
|
attributes: true
|
|
@@ -1566,7 +1673,7 @@ function FloatingFocusManager(props) {
|
|
|
1566
1673
|
return () => {
|
|
1567
1674
|
observer.disconnect();
|
|
1568
1675
|
};
|
|
1569
|
-
}, [disabled, floating, refs, orderRef, getTabbableContent, ignoreInitialFocus]);
|
|
1676
|
+
}, [disabled, floating, floatingFocusNode, refs, orderRef, getTabbableContent, ignoreInitialFocus]);
|
|
1570
1677
|
function renderDismissButton(location) {
|
|
1571
1678
|
if (disabled || !visuallyHiddenDismiss || !modal) {
|
|
1572
1679
|
return null;
|
|
@@ -1576,7 +1683,7 @@ function FloatingFocusManager(props) {
|
|
|
1576
1683
|
onClick: event => onOpenChange(false, event.nativeEvent)
|
|
1577
1684
|
}, typeof visuallyHiddenDismiss === 'string' ? visuallyHiddenDismiss : 'Dismiss');
|
|
1578
1685
|
}
|
|
1579
|
-
const shouldRenderGuards = !disabled && guards && (isInsidePortal || modal);
|
|
1686
|
+
const shouldRenderGuards = !disabled && guards && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);
|
|
1580
1687
|
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, shouldRenderGuards && /*#__PURE__*/React__namespace.createElement(FocusGuard, {
|
|
1581
1688
|
"data-type": "inside",
|
|
1582
1689
|
ref: portalContext == null ? void 0 : portalContext.beforeInsideRef,
|
|
@@ -1618,7 +1725,7 @@ function FloatingFocusManager(props) {
|
|
|
1618
1725
|
}
|
|
1619
1726
|
|
|
1620
1727
|
function isButtonTarget(event) {
|
|
1621
|
-
return floatingUi_utils_dom.isHTMLElement(event.target) && event.target.tagName === 'BUTTON';
|
|
1728
|
+
return floatingUi_utils_dom$1.isHTMLElement(event.target) && event.target.tagName === 'BUTTON';
|
|
1622
1729
|
}
|
|
1623
1730
|
function isSpaceIgnored(element) {
|
|
1624
1731
|
return floatingUi_react_utils.isTypeableElement(element);
|
|
@@ -1648,81 +1755,74 @@ function useClick(context, props) {
|
|
|
1648
1755
|
} = props;
|
|
1649
1756
|
const pointerTypeRef = React__namespace.useRef();
|
|
1650
1757
|
const didKeyDownRef = React__namespace.useRef(false);
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
event.preventDefault();
|
|
1700
|
-
didKeyDownRef.current = true;
|
|
1701
|
-
}
|
|
1702
|
-
if (event.key === 'Enter') {
|
|
1703
|
-
if (open && toggle) {
|
|
1704
|
-
onOpenChange(false, event.nativeEvent, 'click');
|
|
1705
|
-
} else {
|
|
1706
|
-
onOpenChange(true, event.nativeEvent, 'click');
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
},
|
|
1710
|
-
onKeyUp(event) {
|
|
1711
|
-
if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) {
|
|
1712
|
-
return;
|
|
1713
|
-
}
|
|
1714
|
-
if (event.key === ' ' && didKeyDownRef.current) {
|
|
1715
|
-
didKeyDownRef.current = false;
|
|
1716
|
-
if (open && toggle) {
|
|
1717
|
-
onOpenChange(false, event.nativeEvent, 'click');
|
|
1718
|
-
} else {
|
|
1719
|
-
onOpenChange(true, event.nativeEvent, 'click');
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1758
|
+
const reference = React__namespace.useMemo(() => ({
|
|
1759
|
+
onPointerDown(event) {
|
|
1760
|
+
pointerTypeRef.current = event.pointerType;
|
|
1761
|
+
},
|
|
1762
|
+
onMouseDown(event) {
|
|
1763
|
+
const pointerType = pointerTypeRef.current;
|
|
1764
|
+
|
|
1765
|
+
// Ignore all buttons except for the "main" button.
|
|
1766
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
1767
|
+
if (event.button !== 0) return;
|
|
1768
|
+
if (eventOption === 'click') return;
|
|
1769
|
+
if (floatingUi_react_utils.isMouseLikePointerType(pointerType, true) && ignoreMouse) return;
|
|
1770
|
+
if (open && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === 'mousedown' : true)) {
|
|
1771
|
+
onOpenChange(false, event.nativeEvent, 'click');
|
|
1772
|
+
} else {
|
|
1773
|
+
// Prevent stealing focus from the floating element
|
|
1774
|
+
event.preventDefault();
|
|
1775
|
+
onOpenChange(true, event.nativeEvent, 'click');
|
|
1776
|
+
}
|
|
1777
|
+
},
|
|
1778
|
+
onClick(event) {
|
|
1779
|
+
const pointerType = pointerTypeRef.current;
|
|
1780
|
+
if (eventOption === 'mousedown' && pointerTypeRef.current) {
|
|
1781
|
+
pointerTypeRef.current = undefined;
|
|
1782
|
+
return;
|
|
1783
|
+
}
|
|
1784
|
+
if (floatingUi_react_utils.isMouseLikePointerType(pointerType, true) && ignoreMouse) return;
|
|
1785
|
+
if (open && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === 'click' : true)) {
|
|
1786
|
+
onOpenChange(false, event.nativeEvent, 'click');
|
|
1787
|
+
} else {
|
|
1788
|
+
onOpenChange(true, event.nativeEvent, 'click');
|
|
1789
|
+
}
|
|
1790
|
+
},
|
|
1791
|
+
onKeyDown(event) {
|
|
1792
|
+
pointerTypeRef.current = undefined;
|
|
1793
|
+
if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event)) {
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
if (event.key === ' ' && !isSpaceIgnored(domReference)) {
|
|
1797
|
+
// Prevent scrolling
|
|
1798
|
+
event.preventDefault();
|
|
1799
|
+
didKeyDownRef.current = true;
|
|
1800
|
+
}
|
|
1801
|
+
if (event.key === 'Enter') {
|
|
1802
|
+
if (open && toggle) {
|
|
1803
|
+
onOpenChange(false, event.nativeEvent, 'click');
|
|
1804
|
+
} else {
|
|
1805
|
+
onOpenChange(true, event.nativeEvent, 'click');
|
|
1722
1806
|
}
|
|
1723
1807
|
}
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1808
|
+
},
|
|
1809
|
+
onKeyUp(event) {
|
|
1810
|
+
if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) {
|
|
1811
|
+
return;
|
|
1812
|
+
}
|
|
1813
|
+
if (event.key === ' ' && didKeyDownRef.current) {
|
|
1814
|
+
didKeyDownRef.current = false;
|
|
1815
|
+
if (open && toggle) {
|
|
1816
|
+
onOpenChange(false, event.nativeEvent, 'click');
|
|
1817
|
+
} else {
|
|
1818
|
+
onOpenChange(true, event.nativeEvent, 'click');
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
}), [dataRef, domReference, eventOption, ignoreMouse, keyboardHandlers, onOpenChange, open, toggle]);
|
|
1823
|
+
return React__namespace.useMemo(() => enabled ? {
|
|
1824
|
+
reference
|
|
1825
|
+
} : {}, [enabled, reference]);
|
|
1726
1826
|
}
|
|
1727
1827
|
|
|
1728
1828
|
const bubbleHandlerKeys = {
|
|
@@ -1754,12 +1854,7 @@ function useDismiss(context, props) {
|
|
|
1754
1854
|
const {
|
|
1755
1855
|
open,
|
|
1756
1856
|
onOpenChange,
|
|
1757
|
-
|
|
1758
|
-
elements: {
|
|
1759
|
-
reference,
|
|
1760
|
-
domReference,
|
|
1761
|
-
floating
|
|
1762
|
-
},
|
|
1857
|
+
elements,
|
|
1763
1858
|
dataRef
|
|
1764
1859
|
} = context;
|
|
1765
1860
|
const {
|
|
@@ -1787,9 +1882,11 @@ function useDismiss(context, props) {
|
|
|
1787
1882
|
outsidePress: outsidePressCapture
|
|
1788
1883
|
} = normalizeProp(capture);
|
|
1789
1884
|
const closeOnEscapeKeyDown = useEffectEvent(event => {
|
|
1885
|
+
var _dataRef$current$floa;
|
|
1790
1886
|
if (!open || !enabled || !escapeKey || event.key !== 'Escape') {
|
|
1791
1887
|
return;
|
|
1792
1888
|
}
|
|
1889
|
+
const nodeId = (_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.nodeId;
|
|
1793
1890
|
const children = tree ? getChildren(tree.nodesRef.current, nodeId) : [];
|
|
1794
1891
|
if (!escapeKeyBubbles) {
|
|
1795
1892
|
event.stopPropagation();
|
|
@@ -1819,6 +1916,7 @@ function useDismiss(context, props) {
|
|
|
1819
1916
|
(_getTarget2 = floatingUi_react_utils.getTarget(event)) == null || _getTarget2.addEventListener('keydown', callback);
|
|
1820
1917
|
});
|
|
1821
1918
|
const closeOnPressOutside = useEffectEvent(event => {
|
|
1919
|
+
var _dataRef$current$floa2;
|
|
1822
1920
|
// Given developers can stop the propagation of the synthetic event,
|
|
1823
1921
|
// we can only be confident with a positive value.
|
|
1824
1922
|
const insideReactTree = insideReactTreeRef.current;
|
|
@@ -1841,11 +1939,11 @@ function useDismiss(context, props) {
|
|
|
1841
1939
|
}
|
|
1842
1940
|
const target = floatingUi_react_utils.getTarget(event);
|
|
1843
1941
|
const inertSelector = "[" + createAttribute('inert') + "]";
|
|
1844
|
-
const markers = floatingUi_react_utils.getDocument(floating).querySelectorAll(inertSelector);
|
|
1845
|
-
let targetRootAncestor = floatingUi_utils_dom.isElement(target) ? target : null;
|
|
1846
|
-
while (targetRootAncestor && !floatingUi_utils_dom.isLastTraversableNode(targetRootAncestor)) {
|
|
1847
|
-
const nextParent = floatingUi_utils_dom.getParentNode(targetRootAncestor);
|
|
1848
|
-
if (floatingUi_utils_dom.isLastTraversableNode(nextParent) || !floatingUi_utils_dom.isElement(nextParent)) {
|
|
1942
|
+
const markers = floatingUi_react_utils.getDocument(elements.floating).querySelectorAll(inertSelector);
|
|
1943
|
+
let targetRootAncestor = floatingUi_utils_dom$1.isElement(target) ? target : null;
|
|
1944
|
+
while (targetRootAncestor && !floatingUi_utils_dom$1.isLastTraversableNode(targetRootAncestor)) {
|
|
1945
|
+
const nextParent = floatingUi_utils_dom$1.getParentNode(targetRootAncestor);
|
|
1946
|
+
if (floatingUi_utils_dom$1.isLastTraversableNode(nextParent) || !floatingUi_utils_dom$1.isElement(nextParent)) {
|
|
1849
1947
|
break;
|
|
1850
1948
|
}
|
|
1851
1949
|
targetRootAncestor = nextParent;
|
|
@@ -1853,9 +1951,9 @@ function useDismiss(context, props) {
|
|
|
1853
1951
|
|
|
1854
1952
|
// Check if the click occurred on a third-party element injected after the
|
|
1855
1953
|
// floating element rendered.
|
|
1856
|
-
if (markers.length && floatingUi_utils_dom.isElement(target) && !floatingUi_react_utils.isRootElement(target) &&
|
|
1954
|
+
if (markers.length && floatingUi_utils_dom$1.isElement(target) && !floatingUi_react_utils.isRootElement(target) &&
|
|
1857
1955
|
// Clicked on a direct ancestor (e.g. FloatingOverlay).
|
|
1858
|
-
!floatingUi_react_utils.contains(target, floating) &&
|
|
1956
|
+
!floatingUi_react_utils.contains(target, elements.floating) &&
|
|
1859
1957
|
// If the target root element contains none of the markers, then the
|
|
1860
1958
|
// element was injected after the floating element rendered.
|
|
1861
1959
|
Array.from(markers).every(marker => !floatingUi_react_utils.contains(targetRootAncestor, marker))) {
|
|
@@ -1863,7 +1961,7 @@ function useDismiss(context, props) {
|
|
|
1863
1961
|
}
|
|
1864
1962
|
|
|
1865
1963
|
// Check if the click occurred on the scrollbar
|
|
1866
|
-
if (floatingUi_utils_dom.isHTMLElement(target) && floating) {
|
|
1964
|
+
if (floatingUi_utils_dom$1.isHTMLElement(target) && floating) {
|
|
1867
1965
|
// In Firefox, `target.scrollWidth > target.clientWidth` for inline
|
|
1868
1966
|
// elements.
|
|
1869
1967
|
const canScrollX = target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
|
|
@@ -1875,7 +1973,7 @@ function useDismiss(context, props) {
|
|
|
1875
1973
|
// check for. Plus, for modal dialogs with backdrops, it is more
|
|
1876
1974
|
// important that the backdrop is checked but not so much the window.
|
|
1877
1975
|
if (canScrollY) {
|
|
1878
|
-
const isRTL = floatingUi_utils_dom.getComputedStyle(target).direction === 'rtl';
|
|
1976
|
+
const isRTL = floatingUi_utils_dom$1.getComputedStyle(target).direction === 'rtl';
|
|
1879
1977
|
if (isRTL) {
|
|
1880
1978
|
xCond = event.offsetX <= target.offsetWidth - target.clientWidth;
|
|
1881
1979
|
}
|
|
@@ -1884,11 +1982,12 @@ function useDismiss(context, props) {
|
|
|
1884
1982
|
return;
|
|
1885
1983
|
}
|
|
1886
1984
|
}
|
|
1985
|
+
const nodeId = (_dataRef$current$floa2 = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa2.nodeId;
|
|
1887
1986
|
const targetIsInsideChildren = tree && getChildren(tree.nodesRef.current, nodeId).some(node => {
|
|
1888
1987
|
var _node$context;
|
|
1889
1988
|
return floatingUi_react_utils.isEventTargetWithin(event, (_node$context = node.context) == null ? void 0 : _node$context.elements.floating);
|
|
1890
1989
|
});
|
|
1891
|
-
if (floatingUi_react_utils.isEventTargetWithin(event, floating) || floatingUi_react_utils.isEventTargetWithin(event, domReference) || targetIsInsideChildren) {
|
|
1990
|
+
if (floatingUi_react_utils.isEventTargetWithin(event, elements.floating) || floatingUi_react_utils.isEventTargetWithin(event, elements.domReference) || targetIsInsideChildren) {
|
|
1892
1991
|
return;
|
|
1893
1992
|
}
|
|
1894
1993
|
const children = tree ? getChildren(tree.nodesRef.current, nodeId) : [];
|
|
@@ -1925,19 +2024,19 @@ function useDismiss(context, props) {
|
|
|
1925
2024
|
function onScroll(event) {
|
|
1926
2025
|
onOpenChange(false, event, 'ancestor-scroll');
|
|
1927
2026
|
}
|
|
1928
|
-
const doc = floatingUi_react_utils.getDocument(floating);
|
|
2027
|
+
const doc = floatingUi_react_utils.getDocument(elements.floating);
|
|
1929
2028
|
escapeKey && doc.addEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
|
|
1930
2029
|
outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
|
|
1931
2030
|
let ancestors = [];
|
|
1932
2031
|
if (ancestorScroll) {
|
|
1933
|
-
if (floatingUi_utils_dom.isElement(domReference)) {
|
|
1934
|
-
ancestors = floatingUi_utils_dom.getOverflowAncestors(domReference);
|
|
2032
|
+
if (floatingUi_utils_dom$1.isElement(elements.domReference)) {
|
|
2033
|
+
ancestors = floatingUi_utils_dom.getOverflowAncestors(elements.domReference);
|
|
1935
2034
|
}
|
|
1936
|
-
if (floatingUi_utils_dom.isElement(floating)) {
|
|
1937
|
-
ancestors = ancestors.concat(floatingUi_utils_dom.getOverflowAncestors(floating));
|
|
2035
|
+
if (floatingUi_utils_dom$1.isElement(elements.floating)) {
|
|
2036
|
+
ancestors = ancestors.concat(floatingUi_utils_dom.getOverflowAncestors(elements.floating));
|
|
1938
2037
|
}
|
|
1939
|
-
if (!floatingUi_utils_dom.isElement(reference) && reference && reference.contextElement) {
|
|
1940
|
-
ancestors = ancestors.concat(floatingUi_utils_dom.getOverflowAncestors(reference.contextElement));
|
|
2038
|
+
if (!floatingUi_utils_dom$1.isElement(elements.reference) && elements.reference && elements.reference.contextElement) {
|
|
2039
|
+
ancestors = ancestors.concat(floatingUi_utils_dom.getOverflowAncestors(elements.reference.contextElement));
|
|
1941
2040
|
}
|
|
1942
2041
|
}
|
|
1943
2042
|
|
|
@@ -1958,37 +2057,80 @@ function useDismiss(context, props) {
|
|
|
1958
2057
|
ancestor.removeEventListener('scroll', onScroll);
|
|
1959
2058
|
});
|
|
1960
2059
|
};
|
|
1961
|
-
}, [dataRef,
|
|
2060
|
+
}, [dataRef, elements, escapeKey, outsidePress, outsidePressEvent, open, onOpenChange, ancestorScroll, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, escapeKeyCapture, closeOnEscapeKeyDownCapture, closeOnPressOutside, outsidePressCapture, closeOnPressOutsideCapture]);
|
|
1962
2061
|
React__namespace.useEffect(() => {
|
|
1963
2062
|
insideReactTreeRef.current = false;
|
|
1964
2063
|
}, [outsidePress, outsidePressEvent]);
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
2064
|
+
const reference = React__namespace.useMemo(() => ({
|
|
2065
|
+
onKeyDown: closeOnEscapeKeyDown,
|
|
2066
|
+
[bubbleHandlerKeys[referencePressEvent]]: event => {
|
|
2067
|
+
if (referencePress) {
|
|
2068
|
+
onOpenChange(false, event.nativeEvent, 'reference-press');
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
}), [closeOnEscapeKeyDown, onOpenChange, referencePress, referencePressEvent]);
|
|
2072
|
+
const floating = React__namespace.useMemo(() => ({
|
|
2073
|
+
onKeyDown: closeOnEscapeKeyDown,
|
|
2074
|
+
onMouseDown() {
|
|
2075
|
+
endedOrStartedInsideRef.current = true;
|
|
2076
|
+
},
|
|
2077
|
+
onMouseUp() {
|
|
2078
|
+
endedOrStartedInsideRef.current = true;
|
|
2079
|
+
},
|
|
2080
|
+
[captureHandlerKeys[outsidePressEvent]]: () => {
|
|
2081
|
+
insideReactTreeRef.current = true;
|
|
2082
|
+
}
|
|
2083
|
+
}), [closeOnEscapeKeyDown, outsidePressEvent]);
|
|
2084
|
+
return React__namespace.useMemo(() => enabled ? {
|
|
2085
|
+
reference,
|
|
2086
|
+
floating
|
|
2087
|
+
} : {}, [enabled, reference, floating]);
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
function useFloatingRootContext(options) {
|
|
2091
|
+
const {
|
|
2092
|
+
open = false,
|
|
2093
|
+
onOpenChange: onOpenChangeProp,
|
|
2094
|
+
elements: elementsProp
|
|
2095
|
+
} = options;
|
|
2096
|
+
const floatingId = useId();
|
|
2097
|
+
const dataRef = React__namespace.useRef({});
|
|
2098
|
+
const [events] = React__namespace.useState(() => createPubSub());
|
|
2099
|
+
const nested = useFloatingParentNodeId() != null;
|
|
2100
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2101
|
+
const optionDomReference = elementsProp.reference;
|
|
2102
|
+
if (optionDomReference && !floatingUi_utils_dom$1.isElement(optionDomReference)) {
|
|
2103
|
+
error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `refs.setPositionReference()`', 'instead.');
|
|
1968
2104
|
}
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
2105
|
+
}
|
|
2106
|
+
const [positionReference, setPositionReference] = React__namespace.useState(elementsProp.reference);
|
|
2107
|
+
const onOpenChange = useEffectEvent((open, event, reason) => {
|
|
2108
|
+
dataRef.current.openEvent = open ? event : undefined;
|
|
2109
|
+
events.emit('openchange', {
|
|
2110
|
+
open,
|
|
2111
|
+
event,
|
|
2112
|
+
reason,
|
|
2113
|
+
nested
|
|
2114
|
+
});
|
|
2115
|
+
onOpenChangeProp == null || onOpenChangeProp(open, event, reason);
|
|
2116
|
+
});
|
|
2117
|
+
const refs = React__namespace.useMemo(() => ({
|
|
2118
|
+
setPositionReference
|
|
2119
|
+
}), []);
|
|
2120
|
+
const elements = React__namespace.useMemo(() => ({
|
|
2121
|
+
reference: positionReference || elementsProp.reference || null,
|
|
2122
|
+
floating: elementsProp.floating || null,
|
|
2123
|
+
domReference: elementsProp.reference
|
|
2124
|
+
}), [positionReference, elementsProp.reference, elementsProp.floating]);
|
|
2125
|
+
return React__namespace.useMemo(() => ({
|
|
2126
|
+
dataRef,
|
|
2127
|
+
open,
|
|
2128
|
+
onOpenChange,
|
|
2129
|
+
elements,
|
|
2130
|
+
events,
|
|
2131
|
+
floatingId,
|
|
2132
|
+
refs
|
|
2133
|
+
}), [open, onOpenChange, elements, events, floatingId, refs]);
|
|
1992
2134
|
}
|
|
1993
2135
|
|
|
1994
2136
|
/**
|
|
@@ -1996,24 +2138,28 @@ function useDismiss(context, props) {
|
|
|
1996
2138
|
* @see https://floating-ui.com/docs/useFloating
|
|
1997
2139
|
*/
|
|
1998
2140
|
function useFloating(options) {
|
|
1999
|
-
var _options$elements;
|
|
2000
2141
|
if (options === void 0) {
|
|
2001
2142
|
options = {};
|
|
2002
2143
|
}
|
|
2003
2144
|
const {
|
|
2004
|
-
open = false,
|
|
2005
|
-
onOpenChange: unstable_onOpenChange,
|
|
2006
2145
|
nodeId
|
|
2007
2146
|
} = options;
|
|
2147
|
+
const internalRootContext = useFloatingRootContext({
|
|
2148
|
+
...options,
|
|
2149
|
+
elements: {
|
|
2150
|
+
reference: null,
|
|
2151
|
+
floating: null,
|
|
2152
|
+
...options.elements
|
|
2153
|
+
}
|
|
2154
|
+
});
|
|
2155
|
+
const rootContext = options.rootContext || internalRootContext;
|
|
2156
|
+
const computedElements = rootContext.elements;
|
|
2008
2157
|
const [_domReference, setDomReference] = React__namespace.useState(null);
|
|
2009
2158
|
const [positionReference, _setPositionReference] = React__namespace.useState(null);
|
|
2010
|
-
const optionDomReference =
|
|
2159
|
+
const optionDomReference = computedElements == null ? void 0 : computedElements.reference;
|
|
2011
2160
|
const domReference = optionDomReference || _domReference;
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `refs.setPositionReference()`', 'instead.');
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2161
|
+
const domReferenceRef = React__namespace.useRef(null);
|
|
2162
|
+
const tree = useFloatingTree();
|
|
2017
2163
|
index(() => {
|
|
2018
2164
|
if (domReference) {
|
|
2019
2165
|
domReferenceRef.current = domReference;
|
|
@@ -2022,30 +2168,14 @@ function useFloating(options) {
|
|
|
2022
2168
|
const position = floatingUi_reactDom.useFloating({
|
|
2023
2169
|
...options,
|
|
2024
2170
|
elements: {
|
|
2025
|
-
...
|
|
2171
|
+
...computedElements,
|
|
2026
2172
|
...(positionReference && {
|
|
2027
2173
|
reference: positionReference
|
|
2028
2174
|
})
|
|
2029
2175
|
}
|
|
2030
2176
|
});
|
|
2031
|
-
const tree = useFloatingTree();
|
|
2032
|
-
const nested = useFloatingParentNodeId() != null;
|
|
2033
|
-
const onOpenChange = useEffectEvent((open, event, reason) => {
|
|
2034
|
-
dataRef.current.openEvent = open ? event : undefined;
|
|
2035
|
-
events.emit('openchange', {
|
|
2036
|
-
open,
|
|
2037
|
-
event,
|
|
2038
|
-
reason,
|
|
2039
|
-
nested
|
|
2040
|
-
});
|
|
2041
|
-
unstable_onOpenChange == null || unstable_onOpenChange(open, event, reason);
|
|
2042
|
-
});
|
|
2043
|
-
const domReferenceRef = React__namespace.useRef(null);
|
|
2044
|
-
const dataRef = React__namespace.useRef({});
|
|
2045
|
-
const events = React__namespace.useState(() => createPubSub())[0];
|
|
2046
|
-
const floatingId = useId();
|
|
2047
2177
|
const setPositionReference = React__namespace.useCallback(node => {
|
|
2048
|
-
const computedPositionReference = floatingUi_utils_dom.isElement(node) ? {
|
|
2178
|
+
const computedPositionReference = floatingUi_utils_dom$1.isElement(node) ? {
|
|
2049
2179
|
getBoundingClientRect: () => node.getBoundingClientRect(),
|
|
2050
2180
|
contextElement: node
|
|
2051
2181
|
} : node;
|
|
@@ -2055,18 +2185,18 @@ function useFloating(options) {
|
|
|
2055
2185
|
position.refs.setReference(computedPositionReference);
|
|
2056
2186
|
}, [position.refs]);
|
|
2057
2187
|
const setReference = React__namespace.useCallback(node => {
|
|
2058
|
-
if (floatingUi_utils_dom.isElement(node) || node === null) {
|
|
2188
|
+
if (floatingUi_utils_dom$1.isElement(node) || node === null) {
|
|
2059
2189
|
domReferenceRef.current = node;
|
|
2060
2190
|
setDomReference(node);
|
|
2061
2191
|
}
|
|
2062
2192
|
|
|
2063
2193
|
// Backwards-compatibility for passing a virtual element to `reference`
|
|
2064
2194
|
// after it has set the DOM reference.
|
|
2065
|
-
if (floatingUi_utils_dom.isElement(position.refs.reference.current) || position.refs.reference.current === null ||
|
|
2195
|
+
if (floatingUi_utils_dom$1.isElement(position.refs.reference.current) || position.refs.reference.current === null ||
|
|
2066
2196
|
// Don't allow setting virtual elements using the old technique back to
|
|
2067
2197
|
// `null` to support `positionReference` + an unstable `reference`
|
|
2068
2198
|
// callback ref.
|
|
2069
|
-
node !== null && !floatingUi_utils_dom.isElement(node)) {
|
|
2199
|
+
node !== null && !floatingUi_utils_dom$1.isElement(node)) {
|
|
2070
2200
|
position.refs.setReference(node);
|
|
2071
2201
|
}
|
|
2072
2202
|
}, [position.refs]);
|
|
@@ -2082,16 +2212,13 @@ function useFloating(options) {
|
|
|
2082
2212
|
}), [position.elements, domReference]);
|
|
2083
2213
|
const context = React__namespace.useMemo(() => ({
|
|
2084
2214
|
...position,
|
|
2215
|
+
...rootContext,
|
|
2085
2216
|
refs,
|
|
2086
2217
|
elements,
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
floatingId,
|
|
2090
|
-
events,
|
|
2091
|
-
open,
|
|
2092
|
-
onOpenChange
|
|
2093
|
-
}), [position, nodeId, floatingId, events, open, onOpenChange, refs, elements]);
|
|
2218
|
+
nodeId
|
|
2219
|
+
}), [position, refs, elements, nodeId, rootContext]);
|
|
2094
2220
|
index(() => {
|
|
2221
|
+
rootContext.dataRef.current.floatingContext = context;
|
|
2095
2222
|
const node = tree == null ? void 0 : tree.nodesRef.current.find(node => node.id === nodeId);
|
|
2096
2223
|
if (node) {
|
|
2097
2224
|
node.context = context;
|
|
@@ -2118,10 +2245,8 @@ function useFocus(context, props) {
|
|
|
2118
2245
|
open,
|
|
2119
2246
|
onOpenChange,
|
|
2120
2247
|
events,
|
|
2121
|
-
|
|
2122
|
-
elements
|
|
2123
|
-
domReference
|
|
2124
|
-
}
|
|
2248
|
+
dataRef,
|
|
2249
|
+
elements
|
|
2125
2250
|
} = context;
|
|
2126
2251
|
const {
|
|
2127
2252
|
enabled = true,
|
|
@@ -2131,16 +2256,14 @@ function useFocus(context, props) {
|
|
|
2131
2256
|
const timeoutRef = React__namespace.useRef();
|
|
2132
2257
|
const keyboardModalityRef = React__namespace.useRef(true);
|
|
2133
2258
|
React__namespace.useEffect(() => {
|
|
2134
|
-
if (!enabled)
|
|
2135
|
-
|
|
2136
|
-
}
|
|
2137
|
-
const win = floatingUi_utils_dom.getWindow(domReference);
|
|
2259
|
+
if (!enabled) return;
|
|
2260
|
+
const win = floatingUi_utils_dom$1.getWindow(elements.domReference);
|
|
2138
2261
|
|
|
2139
2262
|
// If the reference was focused and the user left the tab/window, and the
|
|
2140
2263
|
// floating element was not open, the focus should be blocked when they
|
|
2141
2264
|
// return to the tab/window.
|
|
2142
2265
|
function onBlur() {
|
|
2143
|
-
if (!open && floatingUi_utils_dom.isHTMLElement(domReference) && domReference === floatingUi_react_utils.activeElement(floatingUi_react_utils.getDocument(domReference))) {
|
|
2266
|
+
if (!open && floatingUi_utils_dom$1.isHTMLElement(elements.domReference) && elements.domReference === floatingUi_react_utils.activeElement(floatingUi_react_utils.getDocument(elements.domReference))) {
|
|
2144
2267
|
blockFocusRef.current = true;
|
|
2145
2268
|
}
|
|
2146
2269
|
}
|
|
@@ -2153,11 +2276,9 @@ function useFocus(context, props) {
|
|
|
2153
2276
|
win.removeEventListener('blur', onBlur);
|
|
2154
2277
|
win.removeEventListener('keydown', onKeyDown, true);
|
|
2155
2278
|
};
|
|
2156
|
-
}, [domReference, open, enabled]);
|
|
2279
|
+
}, [elements.domReference, open, enabled]);
|
|
2157
2280
|
React__namespace.useEffect(() => {
|
|
2158
|
-
if (!enabled)
|
|
2159
|
-
return;
|
|
2160
|
-
}
|
|
2281
|
+
if (!enabled) return;
|
|
2161
2282
|
function onOpenChange(_ref) {
|
|
2162
2283
|
let {
|
|
2163
2284
|
reason
|
|
@@ -2176,69 +2297,67 @@ function useFocus(context, props) {
|
|
|
2176
2297
|
clearTimeout(timeoutRef.current);
|
|
2177
2298
|
};
|
|
2178
2299
|
}, []);
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
return
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
if
|
|
2194
|
-
|
|
2195
|
-
if (
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
if (!target.matches(':focus-visible')) return;
|
|
2202
|
-
} catch (e) {
|
|
2203
|
-
// Old browsers will throw an error when using `:focus-visible`.
|
|
2204
|
-
if (!keyboardModalityRef.current && !floatingUi_react_utils.isTypeableElement(target)) {
|
|
2205
|
-
return;
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2300
|
+
const reference = React__namespace.useMemo(() => ({
|
|
2301
|
+
onPointerDown(event) {
|
|
2302
|
+
if (floatingUi_react_utils.isVirtualPointerEvent(event.nativeEvent)) return;
|
|
2303
|
+
keyboardModalityRef.current = false;
|
|
2304
|
+
},
|
|
2305
|
+
onMouseLeave() {
|
|
2306
|
+
blockFocusRef.current = false;
|
|
2307
|
+
},
|
|
2308
|
+
onFocus(event) {
|
|
2309
|
+
if (blockFocusRef.current) return;
|
|
2310
|
+
const target = floatingUi_react_utils.getTarget(event.nativeEvent);
|
|
2311
|
+
if (visibleOnly && floatingUi_utils_dom$1.isElement(target)) {
|
|
2312
|
+
try {
|
|
2313
|
+
// Mac Safari unreliably matches `:focus-visible` on the reference
|
|
2314
|
+
// if focus was outside the page initially - use the fallback
|
|
2315
|
+
// instead.
|
|
2316
|
+
if (floatingUi_react_utils.isSafari() && floatingUi_react_utils.isMac()) throw Error();
|
|
2317
|
+
if (!target.matches(':focus-visible')) return;
|
|
2318
|
+
} catch (e) {
|
|
2319
|
+
// Old browsers will throw an error when using `:focus-visible`.
|
|
2320
|
+
if (!keyboardModalityRef.current && !floatingUi_react_utils.isTypeableElement(target)) {
|
|
2321
|
+
return;
|
|
2208
2322
|
}
|
|
2209
|
-
onOpenChange(true, event.nativeEvent, 'focus');
|
|
2210
|
-
},
|
|
2211
|
-
onBlur(event) {
|
|
2212
|
-
blockFocusRef.current = false;
|
|
2213
|
-
const relatedTarget = event.relatedTarget;
|
|
2214
|
-
|
|
2215
|
-
// Hit the non-modal focus management portal guard. Focus will be
|
|
2216
|
-
// moved into the floating element immediately after.
|
|
2217
|
-
const movedToFocusGuard = floatingUi_utils_dom.isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute('focus-guard')) && relatedTarget.getAttribute('data-type') === 'outside';
|
|
2218
|
-
|
|
2219
|
-
// Wait for the window blur listener to fire.
|
|
2220
|
-
timeoutRef.current = window.setTimeout(() => {
|
|
2221
|
-
const activeEl = floatingUi_react_utils.activeElement(domReference ? domReference.ownerDocument : document);
|
|
2222
|
-
|
|
2223
|
-
// Focus left the page, keep it open.
|
|
2224
|
-
if (!relatedTarget && activeEl === domReference) return;
|
|
2225
|
-
|
|
2226
|
-
// When focusing the reference element (e.g. regular click), then
|
|
2227
|
-
// clicking into the floating element, prevent it from hiding.
|
|
2228
|
-
// Note: it must be focusable, e.g. `tabindex="-1"`.
|
|
2229
|
-
// We can not rely on relatedTarget to point to the correct element
|
|
2230
|
-
// as it will only point to the shadow host of the newly focused element
|
|
2231
|
-
// and not the element that actually has received focus if it is located
|
|
2232
|
-
// inside a shadow root.
|
|
2233
|
-
if (floatingUi_react_utils.contains(refs.floating.current, activeEl) || floatingUi_react_utils.contains(domReference, activeEl) || movedToFocusGuard) {
|
|
2234
|
-
return;
|
|
2235
|
-
}
|
|
2236
|
-
onOpenChange(false, event.nativeEvent, 'focus');
|
|
2237
|
-
});
|
|
2238
2323
|
}
|
|
2239
2324
|
}
|
|
2240
|
-
|
|
2241
|
-
|
|
2325
|
+
onOpenChange(true, event.nativeEvent, 'focus');
|
|
2326
|
+
},
|
|
2327
|
+
onBlur(event) {
|
|
2328
|
+
blockFocusRef.current = false;
|
|
2329
|
+
const relatedTarget = event.relatedTarget;
|
|
2330
|
+
const nativeEvent = event.nativeEvent;
|
|
2331
|
+
|
|
2332
|
+
// Hit the non-modal focus management portal guard. Focus will be
|
|
2333
|
+
// moved into the floating element immediately after.
|
|
2334
|
+
const movedToFocusGuard = floatingUi_utils_dom$1.isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute('focus-guard')) && relatedTarget.getAttribute('data-type') === 'outside';
|
|
2335
|
+
|
|
2336
|
+
// Wait for the window blur listener to fire.
|
|
2337
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
2338
|
+
var _dataRef$current$floa;
|
|
2339
|
+
const activeEl = floatingUi_react_utils.activeElement(elements.domReference ? elements.domReference.ownerDocument : document);
|
|
2340
|
+
|
|
2341
|
+
// Focus left the page, keep it open.
|
|
2342
|
+
if (!relatedTarget && activeEl === elements.domReference) return;
|
|
2343
|
+
|
|
2344
|
+
// When focusing the reference element (e.g. regular click), then
|
|
2345
|
+
// clicking into the floating element, prevent it from hiding.
|
|
2346
|
+
// Note: it must be focusable, e.g. `tabindex="-1"`.
|
|
2347
|
+
// We can not rely on relatedTarget to point to the correct element
|
|
2348
|
+
// as it will only point to the shadow host of the newly focused element
|
|
2349
|
+
// and not the element that actually has received focus if it is located
|
|
2350
|
+
// inside a shadow root.
|
|
2351
|
+
if (floatingUi_react_utils.contains((_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.refs.floating.current, activeEl) || floatingUi_react_utils.contains(elements.domReference, activeEl) || movedToFocusGuard) {
|
|
2352
|
+
return;
|
|
2353
|
+
}
|
|
2354
|
+
onOpenChange(false, nativeEvent, 'focus');
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2357
|
+
}), [dataRef, elements.domReference, onOpenChange, visibleOnly]);
|
|
2358
|
+
return React__namespace.useMemo(() => enabled ? {
|
|
2359
|
+
reference
|
|
2360
|
+
} : {}, [enabled, reference]);
|
|
2242
2361
|
}
|
|
2243
2362
|
|
|
2244
2363
|
const ACTIVE_KEY = 'active';
|
|
@@ -2298,7 +2417,6 @@ function mergeProps(userProps, propsList, elementKey) {
|
|
|
2298
2417
|
}, {})
|
|
2299
2418
|
};
|
|
2300
2419
|
}
|
|
2301
|
-
|
|
2302
2420
|
/**
|
|
2303
2421
|
* Merges an array of interaction hooks' props into prop getters, allowing
|
|
2304
2422
|
* event handler functions to be composed together without overwriting one
|
|
@@ -2309,22 +2427,18 @@ function useInteractions(propsList) {
|
|
|
2309
2427
|
if (propsList === void 0) {
|
|
2310
2428
|
propsList = [];
|
|
2311
2429
|
}
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
const
|
|
2430
|
+
const referenceDeps = propsList.map(key => key == null ? void 0 : key.reference);
|
|
2431
|
+
const floatingDeps = propsList.map(key => key == null ? void 0 : key.floating);
|
|
2432
|
+
const itemDeps = propsList.map(key => key == null ? void 0 : key.item);
|
|
2315
2433
|
const getReferenceProps = React__namespace.useCallback(userProps => mergeProps(userProps, propsList, 'reference'),
|
|
2316
2434
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2317
|
-
|
|
2435
|
+
referenceDeps);
|
|
2318
2436
|
const getFloatingProps = React__namespace.useCallback(userProps => mergeProps(userProps, propsList, 'floating'),
|
|
2319
2437
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2320
|
-
|
|
2438
|
+
floatingDeps);
|
|
2321
2439
|
const getItemProps = React__namespace.useCallback(userProps => mergeProps(userProps, propsList, 'item'),
|
|
2322
|
-
// Granularly check for `item` changes, because the `getItemProps` getter
|
|
2323
|
-
// should be as referentially stable as possible since it may be passed as
|
|
2324
|
-
// a prop to many components. All `item` key values must therefore be
|
|
2325
|
-
// memoized.
|
|
2326
2440
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2327
|
-
|
|
2441
|
+
itemDeps);
|
|
2328
2442
|
return React__namespace.useMemo(() => ({
|
|
2329
2443
|
getReferenceProps,
|
|
2330
2444
|
getFloatingProps,
|
|
@@ -2372,11 +2486,7 @@ function useListNavigation(context, props) {
|
|
|
2372
2486
|
const {
|
|
2373
2487
|
open,
|
|
2374
2488
|
onOpenChange,
|
|
2375
|
-
|
|
2376
|
-
elements: {
|
|
2377
|
-
domReference,
|
|
2378
|
-
floating
|
|
2379
|
-
}
|
|
2489
|
+
elements
|
|
2380
2490
|
} = context;
|
|
2381
2491
|
const {
|
|
2382
2492
|
listRef,
|
|
@@ -2421,47 +2531,59 @@ function useListNavigation(context, props) {
|
|
|
2421
2531
|
const keyRef = React__namespace.useRef(null);
|
|
2422
2532
|
const isPointerModalityRef = React__namespace.useRef(true);
|
|
2423
2533
|
const previousOnNavigateRef = React__namespace.useRef(onNavigate);
|
|
2424
|
-
const previousMountedRef = React__namespace.useRef(!!floating);
|
|
2534
|
+
const previousMountedRef = React__namespace.useRef(!!elements.floating);
|
|
2535
|
+
const previousOpenRef = React__namespace.useRef(open);
|
|
2425
2536
|
const forceSyncFocus = React__namespace.useRef(false);
|
|
2426
2537
|
const forceScrollIntoViewRef = React__namespace.useRef(false);
|
|
2427
2538
|
const disabledIndicesRef = useLatestRef(disabledIndices);
|
|
2428
2539
|
const latestOpenRef = useLatestRef(open);
|
|
2429
2540
|
const scrollItemIntoViewRef = useLatestRef(scrollItemIntoView);
|
|
2541
|
+
const floatingRef = useLatestRef(elements.floating);
|
|
2542
|
+
const selectedIndexRef = useLatestRef(selectedIndex);
|
|
2430
2543
|
const [activeId, setActiveId] = React__namespace.useState();
|
|
2431
2544
|
const [virtualId, setVirtualId] = React__namespace.useState();
|
|
2432
2545
|
const focusItem = useEffectEvent(function (listRef, indexRef, forceScrollIntoView) {
|
|
2433
2546
|
if (forceScrollIntoView === void 0) {
|
|
2434
2547
|
forceScrollIntoView = false;
|
|
2435
2548
|
}
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2549
|
+
function runFocus(item) {
|
|
2550
|
+
if (virtual) {
|
|
2551
|
+
setActiveId(item.id);
|
|
2552
|
+
tree == null || tree.events.emit('virtualfocus', item);
|
|
2553
|
+
if (virtualItemRef) {
|
|
2554
|
+
virtualItemRef.current = item;
|
|
2555
|
+
}
|
|
2556
|
+
} else {
|
|
2557
|
+
enqueueFocus(item, {
|
|
2558
|
+
preventScroll: true,
|
|
2559
|
+
// Mac Safari does not move the virtual cursor unless the focus call
|
|
2560
|
+
// is sync. However, for the very first focus call, we need to wait
|
|
2561
|
+
// for the position to be ready in order to prevent unwanted
|
|
2562
|
+
// scrolling. This means the virtual cursor will not move to the first
|
|
2563
|
+
// item when first opening the floating element, but will on
|
|
2564
|
+
// subsequent calls. `preventScroll` is supported in modern Safari,
|
|
2565
|
+
// so we can use that instead.
|
|
2566
|
+
// iOS Safari must be async or the first item will not be focused.
|
|
2567
|
+
sync: floatingUi_react_utils.isMac() && floatingUi_react_utils.isSafari() ? isPreventScrollSupported || forceSyncFocus.current : false
|
|
2568
|
+
});
|
|
2443
2569
|
}
|
|
2444
|
-
}
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
// is sync. However, for the very first focus call, we need to wait
|
|
2449
|
-
// for the position to be ready in order to prevent unwanted
|
|
2450
|
-
// scrolling. This means the virtual cursor will not move to the first
|
|
2451
|
-
// item when first opening the floating element, but will on
|
|
2452
|
-
// subsequent calls. `preventScroll` is supported in modern Safari,
|
|
2453
|
-
// so we can use that instead.
|
|
2454
|
-
// iOS Safari must be async or the first item will not be focused.
|
|
2455
|
-
sync: floatingUi_react_utils.isMac() && floatingUi_react_utils.isSafari() ? isPreventScrollSupported || forceSyncFocus.current : false
|
|
2456
|
-
});
|
|
2570
|
+
}
|
|
2571
|
+
const initialItem = listRef.current[indexRef.current];
|
|
2572
|
+
if (initialItem) {
|
|
2573
|
+
runFocus(initialItem);
|
|
2457
2574
|
}
|
|
2458
2575
|
requestAnimationFrame(() => {
|
|
2576
|
+
const waitedItem = listRef.current[indexRef.current] || initialItem;
|
|
2577
|
+
if (!waitedItem) return;
|
|
2578
|
+
if (!initialItem) {
|
|
2579
|
+
runFocus(waitedItem);
|
|
2580
|
+
}
|
|
2459
2581
|
const scrollIntoViewOptions = scrollItemIntoViewRef.current;
|
|
2460
2582
|
const shouldScrollIntoView = scrollIntoViewOptions && item && (forceScrollIntoView || !isPointerModalityRef.current);
|
|
2461
2583
|
if (shouldScrollIntoView) {
|
|
2462
2584
|
// JSDOM doesn't support `.scrollIntoView()` but it's widely supported
|
|
2463
2585
|
// by all browsers.
|
|
2464
|
-
|
|
2586
|
+
waitedItem.scrollIntoView == null || waitedItem.scrollIntoView(typeof scrollIntoViewOptions === 'boolean' ? {
|
|
2465
2587
|
block: 'nearest',
|
|
2466
2588
|
inline: 'nearest'
|
|
2467
2589
|
} : scrollIntoViewOptions);
|
|
@@ -2480,10 +2602,8 @@ function useListNavigation(context, props) {
|
|
|
2480
2602
|
// Sync `selectedIndex` to be the `activeIndex` upon opening the floating
|
|
2481
2603
|
// element. Also, reset `activeIndex` upon closing the floating element.
|
|
2482
2604
|
index(() => {
|
|
2483
|
-
if (!enabled)
|
|
2484
|
-
|
|
2485
|
-
}
|
|
2486
|
-
if (open && floating) {
|
|
2605
|
+
if (!enabled) return;
|
|
2606
|
+
if (open && elements.floating) {
|
|
2487
2607
|
if (focusItemOnOpenRef.current && selectedIndex != null) {
|
|
2488
2608
|
// Regardless of the pointer modality, we want to ensure the selected
|
|
2489
2609
|
// item comes into view when the floating element is opened.
|
|
@@ -2498,18 +2618,16 @@ function useListNavigation(context, props) {
|
|
|
2498
2618
|
indexRef.current = -1;
|
|
2499
2619
|
previousOnNavigateRef.current(null);
|
|
2500
2620
|
}
|
|
2501
|
-
}, [enabled, open, floating, selectedIndex, onNavigate]);
|
|
2621
|
+
}, [enabled, open, elements.floating, selectedIndex, onNavigate]);
|
|
2502
2622
|
|
|
2503
2623
|
// Sync `activeIndex` to be the focused item while the floating element is
|
|
2504
2624
|
// open.
|
|
2505
2625
|
index(() => {
|
|
2506
|
-
if (!enabled)
|
|
2507
|
-
|
|
2508
|
-
}
|
|
2509
|
-
if (open && floating) {
|
|
2626
|
+
if (!enabled) return;
|
|
2627
|
+
if (open && elements.floating) {
|
|
2510
2628
|
if (activeIndex == null) {
|
|
2511
2629
|
forceSyncFocus.current = false;
|
|
2512
|
-
if (
|
|
2630
|
+
if (selectedIndexRef.current != null) {
|
|
2513
2631
|
return;
|
|
2514
2632
|
}
|
|
2515
2633
|
|
|
@@ -2520,7 +2638,7 @@ function useListNavigation(context, props) {
|
|
|
2520
2638
|
}
|
|
2521
2639
|
|
|
2522
2640
|
// Initial sync.
|
|
2523
|
-
if (!previousMountedRef.current && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {
|
|
2641
|
+
if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {
|
|
2524
2642
|
let runs = 0;
|
|
2525
2643
|
const waitForListPopulated = () => {
|
|
2526
2644
|
if (listRef.current[0] == null) {
|
|
@@ -2546,27 +2664,30 @@ function useListNavigation(context, props) {
|
|
|
2546
2664
|
forceScrollIntoViewRef.current = false;
|
|
2547
2665
|
}
|
|
2548
2666
|
}
|
|
2549
|
-
}, [enabled, open, floating, activeIndex,
|
|
2667
|
+
}, [enabled, open, elements.floating, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, disabledIndicesRef]);
|
|
2550
2668
|
|
|
2551
2669
|
// Ensure the parent floating element has focus when a nested child closes
|
|
2552
2670
|
// to allow arrow key navigation to work after the pointer leaves the child.
|
|
2553
2671
|
index(() => {
|
|
2554
2672
|
var _nodes$find;
|
|
2555
|
-
if (!enabled || floating || !tree || virtual || !previousMountedRef.current) {
|
|
2673
|
+
if (!enabled || elements.floating || !tree || virtual || !previousMountedRef.current) {
|
|
2556
2674
|
return;
|
|
2557
2675
|
}
|
|
2558
2676
|
const nodes = tree.nodesRef.current;
|
|
2559
2677
|
const parent = (_nodes$find = nodes.find(node => node.id === parentId)) == null || (_nodes$find = _nodes$find.context) == null ? void 0 : _nodes$find.elements.floating;
|
|
2560
|
-
const activeEl = floatingUi_react_utils.activeElement(floatingUi_react_utils.getDocument(floating));
|
|
2678
|
+
const activeEl = floatingUi_react_utils.activeElement(floatingUi_react_utils.getDocument(elements.floating));
|
|
2561
2679
|
const treeContainsActiveEl = nodes.some(node => node.context && floatingUi_react_utils.contains(node.context.elements.floating, activeEl));
|
|
2562
2680
|
if (parent && !treeContainsActiveEl && isPointerModalityRef.current) {
|
|
2563
2681
|
parent.focus({
|
|
2564
2682
|
preventScroll: true
|
|
2565
2683
|
});
|
|
2566
2684
|
}
|
|
2567
|
-
}, [enabled, floating, tree, parentId, virtual]);
|
|
2685
|
+
}, [enabled, elements.floating, tree, parentId, virtual]);
|
|
2568
2686
|
index(() => {
|
|
2569
|
-
if (!enabled
|
|
2687
|
+
if (!enabled) return;
|
|
2688
|
+
if (!tree) return;
|
|
2689
|
+
if (!virtual) return;
|
|
2690
|
+
if (parentId) return;
|
|
2570
2691
|
function handleVirtualFocus(item) {
|
|
2571
2692
|
setVirtualId(item.id);
|
|
2572
2693
|
if (virtualItemRef) {
|
|
@@ -2580,13 +2701,16 @@ function useListNavigation(context, props) {
|
|
|
2580
2701
|
}, [enabled, tree, virtual, parentId, virtualItemRef]);
|
|
2581
2702
|
index(() => {
|
|
2582
2703
|
previousOnNavigateRef.current = onNavigate;
|
|
2583
|
-
previousMountedRef.current = !!floating;
|
|
2704
|
+
previousMountedRef.current = !!elements.floating;
|
|
2584
2705
|
});
|
|
2585
2706
|
index(() => {
|
|
2586
2707
|
if (!open) {
|
|
2587
2708
|
keyRef.current = null;
|
|
2588
2709
|
}
|
|
2589
2710
|
}, [open]);
|
|
2711
|
+
index(() => {
|
|
2712
|
+
previousOpenRef.current = open;
|
|
2713
|
+
}, [open]);
|
|
2590
2714
|
const hasActiveIndex = activeIndex != null;
|
|
2591
2715
|
const item = React__namespace.useMemo(() => {
|
|
2592
2716
|
function syncCurrentTarget(currentTarget) {
|
|
@@ -2630,7 +2754,7 @@ function useListNavigation(context, props) {
|
|
|
2630
2754
|
focusItem(listRef, indexRef);
|
|
2631
2755
|
onNavigate(null);
|
|
2632
2756
|
if (!virtual) {
|
|
2633
|
-
enqueueFocus(
|
|
2757
|
+
enqueueFocus(floatingRef.current, {
|
|
2634
2758
|
preventScroll: true
|
|
2635
2759
|
});
|
|
2636
2760
|
}
|
|
@@ -2638,126 +2762,137 @@ function useListNavigation(context, props) {
|
|
|
2638
2762
|
})
|
|
2639
2763
|
};
|
|
2640
2764
|
return props;
|
|
2641
|
-
}, [open,
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2765
|
+
}, [open, floatingRef, focusItem, focusItemOnHover, listRef, onNavigate, virtual]);
|
|
2766
|
+
const commonOnKeyDown = useEffectEvent(event => {
|
|
2767
|
+
isPointerModalityRef.current = false;
|
|
2768
|
+
forceSyncFocus.current = true;
|
|
2769
|
+
|
|
2770
|
+
// If the floating element is animating out, ignore navigation. Otherwise,
|
|
2771
|
+
// the `activeIndex` gets set to 0 despite not being open so the next time
|
|
2772
|
+
// the user ArrowDowns, the first item won't be focused.
|
|
2773
|
+
if (!latestOpenRef.current && event.currentTarget === floatingRef.current) {
|
|
2774
|
+
return;
|
|
2645
2775
|
}
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
// If the floating element is animating out, ignore navigation. Otherwise,
|
|
2652
|
-
// the `activeIndex` gets set to 0 despite not being open so the next time
|
|
2653
|
-
// the user ArrowDowns, the first item won't be focused.
|
|
2654
|
-
if (!latestOpenRef.current && event.currentTarget === refs.floating.current) {
|
|
2655
|
-
return;
|
|
2776
|
+
if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl)) {
|
|
2777
|
+
floatingUi_react_utils.stopEvent(event);
|
|
2778
|
+
onOpenChange(false, event.nativeEvent, 'list-navigation');
|
|
2779
|
+
if (floatingUi_utils_dom$1.isHTMLElement(elements.domReference) && !virtual) {
|
|
2780
|
+
elements.domReference.focus();
|
|
2656
2781
|
}
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2782
|
+
return;
|
|
2783
|
+
}
|
|
2784
|
+
const currentIndex = indexRef.current;
|
|
2785
|
+
const minIndex = getMinIndex(listRef, disabledIndices);
|
|
2786
|
+
const maxIndex = getMaxIndex(listRef, disabledIndices);
|
|
2787
|
+
if (event.key === 'Home') {
|
|
2788
|
+
floatingUi_react_utils.stopEvent(event);
|
|
2789
|
+
indexRef.current = minIndex;
|
|
2790
|
+
onNavigate(indexRef.current);
|
|
2791
|
+
}
|
|
2792
|
+
if (event.key === 'End') {
|
|
2793
|
+
floatingUi_react_utils.stopEvent(event);
|
|
2794
|
+
indexRef.current = maxIndex;
|
|
2795
|
+
onNavigate(indexRef.current);
|
|
2796
|
+
}
|
|
2797
|
+
|
|
2798
|
+
// Grid navigation.
|
|
2799
|
+
if (cols > 1) {
|
|
2800
|
+
const sizes = itemSizes || Array.from({
|
|
2801
|
+
length: listRef.current.length
|
|
2802
|
+
}, () => ({
|
|
2803
|
+
width: 1,
|
|
2804
|
+
height: 1
|
|
2805
|
+
}));
|
|
2806
|
+
// To calculate movements on the grid, we use hypothetical cell indices
|
|
2807
|
+
// as if every item was 1x1, then convert back to real indices.
|
|
2808
|
+
const cellMap = buildCellMap(sizes, cols, dense);
|
|
2809
|
+
const minGridIndex = cellMap.findIndex(index => index != null && !isDisabled(listRef.current, index, disabledIndices));
|
|
2810
|
+
// last enabled index
|
|
2811
|
+
const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !isDisabled(listRef.current, index, disabledIndices) ? cellIndex : foundIndex, -1);
|
|
2812
|
+
indexRef.current = cellMap[getGridNavigatedIndex({
|
|
2813
|
+
current: cellMap.map(itemIndex => itemIndex != null ? listRef.current[itemIndex] : null)
|
|
2814
|
+
}, {
|
|
2815
|
+
event,
|
|
2816
|
+
orientation,
|
|
2817
|
+
loop,
|
|
2818
|
+
cols,
|
|
2819
|
+
// treat undefined (empty grid spaces) as disabled indices so we
|
|
2820
|
+
// don't end up in them
|
|
2821
|
+
disabledIndices: getCellIndices([...(disabledIndices || listRef.current.map((_, index) => isDisabled(listRef.current, index) ? index : undefined)), undefined], cellMap),
|
|
2822
|
+
minIndex: minGridIndex,
|
|
2823
|
+
maxIndex: maxGridIndex,
|
|
2824
|
+
prevIndex: getCellIndexOfCorner(indexRef.current > maxIndex ? minIndex : indexRef.current, sizes, cellMap, cols,
|
|
2825
|
+
// use a corner matching the edge closest to the direction
|
|
2826
|
+
// we're moving in so we don't end up in the same item. Prefer
|
|
2827
|
+
// top/left over bottom/right.
|
|
2828
|
+
event.key === ARROW_DOWN ? 'bl' : event.key === ARROW_RIGHT ? 'tr' : 'tl'),
|
|
2829
|
+
stopEvent: true
|
|
2830
|
+
})]; // navigated cell will never be nullish
|
|
2831
|
+
|
|
2832
|
+
onNavigate(indexRef.current);
|
|
2833
|
+
if (orientation === 'both') {
|
|
2663
2834
|
return;
|
|
2664
2835
|
}
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
if (event.key === 'Home') {
|
|
2669
|
-
floatingUi_react_utils.stopEvent(event);
|
|
2670
|
-
indexRef.current = minIndex;
|
|
2671
|
-
onNavigate(indexRef.current);
|
|
2672
|
-
}
|
|
2673
|
-
if (event.key === 'End') {
|
|
2674
|
-
floatingUi_react_utils.stopEvent(event);
|
|
2675
|
-
indexRef.current = maxIndex;
|
|
2676
|
-
onNavigate(indexRef.current);
|
|
2677
|
-
}
|
|
2678
|
-
|
|
2679
|
-
// Grid navigation.
|
|
2680
|
-
if (cols > 1) {
|
|
2681
|
-
const sizes = itemSizes || Array.from({
|
|
2682
|
-
length: listRef.current.length
|
|
2683
|
-
}, () => ({
|
|
2684
|
-
width: 1,
|
|
2685
|
-
height: 1
|
|
2686
|
-
}));
|
|
2687
|
-
// To calculate movements on the grid, we use hypothetical cell indices
|
|
2688
|
-
// as if every item was 1x1, then convert back to real indices.
|
|
2689
|
-
const cellMap = buildCellMap(sizes, cols, dense);
|
|
2690
|
-
const minGridIndex = cellMap.findIndex(index => index != null && !(disabledIndices != null && disabledIndices.includes(index)));
|
|
2691
|
-
// last enabled index
|
|
2692
|
-
const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !(disabledIndices != null && disabledIndices.includes(index)) ? cellIndex : foundIndex, -1);
|
|
2693
|
-
indexRef.current = cellMap[getGridNavigatedIndex({
|
|
2694
|
-
current: cellMap.map(itemIndex => itemIndex != null ? listRef.current[itemIndex] : null)
|
|
2695
|
-
}, {
|
|
2696
|
-
event,
|
|
2697
|
-
orientation,
|
|
2698
|
-
loop,
|
|
2699
|
-
cols,
|
|
2700
|
-
// treat undefined (empty grid spaces) as disabled indices so we
|
|
2701
|
-
// don't end up in them
|
|
2702
|
-
disabledIndices: getCellIndices([...(disabledIndices || []), undefined], cellMap),
|
|
2703
|
-
minIndex: minGridIndex,
|
|
2704
|
-
maxIndex: maxGridIndex,
|
|
2705
|
-
prevIndex: getCellIndexOfCorner(indexRef.current, sizes, cellMap, cols,
|
|
2706
|
-
// use a corner matching the edge closest to the direction
|
|
2707
|
-
// we're moving in so we don't end up in the same item. Prefer
|
|
2708
|
-
// top/left over bottom/right.
|
|
2709
|
-
event.key === ARROW_DOWN ? 'bl' : event.key === ARROW_RIGHT ? 'tr' : 'tl'),
|
|
2710
|
-
stopEvent: true
|
|
2711
|
-
})]; // navigated cell will never be nullish
|
|
2836
|
+
}
|
|
2837
|
+
if (isMainOrientationKey(event.key, orientation)) {
|
|
2838
|
+
floatingUi_react_utils.stopEvent(event);
|
|
2712
2839
|
|
|
2840
|
+
// Reset the index if no item is focused.
|
|
2841
|
+
if (open && !virtual && floatingUi_react_utils.activeElement(event.currentTarget.ownerDocument) === event.currentTarget) {
|
|
2842
|
+
indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;
|
|
2713
2843
|
onNavigate(indexRef.current);
|
|
2714
|
-
|
|
2715
|
-
return;
|
|
2716
|
-
}
|
|
2844
|
+
return;
|
|
2717
2845
|
}
|
|
2718
|
-
if (
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
onNavigate(indexRef.current);
|
|
2725
|
-
return;
|
|
2726
|
-
}
|
|
2727
|
-
if (isMainOrientationToEndKey(event.key, orientation, rtl)) {
|
|
2728
|
-
if (loop) {
|
|
2729
|
-
indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : findNonDisabledIndex(listRef, {
|
|
2730
|
-
startingIndex: currentIndex,
|
|
2731
|
-
disabledIndices
|
|
2732
|
-
});
|
|
2733
|
-
} else {
|
|
2734
|
-
indexRef.current = Math.min(maxIndex, findNonDisabledIndex(listRef, {
|
|
2735
|
-
startingIndex: currentIndex,
|
|
2736
|
-
disabledIndices
|
|
2737
|
-
}));
|
|
2738
|
-
}
|
|
2846
|
+
if (isMainOrientationToEndKey(event.key, orientation, rtl)) {
|
|
2847
|
+
if (loop) {
|
|
2848
|
+
indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : findNonDisabledIndex(listRef, {
|
|
2849
|
+
startingIndex: currentIndex,
|
|
2850
|
+
disabledIndices
|
|
2851
|
+
});
|
|
2739
2852
|
} else {
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
disabledIndices
|
|
2745
|
-
});
|
|
2746
|
-
} else {
|
|
2747
|
-
indexRef.current = Math.max(minIndex, findNonDisabledIndex(listRef, {
|
|
2748
|
-
startingIndex: currentIndex,
|
|
2749
|
-
decrement: true,
|
|
2750
|
-
disabledIndices
|
|
2751
|
-
}));
|
|
2752
|
-
}
|
|
2853
|
+
indexRef.current = Math.min(maxIndex, findNonDisabledIndex(listRef, {
|
|
2854
|
+
startingIndex: currentIndex,
|
|
2855
|
+
disabledIndices
|
|
2856
|
+
}));
|
|
2753
2857
|
}
|
|
2754
|
-
|
|
2755
|
-
|
|
2858
|
+
} else {
|
|
2859
|
+
if (loop) {
|
|
2860
|
+
indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : findNonDisabledIndex(listRef, {
|
|
2861
|
+
startingIndex: currentIndex,
|
|
2862
|
+
decrement: true,
|
|
2863
|
+
disabledIndices
|
|
2864
|
+
});
|
|
2756
2865
|
} else {
|
|
2757
|
-
|
|
2866
|
+
indexRef.current = Math.max(minIndex, findNonDisabledIndex(listRef, {
|
|
2867
|
+
startingIndex: currentIndex,
|
|
2868
|
+
decrement: true,
|
|
2869
|
+
disabledIndices
|
|
2870
|
+
}));
|
|
2758
2871
|
}
|
|
2759
2872
|
}
|
|
2873
|
+
if (isIndexOutOfBounds(listRef, indexRef.current)) {
|
|
2874
|
+
onNavigate(null);
|
|
2875
|
+
} else {
|
|
2876
|
+
onNavigate(indexRef.current);
|
|
2877
|
+
}
|
|
2760
2878
|
}
|
|
2879
|
+
});
|
|
2880
|
+
const ariaActiveDescendantProp = React__namespace.useMemo(() => {
|
|
2881
|
+
return virtual && open && hasActiveIndex && {
|
|
2882
|
+
'aria-activedescendant': virtualId || activeId
|
|
2883
|
+
};
|
|
2884
|
+
}, [virtual, open, hasActiveIndex, virtualId, activeId]);
|
|
2885
|
+
const floating = React__namespace.useMemo(() => {
|
|
2886
|
+
return {
|
|
2887
|
+
'aria-orientation': orientation === 'both' ? undefined : orientation,
|
|
2888
|
+
...(!floatingUi_react_utils.isTypeableCombobox(elements.domReference) && ariaActiveDescendantProp),
|
|
2889
|
+
onKeyDown: commonOnKeyDown,
|
|
2890
|
+
onPointerMove() {
|
|
2891
|
+
isPointerModalityRef.current = true;
|
|
2892
|
+
}
|
|
2893
|
+
};
|
|
2894
|
+
}, [ariaActiveDescendantProp, commonOnKeyDown, elements.domReference, orientation]);
|
|
2895
|
+
const reference = React__namespace.useMemo(() => {
|
|
2761
2896
|
function checkVirtualMouse(event) {
|
|
2762
2897
|
if (focusItemOnOpen === 'auto' && floatingUi_react_utils.isVirtualClick(event.nativeEvent)) {
|
|
2763
2898
|
focusItemOnOpenRef.current = true;
|
|
@@ -2770,105 +2905,95 @@ function useListNavigation(context, props) {
|
|
|
2770
2905
|
focusItemOnOpenRef.current = true;
|
|
2771
2906
|
}
|
|
2772
2907
|
}
|
|
2773
|
-
const ariaActiveDescendantProp = virtual && open && hasActiveIndex && {
|
|
2774
|
-
'aria-activedescendant': virtualId || activeId
|
|
2775
|
-
};
|
|
2776
|
-
const activeItem = listRef.current.find(item => (item == null ? void 0 : item.id) === activeId);
|
|
2777
2908
|
return {
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
setVirtualId(undefined);
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
if (isMainKey && deepestNode.context) {
|
|
2806
|
-
if (deepestNode.context.open && deepestNode.parentId && event.currentTarget !== deepestNode.context.elements.domReference) {
|
|
2807
|
-
var _deepestNode$context$;
|
|
2808
|
-
floatingUi_react_utils.stopEvent(event);
|
|
2809
|
-
(_deepestNode$context$ = deepestNode.context.elements.domReference) == null || _deepestNode$context$.dispatchEvent(eventObject);
|
|
2810
|
-
return;
|
|
2811
|
-
}
|
|
2909
|
+
...ariaActiveDescendantProp,
|
|
2910
|
+
onKeyDown(event) {
|
|
2911
|
+
isPointerModalityRef.current = false;
|
|
2912
|
+
const isArrowKey = event.key.indexOf('Arrow') === 0;
|
|
2913
|
+
const isCrossOpenKey = isCrossOrientationOpenKey(event.key, orientation, rtl);
|
|
2914
|
+
const isCrossCloseKey = isCrossOrientationCloseKey(event.key, orientation, rtl);
|
|
2915
|
+
const isMainKey = isMainOrientationKey(event.key, orientation);
|
|
2916
|
+
const isNavigationKey = (nested ? isCrossOpenKey : isMainKey) || event.key === 'Enter' || event.key.trim() === '';
|
|
2917
|
+
if (virtual && open) {
|
|
2918
|
+
const rootNode = tree == null ? void 0 : tree.nodesRef.current.find(node => node.parentId == null);
|
|
2919
|
+
const deepestNode = tree && rootNode ? getDeepestNode(tree.nodesRef.current, rootNode.id) : null;
|
|
2920
|
+
if (isArrowKey && deepestNode && virtualItemRef) {
|
|
2921
|
+
const eventObject = new KeyboardEvent('keydown', {
|
|
2922
|
+
key: event.key,
|
|
2923
|
+
bubbles: true
|
|
2924
|
+
});
|
|
2925
|
+
if (isCrossOpenKey || isCrossCloseKey) {
|
|
2926
|
+
var _deepestNode$context, _deepestNode$context2;
|
|
2927
|
+
const isCurrentTarget = ((_deepestNode$context = deepestNode.context) == null ? void 0 : _deepestNode$context.elements.domReference) === event.currentTarget;
|
|
2928
|
+
const dispatchItem = isCrossCloseKey && !isCurrentTarget ? (_deepestNode$context2 = deepestNode.context) == null ? void 0 : _deepestNode$context2.elements.domReference : isCrossOpenKey ? listRef.current.find(item => (item == null ? void 0 : item.id) === activeId) : null;
|
|
2929
|
+
if (dispatchItem) {
|
|
2930
|
+
floatingUi_react_utils.stopEvent(event);
|
|
2931
|
+
dispatchItem.dispatchEvent(eventObject);
|
|
2932
|
+
setVirtualId(undefined);
|
|
2812
2933
|
}
|
|
2813
2934
|
}
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
return;
|
|
2821
|
-
}
|
|
2822
|
-
if (isNavigationKey) {
|
|
2823
|
-
keyRef.current = nested && isMainKey ? null : event.key;
|
|
2824
|
-
}
|
|
2825
|
-
if (nested) {
|
|
2826
|
-
if (isCrossOpenKey) {
|
|
2827
|
-
floatingUi_react_utils.stopEvent(event);
|
|
2828
|
-
if (open) {
|
|
2829
|
-
indexRef.current = getMinIndex(listRef, disabledIndices);
|
|
2830
|
-
onNavigate(indexRef.current);
|
|
2831
|
-
} else {
|
|
2832
|
-
onOpenChange(true, event.nativeEvent, 'list-navigation');
|
|
2935
|
+
if (isMainKey && deepestNode.context) {
|
|
2936
|
+
if (deepestNode.context.open && deepestNode.parentId && event.currentTarget !== deepestNode.context.elements.domReference) {
|
|
2937
|
+
var _deepestNode$context$;
|
|
2938
|
+
floatingUi_react_utils.stopEvent(event);
|
|
2939
|
+
(_deepestNode$context$ = deepestNode.context.elements.domReference) == null || _deepestNode$context$.dispatchEvent(eventObject);
|
|
2940
|
+
return;
|
|
2833
2941
|
}
|
|
2834
2942
|
}
|
|
2835
|
-
return;
|
|
2836
2943
|
}
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2944
|
+
return commonOnKeyDown(event);
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
// If a floating element should not open on arrow key down, avoid
|
|
2948
|
+
// setting `activeIndex` while it's closed.
|
|
2949
|
+
if (!open && !openOnArrowKeyDown && isArrowKey) {
|
|
2950
|
+
return;
|
|
2951
|
+
}
|
|
2952
|
+
if (isNavigationKey) {
|
|
2953
|
+
keyRef.current = nested && isMainKey ? null : event.key;
|
|
2954
|
+
}
|
|
2955
|
+
if (nested) {
|
|
2956
|
+
if (isCrossOpenKey) {
|
|
2841
2957
|
floatingUi_react_utils.stopEvent(event);
|
|
2842
|
-
if (!open && openOnArrowKeyDown) {
|
|
2843
|
-
onOpenChange(true, event.nativeEvent, 'list-navigation');
|
|
2844
|
-
} else {
|
|
2845
|
-
onKeyDown(event);
|
|
2846
|
-
}
|
|
2847
2958
|
if (open) {
|
|
2959
|
+
indexRef.current = getMinIndex(listRef, disabledIndicesRef.current);
|
|
2848
2960
|
onNavigate(indexRef.current);
|
|
2961
|
+
} else {
|
|
2962
|
+
onOpenChange(true, event.nativeEvent, 'list-navigation');
|
|
2849
2963
|
}
|
|
2850
2964
|
}
|
|
2851
|
-
|
|
2852
|
-
|
|
2965
|
+
return;
|
|
2966
|
+
}
|
|
2967
|
+
if (isMainKey) {
|
|
2968
|
+
if (selectedIndex != null) {
|
|
2969
|
+
indexRef.current = selectedIndex;
|
|
2970
|
+
}
|
|
2971
|
+
floatingUi_react_utils.stopEvent(event);
|
|
2972
|
+
if (!open && openOnArrowKeyDown) {
|
|
2973
|
+
onOpenChange(true, event.nativeEvent, 'list-navigation');
|
|
2974
|
+
} else {
|
|
2975
|
+
commonOnKeyDown(event);
|
|
2976
|
+
}
|
|
2853
2977
|
if (open) {
|
|
2854
|
-
onNavigate(
|
|
2978
|
+
onNavigate(indexRef.current);
|
|
2855
2979
|
}
|
|
2856
|
-
}
|
|
2857
|
-
onPointerDown: checkVirtualPointer,
|
|
2858
|
-
onMouseDown: checkVirtualMouse,
|
|
2859
|
-
onClick: checkVirtualMouse
|
|
2980
|
+
}
|
|
2860
2981
|
},
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
onKeyDown,
|
|
2865
|
-
onPointerMove() {
|
|
2866
|
-
isPointerModalityRef.current = true;
|
|
2982
|
+
onFocus() {
|
|
2983
|
+
if (open && !virtual) {
|
|
2984
|
+
onNavigate(null);
|
|
2867
2985
|
}
|
|
2868
2986
|
},
|
|
2869
|
-
|
|
2987
|
+
onPointerDown: checkVirtualPointer,
|
|
2988
|
+
onMouseDown: checkVirtualMouse,
|
|
2989
|
+
onClick: checkVirtualMouse
|
|
2870
2990
|
};
|
|
2871
|
-
}, [
|
|
2991
|
+
}, [activeId, ariaActiveDescendantProp, commonOnKeyDown, disabledIndicesRef, focusItemOnOpen, listRef, nested, onNavigate, onOpenChange, open, openOnArrowKeyDown, orientation, rtl, selectedIndex, tree, virtual, virtualItemRef]);
|
|
2992
|
+
return React__namespace.useMemo(() => enabled ? {
|
|
2993
|
+
reference,
|
|
2994
|
+
floating,
|
|
2995
|
+
item
|
|
2996
|
+
} : {}, [enabled, reference, floating, item]);
|
|
2872
2997
|
}
|
|
2873
2998
|
|
|
2874
2999
|
const componentRoleToAriaRoleMap = /*#__PURE__*/new Map([['select', 'listbox'], ['combobox', 'listbox'], ['label', false]]);
|
|
@@ -2895,8 +3020,34 @@ function useRole(context, props) {
|
|
|
2895
3020
|
const referenceId = useId();
|
|
2896
3021
|
const parentId = useFloatingParentNodeId();
|
|
2897
3022
|
const isNested = parentId != null;
|
|
2898
|
-
|
|
2899
|
-
if (
|
|
3023
|
+
const reference = React__namespace.useMemo(() => {
|
|
3024
|
+
if (ariaRole === 'tooltip' || role === 'label') {
|
|
3025
|
+
return {
|
|
3026
|
+
["aria-" + (role === 'label' ? 'labelledby' : 'describedby')]: open ? floatingId : undefined
|
|
3027
|
+
};
|
|
3028
|
+
}
|
|
3029
|
+
return {
|
|
3030
|
+
'aria-expanded': open ? 'true' : 'false',
|
|
3031
|
+
'aria-haspopup': ariaRole === 'alertdialog' ? 'dialog' : ariaRole,
|
|
3032
|
+
'aria-controls': open ? floatingId : undefined,
|
|
3033
|
+
...(ariaRole === 'listbox' && {
|
|
3034
|
+
role: 'combobox'
|
|
3035
|
+
}),
|
|
3036
|
+
...(ariaRole === 'menu' && {
|
|
3037
|
+
id: referenceId
|
|
3038
|
+
}),
|
|
3039
|
+
...(ariaRole === 'menu' && isNested && {
|
|
3040
|
+
role: 'menuitem'
|
|
3041
|
+
}),
|
|
3042
|
+
...(role === 'select' && {
|
|
3043
|
+
'aria-autocomplete': 'none'
|
|
3044
|
+
}),
|
|
3045
|
+
...(role === 'combobox' && {
|
|
3046
|
+
'aria-autocomplete': 'list'
|
|
3047
|
+
})
|
|
3048
|
+
};
|
|
3049
|
+
}, [ariaRole, floatingId, isNested, open, referenceId, role]);
|
|
3050
|
+
const floating = React__namespace.useMemo(() => {
|
|
2900
3051
|
const floatingProps = {
|
|
2901
3052
|
id: floatingId,
|
|
2902
3053
|
...(ariaRole && {
|
|
@@ -2904,75 +3055,53 @@ function useRole(context, props) {
|
|
|
2904
3055
|
})
|
|
2905
3056
|
};
|
|
2906
3057
|
if (ariaRole === 'tooltip' || role === 'label') {
|
|
2907
|
-
return
|
|
2908
|
-
reference: {
|
|
2909
|
-
["aria-" + (role === 'label' ? 'labelledby' : 'describedby')]: open ? floatingId : undefined
|
|
2910
|
-
},
|
|
2911
|
-
floating: floatingProps
|
|
2912
|
-
};
|
|
3058
|
+
return floatingProps;
|
|
2913
3059
|
}
|
|
2914
3060
|
return {
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
'aria-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
'aria-autocomplete': 'list'
|
|
2933
|
-
})
|
|
2934
|
-
},
|
|
2935
|
-
floating: {
|
|
2936
|
-
...floatingProps,
|
|
2937
|
-
...(ariaRole === 'menu' && {
|
|
2938
|
-
'aria-labelledby': referenceId
|
|
2939
|
-
})
|
|
2940
|
-
},
|
|
2941
|
-
item(_ref) {
|
|
2942
|
-
let {
|
|
2943
|
-
active,
|
|
2944
|
-
selected
|
|
2945
|
-
} = _ref;
|
|
2946
|
-
const commonProps = {
|
|
2947
|
-
role: 'option',
|
|
2948
|
-
...(active && {
|
|
2949
|
-
id: floatingId + "-option"
|
|
2950
|
-
})
|
|
2951
|
-
};
|
|
3061
|
+
...floatingProps,
|
|
3062
|
+
...(ariaRole === 'menu' && {
|
|
3063
|
+
'aria-labelledby': referenceId
|
|
3064
|
+
})
|
|
3065
|
+
};
|
|
3066
|
+
}, [ariaRole, floatingId, referenceId, role]);
|
|
3067
|
+
const item = React__namespace.useCallback(_ref => {
|
|
3068
|
+
let {
|
|
3069
|
+
active,
|
|
3070
|
+
selected
|
|
3071
|
+
} = _ref;
|
|
3072
|
+
const commonProps = {
|
|
3073
|
+
role: 'option',
|
|
3074
|
+
...(active && {
|
|
3075
|
+
id: floatingId + "-option"
|
|
3076
|
+
})
|
|
3077
|
+
};
|
|
2952
3078
|
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
}
|
|
3079
|
+
// For `menu`, we are unable to tell if the item is a `menuitemradio`
|
|
3080
|
+
// or `menuitemcheckbox`. For backwards-compatibility reasons, also
|
|
3081
|
+
// avoid defaulting to `menuitem` as it may overwrite custom role props.
|
|
3082
|
+
switch (role) {
|
|
3083
|
+
case 'select':
|
|
3084
|
+
return {
|
|
3085
|
+
...commonProps,
|
|
3086
|
+
'aria-selected': active && selected
|
|
3087
|
+
};
|
|
3088
|
+
case 'combobox':
|
|
3089
|
+
{
|
|
3090
|
+
return {
|
|
3091
|
+
...commonProps,
|
|
3092
|
+
...(active && {
|
|
3093
|
+
'aria-selected': true
|
|
3094
|
+
})
|
|
3095
|
+
};
|
|
2971
3096
|
}
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
3097
|
+
}
|
|
3098
|
+
return {};
|
|
3099
|
+
}, [floatingId, role]);
|
|
3100
|
+
return React__namespace.useMemo(() => enabled ? {
|
|
3101
|
+
reference,
|
|
3102
|
+
floating,
|
|
3103
|
+
item
|
|
3104
|
+
} : {}, [enabled, reference, floating, item]);
|
|
2976
3105
|
}
|
|
2977
3106
|
|
|
2978
3107
|
// Converts a JS style key like `backgroundColor` to a CSS transition-property
|
|
@@ -2987,11 +3116,11 @@ function useDelayUnmount(open, durationMs) {
|
|
|
2987
3116
|
setIsMounted(true);
|
|
2988
3117
|
}
|
|
2989
3118
|
React__namespace.useEffect(() => {
|
|
2990
|
-
if (!open) {
|
|
3119
|
+
if (!open && isMounted) {
|
|
2991
3120
|
const timeout = setTimeout(() => setIsMounted(false), durationMs);
|
|
2992
3121
|
return () => clearTimeout(timeout);
|
|
2993
3122
|
}
|
|
2994
|
-
}, [open, durationMs]);
|
|
3123
|
+
}, [open, isMounted, durationMs]);
|
|
2995
3124
|
return isMounted;
|
|
2996
3125
|
}
|
|
2997
3126
|
/**
|
|
@@ -3014,19 +3143,11 @@ function useTransitionStatus(context, props) {
|
|
|
3014
3143
|
} = props;
|
|
3015
3144
|
const isNumberDuration = typeof duration === 'number';
|
|
3016
3145
|
const closeDuration = (isNumberDuration ? duration : duration.close) || 0;
|
|
3017
|
-
const [initiated, setInitiated] = React__namespace.useState(false);
|
|
3018
3146
|
const [status, setStatus] = React__namespace.useState('unmounted');
|
|
3019
3147
|
const isMounted = useDelayUnmount(open, closeDuration);
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
// after the initial one allows the correct side animation to play when the
|
|
3024
|
-
// placement has changed.
|
|
3025
|
-
index(() => {
|
|
3026
|
-
if (initiated && !isMounted) {
|
|
3027
|
-
setStatus('unmounted');
|
|
3028
|
-
}
|
|
3029
|
-
}, [initiated, isMounted]);
|
|
3148
|
+
if (!isMounted && status === 'close') {
|
|
3149
|
+
setStatus('unmounted');
|
|
3150
|
+
}
|
|
3030
3151
|
index(() => {
|
|
3031
3152
|
if (!floating) return;
|
|
3032
3153
|
if (open) {
|
|
@@ -3038,7 +3159,6 @@ function useTransitionStatus(context, props) {
|
|
|
3038
3159
|
cancelAnimationFrame(frame);
|
|
3039
3160
|
};
|
|
3040
3161
|
}
|
|
3041
|
-
setInitiated(true);
|
|
3042
3162
|
setStatus('close');
|
|
3043
3163
|
}, [open, floating]);
|
|
3044
3164
|
return {
|
|
@@ -3127,13 +3247,11 @@ function useTransitionStyles(context, props) {
|
|
|
3127
3247
|
}
|
|
3128
3248
|
|
|
3129
3249
|
exports.arrow = floatingUi_reactDom.arrow;
|
|
3250
|
+
exports.flip = floatingUi_reactDom.flip;
|
|
3251
|
+
exports.offset = floatingUi_reactDom.offset;
|
|
3252
|
+
exports.shift = floatingUi_reactDom.shift;
|
|
3253
|
+
exports.size = floatingUi_reactDom.size;
|
|
3130
3254
|
exports.getOverflowAncestors = floatingUi_utils_dom.getOverflowAncestors;
|
|
3131
|
-
exports.autoUpdate = floatingUi_dom.autoUpdate;
|
|
3132
|
-
exports.computePosition = floatingUi_dom.computePosition;
|
|
3133
|
-
exports.flip = floatingUi_dom.flip;
|
|
3134
|
-
exports.platform = floatingUi_dom.platform;
|
|
3135
|
-
exports.shift = floatingUi_dom.shift;
|
|
3136
|
-
exports.size = floatingUi_dom.size;
|
|
3137
3255
|
exports.FloatingArrow = FloatingArrow;
|
|
3138
3256
|
exports.FloatingFocusManager = FloatingFocusManager;
|
|
3139
3257
|
exports.FloatingPortal = FloatingPortal;
|
|
@@ -3142,6 +3260,7 @@ exports.useDismiss = useDismiss;
|
|
|
3142
3260
|
exports.useFloating = useFloating;
|
|
3143
3261
|
exports.useFloatingParentNodeId = useFloatingParentNodeId;
|
|
3144
3262
|
exports.useFloatingPortalNode = useFloatingPortalNode;
|
|
3263
|
+
exports.useFloatingRootContext = useFloatingRootContext;
|
|
3145
3264
|
exports.useFloatingTree = useFloatingTree;
|
|
3146
3265
|
exports.useFocus = useFocus;
|
|
3147
3266
|
exports.useHover = useHover;
|