downshift 7.6.0 → 7.6.1

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.
@@ -10,6 +10,6 @@ export default class App extends React.Component<Props, State> {
10
10
  state: State;
11
11
  onChange: (selectedItem: Item | null) => void;
12
12
  onUserAction: (changes: StateChangeOptions<Item>) => void;
13
- render(): JSX.Element;
13
+ render(): React.JSX.Element;
14
14
  }
15
15
  export {};
@@ -8,6 +8,6 @@ interface State {
8
8
  export default class App extends React.Component<Props, State> {
9
9
  state: State;
10
10
  onChange: (selectedItem: Item) => void;
11
- render(): JSX.Element;
11
+ render(): React.JSX.Element;
12
12
  }
13
13
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "downshift",
3
- "version": "7.6.0",
3
+ "version": "7.6.1",
4
4
  "description": "🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.",
5
5
  "main": "dist/downshift.cjs.js",
6
6
  "react-native": "dist/downshift.native.cjs.js",
@@ -76,6 +76,8 @@
76
76
  },
77
77
  "devDependencies": {
78
78
  "@babel/helpers": "^7.14.8",
79
+ "@babel/plugin-proposal-private-methods": "^7.18.6",
80
+ "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
79
81
  "@cypress/webpack-preprocessor": "^5.14.0",
80
82
  "@docusaurus/core": "^2.0.1",
81
83
  "@docusaurus/module-type-aliases": "^2.0.1",
@@ -3031,7 +3031,7 @@ function useCombobox(userProps) {
3031
3031
  itemRefs.current = {};
3032
3032
  } else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
3033
3033
  var _inputRef$current;
3034
- inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3034
+ inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3035
3035
  }
3036
3036
  }, [isOpen, environment]);
3037
3037
 
@@ -3248,9 +3248,10 @@ function useCombobox(userProps) {
3248
3248
  var inputHandleBlur = function inputHandleBlur(event) {
3249
3249
  /* istanbul ignore else */
3250
3250
  if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
3251
+ var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
3251
3252
  dispatch({
3252
3253
  type: InputBlur,
3253
- selectItem: event.relatedTarget !== null
3254
+ selectItem: !isBlurByTabChange
3254
3255
  });
3255
3256
  }
3256
3257
  };
@@ -3018,7 +3018,7 @@ function useCombobox(userProps) {
3018
3018
  itemRefs.current = {};
3019
3019
  } else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
3020
3020
  var _inputRef$current;
3021
- inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3021
+ inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3022
3022
  }
3023
3023
  }, [isOpen, environment]);
3024
3024
 
@@ -3235,9 +3235,10 @@ function useCombobox(userProps) {
3235
3235
  var inputHandleBlur = function inputHandleBlur(event) {
3236
3236
  /* istanbul ignore else */
3237
3237
  if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
3238
+ var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
3238
3239
  dispatch({
3239
3240
  type: InputBlur,
3240
- selectItem: event.relatedTarget !== null
3241
+ selectItem: !isBlurByTabChange
3241
3242
  });
3242
3243
  }
3243
3244
  };
@@ -2261,30 +2261,35 @@
2261
2261
  }
2262
2262
  /* eslint-enable complexity */
2263
2263
 
2264
- /******************************************************************************
2265
- Copyright (c) Microsoft Corporation.
2266
-
2267
- Permission to use, copy, modify, and/or distribute this software for any
2268
- purpose with or without fee is hereby granted.
2269
-
2270
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2271
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2272
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2273
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2274
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2275
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2276
- PERFORMANCE OF THIS SOFTWARE.
2277
- ***************************************************************************** */
2278
-
2279
- var __assign = function() {
2280
- __assign = Object.assign || function __assign(t) {
2281
- for (var s, i = 1, n = arguments.length; i < n; i++) {
2282
- s = arguments[i];
2283
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
2284
- }
2285
- return t;
2286
- };
2287
- return __assign.apply(this, arguments);
2264
+ /******************************************************************************
2265
+ Copyright (c) Microsoft Corporation.
2266
+
2267
+ Permission to use, copy, modify, and/or distribute this software for any
2268
+ purpose with or without fee is hereby granted.
2269
+
2270
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2271
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2272
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2273
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2274
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2275
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2276
+ PERFORMANCE OF THIS SOFTWARE.
2277
+ ***************************************************************************** */
2278
+
2279
+ var __assign = function() {
2280
+ __assign = Object.assign || function __assign(t) {
2281
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
2282
+ s = arguments[i];
2283
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
2284
+ }
2285
+ return t;
2286
+ };
2287
+ return __assign.apply(this, arguments);
2288
+ };
2289
+
2290
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2291
+ var e = new Error(message);
2292
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2288
2293
  };
2289
2294
 
2290
2295
  function getItemIndexByCharacterKey(_a) {
@@ -3327,7 +3332,7 @@
3327
3332
  itemRefs.current = {};
3328
3333
  } else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
3329
3334
  var _inputRef$current;
3330
- inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3335
+ inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3331
3336
  }
3332
3337
  }, [isOpen, environment]);
3333
3338
 
@@ -3544,9 +3549,10 @@
3544
3549
  var inputHandleBlur = function inputHandleBlur(event) {
3545
3550
  /* istanbul ignore else */
3546
3551
  if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
3552
+ var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
3547
3553
  dispatch({
3548
3554
  type: InputBlur,
3549
- selectItem: event.relatedTarget !== null
3555
+ selectItem: !isBlurByTabChange
3550
3556
  });
3551
3557
  }
3552
3558
  };