@pretable/ui 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/grid.css CHANGED
@@ -125,10 +125,11 @@
125
125
 
126
126
  /* ---- Row grouping ---------------------------------------------------- */
127
127
 
128
- /* Group headers borrow the header fill so the eye reads them as structure
129
- rather than as another record. */
128
+ /* Group headers take a structural fill so the eye reads them as structure
129
+ rather than as another record. Its own token, not the header's: a theme
130
+ must be able to restyle group rows without restyling the header strip. */
130
131
  :where([data-pretable-group-row] [data-pretable-cell]) {
131
- background: var(--pretable-bg-header);
132
+ background: var(--pretable-bg-group-row);
132
133
  color: var(--pretable-text-header);
133
134
  font-weight: 600;
134
135
  }
@@ -194,20 +195,16 @@
194
195
  );
195
196
  }
196
197
 
197
- /* Hover */
198
- :where([data-pretable-row]:hover [data-pretable-cell]) {
199
- background: var(--pretable-bg-hover);
200
- }
201
-
202
- /* Pinned cells (sticky left) — reuse header background */
198
+ /* Pinned cells (sticky left) — an opaque fill so scrolled columns pass
199
+ underneath, on their own token rather than the header's. */
203
200
  :where([data-pretable-cell][data-pretable-pinned="left"]) {
204
- background: var(--pretable-bg-header);
201
+ background: var(--pretable-bg-pinned);
205
202
  z-index: 1;
206
203
  }
207
204
 
208
205
  /* Pinned cells (sticky right) — mirror of the left rule */
209
206
  :where([data-pretable-cell][data-pretable-pinned="right"]) {
210
- background: var(--pretable-bg-header);
207
+ background: var(--pretable-bg-pinned);
211
208
  z-index: 1;
212
209
  }
213
210
 
@@ -223,6 +220,26 @@
223
220
  var(--pretable-rule-vertical, var(--pretable-rule));
224
221
  }
225
222
 
223
+ /* Hover. Declared after the pinned surfaces on purpose: every selector here is
224
+ :where()-flattened to (0,0,0), so source order is the only cascade lever,
225
+ and a hover declared earlier loses on pinned cells — leaving a hovered row
226
+ visibly broken in half at the frozen edge. Selection follows this rule for
227
+ the same reason. */
228
+ :where([data-pretable-row]:hover [data-pretable-cell]) {
229
+ /* A background-IMAGE layer, not the background shorthand: the surface rules
230
+ that precede this one (base, zebra, group row, pinned) each set
231
+ `background-color`, and hover must tint that rather than replace it.
232
+ Replacing it is not cosmetic — `--pretable-bg-hover` is a translucent
233
+ state layer in both themes (Excel sets it to `transparent` outright), and
234
+ pinned cells are `position: sticky; z-index: 1` with unpinned cells
235
+ scrolling underneath. A hovered pinned cell that loses its opaque fill
236
+ lets the scrolled-under column print straight through it. */
237
+ background-image: linear-gradient(
238
+ var(--pretable-bg-hover),
239
+ var(--pretable-bg-hover)
240
+ );
241
+ }
242
+
226
243
  /* Selection text color. The selection FILL is drawn by the
227
244
  [role="gridcell"][aria-selected="true"] rule below: @pretable/react sets
228
245
  `aria-selected` and `data-pretable-selected` from the same condition, and
@@ -246,7 +263,17 @@
246
263
  * a usable visual.
247
264
  */
248
265
  :where([role="gridcell"][aria-selected="true"]) {
249
- background: var(--pretable-selection-bg);
266
+ /* A background-image layer for the same reason as hover above:
267
+ `--pretable-selection-bg` is a color-mix at 8% in both themes, so the
268
+ `background` shorthand would replace a pinned cell's opaque fill with a
269
+ 92%-transparent one and let the scrolled-under column show through.
270
+ This rule follows hover in source order, so on a cell that is both
271
+ hovered and selected the selection tint wins the background-image slot
272
+ outright — the same precedence the shorthand gave it, unchanged. */
273
+ background-image: linear-gradient(
274
+ var(--pretable-selection-bg),
275
+ var(--pretable-selection-bg)
276
+ );
250
277
  }
251
278
 
252
279
  :where([role="gridcell"][data-pretable-focused="true"]) {
@@ -410,7 +437,7 @@
410
437
  position: fixed;
411
438
  pointer-events: none;
412
439
  background: var(--pretable-reorder-ghost-bg);
413
- box-shadow: var(--pretable-reorder-ghost-shadow);
440
+ box-shadow: var(--pretable-shadow-overlay);
414
441
  opacity: 0.6;
415
442
  z-index: 10;
416
443
  user-select: none;
@@ -437,7 +464,7 @@
437
464
  height: 18px;
438
465
  padding: 0;
439
466
  border: 0;
440
- border-radius: var(--pretable-radius);
467
+ border-radius: var(--pretable-radius-control);
441
468
  background: transparent;
442
469
  color: var(--pretable-text-dim);
443
470
  cursor: pointer;
@@ -467,7 +494,7 @@
467
494
  flex-direction: column;
468
495
  gap: 8px;
469
496
  padding: 10px;
470
- box-shadow: var(--pretable-reorder-ghost-shadow);
497
+ box-shadow: var(--pretable-shadow-overlay);
471
498
  font: inherit;
472
499
  /* Portaled into <body>, so the font-family declared on the scroll
473
500
  viewport is no longer inherited — declare it here. */
@@ -481,7 +508,7 @@
481
508
  box-sizing: border-box;
482
509
  padding: 5px 7px;
483
510
  border: 1px solid var(--pretable-rule);
484
- border-radius: var(--pretable-radius);
511
+ border-radius: var(--pretable-radius-control);
485
512
  background: var(--pretable-bg-grid);
486
513
  color: var(--pretable-text-cell);
487
514
  font: inherit;
@@ -612,7 +639,7 @@
612
639
  height: 14px;
613
640
  padding: 0;
614
641
  border: 0;
615
- border-radius: var(--pretable-radius);
642
+ border-radius: var(--pretable-radius-control);
616
643
  background: transparent;
617
644
  color: var(--pretable-text-dim);
618
645
  font-size: 10px;
@@ -648,7 +675,7 @@
648
675
  height: 18px;
649
676
  padding: 0;
650
677
  border: 0;
651
- border-radius: var(--pretable-radius);
678
+ border-radius: var(--pretable-radius-control);
652
679
  background: transparent;
653
680
  color: var(--pretable-text-dim);
654
681
  cursor: pointer;
@@ -669,7 +696,7 @@
669
696
  display: flex;
670
697
  flex-direction: column;
671
698
  padding: 4px;
672
- box-shadow: var(--pretable-reorder-ghost-shadow);
699
+ box-shadow: var(--pretable-shadow-overlay);
673
700
  /* Portaled into <body>, so nothing is inherited from the viewport. */
674
701
  font-family: var(--pretable-font-sans);
675
702
  font-size: var(--pretable-font-size-cell);
@@ -679,7 +706,7 @@
679
706
  width: 100%;
680
707
  padding: 6px 8px;
681
708
  border: 0;
682
- border-radius: var(--pretable-radius);
709
+ border-radius: var(--pretable-radius-control);
683
710
  background: transparent;
684
711
  color: var(--pretable-text-cell);
685
712
  font: inherit;
@@ -710,7 +737,7 @@
710
737
  background: var(--pretable-bg-grid);
711
738
  border: 1px solid var(--pretable-rule-strong);
712
739
  border-radius: var(--pretable-radius);
713
- box-shadow: var(--pretable-reorder-ghost-shadow);
740
+ box-shadow: var(--pretable-shadow-overlay);
714
741
  /* Portaled into <body> — see the filter menu above. */
715
742
  font-family: var(--pretable-font-sans);
716
743
  font-size: var(--pretable-font-size-cell);
@@ -748,7 +775,7 @@
748
775
  background: var(--pretable-bg-grid);
749
776
  border: 1px solid var(--pretable-rule-strong);
750
777
  border-radius: var(--pretable-radius);
751
- box-shadow: var(--pretable-reorder-ghost-shadow);
778
+ box-shadow: var(--pretable-shadow-overlay);
752
779
  /* Portaled into <body> — see the filter menu above. */
753
780
  font-family: var(--pretable-font-sans);
754
781
  font-size: var(--pretable-font-size-cell);
@@ -789,7 +816,7 @@
789
816
  :where([data-pretable-date-day]) {
790
817
  text-align: center;
791
818
  padding: 4px 0;
792
- border-radius: var(--pretable-radius);
819
+ border-radius: var(--pretable-radius-control);
793
820
  cursor: pointer;
794
821
  }
795
822
 
@@ -12,6 +12,12 @@
12
12
  --pretable-bg-grid: #ffffff;
13
13
  --pretable-bg-grid-alt: #ffffff; /* No striping by default — Excel doesn't band */
14
14
  --pretable-bg-header: #f3f3f3; /* Excel-for-web header strip */
15
+ /* Pinned body cells and group rows historically borrowed --pretable-bg-header,
16
+ which made it impossible to restyle a frozen data column without also
17
+ restyling the header. They now have their own tokens, defaulted here to the
18
+ value this theme already resolved so nothing moves. */
19
+ --pretable-bg-pinned: var(--pretable-bg-header);
20
+ --pretable-bg-group-row: var(--pretable-bg-header);
15
21
  --pretable-bg-toolbar: #f3f3f3;
16
22
  --pretable-bg-tooltip: #ffffff;
17
23
 
@@ -30,6 +36,7 @@
30
36
  --pretable-rule-vertical: var(--pretable-rule);
31
37
  --pretable-rule-width: 1px;
32
38
  --pretable-radius: 0; /* Sharp edges — Excel never rounds */
39
+ --pretable-radius-control: 0; /* Buttons and menu items don't round either */
33
40
 
34
41
  /* State */
35
42
  --pretable-bg-hover: transparent; /* No row hover — iconic Excel; consumers opt in */
@@ -55,9 +62,18 @@
55
62
  --pretable-resize-handle: transparent;
56
63
  --pretable-resize-handle-hover: var(--pretable-accent);
57
64
  --pretable-reorder-ghost-bg: var(--pretable-bg-header);
58
- --pretable-reorder-ghost-shadow: 0 4px 12px rgb(0 0 0 / 0.12);
59
65
  --pretable-reorder-drop-indicator: var(--pretable-accent);
60
66
 
67
+ /* Elevation. Four of the five things that read a shadow are popovers, so the
68
+ scale is named for what is lifted, not for the drag ghost that happened to
69
+ need one first. */
70
+ --pretable-shadow-overlay: 0 4px 12px rgb(0 0 0 / 0.12);
71
+ /* No card shadow: this theme draws a frame instead. pretable.css uses it. */
72
+ --pretable-shadow-card: none;
73
+ /* The frozen-column edge. Spread must be <= -blur/2 or the blur bleeds above
74
+ and below each pinned cell and paints a dark band at every row boundary. */
75
+ --pretable-shadow-seam: 6px 0 10px -8px rgb(0 0 0 / 0.18);
76
+
61
77
  /* Density — natural default = compact (Excel "Compact" tier) */
62
78
  --pretable-row-height: 20px; /* 15pt at 96 DPI */
63
79
  --pretable-header-height: 24px;
@@ -10,6 +10,12 @@
10
10
  --pretable-bg-grid: #fcfcfc; /* N99 */
11
11
  --pretable-bg-grid-alt: #fcfcfc; /* No striping by default — Material list pattern */
12
12
  --pretable-bg-header: #f3f3f3; /* N96 — one tonal step up */
13
+ /* Pinned body cells and group rows historically borrowed --pretable-bg-header,
14
+ which made it impossible to restyle a frozen data column without also
15
+ restyling the header. They now have their own tokens, defaulted here to the
16
+ value this theme already resolved so nothing moves. */
17
+ --pretable-bg-pinned: var(--pretable-bg-header);
18
+ --pretable-bg-group-row: var(--pretable-bg-header);
13
19
  --pretable-bg-toolbar: #f3f3f3;
14
20
  --pretable-bg-tooltip: #f3f3f3;
15
21
 
@@ -29,6 +35,10 @@
29
35
  --pretable-rule-vertical: var(--pretable-rule);
30
36
  --pretable-rule-width: 1px;
31
37
  --pretable-radius: 12px; /* M3 medium shape scale (matches Card) */
38
+ /* Small affordances need their own step: the card radius applied to a 14–18px
39
+ control (funnel, ⋮ button, chip remove) rounds it into a circle. M3 small
40
+ shape scale. */
41
+ --pretable-radius-control: 6px;
32
42
 
33
43
  /* State */
34
44
  --pretable-bg-hover: rgba(
@@ -59,9 +69,18 @@
59
69
  --pretable-resize-handle: transparent;
60
70
  --pretable-resize-handle-hover: var(--pretable-accent);
61
71
  --pretable-reorder-ghost-bg: var(--pretable-bg-header);
62
- --pretable-reorder-ghost-shadow: 0 4px 12px rgb(0 0 0 / 0.12);
63
72
  --pretable-reorder-drop-indicator: var(--pretable-accent);
64
73
 
74
+ /* Elevation. Four of the five things that read a shadow are popovers, so the
75
+ scale is named for what is lifted, not for the drag ghost that happened to
76
+ need one first. */
77
+ --pretable-shadow-overlay: 0 4px 12px rgb(0 0 0 / 0.12);
78
+ /* No card shadow: this theme draws a frame instead. pretable.css uses it. */
79
+ --pretable-shadow-card: none;
80
+ /* The frozen-column edge. Spread must be <= -blur/2 or the blur bleeds above
81
+ and below each pinned cell and paints a dark band at every row boundary. */
82
+ --pretable-shadow-seam: 6px 0 10px -8px rgb(0 0 0 / 0.18);
83
+
65
84
  /* Density — natural default = standard */
66
85
  --pretable-row-height: 48px;
67
86
  --pretable-header-height: 52px;
@@ -127,4 +146,10 @@
127
146
  --pretable-text-error: #f2b8b5; /* M3 error (dark) */
128
147
 
129
148
  --pretable-accent: #9ecaff;
149
+
150
+ /* A 12%-black shadow on a #1c1c1c surface is invisible, so every dark-mode
151
+ popover read as flat until this override existed. Deeper and more opaque
152
+ rather than lighter: M3 keeps shadows black in dark mode and gets the
153
+ separation from the tonal surface, not from the shadow color. */
154
+ --pretable-shadow-overlay: 0 4px 12px rgb(0 0 0 / 0.5);
130
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretable/ui",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "CSS themes, tokens, and grid styles for Pretable.",
5
5
  "license": "MIT",
6
6
  "repository": {