@progress/kendo-react-buttons 5.5.1-dev.202207252139 → 5.6.0-dev.202208090643
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 +2 -2
- package/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/dist/es/Button.js +1 -1
- package/dist/es/ListButton/ButtonItem.js +1 -1
- package/dist/es/ListButton/DropDownButton.d.ts +7 -4
- package/dist/es/ListButton/DropDownButton.js +44 -14
- package/dist/es/ListButton/SplitButton.d.ts +7 -0
- package/dist/es/ListButton/SplitButton.js +44 -8
- package/dist/es/ListButton/models/ListButtonProps.d.ts +16 -0
- package/dist/es/ListButton/utils/navigation.js +7 -2
- package/dist/es/main.d.ts +2 -1
- package/dist/es/main.js +2 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/util.js +5 -4
- package/dist/npm/Button.js +1 -1
- package/dist/npm/ListButton/ButtonItem.js +1 -1
- package/dist/npm/ListButton/DropDownButton.d.ts +7 -4
- package/dist/npm/ListButton/DropDownButton.js +44 -14
- package/dist/npm/ListButton/SplitButton.d.ts +7 -0
- package/dist/npm/ListButton/SplitButton.js +44 -8
- package/dist/npm/ListButton/models/ListButtonProps.d.ts +16 -0
- package/dist/npm/ListButton/utils/navigation.js +7 -2
- package/dist/npm/main.d.ts +2 -1
- package/dist/npm/main.js +3 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/util.js +5 -4
- package/dist/systemjs/kendo-react-buttons.js +1 -1
- package/package.json +12 -12
|
@@ -10,7 +10,7 @@ export var ButtonItem = function (props) {
|
|
|
10
10
|
}, [props]);
|
|
11
11
|
var As = props.dataItem.render || props.item || (props.item === undefined ? props.render : null);
|
|
12
12
|
var text = props.dataItem.text !== undefined ? props.dataItem.text : (props.textField ? props.dataItem[props.textField] : props.dataItem);
|
|
13
|
-
var item = (React.createElement("li", { id: props.id, className: classNames('k-item', props.className, { 'k-focus': props.focused }), onClick: handleClick, onMouseDown: props.onDown, onPointerDown: props.onDown, role: "menuitem", "aria-disabled": props.dataItem.disabled || undefined }, (React.createElement("span", { tabIndex: -1, className: classNames('k-link k-menu-link', {
|
|
13
|
+
var item = (React.createElement("li", { id: props.id, className: classNames('k-item', props.className, { 'k-focus': props.focused }), tabIndex: -1, onClick: handleClick, onMouseDown: props.onDown, onPointerDown: props.onDown, role: "menuitem", "aria-disabled": props.dataItem.disabled || undefined }, (React.createElement("span", { tabIndex: -1, className: classNames('k-link k-menu-link', {
|
|
14
14
|
'k-selected': props.dataItem.selected,
|
|
15
15
|
'k-disabled': props.dataItem.disabled
|
|
16
16
|
}), key: "icon" }, As
|
|
@@ -34,6 +34,8 @@ export declare class DropDownButton extends React.Component<DropDownButtonProps,
|
|
|
34
34
|
*/
|
|
35
35
|
static propTypes: {
|
|
36
36
|
accessKey: PropTypes.Requireable<string>;
|
|
37
|
+
ariaLabel: PropTypes.Requireable<string>;
|
|
38
|
+
title: PropTypes.Requireable<string>;
|
|
37
39
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
38
40
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
41
|
onItemClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -73,6 +75,8 @@ export declare class DropDownButton extends React.Component<DropDownButtonProps,
|
|
|
73
75
|
};
|
|
74
76
|
private wrapper;
|
|
75
77
|
private mainButton;
|
|
78
|
+
private list;
|
|
79
|
+
private skipFocus;
|
|
76
80
|
private guid;
|
|
77
81
|
private buttonsData;
|
|
78
82
|
constructor(props: DropDownButtonProps);
|
|
@@ -85,15 +89,12 @@ export declare class DropDownButton extends React.Component<DropDownButtonProps,
|
|
|
85
89
|
* @hidden
|
|
86
90
|
*/
|
|
87
91
|
componentDidMount(): void;
|
|
88
|
-
/**
|
|
89
|
-
* @hidden
|
|
90
|
-
*/
|
|
91
|
-
componentDidUpdate(): void;
|
|
92
92
|
/**
|
|
93
93
|
* The DOM element of main button.
|
|
94
94
|
*/
|
|
95
95
|
get element(): HTMLButtonElement | null;
|
|
96
96
|
private onKeyDown;
|
|
97
|
+
private switchFocus;
|
|
97
98
|
private handleFocus;
|
|
98
99
|
private handleBlur;
|
|
99
100
|
private onItemClick;
|
|
@@ -101,6 +102,8 @@ export declare class DropDownButton extends React.Component<DropDownButtonProps,
|
|
|
101
102
|
private mouseDown;
|
|
102
103
|
private dispatchClickEvent;
|
|
103
104
|
private renderPopup;
|
|
105
|
+
private onPopupClose;
|
|
106
|
+
private listRef;
|
|
104
107
|
private renderChildItems;
|
|
105
108
|
private onClickMainButton;
|
|
106
109
|
private dispatchPopupEvent;
|
|
@@ -69,6 +69,8 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
69
69
|
};
|
|
70
70
|
_this.wrapper = null;
|
|
71
71
|
_this.mainButton = null;
|
|
72
|
+
_this.list = null;
|
|
73
|
+
_this.skipFocus = false;
|
|
72
74
|
_this.guid = guid();
|
|
73
75
|
_this.buttonsData = [];
|
|
74
76
|
_this.onKeyDown = function (event) {
|
|
@@ -106,18 +108,29 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
106
108
|
newState.focusedIndex = newFocused;
|
|
107
109
|
var arrowKey = event.keyCode === Keys.up || event.keyCode === Keys.down ||
|
|
108
110
|
event.keyCode === Keys.left || event.keyCode === Keys.right;
|
|
109
|
-
if (!event.altKey && arrowKey) {
|
|
111
|
+
if (!event.altKey && (arrowKey || event.keyCode === Keys.home || event.keyCode === Keys.end)) {
|
|
110
112
|
// Needed to notify the parent listeners that event is handled.
|
|
111
113
|
event.preventDefault();
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
_this.setState(newState);
|
|
115
117
|
};
|
|
118
|
+
_this.switchFocus = function (focusFn) {
|
|
119
|
+
_this.skipFocus = true;
|
|
120
|
+
focusFn();
|
|
121
|
+
window.setTimeout(function () { return _this.skipFocus = false; }, 0);
|
|
122
|
+
};
|
|
116
123
|
_this.handleFocus = function (event) {
|
|
124
|
+
if (_this.skipFocus) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
117
127
|
_this.setState({ focused: true, focusedIndex: _this.opened ? 0 : -1 });
|
|
118
128
|
dispatchEvent(_this.props.onFocus, event, _this, undefined);
|
|
119
129
|
};
|
|
120
130
|
_this.handleBlur = function (event) {
|
|
131
|
+
if (_this.skipFocus) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
121
134
|
_this.setState({ focused: false, opened: false, focusedIndex: -1 });
|
|
122
135
|
dispatchEvent(_this.props.onBlur, event, _this, undefined);
|
|
123
136
|
var fireCloseEvent = _this.opened;
|
|
@@ -131,12 +144,36 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
131
144
|
_this.dispatchPopupEvent(event, false);
|
|
132
145
|
};
|
|
133
146
|
_this.onItemDown = function (event) {
|
|
134
|
-
if (document.activeElement === _this.
|
|
147
|
+
if (document.activeElement === _this.list) {
|
|
135
148
|
event.preventDefault();
|
|
136
149
|
}
|
|
137
150
|
};
|
|
138
151
|
_this.mouseDown = function (event) {
|
|
139
152
|
event.preventDefault();
|
|
153
|
+
if (_this.element && document.activeElement !== _this.element && document.activeElement !== _this.list) {
|
|
154
|
+
_this.element.focus();
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
_this.onPopupClose = function () {
|
|
158
|
+
if (_this.state.focused) {
|
|
159
|
+
_this.switchFocus(function () {
|
|
160
|
+
if (_this.element) {
|
|
161
|
+
_this.element.removeAttribute('tabindex');
|
|
162
|
+
_this.element.focus({ preventScroll: true });
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
_this.listRef = function (list) {
|
|
168
|
+
_this.list = list;
|
|
169
|
+
if (list && _this.state.focused) {
|
|
170
|
+
_this.switchFocus(function () {
|
|
171
|
+
list.focus({ preventScroll: true });
|
|
172
|
+
if (_this.element) {
|
|
173
|
+
_this.element.tabIndex = -1;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
140
177
|
};
|
|
141
178
|
_this.onClickMainButton = function (event) {
|
|
142
179
|
if (!_this.buttonsData.length) {
|
|
@@ -178,7 +215,7 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
178
215
|
return (React.createElement("div", { id: id, style: style, className: classNames('k-dropdown-button', {
|
|
179
216
|
'k-focus': this.state.focused
|
|
180
217
|
}, this.props.className), onKeyDown: this.onKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur, dir: dir, ref: function (el) { return _this.wrapper = el; } },
|
|
181
|
-
React.createElement(Button, { size: this.props.size, shape: this.props.shape, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, onClick: this.onClickMainButton, onMouseDown: this.mouseDown, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, icon: this.props.icon, iconClass: this.props.iconClass, className: this.props.buttonClass, imageUrl: this.props.imageUrl, dir: dir, ref: function (btn) { return _this.mainButton = btn && btn.element; }, type: "button", "aria-
|
|
218
|
+
React.createElement(Button, { size: this.props.size, shape: this.props.shape, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, onClick: this.onClickMainButton, onMouseDown: this.mouseDown, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, icon: this.props.icon, iconClass: this.props.iconClass, className: this.props.buttonClass, imageUrl: this.props.imageUrl, dir: dir, ref: function (btn) { return _this.mainButton = btn && btn.element; }, type: "button", "aria-haspopup": true, "aria-expanded": this.opened || undefined, "aria-label": this.props.ariaLabel, "aria-controls": this.opened ? this.guid : undefined, id: 'button-' + this.guid, title: this.props.title }, this.props.text),
|
|
182
219
|
this.renderPopup(rtl)));
|
|
183
220
|
};
|
|
184
221
|
/**
|
|
@@ -190,15 +227,6 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
190
227
|
this.forceUpdate();
|
|
191
228
|
}
|
|
192
229
|
};
|
|
193
|
-
/**
|
|
194
|
-
* @hidden
|
|
195
|
-
*/
|
|
196
|
-
DropDownButton.prototype.componentDidUpdate = function () {
|
|
197
|
-
if (this.state.focused && this.element) {
|
|
198
|
-
// firefox in mac does not focus on mouse-down, next line fixes this
|
|
199
|
-
this.element.focus();
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
230
|
Object.defineProperty(DropDownButton.prototype, "element", {
|
|
203
231
|
/**
|
|
204
232
|
* The DOM element of main button.
|
|
@@ -221,8 +249,8 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
221
249
|
var _a;
|
|
222
250
|
var _b = this.props.popupSettings, popupSettings = _b === void 0 ? {} : _b;
|
|
223
251
|
var focusedIndex = this.state.focusedIndex;
|
|
224
|
-
return (React.createElement(Popup, { anchor: this.wrapper, show: this.opened, animate: popupSettings.animate, popupClass: classNames('k-menu-popup', popupSettings.popupClass), anchorAlign: popupSettings.anchorAlign || getAnchorAlign(rtl), popupAlign: popupSettings.popupAlign || getPopupAlign(rtl), style: rtl ? { direction: 'rtl' } : undefined },
|
|
225
|
-
React.createElement("ul", { role: "menu", id: this.guid, "aria-activedescendant": focusedIndex >= 0 ? "".concat(this.guid, "-").concat(focusedIndex) : undefined, className: classNames('k-group k-menu-group k-reset', (_a = {},
|
|
252
|
+
return (React.createElement(Popup, { anchor: this.wrapper, show: this.opened, animate: popupSettings.animate, popupClass: classNames('k-menu-popup', popupSettings.popupClass), anchorAlign: popupSettings.anchorAlign || getAnchorAlign(rtl), popupAlign: popupSettings.popupAlign || getPopupAlign(rtl), style: rtl ? { direction: 'rtl' } : undefined, onClose: this.onPopupClose },
|
|
253
|
+
React.createElement("ul", { role: "menu", id: this.guid, "aria-labelledby": 'button-' + this.guid, tabIndex: -1, "aria-activedescendant": focusedIndex >= 0 ? "".concat(this.guid, "-").concat(focusedIndex) : undefined, ref: this.listRef, className: classNames('k-group k-menu-group k-reset', (_a = {},
|
|
226
254
|
_a["k-menu-group-".concat(kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
|
|
227
255
|
_a)) }, this.renderChildItems())));
|
|
228
256
|
};
|
|
@@ -245,6 +273,8 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
245
273
|
*/
|
|
246
274
|
DropDownButton.propTypes = {
|
|
247
275
|
accessKey: PropTypes.string,
|
|
276
|
+
ariaLabel: PropTypes.string,
|
|
277
|
+
title: PropTypes.string,
|
|
248
278
|
onFocus: PropTypes.func,
|
|
249
279
|
onBlur: PropTypes.func,
|
|
250
280
|
onItemClick: PropTypes.func,
|
|
@@ -34,6 +34,8 @@ export declare class SplitButton extends React.Component<SplitButtonProps, Split
|
|
|
34
34
|
*/
|
|
35
35
|
static propTypes: {
|
|
36
36
|
accessKey: PropTypes.Requireable<string>;
|
|
37
|
+
ariaLabel: PropTypes.Requireable<string>;
|
|
38
|
+
title: PropTypes.Requireable<string>;
|
|
37
39
|
onButtonClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
38
40
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
41
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -75,7 +77,9 @@ export declare class SplitButton extends React.Component<SplitButtonProps, Split
|
|
|
75
77
|
};
|
|
76
78
|
private wrapper;
|
|
77
79
|
private mainButton;
|
|
80
|
+
private list;
|
|
78
81
|
private guid;
|
|
82
|
+
private skipFocus;
|
|
79
83
|
private buttonsData;
|
|
80
84
|
constructor(props: SplitButtonProps);
|
|
81
85
|
private get opened();
|
|
@@ -92,11 +96,14 @@ export declare class SplitButton extends React.Component<SplitButtonProps, Split
|
|
|
92
96
|
*/
|
|
93
97
|
get element(): HTMLButtonElement | null;
|
|
94
98
|
private onKeyDown;
|
|
99
|
+
private switchFocus;
|
|
95
100
|
private onFocus;
|
|
96
101
|
private onItemClick;
|
|
97
102
|
private onBlur;
|
|
98
103
|
private dispatchClickEvent;
|
|
99
104
|
private renderPopup;
|
|
105
|
+
private onPopupClose;
|
|
106
|
+
private listRef;
|
|
100
107
|
private renderChildItems;
|
|
101
108
|
private onSplitPartClick;
|
|
102
109
|
private onDownSplitPart;
|
|
@@ -58,7 +58,9 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
58
58
|
};
|
|
59
59
|
_this.wrapper = null;
|
|
60
60
|
_this.mainButton = null;
|
|
61
|
+
_this.list = null;
|
|
61
62
|
_this.guid = guid();
|
|
63
|
+
_this.skipFocus = false;
|
|
62
64
|
_this.buttonsData = [];
|
|
63
65
|
_this.onKeyDown = function (event) {
|
|
64
66
|
var focusedIndex = _this.state.focusedIndex;
|
|
@@ -102,7 +104,7 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
102
104
|
}
|
|
103
105
|
var arrowKey = event.keyCode === Keys.up || event.keyCode === Keys.down ||
|
|
104
106
|
event.keyCode === Keys.left || event.keyCode === Keys.right;
|
|
105
|
-
if (!event.altKey && arrowKey) {
|
|
107
|
+
if (!event.altKey && (arrowKey || event.keyCode === Keys.home || event.keyCode === Keys.end)) {
|
|
106
108
|
// Needed to notify the parent listeners that event is handled.
|
|
107
109
|
event.preventDefault();
|
|
108
110
|
}
|
|
@@ -111,9 +113,17 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
111
113
|
_this.setState(newState);
|
|
112
114
|
}
|
|
113
115
|
};
|
|
116
|
+
_this.switchFocus = function (focusFn) {
|
|
117
|
+
_this.skipFocus = true;
|
|
118
|
+
focusFn();
|
|
119
|
+
window.setTimeout(function () { return _this.skipFocus = false; }, 0);
|
|
120
|
+
};
|
|
114
121
|
_this.onFocus = function (event) {
|
|
122
|
+
if (_this.skipFocus) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
115
125
|
dispatchEvent(_this.props.onFocus, event, _this, undefined);
|
|
116
|
-
_this.setState({ focused: true
|
|
126
|
+
_this.setState({ focused: true });
|
|
117
127
|
};
|
|
118
128
|
_this.onItemClick = function (event, clickedItemIndex) {
|
|
119
129
|
var opened = _this.opened;
|
|
@@ -126,6 +136,9 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
126
136
|
}
|
|
127
137
|
};
|
|
128
138
|
_this.onBlur = function (event) {
|
|
139
|
+
if (_this.skipFocus) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
129
142
|
_this.setState({
|
|
130
143
|
focused: false,
|
|
131
144
|
focusedIndex: -1,
|
|
@@ -136,6 +149,27 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
136
149
|
_this.dispatchPopupEvent(event, false);
|
|
137
150
|
}
|
|
138
151
|
};
|
|
152
|
+
_this.onPopupClose = function () {
|
|
153
|
+
if (_this.state.focused) {
|
|
154
|
+
_this.switchFocus(function () {
|
|
155
|
+
if (_this.element) {
|
|
156
|
+
_this.element.removeAttribute('tabindex');
|
|
157
|
+
_this.element.focus({ preventScroll: true });
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
_this.listRef = function (list) {
|
|
163
|
+
_this.list = list;
|
|
164
|
+
if (list && _this.state.focused) {
|
|
165
|
+
_this.switchFocus(function () {
|
|
166
|
+
list.focus({ preventScroll: true });
|
|
167
|
+
if (_this.element) {
|
|
168
|
+
_this.element.tabIndex = -1;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
};
|
|
139
173
|
_this.onSplitPartClick = function (event) {
|
|
140
174
|
if (_this.buttonsData.length) {
|
|
141
175
|
var toOpen = !_this.opened;
|
|
@@ -149,12 +183,12 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
149
183
|
};
|
|
150
184
|
_this.onDownSplitPart = function (event) {
|
|
151
185
|
event.preventDefault();
|
|
152
|
-
if (_this.element && document.activeElement !== _this.element) {
|
|
186
|
+
if (_this.element && document.activeElement !== _this.element && document.activeElement !== _this.list) {
|
|
153
187
|
_this.element.focus();
|
|
154
188
|
}
|
|
155
189
|
};
|
|
156
190
|
_this.onItemDown = function (event) {
|
|
157
|
-
if (document.activeElement === _this.
|
|
191
|
+
if (document.activeElement === _this.list) {
|
|
158
192
|
event.preventDefault();
|
|
159
193
|
}
|
|
160
194
|
};
|
|
@@ -183,11 +217,10 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
183
217
|
var rtl = this.isRtl();
|
|
184
218
|
var dir = rtl ? 'rtl' : undefined;
|
|
185
219
|
var _a = this.props, id = _a.id, style = _a.style, tabIndex = _a.tabIndex, disabled = _a.disabled;
|
|
186
|
-
var focusedIndex = this.state.focusedIndex;
|
|
187
220
|
return (React.createElement("div", { id: id, style: style, className: classNames('k-split-button', 'k-button-group', {
|
|
188
221
|
'k-focus': this.state.focused
|
|
189
222
|
}, "k-rounded-".concat(kendoThemeMaps.roundedMap[this.props.rounded || 'medium']), this.props.className), onKeyDown: this.onKeyDown, onFocus: this.onFocus, onBlur: this.onBlur, dir: dir, ref: function (el) { return _this.wrapper = el; } },
|
|
190
|
-
React.createElement(Button, { ref: function (el) { return _this.mainButton = el && el.element; }, type: "button", size: this.props.size, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, onClick: function (event) { return _this.onItemClick(event, -1); }, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, className: this.props.buttonClass, icon: this.props.icon, iconClass: this.props.iconClass, imageUrl: this.props.imageUrl, dir: dir, "aria-disabled": disabled, "aria-haspopup": true, "aria-expanded": this.opened, "aria-label":
|
|
223
|
+
React.createElement(Button, { ref: function (el) { return _this.mainButton = el && el.element; }, type: "button", size: this.props.size, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, onClick: function (event) { return _this.onItemClick(event, -1); }, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, className: this.props.buttonClass, icon: this.props.icon, iconClass: this.props.iconClass, imageUrl: this.props.imageUrl, dir: dir, "aria-disabled": disabled, "aria-haspopup": true, "aria-expanded": this.opened || undefined, "aria-label": this.props.ariaLabel, "aria-controls": this.opened ? this.guid : undefined, id: 'button-' + this.guid, title: this.props.title }, this.props.text),
|
|
191
224
|
React.createElement(Button, { type: "button", size: this.props.size, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, icon: "arrow-s", className: "k-split-button-arrow", disabled: disabled || undefined, tabIndex: -1, onClick: this.onSplitPartClick, onMouseDown: this.onDownSplitPart, onPointerDown: this.onDownSplitPart, dir: dir, "aria-label": "menu toggling button" }),
|
|
192
225
|
this.renderPopup(rtl)));
|
|
193
226
|
};
|
|
@@ -226,8 +259,9 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
226
259
|
SplitButton.prototype.renderPopup = function (rtl) {
|
|
227
260
|
var _a;
|
|
228
261
|
var _b = this.props.popupSettings, popupSettings = _b === void 0 ? {} : _b;
|
|
229
|
-
|
|
230
|
-
|
|
262
|
+
var focusedIndex = this.state.focusedIndex;
|
|
263
|
+
return (React.createElement(Popup, { anchor: this.wrapper, show: this.opened, animate: popupSettings.animate, popupClass: classNames('k-menu-popup', popupSettings.popupClass), anchorAlign: popupSettings.anchorAlign || getAnchorAlign(rtl), popupAlign: popupSettings.popupAlign || getPopupAlign(rtl), style: rtl ? { direction: 'rtl' } : undefined, onClose: this.onPopupClose },
|
|
264
|
+
React.createElement("ul", { role: "menu", id: this.guid, "aria-labelledby": 'button-' + this.guid, tabIndex: -1, ref: this.listRef, "aria-activedescendant": focusedIndex >= 0 ? "".concat(this.guid, "-").concat(focusedIndex) : undefined, className: classNames('k-group k-menu-group k-reset', (_a = {},
|
|
231
265
|
_a["k-menu-group-".concat(kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
|
|
232
266
|
_a)) }, this.renderChildItems())));
|
|
233
267
|
};
|
|
@@ -250,6 +284,8 @@ var SplitButton = /** @class */ (function (_super) {
|
|
|
250
284
|
*/
|
|
251
285
|
SplitButton.propTypes = {
|
|
252
286
|
accessKey: PropTypes.string,
|
|
287
|
+
ariaLabel: PropTypes.string,
|
|
288
|
+
title: PropTypes.string,
|
|
253
289
|
onButtonClick: PropTypes.func,
|
|
254
290
|
onFocus: PropTypes.func,
|
|
255
291
|
onBlur: PropTypes.func,
|
|
@@ -8,6 +8,14 @@ export interface DropDownButtonProps extends KendoReactComponentBaseProps {
|
|
|
8
8
|
* Specifies the `accessKey` of the main button.
|
|
9
9
|
*/
|
|
10
10
|
accessKey?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The accessible label of the component.
|
|
13
|
+
*/
|
|
14
|
+
ariaLabel?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The title of the component.
|
|
17
|
+
*/
|
|
18
|
+
title?: string;
|
|
11
19
|
/**
|
|
12
20
|
* Specifies the text of the main button ([see example]({% slug overview_dropdownbutton %}#toc-basic-usage)).
|
|
13
21
|
*/
|
|
@@ -170,6 +178,14 @@ export interface SplitButtonProps extends KendoReactComponentBaseProps {
|
|
|
170
178
|
* Specifies the `accessKey` of the main button.
|
|
171
179
|
*/
|
|
172
180
|
accessKey?: string;
|
|
181
|
+
/**
|
|
182
|
+
* The accessible label of the component.
|
|
183
|
+
*/
|
|
184
|
+
ariaLabel?: string;
|
|
185
|
+
/**
|
|
186
|
+
* The title of the component.
|
|
187
|
+
*/
|
|
188
|
+
title?: string;
|
|
173
189
|
/**
|
|
174
190
|
* Specifies the text of the main button ([see example]({% slug overview_splitbutton %}#toc-basic-usage)).
|
|
175
191
|
*/
|
|
@@ -6,6 +6,7 @@ var navigate = function (focusedIndex, keyCode, altKey, total) {
|
|
|
6
6
|
if (altKey) {
|
|
7
7
|
return focusedIndex;
|
|
8
8
|
}
|
|
9
|
+
var index = Math.min(total - 1, Math.max(0, focusedIndex));
|
|
9
10
|
switch (keyCode) {
|
|
10
11
|
case Keys.enter:
|
|
11
12
|
case Keys.space:
|
|
@@ -13,10 +14,14 @@ var navigate = function (focusedIndex, keyCode, altKey, total) {
|
|
|
13
14
|
return -1;
|
|
14
15
|
case Keys.up:
|
|
15
16
|
case Keys.left:
|
|
16
|
-
return
|
|
17
|
+
return index - 1 < 0 ? total - 1 : index - 1;
|
|
17
18
|
case Keys.down:
|
|
18
19
|
case Keys.right:
|
|
19
|
-
return
|
|
20
|
+
return index + 1 >= total ? 0 : index + 1;
|
|
21
|
+
case Keys.home:
|
|
22
|
+
return 0;
|
|
23
|
+
case Keys.end:
|
|
24
|
+
return total - 1;
|
|
20
25
|
default:
|
|
21
26
|
return focusedIndex;
|
|
22
27
|
}
|
package/dist/es/main.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { Toolbar, ToolbarProps, ToolbarResizeEvent } from './toolbar/Toolbar';
|
|
|
13
13
|
import { ToolbarItem, ToolbarItemProps } from './toolbar/tools/ToolbarItem';
|
|
14
14
|
import { ToolbarSeparator } from './toolbar/tools/ToolbarSeparator';
|
|
15
15
|
import { ToolbarSpacer, ToolbarSpacerProps } from './toolbar/tools/ToolbarSpacer';
|
|
16
|
+
import { toolbarButtons } from './util';
|
|
16
17
|
import { Chip, ChipProps, ChipHandle } from './Chip/Chip';
|
|
17
18
|
import { ChipList, ChipListProps, ChipListHandle } from './Chip/ChipList';
|
|
18
19
|
import { ChipRemoveEvent, ChipMouseEvent, ChipKeyboardEvent, ChipFocusEvent, ChipListChangeEvent, ChipListDataChangeEvent } from './models/index';
|
|
@@ -29,4 +30,4 @@ import { FloatingActionButtonShape } from './FloatingActionButton/models/shape';
|
|
|
29
30
|
import { FloatingActionButtonSize } from './FloatingActionButton/models/size';
|
|
30
31
|
import { FloatingActionButtonRounded } from './FloatingActionButton/models/rounded';
|
|
31
32
|
import { FloatingActionButtonThemeColor } from './FloatingActionButton/models/theme-color';
|
|
32
|
-
export { Toolbar, ToolbarProps, ToolbarItem, ToolbarItemProps, ToolbarSeparator, ToolbarResizeEvent, ToolbarSpacer, ToolbarSpacerProps, Button, ButtonProps, ButtonGroup, ButtonGroupProps, SplitButton, SplitButtonItem, SplitButtonItemProps, DropDownButton, DropDownButtonProps, DropDownButtonItem, DropDownButtonItemProps, ButtonItem, ButtonItemProps, SplitButtonFocusEvent, SplitButtonBlurEvent, SplitButtonClickEvent, SplitButtonOpenEvent, SplitButtonCloseEvent, SplitButtonItemClickEvent, DropDownButtonFocusEvent, DropDownButtonBlurEvent, DropDownButtonOpenEvent, DropDownButtonCloseEvent, DropDownButtonItemClickEvent, ButtonsPopupSettings, Chip, ChipProps, ChipHandle, ChipRemoveEvent, ChipMouseEvent, ChipKeyboardEvent, ChipFocusEvent, ChipList, ChipListProps, ChipListHandle, ChipListDataChangeEvent, ChipListChangeEvent, FloatingActionButton, FloatingActionButtonProps, FloatingActionButtonHandle, FloatingActionButtonItem, FloatingActionButtonItemHandle, FloatingActionButtonItemProps, FloatingActionButtonPopupSettings, FloatingActionButtonAlign, FloatingActionButtonAlignOffset, FloatingActionButtonPositionMode, FloatingActionButtonSize, FloatingActionButtonShape, FloatingActionButtonRounded, FloatingActionButtonThemeColor };
|
|
33
|
+
export { Toolbar, ToolbarProps, ToolbarItem, ToolbarItemProps, ToolbarSeparator, ToolbarResizeEvent, ToolbarSpacer, ToolbarSpacerProps, toolbarButtons, Button, ButtonProps, ButtonGroup, ButtonGroupProps, SplitButton, SplitButtonItem, SplitButtonItemProps, DropDownButton, DropDownButtonProps, DropDownButtonItem, DropDownButtonItemProps, ButtonItem, ButtonItemProps, SplitButtonFocusEvent, SplitButtonBlurEvent, SplitButtonClickEvent, SplitButtonOpenEvent, SplitButtonCloseEvent, SplitButtonItemClickEvent, DropDownButtonFocusEvent, DropDownButtonBlurEvent, DropDownButtonOpenEvent, DropDownButtonCloseEvent, DropDownButtonItemClickEvent, ButtonsPopupSettings, Chip, ChipProps, ChipHandle, ChipRemoveEvent, ChipMouseEvent, ChipKeyboardEvent, ChipFocusEvent, ChipList, ChipListProps, ChipListHandle, ChipListDataChangeEvent, ChipListChangeEvent, FloatingActionButton, FloatingActionButtonProps, FloatingActionButtonHandle, FloatingActionButtonItem, FloatingActionButtonItemHandle, FloatingActionButtonItemProps, FloatingActionButtonPopupSettings, FloatingActionButtonAlign, FloatingActionButtonAlignOffset, FloatingActionButtonPositionMode, FloatingActionButtonSize, FloatingActionButtonShape, FloatingActionButtonRounded, FloatingActionButtonThemeColor };
|
package/dist/es/main.js
CHANGED
|
@@ -8,9 +8,10 @@ import { Toolbar } from './toolbar/Toolbar';
|
|
|
8
8
|
import { ToolbarItem } from './toolbar/tools/ToolbarItem';
|
|
9
9
|
import { ToolbarSeparator } from './toolbar/tools/ToolbarSeparator';
|
|
10
10
|
import { ToolbarSpacer } from './toolbar/tools/ToolbarSpacer';
|
|
11
|
+
import { toolbarButtons } from './util';
|
|
11
12
|
import { Chip } from './Chip/Chip';
|
|
12
13
|
import { ChipList } from './Chip/ChipList';
|
|
13
14
|
import { FloatingActionButton } from './FloatingActionButton/FloatingActionButton';
|
|
14
15
|
import { FloatingActionButtonItem } from './FloatingActionButton/FloatingActionButtonItem';
|
|
15
16
|
export * from './FloatingActionButton/models/events';
|
|
16
|
-
export { Toolbar, ToolbarItem, ToolbarSeparator, ToolbarSpacer, Button, ButtonGroup, SplitButton, SplitButtonItem, DropDownButton, DropDownButtonItem, Chip, ChipList, FloatingActionButton, FloatingActionButtonItem };
|
|
17
|
+
export { Toolbar, ToolbarItem, ToolbarSeparator, ToolbarSpacer, toolbarButtons, Button, ButtonGroup, SplitButton, SplitButtonItem, DropDownButton, DropDownButtonItem, Chip, ChipList, FloatingActionButton, FloatingActionButtonItem };
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-react-buttons',
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1660025982,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
11
11
|
};
|
package/dist/es/util.js
CHANGED
|
@@ -19,14 +19,15 @@ var styles = {
|
|
|
19
19
|
'rtl': 'k-rtl'
|
|
20
20
|
};
|
|
21
21
|
var notDisabled = ':not(.k-disabled):not([disabled]):not([disabled="true"])';
|
|
22
|
+
var noInnerButton = ':not(.k-dropdownlist button):not(.k-colorpicker button):not(.k-split-button .k-split-button-arrow)';
|
|
22
23
|
/**
|
|
23
24
|
* @hidden
|
|
24
25
|
*/
|
|
25
26
|
export var toolbarButtons = [
|
|
26
|
-
'button' + notDisabled,
|
|
27
|
-
'.k-button-group > button' + notDisabled,
|
|
28
|
-
'.k-
|
|
29
|
-
'.k-colorpicker
|
|
27
|
+
'button' + notDisabled + noInnerButton,
|
|
28
|
+
'.k-button-group > button' + notDisabled + noInnerButton,
|
|
29
|
+
'.k-dropdownlist' + notDisabled,
|
|
30
|
+
'.k-colorpicker' + notDisabled
|
|
30
31
|
];
|
|
31
32
|
/**
|
|
32
33
|
* @hidden
|
package/dist/npm/Button.js
CHANGED
|
@@ -120,7 +120,7 @@ var Button = /** @class */ (function (_super) {
|
|
|
120
120
|
imageUrl: imageUrl,
|
|
121
121
|
imageAlt: imageAlt
|
|
122
122
|
});
|
|
123
|
-
return (React.createElement("button", __assign({ ref: function (button) { return _this._element = button; },
|
|
123
|
+
return (React.createElement("button", __assign({ ref: function (button) { return _this._element = button; }, "aria-pressed": togglable ? this.state.selected : undefined }, htmlAttributes, { onClick: this.handleClick, className: (0, kendo_react_common_1.classNames)('k-button', (_a = {},
|
|
124
124
|
_a["k-button-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
125
125
|
_a["k-button-".concat(shape)] = shape,
|
|
126
126
|
_a["k-button-".concat(fillMode)] = fillMode,
|
|
@@ -13,7 +13,7 @@ var ButtonItem = function (props) {
|
|
|
13
13
|
}, [props]);
|
|
14
14
|
var As = props.dataItem.render || props.item || (props.item === undefined ? props.render : null);
|
|
15
15
|
var text = props.dataItem.text !== undefined ? props.dataItem.text : (props.textField ? props.dataItem[props.textField] : props.dataItem);
|
|
16
|
-
var item = (React.createElement("li", { id: props.id, className: (0, kendo_react_common_1.classNames)('k-item', props.className, { 'k-focus': props.focused }), onClick: handleClick, onMouseDown: props.onDown, onPointerDown: props.onDown, role: "menuitem", "aria-disabled": props.dataItem.disabled || undefined }, (React.createElement("span", { tabIndex: -1, className: (0, kendo_react_common_1.classNames)('k-link k-menu-link', {
|
|
16
|
+
var item = (React.createElement("li", { id: props.id, className: (0, kendo_react_common_1.classNames)('k-item', props.className, { 'k-focus': props.focused }), tabIndex: -1, onClick: handleClick, onMouseDown: props.onDown, onPointerDown: props.onDown, role: "menuitem", "aria-disabled": props.dataItem.disabled || undefined }, (React.createElement("span", { tabIndex: -1, className: (0, kendo_react_common_1.classNames)('k-link k-menu-link', {
|
|
17
17
|
'k-selected': props.dataItem.selected,
|
|
18
18
|
'k-disabled': props.dataItem.disabled
|
|
19
19
|
}), key: "icon" }, As
|
|
@@ -34,6 +34,8 @@ export declare class DropDownButton extends React.Component<DropDownButtonProps,
|
|
|
34
34
|
*/
|
|
35
35
|
static propTypes: {
|
|
36
36
|
accessKey: PropTypes.Requireable<string>;
|
|
37
|
+
ariaLabel: PropTypes.Requireable<string>;
|
|
38
|
+
title: PropTypes.Requireable<string>;
|
|
37
39
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
38
40
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
41
|
onItemClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -73,6 +75,8 @@ export declare class DropDownButton extends React.Component<DropDownButtonProps,
|
|
|
73
75
|
};
|
|
74
76
|
private wrapper;
|
|
75
77
|
private mainButton;
|
|
78
|
+
private list;
|
|
79
|
+
private skipFocus;
|
|
76
80
|
private guid;
|
|
77
81
|
private buttonsData;
|
|
78
82
|
constructor(props: DropDownButtonProps);
|
|
@@ -85,15 +89,12 @@ export declare class DropDownButton extends React.Component<DropDownButtonProps,
|
|
|
85
89
|
* @hidden
|
|
86
90
|
*/
|
|
87
91
|
componentDidMount(): void;
|
|
88
|
-
/**
|
|
89
|
-
* @hidden
|
|
90
|
-
*/
|
|
91
|
-
componentDidUpdate(): void;
|
|
92
92
|
/**
|
|
93
93
|
* The DOM element of main button.
|
|
94
94
|
*/
|
|
95
95
|
get element(): HTMLButtonElement | null;
|
|
96
96
|
private onKeyDown;
|
|
97
|
+
private switchFocus;
|
|
97
98
|
private handleFocus;
|
|
98
99
|
private handleBlur;
|
|
99
100
|
private onItemClick;
|
|
@@ -101,6 +102,8 @@ export declare class DropDownButton extends React.Component<DropDownButtonProps,
|
|
|
101
102
|
private mouseDown;
|
|
102
103
|
private dispatchClickEvent;
|
|
103
104
|
private renderPopup;
|
|
105
|
+
private onPopupClose;
|
|
106
|
+
private listRef;
|
|
104
107
|
private renderChildItems;
|
|
105
108
|
private onClickMainButton;
|
|
106
109
|
private dispatchPopupEvent;
|
|
@@ -72,6 +72,8 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
72
72
|
};
|
|
73
73
|
_this.wrapper = null;
|
|
74
74
|
_this.mainButton = null;
|
|
75
|
+
_this.list = null;
|
|
76
|
+
_this.skipFocus = false;
|
|
75
77
|
_this.guid = (0, kendo_react_common_1.guid)();
|
|
76
78
|
_this.buttonsData = [];
|
|
77
79
|
_this.onKeyDown = function (event) {
|
|
@@ -109,18 +111,29 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
109
111
|
newState.focusedIndex = newFocused;
|
|
110
112
|
var arrowKey = event.keyCode === kendo_react_common_1.Keys.up || event.keyCode === kendo_react_common_1.Keys.down ||
|
|
111
113
|
event.keyCode === kendo_react_common_1.Keys.left || event.keyCode === kendo_react_common_1.Keys.right;
|
|
112
|
-
if (!event.altKey && arrowKey) {
|
|
114
|
+
if (!event.altKey && (arrowKey || event.keyCode === kendo_react_common_1.Keys.home || event.keyCode === kendo_react_common_1.Keys.end)) {
|
|
113
115
|
// Needed to notify the parent listeners that event is handled.
|
|
114
116
|
event.preventDefault();
|
|
115
117
|
}
|
|
116
118
|
}
|
|
117
119
|
_this.setState(newState);
|
|
118
120
|
};
|
|
121
|
+
_this.switchFocus = function (focusFn) {
|
|
122
|
+
_this.skipFocus = true;
|
|
123
|
+
focusFn();
|
|
124
|
+
window.setTimeout(function () { return _this.skipFocus = false; }, 0);
|
|
125
|
+
};
|
|
119
126
|
_this.handleFocus = function (event) {
|
|
127
|
+
if (_this.skipFocus) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
120
130
|
_this.setState({ focused: true, focusedIndex: _this.opened ? 0 : -1 });
|
|
121
131
|
(0, kendo_react_common_2.dispatchEvent)(_this.props.onFocus, event, _this, undefined);
|
|
122
132
|
};
|
|
123
133
|
_this.handleBlur = function (event) {
|
|
134
|
+
if (_this.skipFocus) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
124
137
|
_this.setState({ focused: false, opened: false, focusedIndex: -1 });
|
|
125
138
|
(0, kendo_react_common_2.dispatchEvent)(_this.props.onBlur, event, _this, undefined);
|
|
126
139
|
var fireCloseEvent = _this.opened;
|
|
@@ -134,12 +147,36 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
134
147
|
_this.dispatchPopupEvent(event, false);
|
|
135
148
|
};
|
|
136
149
|
_this.onItemDown = function (event) {
|
|
137
|
-
if (document.activeElement === _this.
|
|
150
|
+
if (document.activeElement === _this.list) {
|
|
138
151
|
event.preventDefault();
|
|
139
152
|
}
|
|
140
153
|
};
|
|
141
154
|
_this.mouseDown = function (event) {
|
|
142
155
|
event.preventDefault();
|
|
156
|
+
if (_this.element && document.activeElement !== _this.element && document.activeElement !== _this.list) {
|
|
157
|
+
_this.element.focus();
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
_this.onPopupClose = function () {
|
|
161
|
+
if (_this.state.focused) {
|
|
162
|
+
_this.switchFocus(function () {
|
|
163
|
+
if (_this.element) {
|
|
164
|
+
_this.element.removeAttribute('tabindex');
|
|
165
|
+
_this.element.focus({ preventScroll: true });
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
_this.listRef = function (list) {
|
|
171
|
+
_this.list = list;
|
|
172
|
+
if (list && _this.state.focused) {
|
|
173
|
+
_this.switchFocus(function () {
|
|
174
|
+
list.focus({ preventScroll: true });
|
|
175
|
+
if (_this.element) {
|
|
176
|
+
_this.element.tabIndex = -1;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
143
180
|
};
|
|
144
181
|
_this.onClickMainButton = function (event) {
|
|
145
182
|
if (!_this.buttonsData.length) {
|
|
@@ -181,7 +218,7 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
181
218
|
return (React.createElement("div", { id: id, style: style, className: (0, kendo_react_common_1.classNames)('k-dropdown-button', {
|
|
182
219
|
'k-focus': this.state.focused
|
|
183
220
|
}, this.props.className), onKeyDown: this.onKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur, dir: dir, ref: function (el) { return _this.wrapper = el; } },
|
|
184
|
-
React.createElement(main_1.Button, { size: this.props.size, shape: this.props.shape, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, onClick: this.onClickMainButton, onMouseDown: this.mouseDown, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, icon: this.props.icon, iconClass: this.props.iconClass, className: this.props.buttonClass, imageUrl: this.props.imageUrl, dir: dir, ref: function (btn) { return _this.mainButton = btn && btn.element; }, type: "button", "aria-
|
|
221
|
+
React.createElement(main_1.Button, { size: this.props.size, shape: this.props.shape, rounded: this.props.rounded, fillMode: this.props.fillMode, themeColor: this.props.themeColor, onClick: this.onClickMainButton, onMouseDown: this.mouseDown, disabled: disabled || undefined, tabIndex: tabIndex, accessKey: this.props.accessKey, icon: this.props.icon, iconClass: this.props.iconClass, className: this.props.buttonClass, imageUrl: this.props.imageUrl, dir: dir, ref: function (btn) { return _this.mainButton = btn && btn.element; }, type: "button", "aria-haspopup": true, "aria-expanded": this.opened || undefined, "aria-label": this.props.ariaLabel, "aria-controls": this.opened ? this.guid : undefined, id: 'button-' + this.guid, title: this.props.title }, this.props.text),
|
|
185
222
|
this.renderPopup(rtl)));
|
|
186
223
|
};
|
|
187
224
|
/**
|
|
@@ -193,15 +230,6 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
193
230
|
this.forceUpdate();
|
|
194
231
|
}
|
|
195
232
|
};
|
|
196
|
-
/**
|
|
197
|
-
* @hidden
|
|
198
|
-
*/
|
|
199
|
-
DropDownButton.prototype.componentDidUpdate = function () {
|
|
200
|
-
if (this.state.focused && this.element) {
|
|
201
|
-
// firefox in mac does not focus on mouse-down, next line fixes this
|
|
202
|
-
this.element.focus();
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
233
|
Object.defineProperty(DropDownButton.prototype, "element", {
|
|
206
234
|
/**
|
|
207
235
|
* The DOM element of main button.
|
|
@@ -224,8 +252,8 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
224
252
|
var _a;
|
|
225
253
|
var _b = this.props.popupSettings, popupSettings = _b === void 0 ? {} : _b;
|
|
226
254
|
var focusedIndex = this.state.focusedIndex;
|
|
227
|
-
return (React.createElement(kendo_react_popup_1.Popup, { anchor: this.wrapper, show: this.opened, animate: popupSettings.animate, popupClass: (0, kendo_react_common_1.classNames)('k-menu-popup', popupSettings.popupClass), anchorAlign: popupSettings.anchorAlign || (0, popup_1.getAnchorAlign)(rtl), popupAlign: popupSettings.popupAlign || (0, popup_1.getPopupAlign)(rtl), style: rtl ? { direction: 'rtl' } : undefined },
|
|
228
|
-
React.createElement("ul", { role: "menu", id: this.guid, "aria-activedescendant": focusedIndex >= 0 ? "".concat(this.guid, "-").concat(focusedIndex) : undefined, className: (0, kendo_react_common_1.classNames)('k-group k-menu-group k-reset', (_a = {},
|
|
255
|
+
return (React.createElement(kendo_react_popup_1.Popup, { anchor: this.wrapper, show: this.opened, animate: popupSettings.animate, popupClass: (0, kendo_react_common_1.classNames)('k-menu-popup', popupSettings.popupClass), anchorAlign: popupSettings.anchorAlign || (0, popup_1.getAnchorAlign)(rtl), popupAlign: popupSettings.popupAlign || (0, popup_1.getPopupAlign)(rtl), style: rtl ? { direction: 'rtl' } : undefined, onClose: this.onPopupClose },
|
|
256
|
+
React.createElement("ul", { role: "menu", id: this.guid, "aria-labelledby": 'button-' + this.guid, tabIndex: -1, "aria-activedescendant": focusedIndex >= 0 ? "".concat(this.guid, "-").concat(focusedIndex) : undefined, ref: this.listRef, className: (0, kendo_react_common_1.classNames)('k-group k-menu-group k-reset', (_a = {},
|
|
229
257
|
_a["k-menu-group-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
|
|
230
258
|
_a)) }, this.renderChildItems())));
|
|
231
259
|
};
|
|
@@ -248,6 +276,8 @@ var DropDownButton = /** @class */ (function (_super) {
|
|
|
248
276
|
*/
|
|
249
277
|
DropDownButton.propTypes = {
|
|
250
278
|
accessKey: PropTypes.string,
|
|
279
|
+
ariaLabel: PropTypes.string,
|
|
280
|
+
title: PropTypes.string,
|
|
251
281
|
onFocus: PropTypes.func,
|
|
252
282
|
onBlur: PropTypes.func,
|
|
253
283
|
onItemClick: PropTypes.func,
|