Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@chakra-ui/hooks

Package Overview
Dependencies
Maintainers
4
Versions
418
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chakra-ui/hooks - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

12

CHANGELOG.md
# Change Log
## 1.1.3
### Patch Changes
- [`b572bceed`](https://github.com/chakra-ui/chakra-ui/commit/b572bceedd9fb0c41c65118f0d9ba672791932ca)
Thanks [@segunadebayo](https://github.com/segunadebayo)! -
**useOutsideClick:**
- Update reference to `document.addEventListener` to detect owner document
based on `ref` passed. This would help detect outside click currently from
within an `iframe`.
## 1.1.2

@@ -4,0 +16,0 @@

30

dist/cjs/use-outside-click.js

@@ -6,2 +6,4 @@ "use strict";

var _utils = require("@chakra-ui/utils");
var _react = require("react");

@@ -52,11 +54,12 @@

document.addEventListener("mousedown", onPointerDown, true);
document.addEventListener("mouseup", onMouseUp, true);
document.addEventListener("touchstart", onPointerDown, true);
document.addEventListener("touchend", onTouchEnd, true);
var doc = (0, _utils.getOwnerDocument)(ref.current);
doc.addEventListener("mousedown", onPointerDown, true);
doc.addEventListener("mouseup", onMouseUp, true);
doc.addEventListener("touchstart", onPointerDown, true);
doc.addEventListener("touchend", onTouchEnd, true);
return function () {
document.removeEventListener("mousedown", onPointerDown, true);
document.removeEventListener("mouseup", onMouseUp, true);
document.removeEventListener("touchstart", onPointerDown, true);
document.removeEventListener("touchend", onTouchEnd, true);
doc.removeEventListener("mousedown", onPointerDown, true);
doc.removeEventListener("mouseup", onMouseUp, true);
doc.removeEventListener("touchstart", onPointerDown, true);
doc.removeEventListener("touchend", onTouchEnd, true);
};

@@ -67,2 +70,4 @@ }, [handler, ref, savedHandler, state]);

function isValidEvent(event, ref) {
var _ref$current;
var target = event.target;

@@ -72,11 +77,8 @@ if (event.button > 0) return false; // if the event target is no longer in the document

if (target) {
var ownerDocument = target.ownerDocument;
if (!ownerDocument || !ownerDocument.body.contains(target)) {
return false;
}
var doc = (0, _utils.getOwnerDocument)(target);
if (!doc.body.contains(target)) return false;
}
return ref.current && !ref.current.contains(target);
return !((_ref$current = ref.current) != null && _ref$current.contains(target));
}
//# sourceMappingURL=use-outside-click.js.map

@@ -0,1 +1,2 @@

import { getOwnerDocument } from "@chakra-ui/utils";
import { useEffect, useRef } from "react";

@@ -47,11 +48,12 @@ import { useCallbackRef } from "./use-callback-ref";

document.addEventListener("mousedown", onPointerDown, true);
document.addEventListener("mouseup", onMouseUp, true);
document.addEventListener("touchstart", onPointerDown, true);
document.addEventListener("touchend", onTouchEnd, true);
var doc = getOwnerDocument(ref.current);
doc.addEventListener("mousedown", onPointerDown, true);
doc.addEventListener("mouseup", onMouseUp, true);
doc.addEventListener("touchstart", onPointerDown, true);
doc.addEventListener("touchend", onTouchEnd, true);
return () => {
document.removeEventListener("mousedown", onPointerDown, true);
document.removeEventListener("mouseup", onMouseUp, true);
document.removeEventListener("touchstart", onPointerDown, true);
document.removeEventListener("touchend", onTouchEnd, true);
doc.removeEventListener("mousedown", onPointerDown, true);
doc.removeEventListener("mouseup", onMouseUp, true);
doc.removeEventListener("touchstart", onPointerDown, true);
doc.removeEventListener("touchend", onTouchEnd, true);
};

@@ -62,2 +64,4 @@ }, [handler, ref, savedHandler, state]);

function isValidEvent(event, ref) {
var _ref$current;
var target = event.target;

@@ -67,11 +71,8 @@ if (event.button > 0) return false; // if the event target is no longer in the document

if (target) {
var ownerDocument = target.ownerDocument;
if (!ownerDocument || !ownerDocument.body.contains(target)) {
return false;
}
var doc = getOwnerDocument(target);
if (!doc.body.contains(target)) return false;
}
return ref.current && !ref.current.contains(target);
return !((_ref$current = ref.current) != null && _ref$current.contains(target));
}
//# sourceMappingURL=use-outside-click.js.map
{
"name": "@chakra-ui/hooks",
"version": "1.1.2",
"version": "1.1.3",
"description": "React hooks for Chakra components",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc