import {action} from '@storybook/addon-actions'; import NewBooleanField from 'sentry/components/forms/booleanField'; import CheckboxField from 'sentry/components/forms/checkboxField'; import CompactSelect from 'sentry/components/forms/compactSelect'; import CompositeSelect from 'sentry/components/forms/compositeSelect'; import RadioGroup from 'sentry/components/forms/controls/radioGroup'; import RangeSlider from 'sentry/components/forms/controls/rangeSlider'; import DatePickerField from 'sentry/components/forms/datePickerField'; import FileField from 'sentry/components/forms/fileField'; import Form from 'sentry/components/forms/form'; import FormField from 'sentry/components/forms/formField'; import MultipleCheckboxField from 'sentry/components/forms/MultipleCheckboxField'; import RadioBooleanField from 'sentry/components/forms/radioBooleanField'; import RadioField from 'sentry/components/forms/radioField'; import SelectField from 'sentry/components/forms/selectField'; import TextareaField from 'sentry/components/forms/textareaField'; import TextCopyInput from 'sentry/components/forms/textCopyInput'; import TextField from 'sentry/components/forms/textField'; import {Panel} from 'sentry/components/panels'; import Switch from 'sentry/components/switchButton'; export default { title: 'Components/Forms/Fields', }; export const _TextField = () => (
); _TextField.storyName = 'Text'; _TextField.parameters = { docs: { description: { story: 'Simple text field', }, }, }; export const _TextareaField = ({autosize, rows}) => (
); _TextareaField.storyName = 'Textarea'; _TextareaField.args = { autosize: true, rows: 1, }; export const __BooleanField = () => (
); __BooleanField.storyName = 'Boolean'; export const _CheckboxField = () => (
); _CheckboxField.storyName = 'Checkbox'; export const _MultipleCheckboxField = () => (
); _MultipleCheckboxField.storyName = 'MultipleCheckbox'; export const _DatePickerField = () => (
); _DatePickerField.storyName = 'Datepicker'; export const _RadioField = () => (
); export const __FileField = () => (
); __FileField.storyName = 'File'; _RadioField.storyName = 'Radio'; export const _RadioBooleanField = ({disabled}) => (
); _RadioBooleanField.storyName = 'Radio - Boolean'; _RadioBooleanField.args = { disabled: false, }; export const _SelectField = () => (
); _SelectField.storyName = 'Select'; export const SelectFieldMultiple = () => (
); SelectFieldMultiple.storyName = 'Select - Multiple'; export const SelectFieldGrouped = () => (
); SelectFieldGrouped.storyName = 'Select - Grouped'; export const SelectFieldInFieldLabel = () => (
); SelectFieldInFieldLabel.storyName = 'Select - Label in Field'; SelectFieldInFieldLabel.parameters = { docs: { description: { story: 'Select Control w/ Label In Field', }, }, }; export const CompactSelectField = props => ( ); CompactSelectField.storyName = 'Select - Compact'; CompactSelectField.parameters = { docs: { description: { story: 'Compact', }, }, }; CompactSelectField.args = { size: 'md', menuTitle: '', isSearchable: false, isDisabled: false, isClearable: false, isLoading: false, multiple: false, placeholder: 'Search…', closeOnSelect: true, shouldCloseOnBlur: true, isDismissable: true, offset: 8, crossOffset: 0, containerPadding: 8, placement: 'bottom left', triggerProps: { prefix: 'Prefix', }, }; CompactSelectField.argTypes = { placement: { options: [ 'top', 'bottom', 'left', 'right', 'top left', 'top right', 'bottom left', 'bottom right', 'left top', 'left bottom', 'right top', 'right bottom', ], control: {type: 'radio'}, }, size: { options: ['md', 'sm', 'xs'], control: {type: 'radio'}, }, }; export const CompositeSelectField = props => ( ); CompositeSelectField.storyName = 'Select - Composite'; CompositeSelectField.args = {...CompactSelectField.args}; delete CompositeSelectField.args.multiple; CompositeSelectField.argTypes = CompactSelectField.argTypes; export const NonInlineField = () => (
{({value, label, onChange}) => ( )}
); NonInlineField.storyName = 'Non-inline'; NonInlineField.parameters = { docs: { description: { story: 'Radio Group used w/ FormField', }, }, }; export const _RangeSlider = () => (
{ return `${value} Toaster Strudle${value > 1 ? 's' : ''}`; }} />
); _RangeSlider.storyName = 'Range Slider'; export const WithoutAParentForm = ({onChange}) => { return (
); }; WithoutAParentForm.storyName = 'Without a Parent Form'; WithoutAParentForm.argTypes = { onChange: {action: 'onChange'}, }; WithoutAParentForm.parameters = { docs: { description: { story: 'New form fields used without having a parent Form', }, }, }; export const __TextCopyInput = () => ( Value to be copied ); __TextCopyInput.storyName = 'Text Copy';