import { getNodeLabel } from '@ory/integrations/ui' ; import { Button , TextInput } from '@ory/themes' ; import { NodeInputButton } from './NodeInputButton' ; import { NodeInputCheckbox } from './NodeInputCheckbox' ; import { NodeInputHidden } from './NodeInputHidden' ; import { NodeInputSubmit } from './NodeInputSubmit' ; import { NodeInputProps } from './helpers' ; export function NodeInputDefault < T > ( props ) { const { node , attributes , value = '' , setValue , disabled } = props ; const onClick = ( ) => { if ( attributes . onclick ) { const run = new Function ( attributes . onclick ) ; run ( ) ; } } ; return ( < TextInput title = { node . meta . label ?. text } onClick = { onClick } onChange = { ( e ) => { setValue ( e . target . value ) ; } } type = { attributes . type } name = { attributes . name } value = { value } disabled = { attributes . disabled || disabled } help = { node . messages . length > 0 } state = { node . messages . find ( ( { type } ) => type === 'error' ) ? 'error' : undefined } subtitle = { < > { node . messages . map ( ( { text , id } , k ) => ( < span key = { `${ id }-${ k }` } data - testid = { `ui/message/${ id }` } > { text } < /span>))} < />}/ > ) ; }