@pretable/ui 0.18.0 → 0.19.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.
Files changed (2) hide show
  1. package/grid.css +190 -20
  2. package/package.json +1 -1
package/grid.css CHANGED
@@ -229,15 +229,15 @@
229
229
  cursor: pointer;
230
230
  }
231
231
 
232
- :where([data-pretable-option]:hover) {
232
+ :where([data-pretable-option]:hover:not([aria-disabled="true"])) {
233
233
  background: var(--pretable-bg-hover);
234
234
  }
235
235
 
236
- /* The roving highlight: keyboard navigation's `data-active`, painted like
236
+ /* The roving highlight: keyboard navigation's `data-pretable-active`, painted like
237
237
  a hover. DECLARED BEFORE the selected rule on purpose — an option that
238
238
  is both active and committed should read as SELECTED, and at equal
239
239
  (0,0,0) specificity source order is what decides that. */
240
- :where([data-pretable-option][data-active]) {
240
+ :where([data-pretable-option][data-pretable-active]) {
241
241
  background: var(--pretable-bg-hover);
242
242
  }
243
243
 
@@ -246,6 +246,13 @@
246
246
  color: var(--pretable-text-selected);
247
247
  }
248
248
 
249
+ /* Disabled may also be committed. Keep its selection fill, but let the
250
+ disabled ink and cursor win after the selected rule. */
251
+ :where([data-pretable-option][aria-disabled="true"]) {
252
+ color: var(--pretable-text-dim);
253
+ cursor: default;
254
+ }
255
+
249
256
  /* ---- Kit components: text input --------------------------------------
250
257
  The native input in the grid's box: the same rule border, grid surface
251
258
  and cell ink the select trigger draws, so a field and the picker beside
@@ -262,6 +269,16 @@
262
269
  font: inherit;
263
270
  }
264
271
 
272
+ :where([data-pretable-textarea]) {
273
+ box-sizing: border-box;
274
+ padding-inline: 6px;
275
+ border: 1px solid var(--pretable-rule);
276
+ border-radius: var(--pretable-radius-control);
277
+ background: var(--pretable-bg-grid);
278
+ color: var(--pretable-text-cell);
279
+ font: inherit;
280
+ }
281
+
265
282
  /* ---- Kit components: checkbox ----------------------------------------
266
283
  The 16px square every checkbox in the grid is — the row-select cell, the
267
284
  header select-all, the boolean cell, the column toggle, the checklists
@@ -1409,6 +1426,7 @@
1409
1426
  /* Portaled into <body> — see the filter menu above. */
1410
1427
  font-family: var(--pretable-font-sans);
1411
1428
  font-size: var(--pretable-font-size-cell);
1429
+ line-height: 1.4;
1412
1430
  color: var(--pretable-text-cell);
1413
1431
  }
1414
1432
 
@@ -1420,7 +1438,10 @@
1420
1438
  padding-bottom: 6px;
1421
1439
  }
1422
1440
 
1423
- :where([data-pretable-date-header] button) {
1441
+ :where(
1442
+ [data-pretable-date-header]
1443
+ :is([data-pretable-date-previous-month], [data-pretable-date-next-month])
1444
+ ) {
1424
1445
  border: none;
1425
1446
  background: none;
1426
1447
  color: var(--pretable-text-header);
@@ -1428,13 +1449,25 @@
1428
1449
  padding: 0 6px;
1429
1450
  }
1430
1451
 
1431
- :where([data-pretable-date-header] button:hover:not(:disabled)) {
1452
+ :where(
1453
+ [data-pretable-date-header]
1454
+ :is(
1455
+ [data-pretable-date-previous-month],
1456
+ [data-pretable-date-next-month]
1457
+ ):hover:not(:disabled)
1458
+ ) {
1432
1459
  color: var(--pretable-accent);
1433
1460
  }
1434
1461
  /* The month steppers disable at the calendar's min/max month. Without this
1435
1462
  they kept the enabled colour, the pointer cursor and the hover accent —
1436
1463
  the same defect the menu items had. */
1437
- :where([data-pretable-date-header] button:disabled) {
1464
+ :where(
1465
+ [data-pretable-date-header]
1466
+ :is(
1467
+ [data-pretable-date-previous-month],
1468
+ [data-pretable-date-next-month]
1469
+ ):disabled
1470
+ ) {
1438
1471
  color: var(--pretable-text-dim);
1439
1472
  cursor: default;
1440
1473
  }
@@ -1457,7 +1490,7 @@
1457
1490
  cursor: pointer;
1458
1491
  }
1459
1492
 
1460
- :where([data-pretable-date-day]:hover) {
1493
+ :where([data-pretable-date-day]:hover:not([aria-disabled="true"])) {
1461
1494
  background: var(--pretable-bg-hover);
1462
1495
  }
1463
1496
 
@@ -1474,6 +1507,15 @@
1474
1507
  color: var(--pretable-text-selected);
1475
1508
  }
1476
1509
 
1510
+ :where([data-pretable-date-day][data-pretable-date-active]) {
1511
+ outline: 2px solid var(--pretable-focus-ring);
1512
+ outline-offset: -2px;
1513
+ }
1514
+ :where([data-pretable-date-day][aria-disabled="true"]) {
1515
+ color: var(--pretable-text-dim);
1516
+ cursor: default;
1517
+ }
1518
+
1477
1519
  /* Tooltip / popover */
1478
1520
  :where([data-pretable-popover]) {
1479
1521
  background: var(--pretable-bg-tooltip);
@@ -1482,12 +1524,38 @@
1482
1524
  border-radius: var(--pretable-radius);
1483
1525
  }
1484
1526
 
1527
+ /* Validation messages occupy their own line; the field keeps the full
1528
+ column width instead of shrinking beside the error text. */
1529
+ :where(
1530
+ [data-pretable-cell][data-pretable-edit-status]:has(.pretable-cell-editor)
1531
+ ) {
1532
+ flex-direction: column;
1533
+ align-items: stretch;
1534
+ justify-content: flex-start;
1535
+ padding: 0;
1536
+ }
1537
+ :where(
1538
+ [data-pretable-cell][data-pretable-edit-status]
1539
+ > :is(
1540
+ [data-pretable-number-editor],
1541
+ [data-pretable-enum-editor],
1542
+ [data-pretable-date-editor]
1543
+ )
1544
+ ) {
1545
+ flex: 1;
1546
+ min-height: 0;
1547
+ }
1548
+
1485
1549
  /* Cell editor (inline editing) */
1486
1550
  :where(.pretable-cell-editor) {
1551
+ border-radius: 0;
1552
+ min-height: 0;
1553
+ min-width: 0;
1554
+ flex: 1;
1487
1555
  width: 100%;
1488
1556
  height: 100%;
1489
1557
  box-sizing: border-box;
1490
- padding: var(--pretable-cell-padding-y) var(--pretable-cell-padding-x);
1558
+ padding: 2px var(--pretable-cell-padding-x);
1491
1559
  border: none;
1492
1560
  outline: 2px solid var(--pretable-focus-ring);
1493
1561
  outline-offset: -2px;
@@ -1534,7 +1602,10 @@
1534
1602
  justify-content: center;
1535
1603
  }
1536
1604
 
1537
- :where([data-pretable-number-steppers] button) {
1605
+ :where(
1606
+ [data-pretable-number-steppers]
1607
+ :is([data-pretable-number-increment], [data-pretable-number-decrement])
1608
+ ) {
1538
1609
  border: none;
1539
1610
  background: var(--pretable-bg-header);
1540
1611
  color: var(--pretable-text-header);
@@ -1544,11 +1615,27 @@
1544
1615
  cursor: pointer;
1545
1616
  }
1546
1617
 
1547
- :where([data-pretable-number-steppers] button:hover) {
1618
+ :where(
1619
+ [data-pretable-number-steppers]
1620
+ :is(
1621
+ [data-pretable-number-increment],
1622
+ [data-pretable-number-decrement]
1623
+ ):hover:not(:disabled)
1624
+ ) {
1548
1625
  background: var(--pretable-bg-hover);
1549
1626
  }
1550
1627
 
1628
+ /* Preserve room for an ISO date and caret in narrow date columns. */
1629
+ :where([data-pretable-date-editor] .pretable-cell-editor) {
1630
+ padding-inline: 4px;
1631
+ }
1632
+
1551
1633
  :where([data-pretable-edit-error]) {
1634
+ white-space: nowrap;
1635
+ flex: none;
1636
+ overflow: hidden;
1637
+ text-overflow: ellipsis;
1638
+ line-height: 1.2;
1552
1639
  margin-top: 2px;
1553
1640
  color: var(--pretable-text-error);
1554
1641
  font-family: var(--pretable-font-sans);
@@ -2208,11 +2295,16 @@
2208
2295
  [data-pretable-icon-button]:focus-visible,
2209
2296
  [data-pretable-select]:focus-visible,
2210
2297
  [data-pretable-text-input]:focus-visible,
2298
+ [data-pretable-textarea]:focus-visible,
2211
2299
  [data-pretable-checkbox]:focus-visible
2212
2300
  ) {
2213
2301
  outline: 2px solid var(--pretable-focus-ring);
2214
2302
  outline-offset: -2px;
2215
2303
  }
2304
+ /* Editor errors win over the generic focused-field shorthand. */
2305
+ :where(.pretable-cell-editor[aria-invalid="true"]) {
2306
+ outline-color: var(--pretable-text-error);
2307
+ }
2216
2308
  /* A checkbox rings OUTSIDE its box, alone among the kit controls. The
2217
2309
  square is 16px and paints to its own edge — border, fill and glyph all
2218
2310
  the way out — so the inset ring above would land ON the box rather than
@@ -2232,21 +2324,20 @@
2232
2324
  [data-pretable-button]:disabled,
2233
2325
  [data-pretable-icon-button]:disabled,
2234
2326
  [data-pretable-select]:disabled,
2235
- [data-pretable-text-input]:disabled
2327
+ [data-pretable-text-input]:disabled,
2328
+ [data-pretable-textarea]:disabled
2236
2329
  ) {
2237
2330
  color: var(--pretable-text-dim);
2238
2331
  cursor: default;
2239
2332
  }
2240
- /* The checkbox is deliberately NOT in that list. Its `color` is not ink for
2241
- a label, it is the CHECK GLYPH, painted on the checked fill — so dimming
2242
- it puts --pretable-text-dim on --pretable-checkbox-checked-bg at about
2243
- 1.9:1 and the tick all but vanishes. A read-only boolean column renders
2244
- its cell control disabled on EVERY row, so that would be every tick in
2245
- the column. A checkbox's disabled look is its own tokens (border, fill,
2246
- and the shared opacity/forced-colors treatment), never text ink; all this
2247
- rule owes is the pointer. Declaring no `color` here also leaves the
2248
- checked rule above as the last word on the glyph. */
2333
+ /* A disabled checkbox keeps a legible tick on the grid surface. Changing
2334
+ fill together with ink avoids dim ink on an accent fill. A dashed border
2335
+ distinguishes the unchecked disabled state without relying on opacity. */
2249
2336
  :where([data-pretable-checkbox]:disabled) {
2337
+ background: var(--pretable-bg-grid);
2338
+ color: var(--pretable-text-dim);
2339
+ border-color: var(--pretable-text-dim);
2340
+ border-style: dashed;
2250
2341
  cursor: default;
2251
2342
  }
2252
2343
 
@@ -2457,6 +2548,7 @@
2457
2548
  [data-pretable-icon-button]:disabled,
2458
2549
  [data-pretable-select]:disabled,
2459
2550
  [data-pretable-text-input]:disabled,
2551
+ [data-pretable-textarea]:disabled,
2460
2552
  [data-pretable-checkbox]:disabled
2461
2553
  ) {
2462
2554
  color: GrayText;
@@ -2480,9 +2572,87 @@
2480
2572
  :where([data-pretable-checkbox][aria-checked="true"]),
2481
2573
  :where([data-pretable-checkbox][aria-checked="mixed"]) {
2482
2574
  forced-color-adjust: none;
2575
+ background-color: Highlight;
2576
+ border-color: Highlight;
2577
+ outline-color: CanvasText;
2578
+ color: HighlightText;
2579
+ }
2580
+ /* Disabled wins over both committed selection and checked/mixed state.
2581
+ Canvas/GrayText is the platform disabled pair. The dashed selected
2582
+ outline preserves the committed mark without using an enabled fill. */
2583
+ :where([data-pretable-option][aria-disabled="true"]) {
2584
+ forced-color-adjust: none;
2585
+ background-color: Canvas;
2586
+ color: GrayText;
2587
+ border-color: GrayText;
2588
+ }
2589
+ :where([data-pretable-option][aria-disabled="true"][aria-selected="true"]) {
2590
+ outline: 1px dashed GrayText;
2591
+ outline-offset: -2px;
2592
+ }
2593
+ /* DOM focus stays on the trigger; this is the visible roving focus.
2594
+ currentColor pairs with Canvas, Highlight, or the disabled surface. */
2595
+ :where([data-pretable-option][data-pretable-active]) {
2596
+ outline: 2px solid currentColor;
2597
+ outline-offset: -2px;
2598
+ }
2599
+ :where([data-pretable-checkbox]:disabled) {
2600
+ forced-color-adjust: none;
2601
+ background-color: Canvas;
2602
+ color: GrayText;
2603
+ border-color: GrayText;
2604
+ outline-color: GrayText;
2605
+ }
2606
+ :where(
2607
+ [data-pretable-number-increment],
2608
+ [data-pretable-number-decrement],
2609
+ [data-pretable-date-previous-month],
2610
+ [data-pretable-date-next-month]
2611
+ ) {
2612
+ forced-color-adjust: none;
2613
+ background-color: Canvas;
2614
+ color: CanvasText;
2615
+ border-color: CanvasText;
2616
+ outline-color: CanvasText;
2617
+ }
2618
+ :where(
2619
+ [data-pretable-number-increment]:disabled,
2620
+ [data-pretable-number-decrement]:disabled,
2621
+ [data-pretable-date-previous-month]:disabled,
2622
+ [data-pretable-date-next-month]:disabled
2623
+ ) {
2624
+ color: GrayText;
2625
+ }
2626
+ :where([data-pretable-date-day]) {
2627
+ box-shadow: none;
2628
+ forced-color-adjust: none;
2629
+ background-color: Canvas;
2630
+ color: CanvasText;
2631
+ }
2632
+ :where([data-pretable-date-day][aria-selected="true"]) {
2483
2633
  background-color: Highlight;
2484
2634
  color: HighlightText;
2485
2635
  }
2636
+ :where([data-pretable-date-day][data-pretable-date-today]) {
2637
+ text-decoration: underline;
2638
+ }
2639
+ :where([data-pretable-date-day][aria-disabled="true"]) {
2640
+ background-color: Canvas;
2641
+ color: GrayText;
2642
+ }
2643
+ :where([data-pretable-date-day][data-pretable-date-active]) {
2644
+ outline: 2px solid currentColor;
2645
+ outline-offset: -2px;
2646
+ }
2647
+ :where(.pretable-cell-editor) {
2648
+ forced-color-adjust: none;
2649
+ background-color: Canvas;
2650
+ color: CanvasText;
2651
+ outline-color: Highlight;
2652
+ }
2653
+ :where(.pretable-cell-editor[aria-invalid="true"]) {
2654
+ outline: 2px dashed CanvasText;
2655
+ }
2486
2656
  }
2487
2657
 
2488
2658
  /* Reduced motion. Every animated declaration in this file is named here:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretable/ui",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "CSS themes, tokens, and grid styles for Pretable.",
5
5
  "license": "MIT",
6
6
  "repository": {