@designa8/vibedesign-v6 1.20.19 → 2.1.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.
Files changed (123) hide show
  1. package/README.md +1 -1
  2. package/dist/fonts/plusjakartasans/PlusJakartaSans-Italic[wght].ttf +0 -0
  3. package/dist/fonts/plusjakartasans/PlusJakartaSans[wght].ttf +0 -0
  4. package/dist/index.cjs +12027 -4942
  5. package/dist/index.js +12089 -5004
  6. package/dist/styles.css +1393 -97
  7. package/package.json +116 -1
  8. package/src/atoms/AgentQuestionCard/AgentQuestionCard.tsx +567 -0
  9. package/src/atoms/AgentQuestionCard/index.ts +6 -0
  10. package/src/atoms/AgentQuestionCard/preview.tsx +199 -0
  11. package/src/atoms/AppLayout/AppLayout.tsx +85 -22
  12. package/src/atoms/AppLayout/preview.tsx +4 -0
  13. package/src/atoms/AppSidebar/AppSidebar.tsx +222 -137
  14. package/src/atoms/AppSidebar/preview.tsx +61 -8
  15. package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +241 -169
  16. package/src/atoms/AppSidebarMobile/preview.tsx +59 -89
  17. package/src/atoms/AuthLogin/AuthLogin.tsx +86 -49
  18. package/src/atoms/AuthLogin/preview.tsx +16 -0
  19. package/src/atoms/AuthSignUp/AuthSignUp.tsx +206 -126
  20. package/src/atoms/AuthSignUp/preview.tsx +10 -0
  21. package/src/atoms/BillingToggle/BillingToggle.tsx +2 -2
  22. package/src/atoms/BottomSheet/BottomSheet.tsx +199 -0
  23. package/src/atoms/BottomSheet/index.ts +2 -0
  24. package/src/atoms/BottomSheet/preview.tsx +50 -0
  25. package/src/atoms/Button/Button.tsx +19 -3
  26. package/src/atoms/Button/preview.tsx +2 -1
  27. package/src/atoms/ChatHistorySidebar/ChatHistorySidebar.tsx +160 -84
  28. package/src/atoms/ChatHistorySidebar/preview.tsx +81 -42
  29. package/src/atoms/ChatScreen/ChatScreen.tsx +298 -33
  30. package/src/atoms/ChatScreen/preview.tsx +54 -90
  31. package/src/atoms/Chip/Chip.tsx +81 -33
  32. package/src/atoms/Chip/preview.tsx +39 -21
  33. package/src/atoms/CodeEditor/CodeEditor.tsx +10 -4
  34. package/src/atoms/ComponentActionsSheet/ComponentActionsSheet.tsx +165 -0
  35. package/src/atoms/ComponentActionsSheet/index.ts +7 -0
  36. package/src/atoms/ComponentActionsSheet/preview.tsx +67 -0
  37. package/src/atoms/ComponentCard/ComponentCard.tsx +17 -35
  38. package/src/atoms/ComponentCard/preview.tsx +9 -9
  39. package/src/atoms/DesignSystemLoader/DesignSystemLoader.tsx +153 -0
  40. package/src/atoms/DesignSystemLoader/index.ts +2 -0
  41. package/src/atoms/DesignSystemLoader/preview.tsx +19 -0
  42. package/src/atoms/DesignSystemShowcase/DesignSystemShowcase.tsx +410 -0
  43. package/src/atoms/DesignSystemShowcase/index.ts +6 -0
  44. package/src/atoms/DesignSystemShowcase/preview.tsx +22 -0
  45. package/src/atoms/DesignTokensPanel/DesignTokensPanel.data.ts +254 -0
  46. package/src/atoms/DesignTokensPanel/DesignTokensPanel.tsx +946 -0
  47. package/src/atoms/DesignTokensPanel/index.ts +9 -0
  48. package/src/atoms/DesignTokensPanel/preview.tsx +39 -0
  49. package/src/atoms/ExpandableMessage/ExpandableMessage.tsx +239 -0
  50. package/src/atoms/ExpandableMessage/fix-link-note.txt +3 -0
  51. package/src/atoms/ExpandableMessage/index.ts +2 -0
  52. package/src/atoms/ExpandableMessage/markdown.tsx +310 -0
  53. package/src/atoms/ExpandableMessage/preview.tsx +83 -0
  54. package/src/atoms/FilterTabBar/FilterTabBar.tsx +2 -2
  55. package/src/atoms/FontCombobox/FontCombobox.tsx +655 -0
  56. package/src/atoms/FontCombobox/index.ts +6 -0
  57. package/src/atoms/FontCombobox/preview.tsx +111 -0
  58. package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +894 -96
  59. package/src/atoms/HomePageTemplate/preview.tsx +4 -0
  60. package/src/atoms/Icon/Icon.tsx +17 -11
  61. package/src/atoms/Icon/icons.data.ts +34 -0
  62. package/src/atoms/Input/Input.tsx +37 -21
  63. package/src/atoms/LandingHero/LandingHero.tsx +545 -0
  64. package/src/atoms/LandingHero/index.ts +6 -0
  65. package/src/atoms/LandingHero/preview.tsx +88 -0
  66. package/src/atoms/MarketingFooter/MarketingFooter.tsx +215 -0
  67. package/src/atoms/MarketingFooter/index.ts +7 -0
  68. package/src/atoms/MarketingFooter/preview.tsx +28 -0
  69. package/src/atoms/MarketingNavbar/MarketingNavbar.tsx +451 -0
  70. package/src/atoms/MarketingNavbar/index.ts +7 -0
  71. package/src/atoms/MarketingNavbar/preview.tsx +109 -0
  72. package/src/atoms/MobileActionsDrawer/MobileActionsDrawer.tsx +548 -0
  73. package/src/atoms/MobileActionsDrawer/index.ts +9 -0
  74. package/src/atoms/MobileActionsDrawer/preview.tsx +109 -0
  75. package/src/atoms/Modal/Modal.tsx +77 -28
  76. package/src/atoms/PreviewDock/PreviewDock.tsx +119 -0
  77. package/src/atoms/PreviewDock/index.ts +2 -0
  78. package/src/atoms/PreviewDock/preview.tsx +30 -0
  79. package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +47 -30
  80. package/src/atoms/PricingCard/PricingCard.tsx +15 -4
  81. package/src/atoms/PricingPageTemplate/PricingPageTemplate.tsx +109 -89
  82. package/src/atoms/ProjectSettingsModal/ProjectSettingsModal.tsx +314 -0
  83. package/src/atoms/ProjectSettingsModal/index.ts +2 -0
  84. package/src/atoms/ProjectSettingsModal/preview.tsx +130 -0
  85. package/src/atoms/ProjectSettingsModal/switch.snippet.txt +8 -0
  86. package/src/atoms/PromptInputBar/PromptInputBar.tsx +750 -302
  87. package/src/atoms/PromptInputBar/preview.tsx +64 -64
  88. package/src/atoms/SettingsPageTemplate/SettingsPageTemplate.tsx +272 -0
  89. package/src/atoms/SettingsPageTemplate/index.ts +2 -0
  90. package/src/atoms/SettingsPageTemplate/preview.tsx +29 -0
  91. package/src/atoms/SidebarUpgradeBanner/SidebarUpgradeBanner.tsx +178 -0
  92. package/src/atoms/SidebarUpgradeBanner/index.ts +2 -0
  93. package/src/atoms/SidebarUpgradeBanner/preview.tsx +47 -0
  94. package/src/atoms/SkeletonChip/SkeletonChip.tsx +198 -0
  95. package/src/atoms/SkeletonChip/index.ts +2 -0
  96. package/src/atoms/SkeletonChip/preview.tsx +44 -0
  97. package/src/atoms/TemplateHeader/TemplateHeader.tsx +129 -0
  98. package/src/atoms/TemplateHeader/index.ts +2 -0
  99. package/src/atoms/TemplateHeader/preview.tsx +39 -0
  100. package/src/atoms/TemplateHero/TemplateHero.tsx +286 -0
  101. package/src/atoms/TemplateHero/index.ts +2 -0
  102. package/src/atoms/TemplateHero/preview.tsx +32 -0
  103. package/src/atoms/TemplateSummary/TemplateSummary.tsx +85 -0
  104. package/src/atoms/TemplateSummary/index.ts +2 -0
  105. package/src/atoms/TemplateSummary/preview.tsx +10 -0
  106. package/src/atoms/Toast/Toast.tsx +178 -0
  107. package/src/atoms/Toast/index.ts +2 -0
  108. package/src/atoms/Toast/preview.tsx +100 -0
  109. package/src/atoms/TopNavbar/TopNavbar.tsx +145 -67
  110. package/src/atoms/TopNavbar/preview.tsx +13 -7
  111. package/src/atoms/TopupModal/TopupModal.tsx +94 -0
  112. package/src/atoms/TopupModal/index.ts +2 -0
  113. package/src/atoms/TopupModal/preview.tsx +22 -0
  114. package/src/atoms/UpgradeCard/UpgradeCard.tsx +124 -43
  115. package/src/atoms/UpgradeCard/index.ts +1 -1
  116. package/src/atoms/UpgradeCard/preview.tsx +7 -14
  117. package/src/atoms/UpgradeModal/UpgradeModal.tsx +192 -0
  118. package/src/atoms/UpgradeModal/index.ts +2 -0
  119. package/src/atoms/UpgradeModal/preview.tsx +41 -0
  120. package/src/index.ts +23 -0
  121. package/src/tokens.css +45 -7
  122. package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
  123. package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { ComponentCard } from "./ComponentCard";
3
+ import { Icon } from "../Icon";
3
4
 
4
5
  /* A minimal mock thumbnail that resembles an auth screen preview */
5
6
  function AuthThumbnail() {
@@ -7,12 +8,8 @@ function AuthThumbnail() {
7
8
  <div className="w-full h-full flex flex-col items-center justify-center gap-sm p-lg bg-surface-soft">
8
9
  {/* Simulated card inside thumbnail */}
9
10
  <div className="w-4/5 bg-canvas rounded-xl shadow-card flex flex-col items-center py-lg px-md gap-sm">
10
- <div className="w-12 h-14 rounded-xl bg-primary flex items-center justify-center">
11
- <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="white" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round">
12
- <path d="M12 2L2 7l10 5 10-5-10-5z" />
13
- <path d="M2 17l10 5 10-5" />
14
- <path d="M2 12l10 5 10-5" />
15
- </svg>
11
+ <div className="w-12 h-14 rounded-xl bg-primary text-on-primary flex items-center justify-center">
12
+ <Icon name="layers" size={22} />
16
13
  </div>
17
14
  <div className="w-3/4 h-2 rounded-xs bg-ink opacity-20" />
18
15
  <div className="w-1/2 h-2 rounded-xs bg-muted opacity-30" />
@@ -55,7 +52,7 @@ function DashboardThumbnail() {
55
52
  <div className="w-full h-full flex bg-surface-soft overflow-hidden">
56
53
  {/* Sidebar */}
57
54
  <div className="w-1/4 bg-surface-strong h-full flex flex-col gap-xs p-sm">
58
- {[1,2,3,4].map(i => (
55
+ {[1, 2, 3, 4].map((i) => (
59
56
  <div key={i} className="h-2 rounded-xs bg-muted opacity-30" />
60
57
  ))}
61
58
  </div>
@@ -63,8 +60,11 @@ function DashboardThumbnail() {
63
60
  <div className="flex-1 p-sm flex flex-col gap-xs">
64
61
  <div className="h-3 w-3/4 rounded-xs bg-ink opacity-20 mb-xs" />
65
62
  <div className="flex gap-xs flex-1">
66
- {[1,2,3].map(i => (
67
- <div key={i} className="flex-1 rounded-md bg-canvas shadow-sm border border-hairline-soft" />
63
+ {[1, 2, 3].map((i) => (
64
+ <div
65
+ key={i}
66
+ className="flex-1 rounded-md bg-canvas shadow-sm border border-hairline-soft"
67
+ />
68
68
  ))}
69
69
  </div>
70
70
  </div>
@@ -0,0 +1,153 @@
1
+ import React from "react";
2
+ import { Icon } from "../Icon";
3
+
4
+ export interface DesignSystemLoaderProps
5
+ extends React.HTMLAttributes<HTMLDivElement> {
6
+ /** Main loading headline */
7
+ label?: string;
8
+ /** Secondary, muted description under the headline */
9
+ sublabel?: string;
10
+ }
11
+
12
+ const GRID_SIZE = 9;
13
+
14
+ // Sparkles scattered behind the grid — quantity + position loosely mirror
15
+ // the reference's twinkling backdrop.
16
+ const SPARKLES: Array<{ top: string; left: string; size: number; delay: string }> = [
17
+ { top: "4%", left: "12%", size: 10, delay: "0ms" },
18
+ { top: "10%", left: "78%", size: 8, delay: "150ms" },
19
+ { top: "22%", left: "34%", size: 7, delay: "300ms" },
20
+ { top: "6%", left: "52%", size: 9, delay: "75ms" },
21
+ { top: "70%", left: "8%", size: 8, delay: "225ms" },
22
+ { top: "82%", left: "70%", size: 10, delay: "375ms" },
23
+ { top: "36%", left: "90%", size: 7, delay: "125ms" },
24
+ ];
25
+
26
+ const KEYFRAMES = `
27
+ @keyframes dsl-twinkle {
28
+ 0%, 100% { opacity: 0.15; transform: scale(0.85); }
29
+ 50% { opacity: 0.7; transform: scale(1.1); }
30
+ }
31
+ /*
32
+ Every cell in the grid runs THIS SAME timeline, cycling through the full
33
+ color spectrum (solid primary crest -> soft tints -> empty dashed trough
34
+ -> back to crest). Each cell only differs by its animation-delay, which is
35
+ set from its diagonal position, so at any instant you see every stage of
36
+ this timeline laid out across the grid at once — that band of matching
37
+ stages IS the wave, and it visibly travels across the grid as delays
38
+ shift which stage each cell is currently showing. Percentages are front-
39
+ loaded so the crest starts breaking almost immediately instead of holding
40
+ still for the first stretch of the cycle.
41
+ */
42
+ @keyframes dsl-cell-spectrum {
43
+ 0% { background-color: var(--color-primary); border-color: transparent; opacity: 1; }
44
+ 8% { background-color: var(--color-primary); border-color: transparent; opacity: 0.8; }
45
+ 18% { background-color: var(--color-primary-soft); border-color: transparent; opacity: 1; }
46
+ 30% { background-color: var(--color-primary-soft); border-color: transparent; opacity: 0.55; }
47
+ 45% { background-color: var(--color-surface-soft); border-color: var(--color-hairline); opacity: 1; }
48
+ 62% { background-color: transparent; border-color: var(--color-hairline-strong); border-style: dashed; opacity: 1; }
49
+ 82% { background-color: transparent; border-color: var(--color-hairline-strong); border-style: dashed; opacity: 1; }
50
+ 100% { background-color: var(--color-primary); border-color: transparent; border-style: solid; opacity: 1; }
51
+ }
52
+ `;
53
+
54
+ export const DesignSystemLoader = React.forwardRef<
55
+ HTMLDivElement,
56
+ DesignSystemLoaderProps
57
+ >(
58
+ (
59
+ {
60
+ label = "Loading design system…",
61
+ sublabel = "Building your component library",
62
+ className,
63
+ ...rest
64
+ },
65
+ ref,
66
+ ) => {
67
+ return (
68
+ <div
69
+ ref={ref}
70
+ role="status"
71
+ aria-live="polite"
72
+ className={[
73
+ "w-full max-w-3xl mx-auto flex flex-col items-center justify-center gap-xl bg-canvas px-lg py-xxl",
74
+ className,
75
+ ]
76
+ .filter(Boolean)
77
+ .join(" ")}
78
+ {...rest}
79
+ >
80
+ <style>{KEYFRAMES}</style>
81
+
82
+ {/* Sparkle backdrop + progress grid */}
83
+ <div className="relative w-full max-w-sm">
84
+ {SPARKLES.map((s, i) => (
85
+ <Icon
86
+ key={i}
87
+ name="sparkle"
88
+ size={s.size}
89
+ className="absolute text-primary-soft"
90
+ style={{
91
+ top: s.top,
92
+ left: s.left,
93
+ animationName: "dsl-twinkle",
94
+ animationDuration: "1.6s",
95
+ animationTimingFunction: "ease-in-out",
96
+ animationIterationCount: "infinite",
97
+ animationDelay: s.delay,
98
+ }}
99
+ />
100
+ ))}
101
+
102
+ {/*
103
+ Wave direction: top-right -> bottom-left, sweeping through the
104
+ middle slant. Delay is driven by distance from the top-right
105
+ corner (row + distance-from-right-edge), so the purple crest
106
+ starts top-right, crosses the diagonal, and recedes toward
107
+ bottom-left like a tide, looping forever. Delay step and cycle
108
+ duration are both kept short so the wave is already moving on
109
+ first paint instead of sitting still.
110
+
111
+ The 9-column template and per-cell animation are both applied via
112
+ inline style rather than Tailwind's `grid-cols-9` / arbitrary
113
+ `animate-[...]` classes so the layout and motion render correctly
114
+ even when a consumer's Tailwind JIT build hasn't pre-generated
115
+ those utilities.
116
+ */}
117
+ <div
118
+ className="relative grid gap-xxs"
119
+ style={{ gridTemplateColumns: "repeat(9, minmax(0, 1fr))" }}
120
+ >
121
+ {Array.from({ length: GRID_SIZE * GRID_SIZE }, (_, i) => {
122
+ const row = Math.floor(i / GRID_SIZE);
123
+ const col = i % GRID_SIZE;
124
+ const diag = row + (GRID_SIZE - 1 - col);
125
+ return (
126
+ <span
127
+ key={i}
128
+ className="aspect-square rounded-xs border-2"
129
+ style={{
130
+ animationName: "dsl-cell-spectrum",
131
+ animationDuration: "2.4s",
132
+ animationTimingFunction: "ease-in-out",
133
+ animationIterationCount: "infinite",
134
+ animationFillMode: "both",
135
+ animationDelay: `${diag * 35}ms`,
136
+ }}
137
+ />
138
+ );
139
+ })}
140
+ </div>
141
+ </div>
142
+
143
+ {/* Headline */}
144
+ <div className="flex flex-col items-center gap-xs text-center max-w-sm">
145
+ <span className="text-heading-sm text-ink">{label}</span>
146
+ <span className="text-body-sm text-muted">{sublabel}</span>
147
+ </div>
148
+ </div>
149
+ );
150
+ },
151
+ );
152
+
153
+ DesignSystemLoader.displayName = "DesignSystemLoader";
@@ -0,0 +1,2 @@
1
+ export { DesignSystemLoader } from "./DesignSystemLoader";
2
+ export type { DesignSystemLoaderProps } from "./DesignSystemLoader";
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { DesignSystemLoader } from "./DesignSystemLoader";
3
+
4
+ export default function DesignSystemLoaderPreview() {
5
+ return (
6
+ <div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
7
+ <div className="rounded-lg border border-hairline overflow-hidden h-[560px] bg-canvas flex items-center justify-center">
8
+ <DesignSystemLoader />
9
+ </div>
10
+
11
+ <div className="rounded-lg border border-hairline overflow-hidden h-[560px] bg-canvas flex items-center justify-center">
12
+ <DesignSystemLoader
13
+ label="Publishing your changes…"
14
+ sublabel="Syncing tokens across your library"
15
+ />
16
+ </div>
17
+ </div>
18
+ );
19
+ }
@@ -0,0 +1,410 @@
1
+ import React from "react";
2
+ import { Button } from "../Button";
3
+ import { Input } from "../Input";
4
+ import { Chip } from "../Chip";
5
+ import { Checkbox } from "../Checkbox";
6
+ import { Icon } from "../Icon";
7
+
8
+ export interface ShowcaseThumbnail {
9
+ id: string;
10
+ src: string;
11
+ alt?: string;
12
+ }
13
+
14
+ export interface ShowcaseSwatch {
15
+ /** Text shown in the callout. */
16
+ label: string;
17
+ /** CSS color value, e.g. `var(--color-demo-warm-accent)`. */
18
+ color: string;
19
+ position: "left" | "right-top" | "right-mid";
20
+ }
21
+
22
+ export interface DesignSystemShowcaseProps
23
+ extends React.HTMLAttributes<HTMLDivElement> {
24
+ promptText?: string;
25
+ swatches?: ShowcaseSwatch[];
26
+ fontLabel?: string;
27
+ radiusLabel?: string;
28
+ spaceLabel?: string;
29
+ statLabel?: string;
30
+ statValue?: string;
31
+ statDelta?: string;
32
+ thumbnails?: ShowcaseThumbnail[];
33
+ activeThumbnailId?: string;
34
+ onThumbnailClick?: (id: string) => void;
35
+ darkModeLabel?: string;
36
+ darkModeCaption?: string;
37
+ }
38
+
39
+ const TABS = ["Overview", "Tokens", "Code"] as const;
40
+
41
+ interface ToggleProps {
42
+ on: boolean;
43
+ onChange?: (next: boolean) => void;
44
+ label?: string;
45
+ }
46
+
47
+ /** Interactive switch when `onChange` is set, otherwise a static decorative one. */
48
+ const Toggle: React.FC<ToggleProps> = ({ on, onChange, label = "Toggle" }) => {
49
+ const track = `relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors duration-200 ease-out ${
50
+ on ? "bg-primary" : "bg-surface-strong"
51
+ }`;
52
+ const thumb = `absolute left-xxs h-5 w-5 rounded-full bg-canvas shadow-sm transition-transform duration-200 ease-out ${
53
+ on ? "translate-x-5" : "translate-x-0"
54
+ }`;
55
+ if (!onChange) {
56
+ return (
57
+ <span aria-hidden="true" className={track}>
58
+ <span className={thumb} />
59
+ </span>
60
+ );
61
+ }
62
+ return (
63
+ <button
64
+ type="button"
65
+ role="switch"
66
+ aria-checked={on}
67
+ aria-label={label}
68
+ onClick={() => onChange(!on)}
69
+ className={`${track} cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue`}
70
+ >
71
+ <span className={thumb} />
72
+ </button>
73
+ );
74
+ };
75
+
76
+ const AVATARS: { initials: string; tone: string }[] = [
77
+ { initials: "JD", tone: "bg-demo-warm-accent text-on-primary" },
78
+ { initials: "MK", tone: "bg-workspace-avatar text-on-primary" },
79
+ { initials: "AL", tone: "bg-surface-strong text-ink" },
80
+ ];
81
+
82
+ const Avatars: React.FC = () => (
83
+ <div className="flex items-center -space-x-sm" role="img" aria-label="Three members and 3 more">
84
+ {AVATARS.map((a) => (
85
+ <span
86
+ key={a.initials}
87
+ aria-hidden="true"
88
+ className={`flex h-7 w-7 items-center justify-center rounded-full border-2 border-canvas text-caption ${a.tone}`}
89
+ >
90
+ {a.initials}
91
+ </span>
92
+ ))}
93
+ <span
94
+ aria-hidden="true"
95
+ className="flex h-7 w-7 items-center justify-center rounded-full border-2 border-canvas bg-surface-soft text-caption text-muted"
96
+ >
97
+ +3
98
+ </span>
99
+ </div>
100
+ );
101
+
102
+ const BAR_HEIGHTS = [45, 70, 55, 80, 60, 90, 100];
103
+
104
+ const Bars: React.FC = () => (
105
+ <div aria-hidden="true" className="flex h-8 shrink-0 items-end gap-xs">
106
+ {BAR_HEIGHTS.map((h, i) => (
107
+ <span
108
+ key={i}
109
+ className="w-1.5 rounded-xs bg-primary/60"
110
+ style={{ height: `${h}%` }}
111
+ />
112
+ ))}
113
+ </div>
114
+ );
115
+
116
+ type CalloutSide = "left" | "right";
117
+
118
+ interface CalloutProps {
119
+ side: CalloutSide;
120
+ top: string;
121
+ children: React.ReactNode;
122
+ }
123
+
124
+ /**
125
+ * Floating pill callout, lg+ only.
126
+ * - "right": lives inside the right rail; a dashed connector starts at the rail's
127
+ * left edge (the card's right edge) and runs to the pill. Truncates to fit the rail.
128
+ * - "left": absolutely positioned on the root, overlapping the card's left edge and
129
+ * poking at most 24px past the root's left edge. No connector.
130
+ */
131
+ const Callout: React.FC<CalloutProps> = ({ side, top, children }) => {
132
+ const pill = (
133
+ <span className="flex min-w-0 items-center gap-sm overflow-hidden whitespace-nowrap rounded-full border border-hairline-soft bg-canvas px-sm py-xs text-caption font-weight-body-md text-ink shadow-card">
134
+ {children}
135
+ </span>
136
+ );
137
+ if (side === "left") {
138
+ return (
139
+ <div
140
+ className="absolute -left-6 z-10 hidden max-w-full min-w-0 items-center lg:flex"
141
+ style={{ top }}
142
+ >
143
+ {pill}
144
+ </div>
145
+ );
146
+ }
147
+ return (
148
+ <div
149
+ className="absolute left-0 z-10 flex max-w-full min-w-0 items-center"
150
+ style={{ top }}
151
+ >
152
+ <span aria-hidden="true" className="flex shrink-0 items-center">
153
+ <span className="h-1.5 w-1.5 rounded-full bg-hairline-strong" />
154
+ <span className="w-md border-t border-dashed border-hairline-strong" />
155
+ </span>
156
+ {pill}
157
+ </div>
158
+ );
159
+ };
160
+
161
+ const SWATCH_LAYOUT: Record<ShowcaseSwatch["position"], { side: CalloutSide; top: string }> = {
162
+ left: { side: "left", top: "16%" },
163
+ "right-top": { side: "right", top: "14%" },
164
+ "right-mid": { side: "right", top: "30%" },
165
+ };
166
+
167
+ export const DesignSystemShowcase = React.forwardRef<
168
+ HTMLDivElement,
169
+ DesignSystemShowcaseProps
170
+ >(
171
+ (
172
+ {
173
+ promptText = "a calm fintech brand with warm neutrals",
174
+ swatches = [
175
+ { label: "Accent", color: "var(--color-demo-warm-accent)", position: "left" },
176
+ { label: "Soft", color: "var(--color-demo-warm-soft)", position: "right-top" },
177
+ { label: "Ink", color: "var(--color-demo-warm-ink)", position: "right-mid" },
178
+ ],
179
+ fontLabel = "Plus Jakarta Sans 16",
180
+ radiusLabel = "radius 12",
181
+ spaceLabel = "space 16",
182
+ statLabel = "Monthly active users",
183
+ statValue = "24,532",
184
+ statDelta = "12%",
185
+ thumbnails = [],
186
+ activeThumbnailId,
187
+ onThumbnailClick,
188
+ darkModeLabel = "Dark mode",
189
+ darkModeCaption = "Same tokens. Different mood.",
190
+ className = "",
191
+ ...rest
192
+ },
193
+ ref,
194
+ ) => {
195
+ const baseId = React.useId();
196
+ const [tab, setTab] = React.useState<(typeof TABS)[number]>("Overview");
197
+ const [checked, setChecked] = React.useState(true);
198
+ const [toggleOn, setToggleOn] = React.useState(true);
199
+ const tabIndex = TABS.indexOf(tab);
200
+
201
+ const onTabKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>) => {
202
+ if (e.key !== "ArrowRight" && e.key !== "ArrowLeft") return;
203
+ e.preventDefault();
204
+ const delta = e.key === "ArrowRight" ? 1 : -1;
205
+ const next = TABS[(tabIndex + delta + TABS.length) % TABS.length];
206
+ setTab(next);
207
+ document.getElementById(`${baseId}-tab-${next}`)?.focus();
208
+ };
209
+
210
+ const leftSwatches = swatches.filter((s) => SWATCH_LAYOUT[s.position].side === "left");
211
+ const rightSwatches = swatches.filter((s) => SWATCH_LAYOUT[s.position].side === "right");
212
+
213
+ const renderSwatch = (s: ShowcaseSwatch) => {
214
+ const layout = SWATCH_LAYOUT[s.position];
215
+ return (
216
+ <Callout key={s.label} side={layout.side} top={layout.top}>
217
+ <span
218
+ aria-hidden="true"
219
+ className="h-4 w-4 shrink-0 rounded-full border border-hairline-soft"
220
+ style={{ background: s.color }}
221
+ />
222
+ <span className="truncate">{s.label}</span>
223
+ </Callout>
224
+ );
225
+ };
226
+
227
+ const hasThumbs = thumbnails.length > 0;
228
+
229
+ return (
230
+ <div
231
+ ref={ref}
232
+ className={`relative mx-auto flex w-full min-w-0 max-w-full items-stretch justify-center px-base py-xl lg:justify-start lg:px-0 ${
233
+ hasThumbs ? "lg:pb-32" : "lg:pb-48"
234
+ } ${className}`}
235
+ {...rest}
236
+ >
237
+ {/* left swatch callout (lg+): overlaps the card's left edge, pokes out <= 24px */}
238
+ <div aria-hidden="true">{leftSwatches.map(renderSwatch)}</div>
239
+
240
+ {/* main column: ~336px card at lg+, aligned left of centre; fluid below */}
241
+ <div className="relative w-full min-w-0 max-w-full shrink-0 sm:w-96 lg:ml-xl lg:w-84">
242
+ {/* floating prompt bubble, centred on the card */}
243
+ <div className="relative z-10 -mb-lg flex justify-center">
244
+ <div className="flex max-w-full items-center gap-sm rounded-lg border border-hairline-soft bg-canvas px-md py-sm text-caption text-ink shadow-card">
245
+ <span className="flex h-7 w-7 shrink-0 items-center justify-center rounded-sm bg-primary text-on-primary">
246
+ <Icon name="sparkle" className="size-3.5" aria-hidden="true" />
247
+ </span>
248
+ <span className="truncate">{promptText}</span>
249
+ <span aria-hidden="true" className="animate-pulse text-muted">|</span>
250
+ </div>
251
+ </div>
252
+
253
+ {/* canvas card */}
254
+ <div className="relative min-w-0 rounded-xl border border-hairline-soft bg-canvas p-base pt-xl shadow-card lg:p-md lg:pt-xl">
255
+ <div className="mb-sm flex justify-center">
256
+ <span className="max-w-full truncate rounded-xs bg-ink px-sm py-xxs text-caption text-canvas">
257
+ Button - primary, secondary, ghost
258
+ </span>
259
+ </div>
260
+ <div className="grid grid-cols-3 gap-sm">
261
+ <Button variant="primary" size="sm" className="!rounded-full">Primary</Button>
262
+ <Button variant="secondary" size="sm" className="!rounded-full">Secondary</Button>
263
+ <Button variant="ghost" size="sm" className="!rounded-full !border-hairline">Ghost</Button>
264
+ </div>
265
+
266
+ <div className="mt-base">
267
+ <Input label="Email address" placeholder="you@company.com" size="sm" fullWidth />
268
+ </div>
269
+
270
+ <div className="mt-base flex items-center gap-md">
271
+ <Toggle on={toggleOn} onChange={setToggleOn} label="Enable notifications" />
272
+ <Chip label="Active" variant="success" size="sm" />
273
+ <div className="ml-auto"><Avatars /></div>
274
+ </div>
275
+
276
+ <div className="mt-base flex items-end justify-between gap-md rounded-md border border-hairline-soft p-base">
277
+ <div className="min-w-0">
278
+ <p className="truncate text-caption text-muted">{statLabel}</p>
279
+ <p className="flex flex-wrap items-center gap-sm text-body-lg font-weight-body-md text-ink">
280
+ {statValue}
281
+ <span className="rounded-full bg-semantic-success-soft px-sm py-xxs text-caption text-semantic-success">
282
+ ↑ {statDelta}
283
+ </span>
284
+ </p>
285
+ </div>
286
+ <Bars />
287
+ </div>
288
+
289
+ {/* segmented control with one sliding indicator */}
290
+ <div className="mt-base rounded-md bg-surface-soft p-xxs">
291
+ <div role="tablist" aria-label="Showcase sections" className="relative grid grid-cols-3 text-caption">
292
+ <span
293
+ aria-hidden="true"
294
+ className="absolute inset-y-0 left-0 w-1/3 rounded-sm border-b-2 border-primary bg-canvas shadow-sm transition-transform duration-200 ease-out"
295
+ style={{ transform: `translateX(${tabIndex * 100}%)` }}
296
+ />
297
+ {TABS.map((t) => {
298
+ const selected = tab === t;
299
+ return (
300
+ <button
301
+ key={t}
302
+ id={`${baseId}-tab-${t}`}
303
+ type="button"
304
+ role="tab"
305
+ aria-selected={selected}
306
+ aria-controls={`${baseId}-panel`}
307
+ tabIndex={selected ? 0 : -1}
308
+ onClick={() => setTab(t)}
309
+ onKeyDown={onTabKeyDown}
310
+ className={`relative cursor-pointer rounded-sm py-sm transition duration-150 ease-out active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue ${
311
+ selected ? "font-weight-body-md text-primary" : "text-muted hover:text-ink"
312
+ }`}
313
+ >
314
+ {t}
315
+ </button>
316
+ );
317
+ })}
318
+ </div>
319
+ </div>
320
+ <div
321
+ role="tabpanel"
322
+ id={`${baseId}-panel`}
323
+ aria-labelledby={`${baseId}-tab-${tab}`}
324
+ className="sr-only"
325
+ >
326
+ {tab} section selected
327
+ </div>
328
+
329
+ <div className="mt-base">
330
+ <Checkbox
331
+ label="Send me product updates"
332
+ checked={checked}
333
+ onChange={(e) => setChecked(e.target.checked)}
334
+ size="sm"
335
+ />
336
+ </div>
337
+ </div>
338
+
339
+ {/* selectable thumbnails (kept left-aligned at lg+ so the dark card never covers them) */}
340
+ {hasThumbs && (
341
+ <div className="mt-base flex flex-wrap justify-center gap-md lg:justify-start">
342
+ {thumbnails.map((t) => {
343
+ const active = activeThumbnailId === t.id;
344
+ return (
345
+ <button
346
+ key={t.id}
347
+ type="button"
348
+ onClick={() => onThumbnailClick?.(t.id)}
349
+ aria-pressed={active}
350
+ aria-label={t.alt || `Thumbnail ${t.id}`}
351
+ className={`h-12 w-12 cursor-pointer overflow-hidden rounded-md border-2 bg-canvas shadow-sm transition duration-150 ease-out hover:scale-105 active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue ${
352
+ active ? "border-primary" : "border-transparent"
353
+ }`}
354
+ >
355
+ <img src={t.src} alt="" className="h-full w-full object-cover" />
356
+ </button>
357
+ );
358
+ })}
359
+ </div>
360
+ )}
361
+ </div>
362
+
363
+ {/* right callout rail (lg+): ~176px in the remaining width, connectors touch the card's right edge */}
364
+ <div
365
+ aria-hidden="true"
366
+ className="relative hidden min-w-0 max-w-full shrink basis-auto lg:block lg:w-44"
367
+ >
368
+ {rightSwatches.map(renderSwatch)}
369
+ <Callout side="right" top="44%">
370
+ <span className="shrink-0 font-weight-heading-sm">Aa</span>
371
+ <span className="truncate">{fontLabel}</span>
372
+ </Callout>
373
+ <Callout side="right" top="55%">
374
+ <span aria-hidden="true" className="h-4 w-4 shrink-0 rounded-tl-sm border-l-2 border-t-2 border-ink" />
375
+ <span className="truncate">{radiusLabel}</span>
376
+ </Callout>
377
+ <Callout side="right" top="64%">
378
+ <Icon name="expand-diagonal-arrows" className="size-3.5 shrink-0" aria-hidden="true" />
379
+ <span className="truncate">{spaceLabel}</span>
380
+ </Callout>
381
+ </div>
382
+
383
+ {/* dark mode mini card (lg+): ~224px, anchored bottom-right inside the root, overlaps only the main card's bottom-right corner */}
384
+ <div
385
+ data-theme="dark"
386
+ aria-hidden="true"
387
+ className="absolute bottom-0 right-0 z-10 hidden w-56 max-w-full rounded-lg border border-hairline bg-canvas p-md text-ink shadow-card lg:block"
388
+ >
389
+ <p className="mb-sm flex items-center gap-xs text-caption">
390
+ <Icon name="moon-dark-mode" className="size-3" aria-hidden="true" />
391
+ {darkModeLabel}
392
+ </p>
393
+ <div className="grid grid-cols-3 gap-xs text-caption">
394
+ <span className="rounded-full bg-primary py-xxs text-center text-on-primary">Primary</span>
395
+ <span className="rounded-full border border-hairline py-xxs text-center">Secondary</span>
396
+ <span className="rounded-full border border-hairline py-xxs text-center">Ghost</span>
397
+ </div>
398
+ <div className="mt-sm h-5 rounded-sm border border-hairline bg-surface" />
399
+ <div className="mt-sm flex items-center gap-xs">
400
+ <Toggle on />
401
+ <Chip label="Active" variant="success" size="sm" tabIndex={-1} />
402
+ </div>
403
+ <div className="mt-sm h-8 rounded-sm border border-hairline" />
404
+ <p className="mt-sm text-caption text-muted">{darkModeCaption}</p>
405
+ </div>
406
+ </div>
407
+ );
408
+ },
409
+ );
410
+ DesignSystemShowcase.displayName = "DesignSystemShowcase";
@@ -0,0 +1,6 @@
1
+ export { DesignSystemShowcase } from "./DesignSystemShowcase";
2
+ export type {
3
+ DesignSystemShowcaseProps,
4
+ ShowcaseThumbnail,
5
+ ShowcaseSwatch,
6
+ } from "./DesignSystemShowcase";
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import { DesignSystemShowcase } from "./DesignSystemShowcase";
3
+
4
+ const THUMBS = [
5
+ { id: "warm", src: "https://picsum.photos/seed/warm/96/96", alt: "Warm theme" },
6
+ { id: "bold", src: "https://picsum.photos/seed/bold/96/96", alt: "Bold theme" },
7
+ { id: "pastel", src: "https://picsum.photos/seed/pastel/96/96", alt: "Pastel theme" },
8
+ { id: "mono", src: "https://picsum.photos/seed/mono/96/96", alt: "Mono theme" },
9
+ ];
10
+
11
+ export default function Preview() {
12
+ const [active, setActive] = React.useState("warm");
13
+ return (
14
+ <div className="w-full max-w-3xl mx-auto p-lg">
15
+ <DesignSystemShowcase
16
+ thumbnails={THUMBS}
17
+ activeThumbnailId={active}
18
+ onThumbnailClick={setActive}
19
+ />
20
+ </div>
21
+ );
22
+ }