@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
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,131 @@
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. GT America is static (Mono has no 400;
3
+ a request for it resolves to 500). Kyoto is one variable file, wght 100 to 900.
4
+
5
+ Each family has a fallback matched to its metrics against Arial, Georgia or Courier New, so text
6
+ set before the face arrives takes the same lines and the swap does not move the page. */
7
+
8
+ /* Standard: interface and body */
9
+ @font-face {
10
+ font-family: "GT America";
11
+ font-weight: 300;
12
+ font-style: normal;
13
+ font-display: swap;
14
+ src: url("../fonts/gt-america-300.woff2") format("woff2");
15
+ }
16
+ @font-face {
17
+ font-family: "GT America";
18
+ font-weight: 300;
19
+ font-style: italic;
20
+ font-display: swap;
21
+ src: url("../fonts/gt-america-300-italic.woff2") format("woff2");
22
+ }
23
+ @font-face {
24
+ font-family: "GT America";
25
+ font-weight: 400;
26
+ font-style: normal;
27
+ font-display: swap;
28
+ src: url("../fonts/gt-america-400.woff2") format("woff2");
29
+ }
30
+ @font-face {
31
+ font-family: "GT America";
32
+ font-weight: 400;
33
+ font-style: italic;
34
+ font-display: swap;
35
+ src: url("../fonts/gt-america-400-italic.woff2") format("woff2");
36
+ }
37
+ @font-face {
38
+ font-family: "GT America";
39
+ font-weight: 500;
40
+ font-style: normal;
41
+ font-display: swap;
42
+ src: url("../fonts/gt-america-500.woff2") format("woff2");
43
+ }
44
+
45
+ /* Kyoto: display. The brand's thin serif voice for headlines. */
46
+ @font-face {
47
+ font-family: "PP Kyoto";
48
+ font-weight: 100 900;
49
+ font-style: normal;
50
+ font-display: swap;
51
+ src: url("../fonts/pp-kyoto-vf.woff2") format("woff2");
52
+ }
53
+
54
+ /* Extended: the sans alternate for display, where a serif reads wrong */
55
+ @font-face {
56
+ font-family: "GT America Extended";
57
+ font-weight: 300;
58
+ font-style: normal;
59
+ font-display: swap;
60
+ src: url("../fonts/gt-america-extended-300.woff2") format("woff2");
61
+ }
62
+ @font-face {
63
+ font-family: "GT America Extended";
64
+ font-weight: 400;
65
+ font-style: normal;
66
+ font-display: swap;
67
+ src: url("../fonts/gt-america-extended-400.woff2") format("woff2");
68
+ }
69
+ @font-face {
70
+ font-family: "GT America Extended";
71
+ font-weight: 500;
72
+ font-style: normal;
73
+ font-display: swap;
74
+ src: url("../fonts/gt-america-extended-500.woff2") format("woff2");
75
+ }
76
+ @font-face {
77
+ font-family: "GT America Extended";
78
+ font-weight: 700;
79
+ font-style: normal;
80
+ font-display: swap;
81
+ src: url("../fonts/gt-america-extended-700.woff2") format("woff2");
82
+ }
83
+
84
+ /* Mono: figures and labels */
85
+ @font-face {
86
+ font-family: "GT America Mono";
87
+ font-weight: 300;
88
+ font-style: normal;
89
+ font-display: swap;
90
+ src: url("../fonts/gt-america-mono-300.woff2") format("woff2");
91
+ }
92
+ @font-face {
93
+ font-family: "GT America Mono";
94
+ font-weight: 500;
95
+ font-style: normal;
96
+ font-display: swap;
97
+ src: url("../fonts/gt-america-mono-500.woff2") format("woff2");
98
+ }
99
+
100
+ @font-face {
101
+ font-family: "GT America Fallback";
102
+ src: local("Arial");
103
+ size-adjust: 102.87%;
104
+ ascent-override: 97.7%;
105
+ descent-override: 19.44%;
106
+ line-gap-override: 0%;
107
+ }
108
+ @font-face {
109
+ font-family: "PP Kyoto Fallback";
110
+ src: local("Georgia");
111
+ size-adjust: 108.2%;
112
+ ascent-override: 97.97%;
113
+ descent-override: 31.42%;
114
+ line-gap-override: 25.88%;
115
+ }
116
+ @font-face {
117
+ font-family: "GT America Extended Fallback";
118
+ src: local("Arial");
119
+ size-adjust: 123.41%;
120
+ ascent-override: 81.43%;
121
+ descent-override: 16.21%;
122
+ line-gap-override: 0%;
123
+ }
124
+ @font-face {
125
+ font-family: "GT America Mono Fallback";
126
+ src: local("Courier New");
127
+ size-adjust: 103.32%;
128
+ ascent-override: 97.27%;
129
+ descent-override: 19.36%;
130
+ line-gap-override: 0%;
131
+ }
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
+ }