@flozy/editor 10.5.0 → 10.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/ChatEditor.js +16 -17
- package/dist/Editor/CommonEditor.js +18 -134
- package/dist/Editor/DialogWrapper.js +25 -31
- package/dist/Editor/Editor.css +8 -46
- package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -11
- package/dist/Editor/Elements/Accordion/Accordion.js +9 -46
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +23 -1
- package/dist/Editor/Elements/AppHeader/AppHeader.js +5 -10
- package/dist/Editor/Elements/Button/EditorButton.js +10 -26
- package/dist/Editor/Elements/Carousel/CarouselItem.js +1 -2
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -61
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +7 -10
- package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +2 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +11 -26
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +9 -28
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +6 -17
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +16 -43
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +0 -11
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +4 -8
- package/dist/Editor/Elements/Embed/Image.js +2 -3
- package/dist/Editor/Elements/Embed/Video.js +1 -1
- package/dist/Editor/Elements/EmbedScript/Code.js +2 -14
- package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +28 -57
- package/dist/Editor/Elements/Form/Form.js +171 -184
- package/dist/Editor/Elements/Form/FormElements/FormText.js +6 -23
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +2 -2
- package/dist/Editor/Elements/Form/FormField.js +6 -13
- package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +32 -40
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -7
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +0 -1
- package/dist/Editor/Elements/FreeGrid/Options/More.js +8 -8
- package/dist/Editor/Elements/FreeGrid/styles.js +7 -75
- package/dist/Editor/Elements/Grid/Grid.js +2 -14
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/List/CheckList.js +2 -3
- package/dist/Editor/Elements/Search/SearchAttachment.js +9 -40
- package/dist/Editor/Elements/Search/SearchButton.js +8 -9
- package/dist/Editor/Elements/Search/SearchList.js +7 -9
- package/dist/Editor/Elements/Signature/Signature.css +1 -2
- package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +5 -18
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +3 -16
- package/dist/Editor/Elements/SimpleText/index.js +1 -6
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Table/AddRowCol.js +2 -8
- package/dist/Editor/Elements/Table/DragButton.js +1 -0
- package/dist/Editor/Elements/Table/Draggable.js +2 -6
- package/dist/Editor/Elements/Table/Styles.js +0 -7
- package/dist/Editor/Elements/Table/Table.js +3 -3
- package/dist/Editor/Elements/Table/TableCell.js +8 -31
- package/dist/Editor/Elements/Title/title.js +6 -6
- package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
- package/dist/Editor/MiniEditor.js +1 -2
- package/dist/Editor/Styles/EditorStyles.js +5 -5
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -10
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +2 -4
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -7
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +12 -72
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +27 -100
- package/dist/Editor/Toolbar/PopupTool/index.js +1 -1
- package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
- package/dist/Editor/assets/svg/SettingsIcon.js +0 -1
- package/dist/Editor/common/ColorPickerButton.js +16 -41
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
- package/dist/Editor/common/Icon.js +1 -31
- package/dist/Editor/common/ImageSelector/ImageSelector.js +2 -2
- package/dist/Editor/common/ImageSelector/Styles.js +9 -3
- package/dist/Editor/common/LinkSettings/NavComponents.js +55 -61
- package/dist/Editor/common/LinkSettings/index.js +80 -82
- package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
- package/dist/Editor/common/LinkSettings/style.js +74 -209
- package/dist/Editor/common/MentionsPopup/index.js +1 -4
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +15 -13
- package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +0 -1
- package/dist/Editor/common/RnD/ElementOptions/index.js +2 -2
- package/dist/Editor/common/RnD/ElementOptions/styles.js +1 -28
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +5 -6
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +3 -4
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -4
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +1 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/styles.js +12 -146
- package/dist/Editor/common/RnD/OptionsPopup/index.js +5 -8
- package/dist/Editor/common/RnD/OptionsPopup/style.js +19 -120
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +5 -8
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +19 -28
- package/dist/Editor/common/RnD/Utils/index.js +1 -3
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +58 -42
- package/dist/Editor/common/RnD/VirtualElement/helper.js +132 -323
- package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -16
- package/dist/Editor/common/RnD/index.js +38 -67
- package/dist/Editor/common/Select/index.js +5 -44
- package/dist/Editor/common/Select/styles.js +2 -30
- package/dist/Editor/common/Shorthands/elements.js +11 -65
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +9 -12
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +0 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +8 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +10 -36
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +7 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +6 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +6 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +7 -5
- package/dist/Editor/common/SwipeableDrawer/style.js +12 -14
- package/dist/Editor/common/Uploader.js +0 -16
- package/dist/Editor/common/iconListV2.js +6 -177
- package/dist/Editor/common/iconslist.js +0 -24
- package/dist/Editor/commonStyle.js +62 -186
- package/dist/Editor/helper/index.js +1 -5
- package/dist/Editor/helper/theme.js +2 -203
- package/dist/Editor/hooks/useMouseMove.js +5 -8
- package/dist/Editor/hooks/useTable.js +4 -5
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +1 -3
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/SlateUtilityFunctions.js +46 -172
- package/dist/Editor/utils/accordion.js +4 -14
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/customHooks/useTableResize.js +9 -49
- package/dist/Editor/utils/draftToSlate.js +2 -3
- package/dist/Editor/utils/events.js +6 -50
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/form.js +4 -4
- package/dist/Editor/utils/formfield.js +2 -9
- package/dist/Editor/utils/helper.js +26 -215
- package/dist/Editor/utils/insertAppHeader.js +1 -1
- package/dist/Editor/utils/signature.js +9 -2
- package/package.json +4 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SelectV1.js +0 -510
- package/dist/Editor/Elements/EmbedScript/styles.js +0 -89
- package/dist/Editor/Elements/FreeGrid/helper.js +0 -115
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -439
- package/dist/Editor/assets/svg/BackIcon.js +0 -18
- package/dist/Editor/assets/svg/ClearAllRounded.js +0 -31
- package/dist/Editor/assets/svg/ResetIconNew.js +0 -23
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -293
- package/dist/Editor/common/Checkbox/index.js +0 -46
- package/dist/Editor/common/Checkbox/styles.js +0 -45
- package/dist/Editor/common/CustomColorPicker/index.js +0 -130
- package/dist/Editor/common/CustomColorPicker/style.js +0 -53
- package/dist/Editor/common/CustomDialog2/index.js +0 -94
- package/dist/Editor/common/CustomDialog2/style.js +0 -67
- package/dist/Editor/common/CustomSelect.js +0 -43
- package/dist/Editor/common/RadioGroup/index.js +0 -48
- package/dist/Editor/common/RadioGroup/styles.js +0 -29
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
- package/dist/Editor/common/SnackBar/index.js +0 -43
- package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +0 -115
- package/dist/Editor/helper/textIndeces.js +0 -58
- package/dist/Editor/hooks/useEditorTheme.js +0 -153
- package/dist/Editor/hooks/useThemeValues.js +0 -63
- package/dist/Editor/theme/index.js +0 -149
- package/dist/Editor/themeSettings/ActiveTheme.js +0 -82
- package/dist/Editor/themeSettings/buttons/index.js +0 -300
- package/dist/Editor/themeSettings/buttons/style.js +0 -23
- package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
- package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
- package/dist/Editor/themeSettings/fonts/index.js +0 -240
- package/dist/Editor/themeSettings/fonts/style.js +0 -62
- package/dist/Editor/themeSettings/icons.js +0 -60
- package/dist/Editor/themeSettings/index.js +0 -380
- package/dist/Editor/themeSettings/style.js +0 -299
- package/dist/Editor/themeSettingsAI/icons.js +0 -96
- package/dist/Editor/themeSettingsAI/index.js +0 -355
- package/dist/Editor/themeSettingsAI/saveTheme.js +0 -202
- package/dist/Editor/themeSettingsAI/style.js +0 -332
- package/dist/Editor/utils/updateFormName.js +0 -22
@@ -1,510 +0,0 @@
|
|
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,89 +0,0 @@
|
|
1
|
-
const Styles = theme => ({
|
2
|
-
root: {
|
3
|
-
"& .MuiPaper-root": {
|
4
|
-
borderRadius: "12px",
|
5
|
-
backgroundColor: theme?.palette?.editor?.miniToolBarBackground,
|
6
|
-
border: `1px solid ${theme?.palette?.editor?.miniToolBarBorder}`,
|
7
|
-
overflow: "hidden"
|
8
|
-
},
|
9
|
-
"& textarea": {
|
10
|
-
backgroundColor: theme?.palette?.editor?.inputFieldBgColor,
|
11
|
-
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`,
|
12
|
-
borderRadius: "12px",
|
13
|
-
padding: "10px !important",
|
14
|
-
color: theme?.palette?.editor?.textColor,
|
15
|
-
boxShadow: "0px 4px 18px 0px #00000014",
|
16
|
-
"&:focus": {
|
17
|
-
border: `1px solid #2563EB`,
|
18
|
-
boxShadow: "0px 4px 18px 0px #2563EB1F",
|
19
|
-
outline: "none"
|
20
|
-
},
|
21
|
-
"&:focus-visible": {
|
22
|
-
border: `1px solid #2563EB`,
|
23
|
-
boxShadow: "0px 4px 18px 0px #2563EB1F",
|
24
|
-
outline: "none"
|
25
|
-
}
|
26
|
-
},
|
27
|
-
"& .MuiDialogTitle-root": {
|
28
|
-
padding: "20px 24px 16px 24px"
|
29
|
-
},
|
30
|
-
"& .title": {
|
31
|
-
color: theme?.palette?.editor?.textColor,
|
32
|
-
fontWeight: 600,
|
33
|
-
fontSize: "20px",
|
34
|
-
fontFamily: "Inter, sans-serif"
|
35
|
-
},
|
36
|
-
"& .close-popupbtn": {
|
37
|
-
background: theme?.palette?.editor?.closeButtonBgColor,
|
38
|
-
color: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`,
|
39
|
-
"& svg": {
|
40
|
-
color: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
|
41
|
-
}
|
42
|
-
},
|
43
|
-
"& .divider": {
|
44
|
-
margin: "0px 24px",
|
45
|
-
background: theme?.palette?.editor?.deviderBgColor
|
46
|
-
},
|
47
|
-
"& .save-btn": {
|
48
|
-
backgroundColor: "#2563EB",
|
49
|
-
color: "#ffffff",
|
50
|
-
fontWeight: 600,
|
51
|
-
fontSize: "14px",
|
52
|
-
opacity: 1,
|
53
|
-
borderRadius: "8px",
|
54
|
-
textTransform: "math-auto",
|
55
|
-
height: "36px",
|
56
|
-
padding: "0px 12px",
|
57
|
-
minWidth: "90px",
|
58
|
-
"&:hover": {
|
59
|
-
backgroundColor: "#2563EB"
|
60
|
-
},
|
61
|
-
"@media only screen and (max-width: 899px)": {
|
62
|
-
width: "50%"
|
63
|
-
}
|
64
|
-
},
|
65
|
-
"& .clear-btn": {
|
66
|
-
padding: "8px 12px",
|
67
|
-
color: theme?.palette?.editor?.customDialogueCloseBtnColor,
|
68
|
-
fontWeight: 600,
|
69
|
-
fontSize: "14px",
|
70
|
-
opacity: 1,
|
71
|
-
borderRadius: "8px",
|
72
|
-
textTransform: "math-auto",
|
73
|
-
height: "36px",
|
74
|
-
minWidth: "90px",
|
75
|
-
backgroundColor: theme?.palette?.editor?.closeButtonBackground,
|
76
|
-
border: `1px solid ${theme?.palette?.editor?.customDialogueCloseBtnBorder}`,
|
77
|
-
"&:hover": {
|
78
|
-
backgroundColor: theme?.palette?.editor?.closeButtonBackground
|
79
|
-
},
|
80
|
-
"@media only screen and (max-width: 899px)": {
|
81
|
-
width: "50%"
|
82
|
-
}
|
83
|
-
},
|
84
|
-
"& .MuiDialogActions-root": {
|
85
|
-
padding: "0px 22px 16px 0px"
|
86
|
-
}
|
87
|
-
}
|
88
|
-
});
|
89
|
-
export default Styles;
|