import { HTMLTemplateResult, PropertyValues } from "lit"; import { FRoot } from "../../mixins/components/f-root/f-root"; import render, { renderSingleSelection, renderMultipleSelectionTag } from "./render"; import { handleDropDownOpen, handleDropDownClose, handleOptionSelection, handleSelectionGroup, handleRemoveGroupSelection, handleCheckboxInput, handleCheckboxGroup, handleSelectAll, handleViewMoreTags, handleInput, handleBlur, handleKeyDown, handleOptionMouseOver } from "./handlers"; export type FSelectState = "primary" | "default" | "success" | "warning" | "danger"; export type FSelectHeightProp = number; export type FSelectWidthProp = "fill-container" | `${number}`; export type FSelectArrayOfStrings = string[]; export type FSelectOptionObject = Record> = { icon?: string; title: string; data?: T; qaId?: string; disabled?: boolean; }; export type FSelectOptionsGroup = { [key: string]: FSelectOptionsProp; }; export type FSelectArrayOfObjects = FSelectOptionObject[]; export type FSelectArray = FSelectSingleOption[]; export type FSelectOptionsProp = FSelectSingleOption[]; export type FSelectSingleOption = FSelectOptionObject | string; export type FSelectOptions = FSelectOptionsProp | FSelectOptionsGroup; export type FSelectValue = FSelectOptions | FSelectSingleOption; export type FSelectOptionTemplate = (option: FSelectSingleOption, isSelected?: boolean) => HTMLTemplateResult; export type FSelectCustomEvent = { value: unknown; searchValue?: string; }; export type FSelectCreateOptionEvent = { value: string; options?: FSelectOptions; }; export declare class FSelect extends FRoot { /** * css loaded from scss file */ static styles: import("lit").CSSResult[]; _labelNodes: NodeListOf; _hasLabel: boolean; _helpNodes: NodeListOf; _hasHelperText: boolean; /** * @attribute local state for dropdown open and close boolean */ openDropdown: boolean; /** * @attribute Multiple tags View/Hide */ viewMoreTags: boolean; /** * @attribute local state for typing string and searching in f-select */ searchValue: string; /** * @attribute local state for options selected */ selectedOptions: FSelectOptions; /** * @attribute local state for filtered options on search */ filteredOptions: FSelectOptions; optimizedHeight: number; preferredOpenDirection: string; optionsTop: string; optionsBottom: string; inputElement: HTMLInputElement; wrapperElement: HTMLDivElement; optionElement: HTMLDivElement; allOptions?: NodeListOf; /** * @attribute Categories are various visual representations of an input field. */ type?: "single" | "multiple"; /** * @attribute Variants are various visual representations of an input field. */ variant?: "curved" | "round" | "block"; /** * @attribute Categories are various visual representations of an input field. */ category?: "fill" | "outline" | "transparent"; /** * @attribute States are used to communicate purpose and connotations. */ state?: FSelectState; /** * @attribute f-select can have 2 sizes. By default size is inherited by the parent f-field. */ size?: "medium" | "small"; /** * @attribute Defines the value of an f-select. Validation rules are applied on the value depending on the type property of the f-text-input. */ value?: FSelectValue; /** * @attribute Defines the placeholder text for f-text-input */ options: FSelectOptions; /** * @attribute Defines the placeholder text for f-text-input */ placeholder?: string; /** * @attribute Defines the placeholder text for f-text-input */ optionTemplate?: FSelectOptionTemplate; set ["option-template"](val: FSelectOptionTemplate | undefined); /** * @attribute Icon-left enables an icon on the left of the input value. */ iconLeft?: string; /** * @attribute height of `f-select` */ height: FSelectHeightProp; /** * @attribute width of `f-select` */ width?: FSelectWidthProp; /** * @attribute Loader icon replaces the content of the button . */ loading?: boolean; /** * @attribute Shows disabled state of select element */ disabled?: boolean; /** * @attribute defines whether user can search within the options or not . */ searchable?: boolean; /** * @attribute a ‘close’ icon button appear on right of the select to clear the input value(s). */ clear?: boolean; /** * @attribute options with checkboxes. */ checkbox?: boolean; /** * @attribute when on search no option is presnt, show create new button */ createOption?: boolean; /** * @attribute when on search no option is presnt, and on click of create-button, for array of strings, auto-addition of option toggle */ autoAddOption?: boolean; /** * @attribute limit to show the selection tags inside f-select. */ selectionLimit: number; /** * icon size */ get iconSize(): "small" | "x-small" | undefined; outsideClick: (e: MouseEvent) => void; containerScroll: () => void; connectedCallback(): void; disconnectedCallback(): void; /** * apply styling to f-select options wrapper. */ applyOptionsStyle(width: number): string; /** * index search for the resepctive option */ getIndex(option: FSelectSingleOption): number; /** * index search for respective option of the respective group */ getIndexInGroup(option: FSelectSingleOption, group: string): number; /** * check selection for respective option. */ isSelected(option: FSelectOptionObject | string): boolean; /** * check selection for respective option of the respective group */ isGroupSelection(option: FSelectSingleOption, group: string): boolean; /** * clear input value on clear icon clicked */ clearInputValue(e: MouseEvent): void; /** * clear te search string */ clearSelectionInGroups(e: MouseEvent): void; /** * check if all values of group are selected or not or are in idetereminate state */ getCheckedValue(group: string): "checked" | "unchecked" | "indeterminate"; /** * get sliced array to show selected options */ getSlicedSelections(optionList: FSelectOptionsProp): number; /** * change width of input inside f-select according to searchable prop */ applyInputStyle(): string; /** * get concatinated array from groups */ getConcaticateGroupOptions(array: FSelectOptionsGroup): FSelectSingleOption[]; /** * clear search string */ clearFilterSearchString(): void; isStringsArray(arr: unknown[]): boolean; /** * Create New Option when option not present */ createNewOption(e: MouseEvent): void; /** * validate properties */ validateProperties(): void; /** * options wrapper dimentions update on the basis of window screen */ updateDimentions(): void; _onLabelSlotChange(): void; _onHelpSlotChange(): void; get singleSelectionStyle(): string; get rightOffset(): 74 | 54; protected updated(changedProperties: PropertyValues): void; getOptionQaId(option: FSelectSingleOption): string; handleDropDownOpen: typeof handleDropDownOpen; handleDropDownClose: typeof handleDropDownClose; handleOptionSelection: typeof handleOptionSelection; handleSelectionGroup: typeof handleSelectionGroup; handleRemoveGroupSelection: typeof handleRemoveGroupSelection; handleCheckboxInput: typeof handleCheckboxInput; handleCheckboxGroup: typeof handleCheckboxGroup; handleSelectAll: typeof handleSelectAll; handleViewMoreTags: typeof handleViewMoreTags; handleInput: typeof handleInput; handleBlur: typeof handleBlur; handleKeyDown: typeof handleKeyDown; handleOptionMouseOver: typeof handleOptionMouseOver; render: typeof render; renderSingleSelection: typeof renderSingleSelection; renderMultipleSelectionTag: typeof renderMultipleSelectionTag; } /** * Required for typescript */ declare global { interface HTMLElementTagNameMap { "f-select": FSelect; } }