"use strict";

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

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

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

var _reduxForm = require("redux-form");

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

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

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); }

var TestWrap = function TestWrap(_ref) {
  var children = _ref.children;
  return _react.default.createElement("form", null, children);
};

var RFWrap = (0, _reduxForm.reduxForm)({
  form: 'rf-wrap2'
})(TestWrap);

var props = function props() {
  var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      isHidden = _ref2.isHidden,
      isDisabled = _ref2.isDisabled,
      _ref2$placeholder = _ref2.placeholder,
      placeholder = _ref2$placeholder === void 0 ? 'placeholder' : _ref2$placeholder,
      _ref2$id = _ref2.id,
      id = _ref2$id === void 0 ? 'something' : _ref2$id;

  return {
    isHidden: (0, _addonKnobs.boolean)('isHidden', isHidden),
    isDisabled: (0, _addonKnobs.boolean)('isDisabled', isDisabled),
    placeholder: (0, _addonKnobs.text)('placeholder', placeholder),
    id: (0, _addonKnobs.text)('id', id)
  };
};

(0, _react2.storiesOf)('Web|form/TextArea').add('Default', function () {
  return _react.default.createElement(RFWrap, null, _react.default.createElement(_reduxForm.Field, _extends({
    component: _index.TextArea
  }, props())));
}).add('Error', function () {
  return _react.default.createElement(RFWrap, null, _react.default.createElement(_reduxForm.Field, _extends({
    component: _index.TextArea
  }, props(), {
    meta: {
      touched: true,
      error: 'error message'
    }
  })));
}, {
  info: 'redux-form lib, reduxForm() parent'
});