// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly. import { registerResizableHandleElement, type ResizableHandleElement, type ResizableHandleProps as ResizableHandleElementProps } from '@prosekit/web/resizable'; import { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react'; /** Props for the {@link ResizableHandle} React component. */ export interface ResizableHandleProps { /** * The position of the handle. * * @default "bottom-right" */ position?: ResizableHandleElementProps['position']; } function ResizableHandleComponent(props: ResizableHandleProps, forwardedRef: ForwardedRef) { registerResizableHandleElement(); const elementRef = useRef(null); const { position: p0, ...restProps } = props; useLayoutEffect(() => { const element = elementRef.current as Record | null; if (!element) return; Object.assign(element, { position: p0 }); }); const mergedRef = useCallback( (element: ResizableHandleElement | null) => { elementRef.current = element; if (typeof forwardedRef === 'function') { forwardedRef(element); } else if (forwardedRef) { forwardedRef.current = element; } }, [forwardedRef], ); return createElement('prosekit-resizable-handle', { ...restProps, ref: mergedRef, suppressHydrationWarning: true }); } /** A React component that renders an `prosekit-resizable-handle` custom element. */ export const ResizableHandle: ForwardRefExoticComponent & RefAttributes> = /* @__PURE__ */ forwardRef(ResizableHandleComponent);