@flozy/editor 11.0.2 → 11.0.3

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 (147) hide show
  1. package/dist/Editor/ChatEditor.js +16 -17
  2. package/dist/Editor/CommonEditor.js +16 -129
  3. package/dist/Editor/DialogWrapper.js +25 -31
  4. package/dist/Editor/Editor.css +8 -36
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -11
  6. package/dist/Editor/Elements/AI/Styles.js +0 -1
  7. package/dist/Editor/Elements/Accordion/Accordion.js +22 -28
  8. package/dist/Editor/Elements/Accordion/AccordionButton.js +3 -12
  9. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  10. package/dist/Editor/Elements/Attachments/Attachments.js +11 -153
  11. package/dist/Editor/Elements/Attachments/AttachmentsButton.js +3 -8
  12. package/dist/Editor/Elements/Button/EditorButton.js +7 -23
  13. package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -61
  14. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  15. package/dist/Editor/Elements/Color Picker/ColorPicker.js +7 -10
  16. package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
  17. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +454 -0
  18. package/dist/Editor/Elements/Embed/Embed.js +43 -36
  19. package/dist/Editor/Elements/Embed/Image.js +23 -236
  20. package/dist/Editor/Elements/Embed/Video.js +15 -245
  21. package/dist/Editor/Elements/Form/FormField.js +1 -1
  22. package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
  23. package/dist/Editor/Elements/Form/Workflow/constant.js +1 -25
  24. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +74 -31
  25. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +5 -9
  26. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -3
  27. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
  28. package/dist/Editor/Elements/FreeGrid/styles.js +0 -15
  29. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  30. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -2
  31. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -3
  32. package/dist/Editor/Elements/Signature/SignaturePopup.js +1 -4
  33. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  34. package/dist/Editor/Elements/Table/Table.js +3 -3
  35. package/dist/Editor/Elements/Title/title.js +6 -6
  36. package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -4
  37. package/dist/Editor/Elements/TopBanner/TopBannerButton.js +3 -5
  38. package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
  39. package/dist/Editor/MiniEditor.js +1 -2
  40. package/dist/Editor/Styles/EditorStyles.js +7 -19
  41. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
  42. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
  43. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  44. package/dist/Editor/Toolbar/FormatTools/TextSize.js +29 -33
  45. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
  46. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +2 -4
  47. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +23 -25
  48. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +7 -25
  49. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
  50. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +8 -24
  51. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
  52. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +10 -70
  53. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +14 -73
  54. package/dist/Editor/Toolbar/PopupTool/index.js +3 -4
  55. package/dist/Editor/Toolbar/toolbarGroups.js +10 -56
  56. package/dist/Editor/common/ColorPickerButton.js +16 -38
  57. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  58. package/dist/Editor/common/FontLoader/FontLoader.js +0 -4
  59. package/dist/Editor/common/Icon.js +0 -28
  60. package/dist/Editor/common/ImageSelector/ImageSelector.js +7 -45
  61. package/dist/Editor/common/ImageSelector/Options/Upload.js +11 -26
  62. package/dist/Editor/common/ImageSelector/Styles.js +9 -3
  63. package/dist/Editor/common/LinkSettings/NavComponents.js +2 -6
  64. package/dist/Editor/common/MentionsPopup/index.js +1 -9
  65. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
  66. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
  67. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
  68. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
  69. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
  70. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -4
  71. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +7 -20
  72. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
  73. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +1 -9
  74. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +7 -20
  75. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -11
  76. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
  77. package/dist/Editor/common/RnD/Utils/gridDropItem.js +11 -28
  78. package/dist/Editor/common/RnD/Utils/index.js +1 -3
  79. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +63 -52
  80. package/dist/Editor/common/RnD/VirtualElement/helper.js +130 -320
  81. package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -22
  82. package/dist/Editor/common/RnD/index.js +14 -61
  83. package/dist/Editor/common/Shorthands/elements.js +4 -62
  84. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  85. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +0 -4
  86. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +2 -15
  87. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
  88. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
  89. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +8 -16
  90. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +10 -36
  91. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +7 -16
  92. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
  93. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +1 -0
  94. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
  95. package/dist/Editor/common/StyleBuilder/index.js +4 -8
  96. package/dist/Editor/common/Uploader.js +17 -125
  97. package/dist/Editor/common/iconslist.js +0 -21
  98. package/dist/Editor/commonStyle.js +45 -64
  99. package/dist/Editor/helper/index.js +2 -10
  100. package/dist/Editor/helper/theme.js +2 -203
  101. package/dist/Editor/hooks/useMouseMove.js +3 -9
  102. package/dist/Editor/plugins/withEmbeds.js +1 -12
  103. package/dist/Editor/plugins/withHTML.js +1 -3
  104. package/dist/Editor/plugins/withTable.js +1 -1
  105. package/dist/Editor/service/fileupload.js +0 -70
  106. package/dist/Editor/theme/ThemeList.js +173 -50
  107. package/dist/Editor/utils/SlateUtilityFunctions.js +41 -191
  108. package/dist/Editor/utils/accordion.js +40 -68
  109. package/dist/Editor/utils/button.js +17 -1
  110. package/dist/Editor/utils/draftToSlate.js +2 -3
  111. package/dist/Editor/utils/events.js +89 -94
  112. package/dist/Editor/utils/font.js +37 -40
  113. package/dist/Editor/utils/formfield.js +2 -2
  114. package/dist/Editor/utils/helper.js +22 -98
  115. package/package.json +4 -4
  116. package/dist/Editor/Elements/Attachments/AttachmentStyles.js +0 -16
  117. package/dist/Editor/Elements/FreeGrid/helper.js +0 -194
  118. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -439
  119. package/dist/Editor/assets/svg/BackIcon.js +0 -18
  120. package/dist/Editor/assets/svg/ThemeIcons.js +0 -293
  121. package/dist/Editor/common/CustomColorPicker/index.js +0 -130
  122. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  123. package/dist/Editor/common/CustomDialog2/index.js +0 -94
  124. package/dist/Editor/common/CustomDialog2/style.js +0 -67
  125. package/dist/Editor/common/CustomSelect.js +0 -43
  126. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
  127. package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +0 -115
  128. package/dist/Editor/common/UploaderWithProgress.js +0 -183
  129. package/dist/Editor/helper/textIndeces.js +0 -58
  130. package/dist/Editor/hooks/useEditorTheme.js +0 -153
  131. package/dist/Editor/hooks/useThemeValues.js +0 -63
  132. package/dist/Editor/theme/index.js +0 -149
  133. package/dist/Editor/themeSettings/ActiveTheme.js +0 -82
  134. package/dist/Editor/themeSettings/buttons/index.js +0 -300
  135. package/dist/Editor/themeSettings/buttons/style.js +0 -23
  136. package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
  137. package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
  138. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
  139. package/dist/Editor/themeSettings/fonts/index.js +0 -240
  140. package/dist/Editor/themeSettings/fonts/style.js +0 -62
  141. package/dist/Editor/themeSettings/icons.js +0 -60
  142. package/dist/Editor/themeSettings/index.js +0 -380
  143. package/dist/Editor/themeSettings/style.js +0 -299
  144. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  145. package/dist/Editor/themeSettingsAI/index.js +0 -355
  146. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -202
  147. package/dist/Editor/themeSettingsAI/style.js +0 -332
@@ -1,149 +0,0 @@
1
- import { getDevice } from "../helper/theme";
2
- const themeClassName = ".theme-element";
3
- function getTextStyles(props) {
4
- const {
5
- fontSize,
6
- textDecoration,
7
- color,
8
- ...rest
9
- } = props;
10
- const device = getDevice(window.innerWidth);
11
- const fontS = typeof fontSize === "object" ? fontSize[device] : fontSize;
12
- return {
13
- ...rest,
14
- '& span[data-slate-string="true"]': {
15
- textDecoration,
16
- fontSize: fontS,
17
- color: color || "inherit"
18
- }
19
-
20
- // "&::after": {
21
- // // for placeholder
22
- // fontSize,
23
- // },
24
- };
25
- }
26
-
27
- const transformHeading = (props, elementType) => {
28
- return {
29
- [`& ${elementType}${themeClassName}`]: getTextStyles(props)
30
- };
31
- };
32
- const transformParagraph = (props, paraType) => {
33
- return {
34
- [`& p${themeClassName}.${paraType}`]: getTextStyles(props)
35
- };
36
- };
37
- const transformButton = props => {
38
- const {
39
- borderRadius,
40
- lockRadius,
41
- bannerSpacing,
42
- buttonIcon,
43
- hover,
44
- ...classProps
45
- } = props;
46
- return {
47
- [`& .button${themeClassName}`]: {
48
- ...classProps,
49
- "&:hover": hover
50
- },
51
- buttonTheme: {
52
- borderRadius,
53
- lockRadius,
54
- bannerSpacing,
55
- buttonIcon
56
- }
57
- };
58
- };
59
- const transformProps = (elementType, props) => {
60
- let transformedProp = {};
61
- let otherProps = {};
62
- switch (elementType) {
63
- case "h1":
64
- case "h2":
65
- case "h3":
66
- case "h4":
67
- case "h5":
68
- case "h6":
69
- transformedProp = transformHeading(props, elementType);
70
- break;
71
- case "para1":
72
- case "para2":
73
- case "para3":
74
- transformedProp = transformParagraph(props, elementType);
75
- break;
76
- case "button":
77
- const {
78
- buttonTheme,
79
- ...classProps
80
- } = transformButton(props, elementType);
81
- transformedProp = classProps;
82
- otherProps = {
83
- buttonTheme
84
- };
85
- break;
86
- default:
87
- }
88
- return {
89
- transformedProp,
90
- otherProps
91
- };
92
- };
93
- export const transformTheme = (selectedTheme = {}) => {
94
- let sxProps = {};
95
- let others = {};
96
- const {
97
- elementProps
98
- } = selectedTheme;
99
- if (elementProps) {
100
- Object.entries(elementProps).forEach(([key, value]) => {
101
- const {
102
- transformedProp,
103
- otherProps
104
- } = transformProps(key, value);
105
- sxProps = {
106
- ...sxProps,
107
- ...transformedProp
108
- };
109
- others = {
110
- ...others,
111
- ...otherProps
112
- };
113
- });
114
- }
115
- return {
116
- sxProps,
117
- ...others
118
- };
119
- };
120
- export const defaultTheme = () => ({
121
- theme: {
122
- cssVars: {},
123
- elementProps: {
124
- button: {
125
- color: "#FFFFFF",
126
- background: "#2563EB",
127
- fontFamily: "PoppinsRegular",
128
- fontWeight: 400,
129
- fontSize: "inherit",
130
- borderColor: "transparent",
131
- borderRadius: {
132
- topLeft: 30,
133
- topRight: 30,
134
- bottomLeft: 30,
135
- bottomRight: 30
136
- },
137
- bannerSpacing: {
138
- left: 16,
139
- top: 8,
140
- right: 16,
141
- bottom: 8
142
- }
143
- }
144
- }
145
- }
146
- });
147
- export function getTheme(selectedTheme) {
148
- return transformTheme(selectedTheme?.theme || defaultTheme().theme);
149
- }
@@ -1,82 +0,0 @@
1
- import { Grid, Link, Typography } from "@mui/material";
2
- import { useEditorTheme } from "../hooks/useEditorTheme";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- import { jsxs as _jsxs } from "react/jsx-runtime";
5
- import { Fragment as _Fragment } from "react/jsx-runtime";
6
- function ActiveTheme(props) {
7
- const {
8
- onExplore
9
- } = props;
10
- const {
11
- theme
12
- } = useEditorTheme();
13
- const {
14
- colors = {}
15
- } = theme?.theme?.cssVars || {};
16
- const {
17
- id,
18
- name,
19
- mood_name = ""
20
- } = theme || {};
21
- const themeColors = Object.values(colors || {});
22
- return /*#__PURE__*/_jsxs(Grid, {
23
- className: "activeThemeInnner",
24
- children: [/*#__PURE__*/_jsx(Typography, {
25
- variant: "body1",
26
- className: "title activeThemeTitle",
27
- children: id ? "Active Theme" : "No theme activated"
28
- }), /*#__PURE__*/_jsx(Grid, {
29
- className: "flexAlign",
30
- children: id ? /*#__PURE__*/_jsxs(_Fragment, {
31
- children: [/*#__PURE__*/_jsx(Typography, {
32
- variant: "body1",
33
- className: "fs-14 flexItem",
34
- title: name,
35
- children: name
36
- }), /*#__PURE__*/_jsxs(Typography, {
37
- variant: "body2",
38
- className: "fs-12 textSecondary flexItem",
39
- style: {
40
- marginLeft: id ? "4px" : "0px"
41
- },
42
- children: ["- ", mood_name]
43
- })]
44
- }) : /*#__PURE__*/_jsx(Typography, {
45
- variant: "body2",
46
- className: "fs-12 textSecondary",
47
- style: {
48
- marginLeft: id ? "4px" : "0px"
49
- },
50
- children: `Select 'Explore More' to activate a theme and customize your design.`
51
- })
52
- }), /*#__PURE__*/_jsxs(Grid, {
53
- container: true,
54
- justifyContent: "space-between",
55
- alignItems: "end",
56
- sx: {
57
- mt: 1
58
- },
59
- children: [/*#__PURE__*/_jsx(Grid, {
60
- className: "flexAlign",
61
- sx: {
62
- gap: "10px"
63
- },
64
- children: id ? /*#__PURE__*/_jsx(_Fragment, {
65
- children: themeColors?.map((color, i) => {
66
- return /*#__PURE__*/_jsx(Grid, {
67
- className: "activeColorBox",
68
- style: {
69
- background: color
70
- }
71
- }, i);
72
- })
73
- }) : null
74
- }), onExplore && /*#__PURE__*/_jsx(Link, {
75
- className: "pointer fs-12 fw-500 exploreBtn",
76
- onClick: onExplore,
77
- children: "Explore More"
78
- })]
79
- })]
80
- });
81
- }
82
- export default ActiveTheme;
@@ -1,300 +0,0 @@
1
- import React, { useRef, useState } from "react";
2
- import { Accordion, AccordionDetails, AccordionSummary, Button, Fade, Grid, IconButton, Popper, Typography, styled, useTheme } from "@mui/material";
3
-
4
- // Style
5
- import Style from "./style";
6
- import { PenIcon } from "../icons";
7
- import StyleBuilder from "../../common/StyleBuilder";
8
- import { fontOptions } from "../../utils/font";
9
- import { useEditorTheme } from "../../hooks/useEditorTheme";
10
- import { getBreakPointsValue, getElementProperty, getTRBLBreakPoints, groupByBreakpoint } from "../../helper/theme";
11
- import { KeyboardArrowDownRounded } from "@mui/icons-material";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { jsxs as _jsxs } from "react/jsx-runtime";
14
- const buttonStyle = [{
15
- tab: "General",
16
- value: "size",
17
- fields: [{
18
- label: "Font Family",
19
- key: "fontFamily",
20
- type: "textOptions",
21
- options: fontOptions,
22
- webFont: true,
23
- width: 7,
24
- renderOption: option => {
25
- return /*#__PURE__*/_jsx("span", {
26
- style: {
27
- fontFamily: option.value
28
- },
29
- children: option.text
30
- });
31
- }
32
- }, {
33
- label: "Font Size",
34
- key: "textSize",
35
- type: "fontSize",
36
- width: 5,
37
- placeholder: "16px or 1em"
38
- }]
39
- }, {
40
- tab: "Colors",
41
- value: "colors",
42
- fields: [{
43
- label: "Text Color",
44
- key: "textColor",
45
- type: "color",
46
- needPreview: true
47
- }, {
48
- label: "Button Color",
49
- key: "bgColor",
50
- type: "color",
51
- themeEnabled: true
52
- }]
53
- }, {
54
- tab: "Banner Spacing",
55
- value: "bannerSpacing",
56
- fields: [{
57
- label: "Banner Spacing",
58
- key: "bannerSpacing",
59
- type: "bannerSpacing"
60
- }]
61
- }, {
62
- tab: "Border",
63
- value: "border",
64
- fields: [{
65
- label: "Border Radius",
66
- key: "borderRadius",
67
- type: "borderRadius"
68
- }]
69
- }, {
70
- tab: "Hover Colors",
71
- value: "hoverColors",
72
- fields: [{
73
- label: "Hover Text Color",
74
- key: "textColorHover",
75
- type: "color",
76
- needPreview: true
77
- }, {
78
- label: "Hover Button Color",
79
- key: "bgColorHover",
80
- type: "color"
81
- }]
82
- }];
83
- function getBtnSxProps(buttonStyle = {}, theme) {
84
- let newStyle = {
85
- ...buttonStyle
86
- };
87
- // if (newStyle?.bannerSpacing) {
88
- // newStyle.padding = newStyle?.bannerSpacing;
89
- // }
90
-
91
- const btnSp = groupByBreakpoint({
92
- borderRadius: {
93
- ...getBreakPointsValue(newStyle?.borderRadius || {}, null, "overrideBorderRadius", true)
94
- }
95
- // padding: {
96
- // ...getTRBLBreakPoints(newStyle?.bannerSpacing),
97
- // },
98
- }, theme);
99
- newStyle = {
100
- ...newStyle,
101
- ...btnSp
102
- };
103
- delete newStyle?.bannerSpacing;
104
- if (newStyle?.hover) {
105
- newStyle["&:hover"] = newStyle.hover;
106
- delete newStyle.hover;
107
- }
108
- return newStyle;
109
- }
110
- const MAP_HOVER_KEYS = {
111
- color: "textColorHover",
112
- background: "bgColorHover"
113
- };
114
- const MAP_THEME_TO_ELEMENT_KEYS = {
115
- color: "textColor",
116
- background: "bgColor",
117
- fontFamily: (value, prev, buttonEl) => {
118
- if (!buttonEl?.current) {
119
- return prev;
120
- }
121
- const val = getElementProperty(buttonEl?.current, "font-family");
122
- return {
123
- ...prev,
124
- fontFamily: val
125
- };
126
- },
127
- fontSize: "textSize",
128
- borderRadius: "borderRadius",
129
- bannerSpacing: "bannerSpacing",
130
- lockRadius: "lockRadius",
131
- lockbannerSpacing: "lockbannerSpacing",
132
- // fontWeight
133
-
134
- hover: (value = {}, prev = {}) => {
135
- const props = getProps(value, MAP_HOVER_KEYS);
136
- return {
137
- ...prev,
138
- ...props
139
- };
140
- }
141
- };
142
- const MAP_ELEMENT_TO_THEME_KEYS = {
143
- textSize: "fontSize",
144
- textColor: "color",
145
- bgColor: "background",
146
- bannerSpacing: "bannerSpacing",
147
- borderRadius: "borderRadius",
148
- lockRadius: "lockRadius",
149
- lockbannerSpacing: "lockbannerSpacing",
150
- textColorHover: (value, prev) => {
151
- const hover = {
152
- ...(prev?.hover || {})
153
- };
154
- hover.color = value;
155
- return {
156
- ...prev,
157
- hover
158
- };
159
- },
160
- bgColorHover: (value, prev) => {
161
- const hover = {
162
- ...(prev?.hover || {})
163
- };
164
- hover.background = value;
165
- return {
166
- ...prev,
167
- hover
168
- };
169
- },
170
- fontFamily: "fontFamily"
171
- };
172
- function getProps(buttonStyle, MAP_KEYS, buttonEl) {
173
- let props = {};
174
- Object.entries(buttonStyle).forEach(([key, value]) => {
175
- const elementKey = MAP_KEYS[key];
176
- if (elementKey) {
177
- if (typeof elementKey === "string") {
178
- props[elementKey] = value;
179
- } else {
180
- props = elementKey(value, props, buttonEl);
181
- }
182
- }
183
- });
184
- return props;
185
- }
186
- function convertThemeToElementProps(button = {}, buttonEl) {
187
- const props = getProps(button, MAP_THEME_TO_ELEMENT_KEYS, buttonEl);
188
- return props;
189
- }
190
-
191
- // icons
192
-
193
- const Buttons = props => {
194
- const {
195
- className,
196
- customProps,
197
- openSettings,
198
- onSettingsChange,
199
- type
200
- } = props;
201
- const [anchorEl, setAnchorEl] = useState();
202
- const theme = useTheme();
203
- const {
204
- selectedTheme,
205
- updateTheme
206
- } = useEditorTheme();
207
- const {
208
- button
209
- } = selectedTheme?.elementProps || {};
210
- console.log("getBtnSxProps(button, theme)", getBtnSxProps(button, theme));
211
- const buttonEl = useRef();
212
- const elementProps = convertThemeToElementProps(button, buttonEl);
213
-
214
- // State
215
- return /*#__PURE__*/_jsxs(Grid, {
216
- className: className,
217
- children: [/*#__PURE__*/_jsxs(Accordion, {
218
- className: "settingAccordion",
219
- onChange: () => onSettingsChange(type),
220
- expanded: openSettings === type,
221
- children: [/*#__PURE__*/_jsx(AccordionSummary, {
222
- expandIcon: /*#__PURE__*/_jsx(KeyboardArrowDownRounded, {}),
223
- "aria-controls": "panel1-content",
224
- id: "panel1-header",
225
- children: "Buttons"
226
- }), /*#__PURE__*/_jsx(AccordionDetails, {
227
- children: /*#__PURE__*/_jsxs(Grid, {
228
- container: true,
229
- className: "buttonTypeItem",
230
- justifyContent: "space-between",
231
- alignItems: "center",
232
- wrap: "nowrap",
233
- onClick: e => setAnchorEl(e.currentTarget),
234
- children: [/*#__PURE__*/_jsxs(Grid, {
235
- item: true,
236
- size: 8,
237
- children: [/*#__PURE__*/_jsx(Typography, {
238
- variant: "body1",
239
- className: "fw-600 fs-14",
240
- style: {
241
- marginBottom: "10px"
242
- },
243
- children: "Theme Button"
244
- }), /*#__PURE__*/_jsx(Button, {
245
- sx: getBtnSxProps(button, theme),
246
- ref: buttonEl,
247
- children: "Button"
248
- })]
249
- }), /*#__PURE__*/_jsx(Grid, {
250
- item: true,
251
- size: 4,
252
- children: /*#__PURE__*/_jsx(IconButton, {
253
- className: "editIcon",
254
- children: /*#__PURE__*/_jsx(PenIcon, {})
255
- })
256
- })]
257
- })
258
- })]
259
- }), /*#__PURE__*/_jsx(Popper, {
260
- open: Boolean(anchorEl),
261
- anchorEl: anchorEl,
262
- transition: true,
263
- sx: {
264
- zIndex: "100000",
265
- background: "white"
266
- },
267
- placement: "left-start",
268
- children: ({
269
- TransitionProps
270
- }) => /*#__PURE__*/_jsx(Fade, {
271
- ...TransitionProps,
272
- timeout: 350,
273
- children: /*#__PURE__*/_jsx("div", {
274
- children: /*#__PURE__*/_jsx(StyleBuilder, {
275
- title: "Button",
276
- type: "buttonStyle",
277
- element: elementProps,
278
- onSave: data => {
279
- const props = getProps(data, MAP_ELEMENT_TO_THEME_KEYS);
280
- updateTheme(props, {
281
- action: "ELEMENT_PROPS_CHANGE",
282
- fieldName: "button"
283
- });
284
- setAnchorEl(null);
285
- },
286
- onClose: () => {
287
- setAnchorEl(null);
288
- },
289
- renderTabs: buttonStyle,
290
- customProps: {
291
- disableEditTheme: true,
292
- translation: customProps?.translation || (() => {})
293
- }
294
- })
295
- })
296
- })
297
- })]
298
- });
299
- };
300
- export default styled(Buttons)(Style);
@@ -1,23 +0,0 @@
1
- const Style = ({
2
- appTheme
3
- }) => ({
4
- ".buttonTypeItem": {
5
- padding: "8px 10px",
6
- width: "calc(100% + 20px)",
7
- margin: "0 -10px",
8
- "&:hover": {
9
- background: appTheme?.palette?.editor?.tv_hover_bg,
10
- ".editIcon": {
11
- opacity: "1",
12
- visibility: "visible"
13
- }
14
- },
15
- ".editIcon": {
16
- opacity: "0",
17
- visibility: "hidden",
18
- width: "30px",
19
- height: "30px"
20
- }
21
- }
22
- });
23
- export default Style;