@apexcura/ui-components 0.0.14-Beta13 → 0.0.14-Beta131

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -31,27 +31,36 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
33
  AddMoreTable: () => AddMoreTable,
34
+ BarChart: () => BarChart,
34
35
  ButtonElement: () => ButtonElement,
35
36
  CheckboxElement: () => CheckboxElement,
37
+ CircleDonut: () => CircleDonut,
36
38
  CkEditor: () => CkEditor,
37
39
  DatePickerElement: () => DatePickerElement,
38
40
  DateRangePickerElement: () => DateRangePickerElement,
41
+ DoubleBarChart: () => DoubleBarChart,
39
42
  DropDownGroup: () => DropDownGroup,
40
43
  FileUpload: () => FileUpload,
44
+ HorizontalBarChart: () => HorizontalBarChart,
41
45
  Image: () => Image,
46
+ LineChart: () => LineChart,
42
47
  MultipleSelectElement: () => MultipleSelectElement,
43
48
  Navbar: () => Navbar,
44
49
  NumberElement: () => NumberElement,
50
+ OtpElement: () => OtpElement,
45
51
  PasswordElement: () => PasswordElement,
46
52
  RadioElement: () => RadioElement,
47
53
  SelectElement: () => SelectElement,
54
+ SemiCircleDonut: () => SemiCircleDonut,
48
55
  Sidebar: () => Sidebar,
49
56
  SingleCheckbox: () => SingleCheckbox,
50
57
  SingleSelectElement: () => SingleSelectElement,
58
+ SwitchElement: () => SwitchElement,
51
59
  TableElement: () => TableElement,
52
60
  TabsElement: () => TabsElement,
53
61
  TextElement: () => TextElement,
54
- TextareaElement: () => TextareaElement
62
+ TextareaElement: () => TextareaElement,
63
+ Upload: () => Upload2
55
64
  });
56
65
  module.exports = __toCommonJS(src_exports);
57
66
 
@@ -70,6 +79,7 @@ var TextElement = (props) => {
70
79
  placeholder: props.placeholder,
71
80
  allowClear: true,
72
81
  id: props.name,
82
+ value: props.value,
73
83
  prefix: props.prefix,
74
84
  type: props.type,
75
85
  status: props.status,
@@ -129,8 +139,7 @@ var NumberElement = (props) => {
129
139
  {
130
140
  placeholder: props.placeholder,
131
141
  addonBefore: props.addonBefore,
132
- allowClear: true,
133
- defaultValue: props.defaultValue,
142
+ value: props.value,
134
143
  disabled: props.disabled,
135
144
  id: props.name,
136
145
  prefix: props.prefix,
@@ -375,14 +384,78 @@ var MultipleSelectElement = (props) => {
375
384
  // src/Components/Button.tsx
376
385
  var import_react11 = __toESM(require("react"));
377
386
  var ButtonElement = (props) => {
387
+ const [svgContent, setSvgContent] = (0, import_react11.useState)(null);
388
+ const [originalSvgContent, setOriginalSvgContent] = (0, import_react11.useState)(null);
389
+ const [hoverColor, setHoverColor] = (0, import_react11.useState)(null);
390
+ (0, import_react11.useEffect)(() => {
391
+ if (props.icon) {
392
+ fetch(props.icon).then((response) => response.text()).then((data) => {
393
+ const tempDiv = document.createElement("div");
394
+ tempDiv.innerHTML = data;
395
+ const svgElement = tempDiv.querySelector("svg");
396
+ if (svgElement) {
397
+ const textColorClass = props.className?.match(/text-[\w-]+/g)?.[0];
398
+ const hoverColorClass = props.className?.match(/hover:text-[\w-]+/g)?.[0];
399
+ if (textColorClass) {
400
+ const tempSpan = document.createElement("span");
401
+ tempSpan.className = textColorClass;
402
+ document.body.appendChild(tempSpan);
403
+ const computedColor = getComputedStyle(tempSpan).color;
404
+ document.body.removeChild(tempSpan);
405
+ const paths = svgElement.querySelectorAll("path");
406
+ paths.forEach((path) => path.setAttribute("fill", computedColor));
407
+ }
408
+ if (hoverColorClass) {
409
+ const tempSpan = document.createElement("span");
410
+ tempSpan.className = hoverColorClass.replace("hover:", "");
411
+ document.body.appendChild(tempSpan);
412
+ const computedHoverColor = getComputedStyle(tempSpan).color;
413
+ document.body.removeChild(tempSpan);
414
+ setHoverColor(computedHoverColor);
415
+ }
416
+ svgElement.setAttribute(
417
+ "class",
418
+ `${props.iconsClassName ? props.iconsClassName : ""}`
419
+ );
420
+ setSvgContent(tempDiv.innerHTML);
421
+ setOriginalSvgContent(tempDiv.innerHTML);
422
+ }
423
+ }).catch((error) => console.error("Error fetching SVG:", error));
424
+ }
425
+ }, [props.icon, props.className]);
426
+ const handleMouseEnter = () => {
427
+ if (hoverColor && originalSvgContent) {
428
+ const tempDiv = document.createElement("div");
429
+ tempDiv.innerHTML = originalSvgContent;
430
+ const svgElement = tempDiv.querySelector("svg");
431
+ const paths = svgElement?.querySelectorAll("path");
432
+ paths?.forEach((path) => path.setAttribute("fill", hoverColor));
433
+ setSvgContent(tempDiv.innerHTML);
434
+ }
435
+ };
436
+ const handleMouseLeave = () => {
437
+ if (originalSvgContent) {
438
+ setSvgContent(originalSvgContent);
439
+ }
440
+ };
378
441
  return /* @__PURE__ */ import_react11.default.createElement(
379
442
  "button",
380
443
  {
381
- onClick: () => props.onClick && props.onClick(),
382
- className: `${props.className ? props.className : ""}`
444
+ onClick: props.onClick,
445
+ className: `${props.className ? props.className : ""}`,
446
+ onMouseEnter: handleMouseEnter,
447
+ onMouseLeave: handleMouseLeave,
448
+ disabled: props.loading,
449
+ style: {
450
+ cursor: props.loading ? "no-drop" : "pointer"
451
+ }
383
452
  },
384
- props.icon && /* @__PURE__ */ import_react11.default.createElement("img", { className: props.iconsClassName, src: props.icon }),
385
- props.label
453
+ props.isLoading ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, props.isSVGStylesOverride === false ? props.icon && /* @__PURE__ */ import_react11.default.createElement("img", { className: props.iconsClassName, src: props.icon, alt: props.label }) : svgContent && /* @__PURE__ */ import_react11.default.createElement(
454
+ "span",
455
+ {
456
+ dangerouslySetInnerHTML: { __html: svgContent }
457
+ }
458
+ ), props.label)
386
459
  );
387
460
  };
388
461
 
@@ -464,9 +537,9 @@ var AddMoreTable = (props) => {
464
537
  if (!element) return null;
465
538
  const { element: type, label } = element;
466
539
  if (type === "single-select") {
467
- return /* @__PURE__ */ import_react12.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [] });
540
+ return /* @__PURE__ */ import_react12.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [], firstOptions: [], secondOptions: [] });
468
541
  } else if (type === "textarea") {
469
- return /* @__PURE__ */ import_react12.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [] });
542
+ return /* @__PURE__ */ import_react12.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [], firstOptions: [], secondOptions: [] });
470
543
  } else {
471
544
  return null;
472
545
  }
@@ -524,10 +597,19 @@ var Sidebar = (props) => {
524
597
  props.onChange(item);
525
598
  }
526
599
  };
527
- return /* @__PURE__ */ import_react13.default.createElement("div", { className: props.className, key: props.name }, /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement("img", { src: props.img, alt: "logo" })), /* @__PURE__ */ import_react13.default.createElement("ul", { className: props.listClassName }, props.items?.map((item) => {
528
- return /* @__PURE__ */ import_react13.default.createElement("li", { onClick: () => {
529
- handleChange(item);
530
- }, key: item.label, className: `${props.listItemClassName} ${item.active && props.activeClassName}` }, /* @__PURE__ */ import_react13.default.createElement("img", { src: item.icon, className: props.className }), /* @__PURE__ */ import_react13.default.createElement("p", null, item.label));
600
+ return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: props.name }, /* @__PURE__ */ import_react13.default.createElement("div", { className: props.imgClassName }, /* @__PURE__ */ import_react13.default.createElement("img", { src: props.img, alt: "logo" })), /* @__PURE__ */ import_react13.default.createElement("div", { className: props.listClassName }, props.items?.map((item) => {
601
+ return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: item.label }, /* @__PURE__ */ import_react13.default.createElement(
602
+ ButtonElement,
603
+ {
604
+ ...item,
605
+ className: item.active ? props.activeClassName : props.className,
606
+ iconsClassName: props.iconsClassName,
607
+ onClick: (e) => {
608
+ e.preventDefault();
609
+ handleChange(item);
610
+ }
611
+ }
612
+ ));
531
613
  })));
532
614
  };
533
615
 
@@ -652,7 +734,6 @@ var TableElement = (props) => {
652
734
  const { thead, tbody } = props;
653
735
  const [selectedRecord, setSelectedRecord] = (0, import_react20.useState)({});
654
736
  const [model, setModel] = (0, import_react20.useState)(false);
655
- const [selectedRowKeys, setSelectedRowKeys] = (0, import_react20.useState)([]);
656
737
  const handleChange = (record) => {
657
738
  console.log("record", record);
658
739
  if (props.onChange) {
@@ -665,12 +746,14 @@ var TableElement = (props) => {
665
746
  {
666
747
  title: "#",
667
748
  dataIndex: "#",
668
- key: "#"
749
+ key: "#",
750
+ fixed: "left"
669
751
  },
670
752
  ...thead.map((col, ind) => ({
671
753
  title: col.label,
672
754
  dataIndex: col.name,
673
755
  key: col.key,
756
+ ellipsis: col.ellipsis,
674
757
  render: col.render,
675
758
  sorter: {
676
759
  compare: (a, b) => {
@@ -681,8 +764,10 @@ var TableElement = (props) => {
681
764
  }
682
765
  }
683
766
  }
684
- })),
685
- {
767
+ }))
768
+ ];
769
+ if (props.view) {
770
+ columns.push({
686
771
  title: "View",
687
772
  dataIndex: "View",
688
773
  key: "View",
@@ -697,11 +782,12 @@ var TableElement = (props) => {
697
782
  },
698
783
  "View"
699
784
  )
700
- }
701
- ];
785
+ });
786
+ }
702
787
  }
703
788
  const dataSource = tbody && tbody.map((row, index) => ({
704
789
  ...row,
790
+ key: index + 1,
705
791
  [columns[0].key]: index + 1
706
792
  }));
707
793
  const count = dataSource ? dataSource.length : 0;
@@ -710,28 +796,29 @@ var TableElement = (props) => {
710
796
  props.onChange({ name: "pagination", page, pageSize });
711
797
  }
712
798
  };
713
- const onSelectChange = (newSelectedRowKeys) => {
714
- console.log("selectedRowKeys changed: ", newSelectedRowKeys);
715
- setSelectedRowKeys(newSelectedRowKeys);
716
- };
717
799
  const rowSelectionConfig = props.rowSelection ? {
718
- selectedRowKeys,
719
- onChange: onSelectChange
800
+ onChange: (selectedRowKeys, selectedRows) => {
801
+ console.log(`selectedRowKeys: ${selectedRowKeys}`, "selectedRows: ", selectedRows);
802
+ if (props.onChange) {
803
+ props.onChange(selectedRows);
804
+ }
805
+ }
720
806
  } : void 0;
721
807
  return /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, /* @__PURE__ */ import_react20.default.createElement(
722
808
  import_antd14.Table,
723
809
  {
810
+ className: props.className,
724
811
  pagination: {
725
812
  showTotal: (total) => `Total: ${total} items`,
726
813
  total: count,
727
814
  showSizeChanger: count > 10,
728
815
  onChange: onChangePage
729
816
  },
817
+ rowSelection: rowSelectionConfig,
730
818
  dataSource,
731
819
  columns,
732
- bordered: true,
733
- rowSelection: rowSelectionConfig,
734
- size: props.size && props.size
820
+ size: props.size,
821
+ bordered: true
735
822
  }
736
823
  ), model && /* @__PURE__ */ import_react20.default.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
737
824
  };
@@ -739,19 +826,20 @@ var TableElement = (props) => {
739
826
  // src/Components/DatePicker.tsx
740
827
  var import_react21 = __toESM(require("react"));
741
828
  var import_antd15 = require("antd");
829
+ var import_dayjs = __toESM(require("dayjs"));
830
+ var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
831
+ import_dayjs.default.extend(import_customParseFormat.default);
742
832
  var DatePickerElement = (props) => {
743
- const [date, setDate] = (0, import_react21.useState)(null);
744
- const dateFormat = "DD/MM/YYYY";
745
- const handleChange = (date2, dateString) => {
746
- console.log(dateString);
747
- if (date2) {
748
- const formattedDate = date2.format(dateFormat);
749
- setDate(date2);
833
+ const [dateState, setDateState] = (0, import_react21.useState)("");
834
+ const handleChange = (date, dateString) => {
835
+ if (date) {
836
+ const formattedDate = dateString;
837
+ setDateState(date);
750
838
  if (props.onChange) {
751
839
  props.onChange(formattedDate);
752
840
  }
753
841
  } else {
754
- setDate(null);
842
+ setDateState("");
755
843
  if (props.onChange) {
756
844
  props.onChange("");
757
845
  }
@@ -761,8 +849,8 @@ var DatePickerElement = (props) => {
761
849
  import_antd15.DatePicker,
762
850
  {
763
851
  placeholder: props.placeholder,
764
- value: date,
765
- variant: "borderless",
852
+ value: dateState,
853
+ format: { format: "DD-MM-YYYY" },
766
854
  onChange: handleChange
767
855
  }
768
856
  ));
@@ -771,7 +859,7 @@ var DatePickerElement = (props) => {
771
859
  // src/Components/DateRangePickerElement.tsx
772
860
  var import_react22 = __toESM(require("react"));
773
861
  var import_antd16 = require("antd");
774
- var import_dayjs = __toESM(require("dayjs"));
862
+ var import_dayjs2 = __toESM(require("dayjs"));
775
863
  var DateRangePickerElement = (props) => {
776
864
  const { RangePicker } = import_antd16.DatePicker;
777
865
  const handleChange = (dates, dateStrings) => {
@@ -782,10 +870,10 @@ var DateRangePickerElement = (props) => {
782
870
  }
783
871
  };
784
872
  const rangePresets = [
785
- { label: "Last 7 Days", value: [(0, import_dayjs.default)().add(-7, "d"), (0, import_dayjs.default)()] },
786
- { label: "Last 14 Days", value: [(0, import_dayjs.default)().add(-14, "d"), (0, import_dayjs.default)()] },
787
- { label: "Last 30 Days", value: [(0, import_dayjs.default)().add(-30, "d"), (0, import_dayjs.default)()] },
788
- { label: "Last 90 Days", value: [(0, import_dayjs.default)().add(-90, "d"), (0, import_dayjs.default)()] }
873
+ { label: "Last 7 Days", value: [(0, import_dayjs2.default)().add(-7, "d"), (0, import_dayjs2.default)()] },
874
+ { label: "Last 14 Days", value: [(0, import_dayjs2.default)().add(-14, "d"), (0, import_dayjs2.default)()] },
875
+ { label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
876
+ { label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
789
877
  ];
790
878
  return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
791
879
  };
@@ -793,7 +881,7 @@ var DateRangePickerElement = (props) => {
793
881
  // src/Components/Image.tsx
794
882
  var import_react23 = __toESM(require("react"));
795
883
  var Image = (props) => {
796
- return /* @__PURE__ */ import_react23.default.createElement("div", null, /* @__PURE__ */ import_react23.default.createElement("img", { className: props.className, src: props.img, alt: "image" }));
884
+ return /* @__PURE__ */ import_react23.default.createElement("img", { className: props.className, src: props.img, alt: "image" });
797
885
  };
798
886
 
799
887
  // src/Components/SingleCheckbox.tsx
@@ -814,30 +902,34 @@ var import_antd18 = require("antd");
814
902
  var DropDownGroup = (props) => {
815
903
  const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
816
904
  firstValue: {},
817
- secondValue: {}
905
+ secondValue: {},
906
+ temp: ""
818
907
  });
819
908
  const handleFirstChange = (value) => {
820
- const filterOption2 = props.options?.find(
909
+ console.log(selectedValue.temp);
910
+ const filterOption2 = props.firstOptions?.find(
821
911
  (eachOption) => eachOption.value === value
822
912
  );
823
913
  setSelectedValue((prev) => {
824
914
  const newValue = { ...prev, firstValue: filterOption2 };
915
+ const { temp, ...rest } = newValue;
825
916
  if (newValue.firstValue) {
826
- props.onChange?.(newValue);
917
+ props.onChange?.(rest);
827
918
  }
828
- return selectedValue;
919
+ return newValue;
829
920
  });
830
921
  };
831
922
  const handleSecondChange = (value) => {
832
- const filterOption2 = props.options?.find(
923
+ const filterOption2 = props.secondOptions?.find(
833
924
  (eachOption) => eachOption.value === value
834
925
  );
835
926
  setSelectedValue((prev) => {
836
927
  const newValue = { ...prev, secondValue: filterOption2 };
928
+ const { temp, ...rest } = newValue;
837
929
  if (newValue.secondValue) {
838
- props.onChange?.(newValue);
930
+ props.onChange?.(rest);
839
931
  }
840
- return selectedValue;
932
+ return newValue;
841
933
  });
842
934
  };
843
935
  return /* @__PURE__ */ import_react25.default.createElement("div", { className: props.containerClassName }, props.label && /* @__PURE__ */ import_react25.default.createElement("label", { htmlFor: props.name, className: props.labelClassName }, props.label), /* @__PURE__ */ import_react25.default.createElement("div", { className: props.subContainerClassName }, /* @__PURE__ */ import_react25.default.createElement(
@@ -845,7 +937,7 @@ var DropDownGroup = (props) => {
845
937
  {
846
938
  onChange: handleFirstChange,
847
939
  variant: props.variant,
848
- options: props.options1,
940
+ options: props.firstOptions,
849
941
  className: props.className
850
942
  }
851
943
  ), /* @__PURE__ */ import_react25.default.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ import_react25.default.createElement(
@@ -853,7 +945,7 @@ var DropDownGroup = (props) => {
853
945
  {
854
946
  onChange: handleSecondChange,
855
947
  variant: props.variant,
856
- options: props.options2,
948
+ options: props.secondOptions,
857
949
  className: props.className
858
950
  }
859
951
  )));
@@ -866,14 +958,6 @@ var import_icons4 = require("@ant-design/icons");
866
958
  var FileUpload = (props) => {
867
959
  const { Dragger } = import_antd19.Upload;
868
960
  const [files, setFiles] = (0, import_react26.useState)([]);
869
- const beforeUpload = (file) => {
870
- const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
871
- if (!isCorrectFile) {
872
- import_antd19.message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
873
- return import_antd19.Upload.LIST_IGNORE;
874
- }
875
- return true;
876
- };
877
961
  const handleChange = ({ fileList }) => {
878
962
  setFiles(fileList);
879
963
  if (props.onChange) {
@@ -897,7 +981,6 @@ var FileUpload = (props) => {
897
981
  maxCount: props.max_count,
898
982
  multiple: props.multiple,
899
983
  fileList: files,
900
- beforeUpload,
901
984
  onChange: handleChange,
902
985
  showUploadList: true,
903
986
  customRequest
@@ -918,28 +1001,552 @@ var TabsElement = (props) => {
918
1001
  };
919
1002
  return /* @__PURE__ */ import_react27.default.createElement(import_antd20.Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
920
1003
  };
1004
+
1005
+ // src/Components/SwitchElement.tsx
1006
+ var import_react28 = __toESM(require("react"));
1007
+ var import_antd21 = require("antd");
1008
+ var onChange = (checked) => {
1009
+ console.log(`switch to ${checked}`);
1010
+ };
1011
+ var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(import_antd21.Switch, { defaultChecked: true, onChange });
1012
+
1013
+ // src/Components/Upload.tsx
1014
+ var import_react29 = __toESM(require("react"));
1015
+ var Upload2 = (props) => {
1016
+ const [file, setFile] = (0, import_react29.useState)();
1017
+ const handleFileChange = (e) => {
1018
+ setFile(e.target.files[0]);
1019
+ if (props.onChange) {
1020
+ props.onChange(e.target.files[0]);
1021
+ }
1022
+ };
1023
+ const handleUpload = async () => {
1024
+ if (!file) {
1025
+ console.error("No file selected");
1026
+ return;
1027
+ }
1028
+ };
1029
+ return /* @__PURE__ */ import_react29.default.createElement("div", { style: { marginTop: 16 } }, /* @__PURE__ */ import_react29.default.createElement("input", { type: "file", onChange: handleFileChange }), /* @__PURE__ */ import_react29.default.createElement(
1030
+ "button",
1031
+ {
1032
+ type: "button",
1033
+ onClick: handleUpload,
1034
+ disabled: !file,
1035
+ style: { marginTop: 16 }
1036
+ },
1037
+ "Upload"
1038
+ ));
1039
+ };
1040
+
1041
+ // src/Components/OtpElement.tsx
1042
+ var import_react30 = __toESM(require("react"));
1043
+ var import_antd22 = require("antd");
1044
+ var OtpElement = (props) => {
1045
+ const length = props.length;
1046
+ const [otp, setOtp] = (0, import_react30.useState)(Array(length).fill(""));
1047
+ const inputRefs = (0, import_react30.useRef)([]);
1048
+ const handleChange = (e, index) => {
1049
+ const value = e.target.value;
1050
+ if (/^[0-9]$/.test(value) || value === "") {
1051
+ const newOtp = [...otp];
1052
+ newOtp[index] = value;
1053
+ setOtp(newOtp);
1054
+ props.onChange && props.onChange(newOtp.join(""));
1055
+ if (value && index < length - 1) {
1056
+ inputRefs.current[index + 1]?.focus();
1057
+ }
1058
+ }
1059
+ };
1060
+ const handleKeyDown = (e, index) => {
1061
+ if (e.key === "Backspace" && !otp[index] && index > 0) {
1062
+ inputRefs.current[index - 1]?.focus();
1063
+ }
1064
+ };
1065
+ const handlePaste = (e) => {
1066
+ e.preventDefault();
1067
+ const pasteData = e.clipboardData.getData("text");
1068
+ if (/^\d+$/.test(pasteData)) {
1069
+ const newOtp = pasteData.split("").slice(0, length);
1070
+ setOtp(newOtp.concat(Array(length - newOtp.length).fill("")));
1071
+ props.onChange && props.onChange(newOtp.join(""));
1072
+ newOtp.forEach((_, idx) => {
1073
+ if (inputRefs.current[idx]) {
1074
+ inputRefs.current[idx]?.focus();
1075
+ }
1076
+ });
1077
+ }
1078
+ };
1079
+ (0, import_react30.useEffect)(() => {
1080
+ inputRefs.current[0]?.focus();
1081
+ }, []);
1082
+ return /* @__PURE__ */ import_react30.default.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ import_react30.default.createElement(
1083
+ import_antd22.Input,
1084
+ {
1085
+ key: index,
1086
+ className: props.className,
1087
+ maxLength: 1,
1088
+ value: otp[index],
1089
+ onChange: (e) => handleChange(e, index),
1090
+ onKeyDown: (e) => handleKeyDown(e, index),
1091
+ onPaste: handlePaste,
1092
+ ref: (el) => inputRefs.current[index] = el
1093
+ }
1094
+ )));
1095
+ };
1096
+
1097
+ // src/Components/CircleDonut.tsx
1098
+ var import_react31 = __toESM(require("react"));
1099
+ var import_react_chartjs_2 = require("react-chartjs-2");
1100
+ var import_chart = require("chart.js");
1101
+ import_chart.Chart.register(import_chart.DoughnutController, import_chart.ArcElement, import_chart.Tooltip, import_chart.Legend);
1102
+ var CircleDonut = (props) => {
1103
+ const data = {
1104
+ labels: [
1105
+ "Registration",
1106
+ "Book Appointment",
1107
+ "Diagnostic Tests",
1108
+ "Hospital Facility",
1109
+ "Others, Prescriptions"
1110
+ ],
1111
+ datasets: [
1112
+ {
1113
+ label: "Bot Conversation",
1114
+ data: [30, 10, 27, 40, 12],
1115
+ backgroundColor: [
1116
+ "#FFCB8A",
1117
+ "#CADBBF",
1118
+ "#8AC1BB",
1119
+ "#FCB0CB",
1120
+ "#CEB0FA"
1121
+ ],
1122
+ borderWidth: 0
1123
+ }
1124
+ ]
1125
+ };
1126
+ const options = {
1127
+ responsive: true,
1128
+ cutout: "80%",
1129
+ plugins: {
1130
+ legend: {
1131
+ position: "left",
1132
+ labels: {
1133
+ font: {
1134
+ size: 10
1135
+ },
1136
+ boxWidth: 15,
1137
+ generateLabels: (chart) => {
1138
+ const dataset = chart.data.datasets[0];
1139
+ return chart.data.labels.map((label, index) => {
1140
+ const value = dataset.data[index];
1141
+ return {
1142
+ text: `${label}: ${value}`,
1143
+ fillStyle: dataset.backgroundColor[index]
1144
+ };
1145
+ });
1146
+ }
1147
+ }
1148
+ },
1149
+ tooltip: {
1150
+ enabled: true,
1151
+ callbacks: {
1152
+ label: function(context) {
1153
+ const label = context.label || "";
1154
+ const value = context.raw || 0;
1155
+ return `${label}: ${value}`;
1156
+ }
1157
+ }
1158
+ }
1159
+ }
1160
+ };
1161
+ const centerTextPlugin = {
1162
+ id: "centerText",
1163
+ beforeDraw: (chart) => {
1164
+ const { ctx, chartArea: { left, right, top, bottom } } = chart;
1165
+ const width = right - left;
1166
+ const height = bottom - top;
1167
+ const centerX = left + width / 2;
1168
+ const centerY = top + height / 2;
1169
+ ctx.save();
1170
+ ctx.font = "7px Arial";
1171
+ ctx.fillStyle = "blue";
1172
+ ctx.textAlign = "center";
1173
+ ctx.textBaseline = "middle";
1174
+ ctx.fillText("Total Sessions", centerX, centerY - 10);
1175
+ ctx.font = "25px Arial";
1176
+ ctx.fillStyle = "black";
1177
+ ctx.fillText("85", centerX, centerY + 20);
1178
+ ctx.restore();
1179
+ }
1180
+ };
1181
+ return /* @__PURE__ */ import_react31.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react31.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react31.default.createElement(import_react_chartjs_2.Doughnut, { data, options, plugins: [centerTextPlugin] }));
1182
+ };
1183
+
1184
+ // src/Components/SemiCircleDonut.tsx
1185
+ var import_react32 = __toESM(require("react"));
1186
+ var import_react_chartjs_22 = require("react-chartjs-2");
1187
+ var import_chart2 = require("chart.js");
1188
+ import_chart2.Chart.register(import_chart2.DoughnutController, import_chart2.ArcElement, import_chart2.Tooltip, import_chart2.Legend);
1189
+ var SemiCircleDonut = (props) => {
1190
+ const data = {
1191
+ labels: [
1192
+ "Registration",
1193
+ "Book Appointment",
1194
+ "Diagnostic Tests",
1195
+ "Hospital Facility",
1196
+ "Others, Prescriptions"
1197
+ ],
1198
+ datasets: [
1199
+ {
1200
+ label: "Bot Conversation",
1201
+ data: [30, 10, 27, 40, 12],
1202
+ backgroundColor: [
1203
+ "#FFCB8A",
1204
+ "#CADBBF",
1205
+ "#8AC1BB",
1206
+ "#FCB0CB",
1207
+ "#CEB0FA"
1208
+ ],
1209
+ borderWidth: 0
1210
+ }
1211
+ ]
1212
+ };
1213
+ const options = {
1214
+ responsive: true,
1215
+ circumference: 180,
1216
+ rotation: -90,
1217
+ cutout: "80%",
1218
+ plugins: {
1219
+ legend: {
1220
+ display: false
1221
+ // Disable the legend
1222
+ },
1223
+ tooltip: {
1224
+ enabled: true,
1225
+ callbacks: {
1226
+ label: function(context) {
1227
+ const label = context.label || "";
1228
+ const value = context.raw || 0;
1229
+ return `${label}: ${value}`;
1230
+ }
1231
+ }
1232
+ }
1233
+ }
1234
+ };
1235
+ const centerTextPlugin = {
1236
+ id: "centerText",
1237
+ beforeDraw: (chart) => {
1238
+ const { ctx, chartArea: { left, right, top, bottom } } = chart;
1239
+ const width = right - left;
1240
+ const height = bottom - top;
1241
+ const centerX = left + width / 2;
1242
+ const centerY = top + height / 1.5;
1243
+ ctx.save();
1244
+ ctx.font = "26px Arial";
1245
+ ctx.fillStyle = "black";
1246
+ ctx.textAlign = "center";
1247
+ ctx.textBaseline = "middle";
1248
+ ctx.fillText("High", centerX, centerY - 10);
1249
+ ctx.font = "12px Arial";
1250
+ ctx.fillText("Improve Chatbot Training Data", centerX, centerY + 20);
1251
+ ctx.restore();
1252
+ }
1253
+ };
1254
+ return /* @__PURE__ */ import_react32.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react32.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react32.default.createElement(import_react_chartjs_22.Doughnut, { data, options, plugins: [centerTextPlugin] }));
1255
+ };
1256
+
1257
+ // src/Components/HorizontalBarChart.tsx
1258
+ var import_react33 = __toESM(require("react"));
1259
+ var import_react_chartjs_23 = require("react-chartjs-2");
1260
+ var import_chart3 = require("chart.js");
1261
+ import_chart3.Chart.register(import_chart3.BarElement, import_chart3.CategoryScale, import_chart3.LinearScale, import_chart3.Tooltip);
1262
+ var HorizontalBarChart = (props) => {
1263
+ const data = {
1264
+ labels: ["18-24", "25-34", "35-44", "45-54", "55-64", "65+"],
1265
+ datasets: [
1266
+ {
1267
+ data: [30, 10, 27, 40, 12, 24],
1268
+ backgroundColor: "#6298D5",
1269
+ barThickness: 20
1270
+ }
1271
+ ]
1272
+ };
1273
+ const options = {
1274
+ responsive: true,
1275
+ indexAxis: "y",
1276
+ scales: {
1277
+ x: {
1278
+ beginAtZero: true,
1279
+ ticks: {
1280
+ callback: function(value) {
1281
+ return `${value}%`;
1282
+ }
1283
+ }
1284
+ },
1285
+ y: {
1286
+ grid: {
1287
+ display: false
1288
+ }
1289
+ }
1290
+ },
1291
+ plugins: {
1292
+ tooltip: {
1293
+ enabled: true,
1294
+ callbacks: {
1295
+ label: function(context) {
1296
+ const label = context.label || "";
1297
+ const value = context.raw || 0;
1298
+ return `${label}: ${value}`;
1299
+ }
1300
+ }
1301
+ },
1302
+ legend: {
1303
+ display: false
1304
+ }
1305
+ }
1306
+ };
1307
+ return /* @__PURE__ */ import_react33.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react33.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react33.default.createElement(import_react_chartjs_23.Bar, { data, options }));
1308
+ };
1309
+
1310
+ // src/Components/LineChart.tsx
1311
+ var import_react34 = __toESM(require("react"));
1312
+ var import_auto = __toESM(require("chart.js/auto"));
1313
+ var LineChart = (props) => {
1314
+ const chartRef = (0, import_react34.useRef)(null);
1315
+ const chartInstance = (0, import_react34.useRef)(null);
1316
+ const data = [
1317
+ { label: "ROI", data: [10, 30, 50, 70, 90] },
1318
+ { label: "Engagement Rate", data: [20, 40, 60, 80, 100] },
1319
+ { label: "Conversion Rate", data: [30, 50, 70, 90, 110] }
1320
+ ];
1321
+ const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
1322
+ (0, import_react34.useEffect)(() => {
1323
+ if (chartRef.current) {
1324
+ if (chartInstance.current) {
1325
+ chartInstance.current.destroy();
1326
+ }
1327
+ chartInstance.current = new import_auto.default(chartRef.current, {
1328
+ type: "line",
1329
+ data: {
1330
+ labels,
1331
+ datasets: data.map((dataset, index) => ({
1332
+ label: dataset.label,
1333
+ data: dataset.data,
1334
+ borderColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
1335
+ backgroundColor: "rgba(0, 0, 0, 0)",
1336
+ pointBackgroundColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
1337
+ pointBorderColor: "white",
1338
+ pointStyle: "circle",
1339
+ pointRadius: 3,
1340
+ tension: 0.1,
1341
+ fill: true
1342
+ }))
1343
+ },
1344
+ options: {
1345
+ plugins: {
1346
+ legend: {
1347
+ labels: {
1348
+ usePointStyle: true
1349
+ }
1350
+ }
1351
+ },
1352
+ scales: {
1353
+ x: {
1354
+ grid: {
1355
+ display: true
1356
+ }
1357
+ },
1358
+ y: {
1359
+ beginAtZero: true,
1360
+ suggestedMax: 200,
1361
+ ticks: {
1362
+ callback: function(value) {
1363
+ return value + "%";
1364
+ }
1365
+ },
1366
+ grid: {
1367
+ display: true
1368
+ // Display y-axis grid lines
1369
+ }
1370
+ }
1371
+ }
1372
+ }
1373
+ });
1374
+ }
1375
+ return () => {
1376
+ if (chartInstance.current) {
1377
+ chartInstance.current.destroy();
1378
+ }
1379
+ };
1380
+ }, [labels, data]);
1381
+ return /* @__PURE__ */ import_react34.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react34.default.createElement("canvas", { ref: chartRef }));
1382
+ };
1383
+
1384
+ // src/Components/DoubleBarChart.tsx
1385
+ var import_react35 = __toESM(require("react"));
1386
+ var import_auto2 = __toESM(require("chart.js/auto"));
1387
+ var DoubleBarChart = (props) => {
1388
+ const chartRef = (0, import_react35.useRef)(null);
1389
+ const chartInstance = (0, import_react35.useRef)(null);
1390
+ (0, import_react35.useEffect)(() => {
1391
+ if (chartRef.current) {
1392
+ if (chartInstance.current) {
1393
+ chartInstance.current.destroy();
1394
+ }
1395
+ chartInstance.current = new import_auto2.default(chartRef.current, {
1396
+ type: "bar",
1397
+ data: {
1398
+ labels: [
1399
+ "Summer Health Tips",
1400
+ "New Services Launch",
1401
+ "Discounts on Checkups",
1402
+ "Wellness Webinar",
1403
+ "LinkedIn Insights"
1404
+ ],
1405
+ datasets: [
1406
+ {
1407
+ label: "Engagement Rate",
1408
+ data: [60, 70, 50, 80, 65],
1409
+ // Example data for male
1410
+ backgroundColor: "#93B8E2",
1411
+ barThickness: 20
1412
+ },
1413
+ {
1414
+ label: "Conversion Rate",
1415
+ data: [70, 65, 75, 55, 85],
1416
+ // Example data for female
1417
+ backgroundColor: "#4484CD",
1418
+ barThickness: 20
1419
+ }
1420
+ ]
1421
+ },
1422
+ options: {
1423
+ scales: {
1424
+ x: {
1425
+ grid: {
1426
+ display: true
1427
+ // Display x-axis grid lines
1428
+ }
1429
+ },
1430
+ y: {
1431
+ beginAtZero: true,
1432
+ suggestedMax: 100,
1433
+ ticks: {
1434
+ callback: function(value) {
1435
+ return value + "%";
1436
+ }
1437
+ },
1438
+ grid: {
1439
+ display: true
1440
+ // Remove y-axis grid lines
1441
+ }
1442
+ }
1443
+ },
1444
+ plugins: {
1445
+ legend: {
1446
+ labels: {
1447
+ usePointStyle: true
1448
+ }
1449
+ }
1450
+ }
1451
+ }
1452
+ });
1453
+ }
1454
+ return () => {
1455
+ if (chartInstance.current) {
1456
+ chartInstance.current.destroy();
1457
+ }
1458
+ };
1459
+ }, []);
1460
+ return /* @__PURE__ */ import_react35.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react35.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react35.default.createElement("canvas", { ref: chartRef }));
1461
+ };
1462
+
1463
+ // src/Components/BarChart.tsx
1464
+ var import_react36 = __toESM(require("react"));
1465
+ var import_auto3 = __toESM(require("chart.js/auto"));
1466
+ var BarChart = () => {
1467
+ const chartRef = (0, import_react36.useRef)(null);
1468
+ const chartInstance = (0, import_react36.useRef)(null);
1469
+ (0, import_react36.useEffect)(() => {
1470
+ if (chartRef.current) {
1471
+ if (chartInstance.current) {
1472
+ chartInstance.current.destroy();
1473
+ }
1474
+ chartInstance.current = new import_auto3.default(chartRef.current, {
1475
+ type: "bar",
1476
+ data: {
1477
+ labels: [
1478
+ "17 June",
1479
+ "18 June",
1480
+ "19 June",
1481
+ "20 June",
1482
+ "21 June",
1483
+ "22 June",
1484
+ "23 June"
1485
+ ],
1486
+ datasets: [
1487
+ {
1488
+ data: [70, 65, 75, 55, 85],
1489
+ // Example data for female
1490
+ backgroundColor: "rgba(255, 99, 132, 0.5)",
1491
+ borderColor: "rgba(255, 99, 132, 1)",
1492
+ borderWidth: 1
1493
+ }
1494
+ ]
1495
+ },
1496
+ options: {
1497
+ scales: {
1498
+ y: {
1499
+ beginAtZero: true,
1500
+ suggestedMax: 100,
1501
+ ticks: {
1502
+ callback: function(value) {
1503
+ return value + "%";
1504
+ }
1505
+ }
1506
+ }
1507
+ }
1508
+ }
1509
+ });
1510
+ }
1511
+ return () => {
1512
+ if (chartInstance.current) {
1513
+ chartInstance.current.destroy();
1514
+ }
1515
+ };
1516
+ }, []);
1517
+ return /* @__PURE__ */ import_react36.default.createElement("canvas", { ref: chartRef });
1518
+ };
921
1519
  // Annotate the CommonJS export names for ESM import in node:
922
1520
  0 && (module.exports = {
923
1521
  AddMoreTable,
1522
+ BarChart,
924
1523
  ButtonElement,
925
1524
  CheckboxElement,
1525
+ CircleDonut,
926
1526
  CkEditor,
927
1527
  DatePickerElement,
928
1528
  DateRangePickerElement,
1529
+ DoubleBarChart,
929
1530
  DropDownGroup,
930
1531
  FileUpload,
1532
+ HorizontalBarChart,
931
1533
  Image,
1534
+ LineChart,
932
1535
  MultipleSelectElement,
933
1536
  Navbar,
934
1537
  NumberElement,
1538
+ OtpElement,
935
1539
  PasswordElement,
936
1540
  RadioElement,
937
1541
  SelectElement,
1542
+ SemiCircleDonut,
938
1543
  Sidebar,
939
1544
  SingleCheckbox,
940
1545
  SingleSelectElement,
1546
+ SwitchElement,
941
1547
  TableElement,
942
1548
  TabsElement,
943
1549
  TextElement,
944
- TextareaElement
1550
+ TextareaElement,
1551
+ Upload
945
1552
  });