@zohodesk/dot 1.9.9 → 1.9.10
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/ActionButton/ActionButton.js +18 -8
- package/es/ActionButton/__tests__/__snapshots__/ActionButton.spec.js.snap +47 -60
- package/es/ActionButton/props/defaultProps.js +2 -1
- package/es/ActionButton/props/propTypes.js +4 -1
- package/lib/ActionButton/ActionButton.js +17 -8
- package/lib/ActionButton/__tests__/__snapshots__/ActionButton.spec.js.snap +47 -60
- package/lib/ActionButton/props/defaultProps.js +2 -1
- package/lib/ActionButton/props/propTypes.js +4 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
In this Library, we Provide Some Basic Components to Build Your Application
|
|
4
4
|
|
|
5
|
+
# 1.9.10
|
|
6
|
+
|
|
7
|
+
- **ActionButton**
|
|
8
|
+
- Accessibility improvements:
|
|
9
|
+
- Removed hardcoded `tabIndex='0'` from the content box and arrow button elements.
|
|
10
|
+
- Arrow button now exposes `aria-expanded` and `aria-controls` attributes for screen reader support.
|
|
11
|
+
- Popup is assigned a unique `htmlId` (via `getUniqueId`) linked to `aria-controls` on the arrow button.
|
|
12
|
+
- Added `a11yAttributes` prop.
|
|
13
|
+
|
|
5
14
|
# 1.9.9
|
|
6
15
|
|
|
7
16
|
- PX to variable conversion was not applied due to the CBT migration. The issue has now been fixed.
|
|
@@ -1,3 +1,5 @@
|
|
|
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
|
+
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { defaultProps } from "./props/defaultProps";
|
|
3
5
|
import { propTypes } from "./props/propTypes";
|
|
@@ -7,13 +9,16 @@ import Button from '@zohodesk/components/es/Button/Button';
|
|
|
7
9
|
import { Container, Box } from '@zohodesk/components/es/Layout';
|
|
8
10
|
import ResponsiveDropBox from '@zohodesk/components/es/ResponsiveDropBox/ResponsiveDropBox';
|
|
9
11
|
import CssProvider from '@zohodesk/components/es/Provider/CssProvider';
|
|
12
|
+
import { getUniqueId } from '@zohodesk/components/es/Provider/IdProvider';
|
|
10
13
|
import style from "./ActionButton.module.css";
|
|
11
14
|
import btnStyle from '@zohodesk/components/es/semantic/Button/semanticButton.module.css';
|
|
12
15
|
export class ActionButton extends React.Component {
|
|
13
16
|
constructor(props) {
|
|
14
17
|
super(props);
|
|
18
|
+
this.getElementId = getUniqueId(this);
|
|
15
19
|
this.handleTogglePopup = this.handleTogglePopup.bind(this);
|
|
16
20
|
this.handlePopupOpen = this.handlePopupOpen.bind(this);
|
|
21
|
+
this.popupId = this.getElementId();
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
handlePopupOpen(e) {
|
|
@@ -64,8 +69,12 @@ export class ActionButton extends React.Component {
|
|
|
64
69
|
isAbsolutePositioningNeeded,
|
|
65
70
|
isRestrictScroll,
|
|
66
71
|
positionsOffset,
|
|
67
|
-
targetOffset
|
|
72
|
+
targetOffset,
|
|
73
|
+
a11yAttributes
|
|
68
74
|
} = this.props;
|
|
75
|
+
const {
|
|
76
|
+
splitButton: a11yAttributes_splitButton
|
|
77
|
+
} = a11yAttributes;
|
|
69
78
|
return /*#__PURE__*/React.createElement(Container, {
|
|
70
79
|
alignBox: "row",
|
|
71
80
|
isCover: false,
|
|
@@ -92,8 +101,7 @@ export class ActionButton extends React.Component {
|
|
|
92
101
|
dataId: dataId,
|
|
93
102
|
className: `${btnStyle.buttonReset} ${style.contentBox} ${style[palette + 'Btn']} ${style[size + '_btnBox']} ${children ? style.contentBoxBdr : style.contentBoxBdrRds} ${style.clickable} ${innerClassName} `,
|
|
94
103
|
"data-title": dataTitle,
|
|
95
|
-
tagName: "button"
|
|
96
|
-
tabIndex: "0"
|
|
104
|
+
tagName: "button"
|
|
97
105
|
}, /*#__PURE__*/React.createElement(Container, {
|
|
98
106
|
align: "both"
|
|
99
107
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -113,16 +121,17 @@ export class ActionButton extends React.Component {
|
|
|
113
121
|
}, text) : null)), subText ? /*#__PURE__*/React.createElement(Box, {
|
|
114
122
|
"data-title": removeChildrenTooltip ? null : subText,
|
|
115
123
|
className: style.subTxt
|
|
116
|
-
}, subText) : null)), children ? /*#__PURE__*/React.createElement(Box, {
|
|
124
|
+
}, subText) : null)), children ? /*#__PURE__*/React.createElement(Box, _extends({}, a11yAttributes_splitButton, {
|
|
117
125
|
onClick: onClick && !onHover ? this.handleTogglePopup : this.handlePopupOpen,
|
|
118
126
|
onMouseEnter: onClick ? onHover && this.handleTogglePopup : undefined,
|
|
119
127
|
onMouseLeave: onClick ? onHover && this.handleTogglePopup : undefined,
|
|
120
128
|
className: `${btnStyle.buttonReset} ${style[arrowBoxSize + '_arrowBox']} ${style[palette + 'Arw']} ${style.arrowWrapper} ${isPopupOpen ? style.arrowActive : ''}`,
|
|
121
129
|
dataId: `${dataId}_arrowButton`,
|
|
122
|
-
tabIndex: "0",
|
|
123
130
|
tagName: "button",
|
|
124
|
-
dataSelectorId: `${dataSelectorId}_arrowButton
|
|
125
|
-
|
|
131
|
+
dataSelectorId: `${dataSelectorId}_arrowButton`,
|
|
132
|
+
"aria-expanded": isPopupOpen,
|
|
133
|
+
"aria-controls": this.popupId
|
|
134
|
+
}), /*#__PURE__*/React.createElement(Container, {
|
|
126
135
|
align: "both"
|
|
127
136
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
128
137
|
name: "ZD-down",
|
|
@@ -146,7 +155,8 @@ export class ActionButton extends React.Component {
|
|
|
146
155
|
isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
|
|
147
156
|
isRestrictScroll: isRestrictScroll,
|
|
148
157
|
positionsOffset: positionsOffset,
|
|
149
|
-
targetOffset: targetOffset
|
|
158
|
+
targetOffset: targetOffset,
|
|
159
|
+
htmlId: this.popupId
|
|
150
160
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
151
161
|
flexible: true,
|
|
152
162
|
shrink: true,
|