@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.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
|
-
|
|
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"
|
|
1132
1181
|
}
|
|
1133
|
-
},
|
|
1134
|
-
defaultVariants: {
|
|
1135
|
-
orientation: "vertical"
|
|
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,17 @@ 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
|
-
"
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
"flex flex-col transition-opacity",
|
|
2131
|
-
gapMap[gap],
|
|
2132
|
-
isSubmitted && "opacity-60 pointer-events-none"
|
|
2133
|
-
),
|
|
2134
|
-
children
|
|
2135
|
-
}
|
|
2136
|
-
) })
|
|
2171
|
+
className: cn(
|
|
2172
|
+
"flex flex-col transition-opacity",
|
|
2173
|
+
gapMap[gap],
|
|
2174
|
+
isSubmitted && "opacity-60 pointer-events-none"
|
|
2175
|
+
),
|
|
2176
|
+
children
|
|
2137
2177
|
}
|
|
2138
|
-
);
|
|
2178
|
+
) }) });
|
|
2139
2179
|
};
|
|
2140
2180
|
function DropdownMenu({ ...props }) {
|
|
2141
2181
|
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
@@ -2163,7 +2203,10 @@ function DropdownMenuContent({
|
|
|
2163
2203
|
menu.Menu.Popup,
|
|
2164
2204
|
{
|
|
2165
2205
|
"data-slot": "dropdown-menu-content",
|
|
2166
|
-
className: cn(
|
|
2206
|
+
className: cn(
|
|
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
|
|
2209
|
+
),
|
|
2167
2210
|
...props
|
|
2168
2211
|
}
|
|
2169
2212
|
)
|
|
@@ -2183,7 +2226,10 @@ function DropdownMenuLabel({
|
|
|
2183
2226
|
{
|
|
2184
2227
|
"data-slot": "dropdown-menu-label",
|
|
2185
2228
|
"data-inset": inset,
|
|
2186
|
-
className: cn(
|
|
2229
|
+
className: cn(
|
|
2230
|
+
"text-muted-foreground px-3 py-2.5 text-xs data-[inset]:pl-8",
|
|
2231
|
+
className
|
|
2232
|
+
),
|
|
2187
2233
|
...props
|
|
2188
2234
|
}
|
|
2189
2235
|
);
|
|
@@ -2230,10 +2276,7 @@ function DropdownMenuCheckboxItem({
|
|
|
2230
2276
|
{
|
|
2231
2277
|
className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
|
|
2232
2278
|
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
2233
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2234
|
-
ICONS.IconCheck,
|
|
2235
|
-
{}
|
|
2236
|
-
) })
|
|
2279
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconCheck, {}) })
|
|
2237
2280
|
}
|
|
2238
2281
|
),
|
|
2239
2282
|
children
|
|
@@ -2254,10 +2297,7 @@ function DropdownMenuSeparator({
|
|
|
2254
2297
|
}
|
|
2255
2298
|
);
|
|
2256
2299
|
}
|
|
2257
|
-
var Dropdown = ({
|
|
2258
|
-
items = [],
|
|
2259
|
-
children
|
|
2260
|
-
}) => {
|
|
2300
|
+
var Dropdown = ({ items = [], children }) => {
|
|
2261
2301
|
const { sendEvent } = useMelony();
|
|
2262
2302
|
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
2263
2303
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2266,8 +2306,8 @@ var Dropdown = ({
|
|
|
2266
2306
|
render: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2267
2307
|
Button,
|
|
2268
2308
|
{
|
|
2269
|
-
variant: "
|
|
2270
|
-
size: "icon-
|
|
2309
|
+
variant: "outline",
|
|
2310
|
+
size: "icon-sm",
|
|
2271
2311
|
...props,
|
|
2272
2312
|
onClick: (e) => {
|
|
2273
2313
|
e.stopPropagation();
|
|
@@ -3384,9 +3424,7 @@ function Composer({
|
|
|
3384
3424
|
] })
|
|
3385
3425
|
] }) });
|
|
3386
3426
|
}
|
|
3387
|
-
function StarterPrompts({
|
|
3388
|
-
prompts
|
|
3389
|
-
}) {
|
|
3427
|
+
function StarterPrompts({ prompts }) {
|
|
3390
3428
|
if (!prompts || prompts.length === 0) {
|
|
3391
3429
|
return null;
|
|
3392
3430
|
}
|
|
@@ -3540,57 +3578,46 @@ function Thread({
|
|
|
3540
3578
|
});
|
|
3541
3579
|
};
|
|
3542
3580
|
const showStarterPrompts = messages.length === 0 && starterPrompts && starterPrompts.length > 0 && !isLoadingEvents;
|
|
3543
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3544
|
-
"div",
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
"
|
|
3551
|
-
{
|
|
3552
|
-
className: cn(
|
|
3553
|
-
"max-w-[48rem] mx-auto w-full p-4",
|
|
3554
|
-
showStarterPrompts && "min-h-full flex flex-col"
|
|
3555
|
-
),
|
|
3556
|
-
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: [
|
|
3557
|
-
showStarterPrompts && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3558
|
-
StarterPrompts,
|
|
3559
|
-
{
|
|
3560
|
-
prompts: starterPrompts
|
|
3561
|
-
}
|
|
3562
|
-
),
|
|
3563
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3564
|
-
MessageList,
|
|
3565
|
-
{
|
|
3566
|
-
messages,
|
|
3567
|
-
isLoading,
|
|
3568
|
-
error,
|
|
3569
|
-
loadingStatus
|
|
3570
|
-
}
|
|
3571
|
-
)
|
|
3572
|
-
] })
|
|
3573
|
-
}
|
|
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"
|
|
3574
3589
|
),
|
|
3575
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
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
|
+
] });
|
|
3594
3621
|
}
|
|
3595
3622
|
function ChatHeader({
|
|
3596
3623
|
leftContent,
|
|
@@ -3624,7 +3651,12 @@ function ChatHeader({
|
|
|
3624
3651
|
}
|
|
3625
3652
|
);
|
|
3626
3653
|
}
|
|
3627
|
-
var ThreadList = ({
|
|
3654
|
+
var ThreadList = ({
|
|
3655
|
+
padding,
|
|
3656
|
+
background,
|
|
3657
|
+
gap,
|
|
3658
|
+
radius = "md"
|
|
3659
|
+
}) => {
|
|
3628
3660
|
const { threads, activeThreadId } = useThreads();
|
|
3629
3661
|
const sortedThreads = React3__namespace.useMemo(() => {
|
|
3630
3662
|
return [...threads].sort((a, b) => {
|
|
@@ -3634,8 +3666,8 @@ var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
|
3634
3666
|
});
|
|
3635
3667
|
}, [threads]);
|
|
3636
3668
|
return /* @__PURE__ */ jsxRuntime.jsx(List, { padding, gap, flex: "1", overflow: "scroll", children: sortedThreads.map((thread) => {
|
|
3637
|
-
thread.id === activeThreadId;
|
|
3638
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
3669
|
+
const isActive = thread.id === activeThreadId;
|
|
3670
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3639
3671
|
ListItem,
|
|
3640
3672
|
{
|
|
3641
3673
|
onClickAction: {
|
|
@@ -3644,13 +3676,10 @@ var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
|
3644
3676
|
url: `?threadId=${thread.id}`
|
|
3645
3677
|
}
|
|
3646
3678
|
},
|
|
3647
|
-
background,
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
children: [
|
|
3652
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium truncate", children: thread.title || `Thread ${thread.id.slice(0, 8)}` }) }),
|
|
3653
|
-
/* @__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(
|
|
3654
3683
|
Dropdown,
|
|
3655
3684
|
{
|
|
3656
3685
|
items: [
|
|
@@ -3668,7 +3697,7 @@ var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
|
3668
3697
|
]
|
|
3669
3698
|
}
|
|
3670
3699
|
) })
|
|
3671
|
-
]
|
|
3700
|
+
] })
|
|
3672
3701
|
},
|
|
3673
3702
|
thread.id
|
|
3674
3703
|
);
|
|
@@ -3880,14 +3909,7 @@ var ThreadPopover = ({}) => {
|
|
|
3880
3909
|
}
|
|
3881
3910
|
);
|
|
3882
3911
|
return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
3883
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3884
|
-
Button,
|
|
3885
|
-
{
|
|
3886
|
-
variant: "ghost",
|
|
3887
|
-
size: "icon",
|
|
3888
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconHistory, { className: "size-4" })
|
|
3889
|
-
}
|
|
3890
|
-
) }),
|
|
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" }) }) }),
|
|
3891
3913
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3892
3914
|
PopoverContent,
|
|
3893
3915
|
{
|