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

32 lines (31 loc) • 900 B
JavaScript
import { jsx as u } from "../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useMemo as n } from "../../../external/preact/hooks/dist/hooks.module.js";
/* empty css */
import { calculateProgress as f } from "./calculateProgress.js";
import l from "classnames";
function j(r, t, o) {
const s = t / 2;
let e = Math.round(s / o) * o;
return e < r ? e = r : e > t && (e = t), e;
}
const y = ({ min: r = 0, max: t = 100, step: o = 1, value: s = r, onChange: e, className: d, ...i }) => {
const c = n(() => f(s, r, t, o), [s, r, t, o]);
return /* @__PURE__ */ u(
"input",
{
type: "range",
className: l("adyen-pe-slider", d),
min: r,
max: t,
step: o,
value: s,
onChange: e,
style: { backgroundSize: `${c}% 100%` },
...i
}
);
};
export {
j as calculateSliderAdjustedMidValue,
y as default
};