@nyt87/ui 0.3.0 → 0.3.1
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 +38 -3
- package/package.json +2 -5
package/dist/styles.css
CHANGED
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
|
|
22
22
|
/* ---------- Icons (the sprite and helper come from @nyt87/icons) ---------- */
|
|
23
23
|
.ds-icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.25em; }
|
|
24
|
+
/* The browser hides [hidden] HTML elements only, not SVG ones, so a button that swaps two icons needs this. */
|
|
25
|
+
.ds-icon[hidden] { display: none; }
|
|
24
26
|
.ds-icon--sm { width: 1rem; height: 1rem; }
|
|
25
27
|
.ds-icon--lg { width: 1.5rem; height: 1.5rem; }
|
|
26
28
|
.ds-icon--xl { width: 2rem; height: 2rem; }
|
|
@@ -55,7 +57,17 @@
|
|
|
55
57
|
.ds-btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 88%, var(--fg)); }
|
|
56
58
|
.ds-btn--danger-outline { background: transparent; color: var(--danger); border-color: currentColor; }
|
|
57
59
|
.ds-btn--danger-outline:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 10%, transparent); }
|
|
58
|
-
|
|
60
|
+
/* Link: a text action in a sentence or a table row ("Edit", "Copy"), in the link colour. Quiet danger is a destructive
|
|
61
|
+
row action that reads as text until pointed at or focused ("Remove"); its confirmation dialog carries the red.
|
|
62
|
+
Inline drops the button's height and padding, to sit inside a line of text. */
|
|
63
|
+
.ds-btn--link, .ds-btn--quiet-danger { background: none; padding-inline: var(--space-1); font-weight: 500; }
|
|
64
|
+
.ds-btn--link { color: var(--link); }
|
|
65
|
+
.ds-btn--link:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 0.2em; }
|
|
66
|
+
.ds-btn--quiet-danger { color: var(--fg-muted); }
|
|
67
|
+
.ds-btn--quiet-danger:hover:not(:disabled), .ds-btn--quiet-danger:focus-visible { color: var(--danger); }
|
|
68
|
+
.ds-btn--inline { min-height: 0; padding: 0; font-size: inherit; vertical-align: baseline; }
|
|
69
|
+
/* aria-disabled: looks disabled but still takes the click, so it can say why it can't act */
|
|
70
|
+
.ds-btn:disabled, .ds-btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; }
|
|
59
71
|
.ds-btn[aria-busy='true'] { cursor: progress; opacity: 0.8; }
|
|
60
72
|
|
|
61
73
|
/* ---------- Field + controls ---------- */
|
|
@@ -149,7 +161,9 @@
|
|
|
149
161
|
.ds-tabs__list { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); overflow-x: auto; }
|
|
150
162
|
.ds-tabs__tab { font: inherit; font-size: var(--text-sm); font-weight: 600; color: var(--fg-muted); background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: var(--space-3) var(--space-4); min-height: 2.5rem; cursor: pointer; white-space: nowrap; }
|
|
151
163
|
.ds-tabs__tab:hover { color: var(--fg); }
|
|
152
|
-
.ds-tabs__tab[aria-selected='true'] { color: var(--accent-ink); border-bottom-color: var(--accent); }
|
|
164
|
+
.ds-tabs__tab[aria-selected='true'], .ds-tabs__tab[aria-current='page'] { color: var(--accent-ink); border-bottom-color: var(--accent); }
|
|
165
|
+
/* Tabs that go to pages: links with aria-current="page", in a <nav> (no tabs.js) */
|
|
166
|
+
a.ds-tabs__tab { display: inline-flex; align-items: center; text-decoration: none; }
|
|
153
167
|
.ds-tabs__panel { padding: var(--space-4) 0; }
|
|
154
168
|
|
|
155
169
|
/* ---------- Table ---------- */
|
|
@@ -160,6 +174,20 @@
|
|
|
160
174
|
.ds-table tbody tr:last-child > * { border-bottom: 0; }
|
|
161
175
|
.ds-table tbody tr:hover { background: var(--bg-sunken); }
|
|
162
176
|
.ds-table .ds-num { text-align: right; font-variant-numeric: tabular-nums; }
|
|
177
|
+
/* Wrap: cells wrap and sit at the top, for tables of sentences rather than figures */
|
|
178
|
+
.ds-table--wrap th, .ds-table--wrap td { white-space: normal; vertical-align: top; }
|
|
179
|
+
/* Stack: on a phone each row becomes a block of "label: value" lines, so no column is squeezed or scrolled sideways.
|
|
180
|
+
Give each cell data-label (its column's name); the header row stays for screen readers only. */
|
|
181
|
+
@media (max-width: 40rem) {
|
|
182
|
+
.ds-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
183
|
+
.ds-table--stack, .ds-table--stack tbody, .ds-table--stack tr, .ds-table--stack :is(td, th) { display: block; width: 100%; }
|
|
184
|
+
.ds-table--stack tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
|
|
185
|
+
.ds-table--stack tbody tr:last-child { border-bottom: 0; }
|
|
186
|
+
.ds-table.ds-table--stack :is(td, th) { border: 0; padding: var(--space-1) 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
|
|
187
|
+
.ds-table--stack [data-label] { position: relative; }
|
|
188
|
+
.ds-table.ds-table--stack [data-label] { padding-left: 8rem; }
|
|
189
|
+
.ds-table--stack [data-label]::before { content: attr(data-label); position: absolute; left: 0; top: var(--space-1); width: 7.5rem; font-size: var(--text-xs); font-weight: 600; color: var(--fg-muted); }
|
|
190
|
+
}
|
|
163
191
|
.ds-table__caption { text-align: left; padding: var(--space-3) var(--space-4); font-weight: 700; }
|
|
164
192
|
|
|
165
193
|
/* ---------- Stat ---------- */
|
|
@@ -194,7 +222,7 @@
|
|
|
194
222
|
|
|
195
223
|
/* ---------- Layout helpers ---------- */
|
|
196
224
|
/* --max-width is the width of the content itself; the page gutter sits outside it, so content lines up with page sections. */
|
|
197
|
-
.ds-container { width: 100%; max-width: calc(var(--max-width) + var(--page-gutter) * 2); margin-inline: auto; padding-
|
|
225
|
+
.ds-container { width: 100%; max-width: calc(var(--max-width) + var(--page-gutter) * 2); margin-inline: auto; padding-left: max(var(--page-gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--page-gutter), env(safe-area-inset-right, 0px)); box-sizing: border-box; }
|
|
198
226
|
.ds-skip { position: absolute; left: var(--space-3); top: -5rem; z-index: 100; padding: var(--space-2) var(--space-4); background: var(--bg-raised); color: var(--fg); border: 2px solid var(--ring); border-radius: var(--radius-md); font-weight: 600; text-decoration: none; }
|
|
199
227
|
.ds-skip:focus { top: var(--space-3); }
|
|
200
228
|
|
|
@@ -471,3 +499,10 @@ button.ds-swatch:focus-visible .ds-swatch__dot { outline: 2px solid var(--ring);
|
|
|
471
499
|
.ds-tip:hover .ds-tip__text, .ds-tip:focus-within .ds-tip__text { visibility: visible; opacity: 1; }
|
|
472
500
|
.ds-tip--below .ds-tip__text { bottom: auto; top: calc(100% + 6px); }
|
|
473
501
|
@media (prefers-reduced-motion: reduce) { .ds-tip__text { transition: none; } }
|
|
502
|
+
|
|
503
|
+
/* Touch: where the pointer is a finger, controls are at least 44px (--tap-min) tall; ds-btn--lg already is */
|
|
504
|
+
@media (pointer: coarse) {
|
|
505
|
+
.ds-btn--sm, .ds-btn--md, .ds-control, .ds-tabs__tab { min-height: var(--tap-min); }
|
|
506
|
+
.ds-btn--icon-only.ds-btn--sm, .ds-btn--icon-only.ds-btn--md { width: var(--tap-min); }
|
|
507
|
+
.ds-btn--inline { min-height: 0; }
|
|
508
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyt87/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Framework-free UI components for nyt87 products: HTML + CSS, with small vanilla behaviours for the interactive parts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,9 +9,6 @@
|
|
|
9
9
|
"url": "git+https://github.com/NYT87/design-system.git",
|
|
10
10
|
"directory": "packages/ui"
|
|
11
11
|
},
|
|
12
|
-
"publishConfig": {
|
|
13
|
-
"registry": "https://npm.pkg.github.com"
|
|
14
|
-
},
|
|
15
12
|
"main": "./dist/index.js",
|
|
16
13
|
"types": "./dist/index.d.ts",
|
|
17
14
|
"exports": {
|
|
@@ -49,7 +46,7 @@
|
|
|
49
46
|
"dist"
|
|
50
47
|
],
|
|
51
48
|
"dependencies": {
|
|
52
|
-
"@nyt87/tokens": ">=0.1.
|
|
49
|
+
"@nyt87/tokens": ">=0.1.5"
|
|
53
50
|
},
|
|
54
51
|
"scripts": {
|
|
55
52
|
"build": "tsup && cp src/styles.css dist/styles.css",
|