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

58 lines (57 loc) • 2.4 kB
JavaScript
import { jsx as t } from "../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js";
/* empty css */
import { uniqueId as h } from "../../../utils/random/uniqueId.js";
import e from "../Typography/Typography.js";
import { TypographyVariant as i } from "../Typography/types.js";
import v from "../../../core/Context/useCoreContext.js";
import x from "classnames";
import A from "../Slider/Slider.js";
const Y = ({
dynamicOffersConfig: a,
value: p = a.minAmount.value,
onValueChange: l,
onRelease: m,
className: d
}) => {
const n = h(), { i18n: r } = v(), s = (u) => {
const c = Number(u.target.value);
l == null || l(c);
}, o = (u) => {
const c = Number(u.target.value);
m == null || m(c);
};
return /* @__PURE__ */ t("div", { className: x("adyen-pe-capital-slider", d), children: [
/* @__PURE__ */ t("label", { htmlFor: n, className: "adyen-pe-capital-slider__label", children: /* @__PURE__ */ t(e, { variant: i.BODY, stronger: !0, children: r.get("capital.howMuchMoneyDoYouNeed") }) }),
/* @__PURE__ */ t("div", { children: [
/* @__PURE__ */ t("output", { htmlFor: n, className: "adyen-pe-capital-slider__value", "aria-live": "polite", children: /* @__PURE__ */ t(e, { variant: i.TITLE, strongest: !0, children: r.amount(p, a.minAmount.currency, { maximumFractionDigits: 0 }) }) }),
/* @__PURE__ */ t(
A,
{
id: n,
value: p,
min: a.minAmount.value,
max: a.maxAmount.value,
step: a.step,
onChange: s,
onMouseUp: o,
onTouchEnd: o,
onKeyUp: o,
className: "adyen-pe-capital-slider__input"
}
)
] }),
/* @__PURE__ */ t("div", { className: "adyen-pe-capital-slider__labels", children: [
/* @__PURE__ */ t("label", { children: [
/* @__PURE__ */ t(e, { variant: i.CAPTION, children: r.get("min") }),
/* @__PURE__ */ t(e, { variant: i.BODY, children: r.amount(a.minAmount.value, a.minAmount.currency, { maximumFractionDigits: 0 }) })
] }),
/* @__PURE__ */ t("label", { children: [
/* @__PURE__ */ t(e, { variant: i.CAPTION, children: r.get("max") }),
/* @__PURE__ */ t(e, { variant: i.BODY, children: r.amount(a.maxAmount.value, a.maxAmount.currency, { maximumFractionDigits: 0 }) })
] })
] })
] });
};
export {
Y as default
};