@flozy/editor 3.7.3 → 3.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. package/dist/Editor/ChatEditor.js +29 -2
  2. package/dist/Editor/CommonEditor.js +111 -169
  3. package/dist/Editor/Elements/Accordion/Accordion.js +7 -74
  4. package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +2 -3
  5. package/dist/Editor/Elements/Accordion/AccordionSummary.js +60 -4
  6. package/dist/Editor/Elements/AppHeader/AppHeader.js +4 -26
  7. package/dist/Editor/Elements/Button/EditorButton.js +14 -25
  8. package/dist/Editor/Elements/Color Picker/ColorButtons.js +17 -60
  9. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  10. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  11. package/dist/Editor/Elements/Color Picker/Styles.js +1 -2
  12. package/dist/Editor/Elements/Embed/Frames/ImageFrame.js +0 -1
  13. package/dist/Editor/Elements/Embed/Image.js +20 -28
  14. package/dist/Editor/Elements/Embed/Video.js +11 -15
  15. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
  16. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
  17. package/dist/Editor/Elements/Grid/Grid.js +0 -2
  18. package/dist/Editor/Elements/Grid/GridItem.js +1 -3
  19. package/dist/Editor/Elements/Link/Link.js +1 -6
  20. package/dist/Editor/Elements/Link/LinkButton.js +2 -4
  21. package/dist/Editor/Elements/Link/LinkPopup.js +3 -11
  22. package/dist/Editor/Elements/Table/TableCell.js +1 -1
  23. package/dist/Editor/MiniEditor.js +1 -3
  24. package/dist/Editor/Toolbar/Basic/index.js +2 -4
  25. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +2 -26
  26. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  27. package/dist/Editor/Toolbar/FormatTools/TextSize.js +11 -5
  28. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +11 -4
  29. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +86 -213
  30. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
  31. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +13 -20
  32. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +7 -52
  33. package/dist/Editor/Toolbar/PopupTool/index.js +11 -7
  34. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  35. package/dist/Editor/common/ColorPickerButton.js +9 -25
  36. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  37. package/dist/Editor/common/Icon.js +2 -30
  38. package/dist/Editor/common/MentionsPopup/Styles.js +3 -6
  39. package/dist/Editor/common/Shorthands/elements.js +0 -54
  40. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +7 -7
  41. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
  42. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  43. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +3 -13
  44. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
  45. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +7 -31
  46. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
  47. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +4 -14
  48. package/dist/Editor/common/StyleBuilder/index.js +1 -1
  49. package/dist/Editor/helper/theme.js +4 -190
  50. package/dist/Editor/hooks/useMouseMove.js +2 -4
  51. package/dist/Editor/plugins/withEmbeds.js +1 -1
  52. package/dist/Editor/plugins/withHTML.js +5 -47
  53. package/dist/Editor/plugins/withLayout.js +10 -15
  54. package/dist/Editor/plugins/withTable.js +2 -2
  55. package/dist/Editor/theme/ThemeList.js +173 -50
  56. package/dist/Editor/utils/SlateUtilityFunctions.js +25 -157
  57. package/dist/Editor/utils/button.js +17 -1
  58. package/dist/Editor/utils/events.js +4 -11
  59. package/dist/Editor/utils/font.js +37 -40
  60. package/dist/Editor/utils/helper.js +12 -71
  61. package/package.json +1 -1
  62. package/dist/Editor/Elements/Link/LinkPopupStyles.js +0 -28
  63. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
  64. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  65. package/dist/Editor/common/CustomColorPicker/index.js +0 -106
  66. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  67. package/dist/Editor/common/CustomDialog/index.js +0 -94
  68. package/dist/Editor/common/CustomDialog/style.js +0 -67
  69. package/dist/Editor/common/CustomSelect.js +0 -33
  70. package/dist/Editor/common/EditorCmds.js +0 -35
  71. package/dist/Editor/hooks/useEditorTheme.js +0 -139
  72. package/dist/Editor/theme/index.js +0 -144
  73. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  74. package/dist/Editor/themeSettings/buttons/index.js +0 -290
  75. package/dist/Editor/themeSettings/buttons/style.js +0 -21
  76. package/dist/Editor/themeSettings/colorTheme/index.js +0 -290
  77. package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
  78. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -123
  79. package/dist/Editor/themeSettings/fonts/index.js +0 -213
  80. package/dist/Editor/themeSettings/fonts/style.js +0 -44
  81. package/dist/Editor/themeSettings/icons.js +0 -60
  82. package/dist/Editor/themeSettings/index.js +0 -320
  83. package/dist/Editor/themeSettings/style.js +0 -152
  84. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  85. package/dist/Editor/themeSettingsAI/index.js +0 -356
  86. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -190
  87. package/dist/Editor/themeSettingsAI/style.js +0 -247
@@ -1,356 +0,0 @@
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",
239
- color: "textSecondary",
240
- children: "Click here to upload PDF, PPT, and image files."
241
- })]
242
- })]
243
- })
244
- }), themeTabType === 1 && /*#__PURE__*/_jsx(Grid, {
245
- className: "textArea",
246
- children: /*#__PURE__*/_jsx(TextareaAutosize, {
247
- placeholder: "Describe the theme you are interested in..."
248
- })
249
- }), themeTabType === 2 && /*#__PURE__*/_jsxs(_Fragment, {
250
- children: [/*#__PURE__*/_jsx(Grid, {
251
- className: "textArea imageUrl invalidUrl",
252
- children: /*#__PURE__*/_jsx(TextField, {
253
- fullWidth: true,
254
- placeholder: "Add Image URL",
255
- size: "small"
256
- // value={imageUrl}
257
- ,
258
- id: "outlined-basic",
259
- variant: "outlined",
260
- InputProps: {
261
- endAdornment: /*#__PURE__*/_jsx(InputAdornment, {
262
- position: "end",
263
- children: /*#__PURE__*/_jsx(TickIcon, {})
264
- })
265
- }
266
- })
267
- }), /*#__PURE__*/_jsx(Grid, {
268
- className: "imageUpload",
269
- children: /*#__PURE__*/_jsx(Grid, {
270
- container: true,
271
- justifyContent: "center",
272
- justifyItems: "center",
273
- className: "imgUploadInner",
274
- children: /*#__PURE__*/_jsx(Grid, {
275
- container: true,
276
- justifyContent: "center",
277
- alignItems: "center",
278
- direction: "column",
279
- children: /*#__PURE__*/_jsx("img", {
280
- src: "",
281
- alt: ""
282
- })
283
- })
284
- })
285
- })]
286
- }), /*#__PURE__*/_jsxs(Grid, {
287
- children: [/*#__PURE__*/_jsx(FormControlLabel, {
288
- sx: {
289
- mb: 1,
290
- mt: 1
291
- },
292
- control: /*#__PURE__*/_jsx(Checkbox, {
293
- checked: enableGenerateTheme,
294
- onChange: event => setEnableGenerateTheme(event.target.checked),
295
- size: "small"
296
- }),
297
- label: /*#__PURE__*/_jsx(Typography, {
298
- variant: "body2",
299
- className: "fs-12",
300
- children: "a generated theme is used, the site text style will also change."
301
- })
302
- }), /*#__PURE__*/_jsxs(Grid, {
303
- container: true,
304
- justifyContent: generateTheme ? "space-between" : "flex-end",
305
- children: [generateTheme && /*#__PURE__*/_jsx(Button, {
306
- className: "outlineBtn",
307
- variant: "outlined",
308
- size: "small",
309
- color: "primary",
310
- children: "Regenerate theme"
311
- }), /*#__PURE__*/_jsxs(Button, {
312
- variant: "contained",
313
- size: "small",
314
- className: `blueBtn ${enableGenerateTheme ? "eanbled" : "disabled"}`,
315
- disabled: loading,
316
- onClick: () => {
317
- // setGenerateTheme(true);
318
- getTheme(fileInputRef, onThemeChange, setLoading);
319
- },
320
- children: [loading ? /*#__PURE__*/_jsx(CircularProgress, {
321
- size: 18,
322
- style: {
323
- marginRight: "10px"
324
- }
325
- }) : null, loading ? "Generating..." : "Generate Theme"]
326
- })]
327
- })]
328
- }), /*#__PURE__*/_jsx(Divider, {
329
- sx: {
330
- mt: 2,
331
- mb: 2
332
- }
333
- }), /*#__PURE__*/_jsx(Typography, {
334
- variant: "body1",
335
- className: "fs-14 fw-600",
336
- sx: {
337
- mt: 1,
338
- mb: 1
339
- },
340
- children: "Active Theme"
341
- }), /*#__PURE__*/_jsx(Grid, {
342
- className: "themeCardWrapper",
343
- children: /*#__PURE__*/_jsxs(Grid, {
344
- container: true,
345
- justifyContent: "space-between",
346
- className: "themeCard selected",
347
- children: [/*#__PURE__*/_jsx(TickIcon, {}), /*#__PURE__*/_jsx(ActiveTheme, {
348
- explore: false
349
- })]
350
- })
351
- })]
352
- })
353
- })
354
- });
355
- };
356
- export default styled(ThemeSettingsAI)(Style);
@@ -1,190 +0,0 @@
1
- import React, { useEffect, useState } from "react";
2
- import { 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
- } = props;
21
-
22
- // State
23
- const [saveTheme, setSaveTheme] = useState(false);
24
- const [error, setError] = useState({});
25
- const [form, setForm] = useState(defaultFormData);
26
- const {
27
- name,
28
- mood_name
29
- } = form;
30
- const updateForm = update => {
31
- setForm(prev => ({
32
- ...prev,
33
- ...update
34
- }));
35
- };
36
- useEffect(() => {
37
- setForm(defaultFormData);
38
- }, [defaultFormData]);
39
- const onClose = () => {
40
- setSaveTheme(false);
41
- setError({});
42
- setForm({});
43
- };
44
- const validate = () => {
45
- let err = {};
46
- if (!name) {
47
- err.name = "This field is required!";
48
- }
49
- if (!mood_name) {
50
- err.mood_name = "This field is required!";
51
- }
52
- return err;
53
- };
54
- return /*#__PURE__*/_jsxs(_Fragment, {
55
- children: [/*#__PURE__*/_jsx(Button, {
56
- variant: "contained",
57
- size: "small",
58
- className: `blueBtn ${enableGenerateTheme ? "eanbled" : "disabled"}`
59
- // disabled={!enableGenerateTheme}
60
- ,
61
- onClick: () => setSaveTheme(true),
62
- children: saveBtnLabel
63
- }), /*#__PURE__*/_jsx(Dialog, {
64
- fullWidth: true,
65
- maxWidth: "sm",
66
- open: saveTheme,
67
- onClose: onClose,
68
- className: className,
69
- children: /*#__PURE__*/_jsxs(Grid, {
70
- className: "saveThemeContainer",
71
- sx: {
72
- p: 2
73
- },
74
- children: [/*#__PURE__*/_jsxs(Grid, {
75
- container: true,
76
- justifyContent: "space-between",
77
- children: [/*#__PURE__*/_jsx(Typography, {
78
- variant: "h4",
79
- sx: {
80
- fontSize: "20px"
81
- },
82
- className: "fw-600",
83
- children: "Save Your theme"
84
- }), /*#__PURE__*/_jsx(IconButton, {
85
- onClick: onClose,
86
- className: "closeBtn",
87
- children: /*#__PURE__*/_jsx(CloseIcon, {})
88
- })]
89
- }), /*#__PURE__*/_jsx(Divider, {
90
- sx: {
91
- mt: 1,
92
- mb: 1
93
- }
94
- }), /*#__PURE__*/_jsx(Typography, {
95
- variant: "body1",
96
- className: "fw-500",
97
- sx: {
98
- pb: 0.5
99
- },
100
- children: "Theme name"
101
- }), /*#__PURE__*/_jsx(TextField, {
102
- variant: "outlined",
103
- fullWidth: true,
104
- size: "small",
105
- placeholder: "Ex : Forest green",
106
- onChange: e => updateForm({
107
- name: e.target.value
108
- }),
109
- value: name
110
- }), /*#__PURE__*/_jsx(Error, {
111
- error: error?.name
112
- }), /*#__PURE__*/_jsx(Typography, {
113
- variant: "body1",
114
- className: "fw-500",
115
- sx: {
116
- pt: 1,
117
- pb: 0.5
118
- },
119
- children: "Category"
120
- }), /*#__PURE__*/_jsx(TextField, {
121
- variant: "outlined",
122
- size: "small",
123
- placeholder: "Ex : Nature and Calm",
124
- fullWidth: true,
125
- onChange: e => updateForm({
126
- mood_name: e.target.value
127
- }),
128
- value: mood_name
129
- }), /*#__PURE__*/_jsx(Error, {
130
- error: error?.mood_name
131
- }), /*#__PURE__*/_jsxs(Grid, {
132
- container: true,
133
- justifyContent: "flex-end",
134
- sx: {
135
- mt: 3
136
- },
137
- children: [/*#__PURE__*/_jsx(Button, {
138
- variant: "outlined",
139
- className: "seondaryOutlineBtn",
140
- color: "secondary",
141
- onClick: onClose,
142
- children: "Cancel"
143
- }), /*#__PURE__*/_jsxs(Button, {
144
- variant: "contained",
145
- color: "primary",
146
- className: "blueBtn",
147
- sx: {
148
- ml: 1
149
- },
150
- disabled: loading,
151
- onClick: async () => {
152
- const err = validate();
153
- setError(err);
154
- if (Object.keys(err)?.length) {
155
- return;
156
- }
157
- await onSave({
158
- ...form
159
- });
160
- onClose();
161
- },
162
- children: [loading ? /*#__PURE__*/_jsx(CircularProgress, {
163
- size: 14,
164
- style: {
165
- marginRight: "10px"
166
- }
167
- }) : null, saveBtnLabel]
168
- })]
169
- })]
170
- })
171
- })]
172
- });
173
- };
174
- export default styled(SaveTheme)(Style);
175
- function Error({
176
- error = ""
177
- }) {
178
- if (error) {
179
- return /*#__PURE__*/_jsx(Typography, {
180
- variant: "body1",
181
- sx: {
182
- color: "red",
183
- mt: 1
184
- },
185
- children: error
186
- });
187
- } else {
188
- return /*#__PURE__*/_jsx(_Fragment, {});
189
- }
190
- }