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

50 lines (49 loc) • 1.48 kB
JavaScript
import { jsx as l } from "../../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { ButtonVariant as m } from "../../Button/types.js";
import { useCallback as f } from "../../../../external/preact/hooks/dist/hooks.module.js";
import c from "../../SVGIcons/ChevronDown.js";
import p from "../../SVGIcons/ChevronUp.js";
import d from "../../../../core/Context/useCoreContext.js";
import C from "../../../../hooks/element/useDetachedRender.js";
import b from "../../Button/Button.js";
import { isFunction as h } from "../../../../utils/value/is.js";
const w = (e) => {
const { i18n: a } = d();
return C(
f(
(u, r, t) => {
if (!(u instanceof HTMLElement)) return null;
if (h(e)) return e(r, t);
let o, i, n;
switch (r) {
case "PREV":
o = "prev", i = "previous", n = p;
break;
case "NEXT":
o = i = "next", n = c;
break;
default:
return null;
}
const s = t();
return s ? /* @__PURE__ */ l(
b,
{
"aria-label": a.get(`calendar.${i}Month`),
variant: m.TERTIARY,
disabled: !s,
classNameModifiers: ["circle", o],
iconButton: !0,
onClick: t,
children: /* @__PURE__ */ l(n, { role: "presentation" })
},
r
) : null;
},
[a, e]
)
);
};
export {
w as default
};