@pretable/ui 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -51,7 +51,21 @@ The full token set lives in [`src/tokens.css`](./src/tokens.css). Override any t
51
51
 
52
52
  ### Data-attribute hooks
53
53
 
54
- Pretable surfaces emit a stable set of data attributes on rendered DOM. The CSS files in this package target them; your custom styles can too. The full set lives in `grid.css` — common ones include `[data-pretable-cell]`, `[data-pretable-row]`, `[data-pretable-header]`, `[data-pretable-cell-focused]`, and `[data-pretable-cell-selected]`. Renaming or removing these attributes is a breaking change.
54
+ Pretable surfaces emit a stable set of data attributes on rendered DOM. The CSS files in this package target them; your custom styles can too. The full set lives in `grid.css` — common ones include `[data-pretable-cell]`, `[data-pretable-row]`, `[data-pretable-header]`, `[data-pretable-cell][data-pretable-focused="true"]`, `[data-pretable-cell][data-pretable-selected="true"]`, `[data-pretable-cell][data-pretable-pinned="left"]`, and `[data-pretable-cell][data-pretable-numeric="true"]`. Renaming or removing these attributes is a breaking change.
55
+
56
+ ### Cascade layer
57
+
58
+ `grid.css` ships inside a single `@layer pretable` cascade layer, and every
59
+ selector is wrapped in `:where()` (specificity `(0,0,0)`). Consumer CSS wins by
60
+ layer order or specificity without `!important`. In a Tailwind v4 app declare:
61
+
62
+ ```css
63
+ @layer theme, base, pretable, components, utilities;
64
+ ```
65
+
66
+ Token files (`tokens.css`, `themes/*.css`) are intentionally **unlayered** —
67
+ override tokens after importing the theme. See the website's "Cascade &
68
+ overrides" theming page for the full contract.
55
69
 
56
70
  ## JS API
57
71
 
package/dist/grid.css CHANGED
@@ -3,211 +3,558 @@
3
3
  * Selector-based grid skin. Targets data attributes exposed by @pretable/react;
4
4
  * values reference --pretable-* tokens defined by theme files.
5
5
  *
6
+ * All rules live in the `pretable` cascade layer and use :where() so every
7
+ * default is specificity (0,0,0). Consumers override by writing any selector
8
+ * (it wins on specificity) or any unlayered / later-layer rule (it wins on
9
+ * layer order). Recommended layer order in your app:
10
+ * @layer theme, base, pretable, components, utilities;
11
+ *
6
12
  * Consumer recipe:
7
13
  * @import "@pretable/ui/themes/excel.css";
8
14
  * @import "@pretable/ui/grid.css";
9
15
  */
10
16
 
11
- /* Visually hidden — used for ARIA live region announcements. */
12
- .pt-sr-only {
13
- position: absolute;
14
- width: 1px;
15
- height: 1px;
16
- padding: 0;
17
- margin: -1px;
18
- overflow: hidden;
19
- clip: rect(0, 0, 0, 0);
20
- white-space: nowrap;
21
- border: 0;
22
- }
17
+ @layer pretable {
18
+ /* Visually hidden — used for ARIA live region announcements. */
19
+ :where(.pt-sr-only) {
20
+ position: absolute;
21
+ width: 1px;
22
+ height: 1px;
23
+ padding: 0;
24
+ margin: -1px;
25
+ overflow: hidden;
26
+ clip: rect(0, 0, 0, 0);
27
+ white-space: nowrap;
28
+ border: 0;
29
+ }
23
30
 
24
- /* Outer viewport (scrollable container) */
25
- [data-pretable-scroll-viewport] {
26
- background: var(--pretable-bg-grid);
27
- border: 1px solid var(--pretable-rule-strong);
28
- border-radius: var(--pretable-radius);
29
- font-family: var(--pretable-font-sans);
30
- color: var(--pretable-text-cell);
31
- }
31
+ /* Outer viewport (scrollable container) */
32
+ :where([data-pretable-scroll-viewport]) {
33
+ background: var(--pretable-bg-grid);
34
+ border: 1px solid var(--pretable-rule-strong);
35
+ border-radius: var(--pretable-radius);
36
+ font-family: var(--pretable-font-sans);
37
+ color: var(--pretable-text-cell);
38
+ }
32
39
 
33
- /* Header row */
34
- [data-pretable-header-row] {
35
- background: var(--pretable-bg-header);
36
- border-bottom: 1px solid var(--pretable-rule-strong);
37
- height: var(--pretable-header-height);
38
- }
40
+ /* Header row */
41
+ :where([data-pretable-header-row]) {
42
+ background: var(--pretable-bg-header);
43
+ border-bottom: 1px solid var(--pretable-rule-strong);
44
+ height: var(--pretable-header-height);
45
+ }
39
46
 
40
- [data-pretable-header-cell] {
41
- display: flex;
42
- align-items: center;
43
- padding: 0 var(--pretable-cell-padding-x);
44
- font-size: var(--pretable-font-size-header);
45
- font-weight: 500;
46
- color: var(--pretable-text-header);
47
- border-right: 1px solid var(--pretable-rule);
48
- box-sizing: border-box;
49
- }
47
+ :where([data-pretable-header-cell]) {
48
+ display: flex;
49
+ align-items: center;
50
+ padding: 0 var(--pretable-cell-padding-x);
51
+ font-size: var(--pretable-font-size-header);
52
+ font-weight: 500;
53
+ color: var(--pretable-text-header);
54
+ border-right: 1px solid var(--pretable-rule);
55
+ box-sizing: border-box;
56
+ }
50
57
 
51
- [data-pretable-header-cell]:last-of-type {
52
- border-right: none;
53
- }
58
+ :where([data-pretable-header-cell]:last-of-type) {
59
+ border-right: none;
60
+ }
54
61
 
55
- /* Body cells */
56
- [data-pretable-cell] {
57
- display: flex;
58
- align-items: center;
59
- box-sizing: border-box;
60
- padding: var(--pretable-cell-padding-y) var(--pretable-cell-padding-x);
61
- font-size: var(--pretable-font-size-cell);
62
- color: var(--pretable-text-cell);
63
- background: var(--pretable-bg-grid);
64
- border-right: 1px solid var(--pretable-rule);
65
- border-bottom: 1px solid var(--pretable-rule);
66
- }
62
+ /* Pinned header cells — the header row paints --pretable-bg-header behind
63
+ the whole strip, but each header cell on top of it is a transparent box,
64
+ so an unpinned header's label reads straight through a pinned one once it
65
+ scrolls underneath. Pinned header cells need their own opaque fill, the
66
+ same one their body counterparts get below. */
67
+ :where(
68
+ [data-pretable-header-cell][data-pretable-pinned="left"],
69
+ [data-pretable-header-cell][data-pretable-pinned="right"]
70
+ ) {
71
+ background: var(--pretable-bg-header);
72
+ }
67
73
 
68
- [data-pretable-cell]:last-of-type {
69
- border-right: none;
70
- }
74
+ /* Multi-sort priority badge (rendered only when 2+ columns are sorted) */
75
+ :where([data-pretable-sort-priority]) {
76
+ margin-left: 2px;
77
+ font-size: 9px;
78
+ font-weight: 600;
79
+ color: var(--pretable-text-dim);
80
+ vertical-align: super;
81
+ }
71
82
 
72
- /* Zebra striping — only effective when --pretable-bg-grid-alt differs */
73
- [data-pretable-row]:nth-child(even) [data-pretable-cell] {
74
- background: var(--pretable-bg-grid-alt);
75
- }
83
+ /* Body cells */
84
+ :where([data-pretable-cell]) {
85
+ display: flex;
86
+ align-items: center;
87
+ box-sizing: border-box;
88
+ padding: var(--pretable-cell-padding-y) var(--pretable-cell-padding-x);
89
+ font-size: var(--pretable-font-size-cell);
90
+ color: var(--pretable-text-cell);
91
+ background: var(--pretable-bg-grid);
92
+ border-right: 1px solid var(--pretable-rule);
93
+ border-bottom: 1px solid var(--pretable-rule);
94
+ /* Cells are absolutely positioned, so a value wider than its column paints
95
+ straight over the next one. Clip at the column edge instead.
96
+ NOTE: the cell is a flex container, and `text-overflow: ellipsis` has no
97
+ effect on one — the text is an anonymous flex item. For an ellipsis,
98
+ render the value inside an element that can shrink:
99
+ <span style="min-width:0; overflow:hidden; text-overflow:ellipsis">
100
+ via a column's `render`. */
101
+ overflow: hidden;
102
+ }
76
103
 
77
- /* Hover */
78
- [data-pretable-row]:hover [data-pretable-cell] {
79
- background: var(--pretable-bg-hover);
80
- }
104
+ :where([data-pretable-cell]:last-of-type) {
105
+ border-right: none;
106
+ }
81
107
 
82
- /* Pinned cells (sticky left/right) — reuse header background */
83
- [data-pretable-cell][data-pinned="left"],
84
- [data-pretable-cell][data-pinned="right"] {
85
- background: var(--pretable-bg-header);
86
- z-index: 1;
87
- }
108
+ /* Zebra striping — only effective when --pretable-bg-grid-alt differs */
109
+ :where([data-pretable-row]:nth-child(even) [data-pretable-cell]) {
110
+ background: var(--pretable-bg-grid-alt);
111
+ }
88
112
 
89
- /* Selection */
90
- [data-pretable-cell][data-selected="true"] {
91
- background: var(--pretable-bg-selected);
92
- color: var(--pretable-text-selected);
93
- }
113
+ /* Hover */
114
+ :where([data-pretable-row]:hover [data-pretable-cell]) {
115
+ background: var(--pretable-bg-hover);
116
+ }
94
117
 
95
- /* Focus */
96
- [data-pretable-cell][data-focused="true"] {
97
- outline: 2px solid var(--pretable-focus-ring);
98
- outline-offset: -2px;
99
- }
118
+ /* Pinned cells (sticky left) — reuse header background */
119
+ :where([data-pretable-cell][data-pretable-pinned="left"]) {
120
+ background: var(--pretable-bg-header);
121
+ z-index: 1;
122
+ }
100
123
 
101
- /**
102
- * Theme-agnostic cell-range selection visuals (Phase 3).
103
- * Targets the ARIA role + aria-selected attribute exposed by @pretable/react,
104
- * so consumers using only @pretable/ui's tokens.css (no theme file) still get
105
- * a usable visual. Theme-prefixed rules above take precedence when a theme is
106
- * loaded.
107
- */
108
- [role="gridcell"][aria-selected="true"] {
109
- background: var(--pt-color-selection-bg);
110
- }
124
+ /* Pinned cells (sticky right) — mirror of the left rule */
125
+ :where([data-pretable-cell][data-pretable-pinned="right"]) {
126
+ background: var(--pretable-bg-header);
127
+ z-index: 1;
128
+ }
111
129
 
112
- [role="gridcell"][data-focused="true"] {
113
- box-shadow: inset 0 0 0 2px var(--pt-color-focus-ring);
114
- }
130
+ /* The left-pinned group is bounded by the base cell's border-right; the
131
+ right-pinned group's boundary is its LEADING edge, so draw the rule on the
132
+ first right-pinned cell only (avoids doubling up with the previous cell's
133
+ border-right between two right-pinned columns). */
134
+ :where(
135
+ [data-pretable-cell]:not([data-pretable-pinned="right"])
136
+ + [data-pretable-cell][data-pretable-pinned="right"]
137
+ ) {
138
+ border-left: 1px solid var(--pretable-rule);
139
+ }
115
140
 
116
- /* Numeric cells (opt-in via [data-pretable-numeric="true"]) */
117
- [data-pretable-cell][data-pretable-numeric="true"] {
118
- font-family: var(--pretable-font-mono);
119
- text-align: right;
120
- justify-content: flex-end;
121
- font-variant-numeric: tabular-nums;
122
- }
141
+ /* Selection — wins over zebra/hover via source order (they precede it) */
142
+ :where([data-pretable-cell][data-pretable-selected="true"]) {
143
+ background: var(--pretable-bg-selected);
144
+ color: var(--pretable-text-selected);
145
+ }
123
146
 
124
- /* Toolbar / status bar — applied if engine wraps in named data attribute */
125
- [data-pretable-toolbar],
126
- [data-pretable-status-bar] {
127
- background: var(--pretable-bg-toolbar);
128
- color: var(--pretable-text-dim);
129
- font-family: var(--pretable-font-sans);
130
- font-size: var(--pretable-font-size-cell);
131
- }
147
+ /* Focus */
148
+ :where([data-pretable-cell][data-pretable-focused="true"]) {
149
+ outline: 2px solid var(--pretable-focus-ring);
150
+ outline-offset: -2px;
151
+ }
132
152
 
133
- /* Row-selection checkbox column (Phase 4) */
134
- [data-pretable-cell][data-row-select-cell="true"],
135
- [data-pretable-header-cell][data-pretable-row-select-header] {
136
- display: flex;
137
- align-items: center;
138
- justify-content: center;
139
- padding: 0;
140
- }
141
- button[data-pretable-row-select],
142
- button[data-pretable-row-select-all] {
143
- width: 16px;
144
- height: 16px;
145
- border: 1px solid var(--pt-color-checkbox-border);
146
- background: var(--pt-color-checkbox-bg);
147
- border-radius: 3px;
148
- cursor: pointer;
149
- padding: 0;
150
- display: inline-flex;
151
- align-items: center;
152
- justify-content: center;
153
- font-size: 11px;
154
- line-height: 1;
155
- color: var(--pt-color-checkbox-checked-fg);
156
- }
157
- button[data-pretable-row-select][aria-checked="true"],
158
- button[data-pretable-row-select-all][aria-checked="true"] {
159
- background: var(--pt-color-checkbox-checked-bg);
160
- border-color: var(--pt-color-checkbox-checked-bg);
161
- color: var(--pt-color-checkbox-checked-fg);
162
- }
163
- button[data-pretable-row-select][aria-checked="mixed"],
164
- button[data-pretable-row-select-all][aria-checked="mixed"] {
165
- background: var(--pt-color-checkbox-checked-bg);
166
- border-color: var(--pt-color-checkbox-checked-bg);
167
- color: var(--pt-color-checkbox-checked-fg);
168
- }
153
+ /**
154
+ * Theme-agnostic cell-range selection visuals (Phase 3).
155
+ * Targets the ARIA role + aria-selected attribute exposed by @pretable/react,
156
+ * so consumers using only @pretable/ui's tokens.css (no theme file) still get
157
+ * a usable visual.
158
+ */
159
+ :where([role="gridcell"][aria-selected="true"]) {
160
+ background: var(--pretable-selection-bg);
161
+ }
169
162
 
170
- /* Column resize handle (sub-project C) */
171
- [data-pretable-resize-handle] {
172
- position: absolute;
173
- top: 0;
174
- right: 0;
175
- width: 4px;
176
- height: 100%;
177
- cursor: col-resize;
178
- background: var(--pt-color-resize-handle);
179
- z-index: 2;
180
- user-select: none;
181
- touch-action: none;
182
- }
183
- [data-pretable-resize-handle]:hover,
184
- [data-pretable-resize-handle][data-dragging="true"] {
185
- background: var(--pt-color-resize-handle-hover);
186
- }
163
+ :where([role="gridcell"][data-pretable-focused="true"]) {
164
+ box-shadow: inset 0 0 0 2px var(--pretable-focus-ring);
165
+ }
187
166
 
188
- /* Column reorder gesture (sub-project C) */
189
- [data-pretable-reorder-ghost] {
190
- position: fixed;
191
- pointer-events: none;
192
- background: var(--pt-color-reorder-ghost-bg);
193
- box-shadow: var(--pt-color-reorder-ghost-shadow);
194
- opacity: 0.6;
195
- z-index: 10;
196
- user-select: none;
197
- }
198
- [data-pretable-reorder-drop-indicator] {
199
- position: absolute;
200
- top: 0;
201
- width: 2px;
202
- background: var(--pt-color-reorder-drop-indicator);
203
- z-index: 9;
204
- pointer-events: none;
205
- }
167
+ /* Numeric cells (opt-in via [data-pretable-numeric="true"]) */
168
+ :where([data-pretable-cell][data-pretable-numeric="true"]) {
169
+ font-family: var(--pretable-font-mono);
170
+ text-align: right;
171
+ justify-content: flex-end;
172
+ font-variant-numeric: tabular-nums;
173
+ }
174
+
175
+ /* Toolbar / status bar — applied if engine wraps in named data attribute */
176
+ :where([data-pretable-toolbar], [data-pretable-status-bar]) {
177
+ background: var(--pretable-bg-toolbar);
178
+ color: var(--pretable-text-dim);
179
+ font-family: var(--pretable-font-sans);
180
+ font-size: var(--pretable-font-size-cell);
181
+ }
182
+
183
+ /* Row-selection checkbox column (Phase 4) */
184
+ :where(
185
+ [data-pretable-cell][data-pretable-row-select-cell="true"],
186
+ [data-pretable-header-cell][data-pretable-row-select-header]
187
+ ) {
188
+ display: flex;
189
+ align-items: center;
190
+ justify-content: center;
191
+ padding: 0;
192
+ }
193
+ :where(
194
+ button[data-pretable-row-select],
195
+ button[data-pretable-row-select-all],
196
+ button[data-pretable-bool-cell]
197
+ ) {
198
+ width: 16px;
199
+ height: 16px;
200
+ border: 1px solid var(--pretable-checkbox-border);
201
+ background: var(--pretable-checkbox-bg);
202
+ border-radius: 3px;
203
+ cursor: pointer;
204
+ padding: 0;
205
+ display: inline-flex;
206
+ align-items: center;
207
+ justify-content: center;
208
+ font-size: 11px;
209
+ line-height: 1;
210
+ color: var(--pretable-checkbox-checked-fg);
211
+ }
212
+ :where(
213
+ button[data-pretable-row-select][aria-checked="true"],
214
+ button[data-pretable-row-select-all][aria-checked="true"],
215
+ button[data-pretable-bool-cell][aria-checked="true"]
216
+ ) {
217
+ background: var(--pretable-checkbox-checked-bg);
218
+ border-color: var(--pretable-checkbox-checked-bg);
219
+ color: var(--pretable-checkbox-checked-fg);
220
+ }
221
+ :where(
222
+ button[data-pretable-row-select][aria-checked="mixed"],
223
+ button[data-pretable-row-select-all][aria-checked="mixed"]
224
+ ) {
225
+ background: var(--pretable-checkbox-checked-bg);
226
+ border-color: var(--pretable-checkbox-checked-bg);
227
+ color: var(--pretable-checkbox-checked-fg);
228
+ }
229
+
230
+ /* Boolean toggle cell (typed editors) */
231
+ :where(button[data-pretable-bool-cell]) {
232
+ margin: 0 auto;
233
+ display: flex;
234
+ align-items: center;
235
+ justify-content: center;
236
+ }
237
+ :where(button[data-pretable-bool-cell]:disabled) {
238
+ cursor: default;
239
+ }
240
+ :where(button[data-pretable-bool-cell][aria-busy="true"]) {
241
+ opacity: 0.5;
242
+ cursor: wait;
243
+ }
244
+ :where(button[data-pretable-bool-cell][aria-invalid="true"]) {
245
+ outline: 1px solid var(--pretable-text-error);
246
+ outline-offset: 1px;
247
+ }
248
+
249
+ /* Column resize handle (sub-project C) */
250
+ :where([data-pretable-resize-handle]) {
251
+ position: absolute;
252
+ top: 0;
253
+ right: 0;
254
+ width: 4px;
255
+ height: 100%;
256
+ cursor: col-resize;
257
+ background: var(--pretable-resize-handle);
258
+ z-index: 2;
259
+ user-select: none;
260
+ touch-action: none;
261
+ }
262
+ :where(
263
+ [data-pretable-resize-handle]:hover,
264
+ [data-pretable-resize-handle][data-pretable-dragging="true"]
265
+ ) {
266
+ background: var(--pretable-resize-handle-hover);
267
+ }
268
+
269
+ /* Column reorder gesture (sub-project C) */
270
+ :where([data-pretable-reorder-ghost]) {
271
+ position: fixed;
272
+ pointer-events: none;
273
+ background: var(--pretable-reorder-ghost-bg);
274
+ box-shadow: var(--pretable-reorder-ghost-shadow);
275
+ opacity: 0.6;
276
+ z-index: 10;
277
+ user-select: none;
278
+ /* Portaled into <body> — see the filter menu below. The font-family and
279
+ color declared on the scroll viewport are no longer inherited. */
280
+ font-family: var(--pretable-font-sans);
281
+ color: var(--pretable-text-cell);
282
+ }
283
+ :where([data-pretable-reorder-drop-indicator]) {
284
+ position: absolute;
285
+ top: 0;
286
+ width: 2px;
287
+ background: var(--pretable-reorder-drop-indicator);
288
+ z-index: 9;
289
+ pointer-events: none;
290
+ }
291
+
292
+ /* Built-in column filter menu (sub-project 2/3) */
293
+ :where([data-pretable-filter-funnel]) {
294
+ display: inline-flex;
295
+ align-items: center;
296
+ justify-content: center;
297
+ width: 18px;
298
+ height: 18px;
299
+ padding: 0;
300
+ border: 0;
301
+ border-radius: var(--pretable-radius);
302
+ background: transparent;
303
+ color: var(--pretable-text-dim);
304
+ cursor: pointer;
305
+ opacity: 0;
306
+ transition: opacity 0.1s ease;
307
+ }
308
+ /* Reveal funnels on header-row hover, on funnel keyboard focus, or when a
309
+ filter is active. The header row is a flat list of sibling header cells,
310
+ resize handles, and funnel slots (see pretable-surface.tsx), so a
311
+ per-column `~` hover selector would over-match every column to the right
312
+ of the hovered one; hovering the whole header row is the structurally
313
+ correct trigger. Active/focus-visible funnels stay lit regardless. */
314
+ :where([data-pretable-header-row]:hover [data-pretable-filter-funnel]),
315
+ :where([data-pretable-filter-funnel]:focus-visible),
316
+ :where([data-pretable-filter-funnel][data-pretable-filter-active="true"]) {
317
+ opacity: 1;
318
+ }
319
+ :where([data-pretable-filter-funnel][data-pretable-filter-active="true"]) {
320
+ color: var(--pretable-accent);
321
+ }
322
+ :where([data-pretable-filter-funnel]:hover) {
323
+ background: var(--pretable-bg-hover);
324
+ }
325
+
326
+ :where([data-pretable-filter-menu]) {
327
+ display: flex;
328
+ flex-direction: column;
329
+ gap: 8px;
330
+ padding: 10px;
331
+ box-shadow: var(--pretable-reorder-ghost-shadow);
332
+ font: inherit;
333
+ /* Portaled into <body>, so the font-family declared on the scroll
334
+ viewport is no longer inherited — declare it here. */
335
+ font-family: var(--pretable-font-sans);
336
+ }
337
+ :where([data-pretable-filter-menu]) select,
338
+ :where([data-pretable-filter-menu]) input[type="text"],
339
+ :where([data-pretable-filter-menu]) input[type="date"],
340
+ :where([data-pretable-filter-menu]) input:not([type]) {
341
+ width: 100%;
342
+ box-sizing: border-box;
343
+ padding: 5px 7px;
344
+ border: 1px solid var(--pretable-rule);
345
+ border-radius: var(--pretable-radius);
346
+ background: var(--pretable-bg-grid);
347
+ color: var(--pretable-text-cell);
348
+ font: inherit;
349
+ }
350
+ :where([data-pretable-filter-set]) label {
351
+ display: flex;
352
+ gap: 6px;
353
+ align-items: center;
354
+ }
355
+ :where([data-pretable-filter-clear]) {
356
+ align-self: flex-end;
357
+ background: transparent;
358
+ border: 0;
359
+ color: var(--pretable-accent);
360
+ cursor: pointer;
361
+ padding: 2px 4px;
362
+ }
363
+
364
+ /* Enum combobox listbox (cell editor) */
365
+ :where([data-pretable-enum-editor]) {
366
+ display: block;
367
+ width: 100%;
368
+ height: 100%;
369
+ }
370
+
371
+ :where([data-pretable-enum-listbox]) {
372
+ margin: 0;
373
+ padding: 4px 0;
374
+ list-style: none;
375
+ max-height: 220px;
376
+ overflow-y: auto;
377
+ background: var(--pretable-bg-grid);
378
+ border: 1px solid var(--pretable-rule-strong);
379
+ border-radius: var(--pretable-radius);
380
+ box-shadow: var(--pretable-reorder-ghost-shadow);
381
+ /* Portaled into <body> — see the filter menu above. */
382
+ font-family: var(--pretable-font-sans);
383
+ font-size: var(--pretable-font-size-cell);
384
+ color: var(--pretable-text-cell);
385
+ }
386
+
387
+ /* Typed text matching nothing leaves an empty list; don't paint a bare box. */
388
+ :where([data-pretable-enum-listbox]:empty) {
389
+ display: none;
390
+ }
391
+
392
+ :where([data-pretable-enum-option]) {
393
+ padding: var(--pretable-cell-padding-y) var(--pretable-cell-padding-x);
394
+ cursor: pointer;
395
+ }
396
+
397
+ :where([data-pretable-enum-option]:hover) {
398
+ background: var(--pretable-bg-hover);
399
+ }
400
+
401
+ :where([data-pretable-enum-option][aria-selected="true"]) {
402
+ background: var(--pretable-bg-selected);
403
+ color: var(--pretable-text-selected);
404
+ }
405
+
406
+ /* Date calendar (cell editor) */
407
+ :where([data-pretable-date-editor]) {
408
+ display: block;
409
+ width: 100%;
410
+ height: 100%;
411
+ }
412
+
413
+ :where([data-pretable-date-popover]) {
414
+ padding: 8px;
415
+ background: var(--pretable-bg-grid);
416
+ border: 1px solid var(--pretable-rule-strong);
417
+ border-radius: var(--pretable-radius);
418
+ box-shadow: var(--pretable-reorder-ghost-shadow);
419
+ /* Portaled into <body> — see the filter menu above. */
420
+ font-family: var(--pretable-font-sans);
421
+ font-size: var(--pretable-font-size-cell);
422
+ color: var(--pretable-text-cell);
423
+ }
424
+
425
+ :where([data-pretable-date-header]) {
426
+ display: flex;
427
+ align-items: center;
428
+ justify-content: space-between;
429
+ font-weight: 600;
430
+ padding-bottom: 6px;
431
+ }
432
+
433
+ :where([data-pretable-date-header] button) {
434
+ border: none;
435
+ background: none;
436
+ color: var(--pretable-text-header);
437
+ cursor: pointer;
438
+ padding: 0 6px;
439
+ }
440
+
441
+ :where([data-pretable-date-header] button:hover) {
442
+ color: var(--pretable-accent);
443
+ }
444
+
445
+ :where([data-pretable-date-popover] [role="row"]) {
446
+ display: grid;
447
+ grid-template-columns: repeat(7, 1fr);
448
+ }
449
+
450
+ :where([data-pretable-date-weekdays] [role="columnheader"]) {
451
+ text-align: center;
452
+ padding: 2px 0;
453
+ color: var(--pretable-text-dim);
454
+ }
455
+
456
+ :where([data-pretable-date-day]) {
457
+ text-align: center;
458
+ padding: 4px 0;
459
+ border-radius: var(--pretable-radius);
460
+ cursor: pointer;
461
+ }
462
+
463
+ :where([data-pretable-date-day]:hover) {
464
+ background: var(--pretable-bg-hover);
465
+ }
466
+
467
+ :where([data-pretable-date-day][data-pretable-date-outside]) {
468
+ color: var(--pretable-text-dim);
469
+ }
470
+
471
+ :where([data-pretable-date-day][data-pretable-date-today]) {
472
+ box-shadow: inset 0 0 0 1px var(--pretable-focus-ring);
473
+ }
474
+
475
+ :where([data-pretable-date-day][aria-selected="true"]) {
476
+ background: var(--pretable-bg-selected);
477
+ color: var(--pretable-text-selected);
478
+ }
479
+
480
+ /* Tooltip / popover */
481
+ :where([data-pretable-popover]) {
482
+ background: var(--pretable-bg-tooltip);
483
+ color: var(--pretable-text-cell);
484
+ border: 1px solid var(--pretable-rule);
485
+ border-radius: var(--pretable-radius);
486
+ }
487
+
488
+ /* Cell editor (inline editing) */
489
+ :where(.pretable-cell-editor) {
490
+ width: 100%;
491
+ height: 100%;
492
+ box-sizing: border-box;
493
+ padding: var(--pretable-cell-padding-y) var(--pretable-cell-padding-x);
494
+ border: none;
495
+ outline: 2px solid var(--pretable-focus-ring);
496
+ outline-offset: -2px;
497
+ background: var(--pretable-edit-bg);
498
+ color: var(--pretable-text-cell);
499
+ font-family: var(--pretable-font-sans);
500
+ font-size: var(--pretable-font-size-cell);
501
+ }
502
+
503
+ :where(.pretable-cell-editor[aria-invalid="true"]) {
504
+ outline-color: var(--pretable-text-error);
505
+ }
506
+
507
+ :where(.pretable-cell-editor[aria-busy="true"]) {
508
+ opacity: 0.7;
509
+ cursor: wait;
510
+ }
511
+
512
+ /* Multi-line cell editor (wrapped text columns) */
513
+ :where(textarea.pretable-cell-editor) {
514
+ resize: none;
515
+ overflow: auto;
516
+ max-height: 160px;
517
+ line-height: inherit;
518
+ }
519
+
520
+ /* Number cell editor: input + stacked steppers */
521
+ :where([data-pretable-number-editor]) {
522
+ display: flex;
523
+ align-items: stretch;
524
+ width: 100%;
525
+ height: 100%;
526
+ }
527
+
528
+ :where([data-pretable-number-editor] .pretable-cell-editor) {
529
+ text-align: right;
530
+ flex: 1;
531
+ min-width: 0;
532
+ }
533
+
534
+ :where([data-pretable-number-steppers]) {
535
+ display: flex;
536
+ flex-direction: column;
537
+ justify-content: center;
538
+ }
539
+
540
+ :where([data-pretable-number-steppers] button) {
541
+ border: none;
542
+ background: var(--pretable-bg-header);
543
+ color: var(--pretable-text-header);
544
+ font-size: 8px;
545
+ line-height: 1;
546
+ padding: 2px 4px;
547
+ cursor: pointer;
548
+ }
549
+
550
+ :where([data-pretable-number-steppers] button:hover) {
551
+ background: var(--pretable-bg-hover);
552
+ }
206
553
 
207
- /* Tooltip / popover */
208
- [data-pretable-popover] {
209
- background: var(--pretable-bg-tooltip);
210
- color: var(--pretable-text-cell);
211
- border: 1px solid var(--pretable-rule);
212
- border-radius: var(--pretable-radius);
554
+ :where([data-pretable-edit-error]) {
555
+ margin-top: 2px;
556
+ color: var(--pretable-text-error);
557
+ font-family: var(--pretable-font-sans);
558
+ font-size: var(--pretable-font-size-cell);
559
+ }
213
560
  }
@@ -30,10 +30,28 @@
30
30
  --pretable-bg-selected: rgba(16, 124, 65, 0.1); /* Excel green range tint */
31
31
  --pretable-text-selected: #1f1f1f; /* Don't invert selection text */
32
32
  --pretable-focus-ring: #107c41; /* Excel app brand green active-cell border */
33
+ --pretable-edit-bg: #ffffff; /* editor field — matches grid surface */
34
+ --pretable-text-error: #b91c1c; /* invalid outline + error text */
33
35
 
34
36
  /* Accent */
35
37
  --pretable-accent: #107c41; /* Excel brand green */
36
38
 
39
+ /* Grid controls — derived from this theme's tokens so they recolor coherently */
40
+ --pretable-selection-bg: color-mix(
41
+ in srgb,
42
+ var(--pretable-accent) 8%,
43
+ transparent
44
+ );
45
+ --pretable-checkbox-bg: var(--pretable-bg-grid);
46
+ --pretable-checkbox-border: var(--pretable-rule-strong);
47
+ --pretable-checkbox-checked-bg: var(--pretable-accent);
48
+ --pretable-checkbox-checked-fg: #fff;
49
+ --pretable-resize-handle: transparent;
50
+ --pretable-resize-handle-hover: var(--pretable-accent);
51
+ --pretable-reorder-ghost-bg: var(--pretable-bg-header);
52
+ --pretable-reorder-ghost-shadow: 0 4px 12px rgb(0 0 0 / 0.12);
53
+ --pretable-reorder-drop-indicator: var(--pretable-accent);
54
+
37
55
  /* Density — natural default = compact (Excel "Compact" tier) */
38
56
  --pretable-row-height: 20px; /* 15pt at 96 DPI */
39
57
  --pretable-header-height: 24px;
@@ -33,10 +33,28 @@
33
33
  --pretable-bg-selected: #d1e4ff; /* secondary-container — M3 baseline blue */
34
34
  --pretable-text-selected: #001d36; /* on-secondary-container */
35
35
  --pretable-focus-ring: #0061a4; /* primary */
36
+ --pretable-edit-bg: #fcfcfc; /* N99 — matches grid surface */
37
+ --pretable-text-error: #b3261e; /* M3 error (light) */
36
38
 
37
39
  /* Accent */
38
40
  --pretable-accent: #0061a4; /* primary — M3 baseline blue */
39
41
 
42
+ /* Grid controls — derived from this theme's tokens so they recolor coherently */
43
+ --pretable-selection-bg: color-mix(
44
+ in srgb,
45
+ var(--pretable-accent) 8%,
46
+ transparent
47
+ );
48
+ --pretable-checkbox-bg: var(--pretable-bg-grid);
49
+ --pretable-checkbox-border: var(--pretable-rule-strong);
50
+ --pretable-checkbox-checked-bg: var(--pretable-accent);
51
+ --pretable-checkbox-checked-fg: #fff;
52
+ --pretable-resize-handle: transparent;
53
+ --pretable-resize-handle-hover: var(--pretable-accent);
54
+ --pretable-reorder-ghost-bg: var(--pretable-bg-header);
55
+ --pretable-reorder-ghost-shadow: 0 4px 12px rgb(0 0 0 / 0.12);
56
+ --pretable-reorder-drop-indicator: var(--pretable-accent);
57
+
40
58
  /* Density — natural default = standard */
41
59
  --pretable-row-height: 48px;
42
60
  --pretable-header-height: 52px;
@@ -92,6 +110,8 @@
92
110
  --pretable-bg-selected: #00497d; /* secondary-container — M3 baseline blue (dark) */
93
111
  --pretable-text-selected: #d1e4ff; /* on-secondary-container */
94
112
  --pretable-focus-ring: #9ecaff; /* primary (dark) */
113
+ --pretable-edit-bg: #1c1c1c; /* surface-container-low (dark) */
114
+ --pretable-text-error: #f2b8b5; /* M3 error (dark) */
95
115
 
96
116
  --pretable-accent: #9ecaff;
97
117
  }
package/dist/tokens.css CHANGED
@@ -63,26 +63,6 @@
63
63
  --pt-fs-eyebrow: 11px;
64
64
  --pt-fs-data: 12.5px;
65
65
 
66
- /* Cell-range selection (Phase 3 — derived from accent) */
67
- --pt-color-selection-bg: rgb(234 88 12 / 0.08);
68
- --pt-color-selection-border: rgb(234 88 12 / 0.6);
69
- --pt-color-focus-ring: var(--pt-accent);
70
-
71
- /* Column resize handle (sub-project C) */
72
- --pt-color-resize-handle: transparent;
73
- --pt-color-resize-handle-hover: var(--pt-color-selection-border);
74
-
75
- /* Column reorder ghost + drop indicator (sub-project C) */
76
- --pt-color-reorder-ghost-bg: var(--pt-color-surface, #fff);
77
- --pt-color-reorder-ghost-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
78
- --pt-color-reorder-drop-indicator: var(--pt-color-focus-ring);
79
-
80
- /* Row-selection checkbox column (Phase 4) */
81
- --pt-color-checkbox-bg: #fff;
82
- --pt-color-checkbox-border: #d1d5db;
83
- --pt-color-checkbox-checked-bg: var(--pt-accent);
84
- --pt-color-checkbox-checked-fg: #fff;
85
-
86
66
  /* Layout tokens */
87
67
  --pt-page-max: 1440px;
88
68
  --pt-header-h: 60px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretable/ui",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "CSS themes, tokens, and grid styles for Pretable.",
5
5
  "license": "MIT",
6
6
  "repository": {