@behavioral-agentic-design-system/core 0.8.0 → 0.8.3
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/package.json +3 -2
- package/scripts/build-tokens.cjs +83 -14
- package/src/app/preview/cards/page.tsx +1 -1
- package/src/app/preview/components/page.tsx +62 -4
- package/src/app/shell.tsx +92 -26
- package/src/components/Foundations/Motion.stories.tsx +98 -56
- package/src/components/brand-mark.tsx +7 -1
- package/src/components/customize/brand-mark-section.tsx +14 -5
- package/src/components/customize/letter-spacing.tsx +1 -1
- package/src/components/customize/save-bar.tsx +1 -1
- package/src/components/customize-tab.tsx +1 -1
- package/src/components/home-tab.tsx +48 -36
- package/src/components/layers-tab.tsx +26 -7
- package/src/components/ui/alert.tsx +26 -14
- package/src/components/ui/button.tsx +7 -7
- package/src/components/ui/scroll-area.tsx +13 -1
- package/src/components/ui/sheet.tsx +4 -2
- package/src/components/ui/sonner.tsx +36 -9
- package/src/lib/brand-mark-tone.ts +140 -0
- package/src/styles.css +276 -12
- package/src/tokens.json +30 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behavioral-agentic-design-system/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "BADS core — tokens, shadcn/ui components, and the BADS template shell (app routes, customize tab, theme hooks). Forks consume this and re-export, keeping client repos to ~30 lines of glue.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Matthew Stephens <work@matthewstephens.com> (https://github.com/matthewlarn)",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"./components/bads-update-banner": "./src/components/bads-update-banner.tsx",
|
|
60
60
|
"./components/brand-mark": "./src/components/brand-mark.tsx",
|
|
61
61
|
"./components/dev-identity-badge": "./src/components/dev-identity-badge.tsx",
|
|
62
|
+
"./components/onboarding-wizard": "./src/components/onboarding-wizard.tsx",
|
|
62
63
|
"./components/customize/*": "./src/components/customize/*.tsx",
|
|
63
64
|
"./components/Foundations/*": "./src/components/Foundations/*.tsx",
|
|
64
65
|
"./app/page": "./src/app/page.tsx",
|
|
@@ -122,7 +123,7 @@
|
|
|
122
123
|
"lucide-react": "*",
|
|
123
124
|
"next-themes": "*",
|
|
124
125
|
"react": ">=18",
|
|
125
|
-
"react-day-picker": "
|
|
126
|
+
"react-day-picker": "^9.14.0",
|
|
126
127
|
"react-dom": ">=18",
|
|
127
128
|
"react-resizable-panels": "*",
|
|
128
129
|
"recharts": "*",
|
package/scripts/build-tokens.cjs
CHANGED
|
@@ -159,7 +159,7 @@ const shadowBlock = ` --shadow-opacity: ${shadowOpacity};
|
|
|
159
159
|
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / ${shadowAlpha('md')}), 0 2px 4px -1px hsl(0 0% 0% / ${shadowAlpha('md')});
|
|
160
160
|
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / ${shadowAlpha('lg')}), 0 4px 6px -1px hsl(0 0% 0% / ${shadowAlpha('lg')});
|
|
161
161
|
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / ${shadowAlpha('xl')}), 0 8px 10px -1px hsl(0 0% 0% / ${shadowAlpha('xl')});
|
|
162
|
-
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / ${shadowAlpha('2xl')});`;
|
|
162
|
+
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / ${shadowAlpha('2xl')}), 0 16px 24px -1px hsl(0 0% 0% / ${shadowAlpha('2xl')});`;
|
|
163
163
|
|
|
164
164
|
// Animation tokens emitted into :root from tokens.json. Components reference
|
|
165
165
|
// var(--duration-*) and var(--ease-*) so Sir's edits in tokens.json (or any
|
|
@@ -380,17 +380,20 @@ const themeInline = `@theme inline {
|
|
|
380
380
|
}`;
|
|
381
381
|
|
|
382
382
|
const baseLayer = `@layer base {
|
|
383
|
-
/*
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
\`
|
|
393
|
-
|
|
383
|
+
/* Default border + outline color for every element. Wrapped in \`:where()\`
|
|
384
|
+
so the selector has ZERO specificity: it still overrides the browser
|
|
385
|
+
default (border-color: currentColor — preflight's \`border: 0 solid\` sets
|
|
386
|
+
width/style but never color), yet ANY border-color utility (\`border-primary\`,
|
|
387
|
+
\`border-destructive\`, \`border-red-500\`, ...) at (0,1,0) cleanly beats it.
|
|
388
|
+
|
|
389
|
+
History: this was \`:root *\` (0,1,0) to beat preflight regardless of import
|
|
390
|
+
order — but that specificity TIED every border-color utility and won by
|
|
391
|
+
source order, so EVERY \`border-<color>\` silently rendered as --border grey
|
|
392
|
+
(only \`!important\` or arbitrary-with-! escaped it). \`:where(:root *)\` keeps
|
|
393
|
+
the preflight win (currentColor is the initial value, not a real rule, so a
|
|
394
|
+
0-specificity declaration still overrides it) while letting utilities win.
|
|
395
|
+
See ledgers/research.jsonl 2026-06-04 for the full diagnosis. */
|
|
396
|
+
:where(:root *) {
|
|
394
397
|
@apply border-border outline-ring/50;
|
|
395
398
|
}
|
|
396
399
|
/* Bind html to --font-sans so the picker propagates everywhere — not just
|
|
@@ -567,6 +570,48 @@ html, body {
|
|
|
567
570
|
::view-transition-new(root) { animation: none; }
|
|
568
571
|
}`;
|
|
569
572
|
|
|
573
|
+
// ---- Border-color utilities (workaround for a Tailwind v4 generation gap) -
|
|
574
|
+
//
|
|
575
|
+
// In this v4 setup, PLAIN named border-color utilities (`border-primary`,
|
|
576
|
+
// `border-destructive`, `border-l-primary`, ...) silently don't get generated
|
|
577
|
+
// — the class lands on the element but no rule is emitted, so the color falls
|
|
578
|
+
// through to the `:where(:root *)` default and renders as --border grey. Only
|
|
579
|
+
// the opacity variants (`border-primary/30`) and arbitrary `border-[var(--x)]`
|
|
580
|
+
// generate. That made ~20 components render colored borders as grey (mostly
|
|
581
|
+
// hidden on filled controls, visible on outlined ones — checkbox/radio boxes,
|
|
582
|
+
// input error borders, selected-card borders, alerts).
|
|
583
|
+
//
|
|
584
|
+
// Rather than convert every call site to arbitrary values, we emit the plain
|
|
585
|
+
// utilities here, once, for the whole semantic palette — so every existing
|
|
586
|
+
// `border-<color>` across all components AND every downstream fork just works.
|
|
587
|
+
// Emitted in @layer utilities so they beat the base reset but still lose to a
|
|
588
|
+
// component's own higher-specificity state variants (e.g. hover:border-*).
|
|
589
|
+
// See ledgers/research.jsonl 2026-06-05 for the full diagnosis.
|
|
590
|
+
const BORDER_COLOR_NAMES = [
|
|
591
|
+
'background', 'foreground', 'card', 'card-foreground', 'popover',
|
|
592
|
+
'popover-foreground', 'primary', 'primary-foreground', 'link', 'secondary',
|
|
593
|
+
'secondary-foreground', 'muted', 'muted-foreground', 'accent',
|
|
594
|
+
'accent-foreground', 'destructive', 'destructive-foreground', 'success',
|
|
595
|
+
'warning', 'info', 'border', 'input', 'ring', 'chart-1', 'chart-2', 'chart-3',
|
|
596
|
+
'chart-4', 'chart-5', 'sidebar', 'sidebar-foreground', 'sidebar-primary',
|
|
597
|
+
'sidebar-primary-foreground', 'sidebar-accent', 'sidebar-accent-foreground',
|
|
598
|
+
'sidebar-border', 'sidebar-ring',
|
|
599
|
+
];
|
|
600
|
+
const borderColorUtilities = `@layer utilities {
|
|
601
|
+
${BORDER_COLOR_NAMES.map((c) => {
|
|
602
|
+
const v = `var(--${c})`;
|
|
603
|
+
return [
|
|
604
|
+
` .border-${c} { border-color: ${v}; }`,
|
|
605
|
+
` .border-x-${c} { border-inline-color: ${v}; }`,
|
|
606
|
+
` .border-y-${c} { border-block-color: ${v}; }`,
|
|
607
|
+
` .border-l-${c} { border-left-color: ${v}; }`,
|
|
608
|
+
` .border-r-${c} { border-right-color: ${v}; }`,
|
|
609
|
+
` .border-t-${c} { border-top-color: ${v}; }`,
|
|
610
|
+
` .border-b-${c} { border-bottom-color: ${v}; }`,
|
|
611
|
+
].join('\n');
|
|
612
|
+
}).join('\n')}
|
|
613
|
+
}`;
|
|
614
|
+
|
|
570
615
|
// ---- packages/core/src/styles.css (consumer-facing) ----------------------
|
|
571
616
|
|
|
572
617
|
const pkgCss = `${banner}
|
|
@@ -649,6 +694,8 @@ ${chartDerivationDark}
|
|
|
649
694
|
${themeInline}
|
|
650
695
|
|
|
651
696
|
${baseLayer}
|
|
697
|
+
|
|
698
|
+
${borderColorUtilities}
|
|
652
699
|
`;
|
|
653
700
|
|
|
654
701
|
fs.writeFileSync(PKG_CSS, pkgCss);
|
|
@@ -667,9 +714,25 @@ const appCss = `${banner}
|
|
|
667
714
|
* package read from the same canonical files. */
|
|
668
715
|
@import "../packages/core/src/fonts.css";
|
|
669
716
|
@import "../packages/core/src/brand-fonts.css";
|
|
670
|
-
@import "tailwindcss";
|
|
717
|
+
@import "tailwindcss" source(none);
|
|
671
718
|
@import "tw-animate-css";
|
|
672
719
|
|
|
720
|
+
/* Scope Tailwind's content scan to the preview app's actual UI source.
|
|
721
|
+
* source(none) disables Tailwind v4's automatic whole-project detection,
|
|
722
|
+
* which otherwise scans repo-root text/data dirs (ledgers/, content/, docs/,
|
|
723
|
+
* corrections/, prompts/, layer-*) and harvests code-like strings out of them.
|
|
724
|
+
* One such string — a literal arbitrary border value inside a
|
|
725
|
+
* ledgers/research.jsonl note — generated an invalid empty border-color: var()
|
|
726
|
+
* rule that crashed the CSS parser and 500'd every route. Listing the real
|
|
727
|
+
* source dirs explicitly is the same discipline packages/core/src/styles.css
|
|
728
|
+
* already uses (see its @source block) and keeps the scan deterministic. Paths
|
|
729
|
+
* resolve relative to this file (styles/globals.css). */
|
|
730
|
+
@source "../app/**/*.{ts,tsx}";
|
|
731
|
+
@source "../components/**/*.{ts,tsx}";
|
|
732
|
+
@source "../hooks/**/*.{ts,tsx}";
|
|
733
|
+
@source "../lib/**/*.{ts,tsx}";
|
|
734
|
+
@source "../packages/core/src/**/*.{ts,tsx}";
|
|
735
|
+
|
|
673
736
|
@custom-variant dark (&:is(.dark *));
|
|
674
737
|
|
|
675
738
|
:root {
|
|
@@ -709,9 +772,15 @@ ${themeInline}
|
|
|
709
772
|
|
|
710
773
|
${baseLayer}
|
|
711
774
|
|
|
775
|
+
${borderColorUtilities}
|
|
776
|
+
|
|
777
|
+
/* color-scheme only. The default border color comes from the :where(:root *)
|
|
778
|
+
* rule in the base layer above — do NOT set border-color here: an unlayered
|
|
779
|
+
* star-selector border-color beats every @layer utilities border-color utility
|
|
780
|
+
* (unlayered trumps layered regardless of specificity), which silently
|
|
781
|
+
* rendered all colored borders grey in the app. */
|
|
712
782
|
* {
|
|
713
783
|
color-scheme: light dark;
|
|
714
|
-
border-color: var(--color-border);
|
|
715
784
|
}
|
|
716
785
|
${clientExtras}`;
|
|
717
786
|
|
|
@@ -35,7 +35,9 @@ import {
|
|
|
35
35
|
BottomSheetTitle,
|
|
36
36
|
BottomSheetTrigger,
|
|
37
37
|
} from "@behavioral-agentic-design-system/core/components/ui/bottom-sheet";
|
|
38
|
-
import { Sparkles, Info } from "lucide-react";
|
|
38
|
+
import { Sparkles, Info, CircleAlert } from "lucide-react";
|
|
39
|
+
import { Toaster } from "@behavioral-agentic-design-system/core/components/ui/sonner";
|
|
40
|
+
import { toast } from "sonner";
|
|
39
41
|
|
|
40
42
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
41
43
|
// SSR-rendered output, it causes hydration mismatches.
|
|
@@ -57,7 +59,7 @@ function Section({ title, children }: { title: string; children: React.ReactNode
|
|
|
57
59
|
export default function ComponentsPreview() {
|
|
58
60
|
return (
|
|
59
61
|
<div className="min-h-screen bg-background">
|
|
60
|
-
<div className="mx-auto max-w-5xl space-y-10 p-8">
|
|
62
|
+
<div className="mx-auto max-w-5xl space-y-10 p-4 sm:p-6 lg:p-8">
|
|
61
63
|
<header className="space-y-2">
|
|
62
64
|
<div className="flex items-center gap-2">
|
|
63
65
|
<Sparkles className="size-5 text-primary" />
|
|
@@ -176,9 +178,14 @@ export default function ComponentsPreview() {
|
|
|
176
178
|
</CardContent>
|
|
177
179
|
</Card>
|
|
178
180
|
<Alert>
|
|
179
|
-
<Info className="size-
|
|
181
|
+
<Info className="size-5" />
|
|
180
182
|
<AlertTitle>Heads up</AlertTitle>
|
|
181
|
-
<AlertDescription>
|
|
183
|
+
<AlertDescription>You can update settings any time.</AlertDescription>
|
|
184
|
+
</Alert>
|
|
185
|
+
<Alert variant="destructive">
|
|
186
|
+
<CircleAlert className="size-5" />
|
|
187
|
+
<AlertTitle>Save failed</AlertTitle>
|
|
188
|
+
<AlertDescription>Couldn't reach the server. Try again.</AlertDescription>
|
|
182
189
|
</Alert>
|
|
183
190
|
</div>
|
|
184
191
|
</Section>
|
|
@@ -303,6 +310,57 @@ export default function ComponentsPreview() {
|
|
|
303
310
|
</BottomSheet>
|
|
304
311
|
</div>
|
|
305
312
|
</Section>
|
|
313
|
+
|
|
314
|
+
<Section title="Toast (Sonner)">
|
|
315
|
+
<p className="mb-4 text-sm text-muted-foreground">
|
|
316
|
+
Status variants color the icon + a left accent bar in the matching
|
|
317
|
+
status token (success / warning / info / error). The surface and
|
|
318
|
+
body text stay neutral so copy keeps AAA contrast.
|
|
319
|
+
</p>
|
|
320
|
+
<div className="flex flex-wrap gap-3">
|
|
321
|
+
<Button
|
|
322
|
+
variant="outline"
|
|
323
|
+
onClick={() =>
|
|
324
|
+
toast.success("Changes saved", {
|
|
325
|
+
description: "Your settings are up to date.",
|
|
326
|
+
})
|
|
327
|
+
}
|
|
328
|
+
>
|
|
329
|
+
Success
|
|
330
|
+
</Button>
|
|
331
|
+
<Button
|
|
332
|
+
variant="outline"
|
|
333
|
+
onClick={() =>
|
|
334
|
+
toast.warning("Storage almost full", {
|
|
335
|
+
description: "You're using 92% of your plan's storage.",
|
|
336
|
+
})
|
|
337
|
+
}
|
|
338
|
+
>
|
|
339
|
+
Warning
|
|
340
|
+
</Button>
|
|
341
|
+
<Button
|
|
342
|
+
variant="outline"
|
|
343
|
+
onClick={() =>
|
|
344
|
+
toast.info("New version available", {
|
|
345
|
+
description: "Reload to get the latest components.",
|
|
346
|
+
})
|
|
347
|
+
}
|
|
348
|
+
>
|
|
349
|
+
Info
|
|
350
|
+
</Button>
|
|
351
|
+
<Button
|
|
352
|
+
variant="outline"
|
|
353
|
+
onClick={() =>
|
|
354
|
+
toast.error("Upload failed", {
|
|
355
|
+
description: "The file exceeds the 25MB limit.",
|
|
356
|
+
})
|
|
357
|
+
}
|
|
358
|
+
>
|
|
359
|
+
Error
|
|
360
|
+
</Button>
|
|
361
|
+
</div>
|
|
362
|
+
<Toaster />
|
|
363
|
+
</Section>
|
|
306
364
|
</div>
|
|
307
365
|
</div>
|
|
308
366
|
);
|
package/src/app/shell.tsx
CHANGED
|
@@ -34,6 +34,15 @@ import { OnboardingWizard } from "@behavioral-agentic-design-system/core/compone
|
|
|
34
34
|
|
|
35
35
|
const ONBOARDING_DISMISSED_KEY = "bads:onboarding-wizard:dismissed";
|
|
36
36
|
|
|
37
|
+
// Survives a full-page reload so the user lands back on the tab they were on.
|
|
38
|
+
// Several Customize-tab actions call window.location.reload() to re-read
|
|
39
|
+
// defaults cleanly (Reset all, brand-color applies, pin-to-brand.config) — and
|
|
40
|
+
// activeTab is plain React state, so without this every reload snaps back to
|
|
41
|
+
// the default tab. sessionStorage (not localStorage) keeps it session-scoped
|
|
42
|
+
// and outside the Customize tab's localStorage prefix-sweep, so Reset all can't
|
|
43
|
+
// wipe it before the reload it just triggered.
|
|
44
|
+
const ACTIVE_TAB_KEY = "bads:shell:active-tab";
|
|
45
|
+
|
|
37
46
|
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.`;
|
|
38
47
|
|
|
39
48
|
/**
|
|
@@ -203,7 +212,11 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
203
212
|
} catch {}
|
|
204
213
|
setOnboardingDismissed(true);
|
|
205
214
|
};
|
|
206
|
-
|
|
215
|
+
// Temporarily hidden everywhere per Sir (2026-06-04): the wizard was popping
|
|
216
|
+
// on the deployed showcase. Flip ONBOARDING_WIZARD_ENABLED back to true to
|
|
217
|
+
// restore the fresh-fork setup wizard.
|
|
218
|
+
const ONBOARDING_WIZARD_ENABLED = false;
|
|
219
|
+
const showOnboarding = ONBOARDING_WIZARD_ENABLED && isFreshFork && !onboardingDismissed;
|
|
207
220
|
// Sticky-mount: once a tab has been viewed, keep it mounted forever so the
|
|
208
221
|
// iframe (or React tree) doesn't cold-load on every switch. TabsPanels
|
|
209
222
|
// cross-fades between mounted siblings, so subsequent switches are instant
|
|
@@ -213,6 +226,34 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
213
226
|
setSeen((prev) => (prev.has(activeTab) ? prev : new Set(prev).add(activeTab)));
|
|
214
227
|
}, [activeTab]);
|
|
215
228
|
|
|
229
|
+
// Tab changes flow through this so the choice is persisted for reload
|
|
230
|
+
// restoration. The restore effect below reads it back on mount. Persisting
|
|
231
|
+
// only on real changes (not on mount) means there's no race with the restore
|
|
232
|
+
// read — sessionStorage is never clobbered with the default before it's read.
|
|
233
|
+
const selectTab = useCallback((value: string) => {
|
|
234
|
+
setActiveTab(value);
|
|
235
|
+
try {
|
|
236
|
+
window.sessionStorage.setItem(ACTIVE_TAB_KEY, value);
|
|
237
|
+
} catch {}
|
|
238
|
+
}, []);
|
|
239
|
+
|
|
240
|
+
// Restore the pre-reload tab once on mount. Only restores a tab that still
|
|
241
|
+
// exists in this shell's tab set, so a fork that drops a tab between sessions
|
|
242
|
+
// falls back to the default instead of a blank panel.
|
|
243
|
+
useEffect(() => {
|
|
244
|
+
let stored: string | null = null;
|
|
245
|
+
try {
|
|
246
|
+
stored = window.sessionStorage.getItem(ACTIVE_TAB_KEY);
|
|
247
|
+
} catch {}
|
|
248
|
+
const target = stored;
|
|
249
|
+
if (target && target !== initialTab && tabs.some((t) => t.value === target)) {
|
|
250
|
+
setActiveTab(target);
|
|
251
|
+
setSeen((prev) => (prev.has(target) ? prev : new Set(prev).add(target)));
|
|
252
|
+
}
|
|
253
|
+
// Mount-only: restore the persisted tab a single time.
|
|
254
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
255
|
+
}, []);
|
|
256
|
+
|
|
216
257
|
// Background preload: after the active tab has fully painted and idled,
|
|
217
258
|
// mount every other tab so they load silently while the user is reading
|
|
218
259
|
// the home tab. By the time someone clicks any other tab, its iframe is
|
|
@@ -289,37 +330,62 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
289
330
|
});
|
|
290
331
|
};
|
|
291
332
|
|
|
292
|
-
const ctx: ShellTabContext = { dark, goToTab:
|
|
293
|
-
const navValue = useMemo<ShellNav>(() => ({ setTab:
|
|
333
|
+
const ctx: ShellTabContext = { dark, goToTab: selectTab };
|
|
334
|
+
const navValue = useMemo<ShellNav>(() => ({ setTab: selectTab }), [selectTab]);
|
|
335
|
+
|
|
336
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
337
|
+
|
|
338
|
+
// Storybook header link. In dev it points at the local Storybook server
|
|
339
|
+
// (localhost:6080, started by `pnpm dev` / `pnpm storybook`). In production
|
|
340
|
+
// the static Storybook is built into public/storybook/<commit-sha> by the
|
|
341
|
+
// `vercel-build` script and served same-origin at /storybook/<sha>. The SHA
|
|
342
|
+
// in the path is a cache-bust: every deploy gets a brand-new URL the browser
|
|
343
|
+
// has never fetched, so the whole Storybook bundle (manager + iframe shell +
|
|
344
|
+
// story index) loads fresh instead of serving a stale cached copy. The SHA
|
|
345
|
+
// is inlined here via NEXT_PUBLIC_STORYBOOK_VERSION (set to the same value by
|
|
346
|
+
// vercel-build); "dev" is the fallback for a non-Vercel prod build. Override
|
|
347
|
+
// per-fork with NEXT_PUBLIC_STORYBOOK_URL (a standalone deploy or Chromatic
|
|
348
|
+
// permalink); set it to "" to hide the link on a fork without Storybook.
|
|
349
|
+
const storybookUrl =
|
|
350
|
+
process.env.NEXT_PUBLIC_STORYBOOK_URL ??
|
|
351
|
+
(isDev
|
|
352
|
+
? "http://localhost:6080"
|
|
353
|
+
: `/storybook/${process.env.NEXT_PUBLIC_STORYBOOK_VERSION || "dev"}/index.html`);
|
|
354
|
+
|
|
355
|
+
// The GitHub link points at brand.repo, which 404s for anonymous visitors
|
|
356
|
+
// when the repo is private — so it stays dev-only. A fork with a public repo
|
|
357
|
+
// can drop `isDev &&` from its condition below.
|
|
294
358
|
|
|
295
359
|
return (
|
|
296
360
|
<ShellNavContext.Provider value={navValue}>
|
|
297
361
|
<div className="min-h-screen bg-background flex flex-col">
|
|
298
362
|
<header className="border-b bg-card shrink-0">
|
|
299
|
-
<div className="flex h-14 items-center px-6">
|
|
300
|
-
<div className="flex items-center gap-2">
|
|
363
|
+
<div className="flex h-14 items-center px-4 sm:px-6">
|
|
364
|
+
<div className="flex items-center gap-2 min-w-0">
|
|
301
365
|
<div
|
|
302
|
-
className="h-8 w-8 rounded-lg flex items-center justify-center bg-primary text-primary-foreground"
|
|
366
|
+
className="h-8 w-8 rounded-lg flex items-center justify-center bg-primary text-primary-foreground shrink-0"
|
|
303
367
|
>
|
|
304
368
|
<BrandMark size={20} />
|
|
305
369
|
</div>
|
|
306
|
-
<span className="text-lg font-semibold">{brand.name}</span>
|
|
307
|
-
<Badge variant="outline" className="ml-2 text-xs">{brand.tagline}</Badge>
|
|
370
|
+
<span className="text-lg font-semibold truncate">{brand.name}</span>
|
|
371
|
+
<Badge variant="outline" className="ml-2 text-xs hidden sm:inline-flex">{brand.tagline}</Badge>
|
|
308
372
|
</div>
|
|
309
|
-
<div className="ml-auto flex items-center gap-2">
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
<
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
373
|
+
<div className="ml-auto flex items-center gap-1.5 sm:gap-2 shrink-0">
|
|
374
|
+
{storybookUrl && (
|
|
375
|
+
<Button
|
|
376
|
+
asChild
|
|
377
|
+
variant="ghost"
|
|
378
|
+
size="sm"
|
|
379
|
+
className="group h-8 gap-1.5 border border-foreground/30 hover:!bg-foreground hover:!text-background hover:border-foreground"
|
|
380
|
+
title="Open Storybook"
|
|
381
|
+
>
|
|
382
|
+
<a href={storybookUrl} target="_blank" rel="noreferrer" aria-label="Open Storybook in a new tab">
|
|
383
|
+
<BookOpen className="h-4 w-4 transition-all group-hover:scale-110" strokeWidth={1.5} />
|
|
384
|
+
<span className="text-xs font-medium hidden sm:inline">Storybook</span>
|
|
385
|
+
</a>
|
|
386
|
+
</Button>
|
|
387
|
+
)}
|
|
388
|
+
{isDev && brand.repo && (
|
|
323
389
|
<Button
|
|
324
390
|
asChild
|
|
325
391
|
variant="ghost"
|
|
@@ -329,7 +395,7 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
329
395
|
>
|
|
330
396
|
<a href={brand.repo} target="_blank" rel="noreferrer" aria-label="Open GitHub repo in a new tab">
|
|
331
397
|
<GithubMark className="h-4 w-4 transition-all group-hover:scale-110" />
|
|
332
|
-
<span className="text-xs font-medium">GitHub</span>
|
|
398
|
+
<span className="text-xs font-medium hidden sm:inline">GitHub</span>
|
|
333
399
|
</a>
|
|
334
400
|
</Button>
|
|
335
401
|
)}
|
|
@@ -352,14 +418,14 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
352
418
|
|
|
353
419
|
<Tabs
|
|
354
420
|
value={activeTab}
|
|
355
|
-
onValueChange={
|
|
421
|
+
onValueChange={selectTab}
|
|
356
422
|
// Slower cross-fade between mounted panels — 260ms feels deliberate
|
|
357
423
|
// without dragging. Read by the duration utility on TabsPanels.
|
|
358
424
|
style={{ "--tabs-fade-duration": "260ms" } as React.CSSProperties}
|
|
359
425
|
className="flex-1 flex flex-col overflow-hidden"
|
|
360
426
|
>
|
|
361
|
-
<div className="mt-2 mb-1 flex w-full items-center px-4">
|
|
362
|
-
<TabsList className="bg-background text-muted-foreground inline-flex w-
|
|
427
|
+
<div className="mt-2 mb-1 flex w-full items-center px-4 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
|
|
428
|
+
<TabsList className="bg-background text-muted-foreground inline-flex w-max shrink-0 items-center justify-center rounded-full px-0">
|
|
363
429
|
{tabs.map((tab) => (
|
|
364
430
|
<TabsTrigger
|
|
365
431
|
key={tab.value}
|