// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly. import { registerTableHandleRowPositionerElement, type TableHandleRowPositionerElement, type TableHandleRowPositionerProps as TableHandleRowPositionerElementProps } from '@prosekit/web/table-handle'; import { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react'; import { useEditorContext } from '../../contexts/editor-context.ts'; /** Props for the {@link TableHandleRowPositioner} React component. */ export interface TableHandleRowPositionerProps { /** * The placement of the popover, relative to the hovered table cell. * * @default "left" */ placement?: TableHandleRowPositionerElementProps['placement']; /** * The strategy to use for positioning * * @default "absolute" */ strategy?: TableHandleRowPositionerElementProps['strategy']; /** * Options to activate auto-update listeners * * @see https://floating-ui.com/docs/autoUpdate * * @default true */ autoUpdate?: TableHandleRowPositionerElementProps['autoUpdate']; /** * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) * to place the floating element on top of other page content. * * @default false */ hoist?: TableHandleRowPositionerElementProps['hoist']; /** * @default 0 * @hidden */ offset?: TableHandleRowPositionerElementProps['offset']; /** * @default false * @hidden */ flip?: TableHandleRowPositionerElementProps['flip']; /** * @default false * @hidden */ shift?: TableHandleRowPositionerElementProps['shift']; /** * Whether the floating element can overlap the reference element to keep it * in view. * * @default false */ overlap?: TableHandleRowPositionerElementProps['overlap']; /** * Whether to constrain the floating element's width and height to not exceed * the viewport. * * @default false */ fitViewport?: TableHandleRowPositionerElementProps['fitViewport']; /** * Whether to constrain the floating element's width so that it matches the * reference element. * * @default false */ sameWidth?: TableHandleRowPositionerElementProps['sameWidth']; /** * Whether to constrain the floating element's height so that it matches the * reference element. * * @default false */ sameHeight?: TableHandleRowPositionerElementProps['sameHeight']; /** * Whether to improve positioning for inline reference elements that span over * multiple lines. * * @default false */ inline?: TableHandleRowPositionerElementProps['inline']; /** * @default true * @hidden */ hide?: TableHandleRowPositionerElementProps['hide']; /** * Describes the clipping element(s) or area that overflow will be checked relative to. * Please see https://floating-ui.com/docs/detectoverflow#boundary for more information. * * @default 'clippingAncestors' */ boundary?: TableHandleRowPositionerElementProps['boundary']; /** * Describes the root boundary that the element will be checked for overflow relative to. * Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information. * * @default 'viewport' */ rootBoundary?: TableHandleRowPositionerElementProps['rootBoundary']; /** * Describes the virtual padding around the boundary to check for overflow. * Please see https://floating-ui.com/docs/detectoverflow#padding for more information. * * @default 4 */ overflowPadding?: TableHandleRowPositionerElementProps['overflowPadding']; /** * The element that will be used to check for overflow. Please see * https://floating-ui.com/docs/detectoverflow#elementcontext for more * information. * * @default 'floating' */ elementContext?: TableHandleRowPositionerElementProps['elementContext']; /** * Whether to check the alternate elementContext's boundary. Please see * https://floating-ui.com/docs/detectoverflow#altboundary for more * information. * * @default false */ altBoundary?: TableHandleRowPositionerElementProps['altBoundary']; /** * The ProseKit editor instance. * * @default null * @hidden */ editor?: TableHandleRowPositionerElementProps['editor']; } function TableHandleRowPositionerComponent(props: TableHandleRowPositionerProps, forwardedRef: ForwardedRef) { registerTableHandleRowPositionerElement(); const elementRef = useRef(null); const p3Fallback = useEditorContext(); const { altBoundary: p0, autoUpdate: p1, boundary: p2, editor: p3, elementContext: p4, fitViewport: p5, flip: p6, hide: p7, hoist: p8, inline: p9, offset: p10, overflowPadding: p11, overlap: p12, placement: p13, rootBoundary: p14, sameHeight: p15, sameWidth: p16, shift: p17, strategy: p18, ...restProps } = props; useLayoutEffect(() => { const element = elementRef.current as Record | null; if (!element) return; Object.assign(element, { altBoundary: p0, autoUpdate: p1, boundary: p2, editor: p3 ?? p3Fallback, elementContext: p4, fitViewport: p5, flip: p6, hide: p7, hoist: p8, inline: p9, offset: p10, overflowPadding: p11, overlap: p12, placement: p13, rootBoundary: p14, sameHeight: p15, sameWidth: p16, shift: p17, strategy: p18, }); }); const mergedRef = useCallback( (element: TableHandleRowPositionerElement | null) => { elementRef.current = element; if (typeof forwardedRef === 'function') { forwardedRef(element); } else if (forwardedRef) { forwardedRef.current = element; } }, [forwardedRef], ); return createElement('prosekit-table-handle-row-positioner', { ...restProps, ref: mergedRef, suppressHydrationWarning: true }); } /** A React component that renders an `prosekit-table-handle-row-positioner` custom element. */ export const TableHandleRowPositioner: ForwardRefExoticComponent & RefAttributes> = /* @__PURE__ */ forwardRef(TableHandleRowPositionerComponent);