import type { ReactElement, HTMLAttributes, Ref } from "react";
import type SlDropdownElement from "@shoelace-style/shoelace/dist/components/dropdown/dropdown.js";
import {
SlShowEvent,
SlAfterShowEvent,
SlHideEvent,
SlAfterHideEvent,
} from "../events";
export type { SlDropdownElement };
export type SlDropdownShowEvent = SlShowEvent;
export type SlDropdownAfterShowEvent = SlAfterShowEvent;
export type SlDropdownHideEvent = SlHideEvent;
export type SlDropdownAfterHideEvent = SlAfterHideEvent;
export interface SlDropdownProps extends HTMLAttributes {
ref?: Ref;
/**
* Indicates whether or not the dropdown is open. You can toggle this attribute to show and hide the dropdown, or you
* can use the `show()` and `hide()` methods and this attribute will reflect the dropdown's open state.
*/
open?: boolean;
/**
* The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel
* inside of the viewport.
*/
placement?:
| "top"
| "top-start"
| "top-end"
| "bottom"
| "bottom-start"
| "bottom-end"
| "right"
| "right-start"
| "right-end"
| "left"
| "left-start"
| "left-end";
/**
* Disables the dropdown so the panel will not open.
*/
disabled?: boolean;
/**
* By default, the dropdown is closed when an item is selected. This attribute will keep it open instead. Useful for
* dropdowns that allow for multiple interactions.
*/
stayOpenOnSelect?: boolean;
/**
* The distance in pixels from which to offset the panel away from its trigger.
*/
distance?: number;
/**
* The distance in pixels from which to offset the panel along its trigger.
*/
skidding?: number;
/**
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
* `overflow: auto|scroll`. Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
*/
hoist?: boolean;
/**
* Syncs the popup width or height to that of the trigger element.
*/
sync?: "width" | "height" | "both" | undefined;
/**
* Emitted when the dropdown opens.
*/
onSlShow?: (event: SlDropdownShowEvent) => void;
/**
* Emitted when the dropdown opens.
*/
onSlShowCapture?: (event: SlDropdownShowEvent) => void;
/**
* Emitted after the dropdown opens and all animations are complete.
*/
onSlAfterShow?: (event: SlDropdownAfterShowEvent) => void;
/**
* Emitted after the dropdown opens and all animations are complete.
*/
onSlAfterShowCapture?: (event: SlDropdownAfterShowEvent) => void;
/**
* Emitted when the dropdown closes.
*/
onSlHide?: (event: SlDropdownHideEvent) => void;
/**
* Emitted when the dropdown closes.
*/
onSlHideCapture?: (event: SlDropdownHideEvent) => void;
/**
* Emitted after the dropdown closes and all animations are complete.
*/
onSlAfterHide?: (event: SlDropdownAfterHideEvent) => void;
/**
* Emitted after the dropdown closes and all animations are complete.
*/
onSlAfterHideCapture?: (event: SlDropdownAfterHideEvent) => void;
}
/**
* Dropdowns expose additional content that "drops down" in a panel.
*/
export default function SlDropdown(
props: SlDropdownProps,
): ReactElement;