// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly. import { registerPopoverPositionerElement, type PopoverPositionerElement, type PopoverPositionerProps as PopoverPositionerElementProps } from "@prosekit/web/popover"; import { createEffect, createSignal, mergeProps, splitProps } from "solid-js"; import type { Component, JSX } from "solid-js"; import h from "solid-js/h"; /** Props for the {@link PopoverPositioner} Solid component. */ export interface PopoverPositionerProps { /** * The strategy to use for positioning * * @default "absolute" */ strategy?: PopoverPositionerElementProps['strategy']; /** * The initial placement of the floating element * * @default "top" */ placement?: PopoverPositionerElementProps['placement']; /** * Options to activate auto-update listeners * * @see https://floating-ui.com/docs/autoUpdate * * @default true */ autoUpdate?: PopoverPositionerElementProps['autoUpdate']; /** * Whether to use the browser Popover API to place the floating element on * top of other page content. * * @default true */ hoist?: PopoverPositionerElementProps['hoist']; /** * The distance between the reference and floating element. * * @default 6 */ offset?: PopoverPositionerElementProps['offset']; /** * Whether to flip the `placement` in order to keep it in view when the * preferred placement(s) will overflow the clipping boundary. You can also * provide an array of placements to try sequentially if the preferred * `placement` does not fit. * * @default true */ flip?: PopoverPositionerElementProps['flip']; /** * Whether the floating element should shift to keep it in view. * * @default true */ shift?: PopoverPositionerElementProps['shift']; /** * Whether the floating element can overlap the reference element to keep it * in view. * * @default false */ overlap?: PopoverPositionerElementProps['overlap']; /** * Whether to constrain the floating element's width and height to not exceed * the viewport. * * @default false */ fitViewport?: PopoverPositionerElementProps['fitViewport']; /** * Whether to constrain the floating element's width so that it matches the * reference element. * * @default false */ sameWidth?: PopoverPositionerElementProps['sameWidth']; /** * Whether to constrain the floating element's height so that it matches the * reference element. * * @default false */ sameHeight?: PopoverPositionerElementProps['sameHeight']; /** * Whether to improve positioning for inline reference elements that span over * multiple lines. * * @default false */ inline?: PopoverPositionerElementProps['inline']; /** * Whether to hide the floating element when the reference element or the * floating element is fully clipped. * * @default false */ hide?: PopoverPositionerElementProps['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?: PopoverPositionerElementProps['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?: PopoverPositionerElementProps['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?: PopoverPositionerElementProps['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?: PopoverPositionerElementProps['elementContext']; /** * Whether to check the alternate elementContext's boundary. Please see * https://floating-ui.com/docs/detectoverflow#altboundary for more * information. * * @default false */ altBoundary?: PopoverPositionerElementProps['altBoundary']; } /** A Solid component that renders an `prosekit-popover-positioner` custom element. */ export const PopoverPositioner: Component> = (props): any => { registerPopoverPositionerElement() const [getElement, setElement] = createSignal(null) const [ elementProps, restProps ] = splitProps(props, ["altBoundary","autoUpdate","boundary","elementContext","fitViewport","flip","hide","hoist","inline","offset","overflowPadding","overlap","placement","rootBoundary","sameHeight","sameWidth","shift","strategy"]) createEffect(() => { const element = getElement() if (!element) return Object.assign(element, { altBoundary: elementProps.altBoundary, autoUpdate: elementProps.autoUpdate, boundary: elementProps.boundary, elementContext: elementProps.elementContext, fitViewport: elementProps.fitViewport, flip: elementProps.flip, hide: elementProps.hide, hoist: elementProps.hoist, inline: elementProps.inline, offset: elementProps.offset, overflowPadding: elementProps.overflowPadding, overlap: elementProps.overlap, placement: elementProps.placement, rootBoundary: elementProps.rootBoundary, sameHeight: elementProps.sameHeight, sameWidth: elementProps.sameWidth, shift: elementProps.shift, strategy: elementProps.strategy }) }) return () => h( 'prosekit-popover-positioner', mergeProps(restProps, { ref: (el: PopoverPositionerElement | null ) => { setElement(el) }, }), ) };