@algorithm-shift/design-system 1.3.126 → 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 +830 -735
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +784 -690
- 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,11 +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
|
|
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);
|
|
2384
2471
|
const {
|
|
2385
2472
|
options: lazyOptions,
|
|
2386
2473
|
loading,
|
|
@@ -2402,26 +2489,31 @@ function LazySelectDropdown({
|
|
|
2402
2489
|
axiosInstance,
|
|
2403
2490
|
enforceStrictQueryParams
|
|
2404
2491
|
});
|
|
2405
|
-
const selectedOption = (0,
|
|
2406
|
-
(0,
|
|
2492
|
+
const selectedOption = (0, import_react23.useMemo)(() => lazyOptions.find((opt) => opt.value === value), [lazyOptions, value]);
|
|
2493
|
+
(0, import_react23.useEffect)(() => {
|
|
2407
2494
|
if (!isOpen) {
|
|
2408
2495
|
setHighlightedIndex(-1);
|
|
2409
2496
|
} else if (lazyOptions.length > 0 && highlightedIndex === -1) {
|
|
2410
2497
|
setHighlightedIndex(0);
|
|
2411
2498
|
}
|
|
2412
2499
|
}, [isOpen, lazyOptions.length, highlightedIndex]);
|
|
2413
|
-
(0,
|
|
2414
|
-
const
|
|
2415
|
-
|
|
2500
|
+
(0, import_react23.useEffect)(() => {
|
|
2501
|
+
const handleOutside = (e) => {
|
|
2502
|
+
const target = e.target;
|
|
2503
|
+
if (dropdownRef.current && !dropdownRef.current.contains(target) && (!popupRef.current || !popupRef.current.contains(target))) {
|
|
2416
2504
|
setIsOpen(false);
|
|
2417
2505
|
setSearchTerm("");
|
|
2418
2506
|
setHighlightedIndex(-1);
|
|
2419
2507
|
}
|
|
2420
2508
|
};
|
|
2421
|
-
document.addEventListener("mousedown",
|
|
2422
|
-
|
|
2509
|
+
document.addEventListener("mousedown", handleOutside);
|
|
2510
|
+
document.addEventListener("focusin", handleOutside);
|
|
2511
|
+
return () => {
|
|
2512
|
+
document.removeEventListener("mousedown", handleOutside);
|
|
2513
|
+
document.removeEventListener("focusin", handleOutside);
|
|
2514
|
+
};
|
|
2423
2515
|
}, []);
|
|
2424
|
-
(0,
|
|
2516
|
+
(0, import_react23.useEffect)(() => {
|
|
2425
2517
|
if (!isOpen || !hasMore || loading) return;
|
|
2426
2518
|
const observer = new IntersectionObserver(
|
|
2427
2519
|
(entries) => {
|
|
@@ -2512,8 +2604,8 @@ function LazySelectDropdown({
|
|
|
2512
2604
|
break;
|
|
2513
2605
|
}
|
|
2514
2606
|
};
|
|
2515
|
-
return /* @__PURE__ */ (0,
|
|
2516
|
-
/* @__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)(
|
|
2517
2609
|
"input",
|
|
2518
2610
|
{
|
|
2519
2611
|
type: "text",
|
|
@@ -2535,20 +2627,21 @@ function LazySelectDropdown({
|
|
|
2535
2627
|
autoComplete: "off"
|
|
2536
2628
|
}
|
|
2537
2629
|
),
|
|
2538
|
-
selectedOption && !disabled && !readOnly && /* @__PURE__ */ (0,
|
|
2630
|
+
selectedOption && !disabled && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2539
2631
|
"button",
|
|
2540
2632
|
{
|
|
2541
2633
|
type: "button",
|
|
2542
2634
|
"aria-label": "Clear selection",
|
|
2543
2635
|
onClick: handleRemoveSelection,
|
|
2544
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",
|
|
2545
|
-
children: /* @__PURE__ */ (0,
|
|
2637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react8.XSquareIcon, { className: "h-5 w-5 pointer-events-none" })
|
|
2546
2638
|
}
|
|
2547
2639
|
),
|
|
2548
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
2549
|
-
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)(
|
|
2550
2642
|
"div",
|
|
2551
2643
|
{
|
|
2644
|
+
ref: popupRef,
|
|
2552
2645
|
onMouseDown: (e) => e.stopPropagation(),
|
|
2553
2646
|
className: "absolute z-[900] w-fit mt-1 bg-white border border-gray-300 rounded-lg shadow-lg max-h-60 overflow-y-auto",
|
|
2554
2647
|
style: {
|
|
@@ -2557,14 +2650,14 @@ function LazySelectDropdown({
|
|
|
2557
2650
|
top: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().bottom + window.scrollY : 0,
|
|
2558
2651
|
left: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().left + window.scrollX : 0
|
|
2559
2652
|
},
|
|
2560
|
-
children: props.loading && !loading ? /* @__PURE__ */ (0,
|
|
2561
|
-
/* @__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" }),
|
|
2562
2655
|
"Loading..."
|
|
2563
|
-
] }) : /* @__PURE__ */ (0,
|
|
2564
|
-
/* @__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" }),
|
|
2565
2658
|
"Loading..."
|
|
2566
|
-
] }) : lazyOptions.length > 0 ? /* @__PURE__ */ (0,
|
|
2567
|
-
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)(
|
|
2568
2661
|
"div",
|
|
2569
2662
|
{
|
|
2570
2663
|
tabIndex: 0,
|
|
@@ -2583,20 +2676,20 @@ function LazySelectDropdown({
|
|
|
2583
2676
|
},
|
|
2584
2677
|
`${option.value}-${index}`
|
|
2585
2678
|
)),
|
|
2586
|
-
hasMore && /* @__PURE__ */ (0,
|
|
2679
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2587
2680
|
"div",
|
|
2588
2681
|
{
|
|
2589
2682
|
ref: observerTarget,
|
|
2590
2683
|
className: "px-3 py-2 text-center text-gray-400 text-sm border-t",
|
|
2591
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
2592
|
-
/* @__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" }),
|
|
2593
2686
|
"Loading more..."
|
|
2594
2687
|
] }) : "Scroll for more..."
|
|
2595
2688
|
}
|
|
2596
2689
|
)
|
|
2597
|
-
] }) : /* @__PURE__ */ (0,
|
|
2690
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "px-3 py-4 text-sm text-center text-gray-500", children: [
|
|
2598
2691
|
searchTerm ? `No results for "${searchTerm}"` : "No options available",
|
|
2599
|
-
enableAddNewOption && searchTerm && /* @__PURE__ */ (0,
|
|
2692
|
+
enableAddNewOption && searchTerm && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2600
2693
|
"div",
|
|
2601
2694
|
{
|
|
2602
2695
|
onClick: () => handleAddNewOption(searchTerm),
|
|
@@ -2612,14 +2705,14 @@ function LazySelectDropdown({
|
|
|
2612
2705
|
var LazyDropdown_default = LazySelectDropdown;
|
|
2613
2706
|
|
|
2614
2707
|
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
2615
|
-
var
|
|
2708
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2616
2709
|
var Dropdown = ({ className, style, ...props }) => {
|
|
2617
2710
|
const list = Array.isArray(props?.data) ? props.data : [];
|
|
2618
2711
|
const placeholder = props.placeholder ? props.placeholder : "Select an option";
|
|
2619
2712
|
const isEditable = props.isEditable ?? true;
|
|
2620
2713
|
const isDisabled = props.isDisabled ?? false;
|
|
2621
2714
|
const isReadonly = props.isReadonly ?? false;
|
|
2622
|
-
(0,
|
|
2715
|
+
(0, import_react24.useEffect)(() => {
|
|
2623
2716
|
if (props.value !== void 0) {
|
|
2624
2717
|
handleChange(props.value);
|
|
2625
2718
|
}
|
|
@@ -2634,7 +2727,7 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
2634
2727
|
label: item[dataLabel]
|
|
2635
2728
|
}));
|
|
2636
2729
|
if (props.lazyLoad) {
|
|
2637
|
-
return /* @__PURE__ */ (0,
|
|
2730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2638
2731
|
LazyDropdown_default,
|
|
2639
2732
|
{
|
|
2640
2733
|
...props,
|
|
@@ -2651,9 +2744,9 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
2651
2744
|
}
|
|
2652
2745
|
);
|
|
2653
2746
|
}
|
|
2654
|
-
return /* @__PURE__ */ (0,
|
|
2655
|
-
/* @__PURE__ */ (0,
|
|
2656
|
-
/* @__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)(
|
|
2657
2750
|
SelectTrigger,
|
|
2658
2751
|
{
|
|
2659
2752
|
id: props.name || "select-field",
|
|
@@ -2663,31 +2756,31 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
2663
2756
|
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
2664
2757
|
},
|
|
2665
2758
|
"aria-readonly": isReadonly,
|
|
2666
|
-
children: /* @__PURE__ */ (0,
|
|
2759
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SelectValue, { placeholder })
|
|
2667
2760
|
}
|
|
2668
2761
|
),
|
|
2669
|
-
/* @__PURE__ */ (0,
|
|
2670
|
-
props.dataLoading && /* @__PURE__ */ (0,
|
|
2671
|
-
!props.dataLoading && options.length === 0 && /* @__PURE__ */ (0,
|
|
2672
|
-
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))
|
|
2673
2766
|
] })
|
|
2674
2767
|
] }),
|
|
2675
|
-
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 })
|
|
2676
2769
|
] });
|
|
2677
2770
|
};
|
|
2678
2771
|
var Dropdown_default = Dropdown;
|
|
2679
2772
|
|
|
2680
2773
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
2681
|
-
var
|
|
2774
|
+
var import_react25 = require("react");
|
|
2682
2775
|
|
|
2683
2776
|
// src/components/ui/switch.tsx
|
|
2684
2777
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
2685
|
-
var
|
|
2778
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2686
2779
|
function Switch({
|
|
2687
2780
|
className,
|
|
2688
2781
|
...props
|
|
2689
2782
|
}) {
|
|
2690
|
-
return /* @__PURE__ */ (0,
|
|
2783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2691
2784
|
SwitchPrimitive.Root,
|
|
2692
2785
|
{
|
|
2693
2786
|
"data-slot": "switch",
|
|
@@ -2696,7 +2789,7 @@ function Switch({
|
|
|
2696
2789
|
className
|
|
2697
2790
|
),
|
|
2698
2791
|
...props,
|
|
2699
|
-
children: /* @__PURE__ */ (0,
|
|
2792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2700
2793
|
SwitchPrimitive.Thumb,
|
|
2701
2794
|
{
|
|
2702
2795
|
"data-slot": "switch-thumb",
|
|
@@ -2710,11 +2803,11 @@ function Switch({
|
|
|
2710
2803
|
}
|
|
2711
2804
|
|
|
2712
2805
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
2713
|
-
var
|
|
2806
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2714
2807
|
var SwitchToggle = ({ className, style, ...props }) => {
|
|
2715
2808
|
const isEditable = props.isEditable ?? true;
|
|
2716
2809
|
const isDisabled = props.isDisabled ?? false;
|
|
2717
|
-
(0,
|
|
2810
|
+
(0, import_react25.useEffect)(() => {
|
|
2718
2811
|
if (props.value !== void 0) {
|
|
2719
2812
|
handleChange?.(props.value);
|
|
2720
2813
|
}
|
|
@@ -2722,9 +2815,9 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
2722
2815
|
const handleChange = (value) => {
|
|
2723
2816
|
props.onChange?.(value, props?.name || "");
|
|
2724
2817
|
};
|
|
2725
|
-
return /* @__PURE__ */ (0,
|
|
2726
|
-
/* @__PURE__ */ (0,
|
|
2727
|
-
/* @__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)(
|
|
2728
2821
|
Switch,
|
|
2729
2822
|
{
|
|
2730
2823
|
id: props.name || "switch",
|
|
@@ -2733,18 +2826,18 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
2733
2826
|
disabled: isDisabled || !isEditable
|
|
2734
2827
|
}
|
|
2735
2828
|
),
|
|
2736
|
-
/* @__PURE__ */ (0,
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Label2, { htmlFor: props.name || "switch", children: props.text })
|
|
2737
2830
|
] }) }),
|
|
2738
|
-
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 })
|
|
2739
2832
|
] });
|
|
2740
2833
|
};
|
|
2741
2834
|
var SwitchToggle_default = SwitchToggle;
|
|
2742
2835
|
|
|
2743
2836
|
// src/components/Inputs/PhoneInput/PhoneInput.tsx
|
|
2744
|
-
var
|
|
2837
|
+
var import_react26 = require("react");
|
|
2745
2838
|
var import_react_international_phone = require("react-international-phone");
|
|
2746
2839
|
var import_style = require("react-international-phone/style.css");
|
|
2747
|
-
var
|
|
2840
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2748
2841
|
var ensureDialcode = (val) => {
|
|
2749
2842
|
if (!val) return "";
|
|
2750
2843
|
const trimmed = val.trim();
|
|
@@ -2753,11 +2846,11 @@ var ensureDialcode = (val) => {
|
|
|
2753
2846
|
return `+91${local}`;
|
|
2754
2847
|
};
|
|
2755
2848
|
var PhoneInput = ({ className, style, ...props }) => {
|
|
2756
|
-
const ref = (0,
|
|
2849
|
+
const ref = (0, import_react26.useRef)(null);
|
|
2757
2850
|
const placeholder = props.placeholder ?? "Enter phone number";
|
|
2758
2851
|
const isEditable = props.isEditable ?? true;
|
|
2759
2852
|
const isDisabled = props.isDisabled ?? false;
|
|
2760
|
-
(0,
|
|
2853
|
+
(0, import_react26.useEffect)(() => {
|
|
2761
2854
|
if (props.value !== void 0) {
|
|
2762
2855
|
handleChange?.(ensureDialcode(props.value), ref.current?.state);
|
|
2763
2856
|
}
|
|
@@ -2772,8 +2865,8 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
2772
2865
|
props.onChange?.(event, props.name || "");
|
|
2773
2866
|
props.getPhoneState?.(meta);
|
|
2774
2867
|
};
|
|
2775
|
-
return /* @__PURE__ */ (0,
|
|
2776
|
-
/* @__PURE__ */ (0,
|
|
2868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
2869
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2777
2870
|
import_react_international_phone.PhoneInput,
|
|
2778
2871
|
{
|
|
2779
2872
|
ref,
|
|
@@ -2798,21 +2891,21 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
2798
2891
|
disabled: isDisabled || !isEditable
|
|
2799
2892
|
}
|
|
2800
2893
|
),
|
|
2801
|
-
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 })
|
|
2802
2895
|
] });
|
|
2803
2896
|
};
|
|
2804
2897
|
var PhoneInput_default = PhoneInput;
|
|
2805
2898
|
|
|
2806
2899
|
// src/components/Inputs/SearchInput/SearchInput.tsx
|
|
2807
|
-
var
|
|
2808
|
-
var
|
|
2900
|
+
var import_react27 = require("react");
|
|
2901
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2809
2902
|
var SearchInput = ({ className, style, ...props }) => {
|
|
2810
2903
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
2811
2904
|
const isEditable = props.isEditable ?? true;
|
|
2812
2905
|
const isDisabled = props.isDisabled ?? false;
|
|
2813
2906
|
const isReadonly = props.isReadonly ?? false;
|
|
2814
2907
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
2815
|
-
(0,
|
|
2908
|
+
(0, import_react27.useEffect)(() => {
|
|
2816
2909
|
if (props.value !== void 0) {
|
|
2817
2910
|
const e = { target: { value: props.value }, type: "change" };
|
|
2818
2911
|
handleChange?.(e);
|
|
@@ -2828,8 +2921,8 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
2828
2921
|
if (value === null || value === void 0) return "";
|
|
2829
2922
|
return value;
|
|
2830
2923
|
};
|
|
2831
|
-
return /* @__PURE__ */ (0,
|
|
2832
|
-
/* @__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)(
|
|
2833
2926
|
Input,
|
|
2834
2927
|
{
|
|
2835
2928
|
type: props.inputType || "search",
|
|
@@ -2848,17 +2941,17 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
2848
2941
|
readOnly: isReadonly
|
|
2849
2942
|
}
|
|
2850
2943
|
) }),
|
|
2851
|
-
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 })
|
|
2852
2945
|
] });
|
|
2853
2946
|
};
|
|
2854
2947
|
var SearchInput_default = SearchInput;
|
|
2855
2948
|
|
|
2856
2949
|
// src/components/Inputs/FileInput/FileInput.tsx
|
|
2857
|
-
var
|
|
2858
|
-
var
|
|
2950
|
+
var import_react28 = require("react");
|
|
2951
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2859
2952
|
var FileInput = ({ className, style, ...props }) => {
|
|
2860
2953
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
2861
|
-
(0,
|
|
2954
|
+
(0, import_react28.useEffect)(() => {
|
|
2862
2955
|
if (props.value !== void 0) {
|
|
2863
2956
|
const e = { target: { value: props.value }, type: "change" };
|
|
2864
2957
|
handleChange?.(e);
|
|
@@ -2874,8 +2967,8 @@ var FileInput = ({ className, style, ...props }) => {
|
|
|
2874
2967
|
if (value === null || value === void 0) return "";
|
|
2875
2968
|
return value;
|
|
2876
2969
|
};
|
|
2877
|
-
return /* @__PURE__ */ (0,
|
|
2878
|
-
/* @__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)(
|
|
2879
2972
|
Input,
|
|
2880
2973
|
{
|
|
2881
2974
|
type: props.inputType || "file",
|
|
@@ -2892,21 +2985,21 @@ var FileInput = ({ className, style, ...props }) => {
|
|
|
2892
2985
|
onChange: handleChange
|
|
2893
2986
|
}
|
|
2894
2987
|
),
|
|
2895
|
-
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 })
|
|
2896
2989
|
] });
|
|
2897
2990
|
};
|
|
2898
2991
|
var FileInput_default = FileInput;
|
|
2899
2992
|
|
|
2900
2993
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
2901
|
-
var
|
|
2994
|
+
var React9 = __toESM(require("react"));
|
|
2902
2995
|
var import_date_fns = require("date-fns");
|
|
2903
|
-
var
|
|
2996
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2904
2997
|
|
|
2905
2998
|
// src/components/ui/calendar.tsx
|
|
2906
|
-
var
|
|
2907
|
-
var
|
|
2999
|
+
var React8 = __toESM(require("react"));
|
|
3000
|
+
var import_lucide_react9 = require("lucide-react");
|
|
2908
3001
|
var import_react_day_picker = require("react-day-picker");
|
|
2909
|
-
var
|
|
3002
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2910
3003
|
function Calendar({
|
|
2911
3004
|
className,
|
|
2912
3005
|
classNames,
|
|
@@ -2918,7 +3011,7 @@ function Calendar({
|
|
|
2918
3011
|
...props
|
|
2919
3012
|
}) {
|
|
2920
3013
|
const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
2921
|
-
return /* @__PURE__ */ (0,
|
|
3014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2922
3015
|
import_react_day_picker.DayPicker,
|
|
2923
3016
|
{
|
|
2924
3017
|
showOutsideDays,
|
|
@@ -3017,7 +3110,7 @@ function Calendar({
|
|
|
3017
3110
|
},
|
|
3018
3111
|
components: {
|
|
3019
3112
|
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
3020
|
-
return /* @__PURE__ */ (0,
|
|
3113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3021
3114
|
"div",
|
|
3022
3115
|
{
|
|
3023
3116
|
"data-slot": "calendar",
|
|
@@ -3029,22 +3122,22 @@ function Calendar({
|
|
|
3029
3122
|
},
|
|
3030
3123
|
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
3031
3124
|
if (orientation === "left") {
|
|
3032
|
-
return /* @__PURE__ */ (0,
|
|
3125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react9.ChevronLeftIcon, { className: cn("size-4", className2), ...props2 });
|
|
3033
3126
|
}
|
|
3034
3127
|
if (orientation === "right") {
|
|
3035
|
-
return /* @__PURE__ */ (0,
|
|
3036
|
-
|
|
3128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3129
|
+
import_lucide_react9.ChevronRightIcon,
|
|
3037
3130
|
{
|
|
3038
3131
|
className: cn("size-4", className2),
|
|
3039
3132
|
...props2
|
|
3040
3133
|
}
|
|
3041
3134
|
);
|
|
3042
3135
|
}
|
|
3043
|
-
return /* @__PURE__ */ (0,
|
|
3136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react9.ChevronDownIcon, { className: cn("size-4", className2), ...props2 });
|
|
3044
3137
|
},
|
|
3045
3138
|
DayButton: CalendarDayButton,
|
|
3046
3139
|
WeekNumber: ({ children, ...props2 }) => {
|
|
3047
|
-
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 }) });
|
|
3048
3141
|
},
|
|
3049
3142
|
...components
|
|
3050
3143
|
},
|
|
@@ -3059,11 +3152,11 @@ function CalendarDayButton({
|
|
|
3059
3152
|
...props
|
|
3060
3153
|
}) {
|
|
3061
3154
|
const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
3062
|
-
const ref =
|
|
3063
|
-
|
|
3155
|
+
const ref = React8.useRef(null);
|
|
3156
|
+
React8.useEffect(() => {
|
|
3064
3157
|
if (modifiers.focused) ref.current?.focus();
|
|
3065
3158
|
}, [modifiers.focused]);
|
|
3066
|
-
return /* @__PURE__ */ (0,
|
|
3159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3067
3160
|
Button,
|
|
3068
3161
|
{
|
|
3069
3162
|
ref,
|
|
@@ -3086,16 +3179,16 @@ function CalendarDayButton({
|
|
|
3086
3179
|
|
|
3087
3180
|
// src/components/ui/popover.tsx
|
|
3088
3181
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
3089
|
-
var
|
|
3182
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3090
3183
|
function Popover({
|
|
3091
3184
|
...props
|
|
3092
3185
|
}) {
|
|
3093
|
-
return /* @__PURE__ */ (0,
|
|
3186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
3094
3187
|
}
|
|
3095
3188
|
function PopoverTrigger({
|
|
3096
3189
|
...props
|
|
3097
3190
|
}) {
|
|
3098
|
-
return /* @__PURE__ */ (0,
|
|
3191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
3099
3192
|
}
|
|
3100
3193
|
function PopoverContent({
|
|
3101
3194
|
className,
|
|
@@ -3103,7 +3196,7 @@ function PopoverContent({
|
|
|
3103
3196
|
sideOffset = 4,
|
|
3104
3197
|
...props
|
|
3105
3198
|
}) {
|
|
3106
|
-
return /* @__PURE__ */ (0,
|
|
3199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3107
3200
|
PopoverPrimitive.Content,
|
|
3108
3201
|
{
|
|
3109
3202
|
"data-slot": "popover-content",
|
|
@@ -3119,7 +3212,7 @@ function PopoverContent({
|
|
|
3119
3212
|
}
|
|
3120
3213
|
|
|
3121
3214
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
3122
|
-
var
|
|
3215
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3123
3216
|
function resolveDate(option, customOption) {
|
|
3124
3217
|
if (!option) return void 0;
|
|
3125
3218
|
switch (option) {
|
|
@@ -3186,7 +3279,7 @@ function DateTimePicker({
|
|
|
3186
3279
|
mode = "date",
|
|
3187
3280
|
...props
|
|
3188
3281
|
}) {
|
|
3189
|
-
const [open, setOpen] =
|
|
3282
|
+
const [open, setOpen] = React9.useState(false);
|
|
3190
3283
|
const placeholderMap = {
|
|
3191
3284
|
date: "Select date",
|
|
3192
3285
|
datetime: "Select date & time",
|
|
@@ -3205,7 +3298,7 @@ function DateTimePicker({
|
|
|
3205
3298
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
3206
3299
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
3207
3300
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
3208
|
-
const [date, setDate] =
|
|
3301
|
+
const [date, setDate] = React9.useState(() => {
|
|
3209
3302
|
if (props.value) {
|
|
3210
3303
|
const d = new Date(props.value);
|
|
3211
3304
|
if (!isNaN(d.getTime())) return d;
|
|
@@ -3214,15 +3307,15 @@ function DateTimePicker({
|
|
|
3214
3307
|
});
|
|
3215
3308
|
const initialHours = date ? date.getHours() : 0;
|
|
3216
3309
|
const initialMinutes = date ? date.getMinutes() : 0;
|
|
3217
|
-
const [hours, setHours] =
|
|
3218
|
-
const [minutes, setMinutes] =
|
|
3219
|
-
const [amPm, setAmPm] =
|
|
3220
|
-
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(() => {
|
|
3221
3314
|
if (hours === 0) return 12;
|
|
3222
3315
|
if (hours > 12) return hours - 12;
|
|
3223
3316
|
return hours;
|
|
3224
3317
|
}, [hours]);
|
|
3225
|
-
|
|
3318
|
+
React9.useEffect(() => {
|
|
3226
3319
|
setAmPm(hours >= 12 ? "PM" : "AM");
|
|
3227
3320
|
}, [hours]);
|
|
3228
3321
|
const emitChange = (nextDate) => {
|
|
@@ -3246,7 +3339,7 @@ function DateTimePicker({
|
|
|
3246
3339
|
};
|
|
3247
3340
|
props.onChange(event, props.name || "");
|
|
3248
3341
|
};
|
|
3249
|
-
|
|
3342
|
+
React9.useEffect(() => {
|
|
3250
3343
|
if (!props.value) {
|
|
3251
3344
|
const defaultDate = resolveDefaultDate(defaultDateValue, customDefaultDate);
|
|
3252
3345
|
setDate(defaultDate);
|
|
@@ -3268,8 +3361,8 @@ function DateTimePicker({
|
|
|
3268
3361
|
setMinutes(d.getMinutes());
|
|
3269
3362
|
}
|
|
3270
3363
|
}, [props.value, defaultDateValue, customDefaultDate]);
|
|
3271
|
-
const [year, setYear] =
|
|
3272
|
-
|
|
3364
|
+
const [year, setYear] = React9.useState(date ? date.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear());
|
|
3365
|
+
React9.useEffect(() => {
|
|
3273
3366
|
if (!date) return;
|
|
3274
3367
|
const newDate = new Date(date);
|
|
3275
3368
|
newDate.setFullYear(year);
|
|
@@ -3353,7 +3446,7 @@ function DateTimePicker({
|
|
|
3353
3446
|
for (let y = currentYear - 90; y <= currentYear; y++) {
|
|
3354
3447
|
yearOptions.push(y);
|
|
3355
3448
|
}
|
|
3356
|
-
const displayValue =
|
|
3449
|
+
const displayValue = React9.useMemo(() => {
|
|
3357
3450
|
if (!date) return "";
|
|
3358
3451
|
try {
|
|
3359
3452
|
if (mode === "date") return (0, import_date_fns.format)(date, "dd-MM-yyyy");
|
|
@@ -3364,11 +3457,11 @@ function DateTimePicker({
|
|
|
3364
3457
|
}
|
|
3365
3458
|
}, [date, mode]);
|
|
3366
3459
|
const isInputDisabled = isDisabled || !isEditable;
|
|
3367
|
-
const [calendarMonthState, setCalendarMonthState] =
|
|
3460
|
+
const [calendarMonthState, setCalendarMonthState] = React9.useState(() => {
|
|
3368
3461
|
const currentMonth = (/* @__PURE__ */ new Date()).getMonth();
|
|
3369
3462
|
return date ? new Date(date.getFullYear(), date.getMonth()) : new Date(year, currentMonth);
|
|
3370
3463
|
});
|
|
3371
|
-
|
|
3464
|
+
React9.useEffect(() => {
|
|
3372
3465
|
setCalendarMonthState(new Date(year, calendarMonthState.getMonth()));
|
|
3373
3466
|
}, [year]);
|
|
3374
3467
|
const handleToday = () => {
|
|
@@ -3377,9 +3470,9 @@ function DateTimePicker({
|
|
|
3377
3470
|
updateDateTime(selectedYearDate);
|
|
3378
3471
|
setOpen(false);
|
|
3379
3472
|
};
|
|
3380
|
-
return /* @__PURE__ */ (0,
|
|
3381
|
-
/* @__PURE__ */ (0,
|
|
3382
|
-
/* @__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)(
|
|
3383
3476
|
Button,
|
|
3384
3477
|
{
|
|
3385
3478
|
type: "button",
|
|
@@ -3396,10 +3489,10 @@ function DateTimePicker({
|
|
|
3396
3489
|
},
|
|
3397
3490
|
disabled: isInputDisabled,
|
|
3398
3491
|
children: [
|
|
3399
|
-
/* @__PURE__ */ (0,
|
|
3400
|
-
/* @__PURE__ */ (0,
|
|
3401
|
-
displayValue && /* @__PURE__ */ (0,
|
|
3402
|
-
|
|
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,
|
|
3403
3496
|
{
|
|
3404
3497
|
className: "absolute right-2 top-2 cursor-pointer",
|
|
3405
3498
|
role: "presentation",
|
|
@@ -3415,10 +3508,10 @@ function DateTimePicker({
|
|
|
3415
3508
|
]
|
|
3416
3509
|
}
|
|
3417
3510
|
) }),
|
|
3418
|
-
/* @__PURE__ */ (0,
|
|
3419
|
-
(mode === "date" || mode === "datetime") && /* @__PURE__ */ (0,
|
|
3420
|
-
/* @__PURE__ */ (0,
|
|
3421
|
-
/* @__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)(
|
|
3422
3515
|
"label",
|
|
3423
3516
|
{
|
|
3424
3517
|
className: "text-xs text-blue-600 font-bold cursor-pointer",
|
|
@@ -3427,18 +3520,18 @@ function DateTimePicker({
|
|
|
3427
3520
|
children: "Today"
|
|
3428
3521
|
}
|
|
3429
3522
|
),
|
|
3430
|
-
/* @__PURE__ */ (0,
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3431
3524
|
"select",
|
|
3432
3525
|
{
|
|
3433
3526
|
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
3434
3527
|
value: year,
|
|
3435
3528
|
onChange: (e) => setYear(Number(e.target.value)),
|
|
3436
3529
|
disabled: isInputDisabled || isReadonly,
|
|
3437
|
-
children: yearOptions.map((y) => /* @__PURE__ */ (0,
|
|
3530
|
+
children: yearOptions.map((y) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: y, children: y }, y))
|
|
3438
3531
|
}
|
|
3439
3532
|
)
|
|
3440
3533
|
] }),
|
|
3441
|
-
/* @__PURE__ */ (0,
|
|
3534
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "calendar-container", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3442
3535
|
Calendar,
|
|
3443
3536
|
{
|
|
3444
3537
|
mode: "single",
|
|
@@ -3456,20 +3549,20 @@ function DateTimePicker({
|
|
|
3456
3549
|
}
|
|
3457
3550
|
) })
|
|
3458
3551
|
] }),
|
|
3459
|
-
(mode === "time" || mode === "datetime") && /* @__PURE__ */ (0,
|
|
3460
|
-
/* @__PURE__ */ (0,
|
|
3461
|
-
/* @__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)(
|
|
3462
3555
|
"select",
|
|
3463
3556
|
{
|
|
3464
3557
|
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
3465
3558
|
value: displayHours,
|
|
3466
3559
|
onChange: handleHoursChange,
|
|
3467
3560
|
disabled: isInputDisabled || isReadonly,
|
|
3468
|
-
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))
|
|
3469
3562
|
}
|
|
3470
3563
|
),
|
|
3471
|
-
/* @__PURE__ */ (0,
|
|
3472
|
-
/* @__PURE__ */ (0,
|
|
3564
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-sm", children: ":" }),
|
|
3565
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3473
3566
|
"select",
|
|
3474
3567
|
{
|
|
3475
3568
|
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
@@ -3478,11 +3571,11 @@ function DateTimePicker({
|
|
|
3478
3571
|
disabled: isInputDisabled || isReadonly,
|
|
3479
3572
|
children: Array.from({ length: 12 }).map((_, i) => {
|
|
3480
3573
|
const val = i * 5;
|
|
3481
|
-
return /* @__PURE__ */ (0,
|
|
3574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: val, children: val.toString().padStart(2, "0") }, val);
|
|
3482
3575
|
})
|
|
3483
3576
|
}
|
|
3484
3577
|
),
|
|
3485
|
-
/* @__PURE__ */ (0,
|
|
3578
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3486
3579
|
"select",
|
|
3487
3580
|
{
|
|
3488
3581
|
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
@@ -3490,15 +3583,15 @@ function DateTimePicker({
|
|
|
3490
3583
|
onChange: handleAmPmChange,
|
|
3491
3584
|
disabled: isInputDisabled || isReadonly,
|
|
3492
3585
|
children: [
|
|
3493
|
-
/* @__PURE__ */ (0,
|
|
3494
|
-
/* @__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" })
|
|
3495
3588
|
]
|
|
3496
3589
|
}
|
|
3497
3590
|
)
|
|
3498
3591
|
] })
|
|
3499
3592
|
] }) })
|
|
3500
3593
|
] }),
|
|
3501
|
-
/* @__PURE__ */ (0,
|
|
3594
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3502
3595
|
Input,
|
|
3503
3596
|
{
|
|
3504
3597
|
type: "hidden",
|
|
@@ -3511,23 +3604,23 @@ function DateTimePicker({
|
|
|
3511
3604
|
}
|
|
3512
3605
|
}
|
|
3513
3606
|
),
|
|
3514
|
-
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 })
|
|
3515
3608
|
] });
|
|
3516
3609
|
}
|
|
3517
3610
|
|
|
3518
3611
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
3519
|
-
var
|
|
3612
|
+
var import_react29 = __toESM(require("react"));
|
|
3520
3613
|
var import_date_fns2 = require("date-fns");
|
|
3521
|
-
var
|
|
3614
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3522
3615
|
var DateRange = ({ className, style, ...props }) => {
|
|
3523
3616
|
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
3524
|
-
const [date, setDate] =
|
|
3617
|
+
const [date, setDate] = import_react29.default.useState(
|
|
3525
3618
|
isDateRange(props.value) ? props.value : {
|
|
3526
3619
|
from: /* @__PURE__ */ new Date(),
|
|
3527
3620
|
to: (0, import_date_fns2.addDays)(/* @__PURE__ */ new Date(), 7)
|
|
3528
3621
|
}
|
|
3529
3622
|
);
|
|
3530
|
-
(0,
|
|
3623
|
+
(0, import_react29.useEffect)(() => {
|
|
3531
3624
|
if (props.value && isDateRange(props.value)) {
|
|
3532
3625
|
handleChange?.(props.value);
|
|
3533
3626
|
}
|
|
@@ -3538,9 +3631,9 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
3538
3631
|
props.onChange?.(value, props?.name || "");
|
|
3539
3632
|
}
|
|
3540
3633
|
};
|
|
3541
|
-
return /* @__PURE__ */ (0,
|
|
3542
|
-
/* @__PURE__ */ (0,
|
|
3543
|
-
/* @__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)(
|
|
3544
3637
|
Button,
|
|
3545
3638
|
{
|
|
3546
3639
|
id: "date",
|
|
@@ -3549,15 +3642,15 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
3549
3642
|
"w-full justify-start text-left font-normal text-[11px] border-[#BDBDBD]",
|
|
3550
3643
|
!date && "text-muted-foreground"
|
|
3551
3644
|
),
|
|
3552
|
-
children: date?.from ? date.to ? /* @__PURE__ */ (0,
|
|
3645
|
+
children: date?.from ? date.to ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
3553
3646
|
(0, import_date_fns2.format)(date.from, "LLL dd, y"),
|
|
3554
3647
|
" -",
|
|
3555
3648
|
" ",
|
|
3556
3649
|
(0, import_date_fns2.format)(date.to, "LLL dd, y")
|
|
3557
|
-
] }) : (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" })
|
|
3558
3651
|
}
|
|
3559
3652
|
) }),
|
|
3560
|
-
/* @__PURE__ */ (0,
|
|
3653
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3561
3654
|
Calendar,
|
|
3562
3655
|
{
|
|
3563
3656
|
mode: "range",
|
|
@@ -3568,21 +3661,21 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
3568
3661
|
}
|
|
3569
3662
|
) })
|
|
3570
3663
|
] }) }),
|
|
3571
|
-
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 })
|
|
3572
3665
|
] });
|
|
3573
3666
|
};
|
|
3574
3667
|
var DateRange_default = DateRange;
|
|
3575
3668
|
|
|
3576
3669
|
// src/components/Inputs/TextInputGroup/TextInputGroup.tsx
|
|
3577
|
-
var
|
|
3578
|
-
var
|
|
3670
|
+
var import_react30 = require("react");
|
|
3671
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3579
3672
|
var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
3580
3673
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
3581
3674
|
const isEditable = props.isEditable ?? true;
|
|
3582
3675
|
const isDisabled = props.isDisabled ?? false;
|
|
3583
3676
|
const isReadonly = props.isReadonly ?? false;
|
|
3584
3677
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
3585
|
-
(0,
|
|
3678
|
+
(0, import_react30.useEffect)(() => {
|
|
3586
3679
|
if (props.value !== void 0) {
|
|
3587
3680
|
const e = { target: { value: props.value }, type: "change" };
|
|
3588
3681
|
handleChange?.(e);
|
|
@@ -3591,8 +3684,8 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
3591
3684
|
const handleChange = (e) => {
|
|
3592
3685
|
props.onChange?.(e, props?.name || "");
|
|
3593
3686
|
};
|
|
3594
|
-
return /* @__PURE__ */ (0,
|
|
3595
|
-
/* @__PURE__ */ (0,
|
|
3687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
3688
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3596
3689
|
"div",
|
|
3597
3690
|
{
|
|
3598
3691
|
className: cn(
|
|
@@ -3602,8 +3695,8 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
3602
3695
|
props.errorMessage ? "border-red-500" : ""
|
|
3603
3696
|
),
|
|
3604
3697
|
children: [
|
|
3605
|
-
prepend && /* @__PURE__ */ (0,
|
|
3606
|
-
/* @__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)(
|
|
3607
3700
|
Input,
|
|
3608
3701
|
{
|
|
3609
3702
|
id: props.name || "prepend-input",
|
|
@@ -3625,19 +3718,19 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
3625
3718
|
readOnly: isReadonly
|
|
3626
3719
|
}
|
|
3627
3720
|
),
|
|
3628
|
-
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 })
|
|
3629
3722
|
]
|
|
3630
3723
|
}
|
|
3631
3724
|
),
|
|
3632
|
-
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 })
|
|
3633
3726
|
] });
|
|
3634
3727
|
};
|
|
3635
3728
|
var TextInputGroup_default = TextInputGroup;
|
|
3636
3729
|
|
|
3637
3730
|
// src/components/Inputs/Multiselect/MultiSelect.tsx
|
|
3638
|
-
var
|
|
3639
|
-
var
|
|
3640
|
-
var
|
|
3731
|
+
var import_react31 = require("react");
|
|
3732
|
+
var import_lucide_react11 = require("lucide-react");
|
|
3733
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3641
3734
|
function LazyMultiSelectDropdown({
|
|
3642
3735
|
value = [],
|
|
3643
3736
|
onChange,
|
|
@@ -3655,10 +3748,10 @@ function LazyMultiSelectDropdown({
|
|
|
3655
3748
|
outputFormat = "array",
|
|
3656
3749
|
...props
|
|
3657
3750
|
}) {
|
|
3658
|
-
const [isOpen, setIsOpen] = (0,
|
|
3659
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
3660
|
-
const dropdownRef = (0,
|
|
3661
|
-
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);
|
|
3662
3755
|
const ensureUnique = (arr) => {
|
|
3663
3756
|
return Array.from(new Set(arr));
|
|
3664
3757
|
};
|
|
@@ -3707,14 +3800,14 @@ function LazyMultiSelectDropdown({
|
|
|
3707
3800
|
return unique;
|
|
3708
3801
|
}
|
|
3709
3802
|
};
|
|
3710
|
-
const selectedOptions = (0,
|
|
3803
|
+
const selectedOptions = (0, import_react31.useMemo)(() => {
|
|
3711
3804
|
return normalizedValue.map((id) => {
|
|
3712
3805
|
const fromLazy = lazyOptions.find((opt) => opt.value === id);
|
|
3713
3806
|
if (fromLazy) return fromLazy;
|
|
3714
3807
|
return { value: id, label: id };
|
|
3715
3808
|
});
|
|
3716
3809
|
}, [normalizedValue, lazyOptions]);
|
|
3717
|
-
(0,
|
|
3810
|
+
(0, import_react31.useEffect)(() => {
|
|
3718
3811
|
const handleClick = (e) => {
|
|
3719
3812
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
3720
3813
|
setIsOpen(false);
|
|
@@ -3723,7 +3816,7 @@ function LazyMultiSelectDropdown({
|
|
|
3723
3816
|
document.addEventListener("mousedown", handleClick);
|
|
3724
3817
|
return () => document.removeEventListener("mousedown", handleClick);
|
|
3725
3818
|
}, []);
|
|
3726
|
-
(0,
|
|
3819
|
+
(0, import_react31.useEffect)(() => {
|
|
3727
3820
|
if (!isOpen || !hasMore || loading) return;
|
|
3728
3821
|
const obs = new IntersectionObserver(
|
|
3729
3822
|
(entries) => {
|
|
@@ -3760,8 +3853,8 @@ function LazyMultiSelectDropdown({
|
|
|
3760
3853
|
}
|
|
3761
3854
|
}
|
|
3762
3855
|
};
|
|
3763
|
-
return /* @__PURE__ */ (0,
|
|
3764
|
-
/* @__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)(
|
|
3765
3858
|
"div",
|
|
3766
3859
|
{
|
|
3767
3860
|
onClick: handleFocus,
|
|
@@ -3773,13 +3866,13 @@ function LazyMultiSelectDropdown({
|
|
|
3773
3866
|
"px-2 py-2 min-h-[35px]"
|
|
3774
3867
|
),
|
|
3775
3868
|
children: [
|
|
3776
|
-
selectedOptions.map((opt) => /* @__PURE__ */ (0,
|
|
3869
|
+
selectedOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3777
3870
|
"span",
|
|
3778
3871
|
{
|
|
3779
3872
|
className: "bg-blue-100 text-blue-700 px-2 py-1 rounded-md text-xs flex items-center gap-1",
|
|
3780
3873
|
children: [
|
|
3781
3874
|
opt.label,
|
|
3782
|
-
!disabled && !readOnly && /* @__PURE__ */ (0,
|
|
3875
|
+
!disabled && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3783
3876
|
"button",
|
|
3784
3877
|
{
|
|
3785
3878
|
type: "button",
|
|
@@ -3788,14 +3881,14 @@ function LazyMultiSelectDropdown({
|
|
|
3788
3881
|
removeTag(opt.value);
|
|
3789
3882
|
},
|
|
3790
3883
|
className: "hover:text-red-600",
|
|
3791
|
-
children: /* @__PURE__ */ (0,
|
|
3884
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react11.XIcon, { size: 12 })
|
|
3792
3885
|
}
|
|
3793
3886
|
)
|
|
3794
3887
|
]
|
|
3795
3888
|
},
|
|
3796
3889
|
opt.value
|
|
3797
3890
|
)),
|
|
3798
|
-
/* @__PURE__ */ (0,
|
|
3891
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3799
3892
|
"input",
|
|
3800
3893
|
{
|
|
3801
3894
|
type: "text",
|
|
@@ -3811,8 +3904,8 @@ function LazyMultiSelectDropdown({
|
|
|
3811
3904
|
]
|
|
3812
3905
|
}
|
|
3813
3906
|
),
|
|
3814
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
3815
|
-
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)(
|
|
3816
3909
|
"div",
|
|
3817
3910
|
{
|
|
3818
3911
|
onMouseDown: (e) => e.stopPropagation(),
|
|
@@ -3823,10 +3916,10 @@ function LazyMultiSelectDropdown({
|
|
|
3823
3916
|
top: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().bottom + window.scrollY : 0,
|
|
3824
3917
|
left: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().left + window.scrollX : 0
|
|
3825
3918
|
},
|
|
3826
|
-
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: [
|
|
3827
3920
|
lazyOptions.map((option) => {
|
|
3828
3921
|
const isSelected = normalizedValue.includes(option.value);
|
|
3829
|
-
return /* @__PURE__ */ (0,
|
|
3922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3830
3923
|
"div",
|
|
3831
3924
|
{
|
|
3832
3925
|
onClick: () => toggleSelect(option.value),
|
|
@@ -3836,13 +3929,13 @@ function LazyMultiSelectDropdown({
|
|
|
3836
3929
|
),
|
|
3837
3930
|
children: [
|
|
3838
3931
|
option.label,
|
|
3839
|
-
isSelected && /* @__PURE__ */ (0,
|
|
3932
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react11.XSquareIcon, { size: 16 })
|
|
3840
3933
|
]
|
|
3841
3934
|
},
|
|
3842
3935
|
option.value
|
|
3843
3936
|
);
|
|
3844
3937
|
}),
|
|
3845
|
-
hasMore && /* @__PURE__ */ (0,
|
|
3938
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3846
3939
|
"div",
|
|
3847
3940
|
{
|
|
3848
3941
|
ref: observerTarget,
|
|
@@ -3850,29 +3943,29 @@ function LazyMultiSelectDropdown({
|
|
|
3850
3943
|
children: loading ? "Loading\u2026" : "Scroll for more\u2026"
|
|
3851
3944
|
}
|
|
3852
3945
|
)
|
|
3853
|
-
] }) : /* @__PURE__ */ (0,
|
|
3946
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "px-3 py-3 text-center text-gray-500", children: "No results" })
|
|
3854
3947
|
}
|
|
3855
3948
|
) })
|
|
3856
3949
|
] });
|
|
3857
3950
|
}
|
|
3858
3951
|
|
|
3859
3952
|
// src/components/ui/data-table.tsx
|
|
3860
|
-
var
|
|
3953
|
+
var React12 = __toESM(require("react"));
|
|
3861
3954
|
var import_free_solid_svg_icons2 = require("@fortawesome/free-solid-svg-icons");
|
|
3862
3955
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
3863
3956
|
var import_react_table2 = require("@tanstack/react-table");
|
|
3864
3957
|
var import_axios3 = __toESM(require("axios"));
|
|
3865
|
-
var
|
|
3958
|
+
var import_lucide_react13 = require("lucide-react");
|
|
3866
3959
|
|
|
3867
3960
|
// src/components/ui/table.tsx
|
|
3868
|
-
var
|
|
3961
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3869
3962
|
function Table({ className, ...props }) {
|
|
3870
|
-
return /* @__PURE__ */ (0,
|
|
3963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3871
3964
|
"div",
|
|
3872
3965
|
{
|
|
3873
3966
|
"data-slot": "table-container",
|
|
3874
3967
|
className: "relative w-full overflow-x-auto rounded-md border border-gray-200 bg-white",
|
|
3875
|
-
children: /* @__PURE__ */ (0,
|
|
3968
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3876
3969
|
"table",
|
|
3877
3970
|
{
|
|
3878
3971
|
"data-slot": "table",
|
|
@@ -3884,7 +3977,7 @@ function Table({ className, ...props }) {
|
|
|
3884
3977
|
);
|
|
3885
3978
|
}
|
|
3886
3979
|
function TableHeader({ className, ...props }) {
|
|
3887
|
-
return /* @__PURE__ */ (0,
|
|
3980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3888
3981
|
"thead",
|
|
3889
3982
|
{
|
|
3890
3983
|
"data-slot": "table-header",
|
|
@@ -3897,7 +3990,7 @@ function TableHeader({ className, ...props }) {
|
|
|
3897
3990
|
);
|
|
3898
3991
|
}
|
|
3899
3992
|
function TableBody({ className, ...props }) {
|
|
3900
|
-
return /* @__PURE__ */ (0,
|
|
3993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3901
3994
|
"tbody",
|
|
3902
3995
|
{
|
|
3903
3996
|
"data-slot": "table-body",
|
|
@@ -3910,7 +4003,7 @@ function TableBody({ className, ...props }) {
|
|
|
3910
4003
|
);
|
|
3911
4004
|
}
|
|
3912
4005
|
function TableRow({ className, ...props }) {
|
|
3913
|
-
return /* @__PURE__ */ (0,
|
|
4006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3914
4007
|
"tr",
|
|
3915
4008
|
{
|
|
3916
4009
|
"data-slot": "table-row",
|
|
@@ -3923,7 +4016,7 @@ function TableRow({ className, ...props }) {
|
|
|
3923
4016
|
);
|
|
3924
4017
|
}
|
|
3925
4018
|
function TableHead({ className, ...props }) {
|
|
3926
|
-
return /* @__PURE__ */ (0,
|
|
4019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3927
4020
|
"th",
|
|
3928
4021
|
{
|
|
3929
4022
|
"data-slot": "table-head",
|
|
@@ -3936,7 +4029,7 @@ function TableHead({ className, ...props }) {
|
|
|
3936
4029
|
);
|
|
3937
4030
|
}
|
|
3938
4031
|
function TableCell({ className, ...props }) {
|
|
3939
|
-
return /* @__PURE__ */ (0,
|
|
4032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3940
4033
|
"td",
|
|
3941
4034
|
{
|
|
3942
4035
|
"data-slot": "table-cell",
|
|
@@ -3953,11 +4046,11 @@ function TableCell({ className, ...props }) {
|
|
|
3953
4046
|
var import_react_table = require("@tanstack/react-table");
|
|
3954
4047
|
|
|
3955
4048
|
// src/lib/table/cellRendererFactory.tsx
|
|
3956
|
-
var
|
|
4049
|
+
var import_react32 = __toESM(require("react"));
|
|
3957
4050
|
var LucideIcons2 = __toESM(require("lucide-react"));
|
|
3958
|
-
var
|
|
4051
|
+
var import_lucide_react12 = require("lucide-react");
|
|
3959
4052
|
var import_image = __toESM(require("next/image"));
|
|
3960
|
-
var
|
|
4053
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3961
4054
|
var getContrastColor = (bg) => {
|
|
3962
4055
|
let c = bg.trim().toUpperCase();
|
|
3963
4056
|
if (/^#([a-fA-F0-9]{3})$/.test(c)) {
|
|
@@ -3991,9 +4084,9 @@ var getContrastColor = (bg) => {
|
|
|
3991
4084
|
};
|
|
3992
4085
|
var sanitizeValue = (val) => {
|
|
3993
4086
|
if (val == null) return null;
|
|
3994
|
-
if (
|
|
4087
|
+
if (import_react32.default.isValidElement(val)) return val;
|
|
3995
4088
|
if (typeof val === "string" || typeof val === "number") return val;
|
|
3996
|
-
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));
|
|
3997
4090
|
if (typeof val === "object") {
|
|
3998
4091
|
if ("name" in val && typeof val.name === "string") return val.name;
|
|
3999
4092
|
if ("label" in val && typeof val.label === "string") return val.label;
|
|
@@ -4011,13 +4104,13 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4011
4104
|
switch (renderer) {
|
|
4012
4105
|
/* -------------------- BASIC -------------------- */
|
|
4013
4106
|
case "text":
|
|
4014
|
-
return /* @__PURE__ */ (0,
|
|
4107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: rowValue || formattedValue });
|
|
4015
4108
|
case "number":
|
|
4016
|
-
return /* @__PURE__ */ (0,
|
|
4109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "tabular-nums text-right", children: valueFormatter(rowValue || value, "number:2") });
|
|
4017
4110
|
case "date":
|
|
4018
|
-
return /* @__PURE__ */ (0,
|
|
4111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: valueFormatter(rowValue || value, format3) });
|
|
4019
4112
|
case "link":
|
|
4020
|
-
return /* @__PURE__ */ (0,
|
|
4113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4021
4114
|
"a",
|
|
4022
4115
|
{
|
|
4023
4116
|
href: `${rendererProps?.prefix || ""}${rowValue || formattedValue}`,
|
|
@@ -4029,7 +4122,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4029
4122
|
);
|
|
4030
4123
|
/* -------------------- VISUAL -------------------- */
|
|
4031
4124
|
case "image":
|
|
4032
|
-
return /* @__PURE__ */ (0,
|
|
4125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4033
4126
|
import_image.default,
|
|
4034
4127
|
{
|
|
4035
4128
|
src: rowValue || formattedValue || rendererProps?.fallback || "/placeholder.png",
|
|
@@ -4045,7 +4138,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4045
4138
|
) });
|
|
4046
4139
|
case "icon":
|
|
4047
4140
|
if (!formattedValue) return null;
|
|
4048
|
-
return /* @__PURE__ */ (0,
|
|
4141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4049
4142
|
Icon,
|
|
4050
4143
|
{
|
|
4051
4144
|
iconSet: rendererProps?.iconSet,
|
|
@@ -4062,7 +4155,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4062
4155
|
const color = rendererProps?.colorMap?.[formattedValue] || rendererProps?.color || "gray";
|
|
4063
4156
|
if (!formattedValue) return null;
|
|
4064
4157
|
const textColor = getContrastColor(color);
|
|
4065
|
-
return /* @__PURE__ */ (0,
|
|
4158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4066
4159
|
"span",
|
|
4067
4160
|
{
|
|
4068
4161
|
className: `inline-block px-2 py-1 text-xs rounded-full bg-${color}-100 text-${textColor}-700 ${rendererProps?.className || ""}`,
|
|
@@ -4077,13 +4170,13 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4077
4170
|
const IconComponent = typeof maybeIcon === "function" ? maybeIcon : LucideIcons2.Star;
|
|
4078
4171
|
if (!formattedValue) return null;
|
|
4079
4172
|
const textColor = getContrastColor(color);
|
|
4080
|
-
return /* @__PURE__ */ (0,
|
|
4173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
4081
4174
|
"span",
|
|
4082
4175
|
{
|
|
4083
4176
|
className: `inline-flex items-center gap-1 px-2 py-1 text-xs rounded-full bg-[${color}]-100 text-[${textColor}]-700`,
|
|
4084
4177
|
style: { backgroundColor: color, color: textColor },
|
|
4085
4178
|
children: [
|
|
4086
|
-
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" }) }),
|
|
4087
4180
|
formattedValue
|
|
4088
4181
|
]
|
|
4089
4182
|
}
|
|
@@ -4091,7 +4184,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4091
4184
|
}
|
|
4092
4185
|
/* -------------------- INTERACTIVE -------------------- */
|
|
4093
4186
|
case "button":
|
|
4094
|
-
return /* @__PURE__ */ (0,
|
|
4187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4095
4188
|
"button",
|
|
4096
4189
|
{
|
|
4097
4190
|
onClick: () => rendererProps?.onClick?.(row, formattedValue),
|
|
@@ -4100,8 +4193,8 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4100
4193
|
}
|
|
4101
4194
|
);
|
|
4102
4195
|
case "switch":
|
|
4103
|
-
return /* @__PURE__ */ (0,
|
|
4104
|
-
/* @__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)(
|
|
4105
4198
|
"input",
|
|
4106
4199
|
{
|
|
4107
4200
|
type: "checkbox",
|
|
@@ -4110,10 +4203,10 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4110
4203
|
className: "sr-only peer"
|
|
4111
4204
|
}
|
|
4112
4205
|
),
|
|
4113
|
-
/* @__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" }) })
|
|
4114
4207
|
] });
|
|
4115
4208
|
case "progress":
|
|
4116
|
-
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)(
|
|
4117
4210
|
"div",
|
|
4118
4211
|
{
|
|
4119
4212
|
className: "bg-blue-600 h-2 rounded-full transition-all",
|
|
@@ -4122,8 +4215,8 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4122
4215
|
) });
|
|
4123
4216
|
case "rating": {
|
|
4124
4217
|
const stars = Math.round(Number(rowValue || formattedValue) || 0);
|
|
4125
|
-
return /* @__PURE__ */ (0,
|
|
4126
|
-
|
|
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,
|
|
4127
4220
|
{
|
|
4128
4221
|
size: 16,
|
|
4129
4222
|
className: i < stars ? "text-yellow-400" : "text-gray-300",
|
|
@@ -4133,7 +4226,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4133
4226
|
)) });
|
|
4134
4227
|
}
|
|
4135
4228
|
case "checkbox":
|
|
4136
|
-
return /* @__PURE__ */ (0,
|
|
4229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4137
4230
|
"input",
|
|
4138
4231
|
{
|
|
4139
4232
|
type: "checkbox",
|
|
@@ -4143,7 +4236,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4143
4236
|
}
|
|
4144
4237
|
);
|
|
4145
4238
|
case "html":
|
|
4146
|
-
return /* @__PURE__ */ (0,
|
|
4239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4147
4240
|
"span",
|
|
4148
4241
|
{
|
|
4149
4242
|
dangerouslySetInnerHTML: { __html: String(rowValue || formattedValue) }
|
|
@@ -4153,7 +4246,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4153
4246
|
case "custom": {
|
|
4154
4247
|
const CustomRenderer = customRenderers[rendererProps?.customRendererId] || customRenderers[rendererProps?.rendererId];
|
|
4155
4248
|
if (CustomRenderer)
|
|
4156
|
-
return /* @__PURE__ */ (0,
|
|
4249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4157
4250
|
CustomRenderer,
|
|
4158
4251
|
{
|
|
4159
4252
|
value: formattedValue,
|
|
@@ -4161,11 +4254,11 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
4161
4254
|
...rendererProps
|
|
4162
4255
|
}
|
|
4163
4256
|
);
|
|
4164
|
-
return /* @__PURE__ */ (0,
|
|
4257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Missing custom renderer" });
|
|
4165
4258
|
}
|
|
4166
4259
|
/* -------------------- DEFAULT -------------------- */
|
|
4167
4260
|
default:
|
|
4168
|
-
return /* @__PURE__ */ (0,
|
|
4261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: formattedValue || "-" });
|
|
4169
4262
|
}
|
|
4170
4263
|
};
|
|
4171
4264
|
|
|
@@ -4229,7 +4322,7 @@ var useDynamicColumns = (config, customRenderers = {}, customFormatters = {}) =>
|
|
|
4229
4322
|
};
|
|
4230
4323
|
|
|
4231
4324
|
// src/components/ui/data-table.tsx
|
|
4232
|
-
var
|
|
4325
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4233
4326
|
function DataTable({
|
|
4234
4327
|
columns,
|
|
4235
4328
|
data,
|
|
@@ -4256,13 +4349,13 @@ function DataTable({
|
|
|
4256
4349
|
enableTotalRecords,
|
|
4257
4350
|
getRowCount
|
|
4258
4351
|
}) {
|
|
4259
|
-
const [columnFilters, setColumnFilters] =
|
|
4260
|
-
const [columnVisibility, setColumnVisibility] =
|
|
4261
|
-
const hasLoadedInitialState =
|
|
4262
|
-
const isSavingRef =
|
|
4263
|
-
const isFetchingRef =
|
|
4264
|
-
const [fetchLoading, setFetchLoading] =
|
|
4265
|
-
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) => {
|
|
4266
4359
|
if (!apiSettings || !apiSettings.columns || !apiSettings.columns.visible) {
|
|
4267
4360
|
return {};
|
|
4268
4361
|
}
|
|
@@ -4273,7 +4366,7 @@ function DataTable({
|
|
|
4273
4366
|
});
|
|
4274
4367
|
return result;
|
|
4275
4368
|
}, []);
|
|
4276
|
-
const transformFrontendToApi =
|
|
4369
|
+
const transformFrontendToApi = React12.useCallback((visibility) => {
|
|
4277
4370
|
const visibleColumns = Object.keys(visibility).filter((colId) => visibility[colId] === true);
|
|
4278
4371
|
return {
|
|
4279
4372
|
columns: {
|
|
@@ -4281,7 +4374,7 @@ function DataTable({
|
|
|
4281
4374
|
}
|
|
4282
4375
|
};
|
|
4283
4376
|
}, []);
|
|
4284
|
-
const fetchColumnPreferences =
|
|
4377
|
+
const fetchColumnPreferences = React12.useCallback(async () => {
|
|
4285
4378
|
if (isFetchingRef.current) {
|
|
4286
4379
|
return;
|
|
4287
4380
|
}
|
|
@@ -4341,7 +4434,7 @@ function DataTable({
|
|
|
4341
4434
|
isFetchingRef.current = false;
|
|
4342
4435
|
}
|
|
4343
4436
|
}, [tableId, transformApiToFrontend, manageColumns]);
|
|
4344
|
-
const saveColumnPreferences =
|
|
4437
|
+
const saveColumnPreferences = React12.useCallback(async (visibility) => {
|
|
4345
4438
|
if (!tableId || isSavingRef.current || !manageColumns) {
|
|
4346
4439
|
return;
|
|
4347
4440
|
}
|
|
@@ -4367,7 +4460,7 @@ function DataTable({
|
|
|
4367
4460
|
isSavingRef.current = false;
|
|
4368
4461
|
}
|
|
4369
4462
|
}, [tableId, transformFrontendToApi, manageColumns]);
|
|
4370
|
-
|
|
4463
|
+
React12.useEffect(() => {
|
|
4371
4464
|
if (hasLoadedInitialState.current || isFetchingRef.current) {
|
|
4372
4465
|
return;
|
|
4373
4466
|
}
|
|
@@ -4378,10 +4471,10 @@ function DataTable({
|
|
|
4378
4471
|
fetchColumnPreferences();
|
|
4379
4472
|
}
|
|
4380
4473
|
}, [tableId, manageColumns]);
|
|
4381
|
-
const [manualSort, setManualSort] =
|
|
4382
|
-
const [searchTerm, setSearchTerm] =
|
|
4474
|
+
const [manualSort, setManualSort] = React12.useState(null);
|
|
4475
|
+
const [searchTerm, setSearchTerm] = React12.useState("");
|
|
4383
4476
|
const tableData = Array.isArray(data) ? data : [];
|
|
4384
|
-
const filteredData =
|
|
4477
|
+
const filteredData = React12.useMemo(() => {
|
|
4385
4478
|
if (paginationMode === "client" && globalSearch && searchTerm.trim()) {
|
|
4386
4479
|
const searchLower = searchTerm.toLowerCase().trim();
|
|
4387
4480
|
return tableData.filter((row) => {
|
|
@@ -4404,7 +4497,7 @@ function DataTable({
|
|
|
4404
4497
|
id: "__select__",
|
|
4405
4498
|
renderer: "checkbox",
|
|
4406
4499
|
size: 40,
|
|
4407
|
-
header: ({ table: table2 }) => /* @__PURE__ */ (0,
|
|
4500
|
+
header: ({ table: table2 }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4408
4501
|
"input",
|
|
4409
4502
|
{
|
|
4410
4503
|
type: "checkbox",
|
|
@@ -4422,12 +4515,12 @@ function DataTable({
|
|
|
4422
4515
|
});
|
|
4423
4516
|
}
|
|
4424
4517
|
const dynamicCols = useDynamicColumns({ columns: finalCols, enableRowSelection });
|
|
4425
|
-
const [rowSelection, setRowSelection] =
|
|
4426
|
-
const [localPageSize, setLocalPageSize] =
|
|
4427
|
-
const [localPageIndex, setLocalPageIndex] =
|
|
4428
|
-
const isUpdatingPageSizeRef =
|
|
4429
|
-
const tableRef =
|
|
4430
|
-
|
|
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(() => {
|
|
4431
4524
|
if (paginationMode === "client") {
|
|
4432
4525
|
setLocalPageSize(pageSize);
|
|
4433
4526
|
} else if (paginationMode === "server" && meta?.limit != null) {
|
|
@@ -4503,7 +4596,7 @@ function DataTable({
|
|
|
4503
4596
|
}
|
|
4504
4597
|
}
|
|
4505
4598
|
});
|
|
4506
|
-
|
|
4599
|
+
React12.useEffect(() => {
|
|
4507
4600
|
tableRef.current = table;
|
|
4508
4601
|
if (table && !hasLoadedInitialState.current && !isFetchingRef.current && tableId) {
|
|
4509
4602
|
fetchColumnPreferences();
|
|
@@ -4541,7 +4634,7 @@ function DataTable({
|
|
|
4541
4634
|
setLocalPageIndex(0);
|
|
4542
4635
|
}
|
|
4543
4636
|
};
|
|
4544
|
-
const pageSizeOptions =
|
|
4637
|
+
const pageSizeOptions = React12.useMemo(() => {
|
|
4545
4638
|
if (paginationMode === "client") {
|
|
4546
4639
|
return [5, 10, 20, 50, 100];
|
|
4547
4640
|
}
|
|
@@ -4552,10 +4645,10 @@ function DataTable({
|
|
|
4552
4645
|
}
|
|
4553
4646
|
return base;
|
|
4554
4647
|
}, [paginationMode, meta?.limit]);
|
|
4555
|
-
return /* @__PURE__ */ (0,
|
|
4556
|
-
!loading && /* @__PURE__ */ (0,
|
|
4557
|
-
/* @__PURE__ */ (0,
|
|
4558
|
-
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)(
|
|
4559
4652
|
Button,
|
|
4560
4653
|
{
|
|
4561
4654
|
size: "sm",
|
|
@@ -4570,9 +4663,9 @@ function DataTable({
|
|
|
4570
4663
|
children: fetchLoading ? "Fetching..." : "Get Count"
|
|
4571
4664
|
}
|
|
4572
4665
|
),
|
|
4573
|
-
globalSearch && /* @__PURE__ */ (0,
|
|
4574
|
-
/* @__PURE__ */ (0,
|
|
4575
|
-
/* @__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)(
|
|
4576
4669
|
"input",
|
|
4577
4670
|
{
|
|
4578
4671
|
type: "text",
|
|
@@ -4594,9 +4687,9 @@ function DataTable({
|
|
|
4594
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]"
|
|
4595
4688
|
}
|
|
4596
4689
|
),
|
|
4597
|
-
/* @__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 })
|
|
4598
4691
|
] }),
|
|
4599
|
-
paginationMode === "server" && /* @__PURE__ */ (0,
|
|
4692
|
+
paginationMode === "server" && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4600
4693
|
Button,
|
|
4601
4694
|
{
|
|
4602
4695
|
size: "sm",
|
|
@@ -4607,8 +4700,8 @@ function DataTable({
|
|
|
4607
4700
|
)
|
|
4608
4701
|
] })
|
|
4609
4702
|
] }),
|
|
4610
|
-
manageColumns && /* @__PURE__ */ (0,
|
|
4611
|
-
/* @__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)(
|
|
4612
4705
|
Button,
|
|
4613
4706
|
{
|
|
4614
4707
|
variant: "outline",
|
|
@@ -4617,11 +4710,11 @@ function DataTable({
|
|
|
4617
4710
|
children: "Manage Columns"
|
|
4618
4711
|
}
|
|
4619
4712
|
) }),
|
|
4620
|
-
/* @__PURE__ */ (0,
|
|
4621
|
-
/* @__PURE__ */ (0,
|
|
4622
|
-
/* @__PURE__ */ (0,
|
|
4623
|
-
/* @__PURE__ */ (0,
|
|
4624
|
-
/* @__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)(
|
|
4625
4718
|
"input",
|
|
4626
4719
|
{
|
|
4627
4720
|
type: "checkbox",
|
|
@@ -4642,8 +4735,8 @@ function DataTable({
|
|
|
4642
4735
|
] }),
|
|
4643
4736
|
table.getAllLeafColumns().map((column) => {
|
|
4644
4737
|
const header = column.columnDef.header;
|
|
4645
|
-
return /* @__PURE__ */ (0,
|
|
4646
|
-
/* @__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)(
|
|
4647
4740
|
"input",
|
|
4648
4741
|
{
|
|
4649
4742
|
type: "checkbox",
|
|
@@ -4658,12 +4751,12 @@ function DataTable({
|
|
|
4658
4751
|
] })
|
|
4659
4752
|
] })
|
|
4660
4753
|
] }),
|
|
4661
|
-
/* @__PURE__ */ (0,
|
|
4662
|
-
/* @__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) => {
|
|
4663
4756
|
const canSort = header.column.getCanSort();
|
|
4664
4757
|
const canFilter = header.column.getCanFilter();
|
|
4665
4758
|
const sortDir = manualSort?.key === header.column.id ? manualSort.dir : null;
|
|
4666
|
-
return /* @__PURE__ */ (0,
|
|
4759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4667
4760
|
TableHead,
|
|
4668
4761
|
{
|
|
4669
4762
|
className: "relative select-none",
|
|
@@ -4672,8 +4765,8 @@ function DataTable({
|
|
|
4672
4765
|
minWidth: header.column.columnDef.minSize,
|
|
4673
4766
|
maxWidth: header.column.columnDef.maxSize
|
|
4674
4767
|
},
|
|
4675
|
-
children: /* @__PURE__ */ (0,
|
|
4676
|
-
/* @__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)(
|
|
4677
4770
|
"span",
|
|
4678
4771
|
{
|
|
4679
4772
|
className: `flex items-center gap-1 ${canSort ? "cursor-pointer" : ""}`,
|
|
@@ -4685,32 +4778,32 @@ function DataTable({
|
|
|
4685
4778
|
},
|
|
4686
4779
|
children: [
|
|
4687
4780
|
(0, import_react_table2.flexRender)(header.column.columnDef.header, header.getContext()),
|
|
4688
|
-
canSort && /* @__PURE__ */ (0,
|
|
4689
|
-
sortDir === "asc" && /* @__PURE__ */ (0,
|
|
4690
|
-
sortDir === "desc" && /* @__PURE__ */ (0,
|
|
4691
|
-
!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" })
|
|
4692
4785
|
] })
|
|
4693
4786
|
]
|
|
4694
4787
|
}
|
|
4695
4788
|
),
|
|
4696
|
-
canFilter && /* @__PURE__ */ (0,
|
|
4697
|
-
/* @__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)(
|
|
4698
4791
|
"span",
|
|
4699
4792
|
{
|
|
4700
4793
|
role: "presentation",
|
|
4701
4794
|
className: "pl-5 cursor-pointer",
|
|
4702
4795
|
onClick: (e) => e.stopPropagation(),
|
|
4703
|
-
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" })
|
|
4704
4797
|
}
|
|
4705
4798
|
) }),
|
|
4706
|
-
/* @__PURE__ */ (0,
|
|
4799
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4707
4800
|
PopoverContent,
|
|
4708
4801
|
{
|
|
4709
4802
|
align: "center",
|
|
4710
4803
|
sideOffset: 14,
|
|
4711
4804
|
className: "w-50 p-3 z-[200] border-gray-300",
|
|
4712
4805
|
avoidCollisions: true,
|
|
4713
|
-
children: /* @__PURE__ */ (0,
|
|
4806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
4714
4807
|
"form",
|
|
4715
4808
|
{
|
|
4716
4809
|
onSubmit: (e) => {
|
|
@@ -4723,8 +4816,8 @@ function DataTable({
|
|
|
4723
4816
|
},
|
|
4724
4817
|
className: "space-y-2",
|
|
4725
4818
|
children: [
|
|
4726
|
-
/* @__PURE__ */ (0,
|
|
4727
|
-
/* @__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)(
|
|
4728
4821
|
"input",
|
|
4729
4822
|
{
|
|
4730
4823
|
name: "filter",
|
|
@@ -4734,7 +4827,7 @@ function DataTable({
|
|
|
4734
4827
|
autoComplete: "off"
|
|
4735
4828
|
}
|
|
4736
4829
|
),
|
|
4737
|
-
/* @__PURE__ */ (0,
|
|
4830
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "justify-end flex", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4738
4831
|
Button,
|
|
4739
4832
|
{
|
|
4740
4833
|
type: "submit",
|
|
@@ -4753,9 +4846,9 @@ function DataTable({
|
|
|
4753
4846
|
`header-${header.id}-${index}`
|
|
4754
4847
|
);
|
|
4755
4848
|
}) }, `header-group-${hg.id}`)) }),
|
|
4756
|
-
/* @__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) => {
|
|
4757
4850
|
const column = header.column;
|
|
4758
|
-
return /* @__PURE__ */ (0,
|
|
4851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4759
4852
|
TableCell,
|
|
4760
4853
|
{
|
|
4761
4854
|
className: "p-3",
|
|
@@ -4764,15 +4857,15 @@ function DataTable({
|
|
|
4764
4857
|
minWidth: column.columnDef.minSize,
|
|
4765
4858
|
maxWidth: column.columnDef.maxSize
|
|
4766
4859
|
},
|
|
4767
|
-
children: /* @__PURE__ */ (0,
|
|
4860
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "h-4 bg-gray-200 rounded w-full block animate-pulse" })
|
|
4768
4861
|
},
|
|
4769
4862
|
j
|
|
4770
4863
|
);
|
|
4771
|
-
}) }, 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) => {
|
|
4772
4865
|
const meta2 = cell.column.columnDef.meta || {};
|
|
4773
4866
|
const isClickable = meta2?.isClickable;
|
|
4774
4867
|
const isLastCell = cellIndex === arr.length - 1;
|
|
4775
|
-
return /* @__PURE__ */ (0,
|
|
4868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
4776
4869
|
TableCell,
|
|
4777
4870
|
{
|
|
4778
4871
|
className: `break-words whitespace-normal align-top ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2 ${meta2?.cellClass ?? ""}`,
|
|
@@ -4789,9 +4882,9 @@ function DataTable({
|
|
|
4789
4882
|
},
|
|
4790
4883
|
children: [
|
|
4791
4884
|
(0, import_react_table2.flexRender)(cell.column.columnDef.cell, cell.getContext()),
|
|
4792
|
-
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) => {
|
|
4793
4886
|
const isDelete = action.id === "delete" || action.icon === "delete";
|
|
4794
|
-
return /* @__PURE__ */ (0,
|
|
4887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4795
4888
|
"button",
|
|
4796
4889
|
{
|
|
4797
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"}`,
|
|
@@ -4813,23 +4906,23 @@ function DataTable({
|
|
|
4813
4906
|
},
|
|
4814
4907
|
`cell-${cell.id}-${cellIndex}`
|
|
4815
4908
|
);
|
|
4816
|
-
}) }, 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." }) }) }) })
|
|
4817
4910
|
] }),
|
|
4818
|
-
pagination && /* @__PURE__ */ (0,
|
|
4819
|
-
!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)(
|
|
4820
4913
|
"select",
|
|
4821
4914
|
{
|
|
4822
4915
|
value: paginationMode === "server" && meta?.limit != null ? meta.limit : localPageSize,
|
|
4823
4916
|
onChange: handlePageSizeChange,
|
|
4824
4917
|
className: "ml-2 border rounded py-1 text-sm cursor-pointer border-blue-600",
|
|
4825
|
-
children: pageSizeOptions.map((size) => /* @__PURE__ */ (0,
|
|
4918
|
+
children: pageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("option", { value: size, children: [
|
|
4826
4919
|
size,
|
|
4827
4920
|
" / page"
|
|
4828
4921
|
] }, size))
|
|
4829
4922
|
}
|
|
4830
4923
|
) }),
|
|
4831
|
-
/* @__PURE__ */ (0,
|
|
4832
|
-
/* @__PURE__ */ (0,
|
|
4924
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4925
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4833
4926
|
"button",
|
|
4834
4927
|
{
|
|
4835
4928
|
onClick: () => table.previousPage(),
|
|
@@ -4838,7 +4931,7 @@ function DataTable({
|
|
|
4838
4931
|
children: "Prev"
|
|
4839
4932
|
}
|
|
4840
4933
|
),
|
|
4841
|
-
/* @__PURE__ */ (0,
|
|
4934
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4842
4935
|
"button",
|
|
4843
4936
|
{
|
|
4844
4937
|
onClick: () => table.nextPage(),
|
|
@@ -4853,7 +4946,7 @@ function DataTable({
|
|
|
4853
4946
|
}
|
|
4854
4947
|
|
|
4855
4948
|
// src/components/DataDisplay/Table/Table.tsx
|
|
4856
|
-
var
|
|
4949
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4857
4950
|
var Table2 = ({
|
|
4858
4951
|
columns,
|
|
4859
4952
|
data,
|
|
@@ -4878,7 +4971,7 @@ var Table2 = ({
|
|
|
4878
4971
|
const rawColumns = Array.isArray(columns) ? columns : [];
|
|
4879
4972
|
const rawData = Array.isArray(data) ? data : [];
|
|
4880
4973
|
const isControlled = typeof page === "number";
|
|
4881
|
-
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)(
|
|
4882
4975
|
DataTable,
|
|
4883
4976
|
{
|
|
4884
4977
|
...props,
|
|
@@ -4909,10 +5002,10 @@ var Table2 = ({
|
|
|
4909
5002
|
var Table_default = Table2;
|
|
4910
5003
|
|
|
4911
5004
|
// src/components/ui/pagination.tsx
|
|
4912
|
-
var
|
|
4913
|
-
var
|
|
5005
|
+
var import_lucide_react14 = require("lucide-react");
|
|
5006
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4914
5007
|
function Pagination({ className, ...props }) {
|
|
4915
|
-
return /* @__PURE__ */ (0,
|
|
5008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4916
5009
|
"nav",
|
|
4917
5010
|
{
|
|
4918
5011
|
role: "navigation",
|
|
@@ -4927,7 +5020,7 @@ function PaginationContent({
|
|
|
4927
5020
|
className,
|
|
4928
5021
|
...props
|
|
4929
5022
|
}) {
|
|
4930
|
-
return /* @__PURE__ */ (0,
|
|
5023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4931
5024
|
"ul",
|
|
4932
5025
|
{
|
|
4933
5026
|
"data-slot": "pagination-content",
|
|
@@ -4937,7 +5030,7 @@ function PaginationContent({
|
|
|
4937
5030
|
);
|
|
4938
5031
|
}
|
|
4939
5032
|
function PaginationItem({ ...props }) {
|
|
4940
|
-
return /* @__PURE__ */ (0,
|
|
5033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("li", { "data-slot": "pagination-item", ...props });
|
|
4941
5034
|
}
|
|
4942
5035
|
function PaginationLink({
|
|
4943
5036
|
className,
|
|
@@ -4945,7 +5038,7 @@ function PaginationLink({
|
|
|
4945
5038
|
size = "icon",
|
|
4946
5039
|
...props
|
|
4947
5040
|
}) {
|
|
4948
|
-
return /* @__PURE__ */ (0,
|
|
5041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4949
5042
|
"a",
|
|
4950
5043
|
{
|
|
4951
5044
|
"aria-current": isActive ? "page" : void 0,
|
|
@@ -4966,7 +5059,7 @@ function PaginationPrevious({
|
|
|
4966
5059
|
className,
|
|
4967
5060
|
...props
|
|
4968
5061
|
}) {
|
|
4969
|
-
return /* @__PURE__ */ (0,
|
|
5062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4970
5063
|
PaginationLink,
|
|
4971
5064
|
{
|
|
4972
5065
|
"aria-label": "Go to previous page",
|
|
@@ -4974,8 +5067,8 @@ function PaginationPrevious({
|
|
|
4974
5067
|
className: cn("gap-1 px-2.5 sm:pl-2.5", className),
|
|
4975
5068
|
...props,
|
|
4976
5069
|
children: [
|
|
4977
|
-
/* @__PURE__ */ (0,
|
|
4978
|
-
/* @__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" })
|
|
4979
5072
|
]
|
|
4980
5073
|
}
|
|
4981
5074
|
);
|
|
@@ -4984,7 +5077,7 @@ function PaginationNext({
|
|
|
4984
5077
|
className,
|
|
4985
5078
|
...props
|
|
4986
5079
|
}) {
|
|
4987
|
-
return /* @__PURE__ */ (0,
|
|
5080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4988
5081
|
PaginationLink,
|
|
4989
5082
|
{
|
|
4990
5083
|
"aria-label": "Go to next page",
|
|
@@ -4992,8 +5085,8 @@ function PaginationNext({
|
|
|
4992
5085
|
className: cn("gap-1 px-2.5 sm:pr-2.5", className),
|
|
4993
5086
|
...props,
|
|
4994
5087
|
children: [
|
|
4995
|
-
/* @__PURE__ */ (0,
|
|
4996
|
-
/* @__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, {})
|
|
4997
5090
|
]
|
|
4998
5091
|
}
|
|
4999
5092
|
);
|
|
@@ -5002,7 +5095,7 @@ function PaginationEllipsis({
|
|
|
5002
5095
|
className,
|
|
5003
5096
|
...props
|
|
5004
5097
|
}) {
|
|
5005
|
-
return /* @__PURE__ */ (0,
|
|
5098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
5006
5099
|
"span",
|
|
5007
5100
|
{
|
|
5008
5101
|
"aria-hidden": true,
|
|
@@ -5010,15 +5103,15 @@ function PaginationEllipsis({
|
|
|
5010
5103
|
className: cn("flex size-9 items-center justify-center", className),
|
|
5011
5104
|
...props,
|
|
5012
5105
|
children: [
|
|
5013
|
-
/* @__PURE__ */ (0,
|
|
5014
|
-
/* @__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" })
|
|
5015
5108
|
]
|
|
5016
5109
|
}
|
|
5017
5110
|
);
|
|
5018
5111
|
}
|
|
5019
5112
|
|
|
5020
5113
|
// src/components/DataDisplay/Pagination/Pagination.tsx
|
|
5021
|
-
var
|
|
5114
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5022
5115
|
var CustomPagination = ({
|
|
5023
5116
|
totalPages,
|
|
5024
5117
|
currentPage,
|
|
@@ -5064,10 +5157,10 @@ var CustomPagination = ({
|
|
|
5064
5157
|
}
|
|
5065
5158
|
};
|
|
5066
5159
|
const pageNumbers = getPageNumbers();
|
|
5067
|
-
return /* @__PURE__ */ (0,
|
|
5068
|
-
/* @__PURE__ */ (0,
|
|
5069
|
-
/* @__PURE__ */ (0,
|
|
5070
|
-
/* @__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)(
|
|
5071
5164
|
Select,
|
|
5072
5165
|
{
|
|
5073
5166
|
defaultValue: String(perPage),
|
|
@@ -5075,26 +5168,26 @@ var CustomPagination = ({
|
|
|
5075
5168
|
onPageChange({ page: 1, itemsPerPage: Number(value) });
|
|
5076
5169
|
},
|
|
5077
5170
|
children: [
|
|
5078
|
-
/* @__PURE__ */ (0,
|
|
5079
|
-
/* @__PURE__ */ (0,
|
|
5080
|
-
/* @__PURE__ */ (0,
|
|
5081
|
-
/* @__PURE__ */ (0,
|
|
5082
|
-
/* @__PURE__ */ (0,
|
|
5083
|
-
/* @__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" })
|
|
5084
5177
|
] })
|
|
5085
5178
|
]
|
|
5086
5179
|
}
|
|
5087
5180
|
)
|
|
5088
5181
|
] }),
|
|
5089
|
-
/* @__PURE__ */ (0,
|
|
5090
|
-
/* @__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)(
|
|
5091
5184
|
PaginationPrevious,
|
|
5092
5185
|
{
|
|
5093
5186
|
onClick: () => handlePageChange(currentPage - 1),
|
|
5094
5187
|
className: currentPage === 1 ? "pointer-events-none opacity-50" : "cursor-pointer"
|
|
5095
5188
|
}
|
|
5096
5189
|
) }),
|
|
5097
|
-
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)(
|
|
5098
5191
|
PaginationLink,
|
|
5099
5192
|
{
|
|
5100
5193
|
onClick: () => handlePageChange(pageNumber),
|
|
@@ -5103,7 +5196,7 @@ var CustomPagination = ({
|
|
|
5103
5196
|
children: pageNumber
|
|
5104
5197
|
}
|
|
5105
5198
|
) }, index)),
|
|
5106
|
-
/* @__PURE__ */ (0,
|
|
5199
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5107
5200
|
PaginationNext,
|
|
5108
5201
|
{
|
|
5109
5202
|
onClick: () => handlePageChange(currentPage + 1),
|
|
@@ -5116,23 +5209,23 @@ var CustomPagination = ({
|
|
|
5116
5209
|
var Pagination_default = CustomPagination;
|
|
5117
5210
|
|
|
5118
5211
|
// src/components/DataDisplay/HistoryTimeline/HistoryTimeline.tsx
|
|
5119
|
-
var
|
|
5120
|
-
var
|
|
5212
|
+
var import_react33 = require("react");
|
|
5213
|
+
var import_lucide_react16 = require("lucide-react");
|
|
5121
5214
|
|
|
5122
5215
|
// src/components/ui/accordion.tsx
|
|
5123
5216
|
var AccordionPrimitive = __toESM(require("@radix-ui/react-accordion"));
|
|
5124
|
-
var
|
|
5125
|
-
var
|
|
5217
|
+
var import_lucide_react15 = require("lucide-react");
|
|
5218
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5126
5219
|
function Accordion2({
|
|
5127
5220
|
...props
|
|
5128
5221
|
}) {
|
|
5129
|
-
return /* @__PURE__ */ (0,
|
|
5222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AccordionPrimitive.Root, { "data-slot": "accordion", ...props });
|
|
5130
5223
|
}
|
|
5131
5224
|
function AccordionItem({
|
|
5132
5225
|
className,
|
|
5133
5226
|
...props
|
|
5134
5227
|
}) {
|
|
5135
|
-
return /* @__PURE__ */ (0,
|
|
5228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5136
5229
|
AccordionPrimitive.Item,
|
|
5137
5230
|
{
|
|
5138
5231
|
"data-slot": "accordion-item",
|
|
@@ -5146,7 +5239,7 @@ function AccordionTrigger({
|
|
|
5146
5239
|
children,
|
|
5147
5240
|
...props
|
|
5148
5241
|
}) {
|
|
5149
|
-
return /* @__PURE__ */ (0,
|
|
5242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
5150
5243
|
AccordionPrimitive.Trigger,
|
|
5151
5244
|
{
|
|
5152
5245
|
"data-slot": "accordion-trigger",
|
|
@@ -5157,7 +5250,7 @@ function AccordionTrigger({
|
|
|
5157
5250
|
...props,
|
|
5158
5251
|
children: [
|
|
5159
5252
|
children,
|
|
5160
|
-
/* @__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" })
|
|
5161
5254
|
]
|
|
5162
5255
|
}
|
|
5163
5256
|
) });
|
|
@@ -5167,21 +5260,21 @@ function AccordionContent({
|
|
|
5167
5260
|
children,
|
|
5168
5261
|
...props
|
|
5169
5262
|
}) {
|
|
5170
|
-
return /* @__PURE__ */ (0,
|
|
5263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5171
5264
|
AccordionPrimitive.Content,
|
|
5172
5265
|
{
|
|
5173
5266
|
"data-slot": "accordion-content",
|
|
5174
5267
|
className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
|
5175
5268
|
...props,
|
|
5176
|
-
children: /* @__PURE__ */ (0,
|
|
5269
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: cn("pt-0 pb-4", className), children })
|
|
5177
5270
|
}
|
|
5178
5271
|
);
|
|
5179
5272
|
}
|
|
5180
5273
|
|
|
5181
5274
|
// src/components/ui/card.tsx
|
|
5182
|
-
var
|
|
5275
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5183
5276
|
function Card({ className, ...props }) {
|
|
5184
|
-
return /* @__PURE__ */ (0,
|
|
5277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5185
5278
|
"div",
|
|
5186
5279
|
{
|
|
5187
5280
|
"data-slot": "card",
|
|
@@ -5194,7 +5287,7 @@ function Card({ className, ...props }) {
|
|
|
5194
5287
|
);
|
|
5195
5288
|
}
|
|
5196
5289
|
function CardHeader({ className, ...props }) {
|
|
5197
|
-
return /* @__PURE__ */ (0,
|
|
5290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5198
5291
|
"div",
|
|
5199
5292
|
{
|
|
5200
5293
|
"data-slot": "card-header",
|
|
@@ -5207,7 +5300,7 @@ function CardHeader({ className, ...props }) {
|
|
|
5207
5300
|
);
|
|
5208
5301
|
}
|
|
5209
5302
|
function CardTitle({ className, ...props }) {
|
|
5210
|
-
return /* @__PURE__ */ (0,
|
|
5303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5211
5304
|
"div",
|
|
5212
5305
|
{
|
|
5213
5306
|
"data-slot": "card-title",
|
|
@@ -5217,7 +5310,7 @@ function CardTitle({ className, ...props }) {
|
|
|
5217
5310
|
);
|
|
5218
5311
|
}
|
|
5219
5312
|
function CardContent({ className, ...props }) {
|
|
5220
|
-
return /* @__PURE__ */ (0,
|
|
5313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5221
5314
|
"div",
|
|
5222
5315
|
{
|
|
5223
5316
|
"data-slot": "card-content",
|
|
@@ -5228,7 +5321,7 @@ function CardContent({ className, ...props }) {
|
|
|
5228
5321
|
}
|
|
5229
5322
|
|
|
5230
5323
|
// src/components/DataDisplay/HistoryTimeline/HistoryTimeline.tsx
|
|
5231
|
-
var
|
|
5324
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5232
5325
|
function getValue(item, key) {
|
|
5233
5326
|
if (!key) return void 0;
|
|
5234
5327
|
return item[key];
|
|
@@ -5242,33 +5335,33 @@ var HistoryTimeline = ({
|
|
|
5242
5335
|
createdAtKey,
|
|
5243
5336
|
...props
|
|
5244
5337
|
}) => {
|
|
5245
|
-
const data = (0,
|
|
5338
|
+
const data = (0, import_react33.useMemo)(() => {
|
|
5246
5339
|
if (Array.isArray(props.data)) {
|
|
5247
5340
|
return props.data;
|
|
5248
5341
|
}
|
|
5249
5342
|
return [];
|
|
5250
5343
|
}, [props.data]);
|
|
5251
5344
|
if (loading) {
|
|
5252
|
-
return /* @__PURE__ */ (0,
|
|
5253
|
-
/* @__PURE__ */ (0,
|
|
5254
|
-
/* @__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" })
|
|
5255
5348
|
] }) });
|
|
5256
5349
|
}
|
|
5257
5350
|
if (data.length === 0) {
|
|
5258
|
-
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." }) });
|
|
5259
5352
|
}
|
|
5260
|
-
return /* @__PURE__ */ (0,
|
|
5261
|
-
/* @__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)(
|
|
5262
5355
|
AccordionTrigger,
|
|
5263
5356
|
{
|
|
5264
5357
|
className: cn(
|
|
5265
5358
|
"flex flex-1 items-center justify-between gap-2 p-0 text-left",
|
|
5266
5359
|
"hover:no-underline"
|
|
5267
5360
|
),
|
|
5268
|
-
children: /* @__PURE__ */ (0,
|
|
5361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CardTitle, { className: "text-base font-semibold", children: title })
|
|
5269
5362
|
}
|
|
5270
5363
|
) }),
|
|
5271
|
-
/* @__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) => {
|
|
5272
5365
|
const id = item.id ?? index;
|
|
5273
5366
|
const rawTitle = getValue(item, titleKey);
|
|
5274
5367
|
const rawDescription = getValue(item, descriptionKey);
|
|
@@ -5276,39 +5369,39 @@ var HistoryTimeline = ({
|
|
|
5276
5369
|
const titleText = String(rawTitle ?? "");
|
|
5277
5370
|
const descriptionText = rawDescription != null ? String(rawDescription) : "";
|
|
5278
5371
|
const createdAtDate = rawCreatedAt != null ? new Date(rawCreatedAt) : null;
|
|
5279
|
-
return /* @__PURE__ */ (0,
|
|
5280
|
-
/* @__PURE__ */ (0,
|
|
5281
|
-
|
|
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,
|
|
5282
5375
|
{
|
|
5283
5376
|
className: cn(
|
|
5284
5377
|
"h-5 w-5 text-white"
|
|
5285
5378
|
)
|
|
5286
5379
|
}
|
|
5287
5380
|
) }) }),
|
|
5288
|
-
/* @__PURE__ */ (0,
|
|
5381
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5289
5382
|
Accordion2,
|
|
5290
5383
|
{
|
|
5291
5384
|
type: "single",
|
|
5292
5385
|
collapsible: true,
|
|
5293
5386
|
className: "w-full",
|
|
5294
|
-
children: /* @__PURE__ */ (0,
|
|
5295
|
-
/* @__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)(
|
|
5296
5389
|
AccordionTrigger,
|
|
5297
5390
|
{
|
|
5298
5391
|
className: cn(
|
|
5299
5392
|
"flex items-center justify-between gap-2 rounded-md px-2 py-1 text-left",
|
|
5300
5393
|
"hover:bg-muted/60 hover:no-underline"
|
|
5301
5394
|
),
|
|
5302
|
-
children: /* @__PURE__ */ (0,
|
|
5303
|
-
/* @__PURE__ */ (0,
|
|
5304
|
-
/* @__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", {
|
|
5305
5398
|
dateStyle: "medium",
|
|
5306
5399
|
timeStyle: "short"
|
|
5307
5400
|
}).format(createdAtDate ?? /* @__PURE__ */ new Date()) })
|
|
5308
5401
|
] })
|
|
5309
5402
|
}
|
|
5310
5403
|
),
|
|
5311
|
-
/* @__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 }) })
|
|
5312
5405
|
] })
|
|
5313
5406
|
}
|
|
5314
5407
|
)
|
|
@@ -5319,30 +5412,30 @@ var HistoryTimeline = ({
|
|
|
5319
5412
|
var HistoryTimeline_default = HistoryTimeline;
|
|
5320
5413
|
|
|
5321
5414
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
5322
|
-
var
|
|
5323
|
-
var
|
|
5415
|
+
var import_react34 = require("react");
|
|
5416
|
+
var import_lucide_react18 = require("lucide-react");
|
|
5324
5417
|
var import_link3 = __toESM(require("next/link"));
|
|
5325
5418
|
var import_navigation2 = require("next/navigation");
|
|
5326
5419
|
|
|
5327
5420
|
// src/components/ui/dialog.tsx
|
|
5328
5421
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
|
|
5329
|
-
var
|
|
5330
|
-
var
|
|
5422
|
+
var import_lucide_react17 = require("lucide-react");
|
|
5423
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
5331
5424
|
function Dialog({
|
|
5332
5425
|
...props
|
|
5333
5426
|
}) {
|
|
5334
|
-
return /* @__PURE__ */ (0,
|
|
5427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
5335
5428
|
}
|
|
5336
5429
|
function DialogPortal({
|
|
5337
5430
|
...props
|
|
5338
5431
|
}) {
|
|
5339
|
-
return /* @__PURE__ */ (0,
|
|
5432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
5340
5433
|
}
|
|
5341
5434
|
function DialogOverlay({
|
|
5342
5435
|
className,
|
|
5343
5436
|
...props
|
|
5344
5437
|
}) {
|
|
5345
|
-
return /* @__PURE__ */ (0,
|
|
5438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5346
5439
|
DialogPrimitive.Overlay,
|
|
5347
5440
|
{
|
|
5348
5441
|
"data-slot": "dialog-overlay",
|
|
@@ -5360,9 +5453,9 @@ function DialogContent({
|
|
|
5360
5453
|
showCloseButton = true,
|
|
5361
5454
|
...props
|
|
5362
5455
|
}) {
|
|
5363
|
-
return /* @__PURE__ */ (0,
|
|
5364
|
-
/* @__PURE__ */ (0,
|
|
5365
|
-
/* @__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)(
|
|
5366
5459
|
DialogPrimitive.Content,
|
|
5367
5460
|
{
|
|
5368
5461
|
"data-slot": "dialog-content",
|
|
@@ -5373,14 +5466,14 @@ function DialogContent({
|
|
|
5373
5466
|
...props,
|
|
5374
5467
|
children: [
|
|
5375
5468
|
children,
|
|
5376
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
5469
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
5377
5470
|
DialogPrimitive.Close,
|
|
5378
5471
|
{
|
|
5379
5472
|
"data-slot": "dialog-close",
|
|
5380
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",
|
|
5381
5474
|
children: [
|
|
5382
|
-
/* @__PURE__ */ (0,
|
|
5383
|
-
/* @__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" })
|
|
5384
5477
|
]
|
|
5385
5478
|
}
|
|
5386
5479
|
)
|
|
@@ -5390,7 +5483,7 @@ function DialogContent({
|
|
|
5390
5483
|
] });
|
|
5391
5484
|
}
|
|
5392
5485
|
function DialogHeader({ className, ...props }) {
|
|
5393
|
-
return /* @__PURE__ */ (0,
|
|
5486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5394
5487
|
"div",
|
|
5395
5488
|
{
|
|
5396
5489
|
"data-slot": "dialog-header",
|
|
@@ -5400,7 +5493,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
5400
5493
|
);
|
|
5401
5494
|
}
|
|
5402
5495
|
function DialogFooter({ className, ...props }) {
|
|
5403
|
-
return /* @__PURE__ */ (0,
|
|
5496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5404
5497
|
"div",
|
|
5405
5498
|
{
|
|
5406
5499
|
"data-slot": "dialog-footer",
|
|
@@ -5416,7 +5509,7 @@ function DialogTitle({
|
|
|
5416
5509
|
className,
|
|
5417
5510
|
...props
|
|
5418
5511
|
}) {
|
|
5419
|
-
return /* @__PURE__ */ (0,
|
|
5512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5420
5513
|
DialogPrimitive.Title,
|
|
5421
5514
|
{
|
|
5422
5515
|
"data-slot": "dialog-title",
|
|
@@ -5429,7 +5522,7 @@ function DialogDescription({
|
|
|
5429
5522
|
className,
|
|
5430
5523
|
...props
|
|
5431
5524
|
}) {
|
|
5432
|
-
return /* @__PURE__ */ (0,
|
|
5525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5433
5526
|
DialogPrimitive.Description,
|
|
5434
5527
|
{
|
|
5435
5528
|
"data-slot": "dialog-description",
|
|
@@ -5506,9 +5599,9 @@ function showConfirmToast({
|
|
|
5506
5599
|
}
|
|
5507
5600
|
|
|
5508
5601
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
5509
|
-
var
|
|
5602
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
5510
5603
|
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
|
|
5511
|
-
const [openIndex, setOpenIndex] = (0,
|
|
5604
|
+
const [openIndex, setOpenIndex] = (0, import_react34.useState)(null);
|
|
5512
5605
|
const currentPathname = (0, import_navigation2.usePathname)();
|
|
5513
5606
|
function groupMenus(menus = []) {
|
|
5514
5607
|
const menuMap = /* @__PURE__ */ new Map();
|
|
@@ -5542,7 +5635,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5542
5635
|
});
|
|
5543
5636
|
return sortMenus(rootMenus);
|
|
5544
5637
|
}
|
|
5545
|
-
const rawTabs = (0,
|
|
5638
|
+
const rawTabs = (0, import_react34.useMemo)(() => {
|
|
5546
5639
|
if (!Array.isArray(tabs)) return [];
|
|
5547
5640
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
5548
5641
|
return groupMenus(tabs);
|
|
@@ -5572,9 +5665,9 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5572
5665
|
return tab.children.some((child) => isActive(child.url));
|
|
5573
5666
|
};
|
|
5574
5667
|
const router = (0, import_navigation2.useRouter)();
|
|
5575
|
-
const [showExitDialog, setShowExitDialog] = (0,
|
|
5576
|
-
const [pendingUrl, setPendingUrl] = (0,
|
|
5577
|
-
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)(
|
|
5578
5671
|
(e, url) => {
|
|
5579
5672
|
if (isBuilder) {
|
|
5580
5673
|
e.preventDefault();
|
|
@@ -5605,13 +5698,13 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5605
5698
|
border: active && textActiveColor ? `1px solid ${textActiveColor}` : void 0
|
|
5606
5699
|
};
|
|
5607
5700
|
if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
|
|
5608
|
-
return /* @__PURE__ */ (0,
|
|
5701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5609
5702
|
DropdownMenu,
|
|
5610
5703
|
{
|
|
5611
5704
|
open: openIndex === index,
|
|
5612
5705
|
onOpenChange: (open) => setOpenIndex(open ? index : null),
|
|
5613
5706
|
children: [
|
|
5614
|
-
/* @__PURE__ */ (0,
|
|
5707
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5615
5708
|
DropdownMenuTrigger,
|
|
5616
5709
|
{
|
|
5617
5710
|
className: `${finalClasses} inline-flex items-center gap-1`,
|
|
@@ -5625,11 +5718,11 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5625
5718
|
style: finalStyle,
|
|
5626
5719
|
children: [
|
|
5627
5720
|
tab.header,
|
|
5628
|
-
/* @__PURE__ */ (0,
|
|
5721
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_lucide_react18.ChevronDown, { className: "h-4 w-4 opacity-80" })
|
|
5629
5722
|
]
|
|
5630
5723
|
}
|
|
5631
5724
|
),
|
|
5632
|
-
/* @__PURE__ */ (0,
|
|
5725
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5633
5726
|
DropdownMenuContent,
|
|
5634
5727
|
{
|
|
5635
5728
|
align: "start",
|
|
@@ -5642,12 +5735,12 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5642
5735
|
onMouseLeave: () => {
|
|
5643
5736
|
timeout = setTimeout(() => setOpenIndex(null), 150);
|
|
5644
5737
|
},
|
|
5645
|
-
children: tab.children.map((item, index2) => /* @__PURE__ */ (0,
|
|
5738
|
+
children: tab.children.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5646
5739
|
DropdownMenuItem,
|
|
5647
5740
|
{
|
|
5648
5741
|
asChild: true,
|
|
5649
5742
|
className: "cursor-pointer rounded-sm px-3 py-2 text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
|
|
5650
|
-
children: /* @__PURE__ */ (0,
|
|
5743
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5651
5744
|
import_link3.default,
|
|
5652
5745
|
{
|
|
5653
5746
|
href: item.url || "#",
|
|
@@ -5666,7 +5759,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5666
5759
|
index
|
|
5667
5760
|
);
|
|
5668
5761
|
}
|
|
5669
|
-
return tab.url ? /* @__PURE__ */ (0,
|
|
5762
|
+
return tab.url ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5670
5763
|
import_link3.default,
|
|
5671
5764
|
{
|
|
5672
5765
|
href: tab.url,
|
|
@@ -5677,14 +5770,14 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5677
5770
|
children: tab.header
|
|
5678
5771
|
},
|
|
5679
5772
|
index
|
|
5680
|
-
) : /* @__PURE__ */ (0,
|
|
5773
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: finalClasses, style: finalStyle, role: "button", tabIndex: 0, children: tab.header }, index);
|
|
5681
5774
|
};
|
|
5682
|
-
const renderMobileMenu = () => /* @__PURE__ */ (0,
|
|
5683
|
-
/* @__PURE__ */ (0,
|
|
5684
|
-
/* @__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" }),
|
|
5685
5778
|
"Menu"
|
|
5686
5779
|
] }),
|
|
5687
|
-
/* @__PURE__ */ (0,
|
|
5780
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5688
5781
|
DropdownMenuContent,
|
|
5689
5782
|
{
|
|
5690
5783
|
align: "start",
|
|
@@ -5693,25 +5786,25 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5693
5786
|
children: rawTabs.map((tab, i) => {
|
|
5694
5787
|
const hasChildren = Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown;
|
|
5695
5788
|
if (hasChildren) {
|
|
5696
|
-
return /* @__PURE__ */ (0,
|
|
5697
|
-
/* @__PURE__ */ (0,
|
|
5698
|
-
/* @__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)(
|
|
5699
5792
|
DropdownMenuItem,
|
|
5700
5793
|
{
|
|
5701
5794
|
asChild: true,
|
|
5702
5795
|
className: "cursor-pointer rounded-sm px-3 py-2 text-gray-800 hover:bg-gray-100",
|
|
5703
|
-
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 })
|
|
5704
5797
|
},
|
|
5705
5798
|
item.id || index
|
|
5706
5799
|
)) })
|
|
5707
5800
|
] }, i);
|
|
5708
5801
|
}
|
|
5709
|
-
return /* @__PURE__ */ (0,
|
|
5802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5710
5803
|
DropdownMenuItem,
|
|
5711
5804
|
{
|
|
5712
5805
|
asChild: true,
|
|
5713
5806
|
className: "cursor-pointer rounded-sm px-3 py-2 text-[13px] text-gray-800 hover:bg-gray-100",
|
|
5714
|
-
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 })
|
|
5715
5808
|
},
|
|
5716
5809
|
i
|
|
5717
5810
|
);
|
|
@@ -5721,19 +5814,19 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5721
5814
|
] });
|
|
5722
5815
|
const forceMobile = canvasMode ? canvasMode === "mobile" || canvasMode === "tablet" : void 0;
|
|
5723
5816
|
const forceDesktop = canvasMode ? canvasMode === "desktop" : void 0;
|
|
5724
|
-
return /* @__PURE__ */ (0,
|
|
5725
|
-
/* @__PURE__ */ (0,
|
|
5726
|
-
forceDesktop !== void 0 ? forceDesktop && /* @__PURE__ */ (0,
|
|
5727
|
-
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() })
|
|
5728
5821
|
] }),
|
|
5729
|
-
/* @__PURE__ */ (0,
|
|
5730
|
-
/* @__PURE__ */ (0,
|
|
5731
|
-
/* @__PURE__ */ (0,
|
|
5732
|
-
/* @__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." })
|
|
5733
5826
|
] }),
|
|
5734
|
-
/* @__PURE__ */ (0,
|
|
5735
|
-
/* @__PURE__ */ (0,
|
|
5736
|
-
/* @__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" })
|
|
5737
5830
|
] })
|
|
5738
5831
|
] }) })
|
|
5739
5832
|
] });
|
|
@@ -5741,16 +5834,16 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5741
5834
|
var Tabs_default = Tabs;
|
|
5742
5835
|
|
|
5743
5836
|
// src/components/Navigation/Stages/Stages.tsx
|
|
5744
|
-
var
|
|
5837
|
+
var import_react35 = __toESM(require("react"));
|
|
5745
5838
|
|
|
5746
5839
|
// src/components/ui/tooltip.tsx
|
|
5747
5840
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
|
|
5748
|
-
var
|
|
5841
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
5749
5842
|
function TooltipProvider({
|
|
5750
5843
|
delayDuration = 0,
|
|
5751
5844
|
...props
|
|
5752
5845
|
}) {
|
|
5753
|
-
return /* @__PURE__ */ (0,
|
|
5846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5754
5847
|
TooltipPrimitive.Provider,
|
|
5755
5848
|
{
|
|
5756
5849
|
"data-slot": "tooltip-provider",
|
|
@@ -5762,12 +5855,12 @@ function TooltipProvider({
|
|
|
5762
5855
|
function Tooltip({
|
|
5763
5856
|
...props
|
|
5764
5857
|
}) {
|
|
5765
|
-
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 }) });
|
|
5766
5859
|
}
|
|
5767
5860
|
function TooltipTrigger({
|
|
5768
5861
|
...props
|
|
5769
5862
|
}) {
|
|
5770
|
-
return /* @__PURE__ */ (0,
|
|
5863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
5771
5864
|
}
|
|
5772
5865
|
function TooltipContent({
|
|
5773
5866
|
className,
|
|
@@ -5776,7 +5869,7 @@ function TooltipContent({
|
|
|
5776
5869
|
hideArrow,
|
|
5777
5870
|
...props
|
|
5778
5871
|
}) {
|
|
5779
|
-
return /* @__PURE__ */ (0,
|
|
5872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
5780
5873
|
TooltipPrimitive.Content,
|
|
5781
5874
|
{
|
|
5782
5875
|
"data-slot": "tooltip-content",
|
|
@@ -5788,14 +5881,14 @@ function TooltipContent({
|
|
|
5788
5881
|
...props,
|
|
5789
5882
|
children: [
|
|
5790
5883
|
children,
|
|
5791
|
-
!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]" })
|
|
5792
5885
|
]
|
|
5793
5886
|
}
|
|
5794
5887
|
) });
|
|
5795
5888
|
}
|
|
5796
5889
|
|
|
5797
5890
|
// src/components/Navigation/Stages/Stages.tsx
|
|
5798
|
-
var
|
|
5891
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
5799
5892
|
var StagesComponent = ({
|
|
5800
5893
|
stages,
|
|
5801
5894
|
isShowBtn,
|
|
@@ -5812,11 +5905,11 @@ var StagesComponent = ({
|
|
|
5812
5905
|
canvasMode = "desktop",
|
|
5813
5906
|
...props
|
|
5814
5907
|
}) => {
|
|
5815
|
-
const [activeStage, setActiveStage] = (0,
|
|
5816
|
-
const [isCompleted, setIsCompleted] = (0,
|
|
5817
|
-
const [activeChildStage, setActiveChildStage] = (0,
|
|
5818
|
-
const [activeRootStage, setActiveRootStage] = (0,
|
|
5819
|
-
(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)(() => {
|
|
5820
5913
|
if (currentStage) {
|
|
5821
5914
|
setActiveStage(currentStage);
|
|
5822
5915
|
} else {
|
|
@@ -5878,7 +5971,7 @@ var StagesComponent = ({
|
|
|
5878
5971
|
}
|
|
5879
5972
|
return { activeRoot: null, activeChild: null };
|
|
5880
5973
|
};
|
|
5881
|
-
(0,
|
|
5974
|
+
(0, import_react35.useEffect)(() => {
|
|
5882
5975
|
if (!currentStage || !Array.isArray(stages)) {
|
|
5883
5976
|
setActiveRootStage(null);
|
|
5884
5977
|
setActiveChildStage(null);
|
|
@@ -5891,7 +5984,7 @@ var StagesComponent = ({
|
|
|
5891
5984
|
const isAllStagesCompleted = isCompleted;
|
|
5892
5985
|
const disabled = isAllStagesCompleted || loading || saving;
|
|
5893
5986
|
const primaryColor = props.primaryColor || "#12715b";
|
|
5894
|
-
return /* @__PURE__ */ (0,
|
|
5987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
5895
5988
|
"div",
|
|
5896
5989
|
{
|
|
5897
5990
|
className: `
|
|
@@ -5901,8 +5994,8 @@ var StagesComponent = ({
|
|
|
5901
5994
|
${isMobile ? "p-3 sm:p-4" : "p-2"}
|
|
5902
5995
|
`,
|
|
5903
5996
|
children: [
|
|
5904
|
-
/* @__PURE__ */ (0,
|
|
5905
|
-
/* @__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)(
|
|
5906
5999
|
"div",
|
|
5907
6000
|
{
|
|
5908
6001
|
className: `
|
|
@@ -5910,7 +6003,7 @@ var StagesComponent = ({
|
|
|
5910
6003
|
flex-wrap gap-2 sm:gap-2 lg:gap-3 w-full lg:w-auto
|
|
5911
6004
|
${isMobile ? "order-2 mt-2 lg:mt-0" : "order-2"}
|
|
5912
6005
|
`,
|
|
5913
|
-
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)(
|
|
5914
6007
|
"button",
|
|
5915
6008
|
{
|
|
5916
6009
|
className: `
|
|
@@ -5940,7 +6033,8 @@ var StagesComponent = ({
|
|
|
5940
6033
|
const isCurrentRootStage = activeRootStage?.[dataKey] === stage[dataKey];
|
|
5941
6034
|
const stageHasChildren = Array.isArray(stage?.children) && stage.children.length > 0;
|
|
5942
6035
|
const isCurrentChildStage = activeChildStage?.[dataKey] === activeStage;
|
|
5943
|
-
const
|
|
6036
|
+
const isNotParentSelected = activeChildStage?.[dataKey] !== activeRootStage?.[dataKey];
|
|
6037
|
+
const showOutcomeForCurrentStage = showAsActive && hasOutcome && stageHasChildren && isCurrentRootStage && isCurrentChildStage && isNotParentSelected;
|
|
5944
6038
|
let stageColor = `text-[${primaryColor}] border-2 border-[${primaryColor}]`;
|
|
5945
6039
|
let stageStyle = {
|
|
5946
6040
|
borderColor: primaryColor,
|
|
@@ -5965,8 +6059,8 @@ var StagesComponent = ({
|
|
|
5965
6059
|
}
|
|
5966
6060
|
}
|
|
5967
6061
|
const stageKey = typeof stage[dataKey] === "string" ? stage[dataKey] : JSON.stringify(stage[dataKey]);
|
|
5968
|
-
return /* @__PURE__ */ (0,
|
|
5969
|
-
/* @__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)(
|
|
5970
6064
|
"button",
|
|
5971
6065
|
{
|
|
5972
6066
|
className: `
|
|
@@ -5984,21 +6078,21 @@ var StagesComponent = ({
|
|
|
5984
6078
|
children: stageLabel
|
|
5985
6079
|
}
|
|
5986
6080
|
) }),
|
|
5987
|
-
/* @__PURE__ */ (0,
|
|
5988
|
-
!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" })
|
|
5989
6083
|
] }, stageKey) }, stageKey);
|
|
5990
6084
|
});
|
|
5991
6085
|
})()
|
|
5992
6086
|
}
|
|
5993
6087
|
),
|
|
5994
|
-
isShowBtn && /* @__PURE__ */ (0,
|
|
6088
|
+
isShowBtn && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
5995
6089
|
"div",
|
|
5996
6090
|
{
|
|
5997
6091
|
className: `
|
|
5998
6092
|
flex items-center flex-shrink-0 w-full lg:w-auto
|
|
5999
6093
|
${isMobile ? "order-3 mt-3 lg:mt-0" : "order-3"}
|
|
6000
6094
|
`,
|
|
6001
|
-
children: /* @__PURE__ */ (0,
|
|
6095
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6002
6096
|
"button",
|
|
6003
6097
|
{
|
|
6004
6098
|
className: `
|
|
@@ -6021,33 +6115,33 @@ var StagesComponent = ({
|
|
|
6021
6115
|
var Stages_default = StagesComponent;
|
|
6022
6116
|
|
|
6023
6117
|
// src/components/Navigation/Spacer/Spacer.tsx
|
|
6024
|
-
var
|
|
6118
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6025
6119
|
var Spacer = ({ className, style }) => {
|
|
6026
|
-
return /* @__PURE__ */ (0,
|
|
6120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: `${className}`, style });
|
|
6027
6121
|
};
|
|
6028
6122
|
var Spacer_default = Spacer;
|
|
6029
6123
|
|
|
6030
6124
|
// src/components/Navigation/Profile/Profile.tsx
|
|
6031
|
-
var
|
|
6125
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6032
6126
|
|
|
6033
6127
|
// src/components/Navigation/Notification/Notification.tsx
|
|
6034
|
-
var
|
|
6128
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6035
6129
|
|
|
6036
6130
|
// src/components/Navigation/Logo/Logo.tsx
|
|
6037
|
-
var
|
|
6131
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6038
6132
|
|
|
6039
6133
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
6040
|
-
var
|
|
6041
|
-
var
|
|
6134
|
+
var import_react36 = require("react");
|
|
6135
|
+
var import_lucide_react19 = require("lucide-react");
|
|
6042
6136
|
var import_image2 = __toESM(require("next/image"));
|
|
6043
6137
|
var import_link4 = __toESM(require("next/link"));
|
|
6044
6138
|
var import_navigation3 = require("next/navigation");
|
|
6045
6139
|
|
|
6046
6140
|
// src/components/ui/avatar.tsx
|
|
6047
|
-
var
|
|
6141
|
+
var React14 = __toESM(require("react"));
|
|
6048
6142
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
6049
|
-
var
|
|
6050
|
-
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)(
|
|
6051
6145
|
AvatarPrimitive.Root,
|
|
6052
6146
|
{
|
|
6053
6147
|
ref,
|
|
@@ -6059,7 +6153,7 @@ var Avatar = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
6059
6153
|
}
|
|
6060
6154
|
));
|
|
6061
6155
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
6062
|
-
var AvatarImage =
|
|
6156
|
+
var AvatarImage = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
6063
6157
|
AvatarPrimitive.Image,
|
|
6064
6158
|
{
|
|
6065
6159
|
ref,
|
|
@@ -6068,7 +6162,7 @@ var AvatarImage = React13.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
6068
6162
|
}
|
|
6069
6163
|
));
|
|
6070
6164
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
6071
|
-
var AvatarFallback =
|
|
6165
|
+
var AvatarFallback = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
6072
6166
|
AvatarPrimitive.Fallback,
|
|
6073
6167
|
{
|
|
6074
6168
|
ref,
|
|
@@ -6082,7 +6176,7 @@ var AvatarFallback = React13.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
6082
6176
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
6083
6177
|
|
|
6084
6178
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
6085
|
-
var
|
|
6179
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
6086
6180
|
function Navbar({
|
|
6087
6181
|
style,
|
|
6088
6182
|
badgeType,
|
|
@@ -6104,10 +6198,10 @@ function Navbar({
|
|
|
6104
6198
|
primaryColor = "#2a55a3"
|
|
6105
6199
|
}) {
|
|
6106
6200
|
const router = (0, import_navigation3.useRouter)();
|
|
6107
|
-
const [screenMode, setScreenMode] = (0,
|
|
6201
|
+
const [screenMode, setScreenMode] = (0, import_react36.useState)(
|
|
6108
6202
|
canvasMode
|
|
6109
6203
|
);
|
|
6110
|
-
(0,
|
|
6204
|
+
(0, import_react36.useEffect)(() => {
|
|
6111
6205
|
const detectMode = () => {
|
|
6112
6206
|
if (window.innerWidth < 640) setScreenMode("mobile");
|
|
6113
6207
|
else if (window.innerWidth < 1024) setScreenMode("tablet");
|
|
@@ -6121,7 +6215,7 @@ function Navbar({
|
|
|
6121
6215
|
const isMobile = mode === "mobile";
|
|
6122
6216
|
const isTablet = mode === "tablet";
|
|
6123
6217
|
const isDesktop = mode === "desktop";
|
|
6124
|
-
const handleBuilderExit = (0,
|
|
6218
|
+
const handleBuilderExit = (0, import_react36.useCallback)(
|
|
6125
6219
|
(e, url) => {
|
|
6126
6220
|
if (isBuilder) {
|
|
6127
6221
|
e.preventDefault();
|
|
@@ -6132,7 +6226,7 @@ function Navbar({
|
|
|
6132
6226
|
},
|
|
6133
6227
|
[isBuilder]
|
|
6134
6228
|
);
|
|
6135
|
-
const formattedMenu = (0,
|
|
6229
|
+
const formattedMenu = (0, import_react36.useMemo)(() => {
|
|
6136
6230
|
if (source === "state" && navList?.length) {
|
|
6137
6231
|
return navList.map((i) => ({
|
|
6138
6232
|
...i,
|
|
@@ -6141,9 +6235,9 @@ function Navbar({
|
|
|
6141
6235
|
}
|
|
6142
6236
|
return list;
|
|
6143
6237
|
}, [source, navList, list]);
|
|
6144
|
-
const RenderSearchInput = () => /* @__PURE__ */ (0,
|
|
6145
|
-
/* @__PURE__ */ (0,
|
|
6146
|
-
/* @__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)(
|
|
6147
6241
|
Input,
|
|
6148
6242
|
{
|
|
6149
6243
|
placeholder: "Search",
|
|
@@ -6159,23 +6253,23 @@ function Navbar({
|
|
|
6159
6253
|
}
|
|
6160
6254
|
)
|
|
6161
6255
|
] }) });
|
|
6162
|
-
return /* @__PURE__ */ (0,
|
|
6163
|
-
/* @__PURE__ */ (0,
|
|
6256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
6257
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
6164
6258
|
"nav",
|
|
6165
6259
|
{
|
|
6166
6260
|
className: "w-full min-h-[75px] border-b border-gray-200 dark:border-gray-800 dark:bg-gray-800 bg-white shadow-sm",
|
|
6167
6261
|
style,
|
|
6168
|
-
children: /* @__PURE__ */ (0,
|
|
6169
|
-
/* @__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)(
|
|
6170
6264
|
import_link4.default,
|
|
6171
6265
|
{
|
|
6172
6266
|
href: "/",
|
|
6173
6267
|
onClick: (e) => handleBuilderExit(e, "/"),
|
|
6174
6268
|
className: "flex items-center space-x-2",
|
|
6175
|
-
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" })
|
|
6176
6270
|
}
|
|
6177
6271
|
),
|
|
6178
|
-
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)(
|
|
6179
6273
|
import_link4.default,
|
|
6180
6274
|
{
|
|
6181
6275
|
href: item.url,
|
|
@@ -6185,23 +6279,23 @@ function Navbar({
|
|
|
6185
6279
|
},
|
|
6186
6280
|
item.id
|
|
6187
6281
|
)) }),
|
|
6188
|
-
/* @__PURE__ */ (0,
|
|
6189
|
-
(isDesktop || isTablet) && /* @__PURE__ */ (0,
|
|
6190
|
-
/* @__PURE__ */ (0,
|
|
6191
|
-
/* @__PURE__ */ (0,
|
|
6192
|
-
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" })
|
|
6193
6287
|
] }),
|
|
6194
|
-
/* @__PURE__ */ (0,
|
|
6195
|
-
/* @__PURE__ */ (0,
|
|
6196
|
-
!isMobile && showName && /* @__PURE__ */ (0,
|
|
6197
|
-
/* @__PURE__ */ (0,
|
|
6198
|
-
(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" }) })
|
|
6199
6293
|
] }) }),
|
|
6200
|
-
/* @__PURE__ */ (0,
|
|
6201
|
-
profileMenu.map((item) => /* @__PURE__ */ (0,
|
|
6202
|
-
(isMobile || isTablet) && /* @__PURE__ */ (0,
|
|
6203
|
-
/* @__PURE__ */ (0,
|
|
6204
|
-
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))
|
|
6205
6299
|
] })
|
|
6206
6300
|
] })
|
|
6207
6301
|
] })
|
|
@@ -6209,15 +6303,15 @@ function Navbar({
|
|
|
6209
6303
|
] })
|
|
6210
6304
|
}
|
|
6211
6305
|
),
|
|
6212
|
-
isMobile && /* @__PURE__ */ (0,
|
|
6306
|
+
isMobile && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(RenderSearchInput, {}) })
|
|
6213
6307
|
] });
|
|
6214
6308
|
}
|
|
6215
6309
|
|
|
6216
6310
|
// src/components/Chart/BarChart.tsx
|
|
6217
|
-
var
|
|
6311
|
+
var import_react37 = __toESM(require("react"));
|
|
6218
6312
|
var import_axios4 = __toESM(require("axios"));
|
|
6219
6313
|
var import_recharts = require("recharts");
|
|
6220
|
-
var
|
|
6314
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
6221
6315
|
var palette = [
|
|
6222
6316
|
"#2563eb",
|
|
6223
6317
|
"#1d4ed8",
|
|
@@ -6277,18 +6371,18 @@ var ChartComponent = ({
|
|
|
6277
6371
|
...props
|
|
6278
6372
|
}) => {
|
|
6279
6373
|
const useApi = source === "api" && !!apiUrl;
|
|
6280
|
-
const [rawData, setRawData] = (0,
|
|
6281
|
-
const [rawMeta, setRawMeta] = (0,
|
|
6282
|
-
const [localLoading, setLocalLoading] = (0,
|
|
6283
|
-
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);
|
|
6284
6378
|
const effectiveData = useApi ? rawData : props.data || [];
|
|
6285
6379
|
const effectiveLoading = useApi ? localLoading : externalLoading;
|
|
6286
|
-
(0,
|
|
6380
|
+
(0, import_react37.useEffect)(() => {
|
|
6287
6381
|
if (useApi) {
|
|
6288
6382
|
setCurrentPage(1);
|
|
6289
6383
|
}
|
|
6290
6384
|
}, [useApi]);
|
|
6291
|
-
const fetchData = (0,
|
|
6385
|
+
const fetchData = (0, import_react37.useCallback)(async (page) => {
|
|
6292
6386
|
if (!apiUrl) return;
|
|
6293
6387
|
const cancelled = false;
|
|
6294
6388
|
try {
|
|
@@ -6325,7 +6419,7 @@ var ChartComponent = ({
|
|
|
6325
6419
|
if (!cancelled) setLocalLoading(false);
|
|
6326
6420
|
}
|
|
6327
6421
|
}, [apiUrl, limit]);
|
|
6328
|
-
(0,
|
|
6422
|
+
(0, import_react37.useEffect)(() => {
|
|
6329
6423
|
if (!useApi) return;
|
|
6330
6424
|
fetchData(currentPage);
|
|
6331
6425
|
}, [useApi, currentPage, fetchData]);
|
|
@@ -6333,7 +6427,7 @@ var ChartComponent = ({
|
|
|
6333
6427
|
if (rawMeta && (newPage < 1 || newPage > rawMeta.pages)) return;
|
|
6334
6428
|
setCurrentPage(newPage);
|
|
6335
6429
|
};
|
|
6336
|
-
const data = (0,
|
|
6430
|
+
const data = (0, import_react37.useMemo)(() => {
|
|
6337
6431
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0 || !dataKey || !dataLabel) {
|
|
6338
6432
|
return [];
|
|
6339
6433
|
}
|
|
@@ -6345,10 +6439,10 @@ var ChartComponent = ({
|
|
|
6345
6439
|
}, [effectiveData, dataKey, dataLabel]);
|
|
6346
6440
|
const chartType = props.chartType || "bar";
|
|
6347
6441
|
const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
|
|
6348
|
-
const renderLegends = (0,
|
|
6442
|
+
const renderLegends = (0, import_react37.useMemo)(() => {
|
|
6349
6443
|
if (!showLegends || !dataKey || !dataLabel) return null;
|
|
6350
6444
|
const isLegendRight2 = !forceMobile && legendPosition === "right";
|
|
6351
|
-
return /* @__PURE__ */ (0,
|
|
6445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6352
6446
|
"div",
|
|
6353
6447
|
{
|
|
6354
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",
|
|
@@ -6361,7 +6455,7 @@ var ChartComponent = ({
|
|
|
6361
6455
|
[dataLabel]: d[dataLabel],
|
|
6362
6456
|
[dataKey]: value
|
|
6363
6457
|
};
|
|
6364
|
-
return /* @__PURE__ */ (0,
|
|
6458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
6365
6459
|
"div",
|
|
6366
6460
|
{
|
|
6367
6461
|
role: onLegendClick ? "button" : void 0,
|
|
@@ -6370,16 +6464,16 @@ var ChartComponent = ({
|
|
|
6370
6464
|
onKeyDown: onLegendClick ? (e) => e.key === "Enter" && onLegendClick(payload) : void 0,
|
|
6371
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" : ""}`,
|
|
6372
6466
|
children: [
|
|
6373
|
-
/* @__PURE__ */ (0,
|
|
6467
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6374
6468
|
"span",
|
|
6375
6469
|
{
|
|
6376
6470
|
className: "inline-block w-[12px] h-[12px] rounded-full shrink-0 border-2 border-white/50",
|
|
6377
6471
|
style: { backgroundColor: d.fill }
|
|
6378
6472
|
}
|
|
6379
6473
|
),
|
|
6380
|
-
/* @__PURE__ */ (0,
|
|
6381
|
-
/* @__PURE__ */ (0,
|
|
6382
|
-
/* @__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 })
|
|
6383
6477
|
] })
|
|
6384
6478
|
]
|
|
6385
6479
|
},
|
|
@@ -6390,27 +6484,27 @@ var ChartComponent = ({
|
|
|
6390
6484
|
);
|
|
6391
6485
|
}, [data, dataLabel, dataKey, showLegends, onLegendClick, legendPosition, forceMobile]);
|
|
6392
6486
|
if (effectiveLoading) {
|
|
6393
|
-
return /* @__PURE__ */ (0,
|
|
6487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
6394
6488
|
"div",
|
|
6395
6489
|
{
|
|
6396
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}`,
|
|
6397
6491
|
style,
|
|
6398
6492
|
children: [
|
|
6399
|
-
/* @__PURE__ */ (0,
|
|
6400
|
-
/* @__PURE__ */ (0,
|
|
6401
|
-
/* @__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..." })
|
|
6402
6496
|
] }) }),
|
|
6403
|
-
/* @__PURE__ */ (0,
|
|
6404
|
-
/* @__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) => {
|
|
6405
6499
|
const randomHeight = `${Math.floor(Math.random() * 76) + 20}%`;
|
|
6406
|
-
return /* @__PURE__ */ (0,
|
|
6500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
6407
6501
|
"div",
|
|
6408
6502
|
{
|
|
6409
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`,
|
|
6410
6504
|
style: { height: randomHeight, animationDelay: `${idx * 0.08}s` },
|
|
6411
6505
|
children: [
|
|
6412
|
-
/* @__PURE__ */ (0,
|
|
6413
|
-
/* @__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" })
|
|
6414
6508
|
]
|
|
6415
6509
|
},
|
|
6416
6510
|
`bar-${idx}`
|
|
@@ -6421,74 +6515,74 @@ var ChartComponent = ({
|
|
|
6421
6515
|
);
|
|
6422
6516
|
}
|
|
6423
6517
|
if (data.length === 0) {
|
|
6424
|
-
return /* @__PURE__ */ (0,
|
|
6518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6425
6519
|
"div",
|
|
6426
6520
|
{
|
|
6427
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}`,
|
|
6428
6522
|
style,
|
|
6429
|
-
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" }) }) })
|
|
6430
6524
|
}
|
|
6431
6525
|
);
|
|
6432
6526
|
}
|
|
6433
6527
|
const isLegendRight = !forceMobile && legendPosition === "right";
|
|
6434
|
-
return /* @__PURE__ */ (0,
|
|
6528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
6435
6529
|
"div",
|
|
6436
6530
|
{
|
|
6437
6531
|
className: `relative flex ${isLegendRight ? "flex-row items-stretch gap-4" : "flex-col items-center"} ${className}`,
|
|
6438
6532
|
style,
|
|
6439
6533
|
children: [
|
|
6440
|
-
/* @__PURE__ */ (0,
|
|
6534
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
6441
6535
|
"div",
|
|
6442
6536
|
{
|
|
6443
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"}`,
|
|
6444
6538
|
children: [
|
|
6445
|
-
isPaginationEnabled && rawMeta && /* @__PURE__ */ (0,
|
|
6446
|
-
/* @__PURE__ */ (0,
|
|
6447
|
-
/* @__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)(
|
|
6448
6542
|
"button",
|
|
6449
6543
|
{
|
|
6450
6544
|
onClick: () => handlePageChange(currentPage - 1),
|
|
6451
6545
|
disabled: currentPage === 1 || localLoading,
|
|
6452
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",
|
|
6453
|
-
children: /* @__PURE__ */ (0,
|
|
6547
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: "\u2190 Prev" })
|
|
6454
6548
|
}
|
|
6455
6549
|
),
|
|
6456
|
-
/* @__PURE__ */ (0,
|
|
6457
|
-
/* @__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)(
|
|
6458
6552
|
"button",
|
|
6459
6553
|
{
|
|
6460
6554
|
onClick: () => handlePageChange(currentPage + 1),
|
|
6461
6555
|
disabled: currentPage >= rawMeta.pages || localLoading,
|
|
6462
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",
|
|
6463
|
-
children: /* @__PURE__ */ (0,
|
|
6557
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: "Next \u2192" })
|
|
6464
6558
|
}
|
|
6465
6559
|
)
|
|
6466
6560
|
] }),
|
|
6467
|
-
/* @__PURE__ */ (0,
|
|
6468
|
-
/* @__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)(
|
|
6469
6563
|
"button",
|
|
6470
6564
|
{
|
|
6471
6565
|
onClick: () => handlePageChange(currentPage - 1),
|
|
6472
6566
|
disabled: currentPage === 1 || localLoading,
|
|
6473
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",
|
|
6474
|
-
children: /* @__PURE__ */ (0,
|
|
6568
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: "\u2190 Prev" })
|
|
6475
6569
|
}
|
|
6476
6570
|
),
|
|
6477
|
-
/* @__PURE__ */ (0,
|
|
6478
|
-
/* @__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)(
|
|
6479
6573
|
"button",
|
|
6480
6574
|
{
|
|
6481
6575
|
onClick: () => handlePageChange(currentPage + 1),
|
|
6482
6576
|
disabled: currentPage >= rawMeta.pages || localLoading,
|
|
6483
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",
|
|
6484
|
-
children: /* @__PURE__ */ (0,
|
|
6578
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: "Next \u2192" })
|
|
6485
6579
|
}
|
|
6486
6580
|
)
|
|
6487
6581
|
] })
|
|
6488
6582
|
] }),
|
|
6489
|
-
/* @__PURE__ */ (0,
|
|
6490
|
-
/* @__PURE__ */ (0,
|
|
6491
|
-
/* @__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)(
|
|
6492
6586
|
import_recharts.XAxis,
|
|
6493
6587
|
{
|
|
6494
6588
|
dataKey: dataLabel,
|
|
@@ -6506,7 +6600,7 @@ var ChartComponent = ({
|
|
|
6506
6600
|
className: "hidden sm:block"
|
|
6507
6601
|
}
|
|
6508
6602
|
),
|
|
6509
|
-
/* @__PURE__ */ (0,
|
|
6603
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6510
6604
|
import_recharts.YAxis,
|
|
6511
6605
|
{
|
|
6512
6606
|
tickFormatter: (value) => `${(value / 1e3).toFixed(0)}k`,
|
|
@@ -6519,8 +6613,8 @@ var ChartComponent = ({
|
|
|
6519
6613
|
width: 60
|
|
6520
6614
|
}
|
|
6521
6615
|
),
|
|
6522
|
-
/* @__PURE__ */ (0,
|
|
6523
|
-
/* @__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)(
|
|
6524
6618
|
import_recharts.Bar,
|
|
6525
6619
|
{
|
|
6526
6620
|
dataKey,
|
|
@@ -6528,13 +6622,13 @@ var ChartComponent = ({
|
|
|
6528
6622
|
isAnimationActive: false
|
|
6529
6623
|
}
|
|
6530
6624
|
)
|
|
6531
|
-
] }) : /* @__PURE__ */ (0,
|
|
6532
|
-
/* @__PURE__ */ (0,
|
|
6533
|
-
/* @__PURE__ */ (0,
|
|
6534
|
-
/* @__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 })
|
|
6535
6629
|
] }) }),
|
|
6536
|
-
/* @__PURE__ */ (0,
|
|
6537
|
-
/* @__PURE__ */ (0,
|
|
6630
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_recharts.CartesianGrid, { strokeDasharray: "3 3" }),
|
|
6631
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6538
6632
|
import_recharts.XAxis,
|
|
6539
6633
|
{
|
|
6540
6634
|
dataKey: dataLabel,
|
|
@@ -6548,7 +6642,7 @@ var ChartComponent = ({
|
|
|
6548
6642
|
}
|
|
6549
6643
|
}
|
|
6550
6644
|
),
|
|
6551
|
-
/* @__PURE__ */ (0,
|
|
6645
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6552
6646
|
import_recharts.YAxis,
|
|
6553
6647
|
{
|
|
6554
6648
|
tickFormatter: (value) => `${(value / 1e3).toFixed(0)}k`,
|
|
@@ -6561,8 +6655,8 @@ var ChartComponent = ({
|
|
|
6561
6655
|
width: 60
|
|
6562
6656
|
}
|
|
6563
6657
|
),
|
|
6564
|
-
/* @__PURE__ */ (0,
|
|
6565
|
-
/* @__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)(
|
|
6566
6660
|
import_recharts.Area,
|
|
6567
6661
|
{
|
|
6568
6662
|
type: "monotone",
|
|
@@ -6577,18 +6671,18 @@ var ChartComponent = ({
|
|
|
6577
6671
|
]
|
|
6578
6672
|
}
|
|
6579
6673
|
),
|
|
6580
|
-
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 })
|
|
6581
6675
|
]
|
|
6582
6676
|
}
|
|
6583
6677
|
);
|
|
6584
6678
|
};
|
|
6585
|
-
var BarChart_default =
|
|
6679
|
+
var BarChart_default = import_react37.default.memo(ChartComponent);
|
|
6586
6680
|
|
|
6587
6681
|
// src/components/Chart/PieChart.tsx
|
|
6588
|
-
var
|
|
6682
|
+
var import_react38 = __toESM(require("react"));
|
|
6589
6683
|
var import_axios5 = __toESM(require("axios"));
|
|
6590
6684
|
var import_recharts2 = require("recharts");
|
|
6591
|
-
var
|
|
6685
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
6592
6686
|
var getRandomColor = () => {
|
|
6593
6687
|
const palette2 = [
|
|
6594
6688
|
"#2563eb",
|
|
@@ -6669,11 +6763,11 @@ var DonutChart = ({
|
|
|
6669
6763
|
const showLegends = props.showLegends ?? true;
|
|
6670
6764
|
const canvasMode = props.canvasMode;
|
|
6671
6765
|
const useApi = source === "api" && !!apiUrl;
|
|
6672
|
-
const [rawData, setRawData] = (0,
|
|
6673
|
-
const [localLoading, setLocalLoading] = (0,
|
|
6766
|
+
const [rawData, setRawData] = (0, import_react38.useState)([]);
|
|
6767
|
+
const [localLoading, setLocalLoading] = (0, import_react38.useState)(false);
|
|
6674
6768
|
const effectiveData = useApi ? rawData : props.data || [];
|
|
6675
6769
|
const effectiveLoading = useApi ? localLoading : externalLoading;
|
|
6676
|
-
(0,
|
|
6770
|
+
(0, import_react38.useEffect)(() => {
|
|
6677
6771
|
if (!useApi) return;
|
|
6678
6772
|
let cancelled = false;
|
|
6679
6773
|
const fetchData = async () => {
|
|
@@ -6709,7 +6803,7 @@ var DonutChart = ({
|
|
|
6709
6803
|
cancelled = true;
|
|
6710
6804
|
};
|
|
6711
6805
|
}, [useApi, apiUrl]);
|
|
6712
|
-
const data = (0,
|
|
6806
|
+
const data = (0, import_react38.useMemo)(() => {
|
|
6713
6807
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0) return [];
|
|
6714
6808
|
return effectiveData.map((item) => ({
|
|
6715
6809
|
...item,
|
|
@@ -6718,11 +6812,11 @@ var DonutChart = ({
|
|
|
6718
6812
|
[dataLabel]: item[dataLabel] ?? "Unknown"
|
|
6719
6813
|
}));
|
|
6720
6814
|
}, [effectiveData, dataKey, dataLabel]);
|
|
6721
|
-
const total = (0,
|
|
6815
|
+
const total = (0, import_react38.useMemo)(
|
|
6722
6816
|
() => data.reduce((sum, d) => sum + (d[dataKey] ?? 0), 0),
|
|
6723
6817
|
[data, dataKey]
|
|
6724
6818
|
);
|
|
6725
|
-
const formattedTotal = (0,
|
|
6819
|
+
const formattedTotal = (0, import_react38.useMemo)(() => {
|
|
6726
6820
|
if (total >= 1e6) {
|
|
6727
6821
|
return `${(total / 1e6).toFixed(1)}M`;
|
|
6728
6822
|
}
|
|
@@ -6731,7 +6825,7 @@ var DonutChart = ({
|
|
|
6731
6825
|
}
|
|
6732
6826
|
return total.toString();
|
|
6733
6827
|
}, [total]);
|
|
6734
|
-
const chartData = (0,
|
|
6828
|
+
const chartData = (0, import_react38.useMemo)(() => {
|
|
6735
6829
|
if (total === 0) return data;
|
|
6736
6830
|
const sortedData = [...data].sort((a, b) => (b[dataKey] ?? 0) - (a[dataKey] ?? 0));
|
|
6737
6831
|
const minAngle = 360 / Math.max(12, sortedData.length);
|
|
@@ -6754,15 +6848,15 @@ var DonutChart = ({
|
|
|
6754
6848
|
if (chartData.length <= 6) return { inner: 85, outer: 150 };
|
|
6755
6849
|
return { inner: 70, outer: 130 };
|
|
6756
6850
|
};
|
|
6757
|
-
const [mounted, setMounted] = (0,
|
|
6758
|
-
(0,
|
|
6851
|
+
const [mounted, setMounted] = (0, import_react38.useState)(false);
|
|
6852
|
+
(0, import_react38.useEffect)(() => {
|
|
6759
6853
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
6760
6854
|
return () => clearTimeout(timeout);
|
|
6761
6855
|
}, []);
|
|
6762
|
-
const renderLegends = (0,
|
|
6856
|
+
const renderLegends = (0, import_react38.useMemo)(() => {
|
|
6763
6857
|
if (!showLegends) return null;
|
|
6764
6858
|
const isLegendRight2 = !forceMobile && legendPosition === "right";
|
|
6765
|
-
return /* @__PURE__ */ (0,
|
|
6859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6766
6860
|
"div",
|
|
6767
6861
|
{
|
|
6768
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",
|
|
@@ -6777,7 +6871,7 @@ var DonutChart = ({
|
|
|
6777
6871
|
[dataLabel]: d[dataLabel],
|
|
6778
6872
|
[dataKey]: actualValue
|
|
6779
6873
|
};
|
|
6780
|
-
return /* @__PURE__ */ (0,
|
|
6874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
6781
6875
|
"div",
|
|
6782
6876
|
{
|
|
6783
6877
|
role: onLegendClick ? "button" : void 0,
|
|
@@ -6786,22 +6880,22 @@ var DonutChart = ({
|
|
|
6786
6880
|
onKeyDown: onLegendClick ? (e) => e.key === "Enter" && onLegendClick(payload) : void 0,
|
|
6787
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" : ""}`,
|
|
6788
6882
|
children: [
|
|
6789
|
-
/* @__PURE__ */ (0,
|
|
6883
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6790
6884
|
"span",
|
|
6791
6885
|
{
|
|
6792
6886
|
className: "inline-block w-[12px] h-[12px] rounded-full shrink-0 border-2 border-white/50",
|
|
6793
6887
|
style: { backgroundColor: d.color }
|
|
6794
6888
|
}
|
|
6795
6889
|
),
|
|
6796
|
-
/* @__PURE__ */ (0,
|
|
6797
|
-
/* @__PURE__ */ (0,
|
|
6798
|
-
/* @__PURE__ */ (0,
|
|
6799
|
-
/* @__PURE__ */ (0,
|
|
6800
|
-
/* @__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: [
|
|
6801
6895
|
(actualValue / total * 100).toFixed(1),
|
|
6802
6896
|
"%"
|
|
6803
6897
|
] }),
|
|
6804
|
-
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" })
|
|
6805
6899
|
] })
|
|
6806
6900
|
] })
|
|
6807
6901
|
]
|
|
@@ -6814,26 +6908,26 @@ var DonutChart = ({
|
|
|
6814
6908
|
}, [chartData, data, dataLabel, dataKey, total, showLegends, onLegendClick, legendPosition, forceMobile]);
|
|
6815
6909
|
if (!mounted) return null;
|
|
6816
6910
|
if (effectiveLoading) {
|
|
6817
|
-
return /* @__PURE__ */ (0,
|
|
6911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
6818
6912
|
"div",
|
|
6819
6913
|
{
|
|
6820
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}`,
|
|
6821
6915
|
style,
|
|
6822
6916
|
children: [
|
|
6823
|
-
/* @__PURE__ */ (0,
|
|
6824
|
-
/* @__PURE__ */ (0,
|
|
6825
|
-
/* @__PURE__ */ (0,
|
|
6826
|
-
/* @__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..." })
|
|
6827
6921
|
] }) }),
|
|
6828
|
-
/* @__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)(
|
|
6829
6923
|
"div",
|
|
6830
6924
|
{
|
|
6831
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`,
|
|
6832
6926
|
children: [
|
|
6833
|
-
/* @__PURE__ */ (0,
|
|
6834
|
-
/* @__PURE__ */ (0,
|
|
6835
|
-
/* @__PURE__ */ (0,
|
|
6836
|
-
/* @__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" })
|
|
6837
6931
|
] })
|
|
6838
6932
|
]
|
|
6839
6933
|
},
|
|
@@ -6844,12 +6938,12 @@ var DonutChart = ({
|
|
|
6844
6938
|
);
|
|
6845
6939
|
}
|
|
6846
6940
|
if (data.length === 0) {
|
|
6847
|
-
return /* @__PURE__ */ (0,
|
|
6941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6848
6942
|
"div",
|
|
6849
6943
|
{
|
|
6850
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}`,
|
|
6851
6945
|
style,
|
|
6852
|
-
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" }) }) })
|
|
6853
6947
|
}
|
|
6854
6948
|
);
|
|
6855
6949
|
}
|
|
@@ -6857,19 +6951,19 @@ var DonutChart = ({
|
|
|
6857
6951
|
const innerRadius = inner;
|
|
6858
6952
|
const outerRadius = outer;
|
|
6859
6953
|
const isLegendRight = !forceMobile && legendPosition === "right";
|
|
6860
|
-
return /* @__PURE__ */ (0,
|
|
6954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
6861
6955
|
"div",
|
|
6862
6956
|
{
|
|
6863
6957
|
className: `relative flex ${isLegendRight ? "flex-row items-stretch gap-4" : "flex-col items-center"} ${className}`,
|
|
6864
6958
|
style,
|
|
6865
6959
|
children: [
|
|
6866
|
-
/* @__PURE__ */ (0,
|
|
6960
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
6867
6961
|
"div",
|
|
6868
6962
|
{
|
|
6869
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"}`,
|
|
6870
6964
|
children: [
|
|
6871
|
-
/* @__PURE__ */ (0,
|
|
6872
|
-
/* @__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)(
|
|
6873
6967
|
import_recharts2.Pie,
|
|
6874
6968
|
{
|
|
6875
6969
|
data: chartData,
|
|
@@ -6882,7 +6976,7 @@ var DonutChart = ({
|
|
|
6882
6976
|
isAnimationActive: true,
|
|
6883
6977
|
animationDuration: 800,
|
|
6884
6978
|
minAngle: 3,
|
|
6885
|
-
children: chartData.map((entry, index) => /* @__PURE__ */ (0,
|
|
6979
|
+
children: chartData.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6886
6980
|
import_recharts2.Cell,
|
|
6887
6981
|
{
|
|
6888
6982
|
fill: entry.color,
|
|
@@ -6893,7 +6987,7 @@ var DonutChart = ({
|
|
|
6893
6987
|
))
|
|
6894
6988
|
}
|
|
6895
6989
|
),
|
|
6896
|
-
/* @__PURE__ */ (0,
|
|
6990
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
6897
6991
|
import_recharts2.Tooltip,
|
|
6898
6992
|
{
|
|
6899
6993
|
formatter: (value, name, payload) => {
|
|
@@ -6916,25 +7010,25 @@ var DonutChart = ({
|
|
|
6916
7010
|
}
|
|
6917
7011
|
)
|
|
6918
7012
|
] }) }),
|
|
6919
|
-
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: [
|
|
6920
7014
|
formattedTotal,
|
|
6921
|
-
/* @__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" })
|
|
6922
7016
|
] }) })
|
|
6923
7017
|
]
|
|
6924
7018
|
}
|
|
6925
7019
|
),
|
|
6926
|
-
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 })
|
|
6927
7021
|
]
|
|
6928
7022
|
}
|
|
6929
7023
|
);
|
|
6930
7024
|
};
|
|
6931
|
-
var PieChart_default =
|
|
7025
|
+
var PieChart_default = import_react38.default.memo(DonutChart);
|
|
6932
7026
|
|
|
6933
7027
|
// src/components/Blocks/EmailComposer.tsx
|
|
6934
|
-
var
|
|
7028
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
6935
7029
|
function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc, setShowBcc, cc, setCc, bcc, setBcc, subject, setSubject, body, setBody }) {
|
|
6936
|
-
return /* @__PURE__ */ (0,
|
|
6937
|
-
/* @__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)(
|
|
6938
7032
|
"input",
|
|
6939
7033
|
{
|
|
6940
7034
|
type: "email",
|
|
@@ -6943,8 +7037,8 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
6943
7037
|
required: true
|
|
6944
7038
|
}
|
|
6945
7039
|
) }),
|
|
6946
|
-
/* @__PURE__ */ (0,
|
|
6947
|
-
/* @__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)(
|
|
6948
7042
|
"input",
|
|
6949
7043
|
{
|
|
6950
7044
|
type: "email",
|
|
@@ -6955,7 +7049,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
6955
7049
|
required: true
|
|
6956
7050
|
}
|
|
6957
7051
|
),
|
|
6958
|
-
!showCc && /* @__PURE__ */ (0,
|
|
7052
|
+
!showCc && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
6959
7053
|
"button",
|
|
6960
7054
|
{
|
|
6961
7055
|
onClick: () => setShowCc?.(true),
|
|
@@ -6963,7 +7057,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
6963
7057
|
children: "Cc"
|
|
6964
7058
|
}
|
|
6965
7059
|
),
|
|
6966
|
-
!showBcc && /* @__PURE__ */ (0,
|
|
7060
|
+
!showBcc && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
6967
7061
|
"button",
|
|
6968
7062
|
{
|
|
6969
7063
|
onClick: () => setShowBcc?.(true),
|
|
@@ -6972,7 +7066,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
6972
7066
|
}
|
|
6973
7067
|
)
|
|
6974
7068
|
] }) }),
|
|
6975
|
-
showCc && /* @__PURE__ */ (0,
|
|
7069
|
+
showCc && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
6976
7070
|
"input",
|
|
6977
7071
|
{
|
|
6978
7072
|
type: "text",
|
|
@@ -6982,7 +7076,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
6982
7076
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
6983
7077
|
}
|
|
6984
7078
|
) }),
|
|
6985
|
-
showBcc && /* @__PURE__ */ (0,
|
|
7079
|
+
showBcc && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
6986
7080
|
"input",
|
|
6987
7081
|
{
|
|
6988
7082
|
type: "text",
|
|
@@ -6992,7 +7086,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
6992
7086
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
6993
7087
|
}
|
|
6994
7088
|
) }),
|
|
6995
|
-
/* @__PURE__ */ (0,
|
|
7089
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
6996
7090
|
"input",
|
|
6997
7091
|
{
|
|
6998
7092
|
type: "text",
|
|
@@ -7002,11 +7096,11 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
7002
7096
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
7003
7097
|
}
|
|
7004
7098
|
) }),
|
|
7005
|
-
/* @__PURE__ */ (0,
|
|
7006
|
-
/* @__PURE__ */ (0,
|
|
7007
|
-
/* @__PURE__ */ (0,
|
|
7008
|
-
/* @__PURE__ */ (0,
|
|
7009
|
-
/* @__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" })
|
|
7010
7104
|
] })
|
|
7011
7105
|
] }) });
|
|
7012
7106
|
}
|
|
@@ -7014,10 +7108,10 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
7014
7108
|
// src/components/ui/sonner.tsx
|
|
7015
7109
|
var import_next_themes = require("next-themes");
|
|
7016
7110
|
var import_sonner2 = require("sonner");
|
|
7017
|
-
var
|
|
7111
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
7018
7112
|
var Toaster = ({ ...props }) => {
|
|
7019
7113
|
const { theme = "system" } = (0, import_next_themes.useTheme)();
|
|
7020
|
-
return /* @__PURE__ */ (0,
|
|
7114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7021
7115
|
import_sonner2.Toaster,
|
|
7022
7116
|
{
|
|
7023
7117
|
theme,
|
|
@@ -7035,6 +7129,7 @@ var Toaster = ({ ...props }) => {
|
|
|
7035
7129
|
0 && (module.exports = {
|
|
7036
7130
|
Accordion,
|
|
7037
7131
|
AccordionGroup,
|
|
7132
|
+
Audio,
|
|
7038
7133
|
BarChart,
|
|
7039
7134
|
Breadcrumb,
|
|
7040
7135
|
Button,
|