@nickrobison/colophon-table 0.0.0-stage → 0.1.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/LICENSE.md +21 -0
- package/README.md +55 -2
- package/package.json +72 -3
- package/src/components/CphSkeleton.test.tsx +145 -0
- package/src/components/CphSkeleton.tsx +42 -0
- package/src/components/CphTableEmpty.test.tsx +122 -0
- package/src/components/CphTableEmpty.tsx +42 -0
- package/src/components/DataTable/CphDataTable.test.tsx +408 -0
- package/src/components/DataTable/CphDataTable.tsx +121 -0
- package/src/components/DataTable/pinnedOffsets.ts +94 -0
- package/src/components/FilterMultiSelect/CphTableFilterMultiSelect.test.tsx +172 -0
- package/src/components/FilterMultiSelect/CphTableFilterMultiSelect.tsx +132 -0
- package/src/components/FilterRange/CphTableFilterRange.test.tsx +154 -0
- package/src/components/FilterRange/CphTableFilterRange.tsx +109 -0
- package/src/components/MobileCards/CphMobileCards.test.tsx +174 -0
- package/src/components/MobileCards/CphMobileCards.tsx +117 -0
- package/src/components/Pagination/CphCursorPagination.test.tsx +51 -0
- package/src/components/Pagination/CphCursorPagination.tsx +74 -0
- package/src/components/Pagination/CphPagination.test.tsx +98 -0
- package/src/components/Pagination/CphPagination.tsx +94 -0
- package/src/components/RowDetail/CphRowDetail.test.tsx +182 -0
- package/src/components/RowDetail/CphRowDetail.tsx +66 -0
- package/src/components/SimpleTable/CphSimpleTable.test.tsx +235 -0
- package/src/components/SimpleTable/CphSimpleTable.tsx +369 -0
- package/src/components/SortFilterSheet/CphSortFilterSheet.test.tsx +156 -0
- package/src/components/SortFilterSheet/CphSortFilterSheet.tsx +131 -0
- package/src/components/StatusChip/CphStatusChip.test.tsx +43 -0
- package/src/components/StatusChip/CphStatusChip.tsx +33 -0
- package/src/components/Summary/CphTableSummary.test.tsx +486 -0
- package/src/components/Summary/CphTableSummary.tsx +130 -0
- package/src/components/TableHead/CphTableHead.test.tsx +52 -0
- package/src/components/TableHead/CphTableHead.tsx +129 -0
- package/src/components/TableHead/HeaderCell.test.tsx +880 -0
- package/src/components/TableHead/HeaderCell.tsx +221 -0
- package/src/components/TableRow/Cell.test.tsx +306 -0
- package/src/components/TableRow/Cell.tsx +74 -0
- package/src/components/TableRow/CphTableRow.test.tsx +90 -0
- package/src/components/TableRow/CphTableRow.tsx +17 -0
- package/src/components/Toolbar/CphToolbar.test.tsx +150 -0
- package/src/components/Toolbar/CphToolbar.tsx +138 -0
- package/src/components.css +593 -0
- package/src/index.ts +69 -0
- package/src/table/cellRenderers.tsx +88 -0
- package/src/table/column.test.tsx +277 -0
- package/src/table/column.tsx +36 -0
- package/src/table/features.ts +69 -0
- package/src/table/pageSize.test.ts +128 -0
- package/src/table/pageSize.ts +47 -0
- package/src/table/summary.test.tsx +446 -0
- package/src/table/summary.ts +94 -0
- package/src/table/useCphTable.ts +90 -0
- package/src/table/useCphTableState.test.tsx +697 -0
- package/src/table/useCphTableState.ts +412 -0
- package/src/table-tokens.css +48 -0
- package/src/theme/CphTableDensity.test.tsx +53 -0
- package/src/theme/CphTableDensity.tsx +24 -0
- package/src/theme/cphTableDensityContext.ts +24 -0
- package/src/utils/composeClassName.test.ts +26 -0
- package/src/utils/composeClassName.ts +28 -0
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
/* @nickrobison/colophon-table — table component layer.
|
|
2
|
+
Ported from the Figma TablesPage ledger styles; every class is renamed into the
|
|
3
|
+
cph-table-* namespace and every colour resolves to a --cph-* token.
|
|
4
|
+
`border-collapse: separate` on .cph-table is load-bearing: sticky pinned cells
|
|
5
|
+
do not position correctly under `collapse`. */
|
|
6
|
+
|
|
7
|
+
.cph-table-root {
|
|
8
|
+
color: var(--cph-ink);
|
|
9
|
+
background: var(--cph-paper);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.cph-table-scroll {
|
|
13
|
+
width: 100%;
|
|
14
|
+
max-height: var(--cph-table-scroll-max-h);
|
|
15
|
+
overflow: auto;
|
|
16
|
+
border-top: 1px solid var(--cph-line-dark);
|
|
17
|
+
border-bottom: 1px solid var(--cph-line-dark);
|
|
18
|
+
scrollbar-color: var(--cph-line-dark) var(--cph-paper);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.cph-table {
|
|
22
|
+
width: 100%;
|
|
23
|
+
min-width: var(--cph-table-min-w);
|
|
24
|
+
table-layout: fixed;
|
|
25
|
+
border-collapse: separate;
|
|
26
|
+
border-spacing: 0;
|
|
27
|
+
font-family: var(--cph-font-sans);
|
|
28
|
+
font-size: var(--cph-table-type);
|
|
29
|
+
line-height: var(--cph-table-leading);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.cph-table th,
|
|
33
|
+
.cph-table td {
|
|
34
|
+
padding: var(--cph-table-cell-y) var(--cph-space-3);
|
|
35
|
+
border: 0;
|
|
36
|
+
height: var(--cph-table-row-h);
|
|
37
|
+
vertical-align: middle;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
text-overflow: ellipsis;
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
text-align: left;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* ── Generic simple table (CphSimpleTable) ──────────────────────────── */
|
|
45
|
+
|
|
46
|
+
/* Consumer-defined columns flow freely, so the ledger's fixed chrome (1170px
|
|
47
|
+
min-width / fixed layout) does not apply. Hover/selected tints and the sort
|
|
48
|
+
affordance reuse the token-driven table styles above. */
|
|
49
|
+
|
|
50
|
+
.cph-table-simple .cph-table {
|
|
51
|
+
min-width: 0;
|
|
52
|
+
table-layout: auto;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.cph-table__col-select {
|
|
56
|
+
width: 3rem;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.cph-table thead th {
|
|
60
|
+
height: var(--cph-table-head-h);
|
|
61
|
+
padding-block: var(--cph-space-2);
|
|
62
|
+
border-bottom: 1px solid var(--cph-line);
|
|
63
|
+
color: var(--cph-ink-soft);
|
|
64
|
+
font-family: var(--cph-font-mono);
|
|
65
|
+
font-weight: 400;
|
|
66
|
+
text-transform: uppercase;
|
|
67
|
+
letter-spacing: 0.035em;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.cph-table__numeric {
|
|
71
|
+
text-align: right;
|
|
72
|
+
font-variant-numeric: tabular-nums;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.cph-table__truncate {
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
text-overflow: ellipsis;
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.cph-table__date,
|
|
82
|
+
.cph-table__percent {
|
|
83
|
+
color: var(--cph-ink-soft);
|
|
84
|
+
font-variant-numeric: tabular-nums;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* ── Pinned first column ─────────────────────────────────────────────── */
|
|
88
|
+
|
|
89
|
+
.cph-table__pinned {
|
|
90
|
+
position: sticky;
|
|
91
|
+
left: 0;
|
|
92
|
+
z-index: var(--cph-table-z-pinned);
|
|
93
|
+
background: var(--cph-paper);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.cph-table__pinned-head {
|
|
97
|
+
z-index: var(--cph-table-z-pinned-head);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* ── Rows ────────────────────────────────────────────────────────────── */
|
|
101
|
+
|
|
102
|
+
.cph-table__row {
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
--cph-table-row-bg: var(--cph-paper);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.cph-table__row td {
|
|
108
|
+
border-bottom: 1px solid var(--cph-line);
|
|
109
|
+
background: var(--cph-table-row-bg);
|
|
110
|
+
transition: background var(--cph-motion-sm) var(--cph-ease-out);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.cph-table__row:hover {
|
|
114
|
+
--cph-table-row-bg: var(--cph-table-hover);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.cph-table__row[data-selected="true"] {
|
|
118
|
+
--cph-table-row-bg: var(--cph-table-selected);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* The pinned cell must read the row's own background token, otherwise the
|
|
122
|
+
hover and selected tints stop at the edge of the pinned column. */
|
|
123
|
+
.cph-table__row .cph-table__pinned {
|
|
124
|
+
background: var(--cph-table-row-bg);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.cph-table__row[data-selected="true"] .cph-table__pinned {
|
|
128
|
+
box-shadow: inset 3px 0 var(--cph-orange);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.cph-table__row:focus-within {
|
|
132
|
+
outline: 2px solid var(--cph-orange);
|
|
133
|
+
outline-offset: -2px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.cph-table__source-cell {
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
gap: var(--cph-space-3);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.cph-table__disclosure {
|
|
143
|
+
flex: none;
|
|
144
|
+
width: 0.75rem;
|
|
145
|
+
color: var(--cph-ink-soft);
|
|
146
|
+
font-family: var(--cph-font-mono);
|
|
147
|
+
text-align: center;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.cph-table__row[data-expanded="true"] .cph-table__disclosure {
|
|
151
|
+
color: var(--cph-table-accent-text);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* ── Sortable header affordance ──────────────────────────────────────── */
|
|
155
|
+
|
|
156
|
+
.cph-table__sort {
|
|
157
|
+
display: inline-flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
gap: var(--cph-space-1);
|
|
160
|
+
max-width: 100%;
|
|
161
|
+
min-height: 1.5rem;
|
|
162
|
+
padding: 0;
|
|
163
|
+
border: 0;
|
|
164
|
+
border-radius: 0;
|
|
165
|
+
background: transparent;
|
|
166
|
+
color: inherit;
|
|
167
|
+
font-family: var(--cph-font-mono);
|
|
168
|
+
font-size: var(--cph-table-type);
|
|
169
|
+
font-weight: 400;
|
|
170
|
+
letter-spacing: 0.035em;
|
|
171
|
+
text-transform: uppercase;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.cph-table__sort-arrow {
|
|
175
|
+
letter-spacing: 0;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* ── Checkbox ────────────────────────────────────────────────────────── */
|
|
179
|
+
|
|
180
|
+
.cph-table__checkbox {
|
|
181
|
+
appearance: auto;
|
|
182
|
+
flex: none;
|
|
183
|
+
width: 0.875rem;
|
|
184
|
+
height: 0.875rem;
|
|
185
|
+
min-height: 0;
|
|
186
|
+
margin: 0;
|
|
187
|
+
padding: 0;
|
|
188
|
+
border-radius: 0;
|
|
189
|
+
accent-color: var(--cph-table-accent-text);
|
|
190
|
+
cursor: pointer;
|
|
191
|
+
vertical-align: middle;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.cph-table thead .cph-table__checkbox {
|
|
195
|
+
margin-right: var(--cph-space-6);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* ── Status chip ─────────────────────────────────────────────────────── */
|
|
199
|
+
|
|
200
|
+
.cph-table__chip {
|
|
201
|
+
display: inline-flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
gap: var(--cph-space-1);
|
|
204
|
+
padding: 0 var(--cph-space-2);
|
|
205
|
+
border-radius: var(--cph-radius-sm);
|
|
206
|
+
font-family: var(--cph-font-sans);
|
|
207
|
+
font-size: var(--cph-table-type);
|
|
208
|
+
line-height: 17px;
|
|
209
|
+
white-space: nowrap;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.cph-table .cph-table__chip {
|
|
213
|
+
vertical-align: middle;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.cph-table__chip-dot {
|
|
217
|
+
flex: none;
|
|
218
|
+
width: 0.25rem;
|
|
219
|
+
height: 0.25rem;
|
|
220
|
+
border-radius: 50%;
|
|
221
|
+
background: currentColor;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* ── Aggregate summary (opt-in) ──────────────────────────────────────── */
|
|
225
|
+
|
|
226
|
+
.cph-table__summary {
|
|
227
|
+
position: sticky;
|
|
228
|
+
bottom: 0;
|
|
229
|
+
z-index: var(--cph-table-z-summary);
|
|
230
|
+
background: var(--cph-paper-raised);
|
|
231
|
+
border-top: 1px solid var(--cph-line-dark);
|
|
232
|
+
box-shadow: var(--cph-shadow-l1);
|
|
233
|
+
font-family: var(--cph-font-mono);
|
|
234
|
+
font-weight: 700;
|
|
235
|
+
height: var(--cph-table-summary-h);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.cph-table__summary .cph-table__pinned {
|
|
239
|
+
z-index: var(--cph-table-z-summary-pinned);
|
|
240
|
+
background: var(--cph-paper-raised);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.cph-table__summary th span,
|
|
244
|
+
.cph-table__summary small {
|
|
245
|
+
display: block;
|
|
246
|
+
margin-left: var(--cph-space-3);
|
|
247
|
+
color: var(--cph-ink-soft);
|
|
248
|
+
font-size: var(--cph-table-type);
|
|
249
|
+
font-weight: 400;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.cph-table__summary td:not(.cph-table__numeric) {
|
|
253
|
+
color: var(--cph-ink-soft);
|
|
254
|
+
font-weight: 400;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* ── Skeleton / empty ────────────────────────────────────────────────── */
|
|
258
|
+
|
|
259
|
+
.cph-table__skeleton {
|
|
260
|
+
display: block;
|
|
261
|
+
width: 75%;
|
|
262
|
+
height: 0.625rem;
|
|
263
|
+
border-radius: var(--cph-radius-sm);
|
|
264
|
+
background: var(--cph-line);
|
|
265
|
+
animation: cph-table-pulse var(--cph-table-pulse) var(--cph-ease-out) infinite;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.cph-table__skeleton-row td {
|
|
269
|
+
border-bottom: 1px solid var(--cph-line);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.cph-table__skeleton-row td:first-child .cph-table__skeleton {
|
|
273
|
+
width: 85%;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
@keyframes cph-table-pulse {
|
|
277
|
+
0%,
|
|
278
|
+
100% {
|
|
279
|
+
opacity: 1;
|
|
280
|
+
}
|
|
281
|
+
50% {
|
|
282
|
+
opacity: 0.45;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.cph-table__empty {
|
|
287
|
+
padding: var(--cph-space-8) var(--cph-space-4);
|
|
288
|
+
color: var(--cph-ink-soft);
|
|
289
|
+
font-family: var(--cph-font-serif);
|
|
290
|
+
font-size: 1.15rem;
|
|
291
|
+
text-align: center;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/* ── Column widths (table-layout: fixed reads these) ─────────────────── */
|
|
295
|
+
|
|
296
|
+
.cph-table__col-source {
|
|
297
|
+
width: 29%;
|
|
298
|
+
}
|
|
299
|
+
.cph-table__col-type {
|
|
300
|
+
width: 8%;
|
|
301
|
+
}
|
|
302
|
+
.cph-table__col-collection {
|
|
303
|
+
width: 16%;
|
|
304
|
+
}
|
|
305
|
+
.cph-table__col-status {
|
|
306
|
+
width: 15%;
|
|
307
|
+
}
|
|
308
|
+
.cph-table__col-number {
|
|
309
|
+
width: 6%;
|
|
310
|
+
}
|
|
311
|
+
.cph-table__col-confidence {
|
|
312
|
+
width: 10%;
|
|
313
|
+
}
|
|
314
|
+
.cph-table__col-date {
|
|
315
|
+
width: 10%;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* ── Toolbar ─────────────────────────────────────────────────────────── */
|
|
319
|
+
|
|
320
|
+
.cph-table__toolbar {
|
|
321
|
+
display: flex;
|
|
322
|
+
align-items: center;
|
|
323
|
+
gap: var(--cph-space-3);
|
|
324
|
+
padding: var(--cph-space-4) 0;
|
|
325
|
+
border-top: 1px solid var(--cph-line);
|
|
326
|
+
border-bottom: 1px solid var(--cph-line);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.cph-table__search {
|
|
330
|
+
display: flex;
|
|
331
|
+
position: relative;
|
|
332
|
+
flex: 1;
|
|
333
|
+
min-width: 12rem;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.cph-table__filter {
|
|
337
|
+
display: flex;
|
|
338
|
+
flex-direction: column;
|
|
339
|
+
gap: var(--cph-space-2);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.cph-table__summary-toggle[aria-pressed="true"] {
|
|
343
|
+
background: var(--cph-orange-soft);
|
|
344
|
+
color: var(--cph-table-accent-text);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* ── Filter primitives (multi-select + numeric range) ────────────────── */
|
|
348
|
+
/* Dense ledger controls: hairline borders, mono type, token-driven so the
|
|
349
|
+
dark theme flips automatically via the [data-theme="dark"] token block. */
|
|
350
|
+
|
|
351
|
+
.cph-table__filter-multi {
|
|
352
|
+
display: inline-flex;
|
|
353
|
+
align-items: center;
|
|
354
|
+
gap: var(--cph-space-2);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.cph-table__filter-multi__trigger {
|
|
358
|
+
display: inline-flex;
|
|
359
|
+
align-items: center;
|
|
360
|
+
gap: var(--cph-space-2);
|
|
361
|
+
padding: var(--cph-space-2) var(--cph-space-3);
|
|
362
|
+
border: 1px solid var(--cph-line);
|
|
363
|
+
border-radius: var(--cph-radius-sm);
|
|
364
|
+
background: var(--cph-paper);
|
|
365
|
+
color: var(--cph-ink);
|
|
366
|
+
font-family: var(--cph-font-mono);
|
|
367
|
+
font-size: var(--cph-table-type);
|
|
368
|
+
letter-spacing: 0.03em;
|
|
369
|
+
cursor: pointer;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.cph-table__filter-multi__trigger:hover {
|
|
373
|
+
border-color: var(--cph-line-dark);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.cph-table__filter-multi__trigger-text {
|
|
377
|
+
white-space: nowrap;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.cph-table__filter-multi__popover {
|
|
381
|
+
min-width: 12rem;
|
|
382
|
+
max-height: 18rem;
|
|
383
|
+
padding: var(--cph-space-2);
|
|
384
|
+
border: 1px solid var(--cph-line-dark);
|
|
385
|
+
border-radius: var(--cph-radius-sm);
|
|
386
|
+
background: var(--cph-paper-raised);
|
|
387
|
+
overflow: auto;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.cph-table__filter-multi__list {
|
|
391
|
+
display: flex;
|
|
392
|
+
flex-direction: column;
|
|
393
|
+
gap: 2px;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.cph-table__filter-multi__option {
|
|
397
|
+
display: flex;
|
|
398
|
+
align-items: center;
|
|
399
|
+
gap: var(--cph-space-2);
|
|
400
|
+
padding: var(--cph-space-2) var(--cph-space-3);
|
|
401
|
+
border-radius: var(--cph-radius-sm);
|
|
402
|
+
color: var(--cph-ink);
|
|
403
|
+
font-family: var(--cph-font-mono);
|
|
404
|
+
font-size: var(--cph-table-type);
|
|
405
|
+
cursor: pointer;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.cph-table__filter-multi__option[data-selected],
|
|
409
|
+
.cph-table__filter-multi__option[data-focused] {
|
|
410
|
+
background: var(--cph-table-hover);
|
|
411
|
+
outline: none;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.cph-table__filter-multi__checkbox {
|
|
415
|
+
display: grid;
|
|
416
|
+
width: 0.85rem;
|
|
417
|
+
height: 0.85rem;
|
|
418
|
+
flex: none;
|
|
419
|
+
place-items: center;
|
|
420
|
+
border: 1px solid var(--cph-line-dark);
|
|
421
|
+
border-radius: var(--cph-radius-sm);
|
|
422
|
+
background: var(--cph-paper);
|
|
423
|
+
color: var(--cph-paper);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.cph-table__filter-multi__checkbox--checked {
|
|
427
|
+
border-color: var(--cph-orange);
|
|
428
|
+
background: var(--cph-orange);
|
|
429
|
+
color: var(--cph-paper-raised);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.cph-table__filter-multi__option-label {
|
|
433
|
+
white-space: nowrap;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.cph-table__filter-multi__clear {
|
|
437
|
+
display: inline-flex;
|
|
438
|
+
align-items: center;
|
|
439
|
+
justify-content: center;
|
|
440
|
+
min-width: 1.5rem;
|
|
441
|
+
min-height: 1.5rem;
|
|
442
|
+
padding: 0;
|
|
443
|
+
border: 0;
|
|
444
|
+
background: transparent;
|
|
445
|
+
color: var(--cph-ink-faint);
|
|
446
|
+
cursor: pointer;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.cph-table__filter-multi__clear:hover {
|
|
450
|
+
color: var(--cph-ink);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.cph-table__filter-range {
|
|
454
|
+
display: inline-flex;
|
|
455
|
+
align-items: center;
|
|
456
|
+
gap: var(--cph-space-2);
|
|
457
|
+
color: var(--cph-ink-soft);
|
|
458
|
+
font-family: var(--cph-font-mono);
|
|
459
|
+
font-size: var(--cph-table-type);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.cph-table__filter-range__label {
|
|
463
|
+
color: var(--cph-ink);
|
|
464
|
+
font-size: var(--cph-table-type);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.cph-table__filter-range__input {
|
|
468
|
+
width: 4.5rem;
|
|
469
|
+
padding: var(--cph-space-2);
|
|
470
|
+
border: 1px solid var(--cph-line);
|
|
471
|
+
border-radius: var(--cph-radius-sm);
|
|
472
|
+
background: var(--cph-paper);
|
|
473
|
+
color: var(--cph-ink);
|
|
474
|
+
font-family: var(--cph-font-mono);
|
|
475
|
+
font-size: var(--cph-table-type);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.cph-table__filter-range__input:hover {
|
|
479
|
+
border-color: var(--cph-line-dark);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.cph-table__filter-range__input:focus-visible {
|
|
483
|
+
border-color: var(--cph-orange);
|
|
484
|
+
outline: none;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.cph-table__filter-range__sep {
|
|
488
|
+
color: var(--cph-ink-faint);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/* Explicit dark-theme tuning: the token block flips most values already; this
|
|
492
|
+
keeps the popover hairline visible against the deep dark background. */
|
|
493
|
+
[data-theme="dark"] .cph-table__filter-multi__popover {
|
|
494
|
+
border-color: var(--cph-line-dark);
|
|
495
|
+
background: var(--cph-paper-raised);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/* ── Pagination ──────────────────────────────────────────────────────── */
|
|
499
|
+
|
|
500
|
+
.cph-table__pagination {
|
|
501
|
+
display: flex;
|
|
502
|
+
align-items: center;
|
|
503
|
+
justify-content: space-between;
|
|
504
|
+
gap: var(--cph-space-4);
|
|
505
|
+
min-height: 3rem;
|
|
506
|
+
color: var(--cph-ink-soft);
|
|
507
|
+
font-family: var(--cph-font-mono);
|
|
508
|
+
font-size: var(--cph-table-type);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.cph-table__pagination nav {
|
|
512
|
+
display: flex;
|
|
513
|
+
align-items: center;
|
|
514
|
+
gap: var(--cph-space-4);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/* ── Mobile ──────────────────────────────────────────────────────────── */
|
|
518
|
+
|
|
519
|
+
.cph-table__mobile-cards {
|
|
520
|
+
display: none;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.cph-table__mobile-card {
|
|
524
|
+
display: flex;
|
|
525
|
+
flex-direction: column;
|
|
526
|
+
gap: var(--cph-space-3);
|
|
527
|
+
padding: var(--cph-space-4);
|
|
528
|
+
border-bottom: 1px solid var(--cph-line);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.cph-table__mobile-card[data-selected="true"] {
|
|
532
|
+
background: var(--cph-table-selected);
|
|
533
|
+
box-shadow: inset 3px 0 var(--cph-orange);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.cph-table__mobile-select {
|
|
537
|
+
display: flex;
|
|
538
|
+
align-items: center;
|
|
539
|
+
gap: var(--cph-space-2);
|
|
540
|
+
color: var(--cph-ink-soft);
|
|
541
|
+
font-family: var(--cph-font-mono);
|
|
542
|
+
font-size: var(--cph-table-type);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.cph-table__sheet {
|
|
546
|
+
width: min(100%, 35rem);
|
|
547
|
+
max-height: 85vh;
|
|
548
|
+
padding: var(--cph-space-6);
|
|
549
|
+
border: 1px solid var(--cph-line-dark);
|
|
550
|
+
border-radius: var(--cph-radius-md);
|
|
551
|
+
background: var(--cph-paper-raised);
|
|
552
|
+
color: var(--cph-ink);
|
|
553
|
+
box-shadow: var(--cph-shadow-l2);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.cph-table__sheet-heading {
|
|
557
|
+
display: flex;
|
|
558
|
+
align-items: center;
|
|
559
|
+
justify-content: space-between;
|
|
560
|
+
gap: var(--cph-space-4);
|
|
561
|
+
margin-bottom: var(--cph-space-4);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.cph-table__sheet-actions {
|
|
565
|
+
display: flex;
|
|
566
|
+
justify-content: flex-end;
|
|
567
|
+
gap: var(--cph-space-3);
|
|
568
|
+
margin-top: var(--cph-space-6);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/* Density modes are a desktop concept; the mobile layout collapses to a single
|
|
572
|
+
Comfortable-equivalent spacing. */
|
|
573
|
+
@media (max-width: 760px) {
|
|
574
|
+
.cph-table-scroll {
|
|
575
|
+
display: none;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.cph-table__mobile-cards {
|
|
579
|
+
display: block;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/* ── Reduced motion ──────────────────────────────────────────────────── */
|
|
584
|
+
|
|
585
|
+
@media (prefers-reduced-motion: reduce) {
|
|
586
|
+
.cph-table__skeleton {
|
|
587
|
+
animation: none;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.cph-table__row td {
|
|
591
|
+
transition-duration: 1ms;
|
|
592
|
+
}
|
|
593
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** @packageDocumentation Colophon Table package entry point. */
|
|
2
|
+
|
|
3
|
+
export { CphProvider, useCphDensity, useCphTheme } from "@nickrobison/colophon";
|
|
4
|
+
|
|
5
|
+
export { type CphTableFeatures, cphTableFeatures } from "./table/features";
|
|
6
|
+
export { useCphTable, type CphTableOptions } from "./table/useCphTable";
|
|
7
|
+
export {
|
|
8
|
+
useCphTableState,
|
|
9
|
+
useCphRowSelection,
|
|
10
|
+
type StateSlice,
|
|
11
|
+
type UseCphTableStateOptions,
|
|
12
|
+
type UseCphTableStateReturn,
|
|
13
|
+
type UseCphRowSelectionOptions,
|
|
14
|
+
type UseCphRowSelectionReturn,
|
|
15
|
+
} from "./table/useCphTableState";
|
|
16
|
+
export { type CphColumnMeta, cphColumnHelper } from "./table/column";
|
|
17
|
+
export { getAggregationValue } from "./table/summary";
|
|
18
|
+
export {
|
|
19
|
+
PAGE_SIZES,
|
|
20
|
+
PAGE_SIZE_LABELS,
|
|
21
|
+
DEFAULT_PAGE_SIZE,
|
|
22
|
+
getTotalPages,
|
|
23
|
+
nextPageSize,
|
|
24
|
+
type PageSize,
|
|
25
|
+
} from "./table/pageSize";
|
|
26
|
+
|
|
27
|
+
export { composeClassName } from "./utils/composeClassName";
|
|
28
|
+
export { CphTableDensityProvider } from "./theme/CphTableDensity";
|
|
29
|
+
export { useCphTableDensity } from "./theme/cphTableDensityContext";
|
|
30
|
+
|
|
31
|
+
// Table components
|
|
32
|
+
export { CphDataTable } from "./components/DataTable/CphDataTable";
|
|
33
|
+
export {
|
|
34
|
+
CphSimpleTable,
|
|
35
|
+
type CphSimpleTableColumn,
|
|
36
|
+
type CphSimpleTableProps,
|
|
37
|
+
} from "./components/SimpleTable/CphSimpleTable";
|
|
38
|
+
export {
|
|
39
|
+
CphCursorPagination,
|
|
40
|
+
type CphCursorPaginationProps,
|
|
41
|
+
} from "./components/Pagination/CphCursorPagination";
|
|
42
|
+
export { CphTableHead, type CphTableHeadSelectAll } from "./components/TableHead/CphTableHead";
|
|
43
|
+
export { HeaderCell } from "./components/TableHead/HeaderCell";
|
|
44
|
+
export { CphTableRow } from "./components/TableRow/CphTableRow";
|
|
45
|
+
export { Cell } from "./components/TableRow/Cell";
|
|
46
|
+
export { CphRowDetail } from "./components/RowDetail/CphRowDetail";
|
|
47
|
+
export { CphSkeleton } from "./components/CphSkeleton";
|
|
48
|
+
export { CphTableEmpty } from "./components/CphTableEmpty";
|
|
49
|
+
export { CphTableSummary } from "./components/Summary/CphTableSummary";
|
|
50
|
+
export { CphPagination } from "./components/Pagination/CphPagination";
|
|
51
|
+
export { CphToolbar } from "./components/Toolbar/CphToolbar";
|
|
52
|
+
export { CphSortFilterSheet } from "./components/SortFilterSheet/CphSortFilterSheet";
|
|
53
|
+
export {
|
|
54
|
+
CphMobileCards,
|
|
55
|
+
CphMobileCard,
|
|
56
|
+
type CphMobileCardsProps,
|
|
57
|
+
type CphMobileCardProps,
|
|
58
|
+
} from "./components/MobileCards/CphMobileCards";
|
|
59
|
+
export { CphStatusChip } from "./components/StatusChip/CphStatusChip";
|
|
60
|
+
export {
|
|
61
|
+
CphTableFilterMultiSelect,
|
|
62
|
+
type CphTableFilterMultiSelectProps,
|
|
63
|
+
type CphTableFilterOption,
|
|
64
|
+
} from "./components/FilterMultiSelect/CphTableFilterMultiSelect";
|
|
65
|
+
export {
|
|
66
|
+
CphTableFilterRange,
|
|
67
|
+
type CphTableFilterRangeProps,
|
|
68
|
+
type CphTableFilterRangeValue,
|
|
69
|
+
} from "./components/FilterRange/CphTableFilterRange";
|