var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
import * as React from 'react';
import styled, { css } from 'react-emotion';
import { Icon } from '@bitbloq/ui';
var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  position: relative;\n  width: 56px;\n  height: 26px;\n  border-radius: 14px;\n  border: 1px solid #cfcfcf;\n  cursor: pointer;\n"], ["\n  position: relative;\n  width: 56px;\n  height: 26px;\n  border-radius: 14px;\n  border: 1px solid #cfcfcf;\n  cursor: pointer;\n"])));
var Toggle = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n  width: 22px;\n  height: 22px;\n  border-radius: 11px;\n  background-color: #9b9da1;\n  transition: transform 100ms ease-out;\n  transform: translate(2px, 2px);\n\n  ", "\n"], ["\n  width: 22px;\n  height: 22px;\n  border-radius: 11px;\n  background-color: #9b9da1;\n  transition: transform 100ms ease-out;\n  transform: translate(2px, 2px);\n\n  ",
    "\n"])), function (props) { return props.active && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n    transform: translate(32px, 2px);\n    background-color: #82ad3a;\n  "], ["\n    transform: translate(32px, 2px);\n    background-color: #82ad3a;\n  "]))); });
var SwitchIcon = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n  display: none;\n  position: absolute;\n  top: 6px;\n\n  svg {\n    width: 13px;\n    height: auto;\n  }\n  ", "\n"], ["\n  display: none;\n  position: absolute;\n  top: 6px;\n\n  svg {\n    width: 13px;\n    height: auto;\n  }\n  ",
    "\n"])), function (props) { return props.visible && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n    display: block;\n  "], ["\n    display: block;\n  "]))); });
var DisabledIcon = styled(SwitchIcon)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n  color: #cacdd2;\n  right: 10px;\n"], ["\n  color: #cacdd2;\n  right: 10px;\n"])));
var ActiveIcon = styled(SwitchIcon)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n  color: #82ad3a;\n  left: 10px;\n"], ["\n  color: #82ad3a;\n  left: 10px;\n"])));
export var Switch = function (_a) {
    var value = _a.value, onChange = _a.onChange;
    return React.createElement(Container, { onClick: function () { return onChange(!value); } },
        React.createElement(DisabledIcon, { visible: !value },
            React.createElement(Icon, { name: "close" })),
        React.createElement(Toggle, { active: value }),
        React.createElement(ActiveIcon, { visible: value },
            React.createElement(Icon, { name: "tick" })));
};
export default Switch;
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
//# sourceMappingURL=Switch.js.map