Socket
Socket
Sign inDemoInstall

react-onclickoutside

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-onclickoutside - npm Package Compare versions

Comparing version 5.9.0 to 5.10.0

10

index.js

@@ -58,3 +58,3 @@ /**

var clickedScrollbar = function(evt) {
return document.documentElement.clientWidth <= evt.clientX;
return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
};

@@ -116,2 +116,8 @@

getDefaultProps: function() {
return {
excludeScrollbar: config && config.excludeScrollbar
};
},
/**

@@ -173,3 +179,3 @@ * Add click listeners to the current document,

this.props.outsideClickIgnoreClass || IGNORE_CLASS,
this.props.excludeScrollbar || false,
this.props.excludeScrollbar, // fallback not needed, prop always exists because of getDefaultProps
this.props.preventDefault || false,

@@ -176,0 +182,0 @@ this.props.stopPropagation || false

2

package.json
{
"name": "react-onclickoutside",
"version": "5.9.0",
"version": "5.10.0",
"description": "An onClickOutside wrapper for React components",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -33,2 +33,19 @@ # An onClickOutside wrapper for React components

```
or:
```js
// ES6 Class Syntax
import React, { Component } from 'react'
import onClickOutside from 'react-onclickoutside'
class MyComponent extends Component {
handleClickOutside = evt => {
// ..handling code goes here...
}
}
export default onClickOutside(MyComponent)
```
Note that if you try to wrap a React component class without a `handleClickOutside(evt)` handler like this, the HOC will throw an error. In order to use a custom event handler, you can specify the function to be used by the HOC as second parameter

@@ -212,2 +229,12 @@ (this can be useful in environments like TypeScript, where the fact that the wrapped component does not implement the handler can be flagged at compile-time):

Alternatively, you can specify this behavior as default for all instances of your component passing a configuration object as second parameter:
```js
var MyComponent = onClickOutside(React.createClass({
...
}), {
excludeScrollbar: true
});
```
## Regulating `evt.preventDefault()` and `evt.stopPropagation()`

@@ -214,0 +241,0 @@

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