@mortenbrudvik/waveui 0.7.0 → 0.9.0
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 +564 -155
- package/dist/components/button/Button.cjs +1 -1
- package/dist/components/button/Button.cjs.map +1 -1
- package/dist/components/button/Button.mjs +36 -35
- package/dist/components/button/Button.mjs.map +1 -1
- package/dist/components/button/Button.slots.cjs +1 -1
- package/dist/components/button/Button.slots.cjs.map +1 -1
- package/dist/components/button/Button.slots.mjs +31 -21
- package/dist/components/button/Button.slots.mjs.map +1 -1
- package/dist/components/button/CompoundButton.cjs +1 -1
- package/dist/components/button/CompoundButton.cjs.map +1 -1
- package/dist/components/button/CompoundButton.mjs +31 -29
- package/dist/components/button/CompoundButton.mjs.map +1 -1
- package/dist/components/button/Link.cjs +1 -1
- package/dist/components/button/Link.cjs.map +1 -1
- package/dist/components/button/Link.mjs +24 -23
- package/dist/components/button/Link.mjs.map +1 -1
- package/dist/components/button/MenuButton.cjs +1 -1
- package/dist/components/button/MenuButton.cjs.map +1 -1
- package/dist/components/button/MenuButton.mjs +29 -28
- package/dist/components/button/MenuButton.mjs.map +1 -1
- package/dist/components/button/SplitButton.cjs +1 -1
- package/dist/components/button/SplitButton.cjs.map +1 -1
- package/dist/components/button/SplitButton.mjs +46 -45
- package/dist/components/button/SplitButton.mjs.map +1 -1
- package/dist/components/button/ToggleButton.cjs +1 -1
- package/dist/components/button/ToggleButton.cjs.map +1 -1
- package/dist/components/button/ToggleButton.mjs +38 -35
- package/dist/components/button/ToggleButton.mjs.map +1 -1
- package/dist/components/button/Toolbar.cjs +1 -1
- package/dist/components/button/Toolbar.cjs.map +1 -1
- package/dist/components/button/Toolbar.mjs +43 -42
- package/dist/components/button/Toolbar.mjs.map +1 -1
- package/dist/components/button/Toolbar.parts.cjs +1 -1
- package/dist/components/button/Toolbar.parts.cjs.map +1 -1
- package/dist/components/button/Toolbar.parts.mjs +76 -81
- package/dist/components/button/Toolbar.parts.mjs.map +1 -1
- package/dist/components/data-display/Avatar.cjs +1 -1
- package/dist/components/data-display/Avatar.cjs.map +1 -1
- package/dist/components/data-display/Avatar.mjs +72 -67
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.mjs +89 -88
- package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
- package/dist/components/data-display/Badge.cjs +1 -1
- package/dist/components/data-display/Badge.cjs.map +1 -1
- package/dist/components/data-display/Badge.mjs +17 -16
- package/dist/components/data-display/Badge.mjs.map +1 -1
- package/dist/components/data-display/CounterBadge.cjs +1 -1
- package/dist/components/data-display/CounterBadge.cjs.map +1 -1
- package/dist/components/data-display/CounterBadge.mjs +18 -17
- package/dist/components/data-display/CounterBadge.mjs.map +1 -1
- package/dist/components/data-display/Divider.cjs +1 -1
- package/dist/components/data-display/Divider.cjs.map +1 -1
- package/dist/components/data-display/Divider.mjs +31 -30
- package/dist/components/data-display/Divider.mjs.map +1 -1
- package/dist/components/data-display/Image.cjs +1 -1
- package/dist/components/data-display/Image.cjs.map +1 -1
- package/dist/components/data-display/Image.mjs +16 -15
- package/dist/components/data-display/Image.mjs.map +1 -1
- package/dist/components/data-display/InfoButton.cjs +2 -0
- package/dist/components/data-display/InfoButton.cjs.map +1 -0
- package/dist/components/data-display/InfoButton.mjs +173 -0
- package/dist/components/data-display/InfoButton.mjs.map +1 -0
- package/dist/components/data-display/InfoLabel.cjs +1 -1
- package/dist/components/data-display/InfoLabel.cjs.map +1 -1
- package/dist/components/data-display/InfoLabel.mjs +36 -92
- package/dist/components/data-display/InfoLabel.mjs.map +1 -1
- package/dist/components/data-display/List.cjs +1 -1
- package/dist/components/data-display/List.cjs.map +1 -1
- package/dist/components/data-display/List.mjs +175 -174
- package/dist/components/data-display/List.mjs.map +1 -1
- package/dist/components/data-display/Persona.cjs +1 -1
- package/dist/components/data-display/Persona.cjs.map +1 -1
- package/dist/components/data-display/Persona.mjs +31 -29
- package/dist/components/data-display/Persona.mjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.cjs +1 -1
- package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.mjs +25 -24
- package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
- package/dist/components/data-display/Tag.cjs +1 -1
- package/dist/components/data-display/Tag.cjs.map +1 -1
- package/dist/components/data-display/Tag.mjs +87 -82
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/feedback/MessageBar.cjs +1 -1
- package/dist/components/feedback/MessageBar.cjs.map +1 -1
- package/dist/components/feedback/MessageBar.mjs +129 -71
- package/dist/components/feedback/MessageBar.mjs.map +1 -1
- package/dist/components/feedback/MessageBar.parts.cjs +2 -0
- package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
- package/dist/components/feedback/MessageBar.parts.mjs +84 -0
- package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
- package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
- package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
- package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
- package/dist/components/feedback/MessageBar.reflow.mjs.map +1 -0
- package/dist/components/feedback/MessageBar.status.cjs +1 -1
- package/dist/components/feedback/MessageBar.status.cjs.map +1 -1
- package/dist/components/feedback/MessageBar.status.mjs +2 -1
- package/dist/components/feedback/MessageBar.status.mjs.map +1 -1
- package/dist/components/feedback/ProgressBar.cjs +1 -1
- package/dist/components/feedback/ProgressBar.cjs.map +1 -1
- package/dist/components/feedback/ProgressBar.mjs +44 -43
- package/dist/components/feedback/ProgressBar.mjs.map +1 -1
- package/dist/components/feedback/Skeleton.cjs +1 -1
- package/dist/components/feedback/Skeleton.cjs.map +1 -1
- package/dist/components/feedback/Skeleton.mjs +26 -24
- package/dist/components/feedback/Skeleton.mjs.map +1 -1
- package/dist/components/feedback/Spinner.cjs +1 -1
- package/dist/components/feedback/Spinner.cjs.map +1 -1
- package/dist/components/feedback/Spinner.mjs +32 -31
- package/dist/components/feedback/Spinner.mjs.map +1 -1
- package/dist/components/feedback/Toast.cjs +1 -1
- package/dist/components/feedback/Toast.cjs.map +1 -1
- package/dist/components/feedback/Toast.context.cjs +2 -0
- package/dist/components/feedback/Toast.context.cjs.map +1 -0
- package/dist/components/feedback/Toast.context.mjs +23 -0
- package/dist/components/feedback/Toast.context.mjs.map +1 -0
- package/dist/components/feedback/Toast.mjs +10 -342
- package/dist/components/feedback/Toast.mjs.map +1 -1
- package/dist/components/feedback/Toast.parts.cjs +2 -0
- package/dist/components/feedback/Toast.parts.cjs.map +1 -0
- package/dist/components/feedback/Toast.parts.mjs +98 -0
- package/dist/components/feedback/Toast.parts.mjs.map +1 -0
- package/dist/components/feedback/Toast.root.cjs +2 -0
- package/dist/components/feedback/Toast.root.cjs.map +1 -0
- package/dist/components/feedback/Toast.root.mjs +109 -0
- package/dist/components/feedback/Toast.root.mjs.map +1 -0
- package/dist/components/feedback/Toaster.cjs +2 -0
- package/dist/components/feedback/Toaster.cjs.map +1 -0
- package/dist/components/feedback/Toaster.mjs +564 -0
- package/dist/components/feedback/Toaster.mjs.map +1 -0
- package/dist/components/input/AlphaSlider.cjs +2 -0
- package/dist/components/input/AlphaSlider.cjs.map +1 -0
- package/dist/components/input/AlphaSlider.mjs +115 -0
- package/dist/components/input/AlphaSlider.mjs.map +1 -0
- package/dist/components/input/Checkbox.cjs +1 -1
- package/dist/components/input/Checkbox.cjs.map +1 -1
- package/dist/components/input/Checkbox.mjs +87 -70
- package/dist/components/input/Checkbox.mjs.map +1 -1
- package/dist/components/input/ColorArea.cjs +2 -0
- package/dist/components/input/ColorArea.cjs.map +1 -0
- package/dist/components/input/ColorArea.mjs +204 -0
- package/dist/components/input/ColorArea.mjs.map +1 -0
- package/dist/components/input/ColorPicker.cjs +5 -5
- package/dist/components/input/ColorPicker.cjs.map +1 -1
- package/dist/components/input/ColorPicker.mjs +142 -165
- package/dist/components/input/ColorPicker.mjs.map +1 -1
- package/dist/components/input/ColorPicker.parts.cjs +2 -0
- package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
- package/dist/components/input/ColorPicker.parts.mjs +192 -0
- package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
- package/dist/components/input/ColorSlider.cjs +2 -0
- package/dist/components/input/ColorSlider.cjs.map +1 -0
- package/dist/components/input/ColorSlider.mjs +138 -0
- package/dist/components/input/ColorSlider.mjs.map +1 -0
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +22 -22
- package/dist/components/input/Combobox.expand.mjs.map +1 -1
- package/dist/components/input/Combobox.mjs +151 -141
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +239 -234
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +109 -100
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Field.cjs +1 -1
- package/dist/components/input/Field.cjs.map +1 -1
- package/dist/components/input/Field.mjs +139 -105
- package/dist/components/input/Field.mjs.map +1 -1
- package/dist/components/input/Input.cjs +1 -1
- package/dist/components/input/Input.cjs.map +1 -1
- package/dist/components/input/Input.mjs +80 -55
- package/dist/components/input/Input.mjs.map +1 -1
- package/dist/components/input/Label.cjs +1 -1
- package/dist/components/input/Label.cjs.map +1 -1
- package/dist/components/input/Label.mjs +19 -12
- package/dist/components/input/Label.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +100 -98
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/RadioGroup.cjs +1 -1
- package/dist/components/input/RadioGroup.cjs.map +1 -1
- package/dist/components/input/RadioGroup.mjs +89 -88
- package/dist/components/input/RadioGroup.mjs.map +1 -1
- package/dist/components/input/Rating.cjs +1 -1
- package/dist/components/input/Rating.cjs.map +1 -1
- package/dist/components/input/Rating.item.cjs +2 -0
- package/dist/components/input/Rating.item.cjs.map +1 -0
- package/dist/components/input/Rating.item.mjs +255 -0
- package/dist/components/input/Rating.item.mjs.map +1 -0
- package/dist/components/input/Rating.mjs +152 -152
- package/dist/components/input/Rating.mjs.map +1 -1
- package/dist/components/input/SearchBox.cjs +1 -1
- package/dist/components/input/SearchBox.cjs.map +1 -1
- package/dist/components/input/SearchBox.mjs +162 -132
- package/dist/components/input/SearchBox.mjs.map +1 -1
- package/dist/components/input/Select.cjs +1 -1
- package/dist/components/input/Select.cjs.map +1 -1
- package/dist/components/input/Select.mjs +34 -24
- package/dist/components/input/Select.mjs.map +1 -1
- package/dist/components/input/Slider.cjs +1 -1
- package/dist/components/input/Slider.cjs.map +1 -1
- package/dist/components/input/Slider.mjs +78 -54
- package/dist/components/input/Slider.mjs.map +1 -1
- package/dist/components/input/SpinButton.cjs +1 -1
- package/dist/components/input/SpinButton.cjs.map +1 -1
- package/dist/components/input/SpinButton.mjs +202 -99
- package/dist/components/input/SpinButton.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.cjs +1 -1
- package/dist/components/input/SwatchPicker.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.mjs +38 -37
- package/dist/components/input/SwatchPicker.mjs.map +1 -1
- package/dist/components/input/Switch.cjs +1 -1
- package/dist/components/input/Switch.cjs.map +1 -1
- package/dist/components/input/Switch.mjs +75 -58
- package/dist/components/input/Switch.mjs.map +1 -1
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.mjs +199 -169
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/Textarea.cjs +1 -1
- package/dist/components/input/Textarea.cjs.map +1 -1
- package/dist/components/input/Textarea.mjs +31 -23
- package/dist/components/input/Textarea.mjs.map +1 -1
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +185 -177
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/input/colorName.cjs +2 -0
- package/dist/components/input/colorName.cjs.map +1 -0
- package/dist/components/input/colorName.mjs +30 -0
- package/dist/components/input/colorName.mjs.map +1 -0
- package/dist/components/input/colorUtils.cjs +1 -1
- package/dist/components/input/colorUtils.cjs.map +1 -1
- package/dist/components/input/colorUtils.mjs +154 -56
- package/dist/components/input/colorUtils.mjs.map +1 -1
- package/dist/components/input/fieldLabel.cjs +2 -0
- package/dist/components/input/fieldLabel.cjs.map +1 -0
- package/dist/components/input/fieldLabel.mjs +17 -0
- package/dist/components/input/fieldLabel.mjs.map +1 -0
- package/dist/components/input/inputLook.cjs +2 -0
- package/dist/components/input/inputLook.cjs.map +1 -0
- package/dist/components/input/inputLook.mjs +28 -0
- package/dist/components/input/inputLook.mjs.map +1 -0
- package/dist/components/input/pickerStyles.cjs +1 -1
- package/dist/components/input/pickerStyles.cjs.map +1 -1
- package/dist/components/input/pickerStyles.mjs +42 -4
- package/dist/components/input/pickerStyles.mjs.map +1 -1
- package/dist/components/layout/Accordion.cjs +1 -1
- package/dist/components/layout/Accordion.cjs.map +1 -1
- package/dist/components/layout/Accordion.mjs +130 -129
- package/dist/components/layout/Accordion.mjs.map +1 -1
- package/dist/components/layout/Card.cjs +1 -1
- package/dist/components/layout/Card.cjs.map +1 -1
- package/dist/components/layout/Card.mjs +78 -77
- package/dist/components/layout/Card.mjs.map +1 -1
- package/dist/components/layout/Carousel.cjs +1 -1
- package/dist/components/layout/Carousel.cjs.map +1 -1
- package/dist/components/layout/Carousel.mjs +111 -110
- package/dist/components/layout/Carousel.mjs.map +1 -1
- package/dist/components/layout/Flex.cjs +1 -1
- package/dist/components/layout/Flex.cjs.map +1 -1
- package/dist/components/layout/Flex.mjs +22 -21
- package/dist/components/layout/Flex.mjs.map +1 -1
- package/dist/components/layout/Grid.cjs +1 -1
- package/dist/components/layout/Grid.cjs.map +1 -1
- package/dist/components/layout/Grid.mjs +19 -18
- package/dist/components/layout/Grid.mjs.map +1 -1
- package/dist/components/layout/Overflow.cjs +1 -1
- package/dist/components/layout/Overflow.cjs.map +1 -1
- package/dist/components/layout/Overflow.mjs +92 -91
- package/dist/components/layout/Overflow.mjs.map +1 -1
- package/dist/components/layout/Stack.cjs +1 -1
- package/dist/components/layout/Stack.cjs.map +1 -1
- package/dist/components/layout/Stack.mjs +14 -13
- package/dist/components/layout/Stack.mjs.map +1 -1
- package/dist/components/layout/TabList.cjs +1 -1
- package/dist/components/layout/TabList.cjs.map +1 -1
- package/dist/components/layout/TabList.mjs +118 -117
- package/dist/components/layout/TabList.mjs.map +1 -1
- package/dist/components/layout/Tree.cjs +1 -1
- package/dist/components/layout/Tree.cjs.map +1 -1
- package/dist/components/layout/Tree.context.cjs +2 -0
- package/dist/components/layout/Tree.context.cjs.map +1 -0
- package/dist/components/layout/Tree.context.mjs +33 -0
- package/dist/components/layout/Tree.context.mjs.map +1 -0
- package/dist/components/layout/Tree.core.cjs +2 -0
- package/dist/components/layout/Tree.core.cjs.map +1 -0
- package/dist/components/layout/Tree.core.mjs +416 -0
- package/dist/components/layout/Tree.core.mjs.map +1 -0
- package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
- package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
- package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
- package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
- package/dist/components/layout/Tree.mjs +7 -215
- package/dist/components/layout/Tree.mjs.map +1 -1
- package/dist/components/layout/Tree.selection.cjs +2 -0
- package/dist/components/layout/Tree.selection.cjs.map +1 -0
- package/dist/components/layout/Tree.selection.mjs +73 -0
- package/dist/components/layout/Tree.selection.mjs.map +1 -0
- package/dist/components/navigation/Breadcrumb.cjs +1 -1
- package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
- package/dist/components/navigation/Breadcrumb.mjs +76 -75
- package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
- package/dist/components/navigation/Menu.group.cjs +1 -1
- package/dist/components/navigation/Menu.group.cjs.map +1 -1
- package/dist/components/navigation/Menu.group.mjs +39 -37
- package/dist/components/navigation/Menu.group.mjs.map +1 -1
- package/dist/components/navigation/Menu.items.cjs +1 -1
- package/dist/components/navigation/Menu.items.cjs.map +1 -1
- package/dist/components/navigation/Menu.items.mjs +67 -61
- package/dist/components/navigation/Menu.items.mjs.map +1 -1
- package/dist/components/navigation/Menu.link.cjs +1 -1
- package/dist/components/navigation/Menu.link.cjs.map +1 -1
- package/dist/components/navigation/Menu.link.mjs +34 -28
- package/dist/components/navigation/Menu.link.mjs.map +1 -1
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +114 -113
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +171 -170
- package/dist/components/navigation/Menu.root.mjs.map +1 -1
- package/dist/components/navigation/Menu.selectable.cjs +1 -1
- package/dist/components/navigation/Menu.selectable.cjs.map +1 -1
- package/dist/components/navigation/Menu.selectable.mjs +85 -63
- package/dist/components/navigation/Menu.selectable.mjs.map +1 -1
- package/dist/components/navigation/Menu.splitGroup.cjs +1 -1
- package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -1
- package/dist/components/navigation/Menu.splitGroup.mjs +27 -26
- package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -1
- package/dist/components/navigation/Menu.trigger.cjs +1 -1
- package/dist/components/navigation/Menu.trigger.cjs.map +1 -1
- package/dist/components/navigation/Menu.trigger.mjs +6 -6
- package/dist/components/navigation/Nav.cjs +1 -1
- package/dist/components/navigation/Nav.cjs.map +1 -1
- package/dist/components/navigation/Nav.mjs +170 -155
- package/dist/components/navigation/Nav.mjs.map +1 -1
- package/dist/components/navigation/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination.cjs.map +1 -1
- package/dist/components/navigation/Pagination.mjs +73 -65
- package/dist/components/navigation/Pagination.mjs.map +1 -1
- package/dist/components/navigation/Stepper.cjs +1 -1
- package/dist/components/navigation/Stepper.cjs.map +1 -1
- package/dist/components/navigation/Stepper.mjs +110 -109
- package/dist/components/navigation/Stepper.mjs.map +1 -1
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +109 -108
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Drawer.cjs +1 -1
- package/dist/components/overlays/Drawer.cjs.map +1 -1
- package/dist/components/overlays/Drawer.mjs +110 -109
- package/dist/components/overlays/Drawer.mjs.map +1 -1
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +148 -151
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/Popover.shared.cjs +1 -1
- package/dist/components/overlays/Popover.shared.cjs.map +1 -1
- package/dist/components/overlays/Popover.shared.mjs +82 -77
- package/dist/components/overlays/Popover.shared.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs +41 -37
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +87 -86
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/portal/Portal.cjs +1 -1
- package/dist/components/portal/Portal.cjs.map +1 -1
- package/dist/components/portal/Portal.mjs +33 -32
- package/dist/components/portal/Portal.mjs.map +1 -1
- package/dist/components/provider/WaveProvider.cjs +1 -1
- package/dist/components/provider/WaveProvider.cjs.map +1 -1
- package/dist/components/provider/WaveProvider.mjs +36 -29
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.mjs +228 -227
- package/dist/components/table/DataGrid.mjs.map +1 -1
- package/dist/components/table/Table.cjs +1 -1
- package/dist/components/table/Table.cjs.map +1 -1
- package/dist/components/table/Table.mjs +60 -59
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/typography/Text.cjs +1 -1
- package/dist/components/typography/Text.cjs.map +1 -1
- package/dist/components/typography/Text.mjs +12 -11
- package/dist/components/typography/Text.mjs.map +1 -1
- package/dist/hooks/useFieldControl.cjs.map +1 -1
- package/dist/hooks/useFieldControl.mjs.map +1 -1
- package/dist/hooks/useMediaQuery.cjs +2 -0
- package/dist/hooks/useMediaQuery.cjs.map +1 -0
- package/dist/hooks/useMediaQuery.mjs +20 -0
- package/dist/hooks/useMediaQuery.mjs.map +1 -0
- package/dist/hooks/usePrefersReducedMotion.cjs +1 -1
- package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -1
- package/dist/hooks/usePrefersReducedMotion.mjs +4 -18
- package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +3 -3
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2890 -197
- package/dist/index.d.ts +2890 -197
- package/dist/index.mjs +101 -87
- package/dist/lib/classNames.cjs +2 -0
- package/dist/lib/classNames.cjs.map +1 -0
- package/dist/lib/classNames.mjs +423 -0
- package/dist/lib/classNames.mjs.map +1 -0
- package/dist/lib/color.cjs +2 -0
- package/dist/lib/color.cjs.map +1 -0
- package/dist/lib/color.mjs +86 -0
- package/dist/lib/color.mjs.map +1 -0
- package/dist/lib/globalRegistry.cjs.map +1 -1
- package/dist/lib/globalRegistry.mjs.map +1 -1
- package/dist/lib/styles.cjs +1 -1
- package/dist/lib/styles.cjs.map +1 -1
- package/dist/lib/styles.mjs +21 -4
- package/dist/lib/styles.mjs.map +1 -1
- package/dist/lib/toaster.cjs +2 -0
- package/dist/lib/toaster.cjs.map +1 -0
- package/dist/lib/toaster.mjs +77 -0
- package/dist/lib/toaster.mjs.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +13 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGrid.mjs","names":["useId","_Fragment","useId$1","React","DEFAULT_SELECT_ALL_LABEL","DEFAULT_SELECTION_HEADER_LABEL","createSelectionStore","selected","initial","registered","selectedRegistered","selectAll","singleMode","initialSingleMode","singleId","rowListeners","selectAllListeners","notify","listener","listeners","getSingleId","first","rowId","onRegistrationChange","previous","updateSelectAll","next","subscribeTo","count","done","remaining","items","item","single","createHeaderSlotRegistry","slots","update","nextCell","slot","getCell","cell","DataGridContext","DataGridSortContext","DataGridSectionContext","DataGridHeaderSlotsContext","DataGridHeaderRowHintContext","INERT_CONTEXT","INERT_SORT_CONTEXT","useDataGridContext","reportMissingContext","component","useDataGridSortContext","EMPTY_ITEMS","toItems","keys","sameItems","a","b","index","renderFlatChild","node","key","warnDuplicateRowId","cellBase","selectionCell","nativeControl","DataGridRoot","sortProp","sortColumnProp","sortDirectionProp","selectedItemsProp","rest","props","usesSortApi","defaultSort","sortApiMode","setSortApiMode","objectCallbacks","legacySortControlled","warnDeprecated","defaultSortColumn","defaultSortDirection","mixedSortApi","warnOnce","legacyHalves","setLegacyHalves","legacyControlledSort","column","legacyDefaultSort","sort","setSort","useControllable","onSortChange","requestSort","columnId","sortContext","onSelectionChange","legacySelected","selectedKeys","legacyDefaultSelected","defaultSelectedKeys","controlledSelected","resolveDeprecatedProp","defaultSelected","defaultSelectedItems","setSelected","onSelectedItemsChange","selectionMode","store","toggleRow","effective","selectedCount","toggleAll","all","radioName","selectAllLabel","labels","selectionHeaderLabel","context","useGridNavigation","mergedRef","useMergedRefs","ref","gridRef","content","children","flatChildren","columns","flattenChildren","isElementOfType","DataGridHeader","isCaption","Fragment","DataGridHeaderCell","child","containerClassName","containerLabel","containerLabelledBy","containerRest","containerProps","containerHasRole","droppedContainerName","cn","className","composeEventHandlers","onKeyDown","gridProps","onFocus","onBlur","DataGridSelectionHeaderCell","state","inputRef","clicks","setClicks","focusRingInset","INERT_HEADER_SLOTS","DataGridSelectionHeaderSlot","cellRef","getIsFirst","initialFirst","getServerIsFirst","isFirst","withSelectionHeaderSlots","visit","nodes","thead","setThead","isDev","row","sortIcon","direction","sortColumnId","sortable","sortedDirection","sortOnButtonClick","button","event","onClick","DataGridBody","DataGridRow","section","firstHeaderRowHint","inHeader","selectable","labelId","getSelected","isSelected","unregister","unlabelled","selectionLabel","handleKeyDown","target","labelledBy","idCellIndex","firstCellIndex","DataGridCell","firstCell","needsLabel","selectionCellElement","forcedColors","DataGrid"],"sources":["../../../src/components/table/DataGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport {\n isDev,\n reportMissingContext,\n resolveDeprecatedProp,\n warnDeprecated,\n warnOnce,\n} from '../../lib/dev';\nimport { focusRingInset, forcedColors } from '../../lib/styles';\nimport type { SelectionMode } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useGridNavigation } from './useGridNavigation';\n\nexport type SortDirection = 'ascending' | 'descending';\n\n/** The sort state of a DataGrid: the sorted column and its direction. */\nexport interface DataGridSort {\n /** The `columnId` of the sorted column. */\n columnId: string;\n /** The sort direction. */\n direction: SortDirection;\n}\n\n/** Defines a column in the DataGrid. */\nexport interface DataGridColumn {\n /** Unique identifier for the column (the header cell's `columnId`). */\n id: string;\n /** Display label for the column header. */\n label: string;\n /** Whether the column supports sorting. */\n sortable?: boolean;\n}\n\n/** The built-in text of a DataGrid, for localization (see `DataGridBaseProps.labels`). */\nexport interface DataGridLabels {\n /** Accessible name of the select-all checkbox in the header (`selectionMode=\"multiple\"`).\n * @default 'Select all rows'\n */\n selectAll?: string;\n /**\n * Visually hidden text of the selection column's header cell (`selectionMode=\"single\"`), which\n * names that column.\n * @default 'Selection'\n */\n selectionHeader?: string;\n}\n\nconst DEFAULT_SELECT_ALL_LABEL = 'Select all rows';\nconst DEFAULT_SELECTION_HEADER_LABEL = 'Selection';\n\n/** Props of every DataGrid, whatever sort API it uses. */\nexport interface DataGridBaseProps extends React.HTMLAttributes<HTMLTableElement> {\n /**\n * Column definitions. When given and no `DataGrid.Header` child is present, the header row\n * (including the selection column) is rendered from them: `id` becomes the header cell's\n * `columnId`, `label` its content, `sortable` makes it a sort button.\n */\n columns?: readonly DataGridColumn[];\n /**\n * Row selection mode. `'multiple'` adds a checkbox column with a \"Select all rows\" header\n * checkbox; `'single'` adds a radio column (its header reads \"Selection\" to assistive\n * technology). `labels` localizes both texts.\n * @default 'none'\n */\n selectionMode?: 'none' | SelectionMode;\n /**\n * The name of the select-all checkbox and the header text of the selection column, for\n * localization. Unset members keep their English defaults. Rows are named with their own\n * `selectionLabel`.\n */\n labels?: DataGridLabels;\n /**\n * Controlled selected row ids (`DataGrid.Row` `rowId`). In single mode pass at most one id: with\n * several, only the first one whose row is rendered is selected (a development warning says so).\n */\n selectedItems?: readonly string[];\n /** Initially selected row ids (uncontrolled). In single mode, at most one (see `selectedItems`). */\n defaultSelectedItems?: readonly string[];\n /**\n * Called with the new selected row ids when the selection changes. Ids of rows that are not\n * rendered are left out of the reported selection and of the select-all state, so the next\n * change drops them. Until that change an uncontrolled grid still holds such an id: a row\n * re-added with the same `rowId` before then is shown selected again.\n */\n onSelectedItemsChange?: (selectedItems: string[]) => void;\n /** @deprecated Use `selectedItems` (an array). A `Set` or an array is accepted. */\n selectedKeys?: ReadonlySet<string> | readonly string[];\n /** @deprecated Use `defaultSelectedItems` (an array). A `Set` or an array is accepted. */\n defaultSelectedKeys?: ReadonlySet<string> | readonly string[];\n /** @deprecated Use `onSelectedItemsChange`, which receives an array. Both are called. */\n onSelectionChange?: (keys: Set<string>) => void;\n /**\n * Props for the wrapper `<div>` around the `<table>`: a horizontally scrollable container\n * (`overflow-x-auto`). Use it for its className, style (e.g. a max height) or ref. The wrapper\n * is not a tab stop (the grid's own cell tab stop scrolls it) and has no role, so its\n * `aria-label`/`aria-labelledby` are applied only together with a `role` (e.g. `'region'`);\n * without one they are dropped with a development warning. Name the grid with `aria-label`.\n */\n containerProps?: Omit<React.ComponentPropsWithRef<'div'>, 'children'>;\n /** DataGrid header, body, and row elements. */\n children: React.ReactNode;\n /** Ref to the `<table role=\"grid\">` element. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\ninterface NoDeprecatedSortProps {\n sortColumn?: never;\n defaultSortColumn?: never;\n sortDirection?: never;\n defaultSortDirection?: never;\n}\n\n/** The 0.5 sort API, controlled: `sort` + `onSortChange(sort)`. */\nexport interface DataGridControlledSortProps extends NoDeprecatedSortProps {\n /** The controlled sort, or `null` for an unsorted grid. */\n sort: DataGridSort | null;\n /** Initial sort while `sort` is not given yet. */\n defaultSort?: DataGridSort | null;\n /**\n * Called with the new sort when a sortable header is activated. Sorting is controlled: the\n * consumer reorders the rows.\n */\n onSortChange?: (sort: DataGridSort) => void;\n}\n\n/** The 0.5 sort API, uncontrolled: `defaultSort` (`null` for none) + `onSortChange(sort)`. */\nexport interface DataGridUncontrolledSortProps extends NoDeprecatedSortProps {\n sort?: undefined;\n /** The initial sort, or `null` for an initially unsorted grid. */\n defaultSort: DataGridSort | null;\n /**\n * Called with the new sort when a sortable header is activated. Sorting is controlled: the\n * consumer reorders the rows.\n */\n onSortChange?: (sort: DataGridSort) => void;\n}\n\n/**\n * The 0.4 sort API: `onSortChange(columnId, direction)` and the deprecated `sortColumn`/\n * `sortDirection` props. It applies whenever neither `sort` nor `defaultSort` is given. As in 0.4,\n * the column and the direction can be controlled independently: the half that is not controlled is\n * kept internally and follows every sort request (mixed control, warned in development).\n */\nexport interface DataGridLegacySortProps {\n sort?: undefined;\n defaultSort?: undefined;\n /**\n * @deprecated Use `sort` (`{ columnId, direction }` or `null`). Without `sortDirection`, the\n * direction is kept internally (it toggles on repeated clicks).\n */\n sortColumn?: string;\n /** @deprecated Use `defaultSort`. */\n defaultSortColumn?: string;\n /**\n * @deprecated Use `sort`. Without `sortColumn`, the column is kept internally (it follows the\n * clicked header, starting from `defaultSortColumn`).\n */\n sortDirection?: SortDirection;\n /** @deprecated Use `defaultSort`. */\n defaultSortDirection?: SortDirection;\n /**\n * Called when a sortable header is activated, with the 0.4 arguments. Pass `sort` or\n * `defaultSort` to receive a `DataGridSort` object instead: `defaultSort={null}` turns the\n * object form on for an initially unsorted grid. A `sort` that is still `undefined` (e.g. while\n * data loads) does not: pass `sort={sort ?? null}`.\n *\n * @example\n * <DataGrid defaultSort={null} onSortChange={(sort) => setSort(sort)}>…</DataGrid>\n */\n onSortChange?: (columnId: string, direction: SortDirection) => void;\n}\n\n/**\n * Properties for the DataGrid component. The sort props form a union: `sort`/`defaultSort` with\n * `onSortChange(sort)` (0.5), or the 0.4 form `onSortChange(columnId, direction)` with the\n * deprecated `sortColumn`/`sortDirection`/`defaultSortColumn`/`defaultSortDirection`. The two\n * cannot be mixed.\n */\nexport type DataGridProps = DataGridBaseProps &\n (DataGridControlledSortProps | DataGridUncontrolledSortProps | DataGridLegacySortProps);\n\n/** Properties for the DataGridHeader sub-component. */\nexport interface DataGridHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /**\n * Header row elements. Each `<tr>` child (also inside a Fragment) gets the selection column's\n * header cell prepended when the grid is selectable; a header row rendered by another component\n * should be a `DataGrid.Row`, which adds the cell itself. With several header rows (a grouped\n * header), only the first one gets the \"Select all rows\" control; later rows get an empty cell.\n */\n children: React.ReactNode;\n /** Ref to the `<thead>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the DataGridHeaderCell sub-component. */\nexport interface DataGridHeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /** Column ID used for sort tracking. Required for `sortable`. */\n columnId?: string;\n /**\n * Whether this column can be sorted. The content is rendered inside a `<button>`; the header\n * cell carries `aria-sort`. Ignored (with a development warning) without `columnId`.\n * @default false\n */\n sortable?: boolean;\n /** Header cell content. */\n children: React.ReactNode;\n /** Ref to the `<th>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** Properties for the DataGridBody sub-component. */\nexport interface DataGridBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /** DataGrid row elements. */\n children: React.ReactNode;\n /** Ref to the `<tbody>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the DataGridRow sub-component. */\nexport interface DataGridRowProps extends React.HTMLAttributes<HTMLTableRowElement> {\n /**\n * Unique identifier for this row, used for selection (rows that share one are selected together;\n * a duplicate warns in development). A selectable grid renders no selection control (and warns\n * in development) for a row without it.\n */\n rowId?: string;\n /**\n * Accessible name of the row's selection control. Defaults to the row's first child that is a\n * `DataGrid.Cell`, `<td>` or `<th>` element (`aria-labelledby`); a cell that another component\n * renders is not seen, so pass `selectionLabel` when the row's first cell is one. Without such a\n * child the control is named \"Select row\" (with a development warning).\n */\n selectionLabel?: string;\n /** DataGrid cell elements. */\n children: React.ReactNode;\n /** Ref to the `<tr>` element. */\n ref?: React.Ref<HTMLTableRowElement>;\n}\n\n/** Properties for the DataGridCell sub-component. */\nexport interface DataGridCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Cell content. */\n children: React.ReactNode;\n /** Ref to the `<td>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n// ---------------------------------------------------------------------------\n// Selection store\n// ---------------------------------------------------------------------------\n\ntype SelectAllState = 'all' | 'some' | 'none';\n\n/**\n * Selection state shared with the rows through `useSyncExternalStore`, so toggling one row\n * re-renders only that row (and the select-all header cell). The root pushes the committed\n * selection in a layout effect; rows register their ids. The effective selection is always\n * `selected ∩ registered`, derived on read (no pruning effect).\n *\n * @internal Not exported from the package (exported for its unit tests).\n */\nexport interface SelectionStore {\n /**\n * Row subscription: notified only when the selection changes. Rows registering or unregistering\n * notify no row, so adding or removing k of n rows costs O(k), not O(k·n); the one exception is\n * single mode with several selected ids, where a row registering can move the selected row.\n */\n subscribe(listener: () => void): () => void;\n /**\n * Select-all subscription: notified only when {@link getSelectAllState} changes (through the\n * selection or through rows registering and unregistering).\n */\n subscribeSelectAll(listener: () => void): () => void;\n /** Registers a rendered row id; returns the unregister function. */\n register(rowId: string): () => void;\n /** How many rendered rows are registered with `rowId` (more than one: a duplicate). */\n countRegistrations(rowId: string): number;\n /** Sets the committed selection (layout effect of the root). */\n setSelected(items: readonly string[]): void;\n /**\n * Sets whether the grid is in single mode (layout effect of the root). Only then do rows\n * registering or unregistering re-check the one selected row of single mode and notify the rows.\n */\n setSingleMode(single: boolean): void;\n /**\n * Whether the row is selected. With `single`, only one row is: the first selected id (in\n * selection order) whose row is registered, else the first selected id (before any row\n * registered: the server render and the first client render).\n */\n isSelected(rowId: string, single?: boolean): boolean;\n /** Whether all, some or none of the registered rows are selected. O(1). */\n getSelectAllState(): SelectAllState;\n /** Registered row ids in registration order. */\n getRegistered(): string[];\n /** `items` restricted to registered rows (order of `items`). */\n prune(items: readonly string[]): string[];\n}\n\n/**\n * Creates the {@link SelectionStore} of one DataGrid.\n *\n * @internal Not exported from the package (exported for its unit tests).\n */\nexport function createSelectionStore(\n initial: readonly string[],\n initialSingleMode = false,\n): SelectionStore {\n let selected: ReadonlySet<string> = new Set(initial);\n /** Registered row id -> number of rows registered with it. */\n const registered = new Map<string, number>();\n /** How many registered row ids are selected (kept up to date, so select-all is O(1)). */\n let selectedRegistered = 0;\n let selectAll: SelectAllState = 'none';\n let singleMode = initialSingleMode;\n /** The one selected row of single mode (see `isSelected`); `undefined`: not computed yet. */\n let singleId: string | null | undefined;\n const rowListeners = new Set<() => void>();\n const selectAllListeners = new Set<() => void>();\n\n const notify = (listeners: Set<() => void>) => {\n for (const listener of Array.from(listeners)) listener();\n };\n\n /** Computed on read: O(selected ids) once per change, and only in single mode. */\n const getSingleId = (): string | null => {\n if (singleId !== undefined) return singleId;\n let first: string | null = null;\n for (const rowId of selected) {\n if (registered.has(rowId)) {\n first = rowId;\n break;\n }\n first ??= rowId;\n }\n singleId = first;\n return first;\n };\n\n /**\n * A row id registered or unregistered. With several selected ids, the one selected row of\n * single mode can move: in single mode it is re-checked and the rows are notified if it moved.\n */\n const onRegistrationChange = (rowId: string) => {\n if (selected.size < 2 || !selected.has(rowId)) return;\n const previous = singleId;\n singleId = undefined;\n if (singleMode && getSingleId() !== previous) notify(rowListeners);\n };\n\n const updateSelectAll = () => {\n const next: SelectAllState =\n selectedRegistered === 0 ? 'none' : selectedRegistered === registered.size ? 'all' : 'some';\n if (next === selectAll) return;\n selectAll = next;\n notify(selectAllListeners);\n };\n\n const subscribeTo = (listeners: Set<() => void>) => (listener: () => void) => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n };\n\n return {\n subscribe: subscribeTo(rowListeners),\n subscribeSelectAll: subscribeTo(selectAllListeners),\n register(rowId) {\n const count = registered.get(rowId) ?? 0;\n registered.set(rowId, count + 1);\n if (count === 0 && selected.has(rowId)) selectedRegistered += 1;\n updateSelectAll();\n if (count === 0) onRegistrationChange(rowId);\n let done = false;\n return () => {\n if (done) return;\n done = true;\n const remaining = (registered.get(rowId) ?? 0) - 1;\n if (remaining > 0) {\n registered.set(rowId, remaining);\n return;\n }\n registered.delete(rowId);\n if (selected.has(rowId)) selectedRegistered -= 1;\n updateSelectAll();\n onRegistrationChange(rowId);\n };\n },\n setSelected(items) {\n const next = new Set(items);\n if (next.size === selected.size && items.every((item) => selected.has(item))) return;\n selected = next;\n singleId = undefined;\n selectedRegistered = 0;\n for (const rowId of next) if (registered.has(rowId)) selectedRegistered += 1;\n notify(rowListeners);\n updateSelectAll();\n },\n setSingleMode(single) {\n singleMode = single;\n },\n isSelected(rowId, single = false) {\n return single ? getSingleId() === rowId : selected.has(rowId);\n },\n countRegistrations(rowId) {\n return registered.get(rowId) ?? 0;\n },\n getSelectAllState() {\n return selectAll;\n },\n getRegistered() {\n return Array.from(registered.keys());\n },\n prune(items) {\n return items.filter((item) => registered.has(item));\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// Header selection slots\n// ---------------------------------------------------------------------------\n\n/**\n * The selection column's header slots of one `DataGrid.Header`, one per header row. Only the first\n * slot in document order renders the \"Select all rows\" control (the \"Selection\" text in single\n * mode); the others render an empty cell, so a grouped header (several header rows) has one control\n * and every header row keeps the selection column.\n */\ninterface HeaderSlotRegistry {\n subscribe(listener: () => void): () => void;\n /** Registers a slot and a getter for its current cell; returns the unregister function. */\n register(slot: object, getCell: () => Element | null): () => void;\n /** The first slot in document order, or `null` while no slot is registered. */\n getFirst(): object | null;\n /** Re-checks the order: header rows can move without a slot mounting or unmounting. */\n refresh(): void;\n}\n\nfunction createHeaderSlotRegistry(): HeaderSlotRegistry {\n const slots = new Map<object, () => Element | null>();\n const listeners = new Set<() => void>();\n let first: object | null = null;\n\n const update = () => {\n let next: object | null = null;\n let nextCell: Element | null = null;\n for (const [slot, getCell] of slots) {\n const cell = getCell();\n if (!cell) {\n // A slot whose cell is being replaced (control <-> empty cell): keep the current order\n // until the next registration or header commit sees every cell again.\n if (first !== null && slots.has(first)) return;\n continue;\n }\n if (!nextCell || cell.compareDocumentPosition(nextCell) & Node.DOCUMENT_POSITION_FOLLOWING) {\n next = slot;\n nextCell = cell;\n }\n }\n if (next === null) next = slots.keys().next().value ?? null;\n if (next === first) return;\n first = next;\n for (const listener of Array.from(listeners)) listener();\n };\n\n return {\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n register(slot, getCell) {\n slots.set(slot, getCell);\n update();\n return () => {\n slots.delete(slot);\n update();\n };\n },\n getFirst: () => first,\n refresh: update,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Contexts\n// ---------------------------------------------------------------------------\n\ninterface DataGridContextValue {\n selectionMode: 'none' | SelectionMode;\n store: SelectionStore;\n /** Toggles one row (single mode: selects it alone, or clears it). */\n toggleRow: (rowId: string) => void;\n /** Selects every rendered row, or clears the selection when all are selected. */\n toggleAll: () => void;\n /** Shared `name` of the single-mode radios (they are kept out of any form with `form=\"\"`). */\n radioName: string;\n /** Name of the select-all checkbox (multiple mode). */\n selectAllLabel: string;\n /** Hidden header text of the selection column (single mode). */\n selectionHeaderLabel: string;\n}\n\ninterface DataGridSortContextValue {\n sort: DataGridSort | null;\n requestSort: (columnId: string) => void;\n}\n\ntype DataGridSection = 'header' | 'body';\n\nconst DataGridContext = React.createContext<DataGridContextValue | null>(null);\nconst DataGridSortContext = React.createContext<DataGridSortContextValue | null>(null);\n/** Whether a row is rendered in the header or the body (rows in a header get a header cell). */\nconst DataGridSectionContext = React.createContext<DataGridSection>('body');\n/** The header's selection slots (see {@link HeaderSlotRegistry}). */\nconst DataGridHeaderSlotsContext = React.createContext<HeaderSlotRegistry | null>(null);\n/**\n * Whether the header row below is the header's first row, as far as the header can tell from its\n * children. Only the initial (and server) render uses it; the slots then follow the DOM order.\n */\nconst DataGridHeaderRowHintContext = React.createContext(true);\n\nconst INERT_STORE = createSelectionStore([]);\nconst INERT_CONTEXT: DataGridContextValue = {\n selectionMode: 'none',\n store: INERT_STORE,\n toggleRow: () => {},\n toggleAll: () => {},\n radioName: '',\n selectAllLabel: DEFAULT_SELECT_ALL_LABEL,\n selectionHeaderLabel: DEFAULT_SELECTION_HEADER_LABEL,\n};\nconst INERT_SORT_CONTEXT: DataGridSortContextValue = { sort: null, requestSort: () => {} };\n\nfunction useDataGridContext(component: string): DataGridContextValue {\n const ctx = React.useContext(DataGridContext);\n if (ctx) return ctx;\n reportMissingContext(component, 'DataGrid');\n return INERT_CONTEXT;\n}\n\nfunction useDataGridSortContext(component: string): DataGridSortContextValue {\n const ctx = React.useContext(DataGridSortContext);\n if (ctx) return ctx;\n reportMissingContext(component, 'DataGrid');\n return INERT_SORT_CONTEXT;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst EMPTY_ITEMS: readonly string[] = [];\n\nfunction toItems(\n keys: ReadonlySet<string> | readonly string[] | undefined,\n): readonly string[] | undefined {\n return keys === undefined ? undefined : Array.from(keys);\n}\n\nfunction sameItems(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((item, index) => item === b[index]);\n}\n\n/** A child of {@link flattenChildren} under its flattened key (unique across the flattened list). */\nfunction renderFlatChild({ key, node }: { key: string; node: React.ReactNode }): React.ReactNode {\n return <React.Fragment key={key}>{node}</React.Fragment>;\n}\n\nfunction warnDuplicateRowId(rowId: string): void {\n warnOnce(\n `DataGrid:duplicate-rowId:${rowId}`,\n `DataGrid: several rows share the rowId \"${rowId}\". Row ids must be unique within a ` +\n 'DataGrid; rows with the same rowId are selected and deselected together.',\n );\n}\n\nconst cellBase = 'px-4 py-3 border-b border-border';\nconst selectionCell = 'w-10 px-3 py-3 border-b border-border';\nconst nativeControl = 'accent-primary cursor-pointer';\n\n// ---------------------------------------------------------------------------\n// DataGrid\n// ---------------------------------------------------------------------------\n\n// The component-level JSDoc sits on the exported `DataGrid` below.\nconst DataGridRoot = (props: DataGridProps) => {\n const {\n sort: sortProp,\n defaultSort,\n sortColumn: sortColumnProp,\n defaultSortColumn,\n sortDirection: sortDirectionProp,\n defaultSortDirection,\n onSortChange,\n selectionMode = 'none',\n selectedItems: selectedItemsProp,\n defaultSelectedItems,\n onSelectedItemsChange,\n selectedKeys,\n defaultSelectedKeys,\n onSelectionChange,\n labels,\n columns,\n containerProps,\n children,\n className,\n onKeyDown,\n onFocus,\n onBlur,\n ref,\n ...rest\n } = props;\n\n // --- sort -----------------------------------------------------------------\n /** 0.5 API: `onSortChange(sort)`. Sticky once `sort`/`defaultSort` was given. */\n const usesSortApi = sortProp !== undefined || defaultSort !== undefined;\n const [sortApiMode, setSortApiMode] = React.useState(usesSortApi);\n if (usesSortApi && !sortApiMode) setSortApiMode(true);\n const objectCallbacks = sortApiMode || usesSortApi;\n\n const legacySortControlled = sortColumnProp !== undefined || sortDirectionProp !== undefined;\n if (sortColumnProp !== undefined) warnDeprecated('DataGrid', 'sortColumn', 'sort');\n if (sortDirectionProp !== undefined) warnDeprecated('DataGrid', 'sortDirection', 'sort');\n if (defaultSortColumn !== undefined) {\n warnDeprecated('DataGrid', 'defaultSortColumn', 'defaultSort');\n }\n if (defaultSortDirection !== undefined) {\n warnDeprecated('DataGrid', 'defaultSortDirection', 'defaultSort');\n }\n const mixedSortApi =\n usesSortApi &&\n (legacySortControlled || defaultSortColumn !== undefined || defaultSortDirection !== undefined);\n\n React.useEffect(() => {\n if (mixedSortApi) {\n warnOnce(\n 'DataGrid:mixed-sort',\n 'DataGrid: do not mix `sort`/`defaultSort` with the deprecated `sortColumn`/`sortDirection`/' +\n '`defaultSortColumn`/`defaultSortDirection`. `sort`/`defaultSort` win.',\n );\n }\n }, [mixedSortApi]);\n // 0.4 mixed control: `sortColumn` and `sortDirection` are controlled independently. The half the\n // parent does not control is kept here (seeded from its default) and follows every sort request,\n // as 0.4 did, so repeated clicks still alternate and aria-sort shows what was reported.\n React.useEffect(() => {\n if (usesSortApi) return;\n if (sortColumnProp !== undefined && sortDirectionProp === undefined) {\n warnOnce(\n 'DataGrid:sortColumn-without-sortDirection',\n 'DataGrid: `sortColumn` is controlled but `sortDirection` is not (mixed control). The ' +\n 'direction is kept internally and toggles on repeated clicks, as in 0.4. Pass `sort` ' +\n '(`{ columnId, direction }`) to control both.',\n );\n } else if (sortDirectionProp !== undefined && sortColumnProp === undefined) {\n warnOnce(\n 'DataGrid:sortDirection-without-sortColumn',\n 'DataGrid: `sortDirection` is controlled but `sortColumn` is not (mixed control). The ' +\n 'column is kept internally and follows the clicked header, as in 0.4. Pass `sort` ' +\n '(`{ columnId, direction }`) to control both.',\n );\n }\n }, [usesSortApi, sortColumnProp, sortDirectionProp]);\n\n /** The uncontrolled halves of the 0.4 sort props (used while the other half is controlled). */\n const [legacyHalves, setLegacyHalves] = React.useState<{\n column: string;\n direction: SortDirection;\n }>(() => ({\n column: defaultSortColumn ?? '',\n direction: defaultSortDirection ?? 'ascending',\n }));\n\n const legacyControlledSort = React.useMemo<DataGridSort | null | undefined>(() => {\n if (sortColumnProp === undefined && sortDirectionProp === undefined) return undefined;\n const column = sortColumnProp ?? legacyHalves.column;\n return column === ''\n ? null\n : { columnId: column, direction: sortDirectionProp ?? legacyHalves.direction };\n }, [sortColumnProp, sortDirectionProp, legacyHalves]);\n\n const legacyDefaultSort = React.useMemo<DataGridSort | null>(\n () =>\n defaultSortColumn\n ? { columnId: defaultSortColumn, direction: defaultSortDirection ?? 'ascending' }\n : null,\n [defaultSortColumn, defaultSortDirection],\n );\n\n const controlledSort = usesSortApi ? sortProp : legacyControlledSort;\n const initialSort = defaultSort !== undefined ? defaultSort : legacyDefaultSort;\n\n const emitSortChange = (next: DataGridSort | null) => {\n if (!next) return;\n if (!usesSortApi) {\n setLegacyHalves((previous) =>\n previous.column === next.columnId && previous.direction === next.direction\n ? previous\n : { column: next.columnId, direction: next.direction },\n );\n }\n if (!onSortChange) return;\n if (objectCallbacks) {\n (onSortChange as (sort: DataGridSort) => void)(next);\n } else {\n const legacy = onSortChange as (columnId: string, direction: SortDirection) => void;\n legacy(next.columnId, next.direction);\n }\n };\n\n const [sort, setSort] = useControllable<DataGridSort | null>(\n controlledSort,\n initialSort,\n emitSortChange,\n );\n\n const requestSort = React.useCallback(\n (columnId: string) => {\n setSort((previous) => ({\n columnId,\n direction:\n previous?.columnId === columnId && previous.direction === 'ascending'\n ? 'descending'\n : 'ascending',\n }));\n },\n [setSort],\n );\n\n const sortContext = React.useMemo<DataGridSortContextValue>(\n () => ({ sort, requestSort }),\n [sort, requestSort],\n );\n\n // --- selection ------------------------------------------------------------\n if (onSelectionChange !== undefined) {\n warnDeprecated('DataGrid', 'onSelectionChange', 'onSelectedItemsChange');\n }\n const legacySelected = React.useMemo(() => toItems(selectedKeys), [selectedKeys]);\n const legacyDefaultSelected = React.useMemo(\n () => toItems(defaultSelectedKeys),\n [defaultSelectedKeys],\n );\n const controlledSelected = resolveDeprecatedProp(\n 'DataGrid',\n selectedItemsProp,\n legacySelected,\n 'selectedKeys',\n 'selectedItems',\n );\n const defaultSelected =\n resolveDeprecatedProp(\n 'DataGrid',\n defaultSelectedItems,\n legacyDefaultSelected,\n 'defaultSelectedKeys',\n 'defaultSelectedItems',\n ) ?? EMPTY_ITEMS;\n\n const emitSelectionChange = (next: readonly string[]) => {\n onSelectedItemsChange?.([...next]);\n onSelectionChange?.(new Set(next));\n };\n\n const [selected, setSelected] = useControllable<readonly string[]>(\n controlledSelected,\n defaultSelected,\n emitSelectionChange,\n );\n\n const single = selectionMode === 'single';\n const [store] = React.useState(() => createSelectionStore(selected, single));\n React.useLayoutEffect(() => {\n store.setSelected(selected);\n }, [store, selected]);\n React.useLayoutEffect(() => {\n store.setSingleMode(single);\n }, [store, single]);\n\n const toggleRow = React.useCallback(\n (rowId: string) => {\n setSelected((previous) => {\n const effective = store.prune(previous);\n let next: string[];\n if (single) {\n // Single mode shows the first selected row that is rendered (see the store).\n next = effective[0] === rowId ? [] : [rowId];\n } else {\n next = effective.includes(rowId)\n ? effective.filter((item) => item !== rowId)\n : [...effective, rowId];\n }\n return sameItems(next, previous) ? previous : next;\n });\n },\n [single, setSelected, store],\n );\n\n const selectedCount = selected.length;\n React.useEffect(() => {\n if (single && selectedCount > 1) {\n warnOnce(\n 'DataGrid:single-several-selected',\n `DataGrid: a single-selection grid (selectionMode \"single\") has ${selectedCount} selected row ids; only the first one that is rendered is selected. Pass at most one id in \\`selectedItems\\`/\\`defaultSelectedItems\\`, or use selectionMode=\"multiple\".`,\n );\n }\n }, [single, selectedCount]);\n\n const toggleAll = React.useCallback(() => {\n setSelected((previous) => {\n const effective = store.prune(previous);\n const all = store.getRegistered();\n const allSelected = all.length > 0 && all.every((rowId) => effective.includes(rowId));\n const next = allSelected ? [] : all;\n return sameItems(next, previous) ? previous : next;\n });\n }, [setSelected, store]);\n\n const radioName = useId('wave-datagrid-selection');\n const selectAllLabel = labels?.selectAll ?? DEFAULT_SELECT_ALL_LABEL;\n const selectionHeaderLabel = labels?.selectionHeader ?? DEFAULT_SELECTION_HEADER_LABEL;\n\n const context = React.useMemo<DataGridContextValue>(\n () => ({\n selectionMode,\n store,\n toggleRow,\n toggleAll,\n radioName,\n selectAllLabel,\n selectionHeaderLabel,\n }),\n [selectionMode, store, toggleRow, toggleAll, radioName, selectAllLabel, selectionHeaderLabel],\n );\n\n // --- keyboard -------------------------------------------------------------\n const { gridRef, gridProps } = useGridNavigation();\n const mergedRef = useMergedRefs<HTMLTableElement>(ref, gridRef);\n\n // --- header from columns ----------------------------------------------------\n let content: React.ReactNode = children;\n const flatChildren = columns ? flattenChildren(children) : [];\n if (columns && !flatChildren.some(({ node }) => isElementOfType(node, DataGridHeader))) {\n // A `<caption>` stays the table's first child, before the generated header.\n const isCaption = ({ node }: { node: React.ReactNode }) => isElementOfType(node, 'caption');\n content = (\n <>\n {flatChildren.filter(isCaption).map(renderFlatChild)}\n <DataGridHeader>\n <tr>\n {columns.map((column) => (\n <DataGridHeaderCell key={column.id} columnId={column.id} sortable={column.sortable}>\n {column.label}\n </DataGridHeaderCell>\n ))}\n </tr>\n </DataGridHeader>\n {flatChildren.filter((child) => !isCaption(child)).map(renderFlatChild)}\n </>\n );\n }\n\n const {\n className: containerClassName,\n 'aria-label': containerLabel,\n 'aria-labelledby': containerLabelledBy,\n ...containerRest\n } = containerProps ?? {};\n // The wrapper has no role of its own, and a name is prohibited on a role-less `<div>`: the\n // consumer's name is kept only together with a role.\n const containerHasRole = containerRest.role !== undefined;\n const droppedContainerName =\n !containerHasRole && (containerLabel !== undefined || containerLabelledBy !== undefined);\n\n React.useEffect(() => {\n if (droppedContainerName) {\n warnOnce(\n 'DataGrid:container-name-without-role',\n 'DataGrid: `containerProps[\"aria-label\"]`/`[\"aria-labelledby\"]` is ignored because the ' +\n 'wrapper has no role. Name the grid itself (`aria-label` on DataGrid), or pass a ' +\n '`role` (e.g. \"region\") in `containerProps` too.',\n );\n }\n }, [droppedContainerName]);\n\n return (\n <DataGridContext.Provider value={context}>\n <DataGridSortContext.Provider value={sortContext}>\n <div\n {...containerRest}\n aria-label={containerHasRole ? containerLabel : undefined}\n aria-labelledby={containerHasRole ? containerLabelledBy : undefined}\n className={cn('overflow-x-auto rounded-md border border-border', containerClassName)}\n >\n <table\n ref={mergedRef}\n role=\"grid\"\n aria-multiselectable={selectionMode === 'multiple' || undefined}\n className={cn('w-full border-separate border-spacing-0', className)}\n {...rest}\n onKeyDown={composeEventHandlers(onKeyDown, gridProps.onKeyDown)}\n onFocus={composeEventHandlers(onFocus, gridProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n onBlur={composeEventHandlers(onBlur, gridProps.onBlur, {\n checkDefaultPrevented: false,\n })}\n >\n {content}\n </table>\n </div>\n </DataGridSortContext.Provider>\n </DataGridContext.Provider>\n );\n};\nDataGridRoot.displayName = 'DataGrid';\n\n// ---------------------------------------------------------------------------\n// Selection header cell (internal)\n// ---------------------------------------------------------------------------\n\nfunction DataGridSelectionHeaderCell({\n selectionMode,\n ref,\n}: {\n selectionMode: SelectionMode;\n ref?: React.Ref<HTMLTableCellElement>;\n}) {\n const { store, toggleAll, selectAllLabel, selectionHeaderLabel } =\n useDataGridContext('DataGrid.Header');\n const state = React.useSyncExternalStore(\n store.subscribeSelectAll,\n store.getSelectAllState,\n store.getSelectAllState,\n );\n const inputRef = React.useRef<HTMLInputElement>(null);\n // A click clears the checkbox's `indeterminate` flag (checkbox activation does) and React restores\n // only `checked`, so the flag is re-applied after every click, also when the select-all state\n // stays the same (a controlled parent that keeps the selection partial, or ignores the change).\n const [clicks, setClicks] = React.useState(0);\n\n React.useLayoutEffect(() => {\n if (inputRef.current) inputRef.current.indeterminate = state === 'some';\n }, [state, clicks]);\n\n return (\n <th\n ref={ref}\n scope=\"col\"\n data-selection-cell=\"\"\n className={cn(selectionCell, 'text-start', focusRingInset)}\n >\n {selectionMode === 'multiple' ? (\n <input\n ref={inputRef}\n type=\"checkbox\"\n aria-label={selectAllLabel}\n checked={state === 'all'}\n onChange={() => {\n setClicks((count) => count + 1);\n toggleAll();\n }}\n className={cn(nativeControl, focusRingInset)}\n />\n ) : (\n <span className=\"sr-only\">{selectionHeaderLabel}</span>\n )}\n </th>\n );\n}\n\nconst INERT_HEADER_SLOTS: HeaderSlotRegistry = {\n subscribe: () => () => {},\n register: () => () => {},\n getFirst: () => null,\n refresh: () => {},\n};\n\n/**\n * The selection column's cell of one header row: the select-all header cell in the header's first\n * row (document order), an empty cell in every later row. `initialFirst` is the header's guess from\n * its children, used until the slots are registered (the initial and the server render).\n */\nfunction DataGridSelectionHeaderSlot({\n selectionMode,\n initialFirst,\n}: {\n selectionMode: SelectionMode;\n initialFirst: boolean;\n}) {\n const slots = React.useContext(DataGridHeaderSlotsContext) ?? INERT_HEADER_SLOTS;\n const [slot] = React.useState(() => ({}));\n const cellRef = React.useRef<HTMLTableCellElement | null>(null);\n\n const getIsFirst = React.useCallback(() => {\n const first = slots.getFirst();\n return first === null ? initialFirst : first === slot;\n }, [slots, slot, initialFirst]);\n const getServerIsFirst = React.useCallback(() => initialFirst, [initialFirst]);\n const isFirst = React.useSyncExternalStore(slots.subscribe, getIsFirst, getServerIsFirst);\n\n React.useLayoutEffect(() => slots.register(slot, () => cellRef.current), [slots, slot]);\n\n return isFirst ? (\n <DataGridSelectionHeaderCell ref={cellRef} selectionMode={selectionMode} />\n ) : (\n <td ref={cellRef} data-selection-cell=\"\" className={cn(selectionCell, focusRingInset)} />\n );\n}\n\n// ---------------------------------------------------------------------------\n// Sub-components\n// ---------------------------------------------------------------------------\n\n/**\n * Prepends the selection column's header slot (or `null`) to every `<tr>` in `children`, looking\n * inside Fragments, and tells every other element child (a `DataGrid.Row`, or a component that\n * renders one) whether it is the header's first row. Every row gets the same child shape in every\n * selection mode, so switching `selectionMode` does not remount the header cells.\n */\nfunction withSelectionHeaderSlots(\n children: React.ReactNode,\n selectionMode: 'none' | SelectionMode,\n): React.ReactNode {\n let first = true;\n const visit = (nodes: React.ReactNode): React.ReactNode =>\n React.Children.map(nodes, (child) => {\n if (isElementOfType<{ children?: React.ReactNode }>(child, React.Fragment)) {\n return React.cloneElement(child, undefined, visit(child.props.children));\n }\n if (!React.isValidElement(child)) return child;\n const isFirst = first;\n first = false;\n if (isElementOfType<{ children?: React.ReactNode }>(child, 'tr')) {\n const slot =\n selectionMode === 'none' ? null : (\n <DataGridSelectionHeaderSlot selectionMode={selectionMode} initialFirst={isFirst} />\n );\n return React.cloneElement(child, undefined, slot, child.props.children);\n }\n return (\n <DataGridHeaderRowHintContext.Provider value={isFirst}>\n {child}\n </DataGridHeaderRowHintContext.Provider>\n );\n });\n return visit(children);\n}\n\n/**\n * The grid's `<thead>`. When the grid is selectable, it prepends the selection column's header\n * cell to each `<tr>` child, also inside a Fragment: the first header row gets the \"Select all\n * rows\" checkbox (multiple mode) or the \"Selection\" header (single mode; DataGrid's `labels`\n * localizes both), later rows of a grouped header an empty cell. A header row rendered by another\n * component cannot get it (a development warning says so): use `DataGrid.Row` for such a row,\n * which adds the cell itself.\n */\nconst DataGridHeader = ({ children, className, ref, ...rest }: DataGridHeaderProps) => {\n const { selectionMode } = useDataGridContext('DataGrid.Header');\n const [thead, setThead] = React.useState<HTMLTableSectionElement | null>(null);\n const mergedRef = useMergedRefs<HTMLTableSectionElement>(ref, setThead);\n const [slots] = React.useState(createHeaderSlotRegistry);\n const content = withSelectionHeaderSlots(children, selectionMode);\n\n // Every commit, after the rows' slots registered: header rows can move without a slot mounting.\n React.useLayoutEffect(() => {\n slots.refresh();\n });\n\n // Every commit: header rows can come from components the header cannot see into.\n React.useEffect(() => {\n if (!isDev || !thead || selectionMode === 'none') return;\n const missing = Array.from(thead.rows).some(\n (row) => row.cells.length > 0 && !row.cells[0].hasAttribute('data-selection-cell'),\n );\n if (missing) {\n warnOnce(\n 'DataGrid.Header:missing-selection-cell',\n 'DataGrid.Header: a header row has no selection column header cell, so the header has one ' +\n 'column fewer than the selectable rows. Render header rows as `<tr>` children of ' +\n 'DataGrid.Header (a Fragment is fine), or use `DataGrid.Row` for a header row that ' +\n 'another component renders.',\n );\n }\n });\n\n return (\n <DataGridSectionContext.Provider value=\"header\">\n <DataGridHeaderSlotsContext.Provider value={slots}>\n <thead ref={mergedRef} className={cn('bg-card', className)} {...rest}>\n {content}\n </thead>\n </DataGridHeaderSlotsContext.Provider>\n </DataGridSectionContext.Provider>\n );\n};\nDataGridHeader.displayName = 'DataGridHeader';\n\nconst sortIcon = (direction: SortDirection) => (\n <svg\n className=\"h-3 w-3 shrink-0\"\n viewBox=\"0 0 12 12\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n {direction === 'ascending' ? <path d=\"M6 2L10 8H2L6 2Z\" /> : <path d=\"M6 10L2 4H10L6 10Z\" />}\n </svg>\n);\n\n/**\n * A column header cell. A `sortable` header (with a `columnId`) renders its content inside a\n * `<button type=\"button\">` that toggles the sort; the `<th>` carries `aria-sort`. A consumer\n * `onClick` (on the `<th>`) runs before the sort, and calling `preventDefault()` in it cancels the\n * sort (also for Enter/Space on the button, which click it).\n */\nconst DataGridHeaderCell = ({\n columnId,\n sortable = false,\n children,\n className,\n onClick,\n ref,\n ...rest\n}: DataGridHeaderCellProps) => {\n const { sort, requestSort } = useDataGridSortContext('DataGrid.HeaderCell');\n /** The column this header sorts, or `undefined` when it is not sortable. */\n const sortColumnId = sortable && columnId ? columnId : undefined;\n const sortedDirection =\n sortColumnId !== undefined && sort?.columnId === sortColumnId ? sort.direction : null;\n\n // The sort runs from the `<th>` once the button's click bubbled up to it, composed after the\n // consumer's `onClick` (C-COMPOSE): the consumer runs first and can cancel with preventDefault().\n // The sort button is the `<th>`'s only child; clicks elsewhere in the cell do not sort.\n const sortOnButtonClick = (event: React.MouseEvent<HTMLTableCellElement>) => {\n const button = event.currentTarget.firstElementChild;\n if (\n sortColumnId !== undefined &&\n button?.localName === 'button' &&\n button.contains(event.target as Node)\n ) {\n requestSort(sortColumnId);\n }\n };\n\n React.useEffect(() => {\n if (sortable && !columnId) {\n warnOnce(\n 'DataGrid.HeaderCell:sortable-without-columnId',\n 'DataGrid.HeaderCell: `sortable` needs a `columnId`; the header is rendered as not sortable.',\n );\n }\n }, [sortable, columnId]);\n\n return (\n <th\n ref={ref}\n scope=\"col\"\n aria-sort={sortColumnId !== undefined ? (sortedDirection ?? 'none') : undefined}\n className={cn(\n cellBase,\n 'text-start align-middle font-semibold text-caption-1 uppercase tracking-wider',\n focusRingInset,\n sortColumnId !== undefined && 'p-0 hover:bg-subtle-hover',\n className,\n )}\n {...rest}\n onClick={\n sortColumnId !== undefined ? composeEventHandlers(onClick, sortOnButtonClick) : onClick\n }\n >\n {sortColumnId !== undefined ? (\n <button\n type=\"button\"\n className={cn(\n 'inline-flex w-full cursor-pointer select-none items-center gap-1 border-0 bg-transparent px-4 py-3 text-start text-inherit [font:inherit] uppercase tracking-wider',\n focusRingInset,\n )}\n >\n {children}\n {sortedDirection && sortIcon(sortedDirection)}\n </button>\n ) : (\n <span className=\"inline-flex items-center gap-1\">{children}</span>\n )}\n </th>\n );\n};\nDataGridHeaderCell.displayName = 'DataGridHeaderCell';\n\n/** The grid's `<tbody>`. */\nconst DataGridBody = ({ children, className, ref, ...rest }: DataGridBodyProps) => (\n <DataGridSectionContext.Provider value=\"body\">\n <tbody ref={ref} className={className} {...rest}>\n {children}\n </tbody>\n </DataGridSectionContext.Provider>\n);\nDataGridBody.displayName = 'DataGridBody';\n\n/**\n * A grid row. In a selectable grid it starts with a selection cell (checkbox or radio) named\n * after the row's first cell (or `selectionLabel`); Space on one of its cells toggles the row.\n */\nconst DataGridRow = ({\n rowId,\n selectionLabel,\n children,\n className,\n onKeyDown,\n ref,\n ...rest\n}: DataGridRowProps) => {\n const { selectionMode, store, toggleRow, radioName } = useDataGridContext('DataGrid.Row');\n const section = React.useContext(DataGridSectionContext);\n const firstHeaderRowHint = React.useContext(DataGridHeaderRowHintContext);\n const inHeader = section === 'header';\n const selectable = selectionMode !== 'none' && !inHeader;\n const labelId = useId('wave-datagrid-row-label');\n\n const single = selectionMode === 'single';\n const getSelected = React.useCallback(\n () => rowId !== undefined && store.isSelected(rowId, single),\n [rowId, store, single],\n );\n // Notified only when the selection changes (in multiple mode, rows registering notify no row).\n const isSelected = React.useSyncExternalStore(store.subscribe, getSelected, getSelected);\n\n React.useLayoutEffect(() => {\n if (rowId === undefined || inHeader) return;\n const unregister = store.register(rowId);\n if (isDev && store.countRegistrations(rowId) > 1) warnDuplicateRowId(rowId);\n return unregister;\n }, [store, rowId, inHeader]);\n\n React.useEffect(() => {\n if (selectable && rowId === undefined) {\n warnOnce(\n 'DataGrid.Row:missing-rowId',\n 'DataGrid.Row: a selectable grid needs a `rowId` on every row; this row has no selection control.',\n );\n }\n }, [selectable, rowId]);\n\n const unlabelled = selectable && rowId !== undefined && selectionLabel === undefined;\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (!selectable || rowId === undefined || event.key !== ' ') return;\n const target = event.target as Element;\n // Only keys pressed on the row itself or on one of its own cells, never on a nested widget.\n if (target !== event.currentTarget && target.parentElement !== event.currentTarget) return;\n event.preventDefault();\n toggleRow(rowId);\n };\n\n // Name the selection control after the first cell (its own id, or a generated one). The children\n // are always flattened (Fragments too) and rendered under their flattened keys, whatever the\n // mode, so the keys stay the same when `selectionMode`, `selectionLabel` or `rowId` change and\n // the cells are not remounted.\n const flatChildren = flattenChildren(children);\n let labelledBy: string | undefined;\n let idCellIndex = -1;\n if (unlabelled) {\n const firstCellIndex = flatChildren.findIndex(({ node }) =>\n isElementOfType(node, DataGridCell, 'td', 'th'),\n );\n if (firstCellIndex >= 0) {\n const firstCell = flatChildren[firstCellIndex].node as React.ReactElement<{ id?: string }>;\n labelledBy = firstCell.props.id ?? labelId;\n if (firstCell.props.id === undefined) idCellIndex = firstCellIndex;\n }\n }\n const content = flatChildren.map(({ key, node }, index) =>\n renderFlatChild({\n key,\n node:\n index === idCellIndex\n ? React.cloneElement(node as React.ReactElement<{ id?: string }>, { id: labelId })\n : node,\n }),\n );\n\n const needsLabel = unlabelled && labelledBy === undefined;\n React.useEffect(() => {\n if (needsLabel) {\n warnOnce(\n 'DataGrid.Row:selection-label',\n 'DataGrid.Row: no child is a `DataGrid.Cell`, `<td>` or `<th>` element, so the row selection control is named \"Select row\". Pass `selectionLabel` (a cell rendered by another component is not seen).',\n );\n }\n }, [needsLabel]);\n\n let selectionCellElement: React.ReactNode = null;\n if (inHeader && selectionMode !== 'none') {\n selectionCellElement = (\n <DataGridSelectionHeaderSlot\n selectionMode={selectionMode}\n initialFirst={firstHeaderRowHint}\n />\n );\n } else if (selectable) {\n selectionCellElement = (\n <td role=\"gridcell\" data-selection-cell=\"\" className={cn(selectionCell, focusRingInset)}>\n {rowId !== undefined && (\n <input\n type={selectionMode === 'multiple' ? 'checkbox' : 'radio'}\n name={selectionMode === 'single' ? radioName : undefined}\n // The shared name groups the radios. `form=\"\"` matches no form, so they have no form\n // owner (still one group: same name, both ownerless) and never add a generated field\n // to an enclosing form's submission.\n form={selectionMode === 'single' ? '' : undefined}\n checked={isSelected}\n onChange={() => toggleRow(rowId)}\n aria-label={selectionLabel ?? (labelledBy ? undefined : 'Select row')}\n aria-labelledby={selectionLabel === undefined ? labelledBy : undefined}\n className={cn(nativeControl, focusRingInset)}\n />\n )}\n </td>\n );\n }\n\n return (\n <tr\n ref={ref}\n className={cn(\n !inHeader &&\n 'hover:bg-subtle-hover data-[selected]:bg-selected transition-colors motion-reduce:transition-none',\n selectable && isSelected && forcedColors.selectedContainer,\n className,\n )}\n aria-selected={selectable ? isSelected : undefined}\n data-selected={selectable && isSelected ? '' : undefined}\n {...rest}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n >\n {selectionCellElement}\n {content}\n </tr>\n );\n};\nDataGridRow.displayName = 'DataGridRow';\n\n/** A grid cell (`<td>`), focusable through the grid's keyboard navigation. */\nconst DataGridCell = ({ children, className, ref, ...rest }: DataGridCellProps) => (\n <td\n ref={ref}\n role=\"gridcell\"\n className={cn(cellBase, 'text-body-1', focusRingInset, className)}\n {...rest}\n >\n {children}\n </td>\n);\nDataGridCell.displayName = 'DataGridCell';\n\nexport { DataGridHeader, DataGridHeaderCell, DataGridBody, DataGridRow, DataGridCell };\n\n/**\n * An interactive data table (`role=\"grid\"`) following the APG Grid pattern: one tab stop,\n * arrow-key navigation between cells (Home/End, Ctrl+Home/Ctrl+End, PageUp/PageDown; Up/Down keep\n * the visual column, so a grouped header with spanning cells works), Enter/F2 to interact with a\n * cell's widgets and Escape to return to the cell. A composite widget in a cell (a Toolbar,\n * RadioGroup, TabList, …) is entered with Enter/F2 like a text field; it manages its own tab\n * indexes, so it keeps its own Tab stop. Supports sortable columns (controlled sorting:\n * `onSortChange` reports the new sort and the consumer reorders the rows) and single or multiple\n * row selection with a select-all header checkbox.\n *\n * Sub-components are available as `DataGrid.Header`, `DataGrid.HeaderCell`, `DataGrid.Body`,\n * `DataGrid.Row` and `DataGrid.Cell` in client components, and as the flat exports\n * `DataGridHeader`, `DataGridHeaderCell`, `DataGridBody`, `DataGridRow` and `DataGridCell` (the\n * form React Server Components can import).\n */\nexport const DataGrid = /* @__PURE__ */ Object.assign(DataG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AO,OAAOtI,GAAc;CAClE,QAAQgE;CACR,YAAYG;CACZ,MAAM6C;CACN,KAAKC;CACL,MAAMgB;AACR,CAAC"}
|
|
1
|
+
{"version":3,"file":"DataGrid.mjs","names":["useId","_Fragment","useId$1","React","DEFAULT_SELECT_ALL_LABEL","DEFAULT_SELECTION_HEADER_LABEL","createSelectionStore","selected","initial","registered","selectedRegistered","selectAll","singleMode","initialSingleMode","singleId","rowListeners","selectAllListeners","notify","listener","listeners","getSingleId","first","rowId","onRegistrationChange","previous","updateSelectAll","next","subscribeTo","count","done","remaining","items","item","single","createHeaderSlotRegistry","slots","update","nextCell","slot","getCell","cell","DataGridContext","DataGridSortContext","DataGridSectionContext","DataGridHeaderSlotsContext","DataGridHeaderRowHintContext","INERT_CONTEXT","INERT_SORT_CONTEXT","useDataGridContext","reportMissingContext","component","useDataGridSortContext","EMPTY_ITEMS","toItems","keys","sameItems","a","b","index","renderFlatChild","node","key","warnDuplicateRowId","cellBase","selectionCell","nativeControl","DataGridRoot","sortProp","sortColumnProp","sortDirectionProp","selectedItemsProp","rest","props","usesSortApi","defaultSort","sortApiMode","setSortApiMode","objectCallbacks","legacySortControlled","warnDeprecated","defaultSortColumn","defaultSortDirection","mixedSortApi","warnOnce","legacyHalves","setLegacyHalves","legacyControlledSort","column","legacyDefaultSort","sort","setSort","useControllable","onSortChange","requestSort","columnId","sortContext","onSelectionChange","legacySelected","selectedKeys","legacyDefaultSelected","defaultSelectedKeys","controlledSelected","resolveDeprecatedProp","defaultSelected","defaultSelectedItems","setSelected","onSelectedItemsChange","selectionMode","store","toggleRow","effective","selectedCount","toggleAll","all","radioName","selectAllLabel","labels","selectionHeaderLabel","context","useGridNavigation","mergedRef","useMergedRefs","ref","gridRef","content","children","flatChildren","columns","flattenChildren","isElementOfType","DataGridHeader","isCaption","Fragment","DataGridHeaderCell","child","containerClassName","containerLabel","containerLabelledBy","containerRest","containerProps","containerHasRole","droppedContainerName","cn","dataGridClassNames","className","composeEventHandlers","onKeyDown","gridProps","onFocus","onBlur","DataGridSelectionHeaderCell","state","inputRef","clicks","setClicks","dataGridHeaderClassNames","focusRingInset","INERT_HEADER_SLOTS","DataGridSelectionHeaderSlot","cellRef","getIsFirst","initialFirst","getServerIsFirst","isFirst","withSelectionHeaderSlots","visit","nodes","thead","setThead","isDev","row","sortIcon","dataGridHeaderCellClassNames","direction","sortColumnId","sortable","sortedDirection","sortOnButtonClick","button","event","onClick","DataGridBody","dataGridBodyClassNames","DataGridRow","section","firstHeaderRowHint","inHeader","selectable","labelId","getSelected","isSelected","unregister","unlabelled","selectionLabel","handleKeyDown","target","labelledBy","idCellIndex","firstCellIndex","DataGridCell","firstCell","needsLabel","selectionCellElement","dataGridRowClassNames","forcedColors","dataGridCellClassNames","DataGrid"],"sources":["../../../src/components/table/DataGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport {\n dataGridBodyClassNames,\n dataGridCellClassNames,\n dataGridClassNames,\n dataGridHeaderCellClassNames,\n dataGridHeaderClassNames,\n dataGridRowClassNames,\n} from '../../lib/classNames';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport {\n isDev,\n reportMissingContext,\n resolveDeprecatedProp,\n warnDeprecated,\n warnOnce,\n} from '../../lib/dev';\nimport { focusRingInset, forcedColors } from '../../lib/styles';\nimport type { SelectionMode } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useGridNavigation } from './useGridNavigation';\n\nexport type SortDirection = 'ascending' | 'descending';\n\n/** The sort state of a DataGrid: the sorted column and its direction. */\nexport interface DataGridSort {\n /** The `columnId` of the sorted column. */\n columnId: string;\n /** The sort direction. */\n direction: SortDirection;\n}\n\n/** Defines a column in the DataGrid. */\nexport interface DataGridColumn {\n /** Unique identifier for the column (the header cell's `columnId`). */\n id: string;\n /** Display label for the column header. */\n label: string;\n /** Whether the column supports sorting. */\n sortable?: boolean;\n}\n\n/** The built-in text of a DataGrid, for localization (see `DataGridBaseProps.labels`). */\nexport interface DataGridLabels {\n /** Accessible name of the select-all checkbox in the header (`selectionMode=\"multiple\"`).\n * @default 'Select all rows'\n */\n selectAll?: string;\n /**\n * Visually hidden text of the selection column's header cell (`selectionMode=\"single\"`), which\n * names that column.\n * @default 'Selection'\n */\n selectionHeader?: string;\n}\n\nconst DEFAULT_SELECT_ALL_LABEL = 'Select all rows';\nconst DEFAULT_SELECTION_HEADER_LABEL = 'Selection';\n\n/** Props of every DataGrid, whatever sort API it uses. */\nexport interface DataGridBaseProps extends React.HTMLAttributes<HTMLTableElement> {\n /**\n * Column definitions. When given and no `DataGrid.Header` child is present, the header row\n * (including the selection column) is rendered from them: `id` becomes the header cell's\n * `columnId`, `label` its content, `sortable` makes it a sort button.\n */\n columns?: readonly DataGridColumn[];\n /**\n * Row selection mode. `'multiple'` adds a checkbox column with a \"Select all rows\" header\n * checkbox; `'single'` adds a radio column (its header reads \"Selection\" to assistive\n * technology). `labels` localizes both texts.\n * @default 'none'\n */\n selectionMode?: 'none' | SelectionMode;\n /**\n * The name of the select-all checkbox and the header text of the selection column, for\n * localization. Unset members keep their English defaults. Rows are named with their own\n * `selectionLabel`.\n */\n labels?: DataGridLabels;\n /**\n * Controlled selected row ids (`DataGrid.Row` `rowId`). In single mode pass at most one id: with\n * several, only the first one whose row is rendered is selected (a development warning says so).\n */\n selectedItems?: readonly string[];\n /** Initially selected row ids (uncontrolled). In single mode, at most one (see `selectedItems`). */\n defaultSelectedItems?: readonly string[];\n /**\n * Called with the new selected row ids when the selection changes. Ids of rows that are not\n * rendered are left out of the reported selection and of the select-all state, so the next\n * change drops them. Until that change an uncontrolled grid still holds such an id: a row\n * re-added with the same `rowId` before then is shown selected again.\n */\n onSelectedItemsChange?: (selectedItems: string[]) => void;\n /** @deprecated Use `selectedItems` (an array). A `Set` or an array is accepted. */\n selectedKeys?: ReadonlySet<string> | readonly string[];\n /** @deprecated Use `defaultSelectedItems` (an array). A `Set` or an array is accepted. */\n defaultSelectedKeys?: ReadonlySet<string> | readonly string[];\n /** @deprecated Use `onSelectedItemsChange`, which receives an array. Both are called. */\n onSelectionChange?: (keys: Set<string>) => void;\n /**\n * Props for the wrapper `<div>` around the `<table>`: a horizontally scrollable container\n * (`overflow-x-auto`). Use it for its className, style (e.g. a max height) or ref. The wrapper\n * is not a tab stop (the grid's own cell tab stop scrolls it) and has no role, so its\n * `aria-label`/`aria-labelledby` are applied only together with a `role` (e.g. `'region'`);\n * without one they are dropped with a development warning. Name the grid with `aria-label`.\n */\n containerProps?: Omit<React.ComponentPropsWithRef<'div'>, 'children'>;\n /** DataGrid header, body, and row elements. */\n children: React.ReactNode;\n /** Ref to the `<table role=\"grid\">` element. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\ninterface NoDeprecatedSortProps {\n sortColumn?: never;\n defaultSortColumn?: never;\n sortDirection?: never;\n defaultSortDirection?: never;\n}\n\n/** The 0.5 sort API, controlled: `sort` + `onSortChange(sort)`. */\nexport interface DataGridControlledSortProps extends NoDeprecatedSortProps {\n /** The controlled sort, or `null` for an unsorted grid. */\n sort: DataGridSort | null;\n /** Initial sort while `sort` is not given yet. */\n defaultSort?: DataGridSort | null;\n /**\n * Called with the new sort when a sortable header is activated. Sorting is controlled: the\n * consumer reorders the rows.\n */\n onSortChange?: (sort: DataGridSort) => void;\n}\n\n/** The 0.5 sort API, uncontrolled: `defaultSort` (`null` for none) + `onSortChange(sort)`. */\nexport interface DataGridUncontrolledSortProps extends NoDeprecatedSortProps {\n sort?: undefined;\n /** The initial sort, or `null` for an initially unsorted grid. */\n defaultSort: DataGridSort | null;\n /**\n * Called with the new sort when a sortable header is activated. Sorting is controlled: the\n * consumer reorders the rows.\n */\n onSortChange?: (sort: DataGridSort) => void;\n}\n\n/**\n * The 0.4 sort API: `onSortChange(columnId, direction)` and the deprecated `sortColumn`/\n * `sortDirection` props. It applies whenever neither `sort` nor `defaultSort` is given. As in 0.4,\n * the column and the direction can be controlled independently: the half that is not controlled is\n * kept internally and follows every sort request (mixed control, warned in development).\n */\nexport interface DataGridLegacySortProps {\n sort?: undefined;\n defaultSort?: undefined;\n /**\n * @deprecated Use `sort` (`{ columnId, direction }` or `null`). Without `sortDirection`, the\n * direction is kept internally (it toggles on repeated clicks).\n */\n sortColumn?: string;\n /** @deprecated Use `defaultSort`. */\n defaultSortColumn?: string;\n /**\n * @deprecated Use `sort`. Without `sortColumn`, the column is kept internally (it follows the\n * clicked header, starting from `defaultSortColumn`).\n */\n sortDirection?: SortDirection;\n /** @deprecated Use `defaultSort`. */\n defaultSortDirection?: SortDirection;\n /**\n * Called when a sortable header is activated, with the 0.4 arguments. Pass `sort` or\n * `defaultSort` to receive a `DataGridSort` object instead: `defaultSort={null}` turns the\n * object form on for an initially unsorted grid. A `sort` that is still `undefined` (e.g. while\n * data loads) does not: pass `sort={sort ?? null}`.\n *\n * @example\n * <DataGrid defaultSort={null} onSortChange={(sort) => setSort(sort)}>…</DataGrid>\n */\n onSortChange?: (columnId: string, direction: SortDirection) => void;\n}\n\n/**\n * Properties for the DataGrid component. The sort props form a union: `sort`/`defaultSort` with\n * `onSortChange(sort)` (0.5), or the 0.4 form `onSortChange(columnId, direction)` with the\n * deprecated `sortColumn`/`sortDirection`/`defaultSortColumn`/`defaultSortDirection`. The two\n * cannot be mixed.\n */\nexport type DataGridProps = DataGridBaseProps &\n (DataGridControlledSortProps | DataGridUncontrolledSortProps | DataGridLegacySortProps);\n\n/** Properties for the DataGridHeader sub-component. */\nexport interface DataGridHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /**\n * Header row elements. Each `<tr>` child (also inside a Fragment) gets the selection column's\n * header cell prepended when the grid is selectable; a header row rendered by another component\n * should be a `DataGrid.Row`, which adds the cell itself. With several header rows (a grouped\n * header), only the first one gets the \"Select all rows\" control; later rows get an empty cell.\n */\n children: React.ReactNode;\n /** Ref to the `<thead>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the DataGridHeaderCell sub-component. */\nexport interface DataGridHeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /** Column ID used for sort tracking. Required for `sortable`. */\n columnId?: string;\n /**\n * Whether this column can be sorted. The content is rendered inside a `<button>`; the header\n * cell carries `aria-sort`. Ignored (with a development warning) without `columnId`.\n * @default false\n */\n sortable?: boolean;\n /** Header cell content. */\n children: React.ReactNode;\n /** Ref to the `<th>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** Properties for the DataGridBody sub-component. */\nexport interface DataGridBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /** DataGrid row elements. */\n children: React.ReactNode;\n /** Ref to the `<tbody>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the DataGridRow sub-component. */\nexport interface DataGridRowProps extends React.HTMLAttributes<HTMLTableRowElement> {\n /**\n * Unique identifier for this row, used for selection (rows that share one are selected together;\n * a duplicate warns in development). A selectable grid renders no selection control (and warns\n * in development) for a row without it.\n */\n rowId?: string;\n /**\n * Accessible name of the row's selection control. Defaults to the row's first child that is a\n * `DataGrid.Cell`, `<td>` or `<th>` element (`aria-labelledby`); a cell that another component\n * renders is not seen, so pass `selectionLabel` when the row's first cell is one. Without such a\n * child the control is named \"Select row\" (with a development warning).\n */\n selectionLabel?: string;\n /** DataGrid cell elements. */\n children: React.ReactNode;\n /** Ref to the `<tr>` element. */\n ref?: React.Ref<HTMLTableRowElement>;\n}\n\n/** Properties for the DataGridCell sub-component. */\nexport interface DataGridCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Cell content. */\n children: React.ReactNode;\n /** Ref to the `<td>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n// ---------------------------------------------------------------------------\n// Selection store\n// ---------------------------------------------------------------------------\n\ntype SelectAllState = 'all' | 'some' | 'none';\n\n/**\n * Selection state shared with the rows through `useSyncExternalStore`, so toggling one row\n * re-renders only that row (and the select-all header cell). The root pushes the committed\n * selection in a layout effect; rows register their ids. The effective selection is always\n * `selected ∩ registered`, derived on read (no pruning effect).\n *\n * @internal Not exported from the package (exported for its unit tests).\n */\nexport interface SelectionStore {\n /**\n * Row subscription: notified only when the selection changes. Rows registering or unregistering\n * notify no row, so adding or removing k of n rows costs O(k), not O(k·n); the one exception is\n * single mode with several selected ids, where a row registering can move the selected row.\n */\n subscribe(listener: () => void): () => void;\n /**\n * Select-all subscription: notified only when {@link getSelectAllState} changes (through the\n * selection or through rows registering and unregistering).\n */\n subscribeSelectAll(listener: () => void): () => void;\n /** Registers a rendered row id; returns the unregister function. */\n register(rowId: string): () => void;\n /** How many rendered rows are registered with `rowId` (more than one: a duplicate). */\n countRegistrations(rowId: string): number;\n /** Sets the committed selection (layout effect of the root). */\n setSelected(items: readonly string[]): void;\n /**\n * Sets whether the grid is in single mode (layout effect of the root). Only then do rows\n * registering or unregistering re-check the one selected row of single mode and notify the rows.\n */\n setSingleMode(single: boolean): void;\n /**\n * Whether the row is selected. With `single`, only one row is: the first selected id (in\n * selection order) whose row is registered, else the first selected id (before any row\n * registered: the server render and the first client render).\n */\n isSelected(rowId: string, single?: boolean): boolean;\n /** Whether all, some or none of the registered rows are selected. O(1). */\n getSelectAllState(): SelectAllState;\n /** Registered row ids in registration order. */\n getRegistered(): string[];\n /** `items` restricted to registered rows (order of `items`). */\n prune(items: readonly string[]): string[];\n}\n\n/**\n * Creates the {@link SelectionStore} of one DataGrid.\n *\n * @internal Not exported from the package (exported for its unit tests).\n */\nexport function createSelectionStore(\n initial: readonly string[],\n initialSingleMode = false,\n): SelectionStore {\n let selected: ReadonlySet<string> = new Set(initial);\n /** Registered row id -> number of rows registered with it. */\n const registered = new Map<string, number>();\n /** How many registered row ids are selected (kept up to date, so select-all is O(1)). */\n let selectedRegistered = 0;\n let selectAll: SelectAllState = 'none';\n let singleMode = initialSingleMode;\n /** The one selected row of single mode (see `isSelected`); `undefined`: not computed yet. */\n let singleId: string | null | undefined;\n const rowListeners = new Set<() => void>();\n const selectAllListeners = new Set<() => void>();\n\n const notify = (listeners: Set<() => void>) => {\n for (const listener of Array.from(listeners)) listener();\n };\n\n /** Computed on read: O(selected ids) once per change, and only in single mode. */\n const getSingleId = (): string | null => {\n if (singleId !== undefined) return singleId;\n let first: string | null = null;\n for (const rowId of selected) {\n if (registered.has(rowId)) {\n first = rowId;\n break;\n }\n first ??= rowId;\n }\n singleId = first;\n return first;\n };\n\n /**\n * A row id registered or unregistered. With several selected ids, the one selected row of\n * single mode can move: in single mode it is re-checked and the rows are notified if it moved.\n */\n const onRegistrationChange = (rowId: string) => {\n if (selected.size < 2 || !selected.has(rowId)) return;\n const previous = singleId;\n singleId = undefined;\n if (singleMode && getSingleId() !== previous) notify(rowListeners);\n };\n\n const updateSelectAll = () => {\n const next: SelectAllState =\n selectedRegistered === 0 ? 'none' : selectedRegistered === registered.size ? 'all' : 'some';\n if (next === selectAll) return;\n selectAll = next;\n notify(selectAllListeners);\n };\n\n const subscribeTo = (listeners: Set<() => void>) => (listener: () => void) => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n };\n\n return {\n subscribe: subscribeTo(rowListeners),\n subscribeSelectAll: subscribeTo(selectAllListeners),\n register(rowId) {\n const count = registered.get(rowId) ?? 0;\n registered.set(rowId, count + 1);\n if (count === 0 && selected.has(rowId)) selectedRegistered += 1;\n updateSelectAll();\n if (count === 0) onRegistrationChange(rowId);\n let done = false;\n return () => {\n if (done) return;\n done = true;\n const remaining = (registered.get(rowId) ?? 0) - 1;\n if (remaining > 0) {\n registered.set(rowId, remaining);\n return;\n }\n registered.delete(rowId);\n if (selected.has(rowId)) selectedRegistered -= 1;\n updateSelectAll();\n onRegistrationChange(rowId);\n };\n },\n setSelected(items) {\n const next = new Set(items);\n if (next.size === selected.size && items.every((item) => selected.has(item))) return;\n selected = next;\n singleId = undefined;\n selectedRegistered = 0;\n for (const rowId of next) if (registered.has(rowId)) selectedRegistered += 1;\n notify(rowListeners);\n updateSelectAll();\n },\n setSingleMode(single) {\n singleMode = single;\n },\n isSelected(rowId, single = false) {\n return single ? getSingleId() === rowId : selected.has(rowId);\n },\n countRegistrations(rowId) {\n return registered.get(rowId) ?? 0;\n },\n getSelectAllState() {\n return selectAll;\n },\n getRegistered() {\n return Array.from(registered.keys());\n },\n prune(items) {\n return items.filter((item) => registered.has(item));\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// Header selection slots\n// ---------------------------------------------------------------------------\n\n/**\n * The selection column's header slots of one `DataGrid.Header`, one per header row. Only the first\n * slot in document order renders the \"Select all rows\" control (the \"Selection\" text in single\n * mode); the others render an empty cell, so a grouped header (several header rows) has one control\n * and every header row keeps the selection column.\n */\ninterface HeaderSlotRegistry {\n subscribe(listener: () => void): () => void;\n /** Registers a slot and a getter for its current cell; returns the unregister function. */\n register(slot: object, getCell: () => Element | null): () => void;\n /** The first slot in document order, or `null` while no slot is registered. */\n getFirst(): object | null;\n /** Re-checks the order: header rows can move without a slot mounting or unmounting. */\n refresh(): void;\n}\n\nfunction createHeaderSlotRegistry(): HeaderSlotRegistry {\n const slots = new Map<object, () => Element | null>();\n const listeners = new Set<() => void>();\n let first: object | null = null;\n\n const update = () => {\n let next: object | null = null;\n let nextCell: Element | null = null;\n for (const [slot, getCell] of slots) {\n const cell = getCell();\n if (!cell) {\n // A slot whose cell is being replaced (control <-> empty cell): keep the current order\n // until the next registration or header commit sees every cell again.\n if (first !== null && slots.has(first)) return;\n continue;\n }\n if (!nextCell || cell.compareDocumentPosition(nextCell) & Node.DOCUMENT_POSITION_FOLLOWING) {\n next = slot;\n nextCell = cell;\n }\n }\n if (next === null) next = slots.keys().next().value ?? null;\n if (next === first) return;\n first = next;\n for (const listener of Array.from(listeners)) listener();\n };\n\n return {\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n register(slot, getCell) {\n slots.set(slot, getCell);\n update();\n return () => {\n slots.delete(slot);\n update();\n };\n },\n getFirst: () => first,\n refresh: update,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Contexts\n// ---------------------------------------------------------------------------\n\ninterface DataGridContextValue {\n selectionMode: 'none' | SelectionMode;\n store: SelectionStore;\n /** Toggles one row (single mode: selects it alone, or clears it). */\n toggleRow: (rowId: string) => void;\n /** Selects every rendered row, or clears the selection when all are selected. */\n toggleAll: () => void;\n /** Shared `name` of the single-mode radios (they are kept out of any form with `form=\"\"`). */\n radioName: string;\n /** Name of the select-all checkbox (multiple mode). */\n selectAllLabel: string;\n /** Hidden header text of the selection column (single mode). */\n selectionHeaderLabel: string;\n}\n\ninterface DataGridSortContextValue {\n sort: DataGridSort | null;\n requestSort: (columnId: string) => void;\n}\n\ntype DataGridSection = 'header' | 'body';\n\nconst DataGridContext = React.createContext<DataGridContextValue | null>(null);\nconst DataGridSortContext = React.createContext<DataGridSortContextValue | null>(null);\n/** Whether a row is rendered in the header or the body (rows in a header get a header cell). */\nconst DataGridSectionContext = React.createContext<DataGridSection>('body');\n/** The header's selection slots (see {@link HeaderSlotRegistry}). */\nconst DataGridHeaderSlotsContext = React.createContext<HeaderSlotRegistry | null>(null);\n/**\n * Whether the header row below is the header's first row, as far as the header can tell from its\n * children. Only the initial (and server) render uses it; the slots then follow the DOM order.\n */\nconst DataGridHeaderRowHintContext = React.createContext(true);\n\nconst INERT_STORE = createSelectionStore([]);\nconst INERT_CONTEXT: DataGridContextValue = {\n selectionMode: 'none',\n store: INERT_STORE,\n toggleRow: () => {},\n toggleAll: () => {},\n radioName: '',\n selectAllLabel: DEFAULT_SELECT_ALL_LABEL,\n selectionHeaderLabel: DEFAULT_SELECTION_HEADER_LABEL,\n};\nconst INERT_SORT_CONTEXT: DataGridSortContextValue = { sort: null, requestSort: () => {} };\n\nfunction useDataGridContext(component: string): DataGridContextValue {\n const ctx = React.useContext(DataGridContext);\n if (ctx) return ctx;\n reportMissingContext(component, 'DataGrid');\n return INERT_CONTEXT;\n}\n\nfunction useDataGridSortContext(component: string): DataGridSortContextValue {\n const ctx = React.useContext(DataGridSortContext);\n if (ctx) return ctx;\n reportMissingContext(component, 'DataGrid');\n return INERT_SORT_CONTEXT;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst EMPTY_ITEMS: readonly string[] = [];\n\nfunction toItems(\n keys: ReadonlySet<string> | readonly string[] | undefined,\n): readonly string[] | undefined {\n return keys === undefined ? undefined : Array.from(keys);\n}\n\nfunction sameItems(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((item, index) => item === b[index]);\n}\n\n/** A child of {@link flattenChildren} under its flattened key (unique across the flattened list). */\nfunction renderFlatChild({ key, node }: { key: string; node: React.ReactNode }): React.ReactNode {\n return <React.Fragment key={key}>{node}</React.Fragment>;\n}\n\nfunction warnDuplicateRowId(rowId: string): void {\n warnOnce(\n `DataGrid:duplicate-rowId:${rowId}`,\n `DataGrid: several rows share the rowId \"${rowId}\". Row ids must be unique within a ` +\n 'DataGrid; rows with the same rowId are selected and deselected together.',\n );\n}\n\nconst cellBase = 'px-4 py-3 border-b border-border';\nconst selectionCell = 'w-10 px-3 py-3 border-b border-border';\nconst nativeControl = 'accent-primary cursor-pointer';\n\n// ---------------------------------------------------------------------------\n// DataGrid\n// ---------------------------------------------------------------------------\n\n// The component-level JSDoc sits on the exported `DataGrid` below.\nconst DataGridRoot = (props: DataGridProps) => {\n const {\n sort: sortProp,\n defaultSort,\n sortColumn: sortColumnProp,\n defaultSortColumn,\n sortDirection: sortDirectionProp,\n defaultSortDirection,\n onSortChange,\n selectionMode = 'none',\n selectedItems: selectedItemsProp,\n defaultSelectedItems,\n onSelectedItemsChange,\n selectedKeys,\n defaultSelectedKeys,\n onSelectionChange,\n labels,\n columns,\n containerProps,\n children,\n className,\n onKeyDown,\n onFocus,\n onBlur,\n ref,\n ...rest\n } = props;\n\n // --- sort -----------------------------------------------------------------\n /** 0.5 API: `onSortChange(sort)`. Sticky once `sort`/`defaultSort` was given. */\n const usesSortApi = sortProp !== undefined || defaultSort !== undefined;\n const [sortApiMode, setSortApiMode] = React.useState(usesSortApi);\n if (usesSortApi && !sortApiMode) setSortApiMode(true);\n const objectCallbacks = sortApiMode || usesSortApi;\n\n const legacySortControlled = sortColumnProp !== undefined || sortDirectionProp !== undefined;\n if (sortColumnProp !== undefined) warnDeprecated('DataGrid', 'sortColumn', 'sort');\n if (sortDirectionProp !== undefined) warnDeprecated('DataGrid', 'sortDirection', 'sort');\n if (defaultSortColumn !== undefined) {\n warnDeprecated('DataGrid', 'defaultSortColumn', 'defaultSort');\n }\n if (defaultSortDirection !== undefined) {\n warnDeprecated('DataGrid', 'defaultSortDirection', 'defaultSort');\n }\n const mixedSortApi =\n usesSortApi &&\n (legacySortControlled || defaultSortColumn !== undefined || defaultSortDirection !== undefined);\n\n React.useEffect(() => {\n if (mixedSortApi) {\n warnOnce(\n 'DataGrid:mixed-sort',\n 'DataGrid: do not mix `sort`/`defaultSort` with the deprecated `sortColumn`/`sortDirection`/' +\n '`defaultSortColumn`/`defaultSortDirection`. `sort`/`defaultSort` win.',\n );\n }\n }, [mixedSortApi]);\n // 0.4 mixed control: `sortColumn` and `sortDirection` are controlled independently. The half the\n // parent does not control is kept here (seeded from its default) and follows every sort request,\n // as 0.4 did, so repeated clicks still alternate and aria-sort shows what was reported.\n React.useEffect(() => {\n if (usesSortApi) return;\n if (sortColumnProp !== undefined && sortDirectionProp === undefined) {\n warnOnce(\n 'DataGrid:sortColumn-without-sortDirection',\n 'DataGrid: `sortColumn` is controlled but `sortDirection` is not (mixed control). The ' +\n 'direction is kept internally and toggles on repeated clicks, as in 0.4. Pass `sort` ' +\n '(`{ columnId, direction }`) to control both.',\n );\n } else if (sortDirectionProp !== undefined && sortColumnProp === undefined) {\n warnOnce(\n 'DataGrid:sortDirection-without-sortColumn',\n 'DataGrid: `sortDirection` is controlled but `sortColumn` is not (mixed control). The ' +\n 'column is kept internally and follows the clicked header, as in 0.4. Pass `sort` ' +\n '(`{ columnId, direction }`) to control both.',\n );\n }\n }, [usesSortApi, sortColumnProp, sortDirectionProp]);\n\n /** The uncontrolled halves of the 0.4 sort props (used while the other half is controlled). */\n const [legacyHalves, setLegacyHalves] = React.useState<{\n column: string;\n direction: SortDirection;\n }>(() => ({\n column: defaultSortColumn ?? '',\n direction: defaultSortDirection ?? 'ascending',\n }));\n\n const legacyControlledSort = React.useMemo<DataGridSort | null | undefined>(() => {\n if (sortColumnProp === undefined && sortDirectionProp === undefined) return undefined;\n const column = sortColumnProp ?? legacyHalves.column;\n return column === ''\n ? null\n : { columnId: column, direction: sortDirectionProp ?? legacyHalves.direction };\n }, [sortColumnProp, sortDirectionProp, legacyHalves]);\n\n const legacyDefaultSort = React.useMemo<DataGridSort | null>(\n () =>\n defaultSortColumn\n ? { columnId: defaultSortColumn, direction: defaultSortDirection ?? 'ascending' }\n : null,\n [defaultSortColumn, defaultSortDirection],\n );\n\n const controlledSort = usesSortApi ? sortProp : legacyControlledSort;\n const initialSort = defaultSort !== undefined ? defaultSort : legacyDefaultSort;\n\n const emitSortChange = (next: DataGridSort | null) => {\n if (!next) return;\n if (!usesSortApi) {\n setLegacyHalves((previous) =>\n previous.column === next.columnId && previous.direction === next.direction\n ? previous\n : { column: next.columnId, direction: next.direction },\n );\n }\n if (!onSortChange) return;\n if (objectCallbacks) {\n (onSortChange as (sort: DataGridSort) => void)(next);\n } else {\n const legacy = onSortChange as (columnId: string, direction: SortDirection) => void;\n legacy(next.columnId, next.direction);\n }\n };\n\n const [sort, setSort] = useControllable<DataGridSort | null>(\n controlledSort,\n initialSort,\n emitSortChange,\n );\n\n const requestSort = React.useCallback(\n (columnId: string) => {\n setSort((previous) => ({\n columnId,\n direction:\n previous?.columnId === columnId && previous.direction === 'ascending'\n ? 'descending'\n : 'ascending',\n }));\n },\n [setSort],\n );\n\n const sortContext = React.useMemo<DataGridSortContextValue>(\n () => ({ sort, requestSort }),\n [sort, requestSort],\n );\n\n // --- selection ------------------------------------------------------------\n if (onSelectionChange !== undefined) {\n warnDeprecated('DataGrid', 'onSelectionChange', 'onSelectedItemsChange');\n }\n const legacySelected = React.useMemo(() => toItems(selectedKeys), [selectedKeys]);\n const legacyDefaultSelected = React.useMemo(\n () => toItems(defaultSelectedKeys),\n [defaultSelectedKeys],\n );\n const controlledSelected = resolveDeprecatedProp(\n 'DataGrid',\n selectedItemsProp,\n legacySelected,\n 'selectedKeys',\n 'selectedItems',\n );\n const defaultSelected =\n resolveDeprecatedProp(\n 'DataGrid',\n defaultSelectedItems,\n legacyDefaultSelected,\n 'defaultSelectedKeys',\n 'defaultSelectedItems',\n ) ?? EMPTY_ITEMS;\n\n const emitSelectionChange = (next: readonly string[]) => {\n onSelectedItemsChange?.([...next]);\n onSelectionChange?.(new Set(next));\n };\n\n const [selected, setSelected] = useControllable<readonly string[]>(\n controlledSelected,\n defaultSelected,\n emitSelectionChange,\n );\n\n const single = selectionMode === 'single';\n const [store] = React.useState(() => createSelectionStore(selected, single));\n React.useLayoutEffect(() => {\n store.setSelected(selected);\n }, [store, selected]);\n React.useLayoutEffect(() => {\n store.setSingleMode(single);\n }, [store, single]);\n\n const toggleRow = React.useCallback(\n (rowId: string) => {\n setSelected((previous) => {\n const effective = store.prune(previous);\n let next: string[];\n if (single) {\n // Single mode shows the first selected row that is rendered (see the store).\n next = effective[0] === rowId ? [] : [rowId];\n } else {\n next = effective.includes(rowId)\n ? effective.filter((item) => item !== rowId)\n : [...effective, rowId];\n }\n return sameItems(next, previous) ? previous : next;\n });\n },\n [single, setSelected, store],\n );\n\n const selectedCount = selected.length;\n React.useEffect(() => {\n if (single && selectedCount > 1) {\n warnOnce(\n 'DataGrid:single-several-selected',\n `DataGrid: a single-selection grid (selectionMode \"single\") has ${selectedCount} selected row ids; only the first one that is rendered is selected. Pass at most one id in \\`selectedItems\\`/\\`defaultSelectedItems\\`, or use selectionMode=\"multiple\".`,\n );\n }\n }, [single, selectedCount]);\n\n const toggleAll = React.useCallback(() => {\n setSelected((previous) => {\n const effective = store.prune(previous);\n const all = store.getRegistered();\n const allSelected = all.length > 0 && all.every((rowId) => effective.includes(rowId));\n const next = allSelected ? [] : all;\n return sameItems(next, previous) ? previous : next;\n });\n }, [setSelected, store]);\n\n const radioName = useId('wave-datagrid-selection');\n const selectAllLabel = labels?.selectAll ?? DEFAULT_SELECT_ALL_LABEL;\n const selectionHeaderLabel = labels?.selectionHeader ?? DEFAULT_SELECTION_HEADER_LABEL;\n\n const context = React.useMemo<DataGridContextValue>(\n () => ({\n selectionMode,\n store,\n toggleRow,\n toggleAll,\n radioName,\n selectAllLabel,\n selectionHeaderLabel,\n }),\n [selectionMode, store, toggleRow, toggleAll, radioName, selectAllLabel, selectionHeaderLabel],\n );\n\n // --- keyboard -------------------------------------------------------------\n const { gridRef, gridProps } = useGridNavigation();\n const mergedRef = useMergedRefs<HTMLTableElement>(ref, gridRef);\n\n // --- header from columns ----------------------------------------------------\n let content: React.ReactNode = children;\n const flatChildren = columns ? flattenChildren(children) : [];\n if (columns && !flatChildren.some(({ node }) => isElementOfType(node, DataGridHeader))) {\n // A `<caption>` stays the table's first child, before the generated header.\n const isCaption = ({ node }: { node: React.ReactNode }) => isElementOfType(node, 'caption');\n content = (\n <>\n {flatChildren.filter(isCaption).map(renderFlatChild)}\n <DataGridHeader>\n <tr>\n {columns.map((column) => (\n <DataGridHeaderCell key={column.id} columnId={column.id} sortable={column.sortable}>\n {column.label}\n </DataGridHeaderCell>\n ))}\n </tr>\n </DataGridHeader>\n {flatChildren.filter((child) => !isCaption(child)).map(renderFlatChild)}\n </>\n );\n }\n\n const {\n className: containerClassName,\n 'aria-label': containerLabel,\n 'aria-labelledby': containerLabelledBy,\n ...containerRest\n } = containerProps ?? {};\n // The wrapper has no role of its own, and a name is prohibited on a role-less `<div>`: the\n // consumer's name is kept only together with a role.\n const containerHasRole = containerRest.role !== undefined;\n const droppedContainerName =\n !containerHasRole && (containerLabel !== undefined || containerLabelledBy !== undefined);\n\n React.useEffect(() => {\n if (droppedContainerName) {\n warnOnce(\n 'DataGrid:container-name-without-role',\n 'DataGrid: `containerProps[\"aria-label\"]`/`[\"aria-labelledby\"]` is ignored because the ' +\n 'wrapper has no role. Name the grid itself (`aria-label` on DataGrid), or pass a ' +\n '`role` (e.g. \"region\") in `containerProps` too.',\n );\n }\n }, [droppedContainerName]);\n\n return (\n <DataGridContext.Provider value={context}>\n <DataGridSortContext.Provider value={sortContext}>\n <div\n {...containerRest}\n aria-label={containerHasRole ? containerLabel : undefined}\n aria-labelledby={containerHasRole ? containerLabelledBy : undefined}\n className={cn(\n dataGridClassNames.container,\n 'overflow-x-auto rounded-md border border-border',\n containerClassName,\n )}\n >\n <table\n ref={mergedRef}\n role=\"grid\"\n aria-multiselectable={selectionMode === 'multiple' || undefined}\n className={cn(\n dataGridClassNames.root,\n 'w-full border-separate border-spacing-0',\n className,\n )}\n {...rest}\n onKeyDown={composeEventHandlers(onKeyDown, gridProps.onKeyDown)}\n onFocus={composeEventHandlers(onFocus, gridProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n onBlur={composeEventHandlers(onBlur, gridProps.onBlur, {\n checkDefaultPrevented: false,\n })}\n >\n {content}\n </table>\n </div>\n </DataGridSortContext.Provider>\n </DataGridContext.Provider>\n );\n};\nDataGridRoot.displayName = 'DataGrid';\n\n// ---------------------------------------------------------------------------\n// Selection header cell (internal)\n// ---------------------------------------------------------------------------\n\nfunction DataGridSelectionHeaderCell({\n selectionMode,\n ref,\n}: {\n selectionMode: SelectionMode;\n ref?: React.Ref<HTMLTableCellElement>;\n}) {\n const { store, toggleAll, selectAllLabel, selectionHeaderLabel } =\n useDataGridContext('DataGrid.Header');\n const state = React.useSyncExternalStore(\n store.subscribeSelectAll,\n store.getSelectAllState,\n store.getSelectAllState,\n );\n const inputRef = React.useRef<HTMLInputElement>(null);\n // A click clears the checkbox's `indeterminate` flag (checkbox activation does) and React restores\n // only `checked`, so the flag is re-applied after every click, also when the select-all state\n // stays the same (a controlled parent that keeps the selection partial, or ignores the change).\n const [clicks, setClicks] = React.useState(0);\n\n React.useLayoutEffect(() => {\n if (inputRef.current) inputRef.current.indeterminate = state === 'some';\n }, [state, clicks]);\n\n return (\n <th\n ref={ref}\n scope=\"col\"\n data-selection-cell=\"\"\n className={cn(\n dataGridHeaderClassNames.selectionCell,\n selectionCell,\n 'text-start',\n focusRingInset,\n )}\n >\n {selectionMode === 'multiple' ? (\n <input\n ref={inputRef}\n type=\"checkbox\"\n aria-label={selectAllLabel}\n checked={state === 'all'}\n onChange={() => {\n setClicks((count) => count + 1);\n toggleAll();\n }}\n className={cn(dataGridHeaderClassNames.selectAllCheckbox, nativeControl, focusRingInset)}\n />\n ) : (\n <span className=\"sr-only\">{selectionHeaderLabel}</span>\n )}\n </th>\n );\n}\n\nconst INERT_HEADER_SLOTS: HeaderSlotRegistry = {\n subscribe: () => () => {},\n register: () => () => {},\n getFirst: () => null,\n refresh: () => {},\n};\n\n/**\n * The selection column's cell of one header row: the select-all header cell in the header's first\n * row (document order), an empty cell in every later row. `initialFirst` is the header's guess from\n * its children, used until the slots are registered (the initial and the server render).\n */\nfunction DataGridSelectionHeaderSlot({\n selectionMode,\n initialFirst,\n}: {\n selectionMode: SelectionMode;\n initialFirst: boolean;\n}) {\n const slots = React.useContext(DataGridHeaderSlotsContext) ?? INERT_HEADER_SLOTS;\n const [slot] = React.useState(() => ({}));\n const cellRef = React.useRef<HTMLTableCellElement | null>(null);\n\n const getIsFirst = React.useCallback(() => {\n const first = slots.getFirst();\n return first === null ? initialFirst : first === slot;\n }, [slots, slot, initialFirst]);\n const getServerIsFirst = React.useCallback(() => initialFirst, [initialFirst]);\n const isFirst = React.useSyncExternalStore(slots.subscribe, getIsFirst, getServerIsFirst);\n\n React.useLayoutEffect(() => slots.register(slot, () => cellRef.current), [slots, slot]);\n\n return isFirst ? (\n <DataGridSelectionHeaderCell ref={cellRef} selectionMode={selectionMode} />\n ) : (\n <td\n ref={cellRef}\n data-selection-cell=\"\"\n className={cn(dataGridHeaderClassNames.selectionCell, selectionCell, focusRingInset)}\n />\n );\n}\n\n// ---------------------------------------------------------------------------\n// Sub-components\n// ---------------------------------------------------------------------------\n\n/**\n * Prepends the selection column's header slot (or `null`) to every `<tr>` in `children`, looking\n * inside Fragments, and tells every other element child (a `DataGrid.Row`, or a component that\n * renders one) whether it is the header's first row. Every row gets the same child shape in every\n * selection mode, so switching `selectionMode` does not remount the header cells.\n */\nfunction withSelectionHeaderSlots(\n children: React.ReactNode,\n selectionMode: 'none' | SelectionMode,\n): React.ReactNode {\n let first = true;\n const visit = (nodes: React.ReactNode): React.ReactNode =>\n React.Children.map(nodes, (child) => {\n if (isElementOfType<{ children?: React.ReactNode }>(child, React.Fragment)) {\n return React.cloneElement(child, undefined, visit(child.props.children));\n }\n if (!React.isValidElement(child)) return child;\n const isFirst = first;\n first = false;\n if (isElementOfType<{ children?: React.ReactNode }>(child, 'tr')) {\n const slot =\n selectionMode === 'none' ? null : (\n <DataGridSelectionHeaderSlot selectionMode={selectionMode} initialFirst={isFirst} />\n );\n return React.cloneElement(child, undefined, slot, child.props.children);\n }\n return (\n <DataGridHeaderRowHintContext.Provider value={isFirst}>\n {child}\n </DataGridHeaderRowHintContext.Provider>\n );\n });\n return visit(children);\n}\n\n/**\n * The grid's `<thead>`. When the grid is selectable, it prepends the selection column's header\n * cell to each `<tr>` child, also inside a Fragment: the first header row gets the \"Select all\n * rows\" checkbox (multiple mode) or the \"Selection\" header (single mode; DataGrid's `labels`\n * localizes both), later rows of a grouped header an empty cell. A header row rendered by another\n * component cannot get it (a development warning says so): use `DataGrid.Row` for such a row,\n * which adds the cell itself.\n */\nconst DataGridHeader = ({ children, className, ref, ...rest }: DataGridHeaderProps) => {\n const { selectionMode } = useDataGridContext('DataGrid.Header');\n const [thead, setThead] = React.useState<HTMLTableSectionElement | null>(null);\n const mergedRef = useMergedRefs<HTMLTableSectionElement>(ref, setThead);\n const [slots] = React.useState(createHeaderSlotRegistry);\n const content = withSelectionHeaderSlots(children, selectionMode);\n\n // Every commit, after the rows' slots registered: header rows can move without a slot mounting.\n React.useLayoutEffect(() => {\n slots.refresh();\n });\n\n // Every commit: header rows can come from components the header cannot see into.\n React.useEffect(() => {\n if (!isDev || !thead || selectionMode === 'none') return;\n const missing = Array.from(thead.rows).some(\n (row) => row.cells.length > 0 && !row.cells[0].hasAttribute('data-selection-cell'),\n );\n if (missing) {\n warnOnce(\n 'DataGrid.Header:missing-selection-cell',\n 'DataGrid.Header: a header row has no selection column header cell, so the header has one ' +\n 'column fewer than the selectable rows. Render header rows as `<tr>` children of ' +\n 'DataGrid.Header (a Fragment is fine), or use `DataGrid.Row` for a header row that ' +\n 'another component renders.',\n );\n }\n });\n\n return (\n <DataGridSectionContext.Provider value=\"header\">\n <DataGridHeaderSlotsContext.Provider value={slots}>\n <thead\n ref={mergedRef}\n className={cn(dataGridHeaderClassNames.root, 'bg-card', className)}\n {...rest}\n >\n {content}\n </thead>\n </DataGridHeaderSlotsContext.Provider>\n </DataGridSectionContext.Provider>\n );\n};\nDataGridHeader.displayName = 'DataGridHeader';\n\nconst sortIcon = (direction: SortDirection) => (\n <svg\n className={cn(dataGridHeaderCellClassNames.sortIcon, 'h-3 w-3 shrink-0')}\n viewBox=\"0 0 12 12\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n {direction === 'ascending' ? <path d=\"M6 2L10 8H2L6 2Z\" /> : <path d=\"M6 10L2 4H10L6 10Z\" />}\n </svg>\n);\n\n/**\n * A column header cell. A `sortable` header (with a `columnId`) renders its content inside a\n * `<button type=\"button\">` that toggles the sort; the `<th>` carries `aria-sort`. A consumer\n * `onClick` (on the `<th>`) runs before the sort, and calling `preventDefault()` in it cancels the\n * sort (also for Enter/Space on the button, which click it).\n */\nconst DataGridHeaderCell = ({\n columnId,\n sortable = false,\n children,\n className,\n onClick,\n ref,\n ...rest\n}: DataGridHeaderCellProps) => {\n const { sort, requestSort } = useDataGridSortContext('DataGrid.HeaderCell');\n /** The column this header sorts, or `undefined` when it is not sortable. */\n const sortColumnId = sortable && columnId ? columnId : undefined;\n const sortedDirection =\n sortColumnId !== undefined && sort?.columnId === sortColumnId ? sort.direction : null;\n\n // The sort runs from the `<th>` once the button's click bubbled up to it, composed after the\n // consumer's `onClick` (C-COMPOSE): the consumer runs first and can cancel with preventDefault().\n // The sort button is the `<th>`'s only child; clicks elsewhere in the cell do not sort.\n const sortOnButtonClick = (event: React.MouseEvent<HTMLTableCellElement>) => {\n const button = event.currentTarget.firstElementChild;\n if (\n sortColumnId !== undefined &&\n button?.localName === 'button' &&\n button.contains(event.target as Node)\n ) {\n requestSort(sortColumnId);\n }\n };\n\n React.useEffect(() => {\n if (sortable && !columnId) {\n warnOnce(\n 'DataGrid.HeaderCell:sortable-without-columnId',\n 'DataGrid.HeaderCell: `sortable` needs a `columnId`; the header is rendered as not sortable.',\n );\n }\n }, [sortable, columnId]);\n\n return (\n <th\n ref={ref}\n scope=\"col\"\n aria-sort={sortColumnId !== undefined ? (sortedDirection ?? 'none') : undefined}\n className={cn(\n dataGridHeaderCellClassNames.root,\n cellBase,\n 'text-start align-middle font-semibold text-caption-1 uppercase tracking-wider',\n focusRingInset,\n sortColumnId !== undefined && 'p-0 hover:bg-subtle-hover',\n className,\n )}\n {...rest}\n onClick={\n sortColumnId !== undefined ? composeEventHandlers(onClick, sortOnButtonClick) : onClick\n }\n >\n {sortColumnId !== undefined ? (\n <button\n type=\"button\"\n className={cn(\n dataGridHeaderCellClassNames.button,\n 'inline-flex w-full cursor-pointer select-none items-center gap-1 border-0 bg-transparent px-4 py-3 text-start text-inherit [font:inherit] uppercase tracking-wider',\n focusRingInset,\n )}\n >\n {children}\n {sortedDirection && sortIcon(sortedDirection)}\n </button>\n ) : (\n <span className=\"inline-flex items-center gap-1\">{children}</span>\n )}\n </th>\n );\n};\nDataGridHeaderCell.displayName = 'DataGridHeaderCell';\n\n/** The grid's `<tbody>`. */\nconst DataGridBody = ({ children, className, ref, ...rest }: DataGridBodyProps) => (\n <DataGridSectionContext.Provider value=\"body\">\n <tbody ref={ref} className={cn(dataGridBodyClassNames.root, className)} {...rest}>\n {children}\n </tbody>\n </DataGridSectionContext.Provider>\n);\nDataGridBody.displayName = 'DataGridBody';\n\n/**\n * A grid row. In a selectable grid it starts with a selection cell (checkbox or radio) named\n * after the row's first cell (or `selectionLabel`); Space on one of its cells toggles the row.\n */\nconst DataGridRow = ({\n rowId,\n selectionLabel,\n children,\n className,\n onKeyDown,\n ref,\n ...rest\n}: DataGridRowProps) => {\n const { selectionMode, store, toggleRow, radioName } = useDataGridContext('DataGrid.Row');\n const section = React.useContext(DataGridSectionContext);\n const firstHeaderRowHint = React.useContext(DataGridHeaderRowHintContext);\n const inHeader = section === 'header';\n const selectable = selectionMode !== 'none' && !inHeader;\n const labelId = useId('wave-datagrid-row-label');\n\n const single = selectionMode === 'single';\n const getSelected = React.useCallback(\n () => rowId !== undefined && store.isSelected(rowId, single),\n [rowId, store, single],\n );\n // Notified only when the selection changes (in multiple mode, rows registering notify no row).\n const isSelected = React.useSyncExternalStore(store.subscribe, getSelected, getSelected);\n\n React.useLayoutEffect(() => {\n if (rowId === undefined || inHeader) return;\n const unregister = store.register(rowId);\n if (isDev && store.countRegistrations(rowId) > 1) warnDuplicateRowId(rowId);\n return unregister;\n }, [store, rowId, inHeader]);\n\n React.useEffect(() => {\n if (selectable && rowId === undefined) {\n warnOnce(\n 'DataGrid.Row:missing-rowId',\n 'DataGrid.Row: a selectable grid needs a `rowId` on every row; this row has no selection control.',\n );\n }\n }, [selectable, rowId]);\n\n const unlabelled = selectable && rowId !== undefined && selectionLabel === undefined;\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (!selectable || rowId === undefined || event.key !== ' ') return;\n const target = event.target as Element;\n // Only keys pressed on the row itself or on one of its own cells, never on a nested widget.\n if (target !== event.currentTarget && target.parentElement !== event.currentTarget) return;\n event.preventDefault();\n toggleRow(rowId);\n };\n\n // Name the selection control after the first cell (its own id, or a generated one). The children\n // are always flattened (Fragments too) and rendered under their flattened keys, whatever the\n // mode, so the keys stay the same when `selectionMode`, `selectionLabel` or `rowId` change and\n // the cells are not remounted.\n const flatChildren = flattenChildren(children);\n let labelledBy: string | undefined;\n let idCellIndex = -1;\n if (unlabelled) {\n const firstCellIndex = flatChildren.findIndex(({ node }) =>\n isElementOfType(node, DataGridCell, 'td', 'th'),\n );\n if (firstCellIndex >= 0) {\n const firstCell = flatChildren[firstCellIndex].node as React.ReactElement<{ id?: string }>;\n labelledBy = firstCell.props.id ?? labelId;\n if (firstCell.props.id === undefined) idCellIndex = firstCellIndex;\n }\n }\n const content = flatChildren.map(({ key, node }, index) =>\n renderFlatChild({\n key,\n node:\n index === idCellIndex\n ? React.cloneElement(node as React.ReactElement<{ id?: string }>, { id: labelId })\n : node,\n }),\n );\n\n const needsLabel = unlabelled && labelledBy === undefined;\n React.useEffect(() => {\n if (needsLabel) {\n warnOnce(\n 'DataGrid.Row:selection-label',\n 'DataGrid.Row: no child is a `DataGrid.Cell`, `<td>` or `<th>` element, so the row selection control is named \"Select row\". Pass `selectionLabel` (a cell rendered by another component is not seen).',\n );\n }\n }, [needsLabel]);\n\n let selectionCellElement: React.ReactNode = null;\n if (inHeader && selectionMode !== 'none') {\n selectionCellElement = (\n <DataGridSelectionHeaderSlot\n selectionMode={selectionMode}\n initialFirst={firstHeaderRowHint}\n />\n );\n } else if (selectable) {\n selectionCellElement = (\n <td\n role=\"gridcell\"\n data-selection-cell=\"\"\n className={cn(dataGridRowClassNames.selectionCell, selectionCell, focusRingInset)}\n >\n {rowId !== undefined && (\n <input\n type={selectionMode === 'multiple' ? 'checkbox' : 'radio'}\n name={selectionMode === 'single' ? radioName : undefined}\n // The shared name groups the radios. `form=\"\"` matches no form, so they have no form\n // owner (still one group: same name, both ownerless) and never add a generated field\n // to an enclosing form's submission.\n form={selectionMode === 'single' ? '' : undefined}\n checked={isSelected}\n onChange={() => toggleRow(rowId)}\n aria-label={selectionLabel ?? (labelledBy ? undefined : 'Select row')}\n aria-labelledby={selectionLabel === undefined ? labelledBy : undefined}\n className={cn(dataGridRowClassNames.selectionControl, nativeControl, focusRingInset)}\n />\n )}\n </td>\n );\n }\n\n return (\n <tr\n ref={ref}\n className={cn(\n dataGridRowClassNames.root,\n !inHeader &&\n 'hover:bg-subtle-hover data-[selected]:bg-selected transition-colors motion-reduce:transition-none',\n selectable && isSelected && forcedColors.selectedContainer,\n className,\n )}\n aria-selected={selectable ? isSelected : undefined}\n data-selected={selectable && isSelected ? '' : undefined}\n {...rest}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n >\n {selectionCellElement}\n {content}\n </tr>\n );\n};\nDataGridRow.displayName = 'DataGridRow';\n\n/** A grid cell (`<td>`), focusable through the grid's keyboard navigation. */\nconst DataGridCell = ({ children, className, ref, ...rest }: DataGridCellProps) => (\n <td\n ref={ref}\n role=\"gridcell\"\n className={cn(dataGridCellClassNames.root, cellBase, 'text-body-1', focusRingInset, className)}\n {...rest}\n >\n {children}\n </td>\n);\nDataGridCell.displayName = 'DataGridCell';\n\nexport { DataGridHeader, DataGridHeaderCell, DataGridBody, DataGridRow, DataGridCell };\n\n/**\n * An interactive data table (`role=\"grid\"`) following the APG Grid pattern: one tab stop,\n * arrow-key navigation between cells (Home/End, Ctrl+Home/Ctrl+End, PageUp/PageDown; Up/Down keep\n * the visual column, so a grouped header with spanning cells works), Enter/F2 to interact with a\n * cell's widgets and Escape to return to the cell. A composite widget in a cell (a Toolbar,\n * RadioGroup, TabList, …) is entered with Enter/F2 like a text field; it manages its own tab\n * indexes, so it keeps its own Tab stop. Supports sortable columns (controlled sorting:\n * `onSortChange` reports the new sort and the consumer reorders the rows) and single or multiple\n * row selection with a select-all header checkbox.\n *\n * Sub-components are available as `DataGrid.Header`, `DataGrid.HeaderCell`, `DataGrid.Body`,\n * `DataGrid.Row` and `DataGrid.Cell` in client components, and as the flat exports\n * `DataGridHeader`, `DataGridHeaderCell`, `DataGridBody`, `DataGridRow` and `DataGridCell` (the\n * form React Server Components can import).\n */\nexport const DataGrid = /* @__PURE__ */ Object.assign(DataGridRoot, {\n Header: DataGridHeader,\n HeaderCell: DataGridHeaderCell,\n Body: DataGridBody,\n Row: DataGridRow,\n Cell: DataGridCell,\n});\n"],"mappings":";;;;;;;;;;;;;;AA4DA,IAAMI,IAA2B,mBAC3BC,IAAiC;AA+PvC,SAAgBC,EACd,GACA,IAAoB,IACJ;CAChB,IAAIC,IAAgC,IAAI,IAAIC,CAAO,GAE7CC,oBAAa,IAAI,IAAoB,GAEvCC,IAAqB,GACrBC,IAA4B,QAC5BC,IAAaC,GAEbC,GACEC,oBAAe,IAAI,IAAgB,GACnCC,oBAAqB,IAAI,IAAgB,GAEzCC,KAAU,MAA+B;EAC7C,KAAK,IAAMC,KAAY,MAAM,KAAKC,CAAS,GAAG,EAAS;CACzD,GAGMC,UAAmC;EACvC,IAAIN,MAAa,KAAA,GAAW,OAAOA;EACnC,IAAIO,IAAuB;EAC3B,KAAK,IAAMC,KAASf,GAAU;GAC5B,IAAIE,EAAW,IAAIa,CAAK,GAAG;IACzB,IAAQA;IACR;GACF;GACA,MAAUA;EACZ;EAEA,OADA,IAAWD,GACJA;CACT,GAMME,KAAwB,MAAkB;EAC9C,IAAIhB,EAAS,OAAO,KAAK,CAACA,EAAS,IAAIe,CAAK,GAAG;EAC/C,IAAME,IAAWV;EAEjB,AADA,IAAW,KAAA,GACPF,KAAcQ,EAAY,MAAMI,KAAUP,EAAOF,CAAY;CACnE,GAEMU,UAAwB;EAC5B,IAAMC,IACJhB,MAAuB,IAAI,SAASA,MAAuBD,EAAW,OAAO,QAAQ;EACvF,AAAIiB,MAASf,MACb,IAAYe,GACZT,EAAOD,CAAkB;CAC3B,GAEMW,KAAe,OAAgC,OACnDR,EAAU,IAAID,CAAQ,SACT;EACX,EAAU,OAAOA,CAAQ;CAC3B;CAGF,OAAO;EACL,WAAWS,EAAYZ,CAAY;EACnC,oBAAoBY,EAA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ACJ,WAAW0E,EAAqBC,GAAWgD,CAAa;EAZ1D,UAAA,CAcGQ,GACA9E,CACC;;AAER;AACA,EAAY,cAAc;AAG1B,IAAM2E,KAAgB,EAAE,aAAU,cAAW,QAAK,GAAGhI,QACnD,kBAAC,MAAD;CACO;CACL,MAAK;CACL,WAAWuE,EAAG+D,EAAuB,MAAM9I,GAAU,eAAe6F,GAAgBZ,CAAS;CAC7F,GAAIzE;CAEH;AACC,CAAA;AAEN,EAAa,cAAc;AAmB3B,IAAauI,KAA2B,uBAAO,OAAO5I,GAAc;CAClE,QAAQgE;CACR,YAAYG;CACZ,MAAMgD;CACN,KAAKE;CACL,MAAMgB;AACR,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../hooks/useId.cjs"),
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/classNames.cjs"),a=require("../../hooks/useId.cjs"),o=require("../../hooks/useMergedRefs.cjs");require("../../lib/styles.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l=()=>()=>{};function u(e){let t=s.useCallback(t=>{if(!e||typeof ResizeObserver>`u`)return()=>{};let n=new ResizeObserver(t);n.observe(e);for(let t of Array.from(e.children))n.observe(t);return()=>n.disconnect()},[e]),n=s.useCallback(()=>e?e.scrollWidth>e.clientWidth:!1,[e]);return s.useSyncExternalStore(e?t:l,n,()=>!1)}function d(e){return n.isElementOfType(e,`caption`)}var f=({striped:e=!1,containerProps:l,children:f,className:p,ref:m,...h})=>{let{className:g,ref:_,"aria-label":v,"aria-labelledby":y,...b}=l??{},[x,S]=s.useState(null),C=o.useMergedRefs(_,S),w=u(x),T=a.useId(`wave-table-caption`),E=n.flattenChildren(f),D=E.findIndex(({node:e})=>d(e)),O=D>=0?E[D].node:null,k=O?O.props.id??T:void 0,A=O&&O.props.id===void 0?E.map(({key:e,node:t},n)=>(0,c.jsx)(s.Fragment,{children:n===D?s.cloneElement(O,{id:T}):t},e)):f,j=v?void 0:y??k,M=!!(v||j),N=w&&M,P=b.role;return s.useEffect(()=>{w&&!M&&r.warnOnce(`Table:unnamed-scroll-region`,`Table: the table scrolls horizontally but its scroll region has no name. Add a <caption> or containerProps["aria-label"].`)},[w,M]),(0,c.jsx)(`div`,{...b,ref:C,role:N?`region`:P,tabIndex:w?0:b.tabIndex,"aria-label":w||P!==void 0?v:void 0,"aria-labelledby":N?j:P===void 0?void 0:y,className:t.cn(i.tableClassNames.container,`overflow-x-auto rounded-md border border-border`,w&&`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,g),children:(0,c.jsx)(`table`,{ref:m,"data-striped":e?``:void 0,className:t.cn(i.tableClassNames.root,`w-full border-separate border-spacing-0`,e&&`[:where(&>tbody>tr:nth-child(odd))]:bg-card`,p),...h,children:A})})};f.displayName=`Table`;var p=({children:e,className:n,ref:r,...a})=>(0,c.jsx)(`thead`,{ref:r,...a,className:t.cn(i.tableHeaderClassNames.root,`bg-card`,n),children:e});p.displayName=`TableHeader`;var m=({children:e,className:n,ref:r,...a})=>(0,c.jsx)(`th`,{ref:r,scope:`col`,className:t.cn(i.tableHeaderCellClassNames.root,`px-4 py-3 text-start font-semibold text-caption-1 uppercase tracking-wider border-b border-border`,n),...a,children:e});m.displayName=`TableHeaderCell`;var h=e=>(r.warnDeprecated(`Table`,`Table.Head`,`Table.Header`),(0,c.jsx)(p,{...e}));h.displayName=`TableHead`;var g=e=>(r.warnDeprecated(`Table`,`Table.HeadCell`,`Table.HeaderCell`),(0,c.jsx)(m,{...e}));g.displayName=`TableHeadCell`;var _=({children:e,className:n,ref:r,...a})=>(0,c.jsx)(`tbody`,{ref:r,...a,className:t.cn(i.tableBodyClassNames.root,n),children:e});_.displayName=`TableBody`;var v=({children:e,className:n,ref:r,...a})=>(0,c.jsx)(`tr`,{ref:r,className:t.cn(i.tableRowClassNames.root,`hover:bg-subtle-hover transition-colors motion-reduce:transition-none`,n),...a,children:e});v.displayName=`TableRow`;var y=({children:e,className:n,ref:r,...a})=>(0,c.jsx)(`td`,{ref:r,className:t.cn(i.tableCellClassNames.root,`px-4 py-3 text-body-1 border-b border-border`,n),...a,children:e});y.displayName=`TableCell`;var b=Object.assign(f,{Header:p,HeaderCell:m,Head:h,HeadCell:g,Body:_,Row:v,Cell:y});exports.Table=b,exports.TableBody=_,exports.TableCell=y,exports.TableHead=h,exports.TableHeadCell=g,exports.TableHeader=p,exports.TableHeaderCell=m,exports.TableRow=v;
|
|
2
2
|
//# sourceMappingURL=Table.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.cjs","names":["React","isElementOfType","useMergedRefs","useId","flattenChildren","cn","require_runtime","require_cn","require_children","require_dev","require_useId","require_useMergedRefs","react","react_jsx_runtime","noopSubscribe","useHorizontalOverflow","subscribe","wrapper","observer","onChange","child","getSnapshot","isCaption","node","TableRoot","props","containerClassName","containerRef","containerLabel","containerLabelledBy","containerRest","containerProps","setWrapper","wrapperRef","scrollable","generatedCaptionId","flatChildren","children","captionIndex","caption","captionId","content","index","key","regionLabelledBy","named","isRegion","consumerRole","striped","className","TableHeader","rest","TableHeaderCell","TableHead","TableHeadCell","TableBody","TableRow","TableCell","Table"],"sources":["../../../src/components/table/Table.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { warnDeprecated, warnOnce } from '../../lib/dev';\nimport { focusRing } from '../../lib/styles';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\n\n/** Properties for the Table component. */\nexport interface TableProps extends React.HTMLAttributes<HTMLTableElement> {\n /**\n * Whether to apply alternating row background colors (odd body rows). The stripe has zero\n * specificity, so a row's own background class (`<Table.Row className=\"bg-selected\">`) and its\n * hover color win over it.\n * @default false\n */\n striped?: boolean;\n /**\n * Props for the wrapper `<div>` around the `<table>`: a horizontally scrollable container\n * (`overflow-x-auto`). Use it for its className, style, ref or `aria-label`. While the table\n * scrolls horizontally, the wrapper is a keyboard-focusable `role=\"region\"` named by\n * `containerProps['aria-label']`/`['aria-labelledby']`, else by the table's `<caption>`. While\n * it does not scroll, the wrapper has no role and its `aria-label`/`aria-labelledby` are left\n * off, unless you also pass a `role` in `containerProps` (then they are always applied).\n */\n containerProps?: Omit<React.ComponentPropsWithRef<'div'>, 'children'>;\n /** Table caption, header, body and row elements. */\n children: React.ReactNode;\n /** Ref to the `<table>` element. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\n/** Properties for the TableHeader sub-component. */\nexport interface TableHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /** Table header row elements. */\n children: React.ReactNode;\n /** Ref to the `<thead>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the TableHeaderCell sub-component. */\nexport interface TableHeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /** Header cell content. */\n children: React.ReactNode;\n /** Ref to the `<th>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** @deprecated Use `TableHeaderProps` (`Table.Header`). */\nexport type TableHeadProps = TableHeaderProps;\n\n/** @deprecated Use `TableHeaderCellProps` (`Table.HeaderCell`). */\nexport type TableHeadCellProps = TableHeaderCellProps;\n\n/** Properties for the TableBody sub-component. */\nexport interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /** Table row elements. */\n children: React.ReactNode;\n /** Ref to the `<tbody>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the TableRow sub-component. */\nexport interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {\n /** Table cell elements. */\n children: React.ReactNode;\n /** Ref to the `<tr>` element. */\n ref?: React.Ref<HTMLTableRowElement>;\n}\n\n/** Properties for the TableCell sub-component. */\nexport interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Cell content. */\n children: React.ReactNode;\n /** Ref to the `<td>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\nconst noopSubscribe = () => () => {};\n\n/**\n * Whether `wrapper` scrolls horizontally, as an external store: a `ResizeObserver` on the wrapper\n * and the table re-checks `scrollWidth > clientWidth`. Without `ResizeObserver` (server, old\n * browsers, jsdom) the value is read on each render.\n */\nfunction useHorizontalOverflow(wrapper: HTMLDivElement | null): boolean {\n const subscribe = React.useCallback(\n (onChange: () => void) => {\n if (!wrapper || typeof ResizeObserver === 'undefined') return () => {};\n const observer = new ResizeObserver(onChange);\n observer.observe(wrapper);\n for (const child of Array.from(wrapper.children)) observer.observe(child);\n return () => observer.disconnect();\n },\n [wrapper],\n );\n const getSnapshot = React.useCallback(\n () => (wrapper ? wrapper.scrollWidth > wrapper.clientWidth : false),\n [wrapper],\n );\n return React.useSyncExternalStore(wrapper ? subscribe : noopSubscribe, getSnapshot, () => false);\n}\n\nfunction isCaption(node: React.ReactNode): node is React.ReactElement<{ id?: string }> {\n return isElementOfType(node, 'caption');\n}\n\n// The component-level JSDoc sits on the exported `Table` below.\nconst TableRoot = ({\n striped = false,\n containerProps,\n children,\n className,\n ref,\n ...props\n}: TableProps) => {\n const {\n className: containerClassName,\n ref: containerRef,\n 'aria-label': containerLabel,\n 'aria-labelledby': containerLabelledBy,\n ...containerRest\n } = containerProps ?? {};\n\n const [wrapper, setWrapper] = React.useState<HTMLDivElement | null>(null);\n const wrapperRef = useMergedRefs<HTMLDivElement>(containerRef, setWrapper);\n const scrollable = useHorizontalOverflow(wrapper);\n\n // Name the scroll region after the caption (also one inside a Fragment): keep its id, or give it\n // one. The flattened children are then rendered under their flattened keys.\n const generatedCaptionId = useId('wave-table-caption');\n const flatChildren = flattenChildren(children);\n const captionIndex = flatChildren.findIndex(({ node }) => isCaption(node));\n const caption =\n captionIndex >= 0\n ? (flatChildren[captionIndex].node as React.ReactElement<{ id?: string }>)\n : null;\n const captionId = caption ? (caption.props.id ?? generatedCaptionId) : undefined;\n const content =\n caption && caption.props.id === undefined\n ? flatChildren.map(({ key, node }, index) => (\n <React.Fragment key={key}>\n {index === captionIndex\n ? React.cloneElement(caption, { id: generatedCaptionId })\n : node}\n </React.Fragment>\n ))\n : children;\n\n const regionLabelledBy = containerLabel ? undefined : (containerLabelledBy ?? captionId);\n const named = Boolean(containerLabel || regionLabelledBy);\n const isRegion = scrollable && named;\n /** A role the consumer gave the wrapper: their name goes with it even while nothing scrolls. */\n const consumerRole = containerRest.role;\n\n React.useEffect(() => {\n if (scrollable && !named) {\n warnOnce(\n 'Table:unnamed-scroll-region',\n 'Table: the table scrolls horizontally but its scroll region has no name. Add a <caption> or containerProps[\"aria-label\"].',\n );\n }\n }, [scrollable, named]);\n\n return (\n <div\n {...containerRest}\n ref={wrapperRef}\n role={isRegion ? 'region' : consumerRole}\n tabIndex={scrollable ? 0 : containerRest.tabIndex}\n aria-label={scrollable || consumerRole !== undefined ? containerLabel : undefined}\n aria-labelledby={\n isRegion ? regionLabelledBy : consumerRole !== undefined ? containerLabelledBy : undefined\n }\n className={cn(\n 'overflow-x-auto rounded-md border border-border',\n scrollable && focusRing,\n containerClassName,\n )}\n >\n <table\n ref={ref}\n data-striped={striped ? '' : undefined}\n className={cn(\n 'w-full border-separate border-spacing-0',\n // `:where()` keeps the stripe at specificity 0, so any row class wins (C-CLASS).\n striped && '[:where(&>tbody>tr:nth-child(odd))]:bg-card',\n className,\n )}\n {...props}\n >\n {content}\n </table>\n </div>\n );\n};\nTableRoot.displayName = 'Table';\n\n/** The table's `<thead>`. */\nconst TableHeader = ({ children, className, ref, ...rest }: TableHeaderProps) => (\n <thead ref={ref} {...rest} className={cn('bg-card', className)}>\n {children}\n </thead>\n);\nTableHeader.displayName = 'TableHeader';\n\n/** A column header cell (`<th scope=\"col\">`). */\nconst TableHeaderCell = ({ children, className, ref, ...props }: TableHeaderCellProps) => (\n <th\n ref={ref}\n scope=\"col\"\n className={cn(\n 'px-4 py-3 text-start font-semibold text-caption-1 uppercase tracking-wider border-b border-border',\n className,\n )}\n {...props}\n >\n {children}\n </th>\n);\nTableHeaderCell.displayName = 'TableHeaderCell';\n\n/** @deprecated Use `Table.Header` (`TableHeader`). */\nconst TableHead = (props: TableHeadProps) => {\n warnDeprecated('Table', 'Table.Head', 'Table.Header');\n return <TableHeader {...props} />;\n};\nTableHead.displayName = 'TableHead';\n\n/** @deprecated Use `Table.HeaderCell` (`TableHeaderCell`). */\nconst TableHeadCell = (props: TableHeadCellProps) => {\n warnDeprecated('Table', 'Table.HeadCell', 'Table.HeaderCell');\n return <TableHeaderCell {...props} />;\n};\nTableHeadCell.displayName = 'TableHeadCell';\n\n/** The table's `<tbody>`. */\nconst TableBody = ({ children, className, ref, ...rest }: TableBodyProps) => (\n <tbody ref={ref} {...rest} className={className}>\n {children}\n </tbody>\n);\nTableBody.displayName = 'TableBody';\n\n/** A table row. Striping comes from the table (`striped`), so rows need no context. */\nconst TableRow = ({ children, className, ref, ...props }: TableRowProps) => (\n <tr\n ref={ref}\n className={cn(\n 'hover:bg-subtle-hover transition-colors motion-reduce:transition-none',\n className,\n )}\n {...props}\n >\n {children}\n </tr>\n);\nTableRow.displayName = 'TableRow';\n\n/** A data cell (`<td>`). */\nconst TableCell = ({ children, className, ref, ...props }: TableCellProps) => (\n <td\n ref={ref}\n className={cn('px-4 py-3 text-body-1 border-b border-border', className)}\n {...props}\n >\n {children}\n </td>\n);\nTableCell.displayName = 'TableCell';\n\nexport { TableHeader, TableHeaderCell, TableHead, TableHeadCell, TableBody, TableRow, TableCell };\n\n/**\n * A non-interactive data table with an optional striped body. The table sits in a horizontally\n * scrollable wrapper; while it scrolls, the wrapper is a focusable region (named by\n * `containerProps` or the `<caption>`) so keyboard users can scroll it.\n *\n * Sub-components are available as `Table.Header`, `Table.HeaderCell`, `Table.Body`, `Table.Row`\n * and `Table.Cell` in client components, and as the flat exports `TableHeader`,\n * `TableHeaderCell`, `TableBody`, `TableRow` and `TableCell` (the form React Server Components\n * can import). `Table.Head`/`Table.HeadCell` (`TableHead`/`TableHeadCell`) are deprecated aliases.\n */\nexport const Table = /* @__PURE__ */ Object.assign(TableRoot, {\n Header: TableHeader,\n HeaderCell: TableHeaderCell,\n /** @deprecated Use `Table.Header`. */\n Head: TableHead,\n /** @deprecated Use `Table.HeaderCell`. */\n HeadCell: TableHeadCell,\n Body: TableBody,\n Row: TableRow,\n Cell: TableCell,\n});\n"],"mappings":"+VA8EA,IAAMc,UAA4B,CAAC,EAOnC,SAASC,EAAsB,EAAyC,CACtE,IAAMC,EAAYhB,EAAM,YACrB,GAAyB,CACxB,GAAI,CAACiB,GAAW,OAAO,eAAmB,IAAa,UAAa,CAAC,EACrE,IAAMC,EAAW,IAAI,eAAeC,CAAQ,EAC5CD,EAAS,QAAQD,CAAO,EACxB,IAAK,IAAMG,KAAS,MAAM,KAAKH,EAAQ,QAAQ,EAAGC,EAAS,QAAQE,CAAK,EACxE,UAAaF,EAAS,WAAW,CACnC,EACA,CAACD,CAAO,CACV,EACMI,EAAcrB,EAAM,gBACjBiB,EAAUA,EAAQ,YAAcA,EAAQ,YAAc,GAC7D,CAACA,CAAO,CACV,EACA,OAAOjB,EAAM,qBAAqBiB,EAAUD,EAAYF,EAAeO,MAAmB,EAAK,CACjG,CAEA,SAASC,EAAU,EAAoE,CACrF,OAAOrB,EAAAA,gBAAgBsB,EAAM,SAAS,CACxC,CAGA,IAAMC,GAAa,CACjB,UAAU,GACV,iBACA,WACA,YACA,MACA,GAAGC,KACa,CAChB,GAAM,CACJ,UAAWC,EACX,IAAKC,EACL,aAAcC,EACd,kBAAmBC,EACnB,GAAGC,GACDC,GAAkB,CAAC,EAEjB,CAACd,EAASe,GAAchC,EAAM,SAAgC,IAAI,EAClEiC,EAAa/B,EAAAA,cAA8ByB,EAAcK,CAAU,EACnEE,E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,EAAU,YAAc,YAcxB,IAAaiC,EAAwB,OAAO,OAAOlC,EAAW,CAC5D,OAAQ0B,EACR,WAAYE,EAEZ,KAAMC,EAEN,SAAUC,EACV,KAAMC,EACN,IAAKC,EACL,KAAMC,CACR,CAAC"}
|
|
1
|
+
{"version":3,"file":"Table.cjs","names":["React","isElementOfType","useMergedRefs","useId","flattenChildren","cn","tableClassNames","tableHeaderClassNames","tableHeaderCellClassNames","tableBodyClassNames","tableRowClassNames","tableCellClassNames","require_runtime","require_cn","require_children","require_dev","require_classNames","require_useId","require_useMergedRefs","react","react_jsx_runtime","noopSubscribe","useHorizontalOverflow","subscribe","wrapper","observer","onChange","child","getSnapshot","isCaption","node","TableRoot","props","containerClassName","containerRef","containerLabel","containerLabelledBy","containerRest","containerProps","setWrapper","wrapperRef","scrollable","generatedCaptionId","flatChildren","children","captionIndex","caption","captionId","content","index","key","regionLabelledBy","named","isRegion","consumerRole","striped","className","TableHeader","rest","TableHeaderCell","TableHead","TableHeadCell","TableBody","TableRow","TableCell","Table"],"sources":["../../../src/components/table/Table.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport {\n tableBodyClassNames,\n tableCellClassNames,\n tableClassNames,\n tableHeaderCellClassNames,\n tableHeaderClassNames,\n tableRowClassNames,\n} from '../../lib/classNames';\nimport { warnDeprecated, warnOnce } from '../../lib/dev';\nimport { focusRing } from '../../lib/styles';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\n\n/** Properties for the Table component. */\nexport interface TableProps extends React.HTMLAttributes<HTMLTableElement> {\n /**\n * Whether to apply alternating row background colors (odd body rows). The stripe has zero\n * specificity, so a row's own background class (`<Table.Row className=\"bg-selected\">`) and its\n * hover color win over it.\n * @default false\n */\n striped?: boolean;\n /**\n * Props for the wrapper `<div>` around the `<table>`: a horizontally scrollable container\n * (`overflow-x-auto`). Use it for its className, style, ref or `aria-label`. While the table\n * scrolls horizontally, the wrapper is a keyboard-focusable `role=\"region\"` named by\n * `containerProps['aria-label']`/`['aria-labelledby']`, else by the table's `<caption>`. While\n * it does not scroll, the wrapper has no role and its `aria-label`/`aria-labelledby` are left\n * off, unless you also pass a `role` in `containerProps` (then they are always applied).\n */\n containerProps?: Omit<React.ComponentPropsWithRef<'div'>, 'children'>;\n /** Table caption, header, body and row elements. */\n children: React.ReactNode;\n /** Ref to the `<table>` element. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\n/** Properties for the TableHeader sub-component. */\nexport interface TableHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /** Table header row elements. */\n children: React.ReactNode;\n /** Ref to the `<thead>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the TableHeaderCell sub-component. */\nexport interface TableHeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /** Header cell content. */\n children: React.ReactNode;\n /** Ref to the `<th>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** @deprecated Use `TableHeaderProps` (`Table.Header`). */\nexport type TableHeadProps = TableHeaderProps;\n\n/** @deprecated Use `TableHeaderCellProps` (`Table.HeaderCell`). */\nexport type TableHeadCellProps = TableHeaderCellProps;\n\n/** Properties for the TableBody sub-component. */\nexport interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /** Table row elements. */\n children: React.ReactNode;\n /** Ref to the `<tbody>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the TableRow sub-component. */\nexport interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {\n /** Table cell elements. */\n children: React.ReactNode;\n /** Ref to the `<tr>` element. */\n ref?: React.Ref<HTMLTableRowElement>;\n}\n\n/** Properties for the TableCell sub-component. */\nexport interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Cell content. */\n children: React.ReactNode;\n /** Ref to the `<td>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\nconst noopSubscribe = () => () => {};\n\n/**\n * Whether `wrapper` scrolls horizontally, as an external store: a `ResizeObserver` on the wrapper\n * and the table re-checks `scrollWidth > clientWidth`. Without `ResizeObserver` (server, old\n * browsers, jsdom) the value is read on each render.\n */\nfunction useHorizontalOverflow(wrapper: HTMLDivElement | null): boolean {\n const subscribe = React.useCallback(\n (onChange: () => void) => {\n if (!wrapper || typeof ResizeObserver === 'undefined') return () => {};\n const observer = new ResizeObserver(onChange);\n observer.observe(wrapper);\n for (const child of Array.from(wrapper.children)) observer.observe(child);\n return () => observer.disconnect();\n },\n [wrapper],\n );\n const getSnapshot = React.useCallback(\n () => (wrapper ? wrapper.scrollWidth > wrapper.clientWidth : false),\n [wrapper],\n );\n return React.useSyncExternalStore(wrapper ? subscribe : noopSubscribe, getSnapshot, () => false);\n}\n\nfunction isCaption(node: React.ReactNode): node is React.ReactElement<{ id?: string }> {\n return isElementOfType(node, 'caption');\n}\n\n// The component-level JSDoc sits on the exported `Table` below.\nconst TableRoot = ({\n striped = false,\n containerProps,\n children,\n className,\n ref,\n ...props\n}: TableProps) => {\n const {\n className: containerClassName,\n ref: containerRef,\n 'aria-label': containerLabel,\n 'aria-labelledby': containerLabelledBy,\n ...containerRest\n } = containerProps ?? {};\n\n const [wrapper, setWrapper] = React.useState<HTMLDivElement | null>(null);\n const wrapperRef = useMergedRefs<HTMLDivElement>(containerRef, setWrapper);\n const scrollable = useHorizontalOverflow(wrapper);\n\n // Name the scroll region after the caption (also one inside a Fragment): keep its id, or give it\n // one. The flattened children are then rendered under their flattened keys.\n const generatedCaptionId = useId('wave-table-caption');\n const flatChildren = flattenChildren(children);\n const captionIndex = flatChildren.findIndex(({ node }) => isCaption(node));\n const caption =\n captionIndex >= 0\n ? (flatChildren[captionIndex].node as React.ReactElement<{ id?: string }>)\n : null;\n const captionId = caption ? (caption.props.id ?? generatedCaptionId) : undefined;\n const content =\n caption && caption.props.id === undefined\n ? flatChildren.map(({ key, node }, index) => (\n <React.Fragment key={key}>\n {index === captionIndex\n ? React.cloneElement(caption, { id: generatedCaptionId })\n : node}\n </React.Fragment>\n ))\n : children;\n\n const regionLabelledBy = containerLabel ? undefined : (containerLabelledBy ?? captionId);\n const named = Boolean(containerLabel || regionLabelledBy);\n const isRegion = scrollable && named;\n /** A role the consumer gave the wrapper: their name goes with it even while nothing scrolls. */\n const consumerRole = containerRest.role;\n\n React.useEffect(() => {\n if (scrollable && !named) {\n warnOnce(\n 'Table:unnamed-scroll-region',\n 'Table: the table scrolls horizontally but its scroll region has no name. Add a <caption> or containerProps[\"aria-label\"].',\n );\n }\n }, [scrollable, named]);\n\n return (\n <div\n {...containerRest}\n ref={wrapperRef}\n role={isRegion ? 'region' : consumerRole}\n tabIndex={scrollable ? 0 : containerRest.tabIndex}\n aria-label={scrollable || consumerRole !== undefined ? containerLabel : undefined}\n aria-labelledby={\n isRegion ? regionLabelledBy : consumerRole !== undefined ? containerLabelledBy : undefined\n }\n className={cn(\n tableClassNames.container,\n 'overflow-x-auto rounded-md border border-border',\n scrollable && focusRing,\n containerClassName,\n )}\n >\n <table\n ref={ref}\n data-striped={striped ? '' : undefined}\n className={cn(\n tableClassNames.root,\n 'w-full border-separate border-spacing-0',\n // `:where()` keeps the stripe at specificity 0, so any row class wins (C-CLASS).\n striped && '[:where(&>tbody>tr:nth-child(odd))]:bg-card',\n className,\n )}\n {...props}\n >\n {content}\n </table>\n </div>\n );\n};\nTableRoot.displayName = 'Table';\n\n/** The table's `<thead>`. */\nconst TableHeader = ({ children, className, ref, ...rest }: TableHeaderProps) => (\n <thead ref={ref} {...rest} className={cn(tableHeaderClassNames.root, 'bg-card', className)}>\n {children}\n </thead>\n);\nTableHeader.displayName = 'TableHeader';\n\n/** A column header cell (`<th scope=\"col\">`). */\nconst TableHeaderCell = ({ children, className, ref, ...props }: TableHeaderCellProps) => (\n <th\n ref={ref}\n scope=\"col\"\n className={cn(\n tableHeaderCellClassNames.root,\n 'px-4 py-3 text-start font-semibold text-caption-1 uppercase tracking-wider border-b border-border',\n className,\n )}\n {...props}\n >\n {children}\n </th>\n);\nTableHeaderCell.displayName = 'TableHeaderCell';\n\n/** @deprecated Use `Table.Header` (`TableHeader`). */\nconst TableHead = (props: TableHeadProps) => {\n warnDeprecated('Table', 'Table.Head', 'Table.Header');\n return <TableHeader {...props} />;\n};\nTableHead.displayName = 'TableHead';\n\n/** @deprecated Use `Table.HeaderCell` (`TableHeaderCell`). */\nconst TableHeadCell = (props: TableHeadCellProps) => {\n warnDeprecated('Table', 'Table.HeadCell', 'Table.HeaderCell');\n return <TableHeaderCell {...props} />;\n};\nTableHeadCell.displayName = 'TableHeadCell';\n\n/** The table's `<tbody>`. */\nconst TableBody = ({ children, className, ref, ...rest }: TableBodyProps) => (\n <tbody ref={ref} {...rest} className={cn(tableBodyClassNames.root, className)}>\n {children}\n </tbody>\n);\nTableBody.displayName = 'TableBody';\n\n/** A table row. Striping comes from the table (`striped`), so rows need no context. */\nconst TableRow = ({ children, className, ref, ...props }: TableRowProps) => (\n <tr\n ref={ref}\n className={cn(\n tableRowClassNames.root,\n 'hover:bg-subtle-hover transition-colors motion-reduce:transition-none',\n className,\n )}\n {...props}\n >\n {children}\n </tr>\n);\nTableRow.displayName = 'TableRow';\n\n/** A data cell (`<td>`). */\nconst TableCell = ({ children, className, ref, ...props }: TableCellProps) => (\n <td\n ref={ref}\n className={cn(\n tableCellClassNames.root,\n 'px-4 py-3 text-body-1 border-b border-border',\n className,\n )}\n {...props}\n >\n {children}\n </td>\n);\nTableCell.displayName = 'TableCell';\n\nexport { TableHeader, TableHeaderCell, TableHead, TableHeadCell, TableBody, TableRow, TableCell };\n\n/**\n * A non-interactive data table with an optional striped body. The table sits in a horizontally\n * scrollable wrapper; while it scrolls, the wrapper is a focusable region (named by\n * `containerProps` or the `<caption>`) so keyboard users can scroll it.\n *\n * Sub-components are available as `Table.Header`, `Table.HeaderCell`, `Table.Body`, `Table.Row`\n * and `Table.Cell` in client components, and as the flat exports `TableHeader`,\n * `TableHeaderCell`, `TableBody`, `TableRow` and `TableCell` (the form React Server Components\n * can import). `Table.Head`/`Table.HeadCell` (`TableHead`/`TableHeadCell`) are deprecated aliases.\n */\nexport const Table = /* @__PURE__ */ Object.assign(TableRoot, {\n Header: TableHeader,\n HeaderCell: TableHeaderCell,\n /** @deprecated Use `Table.Header`. */\n Head: TableHead,\n /** @deprecated Use `Table.HeaderCell`. */\n HeadCell: TableHeadCell,\n Body: TableBody,\n Row: TableRow,\n Cell: TableCell,\n});\n"],"mappings":"qYAsFA,IAAMqB,UAA4B,CAAC,EAOnC,SAASC,EAAsB,EAAyC,CACtE,IAAMC,EAAYvB,EAAM,YACrB,GAAyB,CACxB,GAAI,CAACwB,GAAW,OAAO,eAAmB,IAAa,UAAa,CAAC,EACrE,IAAMC,EAAW,IAAI,eAAeC,CAAQ,EAC5CD,EAAS,QAAQD,CAAO,EACxB,IAAK,IAAMG,KAAS,MAAM,KAAKH,EAAQ,QAAQ,EAAGC,EAAS,QAAQE,CAAK,EACxE,UAAaF,EAAS,WAAW,CACnC,EACA,CAACD,CAAO,CACV,EACMI,EAAc5B,EAAM,gBACjBwB,EAAUA,EAAQ,YAAcA,EAAQ,YAAc,GAC7D,CAACA,CAAO,CACV,EACA,OAAOxB,EAAM,qBAAqBwB,EAAUD,EAAYF,EAAeO,MAAmB,EAAK,CACjG,CAEA,SAASC,EAAU,EAAoE,CACrF,OAAO5B,EAAAA,gBAAgB6B,EAAM,SAAS,CACxC,CAGA,IAAMC,GAAa,CACjB,UAAU,GACV,iBACA,WACA,YACA,MACA,GAAGC,KACa,CAChB,GAAM,CACJ,UAAWC,EACX,IAAKC,EACL,aAAcC,EACd,kBAAmBC,EACnB,GAAGC,GACDC,GAAkB,CAAC,EAEjB,CAACd,EAASe,GAAcvC,EAAM,SAAgC,IAAI,EAClEwC,EAAatC,EAAAA,cAA8BgC,EAAcK,CAAU,EACnEE,EAAanB,EAAsBE,CAAO,EAI1CkB,EAAqBv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