@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
|
@@ -24,8 +24,8 @@ const stateAttributesMapping = {
|
|
|
24
24
|
*/
|
|
25
25
|
const NavigationMenuBackdrop = exports.NavigationMenuBackdrop = /*#__PURE__*/React.forwardRef(function NavigationMenuBackdrop(componentProps, forwardedRef) {
|
|
26
26
|
const {
|
|
27
|
-
className,
|
|
28
27
|
render,
|
|
28
|
+
className,
|
|
29
29
|
style,
|
|
30
30
|
...elementProps
|
|
31
31
|
} = componentProps;
|
|
@@ -9,6 +9,7 @@ exports.NavigationMenuContent = void 0;
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var ReactDOM = _interopRequireWildcard(require("react-dom"));
|
|
11
11
|
var _useIsoLayoutEffect = require("@base-ui/utils/useIsoLayoutEffect");
|
|
12
|
+
var _useStableCallback = require("@base-ui/utils/useStableCallback");
|
|
12
13
|
var _inertValue = require("@base-ui/utils/inertValue");
|
|
13
14
|
var _empty = require("@base-ui/utils/empty");
|
|
14
15
|
var _floatingUiReact = require("../../floating-ui-react");
|
|
@@ -43,10 +44,10 @@ const stateAttributesMapping = {
|
|
|
43
44
|
*/
|
|
44
45
|
const NavigationMenuContent = exports.NavigationMenuContent = /*#__PURE__*/React.forwardRef(function NavigationMenuContent(componentProps, forwardedRef) {
|
|
45
46
|
const {
|
|
46
|
-
className,
|
|
47
47
|
render,
|
|
48
|
-
|
|
48
|
+
className,
|
|
49
49
|
style,
|
|
50
|
+
keepMounted = false,
|
|
50
51
|
...elementProps
|
|
51
52
|
} = componentProps;
|
|
52
53
|
const {
|
|
@@ -100,11 +101,13 @@ const NavigationMenuContent = exports.NavigationMenuContent = /*#__PURE__*/React
|
|
|
100
101
|
transitionStatus,
|
|
101
102
|
activationDirection
|
|
102
103
|
};
|
|
103
|
-
const handleCurrentContentRef =
|
|
104
|
-
|
|
104
|
+
const handleCurrentContentRef = (0, _useStableCallback.useStableCallback)(node => {
|
|
105
|
+
// Inactive `keepMounted` content also mounts in the viewport; only the
|
|
106
|
+
// active content can own the shared sizing observer target.
|
|
107
|
+
if (node && open) {
|
|
105
108
|
currentContentRef.current = node;
|
|
106
109
|
}
|
|
107
|
-
}
|
|
110
|
+
});
|
|
108
111
|
const commonProps = {
|
|
109
112
|
onFocus(event) {
|
|
110
113
|
const target = (0, _utils.getTarget)(event.nativeEvent);
|
|
@@ -18,8 +18,8 @@ var _NavigationMenuItemContext = require("../item/NavigationMenuItemContext");
|
|
|
18
18
|
*/
|
|
19
19
|
const NavigationMenuIcon = exports.NavigationMenuIcon = /*#__PURE__*/React.forwardRef(function NavigationMenuIcon(componentProps, forwardedRef) {
|
|
20
20
|
const {
|
|
21
|
-
className,
|
|
22
21
|
render,
|
|
22
|
+
className,
|
|
23
23
|
style,
|
|
24
24
|
...elementProps
|
|
25
25
|
} = componentProps;
|
|
@@ -19,10 +19,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
19
|
*/
|
|
20
20
|
const NavigationMenuItem = exports.NavigationMenuItem = /*#__PURE__*/React.forwardRef(function NavigationMenuItem(componentProps, forwardedRef) {
|
|
21
21
|
const {
|
|
22
|
-
className,
|
|
23
22
|
render,
|
|
24
|
-
|
|
23
|
+
className,
|
|
25
24
|
style,
|
|
25
|
+
value: valueProp,
|
|
26
26
|
...elementProps
|
|
27
27
|
} = componentProps;
|
|
28
28
|
const fallbackValue = (0, _useBaseUiId.useBaseUiId)();
|
|
@@ -25,8 +25,8 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
25
25
|
*/
|
|
26
26
|
const NavigationMenuList = exports.NavigationMenuList = /*#__PURE__*/React.forwardRef(function NavigationMenuList(componentProps, forwardedRef) {
|
|
27
27
|
const {
|
|
28
|
-
className,
|
|
29
28
|
render,
|
|
29
|
+
className,
|
|
30
30
|
style,
|
|
31
31
|
...elementProps
|
|
32
32
|
} = componentProps;
|
|
@@ -27,10 +27,10 @@ const stateAttributesMapping = {
|
|
|
27
27
|
*/
|
|
28
28
|
const NavigationMenuPopup = exports.NavigationMenuPopup = /*#__PURE__*/React.forwardRef(function NavigationMenuPopup(componentProps, forwardedRef) {
|
|
29
29
|
const {
|
|
30
|
-
className,
|
|
31
30
|
render,
|
|
32
|
-
|
|
31
|
+
className,
|
|
33
32
|
style,
|
|
33
|
+
id: idProp,
|
|
34
34
|
...elementProps
|
|
35
35
|
} = componentProps;
|
|
36
36
|
const {
|
|
@@ -223,9 +223,7 @@ function TreeContext(props) {
|
|
|
223
223
|
const nodeId = (0, _floatingUiReact.useFloatingNodeId)();
|
|
224
224
|
const {
|
|
225
225
|
rootRef,
|
|
226
|
-
nested
|
|
227
|
-
} = (0, _NavigationMenuRootContext.useNavigationMenuRootContext)();
|
|
228
|
-
const {
|
|
226
|
+
nested,
|
|
229
227
|
open
|
|
230
228
|
} = (0, _NavigationMenuRootContext.useNavigationMenuRootContext)();
|
|
231
229
|
const state = {
|
|
@@ -37,6 +37,8 @@ var _constants2 = require("../utils/constants");
|
|
|
37
37
|
var _NavigationMenuDismissContext = require("../list/NavigationMenuDismissContext");
|
|
38
38
|
var _NavigationMenuPopupCssVars = require("../popup/NavigationMenuPopupCssVars");
|
|
39
39
|
var _NavigationMenuPositionerCssVars = require("../positioner/NavigationMenuPositionerCssVars");
|
|
40
|
+
var _mergeProps = require("../../merge-props");
|
|
41
|
+
var _DirectionContext = require("../../internals/direction-context/DirectionContext");
|
|
40
42
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
41
43
|
const DEFAULT_SIZE = {
|
|
42
44
|
width: 0,
|
|
@@ -52,11 +54,11 @@ const DEFAULT_SIZE = {
|
|
|
52
54
|
*/
|
|
53
55
|
const NavigationMenuTrigger = exports.NavigationMenuTrigger = /*#__PURE__*/React.forwardRef(function NavigationMenuTrigger(componentProps, forwardedRef) {
|
|
54
56
|
const {
|
|
55
|
-
className,
|
|
56
57
|
render,
|
|
58
|
+
className,
|
|
59
|
+
style,
|
|
57
60
|
nativeButton = true,
|
|
58
61
|
disabled,
|
|
59
|
-
style,
|
|
60
62
|
...elementProps
|
|
61
63
|
} = componentProps;
|
|
62
64
|
const {
|
|
@@ -90,6 +92,7 @@ const NavigationMenuTrigger = exports.NavigationMenuTrigger = /*#__PURE__*/React
|
|
|
90
92
|
const nodeId = (0, _NavigationMenuRootContext.useNavigationMenuTreeContext)();
|
|
91
93
|
const tree = (0, _floatingUiReact.useFloatingTree)();
|
|
92
94
|
const dismissProps = (0, _NavigationMenuDismissContext.useNavigationMenuDismissContext)();
|
|
95
|
+
const direction = (0, _DirectionContext.useDirection)();
|
|
93
96
|
const stickIfOpenTimeout = (0, _useTimeout.useTimeout)();
|
|
94
97
|
const focusFrame = (0, _useAnimationFrame.useAnimationFrame)();
|
|
95
98
|
const mutationFrame = (0, _useAnimationFrame.useAnimationFrame)();
|
|
@@ -349,7 +352,11 @@ const NavigationMenuTrigger = exports.NavigationMenuTrigger = /*#__PURE__*/React
|
|
|
349
352
|
mutationObserver.observe(observedElement, {
|
|
350
353
|
childList: true,
|
|
351
354
|
subtree: true,
|
|
352
|
-
characterData: true
|
|
355
|
+
characterData: true,
|
|
356
|
+
// `keepMounted` submenu switches update dimensions by toggling hidden
|
|
357
|
+
// content rather than inserting or removing content nodes.
|
|
358
|
+
attributes: true,
|
|
359
|
+
attributeFilter: ['hidden']
|
|
353
360
|
});
|
|
354
361
|
return () => {
|
|
355
362
|
mutationObserver.disconnect();
|
|
@@ -368,14 +375,15 @@ const NavigationMenuTrigger = exports.NavigationMenuTrigger = /*#__PURE__*/React
|
|
|
368
375
|
}, [beforeOutsideRef, focusFrame, isActiveItem, open, popupElement]);
|
|
369
376
|
(0, _useIsoLayoutEffect.useIsoLayoutEffect)(() => {
|
|
370
377
|
if (isActiveItemRef.current && open && popupElement) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
378
|
+
const hasNestedMenu = currentContentRef.current?.querySelector('[data-nested]') != null;
|
|
379
|
+
if (transitionStatus === 'starting' && hasNestedMenu) {
|
|
380
|
+
// Inline nested menus can reveal their default content after the
|
|
381
|
+
// top-level content enters the viewport. Defer once so the opening
|
|
382
|
+
// size is measured from the final nested content, not the shell.
|
|
383
|
+
sizeFrame.request(syncCurrentSize);
|
|
384
|
+
return () => {
|
|
385
|
+
sizeFrame.cancel();
|
|
386
|
+
};
|
|
379
387
|
}
|
|
380
388
|
if (skipAutoSizeSyncRef.current) {
|
|
381
389
|
skipAutoSizeSyncRef.current = false;
|
|
@@ -478,9 +486,7 @@ const NavigationMenuTrigger = exports.NavigationMenuTrigger = /*#__PURE__*/React
|
|
|
478
486
|
stickIfOpen,
|
|
479
487
|
toggle: isActiveItem
|
|
480
488
|
});
|
|
481
|
-
const
|
|
482
|
-
getReferenceProps
|
|
483
|
-
} = (0, _floatingUiReact.useInteractions)([hover, click]);
|
|
489
|
+
const referenceProps = React.useMemo(() => (0, _mergeProps.mergeProps)(click.reference, hover?.reference), [click.reference, hover]);
|
|
484
490
|
(0, _useIsoLayoutEffect.useIsoLayoutEffect)(() => {
|
|
485
491
|
if (isActiveItem) {
|
|
486
492
|
setFloatingRootContext(context);
|
|
@@ -584,8 +590,9 @@ const NavigationMenuTrigger = exports.NavigationMenuTrigger = /*#__PURE__*/React
|
|
|
584
590
|
if (nested) {
|
|
585
591
|
return;
|
|
586
592
|
}
|
|
593
|
+
const verticalOpenKey = direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
587
594
|
const openHorizontal = orientation === 'horizontal' && event.key === 'ArrowDown';
|
|
588
|
-
const openVertical = orientation === 'vertical' && event.key ===
|
|
595
|
+
const openVertical = orientation === 'vertical' && event.key === verticalOpenKey;
|
|
589
596
|
if (openHorizontal || openVertical) {
|
|
590
597
|
setValue(itemValue, (0, _createBaseUIEventDetails.createChangeEventDetails)(_reasons.REASONS.listNavigation, event.nativeEvent));
|
|
591
598
|
handleOpenEvent(event);
|
|
@@ -624,7 +631,7 @@ const NavigationMenuTrigger = exports.NavigationMenuTrigger = /*#__PURE__*/React
|
|
|
624
631
|
state: state,
|
|
625
632
|
stateAttributesMapping: _popupStateMapping.pressableTriggerOpenStateMapping,
|
|
626
633
|
refs: [forwardedRef, handleTriggerElement, buttonRef],
|
|
627
|
-
props: [
|
|
634
|
+
props: [referenceProps, dismissProps?.reference || _empty.EMPTY_ARRAY, defaultProps, elementProps, getButtonProps]
|
|
628
635
|
}), isActiveItem && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
629
636
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusGuard.FocusGuard, {
|
|
630
637
|
ref: beforeOutsideRef,
|
|
@@ -11,7 +11,6 @@ function isOutsideMenuEvent({
|
|
|
11
11
|
}, params) {
|
|
12
12
|
const {
|
|
13
13
|
popupElement,
|
|
14
|
-
viewportElement,
|
|
15
14
|
rootRef,
|
|
16
15
|
tree,
|
|
17
16
|
nodeId
|
|
@@ -23,8 +22,5 @@ function isOutsideMenuEvent({
|
|
|
23
22
|
if (!popupElement) {
|
|
24
23
|
return !(0, _utils.contains)(rootRef.current, relatedTarget) && !nodeChildrenContains;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
// Use popupElement as the primary floating element, but fall back to viewportElement if needed
|
|
28
|
-
const floatingElement = popupElement || viewportElement;
|
|
29
|
-
return !(0, _utils.contains)(floatingElement, currentTarget) && !(0, _utils.contains)(floatingElement, relatedTarget) && !(0, _utils.contains)(rootRef.current, relatedTarget) && !nodeChildrenContains && !((0, _utils.contains)(floatingElement, relatedTarget) && relatedTarget?.hasAttribute('data-base-ui-focus-guard'));
|
|
25
|
+
return !(0, _utils.contains)(popupElement, currentTarget) && !(0, _utils.contains)(popupElement, relatedTarget) && !(0, _utils.contains)(rootRef.current, relatedTarget) && !nodeChildrenContains && !((0, _utils.contains)(popupElement, relatedTarget) && relatedTarget?.hasAttribute('data-base-ui-focus-guard'));
|
|
30
26
|
}
|
|
@@ -64,14 +64,13 @@ function Guards({
|
|
|
64
64
|
*
|
|
65
65
|
* Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)
|
|
66
66
|
*/
|
|
67
|
-
|
|
68
67
|
const NavigationMenuViewport = exports.NavigationMenuViewport = /*#__PURE__*/React.forwardRef(function NavigationMenuViewport(componentProps, forwardedRef) {
|
|
69
68
|
const {
|
|
70
|
-
className,
|
|
71
69
|
render,
|
|
70
|
+
className,
|
|
71
|
+
style,
|
|
72
72
|
children,
|
|
73
73
|
id: idProp,
|
|
74
|
-
style,
|
|
75
74
|
...elementProps
|
|
76
75
|
} = componentProps;
|
|
77
76
|
const id = (0, _useId.useId)(idProp);
|
|
@@ -83,10 +83,7 @@ const NumberFieldInput = exports.NumberFieldInput = /*#__PURE__*/React.forwardRe
|
|
|
83
83
|
} = (0, _LabelableContext.useLabelableContext)();
|
|
84
84
|
const hasTouchedInputRef = React.useRef(false);
|
|
85
85
|
const blockRevalidationRef = React.useRef(false);
|
|
86
|
-
(0, _useRegisterFieldControl.useRegisterFieldControl)(inputRef,
|
|
87
|
-
id,
|
|
88
|
-
value
|
|
89
|
-
});
|
|
86
|
+
(0, _useRegisterFieldControl.useRegisterFieldControl)(inputRef, id, value);
|
|
90
87
|
(0, _useValueChanged.useValueChanged)(value, previousValue => {
|
|
91
88
|
const validateOnChange = shouldValidateOnChange();
|
|
92
89
|
clearErrors(name);
|
|
@@ -260,13 +257,14 @@ const NumberFieldInput = exports.NumberFieldInput = /*#__PURE__*/React.forwardRe
|
|
|
260
257
|
const isAsciiDigit = event.key >= '0' && event.key <= '9';
|
|
261
258
|
const isArabicNumeral = _parse.ARABIC_DETECT_RE.test(event.key);
|
|
262
259
|
const isHanNumeral = _parse.HAN_DETECT_RE.test(event.key);
|
|
260
|
+
const isPersianNumeral = _parse.PERSIAN_DETECT_RE.test(event.key);
|
|
263
261
|
const isFullwidthNumeral = _parse.FULLWIDTH_DETECT_RE.test(event.key);
|
|
264
262
|
const isNavigateKey = NAVIGATE_KEYS.has(event.key);
|
|
265
263
|
if (
|
|
266
264
|
// Allow composition events (e.g., pinyin)
|
|
267
265
|
// event.nativeEvent.isComposing does not work in Safari:
|
|
268
266
|
// https://bugs.webkit.org/show_bug.cgi?id=165004
|
|
269
|
-
event.which === 229 || event.altKey || event.ctrlKey || event.metaKey || isAllowedNonNumericKey || isAsciiDigit || isArabicNumeral || isFullwidthNumeral || isHanNumeral || isNavigateKey) {
|
|
267
|
+
event.which === 229 || event.altKey || event.ctrlKey || event.metaKey || isAllowedNonNumericKey || isAsciiDigit || isArabicNumeral || isFullwidthNumeral || isHanNumeral || isPersianNumeral || isNavigateKey) {
|
|
270
268
|
return;
|
|
271
269
|
}
|
|
272
270
|
|
|
@@ -286,6 +286,7 @@ const NumberFieldRoot = exports.NumberFieldRoot = /*#__PURE__*/React.forwardRef(
|
|
|
286
286
|
|
|
287
287
|
// Prevent the default behavior to avoid scrolling the page.
|
|
288
288
|
event.preventDefault();
|
|
289
|
+
allowInputSyncRef.current = true;
|
|
289
290
|
const amount = getStepAmount(event) ?? _constants.DEFAULT_STEP;
|
|
290
291
|
incrementValue(amount, {
|
|
291
292
|
direction: event.deltaY > 0 ? -1 : 1,
|
|
@@ -294,7 +295,7 @@ const NumberFieldRoot = exports.NumberFieldRoot = /*#__PURE__*/React.forwardRef(
|
|
|
294
295
|
});
|
|
295
296
|
}
|
|
296
297
|
return (0, _addEventListener.addEventListener)(element, 'wheel', handleWheel);
|
|
297
|
-
}, [allowWheelScrub, incrementValue, disabled, readOnly,
|
|
298
|
+
}, [allowWheelScrub, incrementValue, disabled, readOnly, getStepAmount]);
|
|
298
299
|
const state = React.useMemo(() => ({
|
|
299
300
|
...fieldState,
|
|
300
301
|
disabled,
|
|
@@ -350,7 +351,9 @@ const NumberFieldRoot = exports.NumberFieldRoot = /*#__PURE__*/React.forwardRef(
|
|
|
350
351
|
},
|
|
351
352
|
onChange(event) {
|
|
352
353
|
// Workaround for https://github.com/facebook/react/issues/9023
|
|
353
|
-
if (event.nativeEvent.defaultPrevented) {
|
|
354
|
+
if (event.nativeEvent.defaultPrevented || disabled || readOnly) {
|
|
355
|
+
// Outside Field.Root, the event is not wrapped by mergeProps.
|
|
356
|
+
event.preventBaseUIHandler?.();
|
|
354
357
|
return;
|
|
355
358
|
}
|
|
356
359
|
|
|
@@ -48,6 +48,7 @@ const NumberFieldScrubArea = exports.NumberFieldScrubArea = /*#__PURE__*/React.f
|
|
|
48
48
|
readOnly,
|
|
49
49
|
inputRef,
|
|
50
50
|
incrementValue,
|
|
51
|
+
allowInputSyncRef,
|
|
51
52
|
getStepAmount,
|
|
52
53
|
onValueCommitted,
|
|
53
54
|
lastChangedValueRef,
|
|
@@ -146,8 +147,10 @@ const NumberFieldScrubArea = exports.NumberFieldScrubArea = /*#__PURE__*/React.f
|
|
|
146
147
|
|
|
147
148
|
// Manually dispatch a click event if no movement happened, since
|
|
148
149
|
// preventDefault on pointerdown prevents the browser click event.
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
const pointerDownTarget = pointerDownTargetRef.current;
|
|
151
|
+
const input = inputRef.current;
|
|
152
|
+
if (!didMoveRef.current && pointerDownTarget != null && input) {
|
|
153
|
+
pointerDownTarget.dispatchEvent(new ((0, _owner.ownerWindow)(input).MouseEvent)('click', {
|
|
151
154
|
bubbles: true,
|
|
152
155
|
cancelable: true
|
|
153
156
|
}));
|
|
@@ -184,6 +187,7 @@ const NumberFieldScrubArea = exports.NumberFieldScrubArea = /*#__PURE__*/React.f
|
|
|
184
187
|
const stepAmount = getStepAmount(event) ?? _constants.DEFAULT_STEP;
|
|
185
188
|
const rawAmount = dValue * stepAmount;
|
|
186
189
|
if (rawAmount !== 0) {
|
|
190
|
+
allowInputSyncRef.current = true;
|
|
187
191
|
incrementValue(Math.abs(rawAmount), {
|
|
188
192
|
direction: rawAmount >= 0 ? 1 : -1,
|
|
189
193
|
event,
|
|
@@ -198,7 +202,7 @@ const NumberFieldScrubArea = exports.NumberFieldScrubArea = /*#__PURE__*/React.f
|
|
|
198
202
|
exitPointerLockTimeout.clear();
|
|
199
203
|
unsubscribe();
|
|
200
204
|
};
|
|
201
|
-
}, [disabled, readOnly, incrementValue, isScrubbing, getStepAmount, inputRef, onScrubbingChange, onScrub, direction, pixelSensitivity, lastChangedValueRef, onValueCommitted, valueRef, exitPointerLockTimeout]);
|
|
205
|
+
}, [disabled, readOnly, allowInputSyncRef, incrementValue, isScrubbing, getStepAmount, inputRef, onScrubbingChange, onScrub, direction, pixelSensitivity, lastChangedValueRef, onValueCommitted, valueRef, exitPointerLockTimeout]);
|
|
202
206
|
|
|
203
207
|
// Prevent scrolling using touch input when scrubbing.
|
|
204
208
|
React.useEffect(function registerScrubberTouchPreventListener() {
|
|
@@ -11,6 +11,7 @@ var _safeReact = require("@base-ui/utils/safeReact");
|
|
|
11
11
|
var _warn = require("@base-ui/utils/warn");
|
|
12
12
|
var _utils = require("../../floating-ui-react/utils");
|
|
13
13
|
var _useCompositeListItem = require("../../internals/composite/list/useCompositeListItem");
|
|
14
|
+
var _DirectionContext = require("../../internals/direction-context/DirectionContext");
|
|
14
15
|
var _useRenderElement = require("../../internals/useRenderElement");
|
|
15
16
|
var _createBaseUIEventDetails = require("../../internals/createBaseUIEventDetails");
|
|
16
17
|
var _reasons = require("../../internals/reasons");
|
|
@@ -51,7 +52,7 @@ const OTPFieldInput = exports.OTPFieldInput = /*#__PURE__*/React.forwardRef(func
|
|
|
51
52
|
reportValueInvalid,
|
|
52
53
|
readOnly,
|
|
53
54
|
required,
|
|
54
|
-
|
|
55
|
+
normalizeValue,
|
|
55
56
|
setValue,
|
|
56
57
|
state,
|
|
57
58
|
validationType,
|
|
@@ -64,6 +65,7 @@ const OTPFieldInput = exports.OTPFieldInput = /*#__PURE__*/React.forwardRef(func
|
|
|
64
65
|
indexGuessBehavior: _useCompositeListItem.IndexGuessBehavior.GuessFromOrder
|
|
65
66
|
});
|
|
66
67
|
const inputRef = React.useRef(null);
|
|
68
|
+
const direction = (0, _DirectionContext.useDirection)();
|
|
67
69
|
const slotValue = value[index] ?? '';
|
|
68
70
|
const inputState = (0, _OTPFieldRootContext.getOTPFieldInputState)(state, slotValue, index);
|
|
69
71
|
const slotAriaLabel = externalAriaLabel;
|
|
@@ -123,9 +125,8 @@ const OTPFieldInput = exports.OTPFieldInput = /*#__PURE__*/React.forwardRef(func
|
|
|
123
125
|
return;
|
|
124
126
|
}
|
|
125
127
|
const rawValue = event.currentTarget.value;
|
|
126
|
-
const nextDigits = (0, _otp.
|
|
127
|
-
|
|
128
|
-
if (didSanitize) {
|
|
128
|
+
const [nextDigits, didRejectCharacters] = (0, _otp.normalizeOTPValueWithDetails)(rawValue, length, validationType, normalizeValue);
|
|
129
|
+
if (didRejectCharacters) {
|
|
129
130
|
reportValueInvalid(rawValue, (0, _createBaseUIEventDetails.createGenericEventDetails)(_reasons.REASONS.inputChange, event.nativeEvent));
|
|
130
131
|
}
|
|
131
132
|
if (nextDigits === '') {
|
|
@@ -137,7 +138,7 @@ const OTPFieldInput = exports.OTPFieldInput = /*#__PURE__*/React.forwardRef(func
|
|
|
137
138
|
}
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
|
-
const nextValue = (0, _otp.replaceOTPValue)(value, index, nextDigits, length, validationType,
|
|
141
|
+
const nextValue = (0, _otp.replaceOTPValue)(value, index, nextDigits, length, validationType, normalizeValue);
|
|
141
142
|
const committedValue = setValue(nextValue, (0, _createBaseUIEventDetails.createChangeEventDetails)(_reasons.REASONS.inputChange, event.nativeEvent));
|
|
142
143
|
if (committedValue != null) {
|
|
143
144
|
const nextInput = Math.min(index + nextDigits.length, length - 1);
|
|
@@ -148,52 +149,66 @@ const OTPFieldInput = exports.OTPFieldInput = /*#__PURE__*/React.forwardRef(func
|
|
|
148
149
|
if (event.defaultPrevented || disabled) {
|
|
149
150
|
return;
|
|
150
151
|
}
|
|
151
|
-
|
|
152
|
+
const firstIndex = 0;
|
|
153
|
+
const lastIndex = Math.max(length - 1, firstIndex);
|
|
154
|
+
const endTargetIndex = Math.min(value.length, lastIndex);
|
|
155
|
+
const hasBoundaryModifier = (event.ctrlKey || event.metaKey) && !event.altKey;
|
|
156
|
+
const isRtl = direction === 'rtl';
|
|
157
|
+
const previousKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
|
|
158
|
+
const nextKey = isRtl ? 'ArrowLeft' : 'ArrowRight';
|
|
159
|
+
if (event.key === previousKey) {
|
|
152
160
|
(0, _utils.stopEvent)(event);
|
|
153
|
-
focusInput(Math.max(
|
|
161
|
+
focusInput(hasBoundaryModifier ? firstIndex : Math.max(firstIndex, index - 1));
|
|
154
162
|
return;
|
|
155
163
|
}
|
|
156
|
-
if (event.key ===
|
|
164
|
+
if (event.key === nextKey) {
|
|
157
165
|
(0, _utils.stopEvent)(event);
|
|
158
|
-
focusInput(Math.min(
|
|
166
|
+
focusInput(hasBoundaryModifier ? endTargetIndex : Math.min(lastIndex, index + 1));
|
|
159
167
|
return;
|
|
160
168
|
}
|
|
161
|
-
if (event.key === 'Home') {
|
|
169
|
+
if (event.key === 'Home' || event.key === 'ArrowUp') {
|
|
162
170
|
(0, _utils.stopEvent)(event);
|
|
163
|
-
focusInput(
|
|
171
|
+
focusInput(firstIndex);
|
|
164
172
|
return;
|
|
165
173
|
}
|
|
166
|
-
if (event.key === 'End') {
|
|
174
|
+
if (event.key === 'End' || event.key === 'ArrowDown') {
|
|
167
175
|
(0, _utils.stopEvent)(event);
|
|
168
|
-
focusInput(
|
|
176
|
+
focusInput(endTargetIndex);
|
|
169
177
|
return;
|
|
170
178
|
}
|
|
171
179
|
if (readOnly) {
|
|
172
180
|
return;
|
|
173
181
|
}
|
|
174
|
-
|
|
175
|
-
(0,
|
|
176
|
-
const committedValue = setValue((0, _otp.removeOTPCharacter)(value, index), (0, _createBaseUIEventDetails.createChangeEventDetails)(_reasons.REASONS.keyboard, event.nativeEvent));
|
|
182
|
+
function setKeyboardValue(nextValue, targetIndex) {
|
|
183
|
+
const committedValue = setValue(nextValue, (0, _createBaseUIEventDetails.createChangeEventDetails)(_reasons.REASONS.keyboard, event.nativeEvent));
|
|
177
184
|
if (committedValue != null) {
|
|
178
|
-
queueFocusInput(
|
|
185
|
+
queueFocusInput(targetIndex, committedValue);
|
|
179
186
|
}
|
|
187
|
+
}
|
|
188
|
+
if (event.key === 'Backspace' && hasBoundaryModifier) {
|
|
189
|
+
(0, _utils.stopEvent)(event);
|
|
190
|
+
setKeyboardValue('', firstIndex);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (event.key === 'Delete') {
|
|
194
|
+
(0, _utils.stopEvent)(event);
|
|
195
|
+
setKeyboardValue((0, _otp.removeOTPCharacter)(value, index), index);
|
|
180
196
|
return;
|
|
181
197
|
}
|
|
182
198
|
const inputValue = event.currentTarget.value;
|
|
183
199
|
const fullSelection = event.currentTarget.selectionStart === 0 && event.currentTarget.selectionEnd === inputValue.length;
|
|
184
200
|
if (event.key.length === 1 && fullSelection && slotValue === event.key) {
|
|
185
201
|
(0, _utils.stopEvent)(event);
|
|
186
|
-
|
|
202
|
+
if (index < length - 1) {
|
|
203
|
+
focusInput(index + 1);
|
|
204
|
+
}
|
|
187
205
|
return;
|
|
188
206
|
}
|
|
189
207
|
if (event.key === 'Backspace') {
|
|
190
208
|
(0, _utils.stopEvent)(event);
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
if (committedValue != null) {
|
|
195
|
-
queueFocusInput(targetIndex, committedValue);
|
|
196
|
-
}
|
|
209
|
+
const targetIndex = Math.max(firstIndex, index - 1);
|
|
210
|
+
const deleteIndex = slotValue === '' ? targetIndex : index;
|
|
211
|
+
setKeyboardValue((0, _otp.removeOTPCharacter)(value, deleteIndex), targetIndex);
|
|
197
212
|
}
|
|
198
213
|
},
|
|
199
214
|
onPaste(event) {
|
|
@@ -211,15 +226,14 @@ const OTPFieldInput = exports.OTPFieldInput = /*#__PURE__*/React.forwardRef(func
|
|
|
211
226
|
return;
|
|
212
227
|
}
|
|
213
228
|
event.preventDefault();
|
|
214
|
-
const nextDigits = (0, _otp.
|
|
215
|
-
|
|
216
|
-
if (didSanitize) {
|
|
229
|
+
const [nextDigits, didRejectCharacters] = (0, _otp.normalizeOTPValueWithDetails)(rawValue, length, validationType, normalizeValue);
|
|
230
|
+
if (didRejectCharacters) {
|
|
217
231
|
reportValueInvalid(rawValue, (0, _createBaseUIEventDetails.createGenericEventDetails)(_reasons.REASONS.inputPaste, event.nativeEvent));
|
|
218
232
|
}
|
|
219
233
|
if (nextDigits === '') {
|
|
220
234
|
return;
|
|
221
235
|
}
|
|
222
|
-
const committedValue = setValue((0, _otp.replaceOTPValue)(value, index, nextDigits, length, validationType,
|
|
236
|
+
const committedValue = setValue((0, _otp.replaceOTPValue)(value, index, nextDigits, length, validationType, normalizeValue), (0, _createBaseUIEventDetails.createChangeEventDetails)(_reasons.REASONS.inputPaste, event.nativeEvent));
|
|
223
237
|
if (committedValue != null) {
|
|
224
238
|
const nextInput = Math.min(index + nextDigits.length, length - 1);
|
|
225
239
|
queueFocusInput(nextInput, committedValue);
|
|
@@ -57,10 +57,17 @@ export interface OTPFieldRootProps extends Omit<BaseUIComponentProps<'div', OTPF
|
|
|
57
57
|
*/
|
|
58
58
|
validationType?: OTPFieldRoot.ValidationType | undefined;
|
|
59
59
|
/**
|
|
60
|
-
* Function
|
|
61
|
-
*
|
|
60
|
+
* Function that normalizes the OTP value after whitespace and `validationType` filtering.
|
|
61
|
+
* It runs whenever OTP Field normalizes a value, including initial/default values, controlled
|
|
62
|
+
* values, and user edits.
|
|
63
|
+
*
|
|
64
|
+
* The returned value is filtered by `validationType` again, then clamped to `length`.
|
|
65
|
+
* It should be idempotent because OTP Field may normalize the same value more than once while
|
|
66
|
+
* handling edits, storing state, and rendering controlled or uncontrolled values. Non-idempotent
|
|
67
|
+
* normalizers can compound across those normalization passes. Characters rejected while
|
|
68
|
+
* normalizing typed or pasted text are reported through `onValueInvalid`.
|
|
62
69
|
*/
|
|
63
|
-
|
|
70
|
+
normalizeValue?: ((value: string) => string) | undefined;
|
|
64
71
|
/**
|
|
65
72
|
* Whether the user must enter a value before submitting a form.
|
|
66
73
|
* @default false
|
|
@@ -99,16 +106,18 @@ export interface OTPFieldRootProps extends Omit<BaseUIComponentProps<'div', OTPF
|
|
|
99
106
|
*/
|
|
100
107
|
onValueChange?: ((value: string, eventDetails: OTPFieldRoot.ChangeEventDetails) => void) | undefined;
|
|
101
108
|
/**
|
|
102
|
-
* Callback fired when entered text contains characters that are rejected by
|
|
103
|
-
* before the OTP value updates.
|
|
109
|
+
* Callback fired when entered text contains characters that are rejected by validation or
|
|
110
|
+
* normalization before the OTP value updates.
|
|
104
111
|
*
|
|
105
|
-
* The `value` argument is the attempted user-entered string before
|
|
112
|
+
* The `value` argument is the attempted user-entered string before normalization.
|
|
106
113
|
*/
|
|
107
114
|
onValueInvalid?: ((value: string, eventDetails: OTPFieldRoot.InvalidEventDetails) => void) | undefined;
|
|
108
115
|
/**
|
|
109
|
-
* Callback function that is fired when the OTP value becomes complete
|
|
116
|
+
* Callback function that is fired when the OTP value becomes complete, or when a complete value
|
|
117
|
+
* is pasted while the OTP is already complete.
|
|
110
118
|
*
|
|
111
|
-
*
|
|
119
|
+
* When the value changes, it runs later than `onValueChange`, after the internal value update is
|
|
120
|
+
* applied. If a complete pasted value matches the current value, `onValueChange` does not fire.
|
|
112
121
|
*
|
|
113
122
|
* If `autoSubmit` is enabled, it runs immediately before the owning form is submitted.
|
|
114
123
|
*/
|