comins-table 0.1.5 → 0.1.6

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/styles.css CHANGED
@@ -11,16 +11,24 @@
11
11
  --comins-table-cell-height: 36px;
12
12
  --comins-table-cell-padding-x: 12px;
13
13
  --comins-table-cell-padding-y: 8px;
14
+ --comins-table-detail-background: var(--comins-table-surface);
15
+ --comins-table-detail-border: var(--comins-table-row-border);
16
+ --comins-table-detail-padding: 12px;
17
+ --comins-table-drop-invalid: #dc2626;
18
+ --comins-table-drop-invalid-background: rgba(220, 38, 38, 0.22);
14
19
  --comins-table-drop-marker: #064e3b;
20
+ --comins-table-drop-valid: #2563eb;
21
+ --comins-table-drop-valid-background: rgba(37, 99, 235, 0.22);
15
22
  --comins-table-focus: rgba(16, 185, 129, 0.28);
16
23
  --comins-table-foreground: #111827;
17
24
  --comins-table-header-background: var(--comins-table-accent);
18
- --comins-table-header-border: var(--comins-table-accent-strong);
25
+ --comins-table-header-border: var(--comins-table-row-border);
19
26
  --comins-table-header-color: var(--comins-table-accent-foreground);
20
27
  --comins-table-header-height: 36px;
21
- --comins-table-header-split-border: var(--comins-table-accent-strong);
28
+ --comins-table-header-split-border: var(--comins-table-cell-border);
22
29
  --comins-table-muted: #64748b;
23
30
  --comins-table-range-background: #f1fcf8;
31
+ --comins-table-selected-range-background: var(--comins-table-row-selected-background);
24
32
  --comins-table-resize-handle: color-mix(in srgb, var(--comins-table-header-color) 70%, transparent);
25
33
  --comins-table-row-border: #bbe7d6;
26
34
  --comins-table-row-disabled-background: #f1f5f9;
@@ -86,8 +94,8 @@
86
94
  --comins-table-accent-soft: #d1fae5;
87
95
  --comins-table-cell-border: #a7dbc8;
88
96
  --comins-table-header-background: #10b981;
89
- --comins-table-header-border: #047857;
90
- --comins-table-header-split-border: #047857;
97
+ --comins-table-header-border: var(--comins-table-row-border);
98
+ --comins-table-header-split-border: var(--comins-table-cell-border);
91
99
  --comins-table-row-border: #bbe7d6;
92
100
  --comins-table-row-disabled-background: #f1f5f9;
93
101
  --comins-table-row-disabled-color: #64748b;
@@ -109,9 +117,9 @@
109
117
  --comins-table-focus: rgba(45, 212, 191, 0.26);
110
118
  --comins-table-foreground: #effcf7;
111
119
  --comins-table-header-background: #064e3b;
112
- --comins-table-header-border: #0f766e;
120
+ --comins-table-header-border: var(--comins-table-row-border);
113
121
  --comins-table-header-color: #ecfdf5;
114
- --comins-table-header-split-border: #10b981;
122
+ --comins-table-header-split-border: var(--comins-table-cell-border);
115
123
  --comins-table-muted: #9ad8c4;
116
124
  --comins-table-range-background: #1f3530;
117
125
  --comins-table-row-border: #2c4c42;
@@ -135,9 +143,9 @@
135
143
  --comins-table-drop-marker: #278aa7;
136
144
  --comins-table-focus: rgba(39, 138, 167, 0.24);
137
145
  --comins-table-header-background: #87ceeb;
138
- --comins-table-header-border: #278aa7;
146
+ --comins-table-header-border: var(--comins-table-row-border);
139
147
  --comins-table-header-color: #07364a;
140
- --comins-table-header-split-border: #278aa7;
148
+ --comins-table-header-split-border: var(--comins-table-cell-border);
141
149
  --comins-table-range-background: #cdeeff;
142
150
  --comins-table-row-border: #a6dbed;
143
151
  --comins-table-row-disabled-background: #dbeff7;
@@ -160,9 +168,9 @@
160
168
  --comins-table-drop-marker: #22c55e;
161
169
  --comins-table-focus: rgba(34, 197, 94, 0.24);
162
170
  --comins-table-header-background: #98ff98;
163
- --comins-table-header-border: #22c55e;
171
+ --comins-table-header-border: var(--comins-table-row-border);
164
172
  --comins-table-header-color: #053f1c;
165
- --comins-table-header-split-border: #22c55e;
173
+ --comins-table-header-split-border: var(--comins-table-cell-border);
166
174
  --comins-table-range-background: #dfffe0;
167
175
  --comins-table-row-border: #9feaab;
168
176
  --comins-table-row-disabled-background: #e5f7e5;
@@ -185,9 +193,9 @@
185
193
  --comins-table-drop-marker: #7e7e7e;
186
194
  --comins-table-focus: rgba(126, 126, 126, 0.24);
187
195
  --comins-table-header-background: #bcbcbc;
188
- --comins-table-header-border: #7e7e7e;
196
+ --comins-table-header-border: var(--comins-table-row-border);
189
197
  --comins-table-header-color: #1f2937;
190
- --comins-table-header-split-border: #7e7e7e;
198
+ --comins-table-header-split-border: var(--comins-table-cell-border);
191
199
  --comins-table-range-background: #e5e5e5;
192
200
  --comins-table-row-border: #c7c7c7;
193
201
  --comins-table-row-disabled-background: #e7e7e7;
@@ -210,9 +218,9 @@
210
218
  --comins-table-drop-marker: #d97706;
211
219
  --comins-table-focus: rgba(245, 158, 11, 0.24);
212
220
  --comins-table-header-background: #ffa500;
213
- --comins-table-header-border: #d97706;
221
+ --comins-table-header-border: var(--comins-table-row-border);
214
222
  --comins-table-header-color: #2f1600;
215
- --comins-table-header-split-border: #d97706;
223
+ --comins-table-header-split-border: var(--comins-table-cell-border);
216
224
  --comins-table-range-background: #ffedd5;
217
225
  --comins-table-row-border: #fbbf24;
218
226
  --comins-table-row-disabled-background: #f7ead6;
@@ -243,6 +251,40 @@
243
251
  font-weight: 700;
244
252
  }
245
253
 
254
+ .comins-table-icon {
255
+ color: currentColor;
256
+ display: block;
257
+ flex: 0 0 15px;
258
+ height: 15px;
259
+ width: 15px;
260
+ }
261
+
262
+ .comins-table-icon-button {
263
+ align-items: center;
264
+ background: transparent;
265
+ border: 0;
266
+ color: inherit;
267
+ cursor: pointer;
268
+ display: inline-flex;
269
+ font: inherit;
270
+ height: 24px;
271
+ justify-content: center;
272
+ min-height: 24px;
273
+ min-width: 24px;
274
+ padding: 0;
275
+ width: 24px;
276
+ }
277
+
278
+ .comins-table-icon-button:disabled {
279
+ cursor: not-allowed;
280
+ opacity: 0.55;
281
+ }
282
+
283
+ .comins-table-icon-button:focus-visible {
284
+ box-shadow: 0 0 0 3px var(--comins-table-focus);
285
+ outline: none;
286
+ }
287
+
246
288
  .comins-tree-cell-content {
247
289
  align-items: center;
248
290
  display: inline-flex;
@@ -253,30 +295,60 @@
253
295
 
254
296
  .comins-tree-expander,
255
297
  .comins-tree-expander-spacer {
256
- flex: 0 0 18px;
257
- height: 18px;
258
- width: 18px;
298
+ flex: 0 0 24px;
299
+ height: 24px;
300
+ width: 24px;
259
301
  }
260
302
 
261
303
  .comins-tree-expander {
262
- align-items: center;
263
- background: transparent;
264
- border: 0;
265
304
  color: var(--comins-table-accent-strong);
266
- cursor: pointer;
267
- display: inline-flex;
268
- font: inherit;
269
- justify-content: center;
270
- padding: 0;
271
305
  }
272
306
 
273
- .comins-tree-expander:focus-visible {
274
- box-shadow: 0 0 0 3px var(--comins-table-focus);
275
- outline: none;
307
+ .comins-tree-cell-value {
308
+ min-width: 0;
276
309
  }
277
310
 
278
- .comins-tree-cell-value {
311
+ .comins-row-detail-expander {
312
+ color: var(--comins-table-accent-strong);
313
+ }
314
+
315
+ .comins-row-detail-expander .comins-table-icon,
316
+ .comins-tree-expander .comins-table-icon {
317
+ transform: rotate(0deg);
318
+ transition: transform 160ms ease;
319
+ }
320
+
321
+ .comins-row-detail-expander[aria-expanded="true"] .comins-table-icon,
322
+ .comins-tree-expander[aria-expanded="true"] .comins-table-icon {
323
+ transform: rotate(90deg);
324
+ }
325
+
326
+ .comins-row-cell-content {
327
+ align-items: center;
328
+ display: flex;
279
329
  min-width: 0;
330
+ width: 100%;
331
+ }
332
+
333
+ .comins-row-cell-content__value {
334
+ flex: 1 1 auto;
335
+ min-width: 0;
336
+ overflow: hidden;
337
+ }
338
+
339
+ .comins-row-leading-controls {
340
+ align-items: center;
341
+ display: inline-flex;
342
+ flex: 0 0 auto;
343
+ gap: 2px;
344
+ margin-right: 4px;
345
+ }
346
+
347
+ .comins-row-detail-expander-spacer,
348
+ .comins-row-drag-handle {
349
+ flex: 0 0 24px;
350
+ height: 24px;
351
+ width: 24px;
280
352
  }
281
353
 
282
354
  .comins-table__body-viewport {
@@ -291,6 +363,7 @@
291
363
 
292
364
  .comins-table__body-viewport[data-virtualized="true"] {
293
365
  contain: layout paint;
366
+ overflow-anchor: none;
294
367
  position: relative;
295
368
  scroll-behavior: auto;
296
369
  }
@@ -403,6 +476,11 @@
403
476
  .comins-table__skeleton-block {
404
477
  animation: none;
405
478
  }
479
+
480
+ .comins-row-detail-expander .comins-table-icon,
481
+ .comins-tree-expander .comins-table-icon {
482
+ transition: none;
483
+ }
406
484
  }
407
485
 
408
486
  .comins-table__table {
@@ -454,6 +532,33 @@
454
532
  overflow: hidden;
455
533
  }
456
534
 
535
+ .comins-table__body-table .comins-table__td {
536
+ padding-bottom: min(
537
+ var(--comins-table-cell-padding-y),
538
+ max(0px, calc((var(--comins-table-row-height) - 25px) / 2))
539
+ );
540
+ padding-top: min(
541
+ var(--comins-table-cell-padding-y),
542
+ max(0px, calc((var(--comins-table-row-height) - 25px) / 2))
543
+ );
544
+ }
545
+
546
+ .comins-table__detail-cell {
547
+ border: 0;
548
+ height: auto;
549
+ overflow: visible;
550
+ padding: 0;
551
+ }
552
+
553
+ .comins-table__detail-content {
554
+ background: var(--comins-table-detail-background);
555
+ border-bottom: 1px solid var(--comins-table-detail-border);
556
+ border-right: 1px solid var(--comins-table-detail-border);
557
+ box-sizing: border-box;
558
+ overflow: auto;
559
+ padding: var(--comins-table-detail-padding);
560
+ }
561
+
457
562
  .comins-table__th {
458
563
  border-top: 1px solid var(--comins-table-header-border);
459
564
  cursor: grab;
@@ -497,8 +602,12 @@
497
602
  cursor: grabbing;
498
603
  }
499
604
 
605
+ .comins-table__th[data-column-position-locked="true"] {
606
+ cursor: default;
607
+ }
608
+
500
609
  .comins-table__th[data-column-placeholder="true"] {
501
- background: color-mix(in srgb, var(--comins-table-surface-muted) 82%, transparent);
610
+ background: color-mix(in srgb, var(--comins-table-header-background) 82%, #000000);
502
611
  outline: 1px dashed var(--comins-table-drop-marker);
503
612
  outline-offset: -2px;
504
613
  }
@@ -509,6 +618,23 @@
509
618
  pointer-events: none;
510
619
  }
511
620
 
621
+ .comins-column-placeholder-label {
622
+ display: none;
623
+ }
624
+
625
+ .comins-table__th[data-column-placeholder="true"] > .comins-column-placeholder-label {
626
+ align-items: center;
627
+ display: flex;
628
+ inset: 0;
629
+ justify-content: center;
630
+ overflow: hidden;
631
+ padding: 0 12px;
632
+ pointer-events: none;
633
+ position: absolute;
634
+ text-overflow: ellipsis;
635
+ white-space: nowrap;
636
+ }
637
+
512
638
  .comins-table__header-content {
513
639
  align-items: center;
514
640
  column-gap: 0;
@@ -524,6 +650,21 @@
524
650
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto minmax(0, auto);
525
651
  }
526
652
 
653
+ .comins-column-move-handle {
654
+ align-items: center;
655
+ cursor: grab;
656
+ display: inline-flex;
657
+ flex: 0 0 24px;
658
+ height: 24px;
659
+ justify-content: center;
660
+ touch-action: none;
661
+ width: 24px;
662
+ }
663
+
664
+ .comins-column-move-handle:active {
665
+ cursor: grabbing;
666
+ }
667
+
527
668
  .comins-table__header-label,
528
669
  .comins-table__header-label > * {
529
670
  display: block;
@@ -621,33 +762,75 @@
621
762
  display: block;
622
763
  }
623
764
 
624
- .comins-table__th[data-column-drop-target="true"] {
625
- background: var(--comins-table-accent-strong);
765
+ .comins-table__th[data-column-drop-target="true"][data-column-drop-valid="true"] {
766
+ background: var(--comins-table-drop-valid-background);
767
+ outline: 2px solid var(--comins-table-drop-valid);
768
+ outline-offset: -2px;
769
+ }
770
+
771
+ .comins-table__th[data-column-drop-valid="true"] .comins-column-drop-marker {
772
+ background: var(--comins-table-drop-valid);
626
773
  }
627
774
 
628
775
  .comins-table__th[data-column-placeholder="true"][data-column-drop-target="true"] {
629
- background: color-mix(in srgb, var(--comins-table-surface-muted) 82%, transparent);
776
+ background: color-mix(in srgb, var(--comins-table-header-background) 82%, #000000);
777
+ }
778
+
779
+ .comins-table__th[data-column-drop-target="true"][data-column-drop-valid="false"] {
780
+ background: var(--comins-table-drop-invalid-background);
781
+ cursor: not-allowed;
782
+ outline: 2px solid var(--comins-table-drop-invalid);
783
+ outline-offset: -2px;
784
+ }
785
+
786
+ .comins-table__th[data-column-drop-target="true"][data-column-drop-valid="false"] .comins-column-drop-marker {
787
+ background: var(--comins-table-drop-invalid);
788
+ }
789
+
790
+ [data-column-move-animating="prepare"] {
791
+ transition: none;
792
+ translate: var(--comins-column-move-offset) 0;
793
+ }
794
+
795
+ [data-column-move-animating="true"] {
796
+ transition: translate 180ms ease-out;
797
+ translate: var(--comins-column-move-offset) 0;
798
+ will-change: translate;
799
+ }
800
+
801
+ @media (prefers-reduced-motion: reduce) {
802
+ [data-column-move-animating] {
803
+ transition: none;
804
+ translate: none;
805
+ }
630
806
  }
631
807
 
632
808
  .comins-column-move-ghost {
809
+ align-items: center;
633
810
  background: var(--comins-table-drop-marker);
634
811
  border: 1px solid rgba(255, 255, 255, 0.58);
635
812
  border-radius: 6px;
636
813
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
637
814
  color: #ffffff;
815
+ display: inline-flex;
638
816
  font-size: 13px;
639
817
  font-weight: 800;
640
818
  max-width: 220px;
641
- overflow: hidden;
819
+ gap: 6px;
642
820
  padding: 7px 10px;
643
821
  pointer-events: none;
644
822
  position: fixed;
645
- text-overflow: ellipsis;
646
823
  top: 0;
647
824
  white-space: nowrap;
648
825
  z-index: 60;
649
826
  }
650
827
 
828
+ .comins-column-move-ghost__label {
829
+ min-width: 0;
830
+ overflow: hidden;
831
+ text-overflow: ellipsis;
832
+ }
833
+
651
834
  .comins-sort-meta {
652
835
  align-items: center;
653
836
  display: inline-flex;
@@ -666,35 +849,6 @@
666
849
  transform 180ms ease;
667
850
  }
668
851
 
669
- .comins-sort-icon {
670
- display: inline-block;
671
- height: 14px;
672
- position: relative;
673
- width: 14px;
674
- }
675
-
676
- .comins-sort-icon::before {
677
- border-left: 2px solid currentColor;
678
- border-top: 2px solid currentColor;
679
- content: "";
680
- height: 6px;
681
- left: 3px;
682
- position: absolute;
683
- top: 2px;
684
- transform: rotate(45deg);
685
- width: 6px;
686
- }
687
-
688
- .comins-sort-icon::after {
689
- background: currentColor;
690
- content: "";
691
- height: 8px;
692
- left: 6px;
693
- position: absolute;
694
- top: 4px;
695
- width: 2px;
696
- }
697
-
698
852
  .comins-sort-indicator[data-sort-state="asc"] {
699
853
  display: inline-flex;
700
854
  opacity: 1;
@@ -704,7 +858,7 @@
704
858
  .comins-sort-indicator[data-sort-state="desc"] {
705
859
  display: inline-flex;
706
860
  opacity: 1;
707
- transform: scale(1) rotate(180deg);
861
+ transform: scale(1) rotate(0deg);
708
862
  }
709
863
 
710
864
  .comins-sort-priority {
@@ -747,23 +901,21 @@
747
901
  z-index: 1;
748
902
  }
749
903
 
750
- .comins-table__td--with-row-handle {
751
- padding-left: 30px;
752
- position: relative;
904
+ .comins-row-drag-handle {
905
+ align-items: center;
906
+ cursor: grab;
907
+ display: inline-flex;
908
+ justify-content: center;
909
+ opacity: 0.55;
753
910
  }
754
911
 
755
- .comins-row-drag-handle {
912
+ .comins-row-drag-handle::before {
756
913
  background:
757
914
  radial-gradient(circle, var(--comins-table-accent-strong) 1px, transparent 1.5px) 0 0 / 4px 4px;
758
- cursor: grab;
915
+ content: "";
759
916
  display: block;
760
- height: 14px;
761
- left: 10px;
762
- opacity: 0.55;
763
- position: absolute;
764
- top: 50%;
765
- transform: translateY(-50%);
766
- width: 10px;
917
+ height: 15px;
918
+ width: 15px;
767
919
  }
768
920
 
769
921
  .comins-row-drag-handle:active {
@@ -790,11 +942,20 @@
790
942
  border-bottom: 0;
791
943
  }
792
944
 
793
- .comins-table__tr > .comins-table__td.comins-cell-range-selected,
794
- .comins-table__tr.comins-row-selected > .comins-table__td.comins-cell-range-selected {
945
+ .comins-table__tr > .comins-table__td.comins-cell-range-selected {
795
946
  background: var(--comins-table-range-background);
796
947
  }
797
948
 
949
+ .comins-table__tr.comins-row-selected > .comins-table__td.comins-cell-range-selected {
950
+ background: var(--comins-table-selected-range-background);
951
+ box-shadow: inset 0 0 0 2px var(--comins-table-accent);
952
+ }
953
+
954
+ .comins-table__tr.comins-row-selected[data-comins-row-custom-background="true"]
955
+ > .comins-table__td.comins-cell-range-selected {
956
+ background: var(--comins-table-row-custom-background);
957
+ }
958
+
798
959
  .comins-table__component-layout {
799
960
  align-items: center;
800
961
  display: inline-flex;