@zohoim/chat-components 1.1.3 → 1.1.4-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.
package/README.md CHANGED
@@ -10,6 +10,10 @@ In this Library, We Provide Some Basic Message Components to Build Your Chat App
10
10
 
11
11
  > import MessageBubble from '@zohoim/chat-components/es/MessageBubble/MessageBubble’;
12
12
 
13
+ # 1.1.4
14
+
15
+ - A11y related props and functionalities added
16
+
13
17
  # 1.1.3
14
18
 
15
19
  - Editor line break issue fix
@@ -53,10 +53,14 @@ export default function ActionIconWrapper(props) {
53
53
  id
54
54
  });
55
55
  return icon ? /*#__PURE__*/React.createElement("div", {
56
+ "aria-label": title,
56
57
  className: actionIconWrapperClass,
58
+ "data-a11y-focus": "true",
57
59
  "data-title": title,
58
60
  onClick: onClick,
59
- onMouseEnter: onMouseEnter
61
+ onMouseEnter: onMouseEnter,
62
+ role: "menuitem",
63
+ tabIndex: 0
60
64
  }, icon) : null;
61
65
  }
62
66
  ActionIconWrapper.propTypes = actionIconWrapperPropTypes;
@@ -71,6 +71,9 @@ export default function AttachmentHandler(props) {
71
71
  return /*#__PURE__*/React.createElement(Container, {
72
72
  alignBox: "column"
73
73
  }, customIcon || /*#__PURE__*/React.createElement(IconButton, {
74
+ a11y: {
75
+ ariaLabel: iconTitle
76
+ },
74
77
  className: newStyle.iconButton,
75
78
  iconClass: newStyle.icon,
76
79
  iconName: iconName,
package/es/Emoji/Emoji.js CHANGED
@@ -58,8 +58,12 @@ export default function Emoji(props) {
58
58
  });
59
59
  return /*#__PURE__*/React.createElement("span", {
60
60
  ref: eleRef,
61
+ "aria-label": title,
61
62
  className: emojiClass,
62
- onClick: onSelect
63
+ "data-a11y-focus": "true",
64
+ onClick: onSelect,
65
+ role: "button",
66
+ tabIndex: 0
63
67
  }, /*#__PURE__*/React.createElement("span", {
64
68
  className: newStyle.emojiContent,
65
69
  "data-smiley": emojiName,
@@ -75,6 +75,9 @@ function EmojiPopupComp(props) {
75
75
  return /*#__PURE__*/React.createElement(Container, {
76
76
  alignBox: "column"
77
77
  }, /*#__PURE__*/React.createElement(IconButton, {
78
+ a11y: {
79
+ ariaLabel: tooltip
80
+ },
78
81
  className: newStyle.iconWrapper,
79
82
  eleRef: getTargetRef,
80
83
  iconClass: newStyle.icon,
@@ -47,9 +47,4 @@
47
47
 
48
48
  .icon :global .path2:before {
49
49
  color: var(--imlib_chat_components_twotone_icon_border) !important;
50
- }
51
-
52
- .icon :global .path2{
53
- position: relative;
54
- z-index: 1;
55
50
  }
@@ -4,7 +4,6 @@
4
4
  }
5
5
 
6
6
  .tabIcon {
7
- /* padding: var(--zd_size10) var(--zd_size16); */
8
7
  position: relative;
9
8
  height: var(--zd_size35) ;
10
9
  display: flex;
@@ -36,5 +35,5 @@
36
35
  width: auto ;
37
36
  height: auto ;
38
37
  margin: 0 ;
39
- padding: 8% ;
38
+ padding: 0 8% ;
40
39
  }
@@ -29,7 +29,8 @@ export default function MessageActions(props) {
29
29
  setRetainMessageActions,
30
30
  renderSecondaryActions,
31
31
  customStyle,
32
- customProps
32
+ customProps,
33
+ moreTitle
33
34
  } = props;
34
35
  const {
35
36
  messageActionProps = dummyObject,
@@ -106,9 +107,10 @@ export default function MessageActions(props) {
106
107
  }, /*#__PURE__*/React.createElement(MoreIcon, null)), [newStyle.moreIcon]);
107
108
  const renderMore = useCallback(componentProps => /*#__PURE__*/React.createElement(ActionIconWrapper, {
108
109
  renderIcon: renderMoreIcon,
110
+ title: moreTitle,
109
111
  ...componentProps,
110
112
  ...actionIconWrapperProps
111
- }), [actionIconWrapperProps, renderMoreIcon]);
113
+ }), [actionIconWrapperProps, renderMoreIcon, moreTitle]);
112
114
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(MessageActionsWrapper, {
113
115
  actions: allActions,
114
116
  defaultShowCount: defaultShowCount,
@@ -21,6 +21,7 @@ const messageActionsPropTypes = {
21
21
  customStyle: PropTypes.object,
22
22
  defaultShowCount: PropTypes.number,
23
23
  renderSecondaryActions: PropTypes.func,
24
- setRetainMessageActions: PropTypes.func
24
+ setRetainMessageActions: PropTypes.func,
25
+ moreTitle: PropTypes.string
25
26
  };
26
27
  export default messageActionsPropTypes;
@@ -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
 
@@ -47,6 +47,7 @@ export default function ReplyComposer(props) {
47
47
  onFileSubmit: propOnFileSubmit,
48
48
  attachmentPreviewTexts,
49
49
  renderHeader,
50
+ renderBody,
50
51
  renderFooter,
51
52
  renderStencils,
52
53
  getEditorState: propGetEditorState,
@@ -102,6 +103,7 @@ export default function ReplyComposer(props) {
102
103
  isLoaded
103
104
  }, newStyle);
104
105
  const headerElement = useMemo(() => renderHandler(renderHeader)(), [renderHeader]);
106
+ const bodyElement = useMemo(() => renderBody ? renderHandler(renderBody)() : null, [renderBody]);
105
107
  const stencilsElement = useMemo(() => isLoading ? renderHandler(renderStencils)({
106
108
  needFooter
107
109
  }) : null, [renderStencils, needFooter, isLoading]);
@@ -125,7 +127,7 @@ export default function ReplyComposer(props) {
125
127
  onSubmit: onFileSubmit,
126
128
  texts: attachmentPreviewTexts,
127
129
  ...attachmentPreviewCustomProps
128
- }) : null, isLoaded ? headerElement : null, stencilsElement || null, /*#__PURE__*/React.createElement("div", {
130
+ }) : null, isLoaded ? headerElement : null, stencilsElement || null, bodyElement || /*#__PURE__*/React.createElement("div", {
129
131
  className: replEditorWrapperClass
130
132
  }, /*#__PURE__*/React.createElement(ReplyEditor, {
131
133
  content: content,
@@ -37,6 +37,10 @@
37
37
  cursor: text !important;
38
38
  }
39
39
 
40
+ div.editableDiv[contenteditable="true"]{
41
+ outline-offset: -5px !important;
42
+ }
43
+
40
44
  .editorWrapper {
41
45
  /** ** Use this class for css customisations *** */
42
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohoim/chat-components",
3
- "version": "1.1.3",
3
+ "version": "1.1.4-beta.1",
4
4
  "description": "Chat Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -42,8 +42,8 @@
42
42
  "@zohodesk/utils": "1.3.13",
43
43
  "@zohodesk/variables": "1.0.0",
44
44
  "@zohodesk/virtualizer": "1.0.13",
45
- "@zohoim/chat-components-hooks": "1.1.3",
46
- "@zohoim/chat-components-utils": "1.1.3"
45
+ "@zohoim/chat-components-hooks": "1.1.4-beta.1",
46
+ "@zohoim/chat-components-utils": "1.1.4-beta.1"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@zohodesk-private/color-variable-preprocessor": "1.2.1",
@@ -52,5 +52,5 @@
52
52
  "jsdom": "23.0.0",
53
53
  "react-to-jsx": "1.3.2"
54
54
  },
55
- "gitHead": "abb04f860c9b98548879fc18e70adf580b679af0"
55
+ "gitHead": "c5b05661a1ed8bf54fe39532d5918d92b6740309"
56
56
  }