@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
|
@@ -61,6 +61,8 @@ declare const selectors: {
|
|
|
61
61
|
mounted: boolean;
|
|
62
62
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
63
63
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
64
|
+
floatingId: string | undefined;
|
|
65
|
+
triggerCount: number;
|
|
64
66
|
preventUnmountingOnClose: boolean;
|
|
65
67
|
payload: unknown;
|
|
66
68
|
activeTriggerId: string | null;
|
|
@@ -78,6 +80,8 @@ declare const selectors: {
|
|
|
78
80
|
mounted: boolean;
|
|
79
81
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
80
82
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
83
|
+
floatingId: string | undefined;
|
|
84
|
+
triggerCount: number;
|
|
81
85
|
preventUnmountingOnClose: boolean;
|
|
82
86
|
payload: unknown;
|
|
83
87
|
activeTriggerId: string | null;
|
|
@@ -95,6 +99,8 @@ declare const selectors: {
|
|
|
95
99
|
mounted: boolean;
|
|
96
100
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
97
101
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
102
|
+
floatingId: string | undefined;
|
|
103
|
+
triggerCount: number;
|
|
98
104
|
preventUnmountingOnClose: boolean;
|
|
99
105
|
payload: unknown;
|
|
100
106
|
activeTriggerId: string | null;
|
|
@@ -112,6 +118,8 @@ declare const selectors: {
|
|
|
112
118
|
mounted: boolean;
|
|
113
119
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
114
120
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
121
|
+
floatingId: string | undefined;
|
|
122
|
+
triggerCount: number;
|
|
115
123
|
preventUnmountingOnClose: boolean;
|
|
116
124
|
payload: unknown;
|
|
117
125
|
activeTriggerId: string | null;
|
|
@@ -123,12 +131,33 @@ declare const selectors: {
|
|
|
123
131
|
inactiveTriggerProps: HTMLProps;
|
|
124
132
|
popupProps: HTMLProps;
|
|
125
133
|
}) => import("../../floating-ui-react/components/FloatingRootStore.js").FloatingRootStore;
|
|
134
|
+
triggerCount: (state: {
|
|
135
|
+
open: boolean;
|
|
136
|
+
readonly openProp: boolean | undefined;
|
|
137
|
+
mounted: boolean;
|
|
138
|
+
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
139
|
+
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
140
|
+
floatingId: string | undefined;
|
|
141
|
+
triggerCount: number;
|
|
142
|
+
preventUnmountingOnClose: boolean;
|
|
143
|
+
payload: unknown;
|
|
144
|
+
activeTriggerId: string | null;
|
|
145
|
+
activeTriggerElement: Element | null;
|
|
146
|
+
readonly triggerIdProp: string | null | undefined;
|
|
147
|
+
popupElement: HTMLElement | null;
|
|
148
|
+
positionerElement: HTMLElement | null;
|
|
149
|
+
activeTriggerProps: HTMLProps;
|
|
150
|
+
inactiveTriggerProps: HTMLProps;
|
|
151
|
+
popupProps: HTMLProps;
|
|
152
|
+
}) => number;
|
|
126
153
|
preventUnmountingOnClose: (state: {
|
|
127
154
|
open: boolean;
|
|
128
155
|
readonly openProp: boolean | undefined;
|
|
129
156
|
mounted: boolean;
|
|
130
157
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
131
158
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
159
|
+
floatingId: string | undefined;
|
|
160
|
+
triggerCount: number;
|
|
132
161
|
preventUnmountingOnClose: boolean;
|
|
133
162
|
payload: unknown;
|
|
134
163
|
activeTriggerId: string | null;
|
|
@@ -146,6 +175,8 @@ declare const selectors: {
|
|
|
146
175
|
mounted: boolean;
|
|
147
176
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
148
177
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
178
|
+
floatingId: string | undefined;
|
|
179
|
+
triggerCount: number;
|
|
149
180
|
preventUnmountingOnClose: boolean;
|
|
150
181
|
payload: unknown;
|
|
151
182
|
activeTriggerId: string | null;
|
|
@@ -163,6 +194,8 @@ declare const selectors: {
|
|
|
163
194
|
mounted: boolean;
|
|
164
195
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
165
196
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
197
|
+
floatingId: string | undefined;
|
|
198
|
+
triggerCount: number;
|
|
166
199
|
preventUnmountingOnClose: boolean;
|
|
167
200
|
payload: unknown;
|
|
168
201
|
activeTriggerId: string | null;
|
|
@@ -180,6 +213,8 @@ declare const selectors: {
|
|
|
180
213
|
mounted: boolean;
|
|
181
214
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
182
215
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
216
|
+
floatingId: string | undefined;
|
|
217
|
+
triggerCount: number;
|
|
183
218
|
preventUnmountingOnClose: boolean;
|
|
184
219
|
payload: unknown;
|
|
185
220
|
activeTriggerId: string | null;
|
|
@@ -191,12 +226,33 @@ declare const selectors: {
|
|
|
191
226
|
inactiveTriggerProps: HTMLProps;
|
|
192
227
|
popupProps: HTMLProps;
|
|
193
228
|
}) => Element | null;
|
|
229
|
+
popupId: (state: {
|
|
230
|
+
open: boolean;
|
|
231
|
+
readonly openProp: boolean | undefined;
|
|
232
|
+
mounted: boolean;
|
|
233
|
+
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
234
|
+
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
235
|
+
floatingId: string | undefined;
|
|
236
|
+
triggerCount: number;
|
|
237
|
+
preventUnmountingOnClose: boolean;
|
|
238
|
+
payload: unknown;
|
|
239
|
+
activeTriggerId: string | null;
|
|
240
|
+
activeTriggerElement: Element | null;
|
|
241
|
+
readonly triggerIdProp: string | null | undefined;
|
|
242
|
+
popupElement: HTMLElement | null;
|
|
243
|
+
positionerElement: HTMLElement | null;
|
|
244
|
+
activeTriggerProps: HTMLProps;
|
|
245
|
+
inactiveTriggerProps: HTMLProps;
|
|
246
|
+
popupProps: HTMLProps;
|
|
247
|
+
}) => string | undefined;
|
|
194
248
|
isTriggerActive: (state: {
|
|
195
249
|
open: boolean;
|
|
196
250
|
readonly openProp: boolean | undefined;
|
|
197
251
|
mounted: boolean;
|
|
198
252
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
199
253
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
254
|
+
floatingId: string | undefined;
|
|
255
|
+
triggerCount: number;
|
|
200
256
|
preventUnmountingOnClose: boolean;
|
|
201
257
|
payload: unknown;
|
|
202
258
|
activeTriggerId: string | null;
|
|
@@ -214,6 +270,8 @@ declare const selectors: {
|
|
|
214
270
|
mounted: boolean;
|
|
215
271
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
216
272
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
273
|
+
floatingId: string | undefined;
|
|
274
|
+
triggerCount: number;
|
|
217
275
|
preventUnmountingOnClose: boolean;
|
|
218
276
|
payload: unknown;
|
|
219
277
|
activeTriggerId: string | null;
|
|
@@ -231,6 +289,8 @@ declare const selectors: {
|
|
|
231
289
|
mounted: boolean;
|
|
232
290
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
233
291
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
292
|
+
floatingId: string | undefined;
|
|
293
|
+
triggerCount: number;
|
|
234
294
|
preventUnmountingOnClose: boolean;
|
|
235
295
|
payload: unknown;
|
|
236
296
|
activeTriggerId: string | null;
|
|
@@ -248,6 +308,8 @@ declare const selectors: {
|
|
|
248
308
|
mounted: boolean;
|
|
249
309
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
250
310
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
311
|
+
floatingId: string | undefined;
|
|
312
|
+
triggerCount: number;
|
|
251
313
|
preventUnmountingOnClose: boolean;
|
|
252
314
|
payload: unknown;
|
|
253
315
|
activeTriggerId: string | null;
|
|
@@ -259,12 +321,33 @@ declare const selectors: {
|
|
|
259
321
|
inactiveTriggerProps: HTMLProps;
|
|
260
322
|
popupProps: HTMLProps;
|
|
261
323
|
}, isActive: boolean) => HTMLProps;
|
|
324
|
+
triggerPopupId: (state: {
|
|
325
|
+
open: boolean;
|
|
326
|
+
readonly openProp: boolean | undefined;
|
|
327
|
+
mounted: boolean;
|
|
328
|
+
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
329
|
+
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
330
|
+
floatingId: string | undefined;
|
|
331
|
+
triggerCount: number;
|
|
332
|
+
preventUnmountingOnClose: boolean;
|
|
333
|
+
payload: unknown;
|
|
334
|
+
activeTriggerId: string | null;
|
|
335
|
+
activeTriggerElement: Element | null;
|
|
336
|
+
readonly triggerIdProp: string | null | undefined;
|
|
337
|
+
popupElement: HTMLElement | null;
|
|
338
|
+
positionerElement: HTMLElement | null;
|
|
339
|
+
activeTriggerProps: HTMLProps;
|
|
340
|
+
inactiveTriggerProps: HTMLProps;
|
|
341
|
+
popupProps: HTMLProps;
|
|
342
|
+
}, triggerId: string | undefined) => string | undefined;
|
|
262
343
|
popupProps: (state: {
|
|
263
344
|
open: boolean;
|
|
264
345
|
readonly openProp: boolean | undefined;
|
|
265
346
|
mounted: boolean;
|
|
266
347
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
267
348
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
349
|
+
floatingId: string | undefined;
|
|
350
|
+
triggerCount: number;
|
|
268
351
|
preventUnmountingOnClose: boolean;
|
|
269
352
|
payload: unknown;
|
|
270
353
|
activeTriggerId: string | null;
|
|
@@ -282,6 +365,8 @@ declare const selectors: {
|
|
|
282
365
|
mounted: boolean;
|
|
283
366
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
284
367
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
368
|
+
floatingId: string | undefined;
|
|
369
|
+
triggerCount: number;
|
|
285
370
|
preventUnmountingOnClose: boolean;
|
|
286
371
|
payload: unknown;
|
|
287
372
|
activeTriggerId: string | null;
|
|
@@ -299,6 +384,8 @@ declare const selectors: {
|
|
|
299
384
|
mounted: boolean;
|
|
300
385
|
transitionStatus: import("../../internals/useTransitionStatus.js").TransitionStatus;
|
|
301
386
|
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
|
|
387
|
+
floatingId: string | undefined;
|
|
388
|
+
triggerCount: number;
|
|
302
389
|
preventUnmountingOnClose: boolean;
|
|
303
390
|
payload: unknown;
|
|
304
391
|
activeTriggerId: string | null;
|
|
@@ -6,7 +6,8 @@ import { isElementDisabled } from '@base-ui/utils/isElementDisabled';
|
|
|
6
6
|
import { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';
|
|
7
7
|
import { warn } from '@base-ui/utils/warn';
|
|
8
8
|
import { SafeReact } from '@base-ui/utils/safeReact';
|
|
9
|
-
import {
|
|
9
|
+
import { EMPTY_OBJECT } from '@base-ui/utils/empty';
|
|
10
|
+
import { safePolygon, useClick, useHoverReferenceInteraction } from "../../floating-ui-react/index.js";
|
|
10
11
|
import { useMenuRootContext } from "../root/MenuRootContext.js";
|
|
11
12
|
import { useBaseUiId } from "../../internals/useBaseUiId.js";
|
|
12
13
|
import { triggerOpenStateMapping } from "../../utils/popupStateMapping.js";
|
|
@@ -23,10 +24,11 @@ import { useMenuSubmenuRootContext } from "../submenu-root/MenuSubmenuRootContex
|
|
|
23
24
|
*
|
|
24
25
|
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
25
26
|
*/
|
|
26
|
-
export const MenuSubmenuTrigger = /*#__PURE__*/React.forwardRef(function
|
|
27
|
+
export const MenuSubmenuTrigger = /*#__PURE__*/React.forwardRef(function MenuSubmenuTrigger(componentProps, forwardedRef) {
|
|
27
28
|
const {
|
|
28
29
|
render,
|
|
29
30
|
className,
|
|
31
|
+
style,
|
|
30
32
|
label,
|
|
31
33
|
id: idProp,
|
|
32
34
|
nativeButton = false,
|
|
@@ -34,7 +36,6 @@ export const MenuSubmenuTrigger = /*#__PURE__*/React.forwardRef(function Submenu
|
|
|
34
36
|
delay = 100,
|
|
35
37
|
closeDelay = 0,
|
|
36
38
|
disabled: disabledProp = false,
|
|
37
|
-
style,
|
|
38
39
|
...elementProps
|
|
39
40
|
} = componentProps;
|
|
40
41
|
const listItem = useCompositeListItem();
|
|
@@ -46,6 +47,7 @@ export const MenuSubmenuTrigger = /*#__PURE__*/React.forwardRef(function Submenu
|
|
|
46
47
|
const open = store.useState('open');
|
|
47
48
|
const floatingRootContext = store.useState('floatingRootContext');
|
|
48
49
|
const floatingTreeRoot = store.useState('floatingTreeRoot');
|
|
50
|
+
const popupId = store.useState('triggerPopupId', thisTriggerId);
|
|
49
51
|
const baseRegisterTrigger = useTriggerRegistration(thisTriggerId, store);
|
|
50
52
|
const registerTrigger = React.useCallback(element => {
|
|
51
53
|
const cleanup = baseRegisterTrigger(element);
|
|
@@ -128,7 +130,7 @@ export const MenuSubmenuTrigger = /*#__PURE__*/React.forwardRef(function Submenu
|
|
|
128
130
|
ignoreMouse: openOnHover,
|
|
129
131
|
stickIfOpen: false
|
|
130
132
|
});
|
|
131
|
-
const localInteractionProps =
|
|
133
|
+
const localInteractionProps = click.reference ?? EMPTY_OBJECT;
|
|
132
134
|
const rootTriggerProps = store.useState('triggerProps', true);
|
|
133
135
|
delete rootTriggerProps.id;
|
|
134
136
|
const state = {
|
|
@@ -139,7 +141,8 @@ export const MenuSubmenuTrigger = /*#__PURE__*/React.forwardRef(function Submenu
|
|
|
139
141
|
const element = useRenderElement('div', componentProps, {
|
|
140
142
|
state,
|
|
141
143
|
stateAttributesMapping: triggerOpenStateMapping,
|
|
142
|
-
props: [localInteractionProps
|
|
144
|
+
props: [localInteractionProps, hoverProps, rootTriggerProps, itemProps, {
|
|
145
|
+
'aria-controls': popupId,
|
|
143
146
|
tabIndex: open || highlighted ? 0 : -1,
|
|
144
147
|
onBlur() {
|
|
145
148
|
if (highlighted) {
|
|
@@ -8,7 +8,7 @@ import { fastComponentRef } from '@base-ui/utils/fastHooks';
|
|
|
8
8
|
import { useStableCallback } from '@base-ui/utils/useStableCallback';
|
|
9
9
|
import { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';
|
|
10
10
|
import { EMPTY_OBJECT } from '@base-ui/utils/empty';
|
|
11
|
-
import { safePolygon, useClick, useFloatingTree, useFocus, useHoverReferenceInteraction,
|
|
11
|
+
import { safePolygon, useClick, useFloatingTree, useFocus, useHoverReferenceInteraction, useFloatingNodeId, useFloatingParentNodeId } from "../../floating-ui-react/index.js";
|
|
12
12
|
import { FloatingTreeStore } from "../../floating-ui-react/components/FloatingTreeStore.js";
|
|
13
13
|
import { contains } from "../../floating-ui-react/utils.js";
|
|
14
14
|
import { useMenuRootContext } from "../root/MenuRootContext.js";
|
|
@@ -28,6 +28,7 @@ import { useContextMenuRootContext } from "../../context-menu/root/ContextMenuRo
|
|
|
28
28
|
import { useMenubarContext } from "../../menubar/MenubarContext.js";
|
|
29
29
|
import { PATIENT_CLICK_THRESHOLD } from "../../internals/constants.js";
|
|
30
30
|
import { FocusGuard } from "../../utils/FocusGuard.js";
|
|
31
|
+
import { mergeProps } from "../../merge-props/index.js";
|
|
31
32
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
33
|
const BOUNDARY_OFFSET = 2;
|
|
33
34
|
|
|
@@ -41,6 +42,7 @@ export const MenuTrigger = fastComponentRef(function MenuTrigger(componentProps,
|
|
|
41
42
|
const {
|
|
42
43
|
render,
|
|
43
44
|
className,
|
|
45
|
+
style,
|
|
44
46
|
disabled: disabledProp = false,
|
|
45
47
|
nativeButton = true,
|
|
46
48
|
id: idProp,
|
|
@@ -49,7 +51,6 @@ export const MenuTrigger = fastComponentRef(function MenuTrigger(componentProps,
|
|
|
49
51
|
closeDelay = 0,
|
|
50
52
|
handle,
|
|
51
53
|
payload,
|
|
52
|
-
style,
|
|
53
54
|
...elementProps
|
|
54
55
|
} = componentProps;
|
|
55
56
|
const rootContext = useMenuRootContext(true);
|
|
@@ -61,6 +62,7 @@ export const MenuTrigger = fastComponentRef(function MenuTrigger(componentProps,
|
|
|
61
62
|
const isTriggerActive = store.useState('isTriggerActive', thisTriggerId);
|
|
62
63
|
const floatingRootContext = store.useState('floatingRootContext');
|
|
63
64
|
const isOpenedByThisTrigger = store.useState('isOpenedByTrigger', thisTriggerId);
|
|
65
|
+
const popupId = store.useState('triggerPopupId', thisTriggerId);
|
|
64
66
|
const triggerElementRef = React.useRef(null);
|
|
65
67
|
const parent = useMenuParent();
|
|
66
68
|
const compositeRootContext = useCompositeRootContext(true);
|
|
@@ -167,15 +169,21 @@ export const MenuTrigger = fastComponentRef(function MenuTrigger(componentProps,
|
|
|
167
169
|
enabled: isInMenubar,
|
|
168
170
|
mouseDownAction: 'open'
|
|
169
171
|
});
|
|
170
|
-
const localInteractionProps =
|
|
172
|
+
const localInteractionProps = React.useMemo(() => mergeProps(focus.reference, click.reference), [focus.reference, click.reference]);
|
|
173
|
+
const rootTriggerProps = store.useState('triggerProps', isMountedByThisTrigger);
|
|
174
|
+
const {
|
|
175
|
+
preFocusGuardRef,
|
|
176
|
+
handlePreFocusGuardFocus,
|
|
177
|
+
handleFocusTargetFocus
|
|
178
|
+
} = useTriggerFocusGuards(store, triggerElementRef);
|
|
171
179
|
const state = {
|
|
172
180
|
disabled,
|
|
173
181
|
open: isOpenedByThisTrigger
|
|
174
182
|
};
|
|
175
|
-
const rootTriggerProps = store.useState('triggerProps', isMountedByThisTrigger);
|
|
176
183
|
const ref = [triggerRef, forwardedRef, buttonRef, registerTrigger, triggerElementRef];
|
|
177
|
-
const props = [localInteractionProps
|
|
184
|
+
const props = [localInteractionProps, hoverProps ?? EMPTY_OBJECT, rootTriggerProps, {
|
|
178
185
|
'aria-haspopup': 'menu',
|
|
186
|
+
'aria-controls': popupId,
|
|
179
187
|
id: thisTriggerId,
|
|
180
188
|
onMouseDown: event => {
|
|
181
189
|
if (store.select('open')) {
|
|
@@ -194,11 +202,6 @@ export const MenuTrigger = fastComponentRef(function MenuTrigger(componentProps,
|
|
|
194
202
|
}, isInMenubar ? {
|
|
195
203
|
role: 'menuitem'
|
|
196
204
|
} : {}, mixedToggleHandlers, elementProps, getButtonProps];
|
|
197
|
-
const {
|
|
198
|
-
preFocusGuardRef,
|
|
199
|
-
handlePreFocusGuardFocus,
|
|
200
|
-
handleFocusTargetFocus
|
|
201
|
-
} = useTriggerFocusGuards(store, triggerElementRef);
|
|
202
205
|
const element = useRenderElement('button', componentProps, {
|
|
203
206
|
enabled: !isInMenubar,
|
|
204
207
|
stateAttributesMapping: pressableTriggerOpenStateMapping,
|
|
@@ -2,8 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { BaseUIComponentProps } from "../../internals/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* A viewport for displaying content transitions.
|
|
5
|
-
* This component is only required if one popup can be opened by multiple triggers, its content
|
|
6
|
-
* and switching between them is animated.
|
|
5
|
+
* This component is only required if one popup can be opened by multiple triggers, its content
|
|
6
|
+
* changes based on the trigger, and switching between them is animated.
|
|
7
7
|
* Renders a `<div>` element.
|
|
8
8
|
*
|
|
9
9
|
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
@@ -14,8 +14,8 @@ const stateAttributesMapping = {
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* A viewport for displaying content transitions.
|
|
17
|
-
* This component is only required if one popup can be opened by multiple triggers, its content
|
|
18
|
-
* and switching between them is animated.
|
|
17
|
+
* This component is only required if one popup can be opened by multiple triggers, its content
|
|
18
|
+
* changes based on the trigger, and switching between them is animated.
|
|
19
19
|
* Renders a `<div>` element.
|
|
20
20
|
*
|
|
21
21
|
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
@@ -14,8 +14,8 @@ import { useRenderElement } from "../../internals/useRenderElement.js";
|
|
|
14
14
|
*/
|
|
15
15
|
export const NavigationMenuArrow = /*#__PURE__*/React.forwardRef(function NavigationMenuArrow(componentProps, forwardedRef) {
|
|
16
16
|
const {
|
|
17
|
-
className,
|
|
18
17
|
render,
|
|
18
|
+
className,
|
|
19
19
|
style,
|
|
20
20
|
...elementProps
|
|
21
21
|
} = componentProps;
|
|
@@ -18,8 +18,8 @@ const stateAttributesMapping = {
|
|
|
18
18
|
*/
|
|
19
19
|
export const NavigationMenuBackdrop = /*#__PURE__*/React.forwardRef(function NavigationMenuBackdrop(componentProps, forwardedRef) {
|
|
20
20
|
const {
|
|
21
|
-
className,
|
|
22
21
|
render,
|
|
22
|
+
className,
|
|
23
23
|
style,
|
|
24
24
|
...elementProps
|
|
25
25
|
} = componentProps;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as ReactDOM from 'react-dom';
|
|
5
5
|
import { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';
|
|
6
|
+
import { useStableCallback } from '@base-ui/utils/useStableCallback';
|
|
6
7
|
import { inertValue } from '@base-ui/utils/inertValue';
|
|
7
8
|
import { EMPTY_OBJECT } from '@base-ui/utils/empty';
|
|
8
9
|
import { FloatingNode } from "../../floating-ui-react/index.js";
|
|
@@ -37,10 +38,10 @@ const stateAttributesMapping = {
|
|
|
37
38
|
*/
|
|
38
39
|
export const NavigationMenuContent = /*#__PURE__*/React.forwardRef(function NavigationMenuContent(componentProps, forwardedRef) {
|
|
39
40
|
const {
|
|
40
|
-
className,
|
|
41
41
|
render,
|
|
42
|
-
|
|
42
|
+
className,
|
|
43
43
|
style,
|
|
44
|
+
keepMounted = false,
|
|
44
45
|
...elementProps
|
|
45
46
|
} = componentProps;
|
|
46
47
|
const {
|
|
@@ -94,11 +95,13 @@ export const NavigationMenuContent = /*#__PURE__*/React.forwardRef(function Navi
|
|
|
94
95
|
transitionStatus,
|
|
95
96
|
activationDirection
|
|
96
97
|
};
|
|
97
|
-
const handleCurrentContentRef =
|
|
98
|
-
|
|
98
|
+
const handleCurrentContentRef = useStableCallback(node => {
|
|
99
|
+
// Inactive `keepMounted` content also mounts in the viewport; only the
|
|
100
|
+
// active content can own the shared sizing observer target.
|
|
101
|
+
if (node && open) {
|
|
99
102
|
currentContentRef.current = node;
|
|
100
103
|
}
|
|
101
|
-
}
|
|
104
|
+
});
|
|
102
105
|
const commonProps = {
|
|
103
106
|
onFocus(event) {
|
|
104
107
|
const target = getTarget(event.nativeEvent);
|
|
@@ -13,8 +13,8 @@ import { useNavigationMenuItemContext } from "../item/NavigationMenuItemContext.
|
|
|
13
13
|
*/
|
|
14
14
|
export const NavigationMenuIcon = /*#__PURE__*/React.forwardRef(function NavigationMenuIcon(componentProps, forwardedRef) {
|
|
15
15
|
const {
|
|
16
|
-
className,
|
|
17
16
|
render,
|
|
17
|
+
className,
|
|
18
18
|
style,
|
|
19
19
|
...elementProps
|
|
20
20
|
} = componentProps;
|
|
@@ -14,10 +14,10 @@ import { useBaseUiId } from "../../internals/useBaseUiId.js";
|
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
export const NavigationMenuItem = /*#__PURE__*/React.forwardRef(function NavigationMenuItem(componentProps, forwardedRef) {
|
|
16
16
|
const {
|
|
17
|
-
className,
|
|
18
17
|
render,
|
|
19
|
-
|
|
18
|
+
className,
|
|
20
19
|
style,
|
|
20
|
+
value: valueProp,
|
|
21
21
|
...elementProps
|
|
22
22
|
} = componentProps;
|
|
23
23
|
const fallbackValue = useBaseUiId();
|
|
@@ -20,8 +20,8 @@ import { useRenderElement } from "../../internals/useRenderElement.js";
|
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
21
|
export const NavigationMenuList = /*#__PURE__*/React.forwardRef(function NavigationMenuList(componentProps, forwardedRef) {
|
|
22
22
|
const {
|
|
23
|
-
className,
|
|
24
23
|
render,
|
|
24
|
+
className,
|
|
25
25
|
style,
|
|
26
26
|
...elementProps
|
|
27
27
|
} = componentProps;
|
|
@@ -21,10 +21,10 @@ const stateAttributesMapping = {
|
|
|
21
21
|
*/
|
|
22
22
|
export const NavigationMenuPopup = /*#__PURE__*/React.forwardRef(function NavigationMenuPopup(componentProps, forwardedRef) {
|
|
23
23
|
const {
|
|
24
|
-
className,
|
|
25
24
|
render,
|
|
26
|
-
|
|
25
|
+
className,
|
|
27
26
|
style,
|
|
27
|
+
id: idProp,
|
|
28
28
|
...elementProps
|
|
29
29
|
} = componentProps;
|
|
30
30
|
const {
|
|
@@ -11,7 +11,7 @@ import { useTimeout } from '@base-ui/utils/useTimeout';
|
|
|
11
11
|
import { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';
|
|
12
12
|
import { useValueAsRef } from '@base-ui/utils/useValueAsRef';
|
|
13
13
|
import { EMPTY_ARRAY } from '@base-ui/utils/empty';
|
|
14
|
-
import { safePolygon, useClick, useFloatingRootContext, useFloatingTree, useHoverReferenceInteraction
|
|
14
|
+
import { safePolygon, useClick, useFloatingRootContext, useFloatingTree, useHoverReferenceInteraction } from "../../floating-ui-react/index.js";
|
|
15
15
|
import { applySafePolygonPointerEventsMutation, clearSafePolygonPointerEventsMutation, useHoverInteractionSharedState } from "../../floating-ui-react/hooks/useHoverInteractionSharedState.js";
|
|
16
16
|
import { contains, getTabbableAfterElement, getNextTabbable, getPreviousTabbable, isOutsideEvent, stopEvent } from "../../floating-ui-react/utils.js";
|
|
17
17
|
import { useNavigationMenuItemContext } from "../item/NavigationMenuItemContext.js";
|
|
@@ -31,6 +31,8 @@ import { NAVIGATION_MENU_TRIGGER_IDENTIFIER } from "../utils/constants.js";
|
|
|
31
31
|
import { useNavigationMenuDismissContext } from "../list/NavigationMenuDismissContext.js";
|
|
32
32
|
import { NavigationMenuPopupCssVars } from "../popup/NavigationMenuPopupCssVars.js";
|
|
33
33
|
import { NavigationMenuPositionerCssVars } from "../positioner/NavigationMenuPositionerCssVars.js";
|
|
34
|
+
import { mergeProps } from "../../merge-props/index.js";
|
|
35
|
+
import { useDirection } from "../../internals/direction-context/DirectionContext.js";
|
|
34
36
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
35
37
|
const DEFAULT_SIZE = {
|
|
36
38
|
width: 0,
|
|
@@ -46,11 +48,11 @@ const DEFAULT_SIZE = {
|
|
|
46
48
|
*/
|
|
47
49
|
export const NavigationMenuTrigger = /*#__PURE__*/React.forwardRef(function NavigationMenuTrigger(componentProps, forwardedRef) {
|
|
48
50
|
const {
|
|
49
|
-
className,
|
|
50
51
|
render,
|
|
52
|
+
className,
|
|
53
|
+
style,
|
|
51
54
|
nativeButton = true,
|
|
52
55
|
disabled,
|
|
53
|
-
style,
|
|
54
56
|
...elementProps
|
|
55
57
|
} = componentProps;
|
|
56
58
|
const {
|
|
@@ -84,6 +86,7 @@ export const NavigationMenuTrigger = /*#__PURE__*/React.forwardRef(function Navi
|
|
|
84
86
|
const nodeId = useNavigationMenuTreeContext();
|
|
85
87
|
const tree = useFloatingTree();
|
|
86
88
|
const dismissProps = useNavigationMenuDismissContext();
|
|
89
|
+
const direction = useDirection();
|
|
87
90
|
const stickIfOpenTimeout = useTimeout();
|
|
88
91
|
const focusFrame = useAnimationFrame();
|
|
89
92
|
const mutationFrame = useAnimationFrame();
|
|
@@ -343,7 +346,11 @@ export const NavigationMenuTrigger = /*#__PURE__*/React.forwardRef(function Navi
|
|
|
343
346
|
mutationObserver.observe(observedElement, {
|
|
344
347
|
childList: true,
|
|
345
348
|
subtree: true,
|
|
346
|
-
characterData: true
|
|
349
|
+
characterData: true,
|
|
350
|
+
// `keepMounted` submenu switches update dimensions by toggling hidden
|
|
351
|
+
// content rather than inserting or removing content nodes.
|
|
352
|
+
attributes: true,
|
|
353
|
+
attributeFilter: ['hidden']
|
|
347
354
|
});
|
|
348
355
|
return () => {
|
|
349
356
|
mutationObserver.disconnect();
|
|
@@ -362,14 +369,15 @@ export const NavigationMenuTrigger = /*#__PURE__*/React.forwardRef(function Navi
|
|
|
362
369
|
}, [beforeOutsideRef, focusFrame, isActiveItem, open, popupElement]);
|
|
363
370
|
useIsoLayoutEffect(() => {
|
|
364
371
|
if (isActiveItemRef.current && open && popupElement) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
372
|
+
const hasNestedMenu = currentContentRef.current?.querySelector('[data-nested]') != null;
|
|
373
|
+
if (transitionStatus === 'starting' && hasNestedMenu) {
|
|
374
|
+
// Inline nested menus can reveal their default content after the
|
|
375
|
+
// top-level content enters the viewport. Defer once so the opening
|
|
376
|
+
// size is measured from the final nested content, not the shell.
|
|
377
|
+
sizeFrame.request(syncCurrentSize);
|
|
378
|
+
return () => {
|
|
379
|
+
sizeFrame.cancel();
|
|
380
|
+
};
|
|
373
381
|
}
|
|
374
382
|
if (skipAutoSizeSyncRef.current) {
|
|
375
383
|
skipAutoSizeSyncRef.current = false;
|
|
@@ -472,9 +480,7 @@ export const NavigationMenuTrigger = /*#__PURE__*/React.forwardRef(function Navi
|
|
|
472
480
|
stickIfOpen,
|
|
473
481
|
toggle: isActiveItem
|
|
474
482
|
});
|
|
475
|
-
const
|
|
476
|
-
getReferenceProps
|
|
477
|
-
} = useInteractions([hover, click]);
|
|
483
|
+
const referenceProps = React.useMemo(() => mergeProps(click.reference, hover?.reference), [click.reference, hover]);
|
|
478
484
|
useIsoLayoutEffect(() => {
|
|
479
485
|
if (isActiveItem) {
|
|
480
486
|
setFloatingRootContext(context);
|
|
@@ -578,8 +584,9 @@ export const NavigationMenuTrigger = /*#__PURE__*/React.forwardRef(function Navi
|
|
|
578
584
|
if (nested) {
|
|
579
585
|
return;
|
|
580
586
|
}
|
|
587
|
+
const verticalOpenKey = direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
581
588
|
const openHorizontal = orientation === 'horizontal' && event.key === 'ArrowDown';
|
|
582
|
-
const openVertical = orientation === 'vertical' && event.key ===
|
|
589
|
+
const openVertical = orientation === 'vertical' && event.key === verticalOpenKey;
|
|
583
590
|
if (openHorizontal || openVertical) {
|
|
584
591
|
setValue(itemValue, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent));
|
|
585
592
|
handleOpenEvent(event);
|
|
@@ -618,7 +625,7 @@ export const NavigationMenuTrigger = /*#__PURE__*/React.forwardRef(function Navi
|
|
|
618
625
|
state: state,
|
|
619
626
|
stateAttributesMapping: pressableTriggerOpenStateMapping,
|
|
620
627
|
refs: [forwardedRef, handleTriggerElement, buttonRef],
|
|
621
|
-
props: [
|
|
628
|
+
props: [referenceProps, dismissProps?.reference || EMPTY_ARRAY, defaultProps, elementProps, getButtonProps]
|
|
622
629
|
}), isActiveItem && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
623
630
|
children: [/*#__PURE__*/_jsx(FocusGuard, {
|
|
624
631
|
ref: beforeOutsideRef,
|
|
@@ -5,7 +5,6 @@ export function isOutsideMenuEvent({
|
|
|
5
5
|
}, params) {
|
|
6
6
|
const {
|
|
7
7
|
popupElement,
|
|
8
|
-
viewportElement,
|
|
9
8
|
rootRef,
|
|
10
9
|
tree,
|
|
11
10
|
nodeId
|
|
@@ -17,8 +16,5 @@ export function isOutsideMenuEvent({
|
|
|
17
16
|
if (!popupElement) {
|
|
18
17
|
return !contains(rootRef.current, relatedTarget) && !nodeChildrenContains;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
// Use popupElement as the primary floating element, but fall back to viewportElement if needed
|
|
22
|
-
const floatingElement = popupElement || viewportElement;
|
|
23
|
-
return !contains(floatingElement, currentTarget) && !contains(floatingElement, relatedTarget) && !contains(rootRef.current, relatedTarget) && !nodeChildrenContains && !(contains(floatingElement, relatedTarget) && relatedTarget?.hasAttribute('data-base-ui-focus-guard'));
|
|
19
|
+
return !contains(popupElement, currentTarget) && !contains(popupElement, relatedTarget) && !contains(rootRef.current, relatedTarget) && !nodeChildrenContains && !(contains(popupElement, relatedTarget) && relatedTarget?.hasAttribute('data-base-ui-focus-guard'));
|
|
24
20
|
}
|
|
@@ -58,14 +58,13 @@ function Guards({
|
|
|
58
58
|
*
|
|
59
59
|
* Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)
|
|
60
60
|
*/
|
|
61
|
-
|
|
62
61
|
export const NavigationMenuViewport = /*#__PURE__*/React.forwardRef(function NavigationMenuViewport(componentProps, forwardedRef) {
|
|
63
62
|
const {
|
|
64
|
-
className,
|
|
65
63
|
render,
|
|
64
|
+
className,
|
|
65
|
+
style,
|
|
66
66
|
children,
|
|
67
67
|
id: idProp,
|
|
68
|
-
style,
|
|
69
68
|
...elementProps
|
|
70
69
|
} = componentProps;
|
|
71
70
|
const id = useId(idProp);
|