@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
|
@@ -10,7 +10,7 @@ import { REASONS } from "../../internals/reasons.js";
|
|
|
10
10
|
* Documentation: [Base UI Collapsible](https://base-ui.com/react/components/collapsible)
|
|
11
11
|
*/
|
|
12
12
|
export declare const CollapsibleRoot: React.ForwardRefExoticComponent<Omit<CollapsibleRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
-
export interface CollapsibleRootState extends Pick<UseCollapsibleRootReturnValue, 'open' | 'disabled'> {}
|
|
13
|
+
export interface CollapsibleRootState extends Pick<UseCollapsibleRootReturnValue, 'open' | 'disabled' | 'transitionStatus'> {}
|
|
14
14
|
export interface CollapsibleRootProps extends BaseUIComponentProps<'div', CollapsibleRootState> {
|
|
15
15
|
/**
|
|
16
16
|
* Whether the collapsible panel is currently open.
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { UseCollapsibleRootReturnValue } from "./useCollapsibleRoot.js";
|
|
3
3
|
import type { CollapsibleRoot, CollapsibleRootState } from "./CollapsibleRoot.js";
|
|
4
|
-
import type { TransitionStatus } from "../../internals/useTransitionStatus.js";
|
|
5
4
|
export interface CollapsibleRootContext extends UseCollapsibleRootReturnValue {
|
|
6
5
|
onOpenChange: (open: boolean, eventDetails: CollapsibleRoot.ChangeEventDetails) => void;
|
|
7
6
|
state: CollapsibleRootState;
|
|
8
|
-
transitionStatus: TransitionStatus;
|
|
9
7
|
}
|
|
10
8
|
export declare const CollapsibleRootContext: React.Context<CollapsibleRootContext | undefined>;
|
|
11
9
|
export declare function useCollapsibleRootContext(): CollapsibleRootContext;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TransitionStatus } from "../../internals/useTransitionStatus.js";
|
|
3
3
|
import type { CollapsibleRoot } from "./CollapsibleRoot.js";
|
|
4
|
-
export type AnimationType = 'css-transition' | 'css-animation' | 'none' | null;
|
|
5
|
-
export interface Dimensions {
|
|
6
|
-
height: number | undefined;
|
|
7
|
-
width: number | undefined;
|
|
8
|
-
}
|
|
9
4
|
export declare function useCollapsibleRoot(parameters: UseCollapsibleRootParameters): UseCollapsibleRootReturnValue;
|
|
10
5
|
export interface UseCollapsibleRootParameters {
|
|
11
6
|
/**
|
|
@@ -32,17 +27,11 @@ export interface UseCollapsibleRootParameters {
|
|
|
32
27
|
disabled: boolean;
|
|
33
28
|
}
|
|
34
29
|
export interface UseCollapsibleRootReturnValue {
|
|
35
|
-
abortControllerRef: React.RefObject<AbortController | null>;
|
|
36
|
-
animationTypeRef: React.RefObject<AnimationType>;
|
|
37
30
|
/**
|
|
38
31
|
* Whether the component should ignore user interaction.
|
|
39
32
|
*/
|
|
40
33
|
disabled: boolean;
|
|
41
34
|
handleTrigger: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
42
|
-
/**
|
|
43
|
-
* The height of the panel.
|
|
44
|
-
*/
|
|
45
|
-
height: number | undefined;
|
|
46
35
|
/**
|
|
47
36
|
* Whether the collapsible panel is mounted for transition and hidden-state
|
|
48
37
|
* purposes. This can be `false` while the element remains in the DOM when
|
|
@@ -54,25 +43,9 @@ export interface UseCollapsibleRootReturnValue {
|
|
|
54
43
|
*/
|
|
55
44
|
open: boolean;
|
|
56
45
|
panelId: React.HTMLAttributes<Element>['id'];
|
|
57
|
-
panelRef: React.RefObject<HTMLElement | null>;
|
|
58
|
-
runOnceAnimationsFinish: (fnToExecute: () => void, signal?: AbortSignal | null) => void;
|
|
59
|
-
setDimensions: React.Dispatch<React.SetStateAction<Dimensions>>;
|
|
60
|
-
setHiddenUntilFound: React.Dispatch<React.SetStateAction<boolean>>;
|
|
61
|
-
setKeepMounted: React.Dispatch<React.SetStateAction<boolean>>;
|
|
62
46
|
setMounted: (nextMounted: boolean) => void;
|
|
63
47
|
setOpen: (open: boolean) => void;
|
|
64
48
|
setPanelIdState: (id: string | undefined) => void;
|
|
65
|
-
setVisible: React.Dispatch<React.SetStateAction<boolean>>;
|
|
66
|
-
transitionDimensionRef: React.RefObject<'height' | 'width' | null>;
|
|
67
49
|
transitionStatus: TransitionStatus;
|
|
68
|
-
/**
|
|
69
|
-
* The visible state of the panel used to determine the `[hidden]` attribute
|
|
70
|
-
* only when CSS keyframe animations are used.
|
|
71
|
-
*/
|
|
72
|
-
visible: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* The width of the panel.
|
|
75
|
-
*/
|
|
76
|
-
width: number | undefined;
|
|
77
50
|
}
|
|
78
51
|
export interface UseCollapsibleRootState {}
|
|
@@ -8,12 +8,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.useCollapsibleRoot = useCollapsibleRoot;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _useControlled = require("@base-ui/utils/useControlled");
|
|
11
|
-
var _useIsoLayoutEffect = require("@base-ui/utils/useIsoLayoutEffect");
|
|
12
11
|
var _useStableCallback = require("@base-ui/utils/useStableCallback");
|
|
13
12
|
var _useBaseUiId = require("../../internals/useBaseUiId");
|
|
14
13
|
var _createBaseUIEventDetails = require("../../internals/createBaseUIEventDetails");
|
|
15
14
|
var _reasons = require("../../internals/reasons");
|
|
16
|
-
var _useAnimationsFinished = require("../../internals/useAnimationsFinished");
|
|
17
15
|
var _useTransitionStatus = require("../../internals/useTransitionStatus");
|
|
18
16
|
function useCollapsibleRoot(parameters) {
|
|
19
17
|
const {
|
|
@@ -22,7 +20,6 @@ function useCollapsibleRoot(parameters) {
|
|
|
22
20
|
onOpenChange,
|
|
23
21
|
disabled
|
|
24
22
|
} = parameters;
|
|
25
|
-
const isControlled = openParam !== undefined;
|
|
26
23
|
const [open, setOpen] = (0, _useControlled.useControlled)({
|
|
27
24
|
controlled: openParam,
|
|
28
25
|
default: defaultOpen,
|
|
@@ -34,24 +31,9 @@ function useCollapsibleRoot(parameters) {
|
|
|
34
31
|
setMounted,
|
|
35
32
|
transitionStatus
|
|
36
33
|
} = (0, _useTransitionStatus.useTransitionStatus)(open, true, true);
|
|
37
|
-
const [visible, setVisible] = React.useState(open);
|
|
38
|
-
const [{
|
|
39
|
-
height,
|
|
40
|
-
width
|
|
41
|
-
}, setDimensions] = React.useState({
|
|
42
|
-
height: undefined,
|
|
43
|
-
width: undefined
|
|
44
|
-
});
|
|
45
34
|
const defaultPanelId = (0, _useBaseUiId.useBaseUiId)();
|
|
46
35
|
const [panelIdState, setPanelIdState] = React.useState();
|
|
47
36
|
const panelId = panelIdState ?? defaultPanelId;
|
|
48
|
-
const [hiddenUntilFound, setHiddenUntilFound] = React.useState(false);
|
|
49
|
-
const [keepMounted, setKeepMounted] = React.useState(false);
|
|
50
|
-
const abortControllerRef = React.useRef(null);
|
|
51
|
-
const animationTypeRef = React.useRef(null);
|
|
52
|
-
const transitionDimensionRef = React.useRef(null);
|
|
53
|
-
const panelRef = React.useRef(null);
|
|
54
|
-
const runOnceAnimationsFinish = (0, _useAnimationsFinished.useAnimationsFinished)(panelRef, false);
|
|
55
37
|
const handleTrigger = (0, _useStableCallback.useStableCallback)(event => {
|
|
56
38
|
const nextOpen = !open;
|
|
57
39
|
const eventDetails = (0, _createBaseUIEventDetails.createChangeEventDetails)(_reasons.REASONS.triggerPress, event.nativeEvent);
|
|
@@ -59,61 +41,17 @@ function useCollapsibleRoot(parameters) {
|
|
|
59
41
|
if (eventDetails.isCanceled) {
|
|
60
42
|
return;
|
|
61
43
|
}
|
|
62
|
-
const panel = panelRef.current;
|
|
63
|
-
if (animationTypeRef.current === 'css-animation' && panel != null) {
|
|
64
|
-
panel.style.removeProperty('animation-name');
|
|
65
|
-
}
|
|
66
|
-
if (!hiddenUntilFound && !keepMounted) {
|
|
67
|
-
if (animationTypeRef.current != null && animationTypeRef.current !== 'css-animation') {
|
|
68
|
-
if (!mounted && nextOpen) {
|
|
69
|
-
setMounted(true);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (animationTypeRef.current === 'css-animation') {
|
|
73
|
-
if (!visible && nextOpen) {
|
|
74
|
-
setVisible(true);
|
|
75
|
-
}
|
|
76
|
-
if (!mounted && nextOpen) {
|
|
77
|
-
setMounted(true);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
44
|
setOpen(nextOpen);
|
|
82
|
-
if (animationTypeRef.current === 'none' && mounted && !nextOpen) {
|
|
83
|
-
setMounted(false);
|
|
84
|
-
}
|
|
85
45
|
});
|
|
86
|
-
(0, _useIsoLayoutEffect.useIsoLayoutEffect)(() => {
|
|
87
|
-
/**
|
|
88
|
-
* Close immediately in controlled mode when no CSS animations or
|
|
89
|
-
* transitions are applied. `keepMounted` only keeps the element in the
|
|
90
|
-
* DOM; `mounted` must still become `false` so the panel regains `hidden`.
|
|
91
|
-
*/
|
|
92
|
-
if (isControlled && animationTypeRef.current === 'none' && !open) {
|
|
93
|
-
setMounted(false);
|
|
94
|
-
}
|
|
95
|
-
}, [isControlled, open, openParam, setMounted]);
|
|
96
46
|
return React.useMemo(() => ({
|
|
97
|
-
abortControllerRef,
|
|
98
|
-
animationTypeRef,
|
|
99
47
|
disabled,
|
|
100
48
|
handleTrigger,
|
|
101
|
-
height,
|
|
102
49
|
mounted,
|
|
103
50
|
open,
|
|
104
51
|
panelId,
|
|
105
|
-
panelRef,
|
|
106
|
-
runOnceAnimationsFinish,
|
|
107
|
-
setDimensions,
|
|
108
|
-
setHiddenUntilFound,
|
|
109
|
-
setKeepMounted,
|
|
110
52
|
setMounted,
|
|
111
53
|
setOpen,
|
|
112
54
|
setPanelIdState,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
transitionStatus,
|
|
116
|
-
visible,
|
|
117
|
-
width
|
|
118
|
-
}), [abortControllerRef, animationTypeRef, disabled, handleTrigger, height, mounted, open, panelId, panelRef, runOnceAnimationsFinish, setDimensions, setHiddenUntilFound, setKeepMounted, setMounted, setOpen, setVisible, transitionDimensionRef, transitionStatus, visible, width]);
|
|
55
|
+
transitionStatus
|
|
56
|
+
}), [disabled, handleTrigger, mounted, open, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]);
|
|
119
57
|
}
|
|
@@ -48,15 +48,14 @@ const CollapsibleTrigger = exports.CollapsibleTrigger = /*#__PURE__*/React.forwa
|
|
|
48
48
|
focusableWhenDisabled: true,
|
|
49
49
|
native: nativeButton
|
|
50
50
|
});
|
|
51
|
-
const props = React.useMemo(() => ({
|
|
52
|
-
'aria-controls': open ? panelId : undefined,
|
|
53
|
-
'aria-expanded': open,
|
|
54
|
-
onClick: handleTrigger
|
|
55
|
-
}), [panelId, open, handleTrigger]);
|
|
56
51
|
const element = (0, _useRenderElement.useRenderElement)('button', componentProps, {
|
|
57
52
|
state,
|
|
58
53
|
ref: [forwardedRef, buttonRef],
|
|
59
|
-
props: [
|
|
54
|
+
props: [{
|
|
55
|
+
'aria-controls': open ? panelId : undefined,
|
|
56
|
+
'aria-expanded': open,
|
|
57
|
+
onClick: handleTrigger
|
|
58
|
+
}, elementProps, getButtonProps],
|
|
60
59
|
stateAttributesMapping
|
|
61
60
|
});
|
|
62
61
|
return element;
|
|
@@ -21,8 +21,8 @@ var _popupStateMapping = require("../../utils/popupStateMapping");
|
|
|
21
21
|
*/
|
|
22
22
|
const ComboboxArrow = exports.ComboboxArrow = /*#__PURE__*/React.forwardRef(function ComboboxArrow(componentProps, forwardedRef) {
|
|
23
23
|
const {
|
|
24
|
-
className,
|
|
25
24
|
render,
|
|
25
|
+
className,
|
|
26
26
|
style,
|
|
27
27
|
...elementProps
|
|
28
28
|
} = componentProps;
|
|
@@ -26,8 +26,8 @@ const stateAttributesMapping = {
|
|
|
26
26
|
*/
|
|
27
27
|
const ComboboxBackdrop = exports.ComboboxBackdrop = /*#__PURE__*/React.forwardRef(function ComboboxBackdrop(componentProps, forwardedRef) {
|
|
28
28
|
const {
|
|
29
|
-
className,
|
|
30
29
|
render,
|
|
30
|
+
className,
|
|
31
31
|
style,
|
|
32
32
|
...elementProps
|
|
33
33
|
} = componentProps;
|
|
@@ -18,6 +18,7 @@ var _utils = require("../../floating-ui-react/utils");
|
|
|
18
18
|
var _store2 = require("../store");
|
|
19
19
|
var _createBaseUIEventDetails = require("../../internals/createBaseUIEventDetails");
|
|
20
20
|
var _reasons = require("../../internals/reasons");
|
|
21
|
+
var _DirectionContext = require("../../internals/direction-context/DirectionContext");
|
|
21
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
23
|
/**
|
|
23
24
|
* An individual chip that represents a value in a multiselectable input.
|
|
@@ -37,6 +38,7 @@ const ComboboxChip = exports.ComboboxChip = /*#__PURE__*/React.forwardRef(functi
|
|
|
37
38
|
setHighlightedChipIndex,
|
|
38
39
|
chipsRef
|
|
39
40
|
} = (0, _ComboboxChipsContext.useComboboxChipsContext)();
|
|
41
|
+
const direction = (0, _DirectionContext.useDirection)();
|
|
40
42
|
const disabled = (0, _store.useStore)(store, _store2.selectors.disabled);
|
|
41
43
|
const readOnly = (0, _store.useStore)(store, _store2.selectors.readOnly);
|
|
42
44
|
const selectedValue = (0, _store.useStore)(store, _store2.selectors.selectedValue);
|
|
@@ -46,14 +48,17 @@ const ComboboxChip = exports.ComboboxChip = /*#__PURE__*/React.forwardRef(functi
|
|
|
46
48
|
} = (0, _useCompositeListItem.useCompositeListItem)();
|
|
47
49
|
function handleKeyDown(event) {
|
|
48
50
|
let nextIndex = index;
|
|
49
|
-
|
|
51
|
+
const isRtl = direction === 'rtl';
|
|
52
|
+
const previousChipKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
|
|
53
|
+
const nextChipKey = isRtl ? 'ArrowLeft' : 'ArrowRight';
|
|
54
|
+
if (event.key === previousChipKey) {
|
|
50
55
|
event.preventDefault();
|
|
51
56
|
if (index > 0) {
|
|
52
57
|
nextIndex = index - 1;
|
|
53
58
|
} else {
|
|
54
59
|
nextIndex = undefined;
|
|
55
60
|
}
|
|
56
|
-
} else if (event.key ===
|
|
61
|
+
} else if (event.key === nextChipKey) {
|
|
57
62
|
event.preventDefault();
|
|
58
63
|
if (index < chipsRef.current.length - 1) {
|
|
59
64
|
nextIndex = index + 1;
|
|
@@ -17,6 +17,10 @@ export interface ComboboxClearState {
|
|
|
17
17
|
* Whether the component should ignore user interaction.
|
|
18
18
|
*/
|
|
19
19
|
disabled: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the clear button should be visible.
|
|
22
|
+
*/
|
|
23
|
+
visible: boolean;
|
|
20
24
|
/**
|
|
21
25
|
* The transition status of the component.
|
|
22
26
|
*/
|
|
@@ -7,6 +7,10 @@ export declare enum ComboboxClearDataAttributes {
|
|
|
7
7
|
* Present when the button is disabled.
|
|
8
8
|
*/
|
|
9
9
|
disabled = "data-disabled",
|
|
10
|
+
/**
|
|
11
|
+
* Present when the clear button is visible.
|
|
12
|
+
*/
|
|
13
|
+
visible = "data-visible",
|
|
10
14
|
/**
|
|
11
15
|
* Present when the button is animating in.
|
|
12
16
|
*/
|
|
@@ -14,6 +14,10 @@ let ComboboxClearDataAttributes = exports.ComboboxClearDataAttributes = function
|
|
|
14
14
|
* Present when the button is disabled.
|
|
15
15
|
*/
|
|
16
16
|
ComboboxClearDataAttributes["disabled"] = "data-disabled";
|
|
17
|
+
/**
|
|
18
|
+
* Present when the clear button is visible.
|
|
19
|
+
*/
|
|
20
|
+
ComboboxClearDataAttributes["visible"] = "data-visible";
|
|
17
21
|
/**
|
|
18
22
|
* Present when the button is animating in.
|
|
19
23
|
*/
|
|
@@ -16,8 +16,8 @@ var _useRenderElement = require("../../internals/useRenderElement");
|
|
|
16
16
|
*/
|
|
17
17
|
const ComboboxIcon = exports.ComboboxIcon = /*#__PURE__*/React.forwardRef(function ComboboxIcon(componentProps, forwardedRef) {
|
|
18
18
|
const {
|
|
19
|
-
className,
|
|
20
19
|
render,
|
|
20
|
+
className,
|
|
21
21
|
style,
|
|
22
22
|
...elementProps
|
|
23
23
|
} = componentProps;
|
|
@@ -94,6 +94,7 @@ const ComboboxInput = exports.ComboboxInput = /*#__PURE__*/React.forwardRef(func
|
|
|
94
94
|
const isComposingRef = React.useRef(false);
|
|
95
95
|
const lastActiveIndexRef = React.useRef(null);
|
|
96
96
|
const shouldRestoreActiveIndexRef = React.useRef(false);
|
|
97
|
+
const inputOwnsFormValue = selectionMode === 'none' && !hasPositionerParent;
|
|
97
98
|
const setInputElement = (0, _useStableCallback.useStableCallback)(element => {
|
|
98
99
|
const nextIsInsidePopup = hasPositionerParent || store.state.inline;
|
|
99
100
|
if (nextIsInsidePopup && !store.state.hasInputValue) {
|
|
@@ -101,7 +102,8 @@ const ComboboxInput = exports.ComboboxInput = /*#__PURE__*/React.forwardRef(func
|
|
|
101
102
|
}
|
|
102
103
|
store.update({
|
|
103
104
|
inputElement: element,
|
|
104
|
-
inputInsidePopup: nextIsInsidePopup
|
|
105
|
+
inputInsidePopup: nextIsInsidePopup,
|
|
106
|
+
inputOwnsFormValue
|
|
105
107
|
});
|
|
106
108
|
});
|
|
107
109
|
const validationProps = hasPositionerParent || !validation ? elementProps : validation.getValidationProps(elementProps);
|
|
@@ -122,15 +124,18 @@ const ComboboxInput = exports.ComboboxInput = /*#__PURE__*/React.forwardRef(func
|
|
|
122
124
|
highlightedChipIndex
|
|
123
125
|
} = comboboxChipsContext;
|
|
124
126
|
const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
|
|
127
|
+
const isRtl = direction === 'rtl';
|
|
128
|
+
const previousChipKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
|
|
129
|
+
const nextChipKey = isRtl ? 'ArrowLeft' : 'ArrowRight';
|
|
125
130
|
if (highlightedChipIndex !== undefined) {
|
|
126
|
-
if (event.key ===
|
|
131
|
+
if (event.key === previousChipKey) {
|
|
127
132
|
event.preventDefault();
|
|
128
133
|
if (highlightedChipIndex > 0) {
|
|
129
134
|
nextIndex = highlightedChipIndex - 1;
|
|
130
135
|
} else {
|
|
131
136
|
nextIndex = undefined;
|
|
132
137
|
}
|
|
133
|
-
} else if (event.key ===
|
|
138
|
+
} else if (event.key === nextChipKey) {
|
|
134
139
|
event.preventDefault();
|
|
135
140
|
if (highlightedChipIndex < renderedChipsCount - 1) {
|
|
136
141
|
nextIndex = highlightedChipIndex + 1;
|
|
@@ -153,7 +158,7 @@ const ComboboxInput = exports.ComboboxInput = /*#__PURE__*/React.forwardRef(func
|
|
|
153
158
|
}
|
|
154
159
|
|
|
155
160
|
// Handle navigation when no chip is highlighted
|
|
156
|
-
if (event.key ===
|
|
161
|
+
if (event.key === previousChipKey && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) {
|
|
157
162
|
event.preventDefault();
|
|
158
163
|
nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : undefined;
|
|
159
164
|
} else if (event.key === 'Backspace' && event.currentTarget.value === '' && selectedValue.length > 0) {
|
|
@@ -179,7 +184,7 @@ const ComboboxInput = exports.ComboboxInput = /*#__PURE__*/React.forwardRef(func
|
|
|
179
184
|
readOnly,
|
|
180
185
|
required: selectionMode === 'none' ? required : undefined,
|
|
181
186
|
form,
|
|
182
|
-
...(
|
|
187
|
+
...(inputOwnsFormValue && name && {
|
|
183
188
|
name
|
|
184
189
|
}),
|
|
185
190
|
id,
|
|
@@ -401,10 +406,14 @@ const ComboboxInput = exports.ComboboxInput = /*#__PURE__*/React.forwardRef(func
|
|
|
401
406
|
}, validationProps],
|
|
402
407
|
stateAttributesMapping: _stateAttributesMapping.triggerStateAttributesMapping
|
|
403
408
|
});
|
|
409
|
+
const renderedInput = hasPositionerParent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FieldRootContext.FieldRootContext.Provider, {
|
|
410
|
+
value: _FieldRootContext.DEFAULT_FIELD_ROOT_CONTEXT,
|
|
411
|
+
children: element
|
|
412
|
+
}) : element;
|
|
404
413
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
405
414
|
children: [open && focusManagerModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ComboboxInternalDismissButton.ComboboxInternalDismissButton, {
|
|
406
415
|
ref: store.state.startDismissRef
|
|
407
|
-
}),
|
|
416
|
+
}), renderedInput]
|
|
408
417
|
});
|
|
409
418
|
});
|
|
410
419
|
if (process.env.NODE_ENV !== "production") ComboboxInput.displayName = "ComboboxInput";
|
|
@@ -29,11 +29,11 @@ const ComboboxItem = exports.ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*
|
|
|
29
29
|
const {
|
|
30
30
|
render,
|
|
31
31
|
className,
|
|
32
|
+
style,
|
|
32
33
|
value: itemValue = null,
|
|
33
34
|
index: indexProp,
|
|
34
35
|
disabled = false,
|
|
35
36
|
nativeButton = false,
|
|
36
|
-
style,
|
|
37
37
|
...elementProps
|
|
38
38
|
} = componentProps;
|
|
39
39
|
const didPointerDownRef = React.useRef(false);
|
|
@@ -60,7 +60,7 @@ const ComboboxItem = exports.ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*
|
|
|
60
60
|
const rootId = (0, _store.useStore)(store, _store2.selectors.id);
|
|
61
61
|
const highlighted = (0, _store.useStore)(store, _store2.selectors.isActive, index);
|
|
62
62
|
const matchesSelectedValue = (0, _store.useStore)(store, _store2.selectors.isSelected, itemValue);
|
|
63
|
-
const
|
|
63
|
+
const itemProps = (0, _store.useStore)(store, _store2.selectors.itemProps);
|
|
64
64
|
const itemRef = React.useRef(null);
|
|
65
65
|
const id = rootId != null && hasRegistered ? `${rootId}-${index}` : undefined;
|
|
66
66
|
const selected = matchesSelectedValue && selectable;
|
|
@@ -106,17 +106,6 @@ const ComboboxItem = exports.ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*
|
|
|
106
106
|
store.set('selectedIndex', index);
|
|
107
107
|
}
|
|
108
108
|
}, [hasRegistered, hasItems, open, store, index, itemValue, isItemEqualToValue]);
|
|
109
|
-
const state = {
|
|
110
|
-
disabled,
|
|
111
|
-
selected,
|
|
112
|
-
highlighted
|
|
113
|
-
};
|
|
114
|
-
const rootProps = getItemProps({
|
|
115
|
-
active: highlighted,
|
|
116
|
-
selected
|
|
117
|
-
});
|
|
118
|
-
rootProps.id = undefined;
|
|
119
|
-
rootProps.onFocus = undefined;
|
|
120
109
|
const {
|
|
121
110
|
getButtonProps,
|
|
122
111
|
buttonRef
|
|
@@ -126,6 +115,11 @@ const ComboboxItem = exports.ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*
|
|
|
126
115
|
native: nativeButton,
|
|
127
116
|
composite: true
|
|
128
117
|
});
|
|
118
|
+
const state = {
|
|
119
|
+
disabled,
|
|
120
|
+
selected,
|
|
121
|
+
highlighted
|
|
122
|
+
};
|
|
129
123
|
function commitSelection(nativeEvent) {
|
|
130
124
|
function selectItem() {
|
|
131
125
|
store.state.handleSelection(nativeEvent, itemValue);
|
|
@@ -172,7 +166,7 @@ const ComboboxItem = exports.ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*
|
|
|
172
166
|
const element = (0, _useRenderElement.useRenderElement)('div', componentProps, {
|
|
173
167
|
ref: [buttonRef, forwardedRef, listItem.ref, itemRef],
|
|
174
168
|
state,
|
|
175
|
-
props: [
|
|
169
|
+
props: [itemProps, defaultProps, elementProps, getButtonProps]
|
|
176
170
|
});
|
|
177
171
|
const contextValue = React.useMemo(() => ({
|
|
178
172
|
selected,
|
|
@@ -36,8 +36,7 @@ const ComboboxItemIndicator = exports.ComboboxItemIndicator = /*#__PURE__*/React
|
|
|
36
36
|
});
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
* costs unless the element needs to be mounted. */
|
|
39
|
+
// Split the core implementation to avoid paying the hook costs unless the element needs to mount.
|
|
41
40
|
if (process.env.NODE_ENV !== "production") ComboboxItemIndicator.displayName = "ComboboxItemIndicator";
|
|
42
41
|
const Inner = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef((componentProps, forwardedRef) => {
|
|
43
42
|
const {
|