@keystone-sites/marketing-design-system 1.0.26 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +47 -67
  2. package/fonts/gt-america-300-italic.woff2 +0 -0
  3. package/fonts/gt-america-300.woff2 +0 -0
  4. package/fonts/gt-america-400-italic.woff2 +0 -0
  5. package/fonts/gt-america-400.woff2 +0 -0
  6. package/fonts/gt-america-500.woff2 +0 -0
  7. package/fonts/gt-america-extended-300.woff2 +0 -0
  8. package/fonts/gt-america-extended-400.woff2 +0 -0
  9. package/fonts/gt-america-extended-500.woff2 +0 -0
  10. package/fonts/gt-america-extended-700.woff2 +0 -0
  11. package/fonts/gt-america-mono-300.woff2 +0 -0
  12. package/fonts/gt-america-mono-500.woff2 +0 -0
  13. package/fonts/pp-kyoto-vf.woff2 +0 -0
  14. package/package.json +46 -203
  15. package/src/base.css +300 -0
  16. package/src/fonts.css +131 -0
  17. package/src/hue.ts +17 -0
  18. package/src/icon.tsx +56 -0
  19. package/src/mark.tsx +14 -0
  20. package/src/motion.ts +123 -0
  21. package/src/parts/chip.css +84 -0
  22. package/src/parts/chip.tsx +40 -0
  23. package/src/parts/composer.css +195 -0
  24. package/src/parts/composer.tsx +220 -0
  25. package/src/parts/cx.ts +2 -0
  26. package/src/parts/faq.css +77 -0
  27. package/src/parts/faq.tsx +25 -0
  28. package/src/parts/footer.css +51 -0
  29. package/src/parts/footer.tsx +27 -0
  30. package/src/parts/nav.css +180 -0
  31. package/src/parts/nav.tsx +101 -0
  32. package/src/parts/photo.css +15 -0
  33. package/src/parts/photo.tsx +24 -0
  34. package/src/parts/plans.css +89 -0
  35. package/src/parts/plans.tsx +56 -0
  36. package/src/parts/prose.css +86 -0
  37. package/src/parts/prose.tsx +49 -0
  38. package/src/parts/shape.css +47 -0
  39. package/src/parts/shape.tsx +68 -0
  40. package/src/parts/split.tsx +49 -0
  41. package/src/parts/stamp.css +85 -0
  42. package/src/parts/stamp.tsx +36 -0
  43. package/src/parts/work-card.css +51 -0
  44. package/src/parts/work-card.tsx +40 -0
  45. package/src/set.css +439 -0
  46. package/src/styles.css +20 -0
  47. package/src/tokens/color.css +471 -0
  48. package/src/tokens/roles.css +12 -0
  49. package/src/tokens/type.css +11 -0
  50. package/src/wordmark.tsx +34 -0
  51. package/AGENTS.md +0 -192
  52. package/assets/media/brand/ks-lockup.svg +0 -13
  53. package/assets/media/brand/ks-logomark.svg +0 -4
  54. package/assets/media/brand/ks-wordmark-inline.svg +0 -13
  55. package/assets/media/brand/ks-wordmark.svg +0 -11
  56. package/assets/media/fonts/gt-standard-standard-vf.woff2 +0 -0
  57. package/assets/media/fonts/pp-kyoto-variable-upright-vf.woff2 +0 -0
  58. package/base.css +0 -113
  59. package/css-vars.d.ts +0 -10
  60. package/grid/engine.css +0 -367
  61. package/grid/field-hash.ts +0 -31
  62. package/grid/field.tsx +0 -48
  63. package/grid/gates.cjs +0 -35
  64. package/grid/region.tsx +0 -97
  65. package/icons.tsx +0 -1282
  66. package/index.css +0 -89
  67. package/lib/autoplay-gate.ts +0 -88
  68. package/lib/focus-trap.ts +0 -42
  69. package/lib/grader.ts +0 -123
  70. package/lib/legal-data.ts +0 -1
  71. package/lib/legal.ts +0 -41
  72. package/lib/noise.tsx +0 -114
  73. package/lib/phone.ts +0 -294
  74. package/lib/render-boundary.tsx +0 -27
  75. package/lib/scroll-lock.ts +0 -25
  76. package/lib/swipe.ts +0 -124
  77. package/lib/use-active-section.ts +0 -43
  78. package/lib/use-count-up.ts +0 -26
  79. package/lib/use-grader-search.ts +0 -143
  80. package/lib/use-popover.ts +0 -30
  81. package/lib/use-video-carousel.ts +0 -271
  82. package/media.ts +0 -558
  83. package/primitives/breadcrumb.css +0 -51
  84. package/primitives/breadcrumb.tsx +0 -46
  85. package/primitives/business-picker.css +0 -135
  86. package/primitives/business-picker.tsx +0 -298
  87. package/primitives/button-inline.css +0 -52
  88. package/primitives/button-inline.tsx +0 -38
  89. package/primitives/buttons.css +0 -551
  90. package/primitives/buttons.tsx +0 -330
  91. package/primitives/case-study-button.css +0 -71
  92. package/primitives/case-study-button.tsx +0 -28
  93. package/primitives/case-study-card.css +0 -318
  94. package/primitives/case-study-card.tsx +0 -116
  95. package/primitives/chip.css +0 -127
  96. package/primitives/chip.tsx +0 -53
  97. package/primitives/closer-row.css +0 -14
  98. package/primitives/closer-row.tsx +0 -22
  99. package/primitives/cta-row.css +0 -41
  100. package/primitives/cta-row.tsx +0 -39
  101. package/primitives/disclosure.css +0 -302
  102. package/primitives/disclosure.tsx +0 -277
  103. package/primitives/faq-question.css +0 -220
  104. package/primitives/faq-question.tsx +0 -55
  105. package/primitives/field.css +0 -279
  106. package/primitives/field.tsx +0 -376
  107. package/primitives/footer-item.css +0 -72
  108. package/primitives/footer-item.tsx +0 -42
  109. package/primitives/glyph-toggle.css +0 -62
  110. package/primitives/glyph-toggle.tsx +0 -42
  111. package/primitives/grader-menu.tsx +0 -84
  112. package/primitives/grader.css +0 -369
  113. package/primitives/grader.tsx +0 -285
  114. package/primitives/keystone-score.css +0 -156
  115. package/primitives/keystone-score.tsx +0 -204
  116. package/primitives/modal.css +0 -194
  117. package/primitives/modal.tsx +0 -204
  118. package/primitives/month-range.css +0 -80
  119. package/primitives/month-range.tsx +0 -183
  120. package/primitives/notice.css +0 -39
  121. package/primitives/notice.tsx +0 -56
  122. package/primitives/persona-card.css +0 -374
  123. package/primitives/persona-card.tsx +0 -74
  124. package/primitives/picture.css +0 -11
  125. package/primitives/picture.tsx +0 -41
  126. package/primitives/plan-card.css +0 -398
  127. package/primitives/plan-card.tsx +0 -153
  128. package/primitives/prose.css +0 -164
  129. package/primitives/prose.tsx +0 -194
  130. package/primitives/ramps.css +0 -77
  131. package/primitives/report-nav.css +0 -382
  132. package/primitives/report-nav.tsx +0 -353
  133. package/primitives/report.css +0 -601
  134. package/primitives/report.tsx +0 -357
  135. package/primitives/skeleton.css +0 -82
  136. package/primitives/skeleton.tsx +0 -56
  137. package/primitives/slider.css +0 -179
  138. package/primitives/slider.tsx +0 -69
  139. package/primitives/slug.css +0 -87
  140. package/primitives/slug.tsx +0 -37
  141. package/primitives/status.css +0 -427
  142. package/primitives/status.tsx +0 -323
  143. package/primitives/strip.css +0 -40
  144. package/primitives/surface.css +0 -88
  145. package/primitives/surface.tsx +0 -100
  146. package/primitives/table.css +0 -227
  147. package/primitives/table.tsx +0 -122
  148. package/primitives/tabs.css +0 -85
  149. package/primitives/tabs.tsx +0 -122
  150. package/primitives/tag.css +0 -46
  151. package/primitives/tag.tsx +0 -33
  152. package/primitives/text.css +0 -127
  153. package/primitives/toc.css +0 -65
  154. package/primitives/toc.tsx +0 -42
  155. package/primitives/tooltip.css +0 -56
  156. package/primitives/tooltip.tsx +0 -103
  157. package/rules/design-system.md +0 -154
  158. package/rules/grid-and-layout.md +0 -166
  159. package/scripts/generate-exports.mjs +0 -61
  160. package/scripts/generate-type-css.mjs +0 -130
  161. package/sections/faq-island.tsx +0 -102
  162. package/sections/faq.css +0 -213
  163. package/sections/faq.tsx +0 -46
  164. package/sections/footer-nav.tsx +0 -95
  165. package/sections/footer-signature.css +0 -223
  166. package/sections/footer-signature.tsx +0 -127
  167. package/sections/footer.css +0 -735
  168. package/sections/footer.tsx +0 -286
  169. package/sections/gallery-overlay.css +0 -213
  170. package/sections/gallery-overlay.tsx +0 -267
  171. package/sections/landing-benefits.css +0 -59
  172. package/sections/landing-benefits.tsx +0 -81
  173. package/sections/landing-closer.css +0 -23
  174. package/sections/landing-closer.tsx +0 -26
  175. package/sections/landing-hero.css +0 -80
  176. package/sections/landing-hero.tsx +0 -69
  177. package/sections/landing-quote.css +0 -19
  178. package/sections/landing-quote.tsx +0 -30
  179. package/sections/landing-sample.ts +0 -66
  180. package/sections/landing.css +0 -45
  181. package/sections/landing.tsx +0 -69
  182. package/sections/load-orchestrator.tsx +0 -43
  183. package/sections/load.css +0 -138
  184. package/sections/nav-desktop.css +0 -530
  185. package/sections/nav-desktop.tsx +0 -155
  186. package/sections/nav-menu.css +0 -57
  187. package/sections/nav-menu.tsx +0 -112
  188. package/sections/nav-mobile.css +0 -571
  189. package/sections/nav-mobile.tsx +0 -222
  190. package/sections/nav.css +0 -127
  191. package/sections/nav.tsx +0 -394
  192. package/sections/site-chat-data.ts +0 -16
  193. package/sections/site-chat-open.tsx +0 -25
  194. package/sections/site-chat.tsx +0 -67
  195. package/site-links.ts +0 -41
  196. package/site.ts +0 -2
  197. package/themes/inverted.css +0 -139
  198. package/tokens/fonts.css +0 -38
  199. package/tokens/motion.css +0 -150
  200. package/tokens/primitives.css +0 -163
  201. package/tokens/semantic.css +0 -159
  202. package/tokens/type-styles.json +0 -145
  203. package/tokens/type.css +0 -1548
  204. package/widgets.css +0 -78
@@ -1,357 +0,0 @@
1
- /** The report kit: the parts a Grader report is built from (ks-Grader
2
- * "Components · Grader report & summary", 170:3424). A panel head, a
3
- * fact and a fact chip, the locked chip and the report link an area card
4
- * ends in, the "You" badge, the rank badge, the area card itself, a
5
- * score row and a finding row that open to their fix, and a stat card. Each takes its
6
- * words and data as props; the consumer composes them with real data.
7
- * Styles live in report.css. */
8
-
9
- import type { ReactNode } from "react";
10
- import { IconArrowRight, IconChevronDownMedium, IconLock } from "../icons";
11
- import type { Grade } from "./status";
12
-
13
- function cx(...parts: (string | false | undefined)[]) {
14
- return parts.filter(Boolean).join(" ");
15
- }
16
-
17
- /** The head of a panel: a title at the left, a meta line at its right
18
- * (under it on a phone); the body beneath starts at its hairline. */
19
- export function PanelHead({
20
- title,
21
- meta,
22
- as: Tag = "h3",
23
- children,
24
- }: {
25
- title: ReactNode;
26
- meta?: ReactNode;
27
- as?: "h2" | "h3" | "h4";
28
- /** A mark beside the meta (a grade pill). */
29
- children?: ReactNode;
30
- }) {
31
- return (
32
- <header className="rpt-panel-head">
33
- <Tag className="type type-fixed ts-text-lg-medium rpt-panel-title">{title}</Tag>
34
- {(meta || children) && (
35
- <div className="rpt-panel-meta">
36
- {children}
37
- {meta && <span className="type type-fixed ts-text-sm-light rpt-panel-note">{meta}</span>}
38
- </div>
39
- )}
40
- </header>
41
- );
42
- }
43
-
44
- /** A labelled fact on the cover: label over value, with an optional detail. */
45
- export function Fact({
46
- label,
47
- value,
48
- detail,
49
- children,
50
- }: {
51
- label: ReactNode;
52
- value: ReactNode;
53
- detail?: ReactNode;
54
- /** Replaces the value while it has not landed (a skeleton). */
55
- children?: ReactNode;
56
- }) {
57
- return (
58
- <div className="rpt-fact">
59
- <dt className="type type-fixed ts-text-xs-light rpt-fact-label">{label}</dt>
60
- <dd className="type type-fixed ts-text-md-light rpt-fact-value">
61
- {children ?? (
62
- <>
63
- {value}
64
- {detail && <span className="rpt-fact-detail"> {detail}</span>}
65
- </>
66
- )}
67
- </dd>
68
- </div>
69
- );
70
- }
71
-
72
- /** A fact in a chip under a report hero; `flag` marks a problem. */
73
- export function FactChip({
74
- tone = "neutral",
75
- children,
76
- }: {
77
- tone?: "neutral" | "flag";
78
- children: ReactNode;
79
- }) {
80
- return (
81
- <span className="type type-fixed ts-text-sm-light rpt-fact-chip" data-tone={tone}>
82
- {tone === "flag" && <i className="rpt-fact-chip-flag" aria-hidden="true" />}
83
- {children}
84
- </span>
85
- );
86
- }
87
-
88
- /** The area a finding belongs to, in a `FindingRow`'s chip slot
89
- * (ks-Grader grader/area-chip). */
90
- export function AreaChip({ children }: { children: ReactNode }) {
91
- return <span className="type type-fixed ts-text-xs-medium rpt-area-chip">{children}</span>;
92
- }
93
-
94
- /** The mark on a summary's area card: what the full report holds. */
95
- export function LockedChip({ children }: { children: ReactNode }) {
96
- return (
97
- <span className="type type-fixed ts-text-sm-light rpt-locked">
98
- <IconLock size={16} />
99
- {children}
100
- </span>
101
- );
102
- }
103
-
104
- /** Where the business ranks for a search (ks-Grader grader/rank-badge):
105
- * first, placed in the pack, or outside it. `rank` null is outside the
106
- * top of the results; the consumer supplies the words for that. */
107
- export function RankBadge({ rank, children }: { rank: number | null; children: ReactNode }) {
108
- const tier = rank == null ? "none" : rank === 1 ? "first" : rank <= 3 ? "top" : "placed";
109
- return (
110
- <span className="type type-fixed ts-text-sm-medium rpt-rank" data-tier={tier}>
111
- {children}
112
- </span>
113
- );
114
- }
115
-
116
- /** A measured value on a scale with bands (ks-Grader 06, the speed
117
- * cards): the segments in order with the share of the bar each takes
118
- * and its tone, and the marker at `at` (0–1). The consumer owns the
119
- * thresholds; the bar only draws them. */
120
- export function ScaleBar({
121
- segments,
122
- at,
123
- }: {
124
- segments: ReadonlyArray<{ share: number; tone: Grade }>;
125
- at: number;
126
- }) {
127
- const clamped = Math.min(1, Math.max(0, at));
128
- return (
129
- <span className="rpt-scale" aria-hidden="true" style={{ "--at": clamped }}>
130
- {segments.map((s, i) => (
131
- <i key={i} className="rpt-scale-seg" data-tone={s.tone} style={{ flexGrow: s.share }} />
132
- ))}
133
- <i className="rpt-scale-mark" />
134
- </span>
135
- );
136
- }
137
-
138
- /** The "You" mark beside the subject's own row in a ranked list. */
139
- export function YouBadge({ children }: { children: ReactNode }) {
140
- return <span className="type type-fixed ts-text-sm-medium rpt-you">{children}</span>;
141
- }
142
-
143
- /** The link an unlocked area card ends in. */
144
- export function ReportLink({
145
- href,
146
- className,
147
- children,
148
- }: {
149
- /** Without one the link is a cue inside a box that is itself the link. */
150
- href?: string;
151
- className?: string;
152
- children: ReactNode;
153
- }) {
154
- const cls = cx("type type-fixed ts-text-sm-regular rpt-link", className);
155
- const body = (
156
- <>
157
- {children}
158
- <IconArrowRight size={16} />
159
- </>
160
- );
161
- return href ? (
162
- <a className={cls} href={href}>
163
- {body}
164
- </a>
165
- ) : (
166
- <span className={cls}>{body}</span>
167
- );
168
- }
169
-
170
- /** One of the four area cards under the Keystone Score: the area's
171
- * name and grade pill, its ring, a short summary, and a footer — the
172
- * locked chip on the summary, the report link once unlocked. In a
173
- * `AreaCards` grid the cards are a 2 × 2 from the tablet anchor and
174
- * full-width rows split by hairlines on a phone. */
175
- export function AreaCard({
176
- title,
177
- pill,
178
- ring,
179
- summary,
180
- footer,
181
- href,
182
- attrs,
183
- as: Tag = "h3",
184
- }: {
185
- title: ReactNode;
186
- pill: ReactNode;
187
- ring: ReactNode;
188
- summary: ReactNode;
189
- footer: ReactNode;
190
- /** The whole card is the link to the area's report; the footer is then
191
- * a cue (`ReportLink` without an href), never a second link. */
192
- href?: string;
193
- /** Data and aria attributes for the link (a host's tracking hook). */
194
- attrs?: Record<`data-${string}` | `aria-${string}`, string | undefined>;
195
- as?: "h3" | "h4";
196
- }) {
197
- const body = (
198
- <>
199
- <div className="rpt-area-head">
200
- <div className="rpt-area-title">
201
- <Tag className="type type-fixed ts-text-lg-light rpt-area-name">{title}</Tag>
202
- {pill}
203
- </div>
204
- {ring}
205
- </div>
206
- <p className="type type-fixed ts-text-sm-light rpt-area-summary">{summary}</p>
207
- <div className="rpt-area-footer">{footer}</div>
208
- </>
209
- );
210
- return href ? (
211
- <a className="rpt-area" href={href} {...attrs}>
212
- {body}
213
- </a>
214
- ) : (
215
- <article className="rpt-area">{body}</article>
216
- );
217
- }
218
-
219
- export function AreaCards({ children }: { children: ReactNode }) {
220
- return <div className="rpt-areas">{children}</div>;
221
- }
222
-
223
- /** The column heads over a list of score rows, on the rows' columns. The
224
- * heads are decoration for a sighted reader; each row says its own. */
225
- export function ScoreRowHead({
226
- area,
227
- score,
228
- grade,
229
- }: {
230
- area: ReactNode;
231
- score: ReactNode;
232
- grade: ReactNode;
233
- }) {
234
- return (
235
- <div className="rpt-score-head" aria-hidden="true">
236
- <span className="type type-fixed ts-text-xs-light">{area}</span>
237
- <span className="type type-fixed ts-text-xs-light rpt-score-head-value">{score}</span>
238
- <span className="type type-fixed ts-text-xs-light rpt-score-head-grade">{grade}</span>
239
- </div>
240
- );
241
- }
242
-
243
- /** A row in the nine-area list: area, score, grade, and — when it opens
244
- * — the finding and first fix beneath. `score` null is unmeasured: the
245
- * slot stays empty and the pill says so. */
246
- export function ScoreRow({
247
- area,
248
- score,
249
- pill,
250
- grade,
251
- open,
252
- children,
253
- }: {
254
- area: ReactNode;
255
- score: number | null;
256
- pill: ReactNode;
257
- grade: Grade;
258
- /** Open on first render (the summary shows one). */
259
- open?: boolean;
260
- /** The body the row opens to; without it the row is flat. */
261
- children?: ReactNode;
262
- }) {
263
- const head = (
264
- <>
265
- <span className="type type-fixed ts-text-lg-regular rpt-score-area">{area}</span>
266
- <span className="type type-fixed ts-display-serif-xs-light rpt-score-value">
267
- {score == null ? "" : Math.round(score)}
268
- </span>
269
- <span className="rpt-score-grade">{pill}</span>
270
- {children && <IconChevronDownMedium className="rpt-row-chevron" />}
271
- </>
272
- );
273
- if (!children) {
274
- return (
275
- <div className="rpt-score-row" data-grade={grade}>
276
- {head}
277
- </div>
278
- );
279
- }
280
- return (
281
- <details className="rpt-score-row" data-grade={grade} open={open}>
282
- <summary className="rpt-score-summary">{head}</summary>
283
- <div className="rpt-row-body">{children}</div>
284
- </details>
285
- );
286
- }
287
-
288
- /** A finding, numbered, with the area it belongs to as a chip; opens to
289
- * its fix when it has one. On a phone the chip moves under the finding. */
290
- export function FindingRow({
291
- number,
292
- finding,
293
- chip,
294
- open,
295
- children,
296
- }: {
297
- number: ReactNode;
298
- finding: ReactNode;
299
- chip?: ReactNode;
300
- open?: boolean;
301
- children?: ReactNode;
302
- }) {
303
- const head = (
304
- <>
305
- <span className="type type-fixed ts-text-sm-light rpt-finding-number">{number}</span>
306
- <span className="type type-fixed ts-text-md-light rpt-finding-text">{finding}</span>
307
- {chip && <span className="rpt-finding-chip">{chip}</span>}
308
- {children && <IconChevronDownMedium className="rpt-row-chevron" />}
309
- </>
310
- );
311
- if (!children) {
312
- return <div className="rpt-finding-row">{head}</div>;
313
- }
314
- return (
315
- <details className="rpt-finding-row" open={open}>
316
- <summary className="rpt-finding-summary">{head}</summary>
317
- <div className="rpt-row-body rpt-finding-body">{children}</div>
318
- </details>
319
- );
320
- }
321
-
322
- /** A statistic in a panel: a label, the figure, a line under it and a
323
- * note. In a `StatCards` row the cards sit side by side from the first
324
- * desktop anchor and stack as hairline rows below it. */
325
- export function StatCard({
326
- label,
327
- value,
328
- sub,
329
- note,
330
- }: {
331
- label: ReactNode;
332
- value: ReactNode;
333
- sub?: ReactNode;
334
- note?: ReactNode;
335
- }) {
336
- return (
337
- <div className="rpt-stat">
338
- <span className="type type-fixed ts-text-sm-regular rpt-stat-label">{label}</span>
339
- <span className="type ts-display-serif-md-light rpt-stat-value">{value}</span>
340
- {sub && (
341
- <span className="type type-fixed ts-display-serif-3xs-extralight rpt-stat-sub">{sub}</span>
342
- )}
343
- {note && <span className="type type-fixed ts-text-xs-light rpt-stat-note">{note}</span>}
344
- </div>
345
- );
346
- }
347
-
348
- /** The row of cards; `columns` is how many sit side by side at the
349
- * desktop anchors (the summary's three standings, the website page's four
350
- * speed figures). */
351
- export function StatCards({ columns = 3, children }: { columns?: 3 | 4; children: ReactNode }) {
352
- return (
353
- <div className="rpt-stats" style={{ "--rpt-stat-cols": columns }}>
354
- {children}
355
- </div>
356
- );
357
- }
@@ -1,82 +0,0 @@
1
- /* Skeleton: a shimmering stand-in the size of the content it waits for.
2
- A measured skeleton wraps transparent sample text so its box is the
3
- value's box under the host's type; a drawn one takes its size from the
4
- host. The shimmer is a highlight sweeping the ground — a background
5
- position animating, never a colour transition. Reduced motion settles
6
- it (base.css) as a still block. */
7
-
8
- /* Designed constants for this file. The colours resolve on the element,
9
- not on :root, so a themed host (data-theme) supplies its own tokens. */
10
- :root {
11
- /* The text line's box inside its line-height, and the short last line. */
12
- --skeleton-text-h: 0.72em;
13
- --skeleton-last-line: 62%;
14
- }
15
-
16
- .skeleton {
17
- --skeleton-ground: var(--color-bg-400);
18
- --skeleton-highlight: var(--color-bg-200);
19
- display: inline-block;
20
- vertical-align: middle;
21
- box-sizing: border-box;
22
- border-radius: var(--radius-xs);
23
- color: transparent;
24
- background-color: var(--skeleton-ground);
25
- background-image: linear-gradient(
26
- 90deg,
27
- var(--skeleton-ground) 0%,
28
- var(--skeleton-highlight) 50%,
29
- var(--skeleton-ground) 100%
30
- );
31
- background-size: 200% 100%;
32
- background-position: 200% 0;
33
- pointer-events: none;
34
- user-select: none;
35
- animation: skeleton-shimmer var(--motion-shimmer-duration) var(--motion-shimmer-ease) infinite;
36
- }
37
- .skeleton * {
38
- visibility: hidden;
39
- }
40
- /* A text stand-in sits on the line like the glyphs it replaces, and never
41
- runs past its line: a measure longer than the column ends where the
42
- wrapped value would. */
43
- .skeleton[data-shape="text"] {
44
- height: var(--skeleton-text-h);
45
- min-width: 1ch;
46
- max-width: 100%;
47
- }
48
- .skeleton[data-shape="text"] .skeleton-measure {
49
- display: inline-block;
50
- height: 0;
51
- overflow: hidden;
52
- white-space: pre;
53
- }
54
- .skeleton[data-shape="block"] {
55
- display: block;
56
- width: 100%;
57
- height: 100%;
58
- }
59
- .skeleton[data-shape="circle"] {
60
- flex: none;
61
- border-radius: var(--radius-full);
62
- }
63
-
64
- /* Lines of copy: full lines and a short last one, stepped by the line gap. */
65
- .skeleton-lines {
66
- display: flex;
67
- flex-direction: column;
68
- gap: calc(1lh - var(--skeleton-text-h));
69
- width: 100%;
70
- }
71
- .skeleton-lines > .skeleton {
72
- width: 100%;
73
- }
74
- .skeleton-lines > .skeleton:last-child {
75
- width: var(--skeleton-last-line);
76
- }
77
-
78
- @keyframes skeleton-shimmer {
79
- to {
80
- background-position: -200% 0;
81
- }
82
- }
@@ -1,56 +0,0 @@
1
- /** Skeleton: the shimmering stand-in for content that has not arrived.
2
- *
3
- * The law: a surface never paints a temporary value while it loads. A
4
- * value that is not yet known renders as a skeleton the size the value
5
- * will be, so nothing moves when it lands. Two forms:
6
- *
7
- * - **Measured** (`measure`): a text stand-in that sizes itself to a
8
- * sample of the final value under the host's own type ("00" for a
9
- * two-digit score, "Not run yet" for the longest label). The sample is
10
- * transparent; the shimmer paints its box. Mount it exactly where the
11
- * value will render, with the same `type` classes.
12
- * - **Drawn** (`shape`): a block, a circle, or `lines` of copy, sized
13
- * from the host (`width`/`height` on the element or its class) when
14
- * no sample text exists — an image, a ring, a paragraph.
15
- *
16
- * Decorative to assistive technology: the host region carries
17
- * `aria-busy` while any skeleton is mounted. Reduced motion renders it
18
- * settled (base.css). Styles live in skeleton.css. */
19
-
20
- type Shape = "block" | "circle" | "text";
21
-
22
- interface SkeletonProps {
23
- /** Sample text the stand-in sizes itself to, under the host's type. */
24
- measure?: string;
25
- /** A drawn stand-in with no sample: a block, a circle, or a text line. */
26
- shape?: Shape;
27
- /** Drawn lines of copy; the last line runs short, as a paragraph does. */
28
- lines?: number;
29
- className?: string;
30
- }
31
-
32
- function cx(...parts: Array<string | undefined | false>): string {
33
- return parts.filter(Boolean).join(" ");
34
- }
35
-
36
- export function Skeleton({ measure, shape, lines, className }: SkeletonProps) {
37
- if (lines && lines > 1) {
38
- return (
39
- <span className={cx("skeleton-lines", className)} aria-hidden="true">
40
- {Array.from({ length: lines }, (_, i) => (
41
- <span key={i} className="skeleton" data-shape="text" />
42
- ))}
43
- </span>
44
- );
45
- }
46
- if (measure !== undefined) {
47
- return (
48
- <span className={cx("skeleton", className)} data-shape="text" aria-hidden="true">
49
- <span className="skeleton-measure">{measure}</span>
50
- </span>
51
- );
52
- }
53
- return (
54
- <span className={cx("skeleton", className)} data-shape={shape ?? "block"} aria-hidden="true" />
55
- );
56
- }
@@ -1,179 +0,0 @@
1
- /* Interior geometry scales from --sldr-w; focus and hit areas stay fixed. */
2
-
3
-
4
- .sldr {
5
- --sldr-track-bevel: inset 0 1px 0 rgba(0, 0, 0, 0.25);
6
- --sldr-thumb-bevel:
7
- inset -1px -1px 0 rgba(0, 0, 0, 0.3),
8
- inset 1px 1px 0 rgba(255, 255, 255, 0.25),
9
- 1px 1px 0 rgba(0, 0, 0, 0.1);
10
- display: inline-flex;
11
- flex-direction: column;
12
- gap: calc(var(--_u) * 11);
13
- --_W0: 224;
14
- --_u: calc(var(--sldr-w, calc(var(--_W0) * 1px)) / var(--_W0));
15
- width: calc(var(--_u) * var(--_W0));
16
- }
17
- /* Size is the slider's own data-size, or the mount's --sldr-size keyword
18
- when it renders with size="inherit". W0 is the designed width. */
19
- .sldr[data-size="sm"] {
20
- --_W0: 304;
21
- }
22
- .sldr[data-size="md"] {
23
- --_W0: 192;
24
- }
25
- @container style(--sldr-size: sm) {
26
- .sldr:not([data-size]) { --_W0: 304; }
27
- }
28
- @container style(--sldr-size: md) {
29
- .sldr:not([data-size]) { --_W0: 192; }
30
- }
31
-
32
- /* Rest fraction per stop: four stops, thirds apart (1150:25523). */
33
- .sldr[data-k="0"] {
34
- --_kf: 0;
35
- }
36
- .sldr[data-k="1"] {
37
- --_kf: calc(1 / 3);
38
- }
39
- .sldr[data-k="2"] {
40
- --_kf: calc(2 / 3);
41
- }
42
- .sldr[data-k="3"] {
43
- --_kf: 1;
44
- }
45
-
46
- /* ---- the thumb row (18 designed) ---- */
47
-
48
- .sldr-row {
49
- position: relative;
50
- height: calc(var(--_u) * 18);
51
- touch-action: pan-y;
52
- }
53
- /* Extend the pointer surface to 44px without changing drawn geometry. */
54
- .sldr-row::before {
55
- content: "";
56
- position: absolute;
57
- left: 0;
58
- right: 0;
59
- top: calc((min(var(--_u) * 18, 44px) - 44px) / 2);
60
- bottom: calc((min(var(--_u) * 18, 44px) - 44px) / 2);
61
- }
62
-
63
- /* The track uses the shared inset bevel. */
64
- .sldr-track {
65
- position: absolute;
66
- left: 0;
67
- right: 0;
68
- top: calc(var(--_u) * 6);
69
- height: calc(var(--_u) * 6);
70
- border-radius: var(--radius-full);
71
- background: linear-gradient(90deg, var(--color-bg-300), var(--color-bg-500));
72
- box-shadow: var(--sldr-track-bevel);
73
- }
74
-
75
- /* Notches mark the interior stops at each third. */
76
- .sldr-notch {
77
- position: absolute;
78
- top: calc(var(--_u) * 6);
79
- left: calc(100% * var(--n) / 3 - var(--_u) * 0.5);
80
- width: calc(var(--_u) * 1);
81
- height: calc(var(--_u) * 3);
82
- background: var(--color-alpha-black-20);
83
- }
84
-
85
- /* progress fill — left edge to the thumb center, a third per stop
86
- (the set's own states); the hue layers carry the 200 → 400 persona
87
- gradients and crossfade on the snap clock */
88
- .sldr-progress {
89
- position: absolute;
90
- left: 0;
91
- top: calc(var(--_u) * 6);
92
- height: calc(var(--_u) * 6);
93
- width: calc(var(--sldr-f, var(--_kf)) * 100%);
94
- border-radius: var(--radius-full);
95
- overflow: clip;
96
- transition: width var(--ps-snap-dur) var(--ps-snap-ease);
97
- }
98
- /* Each hue layer carries the bevel so it paints above the fill. */
99
- .sldr-p {
100
- position: absolute;
101
- inset: 0;
102
- border-radius: inherit;
103
- box-shadow: var(--sldr-track-bevel);
104
- opacity: 0;
105
- transition: opacity var(--ps-snap-dur) var(--ps-snap-ease);
106
- }
107
- .sldr-p[data-hue="pink"] {
108
- background: linear-gradient(90deg, var(--color-pink-200), var(--color-pink-400));
109
- }
110
- .sldr-p[data-hue="teal"] {
111
- background: linear-gradient(90deg, var(--color-teal-200), var(--color-teal-400));
112
- }
113
- .sldr-p[data-hue="blue"] {
114
- background: linear-gradient(90deg, var(--color-blue-200), var(--color-blue-400));
115
- }
116
- .sldr-p[data-hue="purple"] {
117
- background: linear-gradient(90deg, var(--color-purple-200), var(--color-purple-400));
118
- }
119
- .sldr[data-hue="pink"] .sldr-p[data-hue="pink"],
120
- .sldr[data-hue="teal"] .sldr-p[data-hue="teal"],
121
- .sldr[data-hue="blue"] .sldr-p[data-hue="blue"],
122
- .sldr[data-hue="purple"] .sldr-p[data-hue="purple"] {
123
- opacity: 1;
124
- }
125
-
126
- /* The thumb rests at its stop's fraction of the travel. */
127
- .sldr-thumb {
128
- position: absolute;
129
- top: 0;
130
- width: calc(var(--_u) * 18);
131
- height: calc(var(--_u) * 18);
132
- left: calc(var(--sldr-f, var(--_kf)) * (100% - var(--_u) * 18));
133
- border-radius: var(--radius-full);
134
- background: var(--color-text-300);
135
- box-shadow: var(--sldr-thumb-bevel);
136
- transition: left var(--ps-snap-dur) var(--ps-snap-ease);
137
- }
138
-
139
- /* Dragging tracks the pointer without transition lag. */
140
- .sldr[data-dragging] .sldr-thumb,
141
- .sldr[data-dragging] .sldr-progress {
142
- transition: none;
143
- }
144
-
145
- /* The native input supplies semantics and matches the 44px hit area. */
146
- .sldr-input {
147
- position: absolute;
148
- left: 0;
149
- right: 0;
150
- top: calc((min(var(--_u) * 18, 44px) - 44px) / 2);
151
- bottom: calc((min(var(--_u) * 18, 44px) - 44px) / 2);
152
- width: 100%;
153
- margin: 0;
154
- opacity: 0;
155
- pointer-events: none;
156
- }
157
- /* Draw keyboard focus on the controlled thumb. */
158
- .sldr:has(.sldr-input:focus-visible) .sldr-thumb {
159
- box-shadow:
160
- var(--sldr-thumb-bevel),
161
- 0 0 0 var(--ring-w) var(--color-border-200);
162
- }
163
-
164
- /* ---- the label row (16 designed, 11 below the thumb row) ---- */
165
-
166
- .sldr-labels {
167
- display: flex;
168
- align-items: center;
169
- justify-content: space-between;
170
- color: var(--color-text-400);
171
- white-space: nowrap;
172
- --fs-px: calc(var(--_u) * var(--fs-band));
173
- --lh-px: calc(var(--_u) * var(--lh-band));
174
- }
175
- .sldr-glyph {
176
- width: calc(var(--_u) * 13);
177
- height: calc(var(--_u) * 10);
178
- color: var(--color-bg-600);
179
- }