@designa8/vibedesign-v6 1.20.20 → 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.
- package/README.md +1 -1
- package/dist/fonts/plusjakartasans/PlusJakartaSans-Italic[wght].ttf +0 -0
- package/dist/fonts/plusjakartasans/PlusJakartaSans[wght].ttf +0 -0
- package/dist/index.cjs +12027 -4942
- package/dist/index.js +12089 -5004
- package/dist/styles.css +1393 -97
- package/package.json +116 -1
- package/src/atoms/AgentQuestionCard/AgentQuestionCard.tsx +567 -0
- package/src/atoms/AgentQuestionCard/index.ts +6 -0
- package/src/atoms/AgentQuestionCard/preview.tsx +199 -0
- package/src/atoms/AppLayout/AppLayout.tsx +85 -22
- package/src/atoms/AppLayout/preview.tsx +4 -0
- package/src/atoms/AppSidebar/AppSidebar.tsx +222 -137
- package/src/atoms/AppSidebar/preview.tsx +61 -8
- package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +241 -169
- package/src/atoms/AppSidebarMobile/preview.tsx +59 -89
- package/src/atoms/AuthLogin/AuthLogin.tsx +86 -49
- package/src/atoms/AuthLogin/preview.tsx +16 -0
- package/src/atoms/AuthSignUp/AuthSignUp.tsx +206 -126
- package/src/atoms/AuthSignUp/preview.tsx +10 -0
- package/src/atoms/BottomSheet/BottomSheet.tsx +199 -0
- package/src/atoms/BottomSheet/index.ts +2 -0
- package/src/atoms/BottomSheet/preview.tsx +50 -0
- package/src/atoms/Button/Button.tsx +19 -3
- package/src/atoms/Button/preview.tsx +2 -1
- package/src/atoms/ChatHistorySidebar/ChatHistorySidebar.tsx +160 -84
- package/src/atoms/ChatHistorySidebar/preview.tsx +81 -42
- package/src/atoms/ChatScreen/ChatScreen.tsx +298 -33
- package/src/atoms/ChatScreen/preview.tsx +54 -90
- package/src/atoms/Chip/Chip.tsx +81 -33
- package/src/atoms/Chip/preview.tsx +39 -21
- package/src/atoms/CodeEditor/CodeEditor.tsx +10 -4
- package/src/atoms/ComponentActionsSheet/ComponentActionsSheet.tsx +165 -0
- package/src/atoms/ComponentActionsSheet/index.ts +7 -0
- package/src/atoms/ComponentActionsSheet/preview.tsx +67 -0
- package/src/atoms/ComponentCard/ComponentCard.tsx +17 -35
- package/src/atoms/ComponentCard/preview.tsx +9 -9
- package/src/atoms/DesignSystemLoader/DesignSystemLoader.tsx +153 -0
- package/src/atoms/DesignSystemLoader/index.ts +2 -0
- package/src/atoms/DesignSystemLoader/preview.tsx +19 -0
- package/src/atoms/DesignSystemShowcase/DesignSystemShowcase.tsx +410 -0
- package/src/atoms/DesignSystemShowcase/index.ts +6 -0
- package/src/atoms/DesignSystemShowcase/preview.tsx +22 -0
- package/src/atoms/DesignTokensPanel/DesignTokensPanel.data.ts +254 -0
- package/src/atoms/DesignTokensPanel/DesignTokensPanel.tsx +946 -0
- package/src/atoms/DesignTokensPanel/index.ts +9 -0
- package/src/atoms/DesignTokensPanel/preview.tsx +39 -0
- package/src/atoms/ExpandableMessage/ExpandableMessage.tsx +239 -0
- package/src/atoms/ExpandableMessage/fix-link-note.txt +3 -0
- package/src/atoms/ExpandableMessage/index.ts +2 -0
- package/src/atoms/ExpandableMessage/markdown.tsx +310 -0
- package/src/atoms/ExpandableMessage/preview.tsx +83 -0
- package/src/atoms/FilterTabBar/FilterTabBar.tsx +2 -2
- package/src/atoms/FontCombobox/FontCombobox.tsx +655 -0
- package/src/atoms/FontCombobox/index.ts +6 -0
- package/src/atoms/FontCombobox/preview.tsx +111 -0
- package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +894 -96
- package/src/atoms/HomePageTemplate/preview.tsx +4 -0
- package/src/atoms/Icon/Icon.tsx +17 -11
- package/src/atoms/Icon/icons.data.ts +34 -0
- package/src/atoms/Input/Input.tsx +37 -21
- package/src/atoms/LandingHero/LandingHero.tsx +545 -0
- package/src/atoms/LandingHero/index.ts +6 -0
- package/src/atoms/LandingHero/preview.tsx +88 -0
- package/src/atoms/MarketingFooter/MarketingFooter.tsx +215 -0
- package/src/atoms/MarketingFooter/index.ts +7 -0
- package/src/atoms/MarketingFooter/preview.tsx +28 -0
- package/src/atoms/MarketingNavbar/MarketingNavbar.tsx +451 -0
- package/src/atoms/MarketingNavbar/index.ts +7 -0
- package/src/atoms/MarketingNavbar/preview.tsx +109 -0
- package/src/atoms/MobileActionsDrawer/MobileActionsDrawer.tsx +548 -0
- package/src/atoms/MobileActionsDrawer/index.ts +9 -0
- package/src/atoms/MobileActionsDrawer/preview.tsx +109 -0
- package/src/atoms/Modal/Modal.tsx +77 -28
- package/src/atoms/PreviewDock/PreviewDock.tsx +119 -0
- package/src/atoms/PreviewDock/index.ts +2 -0
- package/src/atoms/PreviewDock/preview.tsx +30 -0
- package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +47 -30
- package/src/atoms/PricingCard/PricingCard.tsx +15 -4
- package/src/atoms/PricingPageTemplate/PricingPageTemplate.tsx +109 -89
- package/src/atoms/ProjectSettingsModal/ProjectSettingsModal.tsx +314 -0
- package/src/atoms/ProjectSettingsModal/index.ts +2 -0
- package/src/atoms/ProjectSettingsModal/preview.tsx +130 -0
- package/src/atoms/ProjectSettingsModal/switch.snippet.txt +8 -0
- package/src/atoms/PromptInputBar/PromptInputBar.tsx +750 -302
- package/src/atoms/PromptInputBar/preview.tsx +64 -64
- package/src/atoms/SettingsPageTemplate/SettingsPageTemplate.tsx +272 -0
- package/src/atoms/SettingsPageTemplate/index.ts +2 -0
- package/src/atoms/SettingsPageTemplate/preview.tsx +29 -0
- package/src/atoms/SidebarUpgradeBanner/SidebarUpgradeBanner.tsx +178 -0
- package/src/atoms/SidebarUpgradeBanner/index.ts +2 -0
- package/src/atoms/SidebarUpgradeBanner/preview.tsx +47 -0
- package/src/atoms/SkeletonChip/SkeletonChip.tsx +198 -0
- package/src/atoms/SkeletonChip/index.ts +2 -0
- package/src/atoms/SkeletonChip/preview.tsx +44 -0
- package/src/atoms/TemplateHeader/TemplateHeader.tsx +129 -0
- package/src/atoms/TemplateHeader/index.ts +2 -0
- package/src/atoms/TemplateHeader/preview.tsx +39 -0
- package/src/atoms/TemplateHero/TemplateHero.tsx +286 -0
- package/src/atoms/TemplateHero/index.ts +2 -0
- package/src/atoms/TemplateHero/preview.tsx +32 -0
- package/src/atoms/TemplateSummary/TemplateSummary.tsx +85 -0
- package/src/atoms/TemplateSummary/index.ts +2 -0
- package/src/atoms/TemplateSummary/preview.tsx +10 -0
- package/src/atoms/Toast/Toast.tsx +178 -0
- package/src/atoms/Toast/index.ts +2 -0
- package/src/atoms/Toast/preview.tsx +100 -0
- package/src/atoms/TopNavbar/TopNavbar.tsx +145 -67
- package/src/atoms/TopNavbar/preview.tsx +13 -7
- package/src/atoms/TopupModal/TopupModal.tsx +94 -0
- package/src/atoms/TopupModal/index.ts +2 -0
- package/src/atoms/TopupModal/preview.tsx +22 -0
- package/src/atoms/UpgradeCard/UpgradeCard.tsx +124 -43
- package/src/atoms/UpgradeCard/index.ts +1 -1
- package/src/atoms/UpgradeCard/preview.tsx +7 -14
- package/src/atoms/UpgradeModal/UpgradeModal.tsx +192 -0
- package/src/atoms/UpgradeModal/index.ts +2 -0
- package/src/atoms/UpgradeModal/preview.tsx +41 -0
- package/src/index.ts +23 -0
- package/src/tokens.css +45 -7
- package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
- package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
import { Icon } from "../Icon";
|
|
4
|
+
import { PromptInputBar } from "../PromptInputBar";
|
|
5
|
+
import type { PromptInputBarProps } from "../PromptInputBar";
|
|
6
|
+
|
|
7
|
+
/** Inline gradient phrase for the hero headline (violet -> pink -> orange logo tokens). */
|
|
8
|
+
export const LandingHeroHighlight: React.FC<{ children: React.ReactNode }> = ({ children }) => (
|
|
9
|
+
<span className="bg-linear-to-r from-logo-violet via-logo-pink to-logo-orange bg-clip-text text-transparent">
|
|
10
|
+
{children}
|
|
11
|
+
</span>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export interface LandingHeroWorksWithItem {
|
|
15
|
+
label: string;
|
|
16
|
+
/** Optional logo image src; when omitted only the label (and optional icon) is shown. */
|
|
17
|
+
logoSrc?: string;
|
|
18
|
+
icon?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface LandingHeroProps
|
|
22
|
+
extends Omit<React.HTMLAttributes<HTMLElement>, "title" | "onChange"> {
|
|
23
|
+
eyebrow?: string;
|
|
24
|
+
title?: React.ReactNode;
|
|
25
|
+
subtitle?: string;
|
|
26
|
+
value?: string;
|
|
27
|
+
defaultValue?: string;
|
|
28
|
+
onChange?: (value: string) => void;
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
/** @deprecated No-op. The prompt bar owns its own hints. */
|
|
31
|
+
shortcutHint?: string;
|
|
32
|
+
/** @deprecated No-op. The prompt bar renders an icon send button. */
|
|
33
|
+
generateLabel?: string;
|
|
34
|
+
/** Called with the trimmed prompt when the prompt bar's send button (or Enter) fires. */
|
|
35
|
+
onGenerate?: (value: string) => void;
|
|
36
|
+
/** Disables the prompt bar while a generation is running. */
|
|
37
|
+
generating?: boolean;
|
|
38
|
+
onMic?: () => void;
|
|
39
|
+
recording?: boolean;
|
|
40
|
+
suggestions?: string[];
|
|
41
|
+
onSuggestionClick?: (suggestion: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Layout for the suggestion chips. "wrap" (default) is the existing chip row inside
|
|
44
|
+
* the content column. "marquee" renders a full-bleed strip of two stacked rows that
|
|
45
|
+
* auto-crawl in opposite directions at a constant 32px/s (requestAnimationFrame),
|
|
46
|
+
* pause while the pointer is over the strip, scrub on pointer-drag or wheel, and
|
|
47
|
+
* do not auto-scroll under prefers-reduced-motion.
|
|
48
|
+
*/
|
|
49
|
+
suggestionsVariant?: "wrap" | "marquee";
|
|
50
|
+
referenceLinkLabel?: string;
|
|
51
|
+
onReferenceClick?: () => void;
|
|
52
|
+
footnote?: string;
|
|
53
|
+
error?: string;
|
|
54
|
+
/** Right-hand visual slot (e.g. a product showcase). */
|
|
55
|
+
visual?: React.ReactNode;
|
|
56
|
+
/** Optional decorative background image (soft glow). */
|
|
57
|
+
backgroundSrc?: string;
|
|
58
|
+
scrollHint?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Where the scroll hint sits. "inline" (default) places it directly under the content.
|
|
61
|
+
* "bottom" turns the section into a flex column: the content grid grows and stays
|
|
62
|
+
* vertically centred, and the hint is pinned to the bottom edge (above the worksWith strip).
|
|
63
|
+
* Pair with a consumer min-height via className (e.g. lg:min-h-[calc(100dvh-6rem)]).
|
|
64
|
+
*/
|
|
65
|
+
scrollHintPlacement?: "inline" | "bottom";
|
|
66
|
+
worksWithLabel?: string;
|
|
67
|
+
worksWith?: LandingHeroWorksWithItem[];
|
|
68
|
+
/**
|
|
69
|
+
* Passthrough to the underlying PromptInputBar, spread last so it can override
|
|
70
|
+
* anything (recordingError, audioLevels, onRecordingConfirm, onRecordingCancel,
|
|
71
|
+
* models, selectedModelId, onModelChange, suggestDesigns, onSuggestDesignsChange,
|
|
72
|
+
* onFilesSelected, pastedImages, onImagesChange, ...).
|
|
73
|
+
*/
|
|
74
|
+
promptBarProps?: Partial<PromptInputBarProps>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const gridMaskStyle: React.CSSProperties = {
|
|
78
|
+
backgroundImage: "radial-gradient(var(--color-hairline) 1px, transparent 1px)",
|
|
79
|
+
backgroundSize: "24px 24px",
|
|
80
|
+
maskImage: "linear-gradient(to bottom, black, transparent 85%)",
|
|
81
|
+
WebkitMaskImage: "linear-gradient(to bottom, black, transparent 85%)",
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/* ─── Reduced motion hook ────────────────────────────────────────────────── */
|
|
85
|
+
function usePrefersReducedMotion(): boolean {
|
|
86
|
+
const [reduced, setReduced] = React.useState(false);
|
|
87
|
+
React.useEffect(() => {
|
|
88
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
89
|
+
const mql = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
90
|
+
setReduced(mql.matches);
|
|
91
|
+
const handler = (e: MediaQueryListEvent) => setReduced(e.matches);
|
|
92
|
+
mql.addEventListener?.("change", handler);
|
|
93
|
+
return () => mql.removeEventListener?.("change", handler);
|
|
94
|
+
}, []);
|
|
95
|
+
return reduced;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* ─── Drag/crawl marquee — two opposite-crawling rows ────────────────────
|
|
99
|
+
* Constant-speed JS translateX loop (rAF), not a CSS keyframe. Row 1 crawls
|
|
100
|
+
* left, row 2 crawls right. Hovering pauses; dragging scrubs both rows in
|
|
101
|
+
* opposite directions; a drag under 6px is a chip click; wheel/trackpad is
|
|
102
|
+
* prevented and applied as the same scrub.
|
|
103
|
+
* ────────────────────────────────────────────────────────────────────── */
|
|
104
|
+
const MARQUEE_PX_PER_SECOND = 32;
|
|
105
|
+
const MARQUEE_DRAG_THRESHOLD = 6;
|
|
106
|
+
|
|
107
|
+
/** Split a flat list into two roughly-equal, interleaved rows. */
|
|
108
|
+
function splitInterleaved(items: string[]): [string[], string[]] {
|
|
109
|
+
const rowA: string[] = [];
|
|
110
|
+
const rowB: string[] = [];
|
|
111
|
+
items.forEach((item, i) => {
|
|
112
|
+
(i % 2 === 0 ? rowA : rowB).push(item);
|
|
113
|
+
});
|
|
114
|
+
return [rowA, rowB];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface SuggestionMarqueeProps {
|
|
118
|
+
suggestions: string[];
|
|
119
|
+
onChipClick: (label: string) => void;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Full-bleed strip of two interleaved chip rows that auto-crawl in opposite
|
|
124
|
+
* directions. Pauses on hover, scrubs on drag / wheel, honours reduced motion.
|
|
125
|
+
*/
|
|
126
|
+
export const SuggestionMarquee: React.FC<SuggestionMarqueeProps> = ({ suggestions, onChipClick }) => {
|
|
127
|
+
const reducedMotion = usePrefersReducedMotion();
|
|
128
|
+
const [rowA, rowB] = React.useMemo(() => splitInterleaved(suggestions), [suggestions]);
|
|
129
|
+
|
|
130
|
+
const containerRef = React.useRef<HTMLDivElement | null>(null);
|
|
131
|
+
const track1Ref = React.useRef<HTMLDivElement | null>(null);
|
|
132
|
+
const track2Ref = React.useRef<HTMLDivElement | null>(null);
|
|
133
|
+
const offset1Ref = React.useRef(0);
|
|
134
|
+
const offset2Ref = React.useRef(0);
|
|
135
|
+
const half1Ref = React.useRef(0);
|
|
136
|
+
const half2Ref = React.useRef(0);
|
|
137
|
+
|
|
138
|
+
const draggingRef = React.useRef(false);
|
|
139
|
+
const dragStartXRef = React.useRef(0);
|
|
140
|
+
const dragStartOffset1Ref = React.useRef(0);
|
|
141
|
+
const dragStartOffset2Ref = React.useRef(0);
|
|
142
|
+
const draggedRef = React.useRef(false);
|
|
143
|
+
const gestureHandledRef = React.useRef(false);
|
|
144
|
+
|
|
145
|
+
const rafRef = React.useRef<number | null>(null);
|
|
146
|
+
const lastTsRef = React.useRef<number | null>(null);
|
|
147
|
+
const pausedRef = React.useRef(false);
|
|
148
|
+
|
|
149
|
+
const applyTransforms = React.useCallback(() => {
|
|
150
|
+
if (track1Ref.current) track1Ref.current.style.transform = `translateX(${offset1Ref.current}px)`;
|
|
151
|
+
if (track2Ref.current) track2Ref.current.style.transform = `translateX(${offset2Ref.current}px)`;
|
|
152
|
+
}, []);
|
|
153
|
+
|
|
154
|
+
const normalize = React.useCallback((offsetRef: React.MutableRefObject<number>, half: number) => {
|
|
155
|
+
if (half <= 0) return;
|
|
156
|
+
while (offsetRef.current <= -half) offsetRef.current += half;
|
|
157
|
+
while (offsetRef.current > 0) offsetRef.current -= half;
|
|
158
|
+
}, []);
|
|
159
|
+
|
|
160
|
+
React.useEffect(() => {
|
|
161
|
+
if (track1Ref.current) half1Ref.current = track1Ref.current.scrollWidth / 2;
|
|
162
|
+
if (track2Ref.current) half2Ref.current = track2Ref.current.scrollWidth / 2;
|
|
163
|
+
}, [rowA, rowB]);
|
|
164
|
+
|
|
165
|
+
React.useEffect(() => {
|
|
166
|
+
if (reducedMotion) return;
|
|
167
|
+
|
|
168
|
+
const step = (ts: number) => {
|
|
169
|
+
if (lastTsRef.current === null) lastTsRef.current = ts;
|
|
170
|
+
const dt = (ts - lastTsRef.current) / 1000;
|
|
171
|
+
lastTsRef.current = ts;
|
|
172
|
+
|
|
173
|
+
if (!pausedRef.current && !draggingRef.current) {
|
|
174
|
+
offset1Ref.current -= MARQUEE_PX_PER_SECOND * dt;
|
|
175
|
+
offset2Ref.current += MARQUEE_PX_PER_SECOND * dt;
|
|
176
|
+
normalize(offset1Ref, half1Ref.current);
|
|
177
|
+
normalize(offset2Ref, half2Ref.current);
|
|
178
|
+
applyTransforms();
|
|
179
|
+
}
|
|
180
|
+
rafRef.current = requestAnimationFrame(step);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
rafRef.current = requestAnimationFrame(step);
|
|
184
|
+
return () => {
|
|
185
|
+
if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);
|
|
186
|
+
rafRef.current = null;
|
|
187
|
+
lastTsRef.current = null;
|
|
188
|
+
};
|
|
189
|
+
}, [reducedMotion, applyTransforms, normalize]);
|
|
190
|
+
|
|
191
|
+
const scrubBy = React.useCallback(
|
|
192
|
+
(delta: number) => {
|
|
193
|
+
offset1Ref.current += delta;
|
|
194
|
+
offset2Ref.current -= delta;
|
|
195
|
+
normalize(offset1Ref, half1Ref.current);
|
|
196
|
+
normalize(offset2Ref, half2Ref.current);
|
|
197
|
+
applyTransforms();
|
|
198
|
+
},
|
|
199
|
+
[applyTransforms, normalize],
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
// Wheel/trackpad: native non-passive listener so preventDefault actually stops page scroll.
|
|
203
|
+
React.useEffect(() => {
|
|
204
|
+
const el = containerRef.current;
|
|
205
|
+
if (!el) return;
|
|
206
|
+
const onWheel = (e: WheelEvent) => {
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
const delta = e.deltaX + e.deltaY;
|
|
209
|
+
if (delta === 0) return;
|
|
210
|
+
scrubBy(-delta);
|
|
211
|
+
};
|
|
212
|
+
el.addEventListener("wheel", onWheel, { passive: false });
|
|
213
|
+
return () => el.removeEventListener("wheel", onWheel);
|
|
214
|
+
}, [scrubBy]);
|
|
215
|
+
|
|
216
|
+
// Guards a single gesture against firing onChipClick twice.
|
|
217
|
+
const fireChipOnce = React.useCallback(
|
|
218
|
+
(label: string) => {
|
|
219
|
+
if (gestureHandledRef.current) return;
|
|
220
|
+
gestureHandledRef.current = true;
|
|
221
|
+
onChipClick(label);
|
|
222
|
+
},
|
|
223
|
+
[onChipClick],
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
// Pointer capture retargets e.target to the strip, so fall back to a geometric hit-test.
|
|
227
|
+
const resolveChipLabel = React.useCallback(
|
|
228
|
+
(e: React.PointerEvent<HTMLDivElement>): string | undefined => {
|
|
229
|
+
const target = e.target as HTMLElement | null;
|
|
230
|
+
const fromTarget = target?.closest<HTMLElement>("[data-suggestion-label]");
|
|
231
|
+
if (fromTarget) return fromTarget.dataset.suggestionLabel;
|
|
232
|
+
const atPoint = document.elementFromPoint(e.clientX, e.clientY) as HTMLElement | null;
|
|
233
|
+
return atPoint?.closest<HTMLElement>("[data-suggestion-label]")?.dataset.suggestionLabel;
|
|
234
|
+
},
|
|
235
|
+
[],
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
const handlePointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
239
|
+
draggingRef.current = true;
|
|
240
|
+
draggedRef.current = false;
|
|
241
|
+
gestureHandledRef.current = false;
|
|
242
|
+
dragStartXRef.current = e.clientX;
|
|
243
|
+
dragStartOffset1Ref.current = offset1Ref.current;
|
|
244
|
+
dragStartOffset2Ref.current = offset2Ref.current;
|
|
245
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const handlePointerMove = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
249
|
+
if (!draggingRef.current) return;
|
|
250
|
+
const delta = e.clientX - dragStartXRef.current;
|
|
251
|
+
if (Math.abs(delta) > MARQUEE_DRAG_THRESHOLD) draggedRef.current = true;
|
|
252
|
+
offset1Ref.current = dragStartOffset1Ref.current + delta;
|
|
253
|
+
offset2Ref.current = dragStartOffset2Ref.current - delta;
|
|
254
|
+
normalize(offset1Ref, half1Ref.current);
|
|
255
|
+
normalize(offset2Ref, half2Ref.current);
|
|
256
|
+
applyTransforms();
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
const releaseCapture = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
260
|
+
try {
|
|
261
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
262
|
+
} catch {
|
|
263
|
+
/* no-op */
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
const endDrag = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
268
|
+
if (!draggingRef.current) return;
|
|
269
|
+
draggingRef.current = false;
|
|
270
|
+
releaseCapture(e);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const handlePointerUp = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
274
|
+
const wasDragging = draggingRef.current;
|
|
275
|
+
draggingRef.current = false;
|
|
276
|
+
releaseCapture(e);
|
|
277
|
+
if (!wasDragging) return;
|
|
278
|
+
|
|
279
|
+
if (draggedRef.current) {
|
|
280
|
+
draggedRef.current = false;
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const label = resolveChipLabel(e);
|
|
285
|
+
if (label) fireChipOnce(label);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const renderRow = (items: string[], trackRef: React.RefObject<HTMLDivElement | null>) => (
|
|
289
|
+
<div
|
|
290
|
+
ref={trackRef}
|
|
291
|
+
className="flex w-max gap-sm px-md will-change-transform"
|
|
292
|
+
style={{ touchAction: "none" }}
|
|
293
|
+
>
|
|
294
|
+
{[...items, ...items].map((s, i) => (
|
|
295
|
+
<div key={`${s}-${i}`} role="listitem" data-suggestion-label={s}>
|
|
296
|
+
<Button
|
|
297
|
+
type="button"
|
|
298
|
+
variant="secondary"
|
|
299
|
+
size="sm"
|
|
300
|
+
onClick={() => fireChipOnce(s)}
|
|
301
|
+
className="!rounded-xl whitespace-nowrap"
|
|
302
|
+
>
|
|
303
|
+
{s}
|
|
304
|
+
</Button>
|
|
305
|
+
</div>
|
|
306
|
+
))}
|
|
307
|
+
</div>
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
return (
|
|
311
|
+
<div
|
|
312
|
+
ref={containerRef}
|
|
313
|
+
className="relative flex w-full cursor-grab select-none flex-col gap-sm overflow-hidden active:cursor-grabbing"
|
|
314
|
+
style={{
|
|
315
|
+
maskImage: "linear-gradient(to right, transparent, black 10%, black 90%, transparent)",
|
|
316
|
+
WebkitMaskImage:
|
|
317
|
+
"linear-gradient(to right, transparent, black 10%, black 90%, transparent)",
|
|
318
|
+
}}
|
|
319
|
+
role="list"
|
|
320
|
+
aria-label="Suggested prompts"
|
|
321
|
+
onPointerEnter={() => {
|
|
322
|
+
pausedRef.current = true;
|
|
323
|
+
}}
|
|
324
|
+
onPointerLeave={() => {
|
|
325
|
+
pausedRef.current = false;
|
|
326
|
+
}}
|
|
327
|
+
onPointerDown={handlePointerDown}
|
|
328
|
+
onPointerMove={handlePointerMove}
|
|
329
|
+
onPointerUp={handlePointerUp}
|
|
330
|
+
onPointerCancel={endDrag}
|
|
331
|
+
onFocus={() => {
|
|
332
|
+
pausedRef.current = true;
|
|
333
|
+
}}
|
|
334
|
+
onBlur={() => {
|
|
335
|
+
pausedRef.current = false;
|
|
336
|
+
}}
|
|
337
|
+
>
|
|
338
|
+
{renderRow(rowA, track1Ref)}
|
|
339
|
+
{renderRow(rowB, track2Ref)}
|
|
340
|
+
</div>
|
|
341
|
+
);
|
|
342
|
+
};
|
|
343
|
+
SuggestionMarquee.displayName = "SuggestionMarquee";
|
|
344
|
+
|
|
345
|
+
export const LandingHero = React.forwardRef<HTMLElement, LandingHeroProps>(
|
|
346
|
+
(
|
|
347
|
+
{
|
|
348
|
+
eyebrow = "AI-native design system builder",
|
|
349
|
+
title = (
|
|
350
|
+
<>
|
|
351
|
+
Describe your brand.
|
|
352
|
+
<br />
|
|
353
|
+
Get a <LandingHeroHighlight>design system</LandingHeroHighlight>
|
|
354
|
+
<br />
|
|
355
|
+
you can ship.
|
|
356
|
+
</>
|
|
357
|
+
),
|
|
358
|
+
subtitle = "Design it by chatting. Hand it to your code or your coding agent.",
|
|
359
|
+
value: valueProp,
|
|
360
|
+
defaultValue = "",
|
|
361
|
+
onChange,
|
|
362
|
+
placeholder = "Describe your brand, e.g. a calm fintech brand with warm neutrals...",
|
|
363
|
+
shortcutHint: _shortcutHint,
|
|
364
|
+
generateLabel: _generateLabel,
|
|
365
|
+
onGenerate,
|
|
366
|
+
generating = false,
|
|
367
|
+
onMic,
|
|
368
|
+
recording,
|
|
369
|
+
suggestions = [],
|
|
370
|
+
onSuggestionClick,
|
|
371
|
+
suggestionsVariant = "wrap",
|
|
372
|
+
referenceLinkLabel,
|
|
373
|
+
onReferenceClick,
|
|
374
|
+
footnote,
|
|
375
|
+
error,
|
|
376
|
+
visual,
|
|
377
|
+
backgroundSrc,
|
|
378
|
+
scrollHint = "Scroll to explore",
|
|
379
|
+
scrollHintPlacement = "inline",
|
|
380
|
+
worksWithLabel = "Works with",
|
|
381
|
+
worksWith = [],
|
|
382
|
+
promptBarProps,
|
|
383
|
+
className = "",
|
|
384
|
+
...rest
|
|
385
|
+
},
|
|
386
|
+
ref,
|
|
387
|
+
) => {
|
|
388
|
+
const [inner, setInner] = React.useState(defaultValue);
|
|
389
|
+
const value = valueProp ?? inner;
|
|
390
|
+
const pinned = scrollHintPlacement === "bottom";
|
|
391
|
+
|
|
392
|
+
const setValue = (next: string) => {
|
|
393
|
+
if (valueProp === undefined) setInner(next);
|
|
394
|
+
onChange?.(next);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
const submit = (text: string) => {
|
|
398
|
+
const trimmed = text.trim();
|
|
399
|
+
if (!trimmed || generating) return;
|
|
400
|
+
onGenerate?.(trimmed);
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
const handleSuggestion = (s: string) => {
|
|
404
|
+
setValue(s);
|
|
405
|
+
onSuggestionClick?.(s);
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
return (
|
|
409
|
+
<section
|
|
410
|
+
ref={ref}
|
|
411
|
+
className={`relative isolate w-full overflow-hidden bg-canvas ${pinned ? "flex flex-col" : ""} ${className}`}
|
|
412
|
+
{...rest}
|
|
413
|
+
>
|
|
414
|
+
{/* dotted grid fading downward */}
|
|
415
|
+
<div
|
|
416
|
+
aria-hidden="true"
|
|
417
|
+
className="pointer-events-none absolute inset-0 -z-10 opacity-60"
|
|
418
|
+
style={gridMaskStyle}
|
|
419
|
+
/>
|
|
420
|
+
{backgroundSrc && (
|
|
421
|
+
<img
|
|
422
|
+
src={backgroundSrc}
|
|
423
|
+
alt=""
|
|
424
|
+
aria-hidden="true"
|
|
425
|
+
className="pointer-events-none absolute inset-0 -z-10 h-full w-full object-cover opacity-80"
|
|
426
|
+
/>
|
|
427
|
+
)}
|
|
428
|
+
|
|
429
|
+
<div
|
|
430
|
+
className={`mx-auto grid w-full max-w-7xl items-center gap-xxl px-lg pb-xl pt-xxl lg:grid-cols-[1.1fr_1fr] lg:gap-xl xl:gap-xxl ${pinned ? "flex-1 content-center" : ""}`}
|
|
431
|
+
>
|
|
432
|
+
<div className="flex min-w-0 flex-col items-start gap-lg">
|
|
433
|
+
{eyebrow && (
|
|
434
|
+
<span className="inline-flex items-center gap-xs rounded-full bg-primary-soft px-md py-xs text-caption font-weight-body-md text-primary">
|
|
435
|
+
<Icon name="sparkle" size={12} />
|
|
436
|
+
{eyebrow}
|
|
437
|
+
</span>
|
|
438
|
+
)}
|
|
439
|
+
|
|
440
|
+
<h1 className="text-heading-lg text-ink sm:text-display-lg xl:text-display-xl">
|
|
441
|
+
{title}
|
|
442
|
+
</h1>
|
|
443
|
+
|
|
444
|
+
{subtitle && <p className="text-body-lg text-muted">{subtitle}</p>}
|
|
445
|
+
|
|
446
|
+
<PromptInputBar
|
|
447
|
+
showModeSelector={false}
|
|
448
|
+
value={value}
|
|
449
|
+
onChange={setValue}
|
|
450
|
+
placeholder={placeholder}
|
|
451
|
+
onSend={(text) => submit(text)}
|
|
452
|
+
onMic={onMic}
|
|
453
|
+
recording={recording}
|
|
454
|
+
disabled={generating}
|
|
455
|
+
{...promptBarProps}
|
|
456
|
+
/>
|
|
457
|
+
|
|
458
|
+
{error && (
|
|
459
|
+
<p role="alert" className="text-body-sm text-semantic-error">
|
|
460
|
+
{error}
|
|
461
|
+
</p>
|
|
462
|
+
)}
|
|
463
|
+
|
|
464
|
+
{suggestionsVariant === "wrap" && suggestions.length > 0 && (
|
|
465
|
+
<div className="flex flex-wrap gap-sm lg:gap-xs xl:gap-sm">
|
|
466
|
+
{suggestions.map((s) => (
|
|
467
|
+
<button
|
|
468
|
+
key={s}
|
|
469
|
+
type="button"
|
|
470
|
+
onClick={() => handleSuggestion(s)}
|
|
471
|
+
className="cursor-pointer whitespace-nowrap rounded-md border border-hairline bg-canvas px-md py-xs text-caption text-body transition duration-150 ease-out hover:border-primary hover:text-primary active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue lg:px-sm xl:px-md"
|
|
472
|
+
>
|
|
473
|
+
{s}
|
|
474
|
+
</button>
|
|
475
|
+
))}
|
|
476
|
+
</div>
|
|
477
|
+
)}
|
|
478
|
+
|
|
479
|
+
{referenceLinkLabel && (
|
|
480
|
+
<button
|
|
481
|
+
type="button"
|
|
482
|
+
onClick={onReferenceClick}
|
|
483
|
+
className="cursor-pointer rounded-xs text-body-sm font-weight-body-md text-primary underline underline-offset-4 transition duration-150 ease-out hover:text-primary-hover active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue"
|
|
484
|
+
>
|
|
485
|
+
{referenceLinkLabel}
|
|
486
|
+
</button>
|
|
487
|
+
)}
|
|
488
|
+
|
|
489
|
+
{footnote && (
|
|
490
|
+
<p className="flex items-center gap-sm text-caption text-muted">
|
|
491
|
+
<span className="flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary-soft text-primary">
|
|
492
|
+
<Icon name="check-checkmark" size={12} />
|
|
493
|
+
</span>
|
|
494
|
+
{footnote}
|
|
495
|
+
</p>
|
|
496
|
+
)}
|
|
497
|
+
</div>
|
|
498
|
+
|
|
499
|
+
{visual && <div className="relative min-w-0">{visual}</div>}
|
|
500
|
+
</div>
|
|
501
|
+
|
|
502
|
+
{/* Marquee: full-bleed, outside the max-w-7xl column, under the prompt stack */}
|
|
503
|
+
{suggestionsVariant === "marquee" && suggestions.length > 0 && (
|
|
504
|
+
<div className="w-full pb-lg">
|
|
505
|
+
<SuggestionMarquee suggestions={suggestions} onChipClick={handleSuggestion} />
|
|
506
|
+
</div>
|
|
507
|
+
)}
|
|
508
|
+
|
|
509
|
+
{scrollHint && (
|
|
510
|
+
<div
|
|
511
|
+
className={`flex flex-col items-center gap-xs pb-lg text-caption text-muted-soft ${pinned ? "mt-auto self-center" : ""}`}
|
|
512
|
+
>
|
|
513
|
+
<span
|
|
514
|
+
aria-hidden="true"
|
|
515
|
+
className="flex h-8 w-5 justify-center rounded-full border border-hairline-strong pt-xs"
|
|
516
|
+
>
|
|
517
|
+
<span className="h-2 w-0.5 animate-bounce rounded-full bg-muted-soft" />
|
|
518
|
+
</span>
|
|
519
|
+
{scrollHint}
|
|
520
|
+
</div>
|
|
521
|
+
)}
|
|
522
|
+
|
|
523
|
+
{worksWith.length > 0 && (
|
|
524
|
+
<div className="flex flex-wrap items-center justify-center gap-lg border-t border-hairline-soft px-lg py-lg text-body-sm text-muted">
|
|
525
|
+
<span className="text-caption">{worksWithLabel}</span>
|
|
526
|
+
{worksWith.map((w, i) => (
|
|
527
|
+
<React.Fragment key={w.label}>
|
|
528
|
+
{i > 0 && <span className="h-4 w-px bg-hairline" aria-hidden="true" />}
|
|
529
|
+
<span className="inline-flex items-center gap-xs text-body-sm text-body">
|
|
530
|
+
{w.logoSrc ? (
|
|
531
|
+
<img src={w.logoSrc} alt="" className="h-5 w-5 object-contain" />
|
|
532
|
+
) : (
|
|
533
|
+
w.icon
|
|
534
|
+
)}
|
|
535
|
+
{w.label}
|
|
536
|
+
</span>
|
|
537
|
+
</React.Fragment>
|
|
538
|
+
))}
|
|
539
|
+
</div>
|
|
540
|
+
)}
|
|
541
|
+
</section>
|
|
542
|
+
);
|
|
543
|
+
},
|
|
544
|
+
);
|
|
545
|
+
LandingHero.displayName = "LandingHero";
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { LandingHero, SuggestionMarquee } from "./LandingHero";
|
|
3
|
+
import { Icon } from "../Icon";
|
|
4
|
+
|
|
5
|
+
const CATALOG = [
|
|
6
|
+
"Button", "Input", "Checkbox", "Radio", "Switch", "Badge", "Avatar", "Chip",
|
|
7
|
+
"Tooltip", "Tabs", "Accordion", "Select", "Combobox", "Date picker", "Pagination",
|
|
8
|
+
"Breadcrumbs", "Toast", "Modal", "Drawer", "Navbar", "Sidebar", "Pricing card",
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export default function Preview() {
|
|
12
|
+
const [value, setValue] = React.useState("");
|
|
13
|
+
const [marqueeValue, setMarqueeValue] = React.useState("");
|
|
14
|
+
const [standalonePick, setStandalonePick] = React.useState("");
|
|
15
|
+
const [recording, setRecording] = React.useState(false);
|
|
16
|
+
const [generating, setGenerating] = React.useState(false);
|
|
17
|
+
|
|
18
|
+
const generate = () => {
|
|
19
|
+
setGenerating(true);
|
|
20
|
+
window.setTimeout(() => setGenerating(false), 1800);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="w-full max-w-6xl mx-auto p-lg space-y-xl">
|
|
25
|
+
<div className="space-y-sm">
|
|
26
|
+
<p className="text-caption text-muted">scrollHintPlacement="inline" (default), suggestionsVariant="wrap"</p>
|
|
27
|
+
<LandingHero
|
|
28
|
+
value={value}
|
|
29
|
+
onChange={setValue}
|
|
30
|
+
onGenerate={generate}
|
|
31
|
+
generating={generating}
|
|
32
|
+
onMic={() => setRecording((r) => !r)}
|
|
33
|
+
recording={recording}
|
|
34
|
+
suggestions={["Calm fintech with warm neutrals", "Playful kids learning app", "Bold editorial magazine"]}
|
|
35
|
+
referenceLinkLabel="Or start from a reference brand ->"
|
|
36
|
+
onReferenceClick={() => undefined}
|
|
37
|
+
footnote="No credit card required. Export tokens anytime."
|
|
38
|
+
worksWith={[
|
|
39
|
+
{ label: "React", icon: <Icon name="sparkle" size={16} /> },
|
|
40
|
+
{ label: "Tailwind", icon: <Icon name="sparkle" size={16} /> },
|
|
41
|
+
{ label: "Coding agents", icon: <Icon name="sparkle" size={16} /> },
|
|
42
|
+
]}
|
|
43
|
+
visual={
|
|
44
|
+
<div className="flex w-full items-center justify-center rounded-xl border border-hairline bg-surface py-section text-body-sm text-muted">
|
|
45
|
+
Visual slot
|
|
46
|
+
</div>
|
|
47
|
+
}
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div className="space-y-sm">
|
|
52
|
+
<p className="text-caption text-muted">
|
|
53
|
+
suggestionsVariant="marquee" — two rows crawl in opposite directions; hover pauses, drag or wheel scrubs, click fills the prompt
|
|
54
|
+
</p>
|
|
55
|
+
<LandingHero
|
|
56
|
+
value={marqueeValue}
|
|
57
|
+
onChange={setMarqueeValue}
|
|
58
|
+
suggestions={CATALOG}
|
|
59
|
+
suggestionsVariant="marquee"
|
|
60
|
+
className="border border-hairline rounded-lg"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div className="space-y-sm">
|
|
65
|
+
<p className="text-caption text-muted">
|
|
66
|
+
SuggestionMarquee on its own — last clicked: {standalonePick || "none"}
|
|
67
|
+
</p>
|
|
68
|
+
<div className="w-full rounded-lg border border-hairline bg-canvas py-lg">
|
|
69
|
+
<SuggestionMarquee suggestions={CATALOG} onChipClick={setStandalonePick} />
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div className="space-y-sm">
|
|
74
|
+
<p className="text-caption text-muted">
|
|
75
|
+
scrollHintPlacement="bottom" — hint pinned to the bottom edge of a min-height frame
|
|
76
|
+
</p>
|
|
77
|
+
<LandingHero
|
|
78
|
+
scrollHintPlacement="bottom"
|
|
79
|
+
className="min-h-[720px] border border-hairline rounded-lg"
|
|
80
|
+
worksWith={[
|
|
81
|
+
{ label: "React", icon: <Icon name="sparkle" size={16} /> },
|
|
82
|
+
{ label: "Tailwind", icon: <Icon name="sparkle" size={16} /> },
|
|
83
|
+
]}
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|