@fluid-topics/ftds-combobox 2.1.22 → 2.1.23
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/ftds-combobox.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class FtdsCombobox extends FtdsBaseCombobox<string> implements Ft
|
|
|
14
14
|
private commit;
|
|
15
15
|
resetCombobox(): void;
|
|
16
16
|
protected updated(changedProperties: PropertyValues): void;
|
|
17
|
+
private computeNewSuggestionFromProvider;
|
|
17
18
|
isSuggestionSelected(value: string): boolean;
|
|
18
19
|
onType(e: Event): Promise<void>;
|
|
19
20
|
render(): TemplateResult;
|
package/build/ftds-combobox.js
CHANGED
|
@@ -58,12 +58,28 @@ export class FtdsCombobox extends FtdsBaseCombobox {
|
|
|
58
58
|
super.updated(changedProperties);
|
|
59
59
|
if (changedProperties.has("value")) {
|
|
60
60
|
const previous = (_a = (changedProperties.get("value"))) !== null && _a !== void 0 ? _a : "";
|
|
61
|
-
const hasValueChanged = this.value !== previous && !this.isOpen && this.inputValue ===
|
|
61
|
+
const hasValueChanged = this.value !== previous && !this.isOpen && this.inputValue === this.previousCommittedLabel;
|
|
62
62
|
if (hasValueChanged) {
|
|
63
|
-
this.
|
|
63
|
+
this.computeNewSuggestionFromProvider(this.value)
|
|
64
|
+
.then((suggestion) => {
|
|
65
|
+
this.value = suggestion.value;
|
|
66
|
+
this.inputValue = suggestion.label;
|
|
67
|
+
this.previousCommittedLabel = suggestion.label;
|
|
68
|
+
});
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
}
|
|
72
|
+
async computeNewSuggestionFromProvider(value) {
|
|
73
|
+
const suggestions = await this.suggestionsProvider(value);
|
|
74
|
+
const matchingSuggestion = suggestions.find((s) => s.value === value);
|
|
75
|
+
if (matchingSuggestion) {
|
|
76
|
+
return matchingSuggestion;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
value: this.canOfferNewValue ? value : "",
|
|
80
|
+
label: this.canOfferNewValue ? value : "",
|
|
81
|
+
};
|
|
82
|
+
}
|
|
67
83
|
isSuggestionSelected(value) {
|
|
68
84
|
return value === this.value;
|
|
69
85
|
}
|
|
@@ -3266,7 +3266,7 @@ Also for action icons.`,c.colorGray200),contentGlobalSubtle:o.extend("--ftds-con
|
|
|
3266
3266
|
.listbox-option[aria-selected="true"][data-active="true"] {
|
|
3267
3267
|
background-color: color-mix(in srgb, ${U.defaultCheckedStateLayerColor} calc(${U.defaultCheckedFocusStateLayerOpacity} * 100%), transparent);
|
|
3268
3268
|
}
|
|
3269
|
-
`;var xo=class extends q{constructor(){var e;super(),this.previousCommittedLabel="",this.value=(e=this.value)!==null&&e!==void 0?e:""}handleBlurStrategy(){if(this.inputValue==="")return;let e=this.filteredSuggestions.find(r=>r.label.toLowerCase()===this.inputValue.toLowerCase());e?this.commitSelection(e):this.canOfferNewValue?this.commitTypedText(this.inputValue):this.resetCombobox()}commitSelection(e){zo(e)&&(e.type===te.newValue&&(0,fn.processValidationRules)(e.value,this.newValueValidationRules).length>0||(this.commit(e.value,e.label),this.closeMenu()))}commitTypedText(e){(0,fn.processValidationRules)(e,this.newValueValidationRules).length>0||this.commit(e,e)}commit(e,r){this.value=e,this.inputValue=r,this.previousCommittedLabel=r,this.dispatchEvent(new un(e))}resetCombobox(){this.inputValue=this.previousCommittedLabel}updated(e){var r;if(super.updated(e),e.has("value")){let n=(r=e.get("value"))!==null&&r!==void 0?r:"";this.value!==n&&!this.isOpen&&this.inputValue===
|
|
3269
|
+
`;var xo=class extends q{constructor(){var e;super(),this.previousCommittedLabel="",this.value=(e=this.value)!==null&&e!==void 0?e:""}handleBlurStrategy(){if(this.inputValue==="")return;let e=this.filteredSuggestions.find(r=>r.label.toLowerCase()===this.inputValue.toLowerCase());e?this.commitSelection(e):this.canOfferNewValue?this.commitTypedText(this.inputValue):this.resetCombobox()}commitSelection(e){zo(e)&&(e.type===te.newValue&&(0,fn.processValidationRules)(e.value,this.newValueValidationRules).length>0||(this.commit(e.value,e.label),this.closeMenu()))}commitTypedText(e){(0,fn.processValidationRules)(e,this.newValueValidationRules).length>0||this.commit(e,e)}commit(e,r){this.value=e,this.inputValue=r,this.previousCommittedLabel=r,this.dispatchEvent(new un(e))}resetCombobox(){this.inputValue=this.previousCommittedLabel}updated(e){var r;if(super.updated(e),e.has("value")){let n=(r=e.get("value"))!==null&&r!==void 0?r:"";this.value!==n&&!this.isOpen&&this.inputValue===this.previousCommittedLabel&&this.computeNewSuggestionFromProvider(this.value).then(i=>{this.value=i.value,this.inputValue=i.label,this.previousCommittedLabel=i.label})}}async computeNewSuggestionFromProvider(e){let n=(await this.suggestionsProvider(e)).find(a=>a.value===e);return n||{value:this.canOfferNewValue?e:"",label:this.canOfferNewValue?e:""}}isSuggestionSelected(e){return e===this.value}async onType(e){await super.onType(e),this.inputValue===""&&this.value!==""&&(this.previousCommittedLabel="",this.value="",this.dispatchEvent(new un("")))}render(){return Os.html`
|
|
3270
3270
|
${this.renderField()}
|
|
3271
3271
|
${this.renderListboxContainer(!1)}
|
|
3272
3272
|
`}renderSuggestionItem(e){return Os.html`
|
|
@@ -3346,7 +3346,7 @@ If it declares any Font Awesome CSS pseudo-elements, they will not be rendered a
|
|
|
3346
3346
|
.listbox-option[aria-selected="true"][data-active="true"] {
|
|
3347
3347
|
background-color: color-mix(in srgb, ${G.defaultCheckedStateLayerColor} calc(${G.defaultCheckedFocusStateLayerOpacity} * 100%), transparent);
|
|
3348
3348
|
}
|
|
3349
|
-
`;var $o=class extends de{constructor(){var e;super(),this.previousCommittedLabel="",this.value=(e=this.value)!==null&&e!==void 0?e:""}handleBlurStrategy(){if(this.inputValue==="")return;let e=this.filteredSuggestions.find(r=>r.label.toLowerCase()===this.inputValue.toLowerCase());e?this.commitSelection(e):this.canOfferNewValue?this.commitTypedText(this.inputValue):this.resetCombobox()}commitSelection(e){vn(e)&&(e.type===he.newValue&&Rt(e.value,this.newValueValidationRules).length>0||(this.commit(e.value,e.label),this.closeMenu()))}commitTypedText(e){Rt(e,this.newValueValidationRules).length>0||this.commit(e,e)}commit(e,r){this.value=e,this.inputValue=r,this.previousCommittedLabel=r,this.dispatchEvent(new In(e))}resetCombobox(){this.inputValue=this.previousCommittedLabel}updated(e){var r;if(super.updated(e),e.has("value")){let o=(r=e.get("value"))!==null&&r!==void 0?r:"";this.value!==o&&!this.isOpen&&this.inputValue===
|
|
3349
|
+
`;var $o=class extends de{constructor(){var e;super(),this.previousCommittedLabel="",this.value=(e=this.value)!==null&&e!==void 0?e:""}handleBlurStrategy(){if(this.inputValue==="")return;let e=this.filteredSuggestions.find(r=>r.label.toLowerCase()===this.inputValue.toLowerCase());e?this.commitSelection(e):this.canOfferNewValue?this.commitTypedText(this.inputValue):this.resetCombobox()}commitSelection(e){vn(e)&&(e.type===he.newValue&&Rt(e.value,this.newValueValidationRules).length>0||(this.commit(e.value,e.label),this.closeMenu()))}commitTypedText(e){Rt(e,this.newValueValidationRules).length>0||this.commit(e,e)}commit(e,r){this.value=e,this.inputValue=r,this.previousCommittedLabel=r,this.dispatchEvent(new In(e))}resetCombobox(){this.inputValue=this.previousCommittedLabel}updated(e){var r;if(super.updated(e),e.has("value")){let o=(r=e.get("value"))!==null&&r!==void 0?r:"";this.value!==o&&!this.isOpen&&this.inputValue===this.previousCommittedLabel&&this.computeNewSuggestionFromProvider(this.value).then(i=>{this.value=i.value,this.inputValue=i.label,this.previousCommittedLabel=i.label})}}async computeNewSuggestionFromProvider(e){let o=(await this.suggestionsProvider(e)).find(a=>a.value===e);return o||{value:this.canOfferNewValue?e:"",label:this.canOfferNewValue?e:""}}isSuggestionSelected(e){return e===this.value}async onType(e){await super.onType(e),this.inputValue===""&&this.value!==""&&(this.previousCommittedLabel="",this.value="",this.dispatchEvent(new In("")))}render(){return I`
|
|
3350
3350
|
${this.renderField()}
|
|
3351
3351
|
${this.renderListboxContainer(!1)}
|
|
3352
3352
|
`}renderSuggestionItem(e){return I`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ftds-combobox",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.23",
|
|
4
4
|
"description": "Single-select combobox for the Fluid Topics Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@fluid-topics/design-system-variables": "3.5.1",
|
|
23
|
-
"@fluid-topics/ft-i18n": "2.1.
|
|
24
|
-
"@fluid-topics/ft-wc-utils": "2.1.
|
|
25
|
-
"@fluid-topics/ftds-base-input": "2.1.
|
|
26
|
-
"@fluid-topics/ftds-chip-group": "2.1.
|
|
27
|
-
"@fluid-topics/ftds-icon": "2.1.
|
|
28
|
-
"@fluid-topics/ftds-notice": "2.1.
|
|
29
|
-
"@fluid-topics/ftds-typography": "2.1.
|
|
23
|
+
"@fluid-topics/ft-i18n": "2.1.23",
|
|
24
|
+
"@fluid-topics/ft-wc-utils": "2.1.23",
|
|
25
|
+
"@fluid-topics/ftds-base-input": "2.1.23",
|
|
26
|
+
"@fluid-topics/ftds-chip-group": "2.1.23",
|
|
27
|
+
"@fluid-topics/ftds-icon": "2.1.23",
|
|
28
|
+
"@fluid-topics/ftds-notice": "2.1.23",
|
|
29
|
+
"@fluid-topics/ftds-typography": "2.1.23",
|
|
30
30
|
"lit": "3.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@fluid-topics/ft-wc-test-utils": "2.1.
|
|
33
|
+
"@fluid-topics/ft-wc-test-utils": "2.1.23"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "e3ca12cf64b1a6af677ff8eb408b8dd3e85797f3"
|
|
36
36
|
}
|