burne-ui 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/cli/burne-ui.js +4 -3
- package/cli/init.js +83 -19
- package/cli/skin-live-slots.json +1 -1
- package/cli/skin-slots.json +2 -0
- package/cli/skin-validate.mjs +83 -2
- package/cli/tailwind.css +20 -0
- package/cli/theme-bridge.css +6 -0
- package/dist/authoring.d.ts +2 -0
- package/dist/authoring.js +8 -0
- package/dist/components/composite/Accordion/accordionStyles.js +1 -1
- package/dist/components/composite/Accordion/useAccordionRootState.js +6 -2
- package/dist/components/composite/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/components/composite/AlertDialog/AlertDialog.js +1 -0
- package/dist/components/composite/AlertDialog/alertDialogAnimations.d.ts +1 -0
- package/dist/components/composite/AlertDialog/alertDialogAnimations.js +1 -0
- package/dist/components/composite/AlertDialog/alertDialogParts.d.ts +5 -7
- package/dist/components/composite/AlertDialog/alertDialogParts.js +92 -37
- package/dist/components/composite/AlertDialog/alertDialogStyles.d.ts +3 -2
- package/dist/components/composite/AlertDialog/alertDialogStyles.js +5 -3
- package/dist/components/composite/AlertDialog/alertDialogTypes.d.ts +8 -8
- package/dist/components/composite/AlertDialog/index.d.ts +4 -6
- package/dist/components/composite/AlertDialog/useAlertDialogRootState.d.ts +1 -1
- package/dist/components/composite/AlertDialog/useAlertDialogRootState.js +13 -1
- package/dist/components/composite/ButtonGroup/ButtonGroup.d.ts +1 -0
- package/dist/components/composite/ButtonGroup/ButtonGroup.js +59 -25
- package/dist/components/composite/ButtonGroup/buttonGroupAPI.d.ts +1 -0
- package/dist/components/composite/ButtonGroup/buttonGroupAPI.js +7 -1
- package/dist/components/composite/ButtonGroup/buttonGroupContext.d.ts +3 -2
- package/dist/components/composite/ButtonGroup/buttonGroupContext.js +4 -3
- package/dist/components/composite/ButtonGroup/buttonGroupStyles.js +1 -1
- package/dist/components/composite/ButtonGroup/buttonGroupTypes.d.ts +3 -1
- package/dist/components/composite/ButtonGroup/index.d.ts +1 -0
- package/dist/components/composite/CheckboxGroup/CheckboxGroup.js +25 -7
- package/dist/components/composite/CheckboxGroup/useCheckboxGroupRootState.d.ts +5 -1
- package/dist/components/composite/CheckboxGroup/useCheckboxGroupRootState.js +74 -23
- package/dist/components/composite/Form/Form.js +6 -0
- package/dist/components/composite/Form/formAPI.d.ts +2 -0
- package/dist/components/composite/Form/formAPI.js +29 -2
- package/dist/components/composite/Form/formContext.js +4 -0
- package/dist/components/composite/Form/formParts.js +20 -6
- package/dist/components/composite/Form/formStyles.js +4 -4
- package/dist/components/composite/Form/useFormControlProps.js +25 -15
- package/dist/components/composite/Form/useFormFieldBinding.js +22 -14
- package/dist/components/composite/Form/useFormRootState.d.ts +2 -1
- package/dist/components/composite/Form/useFormRootState.js +151 -89
- package/dist/components/composite/RadioGroup/RadioGroup.js +30 -10
- package/dist/components/composite/RadioGroup/radioGroupA11y.d.ts +10 -0
- package/dist/components/composite/RadioGroup/radioGroupA11y.js +75 -0
- package/dist/components/composite/RadioGroup/radioGroupTypes.d.ts +2 -2
- package/dist/components/composite/RadioGroup/useRadioGroupRootState.d.ts +7 -1
- package/dist/components/composite/RadioGroup/useRadioGroupRootState.js +105 -34
- package/dist/components/composite/ToggleButtonGroup/ToggleButtonGroup.js +3 -1
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupA11y.d.ts +1 -1
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupA11y.js +13 -7
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupAPI.d.ts +2 -0
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupAPI.js +19 -4
- package/dist/components/composite/ToggleButtonGroup/useToggleButtonGroupRootState.js +20 -7
- package/dist/components/composite/utils/optionGroupFieldset.d.ts +1 -1
- package/dist/components/core/Alert/Alert.js +3 -1
- package/dist/components/core/Alert/alertAnimations.js +14 -3
- package/dist/components/core/Alert/alertStyles.d.ts +1 -1
- package/dist/components/core/Alert/alertStyles.js +1 -1
- package/dist/components/core/AppShell/AppShell.js +16 -4
- package/dist/components/core/AppShell/appShellAnimations.js +1 -1
- package/dist/components/core/AppShell/appShellStyles.d.ts +3 -2
- package/dist/components/core/AppShell/appShellStyles.js +8 -2
- package/dist/components/core/AspectRatio/AspectRatio.js +6 -3
- package/dist/components/core/AspectRatio/aspectRatioAnimations.js +1 -1
- package/dist/components/core/AspectRatio/aspectRatioStyles.d.ts +5 -2
- package/dist/components/core/AspectRatio/aspectRatioStyles.js +27 -3
- package/dist/components/core/Avatar/avatarParts.js +26 -6
- package/dist/components/core/Avatar/avatarTypes.d.ts +1 -0
- package/dist/components/core/Avatar/useAvatarRootState.d.ts +1 -0
- package/dist/components/core/Avatar/useAvatarRootState.js +6 -2
- package/dist/components/core/Badge/Badge.js +9 -3
- package/dist/components/core/Badge/badgeA11y.js +6 -0
- package/dist/components/core/Badge/badgeAPI.js +4 -4
- package/dist/components/core/Badge/badgeAnimations.js +18 -3
- package/dist/components/core/Badge/badgeParts.d.ts +1 -1
- package/dist/components/core/Badge/badgeParts.js +6 -3
- package/dist/components/core/Badge/badgeStyles.d.ts +1 -0
- package/dist/components/core/Badge/badgeStyles.js +2 -0
- package/dist/components/core/Badge/badgeTypes.d.ts +2 -0
- package/dist/components/core/Badge/useBadgeRootState.d.ts +1 -0
- package/dist/components/core/Badge/useBadgeRootState.js +2 -1
- package/dist/components/core/Breadcrumbs/breadcrumbsAPI.js +11 -5
- package/dist/components/core/Breadcrumbs/breadcrumbsParts.js +21 -6
- package/dist/components/core/Breadcrumbs/breadcrumbsStyles.js +4 -4
- package/dist/components/core/Button/Button.js +34 -18
- package/dist/components/core/Button/buttonAnimations.d.ts +1 -1
- package/dist/components/core/Button/buttonAnimations.js +18 -7
- package/dist/components/core/Button/buttonParts.js +2 -2
- package/dist/components/core/Button/buttonStyles.d.ts +4 -3
- package/dist/components/core/Button/buttonStyles.js +11 -10
- package/dist/components/core/Button/buttonTypes.d.ts +2 -1
- package/dist/components/core/Button/useButtonRootState.d.ts +2 -1
- package/dist/components/core/Button/useButtonRootState.js +10 -4
- package/dist/components/core/Calendar/Calendar.js +15 -4
- package/dist/components/core/Calendar/calendarAPI.d.ts +10 -6
- package/dist/components/core/Calendar/calendarAPI.js +110 -30
- package/dist/components/core/Calendar/calendarParts.js +173 -72
- package/dist/components/core/Calendar/calendarStyles.d.ts +5 -5
- package/dist/components/core/Calendar/calendarStyles.js +8 -8
- package/dist/components/core/Calendar/calendarTypes.d.ts +8 -0
- package/dist/components/core/Calendar/useCalendarRootState.js +60 -19
- package/dist/components/core/Calendar/useCalendarViewModels.js +6 -6
- package/dist/components/core/Card/Card.d.ts +1 -0
- package/dist/components/core/Card/Card.js +17 -7
- package/dist/components/core/Card/cardAPI.d.ts +1 -0
- package/dist/components/core/Card/cardAPI.js +23 -1
- package/dist/components/core/Card/cardAnimations.d.ts +1 -1
- package/dist/components/core/Card/cardAnimations.js +41 -10
- package/dist/components/core/Card/cardParts.d.ts +1 -1
- package/dist/components/core/Card/cardParts.js +26 -6
- package/dist/components/core/Card/cardStyles.d.ts +5 -4
- package/dist/components/core/Card/cardStyles.js +9 -6
- package/dist/components/core/Card/cardTypes.d.ts +4 -0
- package/dist/components/core/Card/index.d.ts +1 -0
- package/dist/components/core/Checkbox/Checkbox.js +9 -1
- package/dist/components/core/Checkbox/checkboxAPI.d.ts +2 -0
- package/dist/components/core/Checkbox/checkboxAPI.js +36 -0
- package/dist/components/core/Checkbox/checkboxParts.d.ts +5 -4
- package/dist/components/core/Checkbox/checkboxParts.js +74 -48
- package/dist/components/core/Checkbox/checkboxStyles.d.ts +4 -3
- package/dist/components/core/Checkbox/checkboxStyles.js +5 -3
- package/dist/components/core/Checkbox/checkboxTypes.d.ts +2 -0
- package/dist/components/core/Checkbox/index.d.ts +1 -1
- package/dist/components/core/Checkbox/useCheckboxRootState.d.ts +4 -1
- package/dist/components/core/Checkbox/useCheckboxRootState.js +43 -30
- package/dist/components/core/CloseButton/CloseButton.js +2 -1
- package/dist/components/core/CloseButton/closeButtonAnimations.js +38 -9
- package/dist/components/core/CloseButton/closeButtonParts.js +3 -4
- package/dist/components/core/ColorPicker/ColorPicker.js +27 -8
- package/dist/components/core/ColorPicker/ColorSlider.d.ts +2 -0
- package/dist/components/core/ColorPicker/ColorSlider.js +131 -53
- package/dist/components/core/ColorPicker/ColorSwatch.js +22 -4
- package/dist/components/core/ColorPicker/colorPickerAnimations.d.ts +1 -1
- package/dist/components/core/ColorPicker/colorPickerAnimations.js +33 -8
- package/dist/components/core/ColorPicker/colorPickerParts.js +125 -32
- package/dist/components/core/ColorPicker/colorPickerStyles.d.ts +11 -3
- package/dist/components/core/ColorPicker/colorPickerStyles.js +13 -3
- package/dist/components/core/ColorPicker/colorPickerTypes.d.ts +4 -0
- package/dist/components/core/ColorPicker/colorSliderStyles.d.ts +2 -2
- package/dist/components/core/ColorPicker/colorSliderStyles.js +4 -4
- package/dist/components/core/ColorPicker/colorSliderTypes.d.ts +2 -0
- package/dist/components/core/ColorPicker/colorSwatchStyles.d.ts +1 -0
- package/dist/components/core/ColorPicker/colorSwatchStyles.js +4 -0
- package/dist/components/core/ColorPicker/colorUtils.d.ts +2 -1
- package/dist/components/core/ColorPicker/colorUtils.js +33 -10
- package/dist/components/core/ColorPicker/index.d.ts +2 -0
- package/dist/components/core/ColorPicker/useColorPickerRootState.d.ts +3 -1
- package/dist/components/core/ColorPicker/useColorPickerRootState.js +65 -30
- package/dist/components/core/ComboBox/ComboBox.js +13 -1
- package/dist/components/core/ComboBox/comboBoxAnimations.d.ts +3 -2
- package/dist/components/core/ComboBox/comboBoxAnimations.js +5 -2
- package/dist/components/core/ComboBox/comboBoxFieldParts.js +1 -1
- package/dist/components/core/ComboBox/comboBoxParts.d.ts +3 -1
- package/dist/components/core/ComboBox/comboBoxParts.js +114 -28
- package/dist/components/core/ComboBox/comboBoxStyles.d.ts +4 -4
- package/dist/components/core/ComboBox/comboBoxStyles.js +4 -4
- package/dist/components/core/ComboBox/comboBoxTypes.d.ts +5 -0
- package/dist/components/core/ComboBox/useComboBoxInputState.d.ts +3 -2
- package/dist/components/core/ComboBox/useComboBoxInputState.js +130 -62
- package/dist/components/core/ComboBox/useComboBoxRootState.js +44 -18
- package/dist/components/core/Container/Container.js +3 -0
- package/dist/components/core/Container/containerStyles.d.ts +2 -1
- package/dist/components/core/Container/containerStyles.js +2 -1
- package/dist/components/core/ContextMenu/ContextMenu.d.ts +3 -1
- package/dist/components/core/ContextMenu/ContextMenu.js +177 -19
- package/dist/components/core/ContextMenu/contextMenuStyles.d.ts +1 -1
- package/dist/components/core/ContextMenu/contextMenuStyles.js +1 -1
- package/dist/components/core/ContextMenu/index.d.ts +3 -1
- package/dist/components/core/DatePicker/DatePicker.js +8 -3
- package/dist/components/core/DatePicker/datePickerAPI.d.ts +2 -0
- package/dist/components/core/DatePicker/datePickerAPI.js +43 -0
- package/dist/components/core/DatePicker/datePickerAnimations.d.ts +2 -1
- package/dist/components/core/DatePicker/datePickerAnimations.js +9 -5
- package/dist/components/core/DatePicker/datePickerParts.js +29 -5
- package/dist/components/core/DatePicker/datePickerStyles.d.ts +2 -2
- package/dist/components/core/DatePicker/datePickerStyles.js +2 -2
- package/dist/components/core/DatePicker/datePickerTypes.d.ts +2 -0
- package/dist/components/core/DatePicker/useDatePickerRootState.d.ts +2 -0
- package/dist/components/core/DatePicker/useDatePickerRootState.js +63 -24
- package/dist/components/core/Dialog/Dialog.d.ts +1 -1
- package/dist/components/core/Dialog/Dialog.js +2 -0
- package/dist/components/core/Dialog/dialogAnimations.d.ts +1 -0
- package/dist/components/core/Dialog/dialogAnimations.js +1 -0
- package/dist/components/core/Dialog/dialogParts.d.ts +1 -1
- package/dist/components/core/Dialog/dialogParts.js +8 -3
- package/dist/components/core/Dialog/dialogStyles.d.ts +1 -1
- package/dist/components/core/Dialog/dialogStyles.js +2 -2
- package/dist/components/core/Dialog/dialogTypes.d.ts +4 -1
- package/dist/components/core/Dialog/useDialogRootState.d.ts +1 -1
- package/dist/components/core/Dialog/useDialogRootState.js +2 -0
- package/dist/components/core/Disclosure/Disclosure.js +10 -4
- package/dist/components/core/Disclosure/disclosureAnimations.js +7 -5
- package/dist/components/core/Disclosure/disclosureContentPart.js +3 -0
- package/dist/components/core/Disclosure/disclosureParts.js +29 -20
- package/dist/components/core/Disclosure/disclosureStyles.d.ts +1 -1
- package/dist/components/core/Disclosure/disclosureStyles.js +3 -3
- package/dist/components/core/Disclosure/useDisclosureContentDrag.js +3 -1
- package/dist/components/core/Disclosure/useDisclosureGroupRootState.js +17 -7
- package/dist/components/core/Disclosure/useDisclosureRootState.js +12 -12
- package/dist/components/core/Drawer/Drawer.d.ts +1 -1
- package/dist/components/core/Drawer/Drawer.js +2 -0
- package/dist/components/core/Drawer/drawerAnimations.d.ts +1 -0
- package/dist/components/core/Drawer/drawerAnimations.js +1 -0
- package/dist/components/core/Drawer/drawerParts.js +14 -9
- package/dist/components/core/Drawer/drawerStyles.d.ts +1 -1
- package/dist/components/core/Drawer/drawerStyles.js +2 -2
- package/dist/components/core/Drawer/drawerTypes.d.ts +4 -1
- package/dist/components/core/Drawer/useDrawerHandleDrag.d.ts +2 -0
- package/dist/components/core/Drawer/useDrawerHandleDrag.js +117 -35
- package/dist/components/core/Drawer/useDrawerRootState.d.ts +1 -1
- package/dist/components/core/Drawer/useDrawerRootState.js +3 -0
- package/dist/components/core/Dropdown/dropdownA11y.js +4 -1
- package/dist/components/core/Dropdown/dropdownAnimations.d.ts +3 -2
- package/dist/components/core/Dropdown/dropdownAnimations.js +79 -29
- package/dist/components/core/Dropdown/dropdownItemParts.d.ts +3 -1
- package/dist/components/core/Dropdown/dropdownItemParts.js +25 -5
- package/dist/components/core/Dropdown/dropdownParts.js +40 -11
- package/dist/components/core/Dropdown/dropdownStyles.d.ts +3 -3
- package/dist/components/core/Dropdown/dropdownStyles.js +3 -3
- package/dist/components/core/Dropdown/dropdownSubParts.js +47 -16
- package/dist/components/core/Dropdown/dropdownTypes.d.ts +13 -2
- package/dist/components/core/Dropdown/index.d.ts +3 -1
- package/dist/components/core/Dropdown/useDropdownItemState.d.ts +5 -1
- package/dist/components/core/Dropdown/useDropdownItemState.js +3 -1
- package/dist/components/core/Dropdown/useDropdownRootState.js +16 -5
- package/dist/components/core/Expandable/expandableA11y.d.ts +1 -0
- package/dist/components/core/Expandable/expandableA11y.js +5 -0
- package/dist/components/core/Expandable/expandableAPI.d.ts +1 -0
- package/dist/components/core/Expandable/expandableAPI.js +19 -11
- package/dist/components/core/Expandable/expandableAnimations.d.ts +1 -1
- package/dist/components/core/Expandable/expandableAnimations.js +9 -9
- package/dist/components/core/Expandable/expandableParts.js +31 -23
- package/dist/components/core/Expandable/expandableStyles.d.ts +1 -1
- package/dist/components/core/Expandable/expandableStyles.js +1 -1
- package/dist/components/core/Expandable/useExpandableRootState.js +5 -3
- package/dist/components/core/Field/fieldParts.d.ts +2 -2
- package/dist/components/core/Field/fieldParts.js +2 -1
- package/dist/components/core/Field/fieldStyles.js +1 -1
- package/dist/components/core/Grid/Grid.js +3 -0
- package/dist/components/core/Grid/gridStyles.d.ts +2 -1
- package/dist/components/core/Grid/gridStyles.js +2 -1
- package/dist/components/core/Header/Header.js +3 -1
- package/dist/components/core/Header/headerStyles.d.ts +3 -2
- package/dist/components/core/Header/headerStyles.js +9 -2
- package/dist/components/core/HoverCard/hoverCardParts.js +23 -11
- package/dist/components/core/Input/inputAffixParts.js +6 -0
- package/dist/components/core/Input/inputAnimations.js +3 -1
- package/dist/components/core/Input/inputControlParts.js +48 -14
- package/dist/components/core/Input/inputFieldParts.js +1 -1
- package/dist/components/core/Input/inputStyles.d.ts +5 -5
- package/dist/components/core/Input/inputStyles.js +5 -5
- package/dist/components/core/Input/inputTypes.d.ts +1 -0
- package/dist/components/core/Input/useInputRootState.js +2 -1
- package/dist/components/core/Kbd/Kbd.js +3 -1
- package/dist/components/core/Kbd/kbdAnimations.js +16 -4
- package/dist/components/core/Kbd/kbdParts.js +6 -4
- package/dist/components/core/Kbd/kbdStyles.d.ts +1 -1
- package/dist/components/core/Kbd/kbdStyles.js +1 -1
- package/dist/components/core/Kbd/kbdTextPart.js +5 -2
- package/dist/components/core/Kbd/useKbdRootState.js +6 -2
- package/dist/components/core/Label/Label.d.ts +2 -1
- package/dist/components/core/Label/Label.js +8 -1
- package/dist/components/core/Label/labelParts.d.ts +1 -0
- package/dist/components/core/Label/labelTypes.d.ts +3 -1
- package/dist/components/core/Label/useLabelRootState.d.ts +2 -1
- package/dist/components/core/Label/useLabelRootState.js +3 -1
- package/dist/components/core/Link/Link.d.ts +1 -1
- package/dist/components/core/Link/Link.js +38 -25
- package/dist/components/core/Link/linkAPI.d.ts +3 -1
- package/dist/components/core/Link/linkAPI.js +8 -4
- package/dist/components/core/Link/linkAnchorBodyPart.d.ts +2 -2
- package/dist/components/core/Link/linkAnchorBodyPart.js +48 -8
- package/dist/components/core/Link/linkAnimations.d.ts +1 -1
- package/dist/components/core/Link/linkAnimations.js +29 -14
- package/dist/components/core/Link/linkIconSlotPart.d.ts +1 -1
- package/dist/components/core/Link/linkIconSlotPart.js +3 -3
- package/dist/components/core/Link/linkStyles.d.ts +5 -3
- package/dist/components/core/Link/linkStyles.js +6 -3
- package/dist/components/core/Link/linkTypes.d.ts +14 -1
- package/dist/components/core/Link/useLinkRootState.d.ts +2 -0
- package/dist/components/core/ListBox/ListBox.d.ts +1 -0
- package/dist/components/core/ListBox/ListBox.js +2 -0
- package/dist/components/core/ListBox/index.d.ts +1 -0
- package/dist/components/core/ListBox/listBoxAnimations.d.ts +5 -2
- package/dist/components/core/ListBox/listBoxAnimations.js +15 -3
- package/dist/components/core/ListBox/listBoxParts.js +21 -5
- package/dist/components/core/ListBox/listBoxStyles.d.ts +3 -3
- package/dist/components/core/ListBox/listBoxStyles.js +3 -3
- package/dist/components/core/ListBox/listBoxTypes.d.ts +5 -1
- package/dist/components/core/ListBox/useListBoxItemState.d.ts +1 -1
- package/dist/components/core/ListBox/useListBoxRootState.d.ts +1 -1
- package/dist/components/core/ListBox/useListBoxRootState.js +31 -6
- package/dist/components/core/ListBox/useListBoxVirtualWindow.d.ts +1 -0
- package/dist/components/core/ListBox/useListBoxVirtualWindow.js +11 -4
- package/dist/components/core/Loading/Loading.js +1 -1
- package/dist/components/core/Loading/loadingAnimations.d.ts +2 -2
- package/dist/components/core/Loading/loadingAnimations.js +12 -5
- package/dist/components/core/Loading/loadingParts.js +1 -1
- package/dist/components/core/Loading/loadingStyles.js +1 -1
- package/dist/components/core/Meter/Meter.js +21 -3
- package/dist/components/core/Meter/meterAPI.d.ts +4 -0
- package/dist/components/core/Meter/meterAPI.js +13 -2
- package/dist/components/core/Meter/meterParts.js +6 -2
- package/dist/components/core/Meter/meterStyles.d.ts +1 -1
- package/dist/components/core/Meter/meterStyles.js +1 -1
- package/dist/components/core/Meter/meterTypes.d.ts +1 -0
- package/dist/components/core/Meter/useMeterRootState.js +3 -2
- package/dist/components/core/Meter/useMeterTrackState.d.ts +1 -1
- package/dist/components/core/Meter/useMeterTrackState.js +15 -10
- package/dist/components/core/NumberInput/NumberInput.js +13 -2
- package/dist/components/core/NumberInput/numberInputParts.d.ts +4 -1
- package/dist/components/core/NumberInput/numberInputParts.js +30 -4
- package/dist/components/core/NumberInput/numberInputStyles.js +2 -2
- package/dist/components/core/NumberInput/useNumberInputRootState.js +47 -33
- package/dist/components/core/Pagination/paginationAPI.d.ts +4 -1
- package/dist/components/core/Pagination/paginationAPI.js +60 -17
- package/dist/components/core/Pagination/paginationAnimations.js +6 -0
- package/dist/components/core/Pagination/paginationParts.d.ts +1 -1
- package/dist/components/core/Pagination/paginationParts.js +82 -22
- package/dist/components/core/Pagination/paginationStyles.d.ts +7 -6
- package/dist/components/core/Pagination/paginationStyles.js +7 -6
- package/dist/components/core/Pagination/paginationTypes.d.ts +1 -0
- package/dist/components/core/Pagination/usePaginationRootState.js +12 -6
- package/dist/components/core/PinInput/pinInputAnimations.d.ts +6 -1
- package/dist/components/core/PinInput/pinInputAnimations.js +13 -4
- package/dist/components/core/PinInput/pinInputParts.js +84 -20
- package/dist/components/core/PinInput/pinInputStyles.d.ts +1 -1
- package/dist/components/core/PinInput/pinInputStyles.js +2 -2
- package/dist/components/core/PinInput/pinInputTypes.d.ts +4 -0
- package/dist/components/core/PinInput/usePinInputRootState.js +71 -33
- package/dist/components/core/Popover/popoverAnimations.d.ts +1 -0
- package/dist/components/core/Popover/popoverAnimations.js +33 -7
- package/dist/components/core/Popover/popoverParts.js +62 -14
- package/dist/components/core/Popover/popoverStyles.d.ts +1 -1
- package/dist/components/core/Popover/popoverStyles.js +1 -1
- package/dist/components/core/Popover/popoverTypes.d.ts +1 -0
- package/dist/components/core/Popover/usePopoverRootState.js +46 -14
- package/dist/components/core/ProgressBar/ProgressBar.js +21 -3
- package/dist/components/core/ProgressBar/progressBarA11y.d.ts +1 -1
- package/dist/components/core/ProgressBar/progressBarA11y.js +4 -2
- package/dist/components/core/ProgressBar/progressBarAPI.d.ts +4 -0
- package/dist/components/core/ProgressBar/progressBarAPI.js +13 -2
- package/dist/components/core/ProgressBar/progressBarParts.js +6 -2
- package/dist/components/core/ProgressBar/progressBarStyles.d.ts +1 -1
- package/dist/components/core/ProgressBar/progressBarStyles.js +1 -1
- package/dist/components/core/ProgressBar/progressBarTypes.d.ts +3 -0
- package/dist/components/core/ProgressBar/useProgressBarRootState.js +6 -3
- package/dist/components/core/ProgressBar/useProgressBarTrackState.d.ts +1 -1
- package/dist/components/core/ProgressBar/useProgressBarTrackState.js +18 -11
- package/dist/components/core/Radio/Radio.js +6 -1
- package/dist/components/core/Radio/radioParts.js +6 -3
- package/dist/components/core/Radio/radioStyles.d.ts +3 -3
- package/dist/components/core/Radio/radioStyles.js +3 -3
- package/dist/components/core/Radio/radioTypes.d.ts +1 -0
- package/dist/components/core/Radio/useRadioRootState.d.ts +5 -2
- package/dist/components/core/Radio/useRadioRootState.js +80 -36
- package/dist/components/core/Resizable/Resizable.js +185 -20
- package/dist/components/core/Resizable/index.d.ts +1 -0
- package/dist/components/core/Resizable/resizableAnimations.js +1 -1
- package/dist/components/core/Resizable/resizableParts.d.ts +1 -0
- package/dist/components/core/Resizable/resizableParts.js +96 -42
- package/dist/components/core/Resizable/resizableStyles.d.ts +3 -2
- package/dist/components/core/Resizable/resizableStyles.js +3 -2
- package/dist/components/core/Resizable/resizableTypes.d.ts +10 -2
- package/dist/components/core/Ripple/Ripple.js +3 -2
- package/dist/components/core/Ripple/rippleAPI.d.ts +1 -0
- package/dist/components/core/Ripple/rippleAPI.js +7 -0
- package/dist/components/core/Ripple/rippleStyles.d.ts +1 -1
- package/dist/components/core/Ripple/rippleStyles.js +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/core/ScrollArea/scrollAreaAPI.d.ts +11 -2
- package/dist/components/core/ScrollArea/scrollAreaAPI.js +65 -9
- package/dist/components/core/ScrollArea/scrollAreaParts.js +31 -10
- package/dist/components/core/ScrollArea/scrollAreaStyles.d.ts +1 -1
- package/dist/components/core/ScrollArea/scrollAreaStyles.js +1 -1
- package/dist/components/core/ScrollArea/scrollAreaTypes.d.ts +4 -0
- package/dist/components/core/ScrollArea/useScrollAreaRootState.d.ts +1 -1
- package/dist/components/core/ScrollArea/useScrollAreaRootState.js +49 -10
- package/dist/components/core/SearchInput/SearchInput.js +24 -9
- package/dist/components/core/SearchInput/searchInputAnimations.d.ts +7 -6
- package/dist/components/core/SearchInput/searchInputAnimations.js +23 -18
- package/dist/components/core/SearchInput/searchInputParts.d.ts +2 -2
- package/dist/components/core/SearchInput/searchInputParts.js +22 -10
- package/dist/components/core/SearchInput/searchInputStyles.d.ts +5 -3
- package/dist/components/core/SearchInput/searchInputStyles.js +6 -5
- package/dist/components/core/SearchInput/searchInputTypes.d.ts +1 -0
- package/dist/components/core/SearchInput/useSearchInputRootState.d.ts +3 -3
- package/dist/components/core/SearchInput/useSearchInputRootState.js +52 -34
- package/dist/components/core/Select/Select.js +13 -1
- package/dist/components/core/Select/selectAnimations.d.ts +3 -2
- package/dist/components/core/Select/selectAnimations.js +5 -2
- package/dist/components/core/Select/selectParts.d.ts +3 -1
- package/dist/components/core/Select/selectParts.js +2 -1
- package/dist/components/core/Select/selectStyles.d.ts +3 -3
- package/dist/components/core/Select/selectStyles.js +3 -3
- package/dist/components/core/Select/selectTriggerParts.js +79 -28
- package/dist/components/core/Select/selectTypes.d.ts +1 -0
- package/dist/components/core/Select/useSelectRootState.js +33 -16
- package/dist/components/core/SelectionIndicator/selectionIndicatorAnimations.js +23 -3
- package/dist/components/core/SelectionThumb/SelectionThumb.js +1 -1
- package/dist/components/core/Separator/Separator.d.ts +2 -1
- package/dist/components/core/Separator/Separator.js +3 -1
- package/dist/components/core/Separator/index.d.ts +1 -1
- package/dist/components/core/Separator/separatorStyles.d.ts +2 -2
- package/dist/components/core/Separator/separatorStyles.js +2 -2
- package/dist/components/core/Separator/separatorTypes.d.ts +4 -0
- package/dist/components/core/Sidebar/Sidebar.js +15 -2
- package/dist/components/core/Sidebar/sidebarAnimations.d.ts +2 -2
- package/dist/components/core/Sidebar/sidebarAnimations.js +4 -3
- package/dist/components/core/Sidebar/sidebarStyles.d.ts +2 -1
- package/dist/components/core/Sidebar/sidebarStyles.js +2 -1
- package/dist/components/core/Skeleton/skeletonParts.js +8 -5
- package/dist/components/core/Skeleton/skeletonStyles.d.ts +10 -0
- package/dist/components/core/Skeleton/skeletonStyles.js +20 -0
- package/dist/components/core/Slider/Slider.js +9 -3
- package/dist/components/core/Slider/sliderAPI.d.ts +5 -4
- package/dist/components/core/Slider/sliderAPI.js +86 -42
- package/dist/components/core/Slider/sliderAnimations.d.ts +1 -1
- package/dist/components/core/Slider/sliderAnimations.js +2 -2
- package/dist/components/core/Slider/sliderParts.js +11 -2
- package/dist/components/core/Slider/sliderStyles.d.ts +4 -4
- package/dist/components/core/Slider/sliderStyles.js +18 -6
- package/dist/components/core/Slider/sliderThumbParts.d.ts +2 -0
- package/dist/components/core/Slider/sliderThumbParts.js +16 -4
- package/dist/components/core/Slider/sliderTrackParts.js +10 -4
- package/dist/components/core/Slider/sliderTypes.d.ts +9 -1
- package/dist/components/core/Slider/useSliderRootState.d.ts +3 -2
- package/dist/components/core/Slider/useSliderRootState.js +104 -49
- package/dist/components/core/Slider/useSliderTrackState.js +198 -39
- package/dist/components/core/Stack/Stack.js +3 -0
- package/dist/components/core/Stack/stackStyles.d.ts +2 -1
- package/dist/components/core/Stack/stackStyles.js +2 -1
- package/dist/components/core/Stepper/index.d.ts +10 -1
- package/dist/components/core/Stepper/stepperAPI.d.ts +2 -2
- package/dist/components/core/Stepper/stepperAPI.js +4 -3
- package/dist/components/core/Stepper/stepperAnimations.d.ts +1 -0
- package/dist/components/core/Stepper/stepperAnimations.js +28 -2
- package/dist/components/core/Stepper/stepperParts.d.ts +11 -2
- package/dist/components/core/Stepper/stepperParts.js +38 -9
- package/dist/components/core/Stepper/stepperStyles.js +3 -1
- package/dist/components/core/Stepper/stepperTypes.d.ts +3 -2
- package/dist/components/core/Stepper/useStepperRootState.js +10 -3
- package/dist/components/core/Surface/Surface.js +3 -1
- package/dist/components/core/Switch/Switch.js +12 -1
- package/dist/components/core/Switch/switchAPI.d.ts +2 -0
- package/dist/components/core/Switch/switchAPI.js +18 -1
- package/dist/components/core/Switch/switchAnimations.js +29 -9
- package/dist/components/core/Switch/switchControlParts.js +93 -30
- package/dist/components/core/Switch/switchGeometry.js +2 -2
- package/dist/components/core/Switch/switchSimpleParts.d.ts +2 -1
- package/dist/components/core/Switch/switchSimpleParts.js +3 -1
- package/dist/components/core/Switch/switchStyles.d.ts +3 -3
- package/dist/components/core/Switch/switchStyles.js +3 -3
- package/dist/components/core/Switch/switchTypes.d.ts +8 -0
- package/dist/components/core/Switch/useSwitchRootState.js +54 -17
- package/dist/components/core/Table/Table.d.ts +1 -0
- package/dist/components/core/Table/Table.js +2 -0
- package/dist/components/core/Table/index.d.ts +1 -0
- package/dist/components/core/Table/tableAPI.d.ts +6 -1
- package/dist/components/core/Table/tableAPI.js +73 -5
- package/dist/components/core/Table/tableContext.js +6 -1
- package/dist/components/core/Table/tableParts.js +77 -34
- package/dist/components/core/Table/tableStyles.d.ts +13 -2
- package/dist/components/core/Table/tableStyles.js +26 -3
- package/dist/components/core/Table/tableTypes.d.ts +4 -0
- package/dist/components/core/Table/tableVirtualRows.js +140 -27
- package/dist/components/core/Table/useTableContentState.d.ts +2 -1
- package/dist/components/core/Table/useTableContentState.js +32 -6
- package/dist/components/core/Tabs/tabsA11y.d.ts +4 -3
- package/dist/components/core/Tabs/tabsA11y.js +5 -4
- package/dist/components/core/Tabs/tabsContext.d.ts +5 -0
- package/dist/components/core/Tabs/tabsContext.js +12 -0
- package/dist/components/core/Tabs/tabsPanelPart.js +11 -1
- package/dist/components/core/Tabs/tabsParts.js +70 -32
- package/dist/components/core/Tabs/tabsStyles.d.ts +5 -2
- package/dist/components/core/Tabs/tabsStyles.js +13 -4
- package/dist/components/core/Tabs/tabsTabPart.js +55 -50
- package/dist/components/core/Tabs/tabsTypes.d.ts +2 -2
- package/dist/components/core/Tabs/useSlidingTabIndicator.d.ts +1 -1
- package/dist/components/core/Tabs/useSlidingTabIndicator.js +25 -10
- package/dist/components/core/Tabs/useTabsRootState.js +13 -5
- package/dist/components/core/TagsInput/TagsInput.js +13 -2
- package/dist/components/core/TagsInput/index.d.ts +2 -0
- package/dist/components/core/TagsInput/tagsInputParts.d.ts +6 -2
- package/dist/components/core/TagsInput/tagsInputParts.js +81 -14
- package/dist/components/core/TagsInput/tagsInputStyles.js +2 -2
- package/dist/components/core/TagsInput/tagsInputTypes.d.ts +3 -0
- package/dist/components/core/TagsInput/useTagsInputRootState.js +78 -33
- package/dist/components/core/Text/Text.d.ts +2 -1
- package/dist/components/core/Text/Text.js +3 -1
- package/dist/components/core/Text/index.d.ts +1 -1
- package/dist/components/core/Text/textTypes.d.ts +4 -0
- package/dist/components/core/TextArea/textAreaAnimations.js +5 -3
- package/dist/components/core/TextArea/textAreaParts.js +94 -12
- package/dist/components/core/TextArea/textAreaStyles.d.ts +3 -3
- package/dist/components/core/TextArea/textAreaStyles.js +2 -2
- package/dist/components/core/TextArea/textAreaTypes.d.ts +1 -0
- package/dist/components/core/TextArea/useTextAreaRootState.js +2 -1
- package/dist/components/core/TimeField/TimeField.js +6 -1
- package/dist/components/core/TimeField/timeFieldAnimations.d.ts +3 -2
- package/dist/components/core/TimeField/timeFieldAnimations.js +13 -4
- package/dist/components/core/TimeField/timeFieldParts.js +50 -30
- package/dist/components/core/TimeField/timeFieldStyles.d.ts +1 -1
- package/dist/components/core/TimeField/timeFieldStyles.js +1 -1
- package/dist/components/core/TimeField/timeFieldTypes.d.ts +2 -0
- package/dist/components/core/TimeField/useTimeFieldControlState.d.ts +4 -1
- package/dist/components/core/TimeField/useTimeFieldControlState.js +141 -39
- package/dist/components/core/TimeField/useTimeFieldRootState.js +3 -1
- package/dist/components/core/Toast/toastA11y.js +17 -7
- package/dist/components/core/Toast/toastAPI.d.ts +17 -1
- package/dist/components/core/Toast/toastAPI.js +82 -0
- package/dist/components/core/Toast/toastAnimations.d.ts +1 -1
- package/dist/components/core/Toast/toastAnimations.js +106 -98
- package/dist/components/core/Toast/toastProvider.js +25 -3
- package/dist/components/core/Toast/toastStyles.d.ts +5 -3
- package/dist/components/core/Toast/toastStyles.js +5 -3
- package/dist/components/core/Toast/toastTypes.d.ts +9 -0
- package/dist/components/core/Toast/useToastProviderState.js +61 -6
- package/dist/components/core/ToggleButton/ToggleButton.js +23 -7
- package/dist/components/core/ToggleButton/toggleButtonAnimations.d.ts +4 -2
- package/dist/components/core/ToggleButton/toggleButtonAnimations.js +64 -41
- package/dist/components/core/ToggleButton/toggleButtonStyles.d.ts +2 -1
- package/dist/components/core/ToggleButton/toggleButtonStyles.js +21 -2
- package/dist/components/core/ToggleButton/toggleButtonTypes.d.ts +3 -0
- package/dist/components/core/ToggleButton/useToggleButtonRootState.d.ts +1 -1
- package/dist/components/core/ToggleButton/useToggleButtonRootState.js +4 -7
- package/dist/components/core/Tooltip/tooltipAnimations.js +17 -1
- package/dist/components/core/Tooltip/tooltipParts.js +83 -26
- package/dist/components/core/Tooltip/tooltipPosition.js +57 -32
- package/dist/components/core/Tooltip/tooltipStyles.d.ts +2 -2
- package/dist/components/core/Tooltip/tooltipStyles.js +2 -2
- package/dist/components/core/Tooltip/tooltipTypes.d.ts +5 -0
- package/dist/components/core/Tooltip/useTooltipRootState.js +59 -10
- package/dist/components/core/utils/bodyScrollLock.js +12 -3
- package/dist/components/core/utils/clampNumber.d.ts +1 -1
- package/dist/components/core/utils/clampNumber.js +4 -1
- package/dist/components/core/utils/containedEscape.js +12 -0
- package/dist/components/core/utils/fieldFormDom.d.ts +24 -0
- package/dist/components/core/utils/fieldFormDom.js +37 -2
- package/dist/components/core/utils/focusElement.js +2 -2
- package/dist/components/core/utils/hoverInteractiveLift.d.ts +12 -0
- package/dist/components/core/utils/hoverInteractiveLift.js +43 -2
- package/dist/components/core/utils/inputAffixStyles.js +1 -1
- package/dist/components/core/utils/mergeAsChildProps.d.ts +7 -0
- package/dist/components/core/utils/mergeAsChildProps.js +23 -2
- package/dist/components/core/utils/optionListItemStyles.d.ts +2 -2
- package/dist/components/core/utils/optionListItemStyles.js +2 -2
- package/dist/components/core/utils/overlayLayer.d.ts +39 -0
- package/dist/components/core/utils/overlayLayer.js +164 -2
- package/dist/components/core/utils/overlayTriggerSqueeze.js +5 -4
- package/dist/components/core/utils/portalContainer.d.ts +27 -5
- package/dist/components/core/utils/portalContainer.js +38 -4
- package/dist/components/core/utils/pressRipple.js +2 -1
- package/dist/components/core/utils/readingDirection.js +8 -0
- package/dist/components/core/utils/runOpenAfterSqueeze.d.ts +7 -0
- package/dist/components/core/utils/runOpenAfterSqueeze.js +10 -3
- package/dist/components/core/utils/semanticStatusSurface.js +4 -4
- package/dist/components/core/utils/sizeLayout/panel.js +4 -4
- package/dist/components/core/utils/slotMotion/recipes/loadKitRecipe.js +2 -0
- package/dist/components/core/utils/slotMotion/recipes/switchThumb.js +3 -0
- package/dist/components/core/utils/slotMotion/resolveMotionValue.js +1 -1
- package/dist/components/core/utils/slotMotion/slotMount.js +1 -1
- package/dist/components/core/utils/slotMotion/useBarFillMotion.js +8 -3
- package/dist/components/core/utils/useCollapsibleHeight.js +2 -1
- package/dist/components/core/utils/useConvergeRipples.js +4 -1
- package/dist/components/core/utils/useModalMotion.d.ts +2 -0
- package/dist/components/core/utils/useModalMotion.js +19 -3
- package/dist/components/core/utils/usePressableElementTextMotion.js +4 -5
- package/dist/components/core/utils/useShadowMotion.js +28 -7
- package/dist/index.d.ts +3 -3
- package/dist/skins/resolveVariantVisual.d.ts +1 -1
- package/dist/skins/resolveVariantVisual.js +2 -2
- package/dist/skins/skinContext.js +6 -5
- package/dist/skins/skinLiveSlots.generated.d.ts +1 -1
- package/dist/skins/skinLiveSlots.generated.js +1 -1
- package/dist/skins/skinShell.js +9 -4
- package/dist/skins/skinSlots.generated.d.ts +1 -1
- package/dist/skins/skinSlots.generated.js +2 -0
- package/dist/studio/colorPresets.d.ts +1 -1
- package/dist/studio/colorPresets.js +8 -1
- package/dist/studio.d.ts +1 -1
- package/dist/studio.js +13 -1
- package/dist/theme/namedPalettes.d.ts +12 -0
- package/dist/theme/namedPalettes.js +697 -1
- package/dist/theme/themeDefaults.js +6 -3
- package/dist/tokens/config.d.ts +8 -2
- package/dist/tokens/config.js +15 -2
- package/dist/tokens/index.d.ts +1 -1
- package/dist/tokens/index.js +9 -0
- package/dist/ui.css +499 -55
- package/dist/utils/cn.js +89 -2
- package/package.json +1 -1
- package/dist/components/composite/utils/useOptionGroupRequiredAnchor.js +0 -17
- package/dist/components/composite/utils/useOptionGroupSingleValue.js +0 -24
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, memo, useRef, useCallback, useLayoutEffect, useState, Children, isValidElement
|
|
3
|
+
import { forwardRef, memo, useRef, useCallback, useMemo, useLayoutEffect, useState, Children, isValidElement } from "react";
|
|
4
4
|
import { focusKeyboard } from "../utils/focusElement.js";
|
|
5
5
|
import { dataFlag } from "../utils/dataContract.js";
|
|
6
6
|
import { tableCellRole, tableRowRole, columnAriaSort, tableColumnHeaderRole, tableAriaMultiSelectable, tableContentRole, rowAriaSelected, tableIsSelectableGrid } from "./tableA11y.js";
|
|
7
|
-
import { isTableEmptyElement, resolveColumnSortDirection, resolveNextSortDescriptor, tableSortButtons, tableBumpSortButton, hasTableLabel, TONED_ROW_DEFAULT_TONE, moveVirtualTableRow, tableSelectableRows, tableBumpRow, TABLE_ROW_KEY_ATTR, TABLE_VIRTUAL_INDEX_ATTR } from "./tableAPI.js";
|
|
7
|
+
import { extractTableRowKey, isTableEmptyElement, resolveColumnSortDirection, resolveNextSortDescriptor, tableSortButtons, tableBumpSortButton, hasTableLabel, clampTableColumnWidth, TONED_ROW_DEFAULT_TONE, isInteractiveRowDescendant, moveVirtualTableRow, tableSelectableRows, tableBumpRow, TABLE_ROW_KEY_ATTR, TABLE_VIRTUAL_INDEX_ATTR } from "./tableAPI.js";
|
|
8
8
|
import { useTableSlotMotion, TableSortChevron, useTableRowSelectionMotion } from "./tableAnimations.js";
|
|
9
9
|
import { useTableClassNames, useTableContent, useTableVariant, useTableSize, useTableRow, useOptionalTableMotionScope, TableMotionProvider, useTableMotionScope, useTableRowIsSelected, useTableRowIsFocusTarget, useTableVirtual, TableRowProvider } from "./tableContext.js";
|
|
10
|
-
import { TABLE_FOOTER_CLASS, TABLE_BODY_EMPTY_CELL_CLASS, TABLE_CAPTION_CLASS, tableColumnLabelClass, TABLE_COLUMN_MIN_WIDTH,
|
|
10
|
+
import { TABLE_FOOTER_CLASS, TABLE_BODY_EMPTY_CELL_CLASS, TABLE_CAPTION_CLASS, tableColumnLabelClass, TABLE_COLUMN_MIN_WIDTH, tableColumnInnerClass, tableColumnSortButtonClass, TABLE_COLUMN_RESIZE_HANDLE_CLASS, TABLE_COLUMN_RESIZE_GRIP_CLASS, TABLE_COLUMN_RESIZE_GRIP_MARK_CLASS, TABLE_COLUMN_RESIZE_GRIP_LINE_CLASS, tableColumnClass, TABLE_HEADER_ROW_VARIANT_CLASS, tableHeaderClass, tableContentClass, TABLE_SCROLL_STICKY_CLASS, TABLE_SCROLL_CONTAINER_CLASS, tableCellClass, tableRowClass } from "./tableStyles.js";
|
|
11
11
|
import { TableVirtualRows } from "./tableVirtualRows.js";
|
|
12
12
|
import { isRtlElement } from "../utils/readingDirection.js";
|
|
13
13
|
import { formatBurneLabel } from "../../../theme/burneLabels.js";
|
|
@@ -152,6 +152,7 @@ const TableHeaderForward = forwardRef(
|
|
|
152
152
|
...rest
|
|
153
153
|
}, ref) {
|
|
154
154
|
const slotClassNames = useTableClassNames();
|
|
155
|
+
const { stickyHeader } = useTableContent();
|
|
155
156
|
const part = useTableSlotMotion("header", {
|
|
156
157
|
motion,
|
|
157
158
|
forwardedRef: ref,
|
|
@@ -166,7 +167,11 @@ const TableHeaderForward = forwardRef(
|
|
|
166
167
|
"thead",
|
|
167
168
|
{
|
|
168
169
|
ref: part.setRef,
|
|
169
|
-
className:
|
|
170
|
+
className: tableHeaderClass({
|
|
171
|
+
stickyHeader,
|
|
172
|
+
slotClass: slotClassNames.header,
|
|
173
|
+
className
|
|
174
|
+
}),
|
|
170
175
|
...rest,
|
|
171
176
|
...part.pointerHandlers,
|
|
172
177
|
children: rows
|
|
@@ -252,10 +257,12 @@ const TableColumn = forwardRef(
|
|
|
252
257
|
(e) => {
|
|
253
258
|
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
254
259
|
const buttons = tableSortButtons(e.currentTarget);
|
|
260
|
+
const rtl = isRtlElement(e.currentTarget);
|
|
261
|
+
const delta = e.key === "ArrowRight" ? rtl ? -1 : 1 : rtl ? 1 : -1;
|
|
255
262
|
const next = tableBumpSortButton(
|
|
256
263
|
buttons,
|
|
257
264
|
e.currentTarget,
|
|
258
|
-
|
|
265
|
+
delta
|
|
259
266
|
);
|
|
260
267
|
if (!next || next === e.currentTarget) return;
|
|
261
268
|
e.preventDefault();
|
|
@@ -327,13 +334,14 @@ const TableColumn = forwardRef(
|
|
|
327
334
|
if (!dragRef.current || !id) return;
|
|
328
335
|
const host = event.currentTarget.parentElement;
|
|
329
336
|
const sign = host && isRtlElement(host) ? -1 : 1;
|
|
330
|
-
const next =
|
|
337
|
+
const next = clampTableColumnWidth(
|
|
338
|
+
dragRef.current.width + sign * (event.clientX - dragRef.current.x),
|
|
331
339
|
TABLE_COLUMN_MIN_WIDTH,
|
|
332
|
-
|
|
340
|
+
columnMax
|
|
333
341
|
);
|
|
334
342
|
setColumnWidth(id, next);
|
|
335
343
|
},
|
|
336
|
-
[id, setColumnWidth]
|
|
344
|
+
[columnMax, id, setColumnWidth]
|
|
337
345
|
);
|
|
338
346
|
const endResize = useCallback(() => {
|
|
339
347
|
dragRef.current = null;
|
|
@@ -348,9 +356,12 @@ const TableColumn = forwardRef(
|
|
|
348
356
|
event.preventDefault();
|
|
349
357
|
event.stopPropagation();
|
|
350
358
|
const start = width ?? host?.getBoundingClientRect().width ?? TABLE_COLUMN_MIN_WIDTH;
|
|
351
|
-
setColumnWidth(
|
|
359
|
+
setColumnWidth(
|
|
360
|
+
id,
|
|
361
|
+
clampTableColumnWidth(start + delta, TABLE_COLUMN_MIN_WIDTH, columnMax)
|
|
362
|
+
);
|
|
352
363
|
},
|
|
353
|
-
[id, setColumnWidth, width]
|
|
364
|
+
[columnMax, id, setColumnWidth, width]
|
|
354
365
|
);
|
|
355
366
|
return /* @__PURE__ */ jsxs(
|
|
356
367
|
"th",
|
|
@@ -385,15 +396,24 @@ const TableColumn = forwardRef(
|
|
|
385
396
|
}),
|
|
386
397
|
onClick: handleSortClick,
|
|
387
398
|
onKeyDown: handleSortKeyDown,
|
|
388
|
-
children: /* @__PURE__ */ jsx(
|
|
399
|
+
children: /* @__PURE__ */ jsx(
|
|
400
|
+
"span",
|
|
401
|
+
{
|
|
402
|
+
className: tableColumnInnerClass({
|
|
403
|
+
resizable: columnResize,
|
|
404
|
+
slotClass: slotClassNames.columnInner
|
|
405
|
+
}),
|
|
406
|
+
children: inner
|
|
407
|
+
}
|
|
408
|
+
)
|
|
389
409
|
}
|
|
390
410
|
) : /* @__PURE__ */ jsx(
|
|
391
411
|
"span",
|
|
392
412
|
{
|
|
393
|
-
className:
|
|
394
|
-
|
|
395
|
-
slotClassNames.columnInner
|
|
396
|
-
),
|
|
413
|
+
className: tableColumnInnerClass({
|
|
414
|
+
resizable: columnResize,
|
|
415
|
+
slotClass: slotClassNames.columnInner
|
|
416
|
+
}),
|
|
397
417
|
children: inner
|
|
398
418
|
}
|
|
399
419
|
),
|
|
@@ -447,7 +467,7 @@ const TableBodyForward = forwardRef(
|
|
|
447
467
|
...rest
|
|
448
468
|
}, ref) {
|
|
449
469
|
const slotClassNames = useTableClassNames();
|
|
450
|
-
const { selectionMode } = useTableContent();
|
|
470
|
+
const { selectionMode, rowStore } = useTableContent();
|
|
451
471
|
const isGrid = tableIsSelectableGrid(selectionMode);
|
|
452
472
|
const bodyRef = useRef(null);
|
|
453
473
|
const part = useTableSlotMotion("body", {
|
|
@@ -466,9 +486,39 @@ const TableBodyForward = forwardRef(
|
|
|
466
486
|
},
|
|
467
487
|
[setSlotRef]
|
|
468
488
|
);
|
|
469
|
-
const
|
|
489
|
+
const catalogKeys = useMemo(() => {
|
|
490
|
+
if (items === void 0 || typeof children !== "function") return null;
|
|
491
|
+
const fn = children;
|
|
492
|
+
const keys = [];
|
|
493
|
+
for (const item of items) {
|
|
494
|
+
const k = extractTableRowKey(item, fn);
|
|
495
|
+
if (k !== void 0) keys.push(k);
|
|
496
|
+
}
|
|
497
|
+
return keys;
|
|
498
|
+
}, [children, items]);
|
|
499
|
+
useLayoutEffect(() => {
|
|
500
|
+
rowStore.setCatalogKeys(catalogKeys);
|
|
501
|
+
return () => {
|
|
502
|
+
rowStore.setCatalogKeys(null);
|
|
503
|
+
};
|
|
504
|
+
}, [catalogKeys, rowStore]);
|
|
505
|
+
const virtualOn = virtualized && items !== void 0 && items.length > 0 && typeof children === "function";
|
|
470
506
|
let content;
|
|
471
|
-
if (
|
|
507
|
+
if (items !== void 0 && items.length === 0 && renderEmptyState) {
|
|
508
|
+
const emptyState = renderEmptyState();
|
|
509
|
+
content = /* @__PURE__ */ jsx("tr", { role: tableRowRole(isGrid), children: isTableEmptyElement(emptyState) ? emptyState : /* @__PURE__ */ jsx(
|
|
510
|
+
"td",
|
|
511
|
+
{
|
|
512
|
+
role: tableCellRole(isGrid),
|
|
513
|
+
colSpan: 9999,
|
|
514
|
+
className: cn(
|
|
515
|
+
TABLE_BODY_EMPTY_CELL_CLASS,
|
|
516
|
+
slotClassNames.emptyCell
|
|
517
|
+
),
|
|
518
|
+
children: emptyState
|
|
519
|
+
}
|
|
520
|
+
) });
|
|
521
|
+
} else if (virtualOn) {
|
|
472
522
|
content = /* @__PURE__ */ jsx(
|
|
473
523
|
TableVirtualRows,
|
|
474
524
|
{
|
|
@@ -479,21 +529,7 @@ const TableBodyForward = forwardRef(
|
|
|
479
529
|
}
|
|
480
530
|
);
|
|
481
531
|
} else if (items !== void 0) {
|
|
482
|
-
if (
|
|
483
|
-
const emptyState = renderEmptyState();
|
|
484
|
-
content = /* @__PURE__ */ jsx("tr", { role: tableRowRole(isGrid), children: isTableEmptyElement(emptyState) ? emptyState : /* @__PURE__ */ jsx(
|
|
485
|
-
"td",
|
|
486
|
-
{
|
|
487
|
-
role: tableCellRole(isGrid),
|
|
488
|
-
colSpan: 9999,
|
|
489
|
-
className: cn(
|
|
490
|
-
TABLE_BODY_EMPTY_CELL_CLASS,
|
|
491
|
-
slotClassNames.emptyCell
|
|
492
|
-
),
|
|
493
|
-
children: emptyState
|
|
494
|
-
}
|
|
495
|
-
) });
|
|
496
|
-
} else if (typeof children === "function") {
|
|
532
|
+
if (typeof children === "function") {
|
|
497
533
|
content = items.map(children);
|
|
498
534
|
}
|
|
499
535
|
} else {
|
|
@@ -603,7 +639,8 @@ function TableRowSurface({
|
|
|
603
639
|
onRowSelect,
|
|
604
640
|
setFocusedRowKey,
|
|
605
641
|
claimFocusedRowKey,
|
|
606
|
-
isRowDisabled
|
|
642
|
+
isRowDisabled,
|
|
643
|
+
rowStore
|
|
607
644
|
} = useTableContent();
|
|
608
645
|
const scope = useTableMotionScope();
|
|
609
646
|
const {
|
|
@@ -630,6 +667,10 @@ function TableRowSurface({
|
|
|
630
667
|
const isToned = variant === "toned";
|
|
631
668
|
const resolvedTone = tone ?? (isToned ? TONED_ROW_DEFAULT_TONE : void 0);
|
|
632
669
|
useTableRowSelectionMotion(scope, isSelected, part.targetRef);
|
|
670
|
+
useLayoutEffect(() => {
|
|
671
|
+
if (id === void 0) return;
|
|
672
|
+
return rowStore.registerRowKey(id);
|
|
673
|
+
}, [id, rowStore]);
|
|
633
674
|
useLayoutEffect(() => {
|
|
634
675
|
if (!isSelectable || id === void 0) return;
|
|
635
676
|
claimFocusedRowKey(id);
|
|
@@ -645,6 +686,7 @@ function TableRowSurface({
|
|
|
645
686
|
(e) => {
|
|
646
687
|
onClick?.(e);
|
|
647
688
|
if (e.defaultPrevented || !isSelectable || id === void 0) return;
|
|
689
|
+
if (isInteractiveRowDescendant(e.target, e.currentTarget)) return;
|
|
648
690
|
setFocusedRowKey(id);
|
|
649
691
|
onRowSelect(id);
|
|
650
692
|
},
|
|
@@ -654,6 +696,7 @@ function TableRowSurface({
|
|
|
654
696
|
(e) => {
|
|
655
697
|
onKeyDown?.(e);
|
|
656
698
|
if (e.defaultPrevented || !isSelectable || id === void 0) return;
|
|
699
|
+
if (isInteractiveRowDescendant(e.target, e.currentTarget)) return;
|
|
657
700
|
if (e.key === "Enter" || e.key === " ") {
|
|
658
701
|
e.preventDefault();
|
|
659
702
|
setFocusedRowKey(id);
|
|
@@ -3,7 +3,7 @@ import { TableVariant, KitTableVariant } from './tableTypes.js';
|
|
|
3
3
|
export declare const TABLE_ROOT_BASE_CLASS = "w-full";
|
|
4
4
|
export declare const TABLE_ROOT_VARIANT_CLASS: Record<KitTableVariant, string>;
|
|
5
5
|
export declare const TABLE_ROOT_CLIP_CLASS = "overflow-clip";
|
|
6
|
-
export declare const TABLE_SCROLL_CONTAINER_CLASS = "w-full overflow-x-auto
|
|
6
|
+
export declare const TABLE_SCROLL_CONTAINER_CLASS = "w-full overflow-x-auto outline-none focus-ring";
|
|
7
7
|
export declare const TABLE_SCROLL_STICKY_CLASS = "overflow-y-auto max-h-[var(--max-component-2xlarge)]";
|
|
8
8
|
export declare const TABLE_VIRTUAL_SPACER_CELL_CLASS = "border-0 p-0";
|
|
9
9
|
export declare const TABLE_CONTENT_BASE_CLASS = "w-full";
|
|
@@ -20,6 +20,7 @@ export declare const TABLE_COLUMN_RESIZE_GRIP_MARK_CLASS = "h-mid w-px shrink-0
|
|
|
20
20
|
export declare const TABLE_COLUMN_RESIZE_GRIP_LINE_CLASS = "h-full w-px shrink-0 self-stretch bg-border";
|
|
21
21
|
export declare const TABLE_COLUMN_MIN_WIDTH = 64;
|
|
22
22
|
export declare const TABLE_CONTENT_VARIANT_CLASS: Record<KitTableVariant, string>;
|
|
23
|
+
export declare const TABLE_HEADER_STICKY_CLASS = "sticky top-0 z-sticky";
|
|
23
24
|
export declare const TABLE_HEADER_ROW_VARIANT_CLASS: Record<KitTableVariant, string>;
|
|
24
25
|
export declare const TABLE_COLUMN_BASE_CLASS = "group/col sticky top-0 z-10";
|
|
25
26
|
export declare const TABLE_COLUMN_STICKY_CLASS: Record<KitTableVariant, string>;
|
|
@@ -28,11 +29,21 @@ export declare const TABLE_COLUMN_SORTABLE_CLASS = "select-none";
|
|
|
28
29
|
export declare const TABLE_COLUMN_SORT_BUTTON_CLASS = "sort-btn inline-flex w-full min-w-0 items-center gap-xsmall border-0 bg-transparent text-inherit cursor-pointer outline-none focus-ring-inset rounded-small hover:text-foreground -mx-large -my-mid px-large py-mid box-border";
|
|
29
30
|
/** Full-width row so `text-center` / `text-end` on the `<th>` moves the label with the cells. */
|
|
30
31
|
export declare const TABLE_COLUMN_INNER_CLASS = "inline-flex w-full items-center justify-start gap-xsmall group-[.text-center]/col:justify-center group-[.text-end]/col:justify-end";
|
|
32
|
+
export declare const TABLE_COLUMN_INNER_RESIZE_CLASS = "overflow-hidden";
|
|
33
|
+
export declare function tableHeaderClass({ stickyHeader, slotClass, className, }: {
|
|
34
|
+
stickyHeader?: boolean;
|
|
35
|
+
slotClass?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
}): string;
|
|
38
|
+
export declare function tableColumnInnerClass({ resizable, slotClass, }: {
|
|
39
|
+
resizable?: boolean;
|
|
40
|
+
slotClass?: string;
|
|
41
|
+
}): string;
|
|
31
42
|
export declare const TABLE_COLUMN_LABEL_CLASS = "min-w-0 text-small text-start font-w-mid";
|
|
32
43
|
export declare const TABLE_COLUMN_SORT_CHEVRON_BASE_CLASS = "shrink-0 origin-center";
|
|
33
44
|
export declare const TABLE_COLUMN_SORT_CHEVRON_ICON_CLASS = "icon-xsmall";
|
|
34
45
|
export declare const TABLE_COLUMN_SORT_CHEVRON_ACTIVE_CLASS = "text-primary opacity-100";
|
|
35
|
-
export declare const TABLE_COLUMN_SORT_CHEVRON_IDLE_CLASS = "opacity-0 group-hover/col:opacity-40 text-muted";
|
|
46
|
+
export declare const TABLE_COLUMN_SORT_CHEVRON_IDLE_CLASS = "opacity-0 group-hover/col:opacity-40 text-muted-foreground";
|
|
36
47
|
export declare const TABLE_BODY_EMPTY_CELL_CLASS = "px-large py-large text-center";
|
|
37
48
|
export declare const TABLE_ROW_BASE_CLASS = "outline-none";
|
|
38
49
|
export declare const TABLE_ROW_VARIANT_CLASS: Record<KitTableVariant, string>;
|
|
@@ -9,7 +9,7 @@ const TABLE_ROOT_VARIANT_CLASS = {
|
|
|
9
9
|
toned: "overflow-visible bg-transparent"
|
|
10
10
|
};
|
|
11
11
|
const TABLE_ROOT_CLIP_CLASS = "overflow-clip";
|
|
12
|
-
const TABLE_SCROLL_CONTAINER_CLASS = "w-full overflow-x-auto
|
|
12
|
+
const TABLE_SCROLL_CONTAINER_CLASS = "w-full overflow-x-auto outline-none focus-ring";
|
|
13
13
|
const TABLE_SCROLL_STICKY_CLASS = "overflow-y-auto max-h-[var(--max-component-2xlarge)]";
|
|
14
14
|
const TABLE_VIRTUAL_SPACER_CELL_CLASS = "border-0 p-0";
|
|
15
15
|
const TABLE_CONTENT_BASE_CLASS = "w-full";
|
|
@@ -24,6 +24,7 @@ const TABLE_CONTENT_VARIANT_CLASS = {
|
|
|
24
24
|
secondary: "border-collapse",
|
|
25
25
|
toned: "border-separate border-spacing-y-xsmall"
|
|
26
26
|
};
|
|
27
|
+
const TABLE_HEADER_STICKY_CLASS = "sticky top-0 z-sticky";
|
|
27
28
|
const TABLE_HEADER_ROW_VARIANT_CLASS = {
|
|
28
29
|
default: "border-b-token",
|
|
29
30
|
secondary: "border-b-token",
|
|
@@ -38,16 +39,34 @@ const TABLE_COLUMN_STICKY_CLASS = {
|
|
|
38
39
|
const TABLE_COLUMN_VARIANT_CLASS = {
|
|
39
40
|
default: "bg-secondary px-large py-mid text-start text-secondary-foreground whitespace-nowrap",
|
|
40
41
|
secondary: "px-large py-mid text-start text-secondary-foreground whitespace-nowrap",
|
|
41
|
-
toned: "px-large py-mid text-start text-muted whitespace-nowrap bg-transparent"
|
|
42
|
+
toned: "px-large py-mid text-start text-muted-foreground whitespace-nowrap bg-transparent"
|
|
42
43
|
};
|
|
43
44
|
const TABLE_COLUMN_SORTABLE_CLASS = "select-none";
|
|
44
45
|
const TABLE_COLUMN_SORT_BUTTON_CLASS = "sort-btn inline-flex w-full min-w-0 items-center gap-xsmall border-0 bg-transparent text-inherit cursor-pointer outline-none focus-ring-inset rounded-small hover:text-foreground -mx-large -my-mid px-large py-mid box-border";
|
|
45
46
|
const TABLE_COLUMN_INNER_CLASS = "inline-flex w-full items-center justify-start gap-xsmall group-[.text-center]/col:justify-center group-[.text-end]/col:justify-end";
|
|
47
|
+
const TABLE_COLUMN_INNER_RESIZE_CLASS = "overflow-hidden";
|
|
48
|
+
function tableHeaderClass({
|
|
49
|
+
stickyHeader = false,
|
|
50
|
+
slotClass,
|
|
51
|
+
className
|
|
52
|
+
}) {
|
|
53
|
+
return cn(stickyHeader && TABLE_HEADER_STICKY_CLASS, slotClass, className);
|
|
54
|
+
}
|
|
55
|
+
function tableColumnInnerClass({
|
|
56
|
+
resizable = false,
|
|
57
|
+
slotClass
|
|
58
|
+
}) {
|
|
59
|
+
return cn(
|
|
60
|
+
TABLE_COLUMN_INNER_CLASS,
|
|
61
|
+
resizable && TABLE_COLUMN_INNER_RESIZE_CLASS,
|
|
62
|
+
slotClass
|
|
63
|
+
);
|
|
64
|
+
}
|
|
46
65
|
const TABLE_COLUMN_LABEL_CLASS = "min-w-0 text-small text-start font-w-mid";
|
|
47
66
|
const TABLE_COLUMN_SORT_CHEVRON_BASE_CLASS = "shrink-0 origin-center";
|
|
48
67
|
const TABLE_COLUMN_SORT_CHEVRON_ICON_CLASS = "icon-xsmall";
|
|
49
68
|
const TABLE_COLUMN_SORT_CHEVRON_ACTIVE_CLASS = "text-primary opacity-100";
|
|
50
|
-
const TABLE_COLUMN_SORT_CHEVRON_IDLE_CLASS = "opacity-0 group-hover/col:opacity-40 text-muted";
|
|
69
|
+
const TABLE_COLUMN_SORT_CHEVRON_IDLE_CLASS = "opacity-0 group-hover/col:opacity-40 text-muted-foreground";
|
|
51
70
|
const TABLE_BODY_EMPTY_CELL_CLASS = "px-large py-large text-center";
|
|
52
71
|
const TABLE_ROW_BASE_CLASS = "outline-none";
|
|
53
72
|
const TABLE_ROW_VARIANT_CLASS = {
|
|
@@ -216,6 +235,7 @@ export {
|
|
|
216
235
|
TABLE_CELL_VARIANT_CLASS,
|
|
217
236
|
TABLE_COLUMN_BASE_CLASS,
|
|
218
237
|
TABLE_COLUMN_INNER_CLASS,
|
|
238
|
+
TABLE_COLUMN_INNER_RESIZE_CLASS,
|
|
219
239
|
TABLE_COLUMN_LABEL_CLASS,
|
|
220
240
|
TABLE_COLUMN_MIN_WIDTH,
|
|
221
241
|
TABLE_COLUMN_RESIZE_GRIP_CLASS,
|
|
@@ -235,6 +255,7 @@ export {
|
|
|
235
255
|
TABLE_CONTENT_VARIANT_CLASS,
|
|
236
256
|
TABLE_FOOTER_CLASS,
|
|
237
257
|
TABLE_HEADER_ROW_VARIANT_CLASS,
|
|
258
|
+
TABLE_HEADER_STICKY_CLASS,
|
|
238
259
|
TABLE_ROOT_BASE_CLASS,
|
|
239
260
|
TABLE_ROOT_CLIP_CLASS,
|
|
240
261
|
TABLE_ROOT_VARIANT_CLASS,
|
|
@@ -251,9 +272,11 @@ export {
|
|
|
251
272
|
TABLE_VIRTUAL_SPACER_CELL_CLASS,
|
|
252
273
|
tableCellClass,
|
|
253
274
|
tableColumnClass,
|
|
275
|
+
tableColumnInnerClass,
|
|
254
276
|
tableColumnLabelClass,
|
|
255
277
|
tableColumnSortButtonClass,
|
|
256
278
|
tableContentClass,
|
|
279
|
+
tableHeaderClass,
|
|
257
280
|
tableRootClass,
|
|
258
281
|
tableRowClass,
|
|
259
282
|
tableSortChevronClass
|
|
@@ -64,6 +64,7 @@ export type TableProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
64
64
|
/** Cell scale. Default `base` keeps the current padding and `text-small`. */
|
|
65
65
|
size?: TableSize;
|
|
66
66
|
selectionMode?: SelectionMode;
|
|
67
|
+
disallowEmptySelection?: boolean;
|
|
67
68
|
selectedKeys?: Selection;
|
|
68
69
|
defaultSelectedKeys?: Selection;
|
|
69
70
|
onSelectionChange?: (keys: Selection) => void;
|
|
@@ -197,6 +198,9 @@ export type TableRowSelectionStore = {
|
|
|
197
198
|
setSelectedKeys: (next: Selection) => void;
|
|
198
199
|
setFocusedRowKey: (key: string | number) => void;
|
|
199
200
|
claimFocusedRowKey: (key: string | number) => void;
|
|
201
|
+
registerRowKey: (key: string | number) => () => void;
|
|
202
|
+
setCatalogKeys: (keys: readonly (string | number)[] | null) => void;
|
|
203
|
+
getAllRowKeys: () => (string | number)[];
|
|
200
204
|
};
|
|
201
205
|
export type TableRowContextValue = {
|
|
202
206
|
tone: TableRowTone;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useRef, useEffect, useLayoutEffect
|
|
4
|
-
import { findScrollParent } from "../utils/virtualWindow.js";
|
|
3
|
+
import { useState, useRef, useMemo, useCallback, useEffect, useLayoutEffect } from "react";
|
|
5
4
|
import { focusKeyboard } from "../utils/focusElement.js";
|
|
6
|
-
import {
|
|
7
|
-
import { TABLE_ROW_KEY_ATTR, TABLE_VIRTUAL_INDEX_ATTR } from "./tableAPI.js";
|
|
5
|
+
import { findScrollParent, virtualRange } from "../utils/virtualWindow.js";
|
|
6
|
+
import { extractTableRowKey, TABLE_ROW_KEY_ATTR, TABLE_VIRTUAL_INDEX_ATTR } from "./tableAPI.js";
|
|
8
7
|
import { useTableContent, TableVirtualProvider } from "./tableContext.js";
|
|
9
8
|
import { TABLE_VIRTUAL_SPACER_CELL_CLASS } from "./tableStyles.js";
|
|
10
9
|
const TABLE_ROW_SIZE_FALLBACK = 40;
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const MIN_SPACER_COLSPAN = 100;
|
|
11
|
+
function measureHeaderOffset(body) {
|
|
12
|
+
if (!body) return 0;
|
|
13
|
+
if (body.offsetTop > 0) return body.offsetTop;
|
|
14
|
+
const thead = body.closest("table")?.querySelector("thead");
|
|
15
|
+
return thead ? thead.offsetHeight : 0;
|
|
16
|
+
}
|
|
17
|
+
function TableVirtualSpacer({ height, colSpan }) {
|
|
18
|
+
return /* @__PURE__ */ jsx("tr", { "aria-hidden": "true", style: { height }, children: /* @__PURE__ */ jsx("td", { colSpan, className: TABLE_VIRTUAL_SPACER_CELL_CLASS }) });
|
|
13
19
|
}
|
|
14
20
|
function TableVirtualRows({
|
|
15
21
|
items,
|
|
@@ -17,23 +23,60 @@ function TableVirtualRows({
|
|
|
17
23
|
itemSizeProp,
|
|
18
24
|
bodyRef
|
|
19
25
|
}) {
|
|
20
|
-
const { setFocusedRowKey } = useTableContent();
|
|
26
|
+
const { setFocusedRowKey, isRowDisabled } = useTableContent();
|
|
21
27
|
const [measured, setMeasured] = useState(null);
|
|
28
|
+
const [columnCount, setColumnCount] = useState(0);
|
|
29
|
+
const [scrollOffset, setScrollOffset] = useState(0);
|
|
30
|
+
const [viewport, setViewport] = useState(0);
|
|
22
31
|
const [pin, setPin] = useState(0);
|
|
32
|
+
const scrollNodeRef = useRef(null);
|
|
23
33
|
const pendingFocus = useRef(false);
|
|
24
34
|
const itemSize = itemSizeProp ?? measured ?? TABLE_ROW_SIZE_FALLBACK;
|
|
25
35
|
const count = items.length;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
const itemKeys = useMemo(
|
|
37
|
+
() => items.map((item) => extractTableRowKey(item, renderItem)),
|
|
38
|
+
[items, renderItem]
|
|
39
|
+
);
|
|
40
|
+
const readMetrics = useCallback(() => {
|
|
41
|
+
const el = scrollNodeRef.current;
|
|
42
|
+
if (!el) return;
|
|
43
|
+
const headerOffset = measureHeaderOffset(bodyRef.current);
|
|
44
|
+
const nextScroll = Math.max(0, el.scrollTop - headerOffset);
|
|
45
|
+
const nextViewport = el.clientHeight;
|
|
46
|
+
setScrollOffset((prev) => prev === nextScroll ? prev : nextScroll);
|
|
47
|
+
setViewport((prev) => prev === nextViewport ? prev : nextViewport);
|
|
48
|
+
}, [bodyRef]);
|
|
32
49
|
useEffect(() => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
const scrollEl = findScrollParent(bodyRef.current);
|
|
51
|
+
scrollNodeRef.current = scrollEl;
|
|
52
|
+
if (!scrollEl) return;
|
|
53
|
+
scrollEl.addEventListener("scroll", readMetrics, { passive: true });
|
|
54
|
+
let observer = null;
|
|
55
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
56
|
+
observer = new ResizeObserver(readMetrics);
|
|
57
|
+
observer.observe(scrollEl);
|
|
58
|
+
const thead = bodyRef.current?.closest("table")?.querySelector("thead");
|
|
59
|
+
if (thead) observer.observe(thead);
|
|
60
|
+
}
|
|
61
|
+
readMetrics();
|
|
62
|
+
return () => {
|
|
63
|
+
scrollEl.removeEventListener("scroll", readMetrics);
|
|
64
|
+
observer?.disconnect();
|
|
65
|
+
if (scrollNodeRef.current === scrollEl) {
|
|
66
|
+
scrollNodeRef.current = null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}, [bodyRef, count, readMetrics]);
|
|
70
|
+
const range = useMemo(
|
|
71
|
+
() => count > 0 ? virtualRange({ count, itemSize, scrollOffset, viewport }) : { start: 0, end: 0, offset: 0, total: 0, scroll: 0 },
|
|
72
|
+
[count, itemSize, scrollOffset, viewport]
|
|
73
|
+
);
|
|
36
74
|
useLayoutEffect(() => {
|
|
75
|
+
const table = bodyRef.current?.closest("table");
|
|
76
|
+
const thCount = table?.querySelectorAll("thead th").length ?? 0;
|
|
77
|
+
if (thCount > 0) {
|
|
78
|
+
setColumnCount((prev) => prev === thCount ? prev : thCount);
|
|
79
|
+
}
|
|
37
80
|
if (itemSizeProp) return;
|
|
38
81
|
const row = bodyRef.current?.querySelector(`tr[${TABLE_ROW_KEY_ATTR}]`);
|
|
39
82
|
if (!row) return;
|
|
@@ -51,22 +94,92 @@ function TableVirtualRows({
|
|
|
51
94
|
if (key != null) setFocusedRowKey(key);
|
|
52
95
|
focusKeyboard(row);
|
|
53
96
|
}, [bodyRef, pin, range.end, range.start, setFocusedRowKey]);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
97
|
+
const revealIndex = useCallback(
|
|
98
|
+
(targetIndex) => {
|
|
99
|
+
pendingFocus.current = true;
|
|
100
|
+
setPin(targetIndex);
|
|
101
|
+
const scrollEl = scrollNodeRef.current;
|
|
102
|
+
const bodyEl = bodyRef.current;
|
|
103
|
+
if (!scrollEl) return;
|
|
104
|
+
const headerOffset = measureHeaderOffset(bodyEl);
|
|
105
|
+
const thead = bodyEl?.closest("table")?.querySelector("thead");
|
|
106
|
+
const stickyCover = thead ? thead.offsetHeight : 0;
|
|
107
|
+
const rowTop = headerOffset + targetIndex * itemSize;
|
|
108
|
+
const rowBottom = rowTop + itemSize;
|
|
109
|
+
const clientH = scrollEl.clientHeight;
|
|
110
|
+
if (clientH > 0) {
|
|
111
|
+
if (rowTop < scrollEl.scrollTop + stickyCover) {
|
|
112
|
+
scrollEl.scrollTop = Math.max(0, rowTop - stickyCover);
|
|
113
|
+
} else if (rowBottom > scrollEl.scrollTop + clientH) {
|
|
114
|
+
scrollEl.scrollTop = Math.max(0, rowBottom - clientH);
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
scrollEl.scrollTop = Math.max(0, targetIndex * itemSize);
|
|
118
|
+
}
|
|
119
|
+
const nextScroll = Math.max(0, scrollEl.scrollTop - headerOffset);
|
|
120
|
+
setScrollOffset((prev) => prev === nextScroll ? prev : nextScroll);
|
|
121
|
+
},
|
|
122
|
+
[bodyRef, itemSize]
|
|
123
|
+
);
|
|
124
|
+
const isIndexDisabled = useCallback(
|
|
125
|
+
(index) => {
|
|
126
|
+
const key = itemKeys[index];
|
|
127
|
+
return key !== void 0 && isRowDisabled(key);
|
|
128
|
+
},
|
|
129
|
+
[isRowDisabled, itemKeys]
|
|
130
|
+
);
|
|
131
|
+
const step = useCallback(
|
|
132
|
+
(from, delta) => {
|
|
133
|
+
if (count <= 0 || delta === 0) return;
|
|
134
|
+
const dir = delta > 0 ? 1 : -1;
|
|
135
|
+
let candidate = from + dir;
|
|
136
|
+
while (candidate >= 0 && candidate < count) {
|
|
137
|
+
if (!isIndexDisabled(candidate)) {
|
|
138
|
+
revealIndex(candidate);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
candidate += dir;
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
[count, isIndexDisabled, revealIndex]
|
|
145
|
+
);
|
|
146
|
+
const jump = useCallback(
|
|
147
|
+
(index) => {
|
|
148
|
+
if (count <= 0) return;
|
|
149
|
+
const clamped = Math.min(Math.max(0, index), count - 1);
|
|
150
|
+
if (clamped === 0) {
|
|
151
|
+
for (let i = 0; i < count; i += 1) {
|
|
152
|
+
if (!isIndexDisabled(i)) {
|
|
153
|
+
revealIndex(i);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (clamped === count - 1) {
|
|
160
|
+
for (let i = count - 1; i >= 0; i -= 1) {
|
|
161
|
+
if (!isIndexDisabled(i)) {
|
|
162
|
+
revealIndex(i);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (!isIndexDisabled(clamped)) {
|
|
169
|
+
revealIndex(clamped);
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
[count, isIndexDisabled, revealIndex]
|
|
173
|
+
);
|
|
174
|
+
const spacerColSpan = Math.max(columnCount, MIN_SPACER_COLSPAN);
|
|
175
|
+
const tail = Math.max(0, range.total - range.end * itemSize);
|
|
63
176
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
64
|
-
range.offset > 0 ? /* @__PURE__ */ jsx(TableVirtualSpacer, { height: range.offset }) : null,
|
|
177
|
+
range.offset > 0 ? /* @__PURE__ */ jsx(TableVirtualSpacer, { height: range.offset, colSpan: spacerColSpan }) : null,
|
|
65
178
|
items.slice(range.start, range.end).map((item, index) => {
|
|
66
179
|
const rowIndex = range.start + index;
|
|
67
180
|
return /* @__PURE__ */ jsx(TableVirtualProvider, { value: { index: rowIndex, count, step, jump }, children: renderItem(item) }, rowIndex);
|
|
68
181
|
}),
|
|
69
|
-
tail > 0 ? /* @__PURE__ */ jsx(TableVirtualSpacer, { height: tail }) : null
|
|
182
|
+
tail > 0 ? /* @__PURE__ */ jsx(TableVirtualSpacer, { height: tail, colSpan: spacerColSpan }) : null
|
|
70
183
|
] });
|
|
71
184
|
}
|
|
72
185
|
export {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Selection, SelectionMode, SortDescriptor, TableContentContextValue } from './tableTypes.js';
|
|
2
|
-
export declare function useTableContentState({ selectionMode, selectedKeys: selectedKeysProp, defaultSelectedKeys, onSelectionChange, sortDescriptor: sortDescriptorProp, defaultSortDescriptor, onSortChange, disabledKeys, stickyHeader, columnResize, }: {
|
|
2
|
+
export declare function useTableContentState({ selectionMode, disallowEmptySelection, selectedKeys: selectedKeysProp, defaultSelectedKeys, onSelectionChange, sortDescriptor: sortDescriptorProp, defaultSortDescriptor, onSortChange, disabledKeys, stickyHeader, columnResize, }: {
|
|
3
3
|
selectionMode?: SelectionMode;
|
|
4
|
+
disallowEmptySelection?: boolean;
|
|
4
5
|
selectedKeys?: Selection;
|
|
5
6
|
defaultSelectedKeys?: Selection;
|
|
6
7
|
onSelectionChange?: (keys: Selection) => void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useState, useRef, useLayoutEffect, useCallback
|
|
2
|
+
import { useState, useRef, useMemo, useLayoutEffect, useCallback } from "react";
|
|
3
3
|
import { useControllableState } from "../utils/useControllableState.js";
|
|
4
|
-
import {
|
|
4
|
+
import { tableDisabledKeySet, toggleSelectionKey, selectionEquals, EMPTY_TABLE_SELECTION } from "./tableAPI.js";
|
|
5
5
|
function createRowSelectionStore(initialSelected) {
|
|
6
6
|
let selectedKeys = initialSelected;
|
|
7
7
|
let focusedRowKey = null;
|
|
8
|
+
let catalogKeys = null;
|
|
9
|
+
const mountedKeyCounts = /* @__PURE__ */ new Map();
|
|
8
10
|
const selectionListeners = /* @__PURE__ */ new Set();
|
|
9
11
|
const focusListeners = /* @__PURE__ */ new Set();
|
|
10
12
|
return {
|
|
@@ -46,11 +48,27 @@ function createRowSelectionStore(initialSelected) {
|
|
|
46
48
|
if (focusedRowKey != null) return;
|
|
47
49
|
focusedRowKey = key;
|
|
48
50
|
focusListeners.forEach((listener) => listener());
|
|
51
|
+
},
|
|
52
|
+
registerRowKey(key) {
|
|
53
|
+
mountedKeyCounts.set(key, (mountedKeyCounts.get(key) ?? 0) + 1);
|
|
54
|
+
return () => {
|
|
55
|
+
const nextCount = (mountedKeyCounts.get(key) ?? 1) - 1;
|
|
56
|
+
if (nextCount <= 0) mountedKeyCounts.delete(key);
|
|
57
|
+
else mountedKeyCounts.set(key, nextCount);
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
setCatalogKeys(keys) {
|
|
61
|
+
catalogKeys = keys;
|
|
62
|
+
},
|
|
63
|
+
getAllRowKeys() {
|
|
64
|
+
if (catalogKeys != null) return [...catalogKeys];
|
|
65
|
+
return Array.from(mountedKeyCounts.keys());
|
|
49
66
|
}
|
|
50
67
|
};
|
|
51
68
|
}
|
|
52
69
|
function useTableContentState({
|
|
53
70
|
selectionMode = "none",
|
|
71
|
+
disallowEmptySelection = false,
|
|
54
72
|
selectedKeys: selectedKeysProp,
|
|
55
73
|
defaultSelectedKeys,
|
|
56
74
|
onSelectionChange,
|
|
@@ -71,6 +89,11 @@ function useTableContentState({
|
|
|
71
89
|
onSelectionChangeRef.current = onSelectionChange;
|
|
72
90
|
const selectionModeRef = useRef(selectionMode);
|
|
73
91
|
selectionModeRef.current = selectionMode;
|
|
92
|
+
const disallowEmptySelectionRef = useRef(disallowEmptySelection);
|
|
93
|
+
disallowEmptySelectionRef.current = disallowEmptySelection;
|
|
94
|
+
const disabled = useMemo(() => tableDisabledKeySet(disabledKeys), [disabledKeys]);
|
|
95
|
+
const disabledRef = useRef(disabled);
|
|
96
|
+
disabledRef.current = disabled;
|
|
74
97
|
useLayoutEffect(() => {
|
|
75
98
|
if (selectedKeysProp === void 0) return;
|
|
76
99
|
store.setSelectedKeys(selectedKeysProp);
|
|
@@ -84,12 +107,16 @@ function useTableContentState({
|
|
|
84
107
|
});
|
|
85
108
|
const onRowSelect = useCallback(
|
|
86
109
|
(key) => {
|
|
110
|
+
const current = store.getSelectedKeys();
|
|
111
|
+
const allSelectableKeys = store.getAllRowKeys().filter((k) => !disabledRef.current.has(String(k)));
|
|
87
112
|
const next = toggleSelectionKey({
|
|
88
113
|
selectionMode: selectionModeRef.current,
|
|
89
|
-
selectedKeys:
|
|
90
|
-
key
|
|
114
|
+
selectedKeys: current,
|
|
115
|
+
key,
|
|
116
|
+
allSelectableKeys,
|
|
117
|
+
disallowEmptySelection: disallowEmptySelectionRef.current
|
|
91
118
|
});
|
|
92
|
-
if (!next) return;
|
|
119
|
+
if (!next || selectionEquals(current, next)) return;
|
|
93
120
|
if (!isControlledSelection) {
|
|
94
121
|
store.setSelectedKeys(next);
|
|
95
122
|
}
|
|
@@ -109,7 +136,6 @@ function useTableContentState({
|
|
|
109
136
|
},
|
|
110
137
|
[store]
|
|
111
138
|
);
|
|
112
|
-
const disabled = useMemo(() => tableDisabledKeySet(disabledKeys), [disabledKeys]);
|
|
113
139
|
const isRowDisabled = useCallback(
|
|
114
140
|
(key) => disabled.has(String(key)),
|
|
115
141
|
[disabled]
|