@cognite/aura 0.3.5 → 1.0.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/CHANGELOG.md +274 -0
- package/DESIGN.md +664 -281
- package/LICENSE +21 -0
- package/README.md +21 -13
- package/dist/colors-deprecated.css +618 -0
- package/dist/colors.css +803 -830
- package/dist/components/index.d.ts +63 -57
- package/dist/components/index.js +62 -59
- package/dist/components/index.js.map +1 -0
- package/dist/components/ui/core/accordion/accordion.d.ts +19 -18
- package/dist/components/ui/core/accordion/accordion.js +99 -78
- package/dist/components/ui/core/accordion/accordion.js.map +1 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar-motion.d.ts +8 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js +132 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js.map +1 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar.d.ts +31 -31
- package/dist/components/ui/core/action-toolbar/action-toolbar.js +156 -106
- package/dist/components/ui/core/action-toolbar/action-toolbar.js.map +1 -0
- package/dist/components/ui/core/alert/alert.d.ts +25 -25
- package/dist/components/ui/core/alert/alert.gallery.d.ts +2 -0
- package/dist/components/ui/core/alert/alert.gallery.js +54 -0
- package/dist/components/ui/core/alert/alert.gallery.js.map +1 -0
- package/dist/components/ui/core/alert/alert.js +181 -152
- package/dist/components/ui/core/alert/alert.js.map +1 -0
- package/dist/components/ui/core/avatar/avatar.d.ts +10 -9
- package/dist/components/ui/core/avatar/avatar.gallery.d.ts +2 -0
- package/dist/components/ui/core/avatar/avatar.gallery.js +67 -0
- package/dist/components/ui/core/avatar/avatar.gallery.js.map +1 -0
- package/dist/components/ui/core/avatar/avatar.js +75 -65
- package/dist/components/ui/core/avatar/avatar.js.map +1 -0
- package/dist/components/ui/core/badge/badge.d.ts +13 -12
- package/dist/components/ui/core/badge/badge.gallery.d.ts +2 -0
- package/dist/components/ui/core/badge/badge.gallery.js +64 -0
- package/dist/components/ui/core/badge/badge.gallery.js.map +1 -0
- package/dist/components/ui/core/badge/badge.js +88 -72
- package/dist/components/ui/core/badge/badge.js.map +1 -0
- package/dist/components/ui/core/banner/banner.d.ts +18 -18
- package/dist/components/ui/core/banner/banner.gallery.d.ts +2 -0
- package/dist/components/ui/core/banner/banner.gallery.js +56 -0
- package/dist/components/ui/core/banner/banner.gallery.js.map +1 -0
- package/dist/components/ui/core/banner/banner.js +179 -142
- package/dist/components/ui/core/banner/banner.js.map +1 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.d.ts +12 -12
- package/dist/components/ui/core/breadcrumb/breadcrumb.gallery.d.ts +2 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.gallery.js +31 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.gallery.js.map +1 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.js +139 -104
- package/dist/components/ui/core/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/ui/core/button/button.d.ts +7 -7
- package/dist/components/ui/core/button/button.gallery.d.ts +2 -0
- package/dist/components/ui/core/button/button.gallery.js +76 -0
- package/dist/components/ui/core/button/button.gallery.js.map +1 -0
- package/dist/components/ui/core/button/button.js +57 -47
- package/dist/components/ui/core/button/button.js.map +1 -0
- package/dist/components/ui/core/button-group/button-group.d.ts +9 -9
- package/dist/components/ui/core/button-group/button-group.gallery.d.ts +2 -0
- package/dist/components/ui/core/button-group/button-group.gallery.js +62 -0
- package/dist/components/ui/core/button-group/button-group.gallery.js.map +1 -0
- package/dist/components/ui/core/button-group/button-group.js +50 -40
- package/dist/components/ui/core/button-group/button-group.js.map +1 -0
- package/dist/components/ui/core/calendar/calendar-header.d.ts +7 -7
- package/dist/components/ui/core/calendar/calendar-header.js +102 -63
- package/dist/components/ui/core/calendar/calendar-header.js.map +1 -0
- package/dist/components/ui/core/calendar/calendar-utils.d.ts +30 -30
- package/dist/components/ui/core/calendar/calendar-utils.js +116 -39
- package/dist/components/ui/core/calendar/calendar-utils.js.map +1 -0
- package/dist/components/ui/core/calendar/calendar.d.ts +10 -10
- package/dist/components/ui/core/calendar/calendar.js +95 -66
- package/dist/components/ui/core/calendar/calendar.js.map +1 -0
- package/dist/components/ui/core/calendar/constants.js +3 -0
- package/dist/components/ui/core/calendar/constants.js.map +1 -0
- package/dist/components/ui/core/card/card.d.ts +20 -20
- package/dist/components/ui/core/card/card.js +133 -104
- package/dist/components/ui/core/card/card.js.map +1 -0
- package/dist/components/ui/core/chart/chart.d.ts +55 -53
- package/dist/components/ui/core/chart/chart.js +196 -116
- package/dist/components/ui/core/chart/chart.js.map +1 -0
- package/dist/components/ui/core/chart/index.d.ts +2 -2
- package/dist/components/ui/core/chart/index.js +3 -2
- package/dist/components/ui/core/chart/index.js.map +1 -0
- package/dist/components/ui/core/checkbox/checkbox.d.ts +9 -9
- package/dist/components/ui/core/checkbox/checkbox.gallery.d.ts +2 -0
- package/dist/components/ui/core/checkbox/checkbox.gallery.js +36 -0
- package/dist/components/ui/core/checkbox/checkbox.gallery.js.map +1 -0
- package/dist/components/ui/core/checkbox/checkbox.js +88 -68
- package/dist/components/ui/core/checkbox/checkbox.js.map +1 -0
- package/dist/components/ui/core/checkbox/checkbox.metadata.d.ts +1 -1
- package/dist/components/ui/core/checkbox/checkbox.metadata.js +6 -7
- package/dist/components/ui/core/checkbox/checkbox.metadata.js.map +1 -0
- package/dist/components/ui/core/code-block/code-block.d.ts +19 -19
- package/dist/components/ui/core/code-block/code-block.js +260 -175
- package/dist/components/ui/core/code-block/code-block.js.map +1 -0
- package/dist/components/ui/core/collapsible/collapsible.d.ts +5 -5
- package/dist/components/ui/core/collapsible/collapsible.gallery.d.ts +2 -0
- package/dist/components/ui/core/collapsible/collapsible.gallery.js +39 -0
- package/dist/components/ui/core/collapsible/collapsible.gallery.js.map +1 -0
- package/dist/components/ui/core/collapsible/collapsible.js +36 -30
- package/dist/components/ui/core/collapsible/collapsible.js.map +1 -0
- package/dist/components/ui/core/combobox/combobox.d.ts +13 -13
- package/dist/components/ui/core/combobox/combobox.js +89 -40
- package/dist/components/ui/core/combobox/combobox.js.map +1 -0
- package/dist/components/ui/core/command/command.d.ts +20 -18
- package/dist/components/ui/core/command/command.js +137 -85
- package/dist/components/ui/core/command/command.js.map +1 -0
- package/dist/components/ui/core/conversation/conversation.d.ts +14 -0
- package/dist/components/ui/core/conversation/conversation.js +51 -0
- package/dist/components/ui/core/conversation/conversation.js.map +1 -0
- package/dist/components/ui/core/count/count.d.ts +8 -6
- package/dist/components/ui/core/count/count.gallery.d.ts +2 -0
- package/dist/components/ui/core/count/count.gallery.js +55 -0
- package/dist/components/ui/core/count/count.gallery.js.map +1 -0
- package/dist/components/ui/core/count/count.js +51 -21
- package/dist/components/ui/core/count/count.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-cell.d.ts +5 -7
- package/dist/components/ui/core/data-grid/data-grid-cell.js +18 -22
- package/dist/components/ui/core/data-grid/data-grid-cell.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-column-filter.d.ts +4 -0
- package/dist/components/ui/core/data-grid/data-grid-column-filter.js +13 -0
- package/dist/components/ui/core/data-grid/data-grid-column-filter.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-column-resizer.d.ts +8 -0
- package/dist/components/ui/core/data-grid/data-grid-column-resizer.js +25 -0
- package/dist/components/ui/core/data-grid/data-grid-column-resizer.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-clauses.d.ts +14 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js +36 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.d.ts +43 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.js +287 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-footer.d.ts +6 -0
- package/dist/components/ui/core/data-grid/data-grid-footer.js +34 -0
- package/dist/components/ui/core/data-grid/data-grid-footer.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-header-row.d.ts +10 -10
- package/dist/components/ui/core/data-grid/data-grid-header-row.js +85 -55
- package/dist/components/ui/core/data-grid/data-grid-header-row.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-header.d.ts +11 -0
- package/dist/components/ui/core/data-grid/data-grid-header.js +67 -0
- package/dist/components/ui/core/data-grid/data-grid-header.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-row.d.ts +13 -15
- package/dist/components/ui/core/data-grid/data-grid-row.js +117 -76
- package/dist/components/ui/core/data-grid/data-grid-row.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-state.d.ts +15 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-state.js +32 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-state.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-toolbar.d.ts +11 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-toolbar.js +129 -0
- package/dist/components/ui/core/data-grid/data-grid-selection-toolbar.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid-selection.types.d.ts +24 -0
- package/dist/components/ui/core/data-grid/data-grid-selection.types.js +3 -0
- package/dist/components/ui/core/data-grid/data-grid-selection.types.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid.d.ts +125 -35
- package/dist/components/ui/core/data-grid/data-grid.fixtures.d.ts +7 -7
- package/dist/components/ui/core/data-grid/data-grid.fixtures.js +139 -0
- package/dist/components/ui/core/data-grid/data-grid.fixtures.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid.js +540 -132
- package/dist/components/ui/core/data-grid/data-grid.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid.utils.d.ts +3 -4
- package/dist/components/ui/core/data-grid/data-grid.utils.js +46 -33
- package/dist/components/ui/core/data-grid/data-grid.utils.js.map +1 -0
- package/dist/components/ui/core/data-grid/index.d.ts +6 -1
- package/dist/components/ui/core/data-grid/index.js +6 -2
- package/dist/components/ui/core/data-grid/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.d.ts +11 -13
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +85 -61
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +14 -14
- package/dist/components/ui/core/date-time-pickers/date-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +51 -36
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.d.ts +11 -13
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +89 -64
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +20 -20
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.d.ts +4 -4
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +95 -60
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.d.ts +15 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js +120 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/index.d.ts +3 -1
- package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/types.d.ts +25 -32
- package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js +78 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.d.ts +13 -15
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +165 -119
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +37 -37
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +163 -104
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/index.d.ts +17 -12
- package/dist/components/ui/core/date-time-pickers/index.js +10 -6
- package/dist/components/ui/core/date-time-pickers/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +52 -42
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/constants.d.ts +6 -1
- package/dist/components/ui/core/date-time-pickers/shared/constants.js +23 -0
- package/dist/components/ui/core/date-time-pickers/shared/constants.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +16 -15
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +87 -64
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.d.ts +10 -9
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +89 -38
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +34 -23
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.d.ts +23 -23
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +95 -52
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +22 -18
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.d.ts +19 -19
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +41 -24
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.d.ts +13 -13
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +33 -24
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.d.ts +5 -5
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +9 -4
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +13 -9
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +22 -17
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +13 -13
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +49 -40
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.d.ts +7 -7
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +41 -34
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/time-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +12 -14
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +99 -79
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +20 -20
- package/dist/components/ui/core/date-time-pickers/time-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +63 -41
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/index.d.ts +3 -1
- package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.d.ts +14 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js +115 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/types.d.ts +30 -36
- package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js +3 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.d.ts +2 -2
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js +145 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-input.d.ts +56 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-input.js +67 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-input.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.d.ts +18 -18
- package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js +42 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +31 -29
- package/dist/components/ui/core/date-time-pickers/utils/format-utils.js +56 -0
- package/dist/components/ui/core/date-time-pickers/utils/format-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/segment-utils.d.ts +21 -21
- package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js +170 -0
- package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +28 -28
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +88 -7
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js.map +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-validation.d.ts +17 -17
- package/dist/components/ui/core/date-time-pickers/utils/time-validation.js +43 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-validation.js.map +1 -0
- package/dist/components/ui/core/dialog/dialog.d.ts +12 -9
- package/dist/components/ui/core/dialog/dialog.js +90 -82
- package/dist/components/ui/core/dialog/dialog.js.map +1 -0
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +22 -19
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +204 -149
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/components/ui/core/empty-state/empty-state.context.d.ts +4 -4
- package/dist/components/ui/core/empty-state/empty-state.context.js +8 -5
- package/dist/components/ui/core/empty-state/empty-state.context.js.map +1 -0
- package/dist/components/ui/core/empty-state/empty-state.d.ts +14 -14
- package/dist/components/ui/core/empty-state/empty-state.js +96 -82
- package/dist/components/ui/core/empty-state/empty-state.js.map +1 -0
- package/dist/components/ui/core/helper-text/helper-text.d.ts +7 -7
- package/dist/components/ui/core/helper-text/helper-text.js +55 -36
- package/dist/components/ui/core/helper-text/helper-text.js.map +1 -0
- package/dist/components/ui/core/hover-card/hover-card.d.ts +7 -6
- package/dist/components/ui/core/hover-card/hover-card.js +56 -52
- package/dist/components/ui/core/hover-card/hover-card.js.map +1 -0
- package/dist/components/ui/core/inline-citation/inline-citation.d.ts +26 -25
- package/dist/components/ui/core/inline-citation/inline-citation.js +121 -97
- package/dist/components/ui/core/inline-citation/inline-citation.js.map +1 -0
- package/dist/components/ui/core/input/input.d.ts +2 -2
- package/dist/components/ui/core/input/input.gallery.d.ts +2 -0
- package/dist/components/ui/core/input/input.gallery.js +89 -0
- package/dist/components/ui/core/input/input.gallery.js.map +1 -0
- package/dist/components/ui/core/input/input.js +15 -13
- package/dist/components/ui/core/input/input.js.map +1 -0
- package/dist/components/ui/core/input-group/input-group.d.ts +25 -14
- package/dist/components/ui/core/input-group/input-group.js +149 -76
- package/dist/components/ui/core/input-group/input-group.js.map +1 -0
- package/dist/components/ui/core/item/item.d.ts +20 -0
- package/dist/components/ui/core/item/item.js +93 -0
- package/dist/components/ui/core/item/item.js.map +1 -0
- package/dist/components/ui/core/kbd/kbd.d.ts +3 -3
- package/dist/components/ui/core/kbd/kbd.js +24 -20
- package/dist/components/ui/core/kbd/kbd.js.map +1 -0
- package/dist/components/ui/core/label/label.d.ts +3 -3
- package/dist/components/ui/core/label/label.gallery.d.ts +2 -0
- package/dist/components/ui/core/label/label.gallery.js +57 -0
- package/dist/components/ui/core/label/label.gallery.js.map +1 -0
- package/dist/components/ui/core/label/label.js +33 -26
- package/dist/components/ui/core/label/label.js.map +1 -0
- package/dist/components/ui/core/loader/loader.d.ts +6 -6
- package/dist/components/ui/core/loader/loader.js +97 -80
- package/dist/components/ui/core/loader/loader.js.map +1 -0
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.d.ts +8 -9
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +18 -12
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js.map +1 -0
- package/dist/components/ui/core/message/message-response-math-plugin.d.ts +3 -0
- package/dist/components/ui/core/message/message-response-math-plugin.js +6 -0
- package/dist/components/ui/core/message/message-response-math-plugin.js.map +1 -0
- package/dist/components/ui/core/message/message.d.ts +27 -23
- package/dist/components/ui/core/message/message.js +458 -316
- package/dist/components/ui/core/message/message.js.map +1 -0
- package/dist/components/ui/core/overflow-list/overflow-list.d.ts +21 -0
- package/dist/components/ui/core/overflow-list/overflow-list.js +197 -0
- package/dist/components/ui/core/overflow-list/overflow-list.js.map +1 -0
- package/dist/components/ui/core/overflow-list/overflow-list.utils.d.ts +37 -35
- package/dist/components/ui/core/overflow-list/overflow-list.utils.js +206 -0
- package/dist/components/ui/core/overflow-list/overflow-list.utils.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination-size-context.d.ts +2 -2
- package/dist/components/ui/core/pagination/pagination-size-context.js +6 -5
- package/dist/components/ui/core/pagination/pagination-size-context.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination-teleport.d.ts +9 -9
- package/dist/components/ui/core/pagination/pagination-teleport.js +127 -84
- package/dist/components/ui/core/pagination/pagination-teleport.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js.map +1 -0
- package/dist/components/ui/core/pagination/pagination.d.ts +39 -39
- package/dist/components/ui/core/pagination/pagination.js +294 -234
- package/dist/components/ui/core/pagination/pagination.js.map +1 -0
- package/dist/components/ui/core/popover/popover.d.ts +12 -11
- package/dist/components/ui/core/popover/popover.js +104 -89
- package/dist/components/ui/core/popover/popover.js.map +1 -0
- package/dist/components/ui/core/progress/progress.d.ts +9 -8
- package/dist/components/ui/core/progress/progress.js +50 -35
- package/dist/components/ui/core/progress/progress.js.map +1 -0
- package/dist/components/ui/core/prompt-input/prompt-input.d.ts +27 -27
- package/dist/components/ui/core/prompt-input/prompt-input.js +342 -271
- package/dist/components/ui/core/prompt-input/prompt-input.js.map +1 -0
- package/dist/components/ui/core/radio-group/radio-group.d.ts +12 -12
- package/dist/components/ui/core/radio-group/radio-group.gallery.d.ts +2 -0
- package/dist/components/ui/core/radio-group/radio-group.gallery.js +44 -0
- package/dist/components/ui/core/radio-group/radio-group.gallery.js.map +1 -0
- package/dist/components/ui/core/radio-group/radio-group.js +88 -58
- package/dist/components/ui/core/radio-group/radio-group.js.map +1 -0
- package/dist/components/ui/core/reasoning/reasoning.d.ts +7 -7
- package/dist/components/ui/core/reasoning/reasoning.js +68 -56
- package/dist/components/ui/core/reasoning/reasoning.js.map +1 -0
- package/dist/components/ui/core/scroll-area/scroll-area.d.ts +4 -4
- package/dist/components/ui/core/scroll-area/scroll-area.js +50 -40
- package/dist/components/ui/core/scroll-area/scroll-area.js.map +1 -0
- package/dist/components/ui/core/search/search.d.ts +8 -8
- package/dist/components/ui/core/search/search.js +122 -76
- package/dist/components/ui/core/search/search.js.map +1 -0
- package/dist/components/ui/core/segmented-control/segmented-control.d.ts +10 -10
- package/dist/components/ui/core/segmented-control/segmented-control.js +203 -149
- package/dist/components/ui/core/segmented-control/segmented-control.js.map +1 -0
- package/dist/components/ui/core/select/select.d.ts +33 -26
- package/dist/components/ui/core/select/select.js +262 -168
- package/dist/components/ui/core/select/select.js.map +1 -0
- package/dist/components/ui/core/separator/separator.d.ts +2 -2
- package/dist/components/ui/core/separator/separator.gallery.d.ts +2 -0
- package/dist/components/ui/core/separator/separator.gallery.js +63 -0
- package/dist/components/ui/core/separator/separator.gallery.js.map +1 -0
- package/dist/components/ui/core/separator/separator.js +13 -13
- package/dist/components/ui/core/separator/separator.js.map +1 -0
- package/dist/components/ui/core/shimmer/shimmer.d.ts +8 -8
- package/dist/components/ui/core/shimmer/shimmer.js +64 -40
- package/dist/components/ui/core/shimmer/shimmer.js.map +1 -0
- package/dist/components/ui/core/skeleton/skeleton.d.ts +2 -2
- package/dist/components/ui/core/skeleton/skeleton.gallery.d.ts +2 -0
- package/dist/components/ui/core/skeleton/skeleton.gallery.js +22 -0
- package/dist/components/ui/core/skeleton/skeleton.gallery.js.map +1 -0
- package/dist/components/ui/core/skeleton/skeleton.js +13 -13
- package/dist/components/ui/core/skeleton/skeleton.js.map +1 -0
- package/dist/components/ui/core/slider/slider.d.ts +7 -7
- package/dist/components/ui/core/slider/slider.gallery.d.ts +2 -0
- package/dist/components/ui/core/slider/slider.gallery.js +62 -0
- package/dist/components/ui/core/slider/slider.gallery.js.map +1 -0
- package/dist/components/ui/core/slider/slider.js +51 -39
- package/dist/components/ui/core/slider/slider.js.map +1 -0
- package/dist/components/ui/core/sonner-toast/sonner-toast.d.ts +2 -2
- package/dist/components/ui/core/sonner-toast/sonner-toast.js +67 -54
- package/dist/components/ui/core/sonner-toast/sonner-toast.js.map +1 -0
- package/dist/components/ui/core/sources/sources.d.ts +12 -12
- package/dist/components/ui/core/sources/sources.js +87 -58
- package/dist/components/ui/core/sources/sources.js.map +1 -0
- package/dist/components/ui/core/status-text/status-text.d.ts +4 -0
- package/dist/components/ui/core/status-text/status-text.js +14 -0
- package/dist/components/ui/core/status-text/status-text.js.map +1 -0
- package/dist/components/ui/core/switch/switch.d.ts +9 -9
- package/dist/components/ui/core/switch/switch.gallery.d.ts +2 -0
- package/dist/components/ui/core/switch/switch.gallery.js +67 -0
- package/dist/components/ui/core/switch/switch.gallery.js.map +1 -0
- package/dist/components/ui/core/switch/switch.js +83 -61
- package/dist/components/ui/core/switch/switch.js.map +1 -0
- package/dist/components/ui/core/switch/switch.metadata.d.ts +1 -1
- package/dist/components/ui/core/switch/switch.metadata.js +8 -0
- package/dist/components/ui/core/switch/switch.metadata.js.map +1 -0
- package/dist/components/ui/core/tabs/tabs.d.ts +20 -18
- package/dist/components/ui/core/tabs/tabs.js +176 -147
- package/dist/components/ui/core/tabs/tabs.js.map +1 -0
- package/dist/components/ui/core/tabs/tabs.utils.d.ts +1 -1
- package/dist/components/ui/core/tabs/tabs.utils.js +10 -6
- package/dist/components/ui/core/tabs/tabs.utils.js.map +1 -0
- package/dist/components/ui/core/textarea/textarea.d.ts +2 -2
- package/dist/components/ui/core/textarea/textarea.gallery.d.ts +2 -0
- package/dist/components/ui/core/textarea/textarea.gallery.js +51 -0
- package/dist/components/ui/core/textarea/textarea.gallery.js.map +1 -0
- package/dist/components/ui/core/textarea/textarea.js +13 -13
- package/dist/components/ui/core/textarea/textarea.js.map +1 -0
- package/dist/components/ui/core/toggle/toggle.d.ts +9 -9
- package/dist/components/ui/core/toggle/toggle.gallery.d.ts +2 -0
- package/dist/components/ui/core/toggle/toggle.gallery.js +32 -0
- package/dist/components/ui/core/toggle/toggle.gallery.js.map +1 -0
- package/dist/components/ui/core/toggle/toggle.js +60 -54
- package/dist/components/ui/core/toggle/toggle.js.map +1 -0
- package/dist/components/ui/core/tool/tool.d.ts +18 -18
- package/dist/components/ui/core/tool/tool.js +167 -126
- package/dist/components/ui/core/tool/tool.js.map +1 -0
- package/dist/components/ui/core/toolbar/toolbar.d.ts +37 -0
- package/dist/components/ui/core/toolbar/toolbar.js +171 -0
- package/dist/components/ui/core/toolbar/toolbar.js.map +1 -0
- package/dist/components/ui/core/tooltip/tooltip.d.ts +8 -7
- package/dist/components/ui/core/tooltip/tooltip.gallery.d.ts +2 -0
- package/dist/components/ui/core/tooltip/tooltip.gallery.js +52 -0
- package/dist/components/ui/core/tooltip/tooltip.gallery.js.map +1 -0
- package/dist/components/ui/core/tooltip/tooltip.js +53 -46
- package/dist/components/ui/core/tooltip/tooltip.js.map +1 -0
- package/dist/components/ui/core/topbar/topbar.d.ts +26 -26
- package/dist/components/ui/core/topbar/topbar.js +160 -105
- package/dist/components/ui/core/topbar/topbar.js.map +1 -0
- package/dist/components/ui/core/tree/tree.d.ts +20 -0
- package/dist/components/ui/core/tree/tree.js +100 -0
- package/dist/components/ui/core/tree/tree.js.map +1 -0
- package/dist/eslint/index.d.ts +5 -5
- package/dist/eslint/index.js +9 -5
- package/dist/eslint/index.js.map +1 -0
- package/dist/eslint/no-overriding-styles.d.ts +1 -1
- package/dist/eslint/no-overriding-styles.js +341 -201
- package/dist/eslint/no-overriding-styles.js.map +1 -0
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.js +2 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/ai/types.d.ts +43 -43
- package/dist/lib/ai/types.js +3 -0
- package/dist/lib/ai/types.js.map +1 -0
- package/dist/lib/decorative-variant-classes.d.ts +53 -0
- package/dist/lib/decorative-variant-classes.js +58 -0
- package/dist/lib/decorative-variant-classes.js.map +1 -0
- package/dist/lib/highlight-code.d.ts +11 -8
- package/dist/lib/highlight-code.js +58 -40
- package/dist/lib/highlight-code.js.map +1 -0
- package/dist/lib/portal-container-context.d.ts +1 -1
- package/dist/lib/portal-container-context.js +8 -8
- package/dist/lib/portal-container-context.js.map +1 -0
- package/dist/lib/shared-theme-from-url.d.ts +13 -0
- package/dist/lib/shared-theme-from-url.js +61 -0
- package/dist/lib/shared-theme-from-url.js.map +1 -0
- package/dist/lib/style-scope.d.ts +2 -2
- package/dist/lib/style-scope.js +6 -6
- package/dist/lib/style-scope.js.map +1 -0
- package/dist/lib/theme-share-url.d.ts +31 -0
- package/dist/lib/theme-share-url.js +116 -0
- package/dist/lib/theme-share-url.js.map +1 -0
- package/dist/lib/types.d.ts +39 -39
- package/dist/lib/types.js +3 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/use-controllable-state.d.ts +4 -7
- package/dist/lib/use-controllable-state.js +34 -21
- package/dist/lib/use-controllable-state.js.map +1 -0
- package/dist/lib/utils.d.ts +63 -34
- package/dist/lib/utils.js +134 -32
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles.css +2 -1
- package/dist/styles.source.css +46 -16
- package/dist/utils/assign-ref.d.ts +3 -0
- package/dist/utils/assign-ref.js +13 -0
- package/dist/utils/assign-ref.js.map +1 -0
- package/package.json +49 -14
- package/src/components/ui/core/alert/alert.md +46 -0
- package/src/components/ui/core/avatar/avatar.md +30 -0
- package/src/components/ui/core/badge/badge.md +32 -0
- package/src/components/ui/core/banner/banner.md +51 -0
- package/src/components/ui/core/breadcrumb/breadcrumb.md +45 -0
- package/src/components/ui/core/button/button.md +93 -0
- package/src/components/ui/core/button-group/button-group.md +38 -0
- package/src/components/ui/core/checkbox/checkbox.md +37 -0
- package/src/components/ui/core/collapsible/collapsible.md +42 -0
- package/src/components/ui/core/count/count.md +33 -0
- package/src/components/ui/core/input/input.md +48 -0
- package/src/components/ui/core/label/label.md +35 -0
- package/src/components/ui/core/radio-group/radio-group.md +38 -0
- package/src/components/ui/core/separator/separator.md +32 -0
- package/src/components/ui/core/skeleton/skeleton.md +33 -0
- package/src/components/ui/core/slider/slider.md +41 -0
- package/src/components/ui/core/switch/switch.md +26 -0
- package/src/components/ui/core/textarea/textarea.md +42 -0
- package/src/components/ui/core/toggle/toggle.md +39 -0
- package/src/components/ui/core/tooltip/tooltip.md +41 -0
|
@@ -1,134 +1,542 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, forwardRef, useContext, useImperativeHandle, useMemo, useRef } from "react";
|
|
3
|
+
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
|
|
4
|
+
import { IconCheck, IconFilter, IconMinus } from "@tabler/icons-react";
|
|
5
|
+
import { getCoreRowModel, getExpandedRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
6
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
7
|
+
import { useControllableState } from "../../../../lib/use-controllable-state.js";
|
|
8
|
+
import { cn, focusState } from "../../../../lib/utils.js";
|
|
9
|
+
import { Button } from "../button/button.js";
|
|
10
|
+
import { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIcon, EmptyStateTitle } from "../empty-state/empty-state.js";
|
|
11
|
+
import { Search } from "../search/search.js";
|
|
12
|
+
import { Skeleton } from "../skeleton/skeleton.js";
|
|
13
|
+
import { StatusText } from "../status-text/status-text.js";
|
|
14
|
+
import { DataGridCell } from "./data-grid-cell.js";
|
|
15
|
+
import { DataGridHeaderRow } from "./data-grid-header-row.js";
|
|
16
|
+
import { DataGridRow } from "./data-grid-row.js";
|
|
17
|
+
import { countSelectedRowIds, getDataGridCheckboxState, selectDataGridRowTree } from "./data-grid-selection-state.js";
|
|
18
|
+
import { DataGridSelectionToolbar } from "./data-grid-selection-toolbar.js";
|
|
19
|
+
import { PINNED_COLUMN_Z_INDEX, getTextValue } from "./data-grid.utils.js";
|
|
20
|
+
const EMPTY_PINNED_COLUMNS = [];
|
|
21
|
+
function defaultDataGridCell({ renderValue }) {
|
|
22
|
+
const text = getTextValue(renderValue());
|
|
23
|
+
if (text === undefined) return null;
|
|
24
|
+
return /*#__PURE__*/ _jsx("span", {
|
|
25
|
+
className: "block min-w-0 truncate",
|
|
26
|
+
title: text,
|
|
27
|
+
children: text
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const DEFAULT_COLUMN = {
|
|
31
|
+
cell: defaultDataGridCell,
|
|
32
|
+
size: undefined
|
|
33
|
+
};
|
|
34
|
+
const DataGridContext = /*#__PURE__*/ createContext(undefined);
|
|
35
|
+
const defaultDataGridLabels = {
|
|
36
|
+
clearSearch: 'Clear search',
|
|
37
|
+
clearFilters: 'Clear filters'
|
|
38
|
+
};
|
|
39
|
+
const ROW_HEIGHT_MAP = {
|
|
40
|
+
default: 36,
|
|
41
|
+
compact: 32
|
|
17
42
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
43
|
+
const HEADER_HEIGHT_MAP = {
|
|
44
|
+
default: 36,
|
|
45
|
+
compact: 32
|
|
46
|
+
};
|
|
47
|
+
function DataGrid({ data, columns, getRowId, rowCount, globalFilterFn = 'auto', enableRowSelection = false, enableSorting = false, enableColumnResizing = false, columnGrow = false, columnSizing, defaultColumnSizing, onColumnSizingChange, manualPagination = false, manualSorting = false, rowSelection, defaultRowSelection, onRowSelectionChange, selectionActions, sorting, defaultSorting, onSortingChange, columnFilters, defaultColumnFilters, onColumnFiltersChange, pagination, defaultPagination, onPaginationChange, getSubRows, expanded, defaultExpanded, onExpandedChange, getRowCanExpand, maxDepth = 5, striped = false, emphasizeHeader = false, pinnedColumns = EMPTY_PINNED_COLUMNS, gridRef, size = 'default', children, className, onRowClick, searchValue, defaultSearchValue, onSearchValueChange, queryMode = 'client', loading = false, loadingVariant = 'skeleton', loadingRowCount, renderLoadingCell, emptyState, noResultsState, filteredResultCount, totalResultCount, onClearSearch, onClearFilters, labels: labelOverrides, rowHeight, headerHeight, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy }) {
|
|
48
|
+
const scrollContainerRef = useRef(null);
|
|
49
|
+
const labels = {
|
|
50
|
+
...defaultDataGridLabels,
|
|
51
|
+
...labelOverrides
|
|
52
|
+
};
|
|
53
|
+
const [resolvedSearchValue, setResolvedSearchValue] = useControllableState({
|
|
54
|
+
prop: searchValue,
|
|
55
|
+
defaultProp: defaultSearchValue ?? '',
|
|
56
|
+
onChange: onSearchValueChange
|
|
57
|
+
});
|
|
58
|
+
const [resolvedSorting, setResolvedSorting] = useControllableState({
|
|
59
|
+
prop: sorting,
|
|
60
|
+
defaultProp: defaultSorting ?? [],
|
|
61
|
+
onChange: onSortingChange
|
|
62
|
+
});
|
|
63
|
+
const [resolvedColumnFilters, setResolvedColumnFilters] = useControllableState({
|
|
64
|
+
prop: columnFilters,
|
|
65
|
+
defaultProp: defaultColumnFilters ?? [],
|
|
66
|
+
onChange: onColumnFiltersChange
|
|
67
|
+
});
|
|
68
|
+
const [resolvedRowSelection, setResolvedRowSelection] = useControllableState({
|
|
69
|
+
prop: rowSelection,
|
|
70
|
+
defaultProp: defaultRowSelection ?? {},
|
|
71
|
+
onChange: onRowSelectionChange
|
|
72
|
+
});
|
|
73
|
+
const hasPagination = pagination !== undefined || defaultPagination !== undefined;
|
|
74
|
+
const [resolvedPagination, setResolvedPagination] = useControllableState({
|
|
75
|
+
prop: pagination,
|
|
76
|
+
defaultProp: defaultPagination ?? {
|
|
77
|
+
pageIndex: 0,
|
|
78
|
+
pageSize: 10
|
|
79
|
+
},
|
|
80
|
+
onChange: onPaginationChange
|
|
81
|
+
});
|
|
82
|
+
const hasExpanding = getSubRows !== undefined;
|
|
83
|
+
const [resolvedExpanded, setResolvedExpanded] = useControllableState({
|
|
84
|
+
prop: expanded,
|
|
85
|
+
defaultProp: defaultExpanded ?? {},
|
|
86
|
+
onChange: onExpandedChange
|
|
87
|
+
});
|
|
88
|
+
const [resolvedColumnSizing, setResolvedColumnSizing] = useControllableState({
|
|
89
|
+
prop: columnSizing,
|
|
90
|
+
defaultProp: defaultColumnSizing ?? {},
|
|
91
|
+
onChange: onColumnSizingChange
|
|
92
|
+
});
|
|
93
|
+
const isClientSorting = enableSorting && !manualSorting;
|
|
94
|
+
const isClientPagination = hasPagination && !manualPagination;
|
|
95
|
+
const columnPinning = useMemo(()=>({
|
|
96
|
+
left: pinnedColumns,
|
|
97
|
+
right: []
|
|
98
|
+
}), [
|
|
99
|
+
pinnedColumns
|
|
100
|
+
]);
|
|
101
|
+
const pinnedColumnIds = useMemo(()=>new Set(pinnedColumns), [
|
|
102
|
+
pinnedColumns
|
|
103
|
+
]);
|
|
104
|
+
const lastPinnedColumnId = pinnedColumns[pinnedColumns.length - 1];
|
|
105
|
+
// eslint-disable-next-line react-hooks/incompatible-library -- useReactTable in the DataGrid component is intentional and stable.
|
|
106
|
+
const table = useReactTable({
|
|
107
|
+
data,
|
|
108
|
+
columns,
|
|
109
|
+
state: {
|
|
110
|
+
columnPinning,
|
|
111
|
+
globalFilter: resolvedSearchValue,
|
|
112
|
+
sorting: resolvedSorting,
|
|
113
|
+
columnFilters: resolvedColumnFilters,
|
|
114
|
+
rowSelection: resolvedRowSelection,
|
|
115
|
+
columnSizing: resolvedColumnSizing,
|
|
116
|
+
...hasPagination ? {
|
|
117
|
+
pagination: resolvedPagination
|
|
118
|
+
} : {},
|
|
119
|
+
...hasExpanding ? {
|
|
120
|
+
expanded: resolvedExpanded
|
|
121
|
+
} : {}
|
|
122
|
+
},
|
|
123
|
+
onSortingChange: setResolvedSorting,
|
|
124
|
+
onColumnFiltersChange: setResolvedColumnFilters,
|
|
125
|
+
onRowSelectionChange: setResolvedRowSelection,
|
|
126
|
+
onColumnSizingChange: setResolvedColumnSizing,
|
|
127
|
+
...hasPagination ? {
|
|
128
|
+
onPaginationChange: setResolvedPagination
|
|
129
|
+
} : {},
|
|
130
|
+
...hasExpanding ? {
|
|
131
|
+
onExpandedChange: setResolvedExpanded
|
|
132
|
+
} : {},
|
|
133
|
+
// Preserve expanded rows across `data` changes (e.g. refetches) so the user
|
|
134
|
+
// doesn't lose their place. Consumers fetching server-paged data should
|
|
135
|
+
// ensure stable `getRowId` values; otherwise expanded keys can stick to
|
|
136
|
+
// rows that no longer logically exist.
|
|
137
|
+
autoResetExpanded: false,
|
|
138
|
+
enableRowSelection,
|
|
139
|
+
// Selecting a parent selects every descendant, including while it is collapsed.
|
|
140
|
+
enableSubRowSelection: true,
|
|
141
|
+
enableSorting,
|
|
142
|
+
enableColumnResizing,
|
|
143
|
+
columnResizeMode: 'onChange',
|
|
144
|
+
defaultColumn: DEFAULT_COLUMN,
|
|
145
|
+
manualPagination,
|
|
146
|
+
manualSorting,
|
|
147
|
+
manualFiltering: queryMode === 'server',
|
|
148
|
+
getCoreRowModel: getCoreRowModel(),
|
|
149
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
150
|
+
globalFilterFn,
|
|
151
|
+
...isClientSorting ? {
|
|
152
|
+
getSortedRowModel: getSortedRowModel()
|
|
153
|
+
} : {},
|
|
154
|
+
...isClientPagination ? {
|
|
155
|
+
getPaginationRowModel: getPaginationRowModel()
|
|
156
|
+
} : {},
|
|
157
|
+
...hasExpanding ? {
|
|
158
|
+
getExpandedRowModel: getExpandedRowModel()
|
|
159
|
+
} : {},
|
|
160
|
+
getRowId,
|
|
161
|
+
getSubRows,
|
|
162
|
+
getRowCanExpand
|
|
163
|
+
});
|
|
164
|
+
const { rows } = table.getRowModel();
|
|
165
|
+
const headerGroups = table.getHeaderGroups();
|
|
166
|
+
const visibleColumns = table.getVisibleFlatColumns();
|
|
167
|
+
const resolvedRowHeight = rowHeight ?? ROW_HEIGHT_MAP[size];
|
|
168
|
+
const resolvedHeaderHeight = headerHeight ?? HEADER_HEIGHT_MAP[size];
|
|
169
|
+
const resolvedLoadingRowCount = loadingRowCount ?? 6;
|
|
170
|
+
const shouldRenderSkeleton = loading && loadingVariant === 'skeleton';
|
|
171
|
+
const hideRowsForLoading = loading && loadingVariant !== 'none';
|
|
172
|
+
const hasActiveServerSearch = queryMode === 'server' && resolvedSearchValue !== '';
|
|
173
|
+
const hasNoRows = !loading && data.length === 0 && !hasActiveServerSearch;
|
|
174
|
+
const hasNoResults = !loading && (hasActiveServerSearch ? data.length === 0 : data.length > 0 && table.getFilteredRowModel().rows.length === 0);
|
|
175
|
+
const virtualizer = useVirtualizer({
|
|
176
|
+
count: rows.length,
|
|
177
|
+
getScrollElement: ()=>scrollContainerRef.current,
|
|
178
|
+
estimateSize: ()=>resolvedRowHeight,
|
|
179
|
+
overscan: 10
|
|
180
|
+
});
|
|
181
|
+
const bodyHeight = shouldRenderSkeleton ? resolvedLoadingRowCount * resolvedRowHeight : virtualizer.getTotalSize();
|
|
182
|
+
const bodyStyle = {
|
|
183
|
+
'--data-grid-body-height': `${bodyHeight}px`,
|
|
184
|
+
'--data-grid-body-min-height': `${resolvedRowHeight * 4}px`
|
|
185
|
+
};
|
|
186
|
+
useImperativeHandle(gridRef, ()=>({
|
|
187
|
+
scrollToRow: (index)=>virtualizer.scrollToIndex(index),
|
|
188
|
+
resetSorting: ()=>setResolvedSorting([]),
|
|
189
|
+
resetSelection: ()=>setResolvedRowSelection({}),
|
|
190
|
+
resetSearch: ()=>setResolvedSearchValue('')
|
|
191
|
+
}));
|
|
192
|
+
const hasFlexibleColumn = !enableColumnResizing && !columnGrow && visibleColumns.some((column)=>column.columnDef.size === undefined && !pinnedColumnIds.has(column.id));
|
|
193
|
+
const gridTemplateColumns = visibleColumns.map((column, index)=>{
|
|
194
|
+
const columnSize = column.getSize();
|
|
195
|
+
if (enableColumnResizing || pinnedColumnIds.has(column.id)) {
|
|
196
|
+
return `${columnSize}px`;
|
|
197
|
+
}
|
|
198
|
+
if (columnGrow) {
|
|
199
|
+
return `minmax(${columnSize}px, ${columnSize}fr)`;
|
|
200
|
+
}
|
|
201
|
+
const isLastColumn = index === visibleColumns.length - 1;
|
|
202
|
+
if (column.columnDef.size !== undefined) {
|
|
203
|
+
if (!hasFlexibleColumn && isLastColumn) {
|
|
204
|
+
return `minmax(${columnSize}px, 1fr)`;
|
|
205
|
+
}
|
|
206
|
+
return `${columnSize}px`;
|
|
207
|
+
}
|
|
208
|
+
return `minmax(${columnSize}px, 1fr)`;
|
|
209
|
+
}).join(' ');
|
|
210
|
+
const scrollContainerStyle = {
|
|
211
|
+
'--data-grid-template-columns': gridTemplateColumns
|
|
212
|
+
};
|
|
213
|
+
const isResizingColumn = Boolean(table.getState().columnSizingInfo.isResizingColumn);
|
|
214
|
+
const clientFilteredCount = table.getFilteredRowModel().rows.length;
|
|
215
|
+
const clientTotalCount = table.getCoreRowModel().rows.length;
|
|
216
|
+
const contextValue = useMemo(()=>({
|
|
217
|
+
searchValue: resolvedSearchValue,
|
|
218
|
+
setSearchValue: setResolvedSearchValue,
|
|
219
|
+
filteredCount: queryMode === 'client' ? clientFilteredCount : filteredResultCount,
|
|
220
|
+
totalCount: queryMode === 'client' ? clientTotalCount : totalResultCount
|
|
221
|
+
}), [
|
|
222
|
+
resolvedSearchValue,
|
|
223
|
+
setResolvedSearchValue,
|
|
224
|
+
queryMode,
|
|
225
|
+
clientFilteredCount,
|
|
226
|
+
filteredResultCount,
|
|
227
|
+
clientTotalCount,
|
|
228
|
+
totalResultCount
|
|
229
|
+
]);
|
|
230
|
+
const selectedRowCount = countSelectedRowIds(resolvedRowSelection);
|
|
231
|
+
return /*#__PURE__*/ _jsx(DataGridContext.Provider, {
|
|
232
|
+
value: contextValue,
|
|
233
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
234
|
+
"data-slot": "data-grid",
|
|
235
|
+
"data-query-mode": queryMode,
|
|
236
|
+
"data-filtered-result-count": filteredResultCount,
|
|
237
|
+
"data-total-result-count": totalResultCount,
|
|
238
|
+
className: cn('relative flex min-h-0 w-full flex-col overflow-clip rounded-xl text-sm', className),
|
|
239
|
+
children: [
|
|
240
|
+
children,
|
|
241
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
242
|
+
ref: scrollContainerRef,
|
|
243
|
+
"data-slot": "data-grid-scroll-container",
|
|
244
|
+
className: "relative order-2 min-h-0 w-full flex-1 overflow-auto",
|
|
245
|
+
style: scrollContainerStyle,
|
|
246
|
+
role: "table",
|
|
247
|
+
"aria-rowcount": hideRowsForLoading ? headerGroups.length : (rowCount ?? rows.length) + headerGroups.length,
|
|
248
|
+
"aria-colcount": visibleColumns.length,
|
|
249
|
+
"aria-label": ariaLabel,
|
|
250
|
+
"aria-labelledby": ariaLabelledBy,
|
|
251
|
+
children: [
|
|
252
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
253
|
+
className: cn('min-w-fit w-full', enableRowSelection !== false && selectedRowCount > 0 && 'pb-24'),
|
|
254
|
+
children: [
|
|
255
|
+
/*#__PURE__*/ _jsx("div", {
|
|
256
|
+
role: "rowgroup",
|
|
257
|
+
"data-slot": "data-grid-header-group",
|
|
258
|
+
className: "contents",
|
|
259
|
+
children: headerGroups.map((headerGroup, headerRowIndex)=>/*#__PURE__*/ _jsx(DataGridHeaderRow, {
|
|
260
|
+
headerGroup: headerGroup,
|
|
261
|
+
headerRowIndex: headerRowIndex,
|
|
262
|
+
resolvedHeaderHeight: resolvedHeaderHeight,
|
|
263
|
+
pinnedColumnIds: pinnedColumnIds,
|
|
264
|
+
lastPinnedColumnId: lastPinnedColumnId,
|
|
265
|
+
isResizingColumn: isResizingColumn,
|
|
266
|
+
emphasizeHeader: emphasizeHeader
|
|
267
|
+
}, headerGroup.id))
|
|
268
|
+
}),
|
|
269
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
270
|
+
role: "rowgroup",
|
|
271
|
+
"data-slot": "data-grid-body",
|
|
272
|
+
className: cn('relative min-h-(--data-grid-body-min-height)', !hasNoRows && !hasNoResults && 'h-(--data-grid-body-height)'),
|
|
273
|
+
style: bodyStyle,
|
|
274
|
+
children: [
|
|
275
|
+
shouldRenderSkeleton && Array.from({
|
|
276
|
+
length: resolvedLoadingRowCount
|
|
277
|
+
}, (_, rowIndex)=>/*#__PURE__*/ _jsx("div", {
|
|
278
|
+
"data-slot": "data-grid-row-loading",
|
|
279
|
+
"aria-hidden": "true",
|
|
280
|
+
className: "absolute left-0 right-0 grid border-b bg-base-background",
|
|
281
|
+
style: {
|
|
282
|
+
gridTemplateColumns: 'var(--data-grid-template-columns)',
|
|
283
|
+
height: resolvedRowHeight,
|
|
284
|
+
transform: `translateY(${rowIndex * resolvedRowHeight}px)`
|
|
285
|
+
},
|
|
286
|
+
children: visibleColumns.map((column, colIndex)=>{
|
|
287
|
+
const isPinned = pinnedColumnIds.has(column.id);
|
|
288
|
+
const isLastPinned = isPinned && lastPinnedColumnId === column.id;
|
|
289
|
+
return /*#__PURE__*/ _jsx(DataGridCell, {
|
|
290
|
+
isPinned: isPinned,
|
|
291
|
+
isLastPinned: isLastPinned,
|
|
292
|
+
colIndex: colIndex + 1,
|
|
293
|
+
style: isPinned ? {
|
|
294
|
+
position: 'sticky',
|
|
295
|
+
left: column.getStart('left'),
|
|
296
|
+
zIndex: PINNED_COLUMN_Z_INDEX
|
|
297
|
+
} : undefined,
|
|
298
|
+
children: renderLoadingCell?.({
|
|
299
|
+
rowIndex,
|
|
300
|
+
columnId: column.id,
|
|
301
|
+
columnIndex: colIndex,
|
|
302
|
+
size
|
|
303
|
+
}) ?? (column.id === 'select' ? /*#__PURE__*/ _jsx(Skeleton, {
|
|
304
|
+
className: "h-4 w-4 rounded"
|
|
305
|
+
}) : /*#__PURE__*/ _jsx(Skeleton, {
|
|
306
|
+
className: cn('h-4 max-w-full', colIndex === 0 ? 'w-3/4' : 'w-2/3')
|
|
307
|
+
}))
|
|
308
|
+
}, column.id);
|
|
309
|
+
})
|
|
310
|
+
}, `skeleton-row-${rowIndex}`)),
|
|
311
|
+
!hideRowsForLoading && !hasNoRows && !hasNoResults && virtualizer.getVirtualItems().map((virtualRow)=>/*#__PURE__*/ _jsx(DataGridRow, {
|
|
312
|
+
row: rows[virtualRow.index],
|
|
313
|
+
virtualRow: virtualRow,
|
|
314
|
+
headerGroupCount: headerGroups.length,
|
|
315
|
+
pinnedColumnIds: pinnedColumnIds,
|
|
316
|
+
lastPinnedColumnId: lastPinnedColumnId,
|
|
317
|
+
maxDepth: maxDepth,
|
|
318
|
+
hasExpanding: hasExpanding,
|
|
319
|
+
striped: striped,
|
|
320
|
+
onRowClick: onRowClick
|
|
321
|
+
}, rows[virtualRow.index].id)),
|
|
322
|
+
!loading && hasNoRows && emptyState != null && /*#__PURE__*/ _jsx("div", {
|
|
323
|
+
className: "pt-2",
|
|
324
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
325
|
+
className: "flex items-center justify-center rounded-lg bg-medium-background",
|
|
326
|
+
children: renderDataGridState(emptyState, {
|
|
327
|
+
type: 'new-object',
|
|
328
|
+
title: 'No rows yet',
|
|
329
|
+
description: 'Add data to populate this table.'
|
|
330
|
+
})
|
|
331
|
+
})
|
|
332
|
+
}),
|
|
333
|
+
!loading && hasNoResults && /*#__PURE__*/ _jsx("div", {
|
|
334
|
+
className: "pt-2",
|
|
335
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
336
|
+
className: "flex items-center justify-center bg-base-background",
|
|
337
|
+
children: renderDataGridState(noResultsState, {
|
|
338
|
+
type: 'no-results',
|
|
339
|
+
title: 'No results found',
|
|
340
|
+
description: queryMode === 'server' ? 'Apply a different query or clear filters.' : 'Try a different search term or clear filters.',
|
|
341
|
+
action: onClearSearch || onClearFilters ? /*#__PURE__*/ _jsxs("div", {
|
|
342
|
+
className: "mt-2 flex items-center justify-center gap-2",
|
|
343
|
+
children: [
|
|
344
|
+
onClearSearch ? /*#__PURE__*/ _jsx(Button, {
|
|
345
|
+
size: "sm",
|
|
346
|
+
variant: "secondary",
|
|
347
|
+
onClick: onClearSearch,
|
|
348
|
+
children: labels.clearSearch
|
|
349
|
+
}) : null,
|
|
350
|
+
onClearFilters ? /*#__PURE__*/ _jsx(Button, {
|
|
351
|
+
size: "sm",
|
|
352
|
+
variant: "secondary",
|
|
353
|
+
onClick: onClearFilters,
|
|
354
|
+
children: labels.clearFilters
|
|
355
|
+
}) : null
|
|
356
|
+
]
|
|
357
|
+
}) : undefined
|
|
358
|
+
})
|
|
359
|
+
})
|
|
360
|
+
})
|
|
361
|
+
]
|
|
362
|
+
})
|
|
363
|
+
]
|
|
364
|
+
}),
|
|
365
|
+
enableRowSelection !== false ? /*#__PURE__*/ _jsx(DataGridSelectionToolbar, {
|
|
366
|
+
// The count includes every selected id.
|
|
367
|
+
// That covers parents and their children, rows on other pages, and rows hidden by search.
|
|
368
|
+
selectedCount: selectedRowCount,
|
|
369
|
+
rowSelection: resolvedRowSelection,
|
|
370
|
+
selectionActions: selectionActions,
|
|
371
|
+
onClear: ()=>setResolvedRowSelection({})
|
|
372
|
+
}) : null
|
|
373
|
+
]
|
|
374
|
+
})
|
|
375
|
+
]
|
|
376
|
+
})
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
function DataGridCheckbox({ checked, onCheckedChange, disabled, 'aria-label': checkboxAriaLabel }) {
|
|
380
|
+
const isIndeterminate = checked === 'indeterminate';
|
|
381
|
+
const isChecked = checked === true;
|
|
382
|
+
return /*#__PURE__*/ _jsx(CheckboxPrimitive.Root, {
|
|
383
|
+
"data-slot": "checkbox",
|
|
384
|
+
checked: isIndeterminate ? false : isChecked,
|
|
385
|
+
indeterminate: isIndeterminate,
|
|
386
|
+
disabled: disabled,
|
|
387
|
+
onCheckedChange: (next)=>onCheckedChange(next),
|
|
388
|
+
"aria-label": checkboxAriaLabel,
|
|
389
|
+
className: cn('peer relative size-4 shrink-0 rounded-sm border-[1.5px] border-muted-foreground bg-transparent text-foreground-on-primary outline-none transition-colors', '[&:is([data-checked],[data-indeterminate]):not([data-disabled])]:border-transparent [&:is([data-checked],[data-indeterminate]):not([data-disabled])]:bg-primary-background', 'hover:data-unchecked:not-data-disabled:border-muted-foreground-hover', 'data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:border-transparent data-disabled:bg-disabled-background data-disabled:text-disabled-foreground data-disabled:data-unchecked:border-border', '[&[data-checked]_[data-slot=checkbox-check]]:block [&[data-indeterminate]_[data-slot=checkbox-dash]]:block', focusState),
|
|
390
|
+
children: /*#__PURE__*/ _jsxs(CheckboxPrimitive.Indicator, {
|
|
391
|
+
className: "grid size-full place-content-center text-current transition-none",
|
|
392
|
+
children: [
|
|
393
|
+
/*#__PURE__*/ _jsx(IconCheck, {
|
|
394
|
+
"aria-hidden": "true",
|
|
395
|
+
"data-slot": "checkbox-check",
|
|
396
|
+
className: "hidden size-3",
|
|
397
|
+
stroke: 3
|
|
398
|
+
}),
|
|
399
|
+
/*#__PURE__*/ _jsx(IconMinus, {
|
|
400
|
+
"aria-hidden": "true",
|
|
401
|
+
"data-slot": "checkbox-dash",
|
|
402
|
+
className: "hidden size-3",
|
|
403
|
+
stroke: 3.5
|
|
404
|
+
})
|
|
405
|
+
]
|
|
406
|
+
})
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
function DataGridCheckboxHeader({ table }) {
|
|
410
|
+
const allSelected = table.getIsAllPageRowsSelected();
|
|
411
|
+
const someSelected = table.getIsSomePageRowsSelected();
|
|
412
|
+
const checked = allSelected ? true : someSelected ? 'indeterminate' : false;
|
|
413
|
+
return /*#__PURE__*/ _jsx(DataGridCheckbox, {
|
|
414
|
+
checked: checked,
|
|
415
|
+
onCheckedChange: ()=>table.toggleAllPageRowsSelected(!allSelected),
|
|
416
|
+
"aria-label": "Select all rows"
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
function DataGridCheckboxCell({ row }) {
|
|
420
|
+
return /*#__PURE__*/ _jsx(DataGridCheckbox, {
|
|
421
|
+
checked: getDataGridCheckboxState(row),
|
|
422
|
+
disabled: !row.getCanSelect(),
|
|
423
|
+
onCheckedChange: (next)=>{
|
|
424
|
+
if (next === true) {
|
|
425
|
+
selectDataGridRowTree(row);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
row.toggleSelected(false);
|
|
429
|
+
},
|
|
430
|
+
"aria-label": "Select row"
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
const DataGridSearch = /*#__PURE__*/ forwardRef(function DataGridSearch({ className, placeholder = 'Search', ...props }, ref) {
|
|
434
|
+
const { searchValue, setSearchValue } = useDataGridContext();
|
|
435
|
+
return /*#__PURE__*/ _jsx(Search, {
|
|
436
|
+
ref: ref,
|
|
437
|
+
value: searchValue,
|
|
438
|
+
onChange: (event)=>setSearchValue(event.target.value),
|
|
439
|
+
onClear: ()=>setSearchValue(''),
|
|
440
|
+
placeholder: placeholder,
|
|
441
|
+
className: cn('py-4', className),
|
|
442
|
+
...props
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
DataGridSearch.displayName = 'DataGridSearch';
|
|
446
|
+
function defaultFormatResultCount(filteredCount, totalCount) {
|
|
447
|
+
const noun = (totalCount ?? filteredCount) === 1 ? 'result' : 'results';
|
|
448
|
+
return totalCount === undefined ? `Showing ${filteredCount.toLocaleString('en')} ${noun}` : `Showing ${filteredCount.toLocaleString('en')} of ${totalCount.toLocaleString('en')} ${noun}`;
|
|
449
|
+
}
|
|
450
|
+
const DataGridResultCount = /*#__PURE__*/ forwardRef(function DataGridResultCount({ formatLabel = defaultFormatResultCount, ...props }, ref) {
|
|
451
|
+
const { filteredCount, totalCount } = useDataGridContext();
|
|
452
|
+
// Nothing to say until the grid has counted.
|
|
453
|
+
if (filteredCount === undefined) return null;
|
|
454
|
+
const content = formatLabel(filteredCount, totalCount);
|
|
455
|
+
if (content == null) return null;
|
|
456
|
+
return(// Not live by default: it changes on every search keystroke, which screen readers would read out.
|
|
457
|
+
/*#__PURE__*/ _jsx(StatusText, {
|
|
458
|
+
ref: ref,
|
|
459
|
+
"data-slot": "data-grid-result-count",
|
|
460
|
+
"aria-live": "off",
|
|
461
|
+
...props,
|
|
462
|
+
children: content
|
|
463
|
+
}));
|
|
464
|
+
});
|
|
465
|
+
DataGridResultCount.displayName = 'DataGridResultCount';
|
|
466
|
+
function renderDataGridState(state, fallback) {
|
|
467
|
+
if (isDataGridStateCopy(state)) {
|
|
468
|
+
return /*#__PURE__*/ _jsx(DataGridState, {
|
|
469
|
+
type: fallback.type,
|
|
470
|
+
title: state.title ?? fallback.title,
|
|
471
|
+
description: state.description ?? fallback.description,
|
|
472
|
+
action: state.action !== undefined ? state.action : fallback.action
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
if (state !== undefined) return state;
|
|
476
|
+
return /*#__PURE__*/ _jsx(DataGridState, {
|
|
477
|
+
type: fallback.type,
|
|
478
|
+
title: fallback.title,
|
|
479
|
+
description: fallback.description,
|
|
480
|
+
action: fallback.action
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
function isDataGridStateCopy(value) {
|
|
484
|
+
return typeof value === 'object' && value !== null && !('type' in value) && ('title' in value || 'description' in value || 'action' in value);
|
|
485
|
+
}
|
|
486
|
+
function DataGridState({ type, title, description, action }) {
|
|
487
|
+
return /*#__PURE__*/ _jsxs(EmptyState, {
|
|
488
|
+
type: type,
|
|
489
|
+
className: "p-10",
|
|
490
|
+
children: [
|
|
491
|
+
/*#__PURE__*/ _jsx(EmptyStateIcon, {}),
|
|
492
|
+
/*#__PURE__*/ _jsx(EmptyStateTitle, {
|
|
493
|
+
as: "p",
|
|
494
|
+
children: title
|
|
495
|
+
}),
|
|
496
|
+
/*#__PURE__*/ _jsx(EmptyStateDescription, {
|
|
497
|
+
children: description
|
|
498
|
+
}),
|
|
499
|
+
action ? /*#__PURE__*/ _jsx(EmptyStateActions, {
|
|
500
|
+
children: action
|
|
501
|
+
}) : null
|
|
502
|
+
]
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
const DataGridFilterTrigger = /*#__PURE__*/ forwardRef(function DataGridFilterTrigger({ activeCount = 0, label = 'Filters', className, children, ...props }, ref) {
|
|
506
|
+
const hasActiveFilters = activeCount > 0;
|
|
507
|
+
return /*#__PURE__*/ _jsx(Button, {
|
|
508
|
+
ref: ref,
|
|
509
|
+
"data-slot": "data-grid-filter-trigger",
|
|
510
|
+
"data-active-count": activeCount,
|
|
511
|
+
size: "default",
|
|
512
|
+
variant: hasActiveFilters ? 'secondary' : 'ghost',
|
|
513
|
+
className: cn('min-w-0', className),
|
|
514
|
+
"aria-label": children != null ? label : undefined,
|
|
515
|
+
...props,
|
|
516
|
+
children: children ?? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
517
|
+
children: [
|
|
518
|
+
/*#__PURE__*/ _jsx(IconFilter, {
|
|
519
|
+
className: "size-4 shrink-0",
|
|
520
|
+
"aria-hidden": "true"
|
|
521
|
+
}),
|
|
522
|
+
/*#__PURE__*/ _jsx("span", {
|
|
523
|
+
children: label
|
|
524
|
+
})
|
|
525
|
+
]
|
|
526
|
+
})
|
|
527
|
+
});
|
|
528
|
+
});
|
|
529
|
+
DataGridFilterTrigger.displayName = 'DataGridFilterTrigger';
|
|
530
|
+
function useDataGridContext() {
|
|
531
|
+
const context = useContext(DataGridContext);
|
|
532
|
+
if (!context) {
|
|
533
|
+
throw new Error('useDataGridContext must be used within a DataGrid');
|
|
534
|
+
}
|
|
535
|
+
return context;
|
|
132
536
|
}
|
|
133
|
-
|
|
134
|
-
export {
|
|
537
|
+
export { DataGrid, DataGridCheckboxCell, DataGridCheckboxHeader, DataGridResultCount, DataGridFilterTrigger, DataGridSearch, useDataGridContext };
|
|
538
|
+
export { DataGridFilterPanel } from "./data-grid-filter-panel.js";
|
|
539
|
+
export { DataGridFooter, DataGridFooterEnd, DataGridFooterStart } from "./data-grid-footer.js";
|
|
540
|
+
export { DataGridHeader, DataGridHeaderActions, DataGridHeaderEnd, DataGridHeaderStart, DataGridSubtitle, DataGridTitle } from "./data-grid-header.js";
|
|
541
|
+
|
|
542
|
+
//# sourceMappingURL=data-grid.js.map
|