@flozy/editor 10.7.0 → 10.7.1

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 (140) hide show
  1. package/dist/Editor/ChatEditor.js +17 -16
  2. package/dist/Editor/CommonEditor.js +126 -15
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +45 -11
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
  6. package/dist/Editor/Elements/AI/Styles.js +1 -0
  7. package/dist/Editor/Elements/Accordion/Accordion.js +25 -17
  8. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  9. package/dist/Editor/Elements/Attachments/AttachmentStyles.js +16 -0
  10. package/dist/Editor/Elements/Attachments/Attachments.js +153 -11
  11. package/dist/Editor/Elements/Attachments/AttachmentsButton.js +8 -3
  12. package/dist/Editor/Elements/Button/EditorButton.js +23 -7
  13. package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
  14. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  15. package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
  16. package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
  17. package/dist/Editor/Elements/Embed/Embed.js +36 -43
  18. package/dist/Editor/Elements/Embed/Image.js +240 -23
  19. package/dist/Editor/Elements/Embed/Video.js +246 -15
  20. package/dist/Editor/Elements/Form/FormField.js +1 -1
  21. package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
  22. package/dist/Editor/Elements/Form/Workflow/constant.js +25 -1
  23. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +39 -33
  24. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +7 -4
  25. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -0
  26. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
  27. package/dist/Editor/Elements/FreeGrid/helper.js +115 -0
  28. package/dist/Editor/Elements/FreeGrid/styles.js +9 -0
  29. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  30. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +2 -1
  31. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  32. package/dist/Editor/Elements/Table/Table.js +3 -3
  33. package/dist/Editor/Elements/Title/title.js +6 -6
  34. package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
  35. package/dist/Editor/MiniEditor.js +2 -1
  36. package/dist/Editor/Styles/EditorStyles.js +20 -5
  37. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  38. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  39. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  40. package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
  41. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
  42. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +4 -2
  43. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  44. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +4 -2
  45. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
  46. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +7 -4
  47. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
  48. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +69 -9
  49. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +58 -10
  50. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
  51. package/dist/Editor/Toolbar/PopupTool/index.js +5 -2
  52. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  53. package/dist/Editor/assets/svg/BackIcon.js +18 -0
  54. package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
  55. package/dist/Editor/common/ColorPickerButton.js +38 -16
  56. package/dist/Editor/common/CustomColorPicker/index.js +130 -0
  57. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  58. package/dist/Editor/common/CustomDialog2/index.js +94 -0
  59. package/dist/Editor/common/CustomDialog2/style.js +67 -0
  60. package/dist/Editor/common/CustomSelect.js +43 -0
  61. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  62. package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
  63. package/dist/Editor/common/Icon.js +28 -0
  64. package/dist/Editor/common/ImageSelector/ImageSelector.js +46 -8
  65. package/dist/Editor/common/ImageSelector/Options/Upload.js +26 -11
  66. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  67. package/dist/Editor/common/LinkSettings/NavComponents.js +6 -2
  68. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  69. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  70. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  71. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  72. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  73. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  74. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +20 -7
  75. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  76. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +3 -1
  77. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +20 -7
  78. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -2
  79. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  80. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  81. package/dist/Editor/common/RnD/Utils/gridDropItem.js +28 -18
  82. package/dist/Editor/common/RnD/Utils/index.js +3 -1
  83. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +45 -58
  84. package/dist/Editor/common/RnD/VirtualElement/helper.js +320 -130
  85. package/dist/Editor/common/RnD/VirtualElement/styles.js +22 -0
  86. package/dist/Editor/common/RnD/index.js +48 -13
  87. package/dist/Editor/common/Shorthands/elements.js +54 -0
  88. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  89. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
  90. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +15 -2
  91. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  92. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  93. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
  94. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
  95. package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +115 -0
  96. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
  97. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  98. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -0
  99. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  100. package/dist/Editor/common/StyleBuilder/index.js +8 -4
  101. package/dist/Editor/common/Uploader.js +125 -17
  102. package/dist/Editor/common/UploaderWithProgress.js +183 -0
  103. package/dist/Editor/common/iconslist.js +21 -0
  104. package/dist/Editor/commonStyle.js +107 -64
  105. package/dist/Editor/helper/index.js +10 -2
  106. package/dist/Editor/helper/textIndeces.js +58 -0
  107. package/dist/Editor/helper/theme.js +203 -2
  108. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  109. package/dist/Editor/hooks/useMouseMove.js +9 -3
  110. package/dist/Editor/hooks/useThemeValues.js +63 -0
  111. package/dist/Editor/plugins/withEmbeds.js +1 -1
  112. package/dist/Editor/plugins/withHTML.js +7 -3
  113. package/dist/Editor/plugins/withTable.js +1 -1
  114. package/dist/Editor/service/fileupload.js +53 -0
  115. package/dist/Editor/theme/ThemeList.js +50 -173
  116. package/dist/Editor/theme/index.js +149 -0
  117. package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
  118. package/dist/Editor/themeSettings/buttons/index.js +300 -0
  119. package/dist/Editor/themeSettings/buttons/style.js +23 -0
  120. package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
  121. package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
  122. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  123. package/dist/Editor/themeSettings/fonts/index.js +240 -0
  124. package/dist/Editor/themeSettings/fonts/style.js +62 -0
  125. package/dist/Editor/themeSettings/icons.js +60 -0
  126. package/dist/Editor/themeSettings/index.js +380 -0
  127. package/dist/Editor/themeSettings/style.js +299 -0
  128. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  129. package/dist/Editor/themeSettingsAI/index.js +355 -0
  130. package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
  131. package/dist/Editor/themeSettingsAI/style.js +332 -0
  132. package/dist/Editor/utils/SlateUtilityFunctions.js +231 -25
  133. package/dist/Editor/utils/accordion.js +62 -34
  134. package/dist/Editor/utils/button.js +1 -17
  135. package/dist/Editor/utils/draftToSlate.js +3 -2
  136. package/dist/Editor/utils/font.js +40 -37
  137. package/dist/Editor/utils/helper.js +97 -21
  138. package/dist/Editor/utils/insertAppHeader.js +8 -4
  139. package/package.json +4 -4
  140. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -454
@@ -1,9 +1,15 @@
1
1
  import React, { useState, useEffect, useRef } from "react";
2
2
  import { useSlateStatic, ReactEditor } from "slate-react";
3
3
  import { Node, Transforms } from "slate";
4
- import { IconButton, Tooltip, Box, useTheme } from "@mui/material";
4
+ import IconButton from '@mui/material/IconButton';
5
+ import Tooltip from '@mui/material/Tooltip';
6
+ import Box from '@mui/material/Box';
7
+ import useTheme from '@mui/material/styles/useTheme';
8
+ import Grid from '@mui/material/Grid';
9
+ import CircularProgress from '@mui/material/CircularProgress';
5
10
  import DeleteIcon from "@mui/icons-material/Delete";
6
11
  import AspectRatioIcon from "@mui/icons-material/AspectRatio";
12
+ import HighlightOffRoundedIcon from "@mui/icons-material/HighlightOffRounded";
7
13
  import Icon from "../../common/Icon";
8
14
  import useResize from "../../utils/customHooks/useResize";
9
15
  import EmbedPopup from "./EmbedPopup";
@@ -13,8 +19,10 @@ import { getEmbedURL } from "../../helper";
13
19
  import { getBreakPointsValue, getTRBLBreakPoints, groupByBreakpoint } from "../../helper/theme";
14
20
  import { useEditorContext } from "../../hooks/useMouseMove";
15
21
  import useCommonStyle from "../../commonStyle";
22
+ import ImageSelector from "../../common/ImageSelector/ImageSelector";
16
23
  import { jsx as _jsx } from "react/jsx-runtime";
17
24
  import { jsxs as _jsxs } from "react/jsx-runtime";
25
+ import { Fragment as _Fragment } from "react/jsx-runtime";
18
26
  const TYPE_LABELS = {
19
27
  calendly: "Embed Calendly or Other",
20
28
  video: "Embed Video or Other",
@@ -78,18 +86,97 @@ const VideoPlaceholder = props => {
78
86
  onSettings,
79
87
  classes,
80
88
  type,
81
- translation
89
+ translation,
90
+ uploadStatus,
91
+ setUploadStatus,
92
+ uploadTerminator,
93
+ uniqueId,
94
+ editor,
95
+ path
82
96
  } = props;
83
- return !url ? !readOnly ? /*#__PURE__*/_jsxs(Box, {
97
+ const cancelUpload = e => {
98
+ e.stopPropagation();
99
+ uploadTerminator(uniqueId, setUploadStatus);
100
+ Transforms.setNodes(editor, {
101
+ isUpload: false,
102
+ isUploading: false,
103
+ file: null
104
+ }, {
105
+ at: path
106
+ });
107
+ };
108
+ return !url ? !readOnly ? /*#__PURE__*/_jsx(Box, {
84
109
  component: "button",
85
110
  className: "element-empty-btn",
86
- onClick: onSettings,
111
+ onClick: !uploadStatus?.isUploading ? onSettings : () => {},
87
112
  sx: {
88
113
  ...classes.emptyThumbBtn
89
114
  },
90
- children: [/*#__PURE__*/_jsx(Icon, {
91
- icon: "video"
92
- }), TYPE_LABELS[type] || translation("Embed Video or Other")]
115
+ children: uploadStatus?.isUploading ? /*#__PURE__*/_jsxs(Grid, {
116
+ container: true,
117
+ direction: "row",
118
+ sx: {
119
+ justifyContent: "space-between",
120
+ alignItems: "center"
121
+ },
122
+ children: [/*#__PURE__*/_jsx(Grid, {
123
+ children: /*#__PURE__*/_jsxs(Grid, {
124
+ container: true,
125
+ direction: "row",
126
+ sx: {
127
+ justifyContent: "space-between",
128
+ alignItems: "center",
129
+ gap: 1
130
+ },
131
+ children: [/*#__PURE__*/_jsx(Grid, {
132
+ children: /*#__PURE__*/_jsx(Icon, {
133
+ icon: "image"
134
+ })
135
+ }), /*#__PURE__*/_jsx(Grid, {
136
+ children: /*#__PURE__*/_jsxs(Box, {
137
+ display: "flex",
138
+ flexDirection: "column",
139
+ alignItems: "flex-start",
140
+ justifyContent: "space-between",
141
+ children: [/*#__PURE__*/_jsx(Box, {
142
+ className: "truncateText",
143
+ children: uploadStatus?.fileName
144
+ }), /*#__PURE__*/_jsxs(Box, {
145
+ display: "flex",
146
+ alignItems: "center",
147
+ gap: 1,
148
+ marginTop: 1,
149
+ children: [/*#__PURE__*/_jsx(Box, {
150
+ children: uploadStatus?.fileSize
151
+ }), /*#__PURE__*/_jsx(CircularProgress, {
152
+ variant: "determinate",
153
+ value: uploadStatus?.uploadPercentage ?? 0,
154
+ className: "circularProgress-cls",
155
+ size: 15,
156
+ thickness: 8
157
+ }), /*#__PURE__*/_jsx(Box, {
158
+ children: `${uploadStatus?.uploadPercentage?.toFixed(0) ?? 0}%`
159
+ })]
160
+ })]
161
+ })
162
+ })]
163
+ })
164
+ }), /*#__PURE__*/_jsx(Grid, {
165
+ children: /*#__PURE__*/_jsx(HighlightOffRoundedIcon, {
166
+ className: "uploadCancel",
167
+ sx: {
168
+ cursor: "pointer"
169
+ },
170
+ onClick: e => {
171
+ cancelUpload(e);
172
+ }
173
+ })
174
+ })]
175
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
176
+ children: [/*#__PURE__*/_jsx(Icon, {
177
+ icon: "video"
178
+ }), TYPE_LABELS[type] || translation("Embed Video or Other")]
179
+ })
93
180
  }) : /*#__PURE__*/_jsxs(Box, {
94
181
  sx: {
95
182
  color: "#64748B !important",
@@ -120,14 +207,23 @@ const Video = ({
120
207
  xsHidden,
121
208
  width: oldWidth,
122
209
  bannerSpacing,
123
- aspectRatio
210
+ aspectRatio,
211
+ file,
212
+ isUploading,
213
+ uniqueId,
214
+ fromFreeGrid
124
215
  } = element;
125
216
  const editor = useSlateStatic();
126
217
  const [openSetttings, setOpenSettings] = useState(false);
127
218
  const [parentDOM, setParentDOM] = useState(null);
128
219
  const {
129
220
  readOnly,
130
- translation
221
+ translation,
222
+ services,
223
+ uploadFile,
224
+ resumeUploadState,
225
+ uploadTerminator,
226
+ isUploadInProgress = () => false
131
227
  } = customProps;
132
228
  const {
133
229
  vertical,
@@ -148,6 +244,63 @@ const Video = ({
148
244
  return element?.size || {};
149
245
  }
150
246
  };
247
+ const xhrRef = useRef(null);
248
+ const [openUploadPopup, setUploadPopupOpen] = useState(false);
249
+ const [uploadStatus, setUploadStatus] = useState({
250
+ isUploading: false,
251
+ uploadPercentage: 0
252
+ });
253
+ const onClickUpload = () => {
254
+ setUploadPopupOpen(true);
255
+ };
256
+ const onSelectVideo = async video => {
257
+ handleClose();
258
+ let finalURL = null;
259
+ try {
260
+ if (video?.isUpload === false) {
261
+ finalURL = video?.embedURL;
262
+ } else {
263
+ const id = !uniqueId ? crypto?.randomUUID() : uniqueId;
264
+ const result = await services("uploadFile", video?.file);
265
+ const uploadUrl = result?.data?.[0];
266
+ const fileEntry = {
267
+ ...video,
268
+ xhrRef,
269
+ presidnedURL: uploadUrl,
270
+ status: "uploading"
271
+ };
272
+ uploadFile(id, fileEntry, setUploadStatus, onSave, "video");
273
+ if (!fromFreeGrid) {
274
+ Transforms.setNodes(editor, {
275
+ uniqueId: id,
276
+ isUploading: true
277
+ }, {
278
+ at: path
279
+ });
280
+ } else {
281
+ Transforms.setNodes(editor, {
282
+ isUploading: true
283
+ }, {
284
+ at: path
285
+ });
286
+ }
287
+ }
288
+ if (finalURL) {
289
+ const updateObject = {
290
+ ...element,
291
+ url: finalURL
292
+ };
293
+ onSave(updateObject);
294
+ } else {
295
+ return;
296
+ }
297
+ } catch (error) {
298
+ console.log(error);
299
+ }
300
+ };
301
+ const handleClose = () => {
302
+ setUploadPopupOpen(false);
303
+ };
151
304
  const [size, onMouseDown, resizing, onLoad] = useResize({
152
305
  parentDOM,
153
306
  size: getSize(),
@@ -161,12 +314,49 @@ const Video = ({
161
314
  });
162
315
  const arr = Array.from(Node.elements(editor));
163
316
  const ele = arr.find(([elem]) => element === elem);
317
+ const noUploadTracks = () => {
318
+ setUploadStatus({
319
+ isUploading: false,
320
+ uploadPercentage: 0,
321
+ fileName: null,
322
+ fileSize: null
323
+ });
324
+ };
325
+ useEffect(() => {
326
+ const isUploading = isUploadInProgress(uniqueId);
327
+ if (fromFreeGrid) {
328
+ if (isUploading) {
329
+ resumeUploadState(uniqueId, setUploadStatus, onSave, noUploadTracks, "image");
330
+ } else {
331
+ if (!isUploading && file) {
332
+ onSelectVideo({
333
+ file: file
334
+ });
335
+ }
336
+ }
337
+ }
338
+ return () => {
339
+ // Transforms.setNodes(editor, { isUploading: false }, { at: path });
340
+ };
341
+ }, [uniqueId, isUploading, file]);
164
342
  useEffect(() => {
165
343
  if (editor && ele && ele[1] !== undefined) {
166
344
  const dom = ReactEditor.toDOMNode(editor, Node.get(editor, ele[1]));
167
345
  setParentDOM(dom);
168
346
  onLoad(element?.size || {});
169
347
  }
348
+ if (!fromFreeGrid) {
349
+ if (uniqueId && isUploading) {
350
+ resumeUploadState(uniqueId, setUploadStatus, onSave, noUploadTracks, "video");
351
+ } else if (file && isUploading) {
352
+ onSelectVideo({
353
+ file: file
354
+ });
355
+ }
356
+ }
357
+ return () => {
358
+ // xhrRef?.current?.abort();
359
+ };
170
360
  }, []);
171
361
  const ToolBar = () => {
172
362
  return /*#__PURE__*/_jsxs("div", {
@@ -194,12 +384,35 @@ const Video = ({
194
384
  };
195
385
  const onSave = data => {
196
386
  try {
197
- const updateData = {
198
- ...data
199
- };
387
+ let updateData = {};
388
+ if (typeof data === "string") {
389
+ updateData = {
390
+ url: data,
391
+ uniqueId: undefined,
392
+ isUploading: false
393
+ };
394
+ } else if (typeof data?.url !== "string") {
395
+ updateData = {
396
+ ...data,
397
+ url: ""
398
+ };
399
+ onSelectVideo({
400
+ file: data?.url?.file,
401
+ isUpload: true,
402
+ setUploadStatus,
403
+ services: customProps?.services
404
+ });
405
+ } else {
406
+ updateData = data;
407
+ }
200
408
  delete updateData.children;
409
+ Transforms.select(editor, path);
410
+ ReactEditor.focus(editor);
201
411
  Transforms.setNodes(editor, {
202
- ...updateData
412
+ ...updateData,
413
+ isUpload: false,
414
+ isUploading: false,
415
+ file: null
203
416
  }, {
204
417
  at: path
205
418
  });
@@ -281,13 +494,19 @@ const Video = ({
281
494
  children: [!readOnly && url && /*#__PURE__*/_jsx(ToolBar, {}), /*#__PURE__*/_jsx(VideoPlaceholder, {
282
495
  ...element,
283
496
  embedURL: embedURL,
284
- onSettings: onSettings,
497
+ onSettings: onClickUpload,
285
498
  videoSX: videoSX,
286
499
  url: url,
287
500
  readOnly: readOnly,
288
501
  resizing: resizing,
289
502
  classes: classes,
290
- translation: translation
503
+ translation: translation,
504
+ uploadStatus: uploadStatus,
505
+ setUploadStatus: setUploadStatus,
506
+ uploadTerminator: uploadTerminator,
507
+ uniqueId: uniqueId,
508
+ editor: editor,
509
+ path: path
291
510
  }), !readOnly && url ? /*#__PURE__*/_jsx(IconButton, {
292
511
  onPointerDown: onMouseDown,
293
512
  style: {
@@ -295,6 +514,18 @@ const Video = ({
295
514
  },
296
515
  className: "resize-br visible-on-hover",
297
516
  children: /*#__PURE__*/_jsx(AspectRatioIcon, {})
517
+ }) : null, openUploadPopup ? /*#__PURE__*/_jsx(ImageSelector, {
518
+ open: true,
519
+ Add: true,
520
+ commentMore: true,
521
+ actions: true,
522
+ title: "Video",
523
+ onClose: handleClose,
524
+ customProps: customProps,
525
+ onSelectImage: onSelectVideo,
526
+ setUploadPopupOpen: setUploadPopupOpen,
527
+ setUploadStatus: setUploadStatus,
528
+ xhrRef: xhrRef
298
529
  }) : null]
299
530
  }), children]
300
531
  });
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from "react";
2
- import { Transforms, Node } from "slate";
2
+ import { Transforms } from "slate";
3
3
  import { useSlateStatic, ReactEditor } from "slate-react";
4
4
  import { IconButton, Tooltip, Grid, useTheme } from "@mui/material";
5
5
  import FormElements from "./FormElements";
@@ -9,20 +9,20 @@ const FormStyles = theme => ({
9
9
  color: "#94A3B8"
10
10
  },
11
11
  bodyTextArea: {
12
- '& .mini-editor-cls': {
13
- padding: '12px',
14
- '&:focus-visible': {
15
- outline: 'none',
16
- border: 'none'
12
+ "& .mini-editor-cls": {
13
+ padding: "12px",
14
+ "&:focus-visible": {
15
+ outline: "none",
16
+ border: "none"
17
17
  }
18
18
  },
19
19
  "& .editorWorkflow": {
20
- minHeight: '130px',
21
- padding: '12px',
20
+ minHeight: "130px",
21
+ padding: "12px",
22
22
  paddingBottom: 0,
23
- '&:focus-visible': {
24
- outline: 'none',
25
- border: 'none'
23
+ "&:focus-visible": {
24
+ outline: "none",
25
+ border: "none"
26
26
  }
27
27
  }
28
28
  },
@@ -105,7 +105,7 @@ const FormStyles = theme => ({
105
105
  padding: "4px 22px",
106
106
  textTransform: "none",
107
107
  border: "1px solid #D8DDE1",
108
- minWidth: '126px',
108
+ minWidth: "126px",
109
109
  "& svg": {
110
110
  "& path": {
111
111
  stroke: "#64748B"
@@ -169,17 +169,19 @@ const FormStyles = theme => ({
169
169
  }
170
170
  },
171
171
  colorButtonSingle: {
172
+ border: "1.5px solid #DCE4EC !important",
172
173
  "&.active": {
173
- "&:before": {
174
- content: '" "',
175
- position: "absolute",
176
- top: "-5px",
177
- left: "-5px",
178
- width: "calc(100% + 4px)",
179
- height: "calc(100% + 4px)",
180
- border: "3px solid blue",
181
- borderRadius: "50%"
182
- }
174
+ // "&:before": {
175
+ // content: '" "',
176
+ // position: "absolute",
177
+ // top: "-5px",
178
+ // left: "-5px",
179
+ // width: "calc(100% + 4px)",
180
+ // height: "calc(100% + 4px)",
181
+ // border: "3px solid blue",
182
+ // borderRadius: "50%",
183
+ // },
184
+ outline: "2px solid #2563EB"
183
185
  }
184
186
  },
185
187
  colorButtonsInner: {
@@ -249,7 +251,7 @@ const FormStyles = theme => ({
249
251
  }
250
252
  },
251
253
  root: {
252
- padding: '10px'
254
+ padding: "10px"
253
255
  }
254
256
  });
255
257
  export default FormStyles;
@@ -1,3 +1,27 @@
1
1
  export const minutes = [30, 35, 40, 45, 50, 55];
2
2
  export const hours = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
3
- export const days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31];
3
+ export const days = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31];
4
+ export const allowedFormat = {
5
+ Document: ".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.rtf",
6
+ Image: "image/*",
7
+ Video: ".mp4,.webm,.ogg,.mov,.avi,.mkv",
8
+ Embed: "*"
9
+ };
10
+ export const maxSizeMap = {
11
+ Image: 25 * 1024 * 1024,
12
+ // Test -> 5 * 1024 * 1024 -> 5MB
13
+ Video: 1024 * 1024 * 1024,
14
+ Document: 25 * 1024 * 1024,
15
+ Embed: Infinity
16
+ };
17
+ export const allowedTypes = {
18
+ Document: ["application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "text/plain", "application/rtf"],
19
+ Image: ["image/jpeg", "image/png", "image/gif", "image/webp", "image/svg+xml"],
20
+ Video: ["video/mp4", "video/webm", "video/ogg", "video/quicktime", "video/x-msvideo", "video/x-matroska"],
21
+ Embed: ["*"]
22
+ };
23
+ export const extensionMap = {
24
+ Video: ["mp4", "webm", "ogg", "mov", "avi", "mkv"],
25
+ Image: ["jpg", "jpeg", "png", "gif", "webp", "svg"],
26
+ Document: ["pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "rtf"]
27
+ };
@@ -22,6 +22,7 @@ import { DEFAULT_TABLE_NODE } from "../../utils/table";
22
22
  import itemOptions from "./Options/sectionItemOptions";
23
23
  import { getBreakPointsValue, groupByBreakpoint } from "../../helper/theme";
24
24
  import { useDebouncedCallback } from "use-debounce";
25
+ import { getNewElementXsValues } from "./helper";
25
26
  import updateFormName from "../../utils/updateFormName";
26
27
  import { jsx as _jsx } from "react/jsx-runtime";
27
28
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -183,6 +184,11 @@ const FreeGrid = props => {
183
184
  const handleAddElementClick = type => () => {
184
185
  const isEmpty = isEmptySection();
185
186
  const insertAt = isEmpty ? [...path, 0] : [...path, childrenCountRef.current];
187
+ const {
188
+ xsVal,
189
+ sectionHeightXs
190
+ } = getNewElementXsValues(type, element?.children);
191
+ const id = crypto?.randomUUID();
186
192
  switch (type) {
187
193
  case "addText":
188
194
  Transforms.insertNodes(editor, [{
@@ -199,7 +205,8 @@ const FreeGrid = props => {
199
205
  marginTop: 0,
200
206
  top: 0,
201
207
  width: 170,
202
- height: 30
208
+ height: 30,
209
+ ...(xsVal || {})
203
210
  }], {
204
211
  at: [...insertAt]
205
212
  });
@@ -217,20 +224,6 @@ const FreeGrid = props => {
217
224
  linkType: "webAddress"
218
225
  },
219
226
  iconPosition: "start",
220
- bgColor: "#2563EB",
221
- textColor: "#FFF",
222
- borderRadius: {
223
- topLeft: 30,
224
- topRight: 30,
225
- bottomLeft: 30,
226
- bottomRight: 30
227
- },
228
- bannerSpacing: {
229
- left: 12,
230
- top: 12,
231
- right: 12,
232
- bottom: 12
233
- },
234
227
  textAlign: "center",
235
228
  label: "Get Started"
236
229
  }],
@@ -239,7 +232,8 @@ const FreeGrid = props => {
239
232
  marginTop: 0,
240
233
  top: 0,
241
234
  width: 143,
242
- height: 50
235
+ height: 50,
236
+ ...(xsVal || {})
243
237
  }], {
244
238
  at: [...insertAt]
245
239
  });
@@ -265,8 +259,9 @@ const FreeGrid = props => {
265
259
  top: 0,
266
260
  width: 217,
267
261
  height: 173,
268
- width_xs: 217,
269
- height_xs: 173
262
+ // width_xs: 217,
263
+ // height_xs: 173,
264
+ ...(xsVal || {})
270
265
  }], {
271
266
  at: [...insertAt]
272
267
  });
@@ -282,14 +277,17 @@ const FreeGrid = props => {
282
277
  images: [],
283
278
  children: [{
284
279
  text: ""
285
- }]
280
+ }],
281
+ fromFreeGrid: true,
282
+ uniqueId: id
286
283
  }],
287
284
  gridArea: "3 / 1 / 4 / 2",
288
285
  left: 50,
289
286
  marginTop: 0,
290
287
  top: 0,
291
- width: 170,
292
- height: 80
288
+ width: 650,
289
+ height: 80,
290
+ ...(xsVal || {})
293
291
  }], {
294
292
  at: [...insertAt]
295
293
  });
@@ -299,10 +297,13 @@ const FreeGrid = props => {
299
297
  ...insertFreeGridItem("video", createEmbedNode("video", {
300
298
  url: "",
301
299
  alt: "",
302
- images: []
300
+ images: [],
301
+ fromFreeGrid: true,
302
+ uniqueId: id
303
303
  }), {
304
304
  height: 370,
305
- width: 650
305
+ width: 650,
306
+ ...(xsVal || {})
306
307
  })
307
308
  }], {
308
309
  at: [...insertAt]
@@ -314,7 +315,8 @@ const FreeGrid = props => {
314
315
  ...DEFAULT_TABLE_NODE()
315
316
  }, {
316
317
  height: 150,
317
- width: 400
318
+ width: 400,
319
+ ...(xsVal || {})
318
320
  })
319
321
  }], {
320
322
  at: [...insertAt]
@@ -338,7 +340,8 @@ const FreeGrid = props => {
338
340
  marginTop: 0,
339
341
  top: 0,
340
342
  width: 400,
341
- height: 300
343
+ height: 300,
344
+ ...(xsVal || {})
342
345
  }], {
343
346
  at: [...insertAt]
344
347
  });
@@ -350,7 +353,9 @@ const FreeGrid = props => {
350
353
  children: [{
351
354
  text: ""
352
355
  }]
353
- }, {}, "freegridBox")
356
+ }, {
357
+ ...(xsVal || {})
358
+ }, "freegridBox")
354
359
  }], {
355
360
  at: [...insertAt]
356
361
  });
@@ -361,7 +366,8 @@ const FreeGrid = props => {
361
366
  ...FORM_NODE()
362
367
  }, {
363
368
  height: 92,
364
- width: 400
369
+ width: 400,
370
+ ...(xsVal || {})
365
371
  })
366
372
  }], {
367
373
  at: [...insertAt]
@@ -375,7 +381,8 @@ const FreeGrid = props => {
375
381
  })
376
382
  }, {
377
383
  height: 60,
378
- width: 400
384
+ width: 400,
385
+ ...(xsVal || {})
379
386
  })
380
387
  }], {
381
388
  at: [...insertAt]
@@ -396,19 +403,18 @@ const FreeGrid = props => {
396
403
  marginTop: 0,
397
404
  top: 0,
398
405
  width: 170,
399
- height: 30
406
+ height: 30,
407
+ ...(xsVal || {})
400
408
  }], {
401
409
  at: [...insertAt]
402
410
  });
403
411
  break;
404
412
  default:
405
413
  }
406
- if (breakpoint === "lg") {
414
+ if (xsVal) {
407
415
  setSelectedElement({});
408
-
409
- // auto align in mobile
410
416
  Transforms.setNodes(editor, {
411
- xs_updatedOn: null,
417
+ height_xs: sectionHeightXs,
412
418
  updated_at: new Date().getTime()
413
419
  }, {
414
420
  at: path
@@ -8,7 +8,7 @@ import { onDropItem, ROW_HEIGHT } from "../../common/RnD/Utils/gridDropItem";
8
8
  import useBreakpoints from "../../hooks/useBreakpoints";
9
9
  import { breakpointValues, formatBreakpointValues } from "./breakpointConstants";
10
10
  import { useEditorContext } from "../../hooks/useMouseMove";
11
- import { getBreakPointsValue } from "../../helper/theme";
11
+ import { getBreakPointsValue, groupByBreakpoint } from "../../helper/theme";
12
12
  import focusOnNewItem from "../../helper/RnD/focusOnNewItem";
13
13
  import { bringItemToFB } from "../../helper";
14
14
  import itemOptions from "./Options/sectionItemOptions";
@@ -160,6 +160,11 @@ const FreeGridBox = props => {
160
160
  const isBoxHeader = useMemo(() => {
161
161
  return element?.children?.some(c => c.childType === "appHeader" && !c.xs_updatedOn);
162
162
  }, [element]);
163
+ const boxSp = groupByBreakpoint({
164
+ borderRadius: {
165
+ ...getBreakPointsValue(sectionBorderRadius || {}, null, "overrideBorderRadius", true)
166
+ }
167
+ }, theme);
163
168
  return /*#__PURE__*/_jsx(RnD, {
164
169
  id: `freegrid_box_item_${path.join("|")}_${updated_at}_${breakpoint}`,
165
170
  className: `freegrid-item path-${path.length} breakpoint-${breakpoint} freegrid-box_${path.join("_")}`,
@@ -226,9 +231,7 @@ const FreeGridBox = props => {
226
231
  "--rows": `repeat(${repeatTimes}, ${ROW_HEIGHT}px)`
227
232
  },
228
233
  sx: {
229
- borderRadius: {
230
- ...getBreakPointsValue(sectionBorderRadius || {}, null, "overrideBorderRadius", true)
231
- },
234
+ ...boxSp,
232
235
  background: sectionBgColor,
233
236
  backgroundImage: sectionBackgroundImage ? `url('${sectionBackgroundImage}')` : "",
234
237
  borderColor: borderColor || "transparent",
@@ -321,6 +321,7 @@ const FreeGridItem = props => {
321
321
  customProps: customProps,
322
322
  translation: translation,
323
323
  xsHidden: xsHidden,
324
+ disableClick: element?.children?.[0]?.isUploading,
324
325
  children: /*#__PURE__*/_jsxs(Box, {
325
326
  component: "div",
326
327
  ...attributes,