@cognite/aura 0.3.5 → 1.46105.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 +264 -0
- package/DESIGN.md +638 -281
- package/LICENSE +21 -0
- package/README.md +21 -13
- package/dist/colors-deprecated.css +587 -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 +125 -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.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.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.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.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.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.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.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 +259 -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.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.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 +7 -7
- package/dist/components/ui/core/data-grid/data-grid-cell.js +22 -22
- package/dist/components/ui/core/data-grid/data-grid-cell.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 +41 -0
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.js +273 -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 +69 -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 +15 -15
- package/dist/components/ui/core/data-grid/data-grid-row.js +104 -76
- package/dist/components/ui/core/data-grid/data-grid-row.js.map +1 -0
- package/dist/components/ui/core/data-grid/data-grid.d.ts +85 -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 +402 -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 -3
- package/dist/components/ui/core/data-grid/data-grid.utils.js +44 -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 +4 -1
- package/dist/components/ui/core/data-grid/index.js +5 -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.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.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 +9 -9
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +19 -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 +453 -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.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 +27 -26
- package/dist/components/ui/core/select/select.js +213 -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.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.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.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/switch/switch.d.ts +9 -9
- 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.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.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.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 +24 -12
- 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 +46 -11
- package/src/components/ui/core/button/button.md +93 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid-footer.tsx"],"sourcesContent":["import {\n type ComponentProps,\n type ComponentRef,\n type ForwardRefExoticComponent,\n type RefAttributes,\n forwardRef,\n} from 'react';\n\nimport { cn } from '../../../../lib/utils';\n\ntype DataGridFooterProps = ComponentProps<'div'>;\n\nconst DataGridFooter: ForwardRefExoticComponent<\n DataGridFooterProps & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, DataGridFooterProps>(\n ({ className, children, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-slot=\"data-grid-footer\"\n className={cn(\n 'order-3 mt-auto flex min-h-17 items-center justify-between border-t py-4 pl-1.5 pr-4',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\nDataGridFooter.displayName = 'DataGridFooter';\n\nconst DataGridFooterStart: ForwardRefExoticComponent<\n ComponentProps<'div'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, ComponentProps<'div'>>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-slot=\"data-grid-footer-start\"\n className={cn('flex min-w-0 flex-1 items-center gap-2', className)}\n {...props}\n />\n );\n }\n);\nDataGridFooterStart.displayName = 'DataGridFooterStart';\n\nconst DataGridFooterEnd: ForwardRefExoticComponent<\n ComponentProps<'div'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, ComponentProps<'div'>>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-slot=\"data-grid-footer-end\"\n className={cn('flex items-center justify-end gap-2', className)}\n {...props}\n />\n );\n }\n);\nDataGridFooterEnd.displayName = 'DataGridFooterEnd';\n\nexport { DataGridFooter, DataGridFooterEnd, DataGridFooterStart };\n"],"names":["forwardRef","cn","DataGridFooter","className","children","props","ref","div","data-slot","displayName","DataGridFooterStart","DataGridFooterEnd"],"mappings":";AAAA,SAKEA,UAAU,QACL,QAAQ;AAEf,SAASC,EAAE,QAAQ,2BAAwB;AAI3C,MAAMC,+BAEFF,WACF,CAAC,EAAEG,SAAS,EAAEC,QAAQ,EAAE,GAAGC,OAAO,EAAEC;IAClC,qBACE,KAACC;QACCD,KAAKA;QACLE,aAAU;QACVL,WAAWF,GACT,wFACAE;QAED,GAAGE,KAAK;kBAERD;;AAGP;AAEFF,eAAeO,WAAW,GAAG;AAE7B,MAAMC,oCAEFV,WACF,CAAC,EAAEG,SAAS,EAAE,GAAGE,OAAO,EAAEC;IACxB,qBACE,KAACC;QACCD,KAAKA;QACLE,aAAU;QACVL,WAAWF,GAAG,0CAA0CE;QACvD,GAAGE,KAAK;;AAGf;AAEFK,oBAAoBD,WAAW,GAAG;AAElC,MAAME,kCAEFX,WACF,CAAC,EAAEG,SAAS,EAAE,GAAGE,OAAO,EAAEC;IACxB,qBACE,KAACC;QACCD,KAAKA;QACLE,aAAU;QACVL,WAAWF,GAAG,uCAAuCE;QACpD,GAAGE,KAAK;;AAGf;AAEFM,kBAAkBF,WAAW,GAAG;AAEhC,SAASP,cAAc,EAAES,iBAAiB,EAAED,mBAAmB,GAAG"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ReactElement } from
|
|
2
|
-
import { HeaderGroup } from
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import { type HeaderGroup } from "@tanstack/react-table";
|
|
3
3
|
type DataGridHeaderRowProps<TData> = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
headerGroup: HeaderGroup<TData>;
|
|
5
|
+
headerRowIndex: number;
|
|
6
|
+
resolvedHeaderHeight: number;
|
|
7
|
+
gridTemplateColumns: string;
|
|
8
|
+
pinnedColumnIds: Set<string>;
|
|
9
|
+
lastPinnedColumnId: string | undefined;
|
|
10
|
+
pinnedLeftByColumnId: Map<string, number>;
|
|
11
11
|
};
|
|
12
|
-
declare function DataGridHeaderRow<TData>({ headerGroup, headerRowIndex, resolvedHeaderHeight, gridTemplateColumns, pinnedColumnIds, lastPinnedColumnId, pinnedLeftByColumnId
|
|
12
|
+
declare function DataGridHeaderRow<TData>({ headerGroup, headerRowIndex, resolvedHeaderHeight, gridTemplateColumns, pinnedColumnIds, lastPinnedColumnId, pinnedLeftByColumnId }: DataGridHeaderRowProps<TData>): ReactElement;
|
|
13
13
|
export { DataGridHeaderRow, type DataGridHeaderRowProps };
|
|
@@ -1,56 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconArrowDown } from "@tabler/icons-react";
|
|
3
|
+
import { flexRender } from "@tanstack/react-table";
|
|
4
|
+
import { cn, focusState } from "../../../../lib/utils.js";
|
|
5
|
+
import { PINNED_COLUMN_Z_INDEX, getAriaSort } from "./data-grid.utils.js";
|
|
6
|
+
function DataGridHeaderRow({ headerGroup, headerRowIndex, resolvedHeaderHeight, gridTemplateColumns, pinnedColumnIds, lastPinnedColumnId, pinnedLeftByColumnId }) {
|
|
7
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
8
|
+
"data-slot": "data-grid-header-row",
|
|
9
|
+
role: "row",
|
|
10
|
+
"aria-rowindex": headerRowIndex + 1,
|
|
11
|
+
className: cn('sticky z-20 grid bg-background', headerRowIndex === 0 ? 'border-y' : 'border-b'),
|
|
12
|
+
style: {
|
|
13
|
+
top: headerRowIndex * resolvedHeaderHeight,
|
|
14
|
+
gridTemplateColumns,
|
|
15
|
+
minHeight: resolvedHeaderHeight
|
|
16
|
+
},
|
|
17
|
+
children: headerGroup.headers.map((header)=>{
|
|
18
|
+
const isLeafHeader = header.colSpan === 1;
|
|
19
|
+
const isPinned = isLeafHeader && pinnedColumnIds.has(header.column.id);
|
|
20
|
+
const isLastPinned = isPinned && lastPinnedColumnId === header.column.id;
|
|
21
|
+
const sortDirection = header.column.getIsSorted();
|
|
22
|
+
const canSort = isLeafHeader && header.column.getCanSort();
|
|
23
|
+
const isGroupedHeader = header.colSpan > 1;
|
|
24
|
+
const renderedHeader = header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext());
|
|
25
|
+
const isPlainTextHeader = typeof renderedHeader === 'string' || typeof renderedHeader === 'number';
|
|
26
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
27
|
+
"data-slot": "data-grid-column-header",
|
|
28
|
+
role: "columnheader",
|
|
29
|
+
"aria-colindex": header.index + 1,
|
|
30
|
+
"aria-colspan": header.colSpan > 1 ? header.colSpan : undefined,
|
|
31
|
+
"aria-sort": getAriaSort(sortDirection, canSort),
|
|
32
|
+
className: cn('flex items-center pr-3 text-left text-sm font-medium text-muted-foreground', header.index === 0 ? 'pl-4' : 'pl-3', isGroupedHeader && 'justify-center text-base font-semibold text-foreground/70', header.isPlaceholder && 'pointer-events-none', isPinned && 'sticky left-0 z-10 bg-background', isLastPinned && 'shadow-pinned-column', canSort && cn('cursor-pointer select-none hover:bg-muted/60', focusState)),
|
|
33
|
+
tabIndex: canSort ? 0 : undefined,
|
|
34
|
+
style: {
|
|
35
|
+
gridColumn: `span ${header.colSpan} / span ${header.colSpan}`,
|
|
36
|
+
...isPinned ? {
|
|
37
|
+
position: 'sticky',
|
|
38
|
+
left: pinnedLeftByColumnId.get(header.column.id) ?? 0,
|
|
39
|
+
zIndex: PINNED_COLUMN_Z_INDEX
|
|
40
|
+
} : {}
|
|
41
|
+
},
|
|
42
|
+
onClick: canSort ? header.column.getToggleSortingHandler() : undefined,
|
|
43
|
+
onKeyDown: canSort ? (event)=>{
|
|
44
|
+
if (event.key !== 'Enter' && event.key !== ' ') return;
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
header.column.toggleSorting(undefined, event.shiftKey);
|
|
47
|
+
} : undefined,
|
|
48
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
49
|
+
className: "flex min-w-0 flex-1 items-center gap-1",
|
|
50
|
+
children: [
|
|
51
|
+
isPlainTextHeader ? /*#__PURE__*/ _jsx("span", {
|
|
52
|
+
className: "block min-w-0 truncate",
|
|
53
|
+
children: renderedHeader
|
|
54
|
+
}) : renderedHeader,
|
|
55
|
+
(sortDirection === 'asc' || sortDirection === 'desc') && /*#__PURE__*/ _jsx("span", {
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
className: "inline-flex size-4 shrink-0 items-center justify-center",
|
|
58
|
+
children: /*#__PURE__*/ _jsx(IconArrowDown, {
|
|
59
|
+
className: cn('size-3.5 shrink-0', sortDirection === 'asc' && 'rotate-180')
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
})
|
|
64
|
+
}, header.id);
|
|
65
|
+
})
|
|
66
|
+
});
|
|
54
67
|
}
|
|
55
|
-
|
|
56
|
-
|
|
68
|
+
export { DataGridHeaderRow };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=data-grid-header-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid-header-row.tsx"],"sourcesContent":["import type { KeyboardEvent, ReactElement } from 'react';\n\nimport { IconArrowDown } from '@tabler/icons-react';\nimport { type HeaderGroup, flexRender } from '@tanstack/react-table';\n\nimport { cn, focusState } from '../../../../lib/utils';\n\nimport { PINNED_COLUMN_Z_INDEX, getAriaSort } from './data-grid.utils';\n\ntype DataGridHeaderRowProps<TData> = {\n headerGroup: HeaderGroup<TData>;\n headerRowIndex: number;\n resolvedHeaderHeight: number;\n gridTemplateColumns: string;\n pinnedColumnIds: Set<string>;\n lastPinnedColumnId: string | undefined;\n pinnedLeftByColumnId: Map<string, number>;\n};\n\nfunction DataGridHeaderRow<TData>({\n headerGroup,\n headerRowIndex,\n resolvedHeaderHeight,\n gridTemplateColumns,\n pinnedColumnIds,\n lastPinnedColumnId,\n pinnedLeftByColumnId,\n}: DataGridHeaderRowProps<TData>): ReactElement {\n return (\n <div\n data-slot=\"data-grid-header-row\"\n role=\"row\"\n aria-rowindex={headerRowIndex + 1}\n className={cn(\n 'sticky z-20 grid bg-background',\n headerRowIndex === 0 ? 'border-y' : 'border-b'\n )}\n style={{\n top: headerRowIndex * resolvedHeaderHeight,\n gridTemplateColumns,\n minHeight: resolvedHeaderHeight,\n }}\n >\n {headerGroup.headers.map((header) => {\n const isLeafHeader = header.colSpan === 1;\n const isPinned = isLeafHeader && pinnedColumnIds.has(header.column.id);\n const isLastPinned =\n isPinned && lastPinnedColumnId === header.column.id;\n const sortDirection = header.column.getIsSorted();\n const canSort = isLeafHeader && header.column.getCanSort();\n const isGroupedHeader = header.colSpan > 1;\n const renderedHeader = header.isPlaceholder\n ? null\n : flexRender(header.column.columnDef.header, header.getContext());\n const isPlainTextHeader =\n typeof renderedHeader === 'string' ||\n typeof renderedHeader === 'number';\n\n return (\n <div\n key={header.id}\n data-slot=\"data-grid-column-header\"\n role=\"columnheader\"\n aria-colindex={header.index + 1}\n aria-colspan={header.colSpan > 1 ? header.colSpan : undefined}\n aria-sort={getAriaSort(sortDirection, canSort)}\n className={cn(\n 'flex items-center pr-3 text-left text-sm font-medium text-muted-foreground',\n header.index === 0 ? 'pl-4' : 'pl-3',\n isGroupedHeader &&\n 'justify-center text-base font-semibold text-foreground/70',\n header.isPlaceholder && 'pointer-events-none',\n isPinned && 'sticky left-0 z-10 bg-background',\n isLastPinned && 'shadow-pinned-column',\n canSort &&\n cn('cursor-pointer select-none hover:bg-muted/60', focusState)\n )}\n tabIndex={canSort ? 0 : undefined}\n style={{\n gridColumn: `span ${header.colSpan} / span ${header.colSpan}`,\n ...(isPinned\n ? {\n position: 'sticky',\n left: pinnedLeftByColumnId.get(header.column.id) ?? 0,\n zIndex: PINNED_COLUMN_Z_INDEX,\n }\n : {}),\n }}\n onClick={\n canSort ? header.column.getToggleSortingHandler() : undefined\n }\n onKeyDown={\n canSort\n ? (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n event.preventDefault();\n header.column.toggleSorting(undefined, event.shiftKey);\n }\n : undefined\n }\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-1\">\n {isPlainTextHeader ? (\n <span className=\"block min-w-0 truncate\">{renderedHeader}</span>\n ) : (\n renderedHeader\n )}\n {(sortDirection === 'asc' || sortDirection === 'desc') && (\n <span\n aria-hidden=\"true\"\n className=\"inline-flex size-4 shrink-0 items-center justify-center\"\n >\n <IconArrowDown\n className={cn(\n 'size-3.5 shrink-0',\n sortDirection === 'asc' && 'rotate-180'\n )}\n />\n </span>\n )}\n </div>\n </div>\n );\n })}\n </div>\n );\n}\n\nexport { DataGridHeaderRow, type DataGridHeaderRowProps };\n"],"names":["IconArrowDown","flexRender","cn","focusState","PINNED_COLUMN_Z_INDEX","getAriaSort","DataGridHeaderRow","headerGroup","headerRowIndex","resolvedHeaderHeight","gridTemplateColumns","pinnedColumnIds","lastPinnedColumnId","pinnedLeftByColumnId","div","data-slot","role","aria-rowindex","className","style","top","minHeight","headers","map","header","isLeafHeader","colSpan","isPinned","has","column","id","isLastPinned","sortDirection","getIsSorted","canSort","getCanSort","isGroupedHeader","renderedHeader","isPlaceholder","columnDef","getContext","isPlainTextHeader","aria-colindex","index","aria-colspan","undefined","aria-sort","tabIndex","gridColumn","position","left","get","zIndex","onClick","getToggleSortingHandler","onKeyDown","event","key","preventDefault","toggleSorting","shiftKey","span","aria-hidden"],"mappings":";AAEA,SAASA,aAAa,QAAQ,sBAAsB;AACpD,SAA2BC,UAAU,QAAQ,wBAAwB;AAErE,SAASC,EAAE,EAAEC,UAAU,QAAQ,2BAAwB;AAEvD,SAASC,qBAAqB,EAAEC,WAAW,QAAQ,uBAAoB;AAYvE,SAASC,kBAAyB,EAChCC,WAAW,EACXC,cAAc,EACdC,oBAAoB,EACpBC,mBAAmB,EACnBC,eAAe,EACfC,kBAAkB,EAClBC,oBAAoB,EACU;IAC9B,qBACE,KAACC;QACCC,aAAU;QACVC,MAAK;QACLC,iBAAeT,iBAAiB;QAChCU,WAAWhB,GACT,kCACAM,mBAAmB,IAAI,aAAa;QAEtCW,OAAO;YACLC,KAAKZ,iBAAiBC;YACtBC;YACAW,WAAWZ;QACb;kBAECF,YAAYe,OAAO,CAACC,GAAG,CAAC,CAACC;YACxB,MAAMC,eAAeD,OAAOE,OAAO,KAAK;YACxC,MAAMC,WAAWF,gBAAgBd,gBAAgBiB,GAAG,CAACJ,OAAOK,MAAM,CAACC,EAAE;YACrE,MAAMC,eACJJ,YAAYf,uBAAuBY,OAAOK,MAAM,CAACC,EAAE;YACrD,MAAME,gBAAgBR,OAAOK,MAAM,CAACI,WAAW;YAC/C,MAAMC,UAAUT,gBAAgBD,OAAOK,MAAM,CAACM,UAAU;YACxD,MAAMC,kBAAkBZ,OAAOE,OAAO,GAAG;YACzC,MAAMW,iBAAiBb,OAAOc,aAAa,GACvC,OACArC,WAAWuB,OAAOK,MAAM,CAACU,SAAS,CAACf,MAAM,EAAEA,OAAOgB,UAAU;YAChE,MAAMC,oBACJ,OAAOJ,mBAAmB,YAC1B,OAAOA,mBAAmB;YAE5B,qBACE,KAACvB;gBAECC,aAAU;gBACVC,MAAK;gBACL0B,iBAAelB,OAAOmB,KAAK,GAAG;gBAC9BC,gBAAcpB,OAAOE,OAAO,GAAG,IAAIF,OAAOE,OAAO,GAAGmB;gBACpDC,aAAWzC,YAAY2B,eAAeE;gBACtChB,WAAWhB,GACT,8EACAsB,OAAOmB,KAAK,KAAK,IAAI,SAAS,QAC9BP,mBACE,6DACFZ,OAAOc,aAAa,IAAI,uBACxBX,YAAY,oCACZI,gBAAgB,wBAChBG,WACEhC,GAAG,gDAAgDC;gBAEvD4C,UAAUb,UAAU,IAAIW;gBACxB1B,OAAO;oBACL6B,YAAY,CAAC,KAAK,EAAExB,OAAOE,OAAO,CAAC,QAAQ,EAAEF,OAAOE,OAAO,EAAE;oBAC7D,GAAIC,WACA;wBACEsB,UAAU;wBACVC,MAAMrC,qBAAqBsC,GAAG,CAAC3B,OAAOK,MAAM,CAACC,EAAE,KAAK;wBACpDsB,QAAQhD;oBACV,IACA,CAAC,CAAC;gBACR;gBACAiD,SACEnB,UAAUV,OAAOK,MAAM,CAACyB,uBAAuB,KAAKT;gBAEtDU,WACErB,UACI,CAACsB;oBACC,IAAIA,MAAMC,GAAG,KAAK,WAAWD,MAAMC,GAAG,KAAK,KAAK;oBAChDD,MAAME,cAAc;oBACpBlC,OAAOK,MAAM,CAAC8B,aAAa,CAACd,WAAWW,MAAMI,QAAQ;gBACvD,IACAf;0BAGN,cAAA,MAAC/B;oBAAII,WAAU;;wBACZuB,kCACC,KAACoB;4BAAK3C,WAAU;sCAA0BmB;6BAE1CA;wBAEAL,CAAAA,kBAAkB,SAASA,kBAAkB,MAAK,mBAClD,KAAC6B;4BACCC,eAAY;4BACZ5C,WAAU;sCAEV,cAAA,KAAClB;gCACCkB,WAAWhB,GACT,qBACA8B,kBAAkB,SAAS;;;;;eAvDhCR,OAAOM,EAAE;QA+DpB;;AAGN;AAEA,SAASxB,iBAAiB,GAAgC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ComponentProps, type ForwardRefExoticComponent, type RefAttributes } from "react";
|
|
2
|
+
type DataGridHeaderProps = ComponentProps<"div">;
|
|
3
|
+
declare const DataGridHeader: ForwardRefExoticComponent<DataGridHeaderProps & RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const DataGridHeaderStart: ForwardRefExoticComponent<ComponentProps<"div"> & RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const DataGridHeaderEnd: ForwardRefExoticComponent<ComponentProps<"div"> & RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const DataGridTitle: ForwardRefExoticComponent<ComponentProps<"div"> & RefAttributes<HTMLDivElement>>;
|
|
7
|
+
type DataGridSubtitleProps = ComponentProps<"div">;
|
|
8
|
+
declare const DataGridSubtitle: ForwardRefExoticComponent<DataGridSubtitleProps & RefAttributes<HTMLDivElement>>;
|
|
9
|
+
type DataGridHeaderActionsProps = ComponentProps<"div">;
|
|
10
|
+
declare const DataGridHeaderActions: ForwardRefExoticComponent<DataGridHeaderActionsProps & RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export { DataGridHeader, DataGridHeaderActions, DataGridHeaderEnd, DataGridHeaderStart, DataGridSubtitle, DataGridTitle };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../../../../lib/utils.js";
|
|
4
|
+
const DataGridHeader = /*#__PURE__*/ forwardRef(({ className, children, ...props }, ref)=>{
|
|
5
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
6
|
+
ref: ref,
|
|
7
|
+
"data-slot": "data-grid-header",
|
|
8
|
+
className: cn('order-1 group/data-grid-header @container/data-grid-header grid items-center gap-x-4', 'grid-cols-[minmax(0,1fr)_auto]', className),
|
|
9
|
+
...props,
|
|
10
|
+
children: children
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
DataGridHeader.displayName = 'DataGridHeader';
|
|
14
|
+
const DataGridHeaderStart = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
15
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
16
|
+
ref: ref,
|
|
17
|
+
"data-slot": "data-grid-header-start",
|
|
18
|
+
className: cn('col-start-1 row-start-1 min-w-0 flex flex-col gap-1 p-4', className),
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
DataGridHeaderStart.displayName = 'DataGridHeaderStart';
|
|
23
|
+
const DataGridHeaderEnd = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
24
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
25
|
+
ref: ref,
|
|
26
|
+
"data-slot": "data-grid-header-end",
|
|
27
|
+
className: cn('col-start-2 row-start-1 flex items-center justify-end gap-2 pr-3', className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
DataGridHeaderEnd.displayName = 'DataGridHeaderEnd';
|
|
32
|
+
const DataGridTitle = /*#__PURE__*/ forwardRef(function DataGridTitle({ children, className, ...props }, ref) {
|
|
33
|
+
if (!children) return null;
|
|
34
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
35
|
+
ref: ref,
|
|
36
|
+
"data-slot": "data-grid-title",
|
|
37
|
+
className: cn('truncate text-lg font-medium text-foreground', className),
|
|
38
|
+
...props,
|
|
39
|
+
children: children
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
DataGridTitle.displayName = 'DataGridTitle';
|
|
43
|
+
const DataGridSubtitle = /*#__PURE__*/ forwardRef(function DataGridSubtitle({ children, className, ...props }, ref) {
|
|
44
|
+
if (!children) return null;
|
|
45
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
46
|
+
ref: ref,
|
|
47
|
+
"data-slot": "data-grid-subtitle",
|
|
48
|
+
className: cn('truncate text-sm text-muted-foreground', className),
|
|
49
|
+
...props,
|
|
50
|
+
children: children
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
DataGridSubtitle.displayName = 'DataGridSubtitle';
|
|
54
|
+
const DataGridHeaderActions = /*#__PURE__*/ forwardRef(function DataGridHeaderActions({ children, className, ...props }, ref) {
|
|
55
|
+
if (!children) return null;
|
|
56
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
57
|
+
ref: ref,
|
|
58
|
+
"data-slot": "data-grid-header-actions",
|
|
59
|
+
className: cn('flex items-center gap-2 py-4', className),
|
|
60
|
+
...props,
|
|
61
|
+
children: children
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
DataGridHeaderActions.displayName = 'DataGridHeaderActions';
|
|
65
|
+
export { DataGridHeader, DataGridHeaderActions, DataGridHeaderEnd, DataGridHeaderStart, DataGridSubtitle, DataGridTitle };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=data-grid-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid-header.tsx"],"sourcesContent":["import {\n type ComponentProps,\n type ComponentRef,\n type ForwardRefExoticComponent,\n type RefAttributes,\n forwardRef,\n} from 'react';\n\nimport { cn } from '../../../../lib/utils';\n\ntype DataGridHeaderProps = ComponentProps<'div'>;\n\nconst DataGridHeader: ForwardRefExoticComponent<\n DataGridHeaderProps & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, DataGridHeaderProps>(\n ({ className, children, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-slot=\"data-grid-header\"\n className={cn(\n 'order-1 group/data-grid-header @container/data-grid-header grid items-center gap-x-4',\n 'grid-cols-[minmax(0,1fr)_auto]',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\nDataGridHeader.displayName = 'DataGridHeader';\n\nconst DataGridHeaderStart: ForwardRefExoticComponent<\n ComponentProps<'div'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, ComponentProps<'div'>>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-slot=\"data-grid-header-start\"\n className={cn(\n 'col-start-1 row-start-1 min-w-0 flex flex-col gap-1 p-4',\n className\n )}\n {...props}\n />\n );\n }\n);\nDataGridHeaderStart.displayName = 'DataGridHeaderStart';\n\nconst DataGridHeaderEnd: ForwardRefExoticComponent<\n ComponentProps<'div'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, ComponentProps<'div'>>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-slot=\"data-grid-header-end\"\n className={cn(\n 'col-start-2 row-start-1 flex items-center justify-end gap-2 pr-3',\n className\n )}\n {...props}\n />\n );\n }\n);\nDataGridHeaderEnd.displayName = 'DataGridHeaderEnd';\n\nconst DataGridTitle: ForwardRefExoticComponent<\n ComponentProps<'div'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, ComponentProps<'div'>>(\n function DataGridTitle({ children, className, ...props }, ref) {\n if (!children) return null;\n return (\n <div\n ref={ref}\n data-slot=\"data-grid-title\"\n className={cn(\n 'truncate text-lg font-medium text-foreground',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\nDataGridTitle.displayName = 'DataGridTitle';\n\ntype DataGridSubtitleProps = ComponentProps<'div'>;\n\nconst DataGridSubtitle: ForwardRefExoticComponent<\n DataGridSubtitleProps & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, DataGridSubtitleProps>(\n function DataGridSubtitle({ children, className, ...props }, ref) {\n if (!children) return null;\n return (\n <div\n ref={ref}\n data-slot=\"data-grid-subtitle\"\n className={cn('truncate text-sm text-muted-foreground', className)}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\nDataGridSubtitle.displayName = 'DataGridSubtitle';\n\ntype DataGridHeaderActionsProps = ComponentProps<'div'>;\n\nconst DataGridHeaderActions: ForwardRefExoticComponent<\n DataGridHeaderActionsProps & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, DataGridHeaderActionsProps>(\n function DataGridHeaderActions({ children, className, ...props }, ref) {\n if (!children) return null;\n return (\n <div\n ref={ref}\n data-slot=\"data-grid-header-actions\"\n className={cn('flex items-center gap-2 py-4', className)}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\nDataGridHeaderActions.displayName = 'DataGridHeaderActions';\n\nexport {\n DataGridHeader,\n DataGridHeaderActions,\n DataGridHeaderEnd,\n DataGridHeaderStart,\n DataGridSubtitle,\n DataGridTitle,\n};\n"],"names":["forwardRef","cn","DataGridHeader","className","children","props","ref","div","data-slot","displayName","DataGridHeaderStart","DataGridHeaderEnd","DataGridTitle","DataGridSubtitle","DataGridHeaderActions"],"mappings":";AAAA,SAKEA,UAAU,QACL,QAAQ;AAEf,SAASC,EAAE,QAAQ,2BAAwB;AAI3C,MAAMC,+BAEFF,WACF,CAAC,EAAEG,SAAS,EAAEC,QAAQ,EAAE,GAAGC,OAAO,EAAEC;IAClC,qBACE,KAACC;QACCD,KAAKA;QACLE,aAAU;QACVL,WAAWF,GACT,wFACA,kCACAE;QAED,GAAGE,KAAK;kBAERD;;AAGP;AAEFF,eAAeO,WAAW,GAAG;AAE7B,MAAMC,oCAEFV,WACF,CAAC,EAAEG,SAAS,EAAE,GAAGE,OAAO,EAAEC;IACxB,qBACE,KAACC;QACCD,KAAKA;QACLE,aAAU;QACVL,WAAWF,GACT,2DACAE;QAED,GAAGE,KAAK;;AAGf;AAEFK,oBAAoBD,WAAW,GAAG;AAElC,MAAME,kCAEFX,WACF,CAAC,EAAEG,SAAS,EAAE,GAAGE,OAAO,EAAEC;IACxB,qBACE,KAACC;QACCD,KAAKA;QACLE,aAAU;QACVL,WAAWF,GACT,oEACAE;QAED,GAAGE,KAAK;;AAGf;AAEFM,kBAAkBF,WAAW,GAAG;AAEhC,MAAMG,8BAEFZ,WACF,SAASY,cAAc,EAAER,QAAQ,EAAED,SAAS,EAAE,GAAGE,OAAO,EAAEC,GAAG;IAC3D,IAAI,CAACF,UAAU,OAAO;IACtB,qBACE,KAACG;QACCD,KAAKA;QACLE,aAAU;QACVL,WAAWF,GACT,gDACAE;QAED,GAAGE,KAAK;kBAERD;;AAGP;AAEFQ,cAAcH,WAAW,GAAG;AAI5B,MAAMI,iCAEFb,WACF,SAASa,iBAAiB,EAAET,QAAQ,EAAED,SAAS,EAAE,GAAGE,OAAO,EAAEC,GAAG;IAC9D,IAAI,CAACF,UAAU,OAAO;IACtB,qBACE,KAACG;QACCD,KAAKA;QACLE,aAAU;QACVL,WAAWF,GAAG,0CAA0CE;QACvD,GAAGE,KAAK;kBAERD;;AAGP;AAEFS,iBAAiBJ,WAAW,GAAG;AAI/B,MAAMK,sCAEFd,WACF,SAASc,sBAAsB,EAAEV,QAAQ,EAAED,SAAS,EAAE,GAAGE,OAAO,EAAEC,GAAG;IACnE,IAAI,CAACF,UAAU,OAAO;IACtB,qBACE,KAACG;QACCD,KAAKA;QACLE,aAAU;QACVL,WAAWF,GAAG,gCAAgCE;QAC7C,GAAGE,KAAK;kBAERD;;AAGP;AAEFU,sBAAsBL,WAAW,GAAG;AAEpC,SACEP,cAAc,EACdY,qBAAqB,EACrBH,iBAAiB,EACjBD,mBAAmB,EACnBG,gBAAgB,EAChBD,aAAa,GACb"}
|
|
@@ -1,18 +1,18 @@
|
|
|
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
|
-
|
|
15
|
-
|
|
5
|
+
row: Row<TData>;
|
|
6
|
+
virtualRow: VirtualItem;
|
|
7
|
+
headerGroupCount: number;
|
|
8
|
+
gridTemplateColumns: string;
|
|
9
|
+
pinnedColumnIds: Set<string>;
|
|
10
|
+
lastPinnedColumnId: string | undefined;
|
|
11
|
+
pinnedLeftByColumnId: Map<string, number>;
|
|
12
|
+
customCellColumnIds: Set<string>;
|
|
13
|
+
maxDepth: number;
|
|
14
|
+
hasExpanding: boolean;
|
|
15
|
+
onRowClick?: (row: Row<TData>) => void;
|
|
16
16
|
};
|
|
17
|
-
declare function DataGridRow<TData>({ row, virtualRow, headerGroupCount, gridTemplateColumns, pinnedColumnIds, lastPinnedColumnId, pinnedLeftByColumnId, customCellColumnIds, maxDepth, hasExpanding, onRowClick
|
|
17
|
+
declare function DataGridRow<TData>({ row, virtualRow, headerGroupCount, gridTemplateColumns, pinnedColumnIds, lastPinnedColumnId, pinnedLeftByColumnId, customCellColumnIds, maxDepth, hasExpanding, onRowClick }: DataGridRowProps<TData>): ReactElement;
|
|
18
18
|
export { DataGridRow, type DataGridRowProps };
|
|
@@ -1,77 +1,105 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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 { PINNED_COLUMN_Z_INDEX, getTextValue, isAccessorColumn, isFromExpandToggleTarget, isFromIgnoredCellTarget } from "./data-grid.utils.js";
|
|
8
|
+
function DataGridRow({ row, virtualRow, headerGroupCount, gridTemplateColumns, pinnedColumnIds, lastPinnedColumnId, pinnedLeftByColumnId, customCellColumnIds, maxDepth, hasExpanding, onRowClick }) {
|
|
9
|
+
const canExpand = row.getCanExpand();
|
|
10
|
+
const isRowInteractive = onRowClick !== undefined;
|
|
11
|
+
const handleRowActivation = isRowInteractive ? (triggerTarget)=>{
|
|
12
|
+
if (isFromIgnoredCellTarget(triggerTarget)) return;
|
|
13
|
+
if (isFromExpandToggleTarget(triggerTarget)) return;
|
|
14
|
+
onRowClick?.(row);
|
|
15
|
+
} : undefined;
|
|
16
|
+
const visibleCells = row.getVisibleCells();
|
|
17
|
+
const resolvedTreeColumnIndex = visibleCells.findIndex((cell)=>isAccessorColumn(cell.column.columnDef));
|
|
18
|
+
const treeColumnIndex = resolvedTreeColumnIndex >= 0 ? resolvedTreeColumnIndex : 0;
|
|
19
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
20
|
+
"data-slot": "data-grid-row",
|
|
21
|
+
role: "row",
|
|
22
|
+
"aria-rowindex": virtualRow.index + 1 + headerGroupCount,
|
|
23
|
+
"aria-expanded": canExpand ? row.getIsExpanded() : undefined,
|
|
24
|
+
className: cn('group absolute left-0 right-0 grid border-b bg-background transition-colors', 'hover:bg-active-muted-background', isRowInteractive && cn('cursor-pointer focus-visible:bg-active-muted-background', focusState)),
|
|
25
|
+
style: {
|
|
26
|
+
gridTemplateColumns,
|
|
27
|
+
height: virtualRow.size,
|
|
28
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
29
|
+
},
|
|
30
|
+
tabIndex: isRowInteractive ? 0 : undefined,
|
|
31
|
+
onClick: handleRowActivation ? (event)=>handleRowActivation(event.target) : undefined,
|
|
32
|
+
onKeyDown: handleRowActivation ? (event)=>{
|
|
33
|
+
if (event.key !== 'Enter' && event.key !== ' ') return;
|
|
34
|
+
if (isFromIgnoredCellTarget(event.target)) return;
|
|
35
|
+
if (isFromExpandToggleTarget(event.target)) return;
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
handleRowActivation(event.target);
|
|
38
|
+
} : undefined,
|
|
39
|
+
children: visibleCells.map((cell, cellIndex)=>{
|
|
40
|
+
const isPinned = pinnedColumnIds.has(cell.column.id);
|
|
41
|
+
const isLastPinned = isPinned && lastPinnedColumnId === cell.column.id;
|
|
42
|
+
const renderedCell = flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
43
|
+
const hasCustomCellRenderer = customCellColumnIds.has(cell.column.id);
|
|
44
|
+
const renderedTextValue = getTextValue(renderedCell);
|
|
45
|
+
const rawTextValue = getTextValue(cell.getValue());
|
|
46
|
+
const textValue = renderedTextValue ?? (!hasCustomCellRenderer ? rawTextValue : undefined);
|
|
47
|
+
const isTreeColumn = cellIndex === treeColumnIndex;
|
|
48
|
+
const depth = Math.min(row.depth, maxDepth);
|
|
49
|
+
const indentPx = isTreeColumn && depth > 0 ? depth * 16 : 0;
|
|
50
|
+
const showChevron = isTreeColumn && canExpand;
|
|
51
|
+
const showChevronSpacer = isTreeColumn && hasExpanding && !canExpand && depth > 0;
|
|
52
|
+
const pinnedStyle = isPinned ? {
|
|
53
|
+
position: 'sticky',
|
|
54
|
+
left: pinnedLeftByColumnId.get(cell.column.id) ?? 0,
|
|
55
|
+
zIndex: PINNED_COLUMN_Z_INDEX
|
|
56
|
+
} : undefined;
|
|
57
|
+
const cellStyle = indentPx > 0 || pinnedStyle ? {
|
|
58
|
+
...pinnedStyle,
|
|
59
|
+
...indentPx > 0 ? {
|
|
60
|
+
paddingInlineStart: `${indentPx + 12}px`
|
|
61
|
+
} : {}
|
|
62
|
+
} : undefined;
|
|
63
|
+
const needsTreeIndicator = showChevron || showChevronSpacer;
|
|
64
|
+
return /*#__PURE__*/ _jsxs(DataGridCell, {
|
|
65
|
+
"data-row-activation": isAccessorColumn(cell.column.columnDef) ? undefined : 'ignore',
|
|
66
|
+
isPinned: isPinned,
|
|
67
|
+
isLastPinned: isLastPinned,
|
|
68
|
+
colIndex: cellIndex + 1,
|
|
69
|
+
textValue: textValue,
|
|
70
|
+
truncate: needsTreeIndicator ? false : textValue !== undefined,
|
|
71
|
+
style: cellStyle,
|
|
72
|
+
children: [
|
|
73
|
+
showChevron && /*#__PURE__*/ _jsx(Button, {
|
|
74
|
+
size: "icon-sm",
|
|
75
|
+
variant: "ghost",
|
|
76
|
+
className: "mr-2",
|
|
77
|
+
"data-row-expand-toggle": "true",
|
|
78
|
+
onClick: (event)=>{
|
|
79
|
+
event.stopPropagation();
|
|
80
|
+
row.toggleExpanded();
|
|
81
|
+
},
|
|
82
|
+
"aria-label": row.getIsExpanded() ? 'Collapse row' : 'Expand row',
|
|
83
|
+
children: /*#__PURE__*/ _jsx(IconChevronRight, {
|
|
84
|
+
width: 5,
|
|
85
|
+
height: 8,
|
|
86
|
+
className: cn(row.getIsExpanded() && 'rotate-90'),
|
|
87
|
+
"aria-hidden": "true"
|
|
88
|
+
})
|
|
89
|
+
}),
|
|
90
|
+
showChevronSpacer && /*#__PURE__*/ _jsx("span", {
|
|
91
|
+
className: "mr-2 inline-block h-7 w-7 shrink-0",
|
|
92
|
+
"aria-hidden": "true"
|
|
93
|
+
}),
|
|
94
|
+
needsTreeIndicator && textValue !== undefined ? /*#__PURE__*/ _jsx("span", {
|
|
95
|
+
className: "block min-w-0 flex-1 truncate",
|
|
96
|
+
children: textValue
|
|
97
|
+
}) : renderedCell
|
|
98
|
+
]
|
|
99
|
+
}, cell.id);
|
|
100
|
+
})
|
|
101
|
+
});
|
|
75
102
|
}
|
|
76
|
-
|
|
77
|
-
|
|
103
|
+
export { DataGridRow };
|
|
104
|
+
|
|
105
|
+
//# 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} 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 {\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 gridTemplateColumns: string;\n pinnedColumnIds: Set<string>;\n lastPinnedColumnId: string | undefined;\n pinnedLeftByColumnId: Map<string, number>;\n customCellColumnIds: Set<string>;\n maxDepth: number;\n hasExpanding: boolean;\n onRowClick?: (row: Row<TData>) => void;\n};\n\nfunction DataGridRow<TData>({\n row,\n virtualRow,\n headerGroupCount,\n gridTemplateColumns,\n pinnedColumnIds,\n lastPinnedColumnId,\n pinnedLeftByColumnId,\n customCellColumnIds,\n maxDepth,\n hasExpanding,\n onRowClick,\n}: DataGridRowProps<TData>): ReactElement {\n const canExpand = row.getCanExpand();\n const isRowInteractive = onRowClick !== undefined;\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 className={cn(\n 'group absolute left-0 right-0 grid border-b bg-background transition-colors',\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,\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 renderedCell = flexRender(\n cell.column.columnDef.cell,\n cell.getContext()\n );\n const hasCustomCellRenderer = customCellColumnIds.has(cell.column.id);\n const renderedTextValue = getTextValue(renderedCell);\n const rawTextValue = getTextValue(cell.getValue());\n const textValue =\n renderedTextValue ??\n (!hasCustomCellRenderer ? rawTextValue : undefined);\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: pinnedLeftByColumnId.get(cell.column.id) ?? 0,\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 const needsTreeIndicator = showChevron || showChevronSpacer;\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 textValue={textValue}\n truncate={needsTreeIndicator ? false : textValue !== undefined}\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 {needsTreeIndicator && textValue !== undefined ? (\n <span className=\"block min-w-0 flex-1 truncate\">{textValue}</span>\n ) : (\n renderedCell\n )}\n </DataGridCell>\n );\n })}\n </div>\n );\n}\n\nexport { DataGridRow, type DataGridRowProps };\n"],"names":["IconChevronRight","flexRender","cn","focusState","Button","DataGridCell","PINNED_COLUMN_Z_INDEX","getTextValue","isAccessorColumn","isFromExpandToggleTarget","isFromIgnoredCellTarget","DataGridRow","row","virtualRow","headerGroupCount","gridTemplateColumns","pinnedColumnIds","lastPinnedColumnId","pinnedLeftByColumnId","customCellColumnIds","maxDepth","hasExpanding","onRowClick","canExpand","getCanExpand","isRowInteractive","undefined","handleRowActivation","triggerTarget","visibleCells","getVisibleCells","resolvedTreeColumnIndex","findIndex","cell","column","columnDef","treeColumnIndex","div","data-slot","role","aria-rowindex","index","aria-expanded","getIsExpanded","className","style","height","size","transform","start","tabIndex","onClick","event","target","onKeyDown","key","preventDefault","map","cellIndex","isPinned","has","id","isLastPinned","renderedCell","getContext","hasCustomCellRenderer","renderedTextValue","rawTextValue","getValue","textValue","isTreeColumn","depth","Math","min","indentPx","showChevron","showChevronSpacer","pinnedStyle","position","left","get","zIndex","cellStyle","paddingInlineStart","needsTreeIndicator","data-row-activation","colIndex","truncate","variant","data-row-expand-toggle","stopPropagation","toggleExpanded","aria-label","width","aria-hidden","span"],"mappings":";AAOA,SAASA,gBAAgB,QAAQ,sBAAsB;AACvD,SAA8BC,UAAU,QAAQ,wBAAwB;AAGxE,SAASC,EAAE,EAAEC,UAAU,QAAQ,2BAAwB;AACvD,SAASC,MAAM,QAAQ,sBAAmB;AAE1C,SAASC,YAAY,QAAQ,sBAAmB;AAChD,SACEC,qBAAqB,EACrBC,YAAY,EACZC,gBAAgB,EAChBC,wBAAwB,EACxBC,uBAAuB,QAClB,uBAAoB;AAgB3B,SAASC,YAAmB,EAC1BC,GAAG,EACHC,UAAU,EACVC,gBAAgB,EAChBC,mBAAmB,EACnBC,eAAe,EACfC,kBAAkB,EAClBC,oBAAoB,EACpBC,mBAAmB,EACnBC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACc;IACxB,MAAMC,YAAYX,IAAIY,YAAY;IAClC,MAAMC,mBAAmBH,eAAeI;IAExC,MAAMC,sBAAsBF,mBACxB,CAACG;QACC,IAAIlB,wBAAwBkB,gBAAgB;QAC5C,IAAInB,yBAAyBmB,gBAAgB;QAC7CN,aAAaV;IACf,IACAc;IAEJ,MAAMG,eAAejB,IAAIkB,eAAe;IACxC,MAAMC,0BAA0BF,aAAaG,SAAS,CAAC,CAACC,OACtDzB,iBAAiByB,KAAKC,MAAM,CAACC,SAAS;IAExC,MAAMC,kBACJL,2BAA2B,IAAIA,0BAA0B;IAE3D,qBACE,KAACM;QACCC,aAAU;QACVC,MAAK;QACLC,iBAAe3B,WAAW4B,KAAK,GAAG,IAAI3B;QACtC4B,iBAAenB,YAAYX,IAAI+B,aAAa,KAAKjB;QACjDkB,WAAW1C,GACT,+EACA,oCACAuB,oBACEvB,GACE,2DACAC;QAGN0C,OAAO;YACL9B;YACA+B,QAAQjC,WAAWkC,IAAI;YACvBC,WAAW,CAAC,WAAW,EAAEnC,WAAWoC,KAAK,CAAC,GAAG,CAAC;QAChD;QACAC,UAAUzB,mBAAmB,IAAIC;QACjCyB,SACExB,sBACI,CAACyB,QACCzB,oBAAoByB,MAAMC,MAAM,IAClC3B;QAEN4B,WACE3B,sBACI,CAACyB;YACC,IAAIA,MAAMG,GAAG,KAAK,WAAWH,MAAMG,GAAG,KAAK,KAAK;YAChD,IAAI7C,wBAAwB0C,MAAMC,MAAM,GAAG;YAC3C,IAAI5C,yBAAyB2C,MAAMC,MAAM,GAAG;YAC5CD,MAAMI,cAAc;YACpB7B,oBAAoByB,MAAMC,MAAM;QAClC,IACA3B;kBAGLG,aAAa4B,GAAG,CAAC,CAACxB,MAA4ByB;YAC7C,MAAMC,WAAW3C,gBAAgB4C,GAAG,CAAC3B,KAAKC,MAAM,CAAC2B,EAAE;YACnD,MAAMC,eAAeH,YAAY1C,uBAAuBgB,KAAKC,MAAM,CAAC2B,EAAE;YACtE,MAAME,eAAe9D,WACnBgC,KAAKC,MAAM,CAACC,SAAS,CAACF,IAAI,EAC1BA,KAAK+B,UAAU;YAEjB,MAAMC,wBAAwB9C,oBAAoByC,GAAG,CAAC3B,KAAKC,MAAM,CAAC2B,EAAE;YACpE,MAAMK,oBAAoB3D,aAAawD;YACvC,MAAMI,eAAe5D,aAAa0B,KAAKmC,QAAQ;YAC/C,MAAMC,YACJH,qBACC,CAAA,CAACD,wBAAwBE,eAAezC,SAAQ;YAEnD,MAAM4C,eAAeZ,cAActB;YACnC,MAAMmC,QAAQC,KAAKC,GAAG,CAAC7D,IAAI2D,KAAK,EAAEnD;YAClC,MAAMsD,WAAWJ,gBAAgBC,QAAQ,IAAIA,QAAQ,KAAK;YAC1D,MAAMI,cAAcL,gBAAgB/C;YACpC,MAAMqD,oBACJN,gBAAgBjD,gBAAgB,CAACE,aAAagD,QAAQ;YAExD,MAAMM,cAAyClB,WAC3C;gBACEmB,UAAU;gBACVC,MAAM7D,qBAAqB8D,GAAG,CAAC/C,KAAKC,MAAM,CAAC2B,EAAE,KAAK;gBAClDoB,QAAQ3E;YACV,IACAoB;YAEJ,MAAMwD,YACJR,WAAW,KAAKG,cACZ;gBACE,GAAGA,WAAW;gBACd,GAAIH,WAAW,IACX;oBAAES,oBAAoB,GAAGT,WAAW,GAAG,EAAE,CAAC;gBAAC,IAC3C,CAAC,CAAC;YACR,IACAhD;YAEN,MAAM0D,qBAAqBT,eAAeC;YAE1C,qBACE,MAACvE;gBAECgF,uBACE7E,iBAAiByB,KAAKC,MAAM,CAACC,SAAS,IAAIT,YAAY;gBAExDiC,UAAUA;gBACVG,cAAcA;gBACdwB,UAAU5B,YAAY;gBACtBW,WAAWA;gBACXkB,UAAUH,qBAAqB,QAAQf,cAAc3C;gBACrDmB,OAAOqC;;oBAENP,6BACC,KAACvE;wBACC2C,MAAK;wBACLyC,SAAQ;wBACR5C,WAAU;wBACV6C,0BAAuB;wBACvBtC,SAAS,CAACC;4BACRA,MAAMsC,eAAe;4BACrB9E,IAAI+E,cAAc;wBACpB;wBACAC,cAAYhF,IAAI+B,aAAa,KAAK,iBAAiB;kCAEnD,cAAA,KAAC3C;4BACC6F,OAAO;4BACP/C,QAAQ;4BACRF,WAAW1C,GAAGU,IAAI+B,aAAa,MAAM;4BACrCmD,eAAY;;;oBAIjBlB,mCACC,KAACmB;wBACCnD,WAAU;wBACVkD,eAAY;;oBAGfV,sBAAsBf,cAAc3C,0BACnC,KAACqE;wBAAKnD,WAAU;kCAAiCyB;yBAEjDN;;eAxCG9B,KAAK4B,EAAE;QA4ClB;;AAGN;AAEA,SAASlD,WAAW,GAA0B"}
|