UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

68 lines (67 loc) 1.86 kB
import { jsxs as r, jsx as a } from "react/jsx-runtime"; import n from "clsx"; import { uniqueId as v } from "lodash"; import { useRef as x, useState as g } from "react"; import { useIntl as b } from "react-intl"; /* empty css */ import h from "./tooltip.js"; const M = ({ title: c, tooltip: t = "", collapsible: l = !1, initialCollapsed: d = !1, headerEnd: s, children: u }) => { const m = b(), o = x(v("panel_body")), [e, i] = g(d); !l && e && i(!1); const p = l ? { onClick: () => i(!e), role: "button", "aria-expanded": e ? "false" : "true", "aria-controls": o.current } : {}, f = m.formatMessage({ id: "iX0YPY", defaultMessage: [{ type: 5, value: "collapsed", options: { true: { value: [{ type: 0, value: "Expand panel" }] }, other: { value: [{ type: 0, value: "Collapse panel" }] } } }] }, { collapsed: e }); return /* @__PURE__ */ r("div", { className: "mb-2 card border", children: [ /* @__PURE__ */ r("div", { className: n("card-header", "bg-default", { "d-flex": !!s, "align-items-center": !!s }), children: [ /* @__PURE__ */ a("div", { className: "offb-panel-header-collapse-trigger", ...p, children: /* @__PURE__ */ r("span", { className: "mb-0 card-title", children: [ l ? /* @__PURE__ */ a("i", { className: n("formio-collapse-icon", "text-muted", "fa", "fa-regular", { "fa-plus-square": e, "fa-minus-square": !e }), title: f }) : null, c, t && " ", /* @__PURE__ */ a(h, { text: t }) ] }) }), s ] }), e ? null : /* @__PURE__ */ a("div", { className: "card-body", id: o.current, children: u }) ] }); }; export { M as default };