@eztrak/shared 0.9.0 → 0.12.0
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/README.md +184 -2
- package/dist/chunk-7PPCJV2M.mjs +56 -0
- package/dist/chunk-7PPCJV2M.mjs.map +1 -0
- package/dist/{chunk-GVIHLI67.mjs → chunk-BMX2RODZ.mjs} +85 -11
- package/dist/chunk-BMX2RODZ.mjs.map +1 -0
- package/dist/{chunk-2MTTG7D2.mjs → chunk-PHK4IOCF.mjs} +168 -56
- package/dist/chunk-PHK4IOCF.mjs.map +1 -0
- package/dist/components/index.d.mts +17 -1
- package/dist/components/index.d.ts +17 -1
- package/dist/components/index.js +267 -79
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +8 -4
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +329 -77
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -4
- package/dist/utils/index.d.mts +26 -2
- package/dist/utils/index.d.ts +26 -2
- package/dist/utils/index.js +148 -10
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +25 -2
- package/package.json +3 -1
- package/dist/chunk-2MTTG7D2.mjs.map +0 -1
- package/dist/chunk-GED6IT3S.mjs +0 -1
- package/dist/chunk-GED6IT3S.mjs.map +0 -1
- package/dist/chunk-GVIHLI67.mjs.map +0 -1
package/dist/components/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(components_exports, {
|
|
|
33
33
|
CardSkeleton: () => CardSkeleton,
|
|
34
34
|
CustomCellEditor: () => CustomCellEditor,
|
|
35
35
|
CustomPagination: () => CustomPagination,
|
|
36
|
+
DropdownFilter: () => DropdownFilter,
|
|
36
37
|
EztrakTabs: () => EztrakTabs,
|
|
37
38
|
Loader: () => Loader,
|
|
38
39
|
Modal: () => Modal,
|
|
@@ -41,7 +42,8 @@ __export(components_exports, {
|
|
|
41
42
|
SearchInput: () => SearchInput,
|
|
42
43
|
TableLayoutToolbarControls: () => TableLayoutToolbarControls,
|
|
43
44
|
ToolTip: () => ToolTip,
|
|
44
|
-
TooltipText: () => TooltipText
|
|
45
|
+
TooltipText: () => TooltipText,
|
|
46
|
+
dropdownStyles: () => dropdownStyles
|
|
45
47
|
});
|
|
46
48
|
module.exports = __toCommonJS(components_exports);
|
|
47
49
|
|
|
@@ -266,18 +268,92 @@ var import_react_router_dom = require("react-router-dom");
|
|
|
266
268
|
// src/utils/handleApiError.ts
|
|
267
269
|
var import_react_hot_toast = __toESM(require("react-hot-toast"));
|
|
268
270
|
var import_sweetalert2 = __toESM(require("sweetalert2"));
|
|
271
|
+
var BRAND_ORANGE = "#FF7335";
|
|
272
|
+
var CANCEL_RED = "#ff0000";
|
|
273
|
+
function getConfirmErrorMessage(error) {
|
|
274
|
+
if (error && typeof error === "object") {
|
|
275
|
+
const err = error;
|
|
276
|
+
return err.data?.message || err.data?.title || err.message || "Something went wrong. Please try again.";
|
|
277
|
+
}
|
|
278
|
+
return "Something went wrong. Please try again.";
|
|
279
|
+
}
|
|
269
280
|
function confirmationAlert(onConfirm, options = {}) {
|
|
270
|
-
|
|
271
|
-
title
|
|
272
|
-
text
|
|
273
|
-
|
|
281
|
+
const {
|
|
282
|
+
title = options.inputExpectedValue ? "Confirmation Required" : "Are you sure?",
|
|
283
|
+
text,
|
|
284
|
+
html,
|
|
285
|
+
icon = "warning",
|
|
286
|
+
confirmButtonText = "Yes",
|
|
287
|
+
cancelButtonText = "Cancel",
|
|
288
|
+
confirmButtonColor = BRAND_ORANGE,
|
|
289
|
+
cancelButtonColor = CANCEL_RED,
|
|
290
|
+
showLoaderOnConfirm = false,
|
|
291
|
+
inputExpectedValue,
|
|
292
|
+
inputPlaceholder = "Type confirmation text to proceed",
|
|
293
|
+
reverseButtons,
|
|
294
|
+
focusCancel,
|
|
295
|
+
zIndex
|
|
296
|
+
} = options;
|
|
297
|
+
const hasInput = Boolean(inputExpectedValue);
|
|
298
|
+
const useLoader = showLoaderOnConfirm || hasInput;
|
|
299
|
+
const inputHtml = html ?? (hasInput ? `
|
|
300
|
+
${text ? `<p style="margin-bottom: 15px;">${text}</p>` : ""}
|
|
301
|
+
<p style="margin-bottom: 10px; font-weight: bold; color: #666;">
|
|
302
|
+
Please type "<span style="color: ${BRAND_ORANGE}; font-weight: bold;">${inputExpectedValue}</span>" to confirm:
|
|
303
|
+
</p>
|
|
304
|
+
` : void 0);
|
|
305
|
+
const swalOptions = {
|
|
306
|
+
title,
|
|
307
|
+
icon,
|
|
274
308
|
showCancelButton: true,
|
|
275
|
-
confirmButtonText
|
|
276
|
-
cancelButtonText
|
|
277
|
-
confirmButtonColor
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
309
|
+
confirmButtonText,
|
|
310
|
+
cancelButtonText,
|
|
311
|
+
confirmButtonColor,
|
|
312
|
+
cancelButtonColor,
|
|
313
|
+
reverseButtons,
|
|
314
|
+
focusCancel,
|
|
315
|
+
allowOutsideClick: () => !import_sweetalert2.default.isLoading(),
|
|
316
|
+
allowEscapeKey: () => !import_sweetalert2.default.isLoading(),
|
|
317
|
+
didOpen: () => {
|
|
318
|
+
if (zIndex == null) return;
|
|
319
|
+
const container = import_sweetalert2.default.getContainer();
|
|
320
|
+
if (container) container.style.zIndex = String(zIndex);
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
if (hasInput) {
|
|
324
|
+
swalOptions.html = inputHtml;
|
|
325
|
+
swalOptions.input = "text";
|
|
326
|
+
swalOptions.inputPlaceholder = inputPlaceholder;
|
|
327
|
+
swalOptions.inputValidator = (value) => {
|
|
328
|
+
if (!value?.trim()) return "You need to enter the confirmation text!";
|
|
329
|
+
if (value.trim() !== inputExpectedValue.trim()) {
|
|
330
|
+
return `Please type "${inputExpectedValue}" exactly as shown!`;
|
|
331
|
+
}
|
|
332
|
+
return null;
|
|
333
|
+
};
|
|
334
|
+
} else if (html) {
|
|
335
|
+
swalOptions.html = html;
|
|
336
|
+
} else {
|
|
337
|
+
swalOptions.text = text;
|
|
338
|
+
}
|
|
339
|
+
if (useLoader) {
|
|
340
|
+
swalOptions.showLoaderOnConfirm = true;
|
|
341
|
+
swalOptions.preConfirm = (inputValue) => {
|
|
342
|
+
if (hasInput && inputValue?.trim() !== inputExpectedValue.trim()) {
|
|
343
|
+
import_sweetalert2.default.showValidationMessage(
|
|
344
|
+
`Please type "${inputExpectedValue}" exactly as shown!`
|
|
345
|
+
);
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
return Promise.resolve().then(() => onConfirm()).catch((error) => {
|
|
349
|
+
import_sweetalert2.default.showValidationMessage(getConfirmErrorMessage(error));
|
|
350
|
+
throw error;
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
void import_sweetalert2.default.fire(swalOptions).then((result) => {
|
|
355
|
+
if (result.isConfirmed && !useLoader) {
|
|
356
|
+
void Promise.resolve(onConfirm());
|
|
281
357
|
}
|
|
282
358
|
});
|
|
283
359
|
}
|
|
@@ -597,9 +673,119 @@ function CustomPagination({
|
|
|
597
673
|
);
|
|
598
674
|
}
|
|
599
675
|
|
|
600
|
-
// src/components/search-filters/
|
|
676
|
+
// src/components/search-filters/DropdownFilter.tsx
|
|
677
|
+
var import_react_select = __toESM(require("react-select"));
|
|
601
678
|
var import_react_router_dom2 = require("react-router-dom");
|
|
679
|
+
|
|
680
|
+
// src/components/search-filters/dropdownStyles.ts
|
|
681
|
+
var themeColors = {
|
|
682
|
+
primary: "#FF7335",
|
|
683
|
+
primaryHover: "#E65C2E",
|
|
684
|
+
lightBackground: "#FFF3EB",
|
|
685
|
+
textColor: "black",
|
|
686
|
+
white: "white"
|
|
687
|
+
};
|
|
688
|
+
var dropdownStyles = (_borderRadius = "5px") => ({
|
|
689
|
+
control: (provided, state) => ({
|
|
690
|
+
...provided,
|
|
691
|
+
fontSize: "14px",
|
|
692
|
+
padding: "4px 8px",
|
|
693
|
+
minWidth: "180px",
|
|
694
|
+
borderRadius: "5px",
|
|
695
|
+
cursor: "pointer",
|
|
696
|
+
borderColor: state.isFocused ? themeColors.primary : "#e0e0e0",
|
|
697
|
+
boxShadow: state.isFocused ? "0 0 0 2px rgba(255, 115, 53, 0.3)" : "none",
|
|
698
|
+
"&:hover": {
|
|
699
|
+
borderColor: themeColors.primary
|
|
700
|
+
},
|
|
701
|
+
transition: "border-color 0.2s, box-shadow 0.2s",
|
|
702
|
+
zIndex: 50
|
|
703
|
+
}),
|
|
704
|
+
option: (provided, state) => ({
|
|
705
|
+
...provided,
|
|
706
|
+
fontSize: "14px",
|
|
707
|
+
backgroundColor: state.isSelected ? themeColors.primary : state.isFocused ? themeColors.lightBackground : themeColors.white,
|
|
708
|
+
borderRadius: "5px",
|
|
709
|
+
cursor: "pointer",
|
|
710
|
+
borderColor: state.isFocused ? themeColors.primary : "#e0e0e0",
|
|
711
|
+
color: state.isSelected ? themeColors.white : state.isFocused ? themeColors.primary : themeColors.textColor,
|
|
712
|
+
"&:hover": {
|
|
713
|
+
backgroundColor: themeColors.lightBackground,
|
|
714
|
+
color: themeColors.primary
|
|
715
|
+
},
|
|
716
|
+
"&:active": {
|
|
717
|
+
backgroundColor: themeColors.primary,
|
|
718
|
+
color: themeColors.white
|
|
719
|
+
},
|
|
720
|
+
transition: "background-color 0.2s, color 0.2s",
|
|
721
|
+
zIndex: 50
|
|
722
|
+
}),
|
|
723
|
+
singleValue: (provided) => ({
|
|
724
|
+
...provided,
|
|
725
|
+
color: themeColors.textColor,
|
|
726
|
+
zIndex: 50
|
|
727
|
+
}),
|
|
728
|
+
menu: (provided) => ({
|
|
729
|
+
...provided,
|
|
730
|
+
borderRadius: "5px",
|
|
731
|
+
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)",
|
|
732
|
+
marginTop: "4px",
|
|
733
|
+
zIndex: 50
|
|
734
|
+
}),
|
|
735
|
+
dropdownIndicator: (provided) => ({
|
|
736
|
+
...provided,
|
|
737
|
+
color: themeColors.primary,
|
|
738
|
+
"&:hover": {
|
|
739
|
+
color: themeColors.primaryHover
|
|
740
|
+
},
|
|
741
|
+
zIndex: 50
|
|
742
|
+
}),
|
|
743
|
+
indicatorSeparator: () => ({
|
|
744
|
+
display: "none"
|
|
745
|
+
})
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
// src/components/search-filters/DropdownFilter.tsx
|
|
602
749
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
750
|
+
function DropdownFilter({
|
|
751
|
+
name,
|
|
752
|
+
valueKey = "id",
|
|
753
|
+
options,
|
|
754
|
+
placeholder,
|
|
755
|
+
borderRadius = "20px",
|
|
756
|
+
...otherProps
|
|
757
|
+
}) {
|
|
758
|
+
const [searchParams, setSearchParams] = (0, import_react_router_dom2.useSearchParams)();
|
|
759
|
+
const currentValue = searchParams.get(name);
|
|
760
|
+
const selectedOption = currentValue ? options?.find(
|
|
761
|
+
(option) => option[valueKey]?.toString() === currentValue
|
|
762
|
+
) ?? null : null;
|
|
763
|
+
const handleChange = (selected) => {
|
|
764
|
+
setSearchParams((prev) => {
|
|
765
|
+
if (!selected || selected[valueKey] === "") {
|
|
766
|
+
prev.delete(name);
|
|
767
|
+
} else {
|
|
768
|
+
prev.set(name, String(selected[valueKey]));
|
|
769
|
+
}
|
|
770
|
+
return prev;
|
|
771
|
+
});
|
|
772
|
+
};
|
|
773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
774
|
+
import_react_select.default,
|
|
775
|
+
{
|
|
776
|
+
placeholder: placeholder ?? `Select ${name}`,
|
|
777
|
+
value: selectedOption,
|
|
778
|
+
onChange: handleChange,
|
|
779
|
+
options,
|
|
780
|
+
styles: dropdownStyles(borderRadius),
|
|
781
|
+
...otherProps
|
|
782
|
+
}
|
|
783
|
+
);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// src/components/search-filters/ResetFiltersButton.tsx
|
|
787
|
+
var import_react_router_dom3 = require("react-router-dom");
|
|
788
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
603
789
|
var BASE_STYLES = "inline-flex items-center gap-1.5 px-5 py-3 rounded-md text-sm font-medium transition-colors duration-200 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50";
|
|
604
790
|
var VARIANTS = {
|
|
605
791
|
primary: "bg-white text-secondary border border-secondary hover:bg-lightGray hover:text-black",
|
|
@@ -614,7 +800,7 @@ function ResetIcon({
|
|
|
614
800
|
size = 16,
|
|
615
801
|
className
|
|
616
802
|
}) {
|
|
617
|
-
return /* @__PURE__ */ (0,
|
|
803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
618
804
|
"svg",
|
|
619
805
|
{
|
|
620
806
|
width: size,
|
|
@@ -628,10 +814,10 @@ function ResetIcon({
|
|
|
628
814
|
"aria-hidden": "true",
|
|
629
815
|
className,
|
|
630
816
|
children: [
|
|
631
|
-
/* @__PURE__ */ (0,
|
|
632
|
-
/* @__PURE__ */ (0,
|
|
633
|
-
/* @__PURE__ */ (0,
|
|
634
|
-
/* @__PURE__ */ (0,
|
|
817
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
818
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 3v5h-5" }),
|
|
819
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 16H3v5" })
|
|
635
821
|
]
|
|
636
822
|
}
|
|
637
823
|
);
|
|
@@ -645,13 +831,13 @@ function ResetFiltersButton({
|
|
|
645
831
|
onReset,
|
|
646
832
|
disabled = false
|
|
647
833
|
}) {
|
|
648
|
-
const [, setSearchParams] = (0,
|
|
834
|
+
const [, setSearchParams] = (0, import_react_router_dom3.useSearchParams)();
|
|
649
835
|
const handleReset = () => {
|
|
650
836
|
setSearchParams({}, { replace: true });
|
|
651
837
|
onReset?.();
|
|
652
838
|
};
|
|
653
|
-
const resolvedIcon = icon === void 0 ? /* @__PURE__ */ (0,
|
|
654
|
-
return /* @__PURE__ */ (0,
|
|
839
|
+
const resolvedIcon = icon === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ResetIcon, { size: 16 }) : icon;
|
|
840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
655
841
|
"button",
|
|
656
842
|
{
|
|
657
843
|
type: "button",
|
|
@@ -669,8 +855,8 @@ function ResetFiltersButton({
|
|
|
669
855
|
// src/components/search-filters/SearchInput.tsx
|
|
670
856
|
var import_react2 = require("react");
|
|
671
857
|
var import_fi = require("react-icons/fi");
|
|
672
|
-
var
|
|
673
|
-
var
|
|
858
|
+
var import_react_router_dom4 = require("react-router-dom");
|
|
859
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
674
860
|
function SearchInput({
|
|
675
861
|
placeholder = "Search...",
|
|
676
862
|
searchBtn = "",
|
|
@@ -687,7 +873,7 @@ function SearchInput({
|
|
|
687
873
|
defaultValue,
|
|
688
874
|
...props
|
|
689
875
|
}) {
|
|
690
|
-
const [searchParams, setSearchParams] = (0,
|
|
876
|
+
const [searchParams, setSearchParams] = (0, import_react_router_dom4.useSearchParams)();
|
|
691
877
|
const queryParam = searchParams.get(defaultParam) || defaultValue || "";
|
|
692
878
|
const [inputValue, setInputValue] = (0, import_react2.useState)(queryParam);
|
|
693
879
|
const debounceTimerRef = (0, import_react2.useRef)(null);
|
|
@@ -739,7 +925,7 @@ function SearchInput({
|
|
|
739
925
|
}
|
|
740
926
|
};
|
|
741
927
|
}, []);
|
|
742
|
-
return /* @__PURE__ */ (0,
|
|
928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
743
929
|
"form",
|
|
744
930
|
{
|
|
745
931
|
onSubmit: handleSearch,
|
|
@@ -748,7 +934,7 @@ function SearchInput({
|
|
|
748
934
|
searchWrapperClass
|
|
749
935
|
),
|
|
750
936
|
children: [
|
|
751
|
-
showIcon && /* @__PURE__ */ (0,
|
|
937
|
+
showIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
752
938
|
"button",
|
|
753
939
|
{
|
|
754
940
|
type: "submit",
|
|
@@ -756,7 +942,7 @@ function SearchInput({
|
|
|
756
942
|
"bg-white text-secondary rounded-full flex items-center justify-center w-10 h-10",
|
|
757
943
|
searchBtn
|
|
758
944
|
),
|
|
759
|
-
children: customIcon ? customIcon : /* @__PURE__ */ (0,
|
|
945
|
+
children: customIcon ? customIcon : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
760
946
|
import_fi.FiSearch,
|
|
761
947
|
{
|
|
762
948
|
className: cn("h-5 w-5 text-gray-400", searchIconClassName)
|
|
@@ -764,7 +950,7 @@ function SearchInput({
|
|
|
764
950
|
)
|
|
765
951
|
}
|
|
766
952
|
),
|
|
767
|
-
/* @__PURE__ */ (0,
|
|
953
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
768
954
|
"input",
|
|
769
955
|
{
|
|
770
956
|
value: inputValue,
|
|
@@ -789,9 +975,9 @@ var import_fa = require("react-icons/fa");
|
|
|
789
975
|
var import_io5 = require("react-icons/io5");
|
|
790
976
|
|
|
791
977
|
// src/components/Loader/Loader.tsx
|
|
792
|
-
var
|
|
978
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
793
979
|
var Loader = ({ className, color = "#F54C00", size = "50px", speed = "1s" }) => {
|
|
794
|
-
return /* @__PURE__ */ (0,
|
|
980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `loader`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
795
981
|
"div",
|
|
796
982
|
{
|
|
797
983
|
className: `spinner ${className}`,
|
|
@@ -808,7 +994,7 @@ var Loader = ({ className, color = "#F54C00", size = "50px", speed = "1s" }) =>
|
|
|
808
994
|
};
|
|
809
995
|
|
|
810
996
|
// src/components/modal/Modal.tsx
|
|
811
|
-
var
|
|
997
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
812
998
|
function Modal({
|
|
813
999
|
isOpen,
|
|
814
1000
|
onClose,
|
|
@@ -849,7 +1035,7 @@ function Modal({
|
|
|
849
1035
|
document.body.style.overflow = "unset";
|
|
850
1036
|
};
|
|
851
1037
|
}, [isOpen, onClose, closeOnEscape]);
|
|
852
|
-
const modalContent = /* @__PURE__ */ (0,
|
|
1038
|
+
const modalContent = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_framer_motion.AnimatePresence, { children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
853
1039
|
"div",
|
|
854
1040
|
{
|
|
855
1041
|
className: "fixed inset-0 bg-gray-500 bg-opacity-50 flex justify-center items-center z-1000 p-4",
|
|
@@ -868,7 +1054,7 @@ function Modal({
|
|
|
868
1054
|
zIndex
|
|
869
1055
|
},
|
|
870
1056
|
children: [
|
|
871
|
-
/* @__PURE__ */ (0,
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
872
1058
|
import_framer_motion.motion.div,
|
|
873
1059
|
{
|
|
874
1060
|
ref: modalRef,
|
|
@@ -889,7 +1075,7 @@ function Modal({
|
|
|
889
1075
|
// Ensure modal doesn't exceed viewport height
|
|
890
1076
|
},
|
|
891
1077
|
children: [
|
|
892
|
-
/* @__PURE__ */ (0,
|
|
1078
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
893
1079
|
"div",
|
|
894
1080
|
{
|
|
895
1081
|
style: {
|
|
@@ -897,43 +1083,43 @@ function Modal({
|
|
|
897
1083
|
},
|
|
898
1084
|
className: "sticky top-0 z-10 flex justify-between items-center bg-white text-2xl p-8 pb-4 rounded-t-3xl",
|
|
899
1085
|
children: [
|
|
900
|
-
/* @__PURE__ */ (0,
|
|
901
|
-
/* @__PURE__ */ (0,
|
|
902
|
-
onPrint && /* @__PURE__ */ (0,
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: "font-semibold", children: title }),
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center space-x-4", children: [
|
|
1088
|
+
onPrint && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
903
1089
|
"button",
|
|
904
1090
|
{
|
|
905
1091
|
onClick: onPrint,
|
|
906
1092
|
className: "flex items-center gap-1 hover:text-gray-300 text-sm border p-1 rounded",
|
|
907
1093
|
children: [
|
|
908
|
-
/* @__PURE__ */ (0,
|
|
909
|
-
/* @__PURE__ */ (0,
|
|
1094
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_fa.FaPrint, { name: "FaPrint" }),
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Print" })
|
|
910
1096
|
]
|
|
911
1097
|
}
|
|
912
1098
|
),
|
|
913
|
-
onExport && /* @__PURE__ */ (0,
|
|
1099
|
+
onExport && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
914
1100
|
"button",
|
|
915
1101
|
{
|
|
916
1102
|
onClick: onExport,
|
|
917
1103
|
className: "flex items-center gap-1 hover:text-gray-300 text-sm border p-1 rounded",
|
|
918
1104
|
children: [
|
|
919
|
-
/* @__PURE__ */ (0,
|
|
920
|
-
/* @__PURE__ */ (0,
|
|
1105
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_fa.FaFileExport, {}),
|
|
1106
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Export" })
|
|
921
1107
|
]
|
|
922
1108
|
}
|
|
923
1109
|
),
|
|
924
|
-
/* @__PURE__ */ (0,
|
|
1110
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
925
1111
|
"button",
|
|
926
1112
|
{
|
|
927
1113
|
onClick: onClose,
|
|
928
1114
|
className: "px-2 hover:opacity-70 transition-opacity",
|
|
929
|
-
children: /* @__PURE__ */ (0,
|
|
1115
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_io5.IoCloseCircleOutline, { color: "#8898AA", size: 25 })
|
|
930
1116
|
}
|
|
931
1117
|
)
|
|
932
1118
|
] })
|
|
933
1119
|
]
|
|
934
1120
|
}
|
|
935
1121
|
),
|
|
936
|
-
/* @__PURE__ */ (0,
|
|
1122
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
937
1123
|
"div",
|
|
938
1124
|
{
|
|
939
1125
|
className: cn(
|
|
@@ -943,7 +1129,7 @@ function Modal({
|
|
|
943
1129
|
children
|
|
944
1130
|
}
|
|
945
1131
|
),
|
|
946
|
-
footer && /* @__PURE__ */ (0,
|
|
1132
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
947
1133
|
"div",
|
|
948
1134
|
{
|
|
949
1135
|
className: cn("sticky bottom-0 flex justify-end p-4 space-x-4 border-t bg-white ", footerClassName),
|
|
@@ -957,7 +1143,7 @@ function Modal({
|
|
|
957
1143
|
]
|
|
958
1144
|
}
|
|
959
1145
|
),
|
|
960
|
-
isLoading && /* @__PURE__ */ (0,
|
|
1146
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
961
1147
|
"div",
|
|
962
1148
|
{
|
|
963
1149
|
className: "fixed inset-0 flex items-center justify-center bg-gray-200/60",
|
|
@@ -966,7 +1152,7 @@ function Modal({
|
|
|
966
1152
|
"aria-live": "polite",
|
|
967
1153
|
role: "status",
|
|
968
1154
|
onClick: (e) => e.stopPropagation(),
|
|
969
|
-
children: customLoader ? customLoader : /* @__PURE__ */ (0,
|
|
1155
|
+
children: customLoader ? customLoader : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loader, { size: "48px" })
|
|
970
1156
|
}
|
|
971
1157
|
)
|
|
972
1158
|
]
|
|
@@ -982,7 +1168,7 @@ function Modal({
|
|
|
982
1168
|
}
|
|
983
1169
|
|
|
984
1170
|
// src/components/skeleton/CardSkeleton.tsx
|
|
985
|
-
var
|
|
1171
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
986
1172
|
var DEFAULT_LINE_WIDTHS = ["w-32", "w-48"];
|
|
987
1173
|
function shouldShowAvatar(variant, showAvatar) {
|
|
988
1174
|
return showAvatar ?? variant === "profile";
|
|
@@ -991,7 +1177,7 @@ function shouldShowImage(variant, showImage) {
|
|
|
991
1177
|
return showImage ?? variant === "image";
|
|
992
1178
|
}
|
|
993
1179
|
function AvatarSkeleton({ className }) {
|
|
994
|
-
return /* @__PURE__ */ (0,
|
|
1180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
995
1181
|
"svg",
|
|
996
1182
|
{
|
|
997
1183
|
className: cn("w-10 h-10 text-gray-200 dark:text-gray-700", className),
|
|
@@ -999,7 +1185,7 @@ function AvatarSkeleton({ className }) {
|
|
|
999
1185
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1000
1186
|
fill: "currentColor",
|
|
1001
1187
|
viewBox: "0 0 20 20",
|
|
1002
|
-
children: /* @__PURE__ */ (0,
|
|
1188
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M10 0a10 10 0 1 0 10 10A10.011 10.011 0 0 0 10 0Zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6Zm0 13a8.949 8.949 0 0 1-4.951-1.488A3.987 3.987 0 0 1 9 13h2a3.987 3.987 0 0 1 3.951 3.512A8.949 8.949 0 0 1 10 18Z" })
|
|
1003
1189
|
}
|
|
1004
1190
|
);
|
|
1005
1191
|
}
|
|
@@ -1008,7 +1194,7 @@ function SkeletonBlock({
|
|
|
1008
1194
|
className,
|
|
1009
1195
|
isFirst
|
|
1010
1196
|
}) {
|
|
1011
|
-
return /* @__PURE__ */ (0,
|
|
1197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1012
1198
|
"div",
|
|
1013
1199
|
{
|
|
1014
1200
|
className: cn(
|
|
@@ -1040,14 +1226,14 @@ function CardSkeleton({
|
|
|
1040
1226
|
const skeletons = Array.from({ length: Math.max(1, count) }, (_, index) => {
|
|
1041
1227
|
const renderAvatar = shouldShowAvatar(variant, showAvatar);
|
|
1042
1228
|
const renderImage = shouldShowImage(variant, showImage);
|
|
1043
|
-
return /* @__PURE__ */ (0,
|
|
1229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1044
1230
|
"div",
|
|
1045
1231
|
{
|
|
1046
1232
|
className: cn("animate-pulse md:p-6 dark:border-gray-700", className),
|
|
1047
1233
|
style: { animationDuration, ...style },
|
|
1048
1234
|
...props,
|
|
1049
1235
|
children: [
|
|
1050
|
-
renderImage ? /* @__PURE__ */ (0,
|
|
1236
|
+
renderImage ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1051
1237
|
"div",
|
|
1052
1238
|
{
|
|
1053
1239
|
className: cn(
|
|
@@ -1056,9 +1242,9 @@ function CardSkeleton({
|
|
|
1056
1242
|
)
|
|
1057
1243
|
}
|
|
1058
1244
|
) : null,
|
|
1059
|
-
/* @__PURE__ */ (0,
|
|
1060
|
-
renderAvatar ? /* @__PURE__ */ (0,
|
|
1061
|
-
/* @__PURE__ */ (0,
|
|
1245
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cn("flex items-center mt-4 gap-4", contentClassName), children: [
|
|
1246
|
+
renderAvatar ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AvatarSkeleton, { className: avatarClassName }) : null,
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: Array.from({ length: Math.max(1, lines) }, (_2, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1062
1248
|
SkeletonBlock,
|
|
1063
1249
|
{
|
|
1064
1250
|
widthClass: lineWidths[lineIndex] ?? lineWidths[lineWidths.length - 1] ?? DEFAULT_LINE_WIDTHS[1],
|
|
@@ -1068,19 +1254,19 @@ function CardSkeleton({
|
|
|
1068
1254
|
lineIndex
|
|
1069
1255
|
)) })
|
|
1070
1256
|
] }),
|
|
1071
|
-
/* @__PURE__ */ (0,
|
|
1257
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sr-only", children: srLabel })
|
|
1072
1258
|
]
|
|
1073
1259
|
},
|
|
1074
1260
|
index
|
|
1075
1261
|
);
|
|
1076
1262
|
});
|
|
1077
|
-
return /* @__PURE__ */ (0,
|
|
1263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: skeletons });
|
|
1078
1264
|
}
|
|
1079
1265
|
|
|
1080
1266
|
// src/components/tooltip/ToolTip.tsx
|
|
1081
1267
|
var import_react4 = require("react");
|
|
1082
1268
|
var import_react_tooltip = require("react-tooltip");
|
|
1083
|
-
var
|
|
1269
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1084
1270
|
var defaultTooltipStyle = {
|
|
1085
1271
|
color: "#fff",
|
|
1086
1272
|
borderRadius: "5px",
|
|
@@ -1107,10 +1293,10 @@ function ToolTip({
|
|
|
1107
1293
|
const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
|
|
1108
1294
|
const tooltipText = String(text ?? "");
|
|
1109
1295
|
if (disabled || !tooltipText) {
|
|
1110
|
-
return /* @__PURE__ */ (0,
|
|
1296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className, children });
|
|
1111
1297
|
}
|
|
1112
|
-
return /* @__PURE__ */ (0,
|
|
1113
|
-
/* @__PURE__ */ (0,
|
|
1298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1114
1300
|
"span",
|
|
1115
1301
|
{
|
|
1116
1302
|
className,
|
|
@@ -1120,7 +1306,7 @@ function ToolTip({
|
|
|
1120
1306
|
children
|
|
1121
1307
|
}
|
|
1122
1308
|
),
|
|
1123
|
-
/* @__PURE__ */ (0,
|
|
1309
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1124
1310
|
import_react_tooltip.Tooltip,
|
|
1125
1311
|
{
|
|
1126
1312
|
id: tooltipId,
|
|
@@ -1164,7 +1350,7 @@ var toDateInputValue = (date) => {
|
|
|
1164
1350
|
};
|
|
1165
1351
|
|
|
1166
1352
|
// src/components/tooltip/TooltipText.tsx
|
|
1167
|
-
var
|
|
1353
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1168
1354
|
function TooltipText({
|
|
1169
1355
|
text = "",
|
|
1170
1356
|
maxLength = 20,
|
|
@@ -1184,7 +1370,7 @@ function TooltipText({
|
|
|
1184
1370
|
const displayText = truncateText(fullText, maxLength);
|
|
1185
1371
|
const isTruncated = displayText !== fullText;
|
|
1186
1372
|
const tooltipDisabled = !showTooltip || !hasValue || tooltipWhenTruncatedOnly && !isTruncated;
|
|
1187
|
-
return /* @__PURE__ */ (0,
|
|
1373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1188
1374
|
ToolTip,
|
|
1189
1375
|
{
|
|
1190
1376
|
text: fullText,
|
|
@@ -1196,7 +1382,7 @@ function TooltipText({
|
|
|
1196
1382
|
tooltipStyle,
|
|
1197
1383
|
wrapperTabIndex: tooltipDisabled ? void 0 : 0,
|
|
1198
1384
|
disabled: tooltipDisabled,
|
|
1199
|
-
children: /* @__PURE__ */ (0,
|
|
1385
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn("inline-block max-w-full align-bottom", textClassName), children: displayText })
|
|
1200
1386
|
}
|
|
1201
1387
|
);
|
|
1202
1388
|
}
|
|
@@ -1204,9 +1390,9 @@ function TooltipText({
|
|
|
1204
1390
|
// src/components/cell-editor/CustomCellEditor.tsx
|
|
1205
1391
|
var import_react5 = require("react");
|
|
1206
1392
|
var import_react_hot_toast2 = __toESM(require("react-hot-toast"));
|
|
1207
|
-
var
|
|
1393
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1208
1394
|
function ButtonSpinner() {
|
|
1209
|
-
return /* @__PURE__ */ (0,
|
|
1395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1210
1396
|
"svg",
|
|
1211
1397
|
{
|
|
1212
1398
|
className: "animate-spin",
|
|
@@ -1216,7 +1402,7 @@ function ButtonSpinner() {
|
|
|
1216
1402
|
fill: "none",
|
|
1217
1403
|
"aria-hidden": true,
|
|
1218
1404
|
children: [
|
|
1219
|
-
/* @__PURE__ */ (0,
|
|
1405
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1220
1406
|
"circle",
|
|
1221
1407
|
{
|
|
1222
1408
|
cx: "12",
|
|
@@ -1227,7 +1413,7 @@ function ButtonSpinner() {
|
|
|
1227
1413
|
strokeOpacity: "0.25"
|
|
1228
1414
|
}
|
|
1229
1415
|
),
|
|
1230
|
-
/* @__PURE__ */ (0,
|
|
1416
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1231
1417
|
"path",
|
|
1232
1418
|
{
|
|
1233
1419
|
d: "M12 2a10 10 0 0 1 10 10",
|
|
@@ -1363,7 +1549,7 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1363
1549
|
const defaultInputClass = "w-48 px-2 py-1 text-sm border border-gray-200 rounded-md bg-white focus:outline-none focus:ring-1 focus:ring-blue-400";
|
|
1364
1550
|
const defaultSaveBtnClass = "px-3 py-1 text-sm font-medium text-white bg-green-500 rounded-md hover:bg-green-600 disabled:opacity-50 whitespace-nowrap shrink-0";
|
|
1365
1551
|
const defaultCancelBtnClass = "px-3 py-1 text-sm font-medium text-white bg-red-500 rounded-md hover:bg-red-600 disabled:opacity-50 whitespace-nowrap shrink-0";
|
|
1366
|
-
return /* @__PURE__ */ (0,
|
|
1552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1367
1553
|
"div",
|
|
1368
1554
|
{
|
|
1369
1555
|
className: cn(
|
|
@@ -1372,7 +1558,7 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1372
1558
|
),
|
|
1373
1559
|
style: containerStyle,
|
|
1374
1560
|
children: [
|
|
1375
|
-
isDropdown ? /* @__PURE__ */ (0,
|
|
1561
|
+
isDropdown ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1376
1562
|
"select",
|
|
1377
1563
|
{
|
|
1378
1564
|
ref: selectRef,
|
|
@@ -1382,11 +1568,11 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1382
1568
|
className: inputClassName ?? defaultInputClass,
|
|
1383
1569
|
disabled: isLoading,
|
|
1384
1570
|
children: [
|
|
1385
|
-
/* @__PURE__ */ (0,
|
|
1386
|
-
normalizedOptions.map((opt) => /* @__PURE__ */ (0,
|
|
1571
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", disabled: true, children: "Select option..." }),
|
|
1572
|
+
normalizedOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
1387
1573
|
]
|
|
1388
1574
|
}
|
|
1389
|
-
) : /* @__PURE__ */ (0,
|
|
1575
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1390
1576
|
"input",
|
|
1391
1577
|
{
|
|
1392
1578
|
ref: inputRef,
|
|
@@ -1399,7 +1585,7 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1399
1585
|
disabled: isLoading
|
|
1400
1586
|
}
|
|
1401
1587
|
),
|
|
1402
|
-
/* @__PURE__ */ (0,
|
|
1588
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1403
1589
|
"button",
|
|
1404
1590
|
{
|
|
1405
1591
|
type: "button",
|
|
@@ -1408,10 +1594,10 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1408
1594
|
className: saveButtonClassName ?? (saveButtonStyle ? void 0 : defaultSaveBtnClass),
|
|
1409
1595
|
style: saveButtonStyle,
|
|
1410
1596
|
title: "Save (Enter)",
|
|
1411
|
-
children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0,
|
|
1597
|
+
children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ButtonSpinner, {}) : saveButtonContent ?? "Save"
|
|
1412
1598
|
}
|
|
1413
1599
|
),
|
|
1414
|
-
/* @__PURE__ */ (0,
|
|
1600
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1415
1601
|
"button",
|
|
1416
1602
|
{
|
|
1417
1603
|
type: "button",
|
|
@@ -1434,6 +1620,7 @@ CustomCellEditor.displayName = "CustomCellEditor";
|
|
|
1434
1620
|
CardSkeleton,
|
|
1435
1621
|
CustomCellEditor,
|
|
1436
1622
|
CustomPagination,
|
|
1623
|
+
DropdownFilter,
|
|
1437
1624
|
EztrakTabs,
|
|
1438
1625
|
Loader,
|
|
1439
1626
|
Modal,
|
|
@@ -1442,6 +1629,7 @@ CustomCellEditor.displayName = "CustomCellEditor";
|
|
|
1442
1629
|
SearchInput,
|
|
1443
1630
|
TableLayoutToolbarControls,
|
|
1444
1631
|
ToolTip,
|
|
1445
|
-
TooltipText
|
|
1632
|
+
TooltipText,
|
|
1633
|
+
dropdownStyles
|
|
1446
1634
|
});
|
|
1447
1635
|
//# sourceMappingURL=index.js.map
|