import type { ReactElement, HTMLAttributes, Ref } from "react"; import type SlSelectElement from "@shoelace-style/shoelace/dist/components/select/select.js"; import { SlChangeEvent, SlClearEvent, SlInputEvent, SlFocusEvent, SlBlurEvent, SlShowEvent, SlAfterShowEvent, SlHideEvent, SlAfterHideEvent, SlInvalidEvent, } from "../events"; export type { SlSelectElement }; export type SlSelectChangeEvent = SlChangeEvent; export type SlSelectClearEvent = SlClearEvent; export type SlSelectInputEvent = SlInputEvent; export type SlSelectFocusEvent = SlFocusEvent; export type SlSelectBlurEvent = SlBlurEvent; export type SlSelectShowEvent = SlShowEvent; export type SlSelectAfterShowEvent = SlAfterShowEvent; export type SlSelectHideEvent = SlHideEvent; export type SlSelectAfterHideEvent = SlAfterHideEvent; export type SlSelectInvalidEvent = SlInvalidEvent; export interface SlSelectProps extends HTMLAttributes { ref?: Ref; /** * The name of the select, submitted as a name/value pair with form data. */ name?: string; /** * The default value of the form control. Primarily used for resetting the form control. */ value?: string | string[]; /** * The select's size. */ size?: "small" | "medium" | "large"; /** * Placeholder text to show as a hint when the select is empty. */ placeholder?: string; /** * Allows more than one option to be selected. */ multiple?: boolean; /** * The maximum number of selected options to show when `multiple` is true. After the maximum, "+n" will be shown to * indicate the number of additional items that are selected. Set to 0 to remove the limit. */ maxOptionsVisible?: number; /** * Disables the select control. */ disabled?: boolean; /** * Adds a clear button when the select is not empty. */ clearable?: boolean; /** * Indicates whether or not the select is open. You can toggle this attribute to show and hide the menu, or you can * use the `show()` and `hide()` methods and this attribute will reflect the select's open state. */ open?: boolean; /** * Enable this option to prevent the listbox 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; /** * Draws a filled select. */ filled?: boolean; /** * Draws a pill-style select with rounded edges. */ pill?: boolean; /** * The select's label. If you need to display HTML, use the `label` slot instead. */ label?: string; /** * The preferred placement of the select's menu. Note that the actual placement may vary as needed to keep the listbox * inside of the viewport. */ placement?: "top" | "bottom"; /** * The select's help text. If you need to display HTML, use the `help-text` slot instead. */ helpText?: string; /** * By default, form controls are associated with the nearest containing `
` element. This attribute allows you * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in * the same document or shadow root for this to work. */ form?: string; /** * The select's required attribute. */ required?: boolean; /** * A function that customizes the tags to be rendered when multiple=true. The first argument is the option, the second * is the current tag's index. The function should return either a Lit TemplateResult or a string containing trusted HTML of the symbol to render at * the specified value. */ getTag?: ( option: SlOption, index: number, ) => TemplateResult | string | HTMLElement; /** * Emitted when the control's value changes. */ onSlChange?: (event: SlSelectChangeEvent) => void; /** * Emitted when the control's value changes. */ onSlChangeCapture?: (event: SlSelectChangeEvent) => void; /** * Emitted when the control's value is cleared. */ onSlClear?: (event: SlSelectClearEvent) => void; /** * Emitted when the control's value is cleared. */ onSlClearCapture?: (event: SlSelectClearEvent) => void; /** * Emitted when the control receives input. */ onSlInput?: (event: SlSelectInputEvent) => void; /** * Emitted when the control receives input. */ onSlInputCapture?: (event: SlSelectInputEvent) => void; /** * Emitted when the control gains focus. */ onSlFocus?: (event: SlSelectFocusEvent) => void; /** * Emitted when the control gains focus. */ onSlFocusCapture?: (event: SlSelectFocusEvent) => void; /** * Emitted when the control loses focus. */ onSlBlur?: (event: SlSelectBlurEvent) => void; /** * Emitted when the control loses focus. */ onSlBlurCapture?: (event: SlSelectBlurEvent) => void; /** * Emitted when the select's menu opens. */ onSlShow?: (event: SlSelectShowEvent) => void; /** * Emitted when the select's menu opens. */ onSlShowCapture?: (event: SlSelectShowEvent) => void; /** * Emitted after the select's menu opens and all animations are complete. */ onSlAfterShow?: (event: SlSelectAfterShowEvent) => void; /** * Emitted after the select's menu opens and all animations are complete. */ onSlAfterShowCapture?: (event: SlSelectAfterShowEvent) => void; /** * Emitted when the select's menu closes. */ onSlHide?: (event: SlSelectHideEvent) => void; /** * Emitted when the select's menu closes. */ onSlHideCapture?: (event: SlSelectHideEvent) => void; /** * Emitted after the select's menu closes and all animations are complete. */ onSlAfterHide?: (event: SlSelectAfterHideEvent) => void; /** * Emitted after the select's menu closes and all animations are complete. */ onSlAfterHideCapture?: (event: SlSelectAfterHideEvent) => void; /** * Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ onSlInvalid?: (event: SlSelectInvalidEvent) => void; /** * Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ onSlInvalidCapture?: (event: SlSelectInvalidEvent) => void; } /** * Selects allow you to choose items from a menu of predefined options. */ export default function SlSelect( props: SlSelectProps, ): ReactElement;