@apliteni/apliteni-ui 0.165.2 → 0.165.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/docs/components.md +6 -2
- package/guidelines/dense-tables.md +12 -0
- package/package.json +1 -1
- package/react/dist/index.css +1 -1
- package/src/styles/badge.css +2 -1
- package/src/styles/input.css +3 -3
- package/src/styles/table.css +33 -22
package/docs/components.md
CHANGED
|
@@ -689,11 +689,15 @@ width. **A link
|
|
|
689
689
|
inside a cell uses the row's ink, gets an underline on hover, and uses the shared ring on
|
|
690
690
|
`:focus-visible`**. The ring surrounds the whole link, including a title-cell link that wraps.
|
|
691
691
|
`numericValue` distinguishes missing from zero. `deltaValue` prints your sign and uses your
|
|
692
|
-
explicit judgement. **Colour never supplies the sign.**
|
|
692
|
+
explicit judgement. **Colour never supplies the sign.** **Every body and header cell aligns its
|
|
693
|
+
content to the top**, so when one cell wraps, the other values stay level with its first line. A
|
|
694
|
+
React sort mark stands on the first line of a wrapped label. A badge, a logo, a selection box or
|
|
695
|
+
an icon button in a cell stays level with the text beside it.
|
|
693
696
|
|
|
694
697
|
**A hover table that is neither zebra nor dense is a row table.** Its body rows have no lines
|
|
695
698
|
and no column lines, and the head keeps its rule. **A row is 48px tall, 36px with `compact` and
|
|
696
|
-
56px with `comfortable`**, and larger or wrapped content makes it taller.
|
|
699
|
+
56px with `comfortable`**, and larger or wrapped content makes it taller. The space above a
|
|
700
|
+
row's first line centres that line in this height, so a one-line row looks centred. Hover gives the row a
|
|
697
701
|
neutral fill, and a checked selection box gives it an accent wash. Both fills are square, and the
|
|
698
702
|
first and last content sit 12px inside them. The name
|
|
699
703
|
in the first column takes the strongest ink. **`.ui-table__sub` puts a second value under the
|
|
@@ -100,6 +100,18 @@
|
|
|
100
100
|
|
|
101
101
|
**Don't:** Lay a badge, a control or a picture along it, or make it a flex or grid box.
|
|
102
102
|
|
|
103
|
+
## Align cells to the top
|
|
104
|
+
|
|
105
|
+
<!-- rule: top-align -->
|
|
106
|
+
|
|
107
|
+
**Why:** When one cell wraps, values centred in the taller row no longer sit on the line they belong to.
|
|
108
|
+
|
|
109
|
+
**Rule:** Align every cell, header and sort mark with the first line of its row.
|
|
110
|
+
|
|
111
|
+
**Do:** Keep the status and the amount level with the payee's name when a second line follows the name.
|
|
112
|
+
|
|
113
|
+
**Don't:** Centre the values between the two lines of a taller row.
|
|
114
|
+
|
|
103
115
|
## Keep updates stable
|
|
104
116
|
|
|
105
117
|
<!-- rule: states -->
|
package/package.json
CHANGED
package/react/dist/index.css
CHANGED
package/src/styles/badge.css
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
/* rank: chip */
|
|
13
13
|
font-size: var(--text-xs);
|
|
14
14
|
font-weight: var(--weight-semibold);
|
|
15
|
-
|
|
15
|
+
--badge-pad-y: 3px;
|
|
16
|
+
padding: var(--badge-pad-y) 9px;
|
|
16
17
|
border-radius: var(--radius-pill);
|
|
17
18
|
color: var(--text);
|
|
18
19
|
background: var(--chip-neutral-fill);
|
package/src/styles/input.css
CHANGED
|
@@ -148,9 +148,9 @@
|
|
|
148
148
|
transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
|
|
149
149
|
position: relative;
|
|
150
150
|
}
|
|
151
|
-
/* In a cell there is no label line to sit beside, so the box centres on the
|
|
152
|
-
|
|
153
|
-
.ui-table__selection input[type="checkbox"] { margin-
|
|
151
|
+
/* In a cell there is no label line to sit beside, so the box centres on the cell's first
|
|
152
|
+
line instead of dropping 1px to meet a label's first line. */
|
|
153
|
+
.ui-table__selection input[type="checkbox"] { margin-block: calc((var(--ui-cell-line) - 19px) / 2); vertical-align: top; }
|
|
154
154
|
/* The target, not the ink. The box above is drawn at 19x19 because that is what
|
|
155
155
|
sits beside a 15px label without shouting; WCAG 2.5.8 wants 24 CSS px of
|
|
156
156
|
pointer target, which is a different question. This overlay answers it and
|
package/src/styles/table.css
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
color: var(--text);
|
|
22
22
|
padding: 0 var(--space-4) var(--space-3) 0;
|
|
23
23
|
border-bottom: 1px solid var(--border);
|
|
24
|
+
vertical-align: top;
|
|
24
25
|
}
|
|
25
26
|
/* A row header is a body cell that happens to name its row, so it takes the body cell's
|
|
26
27
|
* padding. `.ui-table th` pads for the head, where the label sits above the rule and
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
padding: var(--space-4) var(--space-4) var(--space-4) 0;
|
|
33
34
|
border-bottom: 1px solid var(--border);
|
|
34
35
|
color: var(--text);
|
|
35
|
-
vertical-align:
|
|
36
|
+
vertical-align: top;
|
|
36
37
|
white-space: nowrap;
|
|
37
38
|
}
|
|
38
39
|
/* The last row of the last section, so a final body row keeps its separator when a
|
|
@@ -188,7 +189,7 @@
|
|
|
188
189
|
.ui-table td.ui-table__linked > :is(a:not([class]), a.ui-identity):only-child {
|
|
189
190
|
box-sizing: border-box;
|
|
190
191
|
display: flex;
|
|
191
|
-
align-items:
|
|
192
|
+
align-items: flex-start;
|
|
192
193
|
width: 100%;
|
|
193
194
|
height: 100%;
|
|
194
195
|
padding: var(--space-4) var(--space-4) var(--space-4) 0;
|
|
@@ -200,7 +201,7 @@
|
|
|
200
201
|
:where(.ui-table--hover:not(.ui-table--zebra)) td.ui-table__linked:first-child > :is(a:not([class]), a.ui-identity):only-child { padding-left: var(--space-2); }
|
|
201
202
|
:where(.ui-table--hover:not(.ui-table--zebra)) td.ui-table__linked:last-child > :is(a:not([class]), a.ui-identity):only-child { padding-right: var(--space-2); }
|
|
202
203
|
.ui-table--dense td.ui-table__linked > :is(a:not([class]), a.ui-identity):only-child { padding: var(--space-2) var(--space-3); }
|
|
203
|
-
.ui-table--compact td.ui-table__linked > :is(a:not([class]), a.ui-identity):only-child { padding: var(--space-
|
|
204
|
+
.ui-table--compact td.ui-table__linked > :is(a:not([class]), a.ui-identity):only-child { padding: var(--space-2) var(--space-3) var(--space-1); }
|
|
204
205
|
:where(.ui-table--hover:not(.ui-table--zebra)):is(.ui-table--dense, .ui-table--compact) td.ui-table__linked:first-child > :is(a:not([class]), a.ui-identity):only-child { padding-left: var(--space-2); }
|
|
205
206
|
:where(.ui-table--hover:not(.ui-table--zebra)):is(.ui-table--dense, .ui-table--compact) td.ui-table__linked:last-child > :is(a:not([class]), a.ui-identity):only-child { padding-right: var(--space-2); }
|
|
206
207
|
/* Zebra insets the row's END cells only, so the fill does too: a marked identity behind a
|
|
@@ -327,8 +328,9 @@
|
|
|
327
328
|
margin-inline: calc(-1 * var(--space-3));
|
|
328
329
|
}
|
|
329
330
|
.ui-table td.ui-table__num { text-align: right; }
|
|
331
|
+
/* The top padding centres one 18.2px line in the 33px row (7.4px), rounded up to the step. */
|
|
330
332
|
.ui-table--compact td,
|
|
331
|
-
.ui-table--compact :is(tbody, tfoot) th { padding: var(--space-
|
|
333
|
+
.ui-table--compact :is(tbody, tfoot) th { padding: var(--space-2) var(--space-3) var(--space-1); font-size: var(--text-sm); line-height: var(--leading-snug); height: 33px; }
|
|
332
334
|
.ui-table--compact th { padding: var(--space-2) var(--space-3); }
|
|
333
335
|
.ui-table--compact th:first-child,
|
|
334
336
|
.ui-table--compact td:first-child { padding-left: var(--space-3); }
|
|
@@ -396,6 +398,16 @@
|
|
|
396
398
|
.ui-identity__symbol { font-weight: var(--weight-semibold); }
|
|
397
399
|
.ui-identity__name { white-space: normal; max-width: var(--panel-sm); }
|
|
398
400
|
.ui-identity__logo { width: 24px; height: 24px; flex: 0 0 24px; position: relative; display: grid; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-xs); font-size: var(--text-xs); }
|
|
401
|
+
/* In a top-aligned cell, a logo, a badge or an identity takes no more height than the cell's
|
|
402
|
+
line, so the text stays level with the text of the other cells. A badge gives back its
|
|
403
|
+
padding. The logo is 24px (--space-6), and an identity keeps its 24px tap floor and gives
|
|
404
|
+
back the room around its line. A linked identity fills its cell, so it keeps its place.
|
|
405
|
+
The line height is resolved on the cell, because a logo, a box or a button has its own. */
|
|
406
|
+
@property --ui-cell-line { syntax: "<length>"; inherits: true; initial-value: 0px; }
|
|
407
|
+
.ui-table :is(td, th) { --ui-cell-line: 1lh; }
|
|
408
|
+
.ui-table :is(td, th) .ui-identity:not(.ui-table__linked > :only-child) { margin-block: calc((var(--ui-cell-line) - var(--space-6)) / 2); }
|
|
409
|
+
.ui-table :is(td, th) .ui-identity__logo { margin-block: calc((var(--ui-cell-line) - var(--space-6)) / 2); }
|
|
410
|
+
.ui-table :is(td, th) .ui-badge { margin-block: calc(-1 * var(--badge-pad-y)); }
|
|
399
411
|
.ui-identity__logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
|
|
400
412
|
.ui-identity__logo img[hidden] { display: none; /* motion: still — a failed resource is replaced without animating the error. */ }
|
|
401
413
|
a.ui-identity:hover { text-decoration: underline; }
|
|
@@ -447,10 +459,7 @@ a.ui-identity:hover { text-decoration: underline; }
|
|
|
447
459
|
ring, and the line's ellipsis reaches it. #513 */
|
|
448
460
|
.ui-table--pinned .ui-table__identity a:not([class]) { display: inline; }
|
|
449
461
|
/* Except where the fill gave the lone link the cell's box: it cuts as a block box. */
|
|
450
|
-
.ui-table--pinned .ui-table__identity.ui-table__linked > a:not([class]):only-child {
|
|
451
|
-
display: block;
|
|
452
|
-
align-content: center;
|
|
453
|
-
}
|
|
462
|
+
.ui-table--pinned .ui-table__identity.ui-table__linked > a:not([class]):only-child { display: block; }
|
|
454
463
|
/* The ring goes on the LINE: a link longer than the cell runs past the cut, so a ring
|
|
455
464
|
around the link has no surface to draw its right side on. Inward, like every ring
|
|
456
465
|
the kit puts in a clipped region. why: docs/foundations.md#the-focus-ring, #513 */
|
|
@@ -503,6 +512,7 @@ a.ui-identity:hover { text-decoration: underline; }
|
|
|
503
512
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) {
|
|
504
513
|
--cell-gap: var(--space-4);
|
|
505
514
|
--cell-edge: var(--space-3);
|
|
515
|
+
--row-floor: var(--space-12);
|
|
506
516
|
padding: 0;
|
|
507
517
|
}
|
|
508
518
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) :is(th, td) {
|
|
@@ -516,22 +526,20 @@ a.ui-identity:hover { text-decoration: underline; }
|
|
|
516
526
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense):not(.ui-table--pinned) .ui-table__selection { padding-right: var(--space-4); }
|
|
517
527
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) thead th { padding-block: var(--space-3); }
|
|
518
528
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) tbody > tr > :is(td, th) { border-bottom: 0; }
|
|
529
|
+
/* Cells align to the top, so the top padding centres the FIRST line in the row's floor: a
|
|
530
|
+
one-line row reads as centred, and a wrapped row keeps its first line in the same place. */
|
|
519
531
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) :is(tbody, tfoot) :is(td, th):not(.ui-table__act) {
|
|
520
|
-
height: var(--
|
|
521
|
-
padding-block: var(--space-2);
|
|
532
|
+
height: var(--row-floor);
|
|
533
|
+
padding-block: calc((var(--row-floor) - 1lh) / 2) var(--space-2);
|
|
522
534
|
}
|
|
523
|
-
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense).ui-table--compact { --cell-gap: var(--space-3); }
|
|
535
|
+
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense).ui-table--compact { --cell-gap: var(--space-3); --row-floor: calc(var(--space-8) + var(--space-1)); }
|
|
524
536
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense).ui-table--compact thead th { padding-block: var(--space-2); }
|
|
525
|
-
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense).ui-table--
|
|
526
|
-
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense).ui-table--comfortable {
|
|
527
|
-
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense).ui-table--comfortable :is(tbody, tfoot) :is(td, th):not(.ui-table__act) {
|
|
528
|
-
height: calc(var(--space-12) + var(--space-2));
|
|
529
|
-
padding-block: var(--space-3);
|
|
530
|
-
}
|
|
537
|
+
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense).ui-table--comfortable { --cell-gap: var(--space-5); --row-floor: calc(var(--space-12) + var(--space-2)); }
|
|
538
|
+
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense).ui-table--comfortable :is(tbody, tfoot) :is(td, th):not(.ui-table__act) { padding-bottom: var(--space-3); }
|
|
531
539
|
/* A filled cell link carries the padding its cell gave up. */
|
|
532
540
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) td.ui-table__linked:has(> :is(a:not([class]), a.ui-identity):only-child) { padding: 0; }
|
|
533
|
-
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) td.ui-table__linked > :is(a:not([class]), a.ui-identity):only-child { padding: var(--
|
|
534
|
-
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense).ui-table--comfortable td.ui-table__linked > :is(a:not([class]), a.ui-identity):only-child { padding-
|
|
541
|
+
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) td.ui-table__linked > :is(a:not([class]), a.ui-identity):only-child { padding: calc((var(--row-floor) - 1lh) / 2) var(--cell-gap) var(--space-2) 0; }
|
|
542
|
+
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense).ui-table--comfortable td.ui-table__linked > :is(a:not([class]), a.ui-identity):only-child { padding-bottom: var(--space-3); }
|
|
535
543
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) td.ui-table__linked:first-child > :is(a:not([class]), a.ui-identity):only-child { padding-left: var(--cell-edge); }
|
|
536
544
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) td.ui-table__linked:last-child > :is(a:not([class]), a.ui-identity):only-child { padding-right: var(--cell-edge); }
|
|
537
545
|
|
|
@@ -554,10 +562,13 @@ a.ui-identity:hover { text-decoration: underline; }
|
|
|
554
562
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) tbody tr:not(.is-target):has(> .ui-table__selection :checked):hover > :is(td, th) { background: color-mix(in srgb, var(--accent) 12%, var(--table-bg)); }
|
|
555
563
|
|
|
556
564
|
/* Icon row actions: 32px buttons in a cell as wide as its buttons, so a row keeps its
|
|
557
|
-
height. The glyph, not the button, meets the end cell's edge.
|
|
558
|
-
|
|
565
|
+
height. The glyph, not the button, meets the end cell's edge. The top padding centres a
|
|
566
|
+
button on the first line of text: a labelled button gives back its padding and sits on the
|
|
567
|
+
text's baseline, and an icon button takes the line's height. */
|
|
568
|
+
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) td.ui-table__act { padding-block: calc((var(--row-floor) - 1lh) / 2) 0; padding-right: calc(var(--cell-edge) - var(--space-2)); }
|
|
559
569
|
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) td.ui-table__act:has(.ui-btn--icon) { width: 1%; }
|
|
560
|
-
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) td.ui-table__act .ui-btn
|
|
570
|
+
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) td.ui-table__act .ui-btn { margin-block: calc(-1 * (var(--btn-pad-y) + var(--btn-edge-width))); }
|
|
571
|
+
.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense) td.ui-table__act .ui-btn--icon { box-sizing: border-box; width: var(--space-8); height: var(--space-8); padding: 0; justify-content: center; vertical-align: top; margin-block: calc((var(--ui-cell-line) - var(--space-8)) / 2); }
|
|
561
572
|
|
|
562
573
|
/* In a card the table, or its frame, reaches the card's edges, so a row's fill does too. */
|
|
563
574
|
.ui-card > :is(.ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense), .ui-table-scroll:has(> .ui-table.ui-table--hover:not(.ui-table--zebra):not(.ui-table--dense))) {
|