@7shifts/sous-chef 2.8.0 → 2.8.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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This helper method helps to check if the user is scrolling inside the select options so,
3
+ * it does not close the menu when using the prop menuShouldScrollIntoView
4
+ **/
5
+ export declare const isScrollingTheSelectMenu: (element: HTMLElement) => boolean;
package/dist/index.js CHANGED
@@ -4959,6 +4959,28 @@ function CustomOption(_ref) {
4959
4959
  return React__default.createElement(Select.components.Option, Object.assign({}, props), React__default.createElement(CustomComponent, Object.assign({}, props), children));
4960
4960
  }
4961
4961
 
4962
+ var isScrollingTheSelectMenu = function isScrollingTheSelectMenu(element) {
4963
+ if (!isReactSelectElement(element)) {
4964
+ var _element$children;
4965
+
4966
+ return isReactSelectElement(element === null || element === void 0 ? void 0 : (_element$children = element.children) === null || _element$children === void 0 ? void 0 : _element$children[0]);
4967
+ }
4968
+
4969
+ return true;
4970
+ };
4971
+
4972
+ var isReactSelectElement = function isReactSelectElement(element) {
4973
+ var _element$children2;
4974
+
4975
+ var firstOption = element === null || element === void 0 ? void 0 : (_element$children2 = element.children) === null || _element$children2 === void 0 ? void 0 : _element$children2[0];
4976
+
4977
+ if (!firstOption) {
4978
+ return false;
4979
+ }
4980
+
4981
+ return typeof firstOption.id === 'string' && firstOption.id.includes('react-select');
4982
+ };
4983
+
4962
4984
  var MultiSelectField = function MultiSelectField(_ref) {
4963
4985
  var name = _ref.name,
4964
4986
  inputId = _ref.id,
@@ -5027,10 +5049,7 @@ var MultiSelectField = function MultiSelectField(_ref) {
5027
5049
  return false;
5028
5050
  }
5029
5051
 
5030
- var target = e.target;
5031
- var firstOption = target.children[0];
5032
- var isScrollingTheMenu = firstOption && typeof firstOption.id === 'string' && firstOption.id.includes('react-select');
5033
- return !isScrollingTheMenu;
5052
+ return !isScrollingTheSelectMenu(e.target);
5034
5053
  }
5035
5054
  }));
5036
5055
  };
@@ -5120,10 +5139,7 @@ var SelectField = function SelectField(_ref) {
5120
5139
  return false;
5121
5140
  }
5122
5141
 
5123
- var target = e.target;
5124
- var firstOption = target.children[0];
5125
- var isScrollingTheMenu = firstOption && typeof firstOption.id === 'string' && firstOption.id.includes('react-select');
5126
- return !isScrollingTheMenu;
5142
+ return !isScrollingTheSelectMenu(e.target);
5127
5143
  },
5128
5144
  components: {
5129
5145
  Option: UserCustomOption ? function (props) {