@zohoim/chat-components 1.0.9-beta.5 → 1.0.9-beta.7
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/es/AttachmentPreview/AttachmentPreview.js +8 -2
- package/es/AttachmentPreview/props/defaultProps.js +2 -1
- package/es/AttachmentPreview/props/propTypes.js +2 -1
- package/es/AttachmentPreviewBody/AttachmentPreviewBody.js +31 -15
- package/es/AttachmentPreviewBody/css/AttachmentPreviewBody.module.css +4 -0
- package/es/im/ReplyComposer/ReplyComposer.js +19 -3
- package/es/im/ReplyComposer/css/ReplyComposer.module.css +5 -0
- package/es/im/ReplyComposer/css/cssJSLogic.js +13 -0
- package/package.json +4 -4
|
@@ -9,6 +9,7 @@ import AttachmentPreviewHeader from "../AttachmentPreviewHeader/AttachmentPrevie
|
|
|
9
9
|
import AttachmentPreviewBody from "../AttachmentPreviewBody/AttachmentPreviewBody";
|
|
10
10
|
/** ** Hooks *** */
|
|
11
11
|
|
|
12
|
+
import { useZIndex } from '@zohodesk/components/es/Provider/ZindexProvider';
|
|
12
13
|
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
13
14
|
import useAttachmentPreview from '@zohoim/chat-components-hooks/es/AttachmentPreview/useAttachmentPreview';
|
|
14
15
|
import useAttachmentPreviewEditor from '@zohoim/chat-components-hooks/es/AttachmentPreview/useAttachmentPreviewEditor';
|
|
@@ -36,7 +37,8 @@ export default function AttachmentPreview(props) {
|
|
|
36
37
|
descriptionDetails,
|
|
37
38
|
onDescriptionChange: propOnDescriptionChange,
|
|
38
39
|
needCloseOnEscape,
|
|
39
|
-
needUploadOnEnter
|
|
40
|
+
needUploadOnEnter,
|
|
41
|
+
needAutoZindex
|
|
40
42
|
} = props;
|
|
41
43
|
const {
|
|
42
44
|
editorProps = dummyObject,
|
|
@@ -51,6 +53,7 @@ export default function AttachmentPreview(props) {
|
|
|
51
53
|
/* External customization */
|
|
52
54
|
|
|
53
55
|
const newStyle = useMergeStyle(style, customStyle);
|
|
56
|
+
const getNextIndex = useZIndex();
|
|
54
57
|
const {
|
|
55
58
|
selectedFile,
|
|
56
59
|
isShow,
|
|
@@ -84,7 +87,10 @@ export default function AttachmentPreview(props) {
|
|
|
84
87
|
return isShow ? /*#__PURE__*/React.createElement(Container, {
|
|
85
88
|
align: "both",
|
|
86
89
|
alignBox: "column",
|
|
87
|
-
className: newStyle.attachmentPreview
|
|
90
|
+
className: newStyle.attachmentPreview,
|
|
91
|
+
style: needAutoZindex ? {
|
|
92
|
+
zIndex: `${getNextIndex()}`
|
|
93
|
+
} : {}
|
|
88
94
|
}, /*#__PURE__*/React.createElement("div", {
|
|
89
95
|
className: newStyle.uploadPrev
|
|
90
96
|
}, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(AttachmentPreviewHeader, {
|
|
@@ -3,6 +3,7 @@ import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyCon
|
|
|
3
3
|
const attachmentPreviewDefaultProps = {
|
|
4
4
|
customStyle: dummyObject,
|
|
5
5
|
needCloseOnEscape: true,
|
|
6
|
-
needUploadOnEnter: true
|
|
6
|
+
needUploadOnEnter: true,
|
|
7
|
+
needAutoZindex: true
|
|
7
8
|
};
|
|
8
9
|
export default attachmentPreviewDefaultProps;
|
|
@@ -27,6 +27,7 @@ const attachmentPreviewPropTypes = {
|
|
|
27
27
|
descriptionDetails: PropTypes.object,
|
|
28
28
|
onDescriptionChange: PropTypes.func,
|
|
29
29
|
needCloseOnEscape: PropTypes.bool,
|
|
30
|
-
needUploadOnEnter: PropTypes.bool
|
|
30
|
+
needUploadOnEnter: PropTypes.bool,
|
|
31
|
+
needAutoZindex: PropTypes.bool
|
|
31
32
|
};
|
|
32
33
|
export default attachmentPreviewPropTypes;
|
|
@@ -3,7 +3,7 @@ import React, { useMemo } from 'react';
|
|
|
3
3
|
/** ** Components *** */
|
|
4
4
|
|
|
5
5
|
import { Container } from '@zohodesk/components/es/Layout';
|
|
6
|
-
import
|
|
6
|
+
import ReplyComposer from "../im/ReplyComposer/ReplyComposer";
|
|
7
7
|
import AttachmentIcon from "../AttachmentIcon/AttachmentIcon";
|
|
8
8
|
/** ** Hooks *** */
|
|
9
9
|
|
|
@@ -41,16 +41,33 @@ export default function AttachmentPreviewBody(props) {
|
|
|
41
41
|
const iconCustomStyle = useMemo(() => ({
|
|
42
42
|
icon: newStyle.attachmentIcon
|
|
43
43
|
}), [newStyle.attachmentIcon]);
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
const modifiedEditorProps = useMemo(() => {
|
|
45
|
+
const {
|
|
46
|
+
customProps,
|
|
47
|
+
customStyle: replyComposerCustomStyle
|
|
48
|
+
} = editorProps || dummyObject;
|
|
49
|
+
const {
|
|
50
|
+
replyEditorProps
|
|
51
|
+
} = customProps || dummyObject;
|
|
52
|
+
const {
|
|
53
|
+
customStyle = dummyObject
|
|
54
|
+
} = replyEditorProps || dummyObject;
|
|
55
|
+
return { ...editorProps,
|
|
56
|
+
customStyle: {
|
|
57
|
+
replyComposer: newStyle.replyComposer,
|
|
58
|
+
...replyComposerCustomStyle
|
|
59
|
+
},
|
|
60
|
+
customProps: { ...customProps,
|
|
61
|
+
replyEditorProps: { ...replyEditorProps,
|
|
62
|
+
customStyle: {
|
|
63
|
+
editorWrapper: newStyle.editorWrapper,
|
|
64
|
+
editableDiv: newStyle.editableDiv,
|
|
65
|
+
...customStyle
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}, [editorProps, newStyle.replyComposer, newStyle.editorWrapper, newStyle.editableDiv]);
|
|
54
71
|
return /*#__PURE__*/React.createElement(Container, {
|
|
55
72
|
align: "both",
|
|
56
73
|
alignBox: "column",
|
|
@@ -66,14 +83,13 @@ export default function AttachmentPreviewBody(props) {
|
|
|
66
83
|
fileFormat: fileFormat,
|
|
67
84
|
mediaType: mediaType,
|
|
68
85
|
...attachmentIconProps
|
|
69
|
-
}))), isDescriptionNeeded ? /*#__PURE__*/React.createElement(
|
|
86
|
+
}))), isDescriptionNeeded ? /*#__PURE__*/React.createElement(ReplyComposer, {
|
|
70
87
|
content: description,
|
|
71
|
-
customProps: editorCustomProps,
|
|
72
|
-
customStyle: editorCustomStyle,
|
|
73
88
|
id: `${attachmentId}_Attach_Editor`,
|
|
74
89
|
onChange: onDescriptionChange,
|
|
75
90
|
onKeyDown: onEditorKeyDown,
|
|
76
|
-
placeHolder: placeHolder
|
|
91
|
+
placeHolder: placeHolder,
|
|
92
|
+
...modifiedEditorProps
|
|
77
93
|
}) : null);
|
|
78
94
|
}
|
|
79
95
|
AttachmentPreviewBody.propTypes = attachmentPreviewBodyPropTypes;
|
|
@@ -20,6 +20,7 @@ import replyComposerPropTypes from "./props/propTypes";
|
|
|
20
20
|
/** ** Methods *** */
|
|
21
21
|
|
|
22
22
|
import renderHandler from '@zohoim/chat-components-utils/es/common/renderHandler';
|
|
23
|
+
import cssJSLogic from "./css/cssJSLogic";
|
|
23
24
|
/** ** Styles *** */
|
|
24
25
|
|
|
25
26
|
import style from "./css/ReplyComposer.module.css";
|
|
@@ -47,6 +48,7 @@ export default function ReplyComposer(props) {
|
|
|
47
48
|
attachmentPreviewTexts,
|
|
48
49
|
renderHeader,
|
|
49
50
|
renderFooter,
|
|
51
|
+
renderStencils,
|
|
50
52
|
getEditorState: propGetEditorState,
|
|
51
53
|
needFooter
|
|
52
54
|
} = props;
|
|
@@ -75,7 +77,9 @@ export default function ReplyComposer(props) {
|
|
|
75
77
|
onKeyDown,
|
|
76
78
|
attachmentPreviewCustomProps,
|
|
77
79
|
onFileCancel,
|
|
78
|
-
onFileSubmit
|
|
80
|
+
onFileSubmit,
|
|
81
|
+
isLoading,
|
|
82
|
+
isLoaded
|
|
79
83
|
} = useReplyComposer({
|
|
80
84
|
onKeyDown: propOnKeyDown,
|
|
81
85
|
isShowSuggestion,
|
|
@@ -90,7 +94,17 @@ export default function ReplyComposer(props) {
|
|
|
90
94
|
/* External customization */
|
|
91
95
|
|
|
92
96
|
const newStyle = useMergeStyle(style, customStyle);
|
|
97
|
+
/* CSS classnames added based on logic */
|
|
98
|
+
|
|
99
|
+
const {
|
|
100
|
+
replEditorWrapperClass
|
|
101
|
+
} = cssJSLogic({
|
|
102
|
+
isLoaded
|
|
103
|
+
}, newStyle);
|
|
93
104
|
const headerElement = useMemo(() => renderHandler(renderHeader)(), [renderHeader]);
|
|
105
|
+
const stencilsElement = useMemo(() => isLoading ? renderHandler(renderStencils)({
|
|
106
|
+
needFooter
|
|
107
|
+
}) : null, [renderStencils, needFooter, isLoading]);
|
|
94
108
|
return /*#__PURE__*/React.createElement(Container, {
|
|
95
109
|
className: newStyle.replyComposer,
|
|
96
110
|
isCover: false
|
|
@@ -111,7 +125,9 @@ export default function ReplyComposer(props) {
|
|
|
111
125
|
onSubmit: onFileSubmit,
|
|
112
126
|
texts: attachmentPreviewTexts,
|
|
113
127
|
...attachmentPreviewCustomProps
|
|
114
|
-
}) : null, headerElement || null, /*#__PURE__*/React.createElement(
|
|
128
|
+
}) : null, isLoaded ? headerElement : null, stencilsElement || null, /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: replEditorWrapperClass
|
|
130
|
+
}, /*#__PURE__*/React.createElement(ReplyEditor, {
|
|
115
131
|
content: content,
|
|
116
132
|
EDITORURL: EDITORURL,
|
|
117
133
|
features: allFeatures,
|
|
@@ -124,7 +140,7 @@ export default function ReplyComposer(props) {
|
|
|
124
140
|
onPaste: onPaste,
|
|
125
141
|
placeHolder: placeHolder,
|
|
126
142
|
...replyEditorProps
|
|
127
|
-
}), needFooter ? /*#__PURE__*/React.createElement(ReplyComposerFooter, {
|
|
143
|
+
})), needFooter && isLoaded ? /*#__PURE__*/React.createElement(ReplyComposerFooter, {
|
|
128
144
|
editor: editor,
|
|
129
145
|
extensions: extensions,
|
|
130
146
|
isHTMLContent: isHTMLContent,
|
|
@@ -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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohoim/chat-components",
|
|
3
|
-
"version": "1.0.9-beta.
|
|
3
|
+
"version": "1.0.9-beta.7",
|
|
4
4
|
"description": "Chat Components",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@zohodesk/utils": "1.3.13",
|
|
37
37
|
"@zohodesk/variables": "1.0.0",
|
|
38
38
|
"@zohodesk/virtualizer": "1.0.13",
|
|
39
|
-
"@zohoim/chat-components-hooks": "
|
|
40
|
-
"@zohoim/chat-components-utils": "
|
|
39
|
+
"@zohoim/chat-components-hooks": "1.0.4-beta.7",
|
|
40
|
+
"@zohoim/chat-components-utils": "1.0.4-beta.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@zohodesk-private/css-variable-migrator": "1.0.7",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"jsdom": "23.0.0",
|
|
46
46
|
"react-to-jsx": "1.3.2"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "44f84bf3e27cc3b76db2abc64e889ab026a258b7"
|
|
49
49
|
}
|