UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

88 lines (87 loc) 2.41 kB
import { jsxs as n, jsx as o } from "react/jsx-runtime"; import { useFormikContext as u } from "formik"; import { useContext as d } from "react"; import { defineMessages as f, useIntl as v } from "react-intl"; import "../../../components/formio/tabs.js"; import "clsx"; import { useValidationErrors as c, ErrorList as x } from "../../../utils/errors.js"; /* empty css */ import "@floating-ui/react"; /* empty css */ import { BuilderContext as g } from "../../../context.js"; import "@formio/vanilla-text-mask"; import "formiojs"; import y from "../../../components/formio/panel.js"; import "react-select"; import "dompurify"; import "../../../components/formio/datagrid.js"; import M from "./constraint-mode.js"; import h from "./fixed-value-datetimefield.js"; import F from "./relative-delta.js"; const T = f({ minDate: { id: "dvlFuk", defaultMessage: [{ type: 0, value: "Minimum date " }, { type: 5, value: "configured", options: { false: { value: [{ type: 0, value: "(not set)" }] }, other: { value: [] } } }] }, maxDate: { id: "VX9nvG", defaultMessage: [{ type: 0, value: "Maximum date " }, { type: 5, value: "configured", options: { false: { value: [{ type: 0, value: "(not set)" }] }, other: { value: [] } } }] } }), w = ({ constraint: e }) => { var i, m; const a = v(), { values: t } = u(), { formType: l } = d(g), r = ((m = (i = t == null ? void 0 : t.openForms) == null ? void 0 : i[e]) == null ? void 0 : m.mode) || "", { errors: p, hasErrors: s } = c(`openForms.${e}`); return l === "appointment" ? null : /* @__PURE__ */ n(y, { title: a.formatMessage(T[e], { configured: String(r !== "") }), collapsible: !0, initialCollapsed: !0, children: [ /* @__PURE__ */ o(M, { constraint: e }), r === "fixedValue" && /* @__PURE__ */ o(h, { constraint: e }), r === "relativeToVariable" && /* @__PURE__ */ o(F, { constraint: e }), s && /* @__PURE__ */ o("div", { className: "formio-component has-error", children: /* @__PURE__ */ o(x, { errors: p }) }) ] }); }; export { w as default };