@apexcura/ui-components 0.0.14-Beta13 → 0.0.14-Beta131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +26 -0
- package/dist/index.d.mts +31 -7
- package/dist/index.d.ts +31 -7
- package/dist/index.js +670 -63
- package/dist/index.mjs +691 -75
- package/package.json +5 -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,
|
|
@@ -316,26 +316,90 @@ var MultipleSelectElement = (props) => {
|
|
|
316
316
|
};
|
|
317
317
|
|
|
318
318
|
// src/Components/Button.tsx
|
|
319
|
-
import React11 from "react";
|
|
319
|
+
import React11, { useEffect, useState as useState4 } from "react";
|
|
320
320
|
var ButtonElement = (props) => {
|
|
321
|
+
const [svgContent, setSvgContent] = useState4(null);
|
|
322
|
+
const [originalSvgContent, setOriginalSvgContent] = useState4(null);
|
|
323
|
+
const [hoverColor, setHoverColor] = useState4(null);
|
|
324
|
+
useEffect(() => {
|
|
325
|
+
if (props.icon) {
|
|
326
|
+
fetch(props.icon).then((response) => response.text()).then((data) => {
|
|
327
|
+
const tempDiv = document.createElement("div");
|
|
328
|
+
tempDiv.innerHTML = data;
|
|
329
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
330
|
+
if (svgElement) {
|
|
331
|
+
const textColorClass = props.className?.match(/text-[\w-]+/g)?.[0];
|
|
332
|
+
const hoverColorClass = props.className?.match(/hover:text-[\w-]+/g)?.[0];
|
|
333
|
+
if (textColorClass) {
|
|
334
|
+
const tempSpan = document.createElement("span");
|
|
335
|
+
tempSpan.className = textColorClass;
|
|
336
|
+
document.body.appendChild(tempSpan);
|
|
337
|
+
const computedColor = getComputedStyle(tempSpan).color;
|
|
338
|
+
document.body.removeChild(tempSpan);
|
|
339
|
+
const paths = svgElement.querySelectorAll("path");
|
|
340
|
+
paths.forEach((path) => path.setAttribute("fill", computedColor));
|
|
341
|
+
}
|
|
342
|
+
if (hoverColorClass) {
|
|
343
|
+
const tempSpan = document.createElement("span");
|
|
344
|
+
tempSpan.className = hoverColorClass.replace("hover:", "");
|
|
345
|
+
document.body.appendChild(tempSpan);
|
|
346
|
+
const computedHoverColor = getComputedStyle(tempSpan).color;
|
|
347
|
+
document.body.removeChild(tempSpan);
|
|
348
|
+
setHoverColor(computedHoverColor);
|
|
349
|
+
}
|
|
350
|
+
svgElement.setAttribute(
|
|
351
|
+
"class",
|
|
352
|
+
`${props.iconsClassName ? props.iconsClassName : ""}`
|
|
353
|
+
);
|
|
354
|
+
setSvgContent(tempDiv.innerHTML);
|
|
355
|
+
setOriginalSvgContent(tempDiv.innerHTML);
|
|
356
|
+
}
|
|
357
|
+
}).catch((error) => console.error("Error fetching SVG:", error));
|
|
358
|
+
}
|
|
359
|
+
}, [props.icon, props.className]);
|
|
360
|
+
const handleMouseEnter = () => {
|
|
361
|
+
if (hoverColor && originalSvgContent) {
|
|
362
|
+
const tempDiv = document.createElement("div");
|
|
363
|
+
tempDiv.innerHTML = originalSvgContent;
|
|
364
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
365
|
+
const paths = svgElement?.querySelectorAll("path");
|
|
366
|
+
paths?.forEach((path) => path.setAttribute("fill", hoverColor));
|
|
367
|
+
setSvgContent(tempDiv.innerHTML);
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
const handleMouseLeave = () => {
|
|
371
|
+
if (originalSvgContent) {
|
|
372
|
+
setSvgContent(originalSvgContent);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
321
375
|
return /* @__PURE__ */ React11.createElement(
|
|
322
376
|
"button",
|
|
323
377
|
{
|
|
324
|
-
onClick:
|
|
325
|
-
className: `${props.className ? props.className : ""}
|
|
378
|
+
onClick: props.onClick,
|
|
379
|
+
className: `${props.className ? props.className : ""}`,
|
|
380
|
+
onMouseEnter: handleMouseEnter,
|
|
381
|
+
onMouseLeave: handleMouseLeave,
|
|
382
|
+
disabled: props.loading,
|
|
383
|
+
style: {
|
|
384
|
+
cursor: props.loading ? "no-drop" : "pointer"
|
|
385
|
+
}
|
|
326
386
|
},
|
|
327
|
-
props.icon && /* @__PURE__ */ React11.createElement("img", { className: props.iconsClassName, src: props.icon })
|
|
328
|
-
|
|
387
|
+
props.isLoading ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, props.isSVGStylesOverride === false ? props.icon && /* @__PURE__ */ React11.createElement("img", { className: props.iconsClassName, src: props.icon, alt: props.label }) : svgContent && /* @__PURE__ */ React11.createElement(
|
|
388
|
+
"span",
|
|
389
|
+
{
|
|
390
|
+
dangerouslySetInnerHTML: { __html: svgContent }
|
|
391
|
+
}
|
|
392
|
+
), props.label)
|
|
329
393
|
);
|
|
330
394
|
};
|
|
331
395
|
|
|
332
396
|
// src/Components/AddMoreTable.tsx
|
|
333
|
-
import React12, { useEffect, useState as
|
|
397
|
+
import React12, { useEffect as useEffect2, useState as useState5 } from "react";
|
|
334
398
|
import { Table, Button } from "antd";
|
|
335
399
|
import { PlusOutlined, DeleteOutlined } from "@ant-design/icons";
|
|
336
400
|
var AddMoreTable = (props) => {
|
|
337
401
|
const { thead, tbody } = props;
|
|
338
|
-
const [rows, setRows] =
|
|
402
|
+
const [rows, setRows] = useState5(tbody || []);
|
|
339
403
|
const onHandleRows = () => {
|
|
340
404
|
const newId = rows.length > 0 ? rows[rows.length - 1].id + 1 : 1;
|
|
341
405
|
let newRow = {
|
|
@@ -400,16 +464,16 @@ var AddMoreTable = (props) => {
|
|
|
400
464
|
});
|
|
401
465
|
});
|
|
402
466
|
};
|
|
403
|
-
|
|
467
|
+
useEffect2(() => {
|
|
404
468
|
console.log(rows);
|
|
405
469
|
}, [rows]);
|
|
406
470
|
const renderInputElement = (element, value) => {
|
|
407
471
|
if (!element) return null;
|
|
408
472
|
const { element: type, label } = element;
|
|
409
473
|
if (type === "single-select") {
|
|
410
|
-
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [] });
|
|
474
|
+
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [], firstOptions: [], secondOptions: [] });
|
|
411
475
|
} else if (type === "textarea") {
|
|
412
|
-
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [] });
|
|
476
|
+
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [], firstOptions: [], secondOptions: [] });
|
|
413
477
|
} else {
|
|
414
478
|
return null;
|
|
415
479
|
}
|
|
@@ -467,10 +531,19 @@ var Sidebar = (props) => {
|
|
|
467
531
|
props.onChange(item);
|
|
468
532
|
}
|
|
469
533
|
};
|
|
470
|
-
return /* @__PURE__ */ React13.createElement(
|
|
471
|
-
return /* @__PURE__ */ React13.createElement(
|
|
472
|
-
|
|
473
|
-
|
|
534
|
+
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) => {
|
|
535
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, { key: item.label }, /* @__PURE__ */ React13.createElement(
|
|
536
|
+
ButtonElement,
|
|
537
|
+
{
|
|
538
|
+
...item,
|
|
539
|
+
className: item.active ? props.activeClassName : props.className,
|
|
540
|
+
iconsClassName: props.iconsClassName,
|
|
541
|
+
onClick: (e) => {
|
|
542
|
+
e.preventDefault();
|
|
543
|
+
handleChange(item);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
));
|
|
474
547
|
})));
|
|
475
548
|
};
|
|
476
549
|
|
|
@@ -535,7 +608,7 @@ var Navbar = (props) => {
|
|
|
535
608
|
};
|
|
536
609
|
|
|
537
610
|
// src/Components/TableElement.tsx
|
|
538
|
-
import React20, { useState as
|
|
611
|
+
import React20, { useState as useState6 } from "react";
|
|
539
612
|
import { Table as Table2 } from "antd";
|
|
540
613
|
|
|
541
614
|
// src/Components/Model.tsx
|
|
@@ -593,9 +666,8 @@ var ModelElement = (props) => {
|
|
|
593
666
|
// src/Components/TableElement.tsx
|
|
594
667
|
var TableElement = (props) => {
|
|
595
668
|
const { thead, tbody } = props;
|
|
596
|
-
const [selectedRecord, setSelectedRecord] =
|
|
597
|
-
const [model, setModel] =
|
|
598
|
-
const [selectedRowKeys, setSelectedRowKeys] = useState5([]);
|
|
669
|
+
const [selectedRecord, setSelectedRecord] = useState6({});
|
|
670
|
+
const [model, setModel] = useState6(false);
|
|
599
671
|
const handleChange = (record) => {
|
|
600
672
|
console.log("record", record);
|
|
601
673
|
if (props.onChange) {
|
|
@@ -608,12 +680,14 @@ var TableElement = (props) => {
|
|
|
608
680
|
{
|
|
609
681
|
title: "#",
|
|
610
682
|
dataIndex: "#",
|
|
611
|
-
key: "#"
|
|
683
|
+
key: "#",
|
|
684
|
+
fixed: "left"
|
|
612
685
|
},
|
|
613
686
|
...thead.map((col, ind) => ({
|
|
614
687
|
title: col.label,
|
|
615
688
|
dataIndex: col.name,
|
|
616
689
|
key: col.key,
|
|
690
|
+
ellipsis: col.ellipsis,
|
|
617
691
|
render: col.render,
|
|
618
692
|
sorter: {
|
|
619
693
|
compare: (a, b) => {
|
|
@@ -624,8 +698,10 @@ var TableElement = (props) => {
|
|
|
624
698
|
}
|
|
625
699
|
}
|
|
626
700
|
}
|
|
627
|
-
}))
|
|
628
|
-
|
|
701
|
+
}))
|
|
702
|
+
];
|
|
703
|
+
if (props.view) {
|
|
704
|
+
columns.push({
|
|
629
705
|
title: "View",
|
|
630
706
|
dataIndex: "View",
|
|
631
707
|
key: "View",
|
|
@@ -640,11 +716,12 @@ var TableElement = (props) => {
|
|
|
640
716
|
},
|
|
641
717
|
"View"
|
|
642
718
|
)
|
|
643
|
-
}
|
|
644
|
-
|
|
719
|
+
});
|
|
720
|
+
}
|
|
645
721
|
}
|
|
646
722
|
const dataSource = tbody && tbody.map((row, index) => ({
|
|
647
723
|
...row,
|
|
724
|
+
key: index + 1,
|
|
648
725
|
[columns[0].key]: index + 1
|
|
649
726
|
}));
|
|
650
727
|
const count = dataSource ? dataSource.length : 0;
|
|
@@ -653,48 +730,50 @@ var TableElement = (props) => {
|
|
|
653
730
|
props.onChange({ name: "pagination", page, pageSize });
|
|
654
731
|
}
|
|
655
732
|
};
|
|
656
|
-
const onSelectChange = (newSelectedRowKeys) => {
|
|
657
|
-
console.log("selectedRowKeys changed: ", newSelectedRowKeys);
|
|
658
|
-
setSelectedRowKeys(newSelectedRowKeys);
|
|
659
|
-
};
|
|
660
733
|
const rowSelectionConfig = props.rowSelection ? {
|
|
661
|
-
selectedRowKeys,
|
|
662
|
-
|
|
734
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
735
|
+
console.log(`selectedRowKeys: ${selectedRowKeys}`, "selectedRows: ", selectedRows);
|
|
736
|
+
if (props.onChange) {
|
|
737
|
+
props.onChange(selectedRows);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
663
740
|
} : void 0;
|
|
664
741
|
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
|
|
665
742
|
Table2,
|
|
666
743
|
{
|
|
744
|
+
className: props.className,
|
|
667
745
|
pagination: {
|
|
668
746
|
showTotal: (total) => `Total: ${total} items`,
|
|
669
747
|
total: count,
|
|
670
748
|
showSizeChanger: count > 10,
|
|
671
749
|
onChange: onChangePage
|
|
672
750
|
},
|
|
751
|
+
rowSelection: rowSelectionConfig,
|
|
673
752
|
dataSource,
|
|
674
753
|
columns,
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
size: props.size && props.size
|
|
754
|
+
size: props.size,
|
|
755
|
+
bordered: true
|
|
678
756
|
}
|
|
679
757
|
), model && /* @__PURE__ */ React20.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
680
758
|
};
|
|
681
759
|
|
|
682
760
|
// src/Components/DatePicker.tsx
|
|
683
|
-
import React21, { useState as
|
|
761
|
+
import React21, { useState as useState7 } from "react";
|
|
684
762
|
import { DatePicker } from "antd";
|
|
763
|
+
import dayjs from "dayjs";
|
|
764
|
+
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
765
|
+
dayjs.extend(customParseFormat);
|
|
685
766
|
var DatePickerElement = (props) => {
|
|
686
|
-
const [
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
const formattedDate = date2.format(dateFormat);
|
|
692
|
-
setDate(date2);
|
|
767
|
+
const [dateState, setDateState] = useState7("");
|
|
768
|
+
const handleChange = (date, dateString) => {
|
|
769
|
+
if (date) {
|
|
770
|
+
const formattedDate = dateString;
|
|
771
|
+
setDateState(date);
|
|
693
772
|
if (props.onChange) {
|
|
694
773
|
props.onChange(formattedDate);
|
|
695
774
|
}
|
|
696
775
|
} else {
|
|
697
|
-
|
|
776
|
+
setDateState("");
|
|
698
777
|
if (props.onChange) {
|
|
699
778
|
props.onChange("");
|
|
700
779
|
}
|
|
@@ -704,8 +783,8 @@ var DatePickerElement = (props) => {
|
|
|
704
783
|
DatePicker,
|
|
705
784
|
{
|
|
706
785
|
placeholder: props.placeholder,
|
|
707
|
-
value:
|
|
708
|
-
|
|
786
|
+
value: dateState,
|
|
787
|
+
format: { format: "DD-MM-YYYY" },
|
|
709
788
|
onChange: handleChange
|
|
710
789
|
}
|
|
711
790
|
));
|
|
@@ -714,7 +793,7 @@ var DatePickerElement = (props) => {
|
|
|
714
793
|
// src/Components/DateRangePickerElement.tsx
|
|
715
794
|
import React22 from "react";
|
|
716
795
|
import { DatePicker as DatePicker2, Space } from "antd";
|
|
717
|
-
import
|
|
796
|
+
import dayjs2 from "dayjs";
|
|
718
797
|
var DateRangePickerElement = (props) => {
|
|
719
798
|
const { RangePicker } = DatePicker2;
|
|
720
799
|
const handleChange = (dates, dateStrings) => {
|
|
@@ -725,10 +804,10 @@ var DateRangePickerElement = (props) => {
|
|
|
725
804
|
}
|
|
726
805
|
};
|
|
727
806
|
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: [
|
|
807
|
+
{ label: "Last 7 Days", value: [dayjs2().add(-7, "d"), dayjs2()] },
|
|
808
|
+
{ label: "Last 14 Days", value: [dayjs2().add(-14, "d"), dayjs2()] },
|
|
809
|
+
{ label: "Last 30 Days", value: [dayjs2().add(-30, "d"), dayjs2()] },
|
|
810
|
+
{ label: "Last 90 Days", value: [dayjs2().add(-90, "d"), dayjs2()] }
|
|
732
811
|
];
|
|
733
812
|
return /* @__PURE__ */ React22.createElement(Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ React22.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
734
813
|
};
|
|
@@ -736,7 +815,7 @@ var DateRangePickerElement = (props) => {
|
|
|
736
815
|
// src/Components/Image.tsx
|
|
737
816
|
import React23 from "react";
|
|
738
817
|
var Image = (props) => {
|
|
739
|
-
return /* @__PURE__ */ React23.createElement("
|
|
818
|
+
return /* @__PURE__ */ React23.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
740
819
|
};
|
|
741
820
|
|
|
742
821
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -752,35 +831,39 @@ var SingleCheckbox = (props) => {
|
|
|
752
831
|
};
|
|
753
832
|
|
|
754
833
|
// src/Components/DropDownGroup.tsx
|
|
755
|
-
import React25, { useState as
|
|
834
|
+
import React25, { useState as useState8 } from "react";
|
|
756
835
|
import { Select as Select4 } from "antd";
|
|
757
836
|
var DropDownGroup = (props) => {
|
|
758
|
-
const [selectedValue, setSelectedValue] =
|
|
837
|
+
const [selectedValue, setSelectedValue] = useState8({
|
|
759
838
|
firstValue: {},
|
|
760
|
-
secondValue: {}
|
|
839
|
+
secondValue: {},
|
|
840
|
+
temp: ""
|
|
761
841
|
});
|
|
762
842
|
const handleFirstChange = (value) => {
|
|
763
|
-
|
|
843
|
+
console.log(selectedValue.temp);
|
|
844
|
+
const filterOption2 = props.firstOptions?.find(
|
|
764
845
|
(eachOption) => eachOption.value === value
|
|
765
846
|
);
|
|
766
847
|
setSelectedValue((prev) => {
|
|
767
848
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
849
|
+
const { temp, ...rest } = newValue;
|
|
768
850
|
if (newValue.firstValue) {
|
|
769
|
-
props.onChange?.(
|
|
851
|
+
props.onChange?.(rest);
|
|
770
852
|
}
|
|
771
|
-
return
|
|
853
|
+
return newValue;
|
|
772
854
|
});
|
|
773
855
|
};
|
|
774
856
|
const handleSecondChange = (value) => {
|
|
775
|
-
const filterOption2 = props.
|
|
857
|
+
const filterOption2 = props.secondOptions?.find(
|
|
776
858
|
(eachOption) => eachOption.value === value
|
|
777
859
|
);
|
|
778
860
|
setSelectedValue((prev) => {
|
|
779
861
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
862
|
+
const { temp, ...rest } = newValue;
|
|
780
863
|
if (newValue.secondValue) {
|
|
781
|
-
props.onChange?.(
|
|
864
|
+
props.onChange?.(rest);
|
|
782
865
|
}
|
|
783
|
-
return
|
|
866
|
+
return newValue;
|
|
784
867
|
});
|
|
785
868
|
};
|
|
786
869
|
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(
|
|
@@ -788,7 +871,7 @@ var DropDownGroup = (props) => {
|
|
|
788
871
|
{
|
|
789
872
|
onChange: handleFirstChange,
|
|
790
873
|
variant: props.variant,
|
|
791
|
-
options: props.
|
|
874
|
+
options: props.firstOptions,
|
|
792
875
|
className: props.className
|
|
793
876
|
}
|
|
794
877
|
), /* @__PURE__ */ React25.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ React25.createElement(
|
|
@@ -796,27 +879,19 @@ var DropDownGroup = (props) => {
|
|
|
796
879
|
{
|
|
797
880
|
onChange: handleSecondChange,
|
|
798
881
|
variant: props.variant,
|
|
799
|
-
options: props.
|
|
882
|
+
options: props.secondOptions,
|
|
800
883
|
className: props.className
|
|
801
884
|
}
|
|
802
885
|
)));
|
|
803
886
|
};
|
|
804
887
|
|
|
805
888
|
// src/Components/FilesUpload.tsx
|
|
806
|
-
import React26, { useState as
|
|
807
|
-
import { Upload
|
|
889
|
+
import React26, { useState as useState9 } from "react";
|
|
890
|
+
import { Upload } from "antd";
|
|
808
891
|
import { InboxOutlined } from "@ant-design/icons";
|
|
809
892
|
var FileUpload = (props) => {
|
|
810
893
|
const { Dragger } = Upload;
|
|
811
|
-
const [files, setFiles] =
|
|
812
|
-
const beforeUpload = (file) => {
|
|
813
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
814
|
-
if (!isCorrectFile) {
|
|
815
|
-
message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
816
|
-
return Upload.LIST_IGNORE;
|
|
817
|
-
}
|
|
818
|
-
return true;
|
|
819
|
-
};
|
|
894
|
+
const [files, setFiles] = useState9([]);
|
|
820
895
|
const handleChange = ({ fileList }) => {
|
|
821
896
|
setFiles(fileList);
|
|
822
897
|
if (props.onChange) {
|
|
@@ -840,7 +915,6 @@ var FileUpload = (props) => {
|
|
|
840
915
|
maxCount: props.max_count,
|
|
841
916
|
multiple: props.multiple,
|
|
842
917
|
fileList: files,
|
|
843
|
-
beforeUpload,
|
|
844
918
|
onChange: handleChange,
|
|
845
919
|
showUploadList: true,
|
|
846
920
|
customRequest
|
|
@@ -861,27 +935,569 @@ var TabsElement = (props) => {
|
|
|
861
935
|
};
|
|
862
936
|
return /* @__PURE__ */ React27.createElement(Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
|
|
863
937
|
};
|
|
938
|
+
|
|
939
|
+
// src/Components/SwitchElement.tsx
|
|
940
|
+
import React28 from "react";
|
|
941
|
+
import { Switch } from "antd";
|
|
942
|
+
var onChange = (checked) => {
|
|
943
|
+
console.log(`switch to ${checked}`);
|
|
944
|
+
};
|
|
945
|
+
var SwitchElement = () => /* @__PURE__ */ React28.createElement(Switch, { defaultChecked: true, onChange });
|
|
946
|
+
|
|
947
|
+
// src/Components/Upload.tsx
|
|
948
|
+
import React29, { useState as useState10 } from "react";
|
|
949
|
+
var Upload2 = (props) => {
|
|
950
|
+
const [file, setFile] = useState10();
|
|
951
|
+
const handleFileChange = (e) => {
|
|
952
|
+
setFile(e.target.files[0]);
|
|
953
|
+
if (props.onChange) {
|
|
954
|
+
props.onChange(e.target.files[0]);
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
const handleUpload = async () => {
|
|
958
|
+
if (!file) {
|
|
959
|
+
console.error("No file selected");
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
return /* @__PURE__ */ React29.createElement("div", { style: { marginTop: 16 } }, /* @__PURE__ */ React29.createElement("input", { type: "file", onChange: handleFileChange }), /* @__PURE__ */ React29.createElement(
|
|
964
|
+
"button",
|
|
965
|
+
{
|
|
966
|
+
type: "button",
|
|
967
|
+
onClick: handleUpload,
|
|
968
|
+
disabled: !file,
|
|
969
|
+
style: { marginTop: 16 }
|
|
970
|
+
},
|
|
971
|
+
"Upload"
|
|
972
|
+
));
|
|
973
|
+
};
|
|
974
|
+
|
|
975
|
+
// src/Components/OtpElement.tsx
|
|
976
|
+
import React30, { useState as useState11, useRef, useEffect as useEffect3 } from "react";
|
|
977
|
+
import { Input as Input3 } from "antd";
|
|
978
|
+
var OtpElement = (props) => {
|
|
979
|
+
const length = props.length;
|
|
980
|
+
const [otp, setOtp] = useState11(Array(length).fill(""));
|
|
981
|
+
const inputRefs = useRef([]);
|
|
982
|
+
const handleChange = (e, index) => {
|
|
983
|
+
const value = e.target.value;
|
|
984
|
+
if (/^[0-9]$/.test(value) || value === "") {
|
|
985
|
+
const newOtp = [...otp];
|
|
986
|
+
newOtp[index] = value;
|
|
987
|
+
setOtp(newOtp);
|
|
988
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
989
|
+
if (value && index < length - 1) {
|
|
990
|
+
inputRefs.current[index + 1]?.focus();
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
const handleKeyDown = (e, index) => {
|
|
995
|
+
if (e.key === "Backspace" && !otp[index] && index > 0) {
|
|
996
|
+
inputRefs.current[index - 1]?.focus();
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
const handlePaste = (e) => {
|
|
1000
|
+
e.preventDefault();
|
|
1001
|
+
const pasteData = e.clipboardData.getData("text");
|
|
1002
|
+
if (/^\d+$/.test(pasteData)) {
|
|
1003
|
+
const newOtp = pasteData.split("").slice(0, length);
|
|
1004
|
+
setOtp(newOtp.concat(Array(length - newOtp.length).fill("")));
|
|
1005
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1006
|
+
newOtp.forEach((_, idx) => {
|
|
1007
|
+
if (inputRefs.current[idx]) {
|
|
1008
|
+
inputRefs.current[idx]?.focus();
|
|
1009
|
+
}
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
useEffect3(() => {
|
|
1014
|
+
inputRefs.current[0]?.focus();
|
|
1015
|
+
}, []);
|
|
1016
|
+
return /* @__PURE__ */ React30.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ React30.createElement(
|
|
1017
|
+
Input3,
|
|
1018
|
+
{
|
|
1019
|
+
key: index,
|
|
1020
|
+
className: props.className,
|
|
1021
|
+
maxLength: 1,
|
|
1022
|
+
value: otp[index],
|
|
1023
|
+
onChange: (e) => handleChange(e, index),
|
|
1024
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
1025
|
+
onPaste: handlePaste,
|
|
1026
|
+
ref: (el) => inputRefs.current[index] = el
|
|
1027
|
+
}
|
|
1028
|
+
)));
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
// src/Components/CircleDonut.tsx
|
|
1032
|
+
import React31 from "react";
|
|
1033
|
+
import { Doughnut } from "react-chartjs-2";
|
|
1034
|
+
import {
|
|
1035
|
+
Chart as ChartJS,
|
|
1036
|
+
DoughnutController,
|
|
1037
|
+
ArcElement,
|
|
1038
|
+
Tooltip,
|
|
1039
|
+
Legend
|
|
1040
|
+
} from "chart.js";
|
|
1041
|
+
ChartJS.register(DoughnutController, ArcElement, Tooltip, Legend);
|
|
1042
|
+
var CircleDonut = (props) => {
|
|
1043
|
+
const data = {
|
|
1044
|
+
labels: [
|
|
1045
|
+
"Registration",
|
|
1046
|
+
"Book Appointment",
|
|
1047
|
+
"Diagnostic Tests",
|
|
1048
|
+
"Hospital Facility",
|
|
1049
|
+
"Others, Prescriptions"
|
|
1050
|
+
],
|
|
1051
|
+
datasets: [
|
|
1052
|
+
{
|
|
1053
|
+
label: "Bot Conversation",
|
|
1054
|
+
data: [30, 10, 27, 40, 12],
|
|
1055
|
+
backgroundColor: [
|
|
1056
|
+
"#FFCB8A",
|
|
1057
|
+
"#CADBBF",
|
|
1058
|
+
"#8AC1BB",
|
|
1059
|
+
"#FCB0CB",
|
|
1060
|
+
"#CEB0FA"
|
|
1061
|
+
],
|
|
1062
|
+
borderWidth: 0
|
|
1063
|
+
}
|
|
1064
|
+
]
|
|
1065
|
+
};
|
|
1066
|
+
const options = {
|
|
1067
|
+
responsive: true,
|
|
1068
|
+
cutout: "80%",
|
|
1069
|
+
plugins: {
|
|
1070
|
+
legend: {
|
|
1071
|
+
position: "left",
|
|
1072
|
+
labels: {
|
|
1073
|
+
font: {
|
|
1074
|
+
size: 10
|
|
1075
|
+
},
|
|
1076
|
+
boxWidth: 15,
|
|
1077
|
+
generateLabels: (chart) => {
|
|
1078
|
+
const dataset = chart.data.datasets[0];
|
|
1079
|
+
return chart.data.labels.map((label, index) => {
|
|
1080
|
+
const value = dataset.data[index];
|
|
1081
|
+
return {
|
|
1082
|
+
text: `${label}: ${value}`,
|
|
1083
|
+
fillStyle: dataset.backgroundColor[index]
|
|
1084
|
+
};
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
tooltip: {
|
|
1090
|
+
enabled: true,
|
|
1091
|
+
callbacks: {
|
|
1092
|
+
label: function(context) {
|
|
1093
|
+
const label = context.label || "";
|
|
1094
|
+
const value = context.raw || 0;
|
|
1095
|
+
return `${label}: ${value}`;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
const centerTextPlugin = {
|
|
1102
|
+
id: "centerText",
|
|
1103
|
+
beforeDraw: (chart) => {
|
|
1104
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1105
|
+
const width = right - left;
|
|
1106
|
+
const height = bottom - top;
|
|
1107
|
+
const centerX = left + width / 2;
|
|
1108
|
+
const centerY = top + height / 2;
|
|
1109
|
+
ctx.save();
|
|
1110
|
+
ctx.font = "7px Arial";
|
|
1111
|
+
ctx.fillStyle = "blue";
|
|
1112
|
+
ctx.textAlign = "center";
|
|
1113
|
+
ctx.textBaseline = "middle";
|
|
1114
|
+
ctx.fillText("Total Sessions", centerX, centerY - 10);
|
|
1115
|
+
ctx.font = "25px Arial";
|
|
1116
|
+
ctx.fillStyle = "black";
|
|
1117
|
+
ctx.fillText("85", centerX, centerY + 20);
|
|
1118
|
+
ctx.restore();
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1121
|
+
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] }));
|
|
1122
|
+
};
|
|
1123
|
+
|
|
1124
|
+
// src/Components/SemiCircleDonut.tsx
|
|
1125
|
+
import React32 from "react";
|
|
1126
|
+
import { Doughnut as Doughnut2 } from "react-chartjs-2";
|
|
1127
|
+
import {
|
|
1128
|
+
Chart as ChartJS2,
|
|
1129
|
+
DoughnutController as DoughnutController2,
|
|
1130
|
+
ArcElement as ArcElement2,
|
|
1131
|
+
Tooltip as Tooltip2,
|
|
1132
|
+
Legend as Legend2
|
|
1133
|
+
} from "chart.js";
|
|
1134
|
+
ChartJS2.register(DoughnutController2, ArcElement2, Tooltip2, Legend2);
|
|
1135
|
+
var SemiCircleDonut = (props) => {
|
|
1136
|
+
const data = {
|
|
1137
|
+
labels: [
|
|
1138
|
+
"Registration",
|
|
1139
|
+
"Book Appointment",
|
|
1140
|
+
"Diagnostic Tests",
|
|
1141
|
+
"Hospital Facility",
|
|
1142
|
+
"Others, Prescriptions"
|
|
1143
|
+
],
|
|
1144
|
+
datasets: [
|
|
1145
|
+
{
|
|
1146
|
+
label: "Bot Conversation",
|
|
1147
|
+
data: [30, 10, 27, 40, 12],
|
|
1148
|
+
backgroundColor: [
|
|
1149
|
+
"#FFCB8A",
|
|
1150
|
+
"#CADBBF",
|
|
1151
|
+
"#8AC1BB",
|
|
1152
|
+
"#FCB0CB",
|
|
1153
|
+
"#CEB0FA"
|
|
1154
|
+
],
|
|
1155
|
+
borderWidth: 0
|
|
1156
|
+
}
|
|
1157
|
+
]
|
|
1158
|
+
};
|
|
1159
|
+
const options = {
|
|
1160
|
+
responsive: true,
|
|
1161
|
+
circumference: 180,
|
|
1162
|
+
rotation: -90,
|
|
1163
|
+
cutout: "80%",
|
|
1164
|
+
plugins: {
|
|
1165
|
+
legend: {
|
|
1166
|
+
display: false
|
|
1167
|
+
// Disable the legend
|
|
1168
|
+
},
|
|
1169
|
+
tooltip: {
|
|
1170
|
+
enabled: true,
|
|
1171
|
+
callbacks: {
|
|
1172
|
+
label: function(context) {
|
|
1173
|
+
const label = context.label || "";
|
|
1174
|
+
const value = context.raw || 0;
|
|
1175
|
+
return `${label}: ${value}`;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
const centerTextPlugin = {
|
|
1182
|
+
id: "centerText",
|
|
1183
|
+
beforeDraw: (chart) => {
|
|
1184
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1185
|
+
const width = right - left;
|
|
1186
|
+
const height = bottom - top;
|
|
1187
|
+
const centerX = left + width / 2;
|
|
1188
|
+
const centerY = top + height / 1.5;
|
|
1189
|
+
ctx.save();
|
|
1190
|
+
ctx.font = "26px Arial";
|
|
1191
|
+
ctx.fillStyle = "black";
|
|
1192
|
+
ctx.textAlign = "center";
|
|
1193
|
+
ctx.textBaseline = "middle";
|
|
1194
|
+
ctx.fillText("High", centerX, centerY - 10);
|
|
1195
|
+
ctx.font = "12px Arial";
|
|
1196
|
+
ctx.fillText("Improve Chatbot Training Data", centerX, centerY + 20);
|
|
1197
|
+
ctx.restore();
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
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] }));
|
|
1201
|
+
};
|
|
1202
|
+
|
|
1203
|
+
// src/Components/HorizontalBarChart.tsx
|
|
1204
|
+
import React33 from "react";
|
|
1205
|
+
import { Bar } from "react-chartjs-2";
|
|
1206
|
+
import {
|
|
1207
|
+
Chart as ChartJS3,
|
|
1208
|
+
BarElement,
|
|
1209
|
+
CategoryScale,
|
|
1210
|
+
LinearScale,
|
|
1211
|
+
Tooltip as Tooltip3
|
|
1212
|
+
} from "chart.js";
|
|
1213
|
+
ChartJS3.register(BarElement, CategoryScale, LinearScale, Tooltip3);
|
|
1214
|
+
var HorizontalBarChart = (props) => {
|
|
1215
|
+
const data = {
|
|
1216
|
+
labels: ["18-24", "25-34", "35-44", "45-54", "55-64", "65+"],
|
|
1217
|
+
datasets: [
|
|
1218
|
+
{
|
|
1219
|
+
data: [30, 10, 27, 40, 12, 24],
|
|
1220
|
+
backgroundColor: "#6298D5",
|
|
1221
|
+
barThickness: 20
|
|
1222
|
+
}
|
|
1223
|
+
]
|
|
1224
|
+
};
|
|
1225
|
+
const options = {
|
|
1226
|
+
responsive: true,
|
|
1227
|
+
indexAxis: "y",
|
|
1228
|
+
scales: {
|
|
1229
|
+
x: {
|
|
1230
|
+
beginAtZero: true,
|
|
1231
|
+
ticks: {
|
|
1232
|
+
callback: function(value) {
|
|
1233
|
+
return `${value}%`;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
},
|
|
1237
|
+
y: {
|
|
1238
|
+
grid: {
|
|
1239
|
+
display: false
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
},
|
|
1243
|
+
plugins: {
|
|
1244
|
+
tooltip: {
|
|
1245
|
+
enabled: true,
|
|
1246
|
+
callbacks: {
|
|
1247
|
+
label: function(context) {
|
|
1248
|
+
const label = context.label || "";
|
|
1249
|
+
const value = context.raw || 0;
|
|
1250
|
+
return `${label}: ${value}`;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
},
|
|
1254
|
+
legend: {
|
|
1255
|
+
display: false
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
};
|
|
1259
|
+
return /* @__PURE__ */ React33.createElement("div", { className: props.className }, /* @__PURE__ */ React33.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React33.createElement(Bar, { data, options }));
|
|
1260
|
+
};
|
|
1261
|
+
|
|
1262
|
+
// src/Components/LineChart.tsx
|
|
1263
|
+
import React34, { useEffect as useEffect4, useRef as useRef2 } from "react";
|
|
1264
|
+
import Chart from "chart.js/auto";
|
|
1265
|
+
var LineChart = (props) => {
|
|
1266
|
+
const chartRef = useRef2(null);
|
|
1267
|
+
const chartInstance = useRef2(null);
|
|
1268
|
+
const data = [
|
|
1269
|
+
{ label: "ROI", data: [10, 30, 50, 70, 90] },
|
|
1270
|
+
{ label: "Engagement Rate", data: [20, 40, 60, 80, 100] },
|
|
1271
|
+
{ label: "Conversion Rate", data: [30, 50, 70, 90, 110] }
|
|
1272
|
+
];
|
|
1273
|
+
const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
|
|
1274
|
+
useEffect4(() => {
|
|
1275
|
+
if (chartRef.current) {
|
|
1276
|
+
if (chartInstance.current) {
|
|
1277
|
+
chartInstance.current.destroy();
|
|
1278
|
+
}
|
|
1279
|
+
chartInstance.current = new Chart(chartRef.current, {
|
|
1280
|
+
type: "line",
|
|
1281
|
+
data: {
|
|
1282
|
+
labels,
|
|
1283
|
+
datasets: data.map((dataset, index) => ({
|
|
1284
|
+
label: dataset.label,
|
|
1285
|
+
data: dataset.data,
|
|
1286
|
+
borderColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1287
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
1288
|
+
pointBackgroundColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1289
|
+
pointBorderColor: "white",
|
|
1290
|
+
pointStyle: "circle",
|
|
1291
|
+
pointRadius: 3,
|
|
1292
|
+
tension: 0.1,
|
|
1293
|
+
fill: true
|
|
1294
|
+
}))
|
|
1295
|
+
},
|
|
1296
|
+
options: {
|
|
1297
|
+
plugins: {
|
|
1298
|
+
legend: {
|
|
1299
|
+
labels: {
|
|
1300
|
+
usePointStyle: true
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
},
|
|
1304
|
+
scales: {
|
|
1305
|
+
x: {
|
|
1306
|
+
grid: {
|
|
1307
|
+
display: true
|
|
1308
|
+
}
|
|
1309
|
+
},
|
|
1310
|
+
y: {
|
|
1311
|
+
beginAtZero: true,
|
|
1312
|
+
suggestedMax: 200,
|
|
1313
|
+
ticks: {
|
|
1314
|
+
callback: function(value) {
|
|
1315
|
+
return value + "%";
|
|
1316
|
+
}
|
|
1317
|
+
},
|
|
1318
|
+
grid: {
|
|
1319
|
+
display: true
|
|
1320
|
+
// Display y-axis grid lines
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
return () => {
|
|
1328
|
+
if (chartInstance.current) {
|
|
1329
|
+
chartInstance.current.destroy();
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
}, [labels, data]);
|
|
1333
|
+
return /* @__PURE__ */ React34.createElement("div", { className: props.className }, /* @__PURE__ */ React34.createElement("canvas", { ref: chartRef }));
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
// src/Components/DoubleBarChart.tsx
|
|
1337
|
+
import React35, { useEffect as useEffect5, useRef as useRef3 } from "react";
|
|
1338
|
+
import Chart2 from "chart.js/auto";
|
|
1339
|
+
var DoubleBarChart = (props) => {
|
|
1340
|
+
const chartRef = useRef3(null);
|
|
1341
|
+
const chartInstance = useRef3(null);
|
|
1342
|
+
useEffect5(() => {
|
|
1343
|
+
if (chartRef.current) {
|
|
1344
|
+
if (chartInstance.current) {
|
|
1345
|
+
chartInstance.current.destroy();
|
|
1346
|
+
}
|
|
1347
|
+
chartInstance.current = new Chart2(chartRef.current, {
|
|
1348
|
+
type: "bar",
|
|
1349
|
+
data: {
|
|
1350
|
+
labels: [
|
|
1351
|
+
"Summer Health Tips",
|
|
1352
|
+
"New Services Launch",
|
|
1353
|
+
"Discounts on Checkups",
|
|
1354
|
+
"Wellness Webinar",
|
|
1355
|
+
"LinkedIn Insights"
|
|
1356
|
+
],
|
|
1357
|
+
datasets: [
|
|
1358
|
+
{
|
|
1359
|
+
label: "Engagement Rate",
|
|
1360
|
+
data: [60, 70, 50, 80, 65],
|
|
1361
|
+
// Example data for male
|
|
1362
|
+
backgroundColor: "#93B8E2",
|
|
1363
|
+
barThickness: 20
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
label: "Conversion Rate",
|
|
1367
|
+
data: [70, 65, 75, 55, 85],
|
|
1368
|
+
// Example data for female
|
|
1369
|
+
backgroundColor: "#4484CD",
|
|
1370
|
+
barThickness: 20
|
|
1371
|
+
}
|
|
1372
|
+
]
|
|
1373
|
+
},
|
|
1374
|
+
options: {
|
|
1375
|
+
scales: {
|
|
1376
|
+
x: {
|
|
1377
|
+
grid: {
|
|
1378
|
+
display: true
|
|
1379
|
+
// Display x-axis grid lines
|
|
1380
|
+
}
|
|
1381
|
+
},
|
|
1382
|
+
y: {
|
|
1383
|
+
beginAtZero: true,
|
|
1384
|
+
suggestedMax: 100,
|
|
1385
|
+
ticks: {
|
|
1386
|
+
callback: function(value) {
|
|
1387
|
+
return value + "%";
|
|
1388
|
+
}
|
|
1389
|
+
},
|
|
1390
|
+
grid: {
|
|
1391
|
+
display: true
|
|
1392
|
+
// Remove y-axis grid lines
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
},
|
|
1396
|
+
plugins: {
|
|
1397
|
+
legend: {
|
|
1398
|
+
labels: {
|
|
1399
|
+
usePointStyle: true
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
return () => {
|
|
1407
|
+
if (chartInstance.current) {
|
|
1408
|
+
chartInstance.current.destroy();
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
}, []);
|
|
1412
|
+
return /* @__PURE__ */ React35.createElement("div", { className: props.className }, /* @__PURE__ */ React35.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React35.createElement("canvas", { ref: chartRef }));
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
// src/Components/BarChart.tsx
|
|
1416
|
+
import React36, { useEffect as useEffect6, useRef as useRef4 } from "react";
|
|
1417
|
+
import Chart3 from "chart.js/auto";
|
|
1418
|
+
var BarChart = () => {
|
|
1419
|
+
const chartRef = useRef4(null);
|
|
1420
|
+
const chartInstance = useRef4(null);
|
|
1421
|
+
useEffect6(() => {
|
|
1422
|
+
if (chartRef.current) {
|
|
1423
|
+
if (chartInstance.current) {
|
|
1424
|
+
chartInstance.current.destroy();
|
|
1425
|
+
}
|
|
1426
|
+
chartInstance.current = new Chart3(chartRef.current, {
|
|
1427
|
+
type: "bar",
|
|
1428
|
+
data: {
|
|
1429
|
+
labels: [
|
|
1430
|
+
"17 June",
|
|
1431
|
+
"18 June",
|
|
1432
|
+
"19 June",
|
|
1433
|
+
"20 June",
|
|
1434
|
+
"21 June",
|
|
1435
|
+
"22 June",
|
|
1436
|
+
"23 June"
|
|
1437
|
+
],
|
|
1438
|
+
datasets: [
|
|
1439
|
+
{
|
|
1440
|
+
data: [70, 65, 75, 55, 85],
|
|
1441
|
+
// Example data for female
|
|
1442
|
+
backgroundColor: "rgba(255, 99, 132, 0.5)",
|
|
1443
|
+
borderColor: "rgba(255, 99, 132, 1)",
|
|
1444
|
+
borderWidth: 1
|
|
1445
|
+
}
|
|
1446
|
+
]
|
|
1447
|
+
},
|
|
1448
|
+
options: {
|
|
1449
|
+
scales: {
|
|
1450
|
+
y: {
|
|
1451
|
+
beginAtZero: true,
|
|
1452
|
+
suggestedMax: 100,
|
|
1453
|
+
ticks: {
|
|
1454
|
+
callback: function(value) {
|
|
1455
|
+
return value + "%";
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
return () => {
|
|
1464
|
+
if (chartInstance.current) {
|
|
1465
|
+
chartInstance.current.destroy();
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
}, []);
|
|
1469
|
+
return /* @__PURE__ */ React36.createElement("canvas", { ref: chartRef });
|
|
1470
|
+
};
|
|
864
1471
|
export {
|
|
865
1472
|
AddMoreTable,
|
|
1473
|
+
BarChart,
|
|
866
1474
|
ButtonElement,
|
|
867
1475
|
CheckboxElement,
|
|
1476
|
+
CircleDonut,
|
|
868
1477
|
CkEditor,
|
|
869
1478
|
DatePickerElement,
|
|
870
1479
|
DateRangePickerElement,
|
|
1480
|
+
DoubleBarChart,
|
|
871
1481
|
DropDownGroup,
|
|
872
1482
|
FileUpload,
|
|
1483
|
+
HorizontalBarChart,
|
|
873
1484
|
Image,
|
|
1485
|
+
LineChart,
|
|
874
1486
|
MultipleSelectElement,
|
|
875
1487
|
Navbar,
|
|
876
1488
|
NumberElement,
|
|
1489
|
+
OtpElement,
|
|
877
1490
|
PasswordElement,
|
|
878
1491
|
RadioElement,
|
|
879
1492
|
SelectElement,
|
|
1493
|
+
SemiCircleDonut,
|
|
880
1494
|
Sidebar,
|
|
881
1495
|
SingleCheckbox,
|
|
882
1496
|
SingleSelectElement,
|
|
1497
|
+
SwitchElement,
|
|
883
1498
|
TableElement,
|
|
884
1499
|
TabsElement,
|
|
885
1500
|
TextElement,
|
|
886
|
-
TextareaElement
|
|
1501
|
+
TextareaElement,
|
|
1502
|
+
Upload2 as Upload
|
|
887
1503
|
};
|