rift-ds 1.40.0 → 1.41.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/README.md +6 -2
- package/behaviors/shell.css +9 -11
- package/bin/templates/blocks/components/blocks/AppShell.tsx +2 -1
- package/chat/ChatLauncher.d.ts +2 -2
- package/chat/ChatWidget.css +7 -7
- package/chat/ChatWidget.d.ts +1 -1
- package/components/AppLayout/AppLayout.css +1 -1
- package/components/AppLayout/AppLayout.d.ts +2 -2
- package/components/AppSidebar/AppSidebar.css +12 -15
- package/components/AppSidebar/AppSidebar.d.ts +4 -4
- package/components/AppSidebar/AppSidebar.js +9 -5
- package/components/Avatar/Avatar.css +18 -5
- package/components/Avatar/Avatar.d.ts +2 -0
- package/components/Avatar/Avatar.js +2 -1
- package/components/AvatarGroup/AvatarGroup.css +8 -1
- package/components/AvatarGroup/AvatarGroup.d.ts +6 -0
- package/components/AvatarGroup/AvatarGroup.js +2 -2
- package/components/DataTable/DataTable.css +63 -0
- package/components/DataTable/DataTable.d.ts +26 -2
- package/components/DataTable/DataTable.js +116 -90
- package/components/DrillMenu/DrillMenu.d.ts +2 -1
- package/components/DrillMenu/DrillMenu.js +14 -3
- package/components/EntitySwitcher/EntitySwitcher.css +2 -1
- package/components/Icon/Icon.css +6 -1
- package/components/Icon/Icon.d.ts +3 -1
- package/components/Icon/Icon.js +2 -0
- package/components/PixelAvatar/PixelAvatar.css +7 -1
- package/components/PixelAvatar/PixelAvatar.d.ts +2 -0
- package/components/PixelAvatar/PixelAvatar.js +2 -1
- package/components/ShaderField/useShaderField.js +2 -2
- package/components/ShaderScene/ShaderScene.js +2 -2
- package/components/SiteHeader/SiteHeader.css +0 -9
- package/components/SourceChip/SourceChip.css +2 -1
- package/components/SubNavPanel/SubNavPanel.css +10 -9
- package/components/Table/Table.css +310 -0
- package/components/Table/Table.d.ts +28 -2
- package/components/Table/Table.js +26 -9
- package/components/registry.json +1 -1
- package/components/registry.json.d.ts +1 -1
- package/components/registry.json.js +1 -1
- package/package.json +3 -2
- package/tokens/motion.d.ts +2 -0
- package/tokens/motion.js +2 -0
- package/tokens/presets/contrast.css +34 -1
- package/tokens/presets/coral.css +38 -1
- package/tokens/presets/forest.css +41 -1
- package/tokens/presets/gold.css +35 -1
- package/tokens/presets/marquee.css +40 -1
- package/tokens/presets/mono.css +79 -1
- package/tokens/presets/pink.css +38 -1
- package/tokens/presets/plum.css +41 -1
- package/tokens/presets/terminal.css +36 -1
- package/tokens/presets/violet.css +41 -1
- package/tokens/presets/warm.css +33 -1
- package/tokens/presets/zest.css +45 -1
- package/tokens/registry.json +1 -0
- package/tokens/registry.json.d.ts +1 -0
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +1 -0
- package/tokens/tokens-light.css +5 -0
- package/tokens/values.json.js +1 -1
|
@@ -5,6 +5,21 @@
|
|
|
5
5
|
|
|
6
6
|
@layer rift.tokens, rift.preset, rift.components;
|
|
7
7
|
|
|
8
|
+
/* A frameless table's hover tile paints through these two, inside its
|
|
9
|
+
cells' backgrounds and shadows. Registered as colours so the fill and
|
|
10
|
+
the edge fade together; browsers without @property switch at once. */
|
|
11
|
+
@property --ds-table-fill {
|
|
12
|
+
syntax: '<color>';
|
|
13
|
+
initial-value: transparent;
|
|
14
|
+
inherits: false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@property --ds-table-edge {
|
|
18
|
+
syntax: '<color>';
|
|
19
|
+
initial-value: transparent;
|
|
20
|
+
inherits: false;
|
|
21
|
+
}
|
|
22
|
+
|
|
8
23
|
@layer rift.components {
|
|
9
24
|
|
|
10
25
|
.ds-table {
|
|
@@ -22,6 +37,13 @@
|
|
|
22
37
|
color: var(--color-text-primary);
|
|
23
38
|
}
|
|
24
39
|
|
|
40
|
+
/* Round marks: the shared mark hook at a true circle, so every Avatar,
|
|
41
|
+
Icon tile, PixelAvatar tile and logo in the table draws round whatever
|
|
42
|
+
the theme's radius. */
|
|
43
|
+
.ds-table--round-marks {
|
|
44
|
+
--ds-mark-radius: 50%;
|
|
45
|
+
}
|
|
46
|
+
|
|
25
47
|
/* The plain table clips its own rounded corners. The bordered table does
|
|
26
48
|
not: its wrapper is the scroll container and clips for it, which leaves
|
|
27
49
|
the table itself free of overflow so sticky headers and pinned columns can
|
|
@@ -286,4 +308,292 @@
|
|
|
286
308
|
word-break: break-word;
|
|
287
309
|
}
|
|
288
310
|
|
|
311
|
+
/* ============================================
|
|
312
|
+
FRAMELESS AND THE OUTER CONTROL: wider than a phone only
|
|
313
|
+
Below the phone step a frameless table is drawn as the plain table is,
|
|
314
|
+
and the outer control's column as an ordinary first column: a phone has
|
|
315
|
+
no hover to reveal the control and no page margin for the tile's reach.
|
|
316
|
+
DataTable makes the same switch at its own width, so a table in a narrow
|
|
317
|
+
panel counts there too.
|
|
318
|
+
============================================ */
|
|
319
|
+
|
|
320
|
+
@media (min-width: 601px) {
|
|
321
|
+
/* ============================================
|
|
322
|
+
FRAMELESS (`frameless`)
|
|
323
|
+
No outline, no header band, no column dividers, no table surface: the
|
|
324
|
+
lines between rows stay, cut to the content. The first and last
|
|
325
|
+
columns' content sits flush with the page: the scroll container reaches
|
|
326
|
+
past its column by the bleed (--padding-400) on both sides and the end
|
|
327
|
+
cells pad back in by it. A hovered row lifts into a raised tile that
|
|
328
|
+
fills that reach.
|
|
329
|
+
|
|
330
|
+
The tile is painted by the cells, never by a shape behind the row, so a
|
|
331
|
+
sticky cell (DataTable's pinned columns and sticky header) paints its own
|
|
332
|
+
part of it. Each cell stacks a base (opaque only where it sticks), the
|
|
333
|
+
row's fill, and its divider along the foot. The tile's edges are shadows
|
|
334
|
+
that take no room, in the divider's colour, on the very pixels the
|
|
335
|
+
dividers use: the top edge on the line above, the bottom edge on the
|
|
336
|
+
row's own line. Where the tile meets a divider that line never changes,
|
|
337
|
+
so the tile fades in without a second line ever showing.
|
|
338
|
+
|
|
339
|
+
Two override hooks: --ds-table-tile, the tile's fill (the raised
|
|
340
|
+
container surface by default, which keeps a control in the row hovering
|
|
341
|
+
with the contrast it has on a card), and --ds-table-surface, what a
|
|
342
|
+
sticky cell and the seam between selected rows are painted with (the
|
|
343
|
+
surface of the app shell it sits in, else the page; a table on a card
|
|
344
|
+
sets it to the card's colour).
|
|
345
|
+
============================================ */
|
|
346
|
+
|
|
347
|
+
.ds-table.ds-table--frameless {
|
|
348
|
+
--ds-table-bleed: var(--padding-400);
|
|
349
|
+
--ds-table-radius: var(--radius-300);
|
|
350
|
+
|
|
351
|
+
overflow: visible;
|
|
352
|
+
border-radius: 0;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.ds-table.ds-table--frameless.ds-table--compact {
|
|
356
|
+
--ds-table-radius: var(--radius-200);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/* The scroll container reaches out by the bleed. */
|
|
360
|
+
.ds-table__scroll--frameless {
|
|
361
|
+
margin-inline: calc(-1 * var(--padding-400));
|
|
362
|
+
max-width: none;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.ds-table--frameless .ds-table__head {
|
|
366
|
+
background: transparent;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.ds-table--frameless .ds-table__caption {
|
|
370
|
+
padding-inline: var(--padding-400);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/* Rows paint nothing; their cells paint the tile. */
|
|
374
|
+
.ds-table--frameless .ds-table__body .ds-table__row,
|
|
375
|
+
.ds-table--frameless .ds-table__body .ds-table__row:hover,
|
|
376
|
+
.ds-table.ds-table--frameless.ds-table--striped .ds-table__body .ds-table__row:nth-child(even),
|
|
377
|
+
.ds-table.ds-table--frameless .ds-table__body .ds-table__row.ds-table__row--selected:nth-child(n) {
|
|
378
|
+
background-color: transparent;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.ds-table--frameless :is(.ds-table__cell, .ds-table__header-cell) {
|
|
382
|
+
--ds-table-line: var(--color-table-divider);
|
|
383
|
+
--ds-table-fill: transparent;
|
|
384
|
+
--ds-table-edge: transparent;
|
|
385
|
+
--ds-table-line-size: 100%;
|
|
386
|
+
--ds-table-line-at: bottom;
|
|
387
|
+
--ds-table-side: 0 0 transparent;
|
|
388
|
+
|
|
389
|
+
border: 0;
|
|
390
|
+
box-shadow:
|
|
391
|
+
0 calc(-1 * var(--border-025)) 0 0 var(--ds-table-edge),
|
|
392
|
+
inset 0 calc(-1 * var(--border-025)) 0 0 var(--ds-table-edge),
|
|
393
|
+
var(--ds-table-side);
|
|
394
|
+
background-color: var(--ds-table-base, transparent);
|
|
395
|
+
background-image:
|
|
396
|
+
linear-gradient(var(--ds-table-line), var(--ds-table-line)),
|
|
397
|
+
linear-gradient(var(--ds-table-fill), var(--ds-table-fill));
|
|
398
|
+
background-size:
|
|
399
|
+
var(--ds-table-line-size) var(--border-025),
|
|
400
|
+
100% 100%;
|
|
401
|
+
background-position:
|
|
402
|
+
var(--ds-table-line-at),
|
|
403
|
+
0 0;
|
|
404
|
+
background-repeat: no-repeat;
|
|
405
|
+
transition:
|
|
406
|
+
--ds-table-fill var(--motion-duration-fast) var(--motion-ease-standard),
|
|
407
|
+
--ds-table-edge var(--motion-duration-fast) var(--motion-ease-standard);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/* The end cells pad in by the bleed, round the tile's corners and draw
|
|
411
|
+
its side edge; their stretch of divider stops at the content. */
|
|
412
|
+
.ds-table--frameless .ds-table__row > :first-child {
|
|
413
|
+
--ds-table-side: inset var(--border-025) 0 0 0 var(--ds-table-edge); /* ds-allow(physical): the start side; flipped for rtl below */
|
|
414
|
+
--ds-table-line-size: calc(100% - var(--ds-table-bleed));
|
|
415
|
+
--ds-table-line-at: bottom right; /* ds-allow(physical): the divider is cut at the start side; flipped for rtl below */
|
|
416
|
+
|
|
417
|
+
padding-inline-start: var(--ds-table-bleed);
|
|
418
|
+
border-start-start-radius: var(--ds-table-radius);
|
|
419
|
+
border-end-start-radius: var(--ds-table-radius);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.ds-table--frameless .ds-table__row > :last-child {
|
|
423
|
+
--ds-table-side: inset calc(-1 * var(--border-025)) 0 0 0 var(--ds-table-edge); /* ds-allow(physical): the end side; flipped for rtl below */
|
|
424
|
+
--ds-table-line-size: calc(100% - var(--ds-table-bleed));
|
|
425
|
+
--ds-table-line-at: bottom left; /* ds-allow(physical): the divider is cut at the end side; flipped for rtl below */
|
|
426
|
+
|
|
427
|
+
padding-inline-end: var(--ds-table-bleed);
|
|
428
|
+
border-start-end-radius: var(--ds-table-radius);
|
|
429
|
+
border-end-end-radius: var(--ds-table-radius);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.ds-table--frameless:dir(rtl) .ds-table__row > :first-child {
|
|
433
|
+
--ds-table-side: inset calc(-1 * var(--border-025)) 0 0 0 var(--ds-table-edge);
|
|
434
|
+
--ds-table-line-at: bottom left; /* ds-allow(physical): the start side in rtl */
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.ds-table--frameless:dir(rtl) .ds-table__row > :last-child {
|
|
438
|
+
--ds-table-side: inset var(--border-025) 0 0 0 var(--ds-table-edge);
|
|
439
|
+
--ds-table-line-at: bottom right; /* ds-allow(physical): the end side in rtl */
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/* The header's line hides when the first row is selected. Kept apart
|
|
443
|
+
from the body's line rules on purpose: a bundler merges adjacent rules
|
|
444
|
+
with the same body into one :is() list, and an :is() takes its heaviest
|
|
445
|
+
argument's specificity, which would carry the simple row rule past the
|
|
446
|
+
seam rule below. */
|
|
447
|
+
.ds-table.ds-table--frameless:has(.ds-table__body .ds-table__row--selected:first-child) .ds-table__header-cell {
|
|
448
|
+
--ds-table-line: transparent;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/* A total row keeps its heavier rule, and the line above it gives way so
|
|
452
|
+
the two never stack. */
|
|
453
|
+
.ds-table.ds-table--frameless .ds-table__body .ds-table__row--total > .ds-table__cell {
|
|
454
|
+
border-top: var(--border-050) solid var(--color-table-divider);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.ds-table.ds-table--frameless .ds-table__body .ds-table__row:has(+ .ds-table__row--total) > .ds-table__cell {
|
|
458
|
+
--ds-table-line: transparent;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/* The last body row has no line under it: the table simply ends. */
|
|
462
|
+
.ds-table--frameless .ds-table__body:last-of-type .ds-table__row:last-child > * {
|
|
463
|
+
--ds-table-line: transparent;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/* A tint with no edge (stripe, selection) covers its own line. Striped,
|
|
467
|
+
hovered and selected share a weight, so the later one wins: selected
|
|
468
|
+
over hovered over striped. */
|
|
469
|
+
.ds-table.ds-table--frameless.ds-table--striped .ds-table__body .ds-table__row:nth-child(even) > * {
|
|
470
|
+
--ds-table-fill: var(--color-table-row-stripe-bg);
|
|
471
|
+
--ds-table-line: transparent;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/* The tile, on hover and on keyboard focus inside the row. */
|
|
475
|
+
.ds-table.ds-table--frameless .ds-table__body .ds-table__row:is(:hover, :has(:focus-visible)) > * {
|
|
476
|
+
--ds-table-fill: var(--ds-table-tile, var(--color-bg-container-primary));
|
|
477
|
+
--ds-table-edge: var(--color-table-divider);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.ds-table.ds-table--frameless .ds-table__body .ds-table__row.ds-table__row--selected > * {
|
|
481
|
+
--ds-table-fill: var(--color-table-row-selected-bg);
|
|
482
|
+
--ds-table-line: transparent;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/* The line above a selected row hides too. */
|
|
486
|
+
.ds-table.ds-table--frameless .ds-table__body .ds-table__row:has(+ .ds-table__row--selected) > * {
|
|
487
|
+
--ds-table-line: transparent;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/* Between two selected rows the line is a seam in the surface colour,
|
|
491
|
+
straight across the whole row: the selected tint and the divider are a
|
|
492
|
+
step apart at most, so a divider in its own colour would vanish and a
|
|
493
|
+
block of selected rows would read as one slab. Where they meet, their
|
|
494
|
+
corners square off, so the block is one rounded shape. */
|
|
495
|
+
.ds-table.ds-table--frameless .ds-table__body .ds-table__row.ds-table__row--selected:has(+ .ds-table__row--selected) > * {
|
|
496
|
+
--ds-table-line: var(--ds-table-surface, var(--ds-shell-surface, var(--color-bg-page-primary)));
|
|
497
|
+
--ds-table-line-size: 100%;
|
|
498
|
+
--ds-table-line-at: bottom;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.ds-table.ds-table--frameless .ds-table__body .ds-table__row.ds-table__row--selected:has(+ .ds-table__row--selected) > :first-child {
|
|
502
|
+
border-end-start-radius: 0;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.ds-table.ds-table--frameless .ds-table__body .ds-table__row.ds-table__row--selected:has(+ .ds-table__row--selected) > :last-child {
|
|
506
|
+
border-end-end-radius: 0;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.ds-table.ds-table--frameless .ds-table__body .ds-table__row.ds-table__row--selected + .ds-table__row--selected > :first-child {
|
|
510
|
+
border-start-start-radius: 0;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.ds-table.ds-table--frameless .ds-table__body .ds-table__row.ds-table__row--selected + .ds-table__row--selected > :last-child {
|
|
514
|
+
border-start-end-radius: 0;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/* ============================================
|
|
518
|
+
OUTER CONTROL (`outerControl`)
|
|
519
|
+
The first column is a 40px control column (a grip, a checkbox) that
|
|
520
|
+
takes the place of the start bleed: the scroll container reaches out by
|
|
521
|
+
its width instead, the control sits inside the tile's start, and the
|
|
522
|
+
next cell drops its bleed so the content still lines up with the page.
|
|
523
|
+
The control shows on hover, on keyboard focus, when checked, while any
|
|
524
|
+
row is selected, and always where there is no hover to reveal it.
|
|
525
|
+
40px is DataTable's utility column width (UTILITY_COLUMN_WIDTH).
|
|
526
|
+
============================================ */
|
|
527
|
+
|
|
528
|
+
.ds-table__scroll--outer-control {
|
|
529
|
+
margin-inline-start: -40px; /* ds-allow(spacing): the outer control column, DataTable's UTILITY_COLUMN_WIDTH */
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.ds-table--outer-control .ds-table__caption {
|
|
533
|
+
padding-inline-start: 40px; /* ds-allow(spacing): the outer control column */
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/* The control's cell starts the tile: corners and side edge, but no
|
|
537
|
+
bleed and no stretch of divider (a seam between selected rows still
|
|
538
|
+
crosses it). */
|
|
539
|
+
.ds-table.ds-table--outer-control .ds-table__row > :first-child {
|
|
540
|
+
--ds-table-line: transparent;
|
|
541
|
+
|
|
542
|
+
width: 40px; /* ds-allow(spacing): the outer control column */
|
|
543
|
+
padding-inline: 0;
|
|
544
|
+
text-align: center;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/* An auto-laid-out table squeezes a cell to its content's minimum, so the
|
|
548
|
+
column's width is held by its content too. */
|
|
549
|
+
.ds-table--outer-control .ds-table__row > :first-child > .ds-table__cell-content {
|
|
550
|
+
min-width: 40px; /* ds-allow(spacing): the outer control column */
|
|
551
|
+
justify-content: center;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.ds-table--outer-control .ds-table__row > :first-child > * {
|
|
555
|
+
opacity: 0;
|
|
556
|
+
transition: opacity var(--motion-duration-fast) var(--motion-ease-standard);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.ds-table--outer-control .ds-table__body .ds-table__row:is(:hover, :has(:focus-visible), .ds-table__row--selected) > :first-child > *,
|
|
560
|
+
.ds-table--outer-control .ds-table__row > :first-child:has(:focus-visible, :checked, [aria-checked="true"], [aria-checked="mixed"]) > *,
|
|
561
|
+
.ds-table--outer-control:is(:hover, [data-selecting], :has(.ds-table__body :is(:checked, [aria-checked="true"]))) .ds-table__head .ds-table__row > :first-child > *,
|
|
562
|
+
.ds-table--outer-control:is([data-selecting], :has(.ds-table__body :is(:checked, [aria-checked="true"]))) .ds-table__body .ds-table__row > :first-child > * {
|
|
563
|
+
opacity: 1;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
@media (hover: none) {
|
|
567
|
+
.ds-table--outer-control .ds-table__row > :first-child > * {
|
|
568
|
+
opacity: 1;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/* The cell after the control: no bleed, no corner, no side edge, and a
|
|
573
|
+
divider across its full width, starting at the content. */
|
|
574
|
+
.ds-table.ds-table--outer-control .ds-table__row > :first-child + * {
|
|
575
|
+
--ds-table-side: 0 0 transparent;
|
|
576
|
+
--ds-table-line-size: 100%;
|
|
577
|
+
--ds-table-line-at: bottom;
|
|
578
|
+
|
|
579
|
+
padding-inline-start: 0;
|
|
580
|
+
border-start-start-radius: 0;
|
|
581
|
+
border-end-start-radius: 0;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/* Forced colours drop shadows and fills, so the tile and the selection
|
|
585
|
+
are outlined in system colours instead. */
|
|
586
|
+
@media (forced-colors: active) {
|
|
587
|
+
.ds-table--frameless .ds-table__body .ds-table__row:is(:hover, :has(:focus-visible)) {
|
|
588
|
+
outline: var(--border-025) solid CanvasText;
|
|
589
|
+
outline-offset: calc(-1 * var(--border-025));
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.ds-table--frameless .ds-table__body .ds-table__row.ds-table__row--selected {
|
|
593
|
+
outline: var(--border-025) solid Highlight;
|
|
594
|
+
outline-offset: calc(-1 * var(--border-025));
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
289
599
|
} /* @layer rift.components */
|
|
@@ -38,11 +38,37 @@ type TableOwnProps = {
|
|
|
38
38
|
/**
|
|
39
39
|
* Adds an outer border + border-radius container, a tinted thead background,
|
|
40
40
|
* and `--color-divider` row lines — matching the bordered table style used on
|
|
41
|
-
* markdown content pages.
|
|
41
|
+
* markdown content pages. `frameless` wins when both are set.
|
|
42
42
|
*/
|
|
43
43
|
bordered?: boolean;
|
|
44
|
-
/** Draws a vertical line between columns, as well as the lines between rows. */
|
|
44
|
+
/** Draws a vertical line between columns, as well as the lines between rows. A frameless table draws none. */
|
|
45
45
|
columnDividers?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Draws the table with no frame: no outline, no header band and no column
|
|
48
|
+
* dividers, the first and last columns' content flush with the page, and
|
|
49
|
+
* a hovered row lifted into a raised tile that reaches past the columns.
|
|
50
|
+
* The page needs room for that reach on both sides (`--padding-400`).
|
|
51
|
+
* Wins over `bordered`. On a phone (a viewport under `BREAKPOINT_PHONE_PX`)
|
|
52
|
+
* it is drawn as the plain table, the outer control as an ordinary column.
|
|
53
|
+
*/
|
|
54
|
+
frameless?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Draws every mark in the cells (an Avatar, an AvatarGroup, an Icon tile,
|
|
57
|
+
* a PixelAvatar tile, a logo) as a true circle whatever the theme's radius,
|
|
58
|
+
* through the shared mark hook, `--ds-mark-radius`. A wide picture is not a
|
|
59
|
+
* mark and keeps its corners.
|
|
60
|
+
*/
|
|
61
|
+
roundMarks?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* With `frameless`, makes the first column the row's outer control: a
|
|
64
|
+
* 40px column, its content centred, that sits inside the tile's start and
|
|
65
|
+
* shows on hover, on keyboard focus, when checked, or while any row is
|
|
66
|
+
* checked. Put a drag grip or a checkbox in it. The page needs 40px of
|
|
67
|
+
* room on the table's start side for it. Leave at least one other column
|
|
68
|
+
* without a width: when every column has one, the browser stretches them
|
|
69
|
+
* all, the control's with them.
|
|
70
|
+
*/
|
|
71
|
+
outerControl?: boolean;
|
|
46
72
|
/** Accessible caption for the table */
|
|
47
73
|
caption?: string;
|
|
48
74
|
/** Whether to visually hide the caption (still available to screen readers) */
|
|
@@ -3,6 +3,7 @@ import React from "react";
|
|
|
3
3
|
import "./Table.css";
|
|
4
4
|
import { ScrollRegion } from "../../behaviors/ScrollRegion.js";
|
|
5
5
|
import "../../behaviors/visually-hidden.css";
|
|
6
|
+
import { warnOnce } from "../../behaviors/devWarning.js";
|
|
6
7
|
const Table = React.forwardRef(
|
|
7
8
|
({
|
|
8
9
|
columns,
|
|
@@ -11,21 +12,31 @@ const Table = React.forwardRef(
|
|
|
11
12
|
striped = false,
|
|
12
13
|
bordered = false,
|
|
13
14
|
columnDividers = false,
|
|
15
|
+
frameless = false,
|
|
16
|
+
roundMarks = false,
|
|
17
|
+
outerControl = false,
|
|
14
18
|
caption,
|
|
15
19
|
captionHidden = false,
|
|
16
20
|
className = "",
|
|
17
21
|
...rest
|
|
18
22
|
}, ref) => {
|
|
19
23
|
const baseClass = "ds-table";
|
|
24
|
+
if (frameless && bordered) warnOnce("Table: `frameless` and `bordered` both set; frameless wins.");
|
|
25
|
+
const framed = bordered && !frameless;
|
|
26
|
+
const outer = frameless && outerControl;
|
|
27
|
+
const alignOf = (col, index) => outer && index === 0 ? "center" : col.align;
|
|
20
28
|
const classes = [
|
|
21
29
|
baseClass,
|
|
22
30
|
`${baseClass}--${size}`,
|
|
23
31
|
striped ? `${baseClass}--striped` : "",
|
|
24
|
-
|
|
25
|
-
columnDividers ? `${baseClass}--column-dividers` : "",
|
|
32
|
+
framed ? `${baseClass}--bordered` : "",
|
|
33
|
+
columnDividers && !frameless ? `${baseClass}--column-dividers` : "",
|
|
34
|
+
frameless ? `${baseClass}--frameless` : "",
|
|
35
|
+
outer ? `${baseClass}--outer-control` : "",
|
|
36
|
+
roundMarks ? `${baseClass}--round-marks` : "",
|
|
26
37
|
className
|
|
27
38
|
].filter(Boolean).join(" ");
|
|
28
|
-
const outsideCaption =
|
|
39
|
+
const outsideCaption = framed && caption && !captionHidden;
|
|
29
40
|
const table = /* @__PURE__ */ jsxs("table", { ...rest, ref, className: classes, children: [
|
|
30
41
|
caption && /* @__PURE__ */ jsx(
|
|
31
42
|
"caption",
|
|
@@ -34,7 +45,7 @@ const Table = React.forwardRef(
|
|
|
34
45
|
children: caption
|
|
35
46
|
}
|
|
36
47
|
),
|
|
37
|
-
/* @__PURE__ */ jsx("thead", { className: `${baseClass}__head`, children: /* @__PURE__ */ jsx("tr", { className: `${baseClass}__row ${baseClass}__row--header`, children: columns.map((col) => /* @__PURE__ */ jsx(
|
|
48
|
+
/* @__PURE__ */ jsx("thead", { className: `${baseClass}__head`, children: /* @__PURE__ */ jsx("tr", { className: `${baseClass}__row ${baseClass}__row--header`, children: columns.map((col, index) => /* @__PURE__ */ jsx(
|
|
38
49
|
"th",
|
|
39
50
|
{
|
|
40
51
|
className: `${baseClass}__header-cell`,
|
|
@@ -42,7 +53,7 @@ const Table = React.forwardRef(
|
|
|
42
53
|
"aria-sort": col.sort === "asc" ? "ascending" : col.sort === "desc" ? "descending" : void 0,
|
|
43
54
|
style: {
|
|
44
55
|
width: col.width,
|
|
45
|
-
textAlign: col
|
|
56
|
+
textAlign: alignOf(col, index) || "start"
|
|
46
57
|
},
|
|
47
58
|
children: col.header || /* @__PURE__ */ jsx("span", { className: "ds-visually-hidden", children: col.key })
|
|
48
59
|
},
|
|
@@ -56,7 +67,8 @@ const Table = React.forwardRef(
|
|
|
56
67
|
row.selected ? `${baseClass}__row--selected` : "",
|
|
57
68
|
row.variant && row.variant !== "default" ? `${baseClass}__row--${row.variant}` : ""
|
|
58
69
|
].filter(Boolean).join(" "),
|
|
59
|
-
children: columns.map((col) => {
|
|
70
|
+
children: columns.map((col, index) => {
|
|
71
|
+
const align = alignOf(col, index);
|
|
60
72
|
const content = /* @__PURE__ */ jsx(
|
|
61
73
|
"div",
|
|
62
74
|
{
|
|
@@ -64,7 +76,7 @@ const Table = React.forwardRef(
|
|
|
64
76
|
style: {
|
|
65
77
|
// flex-start and flex-end follow the reading direction;
|
|
66
78
|
// left and right stay on their screen side.
|
|
67
|
-
justifyContent:
|
|
79
|
+
justifyContent: align === "center" ? "center" : align === "end" ? "flex-end" : align === "left" || align === "right" ? align : "flex-start"
|
|
68
80
|
},
|
|
69
81
|
children: row.cells[col.key]
|
|
70
82
|
}
|
|
@@ -75,7 +87,7 @@ const Table = React.forwardRef(
|
|
|
75
87
|
row.id
|
|
76
88
|
)) })
|
|
77
89
|
] });
|
|
78
|
-
if (
|
|
90
|
+
if (framed) {
|
|
79
91
|
const region = /* @__PURE__ */ jsx(ScrollRegion, { className: `${baseClass}__wrapper`, children: table });
|
|
80
92
|
if (!outsideCaption) return region;
|
|
81
93
|
return /* @__PURE__ */ jsxs("div", { className: `${baseClass}__frame`, children: [
|
|
@@ -83,7 +95,12 @@ const Table = React.forwardRef(
|
|
|
83
95
|
region
|
|
84
96
|
] });
|
|
85
97
|
}
|
|
86
|
-
|
|
98
|
+
const scrollClasses = [
|
|
99
|
+
`${baseClass}__scroll`,
|
|
100
|
+
frameless ? `${baseClass}__scroll--frameless` : "",
|
|
101
|
+
outer ? `${baseClass}__scroll--outer-control` : ""
|
|
102
|
+
].filter(Boolean).join(" ");
|
|
103
|
+
return /* @__PURE__ */ jsx(ScrollRegion, { className: scrollClasses, children: table });
|
|
87
104
|
}
|
|
88
105
|
);
|
|
89
106
|
Table.displayName = "Table";
|
package/components/registry.json
CHANGED
|
@@ -1791,7 +1791,7 @@
|
|
|
1791
1791
|
"name": "Table",
|
|
1792
1792
|
"label": "Table",
|
|
1793
1793
|
"slug": "table",
|
|
1794
|
-
"description": "Data table with flexible cell content, striped rows, compact sizing, code columns, and support for icons, inputs and controls.",
|
|
1794
|
+
"description": "Data table with flexible cell content, striped rows, a frameless look, compact sizing, code columns, and support for icons, inputs and controls.",
|
|
1795
1795
|
"category": "data-display",
|
|
1796
1796
|
"client": false,
|
|
1797
1797
|
"keys": { "by": "none" },
|
|
@@ -1791,7 +1791,7 @@ declare const _default: {
|
|
|
1791
1791
|
"name": "Table",
|
|
1792
1792
|
"label": "Table",
|
|
1793
1793
|
"slug": "table",
|
|
1794
|
-
"description": "Data table with flexible cell content, striped rows, compact sizing, code columns, and support for icons, inputs and controls.",
|
|
1794
|
+
"description": "Data table with flexible cell content, striped rows, a frameless look, compact sizing, code columns, and support for icons, inputs and controls.",
|
|
1795
1795
|
"category": "data-display",
|
|
1796
1796
|
"client": false,
|
|
1797
1797
|
"keys": { "by": "none" },
|