@zohoim/chat-components 1.1.3 → 1.1.4
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 +4 -0
- package/es/ActionIconWrapper/ActionIconWrapper.js +5 -1
- package/es/AttachmentHandler/AttachmentHandler.js +3 -0
- package/es/Emoji/Emoji.js +5 -1
- package/es/EmojiPopup/EmojiPopup.js +3 -0
- package/es/EmojiPopup/css/EmojiPopup.module.css +0 -5
- package/es/EmojisFooter/css/EmojisFooter.module.css +1 -2
- package/es/MessageActions/MessageActions.js +4 -2
- package/es/MessageActions/props/propTypes.js +2 -1
- package/es/MessageBubble/MessageBubble.js +20 -4
- package/es/MoreActionItem/MoreActionItem.js +4 -0
- package/es/TextBubble/TextBubble.js +5 -2
- package/es/TextBubble/css/TextBubble.module.css +1 -0
- package/es/im/ReplyEditor/css/ReplyEditor.module.css +4 -0
- package/package.json +4 -4
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
|
-
|
|
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,
|
|
@@ -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,
|
|
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("
|
|
42
|
+
}), moreText ? /*#__PURE__*/React.createElement("button", {
|
|
43
43
|
className: moreTextClass,
|
|
44
|
-
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohoim/chat-components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
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.
|
|
46
|
-
"@zohoim/chat-components-utils": "1.1.
|
|
45
|
+
"@zohoim/chat-components-hooks": "1.1.4",
|
|
46
|
+
"@zohoim/chat-components-utils": "1.1.4"
|
|
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": "
|
|
55
|
+
"gitHead": "0058c5987d4381f3356078cbcc1e2ca2f6f467ed"
|
|
56
56
|
}
|