UNPKG

@telsystems/inputs

Version:
36 lines 1.87 kB
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 __()); }; })(); import * as React from 'react'; import { Label, LABEL_POSITION_RIGHT } from '@telsystems/design'; import theme from '@telsystems/design/dist/themes/default/Toggle.scss'; export { LABEL_POSITION_RIGHT, LABEL_POSITION_LEFT, LABEL_POSITION_TOP } from '@telsystems/design'; var Toggle = (function (_super) { __extends(Toggle, _super); function Toggle() { return _super !== null && _super.apply(this, arguments) || this; } Toggle.prototype.render = function () { var _a = this.props, label = _a.label, selectedText = _a.selectedText, labelAlign = _a.labelAlign, checked = _a.checked, className = _a.className, disabled = _a.disabled, onClick = _a.onClick; return (React.createElement("div", { className: className }, React.createElement(Label, { text: label, selectedText: selectedText, className: theme['toggle'], position: labelAlign }, React.createElement("input", { name: label, type: "checkbox", checked: checked, disabled: disabled, onClick: onClick }), React.createElement("div", { className: theme['icon'] })))); }; Toggle.defaultProps = { label: '', disabled: false, checked: false, labelAlign: LABEL_POSITION_RIGHT, }; return Toggle; }(React.Component)); export { Toggle }; //# sourceMappingURL=Toggle.js.map