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
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
import { useMemo, useState, useRef, useCallback } from "react";
|
|
3
3
|
import { useSkinVariant } from "../../../skins/skinContext.js";
|
|
4
4
|
import { EN_LOCALE, resolveCalendarLocale } from "./calendarLocale.js";
|
|
5
|
-
import { startOfDay, createDefaultCalendarValue, createInitialViewDate, resolveInitialFocusDate, clampCalendarDate, resolveSelectedDates, resolveRangeStart, resolveRangeEnd, navigateViewDate, addCalendarMonths, addCalendarYears, isCalendarDateDisabled, isSameDay, calendarRangeHitsUnavailable, getDaysInMonth } from "./calendarAPI.js";
|
|
5
|
+
import { startOfDay, createDefaultCalendarValue, createInitialViewDate, resolveInitialFocusDate, clampCalendarDate, resolveSelectedDates, resolveRangeStart, resolveRangeEnd, canCalendarNavigate, navigateViewDate, addCalendarMonths, addCalendarYears, isCalendarDateDisabled, isSameDay, calendarRangeHitsUnavailable, isCalendarMonthDisabled, getDaysInMonth, isCalendarYearDisabled } from "./calendarAPI.js";
|
|
6
6
|
function useCalendarRootState(rawProps) {
|
|
7
7
|
const {
|
|
8
8
|
selectionMode: mode = "single",
|
|
9
9
|
variant: variantProp,
|
|
10
10
|
size = "base",
|
|
11
|
+
disabled = false,
|
|
12
|
+
readOnly = false,
|
|
11
13
|
defaultMonth,
|
|
12
14
|
month,
|
|
13
15
|
onMonthChange,
|
|
@@ -15,8 +17,8 @@ function useCalendarRootState(rawProps) {
|
|
|
15
17
|
defaultView = "days",
|
|
16
18
|
onViewChange,
|
|
17
19
|
locale: localeProp = EN_LOCALE,
|
|
18
|
-
minDate,
|
|
19
|
-
maxDate,
|
|
20
|
+
minDate: minDateProp,
|
|
21
|
+
maxDate: maxDateProp,
|
|
20
22
|
isDateUnavailable,
|
|
21
23
|
previousIcon,
|
|
22
24
|
nextIcon,
|
|
@@ -33,6 +35,16 @@ function useCalendarRootState(rawProps) {
|
|
|
33
35
|
const variant = useSkinVariant(variantProp);
|
|
34
36
|
const locale = useMemo(() => resolveCalendarLocale(localeProp), [localeProp]);
|
|
35
37
|
const today = useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
38
|
+
const minDateTime = minDateProp ? startOfDay(minDateProp).getTime() : void 0;
|
|
39
|
+
const maxDateTime = maxDateProp ? startOfDay(maxDateProp).getTime() : void 0;
|
|
40
|
+
const minDate = useMemo(
|
|
41
|
+
() => minDateTime !== void 0 ? new Date(minDateTime) : void 0,
|
|
42
|
+
[minDateTime]
|
|
43
|
+
);
|
|
44
|
+
const maxDate = useMemo(
|
|
45
|
+
() => maxDateTime !== void 0 ? new Date(maxDateTime) : void 0,
|
|
46
|
+
[maxDateTime]
|
|
47
|
+
);
|
|
36
48
|
const isControlled = value !== void 0;
|
|
37
49
|
const [internalValue, setInternalValue] = useState(
|
|
38
50
|
() => createDefaultCalendarValue(mode, resolvedDefault)
|
|
@@ -56,10 +68,11 @@ function useCalendarRootState(rawProps) {
|
|
|
56
68
|
const view = viewControlled ? viewProp : viewInternal;
|
|
57
69
|
const setView = useCallback(
|
|
58
70
|
(next) => {
|
|
71
|
+
if (disabled) return;
|
|
59
72
|
if (!viewControlled) setViewInternal(next);
|
|
60
73
|
onViewChange?.(next);
|
|
61
74
|
},
|
|
62
|
-
[onViewChange, viewControlled]
|
|
75
|
+
[disabled, onViewChange, viewControlled]
|
|
63
76
|
);
|
|
64
77
|
const monthControlled = month !== void 0;
|
|
65
78
|
const [viewDateInternal, setViewDateInternal] = useState(
|
|
@@ -89,6 +102,7 @@ function useCalendarRootState(rawProps) {
|
|
|
89
102
|
() => resolveInitialFocusDate({
|
|
90
103
|
mode,
|
|
91
104
|
resolvedValue,
|
|
105
|
+
initialMonth: month ?? defaultMonth,
|
|
92
106
|
today,
|
|
93
107
|
minDate,
|
|
94
108
|
maxDate
|
|
@@ -120,8 +134,19 @@ function useCalendarRootState(rawProps) {
|
|
|
120
134
|
() => resolveRangeEnd(mode, rangePending, resolvedValue),
|
|
121
135
|
[mode, rangePending, resolvedValue]
|
|
122
136
|
);
|
|
137
|
+
const canNavigatePrev = useMemo(
|
|
138
|
+
() => canCalendarNavigate(view, viewDate, -1, minDate, maxDate),
|
|
139
|
+
[view, viewDate, minDate, maxDate]
|
|
140
|
+
);
|
|
141
|
+
const canNavigateNext = useMemo(
|
|
142
|
+
() => canCalendarNavigate(view, viewDate, 1, minDate, maxDate),
|
|
143
|
+
[view, viewDate, minDate, maxDate]
|
|
144
|
+
);
|
|
123
145
|
const navigate = useCallback(
|
|
124
146
|
(delta) => {
|
|
147
|
+
if (disabled || delta === 0) return;
|
|
148
|
+
const dir = delta < 0 ? -1 : 1;
|
|
149
|
+
if (!canCalendarNavigate(view, viewDateRef.current, dir, minDate, maxDate)) return;
|
|
125
150
|
setViewDateRaw((prev) => navigateViewDate(prev, view, delta));
|
|
126
151
|
setFocusedDateRaw((fd) => {
|
|
127
152
|
if (view === "days") {
|
|
@@ -133,10 +158,11 @@ function useCalendarRootState(rawProps) {
|
|
|
133
158
|
return clampCalendarDate(addCalendarYears(fd, delta * 10), minDate, maxDate);
|
|
134
159
|
});
|
|
135
160
|
},
|
|
136
|
-
[view, minDate, maxDate, setViewDateRaw]
|
|
161
|
+
[disabled, view, minDate, maxDate, setViewDateRaw]
|
|
137
162
|
);
|
|
138
163
|
const onDayPress = useCallback(
|
|
139
164
|
(d) => {
|
|
165
|
+
if (disabled || readOnly) return;
|
|
140
166
|
const day = startOfDay(d);
|
|
141
167
|
if (isCalendarDateDisabled(day, minDate, maxDate, isDateUnavailable)) return;
|
|
142
168
|
setFocusedDateRaw(day);
|
|
@@ -167,50 +193,57 @@ function useCalendarRootState(rawProps) {
|
|
|
167
193
|
}
|
|
168
194
|
}
|
|
169
195
|
},
|
|
170
|
-
[isDateUnavailable, maxDate, minDate, mode, rangePending, setValue]
|
|
196
|
+
[disabled, isDateUnavailable, maxDate, minDate, mode, rangePending, readOnly, setValue]
|
|
171
197
|
);
|
|
172
198
|
const onMonthPress = useCallback(
|
|
173
|
-
(
|
|
199
|
+
(monthIndex) => {
|
|
200
|
+
if (disabled || readOnly) return;
|
|
174
201
|
const year = viewDate.getFullYear();
|
|
175
|
-
|
|
202
|
+
if (isCalendarMonthDisabled(year, monthIndex, minDate, maxDate)) return;
|
|
203
|
+
setViewDateRaw(new Date(year, monthIndex, 1));
|
|
176
204
|
setFocusedDateRaw((fd) => {
|
|
177
|
-
const maxDay = getDaysInMonth(year,
|
|
205
|
+
const maxDay = getDaysInMonth(year, monthIndex);
|
|
178
206
|
return clampCalendarDate(
|
|
179
|
-
new Date(year,
|
|
207
|
+
new Date(year, monthIndex, Math.min(fd.getDate(), maxDay)),
|
|
180
208
|
minDate,
|
|
181
209
|
maxDate
|
|
182
210
|
);
|
|
183
211
|
});
|
|
184
212
|
setView("days");
|
|
185
213
|
},
|
|
186
|
-
[viewDate, minDate, maxDate, setView, setViewDateRaw]
|
|
214
|
+
[disabled, readOnly, viewDate, minDate, maxDate, setView, setViewDateRaw]
|
|
187
215
|
);
|
|
188
216
|
const onYearPress = useCallback(
|
|
189
217
|
(year) => {
|
|
218
|
+
if (disabled || readOnly) return;
|
|
219
|
+
if (isCalendarYearDisabled(year, minDate, maxDate)) return;
|
|
190
220
|
setViewDateRaw(new Date(year, viewDate.getMonth(), 1));
|
|
191
|
-
setFocusedDateRaw(
|
|
192
|
-
(fd)
|
|
193
|
-
|
|
221
|
+
setFocusedDateRaw((fd) => {
|
|
222
|
+
const maxDay = getDaysInMonth(year, fd.getMonth());
|
|
223
|
+
return clampCalendarDate(
|
|
224
|
+
new Date(year, fd.getMonth(), Math.min(fd.getDate(), maxDay)),
|
|
194
225
|
minDate,
|
|
195
226
|
maxDate
|
|
196
|
-
)
|
|
197
|
-
);
|
|
227
|
+
);
|
|
228
|
+
});
|
|
198
229
|
setView("months");
|
|
199
230
|
},
|
|
200
|
-
[viewDate, minDate, maxDate, setView, setViewDateRaw]
|
|
231
|
+
[disabled, readOnly, viewDate, minDate, maxDate, setView, setViewDateRaw]
|
|
201
232
|
);
|
|
202
233
|
const onClear = useCallback(() => {
|
|
234
|
+
if (disabled || readOnly) return;
|
|
203
235
|
setRangePending(null);
|
|
204
236
|
setHoverDate(null);
|
|
205
237
|
if (mode === "single") setValue(null);
|
|
206
238
|
else if (mode === "multiple") setValue([]);
|
|
207
239
|
else setValue({ start: null, end: null });
|
|
208
|
-
}, [mode, setValue]);
|
|
240
|
+
}, [disabled, mode, readOnly, setValue]);
|
|
209
241
|
const onToday = useCallback(() => {
|
|
242
|
+
if (disabled) return;
|
|
210
243
|
setViewDateRaw(new Date(today.getFullYear(), today.getMonth(), 1));
|
|
211
244
|
setFocusedDateRaw(clampCalendarDate(today, minDate, maxDate));
|
|
212
245
|
setView("days");
|
|
213
|
-
}, [today, minDate, maxDate, setView, setViewDateRaw]);
|
|
246
|
+
}, [disabled, today, minDate, maxDate, setView, setViewDateRaw]);
|
|
214
247
|
const contextValue = useMemo(
|
|
215
248
|
() => ({
|
|
216
249
|
mode,
|
|
@@ -233,6 +266,10 @@ function useCalendarRootState(rawProps) {
|
|
|
233
266
|
onToday,
|
|
234
267
|
size,
|
|
235
268
|
variant,
|
|
269
|
+
disabled,
|
|
270
|
+
readOnly,
|
|
271
|
+
canNavigatePrev,
|
|
272
|
+
canNavigateNext,
|
|
236
273
|
locale,
|
|
237
274
|
minDate,
|
|
238
275
|
maxDate,
|
|
@@ -262,6 +299,10 @@ function useCalendarRootState(rawProps) {
|
|
|
262
299
|
onToday,
|
|
263
300
|
size,
|
|
264
301
|
variant,
|
|
302
|
+
disabled,
|
|
303
|
+
readOnly,
|
|
304
|
+
canNavigatePrev,
|
|
305
|
+
canNavigateNext,
|
|
265
306
|
locale,
|
|
266
307
|
minDate,
|
|
267
308
|
maxDate,
|
|
@@ -46,17 +46,17 @@ function useCalendarDayCellModels() {
|
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
function useCalendarMonthCellModels() {
|
|
49
|
-
const { viewDate, selectedDates, locale, today } = useCalendar();
|
|
49
|
+
const { viewDate, selectedDates, locale, today, minDate, maxDate } = useCalendar();
|
|
50
50
|
return useMemo(
|
|
51
|
-
() => buildMonthCellModels(viewDate, selectedDates, locale, today),
|
|
52
|
-
[viewDate, selectedDates, locale, today]
|
|
51
|
+
() => buildMonthCellModels(viewDate, selectedDates, locale, today, minDate, maxDate),
|
|
52
|
+
[viewDate, selectedDates, locale, today, minDate, maxDate]
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
function useCalendarYearCellModels() {
|
|
56
|
-
const { viewDate, selectedDates, today } = useCalendar();
|
|
56
|
+
const { viewDate, selectedDates, today, minDate, maxDate } = useCalendar();
|
|
57
57
|
return useMemo(
|
|
58
|
-
() => buildYearCellModels(viewDate, selectedDates, today),
|
|
59
|
-
[viewDate, selectedDates, today]
|
|
58
|
+
() => buildYearCellModels(viewDate, selectedDates, today, minDate, maxDate),
|
|
59
|
+
[viewDate, selectedDates, today, minDate, maxDate]
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
function useCalendarHeaderTitle() {
|
|
@@ -7,6 +7,7 @@ export declare const CardRoot: import('react').ForwardRefExoticComponent<Omit<HT
|
|
|
7
7
|
size?: import('./cardTypes.js').CardSize;
|
|
8
8
|
shadow?: import('../../../index.js').ShadowLevel;
|
|
9
9
|
pressable?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
10
11
|
href?: string;
|
|
11
12
|
asChild?: boolean;
|
|
12
13
|
onClick?: HTMLAttributes<HTMLElement>["onClick"];
|
|
@@ -22,6 +22,7 @@ const CardRoot = forwardRef(function Card({
|
|
|
22
22
|
size = "base",
|
|
23
23
|
shadow = "base",
|
|
24
24
|
pressable = false,
|
|
25
|
+
disabled = false,
|
|
25
26
|
href,
|
|
26
27
|
asChild = false,
|
|
27
28
|
classNames,
|
|
@@ -53,9 +54,12 @@ const CardRoot = forwardRef(function Card({
|
|
|
53
54
|
const skinRevision = useSkinRegistryRevision();
|
|
54
55
|
const motionDefaults = useMemo(
|
|
55
56
|
() => {
|
|
56
|
-
return resolveCardMotionDefaults({
|
|
57
|
+
return resolveCardMotionDefaults({
|
|
58
|
+
variant: state.variant,
|
|
59
|
+
pressable: interactive && !disabled
|
|
60
|
+
});
|
|
57
61
|
},
|
|
58
|
-
[interactive, skinRevision, state.variant]
|
|
62
|
+
[disabled, interactive, skinRevision, state.variant]
|
|
59
63
|
);
|
|
60
64
|
const motionParams = useMemo(
|
|
61
65
|
() => ({
|
|
@@ -79,6 +83,7 @@ const CardRoot = forwardRef(function Card({
|
|
|
79
83
|
CardSurface,
|
|
80
84
|
{
|
|
81
85
|
pressable: interactive,
|
|
86
|
+
disabled,
|
|
82
87
|
href,
|
|
83
88
|
asChild,
|
|
84
89
|
renderAsButton: state.renderAsButton,
|
|
@@ -106,6 +111,7 @@ const CardRoot = forwardRef(function Card({
|
|
|
106
111
|
CardRoot.displayName = "Card";
|
|
107
112
|
function CardSurface({
|
|
108
113
|
pressable,
|
|
114
|
+
disabled,
|
|
109
115
|
renderAsButton,
|
|
110
116
|
href,
|
|
111
117
|
asChild,
|
|
@@ -128,6 +134,7 @@ function CardSurface({
|
|
|
128
134
|
}) {
|
|
129
135
|
const animations = useCardAnimations({
|
|
130
136
|
pressable,
|
|
137
|
+
disabled,
|
|
131
138
|
variant,
|
|
132
139
|
shadow,
|
|
133
140
|
motion,
|
|
@@ -146,12 +153,15 @@ function CardSurface({
|
|
|
146
153
|
animations.pressableLiftMotionClass,
|
|
147
154
|
size,
|
|
148
155
|
shadow,
|
|
149
|
-
cn(classNames?.root, className)
|
|
156
|
+
cn(classNames?.root, className),
|
|
157
|
+
disabled
|
|
150
158
|
);
|
|
159
|
+
const guardHandlers = pressable || renderAsButton || disabled;
|
|
151
160
|
return /* @__PURE__ */ jsx(
|
|
152
161
|
CardRootShell,
|
|
153
162
|
{
|
|
154
163
|
pressable,
|
|
164
|
+
disabled,
|
|
155
165
|
renderAsButton: renderAsButton && href == null && !asChild,
|
|
156
166
|
href,
|
|
157
167
|
asChild,
|
|
@@ -162,10 +172,10 @@ function CardSurface({
|
|
|
162
172
|
rest,
|
|
163
173
|
onPointerOver: animations.onPointerOver,
|
|
164
174
|
onPointerOut: animations.onPointerOut,
|
|
165
|
-
onPointerDown:
|
|
166
|
-
onPointerUp:
|
|
167
|
-
onClick:
|
|
168
|
-
onKeyDown:
|
|
175
|
+
onPointerDown: guardHandlers ? animations.handlePointerDown : animations.onPointerDownProp,
|
|
176
|
+
onPointerUp: guardHandlers ? animations.handlePointerUp : animations.onPointerUpProp,
|
|
177
|
+
onClick: guardHandlers ? animations.handleClick : animations.onClickProp,
|
|
178
|
+
onKeyDown: guardHandlers ? animations.handleKeyDown : animations.onKeyDownProp,
|
|
169
179
|
children
|
|
170
180
|
}
|
|
171
181
|
);
|
|
@@ -4,7 +4,29 @@ function cardRenderAsButton(pressable, hasExplicitHandlers) {
|
|
|
4
4
|
function cardHasExplicitHandlers(props) {
|
|
5
5
|
return Boolean(props.onClick || props.onKeyDown || props.onPointerDown);
|
|
6
6
|
}
|
|
7
|
+
const CARD_INTERACTIVE_DESCENDANT_SELECTOR = [
|
|
8
|
+
"button",
|
|
9
|
+
"a[href]",
|
|
10
|
+
"input",
|
|
11
|
+
"textarea",
|
|
12
|
+
"select",
|
|
13
|
+
"[role='button']",
|
|
14
|
+
"[role='link']",
|
|
15
|
+
"[role='checkbox']",
|
|
16
|
+
"[role='switch']",
|
|
17
|
+
"[role='menuitem']",
|
|
18
|
+
"[role='option']",
|
|
19
|
+
"[role='combobox']",
|
|
20
|
+
"[contenteditable='true']"
|
|
21
|
+
].join(",");
|
|
22
|
+
function isInteractiveCardDescendant(target, cardEl) {
|
|
23
|
+
if (!(target instanceof Element) || target === cardEl) return false;
|
|
24
|
+
const interactive = target.closest(CARD_INTERACTIVE_DESCENDANT_SELECTOR);
|
|
25
|
+
if (!interactive || interactive === cardEl) return false;
|
|
26
|
+
return cardEl.contains(interactive);
|
|
27
|
+
}
|
|
7
28
|
export {
|
|
8
29
|
cardHasExplicitHandlers,
|
|
9
|
-
cardRenderAsButton
|
|
30
|
+
cardRenderAsButton,
|
|
31
|
+
isInteractiveCardDescendant
|
|
10
32
|
};
|
|
@@ -4,7 +4,7 @@ export declare function resolveCardMotionDefaults({ variant, pressable, }: {
|
|
|
4
4
|
variant: CardVariant;
|
|
5
5
|
pressable: boolean;
|
|
6
6
|
}): CardMotion;
|
|
7
|
-
export declare function useCardAnimations({ pressable, variant, shadow, motion, onClick: onClickProp, onKeyDown: onKeyDownProp, onPointerDown: onPointerDownProp, onPointerUp: onPointerUpProp, onPointerOver: onPointerOverProp, onPointerOut: onPointerOutProp, hoverPointerInsideRef, forwardedRef, }: UseCardAnimationsProps): {
|
|
7
|
+
export declare function useCardAnimations({ pressable, disabled, variant, shadow, motion, onClick: onClickProp, onKeyDown: onKeyDownProp, onPointerDown: onPointerDownProp, onPointerUp: onPointerUpProp, onPointerOver: onPointerOverProp, onPointerOut: onPointerOutProp, hoverPointerInsideRef, forwardedRef, }: UseCardAnimationsProps): {
|
|
8
8
|
setRootRef: (node: HTMLElement | null) => void;
|
|
9
9
|
pressableLiftMotionClass: string;
|
|
10
10
|
handlePointerDown: (e: PointerEvent<HTMLElement>) => void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { killMotion } from "../utils/gsapMotion.js";
|
|
3
|
-
import { useRef, useCallback, useEffect, useMemo } from "react";
|
|
4
|
-
import { shouldSkipInteractiveHoverLift, isInteractivePressKey } from "../utils/hoverInteractiveLift.js";
|
|
3
|
+
import { useRef, useCallback, useLayoutEffect, useEffect, useMemo } from "react";
|
|
4
|
+
import { isKitHoverLiftRecipe, primeInteractiveScaleRest, shouldSkipInteractiveHoverLift, isInteractivePressKey } from "../utils/hoverInteractiveLift.js";
|
|
5
5
|
import { mergeForwardedRef } from "../utils/mergeRefs.js";
|
|
6
|
+
import { useMotionConfig } from "../utils/motionConfigContext.js";
|
|
6
7
|
import { useSecondLevelShadow } from "../utils/useShadowMotion.js";
|
|
7
8
|
import { overlaySkinMotion, usesKitElevation, usesKitElevationMember } from "../../../skins/resolveVariantVisual.js";
|
|
9
|
+
import { isInteractiveCardDescendant } from "./cardAPI.js";
|
|
8
10
|
import { useCardMotionScope } from "./cardContext.js";
|
|
9
11
|
import { KIT_CARD_VARIANTS } from "./cardTypes.js";
|
|
10
12
|
import { bindLiftRecipes } from "../utils/slotMotion/recipes/bindLift.js";
|
|
@@ -40,6 +42,7 @@ function resolveCardMotionDefaults({
|
|
|
40
42
|
}
|
|
41
43
|
function useCardAnimations({
|
|
42
44
|
pressable,
|
|
45
|
+
disabled = false,
|
|
43
46
|
variant,
|
|
44
47
|
shadow = "base",
|
|
45
48
|
motion,
|
|
@@ -67,9 +70,19 @@ function useCardAnimations({
|
|
|
67
70
|
const secondLevelLift = useSecondLevelShadow(rootRef, hasHoverShadow, {
|
|
68
71
|
interactive: false,
|
|
69
72
|
shadowSize: shadow,
|
|
70
|
-
pointerInsideRef: hoverPointerInsideRef
|
|
73
|
+
pointerInsideRef: hoverPointerInsideRef,
|
|
74
|
+
killMotionOnUnmount: false
|
|
71
75
|
});
|
|
72
|
-
const
|
|
76
|
+
const config = useMotionConfig();
|
|
77
|
+
const hoverEnabled = !disabled && (pressable || motion?.root != null);
|
|
78
|
+
useLayoutEffect(() => {
|
|
79
|
+
if (!pressable || disabled || hoverPointerInsideRef.current) return;
|
|
80
|
+
const enterValue = scope.resolve("root", "enter", rootMotionRef.current);
|
|
81
|
+
const hoverValue = scope.resolve("root", "hoverIn", rootMotionRef.current);
|
|
82
|
+
if ((enterValue == null || enterValue === false) && isKitHoverLiftRecipe(hoverValue)) {
|
|
83
|
+
primeInteractiveScaleRest(rootRef.current, config);
|
|
84
|
+
}
|
|
85
|
+
}, [config, disabled, hoverPointerInsideRef, pressable, scope, variant]);
|
|
73
86
|
const playRoot = useCallback(
|
|
74
87
|
(phase) => {
|
|
75
88
|
const el = rootRef.current;
|
|
@@ -89,40 +102,58 @@ function useCardAnimations({
|
|
|
89
102
|
onHoverOut: () => playRoot("hoverOut")
|
|
90
103
|
});
|
|
91
104
|
useEffect(() => {
|
|
92
|
-
if (pressable) return;
|
|
105
|
+
if (pressable && !disabled) return;
|
|
93
106
|
const el = rootRef.current;
|
|
94
107
|
if (el) killMotion(el);
|
|
95
108
|
hoverPointerInsideRef.current = false;
|
|
96
|
-
}, [hoverPointerInsideRef, pressable]);
|
|
109
|
+
}, [disabled, hoverPointerInsideRef, pressable]);
|
|
97
110
|
const handlePointerDown = useCallback(
|
|
98
111
|
(e) => {
|
|
112
|
+
if (disabled) return;
|
|
99
113
|
onPointerDownProp?.(e);
|
|
100
114
|
if (!pressable || e.defaultPrevented) return;
|
|
115
|
+
if (isInteractiveCardDescendant(e.target, e.currentTarget)) return;
|
|
101
116
|
playRoot("pressIn");
|
|
102
117
|
},
|
|
103
|
-
[onPointerDownProp, playRoot, pressable]
|
|
118
|
+
[disabled, onPointerDownProp, playRoot, pressable]
|
|
104
119
|
);
|
|
105
120
|
const handlePointerUp = useCallback(
|
|
106
121
|
(e) => {
|
|
122
|
+
if (disabled) return;
|
|
107
123
|
onPointerUpProp?.(e);
|
|
108
124
|
if (!pressable || e.defaultPrevented) return;
|
|
125
|
+
if (isInteractiveCardDescendant(e.target, e.currentTarget)) return;
|
|
109
126
|
playRoot("pressOut");
|
|
110
127
|
},
|
|
111
|
-
[onPointerUpProp, playRoot, pressable]
|
|
128
|
+
[disabled, onPointerUpProp, playRoot, pressable]
|
|
112
129
|
);
|
|
113
130
|
const handleClick = useCallback(
|
|
114
131
|
(e) => {
|
|
132
|
+
if (disabled) {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
e.stopPropagation();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (isInteractiveCardDescendant(e.target, e.currentTarget)) return;
|
|
115
138
|
onClickProp?.(e);
|
|
116
139
|
},
|
|
117
|
-
[onClickProp]
|
|
140
|
+
[disabled, onClickProp]
|
|
118
141
|
);
|
|
119
142
|
const handleKeyDown = useCallback(
|
|
120
143
|
(e) => {
|
|
144
|
+
if (disabled) {
|
|
145
|
+
if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
e.stopPropagation();
|
|
148
|
+
}
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (isInteractiveCardDescendant(e.target, e.currentTarget)) return;
|
|
121
152
|
onKeyDownProp?.(e);
|
|
122
153
|
if (!pressable || e.defaultPrevented || !isInteractivePressKey(e)) return;
|
|
123
154
|
playRoot("pressIn");
|
|
124
155
|
},
|
|
125
|
-
[onKeyDownProp, playRoot, pressable]
|
|
156
|
+
[disabled, onKeyDownProp, playRoot, pressable]
|
|
126
157
|
);
|
|
127
158
|
const pointerHandlers = useMemo(
|
|
128
159
|
() => mergeMotionPointerHandlers(
|
|
@@ -17,4 +17,4 @@ export declare const CardDescription: import('react').ForwardRefExoticComponent<
|
|
|
17
17
|
export declare const CardFooter: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
|
|
18
18
|
motion?: import('../../../index.js').Prettify<import('./cardTypes.js').CardPartMotion>;
|
|
19
19
|
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
20
|
-
export declare function CardRootShell({ pressable, renderAsButton, href, asChild, rootClassName, setRootRef, rest, children, variant, size, onPointerOver, onPointerOut, onPointerDown, onPointerUp, onClick, onKeyDown, }: CardRootShellProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function CardRootShell({ pressable, renderAsButton, disabled, href, asChild, rootClassName, setRootRef, rest, children, variant, size, onPointerOver, onPointerOut, onPointerDown, onPointerUp, onClick, onKeyDown, }: CardRootShellProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, isValidElement, cloneElement } from "react";
|
|
4
|
-
import { dataVariantProps } from "../utils/dataContract.js";
|
|
4
|
+
import { dataFlag, dataVariantProps } from "../utils/dataContract.js";
|
|
5
|
+
import { mergeAsChildProps, getChildRef } from "../utils/mergeAsChildProps.js";
|
|
5
6
|
import { resolveSkinLayer } from "../../../skins/resolveSkinLayer.js";
|
|
6
7
|
import { SkinShell } from "../../../skins/skinShell.js";
|
|
7
8
|
import { cn } from "../../../utils/cn.js";
|
|
@@ -174,6 +175,7 @@ const CardFooter = forwardRef(
|
|
|
174
175
|
function CardRootShell({
|
|
175
176
|
pressable,
|
|
176
177
|
renderAsButton,
|
|
178
|
+
disabled = false,
|
|
177
179
|
href,
|
|
178
180
|
asChild = false,
|
|
179
181
|
rootClassName,
|
|
@@ -201,15 +203,31 @@ function CardRootShell({
|
|
|
201
203
|
);
|
|
202
204
|
const child = asChild && isValidElement(children) ? children : null;
|
|
203
205
|
const content = child ? child.props.children : children;
|
|
204
|
-
const fallback = child ? cloneElement(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
const fallback = child ? cloneElement(
|
|
207
|
+
child,
|
|
208
|
+
{
|
|
209
|
+
...mergeAsChildProps(
|
|
210
|
+
child,
|
|
211
|
+
{
|
|
212
|
+
className: shellClass,
|
|
213
|
+
onClick,
|
|
214
|
+
onKeyDown,
|
|
215
|
+
...disabled ? { "aria-disabled": true, tabIndex: -1 } : {}
|
|
216
|
+
},
|
|
217
|
+
getChildRef(child),
|
|
218
|
+
{ disabled }
|
|
219
|
+
),
|
|
220
|
+
...disabled ? { href: void 0 } : {}
|
|
221
|
+
}
|
|
222
|
+
) : href != null ? (
|
|
223
|
+
/* eslint-disable jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid, jsx-a11y/control-has-associated-label -- body is injected by SkinShell */
|
|
208
224
|
// react-doctor-disable-next-line react-doctor/anchor-has-content, react-doctor/control-has-associated-label -- body is injected by SkinShell
|
|
209
225
|
/* @__PURE__ */ jsx(
|
|
210
226
|
"a",
|
|
211
227
|
{
|
|
212
|
-
href,
|
|
228
|
+
href: disabled ? void 0 : href,
|
|
229
|
+
"aria-disabled": disabled || void 0,
|
|
230
|
+
tabIndex: disabled ? -1 : void 0,
|
|
213
231
|
className: shellClass,
|
|
214
232
|
onClick,
|
|
215
233
|
onKeyDown
|
|
@@ -221,6 +239,7 @@ function CardRootShell({
|
|
|
221
239
|
"button",
|
|
222
240
|
{
|
|
223
241
|
type: "button",
|
|
242
|
+
disabled: disabled || void 0,
|
|
224
243
|
className: shellClass,
|
|
225
244
|
onClick,
|
|
226
245
|
onKeyDown
|
|
@@ -232,6 +251,7 @@ function CardRootShell({
|
|
|
232
251
|
{
|
|
233
252
|
...rest,
|
|
234
253
|
...dataVariantProps({ size, variant }),
|
|
254
|
+
"data-disabled": dataFlag(disabled),
|
|
235
255
|
part: "card.root",
|
|
236
256
|
variant,
|
|
237
257
|
scope,
|
|
@@ -9,15 +9,16 @@ export declare const CARD_ROOT_BASE_CLASS = "flex min-w-0 flex-col text-foregrou
|
|
|
9
9
|
/** Clips a passive card. Pressable moves this onto the inner face so fade layers can paint. */
|
|
10
10
|
export declare const CARD_ROOT_CLIP_CLASS = "overflow-hidden";
|
|
11
11
|
export declare const CARD_PRESSABLE_ROOT_CLASS = "relative cursor-pointer focus-ring";
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const CARD_PRESSABLE_DISABLED_ROOT_CLASS = "relative cursor-not-allowed opacity-50 focus-ring";
|
|
13
|
+
export declare const CARD_BUTTON_SHELL_CLASS = "w-full border-0 p-0 text-start focus-ring";
|
|
13
14
|
export declare const CARD_PRESSABLE_CONTENT_CLASS = "relative flex min-w-0 flex-1 flex-col overflow-hidden rounded-[inherit]";
|
|
14
15
|
export declare const CARD_HEADER_BASE_CLASS = "flex shrink-0 flex-col text-start";
|
|
15
16
|
export declare const CARD_HEADING_BLOCK_BASE_CLASS = "flex min-w-0 flex-1 flex-col text-start";
|
|
16
17
|
export declare const CARD_BODY_BASE_CLASS = "min-w-0";
|
|
17
18
|
export declare const CARD_TITLE_CLASS = "min-w-0";
|
|
18
|
-
export declare const CARD_DESCRIPTION_CLASS = "min-w-0 text-muted";
|
|
19
|
-
export declare const CARD_FOOTER_BASE_CLASS = "mt-auto border-t-token text-muted";
|
|
20
|
-
export declare function cardRootClass(variant: CardVariant, pressable: boolean, pressableMotionClass: string, size: CardSize, shadow?: ShadowLevel, className?: string): string;
|
|
19
|
+
export declare const CARD_DESCRIPTION_CLASS = "min-w-0 text-muted-foreground";
|
|
20
|
+
export declare const CARD_FOOTER_BASE_CLASS = "mt-auto border-t-token text-muted-foreground";
|
|
21
|
+
export declare function cardRootClass(variant: CardVariant, pressable: boolean, pressableMotionClass: string, size: CardSize, shadow?: ShadowLevel, className?: string, disabled?: boolean): string;
|
|
21
22
|
export declare function cardHeaderClass(size: CardSize, className?: string): string;
|
|
22
23
|
export declare function cardHeadingBlockClass(size: CardSize, className?: string): string;
|
|
23
24
|
export declare function cardBodyClass(size: CardSize, className?: string): string;
|
|
@@ -18,22 +18,24 @@ const CARD_STATIC_SHADOW_CLASS = {
|
|
|
18
18
|
const CARD_ROOT_BASE_CLASS = "flex min-w-0 flex-col text-foreground outline-none";
|
|
19
19
|
const CARD_ROOT_CLIP_CLASS = "overflow-hidden";
|
|
20
20
|
const CARD_PRESSABLE_ROOT_CLASS = "relative cursor-pointer focus-ring";
|
|
21
|
-
const
|
|
21
|
+
const CARD_PRESSABLE_DISABLED_ROOT_CLASS = "relative cursor-not-allowed opacity-50 focus-ring";
|
|
22
|
+
const CARD_BUTTON_SHELL_CLASS = "w-full border-0 p-0 text-start focus-ring";
|
|
22
23
|
const CARD_PRESSABLE_CONTENT_CLASS = "relative flex min-w-0 flex-1 flex-col overflow-hidden rounded-[inherit]";
|
|
23
24
|
const CARD_HEADER_BASE_CLASS = "flex shrink-0 flex-col text-start";
|
|
24
25
|
const CARD_HEADING_BLOCK_BASE_CLASS = "flex min-w-0 flex-1 flex-col text-start";
|
|
25
26
|
const CARD_BODY_BASE_CLASS = "min-w-0";
|
|
26
27
|
const CARD_TITLE_CLASS = "min-w-0";
|
|
27
|
-
const CARD_DESCRIPTION_CLASS = "min-w-0 text-muted";
|
|
28
|
-
const CARD_FOOTER_BASE_CLASS = "mt-auto border-t-token text-muted";
|
|
29
|
-
function cardRootClass(variant, pressable, pressableMotionClass, size, shadow = "base", className) {
|
|
28
|
+
const CARD_DESCRIPTION_CLASS = "min-w-0 text-muted-foreground";
|
|
29
|
+
const CARD_FOOTER_BASE_CLASS = "mt-auto border-t-token text-muted-foreground";
|
|
30
|
+
function cardRootClass(variant, pressable, pressableMotionClass, size, shadow = "base", className, disabled = false) {
|
|
30
31
|
const visual = resolveVariantVisual(variant, KIT_CARD_VARIANTS, "card.root");
|
|
32
|
+
const interactiveRootClass = disabled ? CARD_PRESSABLE_DISABLED_ROOT_CLASS : CARD_PRESSABLE_ROOT_CLASS;
|
|
31
33
|
if (visual.className !== void 0) {
|
|
32
34
|
return cn(
|
|
33
35
|
CARD_ROOT_BASE_CLASS,
|
|
34
36
|
panelSizeLayout(size).rounded,
|
|
35
37
|
!pressable && CARD_ROOT_CLIP_CLASS,
|
|
36
|
-
pressable && cn(
|
|
38
|
+
pressable && cn(interactiveRootClass, pressableMotionClass),
|
|
37
39
|
visual.className,
|
|
38
40
|
className
|
|
39
41
|
);
|
|
@@ -42,7 +44,7 @@ function cardRootClass(variant, pressable, pressableMotionClass, size, shadow =
|
|
|
42
44
|
CARD_ROOT_BASE_CLASS,
|
|
43
45
|
panelSizeLayout(size).rounded,
|
|
44
46
|
!pressable && CARD_ROOT_CLIP_CLASS,
|
|
45
|
-
pressable && cn(
|
|
47
|
+
pressable && cn(interactiveRootClass, pressableMotionClass),
|
|
46
48
|
SURFACE_COLOR_TRANSITION,
|
|
47
49
|
CARD_SURFACE[visual.key],
|
|
48
50
|
!pressable && CARD_STATIC_SHADOW_CLASS[shadow],
|
|
@@ -86,6 +88,7 @@ export {
|
|
|
86
88
|
CARD_HEADER_BASE_CLASS,
|
|
87
89
|
CARD_HEADING_BLOCK_BASE_CLASS,
|
|
88
90
|
CARD_PRESSABLE_CONTENT_CLASS,
|
|
91
|
+
CARD_PRESSABLE_DISABLED_ROOT_CLASS,
|
|
89
92
|
CARD_PRESSABLE_ROOT_CLASS,
|
|
90
93
|
CARD_ROOT_BASE_CLASS,
|
|
91
94
|
CARD_ROOT_CLIP_CLASS,
|
|
@@ -50,6 +50,8 @@ export type CardProps = Omit<HTMLAttributes<HTMLElement>, "onClick" | "onKeyDown
|
|
|
50
50
|
* Do not place other buttons/links inside without `stopPropagation` on their click — otherwise the card `onClick` will also trigger.
|
|
51
51
|
*/
|
|
52
52
|
pressable?: boolean;
|
|
53
|
+
/** Disables interaction on a pressable card. */
|
|
54
|
+
disabled?: boolean;
|
|
53
55
|
/** Renders the pressable shell as a link. */
|
|
54
56
|
href?: string;
|
|
55
57
|
/**
|
|
@@ -100,6 +102,7 @@ export type CardProviderProps = {
|
|
|
100
102
|
export type UseCardRootStateProps = Pick<CardProps, "variant" | "size" | "pressable" | "className" | "onClick" | "onKeyDown" | "onPointerDown">;
|
|
101
103
|
export type UseCardAnimationsProps = {
|
|
102
104
|
pressable: boolean;
|
|
105
|
+
disabled?: boolean;
|
|
103
106
|
variant: CardVariant;
|
|
104
107
|
shadow?: ShadowLevel;
|
|
105
108
|
motion?: CardMotion;
|
|
@@ -115,6 +118,7 @@ export type UseCardAnimationsProps = {
|
|
|
115
118
|
export type CardRootShellProps = {
|
|
116
119
|
pressable: boolean;
|
|
117
120
|
renderAsButton: boolean;
|
|
121
|
+
disabled?: boolean;
|
|
118
122
|
href?: string;
|
|
119
123
|
asChild?: boolean;
|
|
120
124
|
rootClassName: string;
|
|
@@ -3,6 +3,7 @@ export declare const Card: import('react').ForwardRefExoticComponent<Omit<import
|
|
|
3
3
|
size?: import('./cardTypes.js').CardSize;
|
|
4
4
|
shadow?: import('../../../index.js').ShadowLevel;
|
|
5
5
|
pressable?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
href?: string;
|
|
7
8
|
asChild?: boolean;
|
|
8
9
|
onClick?: import('react').HTMLAttributes<HTMLElement>["onClick"];
|