import * as React from 'react'; import { Meta, Story } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { Form, Formik } from 'formik'; import MuiGrid from '@mui/material/Grid'; import { Button } from '../button'; import { Input, InputLabel, FormHelperText, LabelWithHint, Select, Switch, Textarea, ToggleButton, ToggleButtonGroup } from './index'; import type { TextFieldProps } from './index'; export default { title: 'Forms/Form Demo', argTypes: { color: { options: ['primary', 'secondary'], control: { type: 'select' } }, size: { options: ['medium', 'small'], control: { type: 'radio' } } } } as Meta; const handleFormSubmit = action('form submit'); const integrationsFormValues = { accessKeyId: 'MOCK7T6LOREM7GP3L53M', secretAccessKey: 'iPsum2nWhjLw5V', protocol: 'https', verifyCertificate: true, workspaceKey: '', bucketRegion: null }; const IntegrationsTemplate: Story = args => ( {formikProps => { const { values, setFieldValue, submitForm, resetForm } = formikProps; return (
{/* TEXT INPUT */} Access Key ID setFieldValue('accessKeyId', e.target.value)} {...args} /> {!values.accessKeyId ? 'This field is required' : ' '} {/* PASSWORD */} Secret Access Key setFieldValue('secretAccessKey', e.target.value)} {...args} /> {!values.secretAccessKey ? 'This field is required' : ' '} {/* TOGGLE BUTTON GROUP */} Select Protocol value && setFieldValue('protocol', value)} > HTTPS HTTP {/* SWITCH */} Verify server SSL certificate } labelProps={{ labelPlacement: 'end' }} row onChange={e => setFieldValue('verifyCertificate', !values.verifyCertificate)} /> {/* TEXTAREA */} Workspace Key