import * as React from 'react'; import {Field} from './index'; import {boolean, select, text, withKnobs, number} from '@storybook/addon-knobs'; import {withInfo} from '@storybook/addon-info'; import {storyLayout} from '../../index.stories'; import {FIELD_MODE, INTENT, SIZE} from '../../constants'; import {Button} from '../../component'; import {fieldModeMap} from '../../utils/storybookEnums'; // eslint-disable-next-line no-restricted-syntax export default { title: 'Field', decorators: [withInfo, withKnobs, storyLayout] }; export const fields = () => { return ( label {INPUT}
input { {console.log(name, value);}} error={'some error text'} />}
select { {console.log(name, value);}} />}
checkbox { {console.log(name, value);}} />}
switch { {console.log(name, value);}} />}
{}} label={text('label', 'fieldLabel')} sublabel={text('sublabel', 'fieldSubabel')} error={text('error', '')} labelWidth={number('labelWidth', 40)} inputWidth={number('inputWidth', 60)} isMultiLine={boolean('isMultiLine', false)} viewMode={select('size', fieldModeMap(true), FIELD_MODE.COLUMNS_ALIGN_LEFT)} isRequired={boolean('isRequired', false)} prefix={text('prefix', '')} isWide={boolean('isWide', false)} rightExtraItems={( )} />
); };