@lt-ui/table 0.0.0-stage → 0.0.1

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 (132) hide show
  1. package/cells/cells.module.css +481 -0
  2. package/cells/field-cells.d.ts +118 -0
  3. package/cells/field-cells.js +48 -0
  4. package/cells/index.d.ts +29 -0
  5. package/cells/index.js +15 -0
  6. package/cells/square-select.d.ts +19 -0
  7. package/cells/square-select.js +37 -0
  8. package/cells/square.d.ts +16 -0
  9. package/cells/square.js +78 -0
  10. package/cells/table-cell-actions.d.ts +32 -0
  11. package/cells/table-cell-actions.js +36 -0
  12. package/cells/table-cell-checkbox.d.ts +13 -0
  13. package/cells/table-cell-checkbox.js +13 -0
  14. package/cells/table-cell-copy.d.ts +18 -0
  15. package/cells/table-cell-copy.js +32 -0
  16. package/cells/table-cell-date.d.ts +20 -0
  17. package/cells/table-cell-date.js +15 -0
  18. package/cells/table-cell-expand.d.ts +18 -0
  19. package/cells/table-cell-expand.js +17 -0
  20. package/cells/table-cell-file-upload.d.ts +27 -0
  21. package/cells/table-cell-file-upload.js +22 -0
  22. package/cells/table-cell-file.d.ts +27 -0
  23. package/cells/table-cell-file.js +29 -0
  24. package/cells/table-cell-image.d.ts +22 -0
  25. package/cells/table-cell-image.js +12 -0
  26. package/cells/table-cell-input.d.ts +22 -0
  27. package/cells/table-cell-input.js +22 -0
  28. package/cells/table-cell-link.d.ts +14 -0
  29. package/cells/table-cell-link.js +28 -0
  30. package/cells/table-cell-select.d.ts +44 -0
  31. package/cells/table-cell-select.js +30 -0
  32. package/cells/table-cell-switch.d.ts +8 -0
  33. package/cells/table-cell-switch.js +5 -0
  34. package/cells/table-cell-textarea.d.ts +22 -0
  35. package/cells/table-cell-textarea.js +68 -0
  36. package/cjs/cells/cells.module.css +481 -0
  37. package/cjs/cells/field-cells.js +87 -0
  38. package/cjs/cells/index.js +36 -0
  39. package/cjs/cells/square-select.js +77 -0
  40. package/cjs/cells/square.js +117 -0
  41. package/cjs/cells/table-cell-actions.js +75 -0
  42. package/cjs/cells/table-cell-checkbox.js +19 -0
  43. package/cjs/cells/table-cell-copy.js +71 -0
  44. package/cjs/cells/table-cell-date.js +22 -0
  45. package/cjs/cells/table-cell-expand.js +23 -0
  46. package/cjs/cells/table-cell-file-upload.js +61 -0
  47. package/cjs/cells/table-cell-file.js +38 -0
  48. package/cjs/cells/table-cell-image.js +18 -0
  49. package/cjs/cells/table-cell-input.js +61 -0
  50. package/cjs/cells/table-cell-link.js +34 -0
  51. package/cjs/cells/table-cell-select.js +36 -0
  52. package/cjs/cells/table-cell-switch.js +12 -0
  53. package/cjs/cells/table-cell-textarea.js +107 -0
  54. package/cjs/column-settings.js +128 -0
  55. package/cjs/columns.js +67 -0
  56. package/cjs/context.js +14 -0
  57. package/cjs/corner-settings.js +24 -0
  58. package/cjs/empty-function.js +8 -0
  59. package/cjs/features.js +40 -0
  60. package/cjs/header-filter.js +93 -0
  61. package/cjs/index.js +44 -0
  62. package/cjs/layout.js +34 -0
  63. package/cjs/locale/index.js +8 -0
  64. package/cjs/locale/messages.js +63 -0
  65. package/cjs/locale/use-locale.js +10 -0
  66. package/cjs/row-loading-border.js +79 -0
  67. package/cjs/selection.js +34 -0
  68. package/cjs/sort-icon.js +18 -0
  69. package/cjs/styles.module.css +674 -0
  70. package/cjs/table-head.js +45 -0
  71. package/cjs/table-pagination.js +25 -0
  72. package/cjs/table-row.js +62 -0
  73. package/cjs/table-search.js +74 -0
  74. package/cjs/table-toolbar.js +22 -0
  75. package/cjs/table.js +95 -0
  76. package/cjs/tanstack.js +2 -0
  77. package/cjs/types.js +2 -0
  78. package/cjs/use-pointer-sort.js +116 -0
  79. package/cjs/use-table.js +23 -0
  80. package/column-settings.d.ts +59 -0
  81. package/column-settings.js +88 -0
  82. package/columns.d.ts +18 -0
  83. package/columns.js +59 -0
  84. package/context.d.ts +7 -0
  85. package/context.js +10 -0
  86. package/corner-settings.d.ts +11 -0
  87. package/corner-settings.js +16 -0
  88. package/empty-function.d.ts +1 -0
  89. package/empty-function.js +4 -0
  90. package/features.d.ts +38 -0
  91. package/features.js +37 -0
  92. package/header-filter.d.ts +29 -0
  93. package/header-filter.js +54 -0
  94. package/index.d.ts +22 -0
  95. package/index.js +12 -0
  96. package/layout.d.ts +5 -0
  97. package/layout.js +27 -0
  98. package/locale/index.d.ts +3 -0
  99. package/locale/index.js +2 -0
  100. package/locale/messages.d.ts +40 -0
  101. package/locale/messages.js +60 -0
  102. package/locale/use-locale.d.ts +9 -0
  103. package/locale/use-locale.js +7 -0
  104. package/package.json +33 -4
  105. package/row-loading-border.d.ts +7 -0
  106. package/row-loading-border.js +40 -0
  107. package/selection.d.ts +8 -0
  108. package/selection.js +31 -0
  109. package/sort-icon.d.ts +8 -0
  110. package/sort-icon.js +10 -0
  111. package/styles.module.css +674 -0
  112. package/table-head.d.ts +6 -0
  113. package/table-head.js +39 -0
  114. package/table-pagination.d.ts +16 -0
  115. package/table-pagination.js +19 -0
  116. package/table-row.d.ts +21 -0
  117. package/table-row.js +56 -0
  118. package/table-search.d.ts +28 -0
  119. package/table-search.js +38 -0
  120. package/table-toolbar.d.ts +18 -0
  121. package/table-toolbar.js +16 -0
  122. package/table.d.ts +15 -0
  123. package/table.js +56 -0
  124. package/tanstack.d.ts +9 -0
  125. package/tanstack.js +1 -0
  126. package/types.d.ts +161 -0
  127. package/types.js +1 -0
  128. package/use-pointer-sort.d.ts +32 -0
  129. package/use-pointer-sort.js +113 -0
  130. package/use-table.d.ts +46 -0
  131. package/use-table.js +19 -0
  132. package/README.md +0 -3
@@ -0,0 +1,674 @@
1
+ .root {
2
+ --table-pad-y: 12px;
3
+ --table-pad-x: 16px;
4
+ --table-surface: var(--background-primary);
5
+ --table-head-bg: var(--background-secondary);
6
+ --table-row-bg: var(--background-primary);
7
+ --table-line: var(--control-minor);
8
+ --table-column-line: var(--control-minor);
9
+ --table-gap: 8px;
10
+ --table-disabled-hover-bg: color-mix(in sRGB, var(--control-minor) 55%, var(--background-primary));
11
+ --table-hover-bg: color-mix(in sRGB, var(--accent-light) 50%, var(--background-primary));
12
+ position: relative;
13
+ min-width: 0;
14
+ color: var(--text-primary);
15
+ }
16
+
17
+ .size-s {
18
+ --table-pad-y: 6px;
19
+ --table-pad-x: 12px;
20
+ --table-square-height: 33px;
21
+ --table-head-height: 32px;
22
+ --table-cell-lines: 1;
23
+ font-size: 14px;
24
+ line-height: 20px;
25
+ }
26
+
27
+ .size-m {
28
+ --table-pad-y: 12px;
29
+ --table-pad-x: 16px;
30
+ --table-square-height: 45px;
31
+ --table-head-height: 44px;
32
+ --table-cell-lines: 2;
33
+ font-size: 14px;
34
+ line-height: 20px;
35
+ }
36
+
37
+ .size-l {
38
+ --table-pad-y: 16px;
39
+ --table-pad-x: 20px;
40
+ --table-square-height: 57px;
41
+ --table-head-height: 56px;
42
+ --table-cell-lines: 2;
43
+ font-size: 16px;
44
+ line-height: 24px;
45
+ }
46
+
47
+ .body {
48
+ position: relative;
49
+ min-width: 0;
50
+ }
51
+
52
+ .scroll {
53
+ position: relative;
54
+ overflow: auto;
55
+ }
56
+
57
+ .fixedLayout {
58
+ table-layout: fixed;
59
+ }
60
+
61
+ .table {
62
+ width: 100%;
63
+ min-width: 100%;
64
+ border-spacing: 0;
65
+ border-collapse: separate;
66
+ background-color: var(--table-surface);
67
+ }
68
+
69
+ .head th {
70
+ padding: var(--table-pad-y) var(--table-pad-x);
71
+ font-weight: 400;
72
+ color: var(--text-secondary);
73
+ text-align: start;
74
+ white-space: nowrap;
75
+ background-color: var(--table-head-bg);
76
+ }
77
+
78
+ .stickyHeader th {
79
+ position: sticky;
80
+ inset-block-start: 0;
81
+ z-index: 2;
82
+ }
83
+
84
+ .stickyHeader th.sticky {
85
+ z-index: 3;
86
+ }
87
+
88
+ .row > td {
89
+ padding: var(--table-pad-y) var(--table-pad-x);
90
+ font-variant-numeric: tabular-nums;
91
+ vertical-align: middle;
92
+ background-color: var(--table-row-bg);
93
+ }
94
+
95
+ .cornerSettings {
96
+ position: absolute;
97
+ inset-block-start: 0;
98
+ inset-inline-end: 8px;
99
+ z-index: 5;
100
+ display: flex;
101
+ align-items: center;
102
+ height: var(--table-head-height);
103
+ padding-inline: 4px;
104
+ }
105
+
106
+ .withCornerSettings > .body > .scroll > .table > .head > tr > th:last-child {
107
+ padding-inline-end: calc(var(--table-pad-x) + 44px);
108
+ }
109
+
110
+ .strong {
111
+ font-weight: 600;
112
+ }
113
+
114
+ .columnDividers th:not(:last-child),
115
+ .columnDividers td:not(:last-child) {
116
+ border-inline-end: 1px solid var(--table-column-line);
117
+ }
118
+
119
+ .sticky {
120
+ position: sticky;
121
+ z-index: 1;
122
+ box-sizing: border-box;
123
+ overflow: hidden;
124
+ }
125
+
126
+ .align-start {
127
+ text-align: start;
128
+ }
129
+
130
+ .align-center {
131
+ text-align: center;
132
+ }
133
+
134
+ .align-end {
135
+ text-align: end;
136
+ }
137
+
138
+ .head th.align-center {
139
+ text-align: center;
140
+ }
141
+
142
+ .head th.align-end {
143
+ text-align: end;
144
+ }
145
+
146
+ .ellipsis {
147
+ max-width: 0;
148
+ overflow: hidden;
149
+ text-overflow: ellipsis;
150
+ white-space: nowrap;
151
+ }
152
+
153
+ .headerText {
154
+ min-width: 0;
155
+ }
156
+
157
+ .headFilter {
158
+ position: relative;
159
+ display: grid;
160
+ grid-template-columns: minmax(0, 1fr) auto;
161
+ gap: 4px;
162
+ align-items: center;
163
+ min-width: 0;
164
+ }
165
+
166
+ .headFilterTitle {
167
+ grid-area: 1/1;
168
+ min-width: 0;
169
+ }
170
+
171
+ .headFilterOpen .headFilterTitle {
172
+ visibility: hidden;
173
+ }
174
+
175
+ .headFilterButton {
176
+ display: inline-flex;
177
+ grid-area: 1/2;
178
+ align-items: center;
179
+ justify-content: center;
180
+ width: 20px;
181
+ height: 20px;
182
+ padding: 0;
183
+ color: var(--text-minor);
184
+ cursor: pointer;
185
+ background: none;
186
+ border: 0;
187
+ border-radius: var(--rounding-s);
188
+ }
189
+ .headFilterButton:hover {
190
+ color: var(--text-primary);
191
+ }
192
+ .headFilterButton:focus-visible {
193
+ outline: 2px solid var(--control-primary);
194
+ }
195
+
196
+ .headFilter[data-active] .headFilterButton {
197
+ color: var(--text-primary);
198
+ }
199
+
200
+ .headFilterInput,
201
+ .headFilterSelect {
202
+ position: absolute;
203
+ inset: 0 24px 0 0;
204
+ width: calc(100% - 24px);
205
+ min-width: 0;
206
+ padding: 0;
207
+ font: inherit;
208
+ color: var(--text-primary);
209
+ text-align: start;
210
+ outline: none;
211
+ background: transparent;
212
+ border: 0;
213
+ border-radius: 0;
214
+ box-shadow: 0 1px 0 var(--control-secondary);
215
+ }
216
+ .headFilterInput::placeholder,
217
+ .headFilterSelect::placeholder {
218
+ color: var(--text-secondary);
219
+ opacity: 1;
220
+ }
221
+ .headFilterInput:focus-visible,
222
+ .headFilterSelect:focus-visible {
223
+ box-shadow: 0 1px 0 var(--control-primary);
224
+ }
225
+
226
+ .headFilterSelect {
227
+ overflow: hidden;
228
+ text-overflow: ellipsis;
229
+ white-space: nowrap;
230
+ cursor: pointer;
231
+ }
232
+
233
+ .headFilterPlaceholder {
234
+ color: var(--text-secondary);
235
+ }
236
+
237
+ .sortButton {
238
+ display: inline-flex;
239
+ gap: 4px;
240
+ align-items: center;
241
+ padding: 0;
242
+ font: inherit;
243
+ color: inherit;
244
+ cursor: pointer;
245
+ background: none;
246
+ border: 0;
247
+ border-radius: var(--rounding-s);
248
+ }
249
+ .sortButton:hover {
250
+ color: var(--text-primary);
251
+ }
252
+ .sortButton:focus-visible {
253
+ outline: 2px solid var(--control-primary);
254
+ outline-offset: 2px;
255
+ }
256
+
257
+ .row {
258
+ outline: none;
259
+ }
260
+ .row:focus-visible > td {
261
+ box-shadow: inset 0 0 0 1px var(--control-primary);
262
+ }
263
+
264
+ .clickable {
265
+ cursor: pointer;
266
+ }
267
+
268
+ @media (hover: hover) {
269
+ .hoverable:hover > td {
270
+ background-color: var(--table-hover-bg);
271
+ }
272
+ }
273
+ .striped > td {
274
+ background-color: var(--background-secondary);
275
+ }
276
+
277
+ .selected > td {
278
+ background-color: var(--accent-light);
279
+ }
280
+
281
+ .empty > td {
282
+ padding: 32px var(--table-pad-x);
283
+ color: var(--text-minor);
284
+ text-align: center;
285
+ }
286
+
287
+ .expandedRow > td {
288
+ padding: 0 var(--table-pad-x) var(--table-pad-y);
289
+ background-color: var(--table-row-bg);
290
+ }
291
+
292
+ .expandedPanel {
293
+ padding: 16px 20px;
294
+ background-color: var(--background-secondary);
295
+ border-radius: var(--rounding-m);
296
+ }
297
+
298
+ .disabled > td {
299
+ color: var(--text-minor);
300
+ opacity: 0.6;
301
+ }
302
+
303
+ .disabled:hover > td {
304
+ cursor: not-allowed;
305
+ background-color: var(--table-disabled-hover-bg);
306
+ }
307
+
308
+ .rowLoading {
309
+ position: relative;
310
+ }
311
+ .rowLoading > td {
312
+ color: var(--text-minor);
313
+ }
314
+
315
+ .loadingBorder {
316
+ position: absolute;
317
+ inset: 0;
318
+ z-index: 2;
319
+ overflow: visible;
320
+ pointer-events: none;
321
+ animation: table-row-border-in 0.25s ease-out;
322
+ }
323
+
324
+ .loadingTrack,
325
+ .loadingRun {
326
+ fill: none;
327
+ stroke-width: 2;
328
+ }
329
+
330
+ .loadingTrack {
331
+ stroke: var(--control-minor);
332
+ }
333
+
334
+ .loadingRun {
335
+ stroke: var(--control-accent);
336
+ stroke-linecap: round;
337
+ animation: table-row-border-run linear infinite;
338
+ }
339
+
340
+ @keyframes table-row-border-run {
341
+ from {
342
+ stroke-dashoffset: 0;
343
+ }
344
+ to {
345
+ stroke-dashoffset: calc(var(--table-row-perimeter) * -1);
346
+ }
347
+ }
348
+ @keyframes table-row-border-in {
349
+ from {
350
+ opacity: 0;
351
+ }
352
+ to {
353
+ opacity: 1;
354
+ }
355
+ }
356
+ @media (prefers-reduced-motion: reduce) {
357
+ .loadingRun {
358
+ animation: none;
359
+ }
360
+ }
361
+ .rowError > td {
362
+ background-color: var(--attention-light);
363
+ }
364
+
365
+ .errorRow > td {
366
+ padding: 0 var(--table-pad-x) var(--table-pad-y);
367
+ font-size: 13px;
368
+ line-height: 18px;
369
+ color: var(--attention-primary);
370
+ background-color: var(--attention-light);
371
+ }
372
+
373
+ .expander {
374
+ display: inline-flex;
375
+ align-items: center;
376
+ justify-content: center;
377
+ width: 32px;
378
+ height: 32px;
379
+ padding: 0;
380
+ color: var(--text-primary);
381
+ cursor: pointer;
382
+ background: var(--background-primary);
383
+ border: 1px solid var(--control-secondary);
384
+ border-radius: var(--rounding-m);
385
+ }
386
+ .expander:hover {
387
+ background: var(--background-secondary);
388
+ }
389
+ .expander:focus-visible {
390
+ outline: 2px solid var(--control-primary);
391
+ }
392
+ .expander svg {
393
+ width: 20px;
394
+ height: 20px;
395
+ transform: rotate(90deg);
396
+ transition: transform 0.15s ease-out;
397
+ }
398
+
399
+ .expanderOpen svg {
400
+ transform: rotate(-90deg);
401
+ }
402
+
403
+ .expanderCustom svg,
404
+ .expanderCustom.expanderOpen svg {
405
+ transform: none;
406
+ }
407
+
408
+ .expanderCustom.expanderOpen {
409
+ background: var(--control-minor);
410
+ }
411
+
412
+ .spacer > td {
413
+ padding: 0;
414
+ border: 0;
415
+ }
416
+
417
+ .fetching > td {
418
+ padding: 12px var(--table-pad-x);
419
+ }
420
+
421
+ .fetchingInner {
422
+ position: sticky;
423
+ inset-inline-start: 0;
424
+ display: flex;
425
+ justify-content: center;
426
+ width: 100%;
427
+ }
428
+
429
+ .virtual > .body > .scroll > .table > tbody > .row > td {
430
+ box-sizing: border-box;
431
+ height: var(--table-row-height);
432
+ padding-block: 0;
433
+ overflow: hidden;
434
+ text-overflow: ellipsis;
435
+ white-space: nowrap;
436
+ }
437
+
438
+ .loading {
439
+ position: absolute;
440
+ inset: 0;
441
+ z-index: 4;
442
+ display: flex;
443
+ align-items: center;
444
+ justify-content: center;
445
+ background-color: color-mix(in sRGB, var(--background-primary) 60%, transparent);
446
+ }
447
+
448
+ .footer {
449
+ padding-block-start: 16px;
450
+ }
451
+
452
+ .variant-rows > .body > .scroll > .table > .head > tr > th:first-child {
453
+ border-start-start-radius: var(--rounding-l);
454
+ border-end-start-radius: var(--rounding-l);
455
+ }
456
+ .variant-rows > .body > .scroll > .table > .head > tr > th:last-child {
457
+ border-start-end-radius: var(--rounding-l);
458
+ border-end-end-radius: var(--rounding-l);
459
+ }
460
+ .variant-rows > .body > .scroll > .table > tbody > .row:not(:last-child, .hasExpanded) > td,
461
+ .variant-rows > .body > .scroll > .table > tbody > .expandedRow:not(:last-child) > td,
462
+ .variant-rows > .body > .scroll > .table > tbody > .errorRow:not(:last-child, :has(+ .expandedRow)) > td {
463
+ border-block-end: 1px solid var(--table-line);
464
+ }
465
+
466
+ .variant-cells > .body > .scroll {
467
+ border: 1px solid var(--table-line);
468
+ border-radius: var(--rounding-l);
469
+ }
470
+ .variant-cells > .body > .scroll > .table > .head > tr > th {
471
+ border-block-end: 1px solid var(--table-line);
472
+ border-inline-end: 1px solid var(--table-line);
473
+ }
474
+ .variant-cells > .body > .scroll > .table > .head > tr > th:last-child {
475
+ border-inline-end: 0;
476
+ }
477
+ .variant-cells > .body > .scroll > .table > tbody > .row > td {
478
+ border-inline-end: 1px solid var(--table-line);
479
+ }
480
+ .variant-cells > .body > .scroll > .table > tbody > .row > td:last-child {
481
+ border-inline-end: 0;
482
+ }
483
+ .variant-cells > .body > .scroll > .table > .head > tr > th.stickyEnd,
484
+ .variant-cells > .body > .scroll > .table > tbody > .row > td.stickyEnd {
485
+ border-inline-start: 1px solid var(--table-line);
486
+ }
487
+ .variant-cells > .body > .scroll > .table > .head > tr > th:has(+ .stickyEnd),
488
+ .variant-cells > .body > .scroll > .table > tbody > .row > td:has(+ .stickyEnd) {
489
+ border-inline-end: 0;
490
+ }
491
+ .variant-cells > .body > .scroll > .table > tbody > .row:not(:last-child) > td,
492
+ .variant-cells > .body > .scroll > .table > tbody > .expandedRow > td {
493
+ border-block-end: 1px solid var(--table-line);
494
+ }
495
+
496
+ .variant-blocks {
497
+ --table-row-bg: var(--background-secondary);
498
+ --table-expanded-bg: var(--background-secondary);
499
+ }
500
+ .variant-blocks > .body > .scroll > .table > .head > tr > th {
501
+ font-weight: 700;
502
+ color: var(--text-primary);
503
+ background-clip: padding-box;
504
+ border-block-end: var(--table-gap) solid transparent;
505
+ }
506
+ .variant-blocks > .body > .scroll > .table > .head > tr > th:first-child,
507
+ .variant-blocks > .body > .scroll > .table > tbody > .row > td:first-child {
508
+ border-start-start-radius: var(--rounding-m);
509
+ }
510
+ .variant-blocks > .body > .scroll > .table > .head > tr > th:last-child,
511
+ .variant-blocks > .body > .scroll > .table > tbody > .row > td:last-child {
512
+ border-start-end-radius: var(--rounding-m);
513
+ }
514
+ .variant-blocks > .body > .scroll > .table > tbody > .row > td {
515
+ background-clip: padding-box;
516
+ border-block-start: var(--table-gap) solid transparent;
517
+ }
518
+ .variant-blocks > .body > .scroll > .table > tbody > .row:first-child > td {
519
+ border-block-start: 0;
520
+ }
521
+ .variant-blocks > .body > .scroll > .table > tbody > .row:not(.hasExpanded) > td:first-child {
522
+ border-end-start-radius: var(--rounding-m);
523
+ }
524
+ .variant-blocks > .body > .scroll > .table > tbody > .row:not(.hasExpanded) > td:last-child {
525
+ border-end-end-radius: var(--rounding-m);
526
+ }
527
+ .variant-blocks > .body > .scroll > .table > tbody > .errorRow:not(:has(+ .expandedRow)) > td {
528
+ border-end-start-radius: var(--rounding-m);
529
+ border-end-end-radius: var(--rounding-m);
530
+ }
531
+ .variant-blocks > .body > .scroll > .table > tbody > .expandedRow > td {
532
+ padding-block-start: 0;
533
+ border-end-start-radius: var(--rounding-m);
534
+ border-end-end-radius: var(--rounding-m);
535
+ }
536
+ .variant-blocks > .body > .scroll > .table > tbody > .selected > td {
537
+ background-color: var(--accent-light);
538
+ }
539
+ .variant-blocks > .body > .scroll > .table > tbody > .hoverable:hover > td {
540
+ background-color: var(--table-hover-bg);
541
+ }
542
+
543
+ .variant-blocks:not(.reverse) > .body > .scroll > .table > tbody > .row > td [data-lt-ui=field] > [aria-hidden=true] {
544
+ background-color: var(--background-primary);
545
+ }
546
+
547
+ .variant-cells > .body > .scroll > .table > tbody > .row > td:has([data-table-square]) {
548
+ position: relative;
549
+ padding: 0;
550
+ }
551
+ .variant-cells > .body > .scroll > .table > tbody > .row > td:has([data-table-square]):has([data-table-square]:focus-within) {
552
+ z-index: 1;
553
+ outline: 2px solid var(--control-accent);
554
+ outline-offset: -2px;
555
+ }
556
+ .variant-cells > .body > .scroll > .table > tbody > .row > td:has([data-table-square]):has([data-error]) {
557
+ outline: 1px solid var(--attention-primary);
558
+ outline-offset: -1px;
559
+ }
560
+ .variant-cells > .body > .scroll > .table > tbody > .row > td:has([data-table-square]):has([data-error])::after {
561
+ position: absolute;
562
+ inset-block-start: 0;
563
+ inset-inline-end: 0;
564
+ width: 0;
565
+ height: 0;
566
+ pointer-events: none;
567
+ content: "";
568
+ border-block-start: 9px solid var(--attention-primary);
569
+ border-inline-start: 9px solid transparent;
570
+ }
571
+ .variant-cells > .body > .scroll > .table > tbody > .row > td:has([data-table-square]):has([data-error]):has([data-table-square]:focus-within) {
572
+ outline: 2px solid var(--attention-primary);
573
+ outline-offset: -2px;
574
+ }
575
+
576
+ .toolbar {
577
+ display: flex;
578
+ flex-wrap: wrap;
579
+ gap: 8px 12px;
580
+ align-items: center;
581
+ margin-bottom: 12px;
582
+ }
583
+
584
+ .toolbarSearch {
585
+ flex: 0 1 320px;
586
+ min-width: 200px;
587
+ }
588
+
589
+ .toolbarFilters {
590
+ display: flex;
591
+ flex-wrap: wrap;
592
+ gap: 8px;
593
+ align-items: center;
594
+ }
595
+
596
+ .toolbarActions {
597
+ display: flex;
598
+ gap: 8px;
599
+ align-items: center;
600
+ margin-left: auto;
601
+ }
602
+
603
+ .settings {
604
+ display: grid;
605
+ gap: 4px;
606
+ min-width: 260px;
607
+ max-height: 60vh;
608
+ padding: 8px;
609
+ overflow-y: auto;
610
+ }
611
+
612
+ .settingsItem {
613
+ display: flex;
614
+ gap: 8px;
615
+ align-items: center;
616
+ padding: 4px 8px;
617
+ border-radius: var(--rounding-m);
618
+ }
619
+
620
+ .settingsLabel {
621
+ flex: 1 1 auto;
622
+ min-width: 0;
623
+ overflow: hidden;
624
+ text-overflow: ellipsis;
625
+ white-space: nowrap;
626
+ }
627
+
628
+ .settingsHandle {
629
+ display: inline-flex;
630
+ flex: 0 0 auto;
631
+ align-items: center;
632
+ justify-content: center;
633
+ width: 24px;
634
+ height: 24px;
635
+ padding: 0;
636
+ color: var(--text-secondary);
637
+ background: transparent;
638
+ border: 0;
639
+ border-radius: var(--rounding-s);
640
+ }
641
+ .settingsHandle:hover {
642
+ color: var(--text-primary);
643
+ background: var(--control-minor);
644
+ }
645
+ .settingsHandle:focus-visible {
646
+ outline: 2px solid var(--control-primary);
647
+ }
648
+
649
+ .settingsItem[data-dragging] {
650
+ background: var(--background-primary);
651
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1607843137);
652
+ }
653
+
654
+ .settingsFooter {
655
+ display: flex;
656
+ justify-content: flex-end;
657
+ padding: 8px 8px 0;
658
+ margin-top: 4px;
659
+ border-top: 1px solid var(--control-minor);
660
+ }
661
+
662
+ .reverse {
663
+ --table-surface: transparent;
664
+ --table-head-bg: var(--background-primary);
665
+ --table-row-bg: transparent;
666
+ --table-expanded-bg: var(--background-primary);
667
+ }
668
+ .reverse.variant-blocks {
669
+ --table-row-bg: var(--background-primary);
670
+ --table-expanded-bg: var(--background-primary);
671
+ }
672
+ .reverse.variant-cells .scroll {
673
+ background-color: var(--background-primary);
674
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TableHead = TableHead;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = __importDefault(require("react"));
9
+ const clsx_1 = __importDefault(require("clsx"));
10
+ const react_table_1 = require("@tanstack/react-table");
11
+ const header_filter_1 = require("./header-filter");
12
+ const sort_icon_1 = require("./sort-icon");
13
+ const layout_1 = require("./layout");
14
+ const styles_module_scss_1 = __importDefault(require("./styles.module.css"));
15
+ const ariaSort = (sorted) => {
16
+ if (sorted === 'asc')
17
+ return 'ascending';
18
+ if (sorted === 'desc')
19
+ return 'descending';
20
+ return 'none';
21
+ };
22
+ const titleOf = (column) => {
23
+ var _a;
24
+ const { header, meta } = column.columnDef;
25
+ return (_a = meta === null || meta === void 0 ? void 0 : meta.title) !== null && _a !== void 0 ? _a : (typeof header === 'string' ? header : column.id);
26
+ };
27
+ /** Если у колонки задан `meta.filter`, в шапке появляется фильтр (лупа, превращающаяся в поле) */
28
+ const withFilter = (column, content) => {
29
+ var _a;
30
+ const filter = (_a = column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.filter;
31
+ if (!filter || !column.getCanFilter())
32
+ return content;
33
+ return ((0, jsx_runtime_1.jsx)(header_filter_1.HeaderFilter, { column: column, filter: filter === 'text' ? {} : filter, title: titleOf(column), children: content }));
34
+ };
35
+ function TableHead({ table, sticky, }) {
36
+ return ((0, jsx_runtime_1.jsx)("thead", { className: (0, clsx_1.default)(styles_module_scss_1.default.head, sticky && styles_module_scss_1.default.stickyHeader), children: table.getHeaderGroups().map(group => ((0, jsx_runtime_1.jsx)("tr", { children: group.headers.map(header => {
37
+ if (header.isPlaceholder) {
38
+ return (0, jsx_runtime_1.jsx)("th", { colSpan: header.colSpan }, header.id);
39
+ }
40
+ const { column } = header;
41
+ const canSort = column.getCanSort();
42
+ const content = (0, react_table_1.flexRender)(column.columnDef.header, header.getContext());
43
+ return ((0, jsx_runtime_1.jsx)("th", { scope: "col", colSpan: header.colSpan, className: (0, layout_1.cellClass)(column, 'header'), style: (0, layout_1.cellStyle)(column), "aria-sort": canSort ? ariaSort(column.getIsSorted()) : undefined, children: withFilter(column, canSort ? ((0, jsx_runtime_1.jsxs)("button", { type: "button", className: styles_module_scss_1.default.sortButton, onClick: column.getToggleSortingHandler(), children: [(0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.headerText, children: content }), (0, jsx_runtime_1.jsx)(sort_icon_1.SortIcon, { direction: column.getIsSorted() })] })) : ((0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.headerText, children: content }))) }, header.id));
44
+ }) }, group.id))) }));
45
+ }