{"version":3,"file":"useFormValidatorGroup.mjs","names":[],"sources":["../../../../package/services/formValidation/useFormValidatorGroup.ts"],"sourcesContent":["import { useFormValidatorGroupInstance } from '@ahrowe/form-validation';\nimport type { FormGroup, FormValidatorGroupOptions, InferGroupValues } from '@ahrowe/form-validation';\nimport FormValidatorGroupWithForm from './FormValidatorGroupWithForm';\n\n/**\n * @ahrowe/ui's flavour of useFormValidatorGroup: the group it creates has\n * `.Form` attached and defaults `onSubmitError` to an error toast (see\n * FormValidatorGroupWithForm). Reuses the core package's reactive wiring\n * (useFormValidatorGroupInstance) so this and the pure hook share one\n * implementation of \"subscribe a function component to a group\".\n */\nexport function useFormValidatorGroup<TGroup extends FormGroup = FormGroup, TInitial = InferGroupValues<TGroup>>(\n  groupDef: TGroup,\n  { onSubmit, onValidate, ...options }: FormValidatorGroupOptions<TGroup, TInitial> = {},\n): FormValidatorGroupWithForm<TGroup, TInitial> {\n  return useFormValidatorGroupInstance(\n    () => new FormValidatorGroupWithForm(groupDef, null, options),\n    onSubmit,\n    onValidate,\n  );\n}\n"],"mappings":"qIAWA,SAAgB,EACd,EACA,CAAE,WAAU,aAAY,GAAG,GAAyD,CAAC,EACvC,CAC9C,OAAO,MACC,IAAI,EAA2B,EAAU,KAAM,CAAO,EAC5D,EACA,CACF,CACF"}