@amalto/switch
Advanced tools
Comparing version 1.5.9 to 1.6.1
/// <reference types="react" /> | ||
import * as React from 'react'; | ||
declare module Switch { | ||
interface Props { | ||
interface Props extends React.Props<Switch> { | ||
id: string; | ||
@@ -11,5 +12,12 @@ value: boolean; | ||
disabled?: boolean; | ||
children?: React.ReactNode; | ||
key?: React.ReactText; | ||
ref?: React.Ref<Switch>; | ||
} | ||
} | ||
declare function Switch(props: Switch.Props): JSX.Element; | ||
declare class Switch extends React.Component<Switch.Props, any> { | ||
constructor(props: Switch.Props); | ||
render(): JSX.Element; | ||
private handleChange; | ||
} | ||
export default Switch; |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var React = require("react"); | ||
var classNames = require("classnames"); | ||
function Switch(props) { | ||
var handleChange = function (event) { | ||
props.changeHandler(event.target.checked, event.target.name); | ||
var Switch = (function (_super) { | ||
__extends(Switch, _super); | ||
function Switch(props) { | ||
var _this = _super.call(this, props) || this; | ||
_this.handleChange = function (event) { | ||
_this.props.changeHandler(event.target.checked, event.target.name); | ||
}; | ||
return _this; | ||
} | ||
Switch.prototype.render = function () { | ||
return (React.createElement("div", { style: { paddingTop: 2, paddingBottom: 2 }, className: this.props.cssClass }, | ||
React.createElement("div", { className: classNames('onoffswitch', { | ||
'left-align': this.props.alignLeft | ||
}) }, | ||
React.createElement("input", { type: "checkbox", className: 'onoffswitch-checkbox', id: this.props.id, checked: this.props.value, onChange: !this.props.disabled ? this.handleChange : function () { }, name: this.props.name || this.props.id }), | ||
React.createElement("label", { className: "onoffswitch-label", htmlFor: this.props.id }, | ||
React.createElement("span", { className: classNames('onoffswitch-inner', { | ||
'disabled': this.props.disabled | ||
}) }), | ||
React.createElement("span", { className: "onoffswitch-switch" }))))); | ||
}; | ||
return (React.createElement("div", { style: { paddingTop: 2, paddingBottom: 2 }, className: props.cssClass }, | ||
React.createElement("div", { className: classNames('onoffswitch', { | ||
'left-align': props.alignLeft | ||
}) }, | ||
React.createElement("input", { type: "checkbox", className: 'onoffswitch-checkbox', id: props.id, checked: props.value, onChange: !props.disabled ? handleChange : function () { }, name: props.name || props.id }), | ||
React.createElement("label", { className: "onoffswitch-label", htmlFor: props.id }, | ||
React.createElement("span", { className: classNames('onoffswitch-inner', { | ||
'disabled': props.disabled | ||
}) }), | ||
React.createElement("span", { className: "onoffswitch-switch" }))))); | ||
} | ||
return Switch; | ||
}(React.Component)); | ||
exports.default = Switch; | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Switch button.", | ||
"version": "1.5.9", | ||
"version": "1.6.1", | ||
"license": "MIT", | ||
@@ -81,3 +81,3 @@ "repository": { | ||
}, | ||
"gitHead": "3da21a7b8bddfbe02120867f42da323001624b63" | ||
"gitHead": "073eeb987d43006dd37295d0a1aa7c6bc33e803b" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12810
223