@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
@@ -0,0 +1,13 @@
1
+ export { c as ChatAttachment, d as ChatMessage, e as Composer, f as ComposerProps, g as ContentPart, S as SendOptions, h as Suggestions, i as SuggestionsComponent, j as SuggestionsSlotProps, k as SuggestionsSource, l as TextContentPart, m as ThinkingContentPart, n as Thread, o as ThreadArtifactsConfig, p as ThreadComponents, q as ThreadProps, r as ThreadSuggestion, s as ThreadSuggestionsProps, T as ThreadVariant, t as ThreadWelcomeConfig, u as ThreadWelcomeProps, a as TimbalChat, b as TimbalChatProps, v as TimbalRuntimeProvider, w as TimbalRuntimeProviderProps, x as TimbalStreamApi, y as ToolCallContentPart, U as UseTimbalStreamOptions, z as useResolvedSuggestions, A as useTimbalRuntime, B as useTimbalStream } from './chat-CWtQWDtJ.cjs';
2
+ export { M as MarkdownText, T as THREAD_DEFAULT_MAX_WIDTH, a as ToolFallback, b as TooltipIconButton, c as TooltipIconButtonProps, W as WorkforceSelector, d as WorkforceSelectorProps, e as assistantMessageContentClass, f as assistantMessageRootClass, t as threadMessageColumnClass, u as useToolRunning, g as userMessageRootClass } from './layout-B9VayJhZ.cjs';
3
+ import { FC } from 'react';
4
+ import 'react/jsx-runtime';
5
+ import '@assistant-ui/react';
6
+ import '@timbal-ai/timbal-sdk';
7
+ import './timbal-v2-button-F4-z7m33.cjs';
8
+
9
+ declare const UserMessageAttachments: FC;
10
+ declare const ComposerAttachments: FC;
11
+ declare const ComposerAddAttachment: FC;
12
+
13
+ export { ComposerAddAttachment, ComposerAttachments, UserMessageAttachments };
package/dist/chat.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ export { c as ChatAttachment, d as ChatMessage, e as Composer, f as ComposerProps, g as ContentPart, S as SendOptions, h as Suggestions, i as SuggestionsComponent, j as SuggestionsSlotProps, k as SuggestionsSource, l as TextContentPart, m as ThinkingContentPart, n as Thread, o as ThreadArtifactsConfig, p as ThreadComponents, q as ThreadProps, r as ThreadSuggestion, s as ThreadSuggestionsProps, T as ThreadVariant, t as ThreadWelcomeConfig, u as ThreadWelcomeProps, a as TimbalChat, b as TimbalChatProps, v as TimbalRuntimeProvider, w as TimbalRuntimeProviderProps, x as TimbalStreamApi, y as ToolCallContentPart, U as UseTimbalStreamOptions, z as useResolvedSuggestions, A as useTimbalRuntime, B as useTimbalStream } from './chat-CWtQWDtJ.js';
2
+ export { M as MarkdownText, T as THREAD_DEFAULT_MAX_WIDTH, a as ToolFallback, b as TooltipIconButton, c as TooltipIconButtonProps, W as WorkforceSelector, d as WorkforceSelectorProps, e as assistantMessageContentClass, f as assistantMessageRootClass, t as threadMessageColumnClass, u as useToolRunning, g as userMessageRootClass } from './layout-CQWngNQ7.js';
3
+ import { FC } from 'react';
4
+ import 'react/jsx-runtime';
5
+ import '@assistant-ui/react';
6
+ import '@timbal-ai/timbal-sdk';
7
+ import './timbal-v2-button-F4-z7m33.js';
8
+
9
+ declare const UserMessageAttachments: FC;
10
+ declare const ComposerAttachments: FC;
11
+ declare const ComposerAddAttachment: FC;
12
+
13
+ export { ComposerAddAttachment, ComposerAttachments, UserMessageAttachments };
@@ -0,0 +1,51 @@
1
+ import {
2
+ THREAD_DEFAULT_MAX_WIDTH,
3
+ assistantMessageContentClass,
4
+ assistantMessageRootClass,
5
+ threadMessageColumnClass,
6
+ userMessageRootClass
7
+ } from "./chunk-KC5QLVUG.esm.js";
8
+ import {
9
+ WorkforceSelector
10
+ } from "./chunk-WLTW56MC.esm.js";
11
+ import {
12
+ Composer,
13
+ ComposerAddAttachment,
14
+ ComposerAttachments,
15
+ MarkdownText,
16
+ Suggestions,
17
+ Thread,
18
+ TimbalChat,
19
+ TimbalRuntimeProvider,
20
+ ToolFallback,
21
+ TooltipIconButton,
22
+ UserMessageAttachments,
23
+ useResolvedSuggestions,
24
+ useTimbalRuntime,
25
+ useTimbalStream,
26
+ useToolRunning
27
+ } from "./chunk-YJQLLFKP.esm.js";
28
+ import "./chunk-4TCJQSIX.esm.js";
29
+ export {
30
+ Composer,
31
+ ComposerAddAttachment,
32
+ ComposerAttachments,
33
+ MarkdownText,
34
+ Suggestions,
35
+ THREAD_DEFAULT_MAX_WIDTH,
36
+ Thread,
37
+ TimbalChat,
38
+ TimbalRuntimeProvider,
39
+ ToolFallback,
40
+ TooltipIconButton,
41
+ UserMessageAttachments,
42
+ WorkforceSelector,
43
+ assistantMessageContentClass,
44
+ assistantMessageRootClass,
45
+ threadMessageColumnClass,
46
+ useResolvedSuggestions,
47
+ useTimbalRuntime,
48
+ useTimbalStream,
49
+ useToolRunning,
50
+ userMessageRootClass
51
+ };
@@ -0,0 +1,565 @@
1
+ // src/utils.ts
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+ function cn(...inputs) {
5
+ return twMerge(clsx(inputs));
6
+ }
7
+
8
+ // src/ui/timbal-v2-button.tsx
9
+ import * as React from "react";
10
+ import { Slot } from "radix-ui";
11
+
12
+ // src/design/button-tokens.ts
13
+ var TIMBAL_V2_ELEVATED_GRADIENT = "bg-gradient-to-b from-elevated-from to-elevated-to";
14
+ var TIMBAL_V2_MODAL_SURFACE = cn(
15
+ "bg-gradient-to-b from-modal-from to-modal-to",
16
+ "border border-border shadow-card-elevated"
17
+ );
18
+ var TIMBAL_V2_PRIMARY_GRADIENT = "bg-gradient-to-b from-primary-fill-from to-primary-fill-to";
19
+ var TIMBAL_V2_FROM_LEGACY_BUTTON = {
20
+ default: "primary",
21
+ destructive: "destructive",
22
+ outline: "secondary",
23
+ secondary: "secondary",
24
+ ghost: "ghost",
25
+ link: "link"
26
+ };
27
+ var TIMBAL_V2_SIZE_HEIGHT = {
28
+ xs: "min-h-8 h-8",
29
+ sm: "min-h-9 h-9",
30
+ md: "min-h-10 h-10",
31
+ lg: "min-h-11 h-11"
32
+ };
33
+ var TIMBAL_V2_SIZE_ICON = {
34
+ xs: "min-h-8 min-w-8 size-8",
35
+ sm: "min-h-8 min-w-8 size-8",
36
+ md: "min-h-10 min-w-10 size-10",
37
+ lg: "min-h-11 min-w-11 size-11"
38
+ };
39
+ var TIMBAL_V2_SIZE_LABEL_PX = {
40
+ xs: "px-3",
41
+ sm: "px-4",
42
+ md: "px-5",
43
+ lg: "px-6"
44
+ };
45
+ var TIMBAL_V2_FILL = {
46
+ primary: [
47
+ "bg-gradient-to-b from-primary-fill-from to-primary-fill-to",
48
+ "group-hover/tbv2:from-primary-fill-hover-from group-hover/tbv2:to-primary-fill-hover-to",
49
+ "group-active/tbv2:from-primary-fill-active-from group-active/tbv2:to-primary-fill-active-to"
50
+ ].join(" "),
51
+ informative: [
52
+ TIMBAL_V2_PRIMARY_GRADIENT,
53
+ "group-hover/tbv2:from-primary-fill-hover-from group-hover/tbv2:to-primary-fill-hover-to",
54
+ "group-active/tbv2:from-primary-fill-active-from group-active/tbv2:to-primary-fill-active-to",
55
+ "group-active/tbv2:[background-image:linear-gradient(to_top,rgba(0,0,0,0.08),transparent_55%)]"
56
+ ].join(" "),
57
+ destructive: [
58
+ TIMBAL_V2_ELEVATED_GRADIENT,
59
+ "group-hover/tbv2:from-destructive-fill-hover-from group-hover/tbv2:to-destructive-fill-hover-to",
60
+ "group-active/tbv2:from-destructive-fill-active-from group-active/tbv2:to-destructive-fill-active-to"
61
+ ].join(" "),
62
+ secondary: [
63
+ TIMBAL_V2_ELEVATED_GRADIENT,
64
+ "group-hover/tbv2:from-secondary-fill-hover-from group-hover/tbv2:to-secondary-fill-hover-to",
65
+ "group-active/tbv2:from-secondary-fill-active-from group-active/tbv2:to-secondary-fill-active-to"
66
+ ].join(" "),
67
+ ghost: [
68
+ "bg-transparent",
69
+ "group-hover/tbv2:bg-ghost-fill-hover",
70
+ "group-active/tbv2:bg-ghost-fill-active"
71
+ ].join(" "),
72
+ link: "bg-transparent"
73
+ };
74
+ var TIMBAL_V2_LABEL = {
75
+ primary: "text-primary-foreground",
76
+ informative: "text-primary-foreground",
77
+ destructive: "text-destructive",
78
+ secondary: "text-foreground",
79
+ ghost: "text-foreground",
80
+ link: "text-foreground underline decoration-foreground/25 underline-offset-2 group-hover/tbv2:decoration-foreground/45"
81
+ };
82
+ var TIMBAL_V2_BORDER = {
83
+ primary: "",
84
+ informative: "border border-foreground/15",
85
+ destructive: "border border-destructive/45",
86
+ secondary: "border border-border",
87
+ ghost: "",
88
+ link: ""
89
+ };
90
+ var TIMBAL_V2_SHADOW = {
91
+ primary: "shadow-card",
92
+ informative: "shadow-card",
93
+ destructive: "shadow-card",
94
+ secondary: "shadow-card",
95
+ ghost: "",
96
+ link: ""
97
+ };
98
+ var TIMBAL_V2_SWITCH_TRACK_OFF = cn(
99
+ TIMBAL_V2_ELEVATED_GRADIENT,
100
+ "border border-border shadow-card"
101
+ );
102
+ var TIMBAL_V2_SWITCH_THUMB = cn(
103
+ TIMBAL_V2_ELEVATED_GRADIENT,
104
+ "border border-border/80 shadow-sm"
105
+ );
106
+ var TIMBAL_V2_SECONDARY_CHROME = [
107
+ TIMBAL_V2_ELEVATED_GRADIENT,
108
+ "border border-border shadow-card",
109
+ "transition-[background-color,box-shadow,border-color] duration-200 ease-in-out",
110
+ "hover:from-secondary-fill-hover-from hover:to-secondary-fill-hover-to",
111
+ "active:from-secondary-fill-active-from active:to-secondary-fill-active-to"
112
+ ].join(" ");
113
+
114
+ // src/ui/timbal-v2-button.tsx
115
+ import { jsx, jsxs } from "react/jsx-runtime";
116
+ var TIMBAL_V2_FILL_AS_CHILD = {
117
+ primary: [
118
+ "bg-gradient-to-b from-primary-fill-from to-primary-fill-to",
119
+ "hover:from-primary-fill-hover-from hover:to-primary-fill-hover-to",
120
+ "active:from-primary-fill-active-from active:to-primary-fill-active-to"
121
+ ].join(" "),
122
+ informative: [
123
+ TIMBAL_V2_PRIMARY_GRADIENT,
124
+ "hover:from-primary-fill-hover-from hover:to-primary-fill-hover-to",
125
+ "active:from-primary-fill-active-from active:to-primary-fill-active-to",
126
+ "active:[background-image:linear-gradient(to_top,rgba(0,0,0,0.08),transparent_55%)]"
127
+ ].join(" "),
128
+ destructive: [
129
+ TIMBAL_V2_ELEVATED_GRADIENT,
130
+ "hover:from-destructive-fill-hover-from hover:to-destructive-fill-hover-to",
131
+ "active:from-destructive-fill-active-from active:to-destructive-fill-active-to"
132
+ ].join(" "),
133
+ secondary: [
134
+ TIMBAL_V2_ELEVATED_GRADIENT,
135
+ "hover:from-secondary-fill-hover-from hover:to-secondary-fill-hover-to",
136
+ "active:from-secondary-fill-active-from active:to-secondary-fill-active-to"
137
+ ].join(" "),
138
+ ghost: [
139
+ "bg-transparent",
140
+ "hover:bg-ghost-fill-hover",
141
+ "active:bg-ghost-fill-active"
142
+ ].join(" "),
143
+ link: "bg-transparent"
144
+ };
145
+ var TIMBAL_V2_LABEL_AS_CHILD = {
146
+ ...TIMBAL_V2_LABEL,
147
+ link: "text-foreground underline decoration-foreground/25 underline-offset-2 hover:decoration-foreground/45"
148
+ };
149
+ var TimbalV2Button = React.forwardRef(function TimbalV2Button2({
150
+ variant = "secondary",
151
+ size = "sm",
152
+ isIconOnly = false,
153
+ isLoading = false,
154
+ fullWidth = false,
155
+ shape = "pill",
156
+ asChild = false,
157
+ className,
158
+ disabled,
159
+ type = "button",
160
+ children,
161
+ ...props
162
+ }, ref) {
163
+ const isDisabled = disabled || isLoading;
164
+ const sizeClass = isIconOnly ? TIMBAL_V2_SIZE_ICON[size] : TIMBAL_V2_SIZE_HEIGHT[size];
165
+ const radiusClass = variant === "link" || variant === "ghost" ? "rounded-md" : shape === "rect" ? "rounded-md" : "rounded-full";
166
+ const sharedRootClass = cn(
167
+ "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",
168
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-1 focus-visible:ring-offset-background",
169
+ sizeClass,
170
+ radiusClass,
171
+ TIMBAL_V2_BORDER[variant],
172
+ TIMBAL_V2_SHADOW[variant],
173
+ fullWidth && "w-full",
174
+ isDisabled && "pointer-events-none opacity-50",
175
+ className
176
+ );
177
+ if (asChild) {
178
+ return /* @__PURE__ */ jsx(
179
+ Slot.Root,
180
+ {
181
+ ref,
182
+ "aria-disabled": isDisabled ? true : void 0,
183
+ "data-slot": "timbal-v2-button",
184
+ "data-variant": variant,
185
+ className: cn(
186
+ sharedRootClass,
187
+ TIMBAL_V2_FILL_AS_CHILD[variant],
188
+ !isIconOnly && TIMBAL_V2_SIZE_LABEL_PX[size],
189
+ TIMBAL_V2_LABEL_AS_CHILD[variant]
190
+ ),
191
+ ...props,
192
+ children: isLoading ? /* @__PURE__ */ jsx("span", { className: "size-4 animate-spin rounded-full border-2 border-current border-t-transparent" }) : children
193
+ }
194
+ );
195
+ }
196
+ return /* @__PURE__ */ jsxs(
197
+ "button",
198
+ {
199
+ ref,
200
+ type,
201
+ disabled: isDisabled,
202
+ "data-slot": "timbal-v2-button",
203
+ "data-variant": variant,
204
+ className: cn(
205
+ "group/tbv2 flex-col items-stretch overflow-hidden bg-transparent p-0",
206
+ sharedRootClass
207
+ ),
208
+ ...props,
209
+ children: [
210
+ /* @__PURE__ */ jsx(
211
+ "span",
212
+ {
213
+ "aria-hidden": true,
214
+ className: cn(
215
+ "pointer-events-none absolute inset-0 transition duration-200 ease-in-out",
216
+ TIMBAL_V2_FILL[variant]
217
+ )
218
+ }
219
+ ),
220
+ /* @__PURE__ */ jsx(
221
+ "span",
222
+ {
223
+ className: cn(
224
+ "relative z-10 flex min-h-0 flex-1 items-center justify-center gap-1 leading-tight",
225
+ !isIconOnly && TIMBAL_V2_SIZE_LABEL_PX[size],
226
+ TIMBAL_V2_LABEL[variant]
227
+ ),
228
+ children: isLoading ? /* @__PURE__ */ jsx("span", { className: "size-4 animate-spin rounded-full border-2 border-current border-t-transparent" }) : children
229
+ }
230
+ )
231
+ ]
232
+ }
233
+ );
234
+ });
235
+
236
+ // src/ui/tooltip.tsx
237
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
238
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
239
+ function TooltipProvider({
240
+ delayDuration = 0,
241
+ ...props
242
+ }) {
243
+ return /* @__PURE__ */ jsx2(
244
+ TooltipPrimitive.Provider,
245
+ {
246
+ "data-slot": "tooltip-provider",
247
+ delayDuration,
248
+ ...props
249
+ }
250
+ );
251
+ }
252
+ function Tooltip({
253
+ ...props
254
+ }) {
255
+ return /* @__PURE__ */ jsx2(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
256
+ }
257
+ function TooltipTrigger({
258
+ ...props
259
+ }) {
260
+ return /* @__PURE__ */ jsx2(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
261
+ }
262
+ function TooltipContent({
263
+ className,
264
+ sideOffset = 0,
265
+ children,
266
+ ...props
267
+ }) {
268
+ return /* @__PURE__ */ jsx2(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs2(
269
+ TooltipPrimitive.Content,
270
+ {
271
+ "data-slot": "tooltip-content",
272
+ sideOffset,
273
+ className: cn(
274
+ "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",
275
+ className
276
+ ),
277
+ ...props,
278
+ children: [
279
+ children,
280
+ /* @__PURE__ */ jsx2(TooltipPrimitive.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
281
+ ]
282
+ }
283
+ ) });
284
+ }
285
+
286
+ // src/ui/dialog.tsx
287
+ import { XIcon } from "lucide-react";
288
+ import { Dialog as DialogPrimitive } from "radix-ui";
289
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
290
+ function Dialog({
291
+ ...props
292
+ }) {
293
+ return /* @__PURE__ */ jsx3(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
294
+ }
295
+ function DialogTrigger({
296
+ ...props
297
+ }) {
298
+ return /* @__PURE__ */ jsx3(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
299
+ }
300
+ function DialogPortal({
301
+ ...props
302
+ }) {
303
+ return /* @__PURE__ */ jsx3(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
304
+ }
305
+ function DialogClose({
306
+ ...props
307
+ }) {
308
+ return /* @__PURE__ */ jsx3(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
309
+ }
310
+ function DialogOverlay({
311
+ className,
312
+ ...props
313
+ }) {
314
+ return /* @__PURE__ */ jsx3(
315
+ DialogPrimitive.Overlay,
316
+ {
317
+ "data-slot": "dialog-overlay",
318
+ className: cn(
319
+ "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",
320
+ className
321
+ ),
322
+ ...props
323
+ }
324
+ );
325
+ }
326
+ function DialogContent({
327
+ className,
328
+ children,
329
+ showCloseButton = true,
330
+ ...props
331
+ }) {
332
+ return /* @__PURE__ */ jsxs3(DialogPortal, { "data-slot": "dialog-portal", children: [
333
+ /* @__PURE__ */ jsx3(DialogOverlay, {}),
334
+ /* @__PURE__ */ jsxs3(
335
+ DialogPrimitive.Content,
336
+ {
337
+ "data-slot": "dialog-content",
338
+ className: cn(
339
+ TIMBAL_V2_MODAL_SURFACE,
340
+ "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",
341
+ className
342
+ ),
343
+ ...props,
344
+ children: [
345
+ children,
346
+ showCloseButton && /* @__PURE__ */ jsxs3(
347
+ DialogPrimitive.Close,
348
+ {
349
+ "data-slot": "dialog-close",
350
+ 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",
351
+ children: [
352
+ /* @__PURE__ */ jsx3(XIcon, {}),
353
+ /* @__PURE__ */ jsx3("span", { className: "sr-only", children: "Close" })
354
+ ]
355
+ }
356
+ )
357
+ ]
358
+ }
359
+ )
360
+ ] });
361
+ }
362
+ function DialogTitle({
363
+ className,
364
+ ...props
365
+ }) {
366
+ return /* @__PURE__ */ jsx3(
367
+ DialogPrimitive.Title,
368
+ {
369
+ "data-slot": "dialog-title",
370
+ className: cn("text-lg leading-none font-semibold", className),
371
+ ...props
372
+ }
373
+ );
374
+ }
375
+
376
+ // src/ui/avatar.tsx
377
+ import { Avatar as AvatarPrimitive } from "radix-ui";
378
+ import { jsx as jsx4 } from "react/jsx-runtime";
379
+ function Avatar({
380
+ className,
381
+ size = "default",
382
+ ...props
383
+ }) {
384
+ return /* @__PURE__ */ jsx4(
385
+ AvatarPrimitive.Root,
386
+ {
387
+ "data-slot": "avatar",
388
+ "data-size": size,
389
+ className: cn(
390
+ "group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",
391
+ className
392
+ ),
393
+ ...props
394
+ }
395
+ );
396
+ }
397
+ function AvatarImage({
398
+ className,
399
+ ...props
400
+ }) {
401
+ return /* @__PURE__ */ jsx4(
402
+ AvatarPrimitive.Image,
403
+ {
404
+ "data-slot": "avatar-image",
405
+ className: cn("aspect-square size-full", className),
406
+ ...props
407
+ }
408
+ );
409
+ }
410
+ function AvatarFallback({
411
+ className,
412
+ ...props
413
+ }) {
414
+ return /* @__PURE__ */ jsx4(
415
+ AvatarPrimitive.Fallback,
416
+ {
417
+ "data-slot": "avatar-fallback",
418
+ className: cn(
419
+ "bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs",
420
+ className
421
+ ),
422
+ ...props
423
+ }
424
+ );
425
+ }
426
+
427
+ // src/ui/button.tsx
428
+ import { cva } from "class-variance-authority";
429
+ import { jsx as jsx5 } from "react/jsx-runtime";
430
+ var LEGACY_SIZE_TO_V2 = {
431
+ default: "md",
432
+ xs: "xs",
433
+ sm: "sm",
434
+ lg: "lg",
435
+ icon: "sm",
436
+ "icon-xs": "xs",
437
+ "icon-sm": "sm",
438
+ "icon-lg": "lg"
439
+ };
440
+ var buttonVariants = cva(
441
+ "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",
442
+ {
443
+ variants: {
444
+ variant: {
445
+ default: "",
446
+ destructive: "",
447
+ outline: "",
448
+ secondary: "",
449
+ ghost: "",
450
+ link: ""
451
+ },
452
+ size: {
453
+ default: "",
454
+ xs: "",
455
+ sm: "",
456
+ lg: "",
457
+ icon: "",
458
+ "icon-xs": "",
459
+ "icon-sm": "",
460
+ "icon-lg": ""
461
+ }
462
+ },
463
+ defaultVariants: {
464
+ variant: "default",
465
+ size: "default"
466
+ }
467
+ }
468
+ );
469
+ function Button({
470
+ className,
471
+ variant = "default",
472
+ size = "default",
473
+ asChild = false,
474
+ ...props
475
+ }) {
476
+ const v2Variant = TIMBAL_V2_FROM_LEGACY_BUTTON[variant ?? "default"];
477
+ const v2Size = LEGACY_SIZE_TO_V2[size ?? "default"];
478
+ const isIconOnly = typeof size === "string" && size.startsWith("icon");
479
+ return /* @__PURE__ */ jsx5(
480
+ TimbalV2Button,
481
+ {
482
+ "data-slot": "button",
483
+ "data-variant": variant,
484
+ "data-size": size,
485
+ variant: v2Variant,
486
+ size: v2Size,
487
+ shape: "rect",
488
+ isIconOnly,
489
+ asChild,
490
+ className: cn(buttonVariants({ variant, size, className })),
491
+ ...props
492
+ }
493
+ );
494
+ }
495
+
496
+ // src/ui/shimmer.tsx
497
+ import { motion } from "motion/react";
498
+ import {
499
+ memo,
500
+ useMemo
501
+ } from "react";
502
+ import { jsx as jsx6 } from "react/jsx-runtime";
503
+ var ShimmerComponent = ({
504
+ children,
505
+ as: Component = "p",
506
+ className,
507
+ duration = 2,
508
+ spread = 2
509
+ }) => {
510
+ const MotionComponent = motion.create(
511
+ Component
512
+ );
513
+ const dynamicSpread = useMemo(
514
+ () => (children?.length ?? 0) * spread,
515
+ [children, spread]
516
+ );
517
+ return /* @__PURE__ */ jsx6(
518
+ MotionComponent,
519
+ {
520
+ animate: { backgroundPosition: "0% center" },
521
+ className: cn(
522
+ "relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent",
523
+ "[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",
524
+ className
525
+ ),
526
+ initial: { backgroundPosition: "100% center" },
527
+ style: {
528
+ "--spread": `${dynamicSpread}px`,
529
+ backgroundImage: "var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"
530
+ },
531
+ transition: {
532
+ repeat: Number.POSITIVE_INFINITY,
533
+ duration,
534
+ ease: "linear"
535
+ },
536
+ children
537
+ }
538
+ );
539
+ };
540
+ var Shimmer = memo(ShimmerComponent);
541
+
542
+ export {
543
+ cn,
544
+ TIMBAL_V2_ELEVATED_GRADIENT,
545
+ TIMBAL_V2_SWITCH_TRACK_OFF,
546
+ TIMBAL_V2_SWITCH_THUMB,
547
+ TIMBAL_V2_SECONDARY_CHROME,
548
+ TimbalV2Button,
549
+ TooltipProvider,
550
+ Tooltip,
551
+ TooltipTrigger,
552
+ TooltipContent,
553
+ Dialog,
554
+ DialogTrigger,
555
+ DialogPortal,
556
+ DialogClose,
557
+ DialogOverlay,
558
+ DialogContent,
559
+ DialogTitle,
560
+ Avatar,
561
+ AvatarImage,
562
+ AvatarFallback,
563
+ Button,
564
+ Shimmer
565
+ };