@flozy/editor 10.5.1 → 10.5.2

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 (194) hide show
  1. package/dist/Editor/ChatEditor.js +17 -16
  2. package/dist/Editor/CommonEditor.js +134 -18
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +46 -8
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
  6. package/dist/Editor/Elements/Accordion/Accordion.js +46 -9
  7. package/dist/Editor/Elements/Accordion/AccordionSummary.js +1 -23
  8. package/dist/Editor/Elements/AppHeader/AppHeader.js +10 -5
  9. package/dist/Editor/Elements/Button/EditorButton.js +26 -10
  10. package/dist/Editor/Elements/Carousel/CarouselItem.js +2 -1
  11. package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
  12. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  13. package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
  14. package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
  15. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +4 -2
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SelectV1.js +510 -0
  17. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +26 -11
  18. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +28 -9
  19. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +17 -6
  20. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +43 -16
  21. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +11 -0
  22. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +8 -4
  23. package/dist/Editor/Elements/Divider/Divider.js +1 -1
  24. package/dist/Editor/Elements/Embed/Image.js +3 -2
  25. package/dist/Editor/Elements/Embed/Video.js +1 -1
  26. package/dist/Editor/Elements/EmbedScript/Code.js +14 -2
  27. package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +57 -28
  28. package/dist/Editor/Elements/EmbedScript/styles.js +89 -0
  29. package/dist/Editor/Elements/Form/Form.js +184 -171
  30. package/dist/Editor/Elements/Form/FormElements/FormText.js +23 -6
  31. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +2 -2
  32. package/dist/Editor/Elements/Form/FormField.js +13 -6
  33. package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
  34. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +40 -32
  35. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +7 -4
  36. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -0
  37. package/dist/Editor/Elements/FreeGrid/Options/More.js +8 -8
  38. package/dist/Editor/Elements/FreeGrid/helper.js +115 -0
  39. package/dist/Editor/Elements/FreeGrid/styles.js +75 -7
  40. package/dist/Editor/Elements/Grid/Grid.js +14 -2
  41. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  42. package/dist/Editor/Elements/List/CheckList.js +3 -2
  43. package/dist/Editor/Elements/Search/SearchAttachment.js +40 -9
  44. package/dist/Editor/Elements/Search/SearchButton.js +9 -8
  45. package/dist/Editor/Elements/Search/SearchList.js +9 -7
  46. package/dist/Editor/Elements/Signature/Signature.css +2 -1
  47. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +18 -5
  48. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +16 -3
  49. package/dist/Editor/Elements/SimpleText/index.js +6 -1
  50. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  51. package/dist/Editor/Elements/Table/AddRowCol.js +8 -2
  52. package/dist/Editor/Elements/Table/DragButton.js +0 -1
  53. package/dist/Editor/Elements/Table/Draggable.js +6 -2
  54. package/dist/Editor/Elements/Table/Styles.js +7 -0
  55. package/dist/Editor/Elements/Table/Table.js +3 -3
  56. package/dist/Editor/Elements/Table/TableCell.js +31 -8
  57. package/dist/Editor/Elements/Title/title.js +6 -6
  58. package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
  59. package/dist/Editor/MiniEditor.js +2 -1
  60. package/dist/Editor/Styles/EditorStyles.js +5 -5
  61. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  62. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  63. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  64. package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
  65. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
  66. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +4 -2
  67. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  68. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
  69. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +7 -4
  70. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
  71. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +72 -12
  72. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +100 -27
  73. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
  74. package/dist/Editor/Toolbar/PopupTool/index.js +4 -4
  75. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  76. package/dist/Editor/assets/svg/BackIcon.js +18 -0
  77. package/dist/Editor/assets/svg/ClearAllRounded.js +31 -0
  78. package/dist/Editor/assets/svg/ResetIconNew.js +23 -0
  79. package/dist/Editor/assets/svg/SettingsIcon.js +1 -0
  80. package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
  81. package/dist/Editor/common/Checkbox/index.js +46 -0
  82. package/dist/Editor/common/Checkbox/styles.js +45 -0
  83. package/dist/Editor/common/ColorPickerButton.js +41 -16
  84. package/dist/Editor/common/CustomColorPicker/index.js +130 -0
  85. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  86. package/dist/Editor/common/CustomDialog2/index.js +94 -0
  87. package/dist/Editor/common/CustomDialog2/style.js +67 -0
  88. package/dist/Editor/common/CustomSelect.js +43 -0
  89. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  90. package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
  91. package/dist/Editor/common/Icon.js +31 -1
  92. package/dist/Editor/common/ImageSelector/ImageSelector.js +2 -2
  93. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  94. package/dist/Editor/common/LinkSettings/NavComponents.js +61 -55
  95. package/dist/Editor/common/LinkSettings/index.js +82 -80
  96. package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
  97. package/dist/Editor/common/LinkSettings/style.js +209 -74
  98. package/dist/Editor/common/MentionsPopup/index.js +4 -1
  99. package/dist/Editor/common/RadioGroup/index.js +48 -0
  100. package/dist/Editor/common/RadioGroup/styles.js +29 -0
  101. package/dist/Editor/common/RnD/ElementOptions/Actions.js +13 -15
  102. package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +1 -0
  103. package/dist/Editor/common/RnD/ElementOptions/index.js +2 -2
  104. package/dist/Editor/common/RnD/ElementOptions/styles.js +28 -1
  105. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +6 -5
  106. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +4 -3
  107. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  108. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  109. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  110. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  111. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  112. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  113. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  114. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +3 -1
  115. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  116. package/dist/Editor/common/RnD/ElementSettings/styles.js +146 -12
  117. package/dist/Editor/common/RnD/OptionsPopup/index.js +8 -5
  118. package/dist/Editor/common/RnD/OptionsPopup/style.js +120 -19
  119. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +8 -5
  120. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  121. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  122. package/dist/Editor/common/RnD/Utils/gridDropItem.js +28 -19
  123. package/dist/Editor/common/RnD/Utils/index.js +3 -1
  124. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +42 -58
  125. package/dist/Editor/common/RnD/VirtualElement/helper.js +323 -132
  126. package/dist/Editor/common/RnD/VirtualElement/styles.js +16 -0
  127. package/dist/Editor/common/RnD/index.js +67 -38
  128. package/dist/Editor/common/Select/index.js +44 -5
  129. package/dist/Editor/common/Select/styles.js +30 -2
  130. package/dist/Editor/common/Shorthands/elements.js +65 -11
  131. package/dist/Editor/common/SnackBar/index.js +43 -0
  132. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
  133. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +12 -9
  134. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  135. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
  136. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  137. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  138. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  139. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
  140. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
  141. package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +115 -0
  142. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
  143. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  144. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +7 -6
  145. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +13 -6
  146. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  147. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +5 -7
  148. package/dist/Editor/common/SwipeableDrawer/style.js +14 -12
  149. package/dist/Editor/common/Uploader.js +16 -0
  150. package/dist/Editor/common/iconListV2.js +177 -6
  151. package/dist/Editor/common/iconslist.js +24 -0
  152. package/dist/Editor/commonStyle.js +186 -62
  153. package/dist/Editor/helper/deserialize/index.js +6 -4
  154. package/dist/Editor/helper/index.js +5 -1
  155. package/dist/Editor/helper/textIndeces.js +58 -0
  156. package/dist/Editor/helper/theme.js +203 -2
  157. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  158. package/dist/Editor/hooks/useMouseMove.js +8 -5
  159. package/dist/Editor/hooks/useTable.js +5 -4
  160. package/dist/Editor/hooks/useThemeValues.js +63 -0
  161. package/dist/Editor/plugins/withEmbeds.js +1 -1
  162. package/dist/Editor/plugins/withHTML.js +5 -2
  163. package/dist/Editor/plugins/withTable.js +1 -1
  164. package/dist/Editor/theme/ThemeList.js +50 -173
  165. package/dist/Editor/theme/index.js +149 -0
  166. package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
  167. package/dist/Editor/themeSettings/buttons/index.js +300 -0
  168. package/dist/Editor/themeSettings/buttons/style.js +23 -0
  169. package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
  170. package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
  171. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  172. package/dist/Editor/themeSettings/fonts/index.js +240 -0
  173. package/dist/Editor/themeSettings/fonts/style.js +62 -0
  174. package/dist/Editor/themeSettings/icons.js +60 -0
  175. package/dist/Editor/themeSettings/index.js +380 -0
  176. package/dist/Editor/themeSettings/style.js +299 -0
  177. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  178. package/dist/Editor/themeSettingsAI/index.js +355 -0
  179. package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
  180. package/dist/Editor/themeSettingsAI/style.js +332 -0
  181. package/dist/Editor/utils/SlateUtilityFunctions.js +172 -46
  182. package/dist/Editor/utils/accordion.js +14 -4
  183. package/dist/Editor/utils/button.js +1 -17
  184. package/dist/Editor/utils/customHooks/useTableResize.js +49 -9
  185. package/dist/Editor/utils/draftToSlate.js +3 -2
  186. package/dist/Editor/utils/events.js +50 -6
  187. package/dist/Editor/utils/font.js +40 -37
  188. package/dist/Editor/utils/form.js +4 -4
  189. package/dist/Editor/utils/formfield.js +9 -2
  190. package/dist/Editor/utils/helper.js +215 -26
  191. package/dist/Editor/utils/insertAppHeader.js +1 -1
  192. package/dist/Editor/utils/signature.js +2 -9
  193. package/dist/Editor/utils/updateFormName.js +22 -0
  194. package/package.json +4 -4
@@ -0,0 +1,510 @@
1
+ import React, { useCallback, useEffect, useMemo, useState } from "react";
2
+ import Autocomplete from "@mui/material/Autocomplete";
3
+ import Box from "@mui/material/Box";
4
+ import Chip from "@mui/material/Chip";
5
+ import Divider from "@mui/material/Divider";
6
+ import Popover from "@mui/material/Popover";
7
+ import TextField from "@mui/material/TextField";
8
+ import Typography from "@mui/material/Typography";
9
+ import List from "@mui/material/List";
10
+ import ListItem from "@mui/material/ListItem";
11
+ import ListItemButton from "@mui/material/ListItemButton";
12
+ import IconButton from "@mui/material/IconButton";
13
+ import Tooltip from "@mui/material/Tooltip";
14
+ import { CloseIcon } from "../../../../../common/iconslist";
15
+ import { useEditorContext } from "../../../../../hooks/useMouseMove";
16
+ import SwipeableDrawer from "@mui/material/SwipeableDrawer";
17
+ import Icon from "../../../../../common/Icon";
18
+ import { colors } from "../../../../Color Picker/defaultColors";
19
+ import PropertySettings from "../../Options";
20
+ import SnackbarAlert from "../../../../../common/SnackBar";
21
+ import { jsx as _jsx } from "react/jsx-runtime";
22
+ import { jsxs as _jsxs } from "react/jsx-runtime";
23
+ const EXCLUDED_COLORS = new Set(["#000000", "#0F172A", "#2563EB", "#FFFFFF", "#64748B"]);
24
+ const DEFAULT_COLORS = colors?.filter(f => !f?.includes("linear") && !EXCLUDED_COLORS?.has(f));
25
+ const generateRandomColor = () => {
26
+ const randomIndex = Math.floor(Math.random() * DEFAULT_COLORS?.length);
27
+ return DEFAULT_COLORS[randomIndex];
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 => {
35
+ const {
36
+ value,
37
+ options = [],
38
+ selectMultiple,
39
+ property,
40
+ wrapColumn = false,
41
+ onChange,
42
+ onUpdate,
43
+ translation
44
+ } = props;
45
+ const [anchorEl, setAnchorEl] = useState(null);
46
+ const [anchorElOption, setAnchorElOption] = useState(null);
47
+ const [currentIndex, setCurrentIndex] = useState(null);
48
+ const [selectedOptions, setSelectedOptions] = useState([]);
49
+ const [availableOptions, setAvailableOptions] = useState([]);
50
+ const [showSnackBar, setShowSnackBar] = useState(false);
51
+ const [chipColor, setChipColor] = useState(generateRandomColor());
52
+ const [inputValue, setInputValue] = useState("");
53
+ const [availableOptionsMap, setAvailableOptionsMap] = useState({});
54
+ const [resolvedSelectedOptions, setResolvedSelectedOptions] = useState([]);
55
+ const {
56
+ theme
57
+ } = useEditorContext();
58
+ const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
59
+ 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
+ const mode = useMemo(() => ({
85
+ type: "editOptionMulti",
86
+ edit: {
87
+ label: selectMultiple ? "Multi Select" : "Select",
88
+ visible: true,
89
+ key: property,
90
+ type: selectMultiple ? "multi-select" : "select",
91
+ options: availableOptions || [],
92
+ optionIndex: currentIndex,
93
+ hideBackButton: true
94
+ }
95
+ }), [availableOptions, property, currentIndex, selectMultiple]);
96
+ const customScrollStyles = {
97
+ scrollbarWidth: "thin",
98
+ scrollbarColor: `${theme?.palette?.editor?.brainPopupScroll} transparent`,
99
+ "&::-webkit-scrollbar": {
100
+ width: "6px"
101
+ },
102
+ "&::-webkit-scrollbar-thumb": {
103
+ backgroundColor: theme?.palette?.editor?.brainPopupScroll,
104
+ borderRadius: "3px"
105
+ },
106
+ "&::-webkit-scrollbar-track": {
107
+ display: "none"
108
+ }
109
+ };
110
+ useEffect(() => {
111
+ if (inputValue?.trim() && !chipColor) {
112
+ setChipColor(generateRandomColor());
113
+ }
114
+ }, [inputValue, chipColor]);
115
+ useEffect(() => {
116
+ const enriched = hasIds(options) ? options : generateStableIds(options);
117
+ const isDifferent = JSON.stringify(enriched) !== JSON.stringify(availableOptions);
118
+ if (isDifferent) {
119
+ setAvailableOptions(enriched);
120
+ }
121
+ }, [options]);
122
+ const handleOpenPopover = useCallback(event => {
123
+ setAnchorEl(event.currentTarget);
124
+ }, []);
125
+ const handleClosePopover = useCallback(e => {
126
+ e?.stopPropagation();
127
+ setAnchorEl(null);
128
+ }, []);
129
+ const handleAddOption = newValue => {
130
+ const trimmedValue = newValue?.trim?.();
131
+ 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
+ const newOption = {
150
+ value: trimmedValue,
151
+ color: chipColor,
152
+ id: `multi_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 5)}`
153
+ };
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);
164
+ setInputValue("");
165
+ setChipColor("");
166
+ };
167
+ const onClose = () => {
168
+ setAnchorEl(anchorElOption);
169
+ setAnchorElOption(null);
170
+ };
171
+ const onEditOption = (type, data) => {
172
+ const updateData = data?.edit ? data?.edit?.options : data?.options;
173
+ onUpdate(updateData);
174
+ };
175
+ const handleEditOption = (e, index) => {
176
+ e.stopPropagation();
177
+ setCurrentIndex(index);
178
+ setAnchorElOption(anchorEl);
179
+ setAnchorEl(null);
180
+ };
181
+ const handleSelectOption = option => {
182
+ const isAlreadySelected = selectedOptions.some(opt => opt?.id === option?.id);
183
+ if (isAlreadySelected) {
184
+ 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
+ }
197
+ };
198
+ const handleClearSelection = () => {
199
+ setSelectedOptions([]);
200
+ };
201
+ const handleDeleteChip = (event, option) => {
202
+ event.stopPropagation();
203
+ const updatedOptions = selectedOptions?.filter(selected => selected?.id !== option?.id);
204
+ setSelectedOptions(updatedOptions);
205
+ onChange(selectMultiple ? updatedOptions : updatedOptions[0] || null);
206
+ };
207
+ const filteredOptions = availableOptions?.filter(option => option?.value?.toLowerCase()?.includes(inputValue?.toLowerCase()));
208
+ const isExactMatch = availableOptions?.some(opt => opt?.value?.toLowerCase() === inputValue?.toLowerCase());
209
+ const open = Boolean(anchorEl);
210
+ const openEditOption = Boolean(anchorElOption);
211
+ const id = open ? "autocomplete-popover" : undefined;
212
+ return /*#__PURE__*/_jsxs("div", {
213
+ children: [/*#__PURE__*/_jsx(Box, {
214
+ sx: {
215
+ display: "flex",
216
+ flexWrap: wrapColumn ? "wrap" : "nowrap",
217
+ overflowX: wrapColumn ? "hidden" : "auto",
218
+ gap: 0.5,
219
+ padding: "8px",
220
+ cursor: "pointer"
221
+ },
222
+ onClick: handleOpenPopover,
223
+ children: resolvedSelectedOptions?.map((option, index) => /*#__PURE__*/_jsx(Chip, {
224
+ label: option?.value,
225
+ onDelete: event => {
226
+ handleDeleteChip(event, option);
227
+ },
228
+ deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {}),
229
+ variant: "filled",
230
+ sx: {
231
+ backgroundColor: option?.color,
232
+ color: '#0F172A',
233
+ "& .MuiChip-deleteIcon": {
234
+ flexShrink: 0,
235
+ "& path": {
236
+ stroke: '#0F172A !important'
237
+ }
238
+ },
239
+ "&:hover": {
240
+ opacity: 0.8
241
+ }
242
+ }
243
+ }, index))
244
+ }), /*#__PURE__*/_jsx(PopoverComponent, {
245
+ id: id,
246
+ open: open,
247
+ anchorEl: anchorEl,
248
+ anchor: "bottom",
249
+ onClose: e => handleClosePopover(e),
250
+ anchorOrigin: {
251
+ vertical: "top",
252
+ horizontal: "left"
253
+ },
254
+ transformOrigin: {
255
+ vertical: "top",
256
+ horizontal: "left"
257
+ },
258
+ sx: {
259
+ "& .MuiPaper-root": {
260
+ borderRadius: "20px",
261
+ background: theme?.palette?.editor?.textFormatBgColor,
262
+ border: `1px solid ${theme?.palette?.editor?.popUpBorderColor}`,
263
+ boxShadow: "0px 4px 10px 0px #00000029"
264
+ }
265
+ },
266
+ disableAutoFocus: true,
267
+ disableEnforceFocus: true,
268
+ disableRestoreFocus: true,
269
+ children: /*#__PURE__*/_jsxs(Box, {
270
+ sx: {
271
+ width: isMobile ? "100%" : 300
272
+ },
273
+ children: [/*#__PURE__*/_jsx(Autocomplete, {
274
+ multiple: true,
275
+ freeSolo: true,
276
+ disablePortal: true,
277
+ PopperComponent: () => null,
278
+ sx: {
279
+ "& .MuiFormControl-root": {
280
+ maxHeight: "250px",
281
+ overflowY: "auto",
282
+ overflowX: "hidden",
283
+ pr: '12px',
284
+ pl: '12px',
285
+ marginTop: '12px',
286
+ ...customScrollStyles
287
+ }
288
+ },
289
+ disableClearable: true,
290
+ options: [],
291
+ getOptionLabel: () => "",
292
+ value: resolvedSelectedOptions,
293
+ onChange: (event, newValues) => {
294
+ const stringOptions = newValues.filter(val => typeof val === "string" && val.trim());
295
+ for (const str of stringOptions) {
296
+ handleAddOption(str);
297
+ }
298
+ },
299
+ inputValue: inputValue,
300
+ onInputChange: (event, newInputValue) => setInputValue(newInputValue),
301
+ onKeyDown: event => {
302
+ if (event.key === "Enter" && inputValue.trim()) {
303
+ event.preventDefault();
304
+ handleAddOption(inputValue);
305
+ }
306
+ },
307
+ filterOptions: (options, params) => options?.filter(option => option?.value?.toLowerCase()?.includes(params?.inputValue?.toLowerCase())),
308
+ renderInput: params => /*#__PURE__*/_jsx(TextField, {
309
+ ...params,
310
+ variant: "standard",
311
+ InputProps: {
312
+ ...params.InputProps,
313
+ disableUnderline: true,
314
+ sx: {
315
+ display: "flex",
316
+ flexWrap: "wrap",
317
+ fontFamily: "Inter",
318
+ fontWeight: 400,
319
+ fontSize: "12px",
320
+ color: theme?.palette?.editor?.secondaryTextColor,
321
+ "&::placeholder": {
322
+ color: theme?.palette?.editor?.secondaryTextColor
323
+ },
324
+ "& .MuiAutocomplete-input": {
325
+ minWidth: "100px !important"
326
+ }
327
+ },
328
+ endAdornment: /*#__PURE__*/_jsx(Tooltip, {
329
+ arrow: true,
330
+ title: "Clear Selected",
331
+ children: /*#__PURE__*/_jsx(IconButton, {
332
+ onClick: handleClearSelection,
333
+ sx: {
334
+ padding: 0,
335
+ minWidth: "unset",
336
+ "& .MuiSvgIcon-root": {
337
+ fontSize: 20
338
+ },
339
+ '& rect': {
340
+ fill: theme?.palette?.editor?.closeButtonSvgStroke
341
+ },
342
+ '&:hover': {
343
+ backgroundColor: 'transparent'
344
+ }
345
+ },
346
+ children: /*#__PURE__*/_jsx(Icon, {
347
+ icon: "resetIconNew"
348
+ })
349
+ })
350
+ })
351
+ },
352
+ sx: {
353
+ backgroundColor: "transparent",
354
+ fontFamily: 'Inter',
355
+ fontWeight: 400,
356
+ fontSize: '12px'
357
+ },
358
+ placeholder: "Create new one..."
359
+ }),
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
382
+ }
383
+ }
384
+ }, index));
385
+ }
386
+ }), /*#__PURE__*/_jsx(Divider, {
387
+ sx: {
388
+ mt: '12px',
389
+ borderBottom: `1px solid ${theme?.palette?.editor?.popUpBorderColor}`,
390
+ boxShadow: theme?.palette?.editor?.dividerDropShadow
391
+ }
392
+ }), /*#__PURE__*/_jsx(Box, {
393
+ sx: {
394
+ pl: '4px'
395
+ },
396
+ children: /*#__PURE__*/_jsxs(List, {
397
+ sx: {
398
+ maxHeight: "250px",
399
+ overflowY: "auto",
400
+ ...customScrollStyles
401
+ },
402
+ children: [/*#__PURE__*/_jsx(Typography, {
403
+ sx: {
404
+ mb: 1,
405
+ pl: '8px',
406
+ color: theme?.palette?.editor?.secondaryTextColor,
407
+ fontFamily: 'Inter',
408
+ fontWeight: 400,
409
+ fontSize: '12px'
410
+ },
411
+ children: "Choose an option or create one"
412
+ }), filteredOptions?.map((option, index) => /*#__PURE__*/_jsx(ListItem, {
413
+ sx: {
414
+ padding: 0
415
+ },
416
+ disablePadding: true,
417
+ children: /*#__PURE__*/_jsxs(ListItemButton, {
418
+ onClick: () => handleSelectOption(option),
419
+ sx: {
420
+ paddingTop: "4px",
421
+ paddingBottom: "4px",
422
+ justifyContent: 'space-between',
423
+ '&:hover': {
424
+ '& path': {
425
+ stroke: theme?.palette?.editor?.activeColor
426
+ },
427
+ borderRadius: '12px'
428
+ }
429
+ },
430
+ children: [/*#__PURE__*/_jsx(Chip, {
431
+ label: option?.value,
432
+ sx: {
433
+ backgroundColor: option?.color,
434
+ color: '#0F172A',
435
+ fontWeight: 500,
436
+ fontSize: "12px",
437
+ fontFamily: "Inter",
438
+ padding: "4px 12px",
439
+ borderRadius: "16px",
440
+ maxWidth: "180px",
441
+ whiteSpace: "nowrap",
442
+ overflow: "hidden",
443
+ textOverflow: "ellipsis"
444
+ }
445
+ }), /*#__PURE__*/_jsx(IconButton, {
446
+ size: "small",
447
+ sx: {
448
+ '& path': {
449
+ stroke: theme?.palette?.editor?.closeButtonSvgStroke
450
+ },
451
+ '&:hover': {
452
+ backgroundColor: 'transparent'
453
+ }
454
+ },
455
+ onClick: e => handleEditOption(e, index),
456
+ children: /*#__PURE__*/_jsx(Icon, {
457
+ icon: "rightArrow"
458
+ })
459
+ })]
460
+ })
461
+ }, index)), inputValue?.trim() && !isExactMatch && /*#__PURE__*/_jsx(ListItem, {
462
+ disablePadding: true,
463
+ children: /*#__PURE__*/_jsxs(ListItemButton, {
464
+ onClick: () => handleAddOption(inputValue),
465
+ sx: {
466
+ display: "flex",
467
+ alignItems: "center"
468
+ },
469
+ children: [/*#__PURE__*/_jsx(Typography, {
470
+ sx: {
471
+ color: theme?.palette?.editor?.secondaryTextColor,
472
+ marginRight: "6px",
473
+ fontSize: "14px",
474
+ fontFamily: "Inter"
475
+ },
476
+ children: "Create"
477
+ }), /*#__PURE__*/_jsx(Chip, {
478
+ label: `${inputValue}`,
479
+ sx: {
480
+ backgroundColor: chipColor,
481
+ color: '#0F172A',
482
+ fontWeight: 500,
483
+ fontSize: "12px",
484
+ fontFamily: "Inter",
485
+ borderRadius: "16px",
486
+ maxWidth: "180px",
487
+ whiteSpace: "nowrap",
488
+ overflow: "hidden",
489
+ textOverflow: "ellipsis"
490
+ }
491
+ })]
492
+ })
493
+ })]
494
+ })
495
+ })]
496
+ })
497
+ }), openEditOption ? /*#__PURE__*/_jsx(PropertySettings, {
498
+ open: openEditOption,
499
+ anchorEl: anchorElOption,
500
+ mode: mode,
501
+ onClose: onClose,
502
+ onEvent: onEditOption,
503
+ translation: translation
504
+ }) : null, showSnackBar ? /*#__PURE__*/_jsx(SnackbarAlert, {
505
+ message: "Option already selected!",
506
+ setShowSnackBar: setShowSnackBar
507
+ }) : null]
508
+ });
509
+ };
510
+ export default SelectV1;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { useDataView } from "../../Providers/DataViewProvider";
3
- import Select from "./Components/Select";
3
+ import SelectV1 from "./Components/SelectV1";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  const MultiSelectType = props => {
6
6
  const {
@@ -10,35 +10,50 @@ const MultiSelectType = props => {
10
10
  options,
11
11
  label = "",
12
12
  readOnly,
13
- settings
13
+ settings,
14
+ translation
14
15
  } = props;
16
+ const {
17
+ onChange,
18
+ onUpdateProperty
19
+ } = useDataView();
15
20
  const {
16
21
  wrapColumn
17
22
  } = settings;
18
- const {
19
- onChange
20
- } = useDataView();
21
23
  const value = Array.isArray(pValue) ? pValue : [];
22
24
  const coloredValues = [...(value || [])]?.map(m => {
23
25
  return {
24
26
  ...m,
25
- color: options?.find(f => f.value === m.value)?.color || "#FFF"
27
+ color: (options || []).find(f => f?.value === m?.value || f?.id === m?.id)?.color || "#FFF"
26
28
  };
27
29
  });
28
30
  const handleChange = data => {
29
31
  onChange(rowIndex, {
30
- [property]: data?.filter(f => f?.value)
32
+ [property]: data?.filter(f => f?.id)
31
33
  });
32
34
  };
33
- return /*#__PURE__*/_jsx(Select, {
34
- className: `wrap-${wrapColumn}`,
35
+ const handleUpdate = data => {
36
+ const updateData = {
37
+ label: "Multi Select",
38
+ visible: true,
39
+ key: property,
40
+ type: "multi-select",
41
+ options: data
42
+ };
43
+ onUpdateProperty(updateData);
44
+ };
45
+ return /*#__PURE__*/_jsx(SelectV1, {
35
46
  value: coloredValues,
36
47
  onChange: handleChange,
48
+ onUpdate: handleUpdate,
37
49
  options: options,
38
- multiple: true,
50
+ selectMultiple: true,
39
51
  limitTags: 2,
40
52
  placeholder: label,
41
- disabled: readOnly
53
+ disabled: readOnly,
54
+ property: property,
55
+ wrapColumn: wrapColumn,
56
+ translation: translation
42
57
  });
43
58
  };
44
59
  export default MultiSelectType;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { useDataView } from "../../Providers/DataViewProvider";
3
- import Select from "./Components/Select";
3
+ import SelectV1 from "./Components/SelectV1";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  const SelectType = props => {
6
6
  const {
@@ -8,28 +8,47 @@ const SelectType = props => {
8
8
  property,
9
9
  value,
10
10
  options,
11
- readOnly
11
+ readOnly,
12
+ translation
12
13
  } = props;
13
14
  const {
14
- onChange
15
+ onChange,
16
+ onUpdateProperty
15
17
  } = useDataView();
18
+ const label = "";
16
19
  const coloredValues = [...(value || [])]?.map(m => {
17
20
  return {
18
21
  ...m,
19
- color: options?.find(f => f.value === m.value)?.color
22
+ color: (options || []).find(f => f?.value === m?.value || f?.id === m?.id)?.color || "#FFF"
20
23
  };
21
24
  });
22
25
  const handleChange = data => {
23
26
  onChange(rowIndex, {
24
- [property]: data?.filter(f => f?.value)
27
+ [property]: data?.filter(f => f?.id)
25
28
  });
26
29
  };
27
- return /*#__PURE__*/_jsx(Select, {
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, {
28
41
  value: coloredValues,
29
- onChange: handleChange,
30
42
  options: options,
31
- multiple: false,
32
- disabled: readOnly
43
+ selectMultiple: false,
44
+ disabled: readOnly,
45
+ limitTags: 2,
46
+ placeholder: label,
47
+ property: property,
48
+ wrapColumn: false,
49
+ onChange: handleChange,
50
+ onUpdate: handleUpdate,
51
+ translation: translation
33
52
  });
34
53
  };
35
54
  export default SelectType;