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

48 lines (47 loc) • 1.76 kB
JavaScript
import { jsx as e } from "../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import p from "classnames";
import a from "../Typography/Typography.js";
import c, { ComponentHeadingType as l } from "../../../hooks/useComponentHeadingElement.js";
import { TypographyVariant as h, TypographyElement as s } from "../Typography/types.js";
import { Divider as S } from "../Divider/Divider.js";
/* empty css */
import I from "../../../core/Context/preact/useCoreContext.js";
const $ = "adyen-pe-header", j = ({
baseClassName: r = $,
forwardedToRoot: t = !0,
children: n,
className: E,
hasDivider: T,
hideTitle: _,
titleKey: m,
subtitleKey: o,
subtitleConfig: i,
...f
}) => {
const { i18n: d } = I(), { id: v, ref: y } = c({
headingType: l.TITLE,
forwardedToRoot: t
}), { id: g, ref: u } = c({
headingType: l.SUBTITLE,
forwardedToRoot: t
});
return /* @__PURE__ */ e("div", { ...f, className: p([r, E]), children: [
/* @__PURE__ */ e("div", { className: `${r}__headings`, children: [
!_ && m && /* @__PURE__ */ e("div", { ref: y, id: v, className: `${r}__title`, children: /* @__PURE__ */ e(a, { el: s.SPAN, variant: h.TITLE, medium: !0, children: d.get(m) }) }),
o && /* @__PURE__ */ e("div", { ref: u, id: g, className: p(`${r}__subtitle`, i?.classNames), children: /* @__PURE__ */ e(
a,
{
el: i?.typographyEl ?? s.SPAN,
variant: i?.variant ?? h.BODY,
children: d.get(o)
}
) }),
T && /* @__PURE__ */ e(S, { className: `${r}__divider` })
] }),
n && /* @__PURE__ */ e("div", { className: `${r}__controls`, children: n })
] });
};
export {
$ as BASE_CLASS,
j as Header
};