@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.cjs
CHANGED
|
@@ -209,210 +209,295 @@ function CardContent({ className, ...props }) {
|
|
|
209
209
|
}
|
|
210
210
|
);
|
|
211
211
|
}
|
|
212
|
+
|
|
213
|
+
// src/lib/theme-utils.ts
|
|
214
|
+
var paddingMap = {
|
|
215
|
+
none: "p-0",
|
|
216
|
+
xs: "p-1",
|
|
217
|
+
sm: "p-2",
|
|
218
|
+
md: "p-4",
|
|
219
|
+
lg: "p-6",
|
|
220
|
+
xl: "p-8",
|
|
221
|
+
xxl: "p-12"
|
|
222
|
+
};
|
|
223
|
+
var marginMap = {
|
|
224
|
+
none: "m-0",
|
|
225
|
+
xs: "m-1",
|
|
226
|
+
sm: "m-2",
|
|
227
|
+
md: "m-4",
|
|
228
|
+
lg: "m-6",
|
|
229
|
+
xl: "m-8",
|
|
230
|
+
xxl: "m-12"
|
|
231
|
+
};
|
|
232
|
+
var gapMap = {
|
|
233
|
+
none: "gap-0",
|
|
234
|
+
xs: "gap-1",
|
|
235
|
+
sm: "gap-2",
|
|
236
|
+
md: "gap-4",
|
|
237
|
+
lg: "gap-6",
|
|
238
|
+
xl: "gap-8",
|
|
239
|
+
xxl: "gap-12"
|
|
240
|
+
};
|
|
241
|
+
var colorBgMap = {
|
|
242
|
+
primary: "bg-primary text-primary-foreground",
|
|
243
|
+
secondary: "bg-secondary text-secondary-foreground",
|
|
244
|
+
success: "bg-green-500 text-white",
|
|
245
|
+
danger: "bg-destructive text-destructive-foreground",
|
|
246
|
+
warning: "bg-yellow-500 text-white",
|
|
247
|
+
info: "bg-blue-500 text-white",
|
|
248
|
+
background: "bg-background text-foreground",
|
|
249
|
+
foreground: "bg-foreground text-background",
|
|
250
|
+
muted: "bg-muted text-muted-foreground",
|
|
251
|
+
mutedForeground: "bg-muted-foreground text-muted",
|
|
252
|
+
border: "bg-border",
|
|
253
|
+
transparent: "bg-transparent"
|
|
254
|
+
};
|
|
255
|
+
var colorTextMap = {
|
|
256
|
+
primary: "text-primary",
|
|
257
|
+
secondary: "text-secondary",
|
|
258
|
+
success: "text-green-600",
|
|
259
|
+
danger: "text-destructive",
|
|
260
|
+
warning: "text-yellow-600",
|
|
261
|
+
info: "text-blue-600",
|
|
262
|
+
background: "text-background",
|
|
263
|
+
foreground: "text-foreground",
|
|
264
|
+
muted: "text-muted-foreground",
|
|
265
|
+
mutedForeground: "text-muted-foreground",
|
|
266
|
+
border: "text-border",
|
|
267
|
+
transparent: "text-transparent"
|
|
268
|
+
};
|
|
269
|
+
var colorBorderMap = {
|
|
270
|
+
primary: "border-primary",
|
|
271
|
+
secondary: "border-secondary",
|
|
272
|
+
success: "border-green-500",
|
|
273
|
+
danger: "border-destructive",
|
|
274
|
+
warning: "border-yellow-500",
|
|
275
|
+
info: "border-blue-500",
|
|
276
|
+
background: "border-background",
|
|
277
|
+
foreground: "border-foreground",
|
|
278
|
+
muted: "border-muted",
|
|
279
|
+
mutedForeground: "border-muted-foreground",
|
|
280
|
+
border: "border-border",
|
|
281
|
+
transparent: "border-transparent"
|
|
282
|
+
};
|
|
283
|
+
var widthMap = {
|
|
284
|
+
auto: "w-auto",
|
|
285
|
+
full: "w-full",
|
|
286
|
+
min: "w-min",
|
|
287
|
+
max: "w-max",
|
|
288
|
+
"1/2": "w-1/2",
|
|
289
|
+
"1/3": "w-1/3",
|
|
290
|
+
"2/3": "w-2/3",
|
|
291
|
+
"1/4": "w-1/4",
|
|
292
|
+
"3/4": "w-3/4"
|
|
293
|
+
};
|
|
294
|
+
var shadowMap = {
|
|
295
|
+
none: "shadow-none",
|
|
296
|
+
sm: "shadow-sm",
|
|
297
|
+
md: "shadow-md",
|
|
298
|
+
lg: "shadow-lg",
|
|
299
|
+
xl: "shadow-xl"
|
|
300
|
+
};
|
|
301
|
+
var radiusMap = {
|
|
302
|
+
none: "rounded-none",
|
|
303
|
+
sm: "rounded-sm",
|
|
304
|
+
md: "rounded-md",
|
|
305
|
+
lg: "rounded-lg",
|
|
306
|
+
full: "rounded-full"
|
|
307
|
+
};
|
|
308
|
+
var alignMap = {
|
|
309
|
+
start: "items-start",
|
|
310
|
+
center: "items-center",
|
|
311
|
+
end: "items-end",
|
|
312
|
+
stretch: "items-stretch"
|
|
313
|
+
};
|
|
314
|
+
var justifyMap = {
|
|
315
|
+
start: "justify-start",
|
|
316
|
+
center: "justify-center",
|
|
317
|
+
end: "justify-end",
|
|
318
|
+
between: "justify-between",
|
|
319
|
+
around: "justify-around"
|
|
320
|
+
};
|
|
321
|
+
var wrapMap = {
|
|
322
|
+
nowrap: "flex-nowrap",
|
|
323
|
+
wrap: "flex-wrap",
|
|
324
|
+
"wrap-reverse": "flex-wrap-reverse"
|
|
325
|
+
};
|
|
326
|
+
var textSizeMap = {
|
|
327
|
+
none: "text-[0]",
|
|
328
|
+
xs: "text-xs",
|
|
329
|
+
sm: "text-sm",
|
|
330
|
+
md: "text-base",
|
|
331
|
+
lg: "text-lg",
|
|
332
|
+
xl: "text-xl",
|
|
333
|
+
xxl: "text-2xl"
|
|
334
|
+
};
|
|
335
|
+
var textAlignMap = {
|
|
336
|
+
start: "text-left",
|
|
337
|
+
center: "text-center",
|
|
338
|
+
end: "text-right",
|
|
339
|
+
stretch: "text-justify"
|
|
340
|
+
};
|
|
341
|
+
var fontWeightMap = {
|
|
342
|
+
normal: "font-normal",
|
|
343
|
+
medium: "font-medium",
|
|
344
|
+
semibold: "font-semibold",
|
|
345
|
+
bold: "font-bold"
|
|
346
|
+
};
|
|
212
347
|
var Card2 = ({
|
|
213
348
|
children,
|
|
214
349
|
title,
|
|
215
350
|
subtitle,
|
|
216
|
-
|
|
217
|
-
|
|
351
|
+
background,
|
|
352
|
+
padding = "md",
|
|
353
|
+
radius = "md",
|
|
354
|
+
shadow = "md"
|
|
218
355
|
}) => {
|
|
219
356
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
220
357
|
Card,
|
|
221
358
|
{
|
|
222
|
-
className: cn(
|
|
223
|
-
|
|
359
|
+
className: cn(
|
|
360
|
+
"min-w-96 relative",
|
|
361
|
+
background && colorBgMap[background],
|
|
362
|
+
radius && radiusMap[radius],
|
|
363
|
+
shadow && shadowMap[shadow]
|
|
364
|
+
),
|
|
224
365
|
children: [
|
|
225
366
|
(title || subtitle) && /* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { className: "pb-3", children: [
|
|
226
367
|
title && /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { className: "text-lg", children: title }),
|
|
227
368
|
subtitle && /* @__PURE__ */ jsxRuntime.jsx(CardDescription, { children: subtitle })
|
|
228
369
|
] }),
|
|
229
|
-
/* @__PURE__ */ jsxRuntime.jsx(CardContent, { className: "flex flex-col gap-4", children })
|
|
370
|
+
/* @__PURE__ */ jsxRuntime.jsx(CardContent, { className: cn("flex flex-col gap-4", paddingMap[padding]), children })
|
|
230
371
|
]
|
|
231
372
|
}
|
|
232
373
|
);
|
|
233
374
|
};
|
|
234
375
|
var Row = ({
|
|
235
376
|
children,
|
|
236
|
-
gap = "md",
|
|
237
377
|
align = "start",
|
|
238
378
|
justify = "start",
|
|
239
|
-
wrap =
|
|
240
|
-
|
|
241
|
-
|
|
379
|
+
wrap = "nowrap",
|
|
380
|
+
gap = "none",
|
|
381
|
+
padding = "none",
|
|
382
|
+
width = "full"
|
|
242
383
|
}) => {
|
|
243
|
-
const gapClasses = {
|
|
244
|
-
xs: "gap-0",
|
|
245
|
-
sm: "gap-1",
|
|
246
|
-
md: "gap-2",
|
|
247
|
-
lg: "gap-4",
|
|
248
|
-
xl: "gap-6"
|
|
249
|
-
};
|
|
250
|
-
const alignClasses = {
|
|
251
|
-
start: "items-start",
|
|
252
|
-
center: "items-center",
|
|
253
|
-
end: "items-end",
|
|
254
|
-
stretch: "items-stretch"
|
|
255
|
-
};
|
|
256
|
-
const justifyClasses = {
|
|
257
|
-
start: "justify-start",
|
|
258
|
-
center: "justify-center",
|
|
259
|
-
end: "justify-end",
|
|
260
|
-
between: "justify-between",
|
|
261
|
-
around: "justify-around"
|
|
262
|
-
};
|
|
263
384
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
264
385
|
"div",
|
|
265
386
|
{
|
|
266
387
|
className: cn(
|
|
267
|
-
"flex flex-row
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
388
|
+
"flex flex-row",
|
|
389
|
+
alignMap[align],
|
|
390
|
+
justifyMap[justify],
|
|
391
|
+
wrapMap[wrap],
|
|
392
|
+
gapMap[gap],
|
|
393
|
+
paddingMap[padding],
|
|
394
|
+
widthMap[width]
|
|
273
395
|
),
|
|
274
|
-
style,
|
|
275
396
|
children
|
|
276
397
|
}
|
|
277
398
|
);
|
|
278
399
|
};
|
|
279
400
|
var Col = ({
|
|
280
401
|
children,
|
|
281
|
-
gap = "sm",
|
|
282
402
|
align = "start",
|
|
283
403
|
justify = "start",
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
style
|
|
404
|
+
gap = "none",
|
|
405
|
+
width = "auto",
|
|
406
|
+
height = "auto",
|
|
407
|
+
padding = "none",
|
|
408
|
+
background,
|
|
409
|
+
radius
|
|
291
410
|
}) => {
|
|
292
|
-
const gapClasses = {
|
|
293
|
-
xs: "gap-1",
|
|
294
|
-
sm: "gap-2",
|
|
295
|
-
md: "gap-4",
|
|
296
|
-
lg: "gap-6",
|
|
297
|
-
xl: "gap-8"
|
|
298
|
-
};
|
|
299
|
-
const alignClasses = {
|
|
300
|
-
start: "items-start",
|
|
301
|
-
center: "items-center",
|
|
302
|
-
end: "items-end",
|
|
303
|
-
stretch: "items-stretch"
|
|
304
|
-
};
|
|
305
|
-
const justifyClasses = {
|
|
306
|
-
start: "justify-start",
|
|
307
|
-
center: "justify-center",
|
|
308
|
-
end: "justify-end",
|
|
309
|
-
between: "justify-between",
|
|
310
|
-
around: "justify-around"
|
|
311
|
-
};
|
|
312
|
-
const overflowClasses = {
|
|
313
|
-
auto: "overflow-auto",
|
|
314
|
-
hidden: "overflow-hidden",
|
|
315
|
-
scroll: "overflow-scroll",
|
|
316
|
-
visible: "overflow-visible"
|
|
317
|
-
};
|
|
318
|
-
const positionClasses = {
|
|
319
|
-
static: "static",
|
|
320
|
-
relative: "relative",
|
|
321
|
-
absolute: "absolute",
|
|
322
|
-
fixed: "fixed",
|
|
323
|
-
sticky: "sticky"
|
|
324
|
-
};
|
|
325
411
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
326
412
|
"div",
|
|
327
413
|
{
|
|
328
414
|
className: cn(
|
|
329
415
|
"flex flex-col",
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
416
|
+
alignMap[align],
|
|
417
|
+
justifyMap[justify],
|
|
418
|
+
gapMap[gap],
|
|
419
|
+
paddingMap[padding],
|
|
420
|
+
widthMap[width],
|
|
421
|
+
height === "full" && "h-full",
|
|
422
|
+
background && colorBgMap[background],
|
|
423
|
+
radius && radiusMap[radius]
|
|
336
424
|
),
|
|
337
|
-
style: {
|
|
338
|
-
width,
|
|
339
|
-
height,
|
|
340
|
-
padding,
|
|
341
|
-
...style
|
|
342
|
-
},
|
|
343
425
|
children
|
|
344
426
|
}
|
|
345
427
|
);
|
|
346
428
|
};
|
|
347
429
|
var Box = ({
|
|
348
430
|
children,
|
|
349
|
-
padding = "
|
|
350
|
-
margin,
|
|
431
|
+
padding = "none",
|
|
432
|
+
margin = "none",
|
|
351
433
|
background,
|
|
352
434
|
border = false,
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
style
|
|
435
|
+
borderColor = "border",
|
|
436
|
+
radius = "none",
|
|
437
|
+
width = "auto",
|
|
438
|
+
height = "auto",
|
|
439
|
+
shadow = "none"
|
|
359
440
|
}) => {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
441
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
442
|
+
"div",
|
|
443
|
+
{
|
|
444
|
+
className: cn(
|
|
445
|
+
"relative",
|
|
446
|
+
paddingMap[padding],
|
|
447
|
+
marginMap[margin],
|
|
448
|
+
background && colorBgMap[background],
|
|
449
|
+
border && "border",
|
|
450
|
+
border && colorBorderMap[borderColor],
|
|
451
|
+
radiusMap[radius],
|
|
452
|
+
widthMap[width],
|
|
453
|
+
height === "full" && "h-full",
|
|
454
|
+
shadowMap[shadow]
|
|
455
|
+
),
|
|
456
|
+
children
|
|
457
|
+
}
|
|
458
|
+
);
|
|
459
|
+
};
|
|
460
|
+
var Float = ({
|
|
461
|
+
children,
|
|
462
|
+
position = "top-right",
|
|
463
|
+
offsetX = "none",
|
|
464
|
+
offsetY = "none",
|
|
465
|
+
showOnHover = false
|
|
466
|
+
}) => {
|
|
467
|
+
const positionClasses = {
|
|
468
|
+
"top-left": "top-0 left-0",
|
|
469
|
+
"top-right": "top-0 right-0",
|
|
470
|
+
"bottom-left": "bottom-0 left-0",
|
|
471
|
+
"bottom-right": "bottom-0 right-0",
|
|
472
|
+
"center": "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
372
473
|
};
|
|
474
|
+
const marginXClass = position.endsWith("left") ? marginMap[offsetX].replace("m-", "ml-") : marginMap[offsetX].replace("m-", "mr-");
|
|
475
|
+
const marginYClass = position.startsWith("top") ? marginMap[offsetY].replace("m-", "mt-") : marginMap[offsetY].replace("m-", "mb-");
|
|
373
476
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
374
477
|
"div",
|
|
375
478
|
{
|
|
376
479
|
className: cn(
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
480
|
+
"absolute z-10",
|
|
481
|
+
positionClasses[position],
|
|
482
|
+
marginXClass,
|
|
483
|
+
marginYClass,
|
|
484
|
+
showOnHover && "opacity-0 group-hover:opacity-100 transition-opacity"
|
|
381
485
|
),
|
|
382
|
-
style: {
|
|
383
|
-
margin,
|
|
384
|
-
background: background ?? void 0,
|
|
385
|
-
borderRadius,
|
|
386
|
-
width,
|
|
387
|
-
height,
|
|
388
|
-
...style
|
|
389
|
-
},
|
|
390
486
|
children
|
|
391
487
|
}
|
|
392
488
|
);
|
|
393
489
|
};
|
|
394
490
|
var Spacer = ({
|
|
395
491
|
size = "md",
|
|
396
|
-
direction = "vertical"
|
|
397
|
-
className,
|
|
398
|
-
style
|
|
492
|
+
direction = "vertical"
|
|
399
493
|
}) => {
|
|
400
|
-
const sizeClasses = {
|
|
401
|
-
xs: "p-0.5",
|
|
402
|
-
sm: "p-1",
|
|
403
|
-
md: "p-2",
|
|
404
|
-
lg: "p-4",
|
|
405
|
-
xl: "p-8"
|
|
406
|
-
};
|
|
407
494
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
408
495
|
"div",
|
|
409
496
|
{
|
|
410
497
|
className: cn(
|
|
411
498
|
direction === "vertical" ? "w-full" : "h-full",
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
),
|
|
415
|
-
style
|
|
499
|
+
paddingMap[size]
|
|
500
|
+
)
|
|
416
501
|
}
|
|
417
502
|
);
|
|
418
503
|
};
|
|
@@ -436,27 +521,30 @@ function Separator({
|
|
|
436
521
|
}
|
|
437
522
|
var Divider = ({
|
|
438
523
|
orientation = "horizontal",
|
|
439
|
-
|
|
440
|
-
|
|
524
|
+
color = "border",
|
|
525
|
+
margin = "md"
|
|
441
526
|
}) => {
|
|
442
527
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
443
528
|
Separator,
|
|
444
529
|
{
|
|
445
530
|
orientation,
|
|
446
|
-
className: cn(
|
|
447
|
-
|
|
531
|
+
className: cn(
|
|
532
|
+
marginMap[margin],
|
|
533
|
+
colorBgMap[color]
|
|
534
|
+
)
|
|
448
535
|
}
|
|
449
536
|
);
|
|
450
537
|
};
|
|
451
|
-
var List = ({ children,
|
|
538
|
+
var List = ({ children, padding = "none", gap = "none", flex, overflow }) => {
|
|
452
539
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
453
540
|
"div",
|
|
454
541
|
{
|
|
455
|
-
className: cn(
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
542
|
+
className: cn(
|
|
543
|
+
"flex flex-col list-none m-0",
|
|
544
|
+
paddingMap[padding],
|
|
545
|
+
gapMap[gap]
|
|
546
|
+
),
|
|
547
|
+
style: { flex, overflow },
|
|
460
548
|
children
|
|
461
549
|
}
|
|
462
550
|
);
|
|
@@ -470,6 +558,9 @@ var useMelony = (options) => {
|
|
|
470
558
|
const { initialEvents } = options || {};
|
|
471
559
|
const prevInitialEventsRef = React3.useRef(void 0);
|
|
472
560
|
React3.useEffect(() => {
|
|
561
|
+
if (initialEvents && initialEvents === client.getState().events) {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
473
564
|
const currentSerialized = initialEvents ? JSON.stringify(initialEvents) : void 0;
|
|
474
565
|
if (currentSerialized !== prevInitialEventsRef.current) {
|
|
475
566
|
if (initialEvents) {
|
|
@@ -484,46 +575,15 @@ var useMelony = (options) => {
|
|
|
484
575
|
};
|
|
485
576
|
var ListItem = ({
|
|
486
577
|
children,
|
|
487
|
-
orientation = "horizontal",
|
|
488
|
-
gap = "md",
|
|
489
|
-
align,
|
|
490
|
-
justify = "start",
|
|
491
578
|
onClickAction,
|
|
492
|
-
|
|
493
|
-
padding = "
|
|
494
|
-
|
|
495
|
-
|
|
579
|
+
gap = "sm",
|
|
580
|
+
padding = "sm",
|
|
581
|
+
background,
|
|
582
|
+
radius = "md",
|
|
583
|
+
align = "center"
|
|
496
584
|
}) => {
|
|
497
585
|
const { sendEvent } = useMelony();
|
|
498
|
-
const paddingClasses = {
|
|
499
|
-
xs: "px-1.5 py-1",
|
|
500
|
-
sm: "px-2 py-1.5",
|
|
501
|
-
md: "px-3 py-1.5",
|
|
502
|
-
lg: "px-4 py-3",
|
|
503
|
-
xl: "px-6 py-4"
|
|
504
|
-
};
|
|
505
586
|
const isInteractive = !!onClickAction;
|
|
506
|
-
const gapClasses = {
|
|
507
|
-
xs: "gap-1",
|
|
508
|
-
sm: "gap-2",
|
|
509
|
-
md: "gap-3",
|
|
510
|
-
lg: "gap-4",
|
|
511
|
-
xl: "gap-6"
|
|
512
|
-
};
|
|
513
|
-
const resolvedAlign = align ?? (orientation === "vertical" ? "start" : "center");
|
|
514
|
-
const alignClasses = {
|
|
515
|
-
start: "items-start",
|
|
516
|
-
center: "items-center",
|
|
517
|
-
end: "items-end",
|
|
518
|
-
stretch: "items-stretch"
|
|
519
|
-
};
|
|
520
|
-
const justifyClasses = {
|
|
521
|
-
start: "justify-start",
|
|
522
|
-
center: "justify-center",
|
|
523
|
-
end: "justify-end",
|
|
524
|
-
between: "justify-between",
|
|
525
|
-
around: "justify-around"
|
|
526
|
-
};
|
|
527
587
|
const handleClick = () => {
|
|
528
588
|
if (onClickAction) {
|
|
529
589
|
sendEvent(onClickAction);
|
|
@@ -534,29 +594,23 @@ var ListItem = ({
|
|
|
534
594
|
{
|
|
535
595
|
onClick: isInteractive ? handleClick : void 0,
|
|
536
596
|
className: cn(
|
|
537
|
-
"flex
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
paddingClasses[padding] || "px-3 py-2",
|
|
543
|
-
isInteractive ? "cursor-pointer hover:bg-muted" : "cursor-default",
|
|
544
|
-
className
|
|
597
|
+
"flex flex-row transition-colors text-sm",
|
|
598
|
+
paddingMap[padding],
|
|
599
|
+
background ? colorBgMap[background] : isInteractive && "hover:bg-muted",
|
|
600
|
+
radiusMap[radius],
|
|
601
|
+
isInteractive ? "cursor-pointer" : "cursor-default"
|
|
545
602
|
),
|
|
546
|
-
|
|
547
|
-
width,
|
|
548
|
-
...style
|
|
549
|
-
},
|
|
550
|
-
children
|
|
603
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Row, { align, gap, children })
|
|
551
604
|
}
|
|
552
605
|
);
|
|
553
606
|
};
|
|
554
607
|
var Image = ({
|
|
555
608
|
src,
|
|
556
609
|
alt,
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
610
|
+
width = "auto",
|
|
611
|
+
height,
|
|
612
|
+
radius = "md",
|
|
613
|
+
objectFit = "cover"
|
|
560
614
|
}) => {
|
|
561
615
|
const [hasError, setHasError] = React3.useState(false);
|
|
562
616
|
const [isLoading, setIsLoading] = React3.useState(true);
|
|
@@ -587,11 +641,6 @@ var Image = ({
|
|
|
587
641
|
};
|
|
588
642
|
const currentImage = gallery[currentIndex] || { src, alt };
|
|
589
643
|
const hasMultiple = gallery.length > 1;
|
|
590
|
-
const sizes = {
|
|
591
|
-
sm: "h-11",
|
|
592
|
-
md: "h-22",
|
|
593
|
-
lg: "h-44"
|
|
594
|
-
};
|
|
595
644
|
const handleError = () => {
|
|
596
645
|
setHasError(true);
|
|
597
646
|
setIsLoading(false);
|
|
@@ -604,11 +653,11 @@ var Image = ({
|
|
|
604
653
|
"div",
|
|
605
654
|
{
|
|
606
655
|
className: cn(
|
|
607
|
-
"flex items-center justify-center
|
|
608
|
-
|
|
609
|
-
|
|
656
|
+
"flex items-center justify-center bg-muted text-muted-foreground",
|
|
657
|
+
widthMap[width],
|
|
658
|
+
radiusMap[radius]
|
|
610
659
|
),
|
|
611
|
-
style,
|
|
660
|
+
style: { height: height || "100px" },
|
|
612
661
|
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px]", children: "Error" })
|
|
613
662
|
}
|
|
614
663
|
);
|
|
@@ -619,10 +668,11 @@ var Image = ({
|
|
|
619
668
|
{
|
|
620
669
|
ref: triggerRef,
|
|
621
670
|
className: cn(
|
|
622
|
-
"relative overflow-hidden
|
|
623
|
-
|
|
671
|
+
"relative overflow-hidden cursor-pointer",
|
|
672
|
+
widthMap[width],
|
|
673
|
+
radiusMap[radius]
|
|
624
674
|
),
|
|
625
|
-
style,
|
|
675
|
+
style: { height },
|
|
626
676
|
children: [
|
|
627
677
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
628
678
|
"img",
|
|
@@ -632,9 +682,10 @@ var Image = ({
|
|
|
632
682
|
onError: handleError,
|
|
633
683
|
onLoad: handleLoad,
|
|
634
684
|
className: cn(
|
|
635
|
-
"block
|
|
685
|
+
"block w-full transition-opacity duration-200 hover:opacity-90",
|
|
636
686
|
isLoading ? "opacity-0" : "opacity-100",
|
|
637
|
-
|
|
687
|
+
objectFit === "cover" ? "object-cover" : objectFit === "contain" ? "object-contain" : "object-fill",
|
|
688
|
+
height ? "h-full" : "h-auto"
|
|
638
689
|
)
|
|
639
690
|
}
|
|
640
691
|
),
|
|
@@ -699,9 +750,8 @@ var Video = ({
|
|
|
699
750
|
loop = false,
|
|
700
751
|
muted = false,
|
|
701
752
|
aspectRatio = "16/9",
|
|
702
|
-
width = "
|
|
703
|
-
|
|
704
|
-
style
|
|
753
|
+
width = "full",
|
|
754
|
+
radius = "lg"
|
|
705
755
|
}) => {
|
|
706
756
|
const aspectRatios = {
|
|
707
757
|
"16/9": "aspect-video",
|
|
@@ -713,14 +763,11 @@ var Video = ({
|
|
|
713
763
|
"div",
|
|
714
764
|
{
|
|
715
765
|
className: cn(
|
|
716
|
-
"relative overflow-hidden
|
|
766
|
+
"relative overflow-hidden bg-black shadow-sm",
|
|
717
767
|
aspectRatios[aspectRatio] || "aspect-video",
|
|
718
|
-
|
|
768
|
+
widthMap[width],
|
|
769
|
+
radiusMap[radius]
|
|
719
770
|
),
|
|
720
|
-
style: {
|
|
721
|
-
width: typeof width === "number" ? `${width}px` : width,
|
|
722
|
-
...style
|
|
723
|
-
},
|
|
724
771
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
725
772
|
"video",
|
|
726
773
|
{
|
|
@@ -739,37 +786,24 @@ var Video = ({
|
|
|
739
786
|
};
|
|
740
787
|
var Icon = ({
|
|
741
788
|
name,
|
|
742
|
-
size,
|
|
743
|
-
color
|
|
744
|
-
className,
|
|
745
|
-
style
|
|
789
|
+
size = "md",
|
|
790
|
+
color = "foreground"
|
|
746
791
|
}) => {
|
|
747
792
|
const IconComponent = ICONS__namespace[name];
|
|
748
793
|
if (!IconComponent) return null;
|
|
749
794
|
const sizeMap = {
|
|
750
|
-
xs: 12,
|
|
751
795
|
sm: 16,
|
|
752
796
|
md: 20,
|
|
753
|
-
lg: 24
|
|
754
|
-
xl: 28,
|
|
755
|
-
xxl: 32
|
|
797
|
+
lg: 24
|
|
756
798
|
};
|
|
757
|
-
const resolvedSize = typeof size === "
|
|
758
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
759
|
-
|
|
799
|
+
const resolvedSize = typeof size === "number" ? size : sizeMap[size] || 20;
|
|
800
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("inline-flex items-center justify-center", colorTextMap[color]), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
801
|
+
IconComponent,
|
|
760
802
|
{
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
764
|
-
IconComponent,
|
|
765
|
-
{
|
|
766
|
-
size: resolvedSize,
|
|
767
|
-
color: color || "currentColor",
|
|
768
|
-
strokeWidth: 1.5
|
|
769
|
-
}
|
|
770
|
-
)
|
|
803
|
+
size: resolvedSize,
|
|
804
|
+
strokeWidth: 1.5
|
|
771
805
|
}
|
|
772
|
-
);
|
|
806
|
+
) });
|
|
773
807
|
};
|
|
774
808
|
var badgeVariants = classVarianceAuthority.cva(
|
|
775
809
|
"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",
|
|
@@ -813,24 +847,26 @@ function Badge({
|
|
|
813
847
|
var Badge2 = ({
|
|
814
848
|
label,
|
|
815
849
|
variant = "primary",
|
|
816
|
-
|
|
817
|
-
style
|
|
850
|
+
size = "md"
|
|
818
851
|
}) => {
|
|
819
852
|
const variantMap = {
|
|
820
853
|
primary: "default",
|
|
821
854
|
secondary: "secondary",
|
|
822
855
|
danger: "destructive",
|
|
823
856
|
success: "default",
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
857
|
+
warning: "secondary",
|
|
858
|
+
outline: "outline"
|
|
859
|
+
};
|
|
860
|
+
const sizeClasses = {
|
|
861
|
+
sm: "text-[10px] px-1.5 py-0",
|
|
862
|
+
md: "text-xs px-2.5 py-0.5",
|
|
863
|
+
lg: "text-sm px-3 py-1"
|
|
827
864
|
};
|
|
828
865
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
829
866
|
Badge,
|
|
830
867
|
{
|
|
831
868
|
variant: variantMap[variant] || "default",
|
|
832
|
-
className,
|
|
833
|
-
style,
|
|
869
|
+
className: sizeClasses[size],
|
|
834
870
|
children: label
|
|
835
871
|
}
|
|
836
872
|
);
|
|
@@ -838,21 +874,20 @@ var Badge2 = ({
|
|
|
838
874
|
var Chart = ({
|
|
839
875
|
data,
|
|
840
876
|
chartType = "bar",
|
|
841
|
-
|
|
877
|
+
title,
|
|
878
|
+
height = 250,
|
|
842
879
|
showValues = false,
|
|
843
880
|
showGrid = false,
|
|
844
|
-
showTooltips = true
|
|
845
|
-
className,
|
|
846
|
-
style
|
|
881
|
+
showTooltips = true
|
|
847
882
|
}) => {
|
|
848
883
|
const [tooltip, setTooltip] = React3.useState(null);
|
|
849
884
|
if (!Array.isArray(data)) {
|
|
850
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-destructive border border-destructive/20 rounded-md bg-destructive/5", children: "Error: Chart data must be an array" });
|
|
885
|
+
return /* @__PURE__ */ jsxRuntime.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" });
|
|
851
886
|
}
|
|
852
887
|
const maxValue = Math.max(...data.map((d) => d.value), 1);
|
|
853
888
|
const padding = { top: 40, right: 20, bottom: 40, left: 20 };
|
|
854
|
-
const
|
|
855
|
-
const
|
|
889
|
+
const chartHeight = height;
|
|
890
|
+
const chartWidth = 600;
|
|
856
891
|
const defaultColors = [
|
|
857
892
|
"hsl(var(--primary))",
|
|
858
893
|
"hsl(var(--chart-1, 217 91% 60%))",
|
|
@@ -925,7 +960,7 @@ var Chart = ({
|
|
|
925
960
|
const totalBarSpace = chartWidth - padding.left - padding.right;
|
|
926
961
|
const barSpacing = data.length > 1 ? totalBarSpace * 0.1 / data.length : 0;
|
|
927
962
|
const actualBarWidth = (totalBarSpace - barSpacing * (data.length + 1)) / data.length;
|
|
928
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("svg", {
|
|
963
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: `0 0 ${chartWidth} ${chartHeight + padding.bottom}`, className: "w-full h-auto overflow-visible", children: [
|
|
929
964
|
renderGrid(),
|
|
930
965
|
data.map((item, index) => {
|
|
931
966
|
const barHeight = item.value / maxValue * chartHeight;
|
|
@@ -968,7 +1003,7 @@ var Chart = ({
|
|
|
968
1003
|
...item
|
|
969
1004
|
}));
|
|
970
1005
|
const pathData = points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
971
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("svg", {
|
|
1006
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: `0 0 ${chartWidth} ${chartHeight + padding.bottom}`, className: "w-full h-auto overflow-visible", children: [
|
|
972
1007
|
renderGrid(),
|
|
973
1008
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: pathData, fill: "none", stroke: getColor(0), strokeWidth: 3, className: "transition-all" }),
|
|
974
1009
|
points.map((point, index) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
@@ -1009,46 +1044,27 @@ var Chart = ({
|
|
|
1009
1044
|
return renderBarChart();
|
|
1010
1045
|
}
|
|
1011
1046
|
};
|
|
1012
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1047
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-4 w-full", children: [
|
|
1048
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold mb-4 text-center", children: title }),
|
|
1049
|
+
renderChart()
|
|
1050
|
+
] });
|
|
1013
1051
|
};
|
|
1014
1052
|
var Text = ({
|
|
1015
1053
|
value,
|
|
1016
1054
|
size = "md",
|
|
1017
1055
|
weight = "normal",
|
|
1018
1056
|
align = "start",
|
|
1019
|
-
|
|
1020
|
-
style
|
|
1057
|
+
color = "foreground"
|
|
1021
1058
|
}) => {
|
|
1022
|
-
const sizeClasses = {
|
|
1023
|
-
xs: "text-xs",
|
|
1024
|
-
sm: "text-sm",
|
|
1025
|
-
md: "text-base",
|
|
1026
|
-
lg: "text-lg",
|
|
1027
|
-
xl: "text-xl"
|
|
1028
|
-
};
|
|
1029
|
-
const weightClasses = {
|
|
1030
|
-
light: "font-light",
|
|
1031
|
-
normal: "font-normal",
|
|
1032
|
-
medium: "font-medium",
|
|
1033
|
-
semibold: "font-semibold",
|
|
1034
|
-
bold: "font-bold"
|
|
1035
|
-
};
|
|
1036
|
-
const alignClasses = {
|
|
1037
|
-
start: "text-left",
|
|
1038
|
-
center: "text-center",
|
|
1039
|
-
end: "text-right",
|
|
1040
|
-
stretch: "text-justify"
|
|
1041
|
-
};
|
|
1042
1059
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1043
1060
|
"span",
|
|
1044
1061
|
{
|
|
1045
1062
|
className: cn(
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1063
|
+
textSizeMap[size],
|
|
1064
|
+
fontWeightMap[weight],
|
|
1065
|
+
textAlignMap[align],
|
|
1066
|
+
colorTextMap[color]
|
|
1050
1067
|
),
|
|
1051
|
-
style,
|
|
1052
1068
|
children: value
|
|
1053
1069
|
}
|
|
1054
1070
|
);
|
|
@@ -1056,8 +1072,8 @@ var Text = ({
|
|
|
1056
1072
|
var Heading = ({
|
|
1057
1073
|
value,
|
|
1058
1074
|
level = 2,
|
|
1059
|
-
|
|
1060
|
-
|
|
1075
|
+
color = "foreground",
|
|
1076
|
+
align = "start"
|
|
1061
1077
|
}) => {
|
|
1062
1078
|
const Tag = `h${level}`;
|
|
1063
1079
|
const levelClasses = {
|
|
@@ -1073,10 +1089,9 @@ var Heading = ({
|
|
|
1073
1089
|
{
|
|
1074
1090
|
className: cn(
|
|
1075
1091
|
levelClasses[Tag] || levelClasses.h2,
|
|
1076
|
-
|
|
1077
|
-
|
|
1092
|
+
colorTextMap[color],
|
|
1093
|
+
textAlignMap[align]
|
|
1078
1094
|
),
|
|
1079
|
-
style,
|
|
1080
1095
|
children: value
|
|
1081
1096
|
}
|
|
1082
1097
|
);
|
|
@@ -1153,13 +1168,12 @@ var Input2 = ({
|
|
|
1153
1168
|
inputType = "text",
|
|
1154
1169
|
placeholder,
|
|
1155
1170
|
defaultValue,
|
|
1156
|
-
value,
|
|
1157
1171
|
label,
|
|
1158
1172
|
name,
|
|
1159
1173
|
disabled,
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1174
|
+
required,
|
|
1175
|
+
width = "full",
|
|
1176
|
+
onChangeAction
|
|
1163
1177
|
}) => {
|
|
1164
1178
|
const { sendEvent } = useMelony();
|
|
1165
1179
|
const handleChange = (e) => {
|
|
@@ -1173,8 +1187,11 @@ var Input2 = ({
|
|
|
1173
1187
|
});
|
|
1174
1188
|
}
|
|
1175
1189
|
};
|
|
1176
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Field, { className: cn(
|
|
1177
|
-
label && /* @__PURE__ */ jsxRuntime.
|
|
1190
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Field, { className: cn(widthMap[width]), children: [
|
|
1191
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(FieldTitle, { children: [
|
|
1192
|
+
label,
|
|
1193
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
1194
|
+
] }),
|
|
1178
1195
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1179
1196
|
Input,
|
|
1180
1197
|
{
|
|
@@ -1183,9 +1200,9 @@ var Input2 = ({
|
|
|
1183
1200
|
id: name,
|
|
1184
1201
|
placeholder,
|
|
1185
1202
|
defaultValue,
|
|
1186
|
-
value,
|
|
1187
1203
|
disabled,
|
|
1188
|
-
onChange: handleChange
|
|
1204
|
+
onChange: handleChange,
|
|
1205
|
+
required
|
|
1189
1206
|
}
|
|
1190
1207
|
)
|
|
1191
1208
|
] });
|
|
@@ -1206,14 +1223,13 @@ function Textarea({ className, ...props }) {
|
|
|
1206
1223
|
var Textarea2 = ({
|
|
1207
1224
|
placeholder,
|
|
1208
1225
|
defaultValue,
|
|
1209
|
-
value,
|
|
1210
1226
|
label,
|
|
1211
1227
|
name,
|
|
1212
1228
|
disabled,
|
|
1213
1229
|
rows,
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1230
|
+
required,
|
|
1231
|
+
width = "full",
|
|
1232
|
+
onChangeAction
|
|
1217
1233
|
}) => {
|
|
1218
1234
|
const { sendEvent } = useMelony();
|
|
1219
1235
|
const handleChange = (e) => {
|
|
@@ -1227,8 +1243,11 @@ var Textarea2 = ({
|
|
|
1227
1243
|
});
|
|
1228
1244
|
}
|
|
1229
1245
|
};
|
|
1230
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Field, { className: cn(
|
|
1231
|
-
label && /* @__PURE__ */ jsxRuntime.
|
|
1246
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Field, { className: cn(widthMap[width]), children: [
|
|
1247
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(FieldTitle, { children: [
|
|
1248
|
+
label,
|
|
1249
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
1250
|
+
] }),
|
|
1232
1251
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1233
1252
|
Textarea,
|
|
1234
1253
|
{
|
|
@@ -1236,10 +1255,10 @@ var Textarea2 = ({
|
|
|
1236
1255
|
id: name,
|
|
1237
1256
|
placeholder,
|
|
1238
1257
|
defaultValue,
|
|
1239
|
-
value,
|
|
1240
1258
|
disabled,
|
|
1241
1259
|
rows,
|
|
1242
|
-
onChange: handleChange
|
|
1260
|
+
onChange: handleChange,
|
|
1261
|
+
required
|
|
1243
1262
|
}
|
|
1244
1263
|
)
|
|
1245
1264
|
] });
|
|
@@ -1382,14 +1401,13 @@ function SelectScrollDownButton({
|
|
|
1382
1401
|
var Select2 = ({
|
|
1383
1402
|
options,
|
|
1384
1403
|
defaultValue,
|
|
1385
|
-
value,
|
|
1386
1404
|
label,
|
|
1387
1405
|
name,
|
|
1388
1406
|
disabled,
|
|
1407
|
+
required,
|
|
1408
|
+
width = "full",
|
|
1389
1409
|
placeholder,
|
|
1390
|
-
onChangeAction
|
|
1391
|
-
className,
|
|
1392
|
-
style
|
|
1410
|
+
onChangeAction
|
|
1393
1411
|
}) => {
|
|
1394
1412
|
const { sendEvent } = useMelony();
|
|
1395
1413
|
const handleValueChange = (val) => {
|
|
@@ -1403,15 +1421,18 @@ var Select2 = ({
|
|
|
1403
1421
|
});
|
|
1404
1422
|
}
|
|
1405
1423
|
};
|
|
1406
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Field, { className: cn(
|
|
1407
|
-
label && /* @__PURE__ */ jsxRuntime.
|
|
1424
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Field, { className: cn(widthMap[width]), children: [
|
|
1425
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(FieldTitle, { children: [
|
|
1426
|
+
label,
|
|
1427
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
1428
|
+
] }),
|
|
1408
1429
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1409
1430
|
Select,
|
|
1410
1431
|
{
|
|
1411
1432
|
defaultValue,
|
|
1412
|
-
value,
|
|
1413
1433
|
disabled,
|
|
1414
|
-
onValueChange: (
|
|
1434
|
+
onValueChange: (value) => handleValueChange(value || ""),
|
|
1435
|
+
required,
|
|
1415
1436
|
children: [
|
|
1416
1437
|
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
1417
1438
|
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
@@ -1424,15 +1445,18 @@ var Label2 = ({
|
|
|
1424
1445
|
value,
|
|
1425
1446
|
htmlFor,
|
|
1426
1447
|
required,
|
|
1427
|
-
|
|
1428
|
-
|
|
1448
|
+
size = "md",
|
|
1449
|
+
color = "foreground"
|
|
1429
1450
|
}) => {
|
|
1430
1451
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1431
1452
|
Label,
|
|
1432
1453
|
{
|
|
1433
1454
|
htmlFor,
|
|
1434
|
-
className: cn(
|
|
1435
|
-
|
|
1455
|
+
className: cn(
|
|
1456
|
+
"flex items-center gap-1",
|
|
1457
|
+
textSizeMap[size],
|
|
1458
|
+
colorTextMap[color]
|
|
1459
|
+
),
|
|
1436
1460
|
children: [
|
|
1437
1461
|
value,
|
|
1438
1462
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
|
|
@@ -1444,11 +1468,8 @@ var Checkbox = ({
|
|
|
1444
1468
|
label,
|
|
1445
1469
|
name,
|
|
1446
1470
|
checked,
|
|
1447
|
-
defaultChecked,
|
|
1448
1471
|
disabled,
|
|
1449
|
-
onChangeAction
|
|
1450
|
-
className,
|
|
1451
|
-
style
|
|
1472
|
+
onChangeAction
|
|
1452
1473
|
}) => {
|
|
1453
1474
|
const { sendEvent } = useMelony();
|
|
1454
1475
|
const handleChange = (e) => {
|
|
@@ -1462,7 +1483,7 @@ var Checkbox = ({
|
|
|
1462
1483
|
});
|
|
1463
1484
|
}
|
|
1464
1485
|
};
|
|
1465
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
1486
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1466
1487
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1467
1488
|
"input",
|
|
1468
1489
|
{
|
|
@@ -1470,7 +1491,6 @@ var Checkbox = ({
|
|
|
1470
1491
|
name,
|
|
1471
1492
|
id: name,
|
|
1472
1493
|
checked,
|
|
1473
|
-
defaultChecked,
|
|
1474
1494
|
disabled,
|
|
1475
1495
|
onChange: handleChange,
|
|
1476
1496
|
className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50"
|
|
@@ -1481,10 +1501,8 @@ var Checkbox = ({
|
|
|
1481
1501
|
{
|
|
1482
1502
|
htmlFor: name,
|
|
1483
1503
|
value: label,
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
disabled && "cursor-not-allowed opacity-50"
|
|
1487
|
-
)
|
|
1504
|
+
color: disabled ? "muted" : "foreground",
|
|
1505
|
+
size: "sm"
|
|
1488
1506
|
}
|
|
1489
1507
|
)
|
|
1490
1508
|
] });
|
|
@@ -1719,19 +1737,11 @@ var ColorPicker = ({
|
|
|
1719
1737
|
name,
|
|
1720
1738
|
label,
|
|
1721
1739
|
defaultValue = "#000000",
|
|
1722
|
-
value: controlledValue,
|
|
1723
1740
|
onChangeAction,
|
|
1724
|
-
disabled
|
|
1725
|
-
className,
|
|
1726
|
-
style
|
|
1741
|
+
disabled
|
|
1727
1742
|
}) => {
|
|
1728
1743
|
const { sendEvent } = useMelony();
|
|
1729
|
-
const [color, setColor] = React3.useState(
|
|
1730
|
-
React3.useEffect(() => {
|
|
1731
|
-
if (controlledValue !== void 0) {
|
|
1732
|
-
setColor(controlledValue);
|
|
1733
|
-
}
|
|
1734
|
-
}, [controlledValue]);
|
|
1744
|
+
const [color, setColor] = React3.useState(defaultValue);
|
|
1735
1745
|
const handleColorChange = (newColor) => {
|
|
1736
1746
|
setColor(newColor);
|
|
1737
1747
|
if (onChangeAction) {
|
|
@@ -1744,7 +1754,7 @@ var ColorPicker = ({
|
|
|
1744
1754
|
});
|
|
1745
1755
|
}
|
|
1746
1756
|
};
|
|
1747
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Field, { className:
|
|
1757
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Field, { className: "w-full", children: [
|
|
1748
1758
|
label && /* @__PURE__ */ jsxRuntime.jsx(FieldTitle, { children: label }),
|
|
1749
1759
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1750
1760
|
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
|
|
@@ -1811,13 +1821,10 @@ var RadioGroup = ({
|
|
|
1811
1821
|
name,
|
|
1812
1822
|
options,
|
|
1813
1823
|
defaultValue,
|
|
1814
|
-
value,
|
|
1815
1824
|
label,
|
|
1816
1825
|
disabled,
|
|
1817
1826
|
orientation = "vertical",
|
|
1818
|
-
onChangeAction
|
|
1819
|
-
className,
|
|
1820
|
-
style
|
|
1827
|
+
onChangeAction
|
|
1821
1828
|
}) => {
|
|
1822
1829
|
const { sendEvent } = useMelony();
|
|
1823
1830
|
const handleChange = (e) => {
|
|
@@ -1831,8 +1838,8 @@ var RadioGroup = ({
|
|
|
1831
1838
|
});
|
|
1832
1839
|
}
|
|
1833
1840
|
};
|
|
1834
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
1835
|
-
label && /* @__PURE__ */ jsxRuntime.jsx(Label2, { value: label
|
|
1841
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
1842
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(Label2, { value: label }),
|
|
1836
1843
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1837
1844
|
"div",
|
|
1838
1845
|
{
|
|
@@ -1855,8 +1862,7 @@ var RadioGroup = ({
|
|
|
1855
1862
|
name,
|
|
1856
1863
|
id: radioId,
|
|
1857
1864
|
value: option.value,
|
|
1858
|
-
defaultChecked: defaultValue === option.value
|
|
1859
|
-
checked: value === option.value,
|
|
1865
|
+
defaultChecked: defaultValue === option.value,
|
|
1860
1866
|
disabled: isDisabled,
|
|
1861
1867
|
onChange: handleChange,
|
|
1862
1868
|
className: "h-4 w-4 border-gray-300 text-primary focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50"
|
|
@@ -1867,10 +1873,8 @@ var RadioGroup = ({
|
|
|
1867
1873
|
{
|
|
1868
1874
|
htmlFor: radioId,
|
|
1869
1875
|
value: option.label,
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
isDisabled && "cursor-not-allowed opacity-50"
|
|
1873
|
-
)
|
|
1876
|
+
size: "sm",
|
|
1877
|
+
color: isDisabled ? "muted" : "foreground"
|
|
1874
1878
|
}
|
|
1875
1879
|
)
|
|
1876
1880
|
]
|
|
@@ -1927,26 +1931,34 @@ function Button({
|
|
|
1927
1931
|
);
|
|
1928
1932
|
}
|
|
1929
1933
|
var Button2 = ({
|
|
1930
|
-
type,
|
|
1934
|
+
type = "button",
|
|
1931
1935
|
label,
|
|
1932
1936
|
variant = "primary",
|
|
1933
|
-
size = "
|
|
1937
|
+
size = "md",
|
|
1934
1938
|
disabled = false,
|
|
1935
|
-
|
|
1939
|
+
width,
|
|
1936
1940
|
onClickAction,
|
|
1937
|
-
|
|
1938
|
-
style
|
|
1941
|
+
justify = "center"
|
|
1939
1942
|
}) => {
|
|
1940
1943
|
const { sendEvent } = useMelony();
|
|
1941
1944
|
const variantMap = {
|
|
1942
1945
|
primary: "default",
|
|
1943
1946
|
secondary: "secondary",
|
|
1944
1947
|
danger: "destructive",
|
|
1948
|
+
success: "default",
|
|
1949
|
+
// We might want a custom success style later
|
|
1945
1950
|
outline: "outline",
|
|
1946
1951
|
ghost: "ghost",
|
|
1947
|
-
link: "link"
|
|
1948
|
-
|
|
1949
|
-
|
|
1952
|
+
link: "link"
|
|
1953
|
+
};
|
|
1954
|
+
const widthMap2 = {
|
|
1955
|
+
full: "w-full",
|
|
1956
|
+
auto: "w-auto",
|
|
1957
|
+
"1/2": "w-1/2",
|
|
1958
|
+
"1/3": "w-1/3",
|
|
1959
|
+
"2/3": "w-2/3",
|
|
1960
|
+
"1/4": "w-1/4",
|
|
1961
|
+
"3/4": "w-3/4"
|
|
1950
1962
|
};
|
|
1951
1963
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1952
1964
|
Button,
|
|
@@ -1955,8 +1967,7 @@ var Button2 = ({
|
|
|
1955
1967
|
variant: variantMap[variant] || "default",
|
|
1956
1968
|
size: size === "md" ? "default" : size,
|
|
1957
1969
|
disabled,
|
|
1958
|
-
className: cn(
|
|
1959
|
-
style,
|
|
1970
|
+
className: cn(width && widthMap2[width], justifyMap[justify]),
|
|
1960
1971
|
onClick: () => {
|
|
1961
1972
|
if (onClickAction) {
|
|
1962
1973
|
sendEvent(onClickAction);
|
|
@@ -1971,10 +1982,9 @@ var Upload = ({
|
|
|
1971
1982
|
multiple = false,
|
|
1972
1983
|
accept,
|
|
1973
1984
|
onUploadAction,
|
|
1974
|
-
className,
|
|
1975
|
-
style,
|
|
1976
1985
|
initialFiles,
|
|
1977
|
-
mode = "append"
|
|
1986
|
+
mode = "append",
|
|
1987
|
+
disabled
|
|
1978
1988
|
}) => {
|
|
1979
1989
|
const { sendEvent, events } = useMelony();
|
|
1980
1990
|
const fileInputRef = React3.useRef(null);
|
|
@@ -2044,7 +2054,7 @@ var Upload = ({
|
|
|
2044
2054
|
}
|
|
2045
2055
|
}
|
|
2046
2056
|
};
|
|
2047
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
2057
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative inline-block", children: [
|
|
2048
2058
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2049
2059
|
"input",
|
|
2050
2060
|
{
|
|
@@ -2054,11 +2064,11 @@ var Upload = ({
|
|
|
2054
2064
|
multiple,
|
|
2055
2065
|
accept,
|
|
2056
2066
|
className: "hidden",
|
|
2057
|
-
disabled: isUploading
|
|
2067
|
+
disabled: isUploading || disabled
|
|
2058
2068
|
}
|
|
2059
2069
|
),
|
|
2060
2070
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2 mb-2 items-center", children: [
|
|
2061
|
-
showInitialFiles && initialFiles?.map((file, index) => /* @__PURE__ */ jsxRuntime.jsx(Image, { src: file.url, alt: file.name,
|
|
2071
|
+
showInitialFiles && initialFiles?.map((file, index) => /* @__PURE__ */ jsxRuntime.jsx(Image, { src: file.url, alt: file.name, width: "min", radius: "md" }, index)),
|
|
2062
2072
|
displayEvents.map(
|
|
2063
2073
|
(event, index) => event.ui ? /* @__PURE__ */ jsxRuntime.jsx(UIRenderer, { node: event.ui }, index) : null
|
|
2064
2074
|
),
|
|
@@ -2066,12 +2076,11 @@ var Upload = ({
|
|
|
2066
2076
|
Button,
|
|
2067
2077
|
{
|
|
2068
2078
|
type: "button",
|
|
2069
|
-
disabled: isUploading,
|
|
2079
|
+
disabled: isUploading || disabled,
|
|
2070
2080
|
onClick: () => fileInputRef.current?.click(),
|
|
2071
|
-
|
|
2072
|
-
variant: status === "error" ? "destructive" : status === "success" ? "outline" : "default",
|
|
2081
|
+
variant: "default",
|
|
2073
2082
|
children: [
|
|
2074
|
-
isUploading ? /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconLoader2, { className: "h-4 w-4 animate-spin" }) : status === "success" ? /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconCheck, { className: "h-4 w-4 text-green-500" }) : status === "error" ? /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconX, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconUpload, { className: "h-4 w-4" }),
|
|
2083
|
+
isUploading ? /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconLoader2, { className: "h-4 w-4 animate-spin mr-2" }) : status === "success" ? /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconCheck, { className: "h-4 w-4 text-green-500 mr-2" }) : status === "error" ? /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconX, { className: "h-4 w-4 mr-2" }) : /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconUpload, { className: "h-4 w-4 mr-2" }),
|
|
2075
2084
|
status === "success" ? "Uploaded" : status === "error" ? "Failed" : label
|
|
2076
2085
|
]
|
|
2077
2086
|
}
|
|
@@ -2082,8 +2091,7 @@ var Upload = ({
|
|
|
2082
2091
|
var Form = ({
|
|
2083
2092
|
children,
|
|
2084
2093
|
onSubmitAction,
|
|
2085
|
-
|
|
2086
|
-
style
|
|
2094
|
+
gap = "md"
|
|
2087
2095
|
}) => {
|
|
2088
2096
|
const { sendEvent } = useMelony();
|
|
2089
2097
|
const [isSubmitted, setIsSubmitted] = React3.useState(false);
|
|
@@ -2097,7 +2105,7 @@ var Form = ({
|
|
|
2097
2105
|
});
|
|
2098
2106
|
if (onSubmitAction) {
|
|
2099
2107
|
setIsSubmitted(true);
|
|
2100
|
-
if ("type" in onSubmitAction) {
|
|
2108
|
+
if (typeof onSubmitAction === "object" && "type" in onSubmitAction) {
|
|
2101
2109
|
sendEvent({
|
|
2102
2110
|
...onSubmitAction,
|
|
2103
2111
|
data: {
|
|
@@ -2105,7 +2113,7 @@ var Form = ({
|
|
|
2105
2113
|
...data
|
|
2106
2114
|
}
|
|
2107
2115
|
});
|
|
2108
|
-
} else {
|
|
2116
|
+
} else if (typeof onSubmitAction === "function") {
|
|
2109
2117
|
sendEvent(onSubmitAction(data));
|
|
2110
2118
|
}
|
|
2111
2119
|
}
|
|
@@ -2114,13 +2122,13 @@ var Form = ({
|
|
|
2114
2122
|
"form",
|
|
2115
2123
|
{
|
|
2116
2124
|
onSubmit: handleSubmit,
|
|
2117
|
-
className:
|
|
2118
|
-
style,
|
|
2125
|
+
className: "w-full",
|
|
2119
2126
|
children: /* @__PURE__ */ jsxRuntime.jsx("fieldset", { disabled: isSubmitted, className: "m-0 border-0 p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2120
2127
|
"div",
|
|
2121
2128
|
{
|
|
2122
2129
|
className: cn(
|
|
2123
|
-
"flex flex-col
|
|
2130
|
+
"flex flex-col transition-opacity",
|
|
2131
|
+
gapMap[gap],
|
|
2124
2132
|
isSubmitted && "opacity-60 pointer-events-none"
|
|
2125
2133
|
),
|
|
2126
2134
|
children
|
|
@@ -2129,6 +2137,165 @@ var Form = ({
|
|
|
2129
2137
|
}
|
|
2130
2138
|
);
|
|
2131
2139
|
};
|
|
2140
|
+
function DropdownMenu({ ...props }) {
|
|
2141
|
+
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
2142
|
+
}
|
|
2143
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
2144
|
+
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
2145
|
+
}
|
|
2146
|
+
function DropdownMenuContent({
|
|
2147
|
+
align = "start",
|
|
2148
|
+
alignOffset = 0,
|
|
2149
|
+
side = "bottom",
|
|
2150
|
+
sideOffset = 4,
|
|
2151
|
+
className,
|
|
2152
|
+
...props
|
|
2153
|
+
}) {
|
|
2154
|
+
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2155
|
+
menu.Menu.Positioner,
|
|
2156
|
+
{
|
|
2157
|
+
className: "isolate z-50 outline-none",
|
|
2158
|
+
align,
|
|
2159
|
+
alignOffset,
|
|
2160
|
+
side,
|
|
2161
|
+
sideOffset,
|
|
2162
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2163
|
+
menu.Menu.Popup,
|
|
2164
|
+
{
|
|
2165
|
+
"data-slot": "dropdown-menu-content",
|
|
2166
|
+
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),
|
|
2167
|
+
...props
|
|
2168
|
+
}
|
|
2169
|
+
)
|
|
2170
|
+
}
|
|
2171
|
+
) });
|
|
2172
|
+
}
|
|
2173
|
+
function DropdownMenuGroup({ ...props }) {
|
|
2174
|
+
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
2175
|
+
}
|
|
2176
|
+
function DropdownMenuLabel({
|
|
2177
|
+
className,
|
|
2178
|
+
inset,
|
|
2179
|
+
...props
|
|
2180
|
+
}) {
|
|
2181
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2182
|
+
menu.Menu.GroupLabel,
|
|
2183
|
+
{
|
|
2184
|
+
"data-slot": "dropdown-menu-label",
|
|
2185
|
+
"data-inset": inset,
|
|
2186
|
+
className: cn("text-muted-foreground px-3 py-2.5 text-xs data-[inset]:pl-8", className),
|
|
2187
|
+
...props
|
|
2188
|
+
}
|
|
2189
|
+
);
|
|
2190
|
+
}
|
|
2191
|
+
function DropdownMenuItem({
|
|
2192
|
+
className,
|
|
2193
|
+
inset,
|
|
2194
|
+
variant = "default",
|
|
2195
|
+
...props
|
|
2196
|
+
}) {
|
|
2197
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2198
|
+
menu.Menu.Item,
|
|
2199
|
+
{
|
|
2200
|
+
"data-slot": "dropdown-menu-item",
|
|
2201
|
+
"data-inset": inset,
|
|
2202
|
+
"data-variant": variant,
|
|
2203
|
+
className: cn(
|
|
2204
|
+
"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",
|
|
2205
|
+
className
|
|
2206
|
+
),
|
|
2207
|
+
...props
|
|
2208
|
+
}
|
|
2209
|
+
);
|
|
2210
|
+
}
|
|
2211
|
+
function DropdownMenuCheckboxItem({
|
|
2212
|
+
className,
|
|
2213
|
+
children,
|
|
2214
|
+
checked,
|
|
2215
|
+
...props
|
|
2216
|
+
}) {
|
|
2217
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2218
|
+
menu.Menu.CheckboxItem,
|
|
2219
|
+
{
|
|
2220
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
2221
|
+
className: cn(
|
|
2222
|
+
"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",
|
|
2223
|
+
className
|
|
2224
|
+
),
|
|
2225
|
+
checked,
|
|
2226
|
+
...props,
|
|
2227
|
+
children: [
|
|
2228
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2229
|
+
"span",
|
|
2230
|
+
{
|
|
2231
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
|
|
2232
|
+
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
2233
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2234
|
+
ICONS.IconCheck,
|
|
2235
|
+
{}
|
|
2236
|
+
) })
|
|
2237
|
+
}
|
|
2238
|
+
),
|
|
2239
|
+
children
|
|
2240
|
+
]
|
|
2241
|
+
}
|
|
2242
|
+
);
|
|
2243
|
+
}
|
|
2244
|
+
function DropdownMenuSeparator({
|
|
2245
|
+
className,
|
|
2246
|
+
...props
|
|
2247
|
+
}) {
|
|
2248
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2249
|
+
menu.Menu.Separator,
|
|
2250
|
+
{
|
|
2251
|
+
"data-slot": "dropdown-menu-separator",
|
|
2252
|
+
className: cn("bg-border/50 -mx-1 my-1 h-px", className),
|
|
2253
|
+
...props
|
|
2254
|
+
}
|
|
2255
|
+
);
|
|
2256
|
+
}
|
|
2257
|
+
var Dropdown = ({
|
|
2258
|
+
items = [],
|
|
2259
|
+
children
|
|
2260
|
+
}) => {
|
|
2261
|
+
const { sendEvent } = useMelony();
|
|
2262
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
2263
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2264
|
+
DropdownMenuTrigger,
|
|
2265
|
+
{
|
|
2266
|
+
render: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2267
|
+
Button,
|
|
2268
|
+
{
|
|
2269
|
+
variant: "ghost",
|
|
2270
|
+
size: "icon-xs",
|
|
2271
|
+
...props,
|
|
2272
|
+
onClick: (e) => {
|
|
2273
|
+
e.stopPropagation();
|
|
2274
|
+
props.onClick?.(e);
|
|
2275
|
+
},
|
|
2276
|
+
children: children || /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconDotsVertical, { className: "size-3.5" })
|
|
2277
|
+
}
|
|
2278
|
+
)
|
|
2279
|
+
}
|
|
2280
|
+
),
|
|
2281
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent, { align: "start", className: cn("w-32"), children: items.map((item, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2282
|
+
DropdownMenuItem,
|
|
2283
|
+
{
|
|
2284
|
+
onClick: (e) => {
|
|
2285
|
+
e.stopPropagation();
|
|
2286
|
+
if (item.onClickAction) {
|
|
2287
|
+
sendEvent(item.onClickAction);
|
|
2288
|
+
}
|
|
2289
|
+
},
|
|
2290
|
+
children: [
|
|
2291
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: item.icon, size: "sm" }),
|
|
2292
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: item.icon ? "ml-2" : "", children: item.label })
|
|
2293
|
+
]
|
|
2294
|
+
},
|
|
2295
|
+
`${item.label}-${i}`
|
|
2296
|
+
)) })
|
|
2297
|
+
] });
|
|
2298
|
+
};
|
|
2132
2299
|
function UIRenderer({ node }) {
|
|
2133
2300
|
const { type, props, children } = node;
|
|
2134
2301
|
const typeMap = {
|
|
@@ -2149,6 +2316,7 @@ function UIRenderer({ node }) {
|
|
|
2149
2316
|
spacer: Spacer,
|
|
2150
2317
|
divider: Divider,
|
|
2151
2318
|
box: Box,
|
|
2319
|
+
float: Float,
|
|
2152
2320
|
image: Image,
|
|
2153
2321
|
video: Video,
|
|
2154
2322
|
icon: Icon,
|
|
@@ -2157,7 +2325,8 @@ function UIRenderer({ node }) {
|
|
|
2157
2325
|
form: Form,
|
|
2158
2326
|
chart: Chart,
|
|
2159
2327
|
label: Label2,
|
|
2160
|
-
upload: Upload
|
|
2328
|
+
upload: Upload,
|
|
2329
|
+
dropdown: Dropdown
|
|
2161
2330
|
};
|
|
2162
2331
|
const Component = typeMap[type];
|
|
2163
2332
|
if (!Component) {
|
|
@@ -2168,8 +2337,7 @@ function UIRenderer({ node }) {
|
|
|
2168
2337
|
] });
|
|
2169
2338
|
}
|
|
2170
2339
|
const renderedChildren = children?.map((child, i) => /* @__PURE__ */ jsxRuntime.jsx(UIRenderer, { node: child }, i));
|
|
2171
|
-
|
|
2172
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...componentProps, children: renderedChildren });
|
|
2340
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props, children: renderedChildren });
|
|
2173
2341
|
}
|
|
2174
2342
|
var MelonyContext = React3.createContext(
|
|
2175
2343
|
void 0
|
|
@@ -2224,8 +2392,8 @@ var MelonyContextProviderInner = ({
|
|
|
2224
2392
|
window.history.replaceState(null, "", url);
|
|
2225
2393
|
} else {
|
|
2226
2394
|
window.history.pushState(null, "", url);
|
|
2227
|
-
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2228
2395
|
}
|
|
2396
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2229
2397
|
}
|
|
2230
2398
|
return true;
|
|
2231
2399
|
}
|
|
@@ -2341,123 +2509,6 @@ var useAuth = () => {
|
|
|
2341
2509
|
}
|
|
2342
2510
|
return context;
|
|
2343
2511
|
};
|
|
2344
|
-
function DropdownMenu({ ...props }) {
|
|
2345
|
-
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
2346
|
-
}
|
|
2347
|
-
function DropdownMenuTrigger({ ...props }) {
|
|
2348
|
-
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
2349
|
-
}
|
|
2350
|
-
function DropdownMenuContent({
|
|
2351
|
-
align = "start",
|
|
2352
|
-
alignOffset = 0,
|
|
2353
|
-
side = "bottom",
|
|
2354
|
-
sideOffset = 4,
|
|
2355
|
-
className,
|
|
2356
|
-
...props
|
|
2357
|
-
}) {
|
|
2358
|
-
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2359
|
-
menu.Menu.Positioner,
|
|
2360
|
-
{
|
|
2361
|
-
className: "isolate z-50 outline-none",
|
|
2362
|
-
align,
|
|
2363
|
-
alignOffset,
|
|
2364
|
-
side,
|
|
2365
|
-
sideOffset,
|
|
2366
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2367
|
-
menu.Menu.Popup,
|
|
2368
|
-
{
|
|
2369
|
-
"data-slot": "dropdown-menu-content",
|
|
2370
|
-
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),
|
|
2371
|
-
...props
|
|
2372
|
-
}
|
|
2373
|
-
)
|
|
2374
|
-
}
|
|
2375
|
-
) });
|
|
2376
|
-
}
|
|
2377
|
-
function DropdownMenuGroup({ ...props }) {
|
|
2378
|
-
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
2379
|
-
}
|
|
2380
|
-
function DropdownMenuLabel({
|
|
2381
|
-
className,
|
|
2382
|
-
inset,
|
|
2383
|
-
...props
|
|
2384
|
-
}) {
|
|
2385
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2386
|
-
menu.Menu.GroupLabel,
|
|
2387
|
-
{
|
|
2388
|
-
"data-slot": "dropdown-menu-label",
|
|
2389
|
-
"data-inset": inset,
|
|
2390
|
-
className: cn("text-muted-foreground px-3 py-2.5 text-xs data-[inset]:pl-8", className),
|
|
2391
|
-
...props
|
|
2392
|
-
}
|
|
2393
|
-
);
|
|
2394
|
-
}
|
|
2395
|
-
function DropdownMenuItem({
|
|
2396
|
-
className,
|
|
2397
|
-
inset,
|
|
2398
|
-
variant = "default",
|
|
2399
|
-
...props
|
|
2400
|
-
}) {
|
|
2401
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2402
|
-
menu.Menu.Item,
|
|
2403
|
-
{
|
|
2404
|
-
"data-slot": "dropdown-menu-item",
|
|
2405
|
-
"data-inset": inset,
|
|
2406
|
-
"data-variant": variant,
|
|
2407
|
-
className: cn(
|
|
2408
|
-
"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",
|
|
2409
|
-
className
|
|
2410
|
-
),
|
|
2411
|
-
...props
|
|
2412
|
-
}
|
|
2413
|
-
);
|
|
2414
|
-
}
|
|
2415
|
-
function DropdownMenuCheckboxItem({
|
|
2416
|
-
className,
|
|
2417
|
-
children,
|
|
2418
|
-
checked,
|
|
2419
|
-
...props
|
|
2420
|
-
}) {
|
|
2421
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2422
|
-
menu.Menu.CheckboxItem,
|
|
2423
|
-
{
|
|
2424
|
-
"data-slot": "dropdown-menu-checkbox-item",
|
|
2425
|
-
className: cn(
|
|
2426
|
-
"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",
|
|
2427
|
-
className
|
|
2428
|
-
),
|
|
2429
|
-
checked,
|
|
2430
|
-
...props,
|
|
2431
|
-
children: [
|
|
2432
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2433
|
-
"span",
|
|
2434
|
-
{
|
|
2435
|
-
className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
|
|
2436
|
-
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
2437
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2438
|
-
ICONS.IconCheck,
|
|
2439
|
-
{}
|
|
2440
|
-
) })
|
|
2441
|
-
}
|
|
2442
|
-
),
|
|
2443
|
-
children
|
|
2444
|
-
]
|
|
2445
|
-
}
|
|
2446
|
-
);
|
|
2447
|
-
}
|
|
2448
|
-
function DropdownMenuSeparator({
|
|
2449
|
-
className,
|
|
2450
|
-
...props
|
|
2451
|
-
}) {
|
|
2452
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2453
|
-
menu.Menu.Separator,
|
|
2454
|
-
{
|
|
2455
|
-
"data-slot": "dropdown-menu-separator",
|
|
2456
|
-
className: cn("bg-border/50 -mx-1 my-1 h-px", className),
|
|
2457
|
-
...props
|
|
2458
|
-
}
|
|
2459
|
-
);
|
|
2460
|
-
}
|
|
2461
2512
|
var AccountButton = ({
|
|
2462
2513
|
className,
|
|
2463
2514
|
variant = "outline",
|
|
@@ -3027,6 +3078,16 @@ var useThreads = () => {
|
|
|
3027
3078
|
}
|
|
3028
3079
|
return context;
|
|
3029
3080
|
};
|
|
3081
|
+
var useSurface = (options) => {
|
|
3082
|
+
const { events } = useMelony();
|
|
3083
|
+
const surfaceEvents = React3.useMemo(() => {
|
|
3084
|
+
const filtered = events.filter((event) => event.surface === options.name);
|
|
3085
|
+
return melony.filterEventsBySlots(filtered);
|
|
3086
|
+
}, [events, options.name]);
|
|
3087
|
+
return {
|
|
3088
|
+
events: surfaceEvents
|
|
3089
|
+
};
|
|
3090
|
+
};
|
|
3030
3091
|
function Composer({
|
|
3031
3092
|
value,
|
|
3032
3093
|
onChange,
|
|
@@ -3324,8 +3385,7 @@ function Composer({
|
|
|
3324
3385
|
] }) });
|
|
3325
3386
|
}
|
|
3326
3387
|
function StarterPrompts({
|
|
3327
|
-
prompts
|
|
3328
|
-
onPromptClick
|
|
3388
|
+
prompts
|
|
3329
3389
|
}) {
|
|
3330
3390
|
if (!prompts || prompts.length === 0) {
|
|
3331
3391
|
return null;
|
|
@@ -3343,32 +3403,15 @@ function StarterPrompts({
|
|
|
3343
3403
|
role: "user",
|
|
3344
3404
|
data: { content: item.prompt }
|
|
3345
3405
|
},
|
|
3346
|
-
|
|
3406
|
+
justify: "start"
|
|
3347
3407
|
},
|
|
3348
3408
|
index
|
|
3349
3409
|
)) })
|
|
3350
3410
|
] });
|
|
3351
3411
|
}
|
|
3352
3412
|
function MessageContent({ events }) {
|
|
3353
|
-
const
|
|
3354
|
-
|
|
3355
|
-
events.forEach((event, index) => {
|
|
3356
|
-
if (event.slot) {
|
|
3357
|
-
if (!firstSlotIndexes.has(event.slot)) {
|
|
3358
|
-
firstSlotIndexes.set(event.slot, index);
|
|
3359
|
-
}
|
|
3360
|
-
latestSlotIndexes.set(event.slot, index);
|
|
3361
|
-
}
|
|
3362
|
-
});
|
|
3363
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: events.map((event, index) => {
|
|
3364
|
-
let displayEvent = event;
|
|
3365
|
-
if (event.slot) {
|
|
3366
|
-
if (firstSlotIndexes.get(event.slot) !== index) {
|
|
3367
|
-
return null;
|
|
3368
|
-
}
|
|
3369
|
-
const latestIndex = latestSlotIndexes.get(event.slot);
|
|
3370
|
-
displayEvent = events[latestIndex];
|
|
3371
|
-
}
|
|
3413
|
+
const displayEvents = React3.useMemo(() => melony.filterEventsBySlots(events), [events]);
|
|
3414
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: displayEvents.map((displayEvent, index) => {
|
|
3372
3415
|
if (displayEvent.type === "text-delta") {
|
|
3373
3416
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { children: displayEvent.data?.delta }, index);
|
|
3374
3417
|
}
|
|
@@ -3439,10 +3482,8 @@ function MessageList({
|
|
|
3439
3482
|
] });
|
|
3440
3483
|
}
|
|
3441
3484
|
function Thread({
|
|
3442
|
-
className,
|
|
3443
3485
|
placeholder = "Type a message...",
|
|
3444
3486
|
starterPrompts: localStarterPrompts,
|
|
3445
|
-
onStarterPromptClick,
|
|
3446
3487
|
options: localOptions,
|
|
3447
3488
|
autoFocus = false,
|
|
3448
3489
|
defaultSelectedIds
|
|
@@ -3458,9 +3499,14 @@ function Thread({
|
|
|
3458
3499
|
} = useMelony({
|
|
3459
3500
|
initialEvents: threadEvents
|
|
3460
3501
|
});
|
|
3461
|
-
const messages =
|
|
3462
|
-
(
|
|
3463
|
-
|
|
3502
|
+
const messages = React3.useMemo(() => {
|
|
3503
|
+
return initialMessages.map((msg) => ({
|
|
3504
|
+
...msg,
|
|
3505
|
+
content: msg.content.filter((event) => !event.surface)
|
|
3506
|
+
})).filter(
|
|
3507
|
+
(msg) => ["user", "assistant"].includes(msg.role) && msg.content.length > 0
|
|
3508
|
+
);
|
|
3509
|
+
}, [initialMessages]);
|
|
3464
3510
|
const starterPrompts = localStarterPrompts ?? config?.starterPrompts;
|
|
3465
3511
|
const options = localOptions ?? config?.options;
|
|
3466
3512
|
const fileAttachments = config?.fileAttachments;
|
|
@@ -3493,18 +3539,11 @@ function Thread({
|
|
|
3493
3539
|
}
|
|
3494
3540
|
});
|
|
3495
3541
|
};
|
|
3496
|
-
const handleStarterPromptClick = (prompt) => {
|
|
3497
|
-
if (onStarterPromptClick) {
|
|
3498
|
-
onStarterPromptClick(prompt);
|
|
3499
|
-
} else {
|
|
3500
|
-
handleSubmit(void 0, prompt);
|
|
3501
|
-
}
|
|
3502
|
-
};
|
|
3503
3542
|
const showStarterPrompts = messages.length === 0 && starterPrompts && starterPrompts.length > 0 && !isLoadingEvents;
|
|
3504
3543
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3505
3544
|
"div",
|
|
3506
3545
|
{
|
|
3507
|
-
className:
|
|
3546
|
+
className: "relative flex flex-col h-full bg-background flex-1 overflow-hidden",
|
|
3508
3547
|
children: [
|
|
3509
3548
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-y-auto p-4 pb-36", children: [
|
|
3510
3549
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3518,8 +3557,7 @@ function Thread({
|
|
|
3518
3557
|
showStarterPrompts && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3519
3558
|
StarterPrompts,
|
|
3520
3559
|
{
|
|
3521
|
-
prompts: starterPrompts
|
|
3522
|
-
onPromptClick: handleStarterPromptClick
|
|
3560
|
+
prompts: starterPrompts
|
|
3523
3561
|
}
|
|
3524
3562
|
),
|
|
3525
3563
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3586,40 +3624,8 @@ function ChatHeader({
|
|
|
3586
3624
|
}
|
|
3587
3625
|
);
|
|
3588
3626
|
}
|
|
3589
|
-
var
|
|
3590
|
-
|
|
3591
|
-
trigger,
|
|
3592
|
-
triggerClassName,
|
|
3593
|
-
items
|
|
3594
|
-
}) => {
|
|
3595
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
3596
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3597
|
-
DropdownMenuTrigger,
|
|
3598
|
-
{
|
|
3599
|
-
className: triggerClassName,
|
|
3600
|
-
render: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3601
|
-
Button,
|
|
3602
|
-
{
|
|
3603
|
-
variant: "ghost",
|
|
3604
|
-
size: "icon-xs",
|
|
3605
|
-
...props,
|
|
3606
|
-
onClick: (e) => {
|
|
3607
|
-
e.stopPropagation();
|
|
3608
|
-
props.onClick?.(e);
|
|
3609
|
-
},
|
|
3610
|
-
children: trigger || /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconDotsVertical, { className: "size-3.5" })
|
|
3611
|
-
}
|
|
3612
|
-
)
|
|
3613
|
-
}
|
|
3614
|
-
),
|
|
3615
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent, { align: "start", className: cn("w-32", className), children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { onClick: item.onClick, children: [
|
|
3616
|
-
item.icon,
|
|
3617
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
3618
|
-
] }, item.label)) })
|
|
3619
|
-
] });
|
|
3620
|
-
};
|
|
3621
|
-
var ThreadList = ({ className }) => {
|
|
3622
|
-
const { threads, activeThreadId, deleteThread } = useThreads();
|
|
3627
|
+
var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
3628
|
+
const { threads, activeThreadId } = useThreads();
|
|
3623
3629
|
const sortedThreads = React3__namespace.useMemo(() => {
|
|
3624
3630
|
return [...threads].sort((a, b) => {
|
|
3625
3631
|
const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
@@ -3627,15 +3633,8 @@ var ThreadList = ({ className }) => {
|
|
|
3627
3633
|
return dateB - dateA;
|
|
3628
3634
|
});
|
|
3629
3635
|
}, [threads]);
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
await deleteThread(threadId);
|
|
3633
|
-
} catch (error) {
|
|
3634
|
-
console.error("Failed to delete thread:", error);
|
|
3635
|
-
}
|
|
3636
|
-
};
|
|
3637
|
-
return /* @__PURE__ */ jsxRuntime.jsx(List, { className, children: sortedThreads.map((thread) => {
|
|
3638
|
-
const isActive = thread.id === activeThreadId;
|
|
3636
|
+
return /* @__PURE__ */ jsxRuntime.jsx(List, { padding, gap, flex: "1", overflow: "scroll", children: sortedThreads.map((thread) => {
|
|
3637
|
+
thread.id === activeThreadId;
|
|
3639
3638
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3640
3639
|
ListItem,
|
|
3641
3640
|
{
|
|
@@ -3645,7 +3644,10 @@ var ThreadList = ({ className }) => {
|
|
|
3645
3644
|
url: `?threadId=${thread.id}`
|
|
3646
3645
|
}
|
|
3647
3646
|
},
|
|
3648
|
-
|
|
3647
|
+
background,
|
|
3648
|
+
radius,
|
|
3649
|
+
padding,
|
|
3650
|
+
gap,
|
|
3649
3651
|
children: [
|
|
3650
3652
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium truncate", children: thread.title || `Thread ${thread.id.slice(0, 8)}` }) }),
|
|
3651
3653
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 flex items-center opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3654,8 +3656,14 @@ var ThreadList = ({ className }) => {
|
|
|
3654
3656
|
items: [
|
|
3655
3657
|
{
|
|
3656
3658
|
label: "Delete",
|
|
3657
|
-
icon:
|
|
3658
|
-
|
|
3659
|
+
icon: "trash",
|
|
3660
|
+
onClickAction: {
|
|
3661
|
+
role: "system",
|
|
3662
|
+
type: "delete-thread",
|
|
3663
|
+
data: {
|
|
3664
|
+
threadId: thread.id
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3659
3667
|
}
|
|
3660
3668
|
]
|
|
3661
3669
|
}
|
|
@@ -3745,13 +3753,15 @@ function PopupChat({
|
|
|
3745
3753
|
placeholder,
|
|
3746
3754
|
starterPrompts,
|
|
3747
3755
|
options,
|
|
3748
|
-
className: "h-full",
|
|
3749
3756
|
defaultSelectedIds
|
|
3750
3757
|
}
|
|
3751
3758
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3752
3759
|
ThreadList,
|
|
3753
3760
|
{
|
|
3754
|
-
|
|
3761
|
+
padding: "md",
|
|
3762
|
+
gap: "md",
|
|
3763
|
+
background: "muted",
|
|
3764
|
+
radius: "md"
|
|
3755
3765
|
}
|
|
3756
3766
|
) })
|
|
3757
3767
|
] }),
|
|
@@ -3769,9 +3779,10 @@ function PopupChat({
|
|
|
3769
3779
|
)
|
|
3770
3780
|
] });
|
|
3771
3781
|
}
|
|
3772
|
-
function Sidebar({ side, children,
|
|
3782
|
+
function Sidebar({ side, children, width = "1/4" }) {
|
|
3773
3783
|
const { leftCollapsed, rightCollapsed } = useSidebar();
|
|
3774
3784
|
const collapsed = side === "left" ? leftCollapsed : rightCollapsed;
|
|
3785
|
+
const widthClass = widthMap[width];
|
|
3775
3786
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3776
3787
|
"div",
|
|
3777
3788
|
{
|
|
@@ -3779,8 +3790,9 @@ function Sidebar({ side, children, className }) {
|
|
|
3779
3790
|
"flex-shrink-0 border-border bg-background transition-all duration-300 ease-in-out overflow-hidden flex flex-col",
|
|
3780
3791
|
side === "left" ? "border-r" : "border-l",
|
|
3781
3792
|
collapsed ? "w-0 border-r-0 border-l-0 min-w-0" : "",
|
|
3782
|
-
!collapsed &&
|
|
3793
|
+
!collapsed && widthClass
|
|
3783
3794
|
),
|
|
3795
|
+
style: !collapsed && !widthClass ? { width } : void 0,
|
|
3784
3796
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden min-h-0 flex flex-col", children })
|
|
3785
3797
|
}
|
|
3786
3798
|
);
|
|
@@ -3809,6 +3821,10 @@ function FullChat({
|
|
|
3809
3821
|
) }) })
|
|
3810
3822
|
] });
|
|
3811
3823
|
}
|
|
3824
|
+
function Surface({ name, children }) {
|
|
3825
|
+
const { events } = useSurface({ name });
|
|
3826
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children(events) });
|
|
3827
|
+
}
|
|
3812
3828
|
function SidebarToggle({ side, className }) {
|
|
3813
3829
|
const {
|
|
3814
3830
|
leftCollapsed,
|
|
@@ -3848,13 +3864,7 @@ function SidebarToggle({ side, className }) {
|
|
|
3848
3864
|
}
|
|
3849
3865
|
return null;
|
|
3850
3866
|
}
|
|
3851
|
-
var ThreadPopover = ({
|
|
3852
|
-
className,
|
|
3853
|
-
buttonClassName,
|
|
3854
|
-
buttonVariant = "ghost",
|
|
3855
|
-
buttonSize = "icon",
|
|
3856
|
-
emptyState
|
|
3857
|
-
}) => {
|
|
3867
|
+
var ThreadPopover = ({}) => {
|
|
3858
3868
|
const [isOpen, setIsOpen] = React3__namespace.useState(false);
|
|
3859
3869
|
reactHotkeysHook.useHotkeys(
|
|
3860
3870
|
"h",
|
|
@@ -3873,20 +3883,19 @@ var ThreadPopover = ({
|
|
|
3873
3883
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3874
3884
|
Button,
|
|
3875
3885
|
{
|
|
3876
|
-
variant:
|
|
3877
|
-
size:
|
|
3878
|
-
className: cn(buttonClassName),
|
|
3886
|
+
variant: "ghost",
|
|
3887
|
+
size: "icon",
|
|
3879
3888
|
children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconHistory, { className: "size-4" })
|
|
3880
3889
|
}
|
|
3881
3890
|
) }),
|
|
3882
3891
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3883
3892
|
PopoverContent,
|
|
3884
3893
|
{
|
|
3885
|
-
className:
|
|
3894
|
+
className: "w-80 p-0",
|
|
3886
3895
|
side: "bottom",
|
|
3887
3896
|
align: "start",
|
|
3888
3897
|
sideOffset: 8,
|
|
3889
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col h-[400px]", children: /* @__PURE__ */ jsxRuntime.jsx(ThreadList, {
|
|
3898
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col h-[400px]", children: /* @__PURE__ */ jsxRuntime.jsx(ThreadList, {}) })
|
|
3890
3899
|
}
|
|
3891
3900
|
)
|
|
3892
3901
|
] });
|
|
@@ -3977,7 +3986,9 @@ function ThemeToggle() {
|
|
|
3977
3986
|
);
|
|
3978
3987
|
}
|
|
3979
3988
|
var CreateThreadListItem = ({
|
|
3980
|
-
|
|
3989
|
+
padding = "sm",
|
|
3990
|
+
background,
|
|
3991
|
+
radius = "md"
|
|
3981
3992
|
}) => {
|
|
3982
3993
|
const { createThread } = useThreads();
|
|
3983
3994
|
const [isCreating, setIsCreating] = React3__namespace.useState(false);
|
|
@@ -4014,7 +4025,9 @@ var CreateThreadListItem = ({
|
|
|
4014
4025
|
url: "?"
|
|
4015
4026
|
}
|
|
4016
4027
|
},
|
|
4017
|
-
|
|
4028
|
+
padding,
|
|
4029
|
+
background,
|
|
4030
|
+
radius,
|
|
4018
4031
|
children: [
|
|
4019
4032
|
/* @__PURE__ */ jsxRuntime.jsx(ICONS.IconPlus, { className: "size-4" }),
|
|
4020
4033
|
"New chat"
|
|
@@ -4040,6 +4053,7 @@ exports.CreateThreadButton = CreateThreadButton;
|
|
|
4040
4053
|
exports.CreateThreadListItem = CreateThreadListItem;
|
|
4041
4054
|
exports.Divider = Divider;
|
|
4042
4055
|
exports.Dropdown = Dropdown;
|
|
4056
|
+
exports.Float = Float;
|
|
4043
4057
|
exports.Form = Form;
|
|
4044
4058
|
exports.FullChat = FullChat;
|
|
4045
4059
|
exports.Heading = Heading;
|
|
@@ -4060,6 +4074,7 @@ exports.SidebarContext = SidebarContext;
|
|
|
4060
4074
|
exports.SidebarProvider = SidebarProvider;
|
|
4061
4075
|
exports.SidebarToggle = SidebarToggle;
|
|
4062
4076
|
exports.Spacer = Spacer;
|
|
4077
|
+
exports.Surface = Surface;
|
|
4063
4078
|
exports.Text = Text;
|
|
4064
4079
|
exports.Textarea = Textarea2;
|
|
4065
4080
|
exports.ThemeProvider = ThemeProvider;
|
|
@@ -4076,6 +4091,7 @@ exports.useAuth = useAuth;
|
|
|
4076
4091
|
exports.useMelony = useMelony;
|
|
4077
4092
|
exports.useScreenSize = useScreenSize;
|
|
4078
4093
|
exports.useSidebar = useSidebar;
|
|
4094
|
+
exports.useSurface = useSurface;
|
|
4079
4095
|
exports.useTheme = useTheme;
|
|
4080
4096
|
exports.useThreads = useThreads;
|
|
4081
4097
|
Object.keys(ICONS).forEach(function (k) {
|