@florid-kit/components 2.2.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/search-input-dropdown.d.ts +65 -0
- package/index.js +440 -316
- package/index.mjs +1520 -1214
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
export interface SearchDropdownOption {
|
|
4
|
+
id: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class OccitaneSearchInputDropdown extends LitElement {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
placeholder: string;
|
|
11
|
+
helperText: string;
|
|
12
|
+
state: "default" | "error" | "success";
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
theme: "default" | "light";
|
|
15
|
+
options: SearchDropdownOption[];
|
|
16
|
+
searchBy: "id" | "value" | "both";
|
|
17
|
+
noResultsText: string;
|
|
18
|
+
onSelect?: (option: SearchDropdownOption) => void;
|
|
19
|
+
private open;
|
|
20
|
+
private filteredOptions;
|
|
21
|
+
private activeIndex;
|
|
22
|
+
private searchInputEl;
|
|
23
|
+
private readonly _listboxId;
|
|
24
|
+
static shadowRootOptions: ShadowRootInit;
|
|
25
|
+
static styles: import('lit').CSSResult;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
private _handleOutsideClick;
|
|
29
|
+
/**
|
|
30
|
+
* Close the dropdown when focus has left the component entirely.
|
|
31
|
+
* We defer by one frame so focus can settle on the next element before we check.
|
|
32
|
+
*/
|
|
33
|
+
private _handleFocusOut;
|
|
34
|
+
private filterOptions;
|
|
35
|
+
private handleSearch;
|
|
36
|
+
private selectOption;
|
|
37
|
+
private scrollActiveIntoView;
|
|
38
|
+
/**
|
|
39
|
+
* Keyboard handler while focus is in the search input.
|
|
40
|
+
*
|
|
41
|
+
* Arrow ↓/↑ — highlight options (active-descendant, focus stays in input)
|
|
42
|
+
* Enter — select highlighted option
|
|
43
|
+
* Escape — close dropdown
|
|
44
|
+
* Tab — browser handles naturally:
|
|
45
|
+
* input → clear button (×) → li[0] → … → li[n] → li[0] (loop)
|
|
46
|
+
*/
|
|
47
|
+
private handleKeyDown;
|
|
48
|
+
/**
|
|
49
|
+
* Keyboard handler while focus is on a list item.
|
|
50
|
+
*
|
|
51
|
+
* Arrow ↓ — next item (wraps to first)
|
|
52
|
+
* Arrow ↑ — previous item; ArrowUp on first item returns to input
|
|
53
|
+
* Enter/Space — select the focused item
|
|
54
|
+
* Escape — close dropdown and return focus to input
|
|
55
|
+
* Tab — loop: last item → li[0], otherwise move to next item naturally
|
|
56
|
+
* Shift+Tab — browser handles naturally (previous li, or back to clear button / input)
|
|
57
|
+
*/
|
|
58
|
+
private handleListKeyDown;
|
|
59
|
+
render(): import('lit').TemplateResult<1>;
|
|
60
|
+
}
|
|
61
|
+
declare global {
|
|
62
|
+
interface HTMLElementTagNameMap {
|
|
63
|
+
"o-search-input-dropdown": OccitaneSearchInputDropdown;
|
|
64
|
+
}
|
|
65
|
+
}
|