Skip to content

Commit 3f12011

Browse files
lesbaaLes Moffat
andauthored
RD-1000 Fix exported types from GeoCoding control making API Key optional (#90)
* RD-1000 Replace throw error with console.error to allow for keyless server setups * RD-1000 reword warning and convert to console.warn * RD-1000 Fix exported types * RD-1000 Fix Loading state when searching --------- Co-authored-by: Les Moffat <[email protected]>
1 parent 276257c commit 3f12011

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

src/GeocodingControl.svelte

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
5454
export { className as class };
5555
56-
export let apiKey: string | undefined;
56+
export let apiKey: string | undefined = undefined;
5757
5858
export let bbox: BBox | undefined = undefined;
5959
@@ -910,17 +910,19 @@
910910
/>
911911

912912
<div class="clear-button-container" class:displayable={searchValue !== ""}>
913-
<button
914-
type="button"
915-
on:click={() => {
916-
searchValue = "";
917-
picked = undefined;
918-
input.focus();
919-
}}
920-
title={clearButtonTitle}
921-
>
922-
<ClearIcon />
923-
</button>
913+
{#if !abortController}
914+
<button
915+
type="button"
916+
on:click={() => {
917+
searchValue = "";
918+
picked = undefined;
919+
input.focus();
920+
}}
921+
title={clearButtonTitle}
922+
>
923+
<ClearIcon />
924+
</button>
925+
{/if}
924926

925927
{#if abortController}
926928
<LoadingIcon />

src/LoadingIcon.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div>
2-
<svg viewBox="0 0 18 18" width="24" height="24">
2+
<svg viewBox="0 0 18 18" width="24" height="24" class="loading-icon">
33
<path
44
fill="#333"
55
d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"
@@ -23,7 +23,7 @@
2323
align-items: center;
2424
}
2525
26-
svg {
26+
.loading-icon {
2727
animation: rotate 0.8s infinite cubic-bezier(0.45, 0.05, 0.55, 0.95);
2828
}
2929

src/maplibregl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type Options = MapLibreBaseControlOptions & {
1010
/**
1111
* Maptiler API key. Optional if used with MapTiler SDK.
1212
*/
13-
apiKey: string;
13+
apiKey?: string;
1414
};
1515

1616
const { MapLibreBasedGeocodingControl, events } = crateClasses<Options>(

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export type ControlOptions = {
101101
/**
102102
* MapTiler API key.
103103
*/
104-
apiKey: string;
104+
apiKey?: string;
105105

106106
/**
107107
* Geocoding API URL.

0 commit comments

Comments
 (0)