@42-central/ui-react 0.26.0 → 0.27.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.
Files changed (138) hide show
  1. package/dist/{chunk-YZJUPYPO.js → chunk-2W7H43WL.js} +3 -3
  2. package/dist/{chunk-YZJUPYPO.js.map → chunk-2W7H43WL.js.map} +1 -1
  3. package/dist/{chunk-NLSJ6T7V.js → chunk-4D2V4JE4.js} +3 -3
  4. package/dist/{chunk-NLSJ6T7V.js.map → chunk-4D2V4JE4.js.map} +1 -1
  5. package/dist/{chunk-7B44J3CF.js → chunk-5H5YOPCF.js} +3 -3
  6. package/dist/{chunk-7B44J3CF.js.map → chunk-5H5YOPCF.js.map} +1 -1
  7. package/dist/{chunk-JFB6O7IY.js → chunk-7KFUFAVP.js} +4 -4
  8. package/dist/{chunk-JFB6O7IY.js.map → chunk-7KFUFAVP.js.map} +1 -1
  9. package/dist/{chunk-PT22KEVD.js → chunk-BGDVUC3B.js} +5 -5
  10. package/dist/{chunk-PT22KEVD.js.map → chunk-BGDVUC3B.js.map} +1 -1
  11. package/dist/{chunk-7247WBTV.js → chunk-DJ72KP32.js} +3 -3
  12. package/dist/{chunk-7247WBTV.js.map → chunk-DJ72KP32.js.map} +1 -1
  13. package/dist/{chunk-JDPVD2YE.js → chunk-HCHGERDB.js} +3 -3
  14. package/dist/{chunk-JDPVD2YE.js.map → chunk-HCHGERDB.js.map} +1 -1
  15. package/dist/{chunk-H7WOMZXO.js → chunk-HWBFRDX7.js} +16 -8
  16. package/dist/chunk-HWBFRDX7.js.map +1 -0
  17. package/dist/{chunk-LYGOFMXJ.js → chunk-I4IJOLNA.js} +4 -4
  18. package/dist/{chunk-LYGOFMXJ.js.map → chunk-I4IJOLNA.js.map} +1 -1
  19. package/dist/{chunk-DSZF2TW6.js → chunk-IA6DCC3N.js} +6 -6
  20. package/dist/{chunk-DSZF2TW6.js.map → chunk-IA6DCC3N.js.map} +1 -1
  21. package/dist/{chunk-QEAF57ZQ.js → chunk-ISX3AM32.js} +3 -3
  22. package/dist/{chunk-QEAF57ZQ.js.map → chunk-ISX3AM32.js.map} +1 -1
  23. package/dist/{chunk-YMVUQ2L7.js → chunk-L24N5EON.js} +6 -6
  24. package/dist/chunk-L24N5EON.js.map +1 -0
  25. package/dist/{chunk-J2NW7JID.js → chunk-L5GH7LLD.js} +3 -3
  26. package/dist/{chunk-J2NW7JID.js.map → chunk-L5GH7LLD.js.map} +1 -1
  27. package/dist/{chunk-N42EFOML.js → chunk-MCRTAUSZ.js} +6 -6
  28. package/dist/chunk-MCRTAUSZ.js.map +1 -0
  29. package/dist/{chunk-276RL7FX.js → chunk-MNYY7UU2.js} +6 -6
  30. package/dist/{chunk-276RL7FX.js.map → chunk-MNYY7UU2.js.map} +1 -1
  31. package/dist/{chunk-THGJLR5S.js → chunk-NNPSBC7O.js} +5 -5
  32. package/dist/{chunk-THGJLR5S.js.map → chunk-NNPSBC7O.js.map} +1 -1
  33. package/dist/{chunk-2CL3FKEY.js → chunk-QEMXXQQO.js} +3 -3
  34. package/dist/{chunk-2CL3FKEY.js.map → chunk-QEMXXQQO.js.map} +1 -1
  35. package/dist/{chunk-2NTCQIRP.js → chunk-QRNQQIQM.js} +5 -5
  36. package/dist/{chunk-2NTCQIRP.js.map → chunk-QRNQQIQM.js.map} +1 -1
  37. package/dist/{chunk-E3XLWMEB.js → chunk-RKCUXOU2.js} +4 -4
  38. package/dist/{chunk-E3XLWMEB.js.map → chunk-RKCUXOU2.js.map} +1 -1
  39. package/dist/{chunk-DMI4KS32.js → chunk-SBZJGFZ6.js} +3 -3
  40. package/dist/{chunk-DMI4KS32.js.map → chunk-SBZJGFZ6.js.map} +1 -1
  41. package/dist/{chunk-7P32XCEU.js → chunk-SLUOF7XW.js} +2 -2
  42. package/dist/chunk-SLUOF7XW.js.map +1 -0
  43. package/dist/{chunk-2TZU4LSX.js → chunk-ULF5LOBS.js} +3 -3
  44. package/dist/{chunk-2TZU4LSX.js.map → chunk-ULF5LOBS.js.map} +1 -1
  45. package/dist/components/app-shell/index.js +4 -4
  46. package/dist/components/autocomplete/index.js +4 -4
  47. package/dist/components/calendar-heatmap/index.js +2 -2
  48. package/dist/components/camera/index.js +6 -6
  49. package/dist/components/code-block/chrome.js +5 -5
  50. package/dist/components/code-block/index.js +6 -6
  51. package/dist/components/combobox/index.js +4 -4
  52. package/dist/components/combobox-list/index.js +6 -6
  53. package/dist/components/data-table/data-table-features.d.ts +8 -0
  54. package/dist/components/data-table/data-table-features.d.ts.map +1 -1
  55. package/dist/components/data-table/data-table-group.d.ts +128 -0
  56. package/dist/components/data-table/data-table-group.d.ts.map +1 -0
  57. package/dist/components/data-table/data-table-grouping.d.ts +72 -0
  58. package/dist/components/data-table/data-table-grouping.d.ts.map +1 -0
  59. package/dist/components/data-table/data-table-icons.d.ts +4 -2
  60. package/dist/components/data-table/data-table-icons.d.ts.map +1 -1
  61. package/dist/components/data-table/data-table-meta.d.ts +9 -0
  62. package/dist/components/data-table/data-table-meta.d.ts.map +1 -1
  63. package/dist/components/data-table/data-table-pagination.d.ts +4 -1
  64. package/dist/components/data-table/data-table-pagination.d.ts.map +1 -1
  65. package/dist/components/data-table/data-table-schema.d.ts +4 -0
  66. package/dist/components/data-table/data-table-schema.d.ts.map +1 -1
  67. package/dist/components/data-table/data-table-stack.d.ts +16 -3
  68. package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
  69. package/dist/components/data-table/data-table-toolbar.d.ts +33 -2
  70. package/dist/components/data-table/data-table-toolbar.d.ts.map +1 -1
  71. package/dist/components/data-table/data-table-translations.d.ts +35 -0
  72. package/dist/components/data-table/data-table-translations.d.ts.map +1 -1
  73. package/dist/components/data-table/data-table.d.ts +55 -3
  74. package/dist/components/data-table/data-table.d.ts.map +1 -1
  75. package/dist/components/data-table/index.d.ts +3 -1
  76. package/dist/components/data-table/index.d.ts.map +1 -1
  77. package/dist/components/data-table/index.js +877 -229
  78. package/dist/components/data-table/index.js.map +1 -1
  79. package/dist/components/date-picker/index.js +7 -7
  80. package/dist/components/drawer/index.js +4 -4
  81. package/dist/components/hover-card/index.js +3 -3
  82. package/dist/components/kbd/index.js +3 -3
  83. package/dist/components/lightbox/index.js +4 -4
  84. package/dist/components/menu/index.js +4 -4
  85. package/dist/components/modal/index.js +4 -4
  86. package/dist/components/multi-combobox-list/index.js +6 -6
  87. package/dist/components/multi-select/index.js +4 -4
  88. package/dist/components/nav-link/index.js +3 -3
  89. package/dist/components/nav-link/tanstack.js +3 -3
  90. package/dist/components/notification/create-notifier.d.ts.map +1 -1
  91. package/dist/components/notification/index.js +15 -3
  92. package/dist/components/notification/index.js.map +1 -1
  93. package/dist/components/notification/types.d.ts +5 -0
  94. package/dist/components/notification/types.d.ts.map +1 -1
  95. package/dist/components/number-input/index.js +4 -4
  96. package/dist/components/overlays/index.js +5 -5
  97. package/dist/components/photo-capture/index.js +6 -6
  98. package/dist/components/popover/index.js +3 -3
  99. package/dist/components/schedule/index.js +3 -3
  100. package/dist/components/select/index.js +5 -5
  101. package/dist/components/spotlight/index.js +8 -8
  102. package/dist/components/tags-input/index.js +3 -3
  103. package/dist/components/time-input/index.js +5 -5
  104. package/dist/components/tooltip/index.js +2 -2
  105. package/dist/components/tree-multi-select/index.js +4 -4
  106. package/dist/components/tree-select/index.js +4 -4
  107. package/dist/index.js +2 -2
  108. package/dist/lib/overlay-container.d.ts.map +1 -1
  109. package/dist/lib/overlay-layer.d.ts +10 -3
  110. package/dist/lib/overlay-layer.d.ts.map +1 -1
  111. package/dist/theme.css +14 -6
  112. package/package.json +1 -1
  113. package/src/components/data-table/data-table-features.ts +11 -0
  114. package/src/components/data-table/data-table-group.test.tsx +1007 -0
  115. package/src/components/data-table/data-table-group.tsx +474 -0
  116. package/src/components/data-table/data-table-grouping.ts +160 -0
  117. package/src/components/data-table/data-table-icons.tsx +8 -1
  118. package/src/components/data-table/data-table-meta.ts +9 -0
  119. package/src/components/data-table/data-table-pagination.tsx +5 -1
  120. package/src/components/data-table/data-table-stack.tsx +165 -43
  121. package/src/components/data-table/data-table-toolbar.tsx +110 -2
  122. package/src/components/data-table/data-table-translations.ts +44 -0
  123. package/src/components/data-table/data-table.tsx +420 -150
  124. package/src/components/data-table/index.ts +4 -0
  125. package/src/components/drawer/drawer.tsx +1 -1
  126. package/src/components/modal/modal.tsx +1 -1
  127. package/src/components/notification/create-notifier.tsx +18 -2
  128. package/src/components/notification/notify-in-modal.test.tsx +128 -0
  129. package/src/components/notification/types.ts +5 -0
  130. package/src/lib/overlay-container.tsx +2 -1
  131. package/src/lib/overlay-layer.test.tsx +63 -1
  132. package/src/lib/overlay-layer.tsx +29 -6
  133. package/src/theme.css +14 -6
  134. package/src/theme.test.ts +14 -10
  135. package/dist/chunk-7P32XCEU.js.map +0 -1
  136. package/dist/chunk-H7WOMZXO.js.map +0 -1
  137. package/dist/chunk-N42EFOML.js.map +0 -1
  138. package/dist/chunk-YMVUQ2L7.js.map +0 -1
@@ -0,0 +1,128 @@
1
+ import { type Column, type ExpandedState, type RowData, type Updater } from "@tanstack/react-table";
2
+ import { type ReactNode } from "react";
3
+ import { type TableSize } from "../table/table";
4
+ import type { DataTableFeatures, DataTableInstance, Row } from "./data-table-features";
5
+ import { type DataTableGroup, type DataTableGroupNode } from "./data-table-grouping";
6
+ import type { ResolvedDataTableIcons } from "./data-table-icons";
7
+ import type { ResolvedDataTableTranslations } from "./data-table-translations";
8
+ /** What `renderGroupHeader` receives for one group. */
9
+ export type DataTableGroupHeaderContext<TEntity extends RowData> = {
10
+ /** The column the group is made from. */
11
+ column: Column<DataTableFeatures, TEntity, unknown>;
12
+ /** The group's value in that column, as a string. */
13
+ value: string;
14
+ /** Its plain-text label: the matching `select` option's label, else the value. */
15
+ label: string;
16
+ /** The group's rows present in `data`, across its sub-groups. */
17
+ rows: Row<TEntity>[];
18
+ /** Every row the group holds; the server's total under `manualGrouping`. */
19
+ count: number;
20
+ expanded: boolean;
21
+ toggle: () => void;
22
+ };
23
+ /** What a "Show more" click reports under `manualGrouping`. */
24
+ export type DataTableGroupShowMore = {
25
+ columnId: string;
26
+ value: string;
27
+ /** How many of the group's rows are in `data` already. */
28
+ loaded: number;
29
+ };
30
+ /** Everything the two renderings (table body, stacked cards) need to draw groups. */
31
+ export type DataTableGrouping<TEntity extends RowData> = {
32
+ groups: DataTableGroupNode<TEntity>[];
33
+ /** Rows across the drawn groups, by their `count`. */
34
+ rowCount: number;
35
+ label: (node: DataTableGroupNode<TEntity>) => string;
36
+ renderValue: (node: DataTableGroupNode<TEntity>) => ReactNode;
37
+ isExpanded: (node: DataTableGroupNode<TEntity>) => boolean;
38
+ toggle: (node: DataTableGroupNode<TEntity>) => void;
39
+ /** The group's leaf rows up to its current "Show more" limit. */
40
+ visibleRows: (node: DataTableGroupNode<TEntity>) => Row<TEntity>[];
41
+ /** How many rows the next "Show more" adds; `0` draws no button. */
42
+ nextCount: (node: DataTableGroupNode<TEntity>) => number;
43
+ showMore: (node: DataTableGroupNode<TEntity>) => void;
44
+ /** Groups the user opened since mount: their rows fade in. */
45
+ opened: ReadonlySet<string>;
46
+ };
47
+ /**
48
+ * Builds the group tree for the current `grouping` and holds what is local to
49
+ * drawing it: each group's "Show more" limit and which groups were just opened.
50
+ * Returns `null` while the table isn't grouped.
51
+ */
52
+ export declare function useDataTableGrouping<TEntity extends RowData>({ table, grouping, expanded, onExpandedChange, hideEmptyGroups, paginate, groupPageSize, manualGrouping, manualGroups, onGroupShowMore, renderGroupHeader, translations, resetKey, }: {
53
+ table: DataTableInstance<TEntity>;
54
+ grouping: string[];
55
+ expanded: ExpandedState;
56
+ onExpandedChange: (updater: Updater<ExpandedState>) => void;
57
+ hideEmptyGroups: boolean;
58
+ /** `false` shows every row of a group at once (`enablePagination={false}`). */
59
+ paginate: boolean;
60
+ groupPageSize: number;
61
+ manualGrouping: boolean;
62
+ manualGroups?: ReadonlyArray<DataTableGroup>;
63
+ onGroupShowMore?: (group: DataTableGroupShowMore) => void;
64
+ renderGroupHeader?: (context: DataTableGroupHeaderContext<TEntity>) => ReactNode;
65
+ translations: ResolvedDataTableTranslations;
66
+ /** Changes whenever the row set does (grouping, sorting, filters, search): the
67
+ * limits start over, since "the first 25" no longer names the same rows. */
68
+ resetKey: string;
69
+ }): DataTableGrouping<TEntity> | null;
70
+ /**
71
+ * A group's fold control: the chevron and the group's value in one button, then
72
+ * the row count. Shared by the table's group header row and the stacked layout's
73
+ * section heading.
74
+ *
75
+ * The button is named after the group and says whether it is open through
76
+ * `aria-expanded`. The value is drawn inside it for the click target but hidden
77
+ * from assistive technology, which already has the name; a cell renderer used
78
+ * here must not hold a link or a control of its own.
79
+ */
80
+ export declare function DataTableGroupToggle<TEntity extends RowData>({ node, grouping, controls, translations, icons, className, }: {
81
+ node: DataTableGroupNode<TEntity>;
82
+ grouping: DataTableGrouping<TEntity>;
83
+ /** On the fold button: the table indents a sub-group's with it. */
84
+ className?: string;
85
+ /** The id of the element holding the group's rows, for `aria-controls`. */
86
+ controls?: string;
87
+ translations: ResolvedDataTableTranslations;
88
+ icons: ResolvedDataTableIcons;
89
+ }): import("react").JSX.Element;
90
+ /** A group's "Show N more" button, for the table body and the stacked layout alike. */
91
+ export declare function DataTableGroupShowMore<TEntity extends RowData>({ node, grouping, translations, }: {
92
+ node: DataTableGroupNode<TEntity>;
93
+ grouping: DataTableGrouping<TEntity>;
94
+ translations: ResolvedDataTableTranslations;
95
+ }): import("react").JSX.Element;
96
+ /**
97
+ * The grouped table body: one `<tbody>` per first-level group, which makes each
98
+ * a row group. Its first row is the group header, a `<th scope="rowgroup">`
99
+ * across every column holding the group's checkbox (in selection mode), fold
100
+ * button and count. A second grouping level adds sub-group header rows inside
101
+ * the same `<tbody>`, since a `<tbody>` can't nest.
102
+ */
103
+ export declare function DataTableGroupedBody<TEntity extends RowData>({ grouping, table, colSpan, renderRow, selectable, size, translations, icons, className, }: {
104
+ grouping: DataTableGrouping<TEntity>;
105
+ table: DataTableInstance<TEntity>;
106
+ /** The visible column count: every group row spans the table. */
107
+ colSpan: number;
108
+ /** `DataTable`'s own data row, so grouped and flat tables draw rows alike. */
109
+ renderRow: (row: Row<TEntity>, options?: {
110
+ className?: string;
111
+ indent?: boolean;
112
+ }) => ReactNode;
113
+ /** Draws each group's tri-state checkbox. */
114
+ selectable: boolean;
115
+ size: TableSize;
116
+ translations: ResolvedDataTableTranslations;
117
+ icons: ResolvedDataTableIcons;
118
+ className?: string;
119
+ }): import("react").JSX.Element[];
120
+ /** The footer while rows are grouped: the total, in the pagination band's place.
121
+ * Pages across the flattened list would split a group, so each group pages
122
+ * itself ("Show more") and the table-level controls step aside. */
123
+ export declare function DataTableGroupSummary<TEntity extends RowData>({ grouping, translations, className, }: {
124
+ grouping: DataTableGrouping<TEntity>;
125
+ translations: ResolvedDataTableTranslations;
126
+ className?: string;
127
+ }): import("react").JSX.Element;
128
+ //# sourceMappingURL=data-table-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-table-group.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-group.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,aAAa,EAElB,KAAK,OAAO,EACZ,KAAK,OAAO,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,OAAO,CAAA;AAQvD,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAEtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AACtF,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EAKxB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAA;AAE9E,uDAAuD;AACvD,MAAM,MAAM,2BAA2B,CAAC,OAAO,SAAS,OAAO,IAAI;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AC7B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,iCA8GA;AAED;;oEAEoE;AACpE,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,OAAO,EAAE,EAC7D,QAAQ,EACR,YAAY,EACZ,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;IACpC,YAAY,EAAE,6BAA6B,CAAA;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BAsBA"}
@@ -0,0 +1,72 @@
1
+ import type { ExpandedState, RowData } from "@tanstack/react-table";
2
+ import { type NormalizedItem } from "../../lib/select-data";
3
+ import type { DataTableInstance, Row } from "./data-table-features";
4
+ /** A group as the server describes it, for `manualGrouping`: its value in the
5
+ * grouped column and how many rows it holds in total, loaded or not. */
6
+ export type DataTableGroup = {
7
+ value: string;
8
+ count: number;
9
+ };
10
+ /**
11
+ * One group to draw. `groups` holds its sub-groups when a second grouping level
12
+ * follows, `rows` its leaf rows otherwise; exactly one of the two is filled.
13
+ */
14
+ export type DataTableGroupNode<TEntity extends RowData> = {
15
+ /** react-table's group row id: `status:fixed`, nested as `status:fixed>building:b1`. */
16
+ id: string;
17
+ columnId: string;
18
+ /** The group's value, as a string: react-table keys groups by `String(value)`. */
19
+ value: string;
20
+ depth: number;
21
+ /** Every row the group holds: the loaded ones, or the server's total in manual mode. */
22
+ count: number;
23
+ /** The rows of the group present in `data`. */
24
+ loaded: number;
25
+ /** Absent for a group that has no row and was added from the column's options. */
26
+ row?: Row<TEntity>;
27
+ groups: DataTableGroupNode<TEntity>[];
28
+ rows: Row<TEntity>[];
29
+ };
30
+ /** How many grouping levels `DataTable` draws. Manual mode stops at one. */
31
+ export declare const MAX_GROUPING_DEPTH = 2;
32
+ /** A column's `select` filter options, flattened: the source of a group's label,
33
+ * its colour, its default position and the empty groups worth showing. */
34
+ export declare const groupOptions: (column?: {
35
+ columnDef: {
36
+ meta?: {
37
+ filter?: {
38
+ type: string;
39
+ options?: unknown;
40
+ };
41
+ };
42
+ };
43
+ }) => NormalizedItem[];
44
+ /** A group is open unless the state says `false` for it. A plain `expanded` map
45
+ * lists the open rows, so a group that appears after a filter change would start
46
+ * folded; reading only an explicit `false` keeps new groups open and lets
47
+ * `expanded` hold nothing but the folded ones. */
48
+ export declare const isGroupExpanded: (expanded: ExpandedState, id: string) => boolean;
49
+ /** The next `expanded` state once the group `id` is folded or opened. */
50
+ export declare const toggleGroupExpanded: (expanded: ExpandedState, id: string) => ExpandedState;
51
+ /** Every leaf row under a group, across its sub-groups. */
52
+ export declare const groupLeafRows: <TEntity extends RowData>(node: DataTableGroupNode<TEntity>) => Row<TEntity>[];
53
+ /**
54
+ * Turns react-table's grouped rows into the ordered tree `DataTable` draws.
55
+ *
56
+ * react-table builds the groups and sorts the rows inside them. What it leaves
57
+ * out is done here, per level:
58
+ * - the order of the groups: `meta.groupOrder`, else the order of the server's
59
+ * `groups` (manual mode), else the column's `select` options, else ascending;
60
+ * - the groups that have no row, taken from the options or from `groups`, at the
61
+ * first level only: a second level would repeat every option under every parent;
62
+ * - the counts, which in manual mode come from the server.
63
+ */
64
+ export declare function buildGroupTree<TEntity extends RowData>({ table, rows, grouping, hideEmptyGroups, manualGroups, }: {
65
+ table: DataTableInstance<TEntity>;
66
+ /** The sorted row model's top-level rows: group rows while `grouping` is set. */
67
+ rows: Row<TEntity>[];
68
+ grouping: string[];
69
+ hideEmptyGroups: boolean;
70
+ manualGroups?: ReadonlyArray<DataTableGroup>;
71
+ }): DataTableGroupNode<TEntity>[];
72
+ //# sourceMappingURL=data-table-grouping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-table-grouping.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-grouping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,uBAAuB,CAAA;AAChF,OAAO,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CAAC,KAChC,GAAG,CAAC,OAAO,CAAC,EAA+E,CAAA;AAI9F;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,SAAS,OAAO,EAAE,EACtD,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,YAAY,GACb,EAAE;IACD,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;IACjC,iFAAiF;IACjF,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,CAAA;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,eAAe,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;CAC7C,GAAG,kBAAkB,CAAC,OAAO,CAAC,EAAE,CA+DhC"}
@@ -4,12 +4,14 @@ import { type IconMap } from "../../lib/icons";
4
4
  * `DataTable`'s replaceable icons:
5
5
  * - `asc` / `desc` / `unsorted`: a sortable header's state, also in the stacked options drawer.
6
6
  * - `filter`: a column's filter trigger, and the stacked layout's options button.
7
- * - `search` / `columns`: the toolbar's global search and column-visibility menu.
7
+ * - `search` / `columns` / `group`: the toolbar's global search, column-visibility menu and group menu.
8
+ * - `fold`: a group header's chevron. It points to the inline end and the header turns it down
9
+ * while the group is open.
8
10
  * - `prev` / `next`: the pagination footer.
9
11
  * - `empty` / `error`: the placeholder states' badge; `clear` / `retry`: their actions.
10
12
  * - `min` / `max`: a `number` filter's two bounds.
11
13
  */
12
- export type DataTableIconSlot = "asc" | "desc" | "unsorted" | "filter" | "search" | "columns" | "prev" | "next" | "empty" | "error" | "clear" | "retry" | "min" | "max";
14
+ export type DataTableIconSlot = "asc" | "desc" | "unsorted" | "filter" | "search" | "columns" | "prev" | "next" | "empty" | "error" | "clear" | "retry" | "min" | "max" | "group" | "fold";
13
15
  export type DataTableIcons = IconMap<DataTableIconSlot>;
14
16
  export type ResolvedDataTableIcons = Record<DataTableIconSlot, ReactNode>;
15
17
  /** The pagination footer's slice, for `DataTable.Pagination` on its own. */
@@ -1 +1 @@
1
- {"version":3,"file":"data-table-icons.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-icons.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAAE,KAAK,OAAO,EAA0B,MAAM,iBAAiB,CAAA;AAEtE;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GACzB,KAAK,GACL,MAAM,GACN,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,KAAK,GACL,KAAK,CAAA;AACT,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AACvD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAA;AAEzE,4EAA4E;AAC5E,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,sBAe3B,CAAA;AAED,eAAO,MAAM,qBAAqB,WAAY,cAAc,KAAG,sBACL,CAAA;AAE1D,2EAA2E;AAC3E,eAAO,MAAM,QAAQ,WAAY,KAAK,GAAG,KAAK,GAAG,MAAM,KAAG,KAAK,GAAG,MAAM,GAAG,UACrD,CAAA"}
1
+ {"version":3,"file":"data-table-icons.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-icons.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAAE,KAAK,OAAO,EAA0B,MAAM,iBAAiB,CAAA;AAEtE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GACzB,KAAK,GACL,MAAM,GACN,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,KAAK,GACL,KAAK,GACL,OAAO,GACP,MAAM,CAAA;AACV,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AACvD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAA;AAEzE,4EAA4E;AAC5E,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,sBAiB3B,CAAA;AAED,eAAO,MAAM,qBAAqB,WAAY,cAAc,KAAG,sBACL,CAAA;AAE1D,2EAA2E;AAC3E,eAAO,MAAM,QAAQ,WAAY,KAAK,GAAG,KAAK,GAAG,MAAM,KAAG,KAAK,GAAG,MAAM,GAAG,UACrD,CAAA"}
@@ -98,6 +98,15 @@ declare module "@tanstack/react-table" {
98
98
  * there's no `TEntity` to hand it, just
99
99
  * `Array.from({ length: skeletonRowCount })` counters. */
100
100
  skeleton?: ReactNode;
101
+ /** Lists the column in the toolbar's "Group" menu and lets `grouping` name it.
102
+ * Grouping is opt-in per column: set this, or `enableGrouping: true` on the
103
+ * column itself. The column needs an accessor, since a group is the set of
104
+ * rows that share its value. */
105
+ groupable?: boolean;
106
+ /** Orders this column's groups, given two group values (always strings).
107
+ * Default: the order of `filter.options` for a `select` filter, then
108
+ * ascending by value. */
109
+ groupOrder?: (a: string, b: string) => number;
101
110
  }
102
111
  }
103
112
  //# sourceMappingURL=data-table-meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-table-meta.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC7E,OAAO,KAAK,EAAE,SAAS,EA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,MAAM,SAAS,QAAQ,GAAG,QAAQ;QAElC,IAAI,CAAC,EAAE,mBAAmB,CAAA;KAC3B;IAED,UAAU,UAAU,CAClB,EAAE,CAAC,GAAG,CAAC,SAAS,SAAS,aAAa,EACtC,EAAE,CAAC,GAAG,CAAC,KAAK,SAAS,OAAO,EAC5B,MAAM,SAAS,QAAQ,GAAG,QAAQ;QAElC,kFAAkF;QAClF,MAAM,CAAC,EAAE,qBAAqB,CAAA;QAC9B,uDAAuD;QACvD,KAAK,CAAC,EAAE,KAAK,CAAA;QACb;+EACuE;QACvE,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,iFAAiF;QACjF,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,kFAAkF;QAClF,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB;;;uFAG+E;QAC/E,YAAY,CAAC,EAAE,OAAO,CAAA;QACtB;;;;;;;mEAO2D;QAC3D,QAAQ,CAAC,EAAE,SAAS,CAAA;QACpB;;;yCAGiC;QACjC,SAAS,CAAC,EAAE,OAAO,CAAA;QACnB;;kCAE0B;QAC1B,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;KAC9C;CACF"}
@@ -40,6 +40,9 @@ export type DataTablePaginationProps<TEntity extends RowData> = {
40
40
  table: ReactTableInstance<DataTableFeatures, TEntity>;
41
41
  /** Page-size choices for the `Select`. Default `[10, 20, 50]`. */
42
42
  pageSizeOptions?: number[];
43
+ /** How many rows the current page holds, when the row model can't say: a grouped
44
+ * table's row model counts its group rows too. Default: the row model's length. */
45
+ rowsOnPage?: number;
43
46
  /** Best-effort "next" gate when the total row count is unknown (e.g. a
44
47
  * cursor-backed source) — overrides the row-count heuristic below. */
45
48
  hasNextPage?: boolean;
@@ -70,5 +73,5 @@ export type DataTablePaginationProps<TEntity extends RowData> = {
70
73
  * the current page came back short of a full `pageSize` (the best-effort
71
74
  * signal that there's no next page).
72
75
  */
73
- export declare function DataTablePagination<TEntity extends RowData>({ table, pageSizeOptions, hasNextPage, className, translations: translationsProp, paginationMode, icons, }: DataTablePaginationProps<TEntity>): import("react").JSX.Element;
76
+ export declare function DataTablePagination<TEntity extends RowData>({ table, pageSizeOptions, rowsOnPage: rowsOnPageProp, hasNextPage, className, translations: translationsProp, paginationMode, icons, }: DataTablePaginationProps<TEntity>): import("react").JSX.Element;
74
77
  //# sourceMappingURL=data-table-pagination.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-table-pagination.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-pagination.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,IAAI,kBAAkB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAStC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,KAAK,wBAAwB,EAAiB,MAAM,oBAAoB,CAAA;AAEjF,MAAM,MAAM,+BAA+B,GAAG;IAC5C;;;;;;mDAM+C;IAC/C,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;QACd,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,EAAE,EAAE,MAAM,CAAA;QACV,UAAU,EAAE,OAAO,CAAA;QACnB,SAAS,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAA;KACtD,KAAK,SAAS,CAAA;IACf;iEAC6D;IAC7D,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;kDAE8C;IAC9C,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IAC/B,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;sDACkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,wBAAwB,CAAC,OAAO,SAAS,OAAO,IAAI;IAC9D,KAAK,EAAE,kBAAkB,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;IACrD,kEAAkE;IAClE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B;2EACuE;IACvE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,yEAAyE;IACzE,YAAY,CAAC,EAAE,+BAA+B,CAAA;IAC9C;;;;2BAIuB;IACvB,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAChC,4FAA4F;IAC5F,KAAK,CAAC,EAAE,wBAAwB,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAYD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,SAAS,OAAO,EAAE,EAC3D,KAAK,EACL,eAA8B,EAC9B,WAAW,EACX,SAAS,EACT,YAAY,EAAE,gBAAgB,EAC9B,cAAuB,EACvB,KAAK,GACN,EAAE,wBAAwB,CAAC,OAAO,CAAC,+BAqHnC"}
1
+ {"version":3,"file":"data-table-pagination.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-pagination.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,IAAI,kBAAkB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAStC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,KAAK,wBAAwB,EAAiB,MAAM,oBAAoB,CAAA;AAEjF,MAAM,MAAM,+BAA+B,GAAG;IAC5C;;;;;;mDAM+C;IAC/C,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;QACd,IAAI,EAAE,MAAM,CAAA;Q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AAK,GACN,EAAE,wBAAwB,CAAC,OAAO,CAAC,+BAqHnC"}
@@ -24,8 +24,12 @@ export declare function columnHelperFor<S extends StandardSchemaV1<unknown, RowD
24
24
  columnVisibilityFeature: import("@tanstack/react-table").TableFeature;
25
25
  columnSizingFeature: import("@tanstack/react-table").TableFeature;
26
26
  columnResizingFeature: import("@tanstack/react-table").TableFeature;
27
+ columnGroupingFeature: import("@tanstack/react-table").TableFeature;
28
+ rowExpandingFeature: import("@tanstack/react-table").TableFeature;
27
29
  filteredRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
30
+ groupedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
28
31
  sortedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
32
+ expandedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
29
33
  paginatedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
30
34
  sortFns: {
31
35
  alphanumeric: import("@tanstack/react-table").CreatedSortFn<any, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"data-table-schema.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAGpD;qDACqD;AACrD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,gBAAgB,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;AAErF;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;mBAEvF"}
1
+ {"version":3,"file":"data-table-schema.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAGpD;qDACqD;AACrD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,gBAAgB,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;AAErF;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAEvF"}
@@ -1,5 +1,6 @@
1
- import { type Table as ReactTableInstance, type RowData } from "@tanstack/react-table";
1
+ import { type GroupingState, type Table as ReactTableInstance, type RowData } from "@tanstack/react-table";
2
2
  import type { DataTableFeatures, Row } from "./data-table-features";
3
+ import { type DataTableGrouping } from "./data-table-group";
3
4
  import { type ResolvedDataTableIcons } from "./data-table-icons";
4
5
  import { type DataTablePlaceholder, type DataTableView } from "./data-table-placeholder";
5
6
  import type { ResolvedDataTableTranslations } from "./data-table-translations";
@@ -15,8 +16,11 @@ import type { ResolvedDataTableTranslations } from "./data-table-translations";
15
16
  * fields from `meta.label`, and `"scroll"` (the default) stays the
16
17
  * SR-faithful path.
17
18
  */
18
- export declare function DataTableStackedRows<TEntity extends RowData>({ rows, view, error, refetching, empty, onRowClick, isRowClickIgnored, onRetry, table, className, skeletonRowCount, translations, icons, }: {
19
+ export declare function DataTableStackedRows<TEntity extends RowData>({ rows, grouping, view, error, refetching, empty, onRowClick, isRowClickIgnored, onRetry, table, className, skeletonRowCount, translations, icons, }: {
19
20
  rows: Row<TEntity>[];
21
+ /** Set while the table is grouped: the cards are then drawn per group, under a
22
+ * heading that folds them, and `rows` is unused. */
23
+ grouping?: DataTableGrouping<TEntity> | null;
20
24
  /** Resolved once in `DataTable` (see the `match` there) and passed down so
21
25
  * the `<table>` and stacked-card renderings never disagree on state. */
22
26
  view: DataTableView;
@@ -41,8 +45,17 @@ export declare function DataTableStackedRows<TEntity extends RowData>({ rows, vi
41
45
  * pattern) listing every sortable column, every filterable column, and —
42
46
  * when `enableColumnVisibility` is set — every column's visibility toggle.
43
47
  */
44
- export declare function DataTableStackOptions<TEntity extends RowData>({ table, enableColumnVisibility, translations, icons, className, }: {
48
+ export declare function DataTableStackOptions<TEntity extends RowData>({ table, enableColumnVisibility, grouping, translations, icons, className, }: {
45
49
  table: ReactTableInstance<DataTableFeatures, TEntity>;
50
+ /** The toolbar's "Group" menu, as this drawer's first section: set when
51
+ * `DataTable` shows that menu, with the same state behind it. */
52
+ grouping?: {
53
+ value: GroupingState;
54
+ onChange: (grouping: GroupingState) => void;
55
+ maxDepth: number;
56
+ hideEmptyGroups: boolean;
57
+ onHideEmptyGroupsChange: (value: boolean) => void;
58
+ };
46
59
  /** Mirrors `DataTable`'s own gate for the toolbar's `DataTableColumnVisibilityMenu`
47
60
  * — passed straight through so both surfaces agree on when column
48
61
  * visibility is editable. */
@@ -1 +1 @@
1
- {"version":3,"file":"data-table-stack.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-stack.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,KAAK,IAAI,kBAAkB,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAclG,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAGnE,OAAO,EAAE,KAAK,sBAAsB,EAAY,MAAM,oBAAoB,CAAA;AAC1E,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAA;AAE9E;;;;;;;;;;;GAWG;AACH,w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,"file":"data-table-stack.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-stack.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,KAAK,IAAI,kBAAkB,EAChC,KAAK,OAAO,EACb,MAAM,uBAAuB,CAAA;AAe9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAEnE,OAAO,EACL,KAAK,iBAAiB,EAGvB,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,KAAK,sBAAsB,EAAY,MAAM,oBAAoB,CAAA;AAC1E,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAA;AAE9E;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,OAAO,EAAE,EAC5D,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,UAAU,EACV,KAAK,EACL,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,KAAK,GACN,EAAE;IACD,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,CAAA;IACpB;yDACqD;IACrD,QAAQ,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IAC5C;6EACyE;IACzE,IAAI,EAAE,aAAa,CAAA;IACnB,KAAK,CAAC,EAAE,oBAAoB,CAAA;IAC5B,KAAK,CAAC,EAAE,oBAAoB,CAAA;IAC5B,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IACnC,iBAAiB,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,EAAE,GAAG,EAAE,OAAO,KAAK,OAAO,CAAA;IACxE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,KAAK,EAAE,kBAAkB,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;IACrD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,YAAY,EAAE,6BAA6B,CAAA;IAC3C,KAAK,EAAE,sBAAsB,CAAA;CAC9B,+BAsLA;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,OAAO,EAAE,EAC7D,KAAK,EACL,sBAAsB,EACtB,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,SAAS,GACV,EAAE;IACD,KAAK,EAAE,kBAAkB,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;IACrD;sEACkE;IAClE,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,aAAa,CAAA;QACpB,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAA;QAC3C,QAAQ,EAAE,MAAM,CAAA;QAChB,eAAe,EAAE,OAAO,CAAA;QACxB,uBAAuB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;KAClD,CAAA;IACD;;kCAE8B;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,YAAY,EAAE,6BAA6B,CAAA;IAC3C,KAAK,EAAE,sBAAsB,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,sCAyMA"}
@@ -1,6 +1,7 @@
1
- import type { Table as ReactTableInstance, RowData } from "@tanstack/react-table";
2
- import type { ReactNode } from "react";
1
+ import type { GroupingState, Table as ReactTableInstance, RowData } from "@tanstack/react-table";
2
+ import { type ReactNode } from "react";
3
3
  import type { DataTableFeatures } from "./data-table-features";
4
+ import type { ResolvedDataTableTranslations } from "./data-table-translations";
4
5
  /** The global-search box in `Table.Toolbar` — debounces the same way as a
5
6
  * `text` column filter (RFC §6) so a keystroke storm never reaches
6
7
  * `globalFilter` / the `queryKey`. */
@@ -25,4 +26,34 @@ export declare function DataTableColumnVisibilityMenu<TEntity extends RowData>({
25
26
  icon?: ReactNode;
26
27
  className?: string;
27
28
  }): import("react").JSX.Element;
29
+ /** The grouping a pick at `level` gives: the level takes the column (or ends
30
+ * there on "None"), earlier levels stay, and a later level survives unless it
31
+ * names the column just picked. */
32
+ export declare const pickGrouping: (grouping: GroupingState, level: number, value: string) => string[];
33
+ /** The columns a grouping level can pick: every groupable column not already
34
+ * taken by an earlier level, with its label. */
35
+ export declare const groupingChoices: <TEntity extends RowData>(table: ReactTableInstance<DataTableFeatures, TEntity>, grouping: GroupingState, level: number) => ({
36
+ value: string;
37
+ label: undefined;
38
+ } | {
39
+ value: string;
40
+ label: string;
41
+ })[];
42
+ /** The levels the group menu offers: one more than is set, up to `maxDepth`. */
43
+ export declare const groupingLevels: (grouping: GroupingState, maxDepth: number) => number[];
44
+ /** The toolbar's "Group" menu: a radio list of the groupable columns per level
45
+ * ("Group by", then "Then by" once a first level is set), and the "Hide empty
46
+ * groups" toggle. */
47
+ export declare function DataTableGroupMenu<TEntity extends RowData>({ table, grouping, onGroupingChange, maxDepth, hideEmptyGroups, onHideEmptyGroupsChange, translations, icon, className, }: {
48
+ table: ReactTableInstance<DataTableFeatures, TEntity>;
49
+ grouping: GroupingState;
50
+ onGroupingChange: (grouping: GroupingState) => void;
51
+ maxDepth: number;
52
+ hideEmptyGroups: boolean;
53
+ onHideEmptyGroupsChange: (value: boolean) => void;
54
+ translations: ResolvedDataTableTranslations;
55
+ /** The trigger's icon, `icons.group`. */
56
+ icon?: ReactNode;
57
+ className?: string;
58
+ }): import("react").JSX.Element;
28
59
  //# sourceMappingURL=data-table-toolbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-table-toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-toolbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,IAAI,kBAAkB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAK9D;;uCAEuC;AACvC,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,QAAQ,EACR,WAAuB,EACvB,QAAc,EACd,IAA2B,GAC5B,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB,+BAYA;AAED;;;;4BAI4B;AAC5B,wBAAgB,6BAA6B,CAAC,OAAO,SAAS,OAAO,EAAE,EACrE,KAAK,EACL,KAAK,EACL,IAA4B,EAC5B,SAAS,GACV,EAAE;IACD,KAAK,EAAE,kBAAkB,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;IACrD,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAA;IACb,2CAA2C;IAC3C,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA+BA"}
1
+ {"version":3,"file":"data-table-toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-toolbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,kBAAkB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAChG,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIhD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAI9D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAA;AAE9E;;uCAEuC;AACvC,wBAAgB,qBAAqB,CAAC,EACpC,KA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AA;IACvB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAA;IACnD,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,OAAO,CAAA;IACxB,uBAAuB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACjD,YAAY,EAAE,6BAA6B,CAAA;IAC3C,yCAAyC;IACzC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BAgDA"}
@@ -55,6 +55,41 @@ export type DataTableOwnTranslations = {
55
55
  toTime?: string;
56
56
  /** A `date` / `date-range` filter's button that empties the picked range. Default `"Clear"`. */
57
57
  clearDates?: string;
58
+ /** Accessible name of the toolbar's group menu trigger. Default `"Group rows"`. */
59
+ group?: string;
60
+ /** Heading of the group menu's first level, and of the options drawer's picker. Default
61
+ * `"Group by"`. */
62
+ groupBy?: string;
63
+ /** Heading of the group menu's second level. Default `"Then by"`. */
64
+ groupThenBy?: string;
65
+ /** The group menu's choice that removes a level. Default `"None"`. */
66
+ groupNone?: string;
67
+ /** The group menu's toggle for groups that have no rows. Default `"Hide empty groups"`. */
68
+ hideEmptyGroups?: string;
69
+ /** Accessible name of a group header's fold button, from the group's label. The button's
70
+ * `aria-expanded` says whether the group is open, so the name stays the same either way.
71
+ * Default `` (label) => label ``. */
72
+ groupToggle?: (label: string) => string;
73
+ /** A group's row count as a screen reader hears it; the header shows the bare number.
74
+ * `count` is the raw number, for plural rules. Default `"1 row"` / `` `${count} rows` ``. */
75
+ groupCount?: (count: number, formatted: string) => string;
76
+ /** What a group is called when its rows have no value in the grouped column. Default
77
+ * `"No value"`. */
78
+ groupNoValue?: string;
79
+ /** Accessible name of a group header's checkbox. Default `` (label) => `Select group ${label}` ``. */
80
+ selectGroup?: (label: string) => string;
81
+ /** A group's button that reveals its next rows. Default `` (count) => `Show ${count} more` ``. */
82
+ showMore?: (count: number, formatted: string) => string;
83
+ /** The footer while rows are grouped, in place of the pagination controls. Default
84
+ * `"180 rows in 4 groups"`. `formatted` carries both numbers in the locale's digits. */
85
+ groupSummary?: (infos: {
86
+ rows: number;
87
+ groups: number;
88
+ formatted: {
89
+ rows: string;
90
+ groups: string;
91
+ };
92
+ }) => string;
58
93
  };
59
94
  /** Overrides `DataTable`'s wording, as one prop: its own (`DataTableOwnTranslations`), the
60
95
  * pagination footer's (`DataTablePaginationTranslations`), and the keys of the controls its
@@ -1 +1 @@
1
- {"version":3,"file":"data-table-translations.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-translations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAA;AAE9E,4FAA4F;AAC5F,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,MAAM,CAAA;AAEtD;;mFAEmF;AACnF,MAAM,MAAM,wBAAwB,GAAG;IACrC,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;wFACoF;IACpF,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;IACxC;wCACoC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,sGAAsG;IACtG,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACxC;;oCAEgC;IAChC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,KAAK,MAAM,CAAA;IAC/D;8DAC0D;IAC1D,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,MAAM,CAAA;IACzD,4FAA4F;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B,KAChC,6BAA6B,GAAG,+BACiE,CAAA"}
1
+ {"version":3,"file":"data-table-translations.d.ts","sourceRoot":"","sources":["../../../src/components/data-table/data-table-translations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAA;AAE9E,4FAA4F;AAC5F,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,MAAM,CAAA;AAEtD;;mFAEmF;AACnF,MAAM,MAAM,wBAAwB,GAAG;IACrC,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;wFACoF;IACpF,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;IACxC;wCACoC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,sGAAsG;IACtG,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACxC;;oCAEgC;IAChC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,KAAK,MAAM,CAAA;IAC/D;8DAC0D;IAC1D,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,MAAM,CAAA;IACzD,4FAA4F;IAC5F,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;8DAC0D;IAC1D,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAC9C,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0EAA0E;IAC1E,UAAU,CAA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,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAA;KAC5C,KAAK,MAAM,CAAA;CACb,CAAA;AAED;;;;yEAIyE;AACzE,MAAM,MAAM,qBAAqB,GAAG,+BAA+B,GACjE,wBAAwB,GACxB,IAAI,CAAC,uBAAuB,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,gBAAgB,CAAC,GACxF,IAAI,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAA;AAE/C,8EAA8E;AAC9E,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAAC,wBAAwB,CAAC,GAAG;IAC/E,iBAAiB,EAAE,MAAM,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAID,eAAO,MAAM,+BAA+B,EAAE,6BAmC7C,CAAA;AAED;4CAC4C;AAC5C,eAAO,MAAM,4BAA4B,eAC3B,qBAAqB,KAChC,6BAA6B,GAAG,+BACiE,CAAA"}
@@ -1,9 +1,11 @@
1
1
  import type { StandardSchemaV1 } from "@standard-schema/spec";
2
- import { type ColumnFiltersState, type ColumnSizingState, type ColumnVisibilityState, type OnChangeFn, type PaginationState, type RowData, type RowSelectionState, type SortingState } from "@tanstack/react-table";
2
+ import { type ColumnFiltersState, type ColumnSizingState, type ColumnVisibilityState, type ExpandedState, type GroupingState, type OnChangeFn, type PaginationState, type RowData, type RowSelectionState, type SortingState } from "@tanstack/react-table";
3
3
  import type { ReactNode } from "react";
4
4
  import type { WithTestId } from "../../lib/test-id";
5
5
  import { type TableSize } from "../table/table";
6
6
  import { type ColumnDef, type Row } from "./data-table-features";
7
+ import { type DataTableGroupHeaderContext, type DataTableGroupShowMore } from "./data-table-group";
8
+ import { type DataTableGroup } from "./data-table-grouping";
7
9
  import { type DataTableIcons } from "./data-table-icons";
8
10
  import "./data-table-meta";
9
11
  import { DataTablePagination } from "./data-table-pagination";
@@ -71,6 +73,25 @@ export type DataTableProps<TEntity extends RowData> = WithTestId & {
71
73
  * with no entry here renders at its own `size` (default `150`). */
72
74
  columnSizing?: ColumnSizingState;
73
75
  onColumnSizingChange?: OnChangeFn<ColumnSizingState>;
76
+ /** Controlled grouping: the ids of the columns the rows are grouped by, outermost
77
+ * first. Up to two levels (one under `manualGrouping`); each column must opt in
78
+ * with `meta.groupable` or `enableGrouping`. `[]` is an ungrouped table.
79
+ *
80
+ * A grouped column is hidden by default, see `hideGroupedColumns`. */
81
+ grouping?: GroupingState;
82
+ onGroupingChange?: OnChangeFn<GroupingState>;
83
+ /** Controlled fold state, react-table's own `expanded`, keyed by group id
84
+ * (`status:fixed`, nested as `status:fixed>building:b1`). A group is open unless
85
+ * its id maps to `false`, so `{ "status:fixed": false }` folds one group and a
86
+ * group that appears later starts open. `true` opens everything; it is the
87
+ * uncontrolled default. */
88
+ expanded?: ExpandedState;
89
+ onExpandedChange?: OnChangeFn<ExpandedState>;
90
+ /** Controlled "Hide empty groups" switch of the group menu. A group can only be
91
+ * empty when the table knows it exists without a row: from the grouped column's
92
+ * `select` filter options, or from `groups`. Default `true`. */
93
+ hideEmptyGroups?: boolean;
94
+ onHideEmptyGroupsChange?: (value: boolean) => void;
74
95
  /** Seeds internal state for any omitted (uncontrolled) slice. */
75
96
  initialState?: Partial<{
76
97
  sorting: SortingState;
@@ -80,10 +101,25 @@ export type DataTableProps<TEntity extends RowData> = WithTestId & {
80
101
  rowSelection: RowSelectionState;
81
102
  columnVisibility: ColumnVisibilityState;
82
103
  columnSizing: ColumnSizingState;
104
+ grouping: GroupingState;
105
+ expanded: ExpandedState;
106
+ hideEmptyGroups: boolean;
83
107
  }>;
84
108
  manualSorting?: boolean;
85
109
  manualFiltering?: boolean;
86
110
  manualPagination?: boolean;
111
+ /** The server owns the groups: `data` holds the rows loaded so far for every
112
+ * group, and `groups` their totals. The table still sorts the rows it has into
113
+ * their groups. A group's "Show more" appears while it has fewer rows than its
114
+ * count and calls `onGroupShowMore`. One grouping level. */
115
+ manualGrouping?: boolean;
116
+ /** `manualGrouping`: every group of the grouped column, in display order, with
117
+ * its total row count. A group listed here with no row in `data` yet still
118
+ * draws its header (and is an empty group when its count is `0`). */
119
+ groups?: ReadonlyArray<DataTableGroup>;
120
+ /** `manualGrouping`: a group's "Show more" was clicked. Fetch the next
121
+ * `groupPageSize` rows of that group and add them to `data`. */
122
+ onGroupShowMore?: (group: DataTableGroupShowMore) => void;
87
123
  /** Shift-click multi-column sort. Off by default (single-column). */
88
124
  enableMultiSort?: boolean;
89
125
  /** Total server rows; lets react-table derive `pageCount`. */
@@ -100,7 +136,7 @@ export type DataTableProps<TEntity extends RowData> = WithTestId & {
100
136
  * the kit; a partial override only replaces the keys it sets. */
101
137
  translations?: DataTableTranslations;
102
138
  /** Replaces the default icons — sort (`asc`, `desc`, `unsorted`), `filter`, `search`,
103
- * `columns`, `prev`, `next`, the states' `empty`/`error` and their `clear`/`retry` actions,
139
+ * `columns`, `group`, a group header's `fold`, `prev`, `next`, the states' `empty`/`error` and their `clear`/`retry` actions,
104
140
  * and the `number` filter's `min`/`max`. A missing key keeps its default; `null` hides an
105
141
  * icon that has text or a label beside it. */
106
142
  icons?: DataTableIcons;
@@ -134,6 +170,22 @@ export type DataTableProps<TEntity extends RowData> = WithTestId & {
134
170
  globalFilterDebounce?: number;
135
171
  /** Shows the column-visibility `Menu` (only hideable columns are listed). */
136
172
  enableColumnVisibility?: boolean;
173
+ /** Shows the "Group" `Menu`: the groupable columns, a second level once a first
174
+ * is picked, and "Hide empty groups". `grouping` works without it. */
175
+ enableGrouping?: boolean;
176
+ /** Hides a column while the rows are grouped by it, since its value is in every
177
+ * group header. The column-visibility menu, or an explicit `columnVisibility`
178
+ * entry, still shows it. `false` leaves grouped columns in the table. Default
179
+ * `true`. */
180
+ hideGroupedColumns?: boolean;
181
+ /** Rows a group shows before its "Show more" button, and how many each click
182
+ * adds. Groups page on their own: pages across the whole list would split a
183
+ * group in two. Only applies while `enablePagination` is on. Default `25`. */
184
+ groupPageSize?: number;
185
+ /** Replaces what a group header draws for its value. By default that is the
186
+ * grouped column's own cell, so a status badge stays a badge. It sits inside
187
+ * the fold button: return text or decoration, nothing interactive. */
188
+ renderGroupHeader?: (context: DataTableGroupHeaderContext<TEntity>) => ReactNode;
137
189
  /** Shows a drag handle on each resizable header cell (mouse + touch, via
138
190
  * react-table's built-in `getResizeHandler`). Off by default. A column's
139
191
  * `size` (default width) and `minSize` (drag floor) are plain `ColumnDef`
@@ -194,7 +246,7 @@ export declare const DATA_TABLE_DEFAULT_EMPTY = "No results found";
194
246
  * A power user who wants total control composes the `Table` parts with their
195
247
  * own `useReactTable` instance and skips `DataTable` entirely.
196
248
  */
197
- declare function DataTableComponent<TEntity extends RowData>({ data, columns, getRowId, getRowTestId, getRowLabel, testId, sorting: sortingProp, onSortingChange, filters: filtersProp, onFiltersChange, globalFilter: globalFilterProp, onGlobalFilterChange, pagination: paginationProp, onPaginationChange, rowSelection: rowSelectionProp, onRowSelectionChange, columnVisibility: columnVisibilityProp, onColumnVisibilityChange, columnSizing: columnSizingProp, onColumnSizingChange, initialState, manualSorting, manualFiltering, manualPagination, enableMultiSort, rowCount, pageCount, hasNextPage, pageSizeOptions, translations, icons: iconsProp, paginationMode, loading, error, onRetry, empty, enableRowSelection, onRowClick, title, toolbarActions, enableGlobalFilter, globalFilterPlaceholder, globalFilterDebounce, enableColumnVisibility: _enableColumnVisibility, enableColumnResizing, enablePagination, sizing, fillLastColumn, size, striped, stickyHeader, stickyFooter, responsive, className, classNames, }: DataTableProps<TEntity>): import("react").JSX.Element;
249
+ declare function DataTableComponent<TEntity extends RowData>({ data, columns, getRowId, getRowTestId, getRowLabel, testId, sorting: sortingProp, onSortingChange, filters: filtersProp, onFiltersChange, globalFilter: globalFilterProp, onGlobalFilterChange, pagination: paginationProp, onPaginationChange, rowSelection: rowSelectionProp, onRowSelectionChange, columnVisibility: columnVisibilityProp, onColumnVisibilityChange, columnSizing: columnSizingProp, onColumnSizingChange, grouping: groupingProp, onGroupingChange, expanded: expandedProp, onExpandedChange, hideEmptyGroups: hideEmptyGroupsProp, onHideEmptyGroupsChange, initialState, manualSorting, manualFiltering, manualPagination, manualGrouping, groups: manualGroups, onGroupShowMore, enableMultiSort, rowCount, pageCount, hasNextPage, pageSizeOptions, translations, icons: iconsProp, paginationMode, loading, error, onRetry, empty, enableRowSelection, onRowClick, title, toolbarActions, enableGlobalFilter, globalFilterPlaceholder, globalFilterDebounce, enableColumnVisibility: _enableColumnVisibility, enableGrouping, hideGroupedColumns, groupPageSize, renderGroupHeader, enableColumnResizing, enablePagination, sizing, fillLastColumn, size, striped, stickyHeader, stickyFooter, responsive, className, classNames, }: DataTableProps<TEntity>): import("react").JSX.Element;
198
250
  export declare const DataTable: typeof DataTableComponent & {
199
251
  Pagination: typeof DataTablePagination;
200
252
  };