/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

require("../../../_virtual/_rolldown/runtime.js");
let react = require("react");
//#region src/global/js/hooks/useOverflowString.ts
/**
* Copyright IBM Corp. 2025, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
function useOverflowStringWidth(elementRef) {
	const innerText = elementRef?.current?.innerText;
	const [isOverflowing, setIsOverflowing] = (0, react.useState)();
	const checkWidthOverflow = (0, react.useCallback)(() => {
		const offsetWidth = elementRef?.current?.offsetWidth;
		const scrollWidth = elementRef?.current?.scrollWidth;
		if (offsetWidth && scrollWidth) setIsOverflowing(offsetWidth < scrollWidth);
	}, [elementRef]);
	(0, react.useEffect)(() => {
		checkWidthOverflow();
	}, [
		checkWidthOverflow,
		elementRef,
		innerText
	]);
	return isOverflowing;
}
//#endregion
exports.useOverflowStringWidth = useOverflowStringWidth;
