import { createEventMap , Model , ToModelConfig , useEventMap , useUniqueId , } from '@workday/canvas-kit-react/common' ; type FormFieldState = { default hasError ? : boolean ; default id ? : string ; default isRequired ? : boolean ; } ; type FormFieldEvents = { } ; export type FormFieldModel = Model < FormFieldState , FormFieldEvents > ; const formFieldEventMap = createEventMap < FormFieldEvents > ( ) ( { guards : { } , callbacks : { } , } ) ; export type FormFieldModelConfig = FormFieldState & Partial < ToModelConfig < FormFieldState , FormFieldEvents , typeof formFieldEventMap > > ; export const useFormFieldModel = ( config = { } ) : FormFieldModel => { const id = useUniqueId ( config . id ) ; const state = { hasError : config . hasError , isRequired : config . isRequired , id , } ; const events = useEventMap ( formFieldEventMap , state , config , { } ) ; return { state , events , } ; } ;