@zohoim/chat-components 0.0.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.
- package/README.md +9 -0
- package/es/ActionIcon/ActionIcon.js +45 -0
- package/es/ActionIcon/css/ActionIcon.module.css +28 -0
- package/es/ActionIcon/css/cssJSLogic.js +9 -0
- package/es/ActionIcon/index.js +1 -0
- package/es/ActionIcon/props/defaultProps.js +4 -0
- package/es/ActionIcon/props/propTypes.js +8 -0
- package/es/AvatarSpace/AvatarSpace.js +35 -0
- package/es/AvatarSpace/css/AvatarSpace.module.css +1 -0
- package/es/AvatarSpace/css/cssJSLogic.js +15 -0
- package/es/AvatarSpace/index.js +1 -0
- package/es/AvatarSpace/props/defaultProps.js +10 -0
- package/es/AvatarSpace/props/propConstants.js +7 -0
- package/es/AvatarSpace/props/propTypes.js +8 -0
- package/es/MessageActions/MessageActions.js +52 -0
- package/es/MessageActions/css/MessageActions.module.css +0 -0
- package/es/MessageActions/css/cssJSLogic.js +0 -0
- package/es/MessageActions/index.js +2 -0
- package/es/MessageActions/props/defaultProps.js +7 -0
- package/es/MessageActions/props/propConstants.js +5 -0
- package/es/MessageActions/props/propTypes.js +8 -0
- package/es/MessageActionsMore/MessageActionsMore.js +71 -0
- package/es/MessageActionsMore/css/MessageActionsMore.module.css +3 -0
- package/es/MessageActionsMore/css/cssJsLogic.js +0 -0
- package/es/MessageActionsMore/index.js +1 -0
- package/es/MessageActionsMore/props/defaultProps.js +4 -0
- package/es/MessageActionsMore/props/propTypes.js +6 -0
- package/es/MessageBox/MessageBox.js +60 -0
- package/es/MessageBox/css/MessageBox.module.css +38 -0
- package/es/MessageBox/css/cssJSLogic.js +25 -0
- package/es/MessageBox/index.js +2 -0
- package/es/MessageBox/props/defaultProps.js +3 -0
- package/es/MessageBox/props/propTypes.js +8 -0
- package/es/MessageBoxFooter/MessageBoxFooter.js +32 -0
- package/es/MessageBoxFooter/css/MessageBoxFooter.module.css +1 -0
- package/es/MessageBoxFooter/css/cssJsLogic.js +0 -0
- package/es/MessageBoxFooter/index.js +2 -0
- package/es/MessageBoxFooter/props/defaultProps.js +3 -0
- package/es/MessageBoxFooter/props/propTypes.js +5 -0
- package/es/MessageBoxHeader/MessageBoxHeader.js +7 -0
- package/es/MessageBoxHeader/css/MessageBoxHeader.module.css +0 -0
- package/es/MessageBoxHeader/css/cssJsLogic.js +0 -0
- package/es/MessageBoxHeader/index.js +2 -0
- package/es/MessageBoxHeader/props/defaultProps.js +0 -0
- package/es/MessageBoxHeader/props/propTypes.js +0 -0
- package/es/MessageBubble/MessageBubble.js +82 -0
- package/es/MessageBubble/css/MessageBubble.module.css +66 -0
- package/es/MessageBubble/css/cssJSLogic.js +49 -0
- package/es/MessageBubble/index.js +2 -0
- package/es/MessageBubble/props/defaultProps.js +9 -0
- package/es/MessageBubble/props/propConstants.js +6 -0
- package/es/MessageBubble/props/propTypes.js +16 -0
- package/es/TextMessage/DefaultActions.js +61 -0
- package/es/TextMessage/TextMessage.js +67 -0
- package/es/TextMessage/TextMessage1.js +69 -0
- package/es/TextMessage/css/TextMessage.module.css +5 -0
- package/es/TextMessage/css/cssJSLogic.js +0 -0
- package/es/TextMessage/index.js +1 -0
- package/es/TextMessage/props/defaultProps.js +4 -0
- package/es/TextMessage/props/propConstants.js +3 -0
- package/es/TextMessage/props/propTypes.js +17 -0
- package/es/Theme/darkTheme.js +9 -0
- package/es/Theme/defaultTheme.js +16 -0
- package/es/constants/index.js +1 -0
- package/es/index.js +13 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
|
|
3
|
+
/** ** Libraries *** */
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
/** ** Hooks *** */
|
|
7
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
8
|
+
|
|
9
|
+
/** ** Constants *** */
|
|
10
|
+
import actionIconDefaultProps from './props/defaultProps';
|
|
11
|
+
import actionIconPropTypes from './props/propTypes';
|
|
12
|
+
|
|
13
|
+
/** ** Methods *** */
|
|
14
|
+
import renderHandler from '@zohoim/chat-components-utils/es/renderHandler';
|
|
15
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
16
|
+
|
|
17
|
+
/** ** Styles *** */
|
|
18
|
+
import style from './css/ActionIcon.module.css';
|
|
19
|
+
export default function ActionIcon(props) {
|
|
20
|
+
const {
|
|
21
|
+
renderIcon,
|
|
22
|
+
customStyle,
|
|
23
|
+
onClick,
|
|
24
|
+
id
|
|
25
|
+
} = props;
|
|
26
|
+
function handleClick() {
|
|
27
|
+
onClick && onClick(id);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* external customization */
|
|
31
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
32
|
+
/* css classnames added based on logic */
|
|
33
|
+
const {
|
|
34
|
+
actionIconClass
|
|
35
|
+
} = cssJSLogic(props, newStyle);
|
|
36
|
+
const icon = renderHandler(renderIcon)();
|
|
37
|
+
return icon ? /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
onClick: handleClick,
|
|
39
|
+
className: actionIconClass
|
|
40
|
+
}, icon) : null;
|
|
41
|
+
}
|
|
42
|
+
ActionIcon.propTypes = actionIconPropTypes;
|
|
43
|
+
ActionIcon.defaultProps = actionIconDefaultProps;
|
|
44
|
+
ActionIcon.displayName = 'ActionIcon';
|
|
45
|
+
// ActionIcons.constantProps = constantProps;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.varClass {
|
|
2
|
+
--actionIcon-height: var(--imlib_size_26);
|
|
3
|
+
--actionIcon-width: var(--imlib_size_26);
|
|
4
|
+
--actionIcon-border: var(--imlib_size_1);
|
|
5
|
+
--actionIcon-border_radius: var(--imlib_size_4);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.actionIcon {
|
|
9
|
+
composes: varClass;
|
|
10
|
+
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
display: -webkit-inline-flex;
|
|
13
|
+
display: -ms-inline-flexbox;
|
|
14
|
+
color: var(--imlib_chat_components_actionIcon_color);
|
|
15
|
+
position: relative;
|
|
16
|
+
width: var(--actionIcon-width);
|
|
17
|
+
height: var(--actionIcon-height);
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
border: var(--actionIcon-border) solid transparent;
|
|
22
|
+
border-radius: var(--actionIcon-border_radius);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.actionIcon:hover {
|
|
26
|
+
background-color: var(--imlib_chat_components_actionIcon_bg_color);
|
|
27
|
+
border-color: var(--imlib_chat_components_actionIcon_border_color);
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ActionIcon } from './ActionIcon';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
|
|
3
|
+
/** ** Libraries *** */
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
/** ** Components *** */
|
|
7
|
+
import Avatar from '@zohodesk/components/es/Avatar/Avatar';
|
|
8
|
+
|
|
9
|
+
/** ** CSS *** */
|
|
10
|
+
import style from './css/AvatarSpace.module.css';
|
|
11
|
+
|
|
12
|
+
/** ** Methods *** */
|
|
13
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
14
|
+
|
|
15
|
+
/** ** Constants *** */
|
|
16
|
+
import avatarSpaceDefaultProps from './props/defaultProps';
|
|
17
|
+
import avatarSpacePropTypes from './props/propTypes';
|
|
18
|
+
import constantProps from './props/propConstants';
|
|
19
|
+
export default function AvatarSpace(props) {
|
|
20
|
+
const {
|
|
21
|
+
needAvatar,
|
|
22
|
+
avatarProps,
|
|
23
|
+
customStyle
|
|
24
|
+
} = props;
|
|
25
|
+
|
|
26
|
+
/* external customization */
|
|
27
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
28
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: newStyle.dp
|
|
30
|
+
}, needAvatar ? /*#__PURE__*/React.createElement(Avatar, avatarProps) : null);
|
|
31
|
+
}
|
|
32
|
+
AvatarSpace.propTypes = avatarSpacePropTypes;
|
|
33
|
+
AvatarSpace.defaultProps = avatarSpaceDefaultProps;
|
|
34
|
+
AvatarSpace.constantProps = constantProps;
|
|
35
|
+
AvatarSpace.displayName = 'AvatarSpace';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { compileClassNames } from '@zohodesk/utils';
|
|
2
|
+
import propConstants from '../props/propConstants';
|
|
3
|
+
export default function cssJSLogic(props, style) {
|
|
4
|
+
const {
|
|
5
|
+
avatarPosition
|
|
6
|
+
} = props;
|
|
7
|
+
const positionClass = compileClassNames({
|
|
8
|
+
[style.avatarTop]: avatarPosition === propConstants.position.top,
|
|
9
|
+
[style.avatarBottom]: avatarPosition === propConstants.position.bottom,
|
|
10
|
+
[style.avatarMiddle]: avatarPosition === propConstants.position.middle
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
positionClass
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AvatarSpace } from './AvatarSpace';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/** ** Components *** */
|
|
5
|
+
import { Container } from '@zohodesk/components/lib/Layout';
|
|
6
|
+
import { MessageActionsMore } from '..';
|
|
7
|
+
|
|
8
|
+
/** ** Hooks *** */
|
|
9
|
+
import { useMessageAction } from '@zohoim/chat-components-hooks';
|
|
10
|
+
|
|
11
|
+
/** ** Constants *** */
|
|
12
|
+
import messageActionsDefaultProps from './props/defaultProps';
|
|
13
|
+
import messageActionsPropTypes from './props/propTypes';
|
|
14
|
+
import constantProps from './props/propConstants';
|
|
15
|
+
|
|
16
|
+
/** ** Methods *** */
|
|
17
|
+
import renderHandler from '@zohoim/chat-components-utils/es/renderHandler';
|
|
18
|
+
function MessageActions(props) {
|
|
19
|
+
const {
|
|
20
|
+
actions,
|
|
21
|
+
renderMoreIcon,
|
|
22
|
+
moreCount
|
|
23
|
+
} = props;
|
|
24
|
+
const {
|
|
25
|
+
isShowMore: isShowMoreIcon,
|
|
26
|
+
revampedActions = []
|
|
27
|
+
} = useMessageAction(actions, moreCount);
|
|
28
|
+
const {
|
|
29
|
+
defaultActions = [],
|
|
30
|
+
moreActions
|
|
31
|
+
} = revampedActions;
|
|
32
|
+
function renderRow(defaultActions, isShowMore) {
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Container, {
|
|
34
|
+
alignBox: "row"
|
|
35
|
+
}, defaultActions.map(action => {
|
|
36
|
+
const {
|
|
37
|
+
id,
|
|
38
|
+
renderFunction
|
|
39
|
+
} = action;
|
|
40
|
+
return renderHandler(renderFunction)(id, false); // id, isRenderInMorePopup
|
|
41
|
+
}), isShowMore ? /*#__PURE__*/React.createElement(MessageActionsMore, {
|
|
42
|
+
actions: moreActions,
|
|
43
|
+
renderMoreIcon: renderMoreIcon
|
|
44
|
+
}) : null));
|
|
45
|
+
}
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", null, renderRow(defaultActions, isShowMoreIcon));
|
|
47
|
+
}
|
|
48
|
+
MessageActions.defaultProps = messageActionsDefaultProps;
|
|
49
|
+
MessageActions.propTypes = messageActionsPropTypes;
|
|
50
|
+
MessageActions.constantProps = constantProps;
|
|
51
|
+
MessageActions.displayName = 'MessageActions';
|
|
52
|
+
export default MessageActions;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
2
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
3
|
+
/* eslint-disable max-len */
|
|
4
|
+
|
|
5
|
+
/** ** Libraries *** */
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
/** ** Components *** */
|
|
9
|
+
import Popup from '@zohodesk/components/lib/Popup/Popup';
|
|
10
|
+
import DropBox from '@zohodesk/components/lib/DropBox/DropBox';
|
|
11
|
+
|
|
12
|
+
/** ** Constants *** */
|
|
13
|
+
import messageActionsMoreDefaultProps from './props/defaultProps';
|
|
14
|
+
import messageActionsMorePropTypes from './props/propTypes';
|
|
15
|
+
import { MSG_ACTION_POPUP_PORTAL } from '../constants';
|
|
16
|
+
|
|
17
|
+
/** ** Methods *** */
|
|
18
|
+
import renderHandler from '@zohoim/chat-components-utils/es/renderHandler';
|
|
19
|
+
|
|
20
|
+
/** ** Styles *** */
|
|
21
|
+
import style from './css/MessageActionsMore.module.css';
|
|
22
|
+
function MessageActionsMoreComp(props) {
|
|
23
|
+
const {
|
|
24
|
+
actions,
|
|
25
|
+
renderMoreIcon,
|
|
26
|
+
customStyle,
|
|
27
|
+
/**** Popup Props ****/
|
|
28
|
+
getTargetRef,
|
|
29
|
+
getContainerRef,
|
|
30
|
+
position,
|
|
31
|
+
togglePopup,
|
|
32
|
+
isPopupReady,
|
|
33
|
+
isPopupOpen,
|
|
34
|
+
removeClose,
|
|
35
|
+
isAbsolutePositioningNeeded,
|
|
36
|
+
positionsOffset
|
|
37
|
+
} = props;
|
|
38
|
+
const moreIcon = renderHandler(renderMoreIcon)();
|
|
39
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
40
|
+
className: style.container
|
|
41
|
+
}, moreIcon ? /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
onClick: togglePopup,
|
|
43
|
+
ref: getTargetRef
|
|
44
|
+
}, moreIcon) : null, isPopupOpen ? /*#__PURE__*/React.createElement(DropBox, {
|
|
45
|
+
boxPosition: position,
|
|
46
|
+
getRef: getContainerRef,
|
|
47
|
+
isActive: isPopupReady,
|
|
48
|
+
isAnimate: true,
|
|
49
|
+
isArrow: false,
|
|
50
|
+
onClick: removeClose,
|
|
51
|
+
isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
|
|
52
|
+
positionMapping: positionsOffset,
|
|
53
|
+
positionsOffset: positionsOffset,
|
|
54
|
+
portalId: MSG_ACTION_POPUP_PORTAL,
|
|
55
|
+
size: "small"
|
|
56
|
+
// isModel
|
|
57
|
+
}, actions.map(action => {
|
|
58
|
+
const {
|
|
59
|
+
id,
|
|
60
|
+
renderFunction
|
|
61
|
+
} = action;
|
|
62
|
+
return renderHandler(renderFunction)(id, true); // id, isRenderInMorePopup
|
|
63
|
+
})) : null);
|
|
64
|
+
}
|
|
65
|
+
const MessageActionsMore = Popup(MessageActionsMoreComp, '', '', {
|
|
66
|
+
isAbsolutePositioningNeeded: false
|
|
67
|
+
});
|
|
68
|
+
MessageActionsMore.defaultProps = messageActionsMoreDefaultProps;
|
|
69
|
+
MessageActionsMore.propTypes = messageActionsMorePropTypes;
|
|
70
|
+
MessageActionsMore.displayName = 'MessageActionsMore';
|
|
71
|
+
export default MessageActionsMore;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MessageActionsMore } from './MessageActionsMore';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
|
|
3
|
+
/** ** Libraries *** */
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
/** ** Hooks *** */
|
|
7
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
8
|
+
|
|
9
|
+
/** ** Constants *** */
|
|
10
|
+
import messageBoxDefaultProps from './props/defaultProps';
|
|
11
|
+
import messageBoxPropTypes from './props/propTypes';
|
|
12
|
+
|
|
13
|
+
/** ** Methods *** */
|
|
14
|
+
import renderHandler from '@zohoim/chat-components-utils/es/renderHandler';
|
|
15
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
16
|
+
|
|
17
|
+
/** ** Styles *** */
|
|
18
|
+
import style from './css/MessageBox.module.css';
|
|
19
|
+
function MessageBox(props) {
|
|
20
|
+
const {
|
|
21
|
+
renderMessage: renderMessageContent,
|
|
22
|
+
renderMessageFooter,
|
|
23
|
+
renderMessageHeader,
|
|
24
|
+
customStyle,
|
|
25
|
+
renderMessageStatus
|
|
26
|
+
} = props;
|
|
27
|
+
|
|
28
|
+
/* external customization */
|
|
29
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
30
|
+
|
|
31
|
+
/* css classnames added based on logic */
|
|
32
|
+
const {
|
|
33
|
+
messageBoxClass,
|
|
34
|
+
messageContentWrapperClass,
|
|
35
|
+
messageHeaderWrapperClass,
|
|
36
|
+
messageFooterWrapperClass,
|
|
37
|
+
messageStatusWrapperClass
|
|
38
|
+
} = cssJSLogic(props, newStyle);
|
|
39
|
+
|
|
40
|
+
/* Render Childrens */
|
|
41
|
+
const messageHeader = renderHandler(renderMessageHeader)();
|
|
42
|
+
const messageConent = renderHandler(renderMessageContent)();
|
|
43
|
+
const messageFooter = renderHandler(renderMessageFooter)();
|
|
44
|
+
const messageStatus = renderHandler(renderMessageStatus)();
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: messageBoxClass
|
|
47
|
+
}, /*#__PURE__*/React.createElement("div", null, messageHeader ? /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: messageHeaderWrapperClass
|
|
49
|
+
}, messageHeader) : null, messageConent ? /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: messageContentWrapperClass
|
|
51
|
+
}, messageConent) : null, messageFooter ? /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: messageFooterWrapperClass
|
|
53
|
+
}, messageFooter) : null), messageStatus ? /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: messageStatusWrapperClass
|
|
55
|
+
}, messageStatus) : null);
|
|
56
|
+
}
|
|
57
|
+
MessageBox.propTypes = messageBoxPropTypes;
|
|
58
|
+
MessageBox.defaultProps = messageBoxDefaultProps;
|
|
59
|
+
MessageBox.displayName = 'MessageBox';
|
|
60
|
+
export default MessageBox;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.varClass {
|
|
2
|
+
--messageBox-content_padding: var(--imlib_size_14);
|
|
3
|
+
--messageBox-border_radius: var(--imlib_size_9);
|
|
4
|
+
--messageBox-message_status_gap: var(--imlib_size_12);
|
|
5
|
+
--messageBox-message_header_gap: var(--imlib_size_1);
|
|
6
|
+
--messageBox-message_footer_gap: var(--imlib_size_1);
|
|
7
|
+
/* --messageBox-max_width: var(--imlib_size_410); */
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.messageBoxContainer {
|
|
11
|
+
composes: varClass;
|
|
12
|
+
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
align-items: flex-end;
|
|
16
|
+
/* max-width: var(--messageBox-max_width); */
|
|
17
|
+
word-wrap: break-word;
|
|
18
|
+
|
|
19
|
+
background-color: var(--imlib_chat_components_messageBox_bg_color);
|
|
20
|
+
padding: var(--messageBox-content_padding);
|
|
21
|
+
border-radius: var(--messageBox-border_radius);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.messageHeaderWrapper {
|
|
25
|
+
margin-bottom: var(--messageBox-message_header_gap);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.messageFooterWrapper {
|
|
29
|
+
margin-top: var(--messageBox-message_footer_gap);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[dir=ltr] .messageStatusWrapper {
|
|
33
|
+
margin-left: var(--messageBox-message_status_gap);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[dir=rtl] .messageStatusWrapper {
|
|
37
|
+
margin-right: var(--messageBox-message_status_gap);
|
|
38
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { compileClassNames } from '@zohodesk/utils';
|
|
2
|
+
export default function cssJSLogic(props, style) {
|
|
3
|
+
const messageBoxClass = compileClassNames({
|
|
4
|
+
[style.messageBoxContainer]: true
|
|
5
|
+
});
|
|
6
|
+
const messageContentWrapperClass = compileClassNames({
|
|
7
|
+
[style.messageContentWrapper]: true
|
|
8
|
+
});
|
|
9
|
+
const messageHeaderWrapperClass = compileClassNames({
|
|
10
|
+
[style.messageHeaderWrapper]: true
|
|
11
|
+
});
|
|
12
|
+
const messageFooterWrapperClass = compileClassNames({
|
|
13
|
+
[style.messageFooterWrapper]: true
|
|
14
|
+
});
|
|
15
|
+
const messageStatusWrapperClass = compileClassNames({
|
|
16
|
+
[style.messageStatusWrapper]: true
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
messageBoxClass,
|
|
20
|
+
messageContentWrapperClass,
|
|
21
|
+
messageHeaderWrapperClass,
|
|
22
|
+
messageFooterWrapperClass,
|
|
23
|
+
messageStatusWrapperClass
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
/** ** Libraries *** */
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
/** ** Hooks *** */
|
|
6
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
7
|
+
|
|
8
|
+
/** ** Constants *** */
|
|
9
|
+
import messageBoxFooterDefaultProps from './props/defaultProps';
|
|
10
|
+
import messageBoxFooterPropTypes from './props/propTypes';
|
|
11
|
+
|
|
12
|
+
/** ** Styles *** */
|
|
13
|
+
import style from './css/MessageBoxFooter.module.css';
|
|
14
|
+
|
|
15
|
+
/** ** Methods *** */
|
|
16
|
+
import renderHandler from '@zohoim/chat-components-utils/es/renderHandler';
|
|
17
|
+
function MessageBoxFooter(props) {
|
|
18
|
+
const {
|
|
19
|
+
renderFooter,
|
|
20
|
+
customStyle
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
/* external customization */
|
|
24
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: newStyle.footer
|
|
27
|
+
}, renderHandler(renderFooter)());
|
|
28
|
+
}
|
|
29
|
+
MessageBoxFooter.propTypes = messageBoxFooterPropTypes;
|
|
30
|
+
MessageBoxFooter.defaultProps = messageBoxFooterDefaultProps;
|
|
31
|
+
MessageBoxFooter.displayName = 'MessageBoxFooter';
|
|
32
|
+
export default MessageBoxFooter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
/* eslint-disable sort-imports */
|
|
3
|
+
|
|
4
|
+
/** ** Libraries *** */
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
/** ** Hooks *** */
|
|
8
|
+
import { useMessageBubbleAction } from '@zohoim/chat-components-hooks/es/MessageBubble';
|
|
9
|
+
|
|
10
|
+
/** ** Constants *** */
|
|
11
|
+
import messageBubbleDefaultProps from './props/defaultProps';
|
|
12
|
+
import messageBubblePropTypes from './props/propTypes';
|
|
13
|
+
import constantProps from './props/propConstants';
|
|
14
|
+
|
|
15
|
+
/** ** Methods *** */
|
|
16
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
17
|
+
import renderHandler from '@zohoim/chat-components-utils/es/renderHandler';
|
|
18
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
19
|
+
|
|
20
|
+
/** ** Styles *** */
|
|
21
|
+
import style from './css/MessageBubble.module.css';
|
|
22
|
+
export default function MessageBubble(props) {
|
|
23
|
+
const {
|
|
24
|
+
// direction,
|
|
25
|
+
// renderMessageBoxHeader,
|
|
26
|
+
// tagAttributes,
|
|
27
|
+
renderMessageBox,
|
|
28
|
+
renderMessageBoxFooter,
|
|
29
|
+
renderMessageOwner,
|
|
30
|
+
renderMessageActions,
|
|
31
|
+
customStyle
|
|
32
|
+
} = props;
|
|
33
|
+
|
|
34
|
+
/* external customization */
|
|
35
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
36
|
+
/* css classnames added based on logic */
|
|
37
|
+
const {
|
|
38
|
+
bubbleClass,
|
|
39
|
+
messageOwnerWrapperClass,
|
|
40
|
+
messageContainerClass,
|
|
41
|
+
messageBoxWrapperClass,
|
|
42
|
+
messageActionWrapperClass,
|
|
43
|
+
messageBoxFooterWrapperClass
|
|
44
|
+
} = cssJSLogic(props, newStyle);
|
|
45
|
+
|
|
46
|
+
/* Use Hooks */
|
|
47
|
+
const {
|
|
48
|
+
onMouseEnter,
|
|
49
|
+
onMouseLeave,
|
|
50
|
+
isRenderMessageAction
|
|
51
|
+
} = useMessageBubbleAction(props);
|
|
52
|
+
|
|
53
|
+
/* Render Childrens */
|
|
54
|
+
const messageActions = isRenderMessageAction ? renderHandler(renderMessageActions)() : null;
|
|
55
|
+
const messageOwner = renderHandler(renderMessageOwner)();
|
|
56
|
+
const messageBox = renderHandler(renderMessageBox)();
|
|
57
|
+
const messageBoxFooter = renderHandler(renderMessageBoxFooter)();
|
|
58
|
+
// const messageBoxHeader = renderHandler(renderMessageBoxHeader)();
|
|
59
|
+
// const messageActions = renderHandler(renderMessageActions)();
|
|
60
|
+
|
|
61
|
+
/* Construct Layout */
|
|
62
|
+
const messageLayout = /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: bubbleClass,
|
|
64
|
+
onMouseEnter: onMouseEnter,
|
|
65
|
+
onMouseLeave: onMouseLeave
|
|
66
|
+
}, messageOwner ? /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: messageOwnerWrapperClass
|
|
68
|
+
}, messageOwner) : null, messageBox || messageActions ? /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: messageContainerClass
|
|
70
|
+
}, messageBox ? /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: messageBoxWrapperClass
|
|
72
|
+
}, messageBox) : null, messageActions ? /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: messageActionWrapperClass
|
|
74
|
+
}, messageActions) : null) : null, messageBoxFooter ? /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: messageBoxFooterWrapperClass
|
|
76
|
+
}, messageBoxFooter) : null);
|
|
77
|
+
return messageLayout;
|
|
78
|
+
}
|
|
79
|
+
MessageBubble.propTypes = messageBubblePropTypes;
|
|
80
|
+
MessageBubble.defaultProps = messageBubbleDefaultProps;
|
|
81
|
+
MessageBubble.constantProps = constantProps;
|
|
82
|
+
MessageBubble.displayName = 'MessageBubble';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.varClass {
|
|
2
|
+
--messageBubble-bubble_footer_gap: var(--imlib_size_5);
|
|
3
|
+
--messageBubble-message_owner_gap: var(--imlib_size_13);
|
|
4
|
+
--messageBubble-message_action_gap: var(--imlib_size_12);
|
|
5
|
+
--messageBox-max_width: var(--imlib_size_410);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.messageBubble {
|
|
9
|
+
composes: varClass;
|
|
10
|
+
width: 100%;
|
|
11
|
+
display: grid;
|
|
12
|
+
grid-column-gap: var(--messageBubble-message_owner_gap);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.messageOwnerWrapper {
|
|
16
|
+
grid-area: messageOwner;
|
|
17
|
+
align-self: end;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.messageContainer {
|
|
21
|
+
grid-area: messageContainer;
|
|
22
|
+
display: grid;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.messageBoxWrapper {
|
|
26
|
+
grid-area: messageBox;
|
|
27
|
+
max-width: var(--messageBox-max_width);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.messageActionWrapper {
|
|
31
|
+
grid-area: messageAction;
|
|
32
|
+
margin: 0 var(--messageBubble-message_action_gap);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.messageBoxFooterWrapper {
|
|
36
|
+
grid-area: messageBoxFooter;
|
|
37
|
+
margin-top: var(--messageBubble-bubble_footer_gap);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.active {
|
|
41
|
+
background-color: var(--imlib_chat_components_messageBubble_active_bg_color);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.directionIn {
|
|
45
|
+
grid-template-columns: auto 1fr;
|
|
46
|
+
grid-template-areas:
|
|
47
|
+
'messageOwner messageContainer'
|
|
48
|
+
'. messageBoxFooter';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.directionOut {
|
|
52
|
+
grid-template-columns: 1fr auto;
|
|
53
|
+
grid-template-areas:
|
|
54
|
+
'messageContainer messageOwner'
|
|
55
|
+
'messageBoxFooter .';
|
|
56
|
+
justify-items: end;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.directionIn .messageContainer {
|
|
60
|
+
grid-template-columns: auto 1fr;
|
|
61
|
+
grid-template-areas: 'messageBox messageAction';
|
|
62
|
+
}
|
|
63
|
+
.directionOut .messageContainer {
|
|
64
|
+
grid-template-columns: 1fr auto;
|
|
65
|
+
grid-template-areas: 'messageAction messageBox';
|
|
66
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { compileClassNames } from '@zohodesk/utils';
|
|
2
|
+
import propConstants from '../props/propConstants';
|
|
3
|
+
export default function cssJSLogic(props, style) {
|
|
4
|
+
const {
|
|
5
|
+
isActive,
|
|
6
|
+
direction
|
|
7
|
+
} = props;
|
|
8
|
+
const isIncoming = direction === propConstants.direction.in;
|
|
9
|
+
const isOutgoing = direction === propConstants.direction.out;
|
|
10
|
+
|
|
11
|
+
// const activeClass = compileClassNames({
|
|
12
|
+
// [style.active]: isActive
|
|
13
|
+
// });
|
|
14
|
+
|
|
15
|
+
// const directionClass = compileClassNames({
|
|
16
|
+
// [style.directionIn]: isIncoming,
|
|
17
|
+
// [style.directionOut]: isOutgoing
|
|
18
|
+
// });
|
|
19
|
+
|
|
20
|
+
const bubbleClass = compileClassNames({
|
|
21
|
+
[style.messageBubble]: true,
|
|
22
|
+
[style.directionIn]: isIncoming,
|
|
23
|
+
[style.directionOut]: isOutgoing,
|
|
24
|
+
[style.active]: isActive
|
|
25
|
+
});
|
|
26
|
+
const messageOwnerWrapperClass = compileClassNames({
|
|
27
|
+
[style.messageOwnerWrapper]: true
|
|
28
|
+
});
|
|
29
|
+
const messageContainerClass = compileClassNames({
|
|
30
|
+
[style.messageContainer]: true
|
|
31
|
+
});
|
|
32
|
+
const messageBoxWrapperClass = compileClassNames({
|
|
33
|
+
[style.messageBoxWrapper]: true
|
|
34
|
+
});
|
|
35
|
+
const messageActionWrapperClass = compileClassNames({
|
|
36
|
+
[style.messageActionWrapper]: true
|
|
37
|
+
});
|
|
38
|
+
const messageBoxFooterWrapperClass = compileClassNames({
|
|
39
|
+
[style.messageBoxFooterWrapper]: true
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
bubbleClass,
|
|
43
|
+
messageOwnerWrapperClass,
|
|
44
|
+
messageContainerClass,
|
|
45
|
+
messageBoxWrapperClass,
|
|
46
|
+
messageActionWrapperClass,
|
|
47
|
+
messageBoxFooterWrapperClass
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
const messageBubblePropTypes = {
|
|
3
|
+
tagAttributes: PropTypes.object,
|
|
4
|
+
direction: PropTypes.string,
|
|
5
|
+
isActive: PropTypes.bool,
|
|
6
|
+
needMessageActions: PropTypes.bool,
|
|
7
|
+
renderMessageBox: PropTypes.func,
|
|
8
|
+
renderMessageBoxFooter: PropTypes.func,
|
|
9
|
+
renderMessageOwner: PropTypes.func,
|
|
10
|
+
renderMessageActions: PropTypes.func,
|
|
11
|
+
customStyle: PropTypes.object
|
|
12
|
+
// messageActionsShowOn: PropTypes.string,
|
|
13
|
+
// renderMessageBoxHeader: PropTypes.func,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default messageBubblePropTypes;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-no-bind */
|
|
2
|
+
/* eslint-disable max-len */
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import style from './css/TextMessage.module.css';
|
|
5
|
+
import { ActionIcon, MessageActions } from '..';
|
|
6
|
+
import ReplyIcon from '@zohodesk/icon/es/general/Reply';
|
|
7
|
+
import CopyIcon from '@zohodesk/icon/es/general/Copy';
|
|
8
|
+
import DownloadIcon from '@zohodesk/icon/es/general/Cloud';
|
|
9
|
+
import MoreIcon from '@zohodesk/icon/es/general/More';
|
|
10
|
+
function DefaultActions(props) {
|
|
11
|
+
const {
|
|
12
|
+
customActions,
|
|
13
|
+
moreCount,
|
|
14
|
+
onClick
|
|
15
|
+
} = props;
|
|
16
|
+
function renderMoreIcon() {
|
|
17
|
+
return /*#__PURE__*/React.createElement(ActionIcon, {
|
|
18
|
+
renderIcon: () => /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: style.moreIcon
|
|
20
|
+
}, /*#__PURE__*/React.createElement(MoreIcon, null))
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function handleIconClick(id) {
|
|
24
|
+
onClick(id);
|
|
25
|
+
}
|
|
26
|
+
function renderReply() {
|
|
27
|
+
return /*#__PURE__*/React.createElement(ActionIcon, {
|
|
28
|
+
onClick: handleIconClick,
|
|
29
|
+
renderIcon: () => /*#__PURE__*/React.createElement(ReplyIcon, null)
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function renderCopy() {
|
|
33
|
+
return /*#__PURE__*/React.createElement(ActionIcon, {
|
|
34
|
+
onClick: handleIconClick,
|
|
35
|
+
renderIcon: () => /*#__PURE__*/React.createElement(CopyIcon, null)
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function renderDownload() {
|
|
39
|
+
return /*#__PURE__*/React.createElement(ActionIcon, {
|
|
40
|
+
onClick: handleIconClick,
|
|
41
|
+
renderIcon: () => /*#__PURE__*/React.createElement(DownloadIcon, null)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/React.createElement(MessageActions, {
|
|
45
|
+
actions: [{
|
|
46
|
+
id: 'Reply',
|
|
47
|
+
renderFunction: renderReply
|
|
48
|
+
}, {
|
|
49
|
+
id: 'Copy',
|
|
50
|
+
renderFunction: renderCopy
|
|
51
|
+
}, {
|
|
52
|
+
id: 'Download',
|
|
53
|
+
renderFunction: renderDownload
|
|
54
|
+
}, ...customActions]
|
|
55
|
+
// actions={actions}
|
|
56
|
+
,
|
|
57
|
+
renderMoreIcon: renderMoreIcon,
|
|
58
|
+
moreCount: moreCount
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export default DefaultActions;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
/** ** Libraries *** */
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
/** ** Components *** */
|
|
6
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
7
|
+
import { MessageBubble, AvatarSpace, MessageBox, MessageActions } from '..';
|
|
8
|
+
|
|
9
|
+
/** ** Constants *** */
|
|
10
|
+
import textMessageDefaultProps from './props/defaultProps';
|
|
11
|
+
import textMessagePropTypes from './props/propTypes';
|
|
12
|
+
|
|
13
|
+
/** ** Styles *** */
|
|
14
|
+
import style from './css/TextMessage.module.css';
|
|
15
|
+
export default function TextMessage(props) {
|
|
16
|
+
const {
|
|
17
|
+
direction,
|
|
18
|
+
isActive,
|
|
19
|
+
needMessageActions,
|
|
20
|
+
renderMessage,
|
|
21
|
+
renderMessageHeader,
|
|
22
|
+
renderMessageFooter,
|
|
23
|
+
renderMessageBoxFooter,
|
|
24
|
+
needAvatar,
|
|
25
|
+
avatarProps,
|
|
26
|
+
messageActions,
|
|
27
|
+
renderMoreIcon,
|
|
28
|
+
actionsCount,
|
|
29
|
+
renderStatus
|
|
30
|
+
} = props;
|
|
31
|
+
function renderMessageBox() {
|
|
32
|
+
return /*#__PURE__*/React.createElement(MessageBox, {
|
|
33
|
+
renderMessage: renderMessage,
|
|
34
|
+
renderMessageHeader: renderMessageHeader,
|
|
35
|
+
renderMessageFooter: renderMessageFooter,
|
|
36
|
+
renderStatus: renderStatus
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function renderMessageOwner() {
|
|
40
|
+
return /*#__PURE__*/React.createElement(AvatarSpace, {
|
|
41
|
+
needAvatar: needAvatar,
|
|
42
|
+
avatarProps: avatarProps
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function renderMessageActions() {
|
|
46
|
+
return /*#__PURE__*/React.createElement(MessageActions, {
|
|
47
|
+
actions: messageActions,
|
|
48
|
+
renderMoreIcon: renderMoreIcon,
|
|
49
|
+
moreCount: actionsCount
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/React.createElement(MessageBubble, {
|
|
53
|
+
direction: direction,
|
|
54
|
+
isActive: isActive,
|
|
55
|
+
needMessageActions: needMessageActions,
|
|
56
|
+
renderMessageBox: renderMessageBox
|
|
57
|
+
// renderMessageBoxHeader={() => null}
|
|
58
|
+
,
|
|
59
|
+
renderMessageBoxFooter: renderMessageBoxFooter,
|
|
60
|
+
renderMessageOwner: renderMessageOwner,
|
|
61
|
+
renderMessageActions: renderMessageActions
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
TextMessage.displayName = 'TextMessage';
|
|
65
|
+
TextMessage.propTypes = textMessagePropTypes;
|
|
66
|
+
TextMessage.defaultProps = textMessageDefaultProps;
|
|
67
|
+
// ActionIcons.constantProps = constantProps;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
/** ** Libraries *** */
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
/** ** Components *** */
|
|
6
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
7
|
+
import { MessageBubble, AvatarSpace, MessageBox, MessageActions } from '..';
|
|
8
|
+
|
|
9
|
+
/** ** Constants *** */
|
|
10
|
+
import textMessageDefaultProps from './props/defaultProps';
|
|
11
|
+
import textMessagePropTypes from './props/propTypes';
|
|
12
|
+
|
|
13
|
+
/** ** Styles *** */
|
|
14
|
+
import style from './css/TextMessage.module.css';
|
|
15
|
+
export default function TextMessage(props) {
|
|
16
|
+
const {
|
|
17
|
+
direction,
|
|
18
|
+
isActive,
|
|
19
|
+
needMessageActions,
|
|
20
|
+
message,
|
|
21
|
+
renderMessage,
|
|
22
|
+
renderMessageHeader,
|
|
23
|
+
renderMessageFooter,
|
|
24
|
+
renderMessageBoxFooter,
|
|
25
|
+
needAvatar,
|
|
26
|
+
avatarProps,
|
|
27
|
+
messageActions,
|
|
28
|
+
renderMoreIcon,
|
|
29
|
+
actionsCount,
|
|
30
|
+
customStyle
|
|
31
|
+
} = props;
|
|
32
|
+
function renderMessageText() {
|
|
33
|
+
/*#__PURE__*/React.createElement("div", null, message);
|
|
34
|
+
}
|
|
35
|
+
function renderMessageBox() {
|
|
36
|
+
return /*#__PURE__*/React.createElement(MessageBox, {
|
|
37
|
+
renderMessage: renderMessageText,
|
|
38
|
+
renderMessageHeader: renderMessageHeader,
|
|
39
|
+
renderMessageFooter: renderMessageFooter
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function renderAvatarSpace() {
|
|
43
|
+
return /*#__PURE__*/React.createElement(AvatarSpace, {
|
|
44
|
+
needAvatar: needAvatar,
|
|
45
|
+
avatarProps: avatarProps
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function renderMessageActions() {
|
|
49
|
+
return /*#__PURE__*/React.createElement(MessageActions, {
|
|
50
|
+
actions: messageActions,
|
|
51
|
+
renderMoreIcon: renderMoreIcon,
|
|
52
|
+
moreCount: actionsCount
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return /*#__PURE__*/React.createElement(MessageBubble, {
|
|
56
|
+
direction: direction,
|
|
57
|
+
isActive: isActive,
|
|
58
|
+
needMessageActions: needMessageActions,
|
|
59
|
+
renderMessageBox: renderMessageBox
|
|
60
|
+
// renderMessageBoxHeader={() => null}
|
|
61
|
+
,
|
|
62
|
+
renderMessageBoxFooter: renderMessageBoxFooter,
|
|
63
|
+
renderAvatarSpace: renderAvatarSpace,
|
|
64
|
+
renderMessageActions: renderMessageActions
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
TextMessage.propTypes = textMessageDefaultProps;
|
|
68
|
+
TextMessage.defaultProps = textMessagePropTypes;
|
|
69
|
+
// ActionIcons.constantProps = constantProps;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TextMessage } from './TextMessage';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export const textMessagePropTypes = {
|
|
3
|
+
direction: PropTypes.string,
|
|
4
|
+
isActive: PropTypes.bool,
|
|
5
|
+
needMessageActions: PropTypes.bool,
|
|
6
|
+
renderMessage: PropTypes.func,
|
|
7
|
+
renderMessageHeader: PropTypes.func,
|
|
8
|
+
renderMessageFooter: PropTypes.func,
|
|
9
|
+
renderMessageBoxFooter: PropTypes.func,
|
|
10
|
+
needAvatar: PropTypes.bool,
|
|
11
|
+
avatarProps: PropTypes.object,
|
|
12
|
+
messageActions: PropTypes.arrayOf(PropTypes.object),
|
|
13
|
+
renderMoreIcon: PropTypes.func,
|
|
14
|
+
actionsCount: PropTypes.number,
|
|
15
|
+
renderStatus: PropTypes.func
|
|
16
|
+
};
|
|
17
|
+
export default textMessagePropTypes;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
library: 'chat_components',
|
|
3
|
+
variables: {
|
|
4
|
+
messageBubble: {
|
|
5
|
+
active_bg_color: '#fdffe3'
|
|
6
|
+
},
|
|
7
|
+
messageBox: {
|
|
8
|
+
bg_color: '#f1f7fe'
|
|
9
|
+
},
|
|
10
|
+
actionIcon: {
|
|
11
|
+
color: '#0a73eb',
|
|
12
|
+
bg_color: '#f1f7fe',
|
|
13
|
+
border_color: '#b7d1f0'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MSG_ACTION_POPUP_PORTAL = 'MSG_ACTION_POPUP_PORTAL';
|
package/es/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './MessageBubble';
|
|
2
|
+
export * from './AvatarSpace';
|
|
3
|
+
export * from './MessageActions';
|
|
4
|
+
export * from './MessageBox';
|
|
5
|
+
export * from './MessageBoxHeader';
|
|
6
|
+
export * from './MessageBoxFooter';
|
|
7
|
+
export * from './ActionIcon';
|
|
8
|
+
export * from './MessageActionsMore';
|
|
9
|
+
export * from './TextMessage';
|
|
10
|
+
// ... export other components
|
|
11
|
+
|
|
12
|
+
/*** CONSTANTS ***/
|
|
13
|
+
export * from './constants';
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zohoim/chat-components",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Chat Components",
|
|
5
|
+
"main": "es/index.js",
|
|
6
|
+
"module": "es/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "react-cli build:component:es",
|
|
9
|
+
"build_watch": "react-cli build:component:es -w",
|
|
10
|
+
"clean": "react-cli clean unittest coverage es result.json",
|
|
11
|
+
"rtl": "react-cli rtl ./src ./es",
|
|
12
|
+
"prepare": "npm run clean && npm run build && npm run rtl",
|
|
13
|
+
"test": "react-cli test",
|
|
14
|
+
"test:debug": "react-cli test --runInBand --watch"
|
|
15
|
+
},
|
|
16
|
+
"author": "ZohoDesk - IM Team",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"private": false,
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"es",
|
|
24
|
+
"!**/__tests__"
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@zohodesk/components": "1.0.0-alpha-250",
|
|
28
|
+
"@zohodesk/hooks": "1.0.6",
|
|
29
|
+
"@zohodesk/icon": "1.0.6",
|
|
30
|
+
"@zohodesk/utils": "1.0.6",
|
|
31
|
+
"@zohodesk/variables": "1.0.0-beta.30",
|
|
32
|
+
"@zohodesk/virtualizer": "1.0.13",
|
|
33
|
+
"@zohoim/chat-components-hooks": "^0.0.2",
|
|
34
|
+
"@zohoim/chat-components-utils": "^0.0.2"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "a2f7ad66df3a920bb412dd62ae1f6485b5458f51"
|
|
37
|
+
}
|