@lt-ui/table 0.0.0-stage → 0.0.2

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