import React, { useState } from "react";
import styled from "styled-components";
import { Checkbox, useCheckboxesList } from ".";
var MasterCheckbox = styled(Checkbox).withConfig({
  displayName: "checkboxmock__MasterCheckbox",
  componentId: "sc-qsmiq4-0"
})(["margin-bottom:8px;"]);
var StyledCheckbox = styled(Checkbox).withConfig({
  displayName: "checkboxmock__StyledCheckbox",
  componentId: "sc-qsmiq4-1"
})(["margin-left:10px;margin-bottom:8px;"]);
var CheckboxGroup = styled.div.withConfig({
  displayName: "checkboxmock__CheckboxGroup",
  componentId: "sc-qsmiq4-2"
})([""]);
export var MockedCheckbox = function MockedCheckbox(_ref) {
  var _ref$disabled = _ref.disabled,
    disabled = _ref$disabled === void 0 ? false : _ref$disabled;
  var _useState = useState(false),
    checked = _useState[0],
    setChecked = _useState[1];
  var handleChange = function handleChange(value) {
    setChecked(value);
  };
  return /*#__PURE__*/React.createElement(Checkbox, {
    onChange: handleChange,
    checked: checked,
    disabled: disabled
  });
};
export var MockedCheckboxList = function MockedCheckboxList() {
  var _useState2 = useState(false),
    checkedOne = _useState2[0],
    setCheckedOne = _useState2[1];
  var _useState3 = useState(false),
    checkedTwo = _useState3[0],
    setCheckedTwo = _useState3[1];
  var _useState4 = useState(false),
    checkedThree = _useState4[0],
    setCheckedThree = _useState4[1];
  var valuesList = [checkedOne, checkedTwo, checkedThree];
  var handlersList = [setCheckedOne, setCheckedTwo, setCheckedThree];
  var _useCheckboxesList = useCheckboxesList(valuesList, handlersList),
    allChecked = _useCheckboxesList[0],
    indeterminate = _useCheckboxesList[1],
    switchAll = _useCheckboxesList[2];
  var handleChange = function handleChange(setter) {
    return function (value) {
      setter(value);
    };
  };
  return /*#__PURE__*/React.createElement(CheckboxGroup, null, /*#__PURE__*/React.createElement(MasterCheckbox, {
    label: "The Boss checkbox",
    checked: allChecked,
    onChange: switchAll,
    indeterminate: indeterminate
  }), /*#__PURE__*/React.createElement(StyledCheckbox, {
    label: "Do you like greek salad?",
    onChange: handleChange(setCheckedTwo),
    checked: checkedTwo
  }), /*#__PURE__*/React.createElement(StyledCheckbox, {
    label: "Do you like sguschenka?",
    onChange: handleChange(setCheckedOne),
    checked: checkedOne
  }), /*#__PURE__*/React.createElement(StyledCheckbox, {
    label: "Was this story useful?",
    onChange: handleChange(setCheckedThree),
    checked: checkedThree
  }));
};