@zohoim/chat-components 1.1.1 → 1.1.2-beta.1

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 (61) hide show
  1. package/README.md +5 -1
  2. package/assets/Appearance/dark/mode/General_DarkMode.module.css +93 -0
  3. package/assets/Appearance/dark/themes/blue/blue_General_DarkTheme.module.css +40 -0
  4. package/assets/Appearance/dark/themes/green/green_General_DarkTheme.module.css +40 -0
  5. package/assets/Appearance/dark/themes/orange/orange_General_DarkTheme.module.css +40 -0
  6. package/assets/Appearance/dark/themes/red/red_General_DarkTheme.module.css +40 -0
  7. package/assets/Appearance/dark/themes/yellow/yellow_General_DarkTheme.module.css +40 -0
  8. package/assets/Appearance/light/mode/General_LightMode.module.css +93 -0
  9. package/assets/Appearance/light/themes/blue/blue_General_LightTheme.module.css +40 -0
  10. package/assets/Appearance/light/themes/green/green_General_LightTheme.module.css +40 -0
  11. package/assets/Appearance/light/themes/orange/orange_General_LightTheme.module.css +40 -0
  12. package/assets/Appearance/light/themes/red/red_General_LightTheme.module.css +40 -0
  13. package/assets/Appearance/light/themes/yellow/yellow_General_LightTheme.module.css +40 -0
  14. package/assets/Appearance/pureDark/mode/General_PureDarkMode.module.css +93 -0
  15. package/assets/Appearance/pureDark/themes/blue/blue_General_PureDarkTheme.module.css +40 -0
  16. package/assets/Appearance/pureDark/themes/green/green_General_PureDarkTheme.module.css +40 -0
  17. package/assets/Appearance/pureDark/themes/orange/orange_General_PureDarkTheme.module.css +40 -0
  18. package/assets/Appearance/pureDark/themes/red/red_General_PureDarkTheme.module.css +40 -0
  19. package/assets/Appearance/pureDark/themes/yellow/yellow_General_PureDarkTheme.module.css +40 -0
  20. package/es/ActionIconWrapper/ActionIconWrapper.js +5 -1
  21. package/es/AttachmentHandler/AttachmentHandler.js +3 -0
  22. package/es/AttachmentHandler/css/AttachmentHandler.module.css +2 -2
  23. package/es/AttachmentPreviewBody/css/AttachmentPreviewBody.module.css +4 -8
  24. package/es/AttachmentPreviewHeader/css/AttachmentPreviewHeader.module.css +4 -4
  25. package/es/Emoji/Emoji.js +5 -1
  26. package/es/EmojiPopup/EmojiPopup.js +4 -1
  27. package/es/EmojiPopup/css/EmojiPopup.module.css +2 -2
  28. package/es/EmojisFooter/css/EmojisFooter.module.css +3 -4
  29. package/es/EmojisHeader/css/EmojisHeader.module.css +3 -3
  30. package/es/MessageActions/MessageActions.js +3 -1
  31. package/es/MessageActions/props/propTypes.js +2 -1
  32. package/es/MessageBubble/MessageBubble.js +20 -4
  33. package/es/MoreActionItem/MoreActionItem.js +4 -0
  34. package/es/TextBubble/TextBubble.js +5 -2
  35. package/es/TextBubble/css/TextBubble.module.css +1 -0
  36. package/es/Theme/ThemeAssets.js +18 -0
  37. package/es/Theme/ThemeWrapper.js +7 -5
  38. package/es/Theme/utils/getThemeConfigurations.js +1 -55
  39. package/es/im/IMIntegrationIcon/css/IMIntegrationIcon.module.css +2 -2
  40. package/es/im/ReplyEditor/css/ReplyEditor.module.css +4 -4
  41. package/lib/index.js +538 -0
  42. package/package.json +18 -11
  43. package/es/Theme/themeVariables/commonThemeColorVariable.js +0 -17
  44. package/es/Theme/themeVariables/dark/blueTheme.js +0 -133
  45. package/es/Theme/themeVariables/dark/commonColorVariable.js +0 -35
  46. package/es/Theme/themeVariables/dark/greenTheme.js +0 -132
  47. package/es/Theme/themeVariables/dark/orangeTheme.js +0 -132
  48. package/es/Theme/themeVariables/dark/redTheme.js +0 -132
  49. package/es/Theme/themeVariables/dark/yellowTheme.js +0 -132
  50. package/es/Theme/themeVariables/light/blueTheme.js +0 -135
  51. package/es/Theme/themeVariables/light/commonColorVariable.js +0 -54
  52. package/es/Theme/themeVariables/light/greenTheme.js +0 -131
  53. package/es/Theme/themeVariables/light/orangeTheme.js +0 -131
  54. package/es/Theme/themeVariables/light/redTheme.js +0 -131
  55. package/es/Theme/themeVariables/light/yellowTheme.js +0 -131
  56. package/es/Theme/themeVariables/pureDark/blueTheme.js +0 -132
  57. package/es/Theme/themeVariables/pureDark/commonColorVariable.js +0 -37
  58. package/es/Theme/themeVariables/pureDark/greenTheme.js +0 -132
  59. package/es/Theme/themeVariables/pureDark/orangeTheme.js +0 -132
  60. package/es/Theme/themeVariables/pureDark/redTheme.js +0 -132
  61. package/es/Theme/themeVariables/pureDark/yellowTheme.js +0 -132
@@ -20,6 +20,7 @@ import { Box } from '@zohodesk/components/es/Layout';
20
20
  /** ** Styles *** */
21
21
 
22
22
  import style from "./css/MessageBubble.module.css";
23
+ import generateUniqueId from '@zohoim/chat-components-utils/es/common/generateUniqueId';
23
24
  export default function MessageBubble(props) {
24
25
  const {
25
26
  renderMessageBox,
@@ -39,7 +40,9 @@ export default function MessageBubble(props) {
39
40
  const {
40
41
  onMouseEnter,
41
42
  onMouseLeave,
42
- isRenderMessageActions
43
+ isRenderMessageActions,
44
+ onFocus,
45
+ onBlur
43
46
  } = useMessageBubbleAction(props);
44
47
  /* css classnames added based on logic */
45
48
 
@@ -67,7 +70,9 @@ export default function MessageBubble(props) {
67
70
  const messageActionsRenderer = useCallback(() => {
68
71
  const messageActions = isRenderMessageActions ? renderHandler(renderMessageActions)() : null;
69
72
  return messageActions ? /*#__PURE__*/React.createElement(Box, {
70
- className: messageActionWrapperClass
73
+ className: messageActionWrapperClass,
74
+ role: "button",
75
+ tabIndex: "0"
71
76
  }, messageActions) : null;
72
77
  }, [isRenderMessageActions, renderMessageActions, messageActionWrapperClass]);
73
78
  /* Message Box Render */
@@ -84,12 +89,16 @@ export default function MessageBubble(props) {
84
89
 
85
90
  const messageBox = useMemo(() => messageBoxRenderer(), [messageBoxRenderer]);
86
91
  const messageActions = useMemo(() => messageActionsRenderer(), [messageActionsRenderer]);
92
+ const uniqueId = generateUniqueId();
87
93
  const messageBoxWithActionsRenderer = useCallback(() => messageBox || messageActions ? /*#__PURE__*/React.createElement(Box, {
88
94
  className: newStyle.messageContainer
89
95
  }, /*#__PURE__*/React.createElement(Box, {
90
96
  className: newStyle.messageBoxWrapper,
91
97
  flexible: true
92
- }, messageBox, messageActions)) : null, [messageBox, messageActions, newStyle.messageContainer, newStyle.messageBoxWrapper]);
98
+ }, messageBox, /*#__PURE__*/React.createElement("div", {
99
+ id: uniqueId,
100
+ role: "menu"
101
+ }, messageActions))) : null, [messageBox, messageActions, newStyle.messageContainer, newStyle.messageBoxWrapper, uniqueId]);
93
102
  /* Message Footer Render */
94
103
 
95
104
  const messageFooterRenderer = useCallback(() => {
@@ -106,9 +115,16 @@ export default function MessageBubble(props) {
106
115
  /* Construct Layout */
107
116
 
108
117
  const messageLayout = /*#__PURE__*/React.createElement("div", {
118
+ "aria-controls": uniqueId,
119
+ "aria-expanded": isRenderMessageActions ? 'true' : 'false',
120
+ "aria-haspopup": "true",
109
121
  className: bubbleClass,
122
+ onBlur: onBlur,
123
+ onFocus: onFocus,
110
124
  onMouseEnter: onMouseEnter,
111
- onMouseLeave: onMouseLeave
125
+ onMouseLeave: onMouseLeave,
126
+ role: "button",
127
+ tabIndex: 0
112
128
  }, messageSender, messageBoxWithActions, messageFooter);
113
129
  return messageLayout;
114
130
  }
@@ -50,6 +50,10 @@ export default function MoreActionItem(props) {
50
50
  id
51
51
  });
52
52
  return /*#__PURE__*/React.createElement(ListContainer, {
53
+ a11y: {
54
+ 'data-a11y-focus': true,
55
+ 'data-a11y-click': true
56
+ },
53
57
  autoHover: true,
54
58
  customClass: newStyle.listItem,
55
59
  disableTitle: title,
@@ -39,9 +39,12 @@ export default function TextBubble(props) {
39
39
  // __html: HTMLPurifier.sanitize(message)
40
40
  __html: message
41
41
  }
42
- }), moreText ? /*#__PURE__*/React.createElement("div", {
42
+ }), moreText ? /*#__PURE__*/React.createElement("button", {
43
43
  className: moreTextClass,
44
- onClick: onClickMore
44
+ "data-a11y-click": "true",
45
+ "data-a11y-focus": "true",
46
+ onClick: onClickMore,
47
+ tabIndex: "0"
45
48
  }, moreText) : null);
46
49
  }
47
50
  TextBubble.propTypes = textBubblePropTypes;
@@ -9,6 +9,7 @@
9
9
 
10
10
  .moreText {
11
11
  color: var(--imlib_chat_components_textBubble_see_more_color);
12
+ composes: buttonReset from '~@zohodesk/components/es/semantic/Button/semanticButton.module.css';
12
13
  cursor: pointer;
13
14
  }
14
15
 
@@ -67,6 +67,24 @@ import '@zohodesk/variables/assets/fontsizeVariables.module.css';
67
67
  import '@zohodesk/variables/es/fontFamilyVariables.module.css';
68
68
  import '@zohodesk/variables/assets/transitionVariables.module.css';
69
69
  import '@zohodesk/variables/assets/no_transitionVariables.module.css';
70
+ import "../../assets/Appearance/dark/mode/General_DarkMode.module.css";
71
+ import "../../assets/Appearance/dark/themes/blue/blue_General_DarkTheme.module.css";
72
+ import "../../assets/Appearance/dark/themes/green/green_General_DarkTheme.module.css";
73
+ import "../../assets/Appearance/dark/themes/orange/orange_General_DarkTheme.module.css";
74
+ import "../../assets/Appearance/dark/themes/red/red_General_DarkTheme.module.css";
75
+ import "../../assets/Appearance/dark/themes/yellow/yellow_General_DarkTheme.module.css";
76
+ import "../../assets/Appearance/light/mode/General_LightMode.module.css";
77
+ import "../../assets/Appearance/light/themes/blue/blue_General_LightTheme.module.css";
78
+ import "../../assets/Appearance/light/themes/green/green_General_LightTheme.module.css";
79
+ import "../../assets/Appearance/light/themes/orange/orange_General_LightTheme.module.css";
80
+ import "../../assets/Appearance/light/themes/red/red_General_LightTheme.module.css";
81
+ import "../../assets/Appearance/light/themes/yellow/yellow_General_LightTheme.module.css";
82
+ import "../../assets/Appearance/pureDark/mode/General_PureDarkMode.module.css";
83
+ import "../../assets/Appearance/pureDark/themes/blue/blue_General_PureDarkTheme.module.css";
84
+ import "../../assets/Appearance/pureDark/themes/green/green_General_PureDarkTheme.module.css";
85
+ import "../../assets/Appearance/pureDark/themes/orange/orange_General_PureDarkTheme.module.css";
86
+ import "../../assets/Appearance/pureDark/themes/red/red_General_PureDarkTheme.module.css";
87
+ import "../../assets/Appearance/pureDark/themes/yellow/yellow_General_PureDarkTheme.module.css";
70
88
  export default function DeskAssets(props) {
71
89
  const {
72
90
  children
@@ -42,20 +42,22 @@ export default function ThemeWrapper(props) {
42
42
  /** ** ThemeConfigurations Handling *** */
43
43
 
44
44
  const {
45
- themeConfigurations,
46
45
  mode,
47
46
  theme
48
47
  } = getThemeConfigurations({
49
48
  mode: propMode,
50
49
  theme: propTheme
51
50
  });
52
- const configurations = propThemeConfigurations || themeConfigurations;
51
+ const configurations = propThemeConfigurations;
53
52
  /** ** Style Handling *** */
54
53
 
55
54
  const selector = `#${styleTagId}`;
56
55
  const prefix = '--imlib_';
57
56
  const configuration = useMemo(() => [configurations], [configurations]);
58
- const customizedVariables = useMemo(() => getCustomizedCssVariables(configuration, prefix), [configuration, prefix]);
57
+ const customizedVariables = useMemo(() => {
58
+ const cssVariables = propThemeConfigurations ? getCustomizedCssVariables(configuration, prefix) : null;
59
+ return cssVariables;
60
+ }, [configuration, prefix, propThemeConfigurations]);
59
61
  const wrapperDivProps = getWrapperDivProps({
60
62
  modeKey,
61
63
  themeKey,
@@ -71,9 +73,9 @@ export default function ThemeWrapper(props) {
71
73
  }), /*#__PURE__*/React.createElement("div", {
72
74
  "data-portal": EDITOR_POPUP_TARGET_PORTAL
73
75
  })), []);
74
- const renderStyle = useCallback(() => /*#__PURE__*/React.createElement("style", {
76
+ const renderStyle = useCallback(() => customizedVariables ? /*#__PURE__*/React.createElement("style", {
75
77
  id: "zoho-im-variables"
76
- }, `${selector}{${customizedVariables}}`), [selector, customizedVariables]);
78
+ }, `${selector}{${customizedVariables}}`) : null, [selector, customizedVariables]);
77
79
  const renderAssets = useCallback(() => /*#__PURE__*/React.createElement(React.Fragment, null, needThemeAssets ? /*#__PURE__*/React.createElement(ThemeAssets, null) : null, needTooltip ? /*#__PURE__*/React.createElement(TooltipWrapper, {
78
80
  containerRef: containerRef.current,
79
81
  customStyle: tooltipCustomStyle,
@@ -1,19 +1,4 @@
1
1
  import { modeConstants, themeConstants } from '@zohoim/chat-components-utils/es/constants/themeConstants';
2
- import lightBlue from "../themeVariables/light/blueTheme";
3
- import lightGreen from "../themeVariables/light/greenTheme";
4
- import lightOrange from "../themeVariables/light/orangeTheme";
5
- import lightRed from "../themeVariables/light/redTheme";
6
- import lightYellow from "../themeVariables/light/yellowTheme";
7
- import darkBlue from "../themeVariables/dark/blueTheme";
8
- import darkGreen from "../themeVariables/dark/greenTheme";
9
- import darkOrange from "../themeVariables/dark/orangeTheme";
10
- import darkRed from "../themeVariables/dark/redTheme";
11
- import darkYellow from "../themeVariables/dark/yellowTheme";
12
- import pureDarkBlue from "../themeVariables/pureDark/blueTheme";
13
- import pureDarkGreen from "../themeVariables/pureDark/greenTheme";
14
- import pureDarkOrange from "../themeVariables/pureDark/orangeTheme";
15
- import pureDarkRed from "../themeVariables/pureDark/redTheme";
16
- import pureDarkYellow from "../themeVariables/pureDark/yellowTheme";
17
2
  const modeMapping = {
18
3
  [modeConstants.LIGHT]: 'light',
19
4
  [modeConstants.DARK]: 'dark',
@@ -26,56 +11,17 @@ const themeMapping = {
26
11
  [themeConstants.RED]: 'red',
27
12
  [themeConstants.YELLOW]: 'yellow'
28
13
  };
29
- const concatString = '_';
30
14
  const defaultTheme = themeMapping[themeConstants.BLUE];
31
15
  const defaultMode = modeMapping[modeConstants.LIGHT];
32
- const defaultThemeConfiguration = lightBlue;
33
- const themeConfigMapping = {
34
- [`${modeConstants.LIGHT}${concatString}${themeConstants.BLUE}`]: lightBlue,
35
- [`${modeConstants.LIGHT}${concatString}${themeConstants.GREEN}`]: lightGreen,
36
- [`${modeConstants.LIGHT}${concatString}${themeConstants.ORANGE}`]: lightOrange,
37
- [`${modeConstants.LIGHT}${concatString}${themeConstants.RED}`]: lightRed,
38
- [`${modeConstants.LIGHT}${concatString}${themeConstants.YELLOW}`]: lightYellow,
39
- [`${modeConstants.DARK}${concatString}${themeConstants.BLUE}`]: darkBlue,
40
- [`${modeConstants.DARK}${concatString}${themeConstants.GREEN}`]: darkGreen,
41
- [`${modeConstants.DARK}${concatString}${themeConstants.ORANGE}`]: darkOrange,
42
- [`${modeConstants.DARK}${concatString}${themeConstants.RED}`]: darkRed,
43
- [`${modeConstants.DARK}${concatString}${themeConstants.YELLOW}`]: darkYellow,
44
- [`${modeConstants.PURE_DARK}${concatString}${themeConstants.BLUE}`]: pureDarkBlue,
45
- [`${modeConstants.PURE_DARK}${concatString}${themeConstants.GREEN}`]: pureDarkGreen,
46
- [`${modeConstants.PURE_DARK}${concatString}${themeConstants.ORANGE}`]: pureDarkOrange,
47
- [`${modeConstants.PURE_DARK}${concatString}${themeConstants.RED}`]: pureDarkRed,
48
- [`${modeConstants.PURE_DARK}${concatString}${themeConstants.YELLOW}`]: pureDarkYellow
49
- };
50
-
51
- function getThemeName() {
52
- let {
53
- mode = modeConstants.LIGHT,
54
- theme = themeConstants.BLUE
55
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
56
- const themeName = `${mode}${concatString}${theme}`;
57
- return {
58
- themeName
59
- };
60
- }
61
-
62
16
  export default function getThemeConfigurations(_ref) {
63
17
  let {
64
18
  mode: propMode,
65
19
  theme: propTheme
66
20
  } = _ref;
67
- const {
68
- themeName
69
- } = getThemeName({
70
- mode: propMode,
71
- theme: propTheme
72
- });
73
21
  const mode = propMode ? modeMapping[propMode] || propMode : defaultMode;
74
22
  const theme = propTheme ? themeMapping[propTheme] || propTheme : defaultTheme;
75
- const themeConfigurations = themeConfigMapping[themeName] || defaultThemeConfiguration;
76
23
  return {
77
24
  mode,
78
- theme,
79
- themeConfigurations
25
+ theme
80
26
  };
81
27
  }
@@ -64,9 +64,9 @@
64
64
  }
65
65
 
66
66
  .fontIcon :global .path1::before {
67
- color: var(--imlib_chat_components_imIntegrationIcon_path0_color);
67
+ color: var(--imlib_chat_components_imIntegrationIcon_path0_color) !important;
68
68
  }
69
69
 
70
70
  .fontIcon :global .path2::before {
71
- color: var(--imlib_chat_components_imIntegrationIcon_path1_color);
71
+ color: var(--imlib_chat_components_imIntegrationIcon_path1_color) !important;
72
72
  }
@@ -24,10 +24,10 @@
24
24
  font-family: var(--zd_regular) !important;
25
25
  line-height: 22px !important;
26
26
 
27
- --rte-text-color: var(--imlib_chat_components_replyEditor_color) !important;
28
- --rte-bg-color: var(--imlib_chat_components_replyEditor_bg) !important;
27
+ --rte-text-color: var(--imlib_chat_components_reply_editor_color) !important;
28
+ --rte-bg-color: var(--imlib_chat_components_reply_editor_bg) !important;
29
29
  --rte-placeholder-color: var(
30
- --imlib_chat_components_replyEditor_placeholder
30
+ --imlib_chat_components_reply_editor_placeholder_color
31
31
  ) !important;
32
32
  --rte-link-text-color: var(
33
33
  --imlib_chat_components_replyEditor_color
@@ -35,7 +35,7 @@
35
35
 
36
36
  padding: var(--zd_size16) !important;
37
37
  cursor: text !important;
38
- }
38
+ }
39
39
 
40
40
  .editorWrapper {
41
41
  /** ** Use this class for css customisations *** */