@flozy/editor 10.6.5 → 10.6.7

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 (69) hide show
  1. package/dist/Editor/CommonEditor.js +17 -1
  2. package/dist/Editor/Editor.css +26 -0
  3. package/dist/Editor/Elements/Accordion/Accordion.js +46 -9
  4. package/dist/Editor/Elements/Accordion/AccordionSummary.js +2 -25
  5. package/dist/Editor/Elements/AppHeader/AppHeader.js +7 -2
  6. package/dist/Editor/Elements/Button/EditorButton.js +2 -2
  7. package/dist/Editor/Elements/Carousel/CarouselItem.js +2 -1
  8. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SelectV1.js +510 -0
  9. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +10 -10
  10. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +28 -9
  11. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +12 -5
  12. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +44 -18
  13. package/dist/Editor/Elements/Divider/Divider.js +1 -1
  14. package/dist/Editor/Elements/Embed/Embed.css +4 -0
  15. package/dist/Editor/Elements/Form/Form.js +3 -3
  16. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +0 -1
  17. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +4 -1
  18. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -0
  19. package/dist/Editor/Elements/Grid/Grid.js +14 -2
  20. package/dist/Editor/Elements/Signature/Signature.css +2 -1
  21. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +18 -5
  22. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +16 -3
  23. package/dist/Editor/Elements/Table/AddRowCol.js +8 -2
  24. package/dist/Editor/Elements/Table/DragButton.js +0 -1
  25. package/dist/Editor/Elements/Table/Draggable.js +6 -2
  26. package/dist/Editor/Elements/Table/Styles.js +7 -0
  27. package/dist/Editor/Elements/Table/TableCell.js +24 -5
  28. package/dist/Editor/Elements/Title/title.js +2 -5
  29. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +4 -4
  30. package/dist/Editor/Toolbar/PopupTool/index.js +7 -3
  31. package/dist/Editor/common/Checkbox/index.js +46 -0
  32. package/dist/Editor/common/Checkbox/styles.js +45 -0
  33. package/dist/Editor/common/ColorPickerButton.js +3 -0
  34. package/dist/Editor/common/LinkSettings/NavComponents.js +45 -65
  35. package/dist/Editor/common/LinkSettings/index.js +17 -28
  36. package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
  37. package/dist/Editor/common/LinkSettings/style.js +164 -244
  38. package/dist/Editor/common/RadioGroup/index.js +48 -0
  39. package/dist/Editor/common/RadioGroup/styles.js +29 -0
  40. package/dist/Editor/common/RnD/ElementOptions/Actions.js +4 -5
  41. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +4 -3
  42. package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -1
  43. package/dist/Editor/common/RnD/OptionsPopup/style.js +0 -1
  44. package/dist/Editor/common/RnD/Utils/gridDropItem.js +0 -1
  45. package/dist/Editor/common/RnD/Utils/index.js +55 -24
  46. package/dist/Editor/common/RnD/VirtualElement/helper.js +3 -2
  47. package/dist/Editor/common/RnD/index.js +30 -27
  48. package/dist/Editor/common/Select/index.js +44 -7
  49. package/dist/Editor/common/Select/styles.js +30 -2
  50. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
  51. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +12 -9
  52. package/dist/Editor/common/SwipeableDrawer/style.js +14 -12
  53. package/dist/Editor/common/iconListV2.js +76 -0
  54. package/dist/Editor/commonStyle.js +12 -0
  55. package/dist/Editor/helper/deserialize/index.js +6 -4
  56. package/dist/Editor/helper/index.js +4 -0
  57. package/dist/Editor/hooks/useTable.js +5 -4
  58. package/dist/Editor/plugins/withCustomDeleteBackward.js +6 -1
  59. package/dist/Editor/plugins/withHTML.js +11 -4
  60. package/dist/Editor/utils/SlateUtilityFunctions.js +21 -32
  61. package/dist/Editor/utils/accordion.js +129 -39
  62. package/dist/Editor/utils/customHooks/useTableResize.js +49 -9
  63. package/dist/Editor/utils/events.js +17 -5
  64. package/dist/Editor/utils/formfield.js +1 -0
  65. package/dist/Editor/utils/helper.js +53 -9
  66. package/dist/Editor/utils/insertAppHeader.js +1 -1
  67. package/dist/Editor/utils/signature.js +2 -9
  68. package/dist/Editor/utils/updateFormName.js +22 -0
  69. package/package.json +1 -1
@@ -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 MultiSelectWithPopover from "./Components/MultiSelect";
3
+ import SelectV1 from "./Components/SelectV1";
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)?.color || "#FFF"
27
+ color: (options || []).find(f => f?.value === m?.value || f?.id === m?.id)?.color || "#FFF"
28
28
  };
29
29
  });
30
30
  const handleChange = data => {
31
31
  onChange(rowIndex, {
32
- [property]: data?.filter(f => f?.value)
32
+ [property]: data?.filter(f => f?.id)
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(MultiSelectWithPopover, {
45
+ return /*#__PURE__*/_jsx(SelectV1, {
46
46
  value: coloredValues,
47
47
  onChange: handleChange,
48
48
  onUpdate: handleUpdate,
49
49
  options: options,
50
- multiple: true,
50
+ selectMultiple: 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 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;
@@ -1,4 +1,4 @@
1
- import React, { useState } from "react";
1
+ import React, { useEffect, useRef, 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,8 +20,14 @@ 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]);
25
31
  const onAddBox = () => {
26
32
  setAddBox(!addBox);
27
33
  };
@@ -40,7 +46,8 @@ const AddOptions = props => {
40
46
  ...edit,
41
47
  options: [{
42
48
  value: value,
43
- color: getRandomColor()
49
+ color: getRandomColor(),
50
+ id: `multi_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 5)}`
44
51
  }, ...(options || [])]
45
52
  });
46
53
  setValue("");
@@ -60,7 +67,6 @@ const AddOptions = props => {
60
67
  };
61
68
  const onBlur = () => {
62
69
  setValue("");
63
- setAddBox(false);
64
70
  setError("");
65
71
  };
66
72
  return edit?.type === "select" || edit?.type === "multi-select" ? /*#__PURE__*/_jsxs(Box, {
@@ -79,6 +85,7 @@ const AddOptions = props => {
79
85
  })
80
86
  }), addBox ? /*#__PURE__*/_jsx(Box, {
81
87
  children: /*#__PURE__*/_jsx(TextField, {
88
+ inputRef: inputRef,
82
89
  className: "mt",
83
90
  size: "small",
84
91
  fullWidth: true,
@@ -87,7 +94,7 @@ const AddOptions = props => {
87
94
  onChange: handleChange,
88
95
  onBlur: onBlur,
89
96
  helperText: error
90
- })
97
+ }, `input_${options?.length}`)
91
98
  }) : null, /*#__PURE__*/_jsx(List, {
92
99
  children: options?.map((m, i) => {
93
100
  return /*#__PURE__*/_jsxs(ListItemButton, {