@melony/react 0.1.52 → 0.1.54
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/README.md +1 -1
- package/dist/index.cjs +428 -396
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -11
- package/dist/index.d.ts +8 -11
- package/dist/index.js +429 -397
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -71,10 +71,7 @@ function DialogOverlay({
|
|
|
71
71
|
}
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
|
-
function DialogContent({
|
|
75
|
-
className,
|
|
76
|
-
...props
|
|
77
|
-
}) {
|
|
74
|
+
function DialogContent({ className, ...props }) {
|
|
78
75
|
return /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
|
|
79
76
|
/* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
|
|
80
77
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -90,10 +87,7 @@ function DialogContent({
|
|
|
90
87
|
)
|
|
91
88
|
] });
|
|
92
89
|
}
|
|
93
|
-
function DialogClose({
|
|
94
|
-
className,
|
|
95
|
-
...props
|
|
96
|
-
}) {
|
|
90
|
+
function DialogClose({ className, ...props }) {
|
|
97
91
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
98
92
|
dialog.Dialog.Close,
|
|
99
93
|
{
|
|
@@ -106,10 +100,7 @@ function DialogClose({
|
|
|
106
100
|
}
|
|
107
101
|
);
|
|
108
102
|
}
|
|
109
|
-
function DialogHeader({
|
|
110
|
-
className,
|
|
111
|
-
...props
|
|
112
|
-
}) {
|
|
103
|
+
function DialogHeader({ className, ...props }) {
|
|
113
104
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
114
105
|
"div",
|
|
115
106
|
{
|
|
@@ -161,7 +152,10 @@ function Card({
|
|
|
161
152
|
{
|
|
162
153
|
"data-slot": "card",
|
|
163
154
|
"data-size": size,
|
|
164
|
-
className: cn(
|
|
155
|
+
className: cn(
|
|
156
|
+
"ring-foreground/10 bg-card text-card-foreground gap-6 overflow-hidden rounded-2xl py-6 text-sm ring-1 has-[>img:first-child]:pt-0 data-[size=sm]:gap-4 data-[size=sm]:py-4 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col",
|
|
157
|
+
className
|
|
158
|
+
),
|
|
165
159
|
...props
|
|
166
160
|
}
|
|
167
161
|
);
|
|
@@ -436,7 +430,8 @@ var Box = ({
|
|
|
436
430
|
radius = "none",
|
|
437
431
|
width = "auto",
|
|
438
432
|
height = "auto",
|
|
439
|
-
shadow = "none"
|
|
433
|
+
shadow = "none",
|
|
434
|
+
group = false
|
|
440
435
|
}) => {
|
|
441
436
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
442
437
|
"div",
|
|
@@ -451,7 +446,8 @@ var Box = ({
|
|
|
451
446
|
radiusMap[radius],
|
|
452
447
|
widthMap[width],
|
|
453
448
|
height === "full" && "h-full",
|
|
454
|
-
shadowMap[shadow]
|
|
449
|
+
shadowMap[shadow],
|
|
450
|
+
group && "group"
|
|
455
451
|
),
|
|
456
452
|
children
|
|
457
453
|
}
|
|
@@ -465,11 +461,15 @@ var Float = ({
|
|
|
465
461
|
showOnHover = false
|
|
466
462
|
}) => {
|
|
467
463
|
const positionClasses = {
|
|
468
|
-
"top-left": "top-
|
|
469
|
-
"top-right": "top-
|
|
470
|
-
"
|
|
471
|
-
"bottom-
|
|
472
|
-
"
|
|
464
|
+
"top-left": "top-1 left-1",
|
|
465
|
+
"top-right": "top-1 right-1",
|
|
466
|
+
"top-center": "top-1 left-1/2 -translate-x-1/2",
|
|
467
|
+
"bottom-left": "bottom-1 left-1",
|
|
468
|
+
"bottom-right": "bottom-1 right-1",
|
|
469
|
+
"bottom-center": "bottom-1 left-1/2 -translate-x-1/2",
|
|
470
|
+
center: "top- 1 / 2 left - 1/2 -tra nslate-x-1/2 -translate-y-1/2",
|
|
471
|
+
"left-center": "top-1/2 left-1 -translate-y-1/2",
|
|
472
|
+
"right-center": "top-1/2 right-1 -translate-y-1/2"
|
|
473
473
|
};
|
|
474
474
|
const marginXClass = position.endsWith("left") ? marginMap[offsetX].replace("m-", "ml-") : marginMap[offsetX].replace("m-", "mr-");
|
|
475
475
|
const marginYClass = position.startsWith("top") ? marginMap[offsetY].replace("m-", "mt-") : marginMap[offsetY].replace("m-", "mb-");
|
|
@@ -528,10 +528,7 @@ var Divider = ({
|
|
|
528
528
|
Separator,
|
|
529
529
|
{
|
|
530
530
|
orientation,
|
|
531
|
-
className: cn(
|
|
532
|
-
marginMap[margin],
|
|
533
|
-
colorBgMap[color]
|
|
534
|
-
)
|
|
531
|
+
className: cn(marginMap[margin], colorBgMap[color])
|
|
535
532
|
}
|
|
536
533
|
);
|
|
537
534
|
};
|
|
@@ -751,6 +748,7 @@ var Video = ({
|
|
|
751
748
|
muted = false,
|
|
752
749
|
aspectRatio = "16/9",
|
|
753
750
|
width = "full",
|
|
751
|
+
height = "auto",
|
|
754
752
|
radius = "lg"
|
|
755
753
|
}) => {
|
|
756
754
|
const aspectRatios = {
|
|
@@ -768,6 +766,7 @@ var Video = ({
|
|
|
768
766
|
widthMap[width],
|
|
769
767
|
radiusMap[radius]
|
|
770
768
|
),
|
|
769
|
+
style: { height },
|
|
771
770
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
772
771
|
"video",
|
|
773
772
|
{
|
|
@@ -797,13 +796,16 @@ var Icon = ({
|
|
|
797
796
|
lg: 24
|
|
798
797
|
};
|
|
799
798
|
const resolvedSize = typeof size === "number" ? size : sizeMap[size] || 20;
|
|
800
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
801
|
-
|
|
799
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
800
|
+
"div",
|
|
802
801
|
{
|
|
803
|
-
|
|
804
|
-
|
|
802
|
+
className: cn(
|
|
803
|
+
"inline-flex items-center justify-center",
|
|
804
|
+
colorTextMap[color]
|
|
805
|
+
),
|
|
806
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: resolvedSize, strokeWidth: 1.5 })
|
|
805
807
|
}
|
|
806
|
-
)
|
|
808
|
+
);
|
|
807
809
|
};
|
|
808
810
|
var badgeVariants = classVarianceAuthority.cva(
|
|
809
811
|
"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",
|
|
@@ -960,41 +962,60 @@ var Chart = ({
|
|
|
960
962
|
const totalBarSpace = chartWidth - padding.left - padding.right;
|
|
961
963
|
const barSpacing = data.length > 1 ? totalBarSpace * 0.1 / data.length : 0;
|
|
962
964
|
const actualBarWidth = (totalBarSpace - barSpacing * (data.length + 1)) / data.length;
|
|
963
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
965
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
966
|
+
"svg",
|
|
967
|
+
{
|
|
968
|
+
viewBox: `0 0 ${chartWidth} ${chartHeight + padding.bottom}`,
|
|
969
|
+
className: "w-full h-auto overflow-visible",
|
|
970
|
+
children: [
|
|
971
|
+
renderGrid(),
|
|
972
|
+
data.map((item, index) => {
|
|
973
|
+
const barHeight = item.value / maxValue * chartHeight;
|
|
974
|
+
const x = padding.left + barSpacing + index * (actualBarWidth + barSpacing);
|
|
975
|
+
const y = padding.top + chartHeight - barHeight;
|
|
976
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
977
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
978
|
+
"rect",
|
|
979
|
+
{
|
|
980
|
+
x,
|
|
981
|
+
y,
|
|
982
|
+
width: actualBarWidth,
|
|
983
|
+
height: barHeight,
|
|
984
|
+
fill: getColor(index, item.color),
|
|
985
|
+
rx: 4,
|
|
986
|
+
onMouseEnter: () => showTooltips && setTooltip({
|
|
987
|
+
visible: true,
|
|
988
|
+
x: x + actualBarWidth / 2,
|
|
989
|
+
y: y - 5,
|
|
990
|
+
label: item.label,
|
|
991
|
+
value: item.value
|
|
992
|
+
}),
|
|
993
|
+
onMouseLeave: () => setTooltip({
|
|
994
|
+
visible: false,
|
|
995
|
+
x: 0,
|
|
996
|
+
y: 0,
|
|
997
|
+
label: "",
|
|
998
|
+
value: 0
|
|
999
|
+
}),
|
|
1000
|
+
className: "transition-all hover:opacity-80 cursor-pointer"
|
|
1001
|
+
}
|
|
1002
|
+
),
|
|
1003
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
|
+
"text",
|
|
1005
|
+
{
|
|
1006
|
+
x: x + actualBarWidth / 2,
|
|
1007
|
+
y: padding.top + chartHeight + 20,
|
|
1008
|
+
textAnchor: "middle",
|
|
1009
|
+
className: "fill-muted-foreground text-[10px]",
|
|
1010
|
+
children: item.label
|
|
1011
|
+
}
|
|
1012
|
+
)
|
|
1013
|
+
] }, index);
|
|
1014
|
+
}),
|
|
1015
|
+
showTooltips && renderTooltip()
|
|
1016
|
+
]
|
|
1017
|
+
}
|
|
1018
|
+
);
|
|
998
1019
|
};
|
|
999
1020
|
const renderLineChart = () => {
|
|
1000
1021
|
const points = data.map((item, index) => ({
|
|
@@ -1003,37 +1024,59 @@ var Chart = ({
|
|
|
1003
1024
|
...item
|
|
1004
1025
|
}));
|
|
1005
1026
|
const pathData = points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
1006
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1027
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1028
|
+
"svg",
|
|
1029
|
+
{
|
|
1030
|
+
viewBox: `0 0 ${chartWidth} ${chartHeight + padding.bottom}`,
|
|
1031
|
+
className: "w-full h-auto overflow-visible",
|
|
1032
|
+
children: [
|
|
1033
|
+
renderGrid(),
|
|
1034
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1035
|
+
"path",
|
|
1036
|
+
{
|
|
1037
|
+
d: pathData,
|
|
1038
|
+
fill: "none",
|
|
1039
|
+
stroke: getColor(0),
|
|
1040
|
+
strokeWidth: 3,
|
|
1041
|
+
className: "transition-all"
|
|
1042
|
+
}
|
|
1043
|
+
),
|
|
1044
|
+
points.map((point, index) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
1045
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
|
+
"circle",
|
|
1047
|
+
{
|
|
1048
|
+
cx: point.x,
|
|
1049
|
+
cy: point.y,
|
|
1050
|
+
r: 5,
|
|
1051
|
+
fill: getColor(index, point.color),
|
|
1052
|
+
stroke: "hsl(var(--background))",
|
|
1053
|
+
strokeWidth: 2,
|
|
1054
|
+
onMouseEnter: () => showTooltips && setTooltip({
|
|
1055
|
+
visible: true,
|
|
1056
|
+
x: point.x,
|
|
1057
|
+
y: point.y - 5,
|
|
1058
|
+
label: point.label,
|
|
1059
|
+
value: point.value
|
|
1060
|
+
}),
|
|
1061
|
+
onMouseLeave: () => setTooltip({ visible: false, x: 0, y: 0, label: "", value: 0 }),
|
|
1062
|
+
className: "hover:r-6 transition-all cursor-pointer"
|
|
1063
|
+
}
|
|
1064
|
+
),
|
|
1065
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1066
|
+
"text",
|
|
1067
|
+
{
|
|
1068
|
+
x: point.x,
|
|
1069
|
+
y: padding.top + chartHeight + 20,
|
|
1070
|
+
textAnchor: "middle",
|
|
1071
|
+
className: "fill-muted-foreground text-[10px]",
|
|
1072
|
+
children: point.label
|
|
1073
|
+
}
|
|
1074
|
+
)
|
|
1075
|
+
] }, index)),
|
|
1076
|
+
showTooltips && renderTooltip()
|
|
1077
|
+
]
|
|
1078
|
+
}
|
|
1079
|
+
);
|
|
1037
1080
|
};
|
|
1038
1081
|
const renderChart = () => {
|
|
1039
1082
|
switch (chartType) {
|
|
@@ -1123,18 +1166,21 @@ function Label({ className, ...props }) {
|
|
|
1123
1166
|
}
|
|
1124
1167
|
);
|
|
1125
1168
|
}
|
|
1126
|
-
var fieldVariants = classVarianceAuthority.cva(
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1169
|
+
var fieldVariants = classVarianceAuthority.cva(
|
|
1170
|
+
"data-[invalid=true]:text-destructive gap-3 group/field flex w-full",
|
|
1171
|
+
{
|
|
1172
|
+
variants: {
|
|
1173
|
+
orientation: {
|
|
1174
|
+
vertical: "flex-col [&>*]:w-full [&>.sr-only]:w-auto",
|
|
1175
|
+
horizontal: "flex-row items-center [&>[data-slot=field-label]]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
1176
|
+
responsive: "flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
1177
|
+
}
|
|
1178
|
+
},
|
|
1179
|
+
defaultVariants: {
|
|
1180
|
+
orientation: "vertical"
|
|
1181
|
+
}
|
|
1136
1182
|
}
|
|
1137
|
-
|
|
1183
|
+
);
|
|
1138
1184
|
function Field({
|
|
1139
1185
|
className,
|
|
1140
1186
|
orientation = "vertical",
|
|
@@ -1325,7 +1371,10 @@ function SelectContent({
|
|
|
1325
1371
|
select.Select.Popup,
|
|
1326
1372
|
{
|
|
1327
1373
|
"data-slot": "select-content",
|
|
1328
|
-
className: cn(
|
|
1374
|
+
className: cn(
|
|
1375
|
+
"bg-popover text-popover-foreground 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 min-w-36 rounded-2xl shadow-2xl ring-1 duration-100 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto",
|
|
1376
|
+
className
|
|
1377
|
+
),
|
|
1329
1378
|
...props,
|
|
1330
1379
|
children: [
|
|
1331
1380
|
/* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
|
|
@@ -1372,12 +1421,12 @@ function SelectScrollUpButton({
|
|
|
1372
1421
|
select.Select.ScrollUpArrow,
|
|
1373
1422
|
{
|
|
1374
1423
|
"data-slot": "select-scroll-up-button",
|
|
1375
|
-
className: cn(
|
|
1424
|
+
className: cn(
|
|
1425
|
+
"bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 top-0 w-full",
|
|
1426
|
+
className
|
|
1427
|
+
),
|
|
1376
1428
|
...props,
|
|
1377
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1378
|
-
ICONS.IconChevronUp,
|
|
1379
|
-
{}
|
|
1380
|
-
)
|
|
1429
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconChevronUp, {})
|
|
1381
1430
|
}
|
|
1382
1431
|
);
|
|
1383
1432
|
}
|
|
@@ -1389,12 +1438,12 @@ function SelectScrollDownButton({
|
|
|
1389
1438
|
select.Select.ScrollDownArrow,
|
|
1390
1439
|
{
|
|
1391
1440
|
"data-slot": "select-scroll-down-button",
|
|
1392
|
-
className: cn(
|
|
1441
|
+
className: cn(
|
|
1442
|
+
"bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 bottom-0 w-full",
|
|
1443
|
+
className
|
|
1444
|
+
),
|
|
1393
1445
|
...props,
|
|
1394
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1395
|
-
ICONS.IconChevronDown,
|
|
1396
|
-
{}
|
|
1397
|
-
)
|
|
1446
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconChevronDown, {})
|
|
1398
1447
|
}
|
|
1399
1448
|
);
|
|
1400
1449
|
}
|
|
@@ -1850,37 +1899,30 @@ var RadioGroup = ({
|
|
|
1850
1899
|
children: options.map((option, index) => {
|
|
1851
1900
|
const radioId = `${name}-${index}`;
|
|
1852
1901
|
const isDisabled = disabled || option.disabled;
|
|
1853
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
color: isDisabled ? "muted" : "foreground"
|
|
1878
|
-
}
|
|
1879
|
-
)
|
|
1880
|
-
]
|
|
1881
|
-
},
|
|
1882
|
-
index
|
|
1883
|
-
);
|
|
1902
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1903
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1904
|
+
"input",
|
|
1905
|
+
{
|
|
1906
|
+
type: "radio",
|
|
1907
|
+
name,
|
|
1908
|
+
id: radioId,
|
|
1909
|
+
value: option.value,
|
|
1910
|
+
defaultChecked: defaultValue === option.value,
|
|
1911
|
+
disabled: isDisabled,
|
|
1912
|
+
onChange: handleChange,
|
|
1913
|
+
className: "h-4 w-4 border-gray-300 text-primary focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50"
|
|
1914
|
+
}
|
|
1915
|
+
),
|
|
1916
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1917
|
+
Label2,
|
|
1918
|
+
{
|
|
1919
|
+
htmlFor: radioId,
|
|
1920
|
+
value: option.label,
|
|
1921
|
+
size: "sm",
|
|
1922
|
+
color: isDisabled ? "muted" : "foreground"
|
|
1923
|
+
}
|
|
1924
|
+
)
|
|
1925
|
+
] }, index);
|
|
1884
1926
|
})
|
|
1885
1927
|
}
|
|
1886
1928
|
)
|
|
@@ -2068,7 +2110,16 @@ var Upload = ({
|
|
|
2068
2110
|
}
|
|
2069
2111
|
),
|
|
2070
2112
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2 mb-2 items-center", children: [
|
|
2071
|
-
showInitialFiles && initialFiles?.map((file, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2113
|
+
showInitialFiles && initialFiles?.map((file, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2114
|
+
Image,
|
|
2115
|
+
{
|
|
2116
|
+
src: file.url,
|
|
2117
|
+
alt: file.name,
|
|
2118
|
+
width: "min",
|
|
2119
|
+
radius: "md"
|
|
2120
|
+
},
|
|
2121
|
+
index
|
|
2122
|
+
)),
|
|
2072
2123
|
displayEvents.map(
|
|
2073
2124
|
(event, index) => event.ui ? /* @__PURE__ */ jsxRuntime.jsx(UIRenderer, { node: event.ui }, index) : null
|
|
2074
2125
|
),
|
|
@@ -2088,11 +2139,7 @@ var Upload = ({
|
|
|
2088
2139
|
] })
|
|
2089
2140
|
] });
|
|
2090
2141
|
};
|
|
2091
|
-
var Form = ({
|
|
2092
|
-
children,
|
|
2093
|
-
onSubmitAction,
|
|
2094
|
-
gap = "md"
|
|
2095
|
-
}) => {
|
|
2142
|
+
var Form = ({ children, onSubmitAction, gap = "md" }) => {
|
|
2096
2143
|
const { sendEvent } = useMelony();
|
|
2097
2144
|
const [isSubmitted, setIsSubmitted] = React3.useState(false);
|
|
2098
2145
|
const handleSubmit = (e) => {
|
|
@@ -2118,24 +2165,176 @@ var Form = ({
|
|
|
2118
2165
|
}
|
|
2119
2166
|
}
|
|
2120
2167
|
};
|
|
2121
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2122
|
-
"
|
|
2168
|
+
return /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: handleSubmit, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("fieldset", { disabled: isSubmitted, className: "m-0 border-0 p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2169
|
+
"div",
|
|
2123
2170
|
{
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
"
|
|
2171
|
+
className: cn(
|
|
2172
|
+
"flex flex-col transition-opacity",
|
|
2173
|
+
gapMap[gap],
|
|
2174
|
+
isSubmitted && "opacity-60 pointer-events-none"
|
|
2175
|
+
),
|
|
2176
|
+
children
|
|
2177
|
+
}
|
|
2178
|
+
) }) });
|
|
2179
|
+
};
|
|
2180
|
+
function DropdownMenu({ ...props }) {
|
|
2181
|
+
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
2182
|
+
}
|
|
2183
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
2184
|
+
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
2185
|
+
}
|
|
2186
|
+
function DropdownMenuContent({
|
|
2187
|
+
align = "start",
|
|
2188
|
+
alignOffset = 0,
|
|
2189
|
+
side = "bottom",
|
|
2190
|
+
sideOffset = 4,
|
|
2191
|
+
className,
|
|
2192
|
+
...props
|
|
2193
|
+
}) {
|
|
2194
|
+
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2195
|
+
menu.Menu.Positioner,
|
|
2196
|
+
{
|
|
2197
|
+
className: "isolate z-50 outline-none",
|
|
2198
|
+
align,
|
|
2199
|
+
alignOffset,
|
|
2200
|
+
side,
|
|
2201
|
+
sideOffset,
|
|
2202
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2203
|
+
menu.Menu.Popup,
|
|
2128
2204
|
{
|
|
2205
|
+
"data-slot": "dropdown-menu-content",
|
|
2129
2206
|
className: cn(
|
|
2130
|
-
"
|
|
2131
|
-
|
|
2132
|
-
isSubmitted && "opacity-60 pointer-events-none"
|
|
2207
|
+
"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",
|
|
2208
|
+
className
|
|
2133
2209
|
),
|
|
2134
|
-
|
|
2210
|
+
...props
|
|
2135
2211
|
}
|
|
2136
|
-
)
|
|
2212
|
+
)
|
|
2213
|
+
}
|
|
2214
|
+
) });
|
|
2215
|
+
}
|
|
2216
|
+
function DropdownMenuGroup({ ...props }) {
|
|
2217
|
+
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
2218
|
+
}
|
|
2219
|
+
function DropdownMenuLabel({
|
|
2220
|
+
className,
|
|
2221
|
+
inset,
|
|
2222
|
+
...props
|
|
2223
|
+
}) {
|
|
2224
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2225
|
+
menu.Menu.GroupLabel,
|
|
2226
|
+
{
|
|
2227
|
+
"data-slot": "dropdown-menu-label",
|
|
2228
|
+
"data-inset": inset,
|
|
2229
|
+
className: cn(
|
|
2230
|
+
"text-muted-foreground px-3 py-2.5 text-xs data-[inset]:pl-8",
|
|
2231
|
+
className
|
|
2232
|
+
),
|
|
2233
|
+
...props
|
|
2234
|
+
}
|
|
2235
|
+
);
|
|
2236
|
+
}
|
|
2237
|
+
function DropdownMenuItem({
|
|
2238
|
+
className,
|
|
2239
|
+
inset,
|
|
2240
|
+
variant = "default",
|
|
2241
|
+
...props
|
|
2242
|
+
}) {
|
|
2243
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2244
|
+
menu.Menu.Item,
|
|
2245
|
+
{
|
|
2246
|
+
"data-slot": "dropdown-menu-item",
|
|
2247
|
+
"data-inset": inset,
|
|
2248
|
+
"data-variant": variant,
|
|
2249
|
+
className: cn(
|
|
2250
|
+
"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",
|
|
2251
|
+
className
|
|
2252
|
+
),
|
|
2253
|
+
...props
|
|
2254
|
+
}
|
|
2255
|
+
);
|
|
2256
|
+
}
|
|
2257
|
+
function DropdownMenuCheckboxItem({
|
|
2258
|
+
className,
|
|
2259
|
+
children,
|
|
2260
|
+
checked,
|
|
2261
|
+
...props
|
|
2262
|
+
}) {
|
|
2263
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2264
|
+
menu.Menu.CheckboxItem,
|
|
2265
|
+
{
|
|
2266
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
2267
|
+
className: cn(
|
|
2268
|
+
"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",
|
|
2269
|
+
className
|
|
2270
|
+
),
|
|
2271
|
+
checked,
|
|
2272
|
+
...props,
|
|
2273
|
+
children: [
|
|
2274
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2275
|
+
"span",
|
|
2276
|
+
{
|
|
2277
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
|
|
2278
|
+
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
2279
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconCheck, {}) })
|
|
2280
|
+
}
|
|
2281
|
+
),
|
|
2282
|
+
children
|
|
2283
|
+
]
|
|
2137
2284
|
}
|
|
2138
2285
|
);
|
|
2286
|
+
}
|
|
2287
|
+
function DropdownMenuSeparator({
|
|
2288
|
+
className,
|
|
2289
|
+
...props
|
|
2290
|
+
}) {
|
|
2291
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2292
|
+
menu.Menu.Separator,
|
|
2293
|
+
{
|
|
2294
|
+
"data-slot": "dropdown-menu-separator",
|
|
2295
|
+
className: cn("bg-border/50 -mx-1 my-1 h-px", className),
|
|
2296
|
+
...props
|
|
2297
|
+
}
|
|
2298
|
+
);
|
|
2299
|
+
}
|
|
2300
|
+
var Dropdown = ({ items = [], children }) => {
|
|
2301
|
+
const { sendEvent } = useMelony();
|
|
2302
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
2303
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2304
|
+
DropdownMenuTrigger,
|
|
2305
|
+
{
|
|
2306
|
+
render: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2307
|
+
Button,
|
|
2308
|
+
{
|
|
2309
|
+
variant: "outline",
|
|
2310
|
+
size: "icon-sm",
|
|
2311
|
+
...props,
|
|
2312
|
+
onClick: (e) => {
|
|
2313
|
+
e.stopPropagation();
|
|
2314
|
+
props.onClick?.(e);
|
|
2315
|
+
},
|
|
2316
|
+
children: children || /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconDotsVertical, { className: "size-3.5" })
|
|
2317
|
+
}
|
|
2318
|
+
)
|
|
2319
|
+
}
|
|
2320
|
+
),
|
|
2321
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent, { align: "start", className: cn("w-32"), children: items.map((item, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2322
|
+
DropdownMenuItem,
|
|
2323
|
+
{
|
|
2324
|
+
onClick: (e) => {
|
|
2325
|
+
e.stopPropagation();
|
|
2326
|
+
if (item.onClickAction) {
|
|
2327
|
+
sendEvent(item.onClickAction);
|
|
2328
|
+
}
|
|
2329
|
+
},
|
|
2330
|
+
children: [
|
|
2331
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: item.icon, size: "sm" }),
|
|
2332
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: item.icon ? "ml-2" : "", children: item.label })
|
|
2333
|
+
]
|
|
2334
|
+
},
|
|
2335
|
+
`${item.label}-${i}`
|
|
2336
|
+
)) })
|
|
2337
|
+
] });
|
|
2139
2338
|
};
|
|
2140
2339
|
function UIRenderer({ node }) {
|
|
2141
2340
|
const { type, props, children } = node;
|
|
@@ -2166,7 +2365,8 @@ function UIRenderer({ node }) {
|
|
|
2166
2365
|
form: Form,
|
|
2167
2366
|
chart: Chart,
|
|
2168
2367
|
label: Label2,
|
|
2169
|
-
upload: Upload
|
|
2368
|
+
upload: Upload,
|
|
2369
|
+
dropdown: Dropdown
|
|
2170
2370
|
};
|
|
2171
2371
|
const Component = typeMap[type];
|
|
2172
2372
|
if (!Component) {
|
|
@@ -2349,123 +2549,6 @@ var useAuth = () => {
|
|
|
2349
2549
|
}
|
|
2350
2550
|
return context;
|
|
2351
2551
|
};
|
|
2352
|
-
function DropdownMenu({ ...props }) {
|
|
2353
|
-
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
2354
|
-
}
|
|
2355
|
-
function DropdownMenuTrigger({ ...props }) {
|
|
2356
|
-
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
2357
|
-
}
|
|
2358
|
-
function DropdownMenuContent({
|
|
2359
|
-
align = "start",
|
|
2360
|
-
alignOffset = 0,
|
|
2361
|
-
side = "bottom",
|
|
2362
|
-
sideOffset = 4,
|
|
2363
|
-
className,
|
|
2364
|
-
...props
|
|
2365
|
-
}) {
|
|
2366
|
-
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2367
|
-
menu.Menu.Positioner,
|
|
2368
|
-
{
|
|
2369
|
-
className: "isolate z-50 outline-none",
|
|
2370
|
-
align,
|
|
2371
|
-
alignOffset,
|
|
2372
|
-
side,
|
|
2373
|
-
sideOffset,
|
|
2374
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2375
|
-
menu.Menu.Popup,
|
|
2376
|
-
{
|
|
2377
|
-
"data-slot": "dropdown-menu-content",
|
|
2378
|
-
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),
|
|
2379
|
-
...props
|
|
2380
|
-
}
|
|
2381
|
-
)
|
|
2382
|
-
}
|
|
2383
|
-
) });
|
|
2384
|
-
}
|
|
2385
|
-
function DropdownMenuGroup({ ...props }) {
|
|
2386
|
-
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
2387
|
-
}
|
|
2388
|
-
function DropdownMenuLabel({
|
|
2389
|
-
className,
|
|
2390
|
-
inset,
|
|
2391
|
-
...props
|
|
2392
|
-
}) {
|
|
2393
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2394
|
-
menu.Menu.GroupLabel,
|
|
2395
|
-
{
|
|
2396
|
-
"data-slot": "dropdown-menu-label",
|
|
2397
|
-
"data-inset": inset,
|
|
2398
|
-
className: cn("text-muted-foreground px-3 py-2.5 text-xs data-[inset]:pl-8", className),
|
|
2399
|
-
...props
|
|
2400
|
-
}
|
|
2401
|
-
);
|
|
2402
|
-
}
|
|
2403
|
-
function DropdownMenuItem({
|
|
2404
|
-
className,
|
|
2405
|
-
inset,
|
|
2406
|
-
variant = "default",
|
|
2407
|
-
...props
|
|
2408
|
-
}) {
|
|
2409
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2410
|
-
menu.Menu.Item,
|
|
2411
|
-
{
|
|
2412
|
-
"data-slot": "dropdown-menu-item",
|
|
2413
|
-
"data-inset": inset,
|
|
2414
|
-
"data-variant": variant,
|
|
2415
|
-
className: cn(
|
|
2416
|
-
"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",
|
|
2417
|
-
className
|
|
2418
|
-
),
|
|
2419
|
-
...props
|
|
2420
|
-
}
|
|
2421
|
-
);
|
|
2422
|
-
}
|
|
2423
|
-
function DropdownMenuCheckboxItem({
|
|
2424
|
-
className,
|
|
2425
|
-
children,
|
|
2426
|
-
checked,
|
|
2427
|
-
...props
|
|
2428
|
-
}) {
|
|
2429
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2430
|
-
menu.Menu.CheckboxItem,
|
|
2431
|
-
{
|
|
2432
|
-
"data-slot": "dropdown-menu-checkbox-item",
|
|
2433
|
-
className: cn(
|
|
2434
|
-
"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",
|
|
2435
|
-
className
|
|
2436
|
-
),
|
|
2437
|
-
checked,
|
|
2438
|
-
...props,
|
|
2439
|
-
children: [
|
|
2440
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2441
|
-
"span",
|
|
2442
|
-
{
|
|
2443
|
-
className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
|
|
2444
|
-
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
2445
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2446
|
-
ICONS.IconCheck,
|
|
2447
|
-
{}
|
|
2448
|
-
) })
|
|
2449
|
-
}
|
|
2450
|
-
),
|
|
2451
|
-
children
|
|
2452
|
-
]
|
|
2453
|
-
}
|
|
2454
|
-
);
|
|
2455
|
-
}
|
|
2456
|
-
function DropdownMenuSeparator({
|
|
2457
|
-
className,
|
|
2458
|
-
...props
|
|
2459
|
-
}) {
|
|
2460
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2461
|
-
menu.Menu.Separator,
|
|
2462
|
-
{
|
|
2463
|
-
"data-slot": "dropdown-menu-separator",
|
|
2464
|
-
className: cn("bg-border/50 -mx-1 my-1 h-px", className),
|
|
2465
|
-
...props
|
|
2466
|
-
}
|
|
2467
|
-
);
|
|
2468
|
-
}
|
|
2469
2552
|
var AccountButton = ({
|
|
2470
2553
|
className,
|
|
2471
2554
|
variant = "outline",
|
|
@@ -3341,9 +3424,7 @@ function Composer({
|
|
|
3341
3424
|
] })
|
|
3342
3425
|
] }) });
|
|
3343
3426
|
}
|
|
3344
|
-
function StarterPrompts({
|
|
3345
|
-
prompts
|
|
3346
|
-
}) {
|
|
3427
|
+
function StarterPrompts({ prompts }) {
|
|
3347
3428
|
if (!prompts || prompts.length === 0) {
|
|
3348
3429
|
return null;
|
|
3349
3430
|
}
|
|
@@ -3497,57 +3578,46 @@ function Thread({
|
|
|
3497
3578
|
});
|
|
3498
3579
|
};
|
|
3499
3580
|
const showStarterPrompts = messages.length === 0 && starterPrompts && starterPrompts.length > 0 && !isLoadingEvents;
|
|
3500
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3501
|
-
"div",
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
"
|
|
3508
|
-
{
|
|
3509
|
-
className: cn(
|
|
3510
|
-
"max-w-[48rem] mx-auto w-full p-4",
|
|
3511
|
-
showStarterPrompts && "min-h-full flex flex-col"
|
|
3512
|
-
),
|
|
3513
|
-
children: isLoadingEvents && messages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingIndicator, { status: { message: "Loading messages..." } }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3514
|
-
showStarterPrompts && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3515
|
-
StarterPrompts,
|
|
3516
|
-
{
|
|
3517
|
-
prompts: starterPrompts
|
|
3518
|
-
}
|
|
3519
|
-
),
|
|
3520
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3521
|
-
MessageList,
|
|
3522
|
-
{
|
|
3523
|
-
messages,
|
|
3524
|
-
isLoading,
|
|
3525
|
-
error,
|
|
3526
|
-
loadingStatus
|
|
3527
|
-
}
|
|
3528
|
-
)
|
|
3529
|
-
] })
|
|
3530
|
-
}
|
|
3581
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col h-full bg-background flex-1 overflow-hidden", children: [
|
|
3582
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-y-auto p-4 pb-36", children: [
|
|
3583
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3584
|
+
"div",
|
|
3585
|
+
{
|
|
3586
|
+
className: cn(
|
|
3587
|
+
"max-w-[48rem] mx-auto w-full p-4",
|
|
3588
|
+
showStarterPrompts && "min-h-full flex flex-col"
|
|
3531
3589
|
),
|
|
3532
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3590
|
+
children: isLoadingEvents && messages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingIndicator, { status: { message: "Loading messages..." } }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3591
|
+
showStarterPrompts && /* @__PURE__ */ jsxRuntime.jsx(StarterPrompts, { prompts: starterPrompts }),
|
|
3592
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3593
|
+
MessageList,
|
|
3594
|
+
{
|
|
3595
|
+
messages,
|
|
3596
|
+
isLoading,
|
|
3597
|
+
error,
|
|
3598
|
+
loadingStatus
|
|
3599
|
+
}
|
|
3600
|
+
)
|
|
3601
|
+
] })
|
|
3602
|
+
}
|
|
3603
|
+
),
|
|
3604
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: messagesEndRef })
|
|
3605
|
+
] }),
|
|
3606
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-0 p-4 w-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[48rem] mx-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3607
|
+
Composer,
|
|
3608
|
+
{
|
|
3609
|
+
value: input,
|
|
3610
|
+
onChange: setInput,
|
|
3611
|
+
onSubmit: handleSubmit,
|
|
3612
|
+
placeholder,
|
|
3613
|
+
isLoading,
|
|
3614
|
+
options,
|
|
3615
|
+
autoFocus,
|
|
3616
|
+
defaultSelectedIds: allDefaultSelectedIds,
|
|
3617
|
+
fileAttachments
|
|
3618
|
+
}
|
|
3619
|
+
) }) })
|
|
3620
|
+
] });
|
|
3551
3621
|
}
|
|
3552
3622
|
function ChatHeader({
|
|
3553
3623
|
leftContent,
|
|
@@ -3581,40 +3651,13 @@ function ChatHeader({
|
|
|
3581
3651
|
}
|
|
3582
3652
|
);
|
|
3583
3653
|
}
|
|
3584
|
-
var
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3654
|
+
var ThreadList = ({
|
|
3655
|
+
padding,
|
|
3656
|
+
background,
|
|
3657
|
+
gap,
|
|
3658
|
+
radius = "md"
|
|
3589
3659
|
}) => {
|
|
3590
|
-
|
|
3591
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3592
|
-
DropdownMenuTrigger,
|
|
3593
|
-
{
|
|
3594
|
-
className: triggerClassName,
|
|
3595
|
-
render: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3596
|
-
Button,
|
|
3597
|
-
{
|
|
3598
|
-
variant: "ghost",
|
|
3599
|
-
size: "icon-xs",
|
|
3600
|
-
...props,
|
|
3601
|
-
onClick: (e) => {
|
|
3602
|
-
e.stopPropagation();
|
|
3603
|
-
props.onClick?.(e);
|
|
3604
|
-
},
|
|
3605
|
-
children: trigger || /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconDotsVertical, { className: "size-3.5" })
|
|
3606
|
-
}
|
|
3607
|
-
)
|
|
3608
|
-
}
|
|
3609
|
-
),
|
|
3610
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent, { align: "start", className: cn("w-32", className), children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { onClick: item.onClick, children: [
|
|
3611
|
-
item.icon,
|
|
3612
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
3613
|
-
] }, item.label)) })
|
|
3614
|
-
] });
|
|
3615
|
-
};
|
|
3616
|
-
var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
3617
|
-
const { threads, activeThreadId, deleteThread } = useThreads();
|
|
3660
|
+
const { threads, activeThreadId } = useThreads();
|
|
3618
3661
|
const sortedThreads = React3__namespace.useMemo(() => {
|
|
3619
3662
|
return [...threads].sort((a, b) => {
|
|
3620
3663
|
const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
@@ -3622,16 +3665,9 @@ var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
|
3622
3665
|
return dateB - dateA;
|
|
3623
3666
|
});
|
|
3624
3667
|
}, [threads]);
|
|
3625
|
-
const handleDelete = async (threadId) => {
|
|
3626
|
-
try {
|
|
3627
|
-
await deleteThread(threadId);
|
|
3628
|
-
} catch (error) {
|
|
3629
|
-
console.error("Failed to delete thread:", error);
|
|
3630
|
-
}
|
|
3631
|
-
};
|
|
3632
3668
|
return /* @__PURE__ */ jsxRuntime.jsx(List, { padding, gap, flex: "1", overflow: "scroll", children: sortedThreads.map((thread) => {
|
|
3633
|
-
thread.id === activeThreadId;
|
|
3634
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
3669
|
+
const isActive = thread.id === activeThreadId;
|
|
3670
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3635
3671
|
ListItem,
|
|
3636
3672
|
{
|
|
3637
3673
|
onClickAction: {
|
|
@@ -3640,25 +3676,28 @@ var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
|
3640
3676
|
url: `?threadId=${thread.id}`
|
|
3641
3677
|
}
|
|
3642
3678
|
},
|
|
3643
|
-
background,
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
children: [
|
|
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)}` }) }),
|
|
3649
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 flex items-center opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3679
|
+
background: isActive ? "primary" : "transparent",
|
|
3680
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { group: true, width: "full", children: [
|
|
3681
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0 pr-4", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium truncate", children: thread.title || `Thread ${thread.id.slice(0, 8)}` }) }),
|
|
3682
|
+
/* @__PURE__ */ jsxRuntime.jsx(Float, { position: "right-center", showOnHover: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3650
3683
|
Dropdown,
|
|
3651
3684
|
{
|
|
3652
3685
|
items: [
|
|
3653
3686
|
{
|
|
3654
3687
|
label: "Delete",
|
|
3655
|
-
icon:
|
|
3656
|
-
|
|
3688
|
+
icon: "trash",
|
|
3689
|
+
onClickAction: {
|
|
3690
|
+
role: "system",
|
|
3691
|
+
type: "delete-thread",
|
|
3692
|
+
data: {
|
|
3693
|
+
threadId: thread.id
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3657
3696
|
}
|
|
3658
3697
|
]
|
|
3659
3698
|
}
|
|
3660
3699
|
) })
|
|
3661
|
-
]
|
|
3700
|
+
] })
|
|
3662
3701
|
},
|
|
3663
3702
|
thread.id
|
|
3664
3703
|
);
|
|
@@ -3870,14 +3909,7 @@ var ThreadPopover = ({}) => {
|
|
|
3870
3909
|
}
|
|
3871
3910
|
);
|
|
3872
3911
|
return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
3873
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3874
|
-
Button,
|
|
3875
|
-
{
|
|
3876
|
-
variant: "ghost",
|
|
3877
|
-
size: "icon",
|
|
3878
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconHistory, { className: "size-4" })
|
|
3879
|
-
}
|
|
3880
|
-
) }),
|
|
3912
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconHistory, { className: "size-4" }) }) }),
|
|
3881
3913
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3882
3914
|
PopoverContent,
|
|
3883
3915
|
{
|