downshift 6.1.2-alpha.0 → 6.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "downshift",
3
- "version": "6.1.2-alpha.0",
3
+ "version": "6.1.2",
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",
@@ -67,8 +67,8 @@ function scrollIntoView(node, menuNode) {
67
67
  */
68
68
 
69
69
 
70
- function isOrContainsNode(parent, child, environment) {
71
- return parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
70
+ function isOrContainsNode(parent, child) {
71
+ return parent === child || child instanceof Node && parent.contains && parent.contains(child);
72
72
  }
73
73
  /**
74
74
  * Simple debounce implementation. Will call the given
@@ -422,20 +422,20 @@ function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFr
422
422
  *
423
423
  * @param {EventTarget} target Target to check.
424
424
  * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
425
- * @param {Environment} environment The environment.
425
+ * @param {Document} document The document.
426
426
  * @param {boolean} checkActiveElement Whether to also check activeElement.
427
427
  *
428
428
  * @returns {boolean} Whether or not the target is within downshift elements.
429
429
  */
430
430
 
431
431
 
432
- function targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {
432
+ function targetWithinDownshift(target, downshiftElements, document, checkActiveElement) {
433
433
  if (checkActiveElement === void 0) {
434
434
  checkActiveElement = true;
435
435
  }
436
436
 
437
437
  return downshiftElements.some(function (contextNode) {
438
- return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment));
438
+ return contextNode && (isOrContainsNode(contextNode, target) || checkActiveElement && isOrContainsNode(contextNode, document.activeElement));
439
439
  });
440
440
  } // eslint-disable-next-line import/no-mutable-exports
441
441
 
@@ -1976,7 +1976,7 @@ function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, hand
1976
1976
 
1977
1977
  if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
1978
1978
  return ref.current;
1979
- }), environment)) {
1979
+ }), environment.document)) {
1980
1980
  handleBlur();
1981
1981
  }
1982
1982
  };
@@ -54,8 +54,8 @@ function scrollIntoView(node, menuNode) {
54
54
  */
55
55
 
56
56
 
57
- function isOrContainsNode(parent, child, environment) {
58
- return parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
57
+ function isOrContainsNode(parent, child) {
58
+ return parent === child || child instanceof Node && parent.contains && parent.contains(child);
59
59
  }
60
60
  /**
61
61
  * Simple debounce implementation. Will call the given
@@ -409,20 +409,20 @@ function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFr
409
409
  *
410
410
  * @param {EventTarget} target Target to check.
411
411
  * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
412
- * @param {Environment} environment The environment.
412
+ * @param {Document} document The document.
413
413
  * @param {boolean} checkActiveElement Whether to also check activeElement.
414
414
  *
415
415
  * @returns {boolean} Whether or not the target is within downshift elements.
416
416
  */
417
417
 
418
418
 
419
- function targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {
419
+ function targetWithinDownshift(target, downshiftElements, document, checkActiveElement) {
420
420
  if (checkActiveElement === void 0) {
421
421
  checkActiveElement = true;
422
422
  }
423
423
 
424
424
  return downshiftElements.some(function (contextNode) {
425
- return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment));
425
+ return contextNode && (isOrContainsNode(contextNode, target) || checkActiveElement && isOrContainsNode(contextNode, document.activeElement));
426
426
  });
427
427
  } // eslint-disable-next-line import/no-mutable-exports
428
428
 
@@ -1963,7 +1963,7 @@ function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, hand
1963
1963
 
1964
1964
  if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
1965
1965
  return ref.current;
1966
- }), environment)) {
1966
+ }), environment.document)) {
1967
1967
  handleBlur();
1968
1968
  }
1969
1969
  };
@@ -474,8 +474,8 @@
474
474
  */
475
475
 
476
476
 
477
- function isOrContainsNode(parent, child, environment) {
478
- return parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
477
+ function isOrContainsNode(parent, child) {
478
+ return parent === child || child instanceof Node && parent.contains && parent.contains(child);
479
479
  }
480
480
  /**
481
481
  * Simple debounce implementation. Will call the given
@@ -829,20 +829,20 @@
829
829
  *
830
830
  * @param {EventTarget} target Target to check.
831
831
  * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
832
- * @param {Environment} environment The environment.
832
+ * @param {Document} document The document.
833
833
  * @param {boolean} checkActiveElement Whether to also check activeElement.
834
834
  *
835
835
  * @returns {boolean} Whether or not the target is within downshift elements.
836
836
  */
837
837
 
838
838
 
839
- function targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {
839
+ function targetWithinDownshift(target, downshiftElements, document, checkActiveElement) {
840
840
  if (checkActiveElement === void 0) {
841
841
  checkActiveElement = true;
842
842
  }
843
843
 
844
844
  return downshiftElements.some(function (contextNode) {
845
- return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment));
845
+ return contextNode && (isOrContainsNode(contextNode, target) || checkActiveElement && isOrContainsNode(contextNode, document.activeElement));
846
846
  });
847
847
  } // eslint-disable-next-line import/no-mutable-exports
848
848
 
@@ -2373,7 +2373,7 @@
2373
2373
 
2374
2374
  if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
2375
2375
  return ref.current;
2376
- }), environment)) {
2376
+ }), environment.document)) {
2377
2377
  handleBlur();
2378
2378
  }
2379
2379
  };