"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _2 = require("../..");
var _ControlsListItem = _interopRequireDefault(require("./ControlsListItem"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var GRID = {
  areas: [['icon', 'label', 'button'], ['.', 'description', 'description']],
  templateColumns: ['auto', '1fr', '1fr'],
  templateRows: ['auto', '1fr'],
  gutter: {
    row: 1,
    col: 2
  }
};
var ControlsListItemSwitch = function ControlsListItemSwitch(_ref) {
  var checked = _ref.checked,
    description = _ref.description,
    Icon = _ref.Icon,
    label = _ref.label,
    onChange = _ref.onChange,
    addon = _ref.addon,
    disabled = _ref.disabled;
  var hasAddon = _react.default.isValidElement(addon);
  return _react.default.createElement(_ControlsListItem.default, {
    disabled: disabled
  }, _react.default.createElement(_2.CssGrid.Container, GRID, _react.default.createElement(_2.CssGrid.Item, {
    area: "icon",
    justify: "start",
    align: "center"
  }, _react.default.createElement(_react.default.Fragment, null, Icon)), _react.default.createElement(_2.CssGrid.Item, {
    area: "label",
    justify: "start",
    align: "center"
  }, _react.default.createElement(_2.Typography, {
    type: "secondary",
    weight: "bold"
  }, label)), _react.default.createElement(_2.CssGrid.Item, {
    area: "button",
    justify: "end",
    align: "center"
  }, _react.default.createElement(_2.Switch, {
    label: label,
    hiddenLabel: true,
    onClick: function onClick(_) {
      return onChange();
    },
    checked: checked,
    disabled: disabled
  })), _react.default.createElement(_2.CssGrid.Item, {
    area: "description"
  }, description && _react.default.createElement(_2.Typography, {
    type: "secondary",
    color: function color(t) {
      return t.color.label;
    }
  }, description), hasAddon && _react.default.createElement(_2.Box, {
    pt: 2
  }, addon))));
};
var _default = exports.default = ControlsListItemSwitch;