import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; export type CarbonListBoxHighlightContext = ReturnType; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Set an id for the top-level element * @default uniqueId() */ id?: string; /** * Obtain a reference to the HTML element. * @default null */ ref?: null | HTMLDivElement; /** * Set to `true` to render the menu in a portal, * allowing it to escape containers with `overflow: hidden`. * @default false */ portal?: boolean; /** * Set to `true` to open the floating portal. * Only used when `portal` is `true`. * @default false */ open?: boolean; /** * Specify the anchor element to position the portal relative to. * Only used when `portal` is `true`. * @default null */ anchor?: null | HTMLElement; /** * Specify the direction of the menu. * Only used when `portal` is `true`. * @default "bottom" */ direction?: "bottom" | "top"; /** * Specify which edge of the field the menu lines up with when it is wider * than the field, as the inline `Dropdown` menu is. `"end"` opens the menu * toward the start side instead of past the field's end. * @default "start" */ align?: "start" | "end"; /** * Class applied to a wrapper element inside the portal. * Only used when `portal` is `true`. */ portalHostClass?: string | undefined; /** * Set to `true` to let an option's label wrap onto as many lines as it * needs instead of being truncated with an ellipsis. * @default false */ wrapOptions?: boolean; /** * DOM id of the highlighted option (`{instanceId}-{item.id}`). * Applied as a two-node class change so `{#each}` does not re-run * every `ListBoxMenuItem` on ArrowDown. */ highlightedId?: undefined | null | string; /** * When `false`, skip scrolling the highlighted option into view * (pointer hover already has the item on screen). * @default true */ highlightScroll?: boolean; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type ListBoxMenuProps = Omit<$RestProps, keyof $Props> & $Props; export default class ListBoxMenu extends SvelteComponentTyped< ListBoxMenuProps, { mouseleave: WindowEventMap["mouseleave"]; scroll: WindowEventMap["scroll"]; }, { default: Record } > {}