import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Set to `true` to display the popover. * @default false */ open?: boolean; /** * Set to `true` to close the popover on an outside click * @default false */ closeOnOutsideClick?: boolean; /** * Set to `true` to close the popover on the Escape key * @default false */ closeOnEscape?: boolean; /** * Set to `true` render a caret * @default false */ caret?: boolean; /** * Specify the alignment of the caret. * Prefer the Carbon v11 names (`"top-start"`, `"left-end"`, and so on). * On the top and bottom, `start` and `end` name inline sides, so they swap * under `dir="rtl"`. The older names (`"top-left"`, `"left-bottom"`, and so * on) still work and name physical sides, so they keep their place in RTL. * @default "top" */ align?: "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top"; /** * Set to `false` to remove the drop shadow * @default true */ dropShadow?: boolean; /** * Set to `true` to draw a 1px border around the popover and its caret * @default false */ border?: boolean; /** * Set to `true` to enable the high contrast variant * @default false */ highContrast?: boolean; /** * Set to `true` to use a relative position * @default false */ relative?: boolean; /** * Set to `true` to always render the popover in a portal, or `false` to * keep it in place. Left unset, it renders in place and moves to a portal * for an open when a box around it (`overflow` other than `visible`) would * cut it off. A `relative` popover stays in place. */ portalPopover?: boolean | undefined; /** * Obtain a reference to the popover element. * In a portal, this is the portalled element. * @default null */ ref?: null | HTMLDivElement; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type PopoverProps = Omit<$RestProps, keyof $Props> & $Props; export default class Popover extends SvelteComponentTyped< PopoverProps, { "click:outside": CustomEvent<{ target: HTMLElement; }>; close: CustomEvent<{ trigger: "outside-click" | "escape-key"; }>; }, { default: Record } > {}