@progress/kendo-react-buttons 5.14.0-dev.202306011426 → 5.14.0-dev.202306020002

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.
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import * as React from 'react';
24
24
  import * as PropTypes from 'prop-types';
25
- import { IconWrap, kendoThemeMaps, svgIconPropType, useZIndexContext, validatePackage, ZIndexContext } from '@progress/kendo-react-common';
25
+ import { getActiveElement, IconWrap, kendoThemeMaps, svgIconPropType, useZIndexContext, validatePackage, ZIndexContext } from '@progress/kendo-react-common';
26
26
  import { classNames, guid, useDir, dispatchEvent, Keys, getTabIndex } from '@progress/kendo-react-common';
27
27
  import { FloatingActionButtonItem } from './FloatingActionButtonItem';
28
28
  import { packageMetadata } from '../package-metadata';
@@ -143,10 +143,11 @@ export var FloatingActionButton = React.forwardRef(function (props, ref) {
143
143
  dispatchPopupEvent(event, false);
144
144
  }, [setFocusedIndex, setOpen, dispatchItemClickEvent, dispatchPopupEvent]);
145
145
  var handleItemDown = React.useCallback(function (event) {
146
- if (document.activeElement === elementRef.current) {
146
+ var activeElement = getActiveElement(document);
147
+ if (activeElement === elementRef.current) {
147
148
  event.preventDefault();
148
149
  }
149
- }, [elementRef, document.activeElement]);
150
+ }, [elementRef]);
150
151
  var handleKeyDown = React.useCallback(function (event) {
151
152
  var currIndex = focusedIndex;
152
153
  var maxNavIndex = items ? items.length - 1 : -1;
@@ -27,7 +27,7 @@ var __assign = (this && this.__assign) || function () {
27
27
  import * as React from 'react';
28
28
  import * as PropTypes from 'prop-types';
29
29
  import { Button } from './../main';
30
- import { classNames, guid, Keys, kendoThemeMaps, svgIconPropType } from '@progress/kendo-react-common';
30
+ import { classNames, guid, Keys, kendoThemeMaps, svgIconPropType, getActiveElement } from '@progress/kendo-react-common';
31
31
  import { dispatchEvent } from '@progress/kendo-react-common';
32
32
  import { navigate as navigation } from './utils/navigation';
33
33
  import { DropDownButtonItem } from './DropDownButtonItem';
@@ -81,7 +81,6 @@ var DropDownButton = /** @class */ (function (_super) {
81
81
  _this.setState({ focusedIndex: 0, opened: true });
82
82
  }
83
83
  else if (_this.opened && event.keyCode === Keys.up) {
84
- _this.dispatchPopupEvent(event, false);
85
84
  _this.setState({ focusedIndex: -1, opened: false });
86
85
  }
87
86
  return;
@@ -96,12 +95,13 @@ var DropDownButton = /** @class */ (function (_super) {
96
95
  event.preventDefault();
97
96
  newState.focusedIndex = _this.opened ? -1 : 0,
98
97
  newState.opened = !_this.opened;
99
- _this.dispatchPopupEvent(event, newState.opened);
98
+ if (newState.opened) {
99
+ _this.dispatchPopupEvent(event, newState.opened);
100
+ }
100
101
  }
101
102
  else if (_this.opened && event.keyCode === Keys.esc) {
102
103
  newState.focusedIndex = -1;
103
104
  newState.opened = false;
104
- _this.dispatchPopupEvent(event, newState.opened);
105
105
  }
106
106
  if (_this.opened) {
107
107
  var newFocused = navigation(focusedIndex, event.keyCode, event.altKey, _this.buttonsData.length);
@@ -133,24 +133,21 @@ var DropDownButton = /** @class */ (function (_super) {
133
133
  }
134
134
  _this.setState({ focused: false, opened: false, focusedIndex: -1 });
135
135
  dispatchEvent(_this.props.onBlur, event, _this, undefined);
136
- var fireCloseEvent = _this.opened;
137
- if (fireCloseEvent) {
138
- _this.dispatchPopupEvent(event, false);
139
- }
140
136
  };
141
137
  _this.onItemClick = function (event, clickedItemIndex) {
142
138
  _this.setState({ focusedIndex: -1, opened: false });
143
139
  _this.dispatchClickEvent(event, clickedItemIndex);
144
- _this.dispatchPopupEvent(event, false);
145
140
  };
146
141
  _this.onItemDown = function (event) {
147
- if (document.activeElement === _this.list) {
142
+ var activeElement = getActiveElement(document);
143
+ if (activeElement === _this.list) {
148
144
  event.preventDefault();
149
145
  }
150
146
  };
151
147
  _this.mouseDown = function (event) {
152
148
  event.preventDefault();
153
- if (_this.element && document.activeElement !== _this.element && document.activeElement !== _this.list) {
149
+ var activeElement = getActiveElement(document);
150
+ if (_this.element && activeElement !== _this.element && activeElement !== _this.list) {
154
151
  _this.element.focus();
155
152
  }
156
153
  };
@@ -163,6 +160,7 @@ var DropDownButton = /** @class */ (function (_super) {
163
160
  }
164
161
  });
165
162
  }
163
+ _this.dispatchPopupEvent({}, false);
166
164
  };
167
165
  _this.listRef = function (list) {
168
166
  _this.list = list;
@@ -185,7 +183,9 @@ var DropDownButton = /** @class */ (function (_super) {
185
183
  focused: true,
186
184
  focusedIndex: toOpen ? 0 : -1
187
185
  });
188
- _this.dispatchPopupEvent(event, toOpen);
186
+ if (toOpen) {
187
+ _this.dispatchPopupEvent(event, toOpen);
188
+ }
189
189
  };
190
190
  _this.dispatchPopupEvent = function (dispatchedEvent, open) {
191
191
  dispatchEvent(open ? _this.props.onOpen : _this.props.onClose, dispatchedEvent, _this, undefined);
@@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () {
16
16
  import * as React from 'react';
17
17
  import * as PropTypes from 'prop-types';
18
18
  import { Button } from './../main';
19
- import { classNames, guid, kendoThemeMaps, Keys, svgIconPropType } from '@progress/kendo-react-common';
19
+ import { classNames, getActiveElement, guid, kendoThemeMaps, Keys, svgIconPropType } from '@progress/kendo-react-common';
20
20
  import { dispatchEvent } from '@progress/kendo-react-common';
21
21
  import { ButtonItem } from './ButtonItem';
22
22
  import { SplitButtonItem } from './SplitButtonItem';
@@ -71,7 +71,6 @@ var SplitButton = /** @class */ (function (_super) {
71
71
  _this.setState({ focusedIndex: 0, opened: true });
72
72
  }
73
73
  else if (_this.opened && event.keyCode === Keys.up) {
74
- _this.dispatchPopupEvent(event, false);
75
74
  _this.setState({ focusedIndex: -1, opened: false });
76
75
  }
77
76
  return;
@@ -87,7 +86,9 @@ var SplitButton = /** @class */ (function (_super) {
87
86
  focusedIndex: _this.opened ? -1 : 0,
88
87
  opened: !_this.opened
89
88
  };
90
- _this.dispatchPopupEvent(event, newState.opened);
89
+ if (newState.opened) {
90
+ _this.dispatchPopupEvent(event, newState.opened);
91
+ }
91
92
  }
92
93
  }
93
94
  else if (_this.opened && event.keyCode === Keys.esc) {
@@ -95,7 +96,6 @@ var SplitButton = /** @class */ (function (_super) {
95
96
  focusedIndex: -1,
96
97
  opened: false
97
98
  };
98
- _this.dispatchPopupEvent(event, newState.opened);
99
99
  }
100
100
  if (_this.opened) {
101
101
  var newFocused = navigation(focusedIndex, event.keyCode, event.altKey, _this.buttonsData.length);
@@ -132,9 +132,6 @@ var SplitButton = /** @class */ (function (_super) {
132
132
  _this.setState({ focusedIndex: 0, opened: false });
133
133
  }
134
134
  _this.dispatchClickEvent(event, clickedItemIndex);
135
- if (opened) {
136
- _this.dispatchPopupEvent(event, false);
137
- }
138
135
  };
139
136
  _this.onBlur = function (event) {
140
137
  if (_this.skipFocus) {
@@ -146,9 +143,6 @@ var SplitButton = /** @class */ (function (_super) {
146
143
  opened: false
147
144
  });
148
145
  dispatchEvent(_this.props.onBlur, event, _this, undefined);
149
- if (_this.opened) {
150
- _this.dispatchPopupEvent(event, false);
151
- }
152
146
  };
153
147
  _this.onPopupClose = function () {
154
148
  if (_this.state.focused) {
@@ -159,6 +153,7 @@ var SplitButton = /** @class */ (function (_super) {
159
153
  }
160
154
  });
161
155
  }
156
+ _this.dispatchPopupEvent({}, false);
162
157
  };
163
158
  _this.listRef = function (list) {
164
159
  _this.list = list;
@@ -174,7 +169,9 @@ var SplitButton = /** @class */ (function (_super) {
174
169
  _this.onSplitPartClick = function (event) {
175
170
  if (_this.buttonsData.length) {
176
171
  var toOpen = !_this.opened;
177
- _this.dispatchPopupEvent(event, toOpen);
172
+ if (toOpen) {
173
+ _this.dispatchPopupEvent(event, toOpen);
174
+ }
178
175
  _this.setState({
179
176
  focusedIndex: toOpen ? 0 : -1,
180
177
  opened: toOpen,
@@ -184,12 +181,14 @@ var SplitButton = /** @class */ (function (_super) {
184
181
  };
185
182
  _this.onDownSplitPart = function (event) {
186
183
  event.preventDefault();
187
- if (_this.element && document.activeElement !== _this.element && document.activeElement !== _this.list) {
184
+ var activeElement = getActiveElement(document);
185
+ if (_this.element && activeElement !== _this.element && activeElement !== _this.list) {
188
186
  _this.element.focus();
189
187
  }
190
188
  };
191
189
  _this.onItemDown = function (event) {
192
- if (document.activeElement === _this.list) {
190
+ var activeElement = getActiveElement(document);
191
+ if (activeElement === _this.list) {
193
192
  event.preventDefault();
194
193
  }
195
194
  };
@@ -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: 1685627126,
8
+ publishDate: 1685661811,
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
  };
@@ -146,10 +146,11 @@ exports.FloatingActionButton = React.forwardRef(function (props, ref) {
146
146
  dispatchPopupEvent(event, false);
147
147
  }, [setFocusedIndex, setOpen, dispatchItemClickEvent, dispatchPopupEvent]);
148
148
  var handleItemDown = React.useCallback(function (event) {
149
- if (document.activeElement === elementRef.current) {
149
+ var activeElement = (0, kendo_react_common_1.getActiveElement)(document);
150
+ if (activeElement === elementRef.current) {
150
151
  event.preventDefault();
151
152
  }
152
- }, [elementRef, document.activeElement]);
153
+ }, [elementRef]);
153
154
  var handleKeyDown = React.useCallback(function (event) {
154
155
  var currIndex = focusedIndex;
155
156
  var maxNavIndex = items ? items.length - 1 : -1;
@@ -84,7 +84,6 @@ var DropDownButton = /** @class */ (function (_super) {
84
84
  _this.setState({ focusedIndex: 0, opened: true });
85
85
  }
86
86
  else if (_this.opened && event.keyCode === kendo_react_common_1.Keys.up) {
87
- _this.dispatchPopupEvent(event, false);
88
87
  _this.setState({ focusedIndex: -1, opened: false });
89
88
  }
90
89
  return;
@@ -99,12 +98,13 @@ var DropDownButton = /** @class */ (function (_super) {
99
98
  event.preventDefault();
100
99
  newState.focusedIndex = _this.opened ? -1 : 0,
101
100
  newState.opened = !_this.opened;
102
- _this.dispatchPopupEvent(event, newState.opened);
101
+ if (newState.opened) {
102
+ _this.dispatchPopupEvent(event, newState.opened);
103
+ }
103
104
  }
104
105
  else if (_this.opened && event.keyCode === kendo_react_common_1.Keys.esc) {
105
106
  newState.focusedIndex = -1;
106
107
  newState.opened = false;
107
- _this.dispatchPopupEvent(event, newState.opened);
108
108
  }
109
109
  if (_this.opened) {
110
110
  var newFocused = (0, navigation_1.navigate)(focusedIndex, event.keyCode, event.altKey, _this.buttonsData.length);
@@ -136,24 +136,21 @@ var DropDownButton = /** @class */ (function (_super) {
136
136
  }
137
137
  _this.setState({ focused: false, opened: false, focusedIndex: -1 });
138
138
  (0, kendo_react_common_2.dispatchEvent)(_this.props.onBlur, event, _this, undefined);
139
- var fireCloseEvent = _this.opened;
140
- if (fireCloseEvent) {
141
- _this.dispatchPopupEvent(event, false);
142
- }
143
139
  };
144
140
  _this.onItemClick = function (event, clickedItemIndex) {
145
141
  _this.setState({ focusedIndex: -1, opened: false });
146
142
  _this.dispatchClickEvent(event, clickedItemIndex);
147
- _this.dispatchPopupEvent(event, false);
148
143
  };
149
144
  _this.onItemDown = function (event) {
150
- if (document.activeElement === _this.list) {
145
+ var activeElement = (0, kendo_react_common_1.getActiveElement)(document);
146
+ if (activeElement === _this.list) {
151
147
  event.preventDefault();
152
148
  }
153
149
  };
154
150
  _this.mouseDown = function (event) {
155
151
  event.preventDefault();
156
- if (_this.element && document.activeElement !== _this.element && document.activeElement !== _this.list) {
152
+ var activeElement = (0, kendo_react_common_1.getActiveElement)(document);
153
+ if (_this.element && activeElement !== _this.element && activeElement !== _this.list) {
157
154
  _this.element.focus();
158
155
  }
159
156
  };
@@ -166,6 +163,7 @@ var DropDownButton = /** @class */ (function (_super) {
166
163
  }
167
164
  });
168
165
  }
166
+ _this.dispatchPopupEvent({}, false);
169
167
  };
170
168
  _this.listRef = function (list) {
171
169
  _this.list = list;
@@ -188,7 +186,9 @@ var DropDownButton = /** @class */ (function (_super) {
188
186
  focused: true,
189
187
  focusedIndex: toOpen ? 0 : -1
190
188
  });
191
- _this.dispatchPopupEvent(event, toOpen);
189
+ if (toOpen) {
190
+ _this.dispatchPopupEvent(event, toOpen);
191
+ }
192
192
  };
193
193
  _this.dispatchPopupEvent = function (dispatchedEvent, open) {
194
194
  (0, kendo_react_common_2.dispatchEvent)(open ? _this.props.onOpen : _this.props.onClose, dispatchedEvent, _this, undefined);
@@ -74,7 +74,6 @@ var SplitButton = /** @class */ (function (_super) {
74
74
  _this.setState({ focusedIndex: 0, opened: true });
75
75
  }
76
76
  else if (_this.opened && event.keyCode === kendo_react_common_1.Keys.up) {
77
- _this.dispatchPopupEvent(event, false);
78
77
  _this.setState({ focusedIndex: -1, opened: false });
79
78
  }
80
79
  return;
@@ -90,7 +89,9 @@ var SplitButton = /** @class */ (function (_super) {
90
89
  focusedIndex: _this.opened ? -1 : 0,
91
90
  opened: !_this.opened
92
91
  };
93
- _this.dispatchPopupEvent(event, newState.opened);
92
+ if (newState.opened) {
93
+ _this.dispatchPopupEvent(event, newState.opened);
94
+ }
94
95
  }
95
96
  }
96
97
  else if (_this.opened && event.keyCode === kendo_react_common_1.Keys.esc) {
@@ -98,7 +99,6 @@ var SplitButton = /** @class */ (function (_super) {
98
99
  focusedIndex: -1,
99
100
  opened: false
100
101
  };
101
- _this.dispatchPopupEvent(event, newState.opened);
102
102
  }
103
103
  if (_this.opened) {
104
104
  var newFocused = (0, navigation_1.navigate)(focusedIndex, event.keyCode, event.altKey, _this.buttonsData.length);
@@ -135,9 +135,6 @@ var SplitButton = /** @class */ (function (_super) {
135
135
  _this.setState({ focusedIndex: 0, opened: false });
136
136
  }
137
137
  _this.dispatchClickEvent(event, clickedItemIndex);
138
- if (opened) {
139
- _this.dispatchPopupEvent(event, false);
140
- }
141
138
  };
142
139
  _this.onBlur = function (event) {
143
140
  if (_this.skipFocus) {
@@ -149,9 +146,6 @@ var SplitButton = /** @class */ (function (_super) {
149
146
  opened: false
150
147
  });
151
148
  (0, kendo_react_common_2.dispatchEvent)(_this.props.onBlur, event, _this, undefined);
152
- if (_this.opened) {
153
- _this.dispatchPopupEvent(event, false);
154
- }
155
149
  };
156
150
  _this.onPopupClose = function () {
157
151
  if (_this.state.focused) {
@@ -162,6 +156,7 @@ var SplitButton = /** @class */ (function (_super) {
162
156
  }
163
157
  });
164
158
  }
159
+ _this.dispatchPopupEvent({}, false);
165
160
  };
166
161
  _this.listRef = function (list) {
167
162
  _this.list = list;
@@ -177,7 +172,9 @@ var SplitButton = /** @class */ (function (_super) {
177
172
  _this.onSplitPartClick = function (event) {
178
173
  if (_this.buttonsData.length) {
179
174
  var toOpen = !_this.opened;
180
- _this.dispatchPopupEvent(event, toOpen);
175
+ if (toOpen) {
176
+ _this.dispatchPopupEvent(event, toOpen);
177
+ }
181
178
  _this.setState({
182
179
  focusedIndex: toOpen ? 0 : -1,
183
180
  opened: toOpen,
@@ -187,12 +184,14 @@ var SplitButton = /** @class */ (function (_super) {
187
184
  };
188
185
  _this.onDownSplitPart = function (event) {
189
186
  event.preventDefault();
190
- if (_this.element && document.activeElement !== _this.element && document.activeElement !== _this.list) {
187
+ var activeElement = (0, kendo_react_common_1.getActiveElement)(document);
188
+ if (_this.element && activeElement !== _this.element && activeElement !== _this.list) {
191
189
  _this.element.focus();
192
190
  }
193
191
  };
194
192
  _this.onItemDown = function (event) {
195
- if (document.activeElement === _this.list) {
193
+ var activeElement = (0, kendo_react_common_1.getActiveElement)(document);
194
+ if (activeElement === _this.list) {
196
195
  event.preventDefault();
197
196
  }
198
197
  };
@@ -8,7 +8,7 @@ exports.packageMetadata = {
8
8
  name: '@progress/kendo-react-buttons',
9
9
  productName: 'KendoReact',
10
10
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
11
- publishDate: 1685627126,
11
+ publishDate: 1685661811,
12
12
  version: '',
13
13
  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'
14
14
  };