@designa8/vibedesign-v6 1.12.17 → 1.14.0

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.
@@ -0,0 +1,104 @@
1
+ import React from "react";
2
+ import { CodeEditor, type CodeEditorFile } from "./CodeEditor";
3
+
4
+ const files: CodeEditorFile[] = [
5
+ {
6
+ name: "Widget.tsx",
7
+ language: "tsx",
8
+ source: `import React from "react";
9
+
10
+ export function Widget(props: { label: string }) {
11
+ return <div className="bg-primary text-on-primary">{props.label}</div>;
12
+ }
13
+ `,
14
+ },
15
+ {
16
+ name: "index.ts",
17
+ language: "ts",
18
+ source: `export { Widget } from "./Widget";
19
+ `,
20
+ },
21
+ {
22
+ name: "styles.css",
23
+ language: "css",
24
+ source: `.widget {
25
+ border-radius: var(--radius-md);
26
+ padding: var(--spacing-sm) var(--spacing-md);
27
+ }
28
+ `,
29
+ },
30
+ {
31
+ name: "README.md",
32
+ language: "md",
33
+ source: `# Widget
34
+
35
+ A small display element.
36
+ `,
37
+ },
38
+ ];
39
+
40
+ export default function CodeEditorPreview() {
41
+ const [active, setActive] = React.useState("Widget.tsx");
42
+ const [source, setSource] = React.useState(files[0].source);
43
+
44
+ return (
45
+ <div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
46
+ <div>
47
+ <p className="mb-sm text-caption font-weight-heading-sm uppercase tracking-widest text-muted-soft">
48
+ Read-only, light
49
+ </p>
50
+ <CodeEditor
51
+ className="min-h-[22rem]"
52
+ files={files}
53
+ activeFile={active}
54
+ onActiveFileChange={setActive}
55
+ pathPrefix="src/components"
56
+ readOnly
57
+ />
58
+ </div>
59
+
60
+ <div>
61
+ <p className="mb-sm text-caption font-weight-heading-sm uppercase tracking-widest text-muted-soft">
62
+ Streaming (writing)
63
+ </p>
64
+ <CodeEditor
65
+ className="min-h-[17rem]"
66
+ files={files}
67
+ activeFile="Widget.tsx"
68
+ pathPrefix="src/components"
69
+ readOnly
70
+ streamingFileNames={["Widget.tsx"]}
71
+ />
72
+ </div>
73
+
74
+ <div>
75
+ <p className="mb-sm text-caption font-weight-heading-sm uppercase tracking-widest text-muted-soft">
76
+ Editable
77
+ </p>
78
+ <CodeEditor
79
+ className="min-h-[17rem]"
80
+ files={[{ name: "Widget.tsx", language: "tsx", source }]}
81
+ activeFile="Widget.tsx"
82
+ pathPrefix="src/components"
83
+ readOnly={false}
84
+ onChange={(_, next) => setSource(next)}
85
+ />
86
+ </div>
87
+
88
+ <div>
89
+ <p className="mb-sm text-caption font-weight-heading-sm uppercase tracking-widest text-muted-soft">
90
+ Dark mode
91
+ </p>
92
+ <CodeEditor
93
+ className="min-h-[22rem]"
94
+ files={files}
95
+ activeFile={active}
96
+ onActiveFileChange={setActive}
97
+ pathPrefix="src/components"
98
+ readOnly
99
+ dark
100
+ />
101
+ </div>
102
+ </div>
103
+ );
104
+ }
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { ICON_REGISTRY, type IconName } from "./icons.data";
3
+
4
+ export interface IconProps extends React.SVGProps<SVGSVGElement> {
5
+ name: IconName;
6
+ size?: number;
7
+ strokeWidth?: number;
8
+ }
9
+
10
+ export const Icon = React.forwardRef<SVGSVGElement, IconProps>(
11
+ ({ name, size = 20, strokeWidth = 2, className, ...props }, ref) => {
12
+ const glyph = ICON_REGISTRY[name];
13
+ return (
14
+ <svg
15
+ ref={ref}
16
+ viewBox={glyph.viewBox}
17
+ width={size}
18
+ height={size}
19
+ fill="none"
20
+ stroke="currentColor"
21
+ strokeWidth={strokeWidth}
22
+ strokeLinecap="round"
23
+ strokeLinejoin="round"
24
+ className={className}
25
+ aria-hidden="true"
26
+ {...props}
27
+ >
28
+ {glyph.paths.map((d, i) => (
29
+ <path key={i} d={d} />
30
+ ))}
31
+ </svg>
32
+ );
33
+ },
34
+ );
35
+ Icon.displayName = "Icon";
@@ -0,0 +1,8 @@
1
+ export const ICON_REGISTRY = {
2
+ "close": { viewBox: "0 0 24 24", paths: ["M18 6 6 18", "M6 6l12 12"] },
3
+ "chevron-down": { viewBox: "0 0 24 24", paths: ["M6 9l6 6 6-6"] },
4
+ "copy-clipboard": { viewBox: "0 0 24 24", paths: ["M9 9h10v10H9z", "M5 15V5h10"] },
5
+ "check-checkmark": { viewBox: "0 0 24 24", paths: ["M5 13l4 4L19 7"] },
6
+ } as const;
7
+
8
+ export type IconName = keyof typeof ICON_REGISTRY;
@@ -0,0 +1,4 @@
1
+ export { Icon } from "./Icon";
2
+ export type { IconProps } from "./Icon";
3
+ export { ICON_REGISTRY } from "./icons.data";
4
+ export type { IconName } from "./icons.data";
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { Icon } from "./Icon";
3
+ import { ICON_REGISTRY } from "./icons.data";
4
+
5
+ export default function IconPreview() {
6
+ const names = Object.keys(ICON_REGISTRY) as (keyof typeof ICON_REGISTRY)[];
7
+ return (
8
+ <div className="w-full max-w-3xl mx-auto p-lg">
9
+ <div className="grid grid-cols-4 gap-md">
10
+ {names.map((name) => (
11
+ <div key={name} className="flex flex-col items-center gap-xs">
12
+ <Icon name={name} size={24} />
13
+ <span className="text-body-sm text-muted">{name}</span>
14
+ </div>
15
+ ))}
16
+ </div>
17
+ </div>
18
+ );
19
+ }
@@ -0,0 +1,127 @@
1
+ import React from "react";
2
+ import { Typography } from "../Typography";
3
+ import { Button } from "../Button";
4
+ import { Icon } from "../Icon";
5
+
6
+ export type StatusBarTone = "info" | "success" | "warning" | "error";
7
+
8
+ export interface StatusBarProps extends React.HTMLAttributes<HTMLDivElement> {
9
+ /** Drives the accent color, background tint, and pulsing ring */
10
+ tone?: StatusBarTone;
11
+ /** Bold lead text, e.g. "External agent is building a new component" */
12
+ message: string;
13
+ /** Secondary clickable detail text, e.g. "Building or updating PreviewToolbar" */
14
+ detail?: string;
15
+ onDetailClick?: () => void;
16
+ /** Whether the status dot pulses (use for in-progress states) */
17
+ pulsing?: boolean;
18
+ /** Shows a dismiss (×) button on the right when provided */
19
+ onDismiss?: () => void;
20
+ className?: string;
21
+ }
22
+
23
+ const toneBgClass: Record<StatusBarTone, string> = {
24
+ info: "bg-semantic-info-soft",
25
+ success: "bg-semantic-success-soft",
26
+ warning: "bg-semantic-warning-soft",
27
+ error: "bg-semantic-error-soft",
28
+ };
29
+
30
+ const toneBorderClass: Record<StatusBarTone, string> = {
31
+ info: "border-primary",
32
+ success: "border-semantic-success",
33
+ warning: "border-semantic-warning",
34
+ error: "border-semantic-error",
35
+ };
36
+
37
+ const toneDotClass: Record<StatusBarTone, string> = {
38
+ info: "bg-primary",
39
+ success: "bg-semantic-success",
40
+ warning: "bg-semantic-warning",
41
+ error: "bg-semantic-error",
42
+ };
43
+
44
+ const toneTextClass: Record<StatusBarTone, string> = {
45
+ info: "text-primary",
46
+ success: "text-semantic-success",
47
+ warning: "text-semantic-warning",
48
+ error: "text-semantic-error",
49
+ };
50
+
51
+ export const StatusBar = React.forwardRef<HTMLDivElement, StatusBarProps>(
52
+ (
53
+ {
54
+ tone = "info",
55
+ message,
56
+ detail,
57
+ onDetailClick,
58
+ pulsing = true,
59
+ onDismiss,
60
+ className = "",
61
+ ...rest
62
+ },
63
+ ref,
64
+ ) => {
65
+ return (
66
+ <div
67
+ ref={ref}
68
+ role="status"
69
+ className={[
70
+ "w-full flex items-center gap-sm px-lg py-sm",
71
+ "border-b-2",
72
+ toneBgClass[tone],
73
+ toneBorderClass[tone],
74
+ className,
75
+ ].filter(Boolean).join(" ")}
76
+ {...rest}
77
+ >
78
+ {/* Status dot with optional pulsing ring */}
79
+ <span className="relative inline-flex items-center justify-center w-4 h-4 shrink-0" aria-hidden="true">
80
+ {pulsing && (
81
+ <span
82
+ className={["absolute inline-flex h-full w-full rounded-full opacity-75 animate-ping", toneDotClass[tone]].join(" ")}
83
+ />
84
+ )}
85
+ <span className={["relative inline-flex w-2.5 h-2.5 rounded-full", toneDotClass[tone]].join(" ")} />
86
+ </span>
87
+
88
+ <div className="flex flex-1 min-w-0 flex-wrap items-baseline gap-x-sm gap-y-xxs">
89
+ <Typography role="body-sm" className={["font-weight-heading-sm truncate", toneTextClass[tone]].join(" ")}>
90
+ {message}
91
+ </Typography>
92
+
93
+ {detail && (
94
+ onDetailClick ? (
95
+ <Button
96
+ variant="ghost"
97
+ size="sm"
98
+ onClick={onDetailClick}
99
+ className={["!h-auto !p-0 rounded-xs text-body-sm font-weight-body-sm underline hover:no-underline hover:bg-transparent active:bg-transparent truncate", toneTextClass[tone]].join(" ")}
100
+ >
101
+ {detail}
102
+ </Button>
103
+ ) : (
104
+ <Typography role="body-sm" color="body" className="truncate">
105
+ {detail}
106
+ </Typography>
107
+ )
108
+ )}
109
+ </div>
110
+
111
+ {onDismiss && (
112
+ <Button
113
+ variant="ghost"
114
+ size="sm"
115
+ aria-label="Dismiss status"
116
+ onClick={onDismiss}
117
+ className={["!w-6 !h-6 !p-0 rounded-sm shrink-0 hover:bg-transparent active:bg-transparent", toneTextClass[tone]].join(" ")}
118
+ >
119
+ <Icon name="close" size={14} />
120
+ </Button>
121
+ )}
122
+ </div>
123
+ );
124
+ },
125
+ );
126
+
127
+ StatusBar.displayName = "StatusBar";
@@ -0,0 +1,2 @@
1
+ export { StatusBar } from "./StatusBar";
2
+ export type { StatusBarProps, StatusBarTone } from "./StatusBar";
@@ -0,0 +1,52 @@
1
+ import React, { useState } from "react";
2
+ import { StatusBar } from "./StatusBar";
3
+
4
+ export default function StatusBarPreview() {
5
+ const [dismissed, setDismissed] = useState(false);
6
+
7
+ return (
8
+ <div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
9
+ <div className="space-y-xs">
10
+ <p className="text-caption text-muted">In progress (info, pulsing, dismissible)</p>
11
+ {!dismissed && (
12
+ <StatusBar
13
+ tone="info"
14
+ message="External agent is building a new component"
15
+ detail="Building or updating PreviewToolbar"
16
+ onDetailClick={() => {}}
17
+ onDismiss={() => setDismissed(true)}
18
+ />
19
+ )}
20
+ {dismissed && (
21
+ <div className="text-body-sm text-muted px-lg py-xs border-b border-hairline">Dismissed — refresh to reset</div>
22
+ )}
23
+ </div>
24
+
25
+ <div className="space-y-xs">
26
+ <p className="text-caption text-muted">Success (static dot)</p>
27
+ <StatusBar
28
+ tone="success"
29
+ message="Design tokens published"
30
+ detail="View changelog"
31
+ onDetailClick={() => {}}
32
+ pulsing={false}
33
+ />
34
+ </div>
35
+
36
+ <div className="space-y-xs">
37
+ <p className="text-caption text-muted">Warning</p>
38
+ <StatusBar
39
+ tone="warning"
40
+ message="Component preview is out of date"
41
+ detail="Rebuild now"
42
+ onDetailClick={() => {}}
43
+ />
44
+ </div>
45
+
46
+ <div className="space-y-xs">
47
+ <p className="text-caption text-muted">Error, no detail link</p>
48
+ <StatusBar tone="error" message="Build failed — check the console for details" pulsing={false} />
49
+ </div>
50
+ </div>
51
+ );
52
+ }
package/src/index.ts CHANGED
@@ -7,16 +7,19 @@ export * from "./atoms/AuthScreen";
7
7
  export * from "./atoms/Button";
8
8
  export * from "./atoms/ChatScreen";
9
9
  export * from "./atoms/Chip";
10
+ export * from "./atoms/CodeEditor";
10
11
  export * from "./atoms/ComponentCard";
11
12
  export * from "./atoms/ExportDesignMdModal";
12
13
  export * from "./atoms/FilterTabBar";
13
14
  export * from "./atoms/HomePageTemplate";
15
+ export * from "./atoms/Icon";
14
16
  export * from "./atoms/Input";
15
17
  export * from "./atoms/Modal";
16
18
  export * from "./atoms/NavItem";
17
19
  export * from "./atoms/PreviewToolbar";
18
20
  export * from "./atoms/PromptInputBar";
19
21
  export * from "./atoms/PublishModal";
22
+ export * from "./atoms/StatusBar";
20
23
  export * from "./atoms/TopNavbar";
21
24
  export * from "./atoms/Typography";
22
25
  export * from "./atoms/UpgradeCard";
package/src/tokens.css CHANGED
@@ -48,6 +48,7 @@
48
48
  --color-kind-template-bg: #FEF3C7;
49
49
  --color-kind-template-text: #B45309;
50
50
  --color-kind-template-border: #FBD98A;
51
+ --color-semantic-info-soft: #EAE8FB;
51
52
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
52
53
  --font-heading: var(--font-body);
53
54
  --font-display-lg: var(--font-body);
@@ -174,4 +175,8 @@
174
175
  --color-hairline-soft: #242432;
175
176
  --color-hairline-strong: #3C3C50;
176
177
  --color-primary-disabled: #3D3870;
178
+ --color-semantic-success-soft: #123321;
179
+ --color-semantic-warning-soft: #3A2A0A;
180
+ --color-semantic-error-soft: #3A1414;
181
+ --color-semantic-info-soft: #28234F;
177
182
  }