@designa8/vibedesign-v6 1.6.7
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 +66 -0
- package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
- package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
- package/dist/index.cjs +3231 -0
- package/dist/index.js +3201 -0
- package/dist/styles.css +1810 -0
- package/package.json +109 -0
- package/src/atoms/AppLayout/AppLayout.tsx +537 -0
- package/src/atoms/AppLayout/index.ts +2 -0
- package/src/atoms/AppLayout/preview.tsx +75 -0
- package/src/atoms/AppSidebar/AppSidebar.tsx +399 -0
- package/src/atoms/AppSidebar/index.ts +2 -0
- package/src/atoms/AppSidebar/preview.tsx +214 -0
- package/src/atoms/AuthScreen/AuthScreen.tsx +226 -0
- package/src/atoms/AuthScreen/index.ts +2 -0
- package/src/atoms/AuthScreen/preview.tsx +10 -0
- package/src/atoms/Button/Button.tsx +71 -0
- package/src/atoms/Button/index.ts +2 -0
- package/src/atoms/Button/preview.tsx +71 -0
- package/src/atoms/ChatScreen/ChatScreen.tsx +629 -0
- package/src/atoms/ChatScreen/index.ts +2 -0
- package/src/atoms/ChatScreen/preview.tsx +239 -0
- package/src/atoms/Chip/Chip.tsx +121 -0
- package/src/atoms/Chip/index.ts +2 -0
- package/src/atoms/Chip/preview.tsx +99 -0
- package/src/atoms/FilterTabBar/FilterTabBar.tsx +95 -0
- package/src/atoms/FilterTabBar/index.ts +2 -0
- package/src/atoms/FilterTabBar/preview.tsx +92 -0
- package/src/atoms/Input/Input.tsx +139 -0
- package/src/atoms/Input/index.ts +2 -0
- package/src/atoms/Input/preview.tsx +97 -0
- package/src/atoms/Modal/Modal.tsx +144 -0
- package/src/atoms/Modal/index.ts +2 -0
- package/src/atoms/Modal/preview.tsx +111 -0
- package/src/atoms/NavItem/NavItem.tsx +316 -0
- package/src/atoms/NavItem/index.ts +2 -0
- package/src/atoms/NavItem/preview.tsx +125 -0
- package/src/atoms/PromptInputBar/PromptInputBar.tsx +626 -0
- package/src/atoms/PromptInputBar/index.ts +2 -0
- package/src/atoms/PromptInputBar/preview.tsx +85 -0
- package/src/atoms/TopNavbar/TopNavbar.tsx +400 -0
- package/src/atoms/TopNavbar/index.ts +2 -0
- package/src/atoms/TopNavbar/preview.tsx +117 -0
- package/src/atoms/UpgradeCard/UpgradeCard.tsx +65 -0
- package/src/atoms/UpgradeCard/index.ts +2 -0
- package/src/atoms/UpgradeCard/preview.tsx +25 -0
- package/src/atoms/WorkspaceMenu/WorkspaceMenu.tsx +216 -0
- package/src/atoms/WorkspaceMenu/index.ts +2 -0
- package/src/atoms/WorkspaceMenu/preview.tsx +44 -0
- package/src/index.ts +16 -0
- package/src/tokens.css +165 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AppSidebar } from "./AppSidebar";
|
|
3
|
+
import { Button } from "../Button";
|
|
4
|
+
import type { NavEntry } from "./AppSidebar";
|
|
5
|
+
|
|
6
|
+
/* ─── Inline demo icons ─────────────────────────────────────────────────── */
|
|
7
|
+
|
|
8
|
+
const HomeIcon = () => (
|
|
9
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
10
|
+
<path d="M3 9.75L12 3l9 6.75V20a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9.75z" />
|
|
11
|
+
<polyline points="9 21 9 12 15 12 15 21" />
|
|
12
|
+
</svg>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const SearchIcon = () => (
|
|
16
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
17
|
+
<circle cx="11" cy="11" r="8" />
|
|
18
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
19
|
+
</svg>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const FolderIcon = () => (
|
|
23
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
24
|
+
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" />
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const StarIcon = () => (
|
|
29
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
30
|
+
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
|
|
31
|
+
</svg>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const SettingsIcon = () => (
|
|
35
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
36
|
+
<circle cx="12" cy="12" r="3" />
|
|
37
|
+
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
|
|
38
|
+
</svg>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const SubFileIcon = () => (
|
|
42
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "14px", height: "14px" }}>
|
|
43
|
+
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
|
|
44
|
+
<polyline points="14 2 14 8 20 8" />
|
|
45
|
+
</svg>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
/* ─── Scenario A: Full sidebar with deletable sub-items ─────────────────── */
|
|
49
|
+
|
|
50
|
+
function FullSidebarDemo() {
|
|
51
|
+
const [collapsed, setCollapsed] = React.useState(false);
|
|
52
|
+
const [activeId, setActiveId] = React.useState("projects");
|
|
53
|
+
const [activeSubId, setActiveSubId] = React.useState<string | undefined>("proj-alpha");
|
|
54
|
+
const [subItems, setSubItems] = React.useState([
|
|
55
|
+
{ id: "proj-alpha", label: "Alpha", icon: <SubFileIcon /> },
|
|
56
|
+
{ id: "proj-beta", label: "Beta", icon: <SubFileIcon /> },
|
|
57
|
+
{ id: "proj-gamma", label: "Gamma", icon: <SubFileIcon /> },
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
const handleDelete = (id: string) => {
|
|
61
|
+
setSubItems((prev) => prev.filter((s) => s.id !== id));
|
|
62
|
+
if (activeSubId === id) setActiveSubId(undefined);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const entries: NavEntry[] = [
|
|
66
|
+
{ id: "home", label: "Home", icon: <HomeIcon /> },
|
|
67
|
+
{ id: "search", label: "Search", icon: <SearchIcon /> },
|
|
68
|
+
{
|
|
69
|
+
id: "projects",
|
|
70
|
+
label: "Projects",
|
|
71
|
+
icon: <FolderIcon />,
|
|
72
|
+
subItems: subItems.map((s) => ({ ...s, onDelete: handleDelete })),
|
|
73
|
+
},
|
|
74
|
+
{ id: "starred", label: "Starred", icon: <StarIcon /> },
|
|
75
|
+
{ id: "settings", label: "Settings", icon: <SettingsIcon /> },
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div>
|
|
80
|
+
<p className="text-caption text-muted mb-sm">
|
|
81
|
+
Full footer · deletable sub-items (hover a project row to reveal the trash icon)
|
|
82
|
+
</p>
|
|
83
|
+
<div
|
|
84
|
+
className="relative flex bg-canvas rounded-xl border border-hairline shadow-card overflow-hidden"
|
|
85
|
+
style={{ height: "640px" }}
|
|
86
|
+
>
|
|
87
|
+
<AppSidebar
|
|
88
|
+
brandName="Lovable"
|
|
89
|
+
entries={entries}
|
|
90
|
+
activeId={activeId}
|
|
91
|
+
onSelect={setActiveId}
|
|
92
|
+
activeSubId={activeSubId}
|
|
93
|
+
onSubSelect={setActiveSubId}
|
|
94
|
+
collapsed={collapsed}
|
|
95
|
+
onCollapsedChange={setCollapsed}
|
|
96
|
+
workspaceName="Ofer's Lovable"
|
|
97
|
+
showShareCard
|
|
98
|
+
showUpgradeCard
|
|
99
|
+
userInitials="O"
|
|
100
|
+
onInboxClick={() => alert("Inbox clicked")}
|
|
101
|
+
/>
|
|
102
|
+
|
|
103
|
+
<div className="flex-1 flex flex-col items-center justify-center bg-surface-soft gap-md p-xl">
|
|
104
|
+
<p className="text-body-sm text-muted text-center">
|
|
105
|
+
{collapsed ? "Sidebar collapsed" : "Sidebar expanded"}
|
|
106
|
+
</p>
|
|
107
|
+
<p className="text-caption text-muted-soft text-center">
|
|
108
|
+
Active: <strong>{activeId}</strong>
|
|
109
|
+
{activeSubId && <> › <strong>{activeSubId}</strong></>}
|
|
110
|
+
</p>
|
|
111
|
+
{subItems.length === 0 && (
|
|
112
|
+
<p className="text-caption text-semantic-error">All projects deleted</p>
|
|
113
|
+
)}
|
|
114
|
+
<div className="flex flex-wrap gap-xs justify-center">
|
|
115
|
+
{entries.map((e) => (
|
|
116
|
+
<Button
|
|
117
|
+
key={e.id}
|
|
118
|
+
variant={activeId === e.id ? "primary" : "secondary"}
|
|
119
|
+
size="sm"
|
|
120
|
+
onClick={() => {
|
|
121
|
+
setActiveId(e.id);
|
|
122
|
+
if (!e.subItems) setActiveSubId(undefined);
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
{e.label}
|
|
126
|
+
</Button>
|
|
127
|
+
))}
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* ─── Scenario B: Minimal sidebar — no footer content at all ───────────── */
|
|
136
|
+
|
|
137
|
+
function MinimalSidebarDemo() {
|
|
138
|
+
const entries: NavEntry[] = [
|
|
139
|
+
{ id: "home", label: "Home", icon: <HomeIcon /> },
|
|
140
|
+
{ id: "search", label: "Search", icon: <SearchIcon /> },
|
|
141
|
+
{ id: "settings", label: "Settings", icon: <SettingsIcon /> },
|
|
142
|
+
];
|
|
143
|
+
|
|
144
|
+
const [activeId, setActiveId] = React.useState("home");
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<div>
|
|
148
|
+
<p className="text-caption text-muted mb-sm">
|
|
149
|
+
Minimal footer — no workspace, no cards, no avatar, no inbox (footer collapses to nothing)
|
|
150
|
+
</p>
|
|
151
|
+
<div
|
|
152
|
+
className="relative flex bg-canvas rounded-xl border border-hairline shadow-card overflow-hidden"
|
|
153
|
+
style={{ height: "400px" }}
|
|
154
|
+
>
|
|
155
|
+
<AppSidebar
|
|
156
|
+
brandName="Minimal"
|
|
157
|
+
entries={entries}
|
|
158
|
+
activeId={activeId}
|
|
159
|
+
onSelect={setActiveId}
|
|
160
|
+
/>
|
|
161
|
+
<div className="flex-1 flex items-center justify-center bg-surface-soft">
|
|
162
|
+
<p className="text-body-sm text-muted">No footer content</p>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* ─── Scenario C: Partial footer — avatar + inbox only ─────────────────── */
|
|
170
|
+
|
|
171
|
+
function PartialFooterDemo() {
|
|
172
|
+
const entries: NavEntry[] = [
|
|
173
|
+
{ id: "home", label: "Home", icon: <HomeIcon /> },
|
|
174
|
+
{ id: "starred", label: "Starred", icon: <StarIcon /> },
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
const [activeId, setActiveId] = React.useState("home");
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<div>
|
|
181
|
+
<p className="text-caption text-muted mb-sm">
|
|
182
|
+
Partial footer — only user avatar and inbox button (no promo cards)
|
|
183
|
+
</p>
|
|
184
|
+
<div
|
|
185
|
+
className="relative flex bg-canvas rounded-xl border border-hairline shadow-card overflow-hidden"
|
|
186
|
+
style={{ height: "320px" }}
|
|
187
|
+
>
|
|
188
|
+
<AppSidebar
|
|
189
|
+
brandName="Partial"
|
|
190
|
+
entries={entries}
|
|
191
|
+
activeId={activeId}
|
|
192
|
+
onSelect={setActiveId}
|
|
193
|
+
userInitials="AJ"
|
|
194
|
+
onInboxClick={() => {}}
|
|
195
|
+
/>
|
|
196
|
+
<div className="flex-1 flex items-center justify-center bg-surface-soft">
|
|
197
|
+
<p className="text-body-sm text-muted">Avatar + inbox only</p>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* ─── Main preview ──────────────────────────────────────────────────────── */
|
|
205
|
+
|
|
206
|
+
export default function AppSidebarPreview() {
|
|
207
|
+
return (
|
|
208
|
+
<div className="w-full max-w-4xl mx-auto p-lg space-y-xl">
|
|
209
|
+
<FullSidebarDemo />
|
|
210
|
+
<PartialFooterDemo />
|
|
211
|
+
<MinimalSidebarDemo />
|
|
212
|
+
</div>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import React, { useState, useId } from "react";
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
import { Input } from "../Input";
|
|
4
|
+
|
|
5
|
+
export type AuthTab = "login" | "signup";
|
|
6
|
+
|
|
7
|
+
export interface AuthScreenProps {
|
|
8
|
+
defaultTab?: AuthTab;
|
|
9
|
+
onLogin?: (values: { email: string; password: string }) => void;
|
|
10
|
+
onSignup?: (values: { name: string; email: string; password: string }) => void;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const AuthScreen = React.forwardRef<HTMLDivElement, AuthScreenProps>(
|
|
15
|
+
({ defaultTab = "login", onLogin, onSignup, loading = false }, ref) => {
|
|
16
|
+
const [tab, setTab] = useState<AuthTab>(defaultTab);
|
|
17
|
+
const [name, setName] = useState("");
|
|
18
|
+
const [email, setEmail] = useState("");
|
|
19
|
+
const [password, setPassword] = useState("");
|
|
20
|
+
const [confirm, setConfirm] = useState("");
|
|
21
|
+
const [error, setError] = useState<string | null>(null);
|
|
22
|
+
|
|
23
|
+
const nameId = useId();
|
|
24
|
+
const emailId = useId();
|
|
25
|
+
const passwordId = useId();
|
|
26
|
+
const confirmId = useId();
|
|
27
|
+
|
|
28
|
+
const switchTab = (t: AuthTab) => { setTab(t); setError(null); };
|
|
29
|
+
|
|
30
|
+
const handleSubmit = (e: React.FormEvent) => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
setError(null);
|
|
33
|
+
if (tab === "signup") {
|
|
34
|
+
if (password !== confirm) { setError("Passwords do not match."); return; }
|
|
35
|
+
onSignup?.({ name, email, password });
|
|
36
|
+
} else {
|
|
37
|
+
onLogin?.({ email, password });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const labelCls = "block text-body-sm text-body mb-xs font-weight-heading-sm";
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
/* Full-width page background — no height constraint */
|
|
45
|
+
<div ref={ref} className="w-full bg-surface p-xl">
|
|
46
|
+
{/* Center column — limits content width on ultra-wide screens */}
|
|
47
|
+
<div className="w-full max-w-3xl mx-auto flex justify-center">
|
|
48
|
+
{/* Login card — width set via style to avoid max-w-sm cramped-root trigger on the outer div */}
|
|
49
|
+
<div
|
|
50
|
+
style={{ width: "min(100%, 22rem)" }}
|
|
51
|
+
className="rounded-xl border border-hairline-soft bg-canvas px-xl py-xxl shadow-card"
|
|
52
|
+
>
|
|
53
|
+
{/* Logo */}
|
|
54
|
+
<div className="mb-lg flex justify-center">
|
|
55
|
+
<div className="flex h-14 w-10 items-center justify-center rounded-full bg-primary">
|
|
56
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
|
57
|
+
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"
|
|
58
|
+
stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
|
59
|
+
</svg>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
{/* Heading */}
|
|
64
|
+
<h1 className="mb-xs text-heading-sm text-ink">
|
|
65
|
+
{tab === "login" ? "Welcome back" : "Create an account"}
|
|
66
|
+
</h1>
|
|
67
|
+
<p className="mb-xl text-body-sm text-muted">
|
|
68
|
+
{tab === "login"
|
|
69
|
+
? "Sign in to continue to your workspace."
|
|
70
|
+
: "Start your journey — it only takes a minute."}
|
|
71
|
+
</p>
|
|
72
|
+
|
|
73
|
+
{/* Tab switcher */}
|
|
74
|
+
<div role="tablist" aria-label="Auth mode"
|
|
75
|
+
className="mb-xl flex rounded-lg bg-surface-soft p-xs gap-xs">
|
|
76
|
+
{(["login", "signup"] as AuthTab[]).map((t) => (
|
|
77
|
+
<Button
|
|
78
|
+
key={t}
|
|
79
|
+
role="tab"
|
|
80
|
+
type="button"
|
|
81
|
+
aria-selected={tab === t}
|
|
82
|
+
onClick={() => switchTab(t)}
|
|
83
|
+
variant="ghost"
|
|
84
|
+
size="sm"
|
|
85
|
+
style={{ flex: 1, whiteSpace: "normal" }}
|
|
86
|
+
className={[
|
|
87
|
+
"min-w-0 rounded-md py-sm transition-colors",
|
|
88
|
+
tab === t
|
|
89
|
+
? "bg-canvas text-ink shadow-sm font-weight-heading-sm"
|
|
90
|
+
: "text-muted hover:text-ink bg-transparent border-transparent",
|
|
91
|
+
].join(" ")}
|
|
92
|
+
>
|
|
93
|
+
{t === "login" ? "Log in" : "Sign up"}
|
|
94
|
+
</Button>
|
|
95
|
+
))}
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
{/* Form */}
|
|
99
|
+
<form onSubmit={handleSubmit} noValidate className="space-y-base">
|
|
100
|
+
{tab === "signup" && (
|
|
101
|
+
<div>
|
|
102
|
+
<label htmlFor={nameId} className={labelCls}>Full name</label>
|
|
103
|
+
<Input
|
|
104
|
+
id={nameId}
|
|
105
|
+
type="text"
|
|
106
|
+
autoComplete="name"
|
|
107
|
+
required
|
|
108
|
+
placeholder="Jane Doe"
|
|
109
|
+
value={name}
|
|
110
|
+
onChange={(e) => setName(e.target.value)}
|
|
111
|
+
fullWidth
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
)}
|
|
115
|
+
|
|
116
|
+
<div>
|
|
117
|
+
<label htmlFor={emailId} className={labelCls}>Email address</label>
|
|
118
|
+
<Input
|
|
119
|
+
id={emailId}
|
|
120
|
+
type="email"
|
|
121
|
+
autoComplete="email"
|
|
122
|
+
required
|
|
123
|
+
placeholder="you@example.com"
|
|
124
|
+
value={email}
|
|
125
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
126
|
+
fullWidth
|
|
127
|
+
/>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div>
|
|
131
|
+
<div className="mb-xs flex items-center justify-between">
|
|
132
|
+
<label htmlFor={passwordId} className={labelCls + " mb-0"}>Password</label>
|
|
133
|
+
{tab === "login" && (
|
|
134
|
+
<a href="#" className="text-body-sm text-primary hover:underline">
|
|
135
|
+
Forgot password?
|
|
136
|
+
</a>
|
|
137
|
+
)}
|
|
138
|
+
</div>
|
|
139
|
+
<Input
|
|
140
|
+
id={passwordId}
|
|
141
|
+
type="password"
|
|
142
|
+
required
|
|
143
|
+
autoComplete={tab === "login" ? "current-password" : "new-password"}
|
|
144
|
+
placeholder="••••••••"
|
|
145
|
+
value={password}
|
|
146
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
147
|
+
fullWidth
|
|
148
|
+
/>
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
{tab === "signup" && (
|
|
152
|
+
<div>
|
|
153
|
+
<label htmlFor={confirmId} className={labelCls}>Confirm password</label>
|
|
154
|
+
<Input
|
|
155
|
+
id={confirmId}
|
|
156
|
+
type="password"
|
|
157
|
+
autoComplete="new-password"
|
|
158
|
+
required
|
|
159
|
+
placeholder="••••••••"
|
|
160
|
+
value={confirm}
|
|
161
|
+
onChange={(e) => setConfirm(e.target.value)}
|
|
162
|
+
fullWidth
|
|
163
|
+
/>
|
|
164
|
+
</div>
|
|
165
|
+
)}
|
|
166
|
+
|
|
167
|
+
{error && (
|
|
168
|
+
<p role="alert"
|
|
169
|
+
className="rounded-md border border-semantic-error px-base py-sm text-body-sm text-semantic-error">
|
|
170
|
+
{error}
|
|
171
|
+
</p>
|
|
172
|
+
)}
|
|
173
|
+
|
|
174
|
+
<Button type="submit" variant="primary" size="lg" disabled={loading} className="w-full">
|
|
175
|
+
{loading ? "Please wait…" : tab === "login" ? "Sign in" : "Create account"}
|
|
176
|
+
</Button>
|
|
177
|
+
</form>
|
|
178
|
+
|
|
179
|
+
{/* Divider */}
|
|
180
|
+
<div className="my-xl flex items-center gap-base">
|
|
181
|
+
<div className="h-px flex-1 bg-hairline" />
|
|
182
|
+
<span className="text-caption text-muted-soft">OR</span>
|
|
183
|
+
<div className="h-px flex-1 bg-hairline" />
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
{/* Google */}
|
|
187
|
+
<Button type="button" variant="secondary" size="md" className="w-full">
|
|
188
|
+
<svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24" className="shrink-0">
|
|
189
|
+
<path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" fill="var(--color-google-blue)" />
|
|
190
|
+
<path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="var(--color-google-green)" />
|
|
191
|
+
<path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z" fill="var(--color-google-yellow)" />
|
|
192
|
+
<path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="var(--color-google-red)" />
|
|
193
|
+
</svg>
|
|
194
|
+
Continue with Google
|
|
195
|
+
</Button>
|
|
196
|
+
|
|
197
|
+
{/* Footer */}
|
|
198
|
+
<p className="mt-xl text-center text-body-sm text-muted">
|
|
199
|
+
{tab === "login" ? (
|
|
200
|
+
<>Don’t have an account?{" "}
|
|
201
|
+
<Button type="button" variant="ghost" size="sm"
|
|
202
|
+
onClick={() => switchTab("signup")}
|
|
203
|
+
style={{ whiteSpace: "normal" }}
|
|
204
|
+
className="text-primary hover:underline bg-transparent border-transparent p-0 h-auto">
|
|
205
|
+
Sign up
|
|
206
|
+
</Button>
|
|
207
|
+
</>
|
|
208
|
+
) : (
|
|
209
|
+
<>Already have an account?{" "}
|
|
210
|
+
<Button type="button" variant="ghost" size="sm"
|
|
211
|
+
onClick={() => switchTab("login")}
|
|
212
|
+
style={{ whiteSpace: "normal" }}
|
|
213
|
+
className="text-primary hover:underline bg-transparent border-transparent p-0 h-auto">
|
|
214
|
+
Log in
|
|
215
|
+
</Button>
|
|
216
|
+
</>
|
|
217
|
+
)}
|
|
218
|
+
</p>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
AuthScreen.displayName = "AuthScreen";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export type ButtonVariant = "primary" | "secondary" | "ghost" | "destructive";
|
|
4
|
+
export type ButtonSize = "sm" | "md" | "lg";
|
|
5
|
+
|
|
6
|
+
export interface ButtonProps
|
|
7
|
+
extends React.ComponentPropsWithoutRef<"button"> {
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
size?: ButtonSize;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const variantClasses: Record<ButtonVariant, string> = {
|
|
14
|
+
primary:
|
|
15
|
+
"bg-primary text-on-primary hover:bg-primary-hover active:bg-primary-active disabled:bg-primary-disabled disabled:text-on-primary disabled:cursor-not-allowed border border-transparent",
|
|
16
|
+
secondary:
|
|
17
|
+
"bg-canvas text-ink hover:bg-surface-soft active:bg-surface-strong disabled:opacity-50 disabled:cursor-not-allowed border border-hairline",
|
|
18
|
+
ghost:
|
|
19
|
+
"bg-transparent text-ink hover:bg-surface-soft active:bg-surface-strong disabled:opacity-50 disabled:cursor-not-allowed border border-transparent",
|
|
20
|
+
destructive:
|
|
21
|
+
"bg-semantic-error text-on-primary hover:brightness-90 active:brightness-75 disabled:opacity-50 disabled:cursor-not-allowed border border-transparent",
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const sizeClasses: Record<ButtonSize, string> = {
|
|
25
|
+
sm: "px-md py-xs text-body-sm rounded-md",
|
|
26
|
+
md: "px-lg py-sm text-body-md rounded-xl",
|
|
27
|
+
lg: "px-xl py-md text-body-lg rounded-xl",
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
31
|
+
(
|
|
32
|
+
{
|
|
33
|
+
variant = "primary",
|
|
34
|
+
size = "md",
|
|
35
|
+
loading = false,
|
|
36
|
+
disabled,
|
|
37
|
+
children,
|
|
38
|
+
className,
|
|
39
|
+
...rest
|
|
40
|
+
},
|
|
41
|
+
ref,
|
|
42
|
+
) => {
|
|
43
|
+
const isDisabled = disabled || loading;
|
|
44
|
+
|
|
45
|
+
const base =
|
|
46
|
+
"inline-flex items-center justify-center gap-sm font-weight-heading-sm transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-focus focus-visible:ring-offset-2 select-none whitespace-nowrap";
|
|
47
|
+
|
|
48
|
+
const classes = [base, variantClasses[variant], sizeClasses[size], className]
|
|
49
|
+
.filter(Boolean)
|
|
50
|
+
.join(" ");
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<button ref={ref} disabled={isDisabled} className={classes} {...rest}>
|
|
54
|
+
{loading && (
|
|
55
|
+
<svg
|
|
56
|
+
aria-hidden="true"
|
|
57
|
+
className="size-4 animate-spin"
|
|
58
|
+
viewBox="0 0 24 24"
|
|
59
|
+
fill="none"
|
|
60
|
+
>
|
|
61
|
+
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
|
|
62
|
+
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z" />
|
|
63
|
+
</svg>
|
|
64
|
+
)}
|
|
65
|
+
{children}
|
|
66
|
+
</button>
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
Button.displayName = "Button";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button } from "./Button";
|
|
3
|
+
|
|
4
|
+
export default function ButtonPreview() {
|
|
5
|
+
return (
|
|
6
|
+
<div className="w-full max-w-3xl mx-auto p-lg">
|
|
7
|
+
{/* Header */}
|
|
8
|
+
<h2 className="text-heading-md text-ink mb-lg">Buttons</h2>
|
|
9
|
+
|
|
10
|
+
{/* Main variant showcase — matches reference layout */}
|
|
11
|
+
<div className="w-full bg-surface rounded-xl border border-hairline p-lg">
|
|
12
|
+
<div className="flex flex-wrap items-end gap-xl">
|
|
13
|
+
{/* Primary */}
|
|
14
|
+
<div className="flex flex-col items-center gap-sm">
|
|
15
|
+
<span className="text-body-sm text-muted">Primary</span>
|
|
16
|
+
<Button variant="primary" size="md">Primary</Button>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
{/* Primary Hover (forced style) */}
|
|
20
|
+
<div className="flex flex-col items-center gap-sm">
|
|
21
|
+
<span className="text-body-sm text-muted">Primary Hover</span>
|
|
22
|
+
<button
|
|
23
|
+
className="inline-flex items-center justify-center gap-sm font-weight-heading-sm transition-colors duration-150 px-lg py-sm text-body-md rounded-xl bg-primary-hover text-on-primary border border-transparent select-none whitespace-nowrap"
|
|
24
|
+
>
|
|
25
|
+
Primary
|
|
26
|
+
</button>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
{/* Secondary */}
|
|
30
|
+
<div className="flex flex-col items-center gap-sm">
|
|
31
|
+
<span className="text-body-sm text-muted">Secondary</span>
|
|
32
|
+
<Button variant="secondary" size="md">Secondary</Button>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
{/* Ghost */}
|
|
36
|
+
<div className="flex flex-col items-center gap-sm">
|
|
37
|
+
<span className="text-body-sm text-muted">Ghost</span>
|
|
38
|
+
<Button variant="ghost" size="md">Ghost</Button>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
{/* Destructive */}
|
|
42
|
+
<div className="flex flex-col items-center gap-sm">
|
|
43
|
+
<span className="text-body-sm text-muted">Destructive</span>
|
|
44
|
+
<Button variant="destructive" size="md">Delete</Button>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
{/* Size scale */}
|
|
50
|
+
<div className="mt-lg">
|
|
51
|
+
<h3 className="text-heading-sm text-ink mb-md">Sizes</h3>
|
|
52
|
+
<div className="flex flex-wrap items-center gap-md">
|
|
53
|
+
<Button variant="primary" size="sm">Small</Button>
|
|
54
|
+
<Button variant="primary" size="md">Medium</Button>
|
|
55
|
+
<Button variant="primary" size="lg">Large</Button>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
{/* States */}
|
|
60
|
+
<div className="mt-lg">
|
|
61
|
+
<h3 className="text-heading-sm text-ink mb-md">States</h3>
|
|
62
|
+
<div className="flex flex-wrap items-center gap-md">
|
|
63
|
+
<Button variant="primary" disabled>Disabled</Button>
|
|
64
|
+
<Button variant="primary" loading>Loading</Button>
|
|
65
|
+
<Button variant="secondary" disabled>Disabled</Button>
|
|
66
|
+
<Button variant="destructive" disabled>Disabled</Button>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|