@melony/react 0.1.53 → 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 +275 -253
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -6
- package/dist/index.d.ts +4 -6
- package/dist/index.js +276 -254
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -51,10 +51,7 @@ function DialogOverlay({
|
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
|
-
function DialogContent({
|
|
55
|
-
className,
|
|
56
|
-
...props
|
|
57
|
-
}) {
|
|
54
|
+
function DialogContent({ className, ...props }) {
|
|
58
55
|
return /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
59
56
|
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
60
57
|
/* @__PURE__ */ jsx(
|
|
@@ -70,10 +67,7 @@ function DialogContent({
|
|
|
70
67
|
)
|
|
71
68
|
] });
|
|
72
69
|
}
|
|
73
|
-
function DialogClose({
|
|
74
|
-
className,
|
|
75
|
-
...props
|
|
76
|
-
}) {
|
|
70
|
+
function DialogClose({ className, ...props }) {
|
|
77
71
|
return /* @__PURE__ */ jsx(
|
|
78
72
|
Dialog$1.Close,
|
|
79
73
|
{
|
|
@@ -86,10 +80,7 @@ function DialogClose({
|
|
|
86
80
|
}
|
|
87
81
|
);
|
|
88
82
|
}
|
|
89
|
-
function DialogHeader({
|
|
90
|
-
className,
|
|
91
|
-
...props
|
|
92
|
-
}) {
|
|
83
|
+
function DialogHeader({ className, ...props }) {
|
|
93
84
|
return /* @__PURE__ */ jsx(
|
|
94
85
|
"div",
|
|
95
86
|
{
|
|
@@ -141,7 +132,10 @@ function Card({
|
|
|
141
132
|
{
|
|
142
133
|
"data-slot": "card",
|
|
143
134
|
"data-size": size,
|
|
144
|
-
className: cn(
|
|
135
|
+
className: cn(
|
|
136
|
+
"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",
|
|
137
|
+
className
|
|
138
|
+
),
|
|
145
139
|
...props
|
|
146
140
|
}
|
|
147
141
|
);
|
|
@@ -416,7 +410,8 @@ var Box = ({
|
|
|
416
410
|
radius = "none",
|
|
417
411
|
width = "auto",
|
|
418
412
|
height = "auto",
|
|
419
|
-
shadow = "none"
|
|
413
|
+
shadow = "none",
|
|
414
|
+
group = false
|
|
420
415
|
}) => {
|
|
421
416
|
return /* @__PURE__ */ jsx(
|
|
422
417
|
"div",
|
|
@@ -431,7 +426,8 @@ var Box = ({
|
|
|
431
426
|
radiusMap[radius],
|
|
432
427
|
widthMap[width],
|
|
433
428
|
height === "full" && "h-full",
|
|
434
|
-
shadowMap[shadow]
|
|
429
|
+
shadowMap[shadow],
|
|
430
|
+
group && "group"
|
|
435
431
|
),
|
|
436
432
|
children
|
|
437
433
|
}
|
|
@@ -445,11 +441,15 @@ var Float = ({
|
|
|
445
441
|
showOnHover = false
|
|
446
442
|
}) => {
|
|
447
443
|
const positionClasses = {
|
|
448
|
-
"top-left": "top-
|
|
449
|
-
"top-right": "top-
|
|
450
|
-
"
|
|
451
|
-
"bottom-
|
|
452
|
-
"
|
|
444
|
+
"top-left": "top-1 left-1",
|
|
445
|
+
"top-right": "top-1 right-1",
|
|
446
|
+
"top-center": "top-1 left-1/2 -translate-x-1/2",
|
|
447
|
+
"bottom-left": "bottom-1 left-1",
|
|
448
|
+
"bottom-right": "bottom-1 right-1",
|
|
449
|
+
"bottom-center": "bottom-1 left-1/2 -translate-x-1/2",
|
|
450
|
+
center: "top- 1 / 2 left - 1/2 -tra nslate-x-1/2 -translate-y-1/2",
|
|
451
|
+
"left-center": "top-1/2 left-1 -translate-y-1/2",
|
|
452
|
+
"right-center": "top-1/2 right-1 -translate-y-1/2"
|
|
453
453
|
};
|
|
454
454
|
const marginXClass = position.endsWith("left") ? marginMap[offsetX].replace("m-", "ml-") : marginMap[offsetX].replace("m-", "mr-");
|
|
455
455
|
const marginYClass = position.startsWith("top") ? marginMap[offsetY].replace("m-", "mt-") : marginMap[offsetY].replace("m-", "mb-");
|
|
@@ -508,10 +508,7 @@ var Divider = ({
|
|
|
508
508
|
Separator,
|
|
509
509
|
{
|
|
510
510
|
orientation,
|
|
511
|
-
className: cn(
|
|
512
|
-
marginMap[margin],
|
|
513
|
-
colorBgMap[color]
|
|
514
|
-
)
|
|
511
|
+
className: cn(marginMap[margin], colorBgMap[color])
|
|
515
512
|
}
|
|
516
513
|
);
|
|
517
514
|
};
|
|
@@ -731,6 +728,7 @@ var Video = ({
|
|
|
731
728
|
muted = false,
|
|
732
729
|
aspectRatio = "16/9",
|
|
733
730
|
width = "full",
|
|
731
|
+
height = "auto",
|
|
734
732
|
radius = "lg"
|
|
735
733
|
}) => {
|
|
736
734
|
const aspectRatios = {
|
|
@@ -748,6 +746,7 @@ var Video = ({
|
|
|
748
746
|
widthMap[width],
|
|
749
747
|
radiusMap[radius]
|
|
750
748
|
),
|
|
749
|
+
style: { height },
|
|
751
750
|
children: /* @__PURE__ */ jsx(
|
|
752
751
|
"video",
|
|
753
752
|
{
|
|
@@ -777,13 +776,16 @@ var Icon = ({
|
|
|
777
776
|
lg: 24
|
|
778
777
|
};
|
|
779
778
|
const resolvedSize = typeof size === "number" ? size : sizeMap[size] || 20;
|
|
780
|
-
return /* @__PURE__ */ jsx(
|
|
781
|
-
|
|
779
|
+
return /* @__PURE__ */ jsx(
|
|
780
|
+
"div",
|
|
782
781
|
{
|
|
783
|
-
|
|
784
|
-
|
|
782
|
+
className: cn(
|
|
783
|
+
"inline-flex items-center justify-center",
|
|
784
|
+
colorTextMap[color]
|
|
785
|
+
),
|
|
786
|
+
children: /* @__PURE__ */ jsx(IconComponent, { size: resolvedSize, strokeWidth: 1.5 })
|
|
785
787
|
}
|
|
786
|
-
)
|
|
788
|
+
);
|
|
787
789
|
};
|
|
788
790
|
var badgeVariants = cva(
|
|
789
791
|
"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",
|
|
@@ -940,41 +942,60 @@ var Chart = ({
|
|
|
940
942
|
const totalBarSpace = chartWidth - padding.left - padding.right;
|
|
941
943
|
const barSpacing = data.length > 1 ? totalBarSpace * 0.1 / data.length : 0;
|
|
942
944
|
const actualBarWidth = (totalBarSpace - barSpacing * (data.length + 1)) / data.length;
|
|
943
|
-
return /* @__PURE__ */ jsxs(
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
945
|
+
return /* @__PURE__ */ jsxs(
|
|
946
|
+
"svg",
|
|
947
|
+
{
|
|
948
|
+
viewBox: `0 0 ${chartWidth} ${chartHeight + padding.bottom}`,
|
|
949
|
+
className: "w-full h-auto overflow-visible",
|
|
950
|
+
children: [
|
|
951
|
+
renderGrid(),
|
|
952
|
+
data.map((item, index) => {
|
|
953
|
+
const barHeight = item.value / maxValue * chartHeight;
|
|
954
|
+
const x = padding.left + barSpacing + index * (actualBarWidth + barSpacing);
|
|
955
|
+
const y = padding.top + chartHeight - barHeight;
|
|
956
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
957
|
+
/* @__PURE__ */ jsx(
|
|
958
|
+
"rect",
|
|
959
|
+
{
|
|
960
|
+
x,
|
|
961
|
+
y,
|
|
962
|
+
width: actualBarWidth,
|
|
963
|
+
height: barHeight,
|
|
964
|
+
fill: getColor(index, item.color),
|
|
965
|
+
rx: 4,
|
|
966
|
+
onMouseEnter: () => showTooltips && setTooltip({
|
|
967
|
+
visible: true,
|
|
968
|
+
x: x + actualBarWidth / 2,
|
|
969
|
+
y: y - 5,
|
|
970
|
+
label: item.label,
|
|
971
|
+
value: item.value
|
|
972
|
+
}),
|
|
973
|
+
onMouseLeave: () => setTooltip({
|
|
974
|
+
visible: false,
|
|
975
|
+
x: 0,
|
|
976
|
+
y: 0,
|
|
977
|
+
label: "",
|
|
978
|
+
value: 0
|
|
979
|
+
}),
|
|
980
|
+
className: "transition-all hover:opacity-80 cursor-pointer"
|
|
981
|
+
}
|
|
982
|
+
),
|
|
983
|
+
/* @__PURE__ */ jsx(
|
|
984
|
+
"text",
|
|
985
|
+
{
|
|
986
|
+
x: x + actualBarWidth / 2,
|
|
987
|
+
y: padding.top + chartHeight + 20,
|
|
988
|
+
textAnchor: "middle",
|
|
989
|
+
className: "fill-muted-foreground text-[10px]",
|
|
990
|
+
children: item.label
|
|
991
|
+
}
|
|
992
|
+
)
|
|
993
|
+
] }, index);
|
|
994
|
+
}),
|
|
995
|
+
showTooltips && renderTooltip()
|
|
996
|
+
]
|
|
997
|
+
}
|
|
998
|
+
);
|
|
978
999
|
};
|
|
979
1000
|
const renderLineChart = () => {
|
|
980
1001
|
const points = data.map((item, index) => ({
|
|
@@ -983,37 +1004,59 @@ var Chart = ({
|
|
|
983
1004
|
...item
|
|
984
1005
|
}));
|
|
985
1006
|
const pathData = points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
986
|
-
return /* @__PURE__ */ jsxs(
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1007
|
+
return /* @__PURE__ */ jsxs(
|
|
1008
|
+
"svg",
|
|
1009
|
+
{
|
|
1010
|
+
viewBox: `0 0 ${chartWidth} ${chartHeight + padding.bottom}`,
|
|
1011
|
+
className: "w-full h-auto overflow-visible",
|
|
1012
|
+
children: [
|
|
1013
|
+
renderGrid(),
|
|
1014
|
+
/* @__PURE__ */ jsx(
|
|
1015
|
+
"path",
|
|
1016
|
+
{
|
|
1017
|
+
d: pathData,
|
|
1018
|
+
fill: "none",
|
|
1019
|
+
stroke: getColor(0),
|
|
1020
|
+
strokeWidth: 3,
|
|
1021
|
+
className: "transition-all"
|
|
1022
|
+
}
|
|
1023
|
+
),
|
|
1024
|
+
points.map((point, index) => /* @__PURE__ */ jsxs("g", { children: [
|
|
1025
|
+
/* @__PURE__ */ jsx(
|
|
1026
|
+
"circle",
|
|
1027
|
+
{
|
|
1028
|
+
cx: point.x,
|
|
1029
|
+
cy: point.y,
|
|
1030
|
+
r: 5,
|
|
1031
|
+
fill: getColor(index, point.color),
|
|
1032
|
+
stroke: "hsl(var(--background))",
|
|
1033
|
+
strokeWidth: 2,
|
|
1034
|
+
onMouseEnter: () => showTooltips && setTooltip({
|
|
1035
|
+
visible: true,
|
|
1036
|
+
x: point.x,
|
|
1037
|
+
y: point.y - 5,
|
|
1038
|
+
label: point.label,
|
|
1039
|
+
value: point.value
|
|
1040
|
+
}),
|
|
1041
|
+
onMouseLeave: () => setTooltip({ visible: false, x: 0, y: 0, label: "", value: 0 }),
|
|
1042
|
+
className: "hover:r-6 transition-all cursor-pointer"
|
|
1043
|
+
}
|
|
1044
|
+
),
|
|
1045
|
+
/* @__PURE__ */ jsx(
|
|
1046
|
+
"text",
|
|
1047
|
+
{
|
|
1048
|
+
x: point.x,
|
|
1049
|
+
y: padding.top + chartHeight + 20,
|
|
1050
|
+
textAnchor: "middle",
|
|
1051
|
+
className: "fill-muted-foreground text-[10px]",
|
|
1052
|
+
children: point.label
|
|
1053
|
+
}
|
|
1054
|
+
)
|
|
1055
|
+
] }, index)),
|
|
1056
|
+
showTooltips && renderTooltip()
|
|
1057
|
+
]
|
|
1058
|
+
}
|
|
1059
|
+
);
|
|
1017
1060
|
};
|
|
1018
1061
|
const renderChart = () => {
|
|
1019
1062
|
switch (chartType) {
|
|
@@ -1103,18 +1146,21 @@ function Label({ className, ...props }) {
|
|
|
1103
1146
|
}
|
|
1104
1147
|
);
|
|
1105
1148
|
}
|
|
1106
|
-
var fieldVariants = cva(
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1149
|
+
var fieldVariants = cva(
|
|
1150
|
+
"data-[invalid=true]:text-destructive gap-3 group/field flex w-full",
|
|
1151
|
+
{
|
|
1152
|
+
variants: {
|
|
1153
|
+
orientation: {
|
|
1154
|
+
vertical: "flex-col [&>*]:w-full [&>.sr-only]:w-auto",
|
|
1155
|
+
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",
|
|
1156
|
+
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"
|
|
1157
|
+
}
|
|
1158
|
+
},
|
|
1159
|
+
defaultVariants: {
|
|
1160
|
+
orientation: "vertical"
|
|
1161
|
+
}
|
|
1116
1162
|
}
|
|
1117
|
-
|
|
1163
|
+
);
|
|
1118
1164
|
function Field({
|
|
1119
1165
|
className,
|
|
1120
1166
|
orientation = "vertical",
|
|
@@ -1305,7 +1351,10 @@ function SelectContent({
|
|
|
1305
1351
|
Select$1.Popup,
|
|
1306
1352
|
{
|
|
1307
1353
|
"data-slot": "select-content",
|
|
1308
|
-
className: cn(
|
|
1354
|
+
className: cn(
|
|
1355
|
+
"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",
|
|
1356
|
+
className
|
|
1357
|
+
),
|
|
1309
1358
|
...props,
|
|
1310
1359
|
children: [
|
|
1311
1360
|
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
@@ -1352,12 +1401,12 @@ function SelectScrollUpButton({
|
|
|
1352
1401
|
Select$1.ScrollUpArrow,
|
|
1353
1402
|
{
|
|
1354
1403
|
"data-slot": "select-scroll-up-button",
|
|
1355
|
-
className: cn(
|
|
1404
|
+
className: cn(
|
|
1405
|
+
"bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 top-0 w-full",
|
|
1406
|
+
className
|
|
1407
|
+
),
|
|
1356
1408
|
...props,
|
|
1357
|
-
children: /* @__PURE__ */ jsx(
|
|
1358
|
-
IconChevronUp,
|
|
1359
|
-
{}
|
|
1360
|
-
)
|
|
1409
|
+
children: /* @__PURE__ */ jsx(IconChevronUp, {})
|
|
1361
1410
|
}
|
|
1362
1411
|
);
|
|
1363
1412
|
}
|
|
@@ -1369,12 +1418,12 @@ function SelectScrollDownButton({
|
|
|
1369
1418
|
Select$1.ScrollDownArrow,
|
|
1370
1419
|
{
|
|
1371
1420
|
"data-slot": "select-scroll-down-button",
|
|
1372
|
-
className: cn(
|
|
1421
|
+
className: cn(
|
|
1422
|
+
"bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 bottom-0 w-full",
|
|
1423
|
+
className
|
|
1424
|
+
),
|
|
1373
1425
|
...props,
|
|
1374
|
-
children: /* @__PURE__ */ jsx(
|
|
1375
|
-
IconChevronDown,
|
|
1376
|
-
{}
|
|
1377
|
-
)
|
|
1426
|
+
children: /* @__PURE__ */ jsx(IconChevronDown, {})
|
|
1378
1427
|
}
|
|
1379
1428
|
);
|
|
1380
1429
|
}
|
|
@@ -1830,37 +1879,30 @@ var RadioGroup = ({
|
|
|
1830
1879
|
children: options.map((option, index) => {
|
|
1831
1880
|
const radioId = `${name}-${index}`;
|
|
1832
1881
|
const isDisabled = disabled || option.disabled;
|
|
1833
|
-
return /* @__PURE__ */ jsxs(
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
color: isDisabled ? "muted" : "foreground"
|
|
1858
|
-
}
|
|
1859
|
-
)
|
|
1860
|
-
]
|
|
1861
|
-
},
|
|
1862
|
-
index
|
|
1863
|
-
);
|
|
1882
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1883
|
+
/* @__PURE__ */ jsx(
|
|
1884
|
+
"input",
|
|
1885
|
+
{
|
|
1886
|
+
type: "radio",
|
|
1887
|
+
name,
|
|
1888
|
+
id: radioId,
|
|
1889
|
+
value: option.value,
|
|
1890
|
+
defaultChecked: defaultValue === option.value,
|
|
1891
|
+
disabled: isDisabled,
|
|
1892
|
+
onChange: handleChange,
|
|
1893
|
+
className: "h-4 w-4 border-gray-300 text-primary focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50"
|
|
1894
|
+
}
|
|
1895
|
+
),
|
|
1896
|
+
/* @__PURE__ */ jsx(
|
|
1897
|
+
Label2,
|
|
1898
|
+
{
|
|
1899
|
+
htmlFor: radioId,
|
|
1900
|
+
value: option.label,
|
|
1901
|
+
size: "sm",
|
|
1902
|
+
color: isDisabled ? "muted" : "foreground"
|
|
1903
|
+
}
|
|
1904
|
+
)
|
|
1905
|
+
] }, index);
|
|
1864
1906
|
})
|
|
1865
1907
|
}
|
|
1866
1908
|
)
|
|
@@ -2048,7 +2090,16 @@ var Upload = ({
|
|
|
2048
2090
|
}
|
|
2049
2091
|
),
|
|
2050
2092
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 mb-2 items-center", children: [
|
|
2051
|
-
showInitialFiles && initialFiles?.map((file, index) => /* @__PURE__ */ jsx(
|
|
2093
|
+
showInitialFiles && initialFiles?.map((file, index) => /* @__PURE__ */ jsx(
|
|
2094
|
+
Image,
|
|
2095
|
+
{
|
|
2096
|
+
src: file.url,
|
|
2097
|
+
alt: file.name,
|
|
2098
|
+
width: "min",
|
|
2099
|
+
radius: "md"
|
|
2100
|
+
},
|
|
2101
|
+
index
|
|
2102
|
+
)),
|
|
2052
2103
|
displayEvents.map(
|
|
2053
2104
|
(event, index) => event.ui ? /* @__PURE__ */ jsx(UIRenderer, { node: event.ui }, index) : null
|
|
2054
2105
|
),
|
|
@@ -2068,11 +2119,7 @@ var Upload = ({
|
|
|
2068
2119
|
] })
|
|
2069
2120
|
] });
|
|
2070
2121
|
};
|
|
2071
|
-
var Form = ({
|
|
2072
|
-
children,
|
|
2073
|
-
onSubmitAction,
|
|
2074
|
-
gap = "md"
|
|
2075
|
-
}) => {
|
|
2122
|
+
var Form = ({ children, onSubmitAction, gap = "md" }) => {
|
|
2076
2123
|
const { sendEvent } = useMelony();
|
|
2077
2124
|
const [isSubmitted, setIsSubmitted] = useState(false);
|
|
2078
2125
|
const handleSubmit = (e) => {
|
|
@@ -2098,24 +2145,17 @@ var Form = ({
|
|
|
2098
2145
|
}
|
|
2099
2146
|
}
|
|
2100
2147
|
};
|
|
2101
|
-
return /* @__PURE__ */ jsx(
|
|
2102
|
-
"
|
|
2148
|
+
return /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, className: "w-full", children: /* @__PURE__ */ jsx("fieldset", { disabled: isSubmitted, className: "m-0 border-0 p-0", children: /* @__PURE__ */ jsx(
|
|
2149
|
+
"div",
|
|
2103
2150
|
{
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
"
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
"flex flex-col transition-opacity",
|
|
2111
|
-
gapMap[gap],
|
|
2112
|
-
isSubmitted && "opacity-60 pointer-events-none"
|
|
2113
|
-
),
|
|
2114
|
-
children
|
|
2115
|
-
}
|
|
2116
|
-
) })
|
|
2151
|
+
className: cn(
|
|
2152
|
+
"flex flex-col transition-opacity",
|
|
2153
|
+
gapMap[gap],
|
|
2154
|
+
isSubmitted && "opacity-60 pointer-events-none"
|
|
2155
|
+
),
|
|
2156
|
+
children
|
|
2117
2157
|
}
|
|
2118
|
-
);
|
|
2158
|
+
) }) });
|
|
2119
2159
|
};
|
|
2120
2160
|
function DropdownMenu({ ...props }) {
|
|
2121
2161
|
return /* @__PURE__ */ jsx(Menu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
@@ -2143,7 +2183,10 @@ function DropdownMenuContent({
|
|
|
2143
2183
|
Menu.Popup,
|
|
2144
2184
|
{
|
|
2145
2185
|
"data-slot": "dropdown-menu-content",
|
|
2146
|
-
className: cn(
|
|
2186
|
+
className: cn(
|
|
2187
|
+
"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",
|
|
2188
|
+
className
|
|
2189
|
+
),
|
|
2147
2190
|
...props
|
|
2148
2191
|
}
|
|
2149
2192
|
)
|
|
@@ -2163,7 +2206,10 @@ function DropdownMenuLabel({
|
|
|
2163
2206
|
{
|
|
2164
2207
|
"data-slot": "dropdown-menu-label",
|
|
2165
2208
|
"data-inset": inset,
|
|
2166
|
-
className: cn(
|
|
2209
|
+
className: cn(
|
|
2210
|
+
"text-muted-foreground px-3 py-2.5 text-xs data-[inset]:pl-8",
|
|
2211
|
+
className
|
|
2212
|
+
),
|
|
2167
2213
|
...props
|
|
2168
2214
|
}
|
|
2169
2215
|
);
|
|
@@ -2210,10 +2256,7 @@ function DropdownMenuCheckboxItem({
|
|
|
2210
2256
|
{
|
|
2211
2257
|
className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
|
|
2212
2258
|
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
2213
|
-
children: /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(
|
|
2214
|
-
IconCheck,
|
|
2215
|
-
{}
|
|
2216
|
-
) })
|
|
2259
|
+
children: /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(IconCheck, {}) })
|
|
2217
2260
|
}
|
|
2218
2261
|
),
|
|
2219
2262
|
children
|
|
@@ -2234,10 +2277,7 @@ function DropdownMenuSeparator({
|
|
|
2234
2277
|
}
|
|
2235
2278
|
);
|
|
2236
2279
|
}
|
|
2237
|
-
var Dropdown = ({
|
|
2238
|
-
items = [],
|
|
2239
|
-
children
|
|
2240
|
-
}) => {
|
|
2280
|
+
var Dropdown = ({ items = [], children }) => {
|
|
2241
2281
|
const { sendEvent } = useMelony();
|
|
2242
2282
|
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
2243
2283
|
/* @__PURE__ */ jsx(
|
|
@@ -2246,8 +2286,8 @@ var Dropdown = ({
|
|
|
2246
2286
|
render: (props) => /* @__PURE__ */ jsx(
|
|
2247
2287
|
Button,
|
|
2248
2288
|
{
|
|
2249
|
-
variant: "
|
|
2250
|
-
size: "icon-
|
|
2289
|
+
variant: "outline",
|
|
2290
|
+
size: "icon-sm",
|
|
2251
2291
|
...props,
|
|
2252
2292
|
onClick: (e) => {
|
|
2253
2293
|
e.stopPropagation();
|
|
@@ -3364,9 +3404,7 @@ function Composer({
|
|
|
3364
3404
|
] })
|
|
3365
3405
|
] }) });
|
|
3366
3406
|
}
|
|
3367
|
-
function StarterPrompts({
|
|
3368
|
-
prompts
|
|
3369
|
-
}) {
|
|
3407
|
+
function StarterPrompts({ prompts }) {
|
|
3370
3408
|
if (!prompts || prompts.length === 0) {
|
|
3371
3409
|
return null;
|
|
3372
3410
|
}
|
|
@@ -3520,57 +3558,46 @@ function Thread({
|
|
|
3520
3558
|
});
|
|
3521
3559
|
};
|
|
3522
3560
|
const showStarterPrompts = messages.length === 0 && starterPrompts && starterPrompts.length > 0 && !isLoadingEvents;
|
|
3523
|
-
return /* @__PURE__ */ jsxs(
|
|
3524
|
-
"div",
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
"
|
|
3531
|
-
{
|
|
3532
|
-
className: cn(
|
|
3533
|
-
"max-w-[48rem] mx-auto w-full p-4",
|
|
3534
|
-
showStarterPrompts && "min-h-full flex flex-col"
|
|
3535
|
-
),
|
|
3536
|
-
children: isLoadingEvents && messages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx(LoadingIndicator, { status: { message: "Loading messages..." } }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3537
|
-
showStarterPrompts && /* @__PURE__ */ jsx(
|
|
3538
|
-
StarterPrompts,
|
|
3539
|
-
{
|
|
3540
|
-
prompts: starterPrompts
|
|
3541
|
-
}
|
|
3542
|
-
),
|
|
3543
|
-
/* @__PURE__ */ jsx(
|
|
3544
|
-
MessageList,
|
|
3545
|
-
{
|
|
3546
|
-
messages,
|
|
3547
|
-
isLoading,
|
|
3548
|
-
error,
|
|
3549
|
-
loadingStatus
|
|
3550
|
-
}
|
|
3551
|
-
)
|
|
3552
|
-
] })
|
|
3553
|
-
}
|
|
3561
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col h-full bg-background flex-1 overflow-hidden", children: [
|
|
3562
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto p-4 pb-36", children: [
|
|
3563
|
+
/* @__PURE__ */ jsx(
|
|
3564
|
+
"div",
|
|
3565
|
+
{
|
|
3566
|
+
className: cn(
|
|
3567
|
+
"max-w-[48rem] mx-auto w-full p-4",
|
|
3568
|
+
showStarterPrompts && "min-h-full flex flex-col"
|
|
3554
3569
|
),
|
|
3555
|
-
/* @__PURE__ */ jsx("div", {
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3570
|
+
children: isLoadingEvents && messages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx(LoadingIndicator, { status: { message: "Loading messages..." } }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3571
|
+
showStarterPrompts && /* @__PURE__ */ jsx(StarterPrompts, { prompts: starterPrompts }),
|
|
3572
|
+
/* @__PURE__ */ jsx(
|
|
3573
|
+
MessageList,
|
|
3574
|
+
{
|
|
3575
|
+
messages,
|
|
3576
|
+
isLoading,
|
|
3577
|
+
error,
|
|
3578
|
+
loadingStatus
|
|
3579
|
+
}
|
|
3580
|
+
)
|
|
3581
|
+
] })
|
|
3582
|
+
}
|
|
3583
|
+
),
|
|
3584
|
+
/* @__PURE__ */ jsx("div", { ref: messagesEndRef })
|
|
3585
|
+
] }),
|
|
3586
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-0 p-4 w-full", children: /* @__PURE__ */ jsx("div", { className: "max-w-[48rem] mx-auto", children: /* @__PURE__ */ jsx(
|
|
3587
|
+
Composer,
|
|
3588
|
+
{
|
|
3589
|
+
value: input,
|
|
3590
|
+
onChange: setInput,
|
|
3591
|
+
onSubmit: handleSubmit,
|
|
3592
|
+
placeholder,
|
|
3593
|
+
isLoading,
|
|
3594
|
+
options,
|
|
3595
|
+
autoFocus,
|
|
3596
|
+
defaultSelectedIds: allDefaultSelectedIds,
|
|
3597
|
+
fileAttachments
|
|
3598
|
+
}
|
|
3599
|
+
) }) })
|
|
3600
|
+
] });
|
|
3574
3601
|
}
|
|
3575
3602
|
function ChatHeader({
|
|
3576
3603
|
leftContent,
|
|
@@ -3604,7 +3631,12 @@ function ChatHeader({
|
|
|
3604
3631
|
}
|
|
3605
3632
|
);
|
|
3606
3633
|
}
|
|
3607
|
-
var ThreadList = ({
|
|
3634
|
+
var ThreadList = ({
|
|
3635
|
+
padding,
|
|
3636
|
+
background,
|
|
3637
|
+
gap,
|
|
3638
|
+
radius = "md"
|
|
3639
|
+
}) => {
|
|
3608
3640
|
const { threads, activeThreadId } = useThreads();
|
|
3609
3641
|
const sortedThreads = React3.useMemo(() => {
|
|
3610
3642
|
return [...threads].sort((a, b) => {
|
|
@@ -3614,8 +3646,8 @@ var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
|
3614
3646
|
});
|
|
3615
3647
|
}, [threads]);
|
|
3616
3648
|
return /* @__PURE__ */ jsx(List, { padding, gap, flex: "1", overflow: "scroll", children: sortedThreads.map((thread) => {
|
|
3617
|
-
thread.id === activeThreadId;
|
|
3618
|
-
return /* @__PURE__ */
|
|
3649
|
+
const isActive = thread.id === activeThreadId;
|
|
3650
|
+
return /* @__PURE__ */ jsx(
|
|
3619
3651
|
ListItem,
|
|
3620
3652
|
{
|
|
3621
3653
|
onClickAction: {
|
|
@@ -3624,13 +3656,10 @@ var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
|
3624
3656
|
url: `?threadId=${thread.id}`
|
|
3625
3657
|
}
|
|
3626
3658
|
},
|
|
3627
|
-
background,
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
children: [
|
|
3632
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: thread.title || `Thread ${thread.id.slice(0, 8)}` }) }),
|
|
3633
|
-
/* @__PURE__ */ jsx("div", { className: "shrink-0 flex items-center opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsx(
|
|
3659
|
+
background: isActive ? "primary" : "transparent",
|
|
3660
|
+
children: /* @__PURE__ */ jsxs(Box, { group: true, width: "full", children: [
|
|
3661
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0 pr-4", children: /* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: thread.title || `Thread ${thread.id.slice(0, 8)}` }) }),
|
|
3662
|
+
/* @__PURE__ */ jsx(Float, { position: "right-center", showOnHover: true, children: /* @__PURE__ */ jsx(
|
|
3634
3663
|
Dropdown,
|
|
3635
3664
|
{
|
|
3636
3665
|
items: [
|
|
@@ -3648,7 +3677,7 @@ var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
|
3648
3677
|
]
|
|
3649
3678
|
}
|
|
3650
3679
|
) })
|
|
3651
|
-
]
|
|
3680
|
+
] })
|
|
3652
3681
|
},
|
|
3653
3682
|
thread.id
|
|
3654
3683
|
);
|
|
@@ -3860,14 +3889,7 @@ var ThreadPopover = ({}) => {
|
|
|
3860
3889
|
}
|
|
3861
3890
|
);
|
|
3862
3891
|
return /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
3863
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
3864
|
-
Button,
|
|
3865
|
-
{
|
|
3866
|
-
variant: "ghost",
|
|
3867
|
-
size: "icon",
|
|
3868
|
-
children: /* @__PURE__ */ jsx(IconHistory, { className: "size-4" })
|
|
3869
|
-
}
|
|
3870
|
-
) }),
|
|
3892
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ jsx(IconHistory, { className: "size-4" }) }) }),
|
|
3871
3893
|
/* @__PURE__ */ jsx(
|
|
3872
3894
|
PopoverContent,
|
|
3873
3895
|
{
|