@flozy/editor 10.2.4 → 10.2.6
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/CommonEditor.js +11 -0
- package/dist/Editor/Elements/Accordion/Accordion.js +27 -8
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +1 -23
- package/dist/Editor/Elements/AppHeader/AppHeader.js +7 -2
- package/dist/Editor/Elements/Button/EditorButton.js +6 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +26 -26
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +8 -8
- package/dist/Editor/Elements/Form/Form.js +1 -3
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +0 -1
- package/dist/Editor/Elements/Table/TableCell.js +7 -3
- package/dist/Editor/common/Checkbox/index.js +46 -0
- package/dist/Editor/common/Checkbox/styles.js +45 -0
- package/dist/Editor/common/ColorPickerButton.js +3 -0
- package/dist/Editor/common/LinkSettings/NavComponents.js +45 -65
- package/dist/Editor/common/LinkSettings/index.js +13 -26
- package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
- package/dist/Editor/common/LinkSettings/style.js +164 -244
- package/dist/Editor/common/RadioGroup/index.js +48 -0
- package/dist/Editor/common/RadioGroup/styles.js +29 -0
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +4 -5
- package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -1
- package/dist/Editor/common/RnD/OptionsPopup/style.js +0 -1
- package/dist/Editor/common/Select/index.js +44 -7
- package/dist/Editor/common/Select/styles.js +30 -2
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +12 -9
- package/dist/Editor/common/SwipeableDrawer/style.js +14 -12
- package/dist/Editor/common/iconListV2.js +21 -0
- package/dist/Editor/commonStyle.js +18 -0
- package/dist/Editor/utils/helper.js +25 -7
- package/dist/Editor/utils/insertAppHeader.js +1 -1
- package/package.json +1 -1
@@ -191,6 +191,17 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
191
191
|
ReactEditor.focus(editor);
|
192
192
|
}
|
193
193
|
}, [id, content]);
|
194
|
+
useEffect(() => {
|
195
|
+
if (isReadOnly) {
|
196
|
+
const sectionId = window.location.hash.substring(1);
|
197
|
+
const sectionEle = sectionId ? document.getElementById(decodeURIComponent(sectionId)) : null;
|
198
|
+
if (sectionEle) {
|
199
|
+
sectionEle.scrollIntoView({
|
200
|
+
behavior: "smooth"
|
201
|
+
});
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}, []);
|
194
205
|
const debounced = useDebouncedCallback(
|
195
206
|
// function
|
196
207
|
value => {
|
@@ -8,7 +8,8 @@ import { GridSettingsIcon } from "../../common/iconslist";
|
|
8
8
|
import Icon from "../../common/Icon";
|
9
9
|
import { useEditorContext, useEditorSelection } from "../../hooks/useMouseMove";
|
10
10
|
import useCommonStyle from "../../commonStyle";
|
11
|
-
import { getBorderColor } from "../../helper";
|
11
|
+
import { getBorderColor, getTextColor } from "../../helper";
|
12
|
+
import { getBreakPointsValue, getTRBLBreakPoints } from "../../helper/theme";
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
14
15
|
const accordionBtnStyleKeys = {
|
@@ -82,6 +83,12 @@ const Accordion = props => {
|
|
82
83
|
bgColor,
|
83
84
|
borderColor
|
84
85
|
} = element;
|
86
|
+
const accordionSummary = element?.children?.find(c => c.type === "accordion-summary");
|
87
|
+
const {
|
88
|
+
textColor: childTextColor,
|
89
|
+
borderRadius,
|
90
|
+
bannerSpacing
|
91
|
+
} = accordionSummary || {};
|
85
92
|
const borderStyle = getBorderColor(borderColor);
|
86
93
|
const {
|
87
94
|
theme
|
@@ -162,18 +169,29 @@ const Accordion = props => {
|
|
162
169
|
const onClose = () => {
|
163
170
|
setOpenSettings(false);
|
164
171
|
};
|
165
|
-
|
172
|
+
const textStyles = getTextColor(childTextColor);
|
173
|
+
const borderRadiusStyles = {
|
174
|
+
...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
|
175
|
+
};
|
176
|
+
const padding = getTRBLBreakPoints(bannerSpacing);
|
177
|
+
return /*#__PURE__*/_jsxs(Box, {
|
166
178
|
className: `accordion-container`,
|
167
179
|
...attributes,
|
168
180
|
style: {
|
169
181
|
position: "relative"
|
170
182
|
},
|
183
|
+
component: "div",
|
184
|
+
sx: {
|
185
|
+
background: bgColor,
|
186
|
+
...borderStyle,
|
187
|
+
borderRadius: borderRadiusStyles,
|
188
|
+
padding,
|
189
|
+
'& span[data-slate-string="true"]': textStyles
|
190
|
+
},
|
171
191
|
children: [/*#__PURE__*/_jsxs("div", {
|
172
|
-
className: "accordion-title"
|
173
|
-
style:
|
174
|
-
|
175
|
-
...borderStyle
|
176
|
-
},
|
192
|
+
className: "accordion-title"
|
193
|
+
// style={{ background: bgColor, ...borderStyle }}
|
194
|
+
,
|
177
195
|
onClick: onToggle,
|
178
196
|
children: [/*#__PURE__*/_jsx(Box, {
|
179
197
|
role: "button",
|
@@ -195,7 +213,8 @@ const Accordion = props => {
|
|
195
213
|
icon: "accordionArrowDown"
|
196
214
|
})
|
197
215
|
}), children[0]]
|
198
|
-
}), /*#__PURE__*/_jsx(
|
216
|
+
}), /*#__PURE__*/_jsx(Box, {
|
217
|
+
component: "div",
|
199
218
|
className: "accordion-content",
|
200
219
|
style: {
|
201
220
|
display: toggle ? "block" : "none"
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import { getBorderColor, getTextColor } from "../../helper";
|
3
2
|
import { Box } from "@mui/material";
|
4
|
-
import { getBreakPointsValue, getTRBLBreakPoints } from "../../helper/theme";
|
5
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
4
|
const AccordionSummary = props => {
|
7
5
|
const {
|
@@ -9,32 +7,12 @@ const AccordionSummary = props => {
|
|
9
7
|
children,
|
10
8
|
element
|
11
9
|
} = props;
|
12
|
-
const {
|
13
|
-
textColor,
|
14
|
-
bgColor,
|
15
|
-
borderColor,
|
16
|
-
borderRadius,
|
17
|
-
bannerSpacing
|
18
|
-
} = element;
|
19
|
-
const textStyles = getTextColor(textColor);
|
20
|
-
const borderStyle = getBorderColor(borderColor);
|
21
10
|
return /*#__PURE__*/_jsx(Box, {
|
22
11
|
className: `accordion-summary-container`,
|
23
12
|
...attributes,
|
24
13
|
style: {
|
25
14
|
width: "100%",
|
26
|
-
position: "relative"
|
27
|
-
background: bgColor,
|
28
|
-
...borderStyle
|
29
|
-
},
|
30
|
-
sx: {
|
31
|
-
borderRadius: {
|
32
|
-
...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
|
33
|
-
},
|
34
|
-
padding: {
|
35
|
-
...getTRBLBreakPoints(bannerSpacing)
|
36
|
-
},
|
37
|
-
'& span[data-slate-string="true"]': textStyles
|
15
|
+
position: "relative"
|
38
16
|
},
|
39
17
|
component: "div",
|
40
18
|
children: children
|
@@ -18,7 +18,7 @@ import Typography from "@mui/material/Typography";
|
|
18
18
|
import Button from "@mui/material/Button";
|
19
19
|
import AppHeaderPopup from "./AppHeaderPopup";
|
20
20
|
import { getTRBLBreakPoints, groupByBreakpoint } from "../../helper/theme";
|
21
|
-
import { handleLinkType } from "../../utils/helper";
|
21
|
+
import { handleLinkType, isHavingColor } from "../../utils/helper";
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
23
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
24
24
|
import { createElement as _createElement } from "react";
|
@@ -45,6 +45,8 @@ function AppHeader(props) {
|
|
45
45
|
bgColorHover,
|
46
46
|
textColor,
|
47
47
|
textColorHover,
|
48
|
+
borderColor,
|
49
|
+
borderColorHover,
|
48
50
|
menuStyle,
|
49
51
|
bannerSpacing,
|
50
52
|
fontSize,
|
@@ -149,7 +151,7 @@ function AppHeader(props) {
|
|
149
151
|
}) : appTitle
|
150
152
|
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(List, {
|
151
153
|
children: menus.map((item, i) => {
|
152
|
-
const buttonProps = handleLinkType(item.url, item.linkType, true, item.target === "_blank");
|
154
|
+
const buttonProps = handleLinkType(item.url, item.linkType, true, item.target === "_blank", () => {}, !readOnly, true);
|
153
155
|
const onButtonClick = e => {
|
154
156
|
closeDrawer();
|
155
157
|
setTimeout(() => {
|
@@ -225,6 +227,7 @@ function AppHeader(props) {
|
|
225
227
|
sx: {
|
226
228
|
...elevateStyle,
|
227
229
|
background: bgColor,
|
230
|
+
border: isHavingColor(borderColor) ? `1px solid ${borderColor}` : "none",
|
228
231
|
boxShadow: "none",
|
229
232
|
...appbarSp,
|
230
233
|
zIndex: 999
|
@@ -322,6 +325,7 @@ function AppHeader(props) {
|
|
322
325
|
fontSize: fontSize || "16px",
|
323
326
|
color: textColor || "#000",
|
324
327
|
background: bgColor || "none",
|
328
|
+
border: borderColorHover ? `1px solid transparent` : "none",
|
325
329
|
"& .m-settings": {
|
326
330
|
display: "none",
|
327
331
|
position: "absolute",
|
@@ -337,6 +341,7 @@ function AppHeader(props) {
|
|
337
341
|
"&:hover": {
|
338
342
|
color: textColorHover || textColor || "#000",
|
339
343
|
background: bgColorHover || bgColor || "none",
|
344
|
+
border: borderColorHover ? `1px solid ${borderColorHover}` : "none",
|
340
345
|
"& .m-settings": {
|
341
346
|
display: "block"
|
342
347
|
}
|
@@ -61,6 +61,7 @@ const EditorButton = props => {
|
|
61
61
|
fontFamily,
|
62
62
|
textColorHover,
|
63
63
|
bgColorHover,
|
64
|
+
borderColorHover,
|
64
65
|
// buttonIcon,
|
65
66
|
iconPosition = "start",
|
66
67
|
borderStyle,
|
@@ -105,7 +106,7 @@ const EditorButton = props => {
|
|
105
106
|
};
|
106
107
|
const buttonProps = handleLinkType(refURl, linkType, true,
|
107
108
|
// button functionalities have to work on both edit mode and normal mode
|
108
|
-
openInNewTab, handleTrigger, metadata);
|
109
|
+
openInNewTab, handleTrigger, metadata, !readOnly);
|
109
110
|
const onMenuClick = val => () => {
|
110
111
|
switch (val) {
|
111
112
|
case "edit":
|
@@ -279,7 +280,7 @@ const EditorButton = props => {
|
|
279
280
|
sx: {
|
280
281
|
textDecoration: "none",
|
281
282
|
borderBlockStyle: "solid",
|
282
|
-
borderWidth: borderWidth !== undefined ? borderWidth : borderColor ? "1px" : "0px",
|
283
|
+
borderWidth: borderWidth !== undefined ? borderWidth : borderColor || borderColorHover ? "1px" : "0px",
|
283
284
|
...btnSp,
|
284
285
|
borderStyle: borderStyle || "solid",
|
285
286
|
display: "inline-flex",
|
@@ -290,8 +291,9 @@ const EditorButton = props => {
|
|
290
291
|
display: "none"
|
291
292
|
},
|
292
293
|
"&:hover": {
|
293
|
-
color: `${textColorHover || textColor}`,
|
294
|
-
background: bgColorHover || bgColor,
|
294
|
+
color: `${textColorHover || textColor || "#FFFFFF"}`,
|
295
|
+
background: bgColorHover || bgColor || "rgb(30, 75, 122)",
|
296
|
+
borderColor: borderColorHover || borderColor || "",
|
295
297
|
"& .element-toolbar": {
|
296
298
|
display: "flex"
|
297
299
|
}
|
@@ -171,11 +171,11 @@ const MultiSelectWithPopover = props => {
|
|
171
171
|
variant: "filled",
|
172
172
|
sx: {
|
173
173
|
backgroundColor: option?.color,
|
174
|
-
color:
|
174
|
+
color: "#0F172A",
|
175
175
|
"& .MuiChip-deleteIcon": {
|
176
176
|
flexShrink: 0,
|
177
177
|
"& path": {
|
178
|
-
stroke:
|
178
|
+
stroke: "#0F172A !important"
|
179
179
|
}
|
180
180
|
},
|
181
181
|
"&:hover": {
|
@@ -222,9 +222,9 @@ const MultiSelectWithPopover = props => {
|
|
222
222
|
maxHeight: "250px",
|
223
223
|
overflowY: "auto",
|
224
224
|
overflowX: "hidden",
|
225
|
-
pr:
|
226
|
-
pl:
|
227
|
-
marginTop:
|
225
|
+
pr: "12px",
|
226
|
+
pl: "12px",
|
227
|
+
marginTop: "12px",
|
228
228
|
...customScrollStyles
|
229
229
|
}
|
230
230
|
},
|
@@ -282,11 +282,11 @@ const MultiSelectWithPopover = props => {
|
|
282
282
|
"& .MuiSvgIcon-root": {
|
283
283
|
fontSize: 20
|
284
284
|
},
|
285
|
-
|
285
|
+
"& rect": {
|
286
286
|
fill: theme?.palette?.editor?.closeButtonSvgStroke
|
287
287
|
},
|
288
|
-
|
289
|
-
backgroundColor:
|
288
|
+
"&:hover": {
|
289
|
+
backgroundColor: "transparent"
|
290
290
|
}
|
291
291
|
},
|
292
292
|
children: /*#__PURE__*/_jsx(Icon, {
|
@@ -297,9 +297,9 @@ const MultiSelectWithPopover = props => {
|
|
297
297
|
},
|
298
298
|
sx: {
|
299
299
|
backgroundColor: "transparent",
|
300
|
-
fontFamily:
|
300
|
+
fontFamily: "Inter",
|
301
301
|
fontWeight: 400,
|
302
|
-
fontSize:
|
302
|
+
fontSize: "12px"
|
303
303
|
},
|
304
304
|
placeholder: "Create new one..."
|
305
305
|
}),
|
@@ -315,11 +315,11 @@ const MultiSelectWithPopover = props => {
|
|
315
315
|
deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {}),
|
316
316
|
sx: {
|
317
317
|
backgroundColor: option?.color,
|
318
|
-
color:
|
318
|
+
color: "#0F172A",
|
319
319
|
"& .MuiChip-deleteIcon": {
|
320
320
|
flexShrink: 0,
|
321
321
|
"& path": {
|
322
|
-
stroke:
|
322
|
+
stroke: "#0F172A !important"
|
323
323
|
}
|
324
324
|
},
|
325
325
|
"&:hover": {
|
@@ -329,13 +329,13 @@ const MultiSelectWithPopover = props => {
|
|
329
329
|
}, index))
|
330
330
|
}), /*#__PURE__*/_jsx(Divider, {
|
331
331
|
sx: {
|
332
|
-
mt:
|
332
|
+
mt: "12px",
|
333
333
|
borderBottom: `1px solid ${theme?.palette?.editor?.popUpBorderColor}`,
|
334
334
|
boxShadow: theme?.palette?.editor?.dividerDropShadow
|
335
335
|
}
|
336
336
|
}), /*#__PURE__*/_jsx(Box, {
|
337
337
|
sx: {
|
338
|
-
pl:
|
338
|
+
pl: "4px"
|
339
339
|
},
|
340
340
|
children: /*#__PURE__*/_jsxs(List, {
|
341
341
|
sx: {
|
@@ -346,11 +346,11 @@ const MultiSelectWithPopover = props => {
|
|
346
346
|
children: [/*#__PURE__*/_jsx(Typography, {
|
347
347
|
sx: {
|
348
348
|
mb: 1,
|
349
|
-
pl:
|
349
|
+
pl: "8px",
|
350
350
|
color: theme?.palette?.editor?.secondaryTextColor,
|
351
|
-
fontFamily:
|
351
|
+
fontFamily: "Inter",
|
352
352
|
fontWeight: 400,
|
353
|
-
fontSize:
|
353
|
+
fontSize: "12px"
|
354
354
|
},
|
355
355
|
children: "Choose an option or create one"
|
356
356
|
}), filteredOptions?.map((option, index) => /*#__PURE__*/_jsx(ListItem, {
|
@@ -363,19 +363,19 @@ const MultiSelectWithPopover = props => {
|
|
363
363
|
sx: {
|
364
364
|
paddingTop: "4px",
|
365
365
|
paddingBottom: "4px",
|
366
|
-
justifyContent:
|
367
|
-
|
368
|
-
|
366
|
+
justifyContent: "space-between",
|
367
|
+
"&:hover": {
|
368
|
+
"& path": {
|
369
369
|
stroke: theme?.palette?.editor?.activeColor
|
370
370
|
},
|
371
|
-
borderRadius:
|
371
|
+
borderRadius: "12px"
|
372
372
|
}
|
373
373
|
},
|
374
374
|
children: [/*#__PURE__*/_jsx(Chip, {
|
375
375
|
label: option?.value,
|
376
376
|
sx: {
|
377
377
|
backgroundColor: option?.color,
|
378
|
-
color:
|
378
|
+
color: "#0F172A",
|
379
379
|
fontWeight: 500,
|
380
380
|
fontSize: "12px",
|
381
381
|
fontFamily: "Inter",
|
@@ -389,11 +389,11 @@ const MultiSelectWithPopover = props => {
|
|
389
389
|
}), /*#__PURE__*/_jsx(IconButton, {
|
390
390
|
size: "small",
|
391
391
|
sx: {
|
392
|
-
|
392
|
+
"& path": {
|
393
393
|
stroke: theme?.palette?.editor?.closeButtonSvgStroke
|
394
394
|
},
|
395
|
-
|
396
|
-
backgroundColor:
|
395
|
+
"&:hover": {
|
396
|
+
backgroundColor: "transparent"
|
397
397
|
}
|
398
398
|
},
|
399
399
|
onClick: e => handleEditOption(e, index),
|
@@ -422,7 +422,7 @@ const MultiSelectWithPopover = props => {
|
|
422
422
|
label: `${inputValue}`,
|
423
423
|
sx: {
|
424
424
|
backgroundColor: chipColor,
|
425
|
-
color:
|
425
|
+
color: "#0F172A",
|
426
426
|
fontWeight: 500,
|
427
427
|
fontSize: "12px",
|
428
428
|
fontFamily: "Inter",
|
@@ -13,13 +13,13 @@ const MultiSelectType = props => {
|
|
13
13
|
settings,
|
14
14
|
translation
|
15
15
|
} = props;
|
16
|
-
const {
|
17
|
-
wrapColumn
|
18
|
-
} = settings;
|
19
16
|
const {
|
20
17
|
onChange,
|
21
18
|
onUpdateProperty
|
22
19
|
} = useDataView();
|
20
|
+
const {
|
21
|
+
wrapColumn
|
22
|
+
} = settings;
|
23
23
|
const value = Array.isArray(pValue) ? pValue : [];
|
24
24
|
const coloredValues = [...(value || [])]?.map(m => {
|
25
25
|
return {
|
@@ -34,11 +34,11 @@ const MultiSelectType = props => {
|
|
34
34
|
};
|
35
35
|
const handleUpdate = data => {
|
36
36
|
const updateData = {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
label: "Multi Select",
|
38
|
+
visible: true,
|
39
|
+
key: property,
|
40
|
+
type: "multi-select",
|
41
|
+
options: data
|
42
42
|
};
|
43
43
|
onUpdateProperty(updateData);
|
44
44
|
};
|
@@ -4,7 +4,6 @@ import { Node } from "slate";
|
|
4
4
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
5
5
|
import { IconButton, Tooltip, Grid, Menu, MenuItem, CircularProgress, Box, Typography, useTheme } from "@mui/material";
|
6
6
|
import DeleteIcon from "@mui/icons-material/Delete";
|
7
|
-
import BackupIcon from "@mui/icons-material/Backup";
|
8
7
|
import { GridSettingsIcon, GridAddSectionIcon, WorkflowIcon } from "../../common/iconslist";
|
9
8
|
import FormPopup from "./FormPopup";
|
10
9
|
import ButtonPopup from "../Button/ButtonPopup";
|
@@ -207,7 +206,7 @@ const Form = props => {
|
|
207
206
|
}, {
|
208
207
|
at: path
|
209
208
|
});
|
210
|
-
// adding form field style to the current form node
|
209
|
+
// adding form field style to the current form node
|
211
210
|
const currentNode = Node.get(editor, path);
|
212
211
|
if (currentNode) {
|
213
212
|
currentNode.children.forEach((item, index) => {
|
@@ -415,7 +414,6 @@ const Form = props => {
|
|
415
414
|
lineHeight: 1.43,
|
416
415
|
...formSX
|
417
416
|
},
|
418
|
-
ref: formEle,
|
419
417
|
children: [/*#__PURE__*/_jsx(Grid, {
|
420
418
|
className: "form-grid",
|
421
419
|
item: true,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useState, useEffect, useMemo } from "react";
|
2
|
-
import { Editor, Path, Transforms } from "slate";
|
2
|
+
import { Editor, Path, Range, Transforms } from "slate";
|
3
3
|
import { Box, IconButton } from "@mui/material";
|
4
4
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
5
5
|
import useTableResize from "../../utils/customHooks/useTableResize";
|
@@ -150,8 +150,12 @@ const TableCell = props => {
|
|
150
150
|
const isFirstRow = row === 0;
|
151
151
|
const isFirstColumn = column === 0;
|
152
152
|
const [hoverRow, hoverCol] = hoverPath ? hoverPath.slice(-2) : [];
|
153
|
-
const
|
154
|
-
|
153
|
+
const {
|
154
|
+
selection
|
155
|
+
} = editor;
|
156
|
+
const isHavingSelection = selection && !Range.isCollapsed(selection);
|
157
|
+
const showColDrag = isFirstRow && hoverCol === column && !resizing && !readOnly && !hideTools.includes("drag") && !isHavingSelection;
|
158
|
+
const showRowDrag = isFirstColumn && hoverRow === row && !resizing && !readOnly && !hideTools.includes("drag") && !isHavingSelection;
|
155
159
|
const [parentProps] = tableNode || [{}];
|
156
160
|
const [rowProps] = rowNode || [{}];
|
157
161
|
const tableDOM = table.getDOMNode(path, true);
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { Checkbox as Core, FormControlLabel, IconButton, Typography } from "@mui/material";
|
2
|
+
import CheckboxStyles from "./styles";
|
3
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
4
|
+
import { CheckedBoxCheckIcon } from "../iconListV2";
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
+
function Checkbox(props) {
|
7
|
+
const {
|
8
|
+
value,
|
9
|
+
onChange,
|
10
|
+
label,
|
11
|
+
labelProps,
|
12
|
+
checkboxProps,
|
13
|
+
...rest
|
14
|
+
} = props;
|
15
|
+
const {
|
16
|
+
theme
|
17
|
+
} = useEditorContext();
|
18
|
+
const classes = CheckboxStyles(theme);
|
19
|
+
return /*#__PURE__*/_jsx(FormControlLabel, {
|
20
|
+
className: "ccheckbox-primary",
|
21
|
+
sx: {
|
22
|
+
...classes.customCheckBox
|
23
|
+
},
|
24
|
+
control: /*#__PURE__*/_jsx(Core, {
|
25
|
+
value: value,
|
26
|
+
checked: value,
|
27
|
+
onChange: onChange,
|
28
|
+
checkedIcon: /*#__PURE__*/_jsx(IconButton, {
|
29
|
+
className: "checkedIcon",
|
30
|
+
children: /*#__PURE__*/_jsx(CheckedBoxCheckIcon, {})
|
31
|
+
}),
|
32
|
+
icon: /*#__PURE__*/_jsx(IconButton, {
|
33
|
+
className: "unCheckedIcon"
|
34
|
+
}),
|
35
|
+
...(checkboxProps || {})
|
36
|
+
}),
|
37
|
+
label: /*#__PURE__*/_jsx(Typography, {
|
38
|
+
variant: "body1",
|
39
|
+
sx: classes.label,
|
40
|
+
...(labelProps || {}),
|
41
|
+
children: label
|
42
|
+
}),
|
43
|
+
...rest
|
44
|
+
});
|
45
|
+
}
|
46
|
+
export default Checkbox;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
const SelectStyles = (theme = {}) => {
|
2
|
+
const {
|
3
|
+
buttonBorder3,
|
4
|
+
checkedIconBg,
|
5
|
+
tv_text
|
6
|
+
} = theme?.palette?.editor || {};
|
7
|
+
return {
|
8
|
+
customCheckBox: {
|
9
|
+
padding: "0px",
|
10
|
+
marginTop: "8px",
|
11
|
+
"& .MuiCheckbox-root": {
|
12
|
+
padding: "8px 8px 8px 10px",
|
13
|
+
"&:hover": {
|
14
|
+
background: "unset !important"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"& button": {
|
18
|
+
width: "18px !important",
|
19
|
+
height: "18px !important",
|
20
|
+
borderRadius: "3px",
|
21
|
+
border: `1px solid ${buttonBorder3}`,
|
22
|
+
"& svg": {
|
23
|
+
width: "14px",
|
24
|
+
height: "14px"
|
25
|
+
}
|
26
|
+
},
|
27
|
+
"& .checkedIcon": {
|
28
|
+
background: "#2563EB",
|
29
|
+
borderColor: "#2563EB",
|
30
|
+
padding: "0px"
|
31
|
+
},
|
32
|
+
"& .unCheckedIcon": {
|
33
|
+
background: checkedIconBg
|
34
|
+
},
|
35
|
+
"& p": {
|
36
|
+
margin: "0px !important"
|
37
|
+
}
|
38
|
+
},
|
39
|
+
label: {
|
40
|
+
fontSize: "14px",
|
41
|
+
color: `${tv_text} !important`
|
42
|
+
}
|
43
|
+
};
|
44
|
+
};
|
45
|
+
export default SelectStyles;
|