@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.mjs
CHANGED
|
@@ -13,6 +13,7 @@ var TextElement = (props) => {
|
|
|
13
13
|
placeholder: props.placeholder,
|
|
14
14
|
allowClear: true,
|
|
15
15
|
id: props.name,
|
|
16
|
+
value: props.value,
|
|
16
17
|
prefix: props.prefix,
|
|
17
18
|
type: props.type,
|
|
18
19
|
status: props.status,
|
|
@@ -72,8 +73,7 @@ var NumberElement = (props) => {
|
|
|
72
73
|
{
|
|
73
74
|
placeholder: props.placeholder,
|
|
74
75
|
addonBefore: props.addonBefore,
|
|
75
|
-
|
|
76
|
-
defaultValue: props.defaultValue,
|
|
76
|
+
value: props.value,
|
|
77
77
|
disabled: props.disabled,
|
|
78
78
|
id: props.name,
|
|
79
79
|
prefix: props.prefix,
|
|
@@ -321,11 +321,14 @@ var ButtonElement = (props) => {
|
|
|
321
321
|
return /* @__PURE__ */ React11.createElement(
|
|
322
322
|
"button",
|
|
323
323
|
{
|
|
324
|
-
onClick:
|
|
325
|
-
className: `${props.className ? props.className : ""}
|
|
324
|
+
onClick: props.onClick,
|
|
325
|
+
className: `${props.className ? props.className : ""}`,
|
|
326
|
+
disabled: props.loading,
|
|
327
|
+
style: {
|
|
328
|
+
cursor: props.loading ? "no-drop" : "pointer"
|
|
329
|
+
}
|
|
326
330
|
},
|
|
327
|
-
|
|
328
|
-
props.label
|
|
331
|
+
/* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("span", { className: props.iconsClassName }, /* @__PURE__ */ React11.createElement("img", { src: props.icon, className: "icon-active" })), props.label)
|
|
329
332
|
);
|
|
330
333
|
};
|
|
331
334
|
|
|
@@ -467,10 +470,19 @@ var Sidebar = (props) => {
|
|
|
467
470
|
props.onChange(item);
|
|
468
471
|
}
|
|
469
472
|
};
|
|
470
|
-
return /* @__PURE__ */ React13.createElement(
|
|
471
|
-
return /* @__PURE__ */ React13.createElement(
|
|
472
|
-
|
|
473
|
-
|
|
473
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, { key: props.name }, /* @__PURE__ */ React13.createElement("div", { className: props.imgClassName }, /* @__PURE__ */ React13.createElement("img", { src: props.img, alt: "logo" })), /* @__PURE__ */ React13.createElement("div", { className: props.listClassName }, props.items?.map((item) => {
|
|
474
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, { key: item.label }, /* @__PURE__ */ React13.createElement(
|
|
475
|
+
ButtonElement,
|
|
476
|
+
{
|
|
477
|
+
...item,
|
|
478
|
+
className: item.active ? props.activeClassName : props.className,
|
|
479
|
+
iconsClassName: props.iconsClassName,
|
|
480
|
+
onClick: (e) => {
|
|
481
|
+
e.preventDefault();
|
|
482
|
+
handleChange(item);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
));
|
|
474
486
|
})));
|
|
475
487
|
};
|
|
476
488
|
|
|
@@ -535,7 +547,7 @@ var Navbar = (props) => {
|
|
|
535
547
|
};
|
|
536
548
|
|
|
537
549
|
// src/Components/TableElement.tsx
|
|
538
|
-
import React20, { useState as useState5 } from "react";
|
|
550
|
+
import React20, { useState as useState5, useEffect as useEffect2 } from "react";
|
|
539
551
|
import { Table as Table2 } from "antd";
|
|
540
552
|
|
|
541
553
|
// src/Components/Model.tsx
|
|
@@ -544,18 +556,48 @@ import { Modal } from "antd";
|
|
|
544
556
|
|
|
545
557
|
// src/Components/ModelBody.tsx
|
|
546
558
|
import React18 from "react";
|
|
559
|
+
import moment from "moment";
|
|
547
560
|
var ModelBody = (props) => {
|
|
548
|
-
return /* @__PURE__ */ React18.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
561
|
+
return /* @__PURE__ */ React18.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
562
|
+
(eachField) => {
|
|
563
|
+
if (eachField.element === "div") {
|
|
564
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, eachField.label), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
565
|
+
"p",
|
|
566
|
+
{
|
|
567
|
+
style: {
|
|
568
|
+
fontSize: "10px",
|
|
569
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
moment(eachField.dateTime).format("LT")
|
|
573
|
+
) : "");
|
|
574
|
+
} else if (eachField.element === "input-radio") {
|
|
575
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, /* @__PURE__ */ React18.createElement(RadioElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
576
|
+
"p",
|
|
577
|
+
{
|
|
578
|
+
style: {
|
|
579
|
+
fontSize: "10px",
|
|
580
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
moment(eachField.dateTime).format("LT")
|
|
584
|
+
) : "");
|
|
585
|
+
} else if (eachField.element === "button") {
|
|
586
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, /* @__PURE__ */ React18.createElement(ButtonElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
587
|
+
"p",
|
|
588
|
+
{
|
|
589
|
+
style: {
|
|
590
|
+
fontSize: "10px",
|
|
591
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
592
|
+
}
|
|
593
|
+
},
|
|
594
|
+
moment(eachField.dateTime).format("LT")
|
|
595
|
+
) : "");
|
|
596
|
+
} else {
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
557
599
|
}
|
|
558
|
-
|
|
600
|
+
));
|
|
559
601
|
};
|
|
560
602
|
|
|
561
603
|
// src/Components/Model.tsx
|
|
@@ -580,9 +622,22 @@ var ModelElement = (props) => {
|
|
|
580
622
|
margin: "-10px"
|
|
581
623
|
}
|
|
582
624
|
},
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
625
|
+
columns.map((eachColumn) => {
|
|
626
|
+
if (!["index", "View"].includes(eachColumn.key) && eachColumn?.["is_detail"] !== false) {
|
|
627
|
+
return /* @__PURE__ */ React19.createElement("p", { style: { fontWeight: "500", padding: "10px" } }, /* @__PURE__ */ React19.createElement(
|
|
628
|
+
"span",
|
|
629
|
+
{
|
|
630
|
+
style: {
|
|
631
|
+
fontWeight: "200",
|
|
632
|
+
color: "gray",
|
|
633
|
+
paddingRight: "10px"
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
eachColumn.title
|
|
637
|
+
), selectedRecord[eachColumn.key] !== "" ? selectedRecord[eachColumn.key] : "--");
|
|
638
|
+
} else {
|
|
639
|
+
return null;
|
|
640
|
+
}
|
|
586
641
|
})
|
|
587
642
|
)
|
|
588
643
|
},
|
|
@@ -591,13 +646,24 @@ var ModelElement = (props) => {
|
|
|
591
646
|
};
|
|
592
647
|
|
|
593
648
|
// src/Components/TableElement.tsx
|
|
649
|
+
import { EyeOutlined } from "@ant-design/icons";
|
|
594
650
|
var TableElement = (props) => {
|
|
595
651
|
const { thead, tbody } = props;
|
|
596
652
|
const [selectedRecord, setSelectedRecord] = useState5({});
|
|
597
653
|
const [model, setModel] = useState5(false);
|
|
598
|
-
const [
|
|
654
|
+
const [dataSource, setDataSource] = useState5([]);
|
|
655
|
+
useEffect2(() => {
|
|
656
|
+
if (tbody) {
|
|
657
|
+
setDataSource(
|
|
658
|
+
tbody.map((row, index) => ({
|
|
659
|
+
...row,
|
|
660
|
+
key: index,
|
|
661
|
+
index: index + 1
|
|
662
|
+
}))
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
}, [tbody]);
|
|
599
666
|
const handleChange = (record) => {
|
|
600
|
-
console.log("record", record);
|
|
601
667
|
if (props.onChange) {
|
|
602
668
|
props.onChange(record);
|
|
603
669
|
}
|
|
@@ -607,105 +673,151 @@ var TableElement = (props) => {
|
|
|
607
673
|
columns = [
|
|
608
674
|
{
|
|
609
675
|
title: "#",
|
|
610
|
-
dataIndex: "
|
|
611
|
-
key: "
|
|
676
|
+
dataIndex: "index",
|
|
677
|
+
key: "index",
|
|
678
|
+
fixed: "left"
|
|
612
679
|
},
|
|
613
680
|
...thead.map((col, ind) => ({
|
|
614
681
|
title: col.label,
|
|
615
682
|
dataIndex: col.name,
|
|
616
683
|
key: col.key,
|
|
684
|
+
ellipsis: col.ellipsis,
|
|
617
685
|
render: col.render,
|
|
618
686
|
sorter: {
|
|
619
687
|
compare: (a, b) => {
|
|
620
|
-
if (typeof a[col.key] === "number" && typeof
|
|
688
|
+
if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
|
|
621
689
|
return a[col.key] - b[col.key];
|
|
622
|
-
} else if (typeof a[col.key] === "string" && typeof
|
|
690
|
+
} else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
|
|
623
691
|
return a[col.key].localeCompare(b[col.key]);
|
|
624
692
|
}
|
|
625
693
|
}
|
|
626
694
|
}
|
|
627
|
-
}))
|
|
628
|
-
|
|
695
|
+
}))
|
|
696
|
+
];
|
|
697
|
+
if (props.view) {
|
|
698
|
+
columns.push({
|
|
629
699
|
title: "View",
|
|
630
700
|
dataIndex: "View",
|
|
631
701
|
key: "View",
|
|
632
|
-
render: (_, record) =>
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
702
|
+
render: (_, record) => {
|
|
703
|
+
return /* @__PURE__ */ React20.createElement(
|
|
704
|
+
"a",
|
|
705
|
+
{
|
|
706
|
+
onClick: () => {
|
|
707
|
+
if (props.view) {
|
|
708
|
+
setSelectedRecord(record);
|
|
709
|
+
handleChange(record);
|
|
710
|
+
setModel(true);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
/* @__PURE__ */ React20.createElement(EyeOutlined, null)
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
}
|
|
645
719
|
}
|
|
646
|
-
const
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
720
|
+
const onChangeTable = (pagination, filters, sorter, extra) => {
|
|
721
|
+
if (extra && extra.currentDataSource) {
|
|
722
|
+
setDataSource(
|
|
723
|
+
extra.currentDataSource.map((row, index) => ({
|
|
724
|
+
...row,
|
|
725
|
+
index: index + 1
|
|
726
|
+
}))
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
};
|
|
651
730
|
const onChangePage = (page, pageSize) => {
|
|
652
731
|
if (props.onChange) {
|
|
653
732
|
props.onChange({ name: "pagination", page, pageSize });
|
|
654
733
|
}
|
|
655
734
|
};
|
|
656
|
-
const onSelectChange = (newSelectedRowKeys) => {
|
|
657
|
-
console.log("selectedRowKeys changed: ", newSelectedRowKeys);
|
|
658
|
-
setSelectedRowKeys(newSelectedRowKeys);
|
|
659
|
-
};
|
|
660
735
|
const rowSelectionConfig = props.rowSelection ? {
|
|
661
|
-
selectedRowKeys,
|
|
662
|
-
|
|
736
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
737
|
+
console.log(
|
|
738
|
+
`selectedRowKeys: ${selectedRowKeys}`,
|
|
739
|
+
"selectedRows: ",
|
|
740
|
+
selectedRows
|
|
741
|
+
);
|
|
742
|
+
if (props.onChange) {
|
|
743
|
+
props.onChange(selectedRows);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
663
746
|
} : void 0;
|
|
664
747
|
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
|
|
665
748
|
Table2,
|
|
666
749
|
{
|
|
667
|
-
|
|
750
|
+
className: props.className,
|
|
751
|
+
pagination: props.pagination ? {
|
|
668
752
|
showTotal: (total) => `Total: ${total} items`,
|
|
669
|
-
total: count,
|
|
670
|
-
showSizeChanger: count > 10,
|
|
753
|
+
total: props.count,
|
|
754
|
+
showSizeChanger: props.count ? props.count > 10 : 0 > 10,
|
|
671
755
|
onChange: onChangePage
|
|
756
|
+
} : false,
|
|
757
|
+
onRow: (record) => {
|
|
758
|
+
return {
|
|
759
|
+
onClick: () => {
|
|
760
|
+
if (props.view) {
|
|
761
|
+
setSelectedRecord(record);
|
|
762
|
+
handleChange(record);
|
|
763
|
+
setModel(true);
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
style: { cursor: "pointer" }
|
|
767
|
+
};
|
|
672
768
|
},
|
|
769
|
+
rowSelection: rowSelectionConfig,
|
|
673
770
|
dataSource,
|
|
674
771
|
columns,
|
|
772
|
+
size: props.size,
|
|
675
773
|
bordered: true,
|
|
676
|
-
|
|
677
|
-
|
|
774
|
+
onChange: onChangeTable
|
|
775
|
+
}
|
|
776
|
+
), model && /* @__PURE__ */ React20.createElement(
|
|
777
|
+
ModelElement,
|
|
778
|
+
{
|
|
779
|
+
selectedRecord,
|
|
780
|
+
...props,
|
|
781
|
+
columns,
|
|
782
|
+
model,
|
|
783
|
+
onCancel: () => setModel(false)
|
|
678
784
|
}
|
|
679
|
-
)
|
|
785
|
+
));
|
|
680
786
|
};
|
|
681
787
|
|
|
682
788
|
// src/Components/DatePicker.tsx
|
|
683
789
|
import React21, { useState as useState6 } from "react";
|
|
684
790
|
import { DatePicker } from "antd";
|
|
791
|
+
import dayjs from "dayjs";
|
|
792
|
+
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
793
|
+
import moment2 from "moment";
|
|
794
|
+
dayjs.extend(customParseFormat);
|
|
685
795
|
var DatePickerElement = (props) => {
|
|
686
|
-
const [
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
const formattedDate = date2.format(dateFormat);
|
|
692
|
-
setDate(date2);
|
|
796
|
+
const [dateState, setDateState] = useState6("");
|
|
797
|
+
const handleChange = (date, dateString) => {
|
|
798
|
+
if (date) {
|
|
799
|
+
const formattedDate = dateString;
|
|
800
|
+
setDateState(date);
|
|
693
801
|
if (props.onChange) {
|
|
694
802
|
props.onChange(formattedDate);
|
|
695
803
|
}
|
|
696
804
|
} else {
|
|
697
|
-
|
|
805
|
+
setDateState("");
|
|
698
806
|
if (props.onChange) {
|
|
699
807
|
props.onChange("");
|
|
700
808
|
}
|
|
701
809
|
}
|
|
702
810
|
};
|
|
811
|
+
const disabledDate = (current) => {
|
|
812
|
+
return current && current > moment2();
|
|
813
|
+
};
|
|
703
814
|
return /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement(
|
|
704
815
|
DatePicker,
|
|
705
816
|
{
|
|
817
|
+
disabledDate,
|
|
706
818
|
placeholder: props.placeholder,
|
|
707
|
-
value:
|
|
708
|
-
|
|
819
|
+
value: dateState,
|
|
820
|
+
format: { format: "DD-MM-YYYY" },
|
|
709
821
|
onChange: handleChange
|
|
710
822
|
}
|
|
711
823
|
));
|
|
@@ -714,29 +826,43 @@ var DatePickerElement = (props) => {
|
|
|
714
826
|
// src/Components/DateRangePickerElement.tsx
|
|
715
827
|
import React22 from "react";
|
|
716
828
|
import { DatePicker as DatePicker2, Space } from "antd";
|
|
717
|
-
import
|
|
829
|
+
import dayjs2 from "dayjs";
|
|
830
|
+
import moment3 from "moment";
|
|
718
831
|
var DateRangePickerElement = (props) => {
|
|
832
|
+
const { value } = props;
|
|
719
833
|
const { RangePicker } = DatePicker2;
|
|
720
834
|
const handleChange = (dates, dateStrings) => {
|
|
721
|
-
if (dates
|
|
722
|
-
|
|
835
|
+
if (dates) {
|
|
836
|
+
const formattedDate = moment3(dateStrings).format("DD-MM-YYYY");
|
|
837
|
+
props.onChange && props.onChange(formattedDate);
|
|
723
838
|
} else {
|
|
724
|
-
|
|
839
|
+
props.onChange && props.onChange("");
|
|
725
840
|
}
|
|
726
841
|
};
|
|
727
842
|
const rangePresets = [
|
|
728
|
-
{ label: "Last 7 Days", value: [
|
|
729
|
-
{ label: "Last 14 Days", value: [
|
|
730
|
-
{ label: "Last 30 Days", value: [
|
|
731
|
-
{ label: "Last 90 Days", value: [
|
|
843
|
+
{ label: "Last 7 Days", value: [dayjs2().add(-7, "d"), dayjs2()] },
|
|
844
|
+
{ label: "Last 14 Days", value: [dayjs2().add(-14, "d"), dayjs2()] },
|
|
845
|
+
{ label: "Last 30 Days", value: [dayjs2().add(-30, "d"), dayjs2()] },
|
|
846
|
+
{ label: "Last 90 Days", value: [dayjs2().add(-90, "d"), dayjs2()] }
|
|
732
847
|
];
|
|
733
|
-
|
|
848
|
+
const disabledDate = (current) => {
|
|
849
|
+
return current && current > moment3();
|
|
850
|
+
};
|
|
851
|
+
return /* @__PURE__ */ React22.createElement(Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ React22.createElement(
|
|
852
|
+
RangePicker,
|
|
853
|
+
{
|
|
854
|
+
disabledDate,
|
|
855
|
+
presets: rangePresets,
|
|
856
|
+
onChange: handleChange,
|
|
857
|
+
value: value && [dayjs2(value[0].format("DD-MM-YYYY")), dayjs2(value[1].format("DD-MM-YYYY"))]
|
|
858
|
+
}
|
|
859
|
+
));
|
|
734
860
|
};
|
|
735
861
|
|
|
736
862
|
// src/Components/Image.tsx
|
|
737
863
|
import React23 from "react";
|
|
738
864
|
var Image = (props) => {
|
|
739
|
-
return /* @__PURE__ */ React23.createElement("
|
|
865
|
+
return /* @__PURE__ */ React23.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
740
866
|
};
|
|
741
867
|
|
|
742
868
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -755,60 +881,64 @@ var SingleCheckbox = (props) => {
|
|
|
755
881
|
import React25, { useState as useState7 } from "react";
|
|
756
882
|
import { Select as Select4 } from "antd";
|
|
757
883
|
var DropDownGroup = (props) => {
|
|
758
|
-
const [selectedValue, setSelectedValue] = useState7({
|
|
884
|
+
const [selectedValue, setSelectedValue] = useState7({
|
|
885
|
+
firstValue: {},
|
|
886
|
+
secondValue: {},
|
|
887
|
+
temp: ""
|
|
888
|
+
});
|
|
759
889
|
const handleFirstChange = (value) => {
|
|
760
|
-
|
|
890
|
+
console.log(selectedValue.temp);
|
|
891
|
+
const filterOption2 = props.firstOptions?.find(
|
|
892
|
+
(eachOption) => eachOption.value === value
|
|
893
|
+
);
|
|
761
894
|
setSelectedValue((prev) => {
|
|
762
895
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
896
|
+
const { temp, ...rest } = newValue;
|
|
763
897
|
if (newValue.firstValue) {
|
|
764
|
-
props.onChange?.(
|
|
898
|
+
props.onChange?.(rest);
|
|
765
899
|
}
|
|
766
|
-
return
|
|
900
|
+
return newValue;
|
|
767
901
|
});
|
|
768
902
|
};
|
|
769
903
|
const handleSecondChange = (value) => {
|
|
770
|
-
const filterOption2 = props.secondOptions?.find(
|
|
904
|
+
const filterOption2 = props.secondOptions?.find(
|
|
905
|
+
(eachOption) => eachOption.value === value
|
|
906
|
+
);
|
|
771
907
|
setSelectedValue((prev) => {
|
|
772
908
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
909
|
+
const { temp, ...rest } = newValue;
|
|
773
910
|
if (newValue.secondValue) {
|
|
774
|
-
props.onChange?.(
|
|
911
|
+
props.onChange?.(rest);
|
|
775
912
|
}
|
|
776
|
-
return
|
|
913
|
+
return newValue;
|
|
777
914
|
});
|
|
778
915
|
};
|
|
779
|
-
|
|
780
|
-
return /* @__PURE__ */ React25.createElement("div", { className: props.className, style: { display: "flex", flexDirection: "row", backgroundColor: "white", borderRadius: 10, border: "1px solid gray" } }, /* @__PURE__ */ React25.createElement(
|
|
916
|
+
return /* @__PURE__ */ React25.createElement("div", { className: props.containerClassName }, props.label && /* @__PURE__ */ React25.createElement("label", { htmlFor: props.name, className: props.labelClassName }, props.label), /* @__PURE__ */ React25.createElement("div", { className: props.subContainerClassName }, /* @__PURE__ */ React25.createElement(
|
|
781
917
|
Select4,
|
|
782
918
|
{
|
|
783
919
|
onChange: handleFirstChange,
|
|
784
920
|
variant: props.variant,
|
|
785
|
-
options: props.firstOptions
|
|
921
|
+
options: props.firstOptions,
|
|
922
|
+
className: props.className
|
|
786
923
|
}
|
|
787
924
|
), /* @__PURE__ */ React25.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ React25.createElement(
|
|
788
925
|
Select4,
|
|
789
926
|
{
|
|
790
927
|
onChange: handleSecondChange,
|
|
791
928
|
variant: props.variant,
|
|
792
|
-
options: props.secondOptions
|
|
929
|
+
options: props.secondOptions,
|
|
930
|
+
className: props.className
|
|
793
931
|
}
|
|
794
|
-
));
|
|
932
|
+
)));
|
|
795
933
|
};
|
|
796
934
|
|
|
797
935
|
// src/Components/FilesUpload.tsx
|
|
798
936
|
import React26, { useState as useState8 } from "react";
|
|
799
|
-
import { Upload
|
|
937
|
+
import { Upload } from "antd";
|
|
800
938
|
import { InboxOutlined } from "@ant-design/icons";
|
|
801
939
|
var FileUpload = (props) => {
|
|
802
940
|
const { Dragger } = Upload;
|
|
803
941
|
const [files, setFiles] = useState8([]);
|
|
804
|
-
const beforeUpload = (file) => {
|
|
805
|
-
const isCorrectFile = ["image/*", "video/*", "application/*"].includes(file.type);
|
|
806
|
-
if (!isCorrectFile) {
|
|
807
|
-
message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
808
|
-
return Upload.LIST_IGNORE;
|
|
809
|
-
}
|
|
810
|
-
return true;
|
|
811
|
-
};
|
|
812
942
|
const handleChange = ({ fileList }) => {
|
|
813
943
|
setFiles(fileList);
|
|
814
944
|
if (props.onChange) {
|
|
@@ -832,7 +962,6 @@ var FileUpload = (props) => {
|
|
|
832
962
|
maxCount: props.max_count,
|
|
833
963
|
multiple: props.multiple,
|
|
834
964
|
fileList: files,
|
|
835
|
-
beforeUpload,
|
|
836
965
|
onChange: handleChange,
|
|
837
966
|
showUploadList: true,
|
|
838
967
|
customRequest
|
|
@@ -861,22 +990,569 @@ var onChange = (checked) => {
|
|
|
861
990
|
console.log(`switch to ${checked}`);
|
|
862
991
|
};
|
|
863
992
|
var SwitchElement = () => /* @__PURE__ */ React28.createElement(Switch, { defaultChecked: true, onChange });
|
|
993
|
+
|
|
994
|
+
// src/Components/Upload.tsx
|
|
995
|
+
import React29, { useState as useState9 } from "react";
|
|
996
|
+
var Upload2 = (props) => {
|
|
997
|
+
const [file, setFile] = useState9();
|
|
998
|
+
const handleFileChange = (e) => {
|
|
999
|
+
setFile(e.target.files[0]);
|
|
1000
|
+
if (props.onChange) {
|
|
1001
|
+
props.onChange(e.target.files[0]);
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
const handleUpload = async () => {
|
|
1005
|
+
if (!file) {
|
|
1006
|
+
console.error("No file selected");
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
return /* @__PURE__ */ React29.createElement("div", { style: { marginTop: 16 } }, /* @__PURE__ */ React29.createElement("input", { type: "file", onChange: handleFileChange }), /* @__PURE__ */ React29.createElement(
|
|
1011
|
+
"button",
|
|
1012
|
+
{
|
|
1013
|
+
type: "button",
|
|
1014
|
+
onClick: handleUpload,
|
|
1015
|
+
disabled: !file,
|
|
1016
|
+
style: { marginTop: 16 }
|
|
1017
|
+
},
|
|
1018
|
+
"Upload"
|
|
1019
|
+
));
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
// src/Components/OtpElement.tsx
|
|
1023
|
+
import React30, { useState as useState10, useRef, useEffect as useEffect3 } from "react";
|
|
1024
|
+
import { Input as Input3 } from "antd";
|
|
1025
|
+
var OtpElement = (props) => {
|
|
1026
|
+
const length = props.length;
|
|
1027
|
+
const [otp, setOtp] = useState10(Array(length).fill(""));
|
|
1028
|
+
const inputRefs = useRef([]);
|
|
1029
|
+
const handleChange = (e, index) => {
|
|
1030
|
+
const value = e.target.value;
|
|
1031
|
+
if (/^[0-9]$/.test(value) || value === "") {
|
|
1032
|
+
const newOtp = [...otp];
|
|
1033
|
+
newOtp[index] = value;
|
|
1034
|
+
setOtp(newOtp);
|
|
1035
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1036
|
+
if (value && index < length - 1) {
|
|
1037
|
+
inputRefs.current[index + 1]?.focus();
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
const handleKeyDown = (e, index) => {
|
|
1042
|
+
if (e.key === "Backspace" && !otp[index] && index > 0) {
|
|
1043
|
+
inputRefs.current[index - 1]?.focus();
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
const handlePaste = (e) => {
|
|
1047
|
+
e.preventDefault();
|
|
1048
|
+
const pasteData = e.clipboardData.getData("text");
|
|
1049
|
+
if (/^\d+$/.test(pasteData)) {
|
|
1050
|
+
const newOtp = pasteData.split("").slice(0, length);
|
|
1051
|
+
setOtp(newOtp.concat(Array(length - newOtp.length).fill("")));
|
|
1052
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1053
|
+
newOtp.forEach((_, idx) => {
|
|
1054
|
+
if (inputRefs.current[idx]) {
|
|
1055
|
+
inputRefs.current[idx]?.focus();
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
useEffect3(() => {
|
|
1061
|
+
inputRefs.current[0]?.focus();
|
|
1062
|
+
}, []);
|
|
1063
|
+
return /* @__PURE__ */ React30.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ React30.createElement(
|
|
1064
|
+
Input3,
|
|
1065
|
+
{
|
|
1066
|
+
key: index,
|
|
1067
|
+
className: props.className,
|
|
1068
|
+
maxLength: 1,
|
|
1069
|
+
value: otp[index],
|
|
1070
|
+
onChange: (e) => handleChange(e, index),
|
|
1071
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
1072
|
+
onPaste: handlePaste,
|
|
1073
|
+
ref: (el) => inputRefs.current[index] = el
|
|
1074
|
+
}
|
|
1075
|
+
)));
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1078
|
+
// src/Components/CircleDonut.tsx
|
|
1079
|
+
import React31 from "react";
|
|
1080
|
+
import { Doughnut } from "react-chartjs-2";
|
|
1081
|
+
import {
|
|
1082
|
+
Chart as ChartJS,
|
|
1083
|
+
DoughnutController,
|
|
1084
|
+
ArcElement,
|
|
1085
|
+
Tooltip,
|
|
1086
|
+
Legend
|
|
1087
|
+
} from "chart.js";
|
|
1088
|
+
ChartJS.register(DoughnutController, ArcElement, Tooltip, Legend);
|
|
1089
|
+
var CircleDonut = (props) => {
|
|
1090
|
+
const data = {
|
|
1091
|
+
labels: props.labels,
|
|
1092
|
+
datasets: [
|
|
1093
|
+
{
|
|
1094
|
+
label: "Bot Conversation",
|
|
1095
|
+
data: props.data,
|
|
1096
|
+
backgroundColor: [
|
|
1097
|
+
"#FFCB8A",
|
|
1098
|
+
"#CADBBF",
|
|
1099
|
+
"#8AC1BB",
|
|
1100
|
+
"#FCB0CB",
|
|
1101
|
+
"#CEB0FA"
|
|
1102
|
+
],
|
|
1103
|
+
borderWidth: 0
|
|
1104
|
+
}
|
|
1105
|
+
]
|
|
1106
|
+
};
|
|
1107
|
+
const options = {
|
|
1108
|
+
responsive: true,
|
|
1109
|
+
cutout: "80%",
|
|
1110
|
+
plugins: {
|
|
1111
|
+
legend: {
|
|
1112
|
+
position: "left",
|
|
1113
|
+
labels: {
|
|
1114
|
+
font: {
|
|
1115
|
+
size: 10
|
|
1116
|
+
},
|
|
1117
|
+
boxWidth: 15,
|
|
1118
|
+
generateLabels: (chart) => {
|
|
1119
|
+
const dataset = chart.data.datasets[0];
|
|
1120
|
+
return chart.data.labels.map((label, index) => {
|
|
1121
|
+
const value = dataset.data[index];
|
|
1122
|
+
return {
|
|
1123
|
+
text: `${label}: ${value}`,
|
|
1124
|
+
fillStyle: dataset.backgroundColor[index]
|
|
1125
|
+
};
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
tooltip: {
|
|
1131
|
+
enabled: true,
|
|
1132
|
+
callbacks: {
|
|
1133
|
+
label: function(context) {
|
|
1134
|
+
const label = context.label || "";
|
|
1135
|
+
const value = context.raw || 0;
|
|
1136
|
+
return `${label}: ${value}`;
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
const centerTextPlugin = {
|
|
1143
|
+
id: "centerText",
|
|
1144
|
+
beforeDraw: (chart) => {
|
|
1145
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1146
|
+
const width = right - left;
|
|
1147
|
+
const height = bottom - top;
|
|
1148
|
+
const centerX = left + width / 2;
|
|
1149
|
+
const centerY = top + height / 2;
|
|
1150
|
+
ctx.save();
|
|
1151
|
+
ctx.font = "7px Arial";
|
|
1152
|
+
ctx.fillStyle = "blue";
|
|
1153
|
+
ctx.textAlign = "center";
|
|
1154
|
+
ctx.textBaseline = "middle";
|
|
1155
|
+
ctx.fillText("Total Sessions", centerX, centerY - 10);
|
|
1156
|
+
ctx.font = "25px Arial";
|
|
1157
|
+
ctx.fillStyle = "black";
|
|
1158
|
+
ctx.fillText("85", centerX, centerY + 20);
|
|
1159
|
+
ctx.restore();
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
return /* @__PURE__ */ React31.createElement("div", { className: props.className }, /* @__PURE__ */ React31.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React31.createElement(Doughnut, { data, options, plugins: [centerTextPlugin] }));
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1165
|
+
// src/Components/SemiCircleDonut.tsx
|
|
1166
|
+
import React32 from "react";
|
|
1167
|
+
import { Doughnut as Doughnut2 } from "react-chartjs-2";
|
|
1168
|
+
import {
|
|
1169
|
+
Chart as ChartJS2,
|
|
1170
|
+
DoughnutController as DoughnutController2,
|
|
1171
|
+
ArcElement as ArcElement2,
|
|
1172
|
+
Tooltip as Tooltip2,
|
|
1173
|
+
Legend as Legend2
|
|
1174
|
+
} from "chart.js";
|
|
1175
|
+
ChartJS2.register(DoughnutController2, ArcElement2, Tooltip2, Legend2);
|
|
1176
|
+
var SemiCircleDonut = (props) => {
|
|
1177
|
+
const data = {
|
|
1178
|
+
labels: [
|
|
1179
|
+
"Registration",
|
|
1180
|
+
"Book Appointment",
|
|
1181
|
+
"Diagnostic Tests",
|
|
1182
|
+
"Hospital Facility",
|
|
1183
|
+
"Others, Prescriptions"
|
|
1184
|
+
],
|
|
1185
|
+
datasets: [
|
|
1186
|
+
{
|
|
1187
|
+
label: "Bot Conversation",
|
|
1188
|
+
data: [30, 10, 27, 40, 12],
|
|
1189
|
+
backgroundColor: [
|
|
1190
|
+
"#FFCB8A",
|
|
1191
|
+
"#CADBBF",
|
|
1192
|
+
"#8AC1BB",
|
|
1193
|
+
"#FCB0CB",
|
|
1194
|
+
"#CEB0FA"
|
|
1195
|
+
],
|
|
1196
|
+
borderWidth: 0
|
|
1197
|
+
}
|
|
1198
|
+
]
|
|
1199
|
+
};
|
|
1200
|
+
const options = {
|
|
1201
|
+
responsive: true,
|
|
1202
|
+
circumference: 180,
|
|
1203
|
+
rotation: -90,
|
|
1204
|
+
cutout: "80%",
|
|
1205
|
+
plugins: {
|
|
1206
|
+
legend: {
|
|
1207
|
+
display: false
|
|
1208
|
+
// Disable the legend
|
|
1209
|
+
},
|
|
1210
|
+
tooltip: {
|
|
1211
|
+
enabled: true,
|
|
1212
|
+
callbacks: {
|
|
1213
|
+
label: function(context) {
|
|
1214
|
+
const label = context.label || "";
|
|
1215
|
+
const value = context.raw || 0;
|
|
1216
|
+
return `${label}: ${value}`;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
const centerTextPlugin = {
|
|
1223
|
+
id: "centerText",
|
|
1224
|
+
beforeDraw: (chart) => {
|
|
1225
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1226
|
+
const width = right - left;
|
|
1227
|
+
const height = bottom - top;
|
|
1228
|
+
const centerX = left + width / 2;
|
|
1229
|
+
const centerY = top + height / 1.5;
|
|
1230
|
+
const maxWidth = width * 0.8;
|
|
1231
|
+
ctx.save();
|
|
1232
|
+
ctx.fillStyle = "black";
|
|
1233
|
+
ctx.textAlign = "center";
|
|
1234
|
+
ctx.textBaseline = "middle";
|
|
1235
|
+
const drawText = (text, y, fontSize) => {
|
|
1236
|
+
ctx.font = `${fontSize}px Arial`;
|
|
1237
|
+
const textWidth = ctx.measureText(text).width;
|
|
1238
|
+
if (textWidth > maxWidth) {
|
|
1239
|
+
const newFontSize = fontSize * maxWidth / textWidth;
|
|
1240
|
+
ctx.font = `${newFontSize}px Arial`;
|
|
1241
|
+
}
|
|
1242
|
+
ctx.fillText(text, centerX, y);
|
|
1243
|
+
};
|
|
1244
|
+
drawText(props.fillText1, centerY - 10, 16);
|
|
1245
|
+
drawText(props.fillText2, centerY + 20, 8);
|
|
1246
|
+
ctx.restore();
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
return /* @__PURE__ */ React32.createElement("div", { className: props.className }, /* @__PURE__ */ React32.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React32.createElement(Doughnut2, { data, options, plugins: [centerTextPlugin] }));
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
// src/Components/HorizontalBarChart.tsx
|
|
1253
|
+
import React33 from "react";
|
|
1254
|
+
import { Bar } from "react-chartjs-2";
|
|
1255
|
+
import {
|
|
1256
|
+
Chart as ChartJS3,
|
|
1257
|
+
BarElement,
|
|
1258
|
+
CategoryScale,
|
|
1259
|
+
LinearScale,
|
|
1260
|
+
Tooltip as Tooltip3
|
|
1261
|
+
} from "chart.js";
|
|
1262
|
+
ChartJS3.register(BarElement, CategoryScale, LinearScale, Tooltip3);
|
|
1263
|
+
var HorizontalBarChart = (props) => {
|
|
1264
|
+
const data = {
|
|
1265
|
+
labels: ["18-24", "25-34", "35-44", "45-54", "55-64", "65+"],
|
|
1266
|
+
datasets: [
|
|
1267
|
+
{
|
|
1268
|
+
data: [30, 10, 27, 40, 12, 24],
|
|
1269
|
+
backgroundColor: "#6298D5",
|
|
1270
|
+
barThickness: 15
|
|
1271
|
+
}
|
|
1272
|
+
]
|
|
1273
|
+
};
|
|
1274
|
+
const options = {
|
|
1275
|
+
responsive: true,
|
|
1276
|
+
indexAxis: "y",
|
|
1277
|
+
scales: {
|
|
1278
|
+
x: {
|
|
1279
|
+
beginAtZero: true,
|
|
1280
|
+
ticks: {
|
|
1281
|
+
callback: function(value) {
|
|
1282
|
+
return `${value}%`;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
},
|
|
1286
|
+
y: {
|
|
1287
|
+
grid: {
|
|
1288
|
+
display: false
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
},
|
|
1292
|
+
plugins: {
|
|
1293
|
+
tooltip: {
|
|
1294
|
+
enabled: true,
|
|
1295
|
+
callbacks: {
|
|
1296
|
+
label: function(context) {
|
|
1297
|
+
const label = context.label || "";
|
|
1298
|
+
const value = context.raw || 0;
|
|
1299
|
+
return `${label}: ${value}`;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
},
|
|
1303
|
+
legend: {
|
|
1304
|
+
display: false
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
return /* @__PURE__ */ React33.createElement("div", { className: props.className }, /* @__PURE__ */ React33.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React33.createElement(Bar, { data, options }));
|
|
1309
|
+
};
|
|
1310
|
+
|
|
1311
|
+
// src/Components/LineChart.tsx
|
|
1312
|
+
import React34, { useEffect as useEffect4, useRef as useRef2 } from "react";
|
|
1313
|
+
import Chart from "chart.js/auto";
|
|
1314
|
+
var LineChart = (props) => {
|
|
1315
|
+
const chartRef = useRef2(null);
|
|
1316
|
+
const chartInstance = useRef2(null);
|
|
1317
|
+
const data = [
|
|
1318
|
+
{ label: "ROI", data: [10, 13, 20, 15, 10] },
|
|
1319
|
+
{ label: "Engagement Rate", data: [20, 23, 30, 28, 20] },
|
|
1320
|
+
{ label: "Conversion Rate", data: [50, 100, 150, 180, 50] }
|
|
1321
|
+
];
|
|
1322
|
+
const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
|
|
1323
|
+
useEffect4(() => {
|
|
1324
|
+
if (chartRef.current) {
|
|
1325
|
+
if (chartInstance.current) {
|
|
1326
|
+
chartInstance.current.destroy();
|
|
1327
|
+
}
|
|
1328
|
+
chartInstance.current = new Chart(chartRef.current, {
|
|
1329
|
+
type: "line",
|
|
1330
|
+
data: {
|
|
1331
|
+
labels,
|
|
1332
|
+
datasets: data.map((dataset, index) => ({
|
|
1333
|
+
label: dataset.label,
|
|
1334
|
+
data: dataset.data,
|
|
1335
|
+
borderColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1336
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
1337
|
+
pointBackgroundColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1338
|
+
pointBorderColor: "white",
|
|
1339
|
+
pointStyle: "circle",
|
|
1340
|
+
pointRadius: 3,
|
|
1341
|
+
tension: 0.1,
|
|
1342
|
+
fill: true
|
|
1343
|
+
}))
|
|
1344
|
+
},
|
|
1345
|
+
options: {
|
|
1346
|
+
plugins: {
|
|
1347
|
+
legend: {
|
|
1348
|
+
labels: {
|
|
1349
|
+
usePointStyle: true
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
},
|
|
1353
|
+
scales: {
|
|
1354
|
+
x: {
|
|
1355
|
+
grid: {
|
|
1356
|
+
display: false
|
|
1357
|
+
}
|
|
1358
|
+
},
|
|
1359
|
+
y: {
|
|
1360
|
+
beginAtZero: true,
|
|
1361
|
+
suggestedMax: 200,
|
|
1362
|
+
ticks: {
|
|
1363
|
+
callback: function(value) {
|
|
1364
|
+
return value + "%";
|
|
1365
|
+
}
|
|
1366
|
+
},
|
|
1367
|
+
grid: {
|
|
1368
|
+
display: true
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
return () => {
|
|
1376
|
+
if (chartInstance.current) {
|
|
1377
|
+
chartInstance.current.destroy();
|
|
1378
|
+
}
|
|
1379
|
+
};
|
|
1380
|
+
}, [labels, data]);
|
|
1381
|
+
return /* @__PURE__ */ React34.createElement("div", { className: props.className }, /* @__PURE__ */ React34.createElement("canvas", { ref: chartRef }));
|
|
1382
|
+
};
|
|
1383
|
+
|
|
1384
|
+
// src/Components/DoubleBarChart.tsx
|
|
1385
|
+
import React35, { useEffect as useEffect5, useRef as useRef3 } from "react";
|
|
1386
|
+
import Chart2 from "chart.js/auto";
|
|
1387
|
+
var DoubleBarChart = (props) => {
|
|
1388
|
+
const chartRef = useRef3(null);
|
|
1389
|
+
const chartInstance = useRef3(null);
|
|
1390
|
+
useEffect5(() => {
|
|
1391
|
+
if (chartRef.current) {
|
|
1392
|
+
if (chartInstance.current) {
|
|
1393
|
+
chartInstance.current.destroy();
|
|
1394
|
+
}
|
|
1395
|
+
chartInstance.current = new Chart2(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: 10
|
|
1412
|
+
},
|
|
1413
|
+
{
|
|
1414
|
+
label: "Conversion Rate",
|
|
1415
|
+
data: [70, 65, 75, 55, 85],
|
|
1416
|
+
// Example data for female
|
|
1417
|
+
backgroundColor: "#4484CD",
|
|
1418
|
+
barThickness: 10
|
|
1419
|
+
}
|
|
1420
|
+
]
|
|
1421
|
+
},
|
|
1422
|
+
options: {
|
|
1423
|
+
scales: {
|
|
1424
|
+
x: {
|
|
1425
|
+
grid: {
|
|
1426
|
+
display: false
|
|
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
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
},
|
|
1443
|
+
plugins: {
|
|
1444
|
+
legend: {
|
|
1445
|
+
labels: {
|
|
1446
|
+
usePointStyle: true
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
return () => {
|
|
1454
|
+
if (chartInstance.current) {
|
|
1455
|
+
chartInstance.current.destroy();
|
|
1456
|
+
}
|
|
1457
|
+
};
|
|
1458
|
+
}, []);
|
|
1459
|
+
return /* @__PURE__ */ React35.createElement("div", { className: props.className }, /* @__PURE__ */ React35.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React35.createElement("canvas", { ref: chartRef }));
|
|
1460
|
+
};
|
|
1461
|
+
|
|
1462
|
+
// src/Components/BarChart.tsx
|
|
1463
|
+
import React36 from "react";
|
|
1464
|
+
import { Bar as Bar2 } from "react-chartjs-2";
|
|
1465
|
+
import {
|
|
1466
|
+
Chart as ChartJS4,
|
|
1467
|
+
BarElement as BarElement2,
|
|
1468
|
+
CategoryScale as CategoryScale2,
|
|
1469
|
+
LinearScale as LinearScale2,
|
|
1470
|
+
Tooltip as Tooltip4
|
|
1471
|
+
} from "chart.js";
|
|
1472
|
+
ChartJS4.register(BarElement2, CategoryScale2, LinearScale2, Tooltip4);
|
|
1473
|
+
var BarChart = (props) => {
|
|
1474
|
+
const data = {
|
|
1475
|
+
labels: [
|
|
1476
|
+
"17 June",
|
|
1477
|
+
"18 June",
|
|
1478
|
+
"19 June",
|
|
1479
|
+
"20 June",
|
|
1480
|
+
"21 June",
|
|
1481
|
+
"22 June",
|
|
1482
|
+
"23 June"
|
|
1483
|
+
],
|
|
1484
|
+
datasets: [
|
|
1485
|
+
{
|
|
1486
|
+
data: [30, 100, 270, 140, 120, 240],
|
|
1487
|
+
backgroundColor: "#1565C0",
|
|
1488
|
+
barThickness: 15
|
|
1489
|
+
}
|
|
1490
|
+
]
|
|
1491
|
+
};
|
|
1492
|
+
const options = {
|
|
1493
|
+
responsive: true,
|
|
1494
|
+
scales: {
|
|
1495
|
+
x: {
|
|
1496
|
+
beginAtZero: true,
|
|
1497
|
+
grid: {
|
|
1498
|
+
display: false
|
|
1499
|
+
}
|
|
1500
|
+
},
|
|
1501
|
+
y: {
|
|
1502
|
+
grid: {
|
|
1503
|
+
display: true
|
|
1504
|
+
},
|
|
1505
|
+
ticks: {
|
|
1506
|
+
min: 0,
|
|
1507
|
+
max: 400,
|
|
1508
|
+
stepSize: 200,
|
|
1509
|
+
callback: function(value) {
|
|
1510
|
+
return `${value}`;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
},
|
|
1515
|
+
plugins: {
|
|
1516
|
+
tooltip: {
|
|
1517
|
+
enabled: true,
|
|
1518
|
+
callbacks: {
|
|
1519
|
+
label: function(context) {
|
|
1520
|
+
const label = context.label || "";
|
|
1521
|
+
const value = context.raw || 0;
|
|
1522
|
+
return ` ${label}: ${value}`;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
},
|
|
1526
|
+
legend: {
|
|
1527
|
+
display: false
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
};
|
|
1531
|
+
return /* @__PURE__ */ React36.createElement("div", { className: props.className }, /* @__PURE__ */ React36.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React36.createElement(Bar2, { data, options }));
|
|
1532
|
+
};
|
|
864
1533
|
export {
|
|
865
1534
|
AddMoreTable,
|
|
1535
|
+
BarChart,
|
|
866
1536
|
ButtonElement,
|
|
867
1537
|
CheckboxElement,
|
|
1538
|
+
CircleDonut,
|
|
868
1539
|
CkEditor,
|
|
869
1540
|
DatePickerElement,
|
|
870
1541
|
DateRangePickerElement,
|
|
1542
|
+
DoubleBarChart,
|
|
871
1543
|
DropDownGroup,
|
|
872
1544
|
FileUpload,
|
|
1545
|
+
HorizontalBarChart,
|
|
873
1546
|
Image,
|
|
1547
|
+
LineChart,
|
|
874
1548
|
MultipleSelectElement,
|
|
875
1549
|
Navbar,
|
|
876
1550
|
NumberElement,
|
|
1551
|
+
OtpElement,
|
|
877
1552
|
PasswordElement,
|
|
878
1553
|
RadioElement,
|
|
879
1554
|
SelectElement,
|
|
1555
|
+
SemiCircleDonut,
|
|
880
1556
|
Sidebar,
|
|
881
1557
|
SingleCheckbox,
|
|
882
1558
|
SingleSelectElement,
|
|
@@ -884,5 +1560,6 @@ export {
|
|
|
884
1560
|
TableElement,
|
|
885
1561
|
TabsElement,
|
|
886
1562
|
TextElement,
|
|
887
|
-
TextareaElement
|
|
1563
|
+
TextareaElement,
|
|
1564
|
+
Upload2 as Upload
|
|
888
1565
|
};
|