// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly. import { registerAutocompletePositionerElement, type AutocompletePositionerElement, type AutocompletePositionerProps as AutocompletePositionerElementProps } from "@prosekit/web/autocomplete"; 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 AutocompletePositioner} Solid component. */ export interface AutocompletePositionerProps { /** * The placement of the popover, relative to the text cursor. * * @default "bottom-start" */ placement?: AutocompletePositionerElementProps['placement']; /** * The distance between the popover and the text selection. * * @default { mainAxis: 8, crossAxis: -4 } */ offset?: AutocompletePositionerElementProps['offset']; /** * Whether to hide the floating element when the reference element or the * floating element is fully clipped. * * @default true */ hide?: AutocompletePositionerElementProps['hide']; /** @default true */ inline?: AutocompletePositionerElementProps['inline']; /** @default true */ hoist?: AutocompletePositionerElementProps['hoist']; /** @default true */ fitViewport?: AutocompletePositionerElementProps['fitViewport']; /** @default "The body element" */ boundary?: AutocompletePositionerElementProps['boundary']; /** @default 8 */ overflowPadding?: AutocompletePositionerElementProps['overflowPadding']; /** * The strategy to use for positioning * * @default "absolute" */ strategy?: AutocompletePositionerElementProps['strategy']; /** * Options to activate auto-update listeners * * @see https://floating-ui.com/docs/autoUpdate * * @default true */ autoUpdate?: AutocompletePositionerElementProps['autoUpdate']; /** * 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?: AutocompletePositionerElementProps['flip']; /** * Whether the floating element should shift to keep it in view. * * @default true */ shift?: AutocompletePositionerElementProps['shift']; /** * Whether the floating element can overlap the reference element to keep it * in view. * * @default false */ overlap?: AutocompletePositionerElementProps['overlap']; /** * Whether to constrain the floating element's width so that it matches the * reference element. * * @default false */ sameWidth?: AutocompletePositionerElementProps['sameWidth']; /** * Whether to constrain the floating element's height so that it matches the * reference element. * * @default false */ sameHeight?: AutocompletePositionerElementProps['sameHeight']; /** * 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?: AutocompletePositionerElementProps['rootBoundary']; /** * 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?: AutocompletePositionerElementProps['elementContext']; /** * Whether to check the alternate elementContext's boundary. Please see * https://floating-ui.com/docs/detectoverflow#altboundary for more * information. * * @default false */ altBoundary?: AutocompletePositionerElementProps['altBoundary']; } /** A Solid component that renders an `prosekit-autocomplete-positioner` custom element. */ export const AutocompletePositioner: Component> = (props): any => { registerAutocompletePositionerElement() 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-autocomplete-positioner', mergeProps(restProps, { ref: (el: AutocompletePositionerElement | null ) => { setElement(el) }, }), ) };