@hahlex/millar-mcp 0.0.0-stage → 0.1.0-draft.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.
- package/LICENSE +21 -0
- package/dist/docs/CHANGELOG.md +21 -0
- package/dist/docs/GLOSSARY.md +77 -0
- package/dist/http.d.ts +3 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +39566 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +6 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1115 -0
- package/dist/server.js.map +1 -0
- package/dist/skills/millar-animation/SKILL.md +66 -0
- package/dist/skills/millar-animation/references/animation-research-patterns.md +28 -0
- package/dist/skills/millar-animation/references/motion-choreography.md +80 -0
- package/dist/skills/millar-build-web/SKILL.md +59 -0
- package/dist/skills/millar-build-web/references/seo-cwv-and-copy.md +24 -0
- package/dist/skills/millar-build-web/references/web-architecture-checklist.md +47 -0
- package/dist/skills/millar-create-image/SKILL.md +62 -0
- package/dist/skills/millar-create-image/references/human-editorial-photography.md +74 -0
- package/dist/skills/millar-create-image/references/hybrid-plate-compositing.md +43 -0
- package/dist/skills/millar-create-image/references/image-art-direction.md +74 -0
- package/dist/skills/millar-create-image/references/multi-page-asset-map.md +27 -0
- package/dist/skills/millar-create-image/references/natural-editorial-illustration.md +57 -0
- package/dist/skills/millar-create-image/references/procedural-gallery-craft.md +84 -0
- package/dist/skills/millar-create-image/scripts/embed-provenance.mjs +185 -0
- package/dist/skills/millar-deep-research/SKILL.md +62 -0
- package/dist/skills/millar-deep-research/references/visual-extraction-protocol.md +36 -0
- package/dist/skills/millar-deep-research/references/world-class-benchmarks.md +30 -0
- package/dist/skills/millar-design/SKILL.md +83 -0
- package/dist/skills/millar-design/references/aesthetic-movements.md +49 -0
- package/dist/skills/millar-design/references/cross-page-sync-audit.md +25 -0
- package/dist/skills/millar-design/references/style-dna-contract.md +89 -0
- package/dist/skills/millar-verify-web/SKILL.md +76 -0
- package/dist/skills/millar-verify-web/references/five-layer-qa-gate.md +104 -0
- package/dist/skills/millar-verify-web/references/two-axis-review-rubric.md +23 -0
- package/dist/skills/millar-verify-web/scripts/millar-audit.mjs +617 -0
- package/dist/skills/millar-web-workflow/SKILL.md +60 -0
- package/dist/skills/millar-web-workflow/references/creative-divergence-protocol.md +52 -0
- package/dist/skills/millar-web-workflow/references/track-routing-and-gates.md +32 -0
- package/dist/skills-loader.d.ts +47 -0
- package/dist/skills-loader.d.ts.map +1 -0
- package/dist/skills-loader.js +204 -0
- package/dist/skills-loader.js.map +1 -0
- package/dist/sources/packages/marketing/src/assets/BrandAndGeometricAssets.tsx +373 -0
- package/dist/sources/packages/marketing/src/assets/SchematicAndProductAssets.tsx +497 -0
- package/dist/sources/packages/marketing/src/sections/MarketingSections.tsx +946 -0
- package/dist/sources/packages/marketing/src/templates/PageTemplates.tsx +304 -0
- package/dist/sources/packages/ui/src/components/Button.tsx +162 -0
- package/dist/sources/packages/ui/src/components/FormControls.tsx +476 -0
- package/dist/sources/packages/ui/src/components/Layout.tsx +176 -0
- package/dist/sources/packages/ui/src/components/OverlaysAndFeedback.tsx +291 -0
- package/dist/sources/packages/ui/src/components/SurfacesAndData.tsx +564 -0
- package/dist/stdio.d.ts +3 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +37380 -0
- package/dist/stdio.js.map +1 -0
- package/package.json +48 -3
- package/README.md +0 -3
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import React, { useId, useState } from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { IconCheck, IconHelp } from "../icons.js";
|
|
4
|
+
|
|
5
|
+
export interface HelpTooltipProps {
|
|
6
|
+
hint: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Click + hover + focus accessible help button (>= 24x24px WCAG 2.5.8 target).
|
|
12
|
+
* Decoupled from <label> so it never pollutes the associated form control's accessible name.
|
|
13
|
+
*/
|
|
14
|
+
export function HelpTooltip({ hint, label = "More information" }: HelpTooltipProps) {
|
|
15
|
+
const [hovered, setHovered] = useState(false);
|
|
16
|
+
const [pinned, setPinned] = useState(false);
|
|
17
|
+
const panelId = useId();
|
|
18
|
+
const open = hovered || pinned;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<span
|
|
22
|
+
style={{ position: "relative", display: "inline-flex", alignItems: "center" }}
|
|
23
|
+
onMouseEnter={() => setHovered(true)}
|
|
24
|
+
onMouseLeave={() => setHovered(false)}
|
|
25
|
+
>
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
aria-label={label}
|
|
29
|
+
aria-expanded={open}
|
|
30
|
+
aria-describedby={open ? panelId : undefined}
|
|
31
|
+
onClick={() => setPinned((prev) => !prev)}
|
|
32
|
+
onBlur={() => {
|
|
33
|
+
setPinned(false);
|
|
34
|
+
setHovered(false);
|
|
35
|
+
}}
|
|
36
|
+
onKeyDown={(e) => {
|
|
37
|
+
if (e.key === "Escape") {
|
|
38
|
+
setPinned(false);
|
|
39
|
+
setHovered(false);
|
|
40
|
+
}
|
|
41
|
+
}}
|
|
42
|
+
className="millar-focus"
|
|
43
|
+
style={{
|
|
44
|
+
display: "inline-flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
width: 24,
|
|
48
|
+
height: 24,
|
|
49
|
+
padding: 0,
|
|
50
|
+
borderRadius: "var(--radius-pill, 9999px)",
|
|
51
|
+
border: "1px solid var(--border-default)",
|
|
52
|
+
backgroundColor: "var(--bg-surface-2)",
|
|
53
|
+
color: "var(--fg-subtle)",
|
|
54
|
+
cursor: "pointer",
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<IconHelp size="sm" />
|
|
58
|
+
</button>
|
|
59
|
+
{open ? (
|
|
60
|
+
<span
|
|
61
|
+
id={panelId}
|
|
62
|
+
role="tooltip"
|
|
63
|
+
style={{
|
|
64
|
+
position: "absolute",
|
|
65
|
+
bottom: "calc(100% + 8px)",
|
|
66
|
+
left: "50%",
|
|
67
|
+
transform: "translateX(-50%)",
|
|
68
|
+
zIndex: "var(--z-popover, 11000)" as unknown as number,
|
|
69
|
+
width: 240,
|
|
70
|
+
padding: "8px 10px",
|
|
71
|
+
borderRadius: "var(--radius-sm, 8px)",
|
|
72
|
+
backgroundColor: "var(--bg-elevated)",
|
|
73
|
+
border: "1px solid var(--border-default)",
|
|
74
|
+
boxShadow: "var(--shadow-popover)",
|
|
75
|
+
color: "var(--fg-default)",
|
|
76
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
77
|
+
lineHeight: 1.45,
|
|
78
|
+
fontWeight: 400,
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{hint}
|
|
82
|
+
</span>
|
|
83
|
+
) : null}
|
|
84
|
+
</span>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
89
|
+
label?: string;
|
|
90
|
+
hint?: string;
|
|
91
|
+
error?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const Input = React.forwardRef<HTMLInputElement, InputProps>(function Input(
|
|
95
|
+
{ label, hint, error, id, className, style, ...rest },
|
|
96
|
+
ref,
|
|
97
|
+
) {
|
|
98
|
+
const autoId = useId();
|
|
99
|
+
const inputId = id ?? autoId;
|
|
100
|
+
const errorId = `${inputId}-error`;
|
|
101
|
+
const hasError = Boolean(error);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 6, width: "100%" }}>
|
|
105
|
+
{label ? (
|
|
106
|
+
<div style={{ display: "inline-flex", alignItems: "center", gap: 6 }}>
|
|
107
|
+
<label
|
|
108
|
+
htmlFor={inputId}
|
|
109
|
+
style={{
|
|
110
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
111
|
+
fontWeight: 500,
|
|
112
|
+
color: "var(--fg-muted)",
|
|
113
|
+
letterSpacing: 0,
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
{label}
|
|
117
|
+
</label>
|
|
118
|
+
{hint ? <HelpTooltip hint={hint} label={`Help for ${label}`} /> : null}
|
|
119
|
+
</div>
|
|
120
|
+
) : null}
|
|
121
|
+
<input
|
|
122
|
+
ref={ref}
|
|
123
|
+
id={inputId}
|
|
124
|
+
aria-invalid={hasError || undefined}
|
|
125
|
+
aria-describedby={hasError ? errorId : undefined}
|
|
126
|
+
className={clsx("millar-focus", className)}
|
|
127
|
+
style={{
|
|
128
|
+
width: "100%",
|
|
129
|
+
height: 40,
|
|
130
|
+
padding: "0 12px",
|
|
131
|
+
borderRadius: "var(--radius-control, 10px)",
|
|
132
|
+
borderWidth: 1,
|
|
133
|
+
borderStyle: "solid",
|
|
134
|
+
borderColor: hasError ? "var(--status-error)" : "var(--border-default)",
|
|
135
|
+
backgroundColor: "var(--bg-surface)",
|
|
136
|
+
color: "var(--fg-default)",
|
|
137
|
+
fontFamily: "var(--font-sans)",
|
|
138
|
+
fontSize: "var(--text-body-sm, 0.875rem)",
|
|
139
|
+
letterSpacing: 0,
|
|
140
|
+
transition: "border-color var(--motion-productive-fast, 140ms) var(--ease-productive-standard, cubic-bezier(0.2, 0, 0, 1))",
|
|
141
|
+
...style,
|
|
142
|
+
}}
|
|
143
|
+
{...rest}
|
|
144
|
+
/>
|
|
145
|
+
{hasError ? (
|
|
146
|
+
<p
|
|
147
|
+
id={errorId}
|
|
148
|
+
role="alert"
|
|
149
|
+
style={{
|
|
150
|
+
margin: 0,
|
|
151
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
152
|
+
color: "var(--status-error)",
|
|
153
|
+
lineHeight: 1.4,
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
{error}
|
|
157
|
+
</p>
|
|
158
|
+
) : null}
|
|
159
|
+
</div>
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
164
|
+
label?: string;
|
|
165
|
+
hint?: string;
|
|
166
|
+
error?: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export const TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(function TextArea(
|
|
170
|
+
{ label, hint, error, id, rows = 3, className, style, ...rest },
|
|
171
|
+
ref,
|
|
172
|
+
) {
|
|
173
|
+
const autoId = useId();
|
|
174
|
+
const areaId = id ?? autoId;
|
|
175
|
+
const errorId = `${areaId}-error`;
|
|
176
|
+
const hasError = Boolean(error);
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 6, width: "100%" }}>
|
|
180
|
+
{label ? (
|
|
181
|
+
<div style={{ display: "inline-flex", alignItems: "center", gap: 6 }}>
|
|
182
|
+
<label
|
|
183
|
+
htmlFor={areaId}
|
|
184
|
+
style={{
|
|
185
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
186
|
+
fontWeight: 500,
|
|
187
|
+
color: "var(--fg-muted)",
|
|
188
|
+
}}
|
|
189
|
+
>
|
|
190
|
+
{label}
|
|
191
|
+
</label>
|
|
192
|
+
{hint ? <HelpTooltip hint={hint} label={`Help for ${label}`} /> : null}
|
|
193
|
+
</div>
|
|
194
|
+
) : null}
|
|
195
|
+
<textarea
|
|
196
|
+
ref={ref}
|
|
197
|
+
id={areaId}
|
|
198
|
+
rows={rows}
|
|
199
|
+
aria-invalid={hasError || undefined}
|
|
200
|
+
aria-describedby={hasError ? errorId : undefined}
|
|
201
|
+
className={clsx("millar-focus", className)}
|
|
202
|
+
style={{
|
|
203
|
+
width: "100%",
|
|
204
|
+
padding: "10px 12px",
|
|
205
|
+
borderRadius: "var(--radius-control, 10px)",
|
|
206
|
+
borderWidth: 1,
|
|
207
|
+
borderStyle: "solid",
|
|
208
|
+
borderColor: hasError ? "var(--status-error)" : "var(--border-default)",
|
|
209
|
+
backgroundColor: "var(--bg-surface)",
|
|
210
|
+
color: "var(--fg-default)",
|
|
211
|
+
fontFamily: "var(--font-sans)",
|
|
212
|
+
fontSize: "var(--text-body-sm, 0.875rem)",
|
|
213
|
+
lineHeight: 1.5,
|
|
214
|
+
resize: "vertical",
|
|
215
|
+
...style,
|
|
216
|
+
}}
|
|
217
|
+
{...rest}
|
|
218
|
+
/>
|
|
219
|
+
{hasError ? (
|
|
220
|
+
<p
|
|
221
|
+
id={errorId}
|
|
222
|
+
role="alert"
|
|
223
|
+
style={{
|
|
224
|
+
margin: 0,
|
|
225
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
226
|
+
color: "var(--status-error)",
|
|
227
|
+
}}
|
|
228
|
+
>
|
|
229
|
+
{error}
|
|
230
|
+
</p>
|
|
231
|
+
) : null}
|
|
232
|
+
</div>
|
|
233
|
+
);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
export interface SelectOption {
|
|
237
|
+
value: string;
|
|
238
|
+
label: string;
|
|
239
|
+
disabled?: boolean;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
243
|
+
label?: string;
|
|
244
|
+
hint?: string;
|
|
245
|
+
error?: string;
|
|
246
|
+
options: SelectOption[];
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export const Select = React.forwardRef<HTMLSelectElement, SelectProps>(function Select(
|
|
250
|
+
{ label, hint, error, options, id, className, style, ...rest },
|
|
251
|
+
ref,
|
|
252
|
+
) {
|
|
253
|
+
const autoId = useId();
|
|
254
|
+
const selectId = id ?? autoId;
|
|
255
|
+
const errorId = `${selectId}-error`;
|
|
256
|
+
const hasError = Boolean(error);
|
|
257
|
+
|
|
258
|
+
return (
|
|
259
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 6, width: "100%" }}>
|
|
260
|
+
{label ? (
|
|
261
|
+
<div style={{ display: "inline-flex", alignItems: "center", gap: 6 }}>
|
|
262
|
+
<label
|
|
263
|
+
htmlFor={selectId}
|
|
264
|
+
style={{ fontSize: "var(--text-meta, 0.8125rem)", fontWeight: 500, color: "var(--fg-muted)" }}
|
|
265
|
+
>
|
|
266
|
+
{label}
|
|
267
|
+
</label>
|
|
268
|
+
{hint ? <HelpTooltip hint={hint} label={`Help for ${label}`} /> : null}
|
|
269
|
+
</div>
|
|
270
|
+
) : null}
|
|
271
|
+
<select
|
|
272
|
+
ref={ref}
|
|
273
|
+
id={selectId}
|
|
274
|
+
aria-invalid={hasError || undefined}
|
|
275
|
+
aria-describedby={hasError ? errorId : undefined}
|
|
276
|
+
className={clsx("millar-focus", className)}
|
|
277
|
+
style={{
|
|
278
|
+
width: "100%",
|
|
279
|
+
height: 40,
|
|
280
|
+
padding: "0 12px",
|
|
281
|
+
borderRadius: "var(--radius-control, 10px)",
|
|
282
|
+
borderWidth: 1,
|
|
283
|
+
borderStyle: "solid",
|
|
284
|
+
borderColor: hasError ? "var(--status-error)" : "var(--border-default)",
|
|
285
|
+
backgroundColor: "var(--bg-surface)",
|
|
286
|
+
color: "var(--fg-default)",
|
|
287
|
+
fontFamily: "var(--font-sans)",
|
|
288
|
+
fontSize: "var(--text-body-sm, 0.875rem)",
|
|
289
|
+
...style,
|
|
290
|
+
}}
|
|
291
|
+
{...rest}
|
|
292
|
+
>
|
|
293
|
+
{options.map((opt) => (
|
|
294
|
+
<option key={opt.value} value={opt.value} disabled={opt.disabled}>
|
|
295
|
+
{opt.label}
|
|
296
|
+
</option>
|
|
297
|
+
))}
|
|
298
|
+
</select>
|
|
299
|
+
{hasError ? (
|
|
300
|
+
<p id={errorId} role="alert" style={{ margin: 0, fontSize: "var(--text-meta, 0.8125rem)", color: "var(--status-error)" }}>
|
|
301
|
+
{error}
|
|
302
|
+
</p>
|
|
303
|
+
) : null}
|
|
304
|
+
</div>
|
|
305
|
+
);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
export interface SwitchProps {
|
|
309
|
+
checked: boolean;
|
|
310
|
+
onChange: (checked: boolean) => void;
|
|
311
|
+
label: string;
|
|
312
|
+
disabled?: boolean;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export function Switch({ checked, onChange, label, disabled = false }: SwitchProps) {
|
|
316
|
+
const labelId = useId();
|
|
317
|
+
return (
|
|
318
|
+
<div style={{ display: "inline-flex", alignItems: "center", gap: 10 }}>
|
|
319
|
+
<button
|
|
320
|
+
type="button"
|
|
321
|
+
role="switch"
|
|
322
|
+
aria-checked={checked}
|
|
323
|
+
aria-labelledby={labelId}
|
|
324
|
+
disabled={disabled}
|
|
325
|
+
onClick={() => onChange(!checked)}
|
|
326
|
+
className="millar-focus"
|
|
327
|
+
style={{
|
|
328
|
+
position: "relative",
|
|
329
|
+
width: 44,
|
|
330
|
+
height: 24,
|
|
331
|
+
padding: 2,
|
|
332
|
+
borderRadius: "var(--radius-pill, 9999px)",
|
|
333
|
+
border: "1px solid",
|
|
334
|
+
borderColor: checked ? "var(--accent)" : "var(--border-strong)",
|
|
335
|
+
backgroundColor: checked ? "var(--accent)" : "var(--bg-surface-2)",
|
|
336
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
337
|
+
opacity: disabled ? 0.5 : 1,
|
|
338
|
+
transition: "background-color var(--motion-productive-fast, 140ms) var(--ease-productive-standard, cubic-bezier(0.2, 0, 0, 1))",
|
|
339
|
+
}}
|
|
340
|
+
>
|
|
341
|
+
<span
|
|
342
|
+
aria-hidden="true"
|
|
343
|
+
style={{
|
|
344
|
+
display: "block",
|
|
345
|
+
width: 18,
|
|
346
|
+
height: 18,
|
|
347
|
+
borderRadius: "var(--radius-pill, 9999px)",
|
|
348
|
+
backgroundColor: checked ? "var(--fg-on-accent)" : "var(--fg-muted)",
|
|
349
|
+
transform: checked ? "translateX(20px)" : "translateX(0px)",
|
|
350
|
+
transition: "transform var(--motion-productive-fast, 140ms) var(--ease-productive-standard, cubic-bezier(0.2, 0, 0, 1))",
|
|
351
|
+
}}
|
|
352
|
+
/>
|
|
353
|
+
</button>
|
|
354
|
+
<span id={labelId} style={{ fontSize: "var(--text-body-sm, 0.875rem)", color: "var(--fg-default)" }}>
|
|
355
|
+
{label}
|
|
356
|
+
</span>
|
|
357
|
+
</div>
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface CheckboxProps {
|
|
362
|
+
checked: boolean;
|
|
363
|
+
onChange: (checked: boolean) => void;
|
|
364
|
+
label: string;
|
|
365
|
+
disabled?: boolean;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export function Checkbox({ checked, onChange, label, disabled = false }: CheckboxProps) {
|
|
369
|
+
const id = useId();
|
|
370
|
+
return (
|
|
371
|
+
<label
|
|
372
|
+
htmlFor={id}
|
|
373
|
+
style={{
|
|
374
|
+
display: "inline-flex",
|
|
375
|
+
alignItems: "center",
|
|
376
|
+
gap: 10,
|
|
377
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
378
|
+
opacity: disabled ? 0.5 : 1,
|
|
379
|
+
fontSize: "var(--text-body-sm, 0.875rem)",
|
|
380
|
+
color: "var(--fg-default)",
|
|
381
|
+
}}
|
|
382
|
+
>
|
|
383
|
+
<input
|
|
384
|
+
id={id}
|
|
385
|
+
type="checkbox"
|
|
386
|
+
checked={checked}
|
|
387
|
+
disabled={disabled}
|
|
388
|
+
onChange={(e) => onChange(e.target.checked)}
|
|
389
|
+
className="millar-checkbox-input"
|
|
390
|
+
style={{ position: "absolute", opacity: 0, width: 1, height: 1 }}
|
|
391
|
+
/>
|
|
392
|
+
<span
|
|
393
|
+
aria-hidden="true"
|
|
394
|
+
className="millar-checkbox-box"
|
|
395
|
+
style={{
|
|
396
|
+
display: "inline-flex",
|
|
397
|
+
alignItems: "center",
|
|
398
|
+
justifyContent: "center",
|
|
399
|
+
width: 20,
|
|
400
|
+
height: 20,
|
|
401
|
+
borderRadius: 6,
|
|
402
|
+
border: "1px solid",
|
|
403
|
+
borderColor: checked ? "var(--accent)" : "var(--border-strong)",
|
|
404
|
+
backgroundColor: checked ? "var(--accent)" : "var(--bg-surface)",
|
|
405
|
+
color: "var(--fg-on-accent)",
|
|
406
|
+
}}
|
|
407
|
+
>
|
|
408
|
+
{checked ? <IconCheck size="sm" /> : null}
|
|
409
|
+
</span>
|
|
410
|
+
<span>{label}</span>
|
|
411
|
+
</label>
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export interface ChoiceToggleOption<T extends string> {
|
|
416
|
+
value: T;
|
|
417
|
+
label: string;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export interface ChoiceToggleProps<T extends string> {
|
|
421
|
+
label: string;
|
|
422
|
+
value: T;
|
|
423
|
+
onChange: (next: T) => void;
|
|
424
|
+
options: Array<ChoiceToggleOption<T>>;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* High-contrast theme/locale choice row.
|
|
429
|
+
* Explicitly pairs --accent-soft fill with --fg-on-accent-soft (#362218, 7.69:1 AAA)
|
|
430
|
+
* in BOTH light and dark themes, preventing the 1.00:1 invisible dark-mode toggle bug.
|
|
431
|
+
*/
|
|
432
|
+
export function ChoiceToggle<T extends string>({ label, value, onChange, options }: ChoiceToggleProps<T>) {
|
|
433
|
+
return (
|
|
434
|
+
<div
|
|
435
|
+
role="group"
|
|
436
|
+
aria-label={label}
|
|
437
|
+
style={{
|
|
438
|
+
display: "inline-flex",
|
|
439
|
+
alignItems: "center",
|
|
440
|
+
gap: 4,
|
|
441
|
+
padding: 3,
|
|
442
|
+
borderRadius: "var(--radius-control, 10px)",
|
|
443
|
+
border: "1px solid var(--border-default)",
|
|
444
|
+
backgroundColor: "var(--bg-surface-2)",
|
|
445
|
+
}}
|
|
446
|
+
>
|
|
447
|
+
{options.map((opt) => {
|
|
448
|
+
const active = opt.value === value;
|
|
449
|
+
return (
|
|
450
|
+
<button
|
|
451
|
+
key={opt.value}
|
|
452
|
+
type="button"
|
|
453
|
+
aria-pressed={active}
|
|
454
|
+
onClick={() => onChange(opt.value)}
|
|
455
|
+
className="millar-focus"
|
|
456
|
+
style={{
|
|
457
|
+
height: 30,
|
|
458
|
+
padding: "0 10px",
|
|
459
|
+
borderRadius: 7,
|
|
460
|
+
border: "1px solid",
|
|
461
|
+
borderColor: active ? "var(--accent-soft)" : "transparent",
|
|
462
|
+
backgroundColor: active ? "var(--accent-soft)" : "transparent",
|
|
463
|
+
color: active ? "var(--fg-on-accent-soft)" : "var(--fg-muted)",
|
|
464
|
+
fontFamily: "var(--font-sans)",
|
|
465
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
466
|
+
fontWeight: active ? 600 : 500,
|
|
467
|
+
cursor: "pointer",
|
|
468
|
+
}}
|
|
469
|
+
>
|
|
470
|
+
{opt.label}
|
|
471
|
+
</button>
|
|
472
|
+
);
|
|
473
|
+
})}
|
|
474
|
+
</div>
|
|
475
|
+
);
|
|
476
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { IconClose, IconMenu } from "../icons.js";
|
|
3
|
+
import { Button } from "./Button.js";
|
|
4
|
+
|
|
5
|
+
/* --- PageHeader (Enforces <=1 primary CTA + clean operational heading hierarchy) --- */
|
|
6
|
+
|
|
7
|
+
export interface PageHeaderProps {
|
|
8
|
+
title: string;
|
|
9
|
+
meta?: React.ReactNode;
|
|
10
|
+
primaryAction?: React.ReactNode;
|
|
11
|
+
secondaryActions?: React.ReactNode;
|
|
12
|
+
embedded?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function PageHeader({ title, meta, primaryAction, secondaryActions, embedded = false }: PageHeaderProps) {
|
|
16
|
+
const Wrapper = embedded ? "div" : "header";
|
|
17
|
+
const Heading = embedded ? "h3" : "h1";
|
|
18
|
+
return (
|
|
19
|
+
<Wrapper
|
|
20
|
+
style={{
|
|
21
|
+
display: "flex",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
justifyContent: "space-between",
|
|
24
|
+
gap: 16,
|
|
25
|
+
flexWrap: "wrap",
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<div style={{ display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" }}>
|
|
29
|
+
<Heading
|
|
30
|
+
style={{
|
|
31
|
+
margin: 0,
|
|
32
|
+
fontFamily: "var(--font-display)",
|
|
33
|
+
fontSize: "var(--text-page-title, 1.375rem)",
|
|
34
|
+
fontWeight: 600,
|
|
35
|
+
lineHeight: "var(--leading-heading, 1.24)",
|
|
36
|
+
letterSpacing: "var(--tracking-tight, -0.015em)",
|
|
37
|
+
color: "var(--fg-default)",
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{title}
|
|
41
|
+
</Heading>
|
|
42
|
+
{meta}
|
|
43
|
+
</div>
|
|
44
|
+
{primaryAction || secondaryActions ? (
|
|
45
|
+
<div style={{ display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }}>
|
|
46
|
+
{secondaryActions}
|
|
47
|
+
{primaryAction}
|
|
48
|
+
</div>
|
|
49
|
+
) : null}
|
|
50
|
+
</Wrapper>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* --- AppShell (Product-agnostic workspace shell with skip-link & accessible mobile drawer) --- */
|
|
55
|
+
|
|
56
|
+
export interface AppShellNavItem {
|
|
57
|
+
id: string;
|
|
58
|
+
label: string;
|
|
59
|
+
href: string;
|
|
60
|
+
icon?: React.ReactNode;
|
|
61
|
+
active?: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface AppShellProps {
|
|
65
|
+
brand: React.ReactNode;
|
|
66
|
+
navItems: AppShellNavItem[];
|
|
67
|
+
onNavigate?: (id: string) => void;
|
|
68
|
+
toolbarExtra?: React.ReactNode;
|
|
69
|
+
embedded?: boolean;
|
|
70
|
+
children: React.ReactNode;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function AppShell({ brand, navItems, onNavigate, toolbarExtra, embedded = false, children }: AppShellProps) {
|
|
74
|
+
const [navExpanded, setNavExpanded] = useState(true);
|
|
75
|
+
const SidebarTag = embedded ? "div" : "aside";
|
|
76
|
+
const MainTag = embedded ? "div" : "main";
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div style={{ minHeight: "100%", display: "flex", flexDirection: "column", backgroundColor: "var(--bg-app)", color: "var(--fg-default)" }}>
|
|
80
|
+
{!embedded ? (
|
|
81
|
+
<a
|
|
82
|
+
href="#millar-main-content"
|
|
83
|
+
className="millar-focus"
|
|
84
|
+
style={{
|
|
85
|
+
position: "absolute",
|
|
86
|
+
left: -9999,
|
|
87
|
+
top: 8,
|
|
88
|
+
zIndex: 12000,
|
|
89
|
+
padding: "8px 14px",
|
|
90
|
+
borderRadius: "var(--radius-sm, 8px)",
|
|
91
|
+
backgroundColor: "var(--accent)",
|
|
92
|
+
color: "var(--fg-on-accent)",
|
|
93
|
+
textDecoration: "none",
|
|
94
|
+
fontSize: "var(--text-body-sm, 0.875rem)",
|
|
95
|
+
fontWeight: 500,
|
|
96
|
+
}}
|
|
97
|
+
onFocus={(e) => {
|
|
98
|
+
e.currentTarget.style.left = "12px";
|
|
99
|
+
}}
|
|
100
|
+
onBlur={(e) => {
|
|
101
|
+
e.currentTarget.style.left = "-9999px";
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
Skip to main content
|
|
105
|
+
</a>
|
|
106
|
+
) : null}
|
|
107
|
+
|
|
108
|
+
<div style={{ display: "grid", gridTemplateColumns: "240px minmax(0, 1fr)", minHeight: 520, border: "1px solid var(--border-default)", borderRadius: "var(--radius-lg, 16px)", overflow: "hidden" }}>
|
|
109
|
+
<SidebarTag
|
|
110
|
+
aria-label={embedded ? undefined : "Primary navigation"}
|
|
111
|
+
style={{
|
|
112
|
+
backgroundColor: "var(--bg-sidebar)",
|
|
113
|
+
borderRight: "1px solid var(--border-default)",
|
|
114
|
+
padding: 16,
|
|
115
|
+
display: "flex",
|
|
116
|
+
flexDirection: "column",
|
|
117
|
+
gap: 16,
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 }}>
|
|
121
|
+
{brand}
|
|
122
|
+
<Button
|
|
123
|
+
variant="ghost"
|
|
124
|
+
size="sm"
|
|
125
|
+
iconOnly
|
|
126
|
+
aria-label={navExpanded ? "Collapse navigation" : "Expand navigation"}
|
|
127
|
+
aria-expanded={navExpanded}
|
|
128
|
+
onClick={() => setNavExpanded((prev) => !prev)}
|
|
129
|
+
icon={navExpanded ? <IconClose size="md" /> : <IconMenu size="md" />}
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
{navExpanded ? (
|
|
133
|
+
<nav aria-label={embedded ? "Workspace preview sections" : "Workspace sections"} style={{ display: "flex", flexDirection: "column", gap: 4 }}>
|
|
134
|
+
{navItems.map((item) => (
|
|
135
|
+
<a
|
|
136
|
+
key={item.id}
|
|
137
|
+
href={item.href}
|
|
138
|
+
aria-current={item.active ? "page" : undefined}
|
|
139
|
+
onClick={(e) => {
|
|
140
|
+
if (onNavigate) {
|
|
141
|
+
e.preventDefault();
|
|
142
|
+
onNavigate(item.id);
|
|
143
|
+
}
|
|
144
|
+
}}
|
|
145
|
+
className="millar-focus"
|
|
146
|
+
style={{
|
|
147
|
+
display: "flex",
|
|
148
|
+
alignItems: "center",
|
|
149
|
+
gap: 10,
|
|
150
|
+
padding: "8px 10px",
|
|
151
|
+
borderRadius: "var(--radius-sm, 8px)",
|
|
152
|
+
border: "1px solid",
|
|
153
|
+
borderColor: item.active ? "var(--tone-brand-border)" : "transparent",
|
|
154
|
+
backgroundColor: item.active ? "var(--tone-brand-soft)" : "transparent",
|
|
155
|
+
color: item.active ? "var(--tone-brand-fg)" : "var(--fg-muted)",
|
|
156
|
+
fontSize: "var(--text-body-sm, 0.875rem)",
|
|
157
|
+
fontWeight: item.active ? 600 : 500,
|
|
158
|
+
textDecoration: "none",
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
{item.icon}
|
|
162
|
+
<span>{item.label}</span>
|
|
163
|
+
</a>
|
|
164
|
+
))}
|
|
165
|
+
</nav>
|
|
166
|
+
) : null}
|
|
167
|
+
{toolbarExtra ? <div style={{ marginTop: "auto" }}>{toolbarExtra}</div> : null}
|
|
168
|
+
</SidebarTag>
|
|
169
|
+
|
|
170
|
+
<MainTag id={embedded ? undefined : "millar-main-content"} tabIndex={embedded ? undefined : -1} style={{ padding: 24, display: "flex", flexDirection: "column", gap: 20 }}>
|
|
171
|
+
{children}
|
|
172
|
+
</MainTag>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
}
|