@bigbinary/neeto-commons-frontend 2.1.13 → 2.1.14
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 +1 -1
- package/react-utils.cjs.js +8 -3
- package/react-utils.cjs.js.map +1 -1
- package/react-utils.d.ts +3 -1
- package/react-utils.js +8 -3
- package/react-utils.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-commons-frontend",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.14",
|
|
4
4
|
"description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
package/react-utils.cjs.js
CHANGED
|
@@ -3619,6 +3619,9 @@ var useMutationWithInvalidation = function useMutationWithInvalidation(mutationF
|
|
|
3619
3619
|
};
|
|
3620
3620
|
|
|
3621
3621
|
var useOnClickOutside = function useOnClickOutside(ref, handler) {
|
|
3622
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
3623
|
+
_ref$enabled = _ref.enabled,
|
|
3624
|
+
enabled = _ref$enabled === void 0 ? true : _ref$enabled;
|
|
3622
3625
|
React.useEffect(function () {
|
|
3623
3626
|
var listener = function listener(event) {
|
|
3624
3627
|
// Do nothing if clicking ref's element or descendent elements
|
|
@@ -3627,13 +3630,15 @@ var useOnClickOutside = function useOnClickOutside(ref, handler) {
|
|
|
3627
3630
|
}
|
|
3628
3631
|
handler(event);
|
|
3629
3632
|
};
|
|
3630
|
-
|
|
3631
|
-
|
|
3633
|
+
if (enabled) {
|
|
3634
|
+
document.addEventListener("mousedown", listener);
|
|
3635
|
+
document.addEventListener("touchstart", listener);
|
|
3636
|
+
}
|
|
3632
3637
|
return function () {
|
|
3633
3638
|
document.removeEventListener("mousedown", listener);
|
|
3634
3639
|
document.removeEventListener("touchstart", listener);
|
|
3635
3640
|
};
|
|
3636
|
-
}, [handler]);
|
|
3641
|
+
}, [handler, enabled]);
|
|
3637
3642
|
};
|
|
3638
3643
|
|
|
3639
3644
|
var usePrevious = function usePrevious(value) {
|