@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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { useStableCallback } from '@base-ui/utils/useStableCallback';
|
|
5
4
|
import { AriaCombobox } from "../../combobox/root/AriaCombobox.js";
|
|
6
5
|
import { useCoreFilter } from "../../combobox/root/utils/useFilter.js";
|
|
7
6
|
import { stringifyAsLabel } from "../../internals/resolveValueLabel.js";
|
|
@@ -47,13 +46,6 @@ export function AutocompleteRoot(props) {
|
|
|
47
46
|
} else {
|
|
48
47
|
resolvedInputValue = internalValue;
|
|
49
48
|
}
|
|
50
|
-
const handleValueChange = useStableCallback((nextValue, eventDetails) => {
|
|
51
|
-
setInlineInputValue('');
|
|
52
|
-
if (!isControlled) {
|
|
53
|
-
setInternalValue(nextValue);
|
|
54
|
-
}
|
|
55
|
-
onValueChange?.(nextValue, eventDetails);
|
|
56
|
-
});
|
|
57
49
|
const collator = useCoreFilter();
|
|
58
50
|
const baseFilter = React.useMemo(() => {
|
|
59
51
|
if (other.filter !== undefined) {
|
|
@@ -75,7 +67,14 @@ export function AutocompleteRoot(props) {
|
|
|
75
67
|
return baseFilter(item, resolvedQuery, toString);
|
|
76
68
|
};
|
|
77
69
|
}, [baseFilter, mode, resolvedQuery, staticItems]);
|
|
78
|
-
|
|
70
|
+
function handleValueChange(nextValue, eventDetails) {
|
|
71
|
+
setInlineInputValue('');
|
|
72
|
+
if (!isControlled) {
|
|
73
|
+
setInternalValue(nextValue);
|
|
74
|
+
}
|
|
75
|
+
onValueChange?.(nextValue, eventDetails);
|
|
76
|
+
}
|
|
77
|
+
function handleItemHighlighted(highlightedValue, eventDetails) {
|
|
79
78
|
props.onItemHighlighted?.(highlightedValue, eventDetails);
|
|
80
79
|
if (eventDetails.reason === REASONS.pointer) {
|
|
81
80
|
return;
|
|
@@ -89,7 +88,7 @@ export function AutocompleteRoot(props) {
|
|
|
89
88
|
} else {
|
|
90
89
|
setInlineInputValue('');
|
|
91
90
|
}
|
|
92
|
-
}
|
|
91
|
+
}
|
|
93
92
|
return /*#__PURE__*/_jsx(AriaCombobox, {
|
|
94
93
|
...other,
|
|
95
94
|
itemToStringLabel: itemToStringValue,
|
|
@@ -52,10 +52,6 @@ export const AvatarImage = /*#__PURE__*/React.forwardRef(function AvatarImage(co
|
|
|
52
52
|
handleLoadingStatusChange(imageLoadingStatus);
|
|
53
53
|
}
|
|
54
54
|
}, [imageLoadingStatus, handleLoadingStatusChange]);
|
|
55
|
-
const state = {
|
|
56
|
-
imageLoadingStatus,
|
|
57
|
-
transitionStatus
|
|
58
|
-
};
|
|
59
55
|
useOpenChangeComplete({
|
|
60
56
|
open: isVisible,
|
|
61
57
|
ref: imageRef,
|
|
@@ -65,6 +61,10 @@ export const AvatarImage = /*#__PURE__*/React.forwardRef(function AvatarImage(co
|
|
|
65
61
|
}
|
|
66
62
|
}
|
|
67
63
|
});
|
|
64
|
+
const state = {
|
|
65
|
+
imageLoadingStatus,
|
|
66
|
+
transitionStatus
|
|
67
|
+
};
|
|
68
68
|
const element = useRenderElement('img', componentProps, {
|
|
69
69
|
state,
|
|
70
70
|
ref: [forwardedRef, imageRef],
|
|
@@ -45,11 +45,11 @@ export const CheckboxIndicator = /*#__PURE__*/React.forwardRef(function Checkbox
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
const baseStateAttributesMapping = useStateAttributesMapping(rootState);
|
|
48
|
-
const stateAttributesMapping =
|
|
48
|
+
const stateAttributesMapping = {
|
|
49
49
|
...baseStateAttributesMapping,
|
|
50
50
|
...transitionStatusMapping,
|
|
51
51
|
...fieldValidityMapping
|
|
52
|
-
}
|
|
52
|
+
};
|
|
53
53
|
const shouldRender = keepMounted || mounted;
|
|
54
54
|
const element = useRenderElement('span', componentProps, {
|
|
55
55
|
ref: [forwardedRef, indicatorRef],
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { EMPTY_OBJECT } from '@base-ui/utils/empty';
|
|
5
5
|
import { useControlled } from '@base-ui/utils/useControlled';
|
|
6
|
-
import { useStableCallback } from '@base-ui/utils/useStableCallback';
|
|
7
6
|
import { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';
|
|
8
7
|
import { useMergedRefs } from '@base-ui/utils/useMergedRefs';
|
|
9
8
|
import { useRefWithInit } from '@base-ui/utils/useRefWithInit';
|
|
10
9
|
import { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';
|
|
10
|
+
import { ownerWindow } from '@base-ui/utils/owner';
|
|
11
|
+
import { getDefaultFormSubmitter } from '@base-ui/utils/getDefaultFormSubmitter';
|
|
11
12
|
import { NOOP } from "../../internals/noop.js";
|
|
12
13
|
import { useStateAttributesMapping } from "../utils/useStateAttributesMapping.js";
|
|
13
14
|
import { useRenderElement } from "../../internals/useRenderElement.js";
|
|
@@ -46,7 +47,7 @@ export const CheckboxRoot = /*#__PURE__*/React.forwardRef(function CheckboxRoot(
|
|
|
46
47
|
indeterminate = false,
|
|
47
48
|
inputRef: inputRefProp,
|
|
48
49
|
name: nameProp,
|
|
49
|
-
onCheckedChange
|
|
50
|
+
onCheckedChange,
|
|
50
51
|
parent = false,
|
|
51
52
|
readOnly = false,
|
|
52
53
|
render,
|
|
@@ -102,7 +103,6 @@ export const CheckboxRoot = /*#__PURE__*/React.forwardRef(function CheckboxRoot(
|
|
|
102
103
|
groupProps = groupContext.parent.getChildProps(value);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
|
-
const onCheckedChange = useStableCallback(onCheckedChangeProp);
|
|
106
106
|
const {
|
|
107
107
|
checked: groupChecked = checkedProp,
|
|
108
108
|
indeterminate: groupIndeterminate = indeterminate,
|
|
@@ -138,7 +138,7 @@ export const CheckboxRoot = /*#__PURE__*/React.forwardRef(function CheckboxRoot(
|
|
|
138
138
|
hasRegisteredRef.current = true;
|
|
139
139
|
registerControlId(controlSourceRef.current, inputId);
|
|
140
140
|
return undefined;
|
|
141
|
-
}, [inputId,
|
|
141
|
+
}, [inputId, registerControlId, controlSourceRef]);
|
|
142
142
|
React.useEffect(() => {
|
|
143
143
|
const controlSource = controlSourceRef.current;
|
|
144
144
|
return () => {
|
|
@@ -149,11 +149,7 @@ export const CheckboxRoot = /*#__PURE__*/React.forwardRef(function CheckboxRoot(
|
|
|
149
149
|
registerControlId(controlSource, undefined);
|
|
150
150
|
};
|
|
151
151
|
}, [registerControlId, controlSourceRef]);
|
|
152
|
-
useRegisterFieldControl(controlRef,
|
|
153
|
-
enabled: !groupContext,
|
|
154
|
-
id,
|
|
155
|
-
value: checked
|
|
156
|
-
});
|
|
152
|
+
useRegisterFieldControl(controlRef, id, checked, undefined, !groupContext);
|
|
157
153
|
const inputRef = React.useRef(null);
|
|
158
154
|
const mergedInputRef = useMergedRefs(inputRefProp, inputRef, validation.inputRef);
|
|
159
155
|
const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, inputRef, !nativeButton, inputId ?? undefined);
|
|
@@ -205,7 +201,7 @@ export const CheckboxRoot = /*#__PURE__*/React.forwardRef(function CheckboxRoot(
|
|
|
205
201
|
const nextChecked = event.currentTarget.checked;
|
|
206
202
|
const details = createChangeEventDetails(REASONS.none, event.nativeEvent);
|
|
207
203
|
groupOnChange?.(nextChecked, details);
|
|
208
|
-
onCheckedChange(nextChecked, details);
|
|
204
|
+
onCheckedChange?.(nextChecked, details);
|
|
209
205
|
if (details.isCanceled) {
|
|
210
206
|
return;
|
|
211
207
|
}
|
|
@@ -270,12 +266,54 @@ export const CheckboxRoot = /*#__PURE__*/React.forwardRef(function CheckboxRoot(
|
|
|
270
266
|
validation.commit(groupContext ? groupValue : inputEl.checked);
|
|
271
267
|
}
|
|
272
268
|
},
|
|
269
|
+
onKeyDown(event) {
|
|
270
|
+
if (event.key !== 'Enter') {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Let consumer `preventDefault()` handlers opt out while defensively stopping
|
|
275
|
+
// any remaining Base UI Enter handling from treating the checkbox as a button.
|
|
276
|
+
event.preventBaseUIHandler();
|
|
277
|
+
if (event.defaultPrevented) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const formToSubmit = inputRef.current?.form ?? null;
|
|
281
|
+
const currentTarget = event.currentTarget;
|
|
282
|
+
const nativeEvent = event.nativeEvent;
|
|
283
|
+
const originalPreventDefault = event.preventDefault;
|
|
284
|
+
const originalNativePreventDefault = nativeEvent.preventDefault;
|
|
285
|
+
let preventDefaultCalledAfterPropagation = false;
|
|
286
|
+
event.preventDefault = () => {
|
|
287
|
+
preventDefaultCalledAfterPropagation = true;
|
|
288
|
+
originalPreventDefault.call(event);
|
|
289
|
+
};
|
|
290
|
+
nativeEvent.preventDefault = () => {
|
|
291
|
+
preventDefaultCalledAfterPropagation = true;
|
|
292
|
+
originalNativePreventDefault.call(nativeEvent);
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// Enter should not activate/toggle the checkbox. Cancel the native button behavior
|
|
296
|
+
// without setting React's synthetic `defaultPrevented`, so ancestor React handlers
|
|
297
|
+
// can still opt out by calling `preventDefault()` during propagation.
|
|
298
|
+
originalNativePreventDefault.call(nativeEvent);
|
|
299
|
+
ownerWindow(currentTarget).queueMicrotask(() => {
|
|
300
|
+
event.preventDefault = originalPreventDefault;
|
|
301
|
+
nativeEvent.preventDefault = originalNativePreventDefault;
|
|
302
|
+
if (!preventDefaultCalledAfterPropagation) {
|
|
303
|
+
getDefaultFormSubmitter(formToSubmit)?.click();
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
},
|
|
273
307
|
onClick(event) {
|
|
274
308
|
if (readOnly || disabled) {
|
|
275
309
|
return;
|
|
276
310
|
}
|
|
277
311
|
event.preventDefault();
|
|
278
|
-
inputRef.current
|
|
312
|
+
const input = inputRef.current;
|
|
313
|
+
if (!input) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
input.dispatchEvent(new (ownerWindow(input).PointerEvent)('click', {
|
|
279
317
|
bubbles: true,
|
|
280
318
|
shiftKey: event.shiftKey,
|
|
281
319
|
ctrlKey: event.ctrlKey,
|
|
@@ -85,11 +85,7 @@ export const CheckboxGroup = /*#__PURE__*/React.forwardRef(function CheckboxGrou
|
|
|
85
85
|
controlRef.current = element;
|
|
86
86
|
}
|
|
87
87
|
}, []);
|
|
88
|
-
useRegisterFieldControl(controlRef,
|
|
89
|
-
enabled: !!fieldName,
|
|
90
|
-
id,
|
|
91
|
-
value
|
|
92
|
-
});
|
|
88
|
+
useRegisterFieldControl(controlRef, id, value, undefined, !!fieldName);
|
|
93
89
|
const resolvedValue = value ?? EMPTY_ARRAY;
|
|
94
90
|
useValueChanged(resolvedValue, () => {
|
|
95
91
|
if (fieldName) {
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';
|
|
5
5
|
import { warn } from '@base-ui/utils/warn';
|
|
6
|
+
import { resolveStyle } from "../../utils/resolveStyle.js";
|
|
6
7
|
import { useRenderElement } from "../../internals/useRenderElement.js";
|
|
7
8
|
import { useCollapsibleRootContext } from "../root/CollapsibleRootContext.js";
|
|
8
9
|
import { collapsibleStateAttributesMapping } from "../root/stateAttributesMapping.js";
|
|
9
10
|
import { useCollapsiblePanel } from "./useCollapsiblePanel.js";
|
|
10
11
|
import { CollapsiblePanelCssVars } from "./CollapsiblePanelCssVars.js";
|
|
11
|
-
import { useOpenChangeComplete } from "../../internals/useOpenChangeComplete.js";
|
|
12
12
|
/**
|
|
13
13
|
* A panel with the collapsible contents.
|
|
14
14
|
* Renders a `<div>` element.
|
|
@@ -29,31 +29,19 @@ export const CollapsiblePanel = /*#__PURE__*/React.forwardRef(function Collapsib
|
|
|
29
29
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
30
30
|
useIsoLayoutEffect(() => {
|
|
31
31
|
if (hiddenUntilFoundProp && keepMountedProp === false) {
|
|
32
|
-
warn('The `keepMounted={false}` prop on
|
|
32
|
+
warn('The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed.');
|
|
33
33
|
}
|
|
34
34
|
}, [hiddenUntilFoundProp, keepMountedProp]);
|
|
35
35
|
}
|
|
36
36
|
const {
|
|
37
|
-
abortControllerRef,
|
|
38
|
-
animationTypeRef,
|
|
39
|
-
height,
|
|
40
37
|
mounted,
|
|
41
38
|
onOpenChange,
|
|
42
39
|
open,
|
|
43
40
|
panelId,
|
|
44
|
-
panelRef,
|
|
45
|
-
runOnceAnimationsFinish,
|
|
46
|
-
setDimensions,
|
|
47
|
-
setHiddenUntilFound,
|
|
48
|
-
setKeepMounted,
|
|
49
41
|
setMounted,
|
|
50
42
|
setPanelIdState,
|
|
51
43
|
setOpen,
|
|
52
|
-
setVisible,
|
|
53
44
|
state,
|
|
54
|
-
transitionDimensionRef,
|
|
55
|
-
visible,
|
|
56
|
-
width,
|
|
57
45
|
transitionStatus
|
|
58
46
|
} = useCollapsibleRootContext();
|
|
59
47
|
const hiddenUntilFound = hiddenUntilFoundProp ?? false;
|
|
@@ -67,64 +55,54 @@ export const CollapsiblePanel = /*#__PURE__*/React.forwardRef(function Collapsib
|
|
|
67
55
|
}
|
|
68
56
|
return undefined;
|
|
69
57
|
}, [idProp, setPanelIdState]);
|
|
70
|
-
useIsoLayoutEffect(() => {
|
|
71
|
-
setHiddenUntilFound(hiddenUntilFound);
|
|
72
|
-
}, [setHiddenUntilFound, hiddenUntilFound]);
|
|
73
|
-
useIsoLayoutEffect(() => {
|
|
74
|
-
setKeepMounted(keepMounted);
|
|
75
|
-
}, [setKeepMounted, keepMounted]);
|
|
76
58
|
const {
|
|
77
|
-
|
|
59
|
+
height,
|
|
60
|
+
props,
|
|
61
|
+
ref,
|
|
62
|
+
shouldPreventOpenAnimation,
|
|
63
|
+
shouldRender,
|
|
64
|
+
transitionStatus: panelTransitionStatus,
|
|
65
|
+
width
|
|
78
66
|
} = useCollapsiblePanel({
|
|
79
|
-
abortControllerRef,
|
|
80
|
-
animationTypeRef,
|
|
81
67
|
externalRef: forwardedRef,
|
|
82
|
-
height,
|
|
83
68
|
hiddenUntilFound,
|
|
84
69
|
id: panelId,
|
|
85
70
|
keepMounted,
|
|
86
71
|
mounted,
|
|
87
72
|
onOpenChange,
|
|
88
73
|
open,
|
|
89
|
-
panelRef,
|
|
90
|
-
runOnceAnimationsFinish,
|
|
91
|
-
setDimensions,
|
|
92
74
|
setMounted,
|
|
93
75
|
setOpen,
|
|
94
|
-
|
|
95
|
-
transitionDimensionRef,
|
|
96
|
-
visible,
|
|
97
|
-
width
|
|
98
|
-
});
|
|
99
|
-
useOpenChangeComplete({
|
|
100
|
-
open: open && transitionStatus === 'idle',
|
|
101
|
-
ref: panelRef,
|
|
102
|
-
onComplete() {
|
|
103
|
-
if (!open) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
setDimensions({
|
|
107
|
-
height: undefined,
|
|
108
|
-
width: undefined
|
|
109
|
-
});
|
|
110
|
-
}
|
|
76
|
+
transitionStatus
|
|
111
77
|
});
|
|
112
|
-
const panelState =
|
|
78
|
+
const panelState = {
|
|
113
79
|
...state,
|
|
114
|
-
transitionStatus
|
|
115
|
-
}
|
|
116
|
-
const
|
|
80
|
+
transitionStatus: panelTransitionStatus
|
|
81
|
+
};
|
|
82
|
+
const resolvedStyle = resolveStyle(style, panelState);
|
|
83
|
+
const element = useRenderElement('div', {
|
|
84
|
+
...componentProps,
|
|
85
|
+
style: undefined
|
|
86
|
+
}, {
|
|
117
87
|
state: panelState,
|
|
118
|
-
ref
|
|
88
|
+
ref,
|
|
119
89
|
props: [props, {
|
|
120
90
|
style: {
|
|
121
91
|
[CollapsiblePanelCssVars.collapsiblePanelHeight]: height === undefined ? 'auto' : `${height}px`,
|
|
122
92
|
[CollapsiblePanelCssVars.collapsiblePanelWidth]: width === undefined ? 'auto' : `${width}px`
|
|
123
93
|
}
|
|
124
|
-
}, elementProps
|
|
94
|
+
}, elementProps, resolvedStyle ? {
|
|
95
|
+
style: resolvedStyle
|
|
96
|
+
} : undefined,
|
|
97
|
+
// Resolve the public `style` prop so temporary `animationName: 'none'`
|
|
98
|
+
// can still win after user's inline styles have been merged.
|
|
99
|
+
shouldPreventOpenAnimation ? {
|
|
100
|
+
style: {
|
|
101
|
+
animationName: 'none'
|
|
102
|
+
}
|
|
103
|
+
} : undefined],
|
|
125
104
|
stateAttributesMapping: collapsibleStateAttributesMapping
|
|
126
105
|
});
|
|
127
|
-
const shouldRender = keepMounted || hiddenUntilFound || mounted;
|
|
128
106
|
if (!shouldRender) {
|
|
129
107
|
return null;
|
|
130
108
|
}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { HTMLProps } from "../../internals/types.js";
|
|
3
|
-
import type { AnimationType, Dimensions } from "../root/useCollapsibleRoot.js";
|
|
4
3
|
import type { CollapsibleRoot } from "../root/CollapsibleRoot.js";
|
|
4
|
+
import type { TransitionStatus } from "../../internals/useTransitionStatus.js";
|
|
5
5
|
export declare function useCollapsiblePanel(parameters: UseCollapsiblePanelParameters): UseCollapsiblePanelReturnValue;
|
|
6
6
|
export interface UseCollapsiblePanelParameters {
|
|
7
|
-
abortControllerRef: React.RefObject<AbortController | null>;
|
|
8
|
-
animationTypeRef: React.RefObject<AnimationType>;
|
|
9
7
|
externalRef: React.ForwardedRef<HTMLDivElement>;
|
|
10
|
-
/**
|
|
11
|
-
* The height of the panel.
|
|
12
|
-
*/
|
|
13
|
-
height: number | undefined;
|
|
14
8
|
/**
|
|
15
9
|
* Allows the browser's built-in page search to find and expand the panel contents.
|
|
16
10
|
*
|
|
@@ -38,24 +32,16 @@ export interface UseCollapsiblePanelParameters {
|
|
|
38
32
|
* Whether the collapsible panel is currently open.
|
|
39
33
|
*/
|
|
40
34
|
open: boolean;
|
|
41
|
-
panelRef: React.RefObject<HTMLElement | null>;
|
|
42
|
-
runOnceAnimationsFinish: (fnToExecute: () => void, signal?: AbortSignal | null) => void;
|
|
43
|
-
setDimensions: React.Dispatch<React.SetStateAction<Dimensions>>;
|
|
44
35
|
setMounted: (nextMounted: boolean) => void;
|
|
45
36
|
setOpen: (nextOpen: boolean) => void;
|
|
46
|
-
|
|
47
|
-
transitionDimensionRef: React.RefObject<'height' | 'width' | null>;
|
|
48
|
-
/**
|
|
49
|
-
* The visible state of the panel used to determine the `[hidden]` attribute
|
|
50
|
-
* only when CSS keyframe animations are used.
|
|
51
|
-
*/
|
|
52
|
-
visible: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* The width of the panel.
|
|
55
|
-
*/
|
|
56
|
-
width: number | undefined;
|
|
37
|
+
transitionStatus: TransitionStatus;
|
|
57
38
|
}
|
|
58
39
|
export interface UseCollapsiblePanelReturnValue {
|
|
40
|
+
height: number | undefined;
|
|
59
41
|
props: HTMLProps;
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
ref: React.Ref<HTMLDivElement>;
|
|
43
|
+
shouldPreventOpenAnimation: boolean;
|
|
44
|
+
shouldRender: boolean;
|
|
45
|
+
transitionStatus: TransitionStatus;
|
|
46
|
+
width: number | undefined;
|
|
47
|
+
}
|