@designa8/vibedesign-v6 1.6.8 → 1.8.3
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/index.cjs +248 -10
- package/dist/index.js +248 -10
- package/dist/styles.css +51 -6
- package/package.json +11 -1
- package/src/atoms/FilterTabBar/FilterTabBar.tsx +7 -24
- package/src/atoms/FilterTabBar/preview.tsx +20 -81
- package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +253 -0
- package/src/atoms/PreviewToolbar/index.ts +2 -0
- package/src/atoms/PreviewToolbar/preview.tsx +81 -0
- package/src/atoms/Typography/Typography.tsx +107 -0
- package/src/atoms/Typography/index.ts +2 -0
- package/src/atoms/Typography/preview.tsx +132 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { PreviewToolbar, Viewport } from "./PreviewToolbar";
|
|
3
|
+
|
|
4
|
+
export default function PreviewToolbarPreview() {
|
|
5
|
+
const [viewport, setViewport] = useState<Viewport>("desktop");
|
|
6
|
+
const [darkMode, setDarkMode] = useState(false);
|
|
7
|
+
const [inspecting, setInspecting] = useState(false);
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div className="w-full max-w-5xl mx-auto p-lg space-y-xl">
|
|
11
|
+
{/* Label */}
|
|
12
|
+
<div className="space-y-xxs">
|
|
13
|
+
<p className="text-body-sm text-muted uppercase tracking-wide">Preview toolbar</p>
|
|
14
|
+
<p className="text-body-sm text-muted">
|
|
15
|
+
Interactive — click the viewport icons, toggle Dark mode, and try Inspect tokens.
|
|
16
|
+
</p>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
{/* ── Interactive demo ─────────────────────────── */}
|
|
20
|
+
<div className="flex flex-col items-center gap-lg">
|
|
21
|
+
<div className="flex items-center justify-center w-full bg-surface-soft rounded-xl p-xl border border-hairline">
|
|
22
|
+
<PreviewToolbar
|
|
23
|
+
viewport={viewport}
|
|
24
|
+
onViewportChange={setViewport}
|
|
25
|
+
darkMode={darkMode}
|
|
26
|
+
onDarkToggle={() => setDarkMode((d) => !d)}
|
|
27
|
+
inspecting={inspecting}
|
|
28
|
+
onInspectTokens={() => setInspecting((i) => !i)}
|
|
29
|
+
onFullscreen={() => {}}
|
|
30
|
+
onExpand={() => {}}
|
|
31
|
+
onOverflow={() => {}}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<p className="text-body-sm text-muted text-center">
|
|
36
|
+
Active viewport: <strong className="text-ink">{viewport}</strong> ·
|
|
37
|
+
Dark mode: <strong className="text-ink">{darkMode ? "on" : "off"}</strong> ·
|
|
38
|
+
Inspecting: <strong className="text-ink">{inspecting ? "on" : "off"}</strong>
|
|
39
|
+
</p>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
{/* ── Variant: inspecting=true ─────────────────── */}
|
|
43
|
+
<div className="space-y-sm">
|
|
44
|
+
<p className="text-body-sm text-muted font-weight-heading-sm">Inspecting active (inspecting=true)</p>
|
|
45
|
+
<div className="flex items-center justify-center w-full bg-canvas rounded-xl p-xl border border-hairline">
|
|
46
|
+
<PreviewToolbar
|
|
47
|
+
viewport="desktop"
|
|
48
|
+
inspecting
|
|
49
|
+
modelLabel="Sonnet 4.6"
|
|
50
|
+
kindLabel="ATOM"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
{/* ── Variant: mobile active ──────────────────── */}
|
|
56
|
+
<div className="space-y-sm">
|
|
57
|
+
<p className="text-body-sm text-muted font-weight-heading-sm">Mobile active</p>
|
|
58
|
+
<div className="flex items-center justify-center w-full bg-canvas rounded-xl p-xl border border-hairline">
|
|
59
|
+
<PreviewToolbar
|
|
60
|
+
viewport="mobile"
|
|
61
|
+
modelLabel="Opus 4"
|
|
62
|
+
kindLabel="MOLECULE"
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
{/* ── Variant: dark mode on ───────────────────── */}
|
|
68
|
+
<div className="space-y-sm">
|
|
69
|
+
<p className="text-body-sm text-muted font-weight-heading-sm">Dark mode active</p>
|
|
70
|
+
<div className="flex items-center justify-center w-full bg-canvas rounded-xl p-xl border border-hairline">
|
|
71
|
+
<PreviewToolbar
|
|
72
|
+
viewport="sidebar"
|
|
73
|
+
darkMode
|
|
74
|
+
kindLabel="ORGANISM"
|
|
75
|
+
modelLabel="Haiku 3.5"
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export type TypographyRole =
|
|
4
|
+
| "display-lg"
|
|
5
|
+
| "heading-lg"
|
|
6
|
+
| "heading-md"
|
|
7
|
+
| "heading-sm"
|
|
8
|
+
| "body-lg"
|
|
9
|
+
| "body-md"
|
|
10
|
+
| "body-sm"
|
|
11
|
+
| "caption";
|
|
12
|
+
|
|
13
|
+
export type TypographyColor =
|
|
14
|
+
| "ink"
|
|
15
|
+
| "body"
|
|
16
|
+
| "muted"
|
|
17
|
+
| "muted-soft"
|
|
18
|
+
| "primary"
|
|
19
|
+
| "semantic-error"
|
|
20
|
+
| "semantic-success"
|
|
21
|
+
| "semantic-warning"
|
|
22
|
+
| "on-primary";
|
|
23
|
+
|
|
24
|
+
const roleTagMap: Record<TypographyRole, keyof React.JSX.IntrinsicElements> = {
|
|
25
|
+
"display-lg": "h1",
|
|
26
|
+
"heading-lg": "h2",
|
|
27
|
+
"heading-md": "h3",
|
|
28
|
+
"heading-sm": "h4",
|
|
29
|
+
"body-lg": "p",
|
|
30
|
+
"body-md": "p",
|
|
31
|
+
"body-sm": "p",
|
|
32
|
+
caption: "span",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const roleClassMap: Record<TypographyRole, string> = {
|
|
36
|
+
"display-lg": "text-display-lg",
|
|
37
|
+
"heading-lg": "text-heading-lg",
|
|
38
|
+
"heading-md": "text-heading-md",
|
|
39
|
+
"heading-sm": "text-heading-sm",
|
|
40
|
+
"body-lg": "text-body-lg",
|
|
41
|
+
"body-md": "text-body-md",
|
|
42
|
+
"body-sm": "text-body-sm",
|
|
43
|
+
caption: "text-caption",
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const colorClassMap: Record<TypographyColor, string> = {
|
|
47
|
+
ink: "text-ink",
|
|
48
|
+
body: "text-body",
|
|
49
|
+
muted: "text-muted",
|
|
50
|
+
"muted-soft": "text-muted-soft",
|
|
51
|
+
primary: "text-primary",
|
|
52
|
+
"semantic-error": "text-semantic-error",
|
|
53
|
+
"semantic-success": "text-semantic-success",
|
|
54
|
+
"semantic-warning": "text-semantic-warning",
|
|
55
|
+
"on-primary": "text-on-primary",
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export interface TypographyProps
|
|
59
|
+
extends React.HTMLAttributes<HTMLElement> {
|
|
60
|
+
/** Token role that drives size, weight, line-height, and tracking */
|
|
61
|
+
role?: TypographyRole;
|
|
62
|
+
/** Token color alias */
|
|
63
|
+
color?: TypographyColor;
|
|
64
|
+
/** Override the default semantic HTML tag for this role */
|
|
65
|
+
as?: keyof React.JSX.IntrinsicElements;
|
|
66
|
+
/** Truncate to a single line with an ellipsis */
|
|
67
|
+
truncate?: boolean;
|
|
68
|
+
/** Render text in uppercase */
|
|
69
|
+
uppercase?: boolean;
|
|
70
|
+
children: React.ReactNode;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const Typography = React.forwardRef<HTMLElement, TypographyProps>(
|
|
74
|
+
(
|
|
75
|
+
{
|
|
76
|
+
role = "body-md",
|
|
77
|
+
color = "ink",
|
|
78
|
+
as,
|
|
79
|
+
truncate = false,
|
|
80
|
+
uppercase = false,
|
|
81
|
+
className = "",
|
|
82
|
+
children,
|
|
83
|
+
...rest
|
|
84
|
+
},
|
|
85
|
+
ref
|
|
86
|
+
) => {
|
|
87
|
+
const Tag = (as ?? roleTagMap[role]) as React.ElementType;
|
|
88
|
+
|
|
89
|
+
const classes = [
|
|
90
|
+
roleClassMap[role],
|
|
91
|
+
colorClassMap[color],
|
|
92
|
+
truncate ? "truncate" : "",
|
|
93
|
+
uppercase ? "uppercase tracking-wide" : "",
|
|
94
|
+
className,
|
|
95
|
+
]
|
|
96
|
+
.filter(Boolean)
|
|
97
|
+
.join(" ");
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<Tag ref={ref} className={classes} {...rest}>
|
|
101
|
+
{children}
|
|
102
|
+
</Tag>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
Typography.displayName = "Typography";
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Typography, TypographyRole } from "./Typography";
|
|
3
|
+
|
|
4
|
+
const roles: { role: TypographyRole; label: string; sample: string }[] = [
|
|
5
|
+
{
|
|
6
|
+
role: "display-lg",
|
|
7
|
+
label: "display-lg — 48px / 700",
|
|
8
|
+
sample: "The quick brown fox",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
role: "heading-lg",
|
|
12
|
+
label: "heading-lg — 32px / 700",
|
|
13
|
+
sample: "Design systems at scale",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
role: "heading-md",
|
|
17
|
+
label: "heading-md — 24px / 600",
|
|
18
|
+
sample: "Component-driven workflow",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
role: "heading-sm",
|
|
22
|
+
label: "heading-sm — 18px / 600",
|
|
23
|
+
sample: "Tokens drive everything",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
role: "body-lg",
|
|
27
|
+
label: "body-lg — 18px / 400",
|
|
28
|
+
sample:
|
|
29
|
+
"Great products start with a coherent design language that scales across every surface.",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
role: "body-md",
|
|
33
|
+
label: "body-md — 16px / 400",
|
|
34
|
+
sample:
|
|
35
|
+
"Consistent spacing, color, and typography keep the interface readable and the team aligned.",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
role: "body-sm",
|
|
39
|
+
label: "body-sm — 14px / 400",
|
|
40
|
+
sample:
|
|
41
|
+
"Small text is used for secondary information, helper text, and meta content.",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
role: "caption",
|
|
45
|
+
label: "caption — 12px / 400",
|
|
46
|
+
sample: "Last updated 3 minutes ago · Public",
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const Divider = () => (
|
|
51
|
+
<div className="border-t border-hairline-soft" aria-hidden="true" />
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export default function TypographyPreview() {
|
|
55
|
+
return (
|
|
56
|
+
<div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
|
|
57
|
+
{/* Header */}
|
|
58
|
+
<div className="space-y-xs">
|
|
59
|
+
<Typography role="heading-md" color="ink">
|
|
60
|
+
Type Scale
|
|
61
|
+
</Typography>
|
|
62
|
+
<Typography role="body-sm" color="muted">
|
|
63
|
+
Every role maps to a token — size, weight, line-height, and tracking
|
|
64
|
+
update across the whole system when tokens change.
|
|
65
|
+
</Typography>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
{/* Scale rows */}
|
|
69
|
+
<div className="bg-surface rounded-lg border border-hairline overflow-hidden">
|
|
70
|
+
{roles.map(({ role, label, sample }, i) => (
|
|
71
|
+
<React.Fragment key={role}>
|
|
72
|
+
{i > 0 && <Divider />}
|
|
73
|
+
<div className="flex flex-col gap-xs p-lg">
|
|
74
|
+
<Typography role="caption" color="muted-soft" as="span">
|
|
75
|
+
{label}
|
|
76
|
+
</Typography>
|
|
77
|
+
<Typography role={role} color="ink">
|
|
78
|
+
{sample}
|
|
79
|
+
</Typography>
|
|
80
|
+
</div>
|
|
81
|
+
</React.Fragment>
|
|
82
|
+
))}
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
{/* Color variants */}
|
|
86
|
+
<div className="space-y-xs">
|
|
87
|
+
<Typography role="heading-sm" color="ink">
|
|
88
|
+
Color variants
|
|
89
|
+
</Typography>
|
|
90
|
+
<Typography role="body-sm" color="muted">
|
|
91
|
+
Pass the <code className="text-primary font-weight-heading-sm text-body-sm">color</code> prop to apply any token color alias.
|
|
92
|
+
</Typography>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div className="bg-surface rounded-lg border border-hairline p-lg flex flex-col gap-md">
|
|
96
|
+
{(
|
|
97
|
+
[
|
|
98
|
+
["ink", "ink — primary text"],
|
|
99
|
+
["body", "body — body text"],
|
|
100
|
+
["muted", "muted — secondary / helper"],
|
|
101
|
+
["muted-soft", "muted-soft — placeholder / disabled"],
|
|
102
|
+
["primary", "primary — brand accent"],
|
|
103
|
+
["semantic-success", "semantic-success — positive state"],
|
|
104
|
+
["semantic-warning", "semantic-warning — caution state"],
|
|
105
|
+
["semantic-error", "semantic-error — destructive / error"],
|
|
106
|
+
] as const
|
|
107
|
+
).map(([color, label]) => (
|
|
108
|
+
<Typography key={color} role="body-md" color={color}>
|
|
109
|
+
{label}
|
|
110
|
+
</Typography>
|
|
111
|
+
))}
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
{/* Utilities */}
|
|
115
|
+
<div className="space-y-xs">
|
|
116
|
+
<Typography role="heading-sm" color="ink">
|
|
117
|
+
Utilities
|
|
118
|
+
</Typography>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<div className="bg-surface rounded-lg border border-hairline p-lg space-y-md">
|
|
122
|
+
<Typography role="body-md" color="muted" truncate>
|
|
123
|
+
Truncated long text: The quick brown fox jumps over the lazy dog and
|
|
124
|
+
keeps going all the way to the edge of the container and beyond.
|
|
125
|
+
</Typography>
|
|
126
|
+
<Typography role="body-md" color="primary" uppercase>
|
|
127
|
+
Uppercase with tracking
|
|
128
|
+
</Typography>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -10,7 +10,9 @@ export * from "./atoms/FilterTabBar";
|
|
|
10
10
|
export * from "./atoms/Input";
|
|
11
11
|
export * from "./atoms/Modal";
|
|
12
12
|
export * from "./atoms/NavItem";
|
|
13
|
+
export * from "./atoms/PreviewToolbar";
|
|
13
14
|
export * from "./atoms/PromptInputBar";
|
|
14
15
|
export * from "./atoms/TopNavbar";
|
|
16
|
+
export * from "./atoms/Typography";
|
|
15
17
|
export * from "./atoms/UpgradeCard";
|
|
16
18
|
export * from "./atoms/WorkspaceMenu";
|