@flozy/editor 10.5.2 → 10.5.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 (169) hide show
  1. package/dist/Editor/ChatEditor.js +16 -17
  2. package/dist/Editor/CommonEditor.js +14 -128
  3. package/dist/Editor/DialogWrapper.js +25 -31
  4. package/dist/Editor/Editor.css +8 -46
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -11
  6. package/dist/Editor/Elements/Accordion/Accordion.js +9 -46
  7. package/dist/Editor/Elements/Accordion/AccordionSummary.js +23 -1
  8. package/dist/Editor/Elements/AppHeader/AppHeader.js +5 -10
  9. package/dist/Editor/Elements/Button/EditorButton.js +9 -27
  10. package/dist/Editor/Elements/Carousel/CarouselItem.js +1 -2
  11. package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -61
  12. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  13. package/dist/Editor/Elements/Color Picker/ColorPicker.js +7 -10
  14. package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
  15. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/{SelectV1.js → MultiSelect.js} +69 -125
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +10 -10
  17. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +9 -28
  18. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +5 -12
  19. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +14 -40
  20. package/dist/Editor/Elements/Divider/Divider.js +1 -1
  21. package/dist/Editor/Elements/Embed/Video.js +1 -1
  22. package/dist/Editor/Elements/Form/Form.js +3 -3
  23. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +1 -0
  24. package/dist/Editor/Elements/Form/FormField.js +2 -3
  25. package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
  26. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +32 -38
  27. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -7
  28. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +0 -1
  29. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
  30. package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +1 -1
  31. package/dist/Editor/Elements/FreeGrid/styles.js +0 -14
  32. package/dist/Editor/Elements/Grid/Grid.js +2 -14
  33. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  34. package/dist/Editor/Elements/Signature/Signature.css +1 -2
  35. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +5 -18
  36. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +3 -16
  37. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  38. package/dist/Editor/Elements/Table/AddRowCol.js +2 -8
  39. package/dist/Editor/Elements/Table/DragButton.js +1 -0
  40. package/dist/Editor/Elements/Table/Draggable.js +2 -6
  41. package/dist/Editor/Elements/Table/Styles.js +0 -7
  42. package/dist/Editor/Elements/Table/Table.js +3 -3
  43. package/dist/Editor/Elements/Table/TableCell.js +5 -24
  44. package/dist/Editor/Elements/Title/title.js +6 -6
  45. package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
  46. package/dist/Editor/MiniEditor.js +1 -2
  47. package/dist/Editor/Styles/EditorStyles.js +5 -5
  48. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
  49. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
  50. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  51. package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -10
  52. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
  53. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +2 -4
  54. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
  55. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
  56. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -7
  57. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
  58. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +12 -72
  59. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +10 -58
  60. package/dist/Editor/Toolbar/PopupTool/index.js +4 -4
  61. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  62. package/dist/Editor/common/ColorPickerButton.js +16 -41
  63. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  64. package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
  65. package/dist/Editor/common/Icon.js +0 -28
  66. package/dist/Editor/common/ImageSelector/ImageSelector.js +2 -2
  67. package/dist/Editor/common/ImageSelector/Styles.js +9 -3
  68. package/dist/Editor/common/LinkSettings/NavComponents.js +65 -45
  69. package/dist/Editor/common/LinkSettings/index.js +28 -14
  70. package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
  71. package/dist/Editor/common/LinkSettings/style.js +244 -164
  72. package/dist/Editor/common/RnD/ElementOptions/Actions.js +5 -4
  73. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
  74. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +3 -4
  75. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
  76. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
  77. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
  78. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
  79. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -4
  80. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
  81. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
  82. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +1 -3
  83. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
  84. package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -0
  85. package/dist/Editor/common/RnD/OptionsPopup/style.js +1 -0
  86. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -11
  87. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
  88. package/dist/Editor/common/RnD/Utils/gridDropItem.js +19 -28
  89. package/dist/Editor/common/RnD/Utils/index.js +1 -3
  90. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +58 -42
  91. package/dist/Editor/common/RnD/VirtualElement/helper.js +132 -323
  92. package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -16
  93. package/dist/Editor/common/RnD/index.js +38 -67
  94. package/dist/Editor/common/Select/index.js +7 -44
  95. package/dist/Editor/common/Select/styles.js +2 -30
  96. package/dist/Editor/common/Shorthands/elements.js +0 -54
  97. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
  98. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +9 -12
  99. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  100. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +0 -4
  101. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
  102. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
  103. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
  104. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +8 -16
  105. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +10 -36
  106. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +7 -16
  107. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
  108. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
  109. package/dist/Editor/common/SwipeableDrawer/style.js +12 -14
  110. package/dist/Editor/common/Uploader.js +0 -16
  111. package/dist/Editor/common/iconListV2.js +0 -76
  112. package/dist/Editor/common/iconslist.js +0 -21
  113. package/dist/Editor/commonStyle.js +61 -116
  114. package/dist/Editor/helper/deserialize/index.js +4 -6
  115. package/dist/Editor/helper/index.js +1 -5
  116. package/dist/Editor/helper/theme.js +2 -203
  117. package/dist/Editor/hooks/useMouseMove.js +3 -9
  118. package/dist/Editor/hooks/useTable.js +4 -5
  119. package/dist/Editor/plugins/withEmbeds.js +1 -1
  120. package/dist/Editor/plugins/withHTML.js +2 -5
  121. package/dist/Editor/plugins/withTable.js +1 -1
  122. package/dist/Editor/theme/ThemeList.js +173 -50
  123. package/dist/Editor/utils/SlateUtilityFunctions.js +37 -161
  124. package/dist/Editor/utils/accordion.js +4 -14
  125. package/dist/Editor/utils/button.js +17 -1
  126. package/dist/Editor/utils/customHooks/useTableResize.js +9 -49
  127. package/dist/Editor/utils/draftToSlate.js +2 -3
  128. package/dist/Editor/utils/events.js +6 -50
  129. package/dist/Editor/utils/font.js +37 -40
  130. package/dist/Editor/utils/formfield.js +0 -1
  131. package/dist/Editor/utils/helper.js +27 -140
  132. package/dist/Editor/utils/insertAppHeader.js +1 -1
  133. package/dist/Editor/utils/signature.js +9 -2
  134. package/package.json +4 -4
  135. package/dist/Editor/Elements/FreeGrid/helper.js +0 -115
  136. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -439
  137. package/dist/Editor/assets/svg/BackIcon.js +0 -18
  138. package/dist/Editor/assets/svg/ThemeIcons.js +0 -293
  139. package/dist/Editor/common/Checkbox/index.js +0 -46
  140. package/dist/Editor/common/Checkbox/styles.js +0 -45
  141. package/dist/Editor/common/CustomColorPicker/index.js +0 -130
  142. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  143. package/dist/Editor/common/CustomDialog2/index.js +0 -94
  144. package/dist/Editor/common/CustomDialog2/style.js +0 -67
  145. package/dist/Editor/common/CustomSelect.js +0 -43
  146. package/dist/Editor/common/RadioGroup/index.js +0 -48
  147. package/dist/Editor/common/RadioGroup/styles.js +0 -29
  148. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
  149. package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +0 -115
  150. package/dist/Editor/helper/textIndeces.js +0 -58
  151. package/dist/Editor/hooks/useEditorTheme.js +0 -153
  152. package/dist/Editor/hooks/useThemeValues.js +0 -63
  153. package/dist/Editor/theme/index.js +0 -149
  154. package/dist/Editor/themeSettings/ActiveTheme.js +0 -82
  155. package/dist/Editor/themeSettings/buttons/index.js +0 -300
  156. package/dist/Editor/themeSettings/buttons/style.js +0 -23
  157. package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
  158. package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
  159. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
  160. package/dist/Editor/themeSettings/fonts/index.js +0 -240
  161. package/dist/Editor/themeSettings/fonts/style.js +0 -62
  162. package/dist/Editor/themeSettings/icons.js +0 -60
  163. package/dist/Editor/themeSettings/index.js +0 -380
  164. package/dist/Editor/themeSettings/style.js +0 -299
  165. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  166. package/dist/Editor/themeSettingsAI/index.js +0 -355
  167. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -202
  168. package/dist/Editor/themeSettingsAI/style.js +0 -332
  169. package/dist/Editor/utils/updateFormName.js +0 -22
@@ -10,10 +10,10 @@ import List from "@mui/material/List";
10
10
  import ListItem from "@mui/material/ListItem";
11
11
  import ListItemButton from "@mui/material/ListItemButton";
12
12
  import IconButton from "@mui/material/IconButton";
13
+ import SwipeableDrawer from "@mui/material/SwipeableDrawer";
13
14
  import Tooltip from "@mui/material/Tooltip";
14
15
  import { CloseIcon } from "../../../../../common/iconslist";
15
16
  import { useEditorContext } from "../../../../../hooks/useMouseMove";
16
- import SwipeableDrawer from "@mui/material/SwipeableDrawer";
17
17
  import Icon from "../../../../../common/Icon";
18
18
  import { colors } from "../../../../Color Picker/defaultColors";
19
19
  import PropertySettings from "../../Options";
@@ -26,73 +26,41 @@ const generateRandomColor = () => {
26
26
  const randomIndex = Math.floor(Math.random() * DEFAULT_COLORS?.length);
27
27
  return DEFAULT_COLORS[randomIndex];
28
28
  };
29
- const hasIds = arr => Array.isArray(arr) && arr.every(item => 'id' in item);
30
- const generateStableIds = arr => arr.map((item, index) => ({
31
- ...item,
32
- id: `multi_${item.value}_${index}`
33
- }));
34
- const SelectV1 = props => {
29
+ const MultiSelectWithPopover = props => {
35
30
  const {
36
- value,
37
31
  options = [],
38
- selectMultiple,
39
- property,
40
- wrapColumn = false,
32
+ value,
41
33
  onChange,
42
34
  onUpdate,
35
+ property,
36
+ wrapColumn = false,
43
37
  translation
44
38
  } = props;
45
39
  const [anchorEl, setAnchorEl] = useState(null);
46
40
  const [anchorElOption, setAnchorElOption] = useState(null);
47
41
  const [currentIndex, setCurrentIndex] = useState(null);
48
- const [selectedOptions, setSelectedOptions] = useState([]);
49
- const [availableOptions, setAvailableOptions] = useState([]);
42
+ const [selectedOptions, setSelectedOptions] = useState(value);
43
+ const [availableOptions, setAvailableOptions] = useState(options);
50
44
  const [showSnackBar, setShowSnackBar] = useState(false);
51
45
  const [chipColor, setChipColor] = useState(generateRandomColor());
52
46
  const [inputValue, setInputValue] = useState("");
53
- const [availableOptionsMap, setAvailableOptionsMap] = useState({});
54
- const [resolvedSelectedOptions, setResolvedSelectedOptions] = useState([]);
55
47
  const {
56
48
  theme
57
49
  } = useEditorContext();
58
50
  const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
59
51
  const PopoverComponent = isMobile ? SwipeableDrawer : Popover;
60
- useEffect(() => {
61
- const obj = {};
62
- for (const opt of availableOptions) {
63
- if (opt?.id != null) {
64
- obj[opt.id] = opt;
65
- }
66
- }
67
- setAvailableOptionsMap(obj);
68
- }, [availableOptions]);
69
- useEffect(() => {
70
- const resolved = selectedOptions?.filter(sel => sel?.id && availableOptionsMap?.[sel.id])?.map(sel => availableOptionsMap[sel?.id]) ?? [];
71
- setResolvedSelectedOptions(resolved);
72
- }, [selectedOptions, availableOptionsMap]);
73
- useEffect(() => {
74
- const enrichedAvailable = hasIds(options) ? options : generateStableIds(options);
75
- setAvailableOptions(enrichedAvailable);
76
- const enrichedSelected = hasIds(value) ? value : value?.map(sel => {
77
- const match = enrichedAvailable.find(opt => opt?.value === sel?.value);
78
- return match ? {
79
- id: match.id
80
- } : sel;
81
- });
82
- setSelectedOptions(enrichedSelected);
83
- }, []);
84
52
  const mode = useMemo(() => ({
85
53
  type: "editOptionMulti",
86
54
  edit: {
87
- label: selectMultiple ? "Multi Select" : "Select",
55
+ label: "Multi Select",
88
56
  visible: true,
89
57
  key: property,
90
- type: selectMultiple ? "multi-select" : "select",
91
- options: availableOptions || [],
58
+ type: "multi-select",
59
+ options: options || [],
92
60
  optionIndex: currentIndex,
93
61
  hideBackButton: true
94
62
  }
95
- }), [availableOptions, property, currentIndex, selectMultiple]);
63
+ }), [options, property, currentIndex]);
96
64
  const customScrollStyles = {
97
65
  scrollbarWidth: "thin",
98
66
  scrollbarColor: `${theme?.palette?.editor?.brainPopupScroll} transparent`,
@@ -113,12 +81,10 @@ const SelectV1 = props => {
113
81
  }
114
82
  }, [inputValue, chipColor]);
115
83
  useEffect(() => {
116
- const enriched = hasIds(options) ? options : generateStableIds(options);
117
- const isDifferent = JSON.stringify(enriched) !== JSON.stringify(availableOptions);
118
- if (isDifferent) {
119
- setAvailableOptions(enriched);
84
+ if (JSON.stringify(options) !== JSON.stringify(availableOptions)) {
85
+ setAvailableOptions(options);
120
86
  }
121
- }, [options]);
87
+ }, [options, availableOptions]);
122
88
  const handleOpenPopover = useCallback(event => {
123
89
  setAnchorEl(event.currentTarget);
124
90
  }, []);
@@ -127,40 +93,17 @@ const SelectV1 = props => {
127
93
  setAnchorEl(null);
128
94
  }, []);
129
95
  const handleAddOption = newValue => {
130
- const trimmedValue = newValue?.trim?.();
96
+ const trimmedValue = newValue?.trim();
131
97
  if (!trimmedValue) return;
132
- const isDuplicate = availableOptions.some(opt => opt.value.toLowerCase() === trimmedValue.toLowerCase());
133
- if (isDuplicate) {
134
- const existing = availableOptions.find(opt => opt?.value?.toLowerCase() === trimmedValue?.toLowerCase());
135
- const alreadySelected = selectedOptions?.some(sel => sel?.id === existing?.id);
136
- if (!alreadySelected) {
137
- const updatedSelected = selectMultiple ? [...selectedOptions, {
138
- id: existing.id
139
- }] : [{
140
- id: existing.id
141
- }];
142
- setSelectedOptions(updatedSelected);
143
- onChange?.(updatedSelected);
144
- }
145
- setInputValue("");
146
- setChipColor("");
147
- return;
148
- }
149
98
  const newOption = {
150
99
  value: trimmedValue,
151
- color: chipColor,
152
- id: `multi_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 5)}`
100
+ color: chipColor
153
101
  };
154
- const updatedAvailableOptions = [...availableOptions, newOption];
155
- const updatedSelectedOptions = selectMultiple ? [...selectedOptions, {
156
- id: newOption.id
157
- }] : [{
158
- id: newOption.id
159
- }];
160
- setAvailableOptions(updatedAvailableOptions);
161
- setSelectedOptions(updatedSelectedOptions);
162
- onUpdate?.(updatedAvailableOptions);
163
- onChange?.(updatedSelectedOptions);
102
+ if (!availableOptions?.some(opt => opt?.value === trimmedValue)) {
103
+ setAvailableOptions(prev => [...prev, newOption]);
104
+ setSelectedOptions(prev => [...prev, newOption]);
105
+ onUpdate([newOption, ...availableOptions]);
106
+ }
164
107
  setInputValue("");
165
108
  setChipColor("");
166
109
  };
@@ -171,6 +114,11 @@ const SelectV1 = props => {
171
114
  const onEditOption = (type, data) => {
172
115
  const updateData = data?.edit ? data?.edit?.options : data?.options;
173
116
  onUpdate(updateData);
117
+ if (data?.edit?.options) {
118
+ const updatedSelectedOptions = selectedOptions?.filter(selOption => updateData?.some(availOption => availOption?.value === selOption?.value && availOption?.color === selOption?.color));
119
+ setSelectedOptions(updatedSelectedOptions);
120
+ onClose();
121
+ }
174
122
  };
175
123
  const handleEditOption = (e, index) => {
176
124
  e.stopPropagation();
@@ -179,20 +127,12 @@ const SelectV1 = props => {
179
127
  setAnchorEl(null);
180
128
  };
181
129
  const handleSelectOption = option => {
182
- const isAlreadySelected = selectedOptions.some(opt => opt?.id === option?.id);
183
- if (isAlreadySelected) {
130
+ if (!selectedOptions?.some(opt => opt?.value === option?.value)) {
131
+ const updatedOptions = [...selectedOptions, option];
132
+ setSelectedOptions(updatedOptions);
133
+ onChange(updatedOptions);
134
+ } else {
184
135
  setShowSnackBar(true);
185
- return;
186
- }
187
- const updatedOptions = selectMultiple ? [...selectedOptions, {
188
- id: option?.id
189
- }] : [{
190
- id: option?.id
191
- }];
192
- setSelectedOptions(updatedOptions);
193
- onChange(updatedOptions);
194
- if (!selectMultiple) {
195
- handleClosePopover();
196
136
  }
197
137
  };
198
138
  const handleClearSelection = () => {
@@ -200,9 +140,11 @@ const SelectV1 = props => {
200
140
  };
201
141
  const handleDeleteChip = (event, option) => {
202
142
  event.stopPropagation();
203
- const updatedOptions = selectedOptions?.filter(selected => selected?.id !== option?.id);
204
- setSelectedOptions(updatedOptions);
205
- onChange(selectMultiple ? updatedOptions : updatedOptions[0] || null);
143
+ setSelectedOptions(prev => {
144
+ const updatedOptions = prev.filter(selected => selected?.value !== option?.value);
145
+ onChange(updatedOptions);
146
+ return updatedOptions;
147
+ });
206
148
  };
207
149
  const filteredOptions = availableOptions?.filter(option => option?.value?.toLowerCase()?.includes(inputValue?.toLowerCase()));
208
150
  const isExactMatch = availableOptions?.some(opt => opt?.value?.toLowerCase() === inputValue?.toLowerCase());
@@ -220,7 +162,7 @@ const SelectV1 = props => {
220
162
  cursor: "pointer"
221
163
  },
222
164
  onClick: handleOpenPopover,
223
- children: resolvedSelectedOptions?.map((option, index) => /*#__PURE__*/_jsx(Chip, {
165
+ children: selectedOptions?.map((option, index) => /*#__PURE__*/_jsx(Chip, {
224
166
  label: option?.value,
225
167
  onDelete: event => {
226
168
  handleDeleteChip(event, option);
@@ -288,12 +230,16 @@ const SelectV1 = props => {
288
230
  },
289
231
  disableClearable: true,
290
232
  options: [],
291
- getOptionLabel: () => "",
292
- value: resolvedSelectedOptions,
233
+ getOptionLabel: option => options?.value || "",
234
+ value: selectedOptions,
293
235
  onChange: (event, newValues) => {
294
- const stringOptions = newValues.filter(val => typeof val === "string" && val.trim());
295
- for (const str of stringOptions) {
296
- handleAddOption(str);
236
+ const addedOptions = newValues?.filter(value => typeof value === "object" || typeof value === "string" && value?.trim() !== "")?.map(value => typeof value === "string" ? {
237
+ value,
238
+ color: chipColor
239
+ } : value);
240
+ const isDuplicate = addedOptions?.some(newOpt => (selectedOptions || [])?.some(opt => opt.value === newOpt.value));
241
+ if (!isDuplicate) {
242
+ setSelectedOptions([...selectedOptions, ...addedOptions]);
297
243
  }
298
244
  },
299
245
  inputValue: inputValue,
@@ -357,32 +303,30 @@ const SelectV1 = props => {
357
303
  },
358
304
  placeholder: "Create new one..."
359
305
  }),
360
- renderTags: (tagValues, getTagProps) => {
361
- return tagValues?.map((option, index) => /*#__PURE__*/_jsx(Chip, {
362
- variant: "filled",
363
- label: option?.value,
364
- ...getTagProps({
365
- index
366
- }),
367
- onDelete: event => {
368
- handleDeleteChip(event, option);
369
- },
370
- deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {}),
371
- sx: {
372
- backgroundColor: option?.color,
373
- color: '#0F172A',
374
- "& .MuiChip-deleteIcon": {
375
- flexShrink: 0,
376
- "& path": {
377
- stroke: '#0F172A !important'
378
- }
379
- },
380
- "&:hover": {
381
- opacity: 0.8
306
+ renderTags: (tagValues, getTagProps) => tagValues.map((option, index) => /*#__PURE__*/_jsx(Chip, {
307
+ variant: "filled",
308
+ label: option?.value,
309
+ ...getTagProps({
310
+ index
311
+ }),
312
+ onDelete: event => {
313
+ handleDeleteChip(event, option);
314
+ },
315
+ deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {}),
316
+ sx: {
317
+ backgroundColor: option?.color,
318
+ color: '#0F172A',
319
+ "& .MuiChip-deleteIcon": {
320
+ flexShrink: 0,
321
+ "& path": {
322
+ stroke: '#0F172A !important'
382
323
  }
324
+ },
325
+ "&:hover": {
326
+ opacity: 0.8
383
327
  }
384
- }, index));
385
- }
328
+ }
329
+ }, index))
386
330
  }), /*#__PURE__*/_jsx(Divider, {
387
331
  sx: {
388
332
  mt: '12px',
@@ -507,4 +451,4 @@ const SelectV1 = props => {
507
451
  }) : null]
508
452
  });
509
453
  };
510
- export default SelectV1;
454
+ export default MultiSelectWithPopover;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { useDataView } from "../../Providers/DataViewProvider";
3
- import SelectV1 from "./Components/SelectV1";
3
+ import MultiSelectWithPopover from "./Components/MultiSelect";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  const MultiSelectType = props => {
6
6
  const {
@@ -24,30 +24,30 @@ const MultiSelectType = props => {
24
24
  const coloredValues = [...(value || [])]?.map(m => {
25
25
  return {
26
26
  ...m,
27
- color: (options || []).find(f => f?.value === m?.value || f?.id === m?.id)?.color || "#FFF"
27
+ color: options?.find(f => f.value === m.value)?.color || "#FFF"
28
28
  };
29
29
  });
30
30
  const handleChange = data => {
31
31
  onChange(rowIndex, {
32
- [property]: data?.filter(f => f?.id)
32
+ [property]: data?.filter(f => f?.value)
33
33
  });
34
34
  };
35
35
  const handleUpdate = data => {
36
36
  const updateData = {
37
- label: "Multi Select",
38
- visible: true,
39
- key: property,
40
- type: "multi-select",
41
- options: data
37
+ "label": "Multi Select",
38
+ "visible": true,
39
+ "key": property,
40
+ "type": "multi-select",
41
+ "options": data
42
42
  };
43
43
  onUpdateProperty(updateData);
44
44
  };
45
- return /*#__PURE__*/_jsx(SelectV1, {
45
+ return /*#__PURE__*/_jsx(MultiSelectWithPopover, {
46
46
  value: coloredValues,
47
47
  onChange: handleChange,
48
48
  onUpdate: handleUpdate,
49
49
  options: options,
50
- selectMultiple: true,
50
+ multiple: true,
51
51
  limitTags: 2,
52
52
  placeholder: label,
53
53
  disabled: readOnly,
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { useDataView } from "../../Providers/DataViewProvider";
3
- import SelectV1 from "./Components/SelectV1";
3
+ import Select from "./Components/Select";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  const SelectType = props => {
6
6
  const {
@@ -8,47 +8,28 @@ const SelectType = props => {
8
8
  property,
9
9
  value,
10
10
  options,
11
- readOnly,
12
- translation
11
+ readOnly
13
12
  } = props;
14
13
  const {
15
- onChange,
16
- onUpdateProperty
14
+ onChange
17
15
  } = useDataView();
18
- const label = "";
19
16
  const coloredValues = [...(value || [])]?.map(m => {
20
17
  return {
21
18
  ...m,
22
- color: (options || []).find(f => f?.value === m?.value || f?.id === m?.id)?.color || "#FFF"
19
+ color: options?.find(f => f.value === m.value)?.color
23
20
  };
24
21
  });
25
22
  const handleChange = data => {
26
23
  onChange(rowIndex, {
27
- [property]: data?.filter(f => f?.id)
24
+ [property]: data?.filter(f => f?.value)
28
25
  });
29
26
  };
30
- const handleUpdate = data => {
31
- const updateData = {
32
- "label": "Select",
33
- "visible": true,
34
- "key": property,
35
- "type": "select",
36
- "options": data
37
- };
38
- onUpdateProperty(updateData);
39
- };
40
- return /*#__PURE__*/_jsx(SelectV1, {
27
+ return /*#__PURE__*/_jsx(Select, {
41
28
  value: coloredValues,
42
- options: options,
43
- selectMultiple: false,
44
- disabled: readOnly,
45
- limitTags: 2,
46
- placeholder: label,
47
- property: property,
48
- wrapColumn: false,
49
29
  onChange: handleChange,
50
- onUpdate: handleUpdate,
51
- translation: translation
30
+ options: options,
31
+ multiple: false,
32
+ disabled: readOnly
52
33
  });
53
34
  };
54
35
  export default SelectType;
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useRef, useState } from "react";
1
+ import React, { useState } from "react";
2
2
  import { Box, List, ListItemButton, ListItemText, ListItemIcon, TextField, Chip } from "@mui/material";
3
3
  import { colors } from "../../../Color Picker/defaultColors";
4
4
  import Icon from "../../../../common/Icon";
@@ -20,14 +20,8 @@ const AddOptions = props => {
20
20
  const [value, setValue] = useState("");
21
21
  const [error, setError] = useState("");
22
22
  const {
23
- options = []
23
+ options
24
24
  } = edit;
25
- const inputRef = useRef();
26
- useEffect(() => {
27
- if (inputRef?.current) {
28
- inputRef.current.focus();
29
- }
30
- }, [addBox, options]);
31
25
  const onAddBox = () => {
32
26
  setAddBox(!addBox);
33
27
  };
@@ -46,8 +40,7 @@ const AddOptions = props => {
46
40
  ...edit,
47
41
  options: [{
48
42
  value: value,
49
- color: getRandomColor(),
50
- id: `multi_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 5)}`
43
+ color: getRandomColor()
51
44
  }, ...(options || [])]
52
45
  });
53
46
  setValue("");
@@ -67,6 +60,7 @@ const AddOptions = props => {
67
60
  };
68
61
  const onBlur = () => {
69
62
  setValue("");
63
+ setAddBox(false);
70
64
  setError("");
71
65
  };
72
66
  return edit?.type === "select" || edit?.type === "multi-select" ? /*#__PURE__*/_jsxs(Box, {
@@ -85,7 +79,6 @@ const AddOptions = props => {
85
79
  })
86
80
  }), addBox ? /*#__PURE__*/_jsx(Box, {
87
81
  children: /*#__PURE__*/_jsx(TextField, {
88
- inputRef: inputRef,
89
82
  className: "mt",
90
83
  size: "small",
91
84
  fullWidth: true,
@@ -94,7 +87,7 @@ const AddOptions = props => {
94
87
  onChange: handleChange,
95
88
  onBlur: onBlur,
96
89
  helperText: error
97
- }, `input_${options?.length}`)
90
+ })
98
91
  }) : null, /*#__PURE__*/_jsx(List, {
99
92
  children: options?.map((m, i) => {
100
93
  return /*#__PURE__*/_jsxs(ListItemButton, {
@@ -19,7 +19,6 @@ const EditOption = props => {
19
19
  const [edit, setEdit] = useState({
20
20
  ...(mode?.edit || {})
21
21
  });
22
- const [errorMessage, setErrorMessage] = useState("");
23
22
  const editData = useRef({
24
23
  ...edit
25
24
  });
@@ -32,13 +31,10 @@ const EditOption = props => {
32
31
  const selectedOption = edit?.options[optionIndex] || {};
33
32
  const pickerStyles = ColorPickerStyles(theme);
34
33
  const hideBackButton = edit?.hideBackButton || false;
35
- const errorMessageRef = useRef(errorMessage);
36
- useEffect(() => {
37
- errorMessageRef.current = errorMessage;
38
- }, [errorMessage]);
39
34
  useEffect(() => {
40
35
  return () => {
41
- if (editData?.current && !errorMessageRef.current) {
36
+ // on un-mount update the option change
37
+ if (editData?.current) {
42
38
  delete editData?.current?.edited;
43
39
  onEvent("updateProperty", {
44
40
  ...editData?.current
@@ -47,24 +43,18 @@ const EditOption = props => {
47
43
  };
48
44
  }, []);
49
45
  const onChange = e => {
50
- const {
51
- name,
52
- value,
53
- delete: isDelete
54
- } = e?.target || {};
55
- const targetValue = value?.toLowerCase();
56
- const updatedOptions = edit?.options?.map((m, i) => {
46
+ const updatedOptions = edit?.options.map((m, i) => {
57
47
  if (i === edit?.optionIndex) {
58
48
  return {
59
49
  ...m,
60
- [name]: value
50
+ [e.target.name]: e?.target?.value
61
51
  };
62
52
  }
63
53
  return m;
64
54
  });
65
55
 
66
- // If deleting the option
67
- if (edit?.optionIndex > -1 && isDelete) {
56
+ // for delete
57
+ if (edit?.optionIndex > -1 && e?.target?.delete) {
68
58
  updatedOptions.splice(edit?.optionIndex, 1);
69
59
  }
70
60
  const latest = {
@@ -78,28 +68,14 @@ const EditOption = props => {
78
68
  ...latest,
79
69
  edited: true
80
70
  };
81
- if (name === "value" && !value?.trim()) {
82
- setErrorMessage("Option name must not be empty");
83
- return;
84
- }
85
- const isDuplicate = name === "value" && targetValue && edit?.options?.some((op, i) => i !== edit?.optionIndex && op?.value?.toLowerCase?.() === targetValue);
86
- if (isDuplicate) {
87
- setErrorMessage("Option name must be unique");
88
- return;
89
- }
90
- setErrorMessage(""); // Clear error on valid input
91
71
 
92
- // If delete go back
93
- if (isDelete) {
94
- if (hideBackButton) {
95
- onClose();
96
- } else {
97
- onEvent("editProperty", {
98
- edit: {
99
- ...latest
100
- }
101
- });
102
- }
72
+ // if delete go back
73
+ if (e?.target?.delete) {
74
+ onEvent("editProperty", {
75
+ edit: {
76
+ ...latest
77
+ }
78
+ });
103
79
  }
104
80
  };
105
81
  const onBack = () => {
@@ -161,9 +137,7 @@ const EditOption = props => {
161
137
  value: selectedOption?.value,
162
138
  onChange: onChange,
163
139
  fullWidth: true,
164
- placeholder: translation("Option Name"),
165
- helperText: errorMessage,
166
- error: !!errorMessage
140
+ placeholder: translation("Option Name")
167
141
  }),
168
142
  labelPlacement: "top"
169
143
  })
@@ -61,7 +61,7 @@ const Divider = props => {
61
61
  className: "element-toolbar dividerIcon",
62
62
  style: {
63
63
  top: "3px",
64
- right: "8px"
64
+ left: 0
65
65
  },
66
66
  children: /*#__PURE__*/_jsx(Tooltip, {
67
67
  title: translation("Divider Settings"),
@@ -89,7 +89,7 @@ const VideoPlaceholder = props => {
89
89
  },
90
90
  children: [/*#__PURE__*/_jsx(Icon, {
91
91
  icon: "video"
92
- }), translation(TYPE_LABELS[type] || "Embed Video or Other")]
92
+ }), TYPE_LABELS[type] || translation("Embed Video or Other")]
93
93
  }) : /*#__PURE__*/_jsxs(Box, {
94
94
  sx: {
95
95
  color: "#64748B !important",
@@ -4,6 +4,7 @@ import { Node } from "slate";
4
4
  import { useSlateStatic, ReactEditor } from "slate-react";
5
5
  import { IconButton, Tooltip, Grid, Menu, MenuItem, CircularProgress, Box, Typography, useTheme } from "@mui/material";
6
6
  import DeleteIcon from "@mui/icons-material/Delete";
7
+ import BackupIcon from "@mui/icons-material/Backup";
7
8
  import { GridSettingsIcon, GridAddSectionIcon, WorkflowIcon } from "../../common/iconslist";
8
9
  import FormPopup from "./FormPopup";
9
10
  import ButtonPopup from "../Button/ButtonPopup";
@@ -159,8 +160,7 @@ const Form = props => {
159
160
  [pair[0]]: pair[1],
160
161
  placeholder: placeholder,
161
162
  form_name: formName,
162
- tagName: tagName,
163
- uid: fieldData?.uid
163
+ tagName: tagName
164
164
  });
165
165
  }
166
166
  let params = {
@@ -207,7 +207,7 @@ const Form = props => {
207
207
  }, {
208
208
  at: path
209
209
  });
210
- // adding form field style to the current form node
210
+ // adding form field style to the current form node
211
211
  const currentNode = Node.get(editor, path);
212
212
  if (currentNode) {
213
213
  currentNode.children.forEach((item, index) => {
@@ -35,6 +35,7 @@ const FormTextArea = props => {
35
35
  onChange: onChange,
36
36
  sx: {
37
37
  width: "100%",
38
+ borderWidth: "1px",
38
39
  borderBlockStyle: "solid",
39
40
  padding: {
40
41
  ...getTRBLBreakPoints(bannerSpacing)
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from "react";
2
- import { Transforms } from "slate";
2
+ import { Transforms, Node } 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,7 +9,6 @@ import { DeleteIcon } from "../../assets/svg/AIIcons";
9
9
  import { SettingsIcon } from "../../assets/svg/TableIcons";
10
10
  import { useEditorContext } from "../../hooks/useMouseMove";
11
11
  import useCommonStyle from "../../commonStyle";
12
- import { getNode } from "../../utils/helper";
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
14
  const FormField = props => {
@@ -36,7 +35,7 @@ const FormField = props => {
36
35
  const formPath = path.slice(0, path.length - 1);
37
36
  const {
38
37
  metadatamapping
39
- } = getNode(editor, formPath) || {};
38
+ } = Node?.get(editor, formPath) || {};
40
39
  const updatedElement = {
41
40
  ...element,
42
41
  metadatamapping