"use strict";

exports.__esModule = true;
exports.SwitchInput = exports.CheckboxInput = exports.CenterMiddleWrapper = exports.getCheckUpdater = exports.FormCheckbox = void 0;

var _react = _interopRequireDefault(require("react"));

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _utils = require("../../../utils");

var _Checkbox = _interopRequireDefault(require("../../Checkbox"));

var _Switch = _interopRequireDefault(require("../../Switch"));

var _excluded = ["update", "value"],
    _excluded2 = ["update", "value"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var FormCheckbox = (0, _styledComponents.default)(_Checkbox.default).withConfig({
  displayName: "Toggles__FormCheckbox",
  componentId: "sc-u47m6y-0"
})(["height:30px;display:flex;align-self:flex-start;align-items:center;"]);
exports.FormCheckbox = FormCheckbox;
var getCheckUpdater = (0, _utils.memoize)(function (update) {
  return function (e) {
    return update(e.target.checked);
  };
});
exports.getCheckUpdater = getCheckUpdater;

var CenterMiddleWrapper = _styledComponents.default.div.withConfig({
  displayName: "Toggles__CenterMiddleWrapper",
  componentId: "sc-u47m6y-1"
})(["min-height:30px;display:flex;justify-content:center;align-items:center;"]);

exports.CenterMiddleWrapper = CenterMiddleWrapper;

var CheckboxInput = function CheckboxInput(_ref) {
  var update = _ref.update,
      value = _ref.value,
      props = _objectWithoutProperties(_ref, _excluded);

  return /*#__PURE__*/_react.default.createElement(CenterMiddleWrapper, null, /*#__PURE__*/_react.default.createElement(FormCheckbox, _extends({
    onChange: getCheckUpdater(update),
    value: value
  }, props)));
};

exports.CheckboxInput = CheckboxInput;

var SwitchInput = function SwitchInput(_ref2) {
  var update = _ref2.update,
      value = _ref2.value,
      props = _objectWithoutProperties(_ref2, _excluded2);

  return /*#__PURE__*/_react.default.createElement(CenterMiddleWrapper, null, /*#__PURE__*/_react.default.createElement(_Switch.default, _extends({
    onChange: getCheckUpdater(update),
    value: value
  }, props)));
};

exports.SwitchInput = SwitchInput;
;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(FormCheckbox, "FormCheckbox", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(getCheckUpdater, "getCheckUpdater", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(CenterMiddleWrapper, "CenterMiddleWrapper", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(CheckboxInput, "CheckboxInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(SwitchInput, "SwitchInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();

;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(FormCheckbox, "FormCheckbox", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(getCheckUpdater, "getCheckUpdater", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(CenterMiddleWrapper, "CenterMiddleWrapper", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(CheckboxInput, "CheckboxInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(SwitchInput, "SwitchInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();