UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

58 lines (57 loc) 1.67 kB
import { jsx as i } from "react/jsx-runtime"; import { useFormikContext as f } from "formik"; import { useContext as d } from "react"; import { useIntl as c, FormattedMessage as g } from "react-intl"; import { BuilderContext as h } from "../../context.js"; import { hasOwnProperty as C } from "../../types/index.js"; import "../formio/tabs.js"; import "clsx"; /* empty css */ import "@floating-ui/react"; /* empty css */ import "../formio/textfield.js"; import V from "../formio/checkbox.js"; import "../formio/datefield.js"; import "../formio/datetimefield.js"; import "../formio/timefield.js"; /* empty css */ import "react-select"; import "dompurify"; import "../formio/textarea.js"; import "../formio/datagrid.js"; /* empty css */ const v = (t) => C(t, "defaultValue"); function K({ updateDefaultValue: t = !0 }) { const l = c(), { values: o, getFieldProps: m, setFieldValue: a } = f(), { onChange: n } = m("multiple"), { formType: p } = d(h), u = l.formatMessage({ id: "WDRqIp", defaultMessage: [{ type: 0, value: "Are there multiple values possible for this field?" }] }); return p === "appointment" ? null : /* @__PURE__ */ i(V, { name: "multiple", label: /* @__PURE__ */ i(g, { id: "7XdV9f", defaultMessage: [{ type: 0, value: "Multiple values" }] }), tooltip: u, onChange: (r) => { if (n(r), !t || !v(o)) return; const { defaultValue: e } = o; if (e === void 0) return; const s = r.target.checked ? [e] : e[0]; a("defaultValue", s); } }); } export { K as default };