UNPKG

@claudebernard/search-bar-element

Version:

An element providing some custom stuff.

179 lines (158 loc) 4.74 kB
import { CSSResult } from 'lit'; import { LitElement } from 'lit'; import { TemplateResult } from 'lit-html'; export declare enum ECategories { allCategories = "AllCategories", products = "Products", companies = "Companies", molecules = "Molecules", indications = "Indications", atcclass = "Atcclass", commonNames = "CommonNames", genericAccessoriesGroups = "GenericAccessoriesGroups" } declare type FilterBean = { dopingProducts?: boolean; deletedProducts?: boolean; hospitalProducts?: boolean; homeoProducts?: boolean; dermatoProducts?: boolean; dieteticProducts?: boolean; horsAmmProducts?: boolean; veterinarProducts?: boolean; medicalDevicesProducts?: boolean; genericProducts?: boolean; accessoriesProducts?: boolean; genericAccessoriesProducts?: boolean; biosimilarsProducts?: boolean; specialityProducts?: boolean; fieldFilters?: Array<SearchFiltersBean>; }; declare type FilterValue = { value?: string; label?: string; count?: number; exclude?: number; }; declare interface ResultConfig { displayCategoriesLabel?: boolean; displayPictograms?: boolean; filters?: FilterBean; formattingTextShort?: boolean; formattingTooltipTextShort?: boolean; highlight?: boolean; numberResultsDisplayed?: number; sponsorOrdering?: boolean; } /** * BCB search element. */ export declare class SearchBar extends SearchBar_base { language: string; apiUrl: string; apiKey: string | undefined; placeholder: string; resultConfig: ResultConfig; preselectedCategory: ECategories; listCategoriesDisplayed: ECategories[]; autoFocus: boolean; private allResult; private allResultPerCategories; private searchRequestBody; private selectedCategory; private isScrollBarLoaded; private isFocused; private itemResultContainerRef; private categoriesContainerRef; private searchContainerRef; private currentSearchRequestId; private keyboardSectionIndex; private keyboardCategoryIndex; private keyboardResultIndex; dispatchEvent(event: Event): boolean; focus(options?: FocusOptions): void; connectedCallback(): void; disconnectedCallback(): void; private handleOutsideClick; private handleEscapeKey; updated(changedProperties: Map<string | number | symbol, unknown>): void; render(): TemplateResult<1>; private renderResultComponents; private renderItemResult; private handleScroll; private handleGlobalKeyDown; private handleTabNavigation; private handleArrowNavigation; private handleArrowInInput; private handleArrowInCategories; private handleArrowInResults; private handleEnterKey; private applySectionFocus; private getCategoriesElements; private getResultElements; private clearKeyboardFocusVisuals; private applyCategoryFocus; private applyResultFocus; private updateSearch; private convertProductsToEmittedData; private convertProductsToEnterKeyEmittedData; private isClicked; private emitItemSelection; private emitEnterKeyPress; private resetResultPerCategories; private countNumCategories; private handleChangeCategories; private searchInput; private searchInputNumberCategories; static styles: CSSResult; } declare const SearchBar_base: typeof LitElement; export declare interface SearchBarProps { apiUrl: string; apiKey: string; language: string; placeholder: string; autoFocus?: boolean; resultConfig: ResultConfig; preselectedCategory: ECategories; listCategoriesDisplayed: ECategories[]; } declare type SearchFiltersBean = { type?: string; field?: string; label?: string; values?: Array<FilterValue>; totalCount?: number; }; export declare const setLocale: ((newLocale: string) => Promise<void>) & { _LIT_LOCALIZE_SET_LOCALE_?: never; }; export { } declare global { interface HTMLElementTagNameMap { "bcb-search-bar": SearchBar; } } declare global { interface HTMLElementTagNameMap { "bcb-search-input": SearchInput; } } declare global { interface HTMLElementTagNameMap { "bcb-search-categories": SearchCategoriesProps; } } declare global { interface HTMLElementTagNameMap { "bcb-search-item-result": SearchItemResultProps; } } declare global { interface Window { RUNTIME_CONFIG?: { STORYBOOK_API_URL?: string; STORYBOOK_API_KEY?: string; }; } }