@zohoim/chat-components 0.0.15 → 0.0.17
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/ActionIcon/ActionIcon.js +2 -0
- package/es/ActionIconWrapper/ActionIconWrapper.js +6 -2
- package/es/ActionIconWrapper/props/propTypes.js +1 -0
- package/es/AttachmentBubble/AttachmentBubble.js +24 -8
- package/es/AttachmentBubble/css/AttachmentBubble.module.css +15 -1
- package/es/AttachmentBubble/css/cssJSLogic.js +15 -0
- package/es/AttachmentBubble/props/propTypes.js +2 -1
- package/es/AttachmentBubbleInfo/AttachmentBubbleInfo.js +13 -2
- package/es/AttachmentBubbleInfo/css/AttachmentBubbleInfo.module.css +9 -0
- package/es/AttachmentBubbleInfo/css/cssJSLogic.js +13 -0
- package/es/AttachmentBubbleInfo/props/propTypes.js +2 -1
- package/es/AttachmentIcon/AttachmentIcon.js +3 -1
- package/es/AttachmentIcon/css/AttachmentIcon.module.css +2 -2
- package/es/AttachmentIcon/props/propTypes.js +6 -0
- package/es/AttachmentIcon/utils/getAttachmentIconComponent.js +4 -3
- package/es/AudioBubble/AudioBubble.js +5 -2
- package/es/AudioBubble/props/propTypes.js +2 -1
- package/es/ImageBubble/ImageBubble.js +13 -2
- package/es/ImageBubble/css/ImageBubble.module.css +8 -2
- package/es/ImageBubble/css/cssJSLogic.js +13 -0
- package/es/ImageBubble/props/propTypes.js +2 -1
- package/es/LocationBubble/LocationBubble.js +13 -2
- package/es/LocationBubble/css/LocationBubble.module.css +14 -1
- package/es/LocationBubble/css/cssJSLogic.js +13 -0
- package/es/LocationBubble/props/propTypes.js +2 -1
- package/es/MediaBubbleWrapper/MediaBubbleWrapper.js +5 -2
- package/es/MediaBubbleWrapper/props/propTypes.js +2 -1
- package/es/Message/Message.js +4 -2
- package/es/MessageAction/MessageAction.js +3 -0
- package/es/MessageAction/props/propTypes.js +1 -0
- package/es/MessageActions/MessageActions.js +14 -2
- package/es/MessageActions/props/propTypes.js +1 -0
- package/es/MessageBox/MessageBox.js +2 -2
- package/es/MessageBubble/MessageBubble.js +25 -19
- package/es/MessageBubble/css/MessageBubble.module.css +12 -2
- package/es/MessageBubble/css/cssJSLogic.js +4 -2
- package/es/MessageStatus/css/MessageStatus.module.css +0 -3
- package/es/MoreActionItem/MoreActionItem.js +8 -0
- package/es/MoreActionItem/props/propTypes.js +1 -0
- package/es/ReplyBubble/ReplyBubble.js +32 -13
- package/es/ReplyBubble/css/ReplyBubble.module.css +1 -1
- package/es/ReplyBubble/props/propTypes.js +8 -2
- package/es/ReplyBubbleContent/ReplyBubbleContent.js +11 -2
- package/es/ReplyBubbleContent/css/ReplyBubbleContent.module.css +21 -3
- package/es/ReplyBubbleContent/css/cssJSLogic.js +13 -0
- package/es/ReplyBubbleContent/props/propTypes.js +2 -1
- package/es/ReplyBubbleHeader/ReplyBubbleHeader.js +20 -5
- package/es/ReplyBubbleHeader/css/ReplyBubbleHeader.module.css +12 -0
- package/es/ReplyBubbleHeader/css/cssJSLogic.js +12 -0
- package/es/ReplyBubbleHeader/props/defaultProps.js +2 -1
- package/es/ReplyBubbleHeader/props/propTypes.js +6 -2
- package/es/TextBubble/TextBubble.js +15 -3
- package/es/TextBubble/css/TextBubble.module.css +13 -0
- package/es/TextBubble/css/cssJSLogic.js +18 -0
- package/es/TextBubble/props/propTypes.js +2 -1
- package/es/Theme/themeVariables/commonThemeColorVariable.js +1 -2
- package/es/Theme/themeVariables/dark/blueTheme.js +97 -40
- package/es/Theme/themeVariables/dark/commonColorVariable.js +7 -1
- package/es/Theme/themeVariables/dark/greenTheme.js +95 -38
- package/es/Theme/themeVariables/dark/orangeTheme.js +94 -37
- package/es/Theme/themeVariables/dark/redTheme.js +94 -46
- package/es/Theme/themeVariables/dark/yellowTheme.js +94 -37
- package/es/Theme/themeVariables/light/blueTheme.js +96 -36
- package/es/Theme/themeVariables/light/commonColorVariable.js +12 -1
- package/es/Theme/themeVariables/light/greenTheme.js +96 -36
- package/es/Theme/themeVariables/light/orangeTheme.js +96 -34
- package/es/Theme/themeVariables/light/redTheme.js +96 -34
- package/es/Theme/themeVariables/light/yellowTheme.js +96 -36
- package/es/Theme/themeVariables/pureDark/blueTheme.js +93 -37
- package/es/Theme/themeVariables/pureDark/commonColorVariable.js +7 -1
- package/es/Theme/themeVariables/pureDark/greenTheme.js +94 -37
- package/es/Theme/themeVariables/pureDark/orangeTheme.js +94 -37
- package/es/Theme/themeVariables/pureDark/redTheme.js +94 -37
- package/es/Theme/themeVariables/pureDark/yellowTheme.js +94 -37
- package/es/VideoBubble/VideoBubble.js +5 -2
- package/es/VideoBubble/props/propTypes.js +2 -1
- package/es/icons/iconSrc/attachments/Text.js +47 -0
- package/es/icons/iconSrc/attachments/index.js +1 -1
- package/es/im/ArticleBubble/ArticleBubble.js +16 -3
- package/es/im/ArticleBubble/css/ArticleBubble.module.css +25 -7
- package/es/im/ArticleBubble/css/cssJSLogic.js +12 -0
- package/es/im/ArticleBubble/props/propTypes.js +2 -1
- package/es/im/IMAutoMessageInfo/css/IMAutoMessageInfo.module.css +1 -0
- package/es/im/IMIntegrationIcon/css/IMIntegrationIcon.module.css +1 -6
- package/es/im/IMMessage/IMMessage.js +28 -4
- package/es/im/IMMessage/props/propTypes.js +25 -1
- package/es/im/IMMessageContent/IMMessageContent.js +39 -42
- package/es/im/IMMessageContent/css/IMMessageContent.module.css +6 -2
- package/es/im/IMMessageContent/props/propTypes.js +7 -2
- package/es/im/IMMessageMeta/IMMessageMeta.js +8 -8
- package/es/im/IMMessageMeta/css/IMMessageMeta.module.css +1 -1
- package/es/im/IMMessageMeta/props/defaultProps.js +1 -1
- package/es/im/IMPermaLink/css/IMPermaLink.module.css +1 -1
- package/es/im/IMReplyBubble/IMReplyBubble.js +10 -5
- package/es/im/IMReplyBubble/props/propTypes.js +7 -2
- package/es/im/IMTextBubble/IMTextBubble.js +5 -2
- package/es/im/IMTextBubble/props/propTypes.js +2 -1
- package/es/im/css/common.module.css +2 -2
- package/es/im/index.js +0 -1
- package/es/index.js +0 -1
- package/package.json +4 -21
- package/es/InfoBubble/InfoBubble.js +0 -34
- package/es/InfoBubble/css/InfoBubble.module.css +0 -0
- package/es/InfoBubble/css/cssJSLogic.js +0 -10
- package/es/InfoBubble/index.js +0 -1
- package/es/InfoBubble/props/defaultProps.js +0 -6
- package/es/InfoBubble/props/propTypes.js +0 -6
- package/es/Theme/crm/dark/blueFanTheme.js +0 -28
- package/es/Theme/crm/dark/blueTheme.js +0 -28
- package/es/Theme/crm/dark/commonColorVariable.js +0 -11
- package/es/Theme/crm/dark/darkBlueTheme.js +0 -28
- package/es/Theme/crm/dark/darkGreyTheme.js +0 -28
- package/es/Theme/crm/dark/greenTheme.js +0 -28
- package/es/Theme/crm/dark/orangeTheme.js +0 -28
- package/es/Theme/crm/dark/pinkTheme.js +0 -28
- package/es/Theme/crm/dark/tealTheme.js +0 -28
- package/es/Theme/crm/dark/whiteTheme.js +0 -28
- package/es/Theme/crm/light/blueFanTheme.js +0 -28
- package/es/Theme/crm/light/blueTheme.js +0 -31
- package/es/Theme/crm/light/commonColorVariable.js +0 -9
- package/es/Theme/crm/light/darkBlueTheme.js +0 -28
- package/es/Theme/crm/light/darkGreyTheme.js +0 -28
- package/es/Theme/crm/light/greenTheme.js +0 -28
- package/es/Theme/crm/light/orangeTheme.js +0 -28
- package/es/Theme/crm/light/pinkTheme.js +0 -28
- package/es/Theme/crm/light/tealTheme.js +0 -28
- package/es/Theme/crm/light/whiteTheme.js +0 -28
- package/es/Theme/crm/pureDark/blueFanTheme.js +0 -28
- package/es/Theme/crm/pureDark/blueTheme.js +0 -28
- package/es/Theme/crm/pureDark/commonColorVariable.js +0 -9
- package/es/Theme/crm/pureDark/darkBlueTheme.js +0 -28
- package/es/Theme/crm/pureDark/darkGreyTheme.js +0 -28
- package/es/Theme/crm/pureDark/greenTheme.js +0 -28
- package/es/Theme/crm/pureDark/orangeTheme.js +0 -28
- package/es/Theme/crm/pureDark/pinkTheme.js +0 -28
- package/es/Theme/crm/pureDark/tealTheme.js +0 -28
- package/es/Theme/crm/pureDark/whiteTheme.js +0 -28
- package/es/im/IMInfoBubble/IMInfoBubble.js +0 -34
- package/es/im/IMInfoBubble/css/IMInfoBubble.module.css +0 -0
- package/es/im/IMInfoBubble/css/cssJSLogic.js +0 -10
- package/es/im/IMInfoBubble/index.js +0 -1
- package/es/im/IMInfoBubble/props/defaultProps.js +0 -6
- package/es/im/IMInfoBubble/props/propTypes.js +0 -6
- /package/es/icons/factory/attachments/{txt.svg → text.svg} +0 -0
|
@@ -38,6 +38,7 @@ export default function ActionIcon(props) {
|
|
|
38
38
|
customStyle,
|
|
39
39
|
customProps,
|
|
40
40
|
onClick,
|
|
41
|
+
onMouseEnter,
|
|
41
42
|
id,
|
|
42
43
|
title,
|
|
43
44
|
isDisabled,
|
|
@@ -70,6 +71,7 @@ export default function ActionIcon(props) {
|
|
|
70
71
|
id: id,
|
|
71
72
|
isDisabled: isDisabled,
|
|
72
73
|
onClick: onClick,
|
|
74
|
+
onMouseEnter: onMouseEnter,
|
|
73
75
|
renderIcon: renderIcon,
|
|
74
76
|
title: title
|
|
75
77
|
}, actionIconWrapperProps));
|
|
@@ -20,14 +20,17 @@ export default function ActionIconWrapper(props) {
|
|
|
20
20
|
renderIcon,
|
|
21
21
|
customStyle,
|
|
22
22
|
onClick: propOnClick,
|
|
23
|
+
onMouseEnter: propOnMouseEnter,
|
|
23
24
|
id,
|
|
24
25
|
title,
|
|
25
26
|
isDisabled
|
|
26
27
|
} = props;
|
|
27
28
|
const {
|
|
28
|
-
onClick
|
|
29
|
+
onClick,
|
|
30
|
+
onMouseEnter
|
|
29
31
|
} = useActionIconWrapper({
|
|
30
32
|
onClick: propOnClick,
|
|
33
|
+
onMouseEnter: propOnMouseEnter,
|
|
31
34
|
id,
|
|
32
35
|
isDisabled
|
|
33
36
|
});
|
|
@@ -49,7 +52,8 @@ export default function ActionIconWrapper(props) {
|
|
|
49
52
|
return icon ? /*#__PURE__*/React.createElement("div", {
|
|
50
53
|
className: actionIconWrapperClass,
|
|
51
54
|
"data-title": title,
|
|
52
|
-
onClick: onClick
|
|
55
|
+
onClick: onClick,
|
|
56
|
+
onMouseEnter: onMouseEnter
|
|
53
57
|
}, icon) : null;
|
|
54
58
|
}
|
|
55
59
|
ActionIconWrapper.propTypes = actionIconWrapperPropTypes;
|
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
const actionIconWrapperPropTypes = {
|
|
4
4
|
id: PropTypes.string.isRequired,
|
|
5
5
|
onClick: PropTypes.func.isRequired,
|
|
6
|
+
onMouseEnter: PropTypes.func,
|
|
6
7
|
renderIcon: PropTypes.func.isRequired,
|
|
7
8
|
customStyle: PropTypes.object,
|
|
8
9
|
isDisabled: PropTypes.bool,
|
|
@@ -18,41 +18,57 @@ import style from './css/AttachmentBubble.module.css';
|
|
|
18
18
|
import AttachmentBubbleInfo from '../AttachmentBubbleInfo/AttachmentBubbleInfo';
|
|
19
19
|
import AttachmentIcon from '../AttachmentIcon/AttachmentIcon';
|
|
20
20
|
import { Container, Box } from '@zohodesk/components/es/Layout';
|
|
21
|
+
/** ** Methods *** */
|
|
22
|
+
|
|
23
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
21
24
|
export default function AttachmentBubble(props) {
|
|
22
25
|
const {
|
|
23
26
|
customStyle,
|
|
24
27
|
customProps,
|
|
25
|
-
attachmentDetails
|
|
28
|
+
attachmentDetails,
|
|
29
|
+
isFailed
|
|
26
30
|
} = props;
|
|
27
31
|
const {
|
|
28
32
|
attachmentBubbleInfoProps,
|
|
29
33
|
attachmentIconProps
|
|
30
34
|
} = customProps;
|
|
31
|
-
/* External CSS Customization */
|
|
32
|
-
|
|
33
|
-
const newStyle = useMergeStyle(style, customStyle);
|
|
34
35
|
const {
|
|
35
36
|
formattedFileSize: fileSize,
|
|
36
37
|
fileName,
|
|
37
|
-
fileFormat
|
|
38
|
+
fileFormat,
|
|
39
|
+
mediaType
|
|
38
40
|
} = useAttachmentBubble({
|
|
39
41
|
attachmentDetails
|
|
40
42
|
});
|
|
43
|
+
/* External CSS Customization */
|
|
44
|
+
|
|
45
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
46
|
+
/* css classnames added based on logic */
|
|
47
|
+
|
|
48
|
+
const {
|
|
49
|
+
attachmentBubbleClass
|
|
50
|
+
} = cssJSLogic({
|
|
51
|
+
isFailed,
|
|
52
|
+
fileFormat
|
|
53
|
+
}, newStyle);
|
|
41
54
|
return /*#__PURE__*/React.createElement(Container, {
|
|
42
55
|
alignBox: "row",
|
|
43
|
-
className:
|
|
56
|
+
className: attachmentBubbleClass,
|
|
44
57
|
isCover: false
|
|
45
58
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
46
59
|
className: newStyle.attachmentBubbleIcon
|
|
47
60
|
}, /*#__PURE__*/React.createElement(AttachmentIcon, _extends({
|
|
48
|
-
fileFormat: fileFormat
|
|
61
|
+
fileFormat: fileFormat,
|
|
62
|
+
mediaType: mediaType
|
|
49
63
|
}, attachmentIconProps))), /*#__PURE__*/React.createElement(Box, {
|
|
50
64
|
className: newStyle.attachmentBubbleContent,
|
|
51
65
|
flexible: true
|
|
52
66
|
}, /*#__PURE__*/React.createElement(AttachmentBubbleInfo, _extends({
|
|
53
67
|
fileName: fileName,
|
|
54
68
|
fileSize: fileSize
|
|
55
|
-
}, attachmentBubbleInfoProps
|
|
69
|
+
}, attachmentBubbleInfoProps, {
|
|
70
|
+
isFailed: isFailed
|
|
71
|
+
}))));
|
|
56
72
|
}
|
|
57
73
|
AttachmentBubble.propTypes = attachmentBubblePropTypes;
|
|
58
74
|
AttachmentBubble.defaultProps = attachmentBubbleDefaultProps;
|
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
border: 1px solid var(--imlib_chat_components_attachmentBubble_border_color);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
.failedAttachmentBubble{
|
|
9
|
+
background-color: var(--imlib_chat_components_attachmentBubble_bg_color_failed);
|
|
10
|
+
border-color: var(--imlib_chat_components_attachmentBubble_border_color_failed);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.attachmentBubbleCursor {
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
}
|
|
16
|
+
|
|
8
17
|
.attachmentBubbleIcon {
|
|
9
18
|
width: var(--zd_size60) ;
|
|
10
19
|
display: flex;
|
|
@@ -21,6 +30,11 @@
|
|
|
21
30
|
border-left: 1px solid var(--imlib_chat_components_attachmentBubble_border_color);
|
|
22
31
|
}
|
|
23
32
|
|
|
33
|
+
.failedAttachmentBubble .attachmentBubbleIcon{
|
|
34
|
+
border-color: var(--imlib_chat_components_attachmentBubble_border_color_failed);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
24
38
|
.attachmentBubbleIcon, .attachmentBubbleContent {
|
|
25
39
|
padding: var(--zd_size10) ;
|
|
26
|
-
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { compileClassNames } from '@zohodesk/utils';
|
|
2
|
+
export default function cssJSLogic(props, style) {
|
|
3
|
+
const {
|
|
4
|
+
isFailed,
|
|
5
|
+
fileFormat
|
|
6
|
+
} = props;
|
|
7
|
+
const attachmentBubbleClass = compileClassNames({
|
|
8
|
+
[style.attachmentBubble]: true,
|
|
9
|
+
[style.failedAttachmentBubble]: isFailed,
|
|
10
|
+
[style.attachmentBubbleCursor]: fileFormat === 'pdf'
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
attachmentBubbleClass
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -10,6 +10,7 @@ const attachmentBubblePropTypes = {
|
|
|
10
10
|
attachmentBubbleInfoProps: PropTypes.object,
|
|
11
11
|
attachmentIconProps: PropTypes.object
|
|
12
12
|
}),
|
|
13
|
-
customStyle: PropTypes.object
|
|
13
|
+
customStyle: PropTypes.object,
|
|
14
|
+
isFailed: PropTypes.bool
|
|
14
15
|
};
|
|
15
16
|
export default attachmentBubblePropTypes;
|
|
@@ -13,17 +13,28 @@ import { Container, Box } from '@zohodesk/components/es/Layout';
|
|
|
13
13
|
/** ** Styles *** */
|
|
14
14
|
|
|
15
15
|
import style from './css/AttachmentBubbleInfo.module.css';
|
|
16
|
+
/** ** Methods *** */
|
|
17
|
+
|
|
18
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
16
19
|
export default function AttachmentBubbleInfo(props) {
|
|
17
20
|
const {
|
|
18
21
|
customStyle,
|
|
19
22
|
fileName,
|
|
20
|
-
fileSize
|
|
23
|
+
fileSize,
|
|
24
|
+
isFailed
|
|
21
25
|
} = props;
|
|
22
26
|
/* External css customization */
|
|
23
27
|
|
|
24
28
|
const newStyle = useMergeStyle(style, customStyle);
|
|
29
|
+
/* css classnames added based on logic */
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
attachmentBubbleInfoClass
|
|
33
|
+
} = cssJSLogic({
|
|
34
|
+
isFailed
|
|
35
|
+
}, newStyle);
|
|
25
36
|
return /*#__PURE__*/React.createElement(Container, {
|
|
26
|
-
className:
|
|
37
|
+
className: attachmentBubbleInfoClass,
|
|
27
38
|
isCover: false
|
|
28
39
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
29
40
|
className: newStyle.fileName
|
|
@@ -12,12 +12,20 @@
|
|
|
12
12
|
margin-bottom: var(--zd_size5) ;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
.failedAttachmentBubbleInfo .fileName{
|
|
16
|
+
color: var(--imlib_chat_components_attachmentBubbleInfo_fileName_color_failed);
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
.fileSize {
|
|
16
20
|
composes: varClass;
|
|
17
21
|
font-size: var(--attachmentBubbleInfo-fileSize_font_size);
|
|
18
22
|
color: var(--imlib_chat_components_attachmentBubbleInfo_fileSize_color);
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
.failedAttachmentBubbleInfo .fileSize{
|
|
26
|
+
color: var(--imlib_chat_components_attachmentBubbleInfo_fileSize_color_failed);
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
.fileName,
|
|
22
30
|
.fileSize {
|
|
23
31
|
composes: dotted from "../../css/common.module.css";
|
|
@@ -27,3 +35,4 @@
|
|
|
27
35
|
width: 100% ;
|
|
28
36
|
/* Use this class name for css customization */
|
|
29
37
|
}
|
|
38
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { compileClassNames } from '@zohodesk/utils';
|
|
2
|
+
export default function cssJSLogic(props, style) {
|
|
3
|
+
const {
|
|
4
|
+
isFailed
|
|
5
|
+
} = props;
|
|
6
|
+
const attachmentBubbleInfoClass = compileClassNames({
|
|
7
|
+
[style.attachmentBubbleInfo]: true,
|
|
8
|
+
[style.failedAttachmentBubbleInfo]: isFailed
|
|
9
|
+
});
|
|
10
|
+
return {
|
|
11
|
+
attachmentBubbleInfoClass
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
const attachmentBubbleInfoPropTypes = {
|
|
4
4
|
fileName: PropTypes.string.isRequired,
|
|
5
5
|
fileSize: PropTypes.string.isRequired,
|
|
6
|
-
customStyle: PropTypes.object
|
|
6
|
+
customStyle: PropTypes.object,
|
|
7
|
+
isFailed: PropTypes.bool
|
|
7
8
|
};
|
|
8
9
|
export default attachmentBubbleInfoPropTypes;
|
|
@@ -18,6 +18,7 @@ export default function AttachmentIcon(props) {
|
|
|
18
18
|
const {
|
|
19
19
|
customStyle,
|
|
20
20
|
fileFormat,
|
|
21
|
+
mediaType,
|
|
21
22
|
renderCustomIcon
|
|
22
23
|
} = props;
|
|
23
24
|
/* External CSS Customization */
|
|
@@ -36,7 +37,8 @@ export default function AttachmentIcon(props) {
|
|
|
36
37
|
const {
|
|
37
38
|
IconComponent
|
|
38
39
|
} = getAttachmentIconComponent({
|
|
39
|
-
fileFormat
|
|
40
|
+
fileFormat,
|
|
41
|
+
mediaType
|
|
40
42
|
});
|
|
41
43
|
return IconComponent ? /*#__PURE__*/React.createElement(IconComponent, {
|
|
42
44
|
customStyle: iconCustomStyle
|
|
@@ -3,8 +3,14 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
/** ** Constants *** */
|
|
4
4
|
|
|
5
5
|
import attachmentFileTypes from '@zohoim/chat-components-utils/es/constants/attachmentFileTypes';
|
|
6
|
+
const {
|
|
7
|
+
AUDIO,
|
|
8
|
+
VIDEO,
|
|
9
|
+
IMAGE
|
|
10
|
+
} = attachmentFileTypes;
|
|
6
11
|
const attachmentIconPropTypes = {
|
|
7
12
|
fileFormat: PropTypes.oneOf(Object.values(attachmentFileTypes)).isRequired,
|
|
13
|
+
mediaType: PropTypes.oneOf([AUDIO, VIDEO, IMAGE]).isRequired,
|
|
8
14
|
customStyle: PropTypes.object,
|
|
9
15
|
renderCustomIcon: PropTypes.func
|
|
10
16
|
};
|
|
@@ -3,7 +3,7 @@ import AudioIcon from '../../icons/iconSrc/attachments/Audio';
|
|
|
3
3
|
import CodeIcon from '../../icons/iconSrc/attachments/Code';
|
|
4
4
|
import ImageIcon from '../../icons/iconSrc/attachments/Image';
|
|
5
5
|
import PdfIcon from '../../icons/iconSrc/attachments/Pdf';
|
|
6
|
-
import TextIcon from '../../icons/iconSrc/attachments/
|
|
6
|
+
import TextIcon from '../../icons/iconSrc/attachments/Text';
|
|
7
7
|
import UnknownIcon from '../../icons/iconSrc/attachments/Unknown';
|
|
8
8
|
import VideoIcon from '../../icons/iconSrc/attachments/Video';
|
|
9
9
|
import ZipIcon from '../../icons/iconSrc/attachments/Zip';
|
|
@@ -32,7 +32,8 @@ const {
|
|
|
32
32
|
} = attachmentFileTypes;
|
|
33
33
|
export default function getAttachmentIconComponent(_ref) {
|
|
34
34
|
let {
|
|
35
|
-
fileFormat
|
|
35
|
+
fileFormat,
|
|
36
|
+
mediaType
|
|
36
37
|
} = _ref;
|
|
37
38
|
const iconMapping = {
|
|
38
39
|
[SVG]: CodeIcon,
|
|
@@ -54,7 +55,7 @@ export default function getAttachmentIconComponent(_ref) {
|
|
|
54
55
|
[ZIP]: ZipIcon,
|
|
55
56
|
[UNDEFINED]: UnknownIcon
|
|
56
57
|
};
|
|
57
|
-
const IconComponent = iconMapping[fileFormat] || iconMapping[UNDEFINED];
|
|
58
|
+
const IconComponent = attachmentFileTypes[mediaType] ? iconMapping[attachmentFileTypes[mediaType]] : iconMapping[fileFormat] || iconMapping[UNDEFINED];
|
|
58
59
|
return {
|
|
59
60
|
IconComponent
|
|
60
61
|
};
|
|
@@ -22,7 +22,8 @@ export default function AudioBubble(props) {
|
|
|
22
22
|
const {
|
|
23
23
|
customStyle,
|
|
24
24
|
audioDetails,
|
|
25
|
-
customProps
|
|
25
|
+
customProps,
|
|
26
|
+
isFailed
|
|
26
27
|
} = props;
|
|
27
28
|
const {
|
|
28
29
|
audioProps = dummyObject,
|
|
@@ -46,7 +47,9 @@ export default function AudioBubble(props) {
|
|
|
46
47
|
return /*#__PURE__*/React.createElement(MediaBubbleWrapper, _extends({
|
|
47
48
|
mediaDetails: audioDetails,
|
|
48
49
|
renderMedia: renderMedia
|
|
49
|
-
}, mediaBubbleWrapperProps
|
|
50
|
+
}, mediaBubbleWrapperProps, {
|
|
51
|
+
isFailed: isFailed
|
|
52
|
+
}));
|
|
50
53
|
}
|
|
51
54
|
AudioBubble.propTypes = audioBubblePropTypes;
|
|
52
55
|
AudioBubble.defaultProps = audioBubbleDefaultProps;
|
|
@@ -15,14 +15,25 @@ import style from './css/ImageBubble.module.css';
|
|
|
15
15
|
|
|
16
16
|
import { Container } from '@zohodesk/components/es/Layout';
|
|
17
17
|
import LazyLoadImage from '../LazyLoadImage/LazyLoadImage';
|
|
18
|
+
/** ** Methods *** */
|
|
19
|
+
|
|
20
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
18
21
|
export default function ImageBubble(props) {
|
|
19
22
|
const {
|
|
20
23
|
customStyle,
|
|
21
|
-
imageDetails
|
|
24
|
+
imageDetails,
|
|
25
|
+
isFailed
|
|
22
26
|
} = props;
|
|
23
27
|
/* External CSS Customization */
|
|
24
28
|
|
|
25
29
|
const newStyle = useMergeStyle(style, customStyle);
|
|
30
|
+
/* css classnames added based on logic */
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
imageBubbleClass
|
|
34
|
+
} = cssJSLogic({
|
|
35
|
+
isFailed
|
|
36
|
+
}, newStyle);
|
|
26
37
|
const imageStyle = useMemo(() => ({
|
|
27
38
|
lazyLoadImage: newStyle.image
|
|
28
39
|
}), [newStyle.image]);
|
|
@@ -37,7 +48,7 @@ export default function ImageBubble(props) {
|
|
|
37
48
|
});
|
|
38
49
|
return /*#__PURE__*/React.createElement(Container, {
|
|
39
50
|
align: "both",
|
|
40
|
-
className:
|
|
51
|
+
className: imageBubbleClass
|
|
41
52
|
}, /*#__PURE__*/React.createElement(LazyLoadImage, {
|
|
42
53
|
alternate: alternate,
|
|
43
54
|
customStyle: blurImageStyle,
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
.imageBubbleWrapper {
|
|
13
13
|
composes: varClass;
|
|
14
|
-
width: var(--imageBubble-wrapper_width);
|
|
14
|
+
width: var(--imageBubble-wrapper_width) !important;
|
|
15
15
|
max-width: var(--imageBubble-wrapper_max_width);
|
|
16
|
-
height: var(--imageBubble-wrapper_height);
|
|
16
|
+
height: var(--imageBubble-wrapper_height) !important;
|
|
17
|
+
color: var(--imlib_chat_components_imageBubble_alt_text_color);
|
|
17
18
|
overflow: hidden;
|
|
18
19
|
position: relative;
|
|
19
20
|
cursor: pointer;
|
|
@@ -21,6 +22,11 @@
|
|
|
21
22
|
border-radius: 3px;
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
.failedImageBubble{
|
|
26
|
+
color: var(--imlib_chat_components_imageBubble_alt_text_color_failed);
|
|
27
|
+
background-color: var(--imlib_chat_components_imageBubble_bg_color_failed);
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
.blurImage {
|
|
25
31
|
object-fit: cover;
|
|
26
32
|
-webkit-filter: blur(90px);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { compileClassNames } from '@zohodesk/utils';
|
|
2
|
+
export default function cssJSLogic(props, style) {
|
|
3
|
+
const {
|
|
4
|
+
isFailed
|
|
5
|
+
} = props;
|
|
6
|
+
const imageBubbleClass = compileClassNames({
|
|
7
|
+
[style.imageBubbleWrapper]: true,
|
|
8
|
+
[style.failedImageBubble]: isFailed
|
|
9
|
+
});
|
|
10
|
+
return {
|
|
11
|
+
imageBubbleClass
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -13,18 +13,29 @@ import { Container, Box } from '@zohodesk/components/es/Layout';
|
|
|
13
13
|
/** ** Styles *** */
|
|
14
14
|
|
|
15
15
|
import style from './css/LocationBubble.module.css';
|
|
16
|
+
/** ** Methods *** */
|
|
17
|
+
|
|
18
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
16
19
|
export default function LocationBubble(props) {
|
|
17
20
|
const {
|
|
18
21
|
customStyle,
|
|
19
|
-
locationUrl
|
|
22
|
+
locationUrl,
|
|
23
|
+
isFailed
|
|
20
24
|
} = props;
|
|
21
25
|
/* External CSS Customization */
|
|
22
26
|
|
|
23
27
|
const newStyle = useMergeStyle(style, customStyle);
|
|
28
|
+
/* css classnames added based on logic */
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
locationBubbleClass
|
|
32
|
+
} = cssJSLogic({
|
|
33
|
+
isFailed
|
|
34
|
+
}, newStyle);
|
|
24
35
|
return /*#__PURE__*/React.createElement(Container, {
|
|
25
36
|
align: "vertical",
|
|
26
37
|
alignBox: "row",
|
|
27
|
-
className:
|
|
38
|
+
className: locationBubbleClass,
|
|
28
39
|
isCover: false
|
|
29
40
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
30
41
|
className: newStyle.imageWrapper,
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
border-radius: 3px;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
.failedLocationBubble{
|
|
17
|
+
background-color: var(--imlib_chat_components_locationBubble_bg_color_failed);
|
|
18
|
+
border-color: var(--imlib_chat_components_locationBubble_border_color_failed);
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
.image {
|
|
17
22
|
width: 100% ;
|
|
18
23
|
height: 100% ;
|
|
@@ -33,5 +38,13 @@
|
|
|
33
38
|
.textLink {
|
|
34
39
|
display: block;
|
|
35
40
|
composes: dotted from "../../css/common.module.css";
|
|
36
|
-
color: var(--
|
|
41
|
+
color: var(--imlib_chat_components_locationBubble_url_color);
|
|
37
42
|
}
|
|
43
|
+
|
|
44
|
+
.failedLocationBubble .textLink{
|
|
45
|
+
color: var(--imlib_chat_components_locationBubble_url_color_failed);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.textLink:hover{
|
|
49
|
+
text-decoration: underline !important;
|
|
50
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { compileClassNames } from '@zohodesk/utils';
|
|
2
|
+
export default function cssJSLogic(props, style) {
|
|
3
|
+
const {
|
|
4
|
+
isFailed
|
|
5
|
+
} = props;
|
|
6
|
+
const locationBubbleClass = compileClassNames({
|
|
7
|
+
[style.locationBubble]: true,
|
|
8
|
+
[style.failedLocationBubble]: isFailed
|
|
9
|
+
});
|
|
10
|
+
return {
|
|
11
|
+
locationBubbleClass
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -25,7 +25,8 @@ export default function MediaBubbleWrapper(props) {
|
|
|
25
25
|
customStyle,
|
|
26
26
|
mediaDetails,
|
|
27
27
|
customProps,
|
|
28
|
-
renderMedia
|
|
28
|
+
renderMedia,
|
|
29
|
+
isFailed
|
|
29
30
|
} = props;
|
|
30
31
|
const {
|
|
31
32
|
attachmentBubbleInfoProps = dummyObject
|
|
@@ -52,7 +53,9 @@ export default function MediaBubbleWrapper(props) {
|
|
|
52
53
|
customStyle: bubbleInfoCustomStyle,
|
|
53
54
|
fileName: fileName,
|
|
54
55
|
fileSize: fileSize
|
|
55
|
-
}, attachmentBubbleInfoProps
|
|
56
|
+
}, attachmentBubbleInfoProps, {
|
|
57
|
+
isFailed: isFailed
|
|
58
|
+
})), mediaComponent);
|
|
56
59
|
}
|
|
57
60
|
MediaBubbleWrapper.propTypes = mediaBubbleWrapperPropTypes;
|
|
58
61
|
MediaBubbleWrapper.defaultProps = mediaBubbleWrapperDefaultProps;
|
|
@@ -11,6 +11,7 @@ const mediaBubbleWrapperPropTypes = {
|
|
|
11
11
|
customProps: PropTypes.shape({
|
|
12
12
|
attachmentBubbleInfoProps: PropTypes.object
|
|
13
13
|
}),
|
|
14
|
-
customStyle: PropTypes.object
|
|
14
|
+
customStyle: PropTypes.object,
|
|
15
|
+
isFailed: PropTypes.bool
|
|
15
16
|
};
|
|
16
17
|
export default mediaBubbleWrapperPropTypes;
|
package/es/Message/Message.js
CHANGED
|
@@ -31,6 +31,7 @@ export default function Message(props) {
|
|
|
31
31
|
actions,
|
|
32
32
|
renderSecondaryActions,
|
|
33
33
|
onSelectAction,
|
|
34
|
+
onMouseEnterAction,
|
|
34
35
|
renderContent,
|
|
35
36
|
customProps
|
|
36
37
|
} = props;
|
|
@@ -103,10 +104,11 @@ export default function Message(props) {
|
|
|
103
104
|
const props = {
|
|
104
105
|
actions,
|
|
105
106
|
onSelect: onSelectAction,
|
|
106
|
-
renderSecondaryActions
|
|
107
|
+
renderSecondaryActions,
|
|
108
|
+
onMouseEnter: onMouseEnterAction
|
|
107
109
|
};
|
|
108
110
|
return /*#__PURE__*/React.createElement(MessageActions, _extends({}, props, messageActionsProps));
|
|
109
|
-
}, [actions, onSelectAction, renderSecondaryActions, messageActionsProps]);
|
|
111
|
+
}, [actions, onSelectAction, onMouseEnterAction, renderSecondaryActions, messageActionsProps]);
|
|
110
112
|
const needMessageActions = !!actions.length;
|
|
111
113
|
return /*#__PURE__*/React.createElement(MessageBubble, _extends({
|
|
112
114
|
direction: direction,
|
|
@@ -16,6 +16,7 @@ export default function MessageAction(props) {
|
|
|
16
16
|
displayText,
|
|
17
17
|
id,
|
|
18
18
|
onClick,
|
|
19
|
+
onMouseEnter,
|
|
19
20
|
isShowInMore,
|
|
20
21
|
iconTitle,
|
|
21
22
|
customProps,
|
|
@@ -44,12 +45,14 @@ export default function MessageAction(props) {
|
|
|
44
45
|
isDisabled: isDisabled,
|
|
45
46
|
needIcon: needMoreActionItemIcon,
|
|
46
47
|
onClick: onClick,
|
|
48
|
+
onMouseEnter: onMouseEnter,
|
|
47
49
|
renderIcon: renderIcon,
|
|
48
50
|
title: iconTitle
|
|
49
51
|
}, moreActionItemProps)) : /*#__PURE__*/React.createElement(ActionIcon, _extends({
|
|
50
52
|
id: id,
|
|
51
53
|
isDisabled: isDisabled,
|
|
52
54
|
onClick: onClick,
|
|
55
|
+
onMouseEnter: onMouseEnter,
|
|
53
56
|
title: iconTitle
|
|
54
57
|
}, actionIconProps));
|
|
55
58
|
}
|
|
@@ -4,6 +4,7 @@ const messageActionPropTypes = {
|
|
|
4
4
|
displayText: PropTypes.string.isRequired,
|
|
5
5
|
id: PropTypes.string.isRequired,
|
|
6
6
|
onClick: PropTypes.func.isRequired,
|
|
7
|
+
onMouseEnter: PropTypes.func,
|
|
7
8
|
closePopup: PropTypes.func,
|
|
8
9
|
customProps: PropTypes.shape({
|
|
9
10
|
actionIconProps: PropTypes.object,
|
|
@@ -30,6 +30,7 @@ export default function MessageActions(props) {
|
|
|
30
30
|
actions,
|
|
31
31
|
defaultShowCount,
|
|
32
32
|
onSelect,
|
|
33
|
+
onMouseEnter,
|
|
33
34
|
renderSecondaryActions,
|
|
34
35
|
customStyle,
|
|
35
36
|
customProps
|
|
@@ -52,6 +53,16 @@ export default function MessageActions(props) {
|
|
|
52
53
|
e
|
|
53
54
|
});
|
|
54
55
|
}, [onSelect]);
|
|
56
|
+
const handleMouseEnterAction = useCallback(_ref2 => {
|
|
57
|
+
let {
|
|
58
|
+
id,
|
|
59
|
+
e
|
|
60
|
+
} = _ref2;
|
|
61
|
+
onMouseEnter && onMouseEnter({
|
|
62
|
+
id,
|
|
63
|
+
e
|
|
64
|
+
});
|
|
65
|
+
}, [onMouseEnter]);
|
|
55
66
|
/* External Action Icon */
|
|
56
67
|
|
|
57
68
|
const renderAction = useCallback(function () {
|
|
@@ -74,9 +85,10 @@ export default function MessageActions(props) {
|
|
|
74
85
|
id: id,
|
|
75
86
|
isDisabled: isDisabled,
|
|
76
87
|
isShowInMore: isShowInMore,
|
|
77
|
-
onClick: handleClickAction
|
|
88
|
+
onClick: handleClickAction,
|
|
89
|
+
onMouseEnter: handleMouseEnterAction
|
|
78
90
|
}, messageActionProps));
|
|
79
|
-
}, [handleClickAction, messageActionProps]);
|
|
91
|
+
}, [handleClickAction, handleMouseEnterAction, messageActionProps]);
|
|
80
92
|
/* Hooks handling */
|
|
81
93
|
|
|
82
94
|
const {
|
|
@@ -12,6 +12,7 @@ const messageActionsPropTypes = {
|
|
|
12
12
|
renderFunction: PropTypes.func
|
|
13
13
|
})).isRequired,
|
|
14
14
|
onSelect: PropTypes.func.isRequired,
|
|
15
|
+
onMouseEnter: PropTypes.func,
|
|
15
16
|
customProps: PropTypes.shape({
|
|
16
17
|
actionIconWrapperProps: PropTypes.object,
|
|
17
18
|
messageActionProps: PropTypes.object,
|