@apexcura/ui-components 0.0.14-Beta20 → 0.0.14-Beta200
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 +766 -106
- package/dist/index.mjs +781 -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,42 @@ 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
|
-
props.onChange(dateStrings);
|
|
901
|
+
if (dates) {
|
|
902
|
+
props.onChange && props.onChange(dateStrings);
|
|
781
903
|
} else {
|
|
782
|
-
|
|
904
|
+
props.onChange && props.onChange("");
|
|
783
905
|
}
|
|
784
906
|
};
|
|
785
907
|
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,
|
|
908
|
+
{ label: "Last 7 Days", value: [(0, import_dayjs2.default)().add(-7, "d"), (0, import_dayjs2.default)()] },
|
|
909
|
+
{ label: "Last 14 Days", value: [(0, import_dayjs2.default)().add(-14, "d"), (0, import_dayjs2.default)()] },
|
|
910
|
+
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
|
|
911
|
+
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
|
|
790
912
|
];
|
|
791
|
-
|
|
913
|
+
const disabledDate = (current) => {
|
|
914
|
+
return current && current > (0, import_moment3.default)();
|
|
915
|
+
};
|
|
916
|
+
return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(
|
|
917
|
+
RangePicker,
|
|
918
|
+
{
|
|
919
|
+
disabledDate,
|
|
920
|
+
presets: rangePresets,
|
|
921
|
+
onChange: handleChange,
|
|
922
|
+
value: value && [(0, import_dayjs2.default)(value[0]), (0, import_dayjs2.default)(value[1])]
|
|
923
|
+
}
|
|
924
|
+
));
|
|
792
925
|
};
|
|
793
926
|
|
|
794
927
|
// src/Components/Image.tsx
|
|
795
928
|
var import_react23 = __toESM(require("react"));
|
|
796
929
|
var Image = (props) => {
|
|
797
|
-
return /* @__PURE__ */ import_react23.default.createElement("
|
|
930
|
+
return /* @__PURE__ */ import_react23.default.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
798
931
|
};
|
|
799
932
|
|
|
800
933
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -813,60 +946,64 @@ var SingleCheckbox = (props) => {
|
|
|
813
946
|
var import_react25 = __toESM(require("react"));
|
|
814
947
|
var import_antd18 = require("antd");
|
|
815
948
|
var DropDownGroup = (props) => {
|
|
816
|
-
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
949
|
+
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
950
|
+
firstValue: {},
|
|
951
|
+
secondValue: {},
|
|
952
|
+
temp: ""
|
|
953
|
+
});
|
|
817
954
|
const handleFirstChange = (value) => {
|
|
818
|
-
|
|
955
|
+
console.log(selectedValue.temp);
|
|
956
|
+
const filterOption2 = props.firstOptions?.find(
|
|
957
|
+
(eachOption) => eachOption.value === value
|
|
958
|
+
);
|
|
819
959
|
setSelectedValue((prev) => {
|
|
820
960
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
961
|
+
const { temp, ...rest } = newValue;
|
|
821
962
|
if (newValue.firstValue) {
|
|
822
|
-
props.onChange?.(
|
|
963
|
+
props.onChange?.(rest);
|
|
823
964
|
}
|
|
824
|
-
return
|
|
965
|
+
return newValue;
|
|
825
966
|
});
|
|
826
967
|
};
|
|
827
968
|
const handleSecondChange = (value) => {
|
|
828
|
-
const filterOption2 = props.secondOptions?.find(
|
|
969
|
+
const filterOption2 = props.secondOptions?.find(
|
|
970
|
+
(eachOption) => eachOption.value === value
|
|
971
|
+
);
|
|
829
972
|
setSelectedValue((prev) => {
|
|
830
973
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
974
|
+
const { temp, ...rest } = newValue;
|
|
831
975
|
if (newValue.secondValue) {
|
|
832
|
-
props.onChange?.(
|
|
976
|
+
props.onChange?.(rest);
|
|
833
977
|
}
|
|
834
|
-
return
|
|
978
|
+
return newValue;
|
|
835
979
|
});
|
|
836
980
|
};
|
|
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(
|
|
981
|
+
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
982
|
import_antd18.Select,
|
|
840
983
|
{
|
|
841
984
|
onChange: handleFirstChange,
|
|
842
985
|
variant: props.variant,
|
|
843
|
-
options: props.firstOptions
|
|
986
|
+
options: props.firstOptions,
|
|
987
|
+
className: props.className
|
|
844
988
|
}
|
|
845
989
|
), /* @__PURE__ */ import_react25.default.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ import_react25.default.createElement(
|
|
846
990
|
import_antd18.Select,
|
|
847
991
|
{
|
|
848
992
|
onChange: handleSecondChange,
|
|
849
993
|
variant: props.variant,
|
|
850
|
-
options: props.secondOptions
|
|
994
|
+
options: props.secondOptions,
|
|
995
|
+
className: props.className
|
|
851
996
|
}
|
|
852
|
-
));
|
|
997
|
+
)));
|
|
853
998
|
};
|
|
854
999
|
|
|
855
1000
|
// src/Components/FilesUpload.tsx
|
|
856
1001
|
var import_react26 = __toESM(require("react"));
|
|
857
1002
|
var import_antd19 = require("antd");
|
|
858
|
-
var
|
|
1003
|
+
var import_icons5 = require("@ant-design/icons");
|
|
859
1004
|
var FileUpload = (props) => {
|
|
860
1005
|
const { Dragger } = import_antd19.Upload;
|
|
861
1006
|
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
1007
|
const handleChange = ({ fileList }) => {
|
|
871
1008
|
setFiles(fileList);
|
|
872
1009
|
if (props.onChange) {
|
|
@@ -890,12 +1027,11 @@ var FileUpload = (props) => {
|
|
|
890
1027
|
maxCount: props.max_count,
|
|
891
1028
|
multiple: props.multiple,
|
|
892
1029
|
fileList: files,
|
|
893
|
-
beforeUpload,
|
|
894
1030
|
onChange: handleChange,
|
|
895
1031
|
showUploadList: true,
|
|
896
1032
|
customRequest
|
|
897
1033
|
},
|
|
898
|
-
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(
|
|
1034
|
+
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons5.InboxOutlined, null)),
|
|
899
1035
|
/* @__PURE__ */ import_react26.default.createElement("p", null, "Click or drag file to upload")
|
|
900
1036
|
));
|
|
901
1037
|
};
|
|
@@ -919,23 +1055,546 @@ var onChange = (checked) => {
|
|
|
919
1055
|
console.log(`switch to ${checked}`);
|
|
920
1056
|
};
|
|
921
1057
|
var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(import_antd21.Switch, { defaultChecked: true, onChange });
|
|
1058
|
+
|
|
1059
|
+
// src/Components/Upload.tsx
|
|
1060
|
+
var import_react29 = __toESM(require("react"));
|
|
1061
|
+
var Upload2 = (props) => {
|
|
1062
|
+
const [file, setFile] = (0, import_react29.useState)();
|
|
1063
|
+
const handleFileChange = (e) => {
|
|
1064
|
+
setFile(e.target.files[0]);
|
|
1065
|
+
if (props.onChange) {
|
|
1066
|
+
props.onChange(e.target.files[0]);
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
const handleUpload = async () => {
|
|
1070
|
+
if (!file) {
|
|
1071
|
+
console.error("No file selected");
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
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(
|
|
1076
|
+
"button",
|
|
1077
|
+
{
|
|
1078
|
+
type: "button",
|
|
1079
|
+
onClick: handleUpload,
|
|
1080
|
+
disabled: !file,
|
|
1081
|
+
style: { marginTop: 16 }
|
|
1082
|
+
},
|
|
1083
|
+
"Upload"
|
|
1084
|
+
));
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
// src/Components/OtpElement.tsx
|
|
1088
|
+
var import_react30 = __toESM(require("react"));
|
|
1089
|
+
var import_antd22 = require("antd");
|
|
1090
|
+
var OtpElement = (props) => {
|
|
1091
|
+
const length = props.length;
|
|
1092
|
+
const [otp, setOtp] = (0, import_react30.useState)(Array(length).fill(""));
|
|
1093
|
+
const inputRefs = (0, import_react30.useRef)([]);
|
|
1094
|
+
const handleChange = (e, index) => {
|
|
1095
|
+
const value = e.target.value;
|
|
1096
|
+
if (/^[0-9]$/.test(value) || value === "") {
|
|
1097
|
+
const newOtp = [...otp];
|
|
1098
|
+
newOtp[index] = value;
|
|
1099
|
+
setOtp(newOtp);
|
|
1100
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1101
|
+
if (value && index < length - 1) {
|
|
1102
|
+
inputRefs.current[index + 1]?.focus();
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
const handleKeyDown = (e, index) => {
|
|
1107
|
+
if (e.key === "Backspace" && !otp[index] && index > 0) {
|
|
1108
|
+
inputRefs.current[index - 1]?.focus();
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
const handlePaste = (e) => {
|
|
1112
|
+
e.preventDefault();
|
|
1113
|
+
const pasteData = e.clipboardData.getData("text");
|
|
1114
|
+
if (/^\d+$/.test(pasteData)) {
|
|
1115
|
+
const newOtp = pasteData.split("").slice(0, length);
|
|
1116
|
+
setOtp(newOtp.concat(Array(length - newOtp.length).fill("")));
|
|
1117
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1118
|
+
newOtp.forEach((_, idx) => {
|
|
1119
|
+
if (inputRefs.current[idx]) {
|
|
1120
|
+
inputRefs.current[idx]?.focus();
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
(0, import_react30.useEffect)(() => {
|
|
1126
|
+
inputRefs.current[0]?.focus();
|
|
1127
|
+
}, []);
|
|
1128
|
+
return /* @__PURE__ */ import_react30.default.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ import_react30.default.createElement(
|
|
1129
|
+
import_antd22.Input,
|
|
1130
|
+
{
|
|
1131
|
+
key: index,
|
|
1132
|
+
className: props.className,
|
|
1133
|
+
maxLength: 1,
|
|
1134
|
+
value: otp[index],
|
|
1135
|
+
onChange: (e) => handleChange(e, index),
|
|
1136
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
1137
|
+
onPaste: handlePaste,
|
|
1138
|
+
ref: (el) => inputRefs.current[index] = el
|
|
1139
|
+
}
|
|
1140
|
+
)));
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
// src/Components/CircleDonut.tsx
|
|
1144
|
+
var import_react31 = __toESM(require("react"));
|
|
1145
|
+
var import_react_chartjs_2 = require("react-chartjs-2");
|
|
1146
|
+
var import_chart = require("chart.js");
|
|
1147
|
+
import_chart.Chart.register(import_chart.DoughnutController, import_chart.ArcElement, import_chart.Tooltip, import_chart.Legend);
|
|
1148
|
+
var CircleDonut = (props) => {
|
|
1149
|
+
const data = {
|
|
1150
|
+
labels: props.labels,
|
|
1151
|
+
datasets: [
|
|
1152
|
+
{
|
|
1153
|
+
label: "Bot Conversation",
|
|
1154
|
+
data: props.data,
|
|
1155
|
+
backgroundColor: [
|
|
1156
|
+
"#FFCB8A",
|
|
1157
|
+
"#CADBBF",
|
|
1158
|
+
"#8AC1BB",
|
|
1159
|
+
"#FCB0CB",
|
|
1160
|
+
"#CEB0FA"
|
|
1161
|
+
],
|
|
1162
|
+
borderWidth: 0
|
|
1163
|
+
}
|
|
1164
|
+
]
|
|
1165
|
+
};
|
|
1166
|
+
const options = {
|
|
1167
|
+
responsive: true,
|
|
1168
|
+
cutout: "80%",
|
|
1169
|
+
plugins: {
|
|
1170
|
+
legend: {
|
|
1171
|
+
position: "left",
|
|
1172
|
+
labels: {
|
|
1173
|
+
font: {
|
|
1174
|
+
size: 10
|
|
1175
|
+
},
|
|
1176
|
+
boxWidth: 15,
|
|
1177
|
+
generateLabels: (chart) => {
|
|
1178
|
+
const dataset = chart.data.datasets[0];
|
|
1179
|
+
return chart.data.labels.map((label, index) => {
|
|
1180
|
+
const value = dataset.data[index];
|
|
1181
|
+
return {
|
|
1182
|
+
text: `${label}: ${value}`,
|
|
1183
|
+
fillStyle: dataset.backgroundColor[index]
|
|
1184
|
+
};
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
},
|
|
1189
|
+
tooltip: {
|
|
1190
|
+
enabled: true,
|
|
1191
|
+
callbacks: {
|
|
1192
|
+
label: function(context) {
|
|
1193
|
+
const label = context.label || "";
|
|
1194
|
+
const value = context.raw || 0;
|
|
1195
|
+
return `${label}: ${value}`;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
const centerTextPlugin = {
|
|
1202
|
+
id: "centerText",
|
|
1203
|
+
beforeDraw: (chart) => {
|
|
1204
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1205
|
+
const width = right - left;
|
|
1206
|
+
const height = bottom - top;
|
|
1207
|
+
const centerX = left + width / 2;
|
|
1208
|
+
const centerY = top + height / 2;
|
|
1209
|
+
ctx.save();
|
|
1210
|
+
ctx.font = "7px Arial";
|
|
1211
|
+
ctx.fillStyle = "blue";
|
|
1212
|
+
ctx.textAlign = "center";
|
|
1213
|
+
ctx.textBaseline = "middle";
|
|
1214
|
+
ctx.fillText("Total Sessions", centerX, centerY - 10);
|
|
1215
|
+
ctx.font = "25px Arial";
|
|
1216
|
+
ctx.fillStyle = "black";
|
|
1217
|
+
ctx.fillText("85", centerX, centerY + 20);
|
|
1218
|
+
ctx.restore();
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
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] }));
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
// src/Components/SemiCircleDonut.tsx
|
|
1225
|
+
var import_react32 = __toESM(require("react"));
|
|
1226
|
+
var import_react_chartjs_22 = require("react-chartjs-2");
|
|
1227
|
+
var import_chart2 = require("chart.js");
|
|
1228
|
+
import_chart2.Chart.register(import_chart2.DoughnutController, import_chart2.ArcElement, import_chart2.Tooltip, import_chart2.Legend);
|
|
1229
|
+
var SemiCircleDonut = (props) => {
|
|
1230
|
+
const data = {
|
|
1231
|
+
labels: [
|
|
1232
|
+
"Registration",
|
|
1233
|
+
"Book Appointment",
|
|
1234
|
+
"Diagnostic Tests",
|
|
1235
|
+
"Hospital Facility",
|
|
1236
|
+
"Others, Prescriptions"
|
|
1237
|
+
],
|
|
1238
|
+
datasets: [
|
|
1239
|
+
{
|
|
1240
|
+
label: "Bot Conversation",
|
|
1241
|
+
data: [30, 10, 27, 40, 12],
|
|
1242
|
+
backgroundColor: [
|
|
1243
|
+
"#FFCB8A",
|
|
1244
|
+
"#CADBBF",
|
|
1245
|
+
"#8AC1BB",
|
|
1246
|
+
"#FCB0CB",
|
|
1247
|
+
"#CEB0FA"
|
|
1248
|
+
],
|
|
1249
|
+
borderWidth: 0
|
|
1250
|
+
}
|
|
1251
|
+
]
|
|
1252
|
+
};
|
|
1253
|
+
const options = {
|
|
1254
|
+
responsive: true,
|
|
1255
|
+
circumference: 180,
|
|
1256
|
+
rotation: -90,
|
|
1257
|
+
cutout: "80%",
|
|
1258
|
+
plugins: {
|
|
1259
|
+
legend: {
|
|
1260
|
+
display: false
|
|
1261
|
+
// Disable the legend
|
|
1262
|
+
},
|
|
1263
|
+
tooltip: {
|
|
1264
|
+
enabled: true,
|
|
1265
|
+
callbacks: {
|
|
1266
|
+
label: function(context) {
|
|
1267
|
+
const label = context.label || "";
|
|
1268
|
+
const value = context.raw || 0;
|
|
1269
|
+
return `${label}: ${value}`;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1275
|
+
const centerTextPlugin = {
|
|
1276
|
+
id: "centerText",
|
|
1277
|
+
beforeDraw: (chart) => {
|
|
1278
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1279
|
+
const width = right - left;
|
|
1280
|
+
const height = bottom - top;
|
|
1281
|
+
const centerX = left + width / 2;
|
|
1282
|
+
const centerY = top + height / 1.5;
|
|
1283
|
+
const maxWidth = width * 0.8;
|
|
1284
|
+
ctx.save();
|
|
1285
|
+
ctx.fillStyle = "black";
|
|
1286
|
+
ctx.textAlign = "center";
|
|
1287
|
+
ctx.textBaseline = "middle";
|
|
1288
|
+
const drawText = (text, y, fontSize) => {
|
|
1289
|
+
ctx.font = `${fontSize}px Arial`;
|
|
1290
|
+
const textWidth = ctx.measureText(text).width;
|
|
1291
|
+
if (textWidth > maxWidth) {
|
|
1292
|
+
const newFontSize = fontSize * maxWidth / textWidth;
|
|
1293
|
+
ctx.font = `${newFontSize}px Arial`;
|
|
1294
|
+
}
|
|
1295
|
+
ctx.fillText(text, centerX, y);
|
|
1296
|
+
};
|
|
1297
|
+
drawText(props.fillText1, centerY - 10, 16);
|
|
1298
|
+
drawText(props.fillText2, centerY + 20, 8);
|
|
1299
|
+
ctx.restore();
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1302
|
+
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] }));
|
|
1303
|
+
};
|
|
1304
|
+
|
|
1305
|
+
// src/Components/HorizontalBarChart.tsx
|
|
1306
|
+
var import_react33 = __toESM(require("react"));
|
|
1307
|
+
var import_react_chartjs_23 = require("react-chartjs-2");
|
|
1308
|
+
var import_chart3 = require("chart.js");
|
|
1309
|
+
import_chart3.Chart.register(import_chart3.BarElement, import_chart3.CategoryScale, import_chart3.LinearScale, import_chart3.Tooltip);
|
|
1310
|
+
var HorizontalBarChart = (props) => {
|
|
1311
|
+
const data = {
|
|
1312
|
+
labels: ["18-24", "25-34", "35-44", "45-54", "55-64", "65+"],
|
|
1313
|
+
datasets: [
|
|
1314
|
+
{
|
|
1315
|
+
data: [30, 10, 27, 40, 12, 24],
|
|
1316
|
+
backgroundColor: "#6298D5",
|
|
1317
|
+
barThickness: 15
|
|
1318
|
+
}
|
|
1319
|
+
]
|
|
1320
|
+
};
|
|
1321
|
+
const options = {
|
|
1322
|
+
responsive: true,
|
|
1323
|
+
indexAxis: "y",
|
|
1324
|
+
scales: {
|
|
1325
|
+
x: {
|
|
1326
|
+
beginAtZero: true,
|
|
1327
|
+
ticks: {
|
|
1328
|
+
callback: function(value) {
|
|
1329
|
+
return `${value}%`;
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
},
|
|
1333
|
+
y: {
|
|
1334
|
+
grid: {
|
|
1335
|
+
display: false
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
},
|
|
1339
|
+
plugins: {
|
|
1340
|
+
tooltip: {
|
|
1341
|
+
enabled: true,
|
|
1342
|
+
callbacks: {
|
|
1343
|
+
label: function(context) {
|
|
1344
|
+
const label = context.label || "";
|
|
1345
|
+
const value = context.raw || 0;
|
|
1346
|
+
return `${label}: ${value}`;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
},
|
|
1350
|
+
legend: {
|
|
1351
|
+
display: false
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
};
|
|
1355
|
+
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 }));
|
|
1356
|
+
};
|
|
1357
|
+
|
|
1358
|
+
// src/Components/LineChart.tsx
|
|
1359
|
+
var import_react34 = __toESM(require("react"));
|
|
1360
|
+
var import_auto = __toESM(require("chart.js/auto"));
|
|
1361
|
+
var LineChart = (props) => {
|
|
1362
|
+
const chartRef = (0, import_react34.useRef)(null);
|
|
1363
|
+
const chartInstance = (0, import_react34.useRef)(null);
|
|
1364
|
+
const data = [
|
|
1365
|
+
{ label: "ROI", data: [10, 13, 20, 15, 10] },
|
|
1366
|
+
{ label: "Engagement Rate", data: [20, 23, 30, 28, 20] },
|
|
1367
|
+
{ label: "Conversion Rate", data: [50, 100, 150, 180, 50] }
|
|
1368
|
+
];
|
|
1369
|
+
const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
|
|
1370
|
+
(0, import_react34.useEffect)(() => {
|
|
1371
|
+
if (chartRef.current) {
|
|
1372
|
+
if (chartInstance.current) {
|
|
1373
|
+
chartInstance.current.destroy();
|
|
1374
|
+
}
|
|
1375
|
+
chartInstance.current = new import_auto.default(chartRef.current, {
|
|
1376
|
+
type: "line",
|
|
1377
|
+
data: {
|
|
1378
|
+
labels,
|
|
1379
|
+
datasets: data.map((dataset, index) => ({
|
|
1380
|
+
label: dataset.label,
|
|
1381
|
+
data: dataset.data,
|
|
1382
|
+
borderColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1383
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
1384
|
+
pointBackgroundColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1385
|
+
pointBorderColor: "white",
|
|
1386
|
+
pointStyle: "circle",
|
|
1387
|
+
pointRadius: 3,
|
|
1388
|
+
tension: 0.1,
|
|
1389
|
+
fill: true
|
|
1390
|
+
}))
|
|
1391
|
+
},
|
|
1392
|
+
options: {
|
|
1393
|
+
plugins: {
|
|
1394
|
+
legend: {
|
|
1395
|
+
labels: {
|
|
1396
|
+
usePointStyle: true
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
},
|
|
1400
|
+
scales: {
|
|
1401
|
+
x: {
|
|
1402
|
+
grid: {
|
|
1403
|
+
display: false
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
y: {
|
|
1407
|
+
beginAtZero: true,
|
|
1408
|
+
suggestedMax: 200,
|
|
1409
|
+
ticks: {
|
|
1410
|
+
callback: function(value) {
|
|
1411
|
+
return value + "%";
|
|
1412
|
+
}
|
|
1413
|
+
},
|
|
1414
|
+
grid: {
|
|
1415
|
+
display: true
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
return () => {
|
|
1423
|
+
if (chartInstance.current) {
|
|
1424
|
+
chartInstance.current.destroy();
|
|
1425
|
+
}
|
|
1426
|
+
};
|
|
1427
|
+
}, [labels, data]);
|
|
1428
|
+
return /* @__PURE__ */ import_react34.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react34.default.createElement("canvas", { ref: chartRef }));
|
|
1429
|
+
};
|
|
1430
|
+
|
|
1431
|
+
// src/Components/DoubleBarChart.tsx
|
|
1432
|
+
var import_react35 = __toESM(require("react"));
|
|
1433
|
+
var import_auto2 = __toESM(require("chart.js/auto"));
|
|
1434
|
+
var DoubleBarChart = (props) => {
|
|
1435
|
+
const chartRef = (0, import_react35.useRef)(null);
|
|
1436
|
+
const chartInstance = (0, import_react35.useRef)(null);
|
|
1437
|
+
(0, import_react35.useEffect)(() => {
|
|
1438
|
+
if (chartRef.current) {
|
|
1439
|
+
if (chartInstance.current) {
|
|
1440
|
+
chartInstance.current.destroy();
|
|
1441
|
+
}
|
|
1442
|
+
chartInstance.current = new import_auto2.default(chartRef.current, {
|
|
1443
|
+
type: "bar",
|
|
1444
|
+
data: {
|
|
1445
|
+
labels: [
|
|
1446
|
+
"Summer Health Tips",
|
|
1447
|
+
"New Services Launch",
|
|
1448
|
+
"Discounts on Checkups",
|
|
1449
|
+
"Wellness Webinar",
|
|
1450
|
+
"LinkedIn Insights"
|
|
1451
|
+
],
|
|
1452
|
+
datasets: [
|
|
1453
|
+
{
|
|
1454
|
+
label: "Engagement Rate",
|
|
1455
|
+
data: [60, 70, 50, 80, 65],
|
|
1456
|
+
// Example data for male
|
|
1457
|
+
backgroundColor: "#93B8E2",
|
|
1458
|
+
barThickness: 10
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
label: "Conversion Rate",
|
|
1462
|
+
data: [70, 65, 75, 55, 85],
|
|
1463
|
+
// Example data for female
|
|
1464
|
+
backgroundColor: "#4484CD",
|
|
1465
|
+
barThickness: 10
|
|
1466
|
+
}
|
|
1467
|
+
]
|
|
1468
|
+
},
|
|
1469
|
+
options: {
|
|
1470
|
+
scales: {
|
|
1471
|
+
x: {
|
|
1472
|
+
grid: {
|
|
1473
|
+
display: false
|
|
1474
|
+
// Display x-axis grid lines
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
y: {
|
|
1478
|
+
beginAtZero: true,
|
|
1479
|
+
suggestedMax: 100,
|
|
1480
|
+
ticks: {
|
|
1481
|
+
callback: function(value) {
|
|
1482
|
+
return value + "%";
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1485
|
+
grid: {
|
|
1486
|
+
display: true
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
},
|
|
1490
|
+
plugins: {
|
|
1491
|
+
legend: {
|
|
1492
|
+
labels: {
|
|
1493
|
+
usePointStyle: true
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
return () => {
|
|
1501
|
+
if (chartInstance.current) {
|
|
1502
|
+
chartInstance.current.destroy();
|
|
1503
|
+
}
|
|
1504
|
+
};
|
|
1505
|
+
}, []);
|
|
1506
|
+
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 }));
|
|
1507
|
+
};
|
|
1508
|
+
|
|
1509
|
+
// src/Components/BarChart.tsx
|
|
1510
|
+
var import_react36 = __toESM(require("react"));
|
|
1511
|
+
var import_react_chartjs_24 = require("react-chartjs-2");
|
|
1512
|
+
var import_chart4 = require("chart.js");
|
|
1513
|
+
import_chart4.Chart.register(import_chart4.BarElement, import_chart4.CategoryScale, import_chart4.LinearScale, import_chart4.Tooltip);
|
|
1514
|
+
var BarChart = (props) => {
|
|
1515
|
+
const data = {
|
|
1516
|
+
labels: [
|
|
1517
|
+
"17 June",
|
|
1518
|
+
"18 June",
|
|
1519
|
+
"19 June",
|
|
1520
|
+
"20 June",
|
|
1521
|
+
"21 June",
|
|
1522
|
+
"22 June",
|
|
1523
|
+
"23 June"
|
|
1524
|
+
],
|
|
1525
|
+
datasets: [
|
|
1526
|
+
{
|
|
1527
|
+
data: [30, 100, 270, 140, 120, 240],
|
|
1528
|
+
backgroundColor: "#1565C0",
|
|
1529
|
+
barThickness: 15
|
|
1530
|
+
}
|
|
1531
|
+
]
|
|
1532
|
+
};
|
|
1533
|
+
const options = {
|
|
1534
|
+
responsive: true,
|
|
1535
|
+
scales: {
|
|
1536
|
+
x: {
|
|
1537
|
+
beginAtZero: true,
|
|
1538
|
+
grid: {
|
|
1539
|
+
display: false
|
|
1540
|
+
}
|
|
1541
|
+
},
|
|
1542
|
+
y: {
|
|
1543
|
+
grid: {
|
|
1544
|
+
display: true
|
|
1545
|
+
},
|
|
1546
|
+
ticks: {
|
|
1547
|
+
min: 0,
|
|
1548
|
+
max: 400,
|
|
1549
|
+
stepSize: 200,
|
|
1550
|
+
callback: function(value) {
|
|
1551
|
+
return `${value}`;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
},
|
|
1556
|
+
plugins: {
|
|
1557
|
+
tooltip: {
|
|
1558
|
+
enabled: true,
|
|
1559
|
+
callbacks: {
|
|
1560
|
+
label: function(context) {
|
|
1561
|
+
const label = context.label || "";
|
|
1562
|
+
const value = context.raw || 0;
|
|
1563
|
+
return ` ${label}: ${value}`;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
},
|
|
1567
|
+
legend: {
|
|
1568
|
+
display: false
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
};
|
|
1572
|
+
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 }));
|
|
1573
|
+
};
|
|
922
1574
|
// Annotate the CommonJS export names for ESM import in node:
|
|
923
1575
|
0 && (module.exports = {
|
|
924
1576
|
AddMoreTable,
|
|
1577
|
+
BarChart,
|
|
925
1578
|
ButtonElement,
|
|
926
1579
|
CheckboxElement,
|
|
1580
|
+
CircleDonut,
|
|
927
1581
|
CkEditor,
|
|
928
1582
|
DatePickerElement,
|
|
929
1583
|
DateRangePickerElement,
|
|
1584
|
+
DoubleBarChart,
|
|
930
1585
|
DropDownGroup,
|
|
931
1586
|
FileUpload,
|
|
1587
|
+
HorizontalBarChart,
|
|
932
1588
|
Image,
|
|
1589
|
+
LineChart,
|
|
933
1590
|
MultipleSelectElement,
|
|
934
1591
|
Navbar,
|
|
935
1592
|
NumberElement,
|
|
1593
|
+
OtpElement,
|
|
936
1594
|
PasswordElement,
|
|
937
1595
|
RadioElement,
|
|
938
1596
|
SelectElement,
|
|
1597
|
+
SemiCircleDonut,
|
|
939
1598
|
Sidebar,
|
|
940
1599
|
SingleCheckbox,
|
|
941
1600
|
SingleSelectElement,
|
|
@@ -943,5 +1602,6 @@ var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(i
|
|
|
943
1602
|
TableElement,
|
|
944
1603
|
TabsElement,
|
|
945
1604
|
TextElement,
|
|
946
|
-
TextareaElement
|
|
1605
|
+
TextareaElement,
|
|
1606
|
+
Upload
|
|
947
1607
|
});
|