<commit_before>import React from 'react';
import { storiesOf } from '@storybook/react';
import {
  boolean, number, text, select
} from '@storybook/addon-knobs';
import OptionsHelper from '../../utils/helpers/options-helper';
import { notes, info } from './documentation';
import DateInput from '.';

storiesOf('Date Input', module)
  .add('default', () => {
    const autoFocus = boolean('autoFocus', true);
    const disabled = boolean('disabled', false);
    const minDate = text('minDate', '');
    const maxDate = text('maxDate', '');
    const readOnly = boolean('readOnly', false);
    const label = text('label', 'Example DateInput');
    const labelWidth = number('labelWidth', 0);
    const labelHelp = text('labelHelp', 'This text provides more information for the label.');
    const fieldHelp = text('fieldHelp', 'This text provides help for the input.');
    const fieldHelpInline = boolean('fieldHelpInline', false);
    const value = text('value', DateInput.defaultProps.value);
    const labelInline = boolean('labelInline', false);
    const inputWidth = labelInline ? number('inputWidth', 0, {
      range: true,
      min: 0,
      max: 50,
      step: 1
    }) : undefined;
    const labelAlign = labelInline ? select(
      'labelAlign',
      OptionsHelper.alignBinary,
      OptionsHelper.alignBinary[0]
    ) : undefined;

    return (
      <DateInput
        autoFocus={ autoFocus }
        disabled={ disabled }
        minDate={ minDate }
        maxDate={ maxDate }
        readOnly={ readOnly }
        label={ label }
        labelInline={ labelInline }
        labelWidth={ labelWidth }
        labelAlign={ labelAlign }
        labelHelp={ labelHelp }
        inputWidth={ inputWidth }
        fieldHelp={ fieldHelp }
        fieldHelpInline={ fieldHelpInline }
        value={ value }
      />
    );
  }, {
    info: { text: info },
    notes: { markdown: notes }
  });<commit_msg>fixed date not updated on selection in date input story<commit_after>import React from 'react';
import { storiesOf } from '@storybook/react';
import { StateDecorator, Store, State } from '@sambego/storybook-state';
import {
  boolean, number, text, select
} from '@storybook/addon-knobs';
import OptionsHelper from '../../utils/helpers/options-helper';
import { notes, info } from './documentation';
import DateInput from '.';

const store = new Store(
  {
    value: DateInput.defaultProps.value
  }
);

const setValue = (ev) => {
  store.set({ value: ev.target.value });
};

storiesOf('Date Input', module)
  .addDecorator(StateDecorator(store))
  .add('default', () => {
    const autoFocus = boolean('autoFocus', true);
    const disabled = boolean('disabled', false);
    const minDate = text('minDate', '');
    const maxDate = text('maxDate', '');
    const readOnly = boolean('readOnly', false);
    const label = text('label', 'Example DateInput');
    const labelWidth = number('labelWidth', 0);
    const labelHelp = text('labelHelp', 'This text provides more information for the label.');
    const fieldHelp = text('fieldHelp', 'This text provides help for the input.');
    const fieldHelpInline = boolean('fieldHelpInline', false);
    const labelInline = boolean('labelInline', false);
    const inputWidth = labelInline ? number('inputWidth', 0, {
      range: true,
      min: 0,
      max: 50,
      step: 1
    }) : undefined;
    const labelAlign = labelInline ? select(
      'labelAlign',
      OptionsHelper.alignBinary,
      OptionsHelper.alignBinary[0]
    ) : undefined;

    return (
      <DateInput
        autoFocus={ autoFocus }
        disabled={ disabled }
        minDate={ minDate }
        maxDate={ maxDate }
        readOnly={ readOnly }
        label={ label }
        labelInline={ labelInline }
        labelWidth={ labelWidth }
        labelAlign={ labelAlign }
        labelHelp={ labelHelp }
        inputWidth={ inputWidth }
        fieldHelp={ fieldHelp }
        fieldHelpInline={ fieldHelpInline }
        value={ store.get('value') }
        onChange={ setValue }
      />
    );
  }, {
    info: { text: info, propTablesExclude: [State] },
    notes: { markdown: notes }
  });
{'fraction_non_alphanumeric': 0.13462002412545235, 'fraction_numerical': 0.0033775633293124246, 'mean_word_length': 3.0135527589545013, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3086731', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1170, 'n_words': 326}