@fluid-topics/ft-combobox 2.1.23 → 2.1.24
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/build/ft-combobox.d.ts +18 -13
- package/build/ft-combobox.js +18 -9
- package/build/ft-combobox.light.js +133 -135
- package/build/ft-combobox.min.js +260 -262
- package/package.json +4 -4
package/build/ft-combobox.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import { PropertyValues, TemplateResult } from "lit";
|
|
|
2
2
|
import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
3
3
|
import { FtComboboxProperties } from "./ft-combobox.properties";
|
|
4
4
|
import { FtComboboxSuggestionDefinition } from "./models";
|
|
5
|
+
type VisibleSuggestion = {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
kind: "regular" | "new";
|
|
9
|
+
};
|
|
5
10
|
declare const FtCombobox_base: typeof FtLitElement & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
|
|
6
11
|
export declare class FtCombobox extends FtCombobox_base implements FtComboboxProperties {
|
|
7
12
|
static styles: import("lit").CSSResult[];
|
|
@@ -27,17 +32,17 @@ export declare class FtCombobox extends FtCombobox_base implements FtComboboxPro
|
|
|
27
32
|
maxValues?: number;
|
|
28
33
|
maxLength?: number;
|
|
29
34
|
labels: string[];
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
labelsToValues: Map<string, string>;
|
|
36
|
+
filter: string;
|
|
37
|
+
isOpen: boolean;
|
|
38
|
+
comboboxHasVisualFocus: boolean;
|
|
39
|
+
listboxHasVisualFocus: boolean;
|
|
40
|
+
providedSuggestions: FtComboboxSuggestionDefinition[];
|
|
41
|
+
visibleSuggestions: VisibleSuggestion[];
|
|
42
|
+
activeIndex: number;
|
|
43
|
+
ariaLiveMessage: string;
|
|
44
|
+
input: HTMLInputElement;
|
|
45
|
+
listbox: HTMLUListElement;
|
|
41
46
|
constructor();
|
|
42
47
|
private _suggestionsProviderDebouncer?;
|
|
43
48
|
protected willUpdate(props: PropertyValues): void;
|
|
@@ -48,8 +53,6 @@ export declare class FtCombobox extends FtCombobox_base implements FtComboboxPro
|
|
|
48
53
|
private shouldOfferNew;
|
|
49
54
|
private getTotalSuggestionsCount;
|
|
50
55
|
private isNewValueSuggestionSelected;
|
|
51
|
-
connectedCallback(): void;
|
|
52
|
-
disconnectedCallback(): void;
|
|
53
56
|
private renderLiveText;
|
|
54
57
|
private getActiveDescendantId;
|
|
55
58
|
private updateSuggestions;
|
|
@@ -81,6 +84,8 @@ export declare class FtCombobox extends FtCombobox_base implements FtComboboxPro
|
|
|
81
84
|
private onComboboxClick;
|
|
82
85
|
private onComboboxFocus;
|
|
83
86
|
private onComboboxBlur;
|
|
87
|
+
private backgroundListenerInstalled;
|
|
88
|
+
protected contentAvailableCallback(props: PropertyValues<this>): void;
|
|
84
89
|
private onBackgroundPointerUp;
|
|
85
90
|
private onSuggestionClick;
|
|
86
91
|
focus(): void;
|
package/build/ft-combobox.js
CHANGED
|
@@ -86,12 +86,12 @@ export class FtCombobox extends withI18n(FtLitElement) {
|
|
|
86
86
|
this.onComboboxBlur = () => {
|
|
87
87
|
this.removeVisualFocusAll();
|
|
88
88
|
};
|
|
89
|
+
this.backgroundListenerInstalled = false;
|
|
89
90
|
this.onBackgroundPointerUp = (event) => {
|
|
90
91
|
// Use composedPath to handle Shadow DOM correctly
|
|
91
92
|
const path = event.composedPath();
|
|
92
93
|
const clickedInside = path.includes(this);
|
|
93
94
|
if (!clickedInside) {
|
|
94
|
-
this.comboboxHasVisualFocus = false;
|
|
95
95
|
this.removeVisualFocusAll();
|
|
96
96
|
setTimeout(() => this.closeListbox(true), 300); // Inspired from the WCAG examples
|
|
97
97
|
}
|
|
@@ -284,14 +284,6 @@ export class FtCombobox extends withI18n(FtLitElement) {
|
|
|
284
284
|
&& this.activeIndex < this.visibleSuggestions.length
|
|
285
285
|
&& ((_a = this.visibleSuggestions[this.activeIndex]) === null || _a === void 0 ? void 0 : _a.kind) === "new";
|
|
286
286
|
}
|
|
287
|
-
connectedCallback() {
|
|
288
|
-
super.connectedCallback();
|
|
289
|
-
document.body.addEventListener("pointerup", this.onBackgroundPointerUp);
|
|
290
|
-
}
|
|
291
|
-
disconnectedCallback() {
|
|
292
|
-
super.disconnectedCallback();
|
|
293
|
-
document.body.removeEventListener("pointerup", this.onBackgroundPointerUp);
|
|
294
|
-
}
|
|
295
287
|
renderLiveText() {
|
|
296
288
|
const total = this.getTotalSuggestionsCount();
|
|
297
289
|
if (this.isOpen && total > 0) {
|
|
@@ -642,6 +634,23 @@ export class FtCombobox extends withI18n(FtLitElement) {
|
|
|
642
634
|
event.preventDefault();
|
|
643
635
|
}
|
|
644
636
|
}
|
|
637
|
+
contentAvailableCallback(props) {
|
|
638
|
+
super.contentAvailableCallback(props);
|
|
639
|
+
if (props.has("comboboxHasVisualFocus") || props.has("listboxHasVisualFocus") || props.has("isOpen")) {
|
|
640
|
+
if (this.comboboxHasVisualFocus || this.listboxHasVisualFocus || this.isOpen) {
|
|
641
|
+
if (!this.backgroundListenerInstalled) {
|
|
642
|
+
document.body.addEventListener("pointerup", this.onBackgroundPointerUp);
|
|
643
|
+
this.backgroundListenerInstalled = true;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
if (this.backgroundListenerInstalled) {
|
|
648
|
+
document.body.removeEventListener("pointerup", this.onBackgroundPointerUp);
|
|
649
|
+
this.backgroundListenerInstalled = false;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
}
|
|
645
654
|
focus() {
|
|
646
655
|
var _a;
|
|
647
656
|
(_a = this.input) === null || _a === void 0 ? void 0 : _a.focus();
|