@zohodesk/dot 1.0.0-temp-109 → 1.0.0-temp-110
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 +7 -0
- package/css_error.log +0 -0
- package/es/ActionButton/ActionButton.js +5 -2
- package/es/Drawer/Drawer.js +23 -9
- package/es/Drawer/Drawer.module.css +1 -1
- package/es/Drawer/props/defaultProps.js +2 -1
- package/es/Drawer/props/propTypes.js +2 -1
- package/es/alert/AlertLookup/AlertLookup.js +5 -53
- package/es/dropdown/ToggleDropDown/ToggleDropDown.js +15 -13
- package/es/list/Icons/DeleteIcon.js +2 -1
- package/es/list/Icons/SmartIcon.js +0 -1
- package/es/lookup/Lookup/Lookup.js +24 -12
- package/es/lookup/Lookup/props/defaultProps.js +2 -1
- package/es/lookup/Lookup/props/propTypes.js +2 -1
- package/es/lookup/header/Search/Search.js +5 -0
- package/es/version2/GlobalNotification/GlobalNotification.js +2 -1
- package/es/version2/lookup/AlertLookup/AlertLookup.js +42 -52
- package/lib/ActionButton/ActionButton.js +5 -2
- package/lib/Drawer/Drawer.js +23 -9
- package/lib/Drawer/Drawer.module.css +1 -1
- package/lib/Drawer/props/defaultProps.js +2 -1
- package/lib/Drawer/props/propTypes.js +2 -1
- package/lib/alert/AlertLookup/AlertLookup.js +32 -82
- package/lib/dropdown/ToggleDropDown/ToggleDropDown.js +15 -13
- package/lib/list/Icons/DeleteIcon.js +2 -1
- package/lib/list/Icons/SmartIcon.js +0 -1
- package/lib/lookup/Lookup/Lookup.js +24 -11
- package/lib/lookup/Lookup/props/defaultProps.js +2 -1
- package/lib/lookup/Lookup/props/propTypes.js +2 -1
- package/lib/lookup/header/Search/Search.js +5 -0
- package/lib/version2/GlobalNotification/GlobalNotification.js +2 -1
- package/lib/version2/lookup/AlertLookup/AlertLookup.js +67 -82
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
In this Library, we Provide Some Basic Components to Build Your Application
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+
# 1.0.0-beta.240
|
|
7
|
+
|
|
8
|
+
- `Accesssility`- Screen Reader support for some components.
|
|
9
|
+
|
|
10
|
+
- **CustomResponsive** - performance issue fix.
|
|
11
|
+
|
|
5
12
|
# 1.0.0-beta.239
|
|
6
13
|
|
|
7
14
|
- Attachment => Text color added.
|
package/css_error.log
ADDED
|
File without changes
|
|
@@ -98,7 +98,8 @@ export class ActionButton extends React.Component {
|
|
|
98
98
|
onMouseEnter: onClick ? onHover && this.handleTogglePopup : undefined,
|
|
99
99
|
onMouseLeave: onClick ? onHover && this.handleTogglePopup : undefined,
|
|
100
100
|
className: `${style[arrowBoxSize + '_arrowBox']} ${style[palette + 'Arw']} ${style.arrowWrapper} ${isPopupOpen ? style.arrowActive : ''}`,
|
|
101
|
-
dataId: arrowBoxDataId
|
|
101
|
+
dataId: arrowBoxDataId,
|
|
102
|
+
tabIndex: "0"
|
|
102
103
|
}, /*#__PURE__*/React.createElement(Container, {
|
|
103
104
|
align: "both"
|
|
104
105
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -116,7 +117,9 @@ export class ActionButton extends React.Component {
|
|
|
116
117
|
},
|
|
117
118
|
isBoxPaddingNeed: isBoxPaddingNeed,
|
|
118
119
|
getRef: getContainerRef,
|
|
119
|
-
popupGroup: popupGroup
|
|
120
|
+
popupGroup: popupGroup,
|
|
121
|
+
needFocusScope: true,
|
|
122
|
+
onClose: this.handleTogglePopup
|
|
120
123
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
121
124
|
flexible: true,
|
|
122
125
|
shrink: true,
|
package/es/Drawer/Drawer.js
CHANGED
|
@@ -12,6 +12,7 @@ import IconButton from '../IconButton/IconButton';
|
|
|
12
12
|
import Icon from '@zohodesk/icons/lib/Icon';
|
|
13
13
|
import { getZIndex } from '@zohodesk/components/lib/Provider/ZindexProvider';
|
|
14
14
|
import style from './Drawer.module.css';
|
|
15
|
+
import FocusScope from "@zohodesk/a11y/es/FocusScope/FocusScope";
|
|
15
16
|
export class Header extends React.Component {
|
|
16
17
|
render() {
|
|
17
18
|
let {
|
|
@@ -134,6 +135,7 @@ export default class Drawer extends React.Component {
|
|
|
134
135
|
this.drawers = this.drawers.bind(this);
|
|
135
136
|
this.responsiveFunc = this.responsiveFunc.bind(this);
|
|
136
137
|
this.getNextIndex = getZIndex(this);
|
|
138
|
+
this.createRef = /*#__PURE__*/React.createRef();
|
|
137
139
|
}
|
|
138
140
|
drawers(uptoTablet, styleByResolutions) {
|
|
139
141
|
let {
|
|
@@ -142,7 +144,9 @@ export default class Drawer extends React.Component {
|
|
|
142
144
|
paddingSize,
|
|
143
145
|
subDrawerActive,
|
|
144
146
|
subDrawerChildren,
|
|
145
|
-
onBodyClick
|
|
147
|
+
onBodyClick,
|
|
148
|
+
onClose,
|
|
149
|
+
needFocusScope
|
|
146
150
|
} = this.props;
|
|
147
151
|
let childrenWithProps = React.Children.map(children, child => {
|
|
148
152
|
if (child.type === Header || child.type === Footer || child.type === Content) {
|
|
@@ -155,6 +159,17 @@ export default class Drawer extends React.Component {
|
|
|
155
159
|
}
|
|
156
160
|
return child;
|
|
157
161
|
});
|
|
162
|
+
let content = /*#__PURE__*/React.createElement(Box, {
|
|
163
|
+
className: `${style.container} ${style.columns} ${style.drawerModal} ${uptoTablet ? style.mbleSize : style[size]}`,
|
|
164
|
+
"data-a11y-container-focus": false,
|
|
165
|
+
tabindex: -1,
|
|
166
|
+
eleRef: this.createRef
|
|
167
|
+
}, /*#__PURE__*/React.createElement(Card, {
|
|
168
|
+
onClick: e => {
|
|
169
|
+
e && e.stopPropagation && e.stopPropagation();
|
|
170
|
+
onBodyClick(e);
|
|
171
|
+
}
|
|
172
|
+
}, childrenWithProps));
|
|
158
173
|
return /*#__PURE__*/React.createElement(React.Fragment, null, subDrawerChildren ? /*#__PURE__*/React.createElement(Box, {
|
|
159
174
|
className: style.columns
|
|
160
175
|
}, /*#__PURE__*/React.createElement(VelocityAnimationGroup, {
|
|
@@ -167,14 +182,13 @@ export default class Drawer extends React.Component {
|
|
|
167
182
|
}
|
|
168
183
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
169
184
|
flexible: true
|
|
170
|
-
}, subDrawerChildren))))) : null, /*#__PURE__*/React.createElement(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}, childrenWithProps)));
|
|
185
|
+
}, subDrawerChildren))))) : null, needFocusScope ? /*#__PURE__*/React.createElement(FocusScope, {
|
|
186
|
+
elementRef: this.createRef,
|
|
187
|
+
autoFocus: true,
|
|
188
|
+
focusTabLoop: true,
|
|
189
|
+
restoreFocus: true,
|
|
190
|
+
focusClose: onClose
|
|
191
|
+
}, content) : content);
|
|
178
192
|
}
|
|
179
193
|
responsiveFunc(_ref) {
|
|
180
194
|
let {
|
|
@@ -45,5 +45,6 @@ export const Drawer_propTypes = {
|
|
|
45
45
|
subDrawerActive: PropTypes.bool,
|
|
46
46
|
subDrawerChildren: PropTypes.func,
|
|
47
47
|
subDrawerClass: PropTypes.string,
|
|
48
|
-
subDrawerSize: PropTypes.oneOf(['xsmall', 'small', 'medium'])
|
|
48
|
+
subDrawerSize: PropTypes.oneOf(['xsmall', 'small', 'medium']),
|
|
49
|
+
needFocusScope: PropTypes.bool
|
|
49
50
|
};
|
|
@@ -14,56 +14,6 @@ import FormAction from '../../FormAction/FormAction';
|
|
|
14
14
|
/**** CSS ****/
|
|
15
15
|
import style from './AlertLookup.module.css';
|
|
16
16
|
export default class AlertLookup extends Component {
|
|
17
|
-
constructor(props) {
|
|
18
|
-
super(props);
|
|
19
|
-
this.documentKeydownHandler = this.documentKeydownHandler.bind(this);
|
|
20
|
-
this.getButtonRef = this.getButtonRef.bind(this);
|
|
21
|
-
}
|
|
22
|
-
componentDidMount() {
|
|
23
|
-
let {
|
|
24
|
-
isActive
|
|
25
|
-
} = this.props;
|
|
26
|
-
if (isActive) {
|
|
27
|
-
document.addEventListener('keydown', this.documentKeydownHandler);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
componentDidUpdate(prevProps) {
|
|
31
|
-
let {
|
|
32
|
-
isActive
|
|
33
|
-
} = this.props;
|
|
34
|
-
if (prevProps.isActive !== isActive) {
|
|
35
|
-
isActive ? document.addEventListener('keydown', this.documentKeydownHandler) : document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
componentWillUnmount() {
|
|
39
|
-
document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
40
|
-
}
|
|
41
|
-
documentKeydownHandler() {
|
|
42
|
-
let e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
43
|
-
let {
|
|
44
|
-
onSubmitClick,
|
|
45
|
-
onCancelClick,
|
|
46
|
-
isActive,
|
|
47
|
-
onEsc,
|
|
48
|
-
onClose
|
|
49
|
-
} = this.props;
|
|
50
|
-
if (e.keyCode === 27 && isActive) {
|
|
51
|
-
e && e.preventDefault && e.preventDefault();
|
|
52
|
-
onEsc == 'close' ? onClose && onClose(e) : onCancelClick && onCancelClick(e);
|
|
53
|
-
} else if (e.keyCode === 13 && isActive) {
|
|
54
|
-
e && e.preventDefault && e.preventDefault();
|
|
55
|
-
onSubmitClick && onSubmitClick(e);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
getButtonRef(el) {
|
|
59
|
-
this.okButton = el;
|
|
60
|
-
let {
|
|
61
|
-
isDefaultFocus
|
|
62
|
-
} = this.props;
|
|
63
|
-
if (isDefaultFocus) {
|
|
64
|
-
el && el.focus();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
17
|
render() {
|
|
68
18
|
let {
|
|
69
19
|
isActive,
|
|
@@ -91,7 +41,8 @@ export default class AlertLookup extends Component {
|
|
|
91
41
|
iconClass,
|
|
92
42
|
iconSize,
|
|
93
43
|
customProps,
|
|
94
|
-
isHtmlContent
|
|
44
|
+
isHtmlContent,
|
|
45
|
+
onEsc
|
|
95
46
|
} = this.props;
|
|
96
47
|
const {
|
|
97
48
|
LookupProps = {},
|
|
@@ -100,6 +51,8 @@ export default class AlertLookup extends Component {
|
|
|
100
51
|
SecondaryButtonProps = {}
|
|
101
52
|
} = customProps;
|
|
102
53
|
return /*#__PURE__*/React.createElement(Lookup, _extends({
|
|
54
|
+
needFocusScope: true,
|
|
55
|
+
onClose: onEsc == 'close' ? onClose : onCancelClick,
|
|
103
56
|
isActive: isActive,
|
|
104
57
|
size: size,
|
|
105
58
|
dataId: dataId,
|
|
@@ -134,8 +87,7 @@ export default class AlertLookup extends Component {
|
|
|
134
87
|
text: submitText,
|
|
135
88
|
dataId: dataId === 'alertPopup' ? 'alertConfirmButton' : `${dataId}_confirmButton`,
|
|
136
89
|
onClick: onSubmitClick,
|
|
137
|
-
palette: palette === 'primary' ? 'primaryFilled' : 'dangerFilled'
|
|
138
|
-
getRef: this.getButtonRef
|
|
90
|
+
palette: palette === 'primary' ? 'primaryFilled' : 'dangerFilled'
|
|
139
91
|
}, PrimaryButtonProps)), cancelText && /*#__PURE__*/React.createElement(Button, _extends({
|
|
140
92
|
dataId: dataId === 'alertPopup' ? 'alertCancelButton' : `${dataId}_cancelButton`,
|
|
141
93
|
text: cancelText,
|
|
@@ -328,20 +328,22 @@ export class ToggleDropDown extends Component {
|
|
|
328
328
|
}
|
|
329
329
|
break;
|
|
330
330
|
case 13:
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
331
|
+
{
|
|
332
|
+
const selectedId = optionsArr[selectedIndex][idName] || '';
|
|
333
|
+
onClick && onClick(selectedId, optionsArr[selectedIndex]);
|
|
334
|
+
if (!preventPopupClose) {
|
|
335
|
+
togglePopup(e, boxPosition);
|
|
336
|
+
} else if (isSearch) {
|
|
337
|
+
this.searchInput.focus({
|
|
338
|
+
preventScroll: true
|
|
339
|
+
});
|
|
340
|
+
} else {
|
|
341
|
+
this.hiddenInput.focus({
|
|
342
|
+
preventScroll: true
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
break;
|
|
343
346
|
}
|
|
344
|
-
break;
|
|
345
347
|
}
|
|
346
348
|
} else {
|
|
347
349
|
if (keyCode === 13 || keyCode === 40) {
|
|
@@ -16,7 +16,8 @@ export default class DeleteComponent extends React.Component {
|
|
|
16
16
|
onClick: onClick,
|
|
17
17
|
className: `${style.iconStyle} ${style.redHover} ${className ? className : ''}`,
|
|
18
18
|
"data-id": dataId,
|
|
19
|
-
"data-title": dataTitle
|
|
19
|
+
"data-title": dataTitle,
|
|
20
|
+
tabIndex: 0
|
|
20
21
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
21
22
|
name: "ZD-GN-delete",
|
|
22
23
|
iconClass: iconClass ? iconClass : '',
|
|
@@ -2,7 +2,6 @@ import React, { Component } from 'react';
|
|
|
2
2
|
import { SmartIcon_propTypes } from './props/propTypes';
|
|
3
3
|
import style from './Icons.module.css';
|
|
4
4
|
import Icon from '@zohodesk/icons/lib/Icon';
|
|
5
|
-
import btnStyle from '@zohodesk/components/lib/semantic/Button/semanticButton.module.css';
|
|
6
5
|
export default class SmartIcon extends Component {
|
|
7
6
|
render() {
|
|
8
7
|
let {
|
|
@@ -9,13 +9,14 @@ import { Container } from '@zohodesk/components/lib/Layout';
|
|
|
9
9
|
|
|
10
10
|
/*** CSS ***/
|
|
11
11
|
import style from './Lookup.module.css';
|
|
12
|
-
|
|
12
|
+
import FocusScope from '@zohodesk/a11y/es/FocusScope/FocusScope';
|
|
13
13
|
/*eslint-disable react/forbid-component-props */
|
|
14
14
|
|
|
15
15
|
export default class Lookup extends Component {
|
|
16
16
|
constructor(props) {
|
|
17
17
|
super(props);
|
|
18
18
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
19
|
+
this.createRef = /*#__PURE__*/React.createRef();
|
|
19
20
|
}
|
|
20
21
|
componentDidUpdate(prevProps) {
|
|
21
22
|
const {
|
|
@@ -45,7 +46,9 @@ export default class Lookup extends Component {
|
|
|
45
46
|
customClass,
|
|
46
47
|
htmlId,
|
|
47
48
|
a11y,
|
|
48
|
-
childAnimationName
|
|
49
|
+
childAnimationName,
|
|
50
|
+
onClose,
|
|
51
|
+
needFocusScope
|
|
49
52
|
} = this.props;
|
|
50
53
|
const {
|
|
51
54
|
role = 'dialog',
|
|
@@ -53,6 +56,18 @@ export default class Lookup extends Component {
|
|
|
53
56
|
ariaDescribedby,
|
|
54
57
|
ariaModal = isActive ? true : undefined
|
|
55
58
|
} = a11y;
|
|
59
|
+
const content = /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
ref: this.createRef,
|
|
61
|
+
tabIndex: "-1",
|
|
62
|
+
"data-a11y-container-focus": false,
|
|
63
|
+
role: role,
|
|
64
|
+
"aria-labelledby": ariaLabelledby,
|
|
65
|
+
"aria-describedby": ariaDescribedby,
|
|
66
|
+
"aria-modal": ariaModal,
|
|
67
|
+
id: htmlId,
|
|
68
|
+
className: `${style.box} ${style[`${size}Size`]}`,
|
|
69
|
+
"data-id": dataId
|
|
70
|
+
}, children);
|
|
56
71
|
return /*#__PURE__*/React.createElement(FreezeLayer, {
|
|
57
72
|
align: "horizontal",
|
|
58
73
|
animationName: "fade",
|
|
@@ -66,16 +81,13 @@ export default class Lookup extends Component {
|
|
|
66
81
|
alignBox: "row",
|
|
67
82
|
className: style.container,
|
|
68
83
|
dataId: "fldValue"
|
|
69
|
-
}, /*#__PURE__*/React.createElement(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
className: `${style.box} ${style[`${size}Size`]}`,
|
|
77
|
-
"data-id": dataId
|
|
78
|
-
}, children)));
|
|
84
|
+
}, needFocusScope ? /*#__PURE__*/React.createElement(FocusScope, {
|
|
85
|
+
focusTabLoop: true,
|
|
86
|
+
elementRef: this.createRef,
|
|
87
|
+
autoFocus: true,
|
|
88
|
+
restoreFocus: true,
|
|
89
|
+
focusClose: onClose
|
|
90
|
+
}, content) : content));
|
|
79
91
|
}
|
|
80
92
|
}
|
|
81
93
|
Lookup.propTypes = propTypes;
|
|
@@ -188,6 +188,11 @@ class SearchUI extends Component {
|
|
|
188
188
|
customClass: {
|
|
189
189
|
customTextBox: `${isBoxed ? style.inputBox : ''}`
|
|
190
190
|
},
|
|
191
|
+
customProps: {
|
|
192
|
+
TextBoxProps: {
|
|
193
|
+
'data-a11y-autofocus': true
|
|
194
|
+
}
|
|
195
|
+
},
|
|
191
196
|
placeHolder: placeHolder,
|
|
192
197
|
value: searchStr,
|
|
193
198
|
onChange: this.handleChange,
|
|
@@ -90,7 +90,8 @@ export function GlobalNotificationUI(props) {
|
|
|
90
90
|
} = customProps;
|
|
91
91
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
92
92
|
className: `${style.message} ${type ? style[type] : ''}`,
|
|
93
|
-
"data-id": `show_${type}_message
|
|
93
|
+
"data-id": `show_${type}_message`,
|
|
94
|
+
tabIndex: 0
|
|
94
95
|
}, ExtraProps), /*#__PURE__*/React.createElement(Container, {
|
|
95
96
|
className: `${style.container}`,
|
|
96
97
|
alignBox: "row",
|
|
@@ -39,57 +39,41 @@ export default class AlertLookup extends Component {
|
|
|
39
39
|
constructor(props) {
|
|
40
40
|
super(props);
|
|
41
41
|
this.getAriaId = getUniqueId(this);
|
|
42
|
-
this.documentKeydownHandler = this.documentKeydownHandler.bind(this);
|
|
43
|
-
this.getButtonRef = this.getButtonRef.bind(this);
|
|
44
|
-
}
|
|
45
|
-
componentDidMount() {
|
|
46
|
-
let {
|
|
47
|
-
isActive
|
|
48
|
-
} = this.props;
|
|
49
|
-
if (isActive) {
|
|
50
|
-
document.addEventListener('keydown', this.documentKeydownHandler);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
componentDidUpdate(prevProps) {
|
|
54
|
-
let {
|
|
55
|
-
isActive
|
|
56
|
-
} = this.props;
|
|
57
|
-
if (prevProps.isActive !== isActive) {
|
|
58
|
-
isActive ? document.addEventListener('keydown', this.documentKeydownHandler) : document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
componentWillUnmount() {
|
|
62
|
-
document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
63
|
-
}
|
|
64
|
-
documentKeydownHandler() {
|
|
65
|
-
let e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
66
|
-
let {
|
|
67
|
-
onSubmitClick,
|
|
68
|
-
onCancelClick,
|
|
69
|
-
isActive,
|
|
70
|
-
onEsc,
|
|
71
|
-
onClose
|
|
72
|
-
} = this.props;
|
|
73
|
-
if (e.keyCode === 27 && isActive) {
|
|
74
|
-
e && e.preventDefault && e.preventDefault();
|
|
75
|
-
onEsc == 'close' ? onClose && onClose(e) : onCancelClick && onCancelClick(e);
|
|
76
|
-
} else if (e.keyCode === 13 && isActive) {
|
|
77
|
-
e && e.preventDefault && e.preventDefault();
|
|
78
|
-
onSubmitClick && onSubmitClick(e);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
getButtonRef(el) {
|
|
82
|
-
this.okButton = el;
|
|
83
|
-
let {
|
|
84
|
-
isDefaultFocus
|
|
85
|
-
} = this.props;
|
|
86
|
-
if (isDefaultFocus) {
|
|
87
|
-
// el && el.focus();
|
|
88
|
-
setTimeout(() => {
|
|
89
|
-
this.okButton && this.okButton.focus && this.okButton.focus();
|
|
90
|
-
}, 100);
|
|
91
|
-
}
|
|
42
|
+
// this.documentKeydownHandler = this.documentKeydownHandler.bind(this);
|
|
92
43
|
}
|
|
44
|
+
|
|
45
|
+
// componentDidMount() {
|
|
46
|
+
// let { isActive } = this.props;
|
|
47
|
+
// if (isActive) {
|
|
48
|
+
// document.addEventListener('keydown', this.documentKeydownHandler)
|
|
49
|
+
// }
|
|
50
|
+
// }
|
|
51
|
+
|
|
52
|
+
// componentDidUpdate(prevProps) {
|
|
53
|
+
// let { isActive } = this.props;
|
|
54
|
+
// if (prevProps.isActive !== isActive) {
|
|
55
|
+
// isActive
|
|
56
|
+
// ? document.addEventListener('keydown', this.documentKeydownHandler)
|
|
57
|
+
// : document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
58
|
+
// }
|
|
59
|
+
// }
|
|
60
|
+
// componentWillUnmount() {
|
|
61
|
+
// document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
62
|
+
// }
|
|
63
|
+
|
|
64
|
+
// documentKeydownHandler(e = {}) {
|
|
65
|
+
// let { onSubmitClick, onCancelClick, isActive, onEsc, onClose } = this.props;
|
|
66
|
+
// if (e.keyCode === 27 && isActive) {
|
|
67
|
+
// e && e.preventDefault && e.preventDefault();
|
|
68
|
+
// onEsc == 'close'
|
|
69
|
+
// ? onClose && onClose(e)
|
|
70
|
+
// : onCancelClick && onCancelClick(e);
|
|
71
|
+
// } else if (e.keyCode === 13 && isActive) {
|
|
72
|
+
// e && e.preventDefault && e.preventDefault();
|
|
73
|
+
// onSubmitClick && onSubmitClick(e);
|
|
74
|
+
// }
|
|
75
|
+
// }
|
|
76
|
+
|
|
93
77
|
render() {
|
|
94
78
|
let {
|
|
95
79
|
isActive,
|
|
@@ -116,7 +100,9 @@ export default class AlertLookup extends Component {
|
|
|
116
100
|
align,
|
|
117
101
|
childAnimationName,
|
|
118
102
|
isHtmlContent,
|
|
119
|
-
scroll
|
|
103
|
+
scroll,
|
|
104
|
+
isDefaultFocus,
|
|
105
|
+
onEsc
|
|
120
106
|
} = this.props;
|
|
121
107
|
const {
|
|
122
108
|
LookupProps = {},
|
|
@@ -139,6 +125,8 @@ export default class AlertLookup extends Component {
|
|
|
139
125
|
ariaDescribedby: a11y && a11y.ariaDescribedby ? a11y.ariaDescribedby : ariaMessageId + ' ' + ariaConfirmMsgId
|
|
140
126
|
};
|
|
141
127
|
return /*#__PURE__*/React.createElement(Lookup, _extends({
|
|
128
|
+
onClose: onEsc == 'close' ? onClose : onCancelClick,
|
|
129
|
+
needFocusScope: true,
|
|
142
130
|
isActive: isActive,
|
|
143
131
|
size: size,
|
|
144
132
|
dataId: dataId,
|
|
@@ -187,7 +175,9 @@ export default class AlertLookup extends Component {
|
|
|
187
175
|
dataId: dataId === 'alertPopup' ? 'alertConfirmButton' : `${dataId}_confirmButton`,
|
|
188
176
|
onClick: onSubmitClick,
|
|
189
177
|
palette: buttonPalette,
|
|
190
|
-
|
|
178
|
+
customProps: {
|
|
179
|
+
'data-a11y-autofocus': isDefaultFocus
|
|
180
|
+
}
|
|
191
181
|
}, PrimaryButtonProps)), cancelText && /*#__PURE__*/React.createElement(Button, _extends({
|
|
192
182
|
dataId: dataId === 'alertPopup' ? 'alertCancelButton' : `${dataId}_cancelButton`,
|
|
193
183
|
text: cancelText,
|
|
@@ -123,7 +123,8 @@ var ActionButton = /*#__PURE__*/function (_React$Component) {
|
|
|
123
123
|
onMouseEnter: onClick ? onHover && this.handleTogglePopup : undefined,
|
|
124
124
|
onMouseLeave: onClick ? onHover && this.handleTogglePopup : undefined,
|
|
125
125
|
className: "".concat(_ActionButtonModule["default"][arrowBoxSize + '_arrowBox'], " ").concat(_ActionButtonModule["default"][palette + 'Arw'], " ").concat(_ActionButtonModule["default"].arrowWrapper, " ").concat(isPopupOpen ? _ActionButtonModule["default"].arrowActive : ''),
|
|
126
|
-
dataId: arrowBoxDataId
|
|
126
|
+
dataId: arrowBoxDataId,
|
|
127
|
+
tabIndex: "0"
|
|
127
128
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
128
129
|
align: "both"
|
|
129
130
|
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
@@ -141,7 +142,9 @@ var ActionButton = /*#__PURE__*/function (_React$Component) {
|
|
|
141
142
|
},
|
|
142
143
|
isBoxPaddingNeed: isBoxPaddingNeed,
|
|
143
144
|
getRef: getContainerRef,
|
|
144
|
-
popupGroup: popupGroup
|
|
145
|
+
popupGroup: popupGroup,
|
|
146
|
+
needFocusScope: true,
|
|
147
|
+
onClose: this.handleTogglePopup
|
|
145
148
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
146
149
|
flexible: true,
|
|
147
150
|
shrink: true,
|
package/lib/Drawer/Drawer.js
CHANGED
|
@@ -19,6 +19,7 @@ var _IconButton = _interopRequireDefault(require("../IconButton/IconButton"));
|
|
|
19
19
|
var _Icon = _interopRequireDefault(require("@zohodesk/icons/lib/Icon"));
|
|
20
20
|
var _ZindexProvider = require("@zohodesk/components/lib/Provider/ZindexProvider");
|
|
21
21
|
var _DrawerModule = _interopRequireDefault(require("./Drawer.module.css"));
|
|
22
|
+
var _FocusScope = _interopRequireDefault(require("@zohodesk/a11y/es/FocusScope/FocusScope"));
|
|
22
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
24
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
24
25
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -186,6 +187,7 @@ var Drawer = /*#__PURE__*/function (_React$Component4) {
|
|
|
186
187
|
_this.drawers = _this.drawers.bind(_assertThisInitialized(_this));
|
|
187
188
|
_this.responsiveFunc = _this.responsiveFunc.bind(_assertThisInitialized(_this));
|
|
188
189
|
_this.getNextIndex = (0, _ZindexProvider.getZIndex)(_assertThisInitialized(_this));
|
|
190
|
+
_this.createRef = /*#__PURE__*/_react["default"].createRef();
|
|
189
191
|
return _this;
|
|
190
192
|
}
|
|
191
193
|
_createClass(Drawer, [{
|
|
@@ -197,7 +199,9 @@ var Drawer = /*#__PURE__*/function (_React$Component4) {
|
|
|
197
199
|
paddingSize = _this$props4.paddingSize,
|
|
198
200
|
subDrawerActive = _this$props4.subDrawerActive,
|
|
199
201
|
subDrawerChildren = _this$props4.subDrawerChildren,
|
|
200
|
-
onBodyClick = _this$props4.onBodyClick
|
|
202
|
+
onBodyClick = _this$props4.onBodyClick,
|
|
203
|
+
onClose = _this$props4.onClose,
|
|
204
|
+
needFocusScope = _this$props4.needFocusScope;
|
|
201
205
|
var childrenWithProps = _react["default"].Children.map(children, function (child) {
|
|
202
206
|
if (child.type === Header || child.type === Footer || child.type === Content) {
|
|
203
207
|
var _ref = child.props || {},
|
|
@@ -208,6 +212,17 @@ var Drawer = /*#__PURE__*/function (_React$Component4) {
|
|
|
208
212
|
}
|
|
209
213
|
return child;
|
|
210
214
|
});
|
|
215
|
+
var content = /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
216
|
+
className: "".concat(_DrawerModule["default"].container, " ").concat(_DrawerModule["default"].columns, " ").concat(_DrawerModule["default"].drawerModal, " ").concat(uptoTablet ? _DrawerModule["default"].mbleSize : _DrawerModule["default"][size]),
|
|
217
|
+
"data-a11y-container-focus": false,
|
|
218
|
+
tabindex: -1,
|
|
219
|
+
eleRef: this.createRef
|
|
220
|
+
}, /*#__PURE__*/_react["default"].createElement(_Card.Card, {
|
|
221
|
+
onClick: function onClick(e) {
|
|
222
|
+
e && e.stopPropagation && e.stopPropagation();
|
|
223
|
+
onBodyClick(e);
|
|
224
|
+
}
|
|
225
|
+
}, childrenWithProps));
|
|
211
226
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, subDrawerChildren ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
212
227
|
className: _DrawerModule["default"].columns
|
|
213
228
|
}, /*#__PURE__*/_react["default"].createElement(_VelocityAnimationGroup["default"], {
|
|
@@ -220,14 +235,13 @@ var Drawer = /*#__PURE__*/function (_React$Component4) {
|
|
|
220
235
|
}
|
|
221
236
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
222
237
|
flexible: true
|
|
223
|
-
}, subDrawerChildren))))) : null, /*#__PURE__*/_react["default"].createElement(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}, childrenWithProps)));
|
|
238
|
+
}, subDrawerChildren))))) : null, needFocusScope ? /*#__PURE__*/_react["default"].createElement(_FocusScope["default"], {
|
|
239
|
+
elementRef: this.createRef,
|
|
240
|
+
autoFocus: true,
|
|
241
|
+
focusTabLoop: true,
|
|
242
|
+
restoreFocus: true,
|
|
243
|
+
focusClose: onClose
|
|
244
|
+
}, content) : content);
|
|
231
245
|
}
|
|
232
246
|
}, {
|
|
233
247
|
key: "responsiveFunc",
|
|
@@ -24,6 +24,7 @@ var Drawer_defaultProps = {
|
|
|
24
24
|
subDrawerClass: '',
|
|
25
25
|
customClass: '',
|
|
26
26
|
needAutoZindex: true,
|
|
27
|
-
onBodyClick: function onBodyClick() {}
|
|
27
|
+
onBodyClick: function onBodyClick() {},
|
|
28
|
+
needFocusScope: false
|
|
28
29
|
};
|
|
29
30
|
exports.Drawer_defaultProps = Drawer_defaultProps;
|
|
@@ -55,6 +55,7 @@ var Drawer_propTypes = {
|
|
|
55
55
|
subDrawerActive: _propTypes["default"].bool,
|
|
56
56
|
subDrawerChildren: _propTypes["default"].func,
|
|
57
57
|
subDrawerClass: _propTypes["default"].string,
|
|
58
|
-
subDrawerSize: _propTypes["default"].oneOf(['xsmall', 'small', 'medium'])
|
|
58
|
+
subDrawerSize: _propTypes["default"].oneOf(['xsmall', 'small', 'medium']),
|
|
59
|
+
needFocusScope: _propTypes["default"].bool
|
|
59
60
|
};
|
|
60
61
|
exports.Drawer_propTypes = Drawer_propTypes;
|
|
@@ -31,92 +31,41 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
31
31
|
var AlertLookup = /*#__PURE__*/function (_Component) {
|
|
32
32
|
_inherits(AlertLookup, _Component);
|
|
33
33
|
var _super = _createSuper(AlertLookup);
|
|
34
|
-
function AlertLookup(
|
|
35
|
-
var _this;
|
|
34
|
+
function AlertLookup() {
|
|
36
35
|
_classCallCheck(this, AlertLookup);
|
|
37
|
-
|
|
38
|
-
_this.documentKeydownHandler = _this.documentKeydownHandler.bind(_assertThisInitialized(_this));
|
|
39
|
-
_this.getButtonRef = _this.getButtonRef.bind(_assertThisInitialized(_this));
|
|
40
|
-
return _this;
|
|
36
|
+
return _super.apply(this, arguments);
|
|
41
37
|
}
|
|
42
38
|
_createClass(AlertLookup, [{
|
|
43
|
-
key: "
|
|
44
|
-
value: function
|
|
45
|
-
var isActive = this.props.isActive;
|
|
46
|
-
if (isActive) {
|
|
47
|
-
document.addEventListener('keydown', this.documentKeydownHandler);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}, {
|
|
51
|
-
key: "componentDidUpdate",
|
|
52
|
-
value: function componentDidUpdate(prevProps) {
|
|
53
|
-
var isActive = this.props.isActive;
|
|
54
|
-
if (prevProps.isActive !== isActive) {
|
|
55
|
-
isActive ? document.addEventListener('keydown', this.documentKeydownHandler) : document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "componentWillUnmount",
|
|
60
|
-
value: function componentWillUnmount() {
|
|
61
|
-
document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "documentKeydownHandler",
|
|
65
|
-
value: function documentKeydownHandler() {
|
|
66
|
-
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
39
|
+
key: "render",
|
|
40
|
+
value: function render() {
|
|
67
41
|
var _this$props = this.props,
|
|
42
|
+
isActive = _this$props.isActive,
|
|
43
|
+
palette = _this$props.palette,
|
|
44
|
+
size = _this$props.size,
|
|
45
|
+
type = _this$props.type,
|
|
46
|
+
title = _this$props.title,
|
|
47
|
+
message = _this$props.message,
|
|
48
|
+
confirmationMessage = _this$props.confirmationMessage,
|
|
49
|
+
submitText = _this$props.submitText,
|
|
50
|
+
cancelText = _this$props.cancelText,
|
|
68
51
|
onSubmitClick = _this$props.onSubmitClick,
|
|
69
52
|
onCancelClick = _this$props.onCancelClick,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
onClose = _this$props.onClose
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (isDefaultFocus) {
|
|
87
|
-
el && el.focus();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}, {
|
|
91
|
-
key: "render",
|
|
92
|
-
value: function render() {
|
|
93
|
-
var _this$props2 = this.props,
|
|
94
|
-
isActive = _this$props2.isActive,
|
|
95
|
-
palette = _this$props2.palette,
|
|
96
|
-
size = _this$props2.size,
|
|
97
|
-
type = _this$props2.type,
|
|
98
|
-
title = _this$props2.title,
|
|
99
|
-
message = _this$props2.message,
|
|
100
|
-
confirmationMessage = _this$props2.confirmationMessage,
|
|
101
|
-
submitText = _this$props2.submitText,
|
|
102
|
-
cancelText = _this$props2.cancelText,
|
|
103
|
-
onSubmitClick = _this$props2.onSubmitClick,
|
|
104
|
-
onCancelClick = _this$props2.onCancelClick,
|
|
105
|
-
children = _this$props2.children,
|
|
106
|
-
forwardRef = _this$props2.forwardRef,
|
|
107
|
-
onClose = _this$props2.onClose,
|
|
108
|
-
headerChildren = _this$props2.headerChildren,
|
|
109
|
-
wrapHeader = _this$props2.wrapHeader,
|
|
110
|
-
sectionClassName = _this$props2.sectionClassName,
|
|
111
|
-
dataId = _this$props2.dataId,
|
|
112
|
-
onLookupClick = _this$props2.onLookupClick,
|
|
113
|
-
customClass = _this$props2.customClass,
|
|
114
|
-
needIcon = _this$props2.needIcon,
|
|
115
|
-
iconName = _this$props2.iconName,
|
|
116
|
-
iconClass = _this$props2.iconClass,
|
|
117
|
-
iconSize = _this$props2.iconSize,
|
|
118
|
-
customProps = _this$props2.customProps,
|
|
119
|
-
isHtmlContent = _this$props2.isHtmlContent;
|
|
53
|
+
children = _this$props.children,
|
|
54
|
+
forwardRef = _this$props.forwardRef,
|
|
55
|
+
onClose = _this$props.onClose,
|
|
56
|
+
headerChildren = _this$props.headerChildren,
|
|
57
|
+
wrapHeader = _this$props.wrapHeader,
|
|
58
|
+
sectionClassName = _this$props.sectionClassName,
|
|
59
|
+
dataId = _this$props.dataId,
|
|
60
|
+
onLookupClick = _this$props.onLookupClick,
|
|
61
|
+
customClass = _this$props.customClass,
|
|
62
|
+
needIcon = _this$props.needIcon,
|
|
63
|
+
iconName = _this$props.iconName,
|
|
64
|
+
iconClass = _this$props.iconClass,
|
|
65
|
+
iconSize = _this$props.iconSize,
|
|
66
|
+
customProps = _this$props.customProps,
|
|
67
|
+
isHtmlContent = _this$props.isHtmlContent,
|
|
68
|
+
onEsc = _this$props.onEsc;
|
|
120
69
|
var _customProps$LookupPr = customProps.LookupProps,
|
|
121
70
|
LookupProps = _customProps$LookupPr === void 0 ? {} : _customProps$LookupPr,
|
|
122
71
|
_customProps$AlertHea = customProps.AlertHeaderProps,
|
|
@@ -126,6 +75,8 @@ var AlertLookup = /*#__PURE__*/function (_Component) {
|
|
|
126
75
|
_customProps$Secondar = customProps.SecondaryButtonProps,
|
|
127
76
|
SecondaryButtonProps = _customProps$Secondar === void 0 ? {} : _customProps$Secondar;
|
|
128
77
|
return /*#__PURE__*/_react["default"].createElement(_Lookup["default"], _extends({
|
|
78
|
+
needFocusScope: true,
|
|
79
|
+
onClose: onEsc == 'close' ? onClose : onCancelClick,
|
|
129
80
|
isActive: isActive,
|
|
130
81
|
size: size,
|
|
131
82
|
dataId: dataId,
|
|
@@ -160,8 +111,7 @@ var AlertLookup = /*#__PURE__*/function (_Component) {
|
|
|
160
111
|
text: submitText,
|
|
161
112
|
dataId: dataId === 'alertPopup' ? 'alertConfirmButton' : "".concat(dataId, "_confirmButton"),
|
|
162
113
|
onClick: onSubmitClick,
|
|
163
|
-
palette: palette === 'primary' ? 'primaryFilled' : 'dangerFilled'
|
|
164
|
-
getRef: this.getButtonRef
|
|
114
|
+
palette: palette === 'primary' ? 'primaryFilled' : 'dangerFilled'
|
|
165
115
|
}, PrimaryButtonProps)), cancelText && /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
|
|
166
116
|
dataId: dataId === 'alertPopup' ? 'alertCancelButton' : "".concat(dataId, "_cancelButton"),
|
|
167
117
|
text: cancelText,
|
|
@@ -364,20 +364,22 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
364
364
|
}
|
|
365
365
|
break;
|
|
366
366
|
case 13:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
367
|
+
{
|
|
368
|
+
var selectedId = optionsArr[selectedIndex][idName] || '';
|
|
369
|
+
onClick && onClick(selectedId, optionsArr[selectedIndex]);
|
|
370
|
+
if (!preventPopupClose) {
|
|
371
|
+
togglePopup(e, boxPosition);
|
|
372
|
+
} else if (isSearch) {
|
|
373
|
+
this.searchInput.focus({
|
|
374
|
+
preventScroll: true
|
|
375
|
+
});
|
|
376
|
+
} else {
|
|
377
|
+
this.hiddenInput.focus({
|
|
378
|
+
preventScroll: true
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
break;
|
|
379
382
|
}
|
|
380
|
-
break;
|
|
381
383
|
}
|
|
382
384
|
} else {
|
|
383
385
|
if (keyCode === 13 || keyCode === 40) {
|
|
@@ -41,7 +41,8 @@ var DeleteComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
41
41
|
onClick: onClick,
|
|
42
42
|
className: "".concat(_IconsModule["default"].iconStyle, " ").concat(_IconsModule["default"].redHover, " ").concat(className ? className : ''),
|
|
43
43
|
"data-id": dataId,
|
|
44
|
-
"data-title": dataTitle
|
|
44
|
+
"data-title": dataTitle,
|
|
45
|
+
tabIndex: 0
|
|
45
46
|
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
46
47
|
name: "ZD-GN-delete",
|
|
47
48
|
iconClass: iconClass ? iconClass : '',
|
|
@@ -9,7 +9,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _propTypes = require("./props/propTypes");
|
|
10
10
|
var _IconsModule = _interopRequireDefault(require("./Icons.module.css"));
|
|
11
11
|
var _Icon = _interopRequireDefault(require("@zohodesk/icons/lib/Icon"));
|
|
12
|
-
var _semanticButtonModule = _interopRequireDefault(require("@zohodesk/components/lib/semantic/Button/semanticButton.module.css"));
|
|
13
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -11,6 +11,7 @@ var _propTypes = require("./props/propTypes");
|
|
|
11
11
|
var _FreezeLayer = _interopRequireDefault(require("../../FreezeLayer/FreezeLayer"));
|
|
12
12
|
var _Layout = require("@zohodesk/components/lib/Layout");
|
|
13
13
|
var _LookupModule = _interopRequireDefault(require("./Lookup.module.css"));
|
|
14
|
+
var _FocusScope = _interopRequireDefault(require("@zohodesk/a11y/es/FocusScope/FocusScope"));
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -32,6 +33,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
32
33
|
_classCallCheck(this, Lookup);
|
|
33
34
|
_this = _super.call(this, props);
|
|
34
35
|
_this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));
|
|
36
|
+
_this.createRef = /*#__PURE__*/_react["default"].createRef();
|
|
35
37
|
return _this;
|
|
36
38
|
}
|
|
37
39
|
_createClass(Lookup, [{
|
|
@@ -66,13 +68,27 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
66
68
|
customClass = _this$props.customClass,
|
|
67
69
|
htmlId = _this$props.htmlId,
|
|
68
70
|
a11y = _this$props.a11y,
|
|
69
|
-
childAnimationName = _this$props.childAnimationName
|
|
71
|
+
childAnimationName = _this$props.childAnimationName,
|
|
72
|
+
onClose = _this$props.onClose,
|
|
73
|
+
needFocusScope = _this$props.needFocusScope;
|
|
70
74
|
var _a11y$role = a11y.role,
|
|
71
75
|
role = _a11y$role === void 0 ? 'dialog' : _a11y$role,
|
|
72
76
|
ariaLabelledby = a11y.ariaLabelledby,
|
|
73
77
|
ariaDescribedby = a11y.ariaDescribedby,
|
|
74
78
|
_a11y$ariaModal = a11y.ariaModal,
|
|
75
79
|
ariaModal = _a11y$ariaModal === void 0 ? isActive ? true : undefined : _a11y$ariaModal;
|
|
80
|
+
var content = /*#__PURE__*/_react["default"].createElement("div", {
|
|
81
|
+
ref: this.createRef,
|
|
82
|
+
tabIndex: "-1",
|
|
83
|
+
"data-a11y-container-focus": false,
|
|
84
|
+
role: role,
|
|
85
|
+
"aria-labelledby": ariaLabelledby,
|
|
86
|
+
"aria-describedby": ariaDescribedby,
|
|
87
|
+
"aria-modal": ariaModal,
|
|
88
|
+
id: htmlId,
|
|
89
|
+
className: "".concat(_LookupModule["default"].box, " ").concat(_LookupModule["default"]["".concat(size, "Size")]),
|
|
90
|
+
"data-id": dataId
|
|
91
|
+
}, children);
|
|
76
92
|
return /*#__PURE__*/_react["default"].createElement(_FreezeLayer["default"], {
|
|
77
93
|
align: "horizontal",
|
|
78
94
|
animationName: "fade",
|
|
@@ -86,16 +102,13 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
86
102
|
alignBox: "row",
|
|
87
103
|
className: _LookupModule["default"].container,
|
|
88
104
|
dataId: "fldValue"
|
|
89
|
-
}, /*#__PURE__*/_react["default"].createElement("
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
className: "".concat(_LookupModule["default"].box, " ").concat(_LookupModule["default"]["".concat(size, "Size")]),
|
|
97
|
-
"data-id": dataId
|
|
98
|
-
}, children)));
|
|
105
|
+
}, needFocusScope ? /*#__PURE__*/_react["default"].createElement(_FocusScope["default"], {
|
|
106
|
+
focusTabLoop: true,
|
|
107
|
+
elementRef: this.createRef,
|
|
108
|
+
autoFocus: true,
|
|
109
|
+
restoreFocus: true,
|
|
110
|
+
focusClose: onClose
|
|
111
|
+
}, content) : content));
|
|
99
112
|
}
|
|
100
113
|
}]);
|
|
101
114
|
return Lookup;
|
|
@@ -20,6 +20,7 @@ var propTypes = {
|
|
|
20
20
|
ariaModal: _propTypes["default"].bool
|
|
21
21
|
}),
|
|
22
22
|
onKeyDown: _propTypes["default"].func,
|
|
23
|
-
childAnimationName: _propTypes["default"].oneOf(['expand', 'flyDown'])
|
|
23
|
+
childAnimationName: _propTypes["default"].oneOf(['expand', 'flyDown']),
|
|
24
|
+
needFocusScope: _propTypes["default"].bool
|
|
24
25
|
};
|
|
25
26
|
exports.propTypes = propTypes;
|
|
@@ -219,6 +219,11 @@ var SearchUI = /*#__PURE__*/function (_Component2) {
|
|
|
219
219
|
customClass: {
|
|
220
220
|
customTextBox: "".concat(isBoxed ? _LookupSearchModule["default"].inputBox : '')
|
|
221
221
|
},
|
|
222
|
+
customProps: {
|
|
223
|
+
TextBoxProps: {
|
|
224
|
+
'data-a11y-autofocus': true
|
|
225
|
+
}
|
|
226
|
+
},
|
|
222
227
|
placeHolder: placeHolder,
|
|
223
228
|
value: searchStr,
|
|
224
229
|
onChange: this.handleChange,
|
|
@@ -119,7 +119,8 @@ function GlobalNotificationUI(props) {
|
|
|
119
119
|
ExtraProps = _customProps$ExtraPro === void 0 ? {} : _customProps$ExtraPro;
|
|
120
120
|
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
121
121
|
className: "".concat(_GlobalNotificationModule["default"].message, " ").concat(type ? _GlobalNotificationModule["default"][type] : ''),
|
|
122
|
-
"data-id": "show_".concat(type, "_message")
|
|
122
|
+
"data-id": "show_".concat(type, "_message"),
|
|
123
|
+
tabIndex: 0
|
|
123
124
|
}, ExtraProps), /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
124
125
|
className: "".concat(_GlobalNotificationModule["default"].container),
|
|
125
126
|
alignBox: "row",
|
|
@@ -58,93 +58,74 @@ var AlertLookup = /*#__PURE__*/function (_Component) {
|
|
|
58
58
|
_classCallCheck(this, AlertLookup);
|
|
59
59
|
_this = _super.call(this, props);
|
|
60
60
|
_this.getAriaId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this));
|
|
61
|
-
|
|
62
|
-
_this.getButtonRef = _this.getButtonRef.bind(_assertThisInitialized(_this));
|
|
61
|
+
// this.documentKeydownHandler = this.documentKeydownHandler.bind(this);
|
|
63
62
|
return _this;
|
|
64
63
|
}
|
|
64
|
+
|
|
65
|
+
// componentDidMount() {
|
|
66
|
+
// let { isActive } = this.props;
|
|
67
|
+
// if (isActive) {
|
|
68
|
+
// document.addEventListener('keydown', this.documentKeydownHandler)
|
|
69
|
+
// }
|
|
70
|
+
// }
|
|
71
|
+
|
|
72
|
+
// componentDidUpdate(prevProps) {
|
|
73
|
+
// let { isActive } = this.props;
|
|
74
|
+
// if (prevProps.isActive !== isActive) {
|
|
75
|
+
// isActive
|
|
76
|
+
// ? document.addEventListener('keydown', this.documentKeydownHandler)
|
|
77
|
+
// : document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
78
|
+
// }
|
|
79
|
+
// }
|
|
80
|
+
// componentWillUnmount() {
|
|
81
|
+
// document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
82
|
+
// }
|
|
83
|
+
|
|
84
|
+
// documentKeydownHandler(e = {}) {
|
|
85
|
+
// let { onSubmitClick, onCancelClick, isActive, onEsc, onClose } = this.props;
|
|
86
|
+
// if (e.keyCode === 27 && isActive) {
|
|
87
|
+
// e && e.preventDefault && e.preventDefault();
|
|
88
|
+
// onEsc == 'close'
|
|
89
|
+
// ? onClose && onClose(e)
|
|
90
|
+
// : onCancelClick && onCancelClick(e);
|
|
91
|
+
// } else if (e.keyCode === 13 && isActive) {
|
|
92
|
+
// e && e.preventDefault && e.preventDefault();
|
|
93
|
+
// onSubmitClick && onSubmitClick(e);
|
|
94
|
+
// }
|
|
95
|
+
// }
|
|
65
96
|
_createClass(AlertLookup, [{
|
|
66
|
-
key: "
|
|
67
|
-
value: function
|
|
68
|
-
var isActive = this.props.isActive;
|
|
69
|
-
if (isActive) {
|
|
70
|
-
document.addEventListener('keydown', this.documentKeydownHandler);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "componentDidUpdate",
|
|
75
|
-
value: function componentDidUpdate(prevProps) {
|
|
76
|
-
var isActive = this.props.isActive;
|
|
77
|
-
if (prevProps.isActive !== isActive) {
|
|
78
|
-
isActive ? document.addEventListener('keydown', this.documentKeydownHandler) : document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
key: "componentWillUnmount",
|
|
83
|
-
value: function componentWillUnmount() {
|
|
84
|
-
document.removeEventListener('keydown', this.documentKeydownHandler);
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
key: "documentKeydownHandler",
|
|
88
|
-
value: function documentKeydownHandler() {
|
|
89
|
-
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
97
|
+
key: "render",
|
|
98
|
+
value: function render() {
|
|
90
99
|
var _this$props = this.props,
|
|
100
|
+
isActive = _this$props.isActive,
|
|
101
|
+
size = _this$props.size,
|
|
102
|
+
_this$props$type = _this$props.type,
|
|
103
|
+
type = _this$props$type === void 0 ? 'danger' : _this$props$type,
|
|
104
|
+
title = _this$props.title,
|
|
105
|
+
message = _this$props.message,
|
|
106
|
+
confirmationMessage = _this$props.confirmationMessage,
|
|
107
|
+
submitText = _this$props.submitText,
|
|
108
|
+
cancelText = _this$props.cancelText,
|
|
91
109
|
onSubmitClick = _this$props.onSubmitClick,
|
|
92
110
|
onCancelClick = _this$props.onCancelClick,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
onClose = _this$props.onClose
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
// el && el.focus();
|
|
112
|
-
setTimeout(function () {
|
|
113
|
-
_this2.okButton && _this2.okButton.focus && _this2.okButton.focus();
|
|
114
|
-
}, 100);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}, {
|
|
118
|
-
key: "render",
|
|
119
|
-
value: function render() {
|
|
120
|
-
var _this$props2 = this.props,
|
|
121
|
-
isActive = _this$props2.isActive,
|
|
122
|
-
size = _this$props2.size,
|
|
123
|
-
_this$props2$type = _this$props2.type,
|
|
124
|
-
type = _this$props2$type === void 0 ? 'danger' : _this$props2$type,
|
|
125
|
-
title = _this$props2.title,
|
|
126
|
-
message = _this$props2.message,
|
|
127
|
-
confirmationMessage = _this$props2.confirmationMessage,
|
|
128
|
-
submitText = _this$props2.submitText,
|
|
129
|
-
cancelText = _this$props2.cancelText,
|
|
130
|
-
onSubmitClick = _this$props2.onSubmitClick,
|
|
131
|
-
onCancelClick = _this$props2.onCancelClick,
|
|
132
|
-
children = _this$props2.children,
|
|
133
|
-
forwardRef = _this$props2.forwardRef,
|
|
134
|
-
onClose = _this$props2.onClose,
|
|
135
|
-
headerChildren = _this$props2.headerChildren,
|
|
136
|
-
wrapHeader = _this$props2.wrapHeader,
|
|
137
|
-
dataId = _this$props2.dataId,
|
|
138
|
-
onLookupClick = _this$props2.onLookupClick,
|
|
139
|
-
_this$props2$customCl = _this$props2.customClass,
|
|
140
|
-
customClass = _this$props2$customCl === void 0 ? {} : _this$props2$customCl,
|
|
141
|
-
needIcon = _this$props2.needIcon,
|
|
142
|
-
a11y = _this$props2.a11y,
|
|
143
|
-
customProps = _this$props2.customProps,
|
|
144
|
-
align = _this$props2.align,
|
|
145
|
-
childAnimationName = _this$props2.childAnimationName,
|
|
146
|
-
isHtmlContent = _this$props2.isHtmlContent,
|
|
147
|
-
scroll = _this$props2.scroll;
|
|
111
|
+
children = _this$props.children,
|
|
112
|
+
forwardRef = _this$props.forwardRef,
|
|
113
|
+
onClose = _this$props.onClose,
|
|
114
|
+
headerChildren = _this$props.headerChildren,
|
|
115
|
+
wrapHeader = _this$props.wrapHeader,
|
|
116
|
+
dataId = _this$props.dataId,
|
|
117
|
+
onLookupClick = _this$props.onLookupClick,
|
|
118
|
+
_this$props$customCla = _this$props.customClass,
|
|
119
|
+
customClass = _this$props$customCla === void 0 ? {} : _this$props$customCla,
|
|
120
|
+
needIcon = _this$props.needIcon,
|
|
121
|
+
a11y = _this$props.a11y,
|
|
122
|
+
customProps = _this$props.customProps,
|
|
123
|
+
align = _this$props.align,
|
|
124
|
+
childAnimationName = _this$props.childAnimationName,
|
|
125
|
+
isHtmlContent = _this$props.isHtmlContent,
|
|
126
|
+
scroll = _this$props.scroll,
|
|
127
|
+
isDefaultFocus = _this$props.isDefaultFocus,
|
|
128
|
+
onEsc = _this$props.onEsc;
|
|
148
129
|
var _customProps$LookupPr = customProps.LookupProps,
|
|
149
130
|
LookupProps = _customProps$LookupPr === void 0 ? {} : _customProps$LookupPr,
|
|
150
131
|
_customProps$AlertHea = customProps.AlertHeaderProps,
|
|
@@ -168,6 +149,8 @@ var AlertLookup = /*#__PURE__*/function (_Component) {
|
|
|
168
149
|
ariaDescribedby: a11y && a11y.ariaDescribedby ? a11y.ariaDescribedby : ariaMessageId + ' ' + ariaConfirmMsgId
|
|
169
150
|
};
|
|
170
151
|
return /*#__PURE__*/_react["default"].createElement(_Lookup["default"], _extends({
|
|
152
|
+
onClose: onEsc == 'close' ? onClose : onCancelClick,
|
|
153
|
+
needFocusScope: true,
|
|
171
154
|
isActive: isActive,
|
|
172
155
|
size: size,
|
|
173
156
|
dataId: dataId,
|
|
@@ -216,7 +199,9 @@ var AlertLookup = /*#__PURE__*/function (_Component) {
|
|
|
216
199
|
dataId: dataId === 'alertPopup' ? 'alertConfirmButton' : "".concat(dataId, "_confirmButton"),
|
|
217
200
|
onClick: onSubmitClick,
|
|
218
201
|
palette: buttonPalette,
|
|
219
|
-
|
|
202
|
+
customProps: {
|
|
203
|
+
'data-a11y-autofocus': isDefaultFocus
|
|
204
|
+
}
|
|
220
205
|
}, PrimaryButtonProps)), cancelText && /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
|
|
221
206
|
dataId: dataId === 'alertPopup' ? 'alertCancelButton' : "".concat(dataId, "_cancelButton"),
|
|
222
207
|
text: cancelText,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/dot",
|
|
3
|
-
"version": "1.0.0-temp-
|
|
3
|
+
"version": "1.0.0-temp-110",
|
|
4
4
|
"main": "lib/index",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"build": "react-cli build:component:cmjs",
|
|
23
23
|
"buildlocal": " react-cli build:component:cmjs && npm run rtl",
|
|
24
24
|
"build:es": "react-cli build:library:es",
|
|
25
|
-
"build:dev": "npm run
|
|
25
|
+
"build:dev": "npm run build:variables && npm run build && npm run build:es --module:mode=dev -- -w",
|
|
26
26
|
"rtl:watch": "react-cli rtl ./src ./es -w",
|
|
27
27
|
"rtl": "react-cli rtl ./src ./lib && react-cli rtl ./src ./es",
|
|
28
28
|
"prepare": "npm run init && npm run build && npm run build:es && npm run rtl",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"lintAllFix": "npm run lintAll --eslint:fix=true",
|
|
34
34
|
"test": "react-cli test",
|
|
35
35
|
"sstest": "react-cli sstest",
|
|
36
|
-
"common_package_build": "cd ../common && npm run build && cd ../
|
|
37
|
-
"docs": "npm run
|
|
36
|
+
"common_package_build": "cd ../common && npm run build && cd ../dot",
|
|
37
|
+
"docs": "npm run dubCheck && react-cli docs",
|
|
38
38
|
"postpublish": "react-cli postpublish",
|
|
39
39
|
"download": "rm package-lock.json && rm -rf node_modules/ && npm install",
|
|
40
40
|
"expublish": "npm publish --tag experimental-version"
|
|
@@ -44,19 +44,21 @@
|
|
|
44
44
|
"velocity-react": "1.4.3",
|
|
45
45
|
"@zohodesk/variables": "1.0.0-beta.29",
|
|
46
46
|
"@zohodesk/i18n": "1.0.0-beta.7",
|
|
47
|
-
"@zohodesk/components": "1.0.0-temp-
|
|
47
|
+
"@zohodesk/components": "1.0.0-temp-110",
|
|
48
48
|
"@zohodesk/icons": "1.0.0-beta.109",
|
|
49
49
|
"@zohodesk/svg": "1.0.0-beta.49",
|
|
50
50
|
"@zohodesk/virtualizer": "1.0.3",
|
|
51
|
-
"react-sortable-hoc": "^0.8.3"
|
|
51
|
+
"react-sortable-hoc": "^0.8.3",
|
|
52
|
+
"@zohodesk/a11y": "1.3.4"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
54
55
|
"velocity-react": "1.4.3",
|
|
55
56
|
"@zohodesk/variables": "1.0.0-beta.29",
|
|
56
57
|
"@zohodesk/i18n": "1.0.0-beta.7",
|
|
57
|
-
"@zohodesk/components": "1.0.0-
|
|
58
|
+
"@zohodesk/components": "1.0.0-alpha-252",
|
|
58
59
|
"@zohodesk/icons": "1.0.0-beta.109",
|
|
59
|
-
"@zohodesk/svg": "1.0.0-beta.48"
|
|
60
|
+
"@zohodesk/svg": "1.0.0-beta.48",
|
|
61
|
+
"@zohodesk/a11y": "1.3.4"
|
|
60
62
|
},
|
|
61
63
|
"react-cli": {
|
|
62
64
|
"preprocess": {
|
|
@@ -88,4 +90,4 @@
|
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
|
-
}
|
|
93
|
+
}
|