@adyen/adyen-platform-experience-web
Version:

47 lines (46 loc) • 1.75 kB
JavaScript
import { jsx as e } from "../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js";
import d from "classnames";
import { useState as C, useRef as m, useCallback as h } from "../../../external/preact/hooks/dist/hooks.module.js";
import A from "../SVGIcons/ChevronDown.js";
import N from "../SVGIcons/ChevronUp.js";
import { ACCORDION_BASE_CLASS as O, ACCORDION_HEADER_CLASS as p, ACCORDION_HEADER_CONTAINER_CLASS as E, ACCORDION_HEADER_CONTROLLER_CLASS as S, ACCORDION_CONTENT_CLASS as _ } from "./constants.js";
/* empty css */
function L({ children: a, classNames: c, header: n, headerInformation: i }) {
var t;
const [o, l] = C(!1), r = m(null), s = h(() => {
l(!o);
}, [o]);
return /* @__PURE__ */ e("div", { className: d(O, c), children: [
/* @__PURE__ */ e("h3", { className: p, children: [
/* @__PURE__ */ e(
"button",
{
id: "accordion-controller",
"aria-controls": "accordion-content",
className: E,
onClick: s,
"aria-expanded": o,
children: /* @__PURE__ */ e("div", { className: S, children: [
n,
o ? /* @__PURE__ */ e(N, { height: 8, width: 15 }) : /* @__PURE__ */ e(A, { height: 8, width: 15 })
] })
}
),
i && /* @__PURE__ */ e("div", { children: i })
] }),
/* @__PURE__ */ e(
"div",
{
role: "region",
id: "accordion-content",
"aria-labelledby": "accordion-controller",
style: { maxHeight: o ? (t = r == null ? void 0 : r.current) == null ? void 0 : t.offsetHeight : 0 },
className: _,
children: /* @__PURE__ */ e("div", { ref: r, children: a })
}
)
] });
}
export {
L as default
};