@nyt87/ui 0.2.3 → 0.2.5
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 +132 -3
- package/package.json +2 -2
package/dist/styles.css
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/* @nyt87/ui styles. Requires @nyt87/tokens/tokens.css. Only tokens are used for colour, size, radius and motion. */
|
|
2
2
|
|
|
3
|
+
/* Korean breaks between words, not inside them; a word longer than the line may still wrap. */
|
|
4
|
+
:where(:lang(ko)) { word-break: keep-all; overflow-wrap: anywhere; }
|
|
5
|
+
|
|
3
6
|
.ds-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
|
|
4
7
|
|
|
5
8
|
/* One focus style for everything interactive. */
|
|
6
|
-
:where(.ds-btn, .ds-nav__link, .ds-table__sort, .ds-pager__item, .ds-control, .ds-code__copy, .ds-tabs__tab, .ds-tabs__panel, .ds-table-wrap, .ds-code pre):focus-visible,
|
|
9
|
+
:where(.ds-btn, .ds-nav__link, .ds-table__sort, .ds-pager__item, .ds-control, .ds-code__copy, .ds-tabs__tab, .ds-tabs__panel, .ds-table-wrap, .ds-code pre, .ds-chip__action, .ds-list__link, .ds-tabbar__item, .ds-search__clear):focus-visible,
|
|
7
10
|
.ds-choice:has(input:focus-visible) .ds-choice__box,
|
|
8
11
|
.ds-choice:has(input:focus-visible) .ds-switch,
|
|
9
12
|
.ds-seg__item:has(input:focus-visible) {
|
|
@@ -180,10 +183,12 @@
|
|
|
180
183
|
.ds-code pre { margin: 0; padding: var(--space-3); overflow-x: auto; font-family: var(--font-mono); font-size: var(--text-sm); line-height: var(--leading-normal); }
|
|
181
184
|
|
|
182
185
|
/* ---------- Brand typography: headings and buttons use the heading face ---------- */
|
|
183
|
-
.ds-btn, .ds-card__title, .ds-modal__title, .ds-empty__title, .ds-alert__title, .ds-tabs__tab, .ds-stat__num, .ds-brand, .ds-footer__heading
|
|
186
|
+
.ds-btn, .ds-card__title, .ds-modal__title, .ds-empty__title, .ds-alert__title, .ds-tabs__tab, .ds-stat__num, .ds-brand, .ds-footer__heading,
|
|
187
|
+
.ds-hero__title, .ds-section__title, .ds-features__title, .ds-steps__title, .ds-prose > :is(h1, h2, h3) {
|
|
184
188
|
font-family: var(--font-heading);
|
|
185
189
|
}
|
|
186
|
-
.ds-card__title, .ds-modal__title, .ds-empty__title
|
|
190
|
+
.ds-card__title, .ds-modal__title, .ds-empty__title,
|
|
191
|
+
.ds-hero__title, .ds-section__title, .ds-features__title, .ds-steps__title, .ds-prose > :is(h1, h2, h3) { font-weight: var(--weight-heading); letter-spacing: var(--tracking-heading); }
|
|
187
192
|
|
|
188
193
|
/* ---------- Layout helpers ---------- */
|
|
189
194
|
/* --max-width is the width of the content itself; the page gutter sits outside it, so content lines up with page sections. */
|
|
@@ -245,6 +250,130 @@
|
|
|
245
250
|
/* Hold the footer's text size and colour even when the host page styles bare <p> elements. */
|
|
246
251
|
.ds-footer__tagline, .ds-footer__credit, .ds-footer__note { font-size: var(--text-sm); color: inherit; }
|
|
247
252
|
.ds-footer__heart { color: var(--accent-ink); }
|
|
253
|
+
/* A footer of notes only: the bottom part alone, without a second dividing line under the footer's own. */
|
|
254
|
+
.ds-footer__bottom:first-child { border-top: 0; padding-top: var(--space-6); }
|
|
255
|
+
|
|
256
|
+
/* ---------- Product site sections: hero, section, features, steps, prose ---------- */
|
|
257
|
+
/* Hold margins and sizes even when the host page styles bare headings, <p> and lists. */
|
|
258
|
+
.ds-hero { display: grid; gap: var(--space-5); padding-block: var(--space-7) var(--space-8); }
|
|
259
|
+
.ds-hero__art { display: block; width: 100%; height: auto; border-radius: var(--radius-lg); object-fit: cover; }
|
|
260
|
+
.ds-hero__title { margin: 0; font-size: clamp(var(--text-3xl), 6vw, calc(var(--text-4xl) * 1.5)); line-height: var(--leading-tight); }
|
|
261
|
+
.ds-hero__lead { margin: 0; max-width: 36em; color: var(--fg-muted); font-size: var(--text-lg); line-height: var(--leading-normal); }
|
|
262
|
+
.ds-hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
|
|
263
|
+
|
|
264
|
+
.ds-section { padding-block: var(--space-8); border-top: 1px solid var(--border); }
|
|
265
|
+
.ds-section__title { margin: 0 0 var(--space-4); font-size: clamp(var(--text-2xl), 3.5vw, var(--text-3xl)); line-height: var(--leading-tight); }
|
|
266
|
+
|
|
267
|
+
.ds-features { display: grid; gap: var(--space-5) var(--space-6); grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); margin: 0; padding: 0; list-style: none; }
|
|
268
|
+
.ds-features__title { margin: 0 0 var(--space-1); font-size: var(--text-md); line-height: var(--leading-tight); }
|
|
269
|
+
.ds-features__text { margin: 0; color: var(--fg-muted); line-height: var(--leading-normal); }
|
|
270
|
+
|
|
271
|
+
.ds-steps { display: grid; gap: var(--space-5); margin: 0; padding-left: 1.5em; }
|
|
272
|
+
.ds-steps > li::marker { color: var(--accent-ink); font-family: var(--font-heading); font-weight: 700; }
|
|
273
|
+
.ds-steps__title { margin: 0 0 var(--space-1); font-size: var(--text-lg); line-height: var(--leading-tight); }
|
|
274
|
+
.ds-steps__text { margin: 0; line-height: var(--leading-normal); }
|
|
275
|
+
|
|
276
|
+
.ds-prose { max-width: 42em; line-height: var(--leading-normal); }
|
|
277
|
+
.ds-prose > * { margin: 0; }
|
|
278
|
+
.ds-prose > * + * { margin-top: var(--space-4); }
|
|
279
|
+
.ds-prose > :is(h2, h3) { margin-top: var(--space-6); line-height: var(--leading-tight); }
|
|
280
|
+
/* Only its own plain children: a component placed inside (like ds-steps) keeps its styles. */
|
|
281
|
+
.ds-prose > h1 { font-size: clamp(var(--text-3xl), 6vw, calc(var(--text-4xl) * 1.5)); line-height: var(--leading-tight); }
|
|
282
|
+
.ds-prose > h2 { font-size: var(--text-2xl); }
|
|
283
|
+
.ds-prose > h3 { font-size: var(--text-lg); }
|
|
284
|
+
.ds-prose > :is(ul, ol):not([class]) { padding-left: 1.25em; }
|
|
285
|
+
.ds-prose a:not([class]) { color: var(--link); }
|
|
286
|
+
|
|
287
|
+
/* ---------- App kit: phone-first apps (bottom sheet, toast, chips, list rows, tab bar, search, progress, details, swatches) ---------- */
|
|
288
|
+
|
|
289
|
+
/* Floating button: an icon button that sits over content such as a map. */
|
|
290
|
+
.ds-btn--floating { background: var(--bg-raised); color: var(--fg); border-color: var(--border); box-shadow: var(--shadow-md); border-radius: var(--radius-full); }
|
|
291
|
+
.ds-btn--floating:hover:not(:disabled) { background: var(--bg-sunken); }
|
|
292
|
+
|
|
293
|
+
/* Bottom sheet: a dialog that rises from the bottom edge (phones). Add to dialog.ds-modal.ds-sheet; doubled classes beat the side sheet's rules below. */
|
|
294
|
+
.ds-sheet.ds-sheet--bottom { margin: auto 0 0; width: 100vw; height: fit-content; max-height: 85dvh; }
|
|
295
|
+
.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); }
|
|
296
|
+
.ds-sheet--bottom[open] .ds-modal__panel { animation: ds-sheet-up var(--duration-base) var(--ease); }
|
|
297
|
+
@keyframes ds-sheet-up { from { transform: translateY(100%); } }
|
|
298
|
+
@media (prefers-reduced-motion: reduce) { .ds-sheet--bottom[open] .ds-modal__panel { animation: none; } }
|
|
299
|
+
|
|
300
|
+
/* Toast: a short message with an optional action (Undo), in a fixed region. */
|
|
301
|
+
.ds-toast-region { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + var(--space-4)); transform: translateX(-50%); z-index: 90; display: grid; gap: var(--space-2); width: max-content; max-width: calc(100vw - 2 * var(--space-4)); }
|
|
302
|
+
.ds-toast-region--top { bottom: auto; top: calc(env(safe-area-inset-top) + var(--space-4)); }
|
|
303
|
+
.ds-toast { display: flex; align-items: center; gap: var(--space-3); min-height: calc(var(--tap-min) + var(--space-2)); padding: var(--space-1) var(--space-2) var(--space-1) var(--space-4); background: var(--bg-raised); color: var(--fg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
|
|
304
|
+
.ds-toast__text { flex: 1; margin: 0; font-size: var(--text-sm); line-height: var(--leading-normal); }
|
|
305
|
+
.ds-toast__icon { flex: none; color: var(--fg-muted); }
|
|
306
|
+
.ds-toast--ok .ds-toast__icon { color: var(--ok); }
|
|
307
|
+
.ds-toast--danger .ds-toast__icon { color: var(--danger); }
|
|
308
|
+
|
|
309
|
+
/* Chips: compact labels, optionally with a colour dot, a second line and their own small actions. */
|
|
310
|
+
.ds-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
|
|
311
|
+
.ds-chip { --ds-chip-dot: var(--fg-muted); display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); max-width: 100%; padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3); background: var(--bg-raised); color: var(--fg); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); font-size: var(--text-sm); box-sizing: border-box; }
|
|
312
|
+
.ds-chip:not(:has(.ds-chip__action)) { padding-right: var(--space-3); }
|
|
313
|
+
.ds-chip__dot { flex: none; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--ds-chip-dot); }
|
|
314
|
+
.ds-chip__main { display: grid; min-width: 0; line-height: var(--leading-tight); }
|
|
315
|
+
.ds-chip__label { font-weight: 600; overflow-wrap: anywhere; }
|
|
316
|
+
.ds-chip__note { color: var(--fg-muted); font-size: var(--text-xs); overflow-wrap: anywhere; }
|
|
317
|
+
.ds-chip__action { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; padding: 0; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--fg-muted); cursor: pointer; }
|
|
318
|
+
.ds-chip__action:hover { background: var(--bg-sunken); color: var(--fg); }
|
|
319
|
+
.ds-chip--pending { border-style: dashed; }
|
|
320
|
+
.ds-chip--pending .ds-chip__label { color: var(--fg-muted); }
|
|
321
|
+
|
|
322
|
+
/* List rows: a lead (dot or icon), a title with a meta line, and a trailing action or chevron. */
|
|
323
|
+
.ds-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
|
|
324
|
+
.ds-list__item { display: flex; align-items: center; gap: var(--space-3); min-height: calc(var(--tap-min) + var(--space-2)); padding: var(--space-2) var(--space-1); border-bottom: 1px solid var(--border); }
|
|
325
|
+
.ds-list__link { display: flex; flex: 1; align-items: center; gap: var(--space-3); min-width: 0; align-self: stretch; color: inherit; text-decoration: none; border-radius: var(--radius-md); }
|
|
326
|
+
.ds-list__item:has(> .ds-list__link) { padding: 0; }
|
|
327
|
+
.ds-list__link { padding: var(--space-2) var(--space-1); }
|
|
328
|
+
.ds-list__link:hover { background: var(--bg-sunken); }
|
|
329
|
+
.ds-list__lead { flex: none; display: inline-flex; color: var(--fg-muted); }
|
|
330
|
+
.ds-list__dot { width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--ds-list-dot, var(--fg-muted)); }
|
|
331
|
+
.ds-list__main { display: grid; flex: 1; min-width: 0; gap: 0.1rem; }
|
|
332
|
+
.ds-list__title { font-weight: 600; overflow-wrap: anywhere; }
|
|
333
|
+
.ds-list__meta { color: var(--fg-muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
|
|
334
|
+
.ds-list__trail { flex: none; display: inline-flex; align-items: center; gap: var(--space-1); color: var(--fg-muted); font-size: var(--text-sm); }
|
|
335
|
+
|
|
336
|
+
/* Tab bar: the bottom navigation of a phone app. The app decides where it sits (usually fixed to the bottom). */
|
|
337
|
+
.ds-tabbar { display: flex; background: var(--bg-raised); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
|
|
338
|
+
.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; }
|
|
339
|
+
.ds-tabbar__item .ds-icon { width: 1.5rem; height: 1.5rem; }
|
|
340
|
+
.ds-tabbar__item[aria-current='page'] { color: var(--accent-ink); }
|
|
341
|
+
|
|
342
|
+
/* Search field: a text input with a search icon, and a clear button once it has text. */
|
|
343
|
+
.ds-search { position: relative; display: flex; align-items: center; }
|
|
344
|
+
.ds-search__icon { position: absolute; left: var(--space-3); color: var(--fg-muted); pointer-events: none; }
|
|
345
|
+
.ds-search .ds-control { padding-left: calc(var(--space-3) * 2 + 1.25em); padding-right: var(--tap-min); }
|
|
346
|
+
.ds-search__clear { position: absolute; right: 0; display: inline-flex; align-items: center; justify-content: center; width: var(--tap-min); height: 100%; min-height: var(--tap-min); padding: 0; border: 0; background: transparent; color: var(--fg-muted); cursor: pointer; border-radius: var(--radius-md); }
|
|
347
|
+
.ds-search__clear:hover { color: var(--fg); }
|
|
348
|
+
.ds-search .ds-control::-webkit-search-cancel-button { display: none; }
|
|
349
|
+
|
|
350
|
+
/* Progress bar: a native <progress>, in the accent. Without a value it shows the platform's busy state. */
|
|
351
|
+
.ds-progress { display: block; width: 100%; height: 0.5rem; border: 0; border-radius: var(--radius-full); background: var(--bg-sunken); color: var(--accent); accent-color: var(--accent); overflow: hidden; -webkit-appearance: none; appearance: none; }
|
|
352
|
+
.ds-progress::-webkit-progress-bar { background: var(--bg-sunken); border-radius: var(--radius-full); }
|
|
353
|
+
.ds-progress::-webkit-progress-value { background: var(--accent); border-radius: var(--radius-full); }
|
|
354
|
+
.ds-progress::-moz-progress-bar { background: var(--accent); border-radius: var(--radius-full); }
|
|
355
|
+
.ds-progress:indeterminate { background: linear-gradient(90deg, var(--bg-sunken) 0 35%, var(--accent) 35% 65%, var(--bg-sunken) 65%) 0 0 / 300% 100%; animation: ds-progress-busy 1.4s linear infinite; }
|
|
356
|
+
.ds-progress:indeterminate::-webkit-progress-bar { background: transparent; }
|
|
357
|
+
.ds-progress:indeterminate::-moz-progress-bar { background: transparent; }
|
|
358
|
+
@keyframes ds-progress-busy { from { background-position: 100% 0; } to { background-position: 0 0; } }
|
|
359
|
+
@media (prefers-reduced-motion: reduce) { .ds-progress:indeterminate { animation: none; background-position: 50% 0; } }
|
|
360
|
+
|
|
361
|
+
/* Details list: labels above their values, each row with an optional action on the right. */
|
|
362
|
+
.ds-details { margin: 0; display: grid; }
|
|
363
|
+
.ds-details__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
|
|
364
|
+
.ds-details__row:first-child { padding-top: 0; }
|
|
365
|
+
.ds-details__row:last-child { border-bottom: 0; padding-bottom: 0; }
|
|
366
|
+
.ds-details dt { grid-column: 1; color: var(--fg-muted); font-size: var(--text-sm); }
|
|
367
|
+
.ds-details dd { grid-column: 1; margin: 0; overflow-wrap: anywhere; }
|
|
368
|
+
.ds-details__action { grid-column: 2; grid-row: 1 / span 2; }
|
|
369
|
+
|
|
370
|
+
/* Colour swatches: a choice of colours as radio buttons. Each swatch sets --ds-swatch. */
|
|
371
|
+
.ds-swatches { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0; padding: 0; border: 0; }
|
|
372
|
+
.ds-swatch { position: relative; display: inline-flex; align-items: center; justify-content: center; width: var(--tap-min); height: var(--tap-min); cursor: pointer; }
|
|
373
|
+
.ds-swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
|
|
374
|
+
.ds-swatch__dot { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--ds-swatch); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 20%, transparent); }
|
|
375
|
+
.ds-swatch input:checked + .ds-swatch__dot { outline: 2px solid var(--fg); outline-offset: 2px; }
|
|
376
|
+
.ds-swatch input:focus-visible + .ds-swatch__dot { outline: 2px solid var(--ring); outline-offset: 4px; }
|
|
248
377
|
|
|
249
378
|
/* ---------- Dashboard kit ---------- */
|
|
250
379
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyt87/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"dist"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@nyt87/tokens": ">=0.1.
|
|
52
|
+
"@nyt87/tokens": ">=0.1.3"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsup && cp src/styles.css dist/styles.css",
|