@calcifer-design/ui 0.4.0 → 0.6.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 (133) hide show
  1. package/dist/components/Breadcrumb/Breadcrumb.d.ts +24 -0
  2. package/dist/components/Breadcrumb/Breadcrumb.js +48 -0
  3. package/dist/components/Breadcrumb/Breadcrumb.module.js +10 -0
  4. package/dist/components/Breadcrumb/Breadcrumb_module.css +49 -0
  5. package/dist/components/CardList/CardList.d.ts +30 -0
  6. package/dist/components/CardList/CardList.js +35 -0
  7. package/dist/components/CardList/CardList.module.js +7 -0
  8. package/dist/components/CardList/CardList_module.css +20 -0
  9. package/dist/components/DataGrid/DataGrid.d.ts +3 -0
  10. package/dist/components/DataGrid/DataGrid.js +436 -0
  11. package/dist/components/DataGrid/DataGrid.module.js +36 -0
  12. package/dist/components/DataGrid/DataGrid_module.css +367 -0
  13. package/dist/components/DataGrid/GridCardHeader.d.ts +16 -0
  14. package/dist/components/DataGrid/GridCardHeader.js +40 -0
  15. package/dist/components/DataGrid/GridCheckbox.d.ts +15 -0
  16. package/dist/components/DataGrid/GridCheckbox.js +25 -0
  17. package/dist/components/DataGrid/GridHeaderCell.d.ts +14 -0
  18. package/dist/components/DataGrid/GridHeaderCell.js +29 -0
  19. package/dist/components/DataGrid/GridHeaderRow.d.ts +35 -0
  20. package/dist/components/DataGrid/GridHeaderRow.js +56 -0
  21. package/dist/components/DataGrid/GridRow.d.ts +69 -0
  22. package/dist/components/DataGrid/GridRow.js +139 -0
  23. package/dist/components/DataGrid/GridStateRows.d.ts +24 -0
  24. package/dist/components/DataGrid/GridStateRows.js +59 -0
  25. package/dist/components/DataGrid/columns.d.ts +40 -0
  26. package/dist/components/DataGrid/columns.js +37 -0
  27. package/dist/components/DataGrid/labels.d.ts +20 -0
  28. package/dist/components/DataGrid/labels.js +25 -0
  29. package/dist/components/DataGrid/types.d.ts +88 -0
  30. package/dist/components/DataGrid/types.js +0 -0
  31. package/dist/components/DataGrid/useGridEntries.d.ts +17 -0
  32. package/dist/components/DataGrid/useGridEntries.js +40 -0
  33. package/dist/components/DataGrid/useGridHighlight.d.ts +16 -0
  34. package/dist/components/DataGrid/useGridHighlight.js +24 -0
  35. package/dist/components/DataGrid/useGridKeyboard.d.ts +50 -0
  36. package/dist/components/DataGrid/useGridKeyboard.js +242 -0
  37. package/dist/components/DataGrid/useGridMetrics.d.ts +13 -0
  38. package/dist/components/DataGrid/useGridMetrics.js +35 -0
  39. package/dist/components/DataGrid/useLatest.d.ts +7 -0
  40. package/dist/components/DataGrid/useLatest.js +9 -0
  41. package/dist/components/DataGrid/useLoadMore.d.ts +30 -0
  42. package/dist/components/DataGrid/useLoadMore.js +39 -0
  43. package/dist/components/DataGrid/useRowExpansion.d.ts +14 -0
  44. package/dist/components/DataGrid/useRowExpansion.js +21 -0
  45. package/dist/components/DataGrid/useRowSelection.d.ts +43 -0
  46. package/dist/components/DataGrid/useRowSelection.js +107 -0
  47. package/dist/components/DatePicker/Calendar.d.ts +19 -0
  48. package/dist/components/DatePicker/Calendar.js +207 -0
  49. package/dist/components/DatePicker/DatePicker.d.ts +72 -0
  50. package/dist/components/DatePicker/DatePicker.js +116 -0
  51. package/dist/components/DatePicker/DatePicker.module.js +14 -0
  52. package/dist/components/DatePicker/DatePicker_module.css +112 -0
  53. package/dist/components/DatePicker/calendarDate.d.ts +46 -0
  54. package/dist/components/DatePicker/calendarDate.js +117 -0
  55. package/dist/components/Descriptions/Descriptions.d.ts +25 -0
  56. package/dist/components/Descriptions/Descriptions.js +44 -0
  57. package/dist/components/Descriptions/Descriptions.module.js +8 -0
  58. package/dist/components/Descriptions/Descriptions_module.css +47 -0
  59. package/dist/components/Field/Field.d.ts +1 -1
  60. package/dist/components/Field/Field.js +7 -1
  61. package/dist/components/Field/PickerField.d.ts +41 -0
  62. package/dist/components/Field/PickerField.js +115 -0
  63. package/dist/components/Field/PickerField.module.js +8 -0
  64. package/dist/components/Field/PickerField_module.css +36 -0
  65. package/dist/components/FilterBar/FilterBar.d.ts +55 -0
  66. package/dist/components/FilterBar/FilterBar.js +138 -0
  67. package/dist/components/FilterBar/FilterBar.module.js +13 -0
  68. package/dist/components/FilterBar/FilterBar_module.css +98 -0
  69. package/dist/components/Form/Form.d.ts +48 -0
  70. package/dist/components/Form/Form.js +38 -0
  71. package/dist/components/Form/Form.module.js +5 -0
  72. package/dist/components/Form/FormContext.d.ts +15 -0
  73. package/dist/components/Form/FormContext.js +20 -0
  74. package/dist/components/Form/Form_module.css +6 -0
  75. package/dist/components/PageShell/PageShell.d.ts +27 -0
  76. package/dist/components/PageShell/PageShell.js +35 -0
  77. package/dist/components/PageShell/PageShell.module.js +9 -0
  78. package/dist/components/PageShell/PageShell_module.css +56 -0
  79. package/dist/components/Segmented/Segmented.d.ts +49 -0
  80. package/dist/components/Segmented/Segmented.js +55 -0
  81. package/dist/components/Segmented/Segmented.module.js +7 -0
  82. package/dist/components/Segmented/Segmented_module.css +75 -0
  83. package/dist/components/Steps/Steps.d.ts +30 -0
  84. package/dist/components/Steps/Steps.js +63 -0
  85. package/dist/components/Steps/Steps.module.js +10 -0
  86. package/dist/components/Steps/Steps_module.css +126 -0
  87. package/dist/components/TextArea/TextArea.d.ts +16 -0
  88. package/dist/components/TextArea/TextArea.js +28 -0
  89. package/dist/components/TextArea/TextArea.module.js +5 -0
  90. package/dist/components/TextArea/TextArea_module.css +12 -0
  91. package/dist/components/TimePicker/TimePicker.d.ts +19 -0
  92. package/dist/components/TimePicker/TimePicker.js +17 -0
  93. package/dist/components/Timeline/Timeline.d.ts +39 -0
  94. package/dist/components/Timeline/Timeline.js +109 -0
  95. package/dist/components/Timeline/Timeline.module.js +12 -0
  96. package/dist/components/Timeline/Timeline_module.css +99 -0
  97. package/dist/components/Toolbar/InsideToolbarContext.d.ts +6 -0
  98. package/dist/components/Toolbar/InsideToolbarContext.js +3 -0
  99. package/dist/components/Toolbar/Toolbar.d.ts +46 -0
  100. package/dist/components/Toolbar/Toolbar.js +43 -0
  101. package/dist/components/Toolbar/Toolbar.module.js +7 -0
  102. package/dist/components/Toolbar/Toolbar_module.css +26 -0
  103. package/dist/components/Tree/Tree.d.ts +81 -0
  104. package/dist/components/Tree/Tree.js +232 -0
  105. package/dist/components/Tree/Tree.module.js +12 -0
  106. package/dist/components/Tree/Tree_module.css +124 -0
  107. package/dist/components/Tree/treeIndex.d.ts +23 -0
  108. package/dist/components/Tree/treeIndex.js +33 -0
  109. package/dist/components/TreeSelect/TreeSelect.d.ts +61 -0
  110. package/dist/components/TreeSelect/TreeSelect.js +117 -0
  111. package/dist/components/TreeSelect/TreeSelect.module.js +7 -0
  112. package/dist/components/TreeSelect/TreeSelect_module.css +22 -0
  113. package/dist/components/Upload/Upload.d.ts +66 -0
  114. package/dist/components/Upload/Upload.js +287 -0
  115. package/dist/components/Upload/Upload.module.js +12 -0
  116. package/dist/components/Upload/Upload_module.css +96 -0
  117. package/dist/components/ViewField/ViewField.d.ts +26 -0
  118. package/dist/components/ViewField/ViewField.js +29 -0
  119. package/dist/components/ViewField/ViewField.module.js +6 -0
  120. package/dist/components/ViewField/ViewField_module.css +17 -0
  121. package/dist/hooks/useFormReset.d.ts +10 -0
  122. package/dist/hooks/useFormReset.js +34 -0
  123. package/dist/icons/CalendarIcon.d.ts +2 -0
  124. package/dist/icons/CalendarIcon.js +26 -0
  125. package/dist/icons/ChevronRightIcon.d.ts +6 -0
  126. package/dist/icons/ChevronRightIcon.js +17 -0
  127. package/dist/icons/RefreshIcon.d.ts +6 -0
  128. package/dist/icons/RefreshIcon.js +22 -0
  129. package/dist/index.d.ts +39 -0
  130. package/dist/index.js +19 -0
  131. package/dist/styles/pair.module.js +6 -0
  132. package/dist/styles/pair_module.css +18 -0
  133. package/package.json +4 -3
@@ -0,0 +1,36 @@
1
+ import "./DataGrid_module.css";
2
+ const DataGrid_module = {
3
+ card: "card-sKuGs",
4
+ header: "header-FnSmG",
5
+ heading: "heading-cO1_Q",
6
+ cluster: "cluster-FC5NS",
7
+ actions: "actions-_1Hpt",
8
+ scroll: "scroll-FzUQa",
9
+ fill: "fill-gnSOL",
10
+ scrollFill: "scrollFill-ouKju",
11
+ table: "table-sZLxO",
12
+ head: "head-z5Rnq",
13
+ headerCell: "headerCell-CgaE0",
14
+ sortIcon: "sortIcon-aw3qW",
15
+ row: "row-OLZkz",
16
+ cell: "cell-TYnuY",
17
+ pinnedHeader: "pinnedHeader-b7R5T",
18
+ pinnedCell: "pinnedCell-hktdQ",
19
+ selectHeader: "selectHeader-ysJFY",
20
+ selectCell: "selectCell-WkrzU",
21
+ expandHeader: "expandHeader-xZuaw",
22
+ expandCell: "expandCell-nB87K",
23
+ expandButton: "expandButton-gnwRu",
24
+ actionsHeader: "actionsHeader-DXNJS",
25
+ actionsCell: "actionsCell-XmWDR",
26
+ detailRow: "detailRow-WsOl1",
27
+ detailCell: "detailCell-y4qyE",
28
+ errorCell: "errorCell-m9Gxy",
29
+ errorContent: "errorContent-_tmon",
30
+ stateCell: "stateCell-_44Lv",
31
+ state: "state-WLbKa",
32
+ spacerCell: "spacerCell-IoOYY",
33
+ footer: "footer-pI1Q7",
34
+ rowCount: "rowCount-M_Nba"
35
+ };
36
+ export default DataGrid_module;
@@ -0,0 +1,367 @@
1
+ .card-sKuGs {
2
+ background: var(--color-surface-raised);
3
+ border: 1px solid var(--color-card-border);
4
+ border-radius: var(--radius-lg);
5
+ min-width: 0;
6
+ box-shadow: var(--elevation-1);
7
+ flex-direction: column;
8
+ display: flex;
9
+ overflow: hidden;
10
+ }
11
+
12
+ .header-FnSmG {
13
+ justify-content: space-between;
14
+ align-items: center;
15
+ gap: var(--space-3);
16
+ padding: var(--space-3) var(--space-5);
17
+ flex-wrap: wrap;
18
+ display: flex;
19
+ }
20
+
21
+ .heading-cO1_Q {
22
+ white-space: nowrap;
23
+ font-size: var(--text-md);
24
+ color: var(--color-text);
25
+ margin: 0;
26
+ font-weight: 600;
27
+ }
28
+
29
+ .cluster-FC5NS {
30
+ justify-content: flex-end;
31
+ align-items: center;
32
+ gap: var(--space-2);
33
+ flex-wrap: wrap;
34
+ margin-inline-start: auto;
35
+ display: flex;
36
+ }
37
+
38
+ .actions-_1Hpt {
39
+ align-items: center;
40
+ gap: var(--space-2);
41
+ flex-wrap: wrap;
42
+ display: flex;
43
+ }
44
+
45
+ .scroll-FzUQa {
46
+ max-height: calc(100dvh - var(--space-10) * 2);
47
+ overflow: auto;
48
+ }
49
+
50
+ .fill-gnSOL {
51
+ height: 100%;
52
+ }
53
+
54
+ .scrollFill-ouKju {
55
+ flex: 1 1 0;
56
+ min-height: 0;
57
+ max-height: none;
58
+ }
59
+
60
+ .table-sZLxO {
61
+ border-collapse: collapse;
62
+ width: 100%;
63
+ font-size: var(--text-sm);
64
+ font-variant-numeric: tabular-nums;
65
+ }
66
+
67
+ .head-z5Rnq {
68
+ z-index: 1;
69
+ background: var(--color-surface-1);
70
+ position: sticky;
71
+ inset-block-start: 0;
72
+ }
73
+
74
+ .headerCell-CgaE0 {
75
+ padding: var(--space-2) var(--space-3);
76
+ text-align: start;
77
+ font-size: var(--text-sm);
78
+ color: var(--color-text-muted);
79
+ white-space: nowrap;
80
+ font-weight: 600;
81
+ position: relative;
82
+ }
83
+
84
+ .headerCell-CgaE0:before, .headerCell-CgaE0:after {
85
+ content: "";
86
+ border-block-start: 1px solid var(--color-border);
87
+ pointer-events: none;
88
+ position: absolute;
89
+ inset-inline: 0;
90
+ }
91
+
92
+ .headerCell-CgaE0:before {
93
+ inset-block-start: 0;
94
+ }
95
+
96
+ .headerCell-CgaE0:after {
97
+ inset-block-end: 0;
98
+ }
99
+
100
+ .headerCell-CgaE0[data-sortable] {
101
+ cursor: pointer;
102
+ -webkit-user-select: none;
103
+ user-select: none;
104
+ }
105
+
106
+ .sortIcon-aw3qW {
107
+ margin-inline-start: var(--space-1);
108
+ }
109
+
110
+ .sortIcon-aw3qW:after {
111
+ content: "↕";
112
+ color: var(--color-text-subtle);
113
+ }
114
+
115
+ .sortIcon-aw3qW[data-direction="asc"]:after {
116
+ content: "↑";
117
+ color: var(--color-link);
118
+ }
119
+
120
+ .sortIcon-aw3qW[data-direction="desc"]:after {
121
+ content: "↓";
122
+ color: var(--color-link);
123
+ }
124
+
125
+ .row-OLZkz {
126
+ border-bottom: 1px solid var(--color-border);
127
+ transition-property: background-color;
128
+ transition-duration: var(--motion-duration-1);
129
+ transition-timing-function: var(--motion-ease);
130
+ }
131
+
132
+ .row-OLZkz:last-child {
133
+ border-bottom: 0;
134
+ }
135
+
136
+ @media (hover: hover) {
137
+ .row-OLZkz:hover {
138
+ background: var(--color-surface-2);
139
+ }
140
+ }
141
+
142
+ .row-OLZkz[data-clickable] {
143
+ cursor: pointer;
144
+ }
145
+
146
+ .row-OLZkz[data-highlighted], .row-OLZkz[aria-selected="true"] {
147
+ background: var(--color-accent-wash);
148
+ }
149
+
150
+ @media (hover: hover) {
151
+ .row-OLZkz[data-highlighted]:hover, .row-OLZkz[aria-selected="true"]:hover {
152
+ background: var(--color-accent-soft);
153
+ }
154
+ }
155
+
156
+ @media (forced-colors: active) {
157
+ .row-OLZkz[data-highlighted], .row-OLZkz[aria-selected="true"] {
158
+ outline-style: solid;
159
+ outline-width: var(--focus-ring-width);
160
+ outline-offset: calc(var(--focus-ring-width) * -1);
161
+ }
162
+ }
163
+
164
+ .cell-TYnuY {
165
+ min-width: calc(var(--space-3) * 5);
166
+ padding: var(--space-3);
167
+ vertical-align: middle;
168
+ color: var(--color-text);
169
+ overflow-wrap: anywhere;
170
+ }
171
+
172
+ .headerCell-CgaE0:first-child, .cell-TYnuY:first-child {
173
+ padding-inline-start: var(--space-5);
174
+ }
175
+
176
+ .headerCell-CgaE0:last-child, .cell-TYnuY:last-child {
177
+ padding-inline-end: var(--space-5);
178
+ }
179
+
180
+ .headerCell-CgaE0.pinnedHeader-b7R5T, .cell-TYnuY.pinnedCell-hktdQ {
181
+ text-align: center;
182
+ padding-inline: 0;
183
+ position: sticky;
184
+ }
185
+
186
+ .headerCell-CgaE0.pinnedHeader-b7R5T {
187
+ z-index: 1;
188
+ background: var(--color-surface-1);
189
+ }
190
+
191
+ .cell-TYnuY.pinnedCell-hktdQ {
192
+ background-color: var(--color-surface-raised);
193
+ }
194
+
195
+ @media (hover: hover) {
196
+ .row-OLZkz:hover .cell-TYnuY.pinnedCell-hktdQ {
197
+ background-image: linear-gradient(var(--color-surface-2), var(--color-surface-2));
198
+ }
199
+ }
200
+
201
+ .row-OLZkz[data-highlighted] .cell-TYnuY.pinnedCell-hktdQ, .row-OLZkz[aria-selected="true"] .cell-TYnuY.pinnedCell-hktdQ {
202
+ background-image: linear-gradient(var(--color-accent-wash), var(--color-accent-wash));
203
+ }
204
+
205
+ @media (hover: hover) {
206
+ .row-OLZkz[data-highlighted]:hover .cell-TYnuY.pinnedCell-hktdQ, .row-OLZkz[aria-selected="true"]:hover .cell-TYnuY.pinnedCell-hktdQ {
207
+ background-image: linear-gradient(var(--color-accent-soft), var(--color-accent-soft));
208
+ }
209
+ }
210
+
211
+ .headerCell-CgaE0.selectHeader-ysJFY, .cell-TYnuY.selectCell-WkrzU {
212
+ width: calc(var(--space-2) * 5);
213
+ min-width: calc(var(--space-2) * 5);
214
+ max-width: calc(var(--space-2) * 5);
215
+ inset-inline-start: 0;
216
+ }
217
+
218
+ .headerCell-CgaE0.expandHeader-xZuaw, .cell-TYnuY.expandCell-nB87K {
219
+ width: calc(var(--space-5) + var(--space-1));
220
+ min-width: calc(var(--space-5) + var(--space-1));
221
+ max-width: calc(var(--space-5) + var(--space-1));
222
+ inset-inline-start: 0;
223
+ }
224
+
225
+ .selectHeader-ysJFY + .expandHeader-xZuaw, .selectCell-WkrzU + .expandCell-nB87K {
226
+ inset-inline-start: calc(var(--space-2) * 5);
227
+ }
228
+
229
+ .expandButton-gnwRu {
230
+ width: var(--space-5);
231
+ height: var(--space-5);
232
+ border-radius: var(--radius-sm);
233
+ color: var(--color-text-muted);
234
+ cursor: pointer;
235
+ background: none;
236
+ border: 0;
237
+ justify-content: center;
238
+ align-items: center;
239
+ padding: 0;
240
+ display: inline-flex;
241
+ }
242
+
243
+ .expandButton-gnwRu:focus-visible {
244
+ outline: var(--focus-ring-width) solid var(--color-focus);
245
+ outline-offset: calc(var(--focus-ring-width) * -1);
246
+ }
247
+
248
+ .expandButton-gnwRu svg {
249
+ width: var(--space-4);
250
+ height: var(--space-4);
251
+ transition-property: rotate;
252
+ transition-duration: var(--motion-duration-1);
253
+ transition-timing-function: var(--motion-ease);
254
+ }
255
+
256
+ .expandButton-gnwRu[aria-expanded="true"] svg {
257
+ rotate: 90deg;
258
+ }
259
+
260
+ .table-sZLxO[data-rtl] .expandButton-gnwRu svg {
261
+ scale: -1 1;
262
+ }
263
+
264
+ .table-sZLxO[data-rtl] .expandButton-gnwRu[aria-expanded="true"] svg {
265
+ rotate: -90deg;
266
+ }
267
+
268
+ @media (prefers-reduced-motion: reduce) {
269
+ .expandButton-gnwRu svg {
270
+ transition: none;
271
+ }
272
+ }
273
+
274
+ .headerCell-CgaE0.actionsHeader-DXNJS, .cell-TYnuY.actionsCell-XmWDR {
275
+ width: calc(var(--space-5) * 3);
276
+ min-width: calc(var(--space-5) * 3);
277
+ max-width: calc(var(--space-5) * 3);
278
+ inset-inline-end: 0;
279
+ }
280
+
281
+ .cell-TYnuY.actionsCell-XmWDR:before {
282
+ content: "";
283
+ border-inline-start: 1px solid var(--color-border);
284
+ pointer-events: none;
285
+ position: absolute;
286
+ inset-block: 0;
287
+ inset-inline-start: 0;
288
+ }
289
+
290
+ .headerCell-CgaE0.actionsHeader-DXNJS:after {
291
+ border-inline-start: 1px solid var(--color-border);
292
+ border-block-end: 1px solid var(--color-border);
293
+ inset-block-start: 0;
294
+ }
295
+
296
+ .detailRow-WsOl1 {
297
+ border-block: 1px solid var(--color-border);
298
+ }
299
+
300
+ .detailCell-y4qyE {
301
+ padding: var(--space-3) var(--space-4);
302
+ background: var(--color-surface-1);
303
+ color: var(--color-text);
304
+ }
305
+
306
+ .errorCell-m9Gxy {
307
+ padding: var(--space-3) var(--space-5);
308
+ text-align: center;
309
+ color: var(--color-text);
310
+ }
311
+
312
+ .errorContent-_tmon {
313
+ justify-content: center;
314
+ align-items: center;
315
+ gap: var(--space-3);
316
+ flex-wrap: wrap;
317
+ display: flex;
318
+ }
319
+
320
+ .headerCell-CgaE0:focus-visible, .cell-TYnuY:focus-visible, .detailCell-y4qyE:focus-visible, .errorCell-m9Gxy:focus-visible {
321
+ outline: var(--focus-ring-width) solid var(--color-focus);
322
+ outline-offset: calc(var(--focus-ring-width) * -1);
323
+ }
324
+
325
+ .table-sZLxO[data-density="compact"] .cell-TYnuY {
326
+ padding-block: var(--space-2);
327
+ }
328
+
329
+ .table-sZLxO[data-density="compact"] .cell-TYnuY:not(.pinnedCell-hktdQ) {
330
+ text-overflow: ellipsis;
331
+ white-space: nowrap;
332
+ max-width: 0;
333
+ overflow: hidden;
334
+ }
335
+
336
+ .stateCell-_44Lv {
337
+ padding: var(--space-8) var(--space-5);
338
+ text-align: center;
339
+ color: var(--color-text-muted);
340
+ }
341
+
342
+ .state-WLbKa {
343
+ justify-content: center;
344
+ align-items: center;
345
+ gap: var(--space-3);
346
+ display: flex;
347
+ }
348
+
349
+ .spacerCell-IoOYY {
350
+ border: 0;
351
+ padding: 0;
352
+ }
353
+
354
+ .footer-pI1Q7 {
355
+ align-items: center;
356
+ gap: var(--space-3);
357
+ padding: var(--space-2) var(--space-5);
358
+ border-block-start: 1px solid var(--color-border);
359
+ font-size: var(--text-xs);
360
+ color: var(--color-text-muted);
361
+ display: flex;
362
+ }
363
+
364
+ .rowCount-M_Nba {
365
+ margin-inline-start: auto;
366
+ }
367
+
@@ -0,0 +1,16 @@
1
+ import type { RowData } from '@tanstack/react-table';
2
+ import type { ReactNode } from 'react';
3
+ import type { DataGridProps } from './types.js';
4
+ export interface GridCardHeaderProps {
5
+ heading: string;
6
+ headingLevel: NonNullable<DataGridProps<RowData>['headingLevel']>;
7
+ /** Names the card and the grid inside it. */
8
+ headingId: string;
9
+ actions?: ReactNode;
10
+ onRefresh?: () => void;
11
+ refreshing: boolean;
12
+ toolbarLabel: string;
13
+ refreshLabel: string;
14
+ }
15
+ /** The card's heading, with the refresh button and the consumer's actions beside it. */
16
+ export declare function GridCardHeader({ heading, headingLevel, headingId, actions, onRefresh, refreshing, toolbarLabel, refreshLabel, }: GridCardHeaderProps): import("react").JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { RefreshIcon } from "../../icons/RefreshIcon.js";
3
+ import { IconButton } from "../IconButton/IconButton.js";
4
+ import { Toolbar, ToolbarButton } from "../Toolbar/Toolbar.js";
5
+ import DataGrid_module from "./DataGrid.module.js";
6
+ function GridCardHeader({ heading, headingLevel, headingId, actions, onRefresh, refreshing, toolbarLabel, refreshLabel }) {
7
+ const HeadingTag = `h${headingLevel}`;
8
+ return /*#__PURE__*/ jsxs("header", {
9
+ className: DataGrid_module.header,
10
+ children: [
11
+ /*#__PURE__*/ jsx(HeadingTag, {
12
+ id: headingId,
13
+ className: DataGrid_module.heading,
14
+ children: heading
15
+ }),
16
+ onRefresh || actions ? /*#__PURE__*/ jsxs("div", {
17
+ className: DataGrid_module.cluster,
18
+ children: [
19
+ onRefresh ? /*#__PURE__*/ jsx(Toolbar, {
20
+ "aria-label": toolbarLabel,
21
+ children: /*#__PURE__*/ jsx(ToolbarButton, {
22
+ loading: refreshing,
23
+ onClick: ()=>onRefresh(),
24
+ render: /*#__PURE__*/ jsx(IconButton, {
25
+ label: refreshLabel,
26
+ size: "sm",
27
+ children: /*#__PURE__*/ jsx(RefreshIcon, {})
28
+ })
29
+ })
30
+ }) : null,
31
+ actions ? /*#__PURE__*/ jsx("div", {
32
+ className: DataGrid_module.actions,
33
+ children: actions
34
+ }) : null
35
+ ]
36
+ }) : null
37
+ ]
38
+ });
39
+ }
40
+ export { GridCardHeader };
@@ -0,0 +1,15 @@
1
+ export interface GridCheckboxProps {
2
+ /** The checkbox's accessible name. There is no visible label. */
3
+ label: string;
4
+ checked: boolean;
5
+ /** Neither ticked nor unticked: the state of select-all over a partial selection. */
6
+ indeterminate?: boolean;
7
+ disabled?: boolean;
8
+ onCheckedChange: (checked: boolean) => void;
9
+ tabIndex?: number;
10
+ }
11
+ /**
12
+ * The bare checkbox of the selection column: `Checkbox` without its field row and label, which a
13
+ * grid cell has no room for.
14
+ */
15
+ export declare function GridCheckbox({ label, checked, indeterminate, disabled, onCheckedChange, tabIndex, }: GridCheckboxProps): import("react").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Checkbox } from "@base-ui/react/checkbox";
3
+ import { CheckIcon } from "../../icons/CheckIcon.js";
4
+ import { MinusIcon } from "../../icons/MinusIcon.js";
5
+ import field_module from "../../styles/field.module.js";
6
+ import Checkbox_module from "../Checkbox/Checkbox.module.js";
7
+ function GridCheckbox({ label, checked, indeterminate = false, disabled = false, onCheckedChange, tabIndex }) {
8
+ return /*#__PURE__*/ jsx(Checkbox.Root, {
9
+ className: [
10
+ field_module.controlBox,
11
+ Checkbox_module.box
12
+ ].join(' '),
13
+ "aria-label": label,
14
+ checked: checked,
15
+ indeterminate: indeterminate,
16
+ disabled: disabled,
17
+ tabIndex: tabIndex,
18
+ onCheckedChange: (nextChecked)=>onCheckedChange(nextChecked),
19
+ children: /*#__PURE__*/ jsx(Checkbox.Indicator, {
20
+ className: Checkbox_module.indicator,
21
+ children: indeterminate ? /*#__PURE__*/ jsx(MinusIcon, {}) : /*#__PURE__*/ jsx(CheckIcon, {})
22
+ })
23
+ });
24
+ }
25
+ export { GridCheckbox };
@@ -0,0 +1,14 @@
1
+ import { type Header, type RowData } from '@tanstack/react-table';
2
+ import type { DataGridFeatures } from './columns.js';
3
+ import type { GridCellProps } from './useGridKeyboard.js';
4
+ export interface GridHeaderCellProps<Row extends RowData> {
5
+ header: Header<DataGridFeatures, Row, unknown>;
6
+ /** Counted from 1 across every rendered column. */
7
+ ariaColIndex: number;
8
+ cellProps: GridCellProps;
9
+ }
10
+ /**
11
+ * A column's header cell. The cell is the sort control: a click sorts, and so does Enter. A column
12
+ * that cannot sort claims no sort order, whatever the sorting state says.
13
+ */
14
+ export declare function GridHeaderCell<Row extends RowData>({ header, ariaColIndex, cellProps, }: GridHeaderCellProps<Row>): import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { flexRender } from "@tanstack/react-table";
3
+ import DataGrid_module from "./DataGrid.module.js";
4
+ const ariaSortByDirection = {
5
+ asc: 'ascending',
6
+ desc: 'descending'
7
+ };
8
+ function GridHeaderCell({ header, ariaColIndex, cellProps }) {
9
+ const canSort = header.column.getCanSort();
10
+ const sortDirection = canSort && header.column.getIsSorted();
11
+ return /*#__PURE__*/ jsxs("th", {
12
+ scope: "col",
13
+ className: DataGrid_module.headerCell,
14
+ "aria-colindex": ariaColIndex,
15
+ "aria-sort": sortDirection ? ariaSortByDirection[sortDirection] : void 0,
16
+ "data-sortable": canSort ? '' : void 0,
17
+ onClick: canSort ? header.column.getToggleSortingHandler() : void 0,
18
+ ...cellProps,
19
+ children: [
20
+ flexRender(header.column.columnDef.header, header.getContext()),
21
+ canSort ? /*#__PURE__*/ jsx("span", {
22
+ "aria-hidden": "true",
23
+ className: DataGrid_module.sortIcon,
24
+ "data-direction": sortDirection || 'none'
25
+ }) : null
26
+ ]
27
+ });
28
+ }
29
+ export { GridHeaderCell };
@@ -0,0 +1,35 @@
1
+ import type { Header, RowData } from '@tanstack/react-table';
2
+ import type { ReactNode } from 'react';
3
+ import type { DataGridFeatures } from './columns.js';
4
+ import type { GetCellProps } from './useGridKeyboard.js';
5
+ export interface GridHeaderSelectAll {
6
+ label: string;
7
+ checked: boolean;
8
+ /** Some rows are selected, but not all. */
9
+ indeterminate: boolean;
10
+ disabled: boolean;
11
+ onCheckedChange: () => void;
12
+ }
13
+ export interface GridHeaderRowActions {
14
+ /** The consumer's header for the column; when it is empty, `label` names the column unseen. */
15
+ header: ReactNode;
16
+ label: string;
17
+ }
18
+ export interface GridHeaderRowProps<Row extends RowData> {
19
+ headers: Header<DataGridFeatures, Row, unknown>[];
20
+ columnCount: number;
21
+ /** The columns the grid renders before the row's own cells. */
22
+ columnOffset: number;
23
+ /** The checkbox column's select-all cell; absent without checkbox selection. */
24
+ selectAll?: GridHeaderSelectAll;
25
+ /** The expand column's unseen name; absent without expandable rows. */
26
+ expandLabel?: string;
27
+ /** The row actions column's header cell; absent without one. */
28
+ rowActions?: GridHeaderRowActions;
29
+ getCellProps: GetCellProps;
30
+ }
31
+ /**
32
+ * The header row, keyboard row 0: the select-all cell when rows are selectable, the expand column's
33
+ * header when they expand, the columns' own headers, then the row actions header.
34
+ */
35
+ export declare function GridHeaderRow<Row extends RowData>({ headers, columnCount, columnOffset, selectAll, expandLabel, rowActions, getCellProps, }: GridHeaderRowProps<Row>): import("react").JSX.Element;
@@ -0,0 +1,56 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import a11y_module from "../../styles/a11y.module.js";
3
+ import DataGrid_module from "./DataGrid.module.js";
4
+ import { GridCheckbox } from "./GridCheckbox.js";
5
+ import { GridHeaderCell } from "./GridHeaderCell.js";
6
+ function isEmptyNode(node) {
7
+ return null == node || false === node || '' === node;
8
+ }
9
+ function GridHeaderRow({ headers, columnCount, columnOffset, selectAll, expandLabel, rowActions, getCellProps }) {
10
+ const expandColumn = selectAll ? 1 : 0;
11
+ return /*#__PURE__*/ jsxs("tr", {
12
+ "aria-rowindex": 1,
13
+ children: [
14
+ selectAll ? /*#__PURE__*/ jsx("th", {
15
+ scope: "col",
16
+ className: `${DataGrid_module.headerCell} ${DataGrid_module.pinnedHeader} ${DataGrid_module.selectHeader}`,
17
+ "aria-colindex": 1,
18
+ ...getCellProps(0, 0),
19
+ children: /*#__PURE__*/ jsx(GridCheckbox, {
20
+ label: selectAll.label,
21
+ checked: selectAll.checked,
22
+ indeterminate: selectAll.indeterminate,
23
+ disabled: selectAll.disabled,
24
+ onCheckedChange: selectAll.onCheckedChange,
25
+ tabIndex: -1
26
+ })
27
+ }) : null,
28
+ void 0 !== expandLabel ? /*#__PURE__*/ jsx("th", {
29
+ scope: "col",
30
+ className: `${DataGrid_module.headerCell} ${DataGrid_module.pinnedHeader} ${DataGrid_module.expandHeader}`,
31
+ "aria-colindex": expandColumn + 1,
32
+ ...getCellProps(0, expandColumn),
33
+ children: /*#__PURE__*/ jsx("span", {
34
+ className: a11y_module.visuallyHidden,
35
+ children: expandLabel
36
+ })
37
+ }) : null,
38
+ headers.map((header, columnIndex)=>/*#__PURE__*/ jsx(GridHeaderCell, {
39
+ header: header,
40
+ ariaColIndex: columnIndex + 1 + columnOffset,
41
+ cellProps: getCellProps(0, columnIndex + columnOffset)
42
+ }, header.id)),
43
+ rowActions ? /*#__PURE__*/ jsx("th", {
44
+ scope: "col",
45
+ className: `${DataGrid_module.headerCell} ${DataGrid_module.pinnedHeader} ${DataGrid_module.actionsHeader}`,
46
+ "aria-colindex": columnCount,
47
+ ...getCellProps(0, columnCount - 1),
48
+ children: isEmptyNode(rowActions.header) ? /*#__PURE__*/ jsx("span", {
49
+ className: a11y_module.visuallyHidden,
50
+ children: rowActions.label
51
+ }) : rowActions.header
52
+ }) : null
53
+ ]
54
+ });
55
+ }
56
+ export { GridHeaderRow };