@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,225 @@
1
+ /* Field chrome mirrors grader border/ring language with box radii
2
+ so single-line and textarea controls share one surface. */
3
+
4
+
5
+ .ks-field {
6
+ --field-h: 48px;
7
+ --field-h-sm: 40px;
8
+ --field-textarea-min-h: calc(var(--t) * 2);
9
+ --field-check-size: var(--space-2xl);
10
+ display: flex;
11
+ flex-direction: column;
12
+ gap: var(--space-md);
13
+ --_border: var(--color-border-000);
14
+ --_ring: var(--color-bg-200);
15
+ --_ph: var(--color-text-500);
16
+ --_ink: var(--color-text-200);
17
+ }
18
+
19
+ .ks-field-label {
20
+ display: flex;
21
+ align-items: baseline;
22
+ gap: var(--space-xs);
23
+ color: var(--color-text-200);
24
+ }
25
+
26
+ .ks-field-label[data-hidden] {
27
+ position: absolute;
28
+ width: 1px;
29
+ height: 1px;
30
+ overflow: hidden;
31
+ clip-path: inset(50%);
32
+ white-space: nowrap;
33
+ }
34
+
35
+ .ks-field-req {
36
+ color: var(--color-teal-500);
37
+ }
38
+
39
+ .ks-field-help {
40
+ color: var(--color-text-400);
41
+ }
42
+ .ks-field-help[data-tone="poor"] {
43
+ color: var(--color-danger-200);
44
+ }
45
+ .ks-field[data-invalid] {
46
+ --_border: var(--color-danger-200);
47
+ --_ring: var(--color-danger-000);
48
+ }
49
+
50
+ /* Compact: toolbar height, tighter gap, small type. */
51
+ .ks-field[data-size="sm"] {
52
+ gap: var(--space-sm);
53
+ }
54
+ .ks-field[data-size="sm"] .ks-field-control {
55
+ min-height: var(--field-h-sm);
56
+ padding-inline: var(--space-lg);
57
+ border-radius: var(--radius-md);
58
+ }
59
+ .ks-field[data-size="sm"] .ks-field-control :is(input, textarea, select) {
60
+ --font: var(--ts-text-sm-light-font);
61
+ --ls: var(--ts-text-sm-light-ls);
62
+ --opsz: var(--ts-text-sm-light-opsz);
63
+ }
64
+ .ks-field-control[data-mono] :is(input, textarea) {
65
+ --font: 400 13px/1.5 var(--font-mono);
66
+ --ls: 0;
67
+ }
68
+
69
+ /* Select: the native control with the chrome's own tick. */
70
+ .ks-field-control[data-kind="select"] {
71
+ position: relative;
72
+ padding-right: calc(var(--space-xl) + 20px);
73
+ }
74
+ .ks-field-control select {
75
+ flex: 1;
76
+ width: 100%;
77
+ min-width: 0;
78
+ appearance: none;
79
+ border: 0;
80
+ padding: var(--space-none);
81
+ background: none;
82
+ outline: none;
83
+ color: var(--_ink);
84
+ --font: var(--ts-text-md-light-font);
85
+ --ls: var(--ts-text-md-light-ls);
86
+ --opsz: var(--ts-text-md-light-opsz);
87
+ cursor: pointer;
88
+ }
89
+ .ks-field-control select option {
90
+ color: var(--color-text-100);
91
+ background: var(--color-bg-200);
92
+ }
93
+ .ks-field-tick {
94
+ position: absolute;
95
+ right: var(--space-xl);
96
+ top: 50%;
97
+ translate: 0 -50%;
98
+ pointer-events: none;
99
+ color: var(--color-text-400);
100
+ }
101
+ .ks-field[data-size="sm"] .ks-field-tick {
102
+ right: var(--space-lg);
103
+ }
104
+
105
+ .ks-field-control {
106
+ display: flex;
107
+ align-items: center;
108
+ box-sizing: border-box;
109
+ min-height: var(--field-h);
110
+ padding-inline: var(--space-xl);
111
+ background: var(--color-bg-000);
112
+ border: 1px solid var(--_border);
113
+ border-radius: var(--radius-lg);
114
+ box-shadow: 0 0 0 var(--ring-w) var(--_ring);
115
+ transition-property: border-color, box-shadow;
116
+ transition-duration: var(--motion-hover-duration);
117
+ transition-timing-function: var(--motion-hover-ease);
118
+ }
119
+
120
+ .ks-field-control[data-kind="textarea"] {
121
+ align-items: stretch;
122
+ min-height: var(--field-textarea-min-h);
123
+ padding-block: var(--space-lg);
124
+ }
125
+
126
+ .ks-field-control :is(input, textarea) {
127
+ flex: 1;
128
+ width: 100%;
129
+ min-width: 0;
130
+ border: 0;
131
+ padding: var(--space-none);
132
+ background: none;
133
+ outline: none;
134
+ resize: vertical;
135
+ color: var(--_ink);
136
+ --font: var(--ts-text-md-light-font);
137
+ --ls: var(--ts-text-md-light-ls);
138
+ --opsz: var(--ts-text-md-light-opsz);
139
+ }
140
+
141
+ .ks-field-control :is(input, textarea)::placeholder {
142
+ color: var(--_ph);
143
+ opacity: 1;
144
+ }
145
+
146
+ @media (hover: hover) and (pointer: fine) {
147
+ .ks-field-control:hover {
148
+ --_border: var(--color-border-100);
149
+ --_ring: var(--color-bg-300);
150
+ }
151
+ }
152
+
153
+ .ks-field-control:focus-within {
154
+ --_border: var(--color-teal-300);
155
+ --_ring: var(--color-teal-100);
156
+ }
157
+
158
+ .ks-field-control:focus-within:has(:is(input, textarea):not(:placeholder-shown)) {
159
+ --_border: var(--color-teal-400);
160
+ --_ring: var(--color-teal-150);
161
+ }
162
+
163
+ .ks-field-check {
164
+ gap: var(--space-sm);
165
+ }
166
+
167
+ .ks-field-check-row {
168
+ display: flex;
169
+ align-items: flex-start;
170
+ gap: var(--space-lg);
171
+ }
172
+
173
+ .ks-field-check-row input[type="checkbox"] {
174
+ flex: none;
175
+ box-sizing: border-box;
176
+ width: var(--field-check-size);
177
+ height: var(--field-check-size);
178
+ margin-top: var(--space-2xs, 2px);
179
+ appearance: none;
180
+ background: var(--color-bg-000);
181
+ border: 1px solid var(--color-border-100);
182
+ border-radius: var(--radius-xs);
183
+ box-shadow: 0 0 0 var(--ring-w) var(--color-bg-200);
184
+ transition-property: background-color, border-color, box-shadow;
185
+ transition-duration: var(--motion-hover-duration);
186
+ transition-timing-function: var(--motion-hover-ease);
187
+ }
188
+
189
+ .ks-field-check-row input[type="checkbox"]:checked {
190
+ background: var(--color-teal-500);
191
+ border-color: var(--color-teal-500);
192
+ box-shadow: 0 0 0 var(--ring-w) var(--color-teal-100);
193
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6.2 4.8 8.5 9.5 3.5' stroke='%23f8f7f2' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
194
+ background-repeat: no-repeat;
195
+ background-position: center;
196
+ background-size: 0.75em 0.75em;
197
+ }
198
+
199
+ .ks-field-check-row input[type="checkbox"]:focus-visible {
200
+ outline: none;
201
+ border-color: var(--color-teal-300);
202
+ box-shadow: 0 0 0 var(--ring-w) var(--color-teal-100);
203
+ }
204
+
205
+ .ks-field-check-label {
206
+ color: var(--color-text-300);
207
+ }
208
+
209
+ .ks-field-check-label a {
210
+ color: inherit;
211
+ text-decoration: underline;
212
+ text-decoration-color: var(--color-border-200);
213
+ text-decoration-skip-ink: auto;
214
+ text-underline-offset: 0.18em;
215
+ }
216
+
217
+ .ks-field-check-label a:focus-visible {
218
+ outline: none;
219
+ box-shadow: 0 0 0 var(--ring-w) var(--color-teal-200);
220
+ }
221
+
222
+ .page[data-motion="reduce"] .ks-field-control,
223
+ .page[data-motion="reduce"] .ks-field-check-row input[type="checkbox"] {
224
+ transition: none;
225
+ }
@@ -0,0 +1,266 @@
1
+ /** Labeled text, textarea, select, and checkbox field primitives. */
2
+
3
+ import type {
4
+ InputHTMLAttributes,
5
+ ReactNode,
6
+ SelectHTMLAttributes,
7
+ TextareaHTMLAttributes,
8
+ } from "react";
9
+ import { IconChevronDownSmall } from "../icons";
10
+
11
+ interface FieldShellProps {
12
+ id: string;
13
+ label: ReactNode;
14
+ required?: boolean;
15
+ helpText?: string | null;
16
+ /** Keeps the label for assistive technology only (toolbars). */
17
+ labelHidden?: boolean;
18
+ /** Compact control height for toolbars and dense forms. */
19
+ compact?: boolean;
20
+ /** Error copy; also marks the control invalid. */
21
+ error?: string | null;
22
+ children: ReactNode;
23
+ }
24
+
25
+ function FieldShell({
26
+ id,
27
+ label,
28
+ required,
29
+ helpText,
30
+ labelHidden,
31
+ compact,
32
+ error,
33
+ children,
34
+ }: FieldShellProps) {
35
+ const helpId = helpText ? `${id}-help` : undefined;
36
+ return (
37
+ <div
38
+ className="ks-field"
39
+ data-size={compact ? "sm" : undefined}
40
+ data-invalid={error ? "" : undefined}
41
+ >
42
+ <label
43
+ className="type type-fixed ts-text-sm-medium ks-field-label"
44
+ htmlFor={id}
45
+ data-hidden={labelHidden || undefined}
46
+ >
47
+ <span>{label}</span>
48
+ {required ? (
49
+ <span className="ks-field-req" aria-hidden="true">
50
+ *
51
+ </span>
52
+ ) : null}
53
+ </label>
54
+ {children}
55
+ {error ? (
56
+ <p
57
+ className="type type-fixed ts-text-sm-light ks-field-help"
58
+ id={`${id}-error`}
59
+ data-tone="poor"
60
+ role="alert"
61
+ >
62
+ {error}
63
+ </p>
64
+ ) : helpText ? (
65
+ <p className="type type-fixed ts-text-sm-light ks-field-help" id={helpId}>
66
+ {helpText}
67
+ </p>
68
+ ) : null}
69
+ </div>
70
+ );
71
+ }
72
+
73
+ function describedBy(id: string, helpText?: string | null, error?: string | null) {
74
+ if (error) return `${id}-error`;
75
+ return helpText ? `${id}-help` : undefined;
76
+ }
77
+
78
+ type ShellOptions = Pick<FieldShellProps, "labelHidden" | "compact" | "error">;
79
+
80
+ type TextInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "id" | "className"> &
81
+ ShellOptions & {
82
+ id: string;
83
+ label: ReactNode;
84
+ helpText?: string | null;
85
+ /** Renders the value in the mono face (identifiers, JSON). */
86
+ mono?: boolean;
87
+ };
88
+
89
+ export function FieldText({
90
+ id,
91
+ label,
92
+ helpText,
93
+ required,
94
+ labelHidden,
95
+ compact,
96
+ error,
97
+ mono,
98
+ ...input
99
+ }: TextInputProps) {
100
+ return (
101
+ <FieldShell
102
+ id={id}
103
+ label={label}
104
+ required={required}
105
+ helpText={helpText}
106
+ labelHidden={labelHidden}
107
+ compact={compact}
108
+ error={error}
109
+ >
110
+ <div className="ks-field-control" data-mono={mono || undefined}>
111
+ <input
112
+ className="type type-fixed"
113
+ id={id}
114
+ required={required}
115
+ aria-invalid={error ? true : undefined}
116
+ aria-describedby={describedBy(id, helpText, error)}
117
+ {...input}
118
+ />
119
+ </div>
120
+ </FieldShell>
121
+ );
122
+ }
123
+
124
+ type FieldTextareaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "id" | "className"> &
125
+ ShellOptions & {
126
+ id: string;
127
+ label: ReactNode;
128
+ helpText?: string | null;
129
+ mono?: boolean;
130
+ };
131
+
132
+ export function FieldTextarea({
133
+ id,
134
+ label,
135
+ helpText,
136
+ required,
137
+ rows = 5,
138
+ labelHidden,
139
+ compact,
140
+ error,
141
+ mono,
142
+ ...input
143
+ }: FieldTextareaProps) {
144
+ return (
145
+ <FieldShell
146
+ id={id}
147
+ label={label}
148
+ required={required}
149
+ helpText={helpText}
150
+ labelHidden={labelHidden}
151
+ compact={compact}
152
+ error={error}
153
+ >
154
+ <div className="ks-field-control" data-kind="textarea" data-mono={mono || undefined}>
155
+ <textarea
156
+ className="type type-fixed"
157
+ id={id}
158
+ required={required}
159
+ rows={rows}
160
+ aria-invalid={error ? true : undefined}
161
+ aria-describedby={describedBy(id, helpText, error)}
162
+ {...input}
163
+ />
164
+ </div>
165
+ </FieldShell>
166
+ );
167
+ }
168
+
169
+ type FieldSelectProps = Omit<SelectHTMLAttributes<HTMLSelectElement>, "id" | "className"> &
170
+ ShellOptions & {
171
+ id: string;
172
+ label: ReactNode;
173
+ helpText?: string | null;
174
+ children: ReactNode;
175
+ };
176
+
177
+ /** A native select in the field chrome; options are the children. */
178
+ export function FieldSelect({
179
+ id,
180
+ label,
181
+ helpText,
182
+ required,
183
+ labelHidden,
184
+ compact,
185
+ error,
186
+ children,
187
+ ...select
188
+ }: FieldSelectProps) {
189
+ return (
190
+ <FieldShell
191
+ id={id}
192
+ label={label}
193
+ required={required}
194
+ helpText={helpText}
195
+ labelHidden={labelHidden}
196
+ compact={compact}
197
+ error={error}
198
+ >
199
+ <div className="ks-field-control" data-kind="select">
200
+ <select
201
+ className="type type-fixed"
202
+ id={id}
203
+ required={required}
204
+ aria-invalid={error ? true : undefined}
205
+ aria-describedby={describedBy(id, helpText, error)}
206
+ {...select}
207
+ >
208
+ {children}
209
+ </select>
210
+ <IconChevronDownSmall className="ks-field-tick" />
211
+ </div>
212
+ </FieldShell>
213
+ );
214
+ }
215
+
216
+ interface FieldCheckboxProps {
217
+ id: string;
218
+ name: string;
219
+ label: ReactNode;
220
+ required?: boolean;
221
+ helpText?: string | null;
222
+ value?: string;
223
+ }
224
+
225
+ export function FieldCheckbox({
226
+ id,
227
+ name,
228
+ label,
229
+ required,
230
+ helpText,
231
+ value = "on",
232
+ }: FieldCheckboxProps) {
233
+ const helpId = helpText ? `${id}-help` : undefined;
234
+ const labelId = `${id}-label`;
235
+ return (
236
+ <div className="ks-field ks-field-check">
237
+ <div className="ks-field-check-row">
238
+ <input
239
+ type="checkbox"
240
+ id={id}
241
+ name={name}
242
+ value={value}
243
+ required={required}
244
+ aria-describedby={[labelId, helpId].filter(Boolean).join(" ") || undefined}
245
+ />
246
+ <label
247
+ id={labelId}
248
+ htmlFor={id}
249
+ className="type type-fixed ts-text-sm-light ks-field-check-label"
250
+ >
251
+ {label}
252
+ {required ? (
253
+ <span className="ks-field-req" aria-hidden="true">
254
+ *
255
+ </span>
256
+ ) : null}
257
+ </label>
258
+ </div>
259
+ {helpText ? (
260
+ <p className="type type-fixed ts-text-sm-light ks-field-help" id={helpId}>
261
+ {helpText}
262
+ </p>
263
+ ) : null}
264
+ </div>
265
+ );
266
+ }
@@ -0,0 +1,72 @@
1
+ /* The focus highlight extends without shifting layout. */
2
+
3
+
4
+ .fitem {
5
+ --fitem-bar: 3px;
6
+ display: inline-flex;
7
+ align-items: center;
8
+ gap: var(--fitem-gap);
9
+ color: var(--_ink);
10
+ text-decoration: none;
11
+ white-space: nowrap;
12
+ transition-property: color, gap;
13
+ transition-duration: var(--motion-hover-duration);
14
+ transition-timing-function: var(--motion-hover-ease);
15
+ }
16
+
17
+ /* The step's size rides the grid: the footer sets the `--fs-rm/--fs-rd2` ramp ends. */
18
+ .fitem {
19
+ --font: var(--ts-text-md-regular-font);
20
+ --ls: var(--ts-text-md-regular-ls);
21
+ --opsz: var(--ts-text-md-regular-opsz);
22
+ --fs-rm: var(--ts-text-md-regular-fs);
23
+ --fs-rs: var(--ts-text-md-regular-fs);
24
+ --fs-rt: var(--ts-text-md-regular-fs);
25
+ --fs-rd1: var(--ts-text-md-regular-fs);
26
+ --fs-rd2: var(--ts-text-md-regular-fs);
27
+ --lh-rm: var(--ts-text-md-regular-lh);
28
+ --lh-rs: var(--ts-text-md-regular-lh);
29
+ --lh-rt: var(--ts-text-md-regular-lh);
30
+ --lh-rd1: var(--ts-text-md-regular-lh);
31
+ --lh-rd2: var(--ts-text-md-regular-lh);
32
+ }
33
+
34
+ .fitem[data-chrome="light"] {
35
+ --_ink: var(--color-text-400);
36
+ --_ink-hover: var(--color-text-200);
37
+ --_ink-focus: var(--color-text-300);
38
+ }
39
+ .fitem[data-chrome="dark"] {
40
+ --_ink: var(--color-text-300);
41
+ --_ink-hover: var(--color-text-100);
42
+ --_ink-focus: var(--color-text-200);
43
+ }
44
+
45
+ @media (hover: hover) {
46
+ .fitem:hover {
47
+ color: var(--_ink-hover);
48
+ gap: var(--fitem-gap-hover);
49
+ }
50
+ }
51
+ .fitem[data-state="hover"] {
52
+ color: var(--_ink-hover);
53
+ gap: var(--fitem-gap-hover);
54
+ }
55
+
56
+ .fitem:focus-visible,
57
+ .fitem[data-state="focus"] {
58
+ outline: none;
59
+ color: var(--_ink-focus);
60
+ }
61
+ .fitem:focus-visible .fitem-label,
62
+ .fitem[data-state="focus"] .fitem-label {
63
+ background: var(--color-bg-400);
64
+ box-shadow:
65
+ var(--fitem-bar) 0 0 var(--color-bg-400),
66
+ calc(-1 * var(--fitem-bar)) 0 0 var(--color-bg-400);
67
+ }
68
+
69
+ .fitem-glyph {
70
+ display: inline-flex;
71
+ flex: none;
72
+ }
@@ -0,0 +1,42 @@
1
+ /** Footer navigation link. */
2
+
3
+ import type { ReactNode } from "react";
4
+ import { IconNavTrigger } from "../icons";
5
+ import { EXTERNAL_LINK } from "../site-links";
6
+
7
+ interface FooterItemProps {
8
+ chrome?: "light" | "dark";
9
+ href: string;
10
+ /** Trailing arrow glyph; tints with the label in every state. */
11
+ arrow?: boolean;
12
+ /** Open in a new tab (external destinations). */
13
+ external?: boolean;
14
+ forceState?: "hover" | "focus";
15
+ children: ReactNode;
16
+ }
17
+
18
+ export function FooterItem({
19
+ chrome = "light",
20
+ href,
21
+ arrow = false,
22
+ external = false,
23
+ forceState,
24
+ children,
25
+ }: FooterItemProps) {
26
+ return (
27
+ <a
28
+ className="type fitem"
29
+ data-chrome={chrome}
30
+ data-state={forceState}
31
+ href={href}
32
+ {...(external ? EXTERNAL_LINK : {})}
33
+ >
34
+ <span className="fitem-label">{children}</span>
35
+ {arrow && (
36
+ <span className="fitem-glyph">
37
+ <IconNavTrigger variant="arrow" />
38
+ </span>
39
+ )}
40
+ </a>
41
+ );
42
+ }
@@ -0,0 +1,84 @@
1
+ /** Grouped grader listbox.
2
+ * Rows keep focus on the combobox input and use flat result indices. */
3
+
4
+ import { useLayoutEffect } from "react";
5
+ import type { GraderSuggestion } from "../lib/grader";
6
+ import type { GraderSearchGroups } from "../lib/use-grader-search";
7
+
8
+ export interface GraderMenuLabels {
9
+ places: string;
10
+ web: string;
11
+ }
12
+
13
+ interface GraderSelectMenuProps {
14
+ id: string;
15
+ label: string;
16
+ groups: GraderSearchGroups;
17
+ groupLabels: GraderMenuLabels;
18
+ activeIndex: number;
19
+ optionId: (index: number) => string;
20
+ onActivate: (index: number) => void;
21
+ onChoose: (item: GraderSuggestion) => void;
22
+ }
23
+
24
+ export function GraderSelectMenu({
25
+ id,
26
+ label,
27
+ groups,
28
+ groupLabels,
29
+ activeIndex,
30
+ optionId,
31
+ onActivate,
32
+ onChoose,
33
+ }: GraderSelectMenuProps) {
34
+ const sections = [
35
+ { key: "places", label: groupLabels.places, items: groups.places, offset: 0 },
36
+ { key: "web", label: groupLabels.web, items: groups.web, offset: groups.places.length },
37
+ ].filter((s) => s.items.length > 0);
38
+
39
+ const activeOptionId = optionId(activeIndex);
40
+ useLayoutEffect(() => {
41
+ document.getElementById(activeOptionId)?.scrollIntoView({ block: "nearest" });
42
+ }, [activeOptionId]);
43
+
44
+ return (
45
+ <ul className="grader-menu" id={id} role="listbox" aria-label={label}>
46
+ {sections.map((section) => {
47
+ const labelId = `${id}-${section.key}`;
48
+ return (
49
+ <li key={section.key} className="grader-group" role="group" aria-labelledby={labelId}>
50
+ <span className="type type-fixed ts-text-nav-label grader-group-label" id={labelId}>
51
+ {section.label}
52
+ </span>
53
+ <ul className="grader-group-rows" role="presentation">
54
+ {section.items.map((item, i) => {
55
+ const index = section.offset + i;
56
+ const active = index === activeIndex;
57
+ return (
58
+ <li key={item.id} role="presentation">
59
+ <button
60
+ type="button"
61
+ className="grader-option"
62
+ role="option"
63
+ id={optionId(index)}
64
+ aria-selected={active}
65
+ data-active={active || undefined}
66
+ tabIndex={-1}
67
+ // Keep the combobox focused through pointer selection.
68
+ onMouseDown={(e) => e.preventDefault()}
69
+ onMouseEnter={() => onActivate(index)}
70
+ onClick={() => onChoose(item)}
71
+ >
72
+ <span className="type type-fixed grader-option-name">{item.name}</span>
73
+ <span className="type type-fixed grader-option-sub">{item.address}</span>
74
+ </button>
75
+ </li>
76
+ );
77
+ })}
78
+ </ul>
79
+ </li>
80
+ );
81
+ })}
82
+ </ul>
83
+ );
84
+ }