@base-ui/react 1.0.0-rc.2 → 1.1.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 +156 -5
- package/README.md +2 -3
- package/accordion/header/AccordionHeader.d.ts +1 -1
- package/accordion/item/AccordionItem.d.ts +1 -1
- package/accordion/panel/AccordionPanel.d.ts +1 -1
- package/accordion/root/AccordionRoot.d.ts +1 -1
- package/accordion/trigger/AccordionTrigger.d.ts +1 -1
- package/accordion/trigger/AccordionTrigger.js +3 -4
- package/alert-dialog/root/AlertDialogRoot.d.ts +3 -3
- package/autocomplete/root/AutocompleteRoot.d.ts +1 -1
- package/avatar/fallback/AvatarFallback.d.ts +1 -1
- package/avatar/image/AvatarImage.d.ts +1 -1
- package/avatar/root/AvatarRoot.d.ts +1 -1
- package/button/Button.d.ts +4 -17
- package/button/Button.js +1 -2
- package/checkbox/indicator/CheckboxIndicator.d.ts +1 -1
- package/checkbox/indicator/CheckboxIndicatorDataAttributes.d.ts +4 -0
- package/checkbox/indicator/CheckboxIndicatorDataAttributes.js +4 -0
- package/checkbox/root/CheckboxRoot.d.ts +1 -1
- package/checkbox/root/CheckboxRoot.js +5 -4
- package/checkbox/root/CheckboxRootDataAttributes.d.ts +4 -0
- package/checkbox/root/CheckboxRootDataAttributes.js +4 -0
- package/checkbox-group/CheckboxGroup.d.ts +1 -1
- package/collapsible/panel/CollapsiblePanel.d.ts +1 -1
- package/collapsible/root/CollapsibleRoot.d.ts +1 -1
- package/collapsible/trigger/CollapsibleTrigger.d.ts +1 -1
- package/collapsible/trigger/CollapsibleTrigger.js +1 -2
- package/combobox/arrow/ComboboxArrow.d.ts +1 -1
- package/combobox/backdrop/ComboboxBackdrop.d.ts +1 -1
- package/combobox/chip/ComboboxChip.d.ts +1 -1
- package/combobox/chip-remove/ComboboxChipRemove.d.ts +1 -1
- package/combobox/chip-remove/ComboboxChipRemove.js +3 -2
- package/combobox/chips/ComboboxChips.d.ts +1 -1
- package/combobox/chips/ComboboxChips.js +7 -1
- package/combobox/clear/ComboboxClear.d.ts +1 -1
- package/combobox/clear/ComboboxClear.js +2 -2
- 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/input/ComboboxInput.d.ts +1 -1
- package/combobox/input/ComboboxInput.js +12 -18
- package/combobox/item/ComboboxItem.d.ts +1 -1
- package/combobox/item/ComboboxItem.js +0 -1
- package/combobox/item-indicator/ComboboxItemIndicator.d.ts +1 -1
- package/combobox/list/ComboboxList.d.ts +1 -1
- package/combobox/popup/ComboboxPopup.d.ts +1 -1
- package/combobox/popup/ComboboxPopup.js +2 -1
- package/combobox/portal/ComboboxPortal.d.ts +1 -1
- package/combobox/positioner/ComboboxPositioner.d.ts +1 -1
- package/combobox/root/AriaCombobox.d.ts +8 -1
- package/combobox/root/AriaCombobox.js +19 -16
- package/combobox/root/ComboboxRoot.d.ts +1 -1
- package/combobox/row/ComboboxRow.d.ts +1 -1
- package/combobox/status/ComboboxStatus.d.ts +1 -1
- package/combobox/store.d.ts +3 -0
- package/combobox/store.js +21 -0
- package/combobox/trigger/ComboboxTrigger.d.ts +14 -1
- package/combobox/trigger/ComboboxTrigger.js +31 -11
- package/combobox/trigger/ComboboxTriggerDataAttributes.d.ts +13 -0
- package/combobox/trigger/ComboboxTriggerDataAttributes.js +13 -0
- package/combobox/utils/stateAttributesMapping.d.ts +14 -0
- package/combobox/utils/stateAttributesMapping.js +18 -0
- package/combobox/value/ComboboxValue.d.ts +5 -0
- package/combobox/value/ComboboxValue.js +15 -6
- package/composite/root/useCompositeRoot.d.ts +1 -1
- package/context-menu/trigger/ContextMenuTrigger.d.ts +1 -1
- package/csp-provider/CSPContext.d.ts +13 -0
- package/csp-provider/CSPContext.js +25 -0
- package/csp-provider/CSPProvider.d.ts +25 -0
- package/csp-provider/CSPProvider.js +32 -0
- package/csp-provider/index.d.ts +2 -0
- package/csp-provider/index.js +12 -0
- package/csp-provider/index.parts.d.ts +1 -0
- package/csp-provider/index.parts.js +12 -0
- package/dialog/backdrop/DialogBackdrop.d.ts +1 -1
- package/dialog/close/DialogClose.d.ts +1 -1
- package/dialog/description/DialogDescription.d.ts +1 -1
- package/dialog/popup/DialogPopup.d.ts +1 -1
- package/dialog/portal/DialogPortal.d.ts +1 -1
- package/dialog/portal/DialogPortal.js +1 -0
- package/dialog/root/DialogRoot.d.ts +4 -4
- package/dialog/store/DialogStore.d.ts +2 -2
- package/dialog/title/DialogTitle.d.ts +1 -1
- package/dialog/viewport/DialogViewport.d.ts +1 -1
- package/esm/accordion/header/AccordionHeader.d.ts +1 -1
- package/esm/accordion/item/AccordionItem.d.ts +1 -1
- package/esm/accordion/panel/AccordionPanel.d.ts +1 -1
- package/esm/accordion/root/AccordionRoot.d.ts +1 -1
- package/esm/accordion/trigger/AccordionTrigger.d.ts +1 -1
- package/esm/accordion/trigger/AccordionTrigger.js +3 -4
- package/esm/alert-dialog/root/AlertDialogRoot.d.ts +3 -3
- package/esm/autocomplete/root/AutocompleteRoot.d.ts +1 -1
- package/esm/avatar/fallback/AvatarFallback.d.ts +1 -1
- package/esm/avatar/image/AvatarImage.d.ts +1 -1
- package/esm/avatar/root/AvatarRoot.d.ts +1 -1
- package/esm/button/Button.d.ts +4 -17
- package/esm/button/Button.js +1 -2
- package/esm/checkbox/indicator/CheckboxIndicator.d.ts +1 -1
- package/esm/checkbox/indicator/CheckboxIndicatorDataAttributes.d.ts +4 -0
- package/esm/checkbox/indicator/CheckboxIndicatorDataAttributes.js +4 -0
- package/esm/checkbox/root/CheckboxRoot.d.ts +1 -1
- package/esm/checkbox/root/CheckboxRoot.js +6 -5
- package/esm/checkbox/root/CheckboxRootDataAttributes.d.ts +4 -0
- package/esm/checkbox/root/CheckboxRootDataAttributes.js +4 -0
- package/esm/checkbox-group/CheckboxGroup.d.ts +1 -1
- package/esm/collapsible/panel/CollapsiblePanel.d.ts +1 -1
- package/esm/collapsible/root/CollapsibleRoot.d.ts +1 -1
- package/esm/collapsible/trigger/CollapsibleTrigger.d.ts +1 -1
- package/esm/collapsible/trigger/CollapsibleTrigger.js +1 -2
- package/esm/combobox/arrow/ComboboxArrow.d.ts +1 -1
- package/esm/combobox/backdrop/ComboboxBackdrop.d.ts +1 -1
- package/esm/combobox/chip/ComboboxChip.d.ts +1 -1
- package/esm/combobox/chip-remove/ComboboxChipRemove.d.ts +1 -1
- package/esm/combobox/chip-remove/ComboboxChipRemove.js +3 -2
- package/esm/combobox/chips/ComboboxChips.d.ts +1 -1
- package/esm/combobox/chips/ComboboxChips.js +7 -1
- package/esm/combobox/clear/ComboboxClear.d.ts +1 -1
- package/esm/combobox/clear/ComboboxClear.js +2 -2
- 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/input/ComboboxInput.d.ts +1 -1
- package/esm/combobox/input/ComboboxInput.js +12 -17
- package/esm/combobox/item/ComboboxItem.d.ts +1 -1
- package/esm/combobox/item/ComboboxItem.js +0 -1
- package/esm/combobox/item-indicator/ComboboxItemIndicator.d.ts +1 -1
- package/esm/combobox/list/ComboboxList.d.ts +1 -1
- package/esm/combobox/popup/ComboboxPopup.d.ts +1 -1
- package/esm/combobox/popup/ComboboxPopup.js +2 -1
- package/esm/combobox/portal/ComboboxPortal.d.ts +1 -1
- package/esm/combobox/positioner/ComboboxPositioner.d.ts +1 -1
- package/esm/combobox/root/AriaCombobox.d.ts +8 -1
- package/esm/combobox/root/AriaCombobox.js +20 -17
- package/esm/combobox/root/ComboboxRoot.d.ts +1 -1
- package/esm/combobox/row/ComboboxRow.d.ts +1 -1
- package/esm/combobox/status/ComboboxStatus.d.ts +1 -1
- package/esm/combobox/store.d.ts +3 -0
- package/esm/combobox/store.js +21 -0
- package/esm/combobox/trigger/ComboboxTrigger.d.ts +14 -1
- package/esm/combobox/trigger/ComboboxTrigger.js +32 -12
- package/esm/combobox/trigger/ComboboxTriggerDataAttributes.d.ts +13 -0
- package/esm/combobox/trigger/ComboboxTriggerDataAttributes.js +13 -0
- package/esm/combobox/utils/stateAttributesMapping.d.ts +14 -0
- package/esm/combobox/utils/stateAttributesMapping.js +12 -0
- package/esm/combobox/value/ComboboxValue.d.ts +5 -0
- package/esm/combobox/value/ComboboxValue.js +16 -7
- package/esm/composite/root/useCompositeRoot.d.ts +1 -1
- package/esm/context-menu/trigger/ContextMenuTrigger.d.ts +1 -1
- package/esm/csp-provider/CSPContext.d.ts +13 -0
- package/esm/csp-provider/CSPContext.js +18 -0
- package/esm/csp-provider/CSPProvider.d.ts +25 -0
- package/esm/csp-provider/CSPProvider.js +27 -0
- package/esm/csp-provider/index.d.ts +2 -0
- package/esm/csp-provider/index.js +1 -0
- package/esm/csp-provider/index.parts.d.ts +1 -0
- package/esm/csp-provider/index.parts.js +1 -0
- package/esm/dialog/backdrop/DialogBackdrop.d.ts +1 -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 +1 -1
- package/esm/dialog/portal/DialogPortal.d.ts +1 -1
- package/esm/dialog/portal/DialogPortal.js +1 -0
- package/esm/dialog/root/DialogRoot.d.ts +4 -4
- package/esm/dialog/store/DialogStore.d.ts +2 -2
- package/esm/dialog/title/DialogTitle.d.ts +1 -1
- package/esm/dialog/viewport/DialogViewport.d.ts +1 -1
- package/esm/field/control/FieldControl.d.ts +1 -1
- package/esm/field/description/FieldDescription.d.ts +1 -1
- package/esm/field/error/FieldError.d.ts +1 -1
- package/esm/field/index.d.ts +2 -1
- package/esm/field/item/FieldItem.d.ts +1 -1
- package/esm/field/label/FieldLabel.d.ts +11 -2
- package/esm/field/label/FieldLabel.js +51 -11
- package/esm/field/root/FieldRoot.d.ts +10 -1
- package/esm/field/root/FieldRoot.js +8 -0
- package/esm/field/useField.js +7 -3
- package/esm/fieldset/legend/FieldsetLegend.d.ts +1 -1
- package/esm/fieldset/root/FieldsetRoot.d.ts +1 -1
- package/esm/floating-ui-react/components/FloatingFocusManager.js +7 -6
- package/esm/floating-ui-react/components/FloatingPortal.d.ts +2 -2
- package/esm/floating-ui-react/components/FloatingPortal.js +11 -2
- package/esm/floating-ui-react/hooks/useClientPoint.js +5 -4
- package/esm/floating-ui-react/hooks/useDismiss.js +16 -3
- package/esm/floating-ui-react/hooks/useFocus.d.ts +5 -0
- package/esm/floating-ui-react/hooks/useFocus.js +43 -9
- package/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js +17 -4
- package/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js +3 -0
- package/esm/form/Form.d.ts +18 -1
- package/esm/form/Form.js +17 -0
- package/esm/form/FormContext.d.ts +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/esm/input/Input.d.ts +1 -1
- package/esm/menu/arrow/MenuArrow.d.ts +1 -1
- package/esm/menu/backdrop/MenuBackdrop.d.ts +1 -1
- package/esm/menu/checkbox-item/MenuCheckboxItem.d.ts +1 -1
- package/esm/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.d.ts +1 -1
- package/esm/menu/group/MenuGroup.d.ts +1 -1
- package/esm/menu/group-label/MenuGroupLabel.d.ts +1 -1
- package/esm/menu/item/MenuItem.d.ts +1 -1
- package/esm/menu/popup/MenuPopup.d.ts +1 -1
- package/esm/menu/popup/MenuPopup.js +4 -3
- package/esm/menu/portal/MenuPortal.d.ts +1 -1
- package/esm/menu/positioner/MenuPositioner.d.ts +1 -1
- package/esm/menu/radio-group/MenuRadioGroup.d.ts +1 -1
- package/esm/menu/radio-item/MenuRadioItem.d.ts +1 -1
- package/esm/menu/radio-item-indicator/MenuRadioItemIndicator.d.ts +1 -1
- package/esm/menu/root/MenuRoot.d.ts +7 -6
- package/esm/menu/root/MenuRoot.js +4 -2
- package/esm/menu/store/MenuStore.js +3 -3
- package/esm/menu/submenu-trigger/MenuSubmenuTrigger.d.ts +1 -1
- package/esm/menu/trigger/MenuTrigger.js +13 -13
- package/esm/menubar/Menubar.d.ts +1 -1
- package/esm/merge-props/mergeProps.d.ts +31 -11
- package/esm/merge-props/mergeProps.js +29 -8
- package/esm/meter/indicator/MeterIndicator.d.ts +1 -1
- package/esm/meter/label/MeterLabel.d.ts +1 -1
- package/esm/meter/root/MeterRoot.d.ts +1 -1
- package/esm/meter/track/MeterTrack.d.ts +1 -1
- package/esm/meter/value/MeterValue.d.ts +1 -1
- package/esm/navigation-menu/arrow/NavigationMenuArrow.d.ts +1 -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 +6 -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/popup/NavigationMenuPopup.d.ts +1 -1
- package/esm/navigation-menu/portal/NavigationMenuPortal.d.ts +1 -1
- package/esm/navigation-menu/positioner/NavigationMenuPositioner.d.ts +1 -1
- package/esm/navigation-menu/root/NavigationMenuRoot.d.ts +2 -2
- package/esm/navigation-menu/trigger/NavigationMenuTrigger.d.ts +1 -1
- package/esm/navigation-menu/viewport/NavigationMenuViewport.d.ts +1 -1
- package/esm/number-field/decrement/NumberFieldDecrement.d.ts +1 -1
- package/esm/number-field/decrement/NumberFieldDecrement.js +4 -6
- package/esm/number-field/group/NumberFieldGroup.d.ts +1 -1
- package/esm/number-field/increment/NumberFieldIncrement.d.ts +1 -1
- package/esm/number-field/increment/NumberFieldIncrement.js +4 -6
- package/esm/number-field/input/NumberFieldInput.d.ts +1 -1
- package/esm/number-field/input/NumberFieldInput.js +5 -2
- package/esm/number-field/root/NumberFieldRoot.d.ts +5 -4
- package/esm/number-field/root/NumberFieldRoot.js +12 -5
- package/esm/number-field/root/useNumberFieldButton.d.ts +0 -3
- package/esm/number-field/root/useNumberFieldButton.js +5 -11
- package/esm/number-field/scrub-area/NumberFieldScrubArea.d.ts +1 -1
- package/esm/number-field/scrub-area-cursor/NumberFieldScrubAreaCursor.d.ts +1 -1
- package/esm/popover/arrow/PopoverArrow.d.ts +1 -1
- package/esm/popover/backdrop/PopoverBackdrop.d.ts +1 -1
- package/esm/popover/close/PopoverClose.d.ts +1 -1
- package/esm/popover/description/PopoverDescription.d.ts +1 -1
- package/esm/popover/popup/PopoverPopup.d.ts +1 -1
- package/esm/popover/popup/PopoverPopup.js +0 -30
- package/esm/popover/portal/PopoverPortal.d.ts +1 -1
- package/esm/popover/positioner/PopoverPositioner.d.ts +1 -1
- package/esm/popover/positioner/PopoverPositioner.js +2 -1
- package/esm/popover/root/PopoverRoot.d.ts +2 -2
- package/esm/popover/store/PopoverStore.d.ts +4 -2
- package/esm/popover/store/PopoverStore.js +8 -5
- package/esm/popover/title/PopoverTitle.d.ts +1 -1
- package/esm/popover/trigger/PopoverTrigger.js +2 -2
- package/esm/popover/viewport/PopoverViewport.d.ts +1 -1
- package/esm/popover/viewport/PopoverViewport.js +28 -12
- package/esm/preview-card/arrow/PreviewCardArrow.d.ts +1 -1
- package/esm/preview-card/arrow/PreviewCardArrow.js +2 -3
- package/esm/preview-card/backdrop/PreviewCardBackdrop.d.ts +1 -1
- package/esm/preview-card/backdrop/PreviewCardBackdrop.js +4 -5
- package/esm/preview-card/index.parts.d.ts +3 -1
- package/esm/preview-card/index.parts.js +3 -1
- package/esm/preview-card/popup/PreviewCardPopup.d.ts +2 -1
- package/esm/preview-card/popup/PreviewCardPopup.js +17 -11
- package/esm/preview-card/portal/PreviewCardPortal.d.ts +1 -1
- package/esm/preview-card/portal/PreviewCardPortal.js +2 -3
- package/esm/preview-card/positioner/PreviewCardPositioner.d.ts +2 -1
- package/esm/preview-card/positioner/PreviewCardPositioner.js +16 -11
- package/esm/preview-card/root/PreviewCardContext.d.ts +5 -26
- package/esm/preview-card/root/PreviewCardContext.js +2 -2
- package/esm/preview-card/root/PreviewCardRoot.d.ts +35 -10
- package/esm/preview-card/root/PreviewCardRoot.js +61 -116
- package/esm/preview-card/store/PreviewCardHandle.d.ts +33 -0
- package/esm/preview-card/store/PreviewCardHandle.js +55 -0
- package/esm/preview-card/store/PreviewCardStore.d.ts +36 -0
- package/esm/preview-card/store/PreviewCardStore.js +97 -0
- package/esm/preview-card/trigger/PreviewCardTrigger.d.ts +15 -3
- package/esm/preview-card/trigger/PreviewCardTrigger.js +49 -13
- package/esm/preview-card/viewport/PreviewCardViewport.d.ts +22 -0
- package/esm/preview-card/viewport/PreviewCardViewport.js +272 -0
- package/esm/preview-card/viewport/PreviewCardViewportCssVars.d.ts +14 -0
- package/esm/preview-card/viewport/PreviewCardViewportCssVars.js +15 -0
- package/esm/preview-card/viewport/PreviewCardViewportDataAttributes.d.ts +26 -0
- package/esm/preview-card/viewport/PreviewCardViewportDataAttributes.js +27 -0
- package/esm/progress/indicator/ProgressIndicator.d.ts +1 -1
- package/esm/progress/label/ProgressLabel.d.ts +1 -1
- package/esm/progress/root/ProgressRoot.d.ts +1 -1
- package/esm/progress/track/ProgressTrack.d.ts +1 -1
- package/esm/progress/value/ProgressValue.d.ts +1 -1
- package/esm/radio/indicator/RadioIndicator.d.ts +1 -1
- package/esm/radio/root/RadioRoot.d.ts +1 -1
- package/esm/radio/root/RadioRoot.js +9 -9
- package/esm/radio-group/RadioGroup.d.ts +4 -4
- package/esm/radio-group/RadioGroup.js +2 -2
- package/esm/scroll-area/content/ScrollAreaContent.d.ts +1 -1
- package/esm/scroll-area/content/ScrollAreaContent.js +10 -1
- package/esm/scroll-area/corner/ScrollAreaCorner.d.ts +1 -1
- package/esm/scroll-area/corner/ScrollAreaCorner.js +1 -1
- package/esm/scroll-area/root/ScrollAreaRoot.d.ts +26 -2
- package/esm/scroll-area/root/ScrollAreaRoot.js +33 -29
- package/esm/scroll-area/root/ScrollAreaRootContext.d.ts +10 -43
- package/esm/scroll-area/scrollbar/ScrollAreaScrollbar.d.ts +1 -1
- package/esm/scroll-area/scrollbar/ScrollAreaScrollbar.js +4 -4
- package/esm/scroll-area/thumb/ScrollAreaThumb.d.ts +2 -2
- package/esm/scroll-area/thumb/ScrollAreaThumb.js +1 -1
- package/esm/scroll-area/viewport/ScrollAreaViewport.d.ts +1 -1
- package/esm/scroll-area/viewport/ScrollAreaViewport.js +51 -25
- package/esm/select/arrow/SelectArrow.d.ts +1 -1
- package/esm/select/backdrop/SelectBackdrop.d.ts +1 -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/item/SelectItem.d.ts +1 -1
- package/esm/select/item/SelectItem.js +0 -1
- package/esm/select/item-indicator/SelectItemIndicator.d.ts +1 -1
- package/esm/select/item-text/SelectItemText.d.ts +1 -1
- package/esm/select/list/SelectList.d.ts +1 -1
- package/esm/select/popup/SelectPopup.d.ts +1 -1
- package/esm/select/popup/SelectPopup.js +154 -95
- package/esm/select/portal/SelectPortal.d.ts +1 -1
- package/esm/select/positioner/SelectPositioner.d.ts +1 -1
- package/esm/select/root/SelectRoot.d.ts +2 -2
- package/esm/select/root/SelectRoot.js +26 -13
- package/esm/select/scroll-arrow/SelectScrollArrow.d.ts +1 -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 +2 -1
- package/esm/select/store.js +19 -13
- package/esm/select/trigger/SelectTrigger.d.ts +14 -4
- package/esm/select/trigger/SelectTrigger.js +50 -18
- package/esm/select/value/SelectValue.d.ts +6 -1
- package/esm/select/value/SelectValue.js +19 -5
- package/esm/separator/Separator.d.ts +1 -1
- package/esm/slider/control/SliderControl.d.ts +1 -1
- package/esm/slider/control/SliderControl.js +1 -1
- package/esm/slider/control/SliderControlDataAttributes.d.ts +0 -8
- package/esm/slider/control/SliderControlDataAttributes.js +0 -8
- package/esm/slider/indicator/SliderIndicator.d.ts +1 -1
- package/esm/slider/indicator/SliderIndicatorDataAttributes.d.ts +0 -8
- package/esm/slider/indicator/SliderIndicatorDataAttributes.js +0 -8
- package/esm/slider/root/SliderRootDataAttributes.d.ts +0 -8
- package/esm/slider/root/SliderRootDataAttributes.js +0 -8
- package/esm/slider/thumb/SliderThumb.d.ts +2 -2
- package/esm/slider/thumb/SliderThumb.js +7 -1
- package/esm/slider/thumb/SliderThumbDataAttributes.d.ts +0 -8
- package/esm/slider/thumb/SliderThumbDataAttributes.js +0 -8
- package/esm/slider/track/SliderTrack.d.ts +1 -1
- package/esm/slider/track/SliderTrackDataAttributes.d.ts +0 -8
- package/esm/slider/track/SliderTrackDataAttributes.js +0 -8
- package/esm/slider/value/SliderValue.d.ts +1 -1
- package/esm/slider/value/SliderValueDataAttributes.d.ts +0 -8
- package/esm/slider/value/SliderValueDataAttributes.js +0 -8
- package/esm/switch/root/SwitchRoot.d.ts +6 -1
- package/esm/switch/root/SwitchRoot.js +15 -6
- package/esm/switch/thumb/SwitchThumb.d.ts +1 -1
- package/esm/tabs/indicator/TabsIndicator.d.ts +1 -1
- package/esm/tabs/indicator/TabsIndicator.js +6 -0
- package/esm/tabs/list/TabsList.d.ts +1 -1
- package/esm/tabs/panel/TabsPanel.d.ts +1 -1
- package/esm/tabs/root/TabsRoot.d.ts +1 -1
- package/esm/tabs/tab/TabsTab.d.ts +1 -1
- package/esm/toast/action/ToastAction.d.ts +1 -1
- package/esm/toast/arrow/ToastArrow.d.ts +1 -1
- package/esm/toast/close/ToastClose.d.ts +1 -1
- package/esm/toast/content/ToastContent.d.ts +1 -1
- package/esm/toast/description/ToastDescription.d.ts +1 -1
- package/esm/toast/portal/ToastPortal.d.ts +1 -1
- package/esm/toast/positioner/ToastPositioner.d.ts +1 -1
- package/esm/toast/provider/ToastProvider.js +46 -19
- package/esm/toast/root/ToastRoot.d.ts +1 -1
- package/esm/toast/title/ToastTitle.d.ts +1 -1
- 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 +1 -1
- package/esm/toolbar/group/ToolbarGroup.d.ts +1 -1
- package/esm/toolbar/input/ToolbarInput.d.ts +1 -1
- package/esm/toolbar/link/ToolbarLink.d.ts +1 -1
- package/esm/toolbar/root/ToolbarRoot.d.ts +1 -1
- package/esm/toolbar/separator/ToolbarSeparator.d.ts +1 -1
- package/esm/tooltip/arrow/TooltipArrow.d.ts +1 -1
- package/esm/tooltip/popup/TooltipPopup.d.ts +1 -1
- package/esm/tooltip/popup/TooltipPopup.js +0 -31
- package/esm/tooltip/portal/TooltipPortal.d.ts +1 -1
- package/esm/tooltip/positioner/TooltipPositioner.d.ts +1 -1
- package/esm/tooltip/positioner/TooltipPositioner.js +2 -1
- package/esm/tooltip/root/TooltipRoot.d.ts +4 -6
- package/esm/tooltip/root/TooltipRoot.js +1 -2
- package/esm/tooltip/store/TooltipStore.d.ts +4 -2
- package/esm/tooltip/store/TooltipStore.js +7 -4
- package/esm/tooltip/trigger/TooltipTrigger.js +1 -1
- package/esm/tooltip/viewport/TooltipViewport.d.ts +1 -1
- package/esm/tooltip/viewport/TooltipViewport.js +28 -12
- package/esm/use-render/index.d.ts +2 -1
- package/esm/use-render/index.js +2 -1
- package/esm/utils/FloatingPortalLite.d.ts +1 -1
- package/esm/utils/popups/popupStoreUtils.js +21 -2
- package/esm/utils/resolveValueLabel.d.ts +5 -1
- package/esm/utils/resolveValueLabel.js +46 -22
- package/esm/utils/styles.d.ts +1 -1
- package/esm/utils/styles.js +10 -6
- package/esm/utils/types.d.ts +1 -1
- package/esm/utils/useAnimationsFinished.d.ts +2 -2
- package/esm/utils/useAnimationsFinished.js +56 -33
- package/esm/utils/useOpenChangeComplete.js +8 -10
- package/esm/utils/useOpenInteractionType.js +6 -1
- package/esm/utils/usePopupAutoResize.js +82 -46
- package/field/control/FieldControl.d.ts +1 -1
- package/field/description/FieldDescription.d.ts +1 -1
- package/field/error/FieldError.d.ts +1 -1
- package/field/index.d.ts +2 -1
- package/field/item/FieldItem.d.ts +1 -1
- package/field/label/FieldLabel.d.ts +11 -2
- package/field/label/FieldLabel.js +51 -11
- package/field/root/FieldRoot.d.ts +10 -1
- package/field/root/FieldRoot.js +8 -0
- package/field/useField.js +7 -3
- package/fieldset/legend/FieldsetLegend.d.ts +1 -1
- package/fieldset/root/FieldsetRoot.d.ts +1 -1
- package/floating-ui-react/components/FloatingFocusManager.js +7 -6
- package/floating-ui-react/components/FloatingPortal.d.ts +2 -2
- package/floating-ui-react/components/FloatingPortal.js +11 -2
- package/floating-ui-react/hooks/useClientPoint.js +5 -4
- package/floating-ui-react/hooks/useDismiss.js +16 -3
- package/floating-ui-react/hooks/useFocus.d.ts +5 -0
- package/floating-ui-react/hooks/useFocus.js +43 -9
- package/floating-ui-react/hooks/useHoverReferenceInteraction.js +17 -4
- package/floating-ui-react/hooks/useSyncedFloatingRootContext.js +3 -0
- package/form/Form.d.ts +18 -1
- package/form/Form.js +17 -0
- package/form/FormContext.d.ts +1 -1
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/input/Input.d.ts +1 -1
- package/menu/arrow/MenuArrow.d.ts +1 -1
- package/menu/backdrop/MenuBackdrop.d.ts +1 -1
- package/menu/checkbox-item/MenuCheckboxItem.d.ts +1 -1
- package/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.d.ts +1 -1
- package/menu/group/MenuGroup.d.ts +1 -1
- package/menu/group-label/MenuGroupLabel.d.ts +1 -1
- package/menu/item/MenuItem.d.ts +1 -1
- package/menu/popup/MenuPopup.d.ts +1 -1
- package/menu/popup/MenuPopup.js +4 -3
- package/menu/portal/MenuPortal.d.ts +1 -1
- package/menu/positioner/MenuPositioner.d.ts +1 -1
- package/menu/radio-group/MenuRadioGroup.d.ts +1 -1
- package/menu/radio-item/MenuRadioItem.d.ts +1 -1
- package/menu/radio-item-indicator/MenuRadioItemIndicator.d.ts +1 -1
- package/menu/root/MenuRoot.d.ts +7 -6
- package/menu/root/MenuRoot.js +4 -2
- package/menu/store/MenuStore.js +3 -3
- package/menu/submenu-trigger/MenuSubmenuTrigger.d.ts +1 -1
- package/menu/trigger/MenuTrigger.js +14 -14
- package/menubar/Menubar.d.ts +1 -1
- package/merge-props/mergeProps.d.ts +31 -11
- package/merge-props/mergeProps.js +29 -8
- package/meter/indicator/MeterIndicator.d.ts +1 -1
- package/meter/label/MeterLabel.d.ts +1 -1
- package/meter/root/MeterRoot.d.ts +1 -1
- package/meter/track/MeterTrack.d.ts +1 -1
- package/meter/value/MeterValue.d.ts +1 -1
- package/navigation-menu/arrow/NavigationMenuArrow.d.ts +1 -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 +6 -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/popup/NavigationMenuPopup.d.ts +1 -1
- package/navigation-menu/portal/NavigationMenuPortal.d.ts +1 -1
- package/navigation-menu/positioner/NavigationMenuPositioner.d.ts +1 -1
- package/navigation-menu/root/NavigationMenuRoot.d.ts +2 -2
- package/navigation-menu/trigger/NavigationMenuTrigger.d.ts +1 -1
- package/navigation-menu/viewport/NavigationMenuViewport.d.ts +1 -1
- package/number-field/decrement/NumberFieldDecrement.d.ts +1 -1
- package/number-field/decrement/NumberFieldDecrement.js +4 -6
- package/number-field/group/NumberFieldGroup.d.ts +1 -1
- package/number-field/increment/NumberFieldIncrement.d.ts +1 -1
- package/number-field/increment/NumberFieldIncrement.js +4 -6
- package/number-field/input/NumberFieldInput.d.ts +1 -1
- package/number-field/input/NumberFieldInput.js +5 -2
- package/number-field/root/NumberFieldRoot.d.ts +5 -4
- package/number-field/root/NumberFieldRoot.js +11 -4
- package/number-field/root/useNumberFieldButton.d.ts +0 -3
- package/number-field/root/useNumberFieldButton.js +5 -11
- package/number-field/scrub-area/NumberFieldScrubArea.d.ts +1 -1
- package/number-field/scrub-area-cursor/NumberFieldScrubAreaCursor.d.ts +1 -1
- package/package.json +13 -3
- package/popover/arrow/PopoverArrow.d.ts +1 -1
- package/popover/backdrop/PopoverBackdrop.d.ts +1 -1
- package/popover/close/PopoverClose.d.ts +1 -1
- package/popover/description/PopoverDescription.d.ts +1 -1
- package/popover/popup/PopoverPopup.d.ts +1 -1
- package/popover/popup/PopoverPopup.js +0 -30
- package/popover/portal/PopoverPortal.d.ts +1 -1
- package/popover/positioner/PopoverPositioner.d.ts +1 -1
- package/popover/positioner/PopoverPositioner.js +2 -1
- package/popover/root/PopoverRoot.d.ts +2 -2
- package/popover/store/PopoverStore.d.ts +4 -2
- package/popover/store/PopoverStore.js +8 -5
- package/popover/title/PopoverTitle.d.ts +1 -1
- package/popover/trigger/PopoverTrigger.js +2 -2
- package/popover/viewport/PopoverViewport.d.ts +1 -1
- package/popover/viewport/PopoverViewport.js +28 -12
- package/preview-card/arrow/PreviewCardArrow.d.ts +1 -1
- package/preview-card/arrow/PreviewCardArrow.js +2 -3
- package/preview-card/backdrop/PreviewCardBackdrop.d.ts +1 -1
- package/preview-card/backdrop/PreviewCardBackdrop.js +4 -5
- package/preview-card/index.parts.d.ts +3 -1
- package/preview-card/index.parts.js +21 -1
- package/preview-card/popup/PreviewCardPopup.d.ts +2 -1
- package/preview-card/popup/PreviewCardPopup.js +17 -11
- package/preview-card/portal/PreviewCardPortal.d.ts +1 -1
- package/preview-card/portal/PreviewCardPortal.js +2 -3
- package/preview-card/positioner/PreviewCardPositioner.d.ts +2 -1
- package/preview-card/positioner/PreviewCardPositioner.js +16 -11
- package/preview-card/root/PreviewCardContext.d.ts +5 -26
- package/preview-card/root/PreviewCardContext.js +2 -2
- package/preview-card/root/PreviewCardRoot.d.ts +35 -10
- package/preview-card/root/PreviewCardRoot.js +59 -113
- package/preview-card/store/PreviewCardHandle.d.ts +33 -0
- package/preview-card/store/PreviewCardHandle.js +63 -0
- package/preview-card/store/PreviewCardStore.d.ts +36 -0
- package/preview-card/store/PreviewCardStore.js +105 -0
- package/preview-card/trigger/PreviewCardTrigger.d.ts +15 -3
- package/preview-card/trigger/PreviewCardTrigger.js +50 -13
- package/preview-card/viewport/PreviewCardViewport.d.ts +22 -0
- package/preview-card/viewport/PreviewCardViewport.js +278 -0
- package/preview-card/viewport/PreviewCardViewportCssVars.d.ts +14 -0
- package/preview-card/viewport/PreviewCardViewportCssVars.js +21 -0
- package/preview-card/viewport/PreviewCardViewportDataAttributes.d.ts +26 -0
- package/preview-card/viewport/PreviewCardViewportDataAttributes.js +33 -0
- package/progress/indicator/ProgressIndicator.d.ts +1 -1
- package/progress/label/ProgressLabel.d.ts +1 -1
- package/progress/root/ProgressRoot.d.ts +1 -1
- package/progress/track/ProgressTrack.d.ts +1 -1
- package/progress/value/ProgressValue.d.ts +1 -1
- package/radio/indicator/RadioIndicator.d.ts +1 -1
- package/radio/root/RadioRoot.d.ts +1 -1
- package/radio/root/RadioRoot.js +8 -8
- package/radio-group/RadioGroup.d.ts +4 -4
- package/radio-group/RadioGroup.js +1 -1
- package/scroll-area/content/ScrollAreaContent.d.ts +1 -1
- package/scroll-area/content/ScrollAreaContent.js +10 -1
- package/scroll-area/corner/ScrollAreaCorner.d.ts +1 -1
- package/scroll-area/corner/ScrollAreaCorner.js +1 -1
- package/scroll-area/root/ScrollAreaRoot.d.ts +26 -2
- package/scroll-area/root/ScrollAreaRoot.js +33 -29
- package/scroll-area/root/ScrollAreaRootContext.d.ts +10 -43
- package/scroll-area/scrollbar/ScrollAreaScrollbar.d.ts +1 -1
- package/scroll-area/scrollbar/ScrollAreaScrollbar.js +4 -4
- package/scroll-area/thumb/ScrollAreaThumb.d.ts +2 -2
- package/scroll-area/thumb/ScrollAreaThumb.js +1 -1
- package/scroll-area/viewport/ScrollAreaViewport.d.ts +1 -1
- package/scroll-area/viewport/ScrollAreaViewport.js +51 -25
- package/select/arrow/SelectArrow.d.ts +1 -1
- package/select/backdrop/SelectBackdrop.d.ts +1 -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/item/SelectItem.d.ts +1 -1
- package/select/item/SelectItem.js +0 -1
- package/select/item-indicator/SelectItemIndicator.d.ts +1 -1
- package/select/item-text/SelectItemText.d.ts +1 -1
- package/select/list/SelectList.d.ts +1 -1
- package/select/popup/SelectPopup.d.ts +1 -1
- package/select/popup/SelectPopup.js +154 -95
- package/select/portal/SelectPortal.d.ts +1 -1
- package/select/positioner/SelectPositioner.d.ts +1 -1
- package/select/root/SelectRoot.d.ts +2 -2
- package/select/root/SelectRoot.js +24 -11
- package/select/scroll-arrow/SelectScrollArrow.d.ts +1 -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 +2 -1
- package/select/store.js +18 -12
- package/select/trigger/SelectTrigger.d.ts +14 -4
- package/select/trigger/SelectTrigger.js +50 -18
- package/select/value/SelectValue.d.ts +6 -1
- package/select/value/SelectValue.js +18 -4
- package/separator/Separator.d.ts +1 -1
- package/slider/control/SliderControl.d.ts +1 -1
- package/slider/control/SliderControl.js +1 -1
- package/slider/control/SliderControlDataAttributes.d.ts +0 -8
- package/slider/control/SliderControlDataAttributes.js +0 -8
- package/slider/indicator/SliderIndicator.d.ts +1 -1
- package/slider/indicator/SliderIndicatorDataAttributes.d.ts +0 -8
- package/slider/indicator/SliderIndicatorDataAttributes.js +0 -8
- package/slider/root/SliderRootDataAttributes.d.ts +0 -8
- package/slider/root/SliderRootDataAttributes.js +0 -8
- package/slider/thumb/SliderThumb.d.ts +2 -2
- package/slider/thumb/SliderThumb.js +7 -1
- package/slider/thumb/SliderThumbDataAttributes.d.ts +0 -8
- package/slider/thumb/SliderThumbDataAttributes.js +0 -8
- package/slider/track/SliderTrack.d.ts +1 -1
- package/slider/track/SliderTrackDataAttributes.d.ts +0 -8
- package/slider/track/SliderTrackDataAttributes.js +0 -8
- package/slider/value/SliderValue.d.ts +1 -1
- package/slider/value/SliderValueDataAttributes.d.ts +0 -8
- package/slider/value/SliderValueDataAttributes.js +0 -8
- package/switch/root/SwitchRoot.d.ts +6 -1
- package/switch/root/SwitchRoot.js +14 -5
- package/switch/thumb/SwitchThumb.d.ts +1 -1
- package/tabs/indicator/TabsIndicator.d.ts +1 -1
- package/tabs/indicator/TabsIndicator.js +6 -0
- package/tabs/list/TabsList.d.ts +1 -1
- package/tabs/panel/TabsPanel.d.ts +1 -1
- package/tabs/root/TabsRoot.d.ts +1 -1
- package/tabs/tab/TabsTab.d.ts +1 -1
- package/toast/action/ToastAction.d.ts +1 -1
- package/toast/arrow/ToastArrow.d.ts +1 -1
- package/toast/close/ToastClose.d.ts +1 -1
- package/toast/content/ToastContent.d.ts +1 -1
- package/toast/description/ToastDescription.d.ts +1 -1
- package/toast/portal/ToastPortal.d.ts +1 -1
- package/toast/positioner/ToastPositioner.d.ts +1 -1
- package/toast/provider/ToastProvider.js +46 -19
- package/toast/root/ToastRoot.d.ts +1 -1
- package/toast/title/ToastTitle.d.ts +1 -1
- 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 +1 -1
- package/toolbar/group/ToolbarGroup.d.ts +1 -1
- package/toolbar/input/ToolbarInput.d.ts +1 -1
- package/toolbar/link/ToolbarLink.d.ts +1 -1
- package/toolbar/root/ToolbarRoot.d.ts +1 -1
- package/toolbar/separator/ToolbarSeparator.d.ts +1 -1
- package/tooltip/arrow/TooltipArrow.d.ts +1 -1
- package/tooltip/popup/TooltipPopup.d.ts +1 -1
- package/tooltip/popup/TooltipPopup.js +0 -31
- package/tooltip/portal/TooltipPortal.d.ts +1 -1
- package/tooltip/positioner/TooltipPositioner.d.ts +1 -1
- package/tooltip/positioner/TooltipPositioner.js +2 -1
- package/tooltip/root/TooltipRoot.d.ts +4 -6
- package/tooltip/root/TooltipRoot.js +1 -2
- package/tooltip/store/TooltipStore.d.ts +4 -2
- package/tooltip/store/TooltipStore.js +7 -4
- package/tooltip/trigger/TooltipTrigger.js +1 -1
- package/tooltip/viewport/TooltipViewport.d.ts +1 -1
- package/tooltip/viewport/TooltipViewport.js +28 -12
- package/use-render/index.d.ts +2 -1
- package/utils/FloatingPortalLite.d.ts +1 -1
- package/utils/popups/popupStoreUtils.js +21 -2
- package/utils/resolveValueLabel.d.ts +5 -1
- package/utils/resolveValueLabel.js +48 -22
- package/utils/styles.d.ts +1 -1
- package/utils/styles.js +10 -6
- package/utils/types.d.ts +1 -1
- package/utils/useAnimationsFinished.d.ts +2 -2
- package/utils/useAnimationsFinished.js +56 -33
- package/utils/useOpenChangeComplete.js +8 -10
- package/utils/useOpenInteractionType.js +6 -1
- package/utils/usePopupAutoResize.js +82 -46
- package/esm/utils/interactions/useFocusWithDelay.d.ts +0 -9
- package/esm/utils/interactions/useFocusWithDelay.js +0 -81
- package/utils/interactions/useFocusWithDelay.d.ts +0 -9
- package/utils/interactions/useFocusWithDelay.js +0 -87
- /package/esm/utils/{useMixedToggleClickHander.d.ts → useMixedToggleClickHandler.d.ts} +0 -0
- /package/esm/utils/{useMixedToggleClickHander.js → useMixedToggleClickHandler.js} +0 -0
- /package/utils/{useMixedToggleClickHander.d.ts → useMixedToggleClickHandler.d.ts} +0 -0
- /package/utils/{useMixedToggleClickHander.js → useMixedToggleClickHandler.js} +0 -0
|
@@ -20,7 +20,10 @@ import { mergeProps } from "../../merge-props/index.js";
|
|
|
20
20
|
import { useButton } from "../../use-button/index.js";
|
|
21
21
|
import { createChangeEventDetails } from "../../utils/createBaseUIEventDetails.js";
|
|
22
22
|
import { REASONS } from "../../utils/reasons.js";
|
|
23
|
+
import { useLabelableId } from "../../labelable-provider/useLabelableId.js";
|
|
23
24
|
const BOUNDARY_OFFSET = 2;
|
|
25
|
+
const SELECTED_DELAY = 400;
|
|
26
|
+
const UNSELECTED_DELAY = 200;
|
|
24
27
|
const stateAttributesMapping = {
|
|
25
28
|
...pressableTriggerOpenStateMapping,
|
|
26
29
|
...fieldValidityMapping,
|
|
@@ -37,6 +40,7 @@ export const SelectTrigger = /*#__PURE__*/React.forwardRef(function SelectTrigge
|
|
|
37
40
|
const {
|
|
38
41
|
render,
|
|
39
42
|
className,
|
|
43
|
+
id: idProp,
|
|
40
44
|
disabled: disabledProp = false,
|
|
41
45
|
nativeButton = true,
|
|
42
46
|
...elementProps
|
|
@@ -57,6 +61,7 @@ export const SelectTrigger = /*#__PURE__*/React.forwardRef(function SelectTrigge
|
|
|
57
61
|
selectionRef,
|
|
58
62
|
validation,
|
|
59
63
|
readOnly,
|
|
64
|
+
required,
|
|
60
65
|
alignItemWithTriggerActiveRef,
|
|
61
66
|
disabled: selectDisabled,
|
|
62
67
|
keyboardActiveRef
|
|
@@ -67,11 +72,16 @@ export const SelectTrigger = /*#__PURE__*/React.forwardRef(function SelectTrigge
|
|
|
67
72
|
const triggerProps = useStore(store, selectors.triggerProps);
|
|
68
73
|
const positionerElement = useStore(store, selectors.positionerElement);
|
|
69
74
|
const listElement = useStore(store, selectors.listElement);
|
|
70
|
-
const
|
|
75
|
+
const rootId = useStore(store, selectors.id);
|
|
76
|
+
const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
|
|
77
|
+
const shouldCheckNullItemLabel = !hasSelectedValue && open;
|
|
78
|
+
const hasNullItemLabel = useStore(store, selectors.hasNullItemLabel, shouldCheckNullItemLabel);
|
|
79
|
+
const id = idProp ?? rootId;
|
|
80
|
+
useLabelableId({
|
|
81
|
+
id
|
|
82
|
+
});
|
|
71
83
|
const positionerRef = useValueAsRef(positionerElement);
|
|
72
84
|
const triggerRef = React.useRef(null);
|
|
73
|
-
const timeoutFocus = useTimeout();
|
|
74
|
-
const timeoutMouseDown = useTimeout();
|
|
75
85
|
const {
|
|
76
86
|
getButtonProps,
|
|
77
87
|
buttonRef
|
|
@@ -83,22 +93,37 @@ export const SelectTrigger = /*#__PURE__*/React.forwardRef(function SelectTrigge
|
|
|
83
93
|
store.set('triggerElement', element);
|
|
84
94
|
});
|
|
85
95
|
const mergedRef = useMergedRefs(forwardedRef, triggerRef, buttonRef, setTriggerElement);
|
|
86
|
-
const
|
|
87
|
-
const
|
|
96
|
+
const timeoutFocus = useTimeout();
|
|
97
|
+
const timeoutMouseDown = useTimeout();
|
|
98
|
+
const selectedDelayTimeout = useTimeout();
|
|
99
|
+
const unselectedDelayTimeout = useTimeout();
|
|
88
100
|
React.useEffect(() => {
|
|
89
101
|
if (open) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
selectionRef.current.allowUnselectedMouseUp = true;
|
|
102
|
+
const hasSelectedItemInList = hasSelectedValue || hasNullItemLabel;
|
|
103
|
+
const shouldDelayUnselectedMouseUpLonger = !hasSelectedItemInList;
|
|
93
104
|
|
|
94
|
-
|
|
95
|
-
|
|
105
|
+
// When there is no selected item in the list (placeholder-only selects), a mousedown
|
|
106
|
+
// on the trigger followed by a quick mouseup over the first option can accidentally select
|
|
107
|
+
// within 200ms. Delay unselected mouseup to match the safer 400ms window.
|
|
108
|
+
if (shouldDelayUnselectedMouseUpLonger) {
|
|
109
|
+
selectedDelayTimeout.start(SELECTED_DELAY, () => {
|
|
110
|
+
selectionRef.current.allowUnselectedMouseUp = true;
|
|
96
111
|
selectionRef.current.allowSelectedMouseUp = true;
|
|
97
112
|
});
|
|
98
|
-
}
|
|
113
|
+
} else {
|
|
114
|
+
// mousedown -> move to unselected item -> mouseup should not select within 200ms.
|
|
115
|
+
unselectedDelayTimeout.start(UNSELECTED_DELAY, () => {
|
|
116
|
+
selectionRef.current.allowUnselectedMouseUp = true;
|
|
117
|
+
|
|
118
|
+
// mousedown -> mouseup on selected item should not select within 400ms.
|
|
119
|
+
selectedDelayTimeout.start(UNSELECTED_DELAY, () => {
|
|
120
|
+
selectionRef.current.allowSelectedMouseUp = true;
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
99
124
|
return () => {
|
|
100
|
-
|
|
101
|
-
|
|
125
|
+
selectedDelayTimeout.clear();
|
|
126
|
+
unselectedDelayTimeout.clear();
|
|
102
127
|
};
|
|
103
128
|
}
|
|
104
129
|
selectionRef.current = {
|
|
@@ -107,24 +132,27 @@ export const SelectTrigger = /*#__PURE__*/React.forwardRef(function SelectTrigge
|
|
|
107
132
|
};
|
|
108
133
|
timeoutMouseDown.clear();
|
|
109
134
|
return undefined;
|
|
110
|
-
}, [open, selectionRef, timeoutMouseDown,
|
|
135
|
+
}, [open, hasSelectedValue, hasNullItemLabel, selectionRef, timeoutMouseDown, selectedDelayTimeout, unselectedDelayTimeout]);
|
|
111
136
|
const ariaControlsId = React.useMemo(() => {
|
|
112
137
|
return listElement?.id ?? getFloatingFocusElement(positionerElement)?.id;
|
|
113
138
|
}, [listElement, positionerElement]);
|
|
114
139
|
const props = mergeProps(triggerProps, {
|
|
140
|
+
id,
|
|
115
141
|
role: 'combobox',
|
|
116
142
|
'aria-expanded': open ? 'true' : 'false',
|
|
117
143
|
'aria-haspopup': 'listbox',
|
|
118
144
|
'aria-controls': open ? ariaControlsId : undefined,
|
|
119
145
|
'aria-labelledby': labelId,
|
|
120
146
|
'aria-readonly': readOnly || undefined,
|
|
147
|
+
'aria-required': required || undefined,
|
|
121
148
|
tabIndex: disabled ? -1 : 0,
|
|
122
149
|
ref: mergedRef,
|
|
123
150
|
onFocus(event) {
|
|
124
151
|
setFocused(true);
|
|
152
|
+
|
|
125
153
|
// The popup element shouldn't obscure the focused trigger.
|
|
126
154
|
if (open && alignItemWithTriggerActiveRef.current) {
|
|
127
|
-
setOpen(false, createChangeEventDetails(REASONS.
|
|
155
|
+
setOpen(false, createChangeEventDetails(REASONS.none, event.nativeEvent));
|
|
128
156
|
}
|
|
129
157
|
|
|
130
158
|
// Saves a re-render on initial click: `forceMount === true` mounts
|
|
@@ -136,7 +164,11 @@ export const SelectTrigger = /*#__PURE__*/React.forwardRef(function SelectTrigge
|
|
|
136
164
|
store.set('forceMount', true);
|
|
137
165
|
});
|
|
138
166
|
},
|
|
139
|
-
onBlur() {
|
|
167
|
+
onBlur(event) {
|
|
168
|
+
// If focus is moving into the popup, don't count it as a blur.
|
|
169
|
+
if (contains(positionerElement, event.relatedTarget)) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
140
172
|
setTouched(true);
|
|
141
173
|
setFocused(false);
|
|
142
174
|
if (validationMode === 'onBlur') {
|
|
@@ -189,8 +221,8 @@ export const SelectTrigger = /*#__PURE__*/React.forwardRef(function SelectTrigge
|
|
|
189
221
|
disabled,
|
|
190
222
|
value,
|
|
191
223
|
readOnly,
|
|
192
|
-
placeholder: !
|
|
193
|
-
}), [fieldState, open, disabled, value, readOnly,
|
|
224
|
+
placeholder: !hasSelectedValue
|
|
225
|
+
}), [fieldState, open, disabled, value, readOnly, hasSelectedValue]);
|
|
194
226
|
return useRenderElement('button', componentProps, {
|
|
195
227
|
ref: [forwardedRef, triggerRef],
|
|
196
228
|
state,
|
|
@@ -6,7 +6,7 @@ import type { BaseUIComponentProps } from "../../utils/types.js";
|
|
|
6
6
|
*
|
|
7
7
|
* Documentation: [Base UI Select](https://base-ui.com/react/components/select)
|
|
8
8
|
*/
|
|
9
|
-
export declare const SelectValue: React.ForwardRefExoticComponent<SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
9
|
+
export declare const SelectValue: React.ForwardRefExoticComponent<Omit<SelectValueProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
10
10
|
export interface SelectValueState {
|
|
11
11
|
/**
|
|
12
12
|
* The value of the currently selected item.
|
|
@@ -24,6 +24,11 @@ export interface SelectValueProps extends Omit<BaseUIComponentProps<'span', Sele
|
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
children?: React.ReactNode | ((value: any) => React.ReactNode);
|
|
27
|
+
/**
|
|
28
|
+
* The placeholder value to display when no value is selected.
|
|
29
|
+
* This is overridden by `children` if specified, or by a null item's label in `items`.
|
|
30
|
+
*/
|
|
31
|
+
placeholder?: React.ReactNode;
|
|
27
32
|
}
|
|
28
33
|
export declare namespace SelectValue {
|
|
29
34
|
type State = SelectValueState;
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { useStore } from '@base-ui/utils/store';
|
|
5
5
|
import { useRenderElement } from "../../utils/useRenderElement.js";
|
|
6
6
|
import { useSelectRootContext } from "../root/SelectRootContext.js";
|
|
7
|
-
import {
|
|
7
|
+
import { resolveMultipleLabels, resolveSelectedLabel } from "../../utils/resolveValueLabel.js";
|
|
8
8
|
import { selectors } from "../store.js";
|
|
9
9
|
const stateAttributesMapping = {
|
|
10
10
|
value: () => null
|
|
@@ -21,6 +21,7 @@ export const SelectValue = /*#__PURE__*/React.forwardRef(function SelectValue(co
|
|
|
21
21
|
className,
|
|
22
22
|
render,
|
|
23
23
|
children: childrenProp,
|
|
24
|
+
placeholder,
|
|
24
25
|
...elementProps
|
|
25
26
|
} = componentProps;
|
|
26
27
|
const {
|
|
@@ -30,12 +31,25 @@ export const SelectValue = /*#__PURE__*/React.forwardRef(function SelectValue(co
|
|
|
30
31
|
const value = useStore(store, selectors.value);
|
|
31
32
|
const items = useStore(store, selectors.items);
|
|
32
33
|
const itemToStringLabel = useStore(store, selectors.itemToStringLabel);
|
|
33
|
-
const
|
|
34
|
+
const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
|
|
35
|
+
const shouldCheckNullItemLabel = !hasSelectedValue && placeholder != null && childrenProp == null;
|
|
36
|
+
const hasNullLabel = useStore(store, selectors.hasNullItemLabel, shouldCheckNullItemLabel);
|
|
34
37
|
const state = React.useMemo(() => ({
|
|
35
38
|
value,
|
|
36
|
-
placeholder: !
|
|
37
|
-
}), [value,
|
|
38
|
-
|
|
39
|
+
placeholder: !hasSelectedValue
|
|
40
|
+
}), [value, hasSelectedValue]);
|
|
41
|
+
let children = null;
|
|
42
|
+
if (typeof childrenProp === 'function') {
|
|
43
|
+
children = childrenProp(value);
|
|
44
|
+
} else if (childrenProp != null) {
|
|
45
|
+
children = childrenProp;
|
|
46
|
+
} else if (!hasSelectedValue && placeholder != null && !hasNullLabel) {
|
|
47
|
+
children = placeholder;
|
|
48
|
+
} else if (Array.isArray(value)) {
|
|
49
|
+
children = resolveMultipleLabels(value, items, itemToStringLabel);
|
|
50
|
+
} else {
|
|
51
|
+
children = resolveSelectedLabel(value, items, itemToStringLabel);
|
|
52
|
+
}
|
|
39
53
|
const element = useRenderElement('span', componentProps, {
|
|
40
54
|
state,
|
|
41
55
|
ref: [forwardedRef, valueRef],
|
|
@@ -6,7 +6,7 @@ import type { BaseUIComponentProps, Orientation } from "../utils/types.js";
|
|
|
6
6
|
*
|
|
7
7
|
* Documentation: [Base UI Separator](https://base-ui.com/react/components/separator)
|
|
8
8
|
*/
|
|
9
|
-
export declare const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
export interface SeparatorProps extends BaseUIComponentProps<'div', Separator.State> {
|
|
11
11
|
/**
|
|
12
12
|
* The orientation of the separator.
|
|
@@ -7,7 +7,7 @@ import type { SliderRoot } from "../root/SliderRoot.js";
|
|
|
7
7
|
*
|
|
8
8
|
* Documentation: [Base UI Slider](https://base-ui.com/react/components/slider)
|
|
9
9
|
*/
|
|
10
|
-
export declare const SliderControl: React.ForwardRefExoticComponent<SliderControlProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const SliderControl: React.ForwardRefExoticComponent<Omit<SliderControlProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
export interface SliderControlProps extends BaseUIComponentProps<'div', SliderRoot.State> {}
|
|
12
12
|
export declare namespace SliderControl {
|
|
13
13
|
type State = SliderRoot.State;
|
|
@@ -267,7 +267,6 @@ export const SliderControl = /*#__PURE__*/React.forwardRef(function SliderContro
|
|
|
267
267
|
setDragging(false);
|
|
268
268
|
pressedInputRef.current = null;
|
|
269
269
|
pressedThumbCenterOffsetRef.current = null;
|
|
270
|
-
pressedThumbIndexRef.current = -1;
|
|
271
270
|
const fingerCoords = getFingerCoords(nativeEvent, touchIdRef);
|
|
272
271
|
const finger = fingerCoords != null ? getFingerState(fingerCoords) : null;
|
|
273
272
|
if (finger != null) {
|
|
@@ -278,6 +277,7 @@ export const SliderControl = /*#__PURE__*/React.forwardRef(function SliderContro
|
|
|
278
277
|
if ('pointerType' in nativeEvent && controlRef.current?.hasPointerCapture(nativeEvent.pointerId)) {
|
|
279
278
|
controlRef.current?.releasePointerCapture(nativeEvent.pointerId);
|
|
280
279
|
}
|
|
280
|
+
pressedThumbIndexRef.current = -1;
|
|
281
281
|
touchIdRef.current = null;
|
|
282
282
|
pressedValuesRef.current = null;
|
|
283
283
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
@@ -12,14 +12,6 @@ export declare enum SliderControlDataAttributes {
|
|
|
12
12
|
* Present when the slider is disabled.
|
|
13
13
|
*/
|
|
14
14
|
disabled = "data-disabled",
|
|
15
|
-
/**
|
|
16
|
-
* Present when the slider is readonly.
|
|
17
|
-
*/
|
|
18
|
-
readonly = "data-readonly",
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is required.
|
|
21
|
-
*/
|
|
22
|
-
required = "data-required",
|
|
23
15
|
/**
|
|
24
16
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
25
17
|
*/
|
|
@@ -12,14 +12,6 @@ export let SliderControlDataAttributes = /*#__PURE__*/function (SliderControlDat
|
|
|
12
12
|
* Present when the slider is disabled.
|
|
13
13
|
*/
|
|
14
14
|
SliderControlDataAttributes["disabled"] = "data-disabled";
|
|
15
|
-
/**
|
|
16
|
-
* Present when the slider is readonly.
|
|
17
|
-
*/
|
|
18
|
-
SliderControlDataAttributes["readonly"] = "data-readonly";
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is required.
|
|
21
|
-
*/
|
|
22
|
-
SliderControlDataAttributes["required"] = "data-required";
|
|
23
15
|
/**
|
|
24
16
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
25
17
|
*/
|
|
@@ -7,7 +7,7 @@ import type { SliderRoot } from "../root/SliderRoot.js";
|
|
|
7
7
|
*
|
|
8
8
|
* Documentation: [Base UI Slider](https://base-ui.com/react/components/slider)
|
|
9
9
|
*/
|
|
10
|
-
export declare const SliderIndicator: React.ForwardRefExoticComponent<SliderIndicatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const SliderIndicator: React.ForwardRefExoticComponent<Omit<SliderIndicatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
export interface SliderIndicatorProps extends BaseUIComponentProps<'div', SliderRoot.State> {}
|
|
12
12
|
export declare namespace SliderIndicator {
|
|
13
13
|
type Props = SliderIndicatorProps;
|
|
@@ -12,14 +12,6 @@ export declare enum SliderIndicatorDataAttributes {
|
|
|
12
12
|
* Present when the slider is disabled.
|
|
13
13
|
*/
|
|
14
14
|
disabled = "data-disabled",
|
|
15
|
-
/**
|
|
16
|
-
* Present when the slider is readonly.
|
|
17
|
-
*/
|
|
18
|
-
readonly = "data-readonly",
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is required.
|
|
21
|
-
*/
|
|
22
|
-
required = "data-required",
|
|
23
15
|
/**
|
|
24
16
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
25
17
|
*/
|
|
@@ -12,14 +12,6 @@ export let SliderIndicatorDataAttributes = /*#__PURE__*/function (SliderIndicato
|
|
|
12
12
|
* Present when the slider is disabled.
|
|
13
13
|
*/
|
|
14
14
|
SliderIndicatorDataAttributes["disabled"] = "data-disabled";
|
|
15
|
-
/**
|
|
16
|
-
* Present when the slider is readonly.
|
|
17
|
-
*/
|
|
18
|
-
SliderIndicatorDataAttributes["readonly"] = "data-readonly";
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is required.
|
|
21
|
-
*/
|
|
22
|
-
SliderIndicatorDataAttributes["required"] = "data-required";
|
|
23
15
|
/**
|
|
24
16
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
25
17
|
*/
|
|
@@ -12,14 +12,6 @@ export declare enum SliderRootDataAttributes {
|
|
|
12
12
|
* Present when the slider is disabled.
|
|
13
13
|
*/
|
|
14
14
|
disabled = "data-disabled",
|
|
15
|
-
/**
|
|
16
|
-
* Present when the slider is readonly.
|
|
17
|
-
*/
|
|
18
|
-
readonly = "data-readonly",
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is required.
|
|
21
|
-
*/
|
|
22
|
-
required = "data-required",
|
|
23
15
|
/**
|
|
24
16
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
25
17
|
*/
|
|
@@ -12,14 +12,6 @@ export let SliderRootDataAttributes = /*#__PURE__*/function (SliderRootDataAttri
|
|
|
12
12
|
* Present when the slider is disabled.
|
|
13
13
|
*/
|
|
14
14
|
SliderRootDataAttributes["disabled"] = "data-disabled";
|
|
15
|
-
/**
|
|
16
|
-
* Present when the slider is readonly.
|
|
17
|
-
*/
|
|
18
|
-
SliderRootDataAttributes["readonly"] = "data-readonly";
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is required.
|
|
21
|
-
*/
|
|
22
|
-
SliderRootDataAttributes["required"] = "data-required";
|
|
23
15
|
/**
|
|
24
16
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
25
17
|
*/
|
|
@@ -3,12 +3,12 @@ import { BaseUIComponentProps } from "../../utils/types.js";
|
|
|
3
3
|
import { type LabelableContext } from "../../labelable-provider/LabelableContext.js";
|
|
4
4
|
import type { SliderRoot } from "../root/SliderRoot.js";
|
|
5
5
|
/**
|
|
6
|
-
* The draggable part of the
|
|
6
|
+
* The draggable part of the slider at the tip of the indicator.
|
|
7
7
|
* Renders a `<div>` element and a nested `<input type="range">`.
|
|
8
8
|
*
|
|
9
9
|
* Documentation: [Base UI Slider](https://base-ui.com/react/components/slider)
|
|
10
10
|
*/
|
|
11
|
-
export declare const SliderThumb: React.ForwardRefExoticComponent<SliderThumbProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export declare const SliderThumb: React.ForwardRefExoticComponent<Omit<SliderThumbProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
export interface ThumbMetadata {
|
|
13
13
|
inputId: LabelableContext['controlId'];
|
|
14
14
|
}
|
|
@@ -14,6 +14,7 @@ import { valueToPercent } from "../../utils/valueToPercent.js";
|
|
|
14
14
|
import { ARROW_DOWN, ARROW_UP, ARROW_RIGHT, ARROW_LEFT, HOME, END, COMPOSITE_KEYS } from "../../composite/composite.js";
|
|
15
15
|
import { useCompositeListItem } from "../../composite/list/useCompositeListItem.js";
|
|
16
16
|
import { useDirection } from "../../direction-provider/DirectionContext.js";
|
|
17
|
+
import { useCSPContext } from "../../csp-provider/CSPContext.js";
|
|
17
18
|
import { useFieldRootContext } from "../../field/root/FieldRootContext.js";
|
|
18
19
|
import { useLabelableId } from "../../labelable-provider/useLabelableId.js";
|
|
19
20
|
import { getMidpoint } from "../utils/getMidpoint.js";
|
|
@@ -44,7 +45,7 @@ function getNewValue(thumbValue, step, direction, min, max) {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
|
-
* The draggable part of the
|
|
48
|
+
* The draggable part of the slider at the tip of the indicator.
|
|
48
49
|
* Renders a `<div>` element and a nested `<input type="range">`.
|
|
49
50
|
*
|
|
50
51
|
* Documentation: [Base UI Slider](https://base-ui.com/react/components/slider)
|
|
@@ -69,6 +70,9 @@ export const SliderThumb = /*#__PURE__*/React.forwardRef(function SliderThumb(co
|
|
|
69
70
|
tabIndex: tabIndexProp,
|
|
70
71
|
...elementProps
|
|
71
72
|
} = componentProps;
|
|
73
|
+
const {
|
|
74
|
+
nonce
|
|
75
|
+
} = useCSPContext();
|
|
72
76
|
const id = useBaseUiId(idProp);
|
|
73
77
|
const {
|
|
74
78
|
active: activeIndex,
|
|
@@ -303,7 +307,9 @@ export const SliderThumb = /*#__PURE__*/React.forwardRef(function SliderThumb(co
|
|
|
303
307
|
// this must be rendered with the last thumb to ensure all
|
|
304
308
|
// preceding thumbs are already rendered in the DOM
|
|
305
309
|
last && /*#__PURE__*/_jsx("script", {
|
|
310
|
+
nonce: nonce
|
|
306
311
|
// eslint-disable-next-line react/no-danger
|
|
312
|
+
,
|
|
307
313
|
dangerouslySetInnerHTML: {
|
|
308
314
|
__html: prehydrationScript
|
|
309
315
|
},
|
|
@@ -16,14 +16,6 @@ export declare enum SliderThumbDataAttributes {
|
|
|
16
16
|
* Present when the slider is disabled.
|
|
17
17
|
*/
|
|
18
18
|
disabled = "data-disabled",
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is readonly.
|
|
21
|
-
*/
|
|
22
|
-
readonly = "data-readonly",
|
|
23
|
-
/**
|
|
24
|
-
* Present when the slider is required.
|
|
25
|
-
*/
|
|
26
|
-
required = "data-required",
|
|
27
19
|
/**
|
|
28
20
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
29
21
|
*/
|
|
@@ -16,14 +16,6 @@ export let SliderThumbDataAttributes = /*#__PURE__*/function (SliderThumbDataAtt
|
|
|
16
16
|
* Present when the slider is disabled.
|
|
17
17
|
*/
|
|
18
18
|
SliderThumbDataAttributes["disabled"] = "data-disabled";
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is readonly.
|
|
21
|
-
*/
|
|
22
|
-
SliderThumbDataAttributes["readonly"] = "data-readonly";
|
|
23
|
-
/**
|
|
24
|
-
* Present when the slider is required.
|
|
25
|
-
*/
|
|
26
|
-
SliderThumbDataAttributes["required"] = "data-required";
|
|
27
19
|
/**
|
|
28
20
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
29
21
|
*/
|
|
@@ -7,7 +7,7 @@ import type { SliderRoot } from "../root/SliderRoot.js";
|
|
|
7
7
|
*
|
|
8
8
|
* Documentation: [Base UI Slider](https://base-ui.com/react/components/slider)
|
|
9
9
|
*/
|
|
10
|
-
export declare const SliderTrack: React.ForwardRefExoticComponent<SliderTrackProps & React.RefAttributes<
|
|
10
|
+
export declare const SliderTrack: React.ForwardRefExoticComponent<Omit<SliderTrackProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
export interface SliderTrackProps extends BaseUIComponentProps<'div', SliderRoot.State> {}
|
|
12
12
|
export declare namespace SliderTrack {
|
|
13
13
|
type Props = SliderTrackProps;
|
|
@@ -12,14 +12,6 @@ export declare enum SliderTrackDataAttributes {
|
|
|
12
12
|
* Present when the slider is disabled.
|
|
13
13
|
*/
|
|
14
14
|
disabled = "data-disabled",
|
|
15
|
-
/**
|
|
16
|
-
* Present when the slider is readonly.
|
|
17
|
-
*/
|
|
18
|
-
readonly = "data-readonly",
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is required.
|
|
21
|
-
*/
|
|
22
|
-
required = "data-required",
|
|
23
15
|
/**
|
|
24
16
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
25
17
|
*/
|
|
@@ -12,14 +12,6 @@ export let SliderTrackDataAttributes = /*#__PURE__*/function (SliderTrackDataAtt
|
|
|
12
12
|
* Present when the slider is disabled.
|
|
13
13
|
*/
|
|
14
14
|
SliderTrackDataAttributes["disabled"] = "data-disabled";
|
|
15
|
-
/**
|
|
16
|
-
* Present when the slider is readonly.
|
|
17
|
-
*/
|
|
18
|
-
SliderTrackDataAttributes["readonly"] = "data-readonly";
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is required.
|
|
21
|
-
*/
|
|
22
|
-
SliderTrackDataAttributes["required"] = "data-required";
|
|
23
15
|
/**
|
|
24
16
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
25
17
|
*/
|
|
@@ -7,7 +7,7 @@ import type { SliderRoot } from "../root/SliderRoot.js";
|
|
|
7
7
|
*
|
|
8
8
|
* Documentation: [Base UI Slider](https://base-ui.com/react/components/slider)
|
|
9
9
|
*/
|
|
10
|
-
export declare const SliderValue: React.ForwardRefExoticComponent<SliderValueProps & React.RefAttributes<HTMLOutputElement>>;
|
|
10
|
+
export declare const SliderValue: React.ForwardRefExoticComponent<Omit<SliderValueProps, "ref"> & React.RefAttributes<HTMLOutputElement>>;
|
|
11
11
|
export interface SliderValueProps extends Omit<BaseUIComponentProps<'output', SliderRoot.State>, 'children'> {
|
|
12
12
|
children?: null | ((formattedValues: readonly string[], values: readonly number[]) => React.ReactNode);
|
|
13
13
|
}
|
|
@@ -12,14 +12,6 @@ export declare enum SliderValueDataAttributes {
|
|
|
12
12
|
* Present when the slider is disabled.
|
|
13
13
|
*/
|
|
14
14
|
disabled = "data-disabled",
|
|
15
|
-
/**
|
|
16
|
-
* Present when the slider is readonly.
|
|
17
|
-
*/
|
|
18
|
-
readonly = "data-readonly",
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is required.
|
|
21
|
-
*/
|
|
22
|
-
required = "data-required",
|
|
23
15
|
/**
|
|
24
16
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
25
17
|
*/
|
|
@@ -12,14 +12,6 @@ export let SliderValueDataAttributes = /*#__PURE__*/function (SliderValueDataAtt
|
|
|
12
12
|
* Present when the slider is disabled.
|
|
13
13
|
*/
|
|
14
14
|
SliderValueDataAttributes["disabled"] = "data-disabled";
|
|
15
|
-
/**
|
|
16
|
-
* Present when the slider is readonly.
|
|
17
|
-
*/
|
|
18
|
-
SliderValueDataAttributes["readonly"] = "data-readonly";
|
|
19
|
-
/**
|
|
20
|
-
* Present when the slider is required.
|
|
21
|
-
*/
|
|
22
|
-
SliderValueDataAttributes["required"] = "data-required";
|
|
23
15
|
/**
|
|
24
16
|
* Present when the slider is in valid state (when wrapped in Field.Root).
|
|
25
17
|
*/
|
|
@@ -9,7 +9,7 @@ import type { BaseUIChangeEventDetails } from "../../types/index.js";
|
|
|
9
9
|
*
|
|
10
10
|
* Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)
|
|
11
11
|
*/
|
|
12
|
-
export declare const SwitchRoot: React.ForwardRefExoticComponent<SwitchRootProps & React.RefAttributes<HTMLElement>>;
|
|
12
|
+
export declare const SwitchRoot: React.ForwardRefExoticComponent<Omit<SwitchRootProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
13
13
|
export interface SwitchRootState extends FieldRoot.State {
|
|
14
14
|
/**
|
|
15
15
|
* Whether the switch is currently active.
|
|
@@ -73,6 +73,11 @@ export interface SwitchRootProps extends NonNativeButtonProps, Omit<BaseUICompon
|
|
|
73
73
|
* @default false
|
|
74
74
|
*/
|
|
75
75
|
required?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* The value submitted with the form when the switch is on.
|
|
78
|
+
* By default, switch submits the "on" value, matching native checkbox behavior.
|
|
79
|
+
*/
|
|
80
|
+
value?: string;
|
|
76
81
|
/**
|
|
77
82
|
* The value submitted with the form when the switch is off.
|
|
78
83
|
* By default, unchecked switches do not submit any value, matching native checkbox behavior.
|
|
@@ -5,7 +5,8 @@ import { useControlled } from '@base-ui/utils/useControlled';
|
|
|
5
5
|
import { useStableCallback } from '@base-ui/utils/useStableCallback';
|
|
6
6
|
import { useMergedRefs } from '@base-ui/utils/useMergedRefs';
|
|
7
7
|
import { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';
|
|
8
|
-
import { visuallyHidden } from '@base-ui/utils/visuallyHidden';
|
|
8
|
+
import { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';
|
|
9
|
+
import { EMPTY_OBJECT } from '@base-ui/utils/empty';
|
|
9
10
|
import { useRenderElement } from "../../utils/useRenderElement.js";
|
|
10
11
|
import { mergeProps } from "../../merge-props/index.js";
|
|
11
12
|
import { useBaseUiId } from "../../utils/useBaseUiId.js";
|
|
@@ -43,6 +44,7 @@ export const SwitchRoot = /*#__PURE__*/React.forwardRef(function SwitchRoot(comp
|
|
|
43
44
|
disabled: disabledProp = false,
|
|
44
45
|
render,
|
|
45
46
|
uncheckedValue,
|
|
47
|
+
value,
|
|
46
48
|
...elementProps
|
|
47
49
|
} = componentProps;
|
|
48
50
|
const {
|
|
@@ -71,11 +73,12 @@ export const SwitchRoot = /*#__PURE__*/React.forwardRef(function SwitchRoot(comp
|
|
|
71
73
|
const handleInputRef = useMergedRefs(inputRef, externalInputRef, validation.inputRef);
|
|
72
74
|
const switchRef = React.useRef(null);
|
|
73
75
|
const id = useBaseUiId();
|
|
74
|
-
const
|
|
76
|
+
const controlId = useLabelableId({
|
|
75
77
|
id: idProp,
|
|
76
78
|
implicit: false,
|
|
77
79
|
controlRef: switchRef
|
|
78
80
|
});
|
|
81
|
+
const hiddenInputId = nativeButton ? undefined : controlId;
|
|
79
82
|
const [checked, setCheckedState] = useControlled({
|
|
80
83
|
controlled: checkedProp,
|
|
81
84
|
default: Boolean(defaultChecked),
|
|
@@ -113,10 +116,11 @@ export const SwitchRoot = /*#__PURE__*/React.forwardRef(function SwitchRoot(comp
|
|
|
113
116
|
native: nativeButton
|
|
114
117
|
});
|
|
115
118
|
const rootProps = {
|
|
116
|
-
id,
|
|
119
|
+
id: nativeButton ? controlId : id,
|
|
117
120
|
role: 'switch',
|
|
118
121
|
'aria-checked': checked,
|
|
119
122
|
'aria-readonly': readOnly || undefined,
|
|
123
|
+
'aria-required': required || undefined,
|
|
120
124
|
'aria-labelledby': labelId,
|
|
121
125
|
onFocus() {
|
|
122
126
|
if (!disabled) {
|
|
@@ -145,10 +149,10 @@ export const SwitchRoot = /*#__PURE__*/React.forwardRef(function SwitchRoot(comp
|
|
|
145
149
|
const inputProps = React.useMemo(() => mergeProps({
|
|
146
150
|
checked,
|
|
147
151
|
disabled,
|
|
148
|
-
id:
|
|
152
|
+
id: hiddenInputId,
|
|
149
153
|
name,
|
|
150
154
|
required,
|
|
151
|
-
style: visuallyHidden,
|
|
155
|
+
style: name ? visuallyHiddenInput : visuallyHidden,
|
|
152
156
|
tabIndex: -1,
|
|
153
157
|
type: 'checkbox',
|
|
154
158
|
'aria-hidden': true,
|
|
@@ -169,7 +173,12 @@ export const SwitchRoot = /*#__PURE__*/React.forwardRef(function SwitchRoot(comp
|
|
|
169
173
|
onFocus() {
|
|
170
174
|
switchRef.current?.focus();
|
|
171
175
|
}
|
|
172
|
-
}, validation.getInputValidationProps
|
|
176
|
+
}, validation.getInputValidationProps,
|
|
177
|
+
// React <19 sets an empty value if `undefined` is passed explicitly
|
|
178
|
+
// To avoid this, we only set the value if it's defined
|
|
179
|
+
value !== undefined ? {
|
|
180
|
+
value
|
|
181
|
+
} : EMPTY_OBJECT), [checked, disabled, handleInputRef, hiddenInputId, name, onCheckedChange, required, setCheckedState, validation, value]);
|
|
173
182
|
const state = React.useMemo(() => ({
|
|
174
183
|
...fieldState,
|
|
175
184
|
checked,
|
|
@@ -7,7 +7,7 @@ import type { BaseUIComponentProps } from "../../utils/types.js";
|
|
|
7
7
|
*
|
|
8
8
|
* Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)
|
|
9
9
|
*/
|
|
10
|
-
export declare const SwitchThumb: React.ForwardRefExoticComponent<SwitchThumbProps & React.RefAttributes<HTMLSpanElement>>;
|
|
10
|
+
export declare const SwitchThumb: React.ForwardRefExoticComponent<Omit<SwitchThumbProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
11
11
|
export interface SwitchThumbProps extends BaseUIComponentProps<'span', SwitchThumb.State> {}
|
|
12
12
|
export interface SwitchThumbState extends SwitchRoot.State {}
|
|
13
13
|
export declare namespace SwitchThumb {
|
|
@@ -8,7 +8,7 @@ import type { TabsTab } from "../tab/TabsTab.js";
|
|
|
8
8
|
*
|
|
9
9
|
* Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
|
|
10
10
|
*/
|
|
11
|
-
export declare const TabsIndicator: React.ForwardRefExoticComponent<TabsIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
11
|
+
export declare const TabsIndicator: React.ForwardRefExoticComponent<Omit<TabsIndicatorProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
12
12
|
export interface TabsIndicatorState extends TabsRoot.State {
|
|
13
13
|
activeTabPosition: TabsTab.Position | null;
|
|
14
14
|
activeTabSize: TabsTab.Size | null;
|