@nyt87/ui 0.3.1 → 0.3.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/dist/styles.css +88 -2
- package/package.json +1 -1
package/dist/styles.css
CHANGED
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
.ds-btn--icon-only.ds-btn--sm { width: 2rem; padding: 0; }
|
|
47
47
|
.ds-btn--icon-only.ds-btn--md { width: 2.5rem; padding: 0; }
|
|
48
48
|
.ds-btn--icon-only.ds-btn--lg { width: var(--tap-min); padding: 0; }
|
|
49
|
+
/* Block: the full width of its container, for the one main action at the foot of a phone screen or a sheet */
|
|
50
|
+
.ds-btn--block { display: flex; width: 100%; }
|
|
49
51
|
|
|
50
52
|
.ds-btn--primary { background: var(--accent); color: var(--on-accent); }
|
|
51
53
|
.ds-btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, var(--fg)); }
|
|
@@ -113,6 +115,17 @@
|
|
|
113
115
|
.ds-seg--sm .ds-seg__item span { min-height: 1.6rem; padding: 0 var(--space-2); font-size: var(--text-xs); }
|
|
114
116
|
.ds-seg__item:hover span { color: var(--fg); }
|
|
115
117
|
.ds-seg__item input:checked + span { background: var(--bg-raised); color: var(--fg); box-shadow: var(--shadow-sm); }
|
|
118
|
+
/* Or <button aria-pressed> items, when a choice acts at once (a filter): the button is the item, its text the label. */
|
|
119
|
+
button.ds-seg__item { align-items: center; justify-content: center; min-height: 2rem; padding: 0 var(--space-3); font: inherit; font-size: var(--text-sm); font-weight: 600; color: var(--fg-muted); background: none; border: 0; }
|
|
120
|
+
button.ds-seg__item:hover { color: var(--fg); }
|
|
121
|
+
button.ds-seg__item[aria-pressed='true'] { background: var(--bg-raised); color: var(--fg); box-shadow: var(--shadow-sm); }
|
|
122
|
+
button.ds-seg__item:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
|
|
123
|
+
/* Block: the full width, the items sharing it. Grid: rows of --ds-seg-cols (3) items, for longer sets. */
|
|
124
|
+
.ds-seg--block { display: flex; width: 100%; }
|
|
125
|
+
.ds-seg--block .ds-seg__item { flex: 1; }
|
|
126
|
+
.ds-seg--block label.ds-seg__item > span { flex: 1; justify-content: center; }
|
|
127
|
+
.ds-seg--grid { display: grid; grid-template-columns: repeat(var(--ds-seg-cols, 3), minmax(0, 1fr)); width: 100%; }
|
|
128
|
+
.ds-seg--grid label.ds-seg__item > span { flex: 1; justify-content: center; }
|
|
116
129
|
|
|
117
130
|
/* ---------- Card ---------- */
|
|
118
131
|
.ds-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); }
|
|
@@ -340,6 +353,11 @@ a.ds-tabs__tab { display: inline-flex; align-items: center; text-decoration: non
|
|
|
340
353
|
.ds-sheet.ds-sheet--bottom { margin: auto 0 0; width: 100vw; height: fit-content; max-height: 85dvh; }
|
|
341
354
|
.ds-sheet.ds-sheet--bottom .ds-modal__panel { height: auto; max-height: 85dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-width: 1px 0 0; padding-bottom: env(safe-area-inset-bottom); }
|
|
342
355
|
.ds-sheet--bottom[open] .ds-modal__panel { animation: ds-sheet-up var(--duration-base) var(--ease); }
|
|
356
|
+
/* Adaptive: a bottom sheet on a phone, a centred dialog of at most 45rem where the screen is wide */
|
|
357
|
+
@media (min-width: 64rem) {
|
|
358
|
+
.ds-sheet--adaptive.ds-sheet--bottom { margin: auto; width: min(45rem, 100vw - 2rem); }
|
|
359
|
+
.ds-sheet--adaptive.ds-sheet--bottom .ds-modal__panel { border-radius: var(--radius-lg); border-width: 1px; padding-bottom: 0; }
|
|
360
|
+
}
|
|
343
361
|
@keyframes ds-sheet-up { from { transform: translateY(100%); } }
|
|
344
362
|
@media (prefers-reduced-motion: reduce) { .ds-sheet--bottom[open] .ds-modal__panel { animation: none; } }
|
|
345
363
|
|
|
@@ -364,6 +382,11 @@ a.ds-tabs__tab { display: inline-flex; align-items: center; text-decoration: non
|
|
|
364
382
|
.ds-chip__action:hover { background: var(--bg-sunken); color: var(--fg); }
|
|
365
383
|
.ds-chip--pending { border-style: dashed; }
|
|
366
384
|
.ds-chip--pending .ds-chip__label { color: var(--fg-muted); }
|
|
385
|
+
/* A chip that is itself a button: one that acts (a suggested time), or a toggle with aria-pressed (a pick of several). */
|
|
386
|
+
button.ds-chip { font: inherit; font-size: var(--text-sm); cursor: pointer; padding-right: var(--space-3); }
|
|
387
|
+
button.ds-chip:hover { background: var(--bg-sunken); }
|
|
388
|
+
button.ds-chip:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
|
|
389
|
+
button.ds-chip[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-raised)); font-weight: 600; }
|
|
367
390
|
|
|
368
391
|
/* List rows: a lead (dot or icon), a title with a meta line, and a trailing action or chevron. */
|
|
369
392
|
.ds-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
|
|
@@ -378,12 +401,35 @@ a.ds-tabs__tab { display: inline-flex; align-items: center; text-decoration: non
|
|
|
378
401
|
.ds-list__title { font-weight: 600; overflow-wrap: anywhere; }
|
|
379
402
|
.ds-list__meta { color: var(--fg-muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
|
|
380
403
|
.ds-list__trail { flex: none; display: inline-flex; align-items: center; gap: var(--space-1); color: var(--fg-muted); font-size: var(--text-sm); }
|
|
404
|
+
/* Cards: each row its own bordered card, for lists of things that each carry a state. A tone colours the border
|
|
405
|
+
(1.5px), so the state reads without a badge: ok, warn or danger. */
|
|
406
|
+
.ds-list--cards { display: grid; gap: var(--space-2); border-top: 0; }
|
|
407
|
+
.ds-list--cards .ds-list__item { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-md); padding-inline: var(--space-3); }
|
|
408
|
+
.ds-list--cards .ds-list__item:has(> .ds-list__link) { padding: 0; }
|
|
409
|
+
.ds-list--cards .ds-list__link { padding: var(--space-2) var(--space-3); }
|
|
410
|
+
.ds-list__item--ok, .ds-list__item--warn, .ds-list__item--danger { border-width: 1.5px; }
|
|
411
|
+
.ds-list--cards .ds-list__item--ok { border-color: var(--ok); }
|
|
412
|
+
.ds-list--cards .ds-list__item--warn { border-color: var(--warn); }
|
|
413
|
+
.ds-list--cards .ds-list__item--danger { border-color: var(--danger); }
|
|
414
|
+
/* A row that acts rather than goes somewhere (pick a workspace): a button as the link, the current one aria-current. */
|
|
415
|
+
button.ds-list__link { width: 100%; margin: 0; font: inherit; color: inherit; text-align: left; background: none; border: 0; cursor: pointer; }
|
|
416
|
+
button.ds-list__link:disabled { cursor: default; opacity: 0.6; }
|
|
417
|
+
.ds-list__link:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
|
|
418
|
+
.ds-list--cards .ds-list__item:has(> .ds-list__link[aria-current='true']) { border-color: var(--accent); }
|
|
381
419
|
|
|
382
420
|
/* Tab bar: the bottom navigation of a phone app. The app decides where it sits (usually fixed to the bottom). */
|
|
383
421
|
.ds-tabbar { display: flex; background: var(--bg-raised); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
|
|
384
422
|
.ds-tabbar__item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; min-height: 3.5rem; padding: var(--space-1); color: var(--fg-muted); font-size: var(--text-xs); font-weight: 600; text-decoration: none; }
|
|
385
423
|
.ds-tabbar__item .ds-icon { width: 1.5rem; height: 1.5rem; }
|
|
386
424
|
.ds-tabbar__item[aria-current='page'] { color: var(--accent-ink); }
|
|
425
|
+
/* An item's icon with a count on its corner (wrap the icon and a .ds-count in .ds-tabbar__icon) */
|
|
426
|
+
.ds-tabbar__icon { position: relative; display: inline-flex; }
|
|
427
|
+
|
|
428
|
+
/* Count: a small number on an icon (waiting items, unread comments). Put the number in the item's label too: the
|
|
429
|
+
bubble is aria-hidden. Inside a positioned parent (.ds-tabbar__icon, a ds-btn) it sits on the top-right corner. */
|
|
430
|
+
.ds-count { display: inline-block; min-width: 1.125rem; height: 1.125rem; padding: 0 0.3rem; border-radius: var(--radius-full); background: var(--warn); color: var(--on-status); font-size: 0.75rem; font-weight: 700; line-height: 1.125rem; text-align: center; font-variant-numeric: tabular-nums; box-sizing: border-box; }
|
|
431
|
+
.ds-tabbar__icon .ds-count, .ds-btn .ds-count { position: absolute; top: -0.35rem; right: -0.6rem; }
|
|
432
|
+
.ds-btn:has(> .ds-count) { position: relative; }
|
|
387
433
|
|
|
388
434
|
/* Search field: a text input with a search icon, and a clear button once it has text. */
|
|
389
435
|
.ds-search { position: relative; display: flex; align-items: center; }
|
|
@@ -414,6 +460,46 @@ a.ds-tabs__tab { display: inline-flex; align-items: center; text-decoration: non
|
|
|
414
460
|
/* A <dd>: the only valid child of a row besides <dt>. Two classes, to beat ".ds-details dd". */
|
|
415
461
|
.ds-details .ds-details__action { grid-column: 2; grid-row: 1 / span 2; }
|
|
416
462
|
|
|
463
|
+
/* Disclosure: a <details> that opens in place (recent activity, an item's technical key); the summary is the label. */
|
|
464
|
+
.ds-disclosure { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-md); }
|
|
465
|
+
.ds-disclosure > summary { display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); padding: 0 var(--space-3); font-weight: 600; cursor: pointer; list-style: none; border-radius: inherit; }
|
|
466
|
+
.ds-disclosure > summary::-webkit-details-marker { display: none; }
|
|
467
|
+
.ds-disclosure > summary::before { content: ''; flex: none; width: 0.45rem; height: 0.45rem; border: solid var(--fg-muted); border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform var(--duration-fast) var(--ease); }
|
|
468
|
+
.ds-disclosure[open] > summary::before { transform: rotate(45deg); }
|
|
469
|
+
.ds-disclosure > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
|
|
470
|
+
.ds-disclosure__body { padding: 0 var(--space-3) var(--space-3); }
|
|
471
|
+
/* Plain: no frame, for a disclosure in the page's flow whose content brings its own cards */
|
|
472
|
+
.ds-disclosure--plain { background: none; border: 0; }
|
|
473
|
+
.ds-disclosure--plain > summary, .ds-disclosure--plain > .ds-disclosure__body { padding-inline: 0; }
|
|
474
|
+
@media (prefers-reduced-motion: reduce) { .ds-disclosure > summary::before { transition: none; } }
|
|
475
|
+
|
|
476
|
+
/* Action bar: the screen's main action, fixed to the bottom of a phone screen above the safe area. Leave room under
|
|
477
|
+
the content for it (padding-bottom on the page). */
|
|
478
|
+
.ds-actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom)); background: var(--bg-raised); border-top: 1px solid var(--border); }
|
|
479
|
+
|
|
480
|
+
/* Title bar: the top of a phone app's screen. A leading slot (the brand, a back link), the title centred with a line
|
|
481
|
+
under it (or a button that opens a picker), and trailing icon buttons. The app decides where it sits (usually sticky). */
|
|
482
|
+
.ds-titlebar { display: grid; grid-template-columns: 1fr minmax(0, auto) 1fr; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--bg); border-bottom: 1px solid var(--border); }
|
|
483
|
+
.ds-titlebar__lead { justify-self: start; display: flex; align-items: center; min-height: var(--tap-min); }
|
|
484
|
+
.ds-titlebar__main { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
|
|
485
|
+
.ds-titlebar__title { display: flex; align-items: center; justify-content: center; gap: 0.375rem; max-width: 100%; min-width: 0; margin: 0; font-size: 1.0625rem; font-weight: 700; line-height: var(--leading-tight); }
|
|
486
|
+
.ds-titlebar__sub { display: inline-flex; align-items: center; gap: 0.125rem; max-width: 100%; color: var(--fg-muted); font-size: 0.8125rem; line-height: 1.3; }
|
|
487
|
+
/* the line under the title as a button: short, so its tap target reaches the bar's 44px */
|
|
488
|
+
button.ds-titlebar__sub { position: relative; padding: 0 0.125rem; font-family: inherit; background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
|
|
489
|
+
button.ds-titlebar__sub::after { content: ''; position: absolute; inset: -0.875rem -0.625rem -0.375rem; }
|
|
490
|
+
button.ds-titlebar__sub:hover { color: var(--fg); }
|
|
491
|
+
button.ds-titlebar__sub:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
|
|
492
|
+
.ds-titlebar__trail { justify-self: end; display: flex; align-items: center; gap: 0.125rem; }
|
|
493
|
+
.ds-titlebar__trail .ds-btn[aria-current='page'] { color: var(--accent-ink); }
|
|
494
|
+
|
|
495
|
+
/* Inline confirmation: the question that takes a button's place before it acts ("Refuse this draft?"), with Cancel and
|
|
496
|
+
the action repeating the verb. Danger by default; --go for an action that is safe but can't be taken back. */
|
|
497
|
+
.ds-confirm { padding: var(--space-3); border: 1px solid var(--danger); border-radius: var(--radius-md); background: color-mix(in srgb, var(--danger) 6%, var(--bg-raised)); }
|
|
498
|
+
.ds-confirm--go { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--bg-raised)); }
|
|
499
|
+
.ds-confirm__text { margin: 0 0 var(--space-2); font-size: var(--text-sm); line-height: var(--leading-normal); }
|
|
500
|
+
.ds-confirm__actions { display: flex; gap: var(--space-2); }
|
|
501
|
+
.ds-confirm__actions > * { flex: 1; }
|
|
502
|
+
|
|
417
503
|
/* Colour swatches: a choice of colours as radio buttons. Each swatch sets --ds-swatch. */
|
|
418
504
|
.ds-swatches { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0; padding: 0; border: 0; }
|
|
419
505
|
.ds-swatch { position: relative; display: inline-flex; align-items: center; justify-content: center; width: var(--tap-min); height: var(--tap-min); cursor: pointer; }
|
|
@@ -431,7 +517,7 @@ button.ds-swatch:focus-visible .ds-swatch__dot { outline: 2px solid var(--ring);
|
|
|
431
517
|
|
|
432
518
|
/* App shell: sidebar + top bar + main. Below 860px the sidebar becomes a drawer opened by .ds-app__toggle (needs @nyt87/ui/menu). */
|
|
433
519
|
.ds-app { --app-sidebar: 15rem; display: grid; grid-template-columns: var(--app-sidebar) minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: 'side bar' 'side main'; min-height: var(--app-height, 100dvh); background: var(--bg); color: var(--fg); }
|
|
434
|
-
.ds-app__sidebar { grid-area: side; display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4) var(--space-3); background: var(--bg-raised); border-right: 1px solid var(--border); position: sticky; top: 0; height: var(--app-height, 100dvh); overflow-y: auto; }
|
|
520
|
+
.ds-app__sidebar { grid-area: side; display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4) var(--space-3); background: var(--bg-raised); border-right: 1px solid var(--border); position: sticky; top: 0; height: var(--app-height, 100dvh); overflow-y: auto; box-sizing: border-box; }
|
|
435
521
|
.ds-app__bar { grid-area: bar; display: flex; align-items: center; gap: var(--space-3); min-height: var(--nav-height); padding: 0 var(--space-5); border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 20; }
|
|
436
522
|
.ds-app__title { margin: 0; font-size: var(--text-lg); font-weight: 700; }
|
|
437
523
|
.ds-app__bar-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
|
|
@@ -502,7 +588,7 @@ button.ds-swatch:focus-visible .ds-swatch__dot { outline: 2px solid var(--ring);
|
|
|
502
588
|
|
|
503
589
|
/* Touch: where the pointer is a finger, controls are at least 44px (--tap-min) tall; ds-btn--lg already is */
|
|
504
590
|
@media (pointer: coarse) {
|
|
505
|
-
.ds-btn--sm, .ds-btn--md, .ds-control, .ds-tabs__tab { min-height: var(--tap-min); }
|
|
591
|
+
.ds-btn--sm, .ds-btn--md, .ds-control, .ds-tabs__tab, .ds-seg__item span, button.ds-seg__item { min-height: var(--tap-min); }
|
|
506
592
|
.ds-btn--icon-only.ds-btn--sm, .ds-btn--icon-only.ds-btn--md { width: var(--tap-min); }
|
|
507
593
|
.ds-btn--inline { min-height: 0; }
|
|
508
594
|
}
|
package/package.json
CHANGED