import { useState } from 'react' ; import { useFoundation } from '@rmwc/base' ; import { TextFieldCharacterCountProps , TextFieldCharacterCountApi } from '.' ; import { MDCTextFieldCharacterCounterFoundation } from '@material/textfield' ; export const useTextFieldCharacterCountFoundation = ( props ) => { const [ content , setContent ] = useState < string > ( ) ; const { foundation , ... elements } = useFoundation ( { props , api : ( { foundation } ) : TextFieldCharacterCountApi => { return { getFoundation : ( ) => foundation } ; } , elements : { } , foundation : ( ) => { return new MDCTextFieldCharacterCounterFoundation ( { setContent : ( content ) => { setContent ( content ) ; } } ) ; } } ) ; return { content , ... elements } ; } ;