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
|
@@ -19,11 +19,12 @@ function ButtonGroupSegmentProvider({
|
|
|
19
19
|
segment,
|
|
20
20
|
size,
|
|
21
21
|
variant,
|
|
22
|
+
disabled,
|
|
22
23
|
children
|
|
23
24
|
}) {
|
|
24
25
|
const value = useMemo(
|
|
25
|
-
() => ({ segment, size, variant }),
|
|
26
|
-
[size, segment, variant]
|
|
26
|
+
() => ({ segment, size, variant, disabled }),
|
|
27
|
+
[disabled, size, segment, variant]
|
|
27
28
|
);
|
|
28
29
|
return /* @__PURE__ */ jsx(ButtonGroupSegmentContext.Provider, { value, children });
|
|
29
30
|
}
|
|
@@ -36,7 +37,7 @@ function useOptionalButtonGroupLayout() {
|
|
|
36
37
|
function useInJoinedButtonGroup() {
|
|
37
38
|
const layoutCtx = useOptionalButtonGroupLayout();
|
|
38
39
|
const groupCtx = useOptionalButtonGroupSegment();
|
|
39
|
-
return Boolean(groupCtx && !layoutCtx?.segmented);
|
|
40
|
+
return Boolean(groupCtx?.segment && !layoutCtx?.segmented);
|
|
40
41
|
}
|
|
41
42
|
function ButtonGroupClassNamesProvider({
|
|
42
43
|
classNames,
|
|
@@ -50,7 +50,7 @@ function buttonGroupSegmentSurfaceClasses(seg) {
|
|
|
50
50
|
}
|
|
51
51
|
function buttonGroupTextSurfaceClasses(seg) {
|
|
52
52
|
return cn(
|
|
53
|
-
"relative inline-flex shrink-0 select-none items-center justify-center border-token bg-surface text-muted",
|
|
53
|
+
"relative inline-flex shrink-0 select-none items-center justify-center border-token bg-surface text-muted-foreground",
|
|
54
54
|
buttonGroupRoundingClasses(seg),
|
|
55
55
|
buttonGroupOverlapBorderClasses(seg),
|
|
56
56
|
seg != null && buttonGroupSegmentSurfaceClasses(seg),
|
|
@@ -36,6 +36,7 @@ export type ButtonGroupProps = Omit<HTMLAttributes<HTMLDivElement>, "role" | "ch
|
|
|
36
36
|
segmented?: boolean;
|
|
37
37
|
size?: ButtonSize;
|
|
38
38
|
variant?: ButtonVariant;
|
|
39
|
+
disabled?: boolean;
|
|
39
40
|
classNames?: Prettify<ButtonGroupClassNames>;
|
|
40
41
|
children: ReactNode;
|
|
41
42
|
/**
|
|
@@ -60,9 +61,10 @@ export type ButtonGroupClassNamesProviderProps = {
|
|
|
60
61
|
children: ReactNode;
|
|
61
62
|
};
|
|
62
63
|
export type ButtonGroupSegmentContextValue = {
|
|
63
|
-
segment
|
|
64
|
+
segment?: ButtonGroupSegment;
|
|
64
65
|
size: ButtonSize;
|
|
65
66
|
variant?: ButtonVariant;
|
|
67
|
+
disabled?: boolean;
|
|
66
68
|
};
|
|
67
69
|
export type ButtonGroupLayoutContextValue = {
|
|
68
70
|
segmented: boolean;
|
|
@@ -3,6 +3,7 @@ export declare const ButtonGroup: import('react').ForwardRefExoticComponent<Omit
|
|
|
3
3
|
segmented?: boolean;
|
|
4
4
|
size?: import('../../../index.js').ButtonSize;
|
|
5
5
|
variant?: import('../../../index.js').ButtonVariant;
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
classNames?: import('../../../index.js').Prettify<import('./buttonGroupTypes.js').ButtonGroupClassNames>;
|
|
7
8
|
children: import('react').ReactNode;
|
|
8
9
|
motion?: import('../../../index.js').Prettify<import('../../../index.js').MotionMapWithEvents<import('./buttonGroupTypes.js').ButtonGroupMotion>>;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useMemo } from "react";
|
|
4
4
|
import { Checkbox } from "../../core/Checkbox/index.js";
|
|
5
|
+
import { dataFlag } from "../../core/utils/dataContract.js";
|
|
5
6
|
import { FieldHiddenValues } from "../../core/utils/fieldFormDom.js";
|
|
7
|
+
import { mergeRefs } from "../../core/utils/mergeRefs.js";
|
|
6
8
|
import { OptionGroupFieldset } from "../utils/optionGroupFieldset.js";
|
|
7
9
|
import { itemsPartTaken } from "../../core/utils/itemsBesideChildren.js";
|
|
8
10
|
import { resolveCheckboxGroupMotionDefaults, useCheckboxGroupRootMotion } from "./checkboxGroupAnimations.js";
|
|
@@ -20,7 +22,7 @@ const CheckboxGroupFieldsetShell = forwardRef(
|
|
|
20
22
|
...props
|
|
21
23
|
}, ref) {
|
|
22
24
|
const slotClassNames = useCheckboxGroupClassNames();
|
|
23
|
-
const { selectedValue, selectedValues, selection, required, readOnly, name } = useCheckboxGroupContext();
|
|
25
|
+
const { selectedValue, selectedValues, selection, required, readOnly, disabled, name } = useCheckboxGroupContext();
|
|
24
26
|
const part = useCheckboxGroupRootMotion({
|
|
25
27
|
forwardedRef: ref,
|
|
26
28
|
selectionIdentity: selection === "single" ? selectedValue ?? "" : selectedValues.join("\0"),
|
|
@@ -38,7 +40,9 @@ const CheckboxGroupFieldsetShell = forwardRef(
|
|
|
38
40
|
...part.pointerHandlers,
|
|
39
41
|
"aria-required": required || void 0,
|
|
40
42
|
"aria-readonly": readOnly || void 0,
|
|
41
|
-
"data-
|
|
43
|
+
"data-disabled": dataFlag(disabled),
|
|
44
|
+
"data-readonly": dataFlag(readOnly),
|
|
45
|
+
"data-required": dataFlag(required),
|
|
42
46
|
children: [
|
|
43
47
|
props.children,
|
|
44
48
|
/* @__PURE__ */ jsx(
|
|
@@ -62,9 +66,11 @@ const CheckboxGroupRoot = forwardRef(
|
|
|
62
66
|
size,
|
|
63
67
|
label,
|
|
64
68
|
hint,
|
|
65
|
-
error,
|
|
69
|
+
error: _error,
|
|
66
70
|
items,
|
|
67
|
-
disabled
|
|
71
|
+
disabled: _disabled,
|
|
72
|
+
invalid: invalidProp,
|
|
73
|
+
onBlur: _onBlur,
|
|
68
74
|
name: _name,
|
|
69
75
|
readOnly: _readOnly,
|
|
70
76
|
required: _required,
|
|
@@ -84,14 +90,26 @@ const CheckboxGroupRoot = forwardRef(
|
|
|
84
90
|
playInitialState,
|
|
85
91
|
...fieldsetProps
|
|
86
92
|
} = props;
|
|
87
|
-
const {
|
|
93
|
+
const {
|
|
94
|
+
contextValue,
|
|
95
|
+
fieldLabelCtx,
|
|
96
|
+
hintId,
|
|
97
|
+
errorId,
|
|
98
|
+
disabled,
|
|
99
|
+
formInvalid,
|
|
100
|
+
resolvedError,
|
|
101
|
+
bindFieldsetRef,
|
|
102
|
+
handleBlur
|
|
103
|
+
} = useCheckboxGroupRootState(props);
|
|
88
104
|
const motionDefaults = useMemo(() => resolveCheckboxGroupMotionDefaults(), []);
|
|
89
105
|
const optionList = items && !itemsPartTaken("CheckboxGroup", children, "CheckboxRoot", "CheckboxGroup.List") ? items : void 0;
|
|
90
106
|
const fieldset = /* @__PURE__ */ jsxs(
|
|
91
107
|
CheckboxGroupFieldsetShell,
|
|
92
108
|
{
|
|
93
|
-
ref,
|
|
109
|
+
ref: mergeRefs(ref, bindFieldsetRef),
|
|
94
110
|
disabled,
|
|
111
|
+
invalid: formInvalid ? true : invalidProp,
|
|
112
|
+
onBlur: handleBlur,
|
|
95
113
|
hintId,
|
|
96
114
|
errorId,
|
|
97
115
|
size,
|
|
@@ -110,7 +128,7 @@ const CheckboxGroupRoot = forwardRef(
|
|
|
110
128
|
option.value
|
|
111
129
|
)) }) : null,
|
|
112
130
|
hint != null ? /* @__PURE__ */ jsx(CheckboxGroupHint, { children: hint }) : null,
|
|
113
|
-
|
|
131
|
+
resolvedError != null ? /* @__PURE__ */ jsx(CheckboxGroupError, { children: resolvedError }) : null,
|
|
114
132
|
children
|
|
115
133
|
]
|
|
116
134
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CheckboxGroupContextValue, UseCheckboxGroupRootStateProps } from './checkboxGroupTypes.js';
|
|
2
|
-
export declare function useCheckboxGroupRootState({ required, selectionMode: selection, value: valueProp, defaultValue, onValueChange, values: valuesProp, defaultValues, onValuesChange, disabled, readOnly, name, hintId: hintIdProp, errorId: errorIdProp, }: UseCheckboxGroupRootStateProps): {
|
|
2
|
+
export declare function useCheckboxGroupRootState({ required, selectionMode: selection, value: valueProp, defaultValue, onValueChange, values: valuesProp, defaultValues, onValuesChange, disabled: disabledProp, readOnly: readOnlyProp, name, error, children, onBlur: onBlurProp, hintId: hintIdProp, errorId: errorIdProp, }: UseCheckboxGroupRootStateProps): {
|
|
3
3
|
contextValue: CheckboxGroupContextValue;
|
|
4
4
|
fieldLabelCtx: {
|
|
5
5
|
required: boolean;
|
|
@@ -7,4 +7,8 @@ export declare function useCheckboxGroupRootState({ required, selectionMode: sel
|
|
|
7
7
|
hintId: string;
|
|
8
8
|
errorId: string;
|
|
9
9
|
disabled: boolean;
|
|
10
|
+
formInvalid: boolean;
|
|
11
|
+
resolvedError: string | number | bigint | boolean | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | undefined;
|
|
12
|
+
bindFieldsetRef: (node: HTMLFieldSetElement | null) => void;
|
|
13
|
+
handleBlur: (event: React.FocusEvent<HTMLFieldSetElement>) => void;
|
|
10
14
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useState,
|
|
2
|
+
import { useMemo, useState, useRef, useCallback } from "react";
|
|
3
3
|
import { useFormFieldBinding } from "../Form/useFormFieldBinding.js";
|
|
4
4
|
import "../../core/Field/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useNativeFormReset } from "../../core/utils/fieldFormDom.js";
|
|
6
|
+
import { hasCompoundChild } from "../../core/utils/hasCompoundChild.js";
|
|
6
7
|
import { checkboxGroupNextValues, checkboxGroupValuesEqual } from "./checkboxGroupAPI.js";
|
|
7
8
|
import { useFieldSetHintId, useFieldSetErrorId } from "../../core/Field/Field.js";
|
|
8
9
|
const EMPTY_VALUES = [];
|
|
@@ -15,49 +16,88 @@ function useCheckboxGroupRootState({
|
|
|
15
16
|
values: valuesProp,
|
|
16
17
|
defaultValues,
|
|
17
18
|
onValuesChange,
|
|
18
|
-
disabled
|
|
19
|
-
readOnly
|
|
19
|
+
disabled: disabledProp,
|
|
20
|
+
readOnly: readOnlyProp,
|
|
20
21
|
name,
|
|
22
|
+
error,
|
|
23
|
+
children,
|
|
24
|
+
onBlur: onBlurProp,
|
|
21
25
|
hintId: hintIdProp,
|
|
22
26
|
errorId: errorIdProp
|
|
23
27
|
}) {
|
|
24
28
|
const formBinding = useFormFieldBinding({
|
|
25
29
|
name,
|
|
26
30
|
value: selection === "multiple" ? valuesProp : valueProp,
|
|
27
|
-
disabled,
|
|
28
|
-
readOnly
|
|
31
|
+
disabled: disabledProp,
|
|
32
|
+
readOnly: readOnlyProp
|
|
29
33
|
});
|
|
30
|
-
const
|
|
34
|
+
const resolvedDisabled = Boolean(disabledProp ?? formBinding.disabled);
|
|
35
|
+
const resolvedReadOnly = Boolean(readOnlyProp ?? formBinding.readOnly);
|
|
31
36
|
const formBound = formBinding.bound;
|
|
37
|
+
const formInvalid = Boolean(formBound && formBinding.error);
|
|
38
|
+
const hasCompoundError = useMemo(
|
|
39
|
+
() => hasCompoundChild(children, "CheckboxGroup.Error", "CheckboxGroupError"),
|
|
40
|
+
[children]
|
|
41
|
+
);
|
|
42
|
+
const resolvedError = error ?? (!hasCompoundError && formBound ? formBinding.error : void 0);
|
|
32
43
|
const hintId = useFieldSetHintId(hintIdProp);
|
|
33
44
|
const errorId = useFieldSetErrorId(errorIdProp);
|
|
34
45
|
const multiple = selection === "multiple";
|
|
35
46
|
const valuesControlled = multiple && valuesProp !== void 0;
|
|
47
|
+
const singleControlled = !multiple && valueProp !== void 0;
|
|
36
48
|
const formSingle = formBound && selection === "single" && formBinding.value != null && formBinding.value !== "" ? String(formBinding.value) : null;
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
defaultValue: selection === "single" ? defaultValue : void 0,
|
|
40
|
-
onValueChange: selection === "single" ? onValueChange : void 0,
|
|
41
|
-
allowClear: true
|
|
42
|
-
});
|
|
49
|
+
const [internalSingle, setInternalSingle] = useState(() => defaultValue ?? null);
|
|
50
|
+
const singleSelectedValue = selection === "single" ? formBound ? formSingle : singleControlled ? valueProp ?? null : internalSingle : null;
|
|
43
51
|
const [internalValues, setInternalValues] = useState(
|
|
44
52
|
() => defaultValues ? [...defaultValues] : []
|
|
45
53
|
);
|
|
46
54
|
const formValues = formBound && multiple && Array.isArray(formBinding.value) ? formBinding.value.map(String) : EMPTY_VALUES;
|
|
47
55
|
const selectedValues = !multiple ? EMPTY_VALUES : formBound ? formValues : valuesControlled ? valuesProp ?? EMPTY_VALUES : internalValues;
|
|
48
56
|
const selectedValue = selection === "single" ? singleSelectedValue : null;
|
|
57
|
+
const fieldsetRef = useRef(null);
|
|
58
|
+
const bindFieldsetRef = useCallback(
|
|
59
|
+
(node) => {
|
|
60
|
+
fieldsetRef.current = node;
|
|
61
|
+
if (formBound) {
|
|
62
|
+
const firstInput = node?.querySelector('input[type="checkbox"]:not(:disabled)');
|
|
63
|
+
formBinding.ref(firstInput ?? node);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
[formBinding, formBound]
|
|
67
|
+
);
|
|
68
|
+
useNativeFormReset(
|
|
69
|
+
fieldsetRef,
|
|
70
|
+
() => {
|
|
71
|
+
if (multiple) {
|
|
72
|
+
if (!valuesControlled) setInternalValues(defaultValues ? [...defaultValues] : []);
|
|
73
|
+
} else if (!singleControlled) {
|
|
74
|
+
setInternalSingle(defaultValue ?? null);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
!formBound && (multiple ? !valuesControlled : !singleControlled)
|
|
78
|
+
);
|
|
79
|
+
const handleBlur = useCallback(
|
|
80
|
+
(event) => {
|
|
81
|
+
onBlurProp?.(event);
|
|
82
|
+
if (formBound && !event.currentTarget.contains(event.relatedTarget)) {
|
|
83
|
+
formBinding.onBlur();
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
[formBinding, formBound, onBlurProp]
|
|
87
|
+
);
|
|
49
88
|
const selectSingleValue = useCallback(
|
|
50
89
|
(optionValue, checked) => {
|
|
51
|
-
if (selection !== "single" || resolvedReadOnly) return;
|
|
52
|
-
const next = checked ? optionValue :
|
|
53
|
-
|
|
90
|
+
if (selection !== "single" || resolvedReadOnly || resolvedDisabled) return;
|
|
91
|
+
const next = checked ? optionValue : null;
|
|
92
|
+
if (!singleControlled && !formBound) setInternalSingle(next);
|
|
93
|
+
onValueChange?.(next);
|
|
54
94
|
if (formBound) formBinding.setValue(next ?? "");
|
|
55
95
|
},
|
|
56
|
-
[formBinding, formBound, resolvedReadOnly,
|
|
96
|
+
[formBinding, formBound, onValueChange, resolvedDisabled, resolvedReadOnly, selection, singleControlled]
|
|
57
97
|
);
|
|
58
98
|
const toggleMultipleValue = useCallback(
|
|
59
99
|
(optionValue, checked) => {
|
|
60
|
-
if (!multiple || resolvedReadOnly) return;
|
|
100
|
+
if (!multiple || resolvedReadOnly || resolvedDisabled) return;
|
|
61
101
|
const current = formBound ? formValues : valuesControlled ? valuesProp ?? EMPTY_VALUES : internalValues;
|
|
62
102
|
const next = checkboxGroupNextValues(current, optionValue, checked);
|
|
63
103
|
if (checkboxGroupValuesEqual(current, next)) return;
|
|
@@ -65,14 +105,14 @@ function useCheckboxGroupRootState({
|
|
|
65
105
|
onValuesChange?.(next);
|
|
66
106
|
if (formBound) formBinding.setValue(next);
|
|
67
107
|
},
|
|
68
|
-
[formBinding, formBound, formValues, internalValues, multiple, onValuesChange, resolvedReadOnly, valuesControlled, valuesProp]
|
|
108
|
+
[formBinding, formBound, formValues, internalValues, multiple, onValuesChange, resolvedDisabled, resolvedReadOnly, valuesControlled, valuesProp]
|
|
69
109
|
);
|
|
70
110
|
const contextValue = useMemo(
|
|
71
111
|
() => ({
|
|
72
112
|
selection,
|
|
73
|
-
disabled:
|
|
113
|
+
disabled: resolvedDisabled,
|
|
74
114
|
readOnly: resolvedReadOnly,
|
|
75
|
-
name,
|
|
115
|
+
name: formBinding.name ?? name,
|
|
76
116
|
required,
|
|
77
117
|
hintId,
|
|
78
118
|
errorId,
|
|
@@ -83,9 +123,10 @@ function useCheckboxGroupRootState({
|
|
|
83
123
|
}),
|
|
84
124
|
[
|
|
85
125
|
errorId,
|
|
86
|
-
formBinding,
|
|
126
|
+
formBinding.name,
|
|
87
127
|
hintId,
|
|
88
128
|
name,
|
|
129
|
+
resolvedDisabled,
|
|
89
130
|
resolvedReadOnly,
|
|
90
131
|
required,
|
|
91
132
|
selectSingleValue,
|
|
@@ -96,7 +137,17 @@ function useCheckboxGroupRootState({
|
|
|
96
137
|
]
|
|
97
138
|
);
|
|
98
139
|
const fieldLabelCtx = useMemo(() => ({ required }), [required]);
|
|
99
|
-
return {
|
|
140
|
+
return {
|
|
141
|
+
contextValue,
|
|
142
|
+
fieldLabelCtx,
|
|
143
|
+
hintId,
|
|
144
|
+
errorId,
|
|
145
|
+
disabled: resolvedDisabled,
|
|
146
|
+
formInvalid,
|
|
147
|
+
resolvedError,
|
|
148
|
+
bindFieldsetRef,
|
|
149
|
+
handleBlur
|
|
150
|
+
};
|
|
100
151
|
}
|
|
101
152
|
export {
|
|
102
153
|
useCheckboxGroupRootState
|
|
@@ -26,6 +26,7 @@ const FormRoot = forwardRef(function FormRoot2({
|
|
|
26
26
|
disabled,
|
|
27
27
|
onSubmit,
|
|
28
28
|
onSubmitError,
|
|
29
|
+
onReset,
|
|
29
30
|
errorSummary,
|
|
30
31
|
motion,
|
|
31
32
|
motionController,
|
|
@@ -43,6 +44,7 @@ const FormRoot = forwardRef(function FormRoot2({
|
|
|
43
44
|
shellIds,
|
|
44
45
|
bindingValue,
|
|
45
46
|
handleSubmit,
|
|
47
|
+
handleReset,
|
|
46
48
|
hasErrors,
|
|
47
49
|
announce
|
|
48
50
|
} = useFormRootState({
|
|
@@ -56,6 +58,7 @@ const FormRoot = forwardRef(function FormRoot2({
|
|
|
56
58
|
disabled,
|
|
57
59
|
onSubmit,
|
|
58
60
|
onSubmitError,
|
|
61
|
+
onReset,
|
|
59
62
|
classNames
|
|
60
63
|
});
|
|
61
64
|
const motionDefaults = useMemo(() => resolveFormMotionDefaults(), []);
|
|
@@ -73,6 +76,7 @@ const FormRoot = forwardRef(function FormRoot2({
|
|
|
73
76
|
{
|
|
74
77
|
forwardedRef: ref,
|
|
75
78
|
handleSubmit,
|
|
79
|
+
handleReset,
|
|
76
80
|
titleId: shellIds.titleId,
|
|
77
81
|
descriptionId: shellIds.descriptionId,
|
|
78
82
|
errorSummaryId: shellIds.errorSummaryId,
|
|
@@ -97,6 +101,7 @@ FormRoot.displayName = "Form";
|
|
|
97
101
|
function FormRootSurface({
|
|
98
102
|
forwardedRef,
|
|
99
103
|
handleSubmit,
|
|
104
|
+
handleReset,
|
|
100
105
|
titleId,
|
|
101
106
|
descriptionId,
|
|
102
107
|
errorSummaryId,
|
|
@@ -127,6 +132,7 @@ function FormRootSurface({
|
|
|
127
132
|
ref: part.setRef,
|
|
128
133
|
noValidate: true,
|
|
129
134
|
onSubmit: handleSubmit,
|
|
135
|
+
onReset: handleReset,
|
|
130
136
|
"aria-labelledby": formRootLabelledBy(titleId),
|
|
131
137
|
"aria-describedby": formRootDescribedBy({
|
|
132
138
|
descriptionId,
|
|
@@ -2,6 +2,8 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { FormFieldRules, FormValues } from './formTypes.js';
|
|
3
3
|
export declare function countFormErrors(errors: Record<string, string>): number;
|
|
4
4
|
export declare function formErrorEntries(errors: Record<string, string>): Array<[string, string]>;
|
|
5
|
+
export declare function cleanFormResolverErrors(errors?: Partial<Record<string, string>>): Record<string, string>;
|
|
6
|
+
export declare function getFormValueAtPath(values: FormValues, path: string): unknown;
|
|
5
7
|
export declare function setFormValueAtPath(values: FormValues, path: string, value: unknown): FormValues;
|
|
6
8
|
export declare function isFormValueEmpty(value: unknown): boolean;
|
|
7
9
|
export declare function validateFormFieldRules(value: unknown, values: FormValues, rules?: FormFieldRules): string | undefined;
|
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Children, isValidElement, cloneElement } from "react";
|
|
3
3
|
function countFormErrors(errors) {
|
|
4
|
-
|
|
4
|
+
let count = 0;
|
|
5
|
+
for (const key of Object.keys(errors)) {
|
|
6
|
+
if (errors[key]) count += 1;
|
|
7
|
+
}
|
|
8
|
+
return count;
|
|
5
9
|
}
|
|
6
10
|
function formErrorEntries(errors) {
|
|
7
|
-
return Object.entries(errors);
|
|
11
|
+
return Object.entries(errors).filter(([, message]) => Boolean(message));
|
|
12
|
+
}
|
|
13
|
+
function cleanFormResolverErrors(errors) {
|
|
14
|
+
if (!errors) return {};
|
|
15
|
+
const cleaned = {};
|
|
16
|
+
for (const [key, message] of Object.entries(errors)) {
|
|
17
|
+
if (typeof message === "string" && message.length > 0) {
|
|
18
|
+
cleaned[key] = message;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return cleaned;
|
|
22
|
+
}
|
|
23
|
+
function getFormValueAtPath(values, path) {
|
|
24
|
+
if (!path.includes(".")) return values[path];
|
|
25
|
+
const parts = path.split(".");
|
|
26
|
+
return parts.reduce((acc, key) => {
|
|
27
|
+
if (acc == null || typeof acc !== "object") return void 0;
|
|
28
|
+
return acc[key];
|
|
29
|
+
}, values);
|
|
8
30
|
}
|
|
9
31
|
function setFormValueAtPath(values, path, value) {
|
|
10
32
|
if (!path.includes(".")) {
|
|
@@ -85,14 +107,19 @@ function readControlValueFromEvent(event, type) {
|
|
|
85
107
|
return event;
|
|
86
108
|
}
|
|
87
109
|
const target = event.target;
|
|
110
|
+
if (target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement) {
|
|
111
|
+
return target.value;
|
|
112
|
+
}
|
|
88
113
|
if (!(target instanceof HTMLInputElement)) return void 0;
|
|
89
114
|
if (type === "checkbox") return target.checked;
|
|
90
115
|
if (type === "number") return target.value === "" ? void 0 : Number(target.value);
|
|
91
116
|
return target.value;
|
|
92
117
|
}
|
|
93
118
|
export {
|
|
119
|
+
cleanFormResolverErrors,
|
|
94
120
|
countFormErrors,
|
|
95
121
|
formErrorEntries,
|
|
122
|
+
getFormValueAtPath,
|
|
96
123
|
isFormValueEmpty,
|
|
97
124
|
mergeFormFieldRules,
|
|
98
125
|
readControlValueFromEvent,
|
|
@@ -24,6 +24,9 @@ function FormShellProvider({
|
|
|
24
24
|
function useFormClassNames() {
|
|
25
25
|
return useContext(FormClassNamesContext);
|
|
26
26
|
}
|
|
27
|
+
function useFormShell() {
|
|
28
|
+
return useContext(FormShellContext);
|
|
29
|
+
}
|
|
27
30
|
function useFormShellIds() {
|
|
28
31
|
return useContext(FormShellContext)?.shellIds ?? null;
|
|
29
32
|
}
|
|
@@ -53,6 +56,7 @@ export {
|
|
|
53
56
|
useFormBindingContext,
|
|
54
57
|
useFormClassNames,
|
|
55
58
|
useFormMotionScope,
|
|
59
|
+
useFormShell,
|
|
56
60
|
useFormShellIds,
|
|
57
61
|
useFormSize,
|
|
58
62
|
useOptionalFormBindingContext,
|
|
@@ -7,14 +7,20 @@ import { formErrorEntries } from "./formAPI.js";
|
|
|
7
7
|
import { useFormSlotMotion } from "./formAnimations.js";
|
|
8
8
|
import { formAnnounceClass, formErrorSummaryClass, formActionsClass, formDescriptionClass, formTitleClass, formTitleVariant, formHeaderClass, formFieldClass, formSectionClass } from "./formStyles.js";
|
|
9
9
|
import { mergeMotionSlotMaps } from "../../core/utils/slotMotion/resolveMotionValue.js";
|
|
10
|
+
import { mergeMotionRootSiblings } from "../../core/utils/slotMotion/motionEvents.js";
|
|
10
11
|
import { Text } from "../../core/Text/Text.js";
|
|
11
12
|
const FormSection = forwardRef(
|
|
12
13
|
function FormSection2({ className = "", classNames, motion, motionController, motionState, motionPayload, playInitialState, ...rest }, ref) {
|
|
13
14
|
const parentScope = useOptionalFormMotionScope();
|
|
14
|
-
const
|
|
15
|
+
const mergedSlots = mergeMotionSlotMaps(
|
|
15
16
|
parentScope?.getRootMotion(),
|
|
16
17
|
motion ? { section: motion } : void 0
|
|
17
18
|
);
|
|
19
|
+
const siblings = mergeMotionRootSiblings({
|
|
20
|
+
events: parentScope?.getEvents(),
|
|
21
|
+
states: parentScope?.getStates()
|
|
22
|
+
});
|
|
23
|
+
const mergedMotion = { ...mergedSlots, ...siblings };
|
|
18
24
|
const motionDefaults = useMemo(() => ({}), []);
|
|
19
25
|
return /* @__PURE__ */ jsx(
|
|
20
26
|
FormMotionProvider,
|
|
@@ -251,6 +257,7 @@ const FormErrorSummary = forwardRef(
|
|
|
251
257
|
tabIndex: -1,
|
|
252
258
|
className: formErrorSummaryClass(className, rootClassNames),
|
|
253
259
|
...rest,
|
|
260
|
+
...part.pointerHandlers,
|
|
254
261
|
"aria-live": "polite"
|
|
255
262
|
}
|
|
256
263
|
);
|
|
@@ -315,10 +322,15 @@ FormAnnounce.displayName = "Form.Announce";
|
|
|
315
322
|
const FormField = forwardRef(
|
|
316
323
|
function FormField2({ name, rules, className = "", classNames, children, motion, motionController, motionState, motionPayload, playInitialState, ...rest }, ref) {
|
|
317
324
|
const parentScope = useOptionalFormMotionScope();
|
|
318
|
-
const
|
|
325
|
+
const mergedSlots = mergeMotionSlotMaps(
|
|
319
326
|
parentScope?.getRootMotion(),
|
|
320
327
|
motion ? { field: motion } : void 0
|
|
321
328
|
);
|
|
329
|
+
const siblings = mergeMotionRootSiblings({
|
|
330
|
+
events: parentScope?.getEvents(),
|
|
331
|
+
states: parentScope?.getStates()
|
|
332
|
+
});
|
|
333
|
+
const mergedMotion = { ...mergedSlots, ...siblings };
|
|
322
334
|
const motionDefaults = useMemo(() => ({}), []);
|
|
323
335
|
return /* @__PURE__ */ jsx(
|
|
324
336
|
FormMotionProvider,
|
|
@@ -373,11 +385,13 @@ function FormFieldSurface({
|
|
|
373
385
|
onPointerDown,
|
|
374
386
|
onPointerUp
|
|
375
387
|
});
|
|
388
|
+
const registerFieldRules = form?.registerFieldRules;
|
|
389
|
+
const unregisterFieldRules = form?.unregisterFieldRules;
|
|
376
390
|
useEffect(() => {
|
|
377
|
-
if (!
|
|
378
|
-
|
|
379
|
-
return () =>
|
|
380
|
-
}, [
|
|
391
|
+
if (!registerFieldRules || !unregisterFieldRules || !rules) return;
|
|
392
|
+
registerFieldRules(name, rules);
|
|
393
|
+
return () => unregisterFieldRules(name);
|
|
394
|
+
}, [name, registerFieldRules, rules, unregisterFieldRules]);
|
|
381
395
|
return /* @__PURE__ */ jsx(
|
|
382
396
|
"div",
|
|
383
397
|
{
|
|
@@ -9,7 +9,7 @@ const FORM_SIZE_LAYOUT = {
|
|
|
9
9
|
actionsPaddingTop: "pt-xsmall",
|
|
10
10
|
titleVariant: "base",
|
|
11
11
|
titleClassName: "font-w-mid text-foreground",
|
|
12
|
-
descClassName: "text-small text-muted"
|
|
12
|
+
descClassName: "text-small text-muted-foreground"
|
|
13
13
|
},
|
|
14
14
|
base: {
|
|
15
15
|
rootGap: "gap-2xlarge",
|
|
@@ -19,7 +19,7 @@ const FORM_SIZE_LAYOUT = {
|
|
|
19
19
|
actionsPaddingTop: "pt-small",
|
|
20
20
|
titleVariant: "mid",
|
|
21
21
|
titleClassName: "font-w-mid text-foreground",
|
|
22
|
-
descClassName: "text-base text-muted"
|
|
22
|
+
descClassName: "text-base text-muted-foreground"
|
|
23
23
|
},
|
|
24
24
|
mid: {
|
|
25
25
|
rootGap: "gap-2xlarge",
|
|
@@ -29,7 +29,7 @@ const FORM_SIZE_LAYOUT = {
|
|
|
29
29
|
actionsPaddingTop: "pt-base",
|
|
30
30
|
titleVariant: "mid",
|
|
31
31
|
titleClassName: "font-w-mid text-foreground",
|
|
32
|
-
descClassName: "text-base text-muted"
|
|
32
|
+
descClassName: "text-base text-muted-foreground"
|
|
33
33
|
},
|
|
34
34
|
large: {
|
|
35
35
|
rootGap: "gap-3xlarge",
|
|
@@ -39,7 +39,7 @@ const FORM_SIZE_LAYOUT = {
|
|
|
39
39
|
actionsPaddingTop: "pt-base",
|
|
40
40
|
titleVariant: "large",
|
|
41
41
|
titleClassName: "font-w-mid text-foreground",
|
|
42
|
-
descClassName: "text-mid text-muted"
|
|
42
|
+
descClassName: "text-mid text-muted-foreground"
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
function resolveFormSize(size) {
|
|
@@ -16,43 +16,53 @@ function useFormControlProps({
|
|
|
16
16
|
const form = useOptionalFormBindingContext();
|
|
17
17
|
const explicitValue = valueProp !== void 0;
|
|
18
18
|
const bound = form != null && name != null && !explicitValue;
|
|
19
|
+
const registerRef = form?.registerRef;
|
|
20
|
+
const setFormValue = form?.setValue;
|
|
21
|
+
const setTouched = form?.setTouched;
|
|
22
|
+
const validateField = form?.validateField;
|
|
23
|
+
const getFieldRules = form?.getFieldRules;
|
|
24
|
+
const validateMode = form?.validateMode;
|
|
25
|
+
const onChangeRef = useRef(onChangeProp);
|
|
26
|
+
onChangeRef.current = onChangeProp;
|
|
27
|
+
const onBlurRef = useRef(onBlurProp);
|
|
28
|
+
onBlurRef.current = onBlurProp;
|
|
19
29
|
const ref = useRef(null);
|
|
20
30
|
const setRef = useCallback(
|
|
21
31
|
(node) => {
|
|
22
32
|
ref.current = node;
|
|
23
|
-
if (bound && name)
|
|
33
|
+
if (bound && name) registerRef?.(name, node);
|
|
24
34
|
},
|
|
25
|
-
[bound,
|
|
35
|
+
[bound, name, registerRef]
|
|
26
36
|
);
|
|
27
37
|
const disabled = disabledProp ?? form?.disabled ?? false;
|
|
28
38
|
const readOnly = readOnlyProp ?? form?.readOnly ?? false;
|
|
29
39
|
const formError = bound && name ? form.getError(name) : void 0;
|
|
30
40
|
const rules = useMemo(
|
|
31
|
-
() => mergeFormFieldRules(name ?
|
|
32
|
-
[
|
|
41
|
+
() => mergeFormFieldRules(name ? getFieldRules?.(name) : void 0, rulesProp),
|
|
42
|
+
[getFieldRules, name, rulesProp]
|
|
33
43
|
);
|
|
34
44
|
const rawValue = bound && name ? form.getValue(name) : valueProp;
|
|
35
45
|
const onChange = useCallback(
|
|
36
46
|
(event) => {
|
|
37
|
-
|
|
38
|
-
if (!bound || !name || !
|
|
47
|
+
onChangeRef.current?.(event);
|
|
48
|
+
if (!bound || !name || !setFormValue) return;
|
|
39
49
|
const next = readControlValueFromEvent(event, type);
|
|
40
|
-
|
|
41
|
-
shouldValidate:
|
|
50
|
+
setFormValue(name, next, {
|
|
51
|
+
shouldValidate: validateMode === "onChange"
|
|
42
52
|
});
|
|
43
53
|
},
|
|
44
|
-
[bound,
|
|
54
|
+
[bound, name, setFormValue, type, validateMode]
|
|
45
55
|
);
|
|
46
56
|
const onBlur = useCallback(
|
|
47
57
|
(event) => {
|
|
48
|
-
|
|
49
|
-
if (!bound || !name
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
|
|
58
|
+
onBlurRef.current?.(event);
|
|
59
|
+
if (!bound || !name) return;
|
|
60
|
+
setTouched?.(name, true);
|
|
61
|
+
if (validateMode === "onBlur") {
|
|
62
|
+
validateField?.(name);
|
|
53
63
|
}
|
|
54
64
|
},
|
|
55
|
-
[bound,
|
|
65
|
+
[bound, name, setTouched, validateField, validateMode]
|
|
56
66
|
);
|
|
57
67
|
return {
|
|
58
68
|
bound,
|