/** * @module @cedarjs/forms * * Redwood's form library. * Mostly simple wrappers around `react-hook-form` that make it even easier to use. * * @remarks * * @cedarjs/forms slightly extends `react-hook-form`'s `valueAs` props because it's important for us to coerce values * to the correct type for GraphQL. * The properties that are exclusive to Redwood are: * - `valueAsBoolean` * - `valueAsJSON` * - `emptyAs` * * @see {@link https://react-hook-form.com/} * * @remarks * * We make all of `react-hook-form`'s exports available as well. * * @privateRemarks * * The two main hooks in this library are: * - `useErrorStyles` * - `useRegister` * * `useErrorStyles` implements the error-specific styling via `useEffect`. * * `useRegister` hooks fields up to `react-hook-form` while providing some sensible defaults * based on the field's type. * @privateRemarks * * We use `React.ComponentPropsWithRef` and `React.ComponentPropsWithoutRef` instead of `React.FC` * because the community seems to be shifting away from `React.FC`. * * @see {@link https://fettblog.eu/typescript-react-why-i-dont-use-react-fc/} * @see {@link https://github.com/facebook/create-react-app/pull/8177} * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components/} * * @privateRemarks * * As for interfaces vs types, we're going with TypesScript's recommendation to use interfaces until types are needed. * * @see {@link https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces} */ export * from 'react-hook-form'; export { CheckboxField } from './CheckboxField.js'; export type { EmptyAsValue, RedwoodRegisterOptions } from './coercion.js'; export { FieldError } from './FieldError.js'; export { Form } from './Form.js'; export type { FormProps } from './Form.js'; export { default as FormError } from './FormError.js'; export type { ServerError, RWGqlError, ServerParseError } from './FormError.js'; export { InputField, ButtonField, ColorField, DateField, DatetimeLocalField, EmailField, FileField, HiddenField, ImageField, MonthField, NumberField, PasswordField, RadioField, RangeField, ResetField, SearchField, SubmitField, TelField, TextField, TimeField, UrlField, WeekField, } from './InputComponents.js'; export type { InputFieldProps } from './InputComponents.js'; export { Label } from './Label.js'; export { SelectField } from './SelectField.js'; export { ServerErrorsContext } from './ServerErrorsContext.js'; export { Submit } from './Submit.js'; export { TextAreaField } from './TextAreaField.js'; export { useErrorStyles } from './useErrorStyles.js'; export { useRegister } from './useRegister.js'; //# sourceMappingURL=index.d.ts.map