import React from 'react';

import { storiesOf } from '@storybook/react';
import { withKnobs } from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';

import InputText from './index';
import InputTextDocs from './InputText.md';
import InputTextOptions from './InputText.knobs.options';

storiesOf('forms|atoms', module).addDecorator(withKnobs({ escapeHTML: false })).add('InputText', function () {
  var inputTextOptionsWithKnobs = Object.assign.apply(Object, Object.entries(InputTextOptions).map(function (_ref) {
    var _ref2;

    var k = _ref[0],
        v = _ref[1];
    return _ref2 = {}, _ref2[k] = v(InputText.defaultProps[k]), _ref2;
  }));
  inputTextOptionsWithKnobs.onChange = action('Text input modified');

  return React.createElement(InputText, inputTextOptionsWithKnobs);
}, { info: InputTextDocs });