import { useState } from 'react'; import { Box } from '@chakra-ui/react'; import { FormSelect } from '@/components/form/FormSelect'; import { useFormidable } from '@/components/form/Formidable'; export default { title: 'Components/FormSelect', }; type BasicFormData = { data?: number; }; export const Default = () => { const form = useFormidable({}); return ( ); }; export const ChangeKeys = () => { const form = useFormidable({}); return ( ); }; export const ChangeName = () => { const form = useFormidable({}); return ( ); }; export const AddableItem = () => { const form = useFormidable({}); const [data, setData] = useState([ { id: 111, name: 'first Item' }, { id: 222, name: 'Second Item' }, { id: 333, name: 'third item' }, ]); return ( { return new Promise((resolve, _rejects) => { let upperId = 0; setData((previous) => { previous.forEach((element) => { if (element['id'] > upperId) { upperId = element['id']; } }); upperId++; return [...previous, { id: upperId, name: data }]; }); resolve({ id: upperId, name: data }); }); }} options={data} /> ); }; export const DarkBackground = { render: () => { const form = useFormidable({}); return ( ); }, parameters: { docs: { description: { story: 'some story **markdown**', }, }, }, };