@flozy/editor 1.1.1 → 1.1.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 (92) hide show
  1. package/dist/Editor/CollaborativeEditor.js +7 -2
  2. package/dist/Editor/CommonEditor.js +59 -37
  3. package/dist/Editor/Editor.css +209 -12
  4. package/dist/Editor/Elements/Accordion/Accordion.js +100 -0
  5. package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +20 -0
  6. package/dist/Editor/Elements/Accordion/AccordionButton.js +22 -0
  7. package/dist/Editor/Elements/Accordion/AccordionDetails.js +18 -0
  8. package/dist/Editor/Elements/Accordion/AccordionSummary.js +69 -0
  9. package/dist/Editor/Elements/Accordion/AccordionTitlePopup.js +20 -0
  10. package/dist/Editor/Elements/Button/ButtonPopup.js +20 -0
  11. package/dist/Editor/Elements/Button/ButtonToolIcon.js +19 -0
  12. package/dist/Editor/Elements/Button/EditorButton.js +124 -0
  13. package/dist/Editor/Elements/Carousel/Arrows.js +39 -0
  14. package/dist/Editor/Elements/Carousel/Carousel.js +82 -0
  15. package/dist/Editor/Elements/Carousel/CarouselButton.js +19 -0
  16. package/dist/Editor/Elements/Carousel/CarouselItem.js +13 -0
  17. package/dist/Editor/Elements/Carousel/slick-theme.min.css +143 -0
  18. package/dist/Editor/Elements/Carousel/slick.min.css +83 -0
  19. package/dist/Editor/Elements/Color Picker/ColorPicker.js +1 -1
  20. package/dist/Editor/Elements/Embed/Embed.css +22 -2
  21. package/dist/Editor/Elements/Embed/Embed.js +89 -74
  22. package/dist/Editor/Elements/Embed/EmbedPopup.js +23 -0
  23. package/dist/Editor/Elements/Embed/Image.js +92 -10
  24. package/dist/Editor/Elements/Embed/Video.js +31 -5
  25. package/dist/Editor/Elements/Equation/EquationButton.js +12 -12
  26. package/dist/Editor/Elements/Grid/Grid.js +64 -8
  27. package/dist/Editor/Elements/Grid/GridButton.js +2 -4
  28. package/dist/Editor/Elements/Grid/GridItem.js +59 -5
  29. package/dist/Editor/Elements/Grid/GridItemPopup.js +20 -0
  30. package/dist/Editor/Elements/Grid/GridPopup.js +22 -0
  31. package/dist/Editor/Elements/ID/Id.js +1 -1
  32. package/dist/Editor/Elements/ImageText/ImageText.js +14 -0
  33. package/dist/Editor/Elements/ImageText/ImageTextWrapper.js +14 -0
  34. package/dist/Editor/Elements/Link/LinkButton.js +1 -1
  35. package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -1
  36. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +88 -0
  37. package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +22 -0
  38. package/dist/Editor/Elements/Signature/Signature.js +50 -0
  39. package/dist/Editor/Elements/Signature/SignatureButton.js +19 -0
  40. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +39 -0
  41. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +84 -0
  42. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +50 -0
  43. package/dist/Editor/Elements/Signature/SignatureOptions/index.js +5 -0
  44. package/dist/Editor/Elements/Signature/SignaturePopup.js +243 -0
  45. package/dist/Editor/Elements/Signature/Signed.js +80 -0
  46. package/dist/Editor/Elements/Table/DeleteCellIcon.js +24 -0
  47. package/dist/Editor/Elements/Table/DeleteRowIcon.js +24 -0
  48. package/dist/Editor/Elements/Table/Table.js +9 -1
  49. package/dist/Editor/Elements/Table/TableCell.js +181 -0
  50. package/dist/Editor/Elements/Table/TablePopup.js +22 -0
  51. package/dist/Editor/Elements/Table/TableRow.js +31 -0
  52. package/dist/Editor/Elements/Table/TableSelector.js +62 -68
  53. package/dist/Editor/Toolbar/Toolbar.js +47 -10
  54. package/dist/Editor/Toolbar/styles.css +20 -11
  55. package/dist/Editor/Toolbar/toolbarGroups.js +17 -19
  56. package/dist/Editor/common/Button.js +4 -8
  57. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +23 -0
  58. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +35 -0
  59. package/dist/Editor/common/StyleBuilder/buttonStyle.js +47 -0
  60. package/dist/Editor/common/StyleBuilder/embedImageStyle.js +63 -0
  61. package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +88 -0
  62. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +87 -0
  63. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +136 -0
  64. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +126 -0
  65. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +89 -0
  66. package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +110 -0
  67. package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +42 -0
  68. package/dist/Editor/common/StyleBuilder/fieldTypes/imageTexts.js +75 -0
  69. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +21 -0
  70. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +46 -0
  71. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +51 -0
  72. package/dist/Editor/common/StyleBuilder/gridStyle.js +51 -0
  73. package/dist/Editor/common/StyleBuilder/index.js +114 -0
  74. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +10 -0
  75. package/dist/Editor/common/StyleBuilder/tableStyle.js +38 -0
  76. package/dist/Editor/common/Uploader.js +87 -0
  77. package/dist/Editor/plugins/withEmbeds.js +12 -5
  78. package/dist/Editor/plugins/withTable.js +5 -4
  79. package/dist/Editor/service/fileupload.js +17 -0
  80. package/dist/Editor/utils/SlateUtilityFunctions.js +72 -23
  81. package/dist/Editor/utils/accordion.js +25 -0
  82. package/dist/Editor/utils/button.js +11 -0
  83. package/dist/Editor/utils/carousel.js +13 -0
  84. package/dist/Editor/utils/carouselItem.js +19 -0
  85. package/dist/Editor/utils/customHooks/useContextMenu.js +8 -8
  86. package/dist/Editor/utils/customHooks/useResize.js +1 -1
  87. package/dist/Editor/utils/font.js +59 -0
  88. package/dist/Editor/utils/helper.js +32 -0
  89. package/dist/Editor/utils/imageText.js +19 -0
  90. package/dist/Editor/utils/signature.js +23 -0
  91. package/dist/Editor/utils/table.js +172 -0
  92. package/package.json +11 -3
@@ -1,6 +1,7 @@
1
- import React from "react";
1
+ import React, { useState } from "react";
2
2
  import { Transforms, Element } from "slate";
3
- import { useSelected, useSlateStatic } from "slate-react";
3
+ import { useSelected, useSlateStatic, ReactEditor } from "slate-react";
4
+ import GridItemPopup from "./GridItemPopup";
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
6
7
  const GridItem = props => {
@@ -9,12 +10,27 @@ const GridItem = props => {
9
10
  children,
10
11
  element
11
12
  } = props;
13
+ const [openSetttings, setOpenSettings] = useState(false);
12
14
  const {
13
- grid
15
+ grid,
16
+ bannerSpacing,
17
+ bgColor,
18
+ alignment
14
19
  } = element;
20
+ const {
21
+ left,
22
+ top,
23
+ right,
24
+ bottom
25
+ } = bannerSpacing || {};
26
+ const {
27
+ vertical,
28
+ horizantal
29
+ } = alignment || {};
15
30
  const editor = useSlateStatic();
16
31
  const selected = useSelected();
17
32
  const itemWidth = (grid || 6) / 12 * 100;
33
+ const path = ReactEditor.findPath(editor, element);
18
34
  const onItemSizeDecrease = () => {
19
35
  Transforms.setNodes(editor, {
20
36
  grid: grid <= 1 ? 1 : grid - 1
@@ -37,7 +53,13 @@ const GridItem = props => {
37
53
  return selected ? /*#__PURE__*/_jsxs("div", {
38
54
  contentEditable: false,
39
55
  className: "grid-item-toolbar",
56
+ style: {
57
+ top: "0px"
58
+ },
40
59
  children: [/*#__PURE__*/_jsx("button", {
60
+ onClick: onSettings,
61
+ children: "Settings"
62
+ }), /*#__PURE__*/_jsx("button", {
41
63
  onClick: onItemSizeDecrease,
42
64
  children: "-"
43
65
  }), /*#__PURE__*/_jsx("button", {
@@ -46,13 +68,45 @@ const GridItem = props => {
46
68
  })]
47
69
  }) : null;
48
70
  };
71
+ const onSettings = () => {
72
+ setOpenSettings(true);
73
+ };
74
+ const onSave = data => {
75
+ const updateData = {
76
+ ...data
77
+ };
78
+ delete updateData.children;
79
+ Transforms.setNodes(editor, {
80
+ ...updateData
81
+ }, {
82
+ at: path
83
+ });
84
+ onClose();
85
+ };
86
+ const onClose = () => {
87
+ setOpenSettings(false);
88
+ };
49
89
  return /*#__PURE__*/_jsxs("div", {
50
90
  className: `grid-item xs-${grid}`,
51
91
  ...attributes,
52
92
  style: {
53
- width: `${itemWidth}%`
93
+ display: "flex",
94
+ flexDirection: "column",
95
+ paddingLeft: `${left}px`,
96
+ paddingRight: `${right}px`,
97
+ paddingTop: `${top}px`,
98
+ paddingBottom: `${bottom}px`,
99
+ backgroundColor: bgColor,
100
+ alignItems: horizantal,
101
+ alignContent: vertical,
102
+ width: `${itemWidth}%`,
103
+ margin: "0px"
54
104
  },
55
- children: [children, /*#__PURE__*/_jsx(GridItemToolbar, {})]
105
+ children: [children, /*#__PURE__*/_jsx(GridItemToolbar, {}), openSetttings ? /*#__PURE__*/_jsx(GridItemPopup, {
106
+ element: element,
107
+ onSave: onSave,
108
+ onClose: onClose
109
+ }) : null]
56
110
  });
57
111
  };
58
112
  export default GridItem;
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import StyleBuilder from "../../common/StyleBuilder";
3
+ import gridItemStyle from "../../common/StyleBuilder/gridItemStyle";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const GridItemPopup = props => {
6
+ const {
7
+ element,
8
+ onSave,
9
+ onClose
10
+ } = props;
11
+ return /*#__PURE__*/_jsx(StyleBuilder, {
12
+ title: "Grid Item",
13
+ type: "gridItemStyle",
14
+ element: element,
15
+ onSave: onSave,
16
+ onClose: onClose,
17
+ renderTabs: gridItemStyle
18
+ });
19
+ };
20
+ export default GridItemPopup;
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import StyleBuilder from "../../common/StyleBuilder";
3
+ import gridStyle from "../../common/StyleBuilder/gridStyle";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const GridPopup = props => {
6
+ const {
7
+ element,
8
+ onSave,
9
+ onClose,
10
+ customProps
11
+ } = props;
12
+ return /*#__PURE__*/_jsx(StyleBuilder, {
13
+ title: "Grid",
14
+ type: "gridStyle",
15
+ element: element,
16
+ onSave: onSave,
17
+ onClose: onClose,
18
+ renderTabs: gridStyle,
19
+ customProps: customProps
20
+ });
21
+ };
22
+ export default GridPopup;
@@ -30,7 +30,7 @@ const Id = ({
30
30
  setId("");
31
31
  };
32
32
  return /*#__PURE__*/_jsxs("div", {
33
- className: "popup-wrapper",
33
+ className: "popup-wrapper1",
34
34
  ref: idInputRef,
35
35
  children: [/*#__PURE__*/_jsx(Button, {
36
36
  className: showInput ? "clicked" : "",
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ const ImageText = props => {
4
+ const {
5
+ attributes,
6
+ children
7
+ } = props;
8
+ return /*#__PURE__*/_jsx("div", {
9
+ className: "image-text",
10
+ ...attributes,
11
+ children: children
12
+ });
13
+ };
14
+ export default ImageText;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ const ImageTextWrapper = props => {
4
+ const {
5
+ attributes,
6
+ children
7
+ } = props;
8
+ return /*#__PURE__*/_jsx("div", {
9
+ ...attributes,
10
+ className: "image-text-wrapper",
11
+ children: children
12
+ });
13
+ };
14
+ export default ImageTextWrapper;
@@ -41,7 +41,7 @@ const LinkButton = props => {
41
41
  };
42
42
  return /*#__PURE__*/_jsxs("div", {
43
43
  ref: linkInputRef,
44
- className: "popup-wrapper",
44
+ className: "popup-wrapper1",
45
45
  children: [/*#__PURE__*/_jsx(Button, {
46
46
  className: showInput ? "clicked" : "",
47
47
  active: isBlockActive(editor, "link"),
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { IconButton } from "@mui/material";
2
3
  import KeyboardReturnIcon from "@mui/icons-material/KeyboardReturn";
3
4
  import { Transforms } from "slate";
4
5
  import { useSlateStatic } from "slate-react";
@@ -15,7 +16,7 @@ const NewLineButton = props => {
15
16
  at: [editor.children.length]
16
17
  });
17
18
  };
18
- return /*#__PURE__*/_jsx("button", {
19
+ return /*#__PURE__*/_jsx(IconButton, {
19
20
  title: "New Line",
20
21
  onClick: onAddNewLine,
21
22
  children: /*#__PURE__*/_jsx(KeyboardReturnIcon, {})
@@ -0,0 +1,88 @@
1
+ import React, { useState } from "react";
2
+ import { Transforms, Editor, Element } from "slate";
3
+ import { IconButton } from "@mui/material";
4
+ import ArticleIcon from "@mui/icons-material/Article";
5
+ import { useSlateStatic, ReactEditor } from "slate-react";
6
+ import PageSettingsPopup from "./PageSettingsPopup";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ const PageSettingsButton = props => {
10
+ const {
11
+ customProps
12
+ } = props;
13
+ const [openSetttings, setOpenSettings] = useState(false);
14
+ const [pageProps, setPageProps] = useState({});
15
+ const editor = useSlateStatic();
16
+ const onSettings = () => {
17
+ const {
18
+ element
19
+ } = getPageSettingsPath();
20
+ if (element) {
21
+ setPageProps(element?.pageProps || {});
22
+ setOpenSettings(true);
23
+ }
24
+ };
25
+ const getPageSettingsPath = () => {
26
+ try {
27
+ const [pageSettingsNode] = Editor.nodes(editor, {
28
+ at: [],
29
+ match: n => {
30
+ return !Editor.isEditor(n) && Element.isElement(n) && n.type === "page-settings";
31
+ }
32
+ });
33
+ const path = ReactEditor.findPath(editor, pageSettingsNode[0]);
34
+ return {
35
+ path,
36
+ element: pageSettingsNode[0]
37
+ };
38
+ } catch (err) {
39
+ console.log(err);
40
+ return {
41
+ path: null
42
+ };
43
+ }
44
+ };
45
+ const onSave = data => {
46
+ const {
47
+ path
48
+ } = getPageSettingsPath();
49
+ const updateData = {
50
+ ...data
51
+ };
52
+ delete updateData.children;
53
+ if (path) {
54
+ Transforms.setNodes(editor, {
55
+ pageProps: {
56
+ ...updateData
57
+ }
58
+ }, {
59
+ at: path
60
+ });
61
+ } else {
62
+ Transforms.insertNodes(editor, [{
63
+ type: "page-settings",
64
+ pageProps: {
65
+ ...updateData
66
+ },
67
+ children: [{
68
+ text: ""
69
+ }]
70
+ }]);
71
+ }
72
+ onClose();
73
+ };
74
+ const onClose = () => {
75
+ setOpenSettings(false);
76
+ };
77
+ return /*#__PURE__*/_jsxs(IconButton, {
78
+ title: "Page Settings",
79
+ onClick: onSettings,
80
+ children: [/*#__PURE__*/_jsx(ArticleIcon, {}), openSetttings ? /*#__PURE__*/_jsx(PageSettingsPopup, {
81
+ element: pageProps,
82
+ onSave: onSave,
83
+ onClose: onClose,
84
+ customProps: customProps
85
+ }) : null]
86
+ });
87
+ };
88
+ export default PageSettingsButton;
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import StyleBuilder from "../../common/StyleBuilder";
3
+ import pageSettingsStyle from "../../common/StyleBuilder/pageSettingsStyle";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const PageSettingsPopup = props => {
6
+ const {
7
+ element,
8
+ onSave,
9
+ onClose,
10
+ customProps
11
+ } = props;
12
+ return /*#__PURE__*/_jsx(StyleBuilder, {
13
+ title: "Grid",
14
+ type: "pageSettingsStyle",
15
+ element: element,
16
+ onSave: onSave,
17
+ onClose: onClose,
18
+ renderTabs: pageSettingsStyle,
19
+ customProps: customProps
20
+ });
21
+ };
22
+ export default PageSettingsPopup;
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+ import { Transforms } from "slate";
3
+ import { useSlateStatic, ReactEditor } from "slate-react";
4
+ import SignaturePopup from "./SignaturePopup";
5
+ import { formatDate } from "../../utils/helper";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ const Signature = props => {
9
+ const {
10
+ attributes,
11
+ children,
12
+ element,
13
+ customProps
14
+ } = props;
15
+ const editor = useSlateStatic();
16
+ const isSigned = element?.children[0]?.type === "sign";
17
+ const path = ReactEditor.findPath(editor, element);
18
+ const onSave = (data = {}) => {
19
+ onClear();
20
+ Transforms.insertNodes(editor, [{
21
+ type: "sign",
22
+ signature: null,
23
+ fontFamily: "",
24
+ signedBy: "",
25
+ signedOn: formatDate(new Date(), "MM/DD/YYYY"),
26
+ signedText: "",
27
+ children: [{
28
+ text: ""
29
+ }],
30
+ ...data
31
+ }], {
32
+ at: [...path, 0]
33
+ });
34
+ };
35
+ const onClear = () => {
36
+ Transforms.removeNodes(editor, {
37
+ at: [...path, 0]
38
+ });
39
+ };
40
+ return /*#__PURE__*/_jsxs("div", {
41
+ className: `signature-container`,
42
+ ...attributes,
43
+ children: [!isSigned ? /*#__PURE__*/_jsx(SignaturePopup, {
44
+ customProps: customProps,
45
+ onSave: onSave,
46
+ onClear: onClear
47
+ }) : null, children]
48
+ });
49
+ };
50
+ export default Signature;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { IconButton } from "@mui/material";
3
+ import DrawIcon from "@mui/icons-material/Draw";
4
+ import { insertSignature } from "../../utils/signature";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const SignatureButton = props => {
7
+ const {
8
+ editor
9
+ } = props;
10
+ const handleInsertSignature = () => {
11
+ insertSignature(editor);
12
+ };
13
+ return /*#__PURE__*/_jsx(IconButton, {
14
+ onClick: handleInsertSignature,
15
+ title: "Signature",
16
+ children: /*#__PURE__*/_jsx(DrawIcon, {})
17
+ });
18
+ };
19
+ export default SignatureButton;
@@ -0,0 +1,39 @@
1
+ import React, { useRef } from "react";
2
+ import SignatureCanvas from "react-signature-canvas";
3
+ import { Grid } from "@mui/material";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const DrawSignature = props => {
6
+ let canvasRef = useRef();
7
+ const {
8
+ onDataChange,
9
+ customProps: {
10
+ brush
11
+ }
12
+ } = props;
13
+ const onSigned = () => {
14
+ onDataChange({
15
+ signature: canvasRef.toDataURL()
16
+ });
17
+ };
18
+ return /*#__PURE__*/_jsx(Grid, {
19
+ container: true,
20
+ children: /*#__PURE__*/_jsx(Grid, {
21
+ item: true,
22
+ xs: 12,
23
+ style: {
24
+ width: "100%",
25
+ height: "209px"
26
+ },
27
+ children: /*#__PURE__*/_jsx(SignatureCanvas, {
28
+ canvasProps: {
29
+ className: "signature-canvas"
30
+ },
31
+ onEnd: onSigned,
32
+ ref: ref => canvasRef = ref,
33
+ maxWidth: brush.size || 2,
34
+ penColor: brush?.color || "#000"
35
+ })
36
+ })
37
+ });
38
+ };
39
+ export default DrawSignature;
@@ -0,0 +1,84 @@
1
+ import React, { useState } from "react";
2
+ import { signedTextFonts } from "../../../utils/font";
3
+ import { Grid, Button, TextField, InputAdornment, IconButton } from "@mui/material";
4
+ import ClearIcon from "@mui/icons-material/Clear";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ const TypeSignature = props => {
8
+ const {
9
+ onDataChange
10
+ } = props;
11
+ const [name, setName] = useState("");
12
+ const [fontFamily, setFontFamily] = useState("");
13
+ const onChange = e => {
14
+ setName(e.target.value);
15
+ onDataChange({
16
+ signedText: e.target.value,
17
+ signature: ""
18
+ });
19
+ };
20
+ const onFontFamilyChange = val => () => {
21
+ setFontFamily(val);
22
+ onDataChange({
23
+ fontFamily: val
24
+ });
25
+ };
26
+ const renderFontFamily = () => {
27
+ return signedTextFonts.map((m, i) => {
28
+ return /*#__PURE__*/_jsx(Grid, {
29
+ item: true,
30
+ padding: 1,
31
+ xs: 4,
32
+ style: {
33
+ textAlign: "center"
34
+ },
35
+ children: /*#__PURE__*/_jsx(Button, {
36
+ style: {
37
+ fontFamily: m.text
38
+ },
39
+ fullWidth: true,
40
+ onClick: onFontFamilyChange(m.value),
41
+ className: m.value === fontFamily ? "active" : "",
42
+ children: name || "Signature"
43
+ })
44
+ }, `typesign-ff-${m.value}`);
45
+ });
46
+ };
47
+ return /*#__PURE__*/_jsxs("div", {
48
+ className: "signature-tab-1-wrapper",
49
+ children: [/*#__PURE__*/_jsx("div", {
50
+ className: "typesignature-input-wrapper",
51
+ children: /*#__PURE__*/_jsx(Grid, {
52
+ container: true,
53
+ children: /*#__PURE__*/_jsx(Grid, {
54
+ item: true,
55
+ padding: 1,
56
+ xs: 12,
57
+ style: {
58
+ textAlign: "center"
59
+ },
60
+ children: /*#__PURE__*/_jsx(TextField, {
61
+ value: name,
62
+ onChange: onChange,
63
+ size: "small",
64
+ fullWidth: true,
65
+ InputProps: {
66
+ endAdornment: /*#__PURE__*/_jsx(InputAdornment, {
67
+ position: "end",
68
+ children: /*#__PURE__*/_jsx(IconButton, {
69
+ onClick: () => setName(""),
70
+ children: /*#__PURE__*/_jsx(ClearIcon, {})
71
+ })
72
+ })
73
+ }
74
+ })
75
+ })
76
+ })
77
+ }), /*#__PURE__*/_jsx(Grid, {
78
+ container: true,
79
+ className: "typesignature-fontfamily",
80
+ children: renderFontFamily()
81
+ })]
82
+ });
83
+ };
84
+ export default TypeSignature;
@@ -0,0 +1,50 @@
1
+ import React, { useState } from "react";
2
+ import { convertBase64 } from "../../../utils/helper";
3
+ import { uploadFile } from "../../../service/fileupload";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ const UploadSignature = props => {
7
+ const {
8
+ customProps,
9
+ onUploadDone
10
+ } = props;
11
+ const [base64, setBase64] = useState(null);
12
+ const [uploading, setUploading] = useState(false);
13
+ console.log(customProps);
14
+ const onChange = async e => {
15
+ const file = e.target.files[0];
16
+ const strImage = await convertBase64(file);
17
+ setBase64(strImage);
18
+ doUpload(strImage);
19
+ };
20
+ const doUpload = async strImage => {
21
+ setUploading(true);
22
+ const result = await uploadFile({
23
+ image: strImage
24
+ }, customProps);
25
+ setUploading(false);
26
+ if (result && result?.imageURL) {
27
+ onUploadDone({
28
+ signature: result?.imageURL
29
+ });
30
+ }
31
+ };
32
+ return /*#__PURE__*/_jsxs("div", {
33
+ className: "signature-tab",
34
+ children: [uploading ? "Uploading..." : "", base64 ? /*#__PURE__*/_jsx("div", {
35
+ className: "upload-sign-img-wrapper",
36
+ children: /*#__PURE__*/_jsx("img", {
37
+ className: "upload-sign-img",
38
+ src: base64,
39
+ alt: "Signature"
40
+ })
41
+ }) : /*#__PURE__*/_jsx("div", {
42
+ className: "upload-input-wrapper",
43
+ children: /*#__PURE__*/_jsx("input", {
44
+ type: "file",
45
+ onChange: onChange
46
+ })
47
+ })]
48
+ });
49
+ };
50
+ export default UploadSignature;
@@ -0,0 +1,5 @@
1
+ import DrawSignature from "./DrawSignature";
2
+ import TypeSignature from "./TypeSignature";
3
+ import UploadSignature from "./UploadSignature";
4
+ const SignatureOptions = [DrawSignature, TypeSignature, UploadSignature];
5
+ export default SignatureOptions;