@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,564 @@
|
|
|
1
|
+
import React, { useId, useRef } from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { IconBox, IconClose, IconSearch, type MillarIconBoxTone } from "../icons.js";
|
|
4
|
+
|
|
5
|
+
/* --- Card (Single-elevation discipline: 1px border OR lifted shadow, never noisy ghost cards) --- */
|
|
6
|
+
|
|
7
|
+
export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
surface?: "base" | "inset" | "raised";
|
|
9
|
+
padding?: "default" | "compact" | "none";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function Card({ surface = "base", padding = "default", className, style, children, ...rest }: CardProps) {
|
|
13
|
+
const pad =
|
|
14
|
+
padding === "none" ? 0 : padding === "compact" ? "12px 14px" : "var(--card-padding-block, 16px) var(--card-padding-inline, 18px)";
|
|
15
|
+
const surfaceStyle: React.CSSProperties =
|
|
16
|
+
surface === "inset"
|
|
17
|
+
? { backgroundColor: "var(--bg-surface-2)", border: "1px solid var(--border-default)", boxShadow: "none" }
|
|
18
|
+
: surface === "raised"
|
|
19
|
+
? { backgroundColor: "var(--bg-elevated)", border: "none", boxShadow: "var(--shadow-card)" }
|
|
20
|
+
: { backgroundColor: "var(--bg-surface)", border: "1px solid var(--border-default)", boxShadow: "none" };
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
className={className}
|
|
25
|
+
style={{
|
|
26
|
+
borderRadius: "var(--radius-lg, 16px)",
|
|
27
|
+
padding: pad,
|
|
28
|
+
display: "flex",
|
|
29
|
+
flexDirection: "column",
|
|
30
|
+
gap: "var(--card-gap, 14px)",
|
|
31
|
+
...surfaceStyle,
|
|
32
|
+
...style,
|
|
33
|
+
}}
|
|
34
|
+
{...rest}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* --- Badge (Zero plain-text tags; border + soft wash + dot/icon so color is never sole signal) --- */
|
|
42
|
+
|
|
43
|
+
export type BadgeTone = "neutral" | "brand" | "sand" | "sage" | "success" | "warning" | "error";
|
|
44
|
+
|
|
45
|
+
const BADGE_STYLES: Record<BadgeTone, React.CSSProperties> = {
|
|
46
|
+
neutral: { backgroundColor: "var(--bg-surface-2)", borderColor: "var(--border-default)", color: "var(--fg-muted)" },
|
|
47
|
+
brand: { backgroundColor: "var(--tone-brand-soft)", borderColor: "var(--tone-brand-border)", color: "var(--tone-brand-fg)" },
|
|
48
|
+
sand: { backgroundColor: "var(--tone-sand-soft)", borderColor: "var(--tone-sand-border)", color: "var(--tone-sand-fg)" },
|
|
49
|
+
sage: { backgroundColor: "var(--tone-sage-soft)", borderColor: "var(--tone-sage-border)", color: "var(--tone-sage-fg)" },
|
|
50
|
+
success: { backgroundColor: "var(--status-success-soft)", borderColor: "var(--status-success-border)", color: "var(--status-success)" },
|
|
51
|
+
warning: { backgroundColor: "var(--status-warning-soft)", borderColor: "var(--status-warning-border)", color: "var(--status-warning)" },
|
|
52
|
+
error: { backgroundColor: "var(--status-error-soft)", borderColor: "var(--status-error-border)", color: "var(--status-error)" },
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export interface BadgeProps {
|
|
56
|
+
tone?: BadgeTone;
|
|
57
|
+
dot?: boolean;
|
|
58
|
+
icon?: React.ReactNode;
|
|
59
|
+
children: React.ReactNode;
|
|
60
|
+
className?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function Badge({ tone = "neutral", dot = true, icon, children, className }: BadgeProps) {
|
|
64
|
+
return (
|
|
65
|
+
<span
|
|
66
|
+
className={className}
|
|
67
|
+
style={{
|
|
68
|
+
display: "inline-flex",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
gap: 6,
|
|
71
|
+
padding: "3px 10px",
|
|
72
|
+
borderRadius: "var(--radius-pill, 9999px)",
|
|
73
|
+
borderWidth: 1,
|
|
74
|
+
borderStyle: "solid",
|
|
75
|
+
fontFamily: "var(--font-sans)",
|
|
76
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
77
|
+
fontWeight: 500,
|
|
78
|
+
lineHeight: 1.38,
|
|
79
|
+
whiteSpace: "nowrap",
|
|
80
|
+
...BADGE_STYLES[tone],
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
{icon ?? (dot ? <span aria-hidden="true" style={{ width: 6, height: 6, borderRadius: 9999, backgroundColor: "currentColor", flexShrink: 0 }} /> : null)}
|
|
84
|
+
{children}
|
|
85
|
+
</span>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* --- Stat KPI Tile (Full-box color mixing + --text-kpi tabular-nums; zero one-sided accent bar) --- */
|
|
90
|
+
|
|
91
|
+
export interface StatProps {
|
|
92
|
+
label: string;
|
|
93
|
+
value: string | number;
|
|
94
|
+
delta?: string;
|
|
95
|
+
tone?: MillarIconBoxTone;
|
|
96
|
+
icon?: React.ReactNode;
|
|
97
|
+
progressPercent?: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function Stat({ label, value, delta, tone = "brand", icon, progressPercent }: StatProps) {
|
|
101
|
+
return (
|
|
102
|
+
<Card surface="base" padding="default">
|
|
103
|
+
<div style={{ display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 12 }}>
|
|
104
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 4 }}>
|
|
105
|
+
<span style={{ fontSize: "var(--text-meta, 0.8125rem)", fontWeight: 500, color: "var(--fg-muted)" }}>{label}</span>
|
|
106
|
+
<span
|
|
107
|
+
className="tabular-nums"
|
|
108
|
+
style={{
|
|
109
|
+
fontFamily: "var(--font-display)",
|
|
110
|
+
fontSize: "var(--text-kpi, 1.5rem)",
|
|
111
|
+
fontWeight: 700,
|
|
112
|
+
lineHeight: 1.2,
|
|
113
|
+
letterSpacing: "var(--tracking-tight, -0.015em)",
|
|
114
|
+
color: "var(--fg-default)",
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
{value}
|
|
118
|
+
</span>
|
|
119
|
+
{delta ? (
|
|
120
|
+
<span style={{ fontSize: "var(--text-meta, 0.8125rem)", color: "var(--fg-subtle)" }}>{delta}</span>
|
|
121
|
+
) : null}
|
|
122
|
+
</div>
|
|
123
|
+
{icon ? (
|
|
124
|
+
<IconBox tone={tone} size="md">
|
|
125
|
+
{icon}
|
|
126
|
+
</IconBox>
|
|
127
|
+
) : null}
|
|
128
|
+
</div>
|
|
129
|
+
{typeof progressPercent === "number" ? (
|
|
130
|
+
<div
|
|
131
|
+
role="progressbar"
|
|
132
|
+
aria-valuenow={Math.max(0, Math.min(100, progressPercent))}
|
|
133
|
+
aria-valuemin={0}
|
|
134
|
+
aria-valuemax={100}
|
|
135
|
+
aria-label={label}
|
|
136
|
+
style={{
|
|
137
|
+
height: 6,
|
|
138
|
+
borderRadius: "var(--radius-pill, 9999px)",
|
|
139
|
+
backgroundColor: "var(--bg-surface-2)",
|
|
140
|
+
overflow: "hidden",
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
<div
|
|
144
|
+
style={{
|
|
145
|
+
width: `${Math.max(0, Math.min(100, progressPercent))}%`,
|
|
146
|
+
height: "100%",
|
|
147
|
+
borderRadius: "var(--radius-pill, 9999px)",
|
|
148
|
+
backgroundColor: tone === "sand" ? "var(--chart-neutral)" : "var(--chart-brand)",
|
|
149
|
+
}}
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
) : null}
|
|
153
|
+
</Card>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* --- Tabs (Full APG ArrowLeft/ArrowRight/Home/End keyboard contract) --- */
|
|
158
|
+
|
|
159
|
+
export interface TabItem {
|
|
160
|
+
id: string;
|
|
161
|
+
label: string;
|
|
162
|
+
content: React.ReactNode;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface TabsProps {
|
|
166
|
+
items: TabItem[];
|
|
167
|
+
activeId: string;
|
|
168
|
+
onChange: (id: string) => void;
|
|
169
|
+
ariaLabel: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function Tabs({ items, activeId, onChange, ariaLabel }: TabsProps) {
|
|
173
|
+
const baseId = useId();
|
|
174
|
+
const tabRefs = useRef<Array<HTMLButtonElement | null>>([]);
|
|
175
|
+
|
|
176
|
+
const handleKeyDown = (index: number, e: React.KeyboardEvent<HTMLButtonElement>) => {
|
|
177
|
+
let nextIndex = index;
|
|
178
|
+
if (e.key === "ArrowRight") nextIndex = (index + 1) % items.length;
|
|
179
|
+
else if (e.key === "ArrowLeft") nextIndex = (index - 1 + items.length) % items.length;
|
|
180
|
+
else if (e.key === "Home") nextIndex = 0;
|
|
181
|
+
else if (e.key === "End") nextIndex = items.length - 1;
|
|
182
|
+
else return;
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
const target = items[nextIndex];
|
|
185
|
+
if (target) {
|
|
186
|
+
onChange(target.id);
|
|
187
|
+
tabRefs.current[nextIndex]?.focus();
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const activeItem = items.find((i) => i.id === activeId) ?? items[0];
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
|
195
|
+
<div
|
|
196
|
+
role="tablist"
|
|
197
|
+
aria-label={ariaLabel}
|
|
198
|
+
style={{
|
|
199
|
+
display: "flex",
|
|
200
|
+
alignItems: "center",
|
|
201
|
+
gap: 4,
|
|
202
|
+
borderBottom: "1px solid var(--border-default)",
|
|
203
|
+
flexWrap: "wrap",
|
|
204
|
+
}}
|
|
205
|
+
>
|
|
206
|
+
{items.map((item, idx) => {
|
|
207
|
+
const selected = item.id === activeItem?.id;
|
|
208
|
+
return (
|
|
209
|
+
<button
|
|
210
|
+
key={item.id}
|
|
211
|
+
ref={(el) => {
|
|
212
|
+
tabRefs.current[idx] = el;
|
|
213
|
+
}}
|
|
214
|
+
id={`${baseId}-tab-${item.id}`}
|
|
215
|
+
type="button"
|
|
216
|
+
role="tab"
|
|
217
|
+
aria-selected={selected}
|
|
218
|
+
aria-controls={`${baseId}-panel-${item.id}`}
|
|
219
|
+
tabIndex={selected ? 0 : -1}
|
|
220
|
+
onClick={() => onChange(item.id)}
|
|
221
|
+
onKeyDown={(e) => handleKeyDown(idx, e)}
|
|
222
|
+
className="millar-focus"
|
|
223
|
+
style={{
|
|
224
|
+
padding: "10px 14px",
|
|
225
|
+
marginBottom: -1,
|
|
226
|
+
background: "transparent",
|
|
227
|
+
border: "none",
|
|
228
|
+
borderBottom: selected ? "2px solid var(--fg-accent)" : "2px solid transparent",
|
|
229
|
+
color: selected ? "var(--fg-default)" : "var(--fg-muted)",
|
|
230
|
+
fontFamily: "var(--font-sans)",
|
|
231
|
+
fontSize: "var(--text-body-sm, 0.875rem)",
|
|
232
|
+
fontWeight: selected ? 600 : 500,
|
|
233
|
+
cursor: "pointer",
|
|
234
|
+
}}
|
|
235
|
+
>
|
|
236
|
+
{item.label}
|
|
237
|
+
</button>
|
|
238
|
+
);
|
|
239
|
+
})}
|
|
240
|
+
</div>
|
|
241
|
+
{activeItem ? (
|
|
242
|
+
<div
|
|
243
|
+
id={`${baseId}-panel-${activeItem.id}`}
|
|
244
|
+
role="tabpanel"
|
|
245
|
+
aria-labelledby={`${baseId}-tab-${activeItem.id}`}
|
|
246
|
+
tabIndex={0}
|
|
247
|
+
className="millar-focus"
|
|
248
|
+
>
|
|
249
|
+
{activeItem.content}
|
|
250
|
+
</div>
|
|
251
|
+
) : null}
|
|
252
|
+
</div>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/* --- Segmented Control --- */
|
|
257
|
+
|
|
258
|
+
export interface SegmentedProps<T extends string> {
|
|
259
|
+
options: Array<{ value: T; label: string }>;
|
|
260
|
+
value: T;
|
|
261
|
+
onChange: (value: T) => void;
|
|
262
|
+
ariaLabel: string;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export function Segmented<T extends string>({ options, value, onChange, ariaLabel }: SegmentedProps<T>) {
|
|
266
|
+
return (
|
|
267
|
+
<div
|
|
268
|
+
role="group"
|
|
269
|
+
aria-label={ariaLabel}
|
|
270
|
+
style={{
|
|
271
|
+
display: "inline-flex",
|
|
272
|
+
alignItems: "center",
|
|
273
|
+
padding: 3,
|
|
274
|
+
gap: 2,
|
|
275
|
+
border: "1px solid var(--border-default)",
|
|
276
|
+
borderRadius: "var(--radius-control, 10px)",
|
|
277
|
+
backgroundColor: "transparent",
|
|
278
|
+
}}
|
|
279
|
+
>
|
|
280
|
+
{options.map((opt) => {
|
|
281
|
+
const active = opt.value === value;
|
|
282
|
+
return (
|
|
283
|
+
<button
|
|
284
|
+
key={opt.value}
|
|
285
|
+
type="button"
|
|
286
|
+
aria-pressed={active}
|
|
287
|
+
onClick={() => onChange(opt.value)}
|
|
288
|
+
className="millar-focus"
|
|
289
|
+
style={{
|
|
290
|
+
padding: "6px 12px",
|
|
291
|
+
borderRadius: 7,
|
|
292
|
+
border: "1px solid",
|
|
293
|
+
borderColor: active ? "var(--fg-accent)" : "transparent",
|
|
294
|
+
backgroundColor: active ? "var(--tone-brand-soft)" : "transparent",
|
|
295
|
+
color: active ? "var(--fg-default)" : "var(--fg-muted)",
|
|
296
|
+
fontFamily: "var(--font-sans)",
|
|
297
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
298
|
+
fontWeight: 500,
|
|
299
|
+
cursor: "pointer",
|
|
300
|
+
}}
|
|
301
|
+
>
|
|
302
|
+
{opt.label}
|
|
303
|
+
</button>
|
|
304
|
+
);
|
|
305
|
+
})}
|
|
306
|
+
</div>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* --- DataTable (Zero-scrollbar rule, '-' empty cell, mobileCard support) --- */
|
|
311
|
+
|
|
312
|
+
export interface DataTableColumn<T> {
|
|
313
|
+
key: string;
|
|
314
|
+
header: string;
|
|
315
|
+
align?: "left" | "right";
|
|
316
|
+
numeric?: boolean;
|
|
317
|
+
render?: (row: T) => React.ReactNode;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export interface DataTableProps<T extends Record<string, unknown>> {
|
|
321
|
+
columns: Array<DataTableColumn<T>>;
|
|
322
|
+
rows: T[];
|
|
323
|
+
rowKey: (row: T) => string;
|
|
324
|
+
caption?: string;
|
|
325
|
+
emptyLabel?: string;
|
|
326
|
+
mobileCard?: (row: T) => React.ReactNode;
|
|
327
|
+
forceMobileCards?: boolean;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export function DataTable<T extends Record<string, unknown>>({
|
|
331
|
+
columns,
|
|
332
|
+
rows,
|
|
333
|
+
rowKey,
|
|
334
|
+
caption,
|
|
335
|
+
emptyLabel = "No records found.",
|
|
336
|
+
mobileCard,
|
|
337
|
+
forceMobileCards = false,
|
|
338
|
+
}: DataTableProps<T>) {
|
|
339
|
+
if (rows.length === 0) {
|
|
340
|
+
return (
|
|
341
|
+
<Card surface="inset" padding="default">
|
|
342
|
+
<p style={{ margin: 0, fontSize: "var(--text-body-sm, 0.875rem)", color: "var(--fg-muted)", textAlign: "center" }}>
|
|
343
|
+
{emptyLabel}
|
|
344
|
+
</p>
|
|
345
|
+
</Card>
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (forceMobileCards && mobileCard) {
|
|
350
|
+
return (
|
|
351
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "var(--row-gap, 10px)" }}>
|
|
352
|
+
{rows.map((row) => (
|
|
353
|
+
<Card key={rowKey(row)} surface="base" padding="compact">
|
|
354
|
+
{mobileCard(row)}
|
|
355
|
+
</Card>
|
|
356
|
+
))}
|
|
357
|
+
</div>
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return (
|
|
362
|
+
<div
|
|
363
|
+
style={{
|
|
364
|
+
borderRadius: "var(--radius-lg, 16px)",
|
|
365
|
+
border: "1px solid var(--border-default)",
|
|
366
|
+
backgroundColor: "var(--bg-surface)",
|
|
367
|
+
overflow: "hidden",
|
|
368
|
+
}}
|
|
369
|
+
>
|
|
370
|
+
<table style={{ width: "100%", borderCollapse: "collapse", tableLayout: "fixed" }}>
|
|
371
|
+
{caption ? (
|
|
372
|
+
<caption
|
|
373
|
+
style={{
|
|
374
|
+
textAlign: "left",
|
|
375
|
+
padding: "10px 14px",
|
|
376
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
377
|
+
color: "var(--fg-subtle)",
|
|
378
|
+
borderBottom: "1px solid var(--border-soft)",
|
|
379
|
+
}}
|
|
380
|
+
>
|
|
381
|
+
{caption}
|
|
382
|
+
</caption>
|
|
383
|
+
) : null}
|
|
384
|
+
<thead>
|
|
385
|
+
<tr style={{ backgroundColor: "var(--bg-surface-2)", borderBottom: "1px solid var(--border-default)" }}>
|
|
386
|
+
{columns.map((col) => (
|
|
387
|
+
<th
|
|
388
|
+
key={col.key}
|
|
389
|
+
scope="col"
|
|
390
|
+
style={{
|
|
391
|
+
padding: "var(--row-padding-block, 11px) var(--row-padding-inline, 14px)",
|
|
392
|
+
textAlign: col.align ?? "left",
|
|
393
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
394
|
+
fontWeight: 600,
|
|
395
|
+
color: "var(--fg-muted)",
|
|
396
|
+
}}
|
|
397
|
+
>
|
|
398
|
+
{col.header}
|
|
399
|
+
</th>
|
|
400
|
+
))}
|
|
401
|
+
</tr>
|
|
402
|
+
</thead>
|
|
403
|
+
<tbody>
|
|
404
|
+
{rows.map((row, rIdx) => (
|
|
405
|
+
<tr
|
|
406
|
+
key={rowKey(row)}
|
|
407
|
+
style={{
|
|
408
|
+
borderBottom: rIdx === rows.length - 1 ? "none" : "1px solid var(--border-soft)",
|
|
409
|
+
}}
|
|
410
|
+
>
|
|
411
|
+
{columns.map((col) => {
|
|
412
|
+
const rawVal = row[col.key];
|
|
413
|
+
const rendered = col.render ? col.render(row) : rawVal === null || rawVal === undefined || rawVal === "" ? "-" : String(rawVal);
|
|
414
|
+
return (
|
|
415
|
+
<td
|
|
416
|
+
key={col.key}
|
|
417
|
+
className={clsx(col.numeric && "tabular-nums")}
|
|
418
|
+
style={{
|
|
419
|
+
padding: "var(--row-padding-block, 11px) var(--row-padding-inline, 14px)",
|
|
420
|
+
textAlign: col.align ?? "left",
|
|
421
|
+
fontSize: "var(--text-body-sm, 0.875rem)",
|
|
422
|
+
color: "var(--fg-default)",
|
|
423
|
+
wordBreak: "break-word",
|
|
424
|
+
}}
|
|
425
|
+
>
|
|
426
|
+
{rendered}
|
|
427
|
+
</td>
|
|
428
|
+
);
|
|
429
|
+
})}
|
|
430
|
+
</tr>
|
|
431
|
+
))}
|
|
432
|
+
</tbody>
|
|
433
|
+
</table>
|
|
434
|
+
</div>
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/* --- FilterBar --- */
|
|
439
|
+
|
|
440
|
+
export interface ActiveFilterPill {
|
|
441
|
+
key: string;
|
|
442
|
+
label: string;
|
|
443
|
+
onRemove: () => void;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export interface FilterBarProps {
|
|
447
|
+
searchValue: string;
|
|
448
|
+
onSearchChange: (val: string) => void;
|
|
449
|
+
searchPlaceholder?: string;
|
|
450
|
+
filters?: React.ReactNode;
|
|
451
|
+
activePills?: ActiveFilterPill[];
|
|
452
|
+
onClearAll?: () => void;
|
|
453
|
+
extra?: React.ReactNode;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export function FilterBar({
|
|
457
|
+
searchValue,
|
|
458
|
+
onSearchChange,
|
|
459
|
+
searchPlaceholder = "Search...",
|
|
460
|
+
filters,
|
|
461
|
+
activePills = [],
|
|
462
|
+
onClearAll,
|
|
463
|
+
extra,
|
|
464
|
+
}: FilterBarProps) {
|
|
465
|
+
return (
|
|
466
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
|
|
467
|
+
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 10, flexWrap: "wrap" }}>
|
|
468
|
+
<div style={{ display: "flex", alignItems: "center", gap: 10, flex: "1 1 280px", flexWrap: "wrap" }}>
|
|
469
|
+
<div style={{ position: "relative", flex: "1 1 220px", maxWidth: 340 }}>
|
|
470
|
+
<span
|
|
471
|
+
aria-hidden="true"
|
|
472
|
+
style={{ position: "absolute", left: 12, top: "50%", transform: "translateY(-50%)", color: "var(--fg-subtle)", display: "inline-flex" }}
|
|
473
|
+
>
|
|
474
|
+
<IconSearch size="md" />
|
|
475
|
+
</span>
|
|
476
|
+
<input
|
|
477
|
+
type="search"
|
|
478
|
+
value={searchValue}
|
|
479
|
+
onChange={(e) => onSearchChange(e.target.value)}
|
|
480
|
+
placeholder={searchPlaceholder}
|
|
481
|
+
aria-label={searchPlaceholder}
|
|
482
|
+
className="millar-focus"
|
|
483
|
+
style={{
|
|
484
|
+
width: "100%",
|
|
485
|
+
height: 40,
|
|
486
|
+
padding: "0 12px 0 36px",
|
|
487
|
+
borderRadius: "var(--radius-control, 10px)",
|
|
488
|
+
border: "1px solid var(--border-default)",
|
|
489
|
+
backgroundColor: "var(--bg-surface)",
|
|
490
|
+
color: "var(--fg-default)",
|
|
491
|
+
fontFamily: "var(--font-sans)",
|
|
492
|
+
fontSize: "var(--text-body-sm, 0.875rem)",
|
|
493
|
+
}}
|
|
494
|
+
/>
|
|
495
|
+
</div>
|
|
496
|
+
{filters}
|
|
497
|
+
</div>
|
|
498
|
+
{extra}
|
|
499
|
+
</div>
|
|
500
|
+
{activePills.length > 0 ? (
|
|
501
|
+
<div style={{ display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }}>
|
|
502
|
+
{activePills.map((pill) => (
|
|
503
|
+
<span
|
|
504
|
+
key={pill.key}
|
|
505
|
+
style={{
|
|
506
|
+
display: "inline-flex",
|
|
507
|
+
alignItems: "center",
|
|
508
|
+
gap: 6,
|
|
509
|
+
padding: "3px 8px 3px 10px",
|
|
510
|
+
borderRadius: "var(--radius-pill, 9999px)",
|
|
511
|
+
border: "1px solid var(--tone-brand-border)",
|
|
512
|
+
backgroundColor: "var(--tone-brand-soft)",
|
|
513
|
+
color: "var(--tone-brand-fg)",
|
|
514
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
515
|
+
fontWeight: 500,
|
|
516
|
+
}}
|
|
517
|
+
>
|
|
518
|
+
{pill.label}
|
|
519
|
+
<button
|
|
520
|
+
type="button"
|
|
521
|
+
aria-label={`Remove filter ${pill.label}`}
|
|
522
|
+
onClick={pill.onRemove}
|
|
523
|
+
className="millar-focus"
|
|
524
|
+
style={{
|
|
525
|
+
display: "inline-flex",
|
|
526
|
+
alignItems: "center",
|
|
527
|
+
justifyContent: "center",
|
|
528
|
+
width: 24,
|
|
529
|
+
height: 24,
|
|
530
|
+
padding: 0,
|
|
531
|
+
border: "none",
|
|
532
|
+
borderRadius: 9999,
|
|
533
|
+
background: "transparent",
|
|
534
|
+
color: "inherit",
|
|
535
|
+
cursor: "pointer",
|
|
536
|
+
}}
|
|
537
|
+
>
|
|
538
|
+
<IconClose size="sm" />
|
|
539
|
+
</button>
|
|
540
|
+
</span>
|
|
541
|
+
))}
|
|
542
|
+
{onClearAll ? (
|
|
543
|
+
<button
|
|
544
|
+
type="button"
|
|
545
|
+
onClick={onClearAll}
|
|
546
|
+
className="millar-focus"
|
|
547
|
+
style={{
|
|
548
|
+
background: "transparent",
|
|
549
|
+
border: "none",
|
|
550
|
+
color: "var(--fg-accent)",
|
|
551
|
+
fontSize: "var(--text-meta, 0.8125rem)",
|
|
552
|
+
fontWeight: 500,
|
|
553
|
+
cursor: "pointer",
|
|
554
|
+
padding: "4px 6px",
|
|
555
|
+
}}
|
|
556
|
+
>
|
|
557
|
+
Clear all
|
|
558
|
+
</button>
|
|
559
|
+
) : null}
|
|
560
|
+
</div>
|
|
561
|
+
) : null}
|
|
562
|
+
</div>
|
|
563
|
+
);
|
|
564
|
+
}
|
package/dist/stdio.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":""}
|