burne-ui 2.1.2 → 2.1.4
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/README.md +8 -4
- package/cli/burne-ui.js +4 -3
- package/cli/init.js +83 -19
- package/cli/skin-live-slots.json +1 -1
- package/cli/skin-slots.json +2 -0
- package/cli/skin-validate.mjs +83 -2
- package/cli/tailwind.css +20 -0
- package/cli/theme-bridge.css +6 -0
- package/dist/authoring.d.ts +2 -0
- package/dist/authoring.js +8 -0
- package/dist/components/composite/Accordion/accordionStyles.js +1 -1
- package/dist/components/composite/Accordion/useAccordionRootState.js +6 -2
- package/dist/components/composite/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/components/composite/AlertDialog/AlertDialog.js +1 -0
- package/dist/components/composite/AlertDialog/alertDialogAnimations.d.ts +1 -0
- package/dist/components/composite/AlertDialog/alertDialogAnimations.js +1 -0
- package/dist/components/composite/AlertDialog/alertDialogParts.d.ts +5 -7
- package/dist/components/composite/AlertDialog/alertDialogParts.js +92 -37
- package/dist/components/composite/AlertDialog/alertDialogStyles.d.ts +3 -2
- package/dist/components/composite/AlertDialog/alertDialogStyles.js +5 -3
- package/dist/components/composite/AlertDialog/alertDialogTypes.d.ts +8 -8
- package/dist/components/composite/AlertDialog/index.d.ts +4 -6
- package/dist/components/composite/AlertDialog/useAlertDialogRootState.d.ts +1 -1
- package/dist/components/composite/AlertDialog/useAlertDialogRootState.js +13 -1
- package/dist/components/composite/ButtonGroup/ButtonGroup.d.ts +1 -0
- package/dist/components/composite/ButtonGroup/ButtonGroup.js +59 -25
- package/dist/components/composite/ButtonGroup/buttonGroupAPI.d.ts +1 -0
- package/dist/components/composite/ButtonGroup/buttonGroupAPI.js +7 -1
- package/dist/components/composite/ButtonGroup/buttonGroupContext.d.ts +3 -2
- package/dist/components/composite/ButtonGroup/buttonGroupContext.js +4 -3
- package/dist/components/composite/ButtonGroup/buttonGroupStyles.js +1 -1
- package/dist/components/composite/ButtonGroup/buttonGroupTypes.d.ts +3 -1
- package/dist/components/composite/ButtonGroup/index.d.ts +1 -0
- package/dist/components/composite/CheckboxGroup/CheckboxGroup.js +25 -7
- package/dist/components/composite/CheckboxGroup/useCheckboxGroupRootState.d.ts +5 -1
- package/dist/components/composite/CheckboxGroup/useCheckboxGroupRootState.js +74 -23
- package/dist/components/composite/Form/Form.js +6 -0
- package/dist/components/composite/Form/formAPI.d.ts +2 -0
- package/dist/components/composite/Form/formAPI.js +29 -2
- package/dist/components/composite/Form/formContext.js +4 -0
- package/dist/components/composite/Form/formParts.js +20 -6
- package/dist/components/composite/Form/formStyles.js +4 -4
- package/dist/components/composite/Form/useFormControlProps.js +25 -15
- package/dist/components/composite/Form/useFormFieldBinding.js +22 -14
- package/dist/components/composite/Form/useFormRootState.d.ts +2 -1
- package/dist/components/composite/Form/useFormRootState.js +151 -89
- package/dist/components/composite/RadioGroup/RadioGroup.js +30 -10
- package/dist/components/composite/RadioGroup/radioGroupA11y.d.ts +10 -0
- package/dist/components/composite/RadioGroup/radioGroupA11y.js +75 -0
- package/dist/components/composite/RadioGroup/radioGroupTypes.d.ts +2 -2
- package/dist/components/composite/RadioGroup/useRadioGroupRootState.d.ts +7 -1
- package/dist/components/composite/RadioGroup/useRadioGroupRootState.js +105 -34
- package/dist/components/composite/ToggleButtonGroup/ToggleButtonGroup.js +3 -1
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupA11y.d.ts +1 -1
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupA11y.js +13 -7
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupAPI.d.ts +2 -0
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupAPI.js +19 -4
- package/dist/components/composite/ToggleButtonGroup/useToggleButtonGroupRootState.js +20 -7
- package/dist/components/composite/utils/optionGroupFieldset.d.ts +1 -1
- package/dist/components/core/Alert/Alert.js +3 -1
- package/dist/components/core/Alert/alertAnimations.js +14 -3
- package/dist/components/core/Alert/alertStyles.d.ts +1 -1
- package/dist/components/core/Alert/alertStyles.js +1 -1
- package/dist/components/core/AppShell/AppShell.js +16 -4
- package/dist/components/core/AppShell/appShellAnimations.js +1 -1
- package/dist/components/core/AppShell/appShellStyles.d.ts +3 -2
- package/dist/components/core/AppShell/appShellStyles.js +8 -2
- package/dist/components/core/AspectRatio/AspectRatio.js +6 -3
- package/dist/components/core/AspectRatio/aspectRatioAnimations.js +1 -1
- package/dist/components/core/AspectRatio/aspectRatioStyles.d.ts +5 -2
- package/dist/components/core/AspectRatio/aspectRatioStyles.js +27 -3
- package/dist/components/core/Avatar/avatarParts.js +26 -6
- package/dist/components/core/Avatar/avatarTypes.d.ts +1 -0
- package/dist/components/core/Avatar/useAvatarRootState.d.ts +1 -0
- package/dist/components/core/Avatar/useAvatarRootState.js +6 -2
- package/dist/components/core/Badge/Badge.js +9 -3
- package/dist/components/core/Badge/badgeA11y.js +6 -0
- package/dist/components/core/Badge/badgeAPI.js +4 -4
- package/dist/components/core/Badge/badgeAnimations.js +18 -3
- package/dist/components/core/Badge/badgeParts.d.ts +1 -1
- package/dist/components/core/Badge/badgeParts.js +6 -3
- package/dist/components/core/Badge/badgeStyles.d.ts +1 -0
- package/dist/components/core/Badge/badgeStyles.js +2 -0
- package/dist/components/core/Badge/badgeTypes.d.ts +2 -0
- package/dist/components/core/Badge/useBadgeRootState.d.ts +1 -0
- package/dist/components/core/Badge/useBadgeRootState.js +2 -1
- package/dist/components/core/Breadcrumbs/breadcrumbsAPI.js +11 -5
- package/dist/components/core/Breadcrumbs/breadcrumbsParts.js +21 -6
- package/dist/components/core/Breadcrumbs/breadcrumbsStyles.js +4 -4
- package/dist/components/core/Button/Button.js +34 -18
- package/dist/components/core/Button/buttonAnimations.d.ts +1 -1
- package/dist/components/core/Button/buttonAnimations.js +18 -7
- package/dist/components/core/Button/buttonParts.js +2 -2
- package/dist/components/core/Button/buttonStyles.d.ts +4 -3
- package/dist/components/core/Button/buttonStyles.js +11 -10
- package/dist/components/core/Button/buttonTypes.d.ts +2 -1
- package/dist/components/core/Button/useButtonRootState.d.ts +2 -1
- package/dist/components/core/Button/useButtonRootState.js +10 -4
- package/dist/components/core/Calendar/Calendar.js +15 -4
- package/dist/components/core/Calendar/calendarAPI.d.ts +10 -6
- package/dist/components/core/Calendar/calendarAPI.js +110 -30
- package/dist/components/core/Calendar/calendarParts.js +173 -72
- package/dist/components/core/Calendar/calendarStyles.d.ts +5 -5
- package/dist/components/core/Calendar/calendarStyles.js +8 -8
- package/dist/components/core/Calendar/calendarTypes.d.ts +8 -0
- package/dist/components/core/Calendar/useCalendarRootState.js +60 -19
- package/dist/components/core/Calendar/useCalendarViewModels.js +6 -6
- package/dist/components/core/Card/Card.d.ts +1 -0
- package/dist/components/core/Card/Card.js +17 -7
- package/dist/components/core/Card/cardAPI.d.ts +1 -0
- package/dist/components/core/Card/cardAPI.js +23 -1
- package/dist/components/core/Card/cardAnimations.d.ts +1 -1
- package/dist/components/core/Card/cardAnimations.js +41 -10
- package/dist/components/core/Card/cardParts.d.ts +1 -1
- package/dist/components/core/Card/cardParts.js +26 -6
- package/dist/components/core/Card/cardStyles.d.ts +5 -4
- package/dist/components/core/Card/cardStyles.js +9 -6
- package/dist/components/core/Card/cardTypes.d.ts +4 -0
- package/dist/components/core/Card/index.d.ts +1 -0
- package/dist/components/core/Checkbox/Checkbox.js +9 -1
- package/dist/components/core/Checkbox/checkboxAPI.d.ts +2 -0
- package/dist/components/core/Checkbox/checkboxAPI.js +36 -0
- package/dist/components/core/Checkbox/checkboxParts.d.ts +5 -4
- package/dist/components/core/Checkbox/checkboxParts.js +74 -48
- package/dist/components/core/Checkbox/checkboxStyles.d.ts +4 -3
- package/dist/components/core/Checkbox/checkboxStyles.js +5 -3
- package/dist/components/core/Checkbox/checkboxTypes.d.ts +2 -0
- package/dist/components/core/Checkbox/index.d.ts +1 -1
- package/dist/components/core/Checkbox/useCheckboxRootState.d.ts +4 -1
- package/dist/components/core/Checkbox/useCheckboxRootState.js +43 -30
- package/dist/components/core/CloseButton/CloseButton.js +2 -1
- package/dist/components/core/CloseButton/closeButtonAnimations.js +38 -9
- package/dist/components/core/CloseButton/closeButtonParts.js +3 -4
- package/dist/components/core/ColorPicker/ColorPicker.js +27 -8
- package/dist/components/core/ColorPicker/ColorSlider.d.ts +2 -0
- package/dist/components/core/ColorPicker/ColorSlider.js +131 -53
- package/dist/components/core/ColorPicker/ColorSwatch.js +22 -4
- package/dist/components/core/ColorPicker/colorPickerAnimations.d.ts +1 -1
- package/dist/components/core/ColorPicker/colorPickerAnimations.js +33 -8
- package/dist/components/core/ColorPicker/colorPickerParts.js +125 -32
- package/dist/components/core/ColorPicker/colorPickerStyles.d.ts +11 -3
- package/dist/components/core/ColorPicker/colorPickerStyles.js +13 -3
- package/dist/components/core/ColorPicker/colorPickerTypes.d.ts +4 -0
- package/dist/components/core/ColorPicker/colorSliderStyles.d.ts +2 -2
- package/dist/components/core/ColorPicker/colorSliderStyles.js +4 -4
- package/dist/components/core/ColorPicker/colorSliderTypes.d.ts +2 -0
- package/dist/components/core/ColorPicker/colorSwatchStyles.d.ts +1 -0
- package/dist/components/core/ColorPicker/colorSwatchStyles.js +4 -0
- package/dist/components/core/ColorPicker/colorUtils.d.ts +2 -1
- package/dist/components/core/ColorPicker/colorUtils.js +33 -10
- package/dist/components/core/ColorPicker/index.d.ts +2 -0
- package/dist/components/core/ColorPicker/useColorPickerRootState.d.ts +3 -1
- package/dist/components/core/ColorPicker/useColorPickerRootState.js +65 -30
- package/dist/components/core/ComboBox/ComboBox.js +13 -1
- package/dist/components/core/ComboBox/comboBoxAnimations.d.ts +3 -2
- package/dist/components/core/ComboBox/comboBoxAnimations.js +5 -2
- package/dist/components/core/ComboBox/comboBoxFieldParts.js +1 -1
- package/dist/components/core/ComboBox/comboBoxParts.d.ts +3 -1
- package/dist/components/core/ComboBox/comboBoxParts.js +114 -28
- package/dist/components/core/ComboBox/comboBoxStyles.d.ts +4 -4
- package/dist/components/core/ComboBox/comboBoxStyles.js +4 -4
- package/dist/components/core/ComboBox/comboBoxTypes.d.ts +5 -0
- package/dist/components/core/ComboBox/useComboBoxInputState.d.ts +3 -2
- package/dist/components/core/ComboBox/useComboBoxInputState.js +130 -62
- package/dist/components/core/ComboBox/useComboBoxRootState.js +44 -18
- package/dist/components/core/Container/Container.js +3 -0
- package/dist/components/core/Container/containerStyles.d.ts +2 -1
- package/dist/components/core/Container/containerStyles.js +2 -1
- package/dist/components/core/ContextMenu/ContextMenu.d.ts +3 -1
- package/dist/components/core/ContextMenu/ContextMenu.js +177 -19
- package/dist/components/core/ContextMenu/contextMenuStyles.d.ts +1 -1
- package/dist/components/core/ContextMenu/contextMenuStyles.js +1 -1
- package/dist/components/core/ContextMenu/index.d.ts +3 -1
- package/dist/components/core/DatePicker/DatePicker.js +8 -3
- package/dist/components/core/DatePicker/datePickerAPI.d.ts +2 -0
- package/dist/components/core/DatePicker/datePickerAPI.js +43 -0
- package/dist/components/core/DatePicker/datePickerAnimations.d.ts +2 -1
- package/dist/components/core/DatePicker/datePickerAnimations.js +9 -5
- package/dist/components/core/DatePicker/datePickerParts.js +29 -5
- package/dist/components/core/DatePicker/datePickerStyles.d.ts +2 -2
- package/dist/components/core/DatePicker/datePickerStyles.js +2 -2
- package/dist/components/core/DatePicker/datePickerTypes.d.ts +2 -0
- package/dist/components/core/DatePicker/useDatePickerRootState.d.ts +2 -0
- package/dist/components/core/DatePicker/useDatePickerRootState.js +63 -24
- package/dist/components/core/Dialog/Dialog.d.ts +1 -1
- package/dist/components/core/Dialog/Dialog.js +2 -0
- package/dist/components/core/Dialog/dialogAnimations.d.ts +1 -0
- package/dist/components/core/Dialog/dialogAnimations.js +1 -0
- package/dist/components/core/Dialog/dialogParts.d.ts +1 -1
- package/dist/components/core/Dialog/dialogParts.js +8 -3
- package/dist/components/core/Dialog/dialogStyles.d.ts +1 -1
- package/dist/components/core/Dialog/dialogStyles.js +2 -2
- package/dist/components/core/Dialog/dialogTypes.d.ts +4 -1
- package/dist/components/core/Dialog/useDialogRootState.d.ts +1 -1
- package/dist/components/core/Dialog/useDialogRootState.js +2 -0
- package/dist/components/core/Disclosure/Disclosure.js +10 -4
- package/dist/components/core/Disclosure/disclosureAnimations.js +7 -5
- package/dist/components/core/Disclosure/disclosureContentPart.js +3 -0
- package/dist/components/core/Disclosure/disclosureParts.js +29 -20
- package/dist/components/core/Disclosure/disclosureStyles.d.ts +1 -1
- package/dist/components/core/Disclosure/disclosureStyles.js +3 -3
- package/dist/components/core/Disclosure/useDisclosureContentDrag.js +3 -1
- package/dist/components/core/Disclosure/useDisclosureGroupRootState.js +17 -7
- package/dist/components/core/Disclosure/useDisclosureRootState.js +12 -12
- package/dist/components/core/Drawer/Drawer.d.ts +1 -1
- package/dist/components/core/Drawer/Drawer.js +2 -0
- package/dist/components/core/Drawer/drawerAnimations.d.ts +1 -0
- package/dist/components/core/Drawer/drawerAnimations.js +1 -0
- package/dist/components/core/Drawer/drawerParts.js +14 -9
- package/dist/components/core/Drawer/drawerStyles.d.ts +1 -1
- package/dist/components/core/Drawer/drawerStyles.js +2 -2
- package/dist/components/core/Drawer/drawerTypes.d.ts +4 -1
- package/dist/components/core/Drawer/useDrawerHandleDrag.d.ts +2 -0
- package/dist/components/core/Drawer/useDrawerHandleDrag.js +117 -35
- package/dist/components/core/Drawer/useDrawerRootState.d.ts +1 -1
- package/dist/components/core/Drawer/useDrawerRootState.js +3 -0
- package/dist/components/core/Dropdown/dropdownA11y.js +4 -1
- package/dist/components/core/Dropdown/dropdownAnimations.d.ts +3 -2
- package/dist/components/core/Dropdown/dropdownAnimations.js +79 -29
- package/dist/components/core/Dropdown/dropdownItemParts.d.ts +3 -1
- package/dist/components/core/Dropdown/dropdownItemParts.js +25 -5
- package/dist/components/core/Dropdown/dropdownParts.js +40 -11
- package/dist/components/core/Dropdown/dropdownStyles.d.ts +3 -3
- package/dist/components/core/Dropdown/dropdownStyles.js +3 -3
- package/dist/components/core/Dropdown/dropdownSubParts.js +47 -16
- package/dist/components/core/Dropdown/dropdownTypes.d.ts +13 -2
- package/dist/components/core/Dropdown/index.d.ts +3 -1
- package/dist/components/core/Dropdown/useDropdownItemState.d.ts +5 -1
- package/dist/components/core/Dropdown/useDropdownItemState.js +3 -1
- package/dist/components/core/Dropdown/useDropdownRootState.js +16 -5
- package/dist/components/core/Expandable/expandableA11y.d.ts +1 -0
- package/dist/components/core/Expandable/expandableA11y.js +5 -0
- package/dist/components/core/Expandable/expandableAPI.d.ts +1 -0
- package/dist/components/core/Expandable/expandableAPI.js +19 -11
- package/dist/components/core/Expandable/expandableAnimations.d.ts +1 -1
- package/dist/components/core/Expandable/expandableAnimations.js +9 -9
- package/dist/components/core/Expandable/expandableParts.js +31 -23
- package/dist/components/core/Expandable/expandableStyles.d.ts +1 -1
- package/dist/components/core/Expandable/expandableStyles.js +1 -1
- package/dist/components/core/Expandable/useExpandableRootState.js +5 -3
- package/dist/components/core/Field/fieldParts.d.ts +2 -2
- package/dist/components/core/Field/fieldParts.js +2 -1
- package/dist/components/core/Field/fieldStyles.js +1 -1
- package/dist/components/core/Grid/Grid.js +3 -0
- package/dist/components/core/Grid/gridStyles.d.ts +2 -1
- package/dist/components/core/Grid/gridStyles.js +2 -1
- package/dist/components/core/Header/Header.js +3 -1
- package/dist/components/core/Header/headerStyles.d.ts +3 -2
- package/dist/components/core/Header/headerStyles.js +9 -2
- package/dist/components/core/HoverCard/hoverCardParts.js +23 -11
- package/dist/components/core/Input/inputAffixParts.js +6 -0
- package/dist/components/core/Input/inputAnimations.js +3 -1
- package/dist/components/core/Input/inputControlParts.js +48 -14
- package/dist/components/core/Input/inputFieldParts.js +1 -1
- package/dist/components/core/Input/inputStyles.d.ts +5 -5
- package/dist/components/core/Input/inputStyles.js +5 -5
- package/dist/components/core/Input/inputTypes.d.ts +1 -0
- package/dist/components/core/Input/useInputRootState.js +2 -1
- package/dist/components/core/Kbd/Kbd.js +3 -1
- package/dist/components/core/Kbd/kbdAnimations.js +16 -4
- package/dist/components/core/Kbd/kbdParts.js +6 -4
- package/dist/components/core/Kbd/kbdStyles.d.ts +1 -1
- package/dist/components/core/Kbd/kbdStyles.js +1 -1
- package/dist/components/core/Kbd/kbdTextPart.js +5 -2
- package/dist/components/core/Kbd/useKbdRootState.js +6 -2
- package/dist/components/core/Label/Label.d.ts +2 -1
- package/dist/components/core/Label/Label.js +8 -1
- package/dist/components/core/Label/labelParts.d.ts +1 -0
- package/dist/components/core/Label/labelTypes.d.ts +3 -1
- package/dist/components/core/Label/useLabelRootState.d.ts +2 -1
- package/dist/components/core/Label/useLabelRootState.js +3 -1
- package/dist/components/core/Link/Link.d.ts +1 -1
- package/dist/components/core/Link/Link.js +38 -25
- package/dist/components/core/Link/linkAPI.d.ts +3 -1
- package/dist/components/core/Link/linkAPI.js +8 -4
- package/dist/components/core/Link/linkAnchorBodyPart.d.ts +2 -2
- package/dist/components/core/Link/linkAnchorBodyPart.js +48 -8
- package/dist/components/core/Link/linkAnimations.d.ts +1 -1
- package/dist/components/core/Link/linkAnimations.js +29 -14
- package/dist/components/core/Link/linkIconSlotPart.d.ts +1 -1
- package/dist/components/core/Link/linkIconSlotPart.js +3 -3
- package/dist/components/core/Link/linkStyles.d.ts +5 -3
- package/dist/components/core/Link/linkStyles.js +6 -3
- package/dist/components/core/Link/linkTypes.d.ts +14 -1
- package/dist/components/core/Link/useLinkRootState.d.ts +2 -0
- package/dist/components/core/ListBox/ListBox.d.ts +1 -0
- package/dist/components/core/ListBox/ListBox.js +2 -0
- package/dist/components/core/ListBox/index.d.ts +1 -0
- package/dist/components/core/ListBox/listBoxAnimations.d.ts +5 -2
- package/dist/components/core/ListBox/listBoxAnimations.js +15 -3
- package/dist/components/core/ListBox/listBoxParts.js +21 -5
- package/dist/components/core/ListBox/listBoxStyles.d.ts +3 -3
- package/dist/components/core/ListBox/listBoxStyles.js +3 -3
- package/dist/components/core/ListBox/listBoxTypes.d.ts +5 -1
- package/dist/components/core/ListBox/useListBoxItemState.d.ts +1 -1
- package/dist/components/core/ListBox/useListBoxRootState.d.ts +1 -1
- package/dist/components/core/ListBox/useListBoxRootState.js +31 -6
- package/dist/components/core/ListBox/useListBoxVirtualWindow.d.ts +1 -0
- package/dist/components/core/ListBox/useListBoxVirtualWindow.js +11 -4
- package/dist/components/core/Loading/Loading.js +1 -1
- package/dist/components/core/Loading/loadingAnimations.d.ts +2 -2
- package/dist/components/core/Loading/loadingAnimations.js +12 -5
- package/dist/components/core/Loading/loadingParts.js +1 -1
- package/dist/components/core/Loading/loadingStyles.js +1 -1
- package/dist/components/core/Meter/Meter.js +21 -3
- package/dist/components/core/Meter/meterAPI.d.ts +4 -0
- package/dist/components/core/Meter/meterAPI.js +13 -2
- package/dist/components/core/Meter/meterParts.js +6 -2
- package/dist/components/core/Meter/meterStyles.d.ts +1 -1
- package/dist/components/core/Meter/meterStyles.js +1 -1
- package/dist/components/core/Meter/meterTypes.d.ts +1 -0
- package/dist/components/core/Meter/useMeterRootState.js +3 -2
- package/dist/components/core/Meter/useMeterTrackState.d.ts +1 -1
- package/dist/components/core/Meter/useMeterTrackState.js +15 -10
- package/dist/components/core/NumberInput/NumberInput.js +13 -2
- package/dist/components/core/NumberInput/numberInputParts.d.ts +4 -1
- package/dist/components/core/NumberInput/numberInputParts.js +30 -4
- package/dist/components/core/NumberInput/numberInputStyles.js +2 -2
- package/dist/components/core/NumberInput/useNumberInputRootState.js +47 -33
- package/dist/components/core/Pagination/paginationAPI.d.ts +4 -1
- package/dist/components/core/Pagination/paginationAPI.js +60 -17
- package/dist/components/core/Pagination/paginationAnimations.js +6 -0
- package/dist/components/core/Pagination/paginationParts.d.ts +1 -1
- package/dist/components/core/Pagination/paginationParts.js +82 -22
- package/dist/components/core/Pagination/paginationStyles.d.ts +7 -6
- package/dist/components/core/Pagination/paginationStyles.js +7 -6
- package/dist/components/core/Pagination/paginationTypes.d.ts +1 -0
- package/dist/components/core/Pagination/usePaginationRootState.js +12 -6
- package/dist/components/core/PinInput/pinInputAnimations.d.ts +6 -1
- package/dist/components/core/PinInput/pinInputAnimations.js +13 -4
- package/dist/components/core/PinInput/pinInputParts.js +84 -20
- package/dist/components/core/PinInput/pinInputStyles.d.ts +1 -1
- package/dist/components/core/PinInput/pinInputStyles.js +2 -2
- package/dist/components/core/PinInput/pinInputTypes.d.ts +4 -0
- package/dist/components/core/PinInput/usePinInputRootState.js +71 -33
- package/dist/components/core/Popover/popoverAnimations.d.ts +1 -0
- package/dist/components/core/Popover/popoverAnimations.js +33 -7
- package/dist/components/core/Popover/popoverParts.js +62 -14
- package/dist/components/core/Popover/popoverStyles.d.ts +1 -1
- package/dist/components/core/Popover/popoverStyles.js +1 -1
- package/dist/components/core/Popover/popoverTypes.d.ts +1 -0
- package/dist/components/core/Popover/usePopoverRootState.js +46 -14
- package/dist/components/core/ProgressBar/ProgressBar.js +21 -3
- package/dist/components/core/ProgressBar/progressBarA11y.d.ts +1 -1
- package/dist/components/core/ProgressBar/progressBarA11y.js +4 -2
- package/dist/components/core/ProgressBar/progressBarAPI.d.ts +4 -0
- package/dist/components/core/ProgressBar/progressBarAPI.js +13 -2
- package/dist/components/core/ProgressBar/progressBarParts.js +6 -2
- package/dist/components/core/ProgressBar/progressBarStyles.d.ts +1 -1
- package/dist/components/core/ProgressBar/progressBarStyles.js +1 -1
- package/dist/components/core/ProgressBar/progressBarTypes.d.ts +3 -0
- package/dist/components/core/ProgressBar/useProgressBarRootState.js +6 -3
- package/dist/components/core/ProgressBar/useProgressBarTrackState.d.ts +1 -1
- package/dist/components/core/ProgressBar/useProgressBarTrackState.js +18 -11
- package/dist/components/core/Radio/Radio.js +6 -1
- package/dist/components/core/Radio/radioParts.js +6 -3
- package/dist/components/core/Radio/radioStyles.d.ts +3 -3
- package/dist/components/core/Radio/radioStyles.js +3 -3
- package/dist/components/core/Radio/radioTypes.d.ts +1 -0
- package/dist/components/core/Radio/useRadioRootState.d.ts +5 -2
- package/dist/components/core/Radio/useRadioRootState.js +80 -36
- package/dist/components/core/Resizable/Resizable.js +185 -20
- package/dist/components/core/Resizable/index.d.ts +1 -0
- package/dist/components/core/Resizable/resizableAnimations.js +1 -1
- package/dist/components/core/Resizable/resizableParts.d.ts +1 -0
- package/dist/components/core/Resizable/resizableParts.js +96 -42
- package/dist/components/core/Resizable/resizableStyles.d.ts +3 -2
- package/dist/components/core/Resizable/resizableStyles.js +3 -2
- package/dist/components/core/Resizable/resizableTypes.d.ts +10 -2
- package/dist/components/core/Ripple/Ripple.js +3 -2
- package/dist/components/core/Ripple/rippleAPI.d.ts +1 -0
- package/dist/components/core/Ripple/rippleAPI.js +7 -0
- package/dist/components/core/Ripple/rippleStyles.d.ts +1 -1
- package/dist/components/core/Ripple/rippleStyles.js +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/core/ScrollArea/scrollAreaAPI.d.ts +11 -2
- package/dist/components/core/ScrollArea/scrollAreaAPI.js +65 -9
- package/dist/components/core/ScrollArea/scrollAreaParts.js +31 -10
- package/dist/components/core/ScrollArea/scrollAreaStyles.d.ts +1 -1
- package/dist/components/core/ScrollArea/scrollAreaStyles.js +1 -1
- package/dist/components/core/ScrollArea/scrollAreaTypes.d.ts +4 -0
- package/dist/components/core/ScrollArea/useScrollAreaRootState.d.ts +1 -1
- package/dist/components/core/ScrollArea/useScrollAreaRootState.js +49 -10
- package/dist/components/core/SearchInput/SearchInput.js +24 -9
- package/dist/components/core/SearchInput/searchInputAnimations.d.ts +7 -6
- package/dist/components/core/SearchInput/searchInputAnimations.js +23 -18
- package/dist/components/core/SearchInput/searchInputParts.d.ts +2 -2
- package/dist/components/core/SearchInput/searchInputParts.js +22 -10
- package/dist/components/core/SearchInput/searchInputStyles.d.ts +5 -3
- package/dist/components/core/SearchInput/searchInputStyles.js +6 -5
- package/dist/components/core/SearchInput/searchInputTypes.d.ts +1 -0
- package/dist/components/core/SearchInput/useSearchInputRootState.d.ts +3 -3
- package/dist/components/core/SearchInput/useSearchInputRootState.js +52 -34
- package/dist/components/core/Select/Select.js +13 -1
- package/dist/components/core/Select/selectAnimations.d.ts +3 -2
- package/dist/components/core/Select/selectAnimations.js +5 -2
- package/dist/components/core/Select/selectParts.d.ts +3 -1
- package/dist/components/core/Select/selectParts.js +2 -1
- package/dist/components/core/Select/selectStyles.d.ts +3 -3
- package/dist/components/core/Select/selectStyles.js +3 -3
- package/dist/components/core/Select/selectTriggerParts.js +79 -28
- package/dist/components/core/Select/selectTypes.d.ts +1 -0
- package/dist/components/core/Select/useSelectRootState.js +33 -16
- package/dist/components/core/SelectionIndicator/selectionIndicatorAnimations.js +23 -3
- package/dist/components/core/SelectionThumb/SelectionThumb.js +1 -1
- package/dist/components/core/Separator/Separator.d.ts +2 -1
- package/dist/components/core/Separator/Separator.js +3 -1
- package/dist/components/core/Separator/index.d.ts +1 -1
- package/dist/components/core/Separator/separatorStyles.d.ts +2 -2
- package/dist/components/core/Separator/separatorStyles.js +2 -2
- package/dist/components/core/Separator/separatorTypes.d.ts +4 -0
- package/dist/components/core/Sidebar/Sidebar.js +15 -2
- package/dist/components/core/Sidebar/sidebarAnimations.d.ts +2 -2
- package/dist/components/core/Sidebar/sidebarAnimations.js +4 -3
- package/dist/components/core/Sidebar/sidebarStyles.d.ts +2 -1
- package/dist/components/core/Sidebar/sidebarStyles.js +2 -1
- package/dist/components/core/Skeleton/skeletonParts.js +8 -5
- package/dist/components/core/Skeleton/skeletonStyles.d.ts +10 -0
- package/dist/components/core/Skeleton/skeletonStyles.js +20 -0
- package/dist/components/core/Slider/Slider.js +9 -3
- package/dist/components/core/Slider/sliderAPI.d.ts +5 -4
- package/dist/components/core/Slider/sliderAPI.js +86 -42
- package/dist/components/core/Slider/sliderAnimations.d.ts +1 -1
- package/dist/components/core/Slider/sliderAnimations.js +2 -2
- package/dist/components/core/Slider/sliderParts.js +11 -2
- package/dist/components/core/Slider/sliderStyles.d.ts +4 -4
- package/dist/components/core/Slider/sliderStyles.js +18 -6
- package/dist/components/core/Slider/sliderThumbParts.d.ts +2 -0
- package/dist/components/core/Slider/sliderThumbParts.js +16 -4
- package/dist/components/core/Slider/sliderTrackParts.js +10 -4
- package/dist/components/core/Slider/sliderTypes.d.ts +9 -1
- package/dist/components/core/Slider/useSliderRootState.d.ts +3 -2
- package/dist/components/core/Slider/useSliderRootState.js +104 -49
- package/dist/components/core/Slider/useSliderTrackState.js +198 -39
- package/dist/components/core/Stack/Stack.js +3 -0
- package/dist/components/core/Stack/stackStyles.d.ts +2 -1
- package/dist/components/core/Stack/stackStyles.js +2 -1
- package/dist/components/core/Stepper/index.d.ts +10 -1
- package/dist/components/core/Stepper/stepperAPI.d.ts +2 -2
- package/dist/components/core/Stepper/stepperAPI.js +4 -3
- package/dist/components/core/Stepper/stepperAnimations.d.ts +1 -0
- package/dist/components/core/Stepper/stepperAnimations.js +28 -2
- package/dist/components/core/Stepper/stepperParts.d.ts +11 -2
- package/dist/components/core/Stepper/stepperParts.js +38 -9
- package/dist/components/core/Stepper/stepperStyles.js +3 -1
- package/dist/components/core/Stepper/stepperTypes.d.ts +3 -2
- package/dist/components/core/Stepper/useStepperRootState.js +10 -3
- package/dist/components/core/Surface/Surface.js +3 -1
- package/dist/components/core/Switch/Switch.js +12 -1
- package/dist/components/core/Switch/switchAPI.d.ts +2 -0
- package/dist/components/core/Switch/switchAPI.js +18 -1
- package/dist/components/core/Switch/switchAnimations.js +29 -9
- package/dist/components/core/Switch/switchControlParts.js +93 -30
- package/dist/components/core/Switch/switchGeometry.js +2 -2
- package/dist/components/core/Switch/switchSimpleParts.d.ts +2 -1
- package/dist/components/core/Switch/switchSimpleParts.js +3 -1
- package/dist/components/core/Switch/switchStyles.d.ts +3 -3
- package/dist/components/core/Switch/switchStyles.js +3 -3
- package/dist/components/core/Switch/switchTypes.d.ts +8 -0
- package/dist/components/core/Switch/useSwitchRootState.js +54 -17
- package/dist/components/core/Table/Table.d.ts +1 -0
- package/dist/components/core/Table/Table.js +2 -0
- package/dist/components/core/Table/index.d.ts +1 -0
- package/dist/components/core/Table/tableAPI.d.ts +6 -1
- package/dist/components/core/Table/tableAPI.js +73 -5
- package/dist/components/core/Table/tableContext.js +6 -1
- package/dist/components/core/Table/tableParts.js +77 -34
- package/dist/components/core/Table/tableStyles.d.ts +13 -2
- package/dist/components/core/Table/tableStyles.js +26 -3
- package/dist/components/core/Table/tableTypes.d.ts +4 -0
- package/dist/components/core/Table/tableVirtualRows.js +140 -27
- package/dist/components/core/Table/useTableContentState.d.ts +2 -1
- package/dist/components/core/Table/useTableContentState.js +32 -6
- package/dist/components/core/Tabs/tabsA11y.d.ts +4 -3
- package/dist/components/core/Tabs/tabsA11y.js +5 -4
- package/dist/components/core/Tabs/tabsContext.d.ts +5 -0
- package/dist/components/core/Tabs/tabsContext.js +12 -0
- package/dist/components/core/Tabs/tabsPanelPart.js +11 -1
- package/dist/components/core/Tabs/tabsParts.js +70 -32
- package/dist/components/core/Tabs/tabsStyles.d.ts +5 -2
- package/dist/components/core/Tabs/tabsStyles.js +13 -4
- package/dist/components/core/Tabs/tabsTabPart.js +55 -50
- package/dist/components/core/Tabs/tabsTypes.d.ts +2 -2
- package/dist/components/core/Tabs/useSlidingTabIndicator.d.ts +1 -1
- package/dist/components/core/Tabs/useSlidingTabIndicator.js +25 -10
- package/dist/components/core/Tabs/useTabsRootState.js +13 -5
- package/dist/components/core/TagsInput/TagsInput.js +13 -2
- package/dist/components/core/TagsInput/index.d.ts +2 -0
- package/dist/components/core/TagsInput/tagsInputParts.d.ts +6 -2
- package/dist/components/core/TagsInput/tagsInputParts.js +81 -14
- package/dist/components/core/TagsInput/tagsInputStyles.js +2 -2
- package/dist/components/core/TagsInput/tagsInputTypes.d.ts +3 -0
- package/dist/components/core/TagsInput/useTagsInputRootState.js +78 -33
- package/dist/components/core/Text/Text.d.ts +2 -1
- package/dist/components/core/Text/Text.js +3 -1
- package/dist/components/core/Text/index.d.ts +1 -1
- package/dist/components/core/Text/textTypes.d.ts +4 -0
- package/dist/components/core/TextArea/textAreaAnimations.js +5 -3
- package/dist/components/core/TextArea/textAreaParts.js +94 -12
- package/dist/components/core/TextArea/textAreaStyles.d.ts +3 -3
- package/dist/components/core/TextArea/textAreaStyles.js +2 -2
- package/dist/components/core/TextArea/textAreaTypes.d.ts +1 -0
- package/dist/components/core/TextArea/useTextAreaRootState.js +2 -1
- package/dist/components/core/TimeField/TimeField.js +6 -1
- package/dist/components/core/TimeField/timeFieldAnimations.d.ts +3 -2
- package/dist/components/core/TimeField/timeFieldAnimations.js +13 -4
- package/dist/components/core/TimeField/timeFieldParts.js +50 -30
- package/dist/components/core/TimeField/timeFieldStyles.d.ts +1 -1
- package/dist/components/core/TimeField/timeFieldStyles.js +1 -1
- package/dist/components/core/TimeField/timeFieldTypes.d.ts +2 -0
- package/dist/components/core/TimeField/useTimeFieldControlState.d.ts +4 -1
- package/dist/components/core/TimeField/useTimeFieldControlState.js +141 -39
- package/dist/components/core/TimeField/useTimeFieldRootState.js +3 -1
- package/dist/components/core/Toast/toastA11y.js +17 -7
- package/dist/components/core/Toast/toastAPI.d.ts +17 -1
- package/dist/components/core/Toast/toastAPI.js +82 -0
- package/dist/components/core/Toast/toastAnimations.d.ts +1 -1
- package/dist/components/core/Toast/toastAnimations.js +106 -98
- package/dist/components/core/Toast/toastProvider.js +25 -3
- package/dist/components/core/Toast/toastStyles.d.ts +5 -3
- package/dist/components/core/Toast/toastStyles.js +5 -3
- package/dist/components/core/Toast/toastTypes.d.ts +9 -0
- package/dist/components/core/Toast/useToastProviderState.js +61 -6
- package/dist/components/core/ToggleButton/ToggleButton.js +23 -7
- package/dist/components/core/ToggleButton/toggleButtonAnimations.d.ts +4 -2
- package/dist/components/core/ToggleButton/toggleButtonAnimations.js +64 -41
- package/dist/components/core/ToggleButton/toggleButtonStyles.d.ts +2 -1
- package/dist/components/core/ToggleButton/toggleButtonStyles.js +21 -2
- package/dist/components/core/ToggleButton/toggleButtonTypes.d.ts +3 -0
- package/dist/components/core/ToggleButton/useToggleButtonRootState.d.ts +1 -1
- package/dist/components/core/ToggleButton/useToggleButtonRootState.js +4 -7
- package/dist/components/core/Tooltip/tooltipAnimations.js +17 -1
- package/dist/components/core/Tooltip/tooltipParts.js +83 -26
- package/dist/components/core/Tooltip/tooltipPosition.js +57 -32
- package/dist/components/core/Tooltip/tooltipStyles.d.ts +2 -2
- package/dist/components/core/Tooltip/tooltipStyles.js +2 -2
- package/dist/components/core/Tooltip/tooltipTypes.d.ts +5 -0
- package/dist/components/core/Tooltip/useTooltipRootState.js +59 -10
- package/dist/components/core/utils/bodyScrollLock.js +12 -3
- package/dist/components/core/utils/clampNumber.d.ts +1 -1
- package/dist/components/core/utils/clampNumber.js +4 -1
- package/dist/components/core/utils/containedEscape.js +12 -0
- package/dist/components/core/utils/fieldFormDom.d.ts +24 -0
- package/dist/components/core/utils/fieldFormDom.js +37 -2
- package/dist/components/core/utils/focusElement.js +2 -2
- package/dist/components/core/utils/hoverInteractiveLift.d.ts +12 -0
- package/dist/components/core/utils/hoverInteractiveLift.js +43 -2
- package/dist/components/core/utils/inputAffixStyles.js +1 -1
- package/dist/components/core/utils/mergeAsChildProps.d.ts +7 -0
- package/dist/components/core/utils/mergeAsChildProps.js +23 -2
- package/dist/components/core/utils/optionListItemStyles.d.ts +2 -2
- package/dist/components/core/utils/optionListItemStyles.js +2 -2
- package/dist/components/core/utils/overlayLayer.d.ts +39 -0
- package/dist/components/core/utils/overlayLayer.js +164 -2
- package/dist/components/core/utils/overlayTriggerSqueeze.js +5 -4
- package/dist/components/core/utils/portalContainer.d.ts +27 -5
- package/dist/components/core/utils/portalContainer.js +38 -4
- package/dist/components/core/utils/pressRipple.js +2 -1
- package/dist/components/core/utils/readingDirection.js +8 -0
- package/dist/components/core/utils/runOpenAfterSqueeze.d.ts +7 -0
- package/dist/components/core/utils/runOpenAfterSqueeze.js +10 -3
- package/dist/components/core/utils/semanticStatusSurface.js +4 -4
- package/dist/components/core/utils/sizeLayout/panel.js +4 -4
- package/dist/components/core/utils/slotMotion/recipes/loadKitRecipe.js +2 -0
- package/dist/components/core/utils/slotMotion/recipes/switchThumb.js +3 -0
- package/dist/components/core/utils/slotMotion/resolveMotionValue.js +1 -1
- package/dist/components/core/utils/slotMotion/slotMount.js +1 -1
- package/dist/components/core/utils/slotMotion/useBarFillMotion.js +8 -3
- package/dist/components/core/utils/useCollapsibleHeight.js +2 -1
- package/dist/components/core/utils/useConvergeRipples.js +4 -1
- package/dist/components/core/utils/useModalMotion.d.ts +2 -0
- package/dist/components/core/utils/useModalMotion.js +19 -3
- package/dist/components/core/utils/usePressableElementTextMotion.js +4 -5
- package/dist/components/core/utils/useShadowMotion.js +28 -7
- package/dist/index.d.ts +3 -3
- package/dist/skins/resolveVariantVisual.d.ts +1 -1
- package/dist/skins/resolveVariantVisual.js +2 -2
- package/dist/skins/skinContext.js +6 -5
- package/dist/skins/skinLiveSlots.generated.d.ts +1 -1
- package/dist/skins/skinLiveSlots.generated.js +1 -1
- package/dist/skins/skinShell.js +9 -4
- package/dist/skins/skinSlots.generated.d.ts +1 -1
- package/dist/skins/skinSlots.generated.js +2 -0
- package/dist/studio/colorPresets.d.ts +1 -1
- package/dist/studio/colorPresets.js +8 -1
- package/dist/studio.d.ts +1 -1
- package/dist/studio.js +13 -1
- package/dist/theme/namedPalettes.d.ts +12 -0
- package/dist/theme/namedPalettes.js +697 -1
- package/dist/theme/themeDefaults.js +6 -3
- package/dist/tokens/config.d.ts +8 -2
- package/dist/tokens/config.js +15 -2
- package/dist/tokens/index.d.ts +1 -1
- package/dist/tokens/index.js +9 -0
- package/dist/ui.css +499 -55
- package/dist/utils/cn.js +89 -2
- package/package.json +1 -1
- package/dist/components/composite/utils/useOptionGroupRequiredAnchor.js +0 -17
- package/dist/components/composite/utils/useOptionGroupSingleValue.js +0 -24
|
@@ -4,8 +4,7 @@ import { useFormFieldBinding } from "../../composite/Form/useFormFieldBinding.js
|
|
|
4
4
|
import { fieldErrorId, fieldHintId } from "../Field/fieldA11y.js";
|
|
5
5
|
import { hasCompoundChild } from "../utils/hasCompoundChild.js";
|
|
6
6
|
import { hasCompoundChildren } from "../utils/hasCompoundChildren.js";
|
|
7
|
-
import {
|
|
8
|
-
import { useFieldInvalid } from "../Field/fieldContext.js";
|
|
7
|
+
import { useResolvedFieldInvalid } from "../utils/fieldInvalid.js";
|
|
9
8
|
import { sliderDisplayFromProps, sliderDisplayEqual } from "./sliderAPI.js";
|
|
10
9
|
import { sliderLabelId } from "./sliderA11y.js";
|
|
11
10
|
function useSliderRootState({
|
|
@@ -32,8 +31,8 @@ function useSliderRootState({
|
|
|
32
31
|
thickness,
|
|
33
32
|
formatValue,
|
|
34
33
|
icon,
|
|
35
|
-
disabled,
|
|
36
|
-
readOnly
|
|
34
|
+
disabled: disabledProp,
|
|
35
|
+
readOnly: readOnlyProp,
|
|
37
36
|
"aria-label": ariaLabel,
|
|
38
37
|
"aria-labelledby": ariaLabelledBy,
|
|
39
38
|
variant
|
|
@@ -41,12 +40,13 @@ function useSliderRootState({
|
|
|
41
40
|
const formBinding = useFormFieldBinding({
|
|
42
41
|
name,
|
|
43
42
|
value,
|
|
44
|
-
disabled,
|
|
45
|
-
readOnly
|
|
43
|
+
disabled: disabledProp,
|
|
44
|
+
readOnly: readOnlyProp
|
|
46
45
|
});
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
46
|
+
const formBound = formBinding.bound;
|
|
47
|
+
const resolvedReadOnly = Boolean(readOnlyProp ?? formBinding.readOnly);
|
|
48
|
+
const resolvedDisabled = Boolean(disabledProp ?? formBinding.disabled);
|
|
49
|
+
const boundValue = formBound && formBinding.value !== "" && formBinding.value != null ? formBinding.value : void 0;
|
|
50
50
|
const autoId = useId();
|
|
51
51
|
const sliderId = idProp ?? `slider-${autoId}`;
|
|
52
52
|
const hintId = fieldHintId(sliderId);
|
|
@@ -68,21 +68,85 @@ function useSliderRootState({
|
|
|
68
68
|
const setDisplay = useCallback((next) => {
|
|
69
69
|
setDisplayState((prev) => sliderDisplayEqual(prev, next) ? prev : next);
|
|
70
70
|
}, []);
|
|
71
|
-
const { isCompound, hasLabel,
|
|
71
|
+
const { isCompound, hasLabel, hasCompoundHint, hasCompoundError } = useMemo(() => {
|
|
72
72
|
const compound = hasCompoundChildren(children);
|
|
73
73
|
return {
|
|
74
74
|
isCompound: compound,
|
|
75
|
-
hasLabel: label != null || compound && hasCompoundChild(children, "Label"),
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
hasLabel: label != null || compound && hasCompoundChild(children, "SliderLabel", "Slider.Label", "Label"),
|
|
76
|
+
hasCompoundHint: compound && hasCompoundChild(children, "Slider.Hint", "SliderHint"),
|
|
77
|
+
hasCompoundError: compound && hasCompoundChild(children, "Slider.Error", "SliderError")
|
|
78
78
|
};
|
|
79
|
-
}, [children,
|
|
80
|
-
const
|
|
81
|
-
const
|
|
79
|
+
}, [children, label]);
|
|
80
|
+
const resolvedError = error ?? (!hasCompoundError && formBound ? formBinding.error : void 0);
|
|
81
|
+
const hasHint = hint != null || hasCompoundHint;
|
|
82
|
+
const hasError = resolvedError != null || hasCompoundError;
|
|
83
|
+
const isInvalid = useResolvedFieldInvalid({
|
|
82
84
|
invalid,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
errorConnected: hasError,
|
|
86
|
+
formInvalid: Boolean(formBound && formBinding.error)
|
|
85
87
|
});
|
|
88
|
+
const handleRootValueChange = useCallback(
|
|
89
|
+
(next) => {
|
|
90
|
+
if (resolvedReadOnly || resolvedDisabled) return;
|
|
91
|
+
onValueChange?.(next);
|
|
92
|
+
if (formBound) formBinding.setValue(next);
|
|
93
|
+
},
|
|
94
|
+
[formBinding, formBound, onValueChange, resolvedDisabled, resolvedReadOnly]
|
|
95
|
+
);
|
|
96
|
+
const handleRootValueCommit = useCallback(
|
|
97
|
+
(next) => {
|
|
98
|
+
if (resolvedReadOnly || resolvedDisabled) return;
|
|
99
|
+
onValueCommit?.(next);
|
|
100
|
+
},
|
|
101
|
+
[onValueCommit, resolvedDisabled, resolvedReadOnly]
|
|
102
|
+
);
|
|
103
|
+
const trackProps = useMemo(
|
|
104
|
+
() => ({
|
|
105
|
+
range,
|
|
106
|
+
value: boundValue ?? value,
|
|
107
|
+
defaultValue,
|
|
108
|
+
onValueChange: handleRootValueChange,
|
|
109
|
+
onValueCommit: handleRootValueCommit,
|
|
110
|
+
min,
|
|
111
|
+
max,
|
|
112
|
+
step,
|
|
113
|
+
marks,
|
|
114
|
+
size,
|
|
115
|
+
thickness,
|
|
116
|
+
formatValue,
|
|
117
|
+
icon,
|
|
118
|
+
disabled: resolvedDisabled,
|
|
119
|
+
readOnly: resolvedReadOnly,
|
|
120
|
+
"aria-label": ariaLabel,
|
|
121
|
+
"aria-labelledby": ariaLabelledBy,
|
|
122
|
+
variant,
|
|
123
|
+
orientation
|
|
124
|
+
}),
|
|
125
|
+
[
|
|
126
|
+
ariaLabel,
|
|
127
|
+
ariaLabelledBy,
|
|
128
|
+
boundValue,
|
|
129
|
+
defaultValue,
|
|
130
|
+
formatValue,
|
|
131
|
+
handleRootValueChange,
|
|
132
|
+
handleRootValueCommit,
|
|
133
|
+
icon,
|
|
134
|
+
marks,
|
|
135
|
+
max,
|
|
136
|
+
min,
|
|
137
|
+
orientation,
|
|
138
|
+
range,
|
|
139
|
+
resolvedDisabled,
|
|
140
|
+
resolvedReadOnly,
|
|
141
|
+
size,
|
|
142
|
+
step,
|
|
143
|
+
thickness,
|
|
144
|
+
value,
|
|
145
|
+
variant
|
|
146
|
+
]
|
|
147
|
+
);
|
|
148
|
+
const registerControlRef = formBound ? formBinding.ref : void 0;
|
|
149
|
+
const onControlBlur = formBound ? formBinding.onBlur : void 0;
|
|
86
150
|
const fieldCtx = useMemo(
|
|
87
151
|
() => ({
|
|
88
152
|
sliderId,
|
|
@@ -95,55 +159,46 @@ function useSliderRootState({
|
|
|
95
159
|
labelConnected: hasLabel,
|
|
96
160
|
orientation,
|
|
97
161
|
display,
|
|
98
|
-
setDisplay
|
|
162
|
+
setDisplay,
|
|
163
|
+
trackProps,
|
|
164
|
+
registerControlRef,
|
|
165
|
+
onControlBlur
|
|
99
166
|
}),
|
|
100
|
-
[
|
|
167
|
+
[
|
|
168
|
+
display,
|
|
169
|
+
errorId,
|
|
170
|
+
hasError,
|
|
171
|
+
hasHint,
|
|
172
|
+
hasLabel,
|
|
173
|
+
hintId,
|
|
174
|
+
isInvalid,
|
|
175
|
+
labelId,
|
|
176
|
+
onControlBlur,
|
|
177
|
+
orientation,
|
|
178
|
+
registerControlRef,
|
|
179
|
+
setDisplay,
|
|
180
|
+
sliderId,
|
|
181
|
+
trackProps
|
|
182
|
+
]
|
|
101
183
|
);
|
|
102
184
|
const fieldLabelCtx = useMemo(
|
|
103
185
|
() => ({ labelId, required: false }),
|
|
104
186
|
[labelId]
|
|
105
187
|
);
|
|
106
|
-
const trackProps = {
|
|
107
|
-
range,
|
|
108
|
-
value: boundValue ?? value,
|
|
109
|
-
defaultValue,
|
|
110
|
-
onValueChange: ((next) => {
|
|
111
|
-
if (resolvedReadOnly) return;
|
|
112
|
-
onValueChange?.(next);
|
|
113
|
-
if (formBinding.bound) formBinding.setValue(next);
|
|
114
|
-
}),
|
|
115
|
-
onValueCommit: ((next) => {
|
|
116
|
-
if (resolvedReadOnly) return;
|
|
117
|
-
onValueCommit?.(next);
|
|
118
|
-
}),
|
|
119
|
-
min,
|
|
120
|
-
max,
|
|
121
|
-
step,
|
|
122
|
-
marks,
|
|
123
|
-
size,
|
|
124
|
-
thickness,
|
|
125
|
-
formatValue,
|
|
126
|
-
icon,
|
|
127
|
-
disabled: resolvedDisabled,
|
|
128
|
-
readOnly: resolvedReadOnly,
|
|
129
|
-
"aria-label": ariaLabel,
|
|
130
|
-
"aria-labelledby": ariaLabelledBy,
|
|
131
|
-
variant,
|
|
132
|
-
orientation
|
|
133
|
-
};
|
|
134
188
|
return {
|
|
135
189
|
sliderId,
|
|
136
190
|
isCompound,
|
|
137
191
|
fieldCtx,
|
|
138
192
|
fieldLabelCtx,
|
|
139
193
|
trackProps,
|
|
194
|
+
disabled: resolvedDisabled,
|
|
140
195
|
readOnly: resolvedReadOnly,
|
|
141
196
|
name: formBinding.name ?? name,
|
|
142
197
|
label,
|
|
143
198
|
showValue,
|
|
144
199
|
valueText,
|
|
145
200
|
hint,
|
|
146
|
-
error,
|
|
201
|
+
error: resolvedError,
|
|
147
202
|
hasHint,
|
|
148
203
|
hasError,
|
|
149
204
|
hintId,
|
|
@@ -1,55 +1,96 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useMemo, useCallback, useRef, useState, useLayoutEffect, useEffect } from "react";
|
|
3
|
+
import { useNativeFormReset } from "../utils/fieldFormDom.js";
|
|
4
|
+
import { focusElement } from "../utils/focusElement.js";
|
|
5
|
+
import { isRtlElement } from "../utils/readingDirection.js";
|
|
3
6
|
import { useControllableState } from "../utils/useControllableState.js";
|
|
4
7
|
import { useBurneLabels } from "../../../theme/BurneLabelsProvider.js";
|
|
5
8
|
import { useSkinVariant } from "../../../skins/skinContext.js";
|
|
6
|
-
import { defaultSliderFormatValue, resolveSliderFallbackThumbPx, normalizeSliderMarks, snapSliderToMarks, snapSliderToStep, readSliderValueBinding, sliderLiveValue, commitSliderSingle, commitSliderRange, readSliderTrackMetrics, sliderFillSpanForValues, sliderFillStyleFromSpan,
|
|
9
|
+
import { defaultSliderFormatValue, resolveSliderFallbackThumbPx, normalizeSliderMarks, snapSliderToMarks, snapSliderToStep, readSliderValueBinding, sliderLiveValue, commitSliderSingle, commitSliderRange, readSliderTrackMetrics, sliderFillSpanForValues, sliderFillStyleFromSpan, sliderPointerToValue, applySliderPointer, sliderStepDelta, applySliderThumbKey, sliderThumbCenterPercent, resolveSliderThumbIcon, partitionSliderTrackChildren, sliderValueIdentity, sliderExplicitNames, clampSliderValue } from "./sliderAPI.js";
|
|
7
10
|
import { resolveSliderThumbA11y } from "./sliderA11y.js";
|
|
8
11
|
import { applySliderFillStyle, useSliderFillCleanup } from "./sliderAnimations.js";
|
|
9
12
|
import { useOptionalSliderFieldContext, useSliderClassNames } from "./sliderContext.js";
|
|
10
13
|
import { sliderFillClass, sliderRailClass, sliderTrackCrossStyle, sliderTrackHitAreaClass } from "./sliderStyles.js";
|
|
11
14
|
function useSliderTrackState(props, ref) {
|
|
15
|
+
const fieldCtx = useOptionalSliderFieldContext();
|
|
16
|
+
const rootTrack = fieldCtx?.trackProps;
|
|
12
17
|
const {
|
|
13
18
|
orientation: orientationProp,
|
|
14
|
-
size
|
|
15
|
-
thickness,
|
|
16
|
-
min
|
|
17
|
-
max
|
|
18
|
-
step
|
|
19
|
+
size: sizeProp,
|
|
20
|
+
thickness: thicknessProp,
|
|
21
|
+
min: minProp,
|
|
22
|
+
max: maxProp,
|
|
23
|
+
step: stepProp,
|
|
19
24
|
marks: marksProp,
|
|
20
|
-
formatValue
|
|
21
|
-
icon,
|
|
25
|
+
formatValue: formatValueProp,
|
|
26
|
+
icon: iconProp,
|
|
22
27
|
variant: variantProp,
|
|
23
|
-
disabled
|
|
24
|
-
readOnly
|
|
28
|
+
disabled: disabledProp,
|
|
29
|
+
readOnly: readOnlyProp,
|
|
25
30
|
className,
|
|
26
31
|
style: styleProp,
|
|
27
32
|
classNames: trackClassNames,
|
|
28
33
|
"aria-label": ariaLabelProp,
|
|
29
34
|
"aria-labelledby": ariaLabelledByProp,
|
|
30
|
-
range
|
|
35
|
+
range: rangeProp,
|
|
31
36
|
children,
|
|
32
37
|
onPointerDown: onPointerDownProp,
|
|
33
|
-
value:
|
|
34
|
-
defaultValue:
|
|
35
|
-
onValueChange:
|
|
36
|
-
onValueCommit:
|
|
38
|
+
value: valueProp,
|
|
39
|
+
defaultValue: defaultValueProp,
|
|
40
|
+
onValueChange: onValueChangeProp,
|
|
41
|
+
onValueCommit: onValueCommitProp,
|
|
37
42
|
motion: _motion,
|
|
38
43
|
motionController: _motionController,
|
|
44
|
+
motionState: _motionState,
|
|
45
|
+
motionPayload: _motionPayload,
|
|
46
|
+
playInitialState: _playInitialState,
|
|
39
47
|
...trackRest
|
|
40
48
|
} = props;
|
|
49
|
+
const size = sizeProp ?? rootTrack?.size ?? "base";
|
|
50
|
+
const thickness = thicknessProp ?? rootTrack?.thickness;
|
|
51
|
+
const min = minProp ?? rootTrack?.min ?? 0;
|
|
52
|
+
const max = maxProp ?? rootTrack?.max ?? 100;
|
|
53
|
+
const step = stepProp ?? rootTrack?.step ?? 1;
|
|
54
|
+
const resolvedMarksProp = marksProp ?? rootTrack?.marks;
|
|
55
|
+
const formatValue = formatValueProp ?? rootTrack?.formatValue ?? defaultSliderFormatValue;
|
|
56
|
+
const icon = iconProp ?? rootTrack?.icon;
|
|
57
|
+
const disabled = Boolean(disabledProp ?? rootTrack?.disabled);
|
|
58
|
+
const readOnly = Boolean(readOnlyProp ?? rootTrack?.readOnly);
|
|
59
|
+
const range = Boolean(rangeProp ?? rootTrack?.range);
|
|
60
|
+
const mergedAriaLabel = ariaLabelProp ?? rootTrack?.["aria-label"];
|
|
61
|
+
const mergedAriaLabelledBy = ariaLabelledByProp ?? rootTrack?.["aria-labelledby"];
|
|
62
|
+
const mergedValueProps = useMemo(() => {
|
|
63
|
+
const rootChange = rootTrack?.onValueChange;
|
|
64
|
+
const ownChange = onValueChangeProp;
|
|
65
|
+
const mergedChange = ownChange && rootChange && ownChange !== rootChange ? (next) => {
|
|
66
|
+
ownChange(next);
|
|
67
|
+
rootChange(next);
|
|
68
|
+
} : ownChange ?? rootChange;
|
|
69
|
+
const rootCommit = rootTrack?.onValueCommit;
|
|
70
|
+
const ownCommit = onValueCommitProp;
|
|
71
|
+
const mergedCommit = ownCommit && rootCommit && ownCommit !== rootCommit ? (next) => {
|
|
72
|
+
ownCommit(next);
|
|
73
|
+
rootCommit(next);
|
|
74
|
+
} : ownCommit ?? rootCommit;
|
|
75
|
+
return {
|
|
76
|
+
range,
|
|
77
|
+
value: valueProp !== void 0 ? valueProp : rootTrack?.value,
|
|
78
|
+
defaultValue: defaultValueProp !== void 0 ? defaultValueProp : rootTrack?.defaultValue,
|
|
79
|
+
onValueChange: mergedChange,
|
|
80
|
+
onValueCommit: mergedCommit
|
|
81
|
+
};
|
|
82
|
+
}, [defaultValueProp, onValueChangeProp, onValueCommitProp, range, rootTrack, valueProp]);
|
|
41
83
|
const labels = useBurneLabels();
|
|
42
|
-
const variant = useSkinVariant(variantProp);
|
|
43
|
-
const fieldCtx = useOptionalSliderFieldContext();
|
|
84
|
+
const variant = useSkinVariant(variantProp ?? rootTrack?.variant);
|
|
44
85
|
const rootClassNames = useSliderClassNames();
|
|
45
86
|
const slotClassNames = useMemo(
|
|
46
87
|
() => ({ ...rootClassNames, ...trackClassNames }),
|
|
47
88
|
[rootClassNames, trackClassNames]
|
|
48
89
|
);
|
|
49
|
-
const orientation = orientationProp ?? fieldCtx?.orientation ?? "horizontal";
|
|
90
|
+
const orientation = orientationProp ?? rootTrack?.orientation ?? fieldCtx?.orientation ?? "horizontal";
|
|
50
91
|
const labelId = fieldCtx?.labelId;
|
|
51
92
|
const labelConnected = fieldCtx?.labelConnected ?? false;
|
|
52
|
-
const { explicitLabel, labelledBy } = sliderExplicitNames(
|
|
93
|
+
const { explicitLabel, labelledBy } = sliderExplicitNames(mergedAriaLabel, mergedAriaLabelledBy);
|
|
53
94
|
const resolveThumbA11y = useCallback(
|
|
54
95
|
(kind) => resolveSliderThumbA11y({
|
|
55
96
|
kind,
|
|
@@ -67,17 +108,42 @@ function useSliderTrackState(props, ref) {
|
|
|
67
108
|
);
|
|
68
109
|
const trackRef = useRef(null);
|
|
69
110
|
const fillRef = useRef(null);
|
|
111
|
+
const singleThumbRef = useRef(null);
|
|
112
|
+
const startThumbRef = useRef(null);
|
|
113
|
+
const endThumbRef = useRef(null);
|
|
70
114
|
const [trackSpanPx, setTrackSpanPx] = useState(0);
|
|
115
|
+
const [isRtl, setIsRtl] = useState(false);
|
|
71
116
|
const fallbackThumbPx = useMemo(
|
|
72
117
|
() => resolveSliderFallbackThumbPx(thickness, size),
|
|
73
118
|
[thickness, size]
|
|
74
119
|
);
|
|
75
120
|
const [thumbSpanPx, setThumbSpanPx] = useState(fallbackThumbPx);
|
|
76
121
|
const draggingRef = useRef(null);
|
|
122
|
+
const activePointerIdRef = useRef(null);
|
|
77
123
|
const [activeThumb, setActiveThumb] = useState(null);
|
|
124
|
+
const registerControlRef = fieldCtx?.registerControlRef;
|
|
125
|
+
const getThumbRef = useCallback(
|
|
126
|
+
(kind) => (node) => {
|
|
127
|
+
if (kind === "start") {
|
|
128
|
+
startThumbRef.current = node;
|
|
129
|
+
if (range) registerControlRef?.(node);
|
|
130
|
+
} else if (kind === "end") {
|
|
131
|
+
endThumbRef.current = node;
|
|
132
|
+
} else {
|
|
133
|
+
singleThumbRef.current = node;
|
|
134
|
+
if (!range) registerControlRef?.(node);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
[range, registerControlRef]
|
|
138
|
+
);
|
|
139
|
+
const thumbNodeFor = useCallback((kind) => {
|
|
140
|
+
if (kind === "start") return startThumbRef.current;
|
|
141
|
+
if (kind === "end") return endThumbRef.current;
|
|
142
|
+
return singleThumbRef.current;
|
|
143
|
+
}, []);
|
|
78
144
|
const marks = useMemo(
|
|
79
|
-
() => normalizeSliderMarks(
|
|
80
|
-
[
|
|
145
|
+
() => normalizeSliderMarks(resolvedMarksProp, min, max),
|
|
146
|
+
[resolvedMarksProp, min, max]
|
|
81
147
|
);
|
|
82
148
|
const snap = useCallback(
|
|
83
149
|
(raw) => {
|
|
@@ -87,14 +153,20 @@ function useSliderTrackState(props, ref) {
|
|
|
87
153
|
},
|
|
88
154
|
[marks, min, max, step]
|
|
89
155
|
);
|
|
90
|
-
const binding = readSliderValueBinding(
|
|
156
|
+
const binding = readSliderValueBinding(mergedValueProps, range, min, max);
|
|
157
|
+
const singleDefaultSnapped = snap(binding.singleDefault);
|
|
158
|
+
const rangeDefaultSnapped = useMemo(() => {
|
|
159
|
+
const a = snap(binding.rangeDefault[0]);
|
|
160
|
+
const b = snap(binding.rangeDefault[1]);
|
|
161
|
+
return a <= b ? [a, b] : [b, a];
|
|
162
|
+
}, [binding.rangeDefault, snap]);
|
|
91
163
|
const [singleValue, setSingleValue] = useControllableState({
|
|
92
164
|
value: binding.singleValue,
|
|
93
|
-
defaultValue:
|
|
165
|
+
defaultValue: singleDefaultSnapped
|
|
94
166
|
});
|
|
95
167
|
const [rangeValue, setRangeValue] = useControllableState({
|
|
96
168
|
value: binding.rangeValue,
|
|
97
|
-
defaultValue:
|
|
169
|
+
defaultValue: rangeDefaultSnapped
|
|
98
170
|
});
|
|
99
171
|
const onSingleChange = binding.onSingleChange;
|
|
100
172
|
const onRangeChange = binding.onRangeChange;
|
|
@@ -124,7 +196,10 @@ function useSliderTrackState(props, ref) {
|
|
|
124
196
|
(nextSingle = singleValue, nextRange = rangeValue) => {
|
|
125
197
|
const track = trackRef.current;
|
|
126
198
|
const fill = fillRef.current;
|
|
127
|
-
if (!track
|
|
199
|
+
if (!track) return;
|
|
200
|
+
const rtl = isRtlElement(track);
|
|
201
|
+
setIsRtl((prev) => prev === rtl ? prev : rtl);
|
|
202
|
+
if (!fill) return;
|
|
128
203
|
const rect = track.getBoundingClientRect();
|
|
129
204
|
const { trackSpanPx: spanPx, thumbSpanPx: thumbPx } = readSliderTrackMetrics(
|
|
130
205
|
rect,
|
|
@@ -147,6 +222,20 @@ function useSliderTrackState(props, ref) {
|
|
|
147
222
|
},
|
|
148
223
|
[fallbackThumbPx, max, min, orientation, range, rangeValue, singleValue]
|
|
149
224
|
);
|
|
225
|
+
const isUncontrolled = range ? binding.rangeValue === void 0 : binding.singleValue === void 0;
|
|
226
|
+
useNativeFormReset(
|
|
227
|
+
trackRef,
|
|
228
|
+
() => {
|
|
229
|
+
if (range) {
|
|
230
|
+
setRangeValue(rangeDefaultSnapped);
|
|
231
|
+
latestRef.current = rangeDefaultSnapped;
|
|
232
|
+
} else {
|
|
233
|
+
setSingleValue(singleDefaultSnapped);
|
|
234
|
+
latestRef.current = singleDefaultSnapped;
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
isUncontrolled
|
|
238
|
+
);
|
|
150
239
|
useLayoutEffect(() => {
|
|
151
240
|
syncFill();
|
|
152
241
|
}, [syncFill]);
|
|
@@ -161,25 +250,49 @@ function useSliderTrackState(props, ref) {
|
|
|
161
250
|
const updateFromPointer = useCallback(
|
|
162
251
|
(clientX, clientY, thumb) => {
|
|
163
252
|
const track = trackRef.current;
|
|
164
|
-
if (!track) return;
|
|
253
|
+
if (!track || disabled || readOnly) return;
|
|
254
|
+
let resolvedThumb = thumb;
|
|
255
|
+
if (range && rangeValue[0] === rangeValue[1]) {
|
|
256
|
+
const rect = track.getBoundingClientRect();
|
|
257
|
+
const { thumbSpanPx: thumbPx } = readSliderTrackMetrics(rect, orientation);
|
|
258
|
+
const raw = sliderPointerToValue(
|
|
259
|
+
clientX,
|
|
260
|
+
clientY,
|
|
261
|
+
rect,
|
|
262
|
+
orientation,
|
|
263
|
+
min,
|
|
264
|
+
max,
|
|
265
|
+
thumbPx > 0 ? thumbPx : fallbackThumbPx,
|
|
266
|
+
isRtlElement(track)
|
|
267
|
+
);
|
|
268
|
+
if (raw > rangeValue[1] && resolvedThumb === "start") {
|
|
269
|
+
resolvedThumb = "end";
|
|
270
|
+
draggingRef.current = "end";
|
|
271
|
+
setActiveThumb("end");
|
|
272
|
+
focusElement(thumbNodeFor("end"));
|
|
273
|
+
} else if (raw < rangeValue[0] && resolvedThumb === "end") {
|
|
274
|
+
resolvedThumb = "start";
|
|
275
|
+
draggingRef.current = "start";
|
|
276
|
+
setActiveThumb("start");
|
|
277
|
+
focusElement(thumbNodeFor("start"));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
165
280
|
applySliderPointer({
|
|
166
281
|
track,
|
|
167
282
|
clientX,
|
|
168
283
|
clientY,
|
|
169
|
-
thumb,
|
|
284
|
+
thumb: resolvedThumb,
|
|
170
285
|
disabled,
|
|
171
286
|
readOnly,
|
|
172
287
|
range,
|
|
173
288
|
rangeValue,
|
|
174
|
-
singleValue,
|
|
175
289
|
min,
|
|
176
290
|
max,
|
|
177
291
|
orientation,
|
|
178
292
|
fallbackThumbPx,
|
|
179
293
|
snap,
|
|
180
294
|
emitRange,
|
|
181
|
-
emitSingle
|
|
182
|
-
syncFill
|
|
295
|
+
emitSingle
|
|
183
296
|
});
|
|
184
297
|
},
|
|
185
298
|
[
|
|
@@ -195,7 +308,7 @@ function useSliderTrackState(props, ref) {
|
|
|
195
308
|
rangeValue,
|
|
196
309
|
singleValue,
|
|
197
310
|
snap,
|
|
198
|
-
|
|
311
|
+
thumbNodeFor
|
|
199
312
|
]
|
|
200
313
|
);
|
|
201
314
|
const pickRangeThumb = useCallback(
|
|
@@ -211,23 +324,43 @@ function useSliderTrackState(props, ref) {
|
|
|
211
324
|
orientation,
|
|
212
325
|
min,
|
|
213
326
|
max,
|
|
214
|
-
thumbPx > 0 ? thumbPx : fallbackThumbPx
|
|
327
|
+
thumbPx > 0 ? thumbPx : fallbackThumbPx,
|
|
328
|
+
isRtlElement(track)
|
|
215
329
|
);
|
|
216
330
|
const [lo, hi] = rangeValue;
|
|
331
|
+
if (lo === hi) {
|
|
332
|
+
if (raw > hi) return "end";
|
|
333
|
+
if (raw < lo) return "start";
|
|
334
|
+
return lo <= min ? "end" : "start";
|
|
335
|
+
}
|
|
217
336
|
return Math.abs(raw - lo) <= Math.abs(raw - hi) ? "start" : "end";
|
|
218
337
|
},
|
|
219
338
|
[fallbackThumbPx, max, min, orientation, rangeValue]
|
|
220
339
|
);
|
|
340
|
+
const updateFromPointerRef = useRef(updateFromPointer);
|
|
341
|
+
const commitValueRef = useRef(commitValue);
|
|
342
|
+
useLayoutEffect(() => {
|
|
343
|
+
updateFromPointerRef.current = updateFromPointer;
|
|
344
|
+
commitValueRef.current = commitValue;
|
|
345
|
+
}, [commitValue, updateFromPointer]);
|
|
221
346
|
useEffect(() => {
|
|
222
347
|
const onMove = (e) => {
|
|
223
348
|
const thumb = draggingRef.current;
|
|
224
349
|
if (!thumb) return;
|
|
225
|
-
|
|
350
|
+
if (activePointerIdRef.current !== null && e.pointerId !== activePointerIdRef.current) {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
updateFromPointerRef.current(e.clientX, e.clientY, thumb);
|
|
226
354
|
};
|
|
227
|
-
const onUp = () => {
|
|
228
|
-
if (draggingRef.current)
|
|
355
|
+
const onUp = (e) => {
|
|
356
|
+
if (!draggingRef.current) return;
|
|
357
|
+
if (activePointerIdRef.current !== null && e.pointerId !== activePointerIdRef.current) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
activePointerIdRef.current = null;
|
|
229
361
|
draggingRef.current = null;
|
|
230
362
|
setActiveThumb(null);
|
|
363
|
+
commitValueRef.current();
|
|
231
364
|
};
|
|
232
365
|
window.addEventListener("pointermove", onMove);
|
|
233
366
|
window.addEventListener("pointerup", onUp);
|
|
@@ -237,35 +370,51 @@ function useSliderTrackState(props, ref) {
|
|
|
237
370
|
window.removeEventListener("pointerup", onUp);
|
|
238
371
|
window.removeEventListener("pointercancel", onUp);
|
|
239
372
|
};
|
|
240
|
-
}, [
|
|
373
|
+
}, []);
|
|
241
374
|
const handleTrackPointerDown = useCallback(
|
|
242
375
|
(e) => {
|
|
243
376
|
onPointerDownProp?.(e);
|
|
244
377
|
if (e.defaultPrevented) return;
|
|
245
378
|
if (disabled || readOnly || e.button !== 0) return;
|
|
246
379
|
e.preventDefault();
|
|
380
|
+
if (trackRef.current) {
|
|
381
|
+
const rtl = isRtlElement(trackRef.current);
|
|
382
|
+
setIsRtl((prev) => prev === rtl ? prev : rtl);
|
|
383
|
+
}
|
|
247
384
|
const thumb = range ? pickRangeThumb(e.clientX, e.clientY) : "single";
|
|
385
|
+
activePointerIdRef.current = e.pointerId;
|
|
248
386
|
draggingRef.current = thumb;
|
|
249
387
|
setActiveThumb(thumb);
|
|
388
|
+
focusElement(thumbNodeFor(thumb));
|
|
250
389
|
updateFromPointer(e.clientX, e.clientY, thumb);
|
|
251
390
|
},
|
|
252
|
-
[disabled, onPointerDownProp, pickRangeThumb, range, readOnly, updateFromPointer]
|
|
391
|
+
[disabled, onPointerDownProp, pickRangeThumb, range, readOnly, thumbNodeFor, updateFromPointer]
|
|
253
392
|
);
|
|
254
393
|
const onThumbPointerDown = useCallback(
|
|
255
394
|
(thumb) => (e) => {
|
|
256
395
|
if (disabled || readOnly || e.button !== 0) return;
|
|
257
396
|
e.preventDefault();
|
|
258
397
|
e.stopPropagation();
|
|
398
|
+
if (trackRef.current) {
|
|
399
|
+
const rtl = isRtlElement(trackRef.current);
|
|
400
|
+
setIsRtl((prev) => prev === rtl ? prev : rtl);
|
|
401
|
+
}
|
|
402
|
+
activePointerIdRef.current = e.pointerId;
|
|
259
403
|
draggingRef.current = thumb;
|
|
260
404
|
setActiveThumb(thumb);
|
|
261
|
-
e.currentTarget
|
|
405
|
+
focusElement(e.currentTarget);
|
|
406
|
+
try {
|
|
407
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
408
|
+
} catch {
|
|
409
|
+
}
|
|
262
410
|
},
|
|
263
411
|
[disabled, readOnly]
|
|
264
412
|
);
|
|
265
413
|
const onThumbKeyDown = useCallback(
|
|
266
414
|
(thumb) => (e) => {
|
|
267
415
|
if (disabled || readOnly) return;
|
|
268
|
-
const
|
|
416
|
+
const rtl = isRtlElement(trackRef.current ?? e.currentTarget);
|
|
417
|
+
const action = sliderStepDelta(marks, step, e.key, orientation, rtl);
|
|
269
418
|
if (action === 0) return;
|
|
270
419
|
e.preventDefault();
|
|
271
420
|
applySliderThumbKey({
|
|
@@ -350,6 +499,10 @@ function useSliderTrackState(props, ref) {
|
|
|
350
499
|
const setTrackRef = useCallback(
|
|
351
500
|
(node) => {
|
|
352
501
|
trackRef.current = node;
|
|
502
|
+
if (node) {
|
|
503
|
+
const rtl = isRtlElement(node);
|
|
504
|
+
setIsRtl((prev) => prev === rtl ? prev : rtl);
|
|
505
|
+
}
|
|
353
506
|
if (typeof ref === "function") ref(node);
|
|
354
507
|
else if (ref) ref.current = node;
|
|
355
508
|
},
|
|
@@ -365,6 +518,8 @@ function useSliderTrackState(props, ref) {
|
|
|
365
518
|
size,
|
|
366
519
|
orientation,
|
|
367
520
|
disabled,
|
|
521
|
+
readOnly,
|
|
522
|
+
isRtl,
|
|
368
523
|
icon,
|
|
369
524
|
range,
|
|
370
525
|
variant,
|
|
@@ -375,6 +530,7 @@ function useSliderTrackState(props, ref) {
|
|
|
375
530
|
max,
|
|
376
531
|
formatValue,
|
|
377
532
|
thumbPercent,
|
|
533
|
+
getThumbRef,
|
|
378
534
|
resolveThumbIcon,
|
|
379
535
|
resolveThumbA11y,
|
|
380
536
|
onThumbPointerDown,
|
|
@@ -383,6 +539,8 @@ function useSliderTrackState(props, ref) {
|
|
|
383
539
|
[
|
|
384
540
|
activeThumb,
|
|
385
541
|
disabled,
|
|
542
|
+
readOnly,
|
|
543
|
+
isRtl,
|
|
386
544
|
fillClassResolved,
|
|
387
545
|
formatValue,
|
|
388
546
|
variant,
|
|
@@ -396,6 +554,7 @@ function useSliderTrackState(props, ref) {
|
|
|
396
554
|
railClass,
|
|
397
555
|
range,
|
|
398
556
|
rangeValue,
|
|
557
|
+
getThumbRef,
|
|
399
558
|
resolveThumbA11y,
|
|
400
559
|
resolveThumbIcon,
|
|
401
560
|
singleValue,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useMemo } from "react";
|
|
4
|
+
import { useSkinVariant } from "../../../skins/skinContext.js";
|
|
4
5
|
import { resolveStackMotionDefaults, useStackRootMotion } from "./stackAnimations.js";
|
|
5
6
|
import { StackMotionProvider } from "./stackContext.js";
|
|
6
7
|
import { stackRootClass } from "./stackStyles.js";
|
|
@@ -74,6 +75,7 @@ function StackSurface({
|
|
|
74
75
|
onPointerUp,
|
|
75
76
|
rest
|
|
76
77
|
}) {
|
|
78
|
+
const skinVariant = useSkinVariant(void 0);
|
|
77
79
|
const part = useStackRootMotion({
|
|
78
80
|
forwardedRef,
|
|
79
81
|
motion: rootMotion,
|
|
@@ -92,6 +94,7 @@ function StackSurface({
|
|
|
92
94
|
align,
|
|
93
95
|
justify,
|
|
94
96
|
wrap,
|
|
97
|
+
skinVariant,
|
|
95
98
|
slotClass: classNames?.root,
|
|
96
99
|
className
|
|
97
100
|
}),
|
|
@@ -28,12 +28,13 @@ export declare const STACK_JUSTIFY_CLASS: {
|
|
|
28
28
|
readonly end: "justify-end";
|
|
29
29
|
readonly between: "justify-between";
|
|
30
30
|
};
|
|
31
|
-
export declare function stackRootClass({ orientation, gap, align, justify, wrap, slotClass, className, }: {
|
|
31
|
+
export declare function stackRootClass({ orientation, gap, align, justify, wrap, skinVariant, slotClass, className, }: {
|
|
32
32
|
orientation: StackOrientation;
|
|
33
33
|
gap: StackGap;
|
|
34
34
|
align: StackAlign;
|
|
35
35
|
justify: StackJustify;
|
|
36
36
|
wrap: boolean;
|
|
37
|
+
skinVariant?: string;
|
|
37
38
|
slotClass?: string;
|
|
38
39
|
className?: string;
|
|
39
40
|
}): string;
|
|
@@ -35,6 +35,7 @@ function stackRootClass({
|
|
|
35
35
|
align,
|
|
36
36
|
justify,
|
|
37
37
|
wrap,
|
|
38
|
+
skinVariant,
|
|
38
39
|
slotClass,
|
|
39
40
|
className
|
|
40
41
|
}) {
|
|
@@ -45,7 +46,7 @@ function stackRootClass({
|
|
|
45
46
|
STACK_ALIGN_CLASS[align],
|
|
46
47
|
STACK_JUSTIFY_CLASS[justify],
|
|
47
48
|
wrap && STACK_WRAP_CLASS,
|
|
48
|
-
layoutTargetClass("stack.root"),
|
|
49
|
+
layoutTargetClass("stack.root", skinVariant),
|
|
49
50
|
slotClass,
|
|
50
51
|
className
|
|
51
52
|
);
|