@keystone-sites/marketing-design-system 1.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 (130) hide show
  1. package/AGENTS.md +163 -0
  2. package/README.md +85 -0
  3. package/assets/media/brand/ks-lockup.svg +13 -0
  4. package/assets/media/brand/ks-logomark.svg +4 -0
  5. package/assets/media/brand/ks-wordmark-inline.svg +13 -0
  6. package/assets/media/brand/ks-wordmark.svg +11 -0
  7. package/assets/media/fonts/gt-standard-standard-vf.woff2 +0 -0
  8. package/assets/media/fonts/pp-kyoto-variable-upright-vf.woff2 +0 -0
  9. package/base.css +111 -0
  10. package/css-vars.d.ts +10 -0
  11. package/grid/engine.css +368 -0
  12. package/grid/field-hash.ts +31 -0
  13. package/grid/field.tsx +48 -0
  14. package/grid/gates.cjs +34 -0
  15. package/grid/region.tsx +97 -0
  16. package/icons.tsx +1224 -0
  17. package/index.css +77 -0
  18. package/lib/autoplay-gate.ts +88 -0
  19. package/lib/focus-trap.ts +42 -0
  20. package/lib/grader.ts +131 -0
  21. package/lib/legal-data.ts +1 -0
  22. package/lib/legal.ts +41 -0
  23. package/lib/noise.tsx +114 -0
  24. package/lib/render-boundary.tsx +27 -0
  25. package/lib/scroll-lock.ts +25 -0
  26. package/lib/swipe.ts +124 -0
  27. package/lib/use-active-section.ts +43 -0
  28. package/lib/use-count-up.ts +26 -0
  29. package/lib/use-grader-search.ts +118 -0
  30. package/lib/use-video-carousel.ts +271 -0
  31. package/media.ts +558 -0
  32. package/package.json +201 -0
  33. package/primitives/button-inline.css +52 -0
  34. package/primitives/button-inline.tsx +38 -0
  35. package/primitives/buttons.css +449 -0
  36. package/primitives/buttons.tsx +263 -0
  37. package/primitives/case-study-button.css +71 -0
  38. package/primitives/case-study-button.tsx +28 -0
  39. package/primitives/case-study-card.css +318 -0
  40. package/primitives/case-study-card.tsx +116 -0
  41. package/primitives/closer-row.css +14 -0
  42. package/primitives/closer-row.tsx +22 -0
  43. package/primitives/cta-row.css +41 -0
  44. package/primitives/cta-row.tsx +39 -0
  45. package/primitives/disclosure.css +210 -0
  46. package/primitives/disclosure.tsx +144 -0
  47. package/primitives/faq-question.css +220 -0
  48. package/primitives/faq-question.tsx +55 -0
  49. package/primitives/field.css +225 -0
  50. package/primitives/field.tsx +266 -0
  51. package/primitives/footer-item.css +72 -0
  52. package/primitives/footer-item.tsx +42 -0
  53. package/primitives/grader-menu.tsx +84 -0
  54. package/primitives/grader.css +302 -0
  55. package/primitives/grader.tsx +284 -0
  56. package/primitives/modal.css +151 -0
  57. package/primitives/modal.tsx +90 -0
  58. package/primitives/notice.css +39 -0
  59. package/primitives/notice.tsx +56 -0
  60. package/primitives/persona-card.css +374 -0
  61. package/primitives/persona-card.tsx +74 -0
  62. package/primitives/picture.css +11 -0
  63. package/primitives/picture.tsx +41 -0
  64. package/primitives/plan-card.css +378 -0
  65. package/primitives/plan-card.tsx +91 -0
  66. package/primitives/prose.css +118 -0
  67. package/primitives/prose.tsx +170 -0
  68. package/primitives/ramps.css +84 -0
  69. package/primitives/slider.css +179 -0
  70. package/primitives/slider.tsx +69 -0
  71. package/primitives/slug.css +87 -0
  72. package/primitives/slug.tsx +37 -0
  73. package/primitives/status.css +298 -0
  74. package/primitives/status.tsx +222 -0
  75. package/primitives/strip.css +40 -0
  76. package/primitives/surface.css +78 -0
  77. package/primitives/surface.tsx +95 -0
  78. package/primitives/table.css +226 -0
  79. package/primitives/table.tsx +122 -0
  80. package/primitives/tabs.css +85 -0
  81. package/primitives/tabs.tsx +122 -0
  82. package/primitives/text.css +110 -0
  83. package/primitives/toc.css +65 -0
  84. package/primitives/toc.tsx +42 -0
  85. package/rules/design-system.md +154 -0
  86. package/rules/grid-and-layout.md +166 -0
  87. package/scripts/generate-exports.mjs +61 -0
  88. package/scripts/generate-type-css.mjs +130 -0
  89. package/sections/faq-island.tsx +102 -0
  90. package/sections/faq.css +213 -0
  91. package/sections/faq.tsx +46 -0
  92. package/sections/footer-nav.tsx +95 -0
  93. package/sections/footer-signature.css +183 -0
  94. package/sections/footer-signature.tsx +114 -0
  95. package/sections/footer.css +735 -0
  96. package/sections/footer.tsx +283 -0
  97. package/sections/gallery-overlay.css +213 -0
  98. package/sections/gallery-overlay.tsx +267 -0
  99. package/sections/landing-benefits.css +59 -0
  100. package/sections/landing-benefits.tsx +81 -0
  101. package/sections/landing-closer.css +23 -0
  102. package/sections/landing-closer.tsx +26 -0
  103. package/sections/landing-hero.css +80 -0
  104. package/sections/landing-hero.tsx +69 -0
  105. package/sections/landing-quote.css +19 -0
  106. package/sections/landing-quote.tsx +30 -0
  107. package/sections/landing-sample.ts +66 -0
  108. package/sections/landing.css +45 -0
  109. package/sections/landing.tsx +69 -0
  110. package/sections/load-orchestrator.tsx +43 -0
  111. package/sections/load.css +138 -0
  112. package/sections/nav-desktop.css +530 -0
  113. package/sections/nav-desktop.tsx +155 -0
  114. package/sections/nav-mobile.css +571 -0
  115. package/sections/nav-mobile.tsx +222 -0
  116. package/sections/nav.css +126 -0
  117. package/sections/nav.tsx +394 -0
  118. package/sections/site-chat-data.ts +16 -0
  119. package/sections/site-chat-open.tsx +25 -0
  120. package/sections/site-chat.tsx +67 -0
  121. package/site-links.ts +36 -0
  122. package/site.ts +2 -0
  123. package/themes/inverted.css +139 -0
  124. package/tokens/fonts.css +38 -0
  125. package/tokens/motion.css +125 -0
  126. package/tokens/primitives.css +163 -0
  127. package/tokens/semantic.css +153 -0
  128. package/tokens/type-styles.json +145 -0
  129. package/tokens/type.css +1548 -0
  130. package/widgets.css +78 -0
@@ -0,0 +1,170 @@
1
+ /** The prose kit: the small set of text roles a product surface is
2
+ * written in — an eyebrow, body copy at three sizes, a serif title, a
3
+ * tabular figure, a section head, a dotted list. Each role is a `type`
4
+ * element carrying its Figma step (`ts-…`) at the step's material size;
5
+ * the role class adds only colour and casing. Styles live in prose.css. */
6
+
7
+ import type { ElementType, ReactNode } from "react";
8
+
9
+ function cx(...parts: (string | false | undefined)[]) {
10
+ return parts.filter(Boolean).join(" ");
11
+ }
12
+
13
+ /** A small caps label that names a sheet or a group. */
14
+ export function Eyebrow({
15
+ as: Tag = "p",
16
+ tone,
17
+ className,
18
+ children,
19
+ }: {
20
+ as?: ElementType;
21
+ tone?: "teal";
22
+ className?: string;
23
+ children: ReactNode;
24
+ }) {
25
+ return (
26
+ <Tag className={cx("type type-fixed ts-text-xs-medium eyebrow", className)} data-tone={tone}>
27
+ {children}
28
+ </Tag>
29
+ );
30
+ }
31
+
32
+ type CopySize = "xs" | "sm" | "md";
33
+ type CopyWeight = "light" | "medium";
34
+
35
+ const COPY_STEP: Record<CopySize, Record<CopyWeight, string>> = {
36
+ xs: { light: "ts-text-xs-light", medium: "ts-text-xs-medium" },
37
+ sm: { light: "ts-text-sm-light", medium: "ts-text-sm-medium" },
38
+ md: { light: "ts-text-md-light", medium: "ts-text-md-medium" },
39
+ };
40
+
41
+ /** Body copy. Size and weight pick the step; tone tints; `clip` keeps
42
+ * one line (or two) with an ellipsis; `num` sets tabular figures. */
43
+ export function Copy({
44
+ as: Tag = "p",
45
+ size = "sm",
46
+ weight = "light",
47
+ tone,
48
+ clip,
49
+ num,
50
+ breakAll,
51
+ className,
52
+ children,
53
+ }: {
54
+ as?: ElementType;
55
+ size?: CopySize;
56
+ weight?: CopyWeight;
57
+ tone?: "poor" | "teal";
58
+ clip?: 1 | 2;
59
+ num?: boolean;
60
+ /** Break anywhere (URLs, identifiers). */
61
+ breakAll?: boolean;
62
+ className?: string;
63
+ children: ReactNode;
64
+ }) {
65
+ return (
66
+ <Tag
67
+ className={cx(
68
+ "type type-fixed",
69
+ COPY_STEP[size][weight],
70
+ "copy",
71
+ num && "copy-num",
72
+ breakAll && "copy-break",
73
+ className,
74
+ )}
75
+ data-size={size}
76
+ data-weight={weight}
77
+ data-tone={tone}
78
+ data-clip={clip}
79
+ >
80
+ {children}
81
+ </Tag>
82
+ );
83
+ }
84
+
85
+ const TITLE_STEP = {
86
+ sm: "ts-display-serif-3xs-regular",
87
+ md: "ts-display-serif-2xs-regular",
88
+ lg: "ts-display-serif-xs-regular",
89
+ xl: "ts-display-serif-sm-regular",
90
+ } as const;
91
+
92
+ /** A serif title inside a sheet. */
93
+ export function Title({
94
+ as: Tag = "h3",
95
+ size = "md",
96
+ className,
97
+ children,
98
+ }: {
99
+ as?: ElementType;
100
+ size?: keyof typeof TITLE_STEP;
101
+ className?: string;
102
+ children: ReactNode;
103
+ }) {
104
+ return (
105
+ <Tag className={cx("type type-fixed", TITLE_STEP[size], "copy-title", className)}>
106
+ {children}
107
+ </Tag>
108
+ );
109
+ }
110
+
111
+ const FIGURE_STEP = {
112
+ sm: "ts-text-lg-medium",
113
+ md: "ts-display-sans-sm-medium",
114
+ lg: "ts-display-sans-xl-medium",
115
+ } as const;
116
+
117
+ /** A large tabular number; a hue colours it through the status ramp. */
118
+ export function Figure({
119
+ as: Tag = "p",
120
+ size = "md",
121
+ hue,
122
+ className,
123
+ children,
124
+ }: {
125
+ as?: ElementType;
126
+ size?: keyof typeof FIGURE_STEP;
127
+ hue?: string;
128
+ className?: string;
129
+ children: ReactNode;
130
+ }) {
131
+ return (
132
+ <Tag className={cx("type type-fixed", FIGURE_STEP[size], "figure", className)} data-hue={hue}>
133
+ {children}
134
+ </Tag>
135
+ );
136
+ }
137
+
138
+ /** Names a group of surfaces inside a page body. */
139
+ export function SecTitle({
140
+ as: Tag = "h2",
141
+ className,
142
+ children,
143
+ }: {
144
+ as?: ElementType;
145
+ className?: string;
146
+ children: ReactNode;
147
+ }) {
148
+ return (
149
+ <Tag className={cx("type type-fixed ts-display-serif-xs-regular sec-title", className)}>
150
+ {children}
151
+ </Tag>
152
+ );
153
+ }
154
+
155
+ export function SecSub({ className, children }: { className?: string; children: ReactNode }) {
156
+ return <p className={cx("type type-fixed ts-text-sm-light sec-sub", className)}>{children}</p>;
157
+ }
158
+
159
+ /** Short lines marked with a teal dot. */
160
+ export function DotList({ items, className }: { items: readonly ReactNode[]; className?: string }) {
161
+ return (
162
+ <ul className={cx("dot-list", className)}>
163
+ {items.map((item, i) => (
164
+ <li key={i} className="type type-fixed ts-text-sm-light">
165
+ {item}
166
+ </li>
167
+ ))}
168
+ </ul>
169
+ );
170
+ }
@@ -0,0 +1,84 @@
1
+ /* The standard type ramps: the 384 → 1344 size pairs the site's pages
2
+ share, with the Figma style switching at rt and rd1. Pair one with
3
+ its 384 class — `type ts-display-serif-sm-plus-thin ramp-h1` — and
4
+ the size runs fluidly between the anchors (primitives/text.css). A
5
+ page that needs a different pair sets its own `--fs-rd2/--lh-rd2`; nothing
6
+ here sets a size inside a gate. */
7
+
8
+ /* h1: sm-plus-thin 36/42 → 3xl-thin 72/78. */
9
+ .ramp-h1 {
10
+ color: var(--color-text-100);
11
+ --fs-rd2: var(--ts-display-serif-3xl-thin-fs);
12
+ --lh-rd2: var(--ts-display-serif-3xl-thin-lh);
13
+ }
14
+ @container (--rt) {
15
+ .ramp-h1 {
16
+ --font: var(--ts-display-serif-lg-plus-thin-font);
17
+ --ls: var(--ts-display-serif-lg-plus-thin-ls);
18
+ }
19
+ }
20
+ @container (--rd1) {
21
+ .ramp-h1 {
22
+ --font: var(--ts-display-serif-3xl-thin-font);
23
+ --ls: var(--ts-display-serif-3xl-thin-ls);
24
+ }
25
+ }
26
+
27
+ /* h2: xs-extralight 24/30 → xl-extralight 56/62. */
28
+ .ramp-h2 {
29
+ color: var(--color-text-100);
30
+ --fs-rd2: var(--ts-display-serif-xl-extralight-fs);
31
+ --lh-rd2: var(--ts-display-serif-xl-extralight-lh);
32
+ }
33
+ @container (--rt) {
34
+ .ramp-h2 {
35
+ --font: var(--ts-display-serif-md-plus-extralight-font);
36
+ --ls: var(--ts-display-serif-md-plus-extralight-ls);
37
+ }
38
+ }
39
+ @container (--rd1) {
40
+ .ramp-h2 {
41
+ --font: var(--ts-display-serif-xl-extralight-font);
42
+ --ls: var(--ts-display-serif-xl-extralight-ls);
43
+ }
44
+ }
45
+
46
+ /* body: text-md-light 16/22 → text-xl-light 20/26. */
47
+ .ramp-body {
48
+ color: var(--color-text-300);
49
+ --fs-rd2: var(--ts-text-xl-light-fs);
50
+ --lh-rd2: var(--ts-text-xl-light-lh);
51
+ }
52
+ @container (--rt) {
53
+ .ramp-body {
54
+ --font: var(--ts-text-lg-light-font);
55
+ --opsz: var(--ts-text-lg-light-opsz);
56
+ }
57
+ }
58
+ @container (--rd1) {
59
+ .ramp-body {
60
+ --font: var(--ts-text-xl-light-font);
61
+ --opsz: var(--ts-text-xl-light-opsz);
62
+ }
63
+ }
64
+
65
+ /* quote: 2xs-plus-extralight 20/24 → sm-plus-extralight 36/42; the
66
+ opening quote mark hangs into the margin. */
67
+ .ramp-quote {
68
+ color: var(--color-text-100);
69
+ text-indent: -0.434em;
70
+ --fs-rd2: var(--ts-display-serif-sm-plus-extralight-fs);
71
+ --lh-rd2: var(--ts-display-serif-sm-plus-extralight-lh);
72
+ }
73
+ @supports (hanging-punctuation: first) {
74
+ .ramp-quote {
75
+ text-indent: 0;
76
+ hanging-punctuation: first;
77
+ }
78
+ }
79
+ @container (--rt) {
80
+ .ramp-quote {
81
+ --font: var(--ts-display-serif-sm-plus-extralight-font);
82
+ --ls: var(--ts-display-serif-sm-plus-extralight-ls);
83
+ }
84
+ }
@@ -0,0 +1,179 @@
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
+ }
@@ -0,0 +1,69 @@
1
+ /** slider (613:21216 set): four rest stops, one per persona, with a hue
2
+ * per stop. The disabled native input supplies semantics until the
3
+ * section island enables it and owns pointer gestures. */
4
+
5
+ import { IconSliderArrow } from "../icons";
6
+ import type { PersonaHue } from "./persona-card";
7
+
8
+ /** Rest stop index; the island writes it to `data-k`. */
9
+ export type SliderStop = 0 | 1 | 2 | 3;
10
+ export const SLIDER_STOPS = 4;
11
+ type SliderSize = "sm" | "md" | "lg" | "inherit";
12
+
13
+ const HUES: PersonaHue[] = ["pink", "teal", "blue", "purple"];
14
+
15
+ interface SliderProps {
16
+ size?: SliderSize;
17
+ /** Accessible name for the native range input. */
18
+ label: string;
19
+ /** aria-valuetext for the resting stop (the persona name). */
20
+ valueText?: string;
21
+ forceStop?: SliderStop;
22
+ forceHue?: PersonaHue;
23
+ }
24
+
25
+ export function Slider({
26
+ size = "lg",
27
+ label,
28
+ valueText,
29
+ forceStop = 0,
30
+ forceHue = "pink",
31
+ }: SliderProps) {
32
+ return (
33
+ <span
34
+ className="sldr"
35
+ data-size={size === "inherit" ? undefined : size}
36
+ data-k={forceStop}
37
+ data-hue={forceHue}
38
+ >
39
+ <span className="sldr-row">
40
+ <i className="sldr-track" aria-hidden="true" />
41
+ <i className="sldr-progress" aria-hidden="true">
42
+ {HUES.map((hue) => (
43
+ <i key={hue} className="sldr-p" data-hue={hue} />
44
+ ))}
45
+ </i>
46
+ {/* Notches mark the interior stops, above the fill and below the thumb. */}
47
+ <i className="sldr-notch" style={{ "--n": 1 }} aria-hidden="true" />
48
+ <i className="sldr-notch" style={{ "--n": 2 }} aria-hidden="true" />
49
+ <i className="sldr-thumb" aria-hidden="true" />
50
+ <input
51
+ className="sldr-input"
52
+ type="range"
53
+ min={0}
54
+ max={SLIDER_STOPS - 1}
55
+ step={1}
56
+ defaultValue={forceStop}
57
+ disabled
58
+ aria-label={label}
59
+ aria-valuetext={valueText}
60
+ />
61
+ </span>
62
+ <span className="type ts-text-xs-regular sldr-labels">
63
+ <span>Less work</span>
64
+ <IconSliderArrow className="sldr-glyph" />
65
+ <span>More work</span>
66
+ </span>
67
+ </span>
68
+ );
69
+ }
@@ -0,0 +1,87 @@
1
+ /* Material, like the buttons: text-xs-medium at its fixed token pixels
2
+ in every band. Only the marker and gap step at the rd gate. */
3
+
4
+
5
+ .slug {
6
+ --sys-marker: 6px;
7
+ --sys-marker-rd: 7px;
8
+ display: flex;
9
+ align-items: center;
10
+ gap: var(--space-md);
11
+ margin: var(--space-none);
12
+ color: var(--color-text-400);
13
+ }
14
+ .slug-mark {
15
+ flex: none;
16
+ width: var(--sys-marker);
17
+ height: var(--sys-marker);
18
+ background: var(--color-bg-400);
19
+ }
20
+ .slug-label {
21
+ display: flex;
22
+ align-items: center;
23
+ gap: 0.5em;
24
+ min-width: 0;
25
+ }
26
+ .slug a {
27
+ color: inherit;
28
+ text-decoration: none;
29
+ }
30
+ .slug a:focus-visible {
31
+ outline: none;
32
+ box-shadow: 0 0 0 var(--ring-w) var(--color-bg-300);
33
+ }
34
+
35
+ @container (--rd1) {
36
+ .slug {
37
+ gap: var(--space-lg);
38
+ }
39
+ .slug-mark {
40
+ width: var(--sys-marker-rd);
41
+ height: var(--sys-marker-rd);
42
+ }
43
+ }
44
+
45
+ /* The mark occupies a 1t column so the label lines up with a
46
+ 1t-indented headline. From tablet the inline mark is enough. */
47
+ .slug[data-layout="rail"] {
48
+ height: var(--t);
49
+ gap: 0;
50
+ }
51
+ .slug[data-layout="rail"] .slug-mark {
52
+ width: var(--t);
53
+ height: var(--t);
54
+ background: none;
55
+ display: grid;
56
+ place-items: center;
57
+ }
58
+ .slug[data-layout="rail"] .slug-mark::before {
59
+ content: "";
60
+ width: var(--sys-marker);
61
+ height: var(--sys-marker);
62
+ background: var(--color-bg-400);
63
+ }
64
+ @container (--rt) {
65
+ .slug[data-layout="rail"] {
66
+ height: auto;
67
+ gap: var(--space-md);
68
+ }
69
+ .slug[data-layout="rail"] .slug-mark {
70
+ width: var(--sys-marker);
71
+ height: var(--sys-marker);
72
+ background: var(--color-bg-400);
73
+ display: block;
74
+ }
75
+ .slug[data-layout="rail"] .slug-mark::before {
76
+ content: none;
77
+ }
78
+ }
79
+ @container (--rd1) {
80
+ .slug[data-layout="rail"] {
81
+ gap: var(--space-lg);
82
+ }
83
+ .slug[data-layout="rail"] .slug-mark {
84
+ width: var(--sys-marker-rd);
85
+ height: var(--sys-marker-rd);
86
+ }
87
+ }
@@ -0,0 +1,37 @@
1
+ /** Eyebrow mark and label. Type holds per band so a dynamic crumb
2
+ * does not wrap mid-slice. */
3
+
4
+ import type { ReactNode } from "react";
5
+
6
+ interface SlugProps {
7
+ as?: "p" | "span";
8
+ /** `rail` puts the mark in a 1t column so the label lines up with
9
+ * a 1t-indented headline. */
10
+ layout?: "inline" | "rail";
11
+ className?: string;
12
+ "aria-hidden"?: boolean;
13
+ children: ReactNode;
14
+ }
15
+
16
+ export function Slug({
17
+ as: Tag = "p",
18
+ layout = "inline",
19
+ className,
20
+ "aria-hidden": ariaHidden,
21
+ children,
22
+ }: SlugProps) {
23
+ return (
24
+ <Tag
25
+ className={
26
+ className
27
+ ? `type type-fixed ts-text-xs-medium slug ${className}`
28
+ : "type type-fixed ts-text-xs-medium slug"
29
+ }
30
+ data-layout={layout === "rail" ? "rail" : undefined}
31
+ aria-hidden={ariaHidden}
32
+ >
33
+ <i className="slug-mark" aria-hidden="true" />
34
+ <span className="slug-label">{children}</span>
35
+ </Tag>
36
+ );
37
+ }