'use strict';

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _react3 = require('@storybook/react');

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

var _addonActions = require('@storybook/addon-actions');

var _ = require('../../..');

var _2 = _interopRequireDefault(_);

var _InputTextTypeAheadKnobs = require('../InputTextTypeAhead/InputTextTypeAhead.knobs.options');

var _InputTextTypeAheadKnobs2 = _interopRequireDefault(_InputTextTypeAheadKnobs);

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

(0, _react3.storiesOf)('forms|molecules', module).addDecorator((0, _addonKnobs.withKnobs)({ escapeHTML: false })).add('TypeAheadDropdown', function () {
  var options = _InputTextTypeAheadKnobs2.default.options.orgSelector;
  options[0] = { text: 'All Organizations', value: '' };
  var props = {
    dropdownButton: {
      text: (0, _addonKnobs.text)('TypeAheadDropdown dropdownButton: text', 'All Organizations', 'DropdownButton'),
      capitalized: (0, _addonKnobs.boolean)('TypeAheadDropdown dropdownButton: capitalized', true, 'DropdownButton')
    },
    inputText: {
      boxed: true,
      label: (0, _addonKnobs.text)('TypeAheadDropdown inputText: label', null, 'InputTextTypeAhead'),
      placeholder: (0, _addonKnobs.text)('TypeAheadDropdown inputText: placeholder', 'Search an organization...', 'InputTextTypeAhead'),
      id: (0, _addonKnobs.text)('TypeAheadDropdown inputText: id', 'org-typeahead', 'InputTextTypeAhead'),
      options: (0, _addonKnobs.object)('TypeAheadDropdown inputText: options', options, 'InputTextTypeAhead Options'),
      selected: (0, _addonKnobs.optionsKnob)('TypeAheadDropdown inputText: selected', Object.assign.apply(Object, [{}].concat(options.map(function (option) {
        var _ref;

        return _ref = {}, _ref[option.text] = option.text, _ref;
      }).values())), '', { display: 'select' }, 'InputTextTypeAhead'),
      onChange: (0, _addonActions.action)('TypeAheadDropdown inputText.onChange')
    },
    onKeyDown: (0, _addonActions.action)('TypeAheadDropdown onKeyDown')
  };
  return _react2.default.createElement(_2.default, props);
});