import Button from 'react-bootstrap/Button' import InputGroup from 'react-bootstrap/InputGroup' import BootstrapForm from 'react-bootstrap/Form' import Alert from 'react-bootstrap/Alert' import { Formik, Form as FormikForm, useFormikContext, useField } from 'formik' import { useRef, useState } from 'react' export function SubmitButton ({ children, variant, ...props }) { const { isSubmitting } = useFormikContext() return ( ) } export function Input ({ label, prepend, append, hint, ...props }) { const [field, meta] = useField(props) return ( {label && {label}} {prepend && ( {prepend} )} {append && ( {append} )} {meta.touched && meta.error} {hint && ( {hint} )} ) } export function Form ({ initial, schema, onSubmit, children, ...props }) { const [error, setError] = useState() return ( onSubmit && onSubmit(...args).catch(e => setError(e.message))} > {error && setError(undefined)} dismissible>{error}} {children} ) } export function SyncForm ({ initial, schema, children, action, ...props }) { const ref = useRef(null) return ( ref.current.submit()} > {props => (
{children}
)}
) }