@apliteni/apliteni-ui 0.147.0 → 0.151.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/guidelines/account-and-settings.md +5 -7
- package/guidelines/dense-tables.md +18 -4
- package/guidelines/density-and-accents.md +1 -1
- package/guidelines/going-back.md +5 -5
- package/guidelines/the-page.md +2 -0
- package/package.json +1 -2
- package/react/README.md +7 -16
- package/react/dist/index.css +121 -0
- package/react/dist/index.d.ts +44 -23
- package/react/dist/index.js +1245 -987
- package/src/assets/icons.js +10 -0
- package/src/logic/dropdown-placement.js +17 -1
- package/src/styles/back.css +2 -2
- package/src/styles/card.css +43 -0
- package/src/styles/dropdown.css +14 -0
- package/src/styles/layout.css +7 -3
- package/src/styles/nav.css +3 -38
- package/src/styles/table.css +33 -110
- package/src/tokens/tokens.css +12 -0
package/src/assets/icons.js
CHANGED
|
@@ -184,6 +184,12 @@ export const iconOnlyAllowed = {
|
|
|
184
184
|
// and one button opens the full navigation in a drawer. The three-bar glyph is the
|
|
185
185
|
// reader's own mark for this action.
|
|
186
186
|
menu: 'open the navigation drawer',
|
|
187
|
+
// A document viewer's page and zoom steps, chosen by Artur on #736: a slim row of
|
|
188
|
+
// steppers either side of the readout they move, so the readout names the action.
|
|
189
|
+
chevronLeft: 'step to the previous page',
|
|
190
|
+
chevronRight: 'step to the next page',
|
|
191
|
+
minus: 'zoom out',
|
|
192
|
+
plus: 'zoom in',
|
|
187
193
|
// A chart card's view switch, decided by Artur on #742: the bars and the grid
|
|
188
194
|
// are the two views themselves, side by side in one toolbar at the card's corner.
|
|
189
195
|
chart: 'show the values as a chart',
|
|
@@ -209,6 +215,10 @@ export const iconOnlyNames = {
|
|
|
209
215
|
// something else.
|
|
210
216
|
download: ['export', 'download'],
|
|
211
217
|
menu: ['menu'],
|
|
218
|
+
chevronLeft: ['previous'],
|
|
219
|
+
chevronRight: ['next'],
|
|
220
|
+
minus: ['zoom'],
|
|
221
|
+
plus: ['zoom'],
|
|
212
222
|
chart: ['chart'],
|
|
213
223
|
table: ['table'],
|
|
214
224
|
};
|
|
@@ -216,6 +216,19 @@ function ddScrollBox(dd, panel) {
|
|
|
216
216
|
return { el: el || els[0], els, top, bottom, height };
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
/* Does a body round the panel hide part of its width? Only `hidden` and `clip` count:
|
|
220
|
+
* a body that scrolls across still shows the rest. */
|
|
221
|
+
function ddClipsAcross(box, panel) {
|
|
222
|
+
const view = ddViewOf(panel);
|
|
223
|
+
const p = panel.getBoundingClientRect();
|
|
224
|
+
return box.els.some((at) => {
|
|
225
|
+
const overflow = view.getComputedStyle(at).overflowX;
|
|
226
|
+
if (overflow !== 'hidden' && overflow !== 'clip') return false;
|
|
227
|
+
const left = at.getBoundingClientRect().left + at.clientLeft;
|
|
228
|
+
return p.left < left - 0.5 || p.right > left + at.clientWidth + 0.5;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
219
232
|
/* The top of what has to stay in view over the panel: the field's label when the
|
|
220
233
|
* trigger has one above it, so the reader still sees what the list is for. */
|
|
221
234
|
function ddAnchorTop(dd, t) {
|
|
@@ -240,12 +253,15 @@ function ddContentHeight(panel) {
|
|
|
240
253
|
* the 8px edge where the body cannot. Where even then the body cannot hold the floor
|
|
241
254
|
* (or the whole list, when that is shorter), the panel is lifted out of the body.
|
|
242
255
|
* Measured from the heights alone, so the answer is the same however far the body is
|
|
243
|
-
* scrolled.
|
|
256
|
+
* scrolled. A body that clips across and is narrower than the panel lifts it too: no
|
|
257
|
+
* scroll shows what it cuts off, as the shell's rail cut the account menu (#736).
|
|
258
|
+
* `null` with no scrolling body.
|
|
244
259
|
*/
|
|
245
260
|
function ddBodyFit(dd, panel) {
|
|
246
261
|
const trigger = dd.querySelector('[data-dropdown-trigger]');
|
|
247
262
|
const box = ddScrollBox(dd, panel);
|
|
248
263
|
if (!box || !trigger) return null;
|
|
264
|
+
if (ddClipsAcross(box, panel)) return { box, lift: true };
|
|
249
265
|
const t = trigger.getBoundingClientRect();
|
|
250
266
|
const edge = ddEdge(panel);
|
|
251
267
|
const gap = ddGap(panel);
|
package/src/styles/back.css
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* ============================================================================
|
|
2
2
|
* Back link — .ui-back
|
|
3
3
|
* The way up from a page to the page it sits under. It stands above the page
|
|
4
|
-
* title,
|
|
5
|
-
* is
|
|
4
|
+
* title, and it is quiet at rest: it is on every page below a list, and it
|
|
5
|
+
* is never what the page is for.
|
|
6
6
|
* why: docs/components.md#the-back-link
|
|
7
7
|
* ========================================================================== */
|
|
8
8
|
|
package/src/styles/card.css
CHANGED
|
@@ -61,6 +61,49 @@
|
|
|
61
61
|
border-color: color-mix(in srgb, var(--green) 22%, transparent);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/* A viewer: a document shown inside a card, set apart from the controls that act on it.
|
|
65
|
+
The card's .ui-toolbar becomes a slim row between two hairlines, and its scroll box
|
|
66
|
+
becomes a recessed stage that runs to the card's sides and bottom. The document
|
|
67
|
+
itself is a .ui-card__page on that stage: a sheet one level up, so it reads as the
|
|
68
|
+
object and the row above it as the tools. Decided on #736.
|
|
69
|
+
why: docs/foundations.md#elevation */
|
|
70
|
+
.ui-card__viewer {
|
|
71
|
+
margin: var(--space-4) calc(-1 * var(--space-6)) calc(-1 * var(--space-6));
|
|
72
|
+
border-top: 1px solid var(--card-edge);
|
|
73
|
+
}
|
|
74
|
+
.ui-card__viewer > .ui-toolbar {
|
|
75
|
+
/* One row on a phone too: the page steps hold the start and the zoom the end. */
|
|
76
|
+
flex-wrap: nowrap;
|
|
77
|
+
align-items: center;
|
|
78
|
+
padding: var(--space-2) var(--space-4);
|
|
79
|
+
border-bottom: 1px solid var(--card-edge);
|
|
80
|
+
}
|
|
81
|
+
.ui-card__viewer > .ui-table-scroll {
|
|
82
|
+
/* The stage is the lowest rung, so an inline code chip on it takes the card. */
|
|
83
|
+
--table-bg: var(--surface-2);
|
|
84
|
+
--table-code-bg: var(--surface);
|
|
85
|
+
max-height: none;
|
|
86
|
+
/* With the scroll box's own 4px band at the sides and bottom, an even 24px inset. */
|
|
87
|
+
padding: var(--space-6) var(--space-5) var(--space-5);
|
|
88
|
+
border-radius: 0 0 calc(var(--radius-xl) - 1px) calc(var(--radius-xl) - 1px);
|
|
89
|
+
}
|
|
90
|
+
/* A4 at the least, so a short document still reads as a page and not as a panel.
|
|
91
|
+
The page carries the light palette in both themes (src/tokens/tokens.css), so its
|
|
92
|
+
own ink is set here: the inherited colour is the theme's. */
|
|
93
|
+
.ui-card__page {
|
|
94
|
+
box-sizing: border-box;
|
|
95
|
+
aspect-ratio: 210 / 297;
|
|
96
|
+
padding: var(--space-6) var(--space-5);
|
|
97
|
+
color: var(--text);
|
|
98
|
+
background: var(--surface);
|
|
99
|
+
border: 1px solid var(--card-edge);
|
|
100
|
+
box-shadow: var(--elev-rest);
|
|
101
|
+
border-radius: var(--radius-xs);
|
|
102
|
+
/* A table on the page takes the page's ground, not the stage's, and hands a chip the page. */
|
|
103
|
+
--table-bg: var(--surface);
|
|
104
|
+
--table-code-bg: var(--bg);
|
|
105
|
+
}
|
|
106
|
+
|
|
64
107
|
/* Interactive card (link / button semantics) */
|
|
65
108
|
.ui-card--interactive {
|
|
66
109
|
cursor: pointer;
|
package/src/styles/dropdown.css
CHANGED
|
@@ -331,11 +331,13 @@
|
|
|
331
331
|
/* Hover is a fill and an outline means focus, so a hovered row draws no edge. A row that is
|
|
332
332
|
hovered AND focused draws the ring over the fill.
|
|
333
333
|
why: docs/foundations.md#elevation */
|
|
334
|
+
.ui-dropdown__item[aria-expanded="true"],
|
|
334
335
|
.ui-dropdown__item:hover { background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ }
|
|
335
336
|
/* Light only: the panel is --bg-elevated, which --surface matches exactly there, so the
|
|
336
337
|
hover fill above changed nothing. --surface-3 is the quiet fill the drawer's close mark
|
|
337
338
|
takes on hover, one step under the --surface-2 that .is-active takes below.
|
|
338
339
|
why: docs/foundations.md#elevation */
|
|
340
|
+
:where(:root[data-theme="light"]) .ui-dropdown__item[aria-expanded="true"],
|
|
339
341
|
:where(:root[data-theme="light"]) .ui-dropdown__item:hover { background: var(--surface-3); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ }
|
|
340
342
|
@media (forced-colors: active) {
|
|
341
343
|
.ui-dropdown__item:hover { border: 1px solid Highlight; padding: 8px 11px; }
|
|
@@ -356,6 +358,18 @@
|
|
|
356
358
|
.ui-dropdown__item.is-selected .ui-dropdown__tick { display: inline-flex; } /* motion: still — a mark inside a row whose highlight already transitions; picking it closes the panel, which fades out over --dur-med */
|
|
357
359
|
.ui-dropdown__item.is-selected .ui-dropdown__label { color: var(--text); }
|
|
358
360
|
|
|
361
|
+
/* A row that opens a submenu (#736): the current value at the trailing edge in body ink,
|
|
362
|
+
then a chevron. The submenu is a second panel beside this one, or, in a panel marked
|
|
363
|
+
is-sub, the only rows showing.
|
|
364
|
+
why: docs/components.md#a-submenu-row */
|
|
365
|
+
.ui-dropdown__aside { margin-left: auto; flex: none; font-size: var(--text-xs); color: var(--text); }
|
|
366
|
+
.ui-dropdown__more { margin-left: auto; display: inline-flex; flex: none; /* muted-ink: glyph — submenu chevron */ color: var(--muted); }
|
|
367
|
+
.ui-dropdown__aside + .ui-dropdown__more { margin-left: 0; }
|
|
368
|
+
.ui-dropdown__more svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.25; }
|
|
369
|
+
.ui-dropdown__panel.is-sub > :not(.ui-dropdown__sub) { display: none; } /* The rows swap in one step, inside a panel that is already open. */
|
|
370
|
+
/* Three short choices: the width of a choice and its tick, not the 240px a menu of labels needs. */
|
|
371
|
+
.ui-dropdown__panel--sub { min-width: 180px; }
|
|
372
|
+
|
|
359
373
|
/* When a row has both a badge and a tick, keep the badge from eating the margin */
|
|
360
374
|
.ui-dropdown__badge + .ui-dropdown__tick { margin-left: 8px; }
|
|
361
375
|
|
package/src/styles/layout.css
CHANGED
|
@@ -401,9 +401,6 @@
|
|
|
401
401
|
why: docs/components.md#the-page-shell */
|
|
402
402
|
.ui-app__bar .toggle, .topbar__in .toggle { flex: none; }
|
|
403
403
|
.ui-app__user--bar .ui-app__av { margin-inline-start: 0; }
|
|
404
|
-
/* Crumb, then the title block. At --space-2 the crumb sat 8px off the h1 and
|
|
405
|
-
the h1 8px off its subtitle, so all three ranks read as one. */
|
|
406
|
-
.ui-app__main .ui-nav--crumbs { margin-bottom: var(--space-5); }
|
|
407
404
|
.ui-app__main h1 {
|
|
408
405
|
color: var(--strong);
|
|
409
406
|
/* rank: page-title */
|
|
@@ -416,6 +413,13 @@
|
|
|
416
413
|
.ui-app__sub { color: var(--text); font-size: calc(var(--text-base) + 0.5px); line-height: 1.6; max-width: var(--prose-body); margin-bottom: var(--space-8); }
|
|
417
414
|
/* A page may open on its title alone; then the title carries the head's step. */
|
|
418
415
|
.ui-app__main > h1:not(:has(+ .ui-app__sub)) { margin-bottom: var(--space-8); }
|
|
416
|
+
/* Page tools stand at the end of the title row, and the lede goes under the whole row.
|
|
417
|
+
The row takes the h1's steps: 8px to a lede, 32px when the page opens on its title alone.
|
|
418
|
+
16px keeps the tools off a long title, and the tools stand 12px apart. */
|
|
419
|
+
.ui-app__title-row { display: flex; align-items: center; gap: var(--space-4); margin-bottom: 8px; }
|
|
420
|
+
.ui-app__title-row:not(:has(+ .ui-app__sub)) { margin-bottom: var(--space-8); }
|
|
421
|
+
.ui-app__main .ui-app__title-row > h1 { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
|
|
422
|
+
.ui-app__tools { display: flex; flex: none; align-items: center; gap: var(--space-3); }
|
|
419
423
|
.ui-app__body { display: flex; flex-direction: column; gap: var(--space-5); }
|
|
420
424
|
/* A flex child's min-width is its content by default, so one wide block — a
|
|
421
425
|
ledger, a code sample — pushes the whole page sideways instead of scrolling
|
package/src/styles/nav.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* ============================================================================
|
|
2
|
-
* Navigation — sidebar rail
|
|
2
|
+
* Navigation — sidebar rail and horizontal tabs. One token-driven
|
|
3
3
|
* class family (ui-nav__…) so every variant re-themes across accents +
|
|
4
4
|
* light/dark. appShell() draws its rail from sidebarNav(), so this file is the
|
|
5
5
|
* page shell's rail as well as a standalone component. States are pure tokens.
|
|
@@ -394,39 +394,6 @@
|
|
|
394
394
|
.ui-nav__tab.is-disabled { /* muted-ink: state — unavailable control */ color: var(--disabled-ink); cursor: default; }
|
|
395
395
|
.ui-nav__tab .ui-nav__badge { height: 18px; }
|
|
396
396
|
|
|
397
|
-
/* -- Breadcrumbs --------------------------------------------------------- */
|
|
398
|
-
/* The chip hangs out by its own padding so the first LABEL lands on the column's edge,
|
|
399
|
-
level with the page title under it. */
|
|
400
|
-
.ui-nav__crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-inline-start: -6px; }
|
|
401
|
-
.ui-nav__crumb-item { display: inline-flex; align-items: center; }
|
|
402
|
-
.ui-nav__crumb-item + .ui-nav__crumb-item::before {
|
|
403
|
-
content: "";
|
|
404
|
-
width: 6px; height: 6px;
|
|
405
|
-
margin: 0 8px;
|
|
406
|
-
border-right: 1.4px solid var(--muted);
|
|
407
|
-
border-bottom: 1.4px solid var(--muted);
|
|
408
|
-
transform: rotate(-45deg);
|
|
409
|
-
opacity: 0.7;
|
|
410
|
-
}
|
|
411
|
-
.ui-nav__crumb {
|
|
412
|
-
display: inline-flex;
|
|
413
|
-
align-items: center;
|
|
414
|
-
gap: 6px;
|
|
415
|
-
padding: 3px 6px;
|
|
416
|
-
border-radius: 7px;
|
|
417
|
-
text-decoration: none;
|
|
418
|
-
font-size: var(--text-sm);
|
|
419
|
-
transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
|
|
420
|
-
}
|
|
421
|
-
/* Carries the block's class as well as its own, for the reason .ui-nav__item
|
|
422
|
-
does above: a linked crumb is an <a>, and a host stylesheet's `a:link` is
|
|
423
|
-
(0,1,1), which outranks a bare (0,1,0) class. */
|
|
424
|
-
.ui-nav .ui-nav__crumb { color: var(--text); }
|
|
425
|
-
a.ui-nav__crumb:hover { color: var(--strong); background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ }
|
|
426
|
-
a.ui-nav__crumb:focus-visible { outline: var(--ring); outline-offset: var(--ring-offset); }
|
|
427
|
-
.ui-nav__crumb.is-current { color: var(--strong); font-weight: 500; }
|
|
428
|
-
.ui-nav__crumb .ui-nav__ic svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.5; }
|
|
429
|
-
|
|
430
397
|
/* Forced colours replace every author background, so a selected item takes the system
|
|
431
398
|
pair as its fill. `forced-color-adjust: none` is what keeps the pair from sitting on
|
|
432
399
|
Chromium's Canvas backplate, which would leave the label unreadable. Focus keeps its
|
|
@@ -438,8 +405,7 @@ a.ui-nav__crumb:focus-visible { outline: var(--ring); outline-offset: var(--ring
|
|
|
438
405
|
.ui-nav__item.is-active:not(.is-disabled),
|
|
439
406
|
.ui-nav__item.is-current:not(.is-disabled),
|
|
440
407
|
.ui-nav__tab.is-active:not(.is-disabled),
|
|
441
|
-
.ui-nav--tabs.is-pill .ui-nav__tab.is-active:not(.is-disabled)
|
|
442
|
-
.ui-nav__crumb.is-current {
|
|
408
|
+
.ui-nav--tabs.is-pill .ui-nav__tab.is-active:not(.is-disabled) {
|
|
443
409
|
forced-color-adjust: none;
|
|
444
410
|
background: Highlight !important;
|
|
445
411
|
color: HighlightText !important;
|
|
@@ -447,8 +413,7 @@ a.ui-nav__crumb:focus-visible { outline: var(--ring); outline-offset: var(--ring
|
|
|
447
413
|
}
|
|
448
414
|
.ui-nav__item.is-active:not(.is-disabled) .ui-nav__ic svg,
|
|
449
415
|
.ui-nav__item.is-current:not(.is-disabled) .ui-nav__ic svg,
|
|
450
|
-
.ui-nav__tab.is-active:not(.is-disabled) .ui-nav__ic svg
|
|
451
|
-
.ui-nav__crumb.is-current .ui-nav__ic svg { stroke: HighlightText; }
|
|
416
|
+
.ui-nav__tab.is-active:not(.is-disabled) .ui-nav__ic svg { stroke: HighlightText; }
|
|
452
417
|
.ui-nav__item.is-active .ui-nav__caret,
|
|
453
418
|
.ui-nav__item.is-current .ui-nav__caret { border-color: currentColor; }
|
|
454
419
|
.ui-nav__item.is-active:not(.is-disabled) .ui-nav__badge,
|
package/src/styles/table.css
CHANGED
|
@@ -68,6 +68,10 @@
|
|
|
68
68
|
border-spacing: 0;
|
|
69
69
|
padding: 0 var(--space-2);
|
|
70
70
|
}
|
|
71
|
+
/* A pinned column sticks at the frame's edge, so its first cell owns the start inset
|
|
72
|
+
and the text does not move when the table scrolls. why: #736 */
|
|
73
|
+
.ui-table--hover.ui-table--pinned:not(.ui-table--zebra) { padding: 0 var(--space-2) 0 0; }
|
|
74
|
+
.ui-table--hover.ui-table--pinned:not(.ui-table--zebra) :is(th, td):first-child { padding-left: var(--space-2); }
|
|
71
75
|
.ui-table--hover:not(.ui-table--zebra) tbody tr:hover td:first-child {
|
|
72
76
|
border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
|
|
73
77
|
.ui-table--hover:not(.ui-table--zebra) tbody tr:hover td:last-child {
|
|
@@ -221,8 +225,7 @@
|
|
|
221
225
|
* because a dense cell is nowrap, and the column is then only as wide as the wider
|
|
222
226
|
* of the two: a status that had a column of its own was the first thing a phone cut
|
|
223
227
|
* off, and in here it is the last. The class goes on a span inside the cell, never
|
|
224
|
-
* on the cell, which would leave the table box model. A
|
|
225
|
-
* .ui-table--stack below instead, which drops the head; a pair keeps every head at every
|
|
228
|
+
* on the cell, which would leave the table box model. A pair keeps every head at every
|
|
226
229
|
* width, which is what a three-value glance row is read by. why: #505 */
|
|
227
230
|
.ui-table__pair { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
|
|
228
231
|
|
|
@@ -271,6 +274,12 @@
|
|
|
271
274
|
.ui-table--zebra.ui-table--hover tbody tr.is-target:hover > :is(td, th) {
|
|
272
275
|
background: color-mix(in srgb, var(--accent) 12%, transparent); /* code-bg: inherit — this translucent wash leaves the chip on its opaque ground. */
|
|
273
276
|
}
|
|
277
|
+
/* A pinned cell lays the wash over its own ground, or the columns that scroll under it
|
|
278
|
+
show through. #736 */
|
|
279
|
+
.ui-table--pinned tbody tr.is-target > :is(.ui-table__identity, .ui-table__selection),
|
|
280
|
+
.ui-table--pinned.ui-table--hover tbody tr.is-target:hover > :is(.ui-table__identity, .ui-table__selection) {
|
|
281
|
+
background: linear-gradient(color-mix(in srgb, var(--accent) 12%, transparent)) var(--table-bg);
|
|
282
|
+
}
|
|
274
283
|
|
|
275
284
|
/* A focused row draws the shared ring inward, like its containing scroll region.
|
|
276
285
|
why: docs/foundations.md#the-focus-ring */
|
|
@@ -299,6 +308,11 @@
|
|
|
299
308
|
.ui-card > .ui-table-scroll > .ui-table--dense {
|
|
300
309
|
padding-inline: 0;
|
|
301
310
|
}
|
|
311
|
+
/* A hover table's row inset plus the frame's 4px band is one --space-3, so the
|
|
312
|
+
frame hangs out by that much and the first column meets the title. why: #736 */
|
|
313
|
+
.ui-card > .ui-table-scroll:has(> .ui-table--hover:not(.ui-table--dense)) {
|
|
314
|
+
margin-inline: calc(-1 * var(--space-3));
|
|
315
|
+
}
|
|
302
316
|
.ui-table td.ui-table__num { text-align: right; }
|
|
303
317
|
.ui-table--compact td,
|
|
304
318
|
.ui-table--compact :is(tbody, tfoot) th { padding: var(--space-1) var(--space-3); font-size: var(--text-sm); line-height: var(--leading-snug); height: 33px; }
|
|
@@ -335,9 +349,9 @@
|
|
|
335
349
|
/* The surface belongs to the box that scrolls, so the shades land under the cells
|
|
336
350
|
rather than behind them; the row fills repeat that same surface and step aside.
|
|
337
351
|
The sticky header and pinned column keep their paint: they hide what scrolls
|
|
338
|
-
beneath them. */
|
|
352
|
+
beneath them. A target row keeps its wash. */
|
|
339
353
|
.ui-table-scroll > .ui-table,
|
|
340
|
-
.ui-table-scroll > .ui-table tbody td:not(.ui-table__identity, .ui-table__selection) { background-color: transparent; }
|
|
354
|
+
.ui-table-scroll > .ui-table tbody :where(tr:not(.is-target)) > td:not(.ui-table__identity, .ui-table__selection) { background-color: transparent; }
|
|
341
355
|
.ui-table-scroll > .ui-table--hover tbody tr:hover:not(.is-target) > :is(td, th) {
|
|
342
356
|
background: var(--surface-2);
|
|
343
357
|
}
|
|
@@ -392,6 +406,14 @@
|
|
|
392
406
|
.ui-table-scroll::after { left: calc(100% - var(--space-3)); right: 0; justify-self: end; }
|
|
393
407
|
@container scroll-state(scrollable: left) {
|
|
394
408
|
.ui-table-scroll::before { background: linear-gradient(to right, var(--table-edge), transparent); }
|
|
409
|
+
/* A pinned column stays, so the shade falls on its right side, over the columns that
|
|
410
|
+
scroll under it. The spread carries the shadow past each row's ends, and the clip cuts
|
|
411
|
+
it there and on the left, so the rows join as one even band. why: #736 */
|
|
412
|
+
.ui-table-scroll:has(> .ui-table--pinned)::before { background: none; }
|
|
413
|
+
.ui-table--pinned .ui-table__identity {
|
|
414
|
+
box-shadow: calc(-1 * var(--space-2)) 0 var(--space-3) var(--space-3) var(--table-edge);
|
|
415
|
+
clip-path: inset(0 calc(-1 * var(--space-6)) 0 0);
|
|
416
|
+
}
|
|
395
417
|
}
|
|
396
418
|
@container scroll-state(scrollable: right) {
|
|
397
419
|
.ui-table-scroll::after { background: linear-gradient(to left, var(--table-edge), transparent); }
|
|
@@ -494,112 +516,13 @@ a.ui-identity:hover { text-decoration: underline; }
|
|
|
494
516
|
.ui-table--pinned .ui-table__selection + .ui-table__identity { left: var(--ui-table-selection-width); }
|
|
495
517
|
|
|
496
518
|
/* ============================================================================
|
|
497
|
-
*
|
|
519
|
+
* Running text in a cell — .ui-table__long
|
|
498
520
|
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
* `nowrap` on a paragraph.
|
|
502
|
-
*
|
|
503
|
-
* The consumer's half — the roles a changed `display` drops — is in docs/components.md.
|
|
504
|
-
* why: docs/components.md#dense-financial-tables
|
|
505
|
-
* held by: src/styles/table-stack.test.js (layout), stories/table-stack.test.js (roles)
|
|
521
|
+
* A table never stacks its rows at any width. A wide table scrolls sideways in its frame,
|
|
522
|
+
* and a pinned identity keeps the first column in view. why: #736
|
|
506
523
|
* ========================================================================== */
|
|
507
524
|
|
|
508
|
-
/* The marked column holds running text at any width.
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
@media (max-width: 560px) {
|
|
513
|
-
.ui-table.ui-table--stack { display: block; width: 100%; min-width: 0; padding: 0; }
|
|
514
|
-
.ui-table.ui-table--stack > thead {
|
|
515
|
-
position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
|
|
516
|
-
}
|
|
517
|
-
.ui-table.ui-table--stack > tbody { display: block; }
|
|
518
|
-
.ui-table.ui-table--stack > tbody > tr {
|
|
519
|
-
display: flex; flex-wrap: wrap; align-items: baseline;
|
|
520
|
-
column-gap: var(--space-3); row-gap: var(--space-1);
|
|
521
|
-
/* The inset is on the row, not the table, so its hover fill and separator keep
|
|
522
|
-
their clearance at the width above this one. */
|
|
523
|
-
padding: var(--space-3); border-bottom: 1px solid var(--border);
|
|
524
|
-
}
|
|
525
|
-
.ui-table.ui-table--stack > tbody > tr:last-child { border-bottom: 0; }
|
|
526
|
-
/* `height` is in this list for the same reason `white-space` is: --compact sets a row
|
|
527
|
-
height for a one-line cell, and a block cell takes it as a fixed height rather than a
|
|
528
|
-
floor, so a wrapped paragraph spills through the separator into the next row. A stacked
|
|
529
|
-
cell is as tall as its text. */
|
|
530
|
-
.ui-table.ui-table--stack > tbody > tr > td {
|
|
531
|
-
display: block; width: auto; min-width: 0; max-width: 100%; height: auto;
|
|
532
|
-
padding: 0; border-bottom: 0; white-space: normal; overflow-wrap: break-word;
|
|
533
|
-
}
|
|
534
|
-
.ui-table.ui-table--stack.ui-table--hover tbody tr:hover:not(.is-target) > :is(td, th) {
|
|
535
|
-
background: transparent;
|
|
536
|
-
}
|
|
537
|
-
.ui-table.ui-table--stack > tbody > tr > td.ui-table__long { flex: 0 0 100%; text-align: left; }
|
|
538
|
-
/* The head is gone, so an amount that names its column in `data-label` says it in front of
|
|
539
|
-
the figure, in the unit's size and body ink. */
|
|
540
|
-
.ui-table.ui-table--stack > tbody > tr > td[data-label]::before {
|
|
541
|
-
content: attr(data-label) / ""; margin-right: var(--space-1); font-size: var(--text-xs);
|
|
542
|
-
}
|
|
543
|
-
/* The cells of a stacked row are separate boxes with gaps between them, so a tint on each
|
|
544
|
-
would paint patches. The row paints one tint and the cells let it through. */
|
|
545
|
-
.ui-table.ui-table--stack tbody tr.is-target:is(*, :hover) {
|
|
546
|
-
background: color-mix(in srgb, var(--accent) 12%, transparent); /* code-bg: inherit — this translucent wash leaves the chip on its opaque ground. */
|
|
547
|
-
}
|
|
548
|
-
.ui-table.ui-table--stack tbody tr.is-target:is(*, :hover) > :is(td, th) { background: transparent; }
|
|
549
|
-
/* A stacked row has no columns left to pin, stick or inset, and the identity's name is
|
|
550
|
-
what the row is about — the fold hides it only because a pinned column is narrow. */
|
|
551
|
-
.ui-table.ui-table--stack.ui-table--pinned > :where(thead, tbody) > tr > :where(.ui-table__identity, .ui-table__selection) {
|
|
552
|
-
position: static; width: auto; min-width: 0; max-width: none;
|
|
553
|
-
padding-inline: 0; border-right: 0; text-align: left;
|
|
554
|
-
/* The cap's cut goes with the cap: a card is as wide as the row, so there is
|
|
555
|
-
nothing to cut, and a clip box here would only reach a focused link's ring. */
|
|
556
|
-
overflow: visible; text-overflow: clip;
|
|
557
|
-
}
|
|
558
|
-
/* The name is what the card is about, and a card has the width to wrap it. #500 put
|
|
559
|
-
`nowrap` on it for the narrow column, so the stacked row takes that off too. */
|
|
560
|
-
.ui-table.ui-table--stack.ui-table--pinned .ui-identity__name {
|
|
561
|
-
position: static; width: auto; height: auto; max-width: none;
|
|
562
|
-
overflow: visible; clip-path: none; white-space: normal; text-overflow: clip;
|
|
563
|
-
}
|
|
564
|
-
.ui-table.ui-table--stack.ui-table--pinned .ui-table__identity > * {
|
|
565
|
-
overflow: visible; text-overflow: clip;
|
|
566
|
-
}
|
|
567
|
-
.ui-table.ui-table--stack.ui-table--pinned .ui-table__identity > * a {
|
|
568
|
-
max-width: none; overflow: visible; text-overflow: clip;
|
|
569
|
-
}
|
|
570
|
-
.ui-table.ui-table--stack.ui-table--pinned .ui-table__identity > a:not([class]) {
|
|
571
|
-
display: inline-block;
|
|
572
|
-
}
|
|
573
|
-
.ui-table.ui-table--stack.ui-table--pinned .ui-table__identity:not(.ui-table__linked):has(> a:focus-visible) {
|
|
574
|
-
outline: none;
|
|
575
|
-
}
|
|
576
|
-
.ui-table.ui-table--stack.ui-table--pinned .ui-table__identity:not(.ui-table__linked) > a:focus-visible {
|
|
577
|
-
outline: var(--ring);
|
|
578
|
-
outline-offset: var(--ring-offset);
|
|
579
|
-
}
|
|
580
|
-
/* A card has no column to fill: every cell is a block on its own line and the ROW pays
|
|
581
|
-
the inset, so the fill's padding would stand the link a step right of the card's text
|
|
582
|
-
edge and the cell's `height: 1px` would hold a block cell to one pixel. Written through
|
|
583
|
-
the row like the resets above it, so it outranks the fill and its density. */
|
|
584
|
-
.ui-table.ui-table--stack > tbody > tr > td.ui-table__linked:has(> :is(a:not([class]), a.ui-identity):only-child) { height: auto; }
|
|
585
|
-
.ui-table.ui-table--stack > tbody > tr > td.ui-table__linked > :is(a:not([class]), a.ui-identity):only-child {
|
|
586
|
-
width: auto; height: auto; padding: 0;
|
|
587
|
-
}
|
|
588
|
-
/* The stacked card gives the link its own box again, so it takes the outset band. */
|
|
589
|
-
.ui-table.ui-table--stack > tbody > tr > td.ui-table__linked > a:only-child:focus-visible {
|
|
590
|
-
outline: var(--ring);
|
|
591
|
-
outline-offset: var(--ring-offset);
|
|
592
|
-
}
|
|
593
|
-
/* The bleed now pays for the row's inset instead of the end cells', so the cells still
|
|
594
|
-
start on the card's own text edge and the outline keeps its room on both sides. Same
|
|
595
|
-
step, so the arithmetic is the one the sheet already does for a dense table above; these
|
|
596
|
-
rules exist because a stacked table that is not dense gets no bleed from that one. A
|
|
597
|
-
scroll wrapper owns the bleed when it is the card's child, and owes one step more than
|
|
598
|
-
the table does because the wrapper keeps its own --space-1 of focus clearance. */
|
|
599
|
-
.ui-card > .ui-table--stack {
|
|
600
|
-
width: calc(100% + 2 * var(--space-3)); margin-inline: calc(-1 * var(--space-3));
|
|
601
|
-
}
|
|
602
|
-
.ui-card > .ui-table-scroll:has(> .ui-table--stack) {
|
|
603
|
-
margin-inline: calc(-1 * var(--space-4));
|
|
604
|
-
}
|
|
605
|
-
}
|
|
525
|
+
/* The marked column holds running text at any width. Two classes outrank the nowrap of
|
|
526
|
+
--dense, --compact and __title. The floor keeps a note a readable paragraph when the table
|
|
527
|
+
is wider than its frame, so the frame scrolls instead of the note collapsing to one word. */
|
|
528
|
+
.ui-table td.ui-table__long { white-space: normal; min-width: var(--panel-sm); }
|
package/src/tokens/tokens.css
CHANGED
|
@@ -358,7 +358,11 @@
|
|
|
358
358
|
|
|
359
359
|
/* ============================================================================
|
|
360
360
|
* LIGHT THEME — deck light palette from viz/account.mjs
|
|
361
|
+
*
|
|
362
|
+
* A document sheet (.ui-card__page) takes this palette in both themes: the document
|
|
363
|
+
* is paper, so it stays white with dark ink on a dark stage too. Decided on #736.
|
|
361
364
|
* ========================================================================== */
|
|
365
|
+
.ui-card__page,
|
|
362
366
|
:root[data-theme="light"] {
|
|
363
367
|
color-scheme: light;
|
|
364
368
|
|
|
@@ -537,6 +541,13 @@
|
|
|
537
541
|
--grad-from: var(--purple-light);
|
|
538
542
|
--grad-to: var(--cyan);
|
|
539
543
|
}
|
|
544
|
+
/* The ring is declared once, in the dark block, and computed at :root. The sheet takes the
|
|
545
|
+
light accent above, so it computes its ring again or a focus on the paper keeps the dark one. */
|
|
546
|
+
.ui-card__page {
|
|
547
|
+
--ring-color: var(--accent);
|
|
548
|
+
--ring: var(--ring-width) solid var(--ring-color);
|
|
549
|
+
--ring-scroll: var(--ring);
|
|
550
|
+
}
|
|
540
551
|
|
|
541
552
|
/* ============================================================================
|
|
542
553
|
* WIDTHS BELOW THE PAGE — the box, and the line. Two scales, and one rule for
|
|
@@ -592,6 +603,7 @@
|
|
|
592
603
|
.ui-card,
|
|
593
604
|
.ui-card--accent,
|
|
594
605
|
.ui-card--live,
|
|
606
|
+
.ui-card__page,
|
|
595
607
|
.ui-cmdk__panel,
|
|
596
608
|
.ui-confirm__panel,
|
|
597
609
|
.ui-drawer__footer,
|