import { EventEmitter } from "../../stencil-public-runtime"; import { DuetMargin, DuetTextFontWeight, DuetTheme, DuetTooltipDirection } from "../../common-types"; import { InputComponent } from "../../common/form-components"; import { ThemeableComponent } from "../../common/themeable-component"; export type DuetSelectOption = { label: string; value: string; ariaLabel?: string; disabled?: boolean; }; export type DuetSelectVariation = "default" | "compact" | "tiny"; export type DuetSelectOptionGroup = { label: string; options: DuetSelectOption[]; disabled?: boolean; }; export type DuetSelectItems = Array; export type DuetSelectEvent = { originalEvent?: Event; component: "duet-select"; value: string; }; /** * @slot tooltip - Use to place a tooltip alongside the label. */ export declare class DuetSelect implements ThemeableComponent, InputComponent { /** * Own Properties */ private selectId; private errorId; private labelId; private topCaptionId; private topCaptionPlaceholderId; private isCaptionVisible; private nativeSelect?; private proxyId; /** * Reference to host HTML element. */ element: HTMLElement; /** * State() variables * Inlined decorator, alphabetical order. */ processedItems: DuetSelectItems; /** * Variation of dropdown. Tiny is used for small numbers / tiny option ranges. Compact works well with adjacent buttons, * like with compact pagination. */ variation: DuetSelectVariation; /** * Indicates the id of a related component’s visually focused element. */ accessibleActiveDescendant: string; /** * Indicates the id of a component that describes the input. */ accessibleDescribedBy: string; /** * Controls the margin of the component. */ margin: DuetMargin; /** * Use this prop to add an aria-controls attribute. Use the attribute to indicate * the id of a component controlled by this component. */ accessibleControls: string; /** * Indicates the id of a component owned by the select. */ accessibleOwns: string; /** * Display the select in error state along with an error message. */ error: string; /** * The aria-live attribute for the error message. When the input is validated on blur, use "off", as using "polite" or "assertive" * makes the screen reader read the error message twice. When the input is validated on submit, use "polite", as "off" would leave * the messages unread by screen readers. Use "assertive" only in those rare cases when "polite" would leave the error message * unread by screen readers. */ accessibleLiveError: "off" | "polite" | "assertive"; /** * Expands the input to fill 100% of the container width. */ expand: boolean; /** * The selected value of the select */ value: string; protected valueChanged(): void; /** * Theme of the select. */ theme: DuetTheme; /** * Visually hide the label, but still show it to screen readers. */ labelHidden: boolean; /** * Adds a unique identifier for the select. */ identifier: string; /** * Name of the select. */ name: string; /** * Hint text to display. */ placeholder: string; /** * Caption (underneath label) that can be set as a way of adding extra information */ caption: string; /** * If form input field has a placeholder text, and user types anything (causing the placeholder text to disappear), * settings this to true will "echo" it into the caption slot - this option will be false by default for the next few versions, but will eventually be true by default (scheduled for 4.30.0) */ echoPlaceholder: boolean; /** * An array of items to choose from */ items: string | DuetSelectItems; /** * Makes the select component disabled. This prevents users from being able * to interact with the select, and conveys its inactive state to assistive * technologies. */ disabled: boolean; /** * Set whether the input is required or not. Please note that this is necessary for * accessible inputs when the user is required to fill them. When using this property * you need to also set “novalidate” attribute to your form element to prevent * browser from displaying its own validation errors. */ required: boolean; /** * Label for the select. */ label: string; /** * Color of the label. */ labelColor: string; /** * Font weight of the label. */ labelWeight: DuetTextFontWeight; /** * Defines a specific role attribute for the select. */ role: string | null; /** * Tooltip to display next to the label of the input. */ tooltip: string; /** * With direction setting you can force the tooltip to always open towards left * or right instead of automatically determining the direction. */ tooltipDirection: DuetTooltipDirection; /** * Callback for when the value changed. */ duetChange: EventEmitter; /** * Emitted when the select has focus. */ duetFocus: EventEmitter; /** * Emitted when the select loses focus. */ duetBlur: EventEmitter; /** * Component lifecycle events. */ componentWillLoad(): void; componentDidRender(): void; /** * Component event handling. */ private onChange; private onBlur; private onFocus; /** * Sets focus on the specified `duet-select`. Use this method instead of the global * `select.focus()`. */ setFocus(options?: FocusOptions): Promise; /** * Local methods. */ private refresh; private getSelectedItemLabel; private renderOption; private renderOptionGroup; private getDescribedBy; /** * render() function * Always the last one in the class. */ render(): any; }