@flozy/editor 1.1.2 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. package/dist/Editor/CollaborativeEditor.js +7 -2
  2. package/dist/Editor/CommonEditor.js +53 -34
  3. package/dist/Editor/Editor.css +93 -17
  4. package/dist/Editor/Elements/Accordion/Accordion.js +67 -2
  5. package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +20 -0
  6. package/dist/Editor/Elements/Accordion/AccordionButton.js +2 -1
  7. package/dist/Editor/Elements/Accordion/AccordionSummary.js +59 -4
  8. package/dist/Editor/Elements/Accordion/AccordionTitlePopup.js +20 -0
  9. package/dist/Editor/Elements/Button/ButtonPopup.js +20 -0
  10. package/dist/Editor/Elements/Button/ButtonToolIcon.js +19 -0
  11. package/dist/Editor/Elements/Button/EditorButton.js +124 -0
  12. package/dist/Editor/Elements/Carousel/Arrows.js +39 -0
  13. package/dist/Editor/Elements/Carousel/Carousel.js +82 -0
  14. package/dist/Editor/Elements/Carousel/CarouselButton.js +19 -0
  15. package/dist/Editor/Elements/Carousel/CarouselItem.js +13 -0
  16. package/dist/Editor/Elements/Carousel/slick-theme.min.css +143 -0
  17. package/dist/Editor/Elements/Carousel/slick.min.css +83 -0
  18. package/dist/Editor/Elements/Color Picker/ColorPicker.js +1 -1
  19. package/dist/Editor/Elements/Embed/Embed.css +22 -2
  20. package/dist/Editor/Elements/Embed/Embed.js +89 -74
  21. package/dist/Editor/Elements/Embed/EmbedPopup.js +23 -0
  22. package/dist/Editor/Elements/Embed/Image.js +92 -10
  23. package/dist/Editor/Elements/Embed/Video.js +1 -0
  24. package/dist/Editor/Elements/Equation/EquationButton.js +12 -12
  25. package/dist/Editor/Elements/Grid/Grid.js +64 -8
  26. package/dist/Editor/Elements/Grid/GridButton.js +2 -4
  27. package/dist/Editor/Elements/Grid/GridItem.js +59 -5
  28. package/dist/Editor/Elements/Grid/GridItemPopup.js +20 -0
  29. package/dist/Editor/Elements/Grid/GridPopup.js +22 -0
  30. package/dist/Editor/Elements/ID/Id.js +1 -1
  31. package/dist/Editor/Elements/ImageText/ImageText.js +14 -0
  32. package/dist/Editor/Elements/ImageText/ImageTextWrapper.js +14 -0
  33. package/dist/Editor/Elements/Link/LinkButton.js +1 -1
  34. package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -1
  35. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +88 -0
  36. package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +22 -0
  37. package/dist/Editor/Elements/Signature/Signature.js +4 -2
  38. package/dist/Editor/Elements/Signature/SignatureButton.js +2 -1
  39. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +7 -2
  40. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -1
  41. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +50 -0
  42. package/dist/Editor/Elements/Signature/SignatureOptions/index.js +2 -1
  43. package/dist/Editor/Elements/Signature/SignaturePopup.js +79 -10
  44. package/dist/Editor/Elements/Table/DeleteCellIcon.js +24 -0
  45. package/dist/Editor/Elements/Table/DeleteRowIcon.js +24 -0
  46. package/dist/Editor/Elements/Table/Table.js +9 -1
  47. package/dist/Editor/Elements/Table/TableCell.js +181 -0
  48. package/dist/Editor/Elements/Table/TablePopup.js +22 -0
  49. package/dist/Editor/Elements/Table/TableRow.js +31 -0
  50. package/dist/Editor/Elements/Table/TableSelector.js +62 -68
  51. package/dist/Editor/Toolbar/Toolbar.js +22 -7
  52. package/dist/Editor/Toolbar/styles.css +20 -11
  53. package/dist/Editor/Toolbar/toolbarGroups.js +9 -9
  54. package/dist/Editor/common/Button.js +4 -8
  55. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +23 -0
  56. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +35 -0
  57. package/dist/Editor/common/StyleBuilder/buttonStyle.js +47 -0
  58. package/dist/Editor/common/StyleBuilder/embedImageStyle.js +63 -0
  59. package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +88 -0
  60. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +87 -0
  61. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +136 -0
  62. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +126 -0
  63. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +89 -0
  64. package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +110 -0
  65. package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +42 -0
  66. package/dist/Editor/common/StyleBuilder/fieldTypes/imageTexts.js +75 -0
  67. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +21 -0
  68. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +46 -0
  69. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +51 -0
  70. package/dist/Editor/common/StyleBuilder/gridStyle.js +51 -0
  71. package/dist/Editor/common/StyleBuilder/index.js +114 -0
  72. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +10 -0
  73. package/dist/Editor/common/StyleBuilder/tableStyle.js +38 -0
  74. package/dist/Editor/common/Uploader.js +87 -0
  75. package/dist/Editor/plugins/withEmbeds.js +12 -5
  76. package/dist/Editor/plugins/withTable.js +5 -4
  77. package/dist/Editor/service/fileupload.js +17 -0
  78. package/dist/Editor/utils/SlateUtilityFunctions.js +46 -12
  79. package/dist/Editor/utils/button.js +11 -0
  80. package/dist/Editor/utils/carousel.js +13 -0
  81. package/dist/Editor/utils/carouselItem.js +19 -0
  82. package/dist/Editor/utils/customHooks/useContextMenu.js +8 -8
  83. package/dist/Editor/utils/customHooks/useResize.js +1 -1
  84. package/dist/Editor/utils/font.js +4 -4
  85. package/dist/Editor/utils/helper.js +16 -0
  86. package/dist/Editor/utils/imageText.js +19 -0
  87. package/dist/Editor/utils/table.js +172 -0
  88. package/package.json +2 -1
@@ -0,0 +1,63 @@
1
+ const embedImageStyle = [{
2
+ tab: "Image Texts",
3
+ value: "imageTexts",
4
+ fields: [{
5
+ label: "Image Texts",
6
+ key: "imageTexts",
7
+ type: "imageTexts"
8
+ }]
9
+ }, {
10
+ tab: "Banner Spacing",
11
+ value: "bannerSpacing",
12
+ fields: [{
13
+ label: "Banner Spacing",
14
+ key: "bannerSpacing",
15
+ type: "bannerSpacing"
16
+ }]
17
+ }, {
18
+ tab: "Position",
19
+ value: "position",
20
+ fields: [{
21
+ label: "Set Postion (Vertical & Horizantal)",
22
+ key: "alignment",
23
+ type: "alignment"
24
+ }]
25
+ }, {
26
+ tab: "Colors",
27
+ value: "colors",
28
+ fields: [{
29
+ label: "Text",
30
+ key: "textColor",
31
+ type: "color",
32
+ needPreview: true
33
+ }, {
34
+ label: "Background",
35
+ key: "bgColor",
36
+ type: "color"
37
+ }, {
38
+ label: "Border",
39
+ key: "borderColor",
40
+ type: "color"
41
+ }]
42
+ }, {
43
+ tab: "URL",
44
+ value: "url",
45
+ fields: [{
46
+ label: "URL",
47
+ key: "url",
48
+ type: "text"
49
+ }, {
50
+ label: "File",
51
+ key: "url",
52
+ type: "backgroundImage"
53
+ }]
54
+ }, {
55
+ tab: "Size",
56
+ value: "elementSize",
57
+ fields: [{
58
+ label: "Element Size",
59
+ key: "size",
60
+ type: "elementSize"
61
+ }]
62
+ }];
63
+ export default embedImageStyle;
@@ -0,0 +1,88 @@
1
+ import React from "react";
2
+ import { Grid, Radio, RadioGroup, FormControl, FormLabel, FormControlLabel } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const Alignment = props => {
6
+ const {
7
+ value,
8
+ data,
9
+ onChange
10
+ } = props;
11
+ const {
12
+ key
13
+ } = data;
14
+ const handleChange = e => {
15
+ onChange({
16
+ [key]: {
17
+ ...value,
18
+ [e.target.name]: e.target.value
19
+ }
20
+ });
21
+ };
22
+ return /*#__PURE__*/_jsxs(Grid, {
23
+ container: true,
24
+ padding: 3,
25
+ style: {
26
+ paddingTop: "12px"
27
+ },
28
+ spacing: 1,
29
+ children: [/*#__PURE__*/_jsx(Grid, {
30
+ item: true,
31
+ xs: 12,
32
+ children: /*#__PURE__*/_jsxs(FormControl, {
33
+ children: [/*#__PURE__*/_jsx(FormLabel, {
34
+ id: "demo-row-radio-buttons-group-label",
35
+ children: "Horizantal Position"
36
+ }), /*#__PURE__*/_jsxs(RadioGroup, {
37
+ row: true,
38
+ "aria-labelledby": "demo-row-radio-buttons-group-label",
39
+ name: "horizantal",
40
+ value: value?.horizantal || "start",
41
+ onChange: handleChange,
42
+ children: [/*#__PURE__*/_jsx(FormControlLabel, {
43
+ value: "start",
44
+ control: /*#__PURE__*/_jsx(Radio, {}),
45
+ label: "Left"
46
+ }), /*#__PURE__*/_jsx(FormControlLabel, {
47
+ value: "center",
48
+ control: /*#__PURE__*/_jsx(Radio, {}),
49
+ label: "Center"
50
+ }), /*#__PURE__*/_jsx(FormControlLabel, {
51
+ value: "end",
52
+ control: /*#__PURE__*/_jsx(Radio, {}),
53
+ label: "Right"
54
+ })]
55
+ })]
56
+ })
57
+ }), /*#__PURE__*/_jsx(Grid, {
58
+ item: true,
59
+ xs: 12,
60
+ children: /*#__PURE__*/_jsxs(FormControl, {
61
+ children: [/*#__PURE__*/_jsx(FormLabel, {
62
+ id: "demo-row-radio-buttons-group-label",
63
+ children: "Vertical Position"
64
+ }), /*#__PURE__*/_jsxs(RadioGroup, {
65
+ row: true,
66
+ "aria-labelledby": "demo-row-radio-buttons-group-label",
67
+ name: "vertical",
68
+ value: value?.vertical || "start",
69
+ onChange: handleChange,
70
+ children: [/*#__PURE__*/_jsx(FormControlLabel, {
71
+ value: "start",
72
+ control: /*#__PURE__*/_jsx(Radio, {}),
73
+ label: "Top"
74
+ }), /*#__PURE__*/_jsx(FormControlLabel, {
75
+ value: "center",
76
+ control: /*#__PURE__*/_jsx(Radio, {}),
77
+ label: "Middle"
78
+ }), /*#__PURE__*/_jsx(FormControlLabel, {
79
+ value: "end",
80
+ control: /*#__PURE__*/_jsx(Radio, {}),
81
+ label: "Bottom"
82
+ })]
83
+ })]
84
+ })
85
+ })]
86
+ });
87
+ };
88
+ export default Alignment;
@@ -0,0 +1,87 @@
1
+ import React, { useState } from "react";
2
+ import { Grid, Button } from "@mui/material";
3
+ import CloudUploadIcon from "@mui/icons-material/CloudUpload";
4
+ import { convertBase64 } from "../../../utils/helper";
5
+ import { uploadFile } from "../../../service/fileupload";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ const BackgroundImage = props => {
9
+ const {
10
+ value,
11
+ data,
12
+ customProps,
13
+ onChange
14
+ } = props;
15
+ const {
16
+ key
17
+ } = data;
18
+ const [base64, setBase64] = useState(value);
19
+ const [uploading, setUploading] = useState(false);
20
+ const handleChange = async e => {
21
+ const file = e.target.files[0];
22
+ const strImage = await convertBase64(file);
23
+ setBase64(strImage);
24
+ doUpload(strImage);
25
+ };
26
+ const doUpload = async strImage => {
27
+ setUploading(true);
28
+ const result = await uploadFile({
29
+ image: strImage
30
+ }, customProps);
31
+ setUploading(false);
32
+ if (result && result?.imageURL) {
33
+ onChange({
34
+ [key]: result?.imageURL
35
+ });
36
+ }
37
+ };
38
+ const onRemoveBG = () => {
39
+ setBase64(null);
40
+ onChange({
41
+ [key]: "none"
42
+ });
43
+ };
44
+ return /*#__PURE__*/_jsxs(Grid, {
45
+ container: true,
46
+ padding: 3,
47
+ children: [/*#__PURE__*/_jsxs(Grid, {
48
+ item: true,
49
+ xs: 12,
50
+ style: {
51
+ display: "flex"
52
+ },
53
+ justifyContent: "center",
54
+ alignItems: "center",
55
+ children: [/*#__PURE__*/_jsxs(Button, {
56
+ component: "label",
57
+ variant: "contained",
58
+ startIcon: /*#__PURE__*/_jsx(CloudUploadIcon, {}),
59
+ children: ["Upload file", /*#__PURE__*/_jsx("input", {
60
+ type: "file",
61
+ style: {
62
+ opacity: 0
63
+ },
64
+ onChange: handleChange
65
+ })]
66
+ }), /*#__PURE__*/_jsx("input", {
67
+ type: "checkbox",
68
+ value: "none",
69
+ checked: value === "none",
70
+ onChange: onRemoveBG
71
+ }), " ", "None"]
72
+ }), uploading ? "Uploading..." : "", /*#__PURE__*/_jsx(Grid, {
73
+ item: true,
74
+ xs: 12,
75
+ style: {
76
+ marginTop: "12px",
77
+ width: "100%",
78
+ backgroundImage: base64 ? `url(${base64})` : "none",
79
+ height: "100px",
80
+ backgroundPosition: "center",
81
+ backgroundSize: "contain",
82
+ backgroundRepeat: "no-repeat"
83
+ }
84
+ })]
85
+ });
86
+ };
87
+ export default BackgroundImage;
@@ -0,0 +1,136 @@
1
+ import React from "react";
2
+ import { Grid } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const BANNER_SPACING_KEYS = ["top", "left", "right", "bottom"];
6
+ const BannerSpacing = props => {
7
+ const {
8
+ value,
9
+ data,
10
+ onChange,
11
+ elementProps
12
+ } = props;
13
+ const {
14
+ lockSpacing
15
+ } = elementProps || {};
16
+ const {
17
+ key
18
+ } = data;
19
+ const handleChange = e => {
20
+ let changeAll = {};
21
+ if (lockSpacing) {
22
+ BANNER_SPACING_KEYS.forEach(m => {
23
+ changeAll[m] = e.target.value;
24
+ });
25
+ }
26
+ onChange({
27
+ [key]: {
28
+ ...value,
29
+ [e.target.name]: e.target.value,
30
+ ...changeAll
31
+ }
32
+ });
33
+ };
34
+ const onLockSpacing = () => {
35
+ onChange({
36
+ lockSpacing: !lockSpacing
37
+ });
38
+ };
39
+ return /*#__PURE__*/_jsx(Grid, {
40
+ container: true,
41
+ padding: 4,
42
+ children: /*#__PURE__*/_jsx(Grid, {
43
+ item: true,
44
+ xs: 12,
45
+ style: {
46
+ display: "flex"
47
+ },
48
+ justifyContent: "center",
49
+ children: /*#__PURE__*/_jsxs("div", {
50
+ style: {
51
+ width: "100px",
52
+ height: "100px",
53
+ border: "1px solid blue",
54
+ backgroundColor: "antiquewhite",
55
+ position: "relative",
56
+ display: "flex",
57
+ padding: `${value?.top}px ${value?.right}px ${value?.bottom}px ${value?.left}px`
58
+ },
59
+ children: [/*#__PURE__*/_jsx("div", {
60
+ style: {
61
+ border: "1px solid blue",
62
+ width: "100%"
63
+ }
64
+ }), /*#__PURE__*/_jsx("input", {
65
+ type: "text",
66
+ name: "left",
67
+ value: value?.left,
68
+ style: {
69
+ position: "absolute",
70
+ left: "-28px",
71
+ top: 0,
72
+ bottom: 0,
73
+ width: "16px",
74
+ height: "16px",
75
+ margin: "auto"
76
+ },
77
+ onChange: handleChange
78
+ }), /*#__PURE__*/_jsx("input", {
79
+ type: "text",
80
+ name: "top",
81
+ value: value?.top,
82
+ style: {
83
+ position: "absolute",
84
+ right: 0,
85
+ left: 0,
86
+ top: "-28px",
87
+ width: "16px",
88
+ height: "16px",
89
+ margin: "auto"
90
+ },
91
+ onChange: handleChange
92
+ }), /*#__PURE__*/_jsx("input", {
93
+ type: "text",
94
+ name: "right",
95
+ value: value?.right,
96
+ style: {
97
+ position: "absolute",
98
+ right: "-28px",
99
+ top: 0,
100
+ bottom: 0,
101
+ width: "16px",
102
+ height: "16px",
103
+ margin: "auto"
104
+ },
105
+ onChange: handleChange
106
+ }), /*#__PURE__*/_jsx("input", {
107
+ type: "text",
108
+ name: "bottom",
109
+ value: value?.bottom,
110
+ style: {
111
+ position: "absolute",
112
+ right: 0,
113
+ left: 0,
114
+ bottom: "-28px",
115
+ width: "16px",
116
+ height: "16px",
117
+ margin: "auto"
118
+ },
119
+ onChange: handleChange
120
+ }), /*#__PURE__*/_jsx("button", {
121
+ style: {
122
+ position: "absolute",
123
+ right: 0,
124
+ left: 0,
125
+ top: 0,
126
+ bottom: 0,
127
+ background: "none"
128
+ },
129
+ onClick: onLockSpacing,
130
+ children: lockSpacing ? "Un-Lock" : "Lock"
131
+ })]
132
+ })
133
+ })
134
+ });
135
+ };
136
+ export default BannerSpacing;
@@ -0,0 +1,126 @@
1
+ import React from "react";
2
+ import { Grid } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const BORDER_RADIUS_KEYS = ["topLeft", "topRight", "bottomLeft", "bottomRight"];
6
+ const BorderRadius = props => {
7
+ const {
8
+ value,
9
+ data,
10
+ onChange,
11
+ elementProps
12
+ } = props;
13
+ const {
14
+ lockRadius,
15
+ borderColor
16
+ } = elementProps;
17
+ const {
18
+ key
19
+ } = data;
20
+ const handleChange = e => {
21
+ let changeAll = {};
22
+ if (lockRadius) {
23
+ BORDER_RADIUS_KEYS.forEach(m => {
24
+ changeAll[m] = e.target.value;
25
+ });
26
+ }
27
+ onChange({
28
+ [key]: {
29
+ ...value,
30
+ [e.target.name]: e.target.value,
31
+ ...changeAll
32
+ }
33
+ });
34
+ };
35
+ const onLockRadius = () => {
36
+ onChange({
37
+ lockRadius: !lockRadius
38
+ });
39
+ };
40
+ return /*#__PURE__*/_jsx(Grid, {
41
+ container: true,
42
+ padding: 4,
43
+ children: /*#__PURE__*/_jsx(Grid, {
44
+ item: true,
45
+ xs: 12,
46
+ style: {
47
+ display: "flex"
48
+ },
49
+ justifyContent: "center",
50
+ alignContent: "center",
51
+ children: /*#__PURE__*/_jsxs("div", {
52
+ style: {
53
+ width: "100px",
54
+ height: "100px",
55
+ border: "1px solid blue",
56
+ position: "relative",
57
+ display: "flex",
58
+ borderColor: `${borderColor}`,
59
+ borderRadius: `${value?.topLeft}px ${value?.topRight}px ${value?.bottomLeft}px ${value?.bottomRight}px`
60
+ },
61
+ children: [/*#__PURE__*/_jsx("input", {
62
+ type: "text",
63
+ name: "topLeft",
64
+ value: value?.topLeft,
65
+ style: {
66
+ position: "absolute",
67
+ left: "-25px",
68
+ top: "-28px",
69
+ width: "16px",
70
+ height: "16px",
71
+ margin: "auto"
72
+ },
73
+ onChange: handleChange
74
+ }), /*#__PURE__*/_jsx("input", {
75
+ type: "text",
76
+ name: "topRight",
77
+ value: value?.topRight,
78
+ style: {
79
+ position: "absolute",
80
+ top: "-28px",
81
+ right: "-25px",
82
+ width: "16px",
83
+ height: "16px"
84
+ },
85
+ onChange: handleChange
86
+ }), /*#__PURE__*/_jsx("input", {
87
+ type: "text",
88
+ name: "bottomLeft",
89
+ value: value?.bottomLeft,
90
+ style: {
91
+ position: "absolute",
92
+ left: "-25px",
93
+ bottom: "-28px",
94
+ width: "16px",
95
+ height: "16px"
96
+ },
97
+ onChange: handleChange
98
+ }), /*#__PURE__*/_jsx("input", {
99
+ type: "text",
100
+ name: "bottomRight",
101
+ value: value?.bottomRight,
102
+ style: {
103
+ position: "absolute",
104
+ bottom: "-28px",
105
+ right: "-25px",
106
+ width: "16px",
107
+ height: "16px"
108
+ },
109
+ onChange: handleChange
110
+ }), /*#__PURE__*/_jsx("button", {
111
+ style: {
112
+ position: "absolute",
113
+ right: 0,
114
+ left: 0,
115
+ top: 0,
116
+ bottom: 0,
117
+ background: "none"
118
+ },
119
+ onClick: onLockRadius,
120
+ children: lockRadius ? "Un-Lock" : "Lock"
121
+ })]
122
+ })
123
+ })
124
+ });
125
+ };
126
+ export default BorderRadius;
@@ -0,0 +1,89 @@
1
+ import React from "react";
2
+ import { Grid, TextField, InputAdornment } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const Color = props => {
6
+ const {
7
+ value,
8
+ data,
9
+ onChange,
10
+ elementProps
11
+ } = props;
12
+ const {
13
+ key,
14
+ label,
15
+ needPreview
16
+ } = data;
17
+ const {
18
+ textColor,
19
+ bgColor,
20
+ borderColor
21
+ } = elementProps;
22
+ const handleChange = e => {
23
+ onChange({
24
+ [key]: e.target.value
25
+ });
26
+ };
27
+ return /*#__PURE__*/_jsxs(Grid, {
28
+ container: true,
29
+ children: [needPreview && /*#__PURE__*/_jsxs(Grid, {
30
+ container: true,
31
+ padding: 3,
32
+ children: [/*#__PURE__*/_jsx(Grid, {
33
+ item: true,
34
+ xs: 12,
35
+ style: {
36
+ padding: "8px",
37
+ color: textColor,
38
+ backgroundColor: bgColor,
39
+ border: `1px solid ${borderColor}`
40
+ },
41
+ children: "Text Content"
42
+ }), /*#__PURE__*/_jsx("span", {
43
+ style: {
44
+ color: "#CCC"
45
+ },
46
+ children: "*Select Checkbox for no color"
47
+ })]
48
+ }), /*#__PURE__*/_jsx(Grid, {
49
+ item: true,
50
+ xs: 12,
51
+ style: {
52
+ margin: "12px",
53
+ display: "flex",
54
+ alignItems: "cente",
55
+ justifyContent: "space-between"
56
+ },
57
+ children: /*#__PURE__*/_jsx(Grid, {
58
+ item: true,
59
+ xs: 12,
60
+ children: /*#__PURE__*/_jsx(TextField, {
61
+ fullWidth: true,
62
+ value: value,
63
+ label: label,
64
+ placeholder: label,
65
+ InputLabelProps: {
66
+ shrink: true
67
+ },
68
+ InputProps: {
69
+ endAdornment: /*#__PURE__*/_jsxs(InputAdornment, {
70
+ position: "end",
71
+ children: [/*#__PURE__*/_jsx("input", {
72
+ type: "color",
73
+ value: value,
74
+ name: "textColor",
75
+ onChange: handleChange
76
+ }), /*#__PURE__*/_jsx("input", {
77
+ type: "checkbox",
78
+ onChange: handleChange,
79
+ value: "rgba(0,0,0,0)",
80
+ checked: value === "rgba(0,0,0,0)"
81
+ })]
82
+ })
83
+ }
84
+ })
85
+ })
86
+ })]
87
+ });
88
+ };
89
+ export default Color;
@@ -0,0 +1,110 @@
1
+ import React from "react";
2
+ import { Grid, IconButton, InputAdornment, TextField } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const ElementSize = props => {
6
+ const {
7
+ value,
8
+ data,
9
+ onChange
10
+ } = props;
11
+ const {
12
+ key
13
+ } = data;
14
+ const widthType = value?.widthType ? value?.widthType : value?.widthInPercent ? "%" : "px";
15
+ const wkey = widthType === "%" ? "widthInPercent" : "width";
16
+ const handleChange = e => {
17
+ onChange({
18
+ [key]: {
19
+ ...(value || {}),
20
+ [e.target.name]: isNaN(e.target.value) ? "" : parseInt(e.target.value)
21
+ }
22
+ });
23
+ };
24
+ const onSizeType = cData => () => {
25
+ onChange({
26
+ [key]: {
27
+ ...(value || {}),
28
+ ...cData
29
+ }
30
+ });
31
+ };
32
+ return /*#__PURE__*/_jsxs(Grid, {
33
+ container: true,
34
+ padding: 3,
35
+ spacing: 2,
36
+ className: "input-adorn",
37
+ children: [/*#__PURE__*/_jsx(Grid, {
38
+ item: true,
39
+ xs: 12,
40
+ md: 6,
41
+ children: /*#__PURE__*/_jsx(TextField, {
42
+ fullWidth: true,
43
+ name: wkey,
44
+ label: "Width",
45
+ size: "small",
46
+ value: value ? value[wkey] : "100",
47
+ placeholder: "Width",
48
+ onChange: handleChange,
49
+ InputProps: {
50
+ endAdornment: /*#__PURE__*/_jsxs(InputAdornment, {
51
+ position: "end",
52
+ children: [/*#__PURE__*/_jsx(IconButton, {
53
+ className: widthType === "px" ? "active" : "",
54
+ size: "small",
55
+ onClick: onSizeType({
56
+ widthType: "px",
57
+ widthInPercent: null,
58
+ width: isNaN(value?.width) ? 100 : value?.width || 100
59
+ }),
60
+ children: "PX"
61
+ }), /*#__PURE__*/_jsx(IconButton, {
62
+ className: widthType === "%" ? "active" : "",
63
+ size: "small",
64
+ onClick: onSizeType({
65
+ widthType: "%",
66
+ widthInPercent: value?.widthInPercent || 100
67
+ }),
68
+ children: "%"
69
+ })]
70
+ })
71
+ }
72
+ })
73
+ }), /*#__PURE__*/_jsx(Grid, {
74
+ item: true,
75
+ xs: 12,
76
+ md: 6,
77
+ children: /*#__PURE__*/_jsx(TextField, {
78
+ fullWidth: true,
79
+ name: "height",
80
+ size: "small",
81
+ label: "Height",
82
+ value: value?.height,
83
+ placeholder: "Height",
84
+ helperText: "Leave it to auto if width is in % ",
85
+ onChange: handleChange,
86
+ InputProps: {
87
+ endAdornment: /*#__PURE__*/_jsxs(InputAdornment, {
88
+ position: "end",
89
+ children: [/*#__PURE__*/_jsx(IconButton, {
90
+ className: value?.height !== "" ? "active" : "",
91
+ size: "small",
92
+ onClick: onSizeType({
93
+ height: value?.height || ""
94
+ }),
95
+ children: "PX"
96
+ }), /*#__PURE__*/_jsx(IconButton, {
97
+ className: value?.height === "" ? "active" : "",
98
+ size: "small",
99
+ onClick: onSizeType({
100
+ height: ""
101
+ }),
102
+ children: "auto"
103
+ })]
104
+ })
105
+ }
106
+ })
107
+ })]
108
+ });
109
+ };
110
+ export default ElementSize;