@amalto/switch
Advanced tools
Comparing version 1.5.8 to 1.5.9
/// <reference types="react" /> | ||
import * as React from 'react'; | ||
declare module Switch { | ||
interface Props extends React.Props<Switch> { | ||
interface Props { | ||
id: string; | ||
@@ -12,12 +11,5 @@ value: boolean; | ||
disabled?: boolean; | ||
children?: React.ReactNode; | ||
key?: React.ReactText; | ||
ref?: React.Ref<Switch>; | ||
} | ||
} | ||
declare class Switch extends React.Component<Switch.Props, any> { | ||
constructor(props: Switch.Props); | ||
render(): JSX.Element; | ||
private handleChange; | ||
} | ||
declare function Switch(props: Switch.Props): JSX.Element; | ||
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"); | ||
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" }))))); | ||
function Switch(props) { | ||
var handleChange = function (event) { | ||
props.changeHandler(event.target.checked, event.target.name); | ||
}; | ||
return Switch; | ||
}(React.Component)); | ||
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" }))))); | ||
} | ||
exports.default = Switch; | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Switch button.", | ||
"version": "1.5.8", | ||
"version": "1.5.9", | ||
"license": "MIT", | ||
@@ -81,3 +81,3 @@ "repository": { | ||
}, | ||
"gitHead": "8d4fc86c368b6bc8d3d0d8c5191e55405754e4a9" | ||
"gitHead": "3da21a7b8bddfbe02120867f42da323001624b63" | ||
} |
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
11459
197