UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

90 lines (89 loc) 2.52 kB
import { jsxs as u, jsx as o } from "react/jsx-runtime"; import { useFormikContext as n } 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-datefield.js"; import F from "./include-today.js"; import V from "./relative-delta.js"; const C = 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: [] } } }] } }), H = ({ constraint: e }) => { var i, m; const a = v(), { values: r } = n(), t = ((m = (i = r == null ? void 0 : r.openForms) == null ? void 0 : i[e]) == null ? void 0 : m.mode) || "", { errors: l, hasErrors: p } = c(`openForms.${e}`), { formType: s } = d(g); return s === "appointment" ? null : /* @__PURE__ */ u(y, { title: a.formatMessage(C[e], { configured: String(t !== "") }), collapsible: !0, initialCollapsed: !0, children: [ /* @__PURE__ */ o(M, { constraint: e }), t === "fixedValue" && /* @__PURE__ */ o(h, { constraint: e }), ["future", "past"].includes(t) && /* @__PURE__ */ o(F, { constraint: e }), t === "relativeToVariable" && /* @__PURE__ */ o(V, { constraint: e }), p && /* @__PURE__ */ o("div", { className: "formio-component has-error", children: /* @__PURE__ */ o(x, { errors: l }) }) ] }); }; export { H as default };