@oslokommune/punkt-elements
Version:
Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo
62 lines (61 loc) • 2.24 kB
TypeScript
import { PropertyValues } from 'lit';
import { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
import { ComboboxHandlers } from './combobox-handlers';
export type { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
export interface IPktCombobox {
allowUserInput?: boolean;
typeahead?: boolean;
disabled?: boolean;
displayValueAs?: string;
errorMessage?: string;
fullwidth?: boolean;
hasError?: boolean;
helptext?: string | null;
helptextDropdown?: string | null;
helptextDropdownButton?: string | null;
id?: string;
includeSearch?: boolean;
label?: string | null;
maxlength?: number | null;
minlength?: number | null;
multiple?: boolean;
name?: string;
optionalTag?: boolean;
optionalText?: string;
options?: IPktComboboxOption[];
defaultOptions?: IPktComboboxOption[];
placeholder?: string | null;
requiredTag?: boolean;
requiredText?: string;
searchPlaceholder?: string;
tagPlacement?: TPktComboboxTagPlacement | null;
tagText?: string | null;
value?: string | string[];
isOpen?: boolean;
}
declare global {
interface HTMLElementTagNameMap {
'pkt-combobox': PktCombobox & HTMLSelectElement;
}
}
export declare class PktCombobox extends ComboboxHandlers implements IPktCombobox {
private handleBodyClick;
connectedCallback(): void;
protected willUpdate(changedProperties: Map<PropertyKey, unknown>): void;
disconnectedCallback(): void;
firstUpdated(changedProperties: PropertyValues): void;
updated(changedProperties: PropertyValues): void;
/**
* Override form reset to properly restore combobox state.
* The base class deselects all options and sets value/defaultValue, but
* combobox needs to re-sync _options with the restored values and clean up
* user-added options and UI state.
*/
protected formResetCallback(): void;
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
render(): import('lit-html').TemplateResult<1>;
private renderInputField;
private renderSingleOrMultipleValues;
private renderValueTag;
}
export default PktCombobox;