@designa8/vibedesign-v6 1.20.20 → 2.1.2

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 (125) 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 +224 -138
  14. package/src/atoms/AppSidebar/index.ts +1 -1
  15. package/src/atoms/AppSidebar/preview.tsx +61 -8
  16. package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +242 -173
  17. package/src/atoms/AppSidebarMobile/preview.tsx +59 -89
  18. package/src/atoms/AuthLogin/AuthLogin.tsx +86 -49
  19. package/src/atoms/AuthLogin/preview.tsx +16 -0
  20. package/src/atoms/AuthSignUp/AuthSignUp.tsx +206 -126
  21. package/src/atoms/AuthSignUp/preview.tsx +10 -0
  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/ExportDesignMdModal/ExportDesignMdModal.tsx +6 -1
  55. package/src/atoms/FilterTabBar/FilterTabBar.tsx +2 -2
  56. package/src/atoms/FontCombobox/FontCombobox.tsx +655 -0
  57. package/src/atoms/FontCombobox/index.ts +6 -0
  58. package/src/atoms/FontCombobox/preview.tsx +111 -0
  59. package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +894 -96
  60. package/src/atoms/HomePageTemplate/preview.tsx +4 -0
  61. package/src/atoms/Icon/Icon.tsx +17 -11
  62. package/src/atoms/Icon/icons.data.ts +34 -0
  63. package/src/atoms/Input/Input.tsx +37 -21
  64. package/src/atoms/LandingHero/LandingHero.tsx +545 -0
  65. package/src/atoms/LandingHero/index.ts +6 -0
  66. package/src/atoms/LandingHero/preview.tsx +88 -0
  67. package/src/atoms/MarketingFooter/MarketingFooter.tsx +215 -0
  68. package/src/atoms/MarketingFooter/index.ts +7 -0
  69. package/src/atoms/MarketingFooter/preview.tsx +28 -0
  70. package/src/atoms/MarketingNavbar/MarketingNavbar.tsx +451 -0
  71. package/src/atoms/MarketingNavbar/index.ts +7 -0
  72. package/src/atoms/MarketingNavbar/preview.tsx +109 -0
  73. package/src/atoms/Menu/Menu.tsx +1 -1
  74. package/src/atoms/MobileActionsDrawer/MobileActionsDrawer.tsx +548 -0
  75. package/src/atoms/MobileActionsDrawer/index.ts +9 -0
  76. package/src/atoms/MobileActionsDrawer/preview.tsx +109 -0
  77. package/src/atoms/Modal/Modal.tsx +77 -28
  78. package/src/atoms/PreviewDock/PreviewDock.tsx +119 -0
  79. package/src/atoms/PreviewDock/index.ts +2 -0
  80. package/src/atoms/PreviewDock/preview.tsx +30 -0
  81. package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +47 -30
  82. package/src/atoms/PricingCard/PricingCard.tsx +15 -4
  83. package/src/atoms/PricingPageTemplate/PricingPageTemplate.tsx +109 -89
  84. package/src/atoms/ProjectSettingsModal/ProjectSettingsModal.tsx +314 -0
  85. package/src/atoms/ProjectSettingsModal/index.ts +2 -0
  86. package/src/atoms/ProjectSettingsModal/preview.tsx +130 -0
  87. package/src/atoms/ProjectSettingsModal/switch.snippet.txt +8 -0
  88. package/src/atoms/PromptInputBar/PromptInputBar.tsx +750 -302
  89. package/src/atoms/PromptInputBar/preview.tsx +64 -64
  90. package/src/atoms/SettingsPageTemplate/SettingsPageTemplate.tsx +272 -0
  91. package/src/atoms/SettingsPageTemplate/index.ts +2 -0
  92. package/src/atoms/SettingsPageTemplate/preview.tsx +29 -0
  93. package/src/atoms/SidebarUpgradeBanner/SidebarUpgradeBanner.tsx +178 -0
  94. package/src/atoms/SidebarUpgradeBanner/index.ts +2 -0
  95. package/src/atoms/SidebarUpgradeBanner/preview.tsx +47 -0
  96. package/src/atoms/SkeletonChip/SkeletonChip.tsx +198 -0
  97. package/src/atoms/SkeletonChip/index.ts +2 -0
  98. package/src/atoms/SkeletonChip/preview.tsx +44 -0
  99. package/src/atoms/TemplateHeader/TemplateHeader.tsx +129 -0
  100. package/src/atoms/TemplateHeader/index.ts +2 -0
  101. package/src/atoms/TemplateHeader/preview.tsx +39 -0
  102. package/src/atoms/TemplateHero/TemplateHero.tsx +286 -0
  103. package/src/atoms/TemplateHero/index.ts +2 -0
  104. package/src/atoms/TemplateHero/preview.tsx +32 -0
  105. package/src/atoms/TemplateSummary/TemplateSummary.tsx +85 -0
  106. package/src/atoms/TemplateSummary/index.ts +2 -0
  107. package/src/atoms/TemplateSummary/preview.tsx +10 -0
  108. package/src/atoms/Toast/Toast.tsx +178 -0
  109. package/src/atoms/Toast/index.ts +2 -0
  110. package/src/atoms/Toast/preview.tsx +100 -0
  111. package/src/atoms/TopNavbar/TopNavbar.tsx +145 -67
  112. package/src/atoms/TopNavbar/preview.tsx +13 -7
  113. package/src/atoms/TopupModal/TopupModal.tsx +94 -0
  114. package/src/atoms/TopupModal/index.ts +2 -0
  115. package/src/atoms/TopupModal/preview.tsx +22 -0
  116. package/src/atoms/UpgradeCard/UpgradeCard.tsx +124 -43
  117. package/src/atoms/UpgradeCard/index.ts +1 -1
  118. package/src/atoms/UpgradeCard/preview.tsx +7 -14
  119. package/src/atoms/UpgradeModal/UpgradeModal.tsx +192 -0
  120. package/src/atoms/UpgradeModal/index.ts +2 -0
  121. package/src/atoms/UpgradeModal/preview.tsx +41 -0
  122. package/src/index.ts +23 -0
  123. package/src/tokens.css +45 -7
  124. package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
  125. package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
@@ -0,0 +1,286 @@
1
+ import React from "react";
2
+ import { Typography } from "../Typography";
3
+ import { Button } from "../Button";
4
+ import { Icon } from "../Icon";
5
+
6
+ interface Swatch {
7
+ label: string;
8
+ /** Text shown in the swatch — the token's own name, not a raw hex string */
9
+ valueLabel: string;
10
+ /** Tailwind background utility driven by a token (ignored when `color` is set) */
11
+ bgClass?: string;
12
+ /** Tailwind text utility driven by a token, chosen for contrast (ignored when `color` is set) */
13
+ textClass?: string;
14
+ /** Optional raw hex fill — when set, the chip is painted with this color inline and the
15
+ * label color is picked automatically for contrast via WCAG relative luminance. */
16
+ color?: string;
17
+ }
18
+
19
+ const defaultBrandSwatches: Swatch[] = [
20
+ { label: "Primary", valueLabel: "primary", bgClass: "bg-primary", textClass: "text-on-primary" },
21
+ { label: "Primary hover", valueLabel: "primary-hover", bgClass: "bg-primary-hover", textClass: "text-on-primary" },
22
+ { label: "Primary active", valueLabel: "primary-active", bgClass: "bg-primary-active", textClass: "text-on-primary" },
23
+ { label: "Primary disabled", valueLabel: "primary-disabled", bgClass: "bg-primary-disabled", textClass: "text-ink" },
24
+ { label: "Primary subtle", valueLabel: "primary-soft", bgClass: "bg-primary-soft", textClass: "text-muted" },
25
+ ];
26
+
27
+ const defaultNeutralSwatches: Swatch[] = [
28
+ { label: "Canvas", valueLabel: "canvas", bgClass: "bg-canvas", textClass: "text-ink" },
29
+ { label: "Surface soft", valueLabel: "surface-soft", bgClass: "bg-surface-soft", textClass: "text-ink" },
30
+ { label: "Surface strong", valueLabel: "surface-strong", bgClass: "bg-surface-strong", textClass: "text-ink" },
31
+ { label: "Ink", valueLabel: "ink", bgClass: "bg-ink", textClass: "text-on-primary" },
32
+ { label: "Muted", valueLabel: "muted", bgClass: "bg-muted", textClass: "text-on-primary" },
33
+ { label: "Muted soft", valueLabel: "muted-soft", bgClass: "bg-muted-soft", textClass: "text-ink" },
34
+ ];
35
+
36
+ // Fixed label-color tokens used ONLY to compute a WCAG-contrasting inline label color for
37
+ // consumer-supplied raw swatch hexes (`s.color`). These reference dedicated `contrast-dark` /
38
+ // `contrast-light` tokens (deliberately theme-invariant, unlike `ink`/`canvas`) because the
39
+ // label must contrast against an arbitrary caller-provided hex fill, not against whatever the
40
+ // current theme's ink/canvas roles resolve to.
41
+ const LABEL_DARK_VAR = "var(--color-contrast-dark)";
42
+ const LABEL_LIGHT_VAR = "var(--color-contrast-light)";
43
+
44
+ function relativeLuminance(hex: string): number {
45
+ const clean = hex.replace("#", "");
46
+ const full =
47
+ clean.length === 3
48
+ ? clean
49
+ .split("")
50
+ .map((c) => c + c)
51
+ .join("")
52
+ : clean;
53
+ const r = parseInt(full.substring(0, 2), 16) / 255;
54
+ const g = parseInt(full.substring(2, 4), 16) / 255;
55
+ const b = parseInt(full.substring(4, 6), 16) / 255;
56
+ const [rl, gl, bl] = [r, g, b].map((v) => (v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4)));
57
+ return 0.2126 * rl + 0.7152 * gl + 0.0722 * bl;
58
+ }
59
+
60
+ function pickLabelColor(hex: string): string {
61
+ return relativeLuminance(hex) > 0.5 ? LABEL_DARK_VAR : LABEL_LIGHT_VAR;
62
+ }
63
+
64
+ // Swatches stay on a single row at every width; each chip may shrink (min-w-0) so long
65
+ // token names truncate instead of pushing the row wider than the viewport.
66
+ const SwatchRow = ({ swatches }: { swatches: Swatch[] }) => (
67
+ <div className="flex w-full min-w-0 flex-nowrap overflow-hidden rounded-md border border-hairline">
68
+ {swatches.map((s) => {
69
+ const labelColor = s.color ? pickLabelColor(s.color) : undefined;
70
+ return (
71
+ <div
72
+ key={s.label}
73
+ className={`flex min-w-0 flex-1 flex-col items-center justify-center gap-xxs px-sm py-lg ${
74
+ s.color ? "" : (s.bgClass ?? "bg-surface-soft")
75
+ }`}
76
+ style={s.color ? { backgroundColor: s.color } : undefined}
77
+ >
78
+ <span
79
+ className={`block w-full min-w-0 truncate text-center text-caption font-weight-heading-sm ${s.color ? "" : (s.textClass ?? "text-ink")}`}
80
+ style={labelColor ? { color: labelColor } : undefined}
81
+ >
82
+ {s.valueLabel}
83
+ </span>
84
+ <span
85
+ className={`block w-full min-w-0 truncate text-center text-caption opacity-80 ${s.color ? "" : (s.textClass ?? "text-ink")}`}
86
+ style={labelColor ? { color: labelColor } : undefined}
87
+ >
88
+ {s.label}
89
+ </span>
90
+ </div>
91
+ );
92
+ })}
93
+ </div>
94
+ );
95
+
96
+ export interface TemplateHeroProps extends React.HTMLAttributes<HTMLDivElement> {
97
+ /** Design system name shown as the big title */
98
+ name?: string;
99
+ /** Meta line under the title, e.g. "105 components · React + TypeScript source · Production ready" */
100
+ meta?: string;
101
+ /** Font family name shown in the typography section label, applied inline to the "Aa" specimen */
102
+ fontFamily?: string;
103
+ /** Heading shown at the top of the pricing panel */
104
+ pitchTitle?: string;
105
+ /** Feature bullets listed in the pricing panel */
106
+ features?: string[];
107
+ /** Price string, e.g. "$9.99 USD" */
108
+ price?: string;
109
+ /** Caption under the price */
110
+ priceCaption?: string;
111
+ /** Primary CTA label */
112
+ buyLabel?: string;
113
+ /**
114
+ * Icon name shown before `buyLabel` on the primary CTA.
115
+ * - `undefined` (default) — keeps the current shopping-cart icon.
116
+ * - a string — renders `Icon` with that name (e.g. "grid") instead.
117
+ * - `null` — renders the primary CTA with no leading icon, label only.
118
+ */
119
+ buyIcon?: React.ComponentProps<typeof Icon>["name"] | null;
120
+ /** Secondary CTA label */
121
+ previewLabel?: string;
122
+ /**
123
+ * Optional trust line rendered under the panel CTAs. There is NO default copy: when this is
124
+ * omitted, `undefined`, or an empty / whitespace-only string, the whole trust row is not
125
+ * rendered (no shield-check icon, no caption) and no refund copy is substituted.
126
+ */
127
+ guarantee?: string;
128
+ /** Called when the primary CTA is clicked */
129
+ onBuy?: () => void;
130
+ /** Called when the secondary CTA is clicked */
131
+ onPreview?: () => void;
132
+ /** Override the brand color chips shown in the Colors section */
133
+ brandSwatches?: Swatch[];
134
+ /** Override the neutral color chips shown in the Colors section */
135
+ neutralSwatches?: Swatch[];
136
+ }
137
+
138
+ export const TemplateHero = React.forwardRef<HTMLDivElement, TemplateHeroProps>(
139
+ (
140
+ {
141
+ name = "Design System",
142
+ meta = "105 components · React + TypeScript source · Production ready",
143
+ fontFamily = "Inter",
144
+ pitchTitle = "Everything you need to build great products",
145
+ features = [
146
+ "105 production-ready components",
147
+ "React + TypeScript source code",
148
+ "Includes machine-readable Design.md",
149
+ ],
150
+ price = "$9.99 USD",
151
+ priceCaption = "One-time purchase · Lifetime updates",
152
+ buyLabel = "Buy now",
153
+ buyIcon,
154
+ previewLabel = "Preview components",
155
+ guarantee,
156
+ onBuy,
157
+ onPreview,
158
+ brandSwatches = defaultBrandSwatches,
159
+ neutralSwatches = defaultNeutralSwatches,
160
+ className,
161
+ ...rest
162
+ },
163
+ ref,
164
+ ) => {
165
+ const resolvedBuyIcon = buyIcon === undefined ? "shopping-cart" : buyIcon;
166
+ // No fallback copy: the trust row only exists when the caller supplies real text.
167
+ const trustLine = typeof guarantee === "string" ? guarantee.trim() : "";
168
+
169
+ return (
170
+ <div ref={ref} className={["w-full min-w-0", className].filter(Boolean).join(" ")} {...rest}>
171
+ <div className="min-w-0 rounded-xl border border-hairline bg-canvas p-md shadow-card md:p-xl">
172
+ {/* Responsive split: below md the summary and pricing panel stack in one full-width
173
+ * column (summary first). At md and up the grid holds a true 2:1 ratio via
174
+ * `minmax(0, 2fr) minmax(0, 1fr)` so neither column's intrinsic content width can
175
+ * force the row wider than its parent. */}
176
+ <div className="grid grid-cols-1 items-stretch gap-lg md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)] md:gap-xl">
177
+ {/* Left column — colors & typography summary (2/3) */}
178
+ <div className="min-w-0">
179
+ <div className="mb-xl">
180
+ <Typography role="display-lg" color="ink">
181
+ {name}
182
+ </Typography>
183
+ <Typography role="body-md" color="muted">
184
+ {meta}
185
+ </Typography>
186
+ </div>
187
+
188
+ <div className="mb-lg">
189
+ <Typography role="heading-sm" color="ink" className="mb-md">
190
+ Colors
191
+ </Typography>
192
+
193
+ <Typography role="caption" color="muted" uppercase className="mb-sm block">
194
+ Brand
195
+ </Typography>
196
+ <SwatchRow swatches={brandSwatches} />
197
+
198
+ <Typography role="caption" color="muted" uppercase className="mb-sm mt-lg block">
199
+ Neutrals
200
+ </Typography>
201
+ <SwatchRow swatches={neutralSwatches} />
202
+ </div>
203
+
204
+ <div className="border-t border-hairline pt-lg">
205
+ <Typography role="caption" color="muted" uppercase className="mb-md block">
206
+ Typography · {fontFamily}
207
+ </Typography>
208
+ <div className="flex items-center gap-md">
209
+ <span className="text-display-lg font-weight-heading-lg text-ink" style={{ fontFamily }}>
210
+ Aa
211
+ </span>
212
+ <Typography role="body-md" color="body">
213
+ {fontFamily}
214
+ </Typography>
215
+ </div>
216
+ </div>
217
+ </div>
218
+
219
+ {/* Right column — pricing / feature panel (1/3 at md+, full width below) */}
220
+ <div className="w-full min-w-0 rounded-lg bg-surface-soft p-md md:p-xl">
221
+ <div className="mb-lg flex items-start gap-md">
222
+ <div className="flex size-12 shrink-0 items-center justify-center rounded-md bg-primary">
223
+ <Icon name="sparkle" className="size-6 text-on-primary" aria-hidden="true" />
224
+ </div>
225
+ <Typography role="heading-sm" color="ink">
226
+ {pitchTitle}
227
+ </Typography>
228
+ </div>
229
+
230
+ <ul className="mb-lg flex flex-col gap-sm">
231
+ {features.map((feature) => (
232
+ <li key={feature} className="flex items-center gap-sm">
233
+ <span className="flex size-6 shrink-0 items-center justify-center rounded-full bg-primary-soft">
234
+ <Icon name="check-checkmark" className="size-3.5 text-primary" aria-hidden="true" />
235
+ </span>
236
+ <Typography role="body-sm" color="body">
237
+ {feature}
238
+ </Typography>
239
+ </li>
240
+ ))}
241
+ </ul>
242
+
243
+ <div className="mb-lg">
244
+ <Typography role="display-lg" color="ink">
245
+ {price}
246
+ </Typography>
247
+ <Typography role="body-sm" color="muted">
248
+ {priceCaption}
249
+ </Typography>
250
+ </div>
251
+
252
+ <div className="flex flex-col gap-sm">
253
+ <Button variant="primary" size="lg" className="w-full" onClick={onBuy}>
254
+ {resolvedBuyIcon !== null && (
255
+ <Icon name={resolvedBuyIcon} className="size-4" aria-hidden="true" />
256
+ )}
257
+ {buyLabel}
258
+ </Button>
259
+ <Button
260
+ variant="ghost"
261
+ size="lg"
262
+ className="w-full border border-primary text-primary hover:bg-primary-soft"
263
+ onClick={onPreview}
264
+ >
265
+ <Icon name="eye-show-password" className="size-4" aria-hidden="true" />
266
+ {previewLabel}
267
+ </Button>
268
+ </div>
269
+
270
+ {trustLine.length > 0 && (
271
+ <div className="mt-lg flex items-center gap-xs">
272
+ <Icon name="shield-check" className="size-4 text-muted" aria-hidden="true" />
273
+ <Typography role="caption" color="muted">
274
+ {trustLine}
275
+ </Typography>
276
+ </div>
277
+ )}
278
+ </div>
279
+ </div>
280
+ </div>
281
+ </div>
282
+ );
283
+ },
284
+ );
285
+
286
+ TemplateHero.displayName = "TemplateHero";
@@ -0,0 +1,2 @@
1
+ export { TemplateHero } from "./TemplateHero";
2
+ export type { TemplateHeroProps } from "./TemplateHero";
@@ -0,0 +1,32 @@
1
+ import React, { useState } from "react";
2
+ import { TemplateHero } from "./TemplateHero";
3
+
4
+ export default function TemplateHeroPreview() {
5
+ const [message, setMessage] = useState<string | null>(null);
6
+
7
+ return (
8
+ <div className="w-full max-w-5xl mx-auto p-lg space-y-lg">
9
+ <TemplateHero
10
+ onBuy={() => setMessage("Purchase started")}
11
+ onPreview={() => setMessage("Opening component preview…")}
12
+ />
13
+
14
+ {message && (
15
+ <p className="text-body-sm text-primary text-center">{message}</p>
16
+ )}
17
+
18
+ <TemplateHero
19
+ name="Marketing Kit"
20
+ meta="42 components · Figma + code · Production ready"
21
+ fontFamily="Playfair Display"
22
+ pitchTitle="Ship a consistent brand everywhere"
23
+ features={["Figma library included", "Dark mode built in", "Priority support"]}
24
+ price="$149 USD"
25
+ priceCaption="One-time purchase · Lifetime updates"
26
+ guarantee="Secure checkout · Instant download"
27
+ onBuy={() => setMessage("Purchase started")}
28
+ onPreview={() => setMessage("Opening component preview…")}
29
+ />
30
+ </div>
31
+ );
32
+ }
@@ -0,0 +1,85 @@
1
+ import * as React from "react";
2
+ import { Icon, type IconName } from "../Icon";
3
+
4
+ export interface TemplateSummaryItem {
5
+ icon: IconName;
6
+ index: number;
7
+ title: string;
8
+ description: string;
9
+ }
10
+
11
+ export interface TemplateSummaryProps
12
+ extends React.HTMLAttributes<HTMLDivElement> {
13
+ heading?: string;
14
+ items?: TemplateSummaryItem[];
15
+ }
16
+
17
+ const DEFAULT_ITEMS: TemplateSummaryItem[] = [
18
+ {
19
+ icon: "download",
20
+ index: 1,
21
+ title: "Download the source",
22
+ description: "Get the entire design system as real, editable React + TypeScript code.",
23
+ },
24
+ {
25
+ icon: "file-document",
26
+ index: 2,
27
+ title: "Get a Design.md",
28
+ description: "A machine-readable file documents every token and component in the system.",
29
+ },
30
+ {
31
+ icon: "chat-bubble",
32
+ index: 3,
33
+ title: "Edit with chat",
34
+ description: "Ask the chat to tweak, restyle, or add new components at any time.",
35
+ },
36
+ {
37
+ icon: "sparkle",
38
+ index: 4,
39
+ title: "Let agents evolve it",
40
+ description: "Design.md lets any coding agent update components automatically.",
41
+ },
42
+ ];
43
+
44
+ export const TemplateSummary = React.forwardRef<HTMLDivElement, TemplateSummaryProps>(
45
+ ({ heading = "What you get", items = DEFAULT_ITEMS, className, ...rest }, ref) => {
46
+ return (
47
+ <div
48
+ ref={ref}
49
+ className={["w-full rounded-xl bg-surface-soft p-lg", className]
50
+ .filter(Boolean)
51
+ .join(" ")}
52
+ {...rest}
53
+ >
54
+ <p className="text-heading-sm font-weight-heading-sm text-ink mb-lg">
55
+ {heading}
56
+ </p>
57
+
58
+ <div className="grid grid-cols-2 gap-md">
59
+ {items.map((item) => (
60
+ <div
61
+ key={item.index}
62
+ className="aspect-square rounded-lg bg-canvas p-md shadow-sm flex flex-col"
63
+ >
64
+ <div className="flex items-center justify-between mb-sm">
65
+ <span className="flex h-8 w-8 items-center justify-center rounded-sm bg-primary-soft text-primary">
66
+ <Icon name={item.icon} size={16} />
67
+ </span>
68
+ <span className="text-caption text-muted-soft">
69
+ {String(item.index).padStart(2, "0")}
70
+ </span>
71
+ </div>
72
+ <p className="text-body-sm font-weight-heading-sm text-ink mb-xxs">
73
+ {item.title}
74
+ </p>
75
+ <p className="text-caption text-muted leading-caption">
76
+ {item.description}
77
+ </p>
78
+ </div>
79
+ ))}
80
+ </div>
81
+ </div>
82
+ );
83
+ },
84
+ );
85
+ TemplateSummary.displayName = "TemplateSummary";
@@ -0,0 +1,2 @@
1
+ export { TemplateSummary } from "./TemplateSummary";
2
+ export type { TemplateSummaryProps, TemplateSummaryItem } from "./TemplateSummary";
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { TemplateSummary } from "./TemplateSummary";
3
+
4
+ export default function TemplateSummaryPreview() {
5
+ return (
6
+ <div className="w-full max-w-3xl mx-auto p-lg">
7
+ <TemplateSummary />
8
+ </div>
9
+ );
10
+ }
@@ -0,0 +1,178 @@
1
+ import * as React from "react";
2
+ import { Icon } from "../Icon";
3
+
4
+ export type ToastVariant = "neutral" | "success" | "error" | "info";
5
+
6
+ export interface ToastProps
7
+ extends Omit<React.ComponentPropsWithoutRef<"div">, "title"> {
8
+ variant?: ToastVariant;
9
+ title: React.ReactNode;
10
+ description?: React.ReactNode;
11
+ /** Label for the inline text action (e.g. "Undo", "Retry"). Omit for no action. */
12
+ actionLabel?: string;
13
+ onAction?: () => void;
14
+ actionDisabled?: boolean;
15
+ /** Controlled open state. Leave undefined for uncontrolled (starts open). */
16
+ open?: boolean;
17
+ onOpenChange?: (open: boolean) => void;
18
+ /** Called after the toast is dismissed (button, Escape, or timeout). */
19
+ onDismiss?: () => void;
20
+ /** Auto-dismiss in ms. 0 = persist. Defaults to 4000, errors persist. */
21
+ duration?: number;
22
+ dismissLabel?: string;
23
+ }
24
+
25
+ // Tile fills use semantic tokens; the glyph uses `text-canvas`, which is white
26
+ // in light mode and near-black in dark mode, so the mark always contrasts.
27
+ const GLYPH: Record<
28
+ ToastVariant,
29
+ { icon: "info" | "check-checkmark" | "circle-alert"; tile: string; size: number }
30
+ > = {
31
+ neutral: { icon: "info", tile: "bg-muted", size: 14 },
32
+ success: { icon: "check-checkmark", tile: "bg-semantic-success-accent", size: 14 },
33
+ error: { icon: "circle-alert", tile: "bg-semantic-error", size: 24 },
34
+ info: { icon: "info", tile: "bg-primary", size: 14 },
35
+ };
36
+
37
+ const pressable =
38
+ "cursor-pointer transition duration-150 ease-out active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50";
39
+
40
+ export const Toast = React.forwardRef<HTMLDivElement, ToastProps>(
41
+ (
42
+ {
43
+ variant = "neutral",
44
+ title,
45
+ description,
46
+ actionLabel,
47
+ onAction,
48
+ actionDisabled = false,
49
+ open: openProp,
50
+ onOpenChange,
51
+ onDismiss,
52
+ duration,
53
+ dismissLabel = "Dismiss notification",
54
+ className,
55
+ onKeyDown,
56
+ onMouseEnter,
57
+ onMouseLeave,
58
+ onFocus,
59
+ onBlur,
60
+ ...rest
61
+ },
62
+ ref,
63
+ ) => {
64
+ const isControlled = openProp !== undefined;
65
+ const [internalOpen, setInternalOpen] = React.useState(true);
66
+ const open = isControlled ? openProp : internalOpen;
67
+ const [paused, setPaused] = React.useState(false);
68
+
69
+ const effectiveDuration = duration ?? (variant === "error" ? 0 : 4000);
70
+
71
+ const close = React.useCallback(() => {
72
+ if (!isControlled) setInternalOpen(false);
73
+ onOpenChange?.(false);
74
+ onDismiss?.();
75
+ }, [isControlled, onOpenChange, onDismiss]);
76
+
77
+ React.useEffect(() => {
78
+ if (!open || paused || effectiveDuration <= 0) return;
79
+ const id = window.setTimeout(close, effectiveDuration);
80
+ return () => window.clearTimeout(id);
81
+ }, [open, paused, effectiveDuration, close]);
82
+
83
+ const glyph = GLYPH[variant];
84
+ const state = open ? "open" : "closed";
85
+
86
+ return (
87
+ <div
88
+ ref={ref}
89
+ data-state={state}
90
+ className={[
91
+ "grid w-full transition-[grid-template-rows,opacity,transform] duration-200 ease-out",
92
+ "data-[state=open]:grid-rows-[1fr] data-[state=open]:translate-y-0 data-[state=open]:scale-100 data-[state=open]:opacity-100",
93
+ "data-[state=closed]:pointer-events-none data-[state=closed]:grid-rows-[0fr] data-[state=closed]:translate-y-2 data-[state=closed]:scale-95 data-[state=closed]:opacity-0",
94
+ className,
95
+ ]
96
+ .filter(Boolean)
97
+ .join(" ")}
98
+ style={{ zIndex: open ? "var(--z-toast, 1300)" : undefined }}
99
+ {...rest}
100
+ >
101
+ <div className="min-h-0 data-[state=closed]:overflow-hidden" data-state={state}>
102
+ <div
103
+ role={variant === "error" ? "alert" : "status"}
104
+ aria-live={variant === "error" ? "assertive" : "polite"}
105
+ aria-hidden={!open}
106
+ inert={!open}
107
+ onMouseEnter={(e) => {
108
+ setPaused(true);
109
+ onMouseEnter?.(e);
110
+ }}
111
+ onMouseLeave={(e) => {
112
+ setPaused(false);
113
+ onMouseLeave?.(e);
114
+ }}
115
+ onFocus={(e) => {
116
+ setPaused(true);
117
+ onFocus?.(e);
118
+ }}
119
+ onBlur={(e) => {
120
+ setPaused(false);
121
+ onBlur?.(e);
122
+ }}
123
+ onKeyDown={(e) => {
124
+ if (e.key === "Escape") close();
125
+ onKeyDown?.(e);
126
+ }}
127
+ className="flex w-full items-center gap-md rounded-md border border-hairline bg-surface px-base py-md text-ink shadow-card transition-shadow duration-150 ease-out hover:shadow-md"
128
+ >
129
+ <span
130
+ className={[
131
+ "flex size-6 shrink-0 items-center justify-center rounded-full text-canvas",
132
+ glyph.tile,
133
+ ].join(" ")}
134
+ >
135
+ <Icon name={glyph.icon} size={glyph.size} strokeWidth={2.5} />
136
+ </span>
137
+
138
+ <div className="flex min-w-0 flex-1 flex-col gap-xxs">
139
+ <p className="text-body-md font-weight-body-sm text-ink">{title}</p>
140
+ {description ? (
141
+ <p className="text-body-sm text-muted">{description}</p>
142
+ ) : null}
143
+ </div>
144
+
145
+ {actionLabel ? (
146
+ <button
147
+ type="button"
148
+ disabled={actionDisabled}
149
+ onClick={onAction}
150
+ className={[
151
+ "shrink-0 rounded-sm px-sm py-xs text-body-md text-primary-text hover:bg-surface-strong",
152
+ pressable,
153
+ ].join(" ")}
154
+ >
155
+ {actionLabel}
156
+ </button>
157
+ ) : null}
158
+
159
+ <span aria-hidden="true" className="h-4 w-px shrink-0 bg-hairline" />
160
+
161
+ <button
162
+ type="button"
163
+ aria-label={dismissLabel}
164
+ onClick={close}
165
+ className={[
166
+ "flex size-7 shrink-0 items-center justify-center rounded-sm text-muted hover:bg-surface-strong hover:text-ink",
167
+ pressable,
168
+ ].join(" ")}
169
+ >
170
+ <Icon name="close" size={18} />
171
+ </button>
172
+ </div>
173
+ </div>
174
+ </div>
175
+ );
176
+ },
177
+ );
178
+ Toast.displayName = "Toast";
@@ -0,0 +1,2 @@
1
+ export { Toast } from "./Toast";
2
+ export type { ToastProps, ToastVariant } from "./Toast";