UNPKG

uniforms-react-semantic

Version:

Semantic React UI components for uniforms.

83 lines (71 loc) 2.16 kB
import React from 'react'; import PropTypes from 'prop-types' import connectField from 'uniforms/connectField'; import {Input} from 'semantic-ui-react' import Wrapper from "./Wrapper"; import filterSemanticProps from "./filterSemanticProps"; const Text = ({ action, actionPosition, as, children, className, disabled, error, fluid, focus, icon, iconPosition, input, inverted, label, labelPosition, loading, onChange, size, tabIndex, transparent, type, errorMessage, showInlineError, ...props }) => <Wrapper showInlineError={showInlineError} errorMessage={errorMessage} error={!!error} label={label}> <Input {...filterSemanticProps(props)} action={action} actionPosition={actionPosition} as={as} children={children} className={className} disabled={disabled} error={!!error} fluid={fluid} focus={focus} icon={icon} iconPosition={iconPosition} input={input} inverted={inverted} label={label} labelPosition={labelPosition} loading={loading} size={size} tabIndex={tabIndex} transparent={transparent} type={type} onChange={(event, {value=''}) => { onChange(value) }} /> </Wrapper> Text.propTypes = { errorMessage: PropTypes.string, showInlineError: PropTypes.bool, errorLabel: PropTypes.element, ...Input.propTypes, error: PropTypes.object, } export default connectField(Text, { includeInChain: false, ensureValue: true, initialValue: true, });