@cognite/aura 0.3.4 → 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 +48 -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 +19 -0
- 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 +86 -0
- 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 +118 -0
- 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 +542 -0
- 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 +53 -0
- 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 -0
- package/dist/components/ui/core/data-grid/index.js +6 -0
- 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 +17 -11
- package/dist/components/ui/core/segmented-control/segmented-control.js +204 -108
- 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 +53 -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,18 +1,16 @@
|
|
|
1
|
-
import { ReactElement } from
|
|
2
|
-
import { Row } from
|
|
3
|
-
import { VirtualItem } from
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import { type Row } from "@tanstack/react-table";
|
|
3
|
+
import type { VirtualItem } from "@tanstack/react-virtual";
|
|
4
4
|
type DataGridRowProps<TData> = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
hasExpanding: boolean;
|
|
15
|
-
onRowClick?: (row: Row<TData>) => void;
|
|
5
|
+
row: Row<TData>;
|
|
6
|
+
virtualRow: VirtualItem;
|
|
7
|
+
headerGroupCount: number;
|
|
8
|
+
pinnedColumnIds: Set<string>;
|
|
9
|
+
lastPinnedColumnId: string | undefined;
|
|
10
|
+
maxDepth: number;
|
|
11
|
+
hasExpanding: boolean;
|
|
12
|
+
striped?: boolean;
|
|
13
|
+
onRowClick?: (row: Row<TData>) => void;
|
|
16
14
|
};
|
|
17
|
-
declare function DataGridRow<TData>({ row, virtualRow, headerGroupCount,
|
|
15
|
+
declare function DataGridRow<TData>({ row, virtualRow, headerGroupCount, pinnedColumnIds, lastPinnedColumnId, maxDepth, hasExpanding, striped, onRowClick }: DataGridRowProps<TData>): ReactElement;
|
|
18
16
|
export { DataGridRow, type DataGridRowProps };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconChevronRight } from "@tabler/icons-react";
|
|
3
|
+
import { flexRender } from "@tanstack/react-table";
|
|
4
|
+
import { cn, focusState } from "../../../../lib/utils.js";
|
|
5
|
+
import { Button } from "../button/button.js";
|
|
6
|
+
import { DataGridCell } from "./data-grid-cell.js";
|
|
7
|
+
import { isDataGridRowHighlighted } from "./data-grid-selection-state.js";
|
|
8
|
+
import { PINNED_COLUMN_Z_INDEX, getTextValue, isAccessorColumn, isFromExpandToggleTarget, isFromIgnoredCellTarget } from "./data-grid.utils.js";
|
|
9
|
+
function DataGridRow({ row, virtualRow, headerGroupCount, pinnedColumnIds, lastPinnedColumnId, maxDepth, hasExpanding, striped = false, onRowClick }) {
|
|
10
|
+
const canExpand = row.getCanExpand();
|
|
11
|
+
const isRowInteractive = onRowClick !== undefined;
|
|
12
|
+
const isHighlighted = isDataGridRowHighlighted(row);
|
|
13
|
+
// Rows are virtualized and absolutely positioned, so DOM order doesn't match
|
|
14
|
+
// table order and `even:` selectors can't be used; stripe by the row's index instead.
|
|
15
|
+
const isStripedRow = striped && virtualRow.index % 2 === 1;
|
|
16
|
+
// A hover shade on read-only striped rows reads as another stripe, so only clickable rows get one.
|
|
17
|
+
const showHover = !striped || isRowInteractive;
|
|
18
|
+
const handleRowActivation = isRowInteractive ? (triggerTarget)=>{
|
|
19
|
+
if (isFromIgnoredCellTarget(triggerTarget)) return;
|
|
20
|
+
if (isFromExpandToggleTarget(triggerTarget)) return;
|
|
21
|
+
onRowClick?.(row);
|
|
22
|
+
} : undefined;
|
|
23
|
+
const visibleCells = row.getVisibleCells();
|
|
24
|
+
const resolvedTreeColumnIndex = visibleCells.findIndex((cell)=>isAccessorColumn(cell.column.columnDef));
|
|
25
|
+
const treeColumnIndex = resolvedTreeColumnIndex >= 0 ? resolvedTreeColumnIndex : 0;
|
|
26
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
27
|
+
"data-slot": "data-grid-row",
|
|
28
|
+
role: "row",
|
|
29
|
+
"aria-rowindex": virtualRow.index + 1 + headerGroupCount,
|
|
30
|
+
"aria-expanded": canExpand ? row.getIsExpanded() : undefined,
|
|
31
|
+
"aria-selected": row.getIsSelected() ? true : undefined,
|
|
32
|
+
className: cn('group absolute left-0 right-0 grid border-b bg-base-background transition-colors', isStripedRow && 'bg-muted-background', isHighlighted && 'bg-medium-background', showHover && (isHighlighted ? 'hover:bg-medium-background-hover' : 'hover:bg-active-muted-background'), isRowInteractive && cn('cursor-pointer focus-visible:bg-active-muted-background', focusState)),
|
|
33
|
+
style: {
|
|
34
|
+
gridTemplateColumns: 'var(--data-grid-template-columns)',
|
|
35
|
+
height: virtualRow.size,
|
|
36
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
37
|
+
},
|
|
38
|
+
tabIndex: isRowInteractive ? 0 : undefined,
|
|
39
|
+
onClick: handleRowActivation ? (event)=>handleRowActivation(event.target) : undefined,
|
|
40
|
+
onKeyDown: handleRowActivation ? (event)=>{
|
|
41
|
+
if (event.key !== 'Enter' && event.key !== ' ') return;
|
|
42
|
+
if (isFromIgnoredCellTarget(event.target)) return;
|
|
43
|
+
if (isFromExpandToggleTarget(event.target)) return;
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
handleRowActivation(event.target);
|
|
46
|
+
} : undefined,
|
|
47
|
+
children: visibleCells.map((cell, cellIndex)=>{
|
|
48
|
+
const isPinned = pinnedColumnIds.has(cell.column.id);
|
|
49
|
+
const isLastPinned = isPinned && lastPinnedColumnId === cell.column.id;
|
|
50
|
+
const cellContext = cell.getContext();
|
|
51
|
+
const cellRenderer = cell.column.columnDef.cell;
|
|
52
|
+
let renderedCell;
|
|
53
|
+
let cellTitle;
|
|
54
|
+
if (typeof cellRenderer === 'function') {
|
|
55
|
+
const cellContent = cellRenderer(cellContext);
|
|
56
|
+
cellTitle = getTextValue(cellContent);
|
|
57
|
+
renderedCell = cellContent;
|
|
58
|
+
} else {
|
|
59
|
+
renderedCell = flexRender(cellRenderer, cellContext);
|
|
60
|
+
cellTitle = getTextValue(renderedCell);
|
|
61
|
+
}
|
|
62
|
+
const isTreeColumn = cellIndex === treeColumnIndex;
|
|
63
|
+
const depth = Math.min(row.depth, maxDepth);
|
|
64
|
+
const indentPx = isTreeColumn && depth > 0 ? depth * 16 : 0;
|
|
65
|
+
const showChevron = isTreeColumn && canExpand;
|
|
66
|
+
const showChevronSpacer = isTreeColumn && hasExpanding && !canExpand && depth > 0;
|
|
67
|
+
const pinnedStyle = isPinned ? {
|
|
68
|
+
position: 'sticky',
|
|
69
|
+
left: cell.column.getStart('left'),
|
|
70
|
+
zIndex: PINNED_COLUMN_Z_INDEX
|
|
71
|
+
} : undefined;
|
|
72
|
+
const cellStyle = indentPx > 0 || pinnedStyle ? {
|
|
73
|
+
...pinnedStyle,
|
|
74
|
+
...indentPx > 0 ? {
|
|
75
|
+
paddingInlineStart: `${indentPx + 12}px`
|
|
76
|
+
} : {}
|
|
77
|
+
} : undefined;
|
|
78
|
+
return /*#__PURE__*/ _jsxs(DataGridCell, {
|
|
79
|
+
"data-row-activation": isAccessorColumn(cell.column.columnDef) ? undefined : 'ignore',
|
|
80
|
+
isPinned: isPinned,
|
|
81
|
+
isLastPinned: isLastPinned,
|
|
82
|
+
colIndex: cellIndex + 1,
|
|
83
|
+
style: cellStyle,
|
|
84
|
+
children: [
|
|
85
|
+
showChevron && /*#__PURE__*/ _jsx(Button, {
|
|
86
|
+
size: "icon-sm",
|
|
87
|
+
variant: "ghost",
|
|
88
|
+
className: "mr-2",
|
|
89
|
+
"data-row-expand-toggle": "true",
|
|
90
|
+
onClick: (event)=>{
|
|
91
|
+
event.stopPropagation();
|
|
92
|
+
row.toggleExpanded();
|
|
93
|
+
},
|
|
94
|
+
"aria-label": row.getIsExpanded() ? 'Collapse row' : 'Expand row',
|
|
95
|
+
children: /*#__PURE__*/ _jsx(IconChevronRight, {
|
|
96
|
+
width: 5,
|
|
97
|
+
height: 8,
|
|
98
|
+
className: cn(row.getIsExpanded() && 'rotate-90'),
|
|
99
|
+
"aria-hidden": "true"
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
showChevronSpacer && /*#__PURE__*/ _jsx("span", {
|
|
103
|
+
className: "mr-2 inline-block h-7 w-7 shrink-0",
|
|
104
|
+
"aria-hidden": "true"
|
|
105
|
+
}),
|
|
106
|
+
/*#__PURE__*/ _jsx("span", {
|
|
107
|
+
className: "block min-w-0 flex-1 not-has-[*]:truncate",
|
|
108
|
+
title: cellTitle,
|
|
109
|
+
children: renderedCell
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
}, cell.id);
|
|
113
|
+
})
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export { DataGridRow };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=data-grid-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid-row.tsx"],"sourcesContent":["import type {\n CSSProperties,\n KeyboardEvent,\n MouseEvent,\n ReactElement,\n ReactNode,\n} from 'react';\n\nimport { IconChevronRight } from '@tabler/icons-react';\nimport { type Cell, type Row, flexRender } from '@tanstack/react-table';\nimport type { VirtualItem } from '@tanstack/react-virtual';\n\nimport { cn, focusState } from '../../../../lib/utils';\nimport { Button } from '../button/button';\n\nimport { DataGridCell } from './data-grid-cell';\nimport { isDataGridRowHighlighted } from './data-grid-selection-state';\nimport {\n PINNED_COLUMN_Z_INDEX,\n getTextValue,\n isAccessorColumn,\n isFromExpandToggleTarget,\n isFromIgnoredCellTarget,\n} from './data-grid.utils';\n\ntype DataGridRowProps<TData> = {\n row: Row<TData>;\n virtualRow: VirtualItem;\n headerGroupCount: number;\n pinnedColumnIds: Set<string>;\n lastPinnedColumnId: string | undefined;\n maxDepth: number;\n hasExpanding: boolean;\n striped?: boolean;\n onRowClick?: (row: Row<TData>) => void;\n};\n\nfunction DataGridRow<TData>({\n row,\n virtualRow,\n headerGroupCount,\n pinnedColumnIds,\n lastPinnedColumnId,\n maxDepth,\n hasExpanding,\n striped = false,\n onRowClick,\n}: DataGridRowProps<TData>): ReactElement {\n const canExpand = row.getCanExpand();\n const isRowInteractive = onRowClick !== undefined;\n const isHighlighted = isDataGridRowHighlighted(row);\n // Rows are virtualized and absolutely positioned, so DOM order doesn't match\n // table order and `even:` selectors can't be used; stripe by the row's index instead.\n const isStripedRow = striped && virtualRow.index % 2 === 1;\n // A hover shade on read-only striped rows reads as another stripe, so only clickable rows get one.\n const showHover = !striped || isRowInteractive;\n\n const handleRowActivation = isRowInteractive\n ? (triggerTarget?: EventTarget | null) => {\n if (isFromIgnoredCellTarget(triggerTarget)) return;\n if (isFromExpandToggleTarget(triggerTarget)) return;\n onRowClick?.(row);\n }\n : undefined;\n\n const visibleCells = row.getVisibleCells();\n const resolvedTreeColumnIndex = visibleCells.findIndex((cell) =>\n isAccessorColumn(cell.column.columnDef)\n );\n const treeColumnIndex =\n resolvedTreeColumnIndex >= 0 ? resolvedTreeColumnIndex : 0;\n\n return (\n <div\n data-slot=\"data-grid-row\"\n role=\"row\"\n aria-rowindex={virtualRow.index + 1 + headerGroupCount}\n aria-expanded={canExpand ? row.getIsExpanded() : undefined}\n aria-selected={row.getIsSelected() ? true : undefined}\n className={cn(\n 'group absolute left-0 right-0 grid border-b bg-base-background transition-colors',\n isStripedRow && 'bg-muted-background',\n isHighlighted && 'bg-medium-background',\n showHover &&\n (isHighlighted\n ? 'hover:bg-medium-background-hover'\n : 'hover:bg-active-muted-background'),\n isRowInteractive &&\n cn(\n 'cursor-pointer focus-visible:bg-active-muted-background',\n focusState\n )\n )}\n style={{\n gridTemplateColumns: 'var(--data-grid-template-columns)',\n height: virtualRow.size,\n transform: `translateY(${virtualRow.start}px)`,\n }}\n tabIndex={isRowInteractive ? 0 : undefined}\n onClick={\n handleRowActivation\n ? (event: MouseEvent<HTMLDivElement>) =>\n handleRowActivation(event.target)\n : undefined\n }\n onKeyDown={\n handleRowActivation\n ? (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n if (isFromIgnoredCellTarget(event.target)) return;\n if (isFromExpandToggleTarget(event.target)) return;\n event.preventDefault();\n handleRowActivation(event.target);\n }\n : undefined\n }\n >\n {visibleCells.map((cell: Cell<TData, unknown>, cellIndex: number) => {\n const isPinned = pinnedColumnIds.has(cell.column.id);\n const isLastPinned = isPinned && lastPinnedColumnId === cell.column.id;\n const cellContext = cell.getContext();\n const cellRenderer = cell.column.columnDef.cell;\n let renderedCell: ReactNode;\n let cellTitle: string | undefined;\n\n if (typeof cellRenderer === 'function') {\n const cellContent = cellRenderer(cellContext);\n cellTitle = getTextValue(cellContent);\n renderedCell = cellContent;\n } else {\n renderedCell = flexRender(cellRenderer, cellContext);\n cellTitle = getTextValue(renderedCell);\n }\n\n const isTreeColumn = cellIndex === treeColumnIndex;\n const depth = Math.min(row.depth, maxDepth);\n const indentPx = isTreeColumn && depth > 0 ? depth * 16 : 0;\n const showChevron = isTreeColumn && canExpand;\n const showChevronSpacer =\n isTreeColumn && hasExpanding && !canExpand && depth > 0;\n\n const pinnedStyle: CSSProperties | undefined = isPinned\n ? {\n position: 'sticky',\n left: cell.column.getStart('left'),\n zIndex: PINNED_COLUMN_Z_INDEX,\n }\n : undefined;\n\n const cellStyle: CSSProperties | undefined =\n indentPx > 0 || pinnedStyle\n ? {\n ...pinnedStyle,\n ...(indentPx > 0\n ? { paddingInlineStart: `${indentPx + 12}px` }\n : {}),\n }\n : undefined;\n\n return (\n <DataGridCell\n key={cell.id}\n data-row-activation={\n isAccessorColumn(cell.column.columnDef) ? undefined : 'ignore'\n }\n isPinned={isPinned}\n isLastPinned={isLastPinned}\n colIndex={cellIndex + 1}\n style={cellStyle}\n >\n {showChevron && (\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n className=\"mr-2\"\n data-row-expand-toggle=\"true\"\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n row.toggleExpanded();\n }}\n aria-label={row.getIsExpanded() ? 'Collapse row' : 'Expand row'}\n >\n <IconChevronRight\n width={5}\n height={8}\n className={cn(row.getIsExpanded() && 'rotate-90')}\n aria-hidden=\"true\"\n />\n </Button>\n )}\n {showChevronSpacer && (\n <span\n className=\"mr-2 inline-block h-7 w-7 shrink-0\"\n aria-hidden=\"true\"\n />\n )}\n <span\n className=\"block min-w-0 flex-1 not-has-[*]:truncate\"\n title={cellTitle}\n >\n {renderedCell}\n </span>\n </DataGridCell>\n );\n })}\n </div>\n );\n}\n\nexport { DataGridRow, type DataGridRowProps };\n"],"names":["IconChevronRight","flexRender","cn","focusState","Button","DataGridCell","isDataGridRowHighlighted","PINNED_COLUMN_Z_INDEX","getTextValue","isAccessorColumn","isFromExpandToggleTarget","isFromIgnoredCellTarget","DataGridRow","row","virtualRow","headerGroupCount","pinnedColumnIds","lastPinnedColumnId","maxDepth","hasExpanding","striped","onRowClick","canExpand","getCanExpand","isRowInteractive","undefined","isHighlighted","isStripedRow","index","showHover","handleRowActivation","triggerTarget","visibleCells","getVisibleCells","resolvedTreeColumnIndex","findIndex","cell","column","columnDef","treeColumnIndex","div","data-slot","role","aria-rowindex","aria-expanded","getIsExpanded","aria-selected","getIsSelected","className","style","gridTemplateColumns","height","size","transform","start","tabIndex","onClick","event","target","onKeyDown","key","preventDefault","map","cellIndex","isPinned","has","id","isLastPinned","cellContext","getContext","cellRenderer","renderedCell","cellTitle","cellContent","isTreeColumn","depth","Math","min","indentPx","showChevron","showChevronSpacer","pinnedStyle","position","left","getStart","zIndex","cellStyle","paddingInlineStart","data-row-activation","colIndex","variant","data-row-expand-toggle","stopPropagation","toggleExpanded","aria-label","width","aria-hidden","span","title"],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Row, RowSelectionState } from "@tanstack/react-table";
|
|
2
|
+
type DataGridCheckboxState = boolean | "indeterminate";
|
|
3
|
+
type DataGridSelectionRow<TData> = Pick<Row<TData>, "getIsSelected" | "getIsSomeSelected" | "getIsAllSubRowsSelected"> & {
|
|
4
|
+
subRows: Pick<Row<TData>["subRows"], "length">;
|
|
5
|
+
};
|
|
6
|
+
declare function getDataGridCheckboxState<TData>(row: DataGridSelectionRow<TData>): DataGridCheckboxState;
|
|
7
|
+
declare function isDataGridRowHighlighted<TData>(row: DataGridSelectionRow<TData>): boolean;
|
|
8
|
+
type DataGridToggleableRow = {
|
|
9
|
+
getIsSelected: () => boolean;
|
|
10
|
+
toggleSelected: (value?: boolean) => void;
|
|
11
|
+
subRows: readonly DataGridToggleableRow[];
|
|
12
|
+
};
|
|
13
|
+
declare function selectDataGridRowTree(row: DataGridToggleableRow): void;
|
|
14
|
+
declare function countSelectedRowIds(rowSelection: RowSelectionState): number;
|
|
15
|
+
export { countSelectedRowIds, getDataGridCheckboxState, isDataGridRowHighlighted, selectDataGridRowTree, type DataGridCheckboxState, type DataGridSelectionRow };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function getDataGridCheckboxState(row) {
|
|
2
|
+
if (row.subRows.length === 0) {
|
|
3
|
+
return row.getIsSelected();
|
|
4
|
+
}
|
|
5
|
+
if (row.getIsAllSubRowsSelected()) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
if (row.getIsSomeSelected()) {
|
|
9
|
+
return 'indeterminate';
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
function isDataGridRowHighlighted(row) {
|
|
14
|
+
return row.getIsSelected() || row.getIsSomeSelected();
|
|
15
|
+
}
|
|
16
|
+
// TanStack ignores toggleSelected(true) when the row id is already selected.
|
|
17
|
+
// A partial parent is in that state, so its missing descendants must be selected directly.
|
|
18
|
+
function selectDataGridRowTree(row) {
|
|
19
|
+
if (!row.getIsSelected()) {
|
|
20
|
+
row.toggleSelected(true);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
for (const subRow of row.subRows){
|
|
24
|
+
selectDataGridRowTree(subRow);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function countSelectedRowIds(rowSelection) {
|
|
28
|
+
return Object.values(rowSelection).filter(Boolean).length;
|
|
29
|
+
}
|
|
30
|
+
export { countSelectedRowIds, getDataGridCheckboxState, isDataGridRowHighlighted, selectDataGridRowTree };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=data-grid-selection-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid-selection-state.ts"],"sourcesContent":["import type { Row, RowSelectionState } from '@tanstack/react-table';\n\ntype DataGridCheckboxState = boolean | 'indeterminate';\n\n// This is the slice of `Row<TData>` that selection reads.\ntype DataGridSelectionRow<TData> = Pick<\n Row<TData>,\n 'getIsSelected' | 'getIsSomeSelected' | 'getIsAllSubRowsSelected'\n> & {\n subRows: Pick<Row<TData>['subRows'], 'length'>;\n};\n\nfunction getDataGridCheckboxState<TData>(\n row: DataGridSelectionRow<TData>\n): DataGridCheckboxState {\n if (row.subRows.length === 0) {\n return row.getIsSelected();\n }\n\n if (row.getIsAllSubRowsSelected()) {\n return true;\n }\n\n if (row.getIsSomeSelected()) {\n return 'indeterminate';\n }\n\n return false;\n}\n\nfunction isDataGridRowHighlighted<TData>(\n row: DataGridSelectionRow<TData>\n): boolean {\n return row.getIsSelected() || row.getIsSomeSelected();\n}\n\ntype DataGridToggleableRow = {\n getIsSelected: () => boolean;\n toggleSelected: (value?: boolean) => void;\n subRows: readonly DataGridToggleableRow[];\n};\n\n// TanStack ignores toggleSelected(true) when the row id is already selected.\n// A partial parent is in that state, so its missing descendants must be selected directly.\nfunction selectDataGridRowTree(row: DataGridToggleableRow): void {\n if (!row.getIsSelected()) {\n row.toggleSelected(true);\n return;\n }\n\n for (const subRow of row.subRows) {\n selectDataGridRowTree(subRow);\n }\n}\n\nfunction countSelectedRowIds(rowSelection: RowSelectionState): number {\n return Object.values(rowSelection).filter(Boolean).length;\n}\n\nexport {\n countSelectedRowIds,\n getDataGridCheckboxState,\n isDataGridRowHighlighted,\n selectDataGridRowTree,\n type DataGridCheckboxState,\n type DataGridSelectionRow,\n};\n"],"names":["getDataGridCheckboxState","row","subRows","length","getIsSelected","getIsAllSubRowsSelected","getIsSomeSelected","isDataGridRowHighlighted","selectDataGridRowTree","toggleSelected","subRow","countSelectedRowIds","rowSelection","Object","values","filter","Boolean"],"mappings":"AAYA,SAASA,yBACPC,GAAgC;IAEhC,IAAIA,IAAIC,OAAO,CAACC,MAAM,KAAK,GAAG;QAC5B,OAAOF,IAAIG,aAAa;IAC1B;IAEA,IAAIH,IAAII,uBAAuB,IAAI;QACjC,OAAO;IACT;IAEA,IAAIJ,IAAIK,iBAAiB,IAAI;QAC3B,OAAO;IACT;IAEA,OAAO;AACT;AAEA,SAASC,yBACPN,GAAgC;IAEhC,OAAOA,IAAIG,aAAa,MAAMH,IAAIK,iBAAiB;AACrD;AAQA,6EAA6E;AAC7E,2FAA2F;AAC3F,SAASE,sBAAsBP,GAA0B;IACvD,IAAI,CAACA,IAAIG,aAAa,IAAI;QACxBH,IAAIQ,cAAc,CAAC;QACnB;IACF;IAEA,KAAK,MAAMC,UAAUT,IAAIC,OAAO,CAAE;QAChCM,sBAAsBE;IACxB;AACF;AAEA,SAASC,oBAAoBC,YAA+B;IAC1D,OAAOC,OAAOC,MAAM,CAACF,cAAcG,MAAM,CAACC,SAASb,MAAM;AAC3D;AAEA,SACEQ,mBAAmB,EACnBX,wBAAwB,EACxBO,wBAAwB,EACxBC,qBAAqB,GAGrB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import type { RowSelectionState } from "@tanstack/react-table";
|
|
3
|
+
import type { DataGridSelectionActions } from "./data-grid-selection.types";
|
|
4
|
+
type DataGridSelectionToolbarProps = {
|
|
5
|
+
selectedCount: number;
|
|
6
|
+
rowSelection: RowSelectionState;
|
|
7
|
+
selectionActions?: DataGridSelectionActions;
|
|
8
|
+
onClear: () => void;
|
|
9
|
+
};
|
|
10
|
+
declare function DataGridSelectionToolbar({ selectedCount, rowSelection, selectionActions, onClear }: DataGridSelectionToolbarProps): ReactElement;
|
|
11
|
+
export { DataGridSelectionToolbar };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { IconDotsVertical } from "@tabler/icons-react";
|
|
4
|
+
import { ActionToolbar, ActionToolbarAction, ActionToolbarActionClear, ActionToolbarActions, ActionToolbarPrimaryAction, ActionToolbarSelection, ActionToolbarSelectionSummary } from "../action-toolbar/action-toolbar.js";
|
|
5
|
+
import { Button } from "../button/button.js";
|
|
6
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../dropdown-menu/dropdown-menu.js";
|
|
7
|
+
const MAX_SECONDARY_ACTIONS = 5;
|
|
8
|
+
function DataGridSelectionToolbar({ selectedCount, rowSelection, selectionActions, onClear }) {
|
|
9
|
+
const primaryAction = selectionActions?.primaryAction;
|
|
10
|
+
const requestedSecondaryActions = selectionActions?.secondaryActions ?? [];
|
|
11
|
+
const secondaryActions = limitSecondaryActions(requestedSecondaryActions);
|
|
12
|
+
const menuActions = selectionActions?.menuActions ?? [];
|
|
13
|
+
const secondaryActionCount = requestedSecondaryActions.length;
|
|
14
|
+
useEffect(()=>{
|
|
15
|
+
if (secondaryActionCount <= MAX_SECONDARY_ACTIONS) return;
|
|
16
|
+
console.warn(`[Aura DataGrid] The selection toolbar shows at most ${MAX_SECONDARY_ACTIONS} secondary actions. ` + 'Move the rest to menuActions.');
|
|
17
|
+
}, [
|
|
18
|
+
secondaryActionCount
|
|
19
|
+
]);
|
|
20
|
+
return(// z-[20]: cogs defines `.z-20` as box-shadow; EOS loads it and would shadow the toolbar.
|
|
21
|
+
/*#__PURE__*/ _jsx("div", {
|
|
22
|
+
className: "pointer-events-none sticky bottom-4 z-[20] flex justify-center px-4",
|
|
23
|
+
children: /*#__PURE__*/ _jsxs(ActionToolbar, {
|
|
24
|
+
selectedCount: selectedCount,
|
|
25
|
+
width: "full",
|
|
26
|
+
"aria-label": "Selection actions",
|
|
27
|
+
className: "pointer-events-auto",
|
|
28
|
+
children: [
|
|
29
|
+
/*#__PURE__*/ _jsxs(ActionToolbarSelection, {
|
|
30
|
+
"aria-label": "Selected rows",
|
|
31
|
+
children: [
|
|
32
|
+
/*#__PURE__*/ _jsx(ActionToolbarSelectionSummary, {}),
|
|
33
|
+
/*#__PURE__*/ _jsx(ActionToolbarActionClear, {
|
|
34
|
+
onClick: onClear
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
}),
|
|
38
|
+
/*#__PURE__*/ _jsxs(ActionToolbarActions, {
|
|
39
|
+
"aria-label": "Actions",
|
|
40
|
+
children: [
|
|
41
|
+
menuActions.length > 0 ? /*#__PURE__*/ _jsx(DataGridSelectionMenu, {
|
|
42
|
+
actions: menuActions,
|
|
43
|
+
rowSelection: rowSelection
|
|
44
|
+
}) : null,
|
|
45
|
+
secondaryActions.map((action)=>/*#__PURE__*/ _jsx(DataGridSecondaryToolbarAction, {
|
|
46
|
+
action: action,
|
|
47
|
+
rowSelection: rowSelection
|
|
48
|
+
}, actionListKey(secondaryActions, action))),
|
|
49
|
+
primaryAction ? /*#__PURE__*/ _jsxs(ActionToolbarPrimaryAction, {
|
|
50
|
+
onClick: ()=>primaryAction.onClick(rowSelection),
|
|
51
|
+
children: [
|
|
52
|
+
primaryAction.icon ? /*#__PURE__*/ _jsx("span", {
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
children: primaryAction.icon
|
|
55
|
+
}) : null,
|
|
56
|
+
primaryAction.label
|
|
57
|
+
]
|
|
58
|
+
}) : null
|
|
59
|
+
]
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
})
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
function DataGridSecondaryToolbarAction({ action, rowSelection }) {
|
|
66
|
+
if (action.label != null) {
|
|
67
|
+
return /*#__PURE__*/ _jsxs(ActionToolbarAction, {
|
|
68
|
+
onClick: ()=>action.onClick(rowSelection),
|
|
69
|
+
children: [
|
|
70
|
+
action.icon ? /*#__PURE__*/ _jsx("span", {
|
|
71
|
+
"aria-hidden": "true",
|
|
72
|
+
children: action.icon
|
|
73
|
+
}) : null,
|
|
74
|
+
action.label
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return /*#__PURE__*/ _jsx(ActionToolbarAction, {
|
|
79
|
+
iconOnly: true,
|
|
80
|
+
"aria-label": action['aria-label'],
|
|
81
|
+
onClick: ()=>action.onClick(rowSelection),
|
|
82
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
83
|
+
"aria-hidden": "true",
|
|
84
|
+
children: action.icon
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function DataGridSelectionMenu({ actions, rowSelection }) {
|
|
89
|
+
return /*#__PURE__*/ _jsxs(DropdownMenu, {
|
|
90
|
+
children: [
|
|
91
|
+
/*#__PURE__*/ _jsx(DropdownMenuTrigger, {
|
|
92
|
+
render: /*#__PURE__*/ _jsx(Button, {
|
|
93
|
+
variant: "ghostOnDark",
|
|
94
|
+
size: "icon",
|
|
95
|
+
"aria-label": "More actions",
|
|
96
|
+
children: /*#__PURE__*/ _jsx(IconDotsVertical, {
|
|
97
|
+
"aria-hidden": "true"
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
}),
|
|
101
|
+
/*#__PURE__*/ _jsx(DropdownMenuContent, {
|
|
102
|
+
side: "top",
|
|
103
|
+
align: "end",
|
|
104
|
+
children: actions.map((action)=>/*#__PURE__*/ _jsxs(DropdownMenuItem, {
|
|
105
|
+
onClick: ()=>action.onClick(rowSelection),
|
|
106
|
+
children: [
|
|
107
|
+
action.icon ? /*#__PURE__*/ _jsx("span", {
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
children: action.icon
|
|
110
|
+
}) : null,
|
|
111
|
+
action.label
|
|
112
|
+
]
|
|
113
|
+
}, actionListKey(actions, action)))
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function actionListKey(actions, action) {
|
|
119
|
+
const name = action.label ?? action['aria-label'] ?? '';
|
|
120
|
+
const earlierDuplicates = actions.slice(0, actions.indexOf(action)).filter((candidate)=>(candidate.label ?? candidate['aria-label']) === name).length;
|
|
121
|
+
if (earlierDuplicates === 0) return name;
|
|
122
|
+
return `${name}-${earlierDuplicates + 1}`;
|
|
123
|
+
}
|
|
124
|
+
function limitSecondaryActions(actions) {
|
|
125
|
+
return actions.slice(0, MAX_SECONDARY_ACTIONS);
|
|
126
|
+
}
|
|
127
|
+
export { DataGridSelectionToolbar };
|
|
128
|
+
|
|
129
|
+
//# sourceMappingURL=data-grid-selection-toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid-selection-toolbar.tsx"],"sourcesContent":["import { useEffect, type ReactElement } from 'react';\n\nimport { IconDotsVertical } from '@tabler/icons-react';\nimport type { RowSelectionState } from '@tanstack/react-table';\n\nimport {\n ActionToolbar,\n ActionToolbarAction,\n ActionToolbarActionClear,\n ActionToolbarActions,\n ActionToolbarPrimaryAction,\n ActionToolbarSelection,\n ActionToolbarSelectionSummary,\n} from '../action-toolbar/action-toolbar';\nimport { Button } from '../button/button';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '../dropdown-menu/dropdown-menu';\n\nimport type {\n DataGridSecondaryAction,\n DataGridSelectionAction,\n DataGridSelectionActions,\n} from './data-grid-selection.types';\n\ntype DataGridSelectionToolbarProps = {\n selectedCount: number;\n rowSelection: RowSelectionState;\n selectionActions?: DataGridSelectionActions;\n onClear: () => void;\n};\n\nconst MAX_SECONDARY_ACTIONS = 5;\n\nfunction DataGridSelectionToolbar({\n selectedCount,\n rowSelection,\n selectionActions,\n onClear,\n}: DataGridSelectionToolbarProps): ReactElement {\n const primaryAction = selectionActions?.primaryAction;\n const requestedSecondaryActions = selectionActions?.secondaryActions ?? [];\n const secondaryActions = limitSecondaryActions(requestedSecondaryActions);\n const menuActions = selectionActions?.menuActions ?? [];\n\n const secondaryActionCount = requestedSecondaryActions.length;\n\n useEffect(() => {\n if (secondaryActionCount <= MAX_SECONDARY_ACTIONS) return;\n console.warn(\n `[Aura DataGrid] The selection toolbar shows at most ${MAX_SECONDARY_ACTIONS} secondary actions. ` +\n 'Move the rest to menuActions.'\n );\n }, [secondaryActionCount]);\n\n return (\n // z-[20]: cogs defines `.z-20` as box-shadow; EOS loads it and would shadow the toolbar.\n <div className=\"pointer-events-none sticky bottom-4 z-[20] flex justify-center px-4\">\n <ActionToolbar\n selectedCount={selectedCount}\n width=\"full\"\n aria-label=\"Selection actions\"\n className=\"pointer-events-auto\"\n >\n <ActionToolbarSelection aria-label=\"Selected rows\">\n <ActionToolbarSelectionSummary />\n <ActionToolbarActionClear onClick={onClear} />\n </ActionToolbarSelection>\n <ActionToolbarActions aria-label=\"Actions\">\n {menuActions.length > 0 ? (\n <DataGridSelectionMenu\n actions={menuActions}\n rowSelection={rowSelection}\n />\n ) : null}\n {secondaryActions.map((action: DataGridSecondaryAction) => (\n <DataGridSecondaryToolbarAction\n key={actionListKey(secondaryActions, action)}\n action={action}\n rowSelection={rowSelection}\n />\n ))}\n {primaryAction ? (\n <ActionToolbarPrimaryAction\n onClick={() => primaryAction.onClick(rowSelection)}\n >\n {primaryAction.icon ? (\n <span aria-hidden=\"true\">{primaryAction.icon}</span>\n ) : null}\n {primaryAction.label}\n </ActionToolbarPrimaryAction>\n ) : null}\n </ActionToolbarActions>\n </ActionToolbar>\n </div>\n );\n}\n\nfunction DataGridSecondaryToolbarAction({\n action,\n rowSelection,\n}: {\n action: DataGridSecondaryAction;\n rowSelection: RowSelectionState;\n}): ReactElement {\n if (action.label != null) {\n return (\n <ActionToolbarAction onClick={() => action.onClick(rowSelection)}>\n {action.icon ? <span aria-hidden=\"true\">{action.icon}</span> : null}\n {action.label}\n </ActionToolbarAction>\n );\n }\n\n return (\n <ActionToolbarAction\n iconOnly\n aria-label={action['aria-label']}\n onClick={() => action.onClick(rowSelection)}\n >\n <span aria-hidden=\"true\">{action.icon}</span>\n </ActionToolbarAction>\n );\n}\n\nfunction DataGridSelectionMenu({\n actions,\n rowSelection,\n}: {\n actions: readonly DataGridSelectionAction[];\n rowSelection: RowSelectionState;\n}): ReactElement {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n <Button variant=\"ghostOnDark\" size=\"icon\" aria-label=\"More actions\">\n <IconDotsVertical aria-hidden=\"true\" />\n </Button>\n }\n />\n <DropdownMenuContent side=\"top\" align=\"end\">\n {actions.map((action: DataGridSelectionAction) => (\n <DropdownMenuItem\n key={actionListKey(actions, action)}\n onClick={() => action.onClick(rowSelection)}\n >\n {action.icon ? <span aria-hidden=\"true\">{action.icon}</span> : null}\n {action.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\nfunction actionListKey<T extends { label?: string; 'aria-label'?: string }>(\n actions: readonly T[],\n action: T\n): string {\n const name = action.label ?? action['aria-label'] ?? '';\n const earlierDuplicates = actions\n .slice(0, actions.indexOf(action))\n .filter(\n (candidate) => (candidate.label ?? candidate['aria-label']) === name\n ).length;\n if (earlierDuplicates === 0) return name;\n return `${name}-${earlierDuplicates + 1}`;\n}\n\nfunction limitSecondaryActions(\n actions: readonly DataGridSecondaryAction[]\n): readonly DataGridSecondaryAction[] {\n return actions.slice(0, MAX_SECONDARY_ACTIONS);\n}\n\nexport { DataGridSelectionToolbar };\n"],"names":["useEffect","IconDotsVertical","ActionToolbar","ActionToolbarAction","ActionToolbarActionClear","ActionToolbarActions","ActionToolbarPrimaryAction","ActionToolbarSelection","ActionToolbarSelectionSummary","Button","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuTrigger","MAX_SECONDARY_ACTIONS","DataGridSelectionToolbar","selectedCount","rowSelection","selectionActions","onClear","primaryAction","requestedSecondaryActions","secondaryActions","limitSecondaryActions","menuActions","secondaryActionCount","length","console","warn","div","className","width","aria-label","onClick","DataGridSelectionMenu","actions","map","action","DataGridSecondaryToolbarAction","actionListKey","icon","span","aria-hidden","label","iconOnly","render","variant","size","side","align","name","earlierDuplicates","slice","indexOf","filter","candidate"],"mappings":"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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { RowSelectionState } from "@tanstack/react-table";
|
|
3
|
+
type DataGridSelectionActionClick = (rowSelection: RowSelectionState) => void;
|
|
4
|
+
type DataGridSelectionAction = {
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
onClick: DataGridSelectionActionClick;
|
|
8
|
+
};
|
|
9
|
+
type DataGridSecondaryAction = {
|
|
10
|
+
onClick: DataGridSelectionActionClick;
|
|
11
|
+
} & ({
|
|
12
|
+
label: string;
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
} | {
|
|
15
|
+
icon: ReactNode;
|
|
16
|
+
label?: undefined;
|
|
17
|
+
"aria-label": string;
|
|
18
|
+
});
|
|
19
|
+
type DataGridSelectionActions = {
|
|
20
|
+
primaryAction?: DataGridSelectionAction;
|
|
21
|
+
secondaryActions?: readonly DataGridSecondaryAction[];
|
|
22
|
+
menuActions?: readonly DataGridSelectionAction[];
|
|
23
|
+
};
|
|
24
|
+
export type { DataGridSecondaryAction, DataGridSelectionAction, DataGridSelectionActions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid-selection.types.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { RowSelectionState } from '@tanstack/react-table';\n\n// The grid passes the current selection.\ntype DataGridSelectionActionClick = (rowSelection: RowSelectionState) => void;\n\ntype DataGridSelectionAction = {\n label: string;\n icon?: ReactNode;\n onClick: DataGridSelectionActionClick;\n};\n\ntype DataGridSecondaryAction = {\n onClick: DataGridSelectionActionClick;\n} & (\n | { label: string; icon?: ReactNode }\n | { icon: ReactNode; label?: undefined; 'aria-label': string }\n);\n\ntype DataGridSelectionActions = {\n primaryAction?: DataGridSelectionAction;\n secondaryActions?: readonly DataGridSecondaryAction[];\n menuActions?: readonly DataGridSelectionAction[];\n};\n\nexport type {\n DataGridSecondaryAction,\n DataGridSelectionAction,\n DataGridSelectionActions,\n};\n"],"names":[],"mappings":"AA0BA,WAIE"}
|
|
@@ -1,43 +1,133 @@
|
|
|
1
|
-
import { ReactElement, ReactNode, RefObject } from
|
|
2
|
-
import { ColumnDef, ExpandedState, FilterFnOption, Row, SortingState } from
|
|
3
|
-
|
|
1
|
+
import { type ComponentProps, type ComponentRef, type ForwardRefExoticComponent, type ReactElement, type ReactNode, type RefAttributes, type RefObject } from "react";
|
|
2
|
+
import { type ColumnDef, type ColumnFiltersState, type ColumnSizingState, type ExpandedState, type FilterFnOption, type PaginationState, type Row, type RowSelectionState, type Table, type SortingState } from "@tanstack/react-table";
|
|
3
|
+
import { Button } from "../button/button";
|
|
4
|
+
import { Search } from "../search/search";
|
|
5
|
+
import type { DataGridSelectionActions } from "./data-grid-selection.types";
|
|
6
|
+
type DataGridContextValue = {
|
|
7
|
+
searchValue: string;
|
|
8
|
+
setSearchValue: (value: string) => void;
|
|
9
|
+
filteredCount?: number;
|
|
10
|
+
totalCount?: number;
|
|
11
|
+
};
|
|
12
|
+
type DataGridSize = "default" | "compact";
|
|
13
|
+
type DataGridQueryMode = "client" | "server";
|
|
14
|
+
type DataGridLoadingVariant = "skeleton" | "none";
|
|
15
|
+
type DataGridStateCopyFields = {
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
action: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
type AtLeastOne<
|
|
21
|
+
T,
|
|
22
|
+
Keys extends keyof T = keyof T
|
|
23
|
+
> = Keys extends keyof T ? Pick<Required<T>, Keys> & Partial<Omit<T, Keys>> : never;
|
|
24
|
+
type DataGridStateCopy = AtLeastOne<DataGridStateCopyFields>;
|
|
25
|
+
type DataGridLabels = {
|
|
26
|
+
clearSearch: string;
|
|
27
|
+
clearFilters: string;
|
|
28
|
+
};
|
|
29
|
+
type DataGridLoadingCellContext = {
|
|
30
|
+
rowIndex: number;
|
|
31
|
+
columnId: string;
|
|
32
|
+
columnIndex: number;
|
|
33
|
+
size: DataGridSize;
|
|
34
|
+
};
|
|
4
35
|
type DataGridHandle = {
|
|
5
|
-
|
|
6
|
-
|
|
36
|
+
scrollToRow: (index: number) => void;
|
|
37
|
+
resetSorting: () => void;
|
|
38
|
+
resetSelection: () => void;
|
|
39
|
+
resetSearch: () => void;
|
|
7
40
|
};
|
|
8
41
|
type DataGridBaseProps<TData> = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
data: TData[];
|
|
43
|
+
columns: ColumnDef<TData>[];
|
|
44
|
+
getRowId?: (originalRow: TData, index: number) => string;
|
|
45
|
+
rowCount?: number;
|
|
46
|
+
globalFilterFn?: FilterFnOption<TData>;
|
|
47
|
+
enableRowSelection?: boolean | ((row: Row<TData>) => boolean);
|
|
48
|
+
enableSorting?: boolean;
|
|
49
|
+
enableColumnResizing?: boolean;
|
|
50
|
+
columnGrow?: boolean;
|
|
51
|
+
columnSizing?: ColumnSizingState;
|
|
52
|
+
defaultColumnSizing?: ColumnSizingState;
|
|
53
|
+
onColumnSizingChange?: (value: ColumnSizingState) => void;
|
|
54
|
+
manualPagination?: boolean;
|
|
55
|
+
manualSorting?: boolean;
|
|
56
|
+
rowSelection?: RowSelectionState;
|
|
57
|
+
defaultRowSelection?: RowSelectionState;
|
|
58
|
+
onRowSelectionChange?: (value: RowSelectionState) => void;
|
|
59
|
+
selectionActions?: DataGridSelectionActions;
|
|
60
|
+
sorting?: SortingState;
|
|
61
|
+
defaultSorting?: SortingState;
|
|
62
|
+
onSortingChange?: (value: SortingState) => void;
|
|
63
|
+
columnFilters?: ColumnFiltersState;
|
|
64
|
+
defaultColumnFilters?: ColumnFiltersState;
|
|
65
|
+
onColumnFiltersChange?: (value: ColumnFiltersState) => void;
|
|
66
|
+
pagination?: PaginationState;
|
|
67
|
+
defaultPagination?: PaginationState;
|
|
68
|
+
onPaginationChange?: (value: PaginationState) => void;
|
|
69
|
+
getSubRows?: (row: TData, index: number) => TData[] | undefined;
|
|
70
|
+
expanded?: ExpandedState;
|
|
71
|
+
defaultExpanded?: ExpandedState;
|
|
72
|
+
onExpandedChange?: (value: ExpandedState) => void;
|
|
73
|
+
getRowCanExpand?: (row: Row<TData>) => boolean;
|
|
74
|
+
maxDepth?: number;
|
|
75
|
+
/** Shades every other row to help scan long, read-only tables. */
|
|
76
|
+
striped?: boolean;
|
|
77
|
+
/** Shows column titles semibold in the primary text color instead of muted. */
|
|
78
|
+
emphasizeHeader?: boolean;
|
|
79
|
+
pinnedColumns?: string[];
|
|
80
|
+
gridRef?: RefObject<DataGridHandle | null>;
|
|
81
|
+
size?: DataGridSize;
|
|
82
|
+
children?: ReactNode;
|
|
83
|
+
className?: string;
|
|
84
|
+
onRowClick?: (row: Row<TData>) => void;
|
|
85
|
+
searchValue?: string;
|
|
86
|
+
defaultSearchValue?: string;
|
|
87
|
+
onSearchValueChange?: (value: string) => void;
|
|
88
|
+
queryMode?: DataGridQueryMode;
|
|
89
|
+
loading?: boolean;
|
|
90
|
+
loadingVariant?: DataGridLoadingVariant;
|
|
91
|
+
loadingRowCount?: number;
|
|
92
|
+
renderLoadingCell?: (ctx: DataGridLoadingCellContext) => ReactNode;
|
|
93
|
+
emptyState?: ReactNode | DataGridStateCopy;
|
|
94
|
+
noResultsState?: ReactNode | DataGridStateCopy;
|
|
95
|
+
onClearSearch?: () => void;
|
|
96
|
+
onClearFilters?: () => void;
|
|
97
|
+
labels?: Partial<DataGridLabels>;
|
|
98
|
+
filteredResultCount?: number;
|
|
99
|
+
totalResultCount?: number;
|
|
100
|
+
rowHeight?: number;
|
|
101
|
+
headerHeight?: number;
|
|
33
102
|
};
|
|
34
103
|
type DataGridAccessibleNameProps = {
|
|
35
|
-
|
|
36
|
-
|
|
104
|
+
"aria-label": string;
|
|
105
|
+
"aria-labelledby"?: string;
|
|
37
106
|
} | {
|
|
38
|
-
|
|
39
|
-
|
|
107
|
+
"aria-labelledby": string;
|
|
108
|
+
"aria-label"?: string;
|
|
40
109
|
};
|
|
41
110
|
type DataGridProps<TData> = DataGridBaseProps<TData> & DataGridAccessibleNameProps;
|
|
42
|
-
declare function DataGrid<TData>({ data, columns, getRowId, rowCount, globalFilterFn, enableSorting, manualSorting, sorting, defaultSorting, onSortingChange, getSubRows, expanded, defaultExpanded, onExpandedChange, getRowCanExpand, maxDepth, pinnedColumns, gridRef, size, children, className, onRowClick, rowHeight, headerHeight,
|
|
43
|
-
|
|
111
|
+
declare function DataGrid<TData>({ data, columns, getRowId, rowCount, globalFilterFn, enableRowSelection, enableSorting, enableColumnResizing, columnGrow, columnSizing, defaultColumnSizing, onColumnSizingChange, manualPagination, manualSorting, rowSelection, defaultRowSelection, onRowSelectionChange, selectionActions, sorting, defaultSorting, onSortingChange, columnFilters, defaultColumnFilters, onColumnFiltersChange, pagination, defaultPagination, onPaginationChange, getSubRows, expanded, defaultExpanded, onExpandedChange, getRowCanExpand, maxDepth, striped, emphasizeHeader, pinnedColumns, gridRef, size, children, className, onRowClick, searchValue, defaultSearchValue, onSearchValueChange, queryMode, loading, loadingVariant, loadingRowCount, renderLoadingCell, emptyState, noResultsState, filteredResultCount, totalResultCount, onClearSearch, onClearFilters, labels: labelOverrides, rowHeight, headerHeight, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }: DataGridProps<TData>): ReactElement;
|
|
112
|
+
declare function DataGridCheckboxHeader<TData>({ table }: {
|
|
113
|
+
table: Table<TData>;
|
|
114
|
+
}): ReactElement;
|
|
115
|
+
declare function DataGridCheckboxCell<TData>({ row }: {
|
|
116
|
+
row: Row<TData>;
|
|
117
|
+
}): ReactElement;
|
|
118
|
+
type DataGridSearchProps = Omit<ComponentProps<typeof Search>, "value" | "onChange" | "onClear">;
|
|
119
|
+
declare const DataGridSearch: ForwardRefExoticComponent<DataGridSearchProps & RefAttributes<ComponentRef<typeof Search>>>;
|
|
120
|
+
type DataGridResultCountProps = Omit<ComponentProps<"output">, "children"> & {
|
|
121
|
+
formatLabel?: (filteredCount: number, totalCount?: number) => ReactNode;
|
|
122
|
+
};
|
|
123
|
+
declare const DataGridResultCount: ForwardRefExoticComponent<DataGridResultCountProps & RefAttributes<HTMLOutputElement>>;
|
|
124
|
+
type DataGridFilterTriggerProps = ComponentProps<typeof Button> & {
|
|
125
|
+
activeCount?: number;
|
|
126
|
+
label?: string;
|
|
127
|
+
};
|
|
128
|
+
declare const DataGridFilterTrigger: ForwardRefExoticComponent<DataGridFilterTriggerProps & RefAttributes<ComponentRef<typeof Button>>>;
|
|
129
|
+
declare function useDataGridContext(): DataGridContextValue;
|
|
130
|
+
export { DataGrid, DataGridCheckboxCell, DataGridCheckboxHeader, DataGridResultCount, DataGridFilterTrigger, DataGridSearch, useDataGridContext, type DataGridContextValue, type DataGridHandle, type DataGridLabels };
|
|
131
|
+
export { DataGridFilterPanel, type DataGridFilterColumn, type DataGridFilterPanelLabels } from "./data-grid-filter-panel";
|
|
132
|
+
export { DataGridFooter, DataGridFooterEnd, DataGridFooterStart } from "./data-grid-footer";
|
|
133
|
+
export { DataGridHeader, DataGridHeaderActions, DataGridHeaderEnd, DataGridHeaderStart, DataGridSubtitle, DataGridTitle } from "./data-grid-header";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ColumnDef } from
|
|
1
|
+
import type { ColumnDef } from "@tanstack/react-table";
|
|
2
2
|
type AssetRow = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
status: "Running" | "Stopped" | "Needs attention";
|
|
7
|
+
area: string;
|
|
8
|
+
updated: string;
|
|
9
9
|
};
|
|
10
10
|
declare const assetRows: AssetRow[];
|
|
11
11
|
declare const assetColumns: ColumnDef<AssetRow>[];
|