@base-ui/react 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +125 -8
- package/README.md +1 -1
- package/accordion/item/AccordionItem.d.ts +4 -0
- package/accordion/item/AccordionItem.js +5 -4
- package/accordion/panel/AccordionPanel.js +29 -51
- package/accordion/root/AccordionRoot.js +5 -6
- package/accordion/trigger/AccordionTrigger.js +3 -4
- package/alert-dialog/handle.d.ts +14 -1
- package/alert-dialog/handle.js +22 -5
- package/alert-dialog/index.d.ts +1 -1
- package/alert-dialog/index.parts.d.ts +2 -3
- package/alert-dialog/index.parts.js +4 -5
- package/alert-dialog/root/AlertDialogRoot.d.ts +7 -7
- package/alert-dialog/root/AlertDialogRoot.js +2 -56
- package/alert-dialog/trigger/AlertDialogTrigger.d.ts +25 -0
- package/alert-dialog/trigger/AlertDialogTrigger.js +15 -0
- package/alert-dialog/trigger/AlertDialogTriggerDataAttributes.d.ts +10 -0
- package/alert-dialog/trigger/AlertDialogTriggerDataAttributes.js +18 -0
- package/autocomplete/root/AutocompleteRoot.js +9 -10
- package/avatar/image/AvatarImage.js +4 -4
- package/checkbox/indicator/CheckboxIndicator.js +2 -2
- package/checkbox/root/CheckboxRoot.js +49 -11
- package/checkbox-group/CheckboxGroup.js +1 -5
- package/collapsible/panel/CollapsiblePanel.js +29 -51
- package/collapsible/panel/useCollapsiblePanel.d.ts +9 -23
- package/collapsible/panel/useCollapsiblePanel.js +308 -268
- package/collapsible/root/CollapsibleRoot.d.ts +1 -1
- package/collapsible/root/CollapsibleRootContext.d.ts +0 -2
- package/collapsible/root/useCollapsibleRoot.d.ts +0 -27
- package/collapsible/root/useCollapsibleRoot.js +2 -64
- package/collapsible/trigger/CollapsibleTrigger.js +5 -6
- package/combobox/arrow/ComboboxArrow.js +1 -1
- package/combobox/backdrop/ComboboxBackdrop.js +1 -1
- package/combobox/chip/ComboboxChip.js +7 -2
- package/combobox/clear/ComboboxClear.d.ts +4 -0
- package/combobox/clear/ComboboxClear.js +1 -0
- package/combobox/clear/ComboboxClearDataAttributes.d.ts +4 -0
- package/combobox/clear/ComboboxClearDataAttributes.js +4 -0
- package/combobox/icon/ComboboxIcon.js +1 -1
- package/combobox/input/ComboboxInput.js +15 -6
- package/combobox/item/ComboboxItem.js +8 -14
- package/combobox/item-indicator/ComboboxItemIndicator.js +1 -2
- package/combobox/root/AriaCombobox.js +61 -28
- package/combobox/store.d.ts +4 -8
- package/combobox/store.js +2 -1
- package/combobox/utils/ComboboxInternalDismissButton.js +2 -3
- package/csp-provider/CSPProvider.js +1 -1
- package/dialog/close/DialogClose.js +6 -6
- package/dialog/popup/DialogPopup.js +9 -4
- package/dialog/root/DialogRoot.d.ts +1 -2
- package/dialog/root/DialogRoot.js +3 -73
- package/dialog/root/DialogRootContext.d.ts +1 -0
- package/dialog/root/DialogRootContext.js +3 -1
- package/dialog/root/useDialogRoot.d.ts +12 -4
- package/dialog/root/useDialogRoot.js +27 -25
- package/dialog/root/useRenderDialogRoot.d.ts +4 -0
- package/dialog/root/useRenderDialogRoot.js +96 -0
- package/dialog/store/DialogHandle.d.ts +1 -1
- package/dialog/store/DialogHandle.js +2 -2
- package/dialog/store/DialogStore.d.ts +88 -1
- package/dialog/store/DialogStore.js +12 -17
- package/dialog/trigger/DialogTrigger.d.ts +1 -1
- package/dialog/trigger/DialogTrigger.js +11 -4
- package/dialog/viewport/DialogViewport.js +4 -3
- package/drawer/popup/DrawerPopup.js +13 -9
- package/drawer/root/DrawerRoot.js +11 -11
- package/drawer/root/DrawerRootContext.d.ts +1 -1
- package/drawer/swipe-area/DrawerSwipeArea.js +6 -5
- package/drawer/viewport/DrawerViewport.js +13 -14
- package/esm/accordion/item/AccordionItem.d.ts +4 -0
- package/esm/accordion/item/AccordionItem.js +5 -4
- package/esm/accordion/panel/AccordionPanel.js +29 -51
- package/esm/accordion/root/AccordionRoot.js +5 -6
- package/esm/accordion/trigger/AccordionTrigger.js +4 -5
- package/esm/alert-dialog/handle.d.ts +14 -1
- package/esm/alert-dialog/handle.js +20 -5
- package/esm/alert-dialog/index.d.ts +1 -1
- package/esm/alert-dialog/index.parts.d.ts +2 -3
- package/esm/alert-dialog/index.parts.js +2 -3
- package/esm/alert-dialog/root/AlertDialogRoot.d.ts +7 -7
- package/esm/alert-dialog/root/AlertDialogRoot.js +2 -55
- package/esm/alert-dialog/trigger/AlertDialogTrigger.d.ts +25 -0
- package/esm/alert-dialog/trigger/AlertDialogTrigger.js +10 -0
- package/esm/alert-dialog/trigger/AlertDialogTriggerDataAttributes.d.ts +10 -0
- package/esm/alert-dialog/trigger/AlertDialogTriggerDataAttributes.js +12 -0
- package/esm/autocomplete/root/AutocompleteRoot.js +9 -10
- package/esm/avatar/image/AvatarImage.js +4 -4
- package/esm/checkbox/indicator/CheckboxIndicator.js +2 -2
- package/esm/checkbox/root/CheckboxRoot.js +49 -11
- package/esm/checkbox-group/CheckboxGroup.js +1 -5
- package/esm/collapsible/panel/CollapsiblePanel.js +29 -51
- package/esm/collapsible/panel/useCollapsiblePanel.d.ts +9 -23
- package/esm/collapsible/panel/useCollapsiblePanel.js +309 -269
- package/esm/collapsible/root/CollapsibleRoot.d.ts +1 -1
- package/esm/collapsible/root/CollapsibleRootContext.d.ts +0 -2
- package/esm/collapsible/root/useCollapsibleRoot.d.ts +0 -27
- package/esm/collapsible/root/useCollapsibleRoot.js +2 -64
- package/esm/collapsible/trigger/CollapsibleTrigger.js +5 -6
- package/esm/combobox/arrow/ComboboxArrow.js +1 -1
- package/esm/combobox/backdrop/ComboboxBackdrop.js +1 -1
- package/esm/combobox/chip/ComboboxChip.js +7 -2
- package/esm/combobox/clear/ComboboxClear.d.ts +4 -0
- package/esm/combobox/clear/ComboboxClear.js +1 -0
- package/esm/combobox/clear/ComboboxClearDataAttributes.d.ts +4 -0
- package/esm/combobox/clear/ComboboxClearDataAttributes.js +4 -0
- package/esm/combobox/icon/ComboboxIcon.js +1 -1
- package/esm/combobox/input/ComboboxInput.js +16 -7
- package/esm/combobox/item/ComboboxItem.js +8 -14
- package/esm/combobox/item-indicator/ComboboxItemIndicator.js +1 -2
- package/esm/combobox/root/AriaCombobox.js +62 -29
- package/esm/combobox/store.d.ts +4 -8
- package/esm/combobox/store.js +2 -1
- package/esm/combobox/utils/ComboboxInternalDismissButton.js +2 -3
- package/esm/csp-provider/CSPProvider.js +1 -1
- package/esm/dialog/close/DialogClose.js +6 -6
- package/esm/dialog/popup/DialogPopup.js +9 -4
- package/esm/dialog/root/DialogRoot.d.ts +1 -2
- package/esm/dialog/root/DialogRoot.js +4 -72
- package/esm/dialog/root/DialogRootContext.d.ts +1 -0
- package/esm/dialog/root/DialogRootContext.js +2 -0
- package/esm/dialog/root/useDialogRoot.d.ts +12 -4
- package/esm/dialog/root/useDialogRoot.js +28 -27
- package/esm/dialog/root/useRenderDialogRoot.d.ts +4 -0
- package/esm/dialog/root/useRenderDialogRoot.js +90 -0
- package/esm/dialog/store/DialogHandle.d.ts +1 -1
- package/esm/dialog/store/DialogHandle.js +2 -2
- package/esm/dialog/store/DialogStore.d.ts +88 -1
- package/esm/dialog/store/DialogStore.js +13 -18
- package/esm/dialog/trigger/DialogTrigger.d.ts +1 -1
- package/esm/dialog/trigger/DialogTrigger.js +12 -5
- package/esm/dialog/viewport/DialogViewport.js +4 -3
- package/esm/drawer/popup/DrawerPopup.js +14 -9
- package/esm/drawer/root/DrawerRoot.js +11 -11
- package/esm/drawer/root/DrawerRootContext.d.ts +1 -1
- package/esm/drawer/swipe-area/DrawerSwipeArea.js +6 -5
- package/esm/drawer/viewport/DrawerViewport.js +13 -14
- package/esm/field/control/FieldControl.js +2 -6
- package/esm/field/item/FieldItem.js +1 -4
- package/esm/field/root/FieldRoot.js +11 -3
- package/esm/field/root/useFieldValidation.d.ts +1 -0
- package/esm/field/root/useFieldValidation.js +23 -20
- package/esm/field/utils/getCombinedFieldValidityData.d.ts +1 -1
- package/esm/field/validity/FieldValidity.d.ts +1 -1
- package/esm/floating-ui-react/components/FloatingDelayGroup.js +3 -3
- package/esm/floating-ui-react/components/FloatingFocusManager.d.ts +1 -1
- package/esm/floating-ui-react/components/FloatingFocusManager.js +20 -8
- package/esm/floating-ui-react/components/FloatingPortal.js +3 -3
- package/esm/floating-ui-react/hooks/useClick.js +83 -74
- package/esm/floating-ui-react/hooks/useClientPoint.js +29 -20
- package/esm/floating-ui-react/hooks/useDismiss.d.ts +1 -1
- package/esm/floating-ui-react/hooks/useDismiss.js +82 -93
- package/esm/floating-ui-react/hooks/useFloating.js +37 -32
- package/esm/floating-ui-react/hooks/useFloatingRootContext.d.ts +1 -1
- package/esm/floating-ui-react/hooks/useFloatingRootContext.js +2 -2
- package/esm/floating-ui-react/hooks/useFocus.js +84 -81
- package/esm/floating-ui-react/hooks/useHover.js +72 -76
- package/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js +49 -44
- package/esm/floating-ui-react/hooks/useHoverInteractionSharedState.js +1 -1
- package/esm/floating-ui-react/hooks/useHoverReferenceInteraction.d.ts +7 -2
- package/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js +44 -39
- package/esm/floating-ui-react/hooks/useHoverShared.d.ts +2 -1
- package/esm/floating-ui-react/hooks/useHoverShared.js +4 -0
- package/esm/floating-ui-react/hooks/useListNavigation.d.ts +1 -3
- package/esm/floating-ui-react/hooks/useListNavigation.js +83 -74
- package/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.d.ts +9 -6
- package/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js +25 -20
- package/esm/floating-ui-react/hooks/useTypeahead.d.ts +2 -2
- package/esm/floating-ui-react/hooks/useTypeahead.js +33 -52
- package/esm/floating-ui-react/index.d.ts +0 -2
- package/esm/floating-ui-react/index.js +0 -2
- package/esm/floating-ui-react/types.d.ts +2 -7
- package/esm/floating-ui-react/utils/composite.js +2 -0
- package/esm/floating-ui-react/utils/enqueueFocus.d.ts +1 -1
- package/esm/floating-ui-react/utils/enqueueFocus.js +10 -7
- package/esm/floating-ui-react/utils/getEmptyRootContext.js +1 -1
- package/esm/form/Form.js +2 -2
- package/esm/index.js +1 -1
- package/esm/internals/composite/composite.d.ts +0 -1
- package/esm/internals/composite/composite.js +1 -2
- package/esm/internals/composite/root/useCompositeRoot.js +2 -2
- package/esm/internals/createBaseUIEventDetails.d.ts +2 -0
- package/esm/internals/csp-context/index.d.ts +2 -0
- package/esm/internals/csp-context/index.js +1 -0
- package/esm/internals/field-register-control/index.d.ts +0 -1
- package/esm/internals/field-register-control/useFieldControlRegistration.d.ts +2 -1
- package/esm/internals/field-register-control/useFieldControlRegistration.js +11 -14
- package/esm/internals/field-register-control/useRegisterFieldControl.d.ts +1 -4
- package/esm/internals/field-register-control/useRegisterFieldControl.js +6 -11
- package/esm/internals/field-root-context/FieldRootContext.d.ts +1 -0
- package/esm/internals/field-root-context/FieldRootContext.js +3 -2
- package/esm/internals/form-context/FormContext.d.ts +5 -1
- package/esm/internals/reason-parts.d.ts +2 -0
- package/esm/internals/reason-parts.js +2 -0
- package/esm/internals/types.d.ts +1 -0
- package/esm/internals/use-button/useButton.js +4 -4
- package/esm/internals/usePressAndHold.js +2 -2
- package/esm/internals/useRenderElement.js +2 -0
- package/esm/menu/arrow/MenuArrow.js +1 -1
- package/esm/menu/backdrop/MenuBackdrop.js +1 -1
- package/esm/menu/checkbox-item/MenuCheckboxItem.js +5 -7
- package/esm/menu/group/MenuGroup.js +1 -4
- package/esm/menu/group/MenuGroupContext.d.ts +1 -3
- package/esm/menu/group/MenuGroupContext.js +1 -1
- package/esm/menu/group-label/MenuGroupLabel.js +4 -6
- package/esm/menu/link-item/MenuLinkItem.js +2 -2
- package/esm/menu/popup/MenuPopup.js +5 -5
- package/esm/menu/radio-group/MenuRadioGroup.js +11 -5
- package/esm/menu/radio-item/MenuRadioItem.js +5 -7
- package/esm/menu/root/MenuRoot.js +63 -68
- package/esm/menu/store/MenuHandle.js +1 -1
- package/esm/menu/store/MenuStore.d.ts +87 -0
- package/esm/menu/submenu-trigger/MenuSubmenuTrigger.js +8 -5
- package/esm/menu/trigger/MenuTrigger.js +13 -10
- package/esm/menu/viewport/MenuViewport.d.ts +2 -2
- package/esm/menu/viewport/MenuViewport.js +2 -2
- package/esm/navigation-menu/arrow/NavigationMenuArrow.js +1 -1
- package/esm/navigation-menu/backdrop/NavigationMenuBackdrop.js +1 -1
- package/esm/navigation-menu/content/NavigationMenuContent.js +8 -5
- package/esm/navigation-menu/icon/NavigationMenuIcon.js +1 -1
- package/esm/navigation-menu/item/NavigationMenuItem.js +2 -2
- package/esm/navigation-menu/list/NavigationMenuList.js +1 -1
- package/esm/navigation-menu/popup/NavigationMenuPopup.js +2 -2
- package/esm/navigation-menu/root/NavigationMenuRoot.js +1 -3
- package/esm/navigation-menu/trigger/NavigationMenuTrigger.js +24 -17
- package/esm/navigation-menu/utils/isOutsideMenuEvent.d.ts +0 -1
- package/esm/navigation-menu/utils/isOutsideMenuEvent.js +1 -5
- package/esm/navigation-menu/viewport/NavigationMenuViewport.js +2 -3
- package/esm/number-field/input/NumberFieldInput.js +3 -5
- package/esm/number-field/root/NumberFieldRoot.js +5 -2
- package/esm/number-field/scrub-area/NumberFieldScrubArea.js +7 -3
- package/esm/otp-field/input/OTPFieldInput.js +43 -29
- package/esm/otp-field/root/OTPFieldRoot.d.ts +17 -8
- package/esm/otp-field/root/OTPFieldRoot.js +33 -33
- package/esm/otp-field/root/OTPFieldRootContext.d.ts +1 -1
- package/esm/otp-field/utils/otp.d.ts +5 -4
- package/esm/otp-field/utils/otp.js +23 -12
- package/esm/popover/arrow/PopoverArrow.js +1 -1
- package/esm/popover/backdrop/PopoverBackdrop.js +1 -1
- package/esm/popover/close/PopoverClose.js +2 -2
- package/esm/popover/description/PopoverDescription.js +1 -7
- package/esm/popover/popup/PopoverPopup.d.ts +1 -1
- package/esm/popover/popup/PopoverPopup.js +16 -10
- package/esm/popover/popup/PopoverPopupDataAttributes.d.ts +1 -1
- package/esm/popover/popup/PopoverPopupDataAttributes.js +1 -1
- package/esm/popover/positioner/PopoverPositioner.js +5 -5
- package/esm/popover/root/PopoverRoot.d.ts +1 -1
- package/esm/popover/root/PopoverRoot.js +42 -47
- package/esm/popover/store/PopoverHandle.js +1 -1
- package/esm/popover/store/PopoverStore.d.ts +91 -4
- package/esm/popover/store/PopoverStore.js +17 -18
- package/esm/popover/title/PopoverTitle.js +1 -7
- package/esm/popover/trigger/PopoverTrigger.js +24 -17
- package/esm/popover/viewport/PopoverViewport.d.ts +3 -3
- package/esm/popover/viewport/PopoverViewport.js +2 -2
- package/esm/popover/viewport/PopoverViewportDataAttributes.d.ts +1 -1
- package/esm/popover/viewport/PopoverViewportDataAttributes.js +1 -1
- package/esm/preview-card/positioner/PreviewCardPositioner.js +11 -1
- package/esm/preview-card/root/PreviewCardRoot.d.ts +1 -1
- package/esm/preview-card/root/PreviewCardRoot.js +32 -22
- package/esm/preview-card/store/PreviewCardHandle.js +1 -1
- package/esm/preview-card/store/PreviewCardStore.d.ts +90 -2
- package/esm/preview-card/store/PreviewCardStore.js +19 -31
- package/esm/preview-card/trigger/PreviewCardTrigger.js +6 -3
- package/esm/preview-card/viewport/PreviewCardViewport.d.ts +2 -2
- package/esm/preview-card/viewport/PreviewCardViewport.js +2 -2
- package/esm/preview-card/viewport/PreviewCardViewportDataAttributes.d.ts +2 -2
- package/esm/preview-card/viewport/PreviewCardViewportDataAttributes.js +2 -2
- package/esm/progress/indicator/ProgressIndicator.js +6 -11
- package/esm/progress/root/ProgressRoot.d.ts +1 -1
- package/esm/radio/root/RadioRoot.js +7 -3
- package/esm/radio-group/RadioGroup.js +4 -11
- package/esm/radio-group/RadioGroupContext.d.ts +0 -1
- package/esm/scroll-area/content/ScrollAreaContent.js +4 -4
- package/esm/scroll-area/root/ScrollAreaRoot.js +1 -1
- package/esm/scroll-area/scrollbar/ScrollAreaScrollbar.js +16 -20
- package/esm/scroll-area/viewport/ScrollAreaViewport.js +6 -10
- package/esm/select/arrow/SelectArrow.js +1 -1
- package/esm/select/backdrop/SelectBackdrop.js +1 -1
- package/esm/select/group/SelectGroup.js +1 -1
- package/esm/select/group-label/SelectGroupLabel.js +2 -2
- package/esm/select/icon/SelectIcon.js +1 -1
- package/esm/select/item/SelectItem.js +46 -32
- package/esm/select/item/SelectItemContext.d.ts +1 -1
- package/esm/select/item-indicator/SelectItemIndicator.js +1 -2
- package/esm/select/item-text/SelectItemText.js +9 -6
- package/esm/select/list/SelectList.js +1 -1
- package/esm/select/popup/SelectPopup.js +8 -3
- package/esm/select/positioner/SelectPositioner.js +3 -0
- package/esm/select/root/SelectRoot.js +46 -40
- package/esm/select/root/SelectRootContext.d.ts +4 -5
- package/esm/select/store.d.ts +3 -0
- package/esm/select/store.js +1 -0
- package/esm/select/trigger/SelectTrigger.d.ts +5 -0
- package/esm/select/trigger/SelectTrigger.js +19 -33
- package/esm/select/trigger/SelectTriggerDataAttributes.d.ts +5 -0
- package/esm/select/trigger/SelectTriggerDataAttributes.js +5 -0
- package/esm/slider/control/SliderControl.js +10 -12
- package/esm/slider/root/SliderRoot.js +1 -4
- package/esm/slider/thumb/SliderThumb.js +32 -30
- package/esm/slider/value/SliderValue.js +7 -15
- package/esm/switch/root/SwitchRoot.js +10 -10
- package/esm/switch/thumb/SwitchThumb.js +1 -9
- package/esm/tabs/indicator/TabsIndicator.js +14 -19
- package/esm/tabs/list/TabsList.js +4 -10
- package/esm/tabs/list/TabsListContext.d.ts +2 -1
- package/esm/tabs/panel/TabsPanel.js +1 -1
- package/esm/tabs/root/TabsRoot.d.ts +16 -1
- package/esm/tabs/root/TabsRoot.js +73 -25
- package/esm/tabs/root/TabsRootContext.d.ts +0 -2
- package/esm/toast/provider/ToastProvider.js +1 -1
- package/esm/toast/root/ToastRoot.d.ts +1 -1
- package/esm/toast/root/ToastRoot.js +108 -131
- package/esm/toast/root/ToastRootDataAttributes.d.ts +1 -1
- package/esm/toast/root/ToastRootDataAttributes.js +1 -1
- package/esm/toast/store.d.ts +9 -1
- package/esm/toast/store.js +19 -13
- package/esm/toast/useToastManager.d.ts +1 -1
- package/esm/toast/viewport/ToastViewport.js +1 -1
- package/esm/toggle/Toggle.js +5 -9
- package/esm/toggle-group/ToggleGroup.d.ts +2 -2
- package/esm/toggle-group/ToggleGroup.js +6 -13
- package/esm/toolbar/link/ToolbarLink.d.ts +1 -1
- package/esm/toolbar/link/ToolbarLink.js +1 -2
- package/esm/tooltip/arrow/TooltipArrow.js +3 -3
- package/esm/tooltip/popup/TooltipPopup.js +5 -4
- package/esm/tooltip/root/TooltipRoot.js +35 -26
- package/esm/tooltip/store/TooltipHandle.js +1 -1
- package/esm/tooltip/store/TooltipStore.d.ts +90 -2
- package/esm/tooltip/store/TooltipStore.js +18 -31
- package/esm/tooltip/trigger/TooltipTrigger.js +151 -20
- package/esm/tooltip/viewport/TooltipViewport.d.ts +2 -2
- package/esm/tooltip/viewport/TooltipViewport.js +2 -2
- package/esm/tooltip/viewport/TooltipViewportDataAttributes.d.ts +1 -1
- package/esm/tooltip/viewport/TooltipViewportDataAttributes.js +1 -1
- package/esm/unstable-use-media-query/index.js +1 -1
- package/esm/utils/popups/index.d.ts +1 -0
- package/esm/utils/popups/index.js +1 -0
- package/esm/utils/popups/inlineRect.d.ts +15 -0
- package/esm/utils/popups/inlineRect.js +191 -0
- package/esm/utils/popups/popupStoreUtils.d.ts +28 -10
- package/esm/utils/popups/popupStoreUtils.js +105 -20
- package/esm/utils/popups/popupTriggerMap.js +2 -0
- package/esm/utils/popups/store.d.ts +15 -2
- package/esm/utils/popups/store.js +38 -2
- package/esm/utils/popups/useTriggerFocusGuards.js +4 -5
- package/esm/utils/useAnchorPositioning.d.ts +5 -0
- package/esm/utils/useAnchorPositioning.js +12 -9
- package/esm/utils/useOpenInteractionType.d.ts +4 -0
- package/esm/utils/useOpenInteractionType.js +23 -18
- package/field/control/FieldControl.js +2 -6
- package/field/item/FieldItem.js +1 -4
- package/field/root/FieldRoot.js +11 -3
- package/field/root/useFieldValidation.d.ts +1 -0
- package/field/root/useFieldValidation.js +23 -20
- package/field/utils/getCombinedFieldValidityData.d.ts +1 -1
- package/field/validity/FieldValidity.d.ts +1 -1
- package/floating-ui-react/components/FloatingDelayGroup.js +3 -3
- package/floating-ui-react/components/FloatingFocusManager.d.ts +1 -1
- package/floating-ui-react/components/FloatingFocusManager.js +20 -8
- package/floating-ui-react/components/FloatingPortal.js +3 -3
- package/floating-ui-react/hooks/useClick.js +82 -73
- package/floating-ui-react/hooks/useClientPoint.js +29 -20
- package/floating-ui-react/hooks/useDismiss.d.ts +1 -1
- package/floating-ui-react/hooks/useDismiss.js +82 -92
- package/floating-ui-react/hooks/useFloating.js +36 -32
- package/floating-ui-react/hooks/useFloatingRootContext.d.ts +1 -1
- package/floating-ui-react/hooks/useFloatingRootContext.js +2 -2
- package/floating-ui-react/hooks/useFocus.js +84 -81
- package/floating-ui-react/hooks/useHover.js +74 -78
- package/floating-ui-react/hooks/useHoverFloatingInteraction.js +48 -43
- package/floating-ui-react/hooks/useHoverInteractionSharedState.js +1 -1
- package/floating-ui-react/hooks/useHoverReferenceInteraction.d.ts +7 -2
- package/floating-ui-react/hooks/useHoverReferenceInteraction.js +43 -38
- package/floating-ui-react/hooks/useHoverShared.d.ts +2 -1
- package/floating-ui-react/hooks/useHoverShared.js +11 -0
- package/floating-ui-react/hooks/useListNavigation.d.ts +1 -3
- package/floating-ui-react/hooks/useListNavigation.js +83 -74
- package/floating-ui-react/hooks/useSyncedFloatingRootContext.d.ts +9 -6
- package/floating-ui-react/hooks/useSyncedFloatingRootContext.js +26 -20
- package/floating-ui-react/hooks/useTypeahead.d.ts +2 -2
- package/floating-ui-react/hooks/useTypeahead.js +33 -52
- package/floating-ui-react/index.d.ts +0 -2
- package/floating-ui-react/index.js +0 -14
- package/floating-ui-react/types.d.ts +2 -7
- package/floating-ui-react/utils/composite.js +2 -0
- package/floating-ui-react/utils/enqueueFocus.d.ts +1 -1
- package/floating-ui-react/utils/enqueueFocus.js +10 -7
- package/floating-ui-react/utils/getEmptyRootContext.js +1 -1
- package/form/Form.js +2 -2
- package/index.js +1 -1
- package/internals/composite/composite.d.ts +0 -1
- package/internals/composite/composite.js +2 -3
- package/internals/composite/root/useCompositeRoot.js +1 -1
- package/internals/createBaseUIEventDetails.d.ts +2 -0
- package/internals/csp-context/index.d.ts +2 -0
- package/internals/csp-context/index.js +18 -0
- package/internals/field-register-control/index.d.ts +0 -1
- package/internals/field-register-control/useFieldControlRegistration.d.ts +2 -1
- package/internals/field-register-control/useFieldControlRegistration.js +11 -14
- package/internals/field-register-control/useRegisterFieldControl.d.ts +1 -4
- package/internals/field-register-control/useRegisterFieldControl.js +6 -11
- package/internals/field-root-context/FieldRootContext.d.ts +1 -0
- package/internals/field-root-context/FieldRootContext.js +4 -3
- package/internals/form-context/FormContext.d.ts +5 -1
- package/internals/reason-parts.d.ts +2 -0
- package/internals/reason-parts.js +3 -1
- package/internals/types.d.ts +1 -0
- package/internals/use-button/useButton.js +4 -4
- package/internals/usePressAndHold.js +2 -2
- package/internals/useRenderElement.js +2 -0
- package/menu/arrow/MenuArrow.js +1 -1
- package/menu/backdrop/MenuBackdrop.js +1 -1
- package/menu/checkbox-item/MenuCheckboxItem.js +5 -7
- package/menu/group/MenuGroup.js +1 -4
- package/menu/group/MenuGroupContext.d.ts +1 -3
- package/menu/group/MenuGroupContext.js +1 -1
- package/menu/group-label/MenuGroupLabel.js +4 -6
- package/menu/link-item/MenuLinkItem.js +2 -2
- package/menu/popup/MenuPopup.js +5 -5
- package/menu/radio-group/MenuRadioGroup.js +11 -5
- package/menu/radio-item/MenuRadioItem.js +5 -7
- package/menu/root/MenuRoot.js +60 -65
- package/menu/store/MenuHandle.js +1 -1
- package/menu/store/MenuStore.d.ts +87 -0
- package/menu/submenu-trigger/MenuSubmenuTrigger.js +7 -4
- package/menu/trigger/MenuTrigger.js +12 -9
- package/menu/viewport/MenuViewport.d.ts +2 -2
- package/menu/viewport/MenuViewport.js +2 -2
- package/navigation-menu/arrow/NavigationMenuArrow.js +1 -1
- package/navigation-menu/backdrop/NavigationMenuBackdrop.js +1 -1
- package/navigation-menu/content/NavigationMenuContent.js +8 -5
- package/navigation-menu/icon/NavigationMenuIcon.js +1 -1
- package/navigation-menu/item/NavigationMenuItem.js +2 -2
- package/navigation-menu/list/NavigationMenuList.js +1 -1
- package/navigation-menu/popup/NavigationMenuPopup.js +2 -2
- package/navigation-menu/root/NavigationMenuRoot.js +1 -3
- package/navigation-menu/trigger/NavigationMenuTrigger.js +23 -16
- package/navigation-menu/utils/isOutsideMenuEvent.d.ts +0 -1
- package/navigation-menu/utils/isOutsideMenuEvent.js +1 -5
- package/navigation-menu/viewport/NavigationMenuViewport.js +2 -3
- package/number-field/input/NumberFieldInput.js +3 -5
- package/number-field/root/NumberFieldRoot.js +5 -2
- package/number-field/scrub-area/NumberFieldScrubArea.js +7 -3
- package/otp-field/input/OTPFieldInput.js +42 -28
- package/otp-field/root/OTPFieldRoot.d.ts +17 -8
- package/otp-field/root/OTPFieldRoot.js +32 -32
- package/otp-field/root/OTPFieldRootContext.d.ts +1 -1
- package/otp-field/utils/otp.d.ts +5 -4
- package/otp-field/utils/otp.js +24 -12
- package/package.json +331 -317
- package/popover/arrow/PopoverArrow.js +1 -1
- package/popover/backdrop/PopoverBackdrop.js +1 -1
- package/popover/close/PopoverClose.js +2 -2
- package/popover/description/PopoverDescription.js +1 -7
- package/popover/popup/PopoverPopup.d.ts +1 -1
- package/popover/popup/PopoverPopup.js +16 -10
- package/popover/popup/PopoverPopupDataAttributes.d.ts +1 -1
- package/popover/popup/PopoverPopupDataAttributes.js +1 -1
- package/popover/positioner/PopoverPositioner.js +5 -5
- package/popover/root/PopoverRoot.d.ts +1 -1
- package/popover/root/PopoverRoot.js +39 -44
- package/popover/store/PopoverHandle.js +1 -1
- package/popover/store/PopoverStore.d.ts +91 -4
- package/popover/store/PopoverStore.js +16 -19
- package/popover/title/PopoverTitle.js +1 -7
- package/popover/trigger/PopoverTrigger.js +23 -16
- package/popover/viewport/PopoverViewport.d.ts +3 -3
- package/popover/viewport/PopoverViewport.js +2 -2
- package/popover/viewport/PopoverViewportDataAttributes.d.ts +1 -1
- package/popover/viewport/PopoverViewportDataAttributes.js +1 -1
- package/preview-card/positioner/PreviewCardPositioner.js +11 -1
- package/preview-card/root/PreviewCardRoot.d.ts +1 -1
- package/preview-card/root/PreviewCardRoot.js +30 -20
- package/preview-card/store/PreviewCardHandle.js +1 -1
- package/preview-card/store/PreviewCardStore.d.ts +90 -2
- package/preview-card/store/PreviewCardStore.js +18 -30
- package/preview-card/trigger/PreviewCardTrigger.js +5 -2
- package/preview-card/viewport/PreviewCardViewport.d.ts +2 -2
- package/preview-card/viewport/PreviewCardViewport.js +2 -2
- package/preview-card/viewport/PreviewCardViewportDataAttributes.d.ts +2 -2
- package/preview-card/viewport/PreviewCardViewportDataAttributes.js +2 -2
- package/progress/indicator/ProgressIndicator.js +6 -11
- package/progress/root/ProgressRoot.d.ts +1 -1
- package/radio/root/RadioRoot.js +7 -3
- package/radio-group/RadioGroup.js +4 -11
- package/radio-group/RadioGroupContext.d.ts +0 -1
- package/scroll-area/content/ScrollAreaContent.js +4 -4
- package/scroll-area/root/ScrollAreaRoot.js +1 -1
- package/scroll-area/scrollbar/ScrollAreaScrollbar.js +16 -20
- package/scroll-area/viewport/ScrollAreaViewport.js +6 -10
- package/select/arrow/SelectArrow.js +1 -1
- package/select/backdrop/SelectBackdrop.js +1 -1
- package/select/group/SelectGroup.js +1 -1
- package/select/group-label/SelectGroupLabel.js +2 -2
- package/select/icon/SelectIcon.js +1 -1
- package/select/item/SelectItem.js +46 -32
- package/select/item/SelectItemContext.d.ts +1 -1
- package/select/item-indicator/SelectItemIndicator.js +1 -2
- package/select/item-text/SelectItemText.js +9 -6
- package/select/list/SelectList.js +1 -1
- package/select/popup/SelectPopup.js +8 -3
- package/select/positioner/SelectPositioner.js +3 -0
- package/select/root/SelectRoot.js +45 -39
- package/select/root/SelectRootContext.d.ts +4 -5
- package/select/store.d.ts +3 -0
- package/select/store.js +1 -0
- package/select/trigger/SelectTrigger.d.ts +5 -0
- package/select/trigger/SelectTrigger.js +19 -33
- package/select/trigger/SelectTriggerDataAttributes.d.ts +5 -0
- package/select/trigger/SelectTriggerDataAttributes.js +5 -0
- package/slider/control/SliderControl.js +9 -11
- package/slider/root/SliderRoot.js +1 -4
- package/slider/thumb/SliderThumb.js +32 -30
- package/slider/value/SliderValue.js +7 -15
- package/switch/root/SwitchRoot.js +10 -10
- package/switch/thumb/SwitchThumb.js +1 -9
- package/tabs/indicator/TabsIndicator.js +14 -19
- package/tabs/list/TabsList.js +4 -10
- package/tabs/list/TabsListContext.d.ts +2 -1
- package/tabs/panel/TabsPanel.js +1 -1
- package/tabs/root/TabsRoot.d.ts +16 -1
- package/tabs/root/TabsRoot.js +71 -24
- package/tabs/root/TabsRootContext.d.ts +0 -2
- package/toast/provider/ToastProvider.js +1 -1
- package/toast/root/ToastRoot.d.ts +1 -1
- package/toast/root/ToastRoot.js +110 -133
- package/toast/root/ToastRootDataAttributes.d.ts +1 -1
- package/toast/root/ToastRootDataAttributes.js +1 -1
- package/toast/store.d.ts +9 -1
- package/toast/store.js +18 -12
- package/toast/useToastManager.d.ts +1 -1
- package/toast/viewport/ToastViewport.js +1 -1
- package/toggle/Toggle.js +5 -9
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +6 -13
- package/toolbar/link/ToolbarLink.d.ts +1 -1
- package/toolbar/link/ToolbarLink.js +1 -2
- package/tooltip/arrow/TooltipArrow.js +3 -3
- package/tooltip/popup/TooltipPopup.js +5 -4
- package/tooltip/root/TooltipRoot.js +32 -23
- package/tooltip/store/TooltipHandle.js +1 -1
- package/tooltip/store/TooltipStore.d.ts +90 -2
- package/tooltip/store/TooltipStore.js +17 -30
- package/tooltip/trigger/TooltipTrigger.js +152 -20
- package/tooltip/viewport/TooltipViewport.d.ts +2 -2
- package/tooltip/viewport/TooltipViewport.js +2 -2
- package/tooltip/viewport/TooltipViewportDataAttributes.d.ts +1 -1
- package/tooltip/viewport/TooltipViewportDataAttributes.js +1 -1
- package/unstable-use-media-query/index.js +1 -1
- package/utils/popups/index.d.ts +1 -0
- package/utils/popups/index.js +11 -0
- package/utils/popups/inlineRect.d.ts +15 -0
- package/utils/popups/inlineRect.js +198 -0
- package/utils/popups/popupStoreUtils.d.ts +28 -10
- package/utils/popups/popupStoreUtils.js +110 -20
- package/utils/popups/popupTriggerMap.js +2 -0
- package/utils/popups/store.d.ts +15 -2
- package/utils/popups/store.js +39 -2
- package/utils/popups/useTriggerFocusGuards.js +4 -5
- package/utils/useAnchorPositioning.d.ts +5 -0
- package/utils/useAnchorPositioning.js +12 -9
- package/utils/useOpenInteractionType.d.ts +4 -0
- package/utils/useOpenInteractionType.js +24 -17
- package/checkbox-group/index.parts.d.ts +0 -1
- package/checkbox-group/index.parts.js +0 -12
- package/esm/checkbox-group/index.parts.d.ts +0 -1
- package/esm/checkbox-group/index.parts.js +0 -1
- package/esm/floating-ui-react/hooks/useInteractions.d.ts +0 -20
- package/esm/floating-ui-react/hooks/useInteractions.js +0 -88
- package/esm/floating-ui-react/hooks/useRole.d.ts +0 -17
- package/esm/floating-ui-react/hooks/useRole.js +0 -113
- package/floating-ui-react/hooks/useInteractions.d.ts +0 -20
- package/floating-ui-react/hooks/useInteractions.js +0 -95
- package/floating-ui-react/hooks/useRole.d.ts +0 -17
- package/floating-ui-react/hooks/useRole.js +0 -120
- /package/{csp-provider → esm/internals/csp-context}/CSPContext.d.ts +0 -0
- /package/esm/{csp-provider → internals/csp-context}/CSPContext.js +0 -0
- /package/{esm/csp-provider → internals/csp-context}/CSPContext.d.ts +0 -0
- /package/{csp-provider → internals/csp-context}/CSPContext.js +0 -0
|
@@ -8,19 +8,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.ESCAPE = void 0;
|
|
9
9
|
exports.useListNavigation = useListNavigation;
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
12
|
-
var _useValueAsRef = require("@base-ui/utils/useValueAsRef");
|
|
13
|
-
var _useStableCallback = require("@base-ui/utils/useStableCallback");
|
|
11
|
+
var _useAnimationFrame = require("@base-ui/utils/useAnimationFrame");
|
|
14
12
|
var _useIsoLayoutEffect = require("@base-ui/utils/useIsoLayoutEffect");
|
|
15
13
|
var _owner = require("@base-ui/utils/owner");
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var _FloatingTree = require("../components/FloatingTree");
|
|
14
|
+
var _useStableCallback = require("@base-ui/utils/useStableCallback");
|
|
15
|
+
var _useValueAsRef = require("@base-ui/utils/useValueAsRef");
|
|
16
|
+
var _dom = require("@floating-ui/utils/dom");
|
|
20
17
|
var _createBaseUIEventDetails = require("../../internals/createBaseUIEventDetails");
|
|
21
18
|
var _reasons = require("../../internals/reasons");
|
|
22
|
-
var
|
|
19
|
+
var _FloatingTree = require("../components/FloatingTree");
|
|
20
|
+
var _composite = require("../utils/composite");
|
|
23
21
|
var _constants = require("../utils/constants");
|
|
22
|
+
var _element = require("../utils/element");
|
|
23
|
+
var _enqueueFocus = require("../utils/enqueueFocus");
|
|
24
|
+
var _event = require("../utils/event");
|
|
24
25
|
const ESCAPE = exports.ESCAPE = 'Escape';
|
|
25
26
|
function doSwitch(orientation, vertical, horizontal) {
|
|
26
27
|
switch (orientation) {
|
|
@@ -61,11 +62,6 @@ function isCrossOrientationCloseKey(key, orientation, rtl, cols) {
|
|
|
61
62
|
* @see https://floating-ui.com/docs/useListNavigation
|
|
62
63
|
*/
|
|
63
64
|
function useListNavigation(context, props) {
|
|
64
|
-
const store = 'rootStore' in context ? context.rootStore : context;
|
|
65
|
-
const open = store.useState('open');
|
|
66
|
-
const floatingElement = store.useState('floatingElement');
|
|
67
|
-
const domReferenceElement = store.useState('domReferenceElement');
|
|
68
|
-
const dataRef = store.context.dataRef;
|
|
69
65
|
const {
|
|
70
66
|
listRef,
|
|
71
67
|
activeIndex,
|
|
@@ -101,14 +97,16 @@ function useListNavigation(context, props) {
|
|
|
101
97
|
console.warn('In grid list navigation mode (`cols` > 1), the `orientation` should', 'be either "horizontal" or "both".');
|
|
102
98
|
}
|
|
103
99
|
}
|
|
100
|
+
const store = 'rootStore' in context ? context.rootStore : context;
|
|
101
|
+
const open = store.useState('open');
|
|
102
|
+
const floatingElement = store.useState('floatingElement');
|
|
103
|
+
const domReferenceElement = store.useState('domReferenceElement');
|
|
104
|
+
const dataRef = store.context.dataRef;
|
|
104
105
|
const floatingFocusElement = (0, _element.getFloatingFocusElement)(floatingElement);
|
|
106
|
+
const typeableComboboxReference = (0, _element.isTypeableCombobox)(domReferenceElement);
|
|
105
107
|
const floatingFocusElementRef = (0, _useValueAsRef.useValueAsRef)(floatingFocusElement);
|
|
106
108
|
const parentId = (0, _FloatingTree.useFloatingParentNodeId)();
|
|
107
109
|
const tree = (0, _FloatingTree.useFloatingTree)(externalTree);
|
|
108
|
-
(0, _useIsoLayoutEffect.useIsoLayoutEffect)(() => {
|
|
109
|
-
dataRef.current.orientation = orientation;
|
|
110
|
-
}, [dataRef, orientation]);
|
|
111
|
-
const typeableComboboxReference = (0, _element.isTypeableCombobox)(domReferenceElement);
|
|
112
110
|
const focusItemOnOpenRef = React.useRef(focusItemOnOpen);
|
|
113
111
|
const indexRef = React.useRef(selectedIndex ?? -1);
|
|
114
112
|
const keyRef = React.useRef(null);
|
|
@@ -126,6 +124,8 @@ function useListNavigation(context, props) {
|
|
|
126
124
|
const latestOpenRef = (0, _useValueAsRef.useValueAsRef)(open);
|
|
127
125
|
const selectedIndexRef = (0, _useValueAsRef.useValueAsRef)(selectedIndex);
|
|
128
126
|
const resetOnPointerLeaveRef = (0, _useValueAsRef.useValueAsRef)(resetOnPointerLeave);
|
|
127
|
+
const focusFrame = (0, _useAnimationFrame.useAnimationFrame)();
|
|
128
|
+
const waitForListPopulatedFrame = (0, _useAnimationFrame.useAnimationFrame)();
|
|
129
129
|
const focusItem = (0, _useStableCallback.useStableCallback)(() => {
|
|
130
130
|
function runFocus(item) {
|
|
131
131
|
if (virtual) {
|
|
@@ -142,7 +142,7 @@ function useListNavigation(context, props) {
|
|
|
142
142
|
if (initialItem) {
|
|
143
143
|
runFocus(initialItem);
|
|
144
144
|
}
|
|
145
|
-
const scheduler = forceSyncFocusRef.current ?
|
|
145
|
+
const scheduler = forceSyncFocusRef.current ? callback => callback() : callback => focusFrame.request(callback);
|
|
146
146
|
scheduler(() => {
|
|
147
147
|
const waitedItem = listRef.current[indexRef.current] || initialItem;
|
|
148
148
|
if (!waitedItem) {
|
|
@@ -164,6 +164,9 @@ function useListNavigation(context, props) {
|
|
|
164
164
|
}
|
|
165
165
|
});
|
|
166
166
|
});
|
|
167
|
+
(0, _useIsoLayoutEffect.useIsoLayoutEffect)(() => {
|
|
168
|
+
dataRef.current.orientation = orientation;
|
|
169
|
+
}, [dataRef, orientation]);
|
|
167
170
|
|
|
168
171
|
// Sync `selectedIndex` to be the `activeIndex` upon opening the floating
|
|
169
172
|
// element. Also, reset `activeIndex` upon closing the floating element.
|
|
@@ -222,7 +225,7 @@ function useListNavigation(context, props) {
|
|
|
222
225
|
// otherwise use rAF. Don't try more than twice, since something
|
|
223
226
|
// is wrong otherwise.
|
|
224
227
|
if (runs < 2) {
|
|
225
|
-
const scheduler = runs ?
|
|
228
|
+
const scheduler = runs ? callback => waitForListPopulatedFrame.request(callback) : queueMicrotask;
|
|
226
229
|
scheduler(waitForListPopulated);
|
|
227
230
|
}
|
|
228
231
|
runs += 1;
|
|
@@ -240,7 +243,7 @@ function useListNavigation(context, props) {
|
|
|
240
243
|
focusItem();
|
|
241
244
|
forceScrollIntoViewRef.current = false;
|
|
242
245
|
}
|
|
243
|
-
}, [enabled, open, floatingElement, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem,
|
|
246
|
+
}, [enabled, open, floatingElement, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, waitForListPopulatedFrame]);
|
|
244
247
|
|
|
245
248
|
// Ensure the parent floating element has focus when a nested child closes
|
|
246
249
|
// to allow arrow key navigation to work after the pointer leaves the child.
|
|
@@ -280,57 +283,12 @@ function useListNavigation(context, props) {
|
|
|
280
283
|
onNavigate(event);
|
|
281
284
|
}
|
|
282
285
|
});
|
|
283
|
-
const
|
|
284
|
-
const itemProps = {
|
|
285
|
-
onFocus(event) {
|
|
286
|
-
forceSyncFocusRef.current = true;
|
|
287
|
-
syncCurrentTarget(event);
|
|
288
|
-
},
|
|
289
|
-
onClick: ({
|
|
290
|
-
currentTarget
|
|
291
|
-
}) => currentTarget.focus({
|
|
292
|
-
preventScroll: true
|
|
293
|
-
}),
|
|
294
|
-
// Safari
|
|
295
|
-
onMouseMove(event) {
|
|
296
|
-
forceSyncFocusRef.current = true;
|
|
297
|
-
forceScrollIntoViewRef.current = false;
|
|
298
|
-
if (focusItemOnHover) {
|
|
299
|
-
syncCurrentTarget(event);
|
|
300
|
-
}
|
|
301
|
-
},
|
|
302
|
-
onPointerLeave(event) {
|
|
303
|
-
if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === 'touch') {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
forceSyncFocusRef.current = true;
|
|
307
|
-
const relatedTarget = event.relatedTarget;
|
|
308
|
-
if (!focusItemOnHover || listRef.current.includes(relatedTarget)) {
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
if (!resetOnPointerLeaveRef.current) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
cancelQueuedFocusRef.current?.();
|
|
315
|
-
cancelQueuedFocusRef.current = null;
|
|
316
|
-
indexRef.current = -1;
|
|
317
|
-
onNavigate(event);
|
|
318
|
-
if (!virtual) {
|
|
319
|
-
const floatingFocusEl = floatingFocusElementRef.current;
|
|
320
|
-
const activeEl = (0, _element.activeElement)((0, _owner.ownerDocument)(floatingFocusEl));
|
|
321
|
-
if (floatingFocusEl && (0, _element.contains)(floatingFocusEl, activeEl)) {
|
|
322
|
-
floatingFocusEl.focus({
|
|
323
|
-
preventScroll: true
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
return itemProps;
|
|
330
|
-
}, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]);
|
|
331
|
-
const getParentOrientation = React.useCallback(() => {
|
|
286
|
+
const getParentOrientation = (0, _useStableCallback.useStableCallback)(() => {
|
|
332
287
|
return parentOrientation ?? tree?.nodesRef.current.find(node => node.id === parentId)?.context?.dataRef?.current.orientation;
|
|
333
|
-
}
|
|
288
|
+
});
|
|
289
|
+
const getMinEnabledIndex = (0, _useStableCallback.useStableCallback)(() => {
|
|
290
|
+
return (0, _composite.getMinListIndex)(listRef, disabledIndicesRef.current);
|
|
291
|
+
});
|
|
334
292
|
const commonOnKeyDown = (0, _useStableCallback.useStableCallback)(event => {
|
|
335
293
|
isPointerModalityRef.current = false;
|
|
336
294
|
forceSyncFocusRef.current = true;
|
|
@@ -482,6 +440,54 @@ function useListNavigation(context, props) {
|
|
|
482
440
|
onNavigate(event);
|
|
483
441
|
}
|
|
484
442
|
});
|
|
443
|
+
const item = React.useMemo(() => {
|
|
444
|
+
const itemProps = {
|
|
445
|
+
onFocus(event) {
|
|
446
|
+
forceSyncFocusRef.current = true;
|
|
447
|
+
syncCurrentTarget(event);
|
|
448
|
+
},
|
|
449
|
+
onClick: ({
|
|
450
|
+
currentTarget
|
|
451
|
+
}) => currentTarget.focus({
|
|
452
|
+
preventScroll: true
|
|
453
|
+
}),
|
|
454
|
+
// Safari
|
|
455
|
+
onMouseMove(event) {
|
|
456
|
+
forceSyncFocusRef.current = true;
|
|
457
|
+
forceScrollIntoViewRef.current = false;
|
|
458
|
+
if (focusItemOnHover) {
|
|
459
|
+
syncCurrentTarget(event);
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
onPointerLeave(event) {
|
|
463
|
+
if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === 'touch') {
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
forceSyncFocusRef.current = true;
|
|
467
|
+
const relatedTarget = event.relatedTarget;
|
|
468
|
+
if (!focusItemOnHover || listRef.current.includes(relatedTarget)) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
if (!resetOnPointerLeaveRef.current) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
cancelQueuedFocusRef.current?.();
|
|
475
|
+
cancelQueuedFocusRef.current = null;
|
|
476
|
+
indexRef.current = -1;
|
|
477
|
+
onNavigate(event);
|
|
478
|
+
if (!virtual) {
|
|
479
|
+
const floatingFocusEl = floatingFocusElementRef.current;
|
|
480
|
+
const activeEl = (0, _element.activeElement)((0, _owner.ownerDocument)(floatingFocusEl));
|
|
481
|
+
if (floatingFocusEl && (0, _element.contains)(floatingFocusEl, activeEl)) {
|
|
482
|
+
floatingFocusEl.focus({
|
|
483
|
+
preventScroll: true
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
return itemProps;
|
|
490
|
+
}, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]);
|
|
485
491
|
const ariaActiveDescendantProp = React.useMemo(() => {
|
|
486
492
|
return virtual && open && hasActiveIndex && {
|
|
487
493
|
'aria-activedescendant': `${id}-${activeIndex}`
|
|
@@ -516,6 +522,9 @@ function useListNavigation(context, props) {
|
|
|
516
522
|
};
|
|
517
523
|
}, [ariaActiveDescendantProp, commonOnKeyDown, floatingFocusElementRef, orientation, typeableComboboxReference, store, open, virtual, domReferenceElement]);
|
|
518
524
|
const trigger = React.useMemo(() => {
|
|
525
|
+
function openOnNavigationKeyDown(event) {
|
|
526
|
+
store.setOpen(true, (0, _createBaseUIEventDetails.createChangeEventDetails)(_reasons.REASONS.listNavigation, event.nativeEvent, event.currentTarget));
|
|
527
|
+
}
|
|
519
528
|
function checkVirtualMouse(event) {
|
|
520
529
|
if (focusItemOnOpen === 'auto' && (0, _event.isVirtualClick)(event.nativeEvent)) {
|
|
521
530
|
focusItemOnOpenRef.current = !virtual;
|
|
@@ -554,10 +563,10 @@ function useListNavigation(context, props) {
|
|
|
554
563
|
if (isParentCrossOpenKey) {
|
|
555
564
|
(0, _event.stopEvent)(event);
|
|
556
565
|
if (currentOpen) {
|
|
557
|
-
indexRef.current = (
|
|
566
|
+
indexRef.current = getMinEnabledIndex();
|
|
558
567
|
onNavigate(event);
|
|
559
568
|
} else {
|
|
560
|
-
|
|
569
|
+
openOnNavigationKeyDown(event);
|
|
561
570
|
}
|
|
562
571
|
}
|
|
563
572
|
return undefined;
|
|
@@ -568,7 +577,7 @@ function useListNavigation(context, props) {
|
|
|
568
577
|
}
|
|
569
578
|
(0, _event.stopEvent)(event);
|
|
570
579
|
if (!currentOpen && openOnArrowKeyDown) {
|
|
571
|
-
|
|
580
|
+
openOnNavigationKeyDown(event);
|
|
572
581
|
} else {
|
|
573
582
|
commonOnKeyDown(event);
|
|
574
583
|
}
|
|
@@ -589,7 +598,7 @@ function useListNavigation(context, props) {
|
|
|
589
598
|
onMouseDown: checkVirtualMouse,
|
|
590
599
|
onClick: checkVirtualMouse
|
|
591
600
|
};
|
|
592
|
-
}, [commonOnKeyDown,
|
|
601
|
+
}, [commonOnKeyDown, focusItemOnOpen, getMinEnabledIndex, nested, onNavigate, store, openOnArrowKeyDown, orientation, getParentOrientation, rtl, selectedIndexRef, virtual]);
|
|
593
602
|
const reference = React.useMemo(() => {
|
|
594
603
|
return {
|
|
595
604
|
...ariaActiveDescendantProp,
|
|
@@ -2,16 +2,19 @@ import { ReactStore } from '@base-ui/utils/store';
|
|
|
2
2
|
import { BaseUIChangeEventDetails } from "../../types/index.js";
|
|
3
3
|
import { PopupStoreContext, PopupStoreSelectors, PopupStoreState } from "../../utils/popups/index.js";
|
|
4
4
|
import { FloatingRootStore } from "../components/FloatingRootStore.js";
|
|
5
|
-
export interface UseSyncedFloatingRootContextOptions<State extends PopupStoreState<
|
|
6
|
-
popupStore: ReactStore<State, PopupStoreContext<
|
|
5
|
+
export interface UseSyncedFloatingRootContextOptions<State extends PopupStoreState<unknown>, ContextEventDetails extends BaseUIChangeEventDetails<string>, OpenChangeEventDetails extends BaseUIChangeEventDetails<string>> {
|
|
6
|
+
popupStore: ReactStore<State, PopupStoreContext<ContextEventDetails>, PopupStoreSelectors>;
|
|
7
7
|
/**
|
|
8
8
|
* Whether the Popup element is passed to Floating UI as the floating element instead of the default Positioner.
|
|
9
9
|
*/
|
|
10
10
|
treatPopupAsFloatingElement?: boolean | undefined;
|
|
11
|
-
|
|
11
|
+
floatingRootContext?: FloatingRootStore | undefined;
|
|
12
|
+
floatingId: string | undefined;
|
|
13
|
+
nested: boolean;
|
|
14
|
+
onOpenChange(open: boolean, eventDetails: OpenChangeEventDetails): void;
|
|
12
15
|
}
|
|
13
16
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
17
|
+
* Keeps a FloatingRootStore in sync with the provided PopupStore.
|
|
18
|
+
* Uses the provided FloatingRootStore when one exists, otherwise creates one once and updates it on every render.
|
|
16
19
|
*/
|
|
17
|
-
export declare function useSyncedFloatingRootContext<State extends PopupStoreState<
|
|
20
|
+
export declare function useSyncedFloatingRootContext<State extends PopupStoreState<unknown>, ContextEventDetails extends BaseUIChangeEventDetails<string>, OpenChangeEventDetails extends BaseUIChangeEventDetails<string>>(options: UseSyncedFloatingRootContextOptions<State, ContextEventDetails, OpenChangeEventDetails>): FloatingRootStore;
|
|
@@ -1,43 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.useSyncedFloatingRootContext = useSyncedFloatingRootContext;
|
|
8
|
-
var
|
|
9
|
-
var _useRefWithInit = require("@base-ui/utils/useRefWithInit");
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _useIsoLayoutEffect = require("@base-ui/utils/useIsoLayoutEffect");
|
|
11
11
|
var _dom = require("@floating-ui/utils/dom");
|
|
12
|
-
var _FloatingTree = require("../components/FloatingTree");
|
|
13
12
|
var _FloatingRootStore = require("../components/FloatingRootStore");
|
|
14
13
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* Keeps a FloatingRootStore in sync with the provided PopupStore.
|
|
15
|
+
* Uses the provided FloatingRootStore when one exists, otherwise creates one once and updates it on every render.
|
|
17
16
|
*/
|
|
18
17
|
function useSyncedFloatingRootContext(options) {
|
|
19
18
|
const {
|
|
20
19
|
popupStore,
|
|
21
20
|
treatPopupAsFloatingElement = false,
|
|
21
|
+
floatingRootContext: floatingRootContextProp,
|
|
22
|
+
floatingId,
|
|
23
|
+
nested,
|
|
22
24
|
onOpenChange
|
|
23
25
|
} = options;
|
|
24
|
-
const floatingId = (0, _useId.useId)();
|
|
25
|
-
const nested = (0, _FloatingTree.useFloatingParentNodeId)() != null;
|
|
26
26
|
const open = popupStore.useState('open');
|
|
27
27
|
const referenceElement = popupStore.useState('activeTriggerElement');
|
|
28
28
|
const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? 'popupElement' : 'positionerElement');
|
|
29
29
|
const triggerElements = popupStore.context.triggerElements;
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
const handleOpenChange = onOpenChange;
|
|
31
|
+
const internalStoreRef = React.useRef(null);
|
|
32
|
+
if (floatingRootContextProp === undefined && internalStoreRef.current === null) {
|
|
33
|
+
internalStoreRef.current = new _FloatingRootStore.FloatingRootStore({
|
|
34
|
+
open,
|
|
35
|
+
transitionStatus: undefined,
|
|
36
|
+
referenceElement,
|
|
37
|
+
floatingElement,
|
|
38
|
+
triggerElements,
|
|
39
|
+
onOpenChange: handleOpenChange,
|
|
40
|
+
floatingId,
|
|
41
|
+
syncOnly: true,
|
|
42
|
+
nested
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const store = floatingRootContextProp ?? internalStoreRef.current;
|
|
46
|
+
popupStore.useSyncedValue('floatingId', floatingId);
|
|
41
47
|
(0, _useIsoLayoutEffect.useIsoLayoutEffect)(() => {
|
|
42
48
|
const valuesToSync = {
|
|
43
49
|
open,
|
|
@@ -54,8 +60,8 @@ function useSyncedFloatingRootContext(options) {
|
|
|
54
60
|
store.update(valuesToSync);
|
|
55
61
|
}, [open, floatingId, referenceElement, floatingElement, store]);
|
|
56
62
|
|
|
57
|
-
//
|
|
58
|
-
store.context.onOpenChange =
|
|
63
|
+
// Keep non-reactive context values fresh for interactions that call `store.setOpen`.
|
|
64
|
+
store.context.onOpenChange = handleOpenChange;
|
|
59
65
|
store.context.nested = nested;
|
|
60
66
|
return store;
|
|
61
67
|
}
|
|
@@ -24,9 +24,9 @@ export interface UseTypeaheadProps {
|
|
|
24
24
|
*/
|
|
25
25
|
elementsRef?: React.RefObject<Array<HTMLElement | null>> | undefined;
|
|
26
26
|
/**
|
|
27
|
-
* Callback invoked with the typing
|
|
27
|
+
* Callback invoked with the current typing activity as the user types.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
onTyping?: ((isTyping: boolean) => void) | undefined;
|
|
30
30
|
/**
|
|
31
31
|
* Whether the Hook is enabled, including all internal Effects and event
|
|
32
32
|
* handlers.
|
|
@@ -7,62 +7,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.useTypeahead = useTypeahead;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _useStableCallback = require("@base-ui/utils/useStableCallback");
|
|
11
10
|
var _useIsoLayoutEffect = require("@base-ui/utils/useIsoLayoutEffect");
|
|
11
|
+
var _useStableCallback = require("@base-ui/utils/useStableCallback");
|
|
12
12
|
var _useTimeout = require("@base-ui/utils/useTimeout");
|
|
13
|
+
var _composite = require("../utils/composite");
|
|
13
14
|
var _element = require("../utils/element");
|
|
14
15
|
var _event = require("../utils/event");
|
|
15
|
-
var _composite = require("../utils/composite");
|
|
16
16
|
/**
|
|
17
17
|
* Provides a matching callback that can be used to focus an item as the user
|
|
18
18
|
* types, often used in tandem with `useListNavigation()`.
|
|
19
19
|
* @see https://floating-ui.com/docs/useTypeahead
|
|
20
20
|
*/
|
|
21
21
|
function useTypeahead(context, props) {
|
|
22
|
-
const store = 'rootStore' in context ? context.rootStore : context;
|
|
23
|
-
const dataRef = store.context.dataRef;
|
|
24
|
-
const open = store.useState('open');
|
|
25
22
|
const {
|
|
26
23
|
listRef,
|
|
27
24
|
elementsRef,
|
|
28
25
|
activeIndex,
|
|
29
26
|
onMatch: onMatchProp,
|
|
30
|
-
|
|
27
|
+
onTyping,
|
|
31
28
|
enabled = true,
|
|
32
29
|
resetMs = 750,
|
|
33
30
|
selectedIndex = null
|
|
34
31
|
} = props;
|
|
32
|
+
const store = 'rootStore' in context ? context.rootStore : context;
|
|
33
|
+
const open = store.useState('open');
|
|
35
34
|
const timeout = (0, _useTimeout.useTimeout)();
|
|
36
35
|
const stringRef = React.useRef('');
|
|
37
36
|
const prevIndexRef = React.useRef(selectedIndex ?? activeIndex ?? -1);
|
|
38
37
|
const matchIndexRef = React.useRef(null);
|
|
39
|
-
(0, _useIsoLayoutEffect.useIsoLayoutEffect)(() => {
|
|
40
|
-
if (!open && selectedIndex !== null) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
timeout.clear();
|
|
44
|
-
matchIndexRef.current = null;
|
|
45
|
-
if (stringRef.current !== '') {
|
|
46
|
-
stringRef.current = '';
|
|
47
|
-
}
|
|
48
|
-
}, [open, selectedIndex, timeout]);
|
|
49
|
-
(0, _useIsoLayoutEffect.useIsoLayoutEffect)(() => {
|
|
50
|
-
// Sync arrow key navigation but not typeahead navigation.
|
|
51
|
-
if (open && stringRef.current === '') {
|
|
52
|
-
prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;
|
|
53
|
-
}
|
|
54
|
-
}, [open, selectedIndex, activeIndex]);
|
|
55
|
-
const setTypingChange = (0, _useStableCallback.useStableCallback)(value => {
|
|
56
|
-
if (value) {
|
|
57
|
-
if (!dataRef.current.typing) {
|
|
58
|
-
dataRef.current.typing = value;
|
|
59
|
-
onTypingChange?.(value);
|
|
60
|
-
}
|
|
61
|
-
} else if (dataRef.current.typing) {
|
|
62
|
-
dataRef.current.typing = value;
|
|
63
|
-
onTypingChange?.(value);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
38
|
const onKeyDown = (0, _useStableCallback.useStableCallback)(event => {
|
|
67
39
|
function isVisible(index) {
|
|
68
40
|
const element = elementsRef?.current[index];
|
|
@@ -88,11 +60,11 @@ function useTypeahead(context, props) {
|
|
|
88
60
|
if (stringRef.current.length > 0 && event.key === ' ') {
|
|
89
61
|
// Space should continue the in-progress typeahead session.
|
|
90
62
|
(0, _event.stopEvent)(event);
|
|
91
|
-
|
|
63
|
+
onTyping?.(true);
|
|
92
64
|
}
|
|
93
65
|
if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') {
|
|
94
66
|
if (getMatchingIndex(listContent, stringRef.current) === -1 && event.key !== ' ') {
|
|
95
|
-
|
|
67
|
+
onTyping?.(false);
|
|
96
68
|
}
|
|
97
69
|
}
|
|
98
70
|
if (listContent == null ||
|
|
@@ -104,7 +76,7 @@ function useTypeahead(context, props) {
|
|
|
104
76
|
}
|
|
105
77
|
if (open && event.key !== ' ') {
|
|
106
78
|
(0, _event.stopEvent)(event);
|
|
107
|
-
|
|
79
|
+
onTyping?.(true);
|
|
108
80
|
}
|
|
109
81
|
|
|
110
82
|
// Capture whether this is a new typing session before mutating the string.
|
|
@@ -127,7 +99,7 @@ function useTypeahead(context, props) {
|
|
|
127
99
|
timeout.start(resetMs, () => {
|
|
128
100
|
stringRef.current = '';
|
|
129
101
|
prevIndexRef.current = matchIndexRef.current;
|
|
130
|
-
|
|
102
|
+
onTyping?.(false);
|
|
131
103
|
});
|
|
132
104
|
|
|
133
105
|
// Compute the starting index for this search.
|
|
@@ -141,18 +113,17 @@ function useTypeahead(context, props) {
|
|
|
141
113
|
matchIndexRef.current = index;
|
|
142
114
|
} else if (event.key !== ' ') {
|
|
143
115
|
stringRef.current = '';
|
|
144
|
-
|
|
116
|
+
onTyping?.(false);
|
|
145
117
|
}
|
|
146
118
|
});
|
|
147
119
|
const onBlur = (0, _useStableCallback.useStableCallback)(event => {
|
|
148
120
|
const next = event.relatedTarget;
|
|
149
121
|
const currentDomReferenceElement = store.select('domReferenceElement');
|
|
150
122
|
const currentFloatingElement = store.select('floatingElement');
|
|
151
|
-
const
|
|
152
|
-
const withinFloating = (0, _element.contains)(currentFloatingElement, next);
|
|
123
|
+
const withinComposite = (0, _element.contains)(currentDomReferenceElement, next) || (0, _element.contains)(currentFloatingElement, next);
|
|
153
124
|
|
|
154
125
|
// Keep the session if focus moves within the composite (reference <-> floating).
|
|
155
|
-
if (
|
|
126
|
+
if (withinComposite) {
|
|
156
127
|
return;
|
|
157
128
|
}
|
|
158
129
|
|
|
@@ -160,20 +131,30 @@ function useTypeahead(context, props) {
|
|
|
160
131
|
timeout.clear();
|
|
161
132
|
stringRef.current = '';
|
|
162
133
|
prevIndexRef.current = matchIndexRef.current;
|
|
163
|
-
|
|
134
|
+
onTyping?.(false);
|
|
164
135
|
});
|
|
165
|
-
|
|
136
|
+
(0, _useIsoLayoutEffect.useIsoLayoutEffect)(() => {
|
|
137
|
+
if (!open && selectedIndex !== null) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
timeout.clear();
|
|
141
|
+
matchIndexRef.current = null;
|
|
142
|
+
if (stringRef.current !== '') {
|
|
143
|
+
stringRef.current = '';
|
|
144
|
+
}
|
|
145
|
+
}, [open, selectedIndex, timeout]);
|
|
146
|
+
(0, _useIsoLayoutEffect.useIsoLayoutEffect)(() => {
|
|
147
|
+
// Sync arrow key navigation but not typeahead navigation.
|
|
148
|
+
if (open && stringRef.current === '') {
|
|
149
|
+
prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;
|
|
150
|
+
}
|
|
151
|
+
}, [open, selectedIndex, activeIndex]);
|
|
152
|
+
const sharedProps = React.useMemo(() => ({
|
|
166
153
|
onKeyDown,
|
|
167
154
|
onBlur
|
|
168
155
|
}), [onKeyDown, onBlur]);
|
|
169
|
-
const floating = React.useMemo(() => {
|
|
170
|
-
return {
|
|
171
|
-
onKeyDown,
|
|
172
|
-
onBlur
|
|
173
|
-
};
|
|
174
|
-
}, [onKeyDown, onBlur]);
|
|
175
156
|
return React.useMemo(() => enabled ? {
|
|
176
|
-
reference,
|
|
177
|
-
floating
|
|
178
|
-
} : {}, [enabled,
|
|
157
|
+
reference: sharedProps,
|
|
158
|
+
floating: sharedProps
|
|
159
|
+
} : {}, [enabled, sharedProps]);
|
|
179
160
|
}
|
|
@@ -13,9 +13,7 @@ export { useFocus } from "./hooks/useFocus.js";
|
|
|
13
13
|
export { useHoverFloatingInteraction } from "./hooks/useHoverFloatingInteraction.js";
|
|
14
14
|
export { useHoverReferenceInteraction } from "./hooks/useHoverReferenceInteraction.js";
|
|
15
15
|
export { useHover } from "./hooks/useHover.js";
|
|
16
|
-
export { useInteractions } from "./hooks/useInteractions.js";
|
|
17
16
|
export { useListNavigation } from "./hooks/useListNavigation.js";
|
|
18
|
-
export { useRole } from "./hooks/useRole.js";
|
|
19
17
|
export { useTypeahead } from "./hooks/useTypeahead.js";
|
|
20
18
|
export { safePolygon } from "./safePolygon.js";
|
|
21
19
|
export type * from "./types.js";
|
|
@@ -213,24 +213,12 @@ Object.defineProperty(exports, "useHoverReferenceInteraction", {
|
|
|
213
213
|
return _useHoverReferenceInteraction.useHoverReferenceInteraction;
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
|
-
Object.defineProperty(exports, "useInteractions", {
|
|
217
|
-
enumerable: true,
|
|
218
|
-
get: function () {
|
|
219
|
-
return _useInteractions.useInteractions;
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
216
|
Object.defineProperty(exports, "useListNavigation", {
|
|
223
217
|
enumerable: true,
|
|
224
218
|
get: function () {
|
|
225
219
|
return _useListNavigation.useListNavigation;
|
|
226
220
|
}
|
|
227
221
|
});
|
|
228
|
-
Object.defineProperty(exports, "useRole", {
|
|
229
|
-
enumerable: true,
|
|
230
|
-
get: function () {
|
|
231
|
-
return _useRole.useRole;
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
222
|
Object.defineProperty(exports, "useSyncedFloatingRootContext", {
|
|
235
223
|
enumerable: true,
|
|
236
224
|
get: function () {
|
|
@@ -258,9 +246,7 @@ var _useFocus = require("./hooks/useFocus");
|
|
|
258
246
|
var _useHoverFloatingInteraction = require("./hooks/useHoverFloatingInteraction");
|
|
259
247
|
var _useHoverReferenceInteraction = require("./hooks/useHoverReferenceInteraction");
|
|
260
248
|
var _useHover = require("./hooks/useHover");
|
|
261
|
-
var _useInteractions = require("./hooks/useInteractions");
|
|
262
249
|
var _useListNavigation = require("./hooks/useListNavigation");
|
|
263
|
-
var _useRole = require("./hooks/useRole");
|
|
264
250
|
var _useTypeahead = require("./hooks/useTypeahead");
|
|
265
251
|
var _safePolygon = require("./safePolygon");
|
|
266
252
|
var _reactDom = require("@floating-ui/react-dom");
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { UseFloatingOptions as UsePositionOptions, UseFloatingReturn as UsePositionFloatingReturn, VirtualElement } from '@floating-ui/react-dom';
|
|
2
2
|
import type * as React from 'react';
|
|
3
3
|
import type { BaseUIChangeEventDetails } from "../internals/createBaseUIEventDetails.js";
|
|
4
|
-
import type { ExtendedUserProps } from "./hooks/useInteractions.js";
|
|
5
4
|
import type { FloatingTreeStore } from "./components/FloatingTreeStore.js";
|
|
6
5
|
import type { FloatingRootStore } from "./components/FloatingRootStore.js";
|
|
7
6
|
export * from "./index.js";
|
|
@@ -16,10 +15,8 @@ export type { HandleCloseContext, HandleClose } from "./hooks/useHoverShared.js"
|
|
|
16
15
|
export type { UseHoverFloatingInteractionProps } from "./hooks/useHoverFloatingInteraction.js";
|
|
17
16
|
export type { UseHoverReferenceInteractionProps } from "./hooks/useHoverReferenceInteraction.js";
|
|
18
17
|
export type { UseListNavigationProps } from "./hooks/useListNavigation.js";
|
|
19
|
-
export type { UseRoleProps } from "./hooks/useRole.js";
|
|
20
18
|
export type { UseTypeaheadProps } from "./hooks/useTypeahead.js";
|
|
21
19
|
export type { UseFloatingRootContextOptions } from "./hooks/useFloatingRootContext.js";
|
|
22
|
-
export type { UseInteractionsReturn } from "./hooks/useInteractions.js";
|
|
23
20
|
export type { SafePolygonOptions } from "./safePolygon.js";
|
|
24
21
|
export type { FloatingTreeProps, FloatingNodeProps } from "./components/FloatingTree.js";
|
|
25
22
|
export type { AlignedPlacement, Alignment, ArrowOptions, AutoPlacementOptions, AutoUpdateOptions, Axis, Boundary, ClientRectObject, ComputePositionConfig, ComputePositionReturn, Coords, DetectOverflowOptions, Dimensions, ElementContext, ElementRects, Elements, FlipOptions, FloatingElement, HideOptions, InlineOptions, Length, Middleware, MiddlewareArguments, MiddlewareData, MiddlewareReturn, MiddlewareState, NodeScroll, OffsetOptions, Padding, Placement, Platform, Rect, ReferenceElement, RootBoundary, ShiftOptions, Side, SideObject, SizeOptions, Strategy, VirtualElement } from '@floating-ui/react-dom';
|
|
@@ -51,8 +48,6 @@ export interface FloatingEvents {
|
|
|
51
48
|
export interface ContextData {
|
|
52
49
|
openEvent?: Event | undefined;
|
|
53
50
|
floatingContext?: FloatingContext | undefined;
|
|
54
|
-
/** @deprecated use `onTypingChange` prop in `useTypeahead` */
|
|
55
|
-
typing?: boolean | undefined;
|
|
56
51
|
[key: string]: any;
|
|
57
52
|
}
|
|
58
53
|
export type FloatingRootContext = FloatingRootStore;
|
|
@@ -76,7 +71,7 @@ export type FloatingTreeType = FloatingTreeStore;
|
|
|
76
71
|
export interface ElementProps {
|
|
77
72
|
reference?: React.HTMLProps<Element> | undefined;
|
|
78
73
|
floating?: React.HTMLProps<HTMLElement> | undefined;
|
|
79
|
-
item?: React.HTMLProps<HTMLElement> |
|
|
74
|
+
item?: React.HTMLProps<HTMLElement> | undefined;
|
|
80
75
|
trigger?: React.HTMLProps<Element> | undefined;
|
|
81
76
|
}
|
|
82
77
|
export type ReferenceType = Element | VirtualElement;
|
|
@@ -117,7 +112,7 @@ export interface UseFloatingOptions extends Omit<UsePositionOptions, 'elements'>
|
|
|
117
112
|
*/
|
|
118
113
|
nodeId?: string | undefined;
|
|
119
114
|
/**
|
|
120
|
-
* External
|
|
115
|
+
* External FloatingTree to use when the one provided by context can't be used.
|
|
121
116
|
*/
|
|
122
117
|
externalTree?: FloatingTreeStore | undefined;
|
|
123
118
|
}
|
|
@@ -313,6 +313,8 @@ function createGridCellMap(sizes, cols, dense) {
|
|
|
313
313
|
}, index) => {
|
|
314
314
|
if (width > cols) {
|
|
315
315
|
if (process.env.NODE_ENV !== 'production') {
|
|
316
|
+
// TODO: fix mui/no-guarded-throw
|
|
317
|
+
// eslint-disable-next-line mui/no-guarded-throw
|
|
316
318
|
throw new Error(`[Floating UI]: Invalid grid - item width at index ${index} is greater than grid columns`);
|
|
317
319
|
}
|
|
318
320
|
}
|
|
@@ -2,8 +2,8 @@ import { NOOP } from '@base-ui/utils/empty';
|
|
|
2
2
|
import type { FocusableElement } from "./tabbable.js";
|
|
3
3
|
interface Options {
|
|
4
4
|
preventScroll?: boolean | undefined;
|
|
5
|
-
cancelPrevious?: boolean | undefined;
|
|
6
5
|
sync?: boolean | undefined;
|
|
6
|
+
shouldFocus?: (() => boolean) | undefined;
|
|
7
7
|
}
|
|
8
8
|
export declare function enqueueFocus(el: FocusableElement | null, options?: Options): typeof NOOP;
|
|
9
9
|
export {};
|