diff --git a/README.md b/README.md
index 36671e8..07454ee 100755
--- a/README.md
+++ b/README.md
@@ -2,10 +2,6 @@
A Switch control built with and for [React](http://facebook.github.io/react/index.html)
-## New version 2.1.0
-
-Add square theme.
-
## Demo & Example
Example: [http://gfazioli.github.io/react-switch-button](http://gfazioli.github.io/react-switch-button)
diff --git a/bower.json b/bower.json
index 210a61d..29d4635 100755
--- a/bower.json
+++ b/bower.json
@@ -1,7 +1,7 @@
{
"name": "react-switch-button",
"main": "dist/react-switch-button.min.js",
- "version": "2.0.0",
+ "version": "2.2.1",
"homepage": "http://gfazioli.github.io/react-switch-button/",
"authors": [
"Giovambattista Fazioli"
diff --git a/dist/react-switch-button.js b/dist/react-switch-button.js
index c2465d3..02cfe48 100644
--- a/dist/react-switch-button.js
+++ b/dist/react-switch-button.js
@@ -2,31 +2,41 @@
(function (global){
'use strict';
-var React = typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null;
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+
+function _interopRequireDefault(obj) {
+ return obj && obj.__esModule ? obj : { 'default': obj };
+}
+
+var _react = typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null;
+
+var _react2 = _interopRequireDefault(_react);
-var SwitchButton = React.createClass({
+var SwitchButton = _react2['default'].createClass({
// Display name
displayName: 'Switch Button',
// Version
- version: '2.2.0',
+ version: '2.2.1',
/**
* The props types.
*/
propTypes: {
- id: React.PropTypes.string,
- name: React.PropTypes.string,
- title: React.PropTypes.string,
- label: React.PropTypes.string,
- labelRight: React.PropTypes.string,
- defaultChecked: React.PropTypes.bool,
- disabled: React.PropTypes.bool,
- theme: React.PropTypes.string,
- checked: React.PropTypes.string,
- mode: React.PropTypes.string,
- onChange: React.PropTypes.func
+ id: _react2['default'].PropTypes.string,
+ name: _react2['default'].PropTypes.string,
+ title: _react2['default'].PropTypes.string,
+ label: _react2['default'].PropTypes.string,
+ labelRight: _react2['default'].PropTypes.string,
+ defaultChecked: _react2['default'].PropTypes.bool,
+ disabled: _react2['default'].PropTypes.bool,
+ theme: _react2['default'].PropTypes.string,
+ checked: _react2['default'].PropTypes.string,
+ mode: _react2['default'].PropTypes.string,
+ onChange: _react2['default'].PropTypes.func
},
/**
@@ -71,28 +81,29 @@ var SwitchButton = React.createClass({
}
if (this.props.label !== '') {
- label = React.createElement('label', { htmlFor: id }, this.props.label);
+ label = _react2['default'].createElement('label', { htmlFor: id }, this.props.label);
}
if (this.props.labelRight !== '') {
- labelRight = React.createElement('label', { htmlFor: id }, this.props.labelRight);
+ labelRight = _react2['default'].createElement('label', { htmlFor: id }, this.props.labelRight);
}
if (['switch', 'select'].indexOf(mode) < -1) {
mode = "switch";
}
- return React.createElement('div', { className: 'rsbc-switch-button rsbc-mode-' + mode + ' ' + this.props.theme + (this.props.disabled ? " disabled" : "") }, label, React.createElement('input', { onChange: this.props.onChange,
+ return _react2['default'].createElement('div', { className: 'rsbc-switch-button rsbc-mode-' + mode + ' ' + this.props.theme + (this.props.disabled ? " disabled" : "") }, label, _react2['default'].createElement('input', { onChange: this.props.onChange,
defaultChecked: this.props.defaultChecked,
disabled: this.props.disabled,
id: id, name: this.props.name,
type: 'checkbox',
- value: '1' }), React.createElement('label', { htmlFor: id }), labelRight);
+ value: '1' }), _react2['default'].createElement('label', { htmlFor: id }), labelRight);
}
});
-module.exports = SwitchButton;
+exports['default'] = SwitchButton;
+module.exports = exports['default'];
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[1])(1)
diff --git a/dist/react-switch-button.min.js b/dist/react-switch-button.min.js
index 0a0a4a9..f81a7ac 100644
--- a/dist/react-switch-button.min.js
+++ b/dist/react-switch-button.min.js
@@ -1 +1 @@
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.reactSwitchButton=e()}}(function(){return function e(t,n,o){function i(s,l){if(!n[s]){if(!t[s]){var p="function"==typeof require&&require;if(!l&&p)return p(s,!0);if(r)return r(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var a=n[s]={exports:{}};t[s][0].call(a.exports,function(e){var n=t[s][1][e];return i(n?n:e)},a,a.exports,e,t,n,o)}return n[s].exports}for(var r="function"==typeof require&&require,s=0;s', object: React.createElement(SwitchButton, { theme: this.state.theme, name: 'switch-1' })
+ code: '',
+ object: _react2["default"].createElement(_reactSwitchButton2["default"], { theme: this.state.theme,
+ name: "switch-1" })
}, {
label: "Set Theme",
code: '',
- object: React.createElement(SwitchButton, { name: 'switch-1t',
- theme: 'rsbc-switch-button-flat-square',
+ object: _react2["default"].createElement(_reactSwitchButton2["default"], { name: "switch-1t",
+ theme: "rsbc-switch-button-flat-square",
defaultChecked: true })
}, {
label: "Set initial status",
code: '',
- object: React.createElement(SwitchButton, { name: 'switch-2',
+ object: _react2["default"].createElement(_reactSwitchButton2["default"], { name: "switch-2",
theme: this.state.theme,
defaultChecked: true })
}, {
label: "Add left label",
code: '',
- object: React.createElement(SwitchButton, { name: 'switch-3',
+ object: _react2["default"].createElement(_reactSwitchButton2["default"], { name: "switch-3",
theme: this.state.theme,
- label: 'Click me',
+ label: "Click me",
defaultChecked: true })
}, {
label: "Add right label",
code: '',
- object: React.createElement(SwitchButton, { name: 'switch-4',
+ object: _react2["default"].createElement(_reactSwitchButton2["default"], { name: "switch-4",
theme: this.state.theme,
- labelRight: 'Click me',
+ labelRight: "Click me",
defaultChecked: true })
}, {
label: "Add left and right label",
code: '',
- object: React.createElement(SwitchButton, { name: 'switch-5',
+ object: _react2["default"].createElement(_reactSwitchButton2["default"], { name: "switch-5",
theme: this.state.theme,
- label: 'Both',
- labelRight: 'Click me',
+ label: "Both",
+ labelRight: "Click me",
defaultChecked: true })
}, {
label: "Disabled when On",
code: '',
- object: React.createElement(SwitchButton, { name: 'switch-6',
+ object: _react2["default"].createElement(_reactSwitchButton2["default"], { name: "switch-6",
theme: this.state.theme,
- label: 'Disabled',
+ label: "Disabled",
disabled: true,
defaultChecked: true })
}, {
label: "Disabled when Off",
code: '',
- object: React.createElement(SwitchButton, { name: 'switch-7',
+ object: _react2["default"].createElement(_reactSwitchButton2["default"], { name: "switch-7",
theme: this.state.theme,
- label: 'Disabled',
+ label: "Disabled",
disabled: true })
}, {
label: "New in v2.2.0 Mode select",
code: '',
- object: React.createElement(SwitchButton, { name: 'switch-8',
- mode: 'select',
- labelRight: 'Turn right',
- label: 'Turn left' })
+ object: _react2["default"].createElement(_reactSwitchButton2["default"], { name: "switch-8",
+ mode: "select",
+ theme: this.state.theme,
+ labelRight: "Turn right",
+ label: "Turn left" })
}];
var rows = code.map(function (o, i) {
- return React.createElement('div', { className: 'example',
- key: i }, React.createElement('h3', null, o.label), React.createElement('pre', null, o.code), React.createElement('div', { className: 'result' }, o.object));
+ return _react2["default"].createElement("div", { className: "example",
+ key: i }, _react2["default"].createElement("h3", null, o.label), _react2["default"].createElement("pre", null, o.code), _react2["default"].createElement("div", { className: "result" }, o.object));
});
- return React.createElement('div', { className: 'examples' }, React.createElement('h1', null, 'Say Hello, React Switch Button'), React.createElement('div', { className: 'example' }, React.createElement('h3', null, 'New in v.2.1.0')), React.createElement(SwitchButton, { name: 'switch-theme', label: 'Switch Theme', onChange: this.onChange }), React.createElement('hr', null), rows);
+ return _react2["default"].createElement("div", { className: "examples" }, _react2["default"].createElement("h1", null, "Say Hello, React Switch Button"), _react2["default"].createElement("div", { className: "example" }, _react2["default"].createElement("h3", null, "New in v.2.2.0")), _react2["default"].createElement(_reactSwitchButton2["default"], { name: "new-mode-select",
+ mode: "select",
+ labelRight: "Turn right",
+ label: "Turn left" }), _react2["default"].createElement("div", { className: "example" }, _react2["default"].createElement("h3", null, "New in v.2.1.0")), _react2["default"].createElement(_reactSwitchButton2["default"], { name: "switch-theme",
+ label: "Switch Theme",
+ onChange: this.onChange }), _react2["default"].createElement("hr", null), rows);
}
});
-ReactDom.render(React.createElement(App, null), document.getElementById('app'));
+_reactDom2["default"].render(_react2["default"].createElement(App, null), document.getElementById('app'));
},{"react":undefined,"react-dom":undefined,"react-switch-button":undefined}]},{},[1]);
diff --git a/example/dist/bundle.js b/example/dist/bundle.js
index f82e3a5..8011faa 100644
--- a/example/dist/bundle.js
+++ b/example/dist/bundle.js
@@ -1,31 +1,41 @@
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o', object :
+ label : "Simple usage",
+ code : '',
+ object :
},
{
label : "Set Theme",
@@ -91,8 +94,9 @@ const App = React.createClass( {
code : '',
object :
+ label="Turn left"/>
}
];
@@ -116,11 +120,22 @@ const App = React.createClass( {
Say Hello, React Switch Button
+
+
New in v.2.2.0
+
+
+
+
New in v.2.1.0
-
+
{rows}
diff --git a/lib/react-switch-button.js b/lib/react-switch-button.js
index d432110..23072d9 100755
--- a/lib/react-switch-button.js
+++ b/lib/react-switch-button.js
@@ -1,30 +1,38 @@
'use strict';
-var React = require('react');
+Object.defineProperty(exports, '__esModule', {
+ value: true
+});
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+var _react = require("react");
+
+var _react2 = _interopRequireDefault(_react);
-var SwitchButton = React.createClass({
+var SwitchButton = _react2['default'].createClass({
// Display name
displayName: 'Switch Button',
// Version
- version: '2.2.0',
+ version: '2.2.1',
/**
* The props types.
*/
propTypes: {
- id: React.PropTypes.string,
- name: React.PropTypes.string,
- title: React.PropTypes.string,
- label: React.PropTypes.string,
- labelRight: React.PropTypes.string,
- defaultChecked: React.PropTypes.bool,
- disabled: React.PropTypes.bool,
- theme: React.PropTypes.string,
- checked: React.PropTypes.string,
- mode: React.PropTypes.string,
- onChange: React.PropTypes.func
+ id: _react2['default'].PropTypes.string,
+ name: _react2['default'].PropTypes.string,
+ title: _react2['default'].PropTypes.string,
+ label: _react2['default'].PropTypes.string,
+ labelRight: _react2['default'].PropTypes.string,
+ defaultChecked: _react2['default'].PropTypes.bool,
+ disabled: _react2['default'].PropTypes.bool,
+ theme: _react2['default'].PropTypes.string,
+ checked: _react2['default'].PropTypes.string,
+ mode: _react2['default'].PropTypes.string,
+ onChange: _react2['default'].PropTypes.func
},
/**
@@ -69,7 +77,7 @@ var SwitchButton = React.createClass({
}
if (this.props.label !== '') {
- label = React.createElement(
+ label = _react2['default'].createElement(
'label',
{ htmlFor: id },
this.props.label
@@ -77,7 +85,7 @@ var SwitchButton = React.createClass({
}
if (this.props.labelRight !== '') {
- labelRight = React.createElement(
+ labelRight = _react2['default'].createElement(
'label',
{ htmlFor: id },
this.props.labelRight
@@ -88,21 +96,22 @@ var SwitchButton = React.createClass({
mode = "switch";
}
- return React.createElement(
+ return _react2['default'].createElement(
'div',
{ className: 'rsbc-switch-button rsbc-mode-' + mode + ' ' + this.props.theme + (this.props.disabled ? " disabled" : "") },
label,
- React.createElement('input', { onChange: this.props.onChange,
+ _react2['default'].createElement('input', { onChange: this.props.onChange,
defaultChecked: this.props.defaultChecked,
disabled: this.props.disabled,
id: id, name: this.props.name,
type: 'checkbox',
value: '1' }),
- React.createElement('label', { htmlFor: id }),
+ _react2['default'].createElement('label', { htmlFor: id }),
labelRight
);
}
});
-module.exports = SwitchButton;
\ No newline at end of file
+exports['default'] = SwitchButton;
+module.exports = exports['default'];
\ No newline at end of file
diff --git a/package.json b/package.json
index 4f12835..b253a33 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "react-switch-button",
- "version": "2.2.0",
+ "version": "2.2.1",
"private": false,
"description": "A React UI Component to display an awesome Switch (swipe) Button control",
"main": "dist/react-switch-button.min.js",
diff --git a/src/react-switch-button.js b/src/react-switch-button.js
index 6dbb6ec..c210283 100755
--- a/src/react-switch-button.js
+++ b/src/react-switch-button.js
@@ -1,4 +1,4 @@
-const React = require('react');
+import React from "react";
const SwitchButton = React.createClass( {
@@ -6,7 +6,7 @@ const SwitchButton = React.createClass( {
displayName : 'Switch Button',
// Version
- version : '2.2.0',
+ version : '2.2.1',
/**
* The props types.
@@ -102,4 +102,4 @@ const SwitchButton = React.createClass( {
} );
-module.exports = SwitchButton;
+export default SwitchButton;