@progress/kendo-react-buttons
Version:
All you need in React Button in one package: disabled/enabled states, built-in styles and more. KendoReact Buttons package
46 lines (45 loc) • 2.05 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
const s = "16px", i = (o) => typeof o == "number" ? o + "px" : o, y = (o, r) => {
const t = { horizontal: r ? "right" : "left", vertical: "bottom" };
return o.horizontal === "end" && (t.horizontal = r ? "left" : "right"), t;
}, x = (o, r) => {
const t = { horizontal: r ? "right" : "left", vertical: "top" };
return o.horizontal === "end" && (t.horizontal = r ? "left" : "right"), t;
}, b = (o, r) => {
const t = r === "end" ? "end" : "start";
return {
rtl: { end: "k-text-left", start: "k-text-right" },
ltr: { start: "k-text-left", end: "k-text-right" }
}[o][t];
}, m = (o, r, t, c) => {
const n = r.horizontal, e = r.vertical;
if (o.current) {
const l = t && t.x !== void 0 ? i(t.x) : s, d = t && t.x !== void 0 ? `calc(50% + ${i(t.x)})` : "50%", h = t && t.y !== void 0 ? i(t.y) : s, u = t && t.y !== void 0 ? `calc(50% + ${i(t.y)})` : "50%";
o.current.style.setProperty(a(r, c), n === "center" ? d : l), o.current.style.setProperty(p(r), e === "middle" ? u : h), c && ((e === "top" || e === "bottom") && n === "start" && o.current.style.setProperty("left", "unset"), e === "middle" && n === "end" && o.current.style.setProperty("right", "unset"), e === "middle" && n === "start" && o.current.style.setProperty("left", "unset"));
}
}, a = (o, r) => {
const { horizontal: t } = o;
return {
end: r ? "left" : "right",
center: "left",
start: r ? "right" : "left"
}[t || "end"];
}, p = (o) => ({
top: "top",
middle: "top",
bottom: "bottom"
})[o.vertical || "bottom"];
export {
s as DEFAULT_OFFSET,
y as getAnchorAlign,
x as getPopupAlign,
b as getTextDirectionClass,
m as position,
i as toStringValues
};