"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

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

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

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

var _configureStore = _interopRequireDefault(require("../../internal/configureStore"));

var _reactRedux = require("react-redux");

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

var _RfFormWrapper = _interopRequireDefault(require("../../internal/RfFormWrapper"));

var _ReduxFormWrapper = _interopRequireDefault(require("../ReduxFormWrapper"));

var _reactSelect = _interopRequireDefault(require("react-select"));

var options = [{
  value: 'chocolate',
  label: 'Chocolate'
}, {
  value: 'strawberry',
  label: 'Strawberry'
}, {
  value: 'vanilla',
  label: 'Vanilla'
}];
(0, _react2.storiesOf)('Components|ReduxFormWrapper', module).addDecorator(_addonKnobs.withKnobs).addDecorator(function (story) {
  return /*#__PURE__*/_react.default.createElement(_reactRedux.Provider, {
    store: _configureStore.default
  }, /*#__PURE__*/_react.default.createElement(_RfFormWrapper.default, null, story()));
}).add('react-select', function () {
  var ReactSelectHelper = function ReactSelectHelper(props) {
    return /*#__PURE__*/_react.default.createElement("div", {
      className: "wfp--form-item"
    }, /*#__PURE__*/_react.default.createElement("label", {
      htmlFor: props.id,
      className: "wfp--label"
    }, props.labelText), props.helperText && /*#__PURE__*/_react.default.createElement("div", {
      className: "wfp--form__helper-text"
    }, props.helperText), /*#__PURE__*/_react.default.createElement(_reactSelect.default, (0, _extends2.default)({}, props, {
      className: "wfp--react-select-container",
      classNamePrefix: "wfp--react-select"
    })));
  };

  return /*#__PURE__*/_react.default.createElement(_reduxForm.Field, {
    component: _ReduxFormWrapper.default,
    InputComponent: ReactSelectHelper,
    helperText: "This is a helper text",
    labelText: "The label",
    options: options
  });
});