@zohoim/chat-components 1.0.11 → 1.1.0-beta.2

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 (133) hide show
  1. package/README.md +8 -0
  2. package/es/AttachmentHandler/AttachmentHandler.js +84 -0
  3. package/es/AttachmentHandler/css/AttachmentHandler.module.css +27 -0
  4. package/es/AttachmentHandler/index.js +1 -0
  5. package/es/AttachmentHandler/props/defaultProps.js +10 -0
  6. package/es/AttachmentHandler/props/propTypes.js +17 -0
  7. package/es/AttachmentPreview/AttachmentPreview.js +121 -0
  8. package/es/AttachmentPreview/css/AttachmentPreview.module.css +39 -0
  9. package/es/AttachmentPreview/index.js +1 -0
  10. package/es/AttachmentPreview/props/defaultProps.js +9 -0
  11. package/es/AttachmentPreview/props/propTypes.js +33 -0
  12. package/es/AttachmentPreviewBody/AttachmentPreviewBody.js +97 -0
  13. package/es/AttachmentPreviewBody/css/AttachmentPreviewBody.module.css +75 -0
  14. package/es/AttachmentPreviewBody/index.js +1 -0
  15. package/es/AttachmentPreviewBody/props/defaultProps.js +7 -0
  16. package/es/AttachmentPreviewBody/props/propTypes.js +20 -0
  17. package/es/AttachmentPreviewHeader/AttachmentPreviewHeader.js +84 -0
  18. package/es/AttachmentPreviewHeader/css/AttachmentPreviewHeader.module.css +47 -0
  19. package/es/AttachmentPreviewHeader/index.js +1 -0
  20. package/es/AttachmentPreviewHeader/props/defaultProps.js +7 -0
  21. package/es/AttachmentPreviewHeader/props/propTypes.js +16 -0
  22. package/es/Emoji/Emoji.js +72 -0
  23. package/es/Emoji/css/Emoji.module.css +48 -0
  24. package/es/Emoji/css/cssJSLogic.js +18 -0
  25. package/es/Emoji/index.js +1 -0
  26. package/es/Emoji/props/defaultProps.js +8 -0
  27. package/es/Emoji/props/propTypes.js +16 -0
  28. package/es/EmojiPopup/EmojiPopup.js +115 -0
  29. package/es/EmojiPopup/css/EmojiPopup.module.css +55 -0
  30. package/es/EmojiPopup/index.js +1 -0
  31. package/es/EmojiPopup/props/defaultProps.js +11 -0
  32. package/es/EmojiPopup/props/propTypes.js +21 -0
  33. package/es/Emojis/Emojis.js +81 -0
  34. package/es/Emojis/index.js +1 -0
  35. package/es/Emojis/props/defaultProps.js +10 -0
  36. package/es/Emojis/props/propTypes.js +20 -0
  37. package/es/EmojisEmptyState/EmojisEmptyState.js +50 -0
  38. package/es/EmojisEmptyState/css/EmojisEmptyState.module.css +18 -0
  39. package/es/EmojisEmptyState/index.js +1 -0
  40. package/es/EmojisEmptyState/props/defaultProps.js +9 -0
  41. package/es/EmojisEmptyState/props/propTypes.js +8 -0
  42. package/es/EmojisFooter/EmojisFooter.js +71 -0
  43. package/es/EmojisFooter/css/EmojisFooter.module.css +40 -0
  44. package/es/EmojisFooter/index.js +1 -0
  45. package/es/EmojisFooter/props/defaultProps.js +7 -0
  46. package/es/EmojisFooter/props/propTypes.js +12 -0
  47. package/es/EmojisHeader/EmojisHeader.js +65 -0
  48. package/es/EmojisHeader/css/EmojisHeader.module.css +36 -0
  49. package/es/EmojisHeader/index.js +1 -0
  50. package/es/EmojisHeader/props/defaultProps.js +8 -0
  51. package/es/EmojisHeader/props/propTypes.js +13 -0
  52. package/es/EmojisList/EmojisList.js +130 -0
  53. package/es/EmojisList/css/EmojisList.module.css +50 -0
  54. package/es/EmojisList/css/cssJSLogic.js +25 -0
  55. package/es/EmojisList/index.js +1 -0
  56. package/es/EmojisList/props/defaultProps.js +10 -0
  57. package/es/EmojisList/props/propTypes.js +20 -0
  58. package/es/MessageActionsMore/MessageActionsMore.js +2 -2
  59. package/es/MessageActionsMore/props/propTypes.js +5 -2
  60. package/es/MessageActionsWrapper/MessageActionsWrapper.js +1 -1
  61. package/es/Theme/ThemeAssets.js +2 -2
  62. package/es/Theme/ThemeWrapper.js +20 -7
  63. package/es/Theme/TooltipWrapper.js +1 -1
  64. package/es/Theme/props/defaultProps.js +2 -1
  65. package/es/Theme/props/propTypes.js +2 -1
  66. package/es/Theme/themeVariables/dark/blueTheme.js +18 -1
  67. package/es/Theme/themeVariables/dark/commonColorVariable.js +20 -1
  68. package/es/Theme/themeVariables/dark/greenTheme.js +18 -1
  69. package/es/Theme/themeVariables/dark/orangeTheme.js +18 -1
  70. package/es/Theme/themeVariables/dark/redTheme.js +18 -1
  71. package/es/Theme/themeVariables/dark/yellowTheme.js +18 -1
  72. package/es/Theme/themeVariables/light/blueTheme.js +22 -1
  73. package/es/Theme/themeVariables/light/commonColorVariable.js +19 -0
  74. package/es/Theme/themeVariables/light/greenTheme.js +18 -1
  75. package/es/Theme/themeVariables/light/orangeTheme.js +18 -1
  76. package/es/Theme/themeVariables/light/redTheme.js +18 -1
  77. package/es/Theme/themeVariables/light/yellowTheme.js +18 -1
  78. package/es/Theme/themeVariables/pureDark/blueTheme.js +18 -1
  79. package/es/Theme/themeVariables/pureDark/commonColorVariable.js +20 -1
  80. package/es/Theme/themeVariables/pureDark/greenTheme.js +18 -1
  81. package/es/Theme/themeVariables/pureDark/orangeTheme.js +18 -1
  82. package/es/Theme/themeVariables/pureDark/redTheme.js +18 -1
  83. package/es/Theme/themeVariables/pureDark/yellowTheme.js +18 -1
  84. package/es/Theme/utils/getThemeConfigurations.js +1 -1
  85. package/es/constants/index.js +8 -1
  86. package/es/constants/propConstants/editorPropConstants.js +3 -0
  87. package/es/constants/propConstants/popupPropConstants.js +2 -0
  88. package/es/im/IMAttachmentHandler/IMAttachmentHandler.js +50 -0
  89. package/es/im/IMAttachmentHandler/index.js +1 -0
  90. package/es/im/IMAttachmentHandler/props/defaultProps.js +10 -0
  91. package/es/im/IMAttachmentHandler/props/propTypes.js +28 -0
  92. package/es/im/ReplyComposer/ReplyComposer.js +153 -0
  93. package/es/im/ReplyComposer/css/ReplyComposer.module.css +10 -0
  94. package/es/im/ReplyComposer/css/cssJSLogic.js +13 -0
  95. package/es/im/ReplyComposer/index.js +1 -0
  96. package/es/im/ReplyComposer/props/defaultProps.js +7 -0
  97. package/es/im/ReplyComposer/props/propTypes.js +60 -0
  98. package/es/im/ReplyComposerFooter/ReplyComposerFooter.js +41 -0
  99. package/es/im/ReplyComposerFooter/css/ReplyComposerFooter.module.css +10 -0
  100. package/es/im/ReplyComposerFooter/index.js +1 -0
  101. package/es/im/ReplyComposerFooter/props/defaultProps.js +8 -0
  102. package/es/im/ReplyComposerFooter/props/propTypes.js +17 -0
  103. package/es/im/ReplyEditor/ReplyEditor.js +103 -0
  104. package/es/im/ReplyEditor/css/ReplyEditor.module.css +50 -0
  105. package/es/im/ReplyEditor/css/cssJSLogic.js +10 -0
  106. package/es/im/ReplyEditor/index.js +1 -0
  107. package/es/im/ReplyEditor/props/defaultProps.js +8 -0
  108. package/es/im/ReplyEditor/props/propTypes.js +27 -0
  109. package/es/im/ReplyEditorExtensions/ReplyEditorExtensions.js +149 -0
  110. package/es/im/ReplyEditorExtensions/css/ReplyEditorExtensions.module.css +5 -0
  111. package/es/im/ReplyEditorExtensions/index.js +1 -0
  112. package/es/im/ReplyEditorExtensions/props/defaultProps.js +6 -0
  113. package/es/im/ReplyEditorExtensions/props/propTypes.js +16 -0
  114. package/es/im/ReplyEditorSuggestions/ReplyEditorSuggestions.js +95 -0
  115. package/es/im/ReplyEditorSuggestions/css/ReplyEditorSuggestions.module.css +8 -0
  116. package/es/im/ReplyEditorSuggestions/index.js +1 -0
  117. package/es/im/ReplyEditorSuggestions/props/defaultProps.js +6 -0
  118. package/es/im/ReplyEditorSuggestions/props/propTypes.js +21 -0
  119. package/es/im/ReplyEditorSuggestionsPopup/ReplyEditorSuggestionsPopup.js +93 -0
  120. package/es/im/ReplyEditorSuggestionsPopup/css/ReplyEditorSuggestionsPopup.module.css +7 -0
  121. package/es/im/ReplyEditorSuggestionsPopup/index.js +1 -0
  122. package/es/im/ReplyEditorSuggestionsPopup/props/defaultProps.js +10 -0
  123. package/es/im/ReplyEditorSuggestionsPopup/props/propTypes.js +21 -0
  124. package/es/im/index.js +8 -1
  125. package/es/index.js +13 -2
  126. package/es/rte/Editor/Editor.js +80 -0
  127. package/es/rte/Editor/css/Editor.module.css +17 -0
  128. package/es/rte/Editor/index.js +1 -0
  129. package/es/rte/Editor/props/defaultProps.js +21 -0
  130. package/es/rte/Editor/props/propTypes.js +52 -0
  131. package/es/rte/index.js +1 -0
  132. package/package.json +7 -7
  133. package/es/Theme/constants/index.js +0 -41
@@ -0,0 +1,28 @@
1
+ /** ** Libraries *** */
2
+ import PropTypes from 'prop-types';
3
+ /** ** Constants *** */
4
+
5
+ import integrationConstants from '@zohoim/chat-components-utils/es/imUtils/constants/integrationConstants';
6
+ const {
7
+ WHATSAPP,
8
+ TELEGRAM,
9
+ INSTAGRAM,
10
+ WECHAT,
11
+ TWILLIO,
12
+ LINE,
13
+ IM_TALK,
14
+ FACEBOOKMESSENGER
15
+ } = integrationConstants;
16
+ const imAttachmentHandlerPropTypes = {
17
+ customStyle: PropTypes.object,
18
+ iconName: PropTypes.string.isRequired,
19
+ iconSize: PropTypes.string,
20
+ iconTitle: PropTypes.string,
21
+ renderCustomIcon: PropTypes.func,
22
+ isMultiAttachment: PropTypes.bool,
23
+ onAttach: PropTypes.func,
24
+ customProps: PropTypes.object,
25
+ attachmentType: PropTypes.oneOf(['image', 'document', 'documentAndImage']),
26
+ integrationService: PropTypes.oneOf([WHATSAPP, TELEGRAM, INSTAGRAM, WECHAT, TWILLIO, LINE, IM_TALK, FACEBOOKMESSENGER])
27
+ };
28
+ export default imAttachmentHandlerPropTypes;
@@ -0,0 +1,153 @@
1
+ /** ** Libraries *** */
2
+ import React, { useMemo } from 'react';
3
+ /** ** Components *** */
4
+
5
+ import { Container } from '@zohodesk/components/es/Layout';
6
+ import ReplyEditor from "../ReplyEditor/ReplyEditor";
7
+ import ReplyComposerFooter from "../ReplyComposerFooter/ReplyComposerFooter";
8
+ import ReplyEditorSuggestions from "../ReplyEditorSuggestions/ReplyEditorSuggestions";
9
+ import AttachmentPreview from "../../AttachmentPreview/AttachmentPreview";
10
+ /** ** Hooks *** */
11
+
12
+ import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
13
+ import useReplyComposer from '@zohoim/chat-components-hooks/es/im/ReplyComposer/useReplyComposer';
14
+ import useReplyComposerSuggestions from '@zohoim/chat-components-hooks/es/im/ReplyComposer/useReplyComposerSuggestions';
15
+ /** ** Constants *** */
16
+
17
+ import { dummyArray, dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
18
+ import replyComposerDefaultProps from "./props/defaultProps";
19
+ import replyComposerPropTypes from "./props/propTypes";
20
+ /** ** Methods *** */
21
+
22
+ import renderHandler from '@zohoim/chat-components-utils/es/common/renderHandler';
23
+ import cssJSLogic from "./css/cssJSLogic";
24
+ /** ** Styles *** */
25
+
26
+ import style from "./css/ReplyComposer.module.css";
27
+ export default function ReplyComposer(props) {
28
+ const {
29
+ customStyle,
30
+ id,
31
+ content,
32
+ EDITORURL,
33
+ placeHolder,
34
+ features,
35
+ formats,
36
+ suggestions,
37
+ isHTMLContent,
38
+ onChange,
39
+ onKeyDown: propOnKeyDown,
40
+ onPaste,
41
+ customProps = dummyObject,
42
+ extensions,
43
+ files = dummyArray,
44
+ filesDescription,
45
+ onChangeFileDescription,
46
+ onFileCancel: propOnFileCancel,
47
+ onFileSubmit: propOnFileSubmit,
48
+ attachmentPreviewTexts,
49
+ renderHeader,
50
+ renderFooter,
51
+ renderStencils,
52
+ getEditorState: propGetEditorState,
53
+ needFooter
54
+ } = props;
55
+ const {
56
+ replyEditorSuggestionsProps = dummyObject,
57
+ replyComposerFooterProps = dummyObject
58
+ } = customProps;
59
+ const {
60
+ features: allFeatures,
61
+ suggestionsMapping,
62
+ suggestionDetails,
63
+ isShowSuggestion,
64
+ getSuggetPopupMethods,
65
+ onHideSuggestions,
66
+ onSuggestPopupKeyDown,
67
+ onSelectSuggestion
68
+ } = useReplyComposerSuggestions({
69
+ features,
70
+ suggestions,
71
+ isHTMLContent
72
+ });
73
+ const {
74
+ getEditorState,
75
+ editor,
76
+ onKeyDown,
77
+ attachmentPreviewCustomProps,
78
+ replyEditorCustomProps,
79
+ onFileCancel,
80
+ onFileSubmit,
81
+ isLoading,
82
+ isLoaded
83
+ } = useReplyComposer({
84
+ onKeyDown: propOnKeyDown,
85
+ isShowSuggestion,
86
+ onSuggestPopupKeyDown,
87
+ EDITORURL,
88
+ onPaste,
89
+ customProps,
90
+ onFileCancel: propOnFileCancel,
91
+ onFileSubmit: propOnFileSubmit,
92
+ getEditorState: propGetEditorState
93
+ });
94
+ /* External customization */
95
+
96
+ const newStyle = useMergeStyle(style, customStyle);
97
+ /* CSS classnames added based on logic */
98
+
99
+ const {
100
+ replEditorWrapperClass
101
+ } = cssJSLogic({
102
+ isLoaded
103
+ }, newStyle);
104
+ const headerElement = useMemo(() => renderHandler(renderHeader)(), [renderHeader]);
105
+ const stencilsElement = useMemo(() => isLoading ? renderHandler(renderStencils)({
106
+ needFooter
107
+ }) : null, [renderStencils, needFooter, isLoading]);
108
+ return /*#__PURE__*/React.createElement(Container, {
109
+ className: newStyle.replyComposer,
110
+ isCover: false
111
+ }, isShowSuggestion ? /*#__PURE__*/React.createElement(ReplyEditorSuggestions, {
112
+ getMethods: getSuggetPopupMethods,
113
+ onClose: onHideSuggestions,
114
+ onSelect: onSelectSuggestion,
115
+ suggestionDetails: suggestionDetails,
116
+ suggestionsMapping: suggestionsMapping,
117
+ ...replyEditorSuggestionsProps
118
+ }) : null, files.length > 0 ? /*#__PURE__*/React.createElement(AttachmentPreview, {
119
+ descriptionDetails: filesDescription,
120
+ files: files,
121
+ isDescriptionNeeded: true,
122
+ needEditImage: false,
123
+ onCancel: onFileCancel,
124
+ onDescriptionChange: onChangeFileDescription,
125
+ onSubmit: onFileSubmit,
126
+ texts: attachmentPreviewTexts,
127
+ ...attachmentPreviewCustomProps
128
+ }) : null, isLoaded ? headerElement : null, stencilsElement || null, /*#__PURE__*/React.createElement("div", {
129
+ className: replEditorWrapperClass
130
+ }, /*#__PURE__*/React.createElement(ReplyEditor, {
131
+ content: content,
132
+ EDITORURL: EDITORURL,
133
+ features: allFeatures,
134
+ formats: formats,
135
+ getEditorState: getEditorState,
136
+ id: id,
137
+ isHTMLContent: isHTMLContent,
138
+ onChange: onChange,
139
+ onKeyDown: onKeyDown,
140
+ onPaste: onPaste,
141
+ placeHolder: placeHolder,
142
+ ...replyEditorCustomProps
143
+ })), needFooter && isLoaded ? /*#__PURE__*/React.createElement(ReplyComposerFooter, {
144
+ editor: editor,
145
+ extensions: extensions,
146
+ isHTMLContent: isHTMLContent,
147
+ renderButtons: renderFooter,
148
+ ...replyComposerFooterProps
149
+ }) : null);
150
+ }
151
+ ReplyComposer.propTypes = replyComposerPropTypes;
152
+ ReplyComposer.defaultProps = replyComposerDefaultProps;
153
+ ReplyComposer.displayName = 'ReplyComposer';
@@ -0,0 +1,10 @@
1
+ /** ** Styles *** */
2
+
3
+ .replyComposer {
4
+ /** ** Use this class for css customisation *** */
5
+ }
6
+
7
+ .hidden {
8
+ visibility: hidden;
9
+ height: 0 ;
10
+ }
@@ -0,0 +1,13 @@
1
+ /** ** Methods *** */
2
+ import { compileClassNames } from '@zohodesk/utils';
3
+ export default function cssJSLogic(props, style) {
4
+ const {
5
+ isLoaded
6
+ } = props;
7
+ const replEditorWrapperClass = compileClassNames({
8
+ [style.hidden]: !isLoaded
9
+ });
10
+ return {
11
+ replEditorWrapperClass
12
+ };
13
+ }
@@ -0,0 +1 @@
1
+ export { default as ReplyComposer } from "./ReplyComposer";
@@ -0,0 +1,7 @@
1
+ /** ** Constants *** */
2
+ import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
3
+ const replyComposerDefaultProps = {
4
+ customStyle: dummyObject,
5
+ needFooter: true
6
+ };
7
+ export default replyComposerDefaultProps;
@@ -0,0 +1,60 @@
1
+ /** ** Libraries *** */
2
+ import PropTypes from 'prop-types';
3
+ /** ** Constants *** */
4
+
5
+ import { features, formats } from "../../../constants/propConstants/editorPropConstants";
6
+ const replyComposerPropTypes = {
7
+ customStyle: PropTypes.object,
8
+ id: PropTypes.string,
9
+ content: PropTypes.string.isRequired,
10
+ EDITORURL: PropTypes.string,
11
+ placeHolder: PropTypes.string,
12
+ features: PropTypes.arrayOf(PropTypes.oneOf(features)),
13
+ formats: PropTypes.arrayOf(PropTypes.oneOf(formats)),
14
+ suggestions: PropTypes.arrayOf(PropTypes.shape({
15
+ allowSpace: PropTypes.bool,
16
+ componentProps: PropTypes.object,
17
+ popupProps: PropTypes.object,
18
+ renderItem: PropTypes.func,
19
+ trigger: PropTypes.string
20
+ })),
21
+ isHTMLContent: PropTypes.bool,
22
+ onChange: PropTypes.func.isRequired,
23
+ onKeyDown: PropTypes.func,
24
+ onPaste: PropTypes.func,
25
+ customProps: PropTypes.shape({
26
+ attachmentPreviewProps: PropTypes.object,
27
+ replyComposerFooterProps: PropTypes.object,
28
+ replyEditorProps: PropTypes.object,
29
+ replyEditorSuggestionsProps: PropTypes.object
30
+ }),
31
+ extensions: PropTypes.shape({
32
+ details: PropTypes.objectOf(PropTypes.shape({
33
+ componentProps: PropTypes.object,
34
+ id: PropTypes.string,
35
+ renderItem: PropTypes.func
36
+ })),
37
+ order: PropTypes.array
38
+ }),
39
+ files: PropTypes.arrayOf(PropTypes.shape({
40
+ id: PropTypes.string,
41
+ name: PropTypes.string,
42
+ size: PropTypes.string,
43
+ type: PropTypes.string,
44
+ url: PropTypes.string
45
+ })),
46
+ filesDescription: PropTypes.object,
47
+ onChangeFileDescription: PropTypes.func,
48
+ onFileCancel: PropTypes.func,
49
+ onFileSubmit: PropTypes.func,
50
+ attachmentPreviewTexts: PropTypes.shape({
51
+ cancelText: PropTypes.string,
52
+ editText: PropTypes.string,
53
+ placeHolder: PropTypes.string,
54
+ submitText: PropTypes.string
55
+ }),
56
+ renderHeader: PropTypes.func,
57
+ renderFooter: PropTypes.func,
58
+ getEditorState: PropTypes.func
59
+ };
60
+ export default replyComposerPropTypes;
@@ -0,0 +1,41 @@
1
+ /** ** Libraries *** */
2
+ import React, { useMemo } from 'react';
3
+ /** ** Components *** */
4
+
5
+ import ReplyEditorExtensions from "../ReplyEditorExtensions/ReplyEditorExtensions";
6
+ /** ** Hooks *** */
7
+
8
+ import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
9
+ /** ** Constants *** */
10
+
11
+ import replyComposerFooterDefaultProps from "./props/defaultProps";
12
+ import replyComposerFooterPropTypes from "./props/propTypes";
13
+ /** ** Methods *** */
14
+
15
+ import renderHandler from '@zohoim/chat-components-utils/es/common/renderHandler';
16
+ /** ** Styles *** */
17
+
18
+ import style from "./css/ReplyComposerFooter.module.css";
19
+ export default function ReplyComposerFooter(props) {
20
+ const {
21
+ customStyle,
22
+ editor,
23
+ isHTMLContent,
24
+ extensions,
25
+ renderButtons
26
+ } = props;
27
+ /* External customization */
28
+
29
+ const newStyle = useMergeStyle(style, customStyle);
30
+ const footerButtons = useMemo(() => renderHandler(renderButtons)(), [renderButtons]);
31
+ return /*#__PURE__*/React.createElement("div", {
32
+ className: newStyle.replyComposerFooter
33
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReplyEditorExtensions, {
34
+ editor: editor,
35
+ extensions: extensions,
36
+ isHTMLContent: isHTMLContent
37
+ })), footerButtons || null);
38
+ }
39
+ ReplyComposerFooter.propTypes = replyComposerFooterPropTypes;
40
+ ReplyComposerFooter.defaultProps = replyComposerFooterDefaultProps;
41
+ ReplyComposerFooter.displayName = 'ReplyComposerFooter';
@@ -0,0 +1,10 @@
1
+ /** ** Styles *** */
2
+ .replyComposerFooter {
3
+ display: flex;
4
+ }
5
+ [dir=ltr] .replyComposerFooter {
6
+ padding: 0 0 0 var(--zd_size16) ;
7
+ }
8
+ [dir=rtl] .replyComposerFooter {
9
+ padding: 0 var(--zd_size16) 0 0 ;
10
+ }
@@ -0,0 +1 @@
1
+ export { default as ReplyComposerFooter } from "./ReplyComposerFooter";
@@ -0,0 +1,8 @@
1
+ /** ** Constants *** */
2
+ import { dummyArray, dummyObject } from '@zohoim/chat-components-utils/es/constants';
3
+ const replyComposerFooterDefaultProps = {
4
+ customStyle: dummyObject,
5
+ isHTMLContent: dummyArray,
6
+ extensions: dummyArray
7
+ };
8
+ export default replyComposerFooterDefaultProps;
@@ -0,0 +1,17 @@
1
+ /** ** Libraries *** */
2
+ import PropTypes from 'prop-types';
3
+ const replyComposerFooterPropTypes = {
4
+ customStyle: PropTypes.object,
5
+ editor: PropTypes.object.isRequired,
6
+ isHTMLContent: PropTypes.bool,
7
+ extensions: PropTypes.shape({
8
+ details: PropTypes.objectOf(PropTypes.shape({
9
+ componentProps: PropTypes.object,
10
+ id: PropTypes.string,
11
+ renderItem: PropTypes.func
12
+ })),
13
+ order: PropTypes.array
14
+ }).isRequired,
15
+ renderButtons: PropTypes.func
16
+ };
17
+ export default replyComposerFooterPropTypes;
@@ -0,0 +1,103 @@
1
+ /** ** Libraries *** */
2
+ import React, { useMemo } from 'react';
3
+ /** ** Components *** */
4
+
5
+ import Editor from "../../rte/Editor/Editor";
6
+ import { Container } from '@zohodesk/components/es/Layout';
7
+ /** ** Hooks *** */
8
+
9
+ import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
10
+ import useReplyEditor from '@zohoim/chat-components-hooks/es/im/ReplyEditor/useReplyEditor';
11
+ /** ** Constants *** */
12
+
13
+ import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
14
+ import replyEditorDefaultProps from "./props/defaultProps";
15
+ import replyEditorPropTypes from "./props/propTypes";
16
+ /** ** Methods *** */
17
+
18
+ import cssJSLogic from "./css/cssJSLogic";
19
+ /** ** Styles *** */
20
+
21
+ import style from "./css/ReplyEditor.module.css";
22
+ export default function ReplyEditor(props) {
23
+ const {
24
+ id,
25
+ content,
26
+ EDITORURL,
27
+ placeHolder,
28
+ features,
29
+ formats,
30
+ isHTMLContent,
31
+ onChange,
32
+ onKeyDown,
33
+ onPaste,
34
+ onEnter,
35
+ onErrorCallback: propOnErrorCallback,
36
+ onReadyCallback: propOnReadyCallback,
37
+ customStyle,
38
+ customProps = dummyObject,
39
+ getEditorState,
40
+ themeVariables
41
+ } = props;
42
+ const {
43
+ editorProps = dummyObject
44
+ } = customProps;
45
+ const {
46
+ customStyle: editorCustomStyle = dummyObject
47
+ } = editorProps;
48
+ const {
49
+ onReadyCallback,
50
+ onErrorCallback,
51
+ isRenderEditor,
52
+ isShowEditor,
53
+ appearance,
54
+ isRTL
55
+ } = useReplyEditor({
56
+ onErrorCallback: propOnErrorCallback,
57
+ onReadyCallback: propOnReadyCallback,
58
+ getEditorState,
59
+ onEnter,
60
+ themeVariables
61
+ });
62
+ /* External customization */
63
+
64
+ const newStyle = useMergeStyle(style, customStyle);
65
+ /* CSS classnames added based on logic */
66
+
67
+ const {
68
+ editorClass
69
+ } = cssJSLogic(props, newStyle, {
70
+ isShowEditor
71
+ });
72
+ const editorNewCustomStyle = useMemo(() => ({
73
+ editorWrapper: newStyle.editorWrapper,
74
+ editor: newStyle.editor,
75
+ $editableDiv: newStyle.editableDiv,
76
+ ...editorCustomStyle
77
+ }), [newStyle, editorCustomStyle]);
78
+ return /*#__PURE__*/React.createElement(Container, {
79
+ className: newStyle.replyEditor
80
+ }, isRenderEditor ? /*#__PURE__*/React.createElement(Container, {
81
+ className: editorClass
82
+ }, /*#__PURE__*/React.createElement(Editor, {
83
+ appearance: appearance,
84
+ content: content,
85
+ customStyle: editorNewCustomStyle,
86
+ EDITORURL: EDITORURL,
87
+ features: features,
88
+ formats: formats,
89
+ id: id,
90
+ isHTMLContent: isHTMLContent,
91
+ isRTL: isRTL,
92
+ onChange: onChange,
93
+ onErrorCallback: onErrorCallback,
94
+ onKeyDown: onKeyDown,
95
+ onPaste: onPaste,
96
+ onReadyCallback: onReadyCallback,
97
+ placeHolder: placeHolder,
98
+ ...editorProps
99
+ })) : null);
100
+ }
101
+ ReplyEditor.propTypes = replyEditorPropTypes;
102
+ ReplyEditor.defaultProps = replyEditorDefaultProps;
103
+ ReplyEditor.displayName = 'ReplyEditor';
@@ -0,0 +1,50 @@
1
+ /** ** Styles *** */
2
+
3
+ .replyEditor {
4
+ /** ** Use this class for css customisations *** */
5
+ }
6
+
7
+ .hiddenEditor {
8
+ /** ** Use this class for css customisations *** */
9
+ /* display: none; */
10
+ /* visibility: hidden; */
11
+ }
12
+
13
+ .editableDiv {
14
+ --zd_fallback_font: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI',
15
+ Roboto, 'Helvetica Neue', Arial, sans-serif !important;
16
+ --zd_regular: var(--zd_base_font_regular), var(--zd_fallback_font) !important;
17
+ --zd_light: var(--zd_base_font_light), var(--zd_fallback_font) !important;
18
+ --zd_semibold: var(--zd_base_font_semibold), var(--zd_fallback_font) !important;
19
+ --zd_bold: var(--zd_base_font_bold), var(--zd_fallback_font) !important;
20
+ max-height: var(--zd_size250) !important;
21
+ min-height: var(--zd_size80) !important;
22
+ overflow: auto !important;
23
+ font-size: var(--zd_font_size14) !important;
24
+ font-family: var(--zd_regular) !important;
25
+ line-height: 22px !important;
26
+
27
+ --rte-text-color: var(--imlib_chat_components_replyEditor_color) !important;
28
+ --rte-bg-color: var(--imlib_chat_components_replyEditor_bg) !important;
29
+ --rte-placeholder-color: var(
30
+ --imlib_chat_components_replyEditor_placeholder
31
+ ) !important;
32
+ --rte-link-text-color: var(
33
+ --imlib_chat_components_replyEditor_color
34
+ ) !important;
35
+
36
+ padding: var(--zd_size16) !important;
37
+ cursor: text !important;
38
+ }
39
+
40
+ .editorWrapper {
41
+ /** ** Use this class for css customisations *** */
42
+ }
43
+
44
+ .editor {
45
+ /** ** Use this class for css customisations *** */
46
+ }
47
+
48
+ .replyEditor :global(.prosemirror-suggestion) {
49
+ text-decoration: none !important;
50
+ }
@@ -0,0 +1,10 @@
1
+ /** ** Methods *** */
2
+ import { compileClassNames } from '@zohodesk/utils';
3
+ export default function cssJSLogic(props, style, state) {
4
+ const editorClass = compileClassNames({
5
+ [style.hiddenEditor]: !state.isShowEditor
6
+ });
7
+ return {
8
+ editorClass
9
+ };
10
+ }
@@ -0,0 +1 @@
1
+ export { default as ReplyEditor } from "./ReplyEditor";
@@ -0,0 +1,8 @@
1
+ /** ** Constants *** */
2
+ import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
3
+ const replyEditorDefaultProps = {
4
+ customStyle: dummyObject,
5
+ customProps: dummyObject,
6
+ themeVariables: dummyObject
7
+ };
8
+ export default replyEditorDefaultProps;
@@ -0,0 +1,27 @@
1
+ /** ** Libraries *** */
2
+ import PropTypes from 'prop-types';
3
+ /** ** Constants *** */
4
+
5
+ import { features, formats } from "../../../constants/propConstants/editorPropConstants";
6
+ const replyEditorPropTypes = {
7
+ customStyle: PropTypes.object,
8
+ id: PropTypes.string,
9
+ content: PropTypes.string.isRequired,
10
+ EDITORURL: PropTypes.string,
11
+ placeHolder: PropTypes.string,
12
+ features: PropTypes.arrayOf(PropTypes.oneOf(features)),
13
+ formats: PropTypes.arrayOf(PropTypes.oneOf(formats)),
14
+ isHTMLContent: PropTypes.bool,
15
+ onChange: PropTypes.func.isRequired,
16
+ onKeyDown: PropTypes.func,
17
+ onPaste: PropTypes.func,
18
+ onEnter: PropTypes.func,
19
+ onErrorCallback: PropTypes.func,
20
+ onReadyCallback: PropTypes.func,
21
+ themeVariables: PropTypes.object,
22
+ customProps: PropTypes.shape({
23
+ editorProps: PropTypes.object
24
+ }),
25
+ getEditorState: PropTypes.func
26
+ };
27
+ export default replyEditorPropTypes;