@keystone-sites/marketing-design-system 1.0.27 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/README.md +47 -67
  2. package/fonts/gt-america-italic-vf.woff2 +0 -0
  3. package/fonts/gt-america-mono-vf.woff2 +0 -0
  4. package/fonts/gt-america-vf.woff2 +0 -0
  5. package/fonts/pp-kyoto-vf.woff2 +0 -0
  6. package/package.json +46 -225
  7. package/src/base.css +300 -0
  8. package/src/fonts.css +89 -0
  9. package/src/hue.ts +17 -0
  10. package/src/icon.tsx +56 -0
  11. package/src/mark.tsx +14 -0
  12. package/src/motion.ts +123 -0
  13. package/src/parts/chip.css +84 -0
  14. package/src/parts/chip.tsx +40 -0
  15. package/src/parts/composer.css +195 -0
  16. package/src/parts/composer.tsx +220 -0
  17. package/src/parts/cx.ts +2 -0
  18. package/src/parts/faq.css +77 -0
  19. package/src/parts/faq.tsx +25 -0
  20. package/src/parts/footer.css +51 -0
  21. package/src/parts/footer.tsx +27 -0
  22. package/src/parts/nav.css +213 -0
  23. package/src/parts/nav.tsx +108 -0
  24. package/src/parts/photo.css +15 -0
  25. package/src/parts/photo.tsx +24 -0
  26. package/src/parts/plans.css +89 -0
  27. package/src/parts/plans.tsx +56 -0
  28. package/src/parts/prose.css +86 -0
  29. package/src/parts/prose.tsx +49 -0
  30. package/src/parts/shape.css +47 -0
  31. package/src/parts/shape.tsx +68 -0
  32. package/src/parts/split.tsx +49 -0
  33. package/src/parts/stamp.css +85 -0
  34. package/src/parts/stamp.tsx +36 -0
  35. package/src/parts/work-card.css +51 -0
  36. package/src/parts/work-card.tsx +40 -0
  37. package/src/set.css +439 -0
  38. package/src/styles.css +20 -0
  39. package/src/tokens/color.css +471 -0
  40. package/src/tokens/roles.css +12 -0
  41. package/src/tokens/type.css +11 -0
  42. package/src/wordmark.tsx +34 -0
  43. package/AGENTS.md +0 -216
  44. package/assets/media/brand/ks-lockup.svg +0 -13
  45. package/assets/media/brand/ks-logomark.svg +0 -4
  46. package/assets/media/brand/ks-wordmark-inline.svg +0 -13
  47. package/assets/media/brand/ks-wordmark.svg +0 -11
  48. package/assets/media/fonts/gt-standard-standard-vf.woff2 +0 -0
  49. package/assets/media/fonts/pp-kyoto-variable-upright-vf.woff2 +0 -0
  50. package/base.css +0 -113
  51. package/css-vars.d.ts +0 -10
  52. package/grid/engine.css +0 -388
  53. package/grid/field-hash.ts +0 -31
  54. package/grid/field.tsx +0 -48
  55. package/grid/gates.cjs +0 -35
  56. package/grid/region.tsx +0 -97
  57. package/icons.tsx +0 -1508
  58. package/index.css +0 -94
  59. package/lib/autoplay-gate.ts +0 -88
  60. package/lib/focus-trap.ts +0 -42
  61. package/lib/grader.ts +0 -123
  62. package/lib/legal-data.ts +0 -1
  63. package/lib/legal.ts +0 -41
  64. package/lib/markdown.ts +0 -200
  65. package/lib/noise.tsx +0 -114
  66. package/lib/phone.ts +0 -294
  67. package/lib/render-boundary.tsx +0 -27
  68. package/lib/scroll-lock.ts +0 -25
  69. package/lib/swipe.ts +0 -124
  70. package/lib/use-active-section.ts +0 -43
  71. package/lib/use-copy.ts +0 -41
  72. package/lib/use-count-up.ts +0 -26
  73. package/lib/use-grader-search.ts +0 -143
  74. package/lib/use-popover.ts +0 -30
  75. package/lib/use-video-carousel.ts +0 -271
  76. package/media.ts +0 -558
  77. package/primitives/ask-cursor.tsx +0 -74
  78. package/primitives/ask.css +0 -103
  79. package/primitives/ask.tsx +0 -28
  80. package/primitives/breadcrumb.css +0 -51
  81. package/primitives/breadcrumb.tsx +0 -46
  82. package/primitives/business-picker.css +0 -135
  83. package/primitives/business-picker.tsx +0 -298
  84. package/primitives/button-inline.css +0 -58
  85. package/primitives/button-inline.tsx +0 -48
  86. package/primitives/buttons.css +0 -551
  87. package/primitives/buttons.tsx +0 -330
  88. package/primitives/case-study-button.css +0 -71
  89. package/primitives/case-study-button.tsx +0 -28
  90. package/primitives/case-study-card.css +0 -318
  91. package/primitives/case-study-card.tsx +0 -116
  92. package/primitives/chart.css +0 -110
  93. package/primitives/chart.tsx +0 -198
  94. package/primitives/chat-copy.tsx +0 -30
  95. package/primitives/chat.css +0 -1086
  96. package/primitives/chat.tsx +0 -684
  97. package/primitives/chip.css +0 -127
  98. package/primitives/chip.tsx +0 -53
  99. package/primitives/closer-row.css +0 -14
  100. package/primitives/closer-row.tsx +0 -22
  101. package/primitives/cta-row.css +0 -41
  102. package/primitives/cta-row.tsx +0 -39
  103. package/primitives/disclosure.css +0 -302
  104. package/primitives/disclosure.tsx +0 -277
  105. package/primitives/faq-question.css +0 -220
  106. package/primitives/faq-question.tsx +0 -55
  107. package/primitives/field.css +0 -279
  108. package/primitives/field.tsx +0 -376
  109. package/primitives/footer-item.css +0 -72
  110. package/primitives/footer-item.tsx +0 -42
  111. package/primitives/glyph-toggle.css +0 -62
  112. package/primitives/glyph-toggle.tsx +0 -42
  113. package/primitives/grader-menu.tsx +0 -84
  114. package/primitives/grader.css +0 -369
  115. package/primitives/grader.tsx +0 -285
  116. package/primitives/keystone-score.css +0 -156
  117. package/primitives/keystone-score.tsx +0 -204
  118. package/primitives/markdown.css +0 -232
  119. package/primitives/markdown.tsx +0 -359
  120. package/primitives/modal.css +0 -193
  121. package/primitives/modal.tsx +0 -204
  122. package/primitives/month-range.css +0 -80
  123. package/primitives/month-range.tsx +0 -183
  124. package/primitives/notice.css +0 -39
  125. package/primitives/notice.tsx +0 -56
  126. package/primitives/persona-card.css +0 -374
  127. package/primitives/persona-card.tsx +0 -74
  128. package/primitives/picture.css +0 -11
  129. package/primitives/picture.tsx +0 -41
  130. package/primitives/plan-card.css +0 -398
  131. package/primitives/plan-card.tsx +0 -153
  132. package/primitives/prompt.css +0 -588
  133. package/primitives/prompt.tsx +0 -440
  134. package/primitives/prose.css +0 -164
  135. package/primitives/prose.tsx +0 -194
  136. package/primitives/ramps.css +0 -77
  137. package/primitives/report-nav.css +0 -382
  138. package/primitives/report-nav.tsx +0 -353
  139. package/primitives/report.css +0 -601
  140. package/primitives/report.tsx +0 -357
  141. package/primitives/skeleton.css +0 -82
  142. package/primitives/skeleton.tsx +0 -56
  143. package/primitives/slider.css +0 -179
  144. package/primitives/slider.tsx +0 -69
  145. package/primitives/slug.css +0 -87
  146. package/primitives/slug.tsx +0 -37
  147. package/primitives/status.css +0 -427
  148. package/primitives/status.tsx +0 -323
  149. package/primitives/strip.css +0 -43
  150. package/primitives/surface.css +0 -88
  151. package/primitives/surface.tsx +0 -100
  152. package/primitives/table.css +0 -227
  153. package/primitives/table.tsx +0 -122
  154. package/primitives/tabs.css +0 -85
  155. package/primitives/tabs.tsx +0 -122
  156. package/primitives/tag.css +0 -46
  157. package/primitives/tag.tsx +0 -33
  158. package/primitives/text.css +0 -127
  159. package/primitives/toc.css +0 -65
  160. package/primitives/toc.tsx +0 -42
  161. package/primitives/tooltip.css +0 -56
  162. package/primitives/tooltip.tsx +0 -103
  163. package/rules/design-system.md +0 -154
  164. package/rules/grid-and-layout.md +0 -174
  165. package/scripts/generate-exports.mjs +0 -61
  166. package/scripts/generate-type-css.mjs +0 -130
  167. package/sections/faq-island.tsx +0 -102
  168. package/sections/faq.css +0 -213
  169. package/sections/faq.tsx +0 -46
  170. package/sections/footer-nav.tsx +0 -95
  171. package/sections/footer-signature.css +0 -223
  172. package/sections/footer-signature.tsx +0 -127
  173. package/sections/footer.css +0 -735
  174. package/sections/footer.tsx +0 -286
  175. package/sections/gallery-overlay.css +0 -212
  176. package/sections/gallery-overlay.tsx +0 -267
  177. package/sections/landing-benefits.css +0 -59
  178. package/sections/landing-benefits.tsx +0 -81
  179. package/sections/landing-closer.css +0 -23
  180. package/sections/landing-closer.tsx +0 -26
  181. package/sections/landing-hero.css +0 -80
  182. package/sections/landing-hero.tsx +0 -69
  183. package/sections/landing-quote.css +0 -19
  184. package/sections/landing-quote.tsx +0 -30
  185. package/sections/landing-sample.ts +0 -66
  186. package/sections/landing.css +0 -45
  187. package/sections/landing.tsx +0 -69
  188. package/sections/load-orchestrator.tsx +0 -43
  189. package/sections/load.css +0 -138
  190. package/sections/nav-desktop.css +0 -530
  191. package/sections/nav-desktop.tsx +0 -155
  192. package/sections/nav-menu.css +0 -57
  193. package/sections/nav-menu.tsx +0 -112
  194. package/sections/nav-mobile.css +0 -571
  195. package/sections/nav-mobile.tsx +0 -222
  196. package/sections/nav-solo.tsx +0 -28
  197. package/sections/nav.css +0 -135
  198. package/sections/nav.tsx +0 -394
  199. package/sections/site-chat-data.ts +0 -16
  200. package/sections/site-chat-open.tsx +0 -25
  201. package/sections/site-chat.tsx +0 -67
  202. package/site-links.ts +0 -41
  203. package/site.ts +0 -2
  204. package/themes/inverted.css +0 -177
  205. package/tokens/fonts.css +0 -38
  206. package/tokens/motion.css +0 -158
  207. package/tokens/primitives.css +0 -163
  208. package/tokens/semantic.css +0 -174
  209. package/tokens/type-styles.json +0 -145
  210. package/tokens/type.css +0 -1548
  211. package/widgets.css +0 -78
package/src/base.css ADDED
@@ -0,0 +1,300 @@
1
+ /* The page's defaults, in the `base` layer, so any unlayered rule (a part's, a site's) outranks
2
+ them whatever its specificity.
3
+
4
+ The reset is Tailwind's preflight (MIT, Tailwind Labs, Inc.), unchanged but for its theme
5
+ lookups, which read the system's families. */
6
+ @layer base {
7
+ *,
8
+ ::after,
9
+ ::before,
10
+ ::backdrop,
11
+ ::file-selector-button {
12
+ box-sizing: border-box;
13
+ margin: 0;
14
+ padding: 0;
15
+ border: 0 solid;
16
+ }
17
+
18
+ html,
19
+ :host {
20
+ line-height: 1.5;
21
+ -webkit-text-size-adjust: 100%;
22
+ tab-size: 4;
23
+ font-family: var(--font-sans);
24
+ font-feature-settings: normal;
25
+ font-variation-settings: normal;
26
+ -webkit-tap-highlight-color: transparent;
27
+ }
28
+
29
+ hr {
30
+ height: 0;
31
+ color: inherit;
32
+ border-top-width: 1px;
33
+ }
34
+
35
+ abbr:where([title]) {
36
+ -webkit-text-decoration: underline dotted;
37
+ text-decoration: underline dotted;
38
+ }
39
+
40
+ h1,
41
+ h2,
42
+ h3,
43
+ h4,
44
+ h5,
45
+ h6 {
46
+ font-size: inherit;
47
+ font-weight: inherit;
48
+ }
49
+
50
+ a {
51
+ color: inherit;
52
+ -webkit-text-decoration: inherit;
53
+ text-decoration: inherit;
54
+ }
55
+
56
+ b,
57
+ strong {
58
+ font-weight: bolder;
59
+ }
60
+
61
+ code,
62
+ kbd,
63
+ samp,
64
+ pre {
65
+ font-family: var(--font-mono);
66
+ font-feature-settings: normal;
67
+ font-variation-settings: normal;
68
+ font-size: 1em;
69
+ }
70
+
71
+ small {
72
+ font-size: 80%;
73
+ }
74
+
75
+ sub,
76
+ sup {
77
+ font-size: 75%;
78
+ line-height: 0;
79
+ position: relative;
80
+ vertical-align: baseline;
81
+ }
82
+
83
+ sub {
84
+ bottom: -0.25em;
85
+ }
86
+
87
+ sup {
88
+ top: -0.5em;
89
+ }
90
+
91
+ table {
92
+ text-indent: 0;
93
+ border-color: inherit;
94
+ border-collapse: collapse;
95
+ }
96
+
97
+ :-moz-focusring:where(:not(iframe)) {
98
+ outline: auto;
99
+ }
100
+
101
+ progress {
102
+ vertical-align: baseline;
103
+ }
104
+
105
+ summary {
106
+ display: list-item;
107
+ }
108
+
109
+ ol,
110
+ ul,
111
+ menu {
112
+ list-style: none;
113
+ }
114
+
115
+ img,
116
+ svg,
117
+ video,
118
+ canvas,
119
+ audio,
120
+ iframe,
121
+ embed,
122
+ object {
123
+ display: block;
124
+ vertical-align: middle;
125
+ }
126
+
127
+ img,
128
+ video {
129
+ max-width: 100%;
130
+ height: auto;
131
+ }
132
+
133
+ button,
134
+ input,
135
+ select,
136
+ optgroup,
137
+ textarea,
138
+ ::file-selector-button {
139
+ font: inherit;
140
+ font-feature-settings: inherit;
141
+ font-variation-settings: inherit;
142
+ letter-spacing: inherit;
143
+ color: inherit;
144
+ border-radius: 0;
145
+ background-color: transparent;
146
+ opacity: 1;
147
+ }
148
+
149
+ :where(select:is([multiple], [size])) optgroup {
150
+ font-weight: bolder;
151
+ }
152
+
153
+ :where(select:is([multiple], [size])) optgroup option {
154
+ padding-inline-start: 20px;
155
+ }
156
+
157
+ ::file-selector-button {
158
+ margin-inline-end: 4px;
159
+ }
160
+
161
+ ::placeholder {
162
+ opacity: 1;
163
+ }
164
+
165
+ /* Safari before 17 crashes on color-mix() with currentcolor. */
166
+ @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
167
+ ::placeholder {
168
+ color: color-mix(in oklab, currentcolor 50%, transparent);
169
+ }
170
+ }
171
+
172
+ textarea {
173
+ resize: vertical;
174
+ }
175
+
176
+ ::-webkit-search-decoration {
177
+ -webkit-appearance: none;
178
+ }
179
+
180
+ ::-webkit-date-and-time-value {
181
+ min-height: 1lh;
182
+ text-align: inherit;
183
+ }
184
+
185
+ ::-webkit-datetime-edit {
186
+ display: inline-flex;
187
+ }
188
+
189
+ ::-webkit-datetime-edit-fields-wrapper {
190
+ padding: 0;
191
+ }
192
+
193
+ ::-webkit-datetime-edit,
194
+ ::-webkit-datetime-edit-year-field,
195
+ ::-webkit-datetime-edit-month-field,
196
+ ::-webkit-datetime-edit-day-field,
197
+ ::-webkit-datetime-edit-hour-field,
198
+ ::-webkit-datetime-edit-minute-field,
199
+ ::-webkit-datetime-edit-second-field,
200
+ ::-webkit-datetime-edit-millisecond-field,
201
+ ::-webkit-datetime-edit-meridiem-field {
202
+ padding-block: 0;
203
+ }
204
+
205
+ ::-webkit-calendar-picker-indicator {
206
+ line-height: 1;
207
+ }
208
+
209
+ :-moz-ui-invalid {
210
+ box-shadow: none;
211
+ }
212
+
213
+ button,
214
+ input:where([type="button"], [type="reset"], [type="submit"]),
215
+ ::file-selector-button {
216
+ appearance: button;
217
+ }
218
+
219
+ ::-webkit-inner-spin-button,
220
+ ::-webkit-outer-spin-button {
221
+ height: auto;
222
+ }
223
+
224
+ [hidden]:where(:not([hidden="until-found"])) {
225
+ display: none !important;
226
+ }
227
+
228
+ * {
229
+ border-color: var(--border);
230
+ }
231
+
232
+ html {
233
+ font-family: var(--font-sans);
234
+ font-weight: 300;
235
+ font-size: 1rem;
236
+ line-height: 1.5rem;
237
+ letter-spacing: 0;
238
+ -webkit-font-smoothing: antialiased;
239
+ -moz-osx-font-smoothing: grayscale;
240
+ text-rendering: optimizeLegibility;
241
+ font-feature-settings: "kern", "liga", "calt";
242
+ }
243
+
244
+ body {
245
+ background-color: var(--background);
246
+ color: var(--foreground);
247
+ }
248
+
249
+ /* Headings and running copy wrap for shape; controls keep their lines. */
250
+ h1,
251
+ h2,
252
+ h3,
253
+ h4,
254
+ p,
255
+ li,
256
+ blockquote,
257
+ figcaption {
258
+ text-wrap: pretty;
259
+ }
260
+
261
+ h1,
262
+ h2,
263
+ h3 {
264
+ font-family: var(--font-display);
265
+ font-weight: 200;
266
+ }
267
+
268
+ table,
269
+ time,
270
+ [data-numeric] {
271
+ font-variant-numeric: tabular-nums;
272
+ }
273
+
274
+ button:not(:disabled),
275
+ [role="button"]:not(:disabled) {
276
+ cursor: pointer;
277
+ }
278
+
279
+ [data-slot="icon"] {
280
+ display: inline-block;
281
+ flex-shrink: 0;
282
+ }
283
+
284
+ /* Central draws at 1.5 on a 24 grid; every stroke renders at --icon-stroke on screen whatever
285
+ the icon's size. The attribute catches strokes only, so filled shapes stay filled. */
286
+ [data-slot="icon"] [stroke] {
287
+ stroke-width: var(--icon-stroke);
288
+ vector-effect: non-scaling-stroke;
289
+ }
290
+
291
+ :focus-visible {
292
+ outline: 2px solid var(--ring);
293
+ outline-offset: 2px;
294
+ }
295
+
296
+ ::selection {
297
+ background: var(--primary);
298
+ color: var(--primary-foreground);
299
+ }
300
+ }
package/src/fonts.css ADDED
@@ -0,0 +1,89 @@
1
+ /* GT America and PP Kyoto, shipped with the package in fonts/; a site's bundler emits whichever
2
+ files the page uses, so no site keeps copies of its own. All are variable. GT America is three
3
+ files: upright and italic, each wght 25 to 900 and wdth 50 (Compressed) to 150 (Expanded), with
4
+ Standard at 100 and Extended at 125, and Mono, wght 25 to 900. Kyoto is one file, wght 100 to
5
+ 900.
6
+
7
+ Each family has a fallback matched to its metrics against Arial, Georgia or Courier New, so text
8
+ set before the face arrives takes the same lines and the swap does not move the page. */
9
+
10
+ /* Standard: interface and body */
11
+ @font-face {
12
+ font-family: "GT America";
13
+ font-weight: 25 900;
14
+ font-stretch: 50% 150%;
15
+ font-style: normal;
16
+ font-display: swap;
17
+ src: url("../fonts/gt-america-vf.woff2") format("woff2");
18
+ }
19
+ @font-face {
20
+ font-family: "GT America";
21
+ font-weight: 25 900;
22
+ font-stretch: 50% 150%;
23
+ font-style: italic;
24
+ font-display: swap;
25
+ src: url("../fonts/gt-america-italic-vf.woff2") format("woff2");
26
+ }
27
+
28
+ /* Kyoto: display. The brand's thin serif voice for headlines. */
29
+ @font-face {
30
+ font-family: "PP Kyoto";
31
+ font-weight: 100 900;
32
+ font-style: normal;
33
+ font-display: swap;
34
+ src: url("../fonts/pp-kyoto-vf.woff2") format("woff2");
35
+ }
36
+
37
+ /* Extended: the sans alternate for display, where a serif reads wrong. The upright file, held at
38
+ its widest: a face declared at one width sets the font's wdth axis to it, whatever the text
39
+ asks for, and a page with both families fetches the file once. */
40
+ @font-face {
41
+ font-family: "GT America Extended";
42
+ font-weight: 25 900;
43
+ font-stretch: 125%;
44
+ font-style: normal;
45
+ font-display: swap;
46
+ src: url("../fonts/gt-america-vf.woff2") format("woff2");
47
+ }
48
+
49
+ /* Mono: figures and labels */
50
+ @font-face {
51
+ font-family: "GT America Mono";
52
+ font-weight: 25 900;
53
+ font-style: normal;
54
+ font-display: swap;
55
+ src: url("../fonts/gt-america-mono-vf.woff2") format("woff2");
56
+ }
57
+
58
+ @font-face {
59
+ font-family: "GT America Fallback";
60
+ src: local("Arial");
61
+ size-adjust: 102.5%;
62
+ ascent-override: 93.66%;
63
+ descent-override: 24.39%;
64
+ line-gap-override: 0%;
65
+ }
66
+ @font-face {
67
+ font-family: "PP Kyoto Fallback";
68
+ src: local("Georgia");
69
+ size-adjust: 108.2%;
70
+ ascent-override: 97.97%;
71
+ descent-override: 31.42%;
72
+ line-gap-override: 25.88%;
73
+ }
74
+ @font-face {
75
+ font-family: "GT America Extended Fallback";
76
+ src: local("Arial");
77
+ size-adjust: 123.08%;
78
+ ascent-override: 78%;
79
+ descent-override: 20.31%;
80
+ line-gap-override: 0%;
81
+ }
82
+ @font-face {
83
+ font-family: "GT America Mono Fallback";
84
+ src: local("Courier New");
85
+ size-adjust: 103.32%;
86
+ ascent-override: 92.92%;
87
+ descent-override: 24.2%;
88
+ line-gap-override: 0%;
89
+ }
package/src/hue.ts ADDED
@@ -0,0 +1,17 @@
1
+ /** The hues a part can take (`data-hue`), each with its light, mid, full, deep, soft and ink. */
2
+ export const HUES = [
3
+ "pear",
4
+ "tangerine",
5
+ "pink",
6
+ "purple",
7
+ "blue",
8
+ "red",
9
+ "amber",
10
+ "green",
11
+ "teal",
12
+ "sky",
13
+ "orchid",
14
+ "slate",
15
+ ] as const;
16
+
17
+ export type Hue = (typeof HUES)[number];
package/src/icon.tsx ADDED
@@ -0,0 +1,56 @@
1
+ import {
2
+ type CentralIconBaseProps,
3
+ IconArrowRight,
4
+ IconArrowUp,
5
+ IconArrowUpRight,
6
+ IconBarsThree,
7
+ IconCheckmark1Medium,
8
+ IconCrossMedium,
9
+ IconFacebook,
10
+ IconInfinity,
11
+ IconInstagram,
12
+ IconLinkedin,
13
+ IconPhone,
14
+ IconYoutube,
15
+ } from "@central-icons-react/square-outlined-radius-0-stroke-1.5";
16
+
17
+ // The glyphs the Set draws with: Central (iconists.co), square caps and joins, outlined, radius 0,
18
+ // drawn at 1.5 and rendered at a screen pixel at every size (base.css). A part asks for a glyph
19
+ // by name, so swapping one is an edit to this map alone.
20
+ export const icons = {
21
+ "arrow-right": IconArrowRight,
22
+ "arrow-up": IconArrowUp,
23
+ "arrow-up-right": IconArrowUpRight,
24
+ check: IconCheckmark1Medium,
25
+ close: IconCrossMedium,
26
+ facebook: IconFacebook,
27
+ instagram: IconInstagram,
28
+ linkedin: IconLinkedin,
29
+ menu: IconBarsThree,
30
+ meta: IconInfinity,
31
+ phone: IconPhone,
32
+ youtube: IconYoutube,
33
+ } as const;
34
+
35
+ export type IconName = keyof typeof icons;
36
+
37
+ type Props = Omit<CentralIconBaseProps, "name"> & {
38
+ name: IconName;
39
+ /** A label makes the icon meaningful to assistive tech; without one it is decorative. */
40
+ label?: string;
41
+ };
42
+
43
+ /** A glyph, 1em square, so it scales with the text beside it. */
44
+ export function Icon({ name, label, ...props }: Props) {
45
+ const Glyph = icons[name];
46
+ return (
47
+ <Glyph
48
+ data-slot="icon"
49
+ size="1em"
50
+ aria-hidden={label ? undefined : true}
51
+ aria-label={label}
52
+ role={label ? "img" : undefined}
53
+ {...props}
54
+ />
55
+ );
56
+ }
package/src/mark.tsx ADDED
@@ -0,0 +1,14 @@
1
+ import type { CSSProperties } from "react";
2
+
3
+ /** Keystone's K on its pear tile, in the brand's own colours whatever surrounds it. */
4
+ export function Mark({ className, style }: { className?: string; style?: CSSProperties }) {
5
+ return (
6
+ <svg className={className} style={style} viewBox="0 0 32 32" role="img" aria-label="Keystone">
7
+ <rect width="32" height="32" fill="#d2d800" />
8
+ <g transform="matrix(1 0 0 0.8 8.891 7.448)" fill="#212515">
9
+ <path d="M2.451 10.658C4.737 10.658 6.591 12.975 6.591 15.834 6.591 18.693 4.737 21.01 2.451 21.011 0.163 21.011-1.691 18.693-1.691 15.834-1.691 12.975 0.163 10.658 2.451 10.658Z" />
10
+ <path d="M13.042 8.842 16.869 20.606H9.932L6.179 9.096H-1.344V-0.307H6.179V8.599L9.283-0.309 16.219-0.31 13.042 8.842Z" />
11
+ </g>
12
+ </svg>
13
+ );
14
+ }
package/src/motion.ts ADDED
@@ -0,0 +1,123 @@
1
+ import { type RefObject, useEffect, useEffectEvent, useState, useSyncExternalStore } from "react";
2
+
3
+ // Motion without a library: what the browser has (CSS, the Web Animations API, observers), and a
4
+ // few hooks that tie it to scroll and to a part coming into view.
5
+
6
+ const REDUCE = "(prefers-reduced-motion: reduce)";
7
+
8
+ function subscribeReduce(onChange: () => void) {
9
+ const query = window.matchMedia(REDUCE);
10
+ query.addEventListener("change", onChange);
11
+ return () => {
12
+ query.removeEventListener("change", onChange);
13
+ };
14
+ }
15
+
16
+ /** Whether the visitor asked for less motion. Movement is dropped; what it showed still shows. */
17
+ export function useReducedMotion(): boolean {
18
+ return useSyncExternalStore(
19
+ subscribeReduce,
20
+ () => window.matchMedia(REDUCE).matches,
21
+ () => false,
22
+ );
23
+ }
24
+
25
+ export const prefersReducedMotion = () => window.matchMedia(REDUCE).matches;
26
+
27
+ /** True once the element is in view (and, with `once: false`, false again when it leaves). */
28
+ export function useInView<T extends Element>(
29
+ ref: RefObject<T | null>,
30
+ {
31
+ once = true,
32
+ margin = "0px 0px -12% 0px",
33
+ threshold = 0,
34
+ }: { once?: boolean; margin?: string; threshold?: number } = {},
35
+ ): boolean {
36
+ const [inView, setInView] = useState(false);
37
+ useEffect(() => {
38
+ const node = ref.current;
39
+ if (!node) return;
40
+ const observer = new IntersectionObserver(
41
+ (entries) => {
42
+ const seen = entries.some((each) => each.isIntersecting);
43
+ if (seen) {
44
+ setInView(true);
45
+ if (once) observer.disconnect();
46
+ } else if (!once) {
47
+ setInView(false);
48
+ }
49
+ },
50
+ { rootMargin: margin, threshold },
51
+ );
52
+ observer.observe(node);
53
+ return () => {
54
+ observer.disconnect();
55
+ };
56
+ }, [ref, once, margin, threshold]);
57
+ return inView;
58
+ }
59
+
60
+ // One scroll listener for the page; each subscriber is told once a frame.
61
+ const listeners = new Set<() => void>();
62
+ let frame = 0;
63
+ function onScroll() {
64
+ if (frame) return;
65
+ frame = requestAnimationFrame(() => {
66
+ frame = 0;
67
+ for (const listener of listeners) listener();
68
+ });
69
+ }
70
+ function subscribeScroll(listener: () => void) {
71
+ if (listeners.size === 0) {
72
+ window.addEventListener("scroll", onScroll, { passive: true });
73
+ window.addEventListener("resize", onScroll);
74
+ }
75
+ listeners.add(listener);
76
+ return () => {
77
+ listeners.delete(listener);
78
+ if (listeners.size === 0) {
79
+ window.removeEventListener("scroll", onScroll);
80
+ window.removeEventListener("resize", onScroll);
81
+ }
82
+ };
83
+ }
84
+
85
+ const clamp01 = (n: number) => Math.min(1, Math.max(0, n));
86
+
87
+ /**
88
+ * How far the page has scrolled through an element, 0 to 1.
89
+ * - `pin`: for a tall block holding a sticky child. 0 as its top meets the window's top, 1 as its
90
+ * bottom meets the window's bottom (the whole time the child is pinned).
91
+ * - `pass`: for any block. 0 as its top enters at the window's bottom, 1 as its bottom leaves at
92
+ * the window's top.
93
+ */
94
+ export function progressOf(node: Element, mode: "pin" | "pass"): number {
95
+ const rect = node.getBoundingClientRect();
96
+ const vh = window.innerHeight;
97
+ if (mode === "pin") {
98
+ const travel = rect.height - vh;
99
+ return travel <= 0 ? (rect.top <= 0 ? 1 : 0) : clamp01(-rect.top / travel);
100
+ }
101
+ return clamp01((vh - rect.top) / (vh + rect.height));
102
+ }
103
+
104
+ /**
105
+ * Runs `onProgress` with an element's scroll progress, once a frame while the page scrolls, and
106
+ * never through React state: write a CSS variable or a style in it, so scrolling renders nothing.
107
+ */
108
+ export function useScrollProgress<T extends HTMLElement>(
109
+ ref: RefObject<T | null>,
110
+ onProgress: (progress: number, node: T) => void,
111
+ mode: "pin" | "pass" = "pin",
112
+ ) {
113
+ const tell = useEffectEvent(onProgress);
114
+ useEffect(() => {
115
+ const node = ref.current;
116
+ if (!node) return;
117
+ const read = () => {
118
+ tell(progressOf(node, mode), node);
119
+ };
120
+ read();
121
+ return subscribeScroll(read);
122
+ }, [ref, mode]);
123
+ }
@@ -0,0 +1,84 @@
1
+ /* The Set's button (Figma › The Set › Chiplet): a key with a glyph or a shape before its label. */
2
+
3
+ .ks-chip {
4
+ --chip-bg: var(--stone);
5
+ --chip-fg: #242323;
6
+ display: inline-flex;
7
+ align-items: center;
8
+ gap: var(--key-gap);
9
+ height: var(--key);
10
+ padding-inline: var(--key-pad);
11
+ background: var(--chip-bg);
12
+ color: var(--chip-fg);
13
+ border-radius: 4px;
14
+ font-weight: 500;
15
+ font-size: var(--key-type);
16
+ line-height: 1;
17
+ white-space: nowrap;
18
+ transition:
19
+ background-color 160ms var(--out),
20
+ color 160ms var(--out),
21
+ transform 160ms var(--out),
22
+ box-shadow 160ms var(--out);
23
+ }
24
+ .ks-chip > :where(svg) {
25
+ font-size: var(--key-glyph);
26
+ }
27
+ .ks-chip:where(button, a):hover {
28
+ --chip-bg: color-mix(in oklab, var(--stone) 80%, var(--ink));
29
+ }
30
+ .ks-chip:where(button, a):active {
31
+ transform: translateY(1px);
32
+ }
33
+ .ks-chip[data-variant="pear"] {
34
+ --chip-bg: var(--pear-400);
35
+ --chip-fg: var(--pear-950);
36
+ }
37
+ .ks-chip[data-variant="pear"]:where(button, a):hover {
38
+ --chip-bg: var(--pear-300);
39
+ }
40
+ .ks-chip[data-variant="ink"] {
41
+ --chip-bg: var(--char);
42
+ --chip-fg: var(--text-paper);
43
+ border-radius: 0;
44
+ }
45
+ .ks-chip[data-variant="ink"]:where(button, a):hover {
46
+ --chip-bg: var(--ink);
47
+ }
48
+ .ks-chip[data-variant="white"] {
49
+ --chip-bg: var(--white);
50
+ --chip-fg: var(--ink);
51
+ }
52
+ .ks-chip[data-variant="white"]:where(button, a):hover {
53
+ --chip-bg: var(--canvas);
54
+ }
55
+ .ks-chip[data-variant="hue"] {
56
+ --chip-bg: var(--h-light);
57
+ --chip-fg: var(--h-deep);
58
+ }
59
+ .ks-chip[data-variant="hue"] > .ks-shape {
60
+ color: var(--h-full);
61
+ }
62
+ .ks-chip[data-variant="hue"]:where(button, a):hover {
63
+ --chip-bg: var(--h-mid);
64
+ }
65
+ .ks-chip[data-variant="full"] {
66
+ --chip-bg: var(--h-full);
67
+ --chip-fg: var(--h-ink);
68
+ }
69
+ .ks-chip[data-variant="full"]:where(button, a):hover {
70
+ --chip-bg: var(--h-mid);
71
+ }
72
+ .ks-chip[data-variant="ghost"] {
73
+ --chip-bg: transparent;
74
+ box-shadow: inset 0 0 0 1px var(--line);
75
+ }
76
+ .ks-chip[data-variant="ghost"]:where(button, a):hover {
77
+ --chip-bg: var(--white);
78
+ }
79
+ .ks-chip[data-size="sm"] {
80
+ height: calc(var(--u) * 0.8);
81
+ padding-inline: calc(var(--u) * 0.25) calc(var(--u) * 0.3);
82
+ gap: calc(var(--u) * 0.2);
83
+ font-size: max(12px, calc(var(--u) * 0.325));
84
+ }