@designa8/vibedesign-v6 1.20.20 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +224 -138
- package/src/atoms/AppSidebar/index.ts +1 -1
- package/src/atoms/AppSidebar/preview.tsx +61 -8
- package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +242 -173
- 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/ExportDesignMdModal/ExportDesignMdModal.tsx +6 -1
- 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/Menu/Menu.tsx +1 -1
- 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
package/src/atoms/Chip/Chip.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { Button } from "../Button";
|
|
3
|
+
import { Modal } from "../Modal";
|
|
4
|
+
import { Icon } from "../Icon";
|
|
3
5
|
|
|
4
6
|
export type ChipVariant = "default" | "primary" | "success" | "warning" | "error";
|
|
5
7
|
export type ChipSize = "sm" | "md" | "lg";
|
|
@@ -11,8 +13,13 @@ export interface ChipProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
11
13
|
variant?: ChipVariant;
|
|
12
14
|
/** Size of the chip */
|
|
13
15
|
size?: ChipSize;
|
|
14
|
-
/** Optional leading icon element */
|
|
16
|
+
/** Optional leading icon element. Ignored when `imageSrc` is set. */
|
|
15
17
|
icon?: React.ReactNode;
|
|
18
|
+
/** URL of a leading square thumbnail. Renders before the label and, when
|
|
19
|
+
* set, opens a fullscreen lightbox on click (unless the chip is disabled). */
|
|
20
|
+
imageSrc?: string;
|
|
21
|
+
/** Alt text for the thumbnail. Falls back to `label`. */
|
|
22
|
+
imageAlt?: string;
|
|
16
23
|
/** If provided, renders a dismiss (×) button and calls this handler on click */
|
|
17
24
|
onDismiss?: () => void;
|
|
18
25
|
/** Disabled state — mutes colors and prevents interactions */
|
|
@@ -32,29 +39,13 @@ const variantClasses: Record<ChipVariant, string> = {
|
|
|
32
39
|
|
|
33
40
|
const sizeClasses: Record<
|
|
34
41
|
ChipSize,
|
|
35
|
-
{ chip: string; text: string; icon: string; dismissSize: "sm" }
|
|
42
|
+
{ chip: string; text: string; icon: string; thumb: string; dismissSize: "sm" }
|
|
36
43
|
> = {
|
|
37
|
-
sm: { chip: "h-6 px-xs gap-xs rounded-xs", text: "text-caption", icon: "w-3 h-3", dismissSize: "sm" },
|
|
38
|
-
md: { chip: "h-8 px-sm gap-xs rounded-sm", text: "text-body-sm", icon: "w-4 h-4", dismissSize: "sm" },
|
|
39
|
-
lg: { chip: "h-10 px-md gap-sm rounded-md", text: "text-body-md", icon: "w-5 h-5", dismissSize: "sm" },
|
|
44
|
+
sm: { chip: "h-6 px-xs gap-xs rounded-xs", text: "text-caption", icon: "w-3 h-3", thumb: "w-4 h-4", dismissSize: "sm" },
|
|
45
|
+
md: { chip: "h-8 px-sm gap-xs rounded-sm", text: "text-body-sm", icon: "w-4 h-4", thumb: "w-5 h-5", dismissSize: "sm" },
|
|
46
|
+
lg: { chip: "h-10 px-md gap-sm rounded-md", text: "text-body-md", icon: "w-5 h-5", thumb: "w-6 h-6", dismissSize: "sm" },
|
|
40
47
|
};
|
|
41
48
|
|
|
42
|
-
/** Inline close icon used inside the dismiss Button */
|
|
43
|
-
const CloseIcon = ({ className }: { className?: string }) => (
|
|
44
|
-
<svg
|
|
45
|
-
viewBox="0 0 16 16"
|
|
46
|
-
fill="none"
|
|
47
|
-
stroke="currentColor"
|
|
48
|
-
strokeWidth={2.5}
|
|
49
|
-
strokeLinecap="round"
|
|
50
|
-
className={className}
|
|
51
|
-
aria-hidden="true"
|
|
52
|
-
>
|
|
53
|
-
<line x1="4" y1="4" x2="12" y2="12" />
|
|
54
|
-
<line x1="12" y1="4" x2="4" y2="12" />
|
|
55
|
-
</svg>
|
|
56
|
-
);
|
|
57
|
-
|
|
58
49
|
export const Chip = React.forwardRef<HTMLSpanElement, ChipProps>(
|
|
59
50
|
(
|
|
60
51
|
{
|
|
@@ -62,6 +53,8 @@ export const Chip = React.forwardRef<HTMLSpanElement, ChipProps>(
|
|
|
62
53
|
variant = "default",
|
|
63
54
|
size = "md",
|
|
64
55
|
icon,
|
|
56
|
+
imageSrc,
|
|
57
|
+
imageAlt,
|
|
65
58
|
onDismiss,
|
|
66
59
|
disabled = false,
|
|
67
60
|
className = "",
|
|
@@ -71,8 +64,22 @@ export const Chip = React.forwardRef<HTMLSpanElement, ChipProps>(
|
|
|
71
64
|
) => {
|
|
72
65
|
const sz = sizeClasses[size];
|
|
73
66
|
const vr = variantClasses[variant];
|
|
67
|
+
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
74
68
|
|
|
75
69
|
const disabledStyles = disabled ? "opacity-50 pointer-events-none select-none" : "";
|
|
70
|
+
const isLightboxTrigger = Boolean(imageSrc) && !disabled;
|
|
71
|
+
|
|
72
|
+
const openLightbox = () => {
|
|
73
|
+
if (isLightboxTrigger) setLightboxOpen(true);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const handleBodyKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>) => {
|
|
77
|
+
if (!isLightboxTrigger) return;
|
|
78
|
+
if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
openLightbox();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
76
83
|
|
|
77
84
|
return (
|
|
78
85
|
<span
|
|
@@ -90,29 +97,70 @@ export const Chip = React.forwardRef<HTMLSpanElement, ChipProps>(
|
|
|
90
97
|
.join(" ")}
|
|
91
98
|
{...props}
|
|
92
99
|
>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
<span
|
|
101
|
+
className="inline-flex items-center gap-xs"
|
|
102
|
+
onClick={isLightboxTrigger ? openLightbox : undefined}
|
|
103
|
+
onKeyDown={isLightboxTrigger ? handleBodyKeyDown : undefined}
|
|
104
|
+
role={isLightboxTrigger ? "button" : undefined}
|
|
105
|
+
tabIndex={isLightboxTrigger ? 0 : undefined}
|
|
106
|
+
aria-label={isLightboxTrigger ? `View image for ${label}` : undefined}
|
|
107
|
+
style={isLightboxTrigger ? { cursor: "pointer" } : undefined}
|
|
108
|
+
>
|
|
109
|
+
{imageSrc ? (
|
|
110
|
+
<span
|
|
111
|
+
className={`${sz.thumb} flex-shrink-0 rounded-xs overflow-hidden inline-block`}
|
|
112
|
+
aria-hidden="true"
|
|
113
|
+
>
|
|
114
|
+
<img
|
|
115
|
+
src={imageSrc}
|
|
116
|
+
alt={imageAlt || label}
|
|
117
|
+
className="w-full h-full object-cover"
|
|
118
|
+
/>
|
|
119
|
+
</span>
|
|
120
|
+
) : (
|
|
121
|
+
icon && (
|
|
122
|
+
<span
|
|
123
|
+
className={`${sz.icon} flex-shrink-0 flex items-center justify-center`}
|
|
124
|
+
aria-hidden="true"
|
|
125
|
+
>
|
|
126
|
+
{icon}
|
|
127
|
+
</span>
|
|
128
|
+
)
|
|
129
|
+
)}
|
|
101
130
|
|
|
102
|
-
|
|
131
|
+
<span className={sz.text}>{label}</span>
|
|
132
|
+
</span>
|
|
103
133
|
|
|
104
134
|
{onDismiss && (
|
|
105
135
|
<Button
|
|
106
136
|
variant="ghost"
|
|
107
137
|
size={sz.dismissSize}
|
|
108
|
-
onClick={
|
|
138
|
+
onClick={(e) => {
|
|
139
|
+
e.stopPropagation();
|
|
140
|
+
onDismiss();
|
|
141
|
+
}}
|
|
109
142
|
disabled={disabled}
|
|
110
143
|
aria-label={`Remove ${label}`}
|
|
111
144
|
className="!p-0 !h-4 !w-4 !min-w-0 opacity-60 hover:opacity-100 rounded-full flex-shrink-0"
|
|
112
145
|
>
|
|
113
|
-
<
|
|
146
|
+
<Icon name="close" className="w-3 h-3" />
|
|
114
147
|
</Button>
|
|
115
148
|
)}
|
|
149
|
+
|
|
150
|
+
{imageSrc && (
|
|
151
|
+
<Modal
|
|
152
|
+
isOpen={lightboxOpen}
|
|
153
|
+
onClose={() => setLightboxOpen(false)}
|
|
154
|
+
title={label}
|
|
155
|
+
size="full"
|
|
156
|
+
>
|
|
157
|
+
<img
|
|
158
|
+
src={imageSrc}
|
|
159
|
+
alt={imageAlt || label}
|
|
160
|
+
className="max-w-full max-h-full object-contain mx-auto"
|
|
161
|
+
/>
|
|
162
|
+
</Modal>
|
|
163
|
+
)}
|
|
116
164
|
</span>
|
|
117
165
|
);
|
|
118
166
|
}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { Chip } from "./Chip";
|
|
3
|
-
|
|
4
|
-
const TagIcon = () => (
|
|
5
|
-
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth={1.75} strokeLinecap="round" strokeLinejoin="round" className="w-full h-full">
|
|
6
|
-
<path d="M2 2h5l7 7-5 5-7-7V2z" />
|
|
7
|
-
<circle cx="5" cy="5" r="1" fill="currentColor" stroke="none" />
|
|
8
|
-
</svg>
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
const StarIcon = () => (
|
|
12
|
-
<svg viewBox="0 0 16 16" fill="currentColor" className="w-full h-full">
|
|
13
|
-
<path d="M8 1l1.8 3.6L14 5.3l-3 2.9.7 4.1L8 10.4l-3.7 1.9.7-4.1-3-2.9 4.2-.7z" />
|
|
14
|
-
</svg>
|
|
15
|
-
);
|
|
3
|
+
import { Icon } from "../Icon";
|
|
16
4
|
|
|
17
5
|
export default function ChipPreview() {
|
|
18
6
|
const [tags, setTags] = useState(["Design", "React", "TypeScript", "Figma"]);
|
|
7
|
+
const [photoTags, setPhotoTags] = useState(["Sunset"]);
|
|
19
8
|
|
|
20
9
|
const removeTag = (tag: string) => setTags((prev) => prev.filter((t) => t !== tag));
|
|
10
|
+
const removePhotoTag = (tag: string) => setPhotoTags((prev) => prev.filter((t) => t !== tag));
|
|
11
|
+
|
|
12
|
+
const placeholderImgA =
|
|
13
|
+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Crect width='64' height='64' fill='%236366f1'/%3E%3C/svg%3E";
|
|
14
|
+
const placeholderImgB =
|
|
15
|
+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Crect width='64' height='64' fill='%23f59e0b'/%3E%3C/svg%3E";
|
|
21
16
|
|
|
22
17
|
return (
|
|
23
18
|
<div className="w-full max-w-3xl mx-auto p-lg space-y-xl">
|
|
@@ -48,11 +43,11 @@ export default function ChipPreview() {
|
|
|
48
43
|
<section className="space-y-sm">
|
|
49
44
|
<p className="text-caption text-muted uppercase tracking-wide">With Leading Icon</p>
|
|
50
45
|
<div className="flex flex-wrap gap-sm items-center">
|
|
51
|
-
<Chip label="
|
|
52
|
-
<Chip label="Featured" variant="primary" icon={<
|
|
53
|
-
<Chip label="Success" variant="success" icon={<
|
|
54
|
-
<Chip label="Warning" variant="warning" icon={<
|
|
55
|
-
<Chip label="Error" variant="error" icon={<
|
|
46
|
+
<Chip label="Sparkle" variant="default" icon={<Icon name="sparkle" className="w-full h-full" />} />
|
|
47
|
+
<Chip label="Featured" variant="primary" icon={<Icon name="star" className="w-full h-full" />} />
|
|
48
|
+
<Chip label="Success" variant="success" icon={<Icon name="star" className="w-full h-full" />} />
|
|
49
|
+
<Chip label="Warning" variant="warning" icon={<Icon name="sparkle" className="w-full h-full" />} />
|
|
50
|
+
<Chip label="Error" variant="error" icon={<Icon name="star" className="w-full h-full" />} />
|
|
56
51
|
</div>
|
|
57
52
|
</section>
|
|
58
53
|
|
|
@@ -78,10 +73,32 @@ export default function ChipPreview() {
|
|
|
78
73
|
<section className="space-y-sm">
|
|
79
74
|
<p className="text-caption text-muted uppercase tracking-wide">Dismissible + Icon</p>
|
|
80
75
|
<div className="flex flex-wrap gap-sm items-center">
|
|
81
|
-
<Chip label="Design" variant="primary" icon={<
|
|
82
|
-
<Chip label="Approved" variant="success" icon={<
|
|
83
|
-
<Chip label="Overdue" variant="error" icon={<
|
|
76
|
+
<Chip label="Design" variant="primary" icon={<Icon name="sparkle" className="w-full h-full" />} onDismiss={() => {}} />
|
|
77
|
+
<Chip label="Approved" variant="success" icon={<Icon name="star" className="w-full h-full" />} onDismiss={() => {}} />
|
|
78
|
+
<Chip label="Overdue" variant="error" icon={<Icon name="warning-triangle-alert" className="w-full h-full" />} onDismiss={() => {}} />
|
|
79
|
+
</div>
|
|
80
|
+
</section>
|
|
81
|
+
|
|
82
|
+
{/* Image + dismiss + lightbox */}
|
|
83
|
+
<section className="space-y-sm">
|
|
84
|
+
<p className="text-caption text-muted uppercase tracking-wide">Image + dismiss + lightbox</p>
|
|
85
|
+
<div className="flex flex-wrap gap-sm items-center">
|
|
86
|
+
<Chip label="Cover photo" variant="default" imageSrc={placeholderImgA} imageAlt="Indigo cover thumbnail" />
|
|
87
|
+
{photoTags.map((tag) => (
|
|
88
|
+
<Chip
|
|
89
|
+
key={tag}
|
|
90
|
+
label={tag}
|
|
91
|
+
variant="default"
|
|
92
|
+
imageSrc={placeholderImgB}
|
|
93
|
+
imageAlt="Amber sunset thumbnail"
|
|
94
|
+
onDismiss={() => removePhotoTag(tag)}
|
|
95
|
+
/>
|
|
96
|
+
))}
|
|
97
|
+
{photoTags.length === 0 && (
|
|
98
|
+
<span className="text-body-sm text-muted italic">Removed</span>
|
|
99
|
+
)}
|
|
84
100
|
</div>
|
|
101
|
+
<p className="text-caption text-muted">Click a chip's thumbnail or label to open it fullscreen.</p>
|
|
85
102
|
</section>
|
|
86
103
|
|
|
87
104
|
{/* Disabled */}
|
|
@@ -91,6 +108,7 @@ export default function ChipPreview() {
|
|
|
91
108
|
<Chip label="Default" variant="default" disabled />
|
|
92
109
|
<Chip label="Primary" variant="primary" disabled />
|
|
93
110
|
<Chip label="Error" variant="error" disabled onDismiss={() => {}} />
|
|
111
|
+
<Chip label="Image (disabled)" variant="default" disabled imageSrc={placeholderImgA} />
|
|
94
112
|
</div>
|
|
95
113
|
</section>
|
|
96
114
|
|
|
@@ -256,9 +256,15 @@ export const CodeEditor = React.forwardRef<HTMLDivElement, CodeEditorProps>(
|
|
|
256
256
|
<div
|
|
257
257
|
ref={ref}
|
|
258
258
|
data-theme={dark ? "dark" : undefined}
|
|
259
|
-
className={[
|
|
259
|
+
className={[
|
|
260
|
+
"flex h-full w-full min-h-0 overflow-hidden rounded-lg border border-hairline bg-canvas text-ink",
|
|
261
|
+
className,
|
|
262
|
+
].join(" ")}
|
|
260
263
|
>
|
|
261
|
-
<aside
|
|
264
|
+
<aside
|
|
265
|
+
className="flex h-full min-h-0 w-56 shrink-0 flex-col overflow-y-auto border-r border-hairline bg-canvas"
|
|
266
|
+
style={{ overscrollBehavior: "contain" }}
|
|
267
|
+
>
|
|
262
268
|
<div className="flex items-center justify-between px-lg py-md">
|
|
263
269
|
<span className="text-caption font-weight-heading-sm uppercase tracking-widest text-muted-soft">
|
|
264
270
|
Files
|
|
@@ -299,7 +305,7 @@ export const CodeEditor = React.forwardRef<HTMLDivElement, CodeEditorProps>(
|
|
|
299
305
|
</nav>
|
|
300
306
|
</aside>
|
|
301
307
|
|
|
302
|
-
<div className="flex min-w-0 flex-1 flex-col overflow-hidden bg-canvas">
|
|
308
|
+
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-canvas">
|
|
303
309
|
<div className="flex items-center justify-between border-b border-hairline bg-surface-soft px-lg py-sm">
|
|
304
310
|
<div className="flex min-w-0 items-center gap-sm font-mono text-caption text-muted">
|
|
305
311
|
{current ? <LangBadge language={current.language} /> : null}
|
|
@@ -320,7 +326,7 @@ export const CodeEditor = React.forwardRef<HTMLDivElement, CodeEditorProps>(
|
|
|
320
326
|
</Button>
|
|
321
327
|
</div>
|
|
322
328
|
|
|
323
|
-
<div className="flex-1 overflow-auto bg-canvas">
|
|
329
|
+
<div className="min-h-0 flex-1 overflow-auto bg-canvas" style={{ overscrollBehavior: "contain" }}>
|
|
324
330
|
{readOnly || streaming ? (
|
|
325
331
|
<pre className="m-0 p-0 text-body-sm leading-[1.55] text-ink">
|
|
326
332
|
{lines.map((line, i) => (
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { BottomSheet } from "../BottomSheet";
|
|
3
|
+
import { Button } from "../Button";
|
|
4
|
+
import { Icon } from "../Icon";
|
|
5
|
+
|
|
6
|
+
type IconName = React.ComponentProps<typeof Icon>["name"];
|
|
7
|
+
|
|
8
|
+
export type ComponentActionType = "action" | "toggle" | "nav" | "primary" | "info";
|
|
9
|
+
|
|
10
|
+
export interface ComponentActionItem {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
icon?: IconName;
|
|
14
|
+
meta?: string;
|
|
15
|
+
type?: ComponentActionType;
|
|
16
|
+
checked?: boolean;
|
|
17
|
+
destructive?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ComponentActionSection {
|
|
21
|
+
id: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
items: ComponentActionItem[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ComponentActionsSheetProps {
|
|
27
|
+
open: boolean;
|
|
28
|
+
onOpenChange: (open: boolean) => void;
|
|
29
|
+
title?: string;
|
|
30
|
+
sections: ComponentActionSection[];
|
|
31
|
+
onSelect?: (id: string) => void;
|
|
32
|
+
onToggle?: (id: string, checked: boolean) => void;
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const rowBase =
|
|
37
|
+
"flex min-h-xxl w-full items-center gap-md rounded-lg px-xs py-sm text-left";
|
|
38
|
+
|
|
39
|
+
const rowInteractive =
|
|
40
|
+
"cursor-pointer transition duration-150 ease-out hover:bg-surface-soft active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue";
|
|
41
|
+
|
|
42
|
+
export const ComponentActionsSheet = React.forwardRef<HTMLDivElement, ComponentActionsSheetProps>(
|
|
43
|
+
({ open, onOpenChange, title = "Component actions", sections, onSelect, onToggle, className }, ref) => {
|
|
44
|
+
return (
|
|
45
|
+
<BottomSheet
|
|
46
|
+
ref={ref}
|
|
47
|
+
open={open}
|
|
48
|
+
onOpenChange={onOpenChange}
|
|
49
|
+
title={title}
|
|
50
|
+
size="auto"
|
|
51
|
+
className={className}
|
|
52
|
+
>
|
|
53
|
+
<div
|
|
54
|
+
data-state={open ? "open" : "closed"}
|
|
55
|
+
className="flex flex-col gap-md pb-sm transition-opacity duration-200 ease-out data-[state=open]:opacity-100 data-[state=closed]:opacity-0"
|
|
56
|
+
>
|
|
57
|
+
{sections.map((section) => (
|
|
58
|
+
<section key={section.id} className="flex flex-col gap-xs">
|
|
59
|
+
{section.label ? (
|
|
60
|
+
<h3 className="px-xs text-caption text-muted uppercase">{section.label}</h3>
|
|
61
|
+
) : null}
|
|
62
|
+
<div className="flex flex-col">
|
|
63
|
+
{section.items.map((item) => {
|
|
64
|
+
const type = item.type ?? "action";
|
|
65
|
+
|
|
66
|
+
if (type === "info") {
|
|
67
|
+
return (
|
|
68
|
+
<div key={item.id} className={rowBase}>
|
|
69
|
+
{item.icon ? (
|
|
70
|
+
<span className="flex size-xl shrink-0 items-center justify-center rounded-full bg-surface-soft text-body">
|
|
71
|
+
<Icon name={item.icon} size={18} />
|
|
72
|
+
</span>
|
|
73
|
+
) : null}
|
|
74
|
+
<span className="min-w-0 flex-1 truncate text-body-md text-ink">{item.label}</span>
|
|
75
|
+
{item.meta ? (
|
|
76
|
+
<span className="shrink-0 text-body-sm text-muted">{item.meta}</span>
|
|
77
|
+
) : null}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (type === "primary") {
|
|
83
|
+
return (
|
|
84
|
+
<Button
|
|
85
|
+
key={item.id}
|
|
86
|
+
type="button"
|
|
87
|
+
variant="primary"
|
|
88
|
+
className="mt-xs w-full"
|
|
89
|
+
onClick={() => onSelect?.(item.id)}
|
|
90
|
+
>
|
|
91
|
+
{item.icon ? <Icon name={item.icon} size={16} /> : null}
|
|
92
|
+
{item.label}
|
|
93
|
+
</Button>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const isToggle = type === "toggle";
|
|
98
|
+
const checked = Boolean(item.checked);
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<button
|
|
102
|
+
key={item.id}
|
|
103
|
+
type="button"
|
|
104
|
+
role={isToggle ? "switch" : undefined}
|
|
105
|
+
aria-checked={isToggle ? checked : undefined}
|
|
106
|
+
onClick={() => {
|
|
107
|
+
if (isToggle) onToggle?.(item.id, !checked);
|
|
108
|
+
else onSelect?.(item.id);
|
|
109
|
+
}}
|
|
110
|
+
className={[rowBase, rowInteractive].join(" ")}
|
|
111
|
+
>
|
|
112
|
+
{item.icon ? (
|
|
113
|
+
<span
|
|
114
|
+
className={[
|
|
115
|
+
"flex size-xl shrink-0 items-center justify-center rounded-full",
|
|
116
|
+
item.destructive
|
|
117
|
+
? "bg-semantic-error-soft text-semantic-error"
|
|
118
|
+
: "bg-surface-soft text-body",
|
|
119
|
+
].join(" ")}
|
|
120
|
+
>
|
|
121
|
+
<Icon name={item.icon} size={18} />
|
|
122
|
+
</span>
|
|
123
|
+
) : null}
|
|
124
|
+
<span
|
|
125
|
+
className={[
|
|
126
|
+
"min-w-0 flex-1 truncate text-body-md",
|
|
127
|
+
item.destructive ? "text-semantic-error" : "text-ink",
|
|
128
|
+
].join(" ")}
|
|
129
|
+
>
|
|
130
|
+
{item.label}
|
|
131
|
+
</span>
|
|
132
|
+
{item.meta ? (
|
|
133
|
+
<span className="shrink-0 text-body-sm text-muted">{item.meta}</span>
|
|
134
|
+
) : null}
|
|
135
|
+
{isToggle ? (
|
|
136
|
+
<span
|
|
137
|
+
aria-hidden="true"
|
|
138
|
+
className={[
|
|
139
|
+
"flex h-lg w-xxl shrink-0 items-center rounded-full px-xs transition-colors duration-200 ease-out",
|
|
140
|
+
checked ? "bg-primary" : "bg-surface-strong",
|
|
141
|
+
].join(" ")}
|
|
142
|
+
>
|
|
143
|
+
<span
|
|
144
|
+
className={[
|
|
145
|
+
"size-base shrink-0 rounded-full bg-canvas shadow-sm transition-transform duration-200 ease-out",
|
|
146
|
+
checked ? "translate-x-lg" : "translate-x-0",
|
|
147
|
+
].join(" ")}
|
|
148
|
+
/>
|
|
149
|
+
</span>
|
|
150
|
+
) : type === "nav" ? (
|
|
151
|
+
<Icon name="chevron-right" size={16} className="shrink-0 text-muted-soft" />
|
|
152
|
+
) : null}
|
|
153
|
+
</button>
|
|
154
|
+
);
|
|
155
|
+
})}
|
|
156
|
+
</div>
|
|
157
|
+
</section>
|
|
158
|
+
))}
|
|
159
|
+
</div>
|
|
160
|
+
</BottomSheet>
|
|
161
|
+
);
|
|
162
|
+
},
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
ComponentActionsSheet.displayName = "ComponentActionsSheet";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ComponentActionsSheet, type ComponentActionSection } from "./ComponentActionsSheet";
|
|
3
|
+
|
|
4
|
+
export default function Preview() {
|
|
5
|
+
const [open, setOpen] = React.useState(false);
|
|
6
|
+
const [lastAction, setLastAction] = React.useState<string>("none");
|
|
7
|
+
const [toggles, setToggles] = React.useState<Record<string, boolean>>({
|
|
8
|
+
responsive: true,
|
|
9
|
+
darkmode: false,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const sections: ComponentActionSection[] = [
|
|
13
|
+
{
|
|
14
|
+
id: "info",
|
|
15
|
+
items: [{ id: "kind", label: "Kind", icon: "layers", meta: "Organism", type: "info" }],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "view",
|
|
19
|
+
label: "View",
|
|
20
|
+
items: [
|
|
21
|
+
{ id: "responsive", label: "Responsive preview", icon: "mobile-phone", type: "toggle", checked: toggles.responsive },
|
|
22
|
+
{ id: "darkmode", label: "Dark mode", icon: "moon-dark-mode", type: "toggle", checked: toggles.darkmode },
|
|
23
|
+
{ id: "code", label: "View code", icon: "file-document", type: "nav" },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "manage",
|
|
28
|
+
label: "Manage",
|
|
29
|
+
items: [
|
|
30
|
+
{ id: "copy", label: "Copy source", icon: "copy-clipboard", meta: "tsx" },
|
|
31
|
+
{ id: "rename", label: "Rename", icon: "pencil-edit" },
|
|
32
|
+
{ id: "delete", label: "Delete component", icon: "trash-delete", destructive: true },
|
|
33
|
+
{ id: "publish", label: "Publish", icon: "rocket", type: "primary" },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className="mx-auto w-full max-w-3xl space-y-base p-lg">
|
|
40
|
+
<p className="text-body-sm text-muted">Last action: {lastAction}</p>
|
|
41
|
+
<div className="relative mx-auto h-[640px] w-full max-w-md overflow-hidden rounded-xl border border-hairline bg-surface">
|
|
42
|
+
<div className="flex h-full items-start justify-center p-lg">
|
|
43
|
+
<button
|
|
44
|
+
type="button"
|
|
45
|
+
onClick={() => setOpen(true)}
|
|
46
|
+
className="cursor-pointer rounded-md bg-primary px-lg py-sm text-body-md text-on-primary transition duration-150 ease-out hover:bg-primary-hover active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue"
|
|
47
|
+
>
|
|
48
|
+
Open component actions
|
|
49
|
+
</button>
|
|
50
|
+
</div>
|
|
51
|
+
<ComponentActionsSheet
|
|
52
|
+
open={open}
|
|
53
|
+
onOpenChange={setOpen}
|
|
54
|
+
sections={sections}
|
|
55
|
+
onSelect={(id) => {
|
|
56
|
+
setLastAction(id);
|
|
57
|
+
setOpen(false);
|
|
58
|
+
}}
|
|
59
|
+
onToggle={(id, checked) => {
|
|
60
|
+
setToggles((prev) => ({ ...prev, [id]: checked }));
|
|
61
|
+
setLastAction(`${id} → ${checked ? "on" : "off"}`);
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { Icon } from "../Icon";
|
|
2
3
|
|
|
3
4
|
export type ComponentKind = "Atom" | "Molecule" | "Organism" | "Template";
|
|
4
5
|
|
|
@@ -16,6 +17,14 @@ const iconBg: Record<ComponentKind, string> = {
|
|
|
16
17
|
Template: "bg-[var(--color-kind-template-bg)] text-[var(--color-kind-template-text)]",
|
|
17
18
|
};
|
|
18
19
|
|
|
20
|
+
/* Every glyph resolves through the shared Icon atom. */
|
|
21
|
+
const kindIcon = {
|
|
22
|
+
Atom: "atom",
|
|
23
|
+
Molecule: "grid",
|
|
24
|
+
Organism: "layers",
|
|
25
|
+
Template: "layout-template",
|
|
26
|
+
} as const satisfies Record<ComponentKind, string>;
|
|
27
|
+
|
|
19
28
|
export interface ComponentCardProps
|
|
20
29
|
extends React.HTMLAttributes<HTMLDivElement> {
|
|
21
30
|
/** Component display name */
|
|
@@ -53,7 +62,10 @@ export const ComponentCard = React.forwardRef<
|
|
|
53
62
|
<div
|
|
54
63
|
ref={ref}
|
|
55
64
|
className={[
|
|
56
|
-
|
|
65
|
+
// No overflow clipping here: clipping on the same element as the
|
|
66
|
+
// radius + hairline stroke slices the border flat at the corners.
|
|
67
|
+
// Clipping lives on the thumbnail so the whole stroke stays visible.
|
|
68
|
+
"group relative flex flex-col rounded-xl bg-surface",
|
|
57
69
|
"border border-hairline-soft",
|
|
58
70
|
"shadow-card",
|
|
59
71
|
"transition-all duration-200",
|
|
@@ -65,11 +77,11 @@ export const ComponentCard = React.forwardRef<
|
|
|
65
77
|
.join(" ")}
|
|
66
78
|
{...rest}
|
|
67
79
|
>
|
|
68
|
-
{/* Thumbnail */}
|
|
80
|
+
{/* Thumbnail — owns the clipping and the top corner curve */}
|
|
69
81
|
<div
|
|
70
82
|
className={[
|
|
71
83
|
"relative flex items-center justify-center",
|
|
72
|
-
"w-full aspect-[4/3] overflow-hidden",
|
|
84
|
+
"w-full aspect-[4/3] overflow-hidden rounded-t-xl",
|
|
73
85
|
thumbnailBg ?? "bg-surface-soft",
|
|
74
86
|
].join(" ")}
|
|
75
87
|
>
|
|
@@ -77,7 +89,7 @@ export const ComponentCard = React.forwardRef<
|
|
|
77
89
|
</div>
|
|
78
90
|
|
|
79
91
|
{/* Footer */}
|
|
80
|
-
<div className="flex items-center justify-between px-md py-sm border-t border-hairline-soft bg-canvas">
|
|
92
|
+
<div className="flex items-center justify-between px-md py-sm border-t border-hairline-soft bg-canvas rounded-b-xl">
|
|
81
93
|
<div className="flex flex-col gap-xxs min-w-0">
|
|
82
94
|
<span className="text-body-sm font-weight-heading-sm text-ink truncate">
|
|
83
95
|
{name}
|
|
@@ -107,36 +119,6 @@ ComponentCard.displayName = "ComponentCard";
|
|
|
107
119
|
|
|
108
120
|
/* ── Internal default thumbnail ── */
|
|
109
121
|
function DefaultThumbnail({ kind }: { kind: ComponentKind }) {
|
|
110
|
-
const icons: Record<ComponentKind, React.ReactNode> = {
|
|
111
|
-
Atom: (
|
|
112
|
-
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
113
|
-
<circle cx="12" cy="12" r="1" />
|
|
114
|
-
<path d="M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z" />
|
|
115
|
-
<path d="M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z" />
|
|
116
|
-
</svg>
|
|
117
|
-
),
|
|
118
|
-
Molecule: (
|
|
119
|
-
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
120
|
-
<rect x="2" y="2" width="8" height="8" rx="2" />
|
|
121
|
-
<rect x="14" y="2" width="8" height="8" rx="2" />
|
|
122
|
-
<rect x="2" y="14" width="8" height="8" rx="2" />
|
|
123
|
-
</svg>
|
|
124
|
-
),
|
|
125
|
-
Organism: (
|
|
126
|
-
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
127
|
-
<path d="M12 2L2 7l10 5 10-5-10-5z" />
|
|
128
|
-
<path d="M2 17l10 5 10-5" />
|
|
129
|
-
<path d="M2 12l10 5 10-5" />
|
|
130
|
-
</svg>
|
|
131
|
-
),
|
|
132
|
-
Template: (
|
|
133
|
-
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
134
|
-
<rect x="3" y="3" width="18" height="18" rx="2" />
|
|
135
|
-
<path d="M3 9h18M9 21V9" />
|
|
136
|
-
</svg>
|
|
137
|
-
),
|
|
138
|
-
};
|
|
139
|
-
|
|
140
122
|
return (
|
|
141
123
|
<div
|
|
142
124
|
className={[
|
|
@@ -144,7 +126,7 @@ function DefaultThumbnail({ kind }: { kind: ComponentKind }) {
|
|
|
144
126
|
iconBg[kind],
|
|
145
127
|
].join(" ")}
|
|
146
128
|
>
|
|
147
|
-
{
|
|
129
|
+
<Icon name={kindIcon[kind]} size={32} />
|
|
148
130
|
</div>
|
|
149
131
|
);
|
|
150
132
|
}
|