"use strict";

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

var _react2 = require("@storybook/react");

var _addonKnobs = require("@storybook/addon-knobs");

var _index = require("../index");

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

var propsTable = function propsTable() {
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      _ref$isInitial = _ref.isInitial,
      isInitial = _ref$isInitial === void 0 ? undefined : _ref$isInitial,
      _ref$isHidden = _ref.isHidden,
      isHidden = _ref$isHidden === void 0 ? undefined : _ref$isHidden;

  return {
    isInitial: (0, _addonKnobs.boolean)('is initial (table)', isInitial, 'table'),
    isHidden: (0, _addonKnobs.boolean)('is hidden (table)', isHidden, 'table')
  };
};

var propsRow = function propsRow() {
  var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      _ref2$isHeader = _ref2.isHeader,
      isHeader = _ref2$isHeader === void 0 ? undefined : _ref2$isHeader;

  var groupId = arguments.length > 1 ? arguments[1] : undefined;
  return {
    isHeader: (0, _addonKnobs.boolean)("is header (".concat(groupId, ")"), isHeader, groupId)
  };
};

var propsCell = function propsCell() {
  var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      _ref3$isMinimal = _ref3.isMinimal,
      isMinimal = _ref3$isMinimal === void 0 ? undefined : _ref3$isMinimal,
      _ref3$isHidden = _ref3.isHidden,
      isHidden = _ref3$isHidden === void 0 ? undefined : _ref3$isHidden,
      _ref3$isHeader = _ref3.isHeader,
      isHeader = _ref3$isHeader === void 0 ? undefined : _ref3$isHeader,
      _ref3$isSorted = _ref3.isSorted,
      isSorted = _ref3$isSorted === void 0 ? undefined : _ref3$isSorted,
      _ref3$isSortable = _ref3.isSortable,
      isSortable = _ref3$isSortable === void 0 ? undefined : _ref3$isSortable,
      _ref3$isWrap = _ref3.isWrap,
      isWrap = _ref3$isWrap === void 0 ? undefined : _ref3$isWrap,
      _ref3$isCenter = _ref3.isCenter,
      isCenter = _ref3$isCenter === void 0 ? undefined : _ref3$isCenter,
      _ref3$isRight = _ref3.isRight,
      isRight = _ref3$isRight === void 0 ? undefined : _ref3$isRight,
      _ref3$isPercentageWid = _ref3.isPercentageWidth,
      isPercentageWidth = _ref3$isPercentageWid === void 0 ? undefined : _ref3$isPercentageWid,
      _ref3$isCenterVertica = _ref3.isCenterVertical,
      isCenterVertical = _ref3$isCenterVertica === void 0 ? undefined : _ref3$isCenterVertica,
      _ref3$isResponsive = _ref3.isResponsive,
      isResponsive = _ref3$isResponsive === void 0 ? undefined : _ref3$isResponsive,
      _ref3$title = _ref3.title,
      title = _ref3$title === void 0 ? undefined : _ref3$title,
      _ref3$asc = _ref3.asc,
      asc = _ref3$asc === void 0 ? undefined : _ref3$asc,
      _ref3$width = _ref3.width,
      width = _ref3$width === void 0 ? undefined : _ref3$width;

  var groupId = arguments.length > 1 ? arguments[1] : undefined;
  return {
    isMinimal: (0, _addonKnobs.boolean)("is minimal (".concat(groupId, ")"), isMinimal, groupId),
    isHidden: (0, _addonKnobs.boolean)("is hidden (".concat(groupId, ")"), isHidden, groupId),
    isHeader: (0, _addonKnobs.boolean)("is header (".concat(groupId, ")"), isHeader, groupId),
    isSorted: (0, _addonKnobs.boolean)("is sorted (".concat(groupId, ")"), isSorted, groupId),
    isSortable: (0, _addonKnobs.boolean)("is sortable (".concat(groupId, ")"), isSortable, groupId),
    isWrap: (0, _addonKnobs.boolean)("is wrap (".concat(groupId, ")"), isWrap, groupId),
    isCenter: (0, _addonKnobs.boolean)("is center (".concat(groupId, ")"), isCenter, groupId),
    isRight: (0, _addonKnobs.boolean)("is right (".concat(groupId, ")"), isRight, groupId),
    isPercentageWidth: (0, _addonKnobs.boolean)("is percentage width (".concat(groupId, ")"), isPercentageWidth, groupId),
    isCenterVertical: (0, _addonKnobs.boolean)("is center vertical (".concat(groupId, ")"), isCenterVertical, groupId),
    isResponsive: (0, _addonKnobs.boolean)("is responsive (".concat(groupId, ")"), isResponsive, groupId),
    title: (0, _addonKnobs.text)("title (".concat(groupId, ")"), title, groupId),
    asc: (0, _addonKnobs.text)("asc (".concat(groupId, ")"), asc, groupId),
    width: (0, _addonKnobs.number)("width (".concat(groupId, ")"), width, {}, groupId)
  };
};

(0, _react2.storiesOf)('Web|Table', module).add('default', function () {
  return _react.default.createElement(_index.Table, propsTable(), _react.default.createElement(_index.Row, propsRow({
    isHeader: true
  }, 'row header'), _react.default.createElement(_index.Cell, propsCell({
    isHeader: true,
    title: 'Name'
  }, 'cell header')), _react.default.createElement(_index.Cell, propsCell({
    isHeader: true,
    title: 'Age'
  }, 'cell header')), _react.default.createElement(_index.Cell, propsCell({
    isHeader: true,
    title: 'Sex'
  }, 'cell header'))), _react.default.createElement(_index.Row, propsRow({}, 'row'), _react.default.createElement(_index.Cell, propsCell({
    title: 'Vince'
  }, 'cell')), _react.default.createElement(_index.Cell, propsCell({
    title: '30'
  }, 'cell')), _react.default.createElement(_index.Cell, propsCell({
    title: 'M'
  }, 'cell'))), _react.default.createElement(_index.Row, null, _react.default.createElement(_index.Cell, {
    title: "Jack"
  }), _react.default.createElement(_index.Cell, {
    title: "32"
  }), _react.default.createElement(_index.Cell, {
    title: "M"
  })));
}).add('min', function () {
  return _react.default.createElement(_index.TableMin, null, _react.default.createElement(_index.RowMin, null, _react.default.createElement(_index.CellMin, null, "Name"), _react.default.createElement(_index.CellMin, null, "Age"), _react.default.createElement(_index.CellMin, null, "Sex")), _react.default.createElement(_index.RowMin, null, _react.default.createElement(_index.CellMin, null, "Vince"), _react.default.createElement(_index.CellMin, null, "30"), _react.default.createElement(_index.CellMin, null, "M")), _react.default.createElement(_index.RowMin, null, _react.default.createElement(_index.CellMin, null, "Jack"), _react.default.createElement(_index.CellMin, null, "32"), _react.default.createElement(_index.CellMin, null, "M")));
});