@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 {}
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useControlled } from '@base-ui/utils/useControlled';
|
|
5
|
-
import { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';
|
|
6
5
|
import { useStableCallback } from '@base-ui/utils/useStableCallback';
|
|
7
6
|
import { useBaseUiId } from "../../internals/useBaseUiId.js";
|
|
8
7
|
import { createChangeEventDetails } from "../../internals/createBaseUIEventDetails.js";
|
|
9
8
|
import { REASONS } from "../../internals/reasons.js";
|
|
10
|
-
import { useAnimationsFinished } from "../../internals/useAnimationsFinished.js";
|
|
11
9
|
import { useTransitionStatus } from "../../internals/useTransitionStatus.js";
|
|
12
10
|
export function useCollapsibleRoot(parameters) {
|
|
13
11
|
const {
|
|
@@ -16,7 +14,6 @@ export function useCollapsibleRoot(parameters) {
|
|
|
16
14
|
onOpenChange,
|
|
17
15
|
disabled
|
|
18
16
|
} = parameters;
|
|
19
|
-
const isControlled = openParam !== undefined;
|
|
20
17
|
const [open, setOpen] = useControlled({
|
|
21
18
|
controlled: openParam,
|
|
22
19
|
default: defaultOpen,
|
|
@@ -28,24 +25,9 @@ export function useCollapsibleRoot(parameters) {
|
|
|
28
25
|
setMounted,
|
|
29
26
|
transitionStatus
|
|
30
27
|
} = useTransitionStatus(open, true, true);
|
|
31
|
-
const [visible, setVisible] = React.useState(open);
|
|
32
|
-
const [{
|
|
33
|
-
height,
|
|
34
|
-
width
|
|
35
|
-
}, setDimensions] = React.useState({
|
|
36
|
-
height: undefined,
|
|
37
|
-
width: undefined
|
|
38
|
-
});
|
|
39
28
|
const defaultPanelId = useBaseUiId();
|
|
40
29
|
const [panelIdState, setPanelIdState] = React.useState();
|
|
41
30
|
const panelId = panelIdState ?? defaultPanelId;
|
|
42
|
-
const [hiddenUntilFound, setHiddenUntilFound] = React.useState(false);
|
|
43
|
-
const [keepMounted, setKeepMounted] = React.useState(false);
|
|
44
|
-
const abortControllerRef = React.useRef(null);
|
|
45
|
-
const animationTypeRef = React.useRef(null);
|
|
46
|
-
const transitionDimensionRef = React.useRef(null);
|
|
47
|
-
const panelRef = React.useRef(null);
|
|
48
|
-
const runOnceAnimationsFinish = useAnimationsFinished(panelRef, false);
|
|
49
31
|
const handleTrigger = useStableCallback(event => {
|
|
50
32
|
const nextOpen = !open;
|
|
51
33
|
const eventDetails = createChangeEventDetails(REASONS.triggerPress, event.nativeEvent);
|
|
@@ -53,61 +35,17 @@ export function useCollapsibleRoot(parameters) {
|
|
|
53
35
|
if (eventDetails.isCanceled) {
|
|
54
36
|
return;
|
|
55
37
|
}
|
|
56
|
-
const panel = panelRef.current;
|
|
57
|
-
if (animationTypeRef.current === 'css-animation' && panel != null) {
|
|
58
|
-
panel.style.removeProperty('animation-name');
|
|
59
|
-
}
|
|
60
|
-
if (!hiddenUntilFound && !keepMounted) {
|
|
61
|
-
if (animationTypeRef.current != null && animationTypeRef.current !== 'css-animation') {
|
|
62
|
-
if (!mounted && nextOpen) {
|
|
63
|
-
setMounted(true);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (animationTypeRef.current === 'css-animation') {
|
|
67
|
-
if (!visible && nextOpen) {
|
|
68
|
-
setVisible(true);
|
|
69
|
-
}
|
|
70
|
-
if (!mounted && nextOpen) {
|
|
71
|
-
setMounted(true);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
38
|
setOpen(nextOpen);
|
|
76
|
-
if (animationTypeRef.current === 'none' && mounted && !nextOpen) {
|
|
77
|
-
setMounted(false);
|
|
78
|
-
}
|
|
79
39
|
});
|
|
80
|
-
useIsoLayoutEffect(() => {
|
|
81
|
-
/**
|
|
82
|
-
* Close immediately in controlled mode when no CSS animations or
|
|
83
|
-
* transitions are applied. `keepMounted` only keeps the element in the
|
|
84
|
-
* DOM; `mounted` must still become `false` so the panel regains `hidden`.
|
|
85
|
-
*/
|
|
86
|
-
if (isControlled && animationTypeRef.current === 'none' && !open) {
|
|
87
|
-
setMounted(false);
|
|
88
|
-
}
|
|
89
|
-
}, [isControlled, open, openParam, setMounted]);
|
|
90
40
|
return React.useMemo(() => ({
|
|
91
|
-
abortControllerRef,
|
|
92
|
-
animationTypeRef,
|
|
93
41
|
disabled,
|
|
94
42
|
handleTrigger,
|
|
95
|
-
height,
|
|
96
43
|
mounted,
|
|
97
44
|
open,
|
|
98
45
|
panelId,
|
|
99
|
-
panelRef,
|
|
100
|
-
runOnceAnimationsFinish,
|
|
101
|
-
setDimensions,
|
|
102
|
-
setHiddenUntilFound,
|
|
103
|
-
setKeepMounted,
|
|
104
46
|
setMounted,
|
|
105
47
|
setOpen,
|
|
106
48
|
setPanelIdState,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
transitionStatus,
|
|
110
|
-
visible,
|
|
111
|
-
width
|
|
112
|
-
}), [abortControllerRef, animationTypeRef, disabled, handleTrigger, height, mounted, open, panelId, panelRef, runOnceAnimationsFinish, setDimensions, setHiddenUntilFound, setKeepMounted, setMounted, setOpen, setVisible, transitionDimensionRef, transitionStatus, visible, width]);
|
|
49
|
+
transitionStatus
|
|
50
|
+
}), [disabled, handleTrigger, mounted, open, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]);
|
|
113
51
|
}
|
|
@@ -42,15 +42,14 @@ export const CollapsibleTrigger = /*#__PURE__*/React.forwardRef(function Collaps
|
|
|
42
42
|
focusableWhenDisabled: true,
|
|
43
43
|
native: nativeButton
|
|
44
44
|
});
|
|
45
|
-
const props = React.useMemo(() => ({
|
|
46
|
-
'aria-controls': open ? panelId : undefined,
|
|
47
|
-
'aria-expanded': open,
|
|
48
|
-
onClick: handleTrigger
|
|
49
|
-
}), [panelId, open, handleTrigger]);
|
|
50
45
|
const element = useRenderElement('button', componentProps, {
|
|
51
46
|
state,
|
|
52
47
|
ref: [forwardedRef, buttonRef],
|
|
53
|
-
props: [
|
|
48
|
+
props: [{
|
|
49
|
+
'aria-controls': open ? panelId : undefined,
|
|
50
|
+
'aria-expanded': open,
|
|
51
|
+
onClick: handleTrigger
|
|
52
|
+
}, elementProps, getButtonProps],
|
|
54
53
|
stateAttributesMapping
|
|
55
54
|
});
|
|
56
55
|
return element;
|
|
@@ -16,8 +16,8 @@ import { popupStateMapping } from "../../utils/popupStateMapping.js";
|
|
|
16
16
|
*/
|
|
17
17
|
export const ComboboxArrow = /*#__PURE__*/React.forwardRef(function ComboboxArrow(componentProps, forwardedRef) {
|
|
18
18
|
const {
|
|
19
|
-
className,
|
|
20
19
|
render,
|
|
20
|
+
className,
|
|
21
21
|
style,
|
|
22
22
|
...elementProps
|
|
23
23
|
} = componentProps;
|
|
@@ -20,8 +20,8 @@ const stateAttributesMapping = {
|
|
|
20
20
|
*/
|
|
21
21
|
export const ComboboxBackdrop = /*#__PURE__*/React.forwardRef(function ComboboxBackdrop(componentProps, forwardedRef) {
|
|
22
22
|
const {
|
|
23
|
-
className,
|
|
24
23
|
render,
|
|
24
|
+
className,
|
|
25
25
|
style,
|
|
26
26
|
...elementProps
|
|
27
27
|
} = componentProps;
|
|
@@ -12,6 +12,7 @@ import { stopEvent } from "../../floating-ui-react/utils.js";
|
|
|
12
12
|
import { selectors } from "../store.js";
|
|
13
13
|
import { createChangeEventDetails } from "../../internals/createBaseUIEventDetails.js";
|
|
14
14
|
import { REASONS } from "../../internals/reasons.js";
|
|
15
|
+
import { useDirection } from "../../internals/direction-context/DirectionContext.js";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* An individual chip that represents a value in a multiselectable input.
|
|
@@ -32,6 +33,7 @@ export const ComboboxChip = /*#__PURE__*/React.forwardRef(function ComboboxChip(
|
|
|
32
33
|
setHighlightedChipIndex,
|
|
33
34
|
chipsRef
|
|
34
35
|
} = useComboboxChipsContext();
|
|
36
|
+
const direction = useDirection();
|
|
35
37
|
const disabled = useStore(store, selectors.disabled);
|
|
36
38
|
const readOnly = useStore(store, selectors.readOnly);
|
|
37
39
|
const selectedValue = useStore(store, selectors.selectedValue);
|
|
@@ -41,14 +43,17 @@ export const ComboboxChip = /*#__PURE__*/React.forwardRef(function ComboboxChip(
|
|
|
41
43
|
} = useCompositeListItem();
|
|
42
44
|
function handleKeyDown(event) {
|
|
43
45
|
let nextIndex = index;
|
|
44
|
-
|
|
46
|
+
const isRtl = direction === 'rtl';
|
|
47
|
+
const previousChipKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
|
|
48
|
+
const nextChipKey = isRtl ? 'ArrowLeft' : 'ArrowRight';
|
|
49
|
+
if (event.key === previousChipKey) {
|
|
45
50
|
event.preventDefault();
|
|
46
51
|
if (index > 0) {
|
|
47
52
|
nextIndex = index - 1;
|
|
48
53
|
} else {
|
|
49
54
|
nextIndex = undefined;
|
|
50
55
|
}
|
|
51
|
-
} else if (event.key ===
|
|
56
|
+
} else if (event.key === nextChipKey) {
|
|
52
57
|
event.preventDefault();
|
|
53
58
|
if (index < chipsRef.current.length - 1) {
|
|
54
59
|
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
|
*/
|
|
@@ -8,6 +8,10 @@ export let ComboboxClearDataAttributes = function (ComboboxClearDataAttributes)
|
|
|
8
8
|
* Present when the button is disabled.
|
|
9
9
|
*/
|
|
10
10
|
ComboboxClearDataAttributes["disabled"] = "data-disabled";
|
|
11
|
+
/**
|
|
12
|
+
* Present when the clear button is visible.
|
|
13
|
+
*/
|
|
14
|
+
ComboboxClearDataAttributes["visible"] = "data-visible";
|
|
11
15
|
/**
|
|
12
16
|
* Present when the button is animating in.
|
|
13
17
|
*/
|
|
@@ -11,8 +11,8 @@ import { useRenderElement } from "../../internals/useRenderElement.js";
|
|
|
11
11
|
*/
|
|
12
12
|
export const ComboboxIcon = /*#__PURE__*/React.forwardRef(function ComboboxIcon(componentProps, forwardedRef) {
|
|
13
13
|
const {
|
|
14
|
-
className,
|
|
15
14
|
render,
|
|
15
|
+
className,
|
|
16
16
|
style,
|
|
17
17
|
...elementProps
|
|
18
18
|
} = componentProps;
|
|
@@ -9,7 +9,7 @@ import { useRenderElement } from "../../internals/useRenderElement.js";
|
|
|
9
9
|
import { useComboboxDerivedItemsContext, useComboboxInputValueContext, useComboboxRootContext } from "../root/ComboboxRootContext.js";
|
|
10
10
|
import { triggerStateAttributesMapping } from "../utils/stateAttributesMapping.js";
|
|
11
11
|
import { selectors } from "../store.js";
|
|
12
|
-
import { useFieldRootContext } from "../../internals/field-root-context/FieldRootContext.js";
|
|
12
|
+
import { DEFAULT_FIELD_ROOT_CONTEXT, FieldRootContext, useFieldRootContext } from "../../internals/field-root-context/FieldRootContext.js";
|
|
13
13
|
import { DEFAULT_FIELD_STATE_ATTRIBUTES } from "../../internals/field-constants/constants.js";
|
|
14
14
|
import { useLabelableContext } from "../../internals/labelable-provider/LabelableContext.js";
|
|
15
15
|
import { useComboboxChipsContext } from "../chips/ComboboxChipsContext.js";
|
|
@@ -89,6 +89,7 @@ export const ComboboxInput = /*#__PURE__*/React.forwardRef(function ComboboxInpu
|
|
|
89
89
|
const isComposingRef = React.useRef(false);
|
|
90
90
|
const lastActiveIndexRef = React.useRef(null);
|
|
91
91
|
const shouldRestoreActiveIndexRef = React.useRef(false);
|
|
92
|
+
const inputOwnsFormValue = selectionMode === 'none' && !hasPositionerParent;
|
|
92
93
|
const setInputElement = useStableCallback(element => {
|
|
93
94
|
const nextIsInsidePopup = hasPositionerParent || store.state.inline;
|
|
94
95
|
if (nextIsInsidePopup && !store.state.hasInputValue) {
|
|
@@ -96,7 +97,8 @@ export const ComboboxInput = /*#__PURE__*/React.forwardRef(function ComboboxInpu
|
|
|
96
97
|
}
|
|
97
98
|
store.update({
|
|
98
99
|
inputElement: element,
|
|
99
|
-
inputInsidePopup: nextIsInsidePopup
|
|
100
|
+
inputInsidePopup: nextIsInsidePopup,
|
|
101
|
+
inputOwnsFormValue
|
|
100
102
|
});
|
|
101
103
|
});
|
|
102
104
|
const validationProps = hasPositionerParent || !validation ? elementProps : validation.getValidationProps(elementProps);
|
|
@@ -117,15 +119,18 @@ export const ComboboxInput = /*#__PURE__*/React.forwardRef(function ComboboxInpu
|
|
|
117
119
|
highlightedChipIndex
|
|
118
120
|
} = comboboxChipsContext;
|
|
119
121
|
const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
|
|
122
|
+
const isRtl = direction === 'rtl';
|
|
123
|
+
const previousChipKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
|
|
124
|
+
const nextChipKey = isRtl ? 'ArrowLeft' : 'ArrowRight';
|
|
120
125
|
if (highlightedChipIndex !== undefined) {
|
|
121
|
-
if (event.key ===
|
|
126
|
+
if (event.key === previousChipKey) {
|
|
122
127
|
event.preventDefault();
|
|
123
128
|
if (highlightedChipIndex > 0) {
|
|
124
129
|
nextIndex = highlightedChipIndex - 1;
|
|
125
130
|
} else {
|
|
126
131
|
nextIndex = undefined;
|
|
127
132
|
}
|
|
128
|
-
} else if (event.key ===
|
|
133
|
+
} else if (event.key === nextChipKey) {
|
|
129
134
|
event.preventDefault();
|
|
130
135
|
if (highlightedChipIndex < renderedChipsCount - 1) {
|
|
131
136
|
nextIndex = highlightedChipIndex + 1;
|
|
@@ -148,7 +153,7 @@ export const ComboboxInput = /*#__PURE__*/React.forwardRef(function ComboboxInpu
|
|
|
148
153
|
}
|
|
149
154
|
|
|
150
155
|
// Handle navigation when no chip is highlighted
|
|
151
|
-
if (event.key ===
|
|
156
|
+
if (event.key === previousChipKey && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) {
|
|
152
157
|
event.preventDefault();
|
|
153
158
|
nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : undefined;
|
|
154
159
|
} else if (event.key === 'Backspace' && event.currentTarget.value === '' && selectedValue.length > 0) {
|
|
@@ -174,7 +179,7 @@ export const ComboboxInput = /*#__PURE__*/React.forwardRef(function ComboboxInpu
|
|
|
174
179
|
readOnly,
|
|
175
180
|
required: selectionMode === 'none' ? required : undefined,
|
|
176
181
|
form,
|
|
177
|
-
...(
|
|
182
|
+
...(inputOwnsFormValue && name && {
|
|
178
183
|
name
|
|
179
184
|
}),
|
|
180
185
|
id,
|
|
@@ -396,10 +401,14 @@ export const ComboboxInput = /*#__PURE__*/React.forwardRef(function ComboboxInpu
|
|
|
396
401
|
}, validationProps],
|
|
397
402
|
stateAttributesMapping: triggerStateAttributesMapping
|
|
398
403
|
});
|
|
404
|
+
const renderedInput = hasPositionerParent ? /*#__PURE__*/_jsx(FieldRootContext.Provider, {
|
|
405
|
+
value: DEFAULT_FIELD_ROOT_CONTEXT,
|
|
406
|
+
children: element
|
|
407
|
+
}) : element;
|
|
399
408
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
400
409
|
children: [open && focusManagerModal && /*#__PURE__*/_jsx(ComboboxInternalDismissButton, {
|
|
401
410
|
ref: store.state.startDismissRef
|
|
402
|
-
}),
|
|
411
|
+
}), renderedInput]
|
|
403
412
|
});
|
|
404
413
|
});
|
|
405
414
|
if (process.env.NODE_ENV !== "production") ComboboxInput.displayName = "ComboboxInput";
|
|
@@ -24,11 +24,11 @@ export const ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRe
|
|
|
24
24
|
const {
|
|
25
25
|
render,
|
|
26
26
|
className,
|
|
27
|
+
style,
|
|
27
28
|
value: itemValue = null,
|
|
28
29
|
index: indexProp,
|
|
29
30
|
disabled = false,
|
|
30
31
|
nativeButton = false,
|
|
31
|
-
style,
|
|
32
32
|
...elementProps
|
|
33
33
|
} = componentProps;
|
|
34
34
|
const didPointerDownRef = React.useRef(false);
|
|
@@ -55,7 +55,7 @@ export const ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRe
|
|
|
55
55
|
const rootId = useStore(store, selectors.id);
|
|
56
56
|
const highlighted = useStore(store, selectors.isActive, index);
|
|
57
57
|
const matchesSelectedValue = useStore(store, selectors.isSelected, itemValue);
|
|
58
|
-
const
|
|
58
|
+
const itemProps = useStore(store, selectors.itemProps);
|
|
59
59
|
const itemRef = React.useRef(null);
|
|
60
60
|
const id = rootId != null && hasRegistered ? `${rootId}-${index}` : undefined;
|
|
61
61
|
const selected = matchesSelectedValue && selectable;
|
|
@@ -101,17 +101,6 @@ export const ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRe
|
|
|
101
101
|
store.set('selectedIndex', index);
|
|
102
102
|
}
|
|
103
103
|
}, [hasRegistered, hasItems, open, store, index, itemValue, isItemEqualToValue]);
|
|
104
|
-
const state = {
|
|
105
|
-
disabled,
|
|
106
|
-
selected,
|
|
107
|
-
highlighted
|
|
108
|
-
};
|
|
109
|
-
const rootProps = getItemProps({
|
|
110
|
-
active: highlighted,
|
|
111
|
-
selected
|
|
112
|
-
});
|
|
113
|
-
rootProps.id = undefined;
|
|
114
|
-
rootProps.onFocus = undefined;
|
|
115
104
|
const {
|
|
116
105
|
getButtonProps,
|
|
117
106
|
buttonRef
|
|
@@ -121,6 +110,11 @@ export const ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRe
|
|
|
121
110
|
native: nativeButton,
|
|
122
111
|
composite: true
|
|
123
112
|
});
|
|
113
|
+
const state = {
|
|
114
|
+
disabled,
|
|
115
|
+
selected,
|
|
116
|
+
highlighted
|
|
117
|
+
};
|
|
124
118
|
function commitSelection(nativeEvent) {
|
|
125
119
|
function selectItem() {
|
|
126
120
|
store.state.handleSelection(nativeEvent, itemValue);
|
|
@@ -167,7 +161,7 @@ export const ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRe
|
|
|
167
161
|
const element = useRenderElement('div', componentProps, {
|
|
168
162
|
ref: [buttonRef, forwardedRef, listItem.ref, itemRef],
|
|
169
163
|
state,
|
|
170
|
-
props: [
|
|
164
|
+
props: [itemProps, defaultProps, elementProps, getButtonProps]
|
|
171
165
|
});
|
|
172
166
|
const contextValue = React.useMemo(() => ({
|
|
173
167
|
selected,
|
|
@@ -31,8 +31,7 @@ export const ComboboxItemIndicator = /*#__PURE__*/React.forwardRef(function Comb
|
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
* costs unless the element needs to be mounted. */
|
|
34
|
+
// Split the core implementation to avoid paying the hook costs unless the element needs to mount.
|
|
36
35
|
if (process.env.NODE_ENV !== "production") ComboboxItemIndicator.displayName = "ComboboxItemIndicator";
|
|
37
36
|
const Inner = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef((componentProps, forwardedRef) => {
|
|
38
37
|
const {
|