@melony/react 0.1.50 → 0.1.52
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 +447 -441
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -152
- package/dist/index.d.ts +94 -152
- package/dist/index.js +446 -443
- 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
|
|
@@ -2149,6 +2157,7 @@ function UIRenderer({ node }) {
|
|
|
2149
2157
|
spacer: Spacer,
|
|
2150
2158
|
divider: Divider,
|
|
2151
2159
|
box: Box,
|
|
2160
|
+
float: Float,
|
|
2152
2161
|
image: Image,
|
|
2153
2162
|
video: Video,
|
|
2154
2163
|
icon: Icon,
|
|
@@ -2168,8 +2177,7 @@ function UIRenderer({ node }) {
|
|
|
2168
2177
|
] });
|
|
2169
2178
|
}
|
|
2170
2179
|
const renderedChildren = children?.map((child, i) => /* @__PURE__ */ jsxRuntime.jsx(UIRenderer, { node: child }, i));
|
|
2171
|
-
|
|
2172
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...componentProps, children: renderedChildren });
|
|
2180
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props, children: renderedChildren });
|
|
2173
2181
|
}
|
|
2174
2182
|
var MelonyContext = React3.createContext(
|
|
2175
2183
|
void 0
|
|
@@ -2224,8 +2232,8 @@ var MelonyContextProviderInner = ({
|
|
|
2224
2232
|
window.history.replaceState(null, "", url);
|
|
2225
2233
|
} else {
|
|
2226
2234
|
window.history.pushState(null, "", url);
|
|
2227
|
-
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2228
2235
|
}
|
|
2236
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2229
2237
|
}
|
|
2230
2238
|
return true;
|
|
2231
2239
|
}
|
|
@@ -3027,6 +3035,16 @@ var useThreads = () => {
|
|
|
3027
3035
|
}
|
|
3028
3036
|
return context;
|
|
3029
3037
|
};
|
|
3038
|
+
var useSurface = (options) => {
|
|
3039
|
+
const { events } = useMelony();
|
|
3040
|
+
const surfaceEvents = React3.useMemo(() => {
|
|
3041
|
+
const filtered = events.filter((event) => event.surface === options.name);
|
|
3042
|
+
return melony.filterEventsBySlots(filtered);
|
|
3043
|
+
}, [events, options.name]);
|
|
3044
|
+
return {
|
|
3045
|
+
events: surfaceEvents
|
|
3046
|
+
};
|
|
3047
|
+
};
|
|
3030
3048
|
function Composer({
|
|
3031
3049
|
value,
|
|
3032
3050
|
onChange,
|
|
@@ -3324,8 +3342,7 @@ function Composer({
|
|
|
3324
3342
|
] }) });
|
|
3325
3343
|
}
|
|
3326
3344
|
function StarterPrompts({
|
|
3327
|
-
prompts
|
|
3328
|
-
onPromptClick
|
|
3345
|
+
prompts
|
|
3329
3346
|
}) {
|
|
3330
3347
|
if (!prompts || prompts.length === 0) {
|
|
3331
3348
|
return null;
|
|
@@ -3343,32 +3360,15 @@ function StarterPrompts({
|
|
|
3343
3360
|
role: "user",
|
|
3344
3361
|
data: { content: item.prompt }
|
|
3345
3362
|
},
|
|
3346
|
-
|
|
3363
|
+
justify: "start"
|
|
3347
3364
|
},
|
|
3348
3365
|
index
|
|
3349
3366
|
)) })
|
|
3350
3367
|
] });
|
|
3351
3368
|
}
|
|
3352
3369
|
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
|
-
}
|
|
3370
|
+
const displayEvents = React3.useMemo(() => melony.filterEventsBySlots(events), [events]);
|
|
3371
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: displayEvents.map((displayEvent, index) => {
|
|
3372
3372
|
if (displayEvent.type === "text-delta") {
|
|
3373
3373
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { children: displayEvent.data?.delta }, index);
|
|
3374
3374
|
}
|
|
@@ -3439,10 +3439,8 @@ function MessageList({
|
|
|
3439
3439
|
] });
|
|
3440
3440
|
}
|
|
3441
3441
|
function Thread({
|
|
3442
|
-
className,
|
|
3443
3442
|
placeholder = "Type a message...",
|
|
3444
3443
|
starterPrompts: localStarterPrompts,
|
|
3445
|
-
onStarterPromptClick,
|
|
3446
3444
|
options: localOptions,
|
|
3447
3445
|
autoFocus = false,
|
|
3448
3446
|
defaultSelectedIds
|
|
@@ -3458,9 +3456,14 @@ function Thread({
|
|
|
3458
3456
|
} = useMelony({
|
|
3459
3457
|
initialEvents: threadEvents
|
|
3460
3458
|
});
|
|
3461
|
-
const messages =
|
|
3462
|
-
(
|
|
3463
|
-
|
|
3459
|
+
const messages = React3.useMemo(() => {
|
|
3460
|
+
return initialMessages.map((msg) => ({
|
|
3461
|
+
...msg,
|
|
3462
|
+
content: msg.content.filter((event) => !event.surface)
|
|
3463
|
+
})).filter(
|
|
3464
|
+
(msg) => ["user", "assistant"].includes(msg.role) && msg.content.length > 0
|
|
3465
|
+
);
|
|
3466
|
+
}, [initialMessages]);
|
|
3464
3467
|
const starterPrompts = localStarterPrompts ?? config?.starterPrompts;
|
|
3465
3468
|
const options = localOptions ?? config?.options;
|
|
3466
3469
|
const fileAttachments = config?.fileAttachments;
|
|
@@ -3493,18 +3496,11 @@ function Thread({
|
|
|
3493
3496
|
}
|
|
3494
3497
|
});
|
|
3495
3498
|
};
|
|
3496
|
-
const handleStarterPromptClick = (prompt) => {
|
|
3497
|
-
if (onStarterPromptClick) {
|
|
3498
|
-
onStarterPromptClick(prompt);
|
|
3499
|
-
} else {
|
|
3500
|
-
handleSubmit(void 0, prompt);
|
|
3501
|
-
}
|
|
3502
|
-
};
|
|
3503
3499
|
const showStarterPrompts = messages.length === 0 && starterPrompts && starterPrompts.length > 0 && !isLoadingEvents;
|
|
3504
3500
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3505
3501
|
"div",
|
|
3506
3502
|
{
|
|
3507
|
-
className:
|
|
3503
|
+
className: "relative flex flex-col h-full bg-background flex-1 overflow-hidden",
|
|
3508
3504
|
children: [
|
|
3509
3505
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-y-auto p-4 pb-36", children: [
|
|
3510
3506
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3518,8 +3514,7 @@ function Thread({
|
|
|
3518
3514
|
showStarterPrompts && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3519
3515
|
StarterPrompts,
|
|
3520
3516
|
{
|
|
3521
|
-
prompts: starterPrompts
|
|
3522
|
-
onPromptClick: handleStarterPromptClick
|
|
3517
|
+
prompts: starterPrompts
|
|
3523
3518
|
}
|
|
3524
3519
|
),
|
|
3525
3520
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3618,7 +3613,7 @@ var Dropdown = ({
|
|
|
3618
3613
|
] }, item.label)) })
|
|
3619
3614
|
] });
|
|
3620
3615
|
};
|
|
3621
|
-
var ThreadList = ({
|
|
3616
|
+
var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
3622
3617
|
const { threads, activeThreadId, deleteThread } = useThreads();
|
|
3623
3618
|
const sortedThreads = React3__namespace.useMemo(() => {
|
|
3624
3619
|
return [...threads].sort((a, b) => {
|
|
@@ -3634,8 +3629,8 @@ var ThreadList = ({ className }) => {
|
|
|
3634
3629
|
console.error("Failed to delete thread:", error);
|
|
3635
3630
|
}
|
|
3636
3631
|
};
|
|
3637
|
-
return /* @__PURE__ */ jsxRuntime.jsx(List, {
|
|
3638
|
-
|
|
3632
|
+
return /* @__PURE__ */ jsxRuntime.jsx(List, { padding, gap, flex: "1", overflow: "scroll", children: sortedThreads.map((thread) => {
|
|
3633
|
+
thread.id === activeThreadId;
|
|
3639
3634
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3640
3635
|
ListItem,
|
|
3641
3636
|
{
|
|
@@ -3645,7 +3640,10 @@ var ThreadList = ({ className }) => {
|
|
|
3645
3640
|
url: `?threadId=${thread.id}`
|
|
3646
3641
|
}
|
|
3647
3642
|
},
|
|
3648
|
-
|
|
3643
|
+
background,
|
|
3644
|
+
radius,
|
|
3645
|
+
padding,
|
|
3646
|
+
gap,
|
|
3649
3647
|
children: [
|
|
3650
3648
|
/* @__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
3649
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 flex items-center opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3745,13 +3743,15 @@ function PopupChat({
|
|
|
3745
3743
|
placeholder,
|
|
3746
3744
|
starterPrompts,
|
|
3747
3745
|
options,
|
|
3748
|
-
className: "h-full",
|
|
3749
3746
|
defaultSelectedIds
|
|
3750
3747
|
}
|
|
3751
3748
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3752
3749
|
ThreadList,
|
|
3753
3750
|
{
|
|
3754
|
-
|
|
3751
|
+
padding: "md",
|
|
3752
|
+
gap: "md",
|
|
3753
|
+
background: "muted",
|
|
3754
|
+
radius: "md"
|
|
3755
3755
|
}
|
|
3756
3756
|
) })
|
|
3757
3757
|
] }),
|
|
@@ -3769,9 +3769,10 @@ function PopupChat({
|
|
|
3769
3769
|
)
|
|
3770
3770
|
] });
|
|
3771
3771
|
}
|
|
3772
|
-
function Sidebar({ side, children,
|
|
3772
|
+
function Sidebar({ side, children, width = "1/4" }) {
|
|
3773
3773
|
const { leftCollapsed, rightCollapsed } = useSidebar();
|
|
3774
3774
|
const collapsed = side === "left" ? leftCollapsed : rightCollapsed;
|
|
3775
|
+
const widthClass = widthMap[width];
|
|
3775
3776
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3776
3777
|
"div",
|
|
3777
3778
|
{
|
|
@@ -3779,8 +3780,9 @@ function Sidebar({ side, children, className }) {
|
|
|
3779
3780
|
"flex-shrink-0 border-border bg-background transition-all duration-300 ease-in-out overflow-hidden flex flex-col",
|
|
3780
3781
|
side === "left" ? "border-r" : "border-l",
|
|
3781
3782
|
collapsed ? "w-0 border-r-0 border-l-0 min-w-0" : "",
|
|
3782
|
-
!collapsed &&
|
|
3783
|
+
!collapsed && widthClass
|
|
3783
3784
|
),
|
|
3785
|
+
style: !collapsed && !widthClass ? { width } : void 0,
|
|
3784
3786
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden min-h-0 flex flex-col", children })
|
|
3785
3787
|
}
|
|
3786
3788
|
);
|
|
@@ -3809,6 +3811,10 @@ function FullChat({
|
|
|
3809
3811
|
) }) })
|
|
3810
3812
|
] });
|
|
3811
3813
|
}
|
|
3814
|
+
function Surface({ name, children }) {
|
|
3815
|
+
const { events } = useSurface({ name });
|
|
3816
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children(events) });
|
|
3817
|
+
}
|
|
3812
3818
|
function SidebarToggle({ side, className }) {
|
|
3813
3819
|
const {
|
|
3814
3820
|
leftCollapsed,
|
|
@@ -3848,13 +3854,7 @@ function SidebarToggle({ side, className }) {
|
|
|
3848
3854
|
}
|
|
3849
3855
|
return null;
|
|
3850
3856
|
}
|
|
3851
|
-
var ThreadPopover = ({
|
|
3852
|
-
className,
|
|
3853
|
-
buttonClassName,
|
|
3854
|
-
buttonVariant = "ghost",
|
|
3855
|
-
buttonSize = "icon",
|
|
3856
|
-
emptyState
|
|
3857
|
-
}) => {
|
|
3857
|
+
var ThreadPopover = ({}) => {
|
|
3858
3858
|
const [isOpen, setIsOpen] = React3__namespace.useState(false);
|
|
3859
3859
|
reactHotkeysHook.useHotkeys(
|
|
3860
3860
|
"h",
|
|
@@ -3873,20 +3873,19 @@ var ThreadPopover = ({
|
|
|
3873
3873
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3874
3874
|
Button,
|
|
3875
3875
|
{
|
|
3876
|
-
variant:
|
|
3877
|
-
size:
|
|
3878
|
-
className: cn(buttonClassName),
|
|
3876
|
+
variant: "ghost",
|
|
3877
|
+
size: "icon",
|
|
3879
3878
|
children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconHistory, { className: "size-4" })
|
|
3880
3879
|
}
|
|
3881
3880
|
) }),
|
|
3882
3881
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3883
3882
|
PopoverContent,
|
|
3884
3883
|
{
|
|
3885
|
-
className:
|
|
3884
|
+
className: "w-80 p-0",
|
|
3886
3885
|
side: "bottom",
|
|
3887
3886
|
align: "start",
|
|
3888
3887
|
sideOffset: 8,
|
|
3889
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col h-[400px]", children: /* @__PURE__ */ jsxRuntime.jsx(ThreadList, {
|
|
3888
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col h-[400px]", children: /* @__PURE__ */ jsxRuntime.jsx(ThreadList, {}) })
|
|
3890
3889
|
}
|
|
3891
3890
|
)
|
|
3892
3891
|
] });
|
|
@@ -3977,7 +3976,9 @@ function ThemeToggle() {
|
|
|
3977
3976
|
);
|
|
3978
3977
|
}
|
|
3979
3978
|
var CreateThreadListItem = ({
|
|
3980
|
-
|
|
3979
|
+
padding = "sm",
|
|
3980
|
+
background,
|
|
3981
|
+
radius = "md"
|
|
3981
3982
|
}) => {
|
|
3982
3983
|
const { createThread } = useThreads();
|
|
3983
3984
|
const [isCreating, setIsCreating] = React3__namespace.useState(false);
|
|
@@ -4014,7 +4015,9 @@ var CreateThreadListItem = ({
|
|
|
4014
4015
|
url: "?"
|
|
4015
4016
|
}
|
|
4016
4017
|
},
|
|
4017
|
-
|
|
4018
|
+
padding,
|
|
4019
|
+
background,
|
|
4020
|
+
radius,
|
|
4018
4021
|
children: [
|
|
4019
4022
|
/* @__PURE__ */ jsxRuntime.jsx(ICONS.IconPlus, { className: "size-4" }),
|
|
4020
4023
|
"New chat"
|
|
@@ -4040,6 +4043,7 @@ exports.CreateThreadButton = CreateThreadButton;
|
|
|
4040
4043
|
exports.CreateThreadListItem = CreateThreadListItem;
|
|
4041
4044
|
exports.Divider = Divider;
|
|
4042
4045
|
exports.Dropdown = Dropdown;
|
|
4046
|
+
exports.Float = Float;
|
|
4043
4047
|
exports.Form = Form;
|
|
4044
4048
|
exports.FullChat = FullChat;
|
|
4045
4049
|
exports.Heading = Heading;
|
|
@@ -4060,6 +4064,7 @@ exports.SidebarContext = SidebarContext;
|
|
|
4060
4064
|
exports.SidebarProvider = SidebarProvider;
|
|
4061
4065
|
exports.SidebarToggle = SidebarToggle;
|
|
4062
4066
|
exports.Spacer = Spacer;
|
|
4067
|
+
exports.Surface = Surface;
|
|
4063
4068
|
exports.Text = Text;
|
|
4064
4069
|
exports.Textarea = Textarea2;
|
|
4065
4070
|
exports.ThemeProvider = ThemeProvider;
|
|
@@ -4076,6 +4081,7 @@ exports.useAuth = useAuth;
|
|
|
4076
4081
|
exports.useMelony = useMelony;
|
|
4077
4082
|
exports.useScreenSize = useScreenSize;
|
|
4078
4083
|
exports.useSidebar = useSidebar;
|
|
4084
|
+
exports.useSurface = useSurface;
|
|
4079
4085
|
exports.useTheme = useTheme;
|
|
4080
4086
|
exports.useThreads = useThreads;
|
|
4081
4087
|
Object.keys(ICONS).forEach(function (k) {
|