@moontra/moonui 2.3.10 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +73 -39
- package/dist/index.d.ts +73 -39
- package/dist/index.global.js +540 -38
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1211 -574
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1210 -574
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ui/index.ts +77 -0
- package/src/components/ui/input.tsx +92 -19
- package/src/components/ui/moon-logo.tsx +13 -16
- package/src/components/ui/pagination.tsx +1 -1
- package/src/components/ui/textarea.tsx +194 -20
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
11
11
|
var classVarianceAuthority = require('class-variance-authority');
|
|
12
12
|
var AvatarPrimitive = require('@radix-ui/react-avatar');
|
|
13
13
|
var framerMotion = require('framer-motion');
|
|
14
|
+
var dateFns = require('date-fns');
|
|
14
15
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
15
16
|
require('react-dom');
|
|
16
17
|
var reactSlot = require('@radix-ui/react-slot');
|
|
@@ -18,7 +19,6 @@ var LabelPrimitive = require('@radix-ui/react-label');
|
|
|
18
19
|
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
19
20
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
|
20
21
|
var DialogPrimitive = require('@radix-ui/react-dialog');
|
|
21
|
-
var dateFns = require('date-fns');
|
|
22
22
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
23
23
|
var SelectPrimitive = require('@radix-ui/react-select');
|
|
24
24
|
var SeparatorPrimitive = require('@radix-ui/react-separator');
|
|
@@ -966,7 +966,26 @@ var springAnimations = {
|
|
|
966
966
|
type: "spring",
|
|
967
967
|
stiffness: 260,
|
|
968
968
|
damping: 20
|
|
969
|
-
}
|
|
969
|
+
},
|
|
970
|
+
// Bouncy spring for playful interactions
|
|
971
|
+
bouncy: {
|
|
972
|
+
type: "spring",
|
|
973
|
+
stiffness: 300,
|
|
974
|
+
damping: 15
|
|
975
|
+
},
|
|
976
|
+
// Stiff spring for quick responses
|
|
977
|
+
stiff: {
|
|
978
|
+
type: "spring",
|
|
979
|
+
stiffness: 400,
|
|
980
|
+
damping: 25
|
|
981
|
+
},
|
|
982
|
+
// Gentle spring for subtle movements
|
|
983
|
+
gentle: {
|
|
984
|
+
type: "spring",
|
|
985
|
+
stiffness: 150,
|
|
986
|
+
damping: 15
|
|
987
|
+
}
|
|
988
|
+
};
|
|
970
989
|
var hoverAnimations = {
|
|
971
990
|
lift: {
|
|
972
991
|
y: -2,
|
|
@@ -979,12 +998,22 @@ var hoverAnimations = {
|
|
|
979
998
|
glow: {
|
|
980
999
|
boxShadow: "0 0 20px rgba(var(--primary), 0.3)",
|
|
981
1000
|
transition: springAnimations.smooth
|
|
982
|
-
}
|
|
1001
|
+
},
|
|
1002
|
+
rotate: {
|
|
1003
|
+
rotate: 2,
|
|
1004
|
+
transition: springAnimations.bouncy
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
983
1007
|
var tapAnimations = {
|
|
984
1008
|
scale: {
|
|
985
1009
|
scale: 0.95,
|
|
986
1010
|
transition: { duration: 0.1 }
|
|
987
|
-
}
|
|
1011
|
+
},
|
|
1012
|
+
depress: {
|
|
1013
|
+
y: 1,
|
|
1014
|
+
transition: { duration: 0.1 }
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
988
1017
|
var skeletonAnimation = {
|
|
989
1018
|
initial: { opacity: 0.5 },
|
|
990
1019
|
animate: {
|
|
@@ -1099,6 +1128,202 @@ var CardFooter = t__namespace.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
1099
1128
|
}
|
|
1100
1129
|
));
|
|
1101
1130
|
CardFooter.displayName = "CardFooter";
|
|
1131
|
+
function Calendar({
|
|
1132
|
+
mode = "single",
|
|
1133
|
+
selected,
|
|
1134
|
+
onSelect,
|
|
1135
|
+
disabled,
|
|
1136
|
+
showOutsideDays = false,
|
|
1137
|
+
className,
|
|
1138
|
+
classNames,
|
|
1139
|
+
numberOfMonths = 1,
|
|
1140
|
+
defaultMonth,
|
|
1141
|
+
...props
|
|
1142
|
+
}) {
|
|
1143
|
+
const [currentMonth, setCurrentMonth] = t__namespace.useState(
|
|
1144
|
+
defaultMonth || selected && selected || /* @__PURE__ */ new Date()
|
|
1145
|
+
);
|
|
1146
|
+
const weekDays = [
|
|
1147
|
+
{ short: "S", full: "Sunday" },
|
|
1148
|
+
{ short: "M", full: "Monday" },
|
|
1149
|
+
{ short: "T", full: "Tuesday" },
|
|
1150
|
+
{ short: "W", full: "Wednesday" },
|
|
1151
|
+
{ short: "T", full: "Thursday" },
|
|
1152
|
+
{ short: "F", full: "Friday" },
|
|
1153
|
+
{ short: "S", full: "Saturday" }
|
|
1154
|
+
];
|
|
1155
|
+
const handlePreviousMonth = () => {
|
|
1156
|
+
setCurrentMonth(dateFns.subMonths(currentMonth, 1));
|
|
1157
|
+
};
|
|
1158
|
+
const handleNextMonth = () => {
|
|
1159
|
+
setCurrentMonth(dateFns.addMonths(currentMonth, 1));
|
|
1160
|
+
};
|
|
1161
|
+
const handleDateClick = (date) => {
|
|
1162
|
+
if (disabled?.(date))
|
|
1163
|
+
return;
|
|
1164
|
+
if (mode === "single") {
|
|
1165
|
+
onSelect?.(date);
|
|
1166
|
+
} else if (mode === "range") {
|
|
1167
|
+
const currentSelection = selected;
|
|
1168
|
+
if (!currentSelection?.from || currentSelection.from && currentSelection.to) {
|
|
1169
|
+
onSelect?.({ from: date, to: void 0 });
|
|
1170
|
+
} else {
|
|
1171
|
+
if (date < currentSelection.from) {
|
|
1172
|
+
onSelect?.({ from: date, to: currentSelection.from });
|
|
1173
|
+
} else {
|
|
1174
|
+
onSelect?.({ from: currentSelection.from, to: date });
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
const isDateSelected = (date) => {
|
|
1180
|
+
if (!selected)
|
|
1181
|
+
return false;
|
|
1182
|
+
if (mode === "single") {
|
|
1183
|
+
return dateFns.isSameDay(date, selected);
|
|
1184
|
+
} else if (mode === "range") {
|
|
1185
|
+
const range = selected;
|
|
1186
|
+
if (range.from && range.to) {
|
|
1187
|
+
return date >= range.from && date <= range.to;
|
|
1188
|
+
}
|
|
1189
|
+
return range.from ? dateFns.isSameDay(date, range.from) : false;
|
|
1190
|
+
}
|
|
1191
|
+
return false;
|
|
1192
|
+
};
|
|
1193
|
+
const isRangeStart = (date) => {
|
|
1194
|
+
if (mode !== "range" || !selected)
|
|
1195
|
+
return false;
|
|
1196
|
+
const range = selected;
|
|
1197
|
+
return range.from ? dateFns.isSameDay(date, range.from) : false;
|
|
1198
|
+
};
|
|
1199
|
+
const isRangeEnd = (date) => {
|
|
1200
|
+
if (mode !== "range" || !selected)
|
|
1201
|
+
return false;
|
|
1202
|
+
const range = selected;
|
|
1203
|
+
return range.to ? dateFns.isSameDay(date, range.to) : false;
|
|
1204
|
+
};
|
|
1205
|
+
const isRangeMiddle = (date) => {
|
|
1206
|
+
if (mode !== "range" || !selected)
|
|
1207
|
+
return false;
|
|
1208
|
+
const range = selected;
|
|
1209
|
+
if (!range.from || !range.to)
|
|
1210
|
+
return false;
|
|
1211
|
+
return date > range.from && date < range.to;
|
|
1212
|
+
};
|
|
1213
|
+
const getDaysInMonth = () => {
|
|
1214
|
+
const start = dateFns.startOfMonth(currentMonth);
|
|
1215
|
+
const end = dateFns.endOfMonth(currentMonth);
|
|
1216
|
+
const days2 = dateFns.eachDayOfInterval({ start, end });
|
|
1217
|
+
const firstDayOfWeek = dateFns.getDay(start);
|
|
1218
|
+
const previousMonthDays = [];
|
|
1219
|
+
if (firstDayOfWeek > 0 && showOutsideDays) {
|
|
1220
|
+
const previousMonthStart = dateFns.startOfWeek(start);
|
|
1221
|
+
const previousMonthEnd = new Date(start);
|
|
1222
|
+
previousMonthEnd.setDate(previousMonthEnd.getDate() - 1);
|
|
1223
|
+
previousMonthDays.push(...dateFns.eachDayOfInterval({
|
|
1224
|
+
start: previousMonthStart,
|
|
1225
|
+
end: previousMonthEnd
|
|
1226
|
+
}));
|
|
1227
|
+
}
|
|
1228
|
+
const lastDayOfWeek = dateFns.getDay(end);
|
|
1229
|
+
const nextMonthDays = [];
|
|
1230
|
+
if (lastDayOfWeek < 6 && showOutsideDays) {
|
|
1231
|
+
const nextMonthStart = new Date(end);
|
|
1232
|
+
nextMonthStart.setDate(nextMonthStart.getDate() + 1);
|
|
1233
|
+
const nextMonthEnd = dateFns.endOfWeek(end);
|
|
1234
|
+
nextMonthDays.push(...dateFns.eachDayOfInterval({
|
|
1235
|
+
start: nextMonthStart,
|
|
1236
|
+
end: nextMonthEnd
|
|
1237
|
+
}));
|
|
1238
|
+
}
|
|
1239
|
+
const emptyCells = [];
|
|
1240
|
+
if (!showOutsideDays && firstDayOfWeek > 0) {
|
|
1241
|
+
for (let i = 0; i < firstDayOfWeek; i++) {
|
|
1242
|
+
emptyCells.push(null);
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
return [...previousMonthDays, ...emptyCells, ...days2, ...nextMonthDays];
|
|
1246
|
+
};
|
|
1247
|
+
const days = getDaysInMonth();
|
|
1248
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("moonui-theme", "p-0", className), children: [
|
|
1249
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-6 py-4 border-b border-border/50 dark:border-gray-700/50", children: [
|
|
1250
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1251
|
+
"button",
|
|
1252
|
+
{
|
|
1253
|
+
onClick: handlePreviousMonth,
|
|
1254
|
+
className: cn(
|
|
1255
|
+
"h-10 w-10 bg-transparent p-0 rounded-lg",
|
|
1256
|
+
"hover:bg-muted transition-colors",
|
|
1257
|
+
"inline-flex items-center justify-center"
|
|
1258
|
+
),
|
|
1259
|
+
type: "button",
|
|
1260
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-5 w-5" })
|
|
1261
|
+
}
|
|
1262
|
+
),
|
|
1263
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-base font-medium", children: dateFns.format(currentMonth, "MMMM yyyy") }),
|
|
1264
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1265
|
+
"button",
|
|
1266
|
+
{
|
|
1267
|
+
onClick: handleNextMonth,
|
|
1268
|
+
className: cn(
|
|
1269
|
+
"h-10 w-10 bg-transparent p-0 rounded-lg",
|
|
1270
|
+
"hover:bg-muted transition-colors",
|
|
1271
|
+
"inline-flex items-center justify-center"
|
|
1272
|
+
),
|
|
1273
|
+
type: "button",
|
|
1274
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-5 w-5" })
|
|
1275
|
+
}
|
|
1276
|
+
)
|
|
1277
|
+
] }),
|
|
1278
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-6 pb-4", children: [
|
|
1279
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 mb-2", children: weekDays.map((day, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1280
|
+
"div",
|
|
1281
|
+
{
|
|
1282
|
+
className: "text-muted-foreground text-xs font-medium h-10 flex items-center justify-center",
|
|
1283
|
+
title: day.full,
|
|
1284
|
+
children: day.short
|
|
1285
|
+
},
|
|
1286
|
+
`weekday-${index}`
|
|
1287
|
+
)) }),
|
|
1288
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 gap-1", children: days.map((date, index) => {
|
|
1289
|
+
if (!date) {
|
|
1290
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-10" }, `empty-${index}`);
|
|
1291
|
+
}
|
|
1292
|
+
const isOutsideMonth = !dateFns.isSameMonth(date, currentMonth);
|
|
1293
|
+
const isDisabled = disabled?.(date) || false;
|
|
1294
|
+
const isSelected = isDateSelected(date);
|
|
1295
|
+
const isTodayDate = dateFns.isToday(date);
|
|
1296
|
+
const rangeStart = isRangeStart(date);
|
|
1297
|
+
const rangeEnd = isRangeEnd(date);
|
|
1298
|
+
const rangeMiddle = isRangeMiddle(date);
|
|
1299
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1300
|
+
"button",
|
|
1301
|
+
{
|
|
1302
|
+
onClick: () => handleDateClick(date),
|
|
1303
|
+
disabled: isDisabled,
|
|
1304
|
+
className: cn(
|
|
1305
|
+
"h-10 w-10 p-0 font-normal",
|
|
1306
|
+
"inline-flex items-center justify-center rounded-lg",
|
|
1307
|
+
"hover:bg-muted transition-colors text-sm",
|
|
1308
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
1309
|
+
isOutsideMonth && "text-muted-foreground/50",
|
|
1310
|
+
isDisabled && "text-muted-foreground/30 cursor-not-allowed hover:bg-transparent",
|
|
1311
|
+
isSelected && !rangeMiddle && "bg-primary text-primary-foreground font-medium hover:bg-primary hover:text-primary-foreground",
|
|
1312
|
+
isTodayDate && "font-semibold relative after:absolute after:bottom-1 after:left-1/2 after:-translate-x-1/2 after:h-1 after:w-1 after:rounded-full after:bg-primary",
|
|
1313
|
+
rangeMiddle && "bg-accent/30 text-accent-foreground rounded-none",
|
|
1314
|
+
rangeStart && "rounded-r-none",
|
|
1315
|
+
rangeEnd && "rounded-l-none"
|
|
1316
|
+
),
|
|
1317
|
+
type: "button",
|
|
1318
|
+
children: dateFns.format(date, "d")
|
|
1319
|
+
},
|
|
1320
|
+
date.toISOString()
|
|
1321
|
+
);
|
|
1322
|
+
}) })
|
|
1323
|
+
] })
|
|
1324
|
+
] });
|
|
1325
|
+
}
|
|
1326
|
+
Calendar.displayName = "Calendar";
|
|
1102
1327
|
var getCardType = (number) => {
|
|
1103
1328
|
const patterns = {
|
|
1104
1329
|
visa: /^4/,
|
|
@@ -1109,7 +1334,8 @@ var getCardType = (number) => {
|
|
|
1109
1334
|
jcb: /^35/
|
|
1110
1335
|
};
|
|
1111
1336
|
for (const [type, pattern] of Object.entries(patterns)) {
|
|
1112
|
-
if (pattern.test(number))
|
|
1337
|
+
if (pattern.test(number))
|
|
1338
|
+
return type;
|
|
1113
1339
|
}
|
|
1114
1340
|
return "unknown";
|
|
1115
1341
|
};
|
|
@@ -1119,8 +1345,10 @@ var formatCardNumber = (value, cardType) => {
|
|
|
1119
1345
|
let formatted = "";
|
|
1120
1346
|
let position = 0;
|
|
1121
1347
|
for (const group of groups) {
|
|
1122
|
-
if (position >= cleaned.length)
|
|
1123
|
-
|
|
1348
|
+
if (position >= cleaned.length)
|
|
1349
|
+
break;
|
|
1350
|
+
if (formatted)
|
|
1351
|
+
formatted += " ";
|
|
1124
1352
|
formatted += cleaned.slice(position, position + group);
|
|
1125
1353
|
position += group;
|
|
1126
1354
|
}
|
|
@@ -1446,8 +1674,10 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
1446
1674
|
function useContext22(consumerName, scope) {
|
|
1447
1675
|
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
1448
1676
|
const context = t__namespace.useContext(Context);
|
|
1449
|
-
if (context)
|
|
1450
|
-
|
|
1677
|
+
if (context)
|
|
1678
|
+
return context;
|
|
1679
|
+
if (defaultContext !== void 0)
|
|
1680
|
+
return defaultContext;
|
|
1451
1681
|
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1452
1682
|
}
|
|
1453
1683
|
return [Provider3, useContext22];
|
|
@@ -1469,7 +1699,8 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
1469
1699
|
}
|
|
1470
1700
|
function composeContextScopes(...scopes) {
|
|
1471
1701
|
const baseScope = scopes[0];
|
|
1472
|
-
if (scopes.length === 1)
|
|
1702
|
+
if (scopes.length === 1)
|
|
1703
|
+
return baseScope;
|
|
1473
1704
|
const createScope = () => {
|
|
1474
1705
|
const scopeHooks = scopes.map((createScope2) => ({
|
|
1475
1706
|
useScope: createScope2(),
|
|
@@ -1746,12 +1977,13 @@ var count = 0;
|
|
|
1746
1977
|
function useId2(deterministicId) {
|
|
1747
1978
|
const [id, setId] = t__namespace.useState(useReactId());
|
|
1748
1979
|
useLayoutEffect2(() => {
|
|
1749
|
-
|
|
1980
|
+
if (!deterministicId)
|
|
1981
|
+
setId((reactId) => reactId ?? String(count++));
|
|
1750
1982
|
}, [deterministicId]);
|
|
1751
1983
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
1752
1984
|
}
|
|
1753
1985
|
var COLLAPSIBLE_NAME = "Collapsible";
|
|
1754
|
-
var [createCollapsibleContext] = createContextScope(COLLAPSIBLE_NAME);
|
|
1986
|
+
var [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME);
|
|
1755
1987
|
var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
|
|
1756
1988
|
var Collapsible = t__namespace.forwardRef(
|
|
1757
1989
|
(props, forwardedRef) => {
|
|
@@ -1990,10 +2222,10 @@ var inputVariants = classVarianceAuthority.cva(
|
|
|
1990
2222
|
{
|
|
1991
2223
|
variants: {
|
|
1992
2224
|
variant: {
|
|
1993
|
-
standard: "border border-gray-300 dark:border-gray-700 rounded-md px-3 py-2 hover:border-gray-400 dark:hover:border-gray-600 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/20 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:bg-gray-
|
|
1994
|
-
filled: "border border-transparent bg-gray-100 dark:bg-gray-800
|
|
2225
|
+
standard: "border border-gray-300 dark:border-gray-700 rounded-md px-3 py-2 hover:border-gray-400 dark:hover:border-gray-600 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/20 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:bg-gray-800/80 dark:shadow-inner dark:shadow-gray-950/10",
|
|
2226
|
+
filled: "border border-transparent bg-gray-100 dark:bg-gray-800 rounded-md px-3 py-2 hover:bg-gray-200 dark:hover:bg-gray-700 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/20 dark:shadow-inner dark:shadow-gray-950/10",
|
|
1995
2227
|
ghost: "border-none bg-transparent shadow-none px-1 dark:text-gray-300 dark:placeholder:text-gray-500 hover:bg-gray-100/50 dark:hover:bg-gray-800/30 focus-visible:bg-transparent",
|
|
1996
|
-
underline: "border-t-0 border-l-0 border-r-0 border-b border-gray-300 dark:border-gray-600 rounded-none px-0 py-2 hover:border-gray-400 dark:hover:border-gray-500 focus-visible:ring-0 focus-visible:border-b-2 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:text-gray-300"
|
|
2228
|
+
underline: "border-t-0 border-l-0 border-r-0 border-b border-gray-300 dark:border-gray-600 rounded-none px-0 py-2 hover:border-gray-400 dark:hover:border-gray-500 focus-visible:ring-0 focus-visible:border-b-2 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:text-gray-300 dark:bg-transparent"
|
|
1997
2229
|
},
|
|
1998
2230
|
size: {
|
|
1999
2231
|
sm: "h-8 text-xs",
|
|
@@ -2053,12 +2285,59 @@ var Input = t__namespace.forwardRef(
|
|
|
2053
2285
|
rightIcon,
|
|
2054
2286
|
rightButton,
|
|
2055
2287
|
alwaysShowMessage = false,
|
|
2288
|
+
label,
|
|
2289
|
+
floatingLabel = false,
|
|
2290
|
+
floatingLabelClassName,
|
|
2291
|
+
value,
|
|
2292
|
+
defaultValue,
|
|
2293
|
+
onChange,
|
|
2294
|
+
onFocus,
|
|
2295
|
+
onBlur,
|
|
2296
|
+
placeholder,
|
|
2056
2297
|
...props
|
|
2057
2298
|
}, ref) => {
|
|
2299
|
+
const [isFocused, setIsFocused] = t__namespace.useState(false);
|
|
2300
|
+
const [internalValue, setInternalValue] = t__namespace.useState(value || defaultValue || "");
|
|
2301
|
+
const hasValue = internalValue !== "" && internalValue !== null && internalValue !== void 0;
|
|
2302
|
+
const isLabelActive = isFocused || hasValue;
|
|
2303
|
+
const handleFocus = (e) => {
|
|
2304
|
+
setIsFocused(true);
|
|
2305
|
+
onFocus?.(e);
|
|
2306
|
+
};
|
|
2307
|
+
const handleBlur = (e) => {
|
|
2308
|
+
setIsFocused(false);
|
|
2309
|
+
onBlur?.(e);
|
|
2310
|
+
};
|
|
2311
|
+
const handleChange = (e) => {
|
|
2312
|
+
setInternalValue(e.target.value);
|
|
2313
|
+
onChange?.(e);
|
|
2314
|
+
};
|
|
2315
|
+
t__namespace.useEffect(() => {
|
|
2316
|
+
if (value !== void 0) {
|
|
2317
|
+
setInternalValue(value);
|
|
2318
|
+
}
|
|
2319
|
+
}, [value]);
|
|
2058
2320
|
const showMessage = alwaysShowMessage || error || success;
|
|
2059
2321
|
const messageType = error ? "error" : success ? "success" : "normal";
|
|
2060
2322
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5 w-full", children: [
|
|
2061
2323
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("moonui-theme", inputWrapperVariants({ size }), wrapperClassName), children: [
|
|
2324
|
+
floatingLabel && label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2325
|
+
"label",
|
|
2326
|
+
{
|
|
2327
|
+
htmlFor: props.id,
|
|
2328
|
+
className: cn(
|
|
2329
|
+
"absolute transition-all duration-200 pointer-events-none",
|
|
2330
|
+
leftIcon || loading ? "left-10" : "left-3",
|
|
2331
|
+
"text-gray-500 dark:text-gray-400",
|
|
2332
|
+
isLabelActive ? "top-0 -translate-y-1/2 text-xs bg-background dark:bg-gray-800 px-1" : "top-1/2 -translate-y-1/2 text-sm",
|
|
2333
|
+
isFocused && "text-primary dark:text-primary",
|
|
2334
|
+
!!error && "text-error",
|
|
2335
|
+
disabled && "opacity-50",
|
|
2336
|
+
floatingLabelClassName
|
|
2337
|
+
),
|
|
2338
|
+
children: label
|
|
2339
|
+
}
|
|
2340
|
+
),
|
|
2062
2341
|
leftIcon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-3 text-gray-500 flex items-center justify-center pointer-events-none", children: loading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }) : leftIcon }),
|
|
2063
2342
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2064
2343
|
"input",
|
|
@@ -2083,6 +2362,12 @@ var Input = t__namespace.forwardRef(
|
|
|
2083
2362
|
"data-success": !!success ? "" : void 0,
|
|
2084
2363
|
"aria-invalid": !!error || !!isError || void 0,
|
|
2085
2364
|
"aria-describedby": error ? `${props.id || ""}-error` : success ? `${props.id || ""}-success` : void 0,
|
|
2365
|
+
value,
|
|
2366
|
+
defaultValue,
|
|
2367
|
+
onChange: handleChange,
|
|
2368
|
+
onFocus: handleFocus,
|
|
2369
|
+
onBlur: handleBlur,
|
|
2370
|
+
placeholder: floatingLabel ? isLabelActive ? placeholder : "" : placeholder,
|
|
2086
2371
|
...props
|
|
2087
2372
|
}
|
|
2088
2373
|
),
|
|
@@ -2495,9 +2780,11 @@ var Slider = t__namespace.forwardRef(({
|
|
|
2495
2780
|
}
|
|
2496
2781
|
};
|
|
2497
2782
|
const handleTrackClick = (event) => {
|
|
2498
|
-
if (disabled)
|
|
2783
|
+
if (disabled)
|
|
2784
|
+
return;
|
|
2499
2785
|
const track = trackRef.current;
|
|
2500
|
-
if (!track)
|
|
2786
|
+
if (!track)
|
|
2787
|
+
return;
|
|
2501
2788
|
const rect = track.getBoundingClientRect();
|
|
2502
2789
|
const percent = (event.clientX - rect.left) / rect.width;
|
|
2503
2790
|
const rawValue = min2 + percent * (max2 - min2);
|
|
@@ -2508,11 +2795,13 @@ var Slider = t__namespace.forwardRef(({
|
|
|
2508
2795
|
handleValueChange(newValues);
|
|
2509
2796
|
};
|
|
2510
2797
|
const handleThumbMouseDown = (index) => (event) => {
|
|
2511
|
-
if (disabled)
|
|
2798
|
+
if (disabled)
|
|
2799
|
+
return;
|
|
2512
2800
|
event.preventDefault();
|
|
2513
2801
|
const handleMouseMove = (moveEvent) => {
|
|
2514
2802
|
const track = trackRef.current;
|
|
2515
|
-
if (!track)
|
|
2803
|
+
if (!track)
|
|
2804
|
+
return;
|
|
2516
2805
|
const rect = track.getBoundingClientRect();
|
|
2517
2806
|
const percent = (moveEvent.clientX - rect.left) / rect.width;
|
|
2518
2807
|
const rawValue = min2 + percent * (max2 - min2);
|
|
@@ -2629,7 +2918,8 @@ function rgbToHex(r, g, b) {
|
|
|
2629
2918
|
}
|
|
2630
2919
|
function hexToHsl(hex) {
|
|
2631
2920
|
const rgb = hexToRgb(hex);
|
|
2632
|
-
if (!rgb)
|
|
2921
|
+
if (!rgb)
|
|
2922
|
+
return null;
|
|
2633
2923
|
const r = rgb.r / 255;
|
|
2634
2924
|
const g = rgb.g / 255;
|
|
2635
2925
|
const b = rgb.b / 255;
|
|
@@ -2668,11 +2958,16 @@ function hslToHex(h, s, l) {
|
|
|
2668
2958
|
r = g = b = l;
|
|
2669
2959
|
} else {
|
|
2670
2960
|
const hue2rgb = (p3, q2, t2) => {
|
|
2671
|
-
if (t2 < 0)
|
|
2672
|
-
|
|
2673
|
-
if (t2
|
|
2674
|
-
|
|
2675
|
-
if (t2 <
|
|
2961
|
+
if (t2 < 0)
|
|
2962
|
+
t2 += 1;
|
|
2963
|
+
if (t2 > 1)
|
|
2964
|
+
t2 -= 1;
|
|
2965
|
+
if (t2 < 1 / 6)
|
|
2966
|
+
return p3 + (q2 - p3) * 6 * t2;
|
|
2967
|
+
if (t2 < 1 / 2)
|
|
2968
|
+
return q2;
|
|
2969
|
+
if (t2 < 2 / 3)
|
|
2970
|
+
return p3 + (q2 - p3) * (2 / 3 - t2) * 6;
|
|
2676
2971
|
return p3;
|
|
2677
2972
|
};
|
|
2678
2973
|
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
@@ -2789,8 +3084,10 @@ function ColorPicker({
|
|
|
2789
3084
|
}
|
|
2790
3085
|
};
|
|
2791
3086
|
const formatDisplay = () => {
|
|
2792
|
-
if (format4 === "rgb")
|
|
2793
|
-
|
|
3087
|
+
if (format4 === "rgb")
|
|
3088
|
+
return `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`;
|
|
3089
|
+
if (format4 === "hsl")
|
|
3090
|
+
return `hsl(${hsl.h}, ${hsl.s}%, ${hsl.l}%)`;
|
|
2794
3091
|
return color;
|
|
2795
3092
|
};
|
|
2796
3093
|
return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
@@ -3207,10 +3504,13 @@ var B = /[\\\/_+.#"@\[\(\{&]/g;
|
|
|
3207
3504
|
var K = /[\s-]/;
|
|
3208
3505
|
var X2 = /[\s-]/g;
|
|
3209
3506
|
function G(_, C, h, P2, A, f, O) {
|
|
3210
|
-
if (f === C.length)
|
|
3507
|
+
if (f === C.length)
|
|
3508
|
+
return A === _.length ? U : k;
|
|
3211
3509
|
var T2 = `${A},${f}`;
|
|
3212
|
-
if (O[T2] !== void 0)
|
|
3213
|
-
|
|
3510
|
+
if (O[T2] !== void 0)
|
|
3511
|
+
return O[T2];
|
|
3512
|
+
for (var L2 = P2.charAt(f), c = h.indexOf(L2, A), S = 0, E, N2, R, M; c >= 0; )
|
|
3513
|
+
E = G(_, C, h, P2, c + 1, f + 1, O), E > S && (c === A ? E *= U : m.test(_.charAt(c - 1)) ? (E *= H, R = _.slice(A, c - 1).match(B), R && A > 0 && (E *= Math.pow(u, R.length))) : K.test(_.charAt(c - 1)) ? (E *= Y, M = _.slice(A, c - 1).match(X2), M && A > 0 && (E *= Math.pow(u, M.length))) : (E *= J, A > 0 && (E *= Math.pow(u, c - A))), _.charAt(c) !== C.charAt(f) && (E *= $)), (E < p && h.charAt(c - 1) === P2.charAt(f + 1) || P2.charAt(f + 1) === P2.charAt(f) && h.charAt(c - 1) !== P2.charAt(f)) && (N2 = G(_, C, h, P2, c + 1, f + 2, O), N2 * p > E && (E = N2 * p)), E > S && (S = E), c = h.indexOf(L2, c + 1);
|
|
3214
3514
|
return O[T2] = S, S;
|
|
3215
3515
|
}
|
|
3216
3516
|
function D(_) {
|
|
@@ -3219,40 +3519,123 @@ function D(_) {
|
|
|
3219
3519
|
function W(_, C, h) {
|
|
3220
3520
|
return _ = h && h.length > 0 ? `${_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {});
|
|
3221
3521
|
}
|
|
3222
|
-
var
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
}
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3522
|
+
var NODES2 = [
|
|
3523
|
+
"a",
|
|
3524
|
+
"button",
|
|
3525
|
+
"div",
|
|
3526
|
+
"form",
|
|
3527
|
+
"h2",
|
|
3528
|
+
"h3",
|
|
3529
|
+
"img",
|
|
3530
|
+
"input",
|
|
3531
|
+
"label",
|
|
3532
|
+
"li",
|
|
3533
|
+
"nav",
|
|
3534
|
+
"ol",
|
|
3535
|
+
"p",
|
|
3536
|
+
"select",
|
|
3537
|
+
"span",
|
|
3538
|
+
"svg",
|
|
3539
|
+
"ul"
|
|
3540
|
+
];
|
|
3541
|
+
var Primitive2 = NODES2.reduce((primitive, node) => {
|
|
3542
|
+
const Slot = reactSlot.createSlot(`Primitive.${node}`);
|
|
3543
|
+
const Node = t__namespace.forwardRef((props, forwardedRef) => {
|
|
3544
|
+
const { asChild, ...primitiveProps } = props;
|
|
3545
|
+
const Comp = asChild ? Slot : node;
|
|
3546
|
+
if (typeof window !== "undefined") {
|
|
3547
|
+
window[Symbol.for("radix-ui")] = true;
|
|
3548
|
+
}
|
|
3549
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
3550
|
+
});
|
|
3551
|
+
Node.displayName = `Primitive.${node}`;
|
|
3552
|
+
return { ...primitive, [node]: Node };
|
|
3553
|
+
}, {});
|
|
3554
|
+
var useLayoutEffect22 = globalThis?.document ? t__namespace.useLayoutEffect : () => {
|
|
3555
|
+
};
|
|
3556
|
+
|
|
3557
|
+
// ../../node_modules/@radix-ui/react-id/dist/index.mjs
|
|
3558
|
+
var useReactId2 = t__namespace[" useId ".trim().toString()] || (() => void 0);
|
|
3559
|
+
var count2 = 0;
|
|
3560
|
+
function useId3(deterministicId) {
|
|
3561
|
+
const [id, setId] = t__namespace.useState(useReactId2());
|
|
3562
|
+
useLayoutEffect22(() => {
|
|
3563
|
+
if (!deterministicId)
|
|
3564
|
+
setId((reactId) => reactId ?? String(count2++));
|
|
3565
|
+
}, [deterministicId]);
|
|
3566
|
+
return deterministicId || (id ? `radix-${id}` : "");
|
|
3567
|
+
}
|
|
3568
|
+
function setRef2(ref, value) {
|
|
3569
|
+
if (typeof ref === "function") {
|
|
3570
|
+
return ref(value);
|
|
3571
|
+
} else if (ref !== null && ref !== void 0) {
|
|
3572
|
+
ref.current = value;
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
function composeRefs2(...refs) {
|
|
3576
|
+
return (node) => {
|
|
3577
|
+
let hasCleanup = false;
|
|
3578
|
+
const cleanups = refs.map((ref) => {
|
|
3579
|
+
const cleanup = setRef2(ref, node);
|
|
3580
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
3581
|
+
hasCleanup = true;
|
|
3582
|
+
}
|
|
3583
|
+
return cleanup;
|
|
3584
|
+
});
|
|
3585
|
+
if (hasCleanup) {
|
|
3586
|
+
return () => {
|
|
3587
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
3588
|
+
const cleanup = cleanups[i];
|
|
3589
|
+
if (typeof cleanup == "function") {
|
|
3590
|
+
cleanup();
|
|
3591
|
+
} else {
|
|
3592
|
+
setRef2(refs[i], null);
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
};
|
|
3596
|
+
}
|
|
3597
|
+
};
|
|
3598
|
+
}
|
|
3599
|
+
function useComposedRefs2(...refs) {
|
|
3600
|
+
return t__namespace.useCallback(composeRefs2(...refs), refs);
|
|
3601
|
+
}
|
|
3602
|
+
|
|
3603
|
+
// ../../node_modules/cmdk/dist/index.mjs
|
|
3604
|
+
var N = '[cmdk-group=""]';
|
|
3605
|
+
var Y2 = '[cmdk-group-items=""]';
|
|
3606
|
+
var be = '[cmdk-group-heading=""]';
|
|
3607
|
+
var le = '[cmdk-item=""]';
|
|
3608
|
+
var ce = `${le}:not([aria-disabled="true"])`;
|
|
3609
|
+
var Z = "cmdk-item-select";
|
|
3610
|
+
var T = "data-value";
|
|
3611
|
+
var Re = (r, o, n) => W(r, o, n);
|
|
3612
|
+
var ue = t__namespace.createContext(void 0);
|
|
3613
|
+
var K2 = () => t__namespace.useContext(ue);
|
|
3614
|
+
var de = t__namespace.createContext(void 0);
|
|
3615
|
+
var ee = () => t__namespace.useContext(de);
|
|
3616
|
+
var fe = t__namespace.createContext(void 0);
|
|
3617
|
+
var me = t__namespace.forwardRef((r, o) => {
|
|
3618
|
+
let n = L(() => {
|
|
3619
|
+
var e, a;
|
|
3620
|
+
return { search: "", value: (a = (e = r.value) != null ? e : r.defaultValue) != null ? a : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
|
|
3621
|
+
}), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r, $2 = useId3(), q = useId3(), _ = useId3(), I = t__namespace.useRef(null), v = ke();
|
|
3622
|
+
k2(() => {
|
|
3623
|
+
if (R !== void 0) {
|
|
3624
|
+
let e = R.trim();
|
|
3625
|
+
n.current.value = e, E.emit();
|
|
3626
|
+
}
|
|
3627
|
+
}, [R]), k2(() => {
|
|
3628
|
+
v(6, ne);
|
|
3629
|
+
}, []);
|
|
3630
|
+
let E = t__namespace.useMemo(() => ({ subscribe: (e) => (f.current.add(e), () => f.current.delete(e)), snapshot: () => n.current, setState: (e, a, s) => {
|
|
3631
|
+
var i, l, g, y;
|
|
3632
|
+
if (!Object.is(n.current[e], a)) {
|
|
3633
|
+
if (n.current[e] = a, e === "search")
|
|
3634
|
+
J2(), z(), v(1, W2);
|
|
3635
|
+
else if (e === "value") {
|
|
3636
|
+
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
3637
|
+
let h = document.getElementById(_);
|
|
3638
|
+
h ? h.focus() : (i = document.getElementById($2)) == null || i.focus();
|
|
3256
3639
|
}
|
|
3257
3640
|
if (v(7, () => {
|
|
3258
3641
|
var h;
|
|
@@ -3289,7 +3672,8 @@ var me = t__namespace.forwardRef((r, o) => {
|
|
|
3289
3672
|
return e ? s(e, n.current.search, a) : 0;
|
|
3290
3673
|
}
|
|
3291
3674
|
function z() {
|
|
3292
|
-
if (!n.current.search || p2.current.shouldFilter === false)
|
|
3675
|
+
if (!n.current.search || p2.current.shouldFilter === false)
|
|
3676
|
+
return;
|
|
3293
3677
|
let e = n.current.filtered.items, a = [];
|
|
3294
3678
|
n.current.filtered.groups.forEach((i) => {
|
|
3295
3679
|
let l = c.current.get(i), g = 0;
|
|
@@ -3328,10 +3712,12 @@ var me = t__namespace.forwardRef((r, o) => {
|
|
|
3328
3712
|
let y = (s = (a = d.current.get(g)) == null ? void 0 : a.value) != null ? s : "", h = (l = (i = d.current.get(g)) == null ? void 0 : i.keywords) != null ? l : [], F = te(y, h);
|
|
3329
3713
|
n.current.filtered.items.set(g, F), F > 0 && e++;
|
|
3330
3714
|
}
|
|
3331
|
-
for (let [g, y] of c.current)
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3715
|
+
for (let [g, y] of c.current)
|
|
3716
|
+
for (let h of y)
|
|
3717
|
+
if (n.current.filtered.items.get(h) > 0) {
|
|
3718
|
+
n.current.filtered.groups.add(g);
|
|
3719
|
+
break;
|
|
3720
|
+
}
|
|
3335
3721
|
n.current.filtered.count = e;
|
|
3336
3722
|
}
|
|
3337
3723
|
function ne() {
|
|
@@ -3358,7 +3744,8 @@ var me = t__namespace.forwardRef((r, o) => {
|
|
|
3358
3744
|
}
|
|
3359
3745
|
function re(e) {
|
|
3360
3746
|
let a = M(), s = a == null ? void 0 : a.closest(N), i;
|
|
3361
|
-
for (; s && !i; )
|
|
3747
|
+
for (; s && !i; )
|
|
3748
|
+
s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce);
|
|
3362
3749
|
i ? E.setState("value", i.getAttribute(T)) : Q(e);
|
|
3363
3750
|
}
|
|
3364
3751
|
let oe = () => X7(V().length - 1), ie = (e) => {
|
|
@@ -3366,58 +3753,61 @@ var me = t__namespace.forwardRef((r, o) => {
|
|
|
3366
3753
|
}, se = (e) => {
|
|
3367
3754
|
e.preventDefault(), e.metaKey ? X7(0) : e.altKey ? re(-1) : Q(-1);
|
|
3368
3755
|
};
|
|
3369
|
-
return t__namespace.createElement(
|
|
3756
|
+
return t__namespace.createElement(Primitive2.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
|
|
3370
3757
|
var s;
|
|
3371
3758
|
(s = O.onKeyDown) == null || s.call(O, e);
|
|
3372
3759
|
let a = e.nativeEvent.isComposing || e.keyCode === 229;
|
|
3373
|
-
if (!(e.defaultPrevented || a))
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
j
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3760
|
+
if (!(e.defaultPrevented || a))
|
|
3761
|
+
switch (e.key) {
|
|
3762
|
+
case "n":
|
|
3763
|
+
case "j": {
|
|
3764
|
+
j && e.ctrlKey && ie(e);
|
|
3765
|
+
break;
|
|
3766
|
+
}
|
|
3767
|
+
case "ArrowDown": {
|
|
3768
|
+
ie(e);
|
|
3769
|
+
break;
|
|
3770
|
+
}
|
|
3771
|
+
case "p":
|
|
3772
|
+
case "k": {
|
|
3773
|
+
j && e.ctrlKey && se(e);
|
|
3774
|
+
break;
|
|
3775
|
+
}
|
|
3776
|
+
case "ArrowUp": {
|
|
3777
|
+
se(e);
|
|
3778
|
+
break;
|
|
3779
|
+
}
|
|
3780
|
+
case "Home": {
|
|
3781
|
+
e.preventDefault(), X7(0);
|
|
3782
|
+
break;
|
|
3783
|
+
}
|
|
3784
|
+
case "End": {
|
|
3785
|
+
e.preventDefault(), oe();
|
|
3786
|
+
break;
|
|
3787
|
+
}
|
|
3788
|
+
case "Enter": {
|
|
3789
|
+
e.preventDefault();
|
|
3790
|
+
let i = M();
|
|
3791
|
+
if (i) {
|
|
3792
|
+
let l = new Event(Z);
|
|
3793
|
+
i.dispatchEvent(l);
|
|
3794
|
+
}
|
|
3406
3795
|
}
|
|
3407
3796
|
}
|
|
3408
|
-
}
|
|
3409
3797
|
} }, t__namespace.createElement("label", { "cmdk-label": "", htmlFor: U2.inputId, id: U2.labelId, style: Te }, b), B2(r, (e) => t__namespace.createElement(de.Provider, { value: E }, t__namespace.createElement(ue.Provider, { value: U2 }, e))));
|
|
3410
3798
|
});
|
|
3411
3799
|
var he = t__namespace.forwardRef((r, o) => {
|
|
3412
3800
|
var _, I;
|
|
3413
|
-
let n =
|
|
3801
|
+
let n = useId3(), u2 = t__namespace.useRef(null), c = t__namespace.useContext(fe), d = K2(), f = pe(r), p2 = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
|
|
3414
3802
|
k2(() => {
|
|
3415
|
-
if (!p2)
|
|
3803
|
+
if (!p2)
|
|
3804
|
+
return d.item(n, c == null ? void 0 : c.id);
|
|
3416
3805
|
}, [p2]);
|
|
3417
3806
|
let b = ve(n, u2, [r.value, r.children, u2], r.keywords), m2 = ee(), R = P((v) => v.value && v.value === b.current), x = P((v) => p2 || d.filter() === false ? true : v.search ? v.filtered.items.get(n) > 0 : true);
|
|
3418
3807
|
t__namespace.useEffect(() => {
|
|
3419
3808
|
let v = u2.current;
|
|
3420
|
-
if (!(!v || r.disabled))
|
|
3809
|
+
if (!(!v || r.disabled))
|
|
3810
|
+
return v.addEventListener(Z, C), () => v.removeEventListener(Z, C);
|
|
3421
3811
|
}, [x, r.onSelect, r.disabled]);
|
|
3422
3812
|
function C() {
|
|
3423
3813
|
var v, E;
|
|
@@ -3426,25 +3816,26 @@ var he = t__namespace.forwardRef((r, o) => {
|
|
|
3426
3816
|
function S() {
|
|
3427
3817
|
m2.setState("value", b.current, true);
|
|
3428
3818
|
}
|
|
3429
|
-
if (!x)
|
|
3819
|
+
if (!x)
|
|
3820
|
+
return null;
|
|
3430
3821
|
let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $2, ...q } = r;
|
|
3431
|
-
return t__namespace.createElement(
|
|
3822
|
+
return t__namespace.createElement(Primitive2.div, { ref: composeRefs2(u2, o), ...q, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!A, "aria-selected": !!R, "data-disabled": !!A, "data-selected": !!R, onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S, onClick: A ? void 0 : C }, r.children);
|
|
3432
3823
|
});
|
|
3433
3824
|
var Ee = t__namespace.forwardRef((r, o) => {
|
|
3434
|
-
let { heading: n, children: u2, forceMount: c, ...d } = r, f =
|
|
3825
|
+
let { heading: n, children: u2, forceMount: c, ...d } = r, f = useId3(), p2 = t__namespace.useRef(null), b = t__namespace.useRef(null), m2 = useId3(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true);
|
|
3435
3826
|
k2(() => R.group(f), []), ve(f, p2, [r.value, r.heading, b]);
|
|
3436
3827
|
let C = t__namespace.useMemo(() => ({ id: f, forceMount: c }), [c]);
|
|
3437
|
-
return t__namespace.createElement(
|
|
3828
|
+
return t__namespace.createElement(Primitive2.div, { ref: composeRefs2(p2, o), ...d, "cmdk-group": "", role: "presentation", hidden: x ? void 0 : true }, n && t__namespace.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": true, id: m2 }, n), B2(r, (S) => t__namespace.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? m2 : void 0 }, t__namespace.createElement(fe.Provider, { value: C }, S))));
|
|
3438
3829
|
});
|
|
3439
3830
|
var ye = t__namespace.forwardRef((r, o) => {
|
|
3440
3831
|
let { alwaysRender: n, ...u2 } = r, c = t__namespace.useRef(null), d = P((f) => !f.search);
|
|
3441
|
-
return !n && !d ? null : t__namespace.createElement(
|
|
3832
|
+
return !n && !d ? null : t__namespace.createElement(Primitive2.div, { ref: composeRefs2(c, o), ...u2, "cmdk-separator": "", role: "separator" });
|
|
3442
3833
|
});
|
|
3443
3834
|
var Se = t__namespace.forwardRef((r, o) => {
|
|
3444
3835
|
let { onValueChange: n, ...u2 } = r, c = r.value != null, d = ee(), f = P((m2) => m2.search), p2 = P((m2) => m2.selectedItemId), b = K2();
|
|
3445
3836
|
return t__namespace.useEffect(() => {
|
|
3446
3837
|
r.value != null && d.setState("search", r.value);
|
|
3447
|
-
}, [r.value]), t__namespace.createElement(
|
|
3838
|
+
}, [r.value]), t__namespace.createElement(Primitive2.input, { ref: o, ...u2, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-autocomplete": "list", role: "combobox", "aria-expanded": true, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": p2, id: b.inputId, type: "text", value: c ? r.value : f, onChange: (m2) => {
|
|
3448
3839
|
c || d.setState("search", m2.target.value), n == null || n(m2.target.value);
|
|
3449
3840
|
} });
|
|
3450
3841
|
});
|
|
@@ -3462,29 +3853,31 @@ var Ce = t__namespace.forwardRef((r, o) => {
|
|
|
3462
3853
|
cancelAnimationFrame(x), C.unobserve(m2);
|
|
3463
3854
|
};
|
|
3464
3855
|
}
|
|
3465
|
-
}, []), t__namespace.createElement(
|
|
3856
|
+
}, []), t__namespace.createElement(Primitive2.div, { ref: composeRefs2(d, o), ...c, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b.listId }, B2(r, (m2) => t__namespace.createElement("div", { ref: composeRefs2(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2)));
|
|
3466
3857
|
});
|
|
3467
3858
|
var xe = t__namespace.forwardRef((r, o) => {
|
|
3468
3859
|
let { open: n, onOpenChange: u2, overlayClassName: c, contentClassName: d, container: f, ...p2 } = r;
|
|
3469
3860
|
return t__namespace.createElement(DialogPrimitive__namespace.Root, { open: n, onOpenChange: u2 }, t__namespace.createElement(DialogPrimitive__namespace.Portal, { container: f }, t__namespace.createElement(DialogPrimitive__namespace.Overlay, { "cmdk-overlay": "", className: c }), t__namespace.createElement(DialogPrimitive__namespace.Content, { "aria-label": r.label, "cmdk-dialog": "", className: d }, t__namespace.createElement(me, { ref: o, ...p2 }))));
|
|
3470
3861
|
});
|
|
3471
|
-
var Ie = t__namespace.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t__namespace.createElement(
|
|
3862
|
+
var Ie = t__namespace.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t__namespace.createElement(Primitive2.div, { ref: o, ...r, "cmdk-empty": "", role: "presentation" }) : null);
|
|
3472
3863
|
var Pe = t__namespace.forwardRef((r, o) => {
|
|
3473
3864
|
let { progress: n, children: u2, label: c = "Loading...", ...d } = r;
|
|
3474
|
-
return t__namespace.createElement(
|
|
3865
|
+
return t__namespace.createElement(Primitive2.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, B2(r, (f) => t__namespace.createElement("div", { "aria-hidden": true }, f)));
|
|
3475
3866
|
});
|
|
3476
3867
|
var _e = Object.assign(me, { List: Ce, Item: he, Input: Se, Group: Ee, Separator: ye, Dialog: xe, Empty: Ie, Loading: Pe });
|
|
3477
3868
|
function we(r, o) {
|
|
3478
3869
|
let n = r.nextElementSibling;
|
|
3479
3870
|
for (; n; ) {
|
|
3480
|
-
if (n.matches(o))
|
|
3871
|
+
if (n.matches(o))
|
|
3872
|
+
return n;
|
|
3481
3873
|
n = n.nextElementSibling;
|
|
3482
3874
|
}
|
|
3483
3875
|
}
|
|
3484
3876
|
function De(r, o) {
|
|
3485
3877
|
let n = r.previousElementSibling;
|
|
3486
3878
|
for (; n; ) {
|
|
3487
|
-
if (n.matches(o))
|
|
3879
|
+
if (n.matches(o))
|
|
3880
|
+
return n;
|
|
3488
3881
|
n = n.previousElementSibling;
|
|
3489
3882
|
}
|
|
3490
3883
|
}
|
|
@@ -3510,8 +3903,10 @@ function ve(r, o, n, u2 = []) {
|
|
|
3510
3903
|
let f = (() => {
|
|
3511
3904
|
var m2;
|
|
3512
3905
|
for (let R of n) {
|
|
3513
|
-
if (typeof R == "string")
|
|
3514
|
-
|
|
3906
|
+
if (typeof R == "string")
|
|
3907
|
+
return R.trim();
|
|
3908
|
+
if (typeof R == "object" && "current" in R)
|
|
3909
|
+
return R.current ? (m2 = R.current.textContent) == null ? void 0 : m2.trim() : c.current;
|
|
3515
3910
|
}
|
|
3516
3911
|
})(), p2 = u2.map((m2) => m2.trim());
|
|
3517
3912
|
d.value(r, f, p2), (b = o.current) == null || b.setAttribute(T, f), c.current = f;
|
|
@@ -3929,7 +4324,8 @@ function memo(getDeps, fn, opts) {
|
|
|
3929
4324
|
let result;
|
|
3930
4325
|
return (depArgs) => {
|
|
3931
4326
|
let depTime;
|
|
3932
|
-
if (opts.key && opts.debug)
|
|
4327
|
+
if (opts.key && opts.debug)
|
|
4328
|
+
depTime = Date.now();
|
|
3933
4329
|
const newDeps = getDeps(depArgs);
|
|
3934
4330
|
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
|
3935
4331
|
if (!depsChanged) {
|
|
@@ -3937,7 +4333,8 @@ function memo(getDeps, fn, opts) {
|
|
|
3937
4333
|
}
|
|
3938
4334
|
deps = newDeps;
|
|
3939
4335
|
let resultTime;
|
|
3940
|
-
if (opts.key && opts.debug)
|
|
4336
|
+
if (opts.key && opts.debug)
|
|
4337
|
+
resultTime = Date.now();
|
|
3941
4338
|
result = fn(...newDeps);
|
|
3942
4339
|
opts == null || opts.onChange == null || opts.onChange(result);
|
|
3943
4340
|
if (opts.key && opts.debug) {
|
|
@@ -4308,7 +4705,7 @@ var createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
|
4308
4705
|
var _row$getValue;
|
|
4309
4706
|
return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
|
|
4310
4707
|
},
|
|
4311
|
-
subRows: [],
|
|
4708
|
+
subRows: subRows != null ? subRows : [],
|
|
4312
4709
|
getLeafRows: () => flattenBy(row.subRows, (d) => d.subRows),
|
|
4313
4710
|
getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : void 0,
|
|
4314
4711
|
getParentRows: () => {
|
|
@@ -4316,7 +4713,8 @@ var createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
|
4316
4713
|
let currentRow = row;
|
|
4317
4714
|
while (true) {
|
|
4318
4715
|
const parentRow = currentRow.getParentRow();
|
|
4319
|
-
if (!parentRow)
|
|
4716
|
+
if (!parentRow)
|
|
4717
|
+
break;
|
|
4320
4718
|
parentRows.push(parentRow);
|
|
4321
4719
|
currentRow = parentRow;
|
|
4322
4720
|
}
|
|
@@ -4604,25 +5002,29 @@ var extent = (columnId, _leafRows, childRows) => {
|
|
|
4604
5002
|
const value = row.getValue(columnId);
|
|
4605
5003
|
if (value != null) {
|
|
4606
5004
|
if (min2 === void 0) {
|
|
4607
|
-
if (value >= value)
|
|
5005
|
+
if (value >= value)
|
|
5006
|
+
min2 = max2 = value;
|
|
4608
5007
|
} else {
|
|
4609
|
-
if (min2 > value)
|
|
4610
|
-
|
|
5008
|
+
if (min2 > value)
|
|
5009
|
+
min2 = value;
|
|
5010
|
+
if (max2 < value)
|
|
5011
|
+
max2 = value;
|
|
4611
5012
|
}
|
|
4612
5013
|
}
|
|
4613
5014
|
});
|
|
4614
5015
|
return [min2, max2];
|
|
4615
5016
|
};
|
|
4616
5017
|
var mean = (columnId, leafRows) => {
|
|
4617
|
-
let
|
|
5018
|
+
let count4 = 0;
|
|
4618
5019
|
let sum2 = 0;
|
|
4619
5020
|
leafRows.forEach((row) => {
|
|
4620
5021
|
let value = row.getValue(columnId);
|
|
4621
5022
|
if (value != null && (value = +value) >= value) {
|
|
4622
|
-
++
|
|
5023
|
+
++count4, sum2 += value;
|
|
4623
5024
|
}
|
|
4624
5025
|
});
|
|
4625
|
-
if (
|
|
5026
|
+
if (count4)
|
|
5027
|
+
return sum2 / count4;
|
|
4626
5028
|
return;
|
|
4627
5029
|
};
|
|
4628
5030
|
var median = (columnId, leafRows) => {
|
|
@@ -4646,7 +5048,7 @@ var unique = (columnId, leafRows) => {
|
|
|
4646
5048
|
var uniqueCount = (columnId, leafRows) => {
|
|
4647
5049
|
return new Set(leafRows.map((d) => d.getValue(columnId))).size;
|
|
4648
5050
|
};
|
|
4649
|
-
var
|
|
5051
|
+
var count3 = (_columnId, leafRows) => {
|
|
4650
5052
|
return leafRows.length;
|
|
4651
5053
|
};
|
|
4652
5054
|
var aggregationFns = {
|
|
@@ -4658,7 +5060,7 @@ var aggregationFns = {
|
|
|
4658
5060
|
median,
|
|
4659
5061
|
unique,
|
|
4660
5062
|
uniqueCount,
|
|
4661
|
-
count:
|
|
5063
|
+
count: count3
|
|
4662
5064
|
};
|
|
4663
5065
|
var ColumnGrouping = {
|
|
4664
5066
|
getDefaultColumnDef: () => {
|
|
@@ -4706,7 +5108,8 @@ var ColumnGrouping = {
|
|
|
4706
5108
|
column.getToggleGroupingHandler = () => {
|
|
4707
5109
|
const canGroup = column.getCanGroup();
|
|
4708
5110
|
return () => {
|
|
4709
|
-
if (!canGroup)
|
|
5111
|
+
if (!canGroup)
|
|
5112
|
+
return;
|
|
4710
5113
|
column.toggleGrouping();
|
|
4711
5114
|
};
|
|
4712
5115
|
};
|
|
@@ -5169,7 +5572,8 @@ var ColumnSizing = {
|
|
|
5169
5572
|
};
|
|
5170
5573
|
var passiveSupported = null;
|
|
5171
5574
|
function passiveEventSupported() {
|
|
5172
|
-
if (typeof passiveSupported === "boolean")
|
|
5575
|
+
if (typeof passiveSupported === "boolean")
|
|
5576
|
+
return passiveSupported;
|
|
5173
5577
|
let supported = false;
|
|
5174
5578
|
try {
|
|
5175
5579
|
const options = {
|
|
@@ -5363,7 +5767,8 @@ var RowExpanding = {
|
|
|
5363
5767
|
return;
|
|
5364
5768
|
}
|
|
5365
5769
|
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
|
|
5366
|
-
if (queued)
|
|
5770
|
+
if (queued)
|
|
5771
|
+
return;
|
|
5367
5772
|
queued = true;
|
|
5368
5773
|
table._queue(() => {
|
|
5369
5774
|
table.resetExpanded();
|
|
@@ -5480,7 +5885,8 @@ var RowExpanding = {
|
|
|
5480
5885
|
row.getToggleExpandedHandler = () => {
|
|
5481
5886
|
const canExpand = row.getCanExpand();
|
|
5482
5887
|
return () => {
|
|
5483
|
-
if (!canExpand)
|
|
5888
|
+
if (!canExpand)
|
|
5889
|
+
return;
|
|
5484
5890
|
row.toggleExpanded();
|
|
5485
5891
|
};
|
|
5486
5892
|
};
|
|
@@ -5519,7 +5925,8 @@ var RowPagination = {
|
|
|
5519
5925
|
return;
|
|
5520
5926
|
}
|
|
5521
5927
|
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
|
|
5522
|
-
if (queued)
|
|
5928
|
+
if (queued)
|
|
5929
|
+
return;
|
|
5523
5930
|
queued = true;
|
|
5524
5931
|
table._queue(() => {
|
|
5525
5932
|
table.resetPageIndex();
|
|
@@ -5712,7 +6119,8 @@ var RowPinning = {
|
|
|
5712
6119
|
row.getPinnedIndex = () => {
|
|
5713
6120
|
var _ref4, _visiblePinnedRowIds$;
|
|
5714
6121
|
const position = row.getIsPinned();
|
|
5715
|
-
if (!position)
|
|
6122
|
+
if (!position)
|
|
6123
|
+
return -1;
|
|
5716
6124
|
const visiblePinnedRowIds = (_ref4 = position === "top" ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map((_ref5) => {
|
|
5717
6125
|
let {
|
|
5718
6126
|
id
|
|
@@ -5953,7 +6361,8 @@ var RowSelection = {
|
|
|
5953
6361
|
const canSelect = row.getCanSelect();
|
|
5954
6362
|
return (e) => {
|
|
5955
6363
|
var _target;
|
|
5956
|
-
if (!canSelect)
|
|
6364
|
+
if (!canSelect)
|
|
6365
|
+
return;
|
|
5957
6366
|
row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
|
|
5958
6367
|
};
|
|
5959
6368
|
};
|
|
@@ -6011,7 +6420,8 @@ function isRowSelected(row, selection) {
|
|
|
6011
6420
|
}
|
|
6012
6421
|
function isSubRowSelected(row, selection, table) {
|
|
6013
6422
|
var _row$subRows3;
|
|
6014
|
-
if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length))
|
|
6423
|
+
if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length))
|
|
6424
|
+
return false;
|
|
6015
6425
|
let allChildrenSelected = true;
|
|
6016
6426
|
let someSelected = false;
|
|
6017
6427
|
row.subRows.forEach((subRow) => {
|
|
@@ -6270,7 +6680,8 @@ var RowSorting = {
|
|
|
6270
6680
|
column.getToggleSortingHandler = () => {
|
|
6271
6681
|
const canSort = column.getCanSort();
|
|
6272
6682
|
return (e) => {
|
|
6273
|
-
if (!canSort)
|
|
6683
|
+
if (!canSort)
|
|
6684
|
+
return;
|
|
6274
6685
|
e.persist == null || e.persist();
|
|
6275
6686
|
column.toggleSorting == null || column.toggleSorting(void 0, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
|
|
6276
6687
|
};
|
|
@@ -6753,7 +7164,8 @@ function getSortedRowModel() {
|
|
|
6753
7164
|
const columnInfoById = {};
|
|
6754
7165
|
availableSorting.forEach((sortEntry) => {
|
|
6755
7166
|
const column = table.getColumn(sortEntry.id);
|
|
6756
|
-
if (!column)
|
|
7167
|
+
if (!column)
|
|
7168
|
+
return;
|
|
6757
7169
|
columnInfoById[sortEntry.id] = {
|
|
6758
7170
|
sortUndefined: column.columnDef.sortUndefined,
|
|
6759
7171
|
invertSorting: column.columnDef.invertSorting,
|
|
@@ -6778,8 +7190,10 @@ function getSortedRowModel() {
|
|
|
6778
7190
|
const aUndefined = aValue === void 0;
|
|
6779
7191
|
const bUndefined = bValue === void 0;
|
|
6780
7192
|
if (aUndefined || bUndefined) {
|
|
6781
|
-
if (sortUndefined === "first")
|
|
6782
|
-
|
|
7193
|
+
if (sortUndefined === "first")
|
|
7194
|
+
return aUndefined ? -1 : 1;
|
|
7195
|
+
if (sortUndefined === "last")
|
|
7196
|
+
return aUndefined ? 1 : -1;
|
|
6783
7197
|
sortInt = aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;
|
|
6784
7198
|
}
|
|
6785
7199
|
}
|
|
@@ -6969,7 +7383,8 @@ TableRow.displayName = "TableRow";
|
|
|
6969
7383
|
var TableHead = t__namespace.forwardRef(
|
|
6970
7384
|
({ className, sortable, sorted, onSort, align = "left", children, ...props }, ref) => {
|
|
6971
7385
|
const renderSortIcon = () => {
|
|
6972
|
-
if (!sortable)
|
|
7386
|
+
if (!sortable)
|
|
7387
|
+
return null;
|
|
6973
7388
|
if (sorted === "asc") {
|
|
6974
7389
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6975
7390
|
"svg",
|
|
@@ -7219,279 +7634,93 @@ function createSortableHeader(label) {
|
|
|
7219
7634
|
}
|
|
7220
7635
|
);
|
|
7221
7636
|
}
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7637
|
+
var pageTransitions2 = {
|
|
7638
|
+
initial: { opacity: 0, x: 20 },
|
|
7639
|
+
animate: { opacity: 1, x: 0 },
|
|
7640
|
+
exit: { opacity: 0, x: -20 }
|
|
7641
|
+
};
|
|
7642
|
+
var datePickerVariants = classVarianceAuthority.cva(
|
|
7643
|
+
"w-full justify-start text-left font-normal",
|
|
7644
|
+
{
|
|
7645
|
+
variants: {
|
|
7646
|
+
variant: {
|
|
7647
|
+
default: "",
|
|
7648
|
+
outline: "border-2",
|
|
7649
|
+
ghost: "hover:bg-accent hover:text-accent-foreground"
|
|
7650
|
+
},
|
|
7651
|
+
size: {
|
|
7652
|
+
default: "h-10 px-4 py-2",
|
|
7653
|
+
sm: "h-8 px-3 text-sm",
|
|
7654
|
+
lg: "h-12 px-6 text-base",
|
|
7655
|
+
icon: "h-10 w-10"
|
|
7656
|
+
},
|
|
7657
|
+
state: {
|
|
7658
|
+
default: "",
|
|
7659
|
+
error: "border-destructive focus:ring-destructive",
|
|
7660
|
+
success: "border-success focus:ring-success",
|
|
7661
|
+
warning: "border-warning focus:ring-warning"
|
|
7662
|
+
}
|
|
7663
|
+
},
|
|
7664
|
+
defaultVariants: {
|
|
7665
|
+
variant: "default",
|
|
7666
|
+
size: "default",
|
|
7667
|
+
state: "default"
|
|
7668
|
+
}
|
|
7669
|
+
}
|
|
7670
|
+
);
|
|
7671
|
+
function DatePicker({
|
|
7228
7672
|
className,
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7673
|
+
variant,
|
|
7674
|
+
size,
|
|
7675
|
+
state,
|
|
7676
|
+
value,
|
|
7677
|
+
onChange,
|
|
7678
|
+
placeholder = "Pick a date",
|
|
7679
|
+
formatString = "PPP",
|
|
7680
|
+
minDate,
|
|
7681
|
+
maxDate,
|
|
7682
|
+
disabledDates,
|
|
7683
|
+
disabledDaysOfWeek,
|
|
7684
|
+
showWeekNumbers,
|
|
7685
|
+
iconPosition = "left",
|
|
7686
|
+
icon,
|
|
7687
|
+
allowClear = true,
|
|
7688
|
+
readOnly = false,
|
|
7689
|
+
showTodayButton = true,
|
|
7690
|
+
calendarProps,
|
|
7691
|
+
disabled,
|
|
7232
7692
|
...props
|
|
7233
7693
|
}) {
|
|
7234
|
-
const [
|
|
7235
|
-
|
|
7236
|
-
)
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
const handlePreviousMonth = () => {
|
|
7247
|
-
setCurrentMonth(dateFns.subMonths(currentMonth, 1));
|
|
7694
|
+
const [open, setOpen] = t__namespace.useState(false);
|
|
7695
|
+
const [internalDate, setInternalDate] = t__namespace.useState(value);
|
|
7696
|
+
t__namespace.useEffect(() => {
|
|
7697
|
+
setInternalDate(value);
|
|
7698
|
+
}, [value]);
|
|
7699
|
+
const handleSelect = (date) => {
|
|
7700
|
+
const singleDate = Array.isArray(date) ? date[0] : date && typeof date === "object" && "from" in date ? date.from : date;
|
|
7701
|
+
setInternalDate(singleDate);
|
|
7702
|
+
onChange?.(singleDate);
|
|
7703
|
+
if (singleDate) {
|
|
7704
|
+
setOpen(false);
|
|
7705
|
+
}
|
|
7248
7706
|
};
|
|
7249
|
-
const
|
|
7250
|
-
|
|
7707
|
+
const handleClear = (e) => {
|
|
7708
|
+
e.stopPropagation();
|
|
7709
|
+
handleSelect(void 0);
|
|
7251
7710
|
};
|
|
7252
|
-
const
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
onSelect?.(date);
|
|
7256
|
-
} else if (mode === "range") {
|
|
7257
|
-
const currentSelection = selected;
|
|
7258
|
-
if (!currentSelection?.from || currentSelection.from && currentSelection.to) {
|
|
7259
|
-
onSelect?.({ from: date, to: void 0 });
|
|
7260
|
-
} else {
|
|
7261
|
-
if (date < currentSelection.from) {
|
|
7262
|
-
onSelect?.({ from: date, to: currentSelection.from });
|
|
7263
|
-
} else {
|
|
7264
|
-
onSelect?.({ from: currentSelection.from, to: date });
|
|
7265
|
-
}
|
|
7266
|
-
}
|
|
7267
|
-
}
|
|
7268
|
-
};
|
|
7269
|
-
const isDateSelected = (date) => {
|
|
7270
|
-
if (!selected) return false;
|
|
7271
|
-
if (mode === "single") {
|
|
7272
|
-
return dateFns.isSameDay(date, selected);
|
|
7273
|
-
} else if (mode === "range") {
|
|
7274
|
-
const range = selected;
|
|
7275
|
-
if (range.from && range.to) {
|
|
7276
|
-
return date >= range.from && date <= range.to;
|
|
7277
|
-
}
|
|
7278
|
-
return range.from ? dateFns.isSameDay(date, range.from) : false;
|
|
7279
|
-
}
|
|
7280
|
-
return false;
|
|
7281
|
-
};
|
|
7282
|
-
const isRangeStart = (date) => {
|
|
7283
|
-
if (mode !== "range" || !selected) return false;
|
|
7284
|
-
const range = selected;
|
|
7285
|
-
return range.from ? dateFns.isSameDay(date, range.from) : false;
|
|
7286
|
-
};
|
|
7287
|
-
const isRangeEnd = (date) => {
|
|
7288
|
-
if (mode !== "range" || !selected) return false;
|
|
7289
|
-
const range = selected;
|
|
7290
|
-
return range.to ? dateFns.isSameDay(date, range.to) : false;
|
|
7291
|
-
};
|
|
7292
|
-
const isRangeMiddle = (date) => {
|
|
7293
|
-
if (mode !== "range" || !selected) return false;
|
|
7294
|
-
const range = selected;
|
|
7295
|
-
if (!range.from || !range.to) return false;
|
|
7296
|
-
return date > range.from && date < range.to;
|
|
7297
|
-
};
|
|
7298
|
-
const getDaysInMonth = () => {
|
|
7299
|
-
const start = dateFns.startOfMonth(currentMonth);
|
|
7300
|
-
const end = dateFns.endOfMonth(currentMonth);
|
|
7301
|
-
const days2 = dateFns.eachDayOfInterval({ start, end });
|
|
7302
|
-
const firstDayOfWeek = dateFns.getDay(start);
|
|
7303
|
-
const previousMonthDays = [];
|
|
7304
|
-
if (firstDayOfWeek > 0 && showOutsideDays) {
|
|
7305
|
-
const previousMonthStart = dateFns.startOfWeek(start);
|
|
7306
|
-
const previousMonthEnd = new Date(start);
|
|
7307
|
-
previousMonthEnd.setDate(previousMonthEnd.getDate() - 1);
|
|
7308
|
-
previousMonthDays.push(...dateFns.eachDayOfInterval({
|
|
7309
|
-
start: previousMonthStart,
|
|
7310
|
-
end: previousMonthEnd
|
|
7311
|
-
}));
|
|
7312
|
-
}
|
|
7313
|
-
const lastDayOfWeek = dateFns.getDay(end);
|
|
7314
|
-
const nextMonthDays = [];
|
|
7315
|
-
if (lastDayOfWeek < 6 && showOutsideDays) {
|
|
7316
|
-
const nextMonthStart = new Date(end);
|
|
7317
|
-
nextMonthStart.setDate(nextMonthStart.getDate() + 1);
|
|
7318
|
-
const nextMonthEnd = dateFns.endOfWeek(end);
|
|
7319
|
-
nextMonthDays.push(...dateFns.eachDayOfInterval({
|
|
7320
|
-
start: nextMonthStart,
|
|
7321
|
-
end: nextMonthEnd
|
|
7322
|
-
}));
|
|
7323
|
-
}
|
|
7324
|
-
const emptyCells = [];
|
|
7325
|
-
if (!showOutsideDays && firstDayOfWeek > 0) {
|
|
7326
|
-
for (let i = 0; i < firstDayOfWeek; i++) {
|
|
7327
|
-
emptyCells.push(null);
|
|
7328
|
-
}
|
|
7329
|
-
}
|
|
7330
|
-
return [...previousMonthDays, ...emptyCells, ...days2, ...nextMonthDays];
|
|
7331
|
-
};
|
|
7332
|
-
const days = getDaysInMonth();
|
|
7333
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("moonui-theme", "p-0", className), children: [
|
|
7334
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-6 py-4 border-b border-border/50 dark:border-gray-700/50", children: [
|
|
7335
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7336
|
-
"button",
|
|
7337
|
-
{
|
|
7338
|
-
onClick: handlePreviousMonth,
|
|
7339
|
-
className: cn(
|
|
7340
|
-
"h-10 w-10 bg-transparent p-0 rounded-lg",
|
|
7341
|
-
"hover:bg-muted transition-colors",
|
|
7342
|
-
"inline-flex items-center justify-center"
|
|
7343
|
-
),
|
|
7344
|
-
type: "button",
|
|
7345
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-5 w-5" })
|
|
7346
|
-
}
|
|
7347
|
-
),
|
|
7348
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-base font-medium", children: dateFns.format(currentMonth, "MMMM yyyy") }),
|
|
7349
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7350
|
-
"button",
|
|
7351
|
-
{
|
|
7352
|
-
onClick: handleNextMonth,
|
|
7353
|
-
className: cn(
|
|
7354
|
-
"h-10 w-10 bg-transparent p-0 rounded-lg",
|
|
7355
|
-
"hover:bg-muted transition-colors",
|
|
7356
|
-
"inline-flex items-center justify-center"
|
|
7357
|
-
),
|
|
7358
|
-
type: "button",
|
|
7359
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-5 w-5" })
|
|
7360
|
-
}
|
|
7361
|
-
)
|
|
7362
|
-
] }),
|
|
7363
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-6 pb-4", children: [
|
|
7364
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 mb-2", children: weekDays.map((day, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7365
|
-
"div",
|
|
7366
|
-
{
|
|
7367
|
-
className: "text-muted-foreground text-xs font-medium h-10 flex items-center justify-center",
|
|
7368
|
-
title: day.full,
|
|
7369
|
-
children: day.short
|
|
7370
|
-
},
|
|
7371
|
-
`weekday-${index}`
|
|
7372
|
-
)) }),
|
|
7373
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 gap-1", children: days.map((date, index) => {
|
|
7374
|
-
if (!date) {
|
|
7375
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-10" }, `empty-${index}`);
|
|
7376
|
-
}
|
|
7377
|
-
const isOutsideMonth = !dateFns.isSameMonth(date, currentMonth);
|
|
7378
|
-
const isDisabled = disabled?.(date) || false;
|
|
7379
|
-
const isSelected = isDateSelected(date);
|
|
7380
|
-
const isTodayDate = dateFns.isToday(date);
|
|
7381
|
-
const rangeStart = isRangeStart(date);
|
|
7382
|
-
const rangeEnd = isRangeEnd(date);
|
|
7383
|
-
const rangeMiddle = isRangeMiddle(date);
|
|
7384
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7385
|
-
"button",
|
|
7386
|
-
{
|
|
7387
|
-
onClick: () => handleDateClick(date),
|
|
7388
|
-
disabled: isDisabled,
|
|
7389
|
-
className: cn(
|
|
7390
|
-
"h-10 w-10 p-0 font-normal",
|
|
7391
|
-
"inline-flex items-center justify-center rounded-lg",
|
|
7392
|
-
"hover:bg-muted transition-colors text-sm",
|
|
7393
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
7394
|
-
isOutsideMonth && "text-muted-foreground/50",
|
|
7395
|
-
isDisabled && "text-muted-foreground/30 cursor-not-allowed hover:bg-transparent",
|
|
7396
|
-
isSelected && !rangeMiddle && "bg-primary text-primary-foreground font-medium hover:bg-primary hover:text-primary-foreground",
|
|
7397
|
-
isTodayDate && "font-semibold relative after:absolute after:bottom-1 after:left-1/2 after:-translate-x-1/2 after:h-1 after:w-1 after:rounded-full after:bg-primary",
|
|
7398
|
-
rangeMiddle && "bg-accent/30 text-accent-foreground rounded-none",
|
|
7399
|
-
rangeStart && "rounded-r-none",
|
|
7400
|
-
rangeEnd && "rounded-l-none"
|
|
7401
|
-
),
|
|
7402
|
-
type: "button",
|
|
7403
|
-
children: dateFns.format(date, "d")
|
|
7404
|
-
},
|
|
7405
|
-
date.toISOString()
|
|
7406
|
-
);
|
|
7407
|
-
}) })
|
|
7408
|
-
] })
|
|
7409
|
-
] });
|
|
7410
|
-
}
|
|
7411
|
-
Calendar.displayName = "Calendar";
|
|
7412
|
-
var pageTransitions2 = {
|
|
7413
|
-
initial: { opacity: 0, x: 20 },
|
|
7414
|
-
animate: { opacity: 1, x: 0 },
|
|
7415
|
-
exit: { opacity: 0, x: -20 }
|
|
7416
|
-
};
|
|
7417
|
-
var datePickerVariants = classVarianceAuthority.cva(
|
|
7418
|
-
"w-full justify-start text-left font-normal",
|
|
7419
|
-
{
|
|
7420
|
-
variants: {
|
|
7421
|
-
variant: {
|
|
7422
|
-
default: "",
|
|
7423
|
-
outline: "border-2",
|
|
7424
|
-
ghost: "hover:bg-accent hover:text-accent-foreground"
|
|
7425
|
-
},
|
|
7426
|
-
size: {
|
|
7427
|
-
default: "h-10 px-4 py-2",
|
|
7428
|
-
sm: "h-8 px-3 text-sm",
|
|
7429
|
-
lg: "h-12 px-6 text-base",
|
|
7430
|
-
icon: "h-10 w-10"
|
|
7431
|
-
},
|
|
7432
|
-
state: {
|
|
7433
|
-
default: "",
|
|
7434
|
-
error: "border-destructive focus:ring-destructive",
|
|
7435
|
-
success: "border-success focus:ring-success",
|
|
7436
|
-
warning: "border-warning focus:ring-warning"
|
|
7437
|
-
}
|
|
7438
|
-
},
|
|
7439
|
-
defaultVariants: {
|
|
7440
|
-
variant: "default",
|
|
7441
|
-
size: "default",
|
|
7442
|
-
state: "default"
|
|
7443
|
-
}
|
|
7444
|
-
}
|
|
7445
|
-
);
|
|
7446
|
-
function DatePicker({
|
|
7447
|
-
className,
|
|
7448
|
-
variant,
|
|
7449
|
-
size,
|
|
7450
|
-
state,
|
|
7451
|
-
value,
|
|
7452
|
-
onChange,
|
|
7453
|
-
placeholder = "Pick a date",
|
|
7454
|
-
formatString = "PPP",
|
|
7455
|
-
minDate,
|
|
7456
|
-
maxDate,
|
|
7457
|
-
disabledDates,
|
|
7458
|
-
disabledDaysOfWeek,
|
|
7459
|
-
showWeekNumbers,
|
|
7460
|
-
iconPosition = "left",
|
|
7461
|
-
icon,
|
|
7462
|
-
allowClear = true,
|
|
7463
|
-
readOnly = false,
|
|
7464
|
-
showTodayButton = true,
|
|
7465
|
-
calendarProps,
|
|
7466
|
-
disabled,
|
|
7467
|
-
...props
|
|
7468
|
-
}) {
|
|
7469
|
-
const [open, setOpen] = t__namespace.useState(false);
|
|
7470
|
-
const [internalDate, setInternalDate] = t__namespace.useState(value);
|
|
7471
|
-
t__namespace.useEffect(() => {
|
|
7472
|
-
setInternalDate(value);
|
|
7473
|
-
}, [value]);
|
|
7474
|
-
const handleSelect = (date) => {
|
|
7475
|
-
const singleDate = Array.isArray(date) ? date[0] : date && typeof date === "object" && "from" in date ? date.from : date;
|
|
7476
|
-
setInternalDate(singleDate);
|
|
7477
|
-
onChange?.(singleDate);
|
|
7478
|
-
if (singleDate) {
|
|
7479
|
-
setOpen(false);
|
|
7480
|
-
}
|
|
7481
|
-
};
|
|
7482
|
-
const handleClear = (e) => {
|
|
7483
|
-
e.stopPropagation();
|
|
7484
|
-
handleSelect(void 0);
|
|
7485
|
-
};
|
|
7486
|
-
const handleToday = () => {
|
|
7487
|
-
const today = /* @__PURE__ */ new Date();
|
|
7488
|
-
handleSelect(today);
|
|
7711
|
+
const handleToday = () => {
|
|
7712
|
+
const today = /* @__PURE__ */ new Date();
|
|
7713
|
+
handleSelect(today);
|
|
7489
7714
|
};
|
|
7490
7715
|
const isDateDisabled = (date) => {
|
|
7491
|
-
if (minDate && date < minDate)
|
|
7492
|
-
|
|
7493
|
-
if (
|
|
7494
|
-
|
|
7716
|
+
if (minDate && date < minDate)
|
|
7717
|
+
return true;
|
|
7718
|
+
if (maxDate && date > maxDate)
|
|
7719
|
+
return true;
|
|
7720
|
+
if (disabledDates?.some((d) => d.toDateString() === date.toDateString()))
|
|
7721
|
+
return true;
|
|
7722
|
+
if (disabledDaysOfWeek?.includes(date.getDay()))
|
|
7723
|
+
return true;
|
|
7495
7724
|
return false;
|
|
7496
7725
|
};
|
|
7497
7726
|
const displayValue = internalDate && dateFns.isValid(internalDate) ? dateFns.format(internalDate, formatString) : null;
|
|
@@ -7633,7 +7862,8 @@ function DateRangePicker({
|
|
|
7633
7862
|
}
|
|
7634
7863
|
};
|
|
7635
7864
|
const displayValue = t__namespace.useMemo(() => {
|
|
7636
|
-
if (!internalRange?.from)
|
|
7865
|
+
if (!internalRange?.from)
|
|
7866
|
+
return null;
|
|
7637
7867
|
if (!internalRange?.to) {
|
|
7638
7868
|
return dateFns.format(internalRange.from, formatString);
|
|
7639
7869
|
}
|
|
@@ -7867,7 +8097,8 @@ function DraggableList({
|
|
|
7867
8097
|
}) {
|
|
7868
8098
|
const [draggedIndex, setDraggedIndex] = t__namespace.useState(null);
|
|
7869
8099
|
const handleDragStart = (e, index) => {
|
|
7870
|
-
if (disabled)
|
|
8100
|
+
if (disabled)
|
|
8101
|
+
return;
|
|
7871
8102
|
setDraggedIndex(index);
|
|
7872
8103
|
e.dataTransfer.effectAllowed = "move";
|
|
7873
8104
|
};
|
|
@@ -8161,14 +8392,19 @@ var Progress = t__namespace.forwardRef(({
|
|
|
8161
8392
|
});
|
|
8162
8393
|
Progress.displayName = "Progress";
|
|
8163
8394
|
var getFileIcon = (type) => {
|
|
8164
|
-
if (type.startsWith("image/"))
|
|
8165
|
-
|
|
8166
|
-
if (type.startsWith("
|
|
8167
|
-
|
|
8395
|
+
if (type.startsWith("image/"))
|
|
8396
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Image, { className: "h-4 w-4" });
|
|
8397
|
+
if (type.startsWith("video/"))
|
|
8398
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Video, { className: "h-4 w-4" });
|
|
8399
|
+
if (type.startsWith("audio/"))
|
|
8400
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Music, { className: "h-4 w-4" });
|
|
8401
|
+
if (type.includes("text") || type.includes("document"))
|
|
8402
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "h-4 w-4" });
|
|
8168
8403
|
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.File, { className: "h-4 w-4" });
|
|
8169
8404
|
};
|
|
8170
8405
|
var formatFileSize = (bytes) => {
|
|
8171
|
-
if (bytes === 0)
|
|
8406
|
+
if (bytes === 0)
|
|
8407
|
+
return "0 Bytes";
|
|
8172
8408
|
const k3 = 1024;
|
|
8173
8409
|
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
8174
8410
|
const i = Math.floor(Math.log(bytes) / Math.log(k3));
|
|
@@ -8328,7 +8564,8 @@ var FileUpload = t__namespace.default.forwardRef(
|
|
|
8328
8564
|
const handleDrop = t.useCallback((e) => {
|
|
8329
8565
|
e.preventDefault();
|
|
8330
8566
|
setIsDragOver(false);
|
|
8331
|
-
if (disabled)
|
|
8567
|
+
if (disabled)
|
|
8568
|
+
return;
|
|
8332
8569
|
const files = e.dataTransfer.files;
|
|
8333
8570
|
if (files.length > 0) {
|
|
8334
8571
|
processFiles(files);
|
|
@@ -8469,7 +8706,8 @@ var GestureDrawer = t__namespace.default.forwardRef(
|
|
|
8469
8706
|
const motionValue = isVertical ? y : x;
|
|
8470
8707
|
const opacity = framerMotion.useTransform(motionValue, [0, threshold], [1, 0.5]);
|
|
8471
8708
|
const handleDragEnd = (event, info) => {
|
|
8472
|
-
if (!enableSwipeToClose)
|
|
8709
|
+
if (!enableSwipeToClose)
|
|
8710
|
+
return;
|
|
8473
8711
|
const offset = isVertical ? info.offset.y : info.offset.x;
|
|
8474
8712
|
const velocity = isVertical ? info.velocity.y : info.velocity.x;
|
|
8475
8713
|
let shouldClose = false;
|
|
@@ -8510,7 +8748,8 @@ var GestureDrawer = t__namespace.default.forwardRef(
|
|
|
8510
8748
|
const getAnimatePosition = () => {
|
|
8511
8749
|
return isVertical ? { y: 0 } : { x: 0 };
|
|
8512
8750
|
};
|
|
8513
|
-
if (!isOpen)
|
|
8751
|
+
if (!isOpen)
|
|
8752
|
+
return null;
|
|
8514
8753
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed inset-0 z-50", children: [
|
|
8515
8754
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8516
8755
|
framerMotion.motion.div,
|
|
@@ -8730,7 +8969,8 @@ function LockedComponent({
|
|
|
8730
8969
|
const [isPreviewActive, setIsPreviewActive] = t.useState(false);
|
|
8731
8970
|
const [previewTimeout, setPreviewTimeout] = t.useState(null);
|
|
8732
8971
|
const handleMouseEnter = () => {
|
|
8733
|
-
if (!showPreview)
|
|
8972
|
+
if (!showPreview)
|
|
8973
|
+
return;
|
|
8734
8974
|
setIsPreviewActive(true);
|
|
8735
8975
|
if (previewTimeout) {
|
|
8736
8976
|
clearTimeout(previewTimeout);
|
|
@@ -8836,6 +9076,7 @@ function ProComponentWrapper({
|
|
|
8836
9076
|
nodeEnv: process.env.NODE_ENV === "development",
|
|
8837
9077
|
nextPublicEnv: process.env.NEXT_PUBLIC_VERCEL_ENV === "development",
|
|
8838
9078
|
localhost: typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes(".local")),
|
|
9079
|
+
port: typeof window !== "undefined" && (window.location.port === "3000" || window.location.port === "3001" || window.location.port === "8080"),
|
|
8839
9080
|
vercelEnv: !process.env.VERCEL,
|
|
8840
9081
|
ciEnv: !process.env.CI,
|
|
8841
9082
|
deploymentEnv: !process.env.DEPLOYMENT_ENV
|
|
@@ -8916,7 +9157,9 @@ function ProComponentWrapper({
|
|
|
8916
9157
|
const isDevelopment = () => {
|
|
8917
9158
|
const checks = {
|
|
8918
9159
|
nodeEnv: process.env.NODE_ENV === "development",
|
|
8919
|
-
localhost: typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes(".local"))
|
|
9160
|
+
localhost: typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes(".local")),
|
|
9161
|
+
port: typeof window !== "undefined" && (window.location.port === "3000" || window.location.port === "3001" || window.location.port === "8080")
|
|
9162
|
+
};
|
|
8920
9163
|
if (process.env.VERCEL || process.env.NETLIFY || process.env.RENDER || process.env.RAILWAY_ENVIRONMENT || process.env.FLY_APP_NAME) {
|
|
8921
9164
|
return false;
|
|
8922
9165
|
}
|
|
@@ -9006,7 +9249,8 @@ function MoonLogo({
|
|
|
9006
9249
|
}) {
|
|
9007
9250
|
const logoId = t__namespace.useId();
|
|
9008
9251
|
const gradientId = `moon-gradient-${logoId}`;
|
|
9009
|
-
|
|
9252
|
+
const maskId = `moon-mask-${logoId}`;
|
|
9253
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2", className), children: [
|
|
9010
9254
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
9011
9255
|
"svg",
|
|
9012
9256
|
{
|
|
@@ -9018,11 +9262,17 @@ function MoonLogo({
|
|
|
9018
9262
|
className: "flex-shrink-0",
|
|
9019
9263
|
...props,
|
|
9020
9264
|
children: [
|
|
9021
|
-
|
|
9022
|
-
/* @__PURE__ */ jsxRuntime.
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9265
|
+
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
9266
|
+
variant === "gradient" && /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
|
|
9267
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: "#3B82F6" }),
|
|
9268
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "50%", stopColor: "#8B5CF6" }),
|
|
9269
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: "#EC4899" })
|
|
9270
|
+
] }),
|
|
9271
|
+
/* @__PURE__ */ jsxRuntime.jsxs("mask", { id: maskId, children: [
|
|
9272
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "32", height: "32", fill: "white" }),
|
|
9273
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "22", cy: "10", r: "10", fill: "black" })
|
|
9274
|
+
] })
|
|
9275
|
+
] }),
|
|
9026
9276
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9027
9277
|
"circle",
|
|
9028
9278
|
{
|
|
@@ -9030,17 +9280,8 @@ function MoonLogo({
|
|
|
9030
9280
|
cy: "16",
|
|
9031
9281
|
r: "14",
|
|
9032
9282
|
fill: variant === "gradient" ? `url(#${gradientId})` : "currentColor",
|
|
9033
|
-
className: variant === "default" ? "fill-primary" : ""
|
|
9034
|
-
|
|
9035
|
-
),
|
|
9036
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9037
|
-
"circle",
|
|
9038
|
-
{
|
|
9039
|
-
cx: "22",
|
|
9040
|
-
cy: "10",
|
|
9041
|
-
r: "10",
|
|
9042
|
-
fill: "white",
|
|
9043
|
-
className: "dark:fill-background"
|
|
9283
|
+
className: variant === "default" ? "fill-primary" : "",
|
|
9284
|
+
mask: `url(#${maskId})`
|
|
9044
9285
|
}
|
|
9045
9286
|
)
|
|
9046
9287
|
]
|
|
@@ -9359,22 +9600,30 @@ var formatPhoneNumber = (value, countryCode) => {
|
|
|
9359
9600
|
const cleaned = value.replace(/\D/g, "");
|
|
9360
9601
|
switch (countryCode) {
|
|
9361
9602
|
case "+1":
|
|
9362
|
-
if (cleaned.length <= 3)
|
|
9363
|
-
|
|
9603
|
+
if (cleaned.length <= 3)
|
|
9604
|
+
return cleaned;
|
|
9605
|
+
if (cleaned.length <= 6)
|
|
9606
|
+
return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3)}`;
|
|
9364
9607
|
return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)}-${cleaned.slice(6, 10)}`;
|
|
9365
9608
|
case "+44":
|
|
9366
|
-
if (cleaned.length <= 4)
|
|
9367
|
-
|
|
9609
|
+
if (cleaned.length <= 4)
|
|
9610
|
+
return cleaned;
|
|
9611
|
+
if (cleaned.length <= 7)
|
|
9612
|
+
return `${cleaned.slice(0, 4)} ${cleaned.slice(4)}`;
|
|
9368
9613
|
return `${cleaned.slice(0, 4)} ${cleaned.slice(4, 7)} ${cleaned.slice(7, 11)}`;
|
|
9369
9614
|
case "+90":
|
|
9370
|
-
if (cleaned.length <= 3)
|
|
9371
|
-
|
|
9372
|
-
if (cleaned.length <=
|
|
9615
|
+
if (cleaned.length <= 3)
|
|
9616
|
+
return cleaned;
|
|
9617
|
+
if (cleaned.length <= 6)
|
|
9618
|
+
return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3)}`;
|
|
9619
|
+
if (cleaned.length <= 9)
|
|
9620
|
+
return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)} ${cleaned.slice(6)}`;
|
|
9373
9621
|
return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)} ${cleaned.slice(6, 8)} ${cleaned.slice(8, 10)}`;
|
|
9374
9622
|
default:
|
|
9375
9623
|
let formatted = "";
|
|
9376
9624
|
for (let i = 0; i < cleaned.length; i++) {
|
|
9377
|
-
if (i > 0 && i % 3 === 0)
|
|
9625
|
+
if (i > 0 && i % 3 === 0)
|
|
9626
|
+
formatted += " ";
|
|
9378
9627
|
formatted += cleaned[i];
|
|
9379
9628
|
}
|
|
9380
9629
|
return formatted;
|
|
@@ -9384,13 +9633,10 @@ var getMaxLength = (countryCode) => {
|
|
|
9384
9633
|
switch (countryCode) {
|
|
9385
9634
|
case "+1":
|
|
9386
9635
|
return 10;
|
|
9387
|
-
// US/Canada
|
|
9388
9636
|
case "+44":
|
|
9389
9637
|
return 11;
|
|
9390
|
-
// UK
|
|
9391
9638
|
case "+90":
|
|
9392
9639
|
return 10;
|
|
9393
|
-
// Turkey
|
|
9394
9640
|
default:
|
|
9395
9641
|
return 15;
|
|
9396
9642
|
}
|
|
@@ -9597,54 +9843,236 @@ function RichTextEditor({
|
|
|
9597
9843
|
onChange(e.target.value);
|
|
9598
9844
|
}
|
|
9599
9845
|
};
|
|
9600
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("border border-input rounded-md", className), children: [
|
|
9601
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-border p-2 bg-muted/50", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
|
|
9602
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9603
|
-
"button",
|
|
9604
|
-
{
|
|
9605
|
-
type: "button",
|
|
9606
|
-
className: "px-2 py-1 text-sm rounded hover:bg-background disabled:opacity-50",
|
|
9607
|
-
disabled,
|
|
9608
|
-
title: "Bold (Pro feature)",
|
|
9609
|
-
children: "B"
|
|
9610
|
-
}
|
|
9611
|
-
),
|
|
9612
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9613
|
-
"button",
|
|
9614
|
-
{
|
|
9615
|
-
type: "button",
|
|
9616
|
-
className: "px-2 py-1 text-sm rounded hover:bg-background disabled:opacity-50",
|
|
9617
|
-
disabled,
|
|
9618
|
-
title: "Italic (Pro feature)",
|
|
9619
|
-
children: "I"
|
|
9620
|
-
}
|
|
9621
|
-
),
|
|
9622
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9623
|
-
"button",
|
|
9624
|
-
{
|
|
9625
|
-
type: "button",
|
|
9626
|
-
className: "px-2 py-1 text-sm rounded hover:bg-background disabled:opacity-50",
|
|
9627
|
-
disabled,
|
|
9628
|
-
title: "Underline (Pro feature)",
|
|
9629
|
-
children: "U"
|
|
9630
|
-
}
|
|
9631
|
-
)
|
|
9632
|
-
] }) }),
|
|
9633
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9634
|
-
"textarea",
|
|
9635
|
-
{
|
|
9636
|
-
value,
|
|
9637
|
-
onChange: handleChange,
|
|
9638
|
-
placeholder,
|
|
9639
|
-
disabled,
|
|
9640
|
-
className: cn(
|
|
9641
|
-
"w-full min-h-[200px] p-3 resize-none border-0 bg-transparent",
|
|
9642
|
-
"focus:outline-none focus:ring-0",
|
|
9643
|
-
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
9644
|
-
)
|
|
9645
|
-
}
|
|
9646
|
-
)
|
|
9647
|
-
] });
|
|
9846
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("border border-input rounded-md", className), children: [
|
|
9847
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-border p-2 bg-muted/50", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
|
|
9848
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9849
|
+
"button",
|
|
9850
|
+
{
|
|
9851
|
+
type: "button",
|
|
9852
|
+
className: "px-2 py-1 text-sm rounded hover:bg-background disabled:opacity-50",
|
|
9853
|
+
disabled,
|
|
9854
|
+
title: "Bold (Pro feature)",
|
|
9855
|
+
children: "B"
|
|
9856
|
+
}
|
|
9857
|
+
),
|
|
9858
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9859
|
+
"button",
|
|
9860
|
+
{
|
|
9861
|
+
type: "button",
|
|
9862
|
+
className: "px-2 py-1 text-sm rounded hover:bg-background disabled:opacity-50",
|
|
9863
|
+
disabled,
|
|
9864
|
+
title: "Italic (Pro feature)",
|
|
9865
|
+
children: "I"
|
|
9866
|
+
}
|
|
9867
|
+
),
|
|
9868
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9869
|
+
"button",
|
|
9870
|
+
{
|
|
9871
|
+
type: "button",
|
|
9872
|
+
className: "px-2 py-1 text-sm rounded hover:bg-background disabled:opacity-50",
|
|
9873
|
+
disabled,
|
|
9874
|
+
title: "Underline (Pro feature)",
|
|
9875
|
+
children: "U"
|
|
9876
|
+
}
|
|
9877
|
+
)
|
|
9878
|
+
] }) }),
|
|
9879
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9880
|
+
"textarea",
|
|
9881
|
+
{
|
|
9882
|
+
value,
|
|
9883
|
+
onChange: handleChange,
|
|
9884
|
+
placeholder,
|
|
9885
|
+
disabled,
|
|
9886
|
+
className: cn(
|
|
9887
|
+
"w-full min-h-[200px] p-3 resize-none border-0 bg-transparent",
|
|
9888
|
+
"focus:outline-none focus:ring-0",
|
|
9889
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
9890
|
+
)
|
|
9891
|
+
}
|
|
9892
|
+
)
|
|
9893
|
+
] });
|
|
9894
|
+
}
|
|
9895
|
+
function useStateMachine2(initialState, machine) {
|
|
9896
|
+
return t__namespace.useReducer((state, event) => {
|
|
9897
|
+
const nextState = machine[state][event];
|
|
9898
|
+
return nextState ?? state;
|
|
9899
|
+
}, initialState);
|
|
9900
|
+
}
|
|
9901
|
+
var Presence2 = (props) => {
|
|
9902
|
+
const { present, children } = props;
|
|
9903
|
+
const presence = usePresence2(present);
|
|
9904
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : t__namespace.Children.only(children);
|
|
9905
|
+
const ref = useComposedRefs2(presence.ref, getElementRef2(child));
|
|
9906
|
+
const forceMount = typeof children === "function";
|
|
9907
|
+
return forceMount || presence.isPresent ? t__namespace.cloneElement(child, { ref }) : null;
|
|
9908
|
+
};
|
|
9909
|
+
Presence2.displayName = "Presence";
|
|
9910
|
+
function usePresence2(present) {
|
|
9911
|
+
const [node, setNode] = t__namespace.useState();
|
|
9912
|
+
const stylesRef = t__namespace.useRef(null);
|
|
9913
|
+
const prevPresentRef = t__namespace.useRef(present);
|
|
9914
|
+
const prevAnimationNameRef = t__namespace.useRef("none");
|
|
9915
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
9916
|
+
const [state, send] = useStateMachine2(initialState, {
|
|
9917
|
+
mounted: {
|
|
9918
|
+
UNMOUNT: "unmounted",
|
|
9919
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
9920
|
+
},
|
|
9921
|
+
unmountSuspended: {
|
|
9922
|
+
MOUNT: "mounted",
|
|
9923
|
+
ANIMATION_END: "unmounted"
|
|
9924
|
+
},
|
|
9925
|
+
unmounted: {
|
|
9926
|
+
MOUNT: "mounted"
|
|
9927
|
+
}
|
|
9928
|
+
});
|
|
9929
|
+
t__namespace.useEffect(() => {
|
|
9930
|
+
const currentAnimationName = getAnimationName2(stylesRef.current);
|
|
9931
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
9932
|
+
}, [state]);
|
|
9933
|
+
useLayoutEffect22(() => {
|
|
9934
|
+
const styles = stylesRef.current;
|
|
9935
|
+
const wasPresent = prevPresentRef.current;
|
|
9936
|
+
const hasPresentChanged = wasPresent !== present;
|
|
9937
|
+
if (hasPresentChanged) {
|
|
9938
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
9939
|
+
const currentAnimationName = getAnimationName2(styles);
|
|
9940
|
+
if (present) {
|
|
9941
|
+
send("MOUNT");
|
|
9942
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
9943
|
+
send("UNMOUNT");
|
|
9944
|
+
} else {
|
|
9945
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
9946
|
+
if (wasPresent && isAnimating) {
|
|
9947
|
+
send("ANIMATION_OUT");
|
|
9948
|
+
} else {
|
|
9949
|
+
send("UNMOUNT");
|
|
9950
|
+
}
|
|
9951
|
+
}
|
|
9952
|
+
prevPresentRef.current = present;
|
|
9953
|
+
}
|
|
9954
|
+
}, [present, send]);
|
|
9955
|
+
useLayoutEffect22(() => {
|
|
9956
|
+
if (node) {
|
|
9957
|
+
let timeoutId;
|
|
9958
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
9959
|
+
const handleAnimationEnd = (event) => {
|
|
9960
|
+
const currentAnimationName = getAnimationName2(stylesRef.current);
|
|
9961
|
+
const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
|
|
9962
|
+
if (event.target === node && isCurrentAnimation) {
|
|
9963
|
+
send("ANIMATION_END");
|
|
9964
|
+
if (!prevPresentRef.current) {
|
|
9965
|
+
const currentFillMode = node.style.animationFillMode;
|
|
9966
|
+
node.style.animationFillMode = "forwards";
|
|
9967
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
9968
|
+
if (node.style.animationFillMode === "forwards") {
|
|
9969
|
+
node.style.animationFillMode = currentFillMode;
|
|
9970
|
+
}
|
|
9971
|
+
});
|
|
9972
|
+
}
|
|
9973
|
+
}
|
|
9974
|
+
};
|
|
9975
|
+
const handleAnimationStart = (event) => {
|
|
9976
|
+
if (event.target === node) {
|
|
9977
|
+
prevAnimationNameRef.current = getAnimationName2(stylesRef.current);
|
|
9978
|
+
}
|
|
9979
|
+
};
|
|
9980
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
9981
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
9982
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
9983
|
+
return () => {
|
|
9984
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
9985
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
9986
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
9987
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
9988
|
+
};
|
|
9989
|
+
} else {
|
|
9990
|
+
send("ANIMATION_END");
|
|
9991
|
+
}
|
|
9992
|
+
}, [node, send]);
|
|
9993
|
+
return {
|
|
9994
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
9995
|
+
ref: t__namespace.useCallback((node2) => {
|
|
9996
|
+
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
9997
|
+
setNode(node2);
|
|
9998
|
+
}, [])
|
|
9999
|
+
};
|
|
10000
|
+
}
|
|
10001
|
+
function getAnimationName2(styles) {
|
|
10002
|
+
return styles?.animationName || "none";
|
|
10003
|
+
}
|
|
10004
|
+
function getElementRef2(element) {
|
|
10005
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
10006
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10007
|
+
if (mayWarn) {
|
|
10008
|
+
return element.ref;
|
|
10009
|
+
}
|
|
10010
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
10011
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10012
|
+
if (mayWarn) {
|
|
10013
|
+
return element.props.ref;
|
|
10014
|
+
}
|
|
10015
|
+
return element.props.ref || element.ref;
|
|
10016
|
+
}
|
|
10017
|
+
function createContextScope2(scopeName, createContextScopeDeps = []) {
|
|
10018
|
+
let defaultContexts = [];
|
|
10019
|
+
function createContext32(rootComponentName, defaultContext) {
|
|
10020
|
+
const BaseContext = t__namespace.createContext(defaultContext);
|
|
10021
|
+
const index = defaultContexts.length;
|
|
10022
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
10023
|
+
const Provider3 = (props) => {
|
|
10024
|
+
const { scope, children, ...context } = props;
|
|
10025
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
10026
|
+
const value = t__namespace.useMemo(() => context, Object.values(context));
|
|
10027
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
10028
|
+
};
|
|
10029
|
+
Provider3.displayName = rootComponentName + "Provider";
|
|
10030
|
+
function useContext22(consumerName, scope) {
|
|
10031
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
10032
|
+
const context = t__namespace.useContext(Context);
|
|
10033
|
+
if (context)
|
|
10034
|
+
return context;
|
|
10035
|
+
if (defaultContext !== void 0)
|
|
10036
|
+
return defaultContext;
|
|
10037
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
10038
|
+
}
|
|
10039
|
+
return [Provider3, useContext22];
|
|
10040
|
+
}
|
|
10041
|
+
const createScope = () => {
|
|
10042
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
10043
|
+
return t__namespace.createContext(defaultContext);
|
|
10044
|
+
});
|
|
10045
|
+
return function useScope(scope) {
|
|
10046
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
10047
|
+
return t__namespace.useMemo(
|
|
10048
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
10049
|
+
[scope, contexts]
|
|
10050
|
+
);
|
|
10051
|
+
};
|
|
10052
|
+
};
|
|
10053
|
+
createScope.scopeName = scopeName;
|
|
10054
|
+
return [createContext32, composeContextScopes2(createScope, ...createContextScopeDeps)];
|
|
10055
|
+
}
|
|
10056
|
+
function composeContextScopes2(...scopes) {
|
|
10057
|
+
const baseScope = scopes[0];
|
|
10058
|
+
if (scopes.length === 1)
|
|
10059
|
+
return baseScope;
|
|
10060
|
+
const createScope = () => {
|
|
10061
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
10062
|
+
useScope: createScope2(),
|
|
10063
|
+
scopeName: createScope2.scopeName
|
|
10064
|
+
}));
|
|
10065
|
+
return function useComposedScopes(overrideScopes) {
|
|
10066
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
10067
|
+
const scopeProps = useScope(overrideScopes);
|
|
10068
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
10069
|
+
return { ...nextScopes2, ...currentScope };
|
|
10070
|
+
}, {});
|
|
10071
|
+
return t__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
10072
|
+
};
|
|
10073
|
+
};
|
|
10074
|
+
createScope.scopeName = baseScope.scopeName;
|
|
10075
|
+
return createScope;
|
|
9648
10076
|
}
|
|
9649
10077
|
function useCallbackRef(callback) {
|
|
9650
10078
|
const callbackRef = t__namespace.useRef(callback);
|
|
@@ -9663,14 +10091,22 @@ function useDirection(localDir) {
|
|
|
9663
10091
|
function clamp(value, [min2, max2]) {
|
|
9664
10092
|
return Math.min(max2, Math.max(min2, value));
|
|
9665
10093
|
}
|
|
9666
|
-
function
|
|
10094
|
+
function composeEventHandlers2(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
10095
|
+
return function handleEvent(event) {
|
|
10096
|
+
originalEventHandler?.(event);
|
|
10097
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
10098
|
+
return ourEventHandler?.(event);
|
|
10099
|
+
}
|
|
10100
|
+
};
|
|
10101
|
+
}
|
|
10102
|
+
function useStateMachine3(initialState, machine) {
|
|
9667
10103
|
return t__namespace.useReducer((state, event) => {
|
|
9668
10104
|
const nextState = machine[state][event];
|
|
9669
10105
|
return nextState ?? state;
|
|
9670
10106
|
}, initialState);
|
|
9671
10107
|
}
|
|
9672
10108
|
var SCROLL_AREA_NAME = "ScrollArea";
|
|
9673
|
-
var [createScrollAreaContext] =
|
|
10109
|
+
var [createScrollAreaContext, createScrollAreaScope] = createContextScope2(SCROLL_AREA_NAME);
|
|
9674
10110
|
var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
|
|
9675
10111
|
var ScrollArea = t__namespace.forwardRef(
|
|
9676
10112
|
(props, forwardedRef) => {
|
|
@@ -9690,7 +10126,7 @@ var ScrollArea = t__namespace.forwardRef(
|
|
|
9690
10126
|
const [cornerHeight, setCornerHeight] = t__namespace.useState(0);
|
|
9691
10127
|
const [scrollbarXEnabled, setScrollbarXEnabled] = t__namespace.useState(false);
|
|
9692
10128
|
const [scrollbarYEnabled, setScrollbarYEnabled] = t__namespace.useState(false);
|
|
9693
|
-
const composedRefs =
|
|
10129
|
+
const composedRefs = useComposedRefs2(forwardedRef, (node) => setScrollArea(node));
|
|
9694
10130
|
const direction = useDirection(dir);
|
|
9695
10131
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9696
10132
|
ScrollAreaProvider,
|
|
@@ -9715,7 +10151,7 @@ var ScrollArea = t__namespace.forwardRef(
|
|
|
9715
10151
|
onCornerWidthChange: setCornerWidth,
|
|
9716
10152
|
onCornerHeightChange: setCornerHeight,
|
|
9717
10153
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9718
|
-
|
|
10154
|
+
Primitive2.div,
|
|
9719
10155
|
{
|
|
9720
10156
|
dir: direction,
|
|
9721
10157
|
...scrollAreaProps,
|
|
@@ -9740,7 +10176,7 @@ var ScrollAreaViewport = t__namespace.forwardRef(
|
|
|
9740
10176
|
const { __scopeScrollArea, children, nonce, ...viewportProps } = props;
|
|
9741
10177
|
const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
|
|
9742
10178
|
const ref = t__namespace.useRef(null);
|
|
9743
|
-
const composedRefs =
|
|
10179
|
+
const composedRefs = useComposedRefs2(forwardedRef, ref, context.onViewportChange);
|
|
9744
10180
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9745
10181
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9746
10182
|
"style",
|
|
@@ -9752,7 +10188,7 @@ var ScrollAreaViewport = t__namespace.forwardRef(
|
|
|
9752
10188
|
}
|
|
9753
10189
|
),
|
|
9754
10190
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9755
|
-
|
|
10191
|
+
Primitive2.div,
|
|
9756
10192
|
{
|
|
9757
10193
|
"data-radix-scroll-area-viewport": "",
|
|
9758
10194
|
...viewportProps,
|
|
@@ -9821,7 +10257,7 @@ var ScrollAreaScrollbarHover = t__namespace.forwardRef((props, forwardedRef) =>
|
|
|
9821
10257
|
};
|
|
9822
10258
|
}
|
|
9823
10259
|
}, [context.scrollArea, context.scrollHideDelay]);
|
|
9824
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10260
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Presence2, { present: forceMount || visible, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9825
10261
|
ScrollAreaScrollbarAuto,
|
|
9826
10262
|
{
|
|
9827
10263
|
"data-state": visible ? "visible" : "hidden",
|
|
@@ -9835,7 +10271,7 @@ var ScrollAreaScrollbarScroll = t__namespace.forwardRef((props, forwardedRef) =>
|
|
|
9835
10271
|
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
9836
10272
|
const isHorizontal = props.orientation === "horizontal";
|
|
9837
10273
|
const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
|
|
9838
|
-
const [state, send] =
|
|
10274
|
+
const [state, send] = useStateMachine3("hidden", {
|
|
9839
10275
|
hidden: {
|
|
9840
10276
|
SCROLL: "scrolling"
|
|
9841
10277
|
},
|
|
@@ -9877,14 +10313,14 @@ var ScrollAreaScrollbarScroll = t__namespace.forwardRef((props, forwardedRef) =>
|
|
|
9877
10313
|
return () => viewport.removeEventListener("scroll", handleScroll);
|
|
9878
10314
|
}
|
|
9879
10315
|
}, [context.viewport, isHorizontal, send, debounceScrollEnd]);
|
|
9880
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10316
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Presence2, { present: forceMount || state !== "hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9881
10317
|
ScrollAreaScrollbarVisible,
|
|
9882
10318
|
{
|
|
9883
10319
|
"data-state": state === "hidden" ? "hidden" : "visible",
|
|
9884
10320
|
...scrollbarProps,
|
|
9885
10321
|
ref: forwardedRef,
|
|
9886
|
-
onPointerEnter:
|
|
9887
|
-
onPointerLeave:
|
|
10322
|
+
onPointerEnter: composeEventHandlers2(props.onPointerEnter, () => send("POINTER_ENTER")),
|
|
10323
|
+
onPointerLeave: composeEventHandlers2(props.onPointerLeave, () => send("POINTER_LEAVE"))
|
|
9888
10324
|
}
|
|
9889
10325
|
) });
|
|
9890
10326
|
});
|
|
@@ -9902,7 +10338,7 @@ var ScrollAreaScrollbarAuto = t__namespace.forwardRef((props, forwardedRef) => {
|
|
|
9902
10338
|
}, 10);
|
|
9903
10339
|
useResizeObserver(context.viewport, handleResize);
|
|
9904
10340
|
useResizeObserver(context.content, handleResize);
|
|
9905
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10341
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Presence2, { present: forceMount || visible, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9906
10342
|
ScrollAreaScrollbarVisible,
|
|
9907
10343
|
{
|
|
9908
10344
|
"data-state": visible ? "visible" : "hidden",
|
|
@@ -9948,7 +10384,8 @@ var ScrollAreaScrollbarVisible = t__namespace.forwardRef((props, forwardedRef) =
|
|
|
9948
10384
|
}
|
|
9949
10385
|
},
|
|
9950
10386
|
onWheelScroll: (scrollPos) => {
|
|
9951
|
-
if (context.viewport)
|
|
10387
|
+
if (context.viewport)
|
|
10388
|
+
context.viewport.scrollLeft = scrollPos;
|
|
9952
10389
|
},
|
|
9953
10390
|
onDragScroll: (pointerPos) => {
|
|
9954
10391
|
if (context.viewport) {
|
|
@@ -9972,10 +10409,12 @@ var ScrollAreaScrollbarVisible = t__namespace.forwardRef((props, forwardedRef) =
|
|
|
9972
10409
|
}
|
|
9973
10410
|
},
|
|
9974
10411
|
onWheelScroll: (scrollPos) => {
|
|
9975
|
-
if (context.viewport)
|
|
10412
|
+
if (context.viewport)
|
|
10413
|
+
context.viewport.scrollTop = scrollPos;
|
|
9976
10414
|
},
|
|
9977
10415
|
onDragScroll: (pointerPos) => {
|
|
9978
|
-
if (context.viewport)
|
|
10416
|
+
if (context.viewport)
|
|
10417
|
+
context.viewport.scrollTop = getScrollPosition(pointerPos);
|
|
9979
10418
|
}
|
|
9980
10419
|
}
|
|
9981
10420
|
);
|
|
@@ -9987,16 +10426,17 @@ var ScrollAreaScrollbarX = t__namespace.forwardRef((props, forwardedRef) => {
|
|
|
9987
10426
|
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
9988
10427
|
const [computedStyle, setComputedStyle] = t__namespace.useState();
|
|
9989
10428
|
const ref = t__namespace.useRef(null);
|
|
9990
|
-
const
|
|
10429
|
+
const composeRefs3 = useComposedRefs2(forwardedRef, ref, context.onScrollbarXChange);
|
|
9991
10430
|
t__namespace.useEffect(() => {
|
|
9992
|
-
if (ref.current)
|
|
10431
|
+
if (ref.current)
|
|
10432
|
+
setComputedStyle(getComputedStyle(ref.current));
|
|
9993
10433
|
}, [ref]);
|
|
9994
10434
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9995
10435
|
ScrollAreaScrollbarImpl,
|
|
9996
10436
|
{
|
|
9997
10437
|
"data-orientation": "horizontal",
|
|
9998
10438
|
...scrollbarProps,
|
|
9999
|
-
ref:
|
|
10439
|
+
ref: composeRefs3,
|
|
10000
10440
|
sizes,
|
|
10001
10441
|
style: {
|
|
10002
10442
|
bottom: 0,
|
|
@@ -10037,16 +10477,17 @@ var ScrollAreaScrollbarY = t__namespace.forwardRef((props, forwardedRef) => {
|
|
|
10037
10477
|
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
10038
10478
|
const [computedStyle, setComputedStyle] = t__namespace.useState();
|
|
10039
10479
|
const ref = t__namespace.useRef(null);
|
|
10040
|
-
const
|
|
10480
|
+
const composeRefs3 = useComposedRefs2(forwardedRef, ref, context.onScrollbarYChange);
|
|
10041
10481
|
t__namespace.useEffect(() => {
|
|
10042
|
-
if (ref.current)
|
|
10482
|
+
if (ref.current)
|
|
10483
|
+
setComputedStyle(getComputedStyle(ref.current));
|
|
10043
10484
|
}, [ref]);
|
|
10044
10485
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10045
10486
|
ScrollAreaScrollbarImpl,
|
|
10046
10487
|
{
|
|
10047
10488
|
"data-orientation": "vertical",
|
|
10048
10489
|
...scrollbarProps,
|
|
10049
|
-
ref:
|
|
10490
|
+
ref: composeRefs3,
|
|
10050
10491
|
sizes,
|
|
10051
10492
|
style: {
|
|
10052
10493
|
top: 0,
|
|
@@ -10100,7 +10541,7 @@ var ScrollAreaScrollbarImpl = t__namespace.forwardRef((props, forwardedRef) => {
|
|
|
10100
10541
|
} = props;
|
|
10101
10542
|
const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
|
|
10102
10543
|
const [scrollbar, setScrollbar] = t__namespace.useState(null);
|
|
10103
|
-
const
|
|
10544
|
+
const composeRefs3 = useComposedRefs2(forwardedRef, (node) => setScrollbar(node));
|
|
10104
10545
|
const rectRef = t__namespace.useRef(null);
|
|
10105
10546
|
const prevWebkitUserSelectRef = t__namespace.useRef("");
|
|
10106
10547
|
const viewport = context.viewport;
|
|
@@ -10119,7 +10560,8 @@ var ScrollAreaScrollbarImpl = t__namespace.forwardRef((props, forwardedRef) => {
|
|
|
10119
10560
|
const handleWheel = (event) => {
|
|
10120
10561
|
const element = event.target;
|
|
10121
10562
|
const isScrollbarWheel = scrollbar?.contains(element);
|
|
10122
|
-
if (isScrollbarWheel)
|
|
10563
|
+
if (isScrollbarWheel)
|
|
10564
|
+
handleWheelScroll(event, maxScrollPos);
|
|
10123
10565
|
};
|
|
10124
10566
|
document.addEventListener("wheel", handleWheel, { passive: false });
|
|
10125
10567
|
return () => document.removeEventListener("wheel", handleWheel, { passive: false });
|
|
@@ -10138,12 +10580,12 @@ var ScrollAreaScrollbarImpl = t__namespace.forwardRef((props, forwardedRef) => {
|
|
|
10138
10580
|
onThumbPositionChange: handleThumbPositionChange,
|
|
10139
10581
|
onThumbPointerDown: useCallbackRef(onThumbPointerDown),
|
|
10140
10582
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10141
|
-
|
|
10583
|
+
Primitive2.div,
|
|
10142
10584
|
{
|
|
10143
10585
|
...scrollbarProps,
|
|
10144
|
-
ref:
|
|
10586
|
+
ref: composeRefs3,
|
|
10145
10587
|
style: { position: "absolute", ...scrollbarProps.style },
|
|
10146
|
-
onPointerDown:
|
|
10588
|
+
onPointerDown: composeEventHandlers2(props.onPointerDown, (event) => {
|
|
10147
10589
|
const mainPointer = 0;
|
|
10148
10590
|
if (event.button === mainPointer) {
|
|
10149
10591
|
const element = event.target;
|
|
@@ -10151,18 +10593,20 @@ var ScrollAreaScrollbarImpl = t__namespace.forwardRef((props, forwardedRef) => {
|
|
|
10151
10593
|
rectRef.current = scrollbar.getBoundingClientRect();
|
|
10152
10594
|
prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
|
|
10153
10595
|
document.body.style.webkitUserSelect = "none";
|
|
10154
|
-
if (context.viewport)
|
|
10596
|
+
if (context.viewport)
|
|
10597
|
+
context.viewport.style.scrollBehavior = "auto";
|
|
10155
10598
|
handleDragScroll(event);
|
|
10156
10599
|
}
|
|
10157
10600
|
}),
|
|
10158
|
-
onPointerMove:
|
|
10159
|
-
onPointerUp:
|
|
10601
|
+
onPointerMove: composeEventHandlers2(props.onPointerMove, handleDragScroll),
|
|
10602
|
+
onPointerUp: composeEventHandlers2(props.onPointerUp, (event) => {
|
|
10160
10603
|
const element = event.target;
|
|
10161
10604
|
if (element.hasPointerCapture(event.pointerId)) {
|
|
10162
10605
|
element.releasePointerCapture(event.pointerId);
|
|
10163
10606
|
}
|
|
10164
10607
|
document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
|
|
10165
|
-
if (context.viewport)
|
|
10608
|
+
if (context.viewport)
|
|
10609
|
+
context.viewport.style.scrollBehavior = "";
|
|
10166
10610
|
rectRef.current = null;
|
|
10167
10611
|
})
|
|
10168
10612
|
}
|
|
@@ -10175,7 +10619,7 @@ var ScrollAreaThumb = t__namespace.forwardRef(
|
|
|
10175
10619
|
(props, forwardedRef) => {
|
|
10176
10620
|
const { forceMount, ...thumbProps } = props;
|
|
10177
10621
|
const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);
|
|
10178
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10622
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Presence2, { present: forceMount || scrollbarContext.hasThumb, children: /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaThumbImpl, { ref: forwardedRef, ...thumbProps }) });
|
|
10179
10623
|
}
|
|
10180
10624
|
);
|
|
10181
10625
|
var ScrollAreaThumbImpl = t__namespace.forwardRef(
|
|
@@ -10184,7 +10628,7 @@ var ScrollAreaThumbImpl = t__namespace.forwardRef(
|
|
|
10184
10628
|
const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);
|
|
10185
10629
|
const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);
|
|
10186
10630
|
const { onThumbPositionChange } = scrollbarContext;
|
|
10187
|
-
const composedRef =
|
|
10631
|
+
const composedRef = useComposedRefs2(
|
|
10188
10632
|
forwardedRef,
|
|
10189
10633
|
(node) => scrollbarContext.onThumbChange(node)
|
|
10190
10634
|
);
|
|
@@ -10212,7 +10656,7 @@ var ScrollAreaThumbImpl = t__namespace.forwardRef(
|
|
|
10212
10656
|
}
|
|
10213
10657
|
}, [scrollAreaContext.viewport, debounceScrollEnd, onThumbPositionChange]);
|
|
10214
10658
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10215
|
-
|
|
10659
|
+
Primitive2.div,
|
|
10216
10660
|
{
|
|
10217
10661
|
"data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
|
|
10218
10662
|
...thumbProps,
|
|
@@ -10222,14 +10666,14 @@ var ScrollAreaThumbImpl = t__namespace.forwardRef(
|
|
|
10222
10666
|
height: "var(--radix-scroll-area-thumb-height)",
|
|
10223
10667
|
...style
|
|
10224
10668
|
},
|
|
10225
|
-
onPointerDownCapture:
|
|
10669
|
+
onPointerDownCapture: composeEventHandlers2(props.onPointerDownCapture, (event) => {
|
|
10226
10670
|
const thumb = event.target;
|
|
10227
10671
|
const thumbRect = thumb.getBoundingClientRect();
|
|
10228
10672
|
const x = event.clientX - thumbRect.left;
|
|
10229
10673
|
const y = event.clientY - thumbRect.top;
|
|
10230
10674
|
scrollbarContext.onThumbPointerDown({ x, y });
|
|
10231
10675
|
}),
|
|
10232
|
-
onPointerUp:
|
|
10676
|
+
onPointerUp: composeEventHandlers2(props.onPointerUp, scrollbarContext.onThumbPointerUp)
|
|
10233
10677
|
}
|
|
10234
10678
|
);
|
|
10235
10679
|
}
|
|
@@ -10262,7 +10706,7 @@ var ScrollAreaCornerImpl = t__namespace.forwardRef((props, forwardedRef) => {
|
|
|
10262
10706
|
setWidth(width2);
|
|
10263
10707
|
});
|
|
10264
10708
|
return hasSize ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10265
|
-
|
|
10709
|
+
Primitive2.div,
|
|
10266
10710
|
{
|
|
10267
10711
|
...cornerProps,
|
|
10268
10712
|
ref: forwardedRef,
|
|
@@ -10316,7 +10760,8 @@ function getThumbOffsetFromScroll(scrollPos, sizes, dir = "ltr") {
|
|
|
10316
10760
|
}
|
|
10317
10761
|
function linearScale(input, output) {
|
|
10318
10762
|
return (value) => {
|
|
10319
|
-
if (input[0] === input[1] || output[0] === output[1])
|
|
10763
|
+
if (input[0] === input[1] || output[0] === output[1])
|
|
10764
|
+
return output[0];
|
|
10320
10765
|
const ratio = (output[1] - output[0]) / (input[1] - input[0]);
|
|
10321
10766
|
return output[0] + ratio * (value - input[0]);
|
|
10322
10767
|
};
|
|
@@ -10332,7 +10777,8 @@ var addUnlinkedScrollListener = (node, handler = () => {
|
|
|
10332
10777
|
const position = { left: node.scrollLeft, top: node.scrollTop };
|
|
10333
10778
|
const isHorizontalScroll = prevPosition.left !== position.left;
|
|
10334
10779
|
const isVerticalScroll = prevPosition.top !== position.top;
|
|
10335
|
-
if (isHorizontalScroll || isVerticalScroll)
|
|
10780
|
+
if (isHorizontalScroll || isVerticalScroll)
|
|
10781
|
+
handler();
|
|
10336
10782
|
prevPosition = position;
|
|
10337
10783
|
rAF = window.requestAnimationFrame(loop);
|
|
10338
10784
|
})();
|
|
@@ -10349,7 +10795,7 @@ function useDebounceCallback(callback, delay) {
|
|
|
10349
10795
|
}
|
|
10350
10796
|
function useResizeObserver(element, onResize) {
|
|
10351
10797
|
const handleResize = useCallbackRef(onResize);
|
|
10352
|
-
|
|
10798
|
+
useLayoutEffect22(() => {
|
|
10353
10799
|
let rAF = 0;
|
|
10354
10800
|
if (element) {
|
|
10355
10801
|
const resizeObserver = new ResizeObserver(() => {
|
|
@@ -10450,7 +10896,8 @@ var ScrollReveal = t__namespace.forwardRef(
|
|
|
10450
10896
|
once: triggerOnce
|
|
10451
10897
|
});
|
|
10452
10898
|
const customVariants = t__namespace.useMemo(() => {
|
|
10453
|
-
if (variants)
|
|
10899
|
+
if (variants)
|
|
10900
|
+
return variants;
|
|
10454
10901
|
const baseVariants = defaultVariants[direction] || defaultVariants.up;
|
|
10455
10902
|
return {
|
|
10456
10903
|
hidden: {
|
|
@@ -10464,7 +10911,8 @@ var ScrollReveal = t__namespace.forwardRef(
|
|
|
10464
10911
|
};
|
|
10465
10912
|
}, [direction, distance, variants]);
|
|
10466
10913
|
t__namespace.useEffect(() => {
|
|
10467
|
-
if (!animate2)
|
|
10914
|
+
if (!animate2)
|
|
10915
|
+
return;
|
|
10468
10916
|
if (isInView) {
|
|
10469
10917
|
controls.start("visible");
|
|
10470
10918
|
} else if (!triggerOnce) {
|
|
@@ -10545,7 +10993,8 @@ var ScrollRevealItem = t__namespace.forwardRef(
|
|
|
10545
10993
|
id
|
|
10546
10994
|
}, ref) => {
|
|
10547
10995
|
const customVariants = t__namespace.useMemo(() => {
|
|
10548
|
-
if (variants)
|
|
10996
|
+
if (variants)
|
|
10997
|
+
return variants;
|
|
10549
10998
|
const baseVariants = defaultVariants[direction] || defaultVariants.up;
|
|
10550
10999
|
return {
|
|
10551
11000
|
hidden: {
|
|
@@ -10696,17 +11145,81 @@ var Separator3 = t__namespace.forwardRef(
|
|
|
10696
11145
|
)
|
|
10697
11146
|
);
|
|
10698
11147
|
Separator3.displayName = SeparatorPrimitive__namespace.Root.displayName;
|
|
11148
|
+
var useInsertionEffect2 = t__namespace[" useInsertionEffect ".trim().toString()] || useLayoutEffect22;
|
|
11149
|
+
function useControllableState2({
|
|
11150
|
+
prop,
|
|
11151
|
+
defaultProp,
|
|
11152
|
+
onChange = () => {
|
|
11153
|
+
},
|
|
11154
|
+
caller
|
|
11155
|
+
}) {
|
|
11156
|
+
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState2({
|
|
11157
|
+
defaultProp,
|
|
11158
|
+
onChange
|
|
11159
|
+
});
|
|
11160
|
+
const isControlled = prop !== void 0;
|
|
11161
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
11162
|
+
{
|
|
11163
|
+
const isControlledRef = t__namespace.useRef(prop !== void 0);
|
|
11164
|
+
t__namespace.useEffect(() => {
|
|
11165
|
+
const wasControlled = isControlledRef.current;
|
|
11166
|
+
if (wasControlled !== isControlled) {
|
|
11167
|
+
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
11168
|
+
const to = isControlled ? "controlled" : "uncontrolled";
|
|
11169
|
+
console.warn(
|
|
11170
|
+
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
11171
|
+
);
|
|
11172
|
+
}
|
|
11173
|
+
isControlledRef.current = isControlled;
|
|
11174
|
+
}, [isControlled, caller]);
|
|
11175
|
+
}
|
|
11176
|
+
const setValue = t__namespace.useCallback(
|
|
11177
|
+
(nextValue) => {
|
|
11178
|
+
if (isControlled) {
|
|
11179
|
+
const value2 = isFunction3(nextValue) ? nextValue(prop) : nextValue;
|
|
11180
|
+
if (value2 !== prop) {
|
|
11181
|
+
onChangeRef.current?.(value2);
|
|
11182
|
+
}
|
|
11183
|
+
} else {
|
|
11184
|
+
setUncontrolledProp(nextValue);
|
|
11185
|
+
}
|
|
11186
|
+
},
|
|
11187
|
+
[isControlled, prop, setUncontrolledProp, onChangeRef]
|
|
11188
|
+
);
|
|
11189
|
+
return [value, setValue];
|
|
11190
|
+
}
|
|
11191
|
+
function useUncontrolledState2({
|
|
11192
|
+
defaultProp,
|
|
11193
|
+
onChange
|
|
11194
|
+
}) {
|
|
11195
|
+
const [value, setValue] = t__namespace.useState(defaultProp);
|
|
11196
|
+
const prevValueRef = t__namespace.useRef(value);
|
|
11197
|
+
const onChangeRef = t__namespace.useRef(onChange);
|
|
11198
|
+
useInsertionEffect2(() => {
|
|
11199
|
+
onChangeRef.current = onChange;
|
|
11200
|
+
}, [onChange]);
|
|
11201
|
+
t__namespace.useEffect(() => {
|
|
11202
|
+
if (prevValueRef.current !== value) {
|
|
11203
|
+
onChangeRef.current?.(value);
|
|
11204
|
+
prevValueRef.current = value;
|
|
11205
|
+
}
|
|
11206
|
+
}, [value, prevValueRef]);
|
|
11207
|
+
return [value, setValue, onChangeRef];
|
|
11208
|
+
}
|
|
11209
|
+
function isFunction3(value) {
|
|
11210
|
+
return typeof value === "function";
|
|
11211
|
+
}
|
|
10699
11212
|
var NAME = "Toggle";
|
|
10700
11213
|
var Toggle = t__namespace.forwardRef((props, forwardedRef) => {
|
|
10701
11214
|
const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;
|
|
10702
|
-
const [pressed, setPressed] =
|
|
11215
|
+
const [pressed, setPressed] = useControllableState2({
|
|
10703
11216
|
prop: pressedProp,
|
|
10704
11217
|
onChange: onPressedChange,
|
|
10705
11218
|
defaultProp: defaultPressed ?? false,
|
|
10706
11219
|
caller: NAME
|
|
10707
11220
|
});
|
|
10708
11221
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10709
|
-
|
|
11222
|
+
Primitive2.button,
|
|
10710
11223
|
{
|
|
10711
11224
|
type: "button",
|
|
10712
11225
|
"aria-pressed": pressed,
|
|
@@ -10714,7 +11227,7 @@ var Toggle = t__namespace.forwardRef((props, forwardedRef) => {
|
|
|
10714
11227
|
"data-disabled": props.disabled ? "" : void 0,
|
|
10715
11228
|
...buttonProps,
|
|
10716
11229
|
ref: forwardedRef,
|
|
10717
|
-
onClick:
|
|
11230
|
+
onClick: composeEventHandlers2(props.onClick, () => {
|
|
10718
11231
|
if (!props.disabled) {
|
|
10719
11232
|
setPressed(!pressed);
|
|
10720
11233
|
}
|
|
@@ -10904,7 +11417,7 @@ var SimpleEditor = t__namespace.default.forwardRef(
|
|
|
10904
11417
|
const [content, setContent] = t.useState(value);
|
|
10905
11418
|
const [isPreview, setIsPreview] = t.useState(false);
|
|
10906
11419
|
const [sourceContent, setSourceContent] = t.useState(value);
|
|
10907
|
-
|
|
11420
|
+
t.useState(null);
|
|
10908
11421
|
const editorRef = t__namespace.default.useRef(null);
|
|
10909
11422
|
const sourceRef = t__namespace.default.useRef(null);
|
|
10910
11423
|
const [formatState, setFormatState] = t.useState({
|
|
@@ -10933,7 +11446,8 @@ var SimpleEditor = t__namespace.default.forwardRef(
|
|
|
10933
11446
|
return null;
|
|
10934
11447
|
}, []);
|
|
10935
11448
|
t.useCallback((range) => {
|
|
10936
|
-
if (!range)
|
|
11449
|
+
if (!range)
|
|
11450
|
+
return;
|
|
10937
11451
|
const selection2 = window.getSelection();
|
|
10938
11452
|
if (selection2) {
|
|
10939
11453
|
selection2.removeAllRanges();
|
|
@@ -10941,7 +11455,8 @@ var SimpleEditor = t__namespace.default.forwardRef(
|
|
|
10941
11455
|
}
|
|
10942
11456
|
}, []);
|
|
10943
11457
|
const executeCommand = t.useCallback((command, value2) => {
|
|
10944
|
-
if (disabled)
|
|
11458
|
+
if (disabled)
|
|
11459
|
+
return;
|
|
10945
11460
|
if (editorRef.current) {
|
|
10946
11461
|
editorRef.current.focus();
|
|
10947
11462
|
}
|
|
@@ -11400,7 +11915,7 @@ var SimpleEditor = t__namespace.default.forwardRef(
|
|
|
11400
11915
|
);
|
|
11401
11916
|
SimpleEditor.displayName = "SimpleEditor";
|
|
11402
11917
|
var CharacterCount = ({ content }) => {
|
|
11403
|
-
const [
|
|
11918
|
+
const [count4, setCount] = t.useState(0);
|
|
11404
11919
|
t.useEffect(() => {
|
|
11405
11920
|
const getPlainText = (html) => {
|
|
11406
11921
|
const div = document.createElement("div");
|
|
@@ -11410,7 +11925,7 @@ var CharacterCount = ({ content }) => {
|
|
|
11410
11925
|
setCount(getPlainText(content).length);
|
|
11411
11926
|
}, [content]);
|
|
11412
11927
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11413
|
-
|
|
11928
|
+
count4,
|
|
11414
11929
|
" characters"
|
|
11415
11930
|
] });
|
|
11416
11931
|
};
|
|
@@ -11679,16 +12194,19 @@ var SwipeableCard = t__namespace.forwardRef(
|
|
|
11679
12194
|
const [currentX, setCurrentX] = t__namespace.useState(0);
|
|
11680
12195
|
const [isSwiping, setIsSwiping] = t__namespace.useState(false);
|
|
11681
12196
|
const handleTouchStart = (e) => {
|
|
11682
|
-
if (disabled)
|
|
12197
|
+
if (disabled)
|
|
12198
|
+
return;
|
|
11683
12199
|
setStartX(e.touches[0].clientX);
|
|
11684
12200
|
setIsSwiping(true);
|
|
11685
12201
|
};
|
|
11686
12202
|
const handleTouchMove = (e) => {
|
|
11687
|
-
if (disabled || !isSwiping)
|
|
12203
|
+
if (disabled || !isSwiping)
|
|
12204
|
+
return;
|
|
11688
12205
|
setCurrentX(e.touches[0].clientX);
|
|
11689
12206
|
};
|
|
11690
12207
|
const handleTouchEnd = () => {
|
|
11691
|
-
if (disabled || !isSwiping)
|
|
12208
|
+
if (disabled || !isSwiping)
|
|
12209
|
+
return;
|
|
11692
12210
|
const deltaX = currentX - startX;
|
|
11693
12211
|
if (Math.abs(deltaX) > threshold) {
|
|
11694
12212
|
if (deltaX > 0 && onSwipeRight) {
|
|
@@ -11792,7 +12310,8 @@ var TagsInput = t__namespace.forwardRef(
|
|
|
11792
12310
|
};
|
|
11793
12311
|
const addTag = () => {
|
|
11794
12312
|
const tag = inputValue.trim();
|
|
11795
|
-
if (!tag)
|
|
12313
|
+
if (!tag)
|
|
12314
|
+
return;
|
|
11796
12315
|
if (!allowDuplicates && value.includes(tag)) {
|
|
11797
12316
|
setError("This tag already exists");
|
|
11798
12317
|
setTimeout(() => setError(""), 2e3);
|
|
@@ -11808,7 +12327,8 @@ var TagsInput = t__namespace.forwardRef(
|
|
|
11808
12327
|
setError("");
|
|
11809
12328
|
};
|
|
11810
12329
|
const removeTag = (index) => {
|
|
11811
|
-
if (disabled)
|
|
12330
|
+
if (disabled)
|
|
12331
|
+
return;
|
|
11812
12332
|
onChange(value.filter((_, i) => i !== index));
|
|
11813
12333
|
};
|
|
11814
12334
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
@@ -11871,32 +12391,147 @@ var TagsInput = t__namespace.forwardRef(
|
|
|
11871
12391
|
}
|
|
11872
12392
|
);
|
|
11873
12393
|
TagsInput.displayName = "TagsInput";
|
|
12394
|
+
var textareaVariants = classVarianceAuthority.cva(
|
|
12395
|
+
[
|
|
12396
|
+
"flex w-full rounded-md px-3 py-2 text-sm transition-all duration-200",
|
|
12397
|
+
"text-foreground placeholder:text-muted-foreground dark:placeholder:text-gray-500",
|
|
12398
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
12399
|
+
"focus-visible:outline-none dark:text-gray-200",
|
|
12400
|
+
"resize-none"
|
|
12401
|
+
// Always disable manual resize, we control it
|
|
12402
|
+
],
|
|
12403
|
+
{
|
|
12404
|
+
variants: {
|
|
12405
|
+
variant: {
|
|
12406
|
+
default: "border border-gray-300 dark:border-gray-700 bg-background dark:bg-gray-800/80 hover:border-gray-400 dark:hover:border-gray-600 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/20 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:shadow-inner dark:shadow-gray-950/10",
|
|
12407
|
+
outline: "border-2 border-gray-300 dark:border-gray-700 bg-transparent hover:border-gray-400 dark:hover:border-gray-600 focus-visible:border-primary dark:focus-visible:border-primary/80",
|
|
12408
|
+
ghost: "border-none bg-transparent hover:bg-gray-100/50 dark:hover:bg-gray-800/30 focus-visible:bg-transparent",
|
|
12409
|
+
underline: "border-t-0 border-l-0 border-r-0 border-b-2 border-gray-300 dark:border-gray-600 rounded-none px-0 hover:border-gray-400 dark:hover:border-gray-500 focus-visible:ring-0 focus-visible:border-primary dark:focus-visible:border-primary/80 bg-transparent dark:bg-transparent"
|
|
12410
|
+
},
|
|
12411
|
+
size: {
|
|
12412
|
+
sm: "min-h-[60px] text-xs",
|
|
12413
|
+
md: "min-h-[80px] text-sm",
|
|
12414
|
+
lg: "min-h-[120px] text-base"
|
|
12415
|
+
},
|
|
12416
|
+
isError: {
|
|
12417
|
+
true: "border-error focus-visible:ring-error/30 focus-visible:border-error hover:border-error/80 dark:hover:border-error/80",
|
|
12418
|
+
false: ""
|
|
12419
|
+
},
|
|
12420
|
+
isSuccess: {
|
|
12421
|
+
true: "border-success focus-visible:ring-success/30 focus-visible:border-success hover:border-success/80 dark:hover:border-success/80",
|
|
12422
|
+
false: ""
|
|
12423
|
+
}
|
|
12424
|
+
},
|
|
12425
|
+
defaultVariants: {
|
|
12426
|
+
variant: "default",
|
|
12427
|
+
size: "md",
|
|
12428
|
+
isError: false,
|
|
12429
|
+
isSuccess: false
|
|
12430
|
+
}
|
|
12431
|
+
}
|
|
12432
|
+
);
|
|
11874
12433
|
var Textarea = t__namespace.forwardRef(
|
|
11875
12434
|
({
|
|
11876
12435
|
className,
|
|
11877
|
-
|
|
12436
|
+
wrapperClassName,
|
|
12437
|
+
messageClassName,
|
|
11878
12438
|
variant,
|
|
11879
12439
|
size,
|
|
11880
12440
|
error,
|
|
11881
12441
|
success,
|
|
11882
12442
|
loading,
|
|
11883
|
-
autoResize,
|
|
12443
|
+
autoResize = false,
|
|
11884
12444
|
maxHeight,
|
|
11885
|
-
characterCount,
|
|
12445
|
+
characterCount = false,
|
|
12446
|
+
disabled,
|
|
12447
|
+
maxLength,
|
|
12448
|
+
value,
|
|
12449
|
+
defaultValue,
|
|
12450
|
+
onChange,
|
|
11886
12451
|
...props
|
|
11887
12452
|
}, ref) => {
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
12453
|
+
const textareaRef = t__namespace.useRef(null);
|
|
12454
|
+
const [internalValue, setInternalValue] = t__namespace.useState(value || defaultValue || "");
|
|
12455
|
+
t__namespace.useImperativeHandle(ref, () => textareaRef.current);
|
|
12456
|
+
const adjustHeight = t__namespace.useCallback(() => {
|
|
12457
|
+
const textarea = textareaRef.current;
|
|
12458
|
+
if (!textarea || !autoResize)
|
|
12459
|
+
return;
|
|
12460
|
+
textarea.style.height = "auto";
|
|
12461
|
+
const newHeight = textarea.scrollHeight;
|
|
12462
|
+
if (maxHeight && newHeight > maxHeight) {
|
|
12463
|
+
textarea.style.height = `${maxHeight}px`;
|
|
12464
|
+
textarea.style.overflowY = "auto";
|
|
12465
|
+
} else {
|
|
12466
|
+
textarea.style.height = `${newHeight}px`;
|
|
12467
|
+
textarea.style.overflowY = "hidden";
|
|
11898
12468
|
}
|
|
11899
|
-
);
|
|
12469
|
+
}, [autoResize, maxHeight]);
|
|
12470
|
+
t__namespace.useEffect(() => {
|
|
12471
|
+
adjustHeight();
|
|
12472
|
+
}, [internalValue, adjustHeight]);
|
|
12473
|
+
t__namespace.useEffect(() => {
|
|
12474
|
+
if (value !== void 0) {
|
|
12475
|
+
setInternalValue(value);
|
|
12476
|
+
}
|
|
12477
|
+
}, [value]);
|
|
12478
|
+
const handleChange = (e) => {
|
|
12479
|
+
setInternalValue(e.target.value);
|
|
12480
|
+
onChange?.(e);
|
|
12481
|
+
};
|
|
12482
|
+
const currentLength = String(internalValue).length;
|
|
12483
|
+
const showCharCount = characterCount && (maxLength !== void 0 || currentLength > 0);
|
|
12484
|
+
const errorMessage = typeof error === "string" ? error : void 0;
|
|
12485
|
+
const successMessage = typeof success === "string" ? success : void 0;
|
|
12486
|
+
const showMessage = errorMessage || successMessage;
|
|
12487
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("moonui-theme", "space-y-1.5 w-full", wrapperClassName), children: [
|
|
12488
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
12489
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12490
|
+
"textarea",
|
|
12491
|
+
{
|
|
12492
|
+
ref: textareaRef,
|
|
12493
|
+
className: cn(
|
|
12494
|
+
textareaVariants({
|
|
12495
|
+
variant,
|
|
12496
|
+
size,
|
|
12497
|
+
isError: !!error,
|
|
12498
|
+
isSuccess: !!success
|
|
12499
|
+
}),
|
|
12500
|
+
loading && "pr-10",
|
|
12501
|
+
className
|
|
12502
|
+
),
|
|
12503
|
+
disabled: disabled || loading,
|
|
12504
|
+
value,
|
|
12505
|
+
defaultValue,
|
|
12506
|
+
onChange: handleChange,
|
|
12507
|
+
maxLength,
|
|
12508
|
+
"aria-invalid": !!error || void 0,
|
|
12509
|
+
"aria-describedby": errorMessage ? `${props.id || ""}-error` : successMessage ? `${props.id || ""}-success` : void 0,
|
|
12510
|
+
...props
|
|
12511
|
+
}
|
|
12512
|
+
),
|
|
12513
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-3 right-3 text-gray-500", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }) })
|
|
12514
|
+
] }),
|
|
12515
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
12516
|
+
showMessage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12517
|
+
"p",
|
|
12518
|
+
{
|
|
12519
|
+
className: cn(
|
|
12520
|
+
"text-xs transition-all",
|
|
12521
|
+
errorMessage && "text-error",
|
|
12522
|
+
successMessage && "text-success",
|
|
12523
|
+
messageClassName
|
|
12524
|
+
),
|
|
12525
|
+
id: errorMessage ? `${props.id || ""}-error` : successMessage ? `${props.id || ""}-success` : void 0,
|
|
12526
|
+
children: errorMessage || successMessage
|
|
12527
|
+
}
|
|
12528
|
+
),
|
|
12529
|
+
showCharCount && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground dark:text-gray-500 ml-auto", children: [
|
|
12530
|
+
currentLength,
|
|
12531
|
+
maxLength !== void 0 && ` / ${maxLength}`
|
|
12532
|
+
] })
|
|
12533
|
+
] })
|
|
12534
|
+
] });
|
|
11900
12535
|
}
|
|
11901
12536
|
);
|
|
11902
12537
|
Textarea.displayName = "Textarea";
|
|
@@ -12072,7 +12707,8 @@ function toast({ ...props }) {
|
|
|
12072
12707
|
id,
|
|
12073
12708
|
open: true,
|
|
12074
12709
|
onOpenChange: (open) => {
|
|
12075
|
-
if (!open)
|
|
12710
|
+
if (!open)
|
|
12711
|
+
dismiss();
|
|
12076
12712
|
}
|
|
12077
12713
|
}
|
|
12078
12714
|
});
|
|
@@ -12142,15 +12778,15 @@ function Toaster() {
|
|
|
12142
12778
|
*)
|
|
12143
12779
|
*/
|
|
12144
12780
|
|
|
12145
|
-
Object.defineProperty(exports,
|
|
12781
|
+
Object.defineProperty(exports, 'Palette', {
|
|
12146
12782
|
enumerable: true,
|
|
12147
12783
|
get: function () { return lucideReact.Palette; }
|
|
12148
12784
|
});
|
|
12149
|
-
Object.defineProperty(exports,
|
|
12785
|
+
Object.defineProperty(exports, 'Pipette', {
|
|
12150
12786
|
enumerable: true,
|
|
12151
12787
|
get: function () { return lucideReact.Pipette; }
|
|
12152
12788
|
});
|
|
12153
|
-
Object.defineProperty(exports,
|
|
12789
|
+
Object.defineProperty(exports, 'format', {
|
|
12154
12790
|
enumerable: true,
|
|
12155
12791
|
get: function () { return dateFns.format; }
|
|
12156
12792
|
});
|
|
@@ -12264,6 +12900,7 @@ exports.MoonUIBreadcrumbList = BreadcrumbList;
|
|
|
12264
12900
|
exports.MoonUIBreadcrumbPage = BreadcrumbPage;
|
|
12265
12901
|
exports.MoonUIBreadcrumbSeparator = BreadcrumbSeparator;
|
|
12266
12902
|
exports.MoonUIButton = Button;
|
|
12903
|
+
exports.MoonUICalendar = Calendar;
|
|
12267
12904
|
exports.MoonUICard = Card;
|
|
12268
12905
|
exports.MoonUICardCVCInput = CardCVCInput;
|
|
12269
12906
|
exports.MoonUICardContent = CardContent;
|
|
@@ -12497,5 +13134,5 @@ exports.toast = toast;
|
|
|
12497
13134
|
exports.toggleVariants = toggleVariants;
|
|
12498
13135
|
exports.tooltipVariants = tooltipVariants;
|
|
12499
13136
|
exports.useToast = useToast;
|
|
12500
|
-
//# sourceMappingURL=
|
|
13137
|
+
//# sourceMappingURL=out.js.map
|
|
12501
13138
|
//# sourceMappingURL=index.js.map
|