@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
|
@@ -72,11 +72,11 @@ function resolveTouchAction(direction) {
|
|
|
72
72
|
*/
|
|
73
73
|
const DrawerSwipeArea = exports.DrawerSwipeArea = /*#__PURE__*/React.forwardRef(function DrawerSwipeArea(componentProps, forwardedRef) {
|
|
74
74
|
const {
|
|
75
|
-
className,
|
|
76
75
|
render,
|
|
76
|
+
className,
|
|
77
|
+
style,
|
|
77
78
|
disabled = false,
|
|
78
79
|
swipeDirection: swipeDirectionProp,
|
|
79
|
-
style,
|
|
80
80
|
...elementProps
|
|
81
81
|
} = componentProps;
|
|
82
82
|
const {
|
|
@@ -102,13 +102,13 @@ const DrawerSwipeArea = exports.DrawerSwipeArea = /*#__PURE__*/React.forwardRef(
|
|
|
102
102
|
const swipeAreaId = (0, _useBaseUiId.useBaseUiId)(componentProps.id);
|
|
103
103
|
const registerTrigger = (0, _popups.useTriggerRegistration)(swipeAreaId, store);
|
|
104
104
|
const open = store.useState('open');
|
|
105
|
-
const resolvedSwipeDirection = swipeDirectionProp ?? oppositeSwipeDirection[swipeDirection];
|
|
106
|
-
const dismissDirection = oppositeSwipeDirection[resolvedSwipeDirection];
|
|
107
|
-
const enabled = !disabled && (!open || swipeActive);
|
|
108
105
|
const resetDragDelta = (0, _useStableCallback.useStableCallback)(() => {
|
|
109
106
|
dragDeltaRef.current.x = 0;
|
|
110
107
|
dragDeltaRef.current.y = 0;
|
|
111
108
|
});
|
|
109
|
+
const resolvedSwipeDirection = swipeDirectionProp ?? oppositeSwipeDirection[swipeDirection];
|
|
110
|
+
const dismissDirection = oppositeSwipeDirection[resolvedSwipeDirection];
|
|
111
|
+
const enabled = !disabled && (!open || swipeActive);
|
|
112
112
|
function disableDismissForSwipe() {
|
|
113
113
|
releaseDismissTimeout.clear();
|
|
114
114
|
store.context.outsidePressEnabledRef.current = false;
|
|
@@ -361,6 +361,7 @@ const DrawerSwipeArea = exports.DrawerSwipeArea = /*#__PURE__*/React.forwardRef(
|
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
363
|
swipePointerProps.onPointerDown?.(event);
|
|
364
|
+
|
|
364
365
|
// Prevent native text selection/drag gestures from competing with swipe-open dragging.
|
|
365
366
|
if (event.cancelable) {
|
|
366
367
|
event.preventDefault();
|
|
@@ -54,8 +54,8 @@ const DRAWER_CONTENT_SELECTOR = `[${_DrawerContentDataAttributes.DRAWER_CONTENT_
|
|
|
54
54
|
*/
|
|
55
55
|
const DrawerViewport = exports.DrawerViewport = /*#__PURE__*/React.forwardRef(function DrawerViewport(props, forwardedRef) {
|
|
56
56
|
const {
|
|
57
|
-
className,
|
|
58
57
|
render,
|
|
58
|
+
className,
|
|
59
59
|
style,
|
|
60
60
|
children,
|
|
61
61
|
...elementProps
|
|
@@ -71,25 +71,25 @@ const DrawerViewport = exports.DrawerViewport = /*#__PURE__*/React.forwardRef(fu
|
|
|
71
71
|
snapToSequentialPoints
|
|
72
72
|
} = (0, _DrawerRootContext.useDrawerRootContext)();
|
|
73
73
|
const providerContext = (0, _DrawerProviderContext.useDrawerProviderContext)(true);
|
|
74
|
-
const
|
|
74
|
+
const {
|
|
75
|
+
snapPoints,
|
|
76
|
+
resolvedSnapPoints,
|
|
77
|
+
activeSnapPoint,
|
|
78
|
+
activeSnapPointOffset,
|
|
79
|
+
setActiveSnapPoint,
|
|
80
|
+
popupHeight
|
|
81
|
+
} = (0, _useDrawerSnapPoints.useDrawerSnapPoints)();
|
|
75
82
|
const open = store.useState('open');
|
|
76
83
|
const mounted = store.useState('mounted');
|
|
77
84
|
const nested = store.useState('nested');
|
|
78
85
|
const nestedOpenDrawerCount = store.useState('nestedOpenDrawerCount');
|
|
79
86
|
const viewportElement = store.useState('viewportElement');
|
|
80
87
|
const popupElementState = store.useState('popupElement');
|
|
88
|
+
const visualStateStore = providerContext?.visualStateStore;
|
|
81
89
|
const nestedDrawerOpen = nestedOpenDrawerCount > 0;
|
|
82
90
|
const scrollAxis = swipeDirection === 'left' || swipeDirection === 'right' ? 'horizontal' : 'vertical';
|
|
83
91
|
const isVerticalScrollAxis = scrollAxis === 'vertical';
|
|
84
92
|
const crossScrollAxis = isVerticalScrollAxis ? 'horizontal' : 'vertical';
|
|
85
|
-
const {
|
|
86
|
-
snapPoints,
|
|
87
|
-
resolvedSnapPoints,
|
|
88
|
-
activeSnapPoint,
|
|
89
|
-
activeSnapPointOffset,
|
|
90
|
-
setActiveSnapPoint,
|
|
91
|
-
popupHeight
|
|
92
|
-
} = (0, _useDrawerSnapPoints.useDrawerSnapPoints)();
|
|
93
93
|
const [swipeRelease, setSwipeRelease] = React.useState(null);
|
|
94
94
|
const pendingSwipeCloseSnapPointRef = React.useRef(undefined);
|
|
95
95
|
const resetSwipeRef = React.useRef(null);
|
|
@@ -702,10 +702,8 @@ const DrawerViewport = exports.DrawerViewport = /*#__PURE__*/React.forwardRef(fu
|
|
|
702
702
|
swiping: swipe.swiping,
|
|
703
703
|
getDragStyles: swipe.getDragStyles,
|
|
704
704
|
swipeStrength: swipeRelease ?? null,
|
|
705
|
-
setSwipeDismissed
|
|
706
|
-
|
|
707
|
-
}
|
|
708
|
-
}), [store, swipe.getDragStyles, swipe.swiping, swipeRelease]);
|
|
705
|
+
setSwipeDismissed
|
|
706
|
+
}), [setSwipeDismissed, swipe.getDragStyles, swipe.swiping, swipeRelease]);
|
|
709
707
|
function resetTouchTrackingState() {
|
|
710
708
|
ignoreTouchSwipeRef.current = false;
|
|
711
709
|
touchScrollStateRef.current = null;
|
|
@@ -715,6 +713,7 @@ const DrawerViewport = exports.DrawerViewport = /*#__PURE__*/React.forwardRef(fu
|
|
|
715
713
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogViewport.DialogViewport, {
|
|
716
714
|
ref: forwardedRef,
|
|
717
715
|
className: className,
|
|
716
|
+
style: style,
|
|
718
717
|
render: render,
|
|
719
718
|
...(0, _mergeProps.mergeProps)(elementProps, {
|
|
720
719
|
onPointerDown(event) {
|
|
@@ -12,6 +12,10 @@ import { REASONS } from "../../internals/reasons.js";
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
14
|
export interface AccordionItemState extends AccordionRootState {
|
|
15
|
+
/**
|
|
16
|
+
* Whether the accordion item's panel is currently hidden.
|
|
17
|
+
*/
|
|
18
|
+
hidden: boolean;
|
|
15
19
|
/**
|
|
16
20
|
* The item index.
|
|
17
21
|
*/
|
|
@@ -68,9 +68,8 @@ export const AccordionItem = /*#__PURE__*/React.forwardRef(function AccordionIte
|
|
|
68
68
|
const collapsibleState = React.useMemo(() => ({
|
|
69
69
|
open: collapsible.open,
|
|
70
70
|
disabled: collapsible.disabled,
|
|
71
|
-
hidden: !collapsible.mounted,
|
|
72
71
|
transitionStatus: collapsible.transitionStatus
|
|
73
|
-
}), [collapsible.open, collapsible.disabled, collapsible.
|
|
72
|
+
}), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]);
|
|
74
73
|
const collapsibleContext = React.useMemo(() => ({
|
|
75
74
|
...collapsible,
|
|
76
75
|
onOpenChange,
|
|
@@ -78,11 +77,13 @@ export const AccordionItem = /*#__PURE__*/React.forwardRef(function AccordionIte
|
|
|
78
77
|
}), [collapsible, collapsibleState, onOpenChange]);
|
|
79
78
|
const state = React.useMemo(() => ({
|
|
80
79
|
...rootState,
|
|
80
|
+
hidden: !isOpen && !collapsible.mounted,
|
|
81
81
|
index,
|
|
82
82
|
disabled,
|
|
83
83
|
open: isOpen
|
|
84
|
-
}), [disabled, index, isOpen, rootState]);
|
|
85
|
-
const
|
|
84
|
+
}), [collapsible.mounted, disabled, index, isOpen, rootState]);
|
|
85
|
+
const defaultTriggerId = useBaseUiId();
|
|
86
|
+
const [triggerId, setTriggerId] = React.useState(defaultTriggerId);
|
|
86
87
|
const accordionItemContext = React.useMemo(() => ({
|
|
87
88
|
open: isOpen,
|
|
88
89
|
state,
|
|
@@ -3,13 +3,13 @@
|
|
|
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 { useCollapsibleRootContext } from "../../collapsible/root/CollapsibleRootContext.js";
|
|
7
8
|
import { useCollapsiblePanel } from "../../collapsible/panel/useCollapsiblePanel.js";
|
|
8
9
|
import { useAccordionRootContext } from "../root/AccordionRootContext.js";
|
|
9
10
|
import { useAccordionItemContext } from "../item/AccordionItemContext.js";
|
|
10
11
|
import { accordionStateAttributesMapping } from "../item/stateAttributesMapping.js";
|
|
11
12
|
import { AccordionPanelCssVars } from "./AccordionPanelCssVars.js";
|
|
12
|
-
import { useOpenChangeComplete } from "../../internals/useOpenChangeComplete.js";
|
|
13
13
|
import { useRenderElement } from "../../internals/useRenderElement.js";
|
|
14
14
|
/**
|
|
15
15
|
* A collapsible panel with the accordion item contents.
|
|
@@ -32,24 +32,12 @@ export const AccordionPanel = /*#__PURE__*/React.forwardRef(function AccordionPa
|
|
|
32
32
|
keepMounted: contextKeepMounted
|
|
33
33
|
} = useAccordionRootContext();
|
|
34
34
|
const {
|
|
35
|
-
abortControllerRef,
|
|
36
|
-
animationTypeRef,
|
|
37
|
-
height,
|
|
38
35
|
mounted,
|
|
39
36
|
onOpenChange,
|
|
40
37
|
open,
|
|
41
38
|
panelId,
|
|
42
|
-
panelRef,
|
|
43
|
-
runOnceAnimationsFinish,
|
|
44
|
-
setDimensions,
|
|
45
|
-
setHiddenUntilFound,
|
|
46
|
-
setKeepMounted,
|
|
47
39
|
setMounted,
|
|
48
40
|
setOpen,
|
|
49
|
-
setVisible,
|
|
50
|
-
transitionDimensionRef,
|
|
51
|
-
visible,
|
|
52
|
-
width,
|
|
53
41
|
setPanelIdState,
|
|
54
42
|
transitionStatus
|
|
55
43
|
} = useCollapsibleRootContext();
|
|
@@ -59,7 +47,7 @@ export const AccordionPanel = /*#__PURE__*/React.forwardRef(function AccordionPa
|
|
|
59
47
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
60
48
|
useIsoLayoutEffect(() => {
|
|
61
49
|
if (keepMountedProp === false && hiddenUntilFound) {
|
|
62
|
-
warn('The `keepMounted={false}` prop on
|
|
50
|
+
warn('The `keepMounted={false}` prop on an `Accordion.Panel` is ignored when `hiddenUntilFound` is enabled on the panel or root, since the panel must remain mounted while closed.');
|
|
63
51
|
}
|
|
64
52
|
}, [hiddenUntilFound, keepMountedProp]);
|
|
65
53
|
}
|
|
@@ -72,59 +60,41 @@ export const AccordionPanel = /*#__PURE__*/React.forwardRef(function AccordionPa
|
|
|
72
60
|
}
|
|
73
61
|
return undefined;
|
|
74
62
|
}, [idProp, setPanelIdState]);
|
|
75
|
-
useIsoLayoutEffect(() => {
|
|
76
|
-
setHiddenUntilFound(hiddenUntilFound);
|
|
77
|
-
}, [setHiddenUntilFound, hiddenUntilFound]);
|
|
78
|
-
useIsoLayoutEffect(() => {
|
|
79
|
-
setKeepMounted(keepMounted);
|
|
80
|
-
}, [setKeepMounted, keepMounted]);
|
|
81
|
-
useOpenChangeComplete({
|
|
82
|
-
open: open && transitionStatus === 'idle',
|
|
83
|
-
ref: panelRef,
|
|
84
|
-
onComplete() {
|
|
85
|
-
if (!open) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
setDimensions({
|
|
89
|
-
width: undefined,
|
|
90
|
-
height: undefined
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
63
|
const {
|
|
95
|
-
|
|
64
|
+
height,
|
|
65
|
+
props,
|
|
66
|
+
ref,
|
|
67
|
+
shouldPreventOpenAnimation,
|
|
68
|
+
shouldRender,
|
|
69
|
+
transitionStatus: panelTransitionStatus,
|
|
70
|
+
width
|
|
96
71
|
} = useCollapsiblePanel({
|
|
97
|
-
abortControllerRef,
|
|
98
|
-
animationTypeRef,
|
|
99
72
|
externalRef: forwardedRef,
|
|
100
|
-
height,
|
|
101
73
|
hiddenUntilFound,
|
|
102
74
|
id: idProp ?? panelId,
|
|
103
75
|
keepMounted,
|
|
104
76
|
mounted,
|
|
105
77
|
onOpenChange,
|
|
106
78
|
open,
|
|
107
|
-
panelRef,
|
|
108
|
-
runOnceAnimationsFinish,
|
|
109
|
-
setDimensions,
|
|
110
79
|
setMounted,
|
|
111
80
|
setOpen,
|
|
112
|
-
|
|
113
|
-
transitionDimensionRef,
|
|
114
|
-
visible,
|
|
115
|
-
width
|
|
81
|
+
transitionStatus
|
|
116
82
|
});
|
|
117
83
|
const {
|
|
118
84
|
state,
|
|
119
85
|
triggerId
|
|
120
86
|
} = useAccordionItemContext();
|
|
121
|
-
const panelState =
|
|
87
|
+
const panelState = {
|
|
122
88
|
...state,
|
|
123
|
-
transitionStatus
|
|
124
|
-
}
|
|
125
|
-
const
|
|
89
|
+
transitionStatus: panelTransitionStatus
|
|
90
|
+
};
|
|
91
|
+
const resolvedStyle = resolveStyle(style, panelState);
|
|
92
|
+
const element = useRenderElement('div', {
|
|
93
|
+
...componentProps,
|
|
94
|
+
style: undefined
|
|
95
|
+
}, {
|
|
126
96
|
state: panelState,
|
|
127
|
-
ref
|
|
97
|
+
ref,
|
|
128
98
|
props: [props, {
|
|
129
99
|
'aria-labelledby': triggerId,
|
|
130
100
|
role: 'region',
|
|
@@ -132,10 +102,18 @@ export const AccordionPanel = /*#__PURE__*/React.forwardRef(function AccordionPa
|
|
|
132
102
|
[AccordionPanelCssVars.accordionPanelHeight]: height === undefined ? 'auto' : `${height}px`,
|
|
133
103
|
[AccordionPanelCssVars.accordionPanelWidth]: width === undefined ? 'auto' : `${width}px`
|
|
134
104
|
}
|
|
135
|
-
}, elementProps
|
|
105
|
+
}, elementProps, resolvedStyle ? {
|
|
106
|
+
style: resolvedStyle
|
|
107
|
+
} : undefined,
|
|
108
|
+
// Resolve the public `style` prop so temporary `animationName: 'none'`
|
|
109
|
+
// can still win after user's inline styles have been merged.
|
|
110
|
+
shouldPreventOpenAnimation ? {
|
|
111
|
+
style: {
|
|
112
|
+
animationName: 'none'
|
|
113
|
+
}
|
|
114
|
+
} : undefined],
|
|
136
115
|
stateAttributesMapping: accordionStateAttributesMapping
|
|
137
116
|
});
|
|
138
|
-
const shouldRender = keepMounted || hiddenUntilFound || mounted;
|
|
139
117
|
if (!shouldRender) {
|
|
140
118
|
return null;
|
|
141
119
|
}
|
|
@@ -30,7 +30,7 @@ export const AccordionRoot = /*#__PURE__*/React.forwardRef(function AccordionRoo
|
|
|
30
30
|
hiddenUntilFound: hiddenUntilFoundProp,
|
|
31
31
|
keepMounted: keepMountedProp,
|
|
32
32
|
loopFocus = true,
|
|
33
|
-
onValueChange
|
|
33
|
+
onValueChange,
|
|
34
34
|
multiple = false,
|
|
35
35
|
orientation = 'vertical',
|
|
36
36
|
value: valueProp,
|
|
@@ -43,7 +43,7 @@ export const AccordionRoot = /*#__PURE__*/React.forwardRef(function AccordionRoo
|
|
|
43
43
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
44
44
|
useIsoLayoutEffect(() => {
|
|
45
45
|
if (hiddenUntilFoundProp && keepMountedProp === false) {
|
|
46
|
-
warn('The `keepMounted={false}` prop on
|
|
46
|
+
warn('The `keepMounted={false}` prop on `Accordion.Root` is ignored when `hiddenUntilFound` is enabled, since panels must remain mounted while closed.');
|
|
47
47
|
}
|
|
48
48
|
}, [hiddenUntilFoundProp, keepMountedProp]);
|
|
49
49
|
}
|
|
@@ -56,7 +56,6 @@ export const AccordionRoot = /*#__PURE__*/React.forwardRef(function AccordionRoo
|
|
|
56
56
|
}
|
|
57
57
|
return undefined;
|
|
58
58
|
}, [valueProp, defaultValueProp]);
|
|
59
|
-
const onValueChange = useStableCallback(onValueChangeProp);
|
|
60
59
|
const accordionItemRefs = React.useRef([]);
|
|
61
60
|
const [value, setValue] = useControlled({
|
|
62
61
|
controlled: valueProp,
|
|
@@ -68,7 +67,7 @@ export const AccordionRoot = /*#__PURE__*/React.forwardRef(function AccordionRoo
|
|
|
68
67
|
const details = createChangeEventDetails(REASONS.none);
|
|
69
68
|
if (!multiple) {
|
|
70
69
|
const nextValue = value[0] === newValue ? [] : [newValue];
|
|
71
|
-
onValueChange(nextValue, details);
|
|
70
|
+
onValueChange?.(nextValue, details);
|
|
72
71
|
if (details.isCanceled) {
|
|
73
72
|
return;
|
|
74
73
|
}
|
|
@@ -76,14 +75,14 @@ export const AccordionRoot = /*#__PURE__*/React.forwardRef(function AccordionRoo
|
|
|
76
75
|
} else if (nextOpen) {
|
|
77
76
|
const nextOpenValues = value.slice();
|
|
78
77
|
nextOpenValues.push(newValue);
|
|
79
|
-
onValueChange(nextOpenValues, details);
|
|
78
|
+
onValueChange?.(nextOpenValues, details);
|
|
80
79
|
if (details.isCanceled) {
|
|
81
80
|
return;
|
|
82
81
|
}
|
|
83
82
|
setValue(nextOpenValues);
|
|
84
83
|
} else {
|
|
85
84
|
const nextOpenValues = value.filter(v => v !== newValue);
|
|
86
|
-
onValueChange(nextOpenValues, details);
|
|
85
|
+
onValueChange?.(nextOpenValues, details);
|
|
87
86
|
if (details.isCanceled) {
|
|
88
87
|
return;
|
|
89
88
|
}
|
|
@@ -6,11 +6,10 @@ import { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';
|
|
|
6
6
|
import { triggerOpenStateMapping } from "../../utils/collapsibleOpenStateMapping.js";
|
|
7
7
|
import { useButton } from "../../internals/use-button/index.js";
|
|
8
8
|
import { useCollapsibleRootContext } from "../../collapsible/root/CollapsibleRootContext.js";
|
|
9
|
-
import { ARROW_DOWN, ARROW_UP, ARROW_RIGHT, ARROW_LEFT,
|
|
9
|
+
import { ARROW_DOWN, ARROW_UP, ARROW_RIGHT, ARROW_LEFT, COMPOSITE_KEYS, stopEvent } from "../../internals/composite/composite.js";
|
|
10
10
|
import { useAccordionRootContext } from "../root/AccordionRootContext.js";
|
|
11
11
|
import { useAccordionItemContext } from "../item/AccordionItemContext.js";
|
|
12
12
|
import { useRenderElement } from "../../internals/useRenderElement.js";
|
|
13
|
-
const SUPPORTED_KEYS = new Set([ARROW_DOWN, ARROW_UP, ARROW_RIGHT, ARROW_LEFT, HOME, END]);
|
|
14
13
|
function getActiveTriggers(accordionItemRefs) {
|
|
15
14
|
const {
|
|
16
15
|
current: accordionItemElements
|
|
@@ -82,14 +81,14 @@ export const AccordionTrigger = /*#__PURE__*/React.forwardRef(function Accordion
|
|
|
82
81
|
setTriggerId(undefined);
|
|
83
82
|
};
|
|
84
83
|
}, [idProp, setTriggerId]);
|
|
85
|
-
const props =
|
|
84
|
+
const props = {
|
|
86
85
|
'aria-controls': open ? panelId : undefined,
|
|
87
86
|
'aria-expanded': open,
|
|
88
87
|
id,
|
|
89
88
|
tabIndex: 0,
|
|
90
89
|
onClick: handleTrigger,
|
|
91
90
|
onKeyDown(event) {
|
|
92
|
-
if (!
|
|
91
|
+
if (!COMPOSITE_KEYS.has(event.key)) {
|
|
93
92
|
return;
|
|
94
93
|
}
|
|
95
94
|
stopEvent(event);
|
|
@@ -154,7 +153,7 @@ export const AccordionTrigger = /*#__PURE__*/React.forwardRef(function Accordion
|
|
|
154
153
|
triggers[nextIndex].focus();
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
|
-
}
|
|
156
|
+
};
|
|
158
157
|
const element = useRenderElement('button', componentProps, {
|
|
159
158
|
state,
|
|
160
159
|
ref: [forwardedRef, buttonRef],
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
import { DialogHandle } from "../dialog/store/DialogHandle.js";
|
|
2
|
-
|
|
2
|
+
import { DialogStore } from "../dialog/store/DialogStore.js";
|
|
3
|
+
export declare const alertDialogState: {
|
|
4
|
+
readonly modal: true;
|
|
5
|
+
readonly disablePointerDismissal: true;
|
|
6
|
+
readonly role: "alertdialog";
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A handle to control an Alert Dialog imperatively and to associate detached triggers with it.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AlertDialogHandle<Payload> extends DialogHandle<Payload> {
|
|
12
|
+
private readonly __alertDialogBrand;
|
|
13
|
+
constructor(store?: DialogStore<Payload>);
|
|
14
|
+
}
|
|
15
|
+
export declare function createAlertDialogHandle<Payload>(): AlertDialogHandle<Payload>;
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { DialogHandle } from "../dialog/store/DialogHandle.js";
|
|
2
2
|
import { DialogStore } from "../dialog/store/DialogStore.js";
|
|
3
|
+
export const alertDialogState = {
|
|
4
|
+
modal: true,
|
|
5
|
+
disablePointerDismissal: true,
|
|
6
|
+
role: 'alertdialog'
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A handle to control an Alert Dialog imperatively and to associate detached triggers with it.
|
|
11
|
+
*/
|
|
12
|
+
export class AlertDialogHandle extends DialogHandle {
|
|
13
|
+
constructor(store) {
|
|
14
|
+
const alertDialogStore = store ?? new DialogStore(alertDialogState);
|
|
15
|
+
super(alertDialogStore);
|
|
16
|
+
if (store) {
|
|
17
|
+
// Supplied stores may have been created as plain dialogs; enforce alert-dialog state.
|
|
18
|
+
this.store.update(alertDialogState);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
3
22
|
export function createAlertDialogHandle() {
|
|
4
|
-
return new
|
|
5
|
-
modal: true,
|
|
6
|
-
disablePointerDismissal: true,
|
|
7
|
-
role: 'alertdialog'
|
|
8
|
-
}));
|
|
23
|
+
return new AlertDialogHandle();
|
|
9
24
|
}
|
|
@@ -6,5 +6,5 @@ export type { DialogDescriptionProps as AlertDialogDescriptionProps, DialogDescr
|
|
|
6
6
|
export type { DialogPopupProps as AlertDialogPopupProps, DialogPopupState as AlertDialogPopupState } from "../dialog/popup/DialogPopup.js";
|
|
7
7
|
export type { DialogPortalProps as AlertDialogPortalProps, DialogPortalState as AlertDialogPortalState } from "../dialog/portal/DialogPortal.js";
|
|
8
8
|
export type { DialogTitleProps as AlertDialogTitleProps, DialogTitleState as AlertDialogTitleState } from "../dialog/title/DialogTitle.js";
|
|
9
|
-
export type
|
|
9
|
+
export type * from "./trigger/AlertDialogTrigger.js";
|
|
10
10
|
export type { DialogViewportProps as AlertDialogViewportProps, DialogViewportState as AlertDialogViewportState } from "../dialog/viewport/DialogViewport.js";
|
|
@@ -5,7 +5,6 @@ export { DialogDescription as Description } from "../dialog/description/DialogDe
|
|
|
5
5
|
export { DialogPopup as Popup } from "../dialog/popup/DialogPopup.js";
|
|
6
6
|
export { DialogPortal as Portal } from "../dialog/portal/DialogPortal.js";
|
|
7
7
|
export { DialogTitle as Title } from "../dialog/title/DialogTitle.js";
|
|
8
|
-
export {
|
|
8
|
+
export { AlertDialogTrigger as Trigger } from "./trigger/AlertDialogTrigger.js";
|
|
9
9
|
export { DialogViewport as Viewport } from "../dialog/viewport/DialogViewport.js";
|
|
10
|
-
export { createAlertDialogHandle as createHandle } from "./handle.js";
|
|
11
|
-
export { DialogHandle as Handle } from "../dialog/store/DialogHandle.js";
|
|
10
|
+
export { AlertDialogHandle as Handle, createAlertDialogHandle as createHandle } from "./handle.js";
|
|
@@ -5,7 +5,6 @@ export { DialogDescription as Description } from "../dialog/description/DialogDe
|
|
|
5
5
|
export { DialogPopup as Popup } from "../dialog/popup/DialogPopup.js";
|
|
6
6
|
export { DialogPortal as Portal } from "../dialog/portal/DialogPortal.js";
|
|
7
7
|
export { DialogTitle as Title } from "../dialog/title/DialogTitle.js";
|
|
8
|
-
export {
|
|
8
|
+
export { AlertDialogTrigger as Trigger } from "./trigger/AlertDialogTrigger.js";
|
|
9
9
|
export { DialogViewport as Viewport } from "../dialog/viewport/DialogViewport.js";
|
|
10
|
-
export { createAlertDialogHandle as createHandle } from "./handle.js";
|
|
11
|
-
export { DialogHandle as Handle } from "../dialog/store/DialogHandle.js";
|
|
10
|
+
export { AlertDialogHandle as Handle, createAlertDialogHandle as createHandle } from "./handle.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BaseUIChangeEventDetails } from "../../internals/createBaseUIEventDetails.js";
|
|
3
|
-
import { DialogHandle } from "../../dialog/store/DialogHandle.js";
|
|
4
3
|
import type { DialogRoot } from "../../dialog/root/DialogRoot.js";
|
|
4
|
+
import type { AlertDialogHandle } from "../handle.js";
|
|
5
5
|
/**
|
|
6
6
|
* Groups all parts of the alert dialog.
|
|
7
7
|
* Doesn't render its own HTML element.
|
|
@@ -12,15 +12,15 @@ export declare function AlertDialogRoot<Payload>(props: AlertDialogRoot.Props<Pa
|
|
|
12
12
|
export interface AlertDialogRootState {}
|
|
13
13
|
export interface AlertDialogRootProps<Payload = unknown> extends Omit<DialogRoot.Props<Payload>, 'modal' | 'disablePointerDismissal' | 'onOpenChange' | 'actionsRef' | 'handle'> {
|
|
14
14
|
/**
|
|
15
|
-
* Event handler called when the dialog is opened or closed.
|
|
15
|
+
* Event handler called when the alert dialog is opened or closed.
|
|
16
16
|
*/
|
|
17
17
|
onOpenChange?: ((open: boolean, eventDetails: AlertDialogRoot.ChangeEventDetails) => void) | undefined;
|
|
18
18
|
/**
|
|
19
19
|
* A ref to imperative actions.
|
|
20
|
-
* - `unmount`: When specified, the dialog will not be unmounted when closed.
|
|
21
|
-
* Instead, the `unmount` function must be called to unmount the dialog manually.
|
|
22
|
-
* Useful when the dialog's animation is controlled by an external library.
|
|
23
|
-
* - `close`: Closes the dialog imperatively when called.
|
|
20
|
+
* - `unmount`: When specified, the alert dialog will not be unmounted when closed.
|
|
21
|
+
* Instead, the `unmount` function must be called to unmount the alert dialog manually.
|
|
22
|
+
* Useful when the alert dialog's animation is controlled by an external library.
|
|
23
|
+
* - `close`: Closes the alert dialog imperatively when called.
|
|
24
24
|
*/
|
|
25
25
|
actionsRef?: React.RefObject<AlertDialogRoot.Actions | null> | undefined;
|
|
26
26
|
/**
|
|
@@ -28,7 +28,7 @@ export interface AlertDialogRootProps<Payload = unknown> extends Omit<DialogRoot
|
|
|
28
28
|
* If specified, allows external triggers to control the alert dialog's open state.
|
|
29
29
|
* Can be created with the AlertDialog.createHandle() method.
|
|
30
30
|
*/
|
|
31
|
-
handle?:
|
|
31
|
+
handle?: AlertDialogHandle<Payload> | undefined;
|
|
32
32
|
}
|
|
33
33
|
export type AlertDialogRootActions = DialogRoot.Actions;
|
|
34
34
|
export type AlertDialogRootChangeEventReason = DialogRoot.ChangeEventReason;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { IsDrawerContext } from "../../dialog/root/DialogRoot.js";
|
|
5
|
-
import { useDialogRoot } from "../../dialog/root/useDialogRoot.js";
|
|
6
|
-
import { DialogRootContext, useDialogRootContext } from "../../dialog/root/DialogRootContext.js";
|
|
7
|
-
import { DialogStore } from "../../dialog/store/DialogStore.js";
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRenderDialogRoot } from "../../dialog/root/useRenderDialogRoot.js";
|
|
9
4
|
/**
|
|
10
5
|
* Groups all parts of the alert dialog.
|
|
11
6
|
* Doesn't render its own HTML element.
|
|
@@ -13,53 +8,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
8
|
* Documentation: [Base UI Alert Dialog](https://base-ui.com/react/components/alert-dialog)
|
|
14
9
|
*/
|
|
15
10
|
export function AlertDialogRoot(props) {
|
|
16
|
-
|
|
17
|
-
children,
|
|
18
|
-
open: openProp,
|
|
19
|
-
defaultOpen = false,
|
|
20
|
-
onOpenChange,
|
|
21
|
-
onOpenChangeComplete,
|
|
22
|
-
actionsRef,
|
|
23
|
-
handle,
|
|
24
|
-
triggerId: triggerIdProp,
|
|
25
|
-
defaultTriggerId: defaultTriggerIdProp = null
|
|
26
|
-
} = props;
|
|
27
|
-
const parentDialogRootContext = useDialogRootContext(true);
|
|
28
|
-
const nested = Boolean(parentDialogRootContext);
|
|
29
|
-
const store = DialogStore.useStore(handle?.store, {
|
|
30
|
-
open: defaultOpen,
|
|
31
|
-
openProp,
|
|
32
|
-
activeTriggerId: defaultTriggerIdProp,
|
|
33
|
-
triggerIdProp,
|
|
34
|
-
modal: true,
|
|
35
|
-
disablePointerDismissal: true,
|
|
36
|
-
nested,
|
|
37
|
-
role: 'alertdialog'
|
|
38
|
-
});
|
|
39
|
-
store.useControlledProp('openProp', openProp);
|
|
40
|
-
store.useControlledProp('triggerIdProp', triggerIdProp);
|
|
41
|
-
store.useSyncedValue('nested', nested);
|
|
42
|
-
store.useContextCallback('onOpenChange', onOpenChange);
|
|
43
|
-
store.useContextCallback('onOpenChangeComplete', onOpenChangeComplete);
|
|
44
|
-
const payload = store.useState('payload');
|
|
45
|
-
useDialogRoot({
|
|
46
|
-
store,
|
|
47
|
-
actionsRef,
|
|
48
|
-
parentContext: parentDialogRootContext?.store.context,
|
|
49
|
-
isDrawer: false,
|
|
50
|
-
onOpenChange,
|
|
51
|
-
triggerIdProp
|
|
52
|
-
});
|
|
53
|
-
const contextValue = React.useMemo(() => ({
|
|
54
|
-
store
|
|
55
|
-
}), [store]);
|
|
56
|
-
return /*#__PURE__*/_jsx(IsDrawerContext.Provider, {
|
|
57
|
-
value: false,
|
|
58
|
-
children: /*#__PURE__*/_jsx(DialogRootContext.Provider, {
|
|
59
|
-
value: contextValue,
|
|
60
|
-
children: typeof children === 'function' ? children({
|
|
61
|
-
payload
|
|
62
|
-
}) : children
|
|
63
|
-
})
|
|
64
|
-
});
|
|
11
|
+
return useRenderDialogRoot(props, 'alert-dialog');
|
|
65
12
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { type DialogTriggerProps, type DialogTriggerState } from "../../dialog/trigger/DialogTrigger.js";
|
|
3
|
+
import type { AlertDialogHandle } from "../handle.js";
|
|
4
|
+
/**
|
|
5
|
+
* A button that opens the alert dialog.
|
|
6
|
+
* Renders a `<button>` element.
|
|
7
|
+
*
|
|
8
|
+
* Documentation: [Base UI Alert Dialog](https://base-ui.com/react/components/alert-dialog)
|
|
9
|
+
*/
|
|
10
|
+
export declare const AlertDialogTrigger: AlertDialogTrigger;
|
|
11
|
+
export interface AlertDialogTrigger {
|
|
12
|
+
<Payload>(componentProps: AlertDialogTriggerProps<Payload>): React.JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export interface AlertDialogTriggerProps<Payload = unknown> extends Omit<DialogTriggerProps<Payload>, 'handle'> {
|
|
15
|
+
/**
|
|
16
|
+
* A handle to associate the trigger with an alert dialog.
|
|
17
|
+
* Can be created with the AlertDialog.createHandle() method.
|
|
18
|
+
*/
|
|
19
|
+
handle?: AlertDialogHandle<Payload> | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface AlertDialogTriggerState extends DialogTriggerState {}
|
|
22
|
+
export declare namespace AlertDialogTrigger {
|
|
23
|
+
type Props<Payload = unknown> = AlertDialogTriggerProps<Payload>;
|
|
24
|
+
type State = AlertDialogTriggerState;
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { DialogTrigger } from "../../dialog/trigger/DialogTrigger.js";
|
|
4
|
+
/**
|
|
5
|
+
* A button that opens the alert dialog.
|
|
6
|
+
* Renders a `<button>` element.
|
|
7
|
+
*
|
|
8
|
+
* Documentation: [Base UI Alert Dialog](https://base-ui.com/react/components/alert-dialog)
|
|
9
|
+
*/
|
|
10
|
+
export const AlertDialogTrigger = DialogTrigger;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CommonTriggerDataAttributes } from "../../utils/popupStateMapping.js";
|
|
2
|
+
export let AlertDialogTriggerDataAttributes = function (AlertDialogTriggerDataAttributes) {
|
|
3
|
+
/**
|
|
4
|
+
* Present when the trigger is disabled.
|
|
5
|
+
*/
|
|
6
|
+
AlertDialogTriggerDataAttributes["disabled"] = "data-disabled";
|
|
7
|
+
/**
|
|
8
|
+
* Present when the corresponding alert dialog is open.
|
|
9
|
+
*/
|
|
10
|
+
AlertDialogTriggerDataAttributes[AlertDialogTriggerDataAttributes["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen";
|
|
11
|
+
return AlertDialogTriggerDataAttributes;
|
|
12
|
+
}({});
|