@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
package/dist/styles.css
CHANGED
|
@@ -80,6 +80,14 @@
|
|
|
80
80
|
--color-semantic-warning-soft: #fef9c3;
|
|
81
81
|
--color-semantic-error-soft: #fee2e2;
|
|
82
82
|
--font-body: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
83
|
+
--text-display-lg: 48px;
|
|
84
|
+
--text-display-lg--font-weight: 700;
|
|
85
|
+
--text-display-lg--line-height: 1.1;
|
|
86
|
+
--text-display-lg--letter-spacing: -0.5px;
|
|
87
|
+
--text-heading-lg: 32px;
|
|
88
|
+
--text-heading-lg--font-weight: 700;
|
|
89
|
+
--text-heading-lg--line-height: 1.2;
|
|
90
|
+
--text-heading-lg--letter-spacing: -0.25px;
|
|
83
91
|
--text-heading-md: 24px;
|
|
84
92
|
--text-heading-md--font-weight: 600;
|
|
85
93
|
--text-heading-md--line-height: 1.3;
|
|
@@ -356,6 +364,9 @@
|
|
|
356
364
|
.mx-xs {
|
|
357
365
|
margin-inline: var(--spacing-xs);
|
|
358
366
|
}
|
|
367
|
+
.mx-xxs {
|
|
368
|
+
margin-inline: var(--spacing-xxs);
|
|
369
|
+
}
|
|
359
370
|
.my-xl {
|
|
360
371
|
margin-block: var(--spacing-xl);
|
|
361
372
|
}
|
|
@@ -430,9 +441,6 @@
|
|
|
430
441
|
.inline-flex {
|
|
431
442
|
display: inline-flex;
|
|
432
443
|
}
|
|
433
|
-
.aspect-square {
|
|
434
|
-
aspect-ratio: 1 / 1;
|
|
435
|
-
}
|
|
436
444
|
.size-2\.5 {
|
|
437
445
|
width: calc(var(--spacing) * 2.5);
|
|
438
446
|
height: calc(var(--spacing) * 2.5);
|
|
@@ -459,6 +467,9 @@
|
|
|
459
467
|
.\!h-5 {
|
|
460
468
|
height: calc(var(--spacing) * 5) !important;
|
|
461
469
|
}
|
|
470
|
+
.\!h-8 {
|
|
471
|
+
height: calc(var(--spacing) * 8) !important;
|
|
472
|
+
}
|
|
462
473
|
.h-1\.5 {
|
|
463
474
|
height: calc(var(--spacing) * 1.5);
|
|
464
475
|
}
|
|
@@ -516,6 +527,9 @@
|
|
|
516
527
|
.\!w-5 {
|
|
517
528
|
width: calc(var(--spacing) * 5) !important;
|
|
518
529
|
}
|
|
530
|
+
.\!w-8 {
|
|
531
|
+
width: calc(var(--spacing) * 8) !important;
|
|
532
|
+
}
|
|
519
533
|
.\!w-full {
|
|
520
534
|
width: 100% !important;
|
|
521
535
|
}
|
|
@@ -558,6 +572,9 @@
|
|
|
558
572
|
.w-full {
|
|
559
573
|
width: 100%;
|
|
560
574
|
}
|
|
575
|
+
.w-px {
|
|
576
|
+
width: 1px;
|
|
577
|
+
}
|
|
561
578
|
.max-w-2xl {
|
|
562
579
|
max-width: var(--container-2xl);
|
|
563
580
|
}
|
|
@@ -766,6 +783,13 @@
|
|
|
766
783
|
margin-block-end: calc(var(--spacing-xl) * calc(1 - var(--tw-space-y-reverse)));
|
|
767
784
|
}
|
|
768
785
|
}
|
|
786
|
+
.space-y-xs {
|
|
787
|
+
:where(& > :not(:last-child)) {
|
|
788
|
+
--tw-space-y-reverse: 0;
|
|
789
|
+
margin-block-start: calc(var(--spacing-xs) * var(--tw-space-y-reverse));
|
|
790
|
+
margin-block-end: calc(var(--spacing-xs) * calc(1 - var(--tw-space-y-reverse)));
|
|
791
|
+
}
|
|
792
|
+
}
|
|
769
793
|
.space-y-xxl {
|
|
770
794
|
:where(& > :not(:last-child)) {
|
|
771
795
|
--tw-space-y-reverse: 0;
|
|
@@ -899,6 +923,9 @@
|
|
|
899
923
|
.border-primary {
|
|
900
924
|
border-color: var(--color-primary);
|
|
901
925
|
}
|
|
926
|
+
.border-primary-disabled {
|
|
927
|
+
border-color: var(--color-primary-disabled);
|
|
928
|
+
}
|
|
902
929
|
.border-semantic-error {
|
|
903
930
|
border-color: var(--color-semantic-error);
|
|
904
931
|
}
|
|
@@ -932,9 +959,6 @@
|
|
|
932
959
|
.bg-primary {
|
|
933
960
|
background-color: var(--color-primary);
|
|
934
961
|
}
|
|
935
|
-
.bg-primary-active {
|
|
936
|
-
background-color: var(--color-primary-active);
|
|
937
|
-
}
|
|
938
962
|
.bg-primary-disabled {
|
|
939
963
|
background-color: var(--color-primary-disabled);
|
|
940
964
|
}
|
|
@@ -983,6 +1007,9 @@
|
|
|
983
1007
|
.p-xs {
|
|
984
1008
|
padding: var(--spacing-xs);
|
|
985
1009
|
}
|
|
1010
|
+
.p-xxs {
|
|
1011
|
+
padding: var(--spacing-xxs);
|
|
1012
|
+
}
|
|
986
1013
|
.\!px-0 {
|
|
987
1014
|
padding-inline: 0 !important;
|
|
988
1015
|
}
|
|
@@ -1115,6 +1142,18 @@
|
|
|
1115
1142
|
letter-spacing: var(--tw-tracking, var(--text-caption--letter-spacing));
|
|
1116
1143
|
font-weight: var(--tw-font-weight, var(--text-caption--font-weight));
|
|
1117
1144
|
}
|
|
1145
|
+
.text-display-lg {
|
|
1146
|
+
font-size: var(--text-display-lg);
|
|
1147
|
+
line-height: var(--tw-leading, var(--text-display-lg--line-height));
|
|
1148
|
+
letter-spacing: var(--tw-tracking, var(--text-display-lg--letter-spacing));
|
|
1149
|
+
font-weight: var(--tw-font-weight, var(--text-display-lg--font-weight));
|
|
1150
|
+
}
|
|
1151
|
+
.text-heading-lg {
|
|
1152
|
+
font-size: var(--text-heading-lg);
|
|
1153
|
+
line-height: var(--tw-leading, var(--text-heading-lg--line-height));
|
|
1154
|
+
letter-spacing: var(--tw-tracking, var(--text-heading-lg--letter-spacing));
|
|
1155
|
+
font-weight: var(--tw-font-weight, var(--text-heading-lg--font-weight));
|
|
1156
|
+
}
|
|
1118
1157
|
.text-heading-md {
|
|
1119
1158
|
font-size: var(--text-heading-md);
|
|
1120
1159
|
line-height: var(--tw-leading, var(--text-heading-md--line-height));
|
|
@@ -1161,6 +1200,9 @@
|
|
|
1161
1200
|
.text-body {
|
|
1162
1201
|
color: var(--color-body);
|
|
1163
1202
|
}
|
|
1203
|
+
.text-canvas {
|
|
1204
|
+
color: var(--color-canvas);
|
|
1205
|
+
}
|
|
1164
1206
|
.text-hairline-strong {
|
|
1165
1207
|
color: var(--color-hairline-strong);
|
|
1166
1208
|
}
|
|
@@ -1185,6 +1227,9 @@
|
|
|
1185
1227
|
.text-semantic-success {
|
|
1186
1228
|
color: var(--color-semantic-success);
|
|
1187
1229
|
}
|
|
1230
|
+
.text-semantic-warning {
|
|
1231
|
+
color: var(--color-semantic-warning);
|
|
1232
|
+
}
|
|
1188
1233
|
.uppercase {
|
|
1189
1234
|
text-transform: uppercase;
|
|
1190
1235
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designa8/vibedesign-v6",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "Design system \"Plasma Design System\" generated by atom-server.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -84,6 +84,11 @@
|
|
|
84
84
|
"kind": "Atom",
|
|
85
85
|
"description": null
|
|
86
86
|
},
|
|
87
|
+
{
|
|
88
|
+
"name": "PreviewToolbar",
|
|
89
|
+
"kind": "Atom",
|
|
90
|
+
"description": null
|
|
91
|
+
},
|
|
87
92
|
{
|
|
88
93
|
"name": "PromptInputBar",
|
|
89
94
|
"kind": "Molecule",
|
|
@@ -94,6 +99,11 @@
|
|
|
94
99
|
"kind": "Organism",
|
|
95
100
|
"description": null
|
|
96
101
|
},
|
|
102
|
+
{
|
|
103
|
+
"name": "Typography",
|
|
104
|
+
"kind": "Atom",
|
|
105
|
+
"description": null
|
|
106
|
+
},
|
|
97
107
|
{
|
|
98
108
|
"name": "UpgradeCard",
|
|
99
109
|
"kind": "Molecule",
|
|
@@ -4,19 +4,16 @@ import { Button } from "../Button";
|
|
|
4
4
|
export interface FilterTab {
|
|
5
5
|
/** Unique identifier for this tab */
|
|
6
6
|
value: string;
|
|
7
|
-
/** Display label
|
|
8
|
-
label
|
|
9
|
-
/** Icon rendered before the label (or alone when no label is given) */
|
|
10
|
-
icon?: React.ReactNode;
|
|
7
|
+
/** Display label */
|
|
8
|
+
label: string;
|
|
11
9
|
/** Optional count badge */
|
|
12
10
|
count?: number;
|
|
13
|
-
/** Accessible label required when the tab is icon-only */
|
|
14
|
-
"aria-label"?: string;
|
|
15
11
|
}
|
|
16
12
|
|
|
17
13
|
export interface FilterTabBarProps
|
|
18
14
|
extends Omit<React.ComponentPropsWithoutRef<"div">, "onChange"> {
|
|
19
15
|
tabs: FilterTab[];
|
|
16
|
+
/** Currently active tab value */
|
|
20
17
|
value: string;
|
|
21
18
|
onChange: (value: string) => void;
|
|
22
19
|
}
|
|
@@ -30,7 +27,7 @@ export const FilterTabBar = React.forwardRef<HTMLDivElement, FilterTabBarProps>(
|
|
|
30
27
|
aria-label="Filter tabs"
|
|
31
28
|
className={[
|
|
32
29
|
"inline-flex items-center gap-xs p-xs",
|
|
33
|
-
"bg-
|
|
30
|
+
"bg-canvas border border-hairline rounded-xl shadow-sm",
|
|
34
31
|
className,
|
|
35
32
|
]
|
|
36
33
|
.filter(Boolean)
|
|
@@ -39,32 +36,18 @@ export const FilterTabBar = React.forwardRef<HTMLDivElement, FilterTabBarProps>(
|
|
|
39
36
|
>
|
|
40
37
|
{tabs.map((tab) => {
|
|
41
38
|
const isActive = tab.value === value;
|
|
42
|
-
const iconOnly = !!tab.icon && !tab.label;
|
|
43
39
|
|
|
44
40
|
return (
|
|
45
41
|
<Button
|
|
46
42
|
key={tab.value}
|
|
47
43
|
role="tab"
|
|
48
44
|
aria-selected={isActive}
|
|
49
|
-
aria-label={tab["aria-label"]}
|
|
50
45
|
variant={isActive ? "primary" : "ghost"}
|
|
51
46
|
size="sm"
|
|
52
47
|
onClick={() => onChange(tab.value)}
|
|
53
|
-
|
|
54
|
-
className={[
|
|
55
|
-
"transition-[background-color,color,box-shadow] duration-200 ease-in-out",
|
|
56
|
-
iconOnly ? "!px-xs aspect-square" : "",
|
|
57
|
-
]
|
|
58
|
-
.filter(Boolean)
|
|
59
|
-
.join(" ")}
|
|
48
|
+
className="gap-xs"
|
|
60
49
|
>
|
|
61
|
-
{tab.
|
|
62
|
-
<span className="inline-flex items-center justify-center size-4 shrink-0">
|
|
63
|
-
{tab.icon}
|
|
64
|
-
</span>
|
|
65
|
-
)}
|
|
66
|
-
|
|
67
|
-
{tab.label && <span>{tab.label}</span>}
|
|
50
|
+
<span>{tab.label}</span>
|
|
68
51
|
|
|
69
52
|
{tab.count !== undefined && (
|
|
70
53
|
<span
|
|
@@ -74,7 +57,7 @@ export const FilterTabBar = React.forwardRef<HTMLDivElement, FilterTabBarProps>(
|
|
|
74
57
|
"text-caption leading-none",
|
|
75
58
|
"transition-[background-color,color] duration-200 ease-in-out",
|
|
76
59
|
isActive
|
|
77
|
-
? "bg-
|
|
60
|
+
? "bg-ink text-canvas"
|
|
78
61
|
: "bg-surface-strong text-muted",
|
|
79
62
|
]
|
|
80
63
|
.filter(Boolean)
|
|
@@ -1,92 +1,31 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { FilterTabBar
|
|
2
|
+
import { FilterTabBar } from "./FilterTabBar";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<rect x="1" y="1" width="6" height="6" rx="1" />
|
|
8
|
-
<rect x="9" y="1" width="6" height="6" rx="1" />
|
|
9
|
-
<rect x="1" y="9" width="6" height="6" rx="1" />
|
|
10
|
-
<rect x="9" y="9" width="6" height="6" rx="1" />
|
|
11
|
-
</svg>
|
|
12
|
-
);
|
|
13
|
-
const IconList = () => (
|
|
14
|
-
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" className="size-4">
|
|
15
|
-
<line x1="3" y1="4" x2="13" y2="4" />
|
|
16
|
-
<line x1="3" y1="8" x2="13" y2="8" />
|
|
17
|
-
<line x1="3" y1="12" x2="13" y2="12" />
|
|
18
|
-
</svg>
|
|
19
|
-
);
|
|
20
|
-
const IconColumns = () => (
|
|
21
|
-
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" className="size-4">
|
|
22
|
-
<rect x="1" y="2" width="4" height="12" rx="1" />
|
|
23
|
-
<rect x="6" y="2" width="4" height="12" rx="1" />
|
|
24
|
-
<rect x="11" y="2" width="4" height="12" rx="1" />
|
|
25
|
-
</svg>
|
|
26
|
-
);
|
|
27
|
-
const IconStar = () => (
|
|
28
|
-
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" className="size-4">
|
|
29
|
-
<polygon points="8,1 10,6 15,6 11,9.5 12.5,15 8,12 3.5,15 5,9.5 1,6 6,6" />
|
|
30
|
-
</svg>
|
|
31
|
-
);
|
|
32
|
-
const IconClock = () => (
|
|
33
|
-
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" className="size-4">
|
|
34
|
-
<circle cx="8" cy="8" r="6.5" />
|
|
35
|
-
<polyline points="8,4 8,8 11,10" />
|
|
36
|
-
</svg>
|
|
37
|
-
);
|
|
38
|
-
const IconArchive = () => (
|
|
39
|
-
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" className="size-4">
|
|
40
|
-
<rect x="1" y="3" width="14" height="3" rx="1" />
|
|
41
|
-
<path d="M2 6v7a1 1 0 001 1h10a1 1 0 001-1V6" />
|
|
42
|
-
<line x1="6" y1="9" x2="10" y2="9" />
|
|
43
|
-
</svg>
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
/* ── Tab data ─────────────────────────────────────────────── */
|
|
47
|
-
const iconOnlyTabs: FilterTab[] = [
|
|
48
|
-
{ value: "grid", icon: <IconGrid />, "aria-label": "Grid view" },
|
|
49
|
-
{ value: "list", icon: <IconList />, "aria-label": "List view" },
|
|
50
|
-
{ value: "columns", icon: <IconColumns />, "aria-label": "Columns view" },
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
const iconLabelTabs: FilterTab[] = [
|
|
54
|
-
{ value: "starred", icon: <IconStar />, label: "Starred", count: 4 },
|
|
55
|
-
{ value: "recent", icon: <IconClock />, label: "Recent", count: 12 },
|
|
56
|
-
{ value: "archived", icon: <IconArchive />, label: "Archived", count: 2 },
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
const labelOnlyTabs: FilterTab[] = [
|
|
60
|
-
{ value: "all", label: "All", count: 11 },
|
|
61
|
-
{ value: "atoms", label: "Atoms", count: 5 },
|
|
4
|
+
const tabs = [
|
|
5
|
+
{ value: "all", label: "All", count: 15 },
|
|
6
|
+
{ value: "atoms", label: "Atoms", count: 8 },
|
|
62
7
|
{ value: "molecules", label: "Molecules", count: 2 },
|
|
63
|
-
{ value: "organisms", label: "Organisms", count:
|
|
64
|
-
{ value: "
|
|
8
|
+
{ value: "organisms", label: "Organisms", count: 5 },
|
|
9
|
+
{ value: "templates", label: "Templates", count: 0 },
|
|
65
10
|
];
|
|
66
11
|
|
|
67
12
|
export default function FilterTabBarPreview() {
|
|
68
|
-
const [
|
|
69
|
-
const [scope, setScope] = useState("starred");
|
|
70
|
-
const [kind, setKind] = useState("all");
|
|
13
|
+
const [active, setActive] = useState("all");
|
|
71
14
|
|
|
72
15
|
return (
|
|
73
|
-
<div className="w-full max-w-3xl mx-auto p-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<p className="text-caption text-muted uppercase tracking-wide mb-sm">Label + count (original)</p>
|
|
87
|
-
<FilterTabBar tabs={labelOnlyTabs} value={kind} onChange={setKind} />
|
|
88
|
-
</div>
|
|
89
|
-
|
|
16
|
+
<div className="w-full max-w-3xl mx-auto p-xl flex flex-col items-center gap-xl bg-canvas py-xxl justify-center">
|
|
17
|
+
<FilterTabBar tabs={tabs} value={active} onChange={setActive} />
|
|
18
|
+
|
|
19
|
+
{/* No-count variant */}
|
|
20
|
+
<FilterTabBar
|
|
21
|
+
tabs={[
|
|
22
|
+
{ value: "recent", label: "Recent" },
|
|
23
|
+
{ value: "starred", label: "Starred" },
|
|
24
|
+
{ value: "archived", label: "Archived" },
|
|
25
|
+
]}
|
|
26
|
+
value="recent"
|
|
27
|
+
onChange={() => {}}
|
|
28
|
+
/>
|
|
90
29
|
</div>
|
|
91
30
|
);
|
|
92
31
|
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
import { Chip } from "../Chip";
|
|
4
|
+
|
|
5
|
+
// ─── Icons ─────────────────────────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
const DesktopIcon = () => (
|
|
8
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
9
|
+
<rect x="2" y="3" width="20" height="14" rx="2" />
|
|
10
|
+
<path d="M8 21h8M12 17v4" />
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const SidebarIcon = () => (
|
|
15
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
16
|
+
<rect x="2" y="3" width="20" height="18" rx="2" />
|
|
17
|
+
<path d="M9 3v18" />
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const MobileIcon = () => (
|
|
22
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
23
|
+
<rect x="5" y="2" width="14" height="20" rx="2" />
|
|
24
|
+
<circle cx="12" cy="17" r="1" fill="currentColor" stroke="none" />
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const ExpandIcon = () => (
|
|
29
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
30
|
+
<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7" />
|
|
31
|
+
</svg>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
/** Circular cursor pointer icon (matching the reference's "inspect" icon) */
|
|
35
|
+
const InspectIcon = () => (
|
|
36
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
37
|
+
<circle cx="12" cy="12" r="9" />
|
|
38
|
+
<path d="M12 8v4l3 3" />
|
|
39
|
+
<circle cx="12" cy="12" r="1" fill="currentColor" stroke="none" />
|
|
40
|
+
</svg>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const MoonIcon = () => (
|
|
44
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
45
|
+
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
|
|
46
|
+
</svg>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const FullscreenIcon = () => (
|
|
50
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
51
|
+
<polyline points="15 3 21 3 21 9" />
|
|
52
|
+
<polyline points="9 21 3 21 3 15" />
|
|
53
|
+
<line x1="21" y1="3" x2="14" y2="10" />
|
|
54
|
+
<line x1="3" y1="21" x2="10" y2="14" />
|
|
55
|
+
</svg>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const DotsIcon = () => (
|
|
59
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" stroke="none" aria-hidden="true">
|
|
60
|
+
<circle cx="12" cy="5" r="1.6" />
|
|
61
|
+
<circle cx="12" cy="12" r="1.6" />
|
|
62
|
+
<circle cx="12" cy="19" r="1.6" />
|
|
63
|
+
</svg>
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
// ─── Types ─────────────────────────────────────────────────────────────────────
|
|
67
|
+
|
|
68
|
+
export type Viewport = "desktop" | "sidebar" | "mobile";
|
|
69
|
+
|
|
70
|
+
interface ViewportOption {
|
|
71
|
+
id: Viewport;
|
|
72
|
+
Icon: React.FC;
|
|
73
|
+
label: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const VIEWPORT_OPTIONS: ViewportOption[] = [
|
|
77
|
+
{ id: "desktop", Icon: DesktopIcon, label: "Desktop view" },
|
|
78
|
+
{ id: "sidebar", Icon: SidebarIcon, label: "Sidebar view" },
|
|
79
|
+
{ id: "mobile", Icon: MobileIcon, label: "Mobile view" },
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
// ─── Props ─────────────────────────────────────────────────────────────────────
|
|
83
|
+
|
|
84
|
+
export interface PreviewToolbarProps {
|
|
85
|
+
/** Currently active viewport */
|
|
86
|
+
viewport?: Viewport;
|
|
87
|
+
onViewportChange?: (v: Viewport) => void;
|
|
88
|
+
/** Dark mode state */
|
|
89
|
+
darkMode?: boolean;
|
|
90
|
+
onDarkToggle?: () => void;
|
|
91
|
+
/**
|
|
92
|
+
* When true, the Inspect tokens button shows "Exit inspect" with a primary
|
|
93
|
+
* (filled) variant to indicate the active state. When false (default), shows
|
|
94
|
+
* "Inspect tokens" with the secondary variant.
|
|
95
|
+
*/
|
|
96
|
+
inspecting?: boolean;
|
|
97
|
+
onInspectTokens?: () => void;
|
|
98
|
+
onFullscreen?: () => void;
|
|
99
|
+
onExpand?: () => void;
|
|
100
|
+
/** Model name shown as a chip, e.g. "Sonnet 4.6" */
|
|
101
|
+
modelLabel?: string;
|
|
102
|
+
/** Component kind shown as a chip, e.g. "ATOM" */
|
|
103
|
+
kindLabel?: string;
|
|
104
|
+
onOverflow?: () => void;
|
|
105
|
+
className?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ─── Viewport button — tight icon-only toggle not coverable by Button variants ─
|
|
109
|
+
|
|
110
|
+
interface VpBtnProps {
|
|
111
|
+
label: string;
|
|
112
|
+
active: boolean;
|
|
113
|
+
onClick: () => void;
|
|
114
|
+
children: React.ReactNode;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const ViewportBtn: React.FC<VpBtnProps> = ({ label, active, onClick, children }) => (
|
|
118
|
+
<Button
|
|
119
|
+
variant={active ? "primary" : "ghost"}
|
|
120
|
+
size="sm"
|
|
121
|
+
aria-label={label}
|
|
122
|
+
aria-pressed={active}
|
|
123
|
+
onClick={onClick}
|
|
124
|
+
className={["!w-8 !h-8 !p-0 rounded-sm shrink-0", active ? "" : "text-muted"].join(" ")}
|
|
125
|
+
>
|
|
126
|
+
{children}
|
|
127
|
+
</Button>
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
// ─── Main ──────────────────────────────────────────────────────────────────────
|
|
131
|
+
|
|
132
|
+
export const PreviewToolbar = React.forwardRef<HTMLDivElement, PreviewToolbarProps>(
|
|
133
|
+
(
|
|
134
|
+
{
|
|
135
|
+
viewport = "desktop",
|
|
136
|
+
onViewportChange,
|
|
137
|
+
darkMode = false,
|
|
138
|
+
onDarkToggle,
|
|
139
|
+
inspecting = false,
|
|
140
|
+
onInspectTokens,
|
|
141
|
+
onFullscreen,
|
|
142
|
+
onExpand,
|
|
143
|
+
modelLabel = "Sonnet 4.6",
|
|
144
|
+
kindLabel = "ATOM",
|
|
145
|
+
onOverflow,
|
|
146
|
+
className = "",
|
|
147
|
+
},
|
|
148
|
+
ref,
|
|
149
|
+
) => (
|
|
150
|
+
<div
|
|
151
|
+
ref={ref}
|
|
152
|
+
role="toolbar"
|
|
153
|
+
aria-label="Preview toolbar"
|
|
154
|
+
className={[
|
|
155
|
+
"inline-flex items-center gap-sm px-sm py-xs",
|
|
156
|
+
"bg-canvas border border-hairline rounded-xl shadow-md",
|
|
157
|
+
className,
|
|
158
|
+
].filter(Boolean).join(" ")}
|
|
159
|
+
>
|
|
160
|
+
{/* ── Viewport toggles ── */}
|
|
161
|
+
<div
|
|
162
|
+
role="group"
|
|
163
|
+
aria-label="Viewport size"
|
|
164
|
+
className="inline-flex items-center gap-xxs bg-surface-soft rounded-lg p-xxs"
|
|
165
|
+
>
|
|
166
|
+
{VIEWPORT_OPTIONS.map(({ id, Icon, label }) => (
|
|
167
|
+
<ViewportBtn
|
|
168
|
+
key={id}
|
|
169
|
+
label={label}
|
|
170
|
+
active={viewport === id}
|
|
171
|
+
onClick={() => onViewportChange?.(id)}
|
|
172
|
+
>
|
|
173
|
+
<Icon />
|
|
174
|
+
</ViewportBtn>
|
|
175
|
+
))}
|
|
176
|
+
|
|
177
|
+
<div className="w-px h-4 bg-hairline mx-xxs" aria-hidden />
|
|
178
|
+
|
|
179
|
+
<Button
|
|
180
|
+
variant="ghost"
|
|
181
|
+
size="sm"
|
|
182
|
+
aria-label="Expand preview"
|
|
183
|
+
onClick={onExpand}
|
|
184
|
+
className="!w-8 !h-8 !p-0 rounded-sm text-muted shrink-0"
|
|
185
|
+
>
|
|
186
|
+
<ExpandIcon />
|
|
187
|
+
</Button>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
{/* ── Inspect tokens button — variant and label driven by `inspecting` prop ── */}
|
|
191
|
+
<Button
|
|
192
|
+
variant={inspecting ? "primary" : "secondary"}
|
|
193
|
+
size="sm"
|
|
194
|
+
aria-pressed={inspecting}
|
|
195
|
+
onClick={onInspectTokens}
|
|
196
|
+
className="gap-xs rounded-xl"
|
|
197
|
+
>
|
|
198
|
+
<InspectIcon />
|
|
199
|
+
{inspecting ? "Exit inspect" : "Inspect tokens"}
|
|
200
|
+
</Button>
|
|
201
|
+
|
|
202
|
+
<Button
|
|
203
|
+
variant={darkMode ? "primary" : "secondary"}
|
|
204
|
+
size="sm"
|
|
205
|
+
aria-pressed={darkMode}
|
|
206
|
+
onClick={onDarkToggle}
|
|
207
|
+
className="gap-xs rounded-xl"
|
|
208
|
+
>
|
|
209
|
+
<MoonIcon />
|
|
210
|
+
Dark
|
|
211
|
+
</Button>
|
|
212
|
+
|
|
213
|
+
<Button
|
|
214
|
+
variant="secondary"
|
|
215
|
+
size="sm"
|
|
216
|
+
onClick={onFullscreen}
|
|
217
|
+
className="gap-xs rounded-xl"
|
|
218
|
+
>
|
|
219
|
+
<FullscreenIcon />
|
|
220
|
+
Fullscreen
|
|
221
|
+
</Button>
|
|
222
|
+
|
|
223
|
+
{/* ── Model chip (outlined primary style) ── */}
|
|
224
|
+
<Chip
|
|
225
|
+
label={modelLabel ?? ""}
|
|
226
|
+
variant="default"
|
|
227
|
+
size="md"
|
|
228
|
+
className="border-primary text-primary bg-canvas cursor-default select-none"
|
|
229
|
+
/>
|
|
230
|
+
|
|
231
|
+
{/* ── Kind chip (filled soft primary) ── */}
|
|
232
|
+
<Chip
|
|
233
|
+
label={kindLabel ?? ""}
|
|
234
|
+
variant="default"
|
|
235
|
+
size="md"
|
|
236
|
+
className="bg-primary-disabled border-primary-disabled text-primary cursor-default select-none"
|
|
237
|
+
/>
|
|
238
|
+
|
|
239
|
+
{/* ── Overflow ── */}
|
|
240
|
+
<Button
|
|
241
|
+
variant="ghost"
|
|
242
|
+
size="sm"
|
|
243
|
+
aria-label="More options"
|
|
244
|
+
onClick={onOverflow}
|
|
245
|
+
className="!w-8 !h-8 !p-0 rounded-sm text-muted shrink-0"
|
|
246
|
+
>
|
|
247
|
+
<DotsIcon />
|
|
248
|
+
</Button>
|
|
249
|
+
</div>
|
|
250
|
+
),
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
PreviewToolbar.displayName = "PreviewToolbar";
|