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 1.0.17 to 1.0.18

36

lib/react-bootstrap-toggle.js

@@ -9,4 +9,2 @@ 'use strict';

require('./src/bootstrap2-toggle.less');
var _react = require('react');

@@ -41,3 +39,4 @@

value: function onClick() {
this.props.onClick && this.props.onClick(!this.state.active);
if (this.props.disabled) return;
this.props.onChange && this.props.onChange(!this.state.active);
this.setState({ active: !this.state.active });

@@ -49,13 +48,8 @@ }

var activeClass = 'toggle btn ' + this.props.labelOneClass;
var inactiveClass = 'toggle btn off ' + this.props.labelTwoClass;
var activeClass = 'toggle btn';
var inactiveClass = 'toggle btn btn-primary off ';
var labelOneClass = 'btn toggle-on ' + this.props.labelOneClass;
var labelTwoClass = 'btn toggle-off ' + this.props.labelTwoClass;
if (this.state.active) {
labelOneClass += ' active';
} else {
labelTwoClass += ' active';
}
var style = {

@@ -75,3 +69,3 @@ width: this.props.width,

'label',
{ className: labelOneClass },
{ disabled: this.props.disabled, className: labelOneClass },
this.props.options[0]

@@ -81,6 +75,6 @@ ),

'label',
{ className: labelTwoClass },
{ disabled: this.props.disabled, className: labelTwoClass },
this.props.options[1]
),
_react2.default.createElement('span', { className: 'toggle-handle btn btn-default' })
_react2.default.createElement('span', { disabled: this.props.disabled, className: 'toggle-handle btn btn-default' })
)

@@ -97,9 +91,18 @@ );

ReactBootstrapSwitcher.propTypes = {
// Holds the className for label one
labelOneClass: _react2.default.PropTypes.string,
// Holds the className for label two
labelTwoClass: _react2.default.PropTypes.string,
// Height prop
height: _react2.default.PropTypes.string,
// Width prop
width: _react2.default.PropTypes.string,
// an array that holds the options Example : ['yes', 'no']
options: _react2.default.PropTypes.array,
// The initial state of the component
active: _react2.default.PropTypes.bool,
onChange: _react2.default.PropTypes.func
// The onChange event, returns the state as the argument
onChange: _react2.default.PropTypes.func,
// Sets the button to disabled
disabled: _react2.default.PropTypes.bool

@@ -114,4 +117,5 @@ };

options: ['Yes', 'No'],
active: true
active: true,
disabled: false
};
{
"name": "react-bootstrap-toggle",
"version": "1.0.17",
"version": "1.0.18",
"description": "A React version of the bootstrap-toggle without the JQuery dependency",

@@ -8,3 +8,3 @@ "main": "./lib/react-bootstrap-toggle.js",

"type": "git",
"url": "https://github.com/https://github.com/arnthor3/react-bootstrap-toggle"
"url": "https://github.com/arnthor3/react-bootstrap-toggle"
},

@@ -11,0 +11,0 @@ "scripts": {

@@ -1,3 +0,45 @@

#React-bootstrap-toggle
## React-Bootstrap-Toggle
Will add readme later..
This is a react component of the http://www.bootstraptoggle.com/ project.
You need to include the bootstrap css file and also the bootstrap2-toggle css file in your app.
If you are using the npm version then you can include it from the module like this.
```sh
<link rel="stylesheet" href="node_modules/lib/bootstrap2-toggle.css">
```
Or you could import it to your SASS or LESS build.
```sh
@import "node_modules/lib/bootstrap2-toggle.css";
```
## NPM
```sh
npm install react-bootstrap-toggle --save
```
## Props
### width
Defaults to a 100 px width
### height
Default to 35 px width
### options
Defaults to ['Yes', 'No']
### active
Defaults to true
### disabled
Defaults to false
### onChange
Invoked when the component state changes.

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