@timbal-ai/timbal-react 0.5.4 → 0.6.0

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.
Files changed (44) hide show
  1. package/README.md +128 -4
  2. package/dist/app.cjs +5311 -0
  3. package/dist/app.d.cts +29 -0
  4. package/dist/app.d.ts +29 -0
  5. package/dist/app.esm.js +81 -0
  6. package/dist/chart-artifact-C71dk4xI.d.ts +329 -0
  7. package/dist/chart-artifact-CPEpOmtV.d.cts +329 -0
  8. package/dist/chat-CWtQWDtJ.d.cts +650 -0
  9. package/dist/chat-CWtQWDtJ.d.ts +650 -0
  10. package/dist/chat.cjs +4162 -0
  11. package/dist/chat.d.cts +13 -0
  12. package/dist/chat.d.ts +13 -0
  13. package/dist/chat.esm.js +51 -0
  14. package/dist/chunk-4TCJQSIX.esm.js +565 -0
  15. package/dist/chunk-IYENDIRY.esm.js +119 -0
  16. package/dist/chunk-KC5QLVUG.esm.js +22 -0
  17. package/dist/chunk-M4V6Q6XO.esm.js +1082 -0
  18. package/dist/chunk-OFHLFNJH.esm.js +138 -0
  19. package/dist/chunk-OVHR7J3J.esm.js +1574 -0
  20. package/dist/chunk-WLTW56MC.esm.js +66 -0
  21. package/dist/chunk-YJQLLFKP.esm.js +3672 -0
  22. package/dist/index.cjs +1823 -359
  23. package/dist/index.d.cts +15 -931
  24. package/dist/index.d.ts +15 -931
  25. package/dist/index.esm.js +187 -5578
  26. package/dist/layout-B9VayJhZ.d.cts +75 -0
  27. package/dist/layout-CQWngNQ7.d.ts +75 -0
  28. package/dist/studio.cjs +5734 -0
  29. package/dist/studio.d.cts +15 -0
  30. package/dist/studio.d.ts +15 -0
  31. package/dist/studio.esm.js +27 -0
  32. package/dist/styles.css +52 -2
  33. package/dist/timbal-v2-button-F4-z7m33.d.cts +40 -0
  34. package/dist/timbal-v2-button-F4-z7m33.d.ts +40 -0
  35. package/dist/ui.cjs +720 -0
  36. package/dist/ui.d.cts +74 -0
  37. package/dist/ui.d.ts +74 -0
  38. package/dist/ui.esm.js +44 -0
  39. package/dist/welcome--80i_O0p.d.cts +190 -0
  40. package/dist/welcome-BOizSp5h.d.ts +190 -0
  41. package/package.json +35 -3
  42. package/scripts/dev-linked.mjs +66 -0
  43. package/vite/local-dev.d.ts +4 -0
  44. package/vite/local-dev.mjs +71 -0
package/dist/ui.cjs ADDED
@@ -0,0 +1,720 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/ui.ts
31
+ var ui_exports = {};
32
+ __export(ui_exports, {
33
+ Avatar: () => Avatar,
34
+ AvatarFallback: () => AvatarFallback,
35
+ AvatarImage: () => AvatarImage,
36
+ Button: () => Button,
37
+ Dialog: () => Dialog,
38
+ DialogClose: () => DialogClose,
39
+ DialogContent: () => DialogContent,
40
+ DialogOverlay: () => DialogOverlay,
41
+ DialogPortal: () => DialogPortal,
42
+ DialogTitle: () => DialogTitle,
43
+ DialogTrigger: () => DialogTrigger,
44
+ MemoPillSegmentedTabs: () => MemoPillSegmentedTabs,
45
+ PillSegmentedTabs: () => PillSegmentedTabs,
46
+ Shimmer: () => Shimmer,
47
+ TimbalV2Button: () => TimbalV2Button,
48
+ Tooltip: () => Tooltip,
49
+ TooltipContent: () => TooltipContent,
50
+ TooltipProvider: () => TooltipProvider,
51
+ TooltipTrigger: () => TooltipTrigger
52
+ });
53
+ module.exports = __toCommonJS(ui_exports);
54
+
55
+ // src/ui/button.tsx
56
+ var import_class_variance_authority = require("class-variance-authority");
57
+
58
+ // src/utils.ts
59
+ var import_clsx = require("clsx");
60
+ var import_tailwind_merge = require("tailwind-merge");
61
+ function cn(...inputs) {
62
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
63
+ }
64
+
65
+ // src/design/button-tokens.ts
66
+ var TIMBAL_V2_ELEVATED_GRADIENT = "bg-gradient-to-b from-elevated-from to-elevated-to";
67
+ var TIMBAL_V2_MODAL_SURFACE = cn(
68
+ "bg-gradient-to-b from-modal-from to-modal-to",
69
+ "border border-border shadow-card-elevated"
70
+ );
71
+ var TIMBAL_V2_PRIMARY_GRADIENT = "bg-gradient-to-b from-primary-fill-from to-primary-fill-to";
72
+ var TIMBAL_V2_FROM_LEGACY_BUTTON = {
73
+ default: "primary",
74
+ destructive: "destructive",
75
+ outline: "secondary",
76
+ secondary: "secondary",
77
+ ghost: "ghost",
78
+ link: "link"
79
+ };
80
+ var TIMBAL_V2_SIZE_HEIGHT = {
81
+ xs: "min-h-8 h-8",
82
+ sm: "min-h-9 h-9",
83
+ md: "min-h-10 h-10",
84
+ lg: "min-h-11 h-11"
85
+ };
86
+ var TIMBAL_V2_SIZE_ICON = {
87
+ xs: "min-h-8 min-w-8 size-8",
88
+ sm: "min-h-8 min-w-8 size-8",
89
+ md: "min-h-10 min-w-10 size-10",
90
+ lg: "min-h-11 min-w-11 size-11"
91
+ };
92
+ var TIMBAL_V2_SIZE_LABEL_PX = {
93
+ xs: "px-3",
94
+ sm: "px-4",
95
+ md: "px-5",
96
+ lg: "px-6"
97
+ };
98
+ var TIMBAL_V2_FILL = {
99
+ primary: [
100
+ "bg-gradient-to-b from-primary-fill-from to-primary-fill-to",
101
+ "group-hover/tbv2:from-primary-fill-hover-from group-hover/tbv2:to-primary-fill-hover-to",
102
+ "group-active/tbv2:from-primary-fill-active-from group-active/tbv2:to-primary-fill-active-to"
103
+ ].join(" "),
104
+ informative: [
105
+ TIMBAL_V2_PRIMARY_GRADIENT,
106
+ "group-hover/tbv2:from-primary-fill-hover-from group-hover/tbv2:to-primary-fill-hover-to",
107
+ "group-active/tbv2:from-primary-fill-active-from group-active/tbv2:to-primary-fill-active-to",
108
+ "group-active/tbv2:[background-image:linear-gradient(to_top,rgba(0,0,0,0.08),transparent_55%)]"
109
+ ].join(" "),
110
+ destructive: [
111
+ TIMBAL_V2_ELEVATED_GRADIENT,
112
+ "group-hover/tbv2:from-destructive-fill-hover-from group-hover/tbv2:to-destructive-fill-hover-to",
113
+ "group-active/tbv2:from-destructive-fill-active-from group-active/tbv2:to-destructive-fill-active-to"
114
+ ].join(" "),
115
+ secondary: [
116
+ TIMBAL_V2_ELEVATED_GRADIENT,
117
+ "group-hover/tbv2:from-secondary-fill-hover-from group-hover/tbv2:to-secondary-fill-hover-to",
118
+ "group-active/tbv2:from-secondary-fill-active-from group-active/tbv2:to-secondary-fill-active-to"
119
+ ].join(" "),
120
+ ghost: [
121
+ "bg-transparent",
122
+ "group-hover/tbv2:bg-ghost-fill-hover",
123
+ "group-active/tbv2:bg-ghost-fill-active"
124
+ ].join(" "),
125
+ link: "bg-transparent"
126
+ };
127
+ var TIMBAL_V2_LABEL = {
128
+ primary: "text-primary-foreground",
129
+ informative: "text-primary-foreground",
130
+ destructive: "text-destructive",
131
+ secondary: "text-foreground",
132
+ ghost: "text-foreground",
133
+ link: "text-foreground underline decoration-foreground/25 underline-offset-2 group-hover/tbv2:decoration-foreground/45"
134
+ };
135
+ var TIMBAL_V2_BORDER = {
136
+ primary: "",
137
+ informative: "border border-foreground/15",
138
+ destructive: "border border-destructive/45",
139
+ secondary: "border border-border",
140
+ ghost: "",
141
+ link: ""
142
+ };
143
+ var TIMBAL_V2_SHADOW = {
144
+ primary: "shadow-card",
145
+ informative: "shadow-card",
146
+ destructive: "shadow-card",
147
+ secondary: "shadow-card",
148
+ ghost: "",
149
+ link: ""
150
+ };
151
+ var TIMBAL_V2_SWITCH_TRACK_OFF = cn(
152
+ TIMBAL_V2_ELEVATED_GRADIENT,
153
+ "border border-border shadow-card"
154
+ );
155
+ var TIMBAL_V2_SWITCH_THUMB = cn(
156
+ TIMBAL_V2_ELEVATED_GRADIENT,
157
+ "border border-border/80 shadow-sm"
158
+ );
159
+ var TIMBAL_V2_SECONDARY_CHROME = [
160
+ TIMBAL_V2_ELEVATED_GRADIENT,
161
+ "border border-border shadow-card",
162
+ "transition-[background-color,box-shadow,border-color] duration-200 ease-in-out",
163
+ "hover:from-secondary-fill-hover-from hover:to-secondary-fill-hover-to",
164
+ "active:from-secondary-fill-active-from active:to-secondary-fill-active-to"
165
+ ].join(" ");
166
+
167
+ // src/ui/timbal-v2-button.tsx
168
+ var React = __toESM(require("react"), 1);
169
+ var import_radix_ui = require("radix-ui");
170
+ var import_jsx_runtime = require("react/jsx-runtime");
171
+ var TIMBAL_V2_FILL_AS_CHILD = {
172
+ primary: [
173
+ "bg-gradient-to-b from-primary-fill-from to-primary-fill-to",
174
+ "hover:from-primary-fill-hover-from hover:to-primary-fill-hover-to",
175
+ "active:from-primary-fill-active-from active:to-primary-fill-active-to"
176
+ ].join(" "),
177
+ informative: [
178
+ TIMBAL_V2_PRIMARY_GRADIENT,
179
+ "hover:from-primary-fill-hover-from hover:to-primary-fill-hover-to",
180
+ "active:from-primary-fill-active-from active:to-primary-fill-active-to",
181
+ "active:[background-image:linear-gradient(to_top,rgba(0,0,0,0.08),transparent_55%)]"
182
+ ].join(" "),
183
+ destructive: [
184
+ TIMBAL_V2_ELEVATED_GRADIENT,
185
+ "hover:from-destructive-fill-hover-from hover:to-destructive-fill-hover-to",
186
+ "active:from-destructive-fill-active-from active:to-destructive-fill-active-to"
187
+ ].join(" "),
188
+ secondary: [
189
+ TIMBAL_V2_ELEVATED_GRADIENT,
190
+ "hover:from-secondary-fill-hover-from hover:to-secondary-fill-hover-to",
191
+ "active:from-secondary-fill-active-from active:to-secondary-fill-active-to"
192
+ ].join(" "),
193
+ ghost: [
194
+ "bg-transparent",
195
+ "hover:bg-ghost-fill-hover",
196
+ "active:bg-ghost-fill-active"
197
+ ].join(" "),
198
+ link: "bg-transparent"
199
+ };
200
+ var TIMBAL_V2_LABEL_AS_CHILD = {
201
+ ...TIMBAL_V2_LABEL,
202
+ link: "text-foreground underline decoration-foreground/25 underline-offset-2 hover:decoration-foreground/45"
203
+ };
204
+ var TimbalV2Button = React.forwardRef(function TimbalV2Button2({
205
+ variant = "secondary",
206
+ size = "sm",
207
+ isIconOnly = false,
208
+ isLoading = false,
209
+ fullWidth = false,
210
+ shape = "pill",
211
+ asChild = false,
212
+ className,
213
+ disabled,
214
+ type = "button",
215
+ children,
216
+ ...props
217
+ }, ref) {
218
+ const isDisabled = disabled || isLoading;
219
+ const sizeClass = isIconOnly ? TIMBAL_V2_SIZE_ICON[size] : TIMBAL_V2_SIZE_HEIGHT[size];
220
+ const radiusClass = variant === "link" || variant === "ghost" ? "rounded-md" : shape === "rect" ? "rounded-md" : "rounded-full";
221
+ const sharedRootClass = cn(
222
+ "relative box-border inline-flex items-center justify-center gap-2 whitespace-nowrap border-0 text-sm font-normal shadow-none transition duration-200 ease-in-out",
223
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-1 focus-visible:ring-offset-background",
224
+ sizeClass,
225
+ radiusClass,
226
+ TIMBAL_V2_BORDER[variant],
227
+ TIMBAL_V2_SHADOW[variant],
228
+ fullWidth && "w-full",
229
+ isDisabled && "pointer-events-none opacity-50",
230
+ className
231
+ );
232
+ if (asChild) {
233
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
234
+ import_radix_ui.Slot.Root,
235
+ {
236
+ ref,
237
+ "aria-disabled": isDisabled ? true : void 0,
238
+ "data-slot": "timbal-v2-button",
239
+ "data-variant": variant,
240
+ className: cn(
241
+ sharedRootClass,
242
+ TIMBAL_V2_FILL_AS_CHILD[variant],
243
+ !isIconOnly && TIMBAL_V2_SIZE_LABEL_PX[size],
244
+ TIMBAL_V2_LABEL_AS_CHILD[variant]
245
+ ),
246
+ ...props,
247
+ children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "size-4 animate-spin rounded-full border-2 border-current border-t-transparent" }) : children
248
+ }
249
+ );
250
+ }
251
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
252
+ "button",
253
+ {
254
+ ref,
255
+ type,
256
+ disabled: isDisabled,
257
+ "data-slot": "timbal-v2-button",
258
+ "data-variant": variant,
259
+ className: cn(
260
+ "group/tbv2 flex-col items-stretch overflow-hidden bg-transparent p-0",
261
+ sharedRootClass
262
+ ),
263
+ ...props,
264
+ children: [
265
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
266
+ "span",
267
+ {
268
+ "aria-hidden": true,
269
+ className: cn(
270
+ "pointer-events-none absolute inset-0 transition duration-200 ease-in-out",
271
+ TIMBAL_V2_FILL[variant]
272
+ )
273
+ }
274
+ ),
275
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
276
+ "span",
277
+ {
278
+ className: cn(
279
+ "relative z-10 flex min-h-0 flex-1 items-center justify-center gap-1 leading-tight",
280
+ !isIconOnly && TIMBAL_V2_SIZE_LABEL_PX[size],
281
+ TIMBAL_V2_LABEL[variant]
282
+ ),
283
+ children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "size-4 animate-spin rounded-full border-2 border-current border-t-transparent" }) : children
284
+ }
285
+ )
286
+ ]
287
+ }
288
+ );
289
+ });
290
+
291
+ // src/ui/button.tsx
292
+ var import_jsx_runtime2 = require("react/jsx-runtime");
293
+ var LEGACY_SIZE_TO_V2 = {
294
+ default: "md",
295
+ xs: "xs",
296
+ sm: "sm",
297
+ lg: "lg",
298
+ icon: "sm",
299
+ "icon-xs": "xs",
300
+ "icon-sm": "sm",
301
+ "icon-lg": "lg"
302
+ };
303
+ var buttonVariants = (0, import_class_variance_authority.cva)(
304
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0",
305
+ {
306
+ variants: {
307
+ variant: {
308
+ default: "",
309
+ destructive: "",
310
+ outline: "",
311
+ secondary: "",
312
+ ghost: "",
313
+ link: ""
314
+ },
315
+ size: {
316
+ default: "",
317
+ xs: "",
318
+ sm: "",
319
+ lg: "",
320
+ icon: "",
321
+ "icon-xs": "",
322
+ "icon-sm": "",
323
+ "icon-lg": ""
324
+ }
325
+ },
326
+ defaultVariants: {
327
+ variant: "default",
328
+ size: "default"
329
+ }
330
+ }
331
+ );
332
+ function Button({
333
+ className,
334
+ variant = "default",
335
+ size = "default",
336
+ asChild = false,
337
+ ...props
338
+ }) {
339
+ const v2Variant = TIMBAL_V2_FROM_LEGACY_BUTTON[variant ?? "default"];
340
+ const v2Size = LEGACY_SIZE_TO_V2[size ?? "default"];
341
+ const isIconOnly = typeof size === "string" && size.startsWith("icon");
342
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
343
+ TimbalV2Button,
344
+ {
345
+ "data-slot": "button",
346
+ "data-variant": variant,
347
+ "data-size": size,
348
+ variant: v2Variant,
349
+ size: v2Size,
350
+ shape: "rect",
351
+ isIconOnly,
352
+ asChild,
353
+ className: cn(buttonVariants({ variant, size, className })),
354
+ ...props
355
+ }
356
+ );
357
+ }
358
+
359
+ // src/ui/tooltip.tsx
360
+ var import_radix_ui2 = require("radix-ui");
361
+ var import_jsx_runtime3 = require("react/jsx-runtime");
362
+ function TooltipProvider({
363
+ delayDuration = 0,
364
+ ...props
365
+ }) {
366
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
367
+ import_radix_ui2.Tooltip.Provider,
368
+ {
369
+ "data-slot": "tooltip-provider",
370
+ delayDuration,
371
+ ...props
372
+ }
373
+ );
374
+ }
375
+ function Tooltip({
376
+ ...props
377
+ }) {
378
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.Tooltip.Root, { "data-slot": "tooltip", ...props });
379
+ }
380
+ function TooltipTrigger({
381
+ ...props
382
+ }) {
383
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.Tooltip.Trigger, { "data-slot": "tooltip-trigger", ...props });
384
+ }
385
+ function TooltipContent({
386
+ className,
387
+ sideOffset = 0,
388
+ children,
389
+ ...props
390
+ }) {
391
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.Tooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
392
+ import_radix_ui2.Tooltip.Content,
393
+ {
394
+ "data-slot": "tooltip-content",
395
+ sideOffset,
396
+ className: cn(
397
+ "bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
398
+ className
399
+ ),
400
+ ...props,
401
+ children: [
402
+ children,
403
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.Tooltip.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
404
+ ]
405
+ }
406
+ ) });
407
+ }
408
+
409
+ // src/ui/avatar.tsx
410
+ var import_radix_ui3 = require("radix-ui");
411
+ var import_jsx_runtime4 = require("react/jsx-runtime");
412
+ function Avatar({
413
+ className,
414
+ size = "default",
415
+ ...props
416
+ }) {
417
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
418
+ import_radix_ui3.Avatar.Root,
419
+ {
420
+ "data-slot": "avatar",
421
+ "data-size": size,
422
+ className: cn(
423
+ "group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",
424
+ className
425
+ ),
426
+ ...props
427
+ }
428
+ );
429
+ }
430
+ function AvatarImage({
431
+ className,
432
+ ...props
433
+ }) {
434
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
435
+ import_radix_ui3.Avatar.Image,
436
+ {
437
+ "data-slot": "avatar-image",
438
+ className: cn("aspect-square size-full", className),
439
+ ...props
440
+ }
441
+ );
442
+ }
443
+ function AvatarFallback({
444
+ className,
445
+ ...props
446
+ }) {
447
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
448
+ import_radix_ui3.Avatar.Fallback,
449
+ {
450
+ "data-slot": "avatar-fallback",
451
+ className: cn(
452
+ "bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs",
453
+ className
454
+ ),
455
+ ...props
456
+ }
457
+ );
458
+ }
459
+
460
+ // src/ui/dialog.tsx
461
+ var import_lucide_react = require("lucide-react");
462
+ var import_radix_ui4 = require("radix-ui");
463
+ var import_jsx_runtime5 = require("react/jsx-runtime");
464
+ function Dialog({
465
+ ...props
466
+ }) {
467
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_radix_ui4.Dialog.Root, { "data-slot": "dialog", ...props });
468
+ }
469
+ function DialogTrigger({
470
+ ...props
471
+ }) {
472
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_radix_ui4.Dialog.Trigger, { "data-slot": "dialog-trigger", ...props });
473
+ }
474
+ function DialogPortal({
475
+ ...props
476
+ }) {
477
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_radix_ui4.Dialog.Portal, { "data-slot": "dialog-portal", ...props });
478
+ }
479
+ function DialogClose({
480
+ ...props
481
+ }) {
482
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_radix_ui4.Dialog.Close, { "data-slot": "dialog-close", ...props });
483
+ }
484
+ function DialogOverlay({
485
+ className,
486
+ ...props
487
+ }) {
488
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
489
+ import_radix_ui4.Dialog.Overlay,
490
+ {
491
+ "data-slot": "dialog-overlay",
492
+ className: cn(
493
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[70] bg-black/50",
494
+ className
495
+ ),
496
+ ...props
497
+ }
498
+ );
499
+ }
500
+ function DialogContent({
501
+ className,
502
+ children,
503
+ showCloseButton = true,
504
+ ...props
505
+ }) {
506
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [
507
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DialogOverlay, {}),
508
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
509
+ import_radix_ui4.Dialog.Content,
510
+ {
511
+ "data-slot": "dialog-content",
512
+ className: cn(
513
+ TIMBAL_V2_MODAL_SURFACE,
514
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-[70] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl p-6 duration-200 outline-none sm:max-w-lg",
515
+ className
516
+ ),
517
+ ...props,
518
+ children: [
519
+ children,
520
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
521
+ import_radix_ui4.Dialog.Close,
522
+ {
523
+ "data-slot": "dialog-close",
524
+ className: "ring-offset-background focus:ring-ring data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-[opacity,background-color] hover:bg-ghost-fill-hover hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
525
+ children: [
526
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.XIcon, {}),
527
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sr-only", children: "Close" })
528
+ ]
529
+ }
530
+ )
531
+ ]
532
+ }
533
+ )
534
+ ] });
535
+ }
536
+ function DialogTitle({
537
+ className,
538
+ ...props
539
+ }) {
540
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
541
+ import_radix_ui4.Dialog.Title,
542
+ {
543
+ "data-slot": "dialog-title",
544
+ className: cn("text-lg leading-none font-semibold", className),
545
+ ...props
546
+ }
547
+ );
548
+ }
549
+
550
+ // src/ui/shimmer.tsx
551
+ var import_react = require("motion/react");
552
+ var import_react2 = require("react");
553
+ var import_jsx_runtime6 = require("react/jsx-runtime");
554
+ var ShimmerComponent = ({
555
+ children,
556
+ as: Component = "p",
557
+ className,
558
+ duration = 2,
559
+ spread = 2
560
+ }) => {
561
+ const MotionComponent = import_react.motion.create(
562
+ Component
563
+ );
564
+ const dynamicSpread = (0, import_react2.useMemo)(
565
+ () => (children?.length ?? 0) * spread,
566
+ [children, spread]
567
+ );
568
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
569
+ MotionComponent,
570
+ {
571
+ animate: { backgroundPosition: "0% center" },
572
+ className: cn(
573
+ "relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent",
574
+ "[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",
575
+ className
576
+ ),
577
+ initial: { backgroundPosition: "100% center" },
578
+ style: {
579
+ "--spread": `${dynamicSpread}px`,
580
+ backgroundImage: "var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"
581
+ },
582
+ transition: {
583
+ repeat: Number.POSITIVE_INFINITY,
584
+ duration,
585
+ ease: "linear"
586
+ },
587
+ children
588
+ }
589
+ );
590
+ };
591
+ var Shimmer = (0, import_react2.memo)(ShimmerComponent);
592
+
593
+ // src/ui/pill-segmented-tabs.tsx
594
+ var import_react3 = require("react");
595
+ var import_react4 = require("motion/react");
596
+
597
+ // src/design/pill-segmented-classes.ts
598
+ var pillSegmentedTrackBase = "inline-flex w-fit max-w-max shrink-0 self-start items-center rounded-full";
599
+ var pillSegmentedTrackSurface = cn(
600
+ "bg-pill-segmented-track border border-[var(--pill-segmented-track-border)]",
601
+ "shadow-[var(--pill-segmented-track-shadow)]"
602
+ );
603
+ var pillSegmentedTrackClass = cn(
604
+ pillSegmentedTrackBase,
605
+ pillSegmentedTrackSurface,
606
+ "gap-1 p-1"
607
+ );
608
+ var pillSegmentedTrackFlushClass = cn(
609
+ pillSegmentedTrackBase,
610
+ pillSegmentedTrackSurface,
611
+ "h-[var(--studio-chrome-pill-height)] items-center gap-0.5 overflow-visible p-0.5"
612
+ );
613
+ var pillSegmentedSegmentClass = cn(
614
+ "relative flex items-center gap-1.5 rounded-full px-4 py-1.5 text-xs font-normal transition-colors"
615
+ );
616
+ var pillSegmentedFlushSegmentClass = cn(
617
+ "relative box-border inline-flex h-9 min-h-9 items-center justify-center gap-1.5 rounded-full px-3.5 py-0",
618
+ "text-sm font-normal leading-tight transition-colors"
619
+ );
620
+ var pillSegmentedActiveIndicatorClass = cn(
621
+ "absolute inset-0 rounded-full",
622
+ "border border-[var(--pill-segmented-indicator-border)]",
623
+ "bg-gradient-to-b from-[var(--pill-segmented-indicator-from)] to-[var(--pill-segmented-indicator-to)]",
624
+ "shadow-[var(--pill-segmented-indicator-shadow)]"
625
+ );
626
+
627
+ // src/ui/pill-segmented-tabs.tsx
628
+ var import_jsx_runtime7 = require("react/jsx-runtime");
629
+ var PillTab = ({
630
+ tabKey,
631
+ label,
632
+ isActive,
633
+ disabled,
634
+ onSelect,
635
+ layoutId,
636
+ segmentClassName,
637
+ animateIndicator
638
+ }) => {
639
+ const handlePress = (0, import_react3.useCallback)(() => {
640
+ if (!disabled) onSelect(tabKey);
641
+ }, [disabled, onSelect, tabKey]);
642
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
643
+ "button",
644
+ {
645
+ type: "button",
646
+ onClick: handlePress,
647
+ disabled,
648
+ "aria-pressed": isActive,
649
+ className: cn(
650
+ segmentClassName,
651
+ disabled && "cursor-not-allowed opacity-50",
652
+ !disabled && (isActive ? "text-foreground" : "text-muted-foreground hover:text-foreground")
653
+ ),
654
+ children: [
655
+ isActive && animateIndicator ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
656
+ import_react4.motion.div,
657
+ {
658
+ layoutId,
659
+ className: pillSegmentedActiveIndicatorClass,
660
+ transition: { type: "spring", duration: 0.3, bounce: 0.15 }
661
+ }
662
+ ) : isActive ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: pillSegmentedActiveIndicatorClass, "aria-hidden": true }) : null,
663
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "relative z-10 whitespace-nowrap", children: label })
664
+ ]
665
+ }
666
+ );
667
+ };
668
+ var PillSegmentedTabs = ({
669
+ value,
670
+ onChange,
671
+ tabs,
672
+ className,
673
+ trackVariant = "default",
674
+ layoutId: layoutIdProp,
675
+ "aria-label": ariaLabel
676
+ }) => {
677
+ const reactId = (0, import_react3.useId)();
678
+ const layoutId = layoutIdProp ?? `pill-segmented-${reactId.replace(/:/g, "")}`;
679
+ const reducedMotion = (0, import_react4.useReducedMotion)();
680
+ const isFlush = trackVariant === "flush";
681
+ const trackClass = isFlush ? pillSegmentedTrackFlushClass : pillSegmentedTrackClass;
682
+ const segmentClassName = isFlush ? pillSegmentedFlushSegmentClass : pillSegmentedSegmentClass;
683
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { role: "group", "aria-label": ariaLabel, className: cn(trackClass, className), children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
684
+ PillTab,
685
+ {
686
+ tabKey: tab.key,
687
+ label: tab.label,
688
+ disabled: tab.disabled,
689
+ isActive: value === tab.key,
690
+ onSelect: onChange,
691
+ layoutId,
692
+ segmentClassName,
693
+ animateIndicator: !reducedMotion
694
+ },
695
+ tab.key
696
+ )) });
697
+ };
698
+ var MemoPillSegmentedTabs = (0, import_react3.memo)(PillSegmentedTabs);
699
+ // Annotate the CommonJS export names for ESM import in node:
700
+ 0 && (module.exports = {
701
+ Avatar,
702
+ AvatarFallback,
703
+ AvatarImage,
704
+ Button,
705
+ Dialog,
706
+ DialogClose,
707
+ DialogContent,
708
+ DialogOverlay,
709
+ DialogPortal,
710
+ DialogTitle,
711
+ DialogTrigger,
712
+ MemoPillSegmentedTabs,
713
+ PillSegmentedTabs,
714
+ Shimmer,
715
+ TimbalV2Button,
716
+ Tooltip,
717
+ TooltipContent,
718
+ TooltipProvider,
719
+ TooltipTrigger
720
+ });