@stachelock/ui 0.6.6 → 0.6.8
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/dist/{CalendarHeader.vue_vue_type_script_setup_true_lang-CA_C4dmn.js → CalendarHeader.vue_vue_type_script_setup_true_lang-CMBsY5Y0.js} +1 -1
- package/dist/{ComboboxInput.vue_vue_type_script_setup_true_lang-D52gzkAa.js → ComboboxInput.vue_vue_type_script_setup_true_lang-DacJtKYo.js} +141 -125
- package/dist/{DynamicForm.vue_vue_type_script_setup_true_lang-BR8Pq7Kw.js → DynamicForm.vue_vue_type_script_setup_true_lang-Bq8Gvhsc.js} +1 -1
- package/dist/{DynamicFormField.vue_vue_type_script_setup_true_lang-BCVmqg_n.js → DynamicFormField.vue_vue_type_script_setup_true_lang-CdNtWWlT.js} +4 -4
- package/dist/{InlineTabs.vue_vue_type_script_setup_true_lang-slNq2sot.js → InlineTabs.vue_vue_type_script_setup_true_lang-B6A0zsE6.js} +1 -1
- package/dist/{SelectInput.vue_vue_type_script_setup_true_lang-COZuuSFS.js → SelectInput.vue_vue_type_script_setup_true_lang-DFfKsmvj.js} +96 -86
- package/dist/{SelectTextInput.vue_vue_type_script_setup_true_lang-BVaViHPl.js → SelectTextInput.vue_vue_type_script_setup_true_lang-C3BGLjY1.js} +1 -1
- package/dist/{TabGroup.vue_vue_type_script_setup_true_lang-pEKm-uUq.js → TabGroup.vue_vue_type_script_setup_true_lang-BzqtAqbr.js} +1 -1
- package/dist/{TabGroupUnderline.vue_vue_type_script_setup_true_lang--IKyRPkX.js → TabGroupUnderline.vue_vue_type_script_setup_true_lang-C6OYRDCq.js} +1 -1
- package/dist/{TabsInPills.vue_vue_type_script_setup_true_lang-EG0nj4F6.js → TabsInPills.vue_vue_type_script_setup_true_lang-C7T3PUnB.js} +1 -1
- package/dist/TextInput-C5IzX7m_.js +131 -0
- package/dist/calendars/CalendarDashboard.js +1 -1
- package/dist/calendars/CalendarHeader.js +1 -1
- package/dist/forms/DynamicForm.js +1 -1
- package/dist/forms/DynamicFormField.js +1 -1
- package/dist/index.js +132 -132
- package/dist/inputs/AddressInput.js +148 -146
- package/dist/inputs/ComboboxInput.js +1 -1
- package/dist/inputs/SelectInput.js +1 -1
- package/dist/inputs/SelectTextInput.js +1 -1
- package/dist/inputs/TextInput.js +3 -108
- package/dist/src/components/inputs/AddressInput.d.ts +6 -0
- package/dist/src/components/inputs/ComboboxInput.d.ts +3 -0
- package/dist/src/components/inputs/TextInput.d.ts +1 -0
- package/dist/src/types/ui.d.ts +5 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/validation.d.ts +11 -0
- package/dist/style.css +1 -1
- package/dist/tabs/InlineTabs.js +1 -1
- package/dist/tabs/TabGroup.js +1 -1
- package/dist/tabs/TabGroupUnderline.js +1 -1
- package/dist/tabs/TabsInPills.js +1 -1
- package/dist/tabs/index.js +4 -4
- package/dist/ui.css +1 -1
- package/package.json +1 -1
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { defineComponent as pe, inject as ye, onMounted as ve, ref as $, reactive as be, computed as K, watch as he, createElementBlock as G, openBlock as x, createVNode as y, unref as p, withCtx as C, createElementVNode as v, createCommentVNode as R, normalizeClass as I, createBlock as E, Fragment as xe, renderList as ke, toDisplayString as N, resolveDynamicComponent as we, createTextVNode as H } from "vue";
|
|
2
|
+
import { i as Ce, T } from "../TextInput-C5IzX7m_.js";
|
|
3
|
+
import { Combobox as Ie, ComboboxInput as Se, ComboboxButton as Ae, TransitionRoot as W, ComboboxOptions as ze, ComboboxOption as _e } from "@headlessui/vue";
|
|
4
|
+
import { LockClosedIcon as $e, MagnifyingGlassIcon as Ke, CheckIcon as Ge, ChevronDownIcon as Te, ChevronUpIcon as Oe } from "@heroicons/vue/20/solid";
|
|
5
|
+
import { ClockIcon as Q, ExclamationCircleIcon as Me, CheckCircleIcon as Ue } from "@heroicons/vue/24/outline";
|
|
6
|
+
import { useField as Ee } from "vee-validate";
|
|
6
7
|
import { debounce as X } from "lodash-es";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
k = e, F = !1, T = null, L = null, U = null;
|
|
8
|
+
import Pe from "../forms/FormFieldWrapper.js";
|
|
9
|
+
import { g as Le } from "../id-DafBB_QF.js";
|
|
10
|
+
import { Loader as Re } from "@googlemaps/js-api-loader";
|
|
11
|
+
import { _ as Ne } from "../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
12
|
+
let k = null, U = null, L = null, O = null, F = !1;
|
|
13
|
+
const M = /* @__PURE__ */ new Map(), Fe = 1e3, Be = 1e3 * 60 * 60 * 24;
|
|
14
|
+
function De(e) {
|
|
15
|
+
k = e, F = !1, O = null, L = null, U = null;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function Ve() {
|
|
18
18
|
return k !== null && !!k.apiKey;
|
|
19
19
|
}
|
|
20
|
-
async function
|
|
20
|
+
async function B() {
|
|
21
21
|
if (!F) {
|
|
22
|
-
if (
|
|
23
|
-
return
|
|
22
|
+
if (O)
|
|
23
|
+
return O;
|
|
24
24
|
if (!k?.apiKey)
|
|
25
25
|
throw new Error(
|
|
26
26
|
'[Geocoding] API key not configured. Call configureGeocoding({ apiKey: "..." }) first, or configure via StachelockUI plugin with googleMaps.apiKey option.'
|
|
27
27
|
);
|
|
28
|
-
return
|
|
28
|
+
return O = (async () => {
|
|
29
29
|
try {
|
|
30
|
-
await new
|
|
30
|
+
await new Re({
|
|
31
31
|
apiKey: k.apiKey,
|
|
32
32
|
version: k.version || "weekly",
|
|
33
33
|
id: "__stachelockGoogleMapsScriptId",
|
|
34
34
|
libraries: k.libraries || ["places", "maps", "geometry"]
|
|
35
35
|
}).load(), L = await google.maps.importLibrary("places"), U = new google.maps.Geocoder(), F = !0;
|
|
36
36
|
} catch (e) {
|
|
37
|
-
throw
|
|
37
|
+
throw O = null, console.error("[Geocoding] Error loading Google Maps API:", e), e;
|
|
38
38
|
}
|
|
39
|
-
})(),
|
|
39
|
+
})(), O;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
function J(e) {
|
|
@@ -47,11 +47,11 @@ function Y(e) {
|
|
|
47
47
|
}
|
|
48
48
|
function q(e) {
|
|
49
49
|
const a = M.get(e);
|
|
50
|
-
return a ? Date.now() - a.ts >
|
|
50
|
+
return a ? Date.now() - a.ts > Be ? (M.delete(e), null) : a.result : null;
|
|
51
51
|
}
|
|
52
52
|
function ee(e, a) {
|
|
53
53
|
try {
|
|
54
|
-
if (M.size >=
|
|
54
|
+
if (M.size >= Fe) {
|
|
55
55
|
const c = M.keys().next().value;
|
|
56
56
|
c && M.delete(c);
|
|
57
57
|
}
|
|
@@ -61,26 +61,26 @@ function ee(e, a) {
|
|
|
61
61
|
}
|
|
62
62
|
function te(e, a = 15, c = "200x200") {
|
|
63
63
|
if (!k?.apiKey) return "";
|
|
64
|
-
const
|
|
64
|
+
const r = k.staticMapsApiKey || k.apiKey, i = "https://maps.googleapis.com/maps/api/staticmap", f = new URLSearchParams({
|
|
65
65
|
center: `${e.lat},${e.lng}`,
|
|
66
66
|
zoom: a.toString(),
|
|
67
67
|
size: c,
|
|
68
|
-
key:
|
|
68
|
+
key: r,
|
|
69
69
|
markers: `color:red|${e.lat},${e.lng}`
|
|
70
70
|
});
|
|
71
71
|
return `${i}?${f.toString()}`;
|
|
72
72
|
}
|
|
73
|
-
async function
|
|
73
|
+
async function je(e) {
|
|
74
74
|
if (!e?.trim())
|
|
75
75
|
return {
|
|
76
76
|
status: "INVALID_INPUT",
|
|
77
77
|
message: "No placeId provided for geocoding."
|
|
78
78
|
};
|
|
79
|
-
await
|
|
79
|
+
await B();
|
|
80
80
|
const a = Y({ placeId: e }), c = q(a);
|
|
81
|
-
return c || new Promise((
|
|
81
|
+
return c || new Promise((r) => {
|
|
82
82
|
if (!U) {
|
|
83
|
-
|
|
83
|
+
r({
|
|
84
84
|
status: "ERROR",
|
|
85
85
|
message: "Geocoder service not initialized."
|
|
86
86
|
});
|
|
@@ -88,48 +88,48 @@ async function Be(e) {
|
|
|
88
88
|
}
|
|
89
89
|
U.geocode({ placeId: e }, (i, f) => {
|
|
90
90
|
if (f === google.maps.GeocoderStatus.OK && i && i.length > 0) {
|
|
91
|
-
const d = i[0],
|
|
91
|
+
const d = i[0], n = d.geometry ? {
|
|
92
92
|
lat: d.geometry.location.lat(),
|
|
93
93
|
lng: d.geometry.location.lng()
|
|
94
94
|
} : void 0, h = {
|
|
95
95
|
status: "OK",
|
|
96
96
|
message: "Found address",
|
|
97
97
|
address_components: d.address_components || [],
|
|
98
|
-
location:
|
|
98
|
+
location: n,
|
|
99
99
|
formatted_address: d.formatted_address || "",
|
|
100
|
-
thumbnailUrl:
|
|
100
|
+
thumbnailUrl: n ? te(n) : void 0
|
|
101
101
|
};
|
|
102
|
-
ee(a, h),
|
|
102
|
+
ee(a, h), r(h);
|
|
103
103
|
} else
|
|
104
|
-
|
|
104
|
+
r({
|
|
105
105
|
status: f.toString(),
|
|
106
106
|
message: `Unable to geocode place: ${f}`
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function Ze(e) {
|
|
112
112
|
const a = J(e);
|
|
113
113
|
if (a.length < 10) return !1;
|
|
114
|
-
const c = /\d/.test(a),
|
|
115
|
-
return (
|
|
114
|
+
const c = /\d/.test(a), r = a.includes(","), i = /\b([A-Z]{2})\b/i.test(e), f = /\b\d{5}(?:-\d{4})?\b/.test(a);
|
|
115
|
+
return (r || i || f) && c;
|
|
116
116
|
}
|
|
117
|
-
async function
|
|
117
|
+
async function He(e) {
|
|
118
118
|
if (!e?.trim())
|
|
119
119
|
return {
|
|
120
120
|
status: "INVALID_INPUT",
|
|
121
121
|
message: "No address provided for geocoding."
|
|
122
122
|
};
|
|
123
|
-
if (!
|
|
123
|
+
if (!Ze(e))
|
|
124
124
|
return {
|
|
125
125
|
status: "INVALID_INPUT",
|
|
126
126
|
message: "Insufficient address information for geocoding."
|
|
127
127
|
};
|
|
128
|
-
await
|
|
128
|
+
await B();
|
|
129
129
|
const a = Y(e), c = q(a);
|
|
130
|
-
return c || new Promise((
|
|
130
|
+
return c || new Promise((r) => {
|
|
131
131
|
if (!U) {
|
|
132
|
-
|
|
132
|
+
r({
|
|
133
133
|
status: "ERROR",
|
|
134
134
|
message: "Geocoder service not initialized."
|
|
135
135
|
});
|
|
@@ -137,54 +137,54 @@ async function je(e) {
|
|
|
137
137
|
}
|
|
138
138
|
U.geocode({ address: e }, (i, f) => {
|
|
139
139
|
if (f === google.maps.GeocoderStatus.OK && i && i.length > 0) {
|
|
140
|
-
const d = i[0],
|
|
140
|
+
const d = i[0], n = d.geometry ? {
|
|
141
141
|
lat: d.geometry.location.lat(),
|
|
142
142
|
lng: d.geometry.location.lng()
|
|
143
143
|
} : void 0, h = {
|
|
144
144
|
status: "OK",
|
|
145
145
|
message: "Found address",
|
|
146
146
|
address_components: d.address_components || [],
|
|
147
|
-
location:
|
|
147
|
+
location: n,
|
|
148
148
|
formatted_address: d.formatted_address || "",
|
|
149
|
-
thumbnailUrl:
|
|
149
|
+
thumbnailUrl: n ? te(n) : void 0
|
|
150
150
|
};
|
|
151
|
-
ee(a, h),
|
|
151
|
+
ee(a, h), r(h);
|
|
152
152
|
} else
|
|
153
|
-
|
|
153
|
+
r({
|
|
154
154
|
status: f.toString(),
|
|
155
155
|
message: `Unable to geocode address: ${f}`
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
|
-
async function
|
|
160
|
+
async function We(e, a) {
|
|
161
161
|
if (!e?.trim())
|
|
162
162
|
return [];
|
|
163
|
-
if (await
|
|
163
|
+
if (await B(), !L)
|
|
164
164
|
return console.warn("[Geocoding] Places library not initialized"), [];
|
|
165
165
|
try {
|
|
166
|
-
const { AutocompleteSuggestion: c } = L,
|
|
166
|
+
const { AutocompleteSuggestion: c } = L, r = {
|
|
167
167
|
input: e,
|
|
168
168
|
...a?.includedPrimaryTypes && { includedPrimaryTypes: a.includedPrimaryTypes },
|
|
169
169
|
...a?.includedRegionCodes && { includedRegionCodes: a.includedRegionCodes }
|
|
170
|
-
}, { suggestions: i } = await c.fetchAutocompleteSuggestions(
|
|
170
|
+
}, { suggestions: i } = await c.fetchAutocompleteSuggestions(r);
|
|
171
171
|
return i.filter(
|
|
172
172
|
(d) => d.placePrediction !== null
|
|
173
173
|
).map((d) => {
|
|
174
|
-
const
|
|
174
|
+
const n = d.placePrediction;
|
|
175
175
|
return {
|
|
176
|
-
placeId:
|
|
177
|
-
description:
|
|
178
|
-
mainText:
|
|
179
|
-
secondaryText:
|
|
180
|
-
types:
|
|
176
|
+
placeId: n.placeId,
|
|
177
|
+
description: n.text.toString(),
|
|
178
|
+
mainText: n.mainText?.toString() || n.text.toString(),
|
|
179
|
+
secondaryText: n.secondaryText?.toString() || "",
|
|
180
|
+
types: n.types || []
|
|
181
181
|
};
|
|
182
182
|
});
|
|
183
183
|
} catch (c) {
|
|
184
184
|
return console.error("[Geocoding] Error fetching autocomplete suggestions:", c), [];
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function Qe(e) {
|
|
188
188
|
const a = {
|
|
189
189
|
street: "",
|
|
190
190
|
city: "",
|
|
@@ -194,14 +194,14 @@ function He(e) {
|
|
|
194
194
|
};
|
|
195
195
|
if (!e?.address_components)
|
|
196
196
|
return a;
|
|
197
|
-
let c = "",
|
|
197
|
+
let c = "", r = "", i = "", f = "", d = "", n = "", h = "", S = "", A = "", P = "", b = "", z = "";
|
|
198
198
|
for (const g of e.address_components) {
|
|
199
199
|
const u = g.types;
|
|
200
|
-
u.includes("street_number") ? c = g.long_name : u.includes("route") ?
|
|
200
|
+
u.includes("street_number") ? c = g.long_name : u.includes("route") ? r = g.long_name : u.includes("subpremise") ? i = g.long_name : u.includes("premise") ? f = g.long_name : u.includes("locality") ? d = g.long_name : u.includes("sublocality") || u.includes("sublocality_level_1") ? u.includes("sublocality_level_1") ? h = g.long_name : n = g.long_name : u.includes("administrative_area_level_2") ? S = g.long_name : u.includes("administrative_area_level_3") ? A = g.long_name : u.includes("postal_town") ? P = g.long_name : u.includes("administrative_area_level_1") ? a.state = g.short_name : u.includes("postal_code") ? b = g.long_name : u.includes("postal_code_prefix") ? z = g.long_name : u.includes("country") && (a.country = g.short_name);
|
|
201
201
|
}
|
|
202
|
-
return c &&
|
|
202
|
+
return c && r ? a.street = `${c} ${r}` : r ? a.street = r : f && (a.street = f), i && a.street && (a.street = `${a.street}, ${i}`), a.city = d || P || h || n || A || S || "", a.zipcode = b || z || "", a;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function Xe(e) {
|
|
205
205
|
return [
|
|
206
206
|
e.street,
|
|
207
207
|
e.city,
|
|
@@ -209,10 +209,10 @@ function We(e) {
|
|
|
209
209
|
e.country
|
|
210
210
|
].filter(Boolean).join(", ");
|
|
211
211
|
}
|
|
212
|
-
const
|
|
212
|
+
const Je = { class: "sl-address-input" }, Ye = { class: "sl-space-y-3" }, qe = { class: "sl-relative" }, et = { class: "sl-flex sl-flex-col" }, tt = {
|
|
213
213
|
key: 0,
|
|
214
214
|
class: "sl-flex sl-items-center sl-justify-between"
|
|
215
|
-
},
|
|
215
|
+
}, st = { class: "sl-flex sl-items-center sl-gap-2" }, lt = { class: "sl-grid sl-grid-cols-1 sm:sl-grid-cols-2 sl-gap-3 sl-p-3 sl-bg-gray-50 dark:sl-bg-slate-800/50 sl-rounded-lg sl-border sl-border-gray-200 dark:sl-border-slate-700" }, at = { class: "sm:sl-col-span-2" }, ot = /* @__PURE__ */ pe({
|
|
216
216
|
__name: "AddressInput",
|
|
217
217
|
props: {
|
|
218
218
|
name: {},
|
|
@@ -225,33 +225,34 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
225
225
|
allowManualEntry: { type: Boolean, default: !0 },
|
|
226
226
|
successMessage: { default: "" },
|
|
227
227
|
tertiaryLabel: { default: "" },
|
|
228
|
-
validateOnMount: { type: Boolean, default: !1 }
|
|
228
|
+
validateOnMount: { type: Boolean, default: !1 },
|
|
229
|
+
optional: { type: Boolean, default: void 0 }
|
|
229
230
|
},
|
|
230
231
|
emits: ["update:modelValue", "blur", "focus"],
|
|
231
232
|
setup(e, { expose: a, emit: c }) {
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
d?.apiKey && !
|
|
233
|
+
const r = e, i = c, f = Le(r.name || "address-input"), d = ye("googleMaps", void 0);
|
|
234
|
+
ve(() => {
|
|
235
|
+
d?.apiKey && !Ve() && De({
|
|
235
236
|
apiKey: d.apiKey,
|
|
236
237
|
version: d.version,
|
|
237
238
|
libraries: d.libraries
|
|
238
239
|
});
|
|
239
240
|
});
|
|
240
|
-
const { value:
|
|
241
|
-
() =>
|
|
242
|
-
|
|
241
|
+
const { value: n, errorMessage: h, meta: S, handleChange: A, setTouched: P } = Ee(
|
|
242
|
+
() => r.name,
|
|
243
|
+
r.rules,
|
|
243
244
|
{
|
|
244
|
-
validateOnMount:
|
|
245
|
-
initialValue:
|
|
245
|
+
validateOnMount: r.validateOnMount,
|
|
246
|
+
initialValue: r.modelValue
|
|
246
247
|
}
|
|
247
|
-
), b = $([]), z = $(null), g = $(""), u = $(!1),
|
|
248
|
+
), b = $([]), z = $(null), g = $(""), u = $(!1), D = $(!1), m = $("unverified"), s = be({
|
|
248
249
|
street: "",
|
|
249
250
|
suite: "",
|
|
250
251
|
city: "",
|
|
251
252
|
state: "",
|
|
252
253
|
zipcode: "",
|
|
253
254
|
country: ""
|
|
254
|
-
}), V =
|
|
255
|
+
}), V = K(() => !!(n.value?.formattedAddress || n.value?.street)), se = K(() => r.optional !== void 0 ? r.optional : Ce(r.rules)), le = K(() => r.showSuggestionCount && b.value.length > 0 ? `${b.value.length} suggestions` : r.tertiaryLabel), j = K(() => {
|
|
255
256
|
switch (m.value) {
|
|
256
257
|
case "verified":
|
|
257
258
|
return "sl-text-green-600 dark:sl-text-green-400";
|
|
@@ -262,7 +263,7 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
262
263
|
default:
|
|
263
264
|
return "sl-text-gray-500 dark:sl-text-slate-400";
|
|
264
265
|
}
|
|
265
|
-
}),
|
|
266
|
+
}), ae = K(() => {
|
|
266
267
|
switch (m.value) {
|
|
267
268
|
case "verified":
|
|
268
269
|
return "Verified";
|
|
@@ -273,47 +274,47 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
273
274
|
default:
|
|
274
275
|
return "Unverified";
|
|
275
276
|
}
|
|
276
|
-
}),
|
|
277
|
+
}), oe = K(() => {
|
|
277
278
|
switch (m.value) {
|
|
278
279
|
case "verified":
|
|
279
|
-
return
|
|
280
|
+
return Ue;
|
|
280
281
|
case "error":
|
|
281
|
-
return
|
|
282
|
+
return Me;
|
|
282
283
|
case "pending":
|
|
283
284
|
return Q;
|
|
284
285
|
default:
|
|
285
286
|
return Q;
|
|
286
287
|
}
|
|
287
|
-
}),
|
|
288
|
+
}), re = X(async (l) => {
|
|
288
289
|
if (!l || l.length < 3) {
|
|
289
290
|
b.value = [];
|
|
290
291
|
return;
|
|
291
292
|
}
|
|
292
|
-
|
|
293
|
+
D.value = !0;
|
|
293
294
|
try {
|
|
294
|
-
const t = await
|
|
295
|
+
const t = await We(l);
|
|
295
296
|
b.value = t;
|
|
296
297
|
} catch (t) {
|
|
297
298
|
console.error("[AddressInput] Error fetching suggestions:", t), b.value = [];
|
|
298
299
|
} finally {
|
|
299
|
-
|
|
300
|
+
D.value = !1;
|
|
300
301
|
}
|
|
301
302
|
}, 300);
|
|
302
|
-
function
|
|
303
|
+
function ne(l) {
|
|
303
304
|
const t = l.target;
|
|
304
|
-
g.value = t.value,
|
|
305
|
+
g.value = t.value, re(t.value);
|
|
305
306
|
}
|
|
306
|
-
function
|
|
307
|
-
return l ? l.description :
|
|
307
|
+
function ie(l) {
|
|
308
|
+
return l ? l.description : n.value?.formattedAddress ? n.value.formattedAddress : "";
|
|
308
309
|
}
|
|
309
|
-
async function
|
|
310
|
+
async function de(l) {
|
|
310
311
|
if (l) {
|
|
311
312
|
m.value = "pending", b.value = [];
|
|
312
313
|
try {
|
|
313
|
-
const t = await
|
|
314
|
+
const t = await je(l.placeId);
|
|
314
315
|
if (t.status === "OK") {
|
|
315
316
|
m.value = "verified";
|
|
316
|
-
const o =
|
|
317
|
+
const o = Qe(t);
|
|
317
318
|
s.street = o.street, s.city = o.city, s.state = o.state, s.zipcode = o.zipcode, s.country = o.country;
|
|
318
319
|
const w = {
|
|
319
320
|
formattedAddress: t.formatted_address,
|
|
@@ -326,7 +327,7 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
326
327
|
geocode: t,
|
|
327
328
|
placeId: l.placeId
|
|
328
329
|
};
|
|
329
|
-
|
|
330
|
+
n.value = w, A(w), i("update:modelValue", w), u.value = !0;
|
|
330
331
|
} else
|
|
331
332
|
m.value = "error", console.warn("[AddressInput] Geocoding failed:", t.message);
|
|
332
333
|
} catch (t) {
|
|
@@ -334,15 +335,15 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
334
335
|
}
|
|
335
336
|
}
|
|
336
337
|
}
|
|
337
|
-
const
|
|
338
|
-
const l =
|
|
338
|
+
const ce = ["street", "city", "state", "zipcode", "country"], ue = X(async () => {
|
|
339
|
+
const l = Xe(s);
|
|
339
340
|
if (!l || l.length < 10) {
|
|
340
341
|
m.value = "unverified";
|
|
341
342
|
return;
|
|
342
343
|
}
|
|
343
344
|
m.value = "pending";
|
|
344
345
|
try {
|
|
345
|
-
const t = await
|
|
346
|
+
const t = await He(l);
|
|
346
347
|
if (t.status === "OK") {
|
|
347
348
|
m.value = "verified";
|
|
348
349
|
const o = {
|
|
@@ -357,7 +358,7 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
357
358
|
placeId: void 0
|
|
358
359
|
// Clear placeId since we re-geocoded
|
|
359
360
|
};
|
|
360
|
-
|
|
361
|
+
n.value = o, A(o), i("update:modelValue", o);
|
|
361
362
|
} else
|
|
362
363
|
m.value = "unverified";
|
|
363
364
|
} catch (t) {
|
|
@@ -366,7 +367,7 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
366
367
|
}, 600);
|
|
367
368
|
function _(l) {
|
|
368
369
|
const t = {
|
|
369
|
-
...
|
|
370
|
+
...n.value,
|
|
370
371
|
street: s.street,
|
|
371
372
|
suite: s.suite,
|
|
372
373
|
city: s.city,
|
|
@@ -374,74 +375,75 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
374
375
|
zipcode: s.zipcode,
|
|
375
376
|
country: s.country
|
|
376
377
|
};
|
|
377
|
-
|
|
378
|
+
ce.includes(l) && (m.value = "unverified", t.geocode = void 0, ue()), n.value = t, A(t), i("update:modelValue", t);
|
|
378
379
|
}
|
|
379
|
-
function
|
|
380
|
+
function fe(l) {
|
|
380
381
|
i("focus", l);
|
|
381
382
|
}
|
|
382
|
-
function
|
|
383
|
+
function ge(l) {
|
|
383
384
|
P(!0), i("blur", l);
|
|
384
385
|
}
|
|
385
|
-
|
|
386
|
-
() =>
|
|
386
|
+
he(
|
|
387
|
+
() => r.modelValue,
|
|
387
388
|
(l) => {
|
|
388
|
-
l && (l.geocode?.status === "OK" ? m.value = "verified" : l.geocode?.status === "ERROR" && (m.value = "error"), l !==
|
|
389
|
+
l && (l.geocode?.status === "OK" ? m.value = "verified" : l.geocode?.status === "ERROR" && (m.value = "error"), l !== n.value && (n.value = l, l.street !== void 0 && (s.street = l.street), l.suite !== void 0 && (s.suite = l.suite), l.city !== void 0 && (s.city = l.city), l.state !== void 0 && (s.state = l.state), l.zipcode !== void 0 && (s.zipcode = l.zipcode), l.country !== void 0 && (s.country = l.country)));
|
|
389
390
|
},
|
|
390
391
|
{ immediate: !0, deep: !0 }
|
|
391
392
|
);
|
|
392
|
-
function
|
|
393
|
-
|
|
393
|
+
function me() {
|
|
394
|
+
n.value = void 0, z.value = null, g.value = "", b.value = [], u.value = !1, m.value = "unverified", s.street = "", s.suite = "", s.city = "", s.state = "", s.zipcode = "", s.country = "";
|
|
394
395
|
}
|
|
395
396
|
return a({
|
|
396
|
-
resetInput:
|
|
397
|
+
resetInput: me,
|
|
397
398
|
geocodeStatus: m,
|
|
398
399
|
meta: S,
|
|
399
400
|
errorMessage: h
|
|
400
|
-
}), (l, t) => (x(),
|
|
401
|
-
y(
|
|
401
|
+
}), (l, t) => (x(), G("div", Je, [
|
|
402
|
+
y(Pe, {
|
|
402
403
|
id: p(f),
|
|
403
404
|
name: e.name,
|
|
404
405
|
label: e.label,
|
|
405
|
-
"tertiary-label":
|
|
406
|
+
"tertiary-label": le.value,
|
|
406
407
|
"error-message": p(h),
|
|
407
408
|
"success-message": e.successMessage,
|
|
408
409
|
"is-valid": p(S).valid,
|
|
409
410
|
"is-touched": p(S).touched,
|
|
410
|
-
disabled: e.disabled
|
|
411
|
+
disabled: e.disabled,
|
|
412
|
+
optional: se.value
|
|
411
413
|
}, {
|
|
412
414
|
default: C(() => [
|
|
413
|
-
v("div",
|
|
414
|
-
y(p(
|
|
415
|
+
v("div", Ye, [
|
|
416
|
+
y(p(Ie), {
|
|
415
417
|
modelValue: z.value,
|
|
416
418
|
"onUpdate:modelValue": [
|
|
417
419
|
t[0] || (t[0] = (o) => z.value = o),
|
|
418
|
-
|
|
420
|
+
de
|
|
419
421
|
],
|
|
420
422
|
disabled: e.disabled,
|
|
421
423
|
nullable: ""
|
|
422
424
|
}, {
|
|
423
425
|
default: C(() => [
|
|
424
|
-
v("div",
|
|
425
|
-
y(p(
|
|
426
|
+
v("div", qe, [
|
|
427
|
+
y(p(Se), {
|
|
426
428
|
id: p(f),
|
|
427
|
-
"display-value":
|
|
429
|
+
"display-value": ie,
|
|
428
430
|
placeholder: e.placeholder || "Search for an address...",
|
|
429
431
|
disabled: e.disabled,
|
|
430
432
|
class: I([
|
|
431
433
|
"sl-block sl-w-full sl-rounded-lg sl-border sl-py-2.5 sl-pl-3 sl-pr-10 sl-text-sm focus:sl-outline-none",
|
|
432
434
|
e.disabled ? "sl-border-gray-200 dark:sl-border-slate-700 sl-bg-gray-50 dark:sl-bg-slate-800 sl-text-gray-500 dark:sl-text-slate-400 sl-cursor-not-allowed" : "sl-border-gray-300 dark:sl-border-slate-600 sl-bg-white dark:sl-bg-slate-900 sl-text-gray-900 dark:sl-text-slate-100 placeholder:sl-text-gray-400 dark:placeholder:sl-text-slate-500 focus:sl-border-stachelock-500 focus:sl-ring-2 focus:sl-ring-stachelock-500"
|
|
433
435
|
]),
|
|
434
|
-
onChange:
|
|
435
|
-
onFocus:
|
|
436
|
-
onBlur:
|
|
436
|
+
onChange: ne,
|
|
437
|
+
onFocus: fe,
|
|
438
|
+
onBlur: ge
|
|
437
439
|
}, null, 8, ["id", "placeholder", "disabled", "class"]),
|
|
438
|
-
y(p(
|
|
440
|
+
y(p(Ae), { class: "sl-absolute sl-inset-y-0 sl-right-0 sl-flex sl-items-center sl-pr-2" }, {
|
|
439
441
|
default: C(() => [
|
|
440
|
-
e.disabled ? (x(),
|
|
442
|
+
e.disabled ? (x(), E(p($e), {
|
|
441
443
|
key: 0,
|
|
442
444
|
class: "sl-h-5 sl-w-5 sl-text-gray-400 dark:sl-text-slate-500",
|
|
443
445
|
"aria-hidden": "true"
|
|
444
|
-
})) : (x(),
|
|
446
|
+
})) : (x(), E(p(Ke), {
|
|
445
447
|
key: 1,
|
|
446
448
|
class: "sl-h-5 sl-w-5 sl-text-gray-400 dark:sl-text-slate-400",
|
|
447
449
|
"aria-hidden": "true"
|
|
@@ -455,12 +457,12 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
455
457
|
"leave-to": "sl-opacity-0"
|
|
456
458
|
}, {
|
|
457
459
|
default: C(() => [
|
|
458
|
-
b.value.length > 0 ? (x(),
|
|
460
|
+
b.value.length > 0 ? (x(), E(p(ze), {
|
|
459
461
|
key: 0,
|
|
460
462
|
class: "sl-absolute sl-z-50 sl-mt-1 sl-max-h-60 sl-w-full sl-overflow-auto sl-rounded-md sl-bg-white dark:sl-bg-slate-800 sl-py-1 sl-text-base sl-shadow-lg dark:sl-shadow-slate-900/50 sl-ring-1 sl-ring-black sl-ring-opacity-5 dark:sl-ring-slate-700 focus:sl-outline-none sm:sl-text-sm"
|
|
461
463
|
}, {
|
|
462
464
|
default: C(() => [
|
|
463
|
-
(x(!0),
|
|
465
|
+
(x(!0), G(xe, null, ke(b.value, (o) => (x(), E(p(_e), {
|
|
464
466
|
key: o.placeId,
|
|
465
467
|
value: o,
|
|
466
468
|
as: "template"
|
|
@@ -472,7 +474,7 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
472
474
|
w ? "sl-bg-stachelock-600 sl-text-white" : "sl-text-gray-900 dark:sl-text-slate-200"
|
|
473
475
|
])
|
|
474
476
|
}, [
|
|
475
|
-
v("div",
|
|
477
|
+
v("div", et, [
|
|
476
478
|
v("span", {
|
|
477
479
|
class: I(["sl-block sl-truncate", Z ? "sl-font-medium" : "sl-font-normal"])
|
|
478
480
|
}, N(o.mainText), 3),
|
|
@@ -480,14 +482,14 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
480
482
|
class: I(["sl-text-xs", w ? "sl-text-stachelock-100" : "sl-text-gray-500 dark:sl-text-slate-400"])
|
|
481
483
|
}, N(o.secondaryText), 3)
|
|
482
484
|
]),
|
|
483
|
-
Z ? (x(),
|
|
485
|
+
Z ? (x(), G("span", {
|
|
484
486
|
key: 0,
|
|
485
487
|
class: I([
|
|
486
488
|
"sl-absolute sl-inset-y-0 sl-left-0 sl-flex sl-items-center sl-pl-3",
|
|
487
489
|
w ? "sl-text-white" : "sl-text-stachelock-600 dark:sl-text-stachelock-400"
|
|
488
490
|
])
|
|
489
491
|
}, [
|
|
490
|
-
y(p(
|
|
492
|
+
y(p(Ge), {
|
|
491
493
|
class: "sl-h-5 sl-w-5",
|
|
492
494
|
"aria-hidden": "true"
|
|
493
495
|
})
|
|
@@ -506,31 +508,31 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
506
508
|
]),
|
|
507
509
|
_: 1
|
|
508
510
|
}, 8, ["modelValue", "disabled"]),
|
|
509
|
-
V.value && !e.disabled ? (x(),
|
|
510
|
-
v("div",
|
|
511
|
+
V.value && !e.disabled ? (x(), G("div", tt, [
|
|
512
|
+
v("div", st, [
|
|
511
513
|
v("span", {
|
|
512
514
|
class: I(["sl-text-xs sl-uppercase sl-font-medium", j.value])
|
|
513
|
-
}, N(
|
|
514
|
-
(x(),
|
|
515
|
+
}, N(ae.value), 3),
|
|
516
|
+
(x(), E(we(oe.value), {
|
|
515
517
|
class: I(["sl-h-4 sl-w-4", j.value])
|
|
516
518
|
}, null, 8, ["class"]))
|
|
517
519
|
]),
|
|
518
|
-
u.value ? (x(),
|
|
520
|
+
u.value ? (x(), G("button", {
|
|
519
521
|
key: 1,
|
|
520
522
|
type: "button",
|
|
521
523
|
onClick: t[2] || (t[2] = (o) => u.value = !1),
|
|
522
524
|
class: "sl-text-xs sl-text-gray-500 dark:sl-text-slate-400 hover:sl-underline sl-flex sl-items-center sl-gap-1"
|
|
523
525
|
}, [
|
|
524
526
|
t[10] || (t[10] = H(" Collapse ", -1)),
|
|
525
|
-
y(p(
|
|
526
|
-
])) : (x(),
|
|
527
|
+
y(p(Oe), { class: "sl-h-3 sl-w-3" })
|
|
528
|
+
])) : (x(), G("button", {
|
|
527
529
|
key: 0,
|
|
528
530
|
type: "button",
|
|
529
531
|
onClick: t[1] || (t[1] = (o) => u.value = !0),
|
|
530
532
|
class: "sl-text-xs sl-text-stachelock-600 dark:sl-text-stachelock-400 hover:sl-underline sl-flex sl-items-center sl-gap-1"
|
|
531
533
|
}, [
|
|
532
534
|
t[9] || (t[9] = H(" Edit address ", -1)),
|
|
533
|
-
y(p(
|
|
535
|
+
y(p(Te), { class: "sl-h-3 sl-w-3" })
|
|
534
536
|
]))
|
|
535
537
|
])) : R("", !0),
|
|
536
538
|
y(p(W), {
|
|
@@ -543,9 +545,9 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
543
545
|
"leave-to": "sl-opacity-0 sl-transform sl--translate-y-2"
|
|
544
546
|
}, {
|
|
545
547
|
default: C(() => [
|
|
546
|
-
v("div",
|
|
547
|
-
v("div",
|
|
548
|
-
y(
|
|
548
|
+
v("div", lt, [
|
|
549
|
+
v("div", at, [
|
|
550
|
+
y(T, {
|
|
549
551
|
name: `${e.name}_street`,
|
|
550
552
|
label: "Street Address",
|
|
551
553
|
value: s.street,
|
|
@@ -558,7 +560,7 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
558
560
|
}, null, 8, ["name", "value", "disabled"])
|
|
559
561
|
]),
|
|
560
562
|
v("div", null, [
|
|
561
|
-
y(
|
|
563
|
+
y(T, {
|
|
562
564
|
name: `${e.name}_suite`,
|
|
563
565
|
label: "Suite / Apt",
|
|
564
566
|
value: s.suite,
|
|
@@ -572,7 +574,7 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
572
574
|
}, null, 8, ["name", "value", "disabled"])
|
|
573
575
|
]),
|
|
574
576
|
v("div", null, [
|
|
575
|
-
y(
|
|
577
|
+
y(T, {
|
|
576
578
|
name: `${e.name}_city`,
|
|
577
579
|
label: "City",
|
|
578
580
|
value: s.city,
|
|
@@ -585,7 +587,7 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
585
587
|
}, null, 8, ["name", "value", "disabled"])
|
|
586
588
|
]),
|
|
587
589
|
v("div", null, [
|
|
588
|
-
y(
|
|
590
|
+
y(T, {
|
|
589
591
|
name: `${e.name}_state`,
|
|
590
592
|
label: "State",
|
|
591
593
|
value: s.state,
|
|
@@ -598,7 +600,7 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
598
600
|
}, null, 8, ["name", "value", "disabled"])
|
|
599
601
|
]),
|
|
600
602
|
v("div", null, [
|
|
601
|
-
y(
|
|
603
|
+
y(T, {
|
|
602
604
|
name: `${e.name}_zipcode`,
|
|
603
605
|
label: "ZIP Code",
|
|
604
606
|
value: s.zipcode,
|
|
@@ -611,7 +613,7 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
611
613
|
}, null, 8, ["name", "value", "disabled"])
|
|
612
614
|
]),
|
|
613
615
|
v("div", null, [
|
|
614
|
-
y(
|
|
616
|
+
y(T, {
|
|
615
617
|
name: `${e.name}_country`,
|
|
616
618
|
label: "Country",
|
|
617
619
|
value: s.country,
|
|
@@ -630,10 +632,10 @@ const Qe = { class: "sl-address-input" }, Xe = { class: "sl-space-y-3" }, Je = {
|
|
|
630
632
|
])
|
|
631
633
|
]),
|
|
632
634
|
_: 1
|
|
633
|
-
}, 8, ["id", "name", "label", "tertiary-label", "error-message", "success-message", "is-valid", "is-touched", "disabled"])
|
|
635
|
+
}, 8, ["id", "name", "label", "tertiary-label", "error-message", "success-message", "is-valid", "is-touched", "disabled", "optional"])
|
|
634
636
|
]));
|
|
635
637
|
}
|
|
636
|
-
}),
|
|
638
|
+
}), vt = /* @__PURE__ */ Ne(ot, [["__scopeId", "data-v-3d01266b"]]);
|
|
637
639
|
export {
|
|
638
|
-
|
|
640
|
+
vt as default
|
|
639
641
|
};
|