@alfadocs/ui-kit-debug 1.92.0 → 1.93.1
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/_chunks/map-view--c9bJDRw.js +726 -0
- package/dist/_chunks/map-view--c9bJDRw.js.map +1 -0
- package/dist/_chunks/{practice-results-Bls-mygM.js → practice-results-BWX9y6mS.js} +376 -374
- package/dist/_chunks/practice-results-BWX9y6mS.js.map +1 -0
- package/dist/_chunks/{reserved.agent-C1gLyK2R.js → reserved.agent-DnPwaa4u.js} +2 -2
- package/dist/_chunks/reserved.agent-DnPwaa4u.js.map +1 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/booking/booking-types.d.ts +5 -1
- package/dist/components/booking/booking-types.d.ts.map +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/map-view/index.d.ts +1 -1
- package/dist/components/map-view/index.d.ts.map +1 -1
- package/dist/components/map-view/index.js +1 -1
- package/dist/components/map-view/map-view.d.ts +17 -0
- package/dist/components/map-view/map-view.d.ts.map +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/practice-results/practice-results.d.ts +1 -1
- package/dist/components/practice-results/practice-results.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/package.json +1 -1
- package/dist/_chunks/map-view-UrNgxBy3.js +0 -606
- package/dist/_chunks/map-view-UrNgxBy3.js.map +0 -1
- package/dist/_chunks/practice-results-Bls-mygM.js.map +0 -1
- package/dist/_chunks/reserved.agent-C1gLyK2R.js.map +0 -1
|
@@ -1,606 +0,0 @@
|
|
|
1
|
-
import { jsx as r, jsxs as x } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as ce, useMemo as L, useRef as y, useId as pe, useState as D, useEffect as I, useCallback as R, useImperativeHandle as ue } from "react";
|
|
3
|
-
import { c as G } from "./index-D2ZczOXr.js";
|
|
4
|
-
import { useTranslation as C } from "react-i18next";
|
|
5
|
-
import { M as me, A as he, a as ge, b as fe, P as be, c as ve, u as ye, d as B, e as J } from "./maps-core-gate-DkNqGkm3.js";
|
|
6
|
-
import { B as we } from "./button-DohK_Ak_.js";
|
|
7
|
-
import { S as Me } from "./skeleton-tTWJpvAq.js";
|
|
8
|
-
import { V as ze } from "./visually-hidden-BHxEUGyT.js";
|
|
9
|
-
import { E as Ve } from "./error-boundary-tAn_GuCu.js";
|
|
10
|
-
import { u as ke } from "./registry-DvAUVLHh.js";
|
|
11
|
-
import { l as Ie } from "./length-token-DwMnGEYT.js";
|
|
12
|
-
import { M as Le } from "./map-pin-BaY37-Km.js";
|
|
13
|
-
import { E as xe } from "./external-link-CY6zAXXU.js";
|
|
14
|
-
const Ge = {
|
|
15
|
-
id: "map-view",
|
|
16
|
-
// pan → scroll (viewport move); set_zoom → set_value; select_marker → pick
|
|
17
|
-
// (NON-persisting marker focus, no value state slot).
|
|
18
|
-
capabilities: ["scroll", "set_value", "pick"],
|
|
19
|
-
// Every action routes through the imperative bridge, which only exists
|
|
20
|
-
// once the map has loaded: consent granted (the default is
|
|
21
|
-
// `consentGranted={false}`) and Google Maps finished loading. Until then
|
|
22
|
-
// all three actions are silent no-ops. `consentGranted` says whether the
|
|
23
|
-
// gate is passed, and a null `center` after it means the map is still
|
|
24
|
-
// loading. `center` / `zoom` are read off the live
|
|
25
|
-
// map because Google clamps zoom and animates pans, so requested is not
|
|
26
|
-
// applied; `selectedMarkerId` is the only confirmation the host accepted
|
|
27
|
-
// a `select_marker` proposal.
|
|
28
|
-
//
|
|
29
|
-
// A9: marker ids only (`MapMarker.id` is a stable opaque id). Never
|
|
30
|
-
// `MapMarker.label`, never the `address` prop (consumer-supplied free
|
|
31
|
-
// text, PII in any patient-address deployment), never `apiKey`.
|
|
32
|
-
state: {
|
|
33
|
-
consentGranted: {
|
|
34
|
-
type: "boolean",
|
|
35
|
-
descriptionKey: "ui.agent.mapView.state.consentGranted",
|
|
36
|
-
description: "True when the GDPR consent gate has been passed. Read this FIRST: while it is false every action is a silent no-op against a placeholder, and nothing else in the surface says so. When it is true but `center` is still null, Google Maps is loading; wait for `center` before acting.",
|
|
37
|
-
read: (e) => e.isConsentGranted()
|
|
38
|
-
},
|
|
39
|
-
markerCount: {
|
|
40
|
-
type: "number",
|
|
41
|
-
descriptionKey: "ui.agent.mapView.state.markerCount",
|
|
42
|
-
description: "Number of markers the consumer passed. Zero means there is nothing for `select_marker` to select. A count only — no ids, labels or positions.",
|
|
43
|
-
read: (e) => e.getMarkerCount()
|
|
44
|
-
},
|
|
45
|
-
selectedMarkerId: {
|
|
46
|
-
type: "string | null",
|
|
47
|
-
descriptionKey: "ui.agent.mapView.state.selectedMarkerId",
|
|
48
|
-
description: "Id of the marker the host currently holds as selected, or null. Selection is fully controlled by the consumer, so `select_marker` only proposes — this slot is the only way to see whether the proposal was accepted.",
|
|
49
|
-
read: (e) => e.getSelectedMarkerId()
|
|
50
|
-
},
|
|
51
|
-
center: {
|
|
52
|
-
type: "{ lat: number; lng: number } | null",
|
|
53
|
-
descriptionKey: "ui.agent.mapView.state.center",
|
|
54
|
-
description: "Live map centre in lat/lng, or null until the map has loaded (consent not granted, or Google Maps still loading). The read-back for `pan_to`, and the sign that the map is ready.",
|
|
55
|
-
read: (e) => e.getCenter()
|
|
56
|
-
},
|
|
57
|
-
zoom: {
|
|
58
|
-
type: "number | null",
|
|
59
|
-
descriptionKey: "ui.agent.mapView.state.zoom",
|
|
60
|
-
description: "Live zoom level, or null until the map has loaded. Google clamps zoom to the map type's range, so this is not necessarily the value last passed to `set_zoom`.",
|
|
61
|
-
read: (e) => e.getZoom()
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
actions: {
|
|
65
|
-
pan_to: {
|
|
66
|
-
// Ephemeral viewport move, no data loss → read.
|
|
67
|
-
safety: "read",
|
|
68
|
-
argsType: "{ position: { lat: number; lng: number } }",
|
|
69
|
-
argsSchema: {
|
|
70
|
-
type: "object",
|
|
71
|
-
properties: {
|
|
72
|
-
position: {
|
|
73
|
-
type: "object",
|
|
74
|
-
properties: {
|
|
75
|
-
lat: { type: "number", description: "Latitude in degrees." },
|
|
76
|
-
lng: { type: "number", description: "Longitude in degrees." }
|
|
77
|
-
},
|
|
78
|
-
required: ["lat", "lng"]
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
required: ["position"]
|
|
82
|
-
},
|
|
83
|
-
idempotent: !0,
|
|
84
|
-
descriptionKey: "ui.agent.mapView.actions.panTo",
|
|
85
|
-
description: "Pan the map to a new centre without changing zoom. Read the `center` slot back to confirm — Google animates the pan, so the applied centre settles after the call.",
|
|
86
|
-
errors: [
|
|
87
|
-
"Silent no-op until the map has loaded: while `consentGranted` is false (only the consent placeholder shows) or while `center` is still null (Google Maps is loading)."
|
|
88
|
-
],
|
|
89
|
-
invoke: (e, s) => {
|
|
90
|
-
e.panTo(s.position);
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
set_zoom: {
|
|
94
|
-
// Ephemeral viewport zoom, no data loss → read.
|
|
95
|
-
safety: "read",
|
|
96
|
-
argsType: "{ zoom: number }",
|
|
97
|
-
argsSchema: {
|
|
98
|
-
type: "object",
|
|
99
|
-
properties: {
|
|
100
|
-
zoom: {
|
|
101
|
-
type: "number",
|
|
102
|
-
description: "Zoom level, typical range 1–20."
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
required: ["zoom"]
|
|
106
|
-
},
|
|
107
|
-
idempotent: !0,
|
|
108
|
-
descriptionKey: "ui.agent.mapView.actions.setZoom",
|
|
109
|
-
description: "Set the map zoom level (typical range 1–20). Read the `zoom` slot back — Google clamps the request to the map type’s supported range, so requested and applied can differ.",
|
|
110
|
-
errors: [
|
|
111
|
-
"Silent no-op until the map has loaded: while `consentGranted` is false (only the consent placeholder shows) or while `center` is still null (Google Maps is loading).",
|
|
112
|
-
"Requested zoom is clamped to the map type's range; `zoom` reports what was actually applied."
|
|
113
|
-
],
|
|
114
|
-
invoke: (e, s) => {
|
|
115
|
-
e.setZoom(s.zoom);
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
select_marker: {
|
|
119
|
-
// Ephemeral marker focus, no data loss → read.
|
|
120
|
-
safety: "read",
|
|
121
|
-
argsType: "{ id: string | null }",
|
|
122
|
-
argsSchema: {
|
|
123
|
-
type: "object",
|
|
124
|
-
properties: {
|
|
125
|
-
id: {
|
|
126
|
-
type: ["string", "null"],
|
|
127
|
-
description: "Marker id to select, or null to clear the selection."
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
required: ["id"]
|
|
131
|
-
},
|
|
132
|
-
idempotent: !0,
|
|
133
|
-
descriptionKey: "ui.agent.mapView.actions.selectMarker",
|
|
134
|
-
description: "Propose a marker selection by id, or pass null to clear it. Fires the host's `onMarkerClick`; selection is controlled by the host, so read the `selectedMarkerId` slot back to see whether it accepted.",
|
|
135
|
-
errors: [
|
|
136
|
-
"Silent no-op until the map has loaded: while `consentGranted` is false (only the consent placeholder shows) or while `center` is still null (Google Maps is loading).",
|
|
137
|
-
"The host owns `selectedMarkerId` and may ignore the proposal; `selectedMarkerId` is unchanged when it does."
|
|
138
|
-
],
|
|
139
|
-
invoke: (e, s) => {
|
|
140
|
-
e.selectMarker(s.id);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
domHooks: {
|
|
145
|
-
root: {
|
|
146
|
-
attr: "data-component",
|
|
147
|
-
value: "map-view",
|
|
148
|
-
description: "Marks the element as a kit MapView."
|
|
149
|
-
},
|
|
150
|
-
instanceId: {
|
|
151
|
-
attr: "data-component-id",
|
|
152
|
-
sourceProp: "id",
|
|
153
|
-
description: "Sourced from the id prop."
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}, Se = G(
|
|
157
|
-
["ds:relative ds:overflow-hidden ds:block", "ds:bg-[var(--muted)]"].join(" "),
|
|
158
|
-
{
|
|
159
|
-
variants: {
|
|
160
|
-
size: {
|
|
161
|
-
sm: "ds:[--map-block-size:14rem]",
|
|
162
|
-
md: "ds:[--map-block-size:20rem]",
|
|
163
|
-
lg: "ds:[--map-block-size:28rem]",
|
|
164
|
-
// `fill` defers sizing to the parent. The outer takes
|
|
165
|
-
// `block-size: 100%` so the inner (also 100%) has something
|
|
166
|
-
// to inherit from. Use inside a viewport-locked column —
|
|
167
|
-
// `<PracticeResults variant="map-first">` wires this through
|
|
168
|
-
// automatically; standalone consumers must give the parent
|
|
169
|
-
// a constrained block-size or the map collapses to 0.
|
|
170
|
-
fill: "ds:[block-size:100%]"
|
|
171
|
-
},
|
|
172
|
-
surface: {
|
|
173
|
-
bordered: "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
174
|
-
elevated: "ds:rounded-[var(--radius-md)] ds:shadow-[var(--shadow-card)] ds:[:where(&)]:border-[length:var(--surface-border-width,var(--border-width-sm))] ds:border-[color:var(--card-border)]",
|
|
175
|
-
bare: "ds:rounded-none ds:border-0"
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
defaultVariants: { size: "md", surface: "bordered" }
|
|
179
|
-
}
|
|
180
|
-
), Te = G("ds:block ds:inline-size-full", {
|
|
181
|
-
variants: {
|
|
182
|
-
size: {
|
|
183
|
-
sm: "ds:[block-size:var(--map-block-size)]",
|
|
184
|
-
md: "ds:[block-size:var(--map-block-size)]",
|
|
185
|
-
lg: "ds:[block-size:var(--map-block-size)]",
|
|
186
|
-
fill: "ds:[block-size:100%]"
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
defaultVariants: { size: "md" }
|
|
190
|
-
}), Ne = G(
|
|
191
|
-
[
|
|
192
|
-
"ds:absolute ds:inset-0",
|
|
193
|
-
"ds:flex ds:flex-col ds:items-center ds:justify-center",
|
|
194
|
-
"ds:gap-[var(--spacing-sm)]",
|
|
195
|
-
"ds:p-[var(--spacing-md)]",
|
|
196
|
-
"ds:bg-[var(--muted)] ds:text-[var(--foreground)]",
|
|
197
|
-
"ds:text-center"
|
|
198
|
-
].join(" ")
|
|
199
|
-
), Pe = G("type-heading-3 ds:m-0"), F = G(
|
|
200
|
-
"type-body-sm ds:text-[var(--muted-foreground)] ds:[max-inline-size:28rem] ds:m-0"
|
|
201
|
-
);
|
|
202
|
-
function Re({
|
|
203
|
-
onHandleReady: e,
|
|
204
|
-
onMarkerSelect: s
|
|
205
|
-
}) {
|
|
206
|
-
const o = J();
|
|
207
|
-
return I(() => {
|
|
208
|
-
if (o)
|
|
209
|
-
return e({
|
|
210
|
-
panTo: (n) => o.panTo(n),
|
|
211
|
-
setZoom: (n) => o.setZoom(n),
|
|
212
|
-
jumpTo: (n, i) => o.moveCamera({ center: n, zoom: i }),
|
|
213
|
-
selectMarker: (n) => s(n),
|
|
214
|
-
// Read straight off the live map: Google clamps `setZoom` to the
|
|
215
|
-
// map type's range and animates `panTo`, so requested and applied
|
|
216
|
-
// are not the same value.
|
|
217
|
-
getCenter: () => {
|
|
218
|
-
var n;
|
|
219
|
-
return ((n = o.getCenter()) == null ? void 0 : n.toJSON()) ?? null;
|
|
220
|
-
},
|
|
221
|
-
getZoom: () => o.getZoom() ?? null
|
|
222
|
-
}), () => e(null);
|
|
223
|
-
}, [o, e, s]), null;
|
|
224
|
-
}
|
|
225
|
-
const Ce = 256, Ze = (e) => e * Math.PI / 180;
|
|
226
|
-
function K(e) {
|
|
227
|
-
const s = Math.min(Math.max(Math.sin(Ze(e)), -0.9999), 0.9999);
|
|
228
|
-
return Math.log((1 + s) / (1 - s)) / 2;
|
|
229
|
-
}
|
|
230
|
-
const je = (e) => Math.atan(Math.sinh(e)) * 180 / Math.PI;
|
|
231
|
-
function _e(e) {
|
|
232
|
-
let s = -90, o = 90, n = -180, i = 180;
|
|
233
|
-
for (const { lat: l, lng: a } of e)
|
|
234
|
-
s = Math.max(s, l), o = Math.min(o, l), n = Math.max(n, a), i = Math.min(i, a);
|
|
235
|
-
return { north: s, south: o, east: n, west: i };
|
|
236
|
-
}
|
|
237
|
-
function Ee(e, s, o, n, i) {
|
|
238
|
-
const { north: l, south: a, east: p, west: m } = _e(e);
|
|
239
|
-
if (l === a && p === m)
|
|
240
|
-
return { center: { lat: l, lng: p }, zoom: i };
|
|
241
|
-
const d = K(l), h = K(a), u = {
|
|
242
|
-
lat: je((d + h) / 2),
|
|
243
|
-
lng: (p + m) / 2
|
|
244
|
-
}, b = (w, M) => M > 0 ? Math.log2(Math.max(w, 1) / Ce / M) : i, g = Math.min(
|
|
245
|
-
b(s - 2 * n, (p - m) / 360),
|
|
246
|
-
b(o - 2 * n, (d - h) / (2 * Math.PI)),
|
|
247
|
-
i
|
|
248
|
-
);
|
|
249
|
-
return { center: u, zoom: Math.max(0, Math.floor(g)) };
|
|
250
|
-
}
|
|
251
|
-
const U = ({ id: e, lat: s, lng: o }) => e != null ? `id:${e}` : `at:${s},${o}`;
|
|
252
|
-
function Oe({ points: e, fitKey: s, maxZoom: o }) {
|
|
253
|
-
const n = J(), i = y(null), l = y(!1), a = y(null);
|
|
254
|
-
return I(() => {
|
|
255
|
-
if (!n) return;
|
|
256
|
-
const p = () => {
|
|
257
|
-
var g;
|
|
258
|
-
const d = a.current, h = (g = n.getCenter()) == null ? void 0 : g.toJSON(), u = n.getZoom();
|
|
259
|
-
d != null && u === d.zoom && h != null && Math.abs(h.lat - d.center.lat) < 1e-6 && Math.abs(h.lng - d.center.lng) < 1e-6 || (l.current = !0);
|
|
260
|
-
}, m = [
|
|
261
|
-
n.addListener("dragstart", () => {
|
|
262
|
-
l.current = !0;
|
|
263
|
-
}),
|
|
264
|
-
n.addListener("center_changed", p),
|
|
265
|
-
n.addListener("zoom_changed", p)
|
|
266
|
-
];
|
|
267
|
-
return () => m.forEach((d) => d.remove());
|
|
268
|
-
}, [n]), I(() => {
|
|
269
|
-
var M;
|
|
270
|
-
if (!n) return;
|
|
271
|
-
const p = ((M = i.current) == null ? void 0 : M.map) === n ? i.current : null;
|
|
272
|
-
if ((p == null ? void 0 : p.key) === s) return;
|
|
273
|
-
const m = new Set(e.map(U)), d = (f, z) => {
|
|
274
|
-
a.current = { center: f, zoom: z }, n.moveCamera({ center: f, zoom: z }), l.current = !1;
|
|
275
|
-
};
|
|
276
|
-
if (e.length === 0) {
|
|
277
|
-
i.current = { map: n, key: s, points: m };
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
if (p != null && p.points.size > 0 && [...p.points].every((f) => m.has(f)) && l.current) {
|
|
281
|
-
i.current = { map: n, key: s, points: m };
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
const u = n.getDiv();
|
|
285
|
-
if (!(u instanceof Element)) return;
|
|
286
|
-
const b = () => {
|
|
287
|
-
i.current = { map: n, key: s, points: m };
|
|
288
|
-
const f = Math.min(
|
|
289
|
-
Ie("--spacing-2xl", u, 48),
|
|
290
|
-
u.clientWidth / 4,
|
|
291
|
-
u.clientHeight / 4
|
|
292
|
-
), { center: z, zoom: P } = Ee(
|
|
293
|
-
e,
|
|
294
|
-
u.clientWidth,
|
|
295
|
-
u.clientHeight,
|
|
296
|
-
f,
|
|
297
|
-
o
|
|
298
|
-
);
|
|
299
|
-
d(z, P);
|
|
300
|
-
}, g = () => u.clientWidth > 0 && u.clientHeight > 0;
|
|
301
|
-
if (g() || typeof ResizeObserver > "u") {
|
|
302
|
-
b();
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
const w = new ResizeObserver(() => {
|
|
306
|
-
g() && (w.disconnect(), b());
|
|
307
|
-
});
|
|
308
|
-
return w.observe(u), () => w.disconnect();
|
|
309
|
-
}, [n, s, e, o]), null;
|
|
310
|
-
}
|
|
311
|
-
const X = (e) => {
|
|
312
|
-
var s, o;
|
|
313
|
-
return typeof ((o = (s = globalThis.google) == null ? void 0 : s.maps) == null ? void 0 : o[e]) == "function";
|
|
314
|
-
};
|
|
315
|
-
function Y() {
|
|
316
|
-
const { t: e } = C("ui");
|
|
317
|
-
return /* @__PURE__ */ x(
|
|
318
|
-
"div",
|
|
319
|
-
{
|
|
320
|
-
role: "status",
|
|
321
|
-
"data-testid": "map-view-loading",
|
|
322
|
-
className: "ds:[inline-size:100%] ds:[block-size:100%]",
|
|
323
|
-
children: [
|
|
324
|
-
/* @__PURE__ */ r(Me, { variant: "rectangular", width: "100%", height: "100%" }),
|
|
325
|
-
/* @__PURE__ */ r(ze, { children: e("common.loading") })
|
|
326
|
-
]
|
|
327
|
-
}
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
function $e({ children: e }) {
|
|
331
|
-
const s = ye();
|
|
332
|
-
return B("maps") || !s || X("Map") ? e : /* @__PURE__ */ r(Y, {});
|
|
333
|
-
}
|
|
334
|
-
function qe({ children: e }) {
|
|
335
|
-
return B("marker") || X("Marker") ? e : null;
|
|
336
|
-
}
|
|
337
|
-
function W({
|
|
338
|
-
address: e,
|
|
339
|
-
description: s,
|
|
340
|
-
onLoadMap: o,
|
|
341
|
-
openInGoogleMapsHref: n,
|
|
342
|
-
consentCta: i
|
|
343
|
-
}) {
|
|
344
|
-
const { t: l } = C("ui");
|
|
345
|
-
return /* @__PURE__ */ x("div", { className: Ne(), "data-testid": "map-view-consent", children: [
|
|
346
|
-
/* @__PURE__ */ r(
|
|
347
|
-
Le,
|
|
348
|
-
{
|
|
349
|
-
"aria-hidden": "true",
|
|
350
|
-
className: "ds:size-6 ds:text-[var(--muted-foreground)]"
|
|
351
|
-
}
|
|
352
|
-
),
|
|
353
|
-
/* @__PURE__ */ r("p", { className: Pe(), children: l("mapView.consentTitle") }),
|
|
354
|
-
e ? /* @__PURE__ */ r(
|
|
355
|
-
"p",
|
|
356
|
-
{
|
|
357
|
-
className: F(),
|
|
358
|
-
"data-testid": "map-view-address",
|
|
359
|
-
children: e
|
|
360
|
-
}
|
|
361
|
-
) : null,
|
|
362
|
-
/* @__PURE__ */ r("p", { className: F(), children: s }),
|
|
363
|
-
/* @__PURE__ */ x("div", { className: "ds:flex ds:gap-[var(--spacing-sm)] ds:flex-wrap ds:items-center ds:justify-center", children: [
|
|
364
|
-
i ?? /* @__PURE__ */ r(
|
|
365
|
-
we,
|
|
366
|
-
{
|
|
367
|
-
type: "button",
|
|
368
|
-
intent: "primary",
|
|
369
|
-
size: "sm",
|
|
370
|
-
onClick: o,
|
|
371
|
-
"data-testid": "map-view-load-cta",
|
|
372
|
-
children: l("mapView.consentCta")
|
|
373
|
-
}
|
|
374
|
-
),
|
|
375
|
-
/* @__PURE__ */ x(
|
|
376
|
-
"a",
|
|
377
|
-
{
|
|
378
|
-
href: n,
|
|
379
|
-
target: "_blank",
|
|
380
|
-
rel: "noopener noreferrer",
|
|
381
|
-
className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)] ds:text-[var(--primary-readable)] ds:underline ds:underline-offset-2",
|
|
382
|
-
children: [
|
|
383
|
-
l("mapView.openInGoogleMaps"),
|
|
384
|
-
/* @__PURE__ */ r(xe, { "aria-hidden": "true", className: "ds:size-3" })
|
|
385
|
-
]
|
|
386
|
-
}
|
|
387
|
-
)
|
|
388
|
-
] })
|
|
389
|
-
] });
|
|
390
|
-
}
|
|
391
|
-
const He = ce(
|
|
392
|
-
({
|
|
393
|
-
id: e,
|
|
394
|
-
apiKey: s,
|
|
395
|
-
center: o,
|
|
396
|
-
zoom: n = 15,
|
|
397
|
-
markers: i,
|
|
398
|
-
selectedMarkerId: l,
|
|
399
|
-
onMarkerClick: a,
|
|
400
|
-
consentGranted: p = !1,
|
|
401
|
-
onConsentRequest: m,
|
|
402
|
-
address: d,
|
|
403
|
-
consentDescription: h,
|
|
404
|
-
consentCta: u,
|
|
405
|
-
mapId: b,
|
|
406
|
-
size: g,
|
|
407
|
-
surface: w,
|
|
408
|
-
ariaLabel: M,
|
|
409
|
-
fitToPoints: f,
|
|
410
|
-
fitKey: z,
|
|
411
|
-
fitMaxZoom: P = 15,
|
|
412
|
-
className: Q,
|
|
413
|
-
...ee
|
|
414
|
-
}, te) => {
|
|
415
|
-
const { t: S, i18n: ne } = C("ui"), T = L(() => f ?? [], [f]), se = L(
|
|
416
|
-
() => z ?? T.map((t) => `${U(t)}@${t.lat},${t.lng}`).sort().join("|"),
|
|
417
|
-
[z, T]
|
|
418
|
-
), V = T.length > 0, Z = y(V), j = pe(), oe = L(
|
|
419
|
-
() => `map-${j.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
420
|
-
[j]
|
|
421
|
-
), [_, re] = D(!1);
|
|
422
|
-
I(() => {
|
|
423
|
-
if (typeof window > "u") return;
|
|
424
|
-
const t = window.matchMedia("(prefers-reduced-motion: reduce)"), c = () => re(t.matches);
|
|
425
|
-
return c(), t.addEventListener("change", c), () => t.removeEventListener("change", c);
|
|
426
|
-
}, []);
|
|
427
|
-
const E = L(() => `https://www.google.com/maps/search/?api=1&query=${d ? encodeURIComponent(d) : `${o.lat},${o.lng}`}`, [d, o.lat, o.lng]), v = y(null), ae = R((t) => {
|
|
428
|
-
v.current = t;
|
|
429
|
-
}, []), O = y(!1), $ = y(null), q = y(0), N = R(
|
|
430
|
-
() => ({
|
|
431
|
-
panTo: (t) => {
|
|
432
|
-
var c;
|
|
433
|
-
return (c = v.current) == null ? void 0 : c.panTo(t);
|
|
434
|
-
},
|
|
435
|
-
setZoom: (t) => {
|
|
436
|
-
var c;
|
|
437
|
-
return (c = v.current) == null ? void 0 : c.setZoom(t);
|
|
438
|
-
},
|
|
439
|
-
selectMarker: (t) => {
|
|
440
|
-
var c;
|
|
441
|
-
return (c = v.current) == null ? void 0 : c.selectMarker(t);
|
|
442
|
-
},
|
|
443
|
-
// Without `isConsentGranted` an agent has no way to learn that
|
|
444
|
-
// its pan / zoom / select was swallowed by the GDPR gate rather
|
|
445
|
-
// than applied: under the default (`consentGranted={false}`) the
|
|
446
|
-
// whole Maps subtree is unmounted and every action optional-chains
|
|
447
|
-
// into nothing.
|
|
448
|
-
isConsentGranted: () => O.current,
|
|
449
|
-
getCenter: () => {
|
|
450
|
-
var t;
|
|
451
|
-
return ((t = v.current) == null ? void 0 : t.getCenter()) ?? null;
|
|
452
|
-
},
|
|
453
|
-
getZoom: () => {
|
|
454
|
-
var t;
|
|
455
|
-
return ((t = v.current) == null ? void 0 : t.getZoom()) ?? null;
|
|
456
|
-
},
|
|
457
|
-
getSelectedMarkerId: () => $.current,
|
|
458
|
-
getMarkerCount: () => q.current
|
|
459
|
-
}),
|
|
460
|
-
[]
|
|
461
|
-
);
|
|
462
|
-
ue(te, N, [N]);
|
|
463
|
-
const ie = L(
|
|
464
|
-
() => N(),
|
|
465
|
-
[N]
|
|
466
|
-
);
|
|
467
|
-
ke(Ge, ie, e), I(() => {
|
|
468
|
-
var c, k;
|
|
469
|
-
const t = Z.current && !V;
|
|
470
|
-
if (Z.current = V, !V) {
|
|
471
|
-
if (t) {
|
|
472
|
-
(c = v.current) == null || c.jumpTo(o, n);
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
_ || (k = v.current) == null || k.panTo(o);
|
|
476
|
-
}
|
|
477
|
-
}, [o.lat, o.lng, _, V]), I(() => {
|
|
478
|
-
var t;
|
|
479
|
-
V || (t = v.current) == null || t.setZoom(n);
|
|
480
|
-
}, [n, V]);
|
|
481
|
-
const [le, H] = D(!1), A = p || le;
|
|
482
|
-
O.current = A, $.current = l ?? null, q.current = (i ?? []).length;
|
|
483
|
-
const de = R(() => {
|
|
484
|
-
if (m) {
|
|
485
|
-
m(), H(!0);
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
H(!0);
|
|
489
|
-
}, [m]);
|
|
490
|
-
return /* @__PURE__ */ r(
|
|
491
|
-
"div",
|
|
492
|
-
{
|
|
493
|
-
className: Se({ size: g, surface: w, className: Q }),
|
|
494
|
-
"data-component": "map-view",
|
|
495
|
-
"data-component-id": e ?? oe,
|
|
496
|
-
role: "region",
|
|
497
|
-
"aria-label": M ?? S("mapView.label"),
|
|
498
|
-
...ee,
|
|
499
|
-
children: /* @__PURE__ */ r("div", { className: Te({ size: g }), children: A ? (
|
|
500
|
-
// A provider failure shows the consent placeholder (its "Open in
|
|
501
|
-
// Google Maps" link needs no script) with "Load map" as the
|
|
502
|
-
// retry, instead of unmounting the host's React tree. The gate
|
|
503
|
-
// starts the provider only once Google's `core` and `maps`
|
|
504
|
-
// libraries have arrived.
|
|
505
|
-
/* @__PURE__ */ r(
|
|
506
|
-
Ve,
|
|
507
|
-
{
|
|
508
|
-
fallback: ({ reset: t }) => /* @__PURE__ */ r(
|
|
509
|
-
W,
|
|
510
|
-
{
|
|
511
|
-
address: d,
|
|
512
|
-
description: h ?? S("mapView.consentDescription"),
|
|
513
|
-
onLoadMap: t,
|
|
514
|
-
consentCta: void 0,
|
|
515
|
-
openInGoogleMapsHref: E
|
|
516
|
-
}
|
|
517
|
-
),
|
|
518
|
-
children: /* @__PURE__ */ r(me, { libraries: ["maps"], pending: /* @__PURE__ */ r(Y, {}), children: /* @__PURE__ */ r(
|
|
519
|
-
he,
|
|
520
|
-
{
|
|
521
|
-
apiKey: s,
|
|
522
|
-
language: ne.language,
|
|
523
|
-
children: /* @__PURE__ */ r($e, { children: /* @__PURE__ */ x(
|
|
524
|
-
ge,
|
|
525
|
-
{
|
|
526
|
-
defaultCenter: o,
|
|
527
|
-
defaultZoom: n,
|
|
528
|
-
mapId: b,
|
|
529
|
-
gestureHandling: "cooperative",
|
|
530
|
-
disableDefaultUI: !1,
|
|
531
|
-
onClick: () => a == null ? void 0 : a(null),
|
|
532
|
-
className: "ds:[inline-size:100%] ds:[block-size:100%]",
|
|
533
|
-
children: [
|
|
534
|
-
/* @__PURE__ */ r(
|
|
535
|
-
Re,
|
|
536
|
-
{
|
|
537
|
-
onHandleReady: ae,
|
|
538
|
-
onMarkerSelect: (t) => a == null ? void 0 : a(t)
|
|
539
|
-
}
|
|
540
|
-
),
|
|
541
|
-
f ? /* @__PURE__ */ r(
|
|
542
|
-
Oe,
|
|
543
|
-
{
|
|
544
|
-
points: T,
|
|
545
|
-
fitKey: se,
|
|
546
|
-
maxZoom: P
|
|
547
|
-
}
|
|
548
|
-
) : null,
|
|
549
|
-
/* @__PURE__ */ r(qe, { children: (i ?? []).map((t) => {
|
|
550
|
-
const c = l != null && l === t.id, k = S("mapView.markerLabel", {
|
|
551
|
-
label: t.label ?? t.id
|
|
552
|
-
});
|
|
553
|
-
return b ? /* @__PURE__ */ r(
|
|
554
|
-
fe,
|
|
555
|
-
{
|
|
556
|
-
position: t.position,
|
|
557
|
-
title: k,
|
|
558
|
-
"aria-label": k,
|
|
559
|
-
"data-selected": c ? "true" : "false",
|
|
560
|
-
onClick: () => a == null ? void 0 : a(t.id),
|
|
561
|
-
children: /* @__PURE__ */ r(
|
|
562
|
-
be,
|
|
563
|
-
{
|
|
564
|
-
background: "var(--primary)",
|
|
565
|
-
borderColor: "var(--primary)",
|
|
566
|
-
glyphColor: "var(--primary-foreground)"
|
|
567
|
-
}
|
|
568
|
-
)
|
|
569
|
-
},
|
|
570
|
-
t.id
|
|
571
|
-
) : /* @__PURE__ */ r(
|
|
572
|
-
ve,
|
|
573
|
-
{
|
|
574
|
-
position: t.position,
|
|
575
|
-
title: k,
|
|
576
|
-
onClick: () => a == null ? void 0 : a(t.id)
|
|
577
|
-
},
|
|
578
|
-
t.id
|
|
579
|
-
);
|
|
580
|
-
}) })
|
|
581
|
-
]
|
|
582
|
-
}
|
|
583
|
-
) })
|
|
584
|
-
}
|
|
585
|
-
) })
|
|
586
|
-
}
|
|
587
|
-
)
|
|
588
|
-
) : /* @__PURE__ */ r(
|
|
589
|
-
W,
|
|
590
|
-
{
|
|
591
|
-
address: d,
|
|
592
|
-
description: h ?? S("mapView.consentDescription"),
|
|
593
|
-
onLoadMap: de,
|
|
594
|
-
consentCta: u,
|
|
595
|
-
openInGoogleMapsHref: E
|
|
596
|
-
}
|
|
597
|
-
) })
|
|
598
|
-
}
|
|
599
|
-
);
|
|
600
|
-
}
|
|
601
|
-
);
|
|
602
|
-
He.displayName = "MapView";
|
|
603
|
-
export {
|
|
604
|
-
He as M
|
|
605
|
-
};
|
|
606
|
-
//# sourceMappingURL=map-view-UrNgxBy3.js.map
|