@intent-driven/adapter-shadcn 0.1.1

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/dist/index.cjs ADDED
@@ -0,0 +1,676 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/index.js
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ ShadcnAdapterProvider: () => ShadcnAdapterProvider,
33
+ shadcnAdapter: () => shadcnAdapter
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/adapter.jsx
38
+ var React = __toESM(require("react"), 1);
39
+ var Dialog = __toESM(require("@radix-ui/react-dialog"), 1);
40
+ var DropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
41
+ var SelectPrimitive = __toESM(require("@radix-ui/react-select"), 1);
42
+ var TabsPrimitive = __toESM(require("@radix-ui/react-tabs"), 1);
43
+ var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"), 1);
44
+ var import_clsx = require("clsx");
45
+ var import_lucide_react = require("lucide-react");
46
+ var import_theme = require("./theme.css");
47
+ var import_jsx_runtime = require("react/jsx-runtime");
48
+ var EMOJI_TO_LUCIDE = {
49
+ "\u270E": import_lucide_react.Pencil,
50
+ "\u270F\uFE0F": import_lucide_react.Pencil,
51
+ "\u{1F5D1}": import_lucide_react.Trash2,
52
+ "\u{1F5D1}\uFE0F": import_lucide_react.Trash2,
53
+ "\u2795": import_lucide_react.Plus,
54
+ "+": import_lucide_react.Plus,
55
+ "\u2713": import_lucide_react.Check,
56
+ "\u2714": import_lucide_react.Check,
57
+ "\u2714\uFE0F": import_lucide_react.Check,
58
+ "\u2715": import_lucide_react.X,
59
+ "\u2717": import_lucide_react.X,
60
+ "\u274C": import_lucide_react.X,
61
+ "\u22EF": import_lucide_react.MoreHorizontal,
62
+ "\u2026": import_lucide_react.MoreHorizontal,
63
+ "\u{1F50D}": import_lucide_react.Search,
64
+ "\u{1F4CC}": import_lucide_react.Pin,
65
+ "\u{1F4CD}": import_lucide_react.Pin,
66
+ "\u21A9": import_lucide_react.Reply,
67
+ "\u21A9\uFE0F": import_lucide_react.Reply,
68
+ "\u{1F4E4}": import_lucide_react.Send,
69
+ "\u2B50": import_lucide_react.Star,
70
+ "\u{1F514}": import_lucide_react.Bell,
71
+ "\u{1F515}": import_lucide_react.BellOff,
72
+ "\u{1F4E6}": import_lucide_react.Archive,
73
+ "\u{1F4CB}": import_lucide_react.Copy,
74
+ "\u{1F441}": import_lucide_react.Eye,
75
+ "\u{1F512}": import_lucide_react.Lock,
76
+ "\u{1F513}": import_lucide_react.Unlock,
77
+ "\u2699": import_lucide_react.Settings,
78
+ "\u2699\uFE0F": import_lucide_react.Settings,
79
+ "\u{1F464}": import_lucide_react.User,
80
+ "\u{1F6AA}": import_lucide_react.LogOut,
81
+ "\u25B6": import_lucide_react.Play,
82
+ "\u23F9": import_lucide_react.Square,
83
+ "\u{1F4BE}": import_lucide_react.Save,
84
+ "\u{1F4E5}": import_lucide_react.Download,
85
+ "\u{1F4E4}": import_lucide_react.Upload,
86
+ "\u{1F504}": import_lucide_react.RefreshCw,
87
+ "\u{1F503}": import_lucide_react.RefreshCw,
88
+ "\u{1F5C2}": import_lucide_react.Filter,
89
+ "\u{1F4C5}": import_lucide_react.Calendar,
90
+ "\u{1F550}": import_lucide_react.Clock,
91
+ "\u2764\uFE0F": import_lucide_react.Heart,
92
+ "\u{1F44D}": import_lucide_react.ThumbsUp,
93
+ "\u{1F44E}": import_lucide_react.ThumbsDown,
94
+ "\u{1F6A9}": import_lucide_react.Flag,
95
+ "\u{1F4AC}": import_lucide_react.MessageSquare,
96
+ "\u{1F4DE}": import_lucide_react.Phone,
97
+ "\u{1F4F9}": import_lucide_react.Video,
98
+ "\u{1F3A4}": import_lucide_react.Mic,
99
+ "\u{1F507}": import_lucide_react.MicOff,
100
+ "\u{1F50A}": import_lucide_react.Volume2,
101
+ "\u{1F508}": import_lucide_react.VolumeX,
102
+ "\u{1F517}": import_lucide_react.Link,
103
+ "\u2702": import_lucide_react.Unlink,
104
+ "\u2194": import_lucide_react.Move,
105
+ "\u2922": import_lucide_react.Maximize2,
106
+ "\u26A0": import_lucide_react.AlertTriangle,
107
+ "\u26A0\uFE0F": import_lucide_react.AlertTriangle,
108
+ "\u2139": import_lucide_react.Info,
109
+ "\u2139\uFE0F": import_lucide_react.Info,
110
+ "\u2753": import_lucide_react.HelpCircle,
111
+ "\u2192": import_lucide_react.ArrowRight,
112
+ "\u2190": import_lucide_react.ArrowLeft,
113
+ "\u{1F3E0}": import_lucide_react.Home,
114
+ "\u{1F3AF}": import_lucide_react.Target,
115
+ "\u{1F3C6}": import_lucide_react.Award,
116
+ "\u{1F4C8}": import_lucide_react.TrendingUp,
117
+ "\u{1F525}": import_lucide_react.Flame,
118
+ "\u26A1": import_lucide_react.Zap,
119
+ "\u{1F4DA}": import_lucide_react.BookOpen,
120
+ "\u{1F4AA}": import_lucide_react.Dumbbell,
121
+ "\u{1F4B0}": import_lucide_react.DollarSign,
122
+ "\u{1F4BC}": import_lucide_react.Briefcase,
123
+ "\u{1F91D}": import_lucide_react.Users,
124
+ "\u{1F9D8}": import_lucide_react.Smile,
125
+ "\u{1F3A8}": import_lucide_react.Palette,
126
+ "\u{1F3D6}\uFE0F": import_lucide_react.Umbrella,
127
+ "\u{1F30D}": import_lucide_react.Globe,
128
+ "\u{1F9ED}": import_lucide_react.Compass,
129
+ "\u2705": import_lucide_react.CheckSquare,
130
+ "\u2610": import_lucide_react.CheckSquare
131
+ };
132
+ function resolveLucide(emoji) {
133
+ if (!emoji) return null;
134
+ return EMOJI_TO_LUCIDE[emoji] || null;
135
+ }
136
+ var inputBase = [
137
+ "w-full rounded-[var(--radius-doodle)] border-2 border-dashed",
138
+ "border-[var(--color-doodle-border)] bg-[var(--color-doodle-bg)]",
139
+ "px-3 py-2 font-[var(--font-doodle)] text-[var(--color-doodle-ink)]",
140
+ "placeholder:text-[var(--color-doodle-ink-light)]/50",
141
+ "focus:outline-none focus:border-[var(--color-doodle-accent)] transition-colors"
142
+ ].join(" ");
143
+ function ShadcnTextInput({ spec, value, onChange }) {
144
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
145
+ spec.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { style: { fontSize: 13, fontWeight: 500, color: "var(--color-doodle-ink-light)", fontFamily: "var(--font-doodle)" }, children: spec.label }),
146
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
147
+ "input",
148
+ {
149
+ type: spec.type === "email" ? "email" : spec.type === "url" ? "url" : spec.type === "tel" ? "tel" : "text",
150
+ style: {
151
+ width: "100%",
152
+ borderRadius: "var(--radius-doodle)",
153
+ border: "1.5px solid var(--color-doodle-ink)",
154
+ background: "var(--color-doodle-bg)",
155
+ padding: "8px 12px",
156
+ fontFamily: "var(--font-doodle)",
157
+ color: "var(--color-doodle-ink)",
158
+ fontSize: 14,
159
+ outline: "none"
160
+ },
161
+ placeholder: spec.placeholder || "",
162
+ value: value || "",
163
+ onChange: (e) => onChange(e.target.value),
164
+ required: spec.required
165
+ }
166
+ )
167
+ ] });
168
+ }
169
+ function ShadcnTextarea({ spec, value, onChange }) {
170
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
171
+ spec.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { style: { fontSize: 13, fontWeight: 500, color: "var(--color-doodle-ink-light)", fontFamily: "var(--font-doodle)" }, children: spec.label }),
172
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
173
+ "textarea",
174
+ {
175
+ style: {
176
+ width: "100%",
177
+ borderRadius: "var(--radius-doodle)",
178
+ border: "1.5px solid var(--color-doodle-ink)",
179
+ background: "var(--color-doodle-bg)",
180
+ padding: "8px 12px",
181
+ fontFamily: "var(--font-doodle)",
182
+ color: "var(--color-doodle-ink)",
183
+ fontSize: 14,
184
+ minHeight: 80,
185
+ resize: "vertical",
186
+ outline: "none"
187
+ },
188
+ placeholder: spec.placeholder || "",
189
+ value: value || "",
190
+ onChange: (e) => onChange(e.target.value),
191
+ rows: 3
192
+ }
193
+ )
194
+ ] });
195
+ }
196
+ function ShadcnNumber({ spec, value, onChange }) {
197
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
198
+ spec.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { style: { fontSize: 13, fontWeight: 500, color: "var(--color-doodle-ink-light)", fontFamily: "var(--font-doodle)" }, children: spec.label }),
199
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
200
+ "input",
201
+ {
202
+ type: "number",
203
+ style: {
204
+ width: "100%",
205
+ borderRadius: "var(--radius-doodle)",
206
+ border: "1.5px solid var(--color-doodle-ink)",
207
+ background: "var(--color-doodle-bg)",
208
+ padding: "8px 12px",
209
+ fontFamily: "var(--font-doodle)",
210
+ color: "var(--color-doodle-ink)",
211
+ fontSize: 14,
212
+ outline: "none"
213
+ },
214
+ value: value ?? "",
215
+ onChange: (e) => onChange(e.target.value === "" ? null : Number(e.target.value)),
216
+ min: spec.min,
217
+ max: spec.max
218
+ }
219
+ )
220
+ ] });
221
+ }
222
+ function ShadcnDateTime({ spec, value, onChange }) {
223
+ const isTimeOnly = spec.name && /time/i.test(spec.name) && !/date/i.test(spec.name);
224
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
225
+ spec.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { style: { fontSize: 13, fontWeight: 500, color: "var(--color-doodle-ink-light)", fontFamily: "var(--font-doodle)" }, children: spec.label }),
226
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
227
+ "input",
228
+ {
229
+ type: isTimeOnly ? "time" : "date",
230
+ style: {
231
+ width: "100%",
232
+ borderRadius: "var(--radius-doodle)",
233
+ border: "1.5px solid var(--color-doodle-ink)",
234
+ background: "var(--color-doodle-bg)",
235
+ padding: "8px 12px",
236
+ fontFamily: "var(--font-doodle)",
237
+ color: "var(--color-doodle-ink)",
238
+ fontSize: 14,
239
+ outline: "none"
240
+ },
241
+ value: value || "",
242
+ onChange: (e) => onChange(e.target.value)
243
+ }
244
+ )
245
+ ] });
246
+ }
247
+ function ShadcnSelect({ spec, value, onChange }) {
248
+ const options = spec.options || [];
249
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
250
+ spec.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { style: { fontSize: 13, fontWeight: 500, color: "var(--color-doodle-ink-light)", fontFamily: "var(--font-doodle)" }, children: spec.label }),
251
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectPrimitive.Root, { value: value || "", onValueChange: onChange, children: [
252
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
253
+ SelectPrimitive.Trigger,
254
+ {
255
+ style: {
256
+ display: "flex",
257
+ alignItems: "center",
258
+ justifyContent: "space-between",
259
+ width: "100%",
260
+ borderRadius: "var(--radius-doodle)",
261
+ border: "2px dashed var(--color-doodle-border)",
262
+ background: "var(--color-doodle-bg)",
263
+ padding: "8px 12px",
264
+ fontFamily: "var(--font-doodle)",
265
+ color: "var(--color-doodle-ink)",
266
+ fontSize: 14,
267
+ cursor: "pointer"
268
+ },
269
+ children: [
270
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPrimitive.Value, { placeholder: spec.placeholder || "\u0412\u044B\u0431\u0440\u0430\u0442\u044C..." }),
271
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPrimitive.Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDown, { size: 16 }) })
272
+ ]
273
+ }
274
+ ),
275
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
276
+ SelectPrimitive.Content,
277
+ {
278
+ style: {
279
+ background: "var(--color-doodle-bg)",
280
+ border: "2px solid var(--color-doodle-border)",
281
+ borderRadius: "var(--radius-doodle)",
282
+ boxShadow: "4px 4px 0 var(--color-doodle-border)",
283
+ zIndex: 9999,
284
+ fontFamily: "var(--font-doodle)"
285
+ },
286
+ position: "popper",
287
+ sideOffset: 4,
288
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPrimitive.Viewport, { style: { padding: 4 }, children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
289
+ SelectPrimitive.Item,
290
+ {
291
+ value: opt.value || opt,
292
+ style: {
293
+ padding: "8px 12px",
294
+ borderRadius: 8,
295
+ cursor: "pointer",
296
+ color: "var(--color-doodle-ink)",
297
+ outline: "none",
298
+ fontSize: 14
299
+ },
300
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPrimitive.ItemText, { children: opt.label || opt })
301
+ },
302
+ opt.value || opt
303
+ )) })
304
+ }
305
+ ) })
306
+ ] })
307
+ ] });
308
+ }
309
+ var btnBase = {
310
+ borderRadius: "var(--radius-doodle)",
311
+ fontFamily: "var(--font-doodle)",
312
+ cursor: "pointer",
313
+ transition: "all 0.15s",
314
+ border: "2px solid",
315
+ fontSize: 14
316
+ };
317
+ function ShadcnPrimaryButton({ children, onClick, disabled, ...props }) {
318
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
319
+ "button",
320
+ {
321
+ onClick,
322
+ disabled,
323
+ style: {
324
+ ...btnBase,
325
+ padding: "8px 16px",
326
+ fontWeight: 700,
327
+ background: "var(--color-doodle-accent)",
328
+ color: "white",
329
+ borderColor: "var(--color-doodle-accent)",
330
+ boxShadow: "2px 2px 0 var(--color-doodle-ink)",
331
+ opacity: disabled ? 0.5 : 1
332
+ },
333
+ ...props,
334
+ children
335
+ }
336
+ );
337
+ }
338
+ function ShadcnSecondaryButton({ children, onClick, disabled, ...props }) {
339
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
340
+ "button",
341
+ {
342
+ onClick,
343
+ disabled,
344
+ style: {
345
+ ...btnBase,
346
+ padding: "8px 16px",
347
+ background: "transparent",
348
+ color: "var(--color-doodle-ink)",
349
+ borderColor: "var(--color-doodle-border)",
350
+ borderStyle: "dashed",
351
+ opacity: disabled ? 0.5 : 1
352
+ },
353
+ ...props,
354
+ children
355
+ }
356
+ );
357
+ }
358
+ function ShadcnDangerButton({ children, onClick, disabled, ...props }) {
359
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
360
+ "button",
361
+ {
362
+ onClick,
363
+ disabled,
364
+ style: {
365
+ ...btnBase,
366
+ padding: "8px 16px",
367
+ fontWeight: 700,
368
+ background: "var(--color-doodle-warn)",
369
+ color: "white",
370
+ borderColor: "var(--color-doodle-warn)",
371
+ boxShadow: "2px 2px 0 var(--color-doodle-ink)",
372
+ opacity: disabled ? 0.5 : 1
373
+ },
374
+ ...props,
375
+ children
376
+ }
377
+ );
378
+ }
379
+ function ShadcnIntentButton({ spec, onClick, disabled }) {
380
+ const Icon2 = spec.icon ? resolveLucide(spec.icon) : null;
381
+ const label = spec.label || spec.intentId;
382
+ const isDanger = spec.irreversibility === "high" || spec.variant === "danger";
383
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
384
+ "button",
385
+ {
386
+ onClick,
387
+ disabled,
388
+ style: {
389
+ ...btnBase,
390
+ display: "inline-flex",
391
+ alignItems: "center",
392
+ gap: 6,
393
+ padding: "6px 14px",
394
+ fontSize: 14,
395
+ background: isDanger ? "transparent" : "var(--color-doodle-bg)",
396
+ color: isDanger ? "var(--color-doodle-warn)" : "var(--color-doodle-ink)",
397
+ borderColor: isDanger ? "var(--color-doodle-warn)" : "var(--color-doodle-ink)",
398
+ borderStyle: "solid",
399
+ borderWidth: 1.5,
400
+ boxShadow: "1.5px 1.5px 0 var(--color-doodle-ink)",
401
+ opacity: disabled ? 0.5 : 1
402
+ },
403
+ title: label,
404
+ children: [
405
+ Icon2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon2, { size: 16 }),
406
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: label })
407
+ ]
408
+ }
409
+ );
410
+ }
411
+ function ShadcnOverflowMenu({ items, triggerIcon, triggerLabel }) {
412
+ if (!items || items.length === 0) return null;
413
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenu.Root, { children: [
414
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { style: {
415
+ ...btnBase,
416
+ padding: 8,
417
+ background: "transparent",
418
+ color: "var(--color-doodle-ink)",
419
+ borderColor: "var(--color-doodle-border)",
420
+ borderStyle: "dashed"
421
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.MoreHorizontal, { size: 16 }) }) }),
422
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
423
+ DropdownMenu.Content,
424
+ {
425
+ align: "end",
426
+ collisionPadding: 16,
427
+ style: {
428
+ background: "var(--color-doodle-bg)",
429
+ border: "2px solid var(--color-doodle-ink)",
430
+ borderRadius: "var(--radius-doodle)",
431
+ boxShadow: "3px 3px 0 var(--color-doodle-ink)",
432
+ padding: 4,
433
+ zIndex: 9999,
434
+ fontFamily: "var(--font-doodle)",
435
+ minWidth: 180,
436
+ maxWidth: "90vw"
437
+ },
438
+ sideOffset: 6,
439
+ children: items.map((item, i) => {
440
+ if (item.divider) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenu.Separator, { style: { height: 1, background: "var(--color-doodle-border)", margin: "4px 0" } }, item.key);
441
+ const IconCmp = item.icon ? resolveLucide(item.icon) : null;
442
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
443
+ DropdownMenu.Item,
444
+ {
445
+ style: {
446
+ display: "flex",
447
+ alignItems: "center",
448
+ gap: 8,
449
+ padding: "8px 12px",
450
+ borderRadius: 8,
451
+ fontSize: 13,
452
+ color: "var(--color-doodle-ink)",
453
+ outline: "none",
454
+ cursor: "pointer"
455
+ },
456
+ onSelect: () => item.onClick?.(),
457
+ children: [
458
+ IconCmp && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconCmp, { size: 14 }),
459
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: item.label })
460
+ ]
461
+ },
462
+ item.key || i
463
+ );
464
+ })
465
+ }
466
+ ) })
467
+ ] });
468
+ }
469
+ function ShadcnModalShell({ opened, onClose, title, children }) {
470
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog.Root, { open: opened, onOpenChange: (v) => {
471
+ if (!v) onClose();
472
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Dialog.Portal, { children: [
473
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog.Overlay, { style: {
474
+ position: "fixed",
475
+ inset: 0,
476
+ background: "rgba(0,0,0,0.4)",
477
+ backdropFilter: "blur(4px)",
478
+ zIndex: 9999
479
+ } }),
480
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Dialog.Content, { style: {
481
+ position: "fixed",
482
+ left: "50%",
483
+ top: "50%",
484
+ transform: "translate(-50%, -50%)",
485
+ zIndex: 9999,
486
+ width: "calc(100% - 32px)",
487
+ maxWidth: 420,
488
+ maxHeight: "85vh",
489
+ overflowY: "auto",
490
+ background: "var(--color-doodle-bg)",
491
+ border: "2px solid var(--color-doodle-border)",
492
+ borderRadius: "var(--radius-doodle)",
493
+ padding: "var(--spacing-doodle)",
494
+ fontFamily: "var(--font-doodle)",
495
+ boxShadow: "4px 4px 0 var(--color-doodle-ink)"
496
+ }, children: [
497
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog.Title, { style: {
498
+ fontSize: 18,
499
+ fontWeight: 700,
500
+ color: "var(--color-doodle-ink)",
501
+ textDecoration: "underline",
502
+ textDecorationStyle: "wavy",
503
+ textDecorationColor: "var(--color-doodle-border)",
504
+ textUnderlineOffset: 4,
505
+ marginBottom: 16
506
+ }, children: title }),
507
+ children,
508
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog.Close, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { style: {
509
+ position: "absolute",
510
+ top: 12,
511
+ right: 12,
512
+ background: "none",
513
+ border: "none",
514
+ color: "var(--color-doodle-ink-light)",
515
+ cursor: "pointer",
516
+ padding: 4
517
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { size: 18 }) }) })
518
+ ] })
519
+ ] }) });
520
+ }
521
+ function ShadcnTabs({ tabs, value, onChange }) {
522
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsPrimitive.Root, { value, onValueChange: onChange, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsPrimitive.List, { style: {
523
+ display: "flex",
524
+ borderBottom: "2px dashed var(--color-doodle-border)",
525
+ fontFamily: "var(--font-doodle)",
526
+ overflowX: "auto",
527
+ gap: 0
528
+ }, children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
529
+ TabsPrimitive.Trigger,
530
+ {
531
+ value: tab.value,
532
+ style: {
533
+ padding: "8px 16px",
534
+ fontSize: 13,
535
+ whiteSpace: "nowrap",
536
+ background: "transparent",
537
+ border: "none",
538
+ cursor: "pointer",
539
+ fontFamily: "inherit",
540
+ borderBottom: "2px solid transparent",
541
+ marginBottom: -2,
542
+ color: "var(--color-doodle-ink-light)"
543
+ },
544
+ children: tab.label
545
+ },
546
+ tab.value
547
+ )) }) });
548
+ }
549
+ function ShadcnHeading({ children, level = 2, ...props }) {
550
+ const Tag = `h${Math.min(level, 6)}`;
551
+ const sizes = { 1: 24, 2: 20, 3: 18, 4: 16, 5: 14, 6: 13 };
552
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tag, { style: {
553
+ fontSize: sizes[level] || 18,
554
+ fontWeight: 700,
555
+ fontFamily: "var(--font-doodle)",
556
+ color: "var(--color-doodle-ink)",
557
+ textDecoration: "underline",
558
+ textDecorationStyle: "wavy",
559
+ textDecorationColor: "var(--color-doodle-border)",
560
+ textUnderlineOffset: 4,
561
+ margin: 0
562
+ }, ...props, children });
563
+ }
564
+ function ShadcnText({ children, preset, ...props }) {
565
+ const colors = {
566
+ dimmed: "var(--color-doodle-ink-light)",
567
+ accent: "var(--color-doodle-accent)",
568
+ danger: "var(--color-doodle-warn)",
569
+ success: "var(--color-doodle-accent)"
570
+ };
571
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: {
572
+ fontFamily: "var(--font-doodle)",
573
+ color: colors[preset] || "var(--color-doodle-ink)"
574
+ }, ...props, children });
575
+ }
576
+ function ShadcnBadge({ children, color, ...props }) {
577
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: {
578
+ display: "inline-flex",
579
+ alignItems: "center",
580
+ padding: "2px 8px",
581
+ borderRadius: 20,
582
+ fontSize: 12,
583
+ fontWeight: 700,
584
+ fontFamily: "var(--font-doodle)",
585
+ border: `2px solid ${color || "var(--color-doodle-border)"}`,
586
+ background: "var(--color-doodle-highlight)",
587
+ color: color || "var(--color-doodle-ink)"
588
+ }, ...props, children });
589
+ }
590
+ function ShadcnAvatar({ src, name, size = 32, ...props }) {
591
+ const initials = (name || "?").split(" ").map((w) => w[0]).join("").slice(0, 2).toUpperCase();
592
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AvatarPrimitive.Root, { style: {
593
+ display: "inline-flex",
594
+ alignItems: "center",
595
+ justifyContent: "center",
596
+ borderRadius: "50%",
597
+ overflow: "hidden",
598
+ border: "2px solid var(--color-doodle-border)",
599
+ background: "var(--color-doodle-highlight)",
600
+ fontFamily: "var(--font-doodle)",
601
+ width: size,
602
+ height: size
603
+ }, ...props, children: [
604
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarPrimitive.Image, { src, alt: name, style: { width: "100%", height: "100%", objectFit: "cover" } }),
605
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarPrimitive.Fallback, { style: {
606
+ display: "flex",
607
+ alignItems: "center",
608
+ justifyContent: "center",
609
+ width: "100%",
610
+ height: "100%",
611
+ color: "var(--color-doodle-ink)",
612
+ fontSize: Math.round(size * 0.4),
613
+ fontWeight: 700
614
+ }, children: initials })
615
+ ] });
616
+ }
617
+ function ShadcnPaper({ children, ...props }) {
618
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: {
619
+ borderRadius: "var(--radius-doodle)",
620
+ border: "1.5px solid var(--color-doodle-ink)",
621
+ background: "var(--color-doodle-bg)",
622
+ padding: "var(--spacing-doodle)",
623
+ boxShadow: "2px 2px 0 var(--color-doodle-ink)"
624
+ }, ...props, children });
625
+ }
626
+ var shadcnAdapter = {
627
+ name: "shadcn",
628
+ parameter: {
629
+ text: ShadcnTextInput,
630
+ textarea: ShadcnTextarea,
631
+ email: ShadcnTextInput,
632
+ url: ShadcnTextInput,
633
+ tel: ShadcnTextInput,
634
+ number: ShadcnNumber,
635
+ datetime: ShadcnDateTime,
636
+ select: ShadcnSelect
637
+ },
638
+ button: {
639
+ primary: ShadcnPrimaryButton,
640
+ secondary: ShadcnSecondaryButton,
641
+ danger: ShadcnDangerButton,
642
+ intent: ShadcnIntentButton,
643
+ overflow: ShadcnOverflowMenu
644
+ },
645
+ shell: {
646
+ modal: ShadcnModalShell,
647
+ tabs: ShadcnTabs
648
+ },
649
+ primitive: {
650
+ heading: ShadcnHeading,
651
+ text: ShadcnText,
652
+ badge: ShadcnBadge,
653
+ avatar: ShadcnAvatar,
654
+ paper: ShadcnPaper
655
+ },
656
+ icon: {
657
+ resolve: resolveLucide
658
+ }
659
+ };
660
+
661
+ // src/provider.jsx
662
+ var import_react = __toESM(require("react"), 1);
663
+ var import_renderer = require("@intent-driven/renderer");
664
+ var import_jsx_runtime2 = require("react/jsx-runtime");
665
+ function ShadcnAdapterProvider({ children }) {
666
+ import_react.default.useEffect(() => {
667
+ (0, import_renderer.registerUIAdapter)(shadcnAdapter);
668
+ }, []);
669
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
670
+ }
671
+ // Annotate the CommonJS export names for ESM import in node:
672
+ 0 && (module.exports = {
673
+ ShadcnAdapterProvider,
674
+ shadcnAdapter
675
+ });
676
+ //# sourceMappingURL=index.cjs.map