"use strict";

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

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

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

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

var _utils = require("../../../../storybook/utils");

var _component = _interopRequireDefault(require("./component"));

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

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] : {},
      _ref2$isFormVariant = _ref2.isFormVariant,
      isFormVariant = _ref2$isFormVariant === void 0 ? undefined : _ref2$isFormVariant,
      _ref2$isFloatErrorVar = _ref2.isFloatErrorVariant,
      isFloatErrorVariant = _ref2$isFloatErrorVar === void 0 ? undefined : _ref2$isFloatErrorVar,
      _ref2$isClick = _ref2.isClick,
      isClick = _ref2$isClick === void 0 ? undefined : _ref2$isClick,
      _ref2$isDisabled = _ref2.isDisabled,
      isDisabled = _ref2$isDisabled === void 0 ? undefined : _ref2$isDisabled,
      _ref2$isHeaderStretch = _ref2.isHeaderStretchWidth,
      isHeaderStretchWidth = _ref2$isHeaderStretch === void 0 ? undefined : _ref2$isHeaderStretch,
      _ref2$isMenuHeaderWid = _ref2.isMenuHeaderWidth,
      isMenuHeaderWidth = _ref2$isMenuHeaderWid === void 0 ? undefined : _ref2$isMenuHeaderWid,
      _ref2$isCloseOnSelect = _ref2.isCloseOnSelect,
      isCloseOnSelect = _ref2$isCloseOnSelect === void 0 ? undefined : _ref2$isCloseOnSelect,
      _ref2$isInWidget = _ref2.isInWidget,
      isInWidget = _ref2$isInWidget === void 0 ? undefined : _ref2$isInWidget,
      _ref2$infoMessage = _ref2.infoMessage,
      infoMessage = _ref2$infoMessage === void 0 ? undefined : _ref2$infoMessage,
      _ref2$tooltipPosition = _ref2.tooltipPosition,
      tooltipPosition = _ref2$tooltipPosition === void 0 ? undefined : _ref2$tooltipPosition,
      _ref2$placeholder = _ref2.placeholder,
      placeholder = _ref2$placeholder === void 0 ? undefined : _ref2$placeholder,
      _ref2$list = _ref2.list,
      list = _ref2$list === void 0 ? undefined : _ref2$list,
      _ref2$itemKey = _ref2.itemKey,
      itemKey = _ref2$itemKey === void 0 ? undefined : _ref2$itemKey,
      _ref2$activeItem = _ref2.activeItem,
      activeItem = _ref2$activeItem === void 0 ? 2 : _ref2$activeItem,
      _ref2$activeItems = _ref2.activeItems,
      activeItems = _ref2$activeItems === void 0 ? undefined : _ref2$activeItems,
      _ref2$searchQuery = _ref2.searchQuery,
      searchQuery = _ref2$searchQuery === void 0 ? undefined : _ref2$searchQuery,
      _ref2$fieldName = _ref2.fieldName,
      fieldName = _ref2$fieldName === void 0 ? undefined : _ref2$fieldName,
      _ref2$asyncStatus = _ref2.asyncStatus,
      asyncStatus = _ref2$asyncStatus === void 0 ? undefined : _ref2$asyncStatus,
      _ref2$asyncStatusList = _ref2.asyncStatusList,
      asyncStatusList = _ref2$asyncStatusList === void 0 ? undefined : _ref2$asyncStatusList;

  return {
    isFormVariant: (0, _addonKnobs.boolean)('isFormVariant', isFormVariant),
    isFloatErrorVariant: (0, _addonKnobs.boolean)('isFloatErrorVariant', isFloatErrorVariant),
    isClick: (0, _addonKnobs.boolean)('isClick', isClick),
    isDisabled: (0, _addonKnobs.boolean)('isDisabled', isDisabled),
    isHeaderStretchWidth: (0, _addonKnobs.boolean)('isHeaderStretchWidth', isHeaderStretchWidth),
    isMenuHeaderWidth: (0, _addonKnobs.boolean)('isMenuHeaderWidth', isMenuHeaderWidth),
    isCloseOnSelect: (0, _addonKnobs.boolean)('isCloseOnSelect', isCloseOnSelect),
    isInWidget: (0, _addonKnobs.boolean)('isInWidget', isInWidget),
    infoMessage: (0, _addonKnobs.text)('infoMessage', infoMessage),
    tooltipPosition: (0, _addonKnobs.radios)('tooltip position', _utils.tooltipPositions, tooltipPosition),
    placeholder: (0, _addonKnobs.text)('placeholder', placeholder),
    list: (0, _addonKnobs.array)('list', [1, 2, 3, 4]),
    itemKey: (0, _addonKnobs.text)('itemKey', itemKey),
    activeItem: (0, _addonKnobs.text)('activeItem', activeItem),
    // activeItems,
    searchQuery: (0, _addonKnobs.text)('searchQuery', searchQuery),
    fieldName: (0, _addonKnobs.text)('fieldName', fieldName),
    // onItemClick
    // onSearch
    // onToggleDropdownCb
    asyncStatus: (0, _addonKnobs.select)('async status', (0, _utils.asyncStates)({
      isList: false
    }), asyncStatus),
    asyncStatusList: (0, _addonKnobs.select)('async status list', (0, _utils.asyncStates)({
      isList: true
    }), asyncStatusList)
  };
};

(0, _react2.storiesOf)('Web|Dropdown', module).add('Search', function () {
  return _react.default.createElement(RFWrap, null, _react.default.createElement(_component.default, props()));
}).add('Search stretch', function () {
  return _react.default.createElement(RFWrap, null, _react.default.createElement(_component.default, props({
    isHeaderStretchWidth: true,
    isMenuHeaderWidth: true
  })));
}).add('Search form variant', function () {
  return _react.default.createElement(RFWrap, null, _react.default.createElement(_component.default, props({
    isFormVariant: true,
    isHeaderStretchWidth: true,
    isMenuHeaderWidth: true
  })));
});