@apexcura/ui-components 0.0.14-Beta20 → 0.0.14-Beta201
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 +15 -0
- package/dist/index.d.mts +36 -7
- package/dist/index.d.ts +36 -7
- package/dist/index.js +767 -106
- package/dist/index.mjs +782 -105
- package/package.json +7 -3
package/dist/index.js
CHANGED
|
@@ -31,20 +31,27 @@ 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,
|
|
@@ -52,7 +59,8 @@ __export(src_exports, {
|
|
|
52
59
|
TableElement: () => TableElement,
|
|
53
60
|
TabsElement: () => TabsElement,
|
|
54
61
|
TextElement: () => TextElement,
|
|
55
|
-
TextareaElement: () => TextareaElement
|
|
62
|
+
TextareaElement: () => TextareaElement,
|
|
63
|
+
Upload: () => Upload2
|
|
56
64
|
});
|
|
57
65
|
module.exports = __toCommonJS(src_exports);
|
|
58
66
|
|
|
@@ -71,6 +79,7 @@ var TextElement = (props) => {
|
|
|
71
79
|
placeholder: props.placeholder,
|
|
72
80
|
allowClear: true,
|
|
73
81
|
id: props.name,
|
|
82
|
+
value: props.value,
|
|
74
83
|
prefix: props.prefix,
|
|
75
84
|
type: props.type,
|
|
76
85
|
status: props.status,
|
|
@@ -130,8 +139,7 @@ var NumberElement = (props) => {
|
|
|
130
139
|
{
|
|
131
140
|
placeholder: props.placeholder,
|
|
132
141
|
addonBefore: props.addonBefore,
|
|
133
|
-
|
|
134
|
-
defaultValue: props.defaultValue,
|
|
142
|
+
value: props.value,
|
|
135
143
|
disabled: props.disabled,
|
|
136
144
|
id: props.name,
|
|
137
145
|
prefix: props.prefix,
|
|
@@ -379,11 +387,14 @@ var ButtonElement = (props) => {
|
|
|
379
387
|
return /* @__PURE__ */ import_react11.default.createElement(
|
|
380
388
|
"button",
|
|
381
389
|
{
|
|
382
|
-
onClick:
|
|
383
|
-
className: `${props.className ? props.className : ""}
|
|
390
|
+
onClick: props.onClick,
|
|
391
|
+
className: `${props.className ? props.className : ""}`,
|
|
392
|
+
disabled: props.loading,
|
|
393
|
+
style: {
|
|
394
|
+
cursor: props.loading ? "no-drop" : "pointer"
|
|
395
|
+
}
|
|
384
396
|
},
|
|
385
|
-
|
|
386
|
-
props.label
|
|
397
|
+
/* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("span", { className: props.iconsClassName }, /* @__PURE__ */ import_react11.default.createElement("img", { src: props.icon, className: "icon-active" })), props.label)
|
|
387
398
|
);
|
|
388
399
|
};
|
|
389
400
|
|
|
@@ -525,10 +536,19 @@ var Sidebar = (props) => {
|
|
|
525
536
|
props.onChange(item);
|
|
526
537
|
}
|
|
527
538
|
};
|
|
528
|
-
return /* @__PURE__ */ import_react13.default.createElement(
|
|
529
|
-
return /* @__PURE__ */ import_react13.default.createElement(
|
|
530
|
-
|
|
531
|
-
|
|
539
|
+
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) => {
|
|
540
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: item.label }, /* @__PURE__ */ import_react13.default.createElement(
|
|
541
|
+
ButtonElement,
|
|
542
|
+
{
|
|
543
|
+
...item,
|
|
544
|
+
className: item.active ? props.activeClassName : props.className,
|
|
545
|
+
iconsClassName: props.iconsClassName,
|
|
546
|
+
onClick: (e) => {
|
|
547
|
+
e.preventDefault();
|
|
548
|
+
handleChange(item);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
));
|
|
532
552
|
})));
|
|
533
553
|
};
|
|
534
554
|
|
|
@@ -602,18 +622,48 @@ var import_antd13 = require("antd");
|
|
|
602
622
|
|
|
603
623
|
// src/Components/ModelBody.tsx
|
|
604
624
|
var import_react18 = __toESM(require("react"));
|
|
625
|
+
var import_moment = __toESM(require("moment"));
|
|
605
626
|
var ModelBody = (props) => {
|
|
606
|
-
return /* @__PURE__ */ import_react18.default.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
627
|
+
return /* @__PURE__ */ import_react18.default.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
628
|
+
(eachField) => {
|
|
629
|
+
if (eachField.element === "div") {
|
|
630
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, /* @__PURE__ */ import_react18.default.createElement("div", { className: eachField.className }, eachField.label), eachField.dateTime ? /* @__PURE__ */ import_react18.default.createElement(
|
|
631
|
+
"p",
|
|
632
|
+
{
|
|
633
|
+
style: {
|
|
634
|
+
fontSize: "10px",
|
|
635
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
639
|
+
) : "");
|
|
640
|
+
} else if (eachField.element === "input-radio") {
|
|
641
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, /* @__PURE__ */ import_react18.default.createElement("div", { className: eachField.className }, /* @__PURE__ */ import_react18.default.createElement(RadioElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ import_react18.default.createElement(
|
|
642
|
+
"p",
|
|
643
|
+
{
|
|
644
|
+
style: {
|
|
645
|
+
fontSize: "10px",
|
|
646
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
650
|
+
) : "");
|
|
651
|
+
} else if (eachField.element === "button") {
|
|
652
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, /* @__PURE__ */ import_react18.default.createElement("div", { className: eachField.className }, /* @__PURE__ */ import_react18.default.createElement(ButtonElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ import_react18.default.createElement(
|
|
653
|
+
"p",
|
|
654
|
+
{
|
|
655
|
+
style: {
|
|
656
|
+
fontSize: "10px",
|
|
657
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
661
|
+
) : "");
|
|
662
|
+
} else {
|
|
663
|
+
return null;
|
|
664
|
+
}
|
|
615
665
|
}
|
|
616
|
-
|
|
666
|
+
));
|
|
617
667
|
};
|
|
618
668
|
|
|
619
669
|
// src/Components/Model.tsx
|
|
@@ -638,9 +688,22 @@ var ModelElement = (props) => {
|
|
|
638
688
|
margin: "-10px"
|
|
639
689
|
}
|
|
640
690
|
},
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
691
|
+
columns.map((eachColumn) => {
|
|
692
|
+
if (!["index", "View"].includes(eachColumn.key) && eachColumn?.["is_detail"] !== false) {
|
|
693
|
+
return /* @__PURE__ */ import_react19.default.createElement("p", { style: { fontWeight: "500", padding: "10px" } }, /* @__PURE__ */ import_react19.default.createElement(
|
|
694
|
+
"span",
|
|
695
|
+
{
|
|
696
|
+
style: {
|
|
697
|
+
fontWeight: "200",
|
|
698
|
+
color: "gray",
|
|
699
|
+
paddingRight: "10px"
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
eachColumn.title
|
|
703
|
+
), selectedRecord[eachColumn.key] !== "" ? selectedRecord[eachColumn.key] : "--");
|
|
704
|
+
} else {
|
|
705
|
+
return null;
|
|
706
|
+
}
|
|
644
707
|
})
|
|
645
708
|
)
|
|
646
709
|
},
|
|
@@ -649,13 +712,24 @@ var ModelElement = (props) => {
|
|
|
649
712
|
};
|
|
650
713
|
|
|
651
714
|
// src/Components/TableElement.tsx
|
|
715
|
+
var import_icons4 = require("@ant-design/icons");
|
|
652
716
|
var TableElement = (props) => {
|
|
653
717
|
const { thead, tbody } = props;
|
|
654
718
|
const [selectedRecord, setSelectedRecord] = (0, import_react20.useState)({});
|
|
655
719
|
const [model, setModel] = (0, import_react20.useState)(false);
|
|
656
|
-
const [
|
|
720
|
+
const [dataSource, setDataSource] = (0, import_react20.useState)([]);
|
|
721
|
+
(0, import_react20.useEffect)(() => {
|
|
722
|
+
if (tbody) {
|
|
723
|
+
setDataSource(
|
|
724
|
+
tbody.map((row, index) => ({
|
|
725
|
+
...row,
|
|
726
|
+
key: index,
|
|
727
|
+
index: index + 1
|
|
728
|
+
}))
|
|
729
|
+
);
|
|
730
|
+
}
|
|
731
|
+
}, [tbody]);
|
|
657
732
|
const handleChange = (record) => {
|
|
658
|
-
console.log("record", record);
|
|
659
733
|
if (props.onChange) {
|
|
660
734
|
props.onChange(record);
|
|
661
735
|
}
|
|
@@ -665,105 +739,151 @@ var TableElement = (props) => {
|
|
|
665
739
|
columns = [
|
|
666
740
|
{
|
|
667
741
|
title: "#",
|
|
668
|
-
dataIndex: "
|
|
669
|
-
key: "
|
|
742
|
+
dataIndex: "index",
|
|
743
|
+
key: "index",
|
|
744
|
+
fixed: "left"
|
|
670
745
|
},
|
|
671
746
|
...thead.map((col, ind) => ({
|
|
672
747
|
title: col.label,
|
|
673
748
|
dataIndex: col.name,
|
|
674
749
|
key: col.key,
|
|
750
|
+
ellipsis: col.ellipsis,
|
|
675
751
|
render: col.render,
|
|
676
752
|
sorter: {
|
|
677
753
|
compare: (a, b) => {
|
|
678
|
-
if (typeof a[col.key] === "number" && typeof
|
|
754
|
+
if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
|
|
679
755
|
return a[col.key] - b[col.key];
|
|
680
|
-
} else if (typeof a[col.key] === "string" && typeof
|
|
756
|
+
} else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
|
|
681
757
|
return a[col.key].localeCompare(b[col.key]);
|
|
682
758
|
}
|
|
683
759
|
}
|
|
684
760
|
}
|
|
685
|
-
}))
|
|
686
|
-
|
|
761
|
+
}))
|
|
762
|
+
];
|
|
763
|
+
if (props.view) {
|
|
764
|
+
columns.push({
|
|
687
765
|
title: "View",
|
|
688
766
|
dataIndex: "View",
|
|
689
767
|
key: "View",
|
|
690
|
-
render: (_, record) =>
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
768
|
+
render: (_, record) => {
|
|
769
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
770
|
+
"a",
|
|
771
|
+
{
|
|
772
|
+
onClick: () => {
|
|
773
|
+
if (props.view) {
|
|
774
|
+
setSelectedRecord(record);
|
|
775
|
+
handleChange(record);
|
|
776
|
+
setModel(true);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
/* @__PURE__ */ import_react20.default.createElement(import_icons4.EyeOutlined, null)
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
}
|
|
703
785
|
}
|
|
704
|
-
const
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
786
|
+
const onChangeTable = (pagination, filters, sorter, extra) => {
|
|
787
|
+
if (extra && extra.currentDataSource) {
|
|
788
|
+
setDataSource(
|
|
789
|
+
extra.currentDataSource.map((row, index) => ({
|
|
790
|
+
...row,
|
|
791
|
+
index: index + 1
|
|
792
|
+
}))
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
};
|
|
709
796
|
const onChangePage = (page, pageSize) => {
|
|
710
797
|
if (props.onChange) {
|
|
711
798
|
props.onChange({ name: "pagination", page, pageSize });
|
|
712
799
|
}
|
|
713
800
|
};
|
|
714
|
-
const onSelectChange = (newSelectedRowKeys) => {
|
|
715
|
-
console.log("selectedRowKeys changed: ", newSelectedRowKeys);
|
|
716
|
-
setSelectedRowKeys(newSelectedRowKeys);
|
|
717
|
-
};
|
|
718
801
|
const rowSelectionConfig = props.rowSelection ? {
|
|
719
|
-
selectedRowKeys,
|
|
720
|
-
|
|
802
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
803
|
+
console.log(
|
|
804
|
+
`selectedRowKeys: ${selectedRowKeys}`,
|
|
805
|
+
"selectedRows: ",
|
|
806
|
+
selectedRows
|
|
807
|
+
);
|
|
808
|
+
if (props.onChange) {
|
|
809
|
+
props.onChange(selectedRows);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
721
812
|
} : void 0;
|
|
722
813
|
return /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, /* @__PURE__ */ import_react20.default.createElement(
|
|
723
814
|
import_antd14.Table,
|
|
724
815
|
{
|
|
725
|
-
|
|
816
|
+
className: props.className,
|
|
817
|
+
pagination: props.pagination ? {
|
|
726
818
|
showTotal: (total) => `Total: ${total} items`,
|
|
727
|
-
total: count,
|
|
728
|
-
showSizeChanger: count > 10,
|
|
819
|
+
total: props.count,
|
|
820
|
+
showSizeChanger: props.count ? props.count > 10 : 0 > 10,
|
|
729
821
|
onChange: onChangePage
|
|
822
|
+
} : false,
|
|
823
|
+
onRow: (record) => {
|
|
824
|
+
return {
|
|
825
|
+
onClick: () => {
|
|
826
|
+
if (props.view) {
|
|
827
|
+
setSelectedRecord(record);
|
|
828
|
+
handleChange(record);
|
|
829
|
+
setModel(true);
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
style: { cursor: "pointer" }
|
|
833
|
+
};
|
|
730
834
|
},
|
|
835
|
+
rowSelection: rowSelectionConfig,
|
|
731
836
|
dataSource,
|
|
732
837
|
columns,
|
|
838
|
+
size: props.size,
|
|
733
839
|
bordered: true,
|
|
734
|
-
|
|
735
|
-
|
|
840
|
+
onChange: onChangeTable
|
|
841
|
+
}
|
|
842
|
+
), model && /* @__PURE__ */ import_react20.default.createElement(
|
|
843
|
+
ModelElement,
|
|
844
|
+
{
|
|
845
|
+
selectedRecord,
|
|
846
|
+
...props,
|
|
847
|
+
columns,
|
|
848
|
+
model,
|
|
849
|
+
onCancel: () => setModel(false)
|
|
736
850
|
}
|
|
737
|
-
)
|
|
851
|
+
));
|
|
738
852
|
};
|
|
739
853
|
|
|
740
854
|
// src/Components/DatePicker.tsx
|
|
741
855
|
var import_react21 = __toESM(require("react"));
|
|
742
856
|
var import_antd15 = require("antd");
|
|
857
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
858
|
+
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
859
|
+
var import_moment2 = __toESM(require("moment"));
|
|
860
|
+
import_dayjs.default.extend(import_customParseFormat.default);
|
|
743
861
|
var DatePickerElement = (props) => {
|
|
744
|
-
const [
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
const formattedDate = date2.format(dateFormat);
|
|
750
|
-
setDate(date2);
|
|
862
|
+
const [dateState, setDateState] = (0, import_react21.useState)("");
|
|
863
|
+
const handleChange = (date, dateString) => {
|
|
864
|
+
if (date) {
|
|
865
|
+
const formattedDate = dateString;
|
|
866
|
+
setDateState(date);
|
|
751
867
|
if (props.onChange) {
|
|
752
868
|
props.onChange(formattedDate);
|
|
753
869
|
}
|
|
754
870
|
} else {
|
|
755
|
-
|
|
871
|
+
setDateState("");
|
|
756
872
|
if (props.onChange) {
|
|
757
873
|
props.onChange("");
|
|
758
874
|
}
|
|
759
875
|
}
|
|
760
876
|
};
|
|
877
|
+
const disabledDate = (current) => {
|
|
878
|
+
return current && current > (0, import_moment2.default)();
|
|
879
|
+
};
|
|
761
880
|
return /* @__PURE__ */ import_react21.default.createElement("div", null, /* @__PURE__ */ import_react21.default.createElement(
|
|
762
881
|
import_antd15.DatePicker,
|
|
763
882
|
{
|
|
883
|
+
disabledDate,
|
|
764
884
|
placeholder: props.placeholder,
|
|
765
|
-
value:
|
|
766
|
-
|
|
885
|
+
value: dateState,
|
|
886
|
+
format: { format: "DD-MM-YYYY" },
|
|
767
887
|
onChange: handleChange
|
|
768
888
|
}
|
|
769
889
|
));
|
|
@@ -772,29 +892,43 @@ var DatePickerElement = (props) => {
|
|
|
772
892
|
// src/Components/DateRangePickerElement.tsx
|
|
773
893
|
var import_react22 = __toESM(require("react"));
|
|
774
894
|
var import_antd16 = require("antd");
|
|
775
|
-
var
|
|
895
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
896
|
+
var import_moment3 = __toESM(require("moment"));
|
|
776
897
|
var DateRangePickerElement = (props) => {
|
|
898
|
+
const { value } = props;
|
|
777
899
|
const { RangePicker } = import_antd16.DatePicker;
|
|
778
900
|
const handleChange = (dates, dateStrings) => {
|
|
779
|
-
if (dates
|
|
780
|
-
|
|
901
|
+
if (dates) {
|
|
902
|
+
const formattedDate = (0, import_moment3.default)(dateStrings).format("DD-MM-YYYY");
|
|
903
|
+
props.onChange && props.onChange(formattedDate);
|
|
781
904
|
} else {
|
|
782
|
-
|
|
905
|
+
props.onChange && props.onChange("");
|
|
783
906
|
}
|
|
784
907
|
};
|
|
785
908
|
const rangePresets = [
|
|
786
|
-
{ label: "Last 7 Days", value: [(0,
|
|
787
|
-
{ label: "Last 14 Days", value: [(0,
|
|
788
|
-
{ label: "Last 30 Days", value: [(0,
|
|
789
|
-
{ label: "Last 90 Days", value: [(0,
|
|
909
|
+
{ label: "Last 7 Days", value: [(0, import_dayjs2.default)().add(-7, "d"), (0, import_dayjs2.default)()] },
|
|
910
|
+
{ label: "Last 14 Days", value: [(0, import_dayjs2.default)().add(-14, "d"), (0, import_dayjs2.default)()] },
|
|
911
|
+
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
|
|
912
|
+
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
|
|
790
913
|
];
|
|
791
|
-
|
|
914
|
+
const disabledDate = (current) => {
|
|
915
|
+
return current && current > (0, import_moment3.default)();
|
|
916
|
+
};
|
|
917
|
+
return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(
|
|
918
|
+
RangePicker,
|
|
919
|
+
{
|
|
920
|
+
disabledDate,
|
|
921
|
+
presets: rangePresets,
|
|
922
|
+
onChange: handleChange,
|
|
923
|
+
value: value && [(0, import_dayjs2.default)(value[0].format("DD-MM-YYYY")), (0, import_dayjs2.default)(value[1].format("DD-MM-YYYY"))]
|
|
924
|
+
}
|
|
925
|
+
));
|
|
792
926
|
};
|
|
793
927
|
|
|
794
928
|
// src/Components/Image.tsx
|
|
795
929
|
var import_react23 = __toESM(require("react"));
|
|
796
930
|
var Image = (props) => {
|
|
797
|
-
return /* @__PURE__ */ import_react23.default.createElement("
|
|
931
|
+
return /* @__PURE__ */ import_react23.default.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
798
932
|
};
|
|
799
933
|
|
|
800
934
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -813,60 +947,64 @@ var SingleCheckbox = (props) => {
|
|
|
813
947
|
var import_react25 = __toESM(require("react"));
|
|
814
948
|
var import_antd18 = require("antd");
|
|
815
949
|
var DropDownGroup = (props) => {
|
|
816
|
-
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
950
|
+
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
951
|
+
firstValue: {},
|
|
952
|
+
secondValue: {},
|
|
953
|
+
temp: ""
|
|
954
|
+
});
|
|
817
955
|
const handleFirstChange = (value) => {
|
|
818
|
-
|
|
956
|
+
console.log(selectedValue.temp);
|
|
957
|
+
const filterOption2 = props.firstOptions?.find(
|
|
958
|
+
(eachOption) => eachOption.value === value
|
|
959
|
+
);
|
|
819
960
|
setSelectedValue((prev) => {
|
|
820
961
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
962
|
+
const { temp, ...rest } = newValue;
|
|
821
963
|
if (newValue.firstValue) {
|
|
822
|
-
props.onChange?.(
|
|
964
|
+
props.onChange?.(rest);
|
|
823
965
|
}
|
|
824
|
-
return
|
|
966
|
+
return newValue;
|
|
825
967
|
});
|
|
826
968
|
};
|
|
827
969
|
const handleSecondChange = (value) => {
|
|
828
|
-
const filterOption2 = props.secondOptions?.find(
|
|
970
|
+
const filterOption2 = props.secondOptions?.find(
|
|
971
|
+
(eachOption) => eachOption.value === value
|
|
972
|
+
);
|
|
829
973
|
setSelectedValue((prev) => {
|
|
830
974
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
975
|
+
const { temp, ...rest } = newValue;
|
|
831
976
|
if (newValue.secondValue) {
|
|
832
|
-
props.onChange?.(
|
|
977
|
+
props.onChange?.(rest);
|
|
833
978
|
}
|
|
834
|
-
return
|
|
979
|
+
return newValue;
|
|
835
980
|
});
|
|
836
981
|
};
|
|
837
|
-
|
|
838
|
-
return /* @__PURE__ */ import_react25.default.createElement("div", { className: props.className, style: { display: "flex", flexDirection: "row", backgroundColor: "white", borderRadius: 10, border: "1px solid gray" } }, /* @__PURE__ */ import_react25.default.createElement(
|
|
982
|
+
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(
|
|
839
983
|
import_antd18.Select,
|
|
840
984
|
{
|
|
841
985
|
onChange: handleFirstChange,
|
|
842
986
|
variant: props.variant,
|
|
843
|
-
options: props.firstOptions
|
|
987
|
+
options: props.firstOptions,
|
|
988
|
+
className: props.className
|
|
844
989
|
}
|
|
845
990
|
), /* @__PURE__ */ import_react25.default.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ import_react25.default.createElement(
|
|
846
991
|
import_antd18.Select,
|
|
847
992
|
{
|
|
848
993
|
onChange: handleSecondChange,
|
|
849
994
|
variant: props.variant,
|
|
850
|
-
options: props.secondOptions
|
|
995
|
+
options: props.secondOptions,
|
|
996
|
+
className: props.className
|
|
851
997
|
}
|
|
852
|
-
));
|
|
998
|
+
)));
|
|
853
999
|
};
|
|
854
1000
|
|
|
855
1001
|
// src/Components/FilesUpload.tsx
|
|
856
1002
|
var import_react26 = __toESM(require("react"));
|
|
857
1003
|
var import_antd19 = require("antd");
|
|
858
|
-
var
|
|
1004
|
+
var import_icons5 = require("@ant-design/icons");
|
|
859
1005
|
var FileUpload = (props) => {
|
|
860
1006
|
const { Dragger } = import_antd19.Upload;
|
|
861
1007
|
const [files, setFiles] = (0, import_react26.useState)([]);
|
|
862
|
-
const beforeUpload = (file) => {
|
|
863
|
-
const isCorrectFile = ["image/*", "video/*", "application/*"].includes(file.type);
|
|
864
|
-
if (!isCorrectFile) {
|
|
865
|
-
import_antd19.message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
866
|
-
return import_antd19.Upload.LIST_IGNORE;
|
|
867
|
-
}
|
|
868
|
-
return true;
|
|
869
|
-
};
|
|
870
1008
|
const handleChange = ({ fileList }) => {
|
|
871
1009
|
setFiles(fileList);
|
|
872
1010
|
if (props.onChange) {
|
|
@@ -890,12 +1028,11 @@ var FileUpload = (props) => {
|
|
|
890
1028
|
maxCount: props.max_count,
|
|
891
1029
|
multiple: props.multiple,
|
|
892
1030
|
fileList: files,
|
|
893
|
-
beforeUpload,
|
|
894
1031
|
onChange: handleChange,
|
|
895
1032
|
showUploadList: true,
|
|
896
1033
|
customRequest
|
|
897
1034
|
},
|
|
898
|
-
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(
|
|
1035
|
+
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons5.InboxOutlined, null)),
|
|
899
1036
|
/* @__PURE__ */ import_react26.default.createElement("p", null, "Click or drag file to upload")
|
|
900
1037
|
));
|
|
901
1038
|
};
|
|
@@ -919,23 +1056,546 @@ var onChange = (checked) => {
|
|
|
919
1056
|
console.log(`switch to ${checked}`);
|
|
920
1057
|
};
|
|
921
1058
|
var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(import_antd21.Switch, { defaultChecked: true, onChange });
|
|
1059
|
+
|
|
1060
|
+
// src/Components/Upload.tsx
|
|
1061
|
+
var import_react29 = __toESM(require("react"));
|
|
1062
|
+
var Upload2 = (props) => {
|
|
1063
|
+
const [file, setFile] = (0, import_react29.useState)();
|
|
1064
|
+
const handleFileChange = (e) => {
|
|
1065
|
+
setFile(e.target.files[0]);
|
|
1066
|
+
if (props.onChange) {
|
|
1067
|
+
props.onChange(e.target.files[0]);
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
const handleUpload = async () => {
|
|
1071
|
+
if (!file) {
|
|
1072
|
+
console.error("No file selected");
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
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(
|
|
1077
|
+
"button",
|
|
1078
|
+
{
|
|
1079
|
+
type: "button",
|
|
1080
|
+
onClick: handleUpload,
|
|
1081
|
+
disabled: !file,
|
|
1082
|
+
style: { marginTop: 16 }
|
|
1083
|
+
},
|
|
1084
|
+
"Upload"
|
|
1085
|
+
));
|
|
1086
|
+
};
|
|
1087
|
+
|
|
1088
|
+
// src/Components/OtpElement.tsx
|
|
1089
|
+
var import_react30 = __toESM(require("react"));
|
|
1090
|
+
var import_antd22 = require("antd");
|
|
1091
|
+
var OtpElement = (props) => {
|
|
1092
|
+
const length = props.length;
|
|
1093
|
+
const [otp, setOtp] = (0, import_react30.useState)(Array(length).fill(""));
|
|
1094
|
+
const inputRefs = (0, import_react30.useRef)([]);
|
|
1095
|
+
const handleChange = (e, index) => {
|
|
1096
|
+
const value = e.target.value;
|
|
1097
|
+
if (/^[0-9]$/.test(value) || value === "") {
|
|
1098
|
+
const newOtp = [...otp];
|
|
1099
|
+
newOtp[index] = value;
|
|
1100
|
+
setOtp(newOtp);
|
|
1101
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1102
|
+
if (value && index < length - 1) {
|
|
1103
|
+
inputRefs.current[index + 1]?.focus();
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
};
|
|
1107
|
+
const handleKeyDown = (e, index) => {
|
|
1108
|
+
if (e.key === "Backspace" && !otp[index] && index > 0) {
|
|
1109
|
+
inputRefs.current[index - 1]?.focus();
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
const handlePaste = (e) => {
|
|
1113
|
+
e.preventDefault();
|
|
1114
|
+
const pasteData = e.clipboardData.getData("text");
|
|
1115
|
+
if (/^\d+$/.test(pasteData)) {
|
|
1116
|
+
const newOtp = pasteData.split("").slice(0, length);
|
|
1117
|
+
setOtp(newOtp.concat(Array(length - newOtp.length).fill("")));
|
|
1118
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1119
|
+
newOtp.forEach((_, idx) => {
|
|
1120
|
+
if (inputRefs.current[idx]) {
|
|
1121
|
+
inputRefs.current[idx]?.focus();
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
(0, import_react30.useEffect)(() => {
|
|
1127
|
+
inputRefs.current[0]?.focus();
|
|
1128
|
+
}, []);
|
|
1129
|
+
return /* @__PURE__ */ import_react30.default.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ import_react30.default.createElement(
|
|
1130
|
+
import_antd22.Input,
|
|
1131
|
+
{
|
|
1132
|
+
key: index,
|
|
1133
|
+
className: props.className,
|
|
1134
|
+
maxLength: 1,
|
|
1135
|
+
value: otp[index],
|
|
1136
|
+
onChange: (e) => handleChange(e, index),
|
|
1137
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
1138
|
+
onPaste: handlePaste,
|
|
1139
|
+
ref: (el) => inputRefs.current[index] = el
|
|
1140
|
+
}
|
|
1141
|
+
)));
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
// src/Components/CircleDonut.tsx
|
|
1145
|
+
var import_react31 = __toESM(require("react"));
|
|
1146
|
+
var import_react_chartjs_2 = require("react-chartjs-2");
|
|
1147
|
+
var import_chart = require("chart.js");
|
|
1148
|
+
import_chart.Chart.register(import_chart.DoughnutController, import_chart.ArcElement, import_chart.Tooltip, import_chart.Legend);
|
|
1149
|
+
var CircleDonut = (props) => {
|
|
1150
|
+
const data = {
|
|
1151
|
+
labels: props.labels,
|
|
1152
|
+
datasets: [
|
|
1153
|
+
{
|
|
1154
|
+
label: "Bot Conversation",
|
|
1155
|
+
data: props.data,
|
|
1156
|
+
backgroundColor: [
|
|
1157
|
+
"#FFCB8A",
|
|
1158
|
+
"#CADBBF",
|
|
1159
|
+
"#8AC1BB",
|
|
1160
|
+
"#FCB0CB",
|
|
1161
|
+
"#CEB0FA"
|
|
1162
|
+
],
|
|
1163
|
+
borderWidth: 0
|
|
1164
|
+
}
|
|
1165
|
+
]
|
|
1166
|
+
};
|
|
1167
|
+
const options = {
|
|
1168
|
+
responsive: true,
|
|
1169
|
+
cutout: "80%",
|
|
1170
|
+
plugins: {
|
|
1171
|
+
legend: {
|
|
1172
|
+
position: "left",
|
|
1173
|
+
labels: {
|
|
1174
|
+
font: {
|
|
1175
|
+
size: 10
|
|
1176
|
+
},
|
|
1177
|
+
boxWidth: 15,
|
|
1178
|
+
generateLabels: (chart) => {
|
|
1179
|
+
const dataset = chart.data.datasets[0];
|
|
1180
|
+
return chart.data.labels.map((label, index) => {
|
|
1181
|
+
const value = dataset.data[index];
|
|
1182
|
+
return {
|
|
1183
|
+
text: `${label}: ${value}`,
|
|
1184
|
+
fillStyle: dataset.backgroundColor[index]
|
|
1185
|
+
};
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
},
|
|
1190
|
+
tooltip: {
|
|
1191
|
+
enabled: true,
|
|
1192
|
+
callbacks: {
|
|
1193
|
+
label: function(context) {
|
|
1194
|
+
const label = context.label || "";
|
|
1195
|
+
const value = context.raw || 0;
|
|
1196
|
+
return `${label}: ${value}`;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
const centerTextPlugin = {
|
|
1203
|
+
id: "centerText",
|
|
1204
|
+
beforeDraw: (chart) => {
|
|
1205
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1206
|
+
const width = right - left;
|
|
1207
|
+
const height = bottom - top;
|
|
1208
|
+
const centerX = left + width / 2;
|
|
1209
|
+
const centerY = top + height / 2;
|
|
1210
|
+
ctx.save();
|
|
1211
|
+
ctx.font = "7px Arial";
|
|
1212
|
+
ctx.fillStyle = "blue";
|
|
1213
|
+
ctx.textAlign = "center";
|
|
1214
|
+
ctx.textBaseline = "middle";
|
|
1215
|
+
ctx.fillText("Total Sessions", centerX, centerY - 10);
|
|
1216
|
+
ctx.font = "25px Arial";
|
|
1217
|
+
ctx.fillStyle = "black";
|
|
1218
|
+
ctx.fillText("85", centerX, centerY + 20);
|
|
1219
|
+
ctx.restore();
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
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] }));
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
// src/Components/SemiCircleDonut.tsx
|
|
1226
|
+
var import_react32 = __toESM(require("react"));
|
|
1227
|
+
var import_react_chartjs_22 = require("react-chartjs-2");
|
|
1228
|
+
var import_chart2 = require("chart.js");
|
|
1229
|
+
import_chart2.Chart.register(import_chart2.DoughnutController, import_chart2.ArcElement, import_chart2.Tooltip, import_chart2.Legend);
|
|
1230
|
+
var SemiCircleDonut = (props) => {
|
|
1231
|
+
const data = {
|
|
1232
|
+
labels: [
|
|
1233
|
+
"Registration",
|
|
1234
|
+
"Book Appointment",
|
|
1235
|
+
"Diagnostic Tests",
|
|
1236
|
+
"Hospital Facility",
|
|
1237
|
+
"Others, Prescriptions"
|
|
1238
|
+
],
|
|
1239
|
+
datasets: [
|
|
1240
|
+
{
|
|
1241
|
+
label: "Bot Conversation",
|
|
1242
|
+
data: [30, 10, 27, 40, 12],
|
|
1243
|
+
backgroundColor: [
|
|
1244
|
+
"#FFCB8A",
|
|
1245
|
+
"#CADBBF",
|
|
1246
|
+
"#8AC1BB",
|
|
1247
|
+
"#FCB0CB",
|
|
1248
|
+
"#CEB0FA"
|
|
1249
|
+
],
|
|
1250
|
+
borderWidth: 0
|
|
1251
|
+
}
|
|
1252
|
+
]
|
|
1253
|
+
};
|
|
1254
|
+
const options = {
|
|
1255
|
+
responsive: true,
|
|
1256
|
+
circumference: 180,
|
|
1257
|
+
rotation: -90,
|
|
1258
|
+
cutout: "80%",
|
|
1259
|
+
plugins: {
|
|
1260
|
+
legend: {
|
|
1261
|
+
display: false
|
|
1262
|
+
// Disable the legend
|
|
1263
|
+
},
|
|
1264
|
+
tooltip: {
|
|
1265
|
+
enabled: true,
|
|
1266
|
+
callbacks: {
|
|
1267
|
+
label: function(context) {
|
|
1268
|
+
const label = context.label || "";
|
|
1269
|
+
const value = context.raw || 0;
|
|
1270
|
+
return `${label}: ${value}`;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
const centerTextPlugin = {
|
|
1277
|
+
id: "centerText",
|
|
1278
|
+
beforeDraw: (chart) => {
|
|
1279
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1280
|
+
const width = right - left;
|
|
1281
|
+
const height = bottom - top;
|
|
1282
|
+
const centerX = left + width / 2;
|
|
1283
|
+
const centerY = top + height / 1.5;
|
|
1284
|
+
const maxWidth = width * 0.8;
|
|
1285
|
+
ctx.save();
|
|
1286
|
+
ctx.fillStyle = "black";
|
|
1287
|
+
ctx.textAlign = "center";
|
|
1288
|
+
ctx.textBaseline = "middle";
|
|
1289
|
+
const drawText = (text, y, fontSize) => {
|
|
1290
|
+
ctx.font = `${fontSize}px Arial`;
|
|
1291
|
+
const textWidth = ctx.measureText(text).width;
|
|
1292
|
+
if (textWidth > maxWidth) {
|
|
1293
|
+
const newFontSize = fontSize * maxWidth / textWidth;
|
|
1294
|
+
ctx.font = `${newFontSize}px Arial`;
|
|
1295
|
+
}
|
|
1296
|
+
ctx.fillText(text, centerX, y);
|
|
1297
|
+
};
|
|
1298
|
+
drawText(props.fillText1, centerY - 10, 16);
|
|
1299
|
+
drawText(props.fillText2, centerY + 20, 8);
|
|
1300
|
+
ctx.restore();
|
|
1301
|
+
}
|
|
1302
|
+
};
|
|
1303
|
+
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] }));
|
|
1304
|
+
};
|
|
1305
|
+
|
|
1306
|
+
// src/Components/HorizontalBarChart.tsx
|
|
1307
|
+
var import_react33 = __toESM(require("react"));
|
|
1308
|
+
var import_react_chartjs_23 = require("react-chartjs-2");
|
|
1309
|
+
var import_chart3 = require("chart.js");
|
|
1310
|
+
import_chart3.Chart.register(import_chart3.BarElement, import_chart3.CategoryScale, import_chart3.LinearScale, import_chart3.Tooltip);
|
|
1311
|
+
var HorizontalBarChart = (props) => {
|
|
1312
|
+
const data = {
|
|
1313
|
+
labels: ["18-24", "25-34", "35-44", "45-54", "55-64", "65+"],
|
|
1314
|
+
datasets: [
|
|
1315
|
+
{
|
|
1316
|
+
data: [30, 10, 27, 40, 12, 24],
|
|
1317
|
+
backgroundColor: "#6298D5",
|
|
1318
|
+
barThickness: 15
|
|
1319
|
+
}
|
|
1320
|
+
]
|
|
1321
|
+
};
|
|
1322
|
+
const options = {
|
|
1323
|
+
responsive: true,
|
|
1324
|
+
indexAxis: "y",
|
|
1325
|
+
scales: {
|
|
1326
|
+
x: {
|
|
1327
|
+
beginAtZero: true,
|
|
1328
|
+
ticks: {
|
|
1329
|
+
callback: function(value) {
|
|
1330
|
+
return `${value}%`;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
},
|
|
1334
|
+
y: {
|
|
1335
|
+
grid: {
|
|
1336
|
+
display: false
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
},
|
|
1340
|
+
plugins: {
|
|
1341
|
+
tooltip: {
|
|
1342
|
+
enabled: true,
|
|
1343
|
+
callbacks: {
|
|
1344
|
+
label: function(context) {
|
|
1345
|
+
const label = context.label || "";
|
|
1346
|
+
const value = context.raw || 0;
|
|
1347
|
+
return `${label}: ${value}`;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
},
|
|
1351
|
+
legend: {
|
|
1352
|
+
display: false
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
};
|
|
1356
|
+
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 }));
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1359
|
+
// src/Components/LineChart.tsx
|
|
1360
|
+
var import_react34 = __toESM(require("react"));
|
|
1361
|
+
var import_auto = __toESM(require("chart.js/auto"));
|
|
1362
|
+
var LineChart = (props) => {
|
|
1363
|
+
const chartRef = (0, import_react34.useRef)(null);
|
|
1364
|
+
const chartInstance = (0, import_react34.useRef)(null);
|
|
1365
|
+
const data = [
|
|
1366
|
+
{ label: "ROI", data: [10, 13, 20, 15, 10] },
|
|
1367
|
+
{ label: "Engagement Rate", data: [20, 23, 30, 28, 20] },
|
|
1368
|
+
{ label: "Conversion Rate", data: [50, 100, 150, 180, 50] }
|
|
1369
|
+
];
|
|
1370
|
+
const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
|
|
1371
|
+
(0, import_react34.useEffect)(() => {
|
|
1372
|
+
if (chartRef.current) {
|
|
1373
|
+
if (chartInstance.current) {
|
|
1374
|
+
chartInstance.current.destroy();
|
|
1375
|
+
}
|
|
1376
|
+
chartInstance.current = new import_auto.default(chartRef.current, {
|
|
1377
|
+
type: "line",
|
|
1378
|
+
data: {
|
|
1379
|
+
labels,
|
|
1380
|
+
datasets: data.map((dataset, index) => ({
|
|
1381
|
+
label: dataset.label,
|
|
1382
|
+
data: dataset.data,
|
|
1383
|
+
borderColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1384
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
1385
|
+
pointBackgroundColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1386
|
+
pointBorderColor: "white",
|
|
1387
|
+
pointStyle: "circle",
|
|
1388
|
+
pointRadius: 3,
|
|
1389
|
+
tension: 0.1,
|
|
1390
|
+
fill: true
|
|
1391
|
+
}))
|
|
1392
|
+
},
|
|
1393
|
+
options: {
|
|
1394
|
+
plugins: {
|
|
1395
|
+
legend: {
|
|
1396
|
+
labels: {
|
|
1397
|
+
usePointStyle: true
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
scales: {
|
|
1402
|
+
x: {
|
|
1403
|
+
grid: {
|
|
1404
|
+
display: false
|
|
1405
|
+
}
|
|
1406
|
+
},
|
|
1407
|
+
y: {
|
|
1408
|
+
beginAtZero: true,
|
|
1409
|
+
suggestedMax: 200,
|
|
1410
|
+
ticks: {
|
|
1411
|
+
callback: function(value) {
|
|
1412
|
+
return value + "%";
|
|
1413
|
+
}
|
|
1414
|
+
},
|
|
1415
|
+
grid: {
|
|
1416
|
+
display: true
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
return () => {
|
|
1424
|
+
if (chartInstance.current) {
|
|
1425
|
+
chartInstance.current.destroy();
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
}, [labels, data]);
|
|
1429
|
+
return /* @__PURE__ */ import_react34.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react34.default.createElement("canvas", { ref: chartRef }));
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
// src/Components/DoubleBarChart.tsx
|
|
1433
|
+
var import_react35 = __toESM(require("react"));
|
|
1434
|
+
var import_auto2 = __toESM(require("chart.js/auto"));
|
|
1435
|
+
var DoubleBarChart = (props) => {
|
|
1436
|
+
const chartRef = (0, import_react35.useRef)(null);
|
|
1437
|
+
const chartInstance = (0, import_react35.useRef)(null);
|
|
1438
|
+
(0, import_react35.useEffect)(() => {
|
|
1439
|
+
if (chartRef.current) {
|
|
1440
|
+
if (chartInstance.current) {
|
|
1441
|
+
chartInstance.current.destroy();
|
|
1442
|
+
}
|
|
1443
|
+
chartInstance.current = new import_auto2.default(chartRef.current, {
|
|
1444
|
+
type: "bar",
|
|
1445
|
+
data: {
|
|
1446
|
+
labels: [
|
|
1447
|
+
"Summer Health Tips",
|
|
1448
|
+
"New Services Launch",
|
|
1449
|
+
"Discounts on Checkups",
|
|
1450
|
+
"Wellness Webinar",
|
|
1451
|
+
"LinkedIn Insights"
|
|
1452
|
+
],
|
|
1453
|
+
datasets: [
|
|
1454
|
+
{
|
|
1455
|
+
label: "Engagement Rate",
|
|
1456
|
+
data: [60, 70, 50, 80, 65],
|
|
1457
|
+
// Example data for male
|
|
1458
|
+
backgroundColor: "#93B8E2",
|
|
1459
|
+
barThickness: 10
|
|
1460
|
+
},
|
|
1461
|
+
{
|
|
1462
|
+
label: "Conversion Rate",
|
|
1463
|
+
data: [70, 65, 75, 55, 85],
|
|
1464
|
+
// Example data for female
|
|
1465
|
+
backgroundColor: "#4484CD",
|
|
1466
|
+
barThickness: 10
|
|
1467
|
+
}
|
|
1468
|
+
]
|
|
1469
|
+
},
|
|
1470
|
+
options: {
|
|
1471
|
+
scales: {
|
|
1472
|
+
x: {
|
|
1473
|
+
grid: {
|
|
1474
|
+
display: false
|
|
1475
|
+
// Display x-axis grid lines
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
y: {
|
|
1479
|
+
beginAtZero: true,
|
|
1480
|
+
suggestedMax: 100,
|
|
1481
|
+
ticks: {
|
|
1482
|
+
callback: function(value) {
|
|
1483
|
+
return value + "%";
|
|
1484
|
+
}
|
|
1485
|
+
},
|
|
1486
|
+
grid: {
|
|
1487
|
+
display: true
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
},
|
|
1491
|
+
plugins: {
|
|
1492
|
+
legend: {
|
|
1493
|
+
labels: {
|
|
1494
|
+
usePointStyle: true
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
return () => {
|
|
1502
|
+
if (chartInstance.current) {
|
|
1503
|
+
chartInstance.current.destroy();
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
}, []);
|
|
1507
|
+
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 }));
|
|
1508
|
+
};
|
|
1509
|
+
|
|
1510
|
+
// src/Components/BarChart.tsx
|
|
1511
|
+
var import_react36 = __toESM(require("react"));
|
|
1512
|
+
var import_react_chartjs_24 = require("react-chartjs-2");
|
|
1513
|
+
var import_chart4 = require("chart.js");
|
|
1514
|
+
import_chart4.Chart.register(import_chart4.BarElement, import_chart4.CategoryScale, import_chart4.LinearScale, import_chart4.Tooltip);
|
|
1515
|
+
var BarChart = (props) => {
|
|
1516
|
+
const data = {
|
|
1517
|
+
labels: [
|
|
1518
|
+
"17 June",
|
|
1519
|
+
"18 June",
|
|
1520
|
+
"19 June",
|
|
1521
|
+
"20 June",
|
|
1522
|
+
"21 June",
|
|
1523
|
+
"22 June",
|
|
1524
|
+
"23 June"
|
|
1525
|
+
],
|
|
1526
|
+
datasets: [
|
|
1527
|
+
{
|
|
1528
|
+
data: [30, 100, 270, 140, 120, 240],
|
|
1529
|
+
backgroundColor: "#1565C0",
|
|
1530
|
+
barThickness: 15
|
|
1531
|
+
}
|
|
1532
|
+
]
|
|
1533
|
+
};
|
|
1534
|
+
const options = {
|
|
1535
|
+
responsive: true,
|
|
1536
|
+
scales: {
|
|
1537
|
+
x: {
|
|
1538
|
+
beginAtZero: true,
|
|
1539
|
+
grid: {
|
|
1540
|
+
display: false
|
|
1541
|
+
}
|
|
1542
|
+
},
|
|
1543
|
+
y: {
|
|
1544
|
+
grid: {
|
|
1545
|
+
display: true
|
|
1546
|
+
},
|
|
1547
|
+
ticks: {
|
|
1548
|
+
min: 0,
|
|
1549
|
+
max: 400,
|
|
1550
|
+
stepSize: 200,
|
|
1551
|
+
callback: function(value) {
|
|
1552
|
+
return `${value}`;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
},
|
|
1557
|
+
plugins: {
|
|
1558
|
+
tooltip: {
|
|
1559
|
+
enabled: true,
|
|
1560
|
+
callbacks: {
|
|
1561
|
+
label: function(context) {
|
|
1562
|
+
const label = context.label || "";
|
|
1563
|
+
const value = context.raw || 0;
|
|
1564
|
+
return ` ${label}: ${value}`;
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
},
|
|
1568
|
+
legend: {
|
|
1569
|
+
display: false
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
};
|
|
1573
|
+
return /* @__PURE__ */ import_react36.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react36.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react36.default.createElement(import_react_chartjs_24.Bar, { data, options }));
|
|
1574
|
+
};
|
|
922
1575
|
// Annotate the CommonJS export names for ESM import in node:
|
|
923
1576
|
0 && (module.exports = {
|
|
924
1577
|
AddMoreTable,
|
|
1578
|
+
BarChart,
|
|
925
1579
|
ButtonElement,
|
|
926
1580
|
CheckboxElement,
|
|
1581
|
+
CircleDonut,
|
|
927
1582
|
CkEditor,
|
|
928
1583
|
DatePickerElement,
|
|
929
1584
|
DateRangePickerElement,
|
|
1585
|
+
DoubleBarChart,
|
|
930
1586
|
DropDownGroup,
|
|
931
1587
|
FileUpload,
|
|
1588
|
+
HorizontalBarChart,
|
|
932
1589
|
Image,
|
|
1590
|
+
LineChart,
|
|
933
1591
|
MultipleSelectElement,
|
|
934
1592
|
Navbar,
|
|
935
1593
|
NumberElement,
|
|
1594
|
+
OtpElement,
|
|
936
1595
|
PasswordElement,
|
|
937
1596
|
RadioElement,
|
|
938
1597
|
SelectElement,
|
|
1598
|
+
SemiCircleDonut,
|
|
939
1599
|
Sidebar,
|
|
940
1600
|
SingleCheckbox,
|
|
941
1601
|
SingleSelectElement,
|
|
@@ -943,5 +1603,6 @@ var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(i
|
|
|
943
1603
|
TableElement,
|
|
944
1604
|
TabsElement,
|
|
945
1605
|
TextElement,
|
|
946
|
-
TextareaElement
|
|
1606
|
+
TextareaElement,
|
|
1607
|
+
Upload
|
|
947
1608
|
});
|