jett.admin.npmpackage 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +3 -0
- package/dist/index.js +139 -14
- package/dist/index.mjs +142 -18
- package/package.json +1 -1
package/dist/index.css
CHANGED
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
CustomCheckbox: () => CustomCheckbox,
|
|
37
37
|
CustomInput: () => CustomInput,
|
|
38
38
|
CustomSearch: () => CustomSearch,
|
|
39
|
+
CustomSelect: () => CustomSelect,
|
|
39
40
|
CustomSwitch: () => CustomSwitch,
|
|
40
41
|
CustomTable: () => CustomTable,
|
|
41
42
|
CustomTextarea: () => CustomTextarea,
|
|
@@ -586,6 +587,8 @@ var sidebarlogo_default = "./sidebarlogo-S4TNJORM.webp";
|
|
|
586
587
|
|
|
587
588
|
// src/sideBar/SideBar.jsx
|
|
588
589
|
var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) => {
|
|
590
|
+
var _a, _b;
|
|
591
|
+
const [authData, setAuthData] = (0, import_react11.useState)(null);
|
|
589
592
|
const handleIconRotate = (e, index, additionalKey) => {
|
|
590
593
|
let dropDownIcon = e.currentTarget.children[2];
|
|
591
594
|
if (!dropDownIcon) return;
|
|
@@ -606,6 +609,28 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
|
|
|
606
609
|
optionsContainer.classList.add("max-h-0");
|
|
607
610
|
}
|
|
608
611
|
};
|
|
612
|
+
const checkForAuthData = () => {
|
|
613
|
+
const params = new URLSearchParams(window.location.search);
|
|
614
|
+
let authData2 = params.get("authData");
|
|
615
|
+
if (authData2) {
|
|
616
|
+
authData2 = atob(authData2);
|
|
617
|
+
localStorage.setItem("authData", authData2);
|
|
618
|
+
setAuthData(JSON.parse(authData2));
|
|
619
|
+
params.delete("authData");
|
|
620
|
+
const newUrl = window.location.pathname + (params.toString() ? "?" + params.toString() : "");
|
|
621
|
+
window.history.replaceState({}, document.title, newUrl);
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
(0, import_react11.useEffect)(() => {
|
|
625
|
+
checkForAuthData();
|
|
626
|
+
}, []);
|
|
627
|
+
(0, import_react11.useEffect)(() => {
|
|
628
|
+
const storedAuthData = localStorage.getItem("authData");
|
|
629
|
+
if (storedAuthData) {
|
|
630
|
+
let parseData = JSON.parse(storedAuthData);
|
|
631
|
+
setAuthData(parseData);
|
|
632
|
+
}
|
|
633
|
+
}, [localStorage.getItem("authData")]);
|
|
609
634
|
const navItemsLocal = navItems ?? navItemsConstant;
|
|
610
635
|
const additionalItemsLocal = additionalItems ?? additionalItemsConstant;
|
|
611
636
|
const sideBarLogoLocal = sideBarLogo ?? sidebarlogo_default;
|
|
@@ -643,12 +668,20 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
|
|
|
643
668
|
return /* @__PURE__ */ import_react11.default.createElement("div", { key: index, className: "flex items-center gap-3 p-2 hover:bg-[#f3f4f6] dark:hover:bg-[#27272a] dark:text-[#f4f4f5cc] cursor-pointer", onClick: () => item.onClick && item.onClick() }, /* @__PURE__ */ import_react11.default.createElement(item.Icon, { width: 20, height: 20 }), /* @__PURE__ */ import_react11.default.createElement("span", { className: "font-medium text-[#3f3f46cc] dark:text-[#f4f4f5cc]" }, item.label));
|
|
644
669
|
}))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "mt-auto bg-[#fafafa] dark:bg-transparent sticky bottom-0 pt-2" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center justify-between p-2 rounded-lg hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] cursor-pointer", onClick: () => {
|
|
645
670
|
window.location.href = "/profile";
|
|
646
|
-
} }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "relative flex shrink-0 overflow-hidden rounded-full h-10 w-10" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "flex h-full w-full items-center justify-center rounded-full bg-muted" },
|
|
671
|
+
} }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "relative flex shrink-0 overflow-hidden rounded-full h-10 w-10" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "flex h-full w-full items-center justify-center rounded-full bg-muted" }, ((_a = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _a.UserName) ? authData.userInfo.UserName.split("")[0] : "A")), /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement("p", { className: "font-semibold" }, ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.UserName) ? authData.userInfo.UserName : "Admin User"), /* @__PURE__ */ import_react11.default.createElement("p", { className: "text-sm text-[#3f3f46cc] dark:text-[#f4f4f5cc]" }, role))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "text-[#18181b] dark:text-[#f4f4f5cc]" }, /* @__PURE__ */ import_react11.default.createElement(import_lucide_react5.LogOut, null)))));
|
|
647
672
|
};
|
|
648
673
|
|
|
649
674
|
// src/RightSheet/RightSheet.jsx
|
|
650
675
|
var import_react12 = __toESM(require("react"));
|
|
651
|
-
var RightSheet = ({
|
|
676
|
+
var RightSheet = ({
|
|
677
|
+
open,
|
|
678
|
+
setOpen,
|
|
679
|
+
children,
|
|
680
|
+
callBack,
|
|
681
|
+
actionLabel = "Save",
|
|
682
|
+
onAction = () => {
|
|
683
|
+
}
|
|
684
|
+
}) => {
|
|
652
685
|
const [visible, setVisible] = (0, import_react12.useState)(open);
|
|
653
686
|
(0, import_react12.useEffect)(() => {
|
|
654
687
|
if (open) {
|
|
@@ -666,24 +699,28 @@ var RightSheet = ({ open, setOpen, children, callBack }) => {
|
|
|
666
699
|
callBack();
|
|
667
700
|
}, 200);
|
|
668
701
|
};
|
|
702
|
+
const handleAction = () => {
|
|
703
|
+
onAction();
|
|
704
|
+
handleClose();
|
|
705
|
+
};
|
|
669
706
|
if (!visible) return null;
|
|
670
|
-
return /* @__PURE__ */ import_react12.default.createElement(
|
|
707
|
+
return /* @__PURE__ */ import_react12.default.createElement(
|
|
671
708
|
"div",
|
|
672
709
|
{
|
|
673
|
-
className:
|
|
674
|
-
|
|
675
|
-
onClick: (e) => e.stopPropagation()
|
|
710
|
+
className: "fixed inset-0 overflow-x-hidden bg-black/80 sheetPopIn h-full overflow-auto ",
|
|
711
|
+
onClick: handleClose
|
|
676
712
|
},
|
|
677
|
-
/* @__PURE__ */ import_react12.default.createElement(
|
|
678
|
-
|
|
679
|
-
CustomButton,
|
|
713
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
714
|
+
"div",
|
|
680
715
|
{
|
|
681
|
-
|
|
682
|
-
|
|
716
|
+
className: `absolute flex flex-col right-0 top-0 min-h-full min-w-[100%] md:min-w-[576px] bg-white
|
|
717
|
+
${visible ? "sheetRightSlide" : "transition-all duration-200 translate-x-[100%]"} justify-between `,
|
|
718
|
+
onClick: (e) => e.stopPropagation()
|
|
683
719
|
},
|
|
684
|
-
"
|
|
685
|
-
|
|
686
|
-
|
|
720
|
+
/* @__PURE__ */ import_react12.default.createElement("div", { className: "bg-white min-h-full " }, children),
|
|
721
|
+
/* @__PURE__ */ import_react12.default.createElement("div", { className: "h-[90px] flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 p-6 border-t sticky bottom-0 bg-white border-[#e6e6e6]" }, /* @__PURE__ */ import_react12.default.createElement(CustomButton, { variant: "SECONDARY", onClick: () => handleClose() }, "Cancel"), /* @__PURE__ */ import_react12.default.createElement(CustomButton, { variant: "SECONDARY", onClick: handleAction }, actionLabel))
|
|
722
|
+
)
|
|
723
|
+
);
|
|
687
724
|
};
|
|
688
725
|
|
|
689
726
|
// src/Table/CustomTable.jsx
|
|
@@ -695,6 +732,93 @@ var CustomTable = ({ tableHeader, setIsAllChecked, isAllChecked, children }) =>
|
|
|
695
732
|
return /* @__PURE__ */ import_react13.default.createElement("th", { className: `px-4 py-3 text-sm font-medium ${index == tableHeader.length - 1 ? "text-right" : "text-left"}`, key: header + index }, header);
|
|
696
733
|
}))), /* @__PURE__ */ import_react13.default.createElement("tbody", null, children))));
|
|
697
734
|
};
|
|
735
|
+
|
|
736
|
+
// src/inputs/CustomSelect.jsx
|
|
737
|
+
var import_react14 = __toESM(require("react"));
|
|
738
|
+
var import_lucide_react6 = require("lucide-react");
|
|
739
|
+
var CustomSelect = ({
|
|
740
|
+
label,
|
|
741
|
+
value,
|
|
742
|
+
onChange,
|
|
743
|
+
options,
|
|
744
|
+
placeholder = "Select...",
|
|
745
|
+
isRequired = false,
|
|
746
|
+
error,
|
|
747
|
+
heading,
|
|
748
|
+
disabled = false
|
|
749
|
+
}) => {
|
|
750
|
+
const [open, setOpen] = (0, import_react14.useState)(false);
|
|
751
|
+
const [search, setSearch] = (0, import_react14.useState)("");
|
|
752
|
+
const wrapperRef = (0, import_react14.useRef)(null);
|
|
753
|
+
const handleBlur = (e) => {
|
|
754
|
+
var _a;
|
|
755
|
+
if (!((_a = wrapperRef.current) == null ? void 0 : _a.contains(e.relatedTarget))) {
|
|
756
|
+
setOpen(false);
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
const filteredOptions = options.filter(
|
|
760
|
+
(opt) => opt.label.toLowerCase().includes(search.toLowerCase())
|
|
761
|
+
);
|
|
762
|
+
const handleSelect = (val) => {
|
|
763
|
+
onChange(val);
|
|
764
|
+
setOpen(false);
|
|
765
|
+
};
|
|
766
|
+
const selectedOption = options.find((opt) => opt.value === value);
|
|
767
|
+
return /* @__PURE__ */ import_react14.default.createElement(
|
|
768
|
+
"div",
|
|
769
|
+
{
|
|
770
|
+
className: "flex flex-col w-full relative",
|
|
771
|
+
ref: wrapperRef,
|
|
772
|
+
tabIndex: disabled ? -1 : 0,
|
|
773
|
+
onBlur: handleBlur
|
|
774
|
+
},
|
|
775
|
+
heading && /* @__PURE__ */ import_react14.default.createElement("h3", { className: "text-lg font-semibold mb-1" }, heading),
|
|
776
|
+
label && /* @__PURE__ */ import_react14.default.createElement(
|
|
777
|
+
"label",
|
|
778
|
+
{
|
|
779
|
+
className: `font-medium text-sm mb-1 ${heading ? "text-gray-500" : "text-black"}`
|
|
780
|
+
},
|
|
781
|
+
label,
|
|
782
|
+
" ",
|
|
783
|
+
isRequired && /* @__PURE__ */ import_react14.default.createElement("span", { className: "text-red-500" }, "*")
|
|
784
|
+
),
|
|
785
|
+
/* @__PURE__ */ import_react14.default.createElement(
|
|
786
|
+
"div",
|
|
787
|
+
{
|
|
788
|
+
onClick: () => !disabled && setOpen((prev) => !prev),
|
|
789
|
+
className: `flex justify-between items-center rounded-md px-3 py-2 text-sm border h-10 cursor-pointer
|
|
790
|
+
${disabled ? "bg-gray-100 text-gray-400" : "bg-white hover:border-gray-400"}
|
|
791
|
+
${error ? "border-red-500" : "border-gray-300"}
|
|
792
|
+
`
|
|
793
|
+
},
|
|
794
|
+
/* @__PURE__ */ import_react14.default.createElement("span", { className: `${selectedOption ? "text-black" : "text-gray-400"}` }, selectedOption ? selectedOption.label : placeholder),
|
|
795
|
+
/* @__PURE__ */ import_react14.default.createElement(
|
|
796
|
+
import_lucide_react6.ChevronDown,
|
|
797
|
+
{
|
|
798
|
+
className: `w-4 h-4 text-gray-500 transition-transform ${open ? "rotate-180" : ""}`
|
|
799
|
+
}
|
|
800
|
+
)
|
|
801
|
+
),
|
|
802
|
+
open && !disabled && /* @__PURE__ */ import_react14.default.createElement("div", { className: "absolute top-full mt-1 w-full bg-white border border-gray-200 rounded-lg shadow-lg z-10 max-h-60 overflow-y-auto" }, /* @__PURE__ */ import_react14.default.createElement("div", { className: "flex items-center gap-2 p-2 border-b border-gray-200" }, /* @__PURE__ */ import_react14.default.createElement(import_lucide_react6.Search, { size: 16, className: "text-gray-400" }), /* @__PURE__ */ import_react14.default.createElement(
|
|
803
|
+
"input",
|
|
804
|
+
{
|
|
805
|
+
type: "text",
|
|
806
|
+
value: search,
|
|
807
|
+
onChange: (e) => setSearch(e.target.value),
|
|
808
|
+
placeholder: "Search...",
|
|
809
|
+
className: "flex-1 text-sm focus:outline-none"
|
|
810
|
+
}
|
|
811
|
+
)), /* @__PURE__ */ import_react14.default.createElement("ul", null, filteredOptions.length > 0 ? filteredOptions.map((opt) => /* @__PURE__ */ import_react14.default.createElement(
|
|
812
|
+
"li",
|
|
813
|
+
{
|
|
814
|
+
key: opt.value,
|
|
815
|
+
onClick: () => handleSelect(opt.value),
|
|
816
|
+
className: `px-3 py-2 text-sm cursor-pointer hover:bg-gray-100 ${value === opt.value ? "bg-gray-100 font-medium" : ""}`
|
|
817
|
+
},
|
|
818
|
+
opt.label
|
|
819
|
+
)) : /* @__PURE__ */ import_react14.default.createElement("li", { className: "px-3 py-2 text-sm text-gray-400" }, "No results found")))
|
|
820
|
+
);
|
|
821
|
+
};
|
|
698
822
|
// Annotate the CommonJS export names for ESM import in node:
|
|
699
823
|
0 && (module.exports = {
|
|
700
824
|
AppSideBar,
|
|
@@ -704,6 +828,7 @@ var CustomTable = ({ tableHeader, setIsAllChecked, isAllChecked, children }) =>
|
|
|
704
828
|
CustomCheckbox,
|
|
705
829
|
CustomInput,
|
|
706
830
|
CustomSearch,
|
|
831
|
+
CustomSelect,
|
|
707
832
|
CustomSwitch,
|
|
708
833
|
CustomTable,
|
|
709
834
|
CustomTextarea,
|
package/dist/index.mjs
CHANGED
|
@@ -393,7 +393,7 @@ var CustomUpload = ({
|
|
|
393
393
|
|
|
394
394
|
// src/sideBar/SideBar.jsx
|
|
395
395
|
import { ChevronDown as ChevronDown2, Globe as Globe2, LogOut } from "lucide-react";
|
|
396
|
-
import React11 from "react";
|
|
396
|
+
import React11, { useEffect, useState as useState2 } from "react";
|
|
397
397
|
|
|
398
398
|
// ConstantUI.js
|
|
399
399
|
import { Home, BaggageClaim, Users, Banknote, Globe, TrendingUp, FileText, FileKey2, LifeBuoy, Cog, Building, Handshake, DollarSign } from "lucide-react";
|
|
@@ -539,6 +539,8 @@ var sidebarlogo_default = "./sidebarlogo-S4TNJORM.webp";
|
|
|
539
539
|
|
|
540
540
|
// src/sideBar/SideBar.jsx
|
|
541
541
|
var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) => {
|
|
542
|
+
var _a, _b;
|
|
543
|
+
const [authData, setAuthData] = useState2(null);
|
|
542
544
|
const handleIconRotate = (e, index, additionalKey) => {
|
|
543
545
|
let dropDownIcon = e.currentTarget.children[2];
|
|
544
546
|
if (!dropDownIcon) return;
|
|
@@ -559,6 +561,28 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
|
|
|
559
561
|
optionsContainer.classList.add("max-h-0");
|
|
560
562
|
}
|
|
561
563
|
};
|
|
564
|
+
const checkForAuthData = () => {
|
|
565
|
+
const params = new URLSearchParams(window.location.search);
|
|
566
|
+
let authData2 = params.get("authData");
|
|
567
|
+
if (authData2) {
|
|
568
|
+
authData2 = atob(authData2);
|
|
569
|
+
localStorage.setItem("authData", authData2);
|
|
570
|
+
setAuthData(JSON.parse(authData2));
|
|
571
|
+
params.delete("authData");
|
|
572
|
+
const newUrl = window.location.pathname + (params.toString() ? "?" + params.toString() : "");
|
|
573
|
+
window.history.replaceState({}, document.title, newUrl);
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
useEffect(() => {
|
|
577
|
+
checkForAuthData();
|
|
578
|
+
}, []);
|
|
579
|
+
useEffect(() => {
|
|
580
|
+
const storedAuthData = localStorage.getItem("authData");
|
|
581
|
+
if (storedAuthData) {
|
|
582
|
+
let parseData = JSON.parse(storedAuthData);
|
|
583
|
+
setAuthData(parseData);
|
|
584
|
+
}
|
|
585
|
+
}, [localStorage.getItem("authData")]);
|
|
562
586
|
const navItemsLocal = navItems ?? navItemsConstant;
|
|
563
587
|
const additionalItemsLocal = additionalItems ?? additionalItemsConstant;
|
|
564
588
|
const sideBarLogoLocal = sideBarLogo ?? sidebarlogo_default;
|
|
@@ -596,14 +620,22 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
|
|
|
596
620
|
return /* @__PURE__ */ React11.createElement("div", { key: index, className: "flex items-center gap-3 p-2 hover:bg-[#f3f4f6] dark:hover:bg-[#27272a] dark:text-[#f4f4f5cc] cursor-pointer", onClick: () => item.onClick && item.onClick() }, /* @__PURE__ */ React11.createElement(item.Icon, { width: 20, height: 20 }), /* @__PURE__ */ React11.createElement("span", { className: "font-medium text-[#3f3f46cc] dark:text-[#f4f4f5cc]" }, item.label));
|
|
597
621
|
}))), /* @__PURE__ */ React11.createElement("div", { className: "mt-auto bg-[#fafafa] dark:bg-transparent sticky bottom-0 pt-2" }, /* @__PURE__ */ React11.createElement("div", { className: "flex items-center justify-between p-2 rounded-lg hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] cursor-pointer", onClick: () => {
|
|
598
622
|
window.location.href = "/profile";
|
|
599
|
-
} }, /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React11.createElement("span", { className: "relative flex shrink-0 overflow-hidden rounded-full h-10 w-10" }, /* @__PURE__ */ React11.createElement("span", { className: "flex h-full w-full items-center justify-center rounded-full bg-muted" },
|
|
623
|
+
} }, /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React11.createElement("span", { className: "relative flex shrink-0 overflow-hidden rounded-full h-10 w-10" }, /* @__PURE__ */ React11.createElement("span", { className: "flex h-full w-full items-center justify-center rounded-full bg-muted" }, ((_a = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _a.UserName) ? authData.userInfo.UserName.split("")[0] : "A")), /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("p", { className: "font-semibold" }, ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.UserName) ? authData.userInfo.UserName : "Admin User"), /* @__PURE__ */ React11.createElement("p", { className: "text-sm text-[#3f3f46cc] dark:text-[#f4f4f5cc]" }, role))), /* @__PURE__ */ React11.createElement("div", { className: "text-[#18181b] dark:text-[#f4f4f5cc]" }, /* @__PURE__ */ React11.createElement(LogOut, null)))));
|
|
600
624
|
};
|
|
601
625
|
|
|
602
626
|
// src/RightSheet/RightSheet.jsx
|
|
603
|
-
import React12, { useEffect, useState as
|
|
604
|
-
var RightSheet = ({
|
|
605
|
-
|
|
606
|
-
|
|
627
|
+
import React12, { useEffect as useEffect2, useState as useState3 } from "react";
|
|
628
|
+
var RightSheet = ({
|
|
629
|
+
open,
|
|
630
|
+
setOpen,
|
|
631
|
+
children,
|
|
632
|
+
callBack,
|
|
633
|
+
actionLabel = "Save",
|
|
634
|
+
onAction = () => {
|
|
635
|
+
}
|
|
636
|
+
}) => {
|
|
637
|
+
const [visible, setVisible] = useState3(open);
|
|
638
|
+
useEffect2(() => {
|
|
607
639
|
if (open) {
|
|
608
640
|
document.body.style.overflow = "hidden";
|
|
609
641
|
setVisible(true);
|
|
@@ -619,24 +651,28 @@ var RightSheet = ({ open, setOpen, children, callBack }) => {
|
|
|
619
651
|
callBack();
|
|
620
652
|
}, 200);
|
|
621
653
|
};
|
|
654
|
+
const handleAction = () => {
|
|
655
|
+
onAction();
|
|
656
|
+
handleClose();
|
|
657
|
+
};
|
|
622
658
|
if (!visible) return null;
|
|
623
|
-
return /* @__PURE__ */ React12.createElement(
|
|
659
|
+
return /* @__PURE__ */ React12.createElement(
|
|
624
660
|
"div",
|
|
625
661
|
{
|
|
626
|
-
className:
|
|
627
|
-
|
|
628
|
-
onClick: (e) => e.stopPropagation()
|
|
662
|
+
className: "fixed inset-0 overflow-x-hidden bg-black/80 sheetPopIn h-full overflow-auto ",
|
|
663
|
+
onClick: handleClose
|
|
629
664
|
},
|
|
630
|
-
/* @__PURE__ */ React12.createElement(
|
|
631
|
-
|
|
632
|
-
CustomButton,
|
|
665
|
+
/* @__PURE__ */ React12.createElement(
|
|
666
|
+
"div",
|
|
633
667
|
{
|
|
634
|
-
|
|
635
|
-
|
|
668
|
+
className: `absolute flex flex-col right-0 top-0 min-h-full min-w-[100%] md:min-w-[576px] bg-white
|
|
669
|
+
${visible ? "sheetRightSlide" : "transition-all duration-200 translate-x-[100%]"} justify-between `,
|
|
670
|
+
onClick: (e) => e.stopPropagation()
|
|
636
671
|
},
|
|
637
|
-
"
|
|
638
|
-
|
|
639
|
-
|
|
672
|
+
/* @__PURE__ */ React12.createElement("div", { className: "bg-white min-h-full " }, children),
|
|
673
|
+
/* @__PURE__ */ React12.createElement("div", { className: "h-[90px] flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 p-6 border-t sticky bottom-0 bg-white border-[#e6e6e6]" }, /* @__PURE__ */ React12.createElement(CustomButton, { variant: "SECONDARY", onClick: () => handleClose() }, "Cancel"), /* @__PURE__ */ React12.createElement(CustomButton, { variant: "SECONDARY", onClick: handleAction }, actionLabel))
|
|
674
|
+
)
|
|
675
|
+
);
|
|
640
676
|
};
|
|
641
677
|
|
|
642
678
|
// src/Table/CustomTable.jsx
|
|
@@ -648,6 +684,93 @@ var CustomTable = ({ tableHeader, setIsAllChecked, isAllChecked, children }) =>
|
|
|
648
684
|
return /* @__PURE__ */ React13.createElement("th", { className: `px-4 py-3 text-sm font-medium ${index == tableHeader.length - 1 ? "text-right" : "text-left"}`, key: header + index }, header);
|
|
649
685
|
}))), /* @__PURE__ */ React13.createElement("tbody", null, children))));
|
|
650
686
|
};
|
|
687
|
+
|
|
688
|
+
// src/inputs/CustomSelect.jsx
|
|
689
|
+
import React14, { useState as useState4, useRef as useRef3 } from "react";
|
|
690
|
+
import { ChevronDown as ChevronDown3, Search as Search3 } from "lucide-react";
|
|
691
|
+
var CustomSelect = ({
|
|
692
|
+
label,
|
|
693
|
+
value,
|
|
694
|
+
onChange,
|
|
695
|
+
options,
|
|
696
|
+
placeholder = "Select...",
|
|
697
|
+
isRequired = false,
|
|
698
|
+
error,
|
|
699
|
+
heading,
|
|
700
|
+
disabled = false
|
|
701
|
+
}) => {
|
|
702
|
+
const [open, setOpen] = useState4(false);
|
|
703
|
+
const [search, setSearch] = useState4("");
|
|
704
|
+
const wrapperRef = useRef3(null);
|
|
705
|
+
const handleBlur = (e) => {
|
|
706
|
+
var _a;
|
|
707
|
+
if (!((_a = wrapperRef.current) == null ? void 0 : _a.contains(e.relatedTarget))) {
|
|
708
|
+
setOpen(false);
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
const filteredOptions = options.filter(
|
|
712
|
+
(opt) => opt.label.toLowerCase().includes(search.toLowerCase())
|
|
713
|
+
);
|
|
714
|
+
const handleSelect = (val) => {
|
|
715
|
+
onChange(val);
|
|
716
|
+
setOpen(false);
|
|
717
|
+
};
|
|
718
|
+
const selectedOption = options.find((opt) => opt.value === value);
|
|
719
|
+
return /* @__PURE__ */ React14.createElement(
|
|
720
|
+
"div",
|
|
721
|
+
{
|
|
722
|
+
className: "flex flex-col w-full relative",
|
|
723
|
+
ref: wrapperRef,
|
|
724
|
+
tabIndex: disabled ? -1 : 0,
|
|
725
|
+
onBlur: handleBlur
|
|
726
|
+
},
|
|
727
|
+
heading && /* @__PURE__ */ React14.createElement("h3", { className: "text-lg font-semibold mb-1" }, heading),
|
|
728
|
+
label && /* @__PURE__ */ React14.createElement(
|
|
729
|
+
"label",
|
|
730
|
+
{
|
|
731
|
+
className: `font-medium text-sm mb-1 ${heading ? "text-gray-500" : "text-black"}`
|
|
732
|
+
},
|
|
733
|
+
label,
|
|
734
|
+
" ",
|
|
735
|
+
isRequired && /* @__PURE__ */ React14.createElement("span", { className: "text-red-500" }, "*")
|
|
736
|
+
),
|
|
737
|
+
/* @__PURE__ */ React14.createElement(
|
|
738
|
+
"div",
|
|
739
|
+
{
|
|
740
|
+
onClick: () => !disabled && setOpen((prev) => !prev),
|
|
741
|
+
className: `flex justify-between items-center rounded-md px-3 py-2 text-sm border h-10 cursor-pointer
|
|
742
|
+
${disabled ? "bg-gray-100 text-gray-400" : "bg-white hover:border-gray-400"}
|
|
743
|
+
${error ? "border-red-500" : "border-gray-300"}
|
|
744
|
+
`
|
|
745
|
+
},
|
|
746
|
+
/* @__PURE__ */ React14.createElement("span", { className: `${selectedOption ? "text-black" : "text-gray-400"}` }, selectedOption ? selectedOption.label : placeholder),
|
|
747
|
+
/* @__PURE__ */ React14.createElement(
|
|
748
|
+
ChevronDown3,
|
|
749
|
+
{
|
|
750
|
+
className: `w-4 h-4 text-gray-500 transition-transform ${open ? "rotate-180" : ""}`
|
|
751
|
+
}
|
|
752
|
+
)
|
|
753
|
+
),
|
|
754
|
+
open && !disabled && /* @__PURE__ */ React14.createElement("div", { className: "absolute top-full mt-1 w-full bg-white border border-gray-200 rounded-lg shadow-lg z-10 max-h-60 overflow-y-auto" }, /* @__PURE__ */ React14.createElement("div", { className: "flex items-center gap-2 p-2 border-b border-gray-200" }, /* @__PURE__ */ React14.createElement(Search3, { size: 16, className: "text-gray-400" }), /* @__PURE__ */ React14.createElement(
|
|
755
|
+
"input",
|
|
756
|
+
{
|
|
757
|
+
type: "text",
|
|
758
|
+
value: search,
|
|
759
|
+
onChange: (e) => setSearch(e.target.value),
|
|
760
|
+
placeholder: "Search...",
|
|
761
|
+
className: "flex-1 text-sm focus:outline-none"
|
|
762
|
+
}
|
|
763
|
+
)), /* @__PURE__ */ React14.createElement("ul", null, filteredOptions.length > 0 ? filteredOptions.map((opt) => /* @__PURE__ */ React14.createElement(
|
|
764
|
+
"li",
|
|
765
|
+
{
|
|
766
|
+
key: opt.value,
|
|
767
|
+
onClick: () => handleSelect(opt.value),
|
|
768
|
+
className: `px-3 py-2 text-sm cursor-pointer hover:bg-gray-100 ${value === opt.value ? "bg-gray-100 font-medium" : ""}`
|
|
769
|
+
},
|
|
770
|
+
opt.label
|
|
771
|
+
)) : /* @__PURE__ */ React14.createElement("li", { className: "px-3 py-2 text-sm text-gray-400" }, "No results found")))
|
|
772
|
+
);
|
|
773
|
+
};
|
|
651
774
|
export {
|
|
652
775
|
AppSideBar,
|
|
653
776
|
Chip,
|
|
@@ -656,6 +779,7 @@ export {
|
|
|
656
779
|
CustomCheckbox,
|
|
657
780
|
CustomInput,
|
|
658
781
|
CustomSearch,
|
|
782
|
+
CustomSelect,
|
|
659
783
|
CustomSwitch,
|
|
660
784
|
CustomTable,
|
|
661
785
|
CustomTextarea,
|