@zohoim/chat-components 0.0.14 → 0.0.16
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 +15 -3
- package/es/ActionIconWrapper/css/ActionIconWrapper.module.css +5 -0
- package/es/ActionIconWrapper/css/cssJSLogic.js +14 -0
- package/es/ActionIconWrapper/props/propTypes.js +1 -0
- package/es/AttachmentBubble/AttachmentBubble.js +26 -9
- package/es/AttachmentBubble/css/AttachmentBubble.module.css +16 -1
- package/es/AttachmentBubble/css/cssJSLogic.js +15 -0
- package/es/AttachmentBubble/props/propTypes.js +2 -1
- package/es/AttachmentBubbleInfo/AttachmentBubbleInfo.js +20 -5
- package/es/AttachmentBubbleInfo/css/AttachmentBubbleInfo.module.css +11 -3
- 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 +12 -5
- package/es/AudioBubble/AudioBubble.js +21 -5
- package/es/AudioBubble/css/AudioBubble.module.css +4 -0
- package/es/AudioBubble/props/defaultProps.js +1 -0
- 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 +15 -3
- package/es/LocationBubble/css/LocationBubble.module.css +17 -5
- package/es/LocationBubble/css/cssJSLogic.js +13 -0
- package/es/LocationBubble/props/propTypes.js +2 -1
- package/es/MediaBubbleWrapper/MediaBubbleWrapper.js +7 -4
- package/es/MediaBubbleWrapper/css/MediaBubbleWrapper.module.css +4 -0
- 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 +18 -4
- package/es/MessageActions/props/propTypes.js +1 -0
- package/es/MessageBox/MessageBox.js +10 -6
- package/es/MessageBox/css/MessageBox.module.css +1 -6
- package/es/MessageBubble/MessageBubble.js +21 -13
- package/es/MessageStatus/css/MessageStatus.module.css +0 -3
- package/es/MoreActionItem/MoreActionItem.js +8 -0
- package/es/MoreActionItem/css/MoreActionItem.module.css +1 -3
- package/es/MoreActionItem/props/propTypes.js +1 -0
- package/es/ReplyBubble/ReplyBubble.js +32 -14
- package/es/ReplyBubble/css/ReplyBubble.module.css +3 -3
- package/es/ReplyBubble/props/propTypes.js +8 -2
- package/es/ReplyBubbleContent/ReplyBubbleContent.js +15 -5
- package/es/ReplyBubbleContent/css/ReplyBubbleContent.module.css +22 -7
- package/es/ReplyBubbleContent/css/cssJSLogic.js +13 -0
- package/es/ReplyBubbleContent/props/propTypes.js +2 -1
- package/es/ReplyBubbleHeader/ReplyBubbleHeader.js +24 -9
- package/es/ReplyBubbleHeader/css/ReplyBubbleHeader.module.css +37 -6
- 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 +17 -5
- package/es/TextBubble/css/TextBubble.module.css +16 -1
- package/es/TextBubble/css/cssJSLogic.js +18 -0
- package/es/TextBubble/props/propTypes.js +2 -1
- package/es/Theme/ThemeWrapper.js +2 -2
- 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 -35
- package/es/Theme/themeVariables/light/commonColorVariable.js +8 -1
- package/es/Theme/themeVariables/light/greenTheme.js +96 -35
- package/es/Theme/themeVariables/light/orangeTheme.js +97 -34
- package/es/Theme/themeVariables/light/redTheme.js +97 -34
- package/es/Theme/themeVariables/light/yellowTheme.js +96 -35
- 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 +7 -3
- package/es/VideoBubble/props/propTypes.js +2 -1
- package/es/css/common.module.css +6 -0
- package/es/icons/factory/common/article.svg +4 -4
- package/es/icons/factory/integrations/chInstagram.svg +2 -2
- package/es/icons/factory/integrations/chWhatsApp.svg +2 -2
- package/es/icons/factory/integrations/ttASAP.svg +6 -1
- package/es/icons/factory/integrations/ttLine.svg +8 -0
- package/es/icons/factory/integrations/ttTelegram.svg +4 -1
- package/es/icons/factory/integrations/ttTwillio.svg +8 -1
- package/es/icons/factory/integrations/ttWechat.svg +9 -1
- package/es/icons/iconSrc/attachments/Text.js +47 -0
- package/es/icons/iconSrc/attachments/index.js +1 -1
- package/es/icons/iconSrc/common/Article.js +2 -3
- package/es/icons/iconSrc/integrations/ChInstagram.js +2 -3
- package/es/icons/iconSrc/integrations/ChWhatsApp.js +2 -3
- package/es/icons/iconSrc/integrations/TtASAP.js +11 -15
- package/es/icons/iconSrc/integrations/{TtTwitter.js → TtLine.js} +14 -18
- package/es/icons/iconSrc/integrations/TtTelegram.js +8 -12
- package/es/icons/iconSrc/integrations/TtTwillio.js +15 -19
- package/es/icons/iconSrc/integrations/TtWechat.js +19 -20
- package/es/icons/iconSrc/integrations/index.js +1 -1
- package/es/im/ArticleBubble/ArticleBubble.js +22 -8
- package/es/im/ArticleBubble/css/ArticleBubble.module.css +40 -15
- 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/IMIntegrationIcon.js +1 -1
- package/es/im/IMIntegrationIcon/css/IMIntegrationIcon.module.css +1 -6
- package/es/im/IMMessage/IMMessage.js +57 -11
- package/es/im/{IMTicketLink/css/IMTicketLink.module.css → IMMessage/css/IMMessage.module.css} +21 -11
- package/es/im/IMMessage/css/cssJSLogic.js +23 -0
- package/es/im/IMMessage/props/defaultProps.js +2 -1
- package/es/im/IMMessage/props/propTypes.js +28 -2
- package/es/im/IMMessageContent/IMMessageContent.js +41 -42
- package/es/im/IMMessageContent/css/IMMessageContent.module.css +6 -2
- package/es/im/IMMessageContent/props/propTypes.js +8 -2
- package/es/im/IMMessageMeta/IMMessageMeta.js +8 -8
- package/es/im/IMMessageMeta/css/IMMessageMeta.module.css +2 -4
- package/es/im/IMMessageMeta/props/defaultProps.js +1 -1
- package/es/im/IMPermaLink/IMPermaLink.js +48 -0
- package/es/im/IMPermaLink/css/IMPermaLink.module.css +14 -0
- package/es/im/{IMTicketLink → IMPermaLink}/css/cssJSLogic.js +3 -3
- package/es/im/IMPermaLink/index.js +1 -0
- package/es/{InfoBubble → im/IMPermaLink}/props/defaultProps.js +2 -2
- package/es/im/IMPermaLink/props/propTypes.js +11 -0
- 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 +6 -0
- package/es/im/index.js +1 -2
- 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/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/icons/factory/integrations/ttTwitter.svg +0 -1
- 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/im/IMTicketLink/IMTicketLink.js +0 -48
- package/es/im/IMTicketLink/index.js +0 -1
- package/es/im/IMTicketLink/props/defaultProps.js +0 -6
- package/es/im/IMTicketLink/props/propTypes.js +0 -11
- /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));
|
|
@@ -11,6 +11,7 @@ import actionIconWrapperPropTypes from './props/propTypes';
|
|
|
11
11
|
/** ** Methods *** */
|
|
12
12
|
|
|
13
13
|
import renderHandler from '@zohoim/chat-components-utils/es/common/renderHandler';
|
|
14
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
14
15
|
/** ** Styles *** */
|
|
15
16
|
|
|
16
17
|
import style from './css/ActionIconWrapper.module.css';
|
|
@@ -19,29 +20,40 @@ export default function ActionIconWrapper(props) {
|
|
|
19
20
|
renderIcon,
|
|
20
21
|
customStyle,
|
|
21
22
|
onClick: propOnClick,
|
|
23
|
+
onMouseEnter: propOnMouseEnter,
|
|
22
24
|
id,
|
|
23
25
|
title,
|
|
24
26
|
isDisabled
|
|
25
27
|
} = props;
|
|
26
28
|
const {
|
|
27
|
-
onClick
|
|
29
|
+
onClick,
|
|
30
|
+
onMouseEnter
|
|
28
31
|
} = useActionIconWrapper({
|
|
29
32
|
onClick: propOnClick,
|
|
33
|
+
onMouseEnter: propOnMouseEnter,
|
|
30
34
|
id,
|
|
31
35
|
isDisabled
|
|
32
36
|
});
|
|
33
37
|
/* External CSS Customization */
|
|
34
38
|
|
|
35
39
|
const newStyle = useMergeStyle(style, customStyle);
|
|
40
|
+
/* css classnames added based on logic */
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
actionIconWrapperClass
|
|
44
|
+
} = cssJSLogic({
|
|
45
|
+
isDisabled
|
|
46
|
+
}, newStyle);
|
|
36
47
|
/* Render Icon */
|
|
37
48
|
|
|
38
49
|
const icon = renderHandler(renderIcon)({
|
|
39
50
|
id
|
|
40
51
|
});
|
|
41
52
|
return icon ? /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
className:
|
|
53
|
+
className: actionIconWrapperClass,
|
|
43
54
|
"data-title": title,
|
|
44
|
-
onClick: onClick
|
|
55
|
+
onClick: onClick,
|
|
56
|
+
onMouseEnter: onMouseEnter
|
|
45
57
|
}, icon) : null;
|
|
46
58
|
}
|
|
47
59
|
ActionIconWrapper.propTypes = actionIconWrapperPropTypes;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** ** Methods *** */
|
|
2
|
+
import { compileClassNames } from '@zohodesk/utils';
|
|
3
|
+
export default function cssJSLogic(props, style) {
|
|
4
|
+
const {
|
|
5
|
+
isDisabled
|
|
6
|
+
} = props;
|
|
7
|
+
const actionIconWrapperClass = compileClassNames({
|
|
8
|
+
[style.actionIconWrapper]: true,
|
|
9
|
+
[style.disabled]: isDisabled
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
actionIconWrapperClass
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -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,40 +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:
|
|
44
|
-
|
|
56
|
+
className: attachmentBubbleClass,
|
|
57
|
+
isCover: false
|
|
58
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
45
59
|
className: newStyle.attachmentBubbleIcon
|
|
46
60
|
}, /*#__PURE__*/React.createElement(AttachmentIcon, _extends({
|
|
47
|
-
fileFormat: fileFormat
|
|
61
|
+
fileFormat: fileFormat,
|
|
62
|
+
mediaType: mediaType
|
|
48
63
|
}, attachmentIconProps))), /*#__PURE__*/React.createElement(Box, {
|
|
49
64
|
className: newStyle.attachmentBubbleContent,
|
|
50
65
|
flexible: true
|
|
51
66
|
}, /*#__PURE__*/React.createElement(AttachmentBubbleInfo, _extends({
|
|
52
67
|
fileName: fileName,
|
|
53
68
|
fileSize: fileSize
|
|
54
|
-
}, attachmentBubbleInfoProps
|
|
69
|
+
}, attachmentBubbleInfoProps, {
|
|
70
|
+
isFailed: isFailed
|
|
71
|
+
}))));
|
|
55
72
|
}
|
|
56
73
|
AttachmentBubble.propTypes = attachmentBubblePropTypes;
|
|
57
74
|
AttachmentBubble.defaultProps = attachmentBubbleDefaultProps;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
.attachmentBubble {
|
|
2
|
+
width: 100% ;
|
|
2
3
|
background-color: var(--imlib_chat_components_attachmentBubble_bg_color);
|
|
3
4
|
border-radius: 3px;
|
|
4
5
|
border: 1px solid var(--imlib_chat_components_attachmentBubble_border_color);
|
|
5
6
|
}
|
|
6
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
|
+
|
|
7
17
|
.attachmentBubbleIcon {
|
|
8
18
|
width: var(--zd_size60) ;
|
|
9
19
|
display: flex;
|
|
@@ -20,6 +30,11 @@
|
|
|
20
30
|
border-left: 1px solid var(--imlib_chat_components_attachmentBubble_border_color);
|
|
21
31
|
}
|
|
22
32
|
|
|
33
|
+
.failedAttachmentBubble .attachmentBubbleIcon{
|
|
34
|
+
border-color: var(--imlib_chat_components_attachmentBubble_border_color_failed);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
23
38
|
.attachmentBubbleIcon, .attachmentBubbleContent {
|
|
24
39
|
padding: var(--zd_size10) ;
|
|
25
|
-
}
|
|
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;
|
|
@@ -7,23 +7,38 @@ import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
|
7
7
|
|
|
8
8
|
import attachmentBubbleInfoDefaultProps from './props/defaultProps';
|
|
9
9
|
import attachmentBubbleInfoPropTypes from './props/propTypes';
|
|
10
|
+
/** ** Components *** */
|
|
11
|
+
|
|
12
|
+
import { Container, Box } from '@zohodesk/components/es/Layout';
|
|
10
13
|
/** ** Styles *** */
|
|
11
14
|
|
|
12
15
|
import style from './css/AttachmentBubbleInfo.module.css';
|
|
16
|
+
/** ** Methods *** */
|
|
17
|
+
|
|
18
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
13
19
|
export default function AttachmentBubbleInfo(props) {
|
|
14
20
|
const {
|
|
15
21
|
customStyle,
|
|
16
22
|
fileName,
|
|
17
|
-
fileSize
|
|
23
|
+
fileSize,
|
|
24
|
+
isFailed
|
|
18
25
|
} = props;
|
|
19
26
|
/* External css customization */
|
|
20
27
|
|
|
21
28
|
const newStyle = useMergeStyle(style, customStyle);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
/* css classnames added based on logic */
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
attachmentBubbleInfoClass
|
|
33
|
+
} = cssJSLogic({
|
|
34
|
+
isFailed
|
|
35
|
+
}, newStyle);
|
|
36
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
37
|
+
className: attachmentBubbleInfoClass,
|
|
38
|
+
isCover: false
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
25
40
|
className: newStyle.fileName
|
|
26
|
-
}, fileName), /*#__PURE__*/React.createElement(
|
|
41
|
+
}, fileName), /*#__PURE__*/React.createElement(Box, {
|
|
27
42
|
className: newStyle.fileSize
|
|
28
43
|
}, fileSize));
|
|
29
44
|
}
|
|
@@ -12,19 +12,27 @@
|
|
|
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
|
-
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
text-overflow: ellipsis;
|
|
31
|
+
composes: dotted from "../../css/common.module.css";
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
.attachmentBubbleInfo {
|
|
35
|
+
width: 100% ;
|
|
29
36
|
/* Use this class name for css customization */
|
|
30
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';
|
|
@@ -17,6 +17,9 @@ const {
|
|
|
17
17
|
AUDIO,
|
|
18
18
|
VIDEO,
|
|
19
19
|
MP3,
|
|
20
|
+
MPEG,
|
|
21
|
+
VORBIS,
|
|
22
|
+
OGG,
|
|
20
23
|
M4A,
|
|
21
24
|
MP4,
|
|
22
25
|
HTML,
|
|
@@ -29,26 +32,30 @@ const {
|
|
|
29
32
|
} = attachmentFileTypes;
|
|
30
33
|
export default function getAttachmentIconComponent(_ref) {
|
|
31
34
|
let {
|
|
32
|
-
fileFormat
|
|
35
|
+
fileFormat,
|
|
36
|
+
mediaType
|
|
33
37
|
} = _ref;
|
|
34
38
|
const iconMapping = {
|
|
35
|
-
[SVG]:
|
|
39
|
+
[SVG]: CodeIcon,
|
|
36
40
|
[IMAGE]: ImageIcon,
|
|
37
41
|
[PDF]: PdfIcon,
|
|
38
42
|
[AUDIO]: AudioIcon,
|
|
39
43
|
[VIDEO]: VideoIcon,
|
|
40
44
|
[MP3]: AudioIcon,
|
|
45
|
+
[MPEG]: AudioIcon,
|
|
46
|
+
[VORBIS]: AudioIcon,
|
|
47
|
+
[OGG]: AudioIcon,
|
|
41
48
|
[M4A]: AudioIcon,
|
|
42
49
|
[MP4]: VideoIcon,
|
|
43
50
|
[HTML]: CodeIcon,
|
|
44
51
|
[PSD]: UnknownIcon,
|
|
45
52
|
[CSS]: CodeIcon,
|
|
46
53
|
[TEXT]: TextIcon,
|
|
47
|
-
[PLAIN]:
|
|
54
|
+
[PLAIN]: TextIcon,
|
|
48
55
|
[ZIP]: ZipIcon,
|
|
49
56
|
[UNDEFINED]: UnknownIcon
|
|
50
57
|
};
|
|
51
|
-
const IconComponent = iconMapping[fileFormat];
|
|
58
|
+
const IconComponent = attachmentFileTypes[mediaType] ? iconMapping[attachmentFileTypes[mediaType]] : iconMapping[fileFormat] || iconMapping[UNDEFINED];
|
|
52
59
|
return {
|
|
53
60
|
IconComponent
|
|
54
61
|
};
|
|
@@ -2,38 +2,54 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
|
|
3
3
|
/** ** Libraries *** */
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
|
+
/** ** Hooks *** */
|
|
6
|
+
|
|
7
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
5
8
|
/** ** Constants *** */
|
|
6
9
|
|
|
7
10
|
import audioBubbleDefaultProps from './props/defaultProps';
|
|
8
11
|
import audioBubblePropTypes from './props/propTypes';
|
|
9
12
|
import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
|
|
13
|
+
/** ** Styles *** */
|
|
14
|
+
|
|
15
|
+
import style from './css/AudioBubble.module.css';
|
|
10
16
|
/** ** Components *** */
|
|
11
17
|
|
|
18
|
+
import { Box } from '@zohodesk/components/es/Layout';
|
|
12
19
|
import MediaBubbleWrapper from '../MediaBubbleWrapper/MediaBubbleWrapper';
|
|
13
20
|
import Audio from '../Audio/Audio';
|
|
14
21
|
export default function AudioBubble(props) {
|
|
15
22
|
const {
|
|
23
|
+
customStyle,
|
|
16
24
|
audioDetails,
|
|
17
|
-
customProps
|
|
25
|
+
customProps,
|
|
26
|
+
isFailed
|
|
18
27
|
} = props;
|
|
19
28
|
const {
|
|
20
29
|
audioProps = dummyObject,
|
|
21
30
|
mediaBubbleWrapperProps = dummyObject
|
|
22
31
|
} = customProps;
|
|
32
|
+
/* External CSS Customization */
|
|
33
|
+
|
|
34
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
23
35
|
const renderMedia = useCallback(_ref => {
|
|
24
36
|
let {
|
|
25
37
|
fileURL,
|
|
26
38
|
fileType
|
|
27
39
|
} = _ref;
|
|
28
|
-
return /*#__PURE__*/React.createElement(
|
|
40
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
41
|
+
className: newStyle.audioBubble
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Audio, _extends({
|
|
29
43
|
fileType: fileType,
|
|
30
44
|
fileURL: fileURL
|
|
31
|
-
}, audioProps));
|
|
32
|
-
}, [audioProps]);
|
|
45
|
+
}, audioProps)));
|
|
46
|
+
}, [audioProps, newStyle.audioBubble]);
|
|
33
47
|
return /*#__PURE__*/React.createElement(MediaBubbleWrapper, _extends({
|
|
34
48
|
mediaDetails: audioDetails,
|
|
35
49
|
renderMedia: renderMedia
|
|
36
|
-
}, mediaBubbleWrapperProps
|
|
50
|
+
}, mediaBubbleWrapperProps, {
|
|
51
|
+
isFailed: isFailed
|
|
52
|
+
}));
|
|
37
53
|
}
|
|
38
54
|
AudioBubble.propTypes = audioBubblePropTypes;
|
|
39
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,30 @@ 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,
|
|
39
|
+
isCover: false
|
|
28
40
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
29
41
|
className: newStyle.imageWrapper,
|
|
30
42
|
shrink: true
|
|
@@ -32,7 +44,7 @@ export default function LocationBubble(props) {
|
|
|
32
44
|
href: locationUrl,
|
|
33
45
|
rel: "noreferrer noopener",
|
|
34
46
|
target: "_blank"
|
|
35
|
-
}, /*#__PURE__*/React.createElement(
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
36
48
|
className: newStyle.image
|
|
37
49
|
}))), /*#__PURE__*/React.createElement(Box, {
|
|
38
50
|
className: newStyle.textWrapper,
|