@algorithm-shift/design-system 1.3.127 → 1.3.128
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.css +41 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +818 -731
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +772 -686
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ var src_exports = {};
|
|
|
33
33
|
__export(src_exports, {
|
|
34
34
|
Accordion: () => Accordion_default,
|
|
35
35
|
AccordionGroup: () => AccordionGroup_default,
|
|
36
|
+
Audio: () => Audio_default,
|
|
36
37
|
BarChart: () => BarChart_default,
|
|
37
38
|
Breadcrumb: () => Breadcrumb_default,
|
|
38
39
|
Button: () => Button_default,
|
|
@@ -1174,13 +1175,98 @@ function Icon(props) {
|
|
|
1174
1175
|
return null;
|
|
1175
1176
|
}
|
|
1176
1177
|
|
|
1177
|
-
// src/components/
|
|
1178
|
+
// src/components/Basic/Audio/Audio.tsx
|
|
1178
1179
|
var import_react10 = require("react");
|
|
1180
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1181
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1182
|
+
var formatTime = (time) => {
|
|
1183
|
+
if (isNaN(time) || !isFinite(time)) return "00:00";
|
|
1184
|
+
const minutes = Math.floor(time / 60);
|
|
1185
|
+
const seconds = Math.floor(time % 60);
|
|
1186
|
+
return `${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
|
|
1187
|
+
};
|
|
1188
|
+
var AudioWrapper = (props) => {
|
|
1189
|
+
const audioRef = (0, import_react10.useRef)(null);
|
|
1190
|
+
const [isPlaying, setIsPlaying] = (0, import_react10.useState)(false);
|
|
1191
|
+
const [currentTime, setCurrentTime] = (0, import_react10.useState)(0);
|
|
1192
|
+
const [duration, setDuration] = (0, import_react10.useState)(0);
|
|
1193
|
+
(0, import_react10.useEffect)(() => {
|
|
1194
|
+
const audioEl = audioRef.current;
|
|
1195
|
+
if (!audioEl) return;
|
|
1196
|
+
const handleEnded = () => setIsPlaying(false);
|
|
1197
|
+
const handlePause = () => setIsPlaying(false);
|
|
1198
|
+
const handlePlay = () => setIsPlaying(true);
|
|
1199
|
+
const handleTimeUpdate = () => setCurrentTime(audioEl.currentTime);
|
|
1200
|
+
const handleLoadedMetadata = () => setDuration(audioEl.duration);
|
|
1201
|
+
audioEl.addEventListener("ended", handleEnded);
|
|
1202
|
+
audioEl.addEventListener("pause", handlePause);
|
|
1203
|
+
audioEl.addEventListener("play", handlePlay);
|
|
1204
|
+
audioEl.addEventListener("timeupdate", handleTimeUpdate);
|
|
1205
|
+
audioEl.addEventListener("loadedmetadata", handleLoadedMetadata);
|
|
1206
|
+
return () => {
|
|
1207
|
+
audioEl.removeEventListener("ended", handleEnded);
|
|
1208
|
+
audioEl.removeEventListener("pause", handlePause);
|
|
1209
|
+
audioEl.removeEventListener("play", handlePlay);
|
|
1210
|
+
audioEl.removeEventListener("timeupdate", handleTimeUpdate);
|
|
1211
|
+
audioEl.removeEventListener("loadedmetadata", handleLoadedMetadata);
|
|
1212
|
+
};
|
|
1213
|
+
}, []);
|
|
1214
|
+
const togglePlay = () => {
|
|
1215
|
+
if (audioRef.current) {
|
|
1216
|
+
if (isPlaying) {
|
|
1217
|
+
audioRef.current.pause();
|
|
1218
|
+
} else {
|
|
1219
|
+
audioRef.current.play();
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
const handleSeek = (e) => {
|
|
1224
|
+
const time = Number(e.target.value);
|
|
1225
|
+
if (audioRef.current) {
|
|
1226
|
+
audioRef.current.currentTime = time;
|
|
1227
|
+
setCurrentTime(time);
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
const url = props.data || props.src || props.value;
|
|
1231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-3 p-3 bg-white rounded-lg border shadow-sm w-full min-w-[250px]", children: [
|
|
1232
|
+
url && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("audio", { ref: audioRef, src: url, preload: "metadata" }),
|
|
1233
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1234
|
+
"button",
|
|
1235
|
+
{
|
|
1236
|
+
onClick: togglePlay,
|
|
1237
|
+
disabled: !url,
|
|
1238
|
+
className: "p-2 flex-shrink-0 flex items-center justify-center text-blue-600 bg-blue-50 rounded-full hover:bg-blue-100 disabled:opacity-50 disabled:bg-gray-50 disabled:text-gray-400 transition-colors",
|
|
1239
|
+
title: isPlaying ? "Pause Audio" : "Play Audio",
|
|
1240
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react4.Pause, { size: 20, className: "fill-current" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react4.Play, { size: 20, className: "fill-current transform translate-x-0.5" })
|
|
1241
|
+
}
|
|
1242
|
+
),
|
|
1243
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1 flex items-center gap-3", children: [
|
|
1244
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs font-medium text-gray-500 tabular-nums w-10 text-right", children: formatTime(currentTime) }),
|
|
1245
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1246
|
+
"input",
|
|
1247
|
+
{
|
|
1248
|
+
type: "range",
|
|
1249
|
+
min: "0",
|
|
1250
|
+
max: duration || 100,
|
|
1251
|
+
value: currentTime,
|
|
1252
|
+
onChange: handleSeek,
|
|
1253
|
+
disabled: !url,
|
|
1254
|
+
className: "flex-1 h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-blue-600 disabled:accent-gray-400"
|
|
1255
|
+
}
|
|
1256
|
+
),
|
|
1257
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs font-medium text-gray-500 tabular-nums w-10", children: formatTime(duration) })
|
|
1258
|
+
] })
|
|
1259
|
+
] });
|
|
1260
|
+
};
|
|
1261
|
+
var Audio_default = AudioWrapper;
|
|
1262
|
+
|
|
1263
|
+
// src/components/Inputs/TextInput/TextInput.tsx
|
|
1264
|
+
var import_react11 = require("react");
|
|
1179
1265
|
|
|
1180
1266
|
// src/components/ui/input.tsx
|
|
1181
|
-
var
|
|
1267
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1182
1268
|
function Input({ className, type, ...props }) {
|
|
1183
|
-
return /* @__PURE__ */ (0,
|
|
1269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1184
1270
|
"input",
|
|
1185
1271
|
{
|
|
1186
1272
|
type,
|
|
@@ -1197,14 +1283,14 @@ function Input({ className, type, ...props }) {
|
|
|
1197
1283
|
}
|
|
1198
1284
|
|
|
1199
1285
|
// src/components/Inputs/TextInput/TextInput.tsx
|
|
1200
|
-
var
|
|
1286
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1201
1287
|
var TextInput = ({ className, style, ...props }) => {
|
|
1202
1288
|
const placeholder = props.placeholder || "Placeholder text";
|
|
1203
1289
|
const isEditable = props.isEditable ?? true;
|
|
1204
1290
|
const isDisabled = props.isDisabled ?? false;
|
|
1205
1291
|
const isReadonly = props.isReadonly ?? false;
|
|
1206
1292
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1207
|
-
(0,
|
|
1293
|
+
(0, import_react11.useEffect)(() => {
|
|
1208
1294
|
if (props.value !== void 0) {
|
|
1209
1295
|
const e = { target: { value: props.value }, type: "change" };
|
|
1210
1296
|
handleChange?.(e);
|
|
@@ -1220,8 +1306,8 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
1220
1306
|
if (value === null || value === void 0) return "";
|
|
1221
1307
|
return value;
|
|
1222
1308
|
};
|
|
1223
|
-
return /* @__PURE__ */ (0,
|
|
1224
|
-
/* @__PURE__ */ (0,
|
|
1309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1310
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1225
1311
|
Input,
|
|
1226
1312
|
{
|
|
1227
1313
|
type: props.inputType || "text",
|
|
@@ -1240,21 +1326,21 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
1240
1326
|
readOnly: isReadonly
|
|
1241
1327
|
}
|
|
1242
1328
|
),
|
|
1243
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
1329
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1244
1330
|
] });
|
|
1245
1331
|
};
|
|
1246
1332
|
var TextInput_default = TextInput;
|
|
1247
1333
|
|
|
1248
1334
|
// src/components/Inputs/NumberInput/NumberInput.tsx
|
|
1249
|
-
var
|
|
1250
|
-
var
|
|
1335
|
+
var import_react12 = require("react");
|
|
1336
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1251
1337
|
var NumberInput = ({ className, style, ...props }) => {
|
|
1252
1338
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
1253
1339
|
const isEditable = props.isEditable ?? true;
|
|
1254
1340
|
const isDisabled = props.isDisabled ?? false;
|
|
1255
1341
|
const isReadonly = props.isReadonly ?? false;
|
|
1256
1342
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1257
|
-
(0,
|
|
1343
|
+
(0, import_react12.useEffect)(() => {
|
|
1258
1344
|
if (props.value !== void 0) {
|
|
1259
1345
|
const e = { target: { value: props.value }, type: "change" };
|
|
1260
1346
|
handleChange?.(e);
|
|
@@ -1270,8 +1356,8 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
1270
1356
|
if (value === null || value === void 0) return 0;
|
|
1271
1357
|
return value;
|
|
1272
1358
|
};
|
|
1273
|
-
return /* @__PURE__ */ (0,
|
|
1274
|
-
/* @__PURE__ */ (0,
|
|
1359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1360
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1275
1361
|
Input,
|
|
1276
1362
|
{
|
|
1277
1363
|
type: props.inputType || "number",
|
|
@@ -1290,21 +1376,21 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
1290
1376
|
readOnly: isReadonly
|
|
1291
1377
|
}
|
|
1292
1378
|
) }),
|
|
1293
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
1379
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1294
1380
|
] });
|
|
1295
1381
|
};
|
|
1296
1382
|
var NumberInput_default = NumberInput;
|
|
1297
1383
|
|
|
1298
1384
|
// src/components/Inputs/EmailInput/EmailInput.tsx
|
|
1299
|
-
var
|
|
1300
|
-
var
|
|
1385
|
+
var import_react13 = require("react");
|
|
1386
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1301
1387
|
var EmailInput = ({ className, style, ...props }) => {
|
|
1302
1388
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
1303
1389
|
const isEditable = props.isEditable ?? true;
|
|
1304
1390
|
const isDisabled = props.isDisabled ?? false;
|
|
1305
1391
|
const isReadonly = props.isReadonly ?? false;
|
|
1306
1392
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1307
|
-
(0,
|
|
1393
|
+
(0, import_react13.useEffect)(() => {
|
|
1308
1394
|
if (props.value !== void 0) {
|
|
1309
1395
|
const e = { target: { value: props.value }, type: "change" };
|
|
1310
1396
|
handleChange?.(e);
|
|
@@ -1320,8 +1406,8 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
1320
1406
|
if (value === null || value === void 0) return "";
|
|
1321
1407
|
return value;
|
|
1322
1408
|
};
|
|
1323
|
-
return /* @__PURE__ */ (0,
|
|
1324
|
-
/* @__PURE__ */ (0,
|
|
1409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1410
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1325
1411
|
Input,
|
|
1326
1412
|
{
|
|
1327
1413
|
type: props.inputType || "email",
|
|
@@ -1340,21 +1426,21 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
1340
1426
|
readOnly: isReadonly
|
|
1341
1427
|
}
|
|
1342
1428
|
) }),
|
|
1343
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
1429
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1344
1430
|
] });
|
|
1345
1431
|
};
|
|
1346
1432
|
var EmailInput_default = EmailInput;
|
|
1347
1433
|
|
|
1348
1434
|
// src/components/Inputs/PasswordInput/PasswordInput.tsx
|
|
1349
|
-
var
|
|
1350
|
-
var
|
|
1435
|
+
var import_react14 = require("react");
|
|
1436
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1351
1437
|
var PasswordInput = ({ className, style, ...props }) => {
|
|
1352
1438
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
1353
1439
|
const isEditable = props.isEditable ?? true;
|
|
1354
1440
|
const isDisabled = props.isDisabled ?? false;
|
|
1355
1441
|
const isReadonly = props.isReadonly ?? false;
|
|
1356
1442
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1357
|
-
(0,
|
|
1443
|
+
(0, import_react14.useEffect)(() => {
|
|
1358
1444
|
if (props.value !== void 0) {
|
|
1359
1445
|
const e = { target: { value: props.value }, type: "change" };
|
|
1360
1446
|
handleChange?.(e);
|
|
@@ -1370,8 +1456,8 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
1370
1456
|
if (value === null || value === void 0) return "";
|
|
1371
1457
|
return value;
|
|
1372
1458
|
};
|
|
1373
|
-
return /* @__PURE__ */ (0,
|
|
1374
|
-
/* @__PURE__ */ (0,
|
|
1459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1460
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1375
1461
|
Input,
|
|
1376
1462
|
{
|
|
1377
1463
|
type: props.inputType || "password",
|
|
@@ -1390,18 +1476,18 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
1390
1476
|
readOnly: isReadonly
|
|
1391
1477
|
}
|
|
1392
1478
|
) }),
|
|
1393
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
1479
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1394
1480
|
] });
|
|
1395
1481
|
};
|
|
1396
1482
|
var PasswordInput_default = PasswordInput;
|
|
1397
1483
|
|
|
1398
1484
|
// src/components/Inputs/Textarea/Textarea.tsx
|
|
1399
|
-
var
|
|
1485
|
+
var import_react15 = require("react");
|
|
1400
1486
|
|
|
1401
1487
|
// src/components/ui/textarea.tsx
|
|
1402
|
-
var
|
|
1488
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1403
1489
|
function Textarea({ className, ...props }) {
|
|
1404
|
-
return /* @__PURE__ */ (0,
|
|
1490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1405
1491
|
"textarea",
|
|
1406
1492
|
{
|
|
1407
1493
|
"data-slot": "textarea",
|
|
@@ -1415,14 +1501,14 @@ function Textarea({ className, ...props }) {
|
|
|
1415
1501
|
}
|
|
1416
1502
|
|
|
1417
1503
|
// src/components/Inputs/Textarea/Textarea.tsx
|
|
1418
|
-
var
|
|
1504
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1419
1505
|
var Textarea2 = ({ className, style, ...props }) => {
|
|
1420
1506
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
1421
1507
|
const isEditable = props.isEditable ?? true;
|
|
1422
1508
|
const isDisabled = props.isDisabled ?? false;
|
|
1423
1509
|
const isReadonly = props.isReadonly ?? false;
|
|
1424
1510
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1425
|
-
(0,
|
|
1511
|
+
(0, import_react15.useEffect)(() => {
|
|
1426
1512
|
if (props.value !== void 0) {
|
|
1427
1513
|
const e = { target: { value: props.value }, type: "change" };
|
|
1428
1514
|
handleChange?.(e);
|
|
@@ -1431,8 +1517,8 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
1431
1517
|
const handleChange = (e) => {
|
|
1432
1518
|
props.onChange?.(e, props?.name || "");
|
|
1433
1519
|
};
|
|
1434
|
-
return /* @__PURE__ */ (0,
|
|
1435
|
-
/* @__PURE__ */ (0,
|
|
1520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1436
1522
|
Textarea,
|
|
1437
1523
|
{
|
|
1438
1524
|
id: "textarea-field",
|
|
@@ -1450,21 +1536,21 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
1450
1536
|
readOnly: isReadonly
|
|
1451
1537
|
}
|
|
1452
1538
|
),
|
|
1453
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
1539
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1454
1540
|
] });
|
|
1455
1541
|
};
|
|
1456
1542
|
var Textarea_default = Textarea2;
|
|
1457
1543
|
|
|
1458
1544
|
// src/components/Inputs/UrlInput/UrlInput.tsx
|
|
1459
|
-
var
|
|
1460
|
-
var
|
|
1545
|
+
var import_react16 = require("react");
|
|
1546
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1461
1547
|
var UrlInput = ({ className, style, ...props }) => {
|
|
1462
1548
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
1463
1549
|
const isEditable = props.isEditable ?? true;
|
|
1464
1550
|
const isDisabled = props.isDisabled ?? false;
|
|
1465
1551
|
const isReadonly = props.isReadonly ?? false;
|
|
1466
1552
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1467
|
-
(0,
|
|
1553
|
+
(0, import_react16.useEffect)(() => {
|
|
1468
1554
|
if (props.value !== void 0) {
|
|
1469
1555
|
const e = { target: { value: props.value }, type: "change" };
|
|
1470
1556
|
handleChange?.(e);
|
|
@@ -1480,10 +1566,10 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
1480
1566
|
if (value === null || value === void 0) return "";
|
|
1481
1567
|
return value;
|
|
1482
1568
|
};
|
|
1483
|
-
return /* @__PURE__ */ (0,
|
|
1484
|
-
/* @__PURE__ */ (0,
|
|
1485
|
-
/* @__PURE__ */ (0,
|
|
1486
|
-
/* @__PURE__ */ (0,
|
|
1569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
1570
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-start items-center relative", children: [
|
|
1571
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "bg-[#E9E9E9] absolute px-10 text-center top-1/2 h-full justify-center items-center flex w-10 -translate-y-1/2 text-[#383838] font-[500] text-[12px]", children: "https://" }),
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1487
1573
|
Input,
|
|
1488
1574
|
{
|
|
1489
1575
|
id: props.name || "url-field",
|
|
@@ -1503,23 +1589,23 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
1503
1589
|
}
|
|
1504
1590
|
)
|
|
1505
1591
|
] }),
|
|
1506
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
1592
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1507
1593
|
] });
|
|
1508
1594
|
};
|
|
1509
1595
|
var UrlInput_default = UrlInput;
|
|
1510
1596
|
|
|
1511
1597
|
// src/components/Inputs/Checkbox/Checkbox.tsx
|
|
1512
|
-
var
|
|
1598
|
+
var import_react17 = require("react");
|
|
1513
1599
|
|
|
1514
1600
|
// src/components/ui/checkbox.tsx
|
|
1515
1601
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
1516
|
-
var
|
|
1517
|
-
var
|
|
1602
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1603
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1518
1604
|
function Checkbox({
|
|
1519
1605
|
className,
|
|
1520
1606
|
...props
|
|
1521
1607
|
}) {
|
|
1522
|
-
return /* @__PURE__ */ (0,
|
|
1608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1523
1609
|
CheckboxPrimitive.Root,
|
|
1524
1610
|
{
|
|
1525
1611
|
"data-slot": "checkbox",
|
|
@@ -1528,12 +1614,12 @@ function Checkbox({
|
|
|
1528
1614
|
className
|
|
1529
1615
|
),
|
|
1530
1616
|
...props,
|
|
1531
|
-
children: /* @__PURE__ */ (0,
|
|
1617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1532
1618
|
CheckboxPrimitive.Indicator,
|
|
1533
1619
|
{
|
|
1534
1620
|
"data-slot": "checkbox-indicator",
|
|
1535
1621
|
className: "flex items-center justify-center text-current transition-none",
|
|
1536
|
-
children: /* @__PURE__ */ (0,
|
|
1622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react5.CheckIcon, { className: "size-3.5" })
|
|
1537
1623
|
}
|
|
1538
1624
|
)
|
|
1539
1625
|
}
|
|
@@ -1542,12 +1628,12 @@ function Checkbox({
|
|
|
1542
1628
|
|
|
1543
1629
|
// src/components/ui/label.tsx
|
|
1544
1630
|
var LabelPrimitive = __toESM(require("@radix-ui/react-label"));
|
|
1545
|
-
var
|
|
1631
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1546
1632
|
function Label2({
|
|
1547
1633
|
className,
|
|
1548
1634
|
...props
|
|
1549
1635
|
}) {
|
|
1550
|
-
return /* @__PURE__ */ (0,
|
|
1636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1551
1637
|
LabelPrimitive.Root,
|
|
1552
1638
|
{
|
|
1553
1639
|
"data-slot": "label",
|
|
@@ -1561,7 +1647,7 @@ function Label2({
|
|
|
1561
1647
|
}
|
|
1562
1648
|
|
|
1563
1649
|
// src/components/Inputs/Checkbox/Checkbox.tsx
|
|
1564
|
-
var
|
|
1650
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1565
1651
|
var CheckboxInput = ({ className, style, ...props }) => {
|
|
1566
1652
|
const isEditable = props.isEditable ?? true;
|
|
1567
1653
|
const isDisabled = props.isDisabled ?? false;
|
|
@@ -1575,7 +1661,7 @@ var CheckboxInput = ({ className, style, ...props }) => {
|
|
|
1575
1661
|
}
|
|
1576
1662
|
return false;
|
|
1577
1663
|
};
|
|
1578
|
-
(0,
|
|
1664
|
+
(0, import_react17.useEffect)(() => {
|
|
1579
1665
|
if (props.value) {
|
|
1580
1666
|
handleChange(formatValue(props.value));
|
|
1581
1667
|
}
|
|
@@ -1583,9 +1669,9 @@ var CheckboxInput = ({ className, style, ...props }) => {
|
|
|
1583
1669
|
const handleChange = (value) => {
|
|
1584
1670
|
props.onChange?.(value, props?.name || "");
|
|
1585
1671
|
};
|
|
1586
|
-
return /* @__PURE__ */ (0,
|
|
1587
|
-
/* @__PURE__ */ (0,
|
|
1588
|
-
/* @__PURE__ */ (0,
|
|
1672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
1673
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
1674
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1589
1675
|
Checkbox,
|
|
1590
1676
|
{
|
|
1591
1677
|
id: props.name || "checkbox",
|
|
@@ -1594,25 +1680,25 @@ var CheckboxInput = ({ className, style, ...props }) => {
|
|
|
1594
1680
|
disabled: !isEditable || isDisabled
|
|
1595
1681
|
}
|
|
1596
1682
|
),
|
|
1597
|
-
/* @__PURE__ */ (0,
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Label2, { htmlFor: props.name || "checkbox", children: text })
|
|
1598
1684
|
] }) }),
|
|
1599
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
1685
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1600
1686
|
] });
|
|
1601
1687
|
};
|
|
1602
1688
|
var Checkbox_default = CheckboxInput;
|
|
1603
1689
|
|
|
1604
1690
|
// src/components/Inputs/RadioInput/RadioInput.tsx
|
|
1605
|
-
var
|
|
1691
|
+
var import_react18 = require("react");
|
|
1606
1692
|
|
|
1607
1693
|
// src/components/ui/radio-group.tsx
|
|
1608
1694
|
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"));
|
|
1609
|
-
var
|
|
1610
|
-
var
|
|
1695
|
+
var import_lucide_react6 = require("lucide-react");
|
|
1696
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1611
1697
|
function RadioGroup2({
|
|
1612
1698
|
className,
|
|
1613
1699
|
...props
|
|
1614
1700
|
}) {
|
|
1615
|
-
return /* @__PURE__ */ (0,
|
|
1701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1616
1702
|
RadioGroupPrimitive.Root,
|
|
1617
1703
|
{
|
|
1618
1704
|
"data-slot": "radio-group",
|
|
@@ -1625,7 +1711,7 @@ function RadioGroupItem({
|
|
|
1625
1711
|
className,
|
|
1626
1712
|
...props
|
|
1627
1713
|
}) {
|
|
1628
|
-
return /* @__PURE__ */ (0,
|
|
1714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1629
1715
|
RadioGroupPrimitive.Item,
|
|
1630
1716
|
{
|
|
1631
1717
|
"data-slot": "radio-group-item",
|
|
@@ -1634,12 +1720,12 @@ function RadioGroupItem({
|
|
|
1634
1720
|
className
|
|
1635
1721
|
),
|
|
1636
1722
|
...props,
|
|
1637
|
-
children: /* @__PURE__ */ (0,
|
|
1723
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1638
1724
|
RadioGroupPrimitive.Indicator,
|
|
1639
1725
|
{
|
|
1640
1726
|
"data-slot": "radio-group-indicator",
|
|
1641
1727
|
className: "relative flex items-center justify-center",
|
|
1642
|
-
children: /* @__PURE__ */ (0,
|
|
1728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react6.CircleIcon, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" })
|
|
1643
1729
|
}
|
|
1644
1730
|
)
|
|
1645
1731
|
}
|
|
@@ -1647,7 +1733,7 @@ function RadioGroupItem({
|
|
|
1647
1733
|
}
|
|
1648
1734
|
|
|
1649
1735
|
// src/components/Inputs/RadioInput/RadioInput.tsx
|
|
1650
|
-
var
|
|
1736
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1651
1737
|
var RadioInput = ({
|
|
1652
1738
|
className,
|
|
1653
1739
|
style,
|
|
@@ -1663,7 +1749,7 @@ var RadioInput = ({
|
|
|
1663
1749
|
value: item[dataKey || "value"],
|
|
1664
1750
|
label: item[dataLabel || "label"]
|
|
1665
1751
|
}));
|
|
1666
|
-
(0,
|
|
1752
|
+
(0, import_react18.useEffect)(() => {
|
|
1667
1753
|
if (props.value !== void 0) {
|
|
1668
1754
|
handleChange?.(props.value);
|
|
1669
1755
|
}
|
|
@@ -1672,29 +1758,29 @@ var RadioInput = ({
|
|
|
1672
1758
|
onChange?.(value, props?.name || "");
|
|
1673
1759
|
};
|
|
1674
1760
|
const resolvedDefaultValue = (typeof defaultValue === "string" ? defaultValue : void 0) ?? options[0]?.value;
|
|
1675
|
-
return /* @__PURE__ */ (0,
|
|
1676
|
-
/* @__PURE__ */ (0,
|
|
1761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
1762
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
1677
1763
|
RadioGroup2,
|
|
1678
1764
|
{
|
|
1679
1765
|
defaultValue: resolvedDefaultValue,
|
|
1680
1766
|
onValueChange: handleChange,
|
|
1681
1767
|
children: [
|
|
1682
|
-
options.length === 0 && /* @__PURE__ */ (0,
|
|
1683
|
-
options.map((item) => /* @__PURE__ */ (0,
|
|
1684
|
-
/* @__PURE__ */ (0,
|
|
1685
|
-
/* @__PURE__ */ (0,
|
|
1768
|
+
options.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "text-sm text-gray-500", children: "No options available" }),
|
|
1769
|
+
options.map((item) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
1770
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RadioGroupItem, { value: item.value, id: `radio-${item.value}` }),
|
|
1771
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Label2, { htmlFor: `radio-${item.value}`, children: item.label })
|
|
1686
1772
|
] }, item.value))
|
|
1687
1773
|
]
|
|
1688
1774
|
}
|
|
1689
1775
|
) }),
|
|
1690
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
1776
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1691
1777
|
] });
|
|
1692
1778
|
};
|
|
1693
1779
|
var RadioInput_default = RadioInput;
|
|
1694
1780
|
|
|
1695
1781
|
// src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx
|
|
1696
|
-
var
|
|
1697
|
-
var
|
|
1782
|
+
var import_react19 = require("react");
|
|
1783
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1698
1784
|
function MultiCheckbox({
|
|
1699
1785
|
apiUrl,
|
|
1700
1786
|
axiosInstance,
|
|
@@ -1712,11 +1798,11 @@ function MultiCheckbox({
|
|
|
1712
1798
|
onUncheckItems,
|
|
1713
1799
|
...props
|
|
1714
1800
|
}) {
|
|
1715
|
-
const [options, setOptions] = (0,
|
|
1716
|
-
const [page, setPage] = (0,
|
|
1717
|
-
const [hasMore, setHasMore] = (0,
|
|
1718
|
-
const [pageLoading, setPageLoading] = (0,
|
|
1719
|
-
const loadMoreRef = (0,
|
|
1801
|
+
const [options, setOptions] = (0, import_react19.useState)([]);
|
|
1802
|
+
const [page, setPage] = (0, import_react19.useState)(1);
|
|
1803
|
+
const [hasMore, setHasMore] = (0, import_react19.useState)(true);
|
|
1804
|
+
const [pageLoading, setPageLoading] = (0, import_react19.useState)(false);
|
|
1805
|
+
const loadMoreRef = (0, import_react19.useRef)(null);
|
|
1720
1806
|
const normalizeInput = (val) => {
|
|
1721
1807
|
if (!val) return [];
|
|
1722
1808
|
if (Array.isArray(val)) return val;
|
|
@@ -1738,7 +1824,7 @@ function MultiCheckbox({
|
|
|
1738
1824
|
return arr;
|
|
1739
1825
|
}
|
|
1740
1826
|
};
|
|
1741
|
-
const fetchApiPage = (0,
|
|
1827
|
+
const fetchApiPage = (0, import_react19.useCallback)(async () => {
|
|
1742
1828
|
if (!apiUrl) return [];
|
|
1743
1829
|
const client = axiosInstance || (await import("axios")).default;
|
|
1744
1830
|
const res = await client.get(apiUrl, {
|
|
@@ -1750,7 +1836,7 @@ function MultiCheckbox({
|
|
|
1750
1836
|
}
|
|
1751
1837
|
return Array.isArray(res.data) ? res.data : [];
|
|
1752
1838
|
}, [apiUrl, axiosInstance, page, pageSize]);
|
|
1753
|
-
const mapData = (0,
|
|
1839
|
+
const mapData = (0, import_react19.useCallback)(
|
|
1754
1840
|
(items) => {
|
|
1755
1841
|
if (Array.isArray(items) === false) return [];
|
|
1756
1842
|
return (items || []).map((item) => ({
|
|
@@ -1760,7 +1846,7 @@ function MultiCheckbox({
|
|
|
1760
1846
|
},
|
|
1761
1847
|
[dataKey, dataLabel]
|
|
1762
1848
|
);
|
|
1763
|
-
const loadPage = (0,
|
|
1849
|
+
const loadPage = (0, import_react19.useCallback)(async () => {
|
|
1764
1850
|
if (source !== "api") return;
|
|
1765
1851
|
if (pageLoading) return;
|
|
1766
1852
|
setPageLoading(true);
|
|
@@ -1775,7 +1861,7 @@ function MultiCheckbox({
|
|
|
1775
1861
|
setPageLoading(false);
|
|
1776
1862
|
}
|
|
1777
1863
|
}, [source, pageLoading, fetchApiPage, mapData, pageSize]);
|
|
1778
|
-
(0,
|
|
1864
|
+
(0, import_react19.useEffect)(() => {
|
|
1779
1865
|
if (source === "api") {
|
|
1780
1866
|
setOptions([]);
|
|
1781
1867
|
setPage(1);
|
|
@@ -1785,10 +1871,10 @@ function MultiCheckbox({
|
|
|
1785
1871
|
setHasMore(false);
|
|
1786
1872
|
}
|
|
1787
1873
|
}, [source, JSON.stringify(data)]);
|
|
1788
|
-
(0,
|
|
1874
|
+
(0, import_react19.useEffect)(() => {
|
|
1789
1875
|
if (source === "api") loadPage();
|
|
1790
1876
|
}, [page, source]);
|
|
1791
|
-
(0,
|
|
1877
|
+
(0, import_react19.useEffect)(() => {
|
|
1792
1878
|
if (source !== "api") return;
|
|
1793
1879
|
if (!hasMore || pageLoading) return;
|
|
1794
1880
|
const observer = new IntersectionObserver((entries) => {
|
|
@@ -1807,11 +1893,11 @@ function MultiCheckbox({
|
|
|
1807
1893
|
options.filter((opt) => !updated.includes(opt.value)).map((opt) => opt.value)
|
|
1808
1894
|
), props.name || "");
|
|
1809
1895
|
};
|
|
1810
|
-
return /* @__PURE__ */ (0,
|
|
1811
|
-
options.length === 0 && !pageLoading && !loading && /* @__PURE__ */ (0,
|
|
1896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: cn("flex flex-col gap-2 max-h-64 overflow-auto", className), style, children: [
|
|
1897
|
+
options.length === 0 && !pageLoading && !loading && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-center py-2 text-gray-500 text-sm", children: "No options available." }),
|
|
1812
1898
|
options.map((opt, index) => {
|
|
1813
1899
|
const hasError = !!props.errorMessage;
|
|
1814
|
-
return /* @__PURE__ */ (0,
|
|
1900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
1815
1901
|
"div",
|
|
1816
1902
|
{
|
|
1817
1903
|
className: cn(
|
|
@@ -1819,7 +1905,7 @@ function MultiCheckbox({
|
|
|
1819
1905
|
hasError && "bg-red-50"
|
|
1820
1906
|
),
|
|
1821
1907
|
children: [
|
|
1822
|
-
/* @__PURE__ */ (0,
|
|
1908
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1823
1909
|
Checkbox,
|
|
1824
1910
|
{
|
|
1825
1911
|
id: props.name ? `${props.name}-${opt.value}` : opt.value,
|
|
@@ -1831,7 +1917,7 @@ function MultiCheckbox({
|
|
|
1831
1917
|
)
|
|
1832
1918
|
}
|
|
1833
1919
|
),
|
|
1834
|
-
/* @__PURE__ */ (0,
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1835
1921
|
Label2,
|
|
1836
1922
|
{
|
|
1837
1923
|
id: props.name ? `${props.name}-${opt.value}` : opt.value,
|
|
@@ -1845,25 +1931,25 @@ function MultiCheckbox({
|
|
|
1845
1931
|
`${index}-${opt.value}`
|
|
1846
1932
|
);
|
|
1847
1933
|
}),
|
|
1848
|
-
source === "api" && hasMore && /* @__PURE__ */ (0,
|
|
1849
|
-
(pageLoading || loading) && /* @__PURE__ */ (0,
|
|
1850
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
1934
|
+
source === "api" && hasMore && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { ref: loadMoreRef, className: "h-4" }),
|
|
1935
|
+
(pageLoading || loading) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-center py-2 text-gray-500 text-sm", children: "Loading\u2026" }),
|
|
1936
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1851
1937
|
] });
|
|
1852
1938
|
}
|
|
1853
1939
|
|
|
1854
1940
|
// src/components/Inputs/RichText/RichText.tsx
|
|
1855
|
-
var
|
|
1941
|
+
var import_react21 = require("react");
|
|
1856
1942
|
|
|
1857
1943
|
// src/components/Global/TinyMceEditor.tsx
|
|
1858
|
-
var
|
|
1944
|
+
var import_react20 = require("react");
|
|
1859
1945
|
var import_tinymce_react = require("@tinymce/tinymce-react");
|
|
1860
|
-
var
|
|
1946
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1861
1947
|
function MyEditor({
|
|
1862
1948
|
value,
|
|
1863
1949
|
onChange,
|
|
1864
1950
|
isDefault
|
|
1865
1951
|
}) {
|
|
1866
|
-
const editorRef = (0,
|
|
1952
|
+
const editorRef = (0, import_react20.useRef)(null);
|
|
1867
1953
|
function stripOuterP(html) {
|
|
1868
1954
|
const trimmedHtml = html.trim();
|
|
1869
1955
|
if (!trimmedHtml) return "";
|
|
@@ -1875,14 +1961,14 @@ function MyEditor({
|
|
|
1875
1961
|
}
|
|
1876
1962
|
return trimmedHtml;
|
|
1877
1963
|
}
|
|
1878
|
-
const isDefaultToolbar = (0,
|
|
1964
|
+
const isDefaultToolbar = (0, import_react20.useMemo)(() => {
|
|
1879
1965
|
let toolbar = "undo redo | formatselect | bold italic forecolor";
|
|
1880
1966
|
if (isDefault) {
|
|
1881
1967
|
toolbar = "undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help";
|
|
1882
1968
|
}
|
|
1883
1969
|
return toolbar;
|
|
1884
1970
|
}, [isDefault]);
|
|
1885
|
-
return /* @__PURE__ */ (0,
|
|
1971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1886
1972
|
import_tinymce_react.Editor,
|
|
1887
1973
|
{
|
|
1888
1974
|
apiKey: process.env.NEXT_PUBLIC_TINYMCE_API_KEY,
|
|
@@ -1926,9 +2012,9 @@ function MyEditor({
|
|
|
1926
2012
|
}
|
|
1927
2013
|
|
|
1928
2014
|
// src/components/Inputs/RichText/RichText.tsx
|
|
1929
|
-
var
|
|
2015
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1930
2016
|
function RichText({ className, style, ...props }) {
|
|
1931
|
-
(0,
|
|
2017
|
+
(0, import_react21.useEffect)(() => {
|
|
1932
2018
|
if (props.value !== void 0) {
|
|
1933
2019
|
handleChange?.(props.value);
|
|
1934
2020
|
}
|
|
@@ -1936,7 +2022,7 @@ function RichText({ className, style, ...props }) {
|
|
|
1936
2022
|
const handleChange = (content) => {
|
|
1937
2023
|
props.onChange?.(content, props?.name || "");
|
|
1938
2024
|
};
|
|
1939
|
-
return /* @__PURE__ */ (0,
|
|
2025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
1940
2026
|
"div",
|
|
1941
2027
|
{
|
|
1942
2028
|
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
@@ -1945,29 +2031,29 @@ function RichText({ className, style, ...props }) {
|
|
|
1945
2031
|
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
1946
2032
|
},
|
|
1947
2033
|
children: [
|
|
1948
|
-
/* @__PURE__ */ (0,
|
|
1949
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
2034
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(MyEditor, { onChange: handleChange, value: props.value || "", isDefault: true }),
|
|
2035
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
1950
2036
|
]
|
|
1951
2037
|
}
|
|
1952
2038
|
);
|
|
1953
2039
|
}
|
|
1954
2040
|
|
|
1955
2041
|
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
1956
|
-
var
|
|
2042
|
+
var import_react24 = require("react");
|
|
1957
2043
|
|
|
1958
2044
|
// src/components/ui/select.tsx
|
|
1959
2045
|
var SelectPrimitive = __toESM(require("@radix-ui/react-select"));
|
|
1960
|
-
var
|
|
1961
|
-
var
|
|
2046
|
+
var import_lucide_react7 = require("lucide-react");
|
|
2047
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1962
2048
|
function Select({
|
|
1963
2049
|
...props
|
|
1964
2050
|
}) {
|
|
1965
|
-
return /* @__PURE__ */ (0,
|
|
2051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
1966
2052
|
}
|
|
1967
2053
|
function SelectValue({
|
|
1968
2054
|
...props
|
|
1969
2055
|
}) {
|
|
1970
|
-
return /* @__PURE__ */ (0,
|
|
2056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
1971
2057
|
}
|
|
1972
2058
|
function SelectTrigger({
|
|
1973
2059
|
className,
|
|
@@ -1975,7 +2061,7 @@ function SelectTrigger({
|
|
|
1975
2061
|
children,
|
|
1976
2062
|
...props
|
|
1977
2063
|
}) {
|
|
1978
|
-
return /* @__PURE__ */ (0,
|
|
2064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
1979
2065
|
SelectPrimitive.Trigger,
|
|
1980
2066
|
{
|
|
1981
2067
|
"data-slot": "select-trigger",
|
|
@@ -1987,7 +2073,7 @@ function SelectTrigger({
|
|
|
1987
2073
|
...props,
|
|
1988
2074
|
children: [
|
|
1989
2075
|
children,
|
|
1990
|
-
/* @__PURE__ */ (0,
|
|
2076
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react7.ChevronDownIcon, { className: "size-4 opacity-50" }) })
|
|
1991
2077
|
]
|
|
1992
2078
|
}
|
|
1993
2079
|
);
|
|
@@ -1998,7 +2084,7 @@ function SelectContent({
|
|
|
1998
2084
|
position = "popper",
|
|
1999
2085
|
...props
|
|
2000
2086
|
}) {
|
|
2001
|
-
return /* @__PURE__ */ (0,
|
|
2087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SelectPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2002
2088
|
SelectPrimitive.Content,
|
|
2003
2089
|
{
|
|
2004
2090
|
"data-slot": "select-content",
|
|
@@ -2010,8 +2096,8 @@ function SelectContent({
|
|
|
2010
2096
|
position,
|
|
2011
2097
|
...props,
|
|
2012
2098
|
children: [
|
|
2013
|
-
/* @__PURE__ */ (0,
|
|
2014
|
-
/* @__PURE__ */ (0,
|
|
2099
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SelectScrollUpButton, {}),
|
|
2100
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2015
2101
|
SelectPrimitive.Viewport,
|
|
2016
2102
|
{
|
|
2017
2103
|
className: cn(
|
|
@@ -2021,7 +2107,7 @@ function SelectContent({
|
|
|
2021
2107
|
children
|
|
2022
2108
|
}
|
|
2023
2109
|
),
|
|
2024
|
-
/* @__PURE__ */ (0,
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SelectScrollDownButton, {})
|
|
2025
2111
|
]
|
|
2026
2112
|
}
|
|
2027
2113
|
) });
|
|
@@ -2031,7 +2117,7 @@ function SelectItem({
|
|
|
2031
2117
|
children,
|
|
2032
2118
|
...props
|
|
2033
2119
|
}) {
|
|
2034
|
-
return /* @__PURE__ */ (0,
|
|
2120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2035
2121
|
SelectPrimitive.Item,
|
|
2036
2122
|
{
|
|
2037
2123
|
"data-slot": "select-item",
|
|
@@ -2041,8 +2127,8 @@ function SelectItem({
|
|
|
2041
2127
|
),
|
|
2042
2128
|
...props,
|
|
2043
2129
|
children: [
|
|
2044
|
-
/* @__PURE__ */ (0,
|
|
2045
|
-
/* @__PURE__ */ (0,
|
|
2130
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react7.CheckIcon, { className: "size-4" }) }) }),
|
|
2131
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SelectPrimitive.ItemText, { children })
|
|
2046
2132
|
]
|
|
2047
2133
|
}
|
|
2048
2134
|
);
|
|
@@ -2051,7 +2137,7 @@ function SelectScrollUpButton({
|
|
|
2051
2137
|
className,
|
|
2052
2138
|
...props
|
|
2053
2139
|
}) {
|
|
2054
|
-
return /* @__PURE__ */ (0,
|
|
2140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2055
2141
|
SelectPrimitive.ScrollUpButton,
|
|
2056
2142
|
{
|
|
2057
2143
|
"data-slot": "select-scroll-up-button",
|
|
@@ -2060,7 +2146,7 @@ function SelectScrollUpButton({
|
|
|
2060
2146
|
className
|
|
2061
2147
|
),
|
|
2062
2148
|
...props,
|
|
2063
|
-
children: /* @__PURE__ */ (0,
|
|
2149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react7.ChevronUpIcon, { className: "size-4" })
|
|
2064
2150
|
}
|
|
2065
2151
|
);
|
|
2066
2152
|
}
|
|
@@ -2068,7 +2154,7 @@ function SelectScrollDownButton({
|
|
|
2068
2154
|
className,
|
|
2069
2155
|
...props
|
|
2070
2156
|
}) {
|
|
2071
|
-
return /* @__PURE__ */ (0,
|
|
2157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2072
2158
|
SelectPrimitive.ScrollDownButton,
|
|
2073
2159
|
{
|
|
2074
2160
|
"data-slot": "select-scroll-down-button",
|
|
@@ -2077,29 +2163,29 @@ function SelectScrollDownButton({
|
|
|
2077
2163
|
className
|
|
2078
2164
|
),
|
|
2079
2165
|
...props,
|
|
2080
|
-
children: /* @__PURE__ */ (0,
|
|
2166
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react7.ChevronDownIcon, { className: "size-4" })
|
|
2081
2167
|
}
|
|
2082
2168
|
);
|
|
2083
2169
|
}
|
|
2084
2170
|
|
|
2085
2171
|
// src/components/Inputs/Dropdown/LazyDropdown.tsx
|
|
2086
|
-
var
|
|
2087
|
-
var
|
|
2172
|
+
var import_react23 = require("react");
|
|
2173
|
+
var import_lucide_react8 = require("lucide-react");
|
|
2088
2174
|
|
|
2089
2175
|
// src/hooks/useLazyDropdown.ts
|
|
2090
|
-
var
|
|
2176
|
+
var import_react22 = require("react");
|
|
2091
2177
|
var import_axios2 = __toESM(require("axios"));
|
|
2092
2178
|
function useLazyDropdown(config) {
|
|
2093
|
-
const [options, setOptions] = (0,
|
|
2094
|
-
const [page, setPage] = (0,
|
|
2095
|
-
const [hasMore, setHasMore] = (0,
|
|
2096
|
-
const [loading, setLoading] = (0,
|
|
2097
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
2098
|
-
const debounceTimer = (0,
|
|
2099
|
-
const allDataRef = (0,
|
|
2100
|
-
const configRef = (0,
|
|
2179
|
+
const [options, setOptions] = (0, import_react22.useState)([]);
|
|
2180
|
+
const [page, setPage] = (0, import_react22.useState)(1);
|
|
2181
|
+
const [hasMore, setHasMore] = (0, import_react22.useState)(true);
|
|
2182
|
+
const [loading, setLoading] = (0, import_react22.useState)(false);
|
|
2183
|
+
const [searchTerm, setSearchTerm] = (0, import_react22.useState)("");
|
|
2184
|
+
const debounceTimer = (0, import_react22.useRef)(null);
|
|
2185
|
+
const allDataRef = (0, import_react22.useRef)([]);
|
|
2186
|
+
const configRef = (0, import_react22.useRef)(config);
|
|
2101
2187
|
const PAGE_SIZE = config.pageSize || 10;
|
|
2102
|
-
(0,
|
|
2188
|
+
(0, import_react22.useEffect)(() => {
|
|
2103
2189
|
setOptions([]);
|
|
2104
2190
|
setPage(1);
|
|
2105
2191
|
setHasMore(true);
|
|
@@ -2112,7 +2198,7 @@ function useLazyDropdown(config) {
|
|
|
2112
2198
|
return true;
|
|
2113
2199
|
});
|
|
2114
2200
|
};
|
|
2115
|
-
(0,
|
|
2201
|
+
(0, import_react22.useEffect)(() => {
|
|
2116
2202
|
configRef.current = config;
|
|
2117
2203
|
}, [config]);
|
|
2118
2204
|
function getValueByPath2(obj, path) {
|
|
@@ -2123,7 +2209,7 @@ function useLazyDropdown(config) {
|
|
|
2123
2209
|
function isEmptyParamValue(value) {
|
|
2124
2210
|
return value === "" || value === void 0 || value === null || value === "null" || value === "undefined";
|
|
2125
2211
|
}
|
|
2126
|
-
const transformToOptions = (0,
|
|
2212
|
+
const transformToOptions = (0, import_react22.useCallback)((data) => {
|
|
2127
2213
|
if (!data || !Array.isArray(data)) return [];
|
|
2128
2214
|
const cfg = configRef.current;
|
|
2129
2215
|
return data.map((item) => {
|
|
@@ -2161,7 +2247,7 @@ function useLazyDropdown(config) {
|
|
|
2161
2247
|
params: cleaned
|
|
2162
2248
|
};
|
|
2163
2249
|
}
|
|
2164
|
-
const fetchApiData = (0,
|
|
2250
|
+
const fetchApiData = (0, import_react22.useCallback)(async (pageNum, term) => {
|
|
2165
2251
|
if (!configRef.current.apiUrl) return [];
|
|
2166
2252
|
const limit = PAGE_SIZE;
|
|
2167
2253
|
const params = { page: pageNum, limit };
|
|
@@ -2186,7 +2272,7 @@ function useLazyDropdown(config) {
|
|
|
2186
2272
|
}
|
|
2187
2273
|
return [];
|
|
2188
2274
|
}, [PAGE_SIZE, transformToOptions]);
|
|
2189
|
-
const loadPage = (0,
|
|
2275
|
+
const loadPage = (0, import_react22.useCallback)(async (pageNum, term) => {
|
|
2190
2276
|
const cfg = configRef.current;
|
|
2191
2277
|
if (!cfg.enabled) return;
|
|
2192
2278
|
setLoading(true);
|
|
@@ -2274,7 +2360,7 @@ function useLazyDropdown(config) {
|
|
|
2274
2360
|
setLoading(false);
|
|
2275
2361
|
}
|
|
2276
2362
|
};
|
|
2277
|
-
(0,
|
|
2363
|
+
(0, import_react22.useEffect)(() => {
|
|
2278
2364
|
const cfg = configRef.current;
|
|
2279
2365
|
if (!cfg.enabled || !cfg.value || cfg.dataSource !== "api" || !cfg.apiUrl) return;
|
|
2280
2366
|
if (cfg.isMultiSelect) {
|
|
@@ -2287,28 +2373,28 @@ function useLazyDropdown(config) {
|
|
|
2287
2373
|
}
|
|
2288
2374
|
fetchValueItem();
|
|
2289
2375
|
}, [JSON.stringify(config.value), config.dataKey, config.apiUrl, config.dataSource]);
|
|
2290
|
-
const loadMore = (0,
|
|
2376
|
+
const loadMore = (0, import_react22.useCallback)(() => {
|
|
2291
2377
|
if (!loading && hasMore) {
|
|
2292
2378
|
loadPage(page + 1, searchTerm);
|
|
2293
2379
|
}
|
|
2294
2380
|
}, [loading, hasMore, page, searchTerm]);
|
|
2295
|
-
const search = (0,
|
|
2381
|
+
const search = (0, import_react22.useCallback)((term) => {
|
|
2296
2382
|
setSearchTerm(term);
|
|
2297
2383
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
2298
2384
|
debounceTimer.current = setTimeout(() => {
|
|
2299
2385
|
loadPage(1, term);
|
|
2300
2386
|
}, 300);
|
|
2301
2387
|
}, []);
|
|
2302
|
-
const reset = (0,
|
|
2388
|
+
const reset = (0, import_react22.useCallback)(() => {
|
|
2303
2389
|
setSearchTerm("");
|
|
2304
2390
|
setPage(1);
|
|
2305
2391
|
}, []);
|
|
2306
|
-
(0,
|
|
2392
|
+
(0, import_react22.useEffect)(() => {
|
|
2307
2393
|
if (config.initialData?.length) {
|
|
2308
2394
|
allDataRef.current = config.initialData;
|
|
2309
2395
|
}
|
|
2310
2396
|
}, [config.initialData]);
|
|
2311
|
-
(0,
|
|
2397
|
+
(0, import_react22.useEffect)(() => {
|
|
2312
2398
|
if (config.fetchOnMount) loadPage(1, "");
|
|
2313
2399
|
return () => {
|
|
2314
2400
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
@@ -2355,7 +2441,7 @@ function useLazyDropdown(config) {
|
|
|
2355
2441
|
}
|
|
2356
2442
|
|
|
2357
2443
|
// src/components/Inputs/Dropdown/LazyDropdown.tsx
|
|
2358
|
-
var
|
|
2444
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2359
2445
|
function LazySelectDropdown({
|
|
2360
2446
|
options = [],
|
|
2361
2447
|
value,
|
|
@@ -2376,12 +2462,12 @@ function LazySelectDropdown({
|
|
|
2376
2462
|
enforceStrictQueryParams = false,
|
|
2377
2463
|
...props
|
|
2378
2464
|
}) {
|
|
2379
|
-
const [isOpen, setIsOpen] = (0,
|
|
2380
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
2381
|
-
const [highlightedIndex, setHighlightedIndex] = (0,
|
|
2382
|
-
const dropdownRef = (0,
|
|
2383
|
-
const popupRef = (0,
|
|
2384
|
-
const observerTarget = (0,
|
|
2465
|
+
const [isOpen, setIsOpen] = (0, import_react23.useState)(false);
|
|
2466
|
+
const [searchTerm, setSearchTerm] = (0, import_react23.useState)("");
|
|
2467
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react23.useState)(-1);
|
|
2468
|
+
const dropdownRef = (0, import_react23.useRef)(null);
|
|
2469
|
+
const popupRef = (0, import_react23.useRef)(null);
|
|
2470
|
+
const observerTarget = (0, import_react23.useRef)(null);
|
|
2385
2471
|
const {
|
|
2386
2472
|
options: lazyOptions,
|
|
2387
2473
|
loading,
|
|
@@ -2403,15 +2489,15 @@ function LazySelectDropdown({
|
|
|
2403
2489
|
axiosInstance,
|
|
2404
2490
|
enforceStrictQueryParams
|
|
2405
2491
|
});
|
|
2406
|
-
const selectedOption = (0,
|
|
2407
|
-
(0,
|
|
2492
|
+
const selectedOption = (0, import_react23.useMemo)(() => lazyOptions.find((opt) => opt.value === value), [lazyOptions, value]);
|
|
2493
|
+
(0, import_react23.useEffect)(() => {
|
|
2408
2494
|
if (!isOpen) {
|
|
2409
2495
|
setHighlightedIndex(-1);
|
|
2410
2496
|
} else if (lazyOptions.length > 0 && highlightedIndex === -1) {
|
|
2411
2497
|
setHighlightedIndex(0);
|
|
2412
2498
|
}
|
|
2413
2499
|
}, [isOpen, lazyOptions.length, highlightedIndex]);
|
|
2414
|
-
(0,
|
|
2500
|
+
(0, import_react23.useEffect)(() => {
|
|
2415
2501
|
const handleOutside = (e) => {
|
|
2416
2502
|
const target = e.target;
|
|
2417
2503
|
if (dropdownRef.current && !dropdownRef.current.contains(target) && (!popupRef.current || !popupRef.current.contains(target))) {
|
|
@@ -2427,7 +2513,7 @@ function LazySelectDropdown({
|
|
|
2427
2513
|
document.removeEventListener("focusin", handleOutside);
|
|
2428
2514
|
};
|
|
2429
2515
|
}, []);
|
|
2430
|
-
(0,
|
|
2516
|
+
(0, import_react23.useEffect)(() => {
|
|
2431
2517
|
if (!isOpen || !hasMore || loading) return;
|
|
2432
2518
|
const observer = new IntersectionObserver(
|
|
2433
2519
|
(entries) => {
|
|
@@ -2518,8 +2604,8 @@ function LazySelectDropdown({
|
|
|
2518
2604
|
break;
|
|
2519
2605
|
}
|
|
2520
2606
|
};
|
|
2521
|
-
return /* @__PURE__ */ (0,
|
|
2522
|
-
/* @__PURE__ */ (0,
|
|
2607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { ref: dropdownRef, className: "relative w-full", children: [
|
|
2608
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2523
2609
|
"input",
|
|
2524
2610
|
{
|
|
2525
2611
|
type: "text",
|
|
@@ -2541,18 +2627,18 @@ function LazySelectDropdown({
|
|
|
2541
2627
|
autoComplete: "off"
|
|
2542
2628
|
}
|
|
2543
2629
|
),
|
|
2544
|
-
selectedOption && !disabled && !readOnly && /* @__PURE__ */ (0,
|
|
2630
|
+
selectedOption && !disabled && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2545
2631
|
"button",
|
|
2546
2632
|
{
|
|
2547
2633
|
type: "button",
|
|
2548
2634
|
"aria-label": "Clear selection",
|
|
2549
2635
|
onClick: handleRemoveSelection,
|
|
2550
2636
|
className: "absolute right-2 top-1/2 -translate-y-1/2 h-5 w-5 flex items-center justify-center rounded hover:bg-gray-200 text-gray-500 focus:outline-none",
|
|
2551
|
-
children: /* @__PURE__ */ (0,
|
|
2637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react8.XSquareIcon, { className: "h-5 w-5 pointer-events-none" })
|
|
2552
2638
|
}
|
|
2553
2639
|
),
|
|
2554
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
2555
|
-
isOpen && !disabled && /* @__PURE__ */ (0,
|
|
2640
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mt-1 text-xs text-red-500", children: errorMessage }),
|
|
2641
|
+
isOpen && !disabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2556
2642
|
"div",
|
|
2557
2643
|
{
|
|
2558
2644
|
ref: popupRef,
|
|
@@ -2564,14 +2650,14 @@ function LazySelectDropdown({
|
|
|
2564
2650
|
top: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().bottom + window.scrollY : 0,
|
|
2565
2651
|
left: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().left + window.scrollX : 0
|
|
2566
2652
|
},
|
|
2567
|
-
children: props.loading && !loading ? /* @__PURE__ */ (0,
|
|
2568
|
-
/* @__PURE__ */ (0,
|
|
2653
|
+
children: props.loading && !loading ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "px-3 py-4 text-center text-gray-500 flex items-center justify-center gap-2 text-sm", children: [
|
|
2654
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "animate-spin w-4 h-4 border-2 border-gray-300 border-t-blue-500 rounded-full" }),
|
|
2569
2655
|
"Loading..."
|
|
2570
|
-
] }) : /* @__PURE__ */ (0,
|
|
2571
|
-
/* @__PURE__ */ (0,
|
|
2656
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: loading && lazyOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "px-3 py-4 text-center text-gray-500 flex items-center justify-center gap-2 text-sm", children: [
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "animate-spin w-4 h-4 border-2 border-gray-300 border-t-blue-500 rounded-full" }),
|
|
2572
2658
|
"Loading..."
|
|
2573
|
-
] }) : lazyOptions.length > 0 ? /* @__PURE__ */ (0,
|
|
2574
|
-
lazyOptions.map((option, index) => /* @__PURE__ */ (0,
|
|
2659
|
+
] }) : lazyOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
2660
|
+
lazyOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2575
2661
|
"div",
|
|
2576
2662
|
{
|
|
2577
2663
|
tabIndex: 0,
|
|
@@ -2590,20 +2676,20 @@ function LazySelectDropdown({
|
|
|
2590
2676
|
},
|
|
2591
2677
|
`${option.value}-${index}`
|
|
2592
2678
|
)),
|
|
2593
|
-
hasMore && /* @__PURE__ */ (0,
|
|
2679
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2594
2680
|
"div",
|
|
2595
2681
|
{
|
|
2596
2682
|
ref: observerTarget,
|
|
2597
2683
|
className: "px-3 py-2 text-center text-gray-400 text-sm border-t",
|
|
2598
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
2599
|
-
/* @__PURE__ */ (0,
|
|
2684
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-center gap-2 text-sm", children: [
|
|
2685
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "animate-spin w-3 h-3 border-2 border-gray-300 border-t-blue-500 rounded-full" }),
|
|
2600
2686
|
"Loading more..."
|
|
2601
2687
|
] }) : "Scroll for more..."
|
|
2602
2688
|
}
|
|
2603
2689
|
)
|
|
2604
|
-
] }) : /* @__PURE__ */ (0,
|
|
2690
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "px-3 py-4 text-sm text-center text-gray-500", children: [
|
|
2605
2691
|
searchTerm ? `No results for "${searchTerm}"` : "No options available",
|
|
2606
|
-
enableAddNewOption && searchTerm && /* @__PURE__ */ (0,
|
|
2692
|
+
enableAddNewOption && searchTerm && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2607
2693
|
"div",
|
|
2608
2694
|
{
|
|
2609
2695
|
onClick: () => handleAddNewOption(searchTerm),
|
|
@@ -2619,14 +2705,14 @@ function LazySelectDropdown({
|
|
|
2619
2705
|
var LazyDropdown_default = LazySelectDropdown;
|
|
2620
2706
|
|
|
2621
2707
|
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
2622
|
-
var
|
|
2708
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2623
2709
|
var Dropdown = ({ className, style, ...props }) => {
|
|
2624
2710
|
const list = Array.isArray(props?.data) ? props.data : [];
|
|
2625
2711
|
const placeholder = props.placeholder ? props.placeholder : "Select an option";
|
|
2626
2712
|
const isEditable = props.isEditable ?? true;
|
|
2627
2713
|
const isDisabled = props.isDisabled ?? false;
|
|
2628
2714
|
const isReadonly = props.isReadonly ?? false;
|
|
2629
|
-
(0,
|
|
2715
|
+
(0, import_react24.useEffect)(() => {
|
|
2630
2716
|
if (props.value !== void 0) {
|
|
2631
2717
|
handleChange(props.value);
|
|
2632
2718
|
}
|
|
@@ -2641,7 +2727,7 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
2641
2727
|
label: item[dataLabel]
|
|
2642
2728
|
}));
|
|
2643
2729
|
if (props.lazyLoad) {
|
|
2644
|
-
return /* @__PURE__ */ (0,
|
|
2730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2645
2731
|
LazyDropdown_default,
|
|
2646
2732
|
{
|
|
2647
2733
|
...props,
|
|
@@ -2658,9 +2744,9 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
2658
2744
|
}
|
|
2659
2745
|
);
|
|
2660
2746
|
}
|
|
2661
|
-
return /* @__PURE__ */ (0,
|
|
2662
|
-
/* @__PURE__ */ (0,
|
|
2663
|
-
/* @__PURE__ */ (0,
|
|
2747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
2748
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Select, { name: props.name, value: props.value || "", onValueChange: handleChange, disabled: isDisabled || !isEditable, children: [
|
|
2749
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2664
2750
|
SelectTrigger,
|
|
2665
2751
|
{
|
|
2666
2752
|
id: props.name || "select-field",
|
|
@@ -2670,31 +2756,31 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
2670
2756
|
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
2671
2757
|
},
|
|
2672
2758
|
"aria-readonly": isReadonly,
|
|
2673
|
-
children: /* @__PURE__ */ (0,
|
|
2759
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SelectValue, { placeholder })
|
|
2674
2760
|
}
|
|
2675
2761
|
),
|
|
2676
|
-
/* @__PURE__ */ (0,
|
|
2677
|
-
props.dataLoading && /* @__PURE__ */ (0,
|
|
2678
|
-
!props.dataLoading && options.length === 0 && /* @__PURE__ */ (0,
|
|
2679
|
-
options.map((opt) => /* @__PURE__ */ (0,
|
|
2762
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(SelectContent, { children: [
|
|
2763
|
+
props.dataLoading && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SelectItem, { value: "none", disabled: true, children: "Loading..." }),
|
|
2764
|
+
!props.dataLoading && options.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SelectItem, { value: "none", disabled: true, children: "No options" }),
|
|
2765
|
+
options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SelectItem, { value: opt.value, children: opt.label }, opt.value))
|
|
2680
2766
|
] })
|
|
2681
2767
|
] }),
|
|
2682
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
2768
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
2683
2769
|
] });
|
|
2684
2770
|
};
|
|
2685
2771
|
var Dropdown_default = Dropdown;
|
|
2686
2772
|
|
|
2687
2773
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
2688
|
-
var
|
|
2774
|
+
var import_react25 = require("react");
|
|
2689
2775
|
|
|
2690
2776
|
// src/components/ui/switch.tsx
|
|
2691
2777
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
2692
|
-
var
|
|
2778
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2693
2779
|
function Switch({
|
|
2694
2780
|
className,
|
|
2695
2781
|
...props
|
|
2696
2782
|
}) {
|
|
2697
|
-
return /* @__PURE__ */ (0,
|
|
2783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2698
2784
|
SwitchPrimitive.Root,
|
|
2699
2785
|
{
|
|
2700
2786
|
"data-slot": "switch",
|
|
@@ -2703,7 +2789,7 @@ function Switch({
|
|
|
2703
2789
|
className
|
|
2704
2790
|
),
|
|
2705
2791
|
...props,
|
|
2706
|
-
children: /* @__PURE__ */ (0,
|
|
2792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2707
2793
|
SwitchPrimitive.Thumb,
|
|
2708
2794
|
{
|
|
2709
2795
|
"data-slot": "switch-thumb",
|
|
@@ -2717,11 +2803,11 @@ function Switch({
|
|
|
2717
2803
|
}
|
|
2718
2804
|
|
|
2719
2805
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
2720
|
-
var
|
|
2806
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2721
2807
|
var SwitchToggle = ({ className, style, ...props }) => {
|
|
2722
2808
|
const isEditable = props.isEditable ?? true;
|
|
2723
2809
|
const isDisabled = props.isDisabled ?? false;
|
|
2724
|
-
(0,
|
|
2810
|
+
(0, import_react25.useEffect)(() => {
|
|
2725
2811
|
if (props.value !== void 0) {
|
|
2726
2812
|
handleChange?.(props.value);
|
|
2727
2813
|
}
|
|
@@ -2729,9 +2815,9 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
2729
2815
|
const handleChange = (value) => {
|
|
2730
2816
|
props.onChange?.(value, props?.name || "");
|
|
2731
2817
|
};
|
|
2732
|
-
return /* @__PURE__ */ (0,
|
|
2733
|
-
/* @__PURE__ */ (0,
|
|
2734
|
-
/* @__PURE__ */ (0,
|
|
2818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
2819
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center space-x-2 mb-2", children: [
|
|
2820
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2735
2821
|
Switch,
|
|
2736
2822
|
{
|
|
2737
2823
|
id: props.name || "switch",
|
|
@@ -2740,18 +2826,18 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
2740
2826
|
disabled: isDisabled || !isEditable
|
|
2741
2827
|
}
|
|
2742
2828
|
),
|
|
2743
|
-
/* @__PURE__ */ (0,
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Label2, { htmlFor: props.name || "switch", children: props.text })
|
|
2744
2830
|
] }) }),
|
|
2745
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
2831
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
2746
2832
|
] });
|
|
2747
2833
|
};
|
|
2748
2834
|
var SwitchToggle_default = SwitchToggle;
|
|
2749
2835
|
|
|
2750
2836
|
// src/components/Inputs/PhoneInput/PhoneInput.tsx
|
|
2751
|
-
var
|
|
2837
|
+
var import_react26 = require("react");
|
|
2752
2838
|
var import_react_international_phone = require("react-international-phone");
|
|
2753
2839
|
var import_style = require("react-international-phone/style.css");
|
|
2754
|
-
var
|
|
2840
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2755
2841
|
var ensureDialcode = (val) => {
|
|
2756
2842
|
if (!val) return "";
|
|
2757
2843
|
const trimmed = val.trim();
|
|
@@ -2760,11 +2846,11 @@ var ensureDialcode = (val) => {
|
|
|
2760
2846
|
return `+91${local}`;
|
|
2761
2847
|
};
|
|
2762
2848
|
var PhoneInput = ({ className, style, ...props }) => {
|
|
2763
|
-
const ref = (0,
|
|
2849
|
+
const ref = (0, import_react26.useRef)(null);
|
|
2764
2850
|
const placeholder = props.placeholder ?? "Enter phone number";
|
|
2765
2851
|
const isEditable = props.isEditable ?? true;
|
|
2766
2852
|
const isDisabled = props.isDisabled ?? false;
|
|
2767
|
-
(0,
|
|
2853
|
+
(0, import_react26.useEffect)(() => {
|
|
2768
2854
|
if (props.value !== void 0) {
|
|
2769
2855
|
handleChange?.(ensureDialcode(props.value), ref.current?.state);
|
|
2770
2856
|
}
|
|
@@ -2779,8 +2865,8 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
2779
2865
|
props.onChange?.(event, props.name || "");
|
|
2780
2866
|
props.getPhoneState?.(meta);
|
|
2781
2867
|
};
|
|
2782
|
-
return /* @__PURE__ */ (0,
|
|
2783
|
-
/* @__PURE__ */ (0,
|
|
2868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
2869
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2784
2870
|
import_react_international_phone.PhoneInput,
|
|
2785
2871
|
{
|
|
2786
2872
|
ref,
|
|
@@ -2805,21 +2891,21 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
2805
2891
|
disabled: isDisabled || !isEditable
|
|
2806
2892
|
}
|
|
2807
2893
|
),
|
|
2808
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
2894
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
2809
2895
|
] });
|
|
2810
2896
|
};
|
|
2811
2897
|
var PhoneInput_default = PhoneInput;
|
|
2812
2898
|
|
|
2813
2899
|
// src/components/Inputs/SearchInput/SearchInput.tsx
|
|
2814
|
-
var
|
|
2815
|
-
var
|
|
2900
|
+
var import_react27 = require("react");
|
|
2901
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2816
2902
|
var SearchInput = ({ className, style, ...props }) => {
|
|
2817
2903
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
2818
2904
|
const isEditable = props.isEditable ?? true;
|
|
2819
2905
|
const isDisabled = props.isDisabled ?? false;
|
|
2820
2906
|
const isReadonly = props.isReadonly ?? false;
|
|
2821
2907
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
2822
|
-
(0,
|
|
2908
|
+
(0, import_react27.useEffect)(() => {
|
|
2823
2909
|
if (props.value !== void 0) {
|
|
2824
2910
|
const e = { target: { value: props.value }, type: "change" };
|
|
2825
2911
|
handleChange?.(e);
|
|
@@ -2835,8 +2921,8 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
2835
2921
|
if (value === null || value === void 0) return "";
|
|
2836
2922
|
return value;
|
|
2837
2923
|
};
|
|
2838
|
-
return /* @__PURE__ */ (0,
|
|
2839
|
-
/* @__PURE__ */ (0,
|
|
2924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
2925
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2840
2926
|
Input,
|
|
2841
2927
|
{
|
|
2842
2928
|
type: props.inputType || "search",
|
|
@@ -2855,17 +2941,17 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
2855
2941
|
readOnly: isReadonly
|
|
2856
2942
|
}
|
|
2857
2943
|
) }),
|
|
2858
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
2944
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
2859
2945
|
] });
|
|
2860
2946
|
};
|
|
2861
2947
|
var SearchInput_default = SearchInput;
|
|
2862
2948
|
|
|
2863
2949
|
// src/components/Inputs/FileInput/FileInput.tsx
|
|
2864
|
-
var
|
|
2865
|
-
var
|
|
2950
|
+
var import_react28 = require("react");
|
|
2951
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2866
2952
|
var FileInput = ({ className, style, ...props }) => {
|
|
2867
2953
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
2868
|
-
(0,
|
|
2954
|
+
(0, import_react28.useEffect)(() => {
|
|
2869
2955
|
if (props.value !== void 0) {
|
|
2870
2956
|
const e = { target: { value: props.value }, type: "change" };
|
|
2871
2957
|
handleChange?.(e);
|
|
@@ -2881,8 +2967,8 @@ var FileInput = ({ className, style, ...props }) => {
|
|
|
2881
2967
|
if (value === null || value === void 0) return "";
|
|
2882
2968
|
return value;
|
|
2883
2969
|
};
|
|
2884
|
-
return /* @__PURE__ */ (0,
|
|
2885
|
-
/* @__PURE__ */ (0,
|
|
2970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "d-flex items-center relative align-middle", children: [
|
|
2971
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2886
2972
|
Input,
|
|
2887
2973
|
{
|
|
2888
2974
|
type: props.inputType || "file",
|
|
@@ -2899,21 +2985,21 @@ var FileInput = ({ className, style, ...props }) => {
|
|
|
2899
2985
|
onChange: handleChange
|
|
2900
2986
|
}
|
|
2901
2987
|
),
|
|
2902
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
2988
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
2903
2989
|
] });
|
|
2904
2990
|
};
|
|
2905
2991
|
var FileInput_default = FileInput;
|
|
2906
2992
|
|
|
2907
2993
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
2908
|
-
var
|
|
2994
|
+
var React9 = __toESM(require("react"));
|
|
2909
2995
|
var import_date_fns = require("date-fns");
|
|
2910
|
-
var
|
|
2996
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2911
2997
|
|
|
2912
2998
|
// src/components/ui/calendar.tsx
|
|
2913
|
-
var
|
|
2914
|
-
var
|
|
2999
|
+
var React8 = __toESM(require("react"));
|
|
3000
|
+
var import_lucide_react9 = require("lucide-react");
|
|
2915
3001
|
var import_react_day_picker = require("react-day-picker");
|
|
2916
|
-
var
|
|
3002
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2917
3003
|
function Calendar({
|
|
2918
3004
|
className,
|
|
2919
3005
|
classNames,
|
|
@@ -2925,7 +3011,7 @@ function Calendar({
|
|
|
2925
3011
|
...props
|
|
2926
3012
|
}) {
|
|
2927
3013
|
const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
2928
|
-
return /* @__PURE__ */ (0,
|
|
3014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2929
3015
|
import_react_day_picker.DayPicker,
|
|
2930
3016
|
{
|
|
2931
3017
|
showOutsideDays,
|
|
@@ -3024,7 +3110,7 @@ function Calendar({
|
|
|
3024
3110
|
},
|
|
3025
3111
|
components: {
|
|
3026
3112
|
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
3027
|
-
return /* @__PURE__ */ (0,
|
|
3113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3028
3114
|
"div",
|
|
3029
3115
|
{
|
|
3030
3116
|
"data-slot": "calendar",
|
|
@@ -3036,22 +3122,22 @@ function Calendar({
|
|
|
3036
3122
|
},
|
|
3037
3123
|
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
3038
3124
|
if (orientation === "left") {
|
|
3039
|
-
return /* @__PURE__ */ (0,
|
|
3125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react9.ChevronLeftIcon, { className: cn("size-4", className2), ...props2 });
|
|
3040
3126
|
}
|
|
3041
3127
|
if (orientation === "right") {
|
|
3042
|
-
return /* @__PURE__ */ (0,
|
|
3043
|
-
|
|
3128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3129
|
+
import_lucide_react9.ChevronRightIcon,
|
|
3044
3130
|
{
|
|
3045
3131
|
className: cn("size-4", className2),
|
|
3046
3132
|
...props2
|
|
3047
3133
|
}
|
|
3048
3134
|
);
|
|
3049
3135
|
}
|
|
3050
|
-
return /* @__PURE__ */ (0,
|
|
3136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react9.ChevronDownIcon, { className: cn("size-4", className2), ...props2 });
|
|
3051
3137
|
},
|
|
3052
3138
|
DayButton: CalendarDayButton,
|
|
3053
3139
|
WeekNumber: ({ children, ...props2 }) => {
|
|
3054
|
-
return /* @__PURE__ */ (0,
|
|
3140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("td", { ...props2, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
3055
3141
|
},
|
|
3056
3142
|
...components
|
|
3057
3143
|
},
|
|
@@ -3066,11 +3152,11 @@ function CalendarDayButton({
|
|
|
3066
3152
|
...props
|
|
3067
3153
|
}) {
|
|
3068
3154
|
const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
3069
|
-
const ref =
|
|
3070
|
-
|
|
3155
|
+
const ref = React8.useRef(null);
|
|
3156
|
+
React8.useEffect(() => {
|
|
3071
3157
|
if (modifiers.focused) ref.current?.focus();
|
|
3072
3158
|
}, [modifiers.focused]);
|
|
3073
|
-
return /* @__PURE__ */ (0,
|
|
3159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3074
3160
|
Button,
|
|
3075
3161
|
{
|
|
3076
3162
|
ref,
|
|
@@ -3093,16 +3179,16 @@ function CalendarDayButton({
|
|
|
3093
3179
|
|
|
3094
3180
|
// src/components/ui/popover.tsx
|
|
3095
3181
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
3096
|
-
var
|
|
3182
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3097
3183
|
function Popover({
|
|
3098
3184
|
...props
|
|
3099
3185
|
}) {
|
|
3100
|
-
return /* @__PURE__ */ (0,
|
|
3186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
3101
3187
|
}
|
|
3102
3188
|
function PopoverTrigger({
|
|
3103
3189
|
...props
|
|
3104
3190
|
}) {
|
|
3105
|
-
return /* @__PURE__ */ (0,
|
|
3191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
3106
3192
|
}
|
|
3107
3193
|
function PopoverContent({
|
|
3108
3194
|
className,
|
|
@@ -3110,7 +3196,7 @@ function PopoverContent({
|
|
|
3110
3196
|
sideOffset = 4,
|
|
3111
3197
|
...props
|
|
3112
3198
|
}) {
|
|
3113
|
-
return /* @__PURE__ */ (0,
|
|
3199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3114
3200
|
PopoverPrimitive.Content,
|
|
3115
3201
|
{
|
|
3116
3202
|
"data-slot": "popover-content",
|
|
@@ -3126,7 +3212,7 @@ function PopoverContent({
|
|
|
3126
3212
|
}
|
|
3127
3213
|
|
|
3128
3214
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
3129
|
-
var
|
|
3215
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3130
3216
|
function resolveDate(option, customOption) {
|
|
3131
3217
|
if (!option) return void 0;
|
|
3132
3218
|
switch (option) {
|
|
@@ -3193,7 +3279,7 @@ function DateTimePicker({
|
|
|
3193
3279
|
mode = "date",
|
|
3194
3280
|
...props
|
|
3195
3281
|
}) {
|
|
3196
|
-
const [open, setOpen] =
|
|
3282
|
+
const [open, setOpen] = React9.useState(false);
|
|
3197
3283
|
const placeholderMap = {
|
|
3198
3284
|
date: "Select date",
|
|
3199
3285
|
datetime: "Select date & time",
|
|
@@ -3212,7 +3298,7 @@ function DateTimePicker({
|
|
|
3212
3298
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
3213
3299
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
3214
3300
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
3215
|
-
const [date, setDate] =
|
|
3301
|
+
const [date, setDate] = React9.useState(() => {
|
|
3216
3302
|
if (props.value) {
|
|
3217
3303
|
const d = new Date(props.value);
|
|
3218
3304
|
if (!isNaN(d.getTime())) return d;
|
|
@@ -3221,15 +3307,15 @@ function DateTimePicker({
|
|
|
3221
3307
|
});
|
|
3222
3308
|
const initialHours = date ? date.getHours() : 0;
|
|
3223
3309
|
const initialMinutes = date ? date.getMinutes() : 0;
|
|
3224
|
-
const [hours, setHours] =
|
|
3225
|
-
const [minutes, setMinutes] =
|
|
3226
|
-
const [amPm, setAmPm] =
|
|
3227
|
-
const displayHours =
|
|
3310
|
+
const [hours, setHours] = React9.useState(initialHours);
|
|
3311
|
+
const [minutes, setMinutes] = React9.useState(initialMinutes);
|
|
3312
|
+
const [amPm, setAmPm] = React9.useState("AM");
|
|
3313
|
+
const displayHours = React9.useMemo(() => {
|
|
3228
3314
|
if (hours === 0) return 12;
|
|
3229
3315
|
if (hours > 12) return hours - 12;
|
|
3230
3316
|
return hours;
|
|
3231
3317
|
}, [hours]);
|
|
3232
|
-
|
|
3318
|
+
React9.useEffect(() => {
|
|
3233
3319
|
setAmPm(hours >= 12 ? "PM" : "AM");
|
|
3234
3320
|
}, [hours]);
|
|
3235
3321
|
const emitChange = (nextDate) => {
|
|
@@ -3253,7 +3339,7 @@ function DateTimePicker({
|
|
|
3253
3339
|
};
|
|
3254
3340
|
props.onChange(event, props.name || "");
|
|
3255
3341
|
};
|
|
3256
|
-
|
|
3342
|
+
React9.useEffect(() => {
|
|
3257
3343
|
if (!props.value) {
|
|
3258
3344
|
const defaultDate = resolveDefaultDate(defaultDateValue, customDefaultDate);
|
|
3259
3345
|
setDate(defaultDate);
|
|
@@ -3275,8 +3361,8 @@ function DateTimePicker({
|
|
|
3275
3361
|
setMinutes(d.getMinutes());
|
|
3276
3362
|
}
|
|
3277
3363
|
}, [props.value, defaultDateValue, customDefaultDate]);
|
|
3278
|
-
const [year, setYear] =
|
|
3279
|
-
|
|
3364
|
+
const [year, setYear] = React9.useState(date ? date.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear());
|
|
3365
|
+
React9.useEffect(() => {
|
|
3280
3366
|
if (!date) return;
|
|
3281
3367
|
const newDate = new Date(date);
|
|
3282
3368
|
newDate.setFullYear(year);
|
|
@@ -3360,7 +3446,7 @@ function DateTimePicker({
|
|
|
3360
3446
|
for (let y = currentYear - 90; y <= currentYear; y++) {
|
|
3361
3447
|
yearOptions.push(y);
|
|
3362
3448
|
}
|
|
3363
|
-
const displayValue =
|
|
3449
|
+
const displayValue = React9.useMemo(() => {
|
|
3364
3450
|
if (!date) return "";
|
|
3365
3451
|
try {
|
|
3366
3452
|
if (mode === "date") return (0, import_date_fns.format)(date, "dd-MM-yyyy");
|
|
@@ -3371,11 +3457,11 @@ function DateTimePicker({
|
|
|
3371
3457
|
}
|
|
3372
3458
|
}, [date, mode]);
|
|
3373
3459
|
const isInputDisabled = isDisabled || !isEditable;
|
|
3374
|
-
const [calendarMonthState, setCalendarMonthState] =
|
|
3460
|
+
const [calendarMonthState, setCalendarMonthState] = React9.useState(() => {
|
|
3375
3461
|
const currentMonth = (/* @__PURE__ */ new Date()).getMonth();
|
|
3376
3462
|
return date ? new Date(date.getFullYear(), date.getMonth()) : new Date(year, currentMonth);
|
|
3377
3463
|
});
|
|
3378
|
-
|
|
3464
|
+
React9.useEffect(() => {
|
|
3379
3465
|
setCalendarMonthState(new Date(year, calendarMonthState.getMonth()));
|
|
3380
3466
|
}, [year]);
|
|
3381
3467
|
const handleToday = () => {
|
|
@@ -3384,9 +3470,9 @@ function DateTimePicker({
|
|
|
3384
3470
|
updateDateTime(selectedYearDate);
|
|
3385
3471
|
setOpen(false);
|
|
3386
3472
|
};
|
|
3387
|
-
return /* @__PURE__ */ (0,
|
|
3388
|
-
/* @__PURE__ */ (0,
|
|
3389
|
-
/* @__PURE__ */ (0,
|
|
3473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col", children: [
|
|
3474
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
3475
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3390
3476
|
Button,
|
|
3391
3477
|
{
|
|
3392
3478
|
type: "button",
|
|
@@ -3403,10 +3489,10 @@ function DateTimePicker({
|
|
|
3403
3489
|
},
|
|
3404
3490
|
disabled: isInputDisabled,
|
|
3405
3491
|
children: [
|
|
3406
|
-
/* @__PURE__ */ (0,
|
|
3407
|
-
/* @__PURE__ */ (0,
|
|
3408
|
-
displayValue && /* @__PURE__ */ (0,
|
|
3409
|
-
|
|
3492
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lucide_react10.Calendar1Icon, { className: "absolute left-2 top-2" }),
|
|
3493
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "ml-5", children: displayValue || placeholder }),
|
|
3494
|
+
displayValue && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3495
|
+
import_lucide_react10.XSquareIcon,
|
|
3410
3496
|
{
|
|
3411
3497
|
className: "absolute right-2 top-2 cursor-pointer",
|
|
3412
3498
|
role: "presentation",
|
|
@@ -3422,10 +3508,10 @@ function DateTimePicker({
|
|
|
3422
3508
|
]
|
|
3423
3509
|
}
|
|
3424
3510
|
) }),
|
|
3425
|
-
/* @__PURE__ */ (0,
|
|
3426
|
-
(mode === "date" || mode === "datetime") && /* @__PURE__ */ (0,
|
|
3427
|
-
/* @__PURE__ */ (0,
|
|
3428
|
-
/* @__PURE__ */ (0,
|
|
3511
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(PopoverContent, { className: "w-auto text-sm p-2", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
3512
|
+
(mode === "date" || mode === "datetime") && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
3513
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center justify-between gap-1", children: [
|
|
3514
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3429
3515
|
"label",
|
|
3430
3516
|
{
|
|
3431
3517
|
className: "text-xs text-blue-600 font-bold cursor-pointer",
|
|
@@ -3434,18 +3520,18 @@ function DateTimePicker({
|
|
|
3434
3520
|
children: "Today"
|
|
3435
3521
|
}
|
|
3436
3522
|
),
|
|
3437
|
-
/* @__PURE__ */ (0,
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3438
3524
|
"select",
|
|
3439
3525
|
{
|
|
3440
3526
|
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
3441
3527
|
value: year,
|
|
3442
3528
|
onChange: (e) => setYear(Number(e.target.value)),
|
|
3443
3529
|
disabled: isInputDisabled || isReadonly,
|
|
3444
|
-
children: yearOptions.map((y) => /* @__PURE__ */ (0,
|
|
3530
|
+
children: yearOptions.map((y) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: y, children: y }, y))
|
|
3445
3531
|
}
|
|
3446
3532
|
)
|
|
3447
3533
|
] }),
|
|
3448
|
-
/* @__PURE__ */ (0,
|
|
3534
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "calendar-container", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3449
3535
|
Calendar,
|
|
3450
3536
|
{
|
|
3451
3537
|
mode: "single",
|
|
@@ -3463,20 +3549,20 @@ function DateTimePicker({
|
|
|
3463
3549
|
}
|
|
3464
3550
|
) })
|
|
3465
3551
|
] }),
|
|
3466
|
-
(mode === "time" || mode === "datetime") && /* @__PURE__ */ (0,
|
|
3467
|
-
/* @__PURE__ */ (0,
|
|
3468
|
-
/* @__PURE__ */ (0,
|
|
3552
|
+
(mode === "time" || mode === "datetime") && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-2 mt-0", children: [
|
|
3553
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { className: "text-xs text-muted-foreground", children: "Time" }),
|
|
3554
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3469
3555
|
"select",
|
|
3470
3556
|
{
|
|
3471
3557
|
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
3472
3558
|
value: displayHours,
|
|
3473
3559
|
onChange: handleHoursChange,
|
|
3474
3560
|
disabled: isInputDisabled || isReadonly,
|
|
3475
|
-
children: Array.from({ length: 12 }, (_, i) => i + 1).map((hour) => /* @__PURE__ */ (0,
|
|
3561
|
+
children: Array.from({ length: 12 }, (_, i) => i + 1).map((hour) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: hour, children: hour.toString().padStart(2, "0") }, hour))
|
|
3476
3562
|
}
|
|
3477
3563
|
),
|
|
3478
|
-
/* @__PURE__ */ (0,
|
|
3479
|
-
/* @__PURE__ */ (0,
|
|
3564
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-sm", children: ":" }),
|
|
3565
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3480
3566
|
"select",
|
|
3481
3567
|
{
|
|
3482
3568
|
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
@@ -3485,11 +3571,11 @@ function DateTimePicker({
|
|
|
3485
3571
|
disabled: isInputDisabled || isReadonly,
|
|
3486
3572
|
children: Array.from({ length: 12 }).map((_, i) => {
|
|
3487
3573
|
const val = i * 5;
|
|
3488
|
-
return /* @__PURE__ */ (0,
|
|
3574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: val, children: val.toString().padStart(2, "0") }, val);
|
|
3489
3575
|
})
|
|
3490
3576
|
}
|
|
3491
3577
|
),
|
|
3492
|
-
/* @__PURE__ */ (0,
|
|
3578
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3493
3579
|
"select",
|
|
3494
3580
|
{
|
|
3495
3581
|
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
@@ -3497,15 +3583,15 @@ function DateTimePicker({
|
|
|
3497
3583
|
onChange: handleAmPmChange,
|
|
3498
3584
|
disabled: isInputDisabled || isReadonly,
|
|
3499
3585
|
children: [
|
|
3500
|
-
/* @__PURE__ */ (0,
|
|
3501
|
-
/* @__PURE__ */ (0,
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: "AM", children: "AM" }),
|
|
3587
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: "PM", children: "PM" })
|
|
3502
3588
|
]
|
|
3503
3589
|
}
|
|
3504
3590
|
)
|
|
3505
3591
|
] })
|
|
3506
3592
|
] }) })
|
|
3507
3593
|
] }),
|
|
3508
|
-
/* @__PURE__ */ (0,
|
|
3594
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3509
3595
|
Input,
|
|
3510
3596
|
{
|
|
3511
3597
|
type: "hidden",
|
|
@@ -3518,23 +3604,23 @@ function DateTimePicker({
|
|
|
3518
3604
|
}
|
|
3519
3605
|
}
|
|
3520
3606
|
),
|
|
3521
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
3607
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
3522
3608
|
] });
|
|
3523
3609
|
}
|
|
3524
3610
|
|
|
3525
3611
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
3526
|
-
var
|
|
3612
|
+
var import_react29 = __toESM(require("react"));
|
|
3527
3613
|
var import_date_fns2 = require("date-fns");
|
|
3528
|
-
var
|
|
3614
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3529
3615
|
var DateRange = ({ className, style, ...props }) => {
|
|
3530
3616
|
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
3531
|
-
const [date, setDate] =
|
|
3617
|
+
const [date, setDate] = import_react29.default.useState(
|
|
3532
3618
|
isDateRange(props.value) ? props.value : {
|
|
3533
3619
|
from: /* @__PURE__ */ new Date(),
|
|
3534
3620
|
to: (0, import_date_fns2.addDays)(/* @__PURE__ */ new Date(), 7)
|
|
3535
3621
|
}
|
|
3536
3622
|
);
|
|
3537
|
-
(0,
|
|
3623
|
+
(0, import_react29.useEffect)(() => {
|
|
3538
3624
|
if (props.value && isDateRange(props.value)) {
|
|
3539
3625
|
handleChange?.(props.value);
|
|
3540
3626
|
}
|
|
@@ -3545,9 +3631,9 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
3545
3631
|
props.onChange?.(value, props?.name || "");
|
|
3546
3632
|
}
|
|
3547
3633
|
};
|
|
3548
|
-
return /* @__PURE__ */ (0,
|
|
3549
|
-
/* @__PURE__ */ (0,
|
|
3550
|
-
/* @__PURE__ */ (0,
|
|
3634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
3635
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Popover, { children: [
|
|
3636
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3551
3637
|
Button,
|
|
3552
3638
|
{
|
|
3553
3639
|
id: "date",
|
|
@@ -3556,15 +3642,15 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
3556
3642
|
"w-full justify-start text-left font-normal text-[11px] border-[#BDBDBD]",
|
|
3557
3643
|
!date && "text-muted-foreground"
|
|
3558
3644
|
),
|
|
3559
|
-
children: date?.from ? date.to ? /* @__PURE__ */ (0,
|
|
3645
|
+
children: date?.from ? date.to ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
3560
3646
|
(0, import_date_fns2.format)(date.from, "LLL dd, y"),
|
|
3561
3647
|
" -",
|
|
3562
3648
|
" ",
|
|
3563
3649
|
(0, import_date_fns2.format)(date.to, "LLL dd, y")
|
|
3564
|
-
] }) : (0, import_date_fns2.format)(date.from, "LLL dd, y") : /* @__PURE__ */ (0,
|
|
3650
|
+
] }) : (0, import_date_fns2.format)(date.from, "LLL dd, y") : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Pick a date range" })
|
|
3565
3651
|
}
|
|
3566
3652
|
) }),
|
|
3567
|
-
/* @__PURE__ */ (0,
|
|
3653
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3568
3654
|
Calendar,
|
|
3569
3655
|
{
|
|
3570
3656
|
mode: "range",
|
|
@@ -3575,21 +3661,21 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
3575
3661
|
}
|
|
3576
3662
|
) })
|
|
3577
3663
|
] }) }),
|
|
3578
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
3664
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
3579
3665
|
] });
|
|
3580
3666
|
};
|
|
3581
3667
|
var DateRange_default = DateRange;
|
|
3582
3668
|
|
|
3583
3669
|
// src/components/Inputs/TextInputGroup/TextInputGroup.tsx
|
|
3584
|
-
var
|
|
3585
|
-
var
|
|
3670
|
+
var import_react30 = require("react");
|
|
3671
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3586
3672
|
var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
3587
3673
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
3588
3674
|
const isEditable = props.isEditable ?? true;
|
|
3589
3675
|
const isDisabled = props.isDisabled ?? false;
|
|
3590
3676
|
const isReadonly = props.isReadonly ?? false;
|
|
3591
3677
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
3592
|
-
(0,
|
|
3678
|
+
(0, import_react30.useEffect)(() => {
|
|
3593
3679
|
if (props.value !== void 0) {
|
|
3594
3680
|
const e = { target: { value: props.value }, type: "change" };
|
|
3595
3681
|
handleChange?.(e);
|
|
@@ -3598,8 +3684,8 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
3598
3684
|
const handleChange = (e) => {
|
|
3599
3685
|
props.onChange?.(e, props?.name || "");
|
|
3600
3686
|
};
|
|
3601
|
-
return /* @__PURE__ */ (0,
|
|
3602
|
-
/* @__PURE__ */ (0,
|
|
3687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
3688
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3603
3689
|
"div",
|
|
3604
3690
|
{
|
|
3605
3691
|
className: cn(
|
|
@@ -3609,8 +3695,8 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
3609
3695
|
props.errorMessage ? "border-red-500" : ""
|
|
3610
3696
|
),
|
|
3611
3697
|
children: [
|
|
3612
|
-
prepend && /* @__PURE__ */ (0,
|
|
3613
|
-
/* @__PURE__ */ (0,
|
|
3698
|
+
prepend && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "px-3 flex items-center bg-gray-500 text-white h-10 rounded-l-md", children: prepend }),
|
|
3699
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3614
3700
|
Input,
|
|
3615
3701
|
{
|
|
3616
3702
|
id: props.name || "prepend-input",
|
|
@@ -3632,19 +3718,19 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
3632
3718
|
readOnly: isReadonly
|
|
3633
3719
|
}
|
|
3634
3720
|
),
|
|
3635
|
-
append && /* @__PURE__ */ (0,
|
|
3721
|
+
append && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "px-3 flex items-center bg-gray-500 text-white h-10 rounded-r-md", children: append })
|
|
3636
3722
|
]
|
|
3637
3723
|
}
|
|
3638
3724
|
),
|
|
3639
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
3725
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
3640
3726
|
] });
|
|
3641
3727
|
};
|
|
3642
3728
|
var TextInputGroup_default = TextInputGroup;
|
|
3643
3729
|
|
|
3644
3730
|
// src/components/Inputs/Multiselect/MultiSelect.tsx
|
|
3645
|
-
var
|
|
3646
|
-
var
|
|
3647
|
-
var
|
|
3731
|
+
var import_react31 = require("react");
|
|
3732
|
+
var import_lucide_react11 = require("lucide-react");
|
|
3733
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3648
3734
|
function LazyMultiSelectDropdown({
|
|
3649
3735
|
value = [],
|
|
3650
3736
|
onChange,
|
|
@@ -3662,10 +3748,10 @@ function LazyMultiSelectDropdown({
|
|
|
3662
3748
|
outputFormat = "array",
|
|
3663
3749
|
...props
|
|
3664
3750
|
}) {
|
|
3665
|
-
const [isOpen, setIsOpen] = (0,
|
|
3666
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
3667
|
-
const dropdownRef = (0,
|
|
3668
|
-
const observerTarget = (0,
|
|
3751
|
+
const [isOpen, setIsOpen] = (0, import_react31.useState)(false);
|
|
3752
|
+
const [searchTerm, setSearchTerm] = (0, import_react31.useState)("");
|
|
3753
|
+
const dropdownRef = (0, import_react31.useRef)(null);
|
|
3754
|
+
const observerTarget = (0, import_react31.useRef)(null);
|
|
3669
3755
|
const ensureUnique = (arr) => {
|
|
3670
3756
|
return Array.from(new Set(arr));
|
|
3671
3757
|
};
|
|
@@ -3714,14 +3800,14 @@ function LazyMultiSelectDropdown({
|
|
|
3714
3800
|
return unique;
|
|
3715
3801
|
}
|
|
3716
3802
|
};
|
|
3717
|
-
const selectedOptions = (0,
|
|
3803
|
+
const selectedOptions = (0, import_react31.useMemo)(() => {
|
|
3718
3804
|
return normalizedValue.map((id) => {
|
|
3719
3805
|
const fromLazy = lazyOptions.find((opt) => opt.value === id);
|
|
3720
3806
|
if (fromLazy) return fromLazy;
|
|
3721
3807
|
return { value: id, label: id };
|
|
3722
3808
|
});
|
|
3723
3809
|
}, [normalizedValue, lazyOptions]);
|
|
3724
|
-
(0,
|
|
3810
|
+
(0, import_react31.useEffect)(() => {
|
|
3725
3811
|
const handleClick = (e) => {
|
|
3726
3812
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
3727
3813
|
setIsOpen(false);
|
|
@@ -3730,7 +3816,7 @@ function LazyMultiSelectDropdown({
|
|
|
3730
3816
|
document.addEventListener("mousedown", handleClick);
|
|
3731
3817
|
return () => document.removeEventListener("mousedown", handleClick);
|
|
3732
3818
|
}, []);
|
|
3733
|
-
(0,
|
|
3819
|
+
(0, import_react31.useEffect)(() => {
|
|
3734
3820
|
if (!isOpen || !hasMore || loading) return;
|
|
3735
3821
|
const obs = new IntersectionObserver(
|
|
3736
3822
|
(entries) => {
|
|
@@ -3767,8 +3853,8 @@ function LazyMultiSelectDropdown({
|
|
|
3767
3853
|
}
|
|
3768
3854
|
}
|
|
3769
3855
|
};
|
|
3770
|
-
return /* @__PURE__ */ (0,
|
|
3771
|
-
/* @__PURE__ */ (0,
|
|
3856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { ref: dropdownRef, className: "relative w-full", children: [
|
|
3857
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3772
3858
|
"div",
|
|
3773
3859
|
{
|
|
3774
3860
|
onClick: handleFocus,
|
|
@@ -3780,13 +3866,13 @@ function LazyMultiSelectDropdown({
|
|
|
3780
3866
|
"px-2 py-2 min-h-[35px]"
|
|
3781
3867
|
),
|
|
3782
3868
|
children: [
|
|
3783
|
-
selectedOptions.map((opt) => /* @__PURE__ */ (0,
|
|
3869
|
+
selectedOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3784
3870
|
"span",
|
|
3785
3871
|
{
|
|
3786
3872
|
className: "bg-blue-100 text-blue-700 px-2 py-1 rounded-md text-xs flex items-center gap-1",
|
|
3787
3873
|
children: [
|
|
3788
3874
|
opt.label,
|
|
3789
|
-
!disabled && !readOnly && /* @__PURE__ */ (0,
|
|
3875
|
+
!disabled && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3790
3876
|
"button",
|
|
3791
3877
|
{
|
|
3792
3878
|
type: "button",
|
|
@@ -3795,14 +3881,14 @@ function LazyMultiSelectDropdown({
|
|
|
3795
3881
|
removeTag(opt.value);
|
|
3796
3882
|
},
|
|
3797
3883
|
className: "hover:text-red-600",
|
|
3798
|
-
children: /* @__PURE__ */ (0,
|
|
3884
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react11.XIcon, { size: 12 })
|
|
3799
3885
|
}
|
|
3800
3886
|
)
|
|
3801
3887
|
]
|
|
3802
3888
|
},
|
|
3803
3889
|
opt.value
|
|
3804
3890
|
)),
|
|
3805
|
-
/* @__PURE__ */ (0,
|
|
3891
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3806
3892
|
"input",
|
|
3807
3893
|
{
|
|
3808
3894
|
type: "text",
|
|
@@ -3818,8 +3904,8 @@ function LazyMultiSelectDropdown({
|
|
|
3818
3904
|
]
|
|
3819
3905
|
}
|
|
3820
3906
|
),
|
|
3821
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
3822
|
-
isOpen && !disabled && /* @__PURE__ */ (0,
|
|
3907
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "mt-1 text-xs text-red-500", children: errorMessage }),
|
|
3908
|
+
isOpen && !disabled && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3823
3909
|
"div",
|
|
3824
3910
|
{
|
|
3825
3911
|
onMouseDown: (e) => e.stopPropagation(),
|
|
@@ -3830,10 +3916,10 @@ function LazyMultiSelectDropdown({
|
|
|
3830
3916
|
top: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().bottom + window.scrollY : 0,
|
|
3831
3917
|
left: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().left + window.scrollX : 0
|
|
3832
3918
|
},
|
|
3833
|
-
children: dataLoading && lazyOptions.length === 0 ? /* @__PURE__ */ (0,
|
|
3919
|
+
children: dataLoading && lazyOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "px-3 py-3 text-center text-gray-500", children: "Loading..." }) : lazyOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
3834
3920
|
lazyOptions.map((option) => {
|
|
3835
3921
|
const isSelected = normalizedValue.includes(option.value);
|
|
3836
|
-
return /* @__PURE__ */ (0,
|
|
3922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3837
3923
|
"div",
|
|
3838
3924
|
{
|
|
3839
3925
|
onClick: () => toggleSelect(option.value),
|
|
@@ -3843,13 +3929,13 @@ function LazyMultiSelectDropdown({
|
|
|
3843
3929
|
),
|
|
3844
3930
|
children: [
|
|
3845
3931
|
option.label,
|
|
3846
|
-
isSelected && /* @__PURE__ */ (0,
|
|
3932
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react11.XSquareIcon, { size: 16 })
|
|
3847
3933
|
]
|
|
3848
3934
|
},
|
|
3849
3935
|
option.value
|
|
3850
3936
|
);
|
|
3851
3937
|
}),
|
|
3852
|
-
hasMore && /* @__PURE__ */ (0,
|
|
3938
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3853
3939
|
"div",
|
|
3854
3940
|
{
|
|
3855
3941
|
ref: observerTarget,
|
|
@@ -3857,29 +3943,29 @@ function LazyMultiSelectDropdown({
|
|
|
3857
3943
|
children: loading ? "Loading\u2026" : "Scroll for more\u2026"
|
|
3858
3944
|
}
|
|
3859
3945
|
)
|
|
3860
|
-
] }) : /* @__PURE__ */ (0,
|
|
3946
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "px-3 py-3 text-center text-gray-500", children: "No results" })
|
|
3861
3947
|
}
|
|
3862
3948
|
) })
|
|
3863
3949
|
] });
|
|
3864
3950
|
}
|
|
3865
3951
|
|
|
3866
3952
|
// src/components/ui/data-table.tsx
|
|
3867
|
-
var
|
|
3953
|
+
var React12 = __toESM(require("react"));
|
|
3868
3954
|
var import_free_solid_svg_icons2 = require("@fortawesome/free-solid-svg-icons");
|
|
3869
3955
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
3870
3956
|
var import_react_table2 = require("@tanstack/react-table");
|
|
3871
3957
|
var import_axios3 = __toESM(require("axios"));
|
|
3872
|
-
var
|
|
3958
|
+
var import_lucide_react13 = require("lucide-react");
|
|
3873
3959
|
|
|
3874
3960
|
// src/components/ui/table.tsx
|
|
3875
|
-
var
|
|
3961
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3876
3962
|
function Table({ className, ...props }) {
|
|
3877
|
-
return /* @__PURE__ */ (0,
|
|
3963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3878
3964
|
"div",
|
|
3879
3965
|
{
|
|
3880
3966
|
"data-slot": "table-container",
|
|
3881
3967
|
className: "relative w-full overflow-x-auto rounded-md border border-gray-200 bg-white",
|
|
3882
|
-
children: /* @__PURE__ */ (0,
|
|
3968
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3883
3969
|
"table",
|
|
3884
3970
|
{
|
|
3885
3971
|
"data-slot": "table",
|
|
@@ -3891,7 +3977,7 @@ function Table({ className, ...props }) {
|
|
|
3891
3977
|
);
|
|
3892
3978
|
}
|
|
3893
3979
|
function TableHeader({ className, ...props }) {
|
|
3894
|
-
return /* @__PURE__ */ (0,
|
|
3980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3895
3981
|
"thead",
|
|
3896
3982
|
{
|
|
3897
3983
|
"data-slot": "table-header",
|
|
@@ -3904,7 +3990,7 @@ function TableHeader({ className, ...props }) {
|
|
|
3904
3990
|
);
|
|
3905
3991
|
}
|
|
3906
3992
|
function TableBody({ className, ...props }) {
|
|
3907
|
-
return /* @__PURE__ */ (0,
|
|
3993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3908
3994
|
"tbody",
|
|
3909
3995
|
{
|
|
3910
3996
|
"data-slot": "table-body",
|
|
@@ -3917,7 +4003,7 @@ function TableBody({ className, ...props }) {
|
|
|
3917
4003
|
);
|
|
3918
4004
|
}
|
|
3919
4005
|
function TableRow({ className, ...props }) {
|
|
3920
|
-
return /* @__PURE__ */ (0,
|
|
4006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3921
4007
|
"tr",
|
|
3922
4008
|
{
|
|
3923
4009
|
"data-slot": "table-row",
|
|
@@ -3930,7 +4016,7 @@ function TableRow({ className, ...props }) {
|
|
|
3930
4016
|
);
|
|
3931
4017
|
}
|
|
3932
4018
|
function TableHead({ className, ...props }) {
|
|
3933
|
-
return /* @__PURE__ */ (0,
|
|
4019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3934
4020
|
"th",
|
|
3935
4021
|
{
|
|
3936
4022
|
"data-slot": "table-head",
|
|
@@ -3943,7 +4029,7 @@ function TableHead({ className, ...props }) {
|
|
|
3943
4029
|
);
|
|
3944
4030
|
}
|
|
3945
4031
|
function TableCell({ className, ...props }) {
|
|
3946
|
-
return /* @__PURE__ */ (0,
|
|
4032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3947
4033
|
"td",
|
|
3948
4034
|
{
|
|
3949
4035
|
"data-slot": "table-cell",
|
|
@@ -3960,11 +4046,11 @@ function TableCell({ className, ...props }) {
|
|
|
3960
4046
|
var import_react_table = require("@tanstack/react-table");
|
|
3961
4047
|
|
|
3962
4048
|
// src/lib/table/cellRendererFactory.tsx
|
|
3963
|
-
var
|
|
4049
|
+
var import_react32 = __toESM(require("react"));
|
|
3964
4050
|
var LucideIcons2 = __toESM(require("lucide-react"));
|
|
3965
|
-
var
|
|
4051
|
+
var import_lucide_react12 = require("lucide-react");
|
|
3966
4052
|
var import_image = __toESM(require("next/image"));
|
|
3967
|
-
var
|
|
4053
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3968
4054
|
var getContrastColor = (bg) => {
|
|
3969
4055
|
let c = bg.trim().toUpperCase();
|
|
3970
4056
|
if (/^#([a-fA-F0-9]{3})$/.test(c)) {
|
|
@@ -3998,9 +4084,9 @@ var getContrastColor = (bg) => {
|
|
|
3998
4084
|
};
|
|
3999
4085
|
var sanitizeValue = (val) => {
|
|
4000
4086
|
if (val == null) return null;
|
|
4001
|
-
if (
|
|
4087
|
+
if (import_react32.default.isValidElement(val)) return val;
|
|
4002
4088
|
if (typeof val === "string" || typeof val === "number") return val;
|
|
4003
|
-
if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ (0,
|
|
4089
|
+
if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react32.default.Fragment, { children: sanitizeValue(v) }, i));
|
|
4004
4090
|
if (typeof val === "object") {
|
|
4005
4091
|
if ("name" in val && typeof val.name === "string") return val.name;
|
|
4006
4092
|
if ("label" in val && typeof val.label === "string") return val.label;
|
|
@@ -4018,13 +4104,13 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4018
4104
|
switch (renderer) {
|
|
4019
4105
|
/* -------------------- BASIC -------------------- */
|
|
4020
4106
|
case "text":
|
|
4021
|
-
return /* @__PURE__ */ (0,
|
|
4107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: rowValue || formattedValue });
|
|
4022
4108
|
case "number":
|
|
4023
|
-
return /* @__PURE__ */ (0,
|
|
4109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "tabular-nums text-right", children: valueFormatter(rowValue || value, "number:2") });
|
|
4024
4110
|
case "date":
|
|
4025
|
-
return /* @__PURE__ */ (0,
|
|
4111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: valueFormatter(rowValue || value, format3) });
|
|
4026
4112
|
case "link":
|
|
4027
|
-
return /* @__PURE__ */ (0,
|
|
4113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4028
4114
|
"a",
|
|
4029
4115
|
{
|
|
4030
4116
|
href: `${rendererProps?.prefix || ""}${rowValue || formattedValue}`,
|
|
@@ -4036,7 +4122,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4036
4122
|
);
|
|
4037
4123
|
/* -------------------- VISUAL -------------------- */
|
|
4038
4124
|
case "image":
|
|
4039
|
-
return /* @__PURE__ */ (0,
|
|
4125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4040
4126
|
import_image.default,
|
|
4041
4127
|
{
|
|
4042
4128
|
src: rowValue || formattedValue || rendererProps?.fallback || "/placeholder.png",
|
|
@@ -4052,7 +4138,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4052
4138
|
) });
|
|
4053
4139
|
case "icon":
|
|
4054
4140
|
if (!formattedValue) return null;
|
|
4055
|
-
return /* @__PURE__ */ (0,
|
|
4141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4056
4142
|
Icon,
|
|
4057
4143
|
{
|
|
4058
4144
|
iconSet: rendererProps?.iconSet,
|
|
@@ -4069,7 +4155,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4069
4155
|
const color = rendererProps?.colorMap?.[formattedValue] || rendererProps?.color || "gray";
|
|
4070
4156
|
if (!formattedValue) return null;
|
|
4071
4157
|
const textColor = getContrastColor(color);
|
|
4072
|
-
return /* @__PURE__ */ (0,
|
|
4158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4073
4159
|
"span",
|
|
4074
4160
|
{
|
|
4075
4161
|
className: `inline-block px-2 py-1 text-xs rounded-full bg-${color}-100 text-${textColor}-700 ${rendererProps?.className || ""}`,
|
|
@@ -4084,13 +4170,13 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4084
4170
|
const IconComponent = typeof maybeIcon === "function" ? maybeIcon : LucideIcons2.Star;
|
|
4085
4171
|
if (!formattedValue) return null;
|
|
4086
4172
|
const textColor = getContrastColor(color);
|
|
4087
|
-
return /* @__PURE__ */ (0,
|
|
4173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
4088
4174
|
"span",
|
|
4089
4175
|
{
|
|
4090
4176
|
className: `inline-flex items-center gap-1 px-2 py-1 text-xs rounded-full bg-[${color}]-100 text-[${textColor}]-700`,
|
|
4091
4177
|
style: { backgroundColor: color, color: textColor },
|
|
4092
4178
|
children: [
|
|
4093
|
-
rendererProps?.icon && /* @__PURE__ */ (0,
|
|
4179
|
+
rendererProps?.icon && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: IconComponent ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(IconComponent, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(LucideIcons2.Box, { className: "h-4 w-4" }) }),
|
|
4094
4180
|
formattedValue
|
|
4095
4181
|
]
|
|
4096
4182
|
}
|
|
@@ -4098,7 +4184,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4098
4184
|
}
|
|
4099
4185
|
/* -------------------- INTERACTIVE -------------------- */
|
|
4100
4186
|
case "button":
|
|
4101
|
-
return /* @__PURE__ */ (0,
|
|
4187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4102
4188
|
"button",
|
|
4103
4189
|
{
|
|
4104
4190
|
onClick: () => rendererProps?.onClick?.(row, formattedValue),
|
|
@@ -4107,8 +4193,8 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4107
4193
|
}
|
|
4108
4194
|
);
|
|
4109
4195
|
case "switch":
|
|
4110
|
-
return /* @__PURE__ */ (0,
|
|
4111
|
-
/* @__PURE__ */ (0,
|
|
4196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "inline-flex items-center cursor-pointer", children: [
|
|
4197
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4112
4198
|
"input",
|
|
4113
4199
|
{
|
|
4114
4200
|
type: "checkbox",
|
|
@@ -4117,10 +4203,10 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4117
4203
|
className: "sr-only peer"
|
|
4118
4204
|
}
|
|
4119
4205
|
),
|
|
4120
|
-
/* @__PURE__ */ (0,
|
|
4206
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "relative w-9 h-5 bg-gray-300 peer-checked:bg-blue-600 rounded-full transition-all", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "absolute top-[2px] left-[2px] w-4 h-4 bg-white rounded-full peer-checked:translate-x-4 transition-all" }) })
|
|
4121
4207
|
] });
|
|
4122
4208
|
case "progress":
|
|
4123
|
-
return /* @__PURE__ */ (0,
|
|
4209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "w-full bg-gray-100 rounded-full h-2", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4124
4210
|
"div",
|
|
4125
4211
|
{
|
|
4126
4212
|
className: "bg-blue-600 h-2 rounded-full transition-all",
|
|
@@ -4129,8 +4215,8 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4129
4215
|
) });
|
|
4130
4216
|
case "rating": {
|
|
4131
4217
|
const stars = Math.round(Number(rowValue || formattedValue) || 0);
|
|
4132
|
-
return /* @__PURE__ */ (0,
|
|
4133
|
-
|
|
4218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex items-center", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4219
|
+
import_lucide_react12.Star,
|
|
4134
4220
|
{
|
|
4135
4221
|
size: 16,
|
|
4136
4222
|
className: i < stars ? "text-yellow-400" : "text-gray-300",
|
|
@@ -4140,7 +4226,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4140
4226
|
)) });
|
|
4141
4227
|
}
|
|
4142
4228
|
case "checkbox":
|
|
4143
|
-
return /* @__PURE__ */ (0,
|
|
4229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4144
4230
|
"input",
|
|
4145
4231
|
{
|
|
4146
4232
|
type: "checkbox",
|
|
@@ -4150,7 +4236,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4150
4236
|
}
|
|
4151
4237
|
);
|
|
4152
4238
|
case "html":
|
|
4153
|
-
return /* @__PURE__ */ (0,
|
|
4239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4154
4240
|
"span",
|
|
4155
4241
|
{
|
|
4156
4242
|
dangerouslySetInnerHTML: { __html: String(rowValue || formattedValue) }
|
|
@@ -4160,7 +4246,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4160
4246
|
case "custom": {
|
|
4161
4247
|
const CustomRenderer = customRenderers[rendererProps?.customRendererId] || customRenderers[rendererProps?.rendererId];
|
|
4162
4248
|
if (CustomRenderer)
|
|
4163
|
-
return /* @__PURE__ */ (0,
|
|
4249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4164
4250
|
CustomRenderer,
|
|
4165
4251
|
{
|
|
4166
4252
|
value: formattedValue,
|
|
@@ -4168,11 +4254,11 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4168
4254
|
...rendererProps
|
|
4169
4255
|
}
|
|
4170
4256
|
);
|
|
4171
|
-
return /* @__PURE__ */ (0,
|
|
4257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Missing custom renderer" });
|
|
4172
4258
|
}
|
|
4173
4259
|
/* -------------------- DEFAULT -------------------- */
|
|
4174
4260
|
default:
|
|
4175
|
-
return /* @__PURE__ */ (0,
|
|
4261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: formattedValue || "-" });
|
|
4176
4262
|
}
|
|
4177
4263
|
};
|
|
4178
4264
|
|
|
@@ -4236,7 +4322,7 @@ var useDynamicColumns = (config, customRenderers = {}, customFormatters = {}) =>
|
|
|
4236
4322
|
};
|
|
4237
4323
|
|
|
4238
4324
|
// src/components/ui/data-table.tsx
|
|
4239
|
-
var
|
|
4325
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4240
4326
|
function DataTable({
|
|
4241
4327
|
columns,
|
|
4242
4328
|
data,
|
|
@@ -4263,13 +4349,13 @@ function DataTable({
|
|
|
4263
4349
|
enableTotalRecords,
|
|
4264
4350
|
getRowCount
|
|
4265
4351
|
}) {
|
|
4266
|
-
const [columnFilters, setColumnFilters] =
|
|
4267
|
-
const [columnVisibility, setColumnVisibility] =
|
|
4268
|
-
const hasLoadedInitialState =
|
|
4269
|
-
const isSavingRef =
|
|
4270
|
-
const isFetchingRef =
|
|
4271
|
-
const [fetchLoading, setFetchLoading] =
|
|
4272
|
-
const transformApiToFrontend =
|
|
4352
|
+
const [columnFilters, setColumnFilters] = React12.useState([]);
|
|
4353
|
+
const [columnVisibility, setColumnVisibility] = React12.useState({});
|
|
4354
|
+
const hasLoadedInitialState = React12.useRef(false);
|
|
4355
|
+
const isSavingRef = React12.useRef(false);
|
|
4356
|
+
const isFetchingRef = React12.useRef(false);
|
|
4357
|
+
const [fetchLoading, setFetchLoading] = React12.useState(false);
|
|
4358
|
+
const transformApiToFrontend = React12.useCallback((apiSettings, allColumnIds) => {
|
|
4273
4359
|
if (!apiSettings || !apiSettings.columns || !apiSettings.columns.visible) {
|
|
4274
4360
|
return {};
|
|
4275
4361
|
}
|
|
@@ -4280,7 +4366,7 @@ function DataTable({
|
|
|
4280
4366
|
});
|
|
4281
4367
|
return result;
|
|
4282
4368
|
}, []);
|
|
4283
|
-
const transformFrontendToApi =
|
|
4369
|
+
const transformFrontendToApi = React12.useCallback((visibility) => {
|
|
4284
4370
|
const visibleColumns = Object.keys(visibility).filter((colId) => visibility[colId] === true);
|
|
4285
4371
|
return {
|
|
4286
4372
|
columns: {
|
|
@@ -4288,7 +4374,7 @@ function DataTable({
|
|
|
4288
4374
|
}
|
|
4289
4375
|
};
|
|
4290
4376
|
}, []);
|
|
4291
|
-
const fetchColumnPreferences =
|
|
4377
|
+
const fetchColumnPreferences = React12.useCallback(async () => {
|
|
4292
4378
|
if (isFetchingRef.current) {
|
|
4293
4379
|
return;
|
|
4294
4380
|
}
|
|
@@ -4348,7 +4434,7 @@ function DataTable({
|
|
|
4348
4434
|
isFetchingRef.current = false;
|
|
4349
4435
|
}
|
|
4350
4436
|
}, [tableId, transformApiToFrontend, manageColumns]);
|
|
4351
|
-
const saveColumnPreferences =
|
|
4437
|
+
const saveColumnPreferences = React12.useCallback(async (visibility) => {
|
|
4352
4438
|
if (!tableId || isSavingRef.current || !manageColumns) {
|
|
4353
4439
|
return;
|
|
4354
4440
|
}
|
|
@@ -4374,7 +4460,7 @@ function DataTable({
|
|
|
4374
4460
|
isSavingRef.current = false;
|
|
4375
4461
|
}
|
|
4376
4462
|
}, [tableId, transformFrontendToApi, manageColumns]);
|
|
4377
|
-
|
|
4463
|
+
React12.useEffect(() => {
|
|
4378
4464
|
if (hasLoadedInitialState.current || isFetchingRef.current) {
|
|
4379
4465
|
return;
|
|
4380
4466
|
}
|
|
@@ -4385,10 +4471,10 @@ function DataTable({
|
|
|
4385
4471
|
fetchColumnPreferences();
|
|
4386
4472
|
}
|
|
4387
4473
|
}, [tableId, manageColumns]);
|
|
4388
|
-
const [manualSort, setManualSort] =
|
|
4389
|
-
const [searchTerm, setSearchTerm] =
|
|
4474
|
+
const [manualSort, setManualSort] = React12.useState(null);
|
|
4475
|
+
const [searchTerm, setSearchTerm] = React12.useState("");
|
|
4390
4476
|
const tableData = Array.isArray(data) ? data : [];
|
|
4391
|
-
const filteredData =
|
|
4477
|
+
const filteredData = React12.useMemo(() => {
|
|
4392
4478
|
if (paginationMode === "client" && globalSearch && searchTerm.trim()) {
|
|
4393
4479
|
const searchLower = searchTerm.toLowerCase().trim();
|
|
4394
4480
|
return tableData.filter((row) => {
|
|
@@ -4411,7 +4497,7 @@ function DataTable({
|
|
|
4411
4497
|
id: "__select__",
|
|
4412
4498
|
renderer: "checkbox",
|
|
4413
4499
|
size: 40,
|
|
4414
|
-
header: ({ table: table2 }) => /* @__PURE__ */ (0,
|
|
4500
|
+
header: ({ table: table2 }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4415
4501
|
"input",
|
|
4416
4502
|
{
|
|
4417
4503
|
type: "checkbox",
|
|
@@ -4429,12 +4515,12 @@ function DataTable({
|
|
|
4429
4515
|
});
|
|
4430
4516
|
}
|
|
4431
4517
|
const dynamicCols = useDynamicColumns({ columns: finalCols, enableRowSelection });
|
|
4432
|
-
const [rowSelection, setRowSelection] =
|
|
4433
|
-
const [localPageSize, setLocalPageSize] =
|
|
4434
|
-
const [localPageIndex, setLocalPageIndex] =
|
|
4435
|
-
const isUpdatingPageSizeRef =
|
|
4436
|
-
const tableRef =
|
|
4437
|
-
|
|
4518
|
+
const [rowSelection, setRowSelection] = React12.useState({});
|
|
4519
|
+
const [localPageSize, setLocalPageSize] = React12.useState(pageSize);
|
|
4520
|
+
const [localPageIndex, setLocalPageIndex] = React12.useState(0);
|
|
4521
|
+
const isUpdatingPageSizeRef = React12.useRef(false);
|
|
4522
|
+
const tableRef = React12.useRef(null);
|
|
4523
|
+
React12.useEffect(() => {
|
|
4438
4524
|
if (paginationMode === "client") {
|
|
4439
4525
|
setLocalPageSize(pageSize);
|
|
4440
4526
|
} else if (paginationMode === "server" && meta?.limit != null) {
|
|
@@ -4510,7 +4596,7 @@ function DataTable({
|
|
|
4510
4596
|
}
|
|
4511
4597
|
}
|
|
4512
4598
|
});
|
|
4513
|
-
|
|
4599
|
+
React12.useEffect(() => {
|
|
4514
4600
|
tableRef.current = table;
|
|
4515
4601
|
if (table && !hasLoadedInitialState.current && !isFetchingRef.current && tableId) {
|
|
4516
4602
|
fetchColumnPreferences();
|
|
@@ -4548,7 +4634,7 @@ function DataTable({
|
|
|
4548
4634
|
setLocalPageIndex(0);
|
|
4549
4635
|
}
|
|
4550
4636
|
};
|
|
4551
|
-
const pageSizeOptions =
|
|
4637
|
+
const pageSizeOptions = React12.useMemo(() => {
|
|
4552
4638
|
if (paginationMode === "client") {
|
|
4553
4639
|
return [5, 10, 20, 50, 100];
|
|
4554
4640
|
}
|
|
@@ -4559,10 +4645,10 @@ function DataTable({
|
|
|
4559
4645
|
}
|
|
4560
4646
|
return base;
|
|
4561
4647
|
}, [paginationMode, meta?.limit]);
|
|
4562
|
-
return /* @__PURE__ */ (0,
|
|
4563
|
-
!loading && /* @__PURE__ */ (0,
|
|
4564
|
-
/* @__PURE__ */ (0,
|
|
4565
|
-
enableTotalRecords && /* @__PURE__ */ (0,
|
|
4648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "overflow-hidden rounded-md w-full", children: [
|
|
4649
|
+
!loading && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex justify-between p-2 bg-gray-50", children: [
|
|
4650
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-center gap-4 w-full", children: [
|
|
4651
|
+
enableTotalRecords && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4566
4652
|
Button,
|
|
4567
4653
|
{
|
|
4568
4654
|
size: "sm",
|
|
@@ -4577,9 +4663,9 @@ function DataTable({
|
|
|
4577
4663
|
children: fetchLoading ? "Fetching..." : "Get Count"
|
|
4578
4664
|
}
|
|
4579
4665
|
),
|
|
4580
|
-
globalSearch && /* @__PURE__ */ (0,
|
|
4581
|
-
/* @__PURE__ */ (0,
|
|
4582
|
-
/* @__PURE__ */ (0,
|
|
4666
|
+
globalSearch && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-center gap-2 w-full max-w-sm", children: [
|
|
4667
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "relative w-full", children: [
|
|
4668
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4583
4669
|
"input",
|
|
4584
4670
|
{
|
|
4585
4671
|
type: "text",
|
|
@@ -4601,9 +4687,9 @@ function DataTable({
|
|
|
4601
4687
|
className: "border border-gray-300 rounded-md text-sm px-3 py-2 pl-8 w-full focus:outline-none focus:ring-1 focus:ring-[#12715B]"
|
|
4602
4688
|
}
|
|
4603
4689
|
),
|
|
4604
|
-
/* @__PURE__ */ (0,
|
|
4690
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_lucide_react13.Search, { className: "absolute left-2 top-2.5 text-gray-400", size: 16 })
|
|
4605
4691
|
] }),
|
|
4606
|
-
paginationMode === "server" && /* @__PURE__ */ (0,
|
|
4692
|
+
paginationMode === "server" && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4607
4693
|
Button,
|
|
4608
4694
|
{
|
|
4609
4695
|
size: "sm",
|
|
@@ -4614,8 +4700,8 @@ function DataTable({
|
|
|
4614
4700
|
)
|
|
4615
4701
|
] })
|
|
4616
4702
|
] }),
|
|
4617
|
-
manageColumns && /* @__PURE__ */ (0,
|
|
4618
|
-
/* @__PURE__ */ (0,
|
|
4703
|
+
manageColumns && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Popover, { children: [
|
|
4704
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4619
4705
|
Button,
|
|
4620
4706
|
{
|
|
4621
4707
|
variant: "outline",
|
|
@@ -4624,11 +4710,11 @@ function DataTable({
|
|
|
4624
4710
|
children: "Manage Columns"
|
|
4625
4711
|
}
|
|
4626
4712
|
) }),
|
|
4627
|
-
/* @__PURE__ */ (0,
|
|
4628
|
-
/* @__PURE__ */ (0,
|
|
4629
|
-
/* @__PURE__ */ (0,
|
|
4630
|
-
/* @__PURE__ */ (0,
|
|
4631
|
-
/* @__PURE__ */ (0,
|
|
4713
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(PopoverContent, { align: "end", className: "w-48 p-3", children: [
|
|
4714
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "text-sm font-medium mb-2", children: "Show / Hide Columns" }),
|
|
4715
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "max-h-56 overflow-y-auto pr-1 space-y-2", children: [
|
|
4716
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-2 text-sm font-semibold border-b pb-2 mb-2", children: [
|
|
4717
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4632
4718
|
"input",
|
|
4633
4719
|
{
|
|
4634
4720
|
type: "checkbox",
|
|
@@ -4649,8 +4735,8 @@ function DataTable({
|
|
|
4649
4735
|
] }),
|
|
4650
4736
|
table.getAllLeafColumns().map((column) => {
|
|
4651
4737
|
const header = column.columnDef.header;
|
|
4652
|
-
return /* @__PURE__ */ (0,
|
|
4653
|
-
/* @__PURE__ */ (0,
|
|
4738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
4739
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4654
4740
|
"input",
|
|
4655
4741
|
{
|
|
4656
4742
|
type: "checkbox",
|
|
@@ -4665,12 +4751,12 @@ function DataTable({
|
|
|
4665
4751
|
] })
|
|
4666
4752
|
] })
|
|
4667
4753
|
] }),
|
|
4668
|
-
/* @__PURE__ */ (0,
|
|
4669
|
-
/* @__PURE__ */ (0,
|
|
4754
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Table, { className: "table-fixed", children: [
|
|
4755
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TableHeader, { children: table.getHeaderGroups().map((hg) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TableRow, { children: hg.headers.map((header, index) => {
|
|
4670
4756
|
const canSort = header.column.getCanSort();
|
|
4671
4757
|
const canFilter = header.column.getCanFilter();
|
|
4672
4758
|
const sortDir = manualSort?.key === header.column.id ? manualSort.dir : null;
|
|
4673
|
-
return /* @__PURE__ */ (0,
|
|
4759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4674
4760
|
TableHead,
|
|
4675
4761
|
{
|
|
4676
4762
|
className: "relative select-none",
|
|
@@ -4679,8 +4765,8 @@ function DataTable({
|
|
|
4679
4765
|
minWidth: header.column.columnDef.minSize,
|
|
4680
4766
|
maxWidth: header.column.columnDef.maxSize
|
|
4681
4767
|
},
|
|
4682
|
-
children: /* @__PURE__ */ (0,
|
|
4683
|
-
/* @__PURE__ */ (0,
|
|
4768
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4769
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
4684
4770
|
"span",
|
|
4685
4771
|
{
|
|
4686
4772
|
className: `flex items-center gap-1 ${canSort ? "cursor-pointer" : ""}`,
|
|
@@ -4692,32 +4778,32 @@ function DataTable({
|
|
|
4692
4778
|
},
|
|
4693
4779
|
children: [
|
|
4694
4780
|
(0, import_react_table2.flexRender)(header.column.columnDef.header, header.getContext()),
|
|
4695
|
-
canSort && /* @__PURE__ */ (0,
|
|
4696
|
-
sortDir === "asc" && /* @__PURE__ */ (0,
|
|
4697
|
-
sortDir === "desc" && /* @__PURE__ */ (0,
|
|
4698
|
-
!sortDir && /* @__PURE__ */ (0,
|
|
4781
|
+
canSort && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
4782
|
+
sortDir === "asc" && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_lucide_react13.ArrowUp, { size: 14, className: "text-gray-500" }),
|
|
4783
|
+
sortDir === "desc" && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_lucide_react13.ArrowDown, { size: 14, className: "text-gray-500" }),
|
|
4784
|
+
!sortDir && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_lucide_react13.ArrowUpDown, { size: 14, className: "text-gray-400" })
|
|
4699
4785
|
] })
|
|
4700
4786
|
]
|
|
4701
4787
|
}
|
|
4702
4788
|
),
|
|
4703
|
-
canFilter && /* @__PURE__ */ (0,
|
|
4704
|
-
/* @__PURE__ */ (0,
|
|
4789
|
+
canFilter && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Popover, { children: [
|
|
4790
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4705
4791
|
"span",
|
|
4706
4792
|
{
|
|
4707
4793
|
role: "presentation",
|
|
4708
4794
|
className: "pl-5 cursor-pointer",
|
|
4709
4795
|
onClick: (e) => e.stopPropagation(),
|
|
4710
|
-
children: /* @__PURE__ */ (0,
|
|
4796
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons2.faEllipsisH, className: "w-5 h-5 text-gray-500" })
|
|
4711
4797
|
}
|
|
4712
4798
|
) }),
|
|
4713
|
-
/* @__PURE__ */ (0,
|
|
4799
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4714
4800
|
PopoverContent,
|
|
4715
4801
|
{
|
|
4716
4802
|
align: "center",
|
|
4717
4803
|
sideOffset: 14,
|
|
4718
4804
|
className: "w-50 p-3 z-[200] border-gray-300",
|
|
4719
4805
|
avoidCollisions: true,
|
|
4720
|
-
children: /* @__PURE__ */ (0,
|
|
4806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
4721
4807
|
"form",
|
|
4722
4808
|
{
|
|
4723
4809
|
onSubmit: (e) => {
|
|
@@ -4730,8 +4816,8 @@ function DataTable({
|
|
|
4730
4816
|
},
|
|
4731
4817
|
className: "space-y-2",
|
|
4732
4818
|
children: [
|
|
4733
|
-
/* @__PURE__ */ (0,
|
|
4734
|
-
/* @__PURE__ */ (0,
|
|
4819
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("label", { htmlFor: "filter", className: "text-xs text-gray-500 font-normal", children: "Filter by value:" }),
|
|
4820
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4735
4821
|
"input",
|
|
4736
4822
|
{
|
|
4737
4823
|
name: "filter",
|
|
@@ -4741,7 +4827,7 @@ function DataTable({
|
|
|
4741
4827
|
autoComplete: "off"
|
|
4742
4828
|
}
|
|
4743
4829
|
),
|
|
4744
|
-
/* @__PURE__ */ (0,
|
|
4830
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "justify-end flex", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4745
4831
|
Button,
|
|
4746
4832
|
{
|
|
4747
4833
|
type: "submit",
|
|
@@ -4760,9 +4846,9 @@ function DataTable({
|
|
|
4760
4846
|
`header-${header.id}-${index}`
|
|
4761
4847
|
);
|
|
4762
4848
|
}) }, `header-group-${hg.id}`)) }),
|
|
4763
|
-
/* @__PURE__ */ (0,
|
|
4849
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TableRow, { children: table.getHeaderGroups()[0].headers.map((header, j) => {
|
|
4764
4850
|
const column = header.column;
|
|
4765
|
-
return /* @__PURE__ */ (0,
|
|
4851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4766
4852
|
TableCell,
|
|
4767
4853
|
{
|
|
4768
4854
|
className: "p-3",
|
|
@@ -4771,15 +4857,15 @@ function DataTable({
|
|
|
4771
4857
|
minWidth: column.columnDef.minSize,
|
|
4772
4858
|
maxWidth: column.columnDef.maxSize
|
|
4773
4859
|
},
|
|
4774
|
-
children: /* @__PURE__ */ (0,
|
|
4860
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "h-4 bg-gray-200 rounded w-full block animate-pulse" })
|
|
4775
4861
|
},
|
|
4776
4862
|
j
|
|
4777
4863
|
);
|
|
4778
|
-
}) }, i)) }) : table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0,
|
|
4864
|
+
}) }, i)) }) : table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TableRow, { children: row.getVisibleCells().map((cell, cellIndex, arr) => {
|
|
4779
4865
|
const meta2 = cell.column.columnDef.meta || {};
|
|
4780
4866
|
const isClickable = meta2?.isClickable;
|
|
4781
4867
|
const isLastCell = cellIndex === arr.length - 1;
|
|
4782
|
-
return /* @__PURE__ */ (0,
|
|
4868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
4783
4869
|
TableCell,
|
|
4784
4870
|
{
|
|
4785
4871
|
className: `break-words whitespace-normal align-top ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2 ${meta2?.cellClass ?? ""}`,
|
|
@@ -4796,9 +4882,9 @@ function DataTable({
|
|
|
4796
4882
|
},
|
|
4797
4883
|
children: [
|
|
4798
4884
|
(0, import_react_table2.flexRender)(cell.column.columnDef.cell, cell.getContext()),
|
|
4799
|
-
isLastCell && rowActions && rowActions.length > 0 && /* @__PURE__ */ (0,
|
|
4885
|
+
isLastCell && rowActions && rowActions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "absolute p-1 px-2 inset-y-0 right-0 flex items-center transition-opacity duration-200", children: rowActions.map((action) => {
|
|
4800
4886
|
const isDelete = action.id === "delete" || action.icon === "delete";
|
|
4801
|
-
return /* @__PURE__ */ (0,
|
|
4887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4802
4888
|
"button",
|
|
4803
4889
|
{
|
|
4804
4890
|
className: `ml-2 px-2 py-1 text-[12px] rounded cursor-pointer ${isDelete ? "bg-red-800 text-white hover:bg-neutral-600" : "bg-gray-300 hover:bg-gray-400"}`,
|
|
@@ -4820,23 +4906,23 @@ function DataTable({
|
|
|
4820
4906
|
},
|
|
4821
4907
|
`cell-${cell.id}-${cellIndex}`
|
|
4822
4908
|
);
|
|
4823
|
-
}) }, row.id)) : /* @__PURE__ */ (0,
|
|
4909
|
+
}) }, row.id)) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TableCell, { colSpan: dynamicCols.length, className: "h-24 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "flex items-center justify-center py-10 w-full min-w-full text-gray-600 bg-gray-100", children: "No results." }) }) }) })
|
|
4824
4910
|
] }),
|
|
4825
|
-
pagination && /* @__PURE__ */ (0,
|
|
4826
|
-
!loading && /* @__PURE__ */ (0,
|
|
4911
|
+
pagination && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-center justify-between py-3 text-sm w-full", children: [
|
|
4912
|
+
!loading && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "flex gap-2 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4827
4913
|
"select",
|
|
4828
4914
|
{
|
|
4829
4915
|
value: paginationMode === "server" && meta?.limit != null ? meta.limit : localPageSize,
|
|
4830
4916
|
onChange: handlePageSizeChange,
|
|
4831
4917
|
className: "ml-2 border rounded py-1 text-sm cursor-pointer border-blue-600",
|
|
4832
|
-
children: pageSizeOptions.map((size) => /* @__PURE__ */ (0,
|
|
4918
|
+
children: pageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("option", { value: size, children: [
|
|
4833
4919
|
size,
|
|
4834
4920
|
" / page"
|
|
4835
4921
|
] }, size))
|
|
4836
4922
|
}
|
|
4837
4923
|
) }),
|
|
4838
|
-
/* @__PURE__ */ (0,
|
|
4839
|
-
/* @__PURE__ */ (0,
|
|
4924
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4925
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4840
4926
|
"button",
|
|
4841
4927
|
{
|
|
4842
4928
|
onClick: () => table.previousPage(),
|
|
@@ -4845,7 +4931,7 @@ function DataTable({
|
|
|
4845
4931
|
children: "Prev"
|
|
4846
4932
|
}
|
|
4847
4933
|
),
|
|
4848
|
-
/* @__PURE__ */ (0,
|
|
4934
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4849
4935
|
"button",
|
|
4850
4936
|
{
|
|
4851
4937
|
onClick: () => table.nextPage(),
|
|
@@ -4860,7 +4946,7 @@ function DataTable({
|
|
|
4860
4946
|
}
|
|
4861
4947
|
|
|
4862
4948
|
// src/components/DataDisplay/Table/Table.tsx
|
|
4863
|
-
var
|
|
4949
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4864
4950
|
var Table2 = ({
|
|
4865
4951
|
columns,
|
|
4866
4952
|
data,
|
|
@@ -4885,7 +4971,7 @@ var Table2 = ({
|
|
|
4885
4971
|
const rawColumns = Array.isArray(columns) ? columns : [];
|
|
4886
4972
|
const rawData = Array.isArray(data) ? data : [];
|
|
4887
4973
|
const isControlled = typeof page === "number";
|
|
4888
|
-
return /* @__PURE__ */ (0,
|
|
4974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: `${className || ""} space-y-3`, style, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4889
4975
|
DataTable,
|
|
4890
4976
|
{
|
|
4891
4977
|
...props,
|
|
@@ -4916,10 +5002,10 @@ var Table2 = ({
|
|
|
4916
5002
|
var Table_default = Table2;
|
|
4917
5003
|
|
|
4918
5004
|
// src/components/ui/pagination.tsx
|
|
4919
|
-
var
|
|
4920
|
-
var
|
|
5005
|
+
var import_lucide_react14 = require("lucide-react");
|
|
5006
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4921
5007
|
function Pagination({ className, ...props }) {
|
|
4922
|
-
return /* @__PURE__ */ (0,
|
|
5008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4923
5009
|
"nav",
|
|
4924
5010
|
{
|
|
4925
5011
|
role: "navigation",
|
|
@@ -4934,7 +5020,7 @@ function PaginationContent({
|
|
|
4934
5020
|
className,
|
|
4935
5021
|
...props
|
|
4936
5022
|
}) {
|
|
4937
|
-
return /* @__PURE__ */ (0,
|
|
5023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4938
5024
|
"ul",
|
|
4939
5025
|
{
|
|
4940
5026
|
"data-slot": "pagination-content",
|
|
@@ -4944,7 +5030,7 @@ function PaginationContent({
|
|
|
4944
5030
|
);
|
|
4945
5031
|
}
|
|
4946
5032
|
function PaginationItem({ ...props }) {
|
|
4947
|
-
return /* @__PURE__ */ (0,
|
|
5033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("li", { "data-slot": "pagination-item", ...props });
|
|
4948
5034
|
}
|
|
4949
5035
|
function PaginationLink({
|
|
4950
5036
|
className,
|
|
@@ -4952,7 +5038,7 @@ function PaginationLink({
|
|
|
4952
5038
|
size = "icon",
|
|
4953
5039
|
...props
|
|
4954
5040
|
}) {
|
|
4955
|
-
return /* @__PURE__ */ (0,
|
|
5041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4956
5042
|
"a",
|
|
4957
5043
|
{
|
|
4958
5044
|
"aria-current": isActive ? "page" : void 0,
|
|
@@ -4973,7 +5059,7 @@ function PaginationPrevious({
|
|
|
4973
5059
|
className,
|
|
4974
5060
|
...props
|
|
4975
5061
|
}) {
|
|
4976
|
-
return /* @__PURE__ */ (0,
|
|
5062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4977
5063
|
PaginationLink,
|
|
4978
5064
|
{
|
|
4979
5065
|
"aria-label": "Go to previous page",
|
|
@@ -4981,8 +5067,8 @@ function PaginationPrevious({
|
|
|
4981
5067
|
className: cn("gap-1 px-2.5 sm:pl-2.5", className),
|
|
4982
5068
|
...props,
|
|
4983
5069
|
children: [
|
|
4984
|
-
/* @__PURE__ */ (0,
|
|
4985
|
-
/* @__PURE__ */ (0,
|
|
5070
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react14.ChevronLeftIcon, {}),
|
|
5071
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "hidden sm:block", children: "Previous" })
|
|
4986
5072
|
]
|
|
4987
5073
|
}
|
|
4988
5074
|
);
|
|
@@ -4991,7 +5077,7 @@ function PaginationNext({
|
|
|
4991
5077
|
className,
|
|
4992
5078
|
...props
|
|
4993
5079
|
}) {
|
|
4994
|
-
return /* @__PURE__ */ (0,
|
|
5080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4995
5081
|
PaginationLink,
|
|
4996
5082
|
{
|
|
4997
5083
|
"aria-label": "Go to next page",
|
|
@@ -4999,8 +5085,8 @@ function PaginationNext({
|
|
|
4999
5085
|
className: cn("gap-1 px-2.5 sm:pr-2.5", className),
|
|
5000
5086
|
...props,
|
|
5001
5087
|
children: [
|
|
5002
|
-
/* @__PURE__ */ (0,
|
|
5003
|
-
/* @__PURE__ */ (0,
|
|
5088
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "hidden sm:block", children: "Next" }),
|
|
5089
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react14.ChevronRightIcon, {})
|
|
5004
5090
|
]
|
|
5005
5091
|
}
|
|
5006
5092
|
);
|
|
@@ -5009,7 +5095,7 @@ function PaginationEllipsis({
|
|
|
5009
5095
|
className,
|
|
5010
5096
|
...props
|
|
5011
5097
|
}) {
|
|
5012
|
-
return /* @__PURE__ */ (0,
|
|
5098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
5013
5099
|
"span",
|
|
5014
5100
|
{
|
|
5015
5101
|
"aria-hidden": true,
|
|
@@ -5017,15 +5103,15 @@ function PaginationEllipsis({
|
|
|
5017
5103
|
className: cn("flex size-9 items-center justify-center", className),
|
|
5018
5104
|
...props,
|
|
5019
5105
|
children: [
|
|
5020
|
-
/* @__PURE__ */ (0,
|
|
5021
|
-
/* @__PURE__ */ (0,
|
|
5106
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react14.MoreHorizontalIcon, { className: "size-4" }),
|
|
5107
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "sr-only", children: "More pages" })
|
|
5022
5108
|
]
|
|
5023
5109
|
}
|
|
5024
5110
|
);
|
|
5025
5111
|
}
|
|
5026
5112
|
|
|
5027
5113
|
// src/components/DataDisplay/Pagination/Pagination.tsx
|
|
5028
|
-
var
|
|
5114
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5029
5115
|
var CustomPagination = ({
|
|
5030
5116
|
totalPages,
|
|
5031
5117
|
currentPage,
|
|
@@ -5071,10 +5157,10 @@ var CustomPagination = ({
|
|
|
5071
5157
|
}
|
|
5072
5158
|
};
|
|
5073
5159
|
const pageNumbers = getPageNumbers();
|
|
5074
|
-
return /* @__PURE__ */ (0,
|
|
5075
|
-
/* @__PURE__ */ (0,
|
|
5076
|
-
/* @__PURE__ */ (0,
|
|
5077
|
-
/* @__PURE__ */ (0,
|
|
5160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-row gap-1 w-full items-center justify-between", children: [
|
|
5161
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5162
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "text-sm text-muted-foreground whitespace-nowrap", children: "Items per page:" }),
|
|
5163
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
5078
5164
|
Select,
|
|
5079
5165
|
{
|
|
5080
5166
|
defaultValue: String(perPage),
|
|
@@ -5082,26 +5168,26 @@ var CustomPagination = ({
|
|
|
5082
5168
|
onPageChange({ page: 1, itemsPerPage: Number(value) });
|
|
5083
5169
|
},
|
|
5084
5170
|
children: [
|
|
5085
|
-
/* @__PURE__ */ (0,
|
|
5086
|
-
/* @__PURE__ */ (0,
|
|
5087
|
-
/* @__PURE__ */ (0,
|
|
5088
|
-
/* @__PURE__ */ (0,
|
|
5089
|
-
/* @__PURE__ */ (0,
|
|
5090
|
-
/* @__PURE__ */ (0,
|
|
5171
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectTrigger, { className: "w-[100px]", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
5172
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(SelectContent, { children: [
|
|
5173
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectItem, { value: "5", children: "5" }),
|
|
5174
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectItem, { value: "10", children: "10" }),
|
|
5175
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectItem, { value: "20", children: "20" }),
|
|
5176
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectItem, { value: "50", children: "50" })
|
|
5091
5177
|
] })
|
|
5092
5178
|
]
|
|
5093
5179
|
}
|
|
5094
5180
|
)
|
|
5095
5181
|
] }),
|
|
5096
|
-
/* @__PURE__ */ (0,
|
|
5097
|
-
/* @__PURE__ */ (0,
|
|
5182
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Pagination, { className: "justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(PaginationContent, { children: [
|
|
5183
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5098
5184
|
PaginationPrevious,
|
|
5099
5185
|
{
|
|
5100
5186
|
onClick: () => handlePageChange(currentPage - 1),
|
|
5101
5187
|
className: currentPage === 1 ? "pointer-events-none opacity-50" : "cursor-pointer"
|
|
5102
5188
|
}
|
|
5103
5189
|
) }),
|
|
5104
|
-
pageNumbers.map((pageNumber, index) => /* @__PURE__ */ (0,
|
|
5190
|
+
pageNumbers.map((pageNumber, index) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(PaginationItem, { children: pageNumber === "..." ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(PaginationEllipsis, {}) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5105
5191
|
PaginationLink,
|
|
5106
5192
|
{
|
|
5107
5193
|
onClick: () => handlePageChange(pageNumber),
|
|
@@ -5110,7 +5196,7 @@ var CustomPagination = ({
|
|
|
5110
5196
|
children: pageNumber
|
|
5111
5197
|
}
|
|
5112
5198
|
) }, index)),
|
|
5113
|
-
/* @__PURE__ */ (0,
|
|
5199
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5114
5200
|
PaginationNext,
|
|
5115
5201
|
{
|
|
5116
5202
|
onClick: () => handlePageChange(currentPage + 1),
|
|
@@ -5123,23 +5209,23 @@ var CustomPagination = ({
|
|
|
5123
5209
|
var Pagination_default = CustomPagination;
|
|
5124
5210
|
|
|
5125
5211
|
// src/components/DataDisplay/HistoryTimeline/HistoryTimeline.tsx
|
|
5126
|
-
var
|
|
5127
|
-
var
|
|
5212
|
+
var import_react33 = require("react");
|
|
5213
|
+
var import_lucide_react16 = require("lucide-react");
|
|
5128
5214
|
|
|
5129
5215
|
// src/components/ui/accordion.tsx
|
|
5130
5216
|
var AccordionPrimitive = __toESM(require("@radix-ui/react-accordion"));
|
|
5131
|
-
var
|
|
5132
|
-
var
|
|
5217
|
+
var import_lucide_react15 = require("lucide-react");
|
|
5218
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5133
5219
|
function Accordion2({
|
|
5134
5220
|
...props
|
|
5135
5221
|
}) {
|
|
5136
|
-
return /* @__PURE__ */ (0,
|
|
5222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AccordionPrimitive.Root, { "data-slot": "accordion", ...props });
|
|
5137
5223
|
}
|
|
5138
5224
|
function AccordionItem({
|
|
5139
5225
|
className,
|
|
5140
5226
|
...props
|
|
5141
5227
|
}) {
|
|
5142
|
-
return /* @__PURE__ */ (0,
|
|
5228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5143
5229
|
AccordionPrimitive.Item,
|
|
5144
5230
|
{
|
|
5145
5231
|
"data-slot": "accordion-item",
|
|
@@ -5153,7 +5239,7 @@ function AccordionTrigger({
|
|
|
5153
5239
|
children,
|
|
5154
5240
|
...props
|
|
5155
5241
|
}) {
|
|
5156
|
-
return /* @__PURE__ */ (0,
|
|
5242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
5157
5243
|
AccordionPrimitive.Trigger,
|
|
5158
5244
|
{
|
|
5159
5245
|
"data-slot": "accordion-trigger",
|
|
@@ -5164,7 +5250,7 @@ function AccordionTrigger({
|
|
|
5164
5250
|
...props,
|
|
5165
5251
|
children: [
|
|
5166
5252
|
children,
|
|
5167
|
-
/* @__PURE__ */ (0,
|
|
5253
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react15.ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })
|
|
5168
5254
|
]
|
|
5169
5255
|
}
|
|
5170
5256
|
) });
|
|
@@ -5174,21 +5260,21 @@ function AccordionContent({
|
|
|
5174
5260
|
children,
|
|
5175
5261
|
...props
|
|
5176
5262
|
}) {
|
|
5177
|
-
return /* @__PURE__ */ (0,
|
|
5263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5178
5264
|
AccordionPrimitive.Content,
|
|
5179
5265
|
{
|
|
5180
5266
|
"data-slot": "accordion-content",
|
|
5181
5267
|
className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
|
5182
5268
|
...props,
|
|
5183
|
-
children: /* @__PURE__ */ (0,
|
|
5269
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: cn("pt-0 pb-4", className), children })
|
|
5184
5270
|
}
|
|
5185
5271
|
);
|
|
5186
5272
|
}
|
|
5187
5273
|
|
|
5188
5274
|
// src/components/ui/card.tsx
|
|
5189
|
-
var
|
|
5275
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5190
5276
|
function Card({ className, ...props }) {
|
|
5191
|
-
return /* @__PURE__ */ (0,
|
|
5277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5192
5278
|
"div",
|
|
5193
5279
|
{
|
|
5194
5280
|
"data-slot": "card",
|
|
@@ -5201,7 +5287,7 @@ function Card({ className, ...props }) {
|
|
|
5201
5287
|
);
|
|
5202
5288
|
}
|
|
5203
5289
|
function CardHeader({ className, ...props }) {
|
|
5204
|
-
return /* @__PURE__ */ (0,
|
|
5290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5205
5291
|
"div",
|
|
5206
5292
|
{
|
|
5207
5293
|
"data-slot": "card-header",
|
|
@@ -5214,7 +5300,7 @@ function CardHeader({ className, ...props }) {
|
|
|
5214
5300
|
);
|
|
5215
5301
|
}
|
|
5216
5302
|
function CardTitle({ className, ...props }) {
|
|
5217
|
-
return /* @__PURE__ */ (0,
|
|
5303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5218
5304
|
"div",
|
|
5219
5305
|
{
|
|
5220
5306
|
"data-slot": "card-title",
|
|
@@ -5224,7 +5310,7 @@ function CardTitle({ className, ...props }) {
|
|
|
5224
5310
|
);
|
|
5225
5311
|
}
|
|
5226
5312
|
function CardContent({ className, ...props }) {
|
|
5227
|
-
return /* @__PURE__ */ (0,
|
|
5313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5228
5314
|
"div",
|
|
5229
5315
|
{
|
|
5230
5316
|
"data-slot": "card-content",
|
|
@@ -5235,7 +5321,7 @@ function CardContent({ className, ...props }) {
|
|
|
5235
5321
|
}
|
|
5236
5322
|
|
|
5237
5323
|
// src/components/DataDisplay/HistoryTimeline/HistoryTimeline.tsx
|
|
5238
|
-
var
|
|
5324
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5239
5325
|
function getValue(item, key) {
|
|
5240
5326
|
if (!key) return void 0;
|
|
5241
5327
|
return item[key];
|
|
@@ -5249,33 +5335,33 @@ var HistoryTimeline = ({
|
|
|
5249
5335
|
createdAtKey,
|
|
5250
5336
|
...props
|
|
5251
5337
|
}) => {
|
|
5252
|
-
const data = (0,
|
|
5338
|
+
const data = (0, import_react33.useMemo)(() => {
|
|
5253
5339
|
if (Array.isArray(props.data)) {
|
|
5254
5340
|
return props.data;
|
|
5255
5341
|
}
|
|
5256
5342
|
return [];
|
|
5257
5343
|
}, [props.data]);
|
|
5258
5344
|
if (loading) {
|
|
5259
|
-
return /* @__PURE__ */ (0,
|
|
5260
|
-
/* @__PURE__ */ (0,
|
|
5261
|
-
/* @__PURE__ */ (0,
|
|
5345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Card, { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(CardContent, { className: "flex items-center justify-center px-4 py-8", children: [
|
|
5346
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lucide_react16.LoaderCircle, { className: "h-5 w-5 animate-spin text-muted-foreground" }),
|
|
5347
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "ml-2 text-sm text-muted-foreground", children: "Loading history\u2026" })
|
|
5262
5348
|
] }) });
|
|
5263
5349
|
}
|
|
5264
5350
|
if (data.length === 0) {
|
|
5265
|
-
return /* @__PURE__ */ (0,
|
|
5351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Card, { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CardContent, { className: "px-4 py-8 text-center text-muted-foreground", children: "No history available." }) });
|
|
5266
5352
|
}
|
|
5267
|
-
return /* @__PURE__ */ (0,
|
|
5268
|
-
/* @__PURE__ */ (0,
|
|
5353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Card, { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Accordion2, { type: "single", collapsible: true, defaultValue: "history", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(AccordionItem, { value: "history", className: "border-0", children: [
|
|
5354
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CardHeader, { className: "flex flex-row items-center justify-between gap-2 border-b px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5269
5355
|
AccordionTrigger,
|
|
5270
5356
|
{
|
|
5271
5357
|
className: cn(
|
|
5272
5358
|
"flex flex-1 items-center justify-between gap-2 p-0 text-left",
|
|
5273
5359
|
"hover:no-underline"
|
|
5274
5360
|
),
|
|
5275
|
-
children: /* @__PURE__ */ (0,
|
|
5361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CardTitle, { className: "text-base font-semibold", children: title })
|
|
5276
5362
|
}
|
|
5277
5363
|
) }),
|
|
5278
|
-
/* @__PURE__ */ (0,
|
|
5364
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(AccordionContent, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CardContent, { className: "px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ol", { className: "relative ml-4 border-l-2 border-[#939393] space-y-4", children: data.map((item, index) => {
|
|
5279
5365
|
const id = item.id ?? index;
|
|
5280
5366
|
const rawTitle = getValue(item, titleKey);
|
|
5281
5367
|
const rawDescription = getValue(item, descriptionKey);
|
|
@@ -5283,39 +5369,39 @@ var HistoryTimeline = ({
|
|
|
5283
5369
|
const titleText = String(rawTitle ?? "");
|
|
5284
5370
|
const descriptionText = rawDescription != null ? String(rawDescription) : "";
|
|
5285
5371
|
const createdAtDate = rawCreatedAt != null ? new Date(rawCreatedAt) : null;
|
|
5286
|
-
return /* @__PURE__ */ (0,
|
|
5287
|
-
/* @__PURE__ */ (0,
|
|
5288
|
-
|
|
5372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("li", { className: "relative pl-4", children: [
|
|
5373
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "absolute left-[-9px] top-2 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-primary-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "bg-[#06A59A] text-white rounded-md p-[5px]", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5374
|
+
import_lucide_react16.Info,
|
|
5289
5375
|
{
|
|
5290
5376
|
className: cn(
|
|
5291
5377
|
"h-5 w-5 text-white"
|
|
5292
5378
|
)
|
|
5293
5379
|
}
|
|
5294
5380
|
) }) }),
|
|
5295
|
-
/* @__PURE__ */ (0,
|
|
5381
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5296
5382
|
Accordion2,
|
|
5297
5383
|
{
|
|
5298
5384
|
type: "single",
|
|
5299
5385
|
collapsible: true,
|
|
5300
5386
|
className: "w-full",
|
|
5301
|
-
children: /* @__PURE__ */ (0,
|
|
5302
|
-
/* @__PURE__ */ (0,
|
|
5387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(AccordionItem, { value: `item-${item.id}`, className: "border-0", children: [
|
|
5388
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5303
5389
|
AccordionTrigger,
|
|
5304
5390
|
{
|
|
5305
5391
|
className: cn(
|
|
5306
5392
|
"flex items-center justify-between gap-2 rounded-md px-2 py-1 text-left",
|
|
5307
5393
|
"hover:bg-muted/60 hover:no-underline"
|
|
5308
5394
|
),
|
|
5309
|
-
children: /* @__PURE__ */ (0,
|
|
5310
|
-
/* @__PURE__ */ (0,
|
|
5311
|
-
/* @__PURE__ */ (0,
|
|
5395
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
5396
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-sm font-medium leading-none", children: titleText }),
|
|
5397
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-[11px] text-muted-foreground", children: new Intl.DateTimeFormat("default", {
|
|
5312
5398
|
dateStyle: "medium",
|
|
5313
5399
|
timeStyle: "short"
|
|
5314
5400
|
}).format(createdAtDate ?? /* @__PURE__ */ new Date()) })
|
|
5315
5401
|
] })
|
|
5316
5402
|
}
|
|
5317
5403
|
),
|
|
5318
|
-
/* @__PURE__ */ (0,
|
|
5404
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(AccordionContent, { className: "pt-1", children: descriptionText && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "rounded-md bg-muted px-2 py-2 text-xs text-muted-foreground", children: descriptionText }) })
|
|
5319
5405
|
] })
|
|
5320
5406
|
}
|
|
5321
5407
|
)
|
|
@@ -5326,30 +5412,30 @@ var HistoryTimeline = ({
|
|
|
5326
5412
|
var HistoryTimeline_default = HistoryTimeline;
|
|
5327
5413
|
|
|
5328
5414
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
5329
|
-
var
|
|
5330
|
-
var
|
|
5415
|
+
var import_react34 = require("react");
|
|
5416
|
+
var import_lucide_react18 = require("lucide-react");
|
|
5331
5417
|
var import_link3 = __toESM(require("next/link"));
|
|
5332
5418
|
var import_navigation2 = require("next/navigation");
|
|
5333
5419
|
|
|
5334
5420
|
// src/components/ui/dialog.tsx
|
|
5335
5421
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
|
|
5336
|
-
var
|
|
5337
|
-
var
|
|
5422
|
+
var import_lucide_react17 = require("lucide-react");
|
|
5423
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
5338
5424
|
function Dialog({
|
|
5339
5425
|
...props
|
|
5340
5426
|
}) {
|
|
5341
|
-
return /* @__PURE__ */ (0,
|
|
5427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
5342
5428
|
}
|
|
5343
5429
|
function DialogPortal({
|
|
5344
5430
|
...props
|
|
5345
5431
|
}) {
|
|
5346
|
-
return /* @__PURE__ */ (0,
|
|
5432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
5347
5433
|
}
|
|
5348
5434
|
function DialogOverlay({
|
|
5349
5435
|
className,
|
|
5350
5436
|
...props
|
|
5351
5437
|
}) {
|
|
5352
|
-
return /* @__PURE__ */ (0,
|
|
5438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5353
5439
|
DialogPrimitive.Overlay,
|
|
5354
5440
|
{
|
|
5355
5441
|
"data-slot": "dialog-overlay",
|
|
@@ -5367,9 +5453,9 @@ function DialogContent({
|
|
|
5367
5453
|
showCloseButton = true,
|
|
5368
5454
|
...props
|
|
5369
5455
|
}) {
|
|
5370
|
-
return /* @__PURE__ */ (0,
|
|
5371
|
-
/* @__PURE__ */ (0,
|
|
5372
|
-
/* @__PURE__ */ (0,
|
|
5456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
5457
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DialogOverlay, {}),
|
|
5458
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
5373
5459
|
DialogPrimitive.Content,
|
|
5374
5460
|
{
|
|
5375
5461
|
"data-slot": "dialog-content",
|
|
@@ -5380,14 +5466,14 @@ function DialogContent({
|
|
|
5380
5466
|
...props,
|
|
5381
5467
|
children: [
|
|
5382
5468
|
children,
|
|
5383
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
5469
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
5384
5470
|
DialogPrimitive.Close,
|
|
5385
5471
|
{
|
|
5386
5472
|
"data-slot": "dialog-close",
|
|
5387
5473
|
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
5388
5474
|
children: [
|
|
5389
|
-
/* @__PURE__ */ (0,
|
|
5390
|
-
/* @__PURE__ */ (0,
|
|
5475
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_lucide_react17.XIcon, {}),
|
|
5476
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "sr-only", children: "Close" })
|
|
5391
5477
|
]
|
|
5392
5478
|
}
|
|
5393
5479
|
)
|
|
@@ -5397,7 +5483,7 @@ function DialogContent({
|
|
|
5397
5483
|
] });
|
|
5398
5484
|
}
|
|
5399
5485
|
function DialogHeader({ className, ...props }) {
|
|
5400
|
-
return /* @__PURE__ */ (0,
|
|
5486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5401
5487
|
"div",
|
|
5402
5488
|
{
|
|
5403
5489
|
"data-slot": "dialog-header",
|
|
@@ -5407,7 +5493,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
5407
5493
|
);
|
|
5408
5494
|
}
|
|
5409
5495
|
function DialogFooter({ className, ...props }) {
|
|
5410
|
-
return /* @__PURE__ */ (0,
|
|
5496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5411
5497
|
"div",
|
|
5412
5498
|
{
|
|
5413
5499
|
"data-slot": "dialog-footer",
|
|
@@ -5423,7 +5509,7 @@ function DialogTitle({
|
|
|
5423
5509
|
className,
|
|
5424
5510
|
...props
|
|
5425
5511
|
}) {
|
|
5426
|
-
return /* @__PURE__ */ (0,
|
|
5512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5427
5513
|
DialogPrimitive.Title,
|
|
5428
5514
|
{
|
|
5429
5515
|
"data-slot": "dialog-title",
|
|
@@ -5436,7 +5522,7 @@ function DialogDescription({
|
|
|
5436
5522
|
className,
|
|
5437
5523
|
...props
|
|
5438
5524
|
}) {
|
|
5439
|
-
return /* @__PURE__ */ (0,
|
|
5525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5440
5526
|
DialogPrimitive.Description,
|
|
5441
5527
|
{
|
|
5442
5528
|
"data-slot": "dialog-description",
|
|
@@ -5513,9 +5599,9 @@ function showConfirmToast({
|
|
|
5513
5599
|
}
|
|
5514
5600
|
|
|
5515
5601
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
5516
|
-
var
|
|
5602
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
5517
5603
|
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
|
|
5518
|
-
const [openIndex, setOpenIndex] = (0,
|
|
5604
|
+
const [openIndex, setOpenIndex] = (0, import_react34.useState)(null);
|
|
5519
5605
|
const currentPathname = (0, import_navigation2.usePathname)();
|
|
5520
5606
|
function groupMenus(menus = []) {
|
|
5521
5607
|
const menuMap = /* @__PURE__ */ new Map();
|
|
@@ -5549,7 +5635,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5549
5635
|
});
|
|
5550
5636
|
return sortMenus(rootMenus);
|
|
5551
5637
|
}
|
|
5552
|
-
const rawTabs = (0,
|
|
5638
|
+
const rawTabs = (0, import_react34.useMemo)(() => {
|
|
5553
5639
|
if (!Array.isArray(tabs)) return [];
|
|
5554
5640
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
5555
5641
|
return groupMenus(tabs);
|
|
@@ -5579,9 +5665,9 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5579
5665
|
return tab.children.some((child) => isActive(child.url));
|
|
5580
5666
|
};
|
|
5581
5667
|
const router = (0, import_navigation2.useRouter)();
|
|
5582
|
-
const [showExitDialog, setShowExitDialog] = (0,
|
|
5583
|
-
const [pendingUrl, setPendingUrl] = (0,
|
|
5584
|
-
const handleBuilderExit = (0,
|
|
5668
|
+
const [showExitDialog, setShowExitDialog] = (0, import_react34.useState)(false);
|
|
5669
|
+
const [pendingUrl, setPendingUrl] = (0, import_react34.useState)(null);
|
|
5670
|
+
const handleBuilderExit = (0, import_react34.useCallback)(
|
|
5585
5671
|
(e, url) => {
|
|
5586
5672
|
if (isBuilder) {
|
|
5587
5673
|
e.preventDefault();
|
|
@@ -5612,13 +5698,13 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5612
5698
|
border: active && textActiveColor ? `1px solid ${textActiveColor}` : void 0
|
|
5613
5699
|
};
|
|
5614
5700
|
if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
|
|
5615
|
-
return /* @__PURE__ */ (0,
|
|
5701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5616
5702
|
DropdownMenu,
|
|
5617
5703
|
{
|
|
5618
5704
|
open: openIndex === index,
|
|
5619
5705
|
onOpenChange: (open) => setOpenIndex(open ? index : null),
|
|
5620
5706
|
children: [
|
|
5621
|
-
/* @__PURE__ */ (0,
|
|
5707
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5622
5708
|
DropdownMenuTrigger,
|
|
5623
5709
|
{
|
|
5624
5710
|
className: `${finalClasses} inline-flex items-center gap-1`,
|
|
@@ -5632,11 +5718,11 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5632
5718
|
style: finalStyle,
|
|
5633
5719
|
children: [
|
|
5634
5720
|
tab.header,
|
|
5635
|
-
/* @__PURE__ */ (0,
|
|
5721
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_lucide_react18.ChevronDown, { className: "h-4 w-4 opacity-80" })
|
|
5636
5722
|
]
|
|
5637
5723
|
}
|
|
5638
5724
|
),
|
|
5639
|
-
/* @__PURE__ */ (0,
|
|
5725
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5640
5726
|
DropdownMenuContent,
|
|
5641
5727
|
{
|
|
5642
5728
|
align: "start",
|
|
@@ -5649,12 +5735,12 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5649
5735
|
onMouseLeave: () => {
|
|
5650
5736
|
timeout = setTimeout(() => setOpenIndex(null), 150);
|
|
5651
5737
|
},
|
|
5652
|
-
children: tab.children.map((item, index2) => /* @__PURE__ */ (0,
|
|
5738
|
+
children: tab.children.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5653
5739
|
DropdownMenuItem,
|
|
5654
5740
|
{
|
|
5655
5741
|
asChild: true,
|
|
5656
5742
|
className: "cursor-pointer rounded-sm px-3 py-2 text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
|
|
5657
|
-
children: /* @__PURE__ */ (0,
|
|
5743
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5658
5744
|
import_link3.default,
|
|
5659
5745
|
{
|
|
5660
5746
|
href: item.url || "#",
|
|
@@ -5673,7 +5759,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5673
5759
|
index
|
|
5674
5760
|
);
|
|
5675
5761
|
}
|
|
5676
|
-
return tab.url ? /* @__PURE__ */ (0,
|
|
5762
|
+
return tab.url ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5677
5763
|
import_link3.default,
|
|
5678
5764
|
{
|
|
5679
5765
|
href: tab.url,
|
|
@@ -5684,14 +5770,14 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5684
5770
|
children: tab.header
|
|
5685
5771
|
},
|
|
5686
5772
|
index
|
|
5687
|
-
) : /* @__PURE__ */ (0,
|
|
5773
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: finalClasses, style: finalStyle, role: "button", tabIndex: 0, children: tab.header }, index);
|
|
5688
5774
|
};
|
|
5689
|
-
const renderMobileMenu = () => /* @__PURE__ */ (0,
|
|
5690
|
-
/* @__PURE__ */ (0,
|
|
5691
|
-
/* @__PURE__ */ (0,
|
|
5775
|
+
const renderMobileMenu = () => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(DropdownMenu, { children: [
|
|
5776
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(DropdownMenuTrigger, { className: "flex items-center gap-2 px-3 py-2 rounded-md bg-white/10 text-white text-sm", children: [
|
|
5777
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_lucide_react18.Menu, { className: "h-4 w-4" }),
|
|
5692
5778
|
"Menu"
|
|
5693
5779
|
] }),
|
|
5694
|
-
/* @__PURE__ */ (0,
|
|
5780
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5695
5781
|
DropdownMenuContent,
|
|
5696
5782
|
{
|
|
5697
5783
|
align: "start",
|
|
@@ -5700,25 +5786,25 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5700
5786
|
children: rawTabs.map((tab, i) => {
|
|
5701
5787
|
const hasChildren = Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown;
|
|
5702
5788
|
if (hasChildren) {
|
|
5703
|
-
return /* @__PURE__ */ (0,
|
|
5704
|
-
/* @__PURE__ */ (0,
|
|
5705
|
-
/* @__PURE__ */ (0,
|
|
5789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(DropdownMenuSub, { children: [
|
|
5790
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DropdownMenuSubTrigger, { className: "flex items-center justify-between cursor-pointer rounded-sm px-3 py-2 text-[13px] text-foreground hover:text-foreground", children: tab.header }),
|
|
5791
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DropdownMenuSubContent, { className: "bg-white border shadow-lg rounded-md p-1", children: tab.children.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5706
5792
|
DropdownMenuItem,
|
|
5707
5793
|
{
|
|
5708
5794
|
asChild: true,
|
|
5709
5795
|
className: "cursor-pointer rounded-sm px-3 py-2 text-gray-800 hover:bg-gray-100",
|
|
5710
|
-
children: /* @__PURE__ */ (0,
|
|
5796
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_link3.default, { href: item.url || "#", onClick: (e) => handleBuilderExit(e, item.url || "#"), children: item.header })
|
|
5711
5797
|
},
|
|
5712
5798
|
item.id || index
|
|
5713
5799
|
)) })
|
|
5714
5800
|
] }, i);
|
|
5715
5801
|
}
|
|
5716
|
-
return /* @__PURE__ */ (0,
|
|
5802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5717
5803
|
DropdownMenuItem,
|
|
5718
5804
|
{
|
|
5719
5805
|
asChild: true,
|
|
5720
5806
|
className: "cursor-pointer rounded-sm px-3 py-2 text-[13px] text-gray-800 hover:bg-gray-100",
|
|
5721
|
-
children: /* @__PURE__ */ (0,
|
|
5807
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_link3.default, { href: tab.url || "#", onClick: (e) => handleBuilderExit(e, tab.url || "#"), children: tab.header })
|
|
5722
5808
|
},
|
|
5723
5809
|
i
|
|
5724
5810
|
);
|
|
@@ -5728,19 +5814,19 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5728
5814
|
] });
|
|
5729
5815
|
const forceMobile = canvasMode ? canvasMode === "mobile" || canvasMode === "tablet" : void 0;
|
|
5730
5816
|
const forceDesktop = canvasMode ? canvasMode === "desktop" : void 0;
|
|
5731
|
-
return /* @__PURE__ */ (0,
|
|
5732
|
-
/* @__PURE__ */ (0,
|
|
5733
|
-
forceDesktop !== void 0 ? forceDesktop && /* @__PURE__ */ (0,
|
|
5734
|
-
forceMobile !== void 0 ? forceMobile && /* @__PURE__ */ (0,
|
|
5817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
5818
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: cn("min-h-10", className), style, children: [
|
|
5819
|
+
forceDesktop !== void 0 ? forceDesktop && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "hidden md:flex", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "hidden md:flex", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }),
|
|
5820
|
+
forceMobile !== void 0 ? forceMobile && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { children: renderMobileMenu() }) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "flex md:hidden", children: renderMobileMenu() })
|
|
5735
5821
|
] }),
|
|
5736
|
-
/* @__PURE__ */ (0,
|
|
5737
|
-
/* @__PURE__ */ (0,
|
|
5738
|
-
/* @__PURE__ */ (0,
|
|
5739
|
-
/* @__PURE__ */ (0,
|
|
5822
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Dialog, { open: showExitDialog, onOpenChange: setShowExitDialog, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(DialogContent, { className: "bg-[#fff]", children: [
|
|
5823
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(DialogHeader, { children: [
|
|
5824
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DialogTitle, { children: "Exit Builder?" }),
|
|
5825
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DialogDescription, { children: "You are about to leave the builder. Any unsaved changes may be lost." })
|
|
5740
5826
|
] }),
|
|
5741
|
-
/* @__PURE__ */ (0,
|
|
5742
|
-
/* @__PURE__ */ (0,
|
|
5743
|
-
/* @__PURE__ */ (0,
|
|
5827
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(DialogFooter, { children: [
|
|
5828
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Button, { className: "cursor-pointer bg-[#12715b] text-[#fff]", variant: "outline", onClick: () => setShowExitDialog(false), children: "Cancel" }),
|
|
5829
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Button, { className: "cursor-pointer border-[#12715b] border", onClick: confirmExit, children: "Yes, Exit" })
|
|
5744
5830
|
] })
|
|
5745
5831
|
] }) })
|
|
5746
5832
|
] });
|
|
@@ -5748,16 +5834,16 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5748
5834
|
var Tabs_default = Tabs;
|
|
5749
5835
|
|
|
5750
5836
|
// src/components/Navigation/Stages/Stages.tsx
|
|
5751
|
-
var
|
|
5837
|
+
var import_react35 = __toESM(require("react"));
|
|
5752
5838
|
|
|
5753
5839
|
// src/components/ui/tooltip.tsx
|
|
5754
5840
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
|
|
5755
|
-
var
|
|
5841
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
5756
5842
|
function TooltipProvider({
|
|
5757
5843
|
delayDuration = 0,
|
|
5758
5844
|
...props
|
|
5759
5845
|
}) {
|
|
5760
|
-
return /* @__PURE__ */ (0,
|
|
5846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5761
5847
|
TooltipPrimitive.Provider,
|
|
5762
5848
|
{
|
|
5763
5849
|
"data-slot": "tooltip-provider",
|
|
@@ -5769,12 +5855,12 @@ function TooltipProvider({
|
|
|
5769
5855
|
function Tooltip({
|
|
5770
5856
|
...props
|
|
5771
5857
|
}) {
|
|
5772
|
-
return /* @__PURE__ */ (0,
|
|
5858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
5773
5859
|
}
|
|
5774
5860
|
function TooltipTrigger({
|
|
5775
5861
|
...props
|
|
5776
5862
|
}) {
|
|
5777
|
-
return /* @__PURE__ */ (0,
|
|
5863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
5778
5864
|
}
|
|
5779
5865
|
function TooltipContent({
|
|
5780
5866
|
className,
|
|
@@ -5783,7 +5869,7 @@ function TooltipContent({
|
|
|
5783
5869
|
hideArrow,
|
|
5784
5870
|
...props
|
|
5785
5871
|
}) {
|
|
5786
|
-
return /* @__PURE__ */ (0,
|
|
5872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
5787
5873
|
TooltipPrimitive.Content,
|
|
5788
5874
|
{
|
|
5789
5875
|
"data-slot": "tooltip-content",
|
|
@@ -5795,14 +5881,14 @@ function TooltipContent({
|
|
|
5795
5881
|
...props,
|
|
5796
5882
|
children: [
|
|
5797
5883
|
children,
|
|
5798
|
-
!hideArrow && /* @__PURE__ */ (0,
|
|
5884
|
+
!hideArrow && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 rotate-45 rounded-[2px]" })
|
|
5799
5885
|
]
|
|
5800
5886
|
}
|
|
5801
5887
|
) });
|
|
5802
5888
|
}
|
|
5803
5889
|
|
|
5804
5890
|
// src/components/Navigation/Stages/Stages.tsx
|
|
5805
|
-
var
|
|
5891
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
5806
5892
|
var StagesComponent = ({
|
|
5807
5893
|
stages,
|
|
5808
5894
|
isShowBtn,
|
|
@@ -5819,11 +5905,11 @@ var StagesComponent = ({
|
|
|
5819
5905
|
canvasMode = "desktop",
|
|
5820
5906
|
...props
|
|
5821
5907
|
}) => {
|
|
5822
|
-
const [activeStage, setActiveStage] = (0,
|
|
5823
|
-
const [isCompleted, setIsCompleted] = (0,
|
|
5824
|
-
const [activeChildStage, setActiveChildStage] = (0,
|
|
5825
|
-
const [activeRootStage, setActiveRootStage] = (0,
|
|
5826
|
-
(0,
|
|
5908
|
+
const [activeStage, setActiveStage] = (0, import_react35.useState)("");
|
|
5909
|
+
const [isCompleted, setIsCompleted] = (0, import_react35.useState)(false);
|
|
5910
|
+
const [activeChildStage, setActiveChildStage] = (0, import_react35.useState)(null);
|
|
5911
|
+
const [activeRootStage, setActiveRootStage] = (0, import_react35.useState)(null);
|
|
5912
|
+
(0, import_react35.useEffect)(() => {
|
|
5827
5913
|
if (currentStage) {
|
|
5828
5914
|
setActiveStage(currentStage);
|
|
5829
5915
|
} else {
|
|
@@ -5885,7 +5971,7 @@ var StagesComponent = ({
|
|
|
5885
5971
|
}
|
|
5886
5972
|
return { activeRoot: null, activeChild: null };
|
|
5887
5973
|
};
|
|
5888
|
-
(0,
|
|
5974
|
+
(0, import_react35.useEffect)(() => {
|
|
5889
5975
|
if (!currentStage || !Array.isArray(stages)) {
|
|
5890
5976
|
setActiveRootStage(null);
|
|
5891
5977
|
setActiveChildStage(null);
|
|
@@ -5898,7 +5984,7 @@ var StagesComponent = ({
|
|
|
5898
5984
|
const isAllStagesCompleted = isCompleted;
|
|
5899
5985
|
const disabled = isAllStagesCompleted || loading || saving;
|
|
5900
5986
|
const primaryColor = props.primaryColor || "#12715b";
|
|
5901
|
-
return /* @__PURE__ */ (0,
|
|
5987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
5902
5988
|
"div",
|
|
5903
5989
|
{
|
|
5904
5990
|
className: `
|
|
@@ -5908,8 +5994,8 @@ var StagesComponent = ({
|
|
|
5908
5994
|
${isMobile ? "p-3 sm:p-4" : "p-2"}
|
|
5909
5995
|
`,
|
|
5910
5996
|
children: [
|
|
5911
|
-
/* @__PURE__ */ (0,
|
|
5912
|
-
/* @__PURE__ */ (0,
|
|
5997
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "flex items-center flex-shrink-0 order-1 lg:order-1", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "p-2 hover:bg-gray-100 rounded flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("svg", { className: "w-4 h-4 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }) }),
|
|
5998
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5913
5999
|
"div",
|
|
5914
6000
|
{
|
|
5915
6001
|
className: `
|
|
@@ -5917,7 +6003,7 @@ var StagesComponent = ({
|
|
|
5917
6003
|
flex-wrap gap-2 sm:gap-2 lg:gap-3 w-full lg:w-auto
|
|
5918
6004
|
${isMobile ? "order-2 mt-2 lg:mt-0" : "order-2"}
|
|
5919
6005
|
`,
|
|
5920
|
-
children: loading ? Array(6).fill(null).map((_, index) => /* @__PURE__ */ (0,
|
|
6006
|
+
children: loading ? Array(6).fill(null).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5921
6007
|
"button",
|
|
5922
6008
|
{
|
|
5923
6009
|
className: `
|
|
@@ -5973,8 +6059,8 @@ var StagesComponent = ({
|
|
|
5973
6059
|
}
|
|
5974
6060
|
}
|
|
5975
6061
|
const stageKey = typeof stage[dataKey] === "string" ? stage[dataKey] : JSON.stringify(stage[dataKey]);
|
|
5976
|
-
return /* @__PURE__ */ (0,
|
|
5977
|
-
/* @__PURE__ */ (0,
|
|
6062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react35.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Tooltip, { delayDuration: 500, disableHoverableContent: true, children: [
|
|
6063
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5978
6064
|
"button",
|
|
5979
6065
|
{
|
|
5980
6066
|
className: `
|
|
@@ -5992,21 +6078,21 @@ var StagesComponent = ({
|
|
|
5992
6078
|
children: stageLabel
|
|
5993
6079
|
}
|
|
5994
6080
|
) }),
|
|
5995
|
-
/* @__PURE__ */ (0,
|
|
5996
|
-
!isMobile && index < safeStages.length - 1 && /* @__PURE__ */ (0,
|
|
6081
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(TooltipContent, { side: "top", sideOffset: 6, hideArrow: true, children: stageLabel }),
|
|
6082
|
+
!isMobile && index < safeStages.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "hidden sm:flex sm:flex-shrink-0 w-3 h-px bg-gray-300 sm:w-4" })
|
|
5997
6083
|
] }, stageKey) }, stageKey);
|
|
5998
6084
|
});
|
|
5999
6085
|
})()
|
|
6000
6086
|
}
|
|
6001
6087
|
),
|
|
6002
|
-
isShowBtn && /* @__PURE__ */ (0,
|
|
6088
|
+
isShowBtn && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6003
6089
|
"div",
|
|
6004
6090
|
{
|
|
6005
6091
|
className: `
|
|
6006
6092
|
flex items-center flex-shrink-0 w-full lg:w-auto
|
|
6007
6093
|
${isMobile ? "order-3 mt-3 lg:mt-0" : "order-3"}
|
|
6008
6094
|
`,
|
|
6009
|
-
children: /* @__PURE__ */ (0,
|
|
6095
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6010
6096
|
"button",
|
|
6011
6097
|
{
|
|
6012
6098
|
className: `
|
|
@@ -6029,33 +6115,33 @@ var StagesComponent = ({
|
|
|
6029
6115
|
var Stages_default = StagesComponent;
|
|
6030
6116
|
|
|
6031
6117
|
// src/components/Navigation/Spacer/Spacer.tsx
|
|
6032
|
-
var
|
|
6118
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6033
6119
|
var Spacer = ({ className, style }) => {
|
|
6034
|
-
return /* @__PURE__ */ (0,
|
|
6120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: `${className}`, style });
|
|
6035
6121
|
};
|
|
6036
6122
|
var Spacer_default = Spacer;
|
|
6037
6123
|
|
|
6038
6124
|
// src/components/Navigation/Profile/Profile.tsx
|
|
6039
|
-
var
|
|
6125
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6040
6126
|
|
|
6041
6127
|
// src/components/Navigation/Notification/Notification.tsx
|
|
6042
|
-
var
|
|
6128
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6043
6129
|
|
|
6044
6130
|
// src/components/Navigation/Logo/Logo.tsx
|
|
6045
|
-
var
|
|
6131
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6046
6132
|
|
|
6047
6133
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
6048
|
-
var
|
|
6049
|
-
var
|
|
6134
|
+
var import_react36 = require("react");
|
|
6135
|
+
var import_lucide_react19 = require("lucide-react");
|
|
6050
6136
|
var import_image2 = __toESM(require("next/image"));
|
|
6051
6137
|
var import_link4 = __toESM(require("next/link"));
|
|
6052
6138
|
var import_navigation3 = require("next/navigation");
|
|
6053
6139
|
|
|
6054
6140
|
// src/components/ui/avatar.tsx
|
|
6055
|
-
var
|
|
6141
|
+
var React14 = __toESM(require("react"));
|
|
6056
6142
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
6057
|
-
var
|
|
6058
|
-
var Avatar =
|
|
6143
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6144
|
+
var Avatar = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
6059
6145
|
AvatarPrimitive.Root,
|
|
6060
6146
|
{
|
|
6061
6147
|
ref,
|
|
@@ -6067,7 +6153,7 @@ var Avatar = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
6067
6153
|
}
|
|
6068
6154
|
));
|
|
6069
6155
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
6070
|
-
var AvatarImage =
|
|
6156
|
+
var AvatarImage = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
6071
6157
|
AvatarPrimitive.Image,
|
|
6072
6158
|
{
|
|
6073
6159
|
ref,
|
|
@@ -6076,7 +6162,7 @@ var AvatarImage = React13.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
6076
6162
|
}
|
|
6077
6163
|
));
|
|
6078
6164
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
6079
|
-
var AvatarFallback =
|
|
6165
|
+
var AvatarFallback = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
6080
6166
|
AvatarPrimitive.Fallback,
|
|
6081
6167
|
{
|
|
6082
6168
|
ref,
|
|
@@ -6090,7 +6176,7 @@ var AvatarFallback = React13.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
6090
6176
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
6091
6177
|
|
|
6092
6178
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
6093
|
-
var
|
|
6179
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
6094
6180
|
function Navbar({
|
|
6095
6181
|
style,
|
|
6096
6182
|
badgeType,
|
|
@@ -6112,10 +6198,10 @@ function Navbar({
|
|
|
6112
6198
|
primaryColor = "#2a55a3"
|
|
6113
6199
|
}) {
|
|
6114
6200
|
const router = (0, import_navigation3.useRouter)();
|
|
6115
|
-
const [screenMode, setScreenMode] = (0,
|
|
6201
|
+
const [screenMode, setScreenMode] = (0, import_react36.useState)(
|
|
6116
6202
|
canvasMode
|
|
6117
6203
|
);
|
|
6118
|
-
(0,
|
|
6204
|
+
(0, import_react36.useEffect)(() => {
|
|
6119
6205
|
const detectMode = () => {
|
|
6120
6206
|
if (window.innerWidth < 640) setScreenMode("mobile");
|
|
6121
6207
|
else if (window.innerWidth < 1024) setScreenMode("tablet");
|
|
@@ -6129,7 +6215,7 @@ function Navbar({
|
|
|
6129
6215
|
const isMobile = mode === "mobile";
|
|
6130
6216
|
const isTablet = mode === "tablet";
|
|
6131
6217
|
const isDesktop = mode === "desktop";
|
|
6132
|
-
const handleBuilderExit = (0,
|
|
6218
|
+
const handleBuilderExit = (0, import_react36.useCallback)(
|
|
6133
6219
|
(e, url) => {
|
|
6134
6220
|
if (isBuilder) {
|
|
6135
6221
|
e.preventDefault();
|
|
@@ -6140,7 +6226,7 @@ function Navbar({
|
|
|
6140
6226
|
},
|
|
6141
6227
|
[isBuilder]
|
|
6142
6228
|
);
|
|
6143
|
-
const formattedMenu = (0,
|
|
6229
|
+
const formattedMenu = (0, import_react36.useMemo)(() => {
|
|
6144
6230
|
if (source === "state" && navList?.length) {
|
|
6145
6231
|
return navList.map((i) => ({
|
|
6146
6232
|
...i,
|
|
@@ -6149,9 +6235,9 @@ function Navbar({
|
|
|
6149
6235
|
}
|
|
6150
6236
|
return list;
|
|
6151
6237
|
}, [source, navList, list]);
|
|
6152
|
-
const RenderSearchInput = () => /* @__PURE__ */ (0,
|
|
6153
|
-
/* @__PURE__ */ (0,
|
|
6154
|
-
/* @__PURE__ */ (0,
|
|
6238
|
+
const RenderSearchInput = () => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "flex-1 px-2", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "relative w-full max-w-md border border-gray-300 rounded-md", children: [
|
|
6239
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_lucide_react19.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 dark:text-white text-gray-400" }),
|
|
6240
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
6155
6241
|
Input,
|
|
6156
6242
|
{
|
|
6157
6243
|
placeholder: "Search",
|
|
@@ -6167,23 +6253,23 @@ function Navbar({
|
|
|
6167
6253
|
}
|
|
6168
6254
|
)
|
|
6169
6255
|
] }) });
|
|
6170
|
-
return /* @__PURE__ */ (0,
|
|
6171
|
-
/* @__PURE__ */ (0,
|
|
6256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
6257
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
6172
6258
|
"nav",
|
|
6173
6259
|
{
|
|
6174
6260
|
className: "w-full min-h-[75px] border-b border-gray-200 dark:border-gray-800 dark:bg-gray-800 bg-white shadow-sm",
|
|
6175
6261
|
style,
|
|
6176
|
-
children: /* @__PURE__ */ (0,
|
|
6177
|
-
/* @__PURE__ */ (0,
|
|
6262
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "mx-auto flex max-w-[90%] items-center justify-between px-4 py-4", children: [
|
|
6263
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
6178
6264
|
import_link4.default,
|
|
6179
6265
|
{
|
|
6180
6266
|
href: "/",
|
|
6181
6267
|
onClick: (e) => handleBuilderExit(e, "/"),
|
|
6182
6268
|
className: "flex items-center space-x-2",
|
|
6183
|
-
children: imageUrl ? /* @__PURE__ */ (0,
|
|
6269
|
+
children: imageUrl ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_image2.default, { src: imageUrl, alt: altText, width: 180, height: 40 }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "font-semibold text-blue-700", children: "Logo" })
|
|
6184
6270
|
}
|
|
6185
6271
|
),
|
|
6186
|
-
isDesktop && /* @__PURE__ */ (0,
|
|
6272
|
+
isDesktop && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "hidden md:flex items-center space-x-6", children: formattedMenu.map((item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
6187
6273
|
import_link4.default,
|
|
6188
6274
|
{
|
|
6189
6275
|
href: item.url,
|
|
@@ -6193,23 +6279,23 @@ function Navbar({
|
|
|
6193
6279
|
},
|
|
6194
6280
|
item.id
|
|
6195
6281
|
)) }),
|
|
6196
|
-
/* @__PURE__ */ (0,
|
|
6197
|
-
(isDesktop || isTablet) && /* @__PURE__ */ (0,
|
|
6198
|
-
/* @__PURE__ */ (0,
|
|
6199
|
-
/* @__PURE__ */ (0,
|
|
6200
|
-
badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ (0,
|
|
6282
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center space-x-3", children: [
|
|
6283
|
+
(isDesktop || isTablet) && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(RenderSearchInput, {}),
|
|
6284
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "relative bg-gray-200 dark:bg-gray-700 rounded-md", children: [
|
|
6285
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_lucide_react19.Bell, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }) }),
|
|
6286
|
+
badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "absolute -top-1 -right-1 h-4 w-4 flex items-center justify-center bg-red-500 rounded-full text-white text-[10px]", children: badgeCount }) : !hideBadgeWhenZero && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "absolute -top-1 -right-1 h-2 w-2 bg-red-500 rounded-full" })
|
|
6201
6287
|
] }),
|
|
6202
|
-
/* @__PURE__ */ (0,
|
|
6203
|
-
/* @__PURE__ */ (0,
|
|
6204
|
-
!isMobile && showName && /* @__PURE__ */ (0,
|
|
6205
|
-
/* @__PURE__ */ (0,
|
|
6206
|
-
(isMobile || isTablet) && /* @__PURE__ */ (0,
|
|
6288
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(DropdownMenu, { children: [
|
|
6289
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
6290
|
+
!isMobile && showName && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h4", { className: "text-gray-900 dark:text-gray-300 text-sm", children: userName }),
|
|
6291
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Avatar, { className: "h-8 w-8", children: profileType === "avatar" ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(AvatarImage, { src: "/images/appbuilder/toolset/profile.svg", alt: "profile" }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: `bg-[${primaryColor}] text-white h-full w-full rounded-full flex items-center justify-center text-xs`, style: { backgroundColor: primaryColor }, children: getInitials(userName) }) }),
|
|
6292
|
+
(isMobile || isTablet) && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_lucide_react19.Menu, { className: "h-6 w-6" }) })
|
|
6207
6293
|
] }) }),
|
|
6208
|
-
/* @__PURE__ */ (0,
|
|
6209
|
-
profileMenu.map((item) => /* @__PURE__ */ (0,
|
|
6210
|
-
(isMobile || isTablet) && /* @__PURE__ */ (0,
|
|
6211
|
-
/* @__PURE__ */ (0,
|
|
6212
|
-
formattedMenu.map((item) => /* @__PURE__ */ (0,
|
|
6294
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(DropdownMenuContent, { align: "end", className: "bg-white dark:bg-gray-800", children: [
|
|
6295
|
+
profileMenu.map((item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DropdownMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_link4.default, { href: item.url, onClick: (e) => handleBuilderExit(e, item.url), children: item.header }) }, item.id)),
|
|
6296
|
+
(isMobile || isTablet) && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
6297
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DropdownMenuSeparator, {}),
|
|
6298
|
+
formattedMenu.map((item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DropdownMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_link4.default, { href: item.url, onClick: (e) => handleBuilderExit(e, item.url), children: item.header }) }, item.id))
|
|
6213
6299
|
] })
|
|
6214
6300
|
] })
|
|
6215
6301
|
] })
|
|
@@ -6217,15 +6303,15 @@ function Navbar({
|
|
|
6217
6303
|
] })
|
|
6218
6304
|
}
|
|
6219
6305
|
),
|
|
6220
|
-
isMobile && /* @__PURE__ */ (0,
|
|
6306
|
+
isMobile && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(RenderSearchInput, {}) })
|
|
6221
6307
|
] });
|
|
6222
6308
|
}
|
|
6223
6309
|
|
|
6224
6310
|
// src/components/Chart/BarChart.tsx
|
|
6225
|
-
var
|
|
6311
|
+
var import_react37 = __toESM(require("react"));
|
|
6226
6312
|
var import_axios4 = __toESM(require("axios"));
|
|
6227
6313
|
var import_recharts = require("recharts");
|
|
6228
|
-
var
|
|
6314
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
6229
6315
|
var palette = [
|
|
6230
6316
|
"#2563eb",
|
|
6231
6317
|
"#1d4ed8",
|
|
@@ -6285,18 +6371,18 @@ var ChartComponent = ({
|
|
|
6285
6371
|
...props
|
|
6286
6372
|
}) => {
|
|
6287
6373
|
const useApi = source === "api" && !!apiUrl;
|
|
6288
|
-
const [rawData, setRawData] = (0,
|
|
6289
|
-
const [rawMeta, setRawMeta] = (0,
|
|
6290
|
-
const [localLoading, setLocalLoading] = (0,
|
|
6291
|
-
const [currentPage, setCurrentPage] = (0,
|
|
6374
|
+
const [rawData, setRawData] = (0, import_react37.useState)([]);
|
|
6375
|
+
const [rawMeta, setRawMeta] = (0, import_react37.useState)(null);
|
|
6376
|
+
const [localLoading, setLocalLoading] = (0, import_react37.useState)(false);
|
|
6377
|
+
const [currentPage, setCurrentPage] = (0, import_react37.useState)(1);
|
|
6292
6378
|
const effectiveData = useApi ? rawData : props.data || [];
|
|
6293
6379
|
const effectiveLoading = useApi ? localLoading : externalLoading;
|
|
6294
|
-
(0,
|
|
6380
|
+
(0, import_react37.useEffect)(() => {
|
|
6295
6381
|
if (useApi) {
|
|
6296
6382
|
setCurrentPage(1);
|
|
6297
6383
|
}
|
|
6298
6384
|
}, [useApi]);
|
|
6299
|
-
const fetchData = (0,
|
|
6385
|
+
const fetchData = (0, import_react37.useCallback)(async (page) => {
|
|
6300
6386
|
if (!apiUrl) return;
|
|
6301
6387
|
const cancelled = false;
|
|
6302
6388
|
try {
|
|
@@ -6333,7 +6419,7 @@ var ChartComponent = ({
|
|
|
6333
6419
|
if (!cancelled) setLocalLoading(false);
|
|
6334
6420
|
}
|
|
6335
6421
|
}, [apiUrl, limit]);
|
|
6336
|
-
(0,
|
|
6422
|
+
(0, import_react37.useEffect)(() => {
|
|
6337
6423
|
if (!useApi) return;
|
|
6338
6424
|
fetchData(currentPage);
|
|
6339
6425
|
}, [useApi, currentPage, fetchData]);
|
|
@@ -6341,7 +6427,7 @@ var ChartComponent = ({
|
|
|
6341
6427
|
if (rawMeta && (newPage < 1 || newPage > rawMeta.pages)) return;
|
|
6342
6428
|
setCurrentPage(newPage);
|
|
6343
6429
|
};
|
|
6344
|
-
const data = (0,
|
|
6430
|
+
const data = (0, import_react37.useMemo)(() => {
|
|
6345
6431
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0 || !dataKey || !dataLabel) {
|
|
6346
6432
|
return [];
|
|
6347
6433
|
}
|
|
@@ -6353,10 +6439,10 @@ var ChartComponent = ({
|
|
|
6353
6439
|
}, [effectiveData, dataKey, dataLabel]);
|
|
6354
6440
|
const chartType = props.chartType || "bar";
|
|
6355
6441
|
const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
|
|
6356
|
-
const renderLegends = (0,
|
|
6442
|
+
const renderLegends = (0, import_react37.useMemo)(() => {
|
|
6357
6443
|
if (!showLegends || !dataKey || !dataLabel) return null;
|
|
6358
6444
|
const isLegendRight2 = !forceMobile && legendPosition === "right";
|
|
6359
|
-
return /* @__PURE__ */ (0,
|
|
6445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6360
6446
|
"div",
|
|
6361
6447
|
{
|
|
6362
6448
|
className: isLegendRight2 ? "flex flex-col gap-2 w-full min-w-0 justify-start overflow-y-auto max-h-[260px]" : "flex flex-wrap justify-center gap-2 mt-4 w-full max-w-4xl",
|
|
@@ -6369,7 +6455,7 @@ var ChartComponent = ({
|
|
|
6369
6455
|
[dataLabel]: d[dataLabel],
|
|
6370
6456
|
[dataKey]: value
|
|
6371
6457
|
};
|
|
6372
|
-
return /* @__PURE__ */ (0,
|
|
6458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
6373
6459
|
"div",
|
|
6374
6460
|
{
|
|
6375
6461
|
role: onLegendClick ? "button" : void 0,
|
|
@@ -6378,16 +6464,16 @@ var ChartComponent = ({
|
|
|
6378
6464
|
onKeyDown: onLegendClick ? (e) => e.key === "Enter" && onLegendClick(payload) : void 0,
|
|
6379
6465
|
className: `flex items-center space-x-2 rounded-lg border border-gray-200/50 px-3 py-1.5 min-w-[180px] w-[180px] bg-white/80 backdrop-blur-sm shadow-sm hover:shadow-md transition-all ${onLegendClick ? "cursor-pointer" : ""}`,
|
|
6380
6466
|
children: [
|
|
6381
|
-
/* @__PURE__ */ (0,
|
|
6467
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6382
6468
|
"span",
|
|
6383
6469
|
{
|
|
6384
6470
|
className: "inline-block w-[12px] h-[12px] rounded-full shrink-0 border-2 border-white/50",
|
|
6385
6471
|
style: { backgroundColor: d.fill }
|
|
6386
6472
|
}
|
|
6387
6473
|
),
|
|
6388
|
-
/* @__PURE__ */ (0,
|
|
6389
|
-
/* @__PURE__ */ (0,
|
|
6390
|
-
/* @__PURE__ */ (0,
|
|
6474
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
6475
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-gray-900 text-[11px] md:text-[13px] font-semibold block truncate leading-tight capitalize", children: d[dataLabel] }),
|
|
6476
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-xs text-gray-600 font-medium", children: displayValue })
|
|
6391
6477
|
] })
|
|
6392
6478
|
]
|
|
6393
6479
|
},
|
|
@@ -6398,27 +6484,27 @@ var ChartComponent = ({
|
|
|
6398
6484
|
);
|
|
6399
6485
|
}, [data, dataLabel, dataKey, showLegends, onLegendClick, legendPosition, forceMobile]);
|
|
6400
6486
|
if (effectiveLoading) {
|
|
6401
|
-
return /* @__PURE__ */ (0,
|
|
6487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
6402
6488
|
"div",
|
|
6403
6489
|
{
|
|
6404
6490
|
className: `relative flex flex-col w-full h-[300px] md:h-[400px] bg-gradient-to-br from-gray-50 to-gray-100 rounded-xl p-6 ${className}`,
|
|
6405
6491
|
style,
|
|
6406
6492
|
children: [
|
|
6407
|
-
/* @__PURE__ */ (0,
|
|
6408
|
-
/* @__PURE__ */ (0,
|
|
6409
|
-
/* @__PURE__ */ (0,
|
|
6493
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "mb-6 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "inline-flex items-center space-x-2 bg-white/90 px-6 py-2.5 rounded-xl backdrop-blur-sm border border-gray-200 shadow-lg", children: [
|
|
6494
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "w-5 h-5 border-2 border-gray-400 border-t-blue-500 rounded-full animate-spin" }),
|
|
6495
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-sm font-medium text-gray-700 bg-gradient-to-r from-gray-300 bg-clip-text animate-pulse", children: "Loading chart data..." })
|
|
6410
6496
|
] }) }),
|
|
6411
|
-
/* @__PURE__ */ (0,
|
|
6412
|
-
/* @__PURE__ */ (0,
|
|
6497
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white/60 to-transparent animate-shimmer rounded-xl" }),
|
|
6498
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "flex-1 relative w-full h-full min-h-[240px] md:min-h-[320px] bg-white/80 rounded-lg border border-gray-200/50 shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "absolute bottom-0 left-4 right-4 flex gap-2 h-[200px] md:h-[280px] justify-center items-end", children: [...Array(20)].map((_, idx) => {
|
|
6413
6499
|
const randomHeight = `${Math.floor(Math.random() * 76) + 20}%`;
|
|
6414
|
-
return /* @__PURE__ */ (0,
|
|
6500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
6415
6501
|
"div",
|
|
6416
6502
|
{
|
|
6417
6503
|
className: `relative w-10 md:w-12 flex-1 max-w-[48px] rounded-t-lg bg-gradient-to-t from-gray-100 via-gray-200 to-transparent shadow-lg border border-gray-200/50 animate-slide-up stagger-${idx} overflow-hidden`,
|
|
6418
6504
|
style: { height: randomHeight, animationDelay: `${idx * 0.08}s` },
|
|
6419
6505
|
children: [
|
|
6420
|
-
/* @__PURE__ */ (0,
|
|
6421
|
-
/* @__PURE__ */ (0,
|
|
6506
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "absolute inset-0 bg-gradient-to-r from-white/40 via-transparent to-white/40 animate-shimmer-bar" }),
|
|
6507
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "absolute bottom-1 left-1/2 w-4 h-1 rounded-full transform -translate-x-1/2 blur-sm" })
|
|
6422
6508
|
]
|
|
6423
6509
|
},
|
|
6424
6510
|
`bar-${idx}`
|
|
@@ -6429,74 +6515,74 @@ var ChartComponent = ({
|
|
|
6429
6515
|
);
|
|
6430
6516
|
}
|
|
6431
6517
|
if (data.length === 0) {
|
|
6432
|
-
return /* @__PURE__ */ (0,
|
|
6518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6433
6519
|
"div",
|
|
6434
6520
|
{
|
|
6435
6521
|
className: `relative flex flex-col items-center justify-center w-full h-[300px] md:h-[400px] bg-gradient-to-br from-gray-50 to-gray-100 rounded-xl p-6 ${className}`,
|
|
6436
6522
|
style,
|
|
6437
|
-
children: /* @__PURE__ */ (0,
|
|
6523
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "text-center", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "inline-flex items-center space-x-2 bg-white/80 px-6 py-3 rounded-xl backdrop-blur-sm border border-gray-200 shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-sm font-medium text-gray-600", children: "No data" }) }) })
|
|
6438
6524
|
}
|
|
6439
6525
|
);
|
|
6440
6526
|
}
|
|
6441
6527
|
const isLegendRight = !forceMobile && legendPosition === "right";
|
|
6442
|
-
return /* @__PURE__ */ (0,
|
|
6528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
6443
6529
|
"div",
|
|
6444
6530
|
{
|
|
6445
6531
|
className: `relative flex ${isLegendRight ? "flex-row items-stretch gap-4" : "flex-col items-center"} ${className}`,
|
|
6446
6532
|
style,
|
|
6447
6533
|
children: [
|
|
6448
|
-
/* @__PURE__ */ (0,
|
|
6534
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
6449
6535
|
"div",
|
|
6450
6536
|
{
|
|
6451
6537
|
className: `relative flex items-center justify-center ${isLegendRight ? "flex-[2] min-w-0 max-w-[70%] h-[450px]" : "w-full md:w-[75%] h-[450px] mb-2"}`,
|
|
6452
6538
|
children: [
|
|
6453
|
-
isPaginationEnabled && rawMeta && /* @__PURE__ */ (0,
|
|
6454
|
-
/* @__PURE__ */ (0,
|
|
6455
|
-
/* @__PURE__ */ (0,
|
|
6539
|
+
isPaginationEnabled && rawMeta && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex items-center justify-between mb-4 px-2", children: [
|
|
6540
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex items-center space-x-2 sm:hidden w-full justify-center", children: [
|
|
6541
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6456
6542
|
"button",
|
|
6457
6543
|
{
|
|
6458
6544
|
onClick: () => handlePageChange(currentPage - 1),
|
|
6459
6545
|
disabled: currentPage === 1 || localLoading,
|
|
6460
6546
|
className: "flex-1 px-3 py-2 text-xs font-medium rounded-lg border bg-white shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 flex items-center justify-center space-x-1 min-w-0",
|
|
6461
|
-
children: /* @__PURE__ */ (0,
|
|
6547
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: "\u2190 Prev" })
|
|
6462
6548
|
}
|
|
6463
6549
|
),
|
|
6464
|
-
/* @__PURE__ */ (0,
|
|
6465
|
-
/* @__PURE__ */ (0,
|
|
6550
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "px-2 py-2 text-xs font-semibold text-gray-700 min-w-[36px] text-center flex-shrink-0", children: currentPage }),
|
|
6551
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6466
6552
|
"button",
|
|
6467
6553
|
{
|
|
6468
6554
|
onClick: () => handlePageChange(currentPage + 1),
|
|
6469
6555
|
disabled: currentPage >= rawMeta.pages || localLoading,
|
|
6470
6556
|
className: "flex-1 px-3 py-2 text-xs font-medium rounded-lg border bg-white shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 flex items-center justify-center space-x-1 min-w-0",
|
|
6471
|
-
children: /* @__PURE__ */ (0,
|
|
6557
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: "Next \u2192" })
|
|
6472
6558
|
}
|
|
6473
6559
|
)
|
|
6474
6560
|
] }),
|
|
6475
|
-
/* @__PURE__ */ (0,
|
|
6476
|
-
/* @__PURE__ */ (0,
|
|
6561
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "hidden sm:flex items-center space-x-2", children: [
|
|
6562
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6477
6563
|
"button",
|
|
6478
6564
|
{
|
|
6479
6565
|
onClick: () => handlePageChange(currentPage - 1),
|
|
6480
6566
|
disabled: currentPage === 1 || localLoading,
|
|
6481
6567
|
className: "px-3 py-1.5 text-sm font-medium rounded-lg border bg-white shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 flex items-center space-x-1",
|
|
6482
|
-
children: /* @__PURE__ */ (0,
|
|
6568
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: "\u2190 Prev" })
|
|
6483
6569
|
}
|
|
6484
6570
|
),
|
|
6485
|
-
/* @__PURE__ */ (0,
|
|
6486
|
-
/* @__PURE__ */ (0,
|
|
6571
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "px-3 py-1 text-sm font-medium text-gray-700", children: currentPage }),
|
|
6572
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6487
6573
|
"button",
|
|
6488
6574
|
{
|
|
6489
6575
|
onClick: () => handlePageChange(currentPage + 1),
|
|
6490
6576
|
disabled: currentPage >= rawMeta.pages || localLoading,
|
|
6491
6577
|
className: "px-3 py-1.5 text-sm font-medium rounded-lg border bg-white shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 flex items-center space-x-1",
|
|
6492
|
-
children: /* @__PURE__ */ (0,
|
|
6578
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: "Next \u2192" })
|
|
6493
6579
|
}
|
|
6494
6580
|
)
|
|
6495
6581
|
] })
|
|
6496
6582
|
] }),
|
|
6497
|
-
/* @__PURE__ */ (0,
|
|
6498
|
-
/* @__PURE__ */ (0,
|
|
6499
|
-
/* @__PURE__ */ (0,
|
|
6583
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height: "100%", children: chartType === "bar" ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_recharts.BarChart, { data, children: [
|
|
6584
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_recharts.CartesianGrid, { strokeDasharray: "3 3" }),
|
|
6585
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6500
6586
|
import_recharts.XAxis,
|
|
6501
6587
|
{
|
|
6502
6588
|
dataKey: dataLabel,
|
|
@@ -6514,7 +6600,7 @@ var ChartComponent = ({
|
|
|
6514
6600
|
className: "hidden sm:block"
|
|
6515
6601
|
}
|
|
6516
6602
|
),
|
|
6517
|
-
/* @__PURE__ */ (0,
|
|
6603
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6518
6604
|
import_recharts.YAxis,
|
|
6519
6605
|
{
|
|
6520
6606
|
tickFormatter: (value) => `${(value / 1e3).toFixed(0)}k`,
|
|
@@ -6527,8 +6613,8 @@ var ChartComponent = ({
|
|
|
6527
6613
|
width: 60
|
|
6528
6614
|
}
|
|
6529
6615
|
),
|
|
6530
|
-
/* @__PURE__ */ (0,
|
|
6531
|
-
/* @__PURE__ */ (0,
|
|
6616
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_recharts.Tooltip, { formatter: (value) => value != null ? [`${value}`, "Count"] : ["", "Count"] }),
|
|
6617
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6532
6618
|
import_recharts.Bar,
|
|
6533
6619
|
{
|
|
6534
6620
|
dataKey,
|
|
@@ -6536,13 +6622,13 @@ var ChartComponent = ({
|
|
|
6536
6622
|
isAnimationActive: false
|
|
6537
6623
|
}
|
|
6538
6624
|
)
|
|
6539
|
-
] }) : /* @__PURE__ */ (0,
|
|
6540
|
-
/* @__PURE__ */ (0,
|
|
6541
|
-
/* @__PURE__ */ (0,
|
|
6542
|
-
/* @__PURE__ */ (0,
|
|
6625
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_recharts.AreaChart, { data, children: [
|
|
6626
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("linearGradient", { id: "colorCount", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("stop", { offset: "5%", stopColor: "#00695C", stopOpacity: 0.8 }),
|
|
6628
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("stop", { offset: "95%", stopColor: "#00695C", stopOpacity: 0 })
|
|
6543
6629
|
] }) }),
|
|
6544
|
-
/* @__PURE__ */ (0,
|
|
6545
|
-
/* @__PURE__ */ (0,
|
|
6630
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_recharts.CartesianGrid, { strokeDasharray: "3 3" }),
|
|
6631
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6546
6632
|
import_recharts.XAxis,
|
|
6547
6633
|
{
|
|
6548
6634
|
dataKey: dataLabel,
|
|
@@ -6556,7 +6642,7 @@ var ChartComponent = ({
|
|
|
6556
6642
|
}
|
|
6557
6643
|
}
|
|
6558
6644
|
),
|
|
6559
|
-
/* @__PURE__ */ (0,
|
|
6645
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6560
6646
|
import_recharts.YAxis,
|
|
6561
6647
|
{
|
|
6562
6648
|
tickFormatter: (value) => `${(value / 1e3).toFixed(0)}k`,
|
|
@@ -6569,8 +6655,8 @@ var ChartComponent = ({
|
|
|
6569
6655
|
width: 60
|
|
6570
6656
|
}
|
|
6571
6657
|
),
|
|
6572
|
-
/* @__PURE__ */ (0,
|
|
6573
|
-
/* @__PURE__ */ (0,
|
|
6658
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_recharts.Tooltip, { formatter: (value) => value != null ? `${value}k` : "" }),
|
|
6659
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6574
6660
|
import_recharts.Area,
|
|
6575
6661
|
{
|
|
6576
6662
|
type: "monotone",
|
|
@@ -6585,18 +6671,18 @@ var ChartComponent = ({
|
|
|
6585
6671
|
]
|
|
6586
6672
|
}
|
|
6587
6673
|
),
|
|
6588
|
-
showLegends && /* @__PURE__ */ (0,
|
|
6674
|
+
showLegends && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: isLegendRight ? "flex flex-col w-[30%] min-w-[180px] justify-center" : "w-full", children: renderLegends })
|
|
6589
6675
|
]
|
|
6590
6676
|
}
|
|
6591
6677
|
);
|
|
6592
6678
|
};
|
|
6593
|
-
var BarChart_default =
|
|
6679
|
+
var BarChart_default = import_react37.default.memo(ChartComponent);
|
|
6594
6680
|
|
|
6595
6681
|
// src/components/Chart/PieChart.tsx
|
|
6596
|
-
var
|
|
6682
|
+
var import_react38 = __toESM(require("react"));
|
|
6597
6683
|
var import_axios5 = __toESM(require("axios"));
|
|
6598
6684
|
var import_recharts2 = require("recharts");
|
|
6599
|
-
var
|
|
6685
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
6600
6686
|
var getRandomColor = () => {
|
|
6601
6687
|
const palette2 = [
|
|
6602
6688
|
"#2563eb",
|
|
@@ -6677,11 +6763,11 @@ var DonutChart = ({
|
|
|
6677
6763
|
const showLegends = props.showLegends ?? true;
|
|
6678
6764
|
const canvasMode = props.canvasMode;
|
|
6679
6765
|
const useApi = source === "api" && !!apiUrl;
|
|
6680
|
-
const [rawData, setRawData] = (0,
|
|
6681
|
-
const [localLoading, setLocalLoading] = (0,
|
|
6766
|
+
const [rawData, setRawData] = (0, import_react38.useState)([]);
|
|
6767
|
+
const [localLoading, setLocalLoading] = (0, import_react38.useState)(false);
|
|
6682
6768
|
const effectiveData = useApi ? rawData : props.data || [];
|
|
6683
6769
|
const effectiveLoading = useApi ? localLoading : externalLoading;
|
|
6684
|
-
(0,
|
|
6770
|
+
(0, import_react38.useEffect)(() => {
|
|
6685
6771
|
if (!useApi) return;
|
|
6686
6772
|
let cancelled = false;
|
|
6687
6773
|
const fetchData = async () => {
|
|
@@ -6717,7 +6803,7 @@ var DonutChart = ({
|
|
|
6717
6803
|
cancelled = true;
|
|
6718
6804
|
};
|
|
6719
6805
|
}, [useApi, apiUrl]);
|
|
6720
|
-
const data = (0,
|
|
6806
|
+
const data = (0, import_react38.useMemo)(() => {
|
|
6721
6807
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0) return [];
|
|
6722
6808
|
return effectiveData.map((item) => ({
|
|
6723
6809
|
...item,
|
|
@@ -6726,11 +6812,11 @@ var DonutChart = ({
|
|
|
6726
6812
|
[dataLabel]: item[dataLabel] ?? "Unknown"
|
|
6727
6813
|
}));
|
|
6728
6814
|
}, [effectiveData, dataKey, dataLabel]);
|
|
6729
|
-
const total = (0,
|
|
6815
|
+
const total = (0, import_react38.useMemo)(
|
|
6730
6816
|
() => data.reduce((sum, d) => sum + (d[dataKey] ?? 0), 0),
|
|
6731
6817
|
[data, dataKey]
|
|
6732
6818
|
);
|
|
6733
|
-
const formattedTotal = (0,
|
|
6819
|
+
const formattedTotal = (0, import_react38.useMemo)(() => {
|
|
6734
6820
|
if (total >= 1e6) {
|
|
6735
6821
|
return `${(total / 1e6).toFixed(1)}M`;
|
|
6736
6822
|
}
|
|
@@ -6739,7 +6825,7 @@ var DonutChart = ({
|
|
|
6739
6825
|
}
|
|
6740
6826
|
return total.toString();
|
|
6741
6827
|
}, [total]);
|
|
6742
|
-
const chartData = (0,
|
|
6828
|
+
const chartData = (0, import_react38.useMemo)(() => {
|
|
6743
6829
|
if (total === 0) return data;
|
|
6744
6830
|
const sortedData = [...data].sort((a, b) => (b[dataKey] ?? 0) - (a[dataKey] ?? 0));
|
|
6745
6831
|
const minAngle = 360 / Math.max(12, sortedData.length);
|
|
@@ -6762,15 +6848,15 @@ var DonutChart = ({
|
|
|
6762
6848
|
if (chartData.length <= 6) return { inner: 85, outer: 150 };
|
|
6763
6849
|
return { inner: 70, outer: 130 };
|
|
6764
6850
|
};
|
|
6765
|
-
const [mounted, setMounted] = (0,
|
|
6766
|
-
(0,
|
|
6851
|
+
const [mounted, setMounted] = (0, import_react38.useState)(false);
|
|
6852
|
+
(0, import_react38.useEffect)(() => {
|
|
6767
6853
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
6768
6854
|
return () => clearTimeout(timeout);
|
|
6769
6855
|
}, []);
|
|
6770
|
-
const renderLegends = (0,
|
|
6856
|
+
const renderLegends = (0, import_react38.useMemo)(() => {
|
|
6771
6857
|
if (!showLegends) return null;
|
|
6772
6858
|
const isLegendRight2 = !forceMobile && legendPosition === "right";
|
|
6773
|
-
return /* @__PURE__ */ (0,
|
|
6859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6774
6860
|
"div",
|
|
6775
6861
|
{
|
|
6776
6862
|
className: isLegendRight2 ? "flex flex-col gap-2 w-full min-w-0 justify-start overflow-y-auto max-h-[260px]" : "flex flex-wrap justify-center gap-2 mt-4 w-full max-w-4xl",
|
|
@@ -6785,7 +6871,7 @@ var DonutChart = ({
|
|
|
6785
6871
|
[dataLabel]: d[dataLabel],
|
|
6786
6872
|
[dataKey]: actualValue
|
|
6787
6873
|
};
|
|
6788
|
-
return /* @__PURE__ */ (0,
|
|
6874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
6789
6875
|
"div",
|
|
6790
6876
|
{
|
|
6791
6877
|
role: onLegendClick ? "button" : void 0,
|
|
@@ -6794,22 +6880,22 @@ var DonutChart = ({
|
|
|
6794
6880
|
onKeyDown: onLegendClick ? (e) => e.key === "Enter" && onLegendClick(payload) : void 0,
|
|
6795
6881
|
className: `flex items-center space-x-2 rounded-lg border border-gray-200/50 px-3 py-1.5 w-[48%] sm:w-[32%] md:w-auto bg-white/80 backdrop-blur-sm shadow-sm hover:shadow-md transition-all ${onLegendClick ? "cursor-pointer" : ""}`,
|
|
6796
6882
|
children: [
|
|
6797
|
-
/* @__PURE__ */ (0,
|
|
6883
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6798
6884
|
"span",
|
|
6799
6885
|
{
|
|
6800
6886
|
className: "inline-block w-[12px] h-[12px] rounded-full shrink-0 border-2 border-white/50",
|
|
6801
6887
|
style: { backgroundColor: d.color }
|
|
6802
6888
|
}
|
|
6803
6889
|
),
|
|
6804
|
-
/* @__PURE__ */ (0,
|
|
6805
|
-
/* @__PURE__ */ (0,
|
|
6806
|
-
/* @__PURE__ */ (0,
|
|
6807
|
-
/* @__PURE__ */ (0,
|
|
6808
|
-
/* @__PURE__ */ (0,
|
|
6890
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
6891
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-gray-900 text-[11px] md:text-[13px] font-semibold block truncate leading-tight", children: d[dataLabel] }),
|
|
6892
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1 text-xs text-gray-600 font-medium", children: [
|
|
6893
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: displayValue }),
|
|
6894
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { children: [
|
|
6809
6895
|
(actualValue / total * 100).toFixed(1),
|
|
6810
6896
|
"%"
|
|
6811
6897
|
] }),
|
|
6812
|
-
d.isBoosted && /* @__PURE__ */ (0,
|
|
6898
|
+
d.isBoosted && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-[9px] px-1 py-0.5 bg-blue-100 text-blue-700 rounded-full", children: "min" })
|
|
6813
6899
|
] })
|
|
6814
6900
|
] })
|
|
6815
6901
|
]
|
|
@@ -6822,26 +6908,26 @@ var DonutChart = ({
|
|
|
6822
6908
|
}, [chartData, data, dataLabel, dataKey, total, showLegends, onLegendClick, legendPosition, forceMobile]);
|
|
6823
6909
|
if (!mounted) return null;
|
|
6824
6910
|
if (effectiveLoading) {
|
|
6825
|
-
return /* @__PURE__ */ (0,
|
|
6911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
6826
6912
|
"div",
|
|
6827
6913
|
{
|
|
6828
6914
|
className: `relative flex flex-col items-center w-full h-[300px] md:h-[400px] bg-gradient-to-br from-gray-50 to-gray-100 rounded-xl p-6 ${className}`,
|
|
6829
6915
|
style,
|
|
6830
6916
|
children: [
|
|
6831
|
-
/* @__PURE__ */ (0,
|
|
6832
|
-
/* @__PURE__ */ (0,
|
|
6833
|
-
/* @__PURE__ */ (0,
|
|
6834
|
-
/* @__PURE__ */ (0,
|
|
6917
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white/60 to-transparent animate-shimmer rounded-xl" }),
|
|
6918
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "mt-6 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "inline-flex items-center space-x-2 bg-white/80 px-6 py-2 rounded-full backdrop-blur-sm border border-gray-200 shadow-lg", children: [
|
|
6919
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "w-5 h-5 border-2 border-gray-300 border-t-blue-400 rounded-full animate-spin" }),
|
|
6920
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-sm font-medium text-gray-600 bg-gradient-to-r from-gray-300 bg-clip-text animate-pulse", children: "Loading chart data..." })
|
|
6835
6921
|
] }) }),
|
|
6836
|
-
/* @__PURE__ */ (0,
|
|
6922
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex flex-wrap justify-center gap-3 mt-8 w-full max-w-4xl", children: [...Array(18)].map((_, idx) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
6837
6923
|
"div",
|
|
6838
6924
|
{
|
|
6839
6925
|
className: `h-10 w-[48%] sm:w-[32%] md:w-32 rounded-xl bg-gradient-to-r from-gray-200 via-gray-300/50 to-gray-200 p-3 flex items-center space-x-3 animate-slide-up stagger-${idx} shadow-sm border border-gray-200/50`,
|
|
6840
6926
|
children: [
|
|
6841
|
-
/* @__PURE__ */ (0,
|
|
6842
|
-
/* @__PURE__ */ (0,
|
|
6843
|
-
/* @__PURE__ */ (0,
|
|
6844
|
-
/* @__PURE__ */ (0,
|
|
6927
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "w-4 h-4 rounded-full bg-gradient-to-r from-blue-300 to-purple-300 animate-pulse" }),
|
|
6928
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex-1 space-y-1", children: [
|
|
6929
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "h-3 w-20 bg-gray-300 rounded animate-pulse" }),
|
|
6930
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "h-2.5 w-16 bg-gray-200/60 rounded animate-pulse-delayed" })
|
|
6845
6931
|
] })
|
|
6846
6932
|
]
|
|
6847
6933
|
},
|
|
@@ -6852,12 +6938,12 @@ var DonutChart = ({
|
|
|
6852
6938
|
);
|
|
6853
6939
|
}
|
|
6854
6940
|
if (data.length === 0) {
|
|
6855
|
-
return /* @__PURE__ */ (0,
|
|
6941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6856
6942
|
"div",
|
|
6857
6943
|
{
|
|
6858
6944
|
className: `relative flex flex-col items-center justify-center w-full h-[300px] md:h-[400px] bg-gradient-to-br from-gray-50 to-gray-100 rounded-xl p-6 ${className}`,
|
|
6859
6945
|
style,
|
|
6860
|
-
children: /* @__PURE__ */ (0,
|
|
6946
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "text-center", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "inline-flex items-center space-x-2 bg-white/80 px-6 py-3 rounded-xl backdrop-blur-sm border border-gray-200 shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-sm font-medium text-gray-600", children: "No data" }) }) })
|
|
6861
6947
|
}
|
|
6862
6948
|
);
|
|
6863
6949
|
}
|
|
@@ -6865,19 +6951,19 @@ var DonutChart = ({
|
|
|
6865
6951
|
const innerRadius = inner;
|
|
6866
6952
|
const outerRadius = outer;
|
|
6867
6953
|
const isLegendRight = !forceMobile && legendPosition === "right";
|
|
6868
|
-
return /* @__PURE__ */ (0,
|
|
6954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
6869
6955
|
"div",
|
|
6870
6956
|
{
|
|
6871
6957
|
className: `relative flex ${isLegendRight ? "flex-row items-stretch gap-4" : "flex-col items-center"} ${className}`,
|
|
6872
6958
|
style,
|
|
6873
6959
|
children: [
|
|
6874
|
-
/* @__PURE__ */ (0,
|
|
6960
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
6875
6961
|
"div",
|
|
6876
6962
|
{
|
|
6877
6963
|
className: `relative flex items-center justify-center ${isLegendRight ? "flex-[2] min-w-0 max-w-[70%]" : "w-full md:w-[75%]"} h-[280px] md:h-[380px] ${isLegendRight ? "" : "mb-2"}`,
|
|
6878
6964
|
children: [
|
|
6879
|
-
/* @__PURE__ */ (0,
|
|
6880
|
-
/* @__PURE__ */ (0,
|
|
6965
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_recharts2.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_recharts2.PieChart, { children: [
|
|
6966
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6881
6967
|
import_recharts2.Pie,
|
|
6882
6968
|
{
|
|
6883
6969
|
data: chartData,
|
|
@@ -6890,7 +6976,7 @@ var DonutChart = ({
|
|
|
6890
6976
|
isAnimationActive: true,
|
|
6891
6977
|
animationDuration: 800,
|
|
6892
6978
|
minAngle: 3,
|
|
6893
|
-
children: chartData.map((entry, index) => /* @__PURE__ */ (0,
|
|
6979
|
+
children: chartData.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6894
6980
|
import_recharts2.Cell,
|
|
6895
6981
|
{
|
|
6896
6982
|
fill: entry.color,
|
|
@@ -6901,7 +6987,7 @@ var DonutChart = ({
|
|
|
6901
6987
|
))
|
|
6902
6988
|
}
|
|
6903
6989
|
),
|
|
6904
|
-
/* @__PURE__ */ (0,
|
|
6990
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6905
6991
|
import_recharts2.Tooltip,
|
|
6906
6992
|
{
|
|
6907
6993
|
formatter: (value, name, payload) => {
|
|
@@ -6924,25 +7010,25 @@ var DonutChart = ({
|
|
|
6924
7010
|
}
|
|
6925
7011
|
)
|
|
6926
7012
|
] }) }),
|
|
6927
|
-
total > 0 && /* @__PURE__ */ (0,
|
|
7013
|
+
total > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: `absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-center pointer-events-none ${forceMobile ? "text-xl px-2" : "text-3xl px-4"} font-bold bg-white/90 backdrop-blur-sm rounded-full py-1 shadow-lg`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "text-[#1f2937] leading-tight", children: [
|
|
6928
7014
|
formattedTotal,
|
|
6929
|
-
/* @__PURE__ */ (0,
|
|
7015
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-sm md:text-base font-normal text-gray-600 block md:inline-block md:ml-1", children: "total" })
|
|
6930
7016
|
] }) })
|
|
6931
7017
|
]
|
|
6932
7018
|
}
|
|
6933
7019
|
),
|
|
6934
|
-
showLegends && /* @__PURE__ */ (0,
|
|
7020
|
+
showLegends && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: isLegendRight ? "flex flex-col w-[30%] min-w-[180px] justify-center" : "w-full", children: renderLegends })
|
|
6935
7021
|
]
|
|
6936
7022
|
}
|
|
6937
7023
|
);
|
|
6938
7024
|
};
|
|
6939
|
-
var PieChart_default =
|
|
7025
|
+
var PieChart_default = import_react38.default.memo(DonutChart);
|
|
6940
7026
|
|
|
6941
7027
|
// src/components/Blocks/EmailComposer.tsx
|
|
6942
|
-
var
|
|
7028
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
6943
7029
|
function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc, setShowBcc, cc, setCc, bcc, setBcc, subject, setSubject, body, setBody }) {
|
|
6944
|
-
return /* @__PURE__ */ (0,
|
|
6945
|
-
/* @__PURE__ */ (0,
|
|
7030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "border rounded-md shadow bg-[#fff] p-4 mx-auto z-[50] relative", children: [
|
|
7031
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
6946
7032
|
"input",
|
|
6947
7033
|
{
|
|
6948
7034
|
type: "email",
|
|
@@ -6951,8 +7037,8 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
6951
7037
|
required: true
|
|
6952
7038
|
}
|
|
6953
7039
|
) }),
|
|
6954
|
-
/* @__PURE__ */ (0,
|
|
6955
|
-
/* @__PURE__ */ (0,
|
|
7040
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
7041
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
6956
7042
|
"input",
|
|
6957
7043
|
{
|
|
6958
7044
|
type: "email",
|
|
@@ -6963,7 +7049,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
6963
7049
|
required: true
|
|
6964
7050
|
}
|
|
6965
7051
|
),
|
|
6966
|
-
!showCc && /* @__PURE__ */ (0,
|
|
7052
|
+
!showCc && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
6967
7053
|
"button",
|
|
6968
7054
|
{
|
|
6969
7055
|
onClick: () => setShowCc?.(true),
|
|
@@ -6971,7 +7057,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
6971
7057
|
children: "Cc"
|
|
6972
7058
|
}
|
|
6973
7059
|
),
|
|
6974
|
-
!showBcc && /* @__PURE__ */ (0,
|
|
7060
|
+
!showBcc && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
6975
7061
|
"button",
|
|
6976
7062
|
{
|
|
6977
7063
|
onClick: () => setShowBcc?.(true),
|
|
@@ -6980,7 +7066,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
6980
7066
|
}
|
|
6981
7067
|
)
|
|
6982
7068
|
] }) }),
|
|
6983
|
-
showCc && /* @__PURE__ */ (0,
|
|
7069
|
+
showCc && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
6984
7070
|
"input",
|
|
6985
7071
|
{
|
|
6986
7072
|
type: "text",
|
|
@@ -6990,7 +7076,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
6990
7076
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
6991
7077
|
}
|
|
6992
7078
|
) }),
|
|
6993
|
-
showBcc && /* @__PURE__ */ (0,
|
|
7079
|
+
showBcc && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
6994
7080
|
"input",
|
|
6995
7081
|
{
|
|
6996
7082
|
type: "text",
|
|
@@ -7000,7 +7086,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
7000
7086
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
7001
7087
|
}
|
|
7002
7088
|
) }),
|
|
7003
|
-
/* @__PURE__ */ (0,
|
|
7089
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7004
7090
|
"input",
|
|
7005
7091
|
{
|
|
7006
7092
|
type: "text",
|
|
@@ -7010,11 +7096,11 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
7010
7096
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
7011
7097
|
}
|
|
7012
7098
|
) }),
|
|
7013
|
-
/* @__PURE__ */ (0,
|
|
7014
|
-
/* @__PURE__ */ (0,
|
|
7015
|
-
/* @__PURE__ */ (0,
|
|
7016
|
-
/* @__PURE__ */ (0,
|
|
7017
|
-
/* @__PURE__ */ (0,
|
|
7099
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(MyEditor, { value: body, onChange: setBody }) }),
|
|
7100
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex justify-end gap-2", children: [
|
|
7101
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { className: "px-4 py-2 rounded-md text-gray-600 hover:bg-gray-100", children: "Discard" }),
|
|
7102
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { className: "px-4 py-2 rounded-md border text-[#12715B] border-[#12715B]", children: "Reset" }),
|
|
7103
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { className: "px-4 py-2 rounded-md bg-[#12715B] text-white", children: "Send" })
|
|
7018
7104
|
] })
|
|
7019
7105
|
] }) });
|
|
7020
7106
|
}
|
|
@@ -7022,10 +7108,10 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
7022
7108
|
// src/components/ui/sonner.tsx
|
|
7023
7109
|
var import_next_themes = require("next-themes");
|
|
7024
7110
|
var import_sonner2 = require("sonner");
|
|
7025
|
-
var
|
|
7111
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
7026
7112
|
var Toaster = ({ ...props }) => {
|
|
7027
7113
|
const { theme = "system" } = (0, import_next_themes.useTheme)();
|
|
7028
|
-
return /* @__PURE__ */ (0,
|
|
7114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7029
7115
|
import_sonner2.Toaster,
|
|
7030
7116
|
{
|
|
7031
7117
|
theme,
|
|
@@ -7043,6 +7129,7 @@ var Toaster = ({ ...props }) => {
|
|
|
7043
7129
|
0 && (module.exports = {
|
|
7044
7130
|
Accordion,
|
|
7045
7131
|
AccordionGroup,
|
|
7132
|
+
Audio,
|
|
7046
7133
|
BarChart,
|
|
7047
7134
|
Breadcrumb,
|
|
7048
7135
|
Button,
|