warqadui 0.0.46 → 0.0.47
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.js +388 -383
- package/dist/index.mjs +317 -312
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1063,13 +1063,18 @@ var useModal = (initialState = false) => {
|
|
|
1063
1063
|
};
|
|
1064
1064
|
};
|
|
1065
1065
|
|
|
1066
|
+
// src/hooks/uploads/useAntdImageUpload.tsx
|
|
1067
|
+
import { useState as useState7 } from "react";
|
|
1068
|
+
import { Image, Upload } from "antd";
|
|
1069
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1070
|
+
|
|
1066
1071
|
// src/components/Fields/Input.tsx
|
|
1067
|
-
import { forwardRef, useEffect as useEffect5, useState as
|
|
1072
|
+
import { forwardRef, useEffect as useEffect5, useState as useState8 } from "react";
|
|
1068
1073
|
import { Eye, EyeOff } from "lucide-react";
|
|
1069
1074
|
import {
|
|
1070
1075
|
Controller
|
|
1071
1076
|
} from "react-hook-form";
|
|
1072
|
-
import { jsx as
|
|
1077
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1073
1078
|
var Input = forwardRef(
|
|
1074
1079
|
({
|
|
1075
1080
|
label,
|
|
@@ -1085,8 +1090,8 @@ var Input = forwardRef(
|
|
|
1085
1090
|
variant = "default",
|
|
1086
1091
|
...props
|
|
1087
1092
|
}, ref) => {
|
|
1088
|
-
const [isFocused, setIsFocused] =
|
|
1089
|
-
const [showPassword, setShowPassword] =
|
|
1093
|
+
const [isFocused, setIsFocused] = useState8(false);
|
|
1094
|
+
const [showPassword, setShowPassword] = useState8(false);
|
|
1090
1095
|
const { theme } = useWarqadConfig();
|
|
1091
1096
|
const primaryColor = theme?.primaryColor;
|
|
1092
1097
|
useEffect5(() => {
|
|
@@ -1110,12 +1115,12 @@ var Input = forwardRef(
|
|
|
1110
1115
|
form.clearErrors("root");
|
|
1111
1116
|
}
|
|
1112
1117
|
}, [form?.watch(name)]);
|
|
1113
|
-
const renderInput = (inputProps, localType = type || "text") => /* @__PURE__ */
|
|
1118
|
+
const renderInput = (inputProps, localType = type || "text") => /* @__PURE__ */ jsxs12(
|
|
1114
1119
|
"div",
|
|
1115
1120
|
{
|
|
1116
1121
|
className: `${label ? "space-y-2" : ""} group relative ${containerClassName} `,
|
|
1117
1122
|
children: [
|
|
1118
|
-
label && /* @__PURE__ */
|
|
1123
|
+
label && /* @__PURE__ */ jsxs12(
|
|
1119
1124
|
"label",
|
|
1120
1125
|
{
|
|
1121
1126
|
htmlFor: props.id,
|
|
@@ -1123,12 +1128,12 @@ var Input = forwardRef(
|
|
|
1123
1128
|
style: { color: isFocused ? primaryColor : void 0 },
|
|
1124
1129
|
children: [
|
|
1125
1130
|
label,
|
|
1126
|
-
props.required && /* @__PURE__ */
|
|
1131
|
+
props.required && /* @__PURE__ */ jsx18("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1127
1132
|
]
|
|
1128
1133
|
}
|
|
1129
1134
|
),
|
|
1130
|
-
/* @__PURE__ */
|
|
1131
|
-
icon && /* @__PURE__ */
|
|
1135
|
+
/* @__PURE__ */ jsxs12("div", { className: "relative", children: [
|
|
1136
|
+
icon && /* @__PURE__ */ jsx18("div", { className: "absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none", children: /* @__PURE__ */ jsx18(
|
|
1132
1137
|
"div",
|
|
1133
1138
|
{
|
|
1134
1139
|
className: `transition-colors duration-200`,
|
|
@@ -1136,7 +1141,7 @@ var Input = forwardRef(
|
|
|
1136
1141
|
children: icon
|
|
1137
1142
|
}
|
|
1138
1143
|
) }),
|
|
1139
|
-
/* @__PURE__ */
|
|
1144
|
+
/* @__PURE__ */ jsx18(
|
|
1140
1145
|
"input",
|
|
1141
1146
|
{
|
|
1142
1147
|
ref,
|
|
@@ -1158,23 +1163,23 @@ var Input = forwardRef(
|
|
|
1158
1163
|
type: localType === "password" ? showPassword ? "text" : "password" : localType
|
|
1159
1164
|
}
|
|
1160
1165
|
),
|
|
1161
|
-
type === "password" && /* @__PURE__ */
|
|
1166
|
+
type === "password" && /* @__PURE__ */ jsx18(
|
|
1162
1167
|
"button",
|
|
1163
1168
|
{
|
|
1164
1169
|
type: "button",
|
|
1165
1170
|
onClick: () => setShowPassword(!showPassword),
|
|
1166
1171
|
className: "absolute inset-y-0 right-0 pr-2.5 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors focus:outline-none cursor-pointer",
|
|
1167
1172
|
tabIndex: -1,
|
|
1168
|
-
children: showPassword ? /* @__PURE__ */
|
|
1173
|
+
children: showPassword ? /* @__PURE__ */ jsx18(EyeOff, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx18(Eye, { className: "h-5 w-5" })
|
|
1169
1174
|
}
|
|
1170
1175
|
)
|
|
1171
1176
|
] }),
|
|
1172
|
-
message && /* @__PURE__ */
|
|
1177
|
+
message && /* @__PURE__ */ jsx18("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1173
1178
|
]
|
|
1174
1179
|
}
|
|
1175
1180
|
);
|
|
1176
1181
|
if (form && name && type === "number") {
|
|
1177
|
-
return /* @__PURE__ */
|
|
1182
|
+
return /* @__PURE__ */ jsx18(
|
|
1178
1183
|
Controller,
|
|
1179
1184
|
{
|
|
1180
1185
|
control: form.control,
|
|
@@ -1263,13 +1268,13 @@ var Input = forwardRef(
|
|
|
1263
1268
|
);
|
|
1264
1269
|
|
|
1265
1270
|
// src/components/Fields/PhoneInput.tsx
|
|
1266
|
-
import { forwardRef as forwardRef2, useState as
|
|
1271
|
+
import { forwardRef as forwardRef2, useState as useState9 } from "react";
|
|
1267
1272
|
import PhoneInputOriginal, {
|
|
1268
1273
|
isValidPhoneNumber
|
|
1269
1274
|
} from "react-phone-number-input";
|
|
1270
1275
|
import "react-phone-number-input/style.css";
|
|
1271
1276
|
import { Controller as Controller2 } from "react-hook-form";
|
|
1272
|
-
import { jsx as
|
|
1277
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1273
1278
|
var PhoneInput = forwardRef2(
|
|
1274
1279
|
({
|
|
1275
1280
|
label,
|
|
@@ -1283,7 +1288,7 @@ var PhoneInput = forwardRef2(
|
|
|
1283
1288
|
className = "",
|
|
1284
1289
|
...props
|
|
1285
1290
|
}, ref) => {
|
|
1286
|
-
const [isFocused, setIsFocused] =
|
|
1291
|
+
const [isFocused, setIsFocused] = useState9(false);
|
|
1287
1292
|
const { theme } = useWarqadConfig();
|
|
1288
1293
|
const primaryColor = theme?.primaryColor;
|
|
1289
1294
|
let message = error;
|
|
@@ -1298,8 +1303,8 @@ var PhoneInput = forwardRef2(
|
|
|
1298
1303
|
}
|
|
1299
1304
|
message = currentError?.message || message;
|
|
1300
1305
|
}
|
|
1301
|
-
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */
|
|
1302
|
-
/* @__PURE__ */
|
|
1306
|
+
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ jsxs13("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
1307
|
+
/* @__PURE__ */ jsxs13(
|
|
1303
1308
|
"label",
|
|
1304
1309
|
{
|
|
1305
1310
|
className: `block text-xs font-medium transition-colors duration-200`,
|
|
@@ -1308,12 +1313,12 @@ var PhoneInput = forwardRef2(
|
|
|
1308
1313
|
},
|
|
1309
1314
|
children: [
|
|
1310
1315
|
label,
|
|
1311
|
-
props.required && /* @__PURE__ */
|
|
1316
|
+
props.required && /* @__PURE__ */ jsx19("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1312
1317
|
]
|
|
1313
1318
|
}
|
|
1314
1319
|
),
|
|
1315
|
-
/* @__PURE__ */
|
|
1316
|
-
icon && /* @__PURE__ */
|
|
1320
|
+
/* @__PURE__ */ jsxs13("div", { className: "relative", children: [
|
|
1321
|
+
icon && /* @__PURE__ */ jsx19("div", { className: "absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none z-10", children: /* @__PURE__ */ jsx19(
|
|
1317
1322
|
"div",
|
|
1318
1323
|
{
|
|
1319
1324
|
className: `transition-colors duration-200`,
|
|
@@ -1321,7 +1326,7 @@ var PhoneInput = forwardRef2(
|
|
|
1321
1326
|
children: icon
|
|
1322
1327
|
}
|
|
1323
1328
|
) }),
|
|
1324
|
-
/* @__PURE__ */
|
|
1329
|
+
/* @__PURE__ */ jsx19(
|
|
1325
1330
|
PhoneInputOriginal,
|
|
1326
1331
|
{
|
|
1327
1332
|
ref,
|
|
@@ -1341,10 +1346,10 @@ var PhoneInput = forwardRef2(
|
|
|
1341
1346
|
}
|
|
1342
1347
|
)
|
|
1343
1348
|
] }),
|
|
1344
|
-
message && /* @__PURE__ */
|
|
1349
|
+
message && /* @__PURE__ */ jsx19("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1345
1350
|
] });
|
|
1346
1351
|
if (form && name) {
|
|
1347
|
-
return /* @__PURE__ */
|
|
1352
|
+
return /* @__PURE__ */ jsx19(
|
|
1348
1353
|
Controller2,
|
|
1349
1354
|
{
|
|
1350
1355
|
name,
|
|
@@ -1366,7 +1371,7 @@ PhoneInput.displayName = "PhoneInput";
|
|
|
1366
1371
|
import React6, {
|
|
1367
1372
|
createContext as createContext3,
|
|
1368
1373
|
useContext as useContext3,
|
|
1369
|
-
useState as
|
|
1374
|
+
useState as useState10,
|
|
1370
1375
|
useRef as useRef3,
|
|
1371
1376
|
useEffect as useEffect6,
|
|
1372
1377
|
forwardRef as forwardRef3
|
|
@@ -1374,7 +1379,7 @@ import React6, {
|
|
|
1374
1379
|
import { createPortal } from "react-dom";
|
|
1375
1380
|
import { ChevronDown as ChevronDown2, Check as Check2 } from "lucide-react";
|
|
1376
1381
|
import { Controller as Controller3 } from "react-hook-form";
|
|
1377
|
-
import { Fragment as
|
|
1382
|
+
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1378
1383
|
var SelectContext = createContext3(void 0);
|
|
1379
1384
|
var useSelectContext = () => {
|
|
1380
1385
|
const context = useContext3(SelectContext);
|
|
@@ -1393,7 +1398,7 @@ var Select = forwardRef3((props, ref) => {
|
|
|
1393
1398
|
}
|
|
1394
1399
|
}, [value, name, form]);
|
|
1395
1400
|
if (form && name) {
|
|
1396
|
-
return /* @__PURE__ */
|
|
1401
|
+
return /* @__PURE__ */ jsx20(
|
|
1397
1402
|
Controller3,
|
|
1398
1403
|
{
|
|
1399
1404
|
name,
|
|
@@ -1405,7 +1410,7 @@ var Select = forwardRef3((props, ref) => {
|
|
|
1405
1410
|
ref: fieldRef,
|
|
1406
1411
|
onBlur
|
|
1407
1412
|
}
|
|
1408
|
-
}) => /* @__PURE__ */
|
|
1413
|
+
}) => /* @__PURE__ */ jsx20(
|
|
1409
1414
|
SelectRoot,
|
|
1410
1415
|
{
|
|
1411
1416
|
...props,
|
|
@@ -1422,7 +1427,7 @@ var Select = forwardRef3((props, ref) => {
|
|
|
1422
1427
|
}
|
|
1423
1428
|
);
|
|
1424
1429
|
}
|
|
1425
|
-
return /* @__PURE__ */
|
|
1430
|
+
return /* @__PURE__ */ jsx20(
|
|
1426
1431
|
SelectRoot,
|
|
1427
1432
|
{
|
|
1428
1433
|
...props,
|
|
@@ -1455,10 +1460,10 @@ var SelectRoot = ({
|
|
|
1455
1460
|
className = "",
|
|
1456
1461
|
...props
|
|
1457
1462
|
}) => {
|
|
1458
|
-
const [isOpen, setIsOpen] =
|
|
1459
|
-
const [isFocused, setIsFocused] =
|
|
1460
|
-
const [activeIndex, setActiveIndex] =
|
|
1461
|
-
const [registeredOptions, setRegisteredOptions] =
|
|
1463
|
+
const [isOpen, setIsOpen] = useState10(false);
|
|
1464
|
+
const [isFocused, setIsFocused] = useState10(false);
|
|
1465
|
+
const [activeIndex, setActiveIndex] = useState10(-1);
|
|
1466
|
+
const [registeredOptions, setRegisteredOptions] = useState10([]);
|
|
1462
1467
|
const { theme } = useWarqadConfig();
|
|
1463
1468
|
const primaryColor = theme?.primaryColor;
|
|
1464
1469
|
const containerRef = useRef3(null);
|
|
@@ -1529,25 +1534,25 @@ var SelectRoot = ({
|
|
|
1529
1534
|
disabled
|
|
1530
1535
|
};
|
|
1531
1536
|
const hasChildren = React6.Children.count(children) > 0;
|
|
1532
|
-
return /* @__PURE__ */
|
|
1537
|
+
return /* @__PURE__ */ jsx20(SelectContext.Provider, { value: valueCtx, children: /* @__PURE__ */ jsxs14(
|
|
1533
1538
|
"div",
|
|
1534
1539
|
{
|
|
1535
1540
|
ref: containerRef,
|
|
1536
1541
|
className: `${label ? "space-y-2" : ""} group relative ${containerClassName}`,
|
|
1537
1542
|
children: [
|
|
1538
|
-
label && /* @__PURE__ */
|
|
1543
|
+
label && /* @__PURE__ */ jsxs14(
|
|
1539
1544
|
"label",
|
|
1540
1545
|
{
|
|
1541
1546
|
className: `block text-xs font-medium transition-colors duration-200`,
|
|
1542
1547
|
style: { color: isFocused || isOpen ? primaryColor : void 0 },
|
|
1543
1548
|
children: [
|
|
1544
1549
|
label,
|
|
1545
|
-
required && /* @__PURE__ */
|
|
1550
|
+
required && /* @__PURE__ */ jsx20("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1546
1551
|
]
|
|
1547
1552
|
}
|
|
1548
1553
|
),
|
|
1549
|
-
hasChildren ? children : /* @__PURE__ */
|
|
1550
|
-
/* @__PURE__ */
|
|
1554
|
+
hasChildren ? children : /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
1555
|
+
/* @__PURE__ */ jsx20(
|
|
1551
1556
|
SelectTrigger,
|
|
1552
1557
|
{
|
|
1553
1558
|
id,
|
|
@@ -1558,7 +1563,7 @@ var SelectRoot = ({
|
|
|
1558
1563
|
...props
|
|
1559
1564
|
}
|
|
1560
1565
|
),
|
|
1561
|
-
allOptions && allOptions.length > 0 && /* @__PURE__ */
|
|
1566
|
+
allOptions && allOptions.length > 0 && /* @__PURE__ */ jsx20(SelectContent, { children: allOptions.map((opt, index) => /* @__PURE__ */ jsx20(
|
|
1562
1567
|
SelectItem,
|
|
1563
1568
|
{
|
|
1564
1569
|
value: opt.value,
|
|
@@ -1568,7 +1573,7 @@ var SelectRoot = ({
|
|
|
1568
1573
|
String(opt.value) || index
|
|
1569
1574
|
)) })
|
|
1570
1575
|
] }),
|
|
1571
|
-
message && /* @__PURE__ */
|
|
1576
|
+
message && /* @__PURE__ */ jsx20("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1572
1577
|
]
|
|
1573
1578
|
}
|
|
1574
1579
|
) });
|
|
@@ -1600,7 +1605,7 @@ var SelectTrigger = forwardRef3(
|
|
|
1600
1605
|
const lastFocusTime = useRef3(0);
|
|
1601
1606
|
const displayOption = options.find((o) => o.value === selectedValue);
|
|
1602
1607
|
const displayValue = displayOption ? displayOption.label : selectedValue != null && selectedValue !== "" ? String(selectedValue) : placeholder;
|
|
1603
|
-
return /* @__PURE__ */
|
|
1608
|
+
return /* @__PURE__ */ jsx20("div", { className: "relative", ref: dropdownAnchorRef, children: /* @__PURE__ */ jsx20(
|
|
1604
1609
|
"div",
|
|
1605
1610
|
{
|
|
1606
1611
|
id,
|
|
@@ -1649,8 +1654,8 @@ var SelectTrigger = forwardRef3(
|
|
|
1649
1654
|
}
|
|
1650
1655
|
},
|
|
1651
1656
|
...props,
|
|
1652
|
-
children: children ? children : /* @__PURE__ */
|
|
1653
|
-
icon && /* @__PURE__ */
|
|
1657
|
+
children: children ? children : /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
1658
|
+
icon && /* @__PURE__ */ jsx20(
|
|
1654
1659
|
"div",
|
|
1655
1660
|
{
|
|
1656
1661
|
className: `pl-2.5 pr-2 flex items-center transition-colors duration-200`,
|
|
@@ -1660,14 +1665,14 @@ var SelectTrigger = forwardRef3(
|
|
|
1660
1665
|
children: icon
|
|
1661
1666
|
}
|
|
1662
1667
|
),
|
|
1663
|
-
/* @__PURE__ */
|
|
1668
|
+
/* @__PURE__ */ jsx20(
|
|
1664
1669
|
"div",
|
|
1665
1670
|
{
|
|
1666
1671
|
className: `flex-1 truncate text-sm ${icon ? "" : "pl-2.5"} ${!selectedValue && selectedValue !== 0 && selectedValue !== false ? "text-gray-400 dark:text-zinc-500" : ""}`,
|
|
1667
1672
|
children: displayValue
|
|
1668
1673
|
}
|
|
1669
1674
|
),
|
|
1670
|
-
/* @__PURE__ */
|
|
1675
|
+
/* @__PURE__ */ jsx20("div", { className: "pr-2.5 flex items-center gap-1 shrink-0", children: /* @__PURE__ */ jsx20(
|
|
1671
1676
|
ChevronDown2,
|
|
1672
1677
|
{
|
|
1673
1678
|
className: `h-4 w-4 text-gray-400 transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
@@ -1682,7 +1687,7 @@ SelectTrigger.displayName = "SelectTrigger";
|
|
|
1682
1687
|
var SelectContent = forwardRef3(
|
|
1683
1688
|
({ children, className = "", style, ...props }, ref) => {
|
|
1684
1689
|
const { isOpen, setIsOpen, dropdownAnchorRef, dropdownContentRef } = useSelectContext();
|
|
1685
|
-
const [dropdownStyle, setDropdownStyle] =
|
|
1690
|
+
const [dropdownStyle, setDropdownStyle] = useState10({});
|
|
1686
1691
|
const updateDropdownPosition = () => {
|
|
1687
1692
|
if (dropdownAnchorRef.current) {
|
|
1688
1693
|
const rect = dropdownAnchorRef.current.getBoundingClientRect();
|
|
@@ -1713,7 +1718,7 @@ var SelectContent = forwardRef3(
|
|
|
1713
1718
|
}, [isOpen]);
|
|
1714
1719
|
if (!isOpen || typeof document === "undefined") return null;
|
|
1715
1720
|
return createPortal(
|
|
1716
|
-
/* @__PURE__ */
|
|
1721
|
+
/* @__PURE__ */ jsx20(
|
|
1717
1722
|
"div",
|
|
1718
1723
|
{
|
|
1719
1724
|
ref: dropdownContentRef,
|
|
@@ -1721,7 +1726,7 @@ var SelectContent = forwardRef3(
|
|
|
1721
1726
|
style: { ...dropdownStyle, ...style },
|
|
1722
1727
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1723
1728
|
...props,
|
|
1724
|
-
children: /* @__PURE__ */
|
|
1729
|
+
children: /* @__PURE__ */ jsx20("div", { className: "flex flex-col gap-0.5", children: React6.Children.count(children) === 0 ? /* @__PURE__ */ jsx20("div", { className: "p-3 text-center text-sm text-gray-500", children: "No options available" }) : children })
|
|
1725
1730
|
}
|
|
1726
1731
|
),
|
|
1727
1732
|
document.body
|
|
@@ -1752,7 +1757,7 @@ var SelectItem = forwardRef3(
|
|
|
1752
1757
|
setIsOpen(false);
|
|
1753
1758
|
fieldInternalProps?.onBlur?.();
|
|
1754
1759
|
};
|
|
1755
|
-
return /* @__PURE__ */
|
|
1760
|
+
return /* @__PURE__ */ jsxs14(
|
|
1756
1761
|
"button",
|
|
1757
1762
|
{
|
|
1758
1763
|
ref,
|
|
@@ -1768,8 +1773,8 @@ var SelectItem = forwardRef3(
|
|
|
1768
1773
|
},
|
|
1769
1774
|
...props,
|
|
1770
1775
|
children: [
|
|
1771
|
-
/* @__PURE__ */
|
|
1772
|
-
isSelected && /* @__PURE__ */
|
|
1776
|
+
/* @__PURE__ */ jsx20("span", { className: "whitespace-nowrap truncate flex-1", children: children || label }),
|
|
1777
|
+
isSelected && /* @__PURE__ */ jsx20(
|
|
1773
1778
|
Check2,
|
|
1774
1779
|
{
|
|
1775
1780
|
className: "h-4 w-4 shrink-0 ml-2",
|
|
@@ -1784,11 +1789,11 @@ var SelectItem = forwardRef3(
|
|
|
1784
1789
|
SelectItem.displayName = "SelectItem";
|
|
1785
1790
|
|
|
1786
1791
|
// src/components/Fields/textArea.tsx
|
|
1787
|
-
import { forwardRef as forwardRef4, useEffect as useEffect7, useState as
|
|
1792
|
+
import { forwardRef as forwardRef4, useEffect as useEffect7, useState as useState11 } from "react";
|
|
1788
1793
|
import {
|
|
1789
1794
|
Controller as Controller4
|
|
1790
1795
|
} from "react-hook-form";
|
|
1791
|
-
import { jsx as
|
|
1796
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1792
1797
|
var Textarea = forwardRef4(
|
|
1793
1798
|
({
|
|
1794
1799
|
label,
|
|
@@ -1801,7 +1806,7 @@ var Textarea = forwardRef4(
|
|
|
1801
1806
|
className = "",
|
|
1802
1807
|
...props
|
|
1803
1808
|
}, ref) => {
|
|
1804
|
-
const [isFocused, setIsFocused] =
|
|
1809
|
+
const [isFocused, setIsFocused] = useState11(false);
|
|
1805
1810
|
const { theme } = useWarqadConfig();
|
|
1806
1811
|
const primaryColor = theme?.primaryColor;
|
|
1807
1812
|
let message = error;
|
|
@@ -1812,8 +1817,8 @@ var Textarea = forwardRef4(
|
|
|
1812
1817
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1813
1818
|
message = errorObj?.message;
|
|
1814
1819
|
}
|
|
1815
|
-
const renderInput = (inputProps, ref2) => /* @__PURE__ */
|
|
1816
|
-
/* @__PURE__ */
|
|
1820
|
+
const renderInput = (inputProps, ref2) => /* @__PURE__ */ jsxs15("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
|
|
1821
|
+
/* @__PURE__ */ jsxs15(
|
|
1817
1822
|
"label",
|
|
1818
1823
|
{
|
|
1819
1824
|
htmlFor: props.id,
|
|
@@ -1821,11 +1826,11 @@ var Textarea = forwardRef4(
|
|
|
1821
1826
|
style: { color: isFocused ? primaryColor : void 0 },
|
|
1822
1827
|
children: [
|
|
1823
1828
|
label,
|
|
1824
|
-
props.required && /* @__PURE__ */
|
|
1829
|
+
props.required && /* @__PURE__ */ jsx21("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1825
1830
|
]
|
|
1826
1831
|
}
|
|
1827
1832
|
),
|
|
1828
|
-
/* @__PURE__ */
|
|
1833
|
+
/* @__PURE__ */ jsx21("div", { className: "relative", children: /* @__PURE__ */ jsx21(
|
|
1829
1834
|
"textarea",
|
|
1830
1835
|
{
|
|
1831
1836
|
ref: ref2,
|
|
@@ -1846,7 +1851,7 @@ var Textarea = forwardRef4(
|
|
|
1846
1851
|
...inputProps
|
|
1847
1852
|
}
|
|
1848
1853
|
) }),
|
|
1849
|
-
message && /* @__PURE__ */
|
|
1854
|
+
message && /* @__PURE__ */ jsx21("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1850
1855
|
] });
|
|
1851
1856
|
useEffect7(() => {
|
|
1852
1857
|
if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
@@ -1857,7 +1862,7 @@ var Textarea = forwardRef4(
|
|
|
1857
1862
|
}
|
|
1858
1863
|
}, [props.value, name, form]);
|
|
1859
1864
|
if (form && name) {
|
|
1860
|
-
return /* @__PURE__ */
|
|
1865
|
+
return /* @__PURE__ */ jsx21(
|
|
1861
1866
|
Controller4,
|
|
1862
1867
|
{
|
|
1863
1868
|
control: form.control,
|
|
@@ -1896,7 +1901,7 @@ var Textarea = forwardRef4(
|
|
|
1896
1901
|
import {
|
|
1897
1902
|
createContext as createContext4,
|
|
1898
1903
|
useContext as useContext4,
|
|
1899
|
-
useState as
|
|
1904
|
+
useState as useState13,
|
|
1900
1905
|
useRef as useRef4,
|
|
1901
1906
|
useEffect as useEffect8,
|
|
1902
1907
|
forwardRef as forwardRef5
|
|
@@ -1905,7 +1910,7 @@ import { createPortal as createPortal2 } from "react-dom";
|
|
|
1905
1910
|
import { Search, Loader2 as Loader22, ChevronDown as ChevronDown3, Check as Check3, X as X2 } from "lucide-react";
|
|
1906
1911
|
|
|
1907
1912
|
// src/hooks/Fetches/useApis.tsx
|
|
1908
|
-
import { useState as
|
|
1913
|
+
import { useState as useState12, useMemo as useMemo2 } from "react";
|
|
1909
1914
|
import axios from "axios";
|
|
1910
1915
|
var useApi = () => {
|
|
1911
1916
|
const { api: configApi } = useWarqadConfig();
|
|
@@ -1916,10 +1921,10 @@ var useApi = () => {
|
|
|
1916
1921
|
withCredentials: true
|
|
1917
1922
|
});
|
|
1918
1923
|
}, [configApi]);
|
|
1919
|
-
const [data, setData] =
|
|
1920
|
-
const [isLoading, setIsLoading] =
|
|
1921
|
-
const [pdfLoading, setPdfLoading] =
|
|
1922
|
-
const [error, setError] =
|
|
1924
|
+
const [data, setData] = useState12();
|
|
1925
|
+
const [isLoading, setIsLoading] = useState12(false);
|
|
1926
|
+
const [pdfLoading, setPdfLoading] = useState12(false);
|
|
1927
|
+
const [error, setError] = useState12(null);
|
|
1923
1928
|
const get = async ({ url, v = 1, params, delay }) => {
|
|
1924
1929
|
setIsLoading(true);
|
|
1925
1930
|
try {
|
|
@@ -2071,7 +2076,7 @@ var useApis_default = useApi;
|
|
|
2071
2076
|
|
|
2072
2077
|
// src/components/Fields/searchApi.tsx
|
|
2073
2078
|
import { Controller as Controller5 } from "react-hook-form";
|
|
2074
|
-
import { Fragment as
|
|
2079
|
+
import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2075
2080
|
var SearchApiContext = createContext4(
|
|
2076
2081
|
void 0
|
|
2077
2082
|
);
|
|
@@ -2095,12 +2100,12 @@ var SearchApi = forwardRef5(
|
|
|
2095
2100
|
}
|
|
2096
2101
|
}, [value, name, form]);
|
|
2097
2102
|
if (form && name) {
|
|
2098
|
-
return /* @__PURE__ */
|
|
2103
|
+
return /* @__PURE__ */ jsx22(
|
|
2099
2104
|
Controller5,
|
|
2100
2105
|
{
|
|
2101
2106
|
name,
|
|
2102
2107
|
control: form.control,
|
|
2103
|
-
render: ({ field }) => /* @__PURE__ */
|
|
2108
|
+
render: ({ field }) => /* @__PURE__ */ jsx22(
|
|
2104
2109
|
SearchApiRoot,
|
|
2105
2110
|
{
|
|
2106
2111
|
...restProps,
|
|
@@ -2120,7 +2125,7 @@ var SearchApi = forwardRef5(
|
|
|
2120
2125
|
}
|
|
2121
2126
|
);
|
|
2122
2127
|
}
|
|
2123
|
-
return /* @__PURE__ */
|
|
2128
|
+
return /* @__PURE__ */ jsx22(
|
|
2124
2129
|
SearchApiRoot,
|
|
2125
2130
|
{
|
|
2126
2131
|
...restProps,
|
|
@@ -2163,15 +2168,15 @@ var SearchApiRoot = ({
|
|
|
2163
2168
|
className = "",
|
|
2164
2169
|
...props
|
|
2165
2170
|
}) => {
|
|
2166
|
-
const [searchTerm, setSearchTerm] =
|
|
2171
|
+
const [searchTerm, setSearchTerm] = useState13("");
|
|
2167
2172
|
const { theme } = useWarqadConfig();
|
|
2168
2173
|
const primaryColor = theme?.primaryColor;
|
|
2169
|
-
const [options, setOptions] =
|
|
2170
|
-
const [isOpen, setIsOpen] =
|
|
2171
|
-
const [isFocused, setIsFocused] =
|
|
2172
|
-
const [activeIndex, setActiveIndex] =
|
|
2173
|
-
const [selectedObject, setSelectedObject] =
|
|
2174
|
-
const [hasAttemptedHydration, setHasAttemptedHydration] =
|
|
2174
|
+
const [options, setOptions] = useState13([]);
|
|
2175
|
+
const [isOpen, setIsOpen] = useState13(false);
|
|
2176
|
+
const [isFocused, setIsFocused] = useState13(false);
|
|
2177
|
+
const [activeIndex, setActiveIndex] = useState13(-1);
|
|
2178
|
+
const [selectedObject, setSelectedObject] = useState13(void 0);
|
|
2179
|
+
const [hasAttemptedHydration, setHasAttemptedHydration] = useState13(false);
|
|
2175
2180
|
const containerRef = useRef4(null);
|
|
2176
2181
|
const dropdownAnchorRef = useRef4(null);
|
|
2177
2182
|
const dropdownContentRef = useRef4(null);
|
|
@@ -2388,26 +2393,26 @@ var SearchApiRoot = ({
|
|
|
2388
2393
|
onClear
|
|
2389
2394
|
};
|
|
2390
2395
|
const hasChildren = !!children;
|
|
2391
|
-
return /* @__PURE__ */
|
|
2396
|
+
return /* @__PURE__ */ jsx22(SearchApiContext.Provider, { value: valueCtx, children: /* @__PURE__ */ jsxs16(
|
|
2392
2397
|
"div",
|
|
2393
2398
|
{
|
|
2394
2399
|
ref: containerRef,
|
|
2395
2400
|
className: `${label ? "space-y-2" : ""} group relative ${containerClassName}`,
|
|
2396
2401
|
children: [
|
|
2397
|
-
label && /* @__PURE__ */
|
|
2402
|
+
label && /* @__PURE__ */ jsxs16(
|
|
2398
2403
|
"label",
|
|
2399
2404
|
{
|
|
2400
2405
|
className: `block text-xs font-medium transition-colors duration-200`,
|
|
2401
2406
|
style: { color: isFocused || isOpen ? primaryColor : void 0 },
|
|
2402
2407
|
children: [
|
|
2403
2408
|
label,
|
|
2404
|
-
required && /* @__PURE__ */
|
|
2409
|
+
required && /* @__PURE__ */ jsx22("span", { className: "text-red-500 ml-1", children: "*" })
|
|
2405
2410
|
]
|
|
2406
2411
|
}
|
|
2407
2412
|
),
|
|
2408
|
-
hasChildren ? children : /* @__PURE__ */
|
|
2409
|
-
/* @__PURE__ */
|
|
2410
|
-
/* @__PURE__ */
|
|
2413
|
+
hasChildren ? children : /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
2414
|
+
/* @__PURE__ */ jsx22(SearchApiTrigger, { className, children: /* @__PURE__ */ jsx22(SearchApiInput, { ...props }) }),
|
|
2415
|
+
/* @__PURE__ */ jsx22(SearchApiContent, { children: filteredOptions.map((opt, index) => /* @__PURE__ */ jsx22(
|
|
2411
2416
|
SearchApiItem,
|
|
2412
2417
|
{
|
|
2413
2418
|
option: opt,
|
|
@@ -2437,7 +2442,7 @@ var SearchApiTrigger = forwardRef5(
|
|
|
2437
2442
|
inputRef,
|
|
2438
2443
|
searchTerm
|
|
2439
2444
|
} = useSearchApiContext();
|
|
2440
|
-
return /* @__PURE__ */
|
|
2445
|
+
return /* @__PURE__ */ jsx22("div", { className: "relative", ref: dropdownAnchorRef, children: /* @__PURE__ */ jsxs16(
|
|
2441
2446
|
"div",
|
|
2442
2447
|
{
|
|
2443
2448
|
className: `flex items-center w-full px-0 text-gray-900 dark:text-white transition-all duration-200 cursor-text py-1 ${variant === "ghost" ? "bg-transparent border-transparent shadow-none px-0 h-full" : isFocused || isOpen ? "ring-2 bg-white dark:bg-zinc-900 border rounded-xl h-9" : "border-gray-200 dark:border-zinc-800 border rounded-xl bg-white dark:bg-zinc-900/50 h-9"} ${className}`,
|
|
@@ -2454,25 +2459,25 @@ var SearchApiTrigger = forwardRef5(
|
|
|
2454
2459
|
},
|
|
2455
2460
|
...props,
|
|
2456
2461
|
children: [
|
|
2457
|
-
/* @__PURE__ */
|
|
2462
|
+
/* @__PURE__ */ jsx22(
|
|
2458
2463
|
"div",
|
|
2459
2464
|
{
|
|
2460
2465
|
className: `${variant === "ghost" ? "pl-0" : "pl-2.5"} text-gray-400`,
|
|
2461
|
-
children: /* @__PURE__ */
|
|
2466
|
+
children: /* @__PURE__ */ jsx22(Search, { className: "h-4 w-4" })
|
|
2462
2467
|
}
|
|
2463
2468
|
),
|
|
2464
|
-
/* @__PURE__ */
|
|
2465
|
-
/* @__PURE__ */
|
|
2466
|
-
selectedValue && !disabled && /* @__PURE__ */
|
|
2469
|
+
/* @__PURE__ */ jsx22("div", { className: "flex-1 relative ms-2", children }),
|
|
2470
|
+
/* @__PURE__ */ jsx22("div", { className: "pr-2.5 w-16! flex items-center gap-1 shrink-0 min-w-10 justify-end", children: isLoading ? /* @__PURE__ */ jsx22(Loader22, { className: "h-4 w-4 animate-spin text-blue-500 shrink-0" }) : /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
|
|
2471
|
+
selectedValue && !disabled && /* @__PURE__ */ jsx22(
|
|
2467
2472
|
"button",
|
|
2468
2473
|
{
|
|
2469
2474
|
onClick: clearSelection,
|
|
2470
2475
|
type: "button",
|
|
2471
2476
|
className: "p-0.5 hover:bg-gray-200 dark:hover:bg-zinc-700 rounded-full text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
|
|
2472
|
-
children: /* @__PURE__ */
|
|
2477
|
+
children: /* @__PURE__ */ jsx22(X2, { className: "h-3 w-3" })
|
|
2473
2478
|
}
|
|
2474
2479
|
),
|
|
2475
|
-
/* @__PURE__ */
|
|
2480
|
+
/* @__PURE__ */ jsx22(
|
|
2476
2481
|
ChevronDown3,
|
|
2477
2482
|
{
|
|
2478
2483
|
className: `h-4 w-4 text-gray-400 transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
@@ -2552,9 +2557,9 @@ var SearchApiInput = forwardRef5(
|
|
|
2552
2557
|
break;
|
|
2553
2558
|
}
|
|
2554
2559
|
};
|
|
2555
|
-
return /* @__PURE__ */
|
|
2556
|
-
!isOpen && (selectedValue !== void 0 && selectedValue !== null && selectedValue !== "") && /* @__PURE__ */
|
|
2557
|
-
/* @__PURE__ */
|
|
2560
|
+
return /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
2561
|
+
!isOpen && (selectedValue !== void 0 && selectedValue !== null && selectedValue !== "") && /* @__PURE__ */ jsx22("div", { className: "absolute inset-0 flex items-center ms-1 truncate select-none", children: getDisplayValue() }),
|
|
2562
|
+
/* @__PURE__ */ jsx22(
|
|
2558
2563
|
"input",
|
|
2559
2564
|
{
|
|
2560
2565
|
ref: setInternalInputRef,
|
|
@@ -2609,7 +2614,7 @@ var SearchApiContent = forwardRef5(
|
|
|
2609
2614
|
options,
|
|
2610
2615
|
error
|
|
2611
2616
|
} = useSearchApiContext();
|
|
2612
|
-
const [dropdownStyle, setDropdownStyle] =
|
|
2617
|
+
const [dropdownStyle, setDropdownStyle] = useState13({});
|
|
2613
2618
|
const updateDropdownPosition = () => {
|
|
2614
2619
|
if (dropdownAnchorRef.current) {
|
|
2615
2620
|
const rect = dropdownAnchorRef.current.getBoundingClientRect();
|
|
@@ -2640,7 +2645,7 @@ var SearchApiContent = forwardRef5(
|
|
|
2640
2645
|
}, [isOpen]);
|
|
2641
2646
|
if (!isOpen || typeof document === "undefined") return null;
|
|
2642
2647
|
return createPortal2(
|
|
2643
|
-
/* @__PURE__ */
|
|
2648
|
+
/* @__PURE__ */ jsxs16(
|
|
2644
2649
|
"div",
|
|
2645
2650
|
{
|
|
2646
2651
|
ref: dropdownContentRef,
|
|
@@ -2649,11 +2654,11 @@ var SearchApiContent = forwardRef5(
|
|
|
2649
2654
|
onMouseDown: (e) => e.stopPropagation(),
|
|
2650
2655
|
...props,
|
|
2651
2656
|
children: [
|
|
2652
|
-
error && /* @__PURE__ */
|
|
2653
|
-
isLoading && options.length === 0 ? /* @__PURE__ */
|
|
2654
|
-
/* @__PURE__ */
|
|
2657
|
+
error && /* @__PURE__ */ jsx22("div", { className: "px-3 py-2 text-sm text-red-600 dark:text-red-400 border-b border-gray-100 dark:border-zinc-800", children: error }),
|
|
2658
|
+
isLoading && options.length === 0 ? /* @__PURE__ */ jsxs16("div", { className: "p-4 text-center text-sm text-gray-500", children: [
|
|
2659
|
+
/* @__PURE__ */ jsx22(Loader22, { className: "h-5 w-5 animate-spin mx-auto mb-2" }),
|
|
2655
2660
|
"Loading options..."
|
|
2656
|
-
] }) : children ? /* @__PURE__ */
|
|
2661
|
+
] }) : children ? /* @__PURE__ */ jsx22("div", { className: "py-1", children }) : /* @__PURE__ */ jsx22("div", { className: "p-4 text-center text-sm text-gray-500", children: searchTerm ? `No results for "${searchTerm}"` : "No options available" })
|
|
2657
2662
|
]
|
|
2658
2663
|
}
|
|
2659
2664
|
),
|
|
@@ -2682,7 +2687,7 @@ var SearchApiItem = forwardRef5(
|
|
|
2682
2687
|
const optValue = getOptionValue(option);
|
|
2683
2688
|
const isSelected = selectedValue === optValue;
|
|
2684
2689
|
const isHighlighted = index === activeIndex;
|
|
2685
|
-
return /* @__PURE__ */
|
|
2690
|
+
return /* @__PURE__ */ jsxs16(
|
|
2686
2691
|
"button",
|
|
2687
2692
|
{
|
|
2688
2693
|
ref,
|
|
@@ -2701,8 +2706,8 @@ var SearchApiItem = forwardRef5(
|
|
|
2701
2706
|
onMouseEnter: () => setActiveIndex(index),
|
|
2702
2707
|
...props,
|
|
2703
2708
|
children: [
|
|
2704
|
-
/* @__PURE__ */
|
|
2705
|
-
isSelected && /* @__PURE__ */
|
|
2709
|
+
/* @__PURE__ */ jsx22("span", { className: "truncate", children: option[labelKey] }),
|
|
2710
|
+
isSelected && /* @__PURE__ */ jsx22(Check3, { className: "h-4 w-4", style: { color: primaryColor } })
|
|
2706
2711
|
]
|
|
2707
2712
|
},
|
|
2708
2713
|
optValue || index
|
|
@@ -2712,7 +2717,7 @@ var SearchApiItem = forwardRef5(
|
|
|
2712
2717
|
SearchApiItem.displayName = "SearchApiItem";
|
|
2713
2718
|
|
|
2714
2719
|
// src/components/Fields/date.tsx
|
|
2715
|
-
import { forwardRef as forwardRef6, useState as
|
|
2720
|
+
import { forwardRef as forwardRef6, useState as useState14 } from "react";
|
|
2716
2721
|
import { DatePicker } from "antd";
|
|
2717
2722
|
import {
|
|
2718
2723
|
Controller as Controller6
|
|
@@ -2720,7 +2725,7 @@ import {
|
|
|
2720
2725
|
import dayjs from "dayjs";
|
|
2721
2726
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
2722
2727
|
import { Calendar } from "lucide-react";
|
|
2723
|
-
import { jsx as
|
|
2728
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2724
2729
|
dayjs.extend(customParseFormat);
|
|
2725
2730
|
var DateInput = forwardRef6(
|
|
2726
2731
|
({
|
|
@@ -2739,7 +2744,7 @@ var DateInput = forwardRef6(
|
|
|
2739
2744
|
}, ref) => {
|
|
2740
2745
|
const { theme } = useWarqadConfig();
|
|
2741
2746
|
const primaryColor = theme?.primaryColor;
|
|
2742
|
-
const [isFocused, setIsFocused] =
|
|
2747
|
+
const [isFocused, setIsFocused] = useState14(false);
|
|
2743
2748
|
let message = error;
|
|
2744
2749
|
if (form && name) {
|
|
2745
2750
|
const {
|
|
@@ -2757,7 +2762,7 @@ var DateInput = forwardRef6(
|
|
|
2757
2762
|
${className}`;
|
|
2758
2763
|
const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
|
|
2759
2764
|
const dateValue = val && typeof val === "string" ? dayjs(val, "DD/MM/YYYY", true) : dayjs.isDayjs(val) ? val : null;
|
|
2760
|
-
return /* @__PURE__ */
|
|
2765
|
+
return /* @__PURE__ */ jsx23(
|
|
2761
2766
|
DatePicker,
|
|
2762
2767
|
{
|
|
2763
2768
|
ref: refProps,
|
|
@@ -2784,7 +2789,7 @@ var DateInput = forwardRef6(
|
|
|
2784
2789
|
boxShadow: isFocused && !message ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
2785
2790
|
},
|
|
2786
2791
|
classNames: { popup: { root: "z-50" } },
|
|
2787
|
-
suffixIcon: /* @__PURE__ */
|
|
2792
|
+
suffixIcon: /* @__PURE__ */ jsx23(
|
|
2788
2793
|
Calendar,
|
|
2789
2794
|
{
|
|
2790
2795
|
className: "h-5 w-5 text-gray-400",
|
|
@@ -2796,8 +2801,8 @@ var DateInput = forwardRef6(
|
|
|
2796
2801
|
}
|
|
2797
2802
|
);
|
|
2798
2803
|
};
|
|
2799
|
-
return /* @__PURE__ */
|
|
2800
|
-
label && /* @__PURE__ */
|
|
2804
|
+
return /* @__PURE__ */ jsxs17("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
2805
|
+
label && /* @__PURE__ */ jsxs17(
|
|
2801
2806
|
"label",
|
|
2802
2807
|
{
|
|
2803
2808
|
className: "block text-xs font-medium transition-colors duration-200",
|
|
@@ -2806,11 +2811,11 @@ var DateInput = forwardRef6(
|
|
|
2806
2811
|
},
|
|
2807
2812
|
children: [
|
|
2808
2813
|
label,
|
|
2809
|
-
props.required && /* @__PURE__ */
|
|
2814
|
+
props.required && /* @__PURE__ */ jsx23("span", { className: "text-red-500 ml-1", children: "*" })
|
|
2810
2815
|
]
|
|
2811
2816
|
}
|
|
2812
2817
|
),
|
|
2813
|
-
form && name ? /* @__PURE__ */
|
|
2818
|
+
form && name ? /* @__PURE__ */ jsx23(
|
|
2814
2819
|
Controller6,
|
|
2815
2820
|
{
|
|
2816
2821
|
control: form.control,
|
|
@@ -2823,7 +2828,7 @@ var DateInput = forwardRef6(
|
|
|
2823
2828
|
)
|
|
2824
2829
|
}
|
|
2825
2830
|
) : renderDatePicker(value, onChange, onBlur, ref),
|
|
2826
|
-
message && /* @__PURE__ */
|
|
2831
|
+
message && /* @__PURE__ */ jsx23("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
2827
2832
|
] });
|
|
2828
2833
|
}
|
|
2829
2834
|
);
|
|
@@ -2847,7 +2852,7 @@ var Fields = {
|
|
|
2847
2852
|
var Fields_default = Fields;
|
|
2848
2853
|
|
|
2849
2854
|
// src/components/tables/DataTable.tsx
|
|
2850
|
-
import React8, { useState as
|
|
2855
|
+
import React8, { useState as useState15, useMemo as useMemo3, useEffect as useEffect9 } from "react";
|
|
2851
2856
|
import {
|
|
2852
2857
|
useReactTable,
|
|
2853
2858
|
getCoreRowModel,
|
|
@@ -2858,7 +2863,7 @@ import {
|
|
|
2858
2863
|
flexRender
|
|
2859
2864
|
} from "@tanstack/react-table";
|
|
2860
2865
|
import { ChevronDown as ChevronDown4, Search as Search2 } from "lucide-react";
|
|
2861
|
-
import { Fragment as
|
|
2866
|
+
import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2862
2867
|
function DataTable({
|
|
2863
2868
|
columns: userColumns,
|
|
2864
2869
|
data,
|
|
@@ -2880,9 +2885,9 @@ function DataTable({
|
|
|
2880
2885
|
}) {
|
|
2881
2886
|
const { theme } = useWarqadConfig();
|
|
2882
2887
|
const primaryColor = theme?.primaryColor;
|
|
2883
|
-
const [sorting, setSorting] =
|
|
2884
|
-
const [columnFilters, setColumnFilters] =
|
|
2885
|
-
const [columnVisibility, setColumnVisibility] =
|
|
2888
|
+
const [sorting, setSorting] = useState15([]);
|
|
2889
|
+
const [columnFilters, setColumnFilters] = useState15([]);
|
|
2890
|
+
const [columnVisibility, setColumnVisibility] = useState15(
|
|
2886
2891
|
() => {
|
|
2887
2892
|
const initialVisibility = {};
|
|
2888
2893
|
userColumns.forEach((col) => {
|
|
@@ -2896,9 +2901,9 @@ function DataTable({
|
|
|
2896
2901
|
return initialVisibility;
|
|
2897
2902
|
}
|
|
2898
2903
|
);
|
|
2899
|
-
const [rowSelection, setRowSelection] =
|
|
2900
|
-
const [globalFilter, setGlobalFilter] =
|
|
2901
|
-
const [pagination, setPagination] =
|
|
2904
|
+
const [rowSelection, setRowSelection] = useState15({});
|
|
2905
|
+
const [globalFilter, setGlobalFilter] = useState15("");
|
|
2906
|
+
const [pagination, setPagination] = useState15({
|
|
2902
2907
|
pageIndex: 0,
|
|
2903
2908
|
pageSize: pageRows || 10
|
|
2904
2909
|
});
|
|
@@ -2907,7 +2912,7 @@ function DataTable({
|
|
|
2907
2912
|
setPagination((prev) => ({ ...prev, pageSize: pageRows }));
|
|
2908
2913
|
}
|
|
2909
2914
|
}, [pageRows]);
|
|
2910
|
-
const [expanded, setExpanded] =
|
|
2915
|
+
const [expanded, setExpanded] = useState15(() => {
|
|
2911
2916
|
const initialState = {};
|
|
2912
2917
|
if (defaultExpanded && renderSubComponent && data) {
|
|
2913
2918
|
data.forEach((row, idx) => {
|
|
@@ -2934,7 +2939,7 @@ function DataTable({
|
|
|
2934
2939
|
{
|
|
2935
2940
|
id: "_index",
|
|
2936
2941
|
header: "#",
|
|
2937
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
2942
|
+
cell: ({ row }) => /* @__PURE__ */ jsx24("span", { className: "text-gray-500 font-medium ml-1", children: row.index + 1 }),
|
|
2938
2943
|
enableSorting: false
|
|
2939
2944
|
},
|
|
2940
2945
|
...mappedColumns
|
|
@@ -2993,29 +2998,29 @@ function DataTable({
|
|
|
2993
2998
|
table.getState().pagination.pageIndex,
|
|
2994
2999
|
table.getState().pagination.pageSize
|
|
2995
3000
|
]);
|
|
2996
|
-
return /* @__PURE__ */
|
|
2997
|
-
filterables && /* @__PURE__ */
|
|
2998
|
-
/* @__PURE__ */
|
|
3001
|
+
return /* @__PURE__ */ jsxs18("div", { className: `space-y-4 w-full ${className}`, children: [
|
|
3002
|
+
filterables && /* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3003
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 max-w-sm", children: /* @__PURE__ */ jsx24(
|
|
2999
3004
|
Fields_default.Input,
|
|
3000
3005
|
{
|
|
3001
3006
|
placeholder: searchPlaceholder,
|
|
3002
3007
|
value: globalFilter,
|
|
3003
3008
|
onChange: (e) => setGlobalFilter(e.target.value),
|
|
3004
|
-
icon: /* @__PURE__ */
|
|
3009
|
+
icon: /* @__PURE__ */ jsx24(Search2, { size: 16 }),
|
|
3005
3010
|
className: "h-9!"
|
|
3006
3011
|
}
|
|
3007
3012
|
) }),
|
|
3008
|
-
/* @__PURE__ */
|
|
3009
|
-
/* @__PURE__ */
|
|
3013
|
+
/* @__PURE__ */ jsx24("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs18("div", { className: "relative group", children: [
|
|
3014
|
+
/* @__PURE__ */ jsxs18("button", { className: "flex items-center gap-2 px-3 h-9 rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-zinc-800 transition-colors", children: [
|
|
3010
3015
|
"Columns",
|
|
3011
|
-
/* @__PURE__ */
|
|
3016
|
+
/* @__PURE__ */ jsx24(ChevronDown4, { size: 14, className: "text-gray-400" })
|
|
3012
3017
|
] }),
|
|
3013
|
-
/* @__PURE__ */
|
|
3018
|
+
/* @__PURE__ */ jsx24("div", { className: "absolute right-0 top-full mt-2 w-48 py-1 bg-white dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 rounded-lg shadow-xl opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-50", children: table.getAllColumns().filter((column) => column.getCanHide()).map((column) => /* @__PURE__ */ jsxs18(
|
|
3014
3019
|
"label",
|
|
3015
3020
|
{
|
|
3016
3021
|
className: "flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-zinc-800 cursor-pointer capitalize",
|
|
3017
3022
|
children: [
|
|
3018
|
-
/* @__PURE__ */
|
|
3023
|
+
/* @__PURE__ */ jsx24(
|
|
3019
3024
|
"input",
|
|
3020
3025
|
{
|
|
3021
3026
|
type: "checkbox",
|
|
@@ -3032,13 +3037,13 @@ function DataTable({
|
|
|
3032
3037
|
)) })
|
|
3033
3038
|
] }) })
|
|
3034
3039
|
] }),
|
|
3035
|
-
/* @__PURE__ */
|
|
3040
|
+
/* @__PURE__ */ jsx24("div", { className: "rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 overflow-hidden relative", children: /* @__PURE__ */ jsx24("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs18(
|
|
3036
3041
|
"table",
|
|
3037
3042
|
{
|
|
3038
3043
|
className: "w-full text-left border-collapse",
|
|
3039
3044
|
style: { accentColor: primaryColor },
|
|
3040
3045
|
children: [
|
|
3041
|
-
/* @__PURE__ */
|
|
3046
|
+
/* @__PURE__ */ jsx24("thead", { className: "bg-gray-50/50 dark:bg-zinc-900/50 border-b border-gray-200 dark:border-zinc-800", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx24("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx24(
|
|
3042
3047
|
"th",
|
|
3043
3048
|
{
|
|
3044
3049
|
className: `${rowPadding} text-sm font-semibold text-gray-900 dark:text-zinc-100 text-left ${verticalLines ? "border-x border-gray-200 dark:border-zinc-800" : ""} ${header.id === "_index" || header.id === "select" || header.id === "_select" ? "w-px whitespace-nowrap" : ""}`,
|
|
@@ -3049,22 +3054,22 @@ function DataTable({
|
|
|
3049
3054
|
},
|
|
3050
3055
|
header.id
|
|
3051
3056
|
)) }, headerGroup.id)) }),
|
|
3052
|
-
/* @__PURE__ */
|
|
3057
|
+
/* @__PURE__ */ jsx24("tbody", { className: "", children: isLoading ? Array.from({ length: pageRows || 5 }).map((_, i) => /* @__PURE__ */ jsx24(
|
|
3053
3058
|
"tr",
|
|
3054
3059
|
{
|
|
3055
3060
|
className: "border-b border-gray-100 dark:border-zinc-800/50",
|
|
3056
|
-
children: columns.map((_2, j) => /* @__PURE__ */
|
|
3061
|
+
children: columns.map((_2, j) => /* @__PURE__ */ jsx24(
|
|
3057
3062
|
"td",
|
|
3058
3063
|
{
|
|
3059
3064
|
className: `${rowPadding} ${verticalLines ? "border-x border-gray-200 dark:border-zinc-800/50" : ""}`,
|
|
3060
|
-
children: /* @__PURE__ */
|
|
3065
|
+
children: /* @__PURE__ */ jsx24("div", { className: "h-4 bg-gray-100 dark:bg-zinc-800 rounded animate-pulse w-full" })
|
|
3061
3066
|
},
|
|
3062
3067
|
`skeleton-cell-${j}`
|
|
3063
3068
|
))
|
|
3064
3069
|
},
|
|
3065
3070
|
`skeleton-${i}`
|
|
3066
|
-
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */
|
|
3067
|
-
/* @__PURE__ */
|
|
3071
|
+
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxs18(React8.Fragment, { children: [
|
|
3072
|
+
/* @__PURE__ */ jsx24(
|
|
3068
3073
|
"tr",
|
|
3069
3074
|
{
|
|
3070
3075
|
className: `border-b border-gray-200 dark:border-zinc-800 hover:bg-gray-50/50 dark:hover:bg-zinc-900/50 transition-colors last:border-b-0 ${renderSubComponent && hasSubComponent(row.original) ? "cursor-pointer" : ""}`,
|
|
@@ -3079,7 +3084,7 @@ function DataTable({
|
|
|
3079
3084
|
}
|
|
3080
3085
|
}
|
|
3081
3086
|
},
|
|
3082
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */
|
|
3087
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx24(
|
|
3083
3088
|
"td",
|
|
3084
3089
|
{
|
|
3085
3090
|
className: `${rowPadding} text-sm text-gray-700 dark:text-gray-200 ${verticalLines ? "border-x border-gray-200 dark:border-zinc-800" : ""} ${cell.column.id === "_index" || cell.column.id === "select" || cell.column.id === "_select" ? "w-px whitespace-nowrap" : ""}`,
|
|
@@ -3092,14 +3097,14 @@ function DataTable({
|
|
|
3092
3097
|
))
|
|
3093
3098
|
}
|
|
3094
3099
|
),
|
|
3095
|
-
renderSubComponent && row.getIsExpanded() && hasSubComponent(row.original) && /* @__PURE__ */
|
|
3096
|
-
/* @__PURE__ */
|
|
3100
|
+
renderSubComponent && row.getIsExpanded() && hasSubComponent(row.original) && /* @__PURE__ */ jsx24("tr", { className: "border-b border-gray-200 dark:border-zinc-800 bg-gray-50/20 dark:bg-zinc-900/20", children: /* @__PURE__ */ jsx24("td", { colSpan: columns.length, className: "px-2 py-0", children: /* @__PURE__ */ jsxs18("div", { className: "relative pl-6 pb-2 pr-2 pt-2 h-full", children: [
|
|
3101
|
+
/* @__PURE__ */ jsx24("div", { className: "absolute left-2 top-0 bottom-2 w-6 border-l-2 border-b-2 rounded-bl-xl border-(--theme-primary) dark:border-(--theme-primary) pointer-events-none" }),
|
|
3097
3102
|
renderSubComponent({
|
|
3098
3103
|
row: row.original,
|
|
3099
3104
|
index: row.index
|
|
3100
3105
|
})
|
|
3101
3106
|
] }) }) })
|
|
3102
|
-
] }, row.id)) : /* @__PURE__ */
|
|
3107
|
+
] }, row.id)) : /* @__PURE__ */ jsx24("tr", { children: /* @__PURE__ */ jsx24(
|
|
3103
3108
|
"td",
|
|
3104
3109
|
{
|
|
3105
3110
|
colSpan: columns.length,
|
|
@@ -3111,7 +3116,7 @@ function DataTable({
|
|
|
3111
3116
|
(group) => group.headers.some(
|
|
3112
3117
|
(header) => header.column.columnDef.footer
|
|
3113
3118
|
)
|
|
3114
|
-
) && /* @__PURE__ */
|
|
3119
|
+
) && /* @__PURE__ */ jsx24("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-900/50 border-t border-gray-200 dark:border-zinc-800", children: table.getFooterGroups().map((footerGroup) => /* @__PURE__ */ jsx24("tr", { children: footerGroup.headers.map((header) => /* @__PURE__ */ jsx24(
|
|
3115
3120
|
"td",
|
|
3116
3121
|
{
|
|
3117
3122
|
className: `${rowPadding} text-sm font-semibold text-gray-900 dark:text-zinc-100 text-left ${verticalLines ? "border-x border-gray-200 dark:border-zinc-800" : ""} ${header.id === "_index" || header.id === "select" || header.id === "_select" ? "w-px whitespace-nowrap" : ""}`,
|
|
@@ -3125,24 +3130,24 @@ function DataTable({
|
|
|
3125
3130
|
]
|
|
3126
3131
|
}
|
|
3127
3132
|
) }) }),
|
|
3128
|
-
/* @__PURE__ */
|
|
3129
|
-
/* @__PURE__ */
|
|
3133
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between px-2", children: [
|
|
3134
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 text-xs text-gray-500", children: selectable && /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
3130
3135
|
table.getFilteredSelectedRowModel().rows.length,
|
|
3131
3136
|
" of",
|
|
3132
3137
|
" ",
|
|
3133
3138
|
table.getFilteredRowModel().rows.length,
|
|
3134
3139
|
" row(s) selected."
|
|
3135
3140
|
] }) }),
|
|
3136
|
-
pageRows && table.getPageCount() > 1 && /* @__PURE__ */
|
|
3137
|
-
/* @__PURE__ */
|
|
3141
|
+
pageRows && table.getPageCount() > 1 && /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
3142
|
+
/* @__PURE__ */ jsxs18("span", { className: "text-sm text-gray-700 dark:text-gray-300 mr-2 select-none", children: [
|
|
3138
3143
|
"Page",
|
|
3139
3144
|
" ",
|
|
3140
|
-
/* @__PURE__ */
|
|
3145
|
+
/* @__PURE__ */ jsx24("span", { className: "font-semibold", children: table.getState().pagination.pageIndex + 1 }),
|
|
3141
3146
|
" ",
|
|
3142
3147
|
"of ",
|
|
3143
|
-
/* @__PURE__ */
|
|
3148
|
+
/* @__PURE__ */ jsx24("span", { className: "font-semibold", children: table.getPageCount() })
|
|
3144
3149
|
] }),
|
|
3145
|
-
/* @__PURE__ */
|
|
3150
|
+
/* @__PURE__ */ jsx24(
|
|
3146
3151
|
"button",
|
|
3147
3152
|
{
|
|
3148
3153
|
onClick: () => table.previousPage(),
|
|
@@ -3151,7 +3156,7 @@ function DataTable({
|
|
|
3151
3156
|
children: "Previous"
|
|
3152
3157
|
}
|
|
3153
3158
|
),
|
|
3154
|
-
/* @__PURE__ */
|
|
3159
|
+
/* @__PURE__ */ jsx24(
|
|
3155
3160
|
"button",
|
|
3156
3161
|
{
|
|
3157
3162
|
onClick: () => table.nextPage(),
|
|
@@ -3167,7 +3172,7 @@ function DataTable({
|
|
|
3167
3172
|
|
|
3168
3173
|
// src/components/tables/PostTable.tsx
|
|
3169
3174
|
import React9, {
|
|
3170
|
-
useState as
|
|
3175
|
+
useState as useState16,
|
|
3171
3176
|
useMemo as useMemo4,
|
|
3172
3177
|
useEffect as useEffect10,
|
|
3173
3178
|
useRef as useRef5,
|
|
@@ -3190,14 +3195,14 @@ import {
|
|
|
3190
3195
|
ChevronDown as ChevronDown5,
|
|
3191
3196
|
Loader2 as Loader23
|
|
3192
3197
|
} from "lucide-react";
|
|
3193
|
-
import { Fragment as
|
|
3198
|
+
import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3194
3199
|
var TableCell = React9.memo(
|
|
3195
3200
|
({
|
|
3196
3201
|
cell,
|
|
3197
3202
|
rowPadding,
|
|
3198
3203
|
verticalLines
|
|
3199
3204
|
}) => {
|
|
3200
|
-
return /* @__PURE__ */
|
|
3205
|
+
return /* @__PURE__ */ jsx25(
|
|
3201
3206
|
"td",
|
|
3202
3207
|
{
|
|
3203
3208
|
className: cn(
|
|
@@ -3232,8 +3237,8 @@ var TableRow = React9.memo(
|
|
|
3232
3237
|
}) => {
|
|
3233
3238
|
const isExpanded = row.getIsExpanded();
|
|
3234
3239
|
const subComponentVisible = renderSubComponent && isExpanded && hasSubComponent(row.original);
|
|
3235
|
-
return /* @__PURE__ */
|
|
3236
|
-
/* @__PURE__ */
|
|
3240
|
+
return /* @__PURE__ */ jsxs19(React9.Fragment, { children: [
|
|
3241
|
+
/* @__PURE__ */ jsx25(
|
|
3237
3242
|
"tr",
|
|
3238
3243
|
{
|
|
3239
3244
|
className: `border-b border-gray-200 dark:border-zinc-800 hover:bg-gray-50/50 dark:hover:bg-zinc-900/50 transition-colors last:border-b-0 ${renderSubComponent && hasSubComponent(row.original) ? "cursor-pointer" : ""}`,
|
|
@@ -3246,7 +3251,7 @@ var TableRow = React9.memo(
|
|
|
3246
3251
|
}
|
|
3247
3252
|
}
|
|
3248
3253
|
},
|
|
3249
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */
|
|
3254
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx25(
|
|
3250
3255
|
TableCell,
|
|
3251
3256
|
{
|
|
3252
3257
|
cell,
|
|
@@ -3257,8 +3262,8 @@ var TableRow = React9.memo(
|
|
|
3257
3262
|
))
|
|
3258
3263
|
}
|
|
3259
3264
|
),
|
|
3260
|
-
subComponentVisible && /* @__PURE__ */
|
|
3261
|
-
/* @__PURE__ */
|
|
3265
|
+
subComponentVisible && /* @__PURE__ */ jsx25("tr", { className: "border-b border-gray-200 dark:border-zinc-800 bg-gray-50/20 dark:bg-zinc-900/20", children: /* @__PURE__ */ jsx25("td", { colSpan: columnsCount, className: "px-2 py-0", children: /* @__PURE__ */ jsxs19("div", { className: "relative pl-6 pb-2 pr-2 pt-2 h-full", children: [
|
|
3266
|
+
/* @__PURE__ */ jsx25("div", { className: "absolute left-2 top-0 bottom-2 w-6 border-l-2 border-b-2 rounded-bl-xl border-(--theme-primary) dark:border-(--theme-primary) pointer-events-none" }),
|
|
3262
3267
|
renderSubComponent({
|
|
3263
3268
|
row: row.original,
|
|
3264
3269
|
index: row.index
|
|
@@ -3291,10 +3296,10 @@ function PostTable({
|
|
|
3291
3296
|
}) {
|
|
3292
3297
|
const { theme } = useWarqadConfig();
|
|
3293
3298
|
const primaryColor = theme?.primaryColor;
|
|
3294
|
-
const [sorting, setSorting] =
|
|
3295
|
-
const [columnFilters, setColumnFilters] =
|
|
3296
|
-
const [columnVisibility, setColumnVisibility] =
|
|
3297
|
-
const [expanded, setExpanded] =
|
|
3299
|
+
const [sorting, setSorting] = useState16([]);
|
|
3300
|
+
const [columnFilters, setColumnFilters] = useState16([]);
|
|
3301
|
+
const [columnVisibility, setColumnVisibility] = useState16({});
|
|
3302
|
+
const [expanded, setExpanded] = useState16(() => {
|
|
3298
3303
|
const initialState = {};
|
|
3299
3304
|
if (defaultExpanded && renderSubComponent && controlledData) {
|
|
3300
3305
|
controlledData.forEach((row, idx) => {
|
|
@@ -3305,7 +3310,7 @@ function PostTable({
|
|
|
3305
3310
|
}
|
|
3306
3311
|
return initialState;
|
|
3307
3312
|
});
|
|
3308
|
-
const [internalData, setInternalData] =
|
|
3313
|
+
const [internalData, setInternalData] = useState16(controlledData || []);
|
|
3309
3314
|
const isControlled = controlledData !== void 0;
|
|
3310
3315
|
const data = isControlled ? controlledData : internalData;
|
|
3311
3316
|
const entryRowRef = useRef5(null);
|
|
@@ -3328,10 +3333,10 @@ function PostTable({
|
|
|
3328
3333
|
useEffect10(() => {
|
|
3329
3334
|
focusAndScrollEntryRow();
|
|
3330
3335
|
}, []);
|
|
3331
|
-
const [entryData, setEntryData] =
|
|
3332
|
-
const [editingIndex, setEditingIndex] =
|
|
3333
|
-
const [isSavingAsync, setIsSavingAsync] =
|
|
3334
|
-
const [fieldErrors, setFieldErrors] =
|
|
3336
|
+
const [entryData, setEntryData] = useState16({});
|
|
3337
|
+
const [editingIndex, setEditingIndex] = useState16(null);
|
|
3338
|
+
const [isSavingAsync, setIsSavingAsync] = useState16(false);
|
|
3339
|
+
const [fieldErrors, setFieldErrors] = useState16({});
|
|
3335
3340
|
const latestStateRef = useRef5({
|
|
3336
3341
|
data,
|
|
3337
3342
|
entryData,
|
|
@@ -3498,25 +3503,25 @@ function PostTable({
|
|
|
3498
3503
|
header: "Actions",
|
|
3499
3504
|
cell: ({ row, table: table2 }) => {
|
|
3500
3505
|
const { handleEdit: handleEdit2, handleDelete: handleDelete2, submitLoading: submitLoading2, isSavingAsync: isSavingAsync2 } = table2.options.meta;
|
|
3501
|
-
return /* @__PURE__ */
|
|
3502
|
-
/* @__PURE__ */
|
|
3506
|
+
return /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2", children: [
|
|
3507
|
+
/* @__PURE__ */ jsx25(
|
|
3503
3508
|
"button",
|
|
3504
3509
|
{
|
|
3505
3510
|
onClick: () => handleEdit2(row.index, row.original),
|
|
3506
3511
|
disabled: submitLoading2 || isSavingAsync2,
|
|
3507
3512
|
className: "p-1 px-2 rounded-md hover:bg-gray-100 dark:hover:bg-zinc-800 text-gray-500 hover:text-(--theme-primary) dark:hover:text-(--theme-primary) transition-colors disabled:opacity-50",
|
|
3508
3513
|
title: "Edit",
|
|
3509
|
-
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */
|
|
3514
|
+
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */ jsx25(Loader23, { size: 16, className: "animate-spin" }) : /* @__PURE__ */ jsx25(Edit2, { size: 16 })
|
|
3510
3515
|
}
|
|
3511
3516
|
),
|
|
3512
|
-
/* @__PURE__ */
|
|
3517
|
+
/* @__PURE__ */ jsx25(
|
|
3513
3518
|
"button",
|
|
3514
3519
|
{
|
|
3515
3520
|
onClick: () => handleDelete2(row.index),
|
|
3516
3521
|
disabled: submitLoading2 || isSavingAsync2,
|
|
3517
3522
|
className: "p-1 px-2 rounded-md hover:bg-gray-100 dark:hover:bg-zinc-800 text-gray-500 hover:text-red-600 dark:hover:text-red-400 transition-colors disabled:opacity-50",
|
|
3518
3523
|
title: "Delete",
|
|
3519
|
-
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */
|
|
3524
|
+
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */ jsx25(Loader23, { size: 16, className: "animate-spin" }) : /* @__PURE__ */ jsx25(Trash2, { size: 16 })
|
|
3520
3525
|
}
|
|
3521
3526
|
)
|
|
3522
3527
|
] });
|
|
@@ -3538,9 +3543,9 @@ function PostTable({
|
|
|
3538
3543
|
size: 40,
|
|
3539
3544
|
minSize: 40,
|
|
3540
3545
|
maxSize: 40,
|
|
3541
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3542
|
-
/* @__PURE__ */
|
|
3543
|
-
renderSubComponent && hasSubComponent(row.original) && /* @__PURE__ */
|
|
3546
|
+
cell: ({ row }) => /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2", children: [
|
|
3547
|
+
/* @__PURE__ */ jsx25("span", { className: "text-gray-500 font-medium ml-1", children: row.index + 1 }),
|
|
3548
|
+
renderSubComponent && hasSubComponent(row.original) && /* @__PURE__ */ jsx25(
|
|
3544
3549
|
ChevronDown5,
|
|
3545
3550
|
{
|
|
3546
3551
|
size: 16,
|
|
@@ -3550,7 +3555,7 @@ function PostTable({
|
|
|
3550
3555
|
] }),
|
|
3551
3556
|
enableSorting: false,
|
|
3552
3557
|
meta: {
|
|
3553
|
-
field: () => /* @__PURE__ */
|
|
3558
|
+
field: () => /* @__PURE__ */ jsx25("span", { className: "text-gray-400 font-medium px-2 block select-none", children: "#" })
|
|
3554
3559
|
}
|
|
3555
3560
|
});
|
|
3556
3561
|
}
|
|
@@ -3580,13 +3585,13 @@ function PostTable({
|
|
|
3580
3585
|
isSavingAsync
|
|
3581
3586
|
}
|
|
3582
3587
|
});
|
|
3583
|
-
return /* @__PURE__ */
|
|
3588
|
+
return /* @__PURE__ */ jsx25(
|
|
3584
3589
|
"div",
|
|
3585
3590
|
{
|
|
3586
3591
|
className: `space-y-4 w-full ${className}`,
|
|
3587
3592
|
style: { "--theme-primary": primaryColor || "#3b82f6" },
|
|
3588
|
-
children: /* @__PURE__ */
|
|
3589
|
-
/* @__PURE__ */
|
|
3593
|
+
children: /* @__PURE__ */ jsx25("div", { className: "rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 relative", children: /* @__PURE__ */ jsx25("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs19("table", { className: "w-full text-left border-collapse", children: [
|
|
3594
|
+
/* @__PURE__ */ jsx25("thead", { className: "bg-gray-50/50 dark:bg-zinc-900/50 border-b border-gray-200 dark:border-zinc-800", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx25("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx25(
|
|
3590
3595
|
"th",
|
|
3591
3596
|
{
|
|
3592
3597
|
className: cn(
|
|
@@ -3608,12 +3613,12 @@ function PostTable({
|
|
|
3608
3613
|
},
|
|
3609
3614
|
header.id
|
|
3610
3615
|
)) }, headerGroup.id)) }),
|
|
3611
|
-
/* @__PURE__ */
|
|
3612
|
-
isLoading ? Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ jsxs19("tbody", { className: "", children: [
|
|
3617
|
+
isLoading ? Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx25(
|
|
3613
3618
|
"tr",
|
|
3614
3619
|
{
|
|
3615
3620
|
className: "border-b border-gray-100 dark:border-zinc-800/50",
|
|
3616
|
-
children: columns.map((col, j) => /* @__PURE__ */
|
|
3621
|
+
children: columns.map((col, j) => /* @__PURE__ */ jsx25(
|
|
3617
3622
|
"td",
|
|
3618
3623
|
{
|
|
3619
3624
|
className: cn(
|
|
@@ -3626,13 +3631,13 @@ function PostTable({
|
|
|
3626
3631
|
minWidth: col.meta?.width ?? col.minSize,
|
|
3627
3632
|
maxWidth: col.meta?.width ?? col.maxSize
|
|
3628
3633
|
},
|
|
3629
|
-
children: /* @__PURE__ */
|
|
3634
|
+
children: /* @__PURE__ */ jsx25("div", { className: "h-4 bg-gray-100 dark:bg-zinc-800 rounded animate-pulse w-full" })
|
|
3630
3635
|
},
|
|
3631
3636
|
`skeleton-cell-${j}`
|
|
3632
3637
|
))
|
|
3633
3638
|
},
|
|
3634
3639
|
`skeleton-${i}`
|
|
3635
|
-
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */
|
|
3640
|
+
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx25(
|
|
3636
3641
|
TableRow,
|
|
3637
3642
|
{
|
|
3638
3643
|
row,
|
|
@@ -3643,7 +3648,7 @@ function PostTable({
|
|
|
3643
3648
|
columnsCount: columns.length
|
|
3644
3649
|
},
|
|
3645
3650
|
row.id
|
|
3646
|
-
)) : /* @__PURE__ */
|
|
3651
|
+
)) : /* @__PURE__ */ jsx25("tr", { children: /* @__PURE__ */ jsx25(
|
|
3647
3652
|
"td",
|
|
3648
3653
|
{
|
|
3649
3654
|
colSpan: columns.length,
|
|
@@ -3651,7 +3656,7 @@ function PostTable({
|
|
|
3651
3656
|
children: "No results found."
|
|
3652
3657
|
}
|
|
3653
3658
|
) }),
|
|
3654
|
-
/* @__PURE__ */
|
|
3659
|
+
/* @__PURE__ */ jsx25(
|
|
3655
3660
|
"tr",
|
|
3656
3661
|
{
|
|
3657
3662
|
ref: entryRowRef,
|
|
@@ -3666,7 +3671,7 @@ function PostTable({
|
|
|
3666
3671
|
return visibleColumns.map((column) => {
|
|
3667
3672
|
const currentId = column.id || column.columnDef.accessorKey;
|
|
3668
3673
|
if (column.id === "actions") {
|
|
3669
|
-
return /* @__PURE__ */
|
|
3674
|
+
return /* @__PURE__ */ jsx25(
|
|
3670
3675
|
"td",
|
|
3671
3676
|
{
|
|
3672
3677
|
className: cn(
|
|
@@ -3674,38 +3679,38 @@ function PostTable({
|
|
|
3674
3679
|
"py-1! text-sm align-middle transition-colors duration-200",
|
|
3675
3680
|
verticalLines ? "border-x border-gray-200 dark:border-zinc-800" : ""
|
|
3676
3681
|
),
|
|
3677
|
-
children: /* @__PURE__ */
|
|
3678
|
-
/* @__PURE__ */
|
|
3682
|
+
children: /* @__PURE__ */ jsx25("div", { className: "flex items-center gap-2", children: editingIndex !== null ? /* @__PURE__ */ jsxs19(Fragment7, { children: [
|
|
3683
|
+
/* @__PURE__ */ jsx25(
|
|
3679
3684
|
"button",
|
|
3680
3685
|
{
|
|
3681
3686
|
onClick: handleSaveField,
|
|
3682
3687
|
disabled: isSavingAsync || submitLoading,
|
|
3683
3688
|
className: "flex-1 h-8 flex items-center justify-center rounded-lg bg-green-500/10 text-green-600 dark:bg-emerald-500/20 dark:text-emerald-400 hover:bg-green-500 hover:text-white dark:hover:bg-emerald-500 transition-colors shadow-sm active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
3684
3689
|
title: "Update",
|
|
3685
|
-
children: isSavingAsync || submitLoading ? /* @__PURE__ */
|
|
3690
|
+
children: isSavingAsync || submitLoading ? /* @__PURE__ */ jsx25(
|
|
3686
3691
|
Loader23,
|
|
3687
3692
|
{
|
|
3688
3693
|
size: 16,
|
|
3689
3694
|
className: "animate-spin"
|
|
3690
3695
|
}
|
|
3691
|
-
) : /* @__PURE__ */
|
|
3696
|
+
) : /* @__PURE__ */ jsx25(Check4, { size: 16, strokeWidth: 2.5 })
|
|
3692
3697
|
}
|
|
3693
3698
|
),
|
|
3694
|
-
/* @__PURE__ */
|
|
3699
|
+
/* @__PURE__ */ jsx25(
|
|
3695
3700
|
"button",
|
|
3696
3701
|
{
|
|
3697
3702
|
onClick: handleCancelEdit,
|
|
3698
3703
|
disabled: isSavingAsync || submitLoading,
|
|
3699
3704
|
className: "flex-1 h-8 flex items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:bg-red-500/20 dark:text-red-400 hover:bg-red-500 hover:text-white dark:hover:bg-red-500 transition-colors shadow-sm active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
3700
3705
|
title: "Cancel",
|
|
3701
|
-
children: /* @__PURE__ */
|
|
3706
|
+
children: /* @__PURE__ */ jsx25(X3, { size: 16, strokeWidth: 2.5 })
|
|
3702
3707
|
}
|
|
3703
3708
|
)
|
|
3704
|
-
] }) : /* @__PURE__ */
|
|
3709
|
+
] }) : /* @__PURE__ */ jsx25(Fragment7, { children: renderAddButton ? renderAddButton(
|
|
3705
3710
|
entryData,
|
|
3706
3711
|
handleSaveField,
|
|
3707
3712
|
isSavingAsync
|
|
3708
|
-
) : /* @__PURE__ */
|
|
3713
|
+
) : /* @__PURE__ */ jsxs19(
|
|
3709
3714
|
"button",
|
|
3710
3715
|
{
|
|
3711
3716
|
onClick: handleSaveField,
|
|
@@ -3716,14 +3721,14 @@ function PostTable({
|
|
|
3716
3721
|
},
|
|
3717
3722
|
title: "Add Row",
|
|
3718
3723
|
children: [
|
|
3719
|
-
isSavingAsync || submitLoading ? /* @__PURE__ */
|
|
3724
|
+
isSavingAsync || submitLoading ? /* @__PURE__ */ jsx25(
|
|
3720
3725
|
Loader23,
|
|
3721
3726
|
{
|
|
3722
3727
|
size: 14,
|
|
3723
3728
|
className: "animate-spin"
|
|
3724
3729
|
}
|
|
3725
|
-
) : /* @__PURE__ */
|
|
3726
|
-
/* @__PURE__ */
|
|
3730
|
+
) : /* @__PURE__ */ jsx25(Plus, { size: 14, strokeWidth: 2.5 }),
|
|
3731
|
+
/* @__PURE__ */ jsx25("span", { children: isSavingAsync || submitLoading ? "Adding..." : "Add" })
|
|
3727
3732
|
]
|
|
3728
3733
|
}
|
|
3729
3734
|
) }) })
|
|
@@ -3749,7 +3754,7 @@ function PostTable({
|
|
|
3749
3754
|
});
|
|
3750
3755
|
}
|
|
3751
3756
|
};
|
|
3752
|
-
return /* @__PURE__ */
|
|
3757
|
+
return /* @__PURE__ */ jsx25(
|
|
3753
3758
|
"td",
|
|
3754
3759
|
{
|
|
3755
3760
|
"data-column-id": column.id,
|
|
@@ -3775,7 +3780,7 @@ function PostTable({
|
|
|
3775
3780
|
minWidth: column.columnDef.meta?.width ?? column.columnDef.minSize,
|
|
3776
3781
|
maxWidth: column.columnDef.meta?.width ?? column.columnDef.maxSize
|
|
3777
3782
|
},
|
|
3778
|
-
children: /* @__PURE__ */
|
|
3783
|
+
children: /* @__PURE__ */ jsxs19(
|
|
3779
3784
|
"div",
|
|
3780
3785
|
{
|
|
3781
3786
|
className: cn(
|
|
@@ -3806,7 +3811,7 @@ function PostTable({
|
|
|
3806
3811
|
onChange: onChangeValue,
|
|
3807
3812
|
rowData: entryData,
|
|
3808
3813
|
setRowData: setEntryData
|
|
3809
|
-
}) : /* @__PURE__ */
|
|
3814
|
+
}) : /* @__PURE__ */ jsx25(
|
|
3810
3815
|
Fields_default.Input,
|
|
3811
3816
|
{
|
|
3812
3817
|
id: `pti-${accessor}`,
|
|
@@ -3818,7 +3823,7 @@ function PostTable({
|
|
|
3818
3823
|
placeholder: `${typeof column.columnDef.header === "string" ? column.columnDef.header : column.id}`
|
|
3819
3824
|
}
|
|
3820
3825
|
),
|
|
3821
|
-
typeof error === "string" && /* @__PURE__ */
|
|
3826
|
+
typeof error === "string" && /* @__PURE__ */ jsx25("div", { className: "absolute left-1/2 -translate-x-1/2 bottom-full mb-2 z-9999 pointer-events-none opacity-0 group-hover:opacity-100 focus-within:opacity-100 group-focus-within:opacity-100 transition-opacity whitespace-nowrap bg-red-500 text-white text-xs px-2.5 py-1.5 rounded shadow-lg before:content-[''] before:absolute before:top-full before:left-1/2 before:-translate-x-1/2 before:border-4 before:border-transparent before:border-t-red-500", children: error })
|
|
3822
3827
|
]
|
|
3823
3828
|
}
|
|
3824
3829
|
)
|
|
@@ -3834,7 +3839,7 @@ function PostTable({
|
|
|
3834
3839
|
(group) => group.headers.some(
|
|
3835
3840
|
(header) => header.column.columnDef.footer
|
|
3836
3841
|
)
|
|
3837
|
-
) && /* @__PURE__ */
|
|
3842
|
+
) && /* @__PURE__ */ jsx25("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-900/50 border-t border-gray-200 dark:border-zinc-800", children: table.getFooterGroups().map((footerGroup) => /* @__PURE__ */ jsx25("tr", { children: footerGroup.headers.map((header) => /* @__PURE__ */ jsx25(
|
|
3838
3843
|
"td",
|
|
3839
3844
|
{
|
|
3840
3845
|
className: cn(
|
|
@@ -3868,7 +3873,7 @@ import {
|
|
|
3868
3873
|
getCoreRowModel as getCoreRowModel3,
|
|
3869
3874
|
flexRender as flexRender3
|
|
3870
3875
|
} from "@tanstack/react-table";
|
|
3871
|
-
import { jsx as
|
|
3876
|
+
import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3872
3877
|
function SimpleTable({
|
|
3873
3878
|
columns: userColumns,
|
|
3874
3879
|
data,
|
|
@@ -3900,7 +3905,7 @@ function SimpleTable({
|
|
|
3900
3905
|
id: "index",
|
|
3901
3906
|
width: 75,
|
|
3902
3907
|
className: "whitespace-nowrap px-2 text-center",
|
|
3903
|
-
cell: (info) => /* @__PURE__ */
|
|
3908
|
+
cell: (info) => /* @__PURE__ */ jsx26("span", { className: "tabular-nums", children: info.row.index + 1 + startIndex })
|
|
3904
3909
|
});
|
|
3905
3910
|
}
|
|
3906
3911
|
return cols;
|
|
@@ -3917,17 +3922,17 @@ function SimpleTable({
|
|
|
3917
3922
|
)
|
|
3918
3923
|
);
|
|
3919
3924
|
}, [table]);
|
|
3920
|
-
return /* @__PURE__ */
|
|
3921
|
-
/* @__PURE__ */
|
|
3925
|
+
return /* @__PURE__ */ jsxs20("div", { className: `w-full overflow-hidden ${className}`, children: [
|
|
3926
|
+
/* @__PURE__ */ jsxs20(
|
|
3922
3927
|
"table",
|
|
3923
3928
|
{
|
|
3924
3929
|
className: `w-full max-w-full text-left border-collapse table-fixed ${verticalLines ? "border border-black dark:border-white" : ""}`,
|
|
3925
3930
|
children: [
|
|
3926
|
-
/* @__PURE__ */
|
|
3931
|
+
/* @__PURE__ */ jsx26("thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx26(
|
|
3927
3932
|
"tr",
|
|
3928
3933
|
{
|
|
3929
3934
|
className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-200 dark:border-zinc-800"}`,
|
|
3930
|
-
children: headerGroup.headers.map((header) => /* @__PURE__ */
|
|
3935
|
+
children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx26(
|
|
3931
3936
|
"th",
|
|
3932
3937
|
{
|
|
3933
3938
|
className: `${rowPadding} font-semibold text-gray-900 dark:text-zinc-100 text-sm align-top ${verticalLines ? "border-x border-black dark:border-white" : ""} ${header.column.columnDef.className || "wrap-break-word"}`,
|
|
@@ -3946,15 +3951,15 @@ function SimpleTable({
|
|
|
3946
3951
|
},
|
|
3947
3952
|
headerGroup.id
|
|
3948
3953
|
)) }),
|
|
3949
|
-
/* @__PURE__ */
|
|
3954
|
+
/* @__PURE__ */ jsx26("tbody", { className: "text-black dark:text-white font-semibold font-sans tabular-nums", children: isLoading && data.length === 0 ? Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ jsx26(
|
|
3950
3955
|
"tr",
|
|
3951
3956
|
{
|
|
3952
3957
|
className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-100 dark:border-zinc-800/60 last:border-0"}`,
|
|
3953
|
-
children: columns.map((col, colIdx) => /* @__PURE__ */
|
|
3958
|
+
children: columns.map((col, colIdx) => /* @__PURE__ */ jsx26(
|
|
3954
3959
|
"td",
|
|
3955
3960
|
{
|
|
3956
3961
|
className: `text-sm ${rowPadding} align-top ${verticalLines ? "border-x border-black dark:border-white" : ""}`,
|
|
3957
|
-
children: /* @__PURE__ */
|
|
3962
|
+
children: /* @__PURE__ */ jsx26(
|
|
3958
3963
|
"div",
|
|
3959
3964
|
{
|
|
3960
3965
|
className: `h-4 bg-gray-200 dark:bg-zinc-800/50 rounded-sm animate-pulse ${colIdx % 2 === 0 ? "w-3/4" : "w-1/2"} ${colIdx === 0 ? "w-4" : ""}`
|
|
@@ -3965,18 +3970,18 @@ function SimpleTable({
|
|
|
3965
3970
|
))
|
|
3966
3971
|
},
|
|
3967
3972
|
`skeleton-row-${i}`
|
|
3968
|
-
)) : data.length === 0 && !isLoading ? /* @__PURE__ */
|
|
3973
|
+
)) : data.length === 0 && !isLoading ? /* @__PURE__ */ jsx26("tr", { children: /* @__PURE__ */ jsx26(
|
|
3969
3974
|
"td",
|
|
3970
3975
|
{
|
|
3971
3976
|
colSpan: columns.length,
|
|
3972
3977
|
className: "text-center text-gray-500 font-medium",
|
|
3973
|
-
children: emptyState || /* @__PURE__ */
|
|
3978
|
+
children: emptyState || /* @__PURE__ */ jsx26("div", { className: "py-8", children: "No transactions found." })
|
|
3974
3979
|
}
|
|
3975
|
-
) }) : table.getRowModel().rows.map((row) => /* @__PURE__ */
|
|
3980
|
+
) }) : table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx26(
|
|
3976
3981
|
"tr",
|
|
3977
3982
|
{
|
|
3978
3983
|
className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-100 dark:border-zinc-800/60 last:border-0"} hover:bg-gray-50/50 dark:hover:bg-zinc-900/30 transition-colors`,
|
|
3979
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */
|
|
3984
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx26(
|
|
3980
3985
|
"td",
|
|
3981
3986
|
{
|
|
3982
3987
|
className: `text-sm ${rowPadding} align-top ${verticalLines ? "border-x border-black dark:border-white" : ""} ${cell.column.columnDef.className || "wrap-break-word"}`,
|
|
@@ -3987,11 +3992,11 @@ function SimpleTable({
|
|
|
3987
3992
|
},
|
|
3988
3993
|
row.id
|
|
3989
3994
|
)) }),
|
|
3990
|
-
hasFooters && !isLoading && /* @__PURE__ */
|
|
3995
|
+
hasFooters && !isLoading && /* @__PURE__ */ jsx26("tfoot", { className: "text-black dark:text-white font-bold font-sans tabular-nums", children: table.getFooterGroups().map((footerGroup) => /* @__PURE__ */ jsx26(
|
|
3991
3996
|
"tr",
|
|
3992
3997
|
{
|
|
3993
3998
|
className: `${verticalLines ? "border-t border-black dark:border-white" : "bg-gray-50/30 dark:bg-zinc-900/10"}`,
|
|
3994
|
-
children: footerGroup.headers.map((header) => /* @__PURE__ */
|
|
3999
|
+
children: footerGroup.headers.map((header) => /* @__PURE__ */ jsx26(
|
|
3995
4000
|
"td",
|
|
3996
4001
|
{
|
|
3997
4002
|
className: `text-sm ${rowPadding} ${verticalLines ? "border-x border-black dark:border-white" : ""} ${header.column.columnDef.className || "wrap-break-word"}`,
|
|
@@ -4008,13 +4013,13 @@ function SimpleTable({
|
|
|
4008
4013
|
]
|
|
4009
4014
|
}
|
|
4010
4015
|
),
|
|
4011
|
-
componentFooter && /* @__PURE__ */
|
|
4016
|
+
componentFooter && /* @__PURE__ */ jsx26("div", { className: "mt-2 pt-3 border-t border-gray-200 dark:border-zinc-800", children: componentFooter() })
|
|
4012
4017
|
] });
|
|
4013
4018
|
}
|
|
4014
4019
|
|
|
4015
4020
|
// src/components/Badge.tsx
|
|
4016
4021
|
import React11 from "react";
|
|
4017
|
-
import { jsx as
|
|
4022
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4018
4023
|
var Badge = React11.forwardRef(
|
|
4019
4024
|
({
|
|
4020
4025
|
children,
|
|
@@ -4036,7 +4041,7 @@ var Badge = React11.forwardRef(
|
|
|
4036
4041
|
md: "px-2.5 py-1 text-xs leading-tight font-semibold",
|
|
4037
4042
|
lg: "px-3 py-1.5 text-sm leading-tight font-semibold"
|
|
4038
4043
|
};
|
|
4039
|
-
return /* @__PURE__ */
|
|
4044
|
+
return /* @__PURE__ */ jsx27(
|
|
4040
4045
|
"span",
|
|
4041
4046
|
{
|
|
4042
4047
|
ref,
|
|
@@ -4050,13 +4055,13 @@ var Badge = React11.forwardRef(
|
|
|
4050
4055
|
Badge.displayName = "Badge";
|
|
4051
4056
|
|
|
4052
4057
|
// src/components/Branding.tsx
|
|
4053
|
-
import { jsx as
|
|
4058
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4054
4059
|
var Branding = ({
|
|
4055
4060
|
text,
|
|
4056
4061
|
disabled = false,
|
|
4057
4062
|
className
|
|
4058
4063
|
}) => {
|
|
4059
|
-
return /* @__PURE__ */
|
|
4064
|
+
return /* @__PURE__ */ jsx28(
|
|
4060
4065
|
"p",
|
|
4061
4066
|
{
|
|
4062
4067
|
className: cn(
|
|
@@ -4070,7 +4075,7 @@ var Branding = ({
|
|
|
4070
4075
|
};
|
|
4071
4076
|
|
|
4072
4077
|
// src/hooks/Fetches/useA4DataView.tsx
|
|
4073
|
-
import { useEffect as useEffect11, useRef as useRef6, useState as
|
|
4078
|
+
import { useEffect as useEffect11, useRef as useRef6, useState as useState17 } from "react";
|
|
4074
4079
|
import { useReactToPrint } from "react-to-print";
|
|
4075
4080
|
import {
|
|
4076
4081
|
RefreshCw,
|
|
@@ -4080,7 +4085,7 @@ import {
|
|
|
4080
4085
|
ChevronLeft,
|
|
4081
4086
|
ChevronRight as ChevronRight2
|
|
4082
4087
|
} from "lucide-react";
|
|
4083
|
-
import { jsx as
|
|
4088
|
+
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4084
4089
|
var useA4StatementView = ({
|
|
4085
4090
|
url,
|
|
4086
4091
|
v = 1,
|
|
@@ -4131,11 +4136,11 @@ var useA4StatementView = ({
|
|
|
4131
4136
|
const { store } = useWarqadConfig();
|
|
4132
4137
|
const isActuallyLoading = externalLoading ?? isLoading;
|
|
4133
4138
|
const measureContainerRef = useRef6(null);
|
|
4134
|
-
const [pages, setPages] =
|
|
4135
|
-
const [isMeasuring, setIsMeasuring] =
|
|
4136
|
-
const [globalFilter, setGlobalFilter] =
|
|
4137
|
-
const [currentPageIndex, setCurrentPageIndex] =
|
|
4138
|
-
const [pageSearch, setPageSearch] =
|
|
4139
|
+
const [pages, setPages] = useState17([]);
|
|
4140
|
+
const [isMeasuring, setIsMeasuring] = useState17(true);
|
|
4141
|
+
const [globalFilter, setGlobalFilter] = useState17("");
|
|
4142
|
+
const [currentPageIndex, setCurrentPageIndex] = useState17(0);
|
|
4143
|
+
const [pageSearch, setPageSearch] = useState17("");
|
|
4139
4144
|
const displayColumnsForSearch = columns.filter((col) => !col.hide);
|
|
4140
4145
|
const filteredDisplayData = data.filter((row) => {
|
|
4141
4146
|
if (!globalFilter) return true;
|
|
@@ -4151,20 +4156,20 @@ var useA4StatementView = ({
|
|
|
4151
4156
|
const columnsWithFooters = columns.filter(
|
|
4152
4157
|
(col) => col.renderFooter && !col.hide
|
|
4153
4158
|
);
|
|
4154
|
-
const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */
|
|
4159
|
+
const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */ jsxs21(
|
|
4155
4160
|
"div",
|
|
4156
4161
|
{
|
|
4157
4162
|
id: "a4-final-total",
|
|
4158
4163
|
className: "mt-6 flex flex-wrap justify-end items-center pt-4 border-t border-black dark:border-zinc-700 print:border-black gap-4",
|
|
4159
4164
|
children: [
|
|
4160
|
-
/* @__PURE__ */
|
|
4161
|
-
columnsWithFooters.map((col, idx) => /* @__PURE__ */
|
|
4165
|
+
/* @__PURE__ */ jsx29("div", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs mr-auto", children: "Grand Totals" }),
|
|
4166
|
+
columnsWithFooters.map((col, idx) => /* @__PURE__ */ jsxs21(
|
|
4162
4167
|
"div",
|
|
4163
4168
|
{
|
|
4164
4169
|
className: "flex items-center gap-3 px-4 py-2 rounded-md border border-black dark:border-zinc-700 print:border-black",
|
|
4165
4170
|
children: [
|
|
4166
|
-
/* @__PURE__ */
|
|
4167
|
-
/* @__PURE__ */
|
|
4171
|
+
/* @__PURE__ */ jsx29("span", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs", children: typeof col.header === "string" ? col.header : typeof col.key === "string" ? col.key : "Total" }),
|
|
4172
|
+
/* @__PURE__ */ jsx29("div", { className: "text-base font-bold font-sans tabular-nums text-black dark:text-white print:text-black", children: col.renderFooter(filteredDisplayData) })
|
|
4168
4173
|
]
|
|
4169
4174
|
},
|
|
4170
4175
|
col.key || idx
|
|
@@ -4251,28 +4256,28 @@ var useA4StatementView = ({
|
|
|
4251
4256
|
}, 150);
|
|
4252
4257
|
return () => clearTimeout(timer);
|
|
4253
4258
|
}, [isMeasuring, depsString]);
|
|
4254
|
-
const HeaderEl = /* @__PURE__ */
|
|
4259
|
+
const HeaderEl = /* @__PURE__ */ jsxs21(
|
|
4255
4260
|
"div",
|
|
4256
4261
|
{
|
|
4257
4262
|
className: "flex justify-between items-start mb-5 px-8 pt-8",
|
|
4258
4263
|
id: "a4-header-section",
|
|
4259
4264
|
children: [
|
|
4260
|
-
/* @__PURE__ */
|
|
4261
|
-
/* @__PURE__ */
|
|
4262
|
-
/* @__PURE__ */
|
|
4265
|
+
/* @__PURE__ */ jsx29("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsx29("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsxs21("section", { children: [
|
|
4266
|
+
/* @__PURE__ */ jsx29("h1", { className: "text-4xl font-bold text-blue-600 dark:text-blue-500 print:text-blue-600 tracking-tight uppercase", children: title }),
|
|
4267
|
+
/* @__PURE__ */ jsx29("p", { className: "text-gray-500 dark:text-gray-400 print:text-gray-500 mt-1 uppercase text-xs font-semibold tracking-wider", children: subtitle })
|
|
4263
4268
|
] }) }) }),
|
|
4264
|
-
/* @__PURE__ */
|
|
4265
|
-
/* @__PURE__ */
|
|
4266
|
-
/* @__PURE__ */
|
|
4267
|
-
store?.address && /* @__PURE__ */
|
|
4268
|
-
store?.phone && /* @__PURE__ */
|
|
4269
|
-
store?.email && /* @__PURE__ */
|
|
4269
|
+
/* @__PURE__ */ jsxs21("div", { className: "text-right", children: [
|
|
4270
|
+
/* @__PURE__ */ jsx29("h2", { className: "text-lg font-bold text-gray-800 dark:text-gray-100 print:text-gray-800", children: store?.name }),
|
|
4271
|
+
/* @__PURE__ */ jsxs21("div", { className: "text-sm text-gray-500 dark:text-gray-400 print:text-gray-500 leading-relaxed text-right flex flex-col items-end", children: [
|
|
4272
|
+
store?.address && /* @__PURE__ */ jsx29("span", { className: "whitespace-pre-line", children: store.address }),
|
|
4273
|
+
store?.phone && /* @__PURE__ */ jsx29("span", { children: store.phone }),
|
|
4274
|
+
store?.email && /* @__PURE__ */ jsx29("span", { children: store.email })
|
|
4270
4275
|
] })
|
|
4271
4276
|
] })
|
|
4272
4277
|
]
|
|
4273
4278
|
}
|
|
4274
4279
|
);
|
|
4275
|
-
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */
|
|
4280
|
+
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ jsx29("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ jsx29(
|
|
4276
4281
|
InfoGrid,
|
|
4277
4282
|
{
|
|
4278
4283
|
className: "mb-4",
|
|
@@ -4280,29 +4285,29 @@ var useA4StatementView = ({
|
|
|
4280
4285
|
isLoading: isActuallyLoading
|
|
4281
4286
|
}
|
|
4282
4287
|
) }) : null;
|
|
4283
|
-
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */
|
|
4284
|
-
isActuallyLoading ? /* @__PURE__ */
|
|
4285
|
-
/* @__PURE__ */
|
|
4286
|
-
/* @__PURE__ */
|
|
4287
|
-
url && !isActuallyLoading && /* @__PURE__ */
|
|
4288
|
+
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ jsx29("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ jsxs21("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
|
|
4289
|
+
isActuallyLoading ? /* @__PURE__ */ jsx29("div", { className: "mb-4", children: /* @__PURE__ */ jsx29(ClassicSpin, {}) }) : error ? /* @__PURE__ */ jsx29("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx29(AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx29("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx29(FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
4290
|
+
/* @__PURE__ */ jsx29("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: isActuallyLoading ? "Loading data..." : error ? "Failed to Load Statement" : "No Records Found" }),
|
|
4291
|
+
/* @__PURE__ */ jsx29("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: isActuallyLoading ? "Please wait while we prepare your statement." : error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the statement data." : "There are no transactions or records available in this requested statement." }),
|
|
4292
|
+
url && !isActuallyLoading && /* @__PURE__ */ jsxs21(
|
|
4288
4293
|
"button",
|
|
4289
4294
|
{
|
|
4290
4295
|
onClick: () => getData(),
|
|
4291
4296
|
className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
|
|
4292
4297
|
children: [
|
|
4293
|
-
/* @__PURE__ */
|
|
4298
|
+
/* @__PURE__ */ jsx29(RefreshCw, { size: 14 }),
|
|
4294
4299
|
"Try Again"
|
|
4295
4300
|
]
|
|
4296
4301
|
}
|
|
4297
4302
|
)
|
|
4298
4303
|
] }) }) : null;
|
|
4299
|
-
return /* @__PURE__ */
|
|
4300
|
-
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */
|
|
4304
|
+
return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col relative w-full items-center", children: [
|
|
4305
|
+
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ jsx29("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ jsx29(
|
|
4301
4306
|
"div",
|
|
4302
4307
|
{
|
|
4303
4308
|
style: { width: "210mm", boxSizing: "border-box" },
|
|
4304
4309
|
className: "bg-white",
|
|
4305
|
-
children: /* @__PURE__ */
|
|
4310
|
+
children: /* @__PURE__ */ jsxs21(
|
|
4306
4311
|
"div",
|
|
4307
4312
|
{
|
|
4308
4313
|
ref: measureContainerRef,
|
|
@@ -4310,9 +4315,9 @@ var useA4StatementView = ({
|
|
|
4310
4315
|
children: [
|
|
4311
4316
|
HeaderEl,
|
|
4312
4317
|
DisplayInfoGridEl,
|
|
4313
|
-
/* @__PURE__ */
|
|
4314
|
-
/* @__PURE__ */
|
|
4315
|
-
/* @__PURE__ */
|
|
4318
|
+
/* @__PURE__ */ jsxs21("div", { className: "grow w-full px-8 pb-8", children: [
|
|
4319
|
+
/* @__PURE__ */ jsx29("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-800 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ jsx29("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
4320
|
+
/* @__PURE__ */ jsx29(
|
|
4316
4321
|
SimpleTable,
|
|
4317
4322
|
{
|
|
4318
4323
|
columns,
|
|
@@ -4330,52 +4335,52 @@ var useA4StatementView = ({
|
|
|
4330
4335
|
)
|
|
4331
4336
|
}
|
|
4332
4337
|
) }),
|
|
4333
|
-
/* @__PURE__ */
|
|
4338
|
+
/* @__PURE__ */ jsx29("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ jsx29("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageData, pageIndex) => /* @__PURE__ */ jsx29(
|
|
4334
4339
|
"div",
|
|
4335
4340
|
{
|
|
4336
4341
|
className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
|
|
4337
|
-
children: /* @__PURE__ */
|
|
4342
|
+
children: /* @__PURE__ */ jsx29(
|
|
4338
4343
|
PageA4,
|
|
4339
4344
|
{
|
|
4340
4345
|
className: "w-full",
|
|
4341
4346
|
pageNumber: pageIndex + 1,
|
|
4342
4347
|
totalPages: pages.length,
|
|
4343
4348
|
isLastPage: pageIndex === pages.length - 1,
|
|
4344
|
-
children: /* @__PURE__ */
|
|
4345
|
-
/* @__PURE__ */
|
|
4349
|
+
children: /* @__PURE__ */ jsxs21("div", { className: "flex flex-col h-full grow w-full", children: [
|
|
4350
|
+
/* @__PURE__ */ jsxs21("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
|
|
4346
4351
|
headers,
|
|
4347
|
-
printable && pageIndex === currentPageIndex && /* @__PURE__ */
|
|
4348
|
-
/* @__PURE__ */
|
|
4352
|
+
printable && pageIndex === currentPageIndex && /* @__PURE__ */ jsx29("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2", children: [
|
|
4353
|
+
/* @__PURE__ */ jsxs21(
|
|
4349
4354
|
"button",
|
|
4350
4355
|
{
|
|
4351
4356
|
onClick: async () => await getData(),
|
|
4352
4357
|
disabled: isLoading,
|
|
4353
4358
|
className: "flex items-center gap-2 px-3 py-1.5 text-gray-600 dark:text-gray-300 hover:text-black dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-all disabled:opacity-50",
|
|
4354
4359
|
children: [
|
|
4355
|
-
/* @__PURE__ */
|
|
4360
|
+
/* @__PURE__ */ jsx29(
|
|
4356
4361
|
RefreshCw,
|
|
4357
4362
|
{
|
|
4358
4363
|
size: 16,
|
|
4359
4364
|
className: isLoading ? "animate-spin" : ""
|
|
4360
4365
|
}
|
|
4361
4366
|
),
|
|
4362
|
-
/* @__PURE__ */
|
|
4367
|
+
/* @__PURE__ */ jsx29("span", { className: "text-xs font-semibold", children: "Reload" })
|
|
4363
4368
|
]
|
|
4364
4369
|
}
|
|
4365
4370
|
),
|
|
4366
|
-
/* @__PURE__ */
|
|
4371
|
+
/* @__PURE__ */ jsxs21(
|
|
4367
4372
|
"button",
|
|
4368
4373
|
{
|
|
4369
4374
|
onClick: () => reactToPrintFn(),
|
|
4370
4375
|
className: "flex items-center gap-2 px-4 py-1.5 bg-black dark:bg-zinc-800 text-white rounded-md text-xs font-bold shadow-sm hover:bg-zinc-800 dark:hover:bg-zinc-700 transition-all active:scale-95",
|
|
4371
4376
|
children: [
|
|
4372
|
-
/* @__PURE__ */
|
|
4377
|
+
/* @__PURE__ */ jsx29(Printer, { size: 16 }),
|
|
4373
4378
|
"Print"
|
|
4374
4379
|
]
|
|
4375
4380
|
}
|
|
4376
4381
|
),
|
|
4377
|
-
/* @__PURE__ */
|
|
4378
|
-
/* @__PURE__ */
|
|
4382
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
|
|
4383
|
+
/* @__PURE__ */ jsx29(
|
|
4379
4384
|
"button",
|
|
4380
4385
|
{
|
|
4381
4386
|
onClick: (e) => {
|
|
@@ -4386,11 +4391,11 @@ var useA4StatementView = ({
|
|
|
4386
4391
|
},
|
|
4387
4392
|
disabled: currentPageIndex === 0,
|
|
4388
4393
|
className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
|
|
4389
|
-
children: /* @__PURE__ */
|
|
4394
|
+
children: /* @__PURE__ */ jsx29(ChevronLeft, { size: 18 })
|
|
4390
4395
|
}
|
|
4391
4396
|
),
|
|
4392
|
-
/* @__PURE__ */
|
|
4393
|
-
/* @__PURE__ */
|
|
4397
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
|
|
4398
|
+
/* @__PURE__ */ jsxs21(
|
|
4394
4399
|
Select,
|
|
4395
4400
|
{
|
|
4396
4401
|
value: currentPageIndex + 1,
|
|
@@ -4403,9 +4408,9 @@ var useA4StatementView = ({
|
|
|
4403
4408
|
variant: "ghost",
|
|
4404
4409
|
containerClassName: "inline-block",
|
|
4405
4410
|
children: [
|
|
4406
|
-
/* @__PURE__ */
|
|
4407
|
-
/* @__PURE__ */
|
|
4408
|
-
/* @__PURE__ */
|
|
4411
|
+
/* @__PURE__ */ jsx29(SelectTrigger, { className: "h-7 px-2 min-w-[40px] border border-gray-200 dark:border-zinc-700 rounded flex items-center justify-center bg-white dark:bg-zinc-900 hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors", children: /* @__PURE__ */ jsx29("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
|
|
4412
|
+
/* @__PURE__ */ jsxs21(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
|
|
4413
|
+
/* @__PURE__ */ jsx29("div", { className: "p-2 border-b border-gray-100 dark:border-zinc-800 sticky top-0 bg-white dark:bg-zinc-950 z-10", children: /* @__PURE__ */ jsx29(
|
|
4409
4414
|
"input",
|
|
4410
4415
|
{
|
|
4411
4416
|
type: "text",
|
|
@@ -4417,17 +4422,17 @@ var useA4StatementView = ({
|
|
|
4417
4422
|
autoFocus: true
|
|
4418
4423
|
}
|
|
4419
4424
|
) }),
|
|
4420
|
-
/* @__PURE__ */
|
|
4425
|
+
/* @__PURE__ */ jsx29("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
|
|
4421
4426
|
(p) => String(p).includes(pageSearch)
|
|
4422
|
-
).map((p) => /* @__PURE__ */
|
|
4427
|
+
).map((p) => /* @__PURE__ */ jsx29(SelectItem, { value: p, children: p }, p)) })
|
|
4423
4428
|
] })
|
|
4424
4429
|
]
|
|
4425
4430
|
}
|
|
4426
4431
|
),
|
|
4427
|
-
/* @__PURE__ */
|
|
4428
|
-
/* @__PURE__ */
|
|
4432
|
+
/* @__PURE__ */ jsx29("span", { className: "text-gray-400 mx-0.5", children: "/" }),
|
|
4433
|
+
/* @__PURE__ */ jsx29("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
|
|
4429
4434
|
] }),
|
|
4430
|
-
/* @__PURE__ */
|
|
4435
|
+
/* @__PURE__ */ jsx29(
|
|
4431
4436
|
"button",
|
|
4432
4437
|
{
|
|
4433
4438
|
onClick: (e) => {
|
|
@@ -4438,7 +4443,7 @@ var useA4StatementView = ({
|
|
|
4438
4443
|
},
|
|
4439
4444
|
disabled: currentPageIndex === pages.length - 1,
|
|
4440
4445
|
className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
|
|
4441
|
-
children: /* @__PURE__ */
|
|
4446
|
+
children: /* @__PURE__ */ jsx29(ChevronRight2, { size: 18 })
|
|
4442
4447
|
}
|
|
4443
4448
|
)
|
|
4444
4449
|
] })
|
|
@@ -4446,10 +4451,10 @@ var useA4StatementView = ({
|
|
|
4446
4451
|
] }),
|
|
4447
4452
|
pageIndex === 0 && HeaderEl,
|
|
4448
4453
|
pageIndex === 0 && DisplayInfoGridEl,
|
|
4449
|
-
/* @__PURE__ */
|
|
4450
|
-
pageIndex === 0 && /* @__PURE__ */
|
|
4451
|
-
/* @__PURE__ */
|
|
4452
|
-
/* @__PURE__ */
|
|
4454
|
+
/* @__PURE__ */ jsxs21("div", { className: "grow w-full px-8 pb-8", children: [
|
|
4455
|
+
pageIndex === 0 && /* @__PURE__ */ jsxs21("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-700 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2 print:hidden", children: [
|
|
4456
|
+
/* @__PURE__ */ jsx29("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
|
|
4457
|
+
/* @__PURE__ */ jsx29(
|
|
4453
4458
|
"input",
|
|
4454
4459
|
{
|
|
4455
4460
|
type: "text",
|
|
@@ -4460,9 +4465,9 @@ var useA4StatementView = ({
|
|
|
4460
4465
|
}
|
|
4461
4466
|
)
|
|
4462
4467
|
] }),
|
|
4463
|
-
pageIndex === 0 && /* @__PURE__ */
|
|
4464
|
-
pageIndex > 0 && /* @__PURE__ */
|
|
4465
|
-
statusOverlay ? /* @__PURE__ */
|
|
4468
|
+
pageIndex === 0 && /* @__PURE__ */ jsx29("div", { className: "hidden print:flex mb-4 border-b border-gray-200 print:border-gray-200 pb-2 items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ jsx29("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
4469
|
+
pageIndex > 0 && /* @__PURE__ */ jsx29("div", { className: "h-7 print:h-0" }),
|
|
4470
|
+
statusOverlay ? /* @__PURE__ */ jsx29("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ jsx29(
|
|
4466
4471
|
SimpleTable,
|
|
4467
4472
|
{
|
|
4468
4473
|
columns,
|
|
@@ -4498,10 +4503,10 @@ var useA4StatementView = ({
|
|
|
4498
4503
|
var useA4DataView_default = useA4StatementView;
|
|
4499
4504
|
|
|
4500
4505
|
// src/hooks/Fetches/useTransaction.tsx
|
|
4501
|
-
import { useEffect as useEffect12, useState as
|
|
4506
|
+
import { useEffect as useEffect12, useState as useState18 } from "react";
|
|
4502
4507
|
import { AlertCircle as AlertCircle2, FileX as FileX2, Plus as Plus2, RefreshCw as RefreshCw2 } from "lucide-react";
|
|
4503
4508
|
import moment from "moment";
|
|
4504
|
-
import { jsx as
|
|
4509
|
+
import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4505
4510
|
var useTransaction = ({
|
|
4506
4511
|
url,
|
|
4507
4512
|
v = 1,
|
|
@@ -4509,7 +4514,7 @@ var useTransaction = ({
|
|
|
4509
4514
|
params = {},
|
|
4510
4515
|
dateFilter = true
|
|
4511
4516
|
}) => {
|
|
4512
|
-
const [date, setDate] =
|
|
4517
|
+
const [date, setDate] = useState18(
|
|
4513
4518
|
moment().format("DD/MM/YYYY")
|
|
4514
4519
|
);
|
|
4515
4520
|
const dateObj = {};
|
|
@@ -4554,21 +4559,21 @@ var useTransaction = ({
|
|
|
4554
4559
|
createTitle = "Add New",
|
|
4555
4560
|
...rest
|
|
4556
4561
|
}) => {
|
|
4557
|
-
const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */
|
|
4562
|
+
const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ jsx30(
|
|
4558
4563
|
"div",
|
|
4559
4564
|
{
|
|
4560
4565
|
className: `flex flex-col relative w-full items-center justify-center py-12 min-h-[300px] ${className}`,
|
|
4561
|
-
children: /* @__PURE__ */
|
|
4562
|
-
error ? /* @__PURE__ */
|
|
4563
|
-
/* @__PURE__ */
|
|
4564
|
-
/* @__PURE__ */
|
|
4565
|
-
url && /* @__PURE__ */
|
|
4566
|
+
children: /* @__PURE__ */ jsxs22("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
|
|
4567
|
+
error ? /* @__PURE__ */ jsx30("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx30(AlertCircle2, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx30("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx30(FileX2, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
4568
|
+
/* @__PURE__ */ jsx30("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: error ? "Failed to Load Data" : "No Records Found" }),
|
|
4569
|
+
/* @__PURE__ */ jsx30("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the data." : "There are no transactions or records available to display here." }),
|
|
4570
|
+
url && /* @__PURE__ */ jsxs22(
|
|
4566
4571
|
"button",
|
|
4567
4572
|
{
|
|
4568
4573
|
onClick: () => getData(),
|
|
4569
4574
|
className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
|
|
4570
4575
|
children: [
|
|
4571
|
-
/* @__PURE__ */
|
|
4576
|
+
/* @__PURE__ */ jsx30(RefreshCw2, { size: 14 }),
|
|
4572
4577
|
"Try Again"
|
|
4573
4578
|
]
|
|
4574
4579
|
}
|
|
@@ -4576,14 +4581,14 @@ var useTransaction = ({
|
|
|
4576
4581
|
] })
|
|
4577
4582
|
}
|
|
4578
4583
|
) : void 0;
|
|
4579
|
-
return /* @__PURE__ */
|
|
4580
|
-
/* @__PURE__ */
|
|
4581
|
-
/* @__PURE__ */
|
|
4582
|
-
/* @__PURE__ */
|
|
4583
|
-
/* @__PURE__ */
|
|
4584
|
+
return /* @__PURE__ */ jsxs22(Card, { children: [
|
|
4585
|
+
/* @__PURE__ */ jsx30(Card.Header, { children: /* @__PURE__ */ jsxs22("header", { className: "flex items-center justify-between gap-4 py-2", children: [
|
|
4586
|
+
/* @__PURE__ */ jsxs22("div", { className: "space-y-1", children: [
|
|
4587
|
+
/* @__PURE__ */ jsx30(Card.Title, { children: title }),
|
|
4588
|
+
/* @__PURE__ */ jsx30(Card.Description, { children: description })
|
|
4584
4589
|
] }),
|
|
4585
|
-
/* @__PURE__ */
|
|
4586
|
-
dateFilter && /* @__PURE__ */
|
|
4590
|
+
/* @__PURE__ */ jsxs22("section", { className: "flex gap-2 items-center", children: [
|
|
4591
|
+
dateFilter && /* @__PURE__ */ jsx30(
|
|
4587
4592
|
Fields_default.DateInput,
|
|
4588
4593
|
{
|
|
4589
4594
|
value: date,
|
|
@@ -4593,20 +4598,20 @@ var useTransaction = ({
|
|
|
4593
4598
|
}
|
|
4594
4599
|
}
|
|
4595
4600
|
),
|
|
4596
|
-
/* @__PURE__ */
|
|
4601
|
+
/* @__PURE__ */ jsx30(
|
|
4597
4602
|
Button,
|
|
4598
4603
|
{
|
|
4599
4604
|
size: "sm",
|
|
4600
4605
|
className: "rounded-md!",
|
|
4601
4606
|
onClick: onCreate,
|
|
4602
4607
|
variant: "primary",
|
|
4603
|
-
icon: /* @__PURE__ */
|
|
4608
|
+
icon: /* @__PURE__ */ jsx30(Plus2, {}),
|
|
4604
4609
|
children: createTitle
|
|
4605
4610
|
}
|
|
4606
4611
|
)
|
|
4607
4612
|
] })
|
|
4608
4613
|
] }) }),
|
|
4609
|
-
/* @__PURE__ */
|
|
4614
|
+
/* @__PURE__ */ jsx30(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ jsx30("div", { className: `w-full ${className}`, children: /* @__PURE__ */ jsx30(
|
|
4610
4615
|
DataTable,
|
|
4611
4616
|
{
|
|
4612
4617
|
columns,
|