@progress/kendo-react-dropdowns
Version:
React DropDowns offer an interface for users to select different items from a list and more. KendoReact Dropdowns package
25 lines (24 loc) • 921 B
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import * as c from "react";
function u(t, o, n) {
const [d, i] = c.useState(o);
return c.useEffect(() => {
d !== void 0 && t.current && i(t.current.offsetWidth);
}, n), d;
}
function r(t) {
return typeof t == "string" ? Number(t.replace("px", "")) : t || void 0;
}
function W(t, o, n, d) {
const i = r(o.popupSettings.width), s = (n.width !== void 0 && r(n.width)) !== i, h = d.width !== void 0, p = s ? n.width : h ? d.width : i, e = r(u(t, p));
return s || h ? p : e && i && e > i ? e : i;
}
export {
W as useDropdownWidth
};