@nyt87/ui 0.0.0-stage → 0.2.4
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/LICENSE +21 -0
- package/dist/copy.d.ts +1 -0
- package/dist/copy.js +1 -0
- package/dist/drop.d.ts +2 -0
- package/dist/drop.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/menu.d.ts +2 -0
- package/dist/menu.js +1 -0
- package/dist/modal.d.ts +2 -0
- package/dist/modal.js +1 -0
- package/dist/styles.css +356 -0
- package/dist/tabs.d.ts +2 -0
- package/dist/tabs.js +1 -0
- package/dist/theme-scope.d.ts +8 -0
- package/dist/theme-scope.js +3 -0
- package/package.json +60 -4
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NYT87
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/copy.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@nyt87/tokens/theme';
|
package/dist/copy.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
typeof document<"u"&&!window.__dsCopy&&(window.__dsCopy=!0,document.addEventListener("click",async o=>{let t=o.target.closest("[data-ds-copy]");if(!t)return;let e=t.dataset.dsCopy?document.querySelector(t.dataset.dsCopy):t.closest(".ds-code")?.querySelector("pre");if(!e)return;try{await navigator.clipboard.writeText(e.textContent??"")}catch{return}let n=t.textContent;t.setAttribute("aria-live","polite"),t.textContent=t.dataset.copiedLabel??"Copied",setTimeout(()=>{t.textContent=n},1500)}));
|
package/dist/drop.d.ts
ADDED
package/dist/drop.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r=(t,e)=>{e.length&&t.dispatchEvent(new CustomEvent("ds-files",{bubbles:!0,detail:{files:e}}))};typeof document<"u"&&!window.__dsDrop&&(window.__dsDrop=!0,document.addEventListener("click",t=>{t.target.closest("[data-ds-drop-pick]")?.closest(".ds-drop")?.querySelector('input[type="file"]')?.click()}),document.addEventListener("change",t=>{let e=t.target,s=e.closest?.(".ds-drop");!s||e.type!=="file"||(r(s,Array.from(e.files??[])),e.value="")}),document.addEventListener("dragover",t=>{let e=t.target.closest?.(".ds-drop");e&&(t.preventDefault(),e.classList.add("ds-drop--over"))}),document.addEventListener("dragleave",t=>t.target.closest?.(".ds-drop")?.classList.remove("ds-drop--over")),document.addEventListener("drop",t=>{let e=t.target.closest?.(".ds-drop");if(!e)return;t.preventDefault(),e.classList.remove("ds-drop--over");let s=e.querySelector('input[type="file"]'),n=Array.from(t.dataTransfer?.files??[]);r(e,s?.multiple?n:n.slice(0,1))}));
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ColorOverrides, ColorToken, ContrastFailure, checkTheme, contrast, defineTheme, themeCss } from '@nyt87/tokens/theme';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var l=".ds-header__menu, .ds-app__toggle",c=t=>document.getElementById(t.getAttribute("aria-controls")??"");function d(t,e){t.setAttribute("aria-expanded",String(e));let s=e?t.dataset.labelClose:t.dataset.labelOpen;s&&t.setAttribute("aria-label",s);let n=c(t);n&&(t.classList.contains("ds-app__toggle")?n.toggleAttribute("data-open",e):n.hidden=!e)}var r=()=>[...document.querySelectorAll(l)].filter(t=>t.getAttribute("aria-expanded")==="true");typeof document<"u"&&!window.__dsMenu&&(window.__dsMenu=!0,document.addEventListener("click",t=>{let e=t.target,s=e.closest(l);if(s)return d(s,s.getAttribute("aria-expanded")!=="true");e.closest(".ds-header__panel a, .ds-app__sidebar a")&&r().forEach(n=>d(n,!1))}),document.addEventListener("keydown",t=>{t.key==="Escape"&&r().forEach(e=>{d(e,!1),e.focus()})}),document.addEventListener("pointerdown",t=>{let e=t.target;r().forEach(s=>{s.closest(".ds-header")?.contains(e)||c(s)?.contains(e)||s.contains(e)||d(s,!1)})}));function u(t,e=!1){let s=t.closest(".ds-tabs");s&&(s.querySelectorAll('[role="tab"]').forEach(n=>{let o=n===t;n.setAttribute("aria-selected",String(o)),n.tabIndex=o?0:-1;let a=document.getElementById(n.getAttribute("aria-controls")??"");a&&(a.hidden=!o)}),e&&t.focus(),t.dispatchEvent(new CustomEvent("ds-tab-change",{bubbles:!0,detail:{id:t.id}})))}typeof document<"u"&&!window.__dsTabs&&(window.__dsTabs=!0,document.addEventListener("click",t=>{let e=t.target.closest('.ds-tabs [role="tab"]');e&&u(e)}),document.addEventListener("keydown",t=>{let e=t.target.closest('.ds-tabs [role="tab"]');if(!e)return;let s=[...e.closest('[role="tablist"]').querySelectorAll('[role="tab"]')],n=s.indexOf(e),o=s.length-1,a=t.key==="ArrowRight"?n===o?0:n+1:t.key==="ArrowLeft"?n===0?o:n-1:t.key==="Home"?0:t.key==="End"?o:-1;a<0||(t.preventDefault(),u(s[a],!0))}));typeof document<"u"&&!window.__dsModal&&(window.__dsModal=!0,document.addEventListener("click",t=>{let e=t.target,s=e.closest("[data-ds-modal-open]");if(s){document.getElementById(s.dataset.dsModalOpen)?.showModal();return}if(e.closest("[data-ds-modal-close]")){e.closest("dialog")?.close();return}e instanceof HTMLDialogElement&&e.classList.contains("ds-modal")&&e.close()}));typeof document<"u"&&!window.__dsCopy&&(window.__dsCopy=!0,document.addEventListener("click",async t=>{let e=t.target.closest("[data-ds-copy]");if(!e)return;let s=e.dataset.dsCopy?document.querySelector(e.dataset.dsCopy):e.closest(".ds-code")?.querySelector("pre");if(!s)return;try{await navigator.clipboard.writeText(s.textContent??"")}catch{return}let n=e.textContent;e.setAttribute("aria-live","polite"),e.textContent=e.dataset.copiedLabel??"Copied",setTimeout(()=>{e.textContent=n},1500)}));var p=(t,e)=>{e.length&&t.dispatchEvent(new CustomEvent("ds-files",{bubbles:!0,detail:{files:e}}))};typeof document<"u"&&!window.__dsDrop&&(window.__dsDrop=!0,document.addEventListener("click",t=>{t.target.closest("[data-ds-drop-pick]")?.closest(".ds-drop")?.querySelector('input[type="file"]')?.click()}),document.addEventListener("change",t=>{let e=t.target,s=e.closest?.(".ds-drop");!s||e.type!=="file"||(p(s,Array.from(e.files??[])),e.value="")}),document.addEventListener("dragover",t=>{let e=t.target.closest?.(".ds-drop");e&&(t.preventDefault(),e.classList.add("ds-drop--over"))}),document.addEventListener("dragleave",t=>t.target.closest?.(".ds-drop")?.classList.remove("ds-drop--over")),document.addEventListener("drop",t=>{let e=t.target.closest?.(".ds-drop");if(!e)return;t.preventDefault(),e.classList.remove("ds-drop--over");let s=e.querySelector('input[type="file"]'),n=Array.from(t.dataTransfer?.files??[]);p(e,s?.multiple?n:n.slice(0,1))}));import{assertKnownTokens as f,checkTheme as E,themeCss as y}from"@nyt87/tokens/theme";var g=0,m=t=>t?JSON.parse(t):{},i=class extends HTMLElement{static observedAttributes=["light","dark"];#e=document.createElement("style");#t=`ds-scope-${++g}`;connectedCallback(){this.style.display="contents",this.classList.add(this.#t),this.prepend(this.#e),this.#s()}attributeChangedCallback(){this.isConnected&&this.#s()}#s(){let e={light:m(this.getAttribute("light")),dark:m(this.getAttribute("dark"))};f(e),this.#e.textContent=y(`.${this.#t}`,e,{on:"scope"});let s=E(e);s.length&&(console.warn(`[@nyt87/ui] <ds-theme-scope> fails WCAG contrast:
|
|
2
|
+
`+s.map(n=>` ${n.mode}: ${n.fg} ${n.fgColor} on ${n.bg} ${n.bgColor} = ${n.ratio}:1 (needs ${n.min}:1)`).join(`
|
|
3
|
+
`)),this.dispatchEvent(new CustomEvent("ds-contrast-failures",{bubbles:!0,detail:{failures:s}})))}};typeof customElements<"u"&&!customElements.get("ds-theme-scope")&&customElements.define("ds-theme-scope",i);import{checkTheme as x,defineTheme as A,themeCss as H,contrast as O}from"@nyt87/tokens/theme";export{x as checkTheme,O as contrast,A as defineTheme,H as themeCss};
|
package/dist/menu.d.ts
ADDED
package/dist/menu.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=".ds-header__menu, .ds-app__toggle",o=e=>document.getElementById(e.getAttribute("aria-controls")??"");function s(e,t){e.setAttribute("aria-expanded",String(t));let n=t?e.dataset.labelClose:e.dataset.labelOpen;n&&e.setAttribute("aria-label",n);let a=o(e);a&&(e.classList.contains("ds-app__toggle")?a.toggleAttribute("data-open",t):a.hidden=!t)}var d=()=>[...document.querySelectorAll(i)].filter(e=>e.getAttribute("aria-expanded")==="true");typeof document<"u"&&!window.__dsMenu&&(window.__dsMenu=!0,document.addEventListener("click",e=>{let t=e.target,n=t.closest(i);if(n)return s(n,n.getAttribute("aria-expanded")!=="true");t.closest(".ds-header__panel a, .ds-app__sidebar a")&&d().forEach(a=>s(a,!1))}),document.addEventListener("keydown",e=>{e.key==="Escape"&&d().forEach(t=>{s(t,!1),t.focus()})}),document.addEventListener("pointerdown",e=>{let t=e.target;d().forEach(n=>{n.closest(".ds-header")?.contains(t)||o(n)?.contains(t)||n.contains(t)||s(n,!1)})}));
|
package/dist/modal.d.ts
ADDED
package/dist/modal.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
typeof document<"u"&&!window.__dsModal&&(window.__dsModal=!0,document.addEventListener("click",o=>{let e=o.target,t=e.closest("[data-ds-modal-open]");if(t){document.getElementById(t.dataset.dsModalOpen)?.showModal();return}if(e.closest("[data-ds-modal-close]")){e.closest("dialog")?.close();return}e instanceof HTMLDialogElement&&e.classList.contains("ds-modal")&&e.close()}));
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/* @nyt87/ui styles. Requires @nyt87/tokens/tokens.css. Only tokens are used for colour, size, radius and motion. */
|
|
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
|
+
|
|
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; }
|
|
7
|
+
|
|
8
|
+
/* One focus style for everything interactive. */
|
|
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):focus-visible,
|
|
10
|
+
.ds-choice:has(input:focus-visible) .ds-choice__box,
|
|
11
|
+
.ds-choice:has(input:focus-visible) .ds-switch,
|
|
12
|
+
.ds-seg__item:has(input:focus-visible) {
|
|
13
|
+
outline: 2px solid var(--ring);
|
|
14
|
+
outline-offset: 2px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@keyframes ds-spin { to { transform: rotate(360deg); } }
|
|
18
|
+
.ds-spinner { display: inline-block; flex: none; box-sizing: border-box; width: var(--ds-spinner-size, 1.25rem); height: var(--ds-spinner-size, 1.25rem); border: 3px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; border-radius: 50%; animation: ds-spin 0.8s linear infinite; }
|
|
19
|
+
.ds-btn .ds-spinner { --ds-spinner-size: 1em; border-width: 2px; }
|
|
20
|
+
@media (prefers-reduced-motion: reduce) { .ds-spinner { animation-duration: 2.4s; } }
|
|
21
|
+
|
|
22
|
+
/* ---------- Icons (the sprite and helper come from @nyt87/icons) ---------- */
|
|
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
|
+
.ds-icon--sm { width: 1rem; height: 1rem; }
|
|
25
|
+
.ds-icon--lg { width: 1.5rem; height: 1.5rem; }
|
|
26
|
+
.ds-icon--xl { width: 2rem; height: 2rem; }
|
|
27
|
+
.ds-btn .ds-icon { width: 1.125em; height: 1.125em; vertical-align: 0; }
|
|
28
|
+
.ds-btn--icon-only .ds-icon { width: 1.25rem; height: 1.25rem; }
|
|
29
|
+
|
|
30
|
+
/* ---------- Button ---------- */
|
|
31
|
+
.ds-btn {
|
|
32
|
+
display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
|
|
33
|
+
font: inherit; font-weight: 600; line-height: 1; white-space: nowrap;
|
|
34
|
+
border: 1px solid transparent; border-radius: var(--radius-md);
|
|
35
|
+
cursor: pointer; text-decoration: none;
|
|
36
|
+
transition: background var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease), opacity var(--duration-fast) var(--ease);
|
|
37
|
+
}
|
|
38
|
+
.ds-btn--sm { min-height: 2rem; padding: 0 var(--space-3); font-size: var(--text-sm); }
|
|
39
|
+
.ds-btn--md { min-height: 2.5rem; padding: 0 var(--space-4); font-size: var(--text-sm); }
|
|
40
|
+
.ds-btn--lg { min-height: var(--tap-min); padding: 0 var(--space-5); font-size: var(--text-md); }
|
|
41
|
+
.ds-btn__icon { display: inline-flex; }
|
|
42
|
+
.ds-btn--icon-only.ds-btn--sm { width: 2rem; padding: 0; }
|
|
43
|
+
.ds-btn--icon-only.ds-btn--md { width: 2.5rem; padding: 0; }
|
|
44
|
+
.ds-btn--icon-only.ds-btn--lg { width: var(--tap-min); padding: 0; }
|
|
45
|
+
|
|
46
|
+
.ds-btn--primary { background: var(--accent); color: var(--on-accent); }
|
|
47
|
+
.ds-btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, var(--fg)); }
|
|
48
|
+
.ds-btn--secondary { background: var(--bg-raised); color: var(--fg); border-color: var(--border-strong); }
|
|
49
|
+
.ds-btn--secondary:hover:not(:disabled) { background: var(--bg-sunken); }
|
|
50
|
+
.ds-btn--ghost { background: transparent; color: var(--fg); }
|
|
51
|
+
.ds-btn--ghost:hover:not(:disabled) { background: var(--bg-sunken); }
|
|
52
|
+
.ds-btn--danger { background: var(--danger); color: var(--on-status); }
|
|
53
|
+
.ds-btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 88%, var(--fg)); }
|
|
54
|
+
.ds-btn--danger-outline { background: transparent; color: var(--danger); border-color: currentColor; }
|
|
55
|
+
.ds-btn--danger-outline:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 10%, transparent); }
|
|
56
|
+
.ds-btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
57
|
+
.ds-btn[aria-busy='true'] { cursor: progress; opacity: 0.8; }
|
|
58
|
+
|
|
59
|
+
/* ---------- Field + controls ---------- */
|
|
60
|
+
.ds-field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
|
|
61
|
+
.ds-field__label { font-size: var(--text-sm); font-weight: 600; }
|
|
62
|
+
.ds-field__req { color: var(--danger); }
|
|
63
|
+
.ds-field__hint { margin: 0; font-size: var(--text-sm); color: var(--fg-muted); }
|
|
64
|
+
.ds-field__error { margin: 0; font-size: var(--text-sm); color: var(--danger); font-weight: 600; }
|
|
65
|
+
|
|
66
|
+
.ds-control {
|
|
67
|
+
font: inherit; font-size: var(--text-md); color: var(--fg);
|
|
68
|
+
background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
|
|
69
|
+
min-height: 2.5rem; padding: 0 var(--space-3); width: 100%; box-sizing: border-box;
|
|
70
|
+
}
|
|
71
|
+
.ds-control::placeholder { color: var(--fg-muted); opacity: 1; }
|
|
72
|
+
.ds-control--area { padding: var(--space-2) var(--space-3); line-height: var(--leading-normal); resize: vertical; }
|
|
73
|
+
.ds-control--select { appearance: none; padding-right: 2.25rem;
|
|
74
|
+
background-image: linear-gradient(45deg, transparent 50%, var(--fg-muted) 50%), linear-gradient(135deg, var(--fg-muted) 50%, transparent 50%);
|
|
75
|
+
background-position: calc(100% - 1.15rem) 50%, calc(100% - 0.8rem) 50%; background-size: 0.35rem 0.35rem; background-repeat: no-repeat; }
|
|
76
|
+
.ds-control[aria-invalid='true'] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
|
|
77
|
+
.ds-control:disabled { opacity: 0.5; cursor: not-allowed; background: var(--bg-sunken); }
|
|
78
|
+
|
|
79
|
+
/* ---------- Checkbox / Switch ---------- */
|
|
80
|
+
.ds-choice { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; font-size: var(--text-md); }
|
|
81
|
+
.ds-choice__text { display: flex; flex-direction: column; gap: 2px; padding-top: 1px; }
|
|
82
|
+
.ds-choice__hint { font-size: var(--text-sm); color: var(--fg-muted); }
|
|
83
|
+
.ds-choice__box, .ds-switch { appearance: none; margin: 0; flex: none; cursor: pointer; background: var(--bg-raised); border: 1px solid var(--border-strong); }
|
|
84
|
+
.ds-choice__box { width: 1.25rem; height: 1.25rem; border-radius: var(--radius-sm); display: grid; place-content: center; }
|
|
85
|
+
.ds-choice__box::after { content: ''; width: 0.65rem; height: 0.35rem; border: solid var(--on-accent); border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
|
|
86
|
+
.ds-choice__box:checked { background: var(--accent); border-color: var(--accent); }
|
|
87
|
+
.ds-choice__box:checked::after { opacity: 1; }
|
|
88
|
+
.ds-switch { width: 2.5rem; height: 1.4rem; border-radius: var(--radius-full); position: relative; transition: background var(--duration-fast) var(--ease); }
|
|
89
|
+
.ds-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: calc(1.4rem - 6px); height: calc(1.4rem - 6px); border-radius: 50%; background: var(--fg-muted); transition: transform var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease); }
|
|
90
|
+
.ds-switch:checked { background: var(--accent); border-color: var(--accent); }
|
|
91
|
+
.ds-switch:checked::after { transform: translateX(1.1rem); background: var(--on-accent); }
|
|
92
|
+
.ds-choice input:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
93
|
+
|
|
94
|
+
/* ---------- Segmented ---------- */
|
|
95
|
+
.ds-seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-md); }
|
|
96
|
+
.ds-seg__item { position: relative; display: flex; cursor: pointer; border-radius: calc(var(--radius-md) - 2px); }
|
|
97
|
+
.ds-seg__item input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
|
|
98
|
+
.ds-seg__item span { display: flex; align-items: center; padding: 0 var(--space-3); font-size: var(--text-sm); font-weight: 600; color: var(--fg-muted); border-radius: inherit; min-height: 2rem; }
|
|
99
|
+
.ds-seg--sm .ds-seg__item span { min-height: 1.6rem; padding: 0 var(--space-2); font-size: var(--text-xs); }
|
|
100
|
+
.ds-seg__item:hover span { color: var(--fg); }
|
|
101
|
+
.ds-seg__item input:checked + span { background: var(--bg-raised); color: var(--fg); box-shadow: var(--shadow-sm); }
|
|
102
|
+
|
|
103
|
+
/* ---------- Card ---------- */
|
|
104
|
+
.ds-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); }
|
|
105
|
+
.ds-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-4) 0; }
|
|
106
|
+
.ds-card__title { margin: 0; font-size: var(--text-lg); line-height: var(--leading-tight); }
|
|
107
|
+
.ds-card__body { padding: var(--space-4); }
|
|
108
|
+
.ds-card__actions { display: flex; gap: var(--space-2); }
|
|
109
|
+
|
|
110
|
+
/* ---------- Badge ---------- */
|
|
111
|
+
.ds-badge { --tone: var(--fg-muted); display: inline-flex; align-items: center; gap: 0.4em; padding: 0.15em 0.65em; font-size: var(--text-xs); font-weight: 600; line-height: 1.5;
|
|
112
|
+
color: var(--fg); background: color-mix(in srgb, var(--tone) 14%, var(--bg-raised)); border: 1px solid color-mix(in srgb, var(--tone) 35%, var(--bg-raised)); border-radius: var(--radius-full); }
|
|
113
|
+
.ds-badge__dot { width: 0.5em; height: 0.5em; border-radius: 50%; background: var(--tone); }
|
|
114
|
+
.ds-badge--accent { --tone: var(--accent); }
|
|
115
|
+
.ds-badge--ok { --tone: var(--ok); }
|
|
116
|
+
.ds-badge--warn { --tone: var(--warn); }
|
|
117
|
+
.ds-badge--danger { --tone: var(--danger); }
|
|
118
|
+
|
|
119
|
+
/* ---------- Alert ---------- */
|
|
120
|
+
.ds-alert { --tone: var(--border-strong); display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
|
|
121
|
+
padding: var(--space-3) var(--space-4); background: color-mix(in srgb, var(--tone) 9%, var(--bg-raised)); border: 1px solid var(--border); border-left: 4px solid var(--tone); border-radius: var(--radius-md); color: var(--fg); }
|
|
122
|
+
.ds-alert--ok { --tone: var(--ok); }
|
|
123
|
+
.ds-alert--warn { --tone: var(--warn); }
|
|
124
|
+
.ds-alert--danger { --tone: var(--danger); }
|
|
125
|
+
.ds-alert__title { margin: 0; font-weight: 700; }
|
|
126
|
+
.ds-alert__body { color: var(--fg); font-size: var(--text-sm); }
|
|
127
|
+
.ds-alert__title + .ds-alert__body { margin-top: var(--space-1); }
|
|
128
|
+
.ds-alert__action { flex: none; }
|
|
129
|
+
|
|
130
|
+
/* ---------- EmptyState ---------- */
|
|
131
|
+
.ds-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-2); padding: var(--space-7) var(--space-4); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
|
|
132
|
+
.ds-empty__icon { color: var(--fg-muted); font-size: 2rem; line-height: 1; }
|
|
133
|
+
.ds-empty__title { margin: 0; font-size: var(--text-lg); font-weight: 700; }
|
|
134
|
+
.ds-empty__body { margin: 0; color: var(--fg-muted); max-width: 42ch; }
|
|
135
|
+
.ds-empty__action { margin-top: var(--space-2); }
|
|
136
|
+
|
|
137
|
+
/* ---------- Modal ---------- */
|
|
138
|
+
.ds-modal { padding: 0; border: 0; background: transparent; color: var(--fg); max-width: calc(100vw - 2rem); max-height: calc(100dvh - 2rem); overflow: visible; }
|
|
139
|
+
.ds-modal::backdrop { background: var(--scrim); }
|
|
140
|
+
.ds-modal--sm { width: 24rem; } .ds-modal--md { width: 32rem; } .ds-modal--lg { width: 48rem; }
|
|
141
|
+
.ds-modal__panel { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
|
|
142
|
+
.ds-modal__title { margin: 0; padding: var(--space-4) var(--space-5) var(--space-2); font-size: var(--text-xl); }
|
|
143
|
+
.ds-modal__body { padding: var(--space-2) var(--space-5) var(--space-4); overflow: auto; }
|
|
144
|
+
.ds-modal__foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5) var(--space-4); border-top: 1px solid var(--border); }
|
|
145
|
+
|
|
146
|
+
/* ---------- Tabs ---------- */
|
|
147
|
+
.ds-tabs__list { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); overflow-x: auto; }
|
|
148
|
+
.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; }
|
|
149
|
+
.ds-tabs__tab:hover { color: var(--fg); }
|
|
150
|
+
.ds-tabs__tab[aria-selected='true'] { color: var(--accent-ink); border-bottom-color: var(--accent); }
|
|
151
|
+
.ds-tabs__panel { padding: var(--space-4) 0; }
|
|
152
|
+
|
|
153
|
+
/* ---------- Table ---------- */
|
|
154
|
+
.ds-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-raised); }
|
|
155
|
+
.ds-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
|
|
156
|
+
.ds-table th, .ds-table td { padding: var(--space-3) var(--space-4); text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
|
|
157
|
+
.ds-table thead th { background: var(--bg-sunken); color: var(--fg-muted); font-weight: 600; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; }
|
|
158
|
+
.ds-table tbody tr:last-child > * { border-bottom: 0; }
|
|
159
|
+
.ds-table tbody tr:hover { background: var(--bg-sunken); }
|
|
160
|
+
.ds-table .ds-num { text-align: right; font-variant-numeric: tabular-nums; }
|
|
161
|
+
.ds-table__caption { text-align: left; padding: var(--space-3) var(--space-4); font-weight: 700; }
|
|
162
|
+
|
|
163
|
+
/* ---------- Stat ---------- */
|
|
164
|
+
.ds-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--space-3); margin: 0; }
|
|
165
|
+
.ds-stat { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
|
|
166
|
+
.ds-stat__label { font-size: var(--text-xs); color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
|
|
167
|
+
.ds-stat__value { margin: var(--space-1) 0 0; }
|
|
168
|
+
.ds-stat__num { font-size: var(--text-2xl); font-weight: 700; font-variant-numeric: tabular-nums; line-height: var(--leading-tight); }
|
|
169
|
+
.ds-stat__unit { font-size: var(--text-sm); color: var(--fg-muted); }
|
|
170
|
+
.ds-stat__hint { display: block; font-size: var(--text-xs); color: var(--fg-muted); margin-top: 2px; }
|
|
171
|
+
|
|
172
|
+
/* ---------- FileDropZone ---------- */
|
|
173
|
+
.ds-drop { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-6) var(--space-4); text-align: center; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-sunken); transition: border-color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease); }
|
|
174
|
+
.ds-drop--over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg-sunken)); }
|
|
175
|
+
.ds-drop__text { margin: 0; color: var(--fg-muted); }
|
|
176
|
+
|
|
177
|
+
/* ---------- CodeBlock ---------- */
|
|
178
|
+
.ds-code { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
|
|
179
|
+
.ds-code__bar { display: flex; justify-content: space-between; align-items: center; padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3); border-bottom: 1px solid var(--border); }
|
|
180
|
+
.ds-code__lang { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-muted); }
|
|
181
|
+
.ds-code__copy { font: inherit; font-size: var(--text-xs); font-weight: 600; color: var(--fg); background: none; border: 0; border-radius: var(--radius-sm); padding: var(--space-1) var(--space-2); cursor: pointer; }
|
|
182
|
+
.ds-code__copy:hover { background: var(--bg-raised); }
|
|
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); }
|
|
184
|
+
|
|
185
|
+
/* ---------- Brand typography: headings and buttons use the heading face ---------- */
|
|
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) {
|
|
188
|
+
font-family: var(--font-heading);
|
|
189
|
+
}
|
|
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); }
|
|
192
|
+
|
|
193
|
+
/* ---------- Layout helpers ---------- */
|
|
194
|
+
/* --max-width is the width of the content itself; the page gutter sits outside it, so content lines up with page sections. */
|
|
195
|
+
.ds-container { width: 100%; max-width: calc(var(--max-width) + var(--page-gutter) * 2); margin-inline: auto; padding-inline: var(--page-gutter); box-sizing: border-box; }
|
|
196
|
+
.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; }
|
|
197
|
+
.ds-skip:focus { top: var(--space-3); }
|
|
198
|
+
|
|
199
|
+
/* ---------- Brand lockup (header and footer) ---------- */
|
|
200
|
+
.ds-brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); color: var(--fg); text-decoration: none; font-weight: 700; font-size: var(--text-lg); letter-spacing: var(--tracking-heading); }
|
|
201
|
+
.ds-brand__mark { display: inline-flex; line-height: 0; }
|
|
202
|
+
.ds-brand__mark svg, .ds-brand__mark img { height: 1.75rem; width: auto; }
|
|
203
|
+
:where(.ds-brand__name img) { display: block; }
|
|
204
|
+
.ds-brand__name img { height: 1.5rem; width: auto; }
|
|
205
|
+
|
|
206
|
+
/* ---------- SiteHeader ---------- */
|
|
207
|
+
.ds-header { background: var(--bg); border-bottom: 1px solid var(--border); position: relative; z-index: 40; }
|
|
208
|
+
.ds-header--sticky { position: sticky; top: 0; }
|
|
209
|
+
.ds-header__bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); min-height: var(--nav-height); }
|
|
210
|
+
.ds-header__nav { display: flex; align-items: center; justify-content: flex-end; gap: clamp(0.25rem, 1.4vw, 1rem); margin-left: auto; font-family: var(--font-heading); font-weight: 500; font-size: 0.92rem; }
|
|
211
|
+
.ds-header__actions { display: flex; align-items: center; gap: var(--space-3); }
|
|
212
|
+
.ds-header__nav:empty + .ds-header__actions, .ds-brand + .ds-header__actions { margin-left: auto; }
|
|
213
|
+
.ds-header__link { display: inline-flex; align-items: center; min-height: var(--tap-min); padding: 0.35rem 0.6rem; color: var(--fg-muted); text-decoration: none; border-radius: var(--radius-sm); transition: color var(--duration-fast) var(--ease); }
|
|
214
|
+
.ds-header__link:hover { color: var(--fg); }
|
|
215
|
+
.ds-header__link[aria-current='page'] { color: var(--fg); text-decoration: underline; text-decoration-color: var(--accent-ink); text-decoration-thickness: 2px; text-underline-offset: 0.35em; }
|
|
216
|
+
.ds-header__link:focus-visible, .ds-footer__link:focus-visible, .ds-brand:focus-visible, .ds-header__menu:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
|
|
217
|
+
.ds-header__menu { display: none; width: var(--tap-min); height: var(--tap-min); align-items: center; justify-content: center; padding: 0; background: transparent; color: var(--fg); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
|
|
218
|
+
.ds-header__menu:hover { border-color: var(--border-strong); }
|
|
219
|
+
.ds-header__burger, .ds-header__burger::before, .ds-header__burger::after { display: block; width: 16px; height: 2px; border-radius: 999px; background: currentColor; position: relative; transition: transform var(--duration-base) var(--ease), top var(--duration-base) var(--ease), background var(--duration-fast); }
|
|
220
|
+
.ds-header__burger::before, .ds-header__burger::after { content: ''; position: absolute; left: 0; }
|
|
221
|
+
.ds-header__burger::before { top: -5px; } .ds-header__burger::after { top: 5px; }
|
|
222
|
+
.ds-header__menu[aria-expanded='true'] .ds-header__burger { background: transparent; }
|
|
223
|
+
.ds-header__menu[aria-expanded='true'] .ds-header__burger::before { top: 0; transform: rotate(45deg); }
|
|
224
|
+
.ds-header__menu[aria-expanded='true'] .ds-header__burger::after { top: 0; transform: rotate(-45deg); }
|
|
225
|
+
.ds-header__panel { border-top: 1px solid var(--border); background: var(--bg-raised); }
|
|
226
|
+
.ds-header__panel[hidden] { display: none; }
|
|
227
|
+
.ds-header__panel .ds-container { display: grid; padding-block: var(--space-2); }
|
|
228
|
+
.ds-header__panel .ds-header__link { padding: 0.6rem 0.85rem; }
|
|
229
|
+
@media (max-width: 52rem) {
|
|
230
|
+
.ds-header__nav { display: none; }
|
|
231
|
+
.ds-header__menu { display: inline-flex; }
|
|
232
|
+
.ds-header__actions { margin-left: auto; }
|
|
233
|
+
}
|
|
234
|
+
@media (min-width: 52.0625rem) { .ds-header__panel { display: none; } }
|
|
235
|
+
@media (prefers-reduced-motion: reduce) { .ds-header__burger, .ds-header__burger::before, .ds-header__burger::after { transition: none; } }
|
|
236
|
+
|
|
237
|
+
/* ---------- SiteFooter ---------- */
|
|
238
|
+
.ds-footer { margin-top: var(--space-8); border-top: 1px solid var(--border); background: var(--bg); color: var(--fg-muted); font-size: var(--text-sm); }
|
|
239
|
+
.ds-footer__top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-6) var(--space-7); padding-block: var(--space-6) var(--space-5); }
|
|
240
|
+
.ds-footer__brand { flex: 1 1 18rem; max-width: 28rem; }
|
|
241
|
+
.ds-footer__tagline { margin: var(--space-2) 0 0; line-height: var(--leading-normal); }
|
|
242
|
+
.ds-footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
|
|
243
|
+
.ds-footer__heading { margin: 0 0 var(--space-2); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg); font-weight: 700; }
|
|
244
|
+
.ds-footer__row { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); }
|
|
245
|
+
.ds-footer__link { display: inline-flex; align-items: center; min-height: 2rem; color: var(--link); text-decoration: none; border-radius: var(--radius-sm); }
|
|
246
|
+
.ds-footer__link:hover { text-decoration: underline; text-underline-offset: 0.2em; }
|
|
247
|
+
.ds-footer__link--inline { min-height: 0; }
|
|
248
|
+
.ds-footer__bottom { display: grid; gap: var(--space-1); padding-block: var(--space-4) var(--space-6); border-top: 1px solid var(--border); }
|
|
249
|
+
.ds-footer__credit, .ds-footer__note { margin: 0; }
|
|
250
|
+
/* Hold the footer's text size and colour even when the host page styles bare <p> elements. */
|
|
251
|
+
.ds-footer__tagline, .ds-footer__credit, .ds-footer__note { font-size: var(--text-sm); color: inherit; }
|
|
252
|
+
.ds-footer__heart { color: var(--accent-ink); }
|
|
253
|
+
|
|
254
|
+
/* ---------- Product site sections: hero, section, features, steps, prose ---------- */
|
|
255
|
+
/* Hold margins and sizes even when the host page styles bare headings, <p> and lists. */
|
|
256
|
+
.ds-hero { display: grid; gap: var(--space-5); padding-block: var(--space-7) var(--space-8); }
|
|
257
|
+
.ds-hero__art { display: block; width: 100%; height: auto; border-radius: var(--radius-lg); object-fit: cover; }
|
|
258
|
+
.ds-hero__title { margin: 0; font-size: clamp(var(--text-3xl), 6vw, calc(var(--text-4xl) * 1.5)); line-height: var(--leading-tight); }
|
|
259
|
+
.ds-hero__lead { margin: 0; max-width: 36em; color: var(--fg-muted); font-size: var(--text-lg); line-height: var(--leading-normal); }
|
|
260
|
+
.ds-hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
|
|
261
|
+
|
|
262
|
+
.ds-section { padding-block: var(--space-8); border-top: 1px solid var(--border); }
|
|
263
|
+
.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); }
|
|
264
|
+
|
|
265
|
+
.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; }
|
|
266
|
+
.ds-features__title { margin: 0 0 var(--space-1); font-size: var(--text-md); line-height: var(--leading-tight); }
|
|
267
|
+
.ds-features__text { margin: 0; color: var(--fg-muted); line-height: var(--leading-normal); }
|
|
268
|
+
|
|
269
|
+
.ds-steps { display: grid; gap: var(--space-5); margin: 0; padding-left: 1.5em; }
|
|
270
|
+
.ds-steps > li::marker { color: var(--accent-ink); font-family: var(--font-heading); font-weight: 700; }
|
|
271
|
+
.ds-steps__title { margin: 0 0 var(--space-1); font-size: var(--text-lg); line-height: var(--leading-tight); }
|
|
272
|
+
.ds-steps__text { margin: 0; line-height: var(--leading-normal); }
|
|
273
|
+
|
|
274
|
+
.ds-prose { max-width: 42em; line-height: var(--leading-normal); }
|
|
275
|
+
.ds-prose > * { margin: 0; }
|
|
276
|
+
.ds-prose > * + * { margin-top: var(--space-4); }
|
|
277
|
+
.ds-prose > :is(h2, h3) { margin-top: var(--space-6); line-height: var(--leading-tight); }
|
|
278
|
+
/* Only its own plain children: a component placed inside (like ds-steps) keeps its styles. */
|
|
279
|
+
.ds-prose > h1 { font-size: clamp(var(--text-3xl), 6vw, calc(var(--text-4xl) * 1.5)); line-height: var(--leading-tight); }
|
|
280
|
+
.ds-prose > h2 { font-size: var(--text-2xl); }
|
|
281
|
+
.ds-prose > h3 { font-size: var(--text-lg); }
|
|
282
|
+
.ds-prose > :is(ul, ol):not([class]) { padding-left: 1.25em; }
|
|
283
|
+
.ds-prose a:not([class]) { color: var(--link); }
|
|
284
|
+
|
|
285
|
+
/* ---------- Dashboard kit ---------- */
|
|
286
|
+
|
|
287
|
+
/* App shell: sidebar + top bar + main. Below 860px the sidebar becomes a drawer opened by .ds-app__toggle (needs @nyt87/ui/menu). */
|
|
288
|
+
.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); }
|
|
289
|
+
.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; }
|
|
290
|
+
.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; }
|
|
291
|
+
.ds-app__title { margin: 0; font-size: var(--text-lg); font-weight: 700; }
|
|
292
|
+
.ds-app__bar-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
|
|
293
|
+
.ds-app__main { grid-area: main; padding: var(--space-5); min-width: 0; }
|
|
294
|
+
.ds-app__toggle { display: none; }
|
|
295
|
+
.ds-app__scrim { display: none; }
|
|
296
|
+
.ds-nav { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
|
|
297
|
+
.ds-nav__heading { margin: var(--space-3) var(--space-3) var(--space-1); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted); }
|
|
298
|
+
.ds-nav__link { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap-min); padding: 0 var(--space-3); border-radius: var(--radius-md); color: var(--fg-muted); text-decoration: none; font-weight: 500; font-size: var(--text-sm); }
|
|
299
|
+
.ds-nav__link:hover { background: var(--bg-sunken); color: var(--fg); }
|
|
300
|
+
.ds-nav__link[aria-current='page'] { background: var(--bg-sunken); color: var(--fg); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
|
|
301
|
+
.ds-nav__link .ds-icon { flex: none; }
|
|
302
|
+
@media (max-width: 860px) {
|
|
303
|
+
.ds-app { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'bar' 'main'; }
|
|
304
|
+
.ds-app__toggle { display: inline-flex; }
|
|
305
|
+
.ds-app__sidebar { position: fixed; inset: 0 auto 0 0; width: min(18rem, 85vw); z-index: 60; height: 100dvh; transform: translateX(-100%); visibility: hidden; transition: transform var(--duration-base, 180ms) ease, visibility 0s linear var(--duration-base, 180ms); box-shadow: var(--shadow-md); }
|
|
306
|
+
.ds-app__sidebar[data-open] { transform: none; visibility: visible; transition-delay: 0s; }
|
|
307
|
+
.ds-app__sidebar[data-open] ~ .ds-app__scrim { display: block; position: fixed; inset: 0; z-index: 50; background: var(--scrim); }
|
|
308
|
+
.ds-app__main { padding: var(--space-4); }
|
|
309
|
+
}
|
|
310
|
+
@media (prefers-reduced-motion: reduce) { .ds-app__sidebar { transition: none; } }
|
|
311
|
+
|
|
312
|
+
/* Skeleton: a placeholder while content loads. Mark the region aria-busy="true". */
|
|
313
|
+
.ds-skeleton { display: block; height: 1em; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--border) 50%, var(--bg-sunken) 75%); background-size: 200% 100%; animation: ds-shimmer 1.4s linear infinite; }
|
|
314
|
+
.ds-skeleton--text { height: 0.9em; margin-block: 0.4em; } .ds-skeleton--title { height: 1.4em; width: 40%; } .ds-skeleton--block { height: 6rem; }
|
|
315
|
+
@keyframes ds-shimmer { to { background-position: -200% 0; } }
|
|
316
|
+
@media (prefers-reduced-motion: reduce) { .ds-skeleton { animation: none; } }
|
|
317
|
+
|
|
318
|
+
/* Table extensions */
|
|
319
|
+
.ds-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
|
|
320
|
+
.ds-toolbar__grow { flex: 1 1 12rem; }
|
|
321
|
+
.ds-toolbar__end { margin-left: auto; display: flex; gap: var(--space-2); }
|
|
322
|
+
.ds-table--dense th, .ds-table--dense td { padding-block: var(--space-2); }
|
|
323
|
+
.ds-table th[aria-sort] { padding: 0; }
|
|
324
|
+
.ds-table__sort { display: flex; align-items: center; gap: var(--space-1); width: 100%; padding: var(--space-3) var(--space-4); font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
|
|
325
|
+
.ds-table__sort:hover { color: var(--fg); }
|
|
326
|
+
.ds-table__sort::after { content: ''; width: 0.5rem; height: 0.5rem; opacity: 0.35; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }
|
|
327
|
+
.ds-table th[aria-sort='ascending'] .ds-table__sort::after { opacity: 1; transform: rotate(-135deg) translateY(-2px); }
|
|
328
|
+
.ds-table th[aria-sort='descending'] .ds-table__sort::after { opacity: 1; }
|
|
329
|
+
.ds-table th[aria-sort='ascending'], .ds-table th[aria-sort='descending'] { color: var(--fg); }
|
|
330
|
+
.ds-table tbody tr[data-selected] { background: color-mix(in srgb, var(--accent) 10%, var(--bg-raised)); }
|
|
331
|
+
.ds-table td.ds-table__actions { text-align: right; width: 1%; }
|
|
332
|
+
.ds-table__empty { text-align: center; color: var(--fg-muted); padding: var(--space-7) var(--space-4); white-space: normal; }
|
|
333
|
+
.ds-table td.ds-table__wrap { white-space: normal; min-width: 14rem; }
|
|
334
|
+
|
|
335
|
+
/* Pager */
|
|
336
|
+
.ds-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-3); font-size: var(--text-sm); color: var(--fg-muted); }
|
|
337
|
+
.ds-pager__list { display: flex; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
|
|
338
|
+
.ds-pager__item { display: inline-flex; align-items: center; justify-content: center; min-width: 2.25rem; min-height: 2.25rem; padding: 0 var(--space-2); font: inherit; color: var(--fg); background: transparent; border: 1px solid var(--border); border-radius: var(--radius-md); text-decoration: none; cursor: pointer; }
|
|
339
|
+
.ds-pager__item:hover:not([aria-disabled='true']):not([aria-current='page']) { border-color: var(--border-strong); background: var(--bg-sunken); }
|
|
340
|
+
.ds-pager__item[aria-current='page'] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
|
|
341
|
+
.ds-pager__item[aria-disabled='true'], .ds-pager__item:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
342
|
+
|
|
343
|
+
/* Side sheet: a dialog docked to the right edge. Uses the modal behaviour (@nyt87/ui/modal). */
|
|
344
|
+
.ds-sheet { margin: 0 0 0 auto; width: min(32rem, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; }
|
|
345
|
+
.ds-sheet--lg { width: min(48rem, 100vw); }
|
|
346
|
+
.ds-sheet .ds-modal__panel { height: 100dvh; max-height: 100dvh; border-radius: 0; border-width: 0 0 0 1px; }
|
|
347
|
+
.ds-sheet__head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
|
|
348
|
+
.ds-sheet__head .ds-modal__title { padding: 0; flex: 1; }
|
|
349
|
+
.ds-sheet .ds-modal__body { flex: 1; padding-top: var(--space-4); }
|
|
350
|
+
|
|
351
|
+
/* Tooltip: short, supplementary text for a control. The trigger must reference it with aria-describedby. */
|
|
352
|
+
.ds-tip { position: relative; display: inline-flex; }
|
|
353
|
+
.ds-tip__text { position: absolute; z-index: 70; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); width: max-content; max-width: 16rem; padding: var(--space-1) var(--space-2); background: var(--fg); color: var(--bg); font-size: var(--text-xs); font-weight: 500; line-height: 1.4; border-radius: var(--radius-sm); pointer-events: none; visibility: hidden; opacity: 0; transition: opacity var(--duration-fast, 120ms) ease; }
|
|
354
|
+
.ds-tip:hover .ds-tip__text, .ds-tip:focus-within .ds-tip__text { visibility: visible; opacity: 1; }
|
|
355
|
+
.ds-tip--below .ds-tip__text { bottom: auto; top: calc(100% + 6px); }
|
|
356
|
+
@media (prefers-reduced-motion: reduce) { .ds-tip__text { transition: none; } }
|
package/dist/tabs.d.ts
ADDED
package/dist/tabs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function l(e,n=!1){let o=e.closest(".ds-tabs");o&&(o.querySelectorAll('[role="tab"]').forEach(t=>{let s=t===e;t.setAttribute("aria-selected",String(s)),t.tabIndex=s?0:-1;let r=document.getElementById(t.getAttribute("aria-controls")??"");r&&(r.hidden=!s)}),n&&e.focus(),e.dispatchEvent(new CustomEvent("ds-tab-change",{bubbles:!0,detail:{id:e.id}})))}typeof document<"u"&&!window.__dsTabs&&(window.__dsTabs=!0,document.addEventListener("click",e=>{let n=e.target.closest('.ds-tabs [role="tab"]');n&&l(n)}),document.addEventListener("keydown",e=>{let n=e.target.closest('.ds-tabs [role="tab"]');if(!n)return;let o=[...n.closest('[role="tablist"]').querySelectorAll('[role="tab"]')],t=o.indexOf(n),s=o.length-1,r=e.key==="ArrowRight"?t===s?0:t+1:e.key==="ArrowLeft"?t===0?s:t-1:e.key==="Home"?0:e.key==="End"?s:-1;r<0||(e.preventDefault(),l(o[r],!0))}));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{assertKnownTokens as l,checkTheme as r,themeCss as a}from"@nyt87/tokens/theme";var d=0,o=e=>e?JSON.parse(e):{},i=class extends HTMLElement{static observedAttributes=["light","dark"];#t=document.createElement("style");#e=`ds-scope-${++d}`;connectedCallback(){this.style.display="contents",this.classList.add(this.#e),this.prepend(this.#t),this.#s()}attributeChangedCallback(){this.isConnected&&this.#s()}#s(){let s={light:o(this.getAttribute("light")),dark:o(this.getAttribute("dark"))};l(s),this.#t.textContent=a(`.${this.#e}`,s,{on:"scope"});let n=r(s);n.length&&(console.warn(`[@nyt87/ui] <ds-theme-scope> fails WCAG contrast:
|
|
2
|
+
`+n.map(t=>` ${t.mode}: ${t.fg} ${t.fgColor} on ${t.bg} ${t.bgColor} = ${t.ratio}:1 (needs ${t.min}:1)`).join(`
|
|
3
|
+
`)),this.dispatchEvent(new CustomEvent("ds-contrast-failures",{bubbles:!0,detail:{failures:n}})))}};typeof customElements<"u"&&!customElements.get("ds-theme-scope")&&customElements.define("ds-theme-scope",i);export{i as DsThemeScope};
|
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyt87/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"description": "Framework-free UI components for nyt87 products: HTML + CSS, with small vanilla behaviours for the interactive parts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/NYT87/design-system.git",
|
|
10
|
+
"directory": "packages/ui"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://npm.pkg.github.com"
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./styles.css": "./dist/styles.css",
|
|
23
|
+
"./menu": {
|
|
24
|
+
"types": "./dist/menu.d.ts",
|
|
25
|
+
"import": "./dist/menu.js"
|
|
26
|
+
},
|
|
27
|
+
"./tabs": {
|
|
28
|
+
"types": "./dist/tabs.d.ts",
|
|
29
|
+
"import": "./dist/tabs.js"
|
|
30
|
+
},
|
|
31
|
+
"./modal": {
|
|
32
|
+
"types": "./dist/modal.d.ts",
|
|
33
|
+
"import": "./dist/modal.js"
|
|
34
|
+
},
|
|
35
|
+
"./copy": {
|
|
36
|
+
"types": "./dist/copy.d.ts",
|
|
37
|
+
"import": "./dist/copy.js"
|
|
38
|
+
},
|
|
39
|
+
"./drop": {
|
|
40
|
+
"types": "./dist/drop.d.ts",
|
|
41
|
+
"import": "./dist/drop.js"
|
|
42
|
+
},
|
|
43
|
+
"./theme-scope": {
|
|
44
|
+
"types": "./dist/theme-scope.d.ts",
|
|
45
|
+
"import": "./dist/theme-scope.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist"
|
|
50
|
+
],
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@nyt87/tokens": ">=0.1.3"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsup && cp src/styles.css dist/styles.css",
|
|
56
|
+
"typecheck": "tsc --noEmit",
|
|
57
|
+
"test": "vitest run"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"tsup": "^8.5.0"
|
|
61
|
+
}
|
|
62
|
+
}
|
package/README.md
DELETED