/** @license MIT | @cube-dev/ui-kit v0.127.1 | Cube Dev Team */
//#region src/utils/react/forwardRefWithGenerics.tsx
/**
* A helper for creating forwardRef components with generic types.
* This solves the issue where React's forwardRef doesn't work well with generic components,
* especially when props include required children from CollectionBase<T> or similar types.
*
* @example
* ```tsx
* function MySelect<T extends object>(
*   props: MySelectProps<T>,
*   ref: DOMRef<HTMLDivElement>
* ) {
*   // component implementation
*   return <div ref={ref}>...</div>;
* }
*
* const MySelectWithRef = forwardRefWithGenerics(MySelect);
*
* // Usage:
* <MySelectWithRef<ItemType> items={items} ref={myRef} />
* ```
*/
function forwardRefWithGenerics(component) {
	return function ComponentWithRef(props) {
		const { ref = null, ...otherProps } = props;
		return component(otherProps, ref);
	};
}

//#endregion
export { forwardRefWithGenerics };
//# sourceMappingURL=forwardRefWithGenerics.js.map