@apexcura/ui-components 0.0.14-Beta10 → 0.0.14-Beta101
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 +29 -0
- package/dist/index.d.mts +21 -7
- package/dist/index.d.ts +21 -7
- package/dist/index.js +288 -62
- package/dist/index.mjs +296 -74
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -36,22 +36,26 @@ __export(src_exports, {
|
|
|
36
36
|
CkEditor: () => CkEditor,
|
|
37
37
|
DatePickerElement: () => DatePickerElement,
|
|
38
38
|
DateRangePickerElement: () => DateRangePickerElement,
|
|
39
|
+
Donut: () => Donut,
|
|
39
40
|
DropDownGroup: () => DropDownGroup,
|
|
40
41
|
FileUpload: () => FileUpload,
|
|
41
42
|
Image: () => Image,
|
|
42
43
|
MultipleSelectElement: () => MultipleSelectElement,
|
|
43
44
|
Navbar: () => Navbar,
|
|
44
45
|
NumberElement: () => NumberElement,
|
|
46
|
+
OtpElement: () => OtpElement,
|
|
45
47
|
PasswordElement: () => PasswordElement,
|
|
46
48
|
RadioElement: () => RadioElement,
|
|
47
49
|
SelectElement: () => SelectElement,
|
|
48
50
|
Sidebar: () => Sidebar,
|
|
49
51
|
SingleCheckbox: () => SingleCheckbox,
|
|
50
52
|
SingleSelectElement: () => SingleSelectElement,
|
|
53
|
+
SwitchElement: () => SwitchElement,
|
|
51
54
|
TableElement: () => TableElement,
|
|
52
55
|
TabsElement: () => TabsElement,
|
|
53
56
|
TextElement: () => TextElement,
|
|
54
|
-
TextareaElement: () => TextareaElement
|
|
57
|
+
TextareaElement: () => TextareaElement,
|
|
58
|
+
Upload: () => Upload2
|
|
55
59
|
});
|
|
56
60
|
module.exports = __toCommonJS(src_exports);
|
|
57
61
|
|
|
@@ -70,6 +74,7 @@ var TextElement = (props) => {
|
|
|
70
74
|
placeholder: props.placeholder,
|
|
71
75
|
allowClear: true,
|
|
72
76
|
id: props.name,
|
|
77
|
+
value: props.value,
|
|
73
78
|
prefix: props.prefix,
|
|
74
79
|
type: props.type,
|
|
75
80
|
status: props.status,
|
|
@@ -129,8 +134,7 @@ var NumberElement = (props) => {
|
|
|
129
134
|
{
|
|
130
135
|
placeholder: props.placeholder,
|
|
131
136
|
addonBefore: props.addonBefore,
|
|
132
|
-
|
|
133
|
-
defaultValue: props.defaultValue,
|
|
137
|
+
value: props.value,
|
|
134
138
|
disabled: props.disabled,
|
|
135
139
|
id: props.name,
|
|
136
140
|
prefix: props.prefix,
|
|
@@ -375,14 +379,75 @@ var MultipleSelectElement = (props) => {
|
|
|
375
379
|
// src/Components/Button.tsx
|
|
376
380
|
var import_react11 = __toESM(require("react"));
|
|
377
381
|
var ButtonElement = (props) => {
|
|
382
|
+
const [svgContent, setSvgContent] = (0, import_react11.useState)(null);
|
|
383
|
+
const [originalSvgContent, setOriginalSvgContent] = (0, import_react11.useState)(null);
|
|
384
|
+
const [hoverColor, setHoverColor] = (0, import_react11.useState)(null);
|
|
385
|
+
(0, import_react11.useEffect)(() => {
|
|
386
|
+
if (props.icon) {
|
|
387
|
+
fetch(props.icon).then((response) => response.text()).then((data) => {
|
|
388
|
+
const tempDiv = document.createElement("div");
|
|
389
|
+
tempDiv.innerHTML = data;
|
|
390
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
391
|
+
if (svgElement) {
|
|
392
|
+
const textColorClass = props.className?.match(/text-[\w-]+/g)?.[0];
|
|
393
|
+
const hoverColorClass = props.className?.match(/hover:text-[\w-]+/g)?.[0];
|
|
394
|
+
if (textColorClass) {
|
|
395
|
+
const tempSpan = document.createElement("span");
|
|
396
|
+
tempSpan.className = textColorClass;
|
|
397
|
+
document.body.appendChild(tempSpan);
|
|
398
|
+
const computedColor = getComputedStyle(tempSpan).color;
|
|
399
|
+
document.body.removeChild(tempSpan);
|
|
400
|
+
const paths = svgElement.querySelectorAll("path");
|
|
401
|
+
paths.forEach((path) => path.setAttribute("fill", computedColor));
|
|
402
|
+
}
|
|
403
|
+
if (hoverColorClass) {
|
|
404
|
+
const tempSpan = document.createElement("span");
|
|
405
|
+
tempSpan.className = hoverColorClass.replace("hover:", "");
|
|
406
|
+
document.body.appendChild(tempSpan);
|
|
407
|
+
const computedHoverColor = getComputedStyle(tempSpan).color;
|
|
408
|
+
document.body.removeChild(tempSpan);
|
|
409
|
+
setHoverColor(computedHoverColor);
|
|
410
|
+
}
|
|
411
|
+
svgElement.setAttribute(
|
|
412
|
+
"class",
|
|
413
|
+
`${props.iconsClassName ? props.iconsClassName : ""}`
|
|
414
|
+
);
|
|
415
|
+
setSvgContent(tempDiv.innerHTML);
|
|
416
|
+
setOriginalSvgContent(tempDiv.innerHTML);
|
|
417
|
+
}
|
|
418
|
+
}).catch((error) => console.error("Error fetching SVG:", error));
|
|
419
|
+
}
|
|
420
|
+
}, [props.icon, props.className]);
|
|
421
|
+
const handleMouseEnter = () => {
|
|
422
|
+
if (hoverColor && originalSvgContent) {
|
|
423
|
+
const tempDiv = document.createElement("div");
|
|
424
|
+
tempDiv.innerHTML = originalSvgContent;
|
|
425
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
426
|
+
const paths = svgElement?.querySelectorAll("path");
|
|
427
|
+
paths?.forEach((path) => path.setAttribute("fill", hoverColor));
|
|
428
|
+
setSvgContent(tempDiv.innerHTML);
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
const handleMouseLeave = () => {
|
|
432
|
+
if (originalSvgContent) {
|
|
433
|
+
setSvgContent(originalSvgContent);
|
|
434
|
+
}
|
|
435
|
+
};
|
|
378
436
|
return /* @__PURE__ */ import_react11.default.createElement(
|
|
379
437
|
"button",
|
|
380
438
|
{
|
|
381
|
-
onClick:
|
|
382
|
-
className: `${props.className ? props.className : ""}
|
|
439
|
+
onClick: props.onClick,
|
|
440
|
+
className: `${props.className ? props.className : ""}`,
|
|
441
|
+
onMouseEnter: handleMouseEnter,
|
|
442
|
+
onMouseLeave: handleMouseLeave,
|
|
443
|
+
disabled: props.isLoading
|
|
383
444
|
},
|
|
384
|
-
props.icon && /* @__PURE__ */ import_react11.default.createElement("img", { className: props.iconsClassName, src: props.icon })
|
|
385
|
-
|
|
445
|
+
props.isLoading ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }, /* @__PURE__ */ import_react11.default.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), /* @__PURE__ */ import_react11.default.createElement("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })), props.label) : /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, props.isSVGStylesOverride === false ? props.icon && /* @__PURE__ */ import_react11.default.createElement("img", { className: props.iconsClassName, src: props.icon, alt: props.label }) : svgContent && /* @__PURE__ */ import_react11.default.createElement(
|
|
446
|
+
"span",
|
|
447
|
+
{
|
|
448
|
+
dangerouslySetInnerHTML: { __html: svgContent }
|
|
449
|
+
}
|
|
450
|
+
), props.label)
|
|
386
451
|
);
|
|
387
452
|
};
|
|
388
453
|
|
|
@@ -464,9 +529,9 @@ var AddMoreTable = (props) => {
|
|
|
464
529
|
if (!element) return null;
|
|
465
530
|
const { element: type, label } = element;
|
|
466
531
|
if (type === "single-select") {
|
|
467
|
-
return /* @__PURE__ */ import_react12.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [] });
|
|
532
|
+
return /* @__PURE__ */ import_react12.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [], firstOptions: [], secondOptions: [] });
|
|
468
533
|
} else if (type === "textarea") {
|
|
469
|
-
return /* @__PURE__ */ import_react12.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [] });
|
|
534
|
+
return /* @__PURE__ */ import_react12.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [], firstOptions: [], secondOptions: [] });
|
|
470
535
|
} else {
|
|
471
536
|
return null;
|
|
472
537
|
}
|
|
@@ -524,10 +589,19 @@ var Sidebar = (props) => {
|
|
|
524
589
|
props.onChange(item);
|
|
525
590
|
}
|
|
526
591
|
};
|
|
527
|
-
return /* @__PURE__ */ import_react13.default.createElement(
|
|
528
|
-
return /* @__PURE__ */ import_react13.default.createElement(
|
|
529
|
-
|
|
530
|
-
|
|
592
|
+
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) => {
|
|
593
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: item.label }, /* @__PURE__ */ import_react13.default.createElement(
|
|
594
|
+
ButtonElement,
|
|
595
|
+
{
|
|
596
|
+
...item,
|
|
597
|
+
className: `${props.className} ${item.active ? props.activeClassName : ""}`,
|
|
598
|
+
iconsClassName: props.iconsClassName,
|
|
599
|
+
onClick: (e) => {
|
|
600
|
+
e.preventDefault();
|
|
601
|
+
handleChange(item);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
));
|
|
531
605
|
})));
|
|
532
606
|
};
|
|
533
607
|
|
|
@@ -652,7 +726,6 @@ var TableElement = (props) => {
|
|
|
652
726
|
const { thead, tbody } = props;
|
|
653
727
|
const [selectedRecord, setSelectedRecord] = (0, import_react20.useState)({});
|
|
654
728
|
const [model, setModel] = (0, import_react20.useState)(false);
|
|
655
|
-
const [selectedRowKeys, setSelectedRowKeys] = (0, import_react20.useState)([]);
|
|
656
729
|
const handleChange = (record) => {
|
|
657
730
|
console.log("record", record);
|
|
658
731
|
if (props.onChange) {
|
|
@@ -665,12 +738,14 @@ var TableElement = (props) => {
|
|
|
665
738
|
{
|
|
666
739
|
title: "#",
|
|
667
740
|
dataIndex: "#",
|
|
668
|
-
key: "#"
|
|
741
|
+
key: "#",
|
|
742
|
+
fixed: "left"
|
|
669
743
|
},
|
|
670
744
|
...thead.map((col, ind) => ({
|
|
671
745
|
title: col.label,
|
|
672
746
|
dataIndex: col.name,
|
|
673
747
|
key: col.key,
|
|
748
|
+
ellipsis: col.ellipsis,
|
|
674
749
|
render: col.render,
|
|
675
750
|
sorter: {
|
|
676
751
|
compare: (a, b) => {
|
|
@@ -681,8 +756,10 @@ var TableElement = (props) => {
|
|
|
681
756
|
}
|
|
682
757
|
}
|
|
683
758
|
}
|
|
684
|
-
}))
|
|
685
|
-
|
|
759
|
+
}))
|
|
760
|
+
];
|
|
761
|
+
if (props.view) {
|
|
762
|
+
columns.push({
|
|
686
763
|
title: "View",
|
|
687
764
|
dataIndex: "View",
|
|
688
765
|
key: "View",
|
|
@@ -697,11 +774,12 @@ var TableElement = (props) => {
|
|
|
697
774
|
},
|
|
698
775
|
"View"
|
|
699
776
|
)
|
|
700
|
-
}
|
|
701
|
-
|
|
777
|
+
});
|
|
778
|
+
}
|
|
702
779
|
}
|
|
703
780
|
const dataSource = tbody && tbody.map((row, index) => ({
|
|
704
781
|
...row,
|
|
782
|
+
key: index + 1,
|
|
705
783
|
[columns[0].key]: index + 1
|
|
706
784
|
}));
|
|
707
785
|
const count = dataSource ? dataSource.length : 0;
|
|
@@ -710,28 +788,30 @@ var TableElement = (props) => {
|
|
|
710
788
|
props.onChange({ name: "pagination", page, pageSize });
|
|
711
789
|
}
|
|
712
790
|
};
|
|
713
|
-
const onSelectChange = (newSelectedRowKeys) => {
|
|
714
|
-
console.log("selectedRowKeys changed: ", newSelectedRowKeys);
|
|
715
|
-
setSelectedRowKeys(newSelectedRowKeys);
|
|
716
|
-
};
|
|
717
791
|
const rowSelectionConfig = props.rowSelection ? {
|
|
718
|
-
selectedRowKeys,
|
|
719
|
-
|
|
792
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
793
|
+
console.log(`selectedRowKeys: ${selectedRowKeys}`, "selectedRows: ", selectedRows);
|
|
794
|
+
if (props.onChange) {
|
|
795
|
+
props.onChange(selectedRows);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
720
798
|
} : void 0;
|
|
721
799
|
return /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, /* @__PURE__ */ import_react20.default.createElement(
|
|
722
800
|
import_antd14.Table,
|
|
723
801
|
{
|
|
802
|
+
className: props.className,
|
|
724
803
|
pagination: {
|
|
725
804
|
showTotal: (total) => `Total: ${total} items`,
|
|
726
805
|
total: count,
|
|
727
806
|
showSizeChanger: count > 10,
|
|
728
807
|
onChange: onChangePage
|
|
729
808
|
},
|
|
809
|
+
rowSelection: rowSelectionConfig,
|
|
730
810
|
dataSource,
|
|
731
811
|
columns,
|
|
812
|
+
size: props.size,
|
|
732
813
|
bordered: true,
|
|
733
|
-
|
|
734
|
-
size: props.size && props.size
|
|
814
|
+
scroll: { x: 1300 }
|
|
735
815
|
}
|
|
736
816
|
), model && /* @__PURE__ */ import_react20.default.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
737
817
|
};
|
|
@@ -739,19 +819,20 @@ var TableElement = (props) => {
|
|
|
739
819
|
// src/Components/DatePicker.tsx
|
|
740
820
|
var import_react21 = __toESM(require("react"));
|
|
741
821
|
var import_antd15 = require("antd");
|
|
822
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
823
|
+
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
824
|
+
import_dayjs.default.extend(import_customParseFormat.default);
|
|
742
825
|
var DatePickerElement = (props) => {
|
|
743
|
-
const [
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
const formattedDate = date2.format(dateFormat);
|
|
749
|
-
setDate(date2);
|
|
826
|
+
const [dateState, setDateState] = (0, import_react21.useState)("");
|
|
827
|
+
const handleChange = (date, dateString) => {
|
|
828
|
+
if (date) {
|
|
829
|
+
const formattedDate = date;
|
|
830
|
+
setDateState(date);
|
|
750
831
|
if (props.onChange) {
|
|
751
832
|
props.onChange(formattedDate);
|
|
752
833
|
}
|
|
753
834
|
} else {
|
|
754
|
-
|
|
835
|
+
setDateState("");
|
|
755
836
|
if (props.onChange) {
|
|
756
837
|
props.onChange("");
|
|
757
838
|
}
|
|
@@ -761,8 +842,8 @@ var DatePickerElement = (props) => {
|
|
|
761
842
|
import_antd15.DatePicker,
|
|
762
843
|
{
|
|
763
844
|
placeholder: props.placeholder,
|
|
764
|
-
value:
|
|
765
|
-
|
|
845
|
+
value: dateState,
|
|
846
|
+
format: { format: "DD-MM-YYYY" },
|
|
766
847
|
onChange: handleChange
|
|
767
848
|
}
|
|
768
849
|
));
|
|
@@ -771,7 +852,7 @@ var DatePickerElement = (props) => {
|
|
|
771
852
|
// src/Components/DateRangePickerElement.tsx
|
|
772
853
|
var import_react22 = __toESM(require("react"));
|
|
773
854
|
var import_antd16 = require("antd");
|
|
774
|
-
var
|
|
855
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
775
856
|
var DateRangePickerElement = (props) => {
|
|
776
857
|
const { RangePicker } = import_antd16.DatePicker;
|
|
777
858
|
const handleChange = (dates, dateStrings) => {
|
|
@@ -782,10 +863,10 @@ var DateRangePickerElement = (props) => {
|
|
|
782
863
|
}
|
|
783
864
|
};
|
|
784
865
|
const rangePresets = [
|
|
785
|
-
{ label: "Last 7 Days", value: [(0,
|
|
786
|
-
{ label: "Last 14 Days", value: [(0,
|
|
787
|
-
{ label: "Last 30 Days", value: [(0,
|
|
788
|
-
{ label: "Last 90 Days", value: [(0,
|
|
866
|
+
{ label: "Last 7 Days", value: [(0, import_dayjs2.default)().add(-7, "d"), (0, import_dayjs2.default)()] },
|
|
867
|
+
{ label: "Last 14 Days", value: [(0, import_dayjs2.default)().add(-14, "d"), (0, import_dayjs2.default)()] },
|
|
868
|
+
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
|
|
869
|
+
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
|
|
789
870
|
];
|
|
790
871
|
return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
791
872
|
};
|
|
@@ -793,7 +874,7 @@ var DateRangePickerElement = (props) => {
|
|
|
793
874
|
// src/Components/Image.tsx
|
|
794
875
|
var import_react23 = __toESM(require("react"));
|
|
795
876
|
var Image = (props) => {
|
|
796
|
-
return /* @__PURE__ */ import_react23.default.createElement("
|
|
877
|
+
return /* @__PURE__ */ import_react23.default.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
797
878
|
};
|
|
798
879
|
|
|
799
880
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -814,30 +895,34 @@ var import_antd18 = require("antd");
|
|
|
814
895
|
var DropDownGroup = (props) => {
|
|
815
896
|
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
816
897
|
firstValue: {},
|
|
817
|
-
secondValue: {}
|
|
898
|
+
secondValue: {},
|
|
899
|
+
temp: ""
|
|
818
900
|
});
|
|
819
901
|
const handleFirstChange = (value) => {
|
|
820
|
-
|
|
902
|
+
console.log(selectedValue.temp);
|
|
903
|
+
const filterOption2 = props.firstOptions?.find(
|
|
821
904
|
(eachOption) => eachOption.value === value
|
|
822
905
|
);
|
|
823
906
|
setSelectedValue((prev) => {
|
|
824
907
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
908
|
+
const { temp, ...rest } = newValue;
|
|
825
909
|
if (newValue.firstValue) {
|
|
826
|
-
props.onChange?.(
|
|
910
|
+
props.onChange?.(rest);
|
|
827
911
|
}
|
|
828
|
-
return
|
|
912
|
+
return newValue;
|
|
829
913
|
});
|
|
830
914
|
};
|
|
831
915
|
const handleSecondChange = (value) => {
|
|
832
|
-
const filterOption2 = props.
|
|
916
|
+
const filterOption2 = props.secondOptions?.find(
|
|
833
917
|
(eachOption) => eachOption.value === value
|
|
834
918
|
);
|
|
835
919
|
setSelectedValue((prev) => {
|
|
836
920
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
921
|
+
const { temp, ...rest } = newValue;
|
|
837
922
|
if (newValue.secondValue) {
|
|
838
|
-
props.onChange?.(
|
|
923
|
+
props.onChange?.(rest);
|
|
839
924
|
}
|
|
840
|
-
return
|
|
925
|
+
return newValue;
|
|
841
926
|
});
|
|
842
927
|
};
|
|
843
928
|
return /* @__PURE__ */ import_react25.default.createElement("div", { className: props.containerClassName }, props.label && /* @__PURE__ */ import_react25.default.createElement("label", { htmlFor: props.name, className: props.labelClassName }, props.label), /* @__PURE__ */ import_react25.default.createElement("div", { className: props.subContainerClassName }, /* @__PURE__ */ import_react25.default.createElement(
|
|
@@ -845,7 +930,7 @@ var DropDownGroup = (props) => {
|
|
|
845
930
|
{
|
|
846
931
|
onChange: handleFirstChange,
|
|
847
932
|
variant: props.variant,
|
|
848
|
-
options: props.
|
|
933
|
+
options: props.firstOptions,
|
|
849
934
|
className: props.className
|
|
850
935
|
}
|
|
851
936
|
), /* @__PURE__ */ import_react25.default.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ import_react25.default.createElement(
|
|
@@ -853,7 +938,7 @@ var DropDownGroup = (props) => {
|
|
|
853
938
|
{
|
|
854
939
|
onChange: handleSecondChange,
|
|
855
940
|
variant: props.variant,
|
|
856
|
-
options: props.
|
|
941
|
+
options: props.secondOptions,
|
|
857
942
|
className: props.className
|
|
858
943
|
}
|
|
859
944
|
)));
|
|
@@ -866,14 +951,6 @@ var import_icons4 = require("@ant-design/icons");
|
|
|
866
951
|
var FileUpload = (props) => {
|
|
867
952
|
const { Dragger } = import_antd19.Upload;
|
|
868
953
|
const [files, setFiles] = (0, import_react26.useState)([]);
|
|
869
|
-
const beforeUpload = (file) => {
|
|
870
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
871
|
-
if (!isCorrectFile) {
|
|
872
|
-
import_antd19.message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
873
|
-
return import_antd19.Upload.LIST_IGNORE;
|
|
874
|
-
}
|
|
875
|
-
return true;
|
|
876
|
-
};
|
|
877
954
|
const handleChange = ({ fileList }) => {
|
|
878
955
|
setFiles(fileList);
|
|
879
956
|
if (props.onChange) {
|
|
@@ -897,7 +974,6 @@ var FileUpload = (props) => {
|
|
|
897
974
|
maxCount: props.max_count,
|
|
898
975
|
multiple: props.multiple,
|
|
899
976
|
fileList: files,
|
|
900
|
-
beforeUpload,
|
|
901
977
|
onChange: handleChange,
|
|
902
978
|
showUploadList: true,
|
|
903
979
|
customRequest
|
|
@@ -918,6 +994,152 @@ var TabsElement = (props) => {
|
|
|
918
994
|
};
|
|
919
995
|
return /* @__PURE__ */ import_react27.default.createElement(import_antd20.Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
|
|
920
996
|
};
|
|
997
|
+
|
|
998
|
+
// src/Components/SwitchElement.tsx
|
|
999
|
+
var import_react28 = __toESM(require("react"));
|
|
1000
|
+
var import_antd21 = require("antd");
|
|
1001
|
+
var onChange = (checked) => {
|
|
1002
|
+
console.log(`switch to ${checked}`);
|
|
1003
|
+
};
|
|
1004
|
+
var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(import_antd21.Switch, { defaultChecked: true, onChange });
|
|
1005
|
+
|
|
1006
|
+
// src/Components/Upload.tsx
|
|
1007
|
+
var import_react29 = __toESM(require("react"));
|
|
1008
|
+
var Upload2 = (props) => {
|
|
1009
|
+
const [file, setFile] = (0, import_react29.useState)();
|
|
1010
|
+
const handleFileChange = (e) => {
|
|
1011
|
+
setFile(e.target.files[0]);
|
|
1012
|
+
if (props.onChange) {
|
|
1013
|
+
props.onChange(e.target.files[0]);
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
const handleUpload = async () => {
|
|
1017
|
+
if (!file) {
|
|
1018
|
+
console.error("No file selected");
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
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(
|
|
1023
|
+
"button",
|
|
1024
|
+
{
|
|
1025
|
+
type: "button",
|
|
1026
|
+
onClick: handleUpload,
|
|
1027
|
+
disabled: !file,
|
|
1028
|
+
style: { marginTop: 16 }
|
|
1029
|
+
},
|
|
1030
|
+
"Upload"
|
|
1031
|
+
));
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
// src/Components/OtpElement.tsx
|
|
1035
|
+
var import_react30 = __toESM(require("react"));
|
|
1036
|
+
var import_antd22 = require("antd");
|
|
1037
|
+
var OtpElement = (props) => {
|
|
1038
|
+
const length = props.length;
|
|
1039
|
+
const [otp, setOtp] = (0, import_react30.useState)(Array(length).fill(""));
|
|
1040
|
+
const inputRefs = (0, import_react30.useRef)([]);
|
|
1041
|
+
const handleChange = (e, index) => {
|
|
1042
|
+
const value = e.target.value;
|
|
1043
|
+
if (/^[0-9]$/.test(value) || value === "") {
|
|
1044
|
+
const newOtp = [...otp];
|
|
1045
|
+
newOtp[index] = value;
|
|
1046
|
+
setOtp(newOtp);
|
|
1047
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1048
|
+
if (value && index < length - 1) {
|
|
1049
|
+
inputRefs.current[index + 1]?.focus();
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
const handleKeyDown = (e, index) => {
|
|
1054
|
+
if (e.key === "Backspace" && !otp[index] && index > 0) {
|
|
1055
|
+
inputRefs.current[index - 1]?.focus();
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
const handlePaste = (e) => {
|
|
1059
|
+
e.preventDefault();
|
|
1060
|
+
const pasteData = e.clipboardData.getData("text");
|
|
1061
|
+
if (/^\d+$/.test(pasteData)) {
|
|
1062
|
+
const newOtp = pasteData.split("").slice(0, length);
|
|
1063
|
+
setOtp(newOtp.concat(Array(length - newOtp.length).fill("")));
|
|
1064
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1065
|
+
newOtp.forEach((_, idx) => {
|
|
1066
|
+
if (inputRefs.current[idx]) {
|
|
1067
|
+
inputRefs.current[idx]?.focus();
|
|
1068
|
+
}
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1072
|
+
(0, import_react30.useEffect)(() => {
|
|
1073
|
+
inputRefs.current[0]?.focus();
|
|
1074
|
+
}, []);
|
|
1075
|
+
return /* @__PURE__ */ import_react30.default.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ import_react30.default.createElement(
|
|
1076
|
+
import_antd22.Input,
|
|
1077
|
+
{
|
|
1078
|
+
key: index,
|
|
1079
|
+
className: props.className,
|
|
1080
|
+
maxLength: 1,
|
|
1081
|
+
value: otp[index],
|
|
1082
|
+
onChange: (e) => handleChange(e, index),
|
|
1083
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
1084
|
+
onPaste: handlePaste,
|
|
1085
|
+
ref: (el) => inputRefs.current[index] = el
|
|
1086
|
+
}
|
|
1087
|
+
)));
|
|
1088
|
+
};
|
|
1089
|
+
|
|
1090
|
+
// src/Components/Donut.tsx
|
|
1091
|
+
var import_react31 = __toESM(require("react"));
|
|
1092
|
+
var import_highcharts = __toESM(require("highcharts"));
|
|
1093
|
+
var import_highcharts_react_official = __toESM(require("highcharts-react-official"));
|
|
1094
|
+
var HighchartsChart = ({ options }) => {
|
|
1095
|
+
return /* @__PURE__ */ import_react31.default.createElement(import_highcharts_react_official.default, { highcharts: import_highcharts.default, options });
|
|
1096
|
+
};
|
|
1097
|
+
console.log(HighchartsChart);
|
|
1098
|
+
console.log(typeof HighchartsChart);
|
|
1099
|
+
var Donut = (props) => {
|
|
1100
|
+
const chartOptions = {
|
|
1101
|
+
title: {
|
|
1102
|
+
text: "Distribution of Students"
|
|
1103
|
+
},
|
|
1104
|
+
plotOptions: {
|
|
1105
|
+
pie: {
|
|
1106
|
+
innerSize: "70%",
|
|
1107
|
+
dataLabels: {
|
|
1108
|
+
enabled: false,
|
|
1109
|
+
format: "<b>{point.name}</b>: {point.percentage:.1f} %"
|
|
1110
|
+
},
|
|
1111
|
+
showInLegend: true
|
|
1112
|
+
}
|
|
1113
|
+
},
|
|
1114
|
+
series: [
|
|
1115
|
+
{
|
|
1116
|
+
type: "pie",
|
|
1117
|
+
name: "Percentage",
|
|
1118
|
+
data: [
|
|
1119
|
+
{
|
|
1120
|
+
name: "Girls",
|
|
1121
|
+
y: 20,
|
|
1122
|
+
color: "#FF6384"
|
|
1123
|
+
// Custom color for Girls
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
name: "Boys",
|
|
1127
|
+
y: 40,
|
|
1128
|
+
color: "#36A2EB"
|
|
1129
|
+
// Custom color for Boys
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
name: "Students",
|
|
1133
|
+
y: 40,
|
|
1134
|
+
color: "#FFCE56"
|
|
1135
|
+
// Custom color for Students
|
|
1136
|
+
}
|
|
1137
|
+
]
|
|
1138
|
+
}
|
|
1139
|
+
]
|
|
1140
|
+
};
|
|
1141
|
+
return /* @__PURE__ */ import_react31.default.createElement(import_react31.default.Fragment, null, /* @__PURE__ */ import_react31.default.createElement(HighchartsChart, { highcharts: import_highcharts.default, options: chartOptions }));
|
|
1142
|
+
};
|
|
921
1143
|
// Annotate the CommonJS export names for ESM import in node:
|
|
922
1144
|
0 && (module.exports = {
|
|
923
1145
|
AddMoreTable,
|
|
@@ -926,20 +1148,24 @@ var TabsElement = (props) => {
|
|
|
926
1148
|
CkEditor,
|
|
927
1149
|
DatePickerElement,
|
|
928
1150
|
DateRangePickerElement,
|
|
1151
|
+
Donut,
|
|
929
1152
|
DropDownGroup,
|
|
930
1153
|
FileUpload,
|
|
931
1154
|
Image,
|
|
932
1155
|
MultipleSelectElement,
|
|
933
1156
|
Navbar,
|
|
934
1157
|
NumberElement,
|
|
1158
|
+
OtpElement,
|
|
935
1159
|
PasswordElement,
|
|
936
1160
|
RadioElement,
|
|
937
1161
|
SelectElement,
|
|
938
1162
|
Sidebar,
|
|
939
1163
|
SingleCheckbox,
|
|
940
1164
|
SingleSelectElement,
|
|
1165
|
+
SwitchElement,
|
|
941
1166
|
TableElement,
|
|
942
1167
|
TabsElement,
|
|
943
1168
|
TextElement,
|
|
944
|
-
TextareaElement
|
|
1169
|
+
TextareaElement,
|
|
1170
|
+
Upload
|
|
945
1171
|
});
|