@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.
- package/dist/Editor/ChatEditor.js +26 -19
- package/dist/Editor/CommonEditor.js +141 -26
- package/dist/Editor/DialogWrapper.js +31 -25
- package/dist/Editor/Editor.css +11 -7
- package/dist/Editor/Elements/AI/AIInput.js +5 -3
- package/dist/Editor/Elements/AI/CustomSelect.js +9 -5
- package/dist/Editor/Elements/AI/PopoverAIInput.js +15 -5
- package/dist/Editor/Elements/Accordion/Accordion.js +4 -3
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +4 -1
- package/dist/Editor/Elements/Accordion/AccordionButton.js +6 -2
- package/dist/Editor/Elements/Accordion/AccordionTitlePopup.js +4 -1
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/AppHeader/AppHeaderButton.js +6 -2
- package/dist/Editor/Elements/AppHeader/AppHeaderPopup.js +4 -1
- package/dist/Editor/Elements/Attachments/AttachmentsButton.js +4 -1
- package/dist/Editor/Elements/Button/ButtonPopup.js +4 -1
- package/dist/Editor/Elements/Button/ButtonToolIcon.js +6 -2
- package/dist/Editor/Elements/Button/EditorButton.js +43 -30
- package/dist/Editor/Elements/Carousel/Carousel.js +5 -4
- package/dist/Editor/Elements/Carousel/CarouselButton.js +6 -2
- package/dist/Editor/Elements/Carousel/CarouselItem.js +3 -2
- package/dist/Editor/Elements/ChipText/ChipTextPopup.js +4 -1
- package/dist/Editor/Elements/CodeToText/CodeToText.js +5 -4
- package/dist/Editor/Elements/CodeToText/HtmlContextMenu.js +6 -2
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -14
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
- package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
- package/dist/Editor/Elements/Colorbox/ColorboxButton.js +6 -2
- package/dist/Editor/Elements/DataView/DataView.js +5 -2
- package/dist/Editor/Elements/DataView/DataViewButton.js +6 -2
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +4 -2
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +448 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +21 -6
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +13 -12
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +7 -4
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +7 -5
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +9 -7
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +8 -3
- package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +5 -3
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +6 -5
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +5 -3
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +9 -7
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +15 -12
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +3 -2
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +3 -2
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +23 -6
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +6 -4
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +8 -4
- package/dist/Editor/Elements/DataView/Layouts/index.js +3 -1
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +5 -2
- package/dist/Editor/Elements/Divider/Divider.js +5 -3
- package/dist/Editor/Elements/Divider/DividerButton.js +6 -2
- package/dist/Editor/Elements/Divider/DividerPopup.js +3 -2
- package/dist/Editor/Elements/Embed/Embed.js +4 -1
- package/dist/Editor/Elements/Embed/EmbedPopup.js +4 -1
- package/dist/Editor/Elements/Embed/Image.js +16 -11
- package/dist/Editor/Elements/Embed/Video.js +10 -7
- package/dist/Editor/Elements/EmbedScript/Code.js +7 -4
- package/dist/Editor/Elements/EmbedScript/EmbedScript.js +6 -2
- package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +8 -5
- package/dist/Editor/Elements/Emoji/EmojiButton.js +6 -2
- package/dist/Editor/Elements/Form/FieldPopup.js +4 -1
- package/dist/Editor/Elements/Form/Form.js +12 -9
- package/dist/Editor/Elements/Form/FormButton.js +6 -2
- package/dist/Editor/Elements/Form/FormPopup.js +3 -2
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +18 -12
- package/dist/Editor/Elements/Form/Workflow/ListWorkflow.js +13 -8
- package/dist/Editor/Elements/Form/Workflow/MoreOptions.js +3 -2
- package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +4 -2
- package/dist/Editor/Elements/Form/Workflow/index.js +15 -9
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +67 -23
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +31 -6
- package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +6 -2
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +54 -6
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +3 -2
- package/dist/Editor/Elements/FreeGrid/Options/More.js +10 -4
- package/dist/Editor/Elements/FreeGrid/styles.js +3 -0
- package/dist/Editor/Elements/Grid/Grid.js +13 -10
- package/dist/Editor/Elements/Grid/GridButton.js +9 -5
- package/dist/Editor/Elements/Grid/GridItem.js +14 -8
- package/dist/Editor/Elements/Grid/GridItemPopup.js +4 -1
- package/dist/Editor/Elements/Grid/GridPopup.js +4 -1
- package/dist/Editor/Elements/Grid/SectionPopup.js +4 -1
- package/dist/Editor/Elements/Link/Link.js +8 -5
- package/dist/Editor/Elements/Link/LinkButton.js +4 -1
- package/dist/Editor/Elements/List/CheckList.js +18 -10
- package/dist/Editor/Elements/NewLine/NewLineButton.js +6 -2
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +4 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +4 -1
- package/dist/Editor/Elements/Search/SearchButton.js +7 -4
- package/dist/Editor/Elements/Search/SearchList.js +10 -5
- package/dist/Editor/Elements/Signature/SignatureButton.js +6 -2
- package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +2 -8
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +6 -2
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +4 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +17 -16
- package/dist/Editor/Elements/SimpleText/index.js +14 -5
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Table/DragButton.js +4 -2
- package/dist/Editor/Elements/Table/Table.js +23 -11
- package/dist/Editor/Elements/Table/TablePopup.js +4 -1
- package/dist/Editor/Elements/Table/TableSelector.js +10 -6
- package/dist/Editor/Elements/Table/TableTool.js +8 -4
- package/dist/Editor/Elements/Title/title.js +9 -8
- package/dist/Editor/Elements/TopBanner/TopBannerButton.js +4 -1
- package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
- package/dist/Editor/MiniEditor.js +10 -3
- package/dist/Editor/Styles/EditorStyles.js +5 -5
- package/dist/Editor/Toolbar/Basic/index.js +2 -1
- package/dist/Editor/Toolbar/FormatTools/BlockButton.js +6 -2
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +8 -4
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +17 -5
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +10 -5
- package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +10 -4
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +10 -4
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +9 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +42 -35
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +58 -51
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +29 -22
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +226 -87
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +20 -10
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +10 -5
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +71 -11
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +11 -5
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +122 -42
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +436 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +18 -2
- package/dist/Editor/Toolbar/Toolbar.js +20 -10
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/ClearAllRounded.js +31 -0
- package/dist/Editor/assets/svg/ResetIconNew.js +23 -0
- package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
- package/dist/Editor/common/ColorPickerButton.js +39 -14
- package/dist/Editor/common/CustomColorPicker/index.js +131 -0
- package/dist/Editor/common/CustomColorPicker/style.js +53 -0
- package/dist/Editor/common/CustomDialog/index.js +8 -10
- package/dist/Editor/common/CustomDialog2/index.js +94 -0
- package/dist/Editor/common/CustomDialog2/style.js +67 -0
- package/dist/Editor/common/CustomSelect.js +43 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
- package/dist/Editor/common/Icon.js +31 -1
- package/dist/Editor/common/ImageSelector/ImageSelector.js +10 -8
- package/dist/Editor/common/ImageSelector/Options/AddLink.js +6 -4
- package/dist/Editor/common/ImageSelector/Styles.js +3 -9
- package/dist/Editor/common/LinkSettings/NavComponents.js +14 -10
- package/dist/Editor/common/LinkSettings/index.js +20 -14
- package/dist/Editor/common/LinkSettings/navOptions.js +1 -1
- package/dist/Editor/common/MUIIcon/index.js +0 -3
- package/dist/Editor/common/MentionsPopup/index.js +6 -2
- package/dist/Editor/common/RnD/ContextMenu/CMenus.js +46 -22
- package/dist/Editor/common/RnD/ContextMenu/index.js +3 -2
- package/dist/Editor/common/RnD/ElementOptions/index.js +7 -2
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +8 -3
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +7 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +7 -4
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +6 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
- package/dist/Editor/common/RnD/OptionsPopup/index.js +4 -3
- package/dist/Editor/common/RnD/ShadowElement.js +2 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -4
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +73 -9
- package/dist/Editor/common/RnD/Utils/index.js +3 -0
- package/dist/Editor/common/RnD/VirtualElement/BoxHeaderAutoAlignment.js +43 -0
- package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +44 -0
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +134 -0
- package/dist/Editor/common/RnD/VirtualElement/helper.js +382 -0
- package/dist/Editor/common/RnD/VirtualElement/index.js +187 -103
- package/dist/Editor/common/RnD/VirtualElement/styles.js +155 -7
- package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +5 -3
- package/dist/Editor/common/RnD/index.js +69 -13
- package/dist/Editor/common/Section/index.js +7 -4
- package/dist/Editor/common/Shorthands/elements.js +72 -3
- package/dist/Editor/common/SnackBar/index.js +43 -0
- package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +4 -4
- package/dist/Editor/common/StyleBuilder/boxStyle.js +2 -2
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +6 -4
- package/dist/Editor/common/StyleBuilder/dividerStyles.js +2 -2
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +6 -6
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +13 -9
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +11 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +19 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +22 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +6 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +27 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +43 -14
- package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +10 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +19 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +6 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +5 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +7 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +9 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/metaDataMapping.js +8 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +12 -11
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +6 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +8 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textAlign.js +6 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +21 -12
- package/dist/Editor/common/StyleBuilder/formStyle.js +7 -7
- package/dist/Editor/common/StyleBuilder/gridItemStyle.js +6 -6
- package/dist/Editor/common/StyleBuilder/gridStyle.js +5 -5
- package/dist/Editor/common/StyleBuilder/index.js +8 -5
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +5 -7
- package/dist/Editor/common/SwipeableDrawer/index.js +1 -1
- package/dist/Editor/common/Uploader.js +16 -5
- package/dist/Editor/commonStyle.js +68 -57
- package/dist/Editor/helper/index.js +27 -3
- package/dist/Editor/helper/textIndeces.js +58 -0
- package/dist/Editor/helper/theme.js +202 -2
- package/dist/Editor/hooks/useAutoScroll.js +38 -0
- package/dist/Editor/hooks/useEditorTheme.js +153 -0
- package/dist/Editor/hooks/useMouseMove.js +9 -3
- package/dist/Editor/hooks/useThemeValues.js +63 -0
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +11 -9
- package/dist/Editor/plugins/withLayout.js +3 -2
- package/dist/Editor/plugins/withLinks.js +10 -0
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +50 -173
- package/dist/Editor/theme/index.js +149 -0
- package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
- package/dist/Editor/themeSettings/buttons/index.js +290 -0
- package/dist/Editor/themeSettings/buttons/style.js +23 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
- package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
- package/dist/Editor/themeSettings/fonts/index.js +240 -0
- package/dist/Editor/themeSettings/fonts/style.js +61 -0
- package/dist/Editor/themeSettings/icons.js +60 -0
- package/dist/Editor/themeSettings/index.js +351 -0
- package/dist/Editor/themeSettings/style.js +220 -0
- package/dist/Editor/themeSettingsAI/icons.js +96 -0
- package/dist/Editor/themeSettingsAI/index.js +355 -0
- package/dist/Editor/themeSettingsAI/saveTheme.js +205 -0
- package/dist/Editor/themeSettingsAI/style.js +259 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +186 -54
- package/dist/Editor/utils/brains.js +1 -2
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/freegrid.js +3 -3
- package/dist/Editor/utils/helper.js +92 -21
- package/package.json +4 -4
@@ -0,0 +1,355 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Button, Checkbox, CircularProgress, Divider, Drawer, FormControlLabel, Grid, IconButton, InputAdornment, Tab, Tabs, TextField, TextareaAutosize, Typography, styled } from "@mui/material";
|
3
|
+
|
4
|
+
// Style
|
5
|
+
import Style from "./style";
|
6
|
+
|
7
|
+
// icons
|
8
|
+
import { CloseIcon } from "../common/iconslist";
|
9
|
+
import { CloudIcon } from "./icons";
|
10
|
+
import { TickIcon } from "./icons";
|
11
|
+
import { ResetIcon } from "./icons";
|
12
|
+
import { useEditorTheme } from "../hooks/useEditorTheme";
|
13
|
+
import ActiveTheme from "../themeSettings/ActiveTheme";
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
16
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
17
|
+
function generateUniqueId() {
|
18
|
+
const timestamp = Date.now(); // current timestamp in milliseconds
|
19
|
+
const randomNum = Math.floor(Math.random() * 1000000); // random number for uniqueness
|
20
|
+
return `id_${timestamp}_${randomNum}`;
|
21
|
+
}
|
22
|
+
async function getTheme(fileInputRef, onThemeChange, setLoading) {
|
23
|
+
const file = fileInputRef.current?.files[0];
|
24
|
+
if (file) {
|
25
|
+
setLoading(true);
|
26
|
+
// Create a FormData object to hold the file
|
27
|
+
const formData = new FormData();
|
28
|
+
formData.append("file", file); // 'image' is the key that your backend will use to access the file
|
29
|
+
|
30
|
+
try {
|
31
|
+
// Send the file using the fetch API
|
32
|
+
const response = await fetch("https://aicheck.agenciflow.com/create", {
|
33
|
+
method: "POST",
|
34
|
+
body: formData
|
35
|
+
});
|
36
|
+
|
37
|
+
// Handle the response
|
38
|
+
if (response.ok) {
|
39
|
+
const data = await response.json(); // Assuming the response is JSON
|
40
|
+
const theme = JSON.parse(data?.response || "{}");
|
41
|
+
onThemeChange({
|
42
|
+
id: generateUniqueId(),
|
43
|
+
name: "AI Generated",
|
44
|
+
theme: theme
|
45
|
+
});
|
46
|
+
} else {
|
47
|
+
console.error("Error:", response.statusText);
|
48
|
+
}
|
49
|
+
} catch (error) {
|
50
|
+
console.error("Fetch error:", error);
|
51
|
+
}
|
52
|
+
setLoading(false);
|
53
|
+
} else {
|
54
|
+
console.log("No file selected");
|
55
|
+
}
|
56
|
+
}
|
57
|
+
const ThemeSettingsAI = props => {
|
58
|
+
const {
|
59
|
+
className,
|
60
|
+
openAITheme,
|
61
|
+
setOpenAITheme
|
62
|
+
} = props;
|
63
|
+
|
64
|
+
// State
|
65
|
+
// const [themeDrawer, setThemeDrawer] = useState(true);
|
66
|
+
const [themeTabType, setThemeTabType] = React.useState(0);
|
67
|
+
const [enableGenerateTheme, setEnableGenerateTheme] = React.useState(false);
|
68
|
+
const [generateTheme] = React.useState(false);
|
69
|
+
const [loading, setLoading] = React.useState(false);
|
70
|
+
const [imageSrc, setImageSrc] = useState(null);
|
71
|
+
const {
|
72
|
+
updateTheme
|
73
|
+
} = useEditorTheme();
|
74
|
+
const onThemeChange = theme => {
|
75
|
+
updateTheme(theme, {
|
76
|
+
action: "THEME_CHANGE"
|
77
|
+
});
|
78
|
+
};
|
79
|
+
|
80
|
+
// image upload
|
81
|
+
const fileInputRef = React.useRef(null);
|
82
|
+
const handleDivClick = () => {
|
83
|
+
// Trigger the click event on the hidden file input element
|
84
|
+
fileInputRef.current.click();
|
85
|
+
};
|
86
|
+
const handleImageUpload = event => {
|
87
|
+
const file = event.target.files[0];
|
88
|
+
if (file) {
|
89
|
+
const reader = new FileReader();
|
90
|
+
reader.onload = () => {
|
91
|
+
setImageSrc(reader.result);
|
92
|
+
};
|
93
|
+
reader.readAsDataURL(file);
|
94
|
+
setEnableGenerateTheme(true);
|
95
|
+
}
|
96
|
+
};
|
97
|
+
const handleTabChange = (event, newValue) => {
|
98
|
+
setThemeTabType(newValue);
|
99
|
+
};
|
100
|
+
const handleClose = () => {
|
101
|
+
setOpenAITheme(false);
|
102
|
+
};
|
103
|
+
|
104
|
+
// themeCard
|
105
|
+
// const ThemeCard = () => {
|
106
|
+
// return (
|
107
|
+
// <Grid className="themeCardWrapper">
|
108
|
+
// {/* remove selected based on condition */}
|
109
|
+
// <Grid
|
110
|
+
// container
|
111
|
+
// justifyContent={"space-between"}
|
112
|
+
// className="themeCard selected"
|
113
|
+
// >
|
114
|
+
// <TickIcon />
|
115
|
+
// <Grid>
|
116
|
+
// <Typography variant="body1" className="fs-14 fw-500">
|
117
|
+
// Slate Gray
|
118
|
+
// </Typography>
|
119
|
+
// <Typography
|
120
|
+
// variant="body2"
|
121
|
+
// color={"textSecondary"}
|
122
|
+
// className="fs-12"
|
123
|
+
// >
|
124
|
+
// Muted Elegance
|
125
|
+
// </Typography>
|
126
|
+
// </Grid>
|
127
|
+
// <Grid className="flexAlign" sx={{ gap: "5px" }}>
|
128
|
+
// <Grid className="primaryCard"></Grid>
|
129
|
+
// <Grid className="secondaryCard"></Grid>
|
130
|
+
// <Grid className="otherColors" sx={{ gap: "5px" }}>
|
131
|
+
// <Grid className="smallCard"></Grid>
|
132
|
+
// <Grid className="smallCard"></Grid>
|
133
|
+
// <Grid className="smallCard"></Grid>
|
134
|
+
// <Grid className="smallCard"></Grid>
|
135
|
+
// </Grid>
|
136
|
+
// </Grid>
|
137
|
+
// </Grid>
|
138
|
+
// </Grid>
|
139
|
+
// );
|
140
|
+
// };
|
141
|
+
|
142
|
+
return /*#__PURE__*/_jsx(Grid, {
|
143
|
+
className: className,
|
144
|
+
children: /*#__PURE__*/_jsx(Drawer, {
|
145
|
+
className: className,
|
146
|
+
open: openAITheme,
|
147
|
+
onClose: handleClose,
|
148
|
+
anchor: "right",
|
149
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
150
|
+
className: "settingsContainer",
|
151
|
+
children: [/*#__PURE__*/_jsxs(Grid, {
|
152
|
+
container: true,
|
153
|
+
justifyContent: "space-between",
|
154
|
+
wrap: "nowrap",
|
155
|
+
className: "header",
|
156
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
157
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
158
|
+
variant: "body1",
|
159
|
+
className: "title",
|
160
|
+
children: "Create theme with AI"
|
161
|
+
})
|
162
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
163
|
+
className: "closeBtn",
|
164
|
+
onClick: handleClose,
|
165
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
166
|
+
})]
|
167
|
+
}), /*#__PURE__*/_jsxs(Tabs, {
|
168
|
+
value: themeTabType,
|
169
|
+
onChange: handleTabChange,
|
170
|
+
variant: "scrollable",
|
171
|
+
scrollButtons: false,
|
172
|
+
"aria-label": "scrollable prevent tabs example",
|
173
|
+
sx: {
|
174
|
+
mb: 2
|
175
|
+
},
|
176
|
+
children: [/*#__PURE__*/_jsx(Tab, {
|
177
|
+
label: /*#__PURE__*/_jsx(Typography, {
|
178
|
+
variant: "body1",
|
179
|
+
className: "fs-14 fw-500 transformNone",
|
180
|
+
children: "Image"
|
181
|
+
})
|
182
|
+
}), /*#__PURE__*/_jsx(Tab, {
|
183
|
+
label: /*#__PURE__*/_jsx(Typography, {
|
184
|
+
variant: "body1",
|
185
|
+
className: "fs-14 fw-500 transformNone",
|
186
|
+
children: "Text"
|
187
|
+
})
|
188
|
+
}), /*#__PURE__*/_jsx(Tab, {
|
189
|
+
label: /*#__PURE__*/_jsx(Typography, {
|
190
|
+
variant: "body1",
|
191
|
+
className: "fs-14 fw-500 transformNone",
|
192
|
+
children: "Image link"
|
193
|
+
})
|
194
|
+
})]
|
195
|
+
}), themeTabType === 0 && /*#__PURE__*/_jsx(Grid, {
|
196
|
+
className: "imageUpload",
|
197
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
198
|
+
container: true,
|
199
|
+
justifyContent: "center",
|
200
|
+
alignItems: "center",
|
201
|
+
className: "imgUploadInner",
|
202
|
+
onClick: handleDivClick,
|
203
|
+
children: [/*#__PURE__*/_jsx("input", {
|
204
|
+
type: "file",
|
205
|
+
accept: ".png",
|
206
|
+
ref: fileInputRef,
|
207
|
+
onChange: handleImageUpload,
|
208
|
+
style: {
|
209
|
+
display: "none"
|
210
|
+
}
|
211
|
+
}), imageSrc ? /*#__PURE__*/_jsxs(_Fragment, {
|
212
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
213
|
+
className: "resetIcon",
|
214
|
+
onClick: () => setImageSrc(null),
|
215
|
+
children: /*#__PURE__*/_jsx(ResetIcon, {})
|
216
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
217
|
+
className: "changeImgText",
|
218
|
+
children: "Change Image"
|
219
|
+
}), /*#__PURE__*/_jsx("img", {
|
220
|
+
src: imageSrc,
|
221
|
+
alt: "Uploaded Preview",
|
222
|
+
className: "uploadedImage"
|
223
|
+
})]
|
224
|
+
}) : /*#__PURE__*/_jsxs(Grid, {
|
225
|
+
container: true,
|
226
|
+
justifyContent: "center",
|
227
|
+
alignItems: "center",
|
228
|
+
direction: "column",
|
229
|
+
children: [/*#__PURE__*/_jsx(CloudIcon, {}), /*#__PURE__*/_jsx(Typography, {
|
230
|
+
variant: "body1",
|
231
|
+
className: "fw-600",
|
232
|
+
sx: {
|
233
|
+
pb: 0.5
|
234
|
+
},
|
235
|
+
children: "Upload a logo or image"
|
236
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
237
|
+
variant: "body2",
|
238
|
+
className: "fs-12 textSecondary",
|
239
|
+
children: "Click here to upload PDF, PPT, and image files."
|
240
|
+
})]
|
241
|
+
})]
|
242
|
+
})
|
243
|
+
}), themeTabType === 1 && /*#__PURE__*/_jsx(Grid, {
|
244
|
+
className: "textArea",
|
245
|
+
children: /*#__PURE__*/_jsx(TextareaAutosize, {
|
246
|
+
placeholder: "Describe the theme you are interested in..."
|
247
|
+
})
|
248
|
+
}), themeTabType === 2 && /*#__PURE__*/_jsxs(_Fragment, {
|
249
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
250
|
+
className: "textArea imageUrl invalidUrl",
|
251
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
252
|
+
fullWidth: true,
|
253
|
+
placeholder: "Add Image URL",
|
254
|
+
size: "small"
|
255
|
+
// value={imageUrl}
|
256
|
+
,
|
257
|
+
id: "outlined-basic",
|
258
|
+
variant: "outlined",
|
259
|
+
InputProps: {
|
260
|
+
endAdornment: /*#__PURE__*/_jsx(InputAdornment, {
|
261
|
+
position: "end",
|
262
|
+
children: /*#__PURE__*/_jsx(TickIcon, {})
|
263
|
+
})
|
264
|
+
}
|
265
|
+
})
|
266
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
267
|
+
className: "imageUpload",
|
268
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
269
|
+
container: true,
|
270
|
+
justifyContent: "center",
|
271
|
+
justifyItems: "center",
|
272
|
+
className: "imgUploadInner",
|
273
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
274
|
+
container: true,
|
275
|
+
justifyContent: "center",
|
276
|
+
alignItems: "center",
|
277
|
+
direction: "column",
|
278
|
+
children: /*#__PURE__*/_jsx("img", {
|
279
|
+
src: "",
|
280
|
+
alt: ""
|
281
|
+
})
|
282
|
+
})
|
283
|
+
})
|
284
|
+
})]
|
285
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
286
|
+
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
287
|
+
sx: {
|
288
|
+
mb: 1,
|
289
|
+
mt: 1
|
290
|
+
},
|
291
|
+
control: /*#__PURE__*/_jsx(Checkbox, {
|
292
|
+
checked: enableGenerateTheme,
|
293
|
+
onChange: event => setEnableGenerateTheme(event.target.checked),
|
294
|
+
size: "small"
|
295
|
+
}),
|
296
|
+
label: /*#__PURE__*/_jsx(Typography, {
|
297
|
+
variant: "body2",
|
298
|
+
className: "fs-12",
|
299
|
+
children: "a generated theme is used, the site text style will also change."
|
300
|
+
})
|
301
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
302
|
+
container: true,
|
303
|
+
justifyContent: generateTheme ? "space-between" : "flex-end",
|
304
|
+
children: [generateTheme && /*#__PURE__*/_jsx(Button, {
|
305
|
+
className: "outlineBtn",
|
306
|
+
variant: "outlined",
|
307
|
+
size: "small",
|
308
|
+
color: "primary",
|
309
|
+
children: "Regenerate theme"
|
310
|
+
}), /*#__PURE__*/_jsxs(Button, {
|
311
|
+
variant: "contained",
|
312
|
+
size: "small",
|
313
|
+
className: `blueBtn ${enableGenerateTheme ? "eanbled" : "disabled"}`,
|
314
|
+
disabled: loading,
|
315
|
+
onClick: () => {
|
316
|
+
// setGenerateTheme(true);
|
317
|
+
getTheme(fileInputRef, onThemeChange, setLoading);
|
318
|
+
},
|
319
|
+
children: [loading ? /*#__PURE__*/_jsx(CircularProgress, {
|
320
|
+
size: 18,
|
321
|
+
style: {
|
322
|
+
marginRight: "10px"
|
323
|
+
}
|
324
|
+
}) : null, loading ? "Generating..." : "Generate Theme"]
|
325
|
+
})]
|
326
|
+
})]
|
327
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
328
|
+
sx: {
|
329
|
+
mt: 2,
|
330
|
+
mb: 2
|
331
|
+
}
|
332
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
333
|
+
variant: "body1",
|
334
|
+
className: "fs-14 fw-600",
|
335
|
+
sx: {
|
336
|
+
mt: 1,
|
337
|
+
mb: 1
|
338
|
+
},
|
339
|
+
children: "Active Theme"
|
340
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
341
|
+
className: "themeCardWrapper",
|
342
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
343
|
+
container: true,
|
344
|
+
justifyContent: "space-between",
|
345
|
+
className: "themeCard selected",
|
346
|
+
children: [/*#__PURE__*/_jsx(TickIcon, {}), /*#__PURE__*/_jsx(ActiveTheme, {
|
347
|
+
explore: false
|
348
|
+
})]
|
349
|
+
})
|
350
|
+
})]
|
351
|
+
})
|
352
|
+
})
|
353
|
+
});
|
354
|
+
};
|
355
|
+
export default styled(ThemeSettingsAI)(Style);
|
@@ -0,0 +1,205 @@
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
|
+
import { Box, Button, CircularProgress, Dialog, Divider, Grid, IconButton, TextField, Typography, styled } from "@mui/material";
|
3
|
+
|
4
|
+
// Style
|
5
|
+
import Style from "./style";
|
6
|
+
|
7
|
+
// icons
|
8
|
+
import { CloseIcon } from "../common/iconslist";
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
11
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
12
|
+
const SaveTheme = props => {
|
13
|
+
const {
|
14
|
+
className,
|
15
|
+
// enableGenerateTheme,
|
16
|
+
saveBtnLabel,
|
17
|
+
loading,
|
18
|
+
onSave,
|
19
|
+
defaultFormData = {},
|
20
|
+
addNewTheme
|
21
|
+
} = props;
|
22
|
+
|
23
|
+
// State
|
24
|
+
const [saveTheme, setSaveTheme] = useState(false);
|
25
|
+
const [error, setError] = useState({});
|
26
|
+
const [form, setForm] = useState(defaultFormData);
|
27
|
+
const {
|
28
|
+
name,
|
29
|
+
mood_name
|
30
|
+
} = form;
|
31
|
+
const updateForm = update => {
|
32
|
+
setForm(prev => ({
|
33
|
+
...prev,
|
34
|
+
...update
|
35
|
+
}));
|
36
|
+
};
|
37
|
+
const onClose = () => {
|
38
|
+
setSaveTheme(false);
|
39
|
+
setError({});
|
40
|
+
setForm({});
|
41
|
+
};
|
42
|
+
const validate = () => {
|
43
|
+
let err = {};
|
44
|
+
if (!name) {
|
45
|
+
err.name = "This field is required!";
|
46
|
+
}
|
47
|
+
if (!mood_name) {
|
48
|
+
err.mood_name = "This field is required!";
|
49
|
+
}
|
50
|
+
return err;
|
51
|
+
};
|
52
|
+
return /*#__PURE__*/_jsxs(Box, {
|
53
|
+
className: className,
|
54
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
55
|
+
variant: "contained",
|
56
|
+
size: "small"
|
57
|
+
// className={`blueBtn ${enableGenerateTheme ? "eanbled" : "disabled"}`}
|
58
|
+
// disabled={!enableGenerateTheme}
|
59
|
+
,
|
60
|
+
className: addNewTheme ? `outlineBtn` : `blueBtn`,
|
61
|
+
onClick: () => {
|
62
|
+
setForm(defaultFormData);
|
63
|
+
setSaveTheme(true);
|
64
|
+
},
|
65
|
+
children: saveBtnLabel
|
66
|
+
}), /*#__PURE__*/_jsx(Dialog, {
|
67
|
+
fullWidth: true,
|
68
|
+
maxWidth: "sm",
|
69
|
+
open: saveTheme,
|
70
|
+
onClose: onClose,
|
71
|
+
className: className,
|
72
|
+
sx: {
|
73
|
+
borderRadius: "10px"
|
74
|
+
},
|
75
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
76
|
+
className: "saveThemeContainer",
|
77
|
+
sx: {
|
78
|
+
p: 2,
|
79
|
+
pt: 2.5
|
80
|
+
},
|
81
|
+
children: [/*#__PURE__*/_jsxs(Grid, {
|
82
|
+
container: true,
|
83
|
+
justifyContent: "space-between",
|
84
|
+
alignItems: "center",
|
85
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
86
|
+
variant: "h4",
|
87
|
+
sx: {
|
88
|
+
fontSize: "18px"
|
89
|
+
},
|
90
|
+
className: "fw-600",
|
91
|
+
children: saveBtnLabel
|
92
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
93
|
+
onClick: onClose,
|
94
|
+
className: "closeBtn",
|
95
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
96
|
+
})]
|
97
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
98
|
+
sx: {
|
99
|
+
mt: 2,
|
100
|
+
mb: 2
|
101
|
+
}
|
102
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
103
|
+
variant: "body1",
|
104
|
+
className: "fw-500",
|
105
|
+
sx: {
|
106
|
+
pb: 1
|
107
|
+
},
|
108
|
+
children: "Theme name"
|
109
|
+
}), /*#__PURE__*/_jsx(TextField, {
|
110
|
+
variant: "outlined",
|
111
|
+
fullWidth: true,
|
112
|
+
size: "small",
|
113
|
+
placeholder: "Ex : Forest green",
|
114
|
+
onChange: e => updateForm({
|
115
|
+
name: e.target.value
|
116
|
+
}),
|
117
|
+
value: name
|
118
|
+
}), /*#__PURE__*/_jsx(Error, {
|
119
|
+
error: error?.name
|
120
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
121
|
+
variant: "body1",
|
122
|
+
className: "fw-500",
|
123
|
+
sx: {
|
124
|
+
pt: 2,
|
125
|
+
pb: 1
|
126
|
+
},
|
127
|
+
children: "Category"
|
128
|
+
}), /*#__PURE__*/_jsx(TextField, {
|
129
|
+
variant: "outlined",
|
130
|
+
size: "small",
|
131
|
+
placeholder: "Ex : Nature and Calm",
|
132
|
+
fullWidth: true,
|
133
|
+
onChange: e => updateForm({
|
134
|
+
mood_name: e.target.value
|
135
|
+
}),
|
136
|
+
value: mood_name
|
137
|
+
}), /*#__PURE__*/_jsx(Error, {
|
138
|
+
error: error?.mood_name
|
139
|
+
}), loading ? /*#__PURE__*/_jsx(Box, {
|
140
|
+
sx: {
|
141
|
+
position: "absolute",
|
142
|
+
top: 0,
|
143
|
+
left: 0,
|
144
|
+
right: 0,
|
145
|
+
bottom: 0,
|
146
|
+
zIndex: 99999,
|
147
|
+
display: "flex",
|
148
|
+
justifyContent: "center",
|
149
|
+
alignItems: "center"
|
150
|
+
},
|
151
|
+
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
152
|
+
}) : null, /*#__PURE__*/_jsxs(Grid, {
|
153
|
+
container: true,
|
154
|
+
justifyContent: "flex-end",
|
155
|
+
sx: {
|
156
|
+
mt: 3
|
157
|
+
},
|
158
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
159
|
+
variant: "outlined",
|
160
|
+
className: "seondaryOutlineBtn",
|
161
|
+
color: "secondary",
|
162
|
+
onClick: onClose,
|
163
|
+
children: "Cancel"
|
164
|
+
}), /*#__PURE__*/_jsx(Button, {
|
165
|
+
variant: "contained",
|
166
|
+
color: "primary",
|
167
|
+
className: "blueBtn",
|
168
|
+
sx: {
|
169
|
+
ml: 1
|
170
|
+
},
|
171
|
+
onClick: async () => {
|
172
|
+
const err = validate();
|
173
|
+
setError(err);
|
174
|
+
if (Object.keys(err)?.length) {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
await onSave({
|
178
|
+
...form
|
179
|
+
}, addNewTheme);
|
180
|
+
onClose();
|
181
|
+
},
|
182
|
+
children: saveBtnLabel
|
183
|
+
})]
|
184
|
+
})]
|
185
|
+
})
|
186
|
+
})]
|
187
|
+
});
|
188
|
+
};
|
189
|
+
export default styled(SaveTheme)(Style);
|
190
|
+
function Error({
|
191
|
+
error = ""
|
192
|
+
}) {
|
193
|
+
if (error) {
|
194
|
+
return /*#__PURE__*/_jsx(Typography, {
|
195
|
+
variant: "body1",
|
196
|
+
sx: {
|
197
|
+
color: "red",
|
198
|
+
mt: 1
|
199
|
+
},
|
200
|
+
children: error
|
201
|
+
});
|
202
|
+
} else {
|
203
|
+
return /*#__PURE__*/_jsx(_Fragment, {});
|
204
|
+
}
|
205
|
+
}
|