@flozy/editor 9.8.5 → 9.8.7

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.
Files changed (137) hide show
  1. package/dist/Editor/ChatEditor.js +17 -16
  2. package/dist/Editor/CommonEditor.js +119 -17
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +17 -9
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
  6. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  7. package/dist/Editor/Elements/Button/EditorButton.js +25 -9
  8. package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
  9. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  10. package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
  11. package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
  12. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +4 -2
  13. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +448 -0
  14. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +21 -6
  15. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +5 -1
  16. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +3 -2
  17. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +11 -0
  18. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +8 -4
  19. package/dist/Editor/Elements/Embed/Image.js +2 -2
  20. package/dist/Editor/Elements/Embed/Video.js +1 -1
  21. package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
  22. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +48 -22
  23. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +25 -4
  24. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +46 -3
  25. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -2
  26. package/dist/Editor/Elements/FreeGrid/styles.js +3 -0
  27. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  28. package/dist/Editor/Elements/List/CheckList.js +4 -1
  29. package/dist/Editor/Elements/SimpleText/index.js +9 -1
  30. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  31. package/dist/Editor/Elements/Table/Table.js +3 -3
  32. package/dist/Editor/Elements/Title/title.js +6 -6
  33. package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
  34. package/dist/Editor/MiniEditor.js +2 -1
  35. package/dist/Editor/Styles/EditorStyles.js +5 -5
  36. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  37. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  38. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  39. package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
  40. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +4 -2
  41. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  42. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
  43. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +7 -4
  44. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
  45. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +72 -12
  46. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +95 -23
  47. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
  48. package/dist/Editor/Toolbar/PopupTool/index.js +1 -1
  49. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  50. package/dist/Editor/assets/svg/BackIcon.js +18 -0
  51. package/dist/Editor/assets/svg/ClearAllRounded.js +31 -0
  52. package/dist/Editor/assets/svg/ResetIconNew.js +23 -0
  53. package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
  54. package/dist/Editor/common/ColorPickerButton.js +38 -16
  55. package/dist/Editor/common/CustomColorPicker/index.js +131 -0
  56. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  57. package/dist/Editor/common/CustomDialog2/index.js +94 -0
  58. package/dist/Editor/common/CustomDialog2/style.js +67 -0
  59. package/dist/Editor/common/CustomSelect.js +43 -0
  60. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  61. package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
  62. package/dist/Editor/common/Icon.js +31 -1
  63. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  64. package/dist/Editor/common/RnD/ContextMenu/CMenus.js +24 -0
  65. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  66. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  67. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  68. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  69. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  70. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  71. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  72. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  73. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +3 -1
  74. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  75. package/dist/Editor/common/RnD/ShadowElement.js +2 -1
  76. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +8 -2
  77. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  78. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  79. package/dist/Editor/common/RnD/Utils/gridDropItem.js +73 -9
  80. package/dist/Editor/common/RnD/Utils/index.js +3 -0
  81. package/dist/Editor/common/RnD/VirtualElement/BoxHeaderAutoAlignment.js +43 -0
  82. package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +44 -0
  83. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +134 -0
  84. package/dist/Editor/common/RnD/VirtualElement/helper.js +382 -0
  85. package/dist/Editor/common/RnD/VirtualElement/index.js +187 -103
  86. package/dist/Editor/common/RnD/VirtualElement/styles.js +155 -7
  87. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +5 -3
  88. package/dist/Editor/common/RnD/index.js +59 -3
  89. package/dist/Editor/common/Shorthands/elements.js +54 -0
  90. package/dist/Editor/common/SnackBar/index.js +43 -0
  91. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  92. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  93. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  94. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  95. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
  96. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
  97. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
  98. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +7 -6
  99. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  100. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +5 -7
  101. package/dist/Editor/common/Uploader.js +8 -0
  102. package/dist/Editor/common/iconslist.js +7 -8
  103. package/dist/Editor/commonStyle.js +95 -60
  104. package/dist/Editor/helper/textIndeces.js +58 -0
  105. package/dist/Editor/helper/theme.js +202 -2
  106. package/dist/Editor/hooks/useAutoScroll.js +38 -0
  107. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  108. package/dist/Editor/hooks/useMouseMove.js +9 -3
  109. package/dist/Editor/hooks/useThemeValues.js +63 -0
  110. package/dist/Editor/plugins/withEmbeds.js +1 -1
  111. package/dist/Editor/plugins/withHTML.js +10 -7
  112. package/dist/Editor/plugins/withLinks.js +9 -10
  113. package/dist/Editor/plugins/withTable.js +1 -1
  114. package/dist/Editor/theme/ThemeList.js +50 -173
  115. package/dist/Editor/theme/index.js +149 -0
  116. package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
  117. package/dist/Editor/themeSettings/buttons/index.js +290 -0
  118. package/dist/Editor/themeSettings/buttons/style.js +23 -0
  119. package/dist/Editor/themeSettings/colorTheme/index.js +309 -0
  120. package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
  121. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  122. package/dist/Editor/themeSettings/fonts/index.js +240 -0
  123. package/dist/Editor/themeSettings/fonts/style.js +62 -0
  124. package/dist/Editor/themeSettings/icons.js +60 -0
  125. package/dist/Editor/themeSettings/index.js +361 -0
  126. package/dist/Editor/themeSettings/style.js +292 -0
  127. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  128. package/dist/Editor/themeSettingsAI/index.js +355 -0
  129. package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
  130. package/dist/Editor/themeSettingsAI/style.js +324 -0
  131. package/dist/Editor/utils/SlateUtilityFunctions.js +171 -45
  132. package/dist/Editor/utils/button.js +1 -17
  133. package/dist/Editor/utils/draftToSlate.js +3 -2
  134. package/dist/Editor/utils/font.js +40 -37
  135. package/dist/Editor/utils/freegrid.js +2 -3
  136. package/dist/Editor/utils/helper.js +90 -19
  137. package/package.json +4 -4
@@ -0,0 +1,309 @@
1
+ import React from "react";
2
+ import { Accordion, AccordionDetails, AccordionSummary, Divider, FormControlLabel, Grid, IconButton, Radio, RadioGroup, ToggleButton, ToggleButtonGroup, Typography, styled } from "@mui/material";
3
+
4
+ // Style
5
+ import Style from "./style";
6
+
7
+ // icons
8
+ import { ChevronLeft, KeyboardArrowDownRounded } from "@mui/icons-material";
9
+ import { EditIcon } from "../icons";
10
+ import ColorPickerButton from "../../common/ColorPickerButton";
11
+ import { getContrastColor } from "../../utils/helper";
12
+ import useCommonStyle from "../../commonStyle";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ const ColorTheme = props => {
16
+ const {
17
+ className,
18
+ colors,
19
+ onColorChange,
20
+ openDefault,
21
+ appTheme,
22
+ openSettings,
23
+ onSettingsChange,
24
+ type
25
+ } = props;
26
+ const classes = useCommonStyle(appTheme);
27
+ const {
28
+ primaryColors,
29
+ otherColors = []
30
+ } = colors || {};
31
+
32
+ // State
33
+ const [customizeTheme, setCustomizeTheme] = React.useState(false);
34
+ const [buttonType, setButtonType] = React.useState("regular");
35
+ const customTheme = [{
36
+ title: "Text & Line Colors",
37
+ data: [{
38
+ title: "Headings",
39
+ color: "#ccc"
40
+ }, {
41
+ title: "Subheading text",
42
+ color: "#ccc"
43
+ }, {
44
+ title: "Body text",
45
+ color: "#ccc"
46
+ }, {
47
+ title: "Subtext",
48
+ color: "#ccc"
49
+ }, {
50
+ title: "Lines & dividers",
51
+ color: "#ccc"
52
+ }]
53
+ }, {
54
+ title: "Background Colors",
55
+ data: [{
56
+ title: "Primary background color",
57
+ color: "#ccc"
58
+ }, {
59
+ title: "Secondary background color",
60
+ color: "#ccc"
61
+ }]
62
+ }];
63
+ const buttonData = [{
64
+ title: "Button background",
65
+ color: "#ccc"
66
+ }, {
67
+ title: "Button text",
68
+ color: "#ccc"
69
+ }, {
70
+ title: "Button border",
71
+ color: "#ccc"
72
+ }];
73
+
74
+ //button
75
+ const handleButtonType = (event, buttonType) => {
76
+ if (buttonType !== null) {
77
+ setButtonType(buttonType);
78
+ }
79
+ };
80
+ return /*#__PURE__*/_jsx(Grid, {
81
+ className: className,
82
+ children: !customizeTheme ? /*#__PURE__*/_jsxs(Accordion, {
83
+ className: "settingAccordion",
84
+ defaultExpanded: openDefault,
85
+ onChange: () => onSettingsChange(type),
86
+ expanded: openSettings === type,
87
+ children: [/*#__PURE__*/_jsx(AccordionSummary, {
88
+ expandIcon: /*#__PURE__*/_jsx(KeyboardArrowDownRounded, {}),
89
+ "aria-controls": "panel1-content",
90
+ id: "panel1-header",
91
+ children: "Color Theme"
92
+ }), /*#__PURE__*/_jsxs(AccordionDetails, {
93
+ children: [/*#__PURE__*/_jsx(Typography, {
94
+ variant: "body2",
95
+ sx: {
96
+ pb: 1
97
+ },
98
+ className: "fs-12 fw-600",
99
+ children: "Primary Color"
100
+ }), /*#__PURE__*/_jsx(Grid, {
101
+ container: true,
102
+ spacing: 1,
103
+ sx: {
104
+ pb: 2
105
+ },
106
+ className: "primaryColorBoxes",
107
+ wrap: "nowrap",
108
+ children: primaryColors?.map((color, i) => {
109
+ const textColor = getContrastColor(color);
110
+ return /*#__PURE__*/_jsx(Grid, {
111
+ item: true,
112
+ xs: 6,
113
+ children: /*#__PURE__*/_jsx(ColorPickerButton, {
114
+ onSave: selectedColor => {
115
+ if (selectedColor) {
116
+ onColorChange(selectedColor, i);
117
+ }
118
+ },
119
+ hideThemeColors: true
120
+ // hideGradient={true}
121
+ ,
122
+ classes: classes,
123
+ value: color,
124
+ children: /*#__PURE__*/_jsxs(Grid, {
125
+ className: "pmBox",
126
+ style: {
127
+ background: color
128
+ },
129
+ children: [/*#__PURE__*/_jsx(IconButton, {
130
+ className: "editBtn",
131
+ children: /*#__PURE__*/_jsx(EditIcon, {})
132
+ }), /*#__PURE__*/_jsx(Typography, {
133
+ variant: "body2",
134
+ className: "fs-12 valyeText",
135
+ style: {
136
+ color: textColor
137
+ },
138
+ children: color
139
+ })]
140
+ })
141
+ })
142
+ }, i);
143
+ })
144
+ }), /*#__PURE__*/_jsx(Typography, {
145
+ variant: "body2",
146
+ sx: {
147
+ pb: 1
148
+ },
149
+ className: "fs-12 fw-600",
150
+ children: "Secondary Colors"
151
+ }), /*#__PURE__*/_jsx(Grid, {
152
+ container: true,
153
+ className: "secondaryColorBoxes",
154
+ wrap: "nowrap",
155
+ sx: {
156
+ mb: 1
157
+ },
158
+ children: otherColors?.slice(0, 4)?.map((color, i) => {
159
+ const noOfPrimaryColors = 2;
160
+ const colorIndex = noOfPrimaryColors + i;
161
+ const textColor = getContrastColor(color);
162
+ return /*#__PURE__*/_jsx(Grid, {
163
+ item: true,
164
+ xs: 6,
165
+ children: /*#__PURE__*/_jsx(ColorPickerButton, {
166
+ onSave: selectedColor => {
167
+ if (selectedColor) {
168
+ onColorChange(selectedColor, colorIndex);
169
+ }
170
+ },
171
+ hideThemeColors: true
172
+ // hideGradient={true}
173
+ ,
174
+ classes: classes,
175
+ value: color,
176
+ children: /*#__PURE__*/_jsxs(Grid, {
177
+ className: "sdBox",
178
+ style: {
179
+ background: color
180
+ },
181
+ children: [/*#__PURE__*/_jsx(IconButton, {
182
+ className: "editBtn",
183
+ children: /*#__PURE__*/_jsx(EditIcon, {})
184
+ }), /*#__PURE__*/_jsx(Typography, {
185
+ variant: "body2",
186
+ className: "fs-10 valyeText",
187
+ style: {
188
+ color: textColor
189
+ },
190
+ children: color
191
+ })]
192
+ })
193
+ })
194
+ }, i);
195
+ })
196
+ })]
197
+ })]
198
+ }) : /*#__PURE__*/_jsxs(Grid, {
199
+ className: "sectionDetail",
200
+ children: [/*#__PURE__*/_jsxs(Typography, {
201
+ variant: "body1",
202
+ className: "sectionTitle flexAlign",
203
+ children: [/*#__PURE__*/_jsx(IconButton, {
204
+ onClick: () => setCustomizeTheme(false),
205
+ children: /*#__PURE__*/_jsx(ChevronLeft, {})
206
+ }), "Customize Theme settings"]
207
+ }), customTheme.map((item, index) => /*#__PURE__*/_jsxs(Grid, {
208
+ className: "settingsSection",
209
+ children: [/*#__PURE__*/_jsx(Typography, {
210
+ variant: "body1",
211
+ className: "sectionTitle",
212
+ sx: {
213
+ pb: 1
214
+ },
215
+ children: item.title
216
+ }), item.data.map((childitem, childIndex) => /*#__PURE__*/_jsxs(Grid, {
217
+ container: true,
218
+ justifyContent: "space-between",
219
+ sx: {
220
+ pt: 2
221
+ },
222
+ children: [/*#__PURE__*/_jsx(Typography, {
223
+ variant: "body1",
224
+ className: "fs-14",
225
+ children: childitem.title
226
+ }), /*#__PURE__*/_jsx(Grid, {
227
+ className: "xsColorBox",
228
+ sx: {
229
+ background: childitem.color
230
+ }
231
+ })]
232
+ }, childIndex))]
233
+ }, index)), /*#__PURE__*/_jsxs(Grid, {
234
+ className: "settingsSection",
235
+ children: [/*#__PURE__*/_jsx(Typography, {
236
+ variant: "body1",
237
+ className: "sectionTitle",
238
+ sx: {
239
+ pb: 1
240
+ },
241
+ children: "Button Colors"
242
+ }), /*#__PURE__*/_jsxs(ToggleButtonGroup, {
243
+ sx: {
244
+ mt: 2
245
+ },
246
+ className: "toggleType",
247
+ value: buttonType,
248
+ exclusive: true,
249
+ onChange: handleButtonType,
250
+ children: [/*#__PURE__*/_jsx(ToggleButton, {
251
+ value: "regular",
252
+ "aria-label": "regulard",
253
+ children: "Regular"
254
+ }), /*#__PURE__*/_jsx(ToggleButton, {
255
+ value: "hover",
256
+ "aria-label": "hover",
257
+ children: "Hover"
258
+ })]
259
+ }), /*#__PURE__*/_jsx(Divider, {
260
+ sx: {
261
+ mt: 2,
262
+ mb: 1
263
+ }
264
+ }), /*#__PURE__*/_jsxs(RadioGroup, {
265
+ sx: {
266
+ mt: 1
267
+ },
268
+ "aria-labelledby": "demo-radio-buttons-group-label",
269
+ defaultValue: "primary",
270
+ name: "radio-buttons-group",
271
+ children: [/*#__PURE__*/_jsx(FormControlLabel, {
272
+ value: "primary",
273
+ control: /*#__PURE__*/_jsx(Radio, {}),
274
+ label: /*#__PURE__*/_jsx(Typography, {
275
+ variant: "body1",
276
+ className: "fs-14",
277
+ children: "Primary button"
278
+ })
279
+ }), /*#__PURE__*/_jsx(FormControlLabel, {
280
+ value: "secondary",
281
+ control: /*#__PURE__*/_jsx(Radio, {}),
282
+ label: /*#__PURE__*/_jsx(Typography, {
283
+ variant: "body1",
284
+ className: "fs-14",
285
+ children: "Secondary button"
286
+ })
287
+ })]
288
+ }), buttonData.map((item, Index) => /*#__PURE__*/_jsxs(Grid, {
289
+ container: true,
290
+ justifyContent: "space-between",
291
+ sx: {
292
+ pt: 2
293
+ },
294
+ children: [/*#__PURE__*/_jsx(Typography, {
295
+ variant: "body1",
296
+ className: "fs-14",
297
+ children: item.title
298
+ }), /*#__PURE__*/_jsx(Grid, {
299
+ className: "xsColorBox",
300
+ sx: {
301
+ background: item.color
302
+ }
303
+ })]
304
+ }, Index))]
305
+ })]
306
+ })
307
+ });
308
+ };
309
+ export default styled(ColorTheme)(Style);
@@ -0,0 +1,81 @@
1
+ const Style = () => ({
2
+ ".primaryColorBoxes": {
3
+ ".pmBox": {
4
+ border: "1px solid #D1D1D1",
5
+ height: "65px",
6
+ borderRadius: "4px",
7
+ position: "relative",
8
+ flexShrink: 0,
9
+ "&:hover": {
10
+ ".editBtn": {
11
+ opacity: "1",
12
+ visibility: "visible"
13
+ }
14
+ }
15
+ }
16
+ },
17
+ ".secondaryColorBoxes": {
18
+ gap: "10px",
19
+ ".sdBox": {
20
+ border: "1px solid #D1D1D1",
21
+ height: "60px",
22
+ borderRadius: "4px",
23
+ width: "100%",
24
+ flexShrink: 0,
25
+ position: "relative",
26
+ "&:hover": {
27
+ ".editBtn": {
28
+ opacity: "1",
29
+ visibility: "visible"
30
+ }
31
+ }
32
+ }
33
+ },
34
+ ".valyeText": {
35
+ position: "absolute",
36
+ right: "5px",
37
+ bottom: "5px",
38
+ whiteSpace: "nowrap",
39
+ overflow: "hidden",
40
+ textOverflow: "ellipsis",
41
+ maxWidth: "calc(100% - 10px)"
42
+ },
43
+ ".editBtn": {
44
+ position: "absolute",
45
+ right: "2px",
46
+ top: "2px",
47
+ padding: "2px",
48
+ opacity: "0",
49
+ visibility: "hidden"
50
+ },
51
+ ".settingsSection": {
52
+ background: "#FFFFFF",
53
+ border: "1px solid #E4E6E9",
54
+ padding: "12px",
55
+ marginTop: "10px",
56
+ borderRadius: "7px"
57
+ },
58
+ ".toggleType": {
59
+ width: "100%",
60
+ border: "1px solid #2563EB",
61
+ background: "#F5F6F9",
62
+ borderRadius: "8px",
63
+ padding: "3px",
64
+ height: "40px",
65
+ ".MuiToggleButton-root": {
66
+ padding: "10px",
67
+ width: "50%",
68
+ border: "none",
69
+ textTransform: "unset",
70
+ fontSize: "14px",
71
+ color: "#64748B",
72
+ "&.Mui-selected": {
73
+ borderRadius: "8px",
74
+ background: "#2563EB",
75
+ color: "#fff",
76
+ fontWeight: "700"
77
+ }
78
+ }
79
+ }
80
+ });
81
+ export default Style;
@@ -0,0 +1,121 @@
1
+ import { Grid, IconButton, Typography } from "@mui/material";
2
+ import { useEditorTheme } from "../../hooks/useEditorTheme";
3
+ import { PenIcon } from "../icons";
4
+ import useWindowResize from "../../hooks/useWindowResize";
5
+ import { getElementProperty } from "../../helper/theme";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ const MAP_TEXT_PLACEHOLDER = {
9
+ h1: "Heading 1",
10
+ h2: "Heading 2",
11
+ h3: "Heading 3",
12
+ h4: "Heading 4",
13
+ h5: "Heading 5",
14
+ h6: "Heading 6",
15
+ para1: "Paragraph 1",
16
+ para2: "Paragraph 2",
17
+ para3: "Paragraph 3"
18
+ };
19
+ const MAP_COMP = {
20
+ para1: "p",
21
+ para2: "p",
22
+ para3: "p"
23
+ };
24
+ function getPreviewElementStyle(styleProperty, elementId) {
25
+ const element = document.getElementById(elementId);
26
+ return getElementProperty(element, styleProperty);
27
+ }
28
+ function getTextSettings(elementId, otherStyles = {}) {
29
+ return {
30
+ fontFamily: getPreviewElementStyle("font-family", elementId),
31
+ fontSize: getPreviewElementStyle("font-size", elementId),
32
+ fontWeight: getPreviewElementStyle("font-weight", elementId),
33
+ fontStyle: getPreviewElementStyle("font-style", elementId),
34
+ textDecoration: getPreviewElementStyle("text-decoration", elementId),
35
+ ...otherStyles
36
+ };
37
+ }
38
+ function getFontSize(fontSize = "", windowSize) {
39
+ let size = "";
40
+ if (typeof fontSize === "string") {
41
+ size = fontSize;
42
+ } else if (typeof fontSize === "object") {
43
+ size = fontSize[windowSize?.device];
44
+ }
45
+ return size?.includes("px") ? size : size + "px";
46
+ }
47
+ function PreviewElement(props) {
48
+ const {
49
+ field,
50
+ selectedField,
51
+ setSelectedField,
52
+ settings,
53
+ setSettings,
54
+ setAnchorEl
55
+ } = props;
56
+ const {
57
+ selectedTheme
58
+ } = useEditorTheme();
59
+ const {
60
+ elementProps = {}
61
+ } = selectedTheme || {};
62
+ const previewElementId = `theme-heading-element-preview-${field}`;
63
+ const Comp = MAP_COMP[field] || field;
64
+ const selectedSettings = selectedField === field ? settings : {};
65
+ const themeStyles = elementProps[field] || {};
66
+ const placeholder = MAP_TEXT_PLACEHOLDER[field];
67
+ const [windowSize] = useWindowResize();
68
+ const fontFamily = getPreviewElementStyle("font-family", previewElementId);
69
+ const {
70
+ fontSize = "",
71
+ color
72
+ } = themeStyles;
73
+ const size = getFontSize(fontSize, windowSize);
74
+ return /*#__PURE__*/_jsxs(Grid, {
75
+ container: true,
76
+ className: "fontTypeItem",
77
+ justifyContent: "space-between",
78
+ alignItems: "center",
79
+ wrap: "nowrap",
80
+ children: [/*#__PURE__*/_jsxs(Grid, {
81
+ item: true,
82
+ children: [/*#__PURE__*/_jsx(Typography, {
83
+ variant: "body1",
84
+ children: /*#__PURE__*/_jsx(Comp, {
85
+ id: previewElementId,
86
+ style: {
87
+ ...themeStyles,
88
+ ...selectedSettings,
89
+ fontSize: size
90
+ },
91
+ className: "preview-theme-text",
92
+ children: placeholder
93
+ })
94
+ }), /*#__PURE__*/_jsxs(Typography, {
95
+ variant: "body2",
96
+ className: "flexAlign typeValue",
97
+ children: [/*#__PURE__*/_jsx(Grid, {
98
+ component: "span",
99
+ className: "dotColor",
100
+ style: {
101
+ background: selectedSettings?.color || color
102
+ }
103
+ }), /*#__PURE__*/_jsxs(Grid, {
104
+ component: "span",
105
+ children: [fontFamily, ", ", size]
106
+ })]
107
+ })]
108
+ }), /*#__PURE__*/_jsx(IconButton, {
109
+ className: "editIcon",
110
+ onClick: e => {
111
+ setSettings(getTextSettings(previewElementId, {
112
+ color
113
+ }));
114
+ setSelectedField(field);
115
+ setAnchorEl(e.currentTarget);
116
+ },
117
+ children: /*#__PURE__*/_jsx(PenIcon, {})
118
+ })]
119
+ });
120
+ }
121
+ export default PreviewElement;