UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

20 lines (19 loc) 1.34 kB
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; import { FormattedMessage } from 'react-intl'; import { TextField } from '../../components/formio'; /** * Show a formio email component preview. * * NOTE: for the time being, this is rendered in the default Formio bootstrap style, * however at some point this should use the components of * @open-formulieren/formio-renderer instead for a more accurate preview. */ const Preview = ({ component }) => { var _a; const { key, label, description, tooltip, validate = {}, autocomplete, multiple, openForms, } = component; const { required = false } = validate; const requireVerification = (_a = openForms === null || openForms === void 0 ? void 0 : openForms.requireVerification) !== null && _a !== void 0 ? _a : false; const verificationButton = requireVerification ? (_jsx("button", Object.assign({ type: "button", className: "btn btn-primary" }, { children: _jsx(FormattedMessage, { id: 'Cf5zSF', defaultMessage: [{ type: 0, value: "Verify" }] }) }))) : null; return (_jsx(_Fragment, { children: _jsx(TextField, { name: key, multiple: !!multiple, label: label, description: description, tooltip: tooltip, required: required, autoComplete: autocomplete, type: "email", childrenAfterField: verificationButton }) })); }; export default Preview;