@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
22 lines (21 loc) • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const react_intl_1 = require("react-intl");
const formio_1 = require("../../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 ? ((0, jsx_runtime_1.jsx)("button", Object.assign({ type: "button", className: "btn btn-primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: 'Cf5zSF', defaultMessage: [{ type: 0, value: "Verify" }] }) }))) : null;
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(formio_1.TextField, { name: key, multiple: !!multiple, label: label, description: description, tooltip: tooltip, required: required, autoComplete: autocomplete, type: "email", childrenAfterField: verificationButton }) }));
};
exports.default = Preview;