@zohoim/chat-components 0.0.1-cx

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/README.md +9 -0
  2. package/es/ActionIcon/ActionIcon.js +82 -0
  3. package/es/ActionIcon/css/ActionIcon.module.css +8 -0
  4. package/es/ActionIcon/index.js +1 -0
  5. package/es/ActionIcon/props/defaultProps.js +8 -0
  6. package/es/ActionIcon/props/propTypes.js +17 -0
  7. package/es/ActionIconWrapper/ActionIconWrapper.js +61 -0
  8. package/es/ActionIconWrapper/css/ActionIconWrapper.module.css +32 -0
  9. package/es/ActionIconWrapper/css/cssJSLogic.js +14 -0
  10. package/es/ActionIconWrapper/index.js +1 -0
  11. package/es/ActionIconWrapper/props/defaultProps.js +6 -0
  12. package/es/ActionIconWrapper/props/propTypes.js +12 -0
  13. package/es/AttachmentBubble/AttachmentBubble.js +87 -0
  14. package/es/AttachmentBubble/css/AttachmentBubble.module.css +55 -0
  15. package/es/AttachmentBubble/css/cssJSLogic.js +18 -0
  16. package/es/AttachmentBubble/index.js +1 -0
  17. package/es/AttachmentBubble/props/defaultProps.js +8 -0
  18. package/es/AttachmentBubble/props/propTypes.js +19 -0
  19. package/es/AttachmentBubbleInfo/AttachmentBubbleInfo.js +48 -0
  20. package/es/AttachmentBubbleInfo/css/AttachmentBubbleInfo.module.css +39 -0
  21. package/es/AttachmentBubbleInfo/css/cssJSLogic.js +13 -0
  22. package/es/AttachmentBubbleInfo/index.js +1 -0
  23. package/es/AttachmentBubbleInfo/props/defaultProps.js +6 -0
  24. package/es/AttachmentBubbleInfo/props/propTypes.js +9 -0
  25. package/es/AttachmentIcon/AttachmentIcon.js +60 -0
  26. package/es/AttachmentIcon/css/AttachmentIcon.module.css +8 -0
  27. package/es/AttachmentIcon/css/cssJSLogic.js +13 -0
  28. package/es/AttachmentIcon/index.js +1 -0
  29. package/es/AttachmentIcon/props/defaultProps.js +8 -0
  30. package/es/AttachmentIcon/props/propTypes.js +21 -0
  31. package/es/AttachmentIcon/utils/getAttachmentIconComponent.js +81 -0
  32. package/es/Audio/Audio.js +38 -0
  33. package/es/Audio/css/Audio.module.css +7 -0
  34. package/es/Audio/index.js +1 -0
  35. package/es/Audio/props/defaultProps.js +6 -0
  36. package/es/Audio/props/propTypes.js +8 -0
  37. package/es/AudioBubble/AudioBubble.js +56 -0
  38. package/es/AudioBubble/css/AudioBubble.module.css +4 -0
  39. package/es/AudioBubble/index.js +1 -0
  40. package/es/AudioBubble/props/defaultProps.js +7 -0
  41. package/es/AudioBubble/props/propTypes.js +16 -0
  42. package/es/Fonts/puviFont.module.css +62 -0
  43. package/es/ImageBubble/ImageBubble.js +70 -0
  44. package/es/ImageBubble/css/ImageBubble.module.css +63 -0
  45. package/es/ImageBubble/css/cssJSLogic.js +15 -0
  46. package/es/ImageBubble/index.js +1 -0
  47. package/es/ImageBubble/props/defaultProps.js +6 -0
  48. package/es/ImageBubble/props/propTypes.js +13 -0
  49. package/es/LazyLoadImage/LazyLoadImage.js +37 -0
  50. package/es/LazyLoadImage/css/LazyLoadImage.module.css +5 -0
  51. package/es/LazyLoadImage/index.js +1 -0
  52. package/es/LazyLoadImage/props/defaultProps.js +6 -0
  53. package/es/LazyLoadImage/props/propTypes.js +8 -0
  54. package/es/LocationBubble/LocationBubble.js +62 -0
  55. package/es/LocationBubble/css/LocationBubble.module.css +57 -0
  56. package/es/LocationBubble/css/cssJSLogic.js +13 -0
  57. package/es/LocationBubble/images/location.png +0 -0
  58. package/es/LocationBubble/index.js +1 -0
  59. package/es/LocationBubble/props/defaultProps.js +6 -0
  60. package/es/LocationBubble/props/propTypes.js +8 -0
  61. package/es/MediaBubbleWrapper/MediaBubbleWrapper.js +62 -0
  62. package/es/MediaBubbleWrapper/css/MediaBubbleWrapper.module.css +7 -0
  63. package/es/MediaBubbleWrapper/index.js +1 -0
  64. package/es/MediaBubbleWrapper/props/defaultProps.js +7 -0
  65. package/es/MediaBubbleWrapper/props/propTypes.js +17 -0
  66. package/es/Message/Message.js +126 -0
  67. package/es/Message/index.js +1 -0
  68. package/es/Message/props/defaultProps.js +12 -0
  69. package/es/Message/props/propTypes.js +41 -0
  70. package/es/MessageAction/MessageAction.js +60 -0
  71. package/es/MessageAction/index.js +1 -0
  72. package/es/MessageAction/props/defaultProps.js +8 -0
  73. package/es/MessageAction/props/propTypes.js +21 -0
  74. package/es/MessageActions/MessageActions.js +120 -0
  75. package/es/MessageActions/css/MessageActions.module.css +24 -0
  76. package/es/MessageActions/index.js +1 -0
  77. package/es/MessageActions/props/defaultProps.js +10 -0
  78. package/es/MessageActions/props/propTypes.js +25 -0
  79. package/es/MessageActionsMore/MessageActionsMore.js +101 -0
  80. package/es/MessageActionsMore/css/MessageActionsMore.module.css +23 -0
  81. package/es/MessageActionsMore/index.js +1 -0
  82. package/es/MessageActionsMore/props/defaultProps.js +9 -0
  83. package/es/MessageActionsMore/props/propTypes.js +13 -0
  84. package/es/MessageActionsWrapper/MessageActionsWrapper.js +68 -0
  85. package/es/MessageActionsWrapper/css/MessageActionsWrapper.module.css +3 -0
  86. package/es/MessageActionsWrapper/index.js +1 -0
  87. package/es/MessageActionsWrapper/props/defaultProps.js +9 -0
  88. package/es/MessageActionsWrapper/props/propTypes.js +15 -0
  89. package/es/MessageAvatar/MessageAvatar.js +49 -0
  90. package/es/MessageAvatar/css/MessageAvatar.module.css +23 -0
  91. package/es/MessageAvatar/index.js +1 -0
  92. package/es/MessageAvatar/props/defaultProps.js +7 -0
  93. package/es/MessageAvatar/props/propTypes.js +13 -0
  94. package/es/MessageBox/MessageBox.js +66 -0
  95. package/es/MessageBox/css/MessageBox.module.css +56 -0
  96. package/es/MessageBox/css/cssJSLogic.js +18 -0
  97. package/es/MessageBox/index.js +1 -0
  98. package/es/MessageBox/props/defaultProps.js +6 -0
  99. package/es/MessageBox/props/propTypes.js +13 -0
  100. package/es/MessageBubble/MessageBubble.js +116 -0
  101. package/es/MessageBubble/css/MessageBubble.module.css +101 -0
  102. package/es/MessageBubble/css/cssJSLogic.js +34 -0
  103. package/es/MessageBubble/index.js +1 -0
  104. package/es/MessageBubble/props/defaultProps.js +11 -0
  105. package/es/MessageBubble/props/propTypes.js +17 -0
  106. package/es/MessageStatus/MessageStatus.js +77 -0
  107. package/es/MessageStatus/css/MessageStatus.module.css +17 -0
  108. package/es/MessageStatus/css/cssJSLogic.js +26 -0
  109. package/es/MessageStatus/index.js +1 -0
  110. package/es/MessageStatus/props/defaultProps.js +6 -0
  111. package/es/MessageStatus/props/propTypes.js +12 -0
  112. package/es/MoreActionItem/MoreActionItem.js +72 -0
  113. package/es/MoreActionItem/css/MoreActionItem.module.css +27 -0
  114. package/es/MoreActionItem/index.js +1 -0
  115. package/es/MoreActionItem/props/defaultProps.js +7 -0
  116. package/es/MoreActionItem/props/propTypes.js +14 -0
  117. package/es/ReplyBubble/ReplyBubble.js +118 -0
  118. package/es/ReplyBubble/css/ReplyBubble.module.css +23 -0
  119. package/es/ReplyBubble/css/cssJSLogic.js +14 -0
  120. package/es/ReplyBubble/index.js +1 -0
  121. package/es/ReplyBubble/props/defaultProps.js +8 -0
  122. package/es/ReplyBubble/props/propTypes.js +28 -0
  123. package/es/ReplyBubbleContent/ReplyBubbleContent.js +61 -0
  124. package/es/ReplyBubbleContent/css/ReplyBubbleContent.module.css +75 -0
  125. package/es/ReplyBubbleContent/css/cssJSLogic.js +13 -0
  126. package/es/ReplyBubbleContent/index.js +1 -0
  127. package/es/ReplyBubbleContent/props/defaultProps.js +6 -0
  128. package/es/ReplyBubbleContent/props/propTypes.js +11 -0
  129. package/es/ReplyBubbleHeader/ReplyBubbleHeader.js +74 -0
  130. package/es/ReplyBubbleHeader/css/ReplyBubbleHeader.module.css +44 -0
  131. package/es/ReplyBubbleHeader/css/cssJSLogic.js +12 -0
  132. package/es/ReplyBubbleHeader/index.js +1 -0
  133. package/es/ReplyBubbleHeader/props/defaultProps.js +7 -0
  134. package/es/ReplyBubbleHeader/props/propTypes.js +13 -0
  135. package/es/TextBubble/TextBubble.js +49 -0
  136. package/es/TextBubble/css/TextBubble.module.css +35 -0
  137. package/es/TextBubble/css/cssJSLogic.js +18 -0
  138. package/es/TextBubble/index.js +1 -0
  139. package/es/TextBubble/props/defaultProps.js +6 -0
  140. package/es/TextBubble/props/propTypes.js +10 -0
  141. package/es/Theme/ThemeAssets.js +78 -0
  142. package/es/Theme/ThemeWrapper.js +88 -0
  143. package/es/Theme/TooltipWrapper.js +85 -0
  144. package/es/Theme/constants/index.js +41 -0
  145. package/es/Theme/css/TooltipWrapper.module.css +10 -0
  146. package/es/Theme/index.js +1 -0
  147. package/es/Theme/props/defaultProps.js +10 -0
  148. package/es/Theme/props/propTypes.js +14 -0
  149. package/es/Theme/themeVariables/commonThemeColorVariable.js +17 -0
  150. package/es/Theme/themeVariables/dark/blueTheme.js +116 -0
  151. package/es/Theme/themeVariables/dark/commonColorVariable.js +16 -0
  152. package/es/Theme/themeVariables/dark/greenTheme.js +115 -0
  153. package/es/Theme/themeVariables/dark/orangeTheme.js +115 -0
  154. package/es/Theme/themeVariables/dark/redTheme.js +115 -0
  155. package/es/Theme/themeVariables/dark/yellowTheme.js +115 -0
  156. package/es/Theme/themeVariables/light/blueTheme.js +114 -0
  157. package/es/Theme/themeVariables/light/commonColorVariable.js +35 -0
  158. package/es/Theme/themeVariables/light/greenTheme.js +114 -0
  159. package/es/Theme/themeVariables/light/orangeTheme.js +114 -0
  160. package/es/Theme/themeVariables/light/redTheme.js +114 -0
  161. package/es/Theme/themeVariables/light/yellowTheme.js +114 -0
  162. package/es/Theme/themeVariables/pureDark/blueTheme.js +115 -0
  163. package/es/Theme/themeVariables/pureDark/commonColorVariable.js +18 -0
  164. package/es/Theme/themeVariables/pureDark/greenTheme.js +115 -0
  165. package/es/Theme/themeVariables/pureDark/orangeTheme.js +115 -0
  166. package/es/Theme/themeVariables/pureDark/redTheme.js +115 -0
  167. package/es/Theme/themeVariables/pureDark/yellowTheme.js +115 -0
  168. package/es/Theme/utils/combineConfigurations.js +17 -0
  169. package/es/Theme/utils/flatVariables.js +12 -0
  170. package/es/Theme/utils/getCustomizedCssVariables.js +19 -0
  171. package/es/Theme/utils/getThemeConfigurations.js +81 -0
  172. package/es/Theme/utils/getWrapperDivProps.js +16 -0
  173. package/es/Video/Video.js +38 -0
  174. package/es/Video/css/Video.module.css +5 -0
  175. package/es/Video/index.js +1 -0
  176. package/es/Video/props/defaultProps.js +6 -0
  177. package/es/Video/props/propTypes.js +8 -0
  178. package/es/VideoBubble/VideoBubble.js +66 -0
  179. package/es/VideoBubble/css/VideoBubble.module.css +12 -0
  180. package/es/VideoBubble/css/cssJSLogic.js +14 -0
  181. package/es/VideoBubble/index.js +1 -0
  182. package/es/VideoBubble/props/defaultProps.js +7 -0
  183. package/es/VideoBubble/props/propTypes.js +17 -0
  184. package/es/constants/index.js +1 -0
  185. package/es/css/common.module.css +6 -0
  186. package/es/icons/create-icon-components.js +172 -0
  187. package/es/icons/factory/attachments/audio.svg +19 -0
  188. package/es/icons/factory/attachments/code.svg +21 -0
  189. package/es/icons/factory/attachments/image.svg +20 -0
  190. package/es/icons/factory/attachments/pdf.svg +19 -0
  191. package/es/icons/factory/attachments/ppt.svg +1 -0
  192. package/es/icons/factory/attachments/text.svg +22 -0
  193. package/es/icons/factory/attachments/unknown.svg +21 -0
  194. package/es/icons/factory/attachments/video.svg +19 -0
  195. package/es/icons/factory/attachments/xls.svg +1 -0
  196. package/es/icons/factory/attachments/zip.svg +27 -0
  197. package/es/icons/factory/common/alertTriangle.svg +5 -0
  198. package/es/icons/factory/common/article.svg +4 -0
  199. package/es/icons/factory/common/reply.svg +6 -0
  200. package/es/icons/factory/messageStatus/clock.svg +7 -0
  201. package/es/icons/factory/messageStatus/doubleTick.svg +1 -0
  202. package/es/icons/factory/messageStatus/failed.svg +7 -0
  203. package/es/icons/factory/messageStatus/tick.svg +1 -0
  204. package/es/icons/icon.template.js +28 -0
  205. package/es/icons/iconSrc/attachments/Audio.js +38 -0
  206. package/es/icons/iconSrc/attachments/Code.js +44 -0
  207. package/es/icons/iconSrc/attachments/Image.js +43 -0
  208. package/es/icons/iconSrc/attachments/Pdf.js +38 -0
  209. package/es/icons/iconSrc/attachments/Ppt.js +26 -0
  210. package/es/icons/iconSrc/attachments/Text.js +47 -0
  211. package/es/icons/iconSrc/attachments/Txt.js +47 -0
  212. package/es/icons/iconSrc/attachments/Unknown.js +42 -0
  213. package/es/icons/iconSrc/attachments/Video.js +38 -0
  214. package/es/icons/iconSrc/attachments/Xls.js +26 -0
  215. package/es/icons/iconSrc/attachments/Zip.js +86 -0
  216. package/es/icons/iconSrc/attachments/index.js +10 -0
  217. package/es/icons/iconSrc/common/AlertTriangle.js +23 -0
  218. package/es/icons/iconSrc/common/Article.js +17 -0
  219. package/es/icons/iconSrc/common/Reply.js +13 -0
  220. package/es/icons/iconSrc/common/index.js +3 -0
  221. package/es/icons/iconSrc/messageStatus/Clock.js +14 -0
  222. package/es/icons/iconSrc/messageStatus/DoubleTick.js +16 -0
  223. package/es/icons/iconSrc/messageStatus/Failed.js +14 -0
  224. package/es/icons/iconSrc/messageStatus/Tick.js +13 -0
  225. package/es/icons/iconSrc/messageStatus/index.js +4 -0
  226. package/es/im/ArticleBubble/ArticleBubble.js +80 -0
  227. package/es/im/ArticleBubble/css/ArticleBubble.module.css +75 -0
  228. package/es/im/ArticleBubble/css/cssJSLogic.js +12 -0
  229. package/es/im/ArticleBubble/index.js +1 -0
  230. package/es/im/ArticleBubble/props/defaultProps.js +6 -0
  231. package/es/im/ArticleBubble/props/propTypes.js +14 -0
  232. package/es/im/IMIntegrationIcon/IMIntegrationIcon.js +73 -0
  233. package/es/im/IMIntegrationIcon/css/IMIntegrationIcon.module.css +72 -0
  234. package/es/im/IMIntegrationIcon/css/cssJSLogic.js +53 -0
  235. package/es/im/IMIntegrationIcon/index.js +1 -0
  236. package/es/im/IMIntegrationIcon/props/defaultProps.js +11 -0
  237. package/es/im/IMIntegrationIcon/props/propTypes.js +14 -0
  238. package/es/im/IMMessage/IMMessage.js +197 -0
  239. package/es/im/IMMessage/css/IMMessage.module.css +36 -0
  240. package/es/im/IMMessage/css/cssJSLogic.js +15 -0
  241. package/es/im/IMMessage/index.js +1 -0
  242. package/es/im/IMMessage/props/defaultProps.js +16 -0
  243. package/es/im/IMMessage/props/propTypes.js +126 -0
  244. package/es/im/IMMessageContent/IMMessageContent.js +128 -0
  245. package/es/im/IMMessageContent/css/IMMessageContent.module.css +8 -0
  246. package/es/im/IMMessageContent/index.js +1 -0
  247. package/es/im/IMMessageContent/props/defaultProps.js +9 -0
  248. package/es/im/IMMessageContent/props/propTypes.js +54 -0
  249. package/es/im/IMMessageMeta/IMMessageMeta.js +72 -0
  250. package/es/im/IMMessageMeta/css/IMMessageMeta.module.css +46 -0
  251. package/es/im/IMMessageMeta/css/cssJSLogic.js +29 -0
  252. package/es/im/IMMessageMeta/index.js +1 -0
  253. package/es/im/IMMessageMeta/props/defaultProps.js +11 -0
  254. package/es/im/IMMessageMeta/props/propTypes.js +42 -0
  255. package/es/im/IMMessageMetaInfo/IMMessageMetaInfo.js +29 -0
  256. package/es/im/IMMessageMetaInfo/css/IMMessageMetaInfo.module.css +14 -0
  257. package/es/im/IMMessageMetaInfo/index.js +1 -0
  258. package/es/im/IMMessageMetaInfo/props/defaultProps.js +8 -0
  259. package/es/im/IMMessageMetaInfo/props/propTypes.js +8 -0
  260. package/es/im/IMPermaLink/IMPermaLink.js +48 -0
  261. package/es/im/IMPermaLink/css/IMPermaLink.module.css +14 -0
  262. package/es/im/IMPermaLink/css/cssJSLogic.js +14 -0
  263. package/es/im/IMPermaLink/index.js +1 -0
  264. package/es/im/IMPermaLink/props/defaultProps.js +6 -0
  265. package/es/im/IMPermaLink/props/propTypes.js +11 -0
  266. package/es/im/IMReplyBubble/IMReplyBubble.js +52 -0
  267. package/es/im/IMReplyBubble/index.js +1 -0
  268. package/es/im/IMReplyBubble/props/defaultProps.js +7 -0
  269. package/es/im/IMReplyBubble/props/propTypes.js +29 -0
  270. package/es/im/IMTextBubble/IMTextBubble.js +40 -0
  271. package/es/im/IMTextBubble/index.js +1 -0
  272. package/es/im/IMTextBubble/props/defaultProps.js +8 -0
  273. package/es/im/IMTextBubble/props/propTypes.js +31 -0
  274. package/es/im/css/common.module.css +6 -0
  275. package/es/im/index.js +9 -0
  276. package/es/index.js +32 -0
  277. package/package.json +49 -0
@@ -0,0 +1,101 @@
1
+ /** ** Libraries *** */
2
+ import React, { useCallback, useMemo } from 'react';
3
+ /** ** Components *** */
4
+
5
+ import Popup from '@zohodesk/components/lib/Popup/Popup';
6
+ import DropBox from '@zohodesk/components/lib/DropBox/DropBox';
7
+ /** ** Constants *** */
8
+
9
+ import messageActionsMoreDefaultProps from './props/defaultProps';
10
+ import messageActionsMorePropTypes from './props/propTypes';
11
+ import { MSG_ACTION_POPUP_PORTAL } from '../constants';
12
+ import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
13
+ /** ** Methods *** */
14
+
15
+ import renderHandler from '@zohoim/chat-components-utils/es/common/renderHandler';
16
+ /** ** Hooks *** */
17
+
18
+ import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
19
+ /** ** Styles *** */
20
+
21
+ import style from './css/MessageActionsMore.module.css';
22
+
23
+ function MessageActionsMoreComp(props) {
24
+ const {
25
+ actions,
26
+ renderMoreIcon,
27
+ customStyle,
28
+ popupSize,
29
+ defaultPopupPosition,
30
+
31
+ /** ** Popup Props *** */
32
+ getTargetRef,
33
+ getContainerRef,
34
+ position,
35
+ togglePopup,
36
+ isPopupReady,
37
+ isPopupOpen,
38
+ removeClose,
39
+ closePopupOnly,
40
+ isAbsolutePositioningNeeded,
41
+ positionsOffset
42
+ } = props;
43
+ const moreIcon = renderHandler(renderMoreIcon)();
44
+ /* External CSS Customization */
45
+
46
+ const newStyle = useMergeStyle(style, customStyle);
47
+ const popupClass = useMemo(() => ({
48
+ customDropBox: newStyle.popup,
49
+ customMobileDropBox: newStyle.mobilePopup,
50
+ customDropBoxWrap: newStyle.popupWrapper,
51
+ customMobileDropBoxWrap: newStyle.mobilePopupWrapper
52
+ }), [newStyle.popup, newStyle.mobilePopup, newStyle.popupWrapper, newStyle.mobilePopupWrapper]);
53
+
54
+ const handleTogglePopup = e => {
55
+ togglePopup(e, defaultPopupPosition);
56
+ };
57
+
58
+ const renderActions = useCallback(() => actions.map(action => {
59
+ const {
60
+ id,
61
+ renderFunction
62
+ } = action;
63
+ return renderHandler(renderFunction)({
64
+ id,
65
+ isShowInMore: true,
66
+ action,
67
+ closePopup: closePopupOnly
68
+ }); // id, isRenderInMorePopup
69
+ }), [actions, closePopupOnly]);
70
+ const isRenderPopup = !!(moreIcon && isPopupOpen);
71
+ return /*#__PURE__*/React.createElement("span", {
72
+ className: newStyle.morePopupContainer
73
+ }, moreIcon ? /*#__PURE__*/React.createElement("span", {
74
+ ref: getTargetRef,
75
+ onClick: handleTogglePopup
76
+ }, moreIcon) : null, isRenderPopup ? /*#__PURE__*/React.createElement(DropBox, {
77
+ boxPosition: position,
78
+ customClass: popupClass,
79
+ customStyle: dummyObject,
80
+ getRef: getContainerRef,
81
+ isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
82
+ isActive: isPopupReady,
83
+ isAnimate: true,
84
+ isArrow: false,
85
+ onClick: removeClose,
86
+ portalId: MSG_ACTION_POPUP_PORTAL,
87
+ positionsOffset: positionsOffset,
88
+ size: popupSize // isModel
89
+
90
+ }, renderActions()) : null);
91
+ }
92
+
93
+ const MessageActionsMore = Popup(MessageActionsMoreComp, undefined, undefined, {
94
+ isAbsolutePositioningNeeded: false
95
+ });
96
+ MessageActionsMoreComp.defaultProps = messageActionsMoreDefaultProps;
97
+ MessageActionsMoreComp.propTypes = messageActionsMorePropTypes;
98
+ MessageActionsMore.defaultProps = messageActionsMoreDefaultProps;
99
+ MessageActionsMore.propTypes = messageActionsMorePropTypes;
100
+ MessageActionsMore.displayName = 'MessageActionsMore';
101
+ export default MessageActionsMore;
@@ -0,0 +1,23 @@
1
+ .container {
2
+ display: inline-block;
3
+ }
4
+
5
+ .morePopupContainer {
6
+ composes: container;
7
+ }
8
+
9
+ .popup {
10
+ padding: var(--zd_size10) 0 ;
11
+ }
12
+
13
+ .popupWrapper {
14
+ composes: container;
15
+ }
16
+
17
+ .mobilePopup {
18
+ composes: container;
19
+ }
20
+
21
+ .mobilePopupWrapper {
22
+ composes: container;
23
+ }
@@ -0,0 +1 @@
1
+ export { default as MessageActionsMore } from './MessageActionsMore';
@@ -0,0 +1,9 @@
1
+ /** ** Constants *** */
2
+ import { dummyObject, dummyArray } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
3
+ const messageActionsMoreDefaultProps = {
4
+ customStyle: dummyObject,
5
+ actions: dummyArray,
6
+ popupSize: 'small',
7
+ defaultPopupPosition: 'bottomCenter'
8
+ };
9
+ export default messageActionsMoreDefaultProps;
@@ -0,0 +1,13 @@
1
+ /** ** Libraries *** */
2
+ import PropTypes from 'prop-types';
3
+ const messageActionsMorePropTypes = {
4
+ actions: PropTypes.arrayOf(PropTypes.shape({
5
+ id: PropTypes.string.isRequired,
6
+ renderFunction: PropTypes.func
7
+ })).isRequired,
8
+ renderMoreIcon: PropTypes.func.isRequired,
9
+ customStyle: PropTypes.object,
10
+ popupSize: PropTypes.oneOf(['mini', 'xmini', 'xsmall', 'small', 'medium', 'large', 'mlarge', 'xlarge', 'xxlarge', 'default']),
11
+ defaultPopupPosition: PropTypes.oneOf([['bottomCenter', 'bottomLeftToRight', 'bottomCenterToRight', 'bottomRightToLeft', 'bottomCenterToLeft', 'topCenter', 'topLeftToRight', 'topCenterToRight', 'topRightToLeft', 'topCenterToLeft', 'rightTopToBottom', 'rightCenterToBottom', 'rightCenter', 'rightBottomToTop', 'rightCenterToTop', 'leftTopToBottom', 'leftCenterToBottom', 'leftCenter', 'leftBottomToTop', 'leftCenterToTop', 'bottomRight', 'bottomLeft', 'topRight', 'topLeft', 'rightBottom', 'rightTop', 'leftBottom', 'leftTop']])
12
+ };
13
+ export default messageActionsMorePropTypes;
@@ -0,0 +1,68 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ /** ** Libraries *** */
4
+ import React, { useCallback } from 'react';
5
+ /** ** Components *** */
6
+
7
+ import { Container } from '@zohodesk/components/lib/Layout';
8
+ import MessageActionsMore from '../MessageActionsMore/MessageActionsMore';
9
+ /** ** Hooks *** */
10
+
11
+ import useMessageActionsWrapper from '@zohoim/chat-components-hooks/es/MessageActionsWrapper/useMessageActionsWrapper';
12
+ /** ** Constants *** */
13
+
14
+ import messageActionsWrapperDefaultProps from './props/defaultProps';
15
+ import messageActionsWrapperPropTypes from './props/propTypes';
16
+ import { dummyArray, dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
17
+ /** ** Methods *** */
18
+
19
+ import renderHandler from '@zohoim/chat-components-utils/es/common/renderHandler';
20
+ import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
21
+ /** ** Style *** */
22
+
23
+ import style from './css/MessageActionsWrapper.module.css';
24
+ export default function MessageActionsWrapper(props) {
25
+ const {
26
+ actions,
27
+ renderMoreIcon,
28
+ defaultShowCount,
29
+ customStyle,
30
+ customProps
31
+ } = props;
32
+ const {
33
+ messageActionsMoreProps = dummyObject
34
+ } = customProps;
35
+ /* External CSS Customization */
36
+
37
+ const newStyle = useMergeStyle(style, customStyle);
38
+ const {
39
+ isShowMore: isShowMoreIcon,
40
+ actions: defaultActions = dummyArray,
41
+ moreActions = dummyArray
42
+ } = useMessageActionsWrapper(actions, defaultShowCount);
43
+ const renderDefaultActions = useCallback(() => defaultActions.map(action => {
44
+ const {
45
+ id,
46
+ renderFunction
47
+ } = action;
48
+ return renderHandler(renderFunction)({
49
+ id,
50
+ isShowInMore: false,
51
+ action
52
+ }); // id, isRenderInMorePopup
53
+ }), [defaultActions]);
54
+ const renderMoreActions = useCallback(() => /*#__PURE__*/React.createElement(MessageActionsMore, _extends({
55
+ actions: moreActions,
56
+ renderMoreIcon: renderMoreIcon
57
+ }, messageActionsMoreProps)), [moreActions, renderMoreIcon, messageActionsMoreProps]);
58
+ const renderRow = useCallback(() => /*#__PURE__*/React.createElement(Container, {
59
+ alignBox: "row",
60
+ isCover: false
61
+ }, renderDefaultActions(), isShowMoreIcon ? renderMoreActions() : null), [renderDefaultActions, renderMoreActions, isShowMoreIcon]);
62
+ return /*#__PURE__*/React.createElement("div", {
63
+ className: newStyle.messageActionsWrapper
64
+ }, renderRow(defaultActions, isShowMoreIcon));
65
+ }
66
+ MessageActionsWrapper.defaultProps = messageActionsWrapperDefaultProps;
67
+ MessageActionsWrapper.propTypes = messageActionsWrapperPropTypes;
68
+ MessageActionsWrapper.displayName = 'MessageActionsWrapper';
@@ -0,0 +1,3 @@
1
+ .messageActionsWrapper {
2
+ /* Use this class for message actions customization */
3
+ }
@@ -0,0 +1 @@
1
+ export { default as MessageActionsWrapper } from './MessageActionsWrapper';
@@ -0,0 +1,9 @@
1
+ /** ** Constants *** */
2
+ import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
3
+ import { actionsDefaultShowCount } from '@zohoim/chat-components-utils/es/constants/messageActionConstants';
4
+ const messageActionsWrapperDefaultProps = {
5
+ customStyle: dummyObject,
6
+ customProps: dummyObject,
7
+ defaultShowCount: actionsDefaultShowCount
8
+ };
9
+ export default messageActionsWrapperDefaultProps;
@@ -0,0 +1,15 @@
1
+ /** ** Libraries *** */
2
+ import PropTypes from 'prop-types';
3
+ const messageActionsWrapperPropTypes = {
4
+ actions: PropTypes.arrayOf(PropTypes.shape({
5
+ id: PropTypes.string.isRequired,
6
+ renderFunction: PropTypes.func
7
+ })).isRequired,
8
+ customProps: PropTypes.shape({
9
+ messageActionsMoreProps: PropTypes.object
10
+ }),
11
+ customStyle: PropTypes.object,
12
+ defaultShowCount: PropTypes.number,
13
+ renderMoreIcon: PropTypes.func
14
+ };
15
+ export default messageActionsWrapperPropTypes;
@@ -0,0 +1,49 @@
1
+ /** ** Libraries *** */
2
+ import React from 'react';
3
+ /** ** Components *** */
4
+
5
+ import Avatar from '@zohodesk/components/es/Avatar/Avatar';
6
+ /** ** CSS *** */
7
+
8
+ import style from './css/MessageAvatar.module.css';
9
+ /** ** Hooks *** */
10
+
11
+ import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
12
+ /** ** Methods *** */
13
+
14
+ import renderHandler from '@zohoim/chat-components-utils/es/common/renderHandler';
15
+ /** ** Constants *** */
16
+
17
+ import messageAvatarDefaultProps from './props/defaultProps';
18
+ import messageAvatarPropTypes from './props/propTypes';
19
+ export default function MessageAvatar(props) {
20
+ const {
21
+ src,
22
+ alternateSrc,
23
+ title,
24
+ size,
25
+ name,
26
+ customStyle,
27
+ iconTitle,
28
+ renderIcon
29
+ } = props;
30
+ /* External CSS Customization */
31
+
32
+ const newStyle = useMergeStyle(style, customStyle);
33
+ const icon = renderHandler(renderIcon)();
34
+ return /*#__PURE__*/React.createElement("div", {
35
+ className: newStyle.msgAvatar
36
+ }, /*#__PURE__*/React.createElement(Avatar, {
37
+ alternateSrc: alternateSrc,
38
+ customClass: newStyle.avatar,
39
+ name: name,
40
+ size: size,
41
+ src: src,
42
+ title: title
43
+ }), icon ? /*#__PURE__*/React.createElement("span", {
44
+ className: newStyle.icon,
45
+ "data-title": iconTitle
46
+ }, icon) : null);
47
+ }
48
+ MessageAvatar.defaultProps = messageAvatarDefaultProps;
49
+ MessageAvatar.propTypes = messageAvatarPropTypes;
@@ -0,0 +1,23 @@
1
+ .msgAvatar {
2
+ position: relative;
3
+ display: inline-flex;
4
+ }
5
+
6
+ .icon {
7
+ position: absolute;
8
+ bottom: calc( var(--zd_size6) * -1 ) ;
9
+ }
10
+
11
+ [dir=ltr] .icon {
12
+ right: calc( var(--zd_size7) * -1 ) ;
13
+ }
14
+
15
+ [dir=rtl] .icon {
16
+ left: calc( var(--zd_size7) * -1 ) ;
17
+ }
18
+
19
+ .avatar {
20
+ /* Use this class name for external customization */
21
+ width: var(--zd_size32) ;
22
+ height: var(--zd_size32) ;
23
+ }
@@ -0,0 +1 @@
1
+ export { default as MessageAvatar } from './MessageAvatar';
@@ -0,0 +1,7 @@
1
+ /** ** Constants *** */
2
+ import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
3
+ const messageAvatarDefaultProps = {
4
+ customStyle: dummyObject,
5
+ size: 'medium'
6
+ };
7
+ export default messageAvatarDefaultProps;
@@ -0,0 +1,13 @@
1
+ /** ** Libraries *** */
2
+ import PropTypes from 'prop-types';
3
+ const messageAvatarPropTypes = {
4
+ src: PropTypes.string.isRequired,
5
+ alternateSrc: PropTypes.string,
6
+ customStyle: PropTypes.object,
7
+ iconTitle: PropTypes.string,
8
+ name: PropTypes.string,
9
+ renderIcon: PropTypes.func,
10
+ size: PropTypes.oneOf(['xxsmall', 'small', 'xsmall', 'medium', 'xmedium', 'large', 'xlarge']),
11
+ title: PropTypes.string
12
+ };
13
+ export default messageAvatarPropTypes;
@@ -0,0 +1,66 @@
1
+ /** ** Libraries *** */
2
+ import React from 'react';
3
+ /** ** Hooks *** */
4
+
5
+ import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
6
+ /** ** Constants *** */
7
+
8
+ import messageBoxDefaultProps from './props/defaultProps';
9
+ import messageBoxPropTypes from './props/propTypes';
10
+ /** ** Methods *** */
11
+
12
+ import renderHandler from '@zohoim/chat-components-utils/es/common/renderHandler';
13
+ import cssJSLogic from './css/cssJSLogic';
14
+ /** ** Components *** */
15
+
16
+ import { Box } from '@zohodesk/components/es/Layout';
17
+ /** ** Styles *** */
18
+
19
+ import style from './css/MessageBox.module.css';
20
+ export default function MessageBox(props) {
21
+ const {
22
+ renderMessage: renderMessageContent,
23
+ renderMessageFooter,
24
+ renderMessageHeader,
25
+ customStyle,
26
+ renderMessageStatus,
27
+ isFailed,
28
+ isIncoming,
29
+ isOutgoing
30
+ } = props;
31
+ /* External CSS Customization */
32
+
33
+ const newStyle = useMergeStyle(style, customStyle);
34
+ /* css classnames added based on logic */
35
+
36
+ const {
37
+ messageBoxClass
38
+ } = cssJSLogic({
39
+ isFailed,
40
+ isIncoming,
41
+ isOutgoing
42
+ }, newStyle);
43
+ /* Render Childrens */
44
+
45
+ const messageHeader = renderHandler(renderMessageHeader)();
46
+ const messageConent = renderHandler(renderMessageContent)();
47
+ const messageFooter = renderHandler(renderMessageFooter)();
48
+ const messageStatus = renderHandler(renderMessageStatus)();
49
+ return /*#__PURE__*/React.createElement("div", {
50
+ className: messageBoxClass
51
+ }, /*#__PURE__*/React.createElement(Box, {
52
+ className: newStyle.messageBoxInner,
53
+ flexible: true
54
+ }, messageHeader ? /*#__PURE__*/React.createElement(Box, {
55
+ className: newStyle.messageHeaderWrapper
56
+ }, messageHeader) : null, messageConent ? /*#__PURE__*/React.createElement(Box, {
57
+ className: newStyle.messageContentWrapper
58
+ }, messageConent) : null, messageFooter ? /*#__PURE__*/React.createElement(Box, {
59
+ className: newStyle.messageFooterWrapper
60
+ }, messageFooter) : null), messageStatus ? /*#__PURE__*/React.createElement(Box, {
61
+ className: newStyle.messageStatusWrapper
62
+ }, messageStatus) : null);
63
+ }
64
+ MessageBox.propTypes = messageBoxPropTypes;
65
+ MessageBox.defaultProps = messageBoxDefaultProps;
66
+ MessageBox.displayName = 'MessageBox';
@@ -0,0 +1,56 @@
1
+ .varClass {
2
+ --messageBox-content_padding: var(--zd_size14);
3
+ --messageBox-content_size: var(--zd_font_size14);
4
+ --messageBox-border_radius: 9px;
5
+ --messageBox-message_status_gap: var(--zd_size12);
6
+ --messageBox-message_header_gap: var(--zd_size1);
7
+ --messageBox-message_footer_gap: var(--zd_size1);
8
+ }
9
+
10
+ .messageBoxContainer {
11
+ composes: varClass;
12
+ display: grid;
13
+ grid-template-columns: 1fr auto;
14
+ align-items: flex-end;
15
+ color: var(--imlib_chat_components_messageBox_text_color);
16
+ word-wrap: break-word;
17
+ font-size: var(--messageBox-content_size);
18
+ box-sizing: border-box;
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
+ .messageContentWrapper {
25
+ /* Use this class for message content customization */
26
+ line-height: 150%;
27
+ }
28
+
29
+ .messageHeaderWrapper {
30
+ margin-bottom: var(--messageBox-message_header_gap);
31
+ }
32
+
33
+ .messageFooterWrapper {
34
+ margin-top: var(--messageBox-message_footer_gap);
35
+ }
36
+
37
+ [dir=ltr] .messageStatusWrapper {
38
+ margin-left: var(--messageBox-message_status_gap);
39
+ }
40
+
41
+ [dir=rtl] .messageStatusWrapper {
42
+ margin-right: var(--messageBox-message_status_gap);
43
+ }
44
+
45
+ .failedMessageBox {
46
+ color: var(--imlib_chat_components_messageBox_failed_text_color);
47
+ background-color: var(--imlib_chat_components_messageBox_failed_bg_color);
48
+ }
49
+
50
+ .incomingMessageBox {
51
+ background-color: var(--imlib_chat_components_messageBox_incoming_bg_color);
52
+ }
53
+
54
+ .outgoingMessageBox {
55
+ background-color: var(--imlib_chat_components_messageBox_outgoing_bg_color);
56
+ }
@@ -0,0 +1,18 @@
1
+ /** ** Methods *** */
2
+ import { compileClassNames } from '@zohodesk/utils';
3
+ export default function cssJSLogic(props, style) {
4
+ const {
5
+ isFailed,
6
+ isIncoming,
7
+ isOutgoing
8
+ } = props;
9
+ const messageBoxClass = compileClassNames({
10
+ [style.messageBoxContainer]: true,
11
+ [style.failedMessageBox]: isFailed,
12
+ [style.incomingMessageBox]: isIncoming && !isFailed,
13
+ [style.outgoingMessageBox]: isOutgoing && !isFailed
14
+ });
15
+ return {
16
+ messageBoxClass
17
+ };
18
+ }
@@ -0,0 +1 @@
1
+ export { default as MessageBox } from './MessageBox';
@@ -0,0 +1,6 @@
1
+ /** ** Constants *** */
2
+ import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
3
+ export default {
4
+ customStyle: dummyObject,
5
+ isOutgoing: true
6
+ };
@@ -0,0 +1,13 @@
1
+ /** ** Libraries *** */
2
+ import PropTypes from 'prop-types';
3
+ const messageBoxPropTypes = {
4
+ isIncoming: PropTypes.bool.isRequired,
5
+ isOutgoing: PropTypes.bool.isRequired,
6
+ renderMessage: PropTypes.func.isRequired,
7
+ customStyle: PropTypes.object,
8
+ isFailed: PropTypes.bool,
9
+ renderMessageFooter: PropTypes.func,
10
+ renderMessageHeader: PropTypes.func,
11
+ renderMessageStatus: PropTypes.func
12
+ };
13
+ export default messageBoxPropTypes;
@@ -0,0 +1,116 @@
1
+ /* eslint-disable no-confusing-arrow */
2
+
3
+ /** ** Libraries *** */
4
+ import React, { useCallback, useMemo } from 'react';
5
+ /** ** Hooks *** */
6
+
7
+ import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
8
+ import useMessageBubbleAction from '@zohoim/chat-components-hooks/es/MessageBubble/useMessageBubbleAction';
9
+ /** ** Constants *** */
10
+
11
+ import messageBubbleDefaultProps from './props/defaultProps';
12
+ import messageBubblePropTypes from './props/propTypes';
13
+ /** ** Methods *** */
14
+
15
+ import renderHandler from '@zohoim/chat-components-utils/es/common/renderHandler';
16
+ import cssJSLogic from './css/cssJSLogic';
17
+ /** ** Components *** */
18
+
19
+ import { Box } from '@zohodesk/components/es/Layout';
20
+ /** ** Styles *** */
21
+
22
+ import style from './css/MessageBubble.module.css';
23
+ export default function MessageBubble(props) {
24
+ const {
25
+ renderMessageBox,
26
+ renderMessageBoxFooter,
27
+ renderMessageOwner,
28
+ renderMessageActions,
29
+ customStyle,
30
+ needSender,
31
+ isActive,
32
+ direction
33
+ } = props;
34
+ /* External CSS Customization */
35
+
36
+ const newStyle = useMergeStyle(style, customStyle);
37
+ /* Use Hooks */
38
+
39
+ const {
40
+ onMouseEnter,
41
+ onMouseLeave,
42
+ isRenderMessageActions
43
+ } = useMessageBubbleAction(props);
44
+ /* css classnames added based on logic */
45
+
46
+ const {
47
+ bubbleClass,
48
+ messageActionWrapperClass
49
+ } = cssJSLogic({
50
+ isActive,
51
+ direction,
52
+ isRenderMessageActions
53
+ }, newStyle);
54
+ /* Render Childrens */
55
+
56
+ /* Message Sender Render */
57
+
58
+ const messageSenderRenderer = useCallback(() => {
59
+ const messageOwner = renderHandler(renderMessageOwner)();
60
+ return needSender ? /*#__PURE__*/React.createElement(Box, {
61
+ className: newStyle.messageOwnerWrapper
62
+ }, messageOwner) : null;
63
+ }, [renderMessageOwner, needSender, newStyle.messageOwnerWrapper]);
64
+ /* Message Actions Render */
65
+
66
+ const messageActionsRenderer = useCallback(() => {
67
+ const messageActions = isRenderMessageActions ? renderHandler(renderMessageActions)() : null;
68
+ return messageActions ? /*#__PURE__*/React.createElement(Box, {
69
+ className: messageActionWrapperClass
70
+ }, messageActions) : null;
71
+ }, [isRenderMessageActions, renderMessageActions, messageActionWrapperClass]);
72
+ /* Message Box Render */
73
+
74
+ const messageBoxRenderer = useCallback(() => {
75
+ const messageBox = renderHandler(renderMessageBox)();
76
+ return messageBox; // return messageBox ? (
77
+ // <Box flexible className={newStyle.messageBoxWrapper}>
78
+ // {messageBox}
79
+ // </Box>
80
+ // ) : null;
81
+ }, [renderMessageBox]);
82
+ /* Message BoxWithActions Render */
83
+
84
+ const messageBox = useMemo(() => messageBoxRenderer(), [messageBoxRenderer]);
85
+ const messageActions = useMemo(() => messageActionsRenderer(), [messageActionsRenderer]);
86
+ const messageBoxWithActionsRenderer = useCallback(() => messageBox || messageActions ? /*#__PURE__*/React.createElement(Box, {
87
+ className: newStyle.messageContainer
88
+ }, /*#__PURE__*/React.createElement(Box, {
89
+ className: newStyle.messageBoxWrapper,
90
+ flexible: true
91
+ }, messageBox, messageActions)) : null, [messageBox, messageActions, newStyle.messageContainer, newStyle.messageBoxWrapper]);
92
+ /* Message Footer Render */
93
+
94
+ const messageFooterRenderer = useCallback(() => {
95
+ const messageBoxFooter = renderHandler(renderMessageBoxFooter)();
96
+ return messageBoxFooter ? /*#__PURE__*/React.createElement(Box, {
97
+ className: newStyle.messageBoxFooterWrapper
98
+ }, messageBoxFooter) : null;
99
+ }, [renderMessageBoxFooter, newStyle.messageBoxFooterWrapper]);
100
+ /* Get the components */
101
+
102
+ const messageSender = useMemo(() => messageSenderRenderer(), [messageSenderRenderer]);
103
+ const messageBoxWithActions = useMemo(() => messageBoxWithActionsRenderer(), [messageBoxWithActionsRenderer]);
104
+ const messageFooter = useMemo(() => messageFooterRenderer(), [messageFooterRenderer]);
105
+ /* Construct Layout */
106
+
107
+ const messageLayout = /*#__PURE__*/React.createElement("div", {
108
+ className: bubbleClass,
109
+ onMouseEnter: onMouseEnter,
110
+ onMouseLeave: onMouseLeave
111
+ }, messageSender, messageBoxWithActions, messageFooter);
112
+ return messageLayout;
113
+ }
114
+ MessageBubble.propTypes = messageBubblePropTypes;
115
+ MessageBubble.defaultProps = messageBubbleDefaultProps;
116
+ MessageBubble.displayName = 'MessageBubble';