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

react-bootstrap-toggle

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-bootstrap-toggle - npm Package Compare versions

Comparing version 2.2.6 to 2.3.0

+index.html

40

dist/react-bootstrap-toggle.js

@@ -23,2 +23,6 @@ 'use strict';

var _resizeObserverPolyfill = require('resize-observer-polyfill');
var _resizeObserverPolyfill2 = _interopRequireDefault(_resizeObserverPolyfill);
var _utils = require('./utils');

@@ -53,2 +57,3 @@

_this.state = { width: null, height: null };
_this.resizeObserver = null;
_this.onClick = _this.onClick.bind(_this);

@@ -61,2 +66,4 @@ return _this;

value: function componentDidMount() {
var _this2 = this;
if (this.props.width && this.props.height) {

@@ -66,2 +73,9 @@ return;

this.setDimensions();
console.log(this.props.recalculateOnResize, this.props.on);
if (this.props.recalculateOnResize) {
this.resizeObserver = new _resizeObserverPolyfill2.default(function (ent, obs) {
_this2.setDimensions();
});
this.resizeObserver.observe(this.parent);
}
}

@@ -77,2 +91,10 @@ }, {

}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
// shutdown listener
if (this.resizeObserver) {
this.resizeObserver.unobserve(this.parent);
}
}
}, {
key: 'onClick',

@@ -119,3 +141,3 @@ value: function onClick(evt) {

var _cn,
_this2 = this;
_this3 = this;

@@ -138,3 +160,4 @@ var _props = this.props,

height = _props.height,
props = _objectWithoutProperties(_props, ['active', 'onClick', 'onstyle', 'onClassName', 'offstyle', 'offClassName', 'handlestyle', 'handleClassName', 'style', 'on', 'off', 'className', 'disabled', 'width', 'height']);
recalculateOnResize = _props.recalculateOnResize,
props = _objectWithoutProperties(_props, ['active', 'onClick', 'onstyle', 'onClassName', 'offstyle', 'offClassName', 'handlestyle', 'handleClassName', 'style', 'on', 'off', 'className', 'disabled', 'width', 'height', 'recalculateOnResize']);

@@ -160,3 +183,3 @@ var sizeClass = this.getSizeClass();

ref: function ref(c) {
_this2.parent = c;
_this3.parent = c;
}

@@ -171,3 +194,3 @@ }),

ref: function ref(onLabel) {
_this2.on = onLabel;
_this3.on = onLabel;
},

@@ -183,3 +206,3 @@ className: (0, _classnames2.default)('btn toggle-on', sizeClass, onClassName, _defineProperty({}, 'btn-' + onstyle, onstyle)),

ref: function ref(offLabel) {
_this2.off = offLabel;
_this3.off = offLabel;
},

@@ -233,3 +256,5 @@ className: (0, _classnames2.default)('btn toggle-off', sizeClass, offClassName, _defineProperty({}, 'btn-' + offstyle, offstyle)),

onClick: _propTypes2.default.func,
className: _propTypes2.default.string
className: _propTypes2.default.string,
// If the toggle should recalculate it's dimensions when visibility or dimensions change
recalculateOnResize: _propTypes2.default.bool
};

@@ -250,4 +275,5 @@ ReactBootstrapToggle.defaultProps = {

active: true,
style: {}
style: {},
recalculateOnResize: false
};
exports.default = ReactBootstrapToggle;

5

package.json
{
"name": "react-bootstrap-toggle",
"version": "2.2.6",
"version": "2.3.0",
"description": "A React version of the bootstrap-toggle without the JQuery dependency",

@@ -57,3 +57,4 @@ "main": "./dist/index.js",

"classnames": "^2.2.5",
"prop-types": "^15.5.10"
"prop-types": "^15.5.10",
"resize-observer-polyfill": "^1.5.0"
},

@@ -60,0 +61,0 @@ "peerDependencies": {

@@ -83,3 +83,5 @@ ## React-Bootstrap-Toggle

height|integer|*null*|Sets the height of the toggle. if set to *null*, height will be responsive.
disabled|bool|*false*|Render the toggle as disabled
style|object|*null*|If you want to add additional style to the root div
recalculateOnResize|bool|*false*| If the toggle should recalculate it's dimensions when visibility or dimensions change

@@ -86,0 +88,0 @@ ### onClick

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