@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
|
@@ -14,7 +14,11 @@ export default function Preview() {
|
|
|
14
14
|
"Brand color palette",
|
|
15
15
|
"Type scale",
|
|
16
16
|
"Card molecule",
|
|
17
|
+
"Navbar organism",
|
|
18
|
+
"Settings template",
|
|
17
19
|
]}
|
|
20
|
+
suggestionsVariant="marquee"
|
|
21
|
+
animatedBackground={true}
|
|
18
22
|
darkMode={darkMode}
|
|
19
23
|
onDarkModeToggle={() => setDarkMode((d) => !d)}
|
|
20
24
|
onLogout={() => window.alert("Logged out")}
|
package/src/atoms/Icon/Icon.tsx
CHANGED
|
@@ -9,27 +9,33 @@ export interface IconProps extends React.SVGProps<SVGSVGElement> {
|
|
|
9
9
|
|
|
10
10
|
export const Icon = React.forwardRef<SVGSVGElement, IconProps>(
|
|
11
11
|
({ name, size = 20, strokeWidth = 2, className, ...props }, ref) => {
|
|
12
|
-
const glyph = ICON_REGISTRY[name]
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const glyph = ICON_REGISTRY[name] as {
|
|
13
|
+
viewBox: string;
|
|
14
|
+
nodes?: ReadonlyArray<{ tag: string; [key: string]: string }>;
|
|
15
|
+
paths?: ReadonlyArray<string>;
|
|
16
|
+
};
|
|
17
|
+
const nodes =
|
|
18
|
+
glyph.nodes ?? (glyph.paths ?? []).map((d) => ({ tag: "path", d }));
|
|
15
19
|
return (
|
|
16
20
|
<svg
|
|
17
21
|
ref={ref}
|
|
18
22
|
viewBox={glyph.viewBox}
|
|
19
23
|
width={size}
|
|
20
24
|
height={size}
|
|
21
|
-
fill=
|
|
22
|
-
stroke=
|
|
23
|
-
strokeWidth={
|
|
24
|
-
strokeLinecap=
|
|
25
|
-
strokeLinejoin=
|
|
25
|
+
fill="none"
|
|
26
|
+
stroke="currentColor"
|
|
27
|
+
strokeWidth={strokeWidth}
|
|
28
|
+
strokeLinecap="round"
|
|
29
|
+
strokeLinejoin="round"
|
|
26
30
|
className={className}
|
|
27
31
|
aria-hidden="true"
|
|
28
32
|
{...props}
|
|
29
33
|
>
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
{nodes.map((node, i) => {
|
|
35
|
+
const { tag, ...attrs } = node;
|
|
36
|
+
const Tag = tag as "path";
|
|
37
|
+
return <Tag key={i} {...attrs} />;
|
|
38
|
+
})}
|
|
33
39
|
</svg>
|
|
34
40
|
);
|
|
35
41
|
},
|
|
@@ -63,6 +63,40 @@ export const ICON_REGISTRY = {
|
|
|
63
63
|
"cloud": { viewBox: "0 0 24 24", paths: ["M17.5 19a4.5 4.5 0 0 0 0-9 5.5 5.5 0 0 0-10.8-1.5A4 4 0 0 0 6.5 16", "M8 19h9.5"] },
|
|
64
64
|
"download": { viewBox: "0 0 24 24", paths: ["M12 3v12", "M7 10l5 5 5-5", "M5 21h14"] },
|
|
65
65
|
"refresh": { viewBox: "0 0 24 24", paths: ["M4 4v5h5", "M20 20v-5h-5", "M5.5 9A7 7 0 0 1 19 12", "M18.5 15A7 7 0 0 1 5 12"] },
|
|
66
|
+
"molecule-three-connected-nodes": { viewBox: "0 0 24 24", paths: ["M7 7 L17 7", "M7 7 L12 17", "M17 7 L12 17", "M9.2 7a2.2 2.2 0 1 1 -4.4 0 a2.2 2.2 0 1 1 4.4 0", "M19.2 7a2.2 2.2 0 1 1 -4.4 0 a2.2 2.2 0 1 1 4.4 0", "M14.2 17a2.2 2.2 0 1 1 -4.4 0 a2.2 2.2 0 1 1 4.4 0"] },
|
|
67
|
+
"shopping-cart": { viewBox: "0 0 24 24", paths: ["M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6", "M9 21a1 1 0 1 0 0-2 1 1 0 0 0 0 2z", "M20 21a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"] },
|
|
68
|
+
"shield-check": { viewBox: "0 0 24 24", paths: ["M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z", "M9 12l2 2 4-4"] },
|
|
69
|
+
"credit-card": { viewBox: "0 0 24 24", paths: ["M3 4h18a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z", "M1 10h22"] },
|
|
70
|
+
"cpu-chip-processor": { viewBox: "0 0 24 24", paths: ["M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z", "M9 9h6v6h-6z", "M9 1v3", "M15 1v3", "M9 20v3", "M15 20v3", "M20 9h3", "M20 14h3", "M1 9h3", "M1 14h3"] },
|
|
71
|
+
"warning-triangle-alert": { viewBox: "0 0 24 24", paths: ["M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z", "M12 9v4", "M12 17h.01"] },
|
|
72
|
+
"rocket": { viewBox: "0 0 24 24", paths: ["M12 2.5c2.4 1.6 4.5 4.9 4.5 8.6 0 2.1-.6 3.9-1.3 5.2l-3.2 3.2-3.2-3.2c-.7-1.3-1.3-3.1-1.3-5.2 0-3.7 2.1-7 4.5-8.6z", "M9.3 15.7 6.5 17c-.3.9-.5 2.3-.5 3.8 1.4-.1 2.7-.4 3.5-.8l1.4-2.7", "M14.7 15.7 17.5 17c.3.9.5 2.3.5 3.8-1.4-.1-2.7-.4-3.5-.8l-1.4-2.7", "M12 9.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z"] },
|
|
73
|
+
"grip-dots-drag-handle": { viewBox: "0 0 24 24", paths: ["M9 6.5a1 1 0 1 0 0-.01M9 12a1 1 0 1 0 0-.01M9 17.5a1 1 0 1 0 0-.01M15 6.5a1 1 0 1 0 0-.01M15 12a1 1 0 1 0 0-.01M15 17.5a1 1 0 1 0 0-.01"] },
|
|
74
|
+
"arrow-right": { viewBox: "0 0 24 24", paths: ["M5 12h14M13 6l6 6-6 6"] },
|
|
75
|
+
"crown-premium": { viewBox: "0 0 24 24", paths: ["M3 7.5 7 11l5-6.5 5 6.5 4-3.5-2 11H5l-2-11Z", "M5 19.5h14"] },
|
|
76
|
+
"chevron-right": { viewBox: "0 0 24 24", paths: ["M9 5l7 7-7 7"] },
|
|
77
|
+
"crown-lucide-outline-premium-badge": { viewBox: "0 0 24 24", paths: ["M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z", "M5 21h14"] },
|
|
78
|
+
"layout-template": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "18", height: "7", x: "3", y: "3", rx: "1" }, { tag: "rect", width: "9", height: "7", x: "3", y: "14", rx: "1" }, { tag: "rect", width: "5", height: "7", x: "16", y: "14", rx: "1" }] },
|
|
79
|
+
"mic": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12 19v3" }, { tag: "path", d: "M19 10v2a7 7 0 0 1-14 0v-2" }, { tag: "rect", x: "9", y: "2", width: "6", height: "13", rx: "3" }] },
|
|
80
|
+
"upload": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12 3v12" }, { tag: "path", d: "m17 8-5-5-5 5" }, { tag: "path", d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }] },
|
|
81
|
+
"clock": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }, { tag: "polyline", points: "12 6 12 12 16 14" }] },
|
|
82
|
+
"globe": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }, { tag: "path", d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }, { tag: "path", d: "M2 12h20" }] },
|
|
83
|
+
"bell": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10.268 21a2 2 0 0 0 3.464 0" }, { tag: "path", d: "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" }] },
|
|
84
|
+
"square-pen": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }, { tag: "path", d: "M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z" }] },
|
|
85
|
+
"file-sliders": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }, { tag: "path", d: "M14 2v4a2 2 0 0 0 2 2h4" }, { tag: "path", d: "M8 12h8" }, { tag: "path", d: "M10 11v2" }, { tag: "path", d: "M8 17h8" }, { tag: "path", d: "M14 16v2" }] },
|
|
86
|
+
"circle-alert": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }, { tag: "line", x1: "12", x2: "12", y1: "8", y2: "12" }, { tag: "line", x1: "12", x2: "12.01", y1: "16", y2: "16" }] },
|
|
87
|
+
"github": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4" }, { tag: "path", d: "M9 18c-4.51 2-5-2-7-2" }] },
|
|
88
|
+
"twitter": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z" }] },
|
|
89
|
+
"linkedin": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z" }, { tag: "rect", width: "4", height: "12", x: "2", y: "9" }, { tag: "circle", cx: "4", cy: "4", r: "2" }] },
|
|
90
|
+
"youtube": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17" }, { tag: "path", d: "m10 15 5-3-5-3z" }] },
|
|
91
|
+
"code": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "m16 18 6-6-6-6" }, { tag: "path", d: "m8 6-6 6 6 6" }] },
|
|
92
|
+
"group": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M3 7V5c0-1.1.9-2 2-2h2" }, { tag: "path", d: "M17 3h2c1.1 0 2 .9 2 2v2" }, { tag: "path", d: "M21 17v2c0 1.1-.9 2-2 2h-2" }, { tag: "path", d: "M7 21H5c-1.1 0-2-.9-2-2v-2" }, { tag: "rect", width: "7", height: "5", x: "7", y: "7", rx: "1" }, { tag: "rect", width: "7", height: "5", x: "10", y: "12", rx: "1" }] },
|
|
93
|
+
"play": { viewBox: "0 0 24 24", nodes: [{ tag: "polygon", points: "6 3 20 12 6 21 6 3" }] },
|
|
94
|
+
"circle-check": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }, { tag: "path", d: "m9 12 2 2 4-4" }] },
|
|
95
|
+
"info": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }, { tag: "path", d: "M12 16v-4" }, { tag: "path", d: "M12 8h.01" }] },
|
|
96
|
+
"triangle-alert": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }, { tag: "path", d: "M12 9v4" }, { tag: "path", d: "M12 17h.01" }] },
|
|
97
|
+
"landmark": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10 18v-7" }, { tag: "path", d: "M11.12 2.198a2 2 0 0 1 1.76.006l7.866 3.847c.476.233.31.949-.22.949H3.474c-.53 0-.695-.716-.22-.949z" }, { tag: "path", d: "M14 18v-7" }, { tag: "path", d: "M18 18v-7" }, { tag: "path", d: "M3 22h18" }, { tag: "path", d: "M6 18v-7" }] },
|
|
98
|
+
"circle-user": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }, { tag: "circle", cx: "12", cy: "10", r: "3" }, { tag: "path", d: "M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" }] },
|
|
99
|
+
"pencil": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }, { tag: "path", d: "m15 5 4 4" }] },
|
|
66
100
|
} as const;
|
|
67
101
|
|
|
68
102
|
export type IconName = keyof typeof ICON_REGISTRY;
|
|
@@ -18,6 +18,14 @@ export interface InputProps
|
|
|
18
18
|
trailingIcon?: React.ReactNode;
|
|
19
19
|
/** Fill full width of its container */
|
|
20
20
|
fullWidth?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Strips the input's own chrome — border, background, rounding, shadow,
|
|
23
|
+
* focus ring, height and horizontal padding — leaving only the text and
|
|
24
|
+
* placeholder. Use it when a parent already owns the single stroke (an
|
|
25
|
+
* inline field inside a selectable row, a search shell, a composer bar),
|
|
26
|
+
* so focus paints on that parent once instead of drawing a second box.
|
|
27
|
+
*/
|
|
28
|
+
unstyled?: boolean;
|
|
21
29
|
}
|
|
22
30
|
|
|
23
31
|
const sizeClasses: Record<
|
|
@@ -54,6 +62,7 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
54
62
|
leadingIcon,
|
|
55
63
|
trailingIcon,
|
|
56
64
|
fullWidth = false,
|
|
65
|
+
unstyled = false,
|
|
57
66
|
disabled,
|
|
58
67
|
id,
|
|
59
68
|
className = "",
|
|
@@ -65,30 +74,39 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
65
74
|
const inputId = id ?? generatedId;
|
|
66
75
|
const helperId = `${inputId}-helper`;
|
|
67
76
|
const hasError = Boolean(error);
|
|
68
|
-
const {
|
|
69
|
-
|
|
70
|
-
icon: iconSize,
|
|
71
|
-
label: labelSize,
|
|
72
|
-
trailingPad,
|
|
73
|
-
} = sizeClasses[size];
|
|
77
|
+
const { input: inputSize, icon: iconSize, label: labelSize, trailingPad } =
|
|
78
|
+
sizeClasses[size];
|
|
74
79
|
|
|
75
|
-
const
|
|
76
|
-
? "border-semantic-error focus:ring-semantic-error
|
|
77
|
-
: "
|
|
80
|
+
const focusClasses = hasError
|
|
81
|
+
? "focus-visible:border-semantic-error focus-visible:ring-semantic-error"
|
|
82
|
+
: "focus-visible:border-primary-focus focus-visible:ring-focus-blue";
|
|
83
|
+
|
|
84
|
+
// Unstyled: the parent owns the stroke, so this element is bare text.
|
|
85
|
+
// Styled: one surface — border + a single focus-visible ring on that edge.
|
|
86
|
+
const chromeClasses = unstyled
|
|
87
|
+
? "border-0 bg-transparent p-0 text-body-md"
|
|
88
|
+
: [
|
|
89
|
+
"rounded-md border bg-surface",
|
|
90
|
+
"transition-colors duration-150",
|
|
91
|
+
"focus-visible:outline-none focus-visible:ring-2",
|
|
92
|
+
focusClasses,
|
|
93
|
+
inputSize,
|
|
94
|
+
hasError ? "border-semantic-error" : "border-hairline",
|
|
95
|
+
].join(" ");
|
|
78
96
|
|
|
79
97
|
return (
|
|
80
98
|
<div className={`flex flex-col gap-xs ${fullWidth ? "w-full" : "w-fit"}`}>
|
|
81
99
|
{label && (
|
|
82
100
|
<label
|
|
83
101
|
htmlFor={inputId}
|
|
84
|
-
className={`${labelSize} font-
|
|
102
|
+
className={`${labelSize} font-weight-body-md text-ink`}
|
|
85
103
|
>
|
|
86
104
|
{label}
|
|
87
105
|
</label>
|
|
88
106
|
)}
|
|
89
107
|
|
|
90
108
|
<div className="relative flex items-center">
|
|
91
|
-
{leadingIcon && (
|
|
109
|
+
{leadingIcon && !unstyled && (
|
|
92
110
|
<span
|
|
93
111
|
aria-hidden="true"
|
|
94
112
|
className={`absolute left-md flex items-center text-muted ${iconSize}`}
|
|
@@ -101,22 +119,20 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
101
119
|
ref={ref}
|
|
102
120
|
id={inputId}
|
|
103
121
|
disabled={disabled}
|
|
122
|
+
aria-label={label ? undefined : rest["aria-label"] ?? "Text field"}
|
|
104
123
|
aria-invalid={hasError ? "true" : undefined}
|
|
105
124
|
aria-describedby={
|
|
106
125
|
error ? helperId : helperText ? helperId : undefined
|
|
107
126
|
}
|
|
108
127
|
className={[
|
|
109
|
-
"w-full
|
|
110
|
-
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
inputSize,
|
|
114
|
-
borderColor,
|
|
115
|
-
leadingIcon ? "pl-9" : "",
|
|
116
|
-
trailingIcon ? trailingPad : "",
|
|
128
|
+
"w-full text-ink placeholder:text-muted-soft",
|
|
129
|
+
chromeClasses,
|
|
130
|
+
!unstyled && leadingIcon ? "pl-9" : "",
|
|
131
|
+
!unstyled && trailingIcon ? trailingPad : "",
|
|
117
132
|
disabled
|
|
118
|
-
? "cursor-not-allowed
|
|
133
|
+
? "cursor-not-allowed opacity-[var(--opacity-disabled)]"
|
|
119
134
|
: "",
|
|
135
|
+
!unstyled && disabled ? "bg-surface-soft text-muted" : "",
|
|
120
136
|
className,
|
|
121
137
|
]
|
|
122
138
|
.filter(Boolean)
|
|
@@ -124,7 +140,7 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
124
140
|
{...rest}
|
|
125
141
|
/>
|
|
126
142
|
|
|
127
|
-
{trailingIcon && (
|
|
143
|
+
{trailingIcon && !unstyled && (
|
|
128
144
|
<span className="absolute right-sm flex items-center justify-center text-muted overflow-visible pointer-events-auto">
|
|
129
145
|
{trailingIcon}
|
|
130
146
|
</span>
|