UNPKG

@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) 911 B
/** * @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 u from "react"; function c(t, e, n) { const [d, i] = u.useState(e); return u.useEffect(() => { d !== void 0 && t.current && i(t.current.offsetWidth); }, n), d; } function r(t) { return typeof t == "string" ? Number(t.replace("px", "")) : t; } function W(t, e, n, d) { const i = r(e.popupSettings.width), s = (n.width !== void 0 && r(n.width)) !== i, h = d.width !== void 0, p = s ? n.width : h ? d.width : i, o = r(c(t, p)); return s || h ? p : o && i && o > i ? o : i; } export { W as useDropdownWidth };