downshift 8.0.0-alpha.0 → 8.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # CHANGELOG
2
+
3
+ The changelog is automatically updated using
4
+ [semantic-release](https://github.com/semantic-release/semantic-release). You
5
+ can see it on the [releases page](../../releases).
@@ -3076,7 +3076,7 @@ function useCombobox(userProps) {
3076
3076
  itemRefs.current = {};
3077
3077
  } else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
3078
3078
  var _inputRef$current;
3079
- inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3079
+ inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3080
3080
  }
3081
3081
  }, [isOpen, environment]);
3082
3082
 
@@ -3291,9 +3291,10 @@ function useCombobox(userProps) {
3291
3291
  var inputHandleBlur = function inputHandleBlur(event) {
3292
3292
  /* istanbul ignore else */
3293
3293
  if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
3294
+ var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
3294
3295
  dispatch({
3295
3296
  type: InputBlur,
3296
- selectItem: event.relatedTarget !== null
3297
+ selectItem: !isBlurByTabChange
3297
3298
  });
3298
3299
  }
3299
3300
  };
@@ -3313,7 +3314,7 @@ function useCombobox(userProps) {
3313
3314
  return _extends__default["default"]((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {
3314
3315
  inputRef.current = inputNode;
3315
3316
  }), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);
3316
- }, [dispatch, inputKeyDownHandlers, latest, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds]);
3317
+ }, [setGetterPropCallInfo, latest, elementIds, inputKeyDownHandlers, dispatch, mouseAndTouchTrackersRef, environment]);
3317
3318
 
3318
3319
  // returns
3319
3320
  var toggleMenu = React.useCallback(function () {
@@ -3062,7 +3062,7 @@ function useCombobox(userProps) {
3062
3062
  itemRefs.current = {};
3063
3063
  } else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
3064
3064
  var _inputRef$current;
3065
- inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3065
+ inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3066
3066
  }
3067
3067
  }, [isOpen, environment]);
3068
3068
 
@@ -3277,9 +3277,10 @@ function useCombobox(userProps) {
3277
3277
  var inputHandleBlur = function inputHandleBlur(event) {
3278
3278
  /* istanbul ignore else */
3279
3279
  if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
3280
+ var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
3280
3281
  dispatch({
3281
3282
  type: InputBlur,
3282
- selectItem: event.relatedTarget !== null
3283
+ selectItem: !isBlurByTabChange
3283
3284
  });
3284
3285
  }
3285
3286
  };
@@ -3299,7 +3300,7 @@ function useCombobox(userProps) {
3299
3300
  return _extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {
3300
3301
  inputRef.current = inputNode;
3301
3302
  }), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);
3302
- }, [dispatch, inputKeyDownHandlers, latest, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds]);
3303
+ }, [setGetterPropCallInfo, latest, elementIds, inputKeyDownHandlers, dispatch, mouseAndTouchTrackersRef, environment]);
3303
3304
 
3304
3305
  // returns
3305
3306
  var toggleMenu = useCallback(function () {
@@ -2999,7 +2999,7 @@ function useCombobox(userProps) {
2999
2999
  itemRefs.current = {};
3000
3000
  } else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
3001
3001
  var _inputRef$current;
3002
- inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3002
+ inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3003
3003
  }
3004
3004
  }, [isOpen, environment]);
3005
3005
 
@@ -3214,9 +3214,10 @@ function useCombobox(userProps) {
3214
3214
  var inputHandleBlur = function inputHandleBlur(event) {
3215
3215
  /* istanbul ignore else */
3216
3216
  if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
3217
+ var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
3217
3218
  dispatch({
3218
3219
  type: InputBlur,
3219
- selectItem: event.relatedTarget !== null
3220
+ selectItem: !isBlurByTabChange
3220
3221
  });
3221
3222
  }
3222
3223
  };
@@ -3248,7 +3249,7 @@ function useCombobox(userProps) {
3248
3249
  return _extends__default["default"]((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {
3249
3250
  inputRef.current = inputNode;
3250
3251
  }), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);
3251
- }, [dispatch, inputKeyDownHandlers, latest, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds]);
3252
+ }, [setGetterPropCallInfo, latest, elementIds, inputKeyDownHandlers, dispatch, mouseAndTouchTrackersRef, environment]);
3252
3253
 
3253
3254
  // returns
3254
3255
  var toggleMenu = React.useCallback(function () {
@@ -3059,7 +3059,7 @@ function useCombobox(userProps) {
3059
3059
  itemRefs.current = {};
3060
3060
  } else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
3061
3061
  var _inputRef$current;
3062
- inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3062
+ inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
3063
3063
  }
3064
3064
  }, [isOpen, environment]);
3065
3065
 
@@ -3189,7 +3189,7 @@ function useCombobox(userProps) {
3189
3189
  item = _getItemAndIndex[0],
3190
3190
  index = _getItemAndIndex[1];
3191
3191
  var disabled = latestProps.isItemDisabled(item, index);
3192
- var onSelectKey = 'onClick';
3192
+ var onSelectKey = /* istanbul ignore next (react-native) */'onPress' ;
3193
3193
  var customClickHandler = onClick;
3194
3194
  var itemHandleMouseMove = function itemHandleMouseMove() {
3195
3195
  if (index === latestState.highlightedIndex) {
@@ -3274,9 +3274,10 @@ function useCombobox(userProps) {
3274
3274
  var inputHandleBlur = function inputHandleBlur(event) {
3275
3275
  /* istanbul ignore else */
3276
3276
  if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
3277
+ var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
3277
3278
  dispatch({
3278
3279
  type: InputBlur,
3279
- selectItem: event.relatedTarget !== null
3280
+ selectItem: !isBlurByTabChange
3280
3281
  });
3281
3282
  }
3282
3283
  };
@@ -3296,7 +3297,7 @@ function useCombobox(userProps) {
3296
3297
  return _extends__default["default"]((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {
3297
3298
  inputRef.current = inputNode;
3298
3299
  }), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);
3299
- }, [dispatch, inputKeyDownHandlers, latest, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds]);
3300
+ }, [setGetterPropCallInfo, latest, elementIds, inputKeyDownHandlers, dispatch, mouseAndTouchTrackersRef, environment]);
3300
3301
 
3301
3302
  // returns
3302
3303
  var toggleMenu = React.useCallback(function () {
@@ -3392,30 +3392,35 @@
3392
3392
  }
3393
3393
  /* eslint-enable complexity */
3394
3394
 
3395
- /******************************************************************************
3396
- Copyright (c) Microsoft Corporation.
3397
-
3398
- Permission to use, copy, modify, and/or distribute this software for any
3399
- purpose with or without fee is hereby granted.
3400
-
3401
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3402
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3403
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3404
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3405
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3406
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3407
- PERFORMANCE OF THIS SOFTWARE.
3408
- ***************************************************************************** */
3409
-
3410
- var __assign = function() {
3411
- __assign = Object.assign || function __assign(t) {
3412
- for (var s, i = 1, n = arguments.length; i < n; i++) {
3413
- s = arguments[i];
3414
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
3415
- }
3416
- return t;
3417
- };
3418
- return __assign.apply(this, arguments);
3395
+ /******************************************************************************
3396
+ Copyright (c) Microsoft Corporation.
3397
+
3398
+ Permission to use, copy, modify, and/or distribute this software for any
3399
+ purpose with or without fee is hereby granted.
3400
+
3401
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3402
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3403
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3404
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3405
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3406
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3407
+ PERFORMANCE OF THIS SOFTWARE.
3408
+ ***************************************************************************** */
3409
+
3410
+ var __assign = function() {
3411
+ __assign = Object.assign || function __assign(t) {
3412
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
3413
+ s = arguments[i];
3414
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
3415
+ }
3416
+ return t;
3417
+ };
3418
+ return __assign.apply(this, arguments);
3419
+ };
3420
+
3421
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
3422
+ var e = new Error(message);
3423
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3419
3424
  };
3420
3425
 
3421
3426
  function getItemIndexByCharacterKey(_a) {
@@ -4391,7 +4396,7 @@
4391
4396
  itemRefs.current = {};
4392
4397
  } else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
4393
4398
  var _inputRef$current;
4394
- inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
4399
+ inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
4395
4400
  }
4396
4401
  }, [isOpen, environment]);
4397
4402
 
@@ -4606,9 +4611,10 @@
4606
4611
  var inputHandleBlur = function inputHandleBlur(event) {
4607
4612
  /* istanbul ignore else */
4608
4613
  if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
4614
+ var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
4609
4615
  dispatch({
4610
4616
  type: InputBlur,
4611
- selectItem: event.relatedTarget !== null
4617
+ selectItem: !isBlurByTabChange
4612
4618
  });
4613
4619
  }
4614
4620
  };
@@ -4628,7 +4634,7 @@
4628
4634
  return _extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {
4629
4635
  inputRef.current = inputNode;
4630
4636
  }), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);
4631
- }, [dispatch, inputKeyDownHandlers, latest, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds]);
4637
+ }, [setGetterPropCallInfo, latest, elementIds, inputKeyDownHandlers, dispatch, mouseAndTouchTrackersRef, environment]);
4632
4638
 
4633
4639
  // returns
4634
4640
  var toggleMenu = React.useCallback(function () {