UNPKG

@talend/react-forms

Version:

React forms library based on json schema form.

42 lines 1.15 kB
import PropTypes from 'prop-types'; import { ICONS_MAPPING } from '../Comparator.component'; import { TextMode as FieldTemplate } from '../../FieldTemplate'; import { Icon } from "@talend/react-components"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; export default function TextMode(props) { const { id, schema, value } = props; const iconName = ICONS_MAPPING[value.operator]; return /*#__PURE__*/_jsxs(FieldTemplate, { id: id, label: schema.title, labelProps: schema.labelProps, children: [iconName && /*#__PURE__*/_jsx(Icon, { name: iconName }), !iconName && value.operator, `${value.operator ? ' ' : ''}${value.value || ''}`] }); } if (process.env.NODE_ENV !== 'production') { TextMode.propTypes = { id: PropTypes.string, schema: PropTypes.shape({ title: PropTypes.string, labelProps: PropTypes.object }), value: PropTypes.shape({ operator: PropTypes.string, value: PropTypes.string }) }; } TextMode.defaultProps = { schema: {}, value: { operator: '', value: '' } }; //# sourceMappingURL=TextMode.component.js.map