@behavioral-agentic-design-system/core 0.6.0 → 0.8.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.
- package/LICENSE +21 -0
- package/package.json +35 -6
- package/scripts/bads-sync.mjs +1 -1
- package/scripts/build-fonts.cjs +15 -8
- package/scripts/build-tokens.cjs +139 -23
- package/src/api/brand-fonts.ts +27 -6
- package/src/api/layers/file.ts +4 -3
- package/src/api/layers.ts +41 -12
- package/src/api/onboarding-extract.ts +435 -0
- package/src/api/onboarding.ts +82 -0
- package/src/api/site-auth.ts +50 -0
- package/src/app/font-ready.tsx +1 -1
- package/src/app/layout.tsx +9 -3
- package/src/app/preview/components/page.tsx +78 -1
- package/src/app/preview/icons/page.tsx +5 -0
- package/src/app/shell.tsx +90 -23
- package/src/app/site-login/page.tsx +82 -0
- package/src/brand-fonts.css +5 -0
- package/src/components/Foundations/Colors.stories.tsx +10 -1
- package/src/components/Foundations/Motion.stories.tsx +66 -0
- package/src/components/customize/letter-spacing.tsx +3 -2
- package/src/components/customize/type-scale.tsx +3 -2
- package/src/components/customize-tab.tsx +11 -7
- package/src/components/home-tab.tsx +498 -235
- package/src/components/layers-tab.tsx +313 -10
- package/src/components/onboarding-wizard.tsx +1421 -0
- package/src/components/ui/alert.tsx +2 -2
- package/src/components/ui/bottom-sheet.tsx +124 -0
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/chart.tsx +115 -14
- package/src/components/ui/checkbox.tsx +3 -2
- package/src/components/ui/dialog.tsx +7 -4
- package/src/components/ui/dropdown-menu.tsx +4 -0
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/popover.tsx +6 -0
- package/src/components/ui/radio-group.tsx +4 -3
- package/src/components/ui/scroll-area.tsx +5 -0
- package/src/components/ui/select.tsx +4 -0
- package/src/components/ui/sheet.tsx +8 -1
- package/src/components/ui/slider.tsx +22 -7
- package/src/components/ui/switch.tsx +3 -3
- package/src/components/ui/tabs.tsx +6 -0
- package/src/components/ui/tooltip.tsx +4 -0
- package/src/fonts/HyperlegibleSans-Bold.woff2 +0 -0
- package/src/fonts/HyperlegibleSans-BoldItalic.woff2 +0 -0
- package/src/fonts/HyperlegibleSans-Italic.woff2 +0 -0
- package/src/fonts/HyperlegibleSans-Medium.woff2 +0 -0
- package/src/fonts/HyperlegibleSans-MediumItalic.woff2 +0 -0
- package/src/fonts/HyperlegibleSans-Regular.woff2 +0 -0
- package/src/fonts/InterVariable-Italic.woff2 +0 -0
- package/src/fonts/InterVariable.woff2 +0 -0
- package/src/fonts.css +99 -0
- package/src/hooks/use-global-primary-color.ts +114 -68
- package/src/hooks/use-global-serif-font.ts +1 -1
- package/src/hooks/use-portal-theme-class.tsx +90 -0
- package/src/lib/storage.ts +2 -2
- package/src/styles.css +151 -61
- package/src/tokens.default.json +4 -4
- package/src/tokens.json +159 -162
- package/src/app/preview/login/page.tsx +0 -5
- package/src/app/preview/mail/page.tsx +0 -4
- package/src/app/preview/pricing/page.tsx +0 -4
- package/src/components/admin-menu.stories.tsx +0 -68
- package/src/components/admin-menu.tsx +0 -59
|
@@ -25,6 +25,16 @@ import {
|
|
|
25
25
|
DialogTitle,
|
|
26
26
|
DialogTrigger,
|
|
27
27
|
} from "@behavioral-agentic-design-system/core/components/ui/dialog";
|
|
28
|
+
import {
|
|
29
|
+
BottomSheet,
|
|
30
|
+
BottomSheetClose,
|
|
31
|
+
BottomSheetContent,
|
|
32
|
+
BottomSheetDescription,
|
|
33
|
+
BottomSheetFooter,
|
|
34
|
+
BottomSheetHeader,
|
|
35
|
+
BottomSheetTitle,
|
|
36
|
+
BottomSheetTrigger,
|
|
37
|
+
} from "@behavioral-agentic-design-system/core/components/ui/bottom-sheet";
|
|
28
38
|
import { Sparkles, Info } from "lucide-react";
|
|
29
39
|
|
|
30
40
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
@@ -39,7 +49,7 @@ function Section({ title, children }: { title: string; children: React.ReactNode
|
|
|
39
49
|
return (
|
|
40
50
|
<section className="space-y-4">
|
|
41
51
|
<h2 className="text-2xl font-semibold tracking-tight">{title}</h2>
|
|
42
|
-
<
|
|
52
|
+
<Card className="p-6 shadow-none">{children}</Card>
|
|
43
53
|
</section>
|
|
44
54
|
);
|
|
45
55
|
}
|
|
@@ -226,6 +236,73 @@ export default function ComponentsPreview() {
|
|
|
226
236
|
</ul>
|
|
227
237
|
</ScrollArea>
|
|
228
238
|
</Section>
|
|
239
|
+
|
|
240
|
+
<Section title="BottomSheet">
|
|
241
|
+
<div className="flex flex-wrap gap-3">
|
|
242
|
+
{/* Default — grab handle + close button */}
|
|
243
|
+
<BottomSheet>
|
|
244
|
+
<BottomSheetTrigger asChild>
|
|
245
|
+
<Button variant="outline">Open</Button>
|
|
246
|
+
</BottomSheetTrigger>
|
|
247
|
+
<BottomSheetContent>
|
|
248
|
+
<BottomSheetHeader>
|
|
249
|
+
<BottomSheetTitle>Display density</BottomSheetTitle>
|
|
250
|
+
<BottomSheetDescription>
|
|
251
|
+
Choose how much information shows on each row.
|
|
252
|
+
</BottomSheetDescription>
|
|
253
|
+
</BottomSheetHeader>
|
|
254
|
+
</BottomSheetContent>
|
|
255
|
+
</BottomSheet>
|
|
256
|
+
|
|
257
|
+
{/* No handle variant */}
|
|
258
|
+
<BottomSheet>
|
|
259
|
+
<BottomSheetTrigger asChild>
|
|
260
|
+
<Button variant="outline">No handle</Button>
|
|
261
|
+
</BottomSheetTrigger>
|
|
262
|
+
<BottomSheetContent showHandle={false}>
|
|
263
|
+
<BottomSheetHeader>
|
|
264
|
+
<BottomSheetTitle>No grab handle</BottomSheetTitle>
|
|
265
|
+
<BottomSheetDescription>
|
|
266
|
+
Handle hidden via showHandle={"{false}"}.
|
|
267
|
+
</BottomSheetDescription>
|
|
268
|
+
</BottomSheetHeader>
|
|
269
|
+
</BottomSheetContent>
|
|
270
|
+
</BottomSheet>
|
|
271
|
+
|
|
272
|
+
{/* Realistic action sheet with a footer */}
|
|
273
|
+
<BottomSheet>
|
|
274
|
+
<BottomSheetTrigger asChild>
|
|
275
|
+
<Button>View settings</Button>
|
|
276
|
+
</BottomSheetTrigger>
|
|
277
|
+
<BottomSheetContent>
|
|
278
|
+
<BottomSheetHeader>
|
|
279
|
+
<BottomSheetTitle>View settings</BottomSheetTitle>
|
|
280
|
+
<BottomSheetDescription>
|
|
281
|
+
These apply to the Components board only.
|
|
282
|
+
</BottomSheetDescription>
|
|
283
|
+
</BottomSheetHeader>
|
|
284
|
+
<div className="flex flex-col gap-5 px-4 py-2">
|
|
285
|
+
<div className="flex items-center justify-between">
|
|
286
|
+
<Label htmlFor="density-group">Group by status</Label>
|
|
287
|
+
<Switch id="density-group" defaultChecked />
|
|
288
|
+
</div>
|
|
289
|
+
<div className="flex items-center justify-between">
|
|
290
|
+
<Label htmlFor="density-sub">Show sub-tasks</Label>
|
|
291
|
+
<Switch id="density-sub" />
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
<BottomSheetFooter className="flex-row justify-end gap-2">
|
|
295
|
+
<BottomSheetClose asChild>
|
|
296
|
+
<Button variant="ghost">Cancel</Button>
|
|
297
|
+
</BottomSheetClose>
|
|
298
|
+
<BottomSheetClose asChild>
|
|
299
|
+
<Button>Apply</Button>
|
|
300
|
+
</BottomSheetClose>
|
|
301
|
+
</BottomSheetFooter>
|
|
302
|
+
</BottomSheetContent>
|
|
303
|
+
</BottomSheet>
|
|
304
|
+
</div>
|
|
305
|
+
</Section>
|
|
229
306
|
</div>
|
|
230
307
|
</div>
|
|
231
308
|
);
|
package/src/app/shell.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { useState, useEffect, useRef, useCallback, createContext, useContext, us
|
|
|
4
4
|
import { Tabs, TabsContent, TabsList, TabsPanels, TabsTrigger } from "@behavioral-agentic-design-system/core/components/ui/tabs";
|
|
5
5
|
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
6
6
|
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
7
|
-
import { Sun, Moon, BookOpen } from "lucide-react";
|
|
7
|
+
import { Sun, Moon, BookOpen, X } from "lucide-react";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Inline GitHub mark. Lucide dropped brand icons (Github / Twitter / etc.) in
|
|
@@ -30,7 +30,11 @@ import { CustomizeTab } from "@behavioral-agentic-design-system/core/components/
|
|
|
30
30
|
import { LayersTab } from "@behavioral-agentic-design-system/core/components/layers-tab";
|
|
31
31
|
import { HomeTab } from "@behavioral-agentic-design-system/core/components/home-tab";
|
|
32
32
|
import { BrandMark } from "@behavioral-agentic-design-system/core/components/brand-mark";
|
|
33
|
-
import {
|
|
33
|
+
import { OnboardingWizard } from "@behavioral-agentic-design-system/core/components/onboarding-wizard";
|
|
34
|
+
|
|
35
|
+
const ONBOARDING_DISMISSED_KEY = "bads:onboarding-wizard:dismissed";
|
|
36
|
+
|
|
37
|
+
const SETUP_PROMPT = `You are setting up a fresh BADS fork. Use the in-app onboarding brief that the user just completed as your source of truth. Do not re-ask questions that are already answered. Ask only for missing or contradictory details, then run the canonical setup steps in order: rename, source discovery, brand context, voice, microcopy, ethics, tokens, components, patterns, and Chromatic baseline.`;
|
|
34
38
|
|
|
35
39
|
/**
|
|
36
40
|
* Iframe-hosted preview surface. Listens for the parent's dark-mode state and
|
|
@@ -109,12 +113,13 @@ export type ShellTabContext = {
|
|
|
109
113
|
};
|
|
110
114
|
|
|
111
115
|
/**
|
|
112
|
-
* Lets tab content request a tab switch without prop-drilling
|
|
113
|
-
*
|
|
114
|
-
*
|
|
116
|
+
* Lets tab content request a tab switch without prop-drilling through the
|
|
117
|
+
* render tree. Use when a button deep inside a tab (e.g. "Customize" CTA on
|
|
118
|
+
* the Home tab) needs to jump to another tab. The `goToTab` render-prop is
|
|
119
|
+
* still the right call for top-level tab components that already receive
|
|
120
|
+
* ShellTabContext directly.
|
|
115
121
|
*
|
|
116
|
-
* Falls back to a no-op
|
|
117
|
-
* Home tab stays usable in isolation.
|
|
122
|
+
* Falls back to a no-op outside Shell so Home stays usable in storybook.
|
|
118
123
|
*/
|
|
119
124
|
type ShellNav = { setTab: (value: string) => void };
|
|
120
125
|
const ShellNavContext = createContext<ShellNav | null>(null);
|
|
@@ -133,6 +138,14 @@ export type ShellTab = {
|
|
|
133
138
|
value: string;
|
|
134
139
|
label: string;
|
|
135
140
|
hidden?: "md";
|
|
141
|
+
/**
|
|
142
|
+
* Skip the preload-all warm-up AND only mount this tab while it's active
|
|
143
|
+
* (unmount on leave). Use for tabs whose content is too heavy to sit in the
|
|
144
|
+
* DOM permanently — e.g. the Icons tab renders ~1,700 SVGs whose theme
|
|
145
|
+
* repaint, when kept mounted, stutters the dark/light view-transition on
|
|
146
|
+
* every toggle. Trade-off: a brief reload when you revisit the tab.
|
|
147
|
+
*/
|
|
148
|
+
noPreload?: boolean;
|
|
136
149
|
render: (ctx: ShellTabContext) => React.ReactNode;
|
|
137
150
|
};
|
|
138
151
|
|
|
@@ -152,9 +165,8 @@ export const DEFAULT_TABS: ShellTab[] = [
|
|
|
152
165
|
{ value: "components", label: "Components", render: ({ dark }) => <IframePreview dark={dark} src="/preview/components" /> },
|
|
153
166
|
{ value: "cards", label: "Cards", render: ({ dark }) => <IframePreview dark={dark} src="/preview/cards" /> },
|
|
154
167
|
{ value: "dashboard", label: "Dashboard", hidden: "md", render: ({ dark }) => <IframePreview dark={dark} src="/preview/dashboard" minWidth="1400px" /> },
|
|
155
|
-
{ value: "mail", label: "Mail", hidden: "md", render: ({ dark }) => <IframePreview dark={dark} src="/preview/mail" minWidth="1300px" /> },
|
|
156
|
-
{ value: "pricing", label: "Pricing", render: ({ dark }) => <IframePreview dark={dark} src="/preview/pricing" /> },
|
|
157
168
|
{ value: "layers", label: "Layers", render: () => <LayersTab /> },
|
|
169
|
+
{ value: "icons", label: "Icons", noPreload: true, render: ({ dark }) => <IframePreview dark={dark} src="/preview/icons" /> },
|
|
158
170
|
{ value: "colors", label: "Customize", render: () => <CustomizeTab /> },
|
|
159
171
|
];
|
|
160
172
|
|
|
@@ -172,6 +184,26 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
172
184
|
const initialTab = defaultTab ?? tabs[0]?.value ?? "home";
|
|
173
185
|
const [activeTab, setActiveTab] = useState(initialTab);
|
|
174
186
|
const [dark, setDark] = useState(false);
|
|
187
|
+
// Fresh-fork onboarding: only render when brand still says "BADS" (the rename
|
|
188
|
+
// hasn't run yet) AND the user hasn't dismissed the wizard this session.
|
|
189
|
+
// Renamed forks never see this — they've already gone through onboarding.
|
|
190
|
+
const isFreshFork = brand.name === "BADS";
|
|
191
|
+
const [onboardingDismissed, setOnboardingDismissed] = useState(true);
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
if (!isFreshFork) return;
|
|
194
|
+
try {
|
|
195
|
+
setOnboardingDismissed(window.localStorage.getItem(ONBOARDING_DISMISSED_KEY) === "1");
|
|
196
|
+
} catch {
|
|
197
|
+
setOnboardingDismissed(false);
|
|
198
|
+
}
|
|
199
|
+
}, [isFreshFork]);
|
|
200
|
+
const dismissOnboarding = () => {
|
|
201
|
+
try {
|
|
202
|
+
window.localStorage.setItem(ONBOARDING_DISMISSED_KEY, "1");
|
|
203
|
+
} catch {}
|
|
204
|
+
setOnboardingDismissed(true);
|
|
205
|
+
};
|
|
206
|
+
const showOnboarding = isFreshFork && !onboardingDismissed;
|
|
175
207
|
// Sticky-mount: once a tab has been viewed, keep it mounted forever so the
|
|
176
208
|
// iframe (or React tree) doesn't cold-load on every switch. TabsPanels
|
|
177
209
|
// cross-fades between mounted siblings, so subsequent switches are instant
|
|
@@ -192,7 +224,12 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
192
224
|
const preloadAll = () => {
|
|
193
225
|
setSeen((prev) => {
|
|
194
226
|
const next = new Set(prev);
|
|
195
|
-
tabs.
|
|
227
|
+
// noPreload tabs (e.g. Icons) are intentionally left out — they mount
|
|
228
|
+
// only while active so their heavy content doesn't sit in the DOM
|
|
229
|
+
// repainting on every theme toggle.
|
|
230
|
+
tabs.forEach((t) => {
|
|
231
|
+
if (!t.noPreload) next.add(t.value);
|
|
232
|
+
});
|
|
196
233
|
return next;
|
|
197
234
|
});
|
|
198
235
|
};
|
|
@@ -216,11 +253,18 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
216
253
|
const prefersReduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
217
254
|
const supports = typeof document !== "undefined" && "startViewTransition" in document;
|
|
218
255
|
|
|
219
|
-
// Sync
|
|
220
|
-
//
|
|
221
|
-
//
|
|
256
|
+
// Sync EVERY mounted iframe's theme right now, synchronously, inside the
|
|
257
|
+
// transition callback — so all the repaint work happens UP FRONT, before
|
|
258
|
+
// the iris wipe animates, and nothing repaints mid-animation to steal
|
|
259
|
+
// frames. (Deferring off-screen iframes to the per-IframePreview useEffect
|
|
260
|
+
// is what made the wipe stutter: that repaint landed while the 0.4s
|
|
261
|
+
// animation was running.) This is safe now that the one expensive surface,
|
|
262
|
+
// the Icons tab, is lazy-mounted (noPreload — not in the DOM unless active)
|
|
263
|
+
// and its grid renders incrementally, so there's no ~1,700-SVG iframe to
|
|
264
|
+
// pay for here. Matches the smooth behavior of client forks without an
|
|
265
|
+
// Icons tab.
|
|
222
266
|
const syncIframes = () => {
|
|
223
|
-
document.querySelectorAll("iframe").forEach((f) => {
|
|
267
|
+
document.querySelectorAll<HTMLIFrameElement>("iframe").forEach((f) => {
|
|
224
268
|
try {
|
|
225
269
|
f.contentDocument?.documentElement.classList.toggle("dark", next);
|
|
226
270
|
} catch {}
|
|
@@ -268,9 +312,9 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
268
312
|
variant="ghost"
|
|
269
313
|
size="sm"
|
|
270
314
|
className="group h-8 gap-1.5 border border-foreground/30 hover:!bg-foreground hover:!text-background hover:border-foreground"
|
|
271
|
-
title="Open Storybook (requires `pnpm dev` or `pnpm storybook` to be running on :
|
|
315
|
+
title="Open Storybook (requires `pnpm dev` or `pnpm storybook` to be running on :6080)"
|
|
272
316
|
>
|
|
273
|
-
<a href="http://localhost:
|
|
317
|
+
<a href="http://localhost:6080" target="_blank" rel="noreferrer" aria-label="Open Storybook in a new tab">
|
|
274
318
|
<BookOpen className="h-4 w-4 transition-all group-hover:scale-110" strokeWidth={1.5} />
|
|
275
319
|
<span className="text-xs font-medium">Storybook</span>
|
|
276
320
|
</a>
|
|
@@ -333,21 +377,44 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
333
377
|
<section className="relative flex-1 min-h-0 w-full overflow-hidden">
|
|
334
378
|
<div className="absolute inset-x-4 top-1 bottom-4 isolate overflow-hidden rounded-lg">
|
|
335
379
|
<TabsPanels>
|
|
336
|
-
{tabs.map((tab) =>
|
|
337
|
-
|
|
380
|
+
{tabs.map((tab) => {
|
|
381
|
+
// noPreload tabs mount only while active (and unmount on leave);
|
|
382
|
+
// everything else mounts once seen and stays for instant
|
|
383
|
+
// cross-fades. See ShellTab.noPreload.
|
|
384
|
+
const mounted = tab.noPreload ? activeTab === tab.value : seen.has(tab.value);
|
|
385
|
+
return mounted ? (
|
|
338
386
|
<TabsContent key={tab.value} value={tab.value} forceMount>
|
|
339
387
|
{tab.render(ctx)}
|
|
340
388
|
</TabsContent>
|
|
341
|
-
) : null
|
|
342
|
-
)}
|
|
389
|
+
) : null;
|
|
390
|
+
})}
|
|
343
391
|
</TabsPanels>
|
|
344
392
|
</div>
|
|
345
393
|
</section>
|
|
346
394
|
</Tabs>
|
|
347
395
|
|
|
348
|
-
|
|
349
|
-
<
|
|
350
|
-
|
|
396
|
+
{showOnboarding ? (
|
|
397
|
+
<div
|
|
398
|
+
role="dialog"
|
|
399
|
+
aria-modal="true"
|
|
400
|
+
aria-label="Onboarding"
|
|
401
|
+
className="fixed inset-0 z-50 flex items-start justify-center overflow-y-auto bg-background/80 p-4 backdrop-blur-sm md:p-8"
|
|
402
|
+
>
|
|
403
|
+
<div className="relative w-full max-w-5xl">
|
|
404
|
+
<Button
|
|
405
|
+
type="button"
|
|
406
|
+
variant="ghost"
|
|
407
|
+
size="icon"
|
|
408
|
+
onClick={dismissOnboarding}
|
|
409
|
+
className="absolute -top-2 -right-2 z-10 size-9 rounded-full bg-background shadow-md ring-1 ring-border hover:bg-muted"
|
|
410
|
+
aria-label="Dismiss onboarding for now"
|
|
411
|
+
>
|
|
412
|
+
<X className="h-4 w-4" strokeWidth={1.5} />
|
|
413
|
+
</Button>
|
|
414
|
+
<OnboardingWizard setupPrompt={SETUP_PROMPT} defaultProductName={brand.name} />
|
|
415
|
+
</div>
|
|
416
|
+
</div>
|
|
417
|
+
) : null}
|
|
351
418
|
</div>
|
|
352
419
|
</ShellNavContext.Provider>
|
|
353
420
|
);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { brand } from "@/brand.config";
|
|
2
|
+
import { BrandMark } from "@behavioral-agentic-design-system/core/components/brand-mark";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Input,
|
|
6
|
+
} from "@behavioral-agentic-design-system/core/components/ui";
|
|
7
|
+
import {
|
|
8
|
+
Field,
|
|
9
|
+
FieldError,
|
|
10
|
+
FieldLabel,
|
|
11
|
+
} from "@behavioral-agentic-design-system/core/components/ui/field";
|
|
12
|
+
|
|
13
|
+
// Server-rendered password gate for the BADS demo deployment. Activated by
|
|
14
|
+
// middleware.ts when SITE_PASSWORD is set on the deployment target. Page is
|
|
15
|
+
// nested under the root layout so it inherits brand fonts + tokens — the
|
|
16
|
+
// gate feels like part of the system, not a generic basic-auth pop-up.
|
|
17
|
+
|
|
18
|
+
export default async function SiteLoginPage({
|
|
19
|
+
searchParams,
|
|
20
|
+
}: {
|
|
21
|
+
searchParams: Promise<{ next?: string; error?: string }>;
|
|
22
|
+
}) {
|
|
23
|
+
const { next = "/", error } = await searchParams;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<main className="grid min-h-screen place-items-center bg-background px-6 py-12">
|
|
27
|
+
<div className="w-full max-w-sm space-y-8">
|
|
28
|
+
<div className="flex items-center gap-3">
|
|
29
|
+
<BrandMark className="size-8" />
|
|
30
|
+
<div className="flex flex-col">
|
|
31
|
+
<span className="text-base font-medium leading-tight">
|
|
32
|
+
{brand.name}
|
|
33
|
+
</span>
|
|
34
|
+
<span className="text-xs text-muted-foreground">
|
|
35
|
+
{brand.tagline}
|
|
36
|
+
</span>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div className="space-y-2">
|
|
41
|
+
<h1 className="text-2xl font-semibold tracking-tight">
|
|
42
|
+
Password required
|
|
43
|
+
</h1>
|
|
44
|
+
<p className="text-sm text-muted-foreground">
|
|
45
|
+
This preview is gated while we tune it for the next round of
|
|
46
|
+
client reviews. Enter the shared password to continue.
|
|
47
|
+
</p>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<form
|
|
51
|
+
method="POST"
|
|
52
|
+
action="/api/site-auth"
|
|
53
|
+
className="space-y-4"
|
|
54
|
+
autoComplete="off"
|
|
55
|
+
>
|
|
56
|
+
<input type="hidden" name="next" value={next} />
|
|
57
|
+
<Field>
|
|
58
|
+
<FieldLabel htmlFor="site-password">Password</FieldLabel>
|
|
59
|
+
<Input
|
|
60
|
+
id="site-password"
|
|
61
|
+
name="password"
|
|
62
|
+
type="password"
|
|
63
|
+
autoComplete="off"
|
|
64
|
+
autoFocus
|
|
65
|
+
required
|
|
66
|
+
aria-invalid={error ? "true" : "false"}
|
|
67
|
+
aria-describedby={error ? "site-password-error" : undefined}
|
|
68
|
+
/>
|
|
69
|
+
{error && (
|
|
70
|
+
<FieldError id="site-password-error">
|
|
71
|
+
That password didn't match. Try again.
|
|
72
|
+
</FieldError>
|
|
73
|
+
)}
|
|
74
|
+
</Field>
|
|
75
|
+
<Button type="submit" size="xl" className="w-full">
|
|
76
|
+
Continue
|
|
77
|
+
</Button>
|
|
78
|
+
</form>
|
|
79
|
+
</div>
|
|
80
|
+
</main>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* GENERATED FROM brand-fonts.json — DO NOT EDIT BY HAND.
|
|
2
|
+
* Run `pnpm build:fonts` after changing brand-fonts.json (this happens
|
|
3
|
+
* automatically when fonts are added/removed via the Customize tab). */
|
|
4
|
+
|
|
5
|
+
/* No brand fonts registered yet. Add one via the Customize tab → font picker → "+". */
|
|
@@ -2,7 +2,16 @@ import type { Meta, StoryObj } from "@storybook/react";
|
|
|
2
2
|
|
|
3
3
|
const meta: Meta = {
|
|
4
4
|
title: "Foundations/Colors",
|
|
5
|
-
parameters: {
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: "fullscreen",
|
|
7
|
+
// This is a palette reference: every swatch paints a raw token as a
|
|
8
|
+
// *background* with its name laid over it. Some tokens (chart fills, the
|
|
9
|
+
// focus ring) are never text-bearing surfaces in product, so the label-on-
|
|
10
|
+
// swatch pair legitimately falls under AA here. Disable only color-contrast
|
|
11
|
+
// for this doc story — every other axe rule still runs, and real text/bg
|
|
12
|
+
// pairs stay enforced by `pnpm wcag:audit` (AAA) and the rest of CI.
|
|
13
|
+
a11y: { config: { rules: [{ id: "color-contrast", enabled: false }] } },
|
|
14
|
+
},
|
|
6
15
|
};
|
|
7
16
|
export default meta;
|
|
8
17
|
type Story = StoryObj<typeof meta>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
2
3
|
import { useState } from "react";
|
|
3
4
|
|
|
4
5
|
const meta: Meta = {
|
|
@@ -128,6 +129,71 @@ export const Easings: Story = {
|
|
|
128
129
|
},
|
|
129
130
|
};
|
|
130
131
|
|
|
132
|
+
// Semantic motion layer — intent-named pairs emitted as --motion-<intent>-*.
|
|
133
|
+
// Each demo animates the property the intent is meant for, driven entirely by
|
|
134
|
+
// the CSS vars (no hardcoded numbers), so it tracks tokens.json automatically.
|
|
135
|
+
const SEMANTIC_MOTIONS = [
|
|
136
|
+
{ name: "fade", prop: "opacity", from: "0", to: "1", note: "Overlays, content swaps, in-place appear" },
|
|
137
|
+
{ name: "slide", prop: "transform", from: "translateY(24px)", to: "translateY(0)", note: "Sheets, drawers, toasts from an edge" },
|
|
138
|
+
{ name: "scale", prop: "transform", from: "scale(0.85)", to: "scale(1)", note: "Popovers, menus, tooltips from origin" },
|
|
139
|
+
{ name: "expand", prop: "transform", from: "scaleY(0)", to: "scaleY(1)", note: "Accordions, collapsibles, disclosure" },
|
|
140
|
+
{ name: "spin", prop: "transform", from: "rotate(0deg)", to: "rotate(360deg)", note: "Loaders, busy chevrons (loops)" },
|
|
141
|
+
] as const;
|
|
142
|
+
|
|
143
|
+
export const SemanticMotion: Story = {
|
|
144
|
+
parameters: {
|
|
145
|
+
docs: {
|
|
146
|
+
description: {
|
|
147
|
+
story:
|
|
148
|
+
"Intent-named motion: reach for --motion-<intent>-duration / -ease instead of raw numbers. Each box animates with only its intent's CSS vars. See layer-6 motion.md for the decision tree.",
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
render: () => {
|
|
153
|
+
const [tick, setTick] = useState(0);
|
|
154
|
+
return (
|
|
155
|
+
<div className="p-8 bg-background">
|
|
156
|
+
<div className="flex items-baseline justify-between mb-6">
|
|
157
|
+
<h3 className="text-sm font-semibold text-muted-foreground">Semantic motion (by intent)</h3>
|
|
158
|
+
<button
|
|
159
|
+
type="button"
|
|
160
|
+
onClick={() => setTick((t) => t + 1)}
|
|
161
|
+
className="text-sm font-medium underline underline-offset-4 hover:text-primary"
|
|
162
|
+
>
|
|
163
|
+
Replay
|
|
164
|
+
</button>
|
|
165
|
+
</div>
|
|
166
|
+
<div className="space-y-6">
|
|
167
|
+
{SEMANTIC_MOTIONS.map((m) => (
|
|
168
|
+
<div key={m.name} className="flex items-center gap-6">
|
|
169
|
+
<div className="w-44 shrink-0">
|
|
170
|
+
<code className="text-xs font-mono text-foreground">--motion-{m.name}-*</code>
|
|
171
|
+
<p className="text-xs text-muted-foreground font-mono mt-0.5">
|
|
172
|
+
duration / ease
|
|
173
|
+
</p>
|
|
174
|
+
</div>
|
|
175
|
+
<div className="relative h-12 w-12">
|
|
176
|
+
<div
|
|
177
|
+
key={tick}
|
|
178
|
+
className="h-12 w-12 rounded-md bg-primary"
|
|
179
|
+
style={{
|
|
180
|
+
transition: `${m.prop} var(--motion-${m.name}-duration) var(--motion-${m.name}-ease)`,
|
|
181
|
+
transformOrigin: m.name === "expand" ? "top" : "center",
|
|
182
|
+
// Flip from "from" to "to" on each replay (key remount) so
|
|
183
|
+
// the transition plays. Cast covers the dynamic prop key.
|
|
184
|
+
[m.prop]: tick % 2 === 0 ? m.to : m.from,
|
|
185
|
+
} as CSSProperties}
|
|
186
|
+
/>
|
|
187
|
+
</div>
|
|
188
|
+
<p className="text-sm text-muted-foreground">{m.note}</p>
|
|
189
|
+
</div>
|
|
190
|
+
))}
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
);
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
|
|
131
197
|
export const ReducedMotion: Story = {
|
|
132
198
|
parameters: {
|
|
133
199
|
docs: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
4
|
+
import { Card } from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
4
5
|
import { Slider } from "@behavioral-agentic-design-system/core/components/ui/slider";
|
|
5
6
|
import {
|
|
6
7
|
DESIGN_CONTROL_DEFAULTS,
|
|
@@ -87,7 +88,7 @@ export function LetterSpacingPanel() {
|
|
|
87
88
|
</p>
|
|
88
89
|
</div>
|
|
89
90
|
|
|
90
|
-
<
|
|
91
|
+
<Card className="p-6 shadow-none space-y-3">
|
|
91
92
|
<p className="text-3xl font-semibold leading-tight">
|
|
92
93
|
The quick brown fox
|
|
93
94
|
</p>
|
|
@@ -98,7 +99,7 @@ export function LetterSpacingPanel() {
|
|
|
98
99
|
<p className="text-xs text-muted-foreground font-mono">
|
|
99
100
|
0123456789 — sample numerals
|
|
100
101
|
</p>
|
|
101
|
-
</
|
|
102
|
+
</Card>
|
|
102
103
|
</div>
|
|
103
104
|
</section>
|
|
104
105
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
4
|
+
import { Card } from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
4
5
|
import { Slider } from "@behavioral-agentic-design-system/core/components/ui/slider";
|
|
5
6
|
import {
|
|
6
7
|
RATIO_PRESETS,
|
|
@@ -106,7 +107,7 @@ export function TypeScalePanel() {
|
|
|
106
107
|
</div>
|
|
107
108
|
</div>
|
|
108
109
|
|
|
109
|
-
<
|
|
110
|
+
<Card className="p-6 shadow-none space-y-4">
|
|
110
111
|
{PREVIEW_ROWS.map((row) => (
|
|
111
112
|
<div
|
|
112
113
|
key={row.token}
|
|
@@ -128,7 +129,7 @@ export function TypeScalePanel() {
|
|
|
128
129
|
</div>
|
|
129
130
|
</div>
|
|
130
131
|
))}
|
|
131
|
-
</
|
|
132
|
+
</Card>
|
|
132
133
|
</section>
|
|
133
134
|
);
|
|
134
135
|
}
|
|
@@ -143,12 +143,13 @@ function ColorSwatch({
|
|
|
143
143
|
type="button"
|
|
144
144
|
onClick={() => {
|
|
145
145
|
resetToken(variable);
|
|
146
|
-
// Chart
|
|
147
|
-
//
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
// Chart vars are written inline by use-global-primary-color
|
|
147
|
+
// so clearing the override here doesn't put the live --chart-N
|
|
148
|
+
// back into a brand-derived state — call back into the hook
|
|
149
|
+
// to re-evaluate the ramp against the current --primary.
|
|
150
|
+
if (variable.startsWith("--chart-")) {
|
|
151
|
+
reapplyChartRamp();
|
|
152
|
+
}
|
|
152
153
|
}}
|
|
153
154
|
className="inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors"
|
|
154
155
|
>
|
|
@@ -157,6 +158,9 @@ function ColorSwatch({
|
|
|
157
158
|
</button>
|
|
158
159
|
)}
|
|
159
160
|
{showAdd && (
|
|
161
|
+
// allow-text-xs-cta — sub-flow Back link, paired with the
|
|
162
|
+
// text-xs labels around it in the color-add panel header.
|
|
163
|
+
// Reads as a breadcrumb/cancel, not a flow CTA.
|
|
160
164
|
<button
|
|
161
165
|
type="button"
|
|
162
166
|
onClick={resetAddState}
|
|
@@ -486,7 +490,7 @@ function BrandColorCard({
|
|
|
486
490
|
<div className="group relative">
|
|
487
491
|
{opt.grade !== "AAA" && (
|
|
488
492
|
<span
|
|
489
|
-
className="pointer-events-none absolute -top-2 -
|
|
493
|
+
className="pointer-events-none absolute -top-2 -right-2 z-10 inline-flex h-7 w-7 items-center justify-center rounded-full bg-amber-50 dark:bg-amber-950 border border-amber-300 dark:border-amber-700 shadow-sm"
|
|
490
494
|
title={`Below WCAG AAA — current ${opt.contrast}:1 (${opt.grade}), required 7:1`}
|
|
491
495
|
aria-label={`${opt.label} is below WCAG AAA contrast`}
|
|
492
496
|
>
|