Socket
Socket
Sign inDemoInstall

@chakra-ui/hooks

Package Overview
Dependencies
Maintainers
4
Versions
408
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.5.5 to 1.6.0

12

CHANGELOG.md
# Change Log
## 1.6.0
### Minor Changes
- [`28af4c030`](https://github.com/chakra-ui/chakra-ui/commit/28af4c0308e234871548c0857e946e33ff18a130)
[#4595](https://github.com/chakra-ui/chakra-ui/pull/4595) Thanks
[@margalit](https://github.com/margalit)! - - Added an enabled prop to the
`useOutsideClick` hook to conditionally attach event handlers.
- Updated the `useMenu` hook to only enable the `useOutsideClick` hook when
the menu is open.
## 1.5.5

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

8

dist/cjs/use-outside-click.js

@@ -18,3 +18,5 @@ "use strict";

var ref = props.ref,
handler = props.handler;
handler = props.handler,
_props$enabled = props.enabled,
enabled = _props$enabled === void 0 ? true : _props$enabled;
var savedHandler = (0, _useCallbackRef.useCallbackRef)(handler);

@@ -27,2 +29,4 @@ var stateRef = (0, _react.useRef)({

(0, _react.useEffect)(function () {
if (!enabled) return;
var onPointerDown = function onPointerDown(e) {

@@ -66,3 +70,3 @@ if (isValidEvent(e, ref)) {

};
}, [handler, ref, savedHandler, state]);
}, [handler, ref, savedHandler, state, enabled]);
}

@@ -69,0 +73,0 @@

@@ -12,3 +12,4 @@ import { getOwnerDocument } from "@chakra-ui/utils";

ref,
handler
handler,
enabled = true
} = props;

@@ -22,2 +23,4 @@ var savedHandler = useCallbackRef(handler);

useEffect(() => {
if (!enabled) return;
var onPointerDown = e => {

@@ -61,3 +64,3 @@ if (isValidEvent(e, ref)) {

};
}, [handler, ref, savedHandler, state]);
}, [handler, ref, savedHandler, state, enabled]);
}

@@ -64,0 +67,0 @@

import { RefObject } from "react";
export interface UseOutsideClickProps {
/**
* Whether the hook is enabled
*/
enabled?: boolean;
/**
* The reference to a DOM element.

@@ -5,0 +9,0 @@ */

{
"name": "@chakra-ui/hooks",
"version": "1.5.5",
"version": "1.6.0",
"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

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