svelte-craftcms-headless-formie
Version:
Svelte Package for using Craft CMS with the Formie Plugin in headless configuration
32 lines (31 loc) • 868 B
TypeScript
import type { FormieErrorReturnObj } from './types/FormTypes.js';
/**
* @class FormStore
* @description
* custom error class, which can be used to map the errors to its field
*
* @example
* ```svelte
* <script>
* const error = $derived(formStore.errorByHandle(field?.handle));
* </script>
* <input
* type="text"
* aria-invalid={!!error}
* aria-errormessage={error}
* />
* <FieldError {error} /> <!-- will only be shown if errors are present -->
*/
export declare class FormStore {
#private;
/**
* ERROR
*/
clearErrors(): void;
set errors(value: FormieErrorReturnObj);
get errors(): FormieErrorReturnObj | undefined;
getErrorByHandle(handle: string | null | undefined): string | undefined;
setErrorByHandle(handle: string | null | undefined, message: string): {
[handle]: string[];
} | undefined;
}