@designa8/vibedesign-v6 1.20.12 → 1.20.14

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.
@@ -3,6 +3,7 @@ import { Modal } from "../Modal";
3
3
  import { Button } from "../Button";
4
4
  import { Input } from "../Input";
5
5
  import { Chip } from "../Chip";
6
+ import { Icon } from "../Icon";
6
7
 
7
8
  export type PublishTarget = "production" | "local";
8
9
 
@@ -19,84 +20,12 @@ export interface PublishModalProps {
19
20
  currentVersion?: string;
20
21
  /** Suggested next version (editable) */
21
22
  defaultNextVersion?: string;
22
- /** Which tab is selected by default */
23
+ /** The env-determined publish target. There is no in-modal switcher — this is the target. */
23
24
  defaultTarget?: PublishTarget;
24
- /** When true, the publish action is in-flight: disables the tabs, Cancel, and shows a spinner on the submit button */
25
+ /** When true, the publish action is in-flight: disables inputs and Cancel, and shows a spinner on the submit button */
25
26
  loading?: boolean;
26
27
  }
27
28
 
28
- const GlobeIcon = () => (
29
- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
30
- <circle cx="12" cy="12" r="9" />
31
- <path d="M3 12h18" />
32
- <path d="M12 3a13.5 13.5 0 0 1 0 18" />
33
- <path d="M12 3a13.5 13.5 0 0 0 0 18" />
34
- </svg>
35
- );
36
-
37
- const LinkIcon = () => (
38
- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
39
- <path d="M9 17H7A5 5 0 0 1 7 7h2" />
40
- <path d="M15 7h2a5 5 0 1 1 0 10h-2" />
41
- <line x1="8" y1="12" x2="16" y2="12" />
42
- </svg>
43
- );
44
-
45
- const InfoIcon = () => (
46
- <svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
47
- <circle cx="12" cy="12" r="10" opacity="0.15" />
48
- <circle cx="12" cy="7.5" r="1.15" />
49
- <rect x="11" y="10.5" width="2" height="7" rx="1" />
50
- </svg>
51
- );
52
-
53
- const CheckCircleIcon = () => (
54
- <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
55
- <circle cx="12" cy="12" r="9" />
56
- <path d="M8.5 12.5l2.2 2.2 4.8-5" />
57
- </svg>
58
- );
59
-
60
- const LockIcon = () => (
61
- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
62
- <rect x="5" y="10" width="14" height="10" rx="2" />
63
- <path d="M8 10V7a4 4 0 0 1 8 0v3" />
64
- </svg>
65
- );
66
-
67
- const RefreshIcon = () => (
68
- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
69
- <path d="M4 4v5h5" />
70
- <path d="M20 20v-5h-5" />
71
- <path d="M5.5 9A7 7 0 0 1 19 12" />
72
- <path d="M18.5 15A7 7 0 0 1 5 12" />
73
- </svg>
74
- );
75
-
76
- const ChevronIcon = ({ open }: { open: boolean }) => (
77
- <svg
78
- viewBox="0 0 24 24"
79
- width="14"
80
- height="14"
81
- fill="none"
82
- stroke="currentColor"
83
- strokeWidth="2"
84
- strokeLinecap="round"
85
- strokeLinejoin="round"
86
- aria-hidden="true"
87
- className={["transition-transform duration-150", open ? "rotate-90" : ""].join(" ")}
88
- >
89
- <path d="M9 6l6 6-6 6" />
90
- </svg>
91
- );
92
-
93
- const SpinnerIcon = () => (
94
- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" aria-hidden="true" className="animate-spin">
95
- <circle cx="12" cy="12" r="9" stroke="currentColor" strokeWidth="2" opacity="0.25" />
96
- <path d="M21 12a9 9 0 0 0-9-9" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
97
- </svg>
98
- );
99
-
100
29
  function bumpMinor(version: string): string {
101
30
  const parts = version.split(".").map((n) => parseInt(n, 10) || 0);
102
31
  const [major = 0, minor = 0] = parts;
@@ -117,26 +46,16 @@ export const PublishModal = React.forwardRef<HTMLDivElement, PublishModalProps>(
117
46
  },
118
47
  ref
119
48
  ) => {
120
- const [target, setTarget] = useState<PublishTarget>(defaultTarget);
49
+ const target = defaultTarget;
121
50
  const [nextVersion, setNextVersion] = useState(
122
51
  defaultNextVersion ?? bumpMinor(currentVersion)
123
52
  );
124
- const [notesOpen, setNotesOpen] = useState(false);
125
- const [notes, setNotes] = useState("");
126
53
 
127
54
  const isProduction = target === "production";
128
55
 
129
- const summaryItems = isProduction
130
- ? [
131
- { title: "Package validated", desc: "All required fields are valid." },
132
- { title: "No breaking changes", desc: "Compatible with previous versions." },
133
- { title: "Access", desc: "You have publish access to this package." },
134
- ]
135
- : [
136
- { title: "Package built", desc: "Local build artifacts are up to date." },
137
- { title: "Link target resolved", desc: "A local npm link target was found." },
138
- { title: "No global conflicts", desc: "No other project links this package name." },
139
- ];
56
+ const introText = isProduction
57
+ ? "Publish your package to the npm registry so others can install and use it."
58
+ : "Publish this package locally with npm link for testing and internal use before a real release.";
140
59
 
141
60
  const noticeText = isProduction
142
61
  ? "Publishing to npm registry makes your package publicly available to the world. Make sure you're ready to release this version."
@@ -164,7 +83,7 @@ export const PublishModal = React.forwardRef<HTMLDivElement, PublishModalProps>(
164
83
  >
165
84
  {loading ? (
166
85
  <>
167
- <SpinnerIcon />
86
+ <Icon name="loading-spinner" size={16} className="animate-spin" />
168
87
  {isProduction ? "Publishing…" : "Linking…"}
169
88
  </>
170
89
  ) : isProduction ? (
@@ -177,189 +96,72 @@ export const PublishModal = React.forwardRef<HTMLDivElement, PublishModalProps>(
177
96
  }
178
97
  >
179
98
  <div className="w-full space-y-lg">
180
- <p className="text-body-md text-muted">
181
- Publish your package to npm so others can install and use it.
182
- Choose between a production release to the npm registry or a
183
- local publish for testing and internal use.
184
- </p>
99
+ <p className="text-body-md text-muted">{introText}</p>
185
100
 
186
- {/* Tabs — underline style */}
187
- <div
188
- role="tablist"
189
- aria-label="Publish target"
190
- className="flex items-center gap-lg border-b border-hairline"
191
- >
192
- <Button
193
- type="button"
194
- role="tab"
195
- aria-selected={isProduction}
196
- variant="ghost"
197
- size="sm"
198
- onClick={() => setTarget("production")}
199
- disabled={loading}
200
- className={[
201
- "!rounded-none border-b-2 -mb-px",
202
- isProduction
203
- ? "text-primary border-primary"
204
- : "text-muted border-transparent hover:text-ink",
205
- ].join(" ")}
206
- >
207
- <GlobeIcon />
208
- Production (npm registry)
209
- </Button>
210
- <Button
211
- type="button"
212
- role="tab"
213
- aria-selected={!isProduction}
214
- variant="ghost"
215
- size="sm"
216
- onClick={() => setTarget("local")}
217
- disabled={loading}
218
- className={[
219
- "!rounded-none border-b-2 -mb-px",
220
- !isProduction
221
- ? "text-primary border-primary"
222
- : "text-muted border-transparent hover:text-ink",
223
- ].join(" ")}
224
- >
225
- <LinkIcon />
226
- Local (npm link)
227
- </Button>
228
- </div>
101
+ {/* Package details */}
102
+ <div className="rounded-md border border-hairline p-base space-y-base">
103
+ <p className="text-body-md font-weight-heading-sm text-ink">
104
+ Package details
105
+ </p>
229
106
 
230
- {/* Two-column detail grid */}
231
- <div className="grid grid-cols-1 md:grid-cols-2 gap-md">
232
- {/* Package details */}
233
- <div className="rounded-md border border-hairline p-base space-y-base">
234
- <p className="text-body-md font-weight-heading-sm text-ink">
235
- Package details
107
+ <div className="space-y-xxs">
108
+ <p className="text-caption uppercase tracking-wide text-muted">
109
+ Package
236
110
  </p>
111
+ <p className="text-body-md text-ink font-mono">{packageName}</p>
112
+ </div>
237
113
 
238
- <div className="space-y-xxs">
239
- <p className="text-caption uppercase tracking-wide text-muted">
240
- Package
241
- </p>
242
- <p className="text-body-md text-ink font-mono">{packageName}</p>
114
+ <div className="space-y-xxs">
115
+ <p className="text-caption uppercase tracking-wide text-muted">
116
+ Current version
117
+ </p>
118
+ <div className="flex items-center gap-xs">
119
+ <p className="text-body-md text-ink font-mono">{currentVersion}</p>
120
+ <Chip label="Latest" variant="primary" size="sm" />
243
121
  </div>
122
+ </div>
244
123
 
124
+ {isProduction ? (
245
125
  <div className="space-y-xxs">
246
126
  <p className="text-caption uppercase tracking-wide text-muted">
247
- Current version
127
+ Next version
248
128
  </p>
249
129
  <div className="flex items-center gap-xs">
250
- <p className="text-body-md text-ink font-mono">{currentVersion}</p>
251
- <Chip label="Latest" variant="primary" size="sm" />
130
+ <Input
131
+ aria-label="Next version"
132
+ value={nextVersion}
133
+ onChange={(e) => setNextVersion(e.target.value)}
134
+ fullWidth
135
+ disabled={loading}
136
+ />
137
+ <Button
138
+ variant="secondary"
139
+ size="md"
140
+ aria-label="Reset to suggested version"
141
+ onClick={() => setNextVersion(bumpMinor(currentVersion))}
142
+ disabled={loading}
143
+ className="!px-sm"
144
+ >
145
+ <Icon name="refresh" size={16} />
146
+ </Button>
252
147
  </div>
253
148
  </div>
254
-
255
- {isProduction ? (
256
- <div className="space-y-xxs">
257
- <p className="text-caption uppercase tracking-wide text-muted">
258
- Next version
259
- </p>
260
- <div className="flex items-center gap-xs">
261
- <Input
262
- aria-label="Next version"
263
- value={nextVersion}
264
- onChange={(e) => setNextVersion(e.target.value)}
265
- fullWidth
266
- disabled={loading}
267
- />
268
- <Button
269
- variant="secondary"
270
- size="md"
271
- aria-label="Reset to suggested version"
272
- onClick={() => setNextVersion(bumpMinor(currentVersion))}
273
- disabled={loading}
274
- className="!px-sm"
275
- >
276
- <RefreshIcon />
277
- </Button>
278
- </div>
279
- </div>
280
- ) : (
281
- <div className="space-y-xxs">
282
- <p className="text-caption uppercase tracking-wide text-muted">
283
- Link command
284
- </p>
285
- <p className="rounded-sm bg-surface-soft border border-hairline px-sm py-xs text-body-sm font-mono text-body">
286
- npm link {packageName}
287
- </p>
288
- </div>
289
- )}
290
-
291
- <div className="border border-hairline rounded-sm">
292
- <Button
293
- type="button"
294
- variant="ghost"
295
- size="sm"
296
- onClick={() => setNotesOpen((v) => !v)}
297
- aria-expanded={notesOpen}
298
- disabled={loading}
299
- className="w-full !justify-start !rounded-none gap-xs text-body"
300
- >
301
- <ChevronIcon open={notesOpen} />
302
- Release notes (optional)
303
- </Button>
304
- {notesOpen && (
305
- <div className="px-sm pb-sm">
306
- <textarea
307
- value={notes}
308
- onChange={(e) => setNotes(e.target.value)}
309
- placeholder="What changed in this release?"
310
- rows={3}
311
- disabled={loading}
312
- className="w-full resize-none rounded-sm border border-hairline bg-surface px-sm py-xs text-body-sm text-ink placeholder:text-muted-soft outline-none focus:ring-2 focus:ring-primary-focus/20 focus:border-primary-focus disabled:opacity-disabled"
313
- />
314
- </div>
315
- )}
316
- </div>
317
- </div>
318
-
319
- {/* Publish summary */}
320
- <div className="rounded-md border border-hairline p-base space-y-base">
321
- <p className="text-body-md font-weight-heading-sm text-ink">
322
- Publish summary
323
- </p>
324
-
325
- <div className="flex items-start gap-sm rounded-sm bg-primary/10 border border-primary/30 p-sm">
326
- <span className="text-primary flex-shrink-0 mt-xxs">
327
- <InfoIcon />
328
- </span>
329
- <div>
330
- <p className="text-body-sm font-weight-heading-sm text-primary">
331
- {isProduction ? "Ready to publish" : "Ready to link"}
332
- </p>
333
- <p className="text-body-sm text-body">
334
- {isProduction
335
- ? `This will publish version ${nextVersion} to the npm registry.`
336
- : `This will link ${packageName} for local development.`}
337
- </p>
338
- </div>
339
- </div>
340
-
341
- <div className="space-y-sm">
342
- {summaryItems.map((item) => (
343
- <div key={item.title} className="flex items-start gap-sm">
344
- <span className="text-semantic-success flex-shrink-0 mt-xxs">
345
- <CheckCircleIcon />
346
- </span>
347
- <div>
348
- <p className="text-body-sm font-weight-heading-sm text-ink">
349
- {item.title}
350
- </p>
351
- <p className="text-body-sm text-muted">{item.desc}</p>
352
- </div>
353
- </div>
354
- ))}
149
+ ) : (
150
+ <div className="space-y-xxs">
151
+ <p className="text-caption uppercase tracking-wide text-muted">
152
+ Link command
153
+ </p>
154
+ <p className="rounded-sm bg-surface-soft border border-hairline px-sm py-xs text-body-sm font-mono text-body">
155
+ npm link {packageName}
156
+ </p>
355
157
  </div>
356
- </div>
158
+ )}
357
159
  </div>
358
160
 
359
161
  {/* Notice */}
360
162
  <div className="flex items-center gap-sm rounded-md bg-surface-soft border border-hairline p-base">
361
163
  <span className="flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-sm bg-primary text-on-primary">
362
- <LockIcon />
164
+ <Icon name="lock-padlock" size={16} />
363
165
  </span>
364
166
  <p className="text-body-sm text-body">{noticeText}</p>
365
167
  </div>