places-autocomplete-js 1.0.0 → 1.0.2
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/README.md
CHANGED
|
@@ -54,11 +54,11 @@ yarn add places-autocomplete-js
|
|
|
54
54
|
|
|
55
55
|
```javascript
|
|
56
56
|
<script>
|
|
57
|
-
import {
|
|
57
|
+
import { PlacesAutocomplete } from 'places-autocomplete-js';
|
|
58
58
|
|
|
59
59
|
document.addEventListener('DOMContentLoaded', () => {
|
|
60
60
|
try {
|
|
61
|
-
const autocomplete = new
|
|
61
|
+
const autocomplete = new PlacesAutocomplete({
|
|
62
62
|
containerId: 'autocomplete-container',
|
|
63
63
|
googleMapsApiKey: 'YOUR_GOOGLE_MAPS_API_KEY', // Replace with your actual key
|
|
64
64
|
onResponse: (placeDetails) => {
|
|
@@ -76,7 +76,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
76
76
|
// autocomplete.destroy(); // To clean up
|
|
77
77
|
|
|
78
78
|
} catch (error) {
|
|
79
|
-
console.error("Failed to initialize
|
|
79
|
+
console.error("Failed to initialize PlacesAutocomplete:", error.message);
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
|
|
@@ -93,7 +93,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
93
93
|
```
|
|
94
94
|
### Configuration
|
|
95
95
|
|
|
96
|
-
The `
|
|
96
|
+
The `PlacesAutocomplete` class is initialized with a configuration object.
|
|
97
97
|
|
|
98
98
|
| Parameter | Type | Required | Description |
|
|
99
99
|
|--------------------------|----------|----------|------------------------------------------------------------------------------------------------------------|
|
|
@@ -138,7 +138,7 @@ Passed within the main configuration object under the `requestParams` key. These
|
|
|
138
138
|
**Example `requestParams`:**
|
|
139
139
|
|
|
140
140
|
```javascript
|
|
141
|
-
const autocomplete = new
|
|
141
|
+
const autocomplete = new PlacesAutocomplete({
|
|
142
142
|
// ... other config
|
|
143
143
|
requestParams: {
|
|
144
144
|
language: 'fr',
|
|
@@ -182,7 +182,7 @@ Provide an object where keys are the component parts and values are the class st
|
|
|
182
182
|
**Example: Overriding Classes**
|
|
183
183
|
|
|
184
184
|
```javascript
|
|
185
|
-
const autocomplete = new
|
|
185
|
+
const autocomplete = new PlacesAutocomplete({
|
|
186
186
|
// ... other config
|
|
187
187
|
options: {
|
|
188
188
|
classes: {
|
|
@@ -212,7 +212,7 @@ Then, style these classes in your CSS:
|
|
|
212
212
|
|
|
213
213
|
## Public Methods
|
|
214
214
|
|
|
215
|
-
Instances of `
|
|
215
|
+
Instances of `PlacesAutocomplete` have the following public methods:
|
|
216
216
|
|
|
217
217
|
* **`clear()`**: Clears the input field and any visible suggestions, and refreshes the session token.
|
|
218
218
|
* **`destroy()`**: Removes event listeners and cleans up DOM elements created by the widget. Useful when the component is no longer needed (e.g., in SPAs when a view is unmounted).
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
var F = Object.defineProperty;
|
|
2
|
+
var G = (l) => {
|
|
3
|
+
throw TypeError(l);
|
|
4
|
+
};
|
|
5
|
+
var B = (l, t, s) => t in l ? F(l, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : l[t] = s;
|
|
6
|
+
var R = (l, t, s) => B(l, typeof t != "symbol" ? t + "" : t, s), K = (l, t, s) => t.has(l) || G("Cannot " + s);
|
|
7
|
+
var e = (l, t, s) => (K(l, t, "read from private field"), s ? s.call(l) : t.get(l)), h = (l, t, s) => t.has(l) ? G("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(l) : t.set(l, s), c = (l, t, s, i) => (K(l, t, "write to private field"), i ? i.call(l, s) : t.set(l, s), s);
|
|
8
|
+
/**
|
|
9
|
+
* Initializes a Places Autocomplete widget.
|
|
10
|
+
* This script dynamically loads the Google Maps JavaScript API, creates the UI elements
|
|
11
|
+
* for the autocomplete input and suggestions list, handles user input with debouncing,
|
|
12
|
+
* fetches suggestions, manages keyboard navigation, and calls user-defined callbacks
|
|
13
|
+
* on place selection or error.
|
|
14
|
+
*
|
|
15
|
+
* @author Alexander Pechkarev <alexpechkarev@gmail.com>
|
|
16
|
+
* @license MIT
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
var $, f, D, O, n, P, o, u, r, E, w, k, b, p, q, y, j;
|
|
20
|
+
class V {
|
|
21
|
+
/**
|
|
22
|
+
* Class constructor for PacAutocomplete.
|
|
23
|
+
* Initializes the autocomplete widget with the provided configuration.
|
|
24
|
+
* @param {Object} config - Configuration object for the autocomplete widget.
|
|
25
|
+
* @param {string} config.containerId - ID of the container element for the widget.
|
|
26
|
+
* @param {string} config.googleMapsApiKey - Google Maps API key.
|
|
27
|
+
* @param {string} [config.googleMapsApiVersion] - Version of the Google Maps API to use (default: "weekly").
|
|
28
|
+
* @param {Object} [config.options] - Additional options for the widget (e.g., classes, callbacks).
|
|
29
|
+
* @param {Object} [config.requestParams] - Parameters for the autocomplete request (e.g., input, region).
|
|
30
|
+
* @param {*} config
|
|
31
|
+
*/
|
|
32
|
+
constructor(t) {
|
|
33
|
+
// --- Private Properties (using # or _ prefix by convention) ---
|
|
34
|
+
h(this, f);
|
|
35
|
+
h(this, D);
|
|
36
|
+
h(this, O);
|
|
37
|
+
h(this, n);
|
|
38
|
+
h(this, P);
|
|
39
|
+
h(this, o);
|
|
40
|
+
h(this, u);
|
|
41
|
+
h(this, r);
|
|
42
|
+
h(this, E);
|
|
43
|
+
h(this, w);
|
|
44
|
+
h(this, k);
|
|
45
|
+
h(this, b, []);
|
|
46
|
+
h(this, p, -1);
|
|
47
|
+
h(this, q);
|
|
48
|
+
// For user-provided data callback
|
|
49
|
+
h(this, y);
|
|
50
|
+
// For user-provided error callback
|
|
51
|
+
h(this, j, {
|
|
52
|
+
// CSS classes for various parts of the widget.
|
|
53
|
+
section: "",
|
|
54
|
+
// Outer section container.
|
|
55
|
+
container: "relative z-10 transform rounded-xl mt-4",
|
|
56
|
+
// Main container div.
|
|
57
|
+
icon_container: "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3",
|
|
58
|
+
// Container for the search icon.
|
|
59
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8" /><path d="m21 21-4.3-4.3" /></svg>',
|
|
60
|
+
// SVG for the search icon.
|
|
61
|
+
input: "border-1 w-full rounded-md border-0 shadow-sm bg-gray-100 px-4 py-2.5 pl-10 pr-20 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 sm:text-sm",
|
|
62
|
+
// Input field.
|
|
63
|
+
kbd_container: "absolute inset-y-0 right-0 flex py-1.5 pr-1.5",
|
|
64
|
+
// Container for keyboard hints.
|
|
65
|
+
kbd_escape: "inline-flex items-center rounded border border-gray-300 px-1 font-sans text-xs text-gray-500 w-8 mr-1",
|
|
66
|
+
// Escape key hint.
|
|
67
|
+
kbd_up: "inline-flex items-center justify-center rounded border border-gray-300 px-1 font-sans text-xs text-gray-500 w-6",
|
|
68
|
+
// Up arrow key hint.
|
|
69
|
+
kbd_down: "inline-flex items-center rounded border border-gray-400 px-1 font-sans text-xs text-gray-500 justify-center w-6",
|
|
70
|
+
// Down arrow key hint.
|
|
71
|
+
kbd_active: "bg-indigo-500 text-white",
|
|
72
|
+
// Class for active keyboard hint.
|
|
73
|
+
ul: "absolute z-50 -mb-2 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm divide-y divide-gray-100",
|
|
74
|
+
// Suggestions list (ul).
|
|
75
|
+
li: "z-50 cursor-default select-none py-2 px-2 lg:px-4 text-gray-900 hover:bg-indigo-500 hover:text-white",
|
|
76
|
+
// Suggestion item (li).
|
|
77
|
+
li_current: "bg-indigo-500",
|
|
78
|
+
// Class for the currently selected suggestion item.
|
|
79
|
+
li_a: "block w-full flex justify-between",
|
|
80
|
+
// Link element within a suggestion item.
|
|
81
|
+
li_a_current: "text-white",
|
|
82
|
+
// Class for the link in the currently selected suggestion item.
|
|
83
|
+
li_div_container: "flex min-w-0 gap-x-4",
|
|
84
|
+
// Container div within the suggestion link.
|
|
85
|
+
li_div_one: "min-w-0 flex-auto",
|
|
86
|
+
// First inner div (for place name).
|
|
87
|
+
li_div_one_p: "text-sm/6",
|
|
88
|
+
// Paragraph for the place name.
|
|
89
|
+
li_div_two: "shrink-0 flex flex-col items-end min-w-16",
|
|
90
|
+
// Second inner div (for distance).
|
|
91
|
+
li_div_two_p: "mt-1 text-xs/5",
|
|
92
|
+
// Paragraph for the distance.
|
|
93
|
+
highlight: "font-bold"
|
|
94
|
+
// Class for highlighting matched text in suggestions.
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* Debounced function to fetch autocomplete suggestions from the Google Places API.
|
|
98
|
+
* Triggered by the 'input' event on the input element.
|
|
99
|
+
*/
|
|
100
|
+
R(this, "_debouncedMakeAcRequest", this._debounce(async () => {
|
|
101
|
+
if (!e(this, o) || !e(this, o).value) {
|
|
102
|
+
this._reset(), e(this, o) && e(this, o).setAttribute("aria-expanded", "false");
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
e(this, P).input = e(this, o).value;
|
|
106
|
+
try {
|
|
107
|
+
const { suggestions: t } = (
|
|
108
|
+
// eslint-disable-next-line no-undef
|
|
109
|
+
await google.maps.places.AutocompleteSuggestion.fetchAutocompleteSuggestions(
|
|
110
|
+
e(this, P)
|
|
111
|
+
)
|
|
112
|
+
);
|
|
113
|
+
t && t.length > 0 ? (e(this, r).replaceChildren(
|
|
114
|
+
...this._createSuggestionElements(t)
|
|
115
|
+
), e(this, r).style.display = "block", e(this, o).setAttribute("aria-expanded", "true")) : (this._reset(), e(this, o).setAttribute("aria-expanded", "false"));
|
|
116
|
+
} catch (t) {
|
|
117
|
+
e(this, y).call(this, t), this._reset(), e(this, o) && e(this, o).setAttribute("aria-expanded", "false");
|
|
118
|
+
}
|
|
119
|
+
}, (($ = e(this, n)) == null ? void 0 : $.debounce) ?? 100));
|
|
120
|
+
if (!t || !t.containerId || !t.googleMapsApiKey)
|
|
121
|
+
throw new Error(
|
|
122
|
+
"PacAutocomplete: Missing required configuration (containerId, googleMapsApiKey)."
|
|
123
|
+
);
|
|
124
|
+
if (c(this, f, document.getElementById(t.containerId)), !e(this, f))
|
|
125
|
+
throw new Error(
|
|
126
|
+
`PacAutocomplete: Container element with ID "${t.containerId}" not found.`
|
|
127
|
+
);
|
|
128
|
+
c(this, D, t.googleMapsApiKey), c(this, O, t.googleMapsApiVersion || "weekly"), c(this, n, {
|
|
129
|
+
autofocus: !1,
|
|
130
|
+
// Automatically focus the input on load.
|
|
131
|
+
autocomplete: "off",
|
|
132
|
+
// HTML autocomplete attribute for the input.
|
|
133
|
+
placeholder: "Start typing your address ...",
|
|
134
|
+
// Placeholder text for the input.
|
|
135
|
+
distance: !0,
|
|
136
|
+
// Show distance in suggestions (requires origin in request).
|
|
137
|
+
distance_units: "km",
|
|
138
|
+
// Units for distance ('km' or 'miles').
|
|
139
|
+
label: "",
|
|
140
|
+
// Optional label text above the input.
|
|
141
|
+
debounce: 100,
|
|
142
|
+
// Debounce delay (ms) for API requests.
|
|
143
|
+
...t.options
|
|
144
|
+
// User-defined options override defaults
|
|
145
|
+
}), t.options && t.options.classes && (e(this, n).classes = {
|
|
146
|
+
...e(this, j),
|
|
147
|
+
...t.options.classes
|
|
148
|
+
}), c(this, q, t.onResponse || ((s) => {
|
|
149
|
+
console.info("---------Default onResponse not provided---------"), console.info("Selected Place:", JSON.stringify(s, null, 2));
|
|
150
|
+
})), c(this, y, t.onError || ((s) => {
|
|
151
|
+
console.error("---------Default onError not provided---------"), console.error("PAC Error:", s);
|
|
152
|
+
})), c(this, P, {
|
|
153
|
+
input: "",
|
|
154
|
+
includedRegionCodes: ["GB"],
|
|
155
|
+
language: "en-gb",
|
|
156
|
+
region: "GB",
|
|
157
|
+
...t.requestParams
|
|
158
|
+
// User-defined request params override defaults
|
|
159
|
+
}), this._init();
|
|
160
|
+
}
|
|
161
|
+
// --- Private Initialization Method ---
|
|
162
|
+
async _init() {
|
|
163
|
+
try {
|
|
164
|
+
(typeof google > "u" || !google.maps) && await this._loadGoogleMapsApi({
|
|
165
|
+
key: e(this, D),
|
|
166
|
+
v: e(this, O)
|
|
167
|
+
}), this._createPACStructure(), await this._initializeAutocomplete();
|
|
168
|
+
} catch (t) {
|
|
169
|
+
e(this, y).call(this, t);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Creates a debounced version of a function.
|
|
174
|
+
* The debounced function delays invoking `func` until after `wait` milliseconds have
|
|
175
|
+
* elapsed since the last time the debounced function was invoked.
|
|
176
|
+
* @param {Function} func - The function to debounce.
|
|
177
|
+
* @param {number} wait - The number of milliseconds to delay.
|
|
178
|
+
* @returns {Function} The new debounced function.
|
|
179
|
+
*/
|
|
180
|
+
_debounce(t, s) {
|
|
181
|
+
let i = null;
|
|
182
|
+
return function(...d) {
|
|
183
|
+
const _ = () => {
|
|
184
|
+
i = null, t(...d);
|
|
185
|
+
};
|
|
186
|
+
i !== null && clearTimeout(i), i = setTimeout(_, s ?? 100);
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Formats a distance in meters into kilometers or miles.
|
|
191
|
+
* @param {number | null | undefined} distance - Distance in meters.
|
|
192
|
+
* @param {'km' | 'miles'} units - The desired output units.
|
|
193
|
+
* @returns {string | null} Formatted distance string (e.g., "1.23 km") or null if input is invalid.
|
|
194
|
+
*/
|
|
195
|
+
_formatDistance(t, s) {
|
|
196
|
+
if (typeof t != "number" || !e(this, n).distance)
|
|
197
|
+
return null;
|
|
198
|
+
let i, a;
|
|
199
|
+
return s === "km" ? (i = (t / 1e3).toFixed(2), a = "km") : (i = (t / 1609.34).toFixed(2), a = "miles"), i = i.replace(/\.00$/, ""), `${i} ${a}`;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Dynamically loads the Google Maps JavaScript API using the importLibrary method.
|
|
203
|
+
* This is the standard approach recommended by Google.
|
|
204
|
+
* @see https://developers.google.com/maps/documentation/javascript/load-maps-js-api
|
|
205
|
+
* @param {object} g - Configuration object for the API loader (key, v, libraries, etc.).
|
|
206
|
+
*/
|
|
207
|
+
async _loadGoogleMapsApi(t) {
|
|
208
|
+
var s, i, a, d = "The Google Maps JavaScript API", _ = "google", M = "importLibrary", A = "__ib__", T = document, v = window;
|
|
209
|
+
v = v[_] || (v[_] = {});
|
|
210
|
+
var x = v.maps || (v.maps = {}), L = /* @__PURE__ */ new Set(), N = new URLSearchParams(), I = () => (
|
|
211
|
+
// Function to initiate API loading (if not already started)
|
|
212
|
+
s || // eslint-disable-next-line no-async-promise-executor
|
|
213
|
+
(s = new Promise(async (C, m) => {
|
|
214
|
+
var S;
|
|
215
|
+
i = T.createElement("script"), N.set("libraries", [...L].join(","));
|
|
216
|
+
for (a in t)
|
|
217
|
+
N.set(
|
|
218
|
+
a.replace(/[A-Z]/g, (g) => "_" + g[0].toLowerCase()),
|
|
219
|
+
// Convert camelCase to snake_case
|
|
220
|
+
t[a]
|
|
221
|
+
);
|
|
222
|
+
N.set("callback", _ + ".maps." + A), i.src = `https://maps.${_}apis.com/maps/api/js?` + N, x[A] = C, i.onerror = () => s = m(Error(d + " could not load.")), i.nonce = ((S = T.querySelector("script[nonce]")) == null ? void 0 : S.nonce) || "", T.head.append(i);
|
|
223
|
+
}))
|
|
224
|
+
);
|
|
225
|
+
x[M] ? console.warn(d + " only loads once. Ignoring:", t) : x[M] = (C, ...m) => L.add(C) && I().then(() => x[M](C, ...m));
|
|
226
|
+
}
|
|
227
|
+
// --- UI Creation ---
|
|
228
|
+
_createPACStructure() {
|
|
229
|
+
const t = document.createElement("section");
|
|
230
|
+
e(this, n).classes.section.split(" ").forEach((d) => d && t.classList.add(d)), c(this, u, document.createElement("div")), e(this, u).className = e(this, n).classes.container, e(this, u).setAttribute("id", e(this, f)), t.appendChild(e(this, u));
|
|
231
|
+
const s = document.createElement("div");
|
|
232
|
+
s.className = e(this, n).classes.icon_container, e(this, u).appendChild(s);
|
|
233
|
+
const i = document.createElement("div");
|
|
234
|
+
if (i.innerHTML = e(this, n).classes.icon, s.appendChild(i.firstElementChild), c(this, o, document.createElement("input")), e(this, o).id = "input" + e(this, f), e(this, o).type = "text", e(this, o).name = "search", e(this, o).placeholder = e(this, n).placeholder, e(this, o).autocomplete = e(this, n).autocomplete, e(this, o).className = e(this, n).classes.input, e(this, o).setAttribute("role", "combobox"), e(this, o).setAttribute("aria-autocomplete", "list"), e(this, o).setAttribute("aria-expanded", "false"), e(this, o).setAttribute("aria-controls", "pacSuggestions"), e(this, n).autofocus && (e(this, o).autofocus = !0), e(this, n).label) {
|
|
235
|
+
const d = document.createElement("label");
|
|
236
|
+
d.htmlFor = "labelInput" + e(this, f), d.textContent = e(this, n).label, e(this, u).appendChild(d);
|
|
237
|
+
}
|
|
238
|
+
e(this, u).appendChild(e(this, o));
|
|
239
|
+
const a = document.createElement("div");
|
|
240
|
+
a.className = e(this, n).classes.kbd_container, c(this, E, document.createElement("kbd")), e(this, E).className = e(this, n).classes.kbd_escape, e(this, E).textContent = "Esc", a.appendChild(e(this, E)), c(this, w, document.createElement("kbd")), e(this, w).className = e(this, n).classes.kbd_up, e(this, w).innerHTML = "↑", a.appendChild(e(this, w)), c(this, k, document.createElement("kbd")), e(this, k).className = e(this, n).classes.kbd_down, e(this, k).innerHTML = "↓", a.appendChild(e(this, k)), e(this, u).appendChild(a), c(this, r, document.createElement("ul")), e(this, r).id = "pacSuggestions", e(this, r).className = e(this, n).classes.ul, e(this, r).style.display = "none", e(this, r).setAttribute("role", "listbox"), e(this, u).appendChild(e(this, r)), e(this, f).appendChild(t), t.addEventListener("keydown", this._onKeyDown.bind(this));
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Initializes the core autocomplete functionality after the API is loaded.
|
|
244
|
+
* Imports necessary libraries and sets up the input event listener.
|
|
245
|
+
*/
|
|
246
|
+
async _initializeAutocomplete() {
|
|
247
|
+
try {
|
|
248
|
+
await google.maps.importLibrary("places"), this._refreshToken(), e(this, o) ? (e(this, o).addEventListener(
|
|
249
|
+
"input",
|
|
250
|
+
this._debouncedMakeAcRequest.bind(this)
|
|
251
|
+
), e(this, o).addEventListener("blur", () => {
|
|
252
|
+
setTimeout(() => {
|
|
253
|
+
e(this, r) && !e(this, r).contains(document.activeElement) && (e(this, r).style.display = "none", e(this, o).setAttribute("aria-expanded", "false"));
|
|
254
|
+
}, 200);
|
|
255
|
+
}), e(this, o).addEventListener("focus", () => {
|
|
256
|
+
e(this, o).value && e(this, b).length > 0 && (e(this, r).style.display = "block", e(this, o).setAttribute("aria-expanded", "true"));
|
|
257
|
+
})) : e(this, y).call(this, new Error("Input element not found during initialization."));
|
|
258
|
+
} catch (t) {
|
|
259
|
+
console.error("Error initializing Google Places Autocomplete:", t), e(this, y).call(this, new Error("Google Maps Places library not available."));
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Resets the autocomplete input field, clears suggestions, and optionally refreshes the session token.
|
|
264
|
+
* @param {boolean} [refresh=false] - Whether to refresh the Google Places session token.
|
|
265
|
+
*/
|
|
266
|
+
_reset(t = !1) {
|
|
267
|
+
c(this, p, -1), e(this, o) && (e(this, o).value = ""), c(this, b, []), c(this, p, -1), e(this, r) && (e(this, r).innerHTML = "", e(this, r).style.display = "none"), t && this._refreshToken();
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Removes the 'current' highlighting classes from all suggestion list items (li) and their links (a).
|
|
271
|
+
*/
|
|
272
|
+
_resetLiClasses() {
|
|
273
|
+
e(this, r) && Array.from(e(this, r).children).forEach((t) => {
|
|
274
|
+
e(this, n).classes.li_current.split(" ").forEach((i) => t.classList.remove(i));
|
|
275
|
+
const s = t.querySelector("a");
|
|
276
|
+
s && e(this, n).classes.li_a_current.split(" ").forEach((i) => s.classList.remove(i));
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Handles keyboard events (ArrowDown, ArrowUp, Enter, Escape) for navigating
|
|
281
|
+
* and selecting suggestions or closing the list.
|
|
282
|
+
* @param {KeyboardEvent} e - The keyboard event object.
|
|
283
|
+
*/
|
|
284
|
+
_onKeyDown(t) {
|
|
285
|
+
if (!(!e(this, b).length || !e(this, r) || e(this, r).style.display === "none"))
|
|
286
|
+
if (this._resetLiClasses(), t.key === "ArrowDown") {
|
|
287
|
+
t.preventDefault(), c(this, p, Math.min(
|
|
288
|
+
e(this, p) + 1,
|
|
289
|
+
e(this, b).length - 1
|
|
290
|
+
)), e(this, p) < 0 && c(this, p, 0);
|
|
291
|
+
const s = e(this, r).children.item(e(this, p));
|
|
292
|
+
if (s) {
|
|
293
|
+
const i = s.querySelector("a");
|
|
294
|
+
e(this, n).classes.li_current.split(" ").forEach((a) => s.classList.add(a)), i && e(this, n).classes.li_a_current.split(" ").forEach((a) => i.classList.add(a)), s.scrollIntoView({ block: "nearest" });
|
|
295
|
+
}
|
|
296
|
+
e(this, n).classes.kbd_active.split(" ").forEach((i) => {
|
|
297
|
+
var a;
|
|
298
|
+
return (a = e(this, k)) == null ? void 0 : a.classList.add(i);
|
|
299
|
+
}), setTimeout(
|
|
300
|
+
() => e(this, n).classes.kbd_active.split(" ").forEach((i) => {
|
|
301
|
+
var a;
|
|
302
|
+
return (a = e(this, k)) == null ? void 0 : a.classList.remove(i);
|
|
303
|
+
}),
|
|
304
|
+
300
|
|
305
|
+
);
|
|
306
|
+
} else if (t.key === "ArrowUp") {
|
|
307
|
+
t.preventDefault(), c(this, p, Math.max(e(this, p) - 1, 0));
|
|
308
|
+
const s = e(this, r).children.item(e(this, p));
|
|
309
|
+
if (s) {
|
|
310
|
+
const i = s.querySelector("a");
|
|
311
|
+
e(this, n).classes.li_current.split(" ").forEach((a) => s.classList.add(a)), i && e(this, n).classes.li_a_current.split(" ").forEach((a) => i.classList.add(a)), s.scrollIntoView({ block: "nearest" });
|
|
312
|
+
}
|
|
313
|
+
e(this, n).classes.kbd_active.split(" ").forEach((i) => {
|
|
314
|
+
var a;
|
|
315
|
+
return (a = e(this, w)) == null ? void 0 : a.classList.add(i);
|
|
316
|
+
}), setTimeout(
|
|
317
|
+
() => e(this, n).classes.kbd_active.split(" ").forEach((i) => {
|
|
318
|
+
var a;
|
|
319
|
+
return (a = e(this, w)) == null ? void 0 : a.classList.remove(i);
|
|
320
|
+
}),
|
|
321
|
+
300
|
|
322
|
+
);
|
|
323
|
+
} else t.key === "Enter" ? (t.preventDefault(), e(this, p) >= 0 && e(this, p) < e(this, b).length && this._onPlaceSelected(
|
|
324
|
+
e(this, b)[e(this, p)].place
|
|
325
|
+
)) : t.key === "Escape" && (t.preventDefault(), e(this, n).classes.kbd_active.split(" ").forEach((s) => {
|
|
326
|
+
var i;
|
|
327
|
+
return (i = e(this, E)) == null ? void 0 : i.classList.add(s);
|
|
328
|
+
}), setTimeout(
|
|
329
|
+
() => e(this, n).classes.kbd_active.split(" ").forEach((s) => {
|
|
330
|
+
var i;
|
|
331
|
+
return (i = e(this, E)) == null ? void 0 : i.classList.remove(s);
|
|
332
|
+
}),
|
|
333
|
+
300
|
|
334
|
+
), this._reset(!0));
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Creates an array of list item (LI) elements for the suggestions dropdown.
|
|
338
|
+
* Each LI contains a link (A) with the place prediction details and distance.
|
|
339
|
+
* Handles highlighting the matched parts of the suggestion text.
|
|
340
|
+
* @param {Array<google.maps.places.AutocompleteSuggestion>} suggestions - Array of suggestion objects from the API.
|
|
341
|
+
* @returns {Array<HTMLLIElement>} An array of LI elements to be added to the suggestions UL.
|
|
342
|
+
*/
|
|
343
|
+
_createSuggestionElements(t) {
|
|
344
|
+
return c(this, b, []), t.map((s, i) => {
|
|
345
|
+
e(this, b).push({
|
|
346
|
+
id: i + 1,
|
|
347
|
+
description: s.placePrediction.toString(),
|
|
348
|
+
place: s.placePrediction.toPlace()
|
|
349
|
+
});
|
|
350
|
+
const a = document.createElement("div");
|
|
351
|
+
a.className = e(this, n).classes.li_div_container;
|
|
352
|
+
const d = document.createElement("div");
|
|
353
|
+
d.className = e(this, n).classes.li_div_one, a.appendChild(d);
|
|
354
|
+
const _ = document.createElement("p");
|
|
355
|
+
_.className = e(this, n).classes.li_div_one_p;
|
|
356
|
+
const M = s.placePrediction.text, A = M.text, T = M.matches;
|
|
357
|
+
let v = 0;
|
|
358
|
+
T.sort((g, z) => g.startOffset - z.startOffset);
|
|
359
|
+
const x = document.createElement("span"), L = document.createElement("span");
|
|
360
|
+
L.classList = e(this, n).classes.highlight ?? "font-bold";
|
|
361
|
+
for (const g of T)
|
|
362
|
+
x.textContent += A.substring(
|
|
363
|
+
v,
|
|
364
|
+
g.startOffset
|
|
365
|
+
), g.startOffset > 0 && A.charAt(g.startOffset - 1) == " " && (L.textContent += " "), L.textContent += A.substring(
|
|
366
|
+
g.startOffset,
|
|
367
|
+
g.endOffset
|
|
368
|
+
), v = g.endOffset;
|
|
369
|
+
const N = document.createTextNode(
|
|
370
|
+
A.substring(v)
|
|
371
|
+
);
|
|
372
|
+
x.appendChild(L), x.appendChild(N), _.appendChild(x), d.appendChild(_), a.appendChild(d);
|
|
373
|
+
const I = document.createElement("div");
|
|
374
|
+
I.className = e(this, n).classes.li_div_two, a.appendChild(I);
|
|
375
|
+
const C = document.createElement("p");
|
|
376
|
+
C.className = e(this, n).classes.li_div_two_p, C.textContent = this._formatDistance(
|
|
377
|
+
s.placePrediction.distanceMeters,
|
|
378
|
+
e(this, n).distance_units ?? "km"
|
|
379
|
+
), I.appendChild(C);
|
|
380
|
+
const m = document.createElement("a");
|
|
381
|
+
m.href = "javascript:void(0)", m.tabIndex = i + 1, m.className = e(this, n).classes.li_a, m.addEventListener("click", () => {
|
|
382
|
+
this._onPlaceSelected(s.placePrediction.toPlace());
|
|
383
|
+
}), m.appendChild(a), m.appendChild(I);
|
|
384
|
+
const S = document.createElement("li");
|
|
385
|
+
return S.id = `option-${i + 1}`, S.className = e(this, n).classes.li, S.appendChild(m), S;
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Handles the selection of a place. Fetches required fields
|
|
390
|
+
* (displayName, formattedAddress, addressComponents) and calls the
|
|
391
|
+
* user-defined `onPacData` callback.
|
|
392
|
+
* @param {google.maps.places.Place} place - The selected Place object.
|
|
393
|
+
*/
|
|
394
|
+
async _onPlaceSelected(t) {
|
|
395
|
+
try {
|
|
396
|
+
await t.fetchFields({
|
|
397
|
+
fields: ["displayName", "formattedAddress", "addressComponents"]
|
|
398
|
+
// Add more fields as needed
|
|
399
|
+
}), e(this, q).call(this, t.toJSON());
|
|
400
|
+
} catch (s) {
|
|
401
|
+
console.error("Error fetching place details:", s), e(this, y).call(this, s);
|
|
402
|
+
} finally {
|
|
403
|
+
this._reset(!0);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Creates a new Google Places Autocomplete Session Token.
|
|
408
|
+
* This should be called before starting a new series of autocomplete requests.
|
|
409
|
+
*/
|
|
410
|
+
_refreshToken() {
|
|
411
|
+
try {
|
|
412
|
+
e(this, P).sessionToken = new google.maps.places.AutocompleteSessionToken();
|
|
413
|
+
} catch (t) {
|
|
414
|
+
console.error("Error creating session token:", t), e(this, y).call(this, t);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
clear() {
|
|
418
|
+
this._reset(!0);
|
|
419
|
+
}
|
|
420
|
+
destroy() {
|
|
421
|
+
e(this, o) && e(this, o).removeEventListener(
|
|
422
|
+
"input",
|
|
423
|
+
this._debouncedMakeAcRequest
|
|
424
|
+
), e(this, f) && e(this, u) && e(this, f).removeChild(e(this, u).parentElement);
|
|
425
|
+
for (const t in this)
|
|
426
|
+
Object.hasOwn(this, t) && (this[t] = null);
|
|
427
|
+
console.log("PacAutocomplete instance destroyed.");
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
f = new WeakMap(), D = new WeakMap(), O = new WeakMap(), n = new WeakMap(), P = new WeakMap(), o = new WeakMap(), u = new WeakMap(), r = new WeakMap(), E = new WeakMap(), w = new WeakMap(), k = new WeakMap(), b = new WeakMap(), p = new WeakMap(), q = new WeakMap(), y = new WeakMap(), j = new WeakMap();
|
|
431
|
+
export {
|
|
432
|
+
V as PlacesAutocomplete
|
|
433
|
+
};
|
|
434
|
+
//# sourceMappingURL=places-autocomplete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"places-autocomplete.js","sources":["../lib/PlacesAutocomplete.js"],"sourcesContent":["/**\n * Initializes a Places Autocomplete widget.\n * This script dynamically loads the Google Maps JavaScript API, creates the UI elements\n * for the autocomplete input and suggestions list, handles user input with debouncing,\n * fetches suggestions, manages keyboard navigation, and calls user-defined callbacks\n * on place selection or error.\n *\n * @author Alexander Pechkarev <alexpechkarev@gmail.com>\n * @license MIT\n *\n */\n\n/**\n * PacAutocomplete class\n * This class provides a Places Autocomplete widget.\n */\nexport class PlacesAutocomplete {\n // --- Private Properties (using # or _ prefix by convention) ---\n #pacEl;\n #googleMapsApiKey;\n #googleMapsApiVersion;\n #options;\n #request;\n #inputElement;\n #container;\n #ul;\n #kbdEscape;\n #kbdUp;\n #kbdDown;\n #allSuggestions = [];\n #currentSuggestion = -1;\n #onDataCallback; // For user-provided data callback\n #onErrorCallback; // For user-provided error callback\n #defaultClasses = {\n // CSS classes for various parts of the widget.\n section: \"\", // Outer section container.\n container: \"relative z-10 transform rounded-xl mt-4\", // Main container div.\n icon_container:\n \"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3\", // Container for the search icon.\n icon: '<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"w-5 h-5\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\" /><path d=\"m21 21-4.3-4.3\" /></svg>', // SVG for the search icon.\n input:\n \"border-1 w-full rounded-md border-0 shadow-sm bg-gray-100 px-4 py-2.5 pl-10 pr-20 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 sm:text-sm\", // Input field.\n kbd_container: \"absolute inset-y-0 right-0 flex py-1.5 pr-1.5\", // Container for keyboard hints.\n kbd_escape:\n \"inline-flex items-center rounded border border-gray-300 px-1 font-sans text-xs text-gray-500 w-8 mr-1\", // Escape key hint.\n kbd_up:\n \"inline-flex items-center justify-center rounded border border-gray-300 px-1 font-sans text-xs text-gray-500 w-6\", // Up arrow key hint.\n kbd_down:\n \"inline-flex items-center rounded border border-gray-400 px-1 font-sans text-xs text-gray-500 justify-center w-6\", // Down arrow key hint.\n kbd_active: \"bg-indigo-500 text-white\", // Class for active keyboard hint.\n ul: \"absolute z-50 -mb-2 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm divide-y divide-gray-100\", // Suggestions list (ul).\n li: \"z-50 cursor-default select-none py-2 px-2 lg:px-4 text-gray-900 hover:bg-indigo-500 hover:text-white\", // Suggestion item (li).\n li_current: \"bg-indigo-500\", // Class for the currently selected suggestion item.\n li_a: \"block w-full flex justify-between\", // Link element within a suggestion item.\n li_a_current: \"text-white\", // Class for the link in the currently selected suggestion item.\n li_div_container: \"flex min-w-0 gap-x-4\", // Container div within the suggestion link.\n li_div_one: \"min-w-0 flex-auto\", // First inner div (for place name).\n li_div_one_p: \"text-sm/6\", // Paragraph for the place name.\n li_div_two: \"shrink-0 flex flex-col items-end min-w-16\", // Second inner div (for distance).\n li_div_two_p: \"mt-1 text-xs/5\", // Paragraph for the distance.\n highlight: \"font-bold\", // Class for highlighting matched text in suggestions.\n };\n\n /**\n * Class constructor for PacAutocomplete.\n * Initializes the autocomplete widget with the provided configuration.\n * @param {Object} config - Configuration object for the autocomplete widget.\n * @param {string} config.containerId - ID of the container element for the widget.\n * @param {string} config.googleMapsApiKey - Google Maps API key.\n * @param {string} [config.googleMapsApiVersion] - Version of the Google Maps API to use (default: \"weekly\").\n * @param {Object} [config.options] - Additional options for the widget (e.g., classes, callbacks).\n * @param {Object} [config.requestParams] - Parameters for the autocomplete request (e.g., input, region).\n * @param {*} config\n */\n constructor(config) {\n //console.log(\"PacAutocomplete constructor called.\", config);\n if (!config || !config.containerId || !config.googleMapsApiKey) {\n throw new Error(\n \"PacAutocomplete: Missing required configuration (containerId, googleMapsApiKey).\"\n );\n }\n\n this.#pacEl = document.getElementById(config.containerId);\n if (!this.#pacEl) {\n throw new Error(\n `PacAutocomplete: Container element with ID \"${config.containerId}\" not found.`\n );\n }\n\n this.#googleMapsApiKey = config.googleMapsApiKey;\n this.#googleMapsApiVersion = config.googleMapsApiVersion || \"weekly\";\n\n // Merge user options with defaults\n this.#options = {\n autofocus: false, // Automatically focus the input on load.\n autocomplete: \"off\", // HTML autocomplete attribute for the input.\n placeholder: \"Start typing your address ...\", // Placeholder text for the input.\n distance: true, // Show distance in suggestions (requires origin in request).\n distance_units: \"km\", // Units for distance ('km' or 'miles').\n label: \"\", // Optional label text above the input.\n debounce: 100, // Debounce delay (ms) for API requests.\n ...config.options, // User-defined options override defaults\n };\n // Ensure classes are deeply merged if user provides partial classes\n if (config.options && config.options.classes) {\n this.#options.classes = {\n ...this.#defaultClasses,\n ...config.options.classes,\n };\n }\n\n // Set default response and error callbacks if not provided\n this.#onDataCallback =\n config.onResponse ||\n ((place) => {\n console.info(\"---------Default onResponse not provided---------\");\n console.info(\"Selected Place:\", JSON.stringify(place, null, 2));\n });\n this.#onErrorCallback =\n config.onError ||\n ((error) => {\n console.error(\"---------Default onError not provided---------\");\n console.error(\"PAC Error:\", error);\n });\n\n this.#request = {\n input: \"\",\n includedRegionCodes: [\"GB\"],\n language: \"en-gb\",\n region: \"GB\",\n ...config.requestParams, // User-defined request params override defaults\n };\n\n //console.log(this.#request);\n\n this._init(); // Underscore prefix for internal initialization method\n }\n\n // --- Private Initialization Method ---\n async _init() {\n try {\n // check if google maps api is already loaded\n if (typeof google === \"undefined\" || !google.maps) {\n // Load the Google Maps API dynamically\n await this._loadGoogleMapsApi({\n key: this.#googleMapsApiKey,\n v: this.#googleMapsApiVersion,\n });\n }\n this._createPACStructure(); // Pass this.#options\n await this._initializeAutocomplete(); // Pass this.#options\n //console.log(\"PacAutocomplete Initialized for container:\", this.#pacEl.id);\n } catch (error) {\n this.#onErrorCallback(error);\n }\n }\n\n /**\n * Creates a debounced version of a function.\n * The debounced function delays invoking `func` until after `wait` milliseconds have\n * elapsed since the last time the debounced function was invoked.\n * @param {Function} func - The function to debounce.\n * @param {number} wait - The number of milliseconds to delay.\n * @returns {Function} The new debounced function.\n */\n _debounce(func, wait) {\n let timeout = null;\n return function executedFunction(...args) {\n const later = () => {\n timeout = null;\n func(...args); // Call original function\n };\n if (timeout !== null) {\n clearTimeout(timeout); // Clear the previous timeout\n }\n timeout = setTimeout(later, wait ?? 100); // Set the new timeout\n };\n }\n /**\n * Formats a distance in meters into kilometers or miles.\n * @param {number | null | undefined} distance - Distance in meters.\n * @param {'km' | 'miles'} units - The desired output units.\n * @returns {string | null} Formatted distance string (e.g., \"1.23 km\") or null if input is invalid.\n */\n _formatDistance(distance, units) {\n if (typeof distance !== \"number\" || !this.#options.distance) {\n return null; // Return null if distance isn't shown or invalid\n }\n let value;\n let unitLabel;\n if (units === \"km\") {\n value = (distance / 1000).toFixed(2);\n unitLabel = \"km\";\n } else {\n // Default to miles if not 'km'\n value = (distance / 1609.34).toFixed(2);\n unitLabel = \"miles\";\n }\n // Avoid showing \".00\"\n value = value.replace(/\\.00$/, \"\");\n return `${value} ${unitLabel}`;\n }\n\n /**\n * Dynamically loads the Google Maps JavaScript API using the importLibrary method.\n * This is the standard approach recommended by Google.\n * @see https://developers.google.com/maps/documentation/javascript/load-maps-js-api\n * @param {object} g - Configuration object for the API loader (key, v, libraries, etc.).\n */\n async _loadGoogleMapsApi(g) {\n var h, // Promise tracking API load\n a, // Script element\n k, // Loop variable for config keys\n p = \"The Google Maps JavaScript API\", // Error message prefix\n c = \"google\", // Global namespace\n l = \"importLibrary\", // Loader function name\n q = \"__ib__\", // Internal callback name\n m = document, // Document reference\n b = window; // Window reference\n b = b[c] || (b[c] = {}); // Ensure google namespace exists\n var d = b.maps || (b.maps = {}), // Ensure google.maps namespace exists\n r = new Set(), // Set to track requested libraries\n e = new URLSearchParams(), // URL parameters for the API script\n u = () =>\n // Function to initiate API loading (if not already started)\n h ||\n // eslint-disable-next-line no-async-promise-executor\n (h = new Promise(async (f, n) => {\n // Create script element (done async to potentially wait for nonce)\n // await (a = m.createElement('script')); // Original Google code had await here, might not be needed\n a = m.createElement(\"script\"); // Create script tag\n e.set(\"libraries\", [...r].join(\",\")); // Add accumulated libraries\n // Add other parameters from the config object 'g'\n for (k in g)\n e.set(\n k.replace(/[A-Z]/g, (t) => \"_\" + t[0].toLowerCase()), // Convert camelCase to snake_case\n g[k]\n );\n e.set(\"callback\", c + \".maps.\" + q); // Set the internal callback function name\n a.src = `https://maps.${c}apis.com/maps/api/js?` + e; // Construct the API URL\n d[q] = f; // Assign the promise resolver to the callback name on google.maps\n // Error handling for script loading failure\n a.onerror = () => (h = n(Error(p + \" could not load.\"))); // Use onerror for load failures\n // Nonce for Content Security Policy\n a.nonce = m.querySelector(\"script[nonce]\")?.nonce || \"\";\n m.head.append(a); // Append the script to the document head\n }));\n // Define or reuse the importLibrary function on google.maps\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n d[l]\n ? console.warn(p + \" only loads once. Ignoring:\", g) // Warn if called again\n : (d[l] = (f, ...n) => r.add(f) && u().then(() => d[l](f, ...n))); // The actual importLibrary implementation\n }\n\n // --- UI Creation ---\n _createPACStructure() {\n const section = document.createElement(\"section\");\n this.#options.classes.section\n .split(\" \")\n .forEach((cl) => cl && section.classList.add(cl));\n\n // Main container\n this.#container = document.createElement(\"div\");\n this.#container.className = this.#options.classes.container;\n this.#container.setAttribute(\"id\", this.#pacEl);\n section.appendChild(this.#container);\n\n // Icon\n const iconContainer = document.createElement(\"div\");\n iconContainer.className = this.#options.classes.icon_container;\n this.#container.appendChild(iconContainer);\n const icon = document.createElement(\"div\");\n icon.innerHTML = this.#options.classes.icon;\n iconContainer.appendChild(icon.firstElementChild); // Append the actual SVG element\n\n // Input field\n this.#inputElement = document.createElement(\"input\");\n this.#inputElement.id = \"input\" + this.#pacEl; // Assign ID for label association\n this.#inputElement.type = \"text\";\n this.#inputElement.name = \"search\"; // Consider making name configurable\n this.#inputElement.placeholder = this.#options.placeholder;\n this.#inputElement.autocomplete = this.#options.autocomplete;\n this.#inputElement.className = this.#options.classes.input;\n this.#inputElement.setAttribute(\"role\", \"combobox\");\n this.#inputElement.setAttribute(\"aria-autocomplete\", \"list\");\n this.#inputElement.setAttribute(\"aria-expanded\", \"false\"); // Will be updated dynamically\n this.#inputElement.setAttribute(\"aria-controls\", \"pacSuggestions\"); // Links to the suggestions list\n\n if (this.#options.autofocus) {\n this.#inputElement.autofocus = true;\n }\n if (this.#options.label) {\n const label = document.createElement(\"label\");\n label.htmlFor = \"labelInput\" + this.#pacEl; // Assuming inputElement gets this ID\n label.textContent = this.#options.label;\n // Add label classes if needed from opts.classes\n this.#container.appendChild(label); // Append label before input or adjust structure\n }\n this.#container.appendChild(this.#inputElement);\n\n // Keyboard hints container\n const kbdContainer = document.createElement(\"div\");\n kbdContainer.className = this.#options.classes.kbd_container;\n this.#kbdEscape = document.createElement(\"kbd\");\n this.#kbdEscape.className = this.#options.classes.kbd_escape;\n this.#kbdEscape.textContent = \"Esc\";\n kbdContainer.appendChild(this.#kbdEscape);\n this.#kbdUp = document.createElement(\"kbd\");\n this.#kbdUp.className = this.#options.classes.kbd_up;\n this.#kbdUp.innerHTML = \"↑\"; // Up arrow HTML entity\n kbdContainer.appendChild(this.#kbdUp);\n this.#kbdDown = document.createElement(\"kbd\");\n this.#kbdDown.className = this.#options.classes.kbd_down;\n this.#kbdDown.innerHTML = \"↓\"; // Down arrow HTML entity\n kbdContainer.appendChild(this.#kbdDown);\n this.#container.appendChild(kbdContainer);\n\n // Suggestions list (initially hidden)\n this.#ul = document.createElement(\"ul\");\n this.#ul.id = \"pacSuggestions\"; // Must match aria-controls\n this.#ul.className = this.#options.classes.ul;\n this.#ul.style.display = \"none\";\n this.#ul.setAttribute(\"role\", \"listbox\");\n this.#container.appendChild(this.#ul);\n\n this.#pacEl.appendChild(section);\n section.addEventListener(\"keydown\", this._onKeyDown.bind(this)); // Bind 'this'\n }\n\n /**\n * Initializes the core autocomplete functionality after the API is loaded.\n * Imports necessary libraries and sets up the input event listener.\n */\n async _initializeAutocomplete() {\n try {\n // Ensure the 'places' library is available via the dynamic loader\n // eslint-disable-next-line no-undef\n await google.maps.importLibrary(\"places\");\n // console.log('Places library imported successfully.'); // For debugging\n\n // Initial token generation\n this._refreshToken();\n\n // Attach the debounced request function to the input element's 'input' event\n if (this.#inputElement) {\n this.#inputElement.addEventListener(\n \"input\",\n this._debouncedMakeAcRequest.bind(this)\n );\n // Add focus/blur listeners if needed to manage suggestion visibility\n this.#inputElement.addEventListener(\"blur\", () => {\n // Delay hiding suggestions to allow click events on them\n setTimeout(() => {\n if (this.#ul && !this.#ul.contains(document.activeElement)) {\n // Check if focus moved outside suggestions\n this.#ul.style.display = \"none\";\n this.#inputElement.setAttribute(\"aria-expanded\", \"false\");\n }\n }, 200); // Adjust delay as needed\n });\n this.#inputElement.addEventListener(\"focus\", () => {\n // Potentially show suggestions again if input has value\n if (this.#inputElement.value && this.#allSuggestions.length > 0) {\n this.#ul.style.display = \"block\";\n this.#inputElement.setAttribute(\"aria-expanded\", \"true\");\n }\n });\n } else {\n this.#onErrorCallback(\n new Error(\"Input element not found during initialization.\")\n );\n }\n } catch (error) {\n console.error(\"Error initializing Google Places Autocomplete:\", error);\n // eslint-disable-next-line no-undef\n this.#onErrorCallback(\n new Error(\"Google Maps Places library not available.\")\n );\n }\n }\n\n /**\n * Resets the autocomplete input field, clears suggestions, and optionally refreshes the session token.\n * @param {boolean} [refresh=false] - Whether to refresh the Google Places session token.\n */\n _reset(refresh = false) {\n this.#currentSuggestion = -1;\n if (this.#inputElement) {\n this.#inputElement.value = \"\";\n }\n this.#allSuggestions = [];\n this.#currentSuggestion = -1;\n if (this.#ul) {\n this.#ul.innerHTML = \"\"; // Clear existing suggestions\n this.#ul.style.display = \"none\";\n }\n if (refresh) {\n this._refreshToken();\n }\n }\n /**\n * Removes the 'current' highlighting classes from all suggestion list items (li) and their links (a).\n */\n _resetLiClasses() {\n if (!this.#ul) return;\n Array.from(this.#ul.children).forEach((li) => {\n this.#options.classes.li_current\n .split(\" \")\n .forEach((cl) => li.classList.remove(cl));\n const link = li.querySelector(\"a\");\n if (link) {\n this.#options.classes.li_a_current\n .split(\" \")\n .forEach((cl) => link.classList.remove(cl));\n }\n });\n }\n\n /**\n * Handles keyboard events (ArrowDown, ArrowUp, Enter, Escape) for navigating\n * and selecting suggestions or closing the list.\n * @param {KeyboardEvent} e - The keyboard event object.\n */\n _onKeyDown(e) {\n if (\n !this.#allSuggestions.length ||\n !this.#ul ||\n this.#ul.style.display === \"none\"\n )\n return;\n\n this._resetLiClasses(); // Reset classes on any key press within the suggestions\n\n if (e.key === \"ArrowDown\") {\n e.preventDefault(); // Prevent cursor movement in input\n this.#currentSuggestion = Math.min(\n this.#currentSuggestion + 1,\n this.#allSuggestions.length - 1\n );\n if (this.#currentSuggestion < 0) this.#currentSuggestion = 0; // Handle case where it was -1\n\n const currentLi = this.#ul.children.item(this.#currentSuggestion);\n if (currentLi) {\n const currentA = currentLi.querySelector(\"a\");\n this.#options.classes.li_current\n .split(\" \")\n .forEach((cl) => currentLi.classList.add(cl));\n if (currentA) {\n this.#options.classes.li_a_current\n .split(\" \")\n .forEach((cl) => currentA.classList.add(cl));\n }\n currentLi.scrollIntoView({ block: \"nearest\" }); // Ensure visible\n }\n\n // Visual feedback for key press\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdDown?.classList.add(cl));\n setTimeout(\n () =>\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdDown?.classList.remove(cl)),\n 300\n );\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault(); // Prevent cursor movement in input\n this.#currentSuggestion = Math.max(this.#currentSuggestion - 1, 0); // Stay at 0 if already there\n\n const currentLi = this.#ul.children.item(this.#currentSuggestion);\n if (currentLi) {\n const currentA = currentLi.querySelector(\"a\");\n this.#options.classes.li_current\n .split(\" \")\n .forEach((cl) => currentLi.classList.add(cl));\n if (currentA) {\n this.#options.classes.li_a_current\n .split(\" \")\n .forEach((cl) => currentA.classList.add(cl));\n }\n currentLi.scrollIntoView({ block: \"nearest\" }); // Ensure visible\n }\n\n // Visual feedback for key press\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdUp?.classList.add(cl));\n setTimeout(\n () =>\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdUp?.classList.remove(cl)),\n 300\n );\n } else if (e.key === \"Enter\") {\n e.preventDefault(); // Prevent form submission if applicable\n if (\n this.#currentSuggestion >= 0 &&\n this.#currentSuggestion < this.#allSuggestions.length\n ) {\n this._onPlaceSelected(\n this.#allSuggestions[this.#currentSuggestion].place\n );\n // Reset is handled within onPlaceSelected via reset(true)\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n // Visual feedback for key press\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdEscape?.classList.add(cl));\n setTimeout(\n () =>\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdEscape?.classList.remove(cl)),\n 300\n );\n this._reset(true); // Reset search input and results, refresh token\n }\n }\n\n /**\n * Debounced function to fetch autocomplete suggestions from the Google Places API.\n * Triggered by the 'input' event on the input element.\n */\n _debouncedMakeAcRequest = this._debounce(async () => {\n if (!this.#inputElement || !this.#inputElement.value) {\n this._reset();\n if (this.#inputElement)\n this.#inputElement.setAttribute(\"aria-expanded\", \"false\");\n return;\n }\n\n this.#request.input = this.#inputElement.value;\n //console.log(\"Request:\", this.#request); // Debugging\n try {\n const { suggestions } =\n // eslint-disable-next-line no-undef\n await google.maps.places.AutocompleteSuggestion.fetchAutocompleteSuggestions(\n this.#request\n );\n\n // Display suggestions\n if (suggestions && suggestions.length > 0) {\n this.#ul.replaceChildren(\n ...this._createSuggestionElements(suggestions)\n );\n this.#ul.style.display = \"block\";\n this.#inputElement.setAttribute(\"aria-expanded\", \"true\");\n } else {\n // No suggestions found\n this._reset(); // Clear any old suggestions\n this.#inputElement.setAttribute(\"aria-expanded\", \"false\");\n // Optionally display a \"no results\" message in the 'ul'\n }\n } catch (error) {\n this.#onErrorCallback(error);\n this._reset();\n if (this.#inputElement)\n this.#inputElement.setAttribute(\"aria-expanded\", \"false\");\n }\n }, this.#options?.debounce ?? 100);\n\n /**\n * Creates an array of list item (LI) elements for the suggestions dropdown.\n * Each LI contains a link (A) with the place prediction details and distance.\n * Handles highlighting the matched parts of the suggestion text.\n * @param {Array<google.maps.places.AutocompleteSuggestion>} suggestions - Array of suggestion objects from the API.\n * @returns {Array<HTMLLIElement>} An array of LI elements to be added to the suggestions UL.\n */\n _createSuggestionElements(suggestions) {\n this.#allSuggestions = []; // Reset before populating\n return suggestions.map((suggestion, index) => {\n this.#allSuggestions.push({\n id: index + 1,\n description: suggestion.placePrediction.toString(),\n place: suggestion.placePrediction.toPlace(),\n });\n\n // create div elements\n const divContainer = document.createElement(\"div\");\n divContainer.className = this.#options.classes.li_div_container; // flex min-w-0 gap-x-4\n // create inner div element - place name\n const divInner = document.createElement(\"div\");\n divInner.className = this.#options.classes.li_div_one; // min-w-0 flex-auto\n divContainer.appendChild(divInner);\n // create p element - place name\n const p = document.createElement(\"p\");\n p.className = this.#options.classes.li_div_one_p; // text-sm/6\n\n // get prediction text\n const predictionText = suggestion.placePrediction.text;\n const originalText = predictionText.text;\n // Array of objects with startOffset, endOffset\n const matches = predictionText.matches;\n\n //Highlighting Logic\n let lastIndex = 0;\n\n // Sort matches just in case they aren't ordered (though they usually are)\n matches.sort((a, b) => a.startOffset - b.startOffset);\n\n // 1. Create the outer span\n const outerSpan = document.createElement(\"span\");\n\n // 2. Create the inner span for the bold part\n const innerSpan = document.createElement(\"span\");\n innerSpan.classList = this.#options.classes.highlight ?? \"font-bold\"; // Use the highlight class from options\n\n for (const match of matches) {\n // Append text before the current match\n outerSpan.textContent += originalText.substring(\n lastIndex,\n match.startOffset\n );\n\n // Append the highlighted match segment\n if (match.startOffset > 0) {\n // check previous charter is space\n const prevChar = originalText.charAt(match.startOffset - 1);\n if (prevChar == \" \") {\n innerSpan.textContent += \" \";\n }\n }\n innerSpan.textContent += originalText.substring(\n match.startOffset,\n match.endOffset\n );\n\n // Update the last index processed\n lastIndex = match.endOffset;\n }\n\n // 3. Create a text node for the remaining text\n const remainingText = document.createTextNode(\n originalText.substring(lastIndex)\n );\n\n // 4. Append the inner span and the text node to the outer span\n outerSpan.appendChild(innerSpan);\n outerSpan.appendChild(remainingText);\n\n // 5. Append the outer span to the paragraph element\n p.appendChild(outerSpan);\n\n divInner.appendChild(p);\n divContainer.appendChild(divInner);\n\n // create inner div element - distance\n const divInner2 = document.createElement(\"div\");\n divInner2.className = this.#options.classes.li_div_two; //'shrink-0 flex flex-col items-end min-w-16';\n divContainer.appendChild(divInner2);\n // create p element - distance\n const p2 = document.createElement(\"p\");\n p2.className = this.#options.classes.li_div_two_p; //'mt-1 text-xs/5 ';\n p2.textContent = this._formatDistance(\n suggestion.placePrediction.distanceMeters,\n this.#options.distance_units ?? \"km\"\n );\n divInner2.appendChild(p2);\n\n // // create a link element\n const a = document.createElement(\"a\");\n a.href = \"javascript:void(0)\";\n a.tabIndex = index + 1;\n a.className = this.#options.classes.li_a; // block w-full flex justify-between\n\n a.addEventListener(\"click\", () => {\n this._onPlaceSelected(suggestion.placePrediction.toPlace());\n });\n\n // ...\n // a.addEventListener(\"click\", () => {\n // this._fetchPlaceDetails(prediction.place_id);\n // });\n a.appendChild(divContainer);\n a.appendChild(divInner2);\n\n const li = document.createElement(\"li\");\n li.id = `option-${index + 1}`;\n li.className = this.#options.classes.li;\n\n li.appendChild(a);\n return li;\n });\n }\n\n /**\n * Handles the selection of a place. Fetches required fields\n * (displayName, formattedAddress, addressComponents) and calls the\n * user-defined `onPacData` callback.\n * @param {google.maps.places.Place} place - The selected Place object.\n */\n async _onPlaceSelected(place) {\n try {\n // Fetch necessary details for the selected place\n await place.fetchFields({\n fields: [\"displayName\", \"formattedAddress\", \"addressComponents\"], // Add more fields as needed\n });\n // Call the user-provided callback with the place data\n // eslint-disable-next-line no-undef\n this.#onDataCallback(place.toJSON()); // Convert to plain JSON object for the callback\n } catch (error) {\n console.error(\"Error fetching place details:\", error);\n // eslint-disable-next-line no-undef\n this.#onErrorCallback(error);\n } finally {\n // Reset the input and suggestions regardless of success/error\n this._reset(true); // Refresh token after selection\n }\n }\n\n /**\n * Creates a new Google Places Autocomplete Session Token.\n * This should be called before starting a new series of autocomplete requests.\n */\n _refreshToken() {\n try {\n // eslint-disable-next-line no-undef\n this.#request.sessionToken =\n new google.maps.places.AutocompleteSessionToken();\n } catch (error) {\n console.error(\"Error creating session token:\", error);\n // eslint-disable-next-line no-undef\n this.#onErrorCallback(error);\n }\n }\n\n clear() {\n this._reset(true);\n }\n\n destroy() {\n // Remove event listeners, remove elements from DOM\n if (this.#inputElement) {\n this.#inputElement.removeEventListener(\n \"input\",\n this._debouncedMakeAcRequest\n );\n // remove other listeners\n }\n if (this.#pacEl && this.#container) {\n this.#pacEl.removeChild(this.#container.parentElement); // remove the whole section\n }\n // Nullify properties\n for (const prop in this) {\n if (Object.hasOwn(this, prop)) {\n this[prop] = null;\n }\n }\n console.log(\"PacAutocomplete instance destroyed.\");\n }\n}\n"],"names":["_a","_pacEl","_googleMapsApiKey","_googleMapsApiVersion","_options","_request","_inputElement","_container","_ul","_kbdEscape","_kbdUp","_kbdDown","_allSuggestions","_currentSuggestion","_onDataCallback","_onErrorCallback","_defaultClasses","PlacesAutocomplete","config","__privateAdd","__publicField","__privateGet","suggestions","error","__privateSet","place","func","wait","timeout","args","later","distance","units","value","unitLabel","g","h","a","k","p","c","l","q","m","b","d","r","e","u","f","n","t","section","cl","iconContainer","icon","label","kbdContainer","refresh","li","link","currentLi","currentA","suggestion","index","divContainer","divInner","predictionText","originalText","matches","lastIndex","outerSpan","innerSpan","match","remainingText","divInner2","p2","prop"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC;AAgBO,MAAMC,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0D9B,YAAYC,GAAQ;AAxDpB;AAAA,IAAAC,EAAA,MAAAlB;AACA,IAAAkB,EAAA,MAAAjB;AACA,IAAAiB,EAAA,MAAAhB;AACA,IAAAgB,EAAA,MAAAf;AACA,IAAAe,EAAA,MAAAd;AACA,IAAAc,EAAA,MAAAb;AACA,IAAAa,EAAA,MAAAZ;AACA,IAAAY,EAAA,MAAAX;AACA,IAAAW,EAAA,MAAAV;AACA,IAAAU,EAAA,MAAAT;AACA,IAAAS,EAAA,MAAAR;AACA,IAAAQ,EAAA,MAAAP,GAAkB,CAAE;AACpB,IAAAO,EAAA,MAAAN,GAAqB;AACrB,IAAAM,EAAA,MAAAL;AACA;AAAA,IAAAK,EAAA,MAAAJ;AACA;AAAA,IAAAI,EAAA,MAAAH,GAAkB;AAAA;AAAA,MAEhB,SAAS;AAAA;AAAA,MACT,WAAW;AAAA;AAAA,MACX,gBACE;AAAA;AAAA,MACF,MAAM;AAAA;AAAA,MACN,OACE;AAAA;AAAA,MACF,eAAe;AAAA;AAAA,MACf,YACE;A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OAAO,yBAA0B;AAAA,IACpD,SAAQkB,GAAO;AACd,cAAQ,MAAM,iCAAiCA,CAAK,GAEpDF,EAAA,MAAKN,GAAL,WAAsBQ;AAAA,IAC5B;AAAA,EACA;AAAA,EAEE,QAAQ;AACN,SAAK,OAAO,EAAI;AAAA,EACpB;AAAA,EAEE,UAAU;AAER,IAAIF,EAAA,MAAKf,MACPe,EAAA,MAAKf,GAAc;AAAA,MACjB;AAAA,MACA,KAAK;AAAA,IACN,GAGCe,EAAA,MAAKpB,MAAUoB,EAAA,MAAKd,MACtBc,EAAA,MAAKpB,GAAO,YAAYoB,EAAA,MAAKd,GAAW,aAAa;AAGvD,eAAWsE,KAAQ;AACjB,MAAI,OAAO,OAAO,MAAMA,CAAI,MAC1B,KAAKA,CAAI,IAAI;AAGjB,YAAQ,IAAI,qCAAqC;AAAA,EACrD;AACA;AAhuBE5E,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA,eACAC,IAAA;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function(r,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(r=typeof globalThis<"u"?globalThis:r||self,l(r.PlacesAutocomplete={}))})(this,function(r){"use strict";var B=Object.defineProperty;var K=r=>{throw TypeError(r)};var H=(r,l,d)=>l in r?B(r,l,{enumerable:!0,configurable:!0,writable:!0,value:d}):r[l]=d;var $=(r,l,d)=>H(r,typeof l!="symbol"?l+"":l,d),F=(r,l,d)=>l.has(r)||K("Cannot "+d);var e=(r,l,d)=>(F(r,l,"read from private field"),d?d.call(r):l.get(r)),p=(r,l,d)=>l.has(r)?K("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(r):l.set(r,d),h=(r,l,d,f)=>(F(r,l,"write to private field"),f?f.call(r,d):l.set(r,d),d);/**
|
|
2
|
+
* Initializes a Places Autocomplete widget.
|
|
3
|
+
* This script dynamically loads the Google Maps JavaScript API, creates the UI elements
|
|
4
|
+
* for the autocomplete input and suggestions list, handles user input with debouncing,
|
|
5
|
+
* fetches suggestions, manages keyboard navigation, and calls user-defined callbacks
|
|
6
|
+
* on place selection or error.
|
|
7
|
+
*
|
|
8
|
+
* @author Alexander Pechkarev <alexpechkarev@gmail.com>
|
|
9
|
+
* @license MIT
|
|
10
|
+
*
|
|
11
|
+
*/var d,f,q,j,i,S,o,b,c,E,w,k,_,u,z,y,G;class l{constructor(t){p(this,f);p(this,q);p(this,j);p(this,i);p(this,S);p(this,o);p(this,b);p(this,c);p(this,E);p(this,w);p(this,k);p(this,_,[]);p(this,u,-1);p(this,z);p(this,y);p(this,G,{section:"",container:"relative z-10 transform rounded-xl mt-4",icon_container:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3",icon:'<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8" /><path d="m21 21-4.3-4.3" /></svg>',input:"border-1 w-full rounded-md border-0 shadow-sm bg-gray-100 px-4 py-2.5 pl-10 pr-20 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 sm:text-sm",kbd_container:"absolute inset-y-0 right-0 flex py-1.5 pr-1.5",kbd_escape:"inline-flex items-center rounded border border-gray-300 px-1 font-sans text-xs text-gray-500 w-8 mr-1",kbd_up:"inline-flex items-center justify-center rounded border border-gray-300 px-1 font-sans text-xs text-gray-500 w-6",kbd_down:"inline-flex items-center rounded border border-gray-400 px-1 font-sans text-xs text-gray-500 justify-center w-6",kbd_active:"bg-indigo-500 text-white",ul:"absolute z-50 -mb-2 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm divide-y divide-gray-100",li:"z-50 cursor-default select-none py-2 px-2 lg:px-4 text-gray-900 hover:bg-indigo-500 hover:text-white",li_current:"bg-indigo-500",li_a:"block w-full flex justify-between",li_a_current:"text-white",li_div_container:"flex min-w-0 gap-x-4",li_div_one:"min-w-0 flex-auto",li_div_one_p:"text-sm/6",li_div_two:"shrink-0 flex flex-col items-end min-w-16",li_div_two_p:"mt-1 text-xs/5",highlight:"font-bold"});$(this,"_debouncedMakeAcRequest",this._debounce(async()=>{if(!e(this,o)||!e(this,o).value){this._reset(),e(this,o)&&e(this,o).setAttribute("aria-expanded","false");return}e(this,S).input=e(this,o).value;try{const{suggestions:t}=await google.maps.places.AutocompleteSuggestion.fetchAutocompleteSuggestions(e(this,S));t&&t.length>0?(e(this,c).replaceChildren(...this._createSuggestionElements(t)),e(this,c).style.display="block",e(this,o).setAttribute("aria-expanded","true")):(this._reset(),e(this,o).setAttribute("aria-expanded","false"))}catch(t){e(this,y).call(this,t),this._reset(),e(this,o)&&e(this,o).setAttribute("aria-expanded","false")}},((d=e(this,i))==null?void 0:d.debounce)??100));if(!t||!t.containerId||!t.googleMapsApiKey)throw new Error("PacAutocomplete: Missing required configuration (containerId, googleMapsApiKey).");if(h(this,f,document.getElementById(t.containerId)),!e(this,f))throw new Error(`PacAutocomplete: Container element with ID "${t.containerId}" not found.`);h(this,q,t.googleMapsApiKey),h(this,j,t.googleMapsApiVersion||"weekly"),h(this,i,{autofocus:!1,autocomplete:"off",placeholder:"Start typing your address ...",distance:!0,distance_units:"km",label:"",debounce:100,...t.options}),t.options&&t.options.classes&&(e(this,i).classes={...e(this,G),...t.options.classes}),h(this,z,t.onResponse||(n=>{console.info("---------Default onResponse not provided---------"),console.info("Selected Place:",JSON.stringify(n,null,2))})),h(this,y,t.onError||(n=>{console.error("---------Default onError not provided---------"),console.error("PAC Error:",n)})),h(this,S,{input:"",includedRegionCodes:["GB"],language:"en-gb",region:"GB",...t.requestParams}),this._init()}async _init(){try{(typeof google>"u"||!google.maps)&&await this._loadGoogleMapsApi({key:e(this,q),v:e(this,j)}),this._createPACStructure(),await this._initializeAutocomplete()}catch(t){e(this,y).call(this,t)}}_debounce(t,n){let s=null;return function(...m){const v=()=>{s=null,t(...m)};s!==null&&clearTimeout(s),s=setTimeout(v,n??100)}}_formatDistance(t,n){if(typeof t!="number"||!e(this,i).distance)return null;let s,a;return n==="km"?(s=(t/1e3).toFixed(2),a="km"):(s=(t/1609.34).toFixed(2),a="miles"),s=s.replace(/\.00$/,""),`${s} ${a}`}async _loadGoogleMapsApi(t){var n,s,a,m="The Google Maps JavaScript API",v="google",N="importLibrary",P="__ib__",I=document,C=window;C=C[v]||(C[v]={});var A=C.maps||(C.maps={}),T=new Set,D=new URLSearchParams,O=()=>n||(n=new Promise(async(L,g)=>{var M;s=I.createElement("script"),D.set("libraries",[...T].join(","));for(a in t)D.set(a.replace(/[A-Z]/g,x=>"_"+x[0].toLowerCase()),t[a]);D.set("callback",v+".maps."+P),s.src=`https://maps.${v}apis.com/maps/api/js?`+D,A[P]=L,s.onerror=()=>n=g(Error(m+" could not load.")),s.nonce=((M=I.querySelector("script[nonce]"))==null?void 0:M.nonce)||"",I.head.append(s)}));A[N]?console.warn(m+" only loads once. Ignoring:",t):A[N]=(L,...g)=>T.add(L)&&O().then(()=>A[N](L,...g))}_createPACStructure(){const t=document.createElement("section");e(this,i).classes.section.split(" ").forEach(m=>m&&t.classList.add(m)),h(this,b,document.createElement("div")),e(this,b).className=e(this,i).classes.container,e(this,b).setAttribute("id",e(this,f)),t.appendChild(e(this,b));const n=document.createElement("div");n.className=e(this,i).classes.icon_container,e(this,b).appendChild(n);const s=document.createElement("div");if(s.innerHTML=e(this,i).classes.icon,n.appendChild(s.firstElementChild),h(this,o,document.createElement("input")),e(this,o).id="input"+e(this,f),e(this,o).type="text",e(this,o).name="search",e(this,o).placeholder=e(this,i).placeholder,e(this,o).autocomplete=e(this,i).autocomplete,e(this,o).className=e(this,i).classes.input,e(this,o).setAttribute("role","combobox"),e(this,o).setAttribute("aria-autocomplete","list"),e(this,o).setAttribute("aria-expanded","false"),e(this,o).setAttribute("aria-controls","pacSuggestions"),e(this,i).autofocus&&(e(this,o).autofocus=!0),e(this,i).label){const m=document.createElement("label");m.htmlFor="labelInput"+e(this,f),m.textContent=e(this,i).label,e(this,b).appendChild(m)}e(this,b).appendChild(e(this,o));const a=document.createElement("div");a.className=e(this,i).classes.kbd_container,h(this,E,document.createElement("kbd")),e(this,E).className=e(this,i).classes.kbd_escape,e(this,E).textContent="Esc",a.appendChild(e(this,E)),h(this,w,document.createElement("kbd")),e(this,w).className=e(this,i).classes.kbd_up,e(this,w).innerHTML="↑",a.appendChild(e(this,w)),h(this,k,document.createElement("kbd")),e(this,k).className=e(this,i).classes.kbd_down,e(this,k).innerHTML="↓",a.appendChild(e(this,k)),e(this,b).appendChild(a),h(this,c,document.createElement("ul")),e(this,c).id="pacSuggestions",e(this,c).className=e(this,i).classes.ul,e(this,c).style.display="none",e(this,c).setAttribute("role","listbox"),e(this,b).appendChild(e(this,c)),e(this,f).appendChild(t),t.addEventListener("keydown",this._onKeyDown.bind(this))}async _initializeAutocomplete(){try{await google.maps.importLibrary("places"),this._refreshToken(),e(this,o)?(e(this,o).addEventListener("input",this._debouncedMakeAcRequest.bind(this)),e(this,o).addEventListener("blur",()=>{setTimeout(()=>{e(this,c)&&!e(this,c).contains(document.activeElement)&&(e(this,c).style.display="none",e(this,o).setAttribute("aria-expanded","false"))},200)}),e(this,o).addEventListener("focus",()=>{e(this,o).value&&e(this,_).length>0&&(e(this,c).style.display="block",e(this,o).setAttribute("aria-expanded","true"))})):e(this,y).call(this,new Error("Input element not found during initialization."))}catch(t){console.error("Error initializing Google Places Autocomplete:",t),e(this,y).call(this,new Error("Google Maps Places library not available."))}}_reset(t=!1){h(this,u,-1),e(this,o)&&(e(this,o).value=""),h(this,_,[]),h(this,u,-1),e(this,c)&&(e(this,c).innerHTML="",e(this,c).style.display="none"),t&&this._refreshToken()}_resetLiClasses(){e(this,c)&&Array.from(e(this,c).children).forEach(t=>{e(this,i).classes.li_current.split(" ").forEach(s=>t.classList.remove(s));const n=t.querySelector("a");n&&e(this,i).classes.li_a_current.split(" ").forEach(s=>n.classList.remove(s))})}_onKeyDown(t){if(!(!e(this,_).length||!e(this,c)||e(this,c).style.display==="none"))if(this._resetLiClasses(),t.key==="ArrowDown"){t.preventDefault(),h(this,u,Math.min(e(this,u)+1,e(this,_).length-1)),e(this,u)<0&&h(this,u,0);const n=e(this,c).children.item(e(this,u));if(n){const s=n.querySelector("a");e(this,i).classes.li_current.split(" ").forEach(a=>n.classList.add(a)),s&&e(this,i).classes.li_a_current.split(" ").forEach(a=>s.classList.add(a)),n.scrollIntoView({block:"nearest"})}e(this,i).classes.kbd_active.split(" ").forEach(s=>{var a;return(a=e(this,k))==null?void 0:a.classList.add(s)}),setTimeout(()=>e(this,i).classes.kbd_active.split(" ").forEach(s=>{var a;return(a=e(this,k))==null?void 0:a.classList.remove(s)}),300)}else if(t.key==="ArrowUp"){t.preventDefault(),h(this,u,Math.max(e(this,u)-1,0));const n=e(this,c).children.item(e(this,u));if(n){const s=n.querySelector("a");e(this,i).classes.li_current.split(" ").forEach(a=>n.classList.add(a)),s&&e(this,i).classes.li_a_current.split(" ").forEach(a=>s.classList.add(a)),n.scrollIntoView({block:"nearest"})}e(this,i).classes.kbd_active.split(" ").forEach(s=>{var a;return(a=e(this,w))==null?void 0:a.classList.add(s)}),setTimeout(()=>e(this,i).classes.kbd_active.split(" ").forEach(s=>{var a;return(a=e(this,w))==null?void 0:a.classList.remove(s)}),300)}else t.key==="Enter"?(t.preventDefault(),e(this,u)>=0&&e(this,u)<e(this,_).length&&this._onPlaceSelected(e(this,_)[e(this,u)].place)):t.key==="Escape"&&(t.preventDefault(),e(this,i).classes.kbd_active.split(" ").forEach(n=>{var s;return(s=e(this,E))==null?void 0:s.classList.add(n)}),setTimeout(()=>e(this,i).classes.kbd_active.split(" ").forEach(n=>{var s;return(s=e(this,E))==null?void 0:s.classList.remove(n)}),300),this._reset(!0))}_createSuggestionElements(t){return h(this,_,[]),t.map((n,s)=>{e(this,_).push({id:s+1,description:n.placePrediction.toString(),place:n.placePrediction.toPlace()});const a=document.createElement("div");a.className=e(this,i).classes.li_div_container;const m=document.createElement("div");m.className=e(this,i).classes.li_div_one,a.appendChild(m);const v=document.createElement("p");v.className=e(this,i).classes.li_div_one_p;const N=n.placePrediction.text,P=N.text,I=N.matches;let C=0;I.sort((x,R)=>x.startOffset-R.startOffset);const A=document.createElement("span"),T=document.createElement("span");T.classList=e(this,i).classes.highlight??"font-bold";for(const x of I)A.textContent+=P.substring(C,x.startOffset),x.startOffset>0&&P.charAt(x.startOffset-1)==" "&&(T.textContent+=" "),T.textContent+=P.substring(x.startOffset,x.endOffset),C=x.endOffset;const D=document.createTextNode(P.substring(C));A.appendChild(T),A.appendChild(D),v.appendChild(A),m.appendChild(v),a.appendChild(m);const O=document.createElement("div");O.className=e(this,i).classes.li_div_two,a.appendChild(O);const L=document.createElement("p");L.className=e(this,i).classes.li_div_two_p,L.textContent=this._formatDistance(n.placePrediction.distanceMeters,e(this,i).distance_units??"km"),O.appendChild(L);const g=document.createElement("a");g.href="javascript:void(0)",g.tabIndex=s+1,g.className=e(this,i).classes.li_a,g.addEventListener("click",()=>{this._onPlaceSelected(n.placePrediction.toPlace())}),g.appendChild(a),g.appendChild(O);const M=document.createElement("li");return M.id=`option-${s+1}`,M.className=e(this,i).classes.li,M.appendChild(g),M})}async _onPlaceSelected(t){try{await t.fetchFields({fields:["displayName","formattedAddress","addressComponents"]}),e(this,z).call(this,t.toJSON())}catch(n){console.error("Error fetching place details:",n),e(this,y).call(this,n)}finally{this._reset(!0)}}_refreshToken(){try{e(this,S).sessionToken=new google.maps.places.AutocompleteSessionToken}catch(t){console.error("Error creating session token:",t),e(this,y).call(this,t)}}clear(){this._reset(!0)}destroy(){e(this,o)&&e(this,o).removeEventListener("input",this._debouncedMakeAcRequest),e(this,f)&&e(this,b)&&e(this,f).removeChild(e(this,b).parentElement);for(const t in this)Object.hasOwn(this,t)&&(this[t]=null);console.log("PacAutocomplete instance destroyed.")}}f=new WeakMap,q=new WeakMap,j=new WeakMap,i=new WeakMap,S=new WeakMap,o=new WeakMap,b=new WeakMap,c=new WeakMap,E=new WeakMap,w=new WeakMap,k=new WeakMap,_=new WeakMap,u=new WeakMap,z=new WeakMap,y=new WeakMap,G=new WeakMap,r.PlacesAutocomplete=l,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|
|
12
|
+
//# sourceMappingURL=places-autocomplete.umd.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"places-autocomplete.umd.cjs","sources":["../lib/PlacesAutocomplete.js"],"sourcesContent":["/**\n * Initializes a Places Autocomplete widget.\n * This script dynamically loads the Google Maps JavaScript API, creates the UI elements\n * for the autocomplete input and suggestions list, handles user input with debouncing,\n * fetches suggestions, manages keyboard navigation, and calls user-defined callbacks\n * on place selection or error.\n *\n * @author Alexander Pechkarev <alexpechkarev@gmail.com>\n * @license MIT\n *\n */\n\n/**\n * PacAutocomplete class\n * This class provides a Places Autocomplete widget.\n */\nexport class PlacesAutocomplete {\n // --- Private Properties (using # or _ prefix by convention) ---\n #pacEl;\n #googleMapsApiKey;\n #googleMapsApiVersion;\n #options;\n #request;\n #inputElement;\n #container;\n #ul;\n #kbdEscape;\n #kbdUp;\n #kbdDown;\n #allSuggestions = [];\n #currentSuggestion = -1;\n #onDataCallback; // For user-provided data callback\n #onErrorCallback; // For user-provided error callback\n #defaultClasses = {\n // CSS classes for various parts of the widget.\n section: \"\", // Outer section container.\n container: \"relative z-10 transform rounded-xl mt-4\", // Main container div.\n icon_container:\n \"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3\", // Container for the search icon.\n icon: '<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"w-5 h-5\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\" /><path d=\"m21 21-4.3-4.3\" /></svg>', // SVG for the search icon.\n input:\n \"border-1 w-full rounded-md border-0 shadow-sm bg-gray-100 px-4 py-2.5 pl-10 pr-20 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 sm:text-sm\", // Input field.\n kbd_container: \"absolute inset-y-0 right-0 flex py-1.5 pr-1.5\", // Container for keyboard hints.\n kbd_escape:\n \"inline-flex items-center rounded border border-gray-300 px-1 font-sans text-xs text-gray-500 w-8 mr-1\", // Escape key hint.\n kbd_up:\n \"inline-flex items-center justify-center rounded border border-gray-300 px-1 font-sans text-xs text-gray-500 w-6\", // Up arrow key hint.\n kbd_down:\n \"inline-flex items-center rounded border border-gray-400 px-1 font-sans text-xs text-gray-500 justify-center w-6\", // Down arrow key hint.\n kbd_active: \"bg-indigo-500 text-white\", // Class for active keyboard hint.\n ul: \"absolute z-50 -mb-2 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm divide-y divide-gray-100\", // Suggestions list (ul).\n li: \"z-50 cursor-default select-none py-2 px-2 lg:px-4 text-gray-900 hover:bg-indigo-500 hover:text-white\", // Suggestion item (li).\n li_current: \"bg-indigo-500\", // Class for the currently selected suggestion item.\n li_a: \"block w-full flex justify-between\", // Link element within a suggestion item.\n li_a_current: \"text-white\", // Class for the link in the currently selected suggestion item.\n li_div_container: \"flex min-w-0 gap-x-4\", // Container div within the suggestion link.\n li_div_one: \"min-w-0 flex-auto\", // First inner div (for place name).\n li_div_one_p: \"text-sm/6\", // Paragraph for the place name.\n li_div_two: \"shrink-0 flex flex-col items-end min-w-16\", // Second inner div (for distance).\n li_div_two_p: \"mt-1 text-xs/5\", // Paragraph for the distance.\n highlight: \"font-bold\", // Class for highlighting matched text in suggestions.\n };\n\n /**\n * Class constructor for PacAutocomplete.\n * Initializes the autocomplete widget with the provided configuration.\n * @param {Object} config - Configuration object for the autocomplete widget.\n * @param {string} config.containerId - ID of the container element for the widget.\n * @param {string} config.googleMapsApiKey - Google Maps API key.\n * @param {string} [config.googleMapsApiVersion] - Version of the Google Maps API to use (default: \"weekly\").\n * @param {Object} [config.options] - Additional options for the widget (e.g., classes, callbacks).\n * @param {Object} [config.requestParams] - Parameters for the autocomplete request (e.g., input, region).\n * @param {*} config\n */\n constructor(config) {\n //console.log(\"PacAutocomplete constructor called.\", config);\n if (!config || !config.containerId || !config.googleMapsApiKey) {\n throw new Error(\n \"PacAutocomplete: Missing required configuration (containerId, googleMapsApiKey).\"\n );\n }\n\n this.#pacEl = document.getElementById(config.containerId);\n if (!this.#pacEl) {\n throw new Error(\n `PacAutocomplete: Container element with ID \"${config.containerId}\" not found.`\n );\n }\n\n this.#googleMapsApiKey = config.googleMapsApiKey;\n this.#googleMapsApiVersion = config.googleMapsApiVersion || \"weekly\";\n\n // Merge user options with defaults\n this.#options = {\n autofocus: false, // Automatically focus the input on load.\n autocomplete: \"off\", // HTML autocomplete attribute for the input.\n placeholder: \"Start typing your address ...\", // Placeholder text for the input.\n distance: true, // Show distance in suggestions (requires origin in request).\n distance_units: \"km\", // Units for distance ('km' or 'miles').\n label: \"\", // Optional label text above the input.\n debounce: 100, // Debounce delay (ms) for API requests.\n ...config.options, // User-defined options override defaults\n };\n // Ensure classes are deeply merged if user provides partial classes\n if (config.options && config.options.classes) {\n this.#options.classes = {\n ...this.#defaultClasses,\n ...config.options.classes,\n };\n }\n\n // Set default response and error callbacks if not provided\n this.#onDataCallback =\n config.onResponse ||\n ((place) => {\n console.info(\"---------Default onResponse not provided---------\");\n console.info(\"Selected Place:\", JSON.stringify(place, null, 2));\n });\n this.#onErrorCallback =\n config.onError ||\n ((error) => {\n console.error(\"---------Default onError not provided---------\");\n console.error(\"PAC Error:\", error);\n });\n\n this.#request = {\n input: \"\",\n includedRegionCodes: [\"GB\"],\n language: \"en-gb\",\n region: \"GB\",\n ...config.requestParams, // User-defined request params override defaults\n };\n\n //console.log(this.#request);\n\n this._init(); // Underscore prefix for internal initialization method\n }\n\n // --- Private Initialization Method ---\n async _init() {\n try {\n // check if google maps api is already loaded\n if (typeof google === \"undefined\" || !google.maps) {\n // Load the Google Maps API dynamically\n await this._loadGoogleMapsApi({\n key: this.#googleMapsApiKey,\n v: this.#googleMapsApiVersion,\n });\n }\n this._createPACStructure(); // Pass this.#options\n await this._initializeAutocomplete(); // Pass this.#options\n //console.log(\"PacAutocomplete Initialized for container:\", this.#pacEl.id);\n } catch (error) {\n this.#onErrorCallback(error);\n }\n }\n\n /**\n * Creates a debounced version of a function.\n * The debounced function delays invoking `func` until after `wait` milliseconds have\n * elapsed since the last time the debounced function was invoked.\n * @param {Function} func - The function to debounce.\n * @param {number} wait - The number of milliseconds to delay.\n * @returns {Function} The new debounced function.\n */\n _debounce(func, wait) {\n let timeout = null;\n return function executedFunction(...args) {\n const later = () => {\n timeout = null;\n func(...args); // Call original function\n };\n if (timeout !== null) {\n clearTimeout(timeout); // Clear the previous timeout\n }\n timeout = setTimeout(later, wait ?? 100); // Set the new timeout\n };\n }\n /**\n * Formats a distance in meters into kilometers or miles.\n * @param {number | null | undefined} distance - Distance in meters.\n * @param {'km' | 'miles'} units - The desired output units.\n * @returns {string | null} Formatted distance string (e.g., \"1.23 km\") or null if input is invalid.\n */\n _formatDistance(distance, units) {\n if (typeof distance !== \"number\" || !this.#options.distance) {\n return null; // Return null if distance isn't shown or invalid\n }\n let value;\n let unitLabel;\n if (units === \"km\") {\n value = (distance / 1000).toFixed(2);\n unitLabel = \"km\";\n } else {\n // Default to miles if not 'km'\n value = (distance / 1609.34).toFixed(2);\n unitLabel = \"miles\";\n }\n // Avoid showing \".00\"\n value = value.replace(/\\.00$/, \"\");\n return `${value} ${unitLabel}`;\n }\n\n /**\n * Dynamically loads the Google Maps JavaScript API using the importLibrary method.\n * This is the standard approach recommended by Google.\n * @see https://developers.google.com/maps/documentation/javascript/load-maps-js-api\n * @param {object} g - Configuration object for the API loader (key, v, libraries, etc.).\n */\n async _loadGoogleMapsApi(g) {\n var h, // Promise tracking API load\n a, // Script element\n k, // Loop variable for config keys\n p = \"The Google Maps JavaScript API\", // Error message prefix\n c = \"google\", // Global namespace\n l = \"importLibrary\", // Loader function name\n q = \"__ib__\", // Internal callback name\n m = document, // Document reference\n b = window; // Window reference\n b = b[c] || (b[c] = {}); // Ensure google namespace exists\n var d = b.maps || (b.maps = {}), // Ensure google.maps namespace exists\n r = new Set(), // Set to track requested libraries\n e = new URLSearchParams(), // URL parameters for the API script\n u = () =>\n // Function to initiate API loading (if not already started)\n h ||\n // eslint-disable-next-line no-async-promise-executor\n (h = new Promise(async (f, n) => {\n // Create script element (done async to potentially wait for nonce)\n // await (a = m.createElement('script')); // Original Google code had await here, might not be needed\n a = m.createElement(\"script\"); // Create script tag\n e.set(\"libraries\", [...r].join(\",\")); // Add accumulated libraries\n // Add other parameters from the config object 'g'\n for (k in g)\n e.set(\n k.replace(/[A-Z]/g, (t) => \"_\" + t[0].toLowerCase()), // Convert camelCase to snake_case\n g[k]\n );\n e.set(\"callback\", c + \".maps.\" + q); // Set the internal callback function name\n a.src = `https://maps.${c}apis.com/maps/api/js?` + e; // Construct the API URL\n d[q] = f; // Assign the promise resolver to the callback name on google.maps\n // Error handling for script loading failure\n a.onerror = () => (h = n(Error(p + \" could not load.\"))); // Use onerror for load failures\n // Nonce for Content Security Policy\n a.nonce = m.querySelector(\"script[nonce]\")?.nonce || \"\";\n m.head.append(a); // Append the script to the document head\n }));\n // Define or reuse the importLibrary function on google.maps\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n d[l]\n ? console.warn(p + \" only loads once. Ignoring:\", g) // Warn if called again\n : (d[l] = (f, ...n) => r.add(f) && u().then(() => d[l](f, ...n))); // The actual importLibrary implementation\n }\n\n // --- UI Creation ---\n _createPACStructure() {\n const section = document.createElement(\"section\");\n this.#options.classes.section\n .split(\" \")\n .forEach((cl) => cl && section.classList.add(cl));\n\n // Main container\n this.#container = document.createElement(\"div\");\n this.#container.className = this.#options.classes.container;\n this.#container.setAttribute(\"id\", this.#pacEl);\n section.appendChild(this.#container);\n\n // Icon\n const iconContainer = document.createElement(\"div\");\n iconContainer.className = this.#options.classes.icon_container;\n this.#container.appendChild(iconContainer);\n const icon = document.createElement(\"div\");\n icon.innerHTML = this.#options.classes.icon;\n iconContainer.appendChild(icon.firstElementChild); // Append the actual SVG element\n\n // Input field\n this.#inputElement = document.createElement(\"input\");\n this.#inputElement.id = \"input\" + this.#pacEl; // Assign ID for label association\n this.#inputElement.type = \"text\";\n this.#inputElement.name = \"search\"; // Consider making name configurable\n this.#inputElement.placeholder = this.#options.placeholder;\n this.#inputElement.autocomplete = this.#options.autocomplete;\n this.#inputElement.className = this.#options.classes.input;\n this.#inputElement.setAttribute(\"role\", \"combobox\");\n this.#inputElement.setAttribute(\"aria-autocomplete\", \"list\");\n this.#inputElement.setAttribute(\"aria-expanded\", \"false\"); // Will be updated dynamically\n this.#inputElement.setAttribute(\"aria-controls\", \"pacSuggestions\"); // Links to the suggestions list\n\n if (this.#options.autofocus) {\n this.#inputElement.autofocus = true;\n }\n if (this.#options.label) {\n const label = document.createElement(\"label\");\n label.htmlFor = \"labelInput\" + this.#pacEl; // Assuming inputElement gets this ID\n label.textContent = this.#options.label;\n // Add label classes if needed from opts.classes\n this.#container.appendChild(label); // Append label before input or adjust structure\n }\n this.#container.appendChild(this.#inputElement);\n\n // Keyboard hints container\n const kbdContainer = document.createElement(\"div\");\n kbdContainer.className = this.#options.classes.kbd_container;\n this.#kbdEscape = document.createElement(\"kbd\");\n this.#kbdEscape.className = this.#options.classes.kbd_escape;\n this.#kbdEscape.textContent = \"Esc\";\n kbdContainer.appendChild(this.#kbdEscape);\n this.#kbdUp = document.createElement(\"kbd\");\n this.#kbdUp.className = this.#options.classes.kbd_up;\n this.#kbdUp.innerHTML = \"↑\"; // Up arrow HTML entity\n kbdContainer.appendChild(this.#kbdUp);\n this.#kbdDown = document.createElement(\"kbd\");\n this.#kbdDown.className = this.#options.classes.kbd_down;\n this.#kbdDown.innerHTML = \"↓\"; // Down arrow HTML entity\n kbdContainer.appendChild(this.#kbdDown);\n this.#container.appendChild(kbdContainer);\n\n // Suggestions list (initially hidden)\n this.#ul = document.createElement(\"ul\");\n this.#ul.id = \"pacSuggestions\"; // Must match aria-controls\n this.#ul.className = this.#options.classes.ul;\n this.#ul.style.display = \"none\";\n this.#ul.setAttribute(\"role\", \"listbox\");\n this.#container.appendChild(this.#ul);\n\n this.#pacEl.appendChild(section);\n section.addEventListener(\"keydown\", this._onKeyDown.bind(this)); // Bind 'this'\n }\n\n /**\n * Initializes the core autocomplete functionality after the API is loaded.\n * Imports necessary libraries and sets up the input event listener.\n */\n async _initializeAutocomplete() {\n try {\n // Ensure the 'places' library is available via the dynamic loader\n // eslint-disable-next-line no-undef\n await google.maps.importLibrary(\"places\");\n // console.log('Places library imported successfully.'); // For debugging\n\n // Initial token generation\n this._refreshToken();\n\n // Attach the debounced request function to the input element's 'input' event\n if (this.#inputElement) {\n this.#inputElement.addEventListener(\n \"input\",\n this._debouncedMakeAcRequest.bind(this)\n );\n // Add focus/blur listeners if needed to manage suggestion visibility\n this.#inputElement.addEventListener(\"blur\", () => {\n // Delay hiding suggestions to allow click events on them\n setTimeout(() => {\n if (this.#ul && !this.#ul.contains(document.activeElement)) {\n // Check if focus moved outside suggestions\n this.#ul.style.display = \"none\";\n this.#inputElement.setAttribute(\"aria-expanded\", \"false\");\n }\n }, 200); // Adjust delay as needed\n });\n this.#inputElement.addEventListener(\"focus\", () => {\n // Potentially show suggestions again if input has value\n if (this.#inputElement.value && this.#allSuggestions.length > 0) {\n this.#ul.style.display = \"block\";\n this.#inputElement.setAttribute(\"aria-expanded\", \"true\");\n }\n });\n } else {\n this.#onErrorCallback(\n new Error(\"Input element not found during initialization.\")\n );\n }\n } catch (error) {\n console.error(\"Error initializing Google Places Autocomplete:\", error);\n // eslint-disable-next-line no-undef\n this.#onErrorCallback(\n new Error(\"Google Maps Places library not available.\")\n );\n }\n }\n\n /**\n * Resets the autocomplete input field, clears suggestions, and optionally refreshes the session token.\n * @param {boolean} [refresh=false] - Whether to refresh the Google Places session token.\n */\n _reset(refresh = false) {\n this.#currentSuggestion = -1;\n if (this.#inputElement) {\n this.#inputElement.value = \"\";\n }\n this.#allSuggestions = [];\n this.#currentSuggestion = -1;\n if (this.#ul) {\n this.#ul.innerHTML = \"\"; // Clear existing suggestions\n this.#ul.style.display = \"none\";\n }\n if (refresh) {\n this._refreshToken();\n }\n }\n /**\n * Removes the 'current' highlighting classes from all suggestion list items (li) and their links (a).\n */\n _resetLiClasses() {\n if (!this.#ul) return;\n Array.from(this.#ul.children).forEach((li) => {\n this.#options.classes.li_current\n .split(\" \")\n .forEach((cl) => li.classList.remove(cl));\n const link = li.querySelector(\"a\");\n if (link) {\n this.#options.classes.li_a_current\n .split(\" \")\n .forEach((cl) => link.classList.remove(cl));\n }\n });\n }\n\n /**\n * Handles keyboard events (ArrowDown, ArrowUp, Enter, Escape) for navigating\n * and selecting suggestions or closing the list.\n * @param {KeyboardEvent} e - The keyboard event object.\n */\n _onKeyDown(e) {\n if (\n !this.#allSuggestions.length ||\n !this.#ul ||\n this.#ul.style.display === \"none\"\n )\n return;\n\n this._resetLiClasses(); // Reset classes on any key press within the suggestions\n\n if (e.key === \"ArrowDown\") {\n e.preventDefault(); // Prevent cursor movement in input\n this.#currentSuggestion = Math.min(\n this.#currentSuggestion + 1,\n this.#allSuggestions.length - 1\n );\n if (this.#currentSuggestion < 0) this.#currentSuggestion = 0; // Handle case where it was -1\n\n const currentLi = this.#ul.children.item(this.#currentSuggestion);\n if (currentLi) {\n const currentA = currentLi.querySelector(\"a\");\n this.#options.classes.li_current\n .split(\" \")\n .forEach((cl) => currentLi.classList.add(cl));\n if (currentA) {\n this.#options.classes.li_a_current\n .split(\" \")\n .forEach((cl) => currentA.classList.add(cl));\n }\n currentLi.scrollIntoView({ block: \"nearest\" }); // Ensure visible\n }\n\n // Visual feedback for key press\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdDown?.classList.add(cl));\n setTimeout(\n () =>\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdDown?.classList.remove(cl)),\n 300\n );\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault(); // Prevent cursor movement in input\n this.#currentSuggestion = Math.max(this.#currentSuggestion - 1, 0); // Stay at 0 if already there\n\n const currentLi = this.#ul.children.item(this.#currentSuggestion);\n if (currentLi) {\n const currentA = currentLi.querySelector(\"a\");\n this.#options.classes.li_current\n .split(\" \")\n .forEach((cl) => currentLi.classList.add(cl));\n if (currentA) {\n this.#options.classes.li_a_current\n .split(\" \")\n .forEach((cl) => currentA.classList.add(cl));\n }\n currentLi.scrollIntoView({ block: \"nearest\" }); // Ensure visible\n }\n\n // Visual feedback for key press\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdUp?.classList.add(cl));\n setTimeout(\n () =>\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdUp?.classList.remove(cl)),\n 300\n );\n } else if (e.key === \"Enter\") {\n e.preventDefault(); // Prevent form submission if applicable\n if (\n this.#currentSuggestion >= 0 &&\n this.#currentSuggestion < this.#allSuggestions.length\n ) {\n this._onPlaceSelected(\n this.#allSuggestions[this.#currentSuggestion].place\n );\n // Reset is handled within onPlaceSelected via reset(true)\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n // Visual feedback for key press\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdEscape?.classList.add(cl));\n setTimeout(\n () =>\n this.#options.classes.kbd_active\n .split(\" \")\n .forEach((cl) => this.#kbdEscape?.classList.remove(cl)),\n 300\n );\n this._reset(true); // Reset search input and results, refresh token\n }\n }\n\n /**\n * Debounced function to fetch autocomplete suggestions from the Google Places API.\n * Triggered by the 'input' event on the input element.\n */\n _debouncedMakeAcRequest = this._debounce(async () => {\n if (!this.#inputElement || !this.#inputElement.value) {\n this._reset();\n if (this.#inputElement)\n this.#inputElement.setAttribute(\"aria-expanded\", \"false\");\n return;\n }\n\n this.#request.input = this.#inputElement.value;\n //console.log(\"Request:\", this.#request); // Debugging\n try {\n const { suggestions } =\n // eslint-disable-next-line no-undef\n await google.maps.places.AutocompleteSuggestion.fetchAutocompleteSuggestions(\n this.#request\n );\n\n // Display suggestions\n if (suggestions && suggestions.length > 0) {\n this.#ul.replaceChildren(\n ...this._createSuggestionElements(suggestions)\n );\n this.#ul.style.display = \"block\";\n this.#inputElement.setAttribute(\"aria-expanded\", \"true\");\n } else {\n // No suggestions found\n this._reset(); // Clear any old suggestions\n this.#inputElement.setAttribute(\"aria-expanded\", \"false\");\n // Optionally display a \"no results\" message in the 'ul'\n }\n } catch (error) {\n this.#onErrorCallback(error);\n this._reset();\n if (this.#inputElement)\n this.#inputElement.setAttribute(\"aria-expanded\", \"false\");\n }\n }, this.#options?.debounce ?? 100);\n\n /**\n * Creates an array of list item (LI) elements for the suggestions dropdown.\n * Each LI contains a link (A) with the place prediction details and distance.\n * Handles highlighting the matched parts of the suggestion text.\n * @param {Array<google.maps.places.AutocompleteSuggestion>} suggestions - Array of suggestion objects from the API.\n * @returns {Array<HTMLLIElement>} An array of LI elements to be added to the suggestions UL.\n */\n _createSuggestionElements(suggestions) {\n this.#allSuggestions = []; // Reset before populating\n return suggestions.map((suggestion, index) => {\n this.#allSuggestions.push({\n id: index + 1,\n description: suggestion.placePrediction.toString(),\n place: suggestion.placePrediction.toPlace(),\n });\n\n // create div elements\n const divContainer = document.createElement(\"div\");\n divContainer.className = this.#options.classes.li_div_container; // flex min-w-0 gap-x-4\n // create inner div element - place name\n const divInner = document.createElement(\"div\");\n divInner.className = this.#options.classes.li_div_one; // min-w-0 flex-auto\n divContainer.appendChild(divInner);\n // create p element - place name\n const p = document.createElement(\"p\");\n p.className = this.#options.classes.li_div_one_p; // text-sm/6\n\n // get prediction text\n const predictionText = suggestion.placePrediction.text;\n const originalText = predictionText.text;\n // Array of objects with startOffset, endOffset\n const matches = predictionText.matches;\n\n //Highlighting Logic\n let lastIndex = 0;\n\n // Sort matches just in case they aren't ordered (though they usually are)\n matches.sort((a, b) => a.startOffset - b.startOffset);\n\n // 1. Create the outer span\n const outerSpan = document.createElement(\"span\");\n\n // 2. Create the inner span for the bold part\n const innerSpan = document.createElement(\"span\");\n innerSpan.classList = this.#options.classes.highlight ?? \"font-bold\"; // Use the highlight class from options\n\n for (const match of matches) {\n // Append text before the current match\n outerSpan.textContent += originalText.substring(\n lastIndex,\n match.startOffset\n );\n\n // Append the highlighted match segment\n if (match.startOffset > 0) {\n // check previous charter is space\n const prevChar = originalText.charAt(match.startOffset - 1);\n if (prevChar == \" \") {\n innerSpan.textContent += \" \";\n }\n }\n innerSpan.textContent += originalText.substring(\n match.startOffset,\n match.endOffset\n );\n\n // Update the last index processed\n lastIndex = match.endOffset;\n }\n\n // 3. Create a text node for the remaining text\n const remainingText = document.createTextNode(\n originalText.substring(lastIndex)\n );\n\n // 4. Append the inner span and the text node to the outer span\n outerSpan.appendChild(innerSpan);\n outerSpan.appendChild(remainingText);\n\n // 5. Append the outer span to the paragraph element\n p.appendChild(outerSpan);\n\n divInner.appendChild(p);\n divContainer.appendChild(divInner);\n\n // create inner div element - distance\n const divInner2 = document.createElement(\"div\");\n divInner2.className = this.#options.classes.li_div_two; //'shrink-0 flex flex-col items-end min-w-16';\n divContainer.appendChild(divInner2);\n // create p element - distance\n const p2 = document.createElement(\"p\");\n p2.className = this.#options.classes.li_div_two_p; //'mt-1 text-xs/5 ';\n p2.textContent = this._formatDistance(\n suggestion.placePrediction.distanceMeters,\n this.#options.distance_units ?? \"km\"\n );\n divInner2.appendChild(p2);\n\n // // create a link element\n const a = document.createElement(\"a\");\n a.href = \"javascript:void(0)\";\n a.tabIndex = index + 1;\n a.className = this.#options.classes.li_a; // block w-full flex justify-between\n\n a.addEventListener(\"click\", () => {\n this._onPlaceSelected(suggestion.placePrediction.toPlace());\n });\n\n // ...\n // a.addEventListener(\"click\", () => {\n // this._fetchPlaceDetails(prediction.place_id);\n // });\n a.appendChild(divContainer);\n a.appendChild(divInner2);\n\n const li = document.createElement(\"li\");\n li.id = `option-${index + 1}`;\n li.className = this.#options.classes.li;\n\n li.appendChild(a);\n return li;\n });\n }\n\n /**\n * Handles the selection of a place. Fetches required fields\n * (displayName, formattedAddress, addressComponents) and calls the\n * user-defined `onPacData` callback.\n * @param {google.maps.places.Place} place - The selected Place object.\n */\n async _onPlaceSelected(place) {\n try {\n // Fetch necessary details for the selected place\n await place.fetchFields({\n fields: [\"displayName\", \"formattedAddress\", \"addressComponents\"], // Add more fields as needed\n });\n // Call the user-provided callback with the place data\n // eslint-disable-next-line no-undef\n this.#onDataCallback(place.toJSON()); // Convert to plain JSON object for the callback\n } catch (error) {\n console.error(\"Error fetching place details:\", error);\n // eslint-disable-next-line no-undef\n this.#onErrorCallback(error);\n } finally {\n // Reset the input and suggestions regardless of success/error\n this._reset(true); // Refresh token after selection\n }\n }\n\n /**\n * Creates a new Google Places Autocomplete Session Token.\n * This should be called before starting a new series of autocomplete requests.\n */\n _refreshToken() {\n try {\n // eslint-disable-next-line no-undef\n this.#request.sessionToken =\n new google.maps.places.AutocompleteSessionToken();\n } catch (error) {\n console.error(\"Error creating session token:\", error);\n // eslint-disable-next-line no-undef\n this.#onErrorCallback(error);\n }\n }\n\n clear() {\n this._reset(true);\n }\n\n destroy() {\n // Remove event listeners, remove elements from DOM\n if (this.#inputElement) {\n this.#inputElement.removeEventListener(\n \"input\",\n this._debouncedMakeAcRequest\n );\n // remove other listeners\n }\n if (this.#pacEl && this.#container) {\n this.#pacEl.removeChild(this.#container.parentElement); // remove the whole section\n }\n // Nullify properties\n for (const prop in this) {\n if (Object.hasOwn(this, prop)) {\n this[prop] = null;\n }\n }\n console.log(\"PacAutocomplete instance destroyed.\");\n }\n}\n"],"names":["PlacesAutocomplete","config","__privateAdd","_pacEl","_googleMapsApiKey","_googleMapsApiVersion","_options","_request","_inputElement","_container","_ul","_kbdEscape","_kbdUp","_kbdDown","_allSuggestions","_currentSuggestion","_onDataCallback","_onErrorCallback","_defaultClasses","__publicField","__privateGet","suggestions","error","_a","__privateSet","place","func","wait","timeout","args","later","distance","units","value","unitLabel","g","h","a","k","p","c","l","q","m","b","d","r","e","u","f","n","t","section","cl","iconContainer","icon","label","kbdContainer","refresh","li","link","currentLi","currentA","suggestion","index","divContainer","divInner","predictionText","originalText","matches","lastIndex","outerSpan","innerSpan","match","remainingText","divInner2","p2","prop"],"mappings":"qtBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yCAgBO,MAAMA,CAAmB,CA0D9B,YAAYC,EAAQ,CAxDpBC,EAAA,KAAAC,GACAD,EAAA,KAAAE,GACAF,EAAA,KAAAG,GACAH,EAAA,KAAAI,GACAJ,EAAA,KAAAK,GACAL,EAAA,KAAAM,GACAN,EAAA,KAAAO,GACAP,EAAA,KAAAQ,GACAR,EAAA,KAAAS,GACAT,EAAA,KAAAU,GACAV,EAAA,KAAAW,GACAX,EAAA,KAAAY,EAAkB,CAAE,GACpBZ,EAAA,KAAAa,EAAqB,IACrBb,EAAA,KAAAc,GACAd,EAAA,KAAAe,GACAf,EAAA,KAAAgB,EAAkB,CAEhB,QAAS,GACT,UAAW,0CACX,eACE,uEACF,KAAM,kPACN,MACE,0JACF,cAAe,gDACf,WACE,wGACF,OACE,kHACF,SACE,kHACF,WAAY,2BACZ,GAAI,8LACJ,GAAI,uGACJ,WAAY,gBACZ,KAAM,oCACN,aAAc,aACd,iBAAkB,uBAClB,WAAY,oBACZ,aAAc,YACd,WAAY,4CACZ,aAAc,iBACd,UAAW,WACZ,GAkdDC,EAAA,+BAA0B,KAAK,UAAU,SAAY,CACnD,GAAI,CAACC,EAAA,KAAKZ,IAAiB,CAACY,EAAA,KAAKZ,GAAc,MAAO,CACpD,KAAK,OAAQ,EACTY,EAAA,K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,EAAM,OAAQ,EACpC,OAAQH,EAAO,CACd,QAAQ,MAAM,gCAAiCA,CAAK,EAEpDF,EAAA,KAAKH,GAAL,UAAsBK,EAC5B,QAAc,CAER,KAAK,OAAO,EAAI,CACtB,CACA,CAME,eAAgB,CACd,GAAI,CAEFF,EAAA,KAAKb,GAAS,aACZ,IAAI,OAAO,KAAK,OAAO,wBAC1B,OAAQe,EAAO,CACd,QAAQ,MAAM,gCAAiCA,CAAK,EAEpDF,EAAA,KAAKH,GAAL,UAAsBK,EAC5B,CACA,CAEE,OAAQ,CACN,KAAK,OAAO,EAAI,CACpB,CAEE,SAAU,CAEJF,EAAA,KAAKZ,IACPY,EAAA,KAAKZ,GAAc,oBACjB,QACA,KAAK,uBACN,EAGCY,EAAA,KAAKjB,IAAUiB,EAAA,KAAKX,IACtBW,EAAA,KAAKjB,GAAO,YAAYiB,EAAA,KAAKX,GAAW,aAAa,EAGvD,UAAWoE,KAAQ,KACb,OAAO,OAAO,KAAMA,CAAI,IAC1B,KAAKA,CAAI,EAAI,MAGjB,QAAQ,IAAI,qCAAqC,CACrD,CACA,CAhuBE1E,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA"}
|
package/package.json
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
"name": "places-autocomplete-js",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.2",
|
|
6
6
|
"description": "A flexible and customisable vanilla JavaScript library leveraging the Google Maps Places (New) Autocomplete API. This library provides a user-friendly way to search for and retrieve detailed address information in any web application.",
|
|
7
7
|
"keywords": [
|
|
8
|
-
"place-autocomplete
|
|
8
|
+
"place-autocomplete",
|
|
9
|
+
"places-autocomplete-js",
|
|
9
10
|
"google-places-api",
|
|
10
11
|
"google-places-autocomplete-api",
|
|
11
12
|
"autocomplete",
|
|
@@ -34,15 +35,14 @@
|
|
|
34
35
|
"files": [
|
|
35
36
|
"dist"
|
|
36
37
|
],
|
|
37
|
-
"main": "./dist/
|
|
38
|
-
"module": "./dist/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
"main": "./dist/places-autocomplete.umd.cjs",
|
|
39
|
+
"module": "./dist/places-autocomplete.js",
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"import": "./dist/places-autocomplete.js",
|
|
43
|
+
"require": "./dist/places-autocomplete.umd.cjs"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"dev": "vite dev",
|
|
48
48
|
"build": "vite build",
|
|
@@ -50,12 +50,13 @@
|
|
|
50
50
|
"lint": "eslint src/**/*.js"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"
|
|
54
|
-
"vite": "^6.3.5",
|
|
53
|
+
"@tailwindcss/postcss": "^4.1.6",
|
|
55
54
|
"@tailwindcss/vite": "^4.1.6",
|
|
55
|
+
"eslint": "^9.26.0",
|
|
56
|
+
"postcss": "^8.5.3",
|
|
56
57
|
"tailwindcss": "^4.1.6",
|
|
57
|
-
"
|
|
58
|
-
"postcss": "^8.5.3"
|
|
58
|
+
"vite": "^6.3.5"
|
|
59
59
|
},
|
|
60
|
-
"dependencies": {
|
|
61
|
-
}
|
|
60
|
+
"dependencies": {
|
|
61
|
+
}
|
|
62
|
+
}
|