@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.
- 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/BillingToggle/BillingToggle.tsx +2 -2
- 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,47 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { SidebarUpgradeBanner } from "./SidebarUpgradeBanner";
|
|
3
|
+
|
|
4
|
+
export default function SidebarUpgradeBannerPreview() {
|
|
5
|
+
const [upgradeCount, setUpgradeCount] = useState(0);
|
|
6
|
+
const [compactCount, setCompactCount] = useState(0);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
|
|
10
|
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-lg">
|
|
11
|
+
<div>
|
|
12
|
+
<SidebarUpgradeBanner onUpgrade={() => setUpgradeCount((c) => c + 1)} />
|
|
13
|
+
<p className="text-body-sm text-muted mt-sm">
|
|
14
|
+
Upgrade clicked {upgradeCount} time{upgradeCount === 1 ? "" : "s"}.
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div>
|
|
19
|
+
<SidebarUpgradeBanner
|
|
20
|
+
title="Unlock team seats"
|
|
21
|
+
description="Invite teammates and manage roles with priority support."
|
|
22
|
+
ctaLabel="See plans"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div className="w-full">
|
|
28
|
+
<p className="text-caption text-muted mb-xs">
|
|
29
|
+
Compact — sidebar footer variant (narrow sidebar width shown, ~256px card below)
|
|
30
|
+
</p>
|
|
31
|
+
<div className="flex">
|
|
32
|
+
<div className="w-64">
|
|
33
|
+
<SidebarUpgradeBanner
|
|
34
|
+
size="compact"
|
|
35
|
+
title="Upgrade your plan"
|
|
36
|
+
description="Get more out of your apps"
|
|
37
|
+
onUpgrade={() => setCompactCount((c) => c + 1)}
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<p className="text-body-sm text-muted mt-sm">
|
|
42
|
+
Clicked {compactCount} time{compactCount === 1 ? "" : "s"}.
|
|
43
|
+
</p>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export interface SkeletonChipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/**
|
|
5
|
+
* "row" (default) renders icon + label-bar placeholders stacked
|
|
6
|
+
* vertically, sized and spaced to match a NavItem row exactly — a
|
|
7
|
+
* stand-in for a loading nav/menu row. "chip" renders stacked pill bars
|
|
8
|
+
* only — a stand-in for a loading filter-chip/tag row. "block" renders
|
|
9
|
+
* solid rounded rectangles — a stand-in for a card thumbnail or a
|
|
10
|
+
* color-swatch bar, depending on `orientation`.
|
|
11
|
+
*/
|
|
12
|
+
shape?: "row" | "chip" | "block";
|
|
13
|
+
/** Number of stacked placeholder instances to render. Defaults to 3. */
|
|
14
|
+
count?: number;
|
|
15
|
+
/**
|
|
16
|
+
* "row" shape only. When true, renders just the icon placeholder
|
|
17
|
+
* (centered, no label bar) — a stand-in for a collapsed/icon-only nav
|
|
18
|
+
* rail where labels are hidden. Ignored for shape="chip" and shape="block".
|
|
19
|
+
*/
|
|
20
|
+
iconOnly?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* When false, renders the static (no shimmer sweep) reduced-motion look
|
|
23
|
+
* regardless of the OS setting — handy for previewing/testing that state.
|
|
24
|
+
* Defaults to true; the shimmer sweep is also automatically disabled when
|
|
25
|
+
* the user's OS has `prefers-reduced-motion: reduce` set.
|
|
26
|
+
*/
|
|
27
|
+
animated?: boolean;
|
|
28
|
+
/** Accessible label announced once for the whole loading region. */
|
|
29
|
+
label?: string;
|
|
30
|
+
/**
|
|
31
|
+
* When true, the root only takes `w-full` — no centered max-width — so the
|
|
32
|
+
* skeleton can fill any region of a loading page (a full-bleed panel, a
|
|
33
|
+
* sidebar, a grid cell). When false (default), the root keeps its
|
|
34
|
+
* original centered `max-w-3xl` column.
|
|
35
|
+
*/
|
|
36
|
+
fullWidth?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* "vertical" (default) stacks placeholders in a column, as today.
|
|
39
|
+
* "horizontal" lays them out in a stretched row (`flex-row items-stretch
|
|
40
|
+
* w-full`) — used for a color-swatch bar or a horizontal card rail.
|
|
41
|
+
*/
|
|
42
|
+
orientation?: "vertical" | "horizontal";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const ROW_WIDTHS = ["w-3/4", "w-3/5", "w-1/2", "w-2/3"];
|
|
46
|
+
const CHIP_WIDTHS = ["w-40", "w-28", "w-36", "w-24"];
|
|
47
|
+
|
|
48
|
+
// Every placeholder block shares this diagonal sweep: idle base fill, with a
|
|
49
|
+
// lighter diagonal band crossing left-to-right on a loop. Each block is
|
|
50
|
+
// given its own animation-delay (80ms stagger) so a stack never flashes in
|
|
51
|
+
// lockstep. prefers-reduced-motion disables the sweep entirely and falls
|
|
52
|
+
// back to a flat, slightly dimmed block.
|
|
53
|
+
const SHIMMER_STYLES = `
|
|
54
|
+
@keyframes skc-sweep {
|
|
55
|
+
0% { background-position: 160% 0; }
|
|
56
|
+
100% { background-position: -60% 0; }
|
|
57
|
+
}
|
|
58
|
+
.skc-shimmer {
|
|
59
|
+
background-image: linear-gradient(
|
|
60
|
+
115deg,
|
|
61
|
+
transparent 0%,
|
|
62
|
+
transparent 38%,
|
|
63
|
+
var(--color-canvas) 50%,
|
|
64
|
+
transparent 62%,
|
|
65
|
+
transparent 100%
|
|
66
|
+
);
|
|
67
|
+
background-size: 220% 100%;
|
|
68
|
+
animation: skc-sweep 1.6s ease-in-out infinite;
|
|
69
|
+
}
|
|
70
|
+
@media (prefers-reduced-motion: reduce) {
|
|
71
|
+
.skc-shimmer {
|
|
72
|
+
animation: none;
|
|
73
|
+
background-image: none;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
export const SkeletonChip = React.forwardRef<HTMLDivElement, SkeletonChipProps>(
|
|
79
|
+
(
|
|
80
|
+
{
|
|
81
|
+
shape = "row",
|
|
82
|
+
count = 3,
|
|
83
|
+
iconOnly = false,
|
|
84
|
+
animated = true,
|
|
85
|
+
label = "Loading",
|
|
86
|
+
fullWidth = false,
|
|
87
|
+
orientation = "vertical",
|
|
88
|
+
className,
|
|
89
|
+
...rest
|
|
90
|
+
},
|
|
91
|
+
ref,
|
|
92
|
+
) => {
|
|
93
|
+
const items = Array.from({ length: Math.max(1, count) }, (_, i) => i);
|
|
94
|
+
const isHorizontal = orientation === "horizontal";
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div
|
|
98
|
+
ref={ref}
|
|
99
|
+
role="status"
|
|
100
|
+
aria-busy="true"
|
|
101
|
+
className={[fullWidth ? "w-full" : "w-full max-w-3xl mx-auto", className]
|
|
102
|
+
.filter(Boolean)
|
|
103
|
+
.join(" ")}
|
|
104
|
+
{...rest}
|
|
105
|
+
>
|
|
106
|
+
<style>{SHIMMER_STYLES}</style>
|
|
107
|
+
<span className="sr-only">{label}</span>
|
|
108
|
+
|
|
109
|
+
<div
|
|
110
|
+
className={[
|
|
111
|
+
isHorizontal ? "flex flex-row items-stretch w-full" : "flex flex-col",
|
|
112
|
+
shape === "row" ? "gap-xxs" : "gap-xs",
|
|
113
|
+
].join(" ")}
|
|
114
|
+
>
|
|
115
|
+
{items.map((i) => {
|
|
116
|
+
const delay = `${i * 0.08}s`;
|
|
117
|
+
|
|
118
|
+
if (shape === "chip") {
|
|
119
|
+
const widthClass = CHIP_WIDTHS[i % CHIP_WIDTHS.length];
|
|
120
|
+
return (
|
|
121
|
+
<span
|
|
122
|
+
key={i}
|
|
123
|
+
aria-hidden="true"
|
|
124
|
+
className={[
|
|
125
|
+
"h-10 rounded-full bg-surface-strong",
|
|
126
|
+
widthClass,
|
|
127
|
+
animated ? "skc-shimmer" : "opacity-75",
|
|
128
|
+
]
|
|
129
|
+
.filter(Boolean)
|
|
130
|
+
.join(" ")}
|
|
131
|
+
style={animated ? { animationDelay: delay } : undefined}
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (shape === "block") {
|
|
137
|
+
return (
|
|
138
|
+
<span
|
|
139
|
+
key={i}
|
|
140
|
+
aria-hidden="true"
|
|
141
|
+
className={[
|
|
142
|
+
"rounded-md bg-surface-strong",
|
|
143
|
+
isHorizontal ? "h-16 min-w-0 flex-1" : "h-24 w-full",
|
|
144
|
+
animated ? "skc-shimmer" : "opacity-75",
|
|
145
|
+
]
|
|
146
|
+
.filter(Boolean)
|
|
147
|
+
.join(" ")}
|
|
148
|
+
style={animated ? { animationDelay: delay } : undefined}
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const widthClass = ROW_WIDTHS[i % ROW_WIDTHS.length];
|
|
154
|
+
return (
|
|
155
|
+
<div
|
|
156
|
+
key={i}
|
|
157
|
+
className={[
|
|
158
|
+
"flex items-center gap-sm rounded-md",
|
|
159
|
+
iconOnly ? "justify-center px-xs py-xs" : "px-sm py-xs",
|
|
160
|
+
].join(" ")}
|
|
161
|
+
>
|
|
162
|
+
<span
|
|
163
|
+
aria-hidden="true"
|
|
164
|
+
className={[
|
|
165
|
+
"shrink-0 rounded-sm bg-surface-strong",
|
|
166
|
+
animated ? "skc-shimmer" : "opacity-75",
|
|
167
|
+
]
|
|
168
|
+
.filter(Boolean)
|
|
169
|
+
.join(" ")}
|
|
170
|
+
style={{
|
|
171
|
+
width: "18px",
|
|
172
|
+
height: "18px",
|
|
173
|
+
...(animated ? { animationDelay: delay } : undefined),
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
{!iconOnly && (
|
|
177
|
+
<span
|
|
178
|
+
aria-hidden="true"
|
|
179
|
+
className={[
|
|
180
|
+
"h-3.5 rounded-full bg-surface-strong",
|
|
181
|
+
widthClass,
|
|
182
|
+
animated ? "skc-shimmer" : "opacity-75",
|
|
183
|
+
]
|
|
184
|
+
.filter(Boolean)
|
|
185
|
+
.join(" ")}
|
|
186
|
+
style={animated ? { animationDelay: delay } : undefined}
|
|
187
|
+
/>
|
|
188
|
+
)}
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
191
|
+
})}
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
},
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
SkeletonChip.displayName = "SkeletonChip";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SkeletonChip } from "./SkeletonChip";
|
|
3
|
+
import { Button } from "../Button";
|
|
4
|
+
|
|
5
|
+
export default function SkeletonChipPreview() {
|
|
6
|
+
const [animated, setAnimated] = React.useState(true);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<div className="w-full max-w-3xl mx-auto p-lg space-y-xl">
|
|
10
|
+
<div>
|
|
11
|
+
<div className="flex items-center justify-between mb-sm gap-md">
|
|
12
|
+
<p className="text-caption text-muted">
|
|
13
|
+
Row variant — nav/menu rows loading (shape="row")
|
|
14
|
+
</p>
|
|
15
|
+
<Button variant="secondary" size="sm" onClick={() => setAnimated((a) => !a)}>
|
|
16
|
+
{animated ? "Simulate reduced motion" : "Resume shimmer"}
|
|
17
|
+
</Button>
|
|
18
|
+
</div>
|
|
19
|
+
<SkeletonChip shape="row" count={3} animated={animated} />
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div>
|
|
23
|
+
<p className="text-caption text-muted mb-sm">
|
|
24
|
+
Chip variant — filter/tag chips loading (shape="chip")
|
|
25
|
+
</p>
|
|
26
|
+
<SkeletonChip shape="chip" count={3} animated={animated} />
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div>
|
|
30
|
+
<p className="text-caption text-muted mb-sm">
|
|
31
|
+
Block variant, horizontal — a full-width color-swatch bar
|
|
32
|
+
(shape="block" orientation="horizontal" fullWidth)
|
|
33
|
+
</p>
|
|
34
|
+
<SkeletonChip
|
|
35
|
+
shape="block"
|
|
36
|
+
orientation="horizontal"
|
|
37
|
+
fullWidth
|
|
38
|
+
count={5}
|
|
39
|
+
animated={animated}
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Typography } from "../Typography";
|
|
3
|
+
import { Button } from "../Button";
|
|
4
|
+
|
|
5
|
+
export interface TemplateHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/** Design system name shown as the title */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** Font family (kept for API compatibility; not rendered) */
|
|
9
|
+
fontFamily?: string;
|
|
10
|
+
/** Base font size (kept for API compatibility; not rendered) */
|
|
11
|
+
baseFontSize?: string;
|
|
12
|
+
/** Number of brand colors (kept for API compatibility; not rendered) */
|
|
13
|
+
colorCount?: number;
|
|
14
|
+
/** Label for the plan/package badge, e.g. "Complete system". Rendered at md and up only. */
|
|
15
|
+
planLabel?: string;
|
|
16
|
+
/** Price string, e.g. "$79". Rendered at md and up only. */
|
|
17
|
+
price?: string;
|
|
18
|
+
/** Purchase button label */
|
|
19
|
+
purchaseLabel?: string;
|
|
20
|
+
/** Called when the purchase button is clicked */
|
|
21
|
+
onPurchase?: () => void;
|
|
22
|
+
/** Optional CSS color values used to paint the swatch dots, in order. Missing slots fall back to token utility classes. */
|
|
23
|
+
dotColors?: string[];
|
|
24
|
+
/** Label for the mobile-only live-view button. Defaults to "Live preview". */
|
|
25
|
+
previewLabel?: string;
|
|
26
|
+
/** When provided, a live-view button renders beside the buy button (50/50) below the md breakpoint. */
|
|
27
|
+
onPreview?: () => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Token utility fallbacks used when a dotColors slot is missing, in order. */
|
|
31
|
+
const DOT_FALLBACK_CLASSES = ["bg-primary", "bg-primary-hover", "bg-primary-active", "bg-primary-soft"];
|
|
32
|
+
|
|
33
|
+
/** Small decorative 2x2 dot grid standing in for a design-system "swatch" icon. */
|
|
34
|
+
const SwatchIcon = ({ dotColors }: { dotColors?: string[] }) => (
|
|
35
|
+
<div className="grid grid-cols-2 gap-xxs shrink-0" aria-hidden="true">
|
|
36
|
+
{DOT_FALLBACK_CLASSES.map((fallbackClass, index) => {
|
|
37
|
+
const color = dotColors?.[index];
|
|
38
|
+
return (
|
|
39
|
+
<span
|
|
40
|
+
key={index}
|
|
41
|
+
className={["size-2.5 rounded-full", color ? "" : fallbackClass].filter(Boolean).join(" ")}
|
|
42
|
+
style={color ? { backgroundColor: color } : undefined}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
})}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
export const TemplateHeader = React.forwardRef<HTMLDivElement, TemplateHeaderProps>(
|
|
50
|
+
(
|
|
51
|
+
{
|
|
52
|
+
name = "Design System",
|
|
53
|
+
// fontFamily, baseFontSize and colorCount are intentionally unused in the markup.
|
|
54
|
+
fontFamily: _fontFamily,
|
|
55
|
+
baseFontSize: _baseFontSize,
|
|
56
|
+
colorCount: _colorCount,
|
|
57
|
+
planLabel = "Complete system",
|
|
58
|
+
price = "$9.99",
|
|
59
|
+
purchaseLabel = "Buy for $9.99",
|
|
60
|
+
onPurchase,
|
|
61
|
+
dotColors,
|
|
62
|
+
previewLabel = "Live preview",
|
|
63
|
+
onPreview,
|
|
64
|
+
className,
|
|
65
|
+
...rest
|
|
66
|
+
},
|
|
67
|
+
ref,
|
|
68
|
+
) => {
|
|
69
|
+
return (
|
|
70
|
+
<div
|
|
71
|
+
ref={ref}
|
|
72
|
+
className={[
|
|
73
|
+
"sticky top-0 z-20 w-full border-b border-hairline bg-canvas px-md py-sm shadow-card md:px-lg md:py-md",
|
|
74
|
+
className,
|
|
75
|
+
]
|
|
76
|
+
.filter(Boolean)
|
|
77
|
+
.join(" ")}
|
|
78
|
+
{...rest}
|
|
79
|
+
>
|
|
80
|
+
<div className="flex flex-col items-stretch gap-sm md:flex-row md:items-center md:justify-between md:gap-lg">
|
|
81
|
+
<div className="flex min-w-0 items-center justify-start gap-md md:flex-1">
|
|
82
|
+
<div className="hidden size-12 shrink-0 items-center justify-center rounded-md bg-primary-soft md:flex">
|
|
83
|
+
<SwatchIcon dotColors={dotColors} />
|
|
84
|
+
</div>
|
|
85
|
+
<div className="flex min-w-0 flex-1 flex-col">
|
|
86
|
+
<Typography role="heading-sm" color="ink" className="truncate">
|
|
87
|
+
{name}
|
|
88
|
+
</Typography>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div className="flex w-full min-w-0 items-center justify-start gap-md md:w-auto md:shrink-0 md:justify-end md:gap-lg">
|
|
93
|
+
<div className="hidden min-w-0 items-center gap-xs md:flex">
|
|
94
|
+
<Typography role="body-md" color="muted">
|
|
95
|
+
{planLabel}
|
|
96
|
+
</Typography>
|
|
97
|
+
<span className="size-2 shrink-0 rounded-full bg-primary" aria-hidden="true" />
|
|
98
|
+
<Typography role="heading-sm" color="ink">
|
|
99
|
+
{price}
|
|
100
|
+
</Typography>
|
|
101
|
+
</div>
|
|
102
|
+
<div className="flex w-full flex-row items-stretch gap-sm md:w-auto">
|
|
103
|
+
<Button
|
|
104
|
+
variant="primary"
|
|
105
|
+
size="md"
|
|
106
|
+
onClick={onPurchase}
|
|
107
|
+
className="w-full min-w-0 flex-1 basis-0 md:w-auto md:flex-none md:basis-auto"
|
|
108
|
+
>
|
|
109
|
+
{purchaseLabel}
|
|
110
|
+
</Button>
|
|
111
|
+
{onPreview ? (
|
|
112
|
+
<Button
|
|
113
|
+
variant="ghost"
|
|
114
|
+
size="md"
|
|
115
|
+
onClick={onPreview}
|
|
116
|
+
className="w-full min-w-0 flex-1 basis-0 border border-primary text-primary md:hidden"
|
|
117
|
+
>
|
|
118
|
+
{previewLabel}
|
|
119
|
+
</Button>
|
|
120
|
+
) : null}
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
},
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
TemplateHeader.displayName = "TemplateHeader";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { TemplateHeader } from "./TemplateHeader";
|
|
3
|
+
|
|
4
|
+
export default function TemplateHeaderPreview() {
|
|
5
|
+
const [lastAction, setLastAction] = useState<string>("None yet");
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
|
|
9
|
+
<div className="space-y-sm">
|
|
10
|
+
<p className="text-body-sm text-muted">
|
|
11
|
+
With onPreview — below md: plan and price, buy button, then live-view button. At md and up the live-view button is hidden.
|
|
12
|
+
</p>
|
|
13
|
+
<div className="w-full rounded-xl border border-hairline bg-surface overflow-hidden">
|
|
14
|
+
<TemplateHeader
|
|
15
|
+
name="Aurora Design System"
|
|
16
|
+
fontFamily="Inter"
|
|
17
|
+
baseFontSize="14px"
|
|
18
|
+
colorCount={6}
|
|
19
|
+
planLabel="Complete system"
|
|
20
|
+
price="$9.99"
|
|
21
|
+
purchaseLabel="Buy for $9.99"
|
|
22
|
+
previewLabel="Live preview"
|
|
23
|
+
onPurchase={() => setLastAction("Purchase clicked")}
|
|
24
|
+
onPreview={() => setLastAction("Live preview clicked")}
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div className="space-y-sm">
|
|
30
|
+
<p className="text-body-sm text-muted">Without onPreview (no extra button)</p>
|
|
31
|
+
<div className="w-full rounded-xl border border-hairline bg-surface overflow-hidden">
|
|
32
|
+
<TemplateHeader name="Minimal System" onPurchase={() => setLastAction("Purchase clicked (minimal)")} />
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<p className="text-body-sm text-body">Last action: {lastAction}</p>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|