@melony/react 0.1.51 → 0.1.53
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 +617 -601
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -152
- package/dist/index.d.ts +93 -152
- package/dist/index.js +617 -604
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React3 from 'react';
|
|
2
2
|
import React3__default, { createContext, useContext, useRef, useEffect, useState, useCallback, useMemo } from 'react';
|
|
3
|
-
import { convertEventsToMessages } from 'melony';
|
|
3
|
+
import { filterEventsBySlots, convertEventsToMessages } from 'melony';
|
|
4
4
|
import { NuqsAdapter } from 'nuqs/adapters/react';
|
|
5
5
|
import { QueryClient, QueryClientProvider, useQueryClient, useQuery, useMutation } from '@tanstack/react-query';
|
|
6
6
|
import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
|
|
@@ -8,7 +8,7 @@ import { clsx } from 'clsx';
|
|
|
8
8
|
import { twMerge } from 'tailwind-merge';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import * as ICONS from '@tabler/icons-react';
|
|
11
|
-
import { IconX, IconChevronLeft, IconChevronRight, IconLoader2, IconCheck, IconUpload, IconUser, IconLogout, IconBrandGoogle, IconFileText, IconFile, IconPaperclip, IconChevronDown, IconArrowUp,
|
|
11
|
+
import { IconX, IconChevronLeft, IconChevronRight, IconLoader2, IconCheck, IconUpload, IconDotsVertical, IconUser, IconLogout, IconBrandGoogle, IconFileText, IconFile, IconPaperclip, IconChevronDown, IconArrowUp, IconHistory, IconPlus, IconArrowLeft, IconMessage, IconLayoutSidebarLeftExpand, IconLayoutSidebarLeftCollapse, IconLayoutSidebarRightExpand, IconLayoutSidebarRightCollapse, IconDeviceDesktop, IconMoon, IconSun, IconSelector, IconChevronUp } from '@tabler/icons-react';
|
|
12
12
|
export * from '@tabler/icons-react';
|
|
13
13
|
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
14
14
|
import { mergeProps } from '@base-ui/react/merge-props';
|
|
@@ -189,210 +189,295 @@ function CardContent({ className, ...props }) {
|
|
|
189
189
|
}
|
|
190
190
|
);
|
|
191
191
|
}
|
|
192
|
+
|
|
193
|
+
// src/lib/theme-utils.ts
|
|
194
|
+
var paddingMap = {
|
|
195
|
+
none: "p-0",
|
|
196
|
+
xs: "p-1",
|
|
197
|
+
sm: "p-2",
|
|
198
|
+
md: "p-4",
|
|
199
|
+
lg: "p-6",
|
|
200
|
+
xl: "p-8",
|
|
201
|
+
xxl: "p-12"
|
|
202
|
+
};
|
|
203
|
+
var marginMap = {
|
|
204
|
+
none: "m-0",
|
|
205
|
+
xs: "m-1",
|
|
206
|
+
sm: "m-2",
|
|
207
|
+
md: "m-4",
|
|
208
|
+
lg: "m-6",
|
|
209
|
+
xl: "m-8",
|
|
210
|
+
xxl: "m-12"
|
|
211
|
+
};
|
|
212
|
+
var gapMap = {
|
|
213
|
+
none: "gap-0",
|
|
214
|
+
xs: "gap-1",
|
|
215
|
+
sm: "gap-2",
|
|
216
|
+
md: "gap-4",
|
|
217
|
+
lg: "gap-6",
|
|
218
|
+
xl: "gap-8",
|
|
219
|
+
xxl: "gap-12"
|
|
220
|
+
};
|
|
221
|
+
var colorBgMap = {
|
|
222
|
+
primary: "bg-primary text-primary-foreground",
|
|
223
|
+
secondary: "bg-secondary text-secondary-foreground",
|
|
224
|
+
success: "bg-green-500 text-white",
|
|
225
|
+
danger: "bg-destructive text-destructive-foreground",
|
|
226
|
+
warning: "bg-yellow-500 text-white",
|
|
227
|
+
info: "bg-blue-500 text-white",
|
|
228
|
+
background: "bg-background text-foreground",
|
|
229
|
+
foreground: "bg-foreground text-background",
|
|
230
|
+
muted: "bg-muted text-muted-foreground",
|
|
231
|
+
mutedForeground: "bg-muted-foreground text-muted",
|
|
232
|
+
border: "bg-border",
|
|
233
|
+
transparent: "bg-transparent"
|
|
234
|
+
};
|
|
235
|
+
var colorTextMap = {
|
|
236
|
+
primary: "text-primary",
|
|
237
|
+
secondary: "text-secondary",
|
|
238
|
+
success: "text-green-600",
|
|
239
|
+
danger: "text-destructive",
|
|
240
|
+
warning: "text-yellow-600",
|
|
241
|
+
info: "text-blue-600",
|
|
242
|
+
background: "text-background",
|
|
243
|
+
foreground: "text-foreground",
|
|
244
|
+
muted: "text-muted-foreground",
|
|
245
|
+
mutedForeground: "text-muted-foreground",
|
|
246
|
+
border: "text-border",
|
|
247
|
+
transparent: "text-transparent"
|
|
248
|
+
};
|
|
249
|
+
var colorBorderMap = {
|
|
250
|
+
primary: "border-primary",
|
|
251
|
+
secondary: "border-secondary",
|
|
252
|
+
success: "border-green-500",
|
|
253
|
+
danger: "border-destructive",
|
|
254
|
+
warning: "border-yellow-500",
|
|
255
|
+
info: "border-blue-500",
|
|
256
|
+
background: "border-background",
|
|
257
|
+
foreground: "border-foreground",
|
|
258
|
+
muted: "border-muted",
|
|
259
|
+
mutedForeground: "border-muted-foreground",
|
|
260
|
+
border: "border-border",
|
|
261
|
+
transparent: "border-transparent"
|
|
262
|
+
};
|
|
263
|
+
var widthMap = {
|
|
264
|
+
auto: "w-auto",
|
|
265
|
+
full: "w-full",
|
|
266
|
+
min: "w-min",
|
|
267
|
+
max: "w-max",
|
|
268
|
+
"1/2": "w-1/2",
|
|
269
|
+
"1/3": "w-1/3",
|
|
270
|
+
"2/3": "w-2/3",
|
|
271
|
+
"1/4": "w-1/4",
|
|
272
|
+
"3/4": "w-3/4"
|
|
273
|
+
};
|
|
274
|
+
var shadowMap = {
|
|
275
|
+
none: "shadow-none",
|
|
276
|
+
sm: "shadow-sm",
|
|
277
|
+
md: "shadow-md",
|
|
278
|
+
lg: "shadow-lg",
|
|
279
|
+
xl: "shadow-xl"
|
|
280
|
+
};
|
|
281
|
+
var radiusMap = {
|
|
282
|
+
none: "rounded-none",
|
|
283
|
+
sm: "rounded-sm",
|
|
284
|
+
md: "rounded-md",
|
|
285
|
+
lg: "rounded-lg",
|
|
286
|
+
full: "rounded-full"
|
|
287
|
+
};
|
|
288
|
+
var alignMap = {
|
|
289
|
+
start: "items-start",
|
|
290
|
+
center: "items-center",
|
|
291
|
+
end: "items-end",
|
|
292
|
+
stretch: "items-stretch"
|
|
293
|
+
};
|
|
294
|
+
var justifyMap = {
|
|
295
|
+
start: "justify-start",
|
|
296
|
+
center: "justify-center",
|
|
297
|
+
end: "justify-end",
|
|
298
|
+
between: "justify-between",
|
|
299
|
+
around: "justify-around"
|
|
300
|
+
};
|
|
301
|
+
var wrapMap = {
|
|
302
|
+
nowrap: "flex-nowrap",
|
|
303
|
+
wrap: "flex-wrap",
|
|
304
|
+
"wrap-reverse": "flex-wrap-reverse"
|
|
305
|
+
};
|
|
306
|
+
var textSizeMap = {
|
|
307
|
+
none: "text-[0]",
|
|
308
|
+
xs: "text-xs",
|
|
309
|
+
sm: "text-sm",
|
|
310
|
+
md: "text-base",
|
|
311
|
+
lg: "text-lg",
|
|
312
|
+
xl: "text-xl",
|
|
313
|
+
xxl: "text-2xl"
|
|
314
|
+
};
|
|
315
|
+
var textAlignMap = {
|
|
316
|
+
start: "text-left",
|
|
317
|
+
center: "text-center",
|
|
318
|
+
end: "text-right",
|
|
319
|
+
stretch: "text-justify"
|
|
320
|
+
};
|
|
321
|
+
var fontWeightMap = {
|
|
322
|
+
normal: "font-normal",
|
|
323
|
+
medium: "font-medium",
|
|
324
|
+
semibold: "font-semibold",
|
|
325
|
+
bold: "font-bold"
|
|
326
|
+
};
|
|
192
327
|
var Card2 = ({
|
|
193
328
|
children,
|
|
194
329
|
title,
|
|
195
330
|
subtitle,
|
|
196
|
-
|
|
197
|
-
|
|
331
|
+
background,
|
|
332
|
+
padding = "md",
|
|
333
|
+
radius = "md",
|
|
334
|
+
shadow = "md"
|
|
198
335
|
}) => {
|
|
199
336
|
return /* @__PURE__ */ jsxs(
|
|
200
337
|
Card,
|
|
201
338
|
{
|
|
202
|
-
className: cn(
|
|
203
|
-
|
|
339
|
+
className: cn(
|
|
340
|
+
"min-w-96 relative",
|
|
341
|
+
background && colorBgMap[background],
|
|
342
|
+
radius && radiusMap[radius],
|
|
343
|
+
shadow && shadowMap[shadow]
|
|
344
|
+
),
|
|
204
345
|
children: [
|
|
205
346
|
(title || subtitle) && /* @__PURE__ */ jsxs(CardHeader, { className: "pb-3", children: [
|
|
206
347
|
title && /* @__PURE__ */ jsx(CardTitle, { className: "text-lg", children: title }),
|
|
207
348
|
subtitle && /* @__PURE__ */ jsx(CardDescription, { children: subtitle })
|
|
208
349
|
] }),
|
|
209
|
-
/* @__PURE__ */ jsx(CardContent, { className: "flex flex-col gap-4", children })
|
|
350
|
+
/* @__PURE__ */ jsx(CardContent, { className: cn("flex flex-col gap-4", paddingMap[padding]), children })
|
|
210
351
|
]
|
|
211
352
|
}
|
|
212
353
|
);
|
|
213
354
|
};
|
|
214
355
|
var Row = ({
|
|
215
356
|
children,
|
|
216
|
-
gap = "md",
|
|
217
357
|
align = "start",
|
|
218
358
|
justify = "start",
|
|
219
|
-
wrap =
|
|
220
|
-
|
|
221
|
-
|
|
359
|
+
wrap = "nowrap",
|
|
360
|
+
gap = "none",
|
|
361
|
+
padding = "none",
|
|
362
|
+
width = "full"
|
|
222
363
|
}) => {
|
|
223
|
-
const gapClasses = {
|
|
224
|
-
xs: "gap-0",
|
|
225
|
-
sm: "gap-1",
|
|
226
|
-
md: "gap-2",
|
|
227
|
-
lg: "gap-4",
|
|
228
|
-
xl: "gap-6"
|
|
229
|
-
};
|
|
230
|
-
const alignClasses = {
|
|
231
|
-
start: "items-start",
|
|
232
|
-
center: "items-center",
|
|
233
|
-
end: "items-end",
|
|
234
|
-
stretch: "items-stretch"
|
|
235
|
-
};
|
|
236
|
-
const justifyClasses = {
|
|
237
|
-
start: "justify-start",
|
|
238
|
-
center: "justify-center",
|
|
239
|
-
end: "justify-end",
|
|
240
|
-
between: "justify-between",
|
|
241
|
-
around: "justify-around"
|
|
242
|
-
};
|
|
243
364
|
return /* @__PURE__ */ jsx(
|
|
244
365
|
"div",
|
|
245
366
|
{
|
|
246
367
|
className: cn(
|
|
247
|
-
"flex flex-row
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
368
|
+
"flex flex-row",
|
|
369
|
+
alignMap[align],
|
|
370
|
+
justifyMap[justify],
|
|
371
|
+
wrapMap[wrap],
|
|
372
|
+
gapMap[gap],
|
|
373
|
+
paddingMap[padding],
|
|
374
|
+
widthMap[width]
|
|
253
375
|
),
|
|
254
|
-
style,
|
|
255
376
|
children
|
|
256
377
|
}
|
|
257
378
|
);
|
|
258
379
|
};
|
|
259
380
|
var Col = ({
|
|
260
381
|
children,
|
|
261
|
-
gap = "sm",
|
|
262
382
|
align = "start",
|
|
263
383
|
justify = "start",
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
style
|
|
384
|
+
gap = "none",
|
|
385
|
+
width = "auto",
|
|
386
|
+
height = "auto",
|
|
387
|
+
padding = "none",
|
|
388
|
+
background,
|
|
389
|
+
radius
|
|
271
390
|
}) => {
|
|
272
|
-
const gapClasses = {
|
|
273
|
-
xs: "gap-1",
|
|
274
|
-
sm: "gap-2",
|
|
275
|
-
md: "gap-4",
|
|
276
|
-
lg: "gap-6",
|
|
277
|
-
xl: "gap-8"
|
|
278
|
-
};
|
|
279
|
-
const alignClasses = {
|
|
280
|
-
start: "items-start",
|
|
281
|
-
center: "items-center",
|
|
282
|
-
end: "items-end",
|
|
283
|
-
stretch: "items-stretch"
|
|
284
|
-
};
|
|
285
|
-
const justifyClasses = {
|
|
286
|
-
start: "justify-start",
|
|
287
|
-
center: "justify-center",
|
|
288
|
-
end: "justify-end",
|
|
289
|
-
between: "justify-between",
|
|
290
|
-
around: "justify-around"
|
|
291
|
-
};
|
|
292
|
-
const overflowClasses = {
|
|
293
|
-
auto: "overflow-auto",
|
|
294
|
-
hidden: "overflow-hidden",
|
|
295
|
-
scroll: "overflow-scroll",
|
|
296
|
-
visible: "overflow-visible"
|
|
297
|
-
};
|
|
298
|
-
const positionClasses = {
|
|
299
|
-
static: "static",
|
|
300
|
-
relative: "relative",
|
|
301
|
-
absolute: "absolute",
|
|
302
|
-
fixed: "fixed",
|
|
303
|
-
sticky: "sticky"
|
|
304
|
-
};
|
|
305
391
|
return /* @__PURE__ */ jsx(
|
|
306
392
|
"div",
|
|
307
393
|
{
|
|
308
394
|
className: cn(
|
|
309
395
|
"flex flex-col",
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
396
|
+
alignMap[align],
|
|
397
|
+
justifyMap[justify],
|
|
398
|
+
gapMap[gap],
|
|
399
|
+
paddingMap[padding],
|
|
400
|
+
widthMap[width],
|
|
401
|
+
height === "full" && "h-full",
|
|
402
|
+
background && colorBgMap[background],
|
|
403
|
+
radius && radiusMap[radius]
|
|
316
404
|
),
|
|
317
|
-
style: {
|
|
318
|
-
width,
|
|
319
|
-
height,
|
|
320
|
-
padding,
|
|
321
|
-
...style
|
|
322
|
-
},
|
|
323
405
|
children
|
|
324
406
|
}
|
|
325
407
|
);
|
|
326
408
|
};
|
|
327
409
|
var Box = ({
|
|
328
410
|
children,
|
|
329
|
-
padding = "
|
|
330
|
-
margin,
|
|
411
|
+
padding = "none",
|
|
412
|
+
margin = "none",
|
|
331
413
|
background,
|
|
332
414
|
border = false,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
style
|
|
415
|
+
borderColor = "border",
|
|
416
|
+
radius = "none",
|
|
417
|
+
width = "auto",
|
|
418
|
+
height = "auto",
|
|
419
|
+
shadow = "none"
|
|
339
420
|
}) => {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
421
|
+
return /* @__PURE__ */ jsx(
|
|
422
|
+
"div",
|
|
423
|
+
{
|
|
424
|
+
className: cn(
|
|
425
|
+
"relative",
|
|
426
|
+
paddingMap[padding],
|
|
427
|
+
marginMap[margin],
|
|
428
|
+
background && colorBgMap[background],
|
|
429
|
+
border && "border",
|
|
430
|
+
border && colorBorderMap[borderColor],
|
|
431
|
+
radiusMap[radius],
|
|
432
|
+
widthMap[width],
|
|
433
|
+
height === "full" && "h-full",
|
|
434
|
+
shadowMap[shadow]
|
|
435
|
+
),
|
|
436
|
+
children
|
|
437
|
+
}
|
|
438
|
+
);
|
|
439
|
+
};
|
|
440
|
+
var Float = ({
|
|
441
|
+
children,
|
|
442
|
+
position = "top-right",
|
|
443
|
+
offsetX = "none",
|
|
444
|
+
offsetY = "none",
|
|
445
|
+
showOnHover = false
|
|
446
|
+
}) => {
|
|
447
|
+
const positionClasses = {
|
|
448
|
+
"top-left": "top-0 left-0",
|
|
449
|
+
"top-right": "top-0 right-0",
|
|
450
|
+
"bottom-left": "bottom-0 left-0",
|
|
451
|
+
"bottom-right": "bottom-0 right-0",
|
|
452
|
+
"center": "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
352
453
|
};
|
|
454
|
+
const marginXClass = position.endsWith("left") ? marginMap[offsetX].replace("m-", "ml-") : marginMap[offsetX].replace("m-", "mr-");
|
|
455
|
+
const marginYClass = position.startsWith("top") ? marginMap[offsetY].replace("m-", "mt-") : marginMap[offsetY].replace("m-", "mb-");
|
|
353
456
|
return /* @__PURE__ */ jsx(
|
|
354
457
|
"div",
|
|
355
458
|
{
|
|
356
459
|
className: cn(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
460
|
+
"absolute z-10",
|
|
461
|
+
positionClasses[position],
|
|
462
|
+
marginXClass,
|
|
463
|
+
marginYClass,
|
|
464
|
+
showOnHover && "opacity-0 group-hover:opacity-100 transition-opacity"
|
|
361
465
|
),
|
|
362
|
-
style: {
|
|
363
|
-
margin,
|
|
364
|
-
background: background ?? void 0,
|
|
365
|
-
borderRadius,
|
|
366
|
-
width,
|
|
367
|
-
height,
|
|
368
|
-
...style
|
|
369
|
-
},
|
|
370
466
|
children
|
|
371
467
|
}
|
|
372
468
|
);
|
|
373
469
|
};
|
|
374
470
|
var Spacer = ({
|
|
375
471
|
size = "md",
|
|
376
|
-
direction = "vertical"
|
|
377
|
-
className,
|
|
378
|
-
style
|
|
472
|
+
direction = "vertical"
|
|
379
473
|
}) => {
|
|
380
|
-
const sizeClasses = {
|
|
381
|
-
xs: "p-0.5",
|
|
382
|
-
sm: "p-1",
|
|
383
|
-
md: "p-2",
|
|
384
|
-
lg: "p-4",
|
|
385
|
-
xl: "p-8"
|
|
386
|
-
};
|
|
387
474
|
return /* @__PURE__ */ jsx(
|
|
388
475
|
"div",
|
|
389
476
|
{
|
|
390
477
|
className: cn(
|
|
391
478
|
direction === "vertical" ? "w-full" : "h-full",
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
),
|
|
395
|
-
style
|
|
479
|
+
paddingMap[size]
|
|
480
|
+
)
|
|
396
481
|
}
|
|
397
482
|
);
|
|
398
483
|
};
|
|
@@ -416,27 +501,30 @@ function Separator({
|
|
|
416
501
|
}
|
|
417
502
|
var Divider = ({
|
|
418
503
|
orientation = "horizontal",
|
|
419
|
-
|
|
420
|
-
|
|
504
|
+
color = "border",
|
|
505
|
+
margin = "md"
|
|
421
506
|
}) => {
|
|
422
507
|
return /* @__PURE__ */ jsx(
|
|
423
508
|
Separator,
|
|
424
509
|
{
|
|
425
510
|
orientation,
|
|
426
|
-
className: cn(
|
|
427
|
-
|
|
511
|
+
className: cn(
|
|
512
|
+
marginMap[margin],
|
|
513
|
+
colorBgMap[color]
|
|
514
|
+
)
|
|
428
515
|
}
|
|
429
516
|
);
|
|
430
517
|
};
|
|
431
|
-
var List = ({ children,
|
|
518
|
+
var List = ({ children, padding = "none", gap = "none", flex, overflow }) => {
|
|
432
519
|
return /* @__PURE__ */ jsx(
|
|
433
520
|
"div",
|
|
434
521
|
{
|
|
435
|
-
className: cn(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
522
|
+
className: cn(
|
|
523
|
+
"flex flex-col list-none m-0",
|
|
524
|
+
paddingMap[padding],
|
|
525
|
+
gapMap[gap]
|
|
526
|
+
),
|
|
527
|
+
style: { flex, overflow },
|
|
440
528
|
children
|
|
441
529
|
}
|
|
442
530
|
);
|
|
@@ -450,6 +538,9 @@ var useMelony = (options) => {
|
|
|
450
538
|
const { initialEvents } = options || {};
|
|
451
539
|
const prevInitialEventsRef = useRef(void 0);
|
|
452
540
|
useEffect(() => {
|
|
541
|
+
if (initialEvents && initialEvents === client.getState().events) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
453
544
|
const currentSerialized = initialEvents ? JSON.stringify(initialEvents) : void 0;
|
|
454
545
|
if (currentSerialized !== prevInitialEventsRef.current) {
|
|
455
546
|
if (initialEvents) {
|
|
@@ -464,46 +555,15 @@ var useMelony = (options) => {
|
|
|
464
555
|
};
|
|
465
556
|
var ListItem = ({
|
|
466
557
|
children,
|
|
467
|
-
orientation = "horizontal",
|
|
468
|
-
gap = "md",
|
|
469
|
-
align,
|
|
470
|
-
justify = "start",
|
|
471
558
|
onClickAction,
|
|
472
|
-
|
|
473
|
-
padding = "
|
|
474
|
-
|
|
475
|
-
|
|
559
|
+
gap = "sm",
|
|
560
|
+
padding = "sm",
|
|
561
|
+
background,
|
|
562
|
+
radius = "md",
|
|
563
|
+
align = "center"
|
|
476
564
|
}) => {
|
|
477
565
|
const { sendEvent } = useMelony();
|
|
478
|
-
const paddingClasses = {
|
|
479
|
-
xs: "px-1.5 py-1",
|
|
480
|
-
sm: "px-2 py-1.5",
|
|
481
|
-
md: "px-3 py-1.5",
|
|
482
|
-
lg: "px-4 py-3",
|
|
483
|
-
xl: "px-6 py-4"
|
|
484
|
-
};
|
|
485
566
|
const isInteractive = !!onClickAction;
|
|
486
|
-
const gapClasses = {
|
|
487
|
-
xs: "gap-1",
|
|
488
|
-
sm: "gap-2",
|
|
489
|
-
md: "gap-3",
|
|
490
|
-
lg: "gap-4",
|
|
491
|
-
xl: "gap-6"
|
|
492
|
-
};
|
|
493
|
-
const resolvedAlign = align ?? (orientation === "vertical" ? "start" : "center");
|
|
494
|
-
const alignClasses = {
|
|
495
|
-
start: "items-start",
|
|
496
|
-
center: "items-center",
|
|
497
|
-
end: "items-end",
|
|
498
|
-
stretch: "items-stretch"
|
|
499
|
-
};
|
|
500
|
-
const justifyClasses = {
|
|
501
|
-
start: "justify-start",
|
|
502
|
-
center: "justify-center",
|
|
503
|
-
end: "justify-end",
|
|
504
|
-
between: "justify-between",
|
|
505
|
-
around: "justify-around"
|
|
506
|
-
};
|
|
507
567
|
const handleClick = () => {
|
|
508
568
|
if (onClickAction) {
|
|
509
569
|
sendEvent(onClickAction);
|
|
@@ -514,29 +574,23 @@ var ListItem = ({
|
|
|
514
574
|
{
|
|
515
575
|
onClick: isInteractive ? handleClick : void 0,
|
|
516
576
|
className: cn(
|
|
517
|
-
"flex
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
paddingClasses[padding] || "px-3 py-2",
|
|
523
|
-
isInteractive ? "cursor-pointer hover:bg-muted" : "cursor-default",
|
|
524
|
-
className
|
|
577
|
+
"flex flex-row transition-colors text-sm",
|
|
578
|
+
paddingMap[padding],
|
|
579
|
+
background ? colorBgMap[background] : isInteractive && "hover:bg-muted",
|
|
580
|
+
radiusMap[radius],
|
|
581
|
+
isInteractive ? "cursor-pointer" : "cursor-default"
|
|
525
582
|
),
|
|
526
|
-
|
|
527
|
-
width,
|
|
528
|
-
...style
|
|
529
|
-
},
|
|
530
|
-
children
|
|
583
|
+
children: /* @__PURE__ */ jsx(Row, { align, gap, children })
|
|
531
584
|
}
|
|
532
585
|
);
|
|
533
586
|
};
|
|
534
587
|
var Image = ({
|
|
535
588
|
src,
|
|
536
589
|
alt,
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
590
|
+
width = "auto",
|
|
591
|
+
height,
|
|
592
|
+
radius = "md",
|
|
593
|
+
objectFit = "cover"
|
|
540
594
|
}) => {
|
|
541
595
|
const [hasError, setHasError] = useState(false);
|
|
542
596
|
const [isLoading, setIsLoading] = useState(true);
|
|
@@ -567,11 +621,6 @@ var Image = ({
|
|
|
567
621
|
};
|
|
568
622
|
const currentImage = gallery[currentIndex] || { src, alt };
|
|
569
623
|
const hasMultiple = gallery.length > 1;
|
|
570
|
-
const sizes = {
|
|
571
|
-
sm: "h-11",
|
|
572
|
-
md: "h-22",
|
|
573
|
-
lg: "h-44"
|
|
574
|
-
};
|
|
575
624
|
const handleError = () => {
|
|
576
625
|
setHasError(true);
|
|
577
626
|
setIsLoading(false);
|
|
@@ -584,11 +633,11 @@ var Image = ({
|
|
|
584
633
|
"div",
|
|
585
634
|
{
|
|
586
635
|
className: cn(
|
|
587
|
-
"flex items-center justify-center
|
|
588
|
-
|
|
589
|
-
|
|
636
|
+
"flex items-center justify-center bg-muted text-muted-foreground",
|
|
637
|
+
widthMap[width],
|
|
638
|
+
radiusMap[radius]
|
|
590
639
|
),
|
|
591
|
-
style,
|
|
640
|
+
style: { height: height || "100px" },
|
|
592
641
|
children: /* @__PURE__ */ jsx("span", { className: "text-[10px]", children: "Error" })
|
|
593
642
|
}
|
|
594
643
|
);
|
|
@@ -599,10 +648,11 @@ var Image = ({
|
|
|
599
648
|
{
|
|
600
649
|
ref: triggerRef,
|
|
601
650
|
className: cn(
|
|
602
|
-
"relative overflow-hidden
|
|
603
|
-
|
|
651
|
+
"relative overflow-hidden cursor-pointer",
|
|
652
|
+
widthMap[width],
|
|
653
|
+
radiusMap[radius]
|
|
604
654
|
),
|
|
605
|
-
style,
|
|
655
|
+
style: { height },
|
|
606
656
|
children: [
|
|
607
657
|
/* @__PURE__ */ jsx(
|
|
608
658
|
"img",
|
|
@@ -612,9 +662,10 @@ var Image = ({
|
|
|
612
662
|
onError: handleError,
|
|
613
663
|
onLoad: handleLoad,
|
|
614
664
|
className: cn(
|
|
615
|
-
"block
|
|
665
|
+
"block w-full transition-opacity duration-200 hover:opacity-90",
|
|
616
666
|
isLoading ? "opacity-0" : "opacity-100",
|
|
617
|
-
|
|
667
|
+
objectFit === "cover" ? "object-cover" : objectFit === "contain" ? "object-contain" : "object-fill",
|
|
668
|
+
height ? "h-full" : "h-auto"
|
|
618
669
|
)
|
|
619
670
|
}
|
|
620
671
|
),
|
|
@@ -679,9 +730,8 @@ var Video = ({
|
|
|
679
730
|
loop = false,
|
|
680
731
|
muted = false,
|
|
681
732
|
aspectRatio = "16/9",
|
|
682
|
-
width = "
|
|
683
|
-
|
|
684
|
-
style
|
|
733
|
+
width = "full",
|
|
734
|
+
radius = "lg"
|
|
685
735
|
}) => {
|
|
686
736
|
const aspectRatios = {
|
|
687
737
|
"16/9": "aspect-video",
|
|
@@ -693,14 +743,11 @@ var Video = ({
|
|
|
693
743
|
"div",
|
|
694
744
|
{
|
|
695
745
|
className: cn(
|
|
696
|
-
"relative overflow-hidden
|
|
746
|
+
"relative overflow-hidden bg-black shadow-sm",
|
|
697
747
|
aspectRatios[aspectRatio] || "aspect-video",
|
|
698
|
-
|
|
748
|
+
widthMap[width],
|
|
749
|
+
radiusMap[radius]
|
|
699
750
|
),
|
|
700
|
-
style: {
|
|
701
|
-
width: typeof width === "number" ? `${width}px` : width,
|
|
702
|
-
...style
|
|
703
|
-
},
|
|
704
751
|
children: /* @__PURE__ */ jsx(
|
|
705
752
|
"video",
|
|
706
753
|
{
|
|
@@ -719,37 +766,24 @@ var Video = ({
|
|
|
719
766
|
};
|
|
720
767
|
var Icon = ({
|
|
721
768
|
name,
|
|
722
|
-
size,
|
|
723
|
-
color
|
|
724
|
-
className,
|
|
725
|
-
style
|
|
769
|
+
size = "md",
|
|
770
|
+
color = "foreground"
|
|
726
771
|
}) => {
|
|
727
772
|
const IconComponent = ICONS[name];
|
|
728
773
|
if (!IconComponent) return null;
|
|
729
774
|
const sizeMap = {
|
|
730
|
-
xs: 12,
|
|
731
775
|
sm: 16,
|
|
732
776
|
md: 20,
|
|
733
|
-
lg: 24
|
|
734
|
-
xl: 28,
|
|
735
|
-
xxl: 32
|
|
777
|
+
lg: 24
|
|
736
778
|
};
|
|
737
|
-
const resolvedSize = typeof size === "
|
|
738
|
-
return /* @__PURE__ */ jsx(
|
|
739
|
-
|
|
779
|
+
const resolvedSize = typeof size === "number" ? size : sizeMap[size] || 20;
|
|
780
|
+
return /* @__PURE__ */ jsx("div", { className: cn("inline-flex items-center justify-center", colorTextMap[color]), children: /* @__PURE__ */ jsx(
|
|
781
|
+
IconComponent,
|
|
740
782
|
{
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
children: /* @__PURE__ */ jsx(
|
|
744
|
-
IconComponent,
|
|
745
|
-
{
|
|
746
|
-
size: resolvedSize,
|
|
747
|
-
color: color || "currentColor",
|
|
748
|
-
strokeWidth: 1.5
|
|
749
|
-
}
|
|
750
|
-
)
|
|
783
|
+
size: resolvedSize,
|
|
784
|
+
strokeWidth: 1.5
|
|
751
785
|
}
|
|
752
|
-
);
|
|
786
|
+
) });
|
|
753
787
|
};
|
|
754
788
|
var badgeVariants = cva(
|
|
755
789
|
"h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge",
|
|
@@ -793,24 +827,26 @@ function Badge({
|
|
|
793
827
|
var Badge2 = ({
|
|
794
828
|
label,
|
|
795
829
|
variant = "primary",
|
|
796
|
-
|
|
797
|
-
style
|
|
830
|
+
size = "md"
|
|
798
831
|
}) => {
|
|
799
832
|
const variantMap = {
|
|
800
833
|
primary: "default",
|
|
801
834
|
secondary: "secondary",
|
|
802
835
|
danger: "destructive",
|
|
803
836
|
success: "default",
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
837
|
+
warning: "secondary",
|
|
838
|
+
outline: "outline"
|
|
839
|
+
};
|
|
840
|
+
const sizeClasses = {
|
|
841
|
+
sm: "text-[10px] px-1.5 py-0",
|
|
842
|
+
md: "text-xs px-2.5 py-0.5",
|
|
843
|
+
lg: "text-sm px-3 py-1"
|
|
807
844
|
};
|
|
808
845
|
return /* @__PURE__ */ jsx(
|
|
809
846
|
Badge,
|
|
810
847
|
{
|
|
811
848
|
variant: variantMap[variant] || "default",
|
|
812
|
-
className,
|
|
813
|
-
style,
|
|
849
|
+
className: sizeClasses[size],
|
|
814
850
|
children: label
|
|
815
851
|
}
|
|
816
852
|
);
|
|
@@ -818,21 +854,20 @@ var Badge2 = ({
|
|
|
818
854
|
var Chart = ({
|
|
819
855
|
data,
|
|
820
856
|
chartType = "bar",
|
|
821
|
-
|
|
857
|
+
title,
|
|
858
|
+
height = 250,
|
|
822
859
|
showValues = false,
|
|
823
860
|
showGrid = false,
|
|
824
|
-
showTooltips = true
|
|
825
|
-
className,
|
|
826
|
-
style
|
|
861
|
+
showTooltips = true
|
|
827
862
|
}) => {
|
|
828
863
|
const [tooltip, setTooltip] = useState(null);
|
|
829
864
|
if (!Array.isArray(data)) {
|
|
830
|
-
return /* @__PURE__ */ jsx("div", { className: "p-4 text-destructive border border-destructive/20 rounded-md bg-destructive/5", children: "Error: Chart data must be an array" });
|
|
865
|
+
return /* @__PURE__ */ jsx("div", { className: "p-4 text-destructive border border-destructive/20 rounded-md bg-destructive/5 text-sm", children: "Error: Chart data must be an array" });
|
|
831
866
|
}
|
|
832
867
|
const maxValue = Math.max(...data.map((d) => d.value), 1);
|
|
833
868
|
const padding = { top: 40, right: 20, bottom: 40, left: 20 };
|
|
834
|
-
const
|
|
835
|
-
const
|
|
869
|
+
const chartHeight = height;
|
|
870
|
+
const chartWidth = 600;
|
|
836
871
|
const defaultColors = [
|
|
837
872
|
"hsl(var(--primary))",
|
|
838
873
|
"hsl(var(--chart-1, 217 91% 60%))",
|
|
@@ -905,7 +940,7 @@ var Chart = ({
|
|
|
905
940
|
const totalBarSpace = chartWidth - padding.left - padding.right;
|
|
906
941
|
const barSpacing = data.length > 1 ? totalBarSpace * 0.1 / data.length : 0;
|
|
907
942
|
const actualBarWidth = (totalBarSpace - barSpacing * (data.length + 1)) / data.length;
|
|
908
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
943
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: `0 0 ${chartWidth} ${chartHeight + padding.bottom}`, className: "w-full h-auto overflow-visible", children: [
|
|
909
944
|
renderGrid(),
|
|
910
945
|
data.map((item, index) => {
|
|
911
946
|
const barHeight = item.value / maxValue * chartHeight;
|
|
@@ -948,7 +983,7 @@ var Chart = ({
|
|
|
948
983
|
...item
|
|
949
984
|
}));
|
|
950
985
|
const pathData = points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
951
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
986
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: `0 0 ${chartWidth} ${chartHeight + padding.bottom}`, className: "w-full h-auto overflow-visible", children: [
|
|
952
987
|
renderGrid(),
|
|
953
988
|
/* @__PURE__ */ jsx("path", { d: pathData, fill: "none", stroke: getColor(0), strokeWidth: 3, className: "transition-all" }),
|
|
954
989
|
points.map((point, index) => /* @__PURE__ */ jsxs("g", { children: [
|
|
@@ -989,46 +1024,27 @@ var Chart = ({
|
|
|
989
1024
|
return renderBarChart();
|
|
990
1025
|
}
|
|
991
1026
|
};
|
|
992
|
-
return /* @__PURE__ */
|
|
1027
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-4 w-full", children: [
|
|
1028
|
+
title && /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold mb-4 text-center", children: title }),
|
|
1029
|
+
renderChart()
|
|
1030
|
+
] });
|
|
993
1031
|
};
|
|
994
1032
|
var Text = ({
|
|
995
1033
|
value,
|
|
996
1034
|
size = "md",
|
|
997
1035
|
weight = "normal",
|
|
998
1036
|
align = "start",
|
|
999
|
-
|
|
1000
|
-
style
|
|
1037
|
+
color = "foreground"
|
|
1001
1038
|
}) => {
|
|
1002
|
-
const sizeClasses = {
|
|
1003
|
-
xs: "text-xs",
|
|
1004
|
-
sm: "text-sm",
|
|
1005
|
-
md: "text-base",
|
|
1006
|
-
lg: "text-lg",
|
|
1007
|
-
xl: "text-xl"
|
|
1008
|
-
};
|
|
1009
|
-
const weightClasses = {
|
|
1010
|
-
light: "font-light",
|
|
1011
|
-
normal: "font-normal",
|
|
1012
|
-
medium: "font-medium",
|
|
1013
|
-
semibold: "font-semibold",
|
|
1014
|
-
bold: "font-bold"
|
|
1015
|
-
};
|
|
1016
|
-
const alignClasses = {
|
|
1017
|
-
start: "text-left",
|
|
1018
|
-
center: "text-center",
|
|
1019
|
-
end: "text-right",
|
|
1020
|
-
stretch: "text-justify"
|
|
1021
|
-
};
|
|
1022
1039
|
return /* @__PURE__ */ jsx(
|
|
1023
1040
|
"span",
|
|
1024
1041
|
{
|
|
1025
1042
|
className: cn(
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1043
|
+
textSizeMap[size],
|
|
1044
|
+
fontWeightMap[weight],
|
|
1045
|
+
textAlignMap[align],
|
|
1046
|
+
colorTextMap[color]
|
|
1030
1047
|
),
|
|
1031
|
-
style,
|
|
1032
1048
|
children: value
|
|
1033
1049
|
}
|
|
1034
1050
|
);
|
|
@@ -1036,8 +1052,8 @@ var Text = ({
|
|
|
1036
1052
|
var Heading = ({
|
|
1037
1053
|
value,
|
|
1038
1054
|
level = 2,
|
|
1039
|
-
|
|
1040
|
-
|
|
1055
|
+
color = "foreground",
|
|
1056
|
+
align = "start"
|
|
1041
1057
|
}) => {
|
|
1042
1058
|
const Tag = `h${level}`;
|
|
1043
1059
|
const levelClasses = {
|
|
@@ -1053,10 +1069,9 @@ var Heading = ({
|
|
|
1053
1069
|
{
|
|
1054
1070
|
className: cn(
|
|
1055
1071
|
levelClasses[Tag] || levelClasses.h2,
|
|
1056
|
-
|
|
1057
|
-
|
|
1072
|
+
colorTextMap[color],
|
|
1073
|
+
textAlignMap[align]
|
|
1058
1074
|
),
|
|
1059
|
-
style,
|
|
1060
1075
|
children: value
|
|
1061
1076
|
}
|
|
1062
1077
|
);
|
|
@@ -1133,13 +1148,12 @@ var Input2 = ({
|
|
|
1133
1148
|
inputType = "text",
|
|
1134
1149
|
placeholder,
|
|
1135
1150
|
defaultValue,
|
|
1136
|
-
value,
|
|
1137
1151
|
label,
|
|
1138
1152
|
name,
|
|
1139
1153
|
disabled,
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1154
|
+
required,
|
|
1155
|
+
width = "full",
|
|
1156
|
+
onChangeAction
|
|
1143
1157
|
}) => {
|
|
1144
1158
|
const { sendEvent } = useMelony();
|
|
1145
1159
|
const handleChange = (e) => {
|
|
@@ -1153,8 +1167,11 @@ var Input2 = ({
|
|
|
1153
1167
|
});
|
|
1154
1168
|
}
|
|
1155
1169
|
};
|
|
1156
|
-
return /* @__PURE__ */ jsxs(Field, { className: cn(
|
|
1157
|
-
label && /* @__PURE__ */
|
|
1170
|
+
return /* @__PURE__ */ jsxs(Field, { className: cn(widthMap[width]), children: [
|
|
1171
|
+
label && /* @__PURE__ */ jsxs(FieldTitle, { children: [
|
|
1172
|
+
label,
|
|
1173
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
1174
|
+
] }),
|
|
1158
1175
|
/* @__PURE__ */ jsx(
|
|
1159
1176
|
Input,
|
|
1160
1177
|
{
|
|
@@ -1163,9 +1180,9 @@ var Input2 = ({
|
|
|
1163
1180
|
id: name,
|
|
1164
1181
|
placeholder,
|
|
1165
1182
|
defaultValue,
|
|
1166
|
-
value,
|
|
1167
1183
|
disabled,
|
|
1168
|
-
onChange: handleChange
|
|
1184
|
+
onChange: handleChange,
|
|
1185
|
+
required
|
|
1169
1186
|
}
|
|
1170
1187
|
)
|
|
1171
1188
|
] });
|
|
@@ -1186,14 +1203,13 @@ function Textarea({ className, ...props }) {
|
|
|
1186
1203
|
var Textarea2 = ({
|
|
1187
1204
|
placeholder,
|
|
1188
1205
|
defaultValue,
|
|
1189
|
-
value,
|
|
1190
1206
|
label,
|
|
1191
1207
|
name,
|
|
1192
1208
|
disabled,
|
|
1193
1209
|
rows,
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1210
|
+
required,
|
|
1211
|
+
width = "full",
|
|
1212
|
+
onChangeAction
|
|
1197
1213
|
}) => {
|
|
1198
1214
|
const { sendEvent } = useMelony();
|
|
1199
1215
|
const handleChange = (e) => {
|
|
@@ -1207,8 +1223,11 @@ var Textarea2 = ({
|
|
|
1207
1223
|
});
|
|
1208
1224
|
}
|
|
1209
1225
|
};
|
|
1210
|
-
return /* @__PURE__ */ jsxs(Field, { className: cn(
|
|
1211
|
-
label && /* @__PURE__ */
|
|
1226
|
+
return /* @__PURE__ */ jsxs(Field, { className: cn(widthMap[width]), children: [
|
|
1227
|
+
label && /* @__PURE__ */ jsxs(FieldTitle, { children: [
|
|
1228
|
+
label,
|
|
1229
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
1230
|
+
] }),
|
|
1212
1231
|
/* @__PURE__ */ jsx(
|
|
1213
1232
|
Textarea,
|
|
1214
1233
|
{
|
|
@@ -1216,10 +1235,10 @@ var Textarea2 = ({
|
|
|
1216
1235
|
id: name,
|
|
1217
1236
|
placeholder,
|
|
1218
1237
|
defaultValue,
|
|
1219
|
-
value,
|
|
1220
1238
|
disabled,
|
|
1221
1239
|
rows,
|
|
1222
|
-
onChange: handleChange
|
|
1240
|
+
onChange: handleChange,
|
|
1241
|
+
required
|
|
1223
1242
|
}
|
|
1224
1243
|
)
|
|
1225
1244
|
] });
|
|
@@ -1362,14 +1381,13 @@ function SelectScrollDownButton({
|
|
|
1362
1381
|
var Select2 = ({
|
|
1363
1382
|
options,
|
|
1364
1383
|
defaultValue,
|
|
1365
|
-
value,
|
|
1366
1384
|
label,
|
|
1367
1385
|
name,
|
|
1368
1386
|
disabled,
|
|
1387
|
+
required,
|
|
1388
|
+
width = "full",
|
|
1369
1389
|
placeholder,
|
|
1370
|
-
onChangeAction
|
|
1371
|
-
className,
|
|
1372
|
-
style
|
|
1390
|
+
onChangeAction
|
|
1373
1391
|
}) => {
|
|
1374
1392
|
const { sendEvent } = useMelony();
|
|
1375
1393
|
const handleValueChange = (val) => {
|
|
@@ -1383,15 +1401,18 @@ var Select2 = ({
|
|
|
1383
1401
|
});
|
|
1384
1402
|
}
|
|
1385
1403
|
};
|
|
1386
|
-
return /* @__PURE__ */ jsxs(Field, { className: cn(
|
|
1387
|
-
label && /* @__PURE__ */
|
|
1404
|
+
return /* @__PURE__ */ jsxs(Field, { className: cn(widthMap[width]), children: [
|
|
1405
|
+
label && /* @__PURE__ */ jsxs(FieldTitle, { children: [
|
|
1406
|
+
label,
|
|
1407
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
1408
|
+
] }),
|
|
1388
1409
|
/* @__PURE__ */ jsxs(
|
|
1389
1410
|
Select,
|
|
1390
1411
|
{
|
|
1391
1412
|
defaultValue,
|
|
1392
|
-
value,
|
|
1393
1413
|
disabled,
|
|
1394
|
-
onValueChange: (
|
|
1414
|
+
onValueChange: (value) => handleValueChange(value || ""),
|
|
1415
|
+
required,
|
|
1395
1416
|
children: [
|
|
1396
1417
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
1397
1418
|
/* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
@@ -1404,15 +1425,18 @@ var Label2 = ({
|
|
|
1404
1425
|
value,
|
|
1405
1426
|
htmlFor,
|
|
1406
1427
|
required,
|
|
1407
|
-
|
|
1408
|
-
|
|
1428
|
+
size = "md",
|
|
1429
|
+
color = "foreground"
|
|
1409
1430
|
}) => {
|
|
1410
1431
|
return /* @__PURE__ */ jsxs(
|
|
1411
1432
|
Label,
|
|
1412
1433
|
{
|
|
1413
1434
|
htmlFor,
|
|
1414
|
-
className: cn(
|
|
1415
|
-
|
|
1435
|
+
className: cn(
|
|
1436
|
+
"flex items-center gap-1",
|
|
1437
|
+
textSizeMap[size],
|
|
1438
|
+
colorTextMap[color]
|
|
1439
|
+
),
|
|
1416
1440
|
children: [
|
|
1417
1441
|
value,
|
|
1418
1442
|
required && /* @__PURE__ */ jsx("span", { className: "text-destructive", children: "*" })
|
|
@@ -1424,11 +1448,8 @@ var Checkbox = ({
|
|
|
1424
1448
|
label,
|
|
1425
1449
|
name,
|
|
1426
1450
|
checked,
|
|
1427
|
-
defaultChecked,
|
|
1428
1451
|
disabled,
|
|
1429
|
-
onChangeAction
|
|
1430
|
-
className,
|
|
1431
|
-
style
|
|
1452
|
+
onChangeAction
|
|
1432
1453
|
}) => {
|
|
1433
1454
|
const { sendEvent } = useMelony();
|
|
1434
1455
|
const handleChange = (e) => {
|
|
@@ -1442,7 +1463,7 @@ var Checkbox = ({
|
|
|
1442
1463
|
});
|
|
1443
1464
|
}
|
|
1444
1465
|
};
|
|
1445
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
1466
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1446
1467
|
/* @__PURE__ */ jsx(
|
|
1447
1468
|
"input",
|
|
1448
1469
|
{
|
|
@@ -1450,7 +1471,6 @@ var Checkbox = ({
|
|
|
1450
1471
|
name,
|
|
1451
1472
|
id: name,
|
|
1452
1473
|
checked,
|
|
1453
|
-
defaultChecked,
|
|
1454
1474
|
disabled,
|
|
1455
1475
|
onChange: handleChange,
|
|
1456
1476
|
className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50"
|
|
@@ -1461,10 +1481,8 @@ var Checkbox = ({
|
|
|
1461
1481
|
{
|
|
1462
1482
|
htmlFor: name,
|
|
1463
1483
|
value: label,
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
disabled && "cursor-not-allowed opacity-50"
|
|
1467
|
-
)
|
|
1484
|
+
color: disabled ? "muted" : "foreground",
|
|
1485
|
+
size: "sm"
|
|
1468
1486
|
}
|
|
1469
1487
|
)
|
|
1470
1488
|
] });
|
|
@@ -1699,19 +1717,11 @@ var ColorPicker = ({
|
|
|
1699
1717
|
name,
|
|
1700
1718
|
label,
|
|
1701
1719
|
defaultValue = "#000000",
|
|
1702
|
-
value: controlledValue,
|
|
1703
1720
|
onChangeAction,
|
|
1704
|
-
disabled
|
|
1705
|
-
className,
|
|
1706
|
-
style
|
|
1721
|
+
disabled
|
|
1707
1722
|
}) => {
|
|
1708
1723
|
const { sendEvent } = useMelony();
|
|
1709
|
-
const [color, setColor] = useState(
|
|
1710
|
-
useEffect(() => {
|
|
1711
|
-
if (controlledValue !== void 0) {
|
|
1712
|
-
setColor(controlledValue);
|
|
1713
|
-
}
|
|
1714
|
-
}, [controlledValue]);
|
|
1724
|
+
const [color, setColor] = useState(defaultValue);
|
|
1715
1725
|
const handleColorChange = (newColor) => {
|
|
1716
1726
|
setColor(newColor);
|
|
1717
1727
|
if (onChangeAction) {
|
|
@@ -1724,7 +1734,7 @@ var ColorPicker = ({
|
|
|
1724
1734
|
});
|
|
1725
1735
|
}
|
|
1726
1736
|
};
|
|
1727
|
-
return /* @__PURE__ */ jsxs(Field, { className:
|
|
1737
|
+
return /* @__PURE__ */ jsxs(Field, { className: "w-full", children: [
|
|
1728
1738
|
label && /* @__PURE__ */ jsx(FieldTitle, { children: label }),
|
|
1729
1739
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1730
1740
|
/* @__PURE__ */ jsxs(Popover, { children: [
|
|
@@ -1791,13 +1801,10 @@ var RadioGroup = ({
|
|
|
1791
1801
|
name,
|
|
1792
1802
|
options,
|
|
1793
1803
|
defaultValue,
|
|
1794
|
-
value,
|
|
1795
1804
|
label,
|
|
1796
1805
|
disabled,
|
|
1797
1806
|
orientation = "vertical",
|
|
1798
|
-
onChangeAction
|
|
1799
|
-
className,
|
|
1800
|
-
style
|
|
1807
|
+
onChangeAction
|
|
1801
1808
|
}) => {
|
|
1802
1809
|
const { sendEvent } = useMelony();
|
|
1803
1810
|
const handleChange = (e) => {
|
|
@@ -1811,8 +1818,8 @@ var RadioGroup = ({
|
|
|
1811
1818
|
});
|
|
1812
1819
|
}
|
|
1813
1820
|
};
|
|
1814
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
1815
|
-
label && /* @__PURE__ */ jsx(Label2, { value: label
|
|
1821
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
1822
|
+
label && /* @__PURE__ */ jsx(Label2, { value: label }),
|
|
1816
1823
|
/* @__PURE__ */ jsx(
|
|
1817
1824
|
"div",
|
|
1818
1825
|
{
|
|
@@ -1835,8 +1842,7 @@ var RadioGroup = ({
|
|
|
1835
1842
|
name,
|
|
1836
1843
|
id: radioId,
|
|
1837
1844
|
value: option.value,
|
|
1838
|
-
defaultChecked: defaultValue === option.value
|
|
1839
|
-
checked: value === option.value,
|
|
1845
|
+
defaultChecked: defaultValue === option.value,
|
|
1840
1846
|
disabled: isDisabled,
|
|
1841
1847
|
onChange: handleChange,
|
|
1842
1848
|
className: "h-4 w-4 border-gray-300 text-primary focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50"
|
|
@@ -1847,10 +1853,8 @@ var RadioGroup = ({
|
|
|
1847
1853
|
{
|
|
1848
1854
|
htmlFor: radioId,
|
|
1849
1855
|
value: option.label,
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
isDisabled && "cursor-not-allowed opacity-50"
|
|
1853
|
-
)
|
|
1856
|
+
size: "sm",
|
|
1857
|
+
color: isDisabled ? "muted" : "foreground"
|
|
1854
1858
|
}
|
|
1855
1859
|
)
|
|
1856
1860
|
]
|
|
@@ -1907,26 +1911,34 @@ function Button({
|
|
|
1907
1911
|
);
|
|
1908
1912
|
}
|
|
1909
1913
|
var Button2 = ({
|
|
1910
|
-
type,
|
|
1914
|
+
type = "button",
|
|
1911
1915
|
label,
|
|
1912
1916
|
variant = "primary",
|
|
1913
|
-
size = "
|
|
1917
|
+
size = "md",
|
|
1914
1918
|
disabled = false,
|
|
1915
|
-
|
|
1919
|
+
width,
|
|
1916
1920
|
onClickAction,
|
|
1917
|
-
|
|
1918
|
-
style
|
|
1921
|
+
justify = "center"
|
|
1919
1922
|
}) => {
|
|
1920
1923
|
const { sendEvent } = useMelony();
|
|
1921
1924
|
const variantMap = {
|
|
1922
1925
|
primary: "default",
|
|
1923
1926
|
secondary: "secondary",
|
|
1924
1927
|
danger: "destructive",
|
|
1928
|
+
success: "default",
|
|
1929
|
+
// We might want a custom success style later
|
|
1925
1930
|
outline: "outline",
|
|
1926
1931
|
ghost: "ghost",
|
|
1927
|
-
link: "link"
|
|
1928
|
-
|
|
1929
|
-
|
|
1932
|
+
link: "link"
|
|
1933
|
+
};
|
|
1934
|
+
const widthMap2 = {
|
|
1935
|
+
full: "w-full",
|
|
1936
|
+
auto: "w-auto",
|
|
1937
|
+
"1/2": "w-1/2",
|
|
1938
|
+
"1/3": "w-1/3",
|
|
1939
|
+
"2/3": "w-2/3",
|
|
1940
|
+
"1/4": "w-1/4",
|
|
1941
|
+
"3/4": "w-3/4"
|
|
1930
1942
|
};
|
|
1931
1943
|
return /* @__PURE__ */ jsx(
|
|
1932
1944
|
Button,
|
|
@@ -1935,8 +1947,7 @@ var Button2 = ({
|
|
|
1935
1947
|
variant: variantMap[variant] || "default",
|
|
1936
1948
|
size: size === "md" ? "default" : size,
|
|
1937
1949
|
disabled,
|
|
1938
|
-
className: cn(
|
|
1939
|
-
style,
|
|
1950
|
+
className: cn(width && widthMap2[width], justifyMap[justify]),
|
|
1940
1951
|
onClick: () => {
|
|
1941
1952
|
if (onClickAction) {
|
|
1942
1953
|
sendEvent(onClickAction);
|
|
@@ -1951,10 +1962,9 @@ var Upload = ({
|
|
|
1951
1962
|
multiple = false,
|
|
1952
1963
|
accept,
|
|
1953
1964
|
onUploadAction,
|
|
1954
|
-
className,
|
|
1955
|
-
style,
|
|
1956
1965
|
initialFiles,
|
|
1957
|
-
mode = "append"
|
|
1966
|
+
mode = "append",
|
|
1967
|
+
disabled
|
|
1958
1968
|
}) => {
|
|
1959
1969
|
const { sendEvent, events } = useMelony();
|
|
1960
1970
|
const fileInputRef = useRef(null);
|
|
@@ -2024,7 +2034,7 @@ var Upload = ({
|
|
|
2024
2034
|
}
|
|
2025
2035
|
}
|
|
2026
2036
|
};
|
|
2027
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
2037
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative inline-block", children: [
|
|
2028
2038
|
/* @__PURE__ */ jsx(
|
|
2029
2039
|
"input",
|
|
2030
2040
|
{
|
|
@@ -2034,11 +2044,11 @@ var Upload = ({
|
|
|
2034
2044
|
multiple,
|
|
2035
2045
|
accept,
|
|
2036
2046
|
className: "hidden",
|
|
2037
|
-
disabled: isUploading
|
|
2047
|
+
disabled: isUploading || disabled
|
|
2038
2048
|
}
|
|
2039
2049
|
),
|
|
2040
2050
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 mb-2 items-center", children: [
|
|
2041
|
-
showInitialFiles && initialFiles?.map((file, index) => /* @__PURE__ */ jsx(Image, { src: file.url, alt: file.name,
|
|
2051
|
+
showInitialFiles && initialFiles?.map((file, index) => /* @__PURE__ */ jsx(Image, { src: file.url, alt: file.name, width: "min", radius: "md" }, index)),
|
|
2042
2052
|
displayEvents.map(
|
|
2043
2053
|
(event, index) => event.ui ? /* @__PURE__ */ jsx(UIRenderer, { node: event.ui }, index) : null
|
|
2044
2054
|
),
|
|
@@ -2046,12 +2056,11 @@ var Upload = ({
|
|
|
2046
2056
|
Button,
|
|
2047
2057
|
{
|
|
2048
2058
|
type: "button",
|
|
2049
|
-
disabled: isUploading,
|
|
2059
|
+
disabled: isUploading || disabled,
|
|
2050
2060
|
onClick: () => fileInputRef.current?.click(),
|
|
2051
|
-
|
|
2052
|
-
variant: status === "error" ? "destructive" : status === "success" ? "outline" : "default",
|
|
2061
|
+
variant: "default",
|
|
2053
2062
|
children: [
|
|
2054
|
-
isUploading ? /* @__PURE__ */ jsx(IconLoader2, { className: "h-4 w-4 animate-spin" }) : status === "success" ? /* @__PURE__ */ jsx(IconCheck, { className: "h-4 w-4 text-green-500" }) : status === "error" ? /* @__PURE__ */ jsx(IconX, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(IconUpload, { className: "h-4 w-4" }),
|
|
2063
|
+
isUploading ? /* @__PURE__ */ jsx(IconLoader2, { className: "h-4 w-4 animate-spin mr-2" }) : status === "success" ? /* @__PURE__ */ jsx(IconCheck, { className: "h-4 w-4 text-green-500 mr-2" }) : status === "error" ? /* @__PURE__ */ jsx(IconX, { className: "h-4 w-4 mr-2" }) : /* @__PURE__ */ jsx(IconUpload, { className: "h-4 w-4 mr-2" }),
|
|
2055
2064
|
status === "success" ? "Uploaded" : status === "error" ? "Failed" : label
|
|
2056
2065
|
]
|
|
2057
2066
|
}
|
|
@@ -2062,8 +2071,7 @@ var Upload = ({
|
|
|
2062
2071
|
var Form = ({
|
|
2063
2072
|
children,
|
|
2064
2073
|
onSubmitAction,
|
|
2065
|
-
|
|
2066
|
-
style
|
|
2074
|
+
gap = "md"
|
|
2067
2075
|
}) => {
|
|
2068
2076
|
const { sendEvent } = useMelony();
|
|
2069
2077
|
const [isSubmitted, setIsSubmitted] = useState(false);
|
|
@@ -2077,7 +2085,7 @@ var Form = ({
|
|
|
2077
2085
|
});
|
|
2078
2086
|
if (onSubmitAction) {
|
|
2079
2087
|
setIsSubmitted(true);
|
|
2080
|
-
if ("type" in onSubmitAction) {
|
|
2088
|
+
if (typeof onSubmitAction === "object" && "type" in onSubmitAction) {
|
|
2081
2089
|
sendEvent({
|
|
2082
2090
|
...onSubmitAction,
|
|
2083
2091
|
data: {
|
|
@@ -2085,7 +2093,7 @@ var Form = ({
|
|
|
2085
2093
|
...data
|
|
2086
2094
|
}
|
|
2087
2095
|
});
|
|
2088
|
-
} else {
|
|
2096
|
+
} else if (typeof onSubmitAction === "function") {
|
|
2089
2097
|
sendEvent(onSubmitAction(data));
|
|
2090
2098
|
}
|
|
2091
2099
|
}
|
|
@@ -2094,13 +2102,13 @@ var Form = ({
|
|
|
2094
2102
|
"form",
|
|
2095
2103
|
{
|
|
2096
2104
|
onSubmit: handleSubmit,
|
|
2097
|
-
className:
|
|
2098
|
-
style,
|
|
2105
|
+
className: "w-full",
|
|
2099
2106
|
children: /* @__PURE__ */ jsx("fieldset", { disabled: isSubmitted, className: "m-0 border-0 p-0", children: /* @__PURE__ */ jsx(
|
|
2100
2107
|
"div",
|
|
2101
2108
|
{
|
|
2102
2109
|
className: cn(
|
|
2103
|
-
"flex flex-col
|
|
2110
|
+
"flex flex-col transition-opacity",
|
|
2111
|
+
gapMap[gap],
|
|
2104
2112
|
isSubmitted && "opacity-60 pointer-events-none"
|
|
2105
2113
|
),
|
|
2106
2114
|
children
|
|
@@ -2109,6 +2117,165 @@ var Form = ({
|
|
|
2109
2117
|
}
|
|
2110
2118
|
);
|
|
2111
2119
|
};
|
|
2120
|
+
function DropdownMenu({ ...props }) {
|
|
2121
|
+
return /* @__PURE__ */ jsx(Menu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
2122
|
+
}
|
|
2123
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
2124
|
+
return /* @__PURE__ */ jsx(Menu.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
2125
|
+
}
|
|
2126
|
+
function DropdownMenuContent({
|
|
2127
|
+
align = "start",
|
|
2128
|
+
alignOffset = 0,
|
|
2129
|
+
side = "bottom",
|
|
2130
|
+
sideOffset = 4,
|
|
2131
|
+
className,
|
|
2132
|
+
...props
|
|
2133
|
+
}) {
|
|
2134
|
+
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(
|
|
2135
|
+
Menu.Positioner,
|
|
2136
|
+
{
|
|
2137
|
+
className: "isolate z-50 outline-none",
|
|
2138
|
+
align,
|
|
2139
|
+
alignOffset,
|
|
2140
|
+
side,
|
|
2141
|
+
sideOffset,
|
|
2142
|
+
children: /* @__PURE__ */ jsx(
|
|
2143
|
+
Menu.Popup,
|
|
2144
|
+
{
|
|
2145
|
+
"data-slot": "dropdown-menu-content",
|
|
2146
|
+
className: cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-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 ring-foreground/5 bg-popover text-popover-foreground min-w-48 rounded-2xl p-1 shadow-2xl ring-1 duration-100 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden", className),
|
|
2147
|
+
...props
|
|
2148
|
+
}
|
|
2149
|
+
)
|
|
2150
|
+
}
|
|
2151
|
+
) });
|
|
2152
|
+
}
|
|
2153
|
+
function DropdownMenuGroup({ ...props }) {
|
|
2154
|
+
return /* @__PURE__ */ jsx(Menu.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
2155
|
+
}
|
|
2156
|
+
function DropdownMenuLabel({
|
|
2157
|
+
className,
|
|
2158
|
+
inset,
|
|
2159
|
+
...props
|
|
2160
|
+
}) {
|
|
2161
|
+
return /* @__PURE__ */ jsx(
|
|
2162
|
+
Menu.GroupLabel,
|
|
2163
|
+
{
|
|
2164
|
+
"data-slot": "dropdown-menu-label",
|
|
2165
|
+
"data-inset": inset,
|
|
2166
|
+
className: cn("text-muted-foreground px-3 py-2.5 text-xs data-[inset]:pl-8", className),
|
|
2167
|
+
...props
|
|
2168
|
+
}
|
|
2169
|
+
);
|
|
2170
|
+
}
|
|
2171
|
+
function DropdownMenuItem({
|
|
2172
|
+
className,
|
|
2173
|
+
inset,
|
|
2174
|
+
variant = "default",
|
|
2175
|
+
...props
|
|
2176
|
+
}) {
|
|
2177
|
+
return /* @__PURE__ */ jsx(
|
|
2178
|
+
Menu.Item,
|
|
2179
|
+
{
|
|
2180
|
+
"data-slot": "dropdown-menu-item",
|
|
2181
|
+
"data-inset": inset,
|
|
2182
|
+
"data-variant": variant,
|
|
2183
|
+
className: cn(
|
|
2184
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-2.5 rounded-xl px-3 py-2 text-sm [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
2185
|
+
className
|
|
2186
|
+
),
|
|
2187
|
+
...props
|
|
2188
|
+
}
|
|
2189
|
+
);
|
|
2190
|
+
}
|
|
2191
|
+
function DropdownMenuCheckboxItem({
|
|
2192
|
+
className,
|
|
2193
|
+
children,
|
|
2194
|
+
checked,
|
|
2195
|
+
...props
|
|
2196
|
+
}) {
|
|
2197
|
+
return /* @__PURE__ */ jsxs(
|
|
2198
|
+
Menu.CheckboxItem,
|
|
2199
|
+
{
|
|
2200
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
2201
|
+
className: cn(
|
|
2202
|
+
"focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-2.5 rounded-xl py-2 pr-8 pl-3 text-sm [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
2203
|
+
className
|
|
2204
|
+
),
|
|
2205
|
+
checked,
|
|
2206
|
+
...props,
|
|
2207
|
+
children: [
|
|
2208
|
+
/* @__PURE__ */ jsx(
|
|
2209
|
+
"span",
|
|
2210
|
+
{
|
|
2211
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
|
|
2212
|
+
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
2213
|
+
children: /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(
|
|
2214
|
+
IconCheck,
|
|
2215
|
+
{}
|
|
2216
|
+
) })
|
|
2217
|
+
}
|
|
2218
|
+
),
|
|
2219
|
+
children
|
|
2220
|
+
]
|
|
2221
|
+
}
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
2224
|
+
function DropdownMenuSeparator({
|
|
2225
|
+
className,
|
|
2226
|
+
...props
|
|
2227
|
+
}) {
|
|
2228
|
+
return /* @__PURE__ */ jsx(
|
|
2229
|
+
Menu.Separator,
|
|
2230
|
+
{
|
|
2231
|
+
"data-slot": "dropdown-menu-separator",
|
|
2232
|
+
className: cn("bg-border/50 -mx-1 my-1 h-px", className),
|
|
2233
|
+
...props
|
|
2234
|
+
}
|
|
2235
|
+
);
|
|
2236
|
+
}
|
|
2237
|
+
var Dropdown = ({
|
|
2238
|
+
items = [],
|
|
2239
|
+
children
|
|
2240
|
+
}) => {
|
|
2241
|
+
const { sendEvent } = useMelony();
|
|
2242
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
2243
|
+
/* @__PURE__ */ jsx(
|
|
2244
|
+
DropdownMenuTrigger,
|
|
2245
|
+
{
|
|
2246
|
+
render: (props) => /* @__PURE__ */ jsx(
|
|
2247
|
+
Button,
|
|
2248
|
+
{
|
|
2249
|
+
variant: "ghost",
|
|
2250
|
+
size: "icon-xs",
|
|
2251
|
+
...props,
|
|
2252
|
+
onClick: (e) => {
|
|
2253
|
+
e.stopPropagation();
|
|
2254
|
+
props.onClick?.(e);
|
|
2255
|
+
},
|
|
2256
|
+
children: children || /* @__PURE__ */ jsx(IconDotsVertical, { className: "size-3.5" })
|
|
2257
|
+
}
|
|
2258
|
+
)
|
|
2259
|
+
}
|
|
2260
|
+
),
|
|
2261
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", className: cn("w-32"), children: items.map((item, i) => /* @__PURE__ */ jsxs(
|
|
2262
|
+
DropdownMenuItem,
|
|
2263
|
+
{
|
|
2264
|
+
onClick: (e) => {
|
|
2265
|
+
e.stopPropagation();
|
|
2266
|
+
if (item.onClickAction) {
|
|
2267
|
+
sendEvent(item.onClickAction);
|
|
2268
|
+
}
|
|
2269
|
+
},
|
|
2270
|
+
children: [
|
|
2271
|
+
item.icon && /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }),
|
|
2272
|
+
/* @__PURE__ */ jsx("span", { className: item.icon ? "ml-2" : "", children: item.label })
|
|
2273
|
+
]
|
|
2274
|
+
},
|
|
2275
|
+
`${item.label}-${i}`
|
|
2276
|
+
)) })
|
|
2277
|
+
] });
|
|
2278
|
+
};
|
|
2112
2279
|
function UIRenderer({ node }) {
|
|
2113
2280
|
const { type, props, children } = node;
|
|
2114
2281
|
const typeMap = {
|
|
@@ -2129,6 +2296,7 @@ function UIRenderer({ node }) {
|
|
|
2129
2296
|
spacer: Spacer,
|
|
2130
2297
|
divider: Divider,
|
|
2131
2298
|
box: Box,
|
|
2299
|
+
float: Float,
|
|
2132
2300
|
image: Image,
|
|
2133
2301
|
video: Video,
|
|
2134
2302
|
icon: Icon,
|
|
@@ -2137,7 +2305,8 @@ function UIRenderer({ node }) {
|
|
|
2137
2305
|
form: Form,
|
|
2138
2306
|
chart: Chart,
|
|
2139
2307
|
label: Label2,
|
|
2140
|
-
upload: Upload
|
|
2308
|
+
upload: Upload,
|
|
2309
|
+
dropdown: Dropdown
|
|
2141
2310
|
};
|
|
2142
2311
|
const Component = typeMap[type];
|
|
2143
2312
|
if (!Component) {
|
|
@@ -2148,8 +2317,7 @@ function UIRenderer({ node }) {
|
|
|
2148
2317
|
] });
|
|
2149
2318
|
}
|
|
2150
2319
|
const renderedChildren = children?.map((child, i) => /* @__PURE__ */ jsx(UIRenderer, { node: child }, i));
|
|
2151
|
-
|
|
2152
|
-
return /* @__PURE__ */ jsx(Component, { ...componentProps, children: renderedChildren });
|
|
2320
|
+
return /* @__PURE__ */ jsx(Component, { ...props, children: renderedChildren });
|
|
2153
2321
|
}
|
|
2154
2322
|
var MelonyContext = createContext(
|
|
2155
2323
|
void 0
|
|
@@ -2204,8 +2372,8 @@ var MelonyContextProviderInner = ({
|
|
|
2204
2372
|
window.history.replaceState(null, "", url);
|
|
2205
2373
|
} else {
|
|
2206
2374
|
window.history.pushState(null, "", url);
|
|
2207
|
-
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2208
2375
|
}
|
|
2376
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2209
2377
|
}
|
|
2210
2378
|
return true;
|
|
2211
2379
|
}
|
|
@@ -2321,123 +2489,6 @@ var useAuth = () => {
|
|
|
2321
2489
|
}
|
|
2322
2490
|
return context;
|
|
2323
2491
|
};
|
|
2324
|
-
function DropdownMenu({ ...props }) {
|
|
2325
|
-
return /* @__PURE__ */ jsx(Menu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
2326
|
-
}
|
|
2327
|
-
function DropdownMenuTrigger({ ...props }) {
|
|
2328
|
-
return /* @__PURE__ */ jsx(Menu.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
2329
|
-
}
|
|
2330
|
-
function DropdownMenuContent({
|
|
2331
|
-
align = "start",
|
|
2332
|
-
alignOffset = 0,
|
|
2333
|
-
side = "bottom",
|
|
2334
|
-
sideOffset = 4,
|
|
2335
|
-
className,
|
|
2336
|
-
...props
|
|
2337
|
-
}) {
|
|
2338
|
-
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(
|
|
2339
|
-
Menu.Positioner,
|
|
2340
|
-
{
|
|
2341
|
-
className: "isolate z-50 outline-none",
|
|
2342
|
-
align,
|
|
2343
|
-
alignOffset,
|
|
2344
|
-
side,
|
|
2345
|
-
sideOffset,
|
|
2346
|
-
children: /* @__PURE__ */ jsx(
|
|
2347
|
-
Menu.Popup,
|
|
2348
|
-
{
|
|
2349
|
-
"data-slot": "dropdown-menu-content",
|
|
2350
|
-
className: cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-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 ring-foreground/5 bg-popover text-popover-foreground min-w-48 rounded-2xl p-1 shadow-2xl ring-1 duration-100 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden", className),
|
|
2351
|
-
...props
|
|
2352
|
-
}
|
|
2353
|
-
)
|
|
2354
|
-
}
|
|
2355
|
-
) });
|
|
2356
|
-
}
|
|
2357
|
-
function DropdownMenuGroup({ ...props }) {
|
|
2358
|
-
return /* @__PURE__ */ jsx(Menu.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
2359
|
-
}
|
|
2360
|
-
function DropdownMenuLabel({
|
|
2361
|
-
className,
|
|
2362
|
-
inset,
|
|
2363
|
-
...props
|
|
2364
|
-
}) {
|
|
2365
|
-
return /* @__PURE__ */ jsx(
|
|
2366
|
-
Menu.GroupLabel,
|
|
2367
|
-
{
|
|
2368
|
-
"data-slot": "dropdown-menu-label",
|
|
2369
|
-
"data-inset": inset,
|
|
2370
|
-
className: cn("text-muted-foreground px-3 py-2.5 text-xs data-[inset]:pl-8", className),
|
|
2371
|
-
...props
|
|
2372
|
-
}
|
|
2373
|
-
);
|
|
2374
|
-
}
|
|
2375
|
-
function DropdownMenuItem({
|
|
2376
|
-
className,
|
|
2377
|
-
inset,
|
|
2378
|
-
variant = "default",
|
|
2379
|
-
...props
|
|
2380
|
-
}) {
|
|
2381
|
-
return /* @__PURE__ */ jsx(
|
|
2382
|
-
Menu.Item,
|
|
2383
|
-
{
|
|
2384
|
-
"data-slot": "dropdown-menu-item",
|
|
2385
|
-
"data-inset": inset,
|
|
2386
|
-
"data-variant": variant,
|
|
2387
|
-
className: cn(
|
|
2388
|
-
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-2.5 rounded-xl px-3 py-2 text-sm [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
2389
|
-
className
|
|
2390
|
-
),
|
|
2391
|
-
...props
|
|
2392
|
-
}
|
|
2393
|
-
);
|
|
2394
|
-
}
|
|
2395
|
-
function DropdownMenuCheckboxItem({
|
|
2396
|
-
className,
|
|
2397
|
-
children,
|
|
2398
|
-
checked,
|
|
2399
|
-
...props
|
|
2400
|
-
}) {
|
|
2401
|
-
return /* @__PURE__ */ jsxs(
|
|
2402
|
-
Menu.CheckboxItem,
|
|
2403
|
-
{
|
|
2404
|
-
"data-slot": "dropdown-menu-checkbox-item",
|
|
2405
|
-
className: cn(
|
|
2406
|
-
"focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-2.5 rounded-xl py-2 pr-8 pl-3 text-sm [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
2407
|
-
className
|
|
2408
|
-
),
|
|
2409
|
-
checked,
|
|
2410
|
-
...props,
|
|
2411
|
-
children: [
|
|
2412
|
-
/* @__PURE__ */ jsx(
|
|
2413
|
-
"span",
|
|
2414
|
-
{
|
|
2415
|
-
className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
|
|
2416
|
-
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
2417
|
-
children: /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(
|
|
2418
|
-
IconCheck,
|
|
2419
|
-
{}
|
|
2420
|
-
) })
|
|
2421
|
-
}
|
|
2422
|
-
),
|
|
2423
|
-
children
|
|
2424
|
-
]
|
|
2425
|
-
}
|
|
2426
|
-
);
|
|
2427
|
-
}
|
|
2428
|
-
function DropdownMenuSeparator({
|
|
2429
|
-
className,
|
|
2430
|
-
...props
|
|
2431
|
-
}) {
|
|
2432
|
-
return /* @__PURE__ */ jsx(
|
|
2433
|
-
Menu.Separator,
|
|
2434
|
-
{
|
|
2435
|
-
"data-slot": "dropdown-menu-separator",
|
|
2436
|
-
className: cn("bg-border/50 -mx-1 my-1 h-px", className),
|
|
2437
|
-
...props
|
|
2438
|
-
}
|
|
2439
|
-
);
|
|
2440
|
-
}
|
|
2441
2492
|
var AccountButton = ({
|
|
2442
2493
|
className,
|
|
2443
2494
|
variant = "outline",
|
|
@@ -3007,6 +3058,16 @@ var useThreads = () => {
|
|
|
3007
3058
|
}
|
|
3008
3059
|
return context;
|
|
3009
3060
|
};
|
|
3061
|
+
var useSurface = (options) => {
|
|
3062
|
+
const { events } = useMelony();
|
|
3063
|
+
const surfaceEvents = useMemo(() => {
|
|
3064
|
+
const filtered = events.filter((event) => event.surface === options.name);
|
|
3065
|
+
return filterEventsBySlots(filtered);
|
|
3066
|
+
}, [events, options.name]);
|
|
3067
|
+
return {
|
|
3068
|
+
events: surfaceEvents
|
|
3069
|
+
};
|
|
3070
|
+
};
|
|
3010
3071
|
function Composer({
|
|
3011
3072
|
value,
|
|
3012
3073
|
onChange,
|
|
@@ -3304,8 +3365,7 @@ function Composer({
|
|
|
3304
3365
|
] }) });
|
|
3305
3366
|
}
|
|
3306
3367
|
function StarterPrompts({
|
|
3307
|
-
prompts
|
|
3308
|
-
onPromptClick
|
|
3368
|
+
prompts
|
|
3309
3369
|
}) {
|
|
3310
3370
|
if (!prompts || prompts.length === 0) {
|
|
3311
3371
|
return null;
|
|
@@ -3323,32 +3383,15 @@ function StarterPrompts({
|
|
|
3323
3383
|
role: "user",
|
|
3324
3384
|
data: { content: item.prompt }
|
|
3325
3385
|
},
|
|
3326
|
-
|
|
3386
|
+
justify: "start"
|
|
3327
3387
|
},
|
|
3328
3388
|
index
|
|
3329
3389
|
)) })
|
|
3330
3390
|
] });
|
|
3331
3391
|
}
|
|
3332
3392
|
function MessageContent({ events }) {
|
|
3333
|
-
const
|
|
3334
|
-
|
|
3335
|
-
events.forEach((event, index) => {
|
|
3336
|
-
if (event.slot) {
|
|
3337
|
-
if (!firstSlotIndexes.has(event.slot)) {
|
|
3338
|
-
firstSlotIndexes.set(event.slot, index);
|
|
3339
|
-
}
|
|
3340
|
-
latestSlotIndexes.set(event.slot, index);
|
|
3341
|
-
}
|
|
3342
|
-
});
|
|
3343
|
-
return /* @__PURE__ */ jsx(Fragment, { children: events.map((event, index) => {
|
|
3344
|
-
let displayEvent = event;
|
|
3345
|
-
if (event.slot) {
|
|
3346
|
-
if (firstSlotIndexes.get(event.slot) !== index) {
|
|
3347
|
-
return null;
|
|
3348
|
-
}
|
|
3349
|
-
const latestIndex = latestSlotIndexes.get(event.slot);
|
|
3350
|
-
displayEvent = events[latestIndex];
|
|
3351
|
-
}
|
|
3393
|
+
const displayEvents = useMemo(() => filterEventsBySlots(events), [events]);
|
|
3394
|
+
return /* @__PURE__ */ jsx(Fragment, { children: displayEvents.map((displayEvent, index) => {
|
|
3352
3395
|
if (displayEvent.type === "text-delta") {
|
|
3353
3396
|
return /* @__PURE__ */ jsx("span", { children: displayEvent.data?.delta }, index);
|
|
3354
3397
|
}
|
|
@@ -3419,10 +3462,8 @@ function MessageList({
|
|
|
3419
3462
|
] });
|
|
3420
3463
|
}
|
|
3421
3464
|
function Thread({
|
|
3422
|
-
className,
|
|
3423
3465
|
placeholder = "Type a message...",
|
|
3424
3466
|
starterPrompts: localStarterPrompts,
|
|
3425
|
-
onStarterPromptClick,
|
|
3426
3467
|
options: localOptions,
|
|
3427
3468
|
autoFocus = false,
|
|
3428
3469
|
defaultSelectedIds
|
|
@@ -3438,9 +3479,14 @@ function Thread({
|
|
|
3438
3479
|
} = useMelony({
|
|
3439
3480
|
initialEvents: threadEvents
|
|
3440
3481
|
});
|
|
3441
|
-
const messages =
|
|
3442
|
-
(
|
|
3443
|
-
|
|
3482
|
+
const messages = useMemo(() => {
|
|
3483
|
+
return initialMessages.map((msg) => ({
|
|
3484
|
+
...msg,
|
|
3485
|
+
content: msg.content.filter((event) => !event.surface)
|
|
3486
|
+
})).filter(
|
|
3487
|
+
(msg) => ["user", "assistant"].includes(msg.role) && msg.content.length > 0
|
|
3488
|
+
);
|
|
3489
|
+
}, [initialMessages]);
|
|
3444
3490
|
const starterPrompts = localStarterPrompts ?? config?.starterPrompts;
|
|
3445
3491
|
const options = localOptions ?? config?.options;
|
|
3446
3492
|
const fileAttachments = config?.fileAttachments;
|
|
@@ -3473,18 +3519,11 @@ function Thread({
|
|
|
3473
3519
|
}
|
|
3474
3520
|
});
|
|
3475
3521
|
};
|
|
3476
|
-
const handleStarterPromptClick = (prompt) => {
|
|
3477
|
-
if (onStarterPromptClick) {
|
|
3478
|
-
onStarterPromptClick(prompt);
|
|
3479
|
-
} else {
|
|
3480
|
-
handleSubmit(void 0, prompt);
|
|
3481
|
-
}
|
|
3482
|
-
};
|
|
3483
3522
|
const showStarterPrompts = messages.length === 0 && starterPrompts && starterPrompts.length > 0 && !isLoadingEvents;
|
|
3484
3523
|
return /* @__PURE__ */ jsxs(
|
|
3485
3524
|
"div",
|
|
3486
3525
|
{
|
|
3487
|
-
className:
|
|
3526
|
+
className: "relative flex flex-col h-full bg-background flex-1 overflow-hidden",
|
|
3488
3527
|
children: [
|
|
3489
3528
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto p-4 pb-36", children: [
|
|
3490
3529
|
/* @__PURE__ */ jsx(
|
|
@@ -3498,8 +3537,7 @@ function Thread({
|
|
|
3498
3537
|
showStarterPrompts && /* @__PURE__ */ jsx(
|
|
3499
3538
|
StarterPrompts,
|
|
3500
3539
|
{
|
|
3501
|
-
prompts: starterPrompts
|
|
3502
|
-
onPromptClick: handleStarterPromptClick
|
|
3540
|
+
prompts: starterPrompts
|
|
3503
3541
|
}
|
|
3504
3542
|
),
|
|
3505
3543
|
/* @__PURE__ */ jsx(
|
|
@@ -3566,40 +3604,8 @@ function ChatHeader({
|
|
|
3566
3604
|
}
|
|
3567
3605
|
);
|
|
3568
3606
|
}
|
|
3569
|
-
var
|
|
3570
|
-
|
|
3571
|
-
trigger,
|
|
3572
|
-
triggerClassName,
|
|
3573
|
-
items
|
|
3574
|
-
}) => {
|
|
3575
|
-
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
3576
|
-
/* @__PURE__ */ jsx(
|
|
3577
|
-
DropdownMenuTrigger,
|
|
3578
|
-
{
|
|
3579
|
-
className: triggerClassName,
|
|
3580
|
-
render: (props) => /* @__PURE__ */ jsx(
|
|
3581
|
-
Button,
|
|
3582
|
-
{
|
|
3583
|
-
variant: "ghost",
|
|
3584
|
-
size: "icon-xs",
|
|
3585
|
-
...props,
|
|
3586
|
-
onClick: (e) => {
|
|
3587
|
-
e.stopPropagation();
|
|
3588
|
-
props.onClick?.(e);
|
|
3589
|
-
},
|
|
3590
|
-
children: trigger || /* @__PURE__ */ jsx(IconDotsVertical, { className: "size-3.5" })
|
|
3591
|
-
}
|
|
3592
|
-
)
|
|
3593
|
-
}
|
|
3594
|
-
),
|
|
3595
|
-
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", className: cn("w-32", className), children: items.map((item) => /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: item.onClick, children: [
|
|
3596
|
-
item.icon,
|
|
3597
|
-
/* @__PURE__ */ jsx("span", { children: item.label })
|
|
3598
|
-
] }, item.label)) })
|
|
3599
|
-
] });
|
|
3600
|
-
};
|
|
3601
|
-
var ThreadList = ({ className }) => {
|
|
3602
|
-
const { threads, activeThreadId, deleteThread } = useThreads();
|
|
3607
|
+
var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
3608
|
+
const { threads, activeThreadId } = useThreads();
|
|
3603
3609
|
const sortedThreads = React3.useMemo(() => {
|
|
3604
3610
|
return [...threads].sort((a, b) => {
|
|
3605
3611
|
const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
@@ -3607,15 +3613,8 @@ var ThreadList = ({ className }) => {
|
|
|
3607
3613
|
return dateB - dateA;
|
|
3608
3614
|
});
|
|
3609
3615
|
}, [threads]);
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
await deleteThread(threadId);
|
|
3613
|
-
} catch (error) {
|
|
3614
|
-
console.error("Failed to delete thread:", error);
|
|
3615
|
-
}
|
|
3616
|
-
};
|
|
3617
|
-
return /* @__PURE__ */ jsx(List, { className, children: sortedThreads.map((thread) => {
|
|
3618
|
-
const isActive = thread.id === activeThreadId;
|
|
3616
|
+
return /* @__PURE__ */ jsx(List, { padding, gap, flex: "1", overflow: "scroll", children: sortedThreads.map((thread) => {
|
|
3617
|
+
thread.id === activeThreadId;
|
|
3619
3618
|
return /* @__PURE__ */ jsxs(
|
|
3620
3619
|
ListItem,
|
|
3621
3620
|
{
|
|
@@ -3625,7 +3624,10 @@ var ThreadList = ({ className }) => {
|
|
|
3625
3624
|
url: `?threadId=${thread.id}`
|
|
3626
3625
|
}
|
|
3627
3626
|
},
|
|
3628
|
-
|
|
3627
|
+
background,
|
|
3628
|
+
radius,
|
|
3629
|
+
padding,
|
|
3630
|
+
gap,
|
|
3629
3631
|
children: [
|
|
3630
3632
|
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: thread.title || `Thread ${thread.id.slice(0, 8)}` }) }),
|
|
3631
3633
|
/* @__PURE__ */ jsx("div", { className: "shrink-0 flex items-center opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsx(
|
|
@@ -3634,8 +3636,14 @@ var ThreadList = ({ className }) => {
|
|
|
3634
3636
|
items: [
|
|
3635
3637
|
{
|
|
3636
3638
|
label: "Delete",
|
|
3637
|
-
icon:
|
|
3638
|
-
|
|
3639
|
+
icon: "trash",
|
|
3640
|
+
onClickAction: {
|
|
3641
|
+
role: "system",
|
|
3642
|
+
type: "delete-thread",
|
|
3643
|
+
data: {
|
|
3644
|
+
threadId: thread.id
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3639
3647
|
}
|
|
3640
3648
|
]
|
|
3641
3649
|
}
|
|
@@ -3725,13 +3733,15 @@ function PopupChat({
|
|
|
3725
3733
|
placeholder,
|
|
3726
3734
|
starterPrompts,
|
|
3727
3735
|
options,
|
|
3728
|
-
className: "h-full",
|
|
3729
3736
|
defaultSelectedIds
|
|
3730
3737
|
}
|
|
3731
3738
|
) : /* @__PURE__ */ jsx(
|
|
3732
3739
|
ThreadList,
|
|
3733
3740
|
{
|
|
3734
|
-
|
|
3741
|
+
padding: "md",
|
|
3742
|
+
gap: "md",
|
|
3743
|
+
background: "muted",
|
|
3744
|
+
radius: "md"
|
|
3735
3745
|
}
|
|
3736
3746
|
) })
|
|
3737
3747
|
] }),
|
|
@@ -3749,9 +3759,10 @@ function PopupChat({
|
|
|
3749
3759
|
)
|
|
3750
3760
|
] });
|
|
3751
3761
|
}
|
|
3752
|
-
function Sidebar({ side, children,
|
|
3762
|
+
function Sidebar({ side, children, width = "1/4" }) {
|
|
3753
3763
|
const { leftCollapsed, rightCollapsed } = useSidebar();
|
|
3754
3764
|
const collapsed = side === "left" ? leftCollapsed : rightCollapsed;
|
|
3765
|
+
const widthClass = widthMap[width];
|
|
3755
3766
|
return /* @__PURE__ */ jsx(
|
|
3756
3767
|
"div",
|
|
3757
3768
|
{
|
|
@@ -3759,8 +3770,9 @@ function Sidebar({ side, children, className }) {
|
|
|
3759
3770
|
"flex-shrink-0 border-border bg-background transition-all duration-300 ease-in-out overflow-hidden flex flex-col",
|
|
3760
3771
|
side === "left" ? "border-r" : "border-l",
|
|
3761
3772
|
collapsed ? "w-0 border-r-0 border-l-0 min-w-0" : "",
|
|
3762
|
-
!collapsed &&
|
|
3773
|
+
!collapsed && widthClass
|
|
3763
3774
|
),
|
|
3775
|
+
style: !collapsed && !widthClass ? { width } : void 0,
|
|
3764
3776
|
children: /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden min-h-0 flex flex-col", children })
|
|
3765
3777
|
}
|
|
3766
3778
|
);
|
|
@@ -3789,6 +3801,10 @@ function FullChat({
|
|
|
3789
3801
|
) }) })
|
|
3790
3802
|
] });
|
|
3791
3803
|
}
|
|
3804
|
+
function Surface({ name, children }) {
|
|
3805
|
+
const { events } = useSurface({ name });
|
|
3806
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children(events) });
|
|
3807
|
+
}
|
|
3792
3808
|
function SidebarToggle({ side, className }) {
|
|
3793
3809
|
const {
|
|
3794
3810
|
leftCollapsed,
|
|
@@ -3828,13 +3844,7 @@ function SidebarToggle({ side, className }) {
|
|
|
3828
3844
|
}
|
|
3829
3845
|
return null;
|
|
3830
3846
|
}
|
|
3831
|
-
var ThreadPopover = ({
|
|
3832
|
-
className,
|
|
3833
|
-
buttonClassName,
|
|
3834
|
-
buttonVariant = "ghost",
|
|
3835
|
-
buttonSize = "icon",
|
|
3836
|
-
emptyState
|
|
3837
|
-
}) => {
|
|
3847
|
+
var ThreadPopover = ({}) => {
|
|
3838
3848
|
const [isOpen, setIsOpen] = React3.useState(false);
|
|
3839
3849
|
useHotkeys(
|
|
3840
3850
|
"h",
|
|
@@ -3853,20 +3863,19 @@ var ThreadPopover = ({
|
|
|
3853
3863
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
3854
3864
|
Button,
|
|
3855
3865
|
{
|
|
3856
|
-
variant:
|
|
3857
|
-
size:
|
|
3858
|
-
className: cn(buttonClassName),
|
|
3866
|
+
variant: "ghost",
|
|
3867
|
+
size: "icon",
|
|
3859
3868
|
children: /* @__PURE__ */ jsx(IconHistory, { className: "size-4" })
|
|
3860
3869
|
}
|
|
3861
3870
|
) }),
|
|
3862
3871
|
/* @__PURE__ */ jsx(
|
|
3863
3872
|
PopoverContent,
|
|
3864
3873
|
{
|
|
3865
|
-
className:
|
|
3874
|
+
className: "w-80 p-0",
|
|
3866
3875
|
side: "bottom",
|
|
3867
3876
|
align: "start",
|
|
3868
3877
|
sideOffset: 8,
|
|
3869
|
-
children: /* @__PURE__ */ jsx("div", { className: "flex flex-col h-[400px]", children: /* @__PURE__ */ jsx(ThreadList, {
|
|
3878
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex flex-col h-[400px]", children: /* @__PURE__ */ jsx(ThreadList, {}) })
|
|
3870
3879
|
}
|
|
3871
3880
|
)
|
|
3872
3881
|
] });
|
|
@@ -3957,7 +3966,9 @@ function ThemeToggle() {
|
|
|
3957
3966
|
);
|
|
3958
3967
|
}
|
|
3959
3968
|
var CreateThreadListItem = ({
|
|
3960
|
-
|
|
3969
|
+
padding = "sm",
|
|
3970
|
+
background,
|
|
3971
|
+
radius = "md"
|
|
3961
3972
|
}) => {
|
|
3962
3973
|
const { createThread } = useThreads();
|
|
3963
3974
|
const [isCreating, setIsCreating] = React3.useState(false);
|
|
@@ -3994,7 +4005,9 @@ var CreateThreadListItem = ({
|
|
|
3994
4005
|
url: "?"
|
|
3995
4006
|
}
|
|
3996
4007
|
},
|
|
3997
|
-
|
|
4008
|
+
padding,
|
|
4009
|
+
background,
|
|
4010
|
+
radius,
|
|
3998
4011
|
children: [
|
|
3999
4012
|
/* @__PURE__ */ jsx(IconPlus, { className: "size-4" }),
|
|
4000
4013
|
"New chat"
|
|
@@ -4003,6 +4016,6 @@ var CreateThreadListItem = ({
|
|
|
4003
4016
|
);
|
|
4004
4017
|
};
|
|
4005
4018
|
|
|
4006
|
-
export { AccountButton, AuthContext, AuthProvider, Badge2 as Badge, Box, Button2 as Button, Card2 as Card, Chart, ChatHeader, Checkbox, Col, ColorPicker, Composer, CreateThreadButton, CreateThreadListItem, Divider, Dropdown, Form, FullChat, Heading, Hidden, Image, Input2 as Input, Label2 as Label, List, ListItem, MelonyContext, MelonyProvider, PopupChat, RadioGroup, Row, Select2 as Select, Sidebar, SidebarContext, SidebarProvider, SidebarToggle, Spacer, Text, Textarea2 as Textarea, ThemeProvider, ThemeToggle, Thread, ThreadContext, ThreadList, ThreadPopover, ThreadProvider, UIRenderer, Upload, WelcomeScreen, useAuth, useMelony, useScreenSize, useSidebar, useTheme, useThreads };
|
|
4019
|
+
export { AccountButton, AuthContext, AuthProvider, Badge2 as Badge, Box, Button2 as Button, Card2 as Card, Chart, ChatHeader, Checkbox, Col, ColorPicker, Composer, CreateThreadButton, CreateThreadListItem, Divider, Dropdown, Float, Form, FullChat, Heading, Hidden, Image, Input2 as Input, Label2 as Label, List, ListItem, MelonyContext, MelonyProvider, PopupChat, RadioGroup, Row, Select2 as Select, Sidebar, SidebarContext, SidebarProvider, SidebarToggle, Spacer, Surface, Text, Textarea2 as Textarea, ThemeProvider, ThemeToggle, Thread, ThreadContext, ThreadList, ThreadPopover, ThreadProvider, UIRenderer, Upload, WelcomeScreen, useAuth, useMelony, useScreenSize, useSidebar, useSurface, useTheme, useThreads };
|
|
4007
4020
|
//# sourceMappingURL=index.js.map
|
|
4008
4021
|
//# sourceMappingURL=index.js.map
|