@flozy/editor 9.8.3 → 9.8.4

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 (257) hide show
  1. package/dist/Editor/ChatEditor.js +26 -19
  2. package/dist/Editor/CommonEditor.js +141 -26
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +11 -7
  5. package/dist/Editor/Elements/AI/AIInput.js +5 -3
  6. package/dist/Editor/Elements/AI/CustomSelect.js +9 -5
  7. package/dist/Editor/Elements/AI/PopoverAIInput.js +15 -5
  8. package/dist/Editor/Elements/Accordion/Accordion.js +4 -3
  9. package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +4 -1
  10. package/dist/Editor/Elements/Accordion/AccordionButton.js +6 -2
  11. package/dist/Editor/Elements/Accordion/AccordionTitlePopup.js +4 -1
  12. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  13. package/dist/Editor/Elements/AppHeader/AppHeaderButton.js +6 -2
  14. package/dist/Editor/Elements/AppHeader/AppHeaderPopup.js +4 -1
  15. package/dist/Editor/Elements/Attachments/AttachmentsButton.js +4 -1
  16. package/dist/Editor/Elements/Button/ButtonPopup.js +4 -1
  17. package/dist/Editor/Elements/Button/ButtonToolIcon.js +6 -2
  18. package/dist/Editor/Elements/Button/EditorButton.js +43 -30
  19. package/dist/Editor/Elements/Carousel/Carousel.js +5 -4
  20. package/dist/Editor/Elements/Carousel/CarouselButton.js +6 -2
  21. package/dist/Editor/Elements/Carousel/CarouselItem.js +3 -2
  22. package/dist/Editor/Elements/ChipText/ChipTextPopup.js +4 -1
  23. package/dist/Editor/Elements/CodeToText/CodeToText.js +5 -4
  24. package/dist/Editor/Elements/CodeToText/HtmlContextMenu.js +6 -2
  25. package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -14
  26. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  27. package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
  28. package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
  29. package/dist/Editor/Elements/Colorbox/ColorboxButton.js +6 -2
  30. package/dist/Editor/Elements/DataView/DataView.js +5 -2
  31. package/dist/Editor/Elements/DataView/DataViewButton.js +6 -2
  32. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +4 -2
  33. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +448 -0
  34. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +21 -6
  35. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +13 -12
  36. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +7 -4
  37. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +7 -5
  38. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +9 -7
  39. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +8 -3
  40. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +5 -3
  41. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +6 -5
  42. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +5 -3
  43. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +9 -7
  44. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +15 -12
  45. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +3 -2
  46. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +3 -2
  47. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +23 -6
  48. package/dist/Editor/Elements/DataView/Layouts/TableView.js +6 -4
  49. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +8 -4
  50. package/dist/Editor/Elements/DataView/Layouts/index.js +3 -1
  51. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +5 -2
  52. package/dist/Editor/Elements/Divider/Divider.js +5 -3
  53. package/dist/Editor/Elements/Divider/DividerButton.js +6 -2
  54. package/dist/Editor/Elements/Divider/DividerPopup.js +3 -2
  55. package/dist/Editor/Elements/Embed/Embed.js +4 -1
  56. package/dist/Editor/Elements/Embed/EmbedPopup.js +4 -1
  57. package/dist/Editor/Elements/Embed/Image.js +16 -11
  58. package/dist/Editor/Elements/Embed/Video.js +10 -7
  59. package/dist/Editor/Elements/EmbedScript/Code.js +7 -4
  60. package/dist/Editor/Elements/EmbedScript/EmbedScript.js +6 -2
  61. package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +8 -5
  62. package/dist/Editor/Elements/Emoji/EmojiButton.js +6 -2
  63. package/dist/Editor/Elements/Form/FieldPopup.js +4 -1
  64. package/dist/Editor/Elements/Form/Form.js +12 -9
  65. package/dist/Editor/Elements/Form/FormButton.js +6 -2
  66. package/dist/Editor/Elements/Form/FormPopup.js +3 -2
  67. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +18 -12
  68. package/dist/Editor/Elements/Form/Workflow/ListWorkflow.js +13 -8
  69. package/dist/Editor/Elements/Form/Workflow/MoreOptions.js +3 -2
  70. package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
  71. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +4 -2
  72. package/dist/Editor/Elements/Form/Workflow/index.js +15 -9
  73. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +67 -23
  74. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +31 -6
  75. package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +6 -2
  76. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +54 -6
  77. package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +3 -2
  78. package/dist/Editor/Elements/FreeGrid/Options/More.js +10 -4
  79. package/dist/Editor/Elements/FreeGrid/styles.js +3 -0
  80. package/dist/Editor/Elements/Grid/Grid.js +13 -10
  81. package/dist/Editor/Elements/Grid/GridButton.js +9 -5
  82. package/dist/Editor/Elements/Grid/GridItem.js +14 -8
  83. package/dist/Editor/Elements/Grid/GridItemPopup.js +4 -1
  84. package/dist/Editor/Elements/Grid/GridPopup.js +4 -1
  85. package/dist/Editor/Elements/Grid/SectionPopup.js +4 -1
  86. package/dist/Editor/Elements/Link/Link.js +8 -5
  87. package/dist/Editor/Elements/Link/LinkButton.js +4 -1
  88. package/dist/Editor/Elements/List/CheckList.js +18 -10
  89. package/dist/Editor/Elements/NewLine/NewLineButton.js +6 -2
  90. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +4 -1
  91. package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +4 -1
  92. package/dist/Editor/Elements/Search/SearchButton.js +7 -4
  93. package/dist/Editor/Elements/Search/SearchList.js +10 -5
  94. package/dist/Editor/Elements/Signature/SignatureButton.js +6 -2
  95. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +2 -8
  96. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +6 -2
  97. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +4 -1
  98. package/dist/Editor/Elements/Signature/SignaturePopup.js +17 -16
  99. package/dist/Editor/Elements/SimpleText/index.js +14 -5
  100. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  101. package/dist/Editor/Elements/Table/DragButton.js +4 -2
  102. package/dist/Editor/Elements/Table/Table.js +23 -11
  103. package/dist/Editor/Elements/Table/TablePopup.js +4 -1
  104. package/dist/Editor/Elements/Table/TableSelector.js +10 -6
  105. package/dist/Editor/Elements/Table/TableTool.js +8 -4
  106. package/dist/Editor/Elements/Title/title.js +9 -8
  107. package/dist/Editor/Elements/TopBanner/TopBannerButton.js +4 -1
  108. package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
  109. package/dist/Editor/MiniEditor.js +10 -3
  110. package/dist/Editor/Styles/EditorStyles.js +5 -5
  111. package/dist/Editor/Toolbar/Basic/index.js +2 -1
  112. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +6 -2
  113. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  114. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  115. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +8 -4
  116. package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
  117. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +17 -5
  118. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +10 -5
  119. package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +10 -4
  120. package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +10 -4
  121. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +9 -3
  122. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +42 -35
  123. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  124. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +58 -51
  125. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +29 -22
  126. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +226 -87
  127. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +20 -10
  128. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +10 -5
  129. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +71 -11
  130. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +11 -5
  131. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +122 -42
  132. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +436 -0
  133. package/dist/Editor/Toolbar/PopupTool/index.js +18 -2
  134. package/dist/Editor/Toolbar/Toolbar.js +20 -10
  135. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  136. package/dist/Editor/assets/svg/ClearAllRounded.js +31 -0
  137. package/dist/Editor/assets/svg/ResetIconNew.js +23 -0
  138. package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
  139. package/dist/Editor/common/ColorPickerButton.js +39 -14
  140. package/dist/Editor/common/CustomColorPicker/index.js +131 -0
  141. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  142. package/dist/Editor/common/CustomDialog/index.js +8 -10
  143. package/dist/Editor/common/CustomDialog2/index.js +94 -0
  144. package/dist/Editor/common/CustomDialog2/style.js +67 -0
  145. package/dist/Editor/common/CustomSelect.js +43 -0
  146. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  147. package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
  148. package/dist/Editor/common/Icon.js +31 -1
  149. package/dist/Editor/common/ImageSelector/ImageSelector.js +10 -8
  150. package/dist/Editor/common/ImageSelector/Options/AddLink.js +6 -4
  151. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  152. package/dist/Editor/common/LinkSettings/NavComponents.js +14 -10
  153. package/dist/Editor/common/LinkSettings/index.js +20 -14
  154. package/dist/Editor/common/LinkSettings/navOptions.js +1 -1
  155. package/dist/Editor/common/MUIIcon/index.js +0 -3
  156. package/dist/Editor/common/MentionsPopup/index.js +6 -2
  157. package/dist/Editor/common/RnD/ContextMenu/CMenus.js +46 -22
  158. package/dist/Editor/common/RnD/ContextMenu/index.js +3 -2
  159. package/dist/Editor/common/RnD/ElementOptions/index.js +7 -2
  160. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +8 -3
  161. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +7 -3
  162. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  163. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  164. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  165. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  166. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +7 -4
  167. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  168. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  169. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +6 -2
  170. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  171. package/dist/Editor/common/RnD/OptionsPopup/index.js +4 -3
  172. package/dist/Editor/common/RnD/ShadowElement.js +2 -1
  173. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -4
  174. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  175. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  176. package/dist/Editor/common/RnD/Utils/gridDropItem.js +73 -9
  177. package/dist/Editor/common/RnD/Utils/index.js +3 -0
  178. package/dist/Editor/common/RnD/VirtualElement/BoxHeaderAutoAlignment.js +43 -0
  179. package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +44 -0
  180. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +134 -0
  181. package/dist/Editor/common/RnD/VirtualElement/helper.js +382 -0
  182. package/dist/Editor/common/RnD/VirtualElement/index.js +187 -103
  183. package/dist/Editor/common/RnD/VirtualElement/styles.js +155 -7
  184. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +5 -3
  185. package/dist/Editor/common/RnD/index.js +69 -13
  186. package/dist/Editor/common/Section/index.js +7 -4
  187. package/dist/Editor/common/Shorthands/elements.js +72 -3
  188. package/dist/Editor/common/SnackBar/index.js +43 -0
  189. package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +4 -4
  190. package/dist/Editor/common/StyleBuilder/boxStyle.js +2 -2
  191. package/dist/Editor/common/StyleBuilder/buttonStyle.js +6 -4
  192. package/dist/Editor/common/StyleBuilder/dividerStyles.js +2 -2
  193. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +6 -6
  194. package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -2
  195. package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +13 -9
  196. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +11 -3
  197. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +19 -5
  198. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +22 -10
  199. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +6 -3
  200. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +27 -13
  201. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +43 -14
  202. package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +10 -6
  203. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +19 -6
  204. package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +6 -2
  205. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +5 -2
  206. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +7 -6
  207. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +9 -6
  208. package/dist/Editor/common/StyleBuilder/fieldTypes/metaDataMapping.js +8 -2
  209. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +12 -11
  210. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +6 -2
  211. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +8 -4
  212. package/dist/Editor/common/StyleBuilder/fieldTypes/textAlign.js +6 -2
  213. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +21 -12
  214. package/dist/Editor/common/StyleBuilder/formStyle.js +7 -7
  215. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +6 -6
  216. package/dist/Editor/common/StyleBuilder/gridStyle.js +5 -5
  217. package/dist/Editor/common/StyleBuilder/index.js +8 -5
  218. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +5 -7
  219. package/dist/Editor/common/SwipeableDrawer/index.js +1 -1
  220. package/dist/Editor/common/Uploader.js +16 -5
  221. package/dist/Editor/commonStyle.js +68 -57
  222. package/dist/Editor/helper/index.js +27 -3
  223. package/dist/Editor/helper/textIndeces.js +58 -0
  224. package/dist/Editor/helper/theme.js +202 -2
  225. package/dist/Editor/hooks/useAutoScroll.js +38 -0
  226. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  227. package/dist/Editor/hooks/useMouseMove.js +9 -3
  228. package/dist/Editor/hooks/useThemeValues.js +63 -0
  229. package/dist/Editor/plugins/withEmbeds.js +1 -1
  230. package/dist/Editor/plugins/withHTML.js +11 -9
  231. package/dist/Editor/plugins/withLayout.js +3 -2
  232. package/dist/Editor/plugins/withLinks.js +10 -0
  233. package/dist/Editor/plugins/withTable.js +1 -1
  234. package/dist/Editor/theme/ThemeList.js +50 -173
  235. package/dist/Editor/theme/index.js +149 -0
  236. package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
  237. package/dist/Editor/themeSettings/buttons/index.js +290 -0
  238. package/dist/Editor/themeSettings/buttons/style.js +23 -0
  239. package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
  240. package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
  241. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  242. package/dist/Editor/themeSettings/fonts/index.js +240 -0
  243. package/dist/Editor/themeSettings/fonts/style.js +61 -0
  244. package/dist/Editor/themeSettings/icons.js +60 -0
  245. package/dist/Editor/themeSettings/index.js +351 -0
  246. package/dist/Editor/themeSettings/style.js +220 -0
  247. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  248. package/dist/Editor/themeSettingsAI/index.js +355 -0
  249. package/dist/Editor/themeSettingsAI/saveTheme.js +205 -0
  250. package/dist/Editor/themeSettingsAI/style.js +259 -0
  251. package/dist/Editor/utils/SlateUtilityFunctions.js +186 -54
  252. package/dist/Editor/utils/brains.js +1 -2
  253. package/dist/Editor/utils/draftToSlate.js +3 -2
  254. package/dist/Editor/utils/font.js +40 -37
  255. package/dist/Editor/utils/freegrid.js +3 -3
  256. package/dist/Editor/utils/helper.js +92 -21
  257. package/package.json +4 -4
@@ -0,0 +1,448 @@
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 SwipeableDrawer from "@mui/material/SwipeableDrawer";
14
+ import Tooltip from "@mui/material/Tooltip";
15
+ import { CloseIcon } from "../../../../../common/iconslist";
16
+ import { useEditorContext } from "../../../../../hooks/useMouseMove";
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 MultiSelectWithPopover = props => {
30
+ const {
31
+ options = [],
32
+ value,
33
+ onChange,
34
+ onUpdate,
35
+ property,
36
+ wrapColumn = false,
37
+ translation
38
+ } = props;
39
+ const [anchorEl, setAnchorEl] = useState(null);
40
+ const [anchorElOption, setAnchorElOption] = useState(null);
41
+ const [currentIndex, setCurrentIndex] = useState(null);
42
+ const [selectedOptions, setSelectedOptions] = useState(value);
43
+ const [availableOptions, setAvailableOptions] = useState(options);
44
+ const [showSnackBar, setShowSnackBar] = useState(false);
45
+ const [chipColor, setChipColor] = useState(generateRandomColor());
46
+ const [inputValue, setInputValue] = useState("");
47
+ const {
48
+ theme
49
+ } = useEditorContext();
50
+ const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
51
+ const PopoverComponent = isMobile ? SwipeableDrawer : Popover;
52
+ const mode = useMemo(() => ({
53
+ type: "editOptionMulti",
54
+ edit: {
55
+ label: "Multi Select",
56
+ visible: true,
57
+ key: property,
58
+ type: "multi-select",
59
+ options: options || [],
60
+ optionIndex: currentIndex,
61
+ hideBackButton: true
62
+ }
63
+ }), [options, property, currentIndex]);
64
+ const customScrollStyles = {
65
+ scrollbarWidth: "thin",
66
+ scrollbarColor: `${theme?.palette?.editor?.brainPopupScroll} transparent`,
67
+ "&::-webkit-scrollbar": {
68
+ width: "6px"
69
+ },
70
+ "&::-webkit-scrollbar-thumb": {
71
+ backgroundColor: theme?.palette?.editor?.brainPopupScroll,
72
+ borderRadius: "3px"
73
+ },
74
+ "&::-webkit-scrollbar-track": {
75
+ display: "none"
76
+ }
77
+ };
78
+ useEffect(() => {
79
+ if (inputValue?.trim() && !chipColor) {
80
+ setChipColor(generateRandomColor());
81
+ }
82
+ }, [inputValue, chipColor]);
83
+ useEffect(() => {
84
+ if (JSON.stringify(options) !== JSON.stringify(availableOptions)) {
85
+ setAvailableOptions(options);
86
+ }
87
+ }, [options, availableOptions]);
88
+ const handleOpenPopover = useCallback(event => {
89
+ setAnchorEl(event.currentTarget);
90
+ }, []);
91
+ const handleClosePopover = useCallback(e => {
92
+ e?.stopPropagation();
93
+ setAnchorEl(null);
94
+ }, []);
95
+ const handleAddOption = newValue => {
96
+ const trimmedValue = newValue?.trim();
97
+ if (!trimmedValue) return;
98
+ const newOption = {
99
+ value: trimmedValue,
100
+ color: chipColor
101
+ };
102
+ if (!availableOptions?.some(opt => opt?.value === trimmedValue)) {
103
+ setAvailableOptions(prev => [...prev, newOption]);
104
+ setSelectedOptions(prev => [...prev, newOption]);
105
+ onUpdate([newOption, ...availableOptions]);
106
+ }
107
+ setInputValue("");
108
+ setChipColor("");
109
+ };
110
+ const onClose = () => {
111
+ setAnchorEl(anchorElOption);
112
+ setAnchorElOption(null);
113
+ };
114
+ const onEditOption = (type, data) => {
115
+ const updateData = data?.edit ? data?.edit?.options : data?.options;
116
+ onUpdate(updateData);
117
+ if (data?.edit?.options) {
118
+ const updatedSelectedOptions = selectedOptions?.filter(selOption => updateData?.some(availOption => availOption?.value === selOption?.value && availOption?.color === selOption?.color));
119
+ setSelectedOptions(updatedSelectedOptions);
120
+ onClose();
121
+ }
122
+ };
123
+ const handleEditOption = (e, index) => {
124
+ e.stopPropagation();
125
+ setCurrentIndex(index);
126
+ setAnchorElOption(anchorEl);
127
+ setAnchorEl(null);
128
+ };
129
+ const handleSelectOption = option => {
130
+ if (!selectedOptions?.some(opt => opt?.value === option?.value)) {
131
+ const updatedOptions = [...selectedOptions, option];
132
+ setSelectedOptions(updatedOptions);
133
+ onChange(updatedOptions);
134
+ } else {
135
+ setShowSnackBar(true);
136
+ }
137
+ };
138
+ const handleClearSelection = () => {
139
+ setSelectedOptions([]);
140
+ };
141
+ const filteredOptions = availableOptions?.filter(option => option?.value?.toLowerCase()?.includes(inputValue?.toLowerCase()));
142
+ const isExactMatch = availableOptions?.some(opt => opt?.value?.toLowerCase() === inputValue?.toLowerCase());
143
+ const open = Boolean(anchorEl);
144
+ const openEditOption = Boolean(anchorElOption);
145
+ const id = open ? "autocomplete-popover" : undefined;
146
+ return /*#__PURE__*/_jsxs("div", {
147
+ children: [/*#__PURE__*/_jsx(Box, {
148
+ sx: {
149
+ display: "flex",
150
+ flexWrap: wrapColumn ? "wrap" : "nowrap",
151
+ overflowX: wrapColumn ? "hidden" : "auto",
152
+ gap: 0.5,
153
+ padding: "8px",
154
+ cursor: "pointer"
155
+ },
156
+ onClick: handleOpenPopover,
157
+ children: selectedOptions?.map((option, index) => /*#__PURE__*/_jsx(Chip, {
158
+ label: option?.value,
159
+ onDelete: event => {
160
+ event.stopPropagation();
161
+ setSelectedOptions(prev => prev.filter(selected => selected?.value !== option?.value));
162
+ },
163
+ deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {}),
164
+ variant: "filled",
165
+ sx: {
166
+ backgroundColor: option?.color,
167
+ color: '#0F172A',
168
+ "& .MuiChip-deleteIcon": {
169
+ flexShrink: 0,
170
+ "& path": {
171
+ stroke: '#0F172A'
172
+ }
173
+ },
174
+ "&:hover": {
175
+ opacity: 0.8
176
+ }
177
+ }
178
+ }, index))
179
+ }), /*#__PURE__*/_jsx(PopoverComponent, {
180
+ id: id,
181
+ open: open,
182
+ anchorEl: anchorEl,
183
+ anchor: "bottom",
184
+ onClose: e => handleClosePopover(e),
185
+ anchorOrigin: {
186
+ vertical: "top",
187
+ horizontal: "left"
188
+ },
189
+ transformOrigin: {
190
+ vertical: "top",
191
+ horizontal: "left"
192
+ },
193
+ sx: {
194
+ "& .MuiPaper-root": {
195
+ borderRadius: "20px",
196
+ background: theme?.palette?.editor?.textFormatBgColor,
197
+ border: `1px solid ${theme?.palette?.editor?.popUpBorderColor}`,
198
+ boxShadow: "0px 4px 10px 0px #00000029"
199
+ }
200
+ },
201
+ disableAutoFocus: true,
202
+ disableEnforceFocus: true,
203
+ disableRestoreFocus: true,
204
+ children: /*#__PURE__*/_jsxs(Box, {
205
+ sx: {
206
+ width: isMobile ? "100%" : 300
207
+ },
208
+ children: [/*#__PURE__*/_jsx(Autocomplete, {
209
+ multiple: true,
210
+ freeSolo: true,
211
+ disablePortal: true,
212
+ PopperComponent: () => null,
213
+ sx: {
214
+ "& .MuiFormControl-root": {
215
+ maxHeight: "250px",
216
+ overflowY: "auto",
217
+ overflowX: "hidden",
218
+ pr: '12px',
219
+ pl: '12px',
220
+ marginTop: '12px',
221
+ ...customScrollStyles
222
+ }
223
+ },
224
+ disableClearable: true,
225
+ options: [],
226
+ getOptionLabel: option => options?.value || "",
227
+ value: selectedOptions,
228
+ onChange: (event, newValues) => {
229
+ const addedOptions = newValues?.filter(value => typeof value === "object" || typeof value === "string" && value?.trim() !== "")?.map(value => typeof value === "string" ? {
230
+ value,
231
+ color: chipColor
232
+ } : value);
233
+ const isDuplicate = addedOptions?.some(newOpt => (selectedOptions || [])?.some(opt => opt.value === newOpt.value));
234
+ if (!isDuplicate) {
235
+ setSelectedOptions([...selectedOptions, ...addedOptions]);
236
+ }
237
+ },
238
+ inputValue: inputValue,
239
+ onInputChange: (event, newInputValue) => setInputValue(newInputValue),
240
+ onKeyDown: event => {
241
+ if (event.key === "Enter" && inputValue.trim()) {
242
+ event.preventDefault();
243
+ handleAddOption(inputValue);
244
+ }
245
+ },
246
+ filterOptions: (options, params) => options?.filter(option => option?.value?.toLowerCase()?.includes(params?.inputValue?.toLowerCase())),
247
+ renderInput: params => /*#__PURE__*/_jsx(TextField, {
248
+ ...params,
249
+ variant: "standard",
250
+ InputProps: {
251
+ ...params.InputProps,
252
+ disableUnderline: true,
253
+ sx: {
254
+ display: "flex",
255
+ flexWrap: "wrap",
256
+ fontFamily: "Inter",
257
+ fontWeight: 400,
258
+ fontSize: "12px",
259
+ color: theme?.palette?.editor?.secondaryTextColor,
260
+ "&::placeholder": {
261
+ color: theme?.palette?.editor?.secondaryTextColor
262
+ },
263
+ "& .MuiAutocomplete-input": {
264
+ minWidth: "100px !important"
265
+ }
266
+ },
267
+ endAdornment: /*#__PURE__*/_jsx(Tooltip, {
268
+ arrow: true,
269
+ title: "Clear Selected",
270
+ children: /*#__PURE__*/_jsx(IconButton, {
271
+ onClick: handleClearSelection,
272
+ sx: {
273
+ padding: 0,
274
+ minWidth: "unset",
275
+ "& .MuiSvgIcon-root": {
276
+ fontSize: 20
277
+ },
278
+ '& rect': {
279
+ fill: theme?.palette?.editor?.closeButtonSvgStroke
280
+ },
281
+ '&:hover': {
282
+ backgroundColor: 'transparent'
283
+ }
284
+ },
285
+ children: /*#__PURE__*/_jsx(Icon, {
286
+ icon: "resetIconNew"
287
+ })
288
+ })
289
+ })
290
+ },
291
+ sx: {
292
+ backgroundColor: "transparent",
293
+ fontFamily: 'Inter',
294
+ fontWeight: 400,
295
+ fontSize: '12px'
296
+ },
297
+ placeholder: "Create new one..."
298
+ }),
299
+ renderTags: (tagValues, getTagProps) => tagValues.map((option, index) => /*#__PURE__*/_jsx(Chip, {
300
+ variant: "filled",
301
+ label: option?.value,
302
+ ...getTagProps({
303
+ index
304
+ }),
305
+ onDelete: event => {
306
+ event?.stopPropagation();
307
+ setSelectedOptions(prev => prev.filter(selected => selected?.value !== option?.value));
308
+ },
309
+ deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {}),
310
+ sx: {
311
+ backgroundColor: option?.color,
312
+ color: '#0F172A',
313
+ "& .MuiChip-deleteIcon": {
314
+ flexShrink: 0,
315
+ "& path": {
316
+ stroke: '#0F172A'
317
+ }
318
+ },
319
+ "&:hover": {
320
+ opacity: 0.8
321
+ }
322
+ }
323
+ }, index))
324
+ }), /*#__PURE__*/_jsx(Divider, {
325
+ sx: {
326
+ mt: '12px',
327
+ borderBottom: `1px solid ${theme?.palette?.editor?.popUpBorderColor}`,
328
+ boxShadow: theme?.palette?.editor?.dividerDropShadow
329
+ }
330
+ }), /*#__PURE__*/_jsx(Box, {
331
+ sx: {
332
+ pl: '4px'
333
+ },
334
+ children: /*#__PURE__*/_jsxs(List, {
335
+ sx: {
336
+ maxHeight: "250px",
337
+ overflowY: "auto",
338
+ ...customScrollStyles
339
+ },
340
+ children: [/*#__PURE__*/_jsx(Typography, {
341
+ sx: {
342
+ mb: 1,
343
+ pl: '8px',
344
+ color: theme?.palette?.editor?.secondaryTextColor,
345
+ fontFamily: 'Inter',
346
+ fontWeight: 400,
347
+ fontSize: '12px'
348
+ },
349
+ children: "Choose an option or create one"
350
+ }), filteredOptions?.map((option, index) => /*#__PURE__*/_jsx(ListItem, {
351
+ sx: {
352
+ padding: 0
353
+ },
354
+ disablePadding: true,
355
+ children: /*#__PURE__*/_jsxs(ListItemButton, {
356
+ onClick: () => handleSelectOption(option),
357
+ sx: {
358
+ paddingTop: "4px",
359
+ paddingBottom: "4px",
360
+ justifyContent: 'space-between',
361
+ '&:hover': {
362
+ '& path': {
363
+ stroke: theme?.palette?.editor?.activeColor
364
+ },
365
+ borderRadius: '12px'
366
+ }
367
+ },
368
+ children: [/*#__PURE__*/_jsx(Chip, {
369
+ label: option?.value,
370
+ sx: {
371
+ backgroundColor: option?.color,
372
+ color: '#0F172A',
373
+ fontWeight: 500,
374
+ fontSize: "12px",
375
+ fontFamily: "Inter",
376
+ padding: "4px 12px",
377
+ borderRadius: "16px",
378
+ maxWidth: "180px",
379
+ whiteSpace: "nowrap",
380
+ overflow: "hidden",
381
+ textOverflow: "ellipsis"
382
+ }
383
+ }), /*#__PURE__*/_jsx(IconButton, {
384
+ size: "small",
385
+ sx: {
386
+ '& path': {
387
+ stroke: theme?.palette?.editor?.closeButtonSvgStroke
388
+ },
389
+ '&:hover': {
390
+ backgroundColor: 'transparent'
391
+ }
392
+ },
393
+ onClick: e => handleEditOption(e, index),
394
+ children: /*#__PURE__*/_jsx(Icon, {
395
+ icon: "rightArrow"
396
+ })
397
+ })]
398
+ })
399
+ }, index)), inputValue?.trim() && !isExactMatch && /*#__PURE__*/_jsx(ListItem, {
400
+ disablePadding: true,
401
+ children: /*#__PURE__*/_jsxs(ListItemButton, {
402
+ onClick: () => handleAddOption(inputValue),
403
+ sx: {
404
+ display: "flex",
405
+ alignItems: "center"
406
+ },
407
+ children: [/*#__PURE__*/_jsx(Typography, {
408
+ sx: {
409
+ color: theme?.palette?.editor?.secondaryTextColor,
410
+ marginRight: "6px",
411
+ fontSize: "14px",
412
+ fontFamily: "Inter"
413
+ },
414
+ children: "Create"
415
+ }), /*#__PURE__*/_jsx(Chip, {
416
+ label: `${inputValue}`,
417
+ sx: {
418
+ backgroundColor: chipColor,
419
+ color: '#0F172A',
420
+ fontWeight: 500,
421
+ fontSize: "12px",
422
+ fontFamily: "Inter",
423
+ borderRadius: "16px",
424
+ maxWidth: "180px",
425
+ whiteSpace: "nowrap",
426
+ overflow: "hidden",
427
+ textOverflow: "ellipsis"
428
+ }
429
+ })]
430
+ })
431
+ })]
432
+ })
433
+ })]
434
+ })
435
+ }), openEditOption ? /*#__PURE__*/_jsx(PropertySettings, {
436
+ open: openEditOption,
437
+ anchorEl: anchorElOption,
438
+ mode: mode,
439
+ onClose: onClose,
440
+ onEvent: onEditOption,
441
+ translation: translation
442
+ }) : null, showSnackBar ? /*#__PURE__*/_jsx(SnackbarAlert, {
443
+ message: "Option already selected!",
444
+ setShowSnackBar: setShowSnackBar
445
+ }) : null]
446
+ });
447
+ };
448
+ export default MultiSelectWithPopover;
@@ -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 MultiSelectWithPopover from "./Components/MultiSelect";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  const MultiSelectType = props => {
6
6
  const {
@@ -10,13 +10,15 @@ const MultiSelectType = props => {
10
10
  options,
11
11
  label = "",
12
12
  readOnly,
13
- settings
13
+ settings,
14
+ translation
14
15
  } = props;
15
16
  const {
16
17
  wrapColumn
17
18
  } = settings;
18
19
  const {
19
- onChange
20
+ onChange,
21
+ onUpdateProperty
20
22
  } = useDataView();
21
23
  const value = Array.isArray(pValue) ? pValue : [];
22
24
  const coloredValues = [...(value || [])]?.map(m => {
@@ -30,15 +32,28 @@ const MultiSelectType = props => {
30
32
  [property]: data?.filter(f => f?.value)
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(MultiSelectWithPopover, {
35
46
  value: coloredValues,
36
47
  onChange: handleChange,
48
+ onUpdate: handleUpdate,
37
49
  options: options,
38
50
  multiple: 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;
@@ -2,22 +2,23 @@ import React from "react";
2
2
  import { Box } from "@mui/material";
3
3
  import SimpleSelect from "../../DataTypes/Components/SimpleSelect";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
- const SORT_LABELS = {
6
- asc: "Ascending",
7
- desc: "Descending"
8
- };
9
- const SORT_OPTIONS = [{
10
- key: "asc",
11
- label: SORT_LABELS.asc
12
- }, {
13
- key: "desc",
14
- label: SORT_LABELS.desc
15
- }];
16
5
  const ChooseSort = props => {
17
6
  const {
18
7
  sort,
19
- onChange
8
+ onChange,
9
+ translation
20
10
  } = props;
11
+ const SORT_LABELS = {
12
+ asc: translation("Ascending"),
13
+ desc: translation("Descending")
14
+ };
15
+ const SORT_OPTIONS = [{
16
+ key: "asc",
17
+ label: SORT_LABELS.asc
18
+ }, {
19
+ key: "desc",
20
+ label: SORT_LABELS.desc
21
+ }];
21
22
  const handleChange = e => {
22
23
  onChange(sort, {
23
24
  operator: e?.target?.value
@@ -9,7 +9,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
10
  const SortOptions = props => {
11
11
  const {
12
- onClose
12
+ onClose,
13
+ translation
13
14
  } = props;
14
15
  const {
15
16
  properties,
@@ -54,10 +55,12 @@ const SortOptions = props => {
54
55
  children: [/*#__PURE__*/_jsx(ChooseField, {
55
56
  sort: m,
56
57
  properties: properties,
57
- onChange: handleSortChange
58
+ onChange: handleSortChange,
59
+ translation: translation
58
60
  }), /*#__PURE__*/_jsx(ChooseSort, {
59
61
  sort: m,
60
- onChange: handleSortChange
62
+ onChange: handleSortChange,
63
+ translation: translation
61
64
  })]
62
65
  })
63
66
  }, i);
@@ -75,7 +78,7 @@ const SortOptions = props => {
75
78
  icon: 'trashIcon'
76
79
  })
77
80
  }), /*#__PURE__*/_jsx(ListItemText, {
78
- children: "Delete Sort"
81
+ children: translation("Delete Sort")
79
82
  })]
80
83
  })]
81
84
  }) : /*#__PURE__*/_jsx(ColumnsList, {
@@ -15,20 +15,22 @@ const FilterSort = props => {
15
15
  open,
16
16
  mode,
17
17
  anchorEl,
18
- onClose
18
+ onClose,
19
+ translation
19
20
  } = props;
20
21
  const classes = useFilterSortStyles(theme, appTheme);
21
22
  const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
22
23
  const PoperComponent = isMobile ? SwipeableDrawer : Popover;
23
24
  const renderMode = () => {
24
25
  if (mode?.type === "filter") {
25
- return "Filter Mode will be availbele soon";
26
+ return translation("filterModeAvilableSoon");
26
27
  } else if (mode?.type === "sort") {
27
28
  return /*#__PURE__*/_jsx(SortOptions, {
28
- onClose: onClose
29
+ onClose: onClose,
30
+ translation: translation
29
31
  });
30
32
  } else {
31
- return "Unknown Filter / Sort Mode";
33
+ return translation("unKnownFilter");
32
34
  }
33
35
  };
34
36
  return /*#__PURE__*/_jsx(PoperComponent, {
@@ -50,7 +52,7 @@ const FilterSort = props => {
50
52
  children: [/*#__PURE__*/_jsxs(Box, {
51
53
  className: "fe-dv-ap-title",
52
54
  children: [/*#__PURE__*/_jsx("span", {
53
- children: "Sort By"
55
+ children: translation("Sort By")
54
56
  }), /*#__PURE__*/_jsx(IconButton, {
55
57
  className: "tv-act-ico bg br1",
56
58
  size: "small",
@@ -17,7 +17,8 @@ const FilterView = props => {
17
17
  readOnly,
18
18
  title,
19
19
  onTitleChange,
20
- path
20
+ path,
21
+ translation
21
22
  } = props;
22
23
  const {
23
24
  sort,
@@ -92,7 +93,7 @@ const FilterView = props => {
92
93
  fontSize: "16px"
93
94
  },
94
95
  size: "small",
95
- placeholder: "Untitled",
96
+ placeholder: translation("Untitled"),
96
97
  inputProps: {
97
98
  "aria-label": "Table Name",
98
99
  maxLength: 100
@@ -101,7 +102,7 @@ const FilterView = props => {
101
102
  onChange: handleTitleChange,
102
103
  onKeyUp: handleEnter,
103
104
  id: `tv-title-input-${path.join("|")}`
104
- }) : title || "Untitled"
105
+ }) : title || translation("Untitled")
105
106
  }), /*#__PURE__*/_jsxs(Box, {
106
107
  className: "tv-fi-wrpr",
107
108
  sx: {
@@ -130,7 +131,7 @@ const FilterView = props => {
130
131
  paddingBottom: "0px"
131
132
  },
132
133
  size: "small",
133
- placeholder: "Search here",
134
+ placeholder: translation("Search here"),
134
135
  inputProps: {
135
136
  "aria-label": "search google maps"
136
137
  },
@@ -152,7 +153,8 @@ const FilterView = props => {
152
153
  open: open,
153
154
  anchorEl: anchorEl,
154
155
  mode: mode,
155
- onClose: onClose
156
+ onClose: onClose,
157
+ translation: translation
156
158
  }), !readOnly ? /*#__PURE__*/_jsx(IconButton, {
157
159
  className: "mr",
158
160
  sx: {
@@ -196,7 +198,7 @@ const FilterView = props => {
196
198
  children: /*#__PURE__*/_jsx(Icon, {
197
199
  icon: "duplicateIcon"
198
200
  })
199
- }), "Duplicate"]
201
+ }), translation("Duplicate")]
200
202
  }), /*#__PURE__*/_jsxs(MenuItem, {
201
203
  onClick: onMenuClick("Delete"),
202
204
  children: [" ", /*#__PURE__*/_jsx(Box, {
@@ -208,7 +210,7 @@ const FilterView = props => {
208
210
  children: /*#__PURE__*/_jsx(Icon, {
209
211
  icon: "trashIcon"
210
212
  })
211
- }), "Delete"]
213
+ }), translation("Delete")]
212
214
  })]
213
215
  }) : null]
214
216
  })]