@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
|
@@ -25,6 +25,8 @@ import { REASONS } from "../../utils/reasons.js";
|
|
|
25
25
|
import { useToolbarRootContext } from "../../toolbar/root/ToolbarRootContext.js";
|
|
26
26
|
import { COMPOSITE_KEYS } from "../../composite/composite.js";
|
|
27
27
|
import { getDisabledMountTransitionStyles } from "../../utils/getDisabledMountTransitionStyles.js";
|
|
28
|
+
import { clamp } from "../../utils/clamp.js";
|
|
29
|
+
import { useCSPContext } from "../../csp-provider/CSPContext.js";
|
|
28
30
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
31
|
const stateAttributesMapping = {
|
|
30
32
|
...popupStateMapping,
|
|
@@ -53,7 +55,8 @@ export const SelectPopup = /*#__PURE__*/React.forwardRef(function SelectPopup(co
|
|
|
53
55
|
keyboardActiveRef,
|
|
54
56
|
multiple,
|
|
55
57
|
handleScrollArrowVisibility,
|
|
56
|
-
scrollHandlerRef
|
|
58
|
+
scrollHandlerRef,
|
|
59
|
+
highlightItemOnHover
|
|
57
60
|
} = useSelectRootContext();
|
|
58
61
|
const {
|
|
59
62
|
side,
|
|
@@ -65,6 +68,10 @@ export const SelectPopup = /*#__PURE__*/React.forwardRef(function SelectPopup(co
|
|
|
65
68
|
} = useSelectPositionerContext();
|
|
66
69
|
const insideToolbar = useToolbarRootContext(true) != null;
|
|
67
70
|
const floatingRootContext = useSelectFloatingContext();
|
|
71
|
+
const {
|
|
72
|
+
nonce,
|
|
73
|
+
disableStyleElements
|
|
74
|
+
} = useCSPContext();
|
|
68
75
|
const highlightTimeout = useTimeout();
|
|
69
76
|
const id = useStore(store, selectors.id);
|
|
70
77
|
const open = useStore(store, selectors.open);
|
|
@@ -95,12 +102,13 @@ export const SelectPopup = /*#__PURE__*/React.forwardRef(function SelectPopup(co
|
|
|
95
102
|
const positionerStyles = getComputedStyle(positionerElement);
|
|
96
103
|
const marginTop = parseFloat(positionerStyles.marginTop);
|
|
97
104
|
const marginBottom = parseFloat(positionerStyles.marginBottom);
|
|
105
|
+
const maxPopupHeight = getMaxPopupHeight(getComputedStyle(popupRef.current));
|
|
98
106
|
const viewportHeight = doc.documentElement.clientHeight - marginTop - marginBottom;
|
|
99
107
|
const scrollTop = scroller.scrollTop;
|
|
100
108
|
const scrollHeight = scroller.scrollHeight;
|
|
101
109
|
const clientHeight = scroller.clientHeight;
|
|
102
110
|
const maxScrollTop = scrollHeight - clientHeight;
|
|
103
|
-
let nextPositionerHeight =
|
|
111
|
+
let nextPositionerHeight = 0;
|
|
104
112
|
let nextScrollTop = null;
|
|
105
113
|
let setReachedMax = false;
|
|
106
114
|
if (isTopPositioned) {
|
|
@@ -128,13 +136,13 @@ export const SelectPopup = /*#__PURE__*/React.forwardRef(function SelectPopup(co
|
|
|
128
136
|
}
|
|
129
137
|
}
|
|
130
138
|
}
|
|
131
|
-
if (nextPositionerHeight
|
|
139
|
+
if (nextPositionerHeight !== 0) {
|
|
132
140
|
positionerElement.style.height = `${nextPositionerHeight}px`;
|
|
133
141
|
}
|
|
134
142
|
if (nextScrollTop != null) {
|
|
135
143
|
scroller.scrollTop = nextScrollTop;
|
|
136
144
|
}
|
|
137
|
-
if (setReachedMax) {
|
|
145
|
+
if (setReachedMax || nextPositionerHeight >= maxPopupHeight) {
|
|
138
146
|
reachedMaxHeightRef.current = true;
|
|
139
147
|
}
|
|
140
148
|
handleScrollArrowVisibility();
|
|
@@ -172,7 +180,7 @@ export const SelectPopup = /*#__PURE__*/React.forwardRef(function SelectPopup(co
|
|
|
172
180
|
};
|
|
173
181
|
}, [popupRef, positionerElement]);
|
|
174
182
|
useIsoLayoutEffect(() => {
|
|
175
|
-
if (
|
|
183
|
+
if (open || alignItemWithTriggerActive) {
|
|
176
184
|
return;
|
|
177
185
|
}
|
|
178
186
|
initialPlacedRef.current = false;
|
|
@@ -180,109 +188,128 @@ export const SelectPopup = /*#__PURE__*/React.forwardRef(function SelectPopup(co
|
|
|
180
188
|
initialHeightRef.current = 0;
|
|
181
189
|
maxHeightRef.current = 0;
|
|
182
190
|
clearStyles(positionerElement, originalPositionerStylesRef.current);
|
|
183
|
-
}, [
|
|
191
|
+
}, [open, alignItemWithTriggerActive, positionerElement, popupRef]);
|
|
184
192
|
useIsoLayoutEffect(() => {
|
|
185
193
|
const popupElement = popupRef.current;
|
|
186
|
-
if (!
|
|
194
|
+
if (!open || !triggerElement || !positionerElement || !popupElement || store.state.transitionStatus === 'ending') {
|
|
187
195
|
return;
|
|
188
196
|
}
|
|
189
197
|
if (!alignItemWithTriggerActive) {
|
|
190
198
|
initialPlacedRef.current = true;
|
|
191
199
|
scrollArrowFrame.request(handleScrollArrowVisibility);
|
|
200
|
+
popupElement.style.removeProperty('--transform-origin');
|
|
192
201
|
return;
|
|
193
202
|
}
|
|
194
203
|
|
|
195
204
|
// Wait for `selectedItemTextRef.current` to be set.
|
|
196
205
|
queueMicrotask(() => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
const
|
|
223
|
-
const
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
206
|
+
// Ensure we remove any transforms that can affect the location of the popup
|
|
207
|
+
// and therefore the calculations.
|
|
208
|
+
const restoreTransformStyles = unsetTransformStyles(popupElement);
|
|
209
|
+
popupElement.style.removeProperty('--transform-origin');
|
|
210
|
+
try {
|
|
211
|
+
const positionerStyles = getComputedStyle(positionerElement);
|
|
212
|
+
const popupStyles = getComputedStyle(popupElement);
|
|
213
|
+
const doc = ownerDocument(triggerElement);
|
|
214
|
+
const win = ownerWindow(positionerElement);
|
|
215
|
+
const triggerRect = triggerElement.getBoundingClientRect();
|
|
216
|
+
const positionerRect = positionerElement.getBoundingClientRect();
|
|
217
|
+
const triggerX = triggerRect.left;
|
|
218
|
+
const triggerHeight = triggerRect.height;
|
|
219
|
+
const scroller = listElement || popupElement;
|
|
220
|
+
const scrollHeight = scroller.scrollHeight;
|
|
221
|
+
const borderBottom = parseFloat(popupStyles.borderBottomWidth);
|
|
222
|
+
const marginTop = parseFloat(positionerStyles.marginTop) || 10;
|
|
223
|
+
const marginBottom = parseFloat(positionerStyles.marginBottom) || 10;
|
|
224
|
+
const minHeight = parseFloat(positionerStyles.minHeight) || 100;
|
|
225
|
+
const maxPopupHeight = getMaxPopupHeight(popupStyles);
|
|
226
|
+
const paddingLeft = 5;
|
|
227
|
+
const paddingRight = 5;
|
|
228
|
+
const triggerCollisionThreshold = 20;
|
|
229
|
+
const viewportHeight = doc.documentElement.clientHeight - marginTop - marginBottom;
|
|
230
|
+
const viewportWidth = doc.documentElement.clientWidth;
|
|
231
|
+
const availableSpaceBeneathTrigger = viewportHeight - triggerRect.bottom + triggerHeight;
|
|
232
|
+
const textElement = selectedItemTextRef.current;
|
|
233
|
+
const valueElement = valueRef.current;
|
|
234
|
+
let textRect;
|
|
235
|
+
let offsetX = 0;
|
|
236
|
+
let offsetY = 0;
|
|
237
|
+
if (textElement && valueElement) {
|
|
238
|
+
const valueRect = valueElement.getBoundingClientRect();
|
|
239
|
+
textRect = textElement.getBoundingClientRect();
|
|
240
|
+
const valueLeftFromTriggerLeft = valueRect.left - triggerX;
|
|
241
|
+
const textLeftFromPositionerLeft = textRect.left - positionerRect.left;
|
|
242
|
+
const valueCenterFromPositionerTop = valueRect.top - triggerRect.top + valueRect.height / 2;
|
|
243
|
+
const textCenterFromTriggerTop = textRect.top - positionerRect.top + textRect.height / 2;
|
|
244
|
+
offsetX = valueLeftFromTriggerLeft - textLeftFromPositionerLeft;
|
|
245
|
+
offsetY = textCenterFromTriggerTop - valueCenterFromPositionerTop;
|
|
246
|
+
}
|
|
247
|
+
const idealHeight = availableSpaceBeneathTrigger + offsetY + marginBottom + borderBottom;
|
|
248
|
+
let height = Math.min(viewportHeight, idealHeight);
|
|
249
|
+
const maxHeight = viewportHeight - marginTop - marginBottom;
|
|
250
|
+
const scrollTop = idealHeight - height;
|
|
251
|
+
const left = Math.max(paddingLeft, triggerX + offsetX);
|
|
252
|
+
const maxRight = viewportWidth - paddingRight;
|
|
253
|
+
const rightOverflow = Math.max(0, left + positionerRect.width - maxRight);
|
|
254
|
+
positionerElement.style.left = `${left - rightOverflow}px`;
|
|
255
|
+
positionerElement.style.height = `${height}px`;
|
|
256
|
+
positionerElement.style.maxHeight = 'auto';
|
|
257
|
+
positionerElement.style.marginTop = `${marginTop}px`;
|
|
258
|
+
positionerElement.style.marginBottom = `${marginBottom}px`;
|
|
259
|
+
popupElement.style.height = '100%';
|
|
260
|
+
const maxScrollTop = scroller.scrollHeight - scroller.clientHeight;
|
|
261
|
+
const isTopPositioned = scrollTop >= maxScrollTop;
|
|
262
|
+
if (isTopPositioned) {
|
|
263
|
+
height = Math.min(viewportHeight, positionerRect.height) - (scrollTop - maxScrollTop);
|
|
264
|
+
}
|
|
249
265
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
266
|
+
// When the trigger is too close to the top or bottom of the viewport, or the minHeight is
|
|
267
|
+
// reached, we fallback to aligning the popup to the trigger as the UX is poor otherwise.
|
|
268
|
+
const fallbackToAlignPopupToTrigger = triggerRect.top < triggerCollisionThreshold || triggerRect.bottom > viewportHeight - triggerCollisionThreshold || height < Math.min(scrollHeight, minHeight);
|
|
253
269
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
270
|
+
// Safari doesn't position the popup correctly when pinch-zoomed.
|
|
271
|
+
const isPinchZoomed = (win.visualViewport?.scale ?? 1) !== 1 && isWebKit;
|
|
272
|
+
if (fallbackToAlignPopupToTrigger || isPinchZoomed) {
|
|
273
|
+
initialPlacedRef.current = true;
|
|
274
|
+
clearStyles(positionerElement, originalPositionerStylesRef.current);
|
|
275
|
+
ReactDOM.flushSync(() => setControlledAlignItemWithTrigger(false));
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (isTopPositioned) {
|
|
279
|
+
const topOffset = Math.max(0, viewportHeight - idealHeight);
|
|
280
|
+
positionerElement.style.top = positionerRect.height >= maxHeight ? '0' : `${topOffset}px`;
|
|
281
|
+
positionerElement.style.height = `${height}px`;
|
|
282
|
+
scroller.scrollTop = scroller.scrollHeight - scroller.clientHeight;
|
|
283
|
+
initialHeightRef.current = Math.max(minHeight, height);
|
|
284
|
+
} else {
|
|
285
|
+
positionerElement.style.bottom = '0';
|
|
286
|
+
initialHeightRef.current = Math.max(minHeight, height);
|
|
287
|
+
scroller.scrollTop = scrollTop;
|
|
288
|
+
}
|
|
289
|
+
if (textRect) {
|
|
290
|
+
const popupTop = positionerRect.top;
|
|
291
|
+
const popupHeight = positionerRect.height;
|
|
292
|
+
const textCenterY = textRect.top + textRect.height / 2;
|
|
293
|
+
const transformOriginY = popupHeight > 0 ? (textCenterY - popupTop) / popupHeight * 100 : 50;
|
|
294
|
+
const clampedY = clamp(transformOriginY, 0, 100);
|
|
295
|
+
popupElement.style.setProperty('--transform-origin', `50% ${clampedY}%`);
|
|
296
|
+
}
|
|
297
|
+
if (initialHeightRef.current === viewportHeight || height >= maxPopupHeight) {
|
|
298
|
+
reachedMaxHeightRef.current = true;
|
|
299
|
+
}
|
|
300
|
+
handleScrollArrowVisibility();
|
|
277
301
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
302
|
+
// Avoid the `onScroll` event logic from triggering before the popup is placed.
|
|
303
|
+
setTimeout(() => {
|
|
304
|
+
initialPlacedRef.current = true;
|
|
305
|
+
});
|
|
306
|
+
} finally {
|
|
307
|
+
restoreTransformStyles();
|
|
308
|
+
}
|
|
282
309
|
});
|
|
283
|
-
}, [store,
|
|
310
|
+
}, [store, open, positionerElement, triggerElement, valueRef, selectedItemTextRef, popupRef, handleScrollArrowVisibility, alignItemWithTriggerActive, setControlledAlignItemWithTrigger, scrollArrowFrame, scrollDownArrowRef, scrollUpArrowRef, listElement]);
|
|
284
311
|
React.useEffect(() => {
|
|
285
|
-
if (!alignItemWithTriggerActive || !positionerElement || !
|
|
312
|
+
if (!alignItemWithTriggerActive || !positionerElement || !open) {
|
|
286
313
|
return undefined;
|
|
287
314
|
}
|
|
288
315
|
const win = ownerWindow(positionerElement);
|
|
@@ -293,7 +320,7 @@ export const SelectPopup = /*#__PURE__*/React.forwardRef(function SelectPopup(co
|
|
|
293
320
|
return () => {
|
|
294
321
|
win.removeEventListener('resize', handleResize);
|
|
295
322
|
};
|
|
296
|
-
}, [setOpen, alignItemWithTriggerActive, positionerElement,
|
|
323
|
+
}, [setOpen, alignItemWithTriggerActive, positionerElement, open]);
|
|
297
324
|
const defaultProps = {
|
|
298
325
|
...(listElement ? {
|
|
299
326
|
role: 'presentation',
|
|
@@ -313,7 +340,7 @@ export const SelectPopup = /*#__PURE__*/React.forwardRef(function SelectPopup(co
|
|
|
313
340
|
keyboardActiveRef.current = false;
|
|
314
341
|
},
|
|
315
342
|
onPointerLeave(event) {
|
|
316
|
-
if (isMouseWithinBounds(event) || event.pointerType === 'touch') {
|
|
343
|
+
if (!highlightItemOnHover || isMouseWithinBounds(event) || event.pointerType === 'touch') {
|
|
317
344
|
return;
|
|
318
345
|
}
|
|
319
346
|
const popup = event.currentTarget;
|
|
@@ -345,7 +372,7 @@ export const SelectPopup = /*#__PURE__*/React.forwardRef(function SelectPopup(co
|
|
|
345
372
|
}, elementProps]
|
|
346
373
|
});
|
|
347
374
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
348
|
-
children: [styleDisableScrollbar.
|
|
375
|
+
children: [!disableStyleElements && styleDisableScrollbar.getElement(nonce), /*#__PURE__*/_jsx(FloatingFocusManager, {
|
|
349
376
|
context: floatingRootContext,
|
|
350
377
|
modal: false,
|
|
351
378
|
disabled: !mounted,
|
|
@@ -354,4 +381,36 @@ export const SelectPopup = /*#__PURE__*/React.forwardRef(function SelectPopup(co
|
|
|
354
381
|
})]
|
|
355
382
|
});
|
|
356
383
|
});
|
|
357
|
-
if (process.env.NODE_ENV !== "production") SelectPopup.displayName = "SelectPopup";
|
|
384
|
+
if (process.env.NODE_ENV !== "production") SelectPopup.displayName = "SelectPopup";
|
|
385
|
+
function getMaxPopupHeight(popupStyles) {
|
|
386
|
+
const maxHeightStyle = popupStyles.maxHeight || '';
|
|
387
|
+
return maxHeightStyle.endsWith('px') ? parseFloat(maxHeightStyle) || Infinity : Infinity;
|
|
388
|
+
}
|
|
389
|
+
const UNSET_TRANSFORM_STYLES = {
|
|
390
|
+
transform: 'none',
|
|
391
|
+
scale: '1',
|
|
392
|
+
translate: '0 0'
|
|
393
|
+
};
|
|
394
|
+
function restoreInlineStyleProperty(style, property, value) {
|
|
395
|
+
if (value) {
|
|
396
|
+
style.setProperty(property, value);
|
|
397
|
+
} else {
|
|
398
|
+
style.removeProperty(property);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
function unsetTransformStyles(popupElement) {
|
|
402
|
+
const {
|
|
403
|
+
style
|
|
404
|
+
} = popupElement;
|
|
405
|
+
const originalStyles = {};
|
|
406
|
+
const props = Object.keys(UNSET_TRANSFORM_STYLES);
|
|
407
|
+
for (const prop of props) {
|
|
408
|
+
originalStyles[prop] = style.getPropertyValue(prop);
|
|
409
|
+
style.setProperty(prop, UNSET_TRANSFORM_STYLES[prop]);
|
|
410
|
+
}
|
|
411
|
+
return () => {
|
|
412
|
+
for (const prop of props) {
|
|
413
|
+
restoreInlineStyleProperty(style, prop, originalStyles[prop]);
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
}
|
|
@@ -7,7 +7,7 @@ import { FloatingPortal } from "../../floating-ui-react/index.js";
|
|
|
7
7
|
*
|
|
8
8
|
* Documentation: [Base UI Select](https://base-ui.com/react/components/select)
|
|
9
9
|
*/
|
|
10
|
-
export declare const SelectPortal: React.ForwardRefExoticComponent<SelectPortalProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const SelectPortal: React.ForwardRefExoticComponent<Omit<SelectPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
export declare namespace SelectPortal {
|
|
12
12
|
interface State {}
|
|
13
13
|
}
|
|
@@ -7,7 +7,7 @@ import { useAnchorPositioning, type Align, type Side } from "../../utils/useAnch
|
|
|
7
7
|
*
|
|
8
8
|
* Documentation: [Base UI Select](https://base-ui.com/react/components/select)
|
|
9
9
|
*/
|
|
10
|
-
export declare const SelectPositioner: React.ForwardRefExoticComponent<SelectPositionerProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const SelectPositioner: React.ForwardRefExoticComponent<Omit<SelectPositionerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
export interface SelectPositionerState {
|
|
12
12
|
open: boolean;
|
|
13
13
|
side: Side | 'none';
|
|
@@ -70,7 +70,7 @@ export interface SelectRootProps<Value, Multiple extends boolean | undefined = f
|
|
|
70
70
|
open?: boolean;
|
|
71
71
|
/**
|
|
72
72
|
* Determines if the select enters a modal state when open.
|
|
73
|
-
* - `true`: user interaction is limited to the select: document page scroll is locked and
|
|
73
|
+
* - `true`: user interaction is limited to the select: document page scroll is locked and pointer interactions on outside elements are disabled.
|
|
74
74
|
* - `false`: user interaction with the rest of the document is allowed.
|
|
75
75
|
* @default true
|
|
76
76
|
*/
|
|
@@ -81,7 +81,7 @@ export interface SelectRootProps<Value, Multiple extends boolean | undefined = f
|
|
|
81
81
|
* Instead, the `unmount` function must be called to unmount the select manually.
|
|
82
82
|
* Useful when the select's animation is controlled by an external library.
|
|
83
83
|
*/
|
|
84
|
-
actionsRef?: React.RefObject<SelectRootActions>;
|
|
84
|
+
actionsRef?: React.RefObject<SelectRootActions | null>;
|
|
85
85
|
/**
|
|
86
86
|
* Data structure of the items rendered in the select popup.
|
|
87
87
|
* When specified, `<Select.Value>` renders the label of the selected item instead of the raw value.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { visuallyHidden } from '@base-ui/utils/visuallyHidden';
|
|
4
|
+
import { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';
|
|
5
5
|
import { useMergedRefs } from '@base-ui/utils/useMergedRefs';
|
|
6
6
|
import { useRefWithInit } from '@base-ui/utils/useRefWithInit';
|
|
7
7
|
import { useOnFirstRender } from '@base-ui/utils/useOnFirstRender';
|
|
@@ -13,7 +13,6 @@ import { useStore, Store } from '@base-ui/utils/store';
|
|
|
13
13
|
import { useClick, useDismiss, useFloatingRootContext, useInteractions, useListNavigation, useTypeahead } from "../../floating-ui-react/index.js";
|
|
14
14
|
import { SelectRootContext, SelectFloatingContext } from "./SelectRootContext.js";
|
|
15
15
|
import { useFieldRootContext } from "../../field/root/FieldRootContext.js";
|
|
16
|
-
import { useLabelableContext } from "../../labelable-provider/LabelableContext.js";
|
|
17
16
|
import { useLabelableId } from "../../labelable-provider/useLabelableId.js";
|
|
18
17
|
import { useTransitionStatus } from "../../utils/useTransitionStatus.js";
|
|
19
18
|
import { selectors } from "../store.js";
|
|
@@ -23,7 +22,7 @@ import { useOpenChangeComplete } from "../../utils/useOpenChangeComplete.js";
|
|
|
23
22
|
import { useFormContext } from "../../form/FormContext.js";
|
|
24
23
|
import { useField } from "../../field/useField.js";
|
|
25
24
|
import { stringifyAsValue } from "../../utils/resolveValueLabel.js";
|
|
26
|
-
import { EMPTY_ARRAY } from "../../utils/constants.js";
|
|
25
|
+
import { EMPTY_ARRAY, EMPTY_OBJECT } from "../../utils/constants.js";
|
|
27
26
|
import { defaultItemEquality, findItemIndex } from "../../utils/itemEquality.js";
|
|
28
27
|
import { useValueChanged } from "../../utils/useValueChanged.js";
|
|
29
28
|
import { useOpenInteractionType } from "../../utils/useOpenInteractionType.js";
|
|
@@ -66,16 +65,16 @@ export function SelectRoot(props) {
|
|
|
66
65
|
} = useFormContext();
|
|
67
66
|
const {
|
|
68
67
|
setDirty,
|
|
68
|
+
setTouched,
|
|
69
|
+
setFocused,
|
|
69
70
|
shouldValidateOnChange,
|
|
70
71
|
validityData,
|
|
71
72
|
setFilled,
|
|
72
73
|
name: fieldName,
|
|
73
74
|
disabled: fieldDisabled,
|
|
74
|
-
validation
|
|
75
|
+
validation,
|
|
76
|
+
validationMode
|
|
75
77
|
} = useFieldRootContext();
|
|
76
|
-
const {
|
|
77
|
-
controlId
|
|
78
|
-
} = useLabelableContext();
|
|
79
78
|
const generatedId = useLabelableId({
|
|
80
79
|
id
|
|
81
80
|
});
|
|
@@ -176,8 +175,8 @@ export function SelectRoot(props) {
|
|
|
176
175
|
}
|
|
177
176
|
}, [store, value]);
|
|
178
177
|
useIsoLayoutEffect(() => {
|
|
179
|
-
setFilled(value
|
|
180
|
-
}, [value, setFilled]);
|
|
178
|
+
setFilled(multiple ? Array.isArray(value) && value.length > 0 : value != null);
|
|
179
|
+
}, [multiple, value, setFilled]);
|
|
181
180
|
useIsoLayoutEffect(function syncSelectedIndex() {
|
|
182
181
|
if (open) {
|
|
183
182
|
return;
|
|
@@ -212,6 +211,13 @@ export function SelectRoot(props) {
|
|
|
212
211
|
return;
|
|
213
212
|
}
|
|
214
213
|
setOpenUnwrapped(nextOpen);
|
|
214
|
+
if (!nextOpen && (eventDetails.reason === REASONS.focusOut || eventDetails.reason === REASONS.outsidePress)) {
|
|
215
|
+
setTouched(true);
|
|
216
|
+
setFocused(false);
|
|
217
|
+
if (validationMode === 'onBlur') {
|
|
218
|
+
validation.commit(value);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
215
221
|
|
|
216
222
|
// The active index will sync to the last selected index on the next open.
|
|
217
223
|
// Workaround `enableFocusInside` in Floating UI setting `tabindex=0` of a non-highlighted
|
|
@@ -324,7 +330,11 @@ export function SelectRoot(props) {
|
|
|
324
330
|
getFloatingProps,
|
|
325
331
|
getItemProps
|
|
326
332
|
} = useInteractions([click, dismiss, listNavigation, typeahead]);
|
|
327
|
-
const mergedTriggerProps = React.useMemo(() =>
|
|
333
|
+
const mergedTriggerProps = React.useMemo(() => {
|
|
334
|
+
return mergeProps(getReferenceProps(), interactionTypeProps, generatedId ? {
|
|
335
|
+
id: generatedId
|
|
336
|
+
} : EMPTY_OBJECT);
|
|
337
|
+
}, [getReferenceProps, interactionTypeProps, generatedId]);
|
|
328
338
|
useOnFirstRender(() => {
|
|
329
339
|
store.update({
|
|
330
340
|
popupProps: getFloatingProps(),
|
|
@@ -403,7 +413,11 @@ export function SelectRoot(props) {
|
|
|
403
413
|
...validation.getInputValidationProps({
|
|
404
414
|
onFocus() {
|
|
405
415
|
// Move focus to the trigger element when the hidden input is focused.
|
|
406
|
-
store.state.triggerElement?.focus(
|
|
416
|
+
store.state.triggerElement?.focus({
|
|
417
|
+
// Supported in Chrome from 144 (January 2026)
|
|
418
|
+
// @ts-expect-error - focusVisible is not yet in the lib.dom.d.ts
|
|
419
|
+
focusVisible: true
|
|
420
|
+
});
|
|
407
421
|
},
|
|
408
422
|
// Handle browser autofill.
|
|
409
423
|
onChange(event) {
|
|
@@ -439,14 +453,13 @@ export function SelectRoot(props) {
|
|
|
439
453
|
queueMicrotask(handleChange);
|
|
440
454
|
}
|
|
441
455
|
}),
|
|
442
|
-
id: id || controlId || undefined,
|
|
443
456
|
name: multiple ? undefined : name,
|
|
444
457
|
value: serializedValue,
|
|
445
458
|
disabled: disabled,
|
|
446
459
|
required: required && !hasMultipleSelection,
|
|
447
460
|
readOnly: readOnly,
|
|
448
461
|
ref: ref,
|
|
449
|
-
style: visuallyHidden,
|
|
462
|
+
style: name ? visuallyHiddenInput : visuallyHidden,
|
|
450
463
|
tabIndex: -1,
|
|
451
464
|
"aria-hidden": true
|
|
452
465
|
}), hiddenInputs]
|
|
@@ -5,7 +5,7 @@ import { type TransitionStatus } from "../../utils/useTransitionStatus.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
|
-
export declare const SelectScrollArrow: React.ForwardRefExoticComponent<SelectScrollArrowProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export declare const SelectScrollArrow: React.ForwardRefExoticComponent<Omit<SelectScrollArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
9
|
export interface SelectScrollArrowState {
|
|
10
10
|
direction: 'up' | 'down';
|
|
11
11
|
visible: boolean;
|
|
@@ -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 SelectScrollDownArrow: React.ForwardRefExoticComponent<SelectScrollDownArrowProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export declare const SelectScrollDownArrow: React.ForwardRefExoticComponent<Omit<SelectScrollDownArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
export interface SelectScrollDownArrowState {}
|
|
11
11
|
export interface SelectScrollDownArrowProps extends BaseUIComponentProps<'div', SelectScrollDownArrow.State> {
|
|
12
12
|
/**
|
|
@@ -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 SelectScrollUpArrow: React.ForwardRefExoticComponent<SelectScrollUpArrowProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export declare const SelectScrollUpArrow: React.ForwardRefExoticComponent<Omit<SelectScrollUpArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
export interface SelectScrollUpArrowState {}
|
|
11
11
|
export interface SelectScrollUpArrowProps extends BaseUIComponentProps<'div', SelectScrollUpArrow.State> {
|
|
12
12
|
/**
|
package/esm/select/store.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ export declare const selectors: {
|
|
|
43
43
|
itemToStringValue: (state: State) => ((item: any) => string) | undefined;
|
|
44
44
|
isItemEqualToValue: (state: State) => (item: any, value: any) => boolean;
|
|
45
45
|
value: (state: State) => any;
|
|
46
|
+
hasSelectedValue: (state: State) => boolean;
|
|
47
|
+
hasNullItemLabel: (state: State, enabled: boolean) => boolean;
|
|
46
48
|
open: (state: State) => boolean;
|
|
47
49
|
mounted: (state: State) => boolean;
|
|
48
50
|
forceMount: (state: State) => boolean;
|
|
@@ -61,5 +63,4 @@ export declare const selectors: {
|
|
|
61
63
|
scrollUpArrowVisible: (state: State) => boolean;
|
|
62
64
|
scrollDownArrowVisible: (state: State) => boolean;
|
|
63
65
|
hasScrollArrows: (state: State) => boolean;
|
|
64
|
-
serializedValue: (state: State) => string;
|
|
65
66
|
};
|
package/esm/select/store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSelector } from '@base-ui/utils/store';
|
|
2
2
|
import { compareItemEquality } from "../utils/itemEquality.js";
|
|
3
|
-
import { stringifyAsValue } from "../utils/resolveValueLabel.js";
|
|
3
|
+
import { hasNullItemLabel, stringifyAsValue } from "../utils/resolveValueLabel.js";
|
|
4
4
|
export const selectors = {
|
|
5
5
|
id: createSelector(state => state.id),
|
|
6
6
|
modal: createSelector(state => state.modal),
|
|
@@ -10,6 +10,23 @@ export const selectors = {
|
|
|
10
10
|
itemToStringValue: createSelector(state => state.itemToStringValue),
|
|
11
11
|
isItemEqualToValue: createSelector(state => state.isItemEqualToValue),
|
|
12
12
|
value: createSelector(state => state.value),
|
|
13
|
+
hasSelectedValue: createSelector(state => {
|
|
14
|
+
const {
|
|
15
|
+
value,
|
|
16
|
+
multiple,
|
|
17
|
+
itemToStringValue
|
|
18
|
+
} = state;
|
|
19
|
+
if (value == null) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (multiple && Array.isArray(value)) {
|
|
23
|
+
return value.length > 0;
|
|
24
|
+
}
|
|
25
|
+
return stringifyAsValue(value, itemToStringValue) !== '';
|
|
26
|
+
}),
|
|
27
|
+
hasNullItemLabel: createSelector((state, enabled) => {
|
|
28
|
+
return enabled ? hasNullItemLabel(state.items) : false;
|
|
29
|
+
}),
|
|
13
30
|
open: createSelector(state => state.open),
|
|
14
31
|
mounted: createSelector(state => state.mounted),
|
|
15
32
|
forceMount: createSelector(state => state.forceMount),
|
|
@@ -42,16 +59,5 @@ export const selectors = {
|
|
|
42
59
|
listElement: createSelector(state => state.listElement),
|
|
43
60
|
scrollUpArrowVisible: createSelector(state => state.scrollUpArrowVisible),
|
|
44
61
|
scrollDownArrowVisible: createSelector(state => state.scrollDownArrowVisible),
|
|
45
|
-
hasScrollArrows: createSelector(state => state.hasScrollArrows)
|
|
46
|
-
serializedValue: createSelector(state => {
|
|
47
|
-
const {
|
|
48
|
-
multiple,
|
|
49
|
-
value,
|
|
50
|
-
itemToStringValue
|
|
51
|
-
} = state;
|
|
52
|
-
if (multiple && Array.isArray(value) && value.length === 0) {
|
|
53
|
-
return '';
|
|
54
|
-
}
|
|
55
|
-
return stringifyAsValue(value, itemToStringValue);
|
|
56
|
-
})
|
|
62
|
+
hasScrollArrows: createSelector(state => state.hasScrollArrows)
|
|
57
63
|
};
|
|
@@ -7,14 +7,24 @@ import type { FieldRoot } from "../../field/root/FieldRoot.js";
|
|
|
7
7
|
*
|
|
8
8
|
* Documentation: [Base UI Select](https://base-ui.com/react/components/select)
|
|
9
9
|
*/
|
|
10
|
-
export declare const SelectTrigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
export declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
11
11
|
export interface SelectTriggerState extends FieldRoot.State {
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Whether the select popup is currently open.
|
|
14
|
+
*/
|
|
13
15
|
open: boolean;
|
|
14
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Whether the select popup is readonly.
|
|
18
|
+
*/
|
|
15
19
|
readOnly: boolean;
|
|
16
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* The value of the currently selected item.
|
|
22
|
+
*/
|
|
17
23
|
value: any;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the select doesn't have a value.
|
|
26
|
+
*/
|
|
27
|
+
placeholder: boolean;
|
|
18
28
|
}
|
|
19
29
|
export interface SelectTriggerProps extends NativeButtonProps, BaseUIComponentProps<'button', SelectTrigger.State> {
|
|
20
30
|
children?: React.ReactNode;
|