import React from 'react' ; import { createComponent , ExtractProps , useModelContext } from '@workday/canvas-kit-react/common' ; import { Box } from '@workday/canvas-kit-labs-react/common' ; import { FormFieldModelContext } from './FormField' ; import { FormFieldModel , useFormFieldInput } from './hooks' ; export interface FormFieldInputProps extends ExtractProps < typeof Box , never > { model ? : FormFieldModel ; } export const FormFieldInput = createComponent ( 'input' ) ( { displayName : 'FormField.Input' , Component : ( { model , ... elemProps } , ref , Element ) => { const localModel = useModelContext ( FormFieldModelContext , model ) ; const props = useFormFieldInput ( localModel , elemProps , ref ) ; return < Box as = { Element } { ... props } / > ; } , } ) ;