@calcifer-design/ui 0.5.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.
- package/dist/components/DataGrid/DataGrid.d.ts +3 -0
- package/dist/components/DataGrid/DataGrid.js +436 -0
- package/dist/components/DataGrid/DataGrid.module.js +36 -0
- package/dist/components/DataGrid/DataGrid_module.css +367 -0
- package/dist/components/DataGrid/GridCardHeader.d.ts +16 -0
- package/dist/components/DataGrid/GridCardHeader.js +40 -0
- package/dist/components/DataGrid/GridCheckbox.d.ts +15 -0
- package/dist/components/DataGrid/GridCheckbox.js +25 -0
- package/dist/components/DataGrid/GridHeaderCell.d.ts +14 -0
- package/dist/components/DataGrid/GridHeaderCell.js +29 -0
- package/dist/components/DataGrid/GridHeaderRow.d.ts +35 -0
- package/dist/components/DataGrid/GridHeaderRow.js +56 -0
- package/dist/components/DataGrid/GridRow.d.ts +69 -0
- package/dist/components/DataGrid/GridRow.js +139 -0
- package/dist/components/DataGrid/GridStateRows.d.ts +24 -0
- package/dist/components/DataGrid/GridStateRows.js +59 -0
- package/dist/components/DataGrid/columns.d.ts +40 -0
- package/dist/components/DataGrid/columns.js +37 -0
- package/dist/components/DataGrid/labels.d.ts +20 -0
- package/dist/components/DataGrid/labels.js +25 -0
- package/dist/components/DataGrid/types.d.ts +88 -0
- package/dist/components/DataGrid/types.js +0 -0
- package/dist/components/DataGrid/useGridEntries.d.ts +17 -0
- package/dist/components/DataGrid/useGridEntries.js +40 -0
- package/dist/components/DataGrid/useGridHighlight.d.ts +16 -0
- package/dist/components/DataGrid/useGridHighlight.js +24 -0
- package/dist/components/DataGrid/useGridKeyboard.d.ts +50 -0
- package/dist/components/DataGrid/useGridKeyboard.js +242 -0
- package/dist/components/DataGrid/useGridMetrics.d.ts +13 -0
- package/dist/components/DataGrid/useGridMetrics.js +35 -0
- package/dist/components/DataGrid/useLatest.d.ts +7 -0
- package/dist/components/DataGrid/useLatest.js +9 -0
- package/dist/components/DataGrid/useLoadMore.d.ts +30 -0
- package/dist/components/DataGrid/useLoadMore.js +39 -0
- package/dist/components/DataGrid/useRowExpansion.d.ts +14 -0
- package/dist/components/DataGrid/useRowExpansion.js +21 -0
- package/dist/components/DataGrid/useRowSelection.d.ts +43 -0
- package/dist/components/DataGrid/useRowSelection.js +107 -0
- package/dist/icons/ChevronRightIcon.d.ts +6 -0
- package/dist/icons/ChevronRightIcon.js +17 -0
- package/dist/icons/RefreshIcon.d.ts +6 -0
- package/dist/icons/RefreshIcon.js +22 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -0
- package/package.json +3 -2
|
@@ -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 };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type Row as TableRow, type RowData } from '@tanstack/react-table';
|
|
2
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
3
|
+
import { type DataGridFeatures } from './columns.js';
|
|
4
|
+
import type { DataGridDensity } from './types.js';
|
|
5
|
+
import { type GetCellProps } from './useGridKeyboard.js';
|
|
6
|
+
export interface GridRowCheckbox {
|
|
7
|
+
label: string;
|
|
8
|
+
selected: boolean;
|
|
9
|
+
selectable: boolean;
|
|
10
|
+
onCheckedChange: () => void;
|
|
11
|
+
/** Capture-phase click handler for the checkbox cell. */
|
|
12
|
+
onClickCapture: (event: MouseEvent<HTMLElement>) => void;
|
|
13
|
+
/** A click on the cell around the checkbox, which toggles the row as the checkbox would. */
|
|
14
|
+
onCellClick: (event: MouseEvent<HTMLElement>) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface GridRowExpander {
|
|
17
|
+
/** Whether this row has a detail panel; a row without one keeps an empty expand cell. */
|
|
18
|
+
expandable: boolean;
|
|
19
|
+
expanded: boolean;
|
|
20
|
+
label: string;
|
|
21
|
+
/** The id of the row's detail panel, which the expand button controls. */
|
|
22
|
+
panelId: string;
|
|
23
|
+
onToggle: () => void;
|
|
24
|
+
}
|
|
25
|
+
export interface GridRowProps<Row extends RowData> {
|
|
26
|
+
row: TableRow<DataGridFeatures, Row>;
|
|
27
|
+
/** The row's place among the grid's entries; its keyboard row is one more. */
|
|
28
|
+
entryIndex: number;
|
|
29
|
+
measureRef: (element: HTMLTableRowElement | null) => void;
|
|
30
|
+
density: DataGridDensity;
|
|
31
|
+
/** The columns the grid renders before the row's own cells. */
|
|
32
|
+
columnOffset: number;
|
|
33
|
+
highlighted: boolean;
|
|
34
|
+
/** Clicks on the row do something, so it shows a pointer. */
|
|
35
|
+
clickable: boolean;
|
|
36
|
+
/** The checkbox column's cell; absent without checkbox selection. */
|
|
37
|
+
checkbox?: GridRowCheckbox;
|
|
38
|
+
/** The expand column's cell; absent without expandable rows. */
|
|
39
|
+
expander?: GridRowExpander;
|
|
40
|
+
/** Fills the row actions column at the end; absent without one. */
|
|
41
|
+
renderRowActions?: (row: Row) => ReactNode;
|
|
42
|
+
getCellProps: GetCellProps;
|
|
43
|
+
/** The handlers hear only clicks on the row itself, not on its cells' controls. */
|
|
44
|
+
onClick: (event: MouseEvent<HTMLElement>) => void;
|
|
45
|
+
onDoubleClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
46
|
+
onContextMenu?: (event: MouseEvent<HTMLElement>) => void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* One body row: the checkbox cell when rows are selectable, the expand cell when they expand, the
|
|
50
|
+
* row's own cells, then the row actions cell.
|
|
51
|
+
*/
|
|
52
|
+
export declare function GridRow<Row extends RowData>({ row, entryIndex, measureRef, density, columnOffset, highlighted, clickable, checkbox, expander, renderRowActions, getCellProps, onClick, onDoubleClick, onContextMenu, }: GridRowProps<Row>): import("react").JSX.Element;
|
|
53
|
+
export interface GridDetailRowProps {
|
|
54
|
+
/** The panel's place among the grid's entries; its keyboard row is one more. */
|
|
55
|
+
entryIndex: number;
|
|
56
|
+
measureRef: (element: HTMLTableRowElement | null) => void;
|
|
57
|
+
columnCount: number;
|
|
58
|
+
panelId: string;
|
|
59
|
+
getCellProps: GetCellProps;
|
|
60
|
+
children: ReactNode;
|
|
61
|
+
}
|
|
62
|
+
/** An expanded row's detail panel: one cell across every column, measured like any row. */
|
|
63
|
+
export declare function GridDetailRow({ entryIndex, measureRef, columnCount, panelId, getCellProps, children, }: GridDetailRowProps): import("react").JSX.Element;
|
|
64
|
+
export interface GridSpacerRowProps {
|
|
65
|
+
height: number;
|
|
66
|
+
columnCount: number;
|
|
67
|
+
}
|
|
68
|
+
/** Holds the place of entries the virtualiser leaves unrendered, so the body keeps its height. */
|
|
69
|
+
export declare function GridSpacerRow({ height, columnCount }: GridSpacerRowProps): import("react").JSX.Element;
|