'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 _index = require('./index');

var _index2 = _interopRequireDefault(_index);

var _PressFilters = require('./PressFilters.md');

var _PressFilters2 = _interopRequireDefault(_PressFilters);

var _ButtonKnobs = require('../../atoms/buttons/Button/Button.knobs.options');

var _ButtonKnobs2 = _interopRequireDefault(_ButtonKnobs);

var _HeadingsKnobs = require('../../atoms/headings/Headings.knobs.options');

var _HeadingsKnobs2 = _interopRequireDefault(_HeadingsKnobs);

var _ColoredHeadingKnobs = require('../../atoms/headings/ColoredHeading/ColoredHeading.knobs.options');

var _ColoredHeadingKnobs2 = _interopRequireDefault(_ColoredHeadingKnobs);

var _SelectBoxKnobs = require('../../forms/SelectBox/SelectBox.knobs.options');

var _SelectBoxKnobs2 = _interopRequireDefault(_SelectBoxKnobs);

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

var _InputTextTypeAheadKnobs2 = _interopRequireDefault(_InputTextTypeAheadKnobs);

var _OrgSelectorKnobs = require('../../forms/OrgSelector/OrgSelector.knobs.options');

var _OrgSelectorKnobs2 = _interopRequireDefault(_OrgSelectorKnobs);

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

// import knob options for child patterns
(0, _react3.storiesOf)('organisms/PressFilters', module).addDecorator((0, _addonKnobs.withKnobs)({ escapeHTML: false })).add('SelectBox Only', function () {
  var defaultHeadingLevel = '2';
  var pressFiltersStartDate = {
    labelText: 'Select a start date', required: false, id: 'start-date', name: 'start-date', placeholder: 'm/dd/yyyy', restrict: 'max'
  };
  var pressFiltersEndDate = {
    labelText: 'Select an end date', required: false, id: 'end-date', name: 'end-date', placeholder: 'today', restrict: 'max'
  };
  var hideTopic = (0, _addonKnobs.select)('PressFilters hideTopic', { hide: 'Hide', show: 'Show' }, 'show');
  var props = {
    action: (0, _addonKnobs.text)('PressFilters action', '#'),
    coloredHeading: {
      text: (0, _addonKnobs.text)('PressFilters coloredHeading: text', 'Filter Results', 'ColoredHeading'),
      color: (0, _addonKnobs.select)('PressFilters coloredHeading: color', _ColoredHeadingKnobs2.default.color, 'blue', 'ColoredHeading'),
      level: (0, _addonKnobs.select)('PressFilters coloredHeading: level', _HeadingsKnobs2.default.levels, defaultHeadingLevel, 'ColoredHeading')
    },
    orgSelector: {
      organizations: (0, _addonKnobs.object)('PressFilters orgSelector: organizations', _OrgSelectorKnobs2.default.organizations, 'OrgSelector: organizations'),
      onChangeOrgCallback: (0, _addonActions.action)('PressFilters onChangeOrgCallback')
    },
    topic: hideTopic === 'show' ? {
      label: (0, _addonKnobs.text)('PressFilters topic: label', 'Filter by Topic', 'Topic'),
      stackLabel: (0, _addonKnobs.boolean)('PressFilters topic: stackLabel', true, 'Topic'),
      id: 'topic',
      options: (0, _addonKnobs.object)('PressFilters topic: options', _SelectBoxKnobs2.default.options.topics, 'Topic'),
      required: (0, _addonKnobs.boolean)('PressFilters topic: required', true, 'Topic')
    } : null,
    pressType: {},
    dateRange: {
      label: (0, _addonKnobs.text)('PressFilters dateRange: label', 'Date range', 'Date Range'),
      startDate: (0, _addonKnobs.object)('PressFilters dateRange: startDate', pressFiltersStartDate, 'Date Range'),
      endDate: (0, _addonKnobs.object)('PressFilters dateRange: endDate', pressFiltersEndDate, 'Date Range')
    },
    submitButton: {
      text: (0, _addonKnobs.text)('PressFilters submitButton: text', 'Submit', 'Submit Button'),
      type: (0, _addonKnobs.select)('PressFilters submitButton: type', _ButtonKnobs2.default.type, 'submit', 'Submit Button'),
      size: (0, _addonKnobs.select)('PressFilters submitButton: size', _ButtonKnobs2.default.size, 'Submit Button'),
      theme: (0, _addonKnobs.select)('PressFilters submitButton: theme', _ButtonKnobs2.default.theme, '', 'Submit Button'),
      outline: (0, _addonKnobs.boolean)('PressFilters submitButton: outline', false, 'Submit Button'),
      onClick: (0, _addonActions.action)('PressFilters submitButton clicked')
    },
    clearButton: {
      text: (0, _addonKnobs.text)('PressFilters clearButton: text', 'Clear all filters', 'Clear Button'),
      info: (0, _addonKnobs.text)('PressFilters clearButton: aria-label', 'Clear all filters', 'Clear Button'),
      onClearCallback: (0, _addonActions.action)('pressFilters on clearAll')
    }
  };
  props.orgSelector.selectBox = {
    label: (0, _addonKnobs.text)('orgSelector selectBox: label', 'State organization', 'OrgSelector'),
    id: (0, _addonKnobs.text)('orgSelector selectBox: id', 'state-organization', 'OrgSelector'),
    options: (0, _addonKnobs.object)('orgSelector selectBox: options', _SelectBoxKnobs2.default.options.orgSelector, 'OrgSelector'),
    selected: (0, _addonKnobs.select)('orgSelector selectBox: defaultSelected', _SelectBoxKnobs2.default.options.orgSelector.map(function (option) {
      return option.text;
    }), _SelectBoxKnobs2.default.options.orgSelector[0].text, 'OrgSelector')
  };
  props.pressType.selectBox = {
    label: (0, _addonKnobs.text)('PressFilters pressType: label', 'Filter by Announcement Type', 'PressType'),
    stackLabel: (0, _addonKnobs.boolean)('PressFilters pressType: stackLabel', true, 'PressType'),
    id: 'announcement-type',
    options: (0, _addonKnobs.object)('PressFilters pressType: options', _SelectBoxKnobs2.default.options.pressTypes, 'PressType'),
    required: (0, _addonKnobs.boolean)('PressFilters pressType: required', true, 'PressType')
  };
  return _react2.default.createElement(_index2.default, props);
}, { info: _PressFilters2.default }).add('TypeAhead Only', function () {
  var defaultHeadingLevel = '2';
  var pressFiltersStartDate = {
    labelText: 'Select a start date', required: false, id: 'start-date', name: 'start-date', placeholder: 'm/dd/yyyy', restrict: 'max'
  };
  var pressFiltersEndDate = {
    labelText: 'Select an end date', required: false, id: 'end-date', name: 'end-date', placeholder: 'today', restrict: 'max'
  };
  var hideTopic = (0, _addonKnobs.select)('PressFilters hideTopic', { hide: 'Hide', show: 'Show' }, 'show');
  var props = {
    action: (0, _addonKnobs.text)('PressFilters action', '#'),
    coloredHeading: {
      text: (0, _addonKnobs.text)('PressFilters coloredHeading: text', 'Filter Results', 'ColoredHeading'),
      color: (0, _addonKnobs.select)('PressFilters coloredHeading: color', _ColoredHeadingKnobs2.default.color, 'blue', 'ColoredHeading'),
      level: (0, _addonKnobs.select)('PressFilters coloredHeading: level', _HeadingsKnobs2.default.levels, defaultHeadingLevel, 'ColoredHeading')
    },
    orgSelector: {
      organizations: (0, _addonKnobs.object)('PressFilters orgSelector: organizations', _OrgSelectorKnobs2.default.organizations, 'OrgSelector: organizations'),
      onChangeOrgCallback: (0, _addonActions.action)('PressFilters onChangeOrgCallback')
    },
    topic: hideTopic === 'show' ? {
      label: (0, _addonKnobs.text)('PressFilters topic: label', 'Filter by Topic', 'Topic'),
      stackLabel: (0, _addonKnobs.boolean)('PressFilters topic: stackLabel', true, 'Topic'),
      id: 'topic',
      options: (0, _addonKnobs.object)('PressFilters topic: options', _SelectBoxKnobs2.default.options.topics, 'Topic'),
      required: (0, _addonKnobs.boolean)('PressFilters topic: required', true, 'Topic')
    } : null,
    pressType: {},
    dateRange: {
      label: (0, _addonKnobs.text)('PressFilters dateRange: label', 'Date range', 'Date Range'),
      startDate: (0, _addonKnobs.object)('PressFilters dateRange: startDate', pressFiltersStartDate, 'Date Range'),
      endDate: (0, _addonKnobs.object)('PressFilters dateRange: endDate', pressFiltersEndDate, 'Date Range')
    },
    submitButton: {
      text: (0, _addonKnobs.text)('PressFilters submitButton: text', 'Submit', 'Submit Button'),
      type: (0, _addonKnobs.select)('PressFilters submitButton: type', _ButtonKnobs2.default.type, 'submit', 'Submit Button'),
      size: (0, _addonKnobs.select)('PressFilters submitButton: size', _ButtonKnobs2.default.size, 'Submit Button'),
      theme: (0, _addonKnobs.select)('PressFilters submitButton: theme', _ButtonKnobs2.default.theme, '', 'Submit Button'),
      outline: (0, _addonKnobs.boolean)('PressFilters submitButton: outline', false, 'Submit Button'),
      onClick: (0, _addonActions.action)('PressFilters submitButton clicked')
    },
    clearButton: {
      text: (0, _addonKnobs.text)('PressFilters clearButton: text', 'Clear all filters', 'Clear Button'),
      info: (0, _addonKnobs.text)('PressFilters clearButton: aria-label', 'Clear all filters', 'Clear Button'),
      onClearCallback: (0, _addonActions.action)('pressFilters on clearAll')
    }
  };

  props.orgSelector.typeAhead = {
    label: (0, _addonKnobs.text)('orgSelector typeAhead: label', 'State organization', 'OrgSelector'),
    id: (0, _addonKnobs.text)('orgSelector typeAhead: id', 'state-organization', 'OrgSelector'),
    options: (0, _addonKnobs.object)('orgSelector typeAhead: options', _InputTextTypeAheadKnobs2.default.options.orgSelector, 'OrgSelector'),
    selected: (0, _addonKnobs.select)('orgSelector defaultSelected', [''].concat(_InputTextTypeAheadKnobs2.default.options.orgSelector.map(function (option) {
      return option.text;
    })), '', 'OrgSelector'),
    placeholder: (0, _addonKnobs.text)('orgSelector typeAhead: placeholder', 'All Organizations', 'OrgSelector'),
    onChange: (0, _addonActions.action)('PressFilters orgSelector typeahead onChange')
  };

  props.pressType.typeAhead = {
    label: (0, _addonKnobs.text)('PressFilters pressType: label', 'Filter by Announcement Type', 'PressType'),
    id: (0, _addonKnobs.text)('PressFilters pressType: id', 'press-type', 'PressType'),
    options: (0, _addonKnobs.object)('PressFilters pressType: options', _InputTextTypeAheadKnobs2.default.options.pressTypes, 'PressType'),
    selected: (0, _addonKnobs.select)('PressFilters pressType: defaultSelected', [''].concat(_InputTextTypeAheadKnobs2.default.options.pressTypes.map(function (option) {
      return option.text;
    })), '', 'PressType'),
    placeholder: (0, _addonKnobs.text)('PressFilters pressType: placeholder', 'All Types', 'PressType'),
    onChange: (0, _addonActions.action)('PressFilters pressType typeahead onChange')
  };
  return _react2.default.createElement(_index2.default, props);
}, { info: _PressFilters2.default }).add('OrgSelector using TypeAhead and PressType using SelectBox', function () {
  var defaultHeadingLevel = '2';
  var pressFiltersStartDate = {
    labelText: 'Select a start date', required: false, id: 'start-date', name: 'start-date', placeholder: 'm/dd/yyyy', restrict: 'max'
  };
  var pressFiltersEndDate = {
    labelText: 'Select an end date', required: false, id: 'end-date', name: 'end-date', placeholder: 'today', restrict: 'max'
  };
  var hideTopic = (0, _addonKnobs.select)('PressFilters hideTopic', { hide: 'Hide', show: 'Show' }, 'show');
  var props = {
    action: (0, _addonKnobs.text)('PressFilters action', '#'),
    coloredHeading: {
      text: (0, _addonKnobs.text)('PressFilters coloredHeading: text', 'Filter Results', 'ColoredHeading'),
      color: (0, _addonKnobs.select)('PressFilters coloredHeading: color', _ColoredHeadingKnobs2.default.color, 'blue', 'ColoredHeading'),
      level: (0, _addonKnobs.select)('PressFilters coloredHeading: level', _HeadingsKnobs2.default.levels, defaultHeadingLevel, 'ColoredHeading')
    },
    orgSelector: {
      organizations: (0, _addonKnobs.object)('PressFilters orgSelector: organizations', _OrgSelectorKnobs2.default.organizations, 'OrgSelector: organizations'),
      onChangeOrgCallback: (0, _addonActions.action)('PressFilters onChangeOrgCallback')
    },
    topic: hideTopic === 'show' ? {
      label: (0, _addonKnobs.text)('PressFilters topic: label', 'Filter by Topic', 'Topic'),
      stackLabel: (0, _addonKnobs.boolean)('PressFilters topic: stackLabel', true, 'Topic'),
      id: 'topic',
      options: (0, _addonKnobs.object)('PressFilters topic: options', _SelectBoxKnobs2.default.options.topics, 'Topic'),
      required: (0, _addonKnobs.boolean)('PressFilters topic: required', true, 'Topic')
    } : null,
    pressType: {},
    dateRange: {
      label: (0, _addonKnobs.text)('PressFilters dateRange: label', 'Date range', 'Date Range'),
      startDate: (0, _addonKnobs.object)('PressFilters dateRange: startDate', pressFiltersStartDate, 'Date Range'),
      endDate: (0, _addonKnobs.object)('PressFilters dateRange: endDate', pressFiltersEndDate, 'Date Range')
    },
    submitButton: {
      text: (0, _addonKnobs.text)('PressFilters submitButton: text', 'Submit', 'Submit Button'),
      type: (0, _addonKnobs.select)('PressFilters submitButton: type', _ButtonKnobs2.default.type, 'submit', 'Submit Button'),
      size: (0, _addonKnobs.select)('PressFilters submitButton: size', _ButtonKnobs2.default.size, 'Submit Button'),
      theme: (0, _addonKnobs.select)('PressFilters submitButton: theme', _ButtonKnobs2.default.theme, '', 'Submit Button'),
      outline: (0, _addonKnobs.boolean)('PressFilters submitButton: outline', false, 'Submit Button'),
      onClick: (0, _addonActions.action)('PressFilters submitButton clicked')
    },
    clearButton: {
      text: (0, _addonKnobs.text)('PressFilters clearButton: text', 'Clear all filters', 'Clear Button'),
      info: (0, _addonKnobs.text)('PressFilters clearButton: aria-label', 'Clear all filters', 'Clear Button'),
      onClearCallback: (0, _addonActions.action)('pressFilters on clearAll')
    }
  };
  props.orgSelector.typeAhead = {
    label: (0, _addonKnobs.text)('orgSelector typeAhead: label', 'State organization', 'OrgSelector'),
    id: (0, _addonKnobs.text)('orgSelector typeAhead: id', 'state-organization', 'OrgSelector'),
    options: (0, _addonKnobs.object)('orgSelector typeAhead: options', _InputTextTypeAheadKnobs2.default.options.orgSelector, 'OrgSelector'),
    selected: (0, _addonKnobs.select)('orgSelector defaultSelected', [''].concat(_InputTextTypeAheadKnobs2.default.options.orgSelector.map(function (option) {
      return option.text;
    })), '', 'OrgSelector'),
    placeholder: (0, _addonKnobs.text)('orgSelector typeAhead: placeholder', 'All Organizations', 'OrgSelector'),
    onChange: (0, _addonActions.action)('PressFilters orgSelector typeahead onChange')
  };
  props.pressType.selectBox = {
    label: (0, _addonKnobs.text)('PressFilters pressType: label', 'Filter by Announcement Type', 'PressType'),
    stackLabel: (0, _addonKnobs.boolean)('PressFilters pressType: stackLabel', true, 'PressType'),
    id: 'announcement-type',
    options: (0, _addonKnobs.object)('PressFilters pressType: options', _SelectBoxKnobs2.default.options.pressTypes, 'PressType'),
    required: (0, _addonKnobs.boolean)('PressFilters pressType: required', true, 'PressType')
  };
  return _react2.default.createElement(_index2.default, props);
}, { info: _PressFilters2.default }).add('OrgSelector using SelectBox and PressType using TypeAhead', function () {
  var defaultHeadingLevel = '2';
  var pressFiltersStartDate = {
    labelText: 'Select a start date', required: false, id: 'start-date', name: 'start-date', placeholder: 'm/dd/yyyy', restrict: 'max'
  };
  var pressFiltersEndDate = {
    labelText: 'Select an end date', required: false, id: 'end-date', name: 'end-date', placeholder: 'today', restrict: 'max'
  };
  var hideTopic = (0, _addonKnobs.select)('PressFilters hideTopic', { hide: 'Hide', show: 'Show' }, 'show');
  var props = {
    action: (0, _addonKnobs.text)('PressFilters action', '#'),
    coloredHeading: {
      text: (0, _addonKnobs.text)('PressFilters coloredHeading: text', 'Filter Results', 'ColoredHeading'),
      color: (0, _addonKnobs.select)('PressFilters coloredHeading: color', _ColoredHeadingKnobs2.default.color, 'blue', 'ColoredHeading'),
      level: (0, _addonKnobs.select)('PressFilters coloredHeading: level', _HeadingsKnobs2.default.levels, defaultHeadingLevel, 'ColoredHeading')
    },
    orgSelector: {
      organizations: (0, _addonKnobs.object)('PressFilters orgSelector: organizations', _OrgSelectorKnobs2.default.organizations, 'OrgSelector: organizations'),
      onChangeOrgCallback: (0, _addonActions.action)('PressFilters onChangeOrgCallback')
    },
    topic: hideTopic === 'show' ? {
      label: (0, _addonKnobs.text)('PressFilters topic: label', 'Filter by Topic', 'Topic'),
      stackLabel: (0, _addonKnobs.boolean)('PressFilters topic: stackLabel', true, 'Topic'),
      id: 'topic',
      options: (0, _addonKnobs.object)('PressFilters topic: options', _SelectBoxKnobs2.default.options.topics, 'Topic'),
      required: (0, _addonKnobs.boolean)('PressFilters topic: required', true, 'Topic')
    } : null,
    pressType: {},
    dateRange: {
      label: (0, _addonKnobs.text)('PressFilters dateRange: label', 'Date range', 'Date Range'),
      startDate: (0, _addonKnobs.object)('PressFilters dateRange: startDate', pressFiltersStartDate, 'Date Range'),
      endDate: (0, _addonKnobs.object)('PressFilters dateRange: endDate', pressFiltersEndDate, 'Date Range')
    },
    submitButton: {
      text: (0, _addonKnobs.text)('PressFilters submitButton: text', 'Submit', 'Submit Button'),
      type: (0, _addonKnobs.select)('PressFilters submitButton: type', _ButtonKnobs2.default.type, 'submit', 'Submit Button'),
      size: (0, _addonKnobs.select)('PressFilters submitButton: size', _ButtonKnobs2.default.size, 'Submit Button'),
      theme: (0, _addonKnobs.select)('PressFilters submitButton: theme', _ButtonKnobs2.default.theme, '', 'Submit Button'),
      outline: (0, _addonKnobs.boolean)('PressFilters submitButton: outline', false, 'Submit Button'),
      onClick: (0, _addonActions.action)('PressFilters submitButton clicked')
    },
    clearButton: {
      text: (0, _addonKnobs.text)('PressFilters clearButton: text', 'Clear all filters', 'Clear Button'),
      info: (0, _addonKnobs.text)('PressFilters clearButton: aria-label', 'Clear all filters', 'Clear Button'),
      onClearCallback: (0, _addonActions.action)('pressFilters on clearAll')
    }
  };
  props.orgSelector.selectBox = {
    label: (0, _addonKnobs.text)('orgSelector selectBox: label', 'State organization', 'OrgSelector'),
    id: (0, _addonKnobs.text)('orgSelector selectBox: id', 'state-organization', 'OrgSelector'),
    options: (0, _addonKnobs.object)('orgSelector selectBox: options', _SelectBoxKnobs2.default.options.orgSelector, 'OrgSelector'),
    selected: (0, _addonKnobs.select)('orgSelector selectBox: defaultSelected', _SelectBoxKnobs2.default.options.orgSelector.map(function (option) {
      return option.text;
    }), _SelectBoxKnobs2.default.options.orgSelector[0].text, 'OrgSelector')
  };
  props.pressType.typeAhead = {
    label: (0, _addonKnobs.text)('PressFilters pressType: label', 'Filter by Announcement Type', 'PressType'),
    id: (0, _addonKnobs.text)('PressFilters pressType: id', 'press-type', 'PressType'),
    options: (0, _addonKnobs.object)('PressFilters pressType: options', _InputTextTypeAheadKnobs2.default.options.pressTypes, 'PressType'),
    selected: (0, _addonKnobs.select)('PressFilters pressType: defaultSelected', [''].concat(_InputTextTypeAheadKnobs2.default.options.pressTypes.map(function (option) {
      return option.text;
    })), '', 'PressType'),
    placeholder: (0, _addonKnobs.text)('PressFilters pressType: placeholder', 'All Types', 'PressType'),
    onChange: (0, _addonActions.action)('PressFilters pressType typeahead onChange')
  };
  return _react2.default.createElement(_index2.default, props);
}, { info: _PressFilters2.default });