diff --git a/index.html b/index.html index 180458f9..2ac94e59 100644 --- a/index.html +++ b/index.html @@ -25,10 +25,13 @@

***
diff --git a/src/components/address-autocomplete/index.ts b/src/components/address-autocomplete/index.ts index 0b5eab62..408f244b 100644 --- a/src/components/address-autocomplete/index.ts +++ b/src/components/address-autocomplete/index.ts @@ -24,6 +24,9 @@ export class AddressAutocomplete extends LitElement { @property({ type: String }) label = "Select an address"; + @property({ type: String }) + initialAddress = ""; + @property({ type: String }) osPlacesApiKey = import.meta.env.VITE_APP_OS_PLACES_API_KEY || ""; @@ -62,6 +65,7 @@ export class AddressAutocomplete extends LitElement { id: this.id, required: true, source: this._options, + defaultValue: this.initialAddress, showAllValues: true, tNoResults: () => "No addresses found", onConfirm: (option: any) => { @@ -124,7 +128,8 @@ export class AddressAutocomplete extends LitElement { ); }); - this._options.sort((a, b) => a.localeCompare(b)); + const collator = new Intl.Collator([], { numeric: true }); + this._options.sort((a, b) => collator.compare(a, b)); } // fetch next page of results if they exist