@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
|
@@ -2,26 +2,25 @@ import React from "react";
|
|
|
2
2
|
import { Button } from "../Button";
|
|
3
3
|
import { Chip } from "../Chip";
|
|
4
4
|
import { Icon } from "../Icon";
|
|
5
|
-
import { BillingToggle } from "../BillingToggle";
|
|
6
|
-
import type { BillingPeriod } from "../BillingToggle";
|
|
7
5
|
import { PricingCard } from "../PricingCard";
|
|
8
|
-
import type { PricingCardCreditTier } from "../PricingCard";
|
|
9
6
|
import { FaqAccordionItem } from "../FaqAccordionItem";
|
|
10
7
|
|
|
11
8
|
export interface PricingPlan {
|
|
12
9
|
id: string;
|
|
13
10
|
planName: string;
|
|
14
11
|
description: string;
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
/** Single monthly price string, e.g. "$29". */
|
|
13
|
+
price: string;
|
|
17
14
|
priceUnit?: string;
|
|
18
15
|
priceNote?: string;
|
|
19
16
|
features: string[];
|
|
20
17
|
ctaLabel: string;
|
|
21
18
|
ctaCaption?: string;
|
|
22
19
|
highlighted?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
|
|
20
|
+
/** Label for the highlight badge. When omitted, PricingCard uses its own default. */
|
|
21
|
+
highlightLabel?: string;
|
|
22
|
+
/** When true, the card uses the disabled treatment and onPlanCtaClick is not called. */
|
|
23
|
+
disabled?: boolean;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
export interface PricingFaq {
|
|
@@ -35,70 +34,75 @@ export interface PricingPageTemplateProps {
|
|
|
35
34
|
subtitle?: string;
|
|
36
35
|
plans?: PricingPlan[];
|
|
37
36
|
faqs?: PricingFaq[];
|
|
38
|
-
billingPeriod?: BillingPeriod;
|
|
39
|
-
onBillingPeriodChange?: (period: BillingPeriod) => void;
|
|
40
37
|
onPlanCtaClick?: (planId: string) => void;
|
|
41
38
|
onContactSupport?: () => void;
|
|
42
39
|
className?: string;
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{ value: "1200", label: "1,200 credits", price: "$294 /mo", savingsLabel: "Save 2%" },
|
|
51
|
-
{ value: "2000", label: "2,000 credits", price: "$480 /mo", savingsLabel: "Save 4%" },
|
|
52
|
-
{ value: "3000", label: "3,000 credits", price: "$705 /mo", savingsLabel: "Save 6%" },
|
|
53
|
-
{ value: "4000", label: "4,000 credits", price: "$920 /mo", savingsLabel: "Save 8%" },
|
|
54
|
-
{ value: "5000", label: "5,000 credits", price: "$1,125 /mo", savingsLabel: "Save 10%" },
|
|
42
|
+
const PAID_FEATURES: string[] = [
|
|
43
|
+
"npm package with managed versioning",
|
|
44
|
+
"DESIGN.md with agent-to-agent component requests, component fixes, and token updates",
|
|
45
|
+
"Chat-driven building and editing of your design system",
|
|
46
|
+
"suggest_design visual proposals from a stronger model",
|
|
55
47
|
];
|
|
56
48
|
|
|
57
49
|
const DEFAULT_PLANS: PricingPlan[] = [
|
|
58
50
|
{
|
|
59
51
|
id: "free",
|
|
60
52
|
planName: "Free",
|
|
61
|
-
description: "For
|
|
62
|
-
|
|
63
|
-
yearlyPrice: "$0",
|
|
53
|
+
description: "For trying things out",
|
|
54
|
+
price: "$0",
|
|
64
55
|
priceUnit: "/ month",
|
|
56
|
+
priceNote: "500 credits / month",
|
|
65
57
|
features: [
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"Community support",
|
|
70
|
-
"Public projects only",
|
|
58
|
+
"500 credits every month",
|
|
59
|
+
"Haiku 4.5 only",
|
|
60
|
+
"Build and edit components in chat",
|
|
71
61
|
],
|
|
72
62
|
ctaLabel: "Get started",
|
|
73
63
|
ctaCaption: "No credit card required",
|
|
74
64
|
},
|
|
65
|
+
{
|
|
66
|
+
id: "starter",
|
|
67
|
+
planName: "Starter",
|
|
68
|
+
description: "Enough credits to edit a design system you already have.",
|
|
69
|
+
price: "$9",
|
|
70
|
+
priceUnit: "/ month",
|
|
71
|
+
priceNote: "900 credits / month",
|
|
72
|
+
features: PAID_FEATURES,
|
|
73
|
+
ctaLabel: "Start Starter",
|
|
74
|
+
ctaCaption: "Cancel anytime",
|
|
75
|
+
},
|
|
75
76
|
{
|
|
76
77
|
id: "pro",
|
|
77
78
|
planName: "Pro",
|
|
78
|
-
description: "
|
|
79
|
-
|
|
80
|
-
yearlyPrice: "$20",
|
|
79
|
+
description: "Headroom for new components and visual proposals.",
|
|
80
|
+
price: "$19",
|
|
81
81
|
priceUnit: "/ month",
|
|
82
|
-
priceNote: "
|
|
83
|
-
features:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"Priority email support",
|
|
87
|
-
"Private projects",
|
|
88
|
-
"Export design tokens",
|
|
89
|
-
],
|
|
90
|
-
ctaLabel: "Start Pro trial",
|
|
91
|
-
ctaCaption: "14-day free trial · No credit card required",
|
|
82
|
+
priceNote: "1,900 credits / month",
|
|
83
|
+
features: PAID_FEATURES,
|
|
84
|
+
ctaLabel: "Start Pro",
|
|
85
|
+
ctaCaption: "Cancel anytime",
|
|
92
86
|
highlighted: true,
|
|
93
|
-
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "studio",
|
|
90
|
+
planName: "Studio",
|
|
91
|
+
description: "For teams iterating on several kits.",
|
|
92
|
+
price: "$49",
|
|
93
|
+
priceUnit: "/ month",
|
|
94
|
+
priceNote: "4,900 credits / month",
|
|
95
|
+
features: PAID_FEATURES,
|
|
96
|
+
ctaLabel: "Start Studio",
|
|
97
|
+
ctaCaption: "Cancel anytime",
|
|
94
98
|
},
|
|
95
99
|
];
|
|
96
100
|
|
|
97
101
|
const DEFAULT_FAQS: PricingFaq[] = [
|
|
98
102
|
{ question: "Can I change plans anytime?", answer: "Yes — upgrade, downgrade, or cancel your plan at any time from your account settings. Changes apply on your next billing cycle." },
|
|
99
|
-
{ question: "
|
|
100
|
-
{ question: "What payment methods do you accept?", answer: "We accept all major credit cards, plus invoicing for
|
|
101
|
-
{ question: "What happens if I
|
|
103
|
+
{ question: "What are credits used for?", answer: "Credits are spent whenever the agent generates or edits a component. Unused credits don't roll over between billing cycles." },
|
|
104
|
+
{ question: "What payment methods do you accept?", answer: "We accept all major credit cards, plus invoicing for Studio plans." },
|
|
105
|
+
{ question: "What happens if I run out of credits?", answer: "We'll notify you as you approach your limit. You can upgrade your plan at any time to raise it instantly, or buy a one-time top-up of 1,000 credits for $10 without changing your plan." },
|
|
102
106
|
{ question: "Do you offer refunds?", answer: "Yes, we offer a full refund within 14 days of purchase if you're not satisfied." },
|
|
103
107
|
];
|
|
104
108
|
|
|
@@ -110,41 +114,50 @@ export const PricingPageTemplate = React.forwardRef<HTMLDivElement, PricingPageT
|
|
|
110
114
|
subtitle = "Choose the plan that fits your workflow. Upgrade, downgrade, or cancel anytime.",
|
|
111
115
|
plans = DEFAULT_PLANS,
|
|
112
116
|
faqs = DEFAULT_FAQS,
|
|
113
|
-
billingPeriod,
|
|
114
|
-
onBillingPeriodChange,
|
|
115
117
|
onPlanCtaClick,
|
|
116
118
|
onContactSupport,
|
|
117
119
|
className,
|
|
118
120
|
},
|
|
119
121
|
ref,
|
|
120
122
|
) => {
|
|
121
|
-
const [internalPeriod, setInternalPeriod] = React.useState<BillingPeriod>("monthly");
|
|
122
|
-
const period = billingPeriod ?? internalPeriod;
|
|
123
|
-
|
|
124
|
-
const handlePeriodChange = (next: BillingPeriod) => {
|
|
125
|
-
if (billingPeriod === undefined) setInternalPeriod(next);
|
|
126
|
-
onBillingPeriodChange?.(next);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
123
|
const [openFaqIndex, setOpenFaqIndex] = React.useState<number | null>(0);
|
|
130
124
|
|
|
131
|
-
//
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
125
|
+
// Fewer than 3 plans: center the group instead of stretching it across a
|
|
126
|
+
// grid meant for more columns. 3 plans keeps the existing 3-col grid,
|
|
127
|
+
// 4+ plans keeps the existing 4-col grid. The outer wrapper always stays
|
|
128
|
+
// `w-full` so the Template root never gets capped narrow.
|
|
129
|
+
//
|
|
130
|
+
// For 1-2 plans the grid stacks full-width on mobile (`w-full grid`), but
|
|
131
|
+
// at `sm`+ it switches to `sm:w-auto sm:inline-grid` so it sizes to its
|
|
132
|
+
// own content instead of stretching across the full row — `w-full` must
|
|
133
|
+
// NOT survive past the mobile breakpoint or it wins over `inline-grid`
|
|
134
|
+
// and the group stays left-aligned instead of centering. Each card gets a
|
|
135
|
+
// fixed column width (`sm:w-96`, matching a single card's width in the
|
|
136
|
+
// 3-col layout) so the pair (or single card) reads as an evenly-sized,
|
|
137
|
+
// centered group rather than hugging the left edge of an oversized row.
|
|
138
|
+
let plansWrapperClassName: string;
|
|
139
|
+
let plansGridClassName: string;
|
|
140
|
+
const fixedCardWidth = plans.length <= 2;
|
|
141
|
+
if (plans.length >= 4) {
|
|
142
|
+
plansWrapperClassName = "w-full pt-md";
|
|
143
|
+
plansGridClassName = "w-full grid grid-cols-1 sm:grid-cols-4 gap-lg items-stretch";
|
|
144
|
+
} else if (plans.length === 3) {
|
|
145
|
+
plansWrapperClassName = "w-full pt-md";
|
|
146
|
+
plansGridClassName = "w-full grid grid-cols-1 sm:grid-cols-3 gap-lg items-stretch";
|
|
147
|
+
} else if (plans.length === 2) {
|
|
148
|
+
plansWrapperClassName = "w-full pt-md flex justify-center";
|
|
149
|
+
plansGridClassName = "w-full grid grid-cols-1 gap-lg items-stretch sm:w-auto sm:inline-grid sm:grid-cols-2";
|
|
150
|
+
} else {
|
|
151
|
+
plansWrapperClassName = "w-full pt-md flex justify-center";
|
|
152
|
+
plansGridClassName = "w-full grid grid-cols-1 gap-lg items-stretch sm:w-auto sm:inline-grid";
|
|
153
|
+
}
|
|
141
154
|
|
|
142
155
|
return (
|
|
143
156
|
<div
|
|
144
157
|
ref={ref}
|
|
145
158
|
className={["w-full bg-canvas", className].filter(Boolean).join(" ")}
|
|
146
159
|
>
|
|
147
|
-
<div className="w-full max-w-
|
|
160
|
+
<div className="w-full max-w-7xl mx-auto px-lg py-section flex flex-col items-center gap-xl">
|
|
148
161
|
{/* ── Header ── */}
|
|
149
162
|
<div className="flex flex-col items-center gap-md text-center">
|
|
150
163
|
<Chip label={eyebrow} variant="primary" size="sm" className="uppercase tracking-wide" />
|
|
@@ -152,35 +165,42 @@ export const PricingPageTemplate = React.forwardRef<HTMLDivElement, PricingPageT
|
|
|
152
165
|
<p className="text-body-lg text-muted max-w-xl">{subtitle}</p>
|
|
153
166
|
</div>
|
|
154
167
|
|
|
155
|
-
{/* ── Billing toggle ── */}
|
|
156
|
-
<BillingToggle value={period} onChange={handlePeriodChange} />
|
|
157
|
-
|
|
158
168
|
{/* ── Pricing cards ── */}
|
|
159
|
-
<div className=
|
|
160
|
-
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
169
|
+
<div className={plansWrapperClassName}>
|
|
170
|
+
<div className={plansGridClassName}>
|
|
171
|
+
{plans.map((plan) => {
|
|
172
|
+
const card = (
|
|
173
|
+
<PricingCard
|
|
174
|
+
planName={plan.planName}
|
|
175
|
+
description={plan.description}
|
|
176
|
+
price={plan.price}
|
|
177
|
+
priceUnit={plan.priceUnit}
|
|
178
|
+
priceNote={plan.priceNote}
|
|
179
|
+
features={plan.features}
|
|
180
|
+
ctaLabel={plan.ctaLabel}
|
|
181
|
+
ctaCaption={plan.ctaCaption}
|
|
182
|
+
highlighted={plan.highlighted}
|
|
183
|
+
highlightLabel={plan.highlightLabel}
|
|
184
|
+
disabled={plan.disabled}
|
|
185
|
+
onCtaClick={
|
|
186
|
+
plan.disabled ? undefined : () => onPlanCtaClick?.(plan.id)
|
|
187
|
+
}
|
|
188
|
+
/>
|
|
189
|
+
);
|
|
190
|
+
if (fixedCardWidth) {
|
|
191
|
+
return (
|
|
192
|
+
<div key={plan.id} className="w-full sm:w-96">
|
|
193
|
+
{card}
|
|
194
|
+
</div>
|
|
195
|
+
);
|
|
176
196
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
197
|
+
return React.cloneElement(card, { key: plan.id });
|
|
198
|
+
})}
|
|
199
|
+
</div>
|
|
180
200
|
</div>
|
|
181
201
|
|
|
182
202
|
{/* ── FAQ section ── */}
|
|
183
|
-
<div className="w-full rounded-xl border border-hairline bg-surface p-lg md:p-xl flex flex-col gap-lg">
|
|
203
|
+
<div className="max-w-3xl w-full mx-auto rounded-xl border border-hairline bg-surface p-lg md:p-xl flex flex-col gap-lg">
|
|
184
204
|
<h2 className="text-heading-lg text-ink">Frequently asked questions</h2>
|
|
185
205
|
|
|
186
206
|
<div className="flex flex-col gap-sm">
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Input } from "../Input";
|
|
3
|
+
import { Icon } from "../Icon";
|
|
4
|
+
|
|
5
|
+
export interface ProjectSettingsModalProps {
|
|
6
|
+
/** Controls visibility. The panel stays mounted so it can animate closed. */
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
/** Called on scrim click, close button, or Escape. */
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
projectName: string;
|
|
11
|
+
onProjectNameChange?: (name: string) => void;
|
|
12
|
+
onSaveProjectName?: () => void;
|
|
13
|
+
projectNameSaving?: boolean;
|
|
14
|
+
projectNameError?: string;
|
|
15
|
+
/** True once the field differs from the saved name — enables "Save name". */
|
|
16
|
+
projectNameDirty?: boolean;
|
|
17
|
+
tokenLast4?: string | null;
|
|
18
|
+
tokenCreatedAt?: string | null;
|
|
19
|
+
revealedToken?: string | null;
|
|
20
|
+
onRotateToken?: () => void;
|
|
21
|
+
tokenRotating?: boolean;
|
|
22
|
+
tokenRotateError?: string;
|
|
23
|
+
onCopyToken?: () => void;
|
|
24
|
+
tokenCopied?: boolean;
|
|
25
|
+
/** Whether consumer agents may generate a mockup for new atoms. */
|
|
26
|
+
consumerSuggestDesign?: boolean;
|
|
27
|
+
onConsumerSuggestDesignChange?: (next: boolean) => void;
|
|
28
|
+
consumerSuggestDesignSaving?: boolean;
|
|
29
|
+
consumerSuggestDesignError?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Shared action chrome — one size, two weights, no per-callsite overrides. */
|
|
33
|
+
const actionBase =
|
|
34
|
+
"inline-flex h-10 flex-shrink-0 cursor-pointer select-none items-center justify-center whitespace-nowrap rounded-md px-base text-body-sm font-weight-body-md 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";
|
|
35
|
+
|
|
36
|
+
const primaryAction = `${actionBase} bg-primary text-on-primary hover:bg-primary-hover active:bg-primary-active disabled:bg-primary-disabled disabled:text-on-primary`;
|
|
37
|
+
|
|
38
|
+
const secondaryAction = `${actionBase} border border-hairline bg-canvas text-ink hover:bg-surface-soft active:bg-surface-strong disabled:opacity-50`;
|
|
39
|
+
|
|
40
|
+
export const ProjectSettingsModal = React.forwardRef<
|
|
41
|
+
HTMLDivElement,
|
|
42
|
+
ProjectSettingsModalProps
|
|
43
|
+
>(
|
|
44
|
+
(
|
|
45
|
+
{
|
|
46
|
+
isOpen,
|
|
47
|
+
onClose,
|
|
48
|
+
projectName,
|
|
49
|
+
onProjectNameChange,
|
|
50
|
+
onSaveProjectName,
|
|
51
|
+
projectNameSaving = false,
|
|
52
|
+
projectNameError,
|
|
53
|
+
projectNameDirty = false,
|
|
54
|
+
tokenLast4 = null,
|
|
55
|
+
tokenCreatedAt = null,
|
|
56
|
+
revealedToken = null,
|
|
57
|
+
onRotateToken,
|
|
58
|
+
tokenRotating = false,
|
|
59
|
+
tokenRotateError,
|
|
60
|
+
onCopyToken,
|
|
61
|
+
tokenCopied = false,
|
|
62
|
+
consumerSuggestDesign = false,
|
|
63
|
+
onConsumerSuggestDesignChange,
|
|
64
|
+
consumerSuggestDesignSaving = false,
|
|
65
|
+
consumerSuggestDesignError,
|
|
66
|
+
},
|
|
67
|
+
ref,
|
|
68
|
+
) => {
|
|
69
|
+
const hasToken = Boolean(tokenLast4);
|
|
70
|
+
const canSaveName =
|
|
71
|
+
projectNameDirty && !projectNameSaving && projectName.trim().length > 0;
|
|
72
|
+
const switchOn = consumerSuggestDesign;
|
|
73
|
+
const state = isOpen ? "open" : "closed";
|
|
74
|
+
|
|
75
|
+
// Close on Escape while open.
|
|
76
|
+
React.useEffect(() => {
|
|
77
|
+
if (!isOpen) return;
|
|
78
|
+
const onKey = (e: KeyboardEvent) => {
|
|
79
|
+
if (e.key === "Escape") onClose();
|
|
80
|
+
};
|
|
81
|
+
document.addEventListener("keydown", onKey);
|
|
82
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
83
|
+
}, [isOpen, onClose]);
|
|
84
|
+
|
|
85
|
+
// 44x24 track, 2px inset, 20px thumb sliding 20px on transform only.
|
|
86
|
+
const consumerSwitch = (
|
|
87
|
+
<button
|
|
88
|
+
type="button"
|
|
89
|
+
role="switch"
|
|
90
|
+
aria-checked={switchOn}
|
|
91
|
+
aria-label="Suggest design for consumer agents"
|
|
92
|
+
aria-busy={consumerSuggestDesignSaving || undefined}
|
|
93
|
+
disabled={consumerSuggestDesignSaving}
|
|
94
|
+
onClick={() => onConsumerSuggestDesignChange?.(!switchOn)}
|
|
95
|
+
data-state={switchOn ? "on" : "off"}
|
|
96
|
+
className={`inline-flex h-6 w-11 flex-shrink-0 cursor-pointer items-center rounded-full p-0.5 transition-colors duration-200 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50 ${
|
|
97
|
+
switchOn ? "bg-primary" : "bg-surface-strong"
|
|
98
|
+
}`}
|
|
99
|
+
>
|
|
100
|
+
<span
|
|
101
|
+
aria-hidden="true"
|
|
102
|
+
className={`block h-5 w-5 rounded-full bg-canvas shadow-sm transition-transform duration-200 ease-out ${
|
|
103
|
+
switchOn ? "translate-x-5" : "translate-x-0"
|
|
104
|
+
}`}
|
|
105
|
+
/>
|
|
106
|
+
</button>
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<div
|
|
111
|
+
role="dialog"
|
|
112
|
+
aria-modal="true"
|
|
113
|
+
aria-labelledby="project-settings-title"
|
|
114
|
+
data-state={state}
|
|
115
|
+
style={{ zIndex: "var(--z-modal, 1200)" }}
|
|
116
|
+
className={[
|
|
117
|
+
"fixed inset-0 flex items-center justify-center p-base",
|
|
118
|
+
"bg-[var(--color-scrim)]/60",
|
|
119
|
+
"transition-opacity duration-200 ease-out",
|
|
120
|
+
"data-[state=open]:opacity-100",
|
|
121
|
+
"data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0",
|
|
122
|
+
].join(" ")}
|
|
123
|
+
>
|
|
124
|
+
{/* Scrim — a real button so click-to-dismiss is a valid control. */}
|
|
125
|
+
<button
|
|
126
|
+
type="button"
|
|
127
|
+
tabIndex={-1}
|
|
128
|
+
aria-label="Close project settings"
|
|
129
|
+
onClick={onClose}
|
|
130
|
+
className="absolute inset-0 h-full w-full cursor-pointer bg-transparent"
|
|
131
|
+
/>
|
|
132
|
+
|
|
133
|
+
<div
|
|
134
|
+
ref={ref}
|
|
135
|
+
data-state={state}
|
|
136
|
+
className={[
|
|
137
|
+
"relative flex max-h-full w-full max-w-2xl flex-col overflow-hidden",
|
|
138
|
+
"rounded-xl border border-hairline bg-canvas",
|
|
139
|
+
"shadow-[0_12px_48px_-8px_rgba(26,26,46,0.22)]",
|
|
140
|
+
"transition duration-200 ease-out",
|
|
141
|
+
"data-[state=open]:translate-y-0 data-[state=open]:scale-100 data-[state=open]:opacity-100",
|
|
142
|
+
"data-[state=closed]:translate-y-2 data-[state=closed]:scale-[0.98] data-[state=closed]:opacity-0",
|
|
143
|
+
].join(" ")}
|
|
144
|
+
>
|
|
145
|
+
{/* Header — the dialog's only mark: a functional close control. */}
|
|
146
|
+
<div className="flex items-center justify-between gap-md px-lg py-base">
|
|
147
|
+
<h2 id="project-settings-title" className="text-heading-sm text-ink">
|
|
148
|
+
Project settings
|
|
149
|
+
</h2>
|
|
150
|
+
<button
|
|
151
|
+
type="button"
|
|
152
|
+
onClick={onClose}
|
|
153
|
+
aria-label="Close settings"
|
|
154
|
+
className="flex h-8 w-8 flex-shrink-0 cursor-pointer items-center justify-center rounded-sm bg-surface-soft text-muted transition duration-150 ease-out hover:bg-surface-strong hover:text-ink active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue"
|
|
155
|
+
>
|
|
156
|
+
<Icon name="close" size={16} />
|
|
157
|
+
</button>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
{/* Body — sections sit directly on the panel, separated by full-width
|
|
161
|
+
hairlines. No nested cards, no icon tiles. */}
|
|
162
|
+
<div className="min-h-0 flex-1 overflow-y-auto">
|
|
163
|
+
<section className="border-t border-hairline-soft px-lg py-lg">
|
|
164
|
+
<h3 className="text-heading-sm text-ink">Project name</h3>
|
|
165
|
+
<p className="mt-sm max-w-[70ch] text-body-sm text-muted">
|
|
166
|
+
Shown in the editor, the sidebar, and published package metadata.
|
|
167
|
+
</p>
|
|
168
|
+
<div className="mt-base flex items-end gap-md">
|
|
169
|
+
<div className="min-w-0 flex-1">
|
|
170
|
+
<Input
|
|
171
|
+
label="Name"
|
|
172
|
+
fullWidth
|
|
173
|
+
value={projectName}
|
|
174
|
+
onChange={(e) => onProjectNameChange?.(e.target.value)}
|
|
175
|
+
error={projectNameError}
|
|
176
|
+
disabled={projectNameSaving}
|
|
177
|
+
onKeyDown={(e) => {
|
|
178
|
+
if (e.key === "Enter" && canSaveName) {
|
|
179
|
+
e.preventDefault();
|
|
180
|
+
onSaveProjectName?.();
|
|
181
|
+
}
|
|
182
|
+
}}
|
|
183
|
+
/>
|
|
184
|
+
</div>
|
|
185
|
+
<button
|
|
186
|
+
type="button"
|
|
187
|
+
onClick={onSaveProjectName}
|
|
188
|
+
disabled={!canSaveName}
|
|
189
|
+
className={primaryAction}
|
|
190
|
+
>
|
|
191
|
+
{projectNameSaving ? "Saving…" : "Save name"}
|
|
192
|
+
</button>
|
|
193
|
+
</div>
|
|
194
|
+
</section>
|
|
195
|
+
|
|
196
|
+
<section className="border-t border-hairline-soft px-lg py-lg">
|
|
197
|
+
<h3 className="text-heading-sm text-ink">
|
|
198
|
+
Suggest design for new atoms
|
|
199
|
+
</h3>
|
|
200
|
+
<p className="mt-sm max-w-[70ch] text-body-sm text-muted">
|
|
201
|
+
When on, a consumer agent that creates a new atom through the
|
|
202
|
+
Design.md API gets a generated mockup, and the atom is built from
|
|
203
|
+
that mockup automatically. Updates to existing atoms are
|
|
204
|
+
unchanged. Re-export Design.md after changing this so consumer
|
|
205
|
+
copies pick it up.
|
|
206
|
+
</p>
|
|
207
|
+
<div className="mt-base flex items-center justify-between gap-md">
|
|
208
|
+
<span className="text-body-sm text-ink">
|
|
209
|
+
Suggest design for consumer agents
|
|
210
|
+
</span>
|
|
211
|
+
{consumerSwitch}
|
|
212
|
+
</div>
|
|
213
|
+
{consumerSuggestDesignError ? (
|
|
214
|
+
<p className="mt-sm text-body-sm text-semantic-error">
|
|
215
|
+
{consumerSuggestDesignError}
|
|
216
|
+
</p>
|
|
217
|
+
) : null}
|
|
218
|
+
</section>
|
|
219
|
+
|
|
220
|
+
<section className="border-t border-hairline-soft px-lg py-lg">
|
|
221
|
+
<h3 className="text-heading-sm text-ink">Design.md API token</h3>
|
|
222
|
+
<p className="mt-sm max-w-[70ch] text-body-sm text-muted">
|
|
223
|
+
Created the first time you export Design.md. It stays the same
|
|
224
|
+
until you rotate it here. Consumer agents use this bearer to call
|
|
225
|
+
atom-requests and related endpoints.
|
|
226
|
+
</p>
|
|
227
|
+
|
|
228
|
+
<div className="mt-base flex items-center justify-between gap-sm rounded-md bg-surface-soft px-base py-sm">
|
|
229
|
+
{hasToken ? (
|
|
230
|
+
<>
|
|
231
|
+
<code className="min-w-0 truncate font-mono text-body-sm tracking-wide text-ink">
|
|
232
|
+
••••{tokenLast4}
|
|
233
|
+
</code>
|
|
234
|
+
{tokenCreatedAt ? (
|
|
235
|
+
<span className="flex-shrink-0 text-caption text-muted-soft">
|
|
236
|
+
Created {tokenCreatedAt}
|
|
237
|
+
</span>
|
|
238
|
+
) : null}
|
|
239
|
+
</>
|
|
240
|
+
) : (
|
|
241
|
+
<span className="text-body-sm text-muted">
|
|
242
|
+
No token yet. Export Design.md to create one, or generate it
|
|
243
|
+
now.
|
|
244
|
+
</span>
|
|
245
|
+
)}
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
{revealedToken ? (
|
|
249
|
+
<div className="mt-sm space-y-xs">
|
|
250
|
+
<p className="text-caption text-muted">
|
|
251
|
+
New token — copy it now. It will not be shown again after you
|
|
252
|
+
close this dialog.
|
|
253
|
+
</p>
|
|
254
|
+
<div className="flex items-center gap-sm rounded-md bg-surface-soft px-base py-sm">
|
|
255
|
+
<code className="min-w-0 flex-1 truncate font-mono text-body-sm text-ink">
|
|
256
|
+
{revealedToken}
|
|
257
|
+
</code>
|
|
258
|
+
<button
|
|
259
|
+
type="button"
|
|
260
|
+
onClick={onCopyToken}
|
|
261
|
+
aria-label={tokenCopied ? "Token copied" : "Copy token"}
|
|
262
|
+
className="flex h-7 w-7 flex-shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted transition duration-150 ease-out hover:bg-surface-strong hover:text-ink active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue"
|
|
263
|
+
>
|
|
264
|
+
<Icon
|
|
265
|
+
name={tokenCopied ? "check-checkmark" : "copy-clipboard"}
|
|
266
|
+
size={16}
|
|
267
|
+
/>
|
|
268
|
+
</button>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
) : null}
|
|
272
|
+
|
|
273
|
+
{tokenRotateError ? (
|
|
274
|
+
<p className="mt-sm text-body-sm text-semantic-error">
|
|
275
|
+
{tokenRotateError}
|
|
276
|
+
</p>
|
|
277
|
+
) : null}
|
|
278
|
+
|
|
279
|
+
<div className="mt-md flex items-center justify-between gap-md">
|
|
280
|
+
<p className="text-caption text-muted-soft">
|
|
281
|
+
Rotating invalidates the current token immediately.
|
|
282
|
+
</p>
|
|
283
|
+
<button
|
|
284
|
+
type="button"
|
|
285
|
+
onClick={onRotateToken}
|
|
286
|
+
disabled={tokenRotating}
|
|
287
|
+
className={secondaryAction}
|
|
288
|
+
>
|
|
289
|
+
{tokenRotating
|
|
290
|
+
? "Rotating…"
|
|
291
|
+
: hasToken
|
|
292
|
+
? "Rotate token"
|
|
293
|
+
: "Generate token"}
|
|
294
|
+
</button>
|
|
295
|
+
</div>
|
|
296
|
+
</section>
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
{/* Footer */}
|
|
300
|
+
<div className="flex items-center justify-between gap-md border-t border-hairline-soft px-lg py-base">
|
|
301
|
+
<span className="text-caption text-muted-soft">
|
|
302
|
+
All changes saved
|
|
303
|
+
</span>
|
|
304
|
+
<button type="button" onClick={onClose} className={primaryAction}>
|
|
305
|
+
Done
|
|
306
|
+
</button>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
);
|
|
311
|
+
},
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
ProjectSettingsModal.displayName = "ProjectSettingsModal";
|