@flozy/editor 3.7.9 → 3.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. package/dist/Editor/CommonEditor.js +111 -169
  2. package/dist/Editor/Editor.css +12 -1
  3. package/dist/Editor/Elements/AI/AIInput.js +5 -16
  4. package/dist/Editor/Elements/AI/PopoverAIInput.js +17 -31
  5. package/dist/Editor/Elements/AI/Styles.js +1 -2
  6. package/dist/Editor/Elements/Accordion/Accordion.js +7 -74
  7. package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +2 -3
  8. package/dist/Editor/Elements/Accordion/AccordionSummary.js +74 -7
  9. package/dist/Editor/Elements/AppHeader/AppHeader.js +4 -26
  10. package/dist/Editor/Elements/Button/EditorButton.js +16 -28
  11. package/dist/Editor/Elements/Color Picker/ColorButtons.js +17 -60
  12. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  13. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  14. package/dist/Editor/Elements/Color Picker/Styles.js +1 -2
  15. package/dist/Editor/Elements/Embed/Image.js +20 -28
  16. package/dist/Editor/Elements/Embed/Video.js +11 -15
  17. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
  18. package/dist/Editor/Elements/Grid/Grid.js +0 -2
  19. package/dist/Editor/Elements/Grid/GridItem.js +1 -3
  20. package/dist/Editor/Elements/Link/Link.js +1 -6
  21. package/dist/Editor/Elements/Link/LinkButton.js +2 -4
  22. package/dist/Editor/Elements/Link/LinkPopup.js +3 -11
  23. package/dist/Editor/Elements/Table/Table.js +1 -1
  24. package/dist/Editor/Elements/Table/TableCell.js +1 -1
  25. package/dist/Editor/MiniEditor.js +1 -3
  26. package/dist/Editor/Toolbar/Basic/index.js +2 -4
  27. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +2 -26
  28. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  29. package/dist/Editor/Toolbar/FormatTools/TextSize.js +11 -5
  30. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +11 -4
  31. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +86 -213
  32. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
  33. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +13 -20
  34. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +7 -52
  35. package/dist/Editor/Toolbar/PopupTool/index.js +5 -6
  36. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  37. package/dist/Editor/assets/svg/AIIcons.js +1 -153
  38. package/dist/Editor/common/ColorPickerButton.js +9 -25
  39. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  40. package/dist/Editor/common/Icon.js +2 -30
  41. package/dist/Editor/common/LinkSettings/NavComponents.js +2 -5
  42. package/dist/Editor/common/LinkSettings/index.js +1 -2
  43. package/dist/Editor/common/LinkSettings/navOptions.js +2 -7
  44. package/dist/Editor/common/MentionsPopup/Styles.js +2 -5
  45. package/dist/Editor/common/Shorthands/elements.js +0 -54
  46. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +7 -7
  47. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
  48. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  49. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +29 -33
  50. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +25 -31
  51. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
  52. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +7 -31
  53. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
  54. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +4 -14
  55. package/dist/Editor/common/StyleBuilder/index.js +1 -1
  56. package/dist/Editor/helper/theme.js +4 -189
  57. package/dist/Editor/hooks/useMouseMove.js +2 -4
  58. package/dist/Editor/plugins/withEmbeds.js +1 -1
  59. package/dist/Editor/plugins/withHTML.js +5 -47
  60. package/dist/Editor/plugins/withLayout.js +10 -15
  61. package/dist/Editor/plugins/withTable.js +2 -2
  62. package/dist/Editor/theme/ThemeList.js +173 -50
  63. package/dist/Editor/utils/SlateUtilityFunctions.js +25 -157
  64. package/dist/Editor/utils/button.js +17 -1
  65. package/dist/Editor/utils/events.js +4 -11
  66. package/dist/Editor/utils/font.js +37 -40
  67. package/dist/Editor/utils/helper.js +13 -73
  68. package/package.json +1 -2
  69. package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +0 -73
  70. package/dist/Editor/Elements/AI/VoiceToText/index.js +0 -167
  71. package/dist/Editor/Elements/AI/VoiceToText/style.js +0 -40
  72. package/dist/Editor/Elements/Link/LinkPopupStyles.js +0 -28
  73. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
  74. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  75. package/dist/Editor/common/CustomColorPicker/index.js +0 -106
  76. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  77. package/dist/Editor/common/CustomDialog/index.js +0 -94
  78. package/dist/Editor/common/CustomDialog/style.js +0 -67
  79. package/dist/Editor/common/CustomSelect.js +0 -33
  80. package/dist/Editor/common/EditorCmds.js +0 -35
  81. package/dist/Editor/hooks/useEditorTheme.js +0 -139
  82. package/dist/Editor/theme/index.js +0 -144
  83. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  84. package/dist/Editor/themeSettings/buttons/index.js +0 -290
  85. package/dist/Editor/themeSettings/buttons/style.js +0 -21
  86. package/dist/Editor/themeSettings/colorTheme/index.js +0 -290
  87. package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
  88. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -123
  89. package/dist/Editor/themeSettings/fonts/index.js +0 -213
  90. package/dist/Editor/themeSettings/fonts/style.js +0 -44
  91. package/dist/Editor/themeSettings/icons.js +0 -60
  92. package/dist/Editor/themeSettings/index.js +0 -320
  93. package/dist/Editor/themeSettings/style.js +0 -152
  94. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  95. package/dist/Editor/themeSettingsAI/index.js +0 -356
  96. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -190
  97. package/dist/Editor/themeSettingsAI/style.js +0 -247
@@ -1,167 +0,0 @@
1
- import { useState, useEffect, useRef, cloneElement } from "react";
2
- import PropTypes from "prop-types";
3
- import STTStyles from "./style";
4
- import { Grid, IconButton, Box } from "@mui/material";
5
- import { AudioWave } from "./AudioWave";
6
- import { CloseGreyCircle, PauseRecordingIcon, TickBlueCircle } from "../../../assets/svg/AIIcons";
7
- import { MODES } from "../helper";
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- import { jsxs as _jsxs } from "react/jsx-runtime";
10
- function STT(props) {
11
- const {
12
- children,
13
- otherProps,
14
- onSend
15
- } = props;
16
- const {
17
- services
18
- } = otherProps;
19
- const classes = STTStyles();
20
- const [isRecording, setIsRecording] = useState(false);
21
- const [mediaRecorder, setMediaRecorder] = useState(null);
22
- const [audioChunks, setAudioChunks] = useState([]);
23
- const [chunkIndex, setChunkIndex] = useState(0);
24
- const audioChunksRef = useRef([]);
25
- const [transcription, setTranscription] = useState("");
26
- const [showPause, setShowPause] = useState(true);
27
- const [isAILoading, setAILoading] = useState(false);
28
- const setChunk = event => {
29
- if (event.data.size > 0) {
30
- setAudioChunks(prev => {
31
- const updatedChunks = [...prev, event.data];
32
- audioChunksRef.current = updatedChunks; // Update ref manually
33
- return updatedChunks;
34
- });
35
- }
36
- };
37
- const sendChunck = async (isLast = false) => {
38
- if (audioChunksRef.current.length > 0) {
39
- const audioBlob = new Blob(audioChunksRef.current, {
40
- type: "audio/webm"
41
- });
42
- const formData = new FormData();
43
- formData.append("audio", audioBlob, `audio_chunk_${chunkIndex}.wav`);
44
- formData.append("chunkIndex", chunkIndex); // Send chunk index to the backend
45
- if (isLast) {
46
- formData.append("isLastChunk", true); // Send chunk index to the backend
47
- } else {
48
- formData.append("isLastChunk", false);
49
- setChunkIndex(prevIndex => prevIndex + 1);
50
- }
51
- const result = await services("speechToText", {
52
- formData
53
- });
54
- setTranscription(result?.data);
55
- await sendChunck();
56
- }
57
- };
58
- const handleStopRecording = () => {
59
- sendChunck(true);
60
- setAudioChunks([]);
61
- };
62
- const startRecording = async () => {
63
- setTranscription("");
64
- const stream = await navigator.mediaDevices.getUserMedia({
65
- audio: true
66
- });
67
- const recorder = new MediaRecorder(stream);
68
- setMediaRecorder(recorder);
69
- recorder.ondataavailable = setChunk;
70
- recorder.onstop = handleStopRecording;
71
- recorder.start(100);
72
- setIsRecording(true);
73
- setTimeout(() => {
74
- sendChunck();
75
- }, 2000);
76
- };
77
- const stopRecording = () => {
78
- if (mediaRecorder) {
79
- mediaRecorder.stop();
80
-
81
- // Stop all tracks to release the microphone
82
- if (mediaRecorder.stream) {
83
- mediaRecorder.stream.getTracks().forEach(track => track.stop());
84
- }
85
- setChunkIndex(0);
86
- setShowPause(false);
87
- }
88
- };
89
- const sendToInfiniti = async () => {
90
- setAILoading(true);
91
- setIsRecording(false);
92
- const result = await services("infinityAI", {
93
- mode: MODES.default,
94
- query: transcription
95
- });
96
- const text = result?.data || "";
97
- onSend("speech_to_text", {
98
- text
99
- });
100
- stopRecording();
101
- setAILoading(false);
102
- };
103
- const closeRecording = () => {
104
- setAudioChunks([]);
105
- stopRecording();
106
- setIsRecording(false);
107
- setShowPause(true);
108
- setTranscription("");
109
- };
110
- useEffect(() => {
111
- audioChunksRef.current = audioChunks;
112
- }, [audioChunks]);
113
- return /*#__PURE__*/_jsx(Grid, {
114
- xs: 12,
115
- children: /*#__PURE__*/_jsx(Grid, {
116
- className: classes.SttContainer,
117
- children: !isRecording ? /*#__PURE__*/_jsx(Grid, {
118
- xs: 12,
119
- children: /*#__PURE__*/cloneElement(children, {
120
- startRecording,
121
- isAILoading
122
- })
123
- }) : /*#__PURE__*/_jsxs(Grid, {
124
- xs: 12,
125
- sx: classes.AudioVizualizerContainer,
126
- children: [transcription ? /*#__PURE__*/_jsx(Grid, {
127
- xs: 12,
128
- sx: classes.TranscriptionContainer,
129
- children: transcription
130
- }) : null, /*#__PURE__*/_jsxs(Grid, {
131
- xs: 12,
132
- sx: classes.AudioVizualizerContent,
133
- children: [/*#__PURE__*/_jsx(Box, {
134
- children: /*#__PURE__*/_jsx(IconButton, {
135
- onClick: closeRecording,
136
- children: /*#__PURE__*/_jsx(CloseGreyCircle, {})
137
- })
138
- }), /*#__PURE__*/_jsx(Box, {
139
- sx: classes.AudioVisualiser,
140
- children: /*#__PURE__*/_jsx(AudioWave, {
141
- audioChunks: audioChunks
142
- })
143
- }), /*#__PURE__*/_jsx(Box, {
144
- children: showPause ? /*#__PURE__*/_jsx(IconButton, {
145
- onClick: stopRecording,
146
- children: /*#__PURE__*/_jsx(PauseRecordingIcon, {})
147
- }) : /*#__PURE__*/_jsx(IconButton, {
148
- onClick: sendToInfiniti,
149
- disabled: !transcription,
150
- style: !transcription ? {
151
- opacity: 0.5
152
- } : {},
153
- children: /*#__PURE__*/_jsx(TickBlueCircle, {})
154
- })
155
- })]
156
- })]
157
- })
158
- })
159
- });
160
- }
161
- STT.defaultProps = {
162
- classes: {}
163
- };
164
- STT.propTypes = {
165
- classes: PropTypes.object
166
- };
167
- export const VoiceToText = STT;
@@ -1,40 +0,0 @@
1
- const styles = () => ({
2
- SttContainer: {
3
- display: "flex",
4
- width: "100%",
5
- padding: "12px",
6
- zIndex: 1
7
- },
8
- STTInput: {
9
- width: "100%",
10
- borderRadius: "8px",
11
- "&& .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline": {
12
- borderColor: "#2563EB"
13
- },
14
- "&& .MuiOutlinedInput-root": {
15
- background: "rgba(252, 250, 255, 1)"
16
- }
17
- },
18
- AudioVizualizerContainer: {
19
- width: "100%",
20
- display: "flex",
21
- background: "rgba(252, 250, 255, 1)",
22
- borderRadius: "8px",
23
- border: "1px solid #2563EB",
24
- alignItems: "center",
25
- flexWrap: "wrap"
26
- },
27
- AudioVizualizerContent: {
28
- display: "flex",
29
- height: "50px",
30
- width: "100%"
31
- },
32
- AudioVisualiser: {
33
- flexGrow: "1",
34
- height: "100%"
35
- },
36
- TranscriptionContainer: {
37
- padding: "12px"
38
- }
39
- });
40
- export default styles;
@@ -1,28 +0,0 @@
1
- const LinkPopupStyles = theme => ({
2
- addLinkField: {
3
- "& .MuiOutlinedInput-input": {
4
- fontSize: "12px",
5
- fontWeight: 500,
6
- color: `${theme?.palette?.editor?.textColor} !important`
7
- },
8
- "& .MuiFormHelperText-root": {
9
- color: `${theme?.palette?.editor?.textColor} !important`
10
- },
11
- "& .MuiOutlinedInput-root": {
12
- boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.16)",
13
- color: `${theme?.palette?.editor?.textColor} !important`,
14
- borderRadius: "7px",
15
- "& fieldset": {
16
- borderColor: "#D8DDE1"
17
- },
18
- "&:hover fieldset": {
19
- borderColor: "#64748B"
20
- },
21
- "&.Mui-focused fieldset": {
22
- borderColor: "#2563EB"
23
- },
24
- "& .MuiFormLabel-root": {}
25
- }
26
- }
27
- });
28
- export default LinkPopupStyles;
@@ -1,438 +0,0 @@
1
- import { Button, Grid, IconButton, Popover, TextField, Tooltip, Typography } from "@mui/material";
2
- import { useEditorContext } from "../../hooks/useMouseMove";
3
- import { fontFamilyMap, fontOptions } from "../../utils/font";
4
- import FormatClearIcon from "@mui/icons-material/FormatClear";
5
- import usePopupStyles from "../PopupTool/PopupToolStyle";
6
- import { TextMinusIcon, TextPlusIcon } from "../../common/iconslist";
7
- import { BREAKPOINTS_DEVICES, getBreakPointsValue, getVariableValue } from "../../helper/theme";
8
- import useWindowResize from "../../hooks/useWindowResize";
9
- import { toolbarGroups } from "../toolbarGroups";
10
- import Icon from "../../common/Icon";
11
- import { useMemo, useState } from "react";
12
- import CommonButton from "../../common/Button";
13
- import CustomSelect from "../../common/CustomSelect";
14
- import ColorButtons from "../../Elements/Color Picker/ColorButtons";
15
- import FormatColorResetIcon from "@mui/icons-material/FormatColorReset";
16
- import ColorPickerStyles from "../../Elements/Color Picker/Styles";
17
- import colorWheel from "../../Elements/Color Picker/colorWheel.png";
18
- import CustomColorPicker from "../../common/CustomColorPicker";
19
- import { jsx as _jsx } from "react/jsx-runtime";
20
- import { jsxs as _jsxs } from "react/jsx-runtime";
21
- import { Fragment as _Fragment } from "react/jsx-runtime";
22
- function getFontStyleProps(settings = {}, format) {
23
- const {
24
- fontWeight,
25
- fontStyle
26
- } = settings;
27
- let isActive;
28
- let onClick;
29
- switch (format) {
30
- case "bold":
31
- isActive = fontWeight === "bold" || fontWeight === "700";
32
- onClick = () => {
33
- return {
34
- fontWeight: isActive ? "normal" : "bold"
35
- };
36
- };
37
- break;
38
- case "italic":
39
- isActive = fontStyle === "italic";
40
- onClick = () => {
41
- return {
42
- fontStyle: isActive ? "unset" : "italic"
43
- };
44
- };
45
- break;
46
-
47
- // case "underline":
48
- // isActive = textDecoration.includes("underline");
49
- // onClick = () => {
50
- // let otherTextDecoration = textDecoration?.includes("line-through")
51
- // ? "line-through"
52
- // : "";
53
-
54
- // otherTextDecoration += isActive ? "" : " underline";
55
-
56
- // return { textDecoration: otherTextDecoration };
57
- // };
58
- // break;
59
- // case "strikethrough":
60
- // isActive = textDecoration.includes("line-through");
61
- // onClick = () => {
62
- // let otherTextDecoration = textDecoration?.includes("underline")
63
- // ? "underline"
64
- // : "";
65
-
66
- // otherTextDecoration += isActive ? "" : " line-through";
67
-
68
- // return { textDecoration: otherTextDecoration };
69
- // };
70
- // break;
71
-
72
- default:
73
- isActive = false;
74
- onClick = () => {};
75
- break;
76
- }
77
- return {
78
- isActive,
79
- onClick
80
- };
81
- }
82
- const allTools = toolbarGroups.flat();
83
- function ThemeTextFormat(props) {
84
- const {
85
- settings,
86
- updateSettings,
87
- onSaveTextSettings,
88
- onClose
89
- } = props;
90
- const {
91
- theme
92
- } = useEditorContext();
93
- const classes = usePopupStyles(theme);
94
- const pickerStyles = ColorPickerStyles(theme);
95
- const fontStyle = allTools.filter(f => f.type === "mark" && f.themeEnabled);
96
- const fontWeight = allTools.find(f => f.format === "fontWeight");
97
- const fontFamilyVal = useMemo(() => {
98
- const {
99
- fontFamily = ""
100
- } = settings;
101
- let font = fontFamily.startsWith("var") ? getVariableValue(fontFamily) : fontFamily;
102
- return fontOptions?.find(f => f.text === font)?.value;
103
- }, [settings, fontOptions]);
104
- const fontWeightVal = useMemo(() => {
105
- const {
106
- options
107
- } = fontWeight || {};
108
- const selected = options?.find(o => o.value === settings?.fontWeight || o.numVal === settings?.fontWeight);
109
- return selected?.value;
110
- }, [settings?.fontWeight]);
111
- return /*#__PURE__*/_jsxs(Grid, {
112
- container: true,
113
- sx: classes.textFormatWrapper,
114
- children: [/*#__PURE__*/_jsxs(Grid, {
115
- item: true,
116
- xs: 12,
117
- children: [/*#__PURE__*/_jsxs(Grid, {
118
- container: true,
119
- justifyContent: "space-between",
120
- alignItems: "center",
121
- children: [/*#__PURE__*/_jsx(Grid, {
122
- item: true,
123
- children: /*#__PURE__*/_jsx(Typography, {
124
- variant: "body1",
125
- color: "primary",
126
- sx: classes.typoLabel,
127
- children: "Font Family"
128
- })
129
- }), /*#__PURE__*/_jsx(Grid, {
130
- item: true,
131
- children: /*#__PURE__*/_jsx(Button, {
132
- sx: classes.defaultBtn,
133
- startIcon: /*#__PURE__*/_jsx(FormatClearIcon, {}),
134
- onClick: () => updateSettings({
135
- fontFamily: Object.values(fontFamilyMap)[0]
136
- }),
137
- children: "Default"
138
- })
139
- })]
140
- }), /*#__PURE__*/_jsx(Grid, {
141
- item: true,
142
- xs: 12,
143
- sx: classes.textFormatField,
144
- children: /*#__PURE__*/_jsx(CustomSelect, {
145
- options: fontOptions,
146
- classes: classes,
147
- onChange: e => {
148
- const fontFamily = fontOptions.find(f => f.value === e.target.value)?.text;
149
- updateSettings({
150
- fontFamily
151
- });
152
- },
153
- value: fontFamilyVal || fontOptions[0].value
154
- })
155
- })]
156
- }), /*#__PURE__*/_jsxs(Grid, {
157
- container: true,
158
- spacing: 2,
159
- children: [/*#__PURE__*/_jsxs(Grid, {
160
- item: true,
161
- xs: 6,
162
- children: [/*#__PURE__*/_jsx(Typography, {
163
- variant: "body1",
164
- color: "primary",
165
- sx: classes.typoLabel,
166
- children: "Font Weight"
167
- }), /*#__PURE__*/_jsx(Grid, {
168
- item: true,
169
- xs: 12,
170
- sx: classes.textFormatField,
171
- children: /*#__PURE__*/_jsx(CustomSelect, {
172
- options: fontWeight?.options || [],
173
- classes: classes,
174
- onChange: e => {
175
- updateSettings({
176
- fontWeight: e.target.value
177
- });
178
- },
179
- value: fontWeightVal
180
- })
181
- })]
182
- }), /*#__PURE__*/_jsxs(Grid, {
183
- item: true,
184
- xs: 6,
185
- children: [/*#__PURE__*/_jsx(Typography, {
186
- variant: "body1",
187
- color: "primary",
188
- sx: classes.typoLabel,
189
- children: "Font Size"
190
- }), /*#__PURE__*/_jsx(Grid, {
191
- item: true,
192
- xs: 12,
193
- sx: classes.textFormatCG,
194
- children: /*#__PURE__*/_jsx(TextSize, {
195
- classes: classes,
196
- value: settings?.fontSize || 16,
197
- onChange: fontSize => updateSettings({
198
- fontSize
199
- }),
200
- fullWidth: true
201
- })
202
- })]
203
- })]
204
- }), /*#__PURE__*/_jsxs(Grid, {
205
- item: true,
206
- xs: 12,
207
- sx: classes.textFormatField,
208
- style: {
209
- marginTop: "14px"
210
- },
211
- children: [/*#__PURE__*/_jsxs(Grid, {
212
- container: true,
213
- justifyContent: "space-between",
214
- alignItems: "center",
215
- children: [/*#__PURE__*/_jsx(Grid, {
216
- item: true,
217
- children: /*#__PURE__*/_jsx(Typography, {
218
- variant: "body1",
219
- color: "primary",
220
- sx: classes.typoLabel,
221
- children: "Text Color"
222
- })
223
- }), /*#__PURE__*/_jsx(Grid, {
224
- item: true,
225
- children: /*#__PURE__*/_jsx(Button, {
226
- sx: classes.defaultBtn,
227
- startIcon: /*#__PURE__*/_jsx(FormatColorResetIcon, {}),
228
- onClick: () => updateSettings({
229
- color: "#ddd"
230
- }),
231
- children: "Default"
232
- })
233
- })]
234
- }), /*#__PURE__*/_jsx(Grid, {
235
- sx: classes.textFormatColorWrpr,
236
- children: /*#__PURE__*/_jsx(ColorPicker, {
237
- classes: classes,
238
- pickerStyles: pickerStyles,
239
- onChange: color => updateSettings({
240
- color
241
- }),
242
- color: settings?.color,
243
- disableEditTheme: true
244
- })
245
- })]
246
- }), /*#__PURE__*/_jsxs(Grid, {
247
- item: true,
248
- xs: 12,
249
- children: [/*#__PURE__*/_jsx(Typography, {
250
- variant: "body1",
251
- color: "primary",
252
- sx: classes.typoLabel,
253
- children: "Typography"
254
- }), /*#__PURE__*/_jsx(Grid, {
255
- item: true,
256
- xs: 12,
257
- className: "typo-icons",
258
- sx: classes.evenSpace,
259
- children: fontStyle?.map((m, i) => {
260
- const {
261
- isActive,
262
- onClick
263
- } = getFontStyleProps(settings, m.format) || {};
264
- return /*#__PURE__*/_jsx(CommonButton, {
265
- active: isActive,
266
- onClick: () => {
267
- const style = onClick();
268
- updateSettings(style);
269
- },
270
- children: /*#__PURE__*/_jsx(Icon, {
271
- icon: m.format
272
- })
273
- }, i);
274
- })
275
- })]
276
- }), /*#__PURE__*/_jsx(Grid, {
277
- item: true,
278
- xs: 12,
279
- sx: {
280
- mt: 2
281
- },
282
- children: /*#__PURE__*/_jsxs("div", {
283
- style: {
284
- display: "flex",
285
- justifyContent: "end",
286
- margin: "8px",
287
- position: "absolute",
288
- bottom: 0,
289
- right: 0
290
- },
291
- children: [/*#__PURE__*/_jsx(Button, {
292
- onClick: onClose,
293
- className: "secondaryBtn",
294
- children: "Cancel"
295
- }), /*#__PURE__*/_jsx(Button, {
296
- onClick: onSaveTextSettings,
297
- className: "primaryBtn",
298
- children: "Save"
299
- })]
300
- })
301
- })]
302
- });
303
- }
304
- export default ThemeTextFormat;
305
- function TextSize(props) {
306
- const {
307
- classes,
308
- value: val,
309
- onChange,
310
- fullWidth
311
- } = props;
312
- const [size] = useWindowResize();
313
- const value = getBreakPointsValue(val, size?.device);
314
- const updateMarkData = newVal => {
315
- let upData = {
316
- ...getBreakPointsValue(val),
317
- [size?.device]: `${newVal}px`
318
- };
319
-
320
- // if desktop update to all other devices
321
- // to avoid default normal size
322
- if (size?.device === "lg") {
323
- upData = BREAKPOINTS_DEVICES.reduce((a, b) => {
324
- a[b] = `${newVal}px`;
325
- return a;
326
- }, {});
327
- }
328
- onChange(upData);
329
- };
330
- const onChangeSize = e => {
331
- let inc = parseInt(e.target.value) || 8;
332
- inc = inc > 200 ? 200 : inc;
333
- updateMarkData(inc || 8);
334
- };
335
- const getSizeVal = () => {
336
- try {
337
- return parseInt(value);
338
- } catch (err) {
339
- return "";
340
- }
341
- };
342
- const combinedOldVal = getSizeVal();
343
- const onIncreaseSize = () => {
344
- let inc = (combinedOldVal || 0) + 1;
345
- inc = inc > 200 ? 200 : inc;
346
- updateMarkData(inc);
347
- };
348
- const onDecreaseSize = () => {
349
- const newVal = combinedOldVal - 1 < 0 ? 0 : combinedOldVal - 1;
350
- updateMarkData(newVal);
351
- };
352
- return /*#__PURE__*/_jsx(TextField, {
353
- sx: classes?.textSize,
354
- value: combinedOldVal,
355
- onChange: onChangeSize,
356
- size: "small",
357
- inputProps: {
358
- style: {
359
- width: fullWidth ? "100%" : "30px",
360
- textAlign: "center",
361
- height: "19px",
362
- fontSize: "14px"
363
- }
364
- },
365
- fullWidth: fullWidth,
366
- InputProps: {
367
- style: {
368
- borderRadius: "8px"
369
- },
370
- endAdornment: /*#__PURE__*/_jsxs("div", {
371
- className: "textFontArrows",
372
- children: [/*#__PURE__*/_jsx(IconButton, {
373
- onClick: onIncreaseSize,
374
- size: "small",
375
- children: /*#__PURE__*/_jsx(TextPlusIcon, {})
376
- }), /*#__PURE__*/_jsx(IconButton, {
377
- onClick: onDecreaseSize,
378
- size: "small",
379
- children: /*#__PURE__*/_jsx(TextMinusIcon, {})
380
- })]
381
- })
382
- }
383
- });
384
- }
385
- function ColorPicker(props) {
386
- const {
387
- classes,
388
- pickerStyles,
389
- onChange,
390
- color,
391
- disableEditTheme
392
- } = props;
393
- const [anchorEl, setAnchorEl] = useState(null);
394
- const open = Boolean(anchorEl);
395
- const handleClose = () => {
396
- setAnchorEl(null);
397
- };
398
- return /*#__PURE__*/_jsxs(_Fragment, {
399
- children: [/*#__PURE__*/_jsx(Tooltip, {
400
- title: "",
401
- arrow: true,
402
- children: /*#__PURE__*/_jsx(IconButton, {
403
- sx: pickerStyles.colorPickerIcon,
404
- onClick: e => {
405
- setAnchorEl(e.currentTarget);
406
- },
407
- children: /*#__PURE__*/_jsx("img", {
408
- src: colorWheel,
409
- alt: "color wheel"
410
- })
411
- })
412
- }), /*#__PURE__*/_jsx(ColorButtons, {
413
- classes: pickerStyles,
414
- onSelect: onChange,
415
- activeColor: color,
416
- disableEditTheme: disableEditTheme
417
- }), /*#__PURE__*/_jsx(Popover, {
418
- open: open,
419
- anchorEl: anchorEl,
420
- onClose: handleClose,
421
- anchorOrigin: {
422
- vertical: "top",
423
- horizontal: "center"
424
- },
425
- transformOrigin: {
426
- vertical: "bottom",
427
- horizontal: "top"
428
- },
429
- sx: classes.colorPickerPopup,
430
- children: /*#__PURE__*/_jsx(CustomColorPicker, {
431
- gradient: true,
432
- onChange: onChange,
433
- color: color,
434
- disableEditTheme: disableEditTheme
435
- })
436
- })]
437
- });
438
- }