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
|
@@ -5,6 +5,7 @@ import { Field } from "../Field/index.js";
|
|
|
5
5
|
import { joinFieldDescribedBy } from "../Field/fieldA11y.js";
|
|
6
6
|
import { useBurneLabel } from "../../../theme/BurneLabelsProvider.js";
|
|
7
7
|
import { SelectionIndicator } from "../SelectionIndicator/index.js";
|
|
8
|
+
import { dataFlag } from "../utils/dataContract.js";
|
|
8
9
|
import { mergeRefs } from "../utils/mergeRefs.js";
|
|
9
10
|
import { radioInputAriaLabel } from "./radioA11y.js";
|
|
10
11
|
import { resolveRadioIndicatorClassNames, radioVariantToIndicator } from "./radioAPI.js";
|
|
@@ -47,12 +48,10 @@ const RadioControl = forwardRef(
|
|
|
47
48
|
value: ctx.inputProps.value,
|
|
48
49
|
required: ctx.inputProps.required,
|
|
49
50
|
"aria-invalid": ctx.isInvalid ? true : void 0,
|
|
50
|
-
"data-invalid": ctx.isInvalid ? "" : void 0,
|
|
51
51
|
form: ctx.inputProps.form,
|
|
52
52
|
autoFocus: ctx.inputProps.autoFocus,
|
|
53
53
|
tabIndex: ctx.inputProps.tabIndex,
|
|
54
54
|
readOnly: ctx.inputProps.readOnly,
|
|
55
|
-
"data-readonly": ctx.inputProps.readOnly ? "" : void 0,
|
|
56
55
|
onClick: (event) => {
|
|
57
56
|
if (ctx.inputProps.readOnly) {
|
|
58
57
|
event.preventDefault();
|
|
@@ -68,7 +67,11 @@ const RadioControl = forwardRef(
|
|
|
68
67
|
ctx.errorConnected ? ctx.errorId : void 0
|
|
69
68
|
),
|
|
70
69
|
"aria-label": radioInputAriaLabel(ctx.inputProps.value, ctx.hasLabel, unnamedLabel),
|
|
71
|
-
onChange: ctx.onChange
|
|
70
|
+
onChange: ctx.onChange,
|
|
71
|
+
"data-disabled": dataFlag(ctx.isDisabled),
|
|
72
|
+
"data-invalid": dataFlag(ctx.isInvalid),
|
|
73
|
+
"data-readonly": dataFlag(ctx.isReadOnly),
|
|
74
|
+
"data-required": dataFlag(Boolean(ctx.inputProps.required))
|
|
72
75
|
}
|
|
73
76
|
),
|
|
74
77
|
/* @__PURE__ */ jsx(
|
|
@@ -8,11 +8,11 @@ export declare const RADIO_CONTENT_COMPOUND_CLASS = "min-w-0";
|
|
|
8
8
|
export declare const RADIO_LABEL_CLASS = "inline-flex flex-wrap items-center gap-x-xsmall gap-y-0";
|
|
9
9
|
export declare const RADIO_LABEL_COMPOUND_SECONDARY_CLASS = "min-w-0";
|
|
10
10
|
export declare const RADIO_LABEL_MOTION_CLASS = "origin-center";
|
|
11
|
-
export declare const RADIO_LABEL_TEXT_DISABLED_CLASS = "text-muted";
|
|
11
|
+
export declare const RADIO_LABEL_TEXT_DISABLED_CLASS = "text-muted-foreground";
|
|
12
12
|
export declare const RADIO_LABEL_TEXT_DANGER_CLASS = "text-danger";
|
|
13
13
|
export declare const RADIO_REQUIRED_MARK_CLASS = "text-danger";
|
|
14
|
-
export declare const RADIO_HINT_DISABLED_CLASS = "text-muted";
|
|
15
|
-
export declare const RADIO_ERROR_DISABLED_CLASS = "text-muted";
|
|
14
|
+
export declare const RADIO_HINT_DISABLED_CLASS = "text-muted-foreground";
|
|
15
|
+
export declare const RADIO_ERROR_DISABLED_CLASS = "text-muted-foreground";
|
|
16
16
|
export declare const RADIO_SIMPLE_LABEL_WRAP_CLASS = "origin-center";
|
|
17
17
|
export declare const RADIO_SIMPLE_LABEL_TEXT_CLASS = "min-w-0";
|
|
18
18
|
export declare const RADIO_ROOT_BASE_CLASS = "relative cursor-pointer select-none rounded-small text-start";
|
|
@@ -16,11 +16,11 @@ const RADIO_CONTENT_COMPOUND_CLASS = "min-w-0";
|
|
|
16
16
|
const RADIO_LABEL_CLASS = "inline-flex flex-wrap items-center gap-x-xsmall gap-y-0";
|
|
17
17
|
const RADIO_LABEL_COMPOUND_SECONDARY_CLASS = "min-w-0";
|
|
18
18
|
const RADIO_LABEL_MOTION_CLASS = "origin-center";
|
|
19
|
-
const RADIO_LABEL_TEXT_DISABLED_CLASS = "text-muted";
|
|
19
|
+
const RADIO_LABEL_TEXT_DISABLED_CLASS = "text-muted-foreground";
|
|
20
20
|
const RADIO_LABEL_TEXT_DANGER_CLASS = "text-danger";
|
|
21
21
|
const RADIO_REQUIRED_MARK_CLASS = "text-danger";
|
|
22
|
-
const RADIO_HINT_DISABLED_CLASS = "text-muted";
|
|
23
|
-
const RADIO_ERROR_DISABLED_CLASS = "text-muted";
|
|
22
|
+
const RADIO_HINT_DISABLED_CLASS = "text-muted-foreground";
|
|
23
|
+
const RADIO_ERROR_DISABLED_CLASS = "text-muted-foreground";
|
|
24
24
|
const RADIO_SIMPLE_LABEL_WRAP_CLASS = "origin-center";
|
|
25
25
|
const RADIO_SIMPLE_LABEL_TEXT_CLASS = "min-w-0";
|
|
26
26
|
const RADIO_ROOT_BASE_CLASS = "relative cursor-pointer select-none rounded-small text-start";
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import { RadioFieldContextValue, UseRadioRootStateProps } from './radioTypes.js';
|
|
3
|
-
export declare function useRadioRootState({ size, labelPosition, variant: variantProp, disabled, checked, defaultChecked, onChange, id: idProp, name, value, required, form, autoFocus, tabIndex, readOnly, onBlur, onFocus, inputRef, label, hint, error, invalid, }: UseRadioRootStateProps, children: ReactNode | undefined, className?: string, onClick?: (e: MouseEvent<HTMLInputElement>) => void): {
|
|
3
|
+
export declare function useRadioRootState({ size, labelPosition, variant: variantProp, disabled: disabledProp, checked, defaultChecked, onChange, id: idProp, name, value, required, form, autoFocus, tabIndex, readOnly: readOnlyProp, onBlur, onFocus, inputRef, label, hint, error, invalid, }: UseRadioRootStateProps, children: ReactNode | undefined, className?: string, onClick?: (e: MouseEvent<HTMLInputElement>) => void): {
|
|
4
4
|
contextValue: RadioFieldContextValue;
|
|
5
5
|
isCompound: boolean;
|
|
6
6
|
isDisabled: boolean;
|
|
7
|
+
isReadOnly: boolean;
|
|
8
|
+
isInvalid: boolean;
|
|
9
|
+
isRequired: boolean;
|
|
7
10
|
mergedChecked: boolean;
|
|
8
11
|
enableTextMotion: boolean;
|
|
9
12
|
textColRef: import('react').RefObject<HTMLElement | null>;
|
|
@@ -13,7 +16,7 @@ export declare function useRadioRootState({ size, labelPosition, variant: varian
|
|
|
13
16
|
hasError: boolean;
|
|
14
17
|
label: ReactNode;
|
|
15
18
|
hint: ReactNode;
|
|
16
|
-
error: ReactNode;
|
|
19
|
+
error: string | number | bigint | boolean | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | undefined;
|
|
17
20
|
hintId: string;
|
|
18
21
|
errorId: string;
|
|
19
22
|
danger: boolean;
|
|
@@ -3,11 +3,12 @@ import { useSkinVariant } from "../../../skins/skinContext.js";
|
|
|
3
3
|
import { useOptionalRadioGroupContext } from "../../composite/RadioGroup/radioGroupContext.js";
|
|
4
4
|
import { hasCompoundChild } from "../utils/hasCompoundChild.js";
|
|
5
5
|
import { hasCompoundChildren } from "../utils/hasCompoundChildren.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useFormFieldBinding } from "../../composite/Form/useFormFieldBinding.js";
|
|
7
|
+
import { useNativeFormReset } from "../utils/fieldFormDom.js";
|
|
8
|
+
import { mergeRefs } from "../utils/mergeRefs.js";
|
|
7
9
|
import { useControllableState } from "../utils/useControllableState.js";
|
|
8
|
-
import { useId,
|
|
9
|
-
import {
|
|
10
|
-
import { useFieldInvalid } from "../Field/fieldContext.js";
|
|
10
|
+
import { useId, useRef, useMemo, useCallback } from "react";
|
|
11
|
+
import { useResolvedFieldInvalid } from "../utils/fieldInvalid.js";
|
|
11
12
|
import { radioErrorId, radioHintId, radioInputId } from "./radioA11y.js";
|
|
12
13
|
import { compoundUsesInlineMotion } from "./radioAPI.js";
|
|
13
14
|
import { RADIO_SIZE_LAYOUT } from "./radioStyles.js";
|
|
@@ -15,7 +16,7 @@ function useRadioRootState({
|
|
|
15
16
|
size = "base",
|
|
16
17
|
labelPosition = "end",
|
|
17
18
|
variant: variantProp,
|
|
18
|
-
disabled,
|
|
19
|
+
disabled: disabledProp,
|
|
19
20
|
checked,
|
|
20
21
|
defaultChecked,
|
|
21
22
|
onChange,
|
|
@@ -26,7 +27,7 @@ function useRadioRootState({
|
|
|
26
27
|
form,
|
|
27
28
|
autoFocus,
|
|
28
29
|
tabIndex,
|
|
29
|
-
readOnly,
|
|
30
|
+
readOnly: readOnlyProp,
|
|
30
31
|
onBlur,
|
|
31
32
|
onFocus,
|
|
32
33
|
inputRef,
|
|
@@ -39,71 +40,100 @@ function useRadioRootState({
|
|
|
39
40
|
const group = useOptionalRadioGroupContext();
|
|
40
41
|
const optionValueStr = value !== void 0 && value !== null ? String(value) : void 0;
|
|
41
42
|
const inGroup = group != null && optionValueStr != null;
|
|
42
|
-
const formBinding =
|
|
43
|
+
const formBinding = useFormFieldBinding({
|
|
43
44
|
name: inGroup ? void 0 : typeof name === "string" ? name : void 0,
|
|
44
45
|
value: checked,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
disabled,
|
|
48
|
-
readOnly: Boolean(readOnly || group?.readOnly)
|
|
46
|
+
disabled: disabledProp,
|
|
47
|
+
readOnly: readOnlyProp ?? group?.readOnly
|
|
49
48
|
});
|
|
50
|
-
const
|
|
49
|
+
const formBound = !inGroup && formBinding.bound;
|
|
50
|
+
const isDisabled = Boolean(disabledProp ?? group?.disabled ?? formBinding.disabled);
|
|
51
|
+
const isReadOnly = Boolean(readOnlyProp ?? group?.readOnly ?? formBinding.readOnly);
|
|
51
52
|
const autoId = useId();
|
|
52
53
|
const inputId = radioInputId(idProp, autoId);
|
|
53
54
|
const hintId = radioHintId(inputId);
|
|
54
55
|
const errorId = radioErrorId(inputId);
|
|
55
56
|
const isExplicitlyControlled = checked !== void 0;
|
|
56
57
|
const groupChecked = inGroup ? group.selectedValue === optionValueStr : void 0;
|
|
57
|
-
const formChecked =
|
|
58
|
+
const formChecked = formBound ? optionValueStr !== void 0 ? String(formBinding.value ?? "") === optionValueStr : typeof formBinding.value === "boolean" ? formBinding.value : formBinding.value === "on" : void 0;
|
|
58
59
|
const resolvedChecked = isExplicitlyControlled ? checked : groupChecked !== void 0 ? groupChecked : formChecked;
|
|
60
|
+
const isStandaloneUncontrolled = !isExplicitlyControlled && !inGroup && !formBound;
|
|
59
61
|
const [mergedChecked, setMergedChecked, isControlled] = useControllableState({
|
|
60
62
|
value: resolvedChecked,
|
|
61
|
-
defaultValue: Boolean(
|
|
63
|
+
defaultValue: Boolean(isStandaloneUncontrolled ? defaultChecked : void 0)
|
|
62
64
|
});
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
+
const inputElementRef = useRef(null);
|
|
66
|
+
useNativeFormReset(
|
|
67
|
+
inputElementRef,
|
|
68
|
+
() => {
|
|
69
|
+
setMergedChecked(Boolean(defaultChecked));
|
|
70
|
+
},
|
|
71
|
+
isStandaloneUncontrolled
|
|
72
|
+
);
|
|
73
|
+
const inputName = name ?? group?.name ?? formBinding.name;
|
|
65
74
|
const { isCompound, hasCompoundLabel, hasCompoundHint, hasCompoundError } = useMemo(() => {
|
|
66
75
|
const compound = hasCompoundChildren(children);
|
|
67
76
|
return {
|
|
68
77
|
isCompound: compound,
|
|
69
|
-
hasCompoundLabel: compound ? hasCompoundChild(children, "RadioLabel") : false,
|
|
70
|
-
hasCompoundHint: compound ? hasCompoundChild(children, "RadioHint") : false,
|
|
71
|
-
hasCompoundError: compound ? hasCompoundChild(children, "RadioError") : false
|
|
78
|
+
hasCompoundLabel: compound ? hasCompoundChild(children, "RadioLabel", "Radio.Label", "Label") : false,
|
|
79
|
+
hasCompoundHint: compound ? hasCompoundChild(children, "RadioHint", "Radio.Hint") : false,
|
|
80
|
+
hasCompoundError: compound ? hasCompoundChild(children, "RadioError", "Radio.Error") : false
|
|
72
81
|
};
|
|
73
82
|
}, [children]);
|
|
74
83
|
const hasLabel = isCompound ? hasCompoundLabel : Boolean(label);
|
|
75
84
|
const useInlineCompoundMotion = isCompound && compoundUsesInlineMotion(className);
|
|
76
85
|
const enableTextMotion = !isDisabled && (!isCompound || useInlineCompoundMotion);
|
|
77
86
|
const sz = RADIO_SIZE_LAYOUT[size];
|
|
87
|
+
const resolvedError = error ?? (!hasCompoundError && formBound ? formBinding.error : void 0);
|
|
78
88
|
const hasHint = hint != null;
|
|
79
|
-
const hasError =
|
|
80
|
-
const isInvalid =
|
|
89
|
+
const hasError = resolvedError != null;
|
|
90
|
+
const isInvalid = useResolvedFieldInvalid({
|
|
81
91
|
invalid,
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
errorConnected: isCompound ? hasCompoundError : hasError,
|
|
93
|
+
formInvalid: Boolean(formBound && formBinding.error)
|
|
84
94
|
});
|
|
85
95
|
const showDanger = isInvalid;
|
|
86
96
|
const secondaryLines = isCompound ? (hasCompoundHint ? 1 : 0) + (hasCompoundError ? 1 : 0) : (hasHint ? 1 : 0) + (hasError ? 1 : 0);
|
|
87
97
|
const textColRef = useRef(null);
|
|
88
98
|
const handleChange = useCallback(
|
|
89
99
|
(e) => {
|
|
90
|
-
if (
|
|
100
|
+
if (isReadOnly || isDisabled) {
|
|
91
101
|
e.preventDefault();
|
|
92
102
|
return;
|
|
93
103
|
}
|
|
94
|
-
if (
|
|
104
|
+
if (isStandaloneUncontrolled) setMergedChecked(e.target.checked);
|
|
95
105
|
onChange?.(e);
|
|
96
106
|
if (e.defaultPrevented) return;
|
|
97
107
|
if (inGroup && e.target.checked && optionValueStr != null) {
|
|
98
108
|
group.selectValue(optionValueStr);
|
|
99
109
|
return;
|
|
100
110
|
}
|
|
101
|
-
if (
|
|
111
|
+
if (formBound && e.target.checked) {
|
|
112
|
+
formBinding.setValue(optionValueStr !== void 0 ? optionValueStr : true);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
[
|
|
116
|
+
formBinding,
|
|
117
|
+
formBound,
|
|
118
|
+
group,
|
|
119
|
+
inGroup,
|
|
120
|
+
isDisabled,
|
|
121
|
+
isReadOnly,
|
|
122
|
+
isStandaloneUncontrolled,
|
|
123
|
+
onChange,
|
|
124
|
+
optionValueStr,
|
|
125
|
+
setMergedChecked
|
|
126
|
+
]
|
|
127
|
+
);
|
|
128
|
+
const handleBlur = useCallback(
|
|
129
|
+
(e) => {
|
|
130
|
+
onBlur?.(e);
|
|
131
|
+
if (formBound) formBinding.onBlur();
|
|
102
132
|
},
|
|
103
|
-
[formBinding,
|
|
133
|
+
[formBinding, formBound, onBlur]
|
|
104
134
|
);
|
|
105
|
-
const canClearSelection = !isDisabled && !
|
|
106
|
-
const inputRequired = required ?? (inGroup && group.
|
|
135
|
+
const canClearSelection = !isDisabled && !isReadOnly && !required && !(inGroup && group.required);
|
|
136
|
+
const inputRequired = required ?? (inGroup && group.isOptionRequired(optionValueStr, isDisabled) ? true : void 0);
|
|
107
137
|
const handleClick = useCallback(
|
|
108
138
|
(e) => {
|
|
109
139
|
onClick?.(e);
|
|
@@ -113,17 +143,24 @@ function useRadioRootState({
|
|
|
113
143
|
group.selectValue(void 0);
|
|
114
144
|
return;
|
|
115
145
|
}
|
|
146
|
+
if (formBound) {
|
|
147
|
+
formBinding.setValue(optionValueStr !== void 0 ? "" : false);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
116
150
|
if (!isExplicitlyControlled) {
|
|
117
151
|
setMergedChecked(false);
|
|
118
152
|
}
|
|
119
153
|
},
|
|
120
154
|
[
|
|
121
155
|
canClearSelection,
|
|
156
|
+
formBinding,
|
|
157
|
+
formBound,
|
|
122
158
|
group,
|
|
123
159
|
inGroup,
|
|
124
160
|
isExplicitlyControlled,
|
|
125
161
|
mergedChecked,
|
|
126
162
|
onClick,
|
|
163
|
+
optionValueStr,
|
|
127
164
|
setMergedChecked
|
|
128
165
|
]
|
|
129
166
|
);
|
|
@@ -137,6 +174,7 @@ function useRadioRootState({
|
|
|
137
174
|
variant,
|
|
138
175
|
mergedChecked,
|
|
139
176
|
isDisabled,
|
|
177
|
+
isReadOnly,
|
|
140
178
|
isControlled,
|
|
141
179
|
isCompound,
|
|
142
180
|
hasCompoundHint,
|
|
@@ -153,15 +191,15 @@ function useRadioRootState({
|
|
|
153
191
|
onActivate: handleClick,
|
|
154
192
|
inputProps: {
|
|
155
193
|
value,
|
|
156
|
-
defaultChecked:
|
|
194
|
+
defaultChecked: isStandaloneUncontrolled ? defaultChecked : void 0,
|
|
157
195
|
required: inputRequired,
|
|
158
196
|
form,
|
|
159
197
|
autoFocus,
|
|
160
198
|
tabIndex,
|
|
161
|
-
readOnly:
|
|
162
|
-
onBlur,
|
|
199
|
+
readOnly: isReadOnly,
|
|
200
|
+
onBlur: handleBlur,
|
|
163
201
|
onFocus,
|
|
164
|
-
inputRef
|
|
202
|
+
inputRef: mergeRefs(inputElementRef, formBound ? formBinding.ref : void 0, inputRef)
|
|
165
203
|
}
|
|
166
204
|
}),
|
|
167
205
|
[
|
|
@@ -169,8 +207,11 @@ function useRadioRootState({
|
|
|
169
207
|
isInvalid,
|
|
170
208
|
defaultChecked,
|
|
171
209
|
form,
|
|
210
|
+
formBinding.ref,
|
|
211
|
+
formBound,
|
|
172
212
|
autoFocus,
|
|
173
213
|
errorId,
|
|
214
|
+
handleBlur,
|
|
174
215
|
handleChange,
|
|
175
216
|
handleClick,
|
|
176
217
|
hasCompoundError,
|
|
@@ -185,12 +226,12 @@ function useRadioRootState({
|
|
|
185
226
|
useInlineCompoundMotion,
|
|
186
227
|
isControlled,
|
|
187
228
|
isDisabled,
|
|
229
|
+
isReadOnly,
|
|
230
|
+
isStandaloneUncontrolled,
|
|
188
231
|
mergedChecked,
|
|
189
|
-
onBlur,
|
|
190
232
|
onFocus,
|
|
191
233
|
inputRef,
|
|
192
234
|
inputRequired,
|
|
193
|
-
resolvedReadOnly,
|
|
194
235
|
labelPosition,
|
|
195
236
|
size,
|
|
196
237
|
tabIndex,
|
|
@@ -202,6 +243,9 @@ function useRadioRootState({
|
|
|
202
243
|
contextValue,
|
|
203
244
|
isCompound,
|
|
204
245
|
isDisabled,
|
|
246
|
+
isReadOnly,
|
|
247
|
+
isInvalid,
|
|
248
|
+
isRequired: Boolean(inputRequired),
|
|
205
249
|
mergedChecked,
|
|
206
250
|
enableTextMotion,
|
|
207
251
|
textColRef,
|
|
@@ -211,7 +255,7 @@ function useRadioRootState({
|
|
|
211
255
|
hasError,
|
|
212
256
|
label,
|
|
213
257
|
hint,
|
|
214
|
-
error,
|
|
258
|
+
error: resolvedError,
|
|
215
259
|
hintId,
|
|
216
260
|
errorId,
|
|
217
261
|
danger: showDanger
|
|
@@ -1,9 +1,113 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useMemo, useState, useRef, useCallback, Children, isValidElement } from "react";
|
|
3
|
+
import { forwardRef, useMemo, useState, useRef, useCallback, useLayoutEffect, Children, isValidElement, Fragment } from "react";
|
|
4
|
+
import { useSkinVariant } from "../../../skins/skinContext.js";
|
|
4
5
|
import { resolveResizableMotionDefaults, useResizableRootMotion } from "./resizableAnimations.js";
|
|
5
6
|
import { ResizableMotionProvider, ResizableLayoutProvider } from "./resizableContext.js";
|
|
6
7
|
import { resizableRootClass } from "./resizableStyles.js";
|
|
8
|
+
const DEFAULT_MIN_SIZE = 8;
|
|
9
|
+
const DEFAULT_MAX_SIZE = 100;
|
|
10
|
+
function normalizeResizableSizes(order, specs, prev, preserveExisting) {
|
|
11
|
+
if (order.length === 0) {
|
|
12
|
+
return Object.keys(prev).length === 0 ? prev : {};
|
|
13
|
+
}
|
|
14
|
+
const n = order.length;
|
|
15
|
+
const bounds = /* @__PURE__ */ new Map();
|
|
16
|
+
for (const id of order) {
|
|
17
|
+
const spec = specs.get(id);
|
|
18
|
+
const min = Math.min(100, Math.max(0, Number.isFinite(spec?.minSize) ? spec?.minSize ?? DEFAULT_MIN_SIZE : DEFAULT_MIN_SIZE));
|
|
19
|
+
const rawMax = Number.isFinite(spec?.maxSize) ? spec?.maxSize ?? DEFAULT_MAX_SIZE : DEFAULT_MAX_SIZE;
|
|
20
|
+
const max = Math.min(100, Math.max(min, rawMax));
|
|
21
|
+
bounds.set(id, { min, max });
|
|
22
|
+
}
|
|
23
|
+
const existingIds = preserveExisting ? order.filter((id) => id in prev && Number.isFinite(prev[id])) : [];
|
|
24
|
+
const newIds = preserveExisting ? order.filter((id) => !(id in prev && Number.isFinite(prev[id]))) : order;
|
|
25
|
+
const prevKeys = Object.keys(prev);
|
|
26
|
+
if (preserveExisting && existingIds.length === n && prevKeys.length === n) {
|
|
27
|
+
const currentSum = order.reduce((acc, id) => acc + (prev[id] ?? 0), 0);
|
|
28
|
+
const allWithinBounds = order.every((id) => {
|
|
29
|
+
const b = bounds.get(id);
|
|
30
|
+
const v = prev[id] ?? 0;
|
|
31
|
+
return v >= b.min - 1e-4 && v <= b.max + 1e-4;
|
|
32
|
+
});
|
|
33
|
+
if (allWithinBounds && Math.abs(currentSum - 100) < 0.01) {
|
|
34
|
+
return prev;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const raw = {};
|
|
38
|
+
if (existingIds.length === 0) {
|
|
39
|
+
let definedSum = 0;
|
|
40
|
+
let missingCount = 0;
|
|
41
|
+
for (const id of order) {
|
|
42
|
+
const def = specs.get(id)?.defaultSize;
|
|
43
|
+
if (def != null && Number.isFinite(def) && def >= 0) {
|
|
44
|
+
definedSum += def;
|
|
45
|
+
} else {
|
|
46
|
+
missingCount += 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const fallbackShare = missingCount > 0 ? Math.max(0, 100 - definedSum) / missingCount : 0;
|
|
50
|
+
for (const id of order) {
|
|
51
|
+
const def = specs.get(id)?.defaultSize;
|
|
52
|
+
raw[id] = def != null && Number.isFinite(def) && def >= 0 ? def : fallbackShare;
|
|
53
|
+
}
|
|
54
|
+
} else if (newIds.length === 0) {
|
|
55
|
+
for (const id of order) {
|
|
56
|
+
raw[id] = Math.max(0, prev[id] ?? 0);
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
let desiredNewSum = 0;
|
|
60
|
+
for (const id of newIds) {
|
|
61
|
+
const def = specs.get(id)?.defaultSize;
|
|
62
|
+
const share = def != null && Number.isFinite(def) && def >= 0 ? def : 100 / n;
|
|
63
|
+
raw[id] = share;
|
|
64
|
+
desiredNewSum += share;
|
|
65
|
+
}
|
|
66
|
+
const cappedNewSum = Math.min(90, desiredNewSum);
|
|
67
|
+
const newScale = desiredNewSum > 0 ? cappedNewSum / desiredNewSum : 1;
|
|
68
|
+
for (const id of newIds) {
|
|
69
|
+
raw[id] = (raw[id] ?? 0) * newScale;
|
|
70
|
+
}
|
|
71
|
+
const existingSum = existingIds.reduce((acc, id) => acc + Math.max(0, prev[id] ?? 0), 0);
|
|
72
|
+
const remainingForExisting = Math.max(0, 100 - cappedNewSum);
|
|
73
|
+
for (const id of existingIds) {
|
|
74
|
+
raw[id] = existingSum > 0 ? Math.max(0, prev[id] ?? 0) / existingSum * remainingForExisting : remainingForExisting / existingIds.length;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const next = {};
|
|
78
|
+
const rawTotal = order.reduce((acc, id) => acc + Math.max(0, raw[id] ?? 0), 0);
|
|
79
|
+
for (const id of order) {
|
|
80
|
+
next[id] = rawTotal > 0 ? Math.max(0, raw[id] ?? 0) / rawTotal * 100 : 100 / n;
|
|
81
|
+
}
|
|
82
|
+
const locked = /* @__PURE__ */ new Set();
|
|
83
|
+
for (let iter = 0; iter < n + 2; iter += 1) {
|
|
84
|
+
let changed = false;
|
|
85
|
+
for (const id of order) {
|
|
86
|
+
if (locked.has(id)) continue;
|
|
87
|
+
const b = bounds.get(id);
|
|
88
|
+
if (next[id] < b.min - 1e-6) {
|
|
89
|
+
next[id] = b.min;
|
|
90
|
+
locked.add(id);
|
|
91
|
+
changed = true;
|
|
92
|
+
} else if (next[id] > b.max + 1e-6) {
|
|
93
|
+
next[id] = b.max;
|
|
94
|
+
locked.add(id);
|
|
95
|
+
changed = true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (!changed) break;
|
|
99
|
+
const unlocked = order.filter((id) => !locked.has(id));
|
|
100
|
+
if (unlocked.length === 0) break;
|
|
101
|
+
const lockedSum = order.filter((id) => locked.has(id)).reduce((acc, id) => acc + (next[id] ?? 0), 0);
|
|
102
|
+
const remaining = Math.max(0, 100 - lockedSum);
|
|
103
|
+
const unlockedSum = unlocked.reduce((acc, id) => acc + Math.max(0, next[id] ?? 0), 0);
|
|
104
|
+
for (const id of unlocked) {
|
|
105
|
+
next[id] = unlockedSum > 0 ? Math.max(0, next[id] ?? 0) / unlockedSum * remaining : remaining / unlocked.length;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const sameKeys = prevKeys.length === n && order.every((id) => id in prev && Math.abs((prev[id] ?? 0) - (next[id] ?? 0)) < 1e-4);
|
|
109
|
+
return sameKeys ? prev : next;
|
|
110
|
+
}
|
|
7
111
|
const Resizable = forwardRef(function Resizable2({
|
|
8
112
|
orientation = "horizontal",
|
|
9
113
|
className = "",
|
|
@@ -22,10 +126,50 @@ const Resizable = forwardRef(function Resizable2({
|
|
|
22
126
|
}, ref) {
|
|
23
127
|
const motionDefaults = useMemo(() => resolveResizableMotionDefaults(), []);
|
|
24
128
|
const [sizes, setSizes] = useState({});
|
|
25
|
-
const
|
|
129
|
+
const [registryVersion, setRegistryVersion] = useState(0);
|
|
130
|
+
const specsRef = useRef(/* @__PURE__ */ new Map());
|
|
131
|
+
const rootElRef = useRef(null);
|
|
132
|
+
const userResizedRef = useRef(false);
|
|
26
133
|
const commit = useCallback((updater) => {
|
|
134
|
+
userResizedRef.current = true;
|
|
27
135
|
setSizes((prev) => updater(prev));
|
|
28
136
|
}, []);
|
|
137
|
+
const syncNormalizedSizes = useCallback(() => {
|
|
138
|
+
const specs = specsRef.current;
|
|
139
|
+
let order = Array.from(specs.keys());
|
|
140
|
+
const root = rootElRef.current;
|
|
141
|
+
if (root && order.length > 1) {
|
|
142
|
+
const domOrder = [];
|
|
143
|
+
for (const child of Array.from(root.children)) {
|
|
144
|
+
if (child instanceof HTMLElement && child.dataset.value && specs.has(child.dataset.value)) {
|
|
145
|
+
domOrder.push(child.dataset.value);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (domOrder.length === order.length) {
|
|
149
|
+
order = domOrder;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const preserve = userResizedRef.current;
|
|
153
|
+
setSizes((prev) => normalizeResizableSizes(order, specs, prev, preserve));
|
|
154
|
+
}, []);
|
|
155
|
+
useLayoutEffect(() => {
|
|
156
|
+
syncNormalizedSizes();
|
|
157
|
+
}, [registryVersion, syncNormalizedSizes]);
|
|
158
|
+
const registerPanel = useCallback(
|
|
159
|
+
(id, spec) => {
|
|
160
|
+
specsRef.current.set(id, spec);
|
|
161
|
+
setRegistryVersion((v) => v + 1);
|
|
162
|
+
},
|
|
163
|
+
[]
|
|
164
|
+
);
|
|
165
|
+
const unregisterPanel = useCallback(
|
|
166
|
+
(id) => {
|
|
167
|
+
if (!specsRef.current.has(id)) return;
|
|
168
|
+
specsRef.current.delete(id);
|
|
169
|
+
setRegistryVersion((v) => v + 1);
|
|
170
|
+
},
|
|
171
|
+
[]
|
|
172
|
+
);
|
|
29
173
|
const handleCount = countResizableHandles(children);
|
|
30
174
|
const layout = useMemo(() => ({
|
|
31
175
|
orientation,
|
|
@@ -33,20 +177,19 @@ const Resizable = forwardRef(function Resizable2({
|
|
|
33
177
|
panelClass: classNames?.panel,
|
|
34
178
|
handleClass: classNames?.handle,
|
|
35
179
|
commit,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
commit((prev) => {
|
|
42
|
-
if (!(id in prev)) return prev;
|
|
43
|
-
const next = { ...prev };
|
|
44
|
-
delete next[id];
|
|
45
|
-
return next;
|
|
46
|
-
});
|
|
180
|
+
registerPanel,
|
|
181
|
+
unregisterPanel,
|
|
182
|
+
minOf: (id) => {
|
|
183
|
+
const min = specsRef.current.get(id)?.minSize ?? DEFAULT_MIN_SIZE;
|
|
184
|
+
return Number.isFinite(min) ? Math.min(100, Math.max(0, min)) : DEFAULT_MIN_SIZE;
|
|
47
185
|
},
|
|
48
|
-
|
|
49
|
-
|
|
186
|
+
maxOf: (id) => {
|
|
187
|
+
const spec = specsRef.current.get(id);
|
|
188
|
+
const min = Number.isFinite(spec?.minSize) ? Math.min(100, Math.max(0, spec.minSize)) : DEFAULT_MIN_SIZE;
|
|
189
|
+
const max = Number.isFinite(spec?.maxSize) ? spec.maxSize : DEFAULT_MAX_SIZE;
|
|
190
|
+
return Math.min(100, Math.max(min, max));
|
|
191
|
+
}
|
|
192
|
+
}), [classNames?.handle, classNames?.panel, commit, orientation, registerPanel, sizes, unregisterPanel]);
|
|
50
193
|
return /* @__PURE__ */ jsx(
|
|
51
194
|
ResizableMotionProvider,
|
|
52
195
|
{
|
|
@@ -63,6 +206,7 @@ const Resizable = forwardRef(function Resizable2({
|
|
|
63
206
|
className,
|
|
64
207
|
slotClass: classNames?.root,
|
|
65
208
|
forwardedRef: ref,
|
|
209
|
+
rootElRef,
|
|
66
210
|
rootMotion: motion?.root,
|
|
67
211
|
onPointerOver,
|
|
68
212
|
onPointerOut,
|
|
@@ -82,6 +226,7 @@ function ResizableSurface({
|
|
|
82
226
|
slotClass,
|
|
83
227
|
children,
|
|
84
228
|
forwardedRef,
|
|
229
|
+
rootElRef,
|
|
85
230
|
rootMotion,
|
|
86
231
|
onPointerOver,
|
|
87
232
|
onPointerOut,
|
|
@@ -90,6 +235,7 @@ function ResizableSurface({
|
|
|
90
235
|
rest,
|
|
91
236
|
handleCount
|
|
92
237
|
}) {
|
|
238
|
+
const skinVariant = useSkinVariant(void 0);
|
|
93
239
|
const part = useResizableRootMotion({
|
|
94
240
|
forwardedRef,
|
|
95
241
|
motion: rootMotion,
|
|
@@ -98,11 +244,18 @@ function ResizableSurface({
|
|
|
98
244
|
onPointerDown,
|
|
99
245
|
onPointerUp
|
|
100
246
|
});
|
|
247
|
+
const setRef = useCallback(
|
|
248
|
+
(node) => {
|
|
249
|
+
rootElRef.current = node;
|
|
250
|
+
part.setRef(node);
|
|
251
|
+
},
|
|
252
|
+
[part, rootElRef]
|
|
253
|
+
);
|
|
101
254
|
return /* @__PURE__ */ jsx(
|
|
102
255
|
"div",
|
|
103
256
|
{
|
|
104
|
-
ref:
|
|
105
|
-
className: resizableRootClass({ orientation, slotClass, className }),
|
|
257
|
+
ref: setRef,
|
|
258
|
+
className: resizableRootClass({ orientation, skinVariant, slotClass, className }),
|
|
106
259
|
...rest,
|
|
107
260
|
...part.pointerHandlers,
|
|
108
261
|
style: { ...rest.style, "--resizable-handles": handleCount },
|
|
@@ -112,9 +265,21 @@ function ResizableSurface({
|
|
|
112
265
|
);
|
|
113
266
|
}
|
|
114
267
|
function countResizableHandles(children) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
268
|
+
let count = 0;
|
|
269
|
+
const walk = (nodes) => {
|
|
270
|
+
Children.forEach(nodes, (child) => {
|
|
271
|
+
if (!isValidElement(child)) return;
|
|
272
|
+
if (child.type === Fragment) {
|
|
273
|
+
walk(child.props.children);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (child.type.displayName === "Resizable.Handle") {
|
|
277
|
+
count += 1;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
};
|
|
281
|
+
walk(children);
|
|
282
|
+
return count;
|
|
118
283
|
}
|
|
119
284
|
Resizable.displayName = "Resizable";
|
|
120
285
|
export {
|
|
@@ -8,6 +8,7 @@ export declare const Resizable: import('react').ForwardRefExoticComponent<import
|
|
|
8
8
|
Panel: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
|
|
9
9
|
defaultSize?: number;
|
|
10
10
|
minSize?: number;
|
|
11
|
+
maxSize?: number;
|
|
11
12
|
motion?: import('../../../index.js').Prettify<import('./resizableTypes.js').ResizablePartMotion>;
|
|
12
13
|
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
13
14
|
Handle: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
|
|
@@ -18,7 +18,7 @@ function useResizableSlot(slot, {
|
|
|
18
18
|
onPointerUp
|
|
19
19
|
}) {
|
|
20
20
|
const scope = useResizableMotionScope();
|
|
21
|
-
const pointer = hasPointerPhases(motion);
|
|
21
|
+
const pointer = hasPointerPhases(motion ?? scope?.getRootMotion()?.[slot]);
|
|
22
22
|
const part = useMotionPart({
|
|
23
23
|
scope,
|
|
24
24
|
slot: RESIZABLE_MOTION_SLOTS[slot].slot,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const ResizablePanel: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
|
|
2
2
|
defaultSize?: number;
|
|
3
3
|
minSize?: number;
|
|
4
|
+
maxSize?: number;
|
|
4
5
|
motion?: import('../../../index.js').Prettify<import('./resizableTypes.js').ResizablePartMotion>;
|
|
5
6
|
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
6
7
|
export declare const ResizableHandle: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
|