"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _react = _interopRequireDefault(require("react"));
var _ToggleSwitchCore = _interopRequireDefault(require("./ToggleSwitchCore"));
var _system = require("@wix/wix-ui-icons-common/system");
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _generateDataAttr = require("../utils/generateDataAttr");
var _ToggleSwitch2 = require("./ToggleSwitch.constants");
var _ToggleSwitchSt = require("./ToggleSwitch.st.css.js");
var _excluded = ["size", "skin", "styles", "dataHook", "className"];
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/ToggleSwitch/ToggleSwitch.jsx";
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
var checkedIconMap = (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _ToggleSwitch2.SIZES.small, undefined), _ToggleSwitch2.SIZES.medium, /*#__PURE__*/_react["default"].createElement(_system.ToggleOnSmall, {
  __self: void 0,
  __source: {
    fileName: _jsxFileName,
    lineNumber: 16,
    columnNumber: 19
  }
})), _ToggleSwitch2.SIZES.large, /*#__PURE__*/_react["default"].createElement(_system.ToggleOn, {
  __self: void 0,
  __source: {
    fileName: _jsxFileName,
    lineNumber: 17,
    columnNumber: 18
  }
}));
var uncheckedIconMap = (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _ToggleSwitch2.SIZES.small, undefined), _ToggleSwitch2.SIZES.medium, /*#__PURE__*/_react["default"].createElement(_system.ToggleOffSmall, {
  __self: void 0,
  __source: {
    fileName: _jsxFileName,
    lineNumber: 22,
    columnNumber: 19
  }
})), _ToggleSwitch2.SIZES.large, /*#__PURE__*/_react["default"].createElement(_system.ToggleOff, {
  __self: void 0,
  __source: {
    fileName: _jsxFileName,
    lineNumber: 23,
    columnNumber: 18
  }
}));

/** toggle switch */
var ToggleSwitch = /*#__PURE__*/function (_React$PureComponent) {
  function ToggleSwitch() {
    (0, _classCallCheck2["default"])(this, ToggleSwitch);
    return _callSuper(this, ToggleSwitch, arguments);
  }
  (0, _inherits2["default"])(ToggleSwitch, _React$PureComponent);
  return (0, _createClass2["default"])(ToggleSwitch, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
        size = _this$props.size,
        skin = _this$props.skin,
        stylesProp = _this$props.styles,
        dataHook = _this$props.dataHook,
        className = _this$props.className,
        rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
      return /*#__PURE__*/_react["default"].createElement(_ToggleSwitchCore["default"], (0, _extends2["default"])({
        className: (0, _ToggleSwitchSt.st)(_ToggleSwitchSt.classes.root, {
          skin: skin,
          size: size
        }, className)
      }, (0, _generateDataAttr.generateDataAttr)(this.props, ['skin', 'size']), {
        "data-hook": dataHook,
        checkedIcon: checkedIconMap[size],
        uncheckedIcon: uncheckedIconMap[size]
      }, rest, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 45,
          columnNumber: 7
        }
      }));
    }
  }]);
}(_react["default"].PureComponent);
ToggleSwitch.displayName = 'ToggleSwitch';
ToggleSwitch.defaultProps = {
  skin: 'standard',
  size: 'large'
};
var _default = exports["default"] = ToggleSwitch;