@base-ui/react 1.2.0 → 1.3.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 +148 -1
- package/accordion/header/AccordionHeader.d.ts +4 -2
- package/accordion/item/AccordionItem.d.ts +10 -4
- package/accordion/item/AccordionItemContext.d.ts +2 -2
- package/accordion/item/stateAttributesMapping.d.ts +2 -2
- package/accordion/panel/AccordionPanel.d.ts +6 -3
- package/accordion/root/AccordionRoot.d.ts +19 -10
- package/accordion/root/AccordionRootContext.d.ts +7 -7
- package/accordion/trigger/AccordionTrigger.d.ts +4 -2
- package/accordion/trigger/AccordionTrigger.js +3 -1
- package/alert-dialog/root/AlertDialogRoot.d.ts +2 -0
- package/autocomplete/index.d.ts +1 -0
- package/autocomplete/index.parts.d.ts +1 -0
- package/autocomplete/index.parts.js +7 -0
- package/autocomplete/root/AutocompleteRoot.d.ts +4 -4
- package/autocomplete/root/AutocompleteRoot.js +4 -1
- package/avatar/fallback/AvatarFallback.d.ts +3 -6
- package/avatar/fallback/AvatarFallback.js +4 -32
- package/avatar/image/AvatarImage.d.ts +6 -3
- package/avatar/image/AvatarImage.js +2 -3
- package/avatar/image/AvatarImageDataAttributes.d.ts +10 -0
- package/avatar/image/AvatarImageDataAttributes.js +18 -0
- package/avatar/root/AvatarRoot.d.ts +4 -1
- package/checkbox/indicator/CheckboxIndicator.d.ts +6 -3
- package/checkbox/root/CheckboxRoot.d.ts +3 -3
- package/checkbox/root/CheckboxRoot.js +4 -1
- package/checkbox/root/CheckboxRootContext.d.ts +4 -4
- package/checkbox/utils/useStateAttributesMapping.d.ts +2 -2
- package/checkbox-group/CheckboxGroup.d.ts +3 -3
- package/checkbox-group/CheckboxGroupContext.d.ts +2 -2
- package/checkbox-group/useCheckboxGroupParent.d.ts +2 -5
- package/collapsible/panel/CollapsiblePanel.d.ts +6 -3
- package/collapsible/panel/useCollapsiblePanel.d.ts +2 -5
- package/collapsible/root/CollapsibleRoot.d.ts +3 -3
- package/collapsible/root/CollapsibleRootContext.d.ts +4 -4
- package/collapsible/root/stateAttributesMapping.d.ts +2 -2
- package/collapsible/root/useCollapsibleRoot.d.ts +2 -5
- package/collapsible/trigger/CollapsibleTrigger.d.ts +4 -2
- package/combobox/arrow/ComboboxArrow.d.ts +10 -1
- package/combobox/backdrop/ComboboxBackdrop.d.ts +4 -1
- package/combobox/chip/ComboboxChip.d.ts +1 -1
- package/combobox/chip-remove/ComboboxChipRemove.d.ts +1 -1
- package/combobox/chips/ComboboxChips.d.ts +1 -1
- package/combobox/clear/ComboboxClear.d.ts +4 -1
- package/combobox/collection/ComboboxCollection.d.ts +2 -0
- package/combobox/empty/ComboboxEmpty.d.ts +1 -1
- package/combobox/group/ComboboxGroup.d.ts +1 -1
- package/combobox/group-label/ComboboxGroupLabel.d.ts +1 -1
- package/combobox/icon/ComboboxIcon.d.ts +1 -1
- package/combobox/index.d.ts +2 -0
- package/combobox/index.parts.d.ts +2 -0
- package/combobox/index.parts.js +14 -0
- package/combobox/input/ComboboxInput.d.ts +3 -3
- package/combobox/input/ComboboxInput.js +22 -5
- package/combobox/input-group/ComboboxInputGroup.d.ts +40 -0
- package/combobox/input-group/ComboboxInputGroup.js +68 -0
- package/combobox/input-group/ComboboxInputGroupDataAttributes.d.ts +55 -0
- package/combobox/input-group/ComboboxInputGroupDataAttributes.js +62 -0
- package/combobox/item/ComboboxItem.d.ts +1 -1
- package/combobox/item/ComboboxItem.js +2 -1
- package/combobox/item-indicator/ComboboxItemIndicator.d.ts +7 -1
- package/combobox/item-indicator/ComboboxItemIndicatorDataAttributes.d.ts +10 -0
- package/combobox/item-indicator/ComboboxItemIndicatorDataAttributes.js +18 -0
- package/combobox/label/ComboboxLabel.d.ts +16 -0
- package/combobox/label/ComboboxLabel.js +68 -0
- package/combobox/list/ComboboxList.d.ts +1 -1
- package/combobox/popup/ComboboxPopup.d.ts +21 -3
- package/combobox/popup/ComboboxPopup.js +10 -2
- package/combobox/portal/ComboboxPortal.d.ts +3 -4
- package/combobox/positioner/ComboboxPositioner.d.ts +14 -2
- package/combobox/positioner/ComboboxPositioner.js +3 -2
- package/combobox/root/AriaCombobox.d.ts +9 -8
- package/combobox/root/AriaCombobox.js +14 -6
- package/combobox/root/ComboboxRoot.d.ts +4 -4
- package/combobox/row/ComboboxRow.d.ts +1 -1
- package/combobox/status/ComboboxStatus.d.ts +1 -1
- package/combobox/store.d.ts +10 -4
- package/combobox/store.js +2 -0
- package/combobox/trigger/ComboboxTrigger.d.ts +3 -3
- package/combobox/trigger/ComboboxTrigger.js +5 -2
- package/combobox/utils/ComboboxInternalDismissButton.d.ts +5 -0
- package/combobox/utils/ComboboxInternalDismissButton.js +44 -0
- package/composite/item/CompositeItem.d.ts +3 -1
- package/composite/list/CompositeList.d.ts +3 -1
- package/composite/list/useCompositeListItem.d.ts +1 -1
- package/composite/root/CompositeRoot.d.ts +4 -2
- package/composite/root/useCompositeRoot.d.ts +1 -1
- package/context-menu/trigger/ContextMenuTrigger.d.ts +3 -3
- package/dialog/backdrop/DialogBackdrop.d.ts +4 -1
- package/dialog/close/DialogClose.d.ts +1 -1
- package/dialog/description/DialogDescription.d.ts +1 -1
- package/dialog/popup/DialogPopup.d.ts +6 -3
- package/dialog/portal/DialogPortal.d.ts +4 -5
- package/dialog/root/DialogRoot.d.ts +8 -3
- package/dialog/root/useDialogRoot.d.ts +3 -7
- package/dialog/root/useDialogRoot.js +2 -5
- package/dialog/title/DialogTitle.d.ts +1 -1
- package/dialog/trigger/DialogTrigger.d.ts +1 -1
- package/dialog/viewport/DialogViewport.d.ts +3 -0
- package/direction-provider/DirectionProvider.d.ts +2 -0
- package/drawer/backdrop/DrawerBackdrop.d.ts +4 -1
- package/drawer/backdrop/DrawerBackdropDataAttributes.d.ts +18 -0
- package/drawer/backdrop/DrawerBackdropDataAttributes.js +26 -0
- package/drawer/close/DrawerClose.d.ts +1 -1
- package/drawer/content/DrawerContent.d.ts +1 -1
- package/drawer/content/DrawerContent.js +2 -1
- package/drawer/content/DrawerContentDataAttributes.d.ts +1 -0
- package/drawer/content/DrawerContentDataAttributes.js +7 -0
- package/drawer/description/DrawerDescription.d.ts +1 -1
- package/drawer/indent/DrawerIndent.d.ts +3 -2
- package/drawer/indent/DrawerIndent.js +2 -1
- package/drawer/indent-background/DrawerIndentBackground.d.ts +5 -3
- package/drawer/indent-background/DrawerIndentBackground.js +4 -2
- package/drawer/index.d.ts +2 -1
- package/drawer/index.js +3 -3
- package/drawer/index.parts.d.ts +1 -0
- package/drawer/index.parts.js +7 -0
- package/drawer/popup/DrawerPopup.d.ts +6 -3
- package/drawer/popup/DrawerPopup.js +59 -2
- package/drawer/popup/DrawerPopupDataAttributes.d.ts +16 -0
- package/drawer/popup/DrawerPopupDataAttributes.js +18 -1
- package/drawer/portal/DrawerPortal.d.ts +2 -2
- package/drawer/provider/DrawerProvider.d.ts +2 -2
- package/drawer/provider/DrawerProvider.js +2 -2
- package/drawer/root/DrawerRoot.d.ts +5 -3
- package/drawer/root/DrawerRoot.js +6 -2
- package/drawer/swipe-area/DrawerSwipeArea.d.ts +1 -1
- package/drawer/swipe-area/DrawerSwipeArea.js +12 -10
- package/drawer/swipe-area/DrawerSwipeAreaDataAttributes.d.ts +23 -0
- package/drawer/swipe-area/DrawerSwipeAreaDataAttributes.js +31 -0
- package/drawer/title/DrawerTitle.d.ts +1 -1
- package/drawer/trigger/DrawerTrigger.d.ts +1 -1
- package/drawer/viewport/DrawerViewport.d.ts +4 -1
- package/drawer/viewport/DrawerViewport.js +165 -43
- package/drawer/viewport/DrawerViewportDataAttributes.d.ts +22 -0
- package/drawer/viewport/DrawerViewportDataAttributes.js +30 -0
- package/esm/accordion/header/AccordionHeader.d.ts +4 -2
- package/esm/accordion/item/AccordionItem.d.ts +10 -4
- package/esm/accordion/item/AccordionItemContext.d.ts +2 -2
- package/esm/accordion/item/stateAttributesMapping.d.ts +2 -2
- package/esm/accordion/panel/AccordionPanel.d.ts +6 -3
- package/esm/accordion/root/AccordionRoot.d.ts +19 -10
- package/esm/accordion/root/AccordionRootContext.d.ts +7 -7
- package/esm/accordion/trigger/AccordionTrigger.d.ts +4 -2
- package/esm/accordion/trigger/AccordionTrigger.js +3 -1
- package/esm/alert-dialog/root/AlertDialogRoot.d.ts +2 -0
- package/esm/autocomplete/index.d.ts +1 -0
- package/esm/autocomplete/index.parts.d.ts +1 -0
- package/esm/autocomplete/index.parts.js +1 -0
- package/esm/autocomplete/root/AutocompleteRoot.d.ts +4 -4
- package/esm/autocomplete/root/AutocompleteRoot.js +4 -1
- package/esm/avatar/fallback/AvatarFallback.d.ts +3 -6
- package/esm/avatar/fallback/AvatarFallback.js +4 -31
- package/esm/avatar/image/AvatarImage.d.ts +6 -3
- package/esm/avatar/image/AvatarImage.js +2 -3
- package/esm/avatar/image/AvatarImageDataAttributes.d.ts +10 -0
- package/esm/avatar/image/AvatarImageDataAttributes.js +12 -0
- package/esm/avatar/root/AvatarRoot.d.ts +4 -1
- package/esm/checkbox/indicator/CheckboxIndicator.d.ts +6 -3
- package/esm/checkbox/root/CheckboxRoot.d.ts +3 -3
- package/esm/checkbox/root/CheckboxRoot.js +4 -1
- package/esm/checkbox/root/CheckboxRootContext.d.ts +4 -4
- package/esm/checkbox/utils/useStateAttributesMapping.d.ts +2 -2
- package/esm/checkbox-group/CheckboxGroup.d.ts +3 -3
- package/esm/checkbox-group/CheckboxGroupContext.d.ts +2 -2
- package/esm/checkbox-group/useCheckboxGroupParent.d.ts +2 -5
- package/esm/collapsible/panel/CollapsiblePanel.d.ts +6 -3
- package/esm/collapsible/panel/useCollapsiblePanel.d.ts +2 -5
- package/esm/collapsible/root/CollapsibleRoot.d.ts +3 -3
- package/esm/collapsible/root/CollapsibleRootContext.d.ts +4 -4
- package/esm/collapsible/root/stateAttributesMapping.d.ts +2 -2
- package/esm/collapsible/root/useCollapsibleRoot.d.ts +2 -5
- package/esm/collapsible/trigger/CollapsibleTrigger.d.ts +4 -2
- package/esm/combobox/arrow/ComboboxArrow.d.ts +10 -1
- package/esm/combobox/backdrop/ComboboxBackdrop.d.ts +4 -1
- package/esm/combobox/chip/ComboboxChip.d.ts +1 -1
- package/esm/combobox/chip-remove/ComboboxChipRemove.d.ts +1 -1
- package/esm/combobox/chips/ComboboxChips.d.ts +1 -1
- package/esm/combobox/clear/ComboboxClear.d.ts +4 -1
- package/esm/combobox/collection/ComboboxCollection.d.ts +2 -0
- package/esm/combobox/empty/ComboboxEmpty.d.ts +1 -1
- package/esm/combobox/group/ComboboxGroup.d.ts +1 -1
- package/esm/combobox/group-label/ComboboxGroupLabel.d.ts +1 -1
- package/esm/combobox/icon/ComboboxIcon.d.ts +1 -1
- package/esm/combobox/index.d.ts +2 -0
- package/esm/combobox/index.parts.d.ts +2 -0
- package/esm/combobox/index.parts.js +2 -0
- package/esm/combobox/input/ComboboxInput.d.ts +3 -3
- package/esm/combobox/input/ComboboxInput.js +22 -5
- package/esm/combobox/input-group/ComboboxInputGroup.d.ts +40 -0
- package/esm/combobox/input-group/ComboboxInputGroup.js +63 -0
- package/esm/combobox/input-group/ComboboxInputGroupDataAttributes.d.ts +55 -0
- package/esm/combobox/input-group/ComboboxInputGroupDataAttributes.js +56 -0
- package/esm/combobox/item/ComboboxItem.d.ts +1 -1
- package/esm/combobox/item/ComboboxItem.js +2 -1
- package/esm/combobox/item-indicator/ComboboxItemIndicator.d.ts +7 -1
- package/esm/combobox/item-indicator/ComboboxItemIndicatorDataAttributes.d.ts +10 -0
- package/esm/combobox/item-indicator/ComboboxItemIndicatorDataAttributes.js +12 -0
- package/esm/combobox/label/ComboboxLabel.d.ts +16 -0
- package/esm/combobox/label/ComboboxLabel.js +63 -0
- package/esm/combobox/list/ComboboxList.d.ts +1 -1
- package/esm/combobox/popup/ComboboxPopup.d.ts +21 -3
- package/esm/combobox/popup/ComboboxPopup.js +11 -3
- package/esm/combobox/portal/ComboboxPortal.d.ts +3 -4
- package/esm/combobox/positioner/ComboboxPositioner.d.ts +14 -2
- package/esm/combobox/positioner/ComboboxPositioner.js +3 -2
- package/esm/combobox/root/AriaCombobox.d.ts +9 -8
- package/esm/combobox/root/AriaCombobox.js +14 -6
- package/esm/combobox/root/ComboboxRoot.d.ts +4 -4
- package/esm/combobox/row/ComboboxRow.d.ts +1 -1
- package/esm/combobox/status/ComboboxStatus.d.ts +1 -1
- package/esm/combobox/store.d.ts +10 -4
- package/esm/combobox/store.js +2 -0
- package/esm/combobox/trigger/ComboboxTrigger.d.ts +3 -3
- package/esm/combobox/trigger/ComboboxTrigger.js +5 -2
- package/esm/combobox/utils/ComboboxInternalDismissButton.d.ts +5 -0
- package/esm/combobox/utils/ComboboxInternalDismissButton.js +38 -0
- package/esm/composite/item/CompositeItem.d.ts +3 -1
- package/esm/composite/list/CompositeList.d.ts +3 -1
- package/esm/composite/list/useCompositeListItem.d.ts +1 -1
- package/esm/composite/root/CompositeRoot.d.ts +4 -2
- package/esm/composite/root/useCompositeRoot.d.ts +1 -1
- package/esm/context-menu/trigger/ContextMenuTrigger.d.ts +3 -3
- package/esm/dialog/backdrop/DialogBackdrop.d.ts +4 -1
- package/esm/dialog/close/DialogClose.d.ts +1 -1
- package/esm/dialog/description/DialogDescription.d.ts +1 -1
- package/esm/dialog/popup/DialogPopup.d.ts +6 -3
- package/esm/dialog/portal/DialogPortal.d.ts +4 -5
- package/esm/dialog/root/DialogRoot.d.ts +8 -3
- package/esm/dialog/root/useDialogRoot.d.ts +3 -7
- package/esm/dialog/root/useDialogRoot.js +2 -5
- package/esm/dialog/title/DialogTitle.d.ts +1 -1
- package/esm/dialog/trigger/DialogTrigger.d.ts +1 -1
- package/esm/dialog/viewport/DialogViewport.d.ts +3 -0
- package/esm/direction-provider/DirectionProvider.d.ts +2 -0
- package/esm/drawer/backdrop/DrawerBackdrop.d.ts +4 -1
- package/esm/drawer/backdrop/DrawerBackdropDataAttributes.d.ts +18 -0
- package/esm/drawer/backdrop/DrawerBackdropDataAttributes.js +20 -0
- package/esm/drawer/close/DrawerClose.d.ts +1 -1
- package/esm/drawer/content/DrawerContent.d.ts +1 -1
- package/esm/drawer/content/DrawerContent.js +2 -1
- package/esm/drawer/content/DrawerContentDataAttributes.d.ts +1 -0
- package/esm/drawer/content/DrawerContentDataAttributes.js +1 -0
- package/esm/drawer/description/DrawerDescription.d.ts +1 -1
- package/esm/drawer/indent/DrawerIndent.d.ts +3 -2
- package/esm/drawer/indent/DrawerIndent.js +2 -1
- package/esm/drawer/indent-background/DrawerIndentBackground.d.ts +5 -3
- package/esm/drawer/indent-background/DrawerIndentBackground.js +4 -2
- package/esm/drawer/index.d.ts +2 -1
- package/esm/drawer/index.js +1 -1
- package/esm/drawer/index.parts.d.ts +1 -0
- package/esm/drawer/index.parts.js +1 -0
- package/esm/drawer/popup/DrawerPopup.d.ts +6 -3
- package/esm/drawer/popup/DrawerPopup.js +59 -2
- package/esm/drawer/popup/DrawerPopupDataAttributes.d.ts +16 -0
- package/esm/drawer/popup/DrawerPopupDataAttributes.js +18 -1
- package/esm/drawer/portal/DrawerPortal.d.ts +2 -2
- package/esm/drawer/provider/DrawerProvider.d.ts +2 -2
- package/esm/drawer/provider/DrawerProvider.js +2 -2
- package/esm/drawer/root/DrawerRoot.d.ts +5 -3
- package/esm/drawer/root/DrawerRoot.js +6 -2
- package/esm/drawer/swipe-area/DrawerSwipeArea.d.ts +1 -1
- package/esm/drawer/swipe-area/DrawerSwipeArea.js +12 -10
- package/esm/drawer/swipe-area/DrawerSwipeAreaDataAttributes.d.ts +23 -0
- package/esm/drawer/swipe-area/DrawerSwipeAreaDataAttributes.js +25 -0
- package/esm/drawer/title/DrawerTitle.d.ts +1 -1
- package/esm/drawer/trigger/DrawerTrigger.d.ts +1 -1
- package/esm/drawer/viewport/DrawerViewport.d.ts +4 -1
- package/esm/drawer/viewport/DrawerViewport.js +165 -43
- package/esm/drawer/viewport/DrawerViewportDataAttributes.d.ts +22 -0
- package/esm/drawer/viewport/DrawerViewportDataAttributes.js +24 -0
- package/esm/field/control/FieldControl.d.ts +3 -3
- package/esm/field/description/FieldDescription.d.ts +3 -3
- package/esm/field/error/FieldError.d.ts +7 -4
- package/esm/field/error/FieldErrorDataAttributes.d.ts +8 -0
- package/esm/field/error/FieldErrorDataAttributes.js +10 -1
- package/esm/field/item/FieldItem.d.ts +4 -3
- package/esm/field/item/FieldItem.js +2 -2
- package/esm/field/label/FieldLabel.d.ts +3 -3
- package/esm/field/label/FieldLabel.js +6 -51
- package/esm/field/root/FieldRoot.d.ts +19 -2
- package/esm/field/root/FieldRoot.js +2 -1
- package/esm/field/root/FieldRootContext.d.ts +2 -2
- package/esm/field/root/FieldRootContext.js +6 -13
- package/esm/field/root/useFieldValidation.js +5 -4
- package/esm/field/utils/constants.d.ts +3 -0
- package/esm/field/utils/constants.js +11 -0
- package/esm/field/validity/FieldValidity.d.ts +7 -1
- package/esm/fieldset/legend/FieldsetLegend.d.ts +1 -1
- package/esm/fieldset/root/FieldsetRoot.d.ts +1 -1
- package/esm/floating-ui-react/components/FloatingDelayGroup.js +1 -1
- package/esm/floating-ui-react/components/FloatingFocusManager.d.ts +12 -7
- package/esm/floating-ui-react/components/FloatingFocusManager.js +31 -27
- package/esm/floating-ui-react/components/FloatingPortal.d.ts +6 -4
- package/esm/floating-ui-react/hooks/useClick.d.ts +2 -2
- package/esm/floating-ui-react/hooks/useClientPoint.d.ts +1 -1
- package/esm/floating-ui-react/hooks/useDismiss.d.ts +8 -12
- package/esm/floating-ui-react/hooks/useDismiss.js +320 -261
- package/esm/floating-ui-react/hooks/useFloatingRootContext.d.ts +2 -2
- package/esm/floating-ui-react/hooks/useFocus.d.ts +1 -1
- package/esm/floating-ui-react/hooks/useHover.d.ts +6 -14
- package/esm/floating-ui-react/hooks/useHover.js +2 -27
- package/esm/floating-ui-react/hooks/useHoverFloatingInteraction.d.ts +2 -3
- package/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js +55 -71
- package/esm/floating-ui-react/hooks/useHoverInteractionSharedState.d.ts +12 -3
- package/esm/floating-ui-react/hooks/useHoverInteractionSharedState.js +30 -3
- package/esm/floating-ui-react/hooks/useHoverReferenceInteraction.d.ts +8 -3
- package/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js +59 -81
- package/esm/floating-ui-react/hooks/useHoverShared.d.ts +28 -0
- package/esm/floating-ui-react/hooks/useHoverShared.js +26 -0
- package/esm/floating-ui-react/hooks/useListNavigation.d.ts +4 -4
- package/esm/floating-ui-react/hooks/useListNavigation.js +7 -3
- package/esm/floating-ui-react/hooks/useRole.d.ts +1 -1
- package/esm/floating-ui-react/hooks/useTypeahead.d.ts +7 -1
- package/esm/floating-ui-react/hooks/useTypeahead.js +30 -14
- package/esm/floating-ui-react/safePolygon.d.ts +2 -6
- package/esm/floating-ui-react/safePolygon.js +149 -119
- package/esm/floating-ui-react/types.d.ts +5 -4
- package/esm/floating-ui-react/utils/composite.d.ts +1 -0
- package/esm/floating-ui-react/utils/composite.js +128 -129
- package/esm/floating-ui-react/utils/markOthers.d.ts +7 -1
- package/esm/floating-ui-react/utils/markOthers.js +119 -81
- package/esm/form/Form.d.ts +1 -1
- package/esm/global.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/input/Input.d.ts +10 -3
- package/esm/labelable-provider/LabelableProvider.d.ts +4 -1
- package/esm/labelable-provider/LabelableProvider.js +3 -2
- package/esm/labelable-provider/useAriaLabelledBy.d.ts +9 -0
- package/esm/labelable-provider/useAriaLabelledBy.js +56 -0
- package/esm/labelable-provider/useLabel.d.ts +25 -0
- package/esm/labelable-provider/useLabel.js +74 -0
- package/esm/labelable-provider/useLabelableId.d.ts +2 -5
- package/esm/menu/arrow/MenuArrow.d.ts +10 -1
- package/esm/menu/backdrop/MenuBackdrop.d.ts +4 -1
- package/esm/menu/checkbox-item/MenuCheckboxItem.d.ts +3 -3
- package/esm/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.d.ts +7 -1
- package/esm/menu/group/MenuGroup.d.ts +1 -1
- package/esm/menu/group-label/MenuGroupLabel.d.ts +1 -1
- package/esm/menu/index.d.ts +2 -1
- package/esm/menu/index.parts.d.ts +1 -0
- package/esm/menu/index.parts.js +1 -0
- package/esm/menu/item/MenuItem.d.ts +1 -1
- package/esm/menu/item/useMenuItem.d.ts +8 -7
- package/esm/menu/item/useMenuItem.js +5 -7
- package/esm/menu/item/useMenuItemCommonProps.d.ts +7 -4
- package/esm/menu/item/useMenuItemCommonProps.js +16 -2
- package/esm/menu/link-item/MenuLinkItem.d.ts +1 -1
- package/esm/menu/link-item/MenuLinkItem.js +16 -2
- package/esm/menu/popup/MenuPopup.d.ts +20 -5
- package/esm/menu/popup/MenuPopup.js +4 -1
- package/esm/menu/popup/MenuPopupDataAttributes.d.ts +1 -1
- package/esm/menu/popup/MenuPopupDataAttributes.js +1 -1
- package/esm/menu/portal/MenuPortal.d.ts +3 -4
- package/esm/menu/positioner/MenuPositioner.d.ts +18 -2
- package/esm/menu/positioner/MenuPositioner.js +58 -5
- package/esm/menu/radio-group/MenuRadioGroup.d.ts +6 -3
- package/esm/menu/radio-item/MenuRadioItem.d.ts +3 -3
- package/esm/menu/radio-item-indicator/MenuRadioItemIndicator.d.ts +7 -1
- package/esm/menu/root/MenuRoot.d.ts +4 -2
- package/esm/menu/root/MenuRoot.js +2 -3
- package/esm/menu/store/MenuStore.d.ts +4 -2
- package/esm/menu/store/MenuStore.js +15 -1
- package/esm/menu/submenu-trigger/MenuSubmenuTrigger.js +1 -0
- package/esm/menu/trigger/MenuTrigger.d.ts +3 -3
- package/esm/menu/viewport/MenuViewport.d.ts +30 -0
- package/esm/menu/viewport/MenuViewport.js +60 -0
- package/esm/menu/viewport/MenuViewportCssVars.d.ts +14 -0
- package/esm/menu/viewport/MenuViewportCssVars.js +15 -0
- package/esm/menu/viewport/MenuViewportDataAttributes.d.ts +26 -0
- package/esm/menu/viewport/MenuViewportDataAttributes.js +27 -0
- package/esm/menubar/Menubar.d.ts +1 -1
- package/esm/menubar/Menubar.js +1 -7
- package/esm/meter/indicator/MeterIndicator.d.ts +4 -2
- package/esm/meter/label/MeterLabel.d.ts +4 -2
- package/esm/meter/label/MeterLabel.js +4 -8
- package/esm/meter/root/MeterRoot.d.ts +1 -1
- package/esm/meter/root/MeterRoot.js +11 -2
- package/esm/meter/track/MeterTrack.d.ts +4 -2
- package/esm/meter/value/MeterValue.d.ts +5 -3
- package/esm/navigation-menu/arrow/NavigationMenuArrow.d.ts +10 -1
- package/esm/navigation-menu/backdrop/NavigationMenuBackdrop.d.ts +1 -1
- package/esm/navigation-menu/content/NavigationMenuContent.d.ts +1 -1
- package/esm/navigation-menu/content/NavigationMenuContent.js +11 -0
- package/esm/navigation-menu/icon/NavigationMenuIcon.d.ts +1 -1
- package/esm/navigation-menu/item/NavigationMenuItem.d.ts +1 -1
- package/esm/navigation-menu/link/NavigationMenuLink.d.ts +1 -1
- package/esm/navigation-menu/list/NavigationMenuList.d.ts +1 -1
- package/esm/navigation-menu/list/NavigationMenuList.js +11 -2
- package/esm/navigation-menu/popup/NavigationMenuPopup.d.ts +1 -1
- package/esm/navigation-menu/portal/NavigationMenuPortal.d.ts +4 -5
- package/esm/navigation-menu/positioner/NavigationMenuPositioner.d.ts +11 -2
- package/esm/navigation-menu/root/NavigationMenuRoot.d.ts +4 -4
- package/esm/navigation-menu/root/NavigationMenuRoot.js +27 -8
- package/esm/navigation-menu/trigger/NavigationMenuTrigger.d.ts +1 -1
- package/esm/navigation-menu/trigger/NavigationMenuTrigger.js +364 -20
- package/esm/navigation-menu/utils/isOutsideMenuEvent.d.ts +1 -1
- package/esm/navigation-menu/viewport/NavigationMenuViewport.d.ts +1 -1
- package/esm/navigation-menu/viewport/NavigationMenuViewport.js +0 -19
- package/esm/number-field/decrement/NumberFieldDecrement.d.ts +3 -3
- package/esm/number-field/group/NumberFieldGroup.d.ts +3 -3
- package/esm/number-field/increment/NumberFieldIncrement.d.ts +3 -3
- package/esm/number-field/input/NumberFieldInput.d.ts +3 -3
- package/esm/number-field/root/NumberFieldRoot.d.ts +4 -4
- package/esm/number-field/root/NumberFieldRoot.js +1 -1
- package/esm/number-field/root/NumberFieldRootContext.d.ts +2 -2
- package/esm/number-field/root/useNumberFieldButton.d.ts +2 -5
- package/esm/number-field/scrub-area/NumberFieldScrubArea.d.ts +4 -4
- package/esm/number-field/scrub-area-cursor/NumberFieldScrubAreaCursor.d.ts +3 -3
- package/esm/number-field/utils/stateAttributesMapping.d.ts +2 -2
- package/esm/number-field/utils/types.d.ts +2 -2
- package/esm/popover/arrow/PopoverArrow.d.ts +10 -1
- package/esm/popover/backdrop/PopoverBackdrop.d.ts +4 -1
- package/esm/popover/close/PopoverClose.d.ts +1 -1
- package/esm/popover/close/PopoverClose.js +5 -3
- package/esm/popover/description/PopoverDescription.d.ts +1 -1
- package/esm/popover/popup/PopoverPopup.d.ts +15 -3
- package/esm/popover/popup/PopoverPopup.js +11 -2
- package/esm/popover/portal/PopoverPortal.d.ts +3 -4
- package/esm/popover/positioner/PopoverPositioner.d.ts +11 -2
- package/esm/popover/root/PopoverRoot.d.ts +10 -3
- package/esm/popover/root/PopoverRoot.js +1 -3
- package/esm/popover/title/PopoverTitle.d.ts +1 -1
- package/esm/popover/viewport/PopoverViewport.d.ts +16 -12
- package/esm/preview-card/arrow/PreviewCardArrow.d.ts +10 -1
- package/esm/preview-card/backdrop/PreviewCardBackdrop.d.ts +4 -1
- package/esm/preview-card/popup/PreviewCardPopup.d.ts +13 -1
- package/esm/preview-card/portal/PreviewCardPortal.d.ts +3 -4
- package/esm/preview-card/positioner/PreviewCardPositioner.d.ts +14 -2
- package/esm/preview-card/positioner/PreviewCardPositioner.js +7 -1
- package/esm/preview-card/root/PreviewCardRoot.d.ts +3 -3
- package/esm/preview-card/root/PreviewCardRoot.js +22 -9
- package/esm/preview-card/trigger/PreviewCardTrigger.d.ts +1 -1
- package/esm/preview-card/viewport/PreviewCardViewport.d.ts +16 -9
- package/esm/progress/indicator/ProgressIndicator.d.ts +4 -2
- package/esm/progress/label/ProgressLabel.d.ts +4 -2
- package/esm/progress/label/ProgressLabel.js +4 -8
- package/esm/progress/root/ProgressRoot.d.ts +4 -1
- package/esm/progress/root/ProgressRoot.js +11 -2
- package/esm/progress/root/ProgressRootContext.d.ts +2 -2
- package/esm/progress/root/stateAttributesMapping.d.ts +2 -2
- package/esm/progress/track/ProgressTrack.d.ts +4 -2
- package/esm/progress/value/ProgressValue.d.ts +5 -3
- package/esm/radio/indicator/RadioIndicator.d.ts +4 -1
- package/esm/radio/indicator/RadioIndicatorDataAttributes.d.ts +8 -0
- package/esm/radio/indicator/RadioIndicatorDataAttributes.js +10 -1
- package/esm/radio/root/RadioRoot.d.ts +3 -3
- package/esm/radio/root/RadioRoot.js +4 -1
- package/esm/radio-group/RadioGroup.d.ts +3 -3
- package/esm/scroll-area/content/ScrollAreaContent.d.ts +3 -3
- package/esm/scroll-area/corner/ScrollAreaCorner.d.ts +1 -1
- package/esm/scroll-area/root/ScrollAreaRoot.d.ts +27 -11
- package/esm/scroll-area/root/ScrollAreaRoot.js +7 -4
- package/esm/scroll-area/root/ScrollAreaRootContext.d.ts +4 -2
- package/esm/scroll-area/root/stateAttributes.d.ts +2 -2
- package/esm/scroll-area/scrollbar/ScrollAreaScrollbar.d.ts +13 -7
- package/esm/scroll-area/scrollbar/ScrollAreaScrollbar.js +4 -1
- package/esm/scroll-area/thumb/ScrollAreaThumb.d.ts +5 -2
- package/esm/scroll-area/thumb/ScrollAreaThumb.js +3 -1
- package/esm/scroll-area/viewport/ScrollAreaViewport.d.ts +3 -3
- package/esm/scroll-area/viewport/ScrollAreaViewport.js +46 -27
- package/esm/select/arrow/SelectArrow.d.ts +10 -1
- package/esm/select/backdrop/SelectBackdrop.d.ts +7 -1
- package/esm/select/group/SelectGroup.d.ts +1 -1
- package/esm/select/group-label/SelectGroupLabel.d.ts +1 -1
- package/esm/select/icon/SelectIcon.d.ts +1 -1
- package/esm/select/index.d.ts +1 -0
- package/esm/select/index.parts.d.ts +1 -0
- package/esm/select/index.parts.js +1 -0
- package/esm/select/item/SelectItem.d.ts +1 -1
- package/esm/select/item/SelectItem.js +10 -4
- package/esm/select/item-indicator/SelectItemIndicator.d.ts +10 -2
- package/esm/select/item-indicator/SelectItemIndicatorDataAttributes.d.ts +10 -0
- package/esm/select/item-indicator/SelectItemIndicatorDataAttributes.js +12 -0
- package/esm/select/item-text/SelectItemText.d.ts +1 -1
- package/esm/select/label/SelectLabel.d.ts +16 -0
- package/esm/select/label/SelectLabel.js +49 -0
- package/esm/select/list/SelectList.d.ts +1 -1
- package/esm/select/popup/SelectPopup.d.ts +14 -2
- package/esm/select/popup/SelectPopup.js +23 -9
- package/esm/select/portal/SelectPortal.d.ts +3 -4
- package/esm/select/positioner/SelectPositioner.d.ts +14 -2
- package/esm/select/positioner/SelectPositionerContext.d.ts +2 -2
- package/esm/select/root/SelectRoot.d.ts +5 -4
- package/esm/select/root/SelectRoot.js +5 -6
- package/esm/select/scroll-arrow/SelectScrollArrow.d.ts +13 -1
- package/esm/select/scroll-down-arrow/SelectScrollDownArrow.d.ts +1 -1
- package/esm/select/scroll-up-arrow/SelectScrollUpArrow.d.ts +1 -1
- package/esm/select/store.d.ts +5 -2
- package/esm/select/store.js +1 -0
- package/esm/select/trigger/SelectTrigger.d.ts +6 -4
- package/esm/select/trigger/SelectTrigger.js +5 -2
- package/esm/select/value/SelectValue.d.ts +1 -1
- package/esm/separator/Separator.d.ts +1 -1
- package/esm/slider/control/SliderControl.d.ts +4 -3
- package/esm/slider/control/SliderControl.js +0 -2
- package/esm/slider/index.d.ts +1 -0
- package/esm/slider/index.parts.d.ts +1 -0
- package/esm/slider/index.parts.js +1 -0
- package/esm/slider/indicator/SliderIndicator.d.ts +4 -2
- package/esm/slider/label/SliderLabel.d.ts +16 -0
- package/esm/slider/label/SliderLabel.js +58 -0
- package/esm/slider/root/SliderRoot.d.ts +11 -5
- package/esm/slider/root/SliderRoot.js +8 -3
- package/esm/slider/root/SliderRootContext.d.ts +4 -2
- package/esm/slider/root/stateAttributesMapping.d.ts +2 -2
- package/esm/slider/thumb/SliderThumb.d.ts +5 -5
- package/esm/slider/thumb/SliderThumb.js +3 -2
- package/esm/slider/track/SliderTrack.d.ts +4 -2
- package/esm/slider/utils/resolveThumbCollision.d.ts +2 -2
- package/esm/slider/value/SliderValue.d.ts +5 -3
- package/esm/switch/root/SwitchRoot.d.ts +3 -3
- package/esm/switch/root/SwitchRoot.js +4 -1
- package/esm/switch/root/SwitchRootContext.d.ts +4 -4
- package/esm/switch/stateAttributesMapping.d.ts +2 -2
- package/esm/switch/thumb/SwitchThumb.d.ts +3 -3
- package/esm/tabs/indicator/TabsIndicator.d.ts +12 -3
- package/esm/tabs/indicator/TabsIndicator.js +5 -14
- package/esm/tabs/indicator/TabsIndicatorCssVars.d.ts +1 -1
- package/esm/tabs/indicator/TabsIndicatorCssVars.js +1 -1
- package/esm/tabs/list/TabsList.d.ts +3 -3
- package/esm/tabs/list/TabsList.js +48 -3
- package/esm/tabs/list/TabsListContext.d.ts +2 -0
- package/esm/tabs/panel/TabsPanel.d.ts +9 -3
- package/esm/tabs/panel/TabsPanelDataAttributes.d.ts +8 -0
- package/esm/tabs/panel/TabsPanelDataAttributes.js +10 -1
- package/esm/tabs/root/TabsRoot.d.ts +7 -1
- package/esm/tabs/root/TabsRootContext.d.ts +1 -1
- package/esm/tabs/root/stateAttributesMapping.d.ts +2 -2
- package/esm/tabs/tab/TabsTab.d.ts +7 -1
- package/esm/tabs/tab/TabsTab.js +10 -1
- package/esm/toast/action/ToastAction.d.ts +1 -1
- package/esm/toast/arrow/ToastArrow.d.ts +10 -1
- package/esm/toast/close/ToastClose.d.ts +1 -1
- package/esm/toast/content/ToastContent.d.ts +1 -1
- package/esm/toast/createToastManager.d.ts +1 -1
- package/esm/toast/description/ToastDescription.d.ts +1 -1
- package/esm/toast/portal/ToastPortal.d.ts +3 -4
- package/esm/toast/positioner/ToastPositioner.d.ts +12 -3
- package/esm/toast/provider/ToastProvider.d.ts +2 -0
- package/esm/toast/provider/ToastProvider.js +1 -1
- package/esm/toast/root/ToastRoot.d.ts +20 -7
- package/esm/toast/root/ToastRoot.js +3 -1
- package/esm/toast/store.d.ts +1 -1
- package/esm/toast/store.js +37 -8
- package/esm/toast/title/ToastTitle.d.ts +1 -1
- package/esm/toast/useToastManager.d.ts +3 -3
- package/esm/toast/viewport/ToastViewport.d.ts +1 -1
- package/esm/toggle/Toggle.d.ts +1 -1
- package/esm/toggle-group/ToggleGroup.d.ts +1 -1
- package/esm/toolbar/button/ToolbarButton.d.ts +9 -3
- package/esm/toolbar/group/ToolbarGroup.d.ts +4 -2
- package/esm/toolbar/input/ToolbarInput.d.ts +9 -3
- package/esm/toolbar/link/ToolbarLink.d.ts +4 -1
- package/esm/toolbar/root/ToolbarRoot.d.ts +7 -1
- package/esm/toolbar/separator/ToolbarSeparator.d.ts +4 -2
- package/esm/tooltip/arrow/TooltipArrow.d.ts +13 -1
- package/esm/tooltip/popup/TooltipPopup.d.ts +13 -1
- package/esm/tooltip/portal/TooltipPortal.d.ts +3 -4
- package/esm/tooltip/positioner/TooltipPositioner.d.ts +11 -2
- package/esm/tooltip/provider/TooltipProvider.d.ts +2 -0
- package/esm/tooltip/root/TooltipRoot.d.ts +3 -3
- package/esm/tooltip/root/TooltipRoot.js +1 -1
- package/esm/tooltip/store/TooltipStore.d.ts +2 -0
- package/esm/tooltip/store/TooltipStore.js +2 -0
- package/esm/tooltip/trigger/TooltipTrigger.d.ts +6 -1
- package/esm/tooltip/trigger/TooltipTrigger.js +5 -0
- package/esm/tooltip/viewport/TooltipViewport.d.ts +16 -12
- package/esm/types/index.d.ts +16 -1
- package/esm/unstable-use-media-query/index.d.ts +2 -0
- package/esm/use-button/useButton.d.ts +8 -5
- package/esm/use-button/useButton.js +49 -20
- package/esm/use-render/useRender.d.ts +7 -5
- package/esm/utils/FloatingPortalLite.d.ts +4 -2
- package/esm/utils/InternalBackdrop.d.ts +3 -1
- package/esm/utils/closePart.d.ts +16 -0
- package/esm/utils/closePart.js +40 -0
- package/esm/utils/constants.d.ts +4 -0
- package/esm/utils/constants.js +4 -0
- package/esm/utils/createBaseUIEventDetails.d.ts +1 -1
- package/esm/utils/getElementAtPoint.d.ts +1 -0
- package/esm/utils/getElementAtPoint.js +3 -0
- package/esm/utils/resolveAriaLabelledBy.d.ts +2 -0
- package/esm/utils/resolveAriaLabelledBy.js +8 -0
- package/esm/utils/resolveValueLabel.d.ts +4 -4
- package/esm/utils/resolveValueLabel.js +7 -5
- package/esm/utils/types.d.ts +7 -20
- package/esm/utils/useAnchorPositioning.d.ts +53 -18
- package/esm/utils/useAnchorPositioning.js +15 -6
- package/esm/utils/useFocusableWhenDisabled.d.ts +2 -5
- package/esm/utils/useMixedToggleClickHandler.d.ts +2 -4
- package/esm/utils/useOpenChangeComplete.d.ts +2 -4
- package/esm/utils/useOpenInteractionType.d.ts +0 -1
- package/esm/utils/useOpenInteractionType.js +7 -5
- package/esm/utils/usePopupAutoResize.js +1 -2
- package/esm/utils/usePopupViewport.js +11 -8
- package/esm/utils/useRegisteredLabelId.d.ts +1 -0
- package/esm/utils/useRegisteredLabelId.js +14 -0
- package/esm/utils/useRenderElement.d.ts +6 -9
- package/esm/utils/useRenderElement.js +15 -0
- package/esm/utils/useSwipeDismiss.d.ts +91 -92
- package/esm/utils/useSwipeDismiss.js +2 -1
- package/field/control/FieldControl.d.ts +3 -3
- package/field/description/FieldDescription.d.ts +3 -3
- package/field/error/FieldError.d.ts +7 -4
- package/field/error/FieldErrorDataAttributes.d.ts +8 -0
- package/field/error/FieldErrorDataAttributes.js +10 -1
- package/field/item/FieldItem.d.ts +4 -3
- package/field/item/FieldItem.js +2 -2
- package/field/label/FieldLabel.d.ts +3 -3
- package/field/label/FieldLabel.js +6 -51
- package/field/root/FieldRoot.d.ts +19 -2
- package/field/root/FieldRoot.js +2 -1
- package/field/root/FieldRootContext.d.ts +2 -2
- package/field/root/FieldRootContext.js +5 -12
- package/field/root/useFieldValidation.js +5 -4
- package/field/utils/constants.d.ts +3 -0
- package/field/utils/constants.js +12 -1
- package/field/validity/FieldValidity.d.ts +7 -1
- package/fieldset/legend/FieldsetLegend.d.ts +1 -1
- package/fieldset/root/FieldsetRoot.d.ts +1 -1
- package/floating-ui-react/components/FloatingDelayGroup.js +2 -2
- package/floating-ui-react/components/FloatingFocusManager.d.ts +12 -7
- package/floating-ui-react/components/FloatingFocusManager.js +29 -25
- package/floating-ui-react/components/FloatingPortal.d.ts +6 -4
- package/floating-ui-react/hooks/useClick.d.ts +2 -2
- package/floating-ui-react/hooks/useClientPoint.d.ts +1 -1
- package/floating-ui-react/hooks/useDismiss.d.ts +8 -12
- package/floating-ui-react/hooks/useDismiss.js +319 -260
- package/floating-ui-react/hooks/useFloatingRootContext.d.ts +2 -2
- package/floating-ui-react/hooks/useFocus.d.ts +1 -1
- package/floating-ui-react/hooks/useHover.d.ts +6 -14
- package/floating-ui-react/hooks/useHover.js +6 -32
- package/floating-ui-react/hooks/useHoverFloatingInteraction.d.ts +2 -3
- package/floating-ui-react/hooks/useHoverFloatingInteraction.js +53 -70
- package/floating-ui-react/hooks/useHoverInteractionSharedState.d.ts +12 -3
- package/floating-ui-react/hooks/useHoverInteractionSharedState.js +32 -4
- package/floating-ui-react/hooks/useHoverReferenceInteraction.d.ts +8 -3
- package/floating-ui-react/hooks/useHoverReferenceInteraction.js +60 -82
- package/floating-ui-react/hooks/useHoverShared.d.ts +28 -0
- package/floating-ui-react/hooks/useHoverShared.js +34 -0
- package/floating-ui-react/hooks/useListNavigation.d.ts +4 -4
- package/floating-ui-react/hooks/useListNavigation.js +7 -3
- package/floating-ui-react/hooks/useRole.d.ts +1 -1
- package/floating-ui-react/hooks/useTypeahead.d.ts +7 -1
- package/floating-ui-react/hooks/useTypeahead.js +29 -13
- package/floating-ui-react/safePolygon.d.ts +2 -6
- package/floating-ui-react/safePolygon.js +149 -119
- package/floating-ui-react/types.d.ts +5 -4
- package/floating-ui-react/utils/composite.d.ts +1 -0
- package/floating-ui-react/utils/composite.js +129 -129
- package/floating-ui-react/utils/markOthers.d.ts +7 -1
- package/floating-ui-react/utils/markOthers.js +118 -80
- package/form/Form.d.ts +1 -1
- package/global.d.ts +1 -1
- package/index.js +1 -1
- package/input/Input.d.ts +10 -3
- package/labelable-provider/LabelableProvider.d.ts +4 -1
- package/labelable-provider/LabelableProvider.js +3 -2
- package/labelable-provider/useAriaLabelledBy.d.ts +9 -0
- package/labelable-provider/useAriaLabelledBy.js +61 -0
- package/labelable-provider/useLabel.d.ts +25 -0
- package/labelable-provider/useLabel.js +80 -0
- package/labelable-provider/useLabelableId.d.ts +2 -5
- package/menu/arrow/MenuArrow.d.ts +10 -1
- package/menu/backdrop/MenuBackdrop.d.ts +4 -1
- package/menu/checkbox-item/MenuCheckboxItem.d.ts +3 -3
- package/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.d.ts +7 -1
- package/menu/group/MenuGroup.d.ts +1 -1
- package/menu/group-label/MenuGroupLabel.d.ts +1 -1
- package/menu/index.d.ts +2 -1
- package/menu/index.parts.d.ts +1 -0
- package/menu/index.parts.js +7 -0
- package/menu/item/MenuItem.d.ts +1 -1
- package/menu/item/useMenuItem.d.ts +8 -7
- package/menu/item/useMenuItem.js +5 -7
- package/menu/item/useMenuItemCommonProps.d.ts +7 -4
- package/menu/item/useMenuItemCommonProps.js +16 -2
- package/menu/link-item/MenuLinkItem.d.ts +1 -1
- package/menu/link-item/MenuLinkItem.js +16 -2
- package/menu/popup/MenuPopup.d.ts +20 -5
- package/menu/popup/MenuPopup.js +4 -1
- package/menu/popup/MenuPopupDataAttributes.d.ts +1 -1
- package/menu/popup/MenuPopupDataAttributes.js +1 -1
- package/menu/portal/MenuPortal.d.ts +3 -4
- package/menu/positioner/MenuPositioner.d.ts +18 -2
- package/menu/positioner/MenuPositioner.js +56 -4
- package/menu/radio-group/MenuRadioGroup.d.ts +6 -3
- package/menu/radio-item/MenuRadioItem.d.ts +3 -3
- package/menu/radio-item-indicator/MenuRadioItemIndicator.d.ts +7 -1
- package/menu/root/MenuRoot.d.ts +4 -2
- package/menu/root/MenuRoot.js +2 -3
- package/menu/store/MenuStore.d.ts +4 -2
- package/menu/store/MenuStore.js +15 -1
- package/menu/submenu-trigger/MenuSubmenuTrigger.js +1 -0
- package/menu/trigger/MenuTrigger.d.ts +3 -3
- package/menu/viewport/MenuViewport.d.ts +30 -0
- package/menu/viewport/MenuViewport.js +66 -0
- package/menu/viewport/MenuViewportCssVars.d.ts +14 -0
- package/menu/viewport/MenuViewportCssVars.js +21 -0
- package/menu/viewport/MenuViewportDataAttributes.d.ts +26 -0
- package/menu/viewport/MenuViewportDataAttributes.js +33 -0
- package/menubar/Menubar.d.ts +1 -1
- package/menubar/Menubar.js +1 -7
- package/meter/indicator/MeterIndicator.d.ts +4 -2
- package/meter/label/MeterLabel.d.ts +4 -2
- package/meter/label/MeterLabel.js +4 -8
- package/meter/root/MeterRoot.d.ts +1 -1
- package/meter/root/MeterRoot.js +10 -1
- package/meter/track/MeterTrack.d.ts +4 -2
- package/meter/value/MeterValue.d.ts +5 -3
- package/navigation-menu/arrow/NavigationMenuArrow.d.ts +10 -1
- package/navigation-menu/backdrop/NavigationMenuBackdrop.d.ts +1 -1
- package/navigation-menu/content/NavigationMenuContent.d.ts +1 -1
- package/navigation-menu/content/NavigationMenuContent.js +11 -0
- package/navigation-menu/icon/NavigationMenuIcon.d.ts +1 -1
- package/navigation-menu/item/NavigationMenuItem.d.ts +1 -1
- package/navigation-menu/link/NavigationMenuLink.d.ts +1 -1
- package/navigation-menu/list/NavigationMenuList.d.ts +1 -1
- package/navigation-menu/list/NavigationMenuList.js +10 -1
- package/navigation-menu/popup/NavigationMenuPopup.d.ts +1 -1
- package/navigation-menu/portal/NavigationMenuPortal.d.ts +4 -5
- package/navigation-menu/positioner/NavigationMenuPositioner.d.ts +11 -2
- package/navigation-menu/root/NavigationMenuRoot.d.ts +4 -4
- package/navigation-menu/root/NavigationMenuRoot.js +26 -7
- package/navigation-menu/trigger/NavigationMenuTrigger.d.ts +1 -1
- package/navigation-menu/trigger/NavigationMenuTrigger.js +362 -17
- package/navigation-menu/utils/isOutsideMenuEvent.d.ts +1 -1
- package/navigation-menu/viewport/NavigationMenuViewport.d.ts +1 -1
- package/navigation-menu/viewport/NavigationMenuViewport.js +0 -19
- package/number-field/decrement/NumberFieldDecrement.d.ts +3 -3
- package/number-field/group/NumberFieldGroup.d.ts +3 -3
- package/number-field/increment/NumberFieldIncrement.d.ts +3 -3
- package/number-field/input/NumberFieldInput.d.ts +3 -3
- package/number-field/root/NumberFieldRoot.d.ts +4 -4
- package/number-field/root/NumberFieldRoot.js +1 -1
- package/number-field/root/NumberFieldRootContext.d.ts +2 -2
- package/number-field/root/useNumberFieldButton.d.ts +2 -5
- package/number-field/scrub-area/NumberFieldScrubArea.d.ts +4 -4
- package/number-field/scrub-area-cursor/NumberFieldScrubAreaCursor.d.ts +3 -3
- package/number-field/utils/stateAttributesMapping.d.ts +2 -2
- package/number-field/utils/types.d.ts +2 -2
- package/package.json +183 -7
- package/popover/arrow/PopoverArrow.d.ts +10 -1
- package/popover/backdrop/PopoverBackdrop.d.ts +4 -1
- package/popover/close/PopoverClose.d.ts +1 -1
- package/popover/close/PopoverClose.js +5 -3
- package/popover/description/PopoverDescription.d.ts +1 -1
- package/popover/popup/PopoverPopup.d.ts +15 -3
- package/popover/popup/PopoverPopup.js +11 -2
- package/popover/portal/PopoverPortal.d.ts +3 -4
- package/popover/positioner/PopoverPositioner.d.ts +11 -2
- package/popover/root/PopoverRoot.d.ts +10 -3
- package/popover/root/PopoverRoot.js +1 -3
- package/popover/title/PopoverTitle.d.ts +1 -1
- package/popover/viewport/PopoverViewport.d.ts +16 -12
- package/preview-card/arrow/PreviewCardArrow.d.ts +10 -1
- package/preview-card/backdrop/PreviewCardBackdrop.d.ts +4 -1
- package/preview-card/popup/PreviewCardPopup.d.ts +13 -1
- package/preview-card/portal/PreviewCardPortal.d.ts +3 -4
- package/preview-card/positioner/PreviewCardPositioner.d.ts +14 -2
- package/preview-card/positioner/PreviewCardPositioner.js +7 -1
- package/preview-card/root/PreviewCardRoot.d.ts +3 -3
- package/preview-card/root/PreviewCardRoot.js +20 -7
- package/preview-card/trigger/PreviewCardTrigger.d.ts +1 -1
- package/preview-card/viewport/PreviewCardViewport.d.ts +16 -9
- package/progress/indicator/ProgressIndicator.d.ts +4 -2
- package/progress/label/ProgressLabel.d.ts +4 -2
- package/progress/label/ProgressLabel.js +4 -8
- package/progress/root/ProgressRoot.d.ts +4 -1
- package/progress/root/ProgressRoot.js +10 -1
- package/progress/root/ProgressRootContext.d.ts +2 -2
- package/progress/root/stateAttributesMapping.d.ts +2 -2
- package/progress/track/ProgressTrack.d.ts +4 -2
- package/progress/value/ProgressValue.d.ts +5 -3
- package/radio/indicator/RadioIndicator.d.ts +4 -1
- package/radio/indicator/RadioIndicatorDataAttributes.d.ts +8 -0
- package/radio/indicator/RadioIndicatorDataAttributes.js +10 -1
- package/radio/root/RadioRoot.d.ts +3 -3
- package/radio/root/RadioRoot.js +4 -1
- package/radio-group/RadioGroup.d.ts +3 -3
- package/scroll-area/content/ScrollAreaContent.d.ts +3 -3
- package/scroll-area/corner/ScrollAreaCorner.d.ts +1 -1
- package/scroll-area/root/ScrollAreaRoot.d.ts +27 -11
- package/scroll-area/root/ScrollAreaRoot.js +7 -4
- package/scroll-area/root/ScrollAreaRootContext.d.ts +4 -2
- package/scroll-area/root/stateAttributes.d.ts +2 -2
- package/scroll-area/scrollbar/ScrollAreaScrollbar.d.ts +13 -7
- package/scroll-area/scrollbar/ScrollAreaScrollbar.js +4 -1
- package/scroll-area/thumb/ScrollAreaThumb.d.ts +5 -2
- package/scroll-area/thumb/ScrollAreaThumb.js +3 -1
- package/scroll-area/viewport/ScrollAreaViewport.d.ts +3 -3
- package/scroll-area/viewport/ScrollAreaViewport.js +46 -27
- package/select/arrow/SelectArrow.d.ts +10 -1
- package/select/backdrop/SelectBackdrop.d.ts +7 -1
- package/select/group/SelectGroup.d.ts +1 -1
- package/select/group-label/SelectGroupLabel.d.ts +1 -1
- package/select/icon/SelectIcon.d.ts +1 -1
- package/select/index.d.ts +1 -0
- package/select/index.parts.d.ts +1 -0
- package/select/index.parts.js +7 -0
- package/select/item/SelectItem.d.ts +1 -1
- package/select/item/SelectItem.js +10 -4
- package/select/item-indicator/SelectItemIndicator.d.ts +10 -2
- package/select/item-indicator/SelectItemIndicatorDataAttributes.d.ts +10 -0
- package/select/item-indicator/SelectItemIndicatorDataAttributes.js +18 -0
- package/select/item-text/SelectItemText.d.ts +1 -1
- package/select/label/SelectLabel.d.ts +16 -0
- package/select/label/SelectLabel.js +54 -0
- package/select/list/SelectList.d.ts +1 -1
- package/select/popup/SelectPopup.d.ts +14 -2
- package/select/popup/SelectPopup.js +26 -12
- package/select/portal/SelectPortal.d.ts +3 -4
- package/select/positioner/SelectPositioner.d.ts +14 -2
- package/select/positioner/SelectPositionerContext.d.ts +2 -2
- package/select/root/SelectRoot.d.ts +5 -4
- package/select/root/SelectRoot.js +5 -6
- package/select/scroll-arrow/SelectScrollArrow.d.ts +13 -1
- package/select/scroll-down-arrow/SelectScrollDownArrow.d.ts +1 -1
- package/select/scroll-up-arrow/SelectScrollUpArrow.d.ts +1 -1
- package/select/store.d.ts +5 -2
- package/select/store.js +1 -0
- package/select/trigger/SelectTrigger.d.ts +6 -4
- package/select/trigger/SelectTrigger.js +5 -2
- package/select/value/SelectValue.d.ts +1 -1
- package/separator/Separator.d.ts +1 -1
- package/slider/control/SliderControl.d.ts +4 -3
- package/slider/control/SliderControl.js +0 -2
- package/slider/index.d.ts +1 -0
- package/slider/index.parts.d.ts +1 -0
- package/slider/index.parts.js +7 -0
- package/slider/indicator/SliderIndicator.d.ts +4 -2
- package/slider/label/SliderLabel.d.ts +16 -0
- package/slider/label/SliderLabel.js +63 -0
- package/slider/root/SliderRoot.d.ts +11 -5
- package/slider/root/SliderRoot.js +8 -3
- package/slider/root/SliderRootContext.d.ts +4 -2
- package/slider/root/stateAttributesMapping.d.ts +2 -2
- package/slider/thumb/SliderThumb.d.ts +5 -5
- package/slider/thumb/SliderThumb.js +3 -2
- package/slider/track/SliderTrack.d.ts +4 -2
- package/slider/utils/resolveThumbCollision.d.ts +2 -2
- package/slider/value/SliderValue.d.ts +5 -3
- package/switch/root/SwitchRoot.d.ts +3 -3
- package/switch/root/SwitchRoot.js +4 -1
- package/switch/root/SwitchRootContext.d.ts +4 -4
- package/switch/stateAttributesMapping.d.ts +2 -2
- package/switch/thumb/SwitchThumb.d.ts +3 -3
- package/tabs/indicator/TabsIndicator.d.ts +12 -3
- package/tabs/indicator/TabsIndicator.js +5 -14
- package/tabs/indicator/TabsIndicatorCssVars.d.ts +1 -1
- package/tabs/indicator/TabsIndicatorCssVars.js +1 -1
- package/tabs/list/TabsList.d.ts +3 -3
- package/tabs/list/TabsList.js +48 -3
- package/tabs/list/TabsListContext.d.ts +2 -0
- package/tabs/panel/TabsPanel.d.ts +9 -3
- package/tabs/panel/TabsPanelDataAttributes.d.ts +8 -0
- package/tabs/panel/TabsPanelDataAttributes.js +10 -1
- package/tabs/root/TabsRoot.d.ts +7 -1
- package/tabs/root/TabsRootContext.d.ts +1 -1
- package/tabs/root/stateAttributesMapping.d.ts +2 -2
- package/tabs/tab/TabsTab.d.ts +7 -1
- package/tabs/tab/TabsTab.js +10 -1
- package/toast/action/ToastAction.d.ts +1 -1
- package/toast/arrow/ToastArrow.d.ts +10 -1
- package/toast/close/ToastClose.d.ts +1 -1
- package/toast/content/ToastContent.d.ts +1 -1
- package/toast/createToastManager.d.ts +1 -1
- package/toast/description/ToastDescription.d.ts +1 -1
- package/toast/portal/ToastPortal.d.ts +3 -4
- package/toast/positioner/ToastPositioner.d.ts +12 -3
- package/toast/provider/ToastProvider.d.ts +2 -0
- package/toast/provider/ToastProvider.js +1 -1
- package/toast/root/ToastRoot.d.ts +20 -7
- package/toast/root/ToastRoot.js +3 -1
- package/toast/store.d.ts +1 -1
- package/toast/store.js +37 -8
- package/toast/title/ToastTitle.d.ts +1 -1
- package/toast/useToastManager.d.ts +3 -3
- package/toast/viewport/ToastViewport.d.ts +1 -1
- package/toggle/Toggle.d.ts +1 -1
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toolbar/button/ToolbarButton.d.ts +9 -3
- package/toolbar/group/ToolbarGroup.d.ts +4 -2
- package/toolbar/input/ToolbarInput.d.ts +9 -3
- package/toolbar/link/ToolbarLink.d.ts +4 -1
- package/toolbar/root/ToolbarRoot.d.ts +7 -1
- package/toolbar/separator/ToolbarSeparator.d.ts +4 -2
- package/tooltip/arrow/TooltipArrow.d.ts +13 -1
- package/tooltip/popup/TooltipPopup.d.ts +13 -1
- package/tooltip/portal/TooltipPortal.d.ts +3 -4
- package/tooltip/positioner/TooltipPositioner.d.ts +11 -2
- package/tooltip/provider/TooltipProvider.d.ts +2 -0
- package/tooltip/root/TooltipRoot.d.ts +3 -3
- package/tooltip/root/TooltipRoot.js +1 -1
- package/tooltip/store/TooltipStore.d.ts +2 -0
- package/tooltip/store/TooltipStore.js +2 -0
- package/tooltip/trigger/TooltipTrigger.d.ts +6 -1
- package/tooltip/trigger/TooltipTrigger.js +5 -0
- package/tooltip/viewport/TooltipViewport.d.ts +16 -12
- package/types/index.d.ts +16 -1
- package/unstable-use-media-query/index.d.ts +2 -0
- package/use-button/useButton.d.ts +8 -5
- package/use-button/useButton.js +49 -20
- package/use-render/useRender.d.ts +7 -5
- package/utils/FloatingPortalLite.d.ts +4 -2
- package/utils/InternalBackdrop.d.ts +3 -1
- package/utils/closePart.d.ts +16 -0
- package/utils/closePart.js +48 -0
- package/utils/constants.d.ts +4 -0
- package/utils/constants.js +6 -2
- package/utils/createBaseUIEventDetails.d.ts +1 -1
- package/utils/getElementAtPoint.d.ts +1 -0
- package/utils/getElementAtPoint.js +9 -0
- package/utils/resolveAriaLabelledBy.d.ts +2 -0
- package/utils/resolveAriaLabelledBy.js +14 -0
- package/utils/resolveValueLabel.d.ts +4 -4
- package/utils/resolveValueLabel.js +7 -5
- package/utils/types.d.ts +7 -20
- package/utils/useAnchorPositioning.d.ts +53 -18
- package/utils/useAnchorPositioning.js +15 -6
- package/utils/useFocusableWhenDisabled.d.ts +2 -5
- package/utils/useMixedToggleClickHandler.d.ts +2 -4
- package/utils/useOpenChangeComplete.d.ts +2 -4
- package/utils/useOpenInteractionType.d.ts +0 -1
- package/utils/useOpenInteractionType.js +7 -5
- package/utils/usePopupAutoResize.js +1 -2
- package/utils/usePopupViewport.js +11 -8
- package/utils/useRegisteredLabelId.d.ts +1 -0
- package/utils/useRegisteredLabelId.js +19 -0
- package/utils/useRenderElement.d.ts +6 -9
- package/utils/useRenderElement.js +15 -0
- package/utils/useSwipeDismiss.d.ts +91 -92
- package/utils/useSwipeDismiss.js +2 -1
- package/esm/navigation-menu/utils/setFixedSize.d.ts +0 -1
- package/esm/navigation-menu/utils/setFixedSize.js +0 -11
- package/navigation-menu/utils/setFixedSize.d.ts +0 -1
- package/navigation-menu/utils/setFixedSize.js +0 -17
|
@@ -3,16 +3,11 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { error } from '@base-ui/utils/error';
|
|
5
5
|
import { SafeReact } from '@base-ui/utils/safeReact';
|
|
6
|
-
import { isHTMLElement } from '@floating-ui/utils/dom';
|
|
7
|
-
import { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';
|
|
8
|
-
import { ownerDocument } from '@base-ui/utils/owner';
|
|
9
|
-
import { useStableCallback } from '@base-ui/utils/useStableCallback';
|
|
10
|
-
import { getTarget } from "../../floating-ui-react/utils.js";
|
|
11
6
|
import { useFieldRootContext } from "../root/FieldRootContext.js";
|
|
12
|
-
import { useLabelableContext } from "../../labelable-provider/LabelableContext.js";
|
|
13
7
|
import { fieldValidityMapping } from "../utils/constants.js";
|
|
14
|
-
import { useBaseUiId } from "../../utils/useBaseUiId.js";
|
|
15
8
|
import { useRenderElement } from "../../utils/useRenderElement.js";
|
|
9
|
+
import { useLabelableContext } from "../../labelable-provider/LabelableContext.js";
|
|
10
|
+
import { useLabel } from "../../labelable-provider/useLabel.js";
|
|
16
11
|
|
|
17
12
|
/**
|
|
18
13
|
* An accessible label that is automatically associated with the field control.
|
|
@@ -30,34 +25,12 @@ export const FieldLabel = /*#__PURE__*/React.forwardRef(function FieldLabel(comp
|
|
|
30
25
|
} = componentProps;
|
|
31
26
|
const fieldRootContext = useFieldRootContext(false);
|
|
32
27
|
const {
|
|
33
|
-
controlId,
|
|
34
|
-
setLabelId,
|
|
35
28
|
labelId
|
|
36
29
|
} = useLabelableContext();
|
|
37
|
-
const id = useBaseUiId(idProp);
|
|
38
30
|
const labelRef = React.useRef(null);
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Prevent text selection when double clicking label.
|
|
46
|
-
if (!event.defaultPrevented && event.detail > 1) {
|
|
47
|
-
event.preventDefault();
|
|
48
|
-
}
|
|
49
|
-
if (nativeLabel || !controlId) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const controlElement = ownerDocument(event.currentTarget).getElementById(controlId);
|
|
53
|
-
if (isHTMLElement(controlElement)) {
|
|
54
|
-
controlElement.focus({
|
|
55
|
-
// Available from Chrome 144+ (January 2026).
|
|
56
|
-
// Safari and Firefox already support it.
|
|
57
|
-
// @ts-expect-error not available in types yet
|
|
58
|
-
focusVisible: true
|
|
59
|
-
});
|
|
60
|
-
}
|
|
31
|
+
const labelProps = useLabel({
|
|
32
|
+
id: labelId ?? idProp,
|
|
33
|
+
native: nativeLabel
|
|
61
34
|
});
|
|
62
35
|
if (process.env.NODE_ENV !== 'production') {
|
|
63
36
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -79,28 +52,10 @@ export const FieldLabel = /*#__PURE__*/React.forwardRef(function FieldLabel(comp
|
|
|
79
52
|
}
|
|
80
53
|
}, [nativeLabel]);
|
|
81
54
|
}
|
|
82
|
-
useIsoLayoutEffect(() => {
|
|
83
|
-
if (id) {
|
|
84
|
-
setLabelId(id);
|
|
85
|
-
}
|
|
86
|
-
return () => {
|
|
87
|
-
setLabelId(undefined);
|
|
88
|
-
};
|
|
89
|
-
}, [id, setLabelId]);
|
|
90
55
|
const element = useRenderElement('label', componentProps, {
|
|
91
56
|
ref: [forwardedRef, labelRef],
|
|
92
57
|
state: fieldRootContext.state,
|
|
93
|
-
props: [
|
|
94
|
-
id: labelId
|
|
95
|
-
}, nativeLabel ? {
|
|
96
|
-
htmlFor: controlId ?? undefined,
|
|
97
|
-
onMouseDown: handleInteraction
|
|
98
|
-
} : {
|
|
99
|
-
onClick: handleInteraction,
|
|
100
|
-
onPointerDown(event) {
|
|
101
|
-
event.preventDefault();
|
|
102
|
-
}
|
|
103
|
-
}, elementProps],
|
|
58
|
+
props: [labelProps, elementProps],
|
|
104
59
|
stateAttributesMapping: fieldValidityMapping
|
|
105
60
|
});
|
|
106
61
|
return element;
|
|
@@ -31,15 +31,32 @@ export interface FieldRootActions {
|
|
|
31
31
|
validate: () => void;
|
|
32
32
|
}
|
|
33
33
|
export interface FieldRootState {
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Whether the component should ignore user interaction.
|
|
36
|
+
*/
|
|
35
37
|
disabled: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the field has been touched.
|
|
40
|
+
*/
|
|
36
41
|
touched: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the field value has changed from its initial value.
|
|
44
|
+
*/
|
|
37
45
|
dirty: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the field is valid.
|
|
48
|
+
*/
|
|
38
49
|
valid: boolean | null;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the field has a value.
|
|
52
|
+
*/
|
|
39
53
|
filled: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the field is focused.
|
|
56
|
+
*/
|
|
40
57
|
focused: boolean;
|
|
41
58
|
}
|
|
42
|
-
export interface FieldRootProps extends BaseUIComponentProps<'div',
|
|
59
|
+
export interface FieldRootProps extends BaseUIComponentProps<'div', FieldRootState> {
|
|
43
60
|
/**
|
|
44
61
|
* Whether the component should ignore user interaction.
|
|
45
62
|
* Takes precedence over the `disabled` prop on the `<Field.Control>` component.
|
|
@@ -62,7 +62,8 @@ const FieldRootInner = /*#__PURE__*/React.forwardRef(function FieldRootInner(com
|
|
|
62
62
|
setTouchedUnwrapped(value);
|
|
63
63
|
});
|
|
64
64
|
const shouldValidateOnChange = useStableCallback(() => validationMode === 'onChange' || validationMode === 'onSubmit' && submitAttemptedRef.current);
|
|
65
|
-
const
|
|
65
|
+
const hasFormError = !!name && Object.hasOwn(errors, name) && errors[name] !== undefined;
|
|
66
|
+
const invalid = invalidProp === true || hasFormError;
|
|
66
67
|
const [validityData, setValidityData] = React.useState({
|
|
67
68
|
state: DEFAULT_VALIDITY_STATE,
|
|
68
69
|
error: '',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FieldValidityData, FieldRootState } from "./FieldRoot.js";
|
|
3
3
|
import type { Form } from "../../form/index.js";
|
|
4
4
|
import type { UseFieldValidationReturnValue } from "./useFieldValidation.js";
|
|
5
5
|
export interface FieldRootContext {
|
|
@@ -20,7 +20,7 @@ export interface FieldRootContext {
|
|
|
20
20
|
validationMode: Form.ValidationMode;
|
|
21
21
|
validationDebounceTime: number;
|
|
22
22
|
shouldValidateOnChange: () => boolean;
|
|
23
|
-
state:
|
|
23
|
+
state: FieldRootState;
|
|
24
24
|
markedDirtyRef: React.RefObject<boolean>;
|
|
25
25
|
validation: UseFieldValidationReturnValue;
|
|
26
26
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _formatErrorMessage from "@base-ui/utils/formatErrorMessage";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { NOOP } from "../../utils/noop.js";
|
|
6
|
-
import { DEFAULT_VALIDITY_STATE } from "../utils/constants.js";
|
|
6
|
+
import { DEFAULT_FIELD_ROOT_STATE, DEFAULT_FIELD_STATE_ATTRIBUTES, DEFAULT_VALIDITY_STATE } from "../utils/constants.js";
|
|
7
7
|
import { EMPTY_OBJECT } from "../../utils/constants.js";
|
|
8
8
|
export const FieldRootContext = /*#__PURE__*/React.createContext({
|
|
9
9
|
invalid: undefined,
|
|
@@ -17,26 +17,19 @@ export const FieldRootContext = /*#__PURE__*/React.createContext({
|
|
|
17
17
|
},
|
|
18
18
|
setValidityData: NOOP,
|
|
19
19
|
disabled: undefined,
|
|
20
|
-
touched:
|
|
20
|
+
touched: DEFAULT_FIELD_STATE_ATTRIBUTES.touched,
|
|
21
21
|
setTouched: NOOP,
|
|
22
|
-
dirty:
|
|
22
|
+
dirty: DEFAULT_FIELD_STATE_ATTRIBUTES.dirty,
|
|
23
23
|
setDirty: NOOP,
|
|
24
|
-
filled:
|
|
24
|
+
filled: DEFAULT_FIELD_STATE_ATTRIBUTES.filled,
|
|
25
25
|
setFilled: NOOP,
|
|
26
|
-
focused:
|
|
26
|
+
focused: DEFAULT_FIELD_STATE_ATTRIBUTES.focused,
|
|
27
27
|
setFocused: NOOP,
|
|
28
28
|
validate: () => null,
|
|
29
29
|
validationMode: 'onSubmit',
|
|
30
30
|
validationDebounceTime: 0,
|
|
31
31
|
shouldValidateOnChange: () => false,
|
|
32
|
-
state:
|
|
33
|
-
disabled: false,
|
|
34
|
-
valid: null,
|
|
35
|
-
touched: false,
|
|
36
|
-
dirty: false,
|
|
37
|
-
filled: false,
|
|
38
|
-
focused: false
|
|
39
|
-
},
|
|
32
|
+
state: DEFAULT_FIELD_ROOT_STATE,
|
|
40
33
|
markedDirtyRef: {
|
|
41
34
|
current: false
|
|
42
35
|
},
|
|
@@ -191,6 +191,7 @@ export function useFieldValidation(params) {
|
|
|
191
191
|
if (currentFieldData) {
|
|
192
192
|
formRef.current.fields.set(controlId, {
|
|
193
193
|
...currentFieldData,
|
|
194
|
+
// Keep Form-level errors part of overall field validity for submit blocking/focus logic.
|
|
194
195
|
...getCombinedFieldValidityData(nextValidityData, invalid)
|
|
195
196
|
});
|
|
196
197
|
}
|
|
@@ -211,9 +212,9 @@ export function useFieldValidation(params) {
|
|
|
211
212
|
commit(event.currentTarget.value, true);
|
|
212
213
|
return;
|
|
213
214
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
|
|
216
|
+
// When validating on change, run client-side validation even if
|
|
217
|
+
// externally invalid
|
|
217
218
|
const element = event.currentTarget;
|
|
218
219
|
if (element.value === '') {
|
|
219
220
|
// Ignore the debounce time for empty values.
|
|
@@ -229,7 +230,7 @@ export function useFieldValidation(params) {
|
|
|
229
230
|
commit(element.value);
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
|
-
}, getValidationProps(externalProps)), [getValidationProps, clearErrors, name, timeout, commit,
|
|
233
|
+
}, getValidationProps(externalProps)), [getValidationProps, clearErrors, name, timeout, commit, validationDebounceTime, shouldValidateOnChange]);
|
|
233
234
|
return React.useMemo(() => ({
|
|
234
235
|
getValidationProps,
|
|
235
236
|
getInputValidationProps,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FieldRootState } from "../root/FieldRoot.js";
|
|
1
2
|
export declare const DEFAULT_VALIDITY_STATE: {
|
|
2
3
|
badInput: boolean;
|
|
3
4
|
customError: boolean;
|
|
@@ -11,6 +12,8 @@ export declare const DEFAULT_VALIDITY_STATE: {
|
|
|
11
12
|
valid: null;
|
|
12
13
|
valueMissing: boolean;
|
|
13
14
|
};
|
|
15
|
+
export declare const DEFAULT_FIELD_STATE_ATTRIBUTES: Pick<FieldRootState, 'valid' | 'touched' | 'dirty' | 'filled' | 'focused'>;
|
|
16
|
+
export declare const DEFAULT_FIELD_ROOT_STATE: FieldRootState;
|
|
14
17
|
export declare const fieldValidityMapping: {
|
|
15
18
|
valid(value: boolean | null): Record<string, string> | null;
|
|
16
19
|
};
|
|
@@ -12,6 +12,17 @@ export const DEFAULT_VALIDITY_STATE = {
|
|
|
12
12
|
valid: null,
|
|
13
13
|
valueMissing: false
|
|
14
14
|
};
|
|
15
|
+
export const DEFAULT_FIELD_STATE_ATTRIBUTES = {
|
|
16
|
+
valid: null,
|
|
17
|
+
touched: false,
|
|
18
|
+
dirty: false,
|
|
19
|
+
filled: false,
|
|
20
|
+
focused: false
|
|
21
|
+
};
|
|
22
|
+
export const DEFAULT_FIELD_ROOT_STATE = {
|
|
23
|
+
disabled: false,
|
|
24
|
+
...DEFAULT_FIELD_STATE_ATTRIBUTES
|
|
25
|
+
};
|
|
15
26
|
export const fieldValidityMapping = {
|
|
16
27
|
valid(value) {
|
|
17
28
|
if (value === null) {
|
|
@@ -9,7 +9,13 @@ import { type TransitionStatus } from "../../utils/useTransitionStatus.js";
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const FieldValidity: React.FC<FieldValidity.Props>;
|
|
11
11
|
export interface FieldValidityState extends Omit<FieldValidityData, 'state'> {
|
|
12
|
+
/**
|
|
13
|
+
* The validity state.
|
|
14
|
+
*/
|
|
12
15
|
validity: FieldValidityData['state'];
|
|
16
|
+
/**
|
|
17
|
+
* The transition status of the component.
|
|
18
|
+
*/
|
|
13
19
|
transitionStatus: TransitionStatus;
|
|
14
20
|
}
|
|
15
21
|
export interface FieldValidityProps {
|
|
@@ -24,7 +30,7 @@ export interface FieldValidityProps {
|
|
|
24
30
|
* </Field.Validity>
|
|
25
31
|
* ```
|
|
26
32
|
*/
|
|
27
|
-
children: (state:
|
|
33
|
+
children: (state: FieldValidityState) => React.ReactNode;
|
|
28
34
|
}
|
|
29
35
|
export declare namespace FieldValidity {
|
|
30
36
|
type State = FieldValidityState;
|
|
@@ -13,7 +13,7 @@ export interface FieldsetLegendState {
|
|
|
13
13
|
*/
|
|
14
14
|
disabled: boolean;
|
|
15
15
|
}
|
|
16
|
-
export interface FieldsetLegendProps extends BaseUIComponentProps<'div',
|
|
16
|
+
export interface FieldsetLegendProps extends BaseUIComponentProps<'div', FieldsetLegendState> {}
|
|
17
17
|
export declare namespace FieldsetLegend {
|
|
18
18
|
type State = FieldsetLegendState;
|
|
19
19
|
type Props = FieldsetLegendProps;
|
|
@@ -13,7 +13,7 @@ export interface FieldsetRootState {
|
|
|
13
13
|
*/
|
|
14
14
|
disabled: boolean;
|
|
15
15
|
}
|
|
16
|
-
export interface FieldsetRootProps extends BaseUIComponentProps<'fieldset',
|
|
16
|
+
export interface FieldsetRootProps extends BaseUIComponentProps<'fieldset', FieldsetRootState> {}
|
|
17
17
|
export declare namespace FieldsetRoot {
|
|
18
18
|
type State = FieldsetRootState;
|
|
19
19
|
type Props = FieldsetRootProps;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useTimeout, Timeout } from '@base-ui/utils/useTimeout';
|
|
5
5
|
import { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';
|
|
6
|
-
import { getDelay } from "../hooks/
|
|
6
|
+
import { getDelay } from "../hooks/useHoverShared.js";
|
|
7
7
|
import { createChangeEventDetails } from "../../utils/createBaseUIEventDetails.js";
|
|
8
8
|
import { REASONS } from "../../utils/reasons.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -11,7 +11,7 @@ export interface FloatingFocusManagerProps {
|
|
|
11
11
|
/**
|
|
12
12
|
* The interaction type used to open the floating element.
|
|
13
13
|
*/
|
|
14
|
-
openInteractionType?:
|
|
14
|
+
openInteractionType?: InteractionType | null | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* Whether or not the focus manager should be disabled. Useful to delay focus
|
|
17
17
|
* management until after a transition completes or some other conditional
|
|
@@ -30,7 +30,7 @@ export interface FloatingFocusManagerProps {
|
|
|
30
30
|
* or `false`/`undefined` to do nothing.
|
|
31
31
|
* @default true
|
|
32
32
|
*/
|
|
33
|
-
initialFocus?:
|
|
33
|
+
initialFocus?: boolean | React.RefObject<HTMLElement | null> | ((openType: InteractionType) => boolean | HTMLElement | null | void) | undefined;
|
|
34
34
|
/**
|
|
35
35
|
* Determines the element to focus when the floating element is closed.
|
|
36
36
|
*
|
|
@@ -42,7 +42,7 @@ export interface FloatingFocusManagerProps {
|
|
|
42
42
|
* or `false`/`undefined` to do nothing.
|
|
43
43
|
* @default true
|
|
44
44
|
*/
|
|
45
|
-
returnFocus?:
|
|
45
|
+
returnFocus?: boolean | React.RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | HTMLElement | null | void) | undefined;
|
|
46
46
|
/**
|
|
47
47
|
* Determines where focus should be restored if focus inside the floating element is lost
|
|
48
48
|
* (such as due to the removal of the currently focused element from the DOM).
|
|
@@ -53,7 +53,7 @@ export interface FloatingFocusManagerProps {
|
|
|
53
53
|
* - `false`: do not restore focus
|
|
54
54
|
* @default false
|
|
55
55
|
*/
|
|
56
|
-
restoreFocus?:
|
|
56
|
+
restoreFocus?: boolean | 'popup' | undefined;
|
|
57
57
|
/**
|
|
58
58
|
* Determines if focus is “modal”, meaning focus is fully trapped inside the
|
|
59
59
|
* floating element and outside content cannot be accessed. This includes
|
|
@@ -72,20 +72,25 @@ export interface FloatingFocusManagerProps {
|
|
|
72
72
|
/**
|
|
73
73
|
* Overrides the element to focus when tabbing forward out of the floating element.
|
|
74
74
|
*/
|
|
75
|
-
nextFocusableElement?:
|
|
75
|
+
nextFocusableElement?: HTMLElement | React.RefObject<HTMLElement | null> | null | undefined;
|
|
76
76
|
/**
|
|
77
77
|
* Overrides the element to focus when tabbing backward out of the floating element.
|
|
78
78
|
*/
|
|
79
|
-
previousFocusableElement?:
|
|
79
|
+
previousFocusableElement?: HTMLElement | React.RefObject<HTMLElement | null> | null | undefined;
|
|
80
80
|
/**
|
|
81
81
|
* Ref to the focus guard preceding the floating element content.
|
|
82
|
-
* Can be useful to focus the popup
|
|
82
|
+
* Can be useful to focus the popup programmatically.
|
|
83
83
|
*/
|
|
84
84
|
beforeContentFocusGuardRef?: React.RefObject<HTMLSpanElement | null> | undefined;
|
|
85
85
|
/**
|
|
86
86
|
* External FlatingTree to use when the one provided by context can't be used.
|
|
87
87
|
*/
|
|
88
88
|
externalTree?: FloatingTreeStore | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Additional elements that should be treated as part of the floating subtree
|
|
91
|
+
* even if they are rendered outside the floating element itself.
|
|
92
|
+
*/
|
|
93
|
+
getInsideElements?: (() => Array<Element | null | undefined>) | undefined;
|
|
89
94
|
}
|
|
90
95
|
/**
|
|
91
96
|
* Provides focus management for the floating element.
|
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { tabbable, isTabbable, focusable } from 'tabbable';
|
|
5
|
-
import {
|
|
5
|
+
import { getNodeName, isHTMLElement } from '@floating-ui/utils/dom';
|
|
6
6
|
import { useMergedRefs } from '@base-ui/utils/useMergedRefs';
|
|
7
7
|
import { useValueAsRef } from '@base-ui/utils/useValueAsRef';
|
|
8
8
|
import { useStableCallback } from '@base-ui/utils/useStableCallback';
|
|
9
9
|
import { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';
|
|
10
|
-
import { visuallyHidden } from '@base-ui/utils/visuallyHidden';
|
|
11
10
|
import { useTimeout } from '@base-ui/utils/useTimeout';
|
|
12
11
|
import { isWebKit } from '@base-ui/utils/detectBrowser';
|
|
13
12
|
import { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';
|
|
14
13
|
import { ownerDocument, ownerWindow } from '@base-ui/utils/owner';
|
|
15
14
|
import { FocusGuard } from "../../utils/FocusGuard.js";
|
|
16
|
-
import { activeElement, contains, getTarget, isTypeableCombobox, isVirtualClick, isVirtualPointerEvent, stopEvent, getNodeAncestors, getNodeChildren, getFloatingFocusElement, getTabbableOptions, isOutsideEvent, getNextTabbable, getPreviousTabbable, isTypeableElement } from "../utils.js";
|
|
15
|
+
import { activeElement, contains, getTarget, isTypeableCombobox, isVirtualClick, isVirtualPointerEvent, stopEvent, getNodeAncestors, getNodeChildren, getFloatingFocusElement, getTabbableOptions, isOutsideEvent, getNextTabbable, getPreviousTabbable, isElementVisible, isTypeableElement } from "../utils.js";
|
|
17
16
|
import { createChangeEventDetails } from "../../utils/createBaseUIEventDetails.js";
|
|
18
17
|
import { REASONS } from "../../utils/reasons.js";
|
|
19
18
|
import { createAttribute } from "../utils/createAttribute.js";
|
|
@@ -83,7 +82,7 @@ function isFocusable(element) {
|
|
|
83
82
|
if (typeof element.checkVisibility === 'function') {
|
|
84
83
|
return element.checkVisibility();
|
|
85
84
|
}
|
|
86
|
-
return
|
|
85
|
+
return isElementVisible(element);
|
|
87
86
|
}
|
|
88
87
|
function handleTabIndex(floatingFocusElement, orderRef) {
|
|
89
88
|
if (!orderRef.current.includes('floating') && !floatingFocusElement.getAttribute('role')?.includes('dialog')) {
|
|
@@ -124,7 +123,8 @@ export function FloatingFocusManager(props) {
|
|
|
124
123
|
nextFocusableElement,
|
|
125
124
|
previousFocusableElement,
|
|
126
125
|
beforeContentFocusGuardRef,
|
|
127
|
-
externalTree
|
|
126
|
+
externalTree,
|
|
127
|
+
getInsideElements
|
|
128
128
|
} = props;
|
|
129
129
|
const store = 'rootStore' in context ? context.rootStore : context;
|
|
130
130
|
const open = store.useState('open');
|
|
@@ -148,8 +148,6 @@ export function FloatingFocusManager(props) {
|
|
|
148
148
|
const openInteractionTypeRef = useValueAsRef(openInteractionType);
|
|
149
149
|
const tree = useFloatingTree(externalTree);
|
|
150
150
|
const portalContext = usePortalContext();
|
|
151
|
-
const startDismissButtonRef = React.useRef(null);
|
|
152
|
-
const endDismissButtonRef = React.useRef(null);
|
|
153
151
|
const preventReturnFocusRef = React.useRef(false);
|
|
154
152
|
const isPointerDownRef = React.useRef(false);
|
|
155
153
|
const pointerDownOutsideRef = React.useRef(false);
|
|
@@ -168,6 +166,7 @@ export function FloatingFocusManager(props) {
|
|
|
168
166
|
const getTabbableContent = useStableCallback((container = floatingFocusElement) => {
|
|
169
167
|
return container ? tabbable(container, getTabbableOptions()) : [];
|
|
170
168
|
});
|
|
169
|
+
const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter(element => element != null) ?? []);
|
|
171
170
|
const getTabbableElements = useStableCallback(container => {
|
|
172
171
|
const content = getTabbableContent(container);
|
|
173
172
|
return orderRef.current.map(() => content).filter(Boolean).flat();
|
|
@@ -204,7 +203,8 @@ export function FloatingFocusManager(props) {
|
|
|
204
203
|
}
|
|
205
204
|
function onPointerDown(event) {
|
|
206
205
|
const target = getTarget(event);
|
|
207
|
-
const
|
|
206
|
+
const insideElements = getResolvedInsideElements();
|
|
207
|
+
const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some(element => element === target || contains(element, target));
|
|
208
208
|
pointerDownOutsideRef.current = !pointerTargetInside;
|
|
209
209
|
lastInteractionTypeRef.current = event.pointerType || 'keyboard';
|
|
210
210
|
if (target?.closest(`[${CLICK_TRIGGER_IDENTIFIER}]`)) {
|
|
@@ -224,7 +224,7 @@ export function FloatingFocusManager(props) {
|
|
|
224
224
|
doc.removeEventListener('pointercancel', clearPointerDownOutside, true);
|
|
225
225
|
doc.removeEventListener('keydown', onKeyDown, true);
|
|
226
226
|
};
|
|
227
|
-
}, [disabled, floating, domReference, floatingFocusElement, open, portalContext]);
|
|
227
|
+
}, [disabled, floating, domReference, floatingFocusElement, open, portalContext, getResolvedInsideElements]);
|
|
228
228
|
|
|
229
229
|
// Close on focus out and restore focus within the floating tree when needed.
|
|
230
230
|
React.useEffect(() => {
|
|
@@ -255,8 +255,9 @@ export function FloatingFocusManager(props) {
|
|
|
255
255
|
queueMicrotask(() => {
|
|
256
256
|
const nodeId = getNodeId();
|
|
257
257
|
const triggers = store.context.triggerElements;
|
|
258
|
+
const insideElements = getResolvedInsideElements();
|
|
258
259
|
const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute('focus-guard')) && [beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeInsideRef.current, portalContext?.afterInsideRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement)].includes(relatedTarget);
|
|
259
|
-
const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || relatedTarget != null && triggers.hasElement(relatedTarget) || triggers.hasMatchingElement(trigger => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find(node => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find(node => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));
|
|
260
|
+
const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some(element => element === relatedTarget || contains(element, relatedTarget)) || relatedTarget != null && triggers.hasElement(relatedTarget) || triggers.hasMatchingElement(trigger => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find(node => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find(node => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));
|
|
260
261
|
if (currentTarget === domReference && floatingFocusElement) {
|
|
261
262
|
handleTabIndex(floatingFocusElement, orderRef);
|
|
262
263
|
}
|
|
@@ -352,7 +353,7 @@ export function FloatingFocusManager(props) {
|
|
|
352
353
|
cleanup();
|
|
353
354
|
});
|
|
354
355
|
};
|
|
355
|
-
}, [disabled, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, orderRef, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement]);
|
|
356
|
+
}, [disabled, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, orderRef, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);
|
|
356
357
|
|
|
357
358
|
// Hide everything outside the floating tree from assistive tech while open.
|
|
358
359
|
React.useEffect(() => {
|
|
@@ -364,9 +365,19 @@ export function FloatingFocusManager(props) {
|
|
|
364
365
|
const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute('portal')}]`) || []);
|
|
365
366
|
const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : [];
|
|
366
367
|
const rootAncestorComboboxDomReference = ancestors.find(node => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference;
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
const controlInsideElements = [floating, ...portalNodes, beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, ...getResolvedInsideElements()];
|
|
369
|
+
const insideElements = [...controlInsideElements, rootAncestorComboboxDomReference, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement), isUntrappedTypeableCombobox ? domReference : null].filter(x => x != null);
|
|
370
|
+
const ariaHiddenCleanup = markOthers(insideElements, {
|
|
371
|
+
ariaHidden: modal || isUntrappedTypeableCombobox,
|
|
372
|
+
mark: false
|
|
373
|
+
});
|
|
374
|
+
const markerInsideElements = [floating, ...portalNodes].filter(x => x != null);
|
|
375
|
+
const markerCleanup = markOthers(markerInsideElements);
|
|
376
|
+
return () => {
|
|
377
|
+
markerCleanup();
|
|
378
|
+
ariaHiddenCleanup();
|
|
379
|
+
};
|
|
380
|
+
}, [open, disabled, domReference, floating, modal, orderRef, portalContext, isUntrappedTypeableCombobox, tree, getNodeId, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);
|
|
370
381
|
|
|
371
382
|
// Focus the initial element when the floating element opens.
|
|
372
383
|
useIsoLayoutEffect(() => {
|
|
@@ -444,13 +455,6 @@ export function FloatingFocusManager(props) {
|
|
|
444
455
|
}
|
|
445
456
|
}
|
|
446
457
|
events.on('openchange', onOpenChangeLocal);
|
|
447
|
-
const fallbackEl = doc.createElement('span');
|
|
448
|
-
fallbackEl.setAttribute('tabindex', '-1');
|
|
449
|
-
fallbackEl.setAttribute('aria-hidden', 'true');
|
|
450
|
-
Object.assign(fallbackEl.style, visuallyHidden);
|
|
451
|
-
if (isInsidePortal && domReference) {
|
|
452
|
-
domReference.insertAdjacentElement('afterend', fallbackEl);
|
|
453
|
-
}
|
|
454
458
|
function getReturnElement() {
|
|
455
459
|
const returnFocusValueOrFn = returnFocusRef.current;
|
|
456
460
|
let resolvedReturnFocusValue = typeof returnFocusValueOrFn === 'function' ? returnFocusValueOrFn(closeTypeRef.current) : returnFocusValueOrFn;
|
|
@@ -464,15 +468,16 @@ export function FloatingFocusManager(props) {
|
|
|
464
468
|
}
|
|
465
469
|
if (typeof resolvedReturnFocusValue === 'boolean') {
|
|
466
470
|
const el = domReference || getPreviouslyFocusedElement();
|
|
467
|
-
return el && el.isConnected ? el :
|
|
471
|
+
return el && el.isConnected ? el : null;
|
|
468
472
|
}
|
|
469
|
-
const fallback = domReference || getPreviouslyFocusedElement()
|
|
470
|
-
return resolveRef(resolvedReturnFocusValue) || fallback;
|
|
473
|
+
const fallback = domReference || getPreviouslyFocusedElement();
|
|
474
|
+
return resolveRef(resolvedReturnFocusValue) || fallback || null;
|
|
471
475
|
}
|
|
472
476
|
return () => {
|
|
473
477
|
events.off('openchange', onOpenChangeLocal);
|
|
474
478
|
const activeEl = activeElement(doc);
|
|
475
|
-
const
|
|
479
|
+
const insideElements = getResolvedInsideElements();
|
|
480
|
+
const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some(element => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some(node => contains(node.context?.elements.floating, activeEl));
|
|
476
481
|
const returnElement = getReturnElement();
|
|
477
482
|
queueMicrotask(() => {
|
|
478
483
|
// This is `returnElement`, if it's tabbable, or its first tabbable child.
|
|
@@ -489,11 +494,10 @@ export function FloatingFocusManager(props) {
|
|
|
489
494
|
preventScroll: true
|
|
490
495
|
});
|
|
491
496
|
}
|
|
492
|
-
fallbackEl.remove();
|
|
493
497
|
preventReturnFocusRef.current = false;
|
|
494
498
|
});
|
|
495
499
|
};
|
|
496
|
-
}, [disabled, floating, floatingFocusElement, returnFocusRef, dataRef, events, tree,
|
|
500
|
+
}, [disabled, floating, floatingFocusElement, returnFocusRef, dataRef, events, tree, domReference, getNodeId, getResolvedInsideElements]);
|
|
497
501
|
|
|
498
502
|
// Safari may randomly scroll to the bottom of the page if an input inside a popup has focus
|
|
499
503
|
// when the popup unmounts from the DOM.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type UseRenderElementComponentProps } from "../../utils/useRenderElement.js";
|
|
3
3
|
import type { BaseUIComponentProps } from "../../utils/types.js";
|
|
4
4
|
type FocusManagerState = null | {
|
|
5
5
|
modal: boolean;
|
|
@@ -21,8 +21,8 @@ export declare const usePortalContext: () => {
|
|
|
21
21
|
} | null;
|
|
22
22
|
export interface UseFloatingPortalNodeProps {
|
|
23
23
|
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
24
|
-
container?:
|
|
25
|
-
componentProps?:
|
|
24
|
+
container?: HTMLElement | ShadowRoot | null | React.RefObject<HTMLElement | ShadowRoot | null> | undefined;
|
|
25
|
+
componentProps?: UseRenderElementComponentProps<any> | undefined;
|
|
26
26
|
elementProps?: React.HTMLAttributes<HTMLDivElement> | undefined;
|
|
27
27
|
}
|
|
28
28
|
export interface UseFloatingPortalNodeResult {
|
|
@@ -42,8 +42,10 @@ export declare function useFloatingPortalNode(props?: UseFloatingPortalNodeProps
|
|
|
42
42
|
export declare const FloatingPortal: React.ForwardRefExoticComponent<Omit<FloatingPortal.Props<any> & {
|
|
43
43
|
renderGuards?: boolean | undefined;
|
|
44
44
|
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
45
|
+
export interface FloatingPortalState {}
|
|
45
46
|
export declare namespace FloatingPortal {
|
|
46
|
-
|
|
47
|
+
type State = FloatingPortalState;
|
|
48
|
+
interface Props<TState> extends BaseUIComponentProps<'div', TState> {
|
|
47
49
|
/**
|
|
48
50
|
* A parent element to render the portal element into.
|
|
49
51
|
*/
|
|
@@ -12,7 +12,7 @@ export interface UseClickProps {
|
|
|
12
12
|
* Keyboard clicks work as normal.
|
|
13
13
|
* @default 'click'
|
|
14
14
|
*/
|
|
15
|
-
event?:
|
|
15
|
+
event?: 'click' | 'mousedown' | 'mousedown-only' | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Whether to toggle the open state with repeated clicks.
|
|
18
18
|
* @default true
|
|
@@ -40,7 +40,7 @@ export interface UseClickProps {
|
|
|
40
40
|
* The reason for the click.
|
|
41
41
|
* @default REASONS.triggerPress
|
|
42
42
|
*/
|
|
43
|
-
reason?:
|
|
43
|
+
reason?: typeof REASONS.triggerPress | typeof REASONS.inputPress | undefined;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Opens or closes the floating element when clicking the reference element.
|
|
@@ -12,7 +12,7 @@ export interface UseClientPointProps {
|
|
|
12
12
|
* floating element is also interactive.
|
|
13
13
|
* @default 'both'
|
|
14
14
|
*/
|
|
15
|
-
axis?:
|
|
15
|
+
axis?: 'x' | 'y' | 'both' | undefined;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Positions the floating element relative to a client point (in the viewport),
|
|
@@ -24,9 +24,11 @@ export interface UseDismissProps {
|
|
|
24
24
|
* Whether to dismiss the floating element upon pressing the reference
|
|
25
25
|
* element. You likely want to ensure the `move` option in the `useHover()`
|
|
26
26
|
* Hook has been disabled when this is in use.
|
|
27
|
+
*
|
|
28
|
+
* A lazy getter invoked when handling reference press events.
|
|
27
29
|
* @default false
|
|
28
30
|
*/
|
|
29
|
-
referencePress?: boolean | undefined;
|
|
31
|
+
referencePress?: (() => boolean) | undefined;
|
|
30
32
|
/**
|
|
31
33
|
* The type of event to use to determine a "press".
|
|
32
34
|
* - `down` is `pointerdown` on mouse input, but special iOS-like touch handling on touch input.
|
|
@@ -47,33 +49,27 @@ export interface UseDismissProps {
|
|
|
47
49
|
* ```
|
|
48
50
|
* @default true
|
|
49
51
|
*/
|
|
50
|
-
outsidePress?:
|
|
52
|
+
outsidePress?: boolean | ((event: MouseEvent | TouchEvent) => boolean) | undefined;
|
|
51
53
|
/**
|
|
52
54
|
* The type of event to use to determine an outside "press".
|
|
53
55
|
* - `intentional` requires the user to click outside intentionally, firing on `pointerup` for mouse, and requiring minimal `touchmove`s for touch.
|
|
54
56
|
* - `sloppy` fires on `pointerdown` for mouse, while for touch it fires on `touchend` (within 1 second) or while scrolling away after `touchstart`.
|
|
55
57
|
*/
|
|
56
|
-
outsidePressEvent?:
|
|
58
|
+
outsidePressEvent?: PressType | {
|
|
57
59
|
mouse: PressType;
|
|
58
60
|
touch: PressType;
|
|
59
61
|
} | (() => PressType | {
|
|
60
62
|
mouse: PressType;
|
|
61
63
|
touch: PressType;
|
|
62
|
-
})
|
|
63
|
-
/**
|
|
64
|
-
* Whether to dismiss the floating element upon scrolling an overflow
|
|
65
|
-
* ancestor.
|
|
66
|
-
* @default false
|
|
67
|
-
*/
|
|
68
|
-
ancestorScroll?: boolean | undefined;
|
|
64
|
+
}) | undefined;
|
|
69
65
|
/**
|
|
70
66
|
* Determines whether event listeners bubble upwards through a tree of
|
|
71
67
|
* floating elements.
|
|
72
68
|
*/
|
|
73
|
-
bubbles?:
|
|
69
|
+
bubbles?: boolean | {
|
|
74
70
|
escapeKey?: boolean | undefined;
|
|
75
71
|
outsidePress?: boolean | undefined;
|
|
76
|
-
}
|
|
72
|
+
} | undefined;
|
|
77
73
|
/**
|
|
78
74
|
* External FlatingTree to use when the one provided by context can't be used.
|
|
79
75
|
*/
|