UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

103 lines (102 loc) 4.13 kB
import { jsxs as o, Fragment as f, jsx as t } from "react/jsx-runtime"; import { useFormikContext as u } from "formik"; import { useContext as s } from "react"; import { useIntl as h, FormattedMessage as i } from "react-intl"; import "../../formio/tabs.js"; import "clsx"; /* empty css */ import "@floating-ui/react"; /* empty css */ import { TextFieldMultiple as y } from "../../formio/textfield.js"; import "../../formio/datefield.js"; import "../../formio/datetimefield.js"; import "../../formio/timefield.js"; /* empty css */ import "react-select"; import "dompurify"; import { TextAreaMultiple as _ } from "../../formio/textarea.js"; import "../../formio/datagrid.js"; /* empty css */ import { BuilderContext as v } from "../../../context.js"; import { ComponentTranslationsContext as g } from "../i18n.js"; function z({ name: a, withOptionDescription: d }) { const c = h(), { activeLanguage: r } = s(g), { getFieldProps: m } = u(), { value: p = [] } = m(a), { formType: b } = s(v); return b === "appointment" ? null : ( // Same markup as ComponentTranslations<S> body /* @__PURE__ */ o(f, { children: [ /* @__PURE__ */ o("tbody", { children: [ /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("th", { colSpan: 3, style: { textAlign: "end" }, children: /* @__PURE__ */ t(i, { id: "kg/eh1", defaultMessage: [{ type: 0, value: "Choice/option translations" }] }) }) }), p.map(({ value: l, label: n }, e) => /* @__PURE__ */ o("tr", { children: [ /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("span", { id: `option-${e}-label`, className: "offb-table__content offb-table__content--allow-break", children: n }) }), /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("div", { "aria-describedby": `option-${e}-label`, className: "offb-table__content offb-table__content--allow-break", children: l || "-" }) }), /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t(y, { name: `${a}[${e}]openForms.translations.${r}.label`, "aria-label": c.formatMessage({ id: "wOq8Pb", defaultMessage: [{ type: 0, value: 'Translation for option with value "' }, { type: 1, value: "value" }, { type: 0, value: '"' }] }, { value: l }) }) }) ] }, `option-${e}`)) ] }), d && /* @__PURE__ */ o("tbody", { children: [ /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("th", { colSpan: 3, style: { textAlign: "end" }, children: /* @__PURE__ */ t(i, { id: "aqYeqv", defaultMessage: [{ type: 0, value: "Description translations" }] }) }) }), p.map(({ description: l, value: n }, e) => /* @__PURE__ */ o("tr", { children: [ /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("span", { id: `option-${e}-label`, children: /* @__PURE__ */ t(i, { id: "NdaqDN", defaultMessage: [{ type: 0, value: "Option description (" }, { type: 8, value: "option", children: [] }, { type: 0, value: ")" }], values: { option: () => /* @__PURE__ */ t("code", { className: "offb-table__content offb-table__content--allow-break", children: n || "-" }) } }) }) }), /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("div", { "aria-describedby": `option-${e}-label`, className: "offb-table__content offb-table__content--allow-break", children: l || "-" }) }), /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t(_, { name: `${a}[${e}]openForms.translations.${r}.description`, "aria-labelledby": `option-${e}-label` }) }) ] }, `option-description-${e}`)) ] }) ] }) ); } export { z as ValuesTranslations, z as default };