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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ListBoxContextValue, UseListBoxRootStateProps } from './listBoxTypes.js';
|
|
2
|
-
export declare function useListBoxRootState({ size, selectionMode, value: valueProp, defaultValue, onValueChange, values: valuesProp, defaultValues, onValuesChange, disabled, activeValue: activeValueProp, onActiveValueChange, listId: listIdProp, }: UseListBoxRootStateProps): {
|
|
2
|
+
export declare function useListBoxRootState({ size, selectionMode, value: valueProp, defaultValue, onValueChange, values: valuesProp, defaultValues, onValuesChange, disallowEmptySelection, disabled, activeValue: activeValueProp, onActiveValueChange, listId: listIdProp, }: UseListBoxRootStateProps): {
|
|
3
3
|
listId: string;
|
|
4
4
|
contextValue: ListBoxContextValue;
|
|
5
5
|
activeValue: string | null;
|
|
@@ -11,6 +11,7 @@ function useListBoxRootState({
|
|
|
11
11
|
values: valuesProp,
|
|
12
12
|
defaultValues,
|
|
13
13
|
onValuesChange,
|
|
14
|
+
disallowEmptySelection,
|
|
14
15
|
disabled = false,
|
|
15
16
|
activeValue: activeValueProp,
|
|
16
17
|
onActiveValueChange,
|
|
@@ -31,9 +32,12 @@ function useListBoxRootState({
|
|
|
31
32
|
latestSelectedRef.current = selectedArr;
|
|
32
33
|
const [internalActive, setInternalActive] = useState(null);
|
|
33
34
|
const isControlledActive = activeValueProp !== void 0;
|
|
35
|
+
const standaloneKeyboard = !isControlledActive;
|
|
34
36
|
const activeValue = isControlledActive ? activeValueProp : internalActive;
|
|
37
|
+
const activeChangeSourceRef = useRef("keyboard");
|
|
35
38
|
const setActiveValue = useCallback(
|
|
36
|
-
(next) => {
|
|
39
|
+
(next, source = "keyboard") => {
|
|
40
|
+
activeChangeSourceRef.current = source;
|
|
37
41
|
if (!isControlledActive) setInternalActive(next);
|
|
38
42
|
onActiveValueChange?.(next);
|
|
39
43
|
},
|
|
@@ -47,17 +51,37 @@ function useListBoxRootState({
|
|
|
47
51
|
},
|
|
48
52
|
[isControlledValue, multiple, onValueChange, onValuesChange]
|
|
49
53
|
);
|
|
54
|
+
const preventEmptySingle = disallowEmptySelection ?? !standaloneKeyboard;
|
|
50
55
|
const selectItem = useCallback(
|
|
51
56
|
(itemValue) => {
|
|
57
|
+
if (multiple) {
|
|
58
|
+
const next2 = toggleOptionListSelection(
|
|
59
|
+
latestSelectedRef.current,
|
|
60
|
+
itemValue,
|
|
61
|
+
true
|
|
62
|
+
);
|
|
63
|
+
if (disallowEmptySelection && next2.length === 0) return;
|
|
64
|
+
latestSelectedRef.current = next2;
|
|
65
|
+
setSelectedArr(next2);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (preventEmptySingle && latestSelectedRef.current.includes(itemValue)) {
|
|
69
|
+
const next2 = [itemValue];
|
|
70
|
+
latestSelectedRef.current = next2;
|
|
71
|
+
if (!standaloneKeyboard) {
|
|
72
|
+
setSelectedArr(next2);
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
52
76
|
const next = toggleOptionListSelection(
|
|
53
77
|
latestSelectedRef.current,
|
|
54
78
|
itemValue,
|
|
55
|
-
|
|
79
|
+
false
|
|
56
80
|
);
|
|
57
81
|
latestSelectedRef.current = next;
|
|
58
82
|
setSelectedArr(next);
|
|
59
83
|
},
|
|
60
|
-
[multiple, setSelectedArr]
|
|
84
|
+
[disallowEmptySelection, multiple, preventEmptySingle, setSelectedArr, standaloneKeyboard]
|
|
61
85
|
);
|
|
62
86
|
const contextValue = useMemo(
|
|
63
87
|
() => ({
|
|
@@ -67,19 +91,20 @@ function useListBoxRootState({
|
|
|
67
91
|
selected,
|
|
68
92
|
selectItem,
|
|
69
93
|
setActiveValue,
|
|
94
|
+
activeChangeSourceRef,
|
|
70
95
|
indicatorMode: multiple ? "multi" : "radio",
|
|
71
96
|
disabled,
|
|
72
|
-
standaloneKeyboard
|
|
97
|
+
standaloneKeyboard
|
|
73
98
|
}),
|
|
74
99
|
[
|
|
75
100
|
disabled,
|
|
76
|
-
isControlledActive,
|
|
77
101
|
listId,
|
|
78
102
|
multiple,
|
|
79
103
|
selectItem,
|
|
80
104
|
selected,
|
|
81
105
|
setActiveValue,
|
|
82
|
-
size
|
|
106
|
+
size,
|
|
107
|
+
standaloneKeyboard
|
|
83
108
|
]
|
|
84
109
|
);
|
|
85
110
|
return { listId, contextValue, activeValue };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo, useState, useLayoutEffect, Children } from "react";
|
|
3
|
+
import { useMemo, useRef, useState, useLayoutEffect, Children } from "react";
|
|
4
4
|
import { useVirtualWindow } from "../utils/useVirtualWindow.js";
|
|
5
5
|
import { collectListBoxVirtualOptions } from "./listBoxAPI.js";
|
|
6
|
-
import { useListBoxActiveValue } from "./listBoxContext.js";
|
|
6
|
+
import { useListBoxActiveValue, useListBox } from "./listBoxContext.js";
|
|
7
7
|
import { LISTBOX_VIRTUAL_FRAME_CLASS, LISTBOX_VIRTUAL_WINDOW_CLASS } from "./listBoxStyles.js";
|
|
8
8
|
const LISTBOX_ITEM_SIZE_FALLBACK = {
|
|
9
9
|
small: 28,
|
|
@@ -18,12 +18,18 @@ function useListBoxVirtualWindow({
|
|
|
18
18
|
children
|
|
19
19
|
}) {
|
|
20
20
|
const activeValue = useListBoxActiveValue();
|
|
21
|
+
const { activeChangeSourceRef } = useListBox("ListBox");
|
|
21
22
|
const catalog = useMemo(
|
|
22
23
|
() => enabled ? collectListBoxVirtualOptions(children) : null,
|
|
23
24
|
[children, enabled]
|
|
24
25
|
);
|
|
25
26
|
const active = enabled && catalog != null;
|
|
26
|
-
const
|
|
27
|
+
const lastPinnedIndexRef = useRef(-1);
|
|
28
|
+
const rawPinIndex = active && activeValue ? catalog.findIndex((option) => option.value === activeValue) : -1;
|
|
29
|
+
if (activeChangeSourceRef.current !== "pointer") {
|
|
30
|
+
lastPinnedIndexRef.current = rawPinIndex;
|
|
31
|
+
}
|
|
32
|
+
const pinIndex = active ? lastPinnedIndexRef.current : -1;
|
|
27
33
|
const [measured, setMeasured] = useState(null);
|
|
28
34
|
const itemSize = itemSizeProp ?? measured ?? LISTBOX_ITEM_SIZE_FALLBACK[size];
|
|
29
35
|
const virtual = useVirtualWindow({
|
|
@@ -51,7 +57,8 @@ function useListBoxVirtualWindow({
|
|
|
51
57
|
}
|
|
52
58
|
) });
|
|
53
59
|
}, [active, catalog, children, virtual.range.end, virtual.range.offset, virtual.range.start, virtual.range.total]);
|
|
54
|
-
|
|
60
|
+
const rangeKey = active ? `${virtual.range.start}:${virtual.range.end}` : "";
|
|
61
|
+
return { frame, catalog: active ? catalog : null, setScrollNode: virtual.setScrollNode, rangeKey };
|
|
55
62
|
}
|
|
56
63
|
export {
|
|
57
64
|
useListBoxVirtualWindow
|
|
@@ -109,7 +109,7 @@ function LoadingSurface({
|
|
|
109
109
|
className: cn(LOADING_ROOT_CLASS, classNames?.root, className),
|
|
110
110
|
...rest,
|
|
111
111
|
...part.pointerHandlers,
|
|
112
|
-
...dataVariantProps({ size }),
|
|
112
|
+
...dataVariantProps({ size, status }),
|
|
113
113
|
children: indicator === "dots" ? /* @__PURE__ */ jsx(
|
|
114
114
|
LoadingDots,
|
|
115
115
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { MotionScopeValue } from '../utils/slotMotion/index.js';
|
|
2
|
-
import { LoadingMotion } from './loadingTypes.js';
|
|
3
|
-
export declare function useLoadingDotsAnimation(scope: MotionScopeValue | null): void;
|
|
2
|
+
import { LoadingMotion, LoadingSize } from './loadingTypes.js';
|
|
3
|
+
export declare function useLoadingDotsAnimation(scope: MotionScopeValue | null, size?: LoadingSize): void;
|
|
4
4
|
export declare function resolveLoadingMotionDefaults(): LoadingMotion;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useLayoutEffect } from "react";
|
|
3
|
+
import { killMotion } from "../utils/gsapMotion.js";
|
|
3
4
|
import { usePrefersReducedMotion } from "../utils/reducedMotion.js";
|
|
4
5
|
import { useMotionConfig } from "../utils/motionConfigContext.js";
|
|
5
6
|
import { applyLoadingDotInstant } from "../utils/slotMotion/recipes/loadingDots.js";
|
|
6
7
|
import { bindLoadingRecipe } from "../utils/slotMotion/recipes/bindLoading.js";
|
|
7
8
|
bindLoadingRecipe();
|
|
8
|
-
function useLoadingDotsAnimation(scope) {
|
|
9
|
+
function useLoadingDotsAnimation(scope, size) {
|
|
9
10
|
const config = useMotionConfig();
|
|
10
11
|
const reduceMotion = usePrefersReducedMotion();
|
|
11
12
|
useLayoutEffect(() => {
|
|
@@ -17,10 +18,16 @@ function useLoadingDotsAnimation(scope) {
|
|
|
17
18
|
for (const dot of dots) applyLoadingDotInstant(dot);
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const runs = dots.map((dot) => scope.play("dot", "enter", { el: dot }));
|
|
22
|
+
return () => {
|
|
23
|
+
for (const run of runs) {
|
|
24
|
+
run.cancel("unmount");
|
|
25
|
+
}
|
|
26
|
+
for (const dot of dots) {
|
|
27
|
+
killMotion(dot);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}, [config, reduceMotion, scope, size]);
|
|
24
31
|
}
|
|
25
32
|
function resolveLoadingMotionDefaults() {
|
|
26
33
|
return { dot: { enter: "loadingDots" } };
|
|
@@ -54,6 +54,17 @@ const MeterRoot = forwardRef(function MeterRoot2({
|
|
|
54
54
|
status,
|
|
55
55
|
formatValue
|
|
56
56
|
});
|
|
57
|
+
const {
|
|
58
|
+
"aria-label": ariaLabel,
|
|
59
|
+
"aria-labelledby": ariaLabelledBy,
|
|
60
|
+
"aria-describedby": ariaDescribedBy,
|
|
61
|
+
...rootDivRest
|
|
62
|
+
} = divRest;
|
|
63
|
+
const simpleAriaProps = {
|
|
64
|
+
...ariaLabel !== void 0 ? { "aria-label": ariaLabel } : void 0,
|
|
65
|
+
...ariaLabelledBy !== void 0 ? { "aria-labelledby": ariaLabelledBy } : void 0,
|
|
66
|
+
...ariaDescribedBy !== void 0 ? { "aria-describedby": ariaDescribedBy } : void 0
|
|
67
|
+
};
|
|
57
68
|
const body = state.isCompound ? children : /* @__PURE__ */ jsx(
|
|
58
69
|
MeterSimpleBody,
|
|
59
70
|
{
|
|
@@ -62,7 +73,14 @@ const MeterRoot = forwardRef(function MeterRoot2({
|
|
|
62
73
|
valueText: state.valueText,
|
|
63
74
|
hint: state.hint,
|
|
64
75
|
error: state.error,
|
|
65
|
-
trackProps: {
|
|
76
|
+
trackProps: {
|
|
77
|
+
...state.trackProps,
|
|
78
|
+
...simpleAriaProps,
|
|
79
|
+
motionController,
|
|
80
|
+
motionState,
|
|
81
|
+
motionPayload,
|
|
82
|
+
playInitialState
|
|
83
|
+
}
|
|
66
84
|
}
|
|
67
85
|
);
|
|
68
86
|
return /* @__PURE__ */ jsx(MeterFieldProvider, { value: state.fieldCtx, children: /* @__PURE__ */ jsx(MeterClassNamesProvider, { classNames, children: /* @__PURE__ */ jsx(
|
|
@@ -82,9 +100,9 @@ const MeterRoot = forwardRef(function MeterRoot2({
|
|
|
82
100
|
slotClass: classNames?.root,
|
|
83
101
|
className
|
|
84
102
|
}),
|
|
85
|
-
...divRest,
|
|
103
|
+
...state.isCompound ? divRest : rootDivRest,
|
|
86
104
|
ref,
|
|
87
|
-
...dataVariantProps({ size: size ?? "base" }),
|
|
105
|
+
...dataVariantProps({ size: size ?? "base", status }),
|
|
88
106
|
children: body
|
|
89
107
|
}
|
|
90
108
|
) })
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { MeterDisplayState } from './meterTypes.js';
|
|
2
|
+
export declare function resolveMeterBounds(min: number, max: number): {
|
|
3
|
+
safeMin: number;
|
|
4
|
+
safeMax: number;
|
|
5
|
+
};
|
|
2
6
|
export declare function meterValueToPercent(value: number, min: number, max: number): number;
|
|
3
7
|
export declare function defaultMeterFormatValue(value: number): string;
|
|
4
8
|
export declare function meterDisplayEqual(a: MeterDisplayState | null, b: MeterDisplayState | null): boolean;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { formatLocaleNumber } from "../utils/intlFormat.js";
|
|
2
|
+
function resolveMeterBounds(min, max) {
|
|
3
|
+
const safeMin = Number.isFinite(min) ? min : 0;
|
|
4
|
+
const safeMax = Number.isFinite(max) ? max >= safeMin ? max : safeMin : Math.max(safeMin, 100);
|
|
5
|
+
return { safeMin, safeMax };
|
|
6
|
+
}
|
|
2
7
|
function meterValueToPercent(value, min, max) {
|
|
8
|
+
if (!Number.isFinite(value) || !Number.isFinite(min) || !Number.isFinite(max)) {
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
3
11
|
if (max <= min) return 0;
|
|
4
|
-
|
|
12
|
+
const raw = (value - min) / (max - min) * 100;
|
|
13
|
+
if (!Number.isFinite(raw)) return 0;
|
|
14
|
+
return Math.min(100, Math.max(0, raw));
|
|
5
15
|
}
|
|
6
16
|
function defaultMeterFormatValue(value) {
|
|
7
17
|
return formatLocaleNumber(value);
|
|
@@ -14,5 +24,6 @@ function meterDisplayEqual(a, b) {
|
|
|
14
24
|
export {
|
|
15
25
|
defaultMeterFormatValue,
|
|
16
26
|
meterDisplayEqual,
|
|
17
|
-
meterValueToPercent
|
|
27
|
+
meterValueToPercent,
|
|
28
|
+
resolveMeterBounds
|
|
18
29
|
};
|
|
@@ -3,6 +3,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
import { forwardRef, useMemo } from "react";
|
|
4
4
|
import { Field } from "../Field/index.js";
|
|
5
5
|
import { Label as LabelCompound } from "../Label/index.js";
|
|
6
|
+
import { dataVariantProps } from "../utils/dataContract.js";
|
|
6
7
|
import { resolveMeterMotionDefaults, useMeterChromeSlot, useMeterFillMotion, useMeterTrackSlotMotion } from "./meterAnimations.js";
|
|
7
8
|
import { useOptionalMeterMotionScope, MeterMotionProvider, useMeterFieldContext, useMeterClassNames } from "./meterContext.js";
|
|
8
9
|
import { meterValueClass, meterHeaderClass, meterDeterminateFillStyle, meterFillClass, meterTrackClass } from "./meterStyles.js";
|
|
@@ -205,6 +206,7 @@ const MeterTrack = forwardRef(
|
|
|
205
206
|
size,
|
|
206
207
|
thickness,
|
|
207
208
|
color,
|
|
209
|
+
status,
|
|
208
210
|
formatValue,
|
|
209
211
|
orientation,
|
|
210
212
|
className,
|
|
@@ -233,6 +235,7 @@ const MeterTrack = forwardRef(
|
|
|
233
235
|
size,
|
|
234
236
|
thickness,
|
|
235
237
|
color,
|
|
238
|
+
status,
|
|
236
239
|
formatValue,
|
|
237
240
|
orientation,
|
|
238
241
|
"aria-describedby": ariaDescribedByProp
|
|
@@ -271,7 +274,7 @@ const MeterTrack = forwardRef(
|
|
|
271
274
|
}
|
|
272
275
|
);
|
|
273
276
|
MeterTrack.displayName = "Meter.Track";
|
|
274
|
-
const MeterTrackHost = forwardRef(function MeterTrackHost2({ className, state, ...rest }, ref) {
|
|
277
|
+
const MeterTrackHost = forwardRef(function MeterTrackHost2({ className, style, state, ...rest }, ref) {
|
|
275
278
|
const slotClassNames = useMeterClassNames();
|
|
276
279
|
const {
|
|
277
280
|
size: resolvedSize,
|
|
@@ -322,8 +325,9 @@ const MeterTrackHost = forwardRef(function MeterTrackHost2({ className, state, .
|
|
|
322
325
|
slotClass: slotClassNames.track,
|
|
323
326
|
className
|
|
324
327
|
}),
|
|
325
|
-
style: trackCrossStyle,
|
|
328
|
+
style: trackCrossStyle || style ? { ...trackCrossStyle, ...style } : void 0,
|
|
326
329
|
...rest,
|
|
330
|
+
...dataVariantProps({ status }),
|
|
327
331
|
children: /* @__PURE__ */ jsx(
|
|
328
332
|
"span",
|
|
329
333
|
{
|
|
@@ -13,7 +13,7 @@ export declare const METER_FILL_DEFAULT_COLOR_CLASS = "bg-primary";
|
|
|
13
13
|
export declare const METER_HEADER_BASE_CLASS = "flex items-baseline justify-between gap-xsmall";
|
|
14
14
|
export declare const METER_HEADER_HORIZONTAL_CLASS = "w-full";
|
|
15
15
|
export declare const METER_HEADER_VERTICAL_CLASS = "min-w-[8rem]";
|
|
16
|
-
export declare const METER_VALUE_CLASS = "tabular-nums text-muted";
|
|
16
|
+
export declare const METER_VALUE_CLASS = "tabular-nums text-muted-foreground";
|
|
17
17
|
export declare function meterRootClass({ orientation, slotClass, className, }: {
|
|
18
18
|
orientation: MeterOrientation;
|
|
19
19
|
slotClass?: string;
|
|
@@ -24,7 +24,7 @@ const METER_FILL_DEFAULT_COLOR_CLASS = "bg-primary";
|
|
|
24
24
|
const METER_HEADER_BASE_CLASS = "flex items-baseline justify-between gap-xsmall";
|
|
25
25
|
const METER_HEADER_HORIZONTAL_CLASS = "w-full";
|
|
26
26
|
const METER_HEADER_VERTICAL_CLASS = "min-w-[8rem]";
|
|
27
|
-
const METER_VALUE_CLASS = "tabular-nums text-muted";
|
|
27
|
+
const METER_VALUE_CLASS = "tabular-nums text-muted-foreground";
|
|
28
28
|
function meterRootClass({
|
|
29
29
|
orientation,
|
|
30
30
|
slotClass,
|
|
@@ -36,7 +36,7 @@ function useMeterRootState({
|
|
|
36
36
|
const compound = hasCompoundChildren(children);
|
|
37
37
|
return {
|
|
38
38
|
isCompound: compound,
|
|
39
|
-
hasLabel: label != null || compound && hasCompoundChild(children, "Label"),
|
|
39
|
+
hasLabel: label != null || compound && hasCompoundChild(children, "MeterLabel", "Label"),
|
|
40
40
|
hasHint: hint != null || compound && hasCompoundChild(children, "Meter.Hint"),
|
|
41
41
|
hasError: error != null || compound && hasCompoundChild(children, "Meter.Error")
|
|
42
42
|
};
|
|
@@ -50,10 +50,11 @@ function useMeterRootState({
|
|
|
50
50
|
errorConnected: hasError,
|
|
51
51
|
labelConnected: hasLabel,
|
|
52
52
|
orientation,
|
|
53
|
+
status,
|
|
53
54
|
display,
|
|
54
55
|
setDisplay
|
|
55
56
|
}),
|
|
56
|
-
[display, errorId, hasError, hasHint, hasLabel, hintId, meterId, orientation, setDisplay]
|
|
57
|
+
[display, errorId, hasError, hasHint, hasLabel, hintId, meterId, orientation, setDisplay, status]
|
|
57
58
|
);
|
|
58
59
|
const fieldLabelCtx = useMemo(() => ({ labelId }), [labelId]);
|
|
59
60
|
const trackProps = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseMeterTrackStateProps } from './meterTypes.js';
|
|
2
|
-
export declare function useMeterTrackState({ value, min, max, size, thickness, color, status, formatValue, orientation: orientationProp, "aria-describedby": ariaDescribedByProp, }: UseMeterTrackStateProps): {
|
|
2
|
+
export declare function useMeterTrackState({ value, min, max, size, thickness, color, status: statusProp, formatValue, orientation: orientationProp, "aria-describedby": ariaDescribedByProp, }: UseMeterTrackStateProps): {
|
|
3
3
|
size: import('../utils/sizeLayout/index.js').ComponentSize;
|
|
4
4
|
thickness: string | number | undefined;
|
|
5
5
|
color: string | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useMemo, useLayoutEffect } from "react";
|
|
3
3
|
import { clampNumber } from "../utils/clampNumber.js";
|
|
4
|
-
import { meterValueToPercent, defaultMeterFormatValue } from "./meterAPI.js";
|
|
4
|
+
import { resolveMeterBounds, meterValueToPercent, defaultMeterFormatValue } from "./meterAPI.js";
|
|
5
5
|
import { resolveMeterDescribedBy, resolveMeterTrackAria, meterLabelId } from "./meterA11y.js";
|
|
6
6
|
import { useOptionalMeterFieldContext } from "./meterContext.js";
|
|
7
7
|
import { meterTrackCrossStyle, meterFillColorStyle } from "./meterStyles.js";
|
|
@@ -12,25 +12,30 @@ function useMeterTrackState({
|
|
|
12
12
|
size = "base",
|
|
13
13
|
thickness,
|
|
14
14
|
color,
|
|
15
|
-
status,
|
|
15
|
+
status: statusProp,
|
|
16
16
|
formatValue = defaultMeterFormatValue,
|
|
17
17
|
orientation: orientationProp,
|
|
18
18
|
"aria-describedby": ariaDescribedByProp
|
|
19
19
|
}) {
|
|
20
20
|
const fieldCtx = useOptionalMeterFieldContext();
|
|
21
21
|
const orientation = orientationProp ?? fieldCtx?.orientation ?? "horizontal";
|
|
22
|
+
const status = statusProp ?? fieldCtx?.status;
|
|
22
23
|
const meterId = fieldCtx?.meterId;
|
|
23
24
|
const labelId = meterId != null ? meterLabelId(meterId) : void 0;
|
|
24
25
|
const labelConnected = fieldCtx?.labelConnected ?? false;
|
|
25
26
|
const hintConnected = fieldCtx?.hintConnected ?? false;
|
|
26
27
|
const errorConnected = fieldCtx?.errorConnected ?? false;
|
|
28
|
+
const { safeMin, safeMax } = useMemo(
|
|
29
|
+
() => resolveMeterBounds(min, max),
|
|
30
|
+
[max, min]
|
|
31
|
+
);
|
|
27
32
|
const clampedValue = useMemo(
|
|
28
|
-
() => clampNumber(value,
|
|
29
|
-
[
|
|
33
|
+
() => value === Number.POSITIVE_INFINITY ? safeMax : clampNumber(value, safeMin, safeMax),
|
|
34
|
+
[safeMax, safeMin, value]
|
|
30
35
|
);
|
|
31
36
|
const percent = useMemo(
|
|
32
|
-
() => meterValueToPercent(clampedValue,
|
|
33
|
-
[clampedValue,
|
|
37
|
+
() => meterValueToPercent(clampedValue, safeMin, safeMax),
|
|
38
|
+
[clampedValue, safeMax, safeMin]
|
|
34
39
|
);
|
|
35
40
|
const isHorizontal = orientation === "horizontal";
|
|
36
41
|
const statusText = useMemo(
|
|
@@ -46,8 +51,8 @@ function useMeterTrackState({
|
|
|
46
51
|
});
|
|
47
52
|
const aria = resolveMeterTrackAria({
|
|
48
53
|
clampedValue,
|
|
49
|
-
min,
|
|
50
|
-
max,
|
|
54
|
+
min: safeMin,
|
|
55
|
+
max: safeMax,
|
|
51
56
|
statusText,
|
|
52
57
|
labelConnected,
|
|
53
58
|
labelId,
|
|
@@ -60,8 +65,8 @@ function useMeterTrackState({
|
|
|
60
65
|
const fillColorStyle = useMemo(() => meterFillColorStyle(color), [color]);
|
|
61
66
|
const setDisplay = fieldCtx?.setDisplay;
|
|
62
67
|
useLayoutEffect(() => {
|
|
63
|
-
setDisplay?.({ clampedValue, statusText, min, max });
|
|
64
|
-
}, [clampedValue,
|
|
68
|
+
setDisplay?.({ clampedValue, statusText, min: safeMin, max: safeMax });
|
|
69
|
+
}, [clampedValue, safeMax, safeMin, setDisplay, statusText]);
|
|
65
70
|
return {
|
|
66
71
|
size,
|
|
67
72
|
thickness,
|
|
@@ -88,6 +88,17 @@ const NumberInputRoot = forwardRef(function NumberInputRoot2({
|
|
|
88
88
|
}),
|
|
89
89
|
[resolvedVariant, state.contextValue.disabled, state.contextValue.pointerInsideRef]
|
|
90
90
|
);
|
|
91
|
+
const {
|
|
92
|
+
"aria-label": ariaLabel,
|
|
93
|
+
"aria-labelledby": ariaLabelledBy,
|
|
94
|
+
"aria-describedby": ariaDescribedBy,
|
|
95
|
+
...rootRest
|
|
96
|
+
} = rest;
|
|
97
|
+
const simpleAriaProps = {
|
|
98
|
+
...ariaLabel !== void 0 ? { "aria-label": ariaLabel } : void 0,
|
|
99
|
+
...ariaLabelledBy !== void 0 ? { "aria-labelledby": ariaLabelledBy } : void 0,
|
|
100
|
+
...ariaDescribedBy !== void 0 ? { "aria-describedby": ariaDescribedBy } : void 0
|
|
101
|
+
};
|
|
91
102
|
return /* @__PURE__ */ jsx(NumberInputProvider, { value: state.contextValue, children: /* @__PURE__ */ jsx(NumberInputClassNamesProvider, { classNames, children: /* @__PURE__ */ jsx(
|
|
92
103
|
NumberInputMotionProvider,
|
|
93
104
|
{
|
|
@@ -103,7 +114,7 @@ const NumberInputRoot = forwardRef(function NumberInputRoot2({
|
|
|
103
114
|
{
|
|
104
115
|
size,
|
|
105
116
|
className: cn(NUMBER_INPUT_ROOT_CLASS, classNames?.root, className),
|
|
106
|
-
...rest,
|
|
117
|
+
...state.isCompound ? rest : rootRest,
|
|
107
118
|
ref: mergeRefs(ref, focusRef),
|
|
108
119
|
...dataVariantProps({
|
|
109
120
|
size,
|
|
@@ -113,7 +124,7 @@ const NumberInputRoot = forwardRef(function NumberInputRoot2({
|
|
|
113
124
|
"data-disabled": dataFlag(state.contextValue.disabled),
|
|
114
125
|
"data-readonly": dataFlag(state.contextValue.readOnly),
|
|
115
126
|
"data-required": dataFlag(state.contextValue.required),
|
|
116
|
-
children: state.isCompound ? /* @__PURE__ */ jsx(NumberInputCompoundBody, { children }) : /* @__PURE__ */ jsx(NumberInputSimpleBody, {})
|
|
127
|
+
children: state.isCompound ? /* @__PURE__ */ jsx(NumberInputCompoundBody, { children }) : /* @__PURE__ */ jsx(NumberInputSimpleBody, { controlProps: simpleAriaProps })
|
|
117
128
|
}
|
|
118
129
|
) })
|
|
119
130
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { NumberInputControlProps } from './numberInputTypes.js';
|
|
2
3
|
export declare function NumberInputCompoundBody({ children }: {
|
|
3
4
|
children?: ReactNode;
|
|
4
5
|
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
@@ -23,4 +24,6 @@ export declare const NumberInputError: import('react').ForwardRefExoticComponent
|
|
|
23
24
|
children?: ReactNode;
|
|
24
25
|
motion?: import('../../../index.js').Prettify<import('./numberInputTypes.js').NumberInputPartMotion>;
|
|
25
26
|
} & import('react').RefAttributes<HTMLElement>>;
|
|
26
|
-
export declare function NumberInputSimpleBody(
|
|
27
|
+
export declare function NumberInputSimpleBody({ controlProps, }?: {
|
|
28
|
+
controlProps?: Pick<NumberInputControlProps, "aria-label" | "aria-labelledby" | "aria-describedby">;
|
|
29
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, Children } from "react";
|
|
4
4
|
import { Field } from "../Field/index.js";
|
|
5
|
+
import { joinFieldDescribedBy } from "../Field/fieldA11y.js";
|
|
5
6
|
import { dataFlag } from "../utils/dataContract.js";
|
|
7
|
+
import { isImeComposingEvent, isInteractiveDescendantTarget } from "../utils/fieldFormDom.js";
|
|
6
8
|
import { dataInvalidValue, ariaInvalidValue, fieldPaintStatus } from "../utils/fieldInvalid.js";
|
|
7
9
|
import { KitAdd, KitRemove } from "../utils/kitIcons.js";
|
|
8
10
|
import { cn } from "../../../utils/cn.js";
|
|
@@ -15,10 +17,29 @@ function NumberInputShell({ children }) {
|
|
|
15
17
|
const field = useNumberInputContext();
|
|
16
18
|
const slotClassNames = useNumberInputClassNames();
|
|
17
19
|
const shell = useNumberInputShellMotion();
|
|
20
|
+
const handleMouseDown = (event) => {
|
|
21
|
+
if (field.disabled) return;
|
|
22
|
+
const inputEl = field.inputRef.current;
|
|
23
|
+
if (!inputEl) return;
|
|
24
|
+
if (!isInteractiveDescendantTarget(event.target, inputEl) && document.activeElement === inputEl) {
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const handleClick = (event) => {
|
|
29
|
+
if (field.disabled) return;
|
|
30
|
+
const inputEl = field.inputRef.current;
|
|
31
|
+
if (!inputEl) return;
|
|
32
|
+
if (!isInteractiveDescendantTarget(event.target, inputEl) && document.activeElement !== inputEl) {
|
|
33
|
+
inputEl.focus();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
18
36
|
return /* @__PURE__ */ jsx(
|
|
19
37
|
"div",
|
|
20
38
|
{
|
|
21
39
|
ref: shell.setRef,
|
|
40
|
+
role: "presentation",
|
|
41
|
+
onMouseDown: handleMouseDown,
|
|
42
|
+
onClick: handleClick,
|
|
22
43
|
className: numberInputShellClass({
|
|
23
44
|
size: field.size,
|
|
24
45
|
variant: field.variant,
|
|
@@ -91,6 +112,7 @@ const NumberInputControl = forwardRef(
|
|
|
91
112
|
onPointerOut,
|
|
92
113
|
onPointerDown,
|
|
93
114
|
onPointerUp,
|
|
115
|
+
"aria-describedby": ariaDescribedByProp,
|
|
94
116
|
...rest
|
|
95
117
|
}, ref) {
|
|
96
118
|
const field = useNumberInputContext();
|
|
@@ -109,7 +131,9 @@ const NumberInputControl = forwardRef(
|
|
|
109
131
|
};
|
|
110
132
|
const handleKeyDown = (event) => {
|
|
111
133
|
onKeyDown?.(event);
|
|
112
|
-
if (event.defaultPrevented || field.disabled || field.readOnly)
|
|
134
|
+
if (event.defaultPrevented || isImeComposingEvent(event) || field.disabled || field.readOnly) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
113
137
|
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
|
|
114
138
|
event.preventDefault();
|
|
115
139
|
field.nudge(event.key === "ArrowUp" ? 1 : -1);
|
|
@@ -141,7 +165,7 @@ const NumberInputControl = forwardRef(
|
|
|
141
165
|
"aria-valuetext": field.valueText,
|
|
142
166
|
"aria-valuemin": field.min,
|
|
143
167
|
"aria-valuemax": field.max,
|
|
144
|
-
"aria-describedby": field.describedBy,
|
|
168
|
+
"aria-describedby": joinFieldDescribedBy(field.describedBy, ariaDescribedByProp),
|
|
145
169
|
"data-invalid": dataInvalidValue(field.isInvalid),
|
|
146
170
|
"data-disabled": dataFlag(field.disabled),
|
|
147
171
|
"data-readonly": dataFlag(field.readOnly),
|
|
@@ -351,13 +375,15 @@ const NumberInputError = forwardRef(
|
|
|
351
375
|
}
|
|
352
376
|
);
|
|
353
377
|
NumberInputError.displayName = "NumberInputError";
|
|
354
|
-
function NumberInputSimpleBody(
|
|
378
|
+
function NumberInputSimpleBody({
|
|
379
|
+
controlProps
|
|
380
|
+
} = {}) {
|
|
355
381
|
const field = useNumberInputContext();
|
|
356
382
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
357
383
|
field.label != null ? /* @__PURE__ */ jsx(NumberInputLabel, {}) : null,
|
|
358
384
|
/* @__PURE__ */ jsxs(NumberInputShell, { children: [
|
|
359
385
|
/* @__PURE__ */ jsx(NumberInputDecrement, {}),
|
|
360
|
-
/* @__PURE__ */ jsx(NumberInputControl, {}),
|
|
386
|
+
/* @__PURE__ */ jsx(NumberInputControl, { ...controlProps }),
|
|
361
387
|
/* @__PURE__ */ jsx(NumberInputIncrement, {})
|
|
362
388
|
] }),
|
|
363
389
|
field.hint != null ? /* @__PURE__ */ jsx(NumberInputHint, {}) : null,
|
|
@@ -69,7 +69,7 @@ function numberInputControlClass({
|
|
|
69
69
|
className
|
|
70
70
|
}) {
|
|
71
71
|
return cn(
|
|
72
|
-
"min-w-0 flex-1 bg-transparent text-center text-foreground outline-none placeholder:text-muted tabular-nums",
|
|
72
|
+
"min-w-0 flex-1 bg-transparent text-center text-foreground outline-none placeholder:text-muted-foreground tabular-nums",
|
|
73
73
|
CONTROL_SIZE_LAYOUT[size].controlPad,
|
|
74
74
|
NUMBER_INPUT_CONTROL_MIN[size],
|
|
75
75
|
FIELD_CONTROL_MOBILE_NO_ZOOM_CLASS,
|
|
@@ -85,7 +85,7 @@ function numberInputStepperClass({
|
|
|
85
85
|
className
|
|
86
86
|
}) {
|
|
87
87
|
return cn(
|
|
88
|
-
"relative z-10 flex shrink-0 items-center justify-center text-muted outline-none focus-ring-inset",
|
|
88
|
+
"relative z-10 flex shrink-0 items-center justify-center text-muted-foreground outline-none focus-ring-inset",
|
|
89
89
|
TEXT_COLOR_TRANSITION,
|
|
90
90
|
NUMBER_INPUT_BUTTON_PAD[size],
|
|
91
91
|
side === "decrement" ? "border-e-token" : "border-s-token",
|