@designa8/vibedesign-v6 1.12.3 → 1.12.5
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 +58 -6
- package/dist/index.js +58 -6
- package/dist/styles.css +3 -0
- package/package.json +1 -1
- package/src/atoms/ExportDesignMdModal/ExportDesignMdModal.tsx +54 -4
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3884,6 +3884,39 @@ var DownloadIcon = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
|
3884
3884
|
]
|
|
3885
3885
|
}
|
|
3886
3886
|
);
|
|
3887
|
+
var SpinnerIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3888
|
+
"svg",
|
|
3889
|
+
{
|
|
3890
|
+
viewBox: "0 0 24 24",
|
|
3891
|
+
width: "20",
|
|
3892
|
+
height: "20",
|
|
3893
|
+
fill: "none",
|
|
3894
|
+
className: "animate-spin text-primary",
|
|
3895
|
+
"aria-hidden": "true",
|
|
3896
|
+
children: [
|
|
3897
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3898
|
+
"circle",
|
|
3899
|
+
{
|
|
3900
|
+
cx: "12",
|
|
3901
|
+
cy: "12",
|
|
3902
|
+
r: "9",
|
|
3903
|
+
stroke: "currentColor",
|
|
3904
|
+
strokeWidth: "2.5",
|
|
3905
|
+
strokeOpacity: "0.25"
|
|
3906
|
+
}
|
|
3907
|
+
),
|
|
3908
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3909
|
+
"path",
|
|
3910
|
+
{
|
|
3911
|
+
d: "M21 12a9 9 0 0 0-9-9",
|
|
3912
|
+
stroke: "currentColor",
|
|
3913
|
+
strokeWidth: "2.5",
|
|
3914
|
+
strokeLinecap: "round"
|
|
3915
|
+
}
|
|
3916
|
+
)
|
|
3917
|
+
]
|
|
3918
|
+
}
|
|
3919
|
+
);
|
|
3887
3920
|
var ExportDesignMdModal = import_react17.default.forwardRef(
|
|
3888
3921
|
({
|
|
3889
3922
|
isOpen,
|
|
@@ -3891,11 +3924,17 @@ var ExportDesignMdModal = import_react17.default.forwardRef(
|
|
|
3891
3924
|
onExport,
|
|
3892
3925
|
onDownload,
|
|
3893
3926
|
onCopy,
|
|
3927
|
+
onSourceChange,
|
|
3894
3928
|
designSystemName = "Design System",
|
|
3895
3929
|
defaultSource = "production",
|
|
3896
|
-
lines = defaultLines
|
|
3930
|
+
lines = defaultLines,
|
|
3931
|
+
loading = false
|
|
3897
3932
|
}, ref) => {
|
|
3898
3933
|
const [source, setSource] = (0, import_react17.useState)(defaultSource);
|
|
3934
|
+
const changeSource = (next) => {
|
|
3935
|
+
setSource(next);
|
|
3936
|
+
onSourceChange?.(next);
|
|
3937
|
+
};
|
|
3899
3938
|
const handleCopy = () => {
|
|
3900
3939
|
const text = lines.map((l) => l.text).join("\n");
|
|
3901
3940
|
if (typeof navigator !== "undefined" && navigator.clipboard) {
|
|
@@ -3931,7 +3970,7 @@ var ExportDesignMdModal = import_react17.default.forwardRef(
|
|
|
3931
3970
|
{
|
|
3932
3971
|
variant: source === "production" ? "primary" : "ghost",
|
|
3933
3972
|
size: "sm",
|
|
3934
|
-
onClick: () =>
|
|
3973
|
+
onClick: () => changeSource("production"),
|
|
3935
3974
|
children: [
|
|
3936
3975
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CloudIcon, {}),
|
|
3937
3976
|
"Production"
|
|
@@ -3943,7 +3982,7 @@ var ExportDesignMdModal = import_react17.default.forwardRef(
|
|
|
3943
3982
|
{
|
|
3944
3983
|
variant: source === "local" ? "primary" : "ghost",
|
|
3945
3984
|
size: "sm",
|
|
3946
|
-
onClick: () =>
|
|
3985
|
+
onClick: () => changeSource("local"),
|
|
3947
3986
|
children: [
|
|
3948
3987
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LinkIcon, {}),
|
|
3949
3988
|
"Local (npm link)"
|
|
@@ -3987,7 +4026,20 @@ var ExportDesignMdModal = import_react17.default.forwardRef(
|
|
|
3987
4026
|
children: line.text.replace("Design System", designSystemName) || "\xA0"
|
|
3988
4027
|
}
|
|
3989
4028
|
)
|
|
3990
|
-
] }, i)) })
|
|
4029
|
+
] }, i)) }),
|
|
4030
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
4031
|
+
"div",
|
|
4032
|
+
{
|
|
4033
|
+
role: "status",
|
|
4034
|
+
"aria-live": "polite",
|
|
4035
|
+
"aria-label": "Loading preview",
|
|
4036
|
+
className: "absolute inset-0 flex items-center justify-center gap-sm bg-canvas opacity-90",
|
|
4037
|
+
children: [
|
|
4038
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SpinnerIcon2, {}),
|
|
4039
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Typography, { role: "body-sm", color: "muted", children: "Loading preview\u2026" })
|
|
4040
|
+
]
|
|
4041
|
+
}
|
|
4042
|
+
) : null
|
|
3991
4043
|
] })
|
|
3992
4044
|
] }),
|
|
3993
4045
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w-full space-y-sm", children: [
|
|
@@ -4002,7 +4054,7 @@ var ExportDesignMdModal = import_react17.default.forwardRef(
|
|
|
4002
4054
|
{
|
|
4003
4055
|
variant: "secondary",
|
|
4004
4056
|
size: "sm",
|
|
4005
|
-
onClick: () =>
|
|
4057
|
+
onClick: () => changeSource("production"),
|
|
4006
4058
|
children: "Switch"
|
|
4007
4059
|
}
|
|
4008
4060
|
)
|
|
@@ -4018,7 +4070,7 @@ var ExportDesignMdModal = import_react17.default.forwardRef(
|
|
|
4018
4070
|
{
|
|
4019
4071
|
variant: "secondary",
|
|
4020
4072
|
size: "sm",
|
|
4021
|
-
onClick: () =>
|
|
4073
|
+
onClick: () => changeSource("local"),
|
|
4022
4074
|
children: "Switch"
|
|
4023
4075
|
}
|
|
4024
4076
|
)
|
package/dist/index.js
CHANGED
|
@@ -3831,6 +3831,39 @@ var DownloadIcon = () => /* @__PURE__ */ jsxs16(
|
|
|
3831
3831
|
]
|
|
3832
3832
|
}
|
|
3833
3833
|
);
|
|
3834
|
+
var SpinnerIcon2 = () => /* @__PURE__ */ jsxs16(
|
|
3835
|
+
"svg",
|
|
3836
|
+
{
|
|
3837
|
+
viewBox: "0 0 24 24",
|
|
3838
|
+
width: "20",
|
|
3839
|
+
height: "20",
|
|
3840
|
+
fill: "none",
|
|
3841
|
+
className: "animate-spin text-primary",
|
|
3842
|
+
"aria-hidden": "true",
|
|
3843
|
+
children: [
|
|
3844
|
+
/* @__PURE__ */ jsx17(
|
|
3845
|
+
"circle",
|
|
3846
|
+
{
|
|
3847
|
+
cx: "12",
|
|
3848
|
+
cy: "12",
|
|
3849
|
+
r: "9",
|
|
3850
|
+
stroke: "currentColor",
|
|
3851
|
+
strokeWidth: "2.5",
|
|
3852
|
+
strokeOpacity: "0.25"
|
|
3853
|
+
}
|
|
3854
|
+
),
|
|
3855
|
+
/* @__PURE__ */ jsx17(
|
|
3856
|
+
"path",
|
|
3857
|
+
{
|
|
3858
|
+
d: "M21 12a9 9 0 0 0-9-9",
|
|
3859
|
+
stroke: "currentColor",
|
|
3860
|
+
strokeWidth: "2.5",
|
|
3861
|
+
strokeLinecap: "round"
|
|
3862
|
+
}
|
|
3863
|
+
)
|
|
3864
|
+
]
|
|
3865
|
+
}
|
|
3866
|
+
);
|
|
3834
3867
|
var ExportDesignMdModal = React17.forwardRef(
|
|
3835
3868
|
({
|
|
3836
3869
|
isOpen,
|
|
@@ -3838,11 +3871,17 @@ var ExportDesignMdModal = React17.forwardRef(
|
|
|
3838
3871
|
onExport,
|
|
3839
3872
|
onDownload,
|
|
3840
3873
|
onCopy,
|
|
3874
|
+
onSourceChange,
|
|
3841
3875
|
designSystemName = "Design System",
|
|
3842
3876
|
defaultSource = "production",
|
|
3843
|
-
lines = defaultLines
|
|
3877
|
+
lines = defaultLines,
|
|
3878
|
+
loading = false
|
|
3844
3879
|
}, ref) => {
|
|
3845
3880
|
const [source, setSource] = useState3(defaultSource);
|
|
3881
|
+
const changeSource = (next) => {
|
|
3882
|
+
setSource(next);
|
|
3883
|
+
onSourceChange?.(next);
|
|
3884
|
+
};
|
|
3846
3885
|
const handleCopy = () => {
|
|
3847
3886
|
const text = lines.map((l) => l.text).join("\n");
|
|
3848
3887
|
if (typeof navigator !== "undefined" && navigator.clipboard) {
|
|
@@ -3878,7 +3917,7 @@ var ExportDesignMdModal = React17.forwardRef(
|
|
|
3878
3917
|
{
|
|
3879
3918
|
variant: source === "production" ? "primary" : "ghost",
|
|
3880
3919
|
size: "sm",
|
|
3881
|
-
onClick: () =>
|
|
3920
|
+
onClick: () => changeSource("production"),
|
|
3882
3921
|
children: [
|
|
3883
3922
|
/* @__PURE__ */ jsx17(CloudIcon, {}),
|
|
3884
3923
|
"Production"
|
|
@@ -3890,7 +3929,7 @@ var ExportDesignMdModal = React17.forwardRef(
|
|
|
3890
3929
|
{
|
|
3891
3930
|
variant: source === "local" ? "primary" : "ghost",
|
|
3892
3931
|
size: "sm",
|
|
3893
|
-
onClick: () =>
|
|
3932
|
+
onClick: () => changeSource("local"),
|
|
3894
3933
|
children: [
|
|
3895
3934
|
/* @__PURE__ */ jsx17(LinkIcon, {}),
|
|
3896
3935
|
"Local (npm link)"
|
|
@@ -3934,7 +3973,20 @@ var ExportDesignMdModal = React17.forwardRef(
|
|
|
3934
3973
|
children: line.text.replace("Design System", designSystemName) || "\xA0"
|
|
3935
3974
|
}
|
|
3936
3975
|
)
|
|
3937
|
-
] }, i)) })
|
|
3976
|
+
] }, i)) }),
|
|
3977
|
+
loading ? /* @__PURE__ */ jsxs16(
|
|
3978
|
+
"div",
|
|
3979
|
+
{
|
|
3980
|
+
role: "status",
|
|
3981
|
+
"aria-live": "polite",
|
|
3982
|
+
"aria-label": "Loading preview",
|
|
3983
|
+
className: "absolute inset-0 flex items-center justify-center gap-sm bg-canvas opacity-90",
|
|
3984
|
+
children: [
|
|
3985
|
+
/* @__PURE__ */ jsx17(SpinnerIcon2, {}),
|
|
3986
|
+
/* @__PURE__ */ jsx17(Typography, { role: "body-sm", color: "muted", children: "Loading preview\u2026" })
|
|
3987
|
+
]
|
|
3988
|
+
}
|
|
3989
|
+
) : null
|
|
3938
3990
|
] })
|
|
3939
3991
|
] }),
|
|
3940
3992
|
/* @__PURE__ */ jsxs16("div", { className: "w-full space-y-sm", children: [
|
|
@@ -3949,7 +4001,7 @@ var ExportDesignMdModal = React17.forwardRef(
|
|
|
3949
4001
|
{
|
|
3950
4002
|
variant: "secondary",
|
|
3951
4003
|
size: "sm",
|
|
3952
|
-
onClick: () =>
|
|
4004
|
+
onClick: () => changeSource("production"),
|
|
3953
4005
|
children: "Switch"
|
|
3954
4006
|
}
|
|
3955
4007
|
)
|
|
@@ -3965,7 +4017,7 @@ var ExportDesignMdModal = React17.forwardRef(
|
|
|
3965
4017
|
{
|
|
3966
4018
|
variant: "secondary",
|
|
3967
4019
|
size: "sm",
|
|
3968
|
-
onClick: () =>
|
|
4020
|
+
onClick: () => changeSource("local"),
|
|
3969
4021
|
children: "Switch"
|
|
3970
4022
|
}
|
|
3971
4023
|
)
|
package/dist/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -24,12 +24,16 @@ export interface ExportDesignMdModalProps {
|
|
|
24
24
|
onDownload?: () => void;
|
|
25
25
|
/** Called when the user copies the preview to the clipboard */
|
|
26
26
|
onCopy?: () => void;
|
|
27
|
+
/** Called every time the user switches the source toggle (tabs or Switch buttons) */
|
|
28
|
+
onSourceChange?: (source: ExportDesignMdSource) => void;
|
|
27
29
|
/** Name of the design system shown in the generated heading */
|
|
28
30
|
designSystemName?: string;
|
|
29
31
|
/** Which source tab is selected by default */
|
|
30
32
|
defaultSource?: ExportDesignMdSource;
|
|
31
33
|
/** Lines rendered in the code preview panel */
|
|
32
34
|
lines?: ExportDesignMdLine[];
|
|
35
|
+
/** When true, shows a loading overlay on the preview panel while a fetch is in progress */
|
|
36
|
+
loading?: boolean;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
// Note: token values below are written out as literal strings on purpose —
|
|
@@ -135,6 +139,32 @@ const DownloadIcon = () => (
|
|
|
135
139
|
</svg>
|
|
136
140
|
);
|
|
137
141
|
|
|
142
|
+
const SpinnerIcon = () => (
|
|
143
|
+
<svg
|
|
144
|
+
viewBox="0 0 24 24"
|
|
145
|
+
width="20"
|
|
146
|
+
height="20"
|
|
147
|
+
fill="none"
|
|
148
|
+
className="animate-spin text-primary"
|
|
149
|
+
aria-hidden="true"
|
|
150
|
+
>
|
|
151
|
+
<circle
|
|
152
|
+
cx="12"
|
|
153
|
+
cy="12"
|
|
154
|
+
r="9"
|
|
155
|
+
stroke="currentColor"
|
|
156
|
+
strokeWidth="2.5"
|
|
157
|
+
strokeOpacity="0.25"
|
|
158
|
+
/>
|
|
159
|
+
<path
|
|
160
|
+
d="M21 12a9 9 0 0 0-9-9"
|
|
161
|
+
stroke="currentColor"
|
|
162
|
+
strokeWidth="2.5"
|
|
163
|
+
strokeLinecap="round"
|
|
164
|
+
/>
|
|
165
|
+
</svg>
|
|
166
|
+
);
|
|
167
|
+
|
|
138
168
|
export const ExportDesignMdModal = React.forwardRef<
|
|
139
169
|
HTMLDivElement,
|
|
140
170
|
ExportDesignMdModalProps
|
|
@@ -146,14 +176,21 @@ export const ExportDesignMdModal = React.forwardRef<
|
|
|
146
176
|
onExport,
|
|
147
177
|
onDownload,
|
|
148
178
|
onCopy,
|
|
179
|
+
onSourceChange,
|
|
149
180
|
designSystemName = "Design System",
|
|
150
181
|
defaultSource = "production",
|
|
151
182
|
lines = defaultLines,
|
|
183
|
+
loading = false,
|
|
152
184
|
},
|
|
153
185
|
ref
|
|
154
186
|
) => {
|
|
155
187
|
const [source, setSource] = useState<ExportDesignMdSource>(defaultSource);
|
|
156
188
|
|
|
189
|
+
const changeSource = (next: ExportDesignMdSource) => {
|
|
190
|
+
setSource(next);
|
|
191
|
+
onSourceChange?.(next);
|
|
192
|
+
};
|
|
193
|
+
|
|
157
194
|
const handleCopy = () => {
|
|
158
195
|
const text = lines.map((l) => l.text).join("\n");
|
|
159
196
|
if (typeof navigator !== "undefined" && navigator.clipboard) {
|
|
@@ -198,7 +235,7 @@ export const ExportDesignMdModal = React.forwardRef<
|
|
|
198
235
|
<Button
|
|
199
236
|
variant={source === "production" ? "primary" : "ghost"}
|
|
200
237
|
size="sm"
|
|
201
|
-
onClick={() =>
|
|
238
|
+
onClick={() => changeSource("production")}
|
|
202
239
|
>
|
|
203
240
|
<CloudIcon />
|
|
204
241
|
Production
|
|
@@ -206,7 +243,7 @@ export const ExportDesignMdModal = React.forwardRef<
|
|
|
206
243
|
<Button
|
|
207
244
|
variant={source === "local" ? "primary" : "ghost"}
|
|
208
245
|
size="sm"
|
|
209
|
-
onClick={() =>
|
|
246
|
+
onClick={() => changeSource("local")}
|
|
210
247
|
>
|
|
211
248
|
<LinkIcon />
|
|
212
249
|
Local (npm link)
|
|
@@ -258,6 +295,19 @@ export const ExportDesignMdModal = React.forwardRef<
|
|
|
258
295
|
</div>
|
|
259
296
|
))}
|
|
260
297
|
</div>
|
|
298
|
+
{loading ? (
|
|
299
|
+
<div
|
|
300
|
+
role="status"
|
|
301
|
+
aria-live="polite"
|
|
302
|
+
aria-label="Loading preview"
|
|
303
|
+
className="absolute inset-0 flex items-center justify-center gap-sm bg-canvas opacity-90"
|
|
304
|
+
>
|
|
305
|
+
<SpinnerIcon />
|
|
306
|
+
<Typography role="body-sm" color="muted">
|
|
307
|
+
Loading preview…
|
|
308
|
+
</Typography>
|
|
309
|
+
</div>
|
|
310
|
+
) : null}
|
|
261
311
|
</div>
|
|
262
312
|
</div>
|
|
263
313
|
|
|
@@ -281,7 +331,7 @@ export const ExportDesignMdModal = React.forwardRef<
|
|
|
281
331
|
<Button
|
|
282
332
|
variant="secondary"
|
|
283
333
|
size="sm"
|
|
284
|
-
onClick={() =>
|
|
334
|
+
onClick={() => changeSource("production")}
|
|
285
335
|
>
|
|
286
336
|
Switch
|
|
287
337
|
</Button>
|
|
@@ -306,7 +356,7 @@ export const ExportDesignMdModal = React.forwardRef<
|
|
|
306
356
|
<Button
|
|
307
357
|
variant="secondary"
|
|
308
358
|
size="sm"
|
|
309
|
-
onClick={() =>
|
|
359
|
+
onClick={() => changeSource("local")}
|
|
310
360
|
>
|
|
311
361
|
Switch
|
|
312
362
|
</Button>
|