warqadui 0.0.47 → 0.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +1808 -388
- package/dist/index.mjs +1736 -317
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1063,18 +1063,13 @@ 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
|
-
|
|
1071
1066
|
// src/components/Fields/Input.tsx
|
|
1072
|
-
import { forwardRef, useEffect as useEffect5, useState as
|
|
1067
|
+
import { forwardRef, useEffect as useEffect5, useState as useState7 } from "react";
|
|
1073
1068
|
import { Eye, EyeOff } from "lucide-react";
|
|
1074
1069
|
import {
|
|
1075
1070
|
Controller
|
|
1076
1071
|
} from "react-hook-form";
|
|
1077
|
-
import { jsx as
|
|
1072
|
+
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1078
1073
|
var Input = forwardRef(
|
|
1079
1074
|
({
|
|
1080
1075
|
label,
|
|
@@ -1090,8 +1085,8 @@ var Input = forwardRef(
|
|
|
1090
1085
|
variant = "default",
|
|
1091
1086
|
...props
|
|
1092
1087
|
}, ref) => {
|
|
1093
|
-
const [isFocused, setIsFocused] =
|
|
1094
|
-
const [showPassword, setShowPassword] =
|
|
1088
|
+
const [isFocused, setIsFocused] = useState7(false);
|
|
1089
|
+
const [showPassword, setShowPassword] = useState7(false);
|
|
1095
1090
|
const { theme } = useWarqadConfig();
|
|
1096
1091
|
const primaryColor = theme?.primaryColor;
|
|
1097
1092
|
useEffect5(() => {
|
|
@@ -1115,12 +1110,12 @@ var Input = forwardRef(
|
|
|
1115
1110
|
form.clearErrors("root");
|
|
1116
1111
|
}
|
|
1117
1112
|
}, [form?.watch(name)]);
|
|
1118
|
-
const renderInput = (inputProps, localType = type || "text") => /* @__PURE__ */
|
|
1113
|
+
const renderInput = (inputProps, localType = type || "text") => /* @__PURE__ */ jsxs11(
|
|
1119
1114
|
"div",
|
|
1120
1115
|
{
|
|
1121
1116
|
className: `${label ? "space-y-2" : ""} group relative ${containerClassName} `,
|
|
1122
1117
|
children: [
|
|
1123
|
-
label && /* @__PURE__ */
|
|
1118
|
+
label && /* @__PURE__ */ jsxs11(
|
|
1124
1119
|
"label",
|
|
1125
1120
|
{
|
|
1126
1121
|
htmlFor: props.id,
|
|
@@ -1128,12 +1123,12 @@ var Input = forwardRef(
|
|
|
1128
1123
|
style: { color: isFocused ? primaryColor : void 0 },
|
|
1129
1124
|
children: [
|
|
1130
1125
|
label,
|
|
1131
|
-
props.required && /* @__PURE__ */
|
|
1126
|
+
props.required && /* @__PURE__ */ jsx17("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1132
1127
|
]
|
|
1133
1128
|
}
|
|
1134
1129
|
),
|
|
1135
|
-
/* @__PURE__ */
|
|
1136
|
-
icon && /* @__PURE__ */
|
|
1130
|
+
/* @__PURE__ */ jsxs11("div", { className: "relative", children: [
|
|
1131
|
+
icon && /* @__PURE__ */ jsx17("div", { className: "absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none", children: /* @__PURE__ */ jsx17(
|
|
1137
1132
|
"div",
|
|
1138
1133
|
{
|
|
1139
1134
|
className: `transition-colors duration-200`,
|
|
@@ -1141,7 +1136,7 @@ var Input = forwardRef(
|
|
|
1141
1136
|
children: icon
|
|
1142
1137
|
}
|
|
1143
1138
|
) }),
|
|
1144
|
-
/* @__PURE__ */
|
|
1139
|
+
/* @__PURE__ */ jsx17(
|
|
1145
1140
|
"input",
|
|
1146
1141
|
{
|
|
1147
1142
|
ref,
|
|
@@ -1163,23 +1158,23 @@ var Input = forwardRef(
|
|
|
1163
1158
|
type: localType === "password" ? showPassword ? "text" : "password" : localType
|
|
1164
1159
|
}
|
|
1165
1160
|
),
|
|
1166
|
-
type === "password" && /* @__PURE__ */
|
|
1161
|
+
type === "password" && /* @__PURE__ */ jsx17(
|
|
1167
1162
|
"button",
|
|
1168
1163
|
{
|
|
1169
1164
|
type: "button",
|
|
1170
1165
|
onClick: () => setShowPassword(!showPassword),
|
|
1171
1166
|
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",
|
|
1172
1167
|
tabIndex: -1,
|
|
1173
|
-
children: showPassword ? /* @__PURE__ */
|
|
1168
|
+
children: showPassword ? /* @__PURE__ */ jsx17(EyeOff, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx17(Eye, { className: "h-5 w-5" })
|
|
1174
1169
|
}
|
|
1175
1170
|
)
|
|
1176
1171
|
] }),
|
|
1177
|
-
message && /* @__PURE__ */
|
|
1172
|
+
message && /* @__PURE__ */ jsx17("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1178
1173
|
]
|
|
1179
1174
|
}
|
|
1180
1175
|
);
|
|
1181
1176
|
if (form && name && type === "number") {
|
|
1182
|
-
return /* @__PURE__ */
|
|
1177
|
+
return /* @__PURE__ */ jsx17(
|
|
1183
1178
|
Controller,
|
|
1184
1179
|
{
|
|
1185
1180
|
control: form.control,
|
|
@@ -1268,13 +1263,13 @@ var Input = forwardRef(
|
|
|
1268
1263
|
);
|
|
1269
1264
|
|
|
1270
1265
|
// src/components/Fields/PhoneInput.tsx
|
|
1271
|
-
import { forwardRef as forwardRef2, useState as
|
|
1266
|
+
import { forwardRef as forwardRef2, useState as useState8 } from "react";
|
|
1272
1267
|
import PhoneInputOriginal, {
|
|
1273
1268
|
isValidPhoneNumber
|
|
1274
1269
|
} from "react-phone-number-input";
|
|
1275
1270
|
import "react-phone-number-input/style.css";
|
|
1276
1271
|
import { Controller as Controller2 } from "react-hook-form";
|
|
1277
|
-
import { jsx as
|
|
1272
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1278
1273
|
var PhoneInput = forwardRef2(
|
|
1279
1274
|
({
|
|
1280
1275
|
label,
|
|
@@ -1288,7 +1283,7 @@ var PhoneInput = forwardRef2(
|
|
|
1288
1283
|
className = "",
|
|
1289
1284
|
...props
|
|
1290
1285
|
}, ref) => {
|
|
1291
|
-
const [isFocused, setIsFocused] =
|
|
1286
|
+
const [isFocused, setIsFocused] = useState8(false);
|
|
1292
1287
|
const { theme } = useWarqadConfig();
|
|
1293
1288
|
const primaryColor = theme?.primaryColor;
|
|
1294
1289
|
let message = error;
|
|
@@ -1303,8 +1298,8 @@ var PhoneInput = forwardRef2(
|
|
|
1303
1298
|
}
|
|
1304
1299
|
message = currentError?.message || message;
|
|
1305
1300
|
}
|
|
1306
|
-
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */
|
|
1307
|
-
/* @__PURE__ */
|
|
1301
|
+
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ jsxs12("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
1302
|
+
/* @__PURE__ */ jsxs12(
|
|
1308
1303
|
"label",
|
|
1309
1304
|
{
|
|
1310
1305
|
className: `block text-xs font-medium transition-colors duration-200`,
|
|
@@ -1313,12 +1308,12 @@ var PhoneInput = forwardRef2(
|
|
|
1313
1308
|
},
|
|
1314
1309
|
children: [
|
|
1315
1310
|
label,
|
|
1316
|
-
props.required && /* @__PURE__ */
|
|
1311
|
+
props.required && /* @__PURE__ */ jsx18("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1317
1312
|
]
|
|
1318
1313
|
}
|
|
1319
1314
|
),
|
|
1320
|
-
/* @__PURE__ */
|
|
1321
|
-
icon && /* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ jsxs12("div", { className: "relative", children: [
|
|
1316
|
+
icon && /* @__PURE__ */ jsx18("div", { className: "absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none z-10", children: /* @__PURE__ */ jsx18(
|
|
1322
1317
|
"div",
|
|
1323
1318
|
{
|
|
1324
1319
|
className: `transition-colors duration-200`,
|
|
@@ -1326,7 +1321,7 @@ var PhoneInput = forwardRef2(
|
|
|
1326
1321
|
children: icon
|
|
1327
1322
|
}
|
|
1328
1323
|
) }),
|
|
1329
|
-
/* @__PURE__ */
|
|
1324
|
+
/* @__PURE__ */ jsx18(
|
|
1330
1325
|
PhoneInputOriginal,
|
|
1331
1326
|
{
|
|
1332
1327
|
ref,
|
|
@@ -1346,10 +1341,10 @@ var PhoneInput = forwardRef2(
|
|
|
1346
1341
|
}
|
|
1347
1342
|
)
|
|
1348
1343
|
] }),
|
|
1349
|
-
message && /* @__PURE__ */
|
|
1344
|
+
message && /* @__PURE__ */ jsx18("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1350
1345
|
] });
|
|
1351
1346
|
if (form && name) {
|
|
1352
|
-
return /* @__PURE__ */
|
|
1347
|
+
return /* @__PURE__ */ jsx18(
|
|
1353
1348
|
Controller2,
|
|
1354
1349
|
{
|
|
1355
1350
|
name,
|
|
@@ -1371,7 +1366,7 @@ PhoneInput.displayName = "PhoneInput";
|
|
|
1371
1366
|
import React6, {
|
|
1372
1367
|
createContext as createContext3,
|
|
1373
1368
|
useContext as useContext3,
|
|
1374
|
-
useState as
|
|
1369
|
+
useState as useState9,
|
|
1375
1370
|
useRef as useRef3,
|
|
1376
1371
|
useEffect as useEffect6,
|
|
1377
1372
|
forwardRef as forwardRef3
|
|
@@ -1379,7 +1374,7 @@ import React6, {
|
|
|
1379
1374
|
import { createPortal } from "react-dom";
|
|
1380
1375
|
import { ChevronDown as ChevronDown2, Check as Check2 } from "lucide-react";
|
|
1381
1376
|
import { Controller as Controller3 } from "react-hook-form";
|
|
1382
|
-
import { Fragment as
|
|
1377
|
+
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1383
1378
|
var SelectContext = createContext3(void 0);
|
|
1384
1379
|
var useSelectContext = () => {
|
|
1385
1380
|
const context = useContext3(SelectContext);
|
|
@@ -1398,7 +1393,7 @@ var Select = forwardRef3((props, ref) => {
|
|
|
1398
1393
|
}
|
|
1399
1394
|
}, [value, name, form]);
|
|
1400
1395
|
if (form && name) {
|
|
1401
|
-
return /* @__PURE__ */
|
|
1396
|
+
return /* @__PURE__ */ jsx19(
|
|
1402
1397
|
Controller3,
|
|
1403
1398
|
{
|
|
1404
1399
|
name,
|
|
@@ -1410,7 +1405,7 @@ var Select = forwardRef3((props, ref) => {
|
|
|
1410
1405
|
ref: fieldRef,
|
|
1411
1406
|
onBlur
|
|
1412
1407
|
}
|
|
1413
|
-
}) => /* @__PURE__ */
|
|
1408
|
+
}) => /* @__PURE__ */ jsx19(
|
|
1414
1409
|
SelectRoot,
|
|
1415
1410
|
{
|
|
1416
1411
|
...props,
|
|
@@ -1427,7 +1422,7 @@ var Select = forwardRef3((props, ref) => {
|
|
|
1427
1422
|
}
|
|
1428
1423
|
);
|
|
1429
1424
|
}
|
|
1430
|
-
return /* @__PURE__ */
|
|
1425
|
+
return /* @__PURE__ */ jsx19(
|
|
1431
1426
|
SelectRoot,
|
|
1432
1427
|
{
|
|
1433
1428
|
...props,
|
|
@@ -1460,10 +1455,10 @@ var SelectRoot = ({
|
|
|
1460
1455
|
className = "",
|
|
1461
1456
|
...props
|
|
1462
1457
|
}) => {
|
|
1463
|
-
const [isOpen, setIsOpen] =
|
|
1464
|
-
const [isFocused, setIsFocused] =
|
|
1465
|
-
const [activeIndex, setActiveIndex] =
|
|
1466
|
-
const [registeredOptions, setRegisteredOptions] =
|
|
1458
|
+
const [isOpen, setIsOpen] = useState9(false);
|
|
1459
|
+
const [isFocused, setIsFocused] = useState9(false);
|
|
1460
|
+
const [activeIndex, setActiveIndex] = useState9(-1);
|
|
1461
|
+
const [registeredOptions, setRegisteredOptions] = useState9([]);
|
|
1467
1462
|
const { theme } = useWarqadConfig();
|
|
1468
1463
|
const primaryColor = theme?.primaryColor;
|
|
1469
1464
|
const containerRef = useRef3(null);
|
|
@@ -1534,25 +1529,25 @@ var SelectRoot = ({
|
|
|
1534
1529
|
disabled
|
|
1535
1530
|
};
|
|
1536
1531
|
const hasChildren = React6.Children.count(children) > 0;
|
|
1537
|
-
return /* @__PURE__ */
|
|
1532
|
+
return /* @__PURE__ */ jsx19(SelectContext.Provider, { value: valueCtx, children: /* @__PURE__ */ jsxs13(
|
|
1538
1533
|
"div",
|
|
1539
1534
|
{
|
|
1540
1535
|
ref: containerRef,
|
|
1541
1536
|
className: `${label ? "space-y-2" : ""} group relative ${containerClassName}`,
|
|
1542
1537
|
children: [
|
|
1543
|
-
label && /* @__PURE__ */
|
|
1538
|
+
label && /* @__PURE__ */ jsxs13(
|
|
1544
1539
|
"label",
|
|
1545
1540
|
{
|
|
1546
1541
|
className: `block text-xs font-medium transition-colors duration-200`,
|
|
1547
1542
|
style: { color: isFocused || isOpen ? primaryColor : void 0 },
|
|
1548
1543
|
children: [
|
|
1549
1544
|
label,
|
|
1550
|
-
required && /* @__PURE__ */
|
|
1545
|
+
required && /* @__PURE__ */ jsx19("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1551
1546
|
]
|
|
1552
1547
|
}
|
|
1553
1548
|
),
|
|
1554
|
-
hasChildren ? children : /* @__PURE__ */
|
|
1555
|
-
/* @__PURE__ */
|
|
1549
|
+
hasChildren ? children : /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
1550
|
+
/* @__PURE__ */ jsx19(
|
|
1556
1551
|
SelectTrigger,
|
|
1557
1552
|
{
|
|
1558
1553
|
id,
|
|
@@ -1563,7 +1558,7 @@ var SelectRoot = ({
|
|
|
1563
1558
|
...props
|
|
1564
1559
|
}
|
|
1565
1560
|
),
|
|
1566
|
-
allOptions && allOptions.length > 0 && /* @__PURE__ */
|
|
1561
|
+
allOptions && allOptions.length > 0 && /* @__PURE__ */ jsx19(SelectContent, { children: allOptions.map((opt, index) => /* @__PURE__ */ jsx19(
|
|
1567
1562
|
SelectItem,
|
|
1568
1563
|
{
|
|
1569
1564
|
value: opt.value,
|
|
@@ -1573,7 +1568,7 @@ var SelectRoot = ({
|
|
|
1573
1568
|
String(opt.value) || index
|
|
1574
1569
|
)) })
|
|
1575
1570
|
] }),
|
|
1576
|
-
message && /* @__PURE__ */
|
|
1571
|
+
message && /* @__PURE__ */ jsx19("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1577
1572
|
]
|
|
1578
1573
|
}
|
|
1579
1574
|
) });
|
|
@@ -1605,7 +1600,7 @@ var SelectTrigger = forwardRef3(
|
|
|
1605
1600
|
const lastFocusTime = useRef3(0);
|
|
1606
1601
|
const displayOption = options.find((o) => o.value === selectedValue);
|
|
1607
1602
|
const displayValue = displayOption ? displayOption.label : selectedValue != null && selectedValue !== "" ? String(selectedValue) : placeholder;
|
|
1608
|
-
return /* @__PURE__ */
|
|
1603
|
+
return /* @__PURE__ */ jsx19("div", { className: "relative", ref: dropdownAnchorRef, children: /* @__PURE__ */ jsx19(
|
|
1609
1604
|
"div",
|
|
1610
1605
|
{
|
|
1611
1606
|
id,
|
|
@@ -1654,8 +1649,8 @@ var SelectTrigger = forwardRef3(
|
|
|
1654
1649
|
}
|
|
1655
1650
|
},
|
|
1656
1651
|
...props,
|
|
1657
|
-
children: children ? children : /* @__PURE__ */
|
|
1658
|
-
icon && /* @__PURE__ */
|
|
1652
|
+
children: children ? children : /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
1653
|
+
icon && /* @__PURE__ */ jsx19(
|
|
1659
1654
|
"div",
|
|
1660
1655
|
{
|
|
1661
1656
|
className: `pl-2.5 pr-2 flex items-center transition-colors duration-200`,
|
|
@@ -1665,14 +1660,14 @@ var SelectTrigger = forwardRef3(
|
|
|
1665
1660
|
children: icon
|
|
1666
1661
|
}
|
|
1667
1662
|
),
|
|
1668
|
-
/* @__PURE__ */
|
|
1663
|
+
/* @__PURE__ */ jsx19(
|
|
1669
1664
|
"div",
|
|
1670
1665
|
{
|
|
1671
1666
|
className: `flex-1 truncate text-sm ${icon ? "" : "pl-2.5"} ${!selectedValue && selectedValue !== 0 && selectedValue !== false ? "text-gray-400 dark:text-zinc-500" : ""}`,
|
|
1672
1667
|
children: displayValue
|
|
1673
1668
|
}
|
|
1674
1669
|
),
|
|
1675
|
-
/* @__PURE__ */
|
|
1670
|
+
/* @__PURE__ */ jsx19("div", { className: "pr-2.5 flex items-center gap-1 shrink-0", children: /* @__PURE__ */ jsx19(
|
|
1676
1671
|
ChevronDown2,
|
|
1677
1672
|
{
|
|
1678
1673
|
className: `h-4 w-4 text-gray-400 transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
@@ -1687,7 +1682,7 @@ SelectTrigger.displayName = "SelectTrigger";
|
|
|
1687
1682
|
var SelectContent = forwardRef3(
|
|
1688
1683
|
({ children, className = "", style, ...props }, ref) => {
|
|
1689
1684
|
const { isOpen, setIsOpen, dropdownAnchorRef, dropdownContentRef } = useSelectContext();
|
|
1690
|
-
const [dropdownStyle, setDropdownStyle] =
|
|
1685
|
+
const [dropdownStyle, setDropdownStyle] = useState9({});
|
|
1691
1686
|
const updateDropdownPosition = () => {
|
|
1692
1687
|
if (dropdownAnchorRef.current) {
|
|
1693
1688
|
const rect = dropdownAnchorRef.current.getBoundingClientRect();
|
|
@@ -1718,7 +1713,7 @@ var SelectContent = forwardRef3(
|
|
|
1718
1713
|
}, [isOpen]);
|
|
1719
1714
|
if (!isOpen || typeof document === "undefined") return null;
|
|
1720
1715
|
return createPortal(
|
|
1721
|
-
/* @__PURE__ */
|
|
1716
|
+
/* @__PURE__ */ jsx19(
|
|
1722
1717
|
"div",
|
|
1723
1718
|
{
|
|
1724
1719
|
ref: dropdownContentRef,
|
|
@@ -1726,7 +1721,7 @@ var SelectContent = forwardRef3(
|
|
|
1726
1721
|
style: { ...dropdownStyle, ...style },
|
|
1727
1722
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1728
1723
|
...props,
|
|
1729
|
-
children: /* @__PURE__ */
|
|
1724
|
+
children: /* @__PURE__ */ jsx19("div", { className: "flex flex-col gap-0.5", children: React6.Children.count(children) === 0 ? /* @__PURE__ */ jsx19("div", { className: "p-3 text-center text-sm text-gray-500", children: "No options available" }) : children })
|
|
1730
1725
|
}
|
|
1731
1726
|
),
|
|
1732
1727
|
document.body
|
|
@@ -1757,7 +1752,7 @@ var SelectItem = forwardRef3(
|
|
|
1757
1752
|
setIsOpen(false);
|
|
1758
1753
|
fieldInternalProps?.onBlur?.();
|
|
1759
1754
|
};
|
|
1760
|
-
return /* @__PURE__ */
|
|
1755
|
+
return /* @__PURE__ */ jsxs13(
|
|
1761
1756
|
"button",
|
|
1762
1757
|
{
|
|
1763
1758
|
ref,
|
|
@@ -1773,8 +1768,8 @@ var SelectItem = forwardRef3(
|
|
|
1773
1768
|
},
|
|
1774
1769
|
...props,
|
|
1775
1770
|
children: [
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
isSelected && /* @__PURE__ */
|
|
1771
|
+
/* @__PURE__ */ jsx19("span", { className: "whitespace-nowrap truncate flex-1", children: children || label }),
|
|
1772
|
+
isSelected && /* @__PURE__ */ jsx19(
|
|
1778
1773
|
Check2,
|
|
1779
1774
|
{
|
|
1780
1775
|
className: "h-4 w-4 shrink-0 ml-2",
|
|
@@ -1789,11 +1784,11 @@ var SelectItem = forwardRef3(
|
|
|
1789
1784
|
SelectItem.displayName = "SelectItem";
|
|
1790
1785
|
|
|
1791
1786
|
// src/components/Fields/textArea.tsx
|
|
1792
|
-
import { forwardRef as forwardRef4, useEffect as useEffect7, useState as
|
|
1787
|
+
import { forwardRef as forwardRef4, useEffect as useEffect7, useState as useState10 } from "react";
|
|
1793
1788
|
import {
|
|
1794
1789
|
Controller as Controller4
|
|
1795
1790
|
} from "react-hook-form";
|
|
1796
|
-
import { jsx as
|
|
1791
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1797
1792
|
var Textarea = forwardRef4(
|
|
1798
1793
|
({
|
|
1799
1794
|
label,
|
|
@@ -1806,7 +1801,7 @@ var Textarea = forwardRef4(
|
|
|
1806
1801
|
className = "",
|
|
1807
1802
|
...props
|
|
1808
1803
|
}, ref) => {
|
|
1809
|
-
const [isFocused, setIsFocused] =
|
|
1804
|
+
const [isFocused, setIsFocused] = useState10(false);
|
|
1810
1805
|
const { theme } = useWarqadConfig();
|
|
1811
1806
|
const primaryColor = theme?.primaryColor;
|
|
1812
1807
|
let message = error;
|
|
@@ -1817,8 +1812,8 @@ var Textarea = forwardRef4(
|
|
|
1817
1812
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1818
1813
|
message = errorObj?.message;
|
|
1819
1814
|
}
|
|
1820
|
-
const renderInput = (inputProps, ref2) => /* @__PURE__ */
|
|
1821
|
-
/* @__PURE__ */
|
|
1815
|
+
const renderInput = (inputProps, ref2) => /* @__PURE__ */ jsxs14("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
|
|
1816
|
+
/* @__PURE__ */ jsxs14(
|
|
1822
1817
|
"label",
|
|
1823
1818
|
{
|
|
1824
1819
|
htmlFor: props.id,
|
|
@@ -1826,11 +1821,11 @@ var Textarea = forwardRef4(
|
|
|
1826
1821
|
style: { color: isFocused ? primaryColor : void 0 },
|
|
1827
1822
|
children: [
|
|
1828
1823
|
label,
|
|
1829
|
-
props.required && /* @__PURE__ */
|
|
1824
|
+
props.required && /* @__PURE__ */ jsx20("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1830
1825
|
]
|
|
1831
1826
|
}
|
|
1832
1827
|
),
|
|
1833
|
-
/* @__PURE__ */
|
|
1828
|
+
/* @__PURE__ */ jsx20("div", { className: "relative", children: /* @__PURE__ */ jsx20(
|
|
1834
1829
|
"textarea",
|
|
1835
1830
|
{
|
|
1836
1831
|
ref: ref2,
|
|
@@ -1851,7 +1846,7 @@ var Textarea = forwardRef4(
|
|
|
1851
1846
|
...inputProps
|
|
1852
1847
|
}
|
|
1853
1848
|
) }),
|
|
1854
|
-
message && /* @__PURE__ */
|
|
1849
|
+
message && /* @__PURE__ */ jsx20("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1855
1850
|
] });
|
|
1856
1851
|
useEffect7(() => {
|
|
1857
1852
|
if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
@@ -1862,7 +1857,7 @@ var Textarea = forwardRef4(
|
|
|
1862
1857
|
}
|
|
1863
1858
|
}, [props.value, name, form]);
|
|
1864
1859
|
if (form && name) {
|
|
1865
|
-
return /* @__PURE__ */
|
|
1860
|
+
return /* @__PURE__ */ jsx20(
|
|
1866
1861
|
Controller4,
|
|
1867
1862
|
{
|
|
1868
1863
|
control: form.control,
|
|
@@ -1901,7 +1896,7 @@ var Textarea = forwardRef4(
|
|
|
1901
1896
|
import {
|
|
1902
1897
|
createContext as createContext4,
|
|
1903
1898
|
useContext as useContext4,
|
|
1904
|
-
useState as
|
|
1899
|
+
useState as useState12,
|
|
1905
1900
|
useRef as useRef4,
|
|
1906
1901
|
useEffect as useEffect8,
|
|
1907
1902
|
forwardRef as forwardRef5
|
|
@@ -1910,7 +1905,7 @@ import { createPortal as createPortal2 } from "react-dom";
|
|
|
1910
1905
|
import { Search, Loader2 as Loader22, ChevronDown as ChevronDown3, Check as Check3, X as X2 } from "lucide-react";
|
|
1911
1906
|
|
|
1912
1907
|
// src/hooks/Fetches/useApis.tsx
|
|
1913
|
-
import { useState as
|
|
1908
|
+
import { useState as useState11, useMemo as useMemo2 } from "react";
|
|
1914
1909
|
import axios from "axios";
|
|
1915
1910
|
var useApi = () => {
|
|
1916
1911
|
const { api: configApi } = useWarqadConfig();
|
|
@@ -1921,10 +1916,10 @@ var useApi = () => {
|
|
|
1921
1916
|
withCredentials: true
|
|
1922
1917
|
});
|
|
1923
1918
|
}, [configApi]);
|
|
1924
|
-
const [data, setData] =
|
|
1925
|
-
const [isLoading, setIsLoading] =
|
|
1926
|
-
const [pdfLoading, setPdfLoading] =
|
|
1927
|
-
const [error, setError] =
|
|
1919
|
+
const [data, setData] = useState11();
|
|
1920
|
+
const [isLoading, setIsLoading] = useState11(false);
|
|
1921
|
+
const [pdfLoading, setPdfLoading] = useState11(false);
|
|
1922
|
+
const [error, setError] = useState11(null);
|
|
1928
1923
|
const get = async ({ url, v = 1, params, delay }) => {
|
|
1929
1924
|
setIsLoading(true);
|
|
1930
1925
|
try {
|
|
@@ -2076,7 +2071,7 @@ var useApis_default = useApi;
|
|
|
2076
2071
|
|
|
2077
2072
|
// src/components/Fields/searchApi.tsx
|
|
2078
2073
|
import { Controller as Controller5 } from "react-hook-form";
|
|
2079
|
-
import { Fragment as
|
|
2074
|
+
import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2080
2075
|
var SearchApiContext = createContext4(
|
|
2081
2076
|
void 0
|
|
2082
2077
|
);
|
|
@@ -2100,12 +2095,12 @@ var SearchApi = forwardRef5(
|
|
|
2100
2095
|
}
|
|
2101
2096
|
}, [value, name, form]);
|
|
2102
2097
|
if (form && name) {
|
|
2103
|
-
return /* @__PURE__ */
|
|
2098
|
+
return /* @__PURE__ */ jsx21(
|
|
2104
2099
|
Controller5,
|
|
2105
2100
|
{
|
|
2106
2101
|
name,
|
|
2107
2102
|
control: form.control,
|
|
2108
|
-
render: ({ field }) => /* @__PURE__ */
|
|
2103
|
+
render: ({ field }) => /* @__PURE__ */ jsx21(
|
|
2109
2104
|
SearchApiRoot,
|
|
2110
2105
|
{
|
|
2111
2106
|
...restProps,
|
|
@@ -2125,7 +2120,7 @@ var SearchApi = forwardRef5(
|
|
|
2125
2120
|
}
|
|
2126
2121
|
);
|
|
2127
2122
|
}
|
|
2128
|
-
return /* @__PURE__ */
|
|
2123
|
+
return /* @__PURE__ */ jsx21(
|
|
2129
2124
|
SearchApiRoot,
|
|
2130
2125
|
{
|
|
2131
2126
|
...restProps,
|
|
@@ -2168,15 +2163,15 @@ var SearchApiRoot = ({
|
|
|
2168
2163
|
className = "",
|
|
2169
2164
|
...props
|
|
2170
2165
|
}) => {
|
|
2171
|
-
const [searchTerm, setSearchTerm] =
|
|
2166
|
+
const [searchTerm, setSearchTerm] = useState12("");
|
|
2172
2167
|
const { theme } = useWarqadConfig();
|
|
2173
2168
|
const primaryColor = theme?.primaryColor;
|
|
2174
|
-
const [options, setOptions] =
|
|
2175
|
-
const [isOpen, setIsOpen] =
|
|
2176
|
-
const [isFocused, setIsFocused] =
|
|
2177
|
-
const [activeIndex, setActiveIndex] =
|
|
2178
|
-
const [selectedObject, setSelectedObject] =
|
|
2179
|
-
const [hasAttemptedHydration, setHasAttemptedHydration] =
|
|
2169
|
+
const [options, setOptions] = useState12([]);
|
|
2170
|
+
const [isOpen, setIsOpen] = useState12(false);
|
|
2171
|
+
const [isFocused, setIsFocused] = useState12(false);
|
|
2172
|
+
const [activeIndex, setActiveIndex] = useState12(-1);
|
|
2173
|
+
const [selectedObject, setSelectedObject] = useState12(void 0);
|
|
2174
|
+
const [hasAttemptedHydration, setHasAttemptedHydration] = useState12(false);
|
|
2180
2175
|
const containerRef = useRef4(null);
|
|
2181
2176
|
const dropdownAnchorRef = useRef4(null);
|
|
2182
2177
|
const dropdownContentRef = useRef4(null);
|
|
@@ -2393,26 +2388,26 @@ var SearchApiRoot = ({
|
|
|
2393
2388
|
onClear
|
|
2394
2389
|
};
|
|
2395
2390
|
const hasChildren = !!children;
|
|
2396
|
-
return /* @__PURE__ */
|
|
2391
|
+
return /* @__PURE__ */ jsx21(SearchApiContext.Provider, { value: valueCtx, children: /* @__PURE__ */ jsxs15(
|
|
2397
2392
|
"div",
|
|
2398
2393
|
{
|
|
2399
2394
|
ref: containerRef,
|
|
2400
2395
|
className: `${label ? "space-y-2" : ""} group relative ${containerClassName}`,
|
|
2401
2396
|
children: [
|
|
2402
|
-
label && /* @__PURE__ */
|
|
2397
|
+
label && /* @__PURE__ */ jsxs15(
|
|
2403
2398
|
"label",
|
|
2404
2399
|
{
|
|
2405
2400
|
className: `block text-xs font-medium transition-colors duration-200`,
|
|
2406
2401
|
style: { color: isFocused || isOpen ? primaryColor : void 0 },
|
|
2407
2402
|
children: [
|
|
2408
2403
|
label,
|
|
2409
|
-
required && /* @__PURE__ */
|
|
2404
|
+
required && /* @__PURE__ */ jsx21("span", { className: "text-red-500 ml-1", children: "*" })
|
|
2410
2405
|
]
|
|
2411
2406
|
}
|
|
2412
2407
|
),
|
|
2413
|
-
hasChildren ? children : /* @__PURE__ */
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2408
|
+
hasChildren ? children : /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
2409
|
+
/* @__PURE__ */ jsx21(SearchApiTrigger, { className, children: /* @__PURE__ */ jsx21(SearchApiInput, { ...props }) }),
|
|
2410
|
+
/* @__PURE__ */ jsx21(SearchApiContent, { children: filteredOptions.map((opt, index) => /* @__PURE__ */ jsx21(
|
|
2416
2411
|
SearchApiItem,
|
|
2417
2412
|
{
|
|
2418
2413
|
option: opt,
|
|
@@ -2442,7 +2437,7 @@ var SearchApiTrigger = forwardRef5(
|
|
|
2442
2437
|
inputRef,
|
|
2443
2438
|
searchTerm
|
|
2444
2439
|
} = useSearchApiContext();
|
|
2445
|
-
return /* @__PURE__ */
|
|
2440
|
+
return /* @__PURE__ */ jsx21("div", { className: "relative", ref: dropdownAnchorRef, children: /* @__PURE__ */ jsxs15(
|
|
2446
2441
|
"div",
|
|
2447
2442
|
{
|
|
2448
2443
|
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}`,
|
|
@@ -2459,25 +2454,25 @@ var SearchApiTrigger = forwardRef5(
|
|
|
2459
2454
|
},
|
|
2460
2455
|
...props,
|
|
2461
2456
|
children: [
|
|
2462
|
-
/* @__PURE__ */
|
|
2457
|
+
/* @__PURE__ */ jsx21(
|
|
2463
2458
|
"div",
|
|
2464
2459
|
{
|
|
2465
2460
|
className: `${variant === "ghost" ? "pl-0" : "pl-2.5"} text-gray-400`,
|
|
2466
|
-
children: /* @__PURE__ */
|
|
2461
|
+
children: /* @__PURE__ */ jsx21(Search, { className: "h-4 w-4" })
|
|
2467
2462
|
}
|
|
2468
2463
|
),
|
|
2469
|
-
/* @__PURE__ */
|
|
2470
|
-
/* @__PURE__ */
|
|
2471
|
-
selectedValue && !disabled && /* @__PURE__ */
|
|
2464
|
+
/* @__PURE__ */ jsx21("div", { className: "flex-1 relative ms-2", children }),
|
|
2465
|
+
/* @__PURE__ */ jsx21("div", { className: "pr-2.5 w-16! flex items-center gap-1 shrink-0 min-w-10 justify-end", children: isLoading ? /* @__PURE__ */ jsx21(Loader22, { className: "h-4 w-4 animate-spin text-blue-500 shrink-0" }) : /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
|
|
2466
|
+
selectedValue && !disabled && /* @__PURE__ */ jsx21(
|
|
2472
2467
|
"button",
|
|
2473
2468
|
{
|
|
2474
2469
|
onClick: clearSelection,
|
|
2475
2470
|
type: "button",
|
|
2476
2471
|
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",
|
|
2477
|
-
children: /* @__PURE__ */
|
|
2472
|
+
children: /* @__PURE__ */ jsx21(X2, { className: "h-3 w-3" })
|
|
2478
2473
|
}
|
|
2479
2474
|
),
|
|
2480
|
-
/* @__PURE__ */
|
|
2475
|
+
/* @__PURE__ */ jsx21(
|
|
2481
2476
|
ChevronDown3,
|
|
2482
2477
|
{
|
|
2483
2478
|
className: `h-4 w-4 text-gray-400 transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
@@ -2557,9 +2552,9 @@ var SearchApiInput = forwardRef5(
|
|
|
2557
2552
|
break;
|
|
2558
2553
|
}
|
|
2559
2554
|
};
|
|
2560
|
-
return /* @__PURE__ */
|
|
2561
|
-
!isOpen && (selectedValue !== void 0 && selectedValue !== null && selectedValue !== "") && /* @__PURE__ */
|
|
2562
|
-
/* @__PURE__ */
|
|
2555
|
+
return /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
2556
|
+
!isOpen && (selectedValue !== void 0 && selectedValue !== null && selectedValue !== "") && /* @__PURE__ */ jsx21("div", { className: "absolute inset-0 flex items-center ms-1 truncate select-none", children: getDisplayValue() }),
|
|
2557
|
+
/* @__PURE__ */ jsx21(
|
|
2563
2558
|
"input",
|
|
2564
2559
|
{
|
|
2565
2560
|
ref: setInternalInputRef,
|
|
@@ -2614,7 +2609,7 @@ var SearchApiContent = forwardRef5(
|
|
|
2614
2609
|
options,
|
|
2615
2610
|
error
|
|
2616
2611
|
} = useSearchApiContext();
|
|
2617
|
-
const [dropdownStyle, setDropdownStyle] =
|
|
2612
|
+
const [dropdownStyle, setDropdownStyle] = useState12({});
|
|
2618
2613
|
const updateDropdownPosition = () => {
|
|
2619
2614
|
if (dropdownAnchorRef.current) {
|
|
2620
2615
|
const rect = dropdownAnchorRef.current.getBoundingClientRect();
|
|
@@ -2645,7 +2640,7 @@ var SearchApiContent = forwardRef5(
|
|
|
2645
2640
|
}, [isOpen]);
|
|
2646
2641
|
if (!isOpen || typeof document === "undefined") return null;
|
|
2647
2642
|
return createPortal2(
|
|
2648
|
-
/* @__PURE__ */
|
|
2643
|
+
/* @__PURE__ */ jsxs15(
|
|
2649
2644
|
"div",
|
|
2650
2645
|
{
|
|
2651
2646
|
ref: dropdownContentRef,
|
|
@@ -2654,11 +2649,11 @@ var SearchApiContent = forwardRef5(
|
|
|
2654
2649
|
onMouseDown: (e) => e.stopPropagation(),
|
|
2655
2650
|
...props,
|
|
2656
2651
|
children: [
|
|
2657
|
-
error && /* @__PURE__ */
|
|
2658
|
-
isLoading && options.length === 0 ? /* @__PURE__ */
|
|
2659
|
-
/* @__PURE__ */
|
|
2652
|
+
error && /* @__PURE__ */ jsx21("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 }),
|
|
2653
|
+
isLoading && options.length === 0 ? /* @__PURE__ */ jsxs15("div", { className: "p-4 text-center text-sm text-gray-500", children: [
|
|
2654
|
+
/* @__PURE__ */ jsx21(Loader22, { className: "h-5 w-5 animate-spin mx-auto mb-2" }),
|
|
2660
2655
|
"Loading options..."
|
|
2661
|
-
] }) : children ? /* @__PURE__ */
|
|
2656
|
+
] }) : children ? /* @__PURE__ */ jsx21("div", { className: "py-1", children }) : /* @__PURE__ */ jsx21("div", { className: "p-4 text-center text-sm text-gray-500", children: searchTerm ? `No results for "${searchTerm}"` : "No options available" })
|
|
2662
2657
|
]
|
|
2663
2658
|
}
|
|
2664
2659
|
),
|
|
@@ -2687,7 +2682,7 @@ var SearchApiItem = forwardRef5(
|
|
|
2687
2682
|
const optValue = getOptionValue(option);
|
|
2688
2683
|
const isSelected = selectedValue === optValue;
|
|
2689
2684
|
const isHighlighted = index === activeIndex;
|
|
2690
|
-
return /* @__PURE__ */
|
|
2685
|
+
return /* @__PURE__ */ jsxs15(
|
|
2691
2686
|
"button",
|
|
2692
2687
|
{
|
|
2693
2688
|
ref,
|
|
@@ -2706,8 +2701,8 @@ var SearchApiItem = forwardRef5(
|
|
|
2706
2701
|
onMouseEnter: () => setActiveIndex(index),
|
|
2707
2702
|
...props,
|
|
2708
2703
|
children: [
|
|
2709
|
-
/* @__PURE__ */
|
|
2710
|
-
isSelected && /* @__PURE__ */
|
|
2704
|
+
/* @__PURE__ */ jsx21("span", { className: "truncate", children: option[labelKey] }),
|
|
2705
|
+
isSelected && /* @__PURE__ */ jsx21(Check3, { className: "h-4 w-4", style: { color: primaryColor } })
|
|
2711
2706
|
]
|
|
2712
2707
|
},
|
|
2713
2708
|
optValue || index
|
|
@@ -2717,7 +2712,7 @@ var SearchApiItem = forwardRef5(
|
|
|
2717
2712
|
SearchApiItem.displayName = "SearchApiItem";
|
|
2718
2713
|
|
|
2719
2714
|
// src/components/Fields/date.tsx
|
|
2720
|
-
import { forwardRef as forwardRef6, useState as
|
|
2715
|
+
import { forwardRef as forwardRef6, useState as useState13 } from "react";
|
|
2721
2716
|
import { DatePicker } from "antd";
|
|
2722
2717
|
import {
|
|
2723
2718
|
Controller as Controller6
|
|
@@ -2725,7 +2720,7 @@ import {
|
|
|
2725
2720
|
import dayjs from "dayjs";
|
|
2726
2721
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
2727
2722
|
import { Calendar } from "lucide-react";
|
|
2728
|
-
import { jsx as
|
|
2723
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2729
2724
|
dayjs.extend(customParseFormat);
|
|
2730
2725
|
var DateInput = forwardRef6(
|
|
2731
2726
|
({
|
|
@@ -2744,7 +2739,7 @@ var DateInput = forwardRef6(
|
|
|
2744
2739
|
}, ref) => {
|
|
2745
2740
|
const { theme } = useWarqadConfig();
|
|
2746
2741
|
const primaryColor = theme?.primaryColor;
|
|
2747
|
-
const [isFocused, setIsFocused] =
|
|
2742
|
+
const [isFocused, setIsFocused] = useState13(false);
|
|
2748
2743
|
let message = error;
|
|
2749
2744
|
if (form && name) {
|
|
2750
2745
|
const {
|
|
@@ -2762,7 +2757,7 @@ var DateInput = forwardRef6(
|
|
|
2762
2757
|
${className}`;
|
|
2763
2758
|
const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
|
|
2764
2759
|
const dateValue = val && typeof val === "string" ? dayjs(val, "DD/MM/YYYY", true) : dayjs.isDayjs(val) ? val : null;
|
|
2765
|
-
return /* @__PURE__ */
|
|
2760
|
+
return /* @__PURE__ */ jsx22(
|
|
2766
2761
|
DatePicker,
|
|
2767
2762
|
{
|
|
2768
2763
|
ref: refProps,
|
|
@@ -2789,7 +2784,7 @@ var DateInput = forwardRef6(
|
|
|
2789
2784
|
boxShadow: isFocused && !message ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
2790
2785
|
},
|
|
2791
2786
|
classNames: { popup: { root: "z-50" } },
|
|
2792
|
-
suffixIcon: /* @__PURE__ */
|
|
2787
|
+
suffixIcon: /* @__PURE__ */ jsx22(
|
|
2793
2788
|
Calendar,
|
|
2794
2789
|
{
|
|
2795
2790
|
className: "h-5 w-5 text-gray-400",
|
|
@@ -2801,8 +2796,8 @@ var DateInput = forwardRef6(
|
|
|
2801
2796
|
}
|
|
2802
2797
|
);
|
|
2803
2798
|
};
|
|
2804
|
-
return /* @__PURE__ */
|
|
2805
|
-
label && /* @__PURE__ */
|
|
2799
|
+
return /* @__PURE__ */ jsxs16("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
2800
|
+
label && /* @__PURE__ */ jsxs16(
|
|
2806
2801
|
"label",
|
|
2807
2802
|
{
|
|
2808
2803
|
className: "block text-xs font-medium transition-colors duration-200",
|
|
@@ -2811,11 +2806,11 @@ var DateInput = forwardRef6(
|
|
|
2811
2806
|
},
|
|
2812
2807
|
children: [
|
|
2813
2808
|
label,
|
|
2814
|
-
props.required && /* @__PURE__ */
|
|
2809
|
+
props.required && /* @__PURE__ */ jsx22("span", { className: "text-red-500 ml-1", children: "*" })
|
|
2815
2810
|
]
|
|
2816
2811
|
}
|
|
2817
2812
|
),
|
|
2818
|
-
form && name ? /* @__PURE__ */
|
|
2813
|
+
form && name ? /* @__PURE__ */ jsx22(
|
|
2819
2814
|
Controller6,
|
|
2820
2815
|
{
|
|
2821
2816
|
control: form.control,
|
|
@@ -2828,7 +2823,7 @@ var DateInput = forwardRef6(
|
|
|
2828
2823
|
)
|
|
2829
2824
|
}
|
|
2830
2825
|
) : renderDatePicker(value, onChange, onBlur, ref),
|
|
2831
|
-
message && /* @__PURE__ */
|
|
2826
|
+
message && /* @__PURE__ */ jsx22("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
2832
2827
|
] });
|
|
2833
2828
|
}
|
|
2834
2829
|
);
|
|
@@ -2852,7 +2847,7 @@ var Fields = {
|
|
|
2852
2847
|
var Fields_default = Fields;
|
|
2853
2848
|
|
|
2854
2849
|
// src/components/tables/DataTable.tsx
|
|
2855
|
-
import React8, { useState as
|
|
2850
|
+
import React8, { useState as useState14, useMemo as useMemo3, useEffect as useEffect9 } from "react";
|
|
2856
2851
|
import {
|
|
2857
2852
|
useReactTable,
|
|
2858
2853
|
getCoreRowModel,
|
|
@@ -2863,7 +2858,7 @@ import {
|
|
|
2863
2858
|
flexRender
|
|
2864
2859
|
} from "@tanstack/react-table";
|
|
2865
2860
|
import { ChevronDown as ChevronDown4, Search as Search2 } from "lucide-react";
|
|
2866
|
-
import { Fragment as
|
|
2861
|
+
import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2867
2862
|
function DataTable({
|
|
2868
2863
|
columns: userColumns,
|
|
2869
2864
|
data,
|
|
@@ -2885,9 +2880,9 @@ function DataTable({
|
|
|
2885
2880
|
}) {
|
|
2886
2881
|
const { theme } = useWarqadConfig();
|
|
2887
2882
|
const primaryColor = theme?.primaryColor;
|
|
2888
|
-
const [sorting, setSorting] =
|
|
2889
|
-
const [columnFilters, setColumnFilters] =
|
|
2890
|
-
const [columnVisibility, setColumnVisibility] =
|
|
2883
|
+
const [sorting, setSorting] = useState14([]);
|
|
2884
|
+
const [columnFilters, setColumnFilters] = useState14([]);
|
|
2885
|
+
const [columnVisibility, setColumnVisibility] = useState14(
|
|
2891
2886
|
() => {
|
|
2892
2887
|
const initialVisibility = {};
|
|
2893
2888
|
userColumns.forEach((col) => {
|
|
@@ -2901,9 +2896,9 @@ function DataTable({
|
|
|
2901
2896
|
return initialVisibility;
|
|
2902
2897
|
}
|
|
2903
2898
|
);
|
|
2904
|
-
const [rowSelection, setRowSelection] =
|
|
2905
|
-
const [globalFilter, setGlobalFilter] =
|
|
2906
|
-
const [pagination, setPagination] =
|
|
2899
|
+
const [rowSelection, setRowSelection] = useState14({});
|
|
2900
|
+
const [globalFilter, setGlobalFilter] = useState14("");
|
|
2901
|
+
const [pagination, setPagination] = useState14({
|
|
2907
2902
|
pageIndex: 0,
|
|
2908
2903
|
pageSize: pageRows || 10
|
|
2909
2904
|
});
|
|
@@ -2912,7 +2907,7 @@ function DataTable({
|
|
|
2912
2907
|
setPagination((prev) => ({ ...prev, pageSize: pageRows }));
|
|
2913
2908
|
}
|
|
2914
2909
|
}, [pageRows]);
|
|
2915
|
-
const [expanded, setExpanded] =
|
|
2910
|
+
const [expanded, setExpanded] = useState14(() => {
|
|
2916
2911
|
const initialState = {};
|
|
2917
2912
|
if (defaultExpanded && renderSubComponent && data) {
|
|
2918
2913
|
data.forEach((row, idx) => {
|
|
@@ -2939,7 +2934,7 @@ function DataTable({
|
|
|
2939
2934
|
{
|
|
2940
2935
|
id: "_index",
|
|
2941
2936
|
header: "#",
|
|
2942
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
2937
|
+
cell: ({ row }) => /* @__PURE__ */ jsx23("span", { className: "text-gray-500 font-medium ml-1", children: row.index + 1 }),
|
|
2943
2938
|
enableSorting: false
|
|
2944
2939
|
},
|
|
2945
2940
|
...mappedColumns
|
|
@@ -2998,29 +2993,29 @@ function DataTable({
|
|
|
2998
2993
|
table.getState().pagination.pageIndex,
|
|
2999
2994
|
table.getState().pagination.pageSize
|
|
3000
2995
|
]);
|
|
3001
|
-
return /* @__PURE__ */
|
|
3002
|
-
filterables && /* @__PURE__ */
|
|
3003
|
-
/* @__PURE__ */
|
|
2996
|
+
return /* @__PURE__ */ jsxs17("div", { className: `space-y-4 w-full ${className}`, children: [
|
|
2997
|
+
filterables && /* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between gap-4", children: [
|
|
2998
|
+
/* @__PURE__ */ jsx23("div", { className: "flex-1 max-w-sm", children: /* @__PURE__ */ jsx23(
|
|
3004
2999
|
Fields_default.Input,
|
|
3005
3000
|
{
|
|
3006
3001
|
placeholder: searchPlaceholder,
|
|
3007
3002
|
value: globalFilter,
|
|
3008
3003
|
onChange: (e) => setGlobalFilter(e.target.value),
|
|
3009
|
-
icon: /* @__PURE__ */
|
|
3004
|
+
icon: /* @__PURE__ */ jsx23(Search2, { size: 16 }),
|
|
3010
3005
|
className: "h-9!"
|
|
3011
3006
|
}
|
|
3012
3007
|
) }),
|
|
3013
|
-
/* @__PURE__ */
|
|
3014
|
-
/* @__PURE__ */
|
|
3008
|
+
/* @__PURE__ */ jsx23("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs17("div", { className: "relative group", children: [
|
|
3009
|
+
/* @__PURE__ */ jsxs17("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: [
|
|
3015
3010
|
"Columns",
|
|
3016
|
-
/* @__PURE__ */
|
|
3011
|
+
/* @__PURE__ */ jsx23(ChevronDown4, { size: 14, className: "text-gray-400" })
|
|
3017
3012
|
] }),
|
|
3018
|
-
/* @__PURE__ */
|
|
3013
|
+
/* @__PURE__ */ jsx23("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__ */ jsxs17(
|
|
3019
3014
|
"label",
|
|
3020
3015
|
{
|
|
3021
3016
|
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",
|
|
3022
3017
|
children: [
|
|
3023
|
-
/* @__PURE__ */
|
|
3018
|
+
/* @__PURE__ */ jsx23(
|
|
3024
3019
|
"input",
|
|
3025
3020
|
{
|
|
3026
3021
|
type: "checkbox",
|
|
@@ -3037,13 +3032,13 @@ function DataTable({
|
|
|
3037
3032
|
)) })
|
|
3038
3033
|
] }) })
|
|
3039
3034
|
] }),
|
|
3040
|
-
/* @__PURE__ */
|
|
3035
|
+
/* @__PURE__ */ jsx23("div", { className: "rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 overflow-hidden relative", children: /* @__PURE__ */ jsx23("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs17(
|
|
3041
3036
|
"table",
|
|
3042
3037
|
{
|
|
3043
3038
|
className: "w-full text-left border-collapse",
|
|
3044
3039
|
style: { accentColor: primaryColor },
|
|
3045
3040
|
children: [
|
|
3046
|
-
/* @__PURE__ */
|
|
3041
|
+
/* @__PURE__ */ jsx23("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__ */ jsx23("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx23(
|
|
3047
3042
|
"th",
|
|
3048
3043
|
{
|
|
3049
3044
|
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" : ""}`,
|
|
@@ -3054,22 +3049,22 @@ function DataTable({
|
|
|
3054
3049
|
},
|
|
3055
3050
|
header.id
|
|
3056
3051
|
)) }, headerGroup.id)) }),
|
|
3057
|
-
/* @__PURE__ */
|
|
3052
|
+
/* @__PURE__ */ jsx23("tbody", { className: "", children: isLoading ? Array.from({ length: pageRows || 5 }).map((_, i) => /* @__PURE__ */ jsx23(
|
|
3058
3053
|
"tr",
|
|
3059
3054
|
{
|
|
3060
3055
|
className: "border-b border-gray-100 dark:border-zinc-800/50",
|
|
3061
|
-
children: columns.map((_2, j) => /* @__PURE__ */
|
|
3056
|
+
children: columns.map((_2, j) => /* @__PURE__ */ jsx23(
|
|
3062
3057
|
"td",
|
|
3063
3058
|
{
|
|
3064
3059
|
className: `${rowPadding} ${verticalLines ? "border-x border-gray-200 dark:border-zinc-800/50" : ""}`,
|
|
3065
|
-
children: /* @__PURE__ */
|
|
3060
|
+
children: /* @__PURE__ */ jsx23("div", { className: "h-4 bg-gray-100 dark:bg-zinc-800 rounded animate-pulse w-full" })
|
|
3066
3061
|
},
|
|
3067
3062
|
`skeleton-cell-${j}`
|
|
3068
3063
|
))
|
|
3069
3064
|
},
|
|
3070
3065
|
`skeleton-${i}`
|
|
3071
|
-
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */
|
|
3072
|
-
/* @__PURE__ */
|
|
3066
|
+
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxs17(React8.Fragment, { children: [
|
|
3067
|
+
/* @__PURE__ */ jsx23(
|
|
3073
3068
|
"tr",
|
|
3074
3069
|
{
|
|
3075
3070
|
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" : ""}`,
|
|
@@ -3084,7 +3079,7 @@ function DataTable({
|
|
|
3084
3079
|
}
|
|
3085
3080
|
}
|
|
3086
3081
|
},
|
|
3087
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */
|
|
3082
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx23(
|
|
3088
3083
|
"td",
|
|
3089
3084
|
{
|
|
3090
3085
|
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" : ""}`,
|
|
@@ -3097,14 +3092,14 @@ function DataTable({
|
|
|
3097
3092
|
))
|
|
3098
3093
|
}
|
|
3099
3094
|
),
|
|
3100
|
-
renderSubComponent && row.getIsExpanded() && hasSubComponent(row.original) && /* @__PURE__ */
|
|
3101
|
-
/* @__PURE__ */
|
|
3095
|
+
renderSubComponent && row.getIsExpanded() && hasSubComponent(row.original) && /* @__PURE__ */ jsx23("tr", { className: "border-b border-gray-200 dark:border-zinc-800 bg-gray-50/20 dark:bg-zinc-900/20", children: /* @__PURE__ */ jsx23("td", { colSpan: columns.length, className: "px-2 py-0", children: /* @__PURE__ */ jsxs17("div", { className: "relative pl-6 pb-2 pr-2 pt-2 h-full", children: [
|
|
3096
|
+
/* @__PURE__ */ jsx23("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" }),
|
|
3102
3097
|
renderSubComponent({
|
|
3103
3098
|
row: row.original,
|
|
3104
3099
|
index: row.index
|
|
3105
3100
|
})
|
|
3106
3101
|
] }) }) })
|
|
3107
|
-
] }, row.id)) : /* @__PURE__ */
|
|
3102
|
+
] }, row.id)) : /* @__PURE__ */ jsx23("tr", { children: /* @__PURE__ */ jsx23(
|
|
3108
3103
|
"td",
|
|
3109
3104
|
{
|
|
3110
3105
|
colSpan: columns.length,
|
|
@@ -3116,7 +3111,7 @@ function DataTable({
|
|
|
3116
3111
|
(group) => group.headers.some(
|
|
3117
3112
|
(header) => header.column.columnDef.footer
|
|
3118
3113
|
)
|
|
3119
|
-
) && /* @__PURE__ */
|
|
3114
|
+
) && /* @__PURE__ */ jsx23("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__ */ jsx23("tr", { children: footerGroup.headers.map((header) => /* @__PURE__ */ jsx23(
|
|
3120
3115
|
"td",
|
|
3121
3116
|
{
|
|
3122
3117
|
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" : ""}`,
|
|
@@ -3130,24 +3125,24 @@ function DataTable({
|
|
|
3130
3125
|
]
|
|
3131
3126
|
}
|
|
3132
3127
|
) }) }),
|
|
3133
|
-
/* @__PURE__ */
|
|
3134
|
-
/* @__PURE__ */
|
|
3128
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between px-2", children: [
|
|
3129
|
+
/* @__PURE__ */ jsx23("div", { className: "flex-1 text-xs text-gray-500", children: selectable && /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
3135
3130
|
table.getFilteredSelectedRowModel().rows.length,
|
|
3136
3131
|
" of",
|
|
3137
3132
|
" ",
|
|
3138
3133
|
table.getFilteredRowModel().rows.length,
|
|
3139
3134
|
" row(s) selected."
|
|
3140
3135
|
] }) }),
|
|
3141
|
-
pageRows && table.getPageCount() > 1 && /* @__PURE__ */
|
|
3142
|
-
/* @__PURE__ */
|
|
3136
|
+
pageRows && table.getPageCount() > 1 && /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
3137
|
+
/* @__PURE__ */ jsxs17("span", { className: "text-sm text-gray-700 dark:text-gray-300 mr-2 select-none", children: [
|
|
3143
3138
|
"Page",
|
|
3144
3139
|
" ",
|
|
3145
|
-
/* @__PURE__ */
|
|
3140
|
+
/* @__PURE__ */ jsx23("span", { className: "font-semibold", children: table.getState().pagination.pageIndex + 1 }),
|
|
3146
3141
|
" ",
|
|
3147
3142
|
"of ",
|
|
3148
|
-
/* @__PURE__ */
|
|
3143
|
+
/* @__PURE__ */ jsx23("span", { className: "font-semibold", children: table.getPageCount() })
|
|
3149
3144
|
] }),
|
|
3150
|
-
/* @__PURE__ */
|
|
3145
|
+
/* @__PURE__ */ jsx23(
|
|
3151
3146
|
"button",
|
|
3152
3147
|
{
|
|
3153
3148
|
onClick: () => table.previousPage(),
|
|
@@ -3156,7 +3151,7 @@ function DataTable({
|
|
|
3156
3151
|
children: "Previous"
|
|
3157
3152
|
}
|
|
3158
3153
|
),
|
|
3159
|
-
/* @__PURE__ */
|
|
3154
|
+
/* @__PURE__ */ jsx23(
|
|
3160
3155
|
"button",
|
|
3161
3156
|
{
|
|
3162
3157
|
onClick: () => table.nextPage(),
|
|
@@ -3172,7 +3167,7 @@ function DataTable({
|
|
|
3172
3167
|
|
|
3173
3168
|
// src/components/tables/PostTable.tsx
|
|
3174
3169
|
import React9, {
|
|
3175
|
-
useState as
|
|
3170
|
+
useState as useState15,
|
|
3176
3171
|
useMemo as useMemo4,
|
|
3177
3172
|
useEffect as useEffect10,
|
|
3178
3173
|
useRef as useRef5,
|
|
@@ -3195,14 +3190,14 @@ import {
|
|
|
3195
3190
|
ChevronDown as ChevronDown5,
|
|
3196
3191
|
Loader2 as Loader23
|
|
3197
3192
|
} from "lucide-react";
|
|
3198
|
-
import { Fragment as
|
|
3193
|
+
import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3199
3194
|
var TableCell = React9.memo(
|
|
3200
3195
|
({
|
|
3201
3196
|
cell,
|
|
3202
3197
|
rowPadding,
|
|
3203
3198
|
verticalLines
|
|
3204
3199
|
}) => {
|
|
3205
|
-
return /* @__PURE__ */
|
|
3200
|
+
return /* @__PURE__ */ jsx24(
|
|
3206
3201
|
"td",
|
|
3207
3202
|
{
|
|
3208
3203
|
className: cn(
|
|
@@ -3237,8 +3232,8 @@ var TableRow = React9.memo(
|
|
|
3237
3232
|
}) => {
|
|
3238
3233
|
const isExpanded = row.getIsExpanded();
|
|
3239
3234
|
const subComponentVisible = renderSubComponent && isExpanded && hasSubComponent(row.original);
|
|
3240
|
-
return /* @__PURE__ */
|
|
3241
|
-
/* @__PURE__ */
|
|
3235
|
+
return /* @__PURE__ */ jsxs18(React9.Fragment, { children: [
|
|
3236
|
+
/* @__PURE__ */ jsx24(
|
|
3242
3237
|
"tr",
|
|
3243
3238
|
{
|
|
3244
3239
|
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" : ""}`,
|
|
@@ -3251,7 +3246,7 @@ var TableRow = React9.memo(
|
|
|
3251
3246
|
}
|
|
3252
3247
|
}
|
|
3253
3248
|
},
|
|
3254
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */
|
|
3249
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx24(
|
|
3255
3250
|
TableCell,
|
|
3256
3251
|
{
|
|
3257
3252
|
cell,
|
|
@@ -3262,8 +3257,8 @@ var TableRow = React9.memo(
|
|
|
3262
3257
|
))
|
|
3263
3258
|
}
|
|
3264
3259
|
),
|
|
3265
|
-
subComponentVisible && /* @__PURE__ */
|
|
3266
|
-
/* @__PURE__ */
|
|
3260
|
+
subComponentVisible && /* @__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: columnsCount, className: "px-2 py-0", children: /* @__PURE__ */ jsxs18("div", { className: "relative pl-6 pb-2 pr-2 pt-2 h-full", children: [
|
|
3261
|
+
/* @__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" }),
|
|
3267
3262
|
renderSubComponent({
|
|
3268
3263
|
row: row.original,
|
|
3269
3264
|
index: row.index
|
|
@@ -3296,10 +3291,10 @@ function PostTable({
|
|
|
3296
3291
|
}) {
|
|
3297
3292
|
const { theme } = useWarqadConfig();
|
|
3298
3293
|
const primaryColor = theme?.primaryColor;
|
|
3299
|
-
const [sorting, setSorting] =
|
|
3300
|
-
const [columnFilters, setColumnFilters] =
|
|
3301
|
-
const [columnVisibility, setColumnVisibility] =
|
|
3302
|
-
const [expanded, setExpanded] =
|
|
3294
|
+
const [sorting, setSorting] = useState15([]);
|
|
3295
|
+
const [columnFilters, setColumnFilters] = useState15([]);
|
|
3296
|
+
const [columnVisibility, setColumnVisibility] = useState15({});
|
|
3297
|
+
const [expanded, setExpanded] = useState15(() => {
|
|
3303
3298
|
const initialState = {};
|
|
3304
3299
|
if (defaultExpanded && renderSubComponent && controlledData) {
|
|
3305
3300
|
controlledData.forEach((row, idx) => {
|
|
@@ -3310,7 +3305,7 @@ function PostTable({
|
|
|
3310
3305
|
}
|
|
3311
3306
|
return initialState;
|
|
3312
3307
|
});
|
|
3313
|
-
const [internalData, setInternalData] =
|
|
3308
|
+
const [internalData, setInternalData] = useState15(controlledData || []);
|
|
3314
3309
|
const isControlled = controlledData !== void 0;
|
|
3315
3310
|
const data = isControlled ? controlledData : internalData;
|
|
3316
3311
|
const entryRowRef = useRef5(null);
|
|
@@ -3333,10 +3328,10 @@ function PostTable({
|
|
|
3333
3328
|
useEffect10(() => {
|
|
3334
3329
|
focusAndScrollEntryRow();
|
|
3335
3330
|
}, []);
|
|
3336
|
-
const [entryData, setEntryData] =
|
|
3337
|
-
const [editingIndex, setEditingIndex] =
|
|
3338
|
-
const [isSavingAsync, setIsSavingAsync] =
|
|
3339
|
-
const [fieldErrors, setFieldErrors] =
|
|
3331
|
+
const [entryData, setEntryData] = useState15({});
|
|
3332
|
+
const [editingIndex, setEditingIndex] = useState15(null);
|
|
3333
|
+
const [isSavingAsync, setIsSavingAsync] = useState15(false);
|
|
3334
|
+
const [fieldErrors, setFieldErrors] = useState15({});
|
|
3340
3335
|
const latestStateRef = useRef5({
|
|
3341
3336
|
data,
|
|
3342
3337
|
entryData,
|
|
@@ -3503,25 +3498,25 @@ function PostTable({
|
|
|
3503
3498
|
header: "Actions",
|
|
3504
3499
|
cell: ({ row, table: table2 }) => {
|
|
3505
3500
|
const { handleEdit: handleEdit2, handleDelete: handleDelete2, submitLoading: submitLoading2, isSavingAsync: isSavingAsync2 } = table2.options.meta;
|
|
3506
|
-
return /* @__PURE__ */
|
|
3507
|
-
/* @__PURE__ */
|
|
3501
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
3502
|
+
/* @__PURE__ */ jsx24(
|
|
3508
3503
|
"button",
|
|
3509
3504
|
{
|
|
3510
3505
|
onClick: () => handleEdit2(row.index, row.original),
|
|
3511
3506
|
disabled: submitLoading2 || isSavingAsync2,
|
|
3512
3507
|
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",
|
|
3513
3508
|
title: "Edit",
|
|
3514
|
-
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */
|
|
3509
|
+
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */ jsx24(Loader23, { size: 16, className: "animate-spin" }) : /* @__PURE__ */ jsx24(Edit2, { size: 16 })
|
|
3515
3510
|
}
|
|
3516
3511
|
),
|
|
3517
|
-
/* @__PURE__ */
|
|
3512
|
+
/* @__PURE__ */ jsx24(
|
|
3518
3513
|
"button",
|
|
3519
3514
|
{
|
|
3520
3515
|
onClick: () => handleDelete2(row.index),
|
|
3521
3516
|
disabled: submitLoading2 || isSavingAsync2,
|
|
3522
3517
|
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",
|
|
3523
3518
|
title: "Delete",
|
|
3524
|
-
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */
|
|
3519
|
+
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */ jsx24(Loader23, { size: 16, className: "animate-spin" }) : /* @__PURE__ */ jsx24(Trash2, { size: 16 })
|
|
3525
3520
|
}
|
|
3526
3521
|
)
|
|
3527
3522
|
] });
|
|
@@ -3543,9 +3538,9 @@ function PostTable({
|
|
|
3543
3538
|
size: 40,
|
|
3544
3539
|
minSize: 40,
|
|
3545
3540
|
maxSize: 40,
|
|
3546
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3547
|
-
/* @__PURE__ */
|
|
3548
|
-
renderSubComponent && hasSubComponent(row.original) && /* @__PURE__ */
|
|
3541
|
+
cell: ({ row }) => /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
3542
|
+
/* @__PURE__ */ jsx24("span", { className: "text-gray-500 font-medium ml-1", children: row.index + 1 }),
|
|
3543
|
+
renderSubComponent && hasSubComponent(row.original) && /* @__PURE__ */ jsx24(
|
|
3549
3544
|
ChevronDown5,
|
|
3550
3545
|
{
|
|
3551
3546
|
size: 16,
|
|
@@ -3555,7 +3550,7 @@ function PostTable({
|
|
|
3555
3550
|
] }),
|
|
3556
3551
|
enableSorting: false,
|
|
3557
3552
|
meta: {
|
|
3558
|
-
field: () => /* @__PURE__ */
|
|
3553
|
+
field: () => /* @__PURE__ */ jsx24("span", { className: "text-gray-400 font-medium px-2 block select-none", children: "#" })
|
|
3559
3554
|
}
|
|
3560
3555
|
});
|
|
3561
3556
|
}
|
|
@@ -3585,13 +3580,13 @@ function PostTable({
|
|
|
3585
3580
|
isSavingAsync
|
|
3586
3581
|
}
|
|
3587
3582
|
});
|
|
3588
|
-
return /* @__PURE__ */
|
|
3583
|
+
return /* @__PURE__ */ jsx24(
|
|
3589
3584
|
"div",
|
|
3590
3585
|
{
|
|
3591
3586
|
className: `space-y-4 w-full ${className}`,
|
|
3592
3587
|
style: { "--theme-primary": primaryColor || "#3b82f6" },
|
|
3593
|
-
children: /* @__PURE__ */
|
|
3594
|
-
/* @__PURE__ */
|
|
3588
|
+
children: /* @__PURE__ */ jsx24("div", { className: "rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 relative", children: /* @__PURE__ */ jsx24("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs18("table", { className: "w-full text-left border-collapse", children: [
|
|
3589
|
+
/* @__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(
|
|
3595
3590
|
"th",
|
|
3596
3591
|
{
|
|
3597
3592
|
className: cn(
|
|
@@ -3613,12 +3608,12 @@ function PostTable({
|
|
|
3613
3608
|
},
|
|
3614
3609
|
header.id
|
|
3615
3610
|
)) }, headerGroup.id)) }),
|
|
3616
|
-
/* @__PURE__ */
|
|
3617
|
-
isLoading ? Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ jsxs18("tbody", { className: "", children: [
|
|
3612
|
+
isLoading ? Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx24(
|
|
3618
3613
|
"tr",
|
|
3619
3614
|
{
|
|
3620
3615
|
className: "border-b border-gray-100 dark:border-zinc-800/50",
|
|
3621
|
-
children: columns.map((col, j) => /* @__PURE__ */
|
|
3616
|
+
children: columns.map((col, j) => /* @__PURE__ */ jsx24(
|
|
3622
3617
|
"td",
|
|
3623
3618
|
{
|
|
3624
3619
|
className: cn(
|
|
@@ -3631,13 +3626,13 @@ function PostTable({
|
|
|
3631
3626
|
minWidth: col.meta?.width ?? col.minSize,
|
|
3632
3627
|
maxWidth: col.meta?.width ?? col.maxSize
|
|
3633
3628
|
},
|
|
3634
|
-
children: /* @__PURE__ */
|
|
3629
|
+
children: /* @__PURE__ */ jsx24("div", { className: "h-4 bg-gray-100 dark:bg-zinc-800 rounded animate-pulse w-full" })
|
|
3635
3630
|
},
|
|
3636
3631
|
`skeleton-cell-${j}`
|
|
3637
3632
|
))
|
|
3638
3633
|
},
|
|
3639
3634
|
`skeleton-${i}`
|
|
3640
|
-
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */
|
|
3635
|
+
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx24(
|
|
3641
3636
|
TableRow,
|
|
3642
3637
|
{
|
|
3643
3638
|
row,
|
|
@@ -3648,7 +3643,7 @@ function PostTable({
|
|
|
3648
3643
|
columnsCount: columns.length
|
|
3649
3644
|
},
|
|
3650
3645
|
row.id
|
|
3651
|
-
)) : /* @__PURE__ */
|
|
3646
|
+
)) : /* @__PURE__ */ jsx24("tr", { children: /* @__PURE__ */ jsx24(
|
|
3652
3647
|
"td",
|
|
3653
3648
|
{
|
|
3654
3649
|
colSpan: columns.length,
|
|
@@ -3656,7 +3651,7 @@ function PostTable({
|
|
|
3656
3651
|
children: "No results found."
|
|
3657
3652
|
}
|
|
3658
3653
|
) }),
|
|
3659
|
-
/* @__PURE__ */
|
|
3654
|
+
/* @__PURE__ */ jsx24(
|
|
3660
3655
|
"tr",
|
|
3661
3656
|
{
|
|
3662
3657
|
ref: entryRowRef,
|
|
@@ -3671,7 +3666,7 @@ function PostTable({
|
|
|
3671
3666
|
return visibleColumns.map((column) => {
|
|
3672
3667
|
const currentId = column.id || column.columnDef.accessorKey;
|
|
3673
3668
|
if (column.id === "actions") {
|
|
3674
|
-
return /* @__PURE__ */
|
|
3669
|
+
return /* @__PURE__ */ jsx24(
|
|
3675
3670
|
"td",
|
|
3676
3671
|
{
|
|
3677
3672
|
className: cn(
|
|
@@ -3679,38 +3674,38 @@ function PostTable({
|
|
|
3679
3674
|
"py-1! text-sm align-middle transition-colors duration-200",
|
|
3680
3675
|
verticalLines ? "border-x border-gray-200 dark:border-zinc-800" : ""
|
|
3681
3676
|
),
|
|
3682
|
-
children: /* @__PURE__ */
|
|
3683
|
-
/* @__PURE__ */
|
|
3677
|
+
children: /* @__PURE__ */ jsx24("div", { className: "flex items-center gap-2", children: editingIndex !== null ? /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
3678
|
+
/* @__PURE__ */ jsx24(
|
|
3684
3679
|
"button",
|
|
3685
3680
|
{
|
|
3686
3681
|
onClick: handleSaveField,
|
|
3687
3682
|
disabled: isSavingAsync || submitLoading,
|
|
3688
3683
|
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",
|
|
3689
3684
|
title: "Update",
|
|
3690
|
-
children: isSavingAsync || submitLoading ? /* @__PURE__ */
|
|
3685
|
+
children: isSavingAsync || submitLoading ? /* @__PURE__ */ jsx24(
|
|
3691
3686
|
Loader23,
|
|
3692
3687
|
{
|
|
3693
3688
|
size: 16,
|
|
3694
3689
|
className: "animate-spin"
|
|
3695
3690
|
}
|
|
3696
|
-
) : /* @__PURE__ */
|
|
3691
|
+
) : /* @__PURE__ */ jsx24(Check4, { size: 16, strokeWidth: 2.5 })
|
|
3697
3692
|
}
|
|
3698
3693
|
),
|
|
3699
|
-
/* @__PURE__ */
|
|
3694
|
+
/* @__PURE__ */ jsx24(
|
|
3700
3695
|
"button",
|
|
3701
3696
|
{
|
|
3702
3697
|
onClick: handleCancelEdit,
|
|
3703
3698
|
disabled: isSavingAsync || submitLoading,
|
|
3704
3699
|
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",
|
|
3705
3700
|
title: "Cancel",
|
|
3706
|
-
children: /* @__PURE__ */
|
|
3701
|
+
children: /* @__PURE__ */ jsx24(X3, { size: 16, strokeWidth: 2.5 })
|
|
3707
3702
|
}
|
|
3708
3703
|
)
|
|
3709
|
-
] }) : /* @__PURE__ */
|
|
3704
|
+
] }) : /* @__PURE__ */ jsx24(Fragment6, { children: renderAddButton ? renderAddButton(
|
|
3710
3705
|
entryData,
|
|
3711
3706
|
handleSaveField,
|
|
3712
3707
|
isSavingAsync
|
|
3713
|
-
) : /* @__PURE__ */
|
|
3708
|
+
) : /* @__PURE__ */ jsxs18(
|
|
3714
3709
|
"button",
|
|
3715
3710
|
{
|
|
3716
3711
|
onClick: handleSaveField,
|
|
@@ -3721,14 +3716,14 @@ function PostTable({
|
|
|
3721
3716
|
},
|
|
3722
3717
|
title: "Add Row",
|
|
3723
3718
|
children: [
|
|
3724
|
-
isSavingAsync || submitLoading ? /* @__PURE__ */
|
|
3719
|
+
isSavingAsync || submitLoading ? /* @__PURE__ */ jsx24(
|
|
3725
3720
|
Loader23,
|
|
3726
3721
|
{
|
|
3727
3722
|
size: 14,
|
|
3728
3723
|
className: "animate-spin"
|
|
3729
3724
|
}
|
|
3730
|
-
) : /* @__PURE__ */
|
|
3731
|
-
/* @__PURE__ */
|
|
3725
|
+
) : /* @__PURE__ */ jsx24(Plus, { size: 14, strokeWidth: 2.5 }),
|
|
3726
|
+
/* @__PURE__ */ jsx24("span", { children: isSavingAsync || submitLoading ? "Adding..." : "Add" })
|
|
3732
3727
|
]
|
|
3733
3728
|
}
|
|
3734
3729
|
) }) })
|
|
@@ -3754,7 +3749,7 @@ function PostTable({
|
|
|
3754
3749
|
});
|
|
3755
3750
|
}
|
|
3756
3751
|
};
|
|
3757
|
-
return /* @__PURE__ */
|
|
3752
|
+
return /* @__PURE__ */ jsx24(
|
|
3758
3753
|
"td",
|
|
3759
3754
|
{
|
|
3760
3755
|
"data-column-id": column.id,
|
|
@@ -3780,7 +3775,7 @@ function PostTable({
|
|
|
3780
3775
|
minWidth: column.columnDef.meta?.width ?? column.columnDef.minSize,
|
|
3781
3776
|
maxWidth: column.columnDef.meta?.width ?? column.columnDef.maxSize
|
|
3782
3777
|
},
|
|
3783
|
-
children: /* @__PURE__ */
|
|
3778
|
+
children: /* @__PURE__ */ jsxs18(
|
|
3784
3779
|
"div",
|
|
3785
3780
|
{
|
|
3786
3781
|
className: cn(
|
|
@@ -3811,7 +3806,7 @@ function PostTable({
|
|
|
3811
3806
|
onChange: onChangeValue,
|
|
3812
3807
|
rowData: entryData,
|
|
3813
3808
|
setRowData: setEntryData
|
|
3814
|
-
}) : /* @__PURE__ */
|
|
3809
|
+
}) : /* @__PURE__ */ jsx24(
|
|
3815
3810
|
Fields_default.Input,
|
|
3816
3811
|
{
|
|
3817
3812
|
id: `pti-${accessor}`,
|
|
@@ -3823,7 +3818,7 @@ function PostTable({
|
|
|
3823
3818
|
placeholder: `${typeof column.columnDef.header === "string" ? column.columnDef.header : column.id}`
|
|
3824
3819
|
}
|
|
3825
3820
|
),
|
|
3826
|
-
typeof error === "string" && /* @__PURE__ */
|
|
3821
|
+
typeof error === "string" && /* @__PURE__ */ jsx24("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 })
|
|
3827
3822
|
]
|
|
3828
3823
|
}
|
|
3829
3824
|
)
|
|
@@ -3839,7 +3834,7 @@ function PostTable({
|
|
|
3839
3834
|
(group) => group.headers.some(
|
|
3840
3835
|
(header) => header.column.columnDef.footer
|
|
3841
3836
|
)
|
|
3842
|
-
) && /* @__PURE__ */
|
|
3837
|
+
) && /* @__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(
|
|
3843
3838
|
"td",
|
|
3844
3839
|
{
|
|
3845
3840
|
className: cn(
|
|
@@ -3873,7 +3868,7 @@ import {
|
|
|
3873
3868
|
getCoreRowModel as getCoreRowModel3,
|
|
3874
3869
|
flexRender as flexRender3
|
|
3875
3870
|
} from "@tanstack/react-table";
|
|
3876
|
-
import { jsx as
|
|
3871
|
+
import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3877
3872
|
function SimpleTable({
|
|
3878
3873
|
columns: userColumns,
|
|
3879
3874
|
data,
|
|
@@ -3905,7 +3900,7 @@ function SimpleTable({
|
|
|
3905
3900
|
id: "index",
|
|
3906
3901
|
width: 75,
|
|
3907
3902
|
className: "whitespace-nowrap px-2 text-center",
|
|
3908
|
-
cell: (info) => /* @__PURE__ */
|
|
3903
|
+
cell: (info) => /* @__PURE__ */ jsx25("span", { className: "tabular-nums", children: info.row.index + 1 + startIndex })
|
|
3909
3904
|
});
|
|
3910
3905
|
}
|
|
3911
3906
|
return cols;
|
|
@@ -3922,17 +3917,17 @@ function SimpleTable({
|
|
|
3922
3917
|
)
|
|
3923
3918
|
);
|
|
3924
3919
|
}, [table]);
|
|
3925
|
-
return /* @__PURE__ */
|
|
3926
|
-
/* @__PURE__ */
|
|
3920
|
+
return /* @__PURE__ */ jsxs19("div", { className: `w-full overflow-hidden ${className}`, children: [
|
|
3921
|
+
/* @__PURE__ */ jsxs19(
|
|
3927
3922
|
"table",
|
|
3928
3923
|
{
|
|
3929
3924
|
className: `w-full max-w-full text-left border-collapse table-fixed ${verticalLines ? "border border-black dark:border-white" : ""}`,
|
|
3930
3925
|
children: [
|
|
3931
|
-
/* @__PURE__ */
|
|
3926
|
+
/* @__PURE__ */ jsx25("thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx25(
|
|
3932
3927
|
"tr",
|
|
3933
3928
|
{
|
|
3934
3929
|
className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-200 dark:border-zinc-800"}`,
|
|
3935
|
-
children: headerGroup.headers.map((header) => /* @__PURE__ */
|
|
3930
|
+
children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx25(
|
|
3936
3931
|
"th",
|
|
3937
3932
|
{
|
|
3938
3933
|
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"}`,
|
|
@@ -3951,15 +3946,15 @@ function SimpleTable({
|
|
|
3951
3946
|
},
|
|
3952
3947
|
headerGroup.id
|
|
3953
3948
|
)) }),
|
|
3954
|
-
/* @__PURE__ */
|
|
3949
|
+
/* @__PURE__ */ jsx25("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__ */ jsx25(
|
|
3955
3950
|
"tr",
|
|
3956
3951
|
{
|
|
3957
3952
|
className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-100 dark:border-zinc-800/60 last:border-0"}`,
|
|
3958
|
-
children: columns.map((col, colIdx) => /* @__PURE__ */
|
|
3953
|
+
children: columns.map((col, colIdx) => /* @__PURE__ */ jsx25(
|
|
3959
3954
|
"td",
|
|
3960
3955
|
{
|
|
3961
3956
|
className: `text-sm ${rowPadding} align-top ${verticalLines ? "border-x border-black dark:border-white" : ""}`,
|
|
3962
|
-
children: /* @__PURE__ */
|
|
3957
|
+
children: /* @__PURE__ */ jsx25(
|
|
3963
3958
|
"div",
|
|
3964
3959
|
{
|
|
3965
3960
|
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" : ""}`
|
|
@@ -3970,18 +3965,18 @@ function SimpleTable({
|
|
|
3970
3965
|
))
|
|
3971
3966
|
},
|
|
3972
3967
|
`skeleton-row-${i}`
|
|
3973
|
-
)) : data.length === 0 && !isLoading ? /* @__PURE__ */
|
|
3968
|
+
)) : data.length === 0 && !isLoading ? /* @__PURE__ */ jsx25("tr", { children: /* @__PURE__ */ jsx25(
|
|
3974
3969
|
"td",
|
|
3975
3970
|
{
|
|
3976
3971
|
colSpan: columns.length,
|
|
3977
3972
|
className: "text-center text-gray-500 font-medium",
|
|
3978
|
-
children: emptyState || /* @__PURE__ */
|
|
3973
|
+
children: emptyState || /* @__PURE__ */ jsx25("div", { className: "py-8", children: "No transactions found." })
|
|
3979
3974
|
}
|
|
3980
|
-
) }) : table.getRowModel().rows.map((row) => /* @__PURE__ */
|
|
3975
|
+
) }) : table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx25(
|
|
3981
3976
|
"tr",
|
|
3982
3977
|
{
|
|
3983
3978
|
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`,
|
|
3984
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */
|
|
3979
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx25(
|
|
3985
3980
|
"td",
|
|
3986
3981
|
{
|
|
3987
3982
|
className: `text-sm ${rowPadding} align-top ${verticalLines ? "border-x border-black dark:border-white" : ""} ${cell.column.columnDef.className || "wrap-break-word"}`,
|
|
@@ -3992,11 +3987,11 @@ function SimpleTable({
|
|
|
3992
3987
|
},
|
|
3993
3988
|
row.id
|
|
3994
3989
|
)) }),
|
|
3995
|
-
hasFooters && !isLoading && /* @__PURE__ */
|
|
3990
|
+
hasFooters && !isLoading && /* @__PURE__ */ jsx25("tfoot", { className: "text-black dark:text-white font-bold font-sans tabular-nums", children: table.getFooterGroups().map((footerGroup) => /* @__PURE__ */ jsx25(
|
|
3996
3991
|
"tr",
|
|
3997
3992
|
{
|
|
3998
3993
|
className: `${verticalLines ? "border-t border-black dark:border-white" : "bg-gray-50/30 dark:bg-zinc-900/10"}`,
|
|
3999
|
-
children: footerGroup.headers.map((header) => /* @__PURE__ */
|
|
3994
|
+
children: footerGroup.headers.map((header) => /* @__PURE__ */ jsx25(
|
|
4000
3995
|
"td",
|
|
4001
3996
|
{
|
|
4002
3997
|
className: `text-sm ${rowPadding} ${verticalLines ? "border-x border-black dark:border-white" : ""} ${header.column.columnDef.className || "wrap-break-word"}`,
|
|
@@ -4013,13 +4008,13 @@ function SimpleTable({
|
|
|
4013
4008
|
]
|
|
4014
4009
|
}
|
|
4015
4010
|
),
|
|
4016
|
-
componentFooter && /* @__PURE__ */
|
|
4011
|
+
componentFooter && /* @__PURE__ */ jsx25("div", { className: "mt-2 pt-3 border-t border-gray-200 dark:border-zinc-800", children: componentFooter() })
|
|
4017
4012
|
] });
|
|
4018
4013
|
}
|
|
4019
4014
|
|
|
4020
4015
|
// src/components/Badge.tsx
|
|
4021
4016
|
import React11 from "react";
|
|
4022
|
-
import { jsx as
|
|
4017
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
4023
4018
|
var Badge = React11.forwardRef(
|
|
4024
4019
|
({
|
|
4025
4020
|
children,
|
|
@@ -4041,7 +4036,7 @@ var Badge = React11.forwardRef(
|
|
|
4041
4036
|
md: "px-2.5 py-1 text-xs leading-tight font-semibold",
|
|
4042
4037
|
lg: "px-3 py-1.5 text-sm leading-tight font-semibold"
|
|
4043
4038
|
};
|
|
4044
|
-
return /* @__PURE__ */
|
|
4039
|
+
return /* @__PURE__ */ jsx26(
|
|
4045
4040
|
"span",
|
|
4046
4041
|
{
|
|
4047
4042
|
ref,
|
|
@@ -4055,13 +4050,13 @@ var Badge = React11.forwardRef(
|
|
|
4055
4050
|
Badge.displayName = "Badge";
|
|
4056
4051
|
|
|
4057
4052
|
// src/components/Branding.tsx
|
|
4058
|
-
import { jsx as
|
|
4053
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4059
4054
|
var Branding = ({
|
|
4060
4055
|
text,
|
|
4061
4056
|
disabled = false,
|
|
4062
4057
|
className
|
|
4063
4058
|
}) => {
|
|
4064
|
-
return /* @__PURE__ */
|
|
4059
|
+
return /* @__PURE__ */ jsx27(
|
|
4065
4060
|
"p",
|
|
4066
4061
|
{
|
|
4067
4062
|
className: cn(
|
|
@@ -4075,7 +4070,7 @@ var Branding = ({
|
|
|
4075
4070
|
};
|
|
4076
4071
|
|
|
4077
4072
|
// src/hooks/Fetches/useA4DataView.tsx
|
|
4078
|
-
import { useEffect as useEffect11, useRef as useRef6, useState as
|
|
4073
|
+
import { useEffect as useEffect11, useRef as useRef6, useState as useState16 } from "react";
|
|
4079
4074
|
import { useReactToPrint } from "react-to-print";
|
|
4080
4075
|
import {
|
|
4081
4076
|
RefreshCw,
|
|
@@ -4085,7 +4080,7 @@ import {
|
|
|
4085
4080
|
ChevronLeft,
|
|
4086
4081
|
ChevronRight as ChevronRight2
|
|
4087
4082
|
} from "lucide-react";
|
|
4088
|
-
import { jsx as
|
|
4083
|
+
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4089
4084
|
var useA4StatementView = ({
|
|
4090
4085
|
url,
|
|
4091
4086
|
v = 1,
|
|
@@ -4136,11 +4131,11 @@ var useA4StatementView = ({
|
|
|
4136
4131
|
const { store } = useWarqadConfig();
|
|
4137
4132
|
const isActuallyLoading = externalLoading ?? isLoading;
|
|
4138
4133
|
const measureContainerRef = useRef6(null);
|
|
4139
|
-
const [pages, setPages] =
|
|
4140
|
-
const [isMeasuring, setIsMeasuring] =
|
|
4141
|
-
const [globalFilter, setGlobalFilter] =
|
|
4142
|
-
const [currentPageIndex, setCurrentPageIndex] =
|
|
4143
|
-
const [pageSearch, setPageSearch] =
|
|
4134
|
+
const [pages, setPages] = useState16([]);
|
|
4135
|
+
const [isMeasuring, setIsMeasuring] = useState16(true);
|
|
4136
|
+
const [globalFilter, setGlobalFilter] = useState16("");
|
|
4137
|
+
const [currentPageIndex, setCurrentPageIndex] = useState16(0);
|
|
4138
|
+
const [pageSearch, setPageSearch] = useState16("");
|
|
4144
4139
|
const displayColumnsForSearch = columns.filter((col) => !col.hide);
|
|
4145
4140
|
const filteredDisplayData = data.filter((row) => {
|
|
4146
4141
|
if (!globalFilter) return true;
|
|
@@ -4156,20 +4151,20 @@ var useA4StatementView = ({
|
|
|
4156
4151
|
const columnsWithFooters = columns.filter(
|
|
4157
4152
|
(col) => col.renderFooter && !col.hide
|
|
4158
4153
|
);
|
|
4159
|
-
const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */
|
|
4154
|
+
const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */ jsxs20(
|
|
4160
4155
|
"div",
|
|
4161
4156
|
{
|
|
4162
4157
|
id: "a4-final-total",
|
|
4163
4158
|
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",
|
|
4164
4159
|
children: [
|
|
4165
|
-
/* @__PURE__ */
|
|
4166
|
-
columnsWithFooters.map((col, idx) => /* @__PURE__ */
|
|
4160
|
+
/* @__PURE__ */ jsx28("div", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs mr-auto", children: "Grand Totals" }),
|
|
4161
|
+
columnsWithFooters.map((col, idx) => /* @__PURE__ */ jsxs20(
|
|
4167
4162
|
"div",
|
|
4168
4163
|
{
|
|
4169
4164
|
className: "flex items-center gap-3 px-4 py-2 rounded-md border border-black dark:border-zinc-700 print:border-black",
|
|
4170
4165
|
children: [
|
|
4171
|
-
/* @__PURE__ */
|
|
4172
|
-
/* @__PURE__ */
|
|
4166
|
+
/* @__PURE__ */ jsx28("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" }),
|
|
4167
|
+
/* @__PURE__ */ jsx28("div", { className: "text-base font-bold font-sans tabular-nums text-black dark:text-white print:text-black", children: col.renderFooter(filteredDisplayData) })
|
|
4173
4168
|
]
|
|
4174
4169
|
},
|
|
4175
4170
|
col.key || idx
|
|
@@ -4256,28 +4251,28 @@ var useA4StatementView = ({
|
|
|
4256
4251
|
}, 150);
|
|
4257
4252
|
return () => clearTimeout(timer);
|
|
4258
4253
|
}, [isMeasuring, depsString]);
|
|
4259
|
-
const HeaderEl = /* @__PURE__ */
|
|
4254
|
+
const HeaderEl = /* @__PURE__ */ jsxs20(
|
|
4260
4255
|
"div",
|
|
4261
4256
|
{
|
|
4262
4257
|
className: "flex justify-between items-start mb-5 px-8 pt-8",
|
|
4263
4258
|
id: "a4-header-section",
|
|
4264
4259
|
children: [
|
|
4265
|
-
/* @__PURE__ */
|
|
4266
|
-
/* @__PURE__ */
|
|
4267
|
-
/* @__PURE__ */
|
|
4260
|
+
/* @__PURE__ */ jsx28("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsx28("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsxs20("section", { children: [
|
|
4261
|
+
/* @__PURE__ */ jsx28("h1", { className: "text-4xl font-bold text-blue-600 dark:text-blue-500 print:text-blue-600 tracking-tight uppercase", children: title }),
|
|
4262
|
+
/* @__PURE__ */ jsx28("p", { className: "text-gray-500 dark:text-gray-400 print:text-gray-500 mt-1 uppercase text-xs font-semibold tracking-wider", children: subtitle })
|
|
4268
4263
|
] }) }) }),
|
|
4269
|
-
/* @__PURE__ */
|
|
4270
|
-
/* @__PURE__ */
|
|
4271
|
-
/* @__PURE__ */
|
|
4272
|
-
store?.address && /* @__PURE__ */
|
|
4273
|
-
store?.phone && /* @__PURE__ */
|
|
4274
|
-
store?.email && /* @__PURE__ */
|
|
4264
|
+
/* @__PURE__ */ jsxs20("div", { className: "text-right", children: [
|
|
4265
|
+
/* @__PURE__ */ jsx28("h2", { className: "text-lg font-bold text-gray-800 dark:text-gray-100 print:text-gray-800", children: store?.name }),
|
|
4266
|
+
/* @__PURE__ */ jsxs20("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: [
|
|
4267
|
+
store?.address && /* @__PURE__ */ jsx28("span", { className: "whitespace-pre-line", children: store.address }),
|
|
4268
|
+
store?.phone && /* @__PURE__ */ jsx28("span", { children: store.phone }),
|
|
4269
|
+
store?.email && /* @__PURE__ */ jsx28("span", { children: store.email })
|
|
4275
4270
|
] })
|
|
4276
4271
|
] })
|
|
4277
4272
|
]
|
|
4278
4273
|
}
|
|
4279
4274
|
);
|
|
4280
|
-
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */
|
|
4275
|
+
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ jsx28("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ jsx28(
|
|
4281
4276
|
InfoGrid,
|
|
4282
4277
|
{
|
|
4283
4278
|
className: "mb-4",
|
|
@@ -4285,29 +4280,29 @@ var useA4StatementView = ({
|
|
|
4285
4280
|
isLoading: isActuallyLoading
|
|
4286
4281
|
}
|
|
4287
4282
|
) }) : null;
|
|
4288
|
-
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */
|
|
4289
|
-
isActuallyLoading ? /* @__PURE__ */
|
|
4290
|
-
/* @__PURE__ */
|
|
4291
|
-
/* @__PURE__ */
|
|
4292
|
-
url && !isActuallyLoading && /* @__PURE__ */
|
|
4283
|
+
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ jsx28("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ jsxs20("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: [
|
|
4284
|
+
isActuallyLoading ? /* @__PURE__ */ jsx28("div", { className: "mb-4", children: /* @__PURE__ */ jsx28(ClassicSpin, {}) }) : error ? /* @__PURE__ */ jsx28("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__ */ jsx28(AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx28("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx28(FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
4285
|
+
/* @__PURE__ */ jsx28("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" }),
|
|
4286
|
+
/* @__PURE__ */ jsx28("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." }),
|
|
4287
|
+
url && !isActuallyLoading && /* @__PURE__ */ jsxs20(
|
|
4293
4288
|
"button",
|
|
4294
4289
|
{
|
|
4295
4290
|
onClick: () => getData(),
|
|
4296
4291
|
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",
|
|
4297
4292
|
children: [
|
|
4298
|
-
/* @__PURE__ */
|
|
4293
|
+
/* @__PURE__ */ jsx28(RefreshCw, { size: 14 }),
|
|
4299
4294
|
"Try Again"
|
|
4300
4295
|
]
|
|
4301
4296
|
}
|
|
4302
4297
|
)
|
|
4303
4298
|
] }) }) : null;
|
|
4304
|
-
return /* @__PURE__ */
|
|
4305
|
-
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */
|
|
4299
|
+
return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col relative w-full items-center", children: [
|
|
4300
|
+
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ jsx28("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ jsx28(
|
|
4306
4301
|
"div",
|
|
4307
4302
|
{
|
|
4308
4303
|
style: { width: "210mm", boxSizing: "border-box" },
|
|
4309
4304
|
className: "bg-white",
|
|
4310
|
-
children: /* @__PURE__ */
|
|
4305
|
+
children: /* @__PURE__ */ jsxs20(
|
|
4311
4306
|
"div",
|
|
4312
4307
|
{
|
|
4313
4308
|
ref: measureContainerRef,
|
|
@@ -4315,9 +4310,9 @@ var useA4StatementView = ({
|
|
|
4315
4310
|
children: [
|
|
4316
4311
|
HeaderEl,
|
|
4317
4312
|
DisplayInfoGridEl,
|
|
4318
|
-
/* @__PURE__ */
|
|
4319
|
-
/* @__PURE__ */
|
|
4320
|
-
/* @__PURE__ */
|
|
4313
|
+
/* @__PURE__ */ jsxs20("div", { className: "grow w-full px-8 pb-8", children: [
|
|
4314
|
+
/* @__PURE__ */ jsx28("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__ */ jsx28("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
4315
|
+
/* @__PURE__ */ jsx28(
|
|
4321
4316
|
SimpleTable,
|
|
4322
4317
|
{
|
|
4323
4318
|
columns,
|
|
@@ -4335,52 +4330,52 @@ var useA4StatementView = ({
|
|
|
4335
4330
|
)
|
|
4336
4331
|
}
|
|
4337
4332
|
) }),
|
|
4338
|
-
/* @__PURE__ */
|
|
4333
|
+
/* @__PURE__ */ jsx28("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ jsx28("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageData, pageIndex) => /* @__PURE__ */ jsx28(
|
|
4339
4334
|
"div",
|
|
4340
4335
|
{
|
|
4341
4336
|
className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
|
|
4342
|
-
children: /* @__PURE__ */
|
|
4337
|
+
children: /* @__PURE__ */ jsx28(
|
|
4343
4338
|
PageA4,
|
|
4344
4339
|
{
|
|
4345
4340
|
className: "w-full",
|
|
4346
4341
|
pageNumber: pageIndex + 1,
|
|
4347
4342
|
totalPages: pages.length,
|
|
4348
4343
|
isLastPage: pageIndex === pages.length - 1,
|
|
4349
|
-
children: /* @__PURE__ */
|
|
4350
|
-
/* @__PURE__ */
|
|
4344
|
+
children: /* @__PURE__ */ jsxs20("div", { className: "flex flex-col h-full grow w-full", children: [
|
|
4345
|
+
/* @__PURE__ */ jsxs20("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
|
|
4351
4346
|
headers,
|
|
4352
|
-
printable && pageIndex === currentPageIndex && /* @__PURE__ */
|
|
4353
|
-
/* @__PURE__ */
|
|
4347
|
+
printable && pageIndex === currentPageIndex && /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
|
|
4348
|
+
/* @__PURE__ */ jsxs20(
|
|
4354
4349
|
"button",
|
|
4355
4350
|
{
|
|
4356
4351
|
onClick: async () => await getData(),
|
|
4357
4352
|
disabled: isLoading,
|
|
4358
4353
|
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",
|
|
4359
4354
|
children: [
|
|
4360
|
-
/* @__PURE__ */
|
|
4355
|
+
/* @__PURE__ */ jsx28(
|
|
4361
4356
|
RefreshCw,
|
|
4362
4357
|
{
|
|
4363
4358
|
size: 16,
|
|
4364
4359
|
className: isLoading ? "animate-spin" : ""
|
|
4365
4360
|
}
|
|
4366
4361
|
),
|
|
4367
|
-
/* @__PURE__ */
|
|
4362
|
+
/* @__PURE__ */ jsx28("span", { className: "text-xs font-semibold", children: "Reload" })
|
|
4368
4363
|
]
|
|
4369
4364
|
}
|
|
4370
4365
|
),
|
|
4371
|
-
/* @__PURE__ */
|
|
4366
|
+
/* @__PURE__ */ jsxs20(
|
|
4372
4367
|
"button",
|
|
4373
4368
|
{
|
|
4374
4369
|
onClick: () => reactToPrintFn(),
|
|
4375
4370
|
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",
|
|
4376
4371
|
children: [
|
|
4377
|
-
/* @__PURE__ */
|
|
4372
|
+
/* @__PURE__ */ jsx28(Printer, { size: 16 }),
|
|
4378
4373
|
"Print"
|
|
4379
4374
|
]
|
|
4380
4375
|
}
|
|
4381
4376
|
),
|
|
4382
|
-
/* @__PURE__ */
|
|
4383
|
-
/* @__PURE__ */
|
|
4377
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
|
|
4378
|
+
/* @__PURE__ */ jsx28(
|
|
4384
4379
|
"button",
|
|
4385
4380
|
{
|
|
4386
4381
|
onClick: (e) => {
|
|
@@ -4391,11 +4386,11 @@ var useA4StatementView = ({
|
|
|
4391
4386
|
},
|
|
4392
4387
|
disabled: currentPageIndex === 0,
|
|
4393
4388
|
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",
|
|
4394
|
-
children: /* @__PURE__ */
|
|
4389
|
+
children: /* @__PURE__ */ jsx28(ChevronLeft, { size: 18 })
|
|
4395
4390
|
}
|
|
4396
4391
|
),
|
|
4397
|
-
/* @__PURE__ */
|
|
4398
|
-
/* @__PURE__ */
|
|
4392
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
|
|
4393
|
+
/* @__PURE__ */ jsxs20(
|
|
4399
4394
|
Select,
|
|
4400
4395
|
{
|
|
4401
4396
|
value: currentPageIndex + 1,
|
|
@@ -4408,9 +4403,9 @@ var useA4StatementView = ({
|
|
|
4408
4403
|
variant: "ghost",
|
|
4409
4404
|
containerClassName: "inline-block",
|
|
4410
4405
|
children: [
|
|
4411
|
-
/* @__PURE__ */
|
|
4412
|
-
/* @__PURE__ */
|
|
4413
|
-
/* @__PURE__ */
|
|
4406
|
+
/* @__PURE__ */ jsx28(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__ */ jsx28("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
|
|
4407
|
+
/* @__PURE__ */ jsxs20(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
|
|
4408
|
+
/* @__PURE__ */ jsx28("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__ */ jsx28(
|
|
4414
4409
|
"input",
|
|
4415
4410
|
{
|
|
4416
4411
|
type: "text",
|
|
@@ -4422,17 +4417,17 @@ var useA4StatementView = ({
|
|
|
4422
4417
|
autoFocus: true
|
|
4423
4418
|
}
|
|
4424
4419
|
) }),
|
|
4425
|
-
/* @__PURE__ */
|
|
4420
|
+
/* @__PURE__ */ jsx28("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
|
|
4426
4421
|
(p) => String(p).includes(pageSearch)
|
|
4427
|
-
).map((p) => /* @__PURE__ */
|
|
4422
|
+
).map((p) => /* @__PURE__ */ jsx28(SelectItem, { value: p, children: p }, p)) })
|
|
4428
4423
|
] })
|
|
4429
4424
|
]
|
|
4430
4425
|
}
|
|
4431
4426
|
),
|
|
4432
|
-
/* @__PURE__ */
|
|
4433
|
-
/* @__PURE__ */
|
|
4427
|
+
/* @__PURE__ */ jsx28("span", { className: "text-gray-400 mx-0.5", children: "/" }),
|
|
4428
|
+
/* @__PURE__ */ jsx28("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
|
|
4434
4429
|
] }),
|
|
4435
|
-
/* @__PURE__ */
|
|
4430
|
+
/* @__PURE__ */ jsx28(
|
|
4436
4431
|
"button",
|
|
4437
4432
|
{
|
|
4438
4433
|
onClick: (e) => {
|
|
@@ -4443,7 +4438,7 @@ var useA4StatementView = ({
|
|
|
4443
4438
|
},
|
|
4444
4439
|
disabled: currentPageIndex === pages.length - 1,
|
|
4445
4440
|
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",
|
|
4446
|
-
children: /* @__PURE__ */
|
|
4441
|
+
children: /* @__PURE__ */ jsx28(ChevronRight2, { size: 18 })
|
|
4447
4442
|
}
|
|
4448
4443
|
)
|
|
4449
4444
|
] })
|
|
@@ -4451,10 +4446,10 @@ var useA4StatementView = ({
|
|
|
4451
4446
|
] }),
|
|
4452
4447
|
pageIndex === 0 && HeaderEl,
|
|
4453
4448
|
pageIndex === 0 && DisplayInfoGridEl,
|
|
4454
|
-
/* @__PURE__ */
|
|
4455
|
-
pageIndex === 0 && /* @__PURE__ */
|
|
4456
|
-
/* @__PURE__ */
|
|
4457
|
-
/* @__PURE__ */
|
|
4449
|
+
/* @__PURE__ */ jsxs20("div", { className: "grow w-full px-8 pb-8", children: [
|
|
4450
|
+
pageIndex === 0 && /* @__PURE__ */ jsxs20("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: [
|
|
4451
|
+
/* @__PURE__ */ jsx28("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
|
|
4452
|
+
/* @__PURE__ */ jsx28(
|
|
4458
4453
|
"input",
|
|
4459
4454
|
{
|
|
4460
4455
|
type: "text",
|
|
@@ -4465,9 +4460,9 @@ var useA4StatementView = ({
|
|
|
4465
4460
|
}
|
|
4466
4461
|
)
|
|
4467
4462
|
] }),
|
|
4468
|
-
pageIndex === 0 && /* @__PURE__ */
|
|
4469
|
-
pageIndex > 0 && /* @__PURE__ */
|
|
4470
|
-
statusOverlay ? /* @__PURE__ */
|
|
4463
|
+
pageIndex === 0 && /* @__PURE__ */ jsx28("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__ */ jsx28("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
4464
|
+
pageIndex > 0 && /* @__PURE__ */ jsx28("div", { className: "h-7 print:h-0" }),
|
|
4465
|
+
statusOverlay ? /* @__PURE__ */ jsx28("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ jsx28(
|
|
4471
4466
|
SimpleTable,
|
|
4472
4467
|
{
|
|
4473
4468
|
columns,
|
|
@@ -4503,10 +4498,10 @@ var useA4StatementView = ({
|
|
|
4503
4498
|
var useA4DataView_default = useA4StatementView;
|
|
4504
4499
|
|
|
4505
4500
|
// src/hooks/Fetches/useTransaction.tsx
|
|
4506
|
-
import { useEffect as useEffect12, useState as
|
|
4501
|
+
import { useEffect as useEffect12, useState as useState17 } from "react";
|
|
4507
4502
|
import { AlertCircle as AlertCircle2, FileX as FileX2, Plus as Plus2, RefreshCw as RefreshCw2 } from "lucide-react";
|
|
4508
4503
|
import moment from "moment";
|
|
4509
|
-
import { jsx as
|
|
4504
|
+
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4510
4505
|
var useTransaction = ({
|
|
4511
4506
|
url,
|
|
4512
4507
|
v = 1,
|
|
@@ -4514,7 +4509,7 @@ var useTransaction = ({
|
|
|
4514
4509
|
params = {},
|
|
4515
4510
|
dateFilter = true
|
|
4516
4511
|
}) => {
|
|
4517
|
-
const [date, setDate] =
|
|
4512
|
+
const [date, setDate] = useState17(
|
|
4518
4513
|
moment().format("DD/MM/YYYY")
|
|
4519
4514
|
);
|
|
4520
4515
|
const dateObj = {};
|
|
@@ -4559,21 +4554,21 @@ var useTransaction = ({
|
|
|
4559
4554
|
createTitle = "Add New",
|
|
4560
4555
|
...rest
|
|
4561
4556
|
}) => {
|
|
4562
|
-
const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */
|
|
4557
|
+
const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ jsx29(
|
|
4563
4558
|
"div",
|
|
4564
4559
|
{
|
|
4565
4560
|
className: `flex flex-col relative w-full items-center justify-center py-12 min-h-[300px] ${className}`,
|
|
4566
|
-
children: /* @__PURE__ */
|
|
4567
|
-
error ? /* @__PURE__ */
|
|
4568
|
-
/* @__PURE__ */
|
|
4569
|
-
/* @__PURE__ */
|
|
4570
|
-
url && /* @__PURE__ */
|
|
4561
|
+
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: [
|
|
4562
|
+
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(AlertCircle2, { 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(FileX2, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
4563
|
+
/* @__PURE__ */ jsx29("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: error ? "Failed to Load Data" : "No Records Found" }),
|
|
4564
|
+
/* @__PURE__ */ jsx29("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." }),
|
|
4565
|
+
url && /* @__PURE__ */ jsxs21(
|
|
4571
4566
|
"button",
|
|
4572
4567
|
{
|
|
4573
4568
|
onClick: () => getData(),
|
|
4574
4569
|
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",
|
|
4575
4570
|
children: [
|
|
4576
|
-
/* @__PURE__ */
|
|
4571
|
+
/* @__PURE__ */ jsx29(RefreshCw2, { size: 14 }),
|
|
4577
4572
|
"Try Again"
|
|
4578
4573
|
]
|
|
4579
4574
|
}
|
|
@@ -4581,14 +4576,14 @@ var useTransaction = ({
|
|
|
4581
4576
|
] })
|
|
4582
4577
|
}
|
|
4583
4578
|
) : void 0;
|
|
4584
|
-
return /* @__PURE__ */
|
|
4585
|
-
/* @__PURE__ */
|
|
4586
|
-
/* @__PURE__ */
|
|
4587
|
-
/* @__PURE__ */
|
|
4588
|
-
/* @__PURE__ */
|
|
4579
|
+
return /* @__PURE__ */ jsxs21(Card, { children: [
|
|
4580
|
+
/* @__PURE__ */ jsx29(Card.Header, { children: /* @__PURE__ */ jsxs21("header", { className: "flex items-center justify-between gap-4 py-2", children: [
|
|
4581
|
+
/* @__PURE__ */ jsxs21("div", { className: "space-y-1", children: [
|
|
4582
|
+
/* @__PURE__ */ jsx29(Card.Title, { children: title }),
|
|
4583
|
+
/* @__PURE__ */ jsx29(Card.Description, { children: description })
|
|
4589
4584
|
] }),
|
|
4590
|
-
/* @__PURE__ */
|
|
4591
|
-
dateFilter && /* @__PURE__ */
|
|
4585
|
+
/* @__PURE__ */ jsxs21("section", { className: "flex gap-2 items-center", children: [
|
|
4586
|
+
dateFilter && /* @__PURE__ */ jsx29(
|
|
4592
4587
|
Fields_default.DateInput,
|
|
4593
4588
|
{
|
|
4594
4589
|
value: date,
|
|
@@ -4598,20 +4593,20 @@ var useTransaction = ({
|
|
|
4598
4593
|
}
|
|
4599
4594
|
}
|
|
4600
4595
|
),
|
|
4601
|
-
/* @__PURE__ */
|
|
4596
|
+
/* @__PURE__ */ jsx29(
|
|
4602
4597
|
Button,
|
|
4603
4598
|
{
|
|
4604
4599
|
size: "sm",
|
|
4605
4600
|
className: "rounded-md!",
|
|
4606
4601
|
onClick: onCreate,
|
|
4607
4602
|
variant: "primary",
|
|
4608
|
-
icon: /* @__PURE__ */
|
|
4603
|
+
icon: /* @__PURE__ */ jsx29(Plus2, {}),
|
|
4609
4604
|
children: createTitle
|
|
4610
4605
|
}
|
|
4611
4606
|
)
|
|
4612
4607
|
] })
|
|
4613
4608
|
] }) }),
|
|
4614
|
-
/* @__PURE__ */
|
|
4609
|
+
/* @__PURE__ */ jsx29(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ jsx29("div", { className: `w-full ${className}`, children: /* @__PURE__ */ jsx29(
|
|
4615
4610
|
DataTable,
|
|
4616
4611
|
{
|
|
4617
4612
|
columns,
|
|
@@ -4826,6 +4821,1429 @@ var storage = {
|
|
|
4826
4821
|
return keys;
|
|
4827
4822
|
}
|
|
4828
4823
|
};
|
|
4824
|
+
|
|
4825
|
+
// src/hooks/uploads/useAntdImageUpload.tsx
|
|
4826
|
+
import { useState as useState18 } from "react";
|
|
4827
|
+
|
|
4828
|
+
// ../../node_modules/@ant-design/icons/es/components/Context.js
|
|
4829
|
+
import { createContext as createContext5 } from "react";
|
|
4830
|
+
var IconContext = /* @__PURE__ */ createContext5({});
|
|
4831
|
+
var Context_default = IconContext;
|
|
4832
|
+
|
|
4833
|
+
// ../../node_modules/@ant-design/icons/es/components/AntdIcon.js
|
|
4834
|
+
import * as React14 from "react";
|
|
4835
|
+
import { clsx as clsx2 } from "clsx";
|
|
4836
|
+
|
|
4837
|
+
// ../../node_modules/@ant-design/fast-color/es/presetColors.js
|
|
4838
|
+
var presetColors_default = {
|
|
4839
|
+
aliceblue: "9ehhb",
|
|
4840
|
+
antiquewhite: "9sgk7",
|
|
4841
|
+
aqua: "1ekf",
|
|
4842
|
+
aquamarine: "4zsno",
|
|
4843
|
+
azure: "9eiv3",
|
|
4844
|
+
beige: "9lhp8",
|
|
4845
|
+
bisque: "9zg04",
|
|
4846
|
+
black: "0",
|
|
4847
|
+
blanchedalmond: "9zhe5",
|
|
4848
|
+
blue: "73",
|
|
4849
|
+
blueviolet: "5e31e",
|
|
4850
|
+
brown: "6g016",
|
|
4851
|
+
burlywood: "8ouiv",
|
|
4852
|
+
cadetblue: "3qba8",
|
|
4853
|
+
chartreuse: "4zshs",
|
|
4854
|
+
chocolate: "87k0u",
|
|
4855
|
+
coral: "9yvyo",
|
|
4856
|
+
cornflowerblue: "3xael",
|
|
4857
|
+
cornsilk: "9zjz0",
|
|
4858
|
+
crimson: "8l4xo",
|
|
4859
|
+
cyan: "1ekf",
|
|
4860
|
+
darkblue: "3v",
|
|
4861
|
+
darkcyan: "rkb",
|
|
4862
|
+
darkgoldenrod: "776yz",
|
|
4863
|
+
darkgray: "6mbhl",
|
|
4864
|
+
darkgreen: "jr4",
|
|
4865
|
+
darkgrey: "6mbhl",
|
|
4866
|
+
darkkhaki: "7ehkb",
|
|
4867
|
+
darkmagenta: "5f91n",
|
|
4868
|
+
darkolivegreen: "3bzfz",
|
|
4869
|
+
darkorange: "9yygw",
|
|
4870
|
+
darkorchid: "5z6x8",
|
|
4871
|
+
darkred: "5f8xs",
|
|
4872
|
+
darksalmon: "9441m",
|
|
4873
|
+
darkseagreen: "5lwgf",
|
|
4874
|
+
darkslateblue: "2th1n",
|
|
4875
|
+
darkslategray: "1ugcv",
|
|
4876
|
+
darkslategrey: "1ugcv",
|
|
4877
|
+
darkturquoise: "14up",
|
|
4878
|
+
darkviolet: "5rw7n",
|
|
4879
|
+
deeppink: "9yavn",
|
|
4880
|
+
deepskyblue: "11xb",
|
|
4881
|
+
dimgray: "442g9",
|
|
4882
|
+
dimgrey: "442g9",
|
|
4883
|
+
dodgerblue: "16xof",
|
|
4884
|
+
firebrick: "6y7tu",
|
|
4885
|
+
floralwhite: "9zkds",
|
|
4886
|
+
forestgreen: "1cisi",
|
|
4887
|
+
fuchsia: "9y70f",
|
|
4888
|
+
gainsboro: "8m8kc",
|
|
4889
|
+
ghostwhite: "9pq0v",
|
|
4890
|
+
goldenrod: "8j4f4",
|
|
4891
|
+
gold: "9zda8",
|
|
4892
|
+
gray: "50i2o",
|
|
4893
|
+
green: "pa8",
|
|
4894
|
+
greenyellow: "6senj",
|
|
4895
|
+
grey: "50i2o",
|
|
4896
|
+
honeydew: "9eiuo",
|
|
4897
|
+
hotpink: "9yrp0",
|
|
4898
|
+
indianred: "80gnw",
|
|
4899
|
+
indigo: "2xcoy",
|
|
4900
|
+
ivory: "9zldc",
|
|
4901
|
+
khaki: "9edu4",
|
|
4902
|
+
lavenderblush: "9ziet",
|
|
4903
|
+
lavender: "90c8q",
|
|
4904
|
+
lawngreen: "4vk74",
|
|
4905
|
+
lemonchiffon: "9zkct",
|
|
4906
|
+
lightblue: "6s73a",
|
|
4907
|
+
lightcoral: "9dtog",
|
|
4908
|
+
lightcyan: "8s1rz",
|
|
4909
|
+
lightgoldenrodyellow: "9sjiq",
|
|
4910
|
+
lightgray: "89jo3",
|
|
4911
|
+
lightgreen: "5nkwg",
|
|
4912
|
+
lightgrey: "89jo3",
|
|
4913
|
+
lightpink: "9z6wx",
|
|
4914
|
+
lightsalmon: "9z2ii",
|
|
4915
|
+
lightseagreen: "19xgq",
|
|
4916
|
+
lightskyblue: "5arju",
|
|
4917
|
+
lightslategray: "4nwk9",
|
|
4918
|
+
lightslategrey: "4nwk9",
|
|
4919
|
+
lightsteelblue: "6wau6",
|
|
4920
|
+
lightyellow: "9zlcw",
|
|
4921
|
+
lime: "1edc",
|
|
4922
|
+
limegreen: "1zcxe",
|
|
4923
|
+
linen: "9shk6",
|
|
4924
|
+
magenta: "9y70f",
|
|
4925
|
+
maroon: "4zsow",
|
|
4926
|
+
mediumaquamarine: "40eju",
|
|
4927
|
+
mediumblue: "5p",
|
|
4928
|
+
mediumorchid: "79qkz",
|
|
4929
|
+
mediumpurple: "5r3rv",
|
|
4930
|
+
mediumseagreen: "2d9ip",
|
|
4931
|
+
mediumslateblue: "4tcku",
|
|
4932
|
+
mediumspringgreen: "1di2",
|
|
4933
|
+
mediumturquoise: "2uabw",
|
|
4934
|
+
mediumvioletred: "7rn9h",
|
|
4935
|
+
midnightblue: "z980",
|
|
4936
|
+
mintcream: "9ljp6",
|
|
4937
|
+
mistyrose: "9zg0x",
|
|
4938
|
+
moccasin: "9zfzp",
|
|
4939
|
+
navajowhite: "9zest",
|
|
4940
|
+
navy: "3k",
|
|
4941
|
+
oldlace: "9wq92",
|
|
4942
|
+
olive: "50hz4",
|
|
4943
|
+
olivedrab: "472ub",
|
|
4944
|
+
orange: "9z3eo",
|
|
4945
|
+
orangered: "9ykg0",
|
|
4946
|
+
orchid: "8iu3a",
|
|
4947
|
+
palegoldenrod: "9bl4a",
|
|
4948
|
+
palegreen: "5yw0o",
|
|
4949
|
+
paleturquoise: "6v4ku",
|
|
4950
|
+
palevioletred: "8k8lv",
|
|
4951
|
+
papayawhip: "9zi6t",
|
|
4952
|
+
peachpuff: "9ze0p",
|
|
4953
|
+
peru: "80oqn",
|
|
4954
|
+
pink: "9z8wb",
|
|
4955
|
+
plum: "8nba5",
|
|
4956
|
+
powderblue: "6wgdi",
|
|
4957
|
+
purple: "4zssg",
|
|
4958
|
+
rebeccapurple: "3zk49",
|
|
4959
|
+
red: "9y6tc",
|
|
4960
|
+
rosybrown: "7cv4f",
|
|
4961
|
+
royalblue: "2jvtt",
|
|
4962
|
+
saddlebrown: "5fmkz",
|
|
4963
|
+
salmon: "9rvci",
|
|
4964
|
+
sandybrown: "9jn1c",
|
|
4965
|
+
seagreen: "1tdnb",
|
|
4966
|
+
seashell: "9zje6",
|
|
4967
|
+
sienna: "6973h",
|
|
4968
|
+
silver: "7ir40",
|
|
4969
|
+
skyblue: "5arjf",
|
|
4970
|
+
slateblue: "45e4t",
|
|
4971
|
+
slategray: "4e100",
|
|
4972
|
+
slategrey: "4e100",
|
|
4973
|
+
snow: "9zke2",
|
|
4974
|
+
springgreen: "1egv",
|
|
4975
|
+
steelblue: "2r1kk",
|
|
4976
|
+
tan: "87yx8",
|
|
4977
|
+
teal: "pds",
|
|
4978
|
+
thistle: "8ggk8",
|
|
4979
|
+
tomato: "9yqfb",
|
|
4980
|
+
turquoise: "2j4r4",
|
|
4981
|
+
violet: "9b10u",
|
|
4982
|
+
wheat: "9ld4j",
|
|
4983
|
+
white: "9zldr",
|
|
4984
|
+
whitesmoke: "9lhpx",
|
|
4985
|
+
yellow: "9zl6o",
|
|
4986
|
+
yellowgreen: "61fzm"
|
|
4987
|
+
};
|
|
4988
|
+
|
|
4989
|
+
// ../../node_modules/@ant-design/fast-color/es/FastColor.js
|
|
4990
|
+
var round = Math.round;
|
|
4991
|
+
function splitColorStr(str, parseNum) {
|
|
4992
|
+
const match = str.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [];
|
|
4993
|
+
const numList = match.map((item) => parseFloat(item));
|
|
4994
|
+
for (let i = 0; i < 3; i += 1) {
|
|
4995
|
+
numList[i] = parseNum(numList[i] || 0, match[i] || "", i);
|
|
4996
|
+
}
|
|
4997
|
+
if (match[3]) {
|
|
4998
|
+
numList[3] = match[3].includes("%") ? numList[3] / 100 : numList[3];
|
|
4999
|
+
} else {
|
|
5000
|
+
numList[3] = 1;
|
|
5001
|
+
}
|
|
5002
|
+
return numList;
|
|
5003
|
+
}
|
|
5004
|
+
var parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
|
|
5005
|
+
function limitRange(value, max) {
|
|
5006
|
+
const mergedMax = max || 255;
|
|
5007
|
+
if (value > mergedMax) {
|
|
5008
|
+
return mergedMax;
|
|
5009
|
+
}
|
|
5010
|
+
if (value < 0) {
|
|
5011
|
+
return 0;
|
|
5012
|
+
}
|
|
5013
|
+
return value;
|
|
5014
|
+
}
|
|
5015
|
+
var FastColor = class _FastColor {
|
|
5016
|
+
/**
|
|
5017
|
+
* All FastColor objects are valid. So isValid is always true. This property is kept to be compatible with TinyColor.
|
|
5018
|
+
*/
|
|
5019
|
+
isValid = true;
|
|
5020
|
+
/**
|
|
5021
|
+
* Red, R in RGB
|
|
5022
|
+
*/
|
|
5023
|
+
r = 0;
|
|
5024
|
+
/**
|
|
5025
|
+
* Green, G in RGB
|
|
5026
|
+
*/
|
|
5027
|
+
g = 0;
|
|
5028
|
+
/**
|
|
5029
|
+
* Blue, B in RGB
|
|
5030
|
+
*/
|
|
5031
|
+
b = 0;
|
|
5032
|
+
/**
|
|
5033
|
+
* Alpha/Opacity, A in RGBA/HSLA
|
|
5034
|
+
*/
|
|
5035
|
+
a = 1;
|
|
5036
|
+
// HSV privates
|
|
5037
|
+
_h;
|
|
5038
|
+
_hsl_s;
|
|
5039
|
+
_hsv_s;
|
|
5040
|
+
_l;
|
|
5041
|
+
_v;
|
|
5042
|
+
// intermediate variables to calculate HSL/HSV
|
|
5043
|
+
_max;
|
|
5044
|
+
_min;
|
|
5045
|
+
_brightness;
|
|
5046
|
+
constructor(input) {
|
|
5047
|
+
function matchFormat(str) {
|
|
5048
|
+
return str[0] in input && str[1] in input && str[2] in input;
|
|
5049
|
+
}
|
|
5050
|
+
if (!input) {
|
|
5051
|
+
} else if (typeof input === "string") {
|
|
5052
|
+
let matchPrefix2 = function(prefix) {
|
|
5053
|
+
return trimStr.startsWith(prefix);
|
|
5054
|
+
};
|
|
5055
|
+
var matchPrefix = matchPrefix2;
|
|
5056
|
+
const trimStr = input.trim();
|
|
5057
|
+
if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
|
|
5058
|
+
this.fromHexString(trimStr);
|
|
5059
|
+
} else if (matchPrefix2("rgb")) {
|
|
5060
|
+
this.fromRgbString(trimStr);
|
|
5061
|
+
} else if (matchPrefix2("hsl")) {
|
|
5062
|
+
this.fromHslString(trimStr);
|
|
5063
|
+
} else if (matchPrefix2("hsv") || matchPrefix2("hsb")) {
|
|
5064
|
+
this.fromHsvString(trimStr);
|
|
5065
|
+
} else {
|
|
5066
|
+
const presetColor = presetColors_default[trimStr.toLowerCase()];
|
|
5067
|
+
if (presetColor) {
|
|
5068
|
+
this.fromHexString(
|
|
5069
|
+
// Convert 36 hex to 16 hex
|
|
5070
|
+
parseInt(presetColor, 36).toString(16).padStart(6, "0")
|
|
5071
|
+
);
|
|
5072
|
+
}
|
|
5073
|
+
}
|
|
5074
|
+
} else if (input instanceof _FastColor) {
|
|
5075
|
+
this.r = input.r;
|
|
5076
|
+
this.g = input.g;
|
|
5077
|
+
this.b = input.b;
|
|
5078
|
+
this.a = input.a;
|
|
5079
|
+
this._h = input._h;
|
|
5080
|
+
this._hsl_s = input._hsl_s;
|
|
5081
|
+
this._hsv_s = input._hsv_s;
|
|
5082
|
+
this._l = input._l;
|
|
5083
|
+
this._v = input._v;
|
|
5084
|
+
} else if (matchFormat("rgb")) {
|
|
5085
|
+
this.r = limitRange(input.r);
|
|
5086
|
+
this.g = limitRange(input.g);
|
|
5087
|
+
this.b = limitRange(input.b);
|
|
5088
|
+
this.a = typeof input.a === "number" ? limitRange(input.a, 1) : 1;
|
|
5089
|
+
} else if (matchFormat("hsl")) {
|
|
5090
|
+
this.fromHsl(input);
|
|
5091
|
+
} else if (matchFormat("hsv")) {
|
|
5092
|
+
this.fromHsv(input);
|
|
5093
|
+
} else {
|
|
5094
|
+
throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(input));
|
|
5095
|
+
}
|
|
5096
|
+
}
|
|
5097
|
+
// ======================= Setter =======================
|
|
5098
|
+
setR(value) {
|
|
5099
|
+
return this._sc("r", value);
|
|
5100
|
+
}
|
|
5101
|
+
setG(value) {
|
|
5102
|
+
return this._sc("g", value);
|
|
5103
|
+
}
|
|
5104
|
+
setB(value) {
|
|
5105
|
+
return this._sc("b", value);
|
|
5106
|
+
}
|
|
5107
|
+
setA(value) {
|
|
5108
|
+
return this._sc("a", value, 1);
|
|
5109
|
+
}
|
|
5110
|
+
setHue(value) {
|
|
5111
|
+
const hsv = this.toHsv();
|
|
5112
|
+
hsv.h = value;
|
|
5113
|
+
return this._c(hsv);
|
|
5114
|
+
}
|
|
5115
|
+
// ======================= Getter =======================
|
|
5116
|
+
/**
|
|
5117
|
+
* Returns the perceived luminance of a color, from 0-1.
|
|
5118
|
+
* @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
5119
|
+
*/
|
|
5120
|
+
getLuminance() {
|
|
5121
|
+
function adjustGamma(raw) {
|
|
5122
|
+
const val = raw / 255;
|
|
5123
|
+
return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
|
|
5124
|
+
}
|
|
5125
|
+
const R = adjustGamma(this.r);
|
|
5126
|
+
const G = adjustGamma(this.g);
|
|
5127
|
+
const B = adjustGamma(this.b);
|
|
5128
|
+
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
5129
|
+
}
|
|
5130
|
+
getHue() {
|
|
5131
|
+
if (typeof this._h === "undefined") {
|
|
5132
|
+
const delta = this.getMax() - this.getMin();
|
|
5133
|
+
if (delta === 0) {
|
|
5134
|
+
this._h = 0;
|
|
5135
|
+
} else {
|
|
5136
|
+
this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
|
|
5137
|
+
}
|
|
5138
|
+
}
|
|
5139
|
+
return this._h;
|
|
5140
|
+
}
|
|
5141
|
+
/**
|
|
5142
|
+
* @deprecated should use getHSVSaturation or getHSLSaturation instead
|
|
5143
|
+
*/
|
|
5144
|
+
getSaturation() {
|
|
5145
|
+
return this.getHSVSaturation();
|
|
5146
|
+
}
|
|
5147
|
+
getHSVSaturation() {
|
|
5148
|
+
if (typeof this._hsv_s === "undefined") {
|
|
5149
|
+
const delta = this.getMax() - this.getMin();
|
|
5150
|
+
if (delta === 0) {
|
|
5151
|
+
this._hsv_s = 0;
|
|
5152
|
+
} else {
|
|
5153
|
+
this._hsv_s = delta / this.getMax();
|
|
5154
|
+
}
|
|
5155
|
+
}
|
|
5156
|
+
return this._hsv_s;
|
|
5157
|
+
}
|
|
5158
|
+
getHSLSaturation() {
|
|
5159
|
+
if (typeof this._hsl_s === "undefined") {
|
|
5160
|
+
const delta = this.getMax() - this.getMin();
|
|
5161
|
+
if (delta === 0) {
|
|
5162
|
+
this._hsl_s = 0;
|
|
5163
|
+
} else {
|
|
5164
|
+
const l = this.getLightness();
|
|
5165
|
+
this._hsl_s = delta / 255 / (1 - Math.abs(2 * l - 1));
|
|
5166
|
+
}
|
|
5167
|
+
}
|
|
5168
|
+
return this._hsl_s;
|
|
5169
|
+
}
|
|
5170
|
+
getLightness() {
|
|
5171
|
+
if (typeof this._l === "undefined") {
|
|
5172
|
+
this._l = (this.getMax() + this.getMin()) / 510;
|
|
5173
|
+
}
|
|
5174
|
+
return this._l;
|
|
5175
|
+
}
|
|
5176
|
+
getValue() {
|
|
5177
|
+
if (typeof this._v === "undefined") {
|
|
5178
|
+
this._v = this.getMax() / 255;
|
|
5179
|
+
}
|
|
5180
|
+
return this._v;
|
|
5181
|
+
}
|
|
5182
|
+
/**
|
|
5183
|
+
* Returns the perceived brightness of the color, from 0-255.
|
|
5184
|
+
* Note: this is not the b of HSB
|
|
5185
|
+
* @see http://www.w3.org/TR/AERT#color-contrast
|
|
5186
|
+
*/
|
|
5187
|
+
getBrightness() {
|
|
5188
|
+
if (typeof this._brightness === "undefined") {
|
|
5189
|
+
this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3;
|
|
5190
|
+
}
|
|
5191
|
+
return this._brightness;
|
|
5192
|
+
}
|
|
5193
|
+
// ======================== Func ========================
|
|
5194
|
+
darken(amount = 10) {
|
|
5195
|
+
const h = this.getHue();
|
|
5196
|
+
const s = this.getSaturation();
|
|
5197
|
+
let l = this.getLightness() - amount / 100;
|
|
5198
|
+
if (l < 0) {
|
|
5199
|
+
l = 0;
|
|
5200
|
+
}
|
|
5201
|
+
return this._c({
|
|
5202
|
+
h,
|
|
5203
|
+
s,
|
|
5204
|
+
l,
|
|
5205
|
+
a: this.a
|
|
5206
|
+
});
|
|
5207
|
+
}
|
|
5208
|
+
lighten(amount = 10) {
|
|
5209
|
+
const h = this.getHue();
|
|
5210
|
+
const s = this.getSaturation();
|
|
5211
|
+
let l = this.getLightness() + amount / 100;
|
|
5212
|
+
if (l > 1) {
|
|
5213
|
+
l = 1;
|
|
5214
|
+
}
|
|
5215
|
+
return this._c({
|
|
5216
|
+
h,
|
|
5217
|
+
s,
|
|
5218
|
+
l,
|
|
5219
|
+
a: this.a
|
|
5220
|
+
});
|
|
5221
|
+
}
|
|
5222
|
+
/**
|
|
5223
|
+
* Mix the current color a given amount with another color, from 0 to 100.
|
|
5224
|
+
* 0 means no mixing (return current color).
|
|
5225
|
+
*/
|
|
5226
|
+
mix(input, amount = 50) {
|
|
5227
|
+
const color = this._c(input);
|
|
5228
|
+
const p = amount / 100;
|
|
5229
|
+
const calc = (key) => (color[key] - this[key]) * p + this[key];
|
|
5230
|
+
const rgba = {
|
|
5231
|
+
r: round(calc("r")),
|
|
5232
|
+
g: round(calc("g")),
|
|
5233
|
+
b: round(calc("b")),
|
|
5234
|
+
a: round(calc("a") * 100) / 100
|
|
5235
|
+
};
|
|
5236
|
+
return this._c(rgba);
|
|
5237
|
+
}
|
|
5238
|
+
/**
|
|
5239
|
+
* Mix the color with pure white, from 0 to 100.
|
|
5240
|
+
* Providing 0 will do nothing, providing 100 will always return white.
|
|
5241
|
+
*/
|
|
5242
|
+
tint(amount = 10) {
|
|
5243
|
+
return this.mix({
|
|
5244
|
+
r: 255,
|
|
5245
|
+
g: 255,
|
|
5246
|
+
b: 255,
|
|
5247
|
+
a: 1
|
|
5248
|
+
}, amount);
|
|
5249
|
+
}
|
|
5250
|
+
/**
|
|
5251
|
+
* Mix the color with pure black, from 0 to 100.
|
|
5252
|
+
* Providing 0 will do nothing, providing 100 will always return black.
|
|
5253
|
+
*/
|
|
5254
|
+
shade(amount = 10) {
|
|
5255
|
+
return this.mix({
|
|
5256
|
+
r: 0,
|
|
5257
|
+
g: 0,
|
|
5258
|
+
b: 0,
|
|
5259
|
+
a: 1
|
|
5260
|
+
}, amount);
|
|
5261
|
+
}
|
|
5262
|
+
onBackground(background) {
|
|
5263
|
+
const bg = this._c(background);
|
|
5264
|
+
const alpha = this.a + bg.a * (1 - this.a);
|
|
5265
|
+
const calc = (key) => {
|
|
5266
|
+
return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
|
|
5267
|
+
};
|
|
5268
|
+
return this._c({
|
|
5269
|
+
r: calc("r"),
|
|
5270
|
+
g: calc("g"),
|
|
5271
|
+
b: calc("b"),
|
|
5272
|
+
a: alpha
|
|
5273
|
+
});
|
|
5274
|
+
}
|
|
5275
|
+
// ======================= Status =======================
|
|
5276
|
+
isDark() {
|
|
5277
|
+
return this.getBrightness() < 128;
|
|
5278
|
+
}
|
|
5279
|
+
isLight() {
|
|
5280
|
+
return this.getBrightness() >= 128;
|
|
5281
|
+
}
|
|
5282
|
+
// ======================== MISC ========================
|
|
5283
|
+
equals(other) {
|
|
5284
|
+
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
|
|
5285
|
+
}
|
|
5286
|
+
clone() {
|
|
5287
|
+
return this._c(this);
|
|
5288
|
+
}
|
|
5289
|
+
// ======================= Format =======================
|
|
5290
|
+
toHexString() {
|
|
5291
|
+
let hex = "#";
|
|
5292
|
+
const rHex = (this.r || 0).toString(16);
|
|
5293
|
+
hex += rHex.length === 2 ? rHex : "0" + rHex;
|
|
5294
|
+
const gHex = (this.g || 0).toString(16);
|
|
5295
|
+
hex += gHex.length === 2 ? gHex : "0" + gHex;
|
|
5296
|
+
const bHex = (this.b || 0).toString(16);
|
|
5297
|
+
hex += bHex.length === 2 ? bHex : "0" + bHex;
|
|
5298
|
+
if (typeof this.a === "number" && this.a >= 0 && this.a < 1) {
|
|
5299
|
+
const aHex = round(this.a * 255).toString(16);
|
|
5300
|
+
hex += aHex.length === 2 ? aHex : "0" + aHex;
|
|
5301
|
+
}
|
|
5302
|
+
return hex;
|
|
5303
|
+
}
|
|
5304
|
+
/** CSS support color pattern */
|
|
5305
|
+
toHsl() {
|
|
5306
|
+
return {
|
|
5307
|
+
h: this.getHue(),
|
|
5308
|
+
s: this.getHSLSaturation(),
|
|
5309
|
+
l: this.getLightness(),
|
|
5310
|
+
a: this.a
|
|
5311
|
+
};
|
|
5312
|
+
}
|
|
5313
|
+
/** CSS support color pattern */
|
|
5314
|
+
toHslString() {
|
|
5315
|
+
const h = this.getHue();
|
|
5316
|
+
const s = round(this.getHSLSaturation() * 100);
|
|
5317
|
+
const l = round(this.getLightness() * 100);
|
|
5318
|
+
return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
|
|
5319
|
+
}
|
|
5320
|
+
/** Same as toHsb */
|
|
5321
|
+
toHsv() {
|
|
5322
|
+
return {
|
|
5323
|
+
h: this.getHue(),
|
|
5324
|
+
s: this.getHSVSaturation(),
|
|
5325
|
+
v: this.getValue(),
|
|
5326
|
+
a: this.a
|
|
5327
|
+
};
|
|
5328
|
+
}
|
|
5329
|
+
toRgb() {
|
|
5330
|
+
return {
|
|
5331
|
+
r: this.r,
|
|
5332
|
+
g: this.g,
|
|
5333
|
+
b: this.b,
|
|
5334
|
+
a: this.a
|
|
5335
|
+
};
|
|
5336
|
+
}
|
|
5337
|
+
toRgbString() {
|
|
5338
|
+
return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
|
|
5339
|
+
}
|
|
5340
|
+
toString() {
|
|
5341
|
+
return this.toRgbString();
|
|
5342
|
+
}
|
|
5343
|
+
// ====================== Privates ======================
|
|
5344
|
+
/** Return a new FastColor object with one channel changed */
|
|
5345
|
+
_sc(rgb, value, max) {
|
|
5346
|
+
const clone = this.clone();
|
|
5347
|
+
clone[rgb] = limitRange(value, max);
|
|
5348
|
+
return clone;
|
|
5349
|
+
}
|
|
5350
|
+
_c(input) {
|
|
5351
|
+
return new this.constructor(input);
|
|
5352
|
+
}
|
|
5353
|
+
getMax() {
|
|
5354
|
+
if (typeof this._max === "undefined") {
|
|
5355
|
+
this._max = Math.max(this.r, this.g, this.b);
|
|
5356
|
+
}
|
|
5357
|
+
return this._max;
|
|
5358
|
+
}
|
|
5359
|
+
getMin() {
|
|
5360
|
+
if (typeof this._min === "undefined") {
|
|
5361
|
+
this._min = Math.min(this.r, this.g, this.b);
|
|
5362
|
+
}
|
|
5363
|
+
return this._min;
|
|
5364
|
+
}
|
|
5365
|
+
fromHexString(trimStr) {
|
|
5366
|
+
const withoutPrefix = trimStr.replace("#", "");
|
|
5367
|
+
function connectNum(index1, index2) {
|
|
5368
|
+
return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
|
|
5369
|
+
}
|
|
5370
|
+
if (withoutPrefix.length < 6) {
|
|
5371
|
+
this.r = connectNum(0);
|
|
5372
|
+
this.g = connectNum(1);
|
|
5373
|
+
this.b = connectNum(2);
|
|
5374
|
+
this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
|
|
5375
|
+
} else {
|
|
5376
|
+
this.r = connectNum(0, 1);
|
|
5377
|
+
this.g = connectNum(2, 3);
|
|
5378
|
+
this.b = connectNum(4, 5);
|
|
5379
|
+
this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5382
|
+
fromHsl({
|
|
5383
|
+
h: _h,
|
|
5384
|
+
s,
|
|
5385
|
+
l,
|
|
5386
|
+
a
|
|
5387
|
+
}) {
|
|
5388
|
+
const h = (_h % 360 + 360) % 360;
|
|
5389
|
+
this._h = h;
|
|
5390
|
+
this._hsl_s = s;
|
|
5391
|
+
this._l = l;
|
|
5392
|
+
this.a = typeof a === "number" ? a : 1;
|
|
5393
|
+
if (s <= 0) {
|
|
5394
|
+
const rgb = round(l * 255);
|
|
5395
|
+
this.r = rgb;
|
|
5396
|
+
this.g = rgb;
|
|
5397
|
+
this.b = rgb;
|
|
5398
|
+
return;
|
|
5399
|
+
}
|
|
5400
|
+
let r = 0, g = 0, b = 0;
|
|
5401
|
+
const huePrime = h / 60;
|
|
5402
|
+
const chroma = (1 - Math.abs(2 * l - 1)) * s;
|
|
5403
|
+
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
5404
|
+
if (huePrime >= 0 && huePrime < 1) {
|
|
5405
|
+
r = chroma;
|
|
5406
|
+
g = secondComponent;
|
|
5407
|
+
} else if (huePrime >= 1 && huePrime < 2) {
|
|
5408
|
+
r = secondComponent;
|
|
5409
|
+
g = chroma;
|
|
5410
|
+
} else if (huePrime >= 2 && huePrime < 3) {
|
|
5411
|
+
g = chroma;
|
|
5412
|
+
b = secondComponent;
|
|
5413
|
+
} else if (huePrime >= 3 && huePrime < 4) {
|
|
5414
|
+
g = secondComponent;
|
|
5415
|
+
b = chroma;
|
|
5416
|
+
} else if (huePrime >= 4 && huePrime < 5) {
|
|
5417
|
+
r = secondComponent;
|
|
5418
|
+
b = chroma;
|
|
5419
|
+
} else if (huePrime >= 5 && huePrime < 6) {
|
|
5420
|
+
r = chroma;
|
|
5421
|
+
b = secondComponent;
|
|
5422
|
+
}
|
|
5423
|
+
const lightnessModification = l - chroma / 2;
|
|
5424
|
+
this.r = round((r + lightnessModification) * 255);
|
|
5425
|
+
this.g = round((g + lightnessModification) * 255);
|
|
5426
|
+
this.b = round((b + lightnessModification) * 255);
|
|
5427
|
+
}
|
|
5428
|
+
fromHsv({
|
|
5429
|
+
h: _h,
|
|
5430
|
+
s,
|
|
5431
|
+
v,
|
|
5432
|
+
a
|
|
5433
|
+
}) {
|
|
5434
|
+
const h = (_h % 360 + 360) % 360;
|
|
5435
|
+
this._h = h;
|
|
5436
|
+
this._hsv_s = s;
|
|
5437
|
+
this._v = v;
|
|
5438
|
+
this.a = typeof a === "number" ? a : 1;
|
|
5439
|
+
const vv = round(v * 255);
|
|
5440
|
+
this.r = vv;
|
|
5441
|
+
this.g = vv;
|
|
5442
|
+
this.b = vv;
|
|
5443
|
+
if (s <= 0) {
|
|
5444
|
+
return;
|
|
5445
|
+
}
|
|
5446
|
+
const hh = h / 60;
|
|
5447
|
+
const i = Math.floor(hh);
|
|
5448
|
+
const ff = hh - i;
|
|
5449
|
+
const p = round(v * (1 - s) * 255);
|
|
5450
|
+
const q = round(v * (1 - s * ff) * 255);
|
|
5451
|
+
const t = round(v * (1 - s * (1 - ff)) * 255);
|
|
5452
|
+
switch (i) {
|
|
5453
|
+
case 0:
|
|
5454
|
+
this.g = t;
|
|
5455
|
+
this.b = p;
|
|
5456
|
+
break;
|
|
5457
|
+
case 1:
|
|
5458
|
+
this.r = q;
|
|
5459
|
+
this.b = p;
|
|
5460
|
+
break;
|
|
5461
|
+
case 2:
|
|
5462
|
+
this.r = p;
|
|
5463
|
+
this.b = t;
|
|
5464
|
+
break;
|
|
5465
|
+
case 3:
|
|
5466
|
+
this.r = p;
|
|
5467
|
+
this.g = q;
|
|
5468
|
+
break;
|
|
5469
|
+
case 4:
|
|
5470
|
+
this.r = t;
|
|
5471
|
+
this.g = p;
|
|
5472
|
+
break;
|
|
5473
|
+
case 5:
|
|
5474
|
+
default:
|
|
5475
|
+
this.g = p;
|
|
5476
|
+
this.b = q;
|
|
5477
|
+
break;
|
|
5478
|
+
}
|
|
5479
|
+
}
|
|
5480
|
+
fromHsvString(trimStr) {
|
|
5481
|
+
const cells = splitColorStr(trimStr, parseHSVorHSL);
|
|
5482
|
+
this.fromHsv({
|
|
5483
|
+
h: cells[0],
|
|
5484
|
+
s: cells[1],
|
|
5485
|
+
v: cells[2],
|
|
5486
|
+
a: cells[3]
|
|
5487
|
+
});
|
|
5488
|
+
}
|
|
5489
|
+
fromHslString(trimStr) {
|
|
5490
|
+
const cells = splitColorStr(trimStr, parseHSVorHSL);
|
|
5491
|
+
this.fromHsl({
|
|
5492
|
+
h: cells[0],
|
|
5493
|
+
s: cells[1],
|
|
5494
|
+
l: cells[2],
|
|
5495
|
+
a: cells[3]
|
|
5496
|
+
});
|
|
5497
|
+
}
|
|
5498
|
+
fromRgbString(trimStr) {
|
|
5499
|
+
const cells = splitColorStr(trimStr, (num, txt) => (
|
|
5500
|
+
// Convert percentage to number. e.g. 50% -> 128
|
|
5501
|
+
txt.includes("%") ? round(num / 100 * 255) : num
|
|
5502
|
+
));
|
|
5503
|
+
this.r = cells[0];
|
|
5504
|
+
this.g = cells[1];
|
|
5505
|
+
this.b = cells[2];
|
|
5506
|
+
this.a = cells[3];
|
|
5507
|
+
}
|
|
5508
|
+
};
|
|
5509
|
+
|
|
5510
|
+
// ../../node_modules/@ant-design/colors/es/generate.js
|
|
5511
|
+
var hueStep = 2;
|
|
5512
|
+
var saturationStep = 0.16;
|
|
5513
|
+
var saturationStep2 = 0.05;
|
|
5514
|
+
var brightnessStep1 = 0.05;
|
|
5515
|
+
var brightnessStep2 = 0.15;
|
|
5516
|
+
var lightColorCount = 5;
|
|
5517
|
+
var darkColorCount = 4;
|
|
5518
|
+
var darkColorMap = [{
|
|
5519
|
+
index: 7,
|
|
5520
|
+
amount: 15
|
|
5521
|
+
}, {
|
|
5522
|
+
index: 6,
|
|
5523
|
+
amount: 25
|
|
5524
|
+
}, {
|
|
5525
|
+
index: 5,
|
|
5526
|
+
amount: 30
|
|
5527
|
+
}, {
|
|
5528
|
+
index: 5,
|
|
5529
|
+
amount: 45
|
|
5530
|
+
}, {
|
|
5531
|
+
index: 5,
|
|
5532
|
+
amount: 65
|
|
5533
|
+
}, {
|
|
5534
|
+
index: 5,
|
|
5535
|
+
amount: 85
|
|
5536
|
+
}, {
|
|
5537
|
+
index: 4,
|
|
5538
|
+
amount: 90
|
|
5539
|
+
}, {
|
|
5540
|
+
index: 3,
|
|
5541
|
+
amount: 95
|
|
5542
|
+
}, {
|
|
5543
|
+
index: 2,
|
|
5544
|
+
amount: 97
|
|
5545
|
+
}, {
|
|
5546
|
+
index: 1,
|
|
5547
|
+
amount: 98
|
|
5548
|
+
}];
|
|
5549
|
+
function getHue(hsv, i, light) {
|
|
5550
|
+
let hue;
|
|
5551
|
+
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
|
|
5552
|
+
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
|
|
5553
|
+
} else {
|
|
5554
|
+
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
|
|
5555
|
+
}
|
|
5556
|
+
if (hue < 0) {
|
|
5557
|
+
hue += 360;
|
|
5558
|
+
} else if (hue >= 360) {
|
|
5559
|
+
hue -= 360;
|
|
5560
|
+
}
|
|
5561
|
+
return hue;
|
|
5562
|
+
}
|
|
5563
|
+
function getSaturation(hsv, i, light) {
|
|
5564
|
+
if (hsv.h === 0 && hsv.s === 0) {
|
|
5565
|
+
return hsv.s;
|
|
5566
|
+
}
|
|
5567
|
+
let saturation;
|
|
5568
|
+
if (light) {
|
|
5569
|
+
saturation = hsv.s - saturationStep * i;
|
|
5570
|
+
} else if (i === darkColorCount) {
|
|
5571
|
+
saturation = hsv.s + saturationStep;
|
|
5572
|
+
} else {
|
|
5573
|
+
saturation = hsv.s + saturationStep2 * i;
|
|
5574
|
+
}
|
|
5575
|
+
if (saturation > 1) {
|
|
5576
|
+
saturation = 1;
|
|
5577
|
+
}
|
|
5578
|
+
if (light && i === lightColorCount && saturation > 0.1) {
|
|
5579
|
+
saturation = 0.1;
|
|
5580
|
+
}
|
|
5581
|
+
if (saturation < 0.06) {
|
|
5582
|
+
saturation = 0.06;
|
|
5583
|
+
}
|
|
5584
|
+
return Math.round(saturation * 100) / 100;
|
|
5585
|
+
}
|
|
5586
|
+
function getValue(hsv, i, light) {
|
|
5587
|
+
let value;
|
|
5588
|
+
if (light) {
|
|
5589
|
+
value = hsv.v + brightnessStep1 * i;
|
|
5590
|
+
} else {
|
|
5591
|
+
value = hsv.v - brightnessStep2 * i;
|
|
5592
|
+
}
|
|
5593
|
+
value = Math.max(0, Math.min(1, value));
|
|
5594
|
+
return Math.round(value * 100) / 100;
|
|
5595
|
+
}
|
|
5596
|
+
function generate(color, opts = {}) {
|
|
5597
|
+
const patterns = [];
|
|
5598
|
+
const pColor = new FastColor(color);
|
|
5599
|
+
const hsv = pColor.toHsv();
|
|
5600
|
+
for (let i = lightColorCount; i > 0; i -= 1) {
|
|
5601
|
+
const c = new FastColor({
|
|
5602
|
+
h: getHue(hsv, i, true),
|
|
5603
|
+
s: getSaturation(hsv, i, true),
|
|
5604
|
+
v: getValue(hsv, i, true)
|
|
5605
|
+
});
|
|
5606
|
+
patterns.push(c);
|
|
5607
|
+
}
|
|
5608
|
+
patterns.push(pColor);
|
|
5609
|
+
for (let i = 1; i <= darkColorCount; i += 1) {
|
|
5610
|
+
const c = new FastColor({
|
|
5611
|
+
h: getHue(hsv, i),
|
|
5612
|
+
s: getSaturation(hsv, i),
|
|
5613
|
+
v: getValue(hsv, i)
|
|
5614
|
+
});
|
|
5615
|
+
patterns.push(c);
|
|
5616
|
+
}
|
|
5617
|
+
if (opts.theme === "dark") {
|
|
5618
|
+
return darkColorMap.map(({
|
|
5619
|
+
index,
|
|
5620
|
+
amount
|
|
5621
|
+
}) => new FastColor(opts.backgroundColor || "#141414").mix(patterns[index], amount).toHexString());
|
|
5622
|
+
}
|
|
5623
|
+
return patterns.map((c) => c.toHexString());
|
|
5624
|
+
}
|
|
5625
|
+
|
|
5626
|
+
// ../../node_modules/@ant-design/colors/es/presets.js
|
|
5627
|
+
var red = ["#fff1f0", "#ffccc7", "#ffa39e", "#ff7875", "#ff4d4f", "#f5222d", "#cf1322", "#a8071a", "#820014", "#5c0011"];
|
|
5628
|
+
red.primary = red[5];
|
|
5629
|
+
var volcano = ["#fff2e8", "#ffd8bf", "#ffbb96", "#ff9c6e", "#ff7a45", "#fa541c", "#d4380d", "#ad2102", "#871400", "#610b00"];
|
|
5630
|
+
volcano.primary = volcano[5];
|
|
5631
|
+
var orange = ["#fff7e6", "#ffe7ba", "#ffd591", "#ffc069", "#ffa940", "#fa8c16", "#d46b08", "#ad4e00", "#873800", "#612500"];
|
|
5632
|
+
orange.primary = orange[5];
|
|
5633
|
+
var gold = ["#fffbe6", "#fff1b8", "#ffe58f", "#ffd666", "#ffc53d", "#faad14", "#d48806", "#ad6800", "#874d00", "#613400"];
|
|
5634
|
+
gold.primary = gold[5];
|
|
5635
|
+
var yellow = ["#feffe6", "#ffffb8", "#fffb8f", "#fff566", "#ffec3d", "#fadb14", "#d4b106", "#ad8b00", "#876800", "#614700"];
|
|
5636
|
+
yellow.primary = yellow[5];
|
|
5637
|
+
var lime = ["#fcffe6", "#f4ffb8", "#eaff8f", "#d3f261", "#bae637", "#a0d911", "#7cb305", "#5b8c00", "#3f6600", "#254000"];
|
|
5638
|
+
lime.primary = lime[5];
|
|
5639
|
+
var green = ["#f6ffed", "#d9f7be", "#b7eb8f", "#95de64", "#73d13d", "#52c41a", "#389e0d", "#237804", "#135200", "#092b00"];
|
|
5640
|
+
green.primary = green[5];
|
|
5641
|
+
var cyan = ["#e6fffb", "#b5f5ec", "#87e8de", "#5cdbd3", "#36cfc9", "#13c2c2", "#08979c", "#006d75", "#00474f", "#002329"];
|
|
5642
|
+
cyan.primary = cyan[5];
|
|
5643
|
+
var blue = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
|
|
5644
|
+
blue.primary = blue[5];
|
|
5645
|
+
var geekblue = ["#f0f5ff", "#d6e4ff", "#adc6ff", "#85a5ff", "#597ef7", "#2f54eb", "#1d39c4", "#10239e", "#061178", "#030852"];
|
|
5646
|
+
geekblue.primary = geekblue[5];
|
|
5647
|
+
var purple = ["#f9f0ff", "#efdbff", "#d3adf7", "#b37feb", "#9254de", "#722ed1", "#531dab", "#391085", "#22075e", "#120338"];
|
|
5648
|
+
purple.primary = purple[5];
|
|
5649
|
+
var magenta = ["#fff0f6", "#ffd6e7", "#ffadd2", "#ff85c0", "#f759ab", "#eb2f96", "#c41d7f", "#9e1068", "#780650", "#520339"];
|
|
5650
|
+
magenta.primary = magenta[5];
|
|
5651
|
+
var grey = ["#a6a6a6", "#999999", "#8c8c8c", "#808080", "#737373", "#666666", "#404040", "#1a1a1a", "#000000", "#000000"];
|
|
5652
|
+
grey.primary = grey[5];
|
|
5653
|
+
var redDark = ["#2a1215", "#431418", "#58181c", "#791a1f", "#a61d24", "#d32029", "#e84749", "#f37370", "#f89f9a", "#fac8c3"];
|
|
5654
|
+
redDark.primary = redDark[5];
|
|
5655
|
+
var volcanoDark = ["#2b1611", "#441d12", "#592716", "#7c3118", "#aa3e19", "#d84a1b", "#e87040", "#f3956a", "#f8b692", "#fad4bc"];
|
|
5656
|
+
volcanoDark.primary = volcanoDark[5];
|
|
5657
|
+
var orangeDark = ["#2b1d11", "#442a11", "#593815", "#7c4a15", "#aa6215", "#d87a16", "#e89a3c", "#f3b765", "#f8cf8d", "#fae3b7"];
|
|
5658
|
+
orangeDark.primary = orangeDark[5];
|
|
5659
|
+
var goldDark = ["#2b2111", "#443111", "#594214", "#7c5914", "#aa7714", "#d89614", "#e8b339", "#f3cc62", "#f8df8b", "#faedb5"];
|
|
5660
|
+
goldDark.primary = goldDark[5];
|
|
5661
|
+
var yellowDark = ["#2b2611", "#443b11", "#595014", "#7c6e14", "#aa9514", "#d8bd14", "#e8d639", "#f3ea62", "#f8f48b", "#fafab5"];
|
|
5662
|
+
yellowDark.primary = yellowDark[5];
|
|
5663
|
+
var limeDark = ["#1f2611", "#2e3c10", "#3e4f13", "#536d13", "#6f9412", "#8bbb11", "#a9d134", "#c9e75d", "#e4f88b", "#f0fab5"];
|
|
5664
|
+
limeDark.primary = limeDark[5];
|
|
5665
|
+
var greenDark = ["#162312", "#1d3712", "#274916", "#306317", "#3c8618", "#49aa19", "#6abe39", "#8fd460", "#b2e58b", "#d5f2bb"];
|
|
5666
|
+
greenDark.primary = greenDark[5];
|
|
5667
|
+
var cyanDark = ["#112123", "#113536", "#144848", "#146262", "#138585", "#13a8a8", "#33bcb7", "#58d1c9", "#84e2d8", "#b2f1e8"];
|
|
5668
|
+
cyanDark.primary = cyanDark[5];
|
|
5669
|
+
var blueDark = ["#111a2c", "#112545", "#15325b", "#15417e", "#1554ad", "#1668dc", "#3c89e8", "#65a9f3", "#8dc5f8", "#b7dcfa"];
|
|
5670
|
+
blueDark.primary = blueDark[5];
|
|
5671
|
+
var geekblueDark = ["#131629", "#161d40", "#1c2755", "#203175", "#263ea0", "#2b4acb", "#5273e0", "#7f9ef3", "#a8c1f8", "#d2e0fa"];
|
|
5672
|
+
geekblueDark.primary = geekblueDark[5];
|
|
5673
|
+
var purpleDark = ["#1a1325", "#24163a", "#301c4d", "#3e2069", "#51258f", "#642ab5", "#854eca", "#ab7ae0", "#cda8f0", "#ebd7fa"];
|
|
5674
|
+
purpleDark.primary = purpleDark[5];
|
|
5675
|
+
var magentaDark = ["#291321", "#40162f", "#551c3b", "#75204f", "#a02669", "#cb2b83", "#e0529c", "#f37fb7", "#f8a8cc", "#fad2e3"];
|
|
5676
|
+
magentaDark.primary = magentaDark[5];
|
|
5677
|
+
var greyDark = ["#151515", "#1f1f1f", "#2d2d2d", "#393939", "#494949", "#5a5a5a", "#6a6a6a", "#7b7b7b", "#888888", "#969696"];
|
|
5678
|
+
greyDark.primary = greyDark[5];
|
|
5679
|
+
|
|
5680
|
+
// ../../node_modules/@ant-design/icons/es/components/IconBase.js
|
|
5681
|
+
import * as React13 from "react";
|
|
5682
|
+
|
|
5683
|
+
// ../../node_modules/@rc-component/util/es/Dom/canUseDom.js
|
|
5684
|
+
function canUseDom() {
|
|
5685
|
+
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
5686
|
+
}
|
|
5687
|
+
|
|
5688
|
+
// ../../node_modules/@rc-component/util/es/Dom/contains.js
|
|
5689
|
+
function contains(root, n) {
|
|
5690
|
+
if (!root) {
|
|
5691
|
+
return false;
|
|
5692
|
+
}
|
|
5693
|
+
if (root.contains) {
|
|
5694
|
+
return root.contains(n);
|
|
5695
|
+
}
|
|
5696
|
+
let node = n;
|
|
5697
|
+
while (node) {
|
|
5698
|
+
if (node === root) {
|
|
5699
|
+
return true;
|
|
5700
|
+
}
|
|
5701
|
+
node = node.parentNode;
|
|
5702
|
+
}
|
|
5703
|
+
return false;
|
|
5704
|
+
}
|
|
5705
|
+
|
|
5706
|
+
// ../../node_modules/@rc-component/util/es/Dom/dynamicCSS.js
|
|
5707
|
+
var APPEND_ORDER = "data-rc-order";
|
|
5708
|
+
var APPEND_PRIORITY = "data-rc-priority";
|
|
5709
|
+
var MARK_KEY = `rc-util-key`;
|
|
5710
|
+
var containerCache = /* @__PURE__ */ new Map();
|
|
5711
|
+
function getMark({
|
|
5712
|
+
mark
|
|
5713
|
+
} = {}) {
|
|
5714
|
+
if (mark) {
|
|
5715
|
+
return mark.startsWith("data-") ? mark : `data-${mark}`;
|
|
5716
|
+
}
|
|
5717
|
+
return MARK_KEY;
|
|
5718
|
+
}
|
|
5719
|
+
function getContainer(option) {
|
|
5720
|
+
if (option.attachTo) {
|
|
5721
|
+
return option.attachTo;
|
|
5722
|
+
}
|
|
5723
|
+
const head = document.querySelector("head");
|
|
5724
|
+
return head || document.body;
|
|
5725
|
+
}
|
|
5726
|
+
function getOrder(prepend) {
|
|
5727
|
+
if (prepend === "queue") {
|
|
5728
|
+
return "prependQueue";
|
|
5729
|
+
}
|
|
5730
|
+
return prepend ? "prepend" : "append";
|
|
5731
|
+
}
|
|
5732
|
+
function findStyles(container) {
|
|
5733
|
+
return Array.from((containerCache.get(container) || container).children).filter((node) => node.tagName === "STYLE");
|
|
5734
|
+
}
|
|
5735
|
+
function injectCSS(css, option = {}) {
|
|
5736
|
+
if (!canUseDom()) {
|
|
5737
|
+
return null;
|
|
5738
|
+
}
|
|
5739
|
+
const {
|
|
5740
|
+
csp,
|
|
5741
|
+
prepend,
|
|
5742
|
+
priority = 0
|
|
5743
|
+
} = option;
|
|
5744
|
+
const mergedOrder = getOrder(prepend);
|
|
5745
|
+
const isPrependQueue = mergedOrder === "prependQueue";
|
|
5746
|
+
const styleNode = document.createElement("style");
|
|
5747
|
+
styleNode.setAttribute(APPEND_ORDER, mergedOrder);
|
|
5748
|
+
if (isPrependQueue && priority) {
|
|
5749
|
+
styleNode.setAttribute(APPEND_PRIORITY, `${priority}`);
|
|
5750
|
+
}
|
|
5751
|
+
if (csp?.nonce) {
|
|
5752
|
+
styleNode.nonce = csp?.nonce;
|
|
5753
|
+
}
|
|
5754
|
+
styleNode.innerHTML = css;
|
|
5755
|
+
const container = getContainer(option);
|
|
5756
|
+
const {
|
|
5757
|
+
firstChild
|
|
5758
|
+
} = container;
|
|
5759
|
+
if (prepend) {
|
|
5760
|
+
if (isPrependQueue) {
|
|
5761
|
+
const existStyle = (option.styles || findStyles(container)).filter((node) => {
|
|
5762
|
+
if (!["prepend", "prependQueue"].includes(node.getAttribute(APPEND_ORDER))) {
|
|
5763
|
+
return false;
|
|
5764
|
+
}
|
|
5765
|
+
const nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
|
|
5766
|
+
return priority >= nodePriority;
|
|
5767
|
+
});
|
|
5768
|
+
if (existStyle.length) {
|
|
5769
|
+
container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
|
|
5770
|
+
return styleNode;
|
|
5771
|
+
}
|
|
5772
|
+
}
|
|
5773
|
+
container.insertBefore(styleNode, firstChild);
|
|
5774
|
+
} else {
|
|
5775
|
+
container.appendChild(styleNode);
|
|
5776
|
+
}
|
|
5777
|
+
return styleNode;
|
|
5778
|
+
}
|
|
5779
|
+
function findExistNode(key, option = {}) {
|
|
5780
|
+
let {
|
|
5781
|
+
styles
|
|
5782
|
+
} = option;
|
|
5783
|
+
styles ||= findStyles(getContainer(option));
|
|
5784
|
+
return styles.find((node) => node.getAttribute(getMark(option)) === key);
|
|
5785
|
+
}
|
|
5786
|
+
function syncRealContainer(container, option) {
|
|
5787
|
+
const cachedRealContainer = containerCache.get(container);
|
|
5788
|
+
if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
|
|
5789
|
+
const placeholderStyle = injectCSS("", option);
|
|
5790
|
+
const {
|
|
5791
|
+
parentNode
|
|
5792
|
+
} = placeholderStyle;
|
|
5793
|
+
containerCache.set(container, parentNode);
|
|
5794
|
+
container.removeChild(placeholderStyle);
|
|
5795
|
+
}
|
|
5796
|
+
}
|
|
5797
|
+
function updateCSS(css, key, originOption = {}) {
|
|
5798
|
+
const container = getContainer(originOption);
|
|
5799
|
+
const styles = findStyles(container);
|
|
5800
|
+
const option = {
|
|
5801
|
+
...originOption,
|
|
5802
|
+
styles
|
|
5803
|
+
};
|
|
5804
|
+
syncRealContainer(container, option);
|
|
5805
|
+
const existNode = findExistNode(key, option);
|
|
5806
|
+
if (existNode) {
|
|
5807
|
+
if (option.csp?.nonce && existNode.nonce !== option.csp?.nonce) {
|
|
5808
|
+
existNode.nonce = option.csp?.nonce;
|
|
5809
|
+
}
|
|
5810
|
+
if (existNode.innerHTML !== css) {
|
|
5811
|
+
existNode.innerHTML = css;
|
|
5812
|
+
}
|
|
5813
|
+
return existNode;
|
|
5814
|
+
}
|
|
5815
|
+
const newNode = injectCSS(css, option);
|
|
5816
|
+
newNode.setAttribute(getMark(option), key);
|
|
5817
|
+
return newNode;
|
|
5818
|
+
}
|
|
5819
|
+
|
|
5820
|
+
// ../../node_modules/@rc-component/util/es/Dom/shadow.js
|
|
5821
|
+
function getRoot(ele) {
|
|
5822
|
+
return ele?.getRootNode?.();
|
|
5823
|
+
}
|
|
5824
|
+
function inShadow(ele) {
|
|
5825
|
+
return getRoot(ele) instanceof ShadowRoot;
|
|
5826
|
+
}
|
|
5827
|
+
function getShadowRoot(ele) {
|
|
5828
|
+
return inShadow(ele) ? getRoot(ele) : null;
|
|
5829
|
+
}
|
|
5830
|
+
|
|
5831
|
+
// ../../node_modules/@rc-component/util/es/warning.js
|
|
5832
|
+
var warned = {};
|
|
5833
|
+
var preWarningFns = [];
|
|
5834
|
+
var preMessage = (fn) => {
|
|
5835
|
+
preWarningFns.push(fn);
|
|
5836
|
+
};
|
|
5837
|
+
function warning(valid, message) {
|
|
5838
|
+
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
5839
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message);
|
|
5840
|
+
if (finalMessage) {
|
|
5841
|
+
console.error(`Warning: ${finalMessage}`);
|
|
5842
|
+
}
|
|
5843
|
+
}
|
|
5844
|
+
}
|
|
5845
|
+
function note(valid, message) {
|
|
5846
|
+
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
5847
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message);
|
|
5848
|
+
if (finalMessage) {
|
|
5849
|
+
console.warn(`Note: ${finalMessage}`);
|
|
5850
|
+
}
|
|
5851
|
+
}
|
|
5852
|
+
}
|
|
5853
|
+
function resetWarned() {
|
|
5854
|
+
warned = {};
|
|
5855
|
+
}
|
|
5856
|
+
function call(method, valid, message) {
|
|
5857
|
+
if (!valid && !warned[message]) {
|
|
5858
|
+
method(false, message);
|
|
5859
|
+
warned[message] = true;
|
|
5860
|
+
}
|
|
5861
|
+
}
|
|
5862
|
+
function warningOnce(valid, message) {
|
|
5863
|
+
call(warning, valid, message);
|
|
5864
|
+
}
|
|
5865
|
+
function noteOnce(valid, message) {
|
|
5866
|
+
call(note, valid, message);
|
|
5867
|
+
}
|
|
5868
|
+
warningOnce.preMessage = preMessage;
|
|
5869
|
+
warningOnce.resetWarned = resetWarned;
|
|
5870
|
+
warningOnce.noteOnce = noteOnce;
|
|
5871
|
+
|
|
5872
|
+
// ../../node_modules/@ant-design/icons/es/utils.js
|
|
5873
|
+
import React12, { useContext as useContext5, useEffect as useEffect13 } from "react";
|
|
5874
|
+
function camelCase(input) {
|
|
5875
|
+
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
|
|
5876
|
+
}
|
|
5877
|
+
function warning2(valid, message) {
|
|
5878
|
+
warningOnce(valid, `[@ant-design/icons] ${message}`);
|
|
5879
|
+
}
|
|
5880
|
+
function isIconDefinition(target) {
|
|
5881
|
+
return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
|
|
5882
|
+
}
|
|
5883
|
+
function normalizeAttrs(attrs = {}) {
|
|
5884
|
+
return Object.keys(attrs).reduce((acc, key) => {
|
|
5885
|
+
const val = attrs[key];
|
|
5886
|
+
switch (key) {
|
|
5887
|
+
case "class":
|
|
5888
|
+
acc.className = val;
|
|
5889
|
+
delete acc.class;
|
|
5890
|
+
break;
|
|
5891
|
+
default:
|
|
5892
|
+
delete acc[key];
|
|
5893
|
+
acc[camelCase(key)] = val;
|
|
5894
|
+
}
|
|
5895
|
+
return acc;
|
|
5896
|
+
}, {});
|
|
5897
|
+
}
|
|
5898
|
+
function generate2(node, key, rootProps) {
|
|
5899
|
+
if (!rootProps) {
|
|
5900
|
+
return /* @__PURE__ */ React12.createElement(node.tag, {
|
|
5901
|
+
key,
|
|
5902
|
+
...normalizeAttrs(node.attrs)
|
|
5903
|
+
}, (node.children || []).map((child, index) => generate2(child, `${key}-${node.tag}-${index}`)));
|
|
5904
|
+
}
|
|
5905
|
+
return /* @__PURE__ */ React12.createElement(node.tag, {
|
|
5906
|
+
key,
|
|
5907
|
+
...normalizeAttrs(node.attrs),
|
|
5908
|
+
...rootProps
|
|
5909
|
+
}, (node.children || []).map((child, index) => generate2(child, `${key}-${node.tag}-${index}`)));
|
|
5910
|
+
}
|
|
5911
|
+
function getSecondaryColor(primaryColor) {
|
|
5912
|
+
return generate(primaryColor)[0];
|
|
5913
|
+
}
|
|
5914
|
+
function normalizeTwoToneColors(twoToneColor) {
|
|
5915
|
+
if (!twoToneColor) {
|
|
5916
|
+
return [];
|
|
5917
|
+
}
|
|
5918
|
+
return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
|
|
5919
|
+
}
|
|
5920
|
+
var iconStyles = `
|
|
5921
|
+
.anticon {
|
|
5922
|
+
display: inline-flex;
|
|
5923
|
+
align-items: center;
|
|
5924
|
+
color: inherit;
|
|
5925
|
+
font-style: normal;
|
|
5926
|
+
line-height: 0;
|
|
5927
|
+
text-align: center;
|
|
5928
|
+
text-transform: none;
|
|
5929
|
+
vertical-align: -0.125em;
|
|
5930
|
+
text-rendering: optimizeLegibility;
|
|
5931
|
+
-webkit-font-smoothing: antialiased;
|
|
5932
|
+
-moz-osx-font-smoothing: grayscale;
|
|
5933
|
+
}
|
|
5934
|
+
|
|
5935
|
+
.anticon > * {
|
|
5936
|
+
line-height: 1;
|
|
5937
|
+
}
|
|
5938
|
+
|
|
5939
|
+
.anticon svg {
|
|
5940
|
+
display: inline-block;
|
|
5941
|
+
vertical-align: inherit;
|
|
5942
|
+
}
|
|
5943
|
+
|
|
5944
|
+
.anticon::before {
|
|
5945
|
+
display: none;
|
|
5946
|
+
}
|
|
5947
|
+
|
|
5948
|
+
.anticon .anticon-icon {
|
|
5949
|
+
display: block;
|
|
5950
|
+
}
|
|
5951
|
+
|
|
5952
|
+
.anticon[tabindex] {
|
|
5953
|
+
cursor: pointer;
|
|
5954
|
+
}
|
|
5955
|
+
|
|
5956
|
+
.anticon-spin::before,
|
|
5957
|
+
.anticon-spin {
|
|
5958
|
+
display: inline-block;
|
|
5959
|
+
-webkit-animation: loadingCircle 1s infinite linear;
|
|
5960
|
+
animation: loadingCircle 1s infinite linear;
|
|
5961
|
+
}
|
|
5962
|
+
|
|
5963
|
+
@-webkit-keyframes loadingCircle {
|
|
5964
|
+
100% {
|
|
5965
|
+
-webkit-transform: rotate(360deg);
|
|
5966
|
+
transform: rotate(360deg);
|
|
5967
|
+
}
|
|
5968
|
+
}
|
|
5969
|
+
|
|
5970
|
+
@keyframes loadingCircle {
|
|
5971
|
+
100% {
|
|
5972
|
+
-webkit-transform: rotate(360deg);
|
|
5973
|
+
transform: rotate(360deg);
|
|
5974
|
+
}
|
|
5975
|
+
}
|
|
5976
|
+
`;
|
|
5977
|
+
var useInsertStyles = (eleRef) => {
|
|
5978
|
+
const {
|
|
5979
|
+
csp,
|
|
5980
|
+
prefixCls,
|
|
5981
|
+
layer
|
|
5982
|
+
} = useContext5(Context_default);
|
|
5983
|
+
let mergedStyleStr = iconStyles;
|
|
5984
|
+
if (prefixCls) {
|
|
5985
|
+
mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls);
|
|
5986
|
+
}
|
|
5987
|
+
if (layer) {
|
|
5988
|
+
mergedStyleStr = `@layer ${layer} {
|
|
5989
|
+
${mergedStyleStr}
|
|
5990
|
+
}`;
|
|
5991
|
+
}
|
|
5992
|
+
useEffect13(() => {
|
|
5993
|
+
const ele = eleRef.current;
|
|
5994
|
+
const shadowRoot = getShadowRoot(ele);
|
|
5995
|
+
updateCSS(mergedStyleStr, "@ant-design-icons", {
|
|
5996
|
+
prepend: !layer,
|
|
5997
|
+
csp,
|
|
5998
|
+
attachTo: shadowRoot
|
|
5999
|
+
});
|
|
6000
|
+
}, []);
|
|
6001
|
+
};
|
|
6002
|
+
|
|
6003
|
+
// ../../node_modules/@ant-design/icons/es/components/IconBase.js
|
|
6004
|
+
var twoToneColorPalette = {
|
|
6005
|
+
primaryColor: "#333",
|
|
6006
|
+
secondaryColor: "#E6E6E6",
|
|
6007
|
+
calculated: false
|
|
6008
|
+
};
|
|
6009
|
+
function setTwoToneColors({
|
|
6010
|
+
primaryColor,
|
|
6011
|
+
secondaryColor
|
|
6012
|
+
}) {
|
|
6013
|
+
twoToneColorPalette.primaryColor = primaryColor;
|
|
6014
|
+
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
|
|
6015
|
+
twoToneColorPalette.calculated = !!secondaryColor;
|
|
6016
|
+
}
|
|
6017
|
+
function getTwoToneColors() {
|
|
6018
|
+
return {
|
|
6019
|
+
...twoToneColorPalette
|
|
6020
|
+
};
|
|
6021
|
+
}
|
|
6022
|
+
var IconBase = (props) => {
|
|
6023
|
+
const {
|
|
6024
|
+
icon,
|
|
6025
|
+
className,
|
|
6026
|
+
onClick,
|
|
6027
|
+
style,
|
|
6028
|
+
primaryColor,
|
|
6029
|
+
secondaryColor,
|
|
6030
|
+
...restProps
|
|
6031
|
+
} = props;
|
|
6032
|
+
const svgRef = React13.useRef(null);
|
|
6033
|
+
let colors = twoToneColorPalette;
|
|
6034
|
+
if (primaryColor) {
|
|
6035
|
+
colors = {
|
|
6036
|
+
primaryColor,
|
|
6037
|
+
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
|
|
6038
|
+
};
|
|
6039
|
+
}
|
|
6040
|
+
useInsertStyles(svgRef);
|
|
6041
|
+
warning2(isIconDefinition(icon), `icon should be icon definiton, but got ${icon}`);
|
|
6042
|
+
if (!isIconDefinition(icon)) {
|
|
6043
|
+
return null;
|
|
6044
|
+
}
|
|
6045
|
+
let target = icon;
|
|
6046
|
+
if (target && typeof target.icon === "function") {
|
|
6047
|
+
target = {
|
|
6048
|
+
...target,
|
|
6049
|
+
icon: target.icon(colors.primaryColor, colors.secondaryColor)
|
|
6050
|
+
};
|
|
6051
|
+
}
|
|
6052
|
+
return generate2(target.icon, `svg-${target.name}`, {
|
|
6053
|
+
className,
|
|
6054
|
+
onClick,
|
|
6055
|
+
style,
|
|
6056
|
+
"data-icon": target.name,
|
|
6057
|
+
width: "1em",
|
|
6058
|
+
height: "1em",
|
|
6059
|
+
fill: "currentColor",
|
|
6060
|
+
"aria-hidden": "true",
|
|
6061
|
+
...restProps,
|
|
6062
|
+
ref: svgRef
|
|
6063
|
+
});
|
|
6064
|
+
};
|
|
6065
|
+
IconBase.displayName = "IconReact";
|
|
6066
|
+
IconBase.getTwoToneColors = getTwoToneColors;
|
|
6067
|
+
IconBase.setTwoToneColors = setTwoToneColors;
|
|
6068
|
+
var IconBase_default = IconBase;
|
|
6069
|
+
|
|
6070
|
+
// ../../node_modules/@ant-design/icons/es/components/twoTonePrimaryColor.js
|
|
6071
|
+
function setTwoToneColor(twoToneColor) {
|
|
6072
|
+
const [primaryColor, secondaryColor] = normalizeTwoToneColors(twoToneColor);
|
|
6073
|
+
return IconBase_default.setTwoToneColors({
|
|
6074
|
+
primaryColor,
|
|
6075
|
+
secondaryColor
|
|
6076
|
+
});
|
|
6077
|
+
}
|
|
6078
|
+
function getTwoToneColor() {
|
|
6079
|
+
const colors = IconBase_default.getTwoToneColors();
|
|
6080
|
+
if (!colors.calculated) {
|
|
6081
|
+
return colors.primaryColor;
|
|
6082
|
+
}
|
|
6083
|
+
return [colors.primaryColor, colors.secondaryColor];
|
|
6084
|
+
}
|
|
6085
|
+
|
|
6086
|
+
// ../../node_modules/@ant-design/icons/es/components/AntdIcon.js
|
|
6087
|
+
function _extends() {
|
|
6088
|
+
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
6089
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6090
|
+
var source = arguments[i];
|
|
6091
|
+
for (var key in source) {
|
|
6092
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
6093
|
+
target[key] = source[key];
|
|
6094
|
+
}
|
|
6095
|
+
}
|
|
6096
|
+
}
|
|
6097
|
+
return target;
|
|
6098
|
+
};
|
|
6099
|
+
return _extends.apply(this, arguments);
|
|
6100
|
+
}
|
|
6101
|
+
setTwoToneColor(blue.primary);
|
|
6102
|
+
var Icon = /* @__PURE__ */ React14.forwardRef((props, ref) => {
|
|
6103
|
+
const {
|
|
6104
|
+
// affect outter <i>...</i>
|
|
6105
|
+
className,
|
|
6106
|
+
// affect inner <svg>...</svg>
|
|
6107
|
+
icon,
|
|
6108
|
+
spin,
|
|
6109
|
+
rotate,
|
|
6110
|
+
tabIndex,
|
|
6111
|
+
onClick,
|
|
6112
|
+
// other
|
|
6113
|
+
twoToneColor,
|
|
6114
|
+
...restProps
|
|
6115
|
+
} = props;
|
|
6116
|
+
const {
|
|
6117
|
+
prefixCls = "anticon",
|
|
6118
|
+
rootClassName
|
|
6119
|
+
} = React14.useContext(Context_default);
|
|
6120
|
+
const classString = clsx2(rootClassName, prefixCls, {
|
|
6121
|
+
[`${prefixCls}-${icon.name}`]: !!icon.name,
|
|
6122
|
+
[`${prefixCls}-spin`]: !!spin || icon.name === "loading"
|
|
6123
|
+
}, className);
|
|
6124
|
+
let iconTabIndex = tabIndex;
|
|
6125
|
+
if (iconTabIndex === void 0 && onClick) {
|
|
6126
|
+
iconTabIndex = -1;
|
|
6127
|
+
}
|
|
6128
|
+
const svgStyle = rotate ? {
|
|
6129
|
+
msTransform: `rotate(${rotate}deg)`,
|
|
6130
|
+
transform: `rotate(${rotate}deg)`
|
|
6131
|
+
} : void 0;
|
|
6132
|
+
const [primaryColor, secondaryColor] = normalizeTwoToneColors(twoToneColor);
|
|
6133
|
+
return /* @__PURE__ */ React14.createElement("span", _extends({
|
|
6134
|
+
role: "img",
|
|
6135
|
+
"aria-label": icon.name
|
|
6136
|
+
}, restProps, {
|
|
6137
|
+
ref,
|
|
6138
|
+
tabIndex: iconTabIndex,
|
|
6139
|
+
onClick,
|
|
6140
|
+
className: classString
|
|
6141
|
+
}), /* @__PURE__ */ React14.createElement(IconBase_default, {
|
|
6142
|
+
icon,
|
|
6143
|
+
primaryColor,
|
|
6144
|
+
secondaryColor,
|
|
6145
|
+
style: svgStyle
|
|
6146
|
+
}));
|
|
6147
|
+
});
|
|
6148
|
+
Icon.getTwoToneColor = getTwoToneColor;
|
|
6149
|
+
Icon.setTwoToneColor = setTwoToneColor;
|
|
6150
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6151
|
+
Icon.displayName = "AntdIcon";
|
|
6152
|
+
}
|
|
6153
|
+
var AntdIcon_default = Icon;
|
|
6154
|
+
|
|
6155
|
+
// ../../node_modules/@ant-design/icons/es/icons/PlusOutlined.js
|
|
6156
|
+
import * as React15 from "react";
|
|
6157
|
+
|
|
6158
|
+
// ../../node_modules/@ant-design/icons-svg/es/asn/PlusOutlined.js
|
|
6159
|
+
var PlusOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" } }, { "tag": "path", "attrs": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" } }] }, "name": "plus", "theme": "outlined" };
|
|
6160
|
+
var PlusOutlined_default = PlusOutlined;
|
|
6161
|
+
|
|
6162
|
+
// ../../node_modules/@ant-design/icons/es/icons/PlusOutlined.js
|
|
6163
|
+
function _extends2() {
|
|
6164
|
+
_extends2 = Object.assign ? Object.assign.bind() : function(target) {
|
|
6165
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6166
|
+
var source = arguments[i];
|
|
6167
|
+
for (var key in source) {
|
|
6168
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
6169
|
+
target[key] = source[key];
|
|
6170
|
+
}
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
return target;
|
|
6174
|
+
};
|
|
6175
|
+
return _extends2.apply(this, arguments);
|
|
6176
|
+
}
|
|
6177
|
+
var PlusOutlined2 = (props, ref) => /* @__PURE__ */ React15.createElement(AntdIcon_default, _extends2({}, props, {
|
|
6178
|
+
ref,
|
|
6179
|
+
icon: PlusOutlined_default
|
|
6180
|
+
}));
|
|
6181
|
+
var RefIcon = /* @__PURE__ */ React15.forwardRef(PlusOutlined2);
|
|
6182
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6183
|
+
RefIcon.displayName = "PlusOutlined";
|
|
6184
|
+
}
|
|
6185
|
+
var PlusOutlined_default2 = RefIcon;
|
|
6186
|
+
|
|
6187
|
+
// src/hooks/uploads/useAntdImageUpload.tsx
|
|
6188
|
+
import { Image, Upload } from "antd";
|
|
6189
|
+
import { Fragment as Fragment7, jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6190
|
+
var getBase64 = (file) => new Promise((resolve, reject) => {
|
|
6191
|
+
const reader = new FileReader();
|
|
6192
|
+
reader.readAsDataURL(file);
|
|
6193
|
+
reader.onload = () => resolve(reader.result);
|
|
6194
|
+
reader.onerror = (error) => reject(error);
|
|
6195
|
+
});
|
|
6196
|
+
var useAntdImageUpload = ({ length = 1 }) => {
|
|
6197
|
+
const [fileList, setFileList] = useState18([]);
|
|
6198
|
+
const [previewOpen, setPreviewOpen] = useState18(false);
|
|
6199
|
+
const [previewImage, setPreviewImage] = useState18("");
|
|
6200
|
+
const handlePreview = async (file) => {
|
|
6201
|
+
if (!file.url && !file.preview) {
|
|
6202
|
+
file.preview = await getBase64(file.originFileObj);
|
|
6203
|
+
}
|
|
6204
|
+
setPreviewImage(file.url || file.preview);
|
|
6205
|
+
setPreviewOpen(true);
|
|
6206
|
+
};
|
|
6207
|
+
const handleChange = ({ fileList: newFileList }) => {
|
|
6208
|
+
setFileList(
|
|
6209
|
+
newFileList.map((f) => ({
|
|
6210
|
+
...f,
|
|
6211
|
+
status: "done"
|
|
6212
|
+
// mark done immediately
|
|
6213
|
+
}))
|
|
6214
|
+
);
|
|
6215
|
+
};
|
|
6216
|
+
const ImageBox = () => /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
6217
|
+
/* @__PURE__ */ jsx30(
|
|
6218
|
+
Upload,
|
|
6219
|
+
{
|
|
6220
|
+
listType: "picture-card",
|
|
6221
|
+
fileList,
|
|
6222
|
+
onPreview: handlePreview,
|
|
6223
|
+
onChange: handleChange,
|
|
6224
|
+
beforeUpload: () => false,
|
|
6225
|
+
children: fileList.length >= length ? null : /* @__PURE__ */ jsxs22("button", { style: { border: 0, background: "none" }, type: "button", children: [
|
|
6226
|
+
/* @__PURE__ */ jsx30(PlusOutlined_default2, {}),
|
|
6227
|
+
/* @__PURE__ */ jsx30("div", { style: { marginTop: 8 }, children: "Upload" })
|
|
6228
|
+
] })
|
|
6229
|
+
}
|
|
6230
|
+
),
|
|
6231
|
+
previewImage && /* @__PURE__ */ jsx30(
|
|
6232
|
+
Image,
|
|
6233
|
+
{
|
|
6234
|
+
style: { display: "none" },
|
|
6235
|
+
preview: {
|
|
6236
|
+
visible: previewOpen,
|
|
6237
|
+
onVisibleChange: (visible) => setPreviewOpen(visible),
|
|
6238
|
+
afterOpenChange: (visible) => !visible && setPreviewImage("")
|
|
6239
|
+
},
|
|
6240
|
+
src: previewImage
|
|
6241
|
+
}
|
|
6242
|
+
)
|
|
6243
|
+
] });
|
|
6244
|
+
return { ImageBox, fileList, setFileList };
|
|
6245
|
+
};
|
|
6246
|
+
var useAntdImageUpload_default = useAntdImageUpload;
|
|
4829
6247
|
export {
|
|
4830
6248
|
Badge,
|
|
4831
6249
|
Branding,
|
|
@@ -4869,6 +6287,7 @@ export {
|
|
|
4869
6287
|
generatePdf,
|
|
4870
6288
|
storage,
|
|
4871
6289
|
useA4DataView_default as useA4StatementView,
|
|
6290
|
+
useAntdImageUpload_default as useAntdImageUpload,
|
|
4872
6291
|
useApis_default as useApi,
|
|
4873
6292
|
useModal,
|
|
4874
6293
|
useSearchApiContext,
|