jett.admin.npmpackage 1.0.17 → 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 CHANGED
@@ -249,6 +249,9 @@
249
249
  }
250
250
  }
251
251
  @layer utilities {
252
+ .visible {
253
+ visibility: visible;
254
+ }
252
255
  .absolute {
253
256
  position: absolute;
254
257
  }
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,
@@ -672,7 +673,15 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
672
673
 
673
674
  // src/RightSheet/RightSheet.jsx
674
675
  var import_react12 = __toESM(require("react"));
675
- var RightSheet = ({ open, setOpen, children, callBack }) => {
676
+ var RightSheet = ({
677
+ open,
678
+ setOpen,
679
+ children,
680
+ callBack,
681
+ actionLabel = "Save",
682
+ onAction = () => {
683
+ }
684
+ }) => {
676
685
  const [visible, setVisible] = (0, import_react12.useState)(open);
677
686
  (0, import_react12.useEffect)(() => {
678
687
  if (open) {
@@ -690,24 +699,28 @@ var RightSheet = ({ open, setOpen, children, callBack }) => {
690
699
  callBack();
691
700
  }, 200);
692
701
  };
702
+ const handleAction = () => {
703
+ onAction();
704
+ handleClose();
705
+ };
693
706
  if (!visible) return null;
694
- return /* @__PURE__ */ import_react12.default.createElement("div", { className: "fixed inset-0 overflow-x-hidden bg-black/80 sheetPopIn h-full overflow-auto ", onClick: handleClose }, /* @__PURE__ */ import_react12.default.createElement(
707
+ return /* @__PURE__ */ import_react12.default.createElement(
695
708
  "div",
696
709
  {
697
- className: `absolute flex flex-col right-0 top-0 min-h-full min-w-[100%] md:min-w-[576px] bg-white
698
- ${visible ? "sheetRightSlide" : "transition-all duration-200 translate-x-[100%]"} justify-between `,
699
- onClick: (e) => e.stopPropagation()
710
+ className: "fixed inset-0 overflow-x-hidden bg-black/80 sheetPopIn h-full overflow-auto ",
711
+ onClick: handleClose
700
712
  },
701
- /* @__PURE__ */ import_react12.default.createElement("div", { className: "bg-white min-h-full " }, children),
702
- /* @__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(
703
- CustomButton,
713
+ /* @__PURE__ */ import_react12.default.createElement(
714
+ "div",
704
715
  {
705
- variant: "SECONDARY",
706
- onClick: () => handleClose()
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()
707
719
  },
708
- "Cancel"
709
- ))
710
- ));
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
+ );
711
724
  };
712
725
 
713
726
  // src/Table/CustomTable.jsx
@@ -719,6 +732,93 @@ var CustomTable = ({ tableHeader, setIsAllChecked, isAllChecked, children }) =>
719
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);
720
733
  }))), /* @__PURE__ */ import_react13.default.createElement("tbody", null, children))));
721
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
+ };
722
822
  // Annotate the CommonJS export names for ESM import in node:
723
823
  0 && (module.exports = {
724
824
  AppSideBar,
@@ -728,6 +828,7 @@ var CustomTable = ({ tableHeader, setIsAllChecked, isAllChecked, children }) =>
728
828
  CustomCheckbox,
729
829
  CustomInput,
730
830
  CustomSearch,
831
+ CustomSelect,
731
832
  CustomSwitch,
732
833
  CustomTable,
733
834
  CustomTextarea,
package/dist/index.mjs CHANGED
@@ -625,7 +625,15 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
625
625
 
626
626
  // src/RightSheet/RightSheet.jsx
627
627
  import React12, { useEffect as useEffect2, useState as useState3 } from "react";
628
- var RightSheet = ({ open, setOpen, children, callBack }) => {
628
+ var RightSheet = ({
629
+ open,
630
+ setOpen,
631
+ children,
632
+ callBack,
633
+ actionLabel = "Save",
634
+ onAction = () => {
635
+ }
636
+ }) => {
629
637
  const [visible, setVisible] = useState3(open);
630
638
  useEffect2(() => {
631
639
  if (open) {
@@ -643,24 +651,28 @@ var RightSheet = ({ open, setOpen, children, callBack }) => {
643
651
  callBack();
644
652
  }, 200);
645
653
  };
654
+ const handleAction = () => {
655
+ onAction();
656
+ handleClose();
657
+ };
646
658
  if (!visible) return null;
647
- return /* @__PURE__ */ React12.createElement("div", { className: "fixed inset-0 overflow-x-hidden bg-black/80 sheetPopIn h-full overflow-auto ", onClick: handleClose }, /* @__PURE__ */ React12.createElement(
659
+ return /* @__PURE__ */ React12.createElement(
648
660
  "div",
649
661
  {
650
- className: `absolute flex flex-col right-0 top-0 min-h-full min-w-[100%] md:min-w-[576px] bg-white
651
- ${visible ? "sheetRightSlide" : "transition-all duration-200 translate-x-[100%]"} justify-between `,
652
- onClick: (e) => e.stopPropagation()
662
+ className: "fixed inset-0 overflow-x-hidden bg-black/80 sheetPopIn h-full overflow-auto ",
663
+ onClick: handleClose
653
664
  },
654
- /* @__PURE__ */ React12.createElement("div", { className: "bg-white min-h-full " }, children),
655
- /* @__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(
656
- CustomButton,
665
+ /* @__PURE__ */ React12.createElement(
666
+ "div",
657
667
  {
658
- variant: "SECONDARY",
659
- onClick: () => handleClose()
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()
660
671
  },
661
- "Cancel"
662
- ))
663
- ));
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
+ );
664
676
  };
665
677
 
666
678
  // src/Table/CustomTable.jsx
@@ -672,6 +684,93 @@ var CustomTable = ({ tableHeader, setIsAllChecked, isAllChecked, children }) =>
672
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);
673
685
  }))), /* @__PURE__ */ React13.createElement("tbody", null, children))));
674
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
+ };
675
774
  export {
676
775
  AppSideBar,
677
776
  Chip,
@@ -680,6 +779,7 @@ export {
680
779
  CustomCheckbox,
681
780
  CustomInput,
682
781
  CustomSearch,
782
+ CustomSelect,
683
783
  CustomSwitch,
684
784
  CustomTable,
685
785
  CustomTextarea,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jett.admin.npmpackage",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "exports": {