@r2digisolutions/components 0.22.2 → 0.23.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/components/atoms/Avatar/Avatar.stories.d.ts +1 -1
- package/dist/components/atoms/Avatar/Avatar.stories.js +1 -1
- package/dist/components/atoms/Avatar/Avatar.svelte +5 -3
- package/dist/components/atoms/Avatar/Avatar.svelte.d.ts +1 -1
- package/dist/components/atoms/Avatar/AvatarStory.svelte +1 -1
- package/dist/components/atoms/Avatar/AvatarStory.svelte.d.ts +1 -1
- package/dist/components/atoms/Container/Container.stories.d.ts +1 -1
- package/dist/components/atoms/Container/ContainerStory.svelte.d.ts +1 -1
- package/dist/components/atoms/Input/Input.svelte +5 -4
- package/dist/components/molecules/AdSlot/AdSlot.stories.js +10 -0
- package/dist/components/molecules/AdSlot/AdSlot.svelte +16 -0
- package/dist/components/molecules/AdSlot/AdSlot.svelte.d.ts +8 -0
- package/dist/components/molecules/AdSlot/AdSlotStory.svelte +23 -0
- package/dist/components/molecules/AdSlot/AdSlotStory.svelte.d.ts +18 -0
- package/dist/components/molecules/AdUnit/AdUnit.stories.js +28 -0
- package/dist/components/molecules/AdUnit/AdUnit.svelte +151 -0
- package/dist/components/molecules/AdUnit/AdUnit.svelte.d.ts +15 -0
- package/dist/components/molecules/AdUnit/AdUnitStory.svelte +36 -0
- package/dist/components/molecules/AdUnit/AdUnitStory.svelte.d.ts +7 -0
- package/dist/components/molecules/AvatarGroup/AvatarGroup.svelte +1 -1
- package/dist/components/molecules/AvatarGroup/AvatarGroup.svelte.d.ts +1 -1
- package/dist/components/molecules/AvatarLabel/AvatarLabel.svelte +1 -1
- package/dist/components/molecules/AvatarLabel/AvatarLabel.svelte.d.ts +1 -1
- package/dist/components/molecules/Card/Card.svelte +6 -15
- package/dist/components/molecules/ChipBar/ChipBar.svelte +18 -5
- package/dist/components/molecules/ChipBar/ChipBar.svelte.d.ts +1 -1
- package/dist/components/molecules/FeatureList/FeatureList.svelte +26 -7
- package/dist/components/molecules/FeatureList/FeatureList.svelte.d.ts +2 -0
- package/dist/components/molecules/KnowledgeCard/KnowledgeCard.stories.js +25 -0
- package/dist/components/molecules/KnowledgeCard/KnowledgeCard.svelte +95 -0
- package/dist/components/molecules/KnowledgeCard/KnowledgeCard.svelte.d.ts +15 -0
- package/dist/components/molecules/KnowledgeCard/KnowledgeCardStory.svelte +56 -0
- package/dist/components/molecules/KnowledgeCard/KnowledgeCardStory.svelte.d.ts +6 -0
- package/dist/components/molecules/LocaleSwitcher/LocaleSwitcher.svelte +5 -5
- package/dist/components/molecules/MediaCard/MediaCard.svelte +101 -24
- package/dist/components/molecules/MediaCard/MediaCard.svelte.d.ts +25 -6
- package/dist/components/molecules/MediaCard/MediaCardStory.svelte +34 -1
- package/dist/components/molecules/SearchBar/SearchBar.svelte +7 -1
- package/dist/components/molecules/SearchInput/SearchInput.svelte +77 -18
- package/dist/components/molecules/SearchInput/SearchInput.svelte.d.ts +4 -0
- package/dist/components/molecules/SearchInput/SearchInputStory.svelte +1 -0
- package/dist/components/molecules/SearchResultRow/SearchResultRow.stories.js +25 -0
- package/dist/components/molecules/SearchResultRow/SearchResultRow.svelte +74 -0
- package/dist/components/molecules/SearchResultRow/SearchResultRow.svelte.d.ts +18 -0
- package/dist/components/molecules/SearchResultRow/SearchResultRowStory.svelte +85 -0
- package/dist/components/molecules/SearchResultRow/SearchResultRowStory.svelte.d.ts +6 -0
- package/dist/components/molecules/StatCard/StatCard.svelte +7 -1
- package/dist/components/molecules/StatCard/StatCard.svelte.d.ts +2 -0
- package/dist/components/organisms/Drawer/Drawer.svelte +120 -37
- package/dist/components/organisms/Drawer/Drawer.svelte.d.ts +6 -0
- package/dist/components/organisms/MapExplorer/MapExplorer.stories.d.ts +12 -0
- package/dist/components/organisms/MapExplorer/MapExplorer.stories.js +11 -0
- package/dist/components/organisms/MapExplorer/MapExplorer.svelte +928 -0
- package/dist/components/organisms/MapExplorer/MapExplorer.svelte.d.ts +96 -0
- package/dist/components/organisms/MapExplorer/MapExplorerStory.svelte +124 -0
- package/dist/components/organisms/MapExplorer/MapExplorerStory.svelte.d.ts +3 -0
- package/dist/components/organisms/Navbar/Navbar.stories.d.ts +1 -1
- package/dist/components/organisms/Navbar/Navbar.stories.js +1 -1
- package/dist/components/organisms/Navbar/Navbar.svelte +137 -64
- package/dist/components/organisms/Navbar/Navbar.svelte.d.ts +5 -1
- package/dist/components/organisms/Navbar/NavbarStory.svelte +1 -1
- package/dist/components/organisms/Navbar/NavbarStory.svelte.d.ts +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +5 -0
- package/package.json +12 -8
|
@@ -0,0 +1,928 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import Filter from '@lucide/svelte/icons/filter';
|
|
4
|
+
import List from '@lucide/svelte/icons/list';
|
|
5
|
+
import LayoutGrid from '@lucide/svelte/icons/layout-grid';
|
|
6
|
+
import LayoutList from '@lucide/svelte/icons/layout-list';
|
|
7
|
+
import LocateFixed from '@lucide/svelte/icons/locate-fixed';
|
|
8
|
+
import MapIcon from '@lucide/svelte/icons/map';
|
|
9
|
+
import Badge from '../../atoms/Badge/Badge.svelte';
|
|
10
|
+
import Button from '../../atoms/Button/Button.svelte';
|
|
11
|
+
import CountBadge from '../../atoms/CountBadge/CountBadge.svelte';
|
|
12
|
+
import IconButton from '../../atoms/IconButton/IconButton.svelte';
|
|
13
|
+
import Image from '../../atoms/Image/Image.svelte';
|
|
14
|
+
import Text from '../../atoms/Text/Text.svelte';
|
|
15
|
+
import Card from '../../molecules/Card/Card.svelte';
|
|
16
|
+
import EmptyState from '../../molecules/EmptyState/EmptyState.svelte';
|
|
17
|
+
import FilterChips from '../../molecules/FilterChips/FilterChips.svelte';
|
|
18
|
+
import SearchInput from '../../molecules/SearchInput/SearchInput.svelte';
|
|
19
|
+
import Select from '../../molecules/Select/Select.svelte';
|
|
20
|
+
import type { SelectOption } from '../../molecules/Select/Select.svelte';
|
|
21
|
+
import Drawer from '../Drawer/Drawer.svelte';
|
|
22
|
+
import type { Map as LeafletMap, TileLayer } from 'leaflet';
|
|
23
|
+
|
|
24
|
+
export type MapExplorerBounds = {
|
|
25
|
+
south: number;
|
|
26
|
+
west: number;
|
|
27
|
+
north: number;
|
|
28
|
+
east: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type MapExplorerItem = {
|
|
32
|
+
id: string;
|
|
33
|
+
lat: number;
|
|
34
|
+
lng: number;
|
|
35
|
+
title: string;
|
|
36
|
+
subtitle?: string;
|
|
37
|
+
meta?: string;
|
|
38
|
+
priceLabel?: string;
|
|
39
|
+
imageUrl?: string | null;
|
|
40
|
+
href?: string;
|
|
41
|
+
badge?: string;
|
|
42
|
+
chip?: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type MapExplorerCluster = {
|
|
46
|
+
id: string;
|
|
47
|
+
lat: number;
|
|
48
|
+
lng: number;
|
|
49
|
+
count: number;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type MapExplorerFilter = {
|
|
53
|
+
id: string;
|
|
54
|
+
label: string;
|
|
55
|
+
placeholder?: string;
|
|
56
|
+
value: string;
|
|
57
|
+
options: SelectOption[];
|
|
58
|
+
type?: 'select' | 'chips';
|
|
59
|
+
searchable?: boolean;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type MapExplorerPanel = 'list' | 'map';
|
|
63
|
+
export type MapExplorerListView = 'list' | 'grid';
|
|
64
|
+
export type MapExplorerCardContext = {
|
|
65
|
+
select: () => void;
|
|
66
|
+
selected: boolean;
|
|
67
|
+
layout: MapExplorerListView;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
interface MapExplorerProps {
|
|
71
|
+
items?: MapExplorerItem[];
|
|
72
|
+
pins?: MapExplorerItem[];
|
|
73
|
+
clusters?: MapExplorerCluster[];
|
|
74
|
+
selectedId?: string | null;
|
|
75
|
+
query?: string;
|
|
76
|
+
filters?: MapExplorerFilter[];
|
|
77
|
+
total?: number;
|
|
78
|
+
loading?: boolean;
|
|
79
|
+
title?: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
resultLabel?: string;
|
|
82
|
+
searchPlaceholder?: string;
|
|
83
|
+
filtersTitle?: string;
|
|
84
|
+
filtersHint?: string;
|
|
85
|
+
clearFiltersLabel?: string;
|
|
86
|
+
searchAreaLabel?: string;
|
|
87
|
+
locateLabel?: string;
|
|
88
|
+
listLabel?: string;
|
|
89
|
+
mapLabel?: string;
|
|
90
|
+
emptyTitle?: string;
|
|
91
|
+
emptyDescription?: string;
|
|
92
|
+
detailCtaLabel?: string;
|
|
93
|
+
listViewLabel?: string;
|
|
94
|
+
gridViewLabel?: string;
|
|
95
|
+
listView?: MapExplorerListView;
|
|
96
|
+
locateOnLoad?: boolean;
|
|
97
|
+
showSearchArea?: boolean;
|
|
98
|
+
fitToken?: string;
|
|
99
|
+
defaultCenter?: [number, number];
|
|
100
|
+
defaultZoom?: number;
|
|
101
|
+
tileUrl?: string;
|
|
102
|
+
darkTileUrl?: string;
|
|
103
|
+
tileAttribution?: string;
|
|
104
|
+
class?: string;
|
|
105
|
+
card?: Snippet<[MapExplorerItem, MapExplorerCardContext]>;
|
|
106
|
+
detail?: Snippet<[MapExplorerItem]>;
|
|
107
|
+
emptyAction?: Snippet;
|
|
108
|
+
onsearch?: (query: string) => void;
|
|
109
|
+
onfilterchange?: (id: string, value: string) => void;
|
|
110
|
+
onclearfilters?: () => void;
|
|
111
|
+
onselect?: (item: MapExplorerItem | null) => void;
|
|
112
|
+
onboundschange?: (bounds: MapExplorerBounds, zoom: number) => void;
|
|
113
|
+
onsearcharea?: (bounds: MapExplorerBounds, zoom: number) => void;
|
|
114
|
+
onclusterclick?: (cluster: MapExplorerCluster) => void;
|
|
115
|
+
onlocate?: (coords: { lat: number; lng: number }) => void;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let {
|
|
119
|
+
items = [],
|
|
120
|
+
pins,
|
|
121
|
+
clusters = [],
|
|
122
|
+
selectedId = $bindable<string | null>(null),
|
|
123
|
+
query = $bindable(''),
|
|
124
|
+
filters = [],
|
|
125
|
+
total = 0,
|
|
126
|
+
loading = false,
|
|
127
|
+
title = 'Explore',
|
|
128
|
+
description,
|
|
129
|
+
resultLabel,
|
|
130
|
+
searchPlaceholder = 'Search…',
|
|
131
|
+
filtersTitle = 'Filters',
|
|
132
|
+
filtersHint = 'Narrow the map and list.',
|
|
133
|
+
clearFiltersLabel = 'Clear filters',
|
|
134
|
+
searchAreaLabel = 'Search this area',
|
|
135
|
+
locateLabel = 'Near me',
|
|
136
|
+
listLabel = 'List',
|
|
137
|
+
mapLabel = 'Map',
|
|
138
|
+
emptyTitle = 'Nothing here yet',
|
|
139
|
+
emptyDescription = 'Try another area or clear filters.',
|
|
140
|
+
detailCtaLabel = 'View',
|
|
141
|
+
listViewLabel = 'List',
|
|
142
|
+
gridViewLabel = 'Grid',
|
|
143
|
+
listView = $bindable<MapExplorerListView>('list'),
|
|
144
|
+
locateOnLoad = true,
|
|
145
|
+
showSearchArea = true,
|
|
146
|
+
fitToken = '',
|
|
147
|
+
defaultCenter = [40.4168, -3.7038],
|
|
148
|
+
defaultZoom = 6,
|
|
149
|
+
tileUrl = '',
|
|
150
|
+
darkTileUrl = '',
|
|
151
|
+
tileAttribution = '© OpenStreetMap contributors',
|
|
152
|
+
class: className = '',
|
|
153
|
+
card,
|
|
154
|
+
detail,
|
|
155
|
+
emptyAction,
|
|
156
|
+
onsearch,
|
|
157
|
+
onfilterchange,
|
|
158
|
+
onclearfilters,
|
|
159
|
+
onselect,
|
|
160
|
+
onboundschange,
|
|
161
|
+
onsearcharea,
|
|
162
|
+
onclusterclick,
|
|
163
|
+
onlocate
|
|
164
|
+
}: MapExplorerProps = $props();
|
|
165
|
+
|
|
166
|
+
const OSM_TILES = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
|
|
167
|
+
|
|
168
|
+
let panel = $state<MapExplorerPanel>('map');
|
|
169
|
+
let filtersOpen = $state(false);
|
|
170
|
+
let searchAreaVisible = $state(false);
|
|
171
|
+
let locating = $state(false);
|
|
172
|
+
let mapEl = $state<HTMLElement | undefined>(undefined);
|
|
173
|
+
let listEl = $state<HTMLElement | undefined>(undefined);
|
|
174
|
+
let map = $state.raw<LeafletMap | null>(null);
|
|
175
|
+
let leaflet = $state.raw<typeof import('leaflet') | null>(null);
|
|
176
|
+
let tileLayer: TileLayer | null = null;
|
|
177
|
+
let pinGroup: unknown = null;
|
|
178
|
+
let clusterLayer: unknown = null;
|
|
179
|
+
let dark = $state(false);
|
|
180
|
+
let skipNextMove = false;
|
|
181
|
+
let lastFitToken = '';
|
|
182
|
+
let boundsTimer: ReturnType<typeof setTimeout> | null = null;
|
|
183
|
+
|
|
184
|
+
const shown = $derived(items.length);
|
|
185
|
+
const mapPins = $derived(pins ?? items);
|
|
186
|
+
const resultsText = $derived(
|
|
187
|
+
resultLabel ?? (total > shown ? `${shown} / ${total}` : String(total || shown))
|
|
188
|
+
);
|
|
189
|
+
const activeFilterCount = $derived(filters.filter((f) => Boolean(f.value)).length);
|
|
190
|
+
const selected = $derived(
|
|
191
|
+
items.find((item) => item.id === selectedId) ??
|
|
192
|
+
mapPins.find((item) => item.id === selectedId) ??
|
|
193
|
+
null
|
|
194
|
+
);
|
|
195
|
+
let detailOpen = $state(false);
|
|
196
|
+
const activeTileUrl = $derived(dark && darkTileUrl ? darkTileUrl : tileUrl || OSM_TILES);
|
|
197
|
+
const invertTiles = $derived(dark && !darkTileUrl);
|
|
198
|
+
|
|
199
|
+
$effect(() => {
|
|
200
|
+
if (typeof document === 'undefined') return;
|
|
201
|
+
const root = document.documentElement;
|
|
202
|
+
const sync = () => {
|
|
203
|
+
dark = root.classList.contains('dark');
|
|
204
|
+
};
|
|
205
|
+
sync();
|
|
206
|
+
const observer = new MutationObserver(sync);
|
|
207
|
+
observer.observe(root, { attributes: true, attributeFilter: ['class'] });
|
|
208
|
+
return () => observer.disconnect();
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
function currentBounds(instance: LeafletMap): MapExplorerBounds {
|
|
212
|
+
const b = instance.getBounds();
|
|
213
|
+
return {
|
|
214
|
+
south: b.getSouth(),
|
|
215
|
+
west: b.getWest(),
|
|
216
|
+
north: b.getNorth(),
|
|
217
|
+
east: b.getEast()
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function emitBounds(instance: LeafletMap, viaSearchArea = false) {
|
|
222
|
+
const bounds = currentBounds(instance);
|
|
223
|
+
const zoom = instance.getZoom();
|
|
224
|
+
if (viaSearchArea) onsearcharea?.(bounds, zoom);
|
|
225
|
+
else onboundschange?.(bounds, zoom);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function scheduleBounds(instance: LeafletMap) {
|
|
229
|
+
if (skipNextMove) {
|
|
230
|
+
skipNextMove = false;
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (showSearchArea) searchAreaVisible = true;
|
|
234
|
+
if (boundsTimer) clearTimeout(boundsTimer);
|
|
235
|
+
boundsTimer = setTimeout(() => emitBounds(instance), 280);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function escapeHtml(value: string) {
|
|
239
|
+
return value
|
|
240
|
+
.replace(/&/g, '&')
|
|
241
|
+
.replace(/"/g, '"')
|
|
242
|
+
.replace(/</g, '<')
|
|
243
|
+
.replace(/>/g, '>');
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function pinHtml(item: MapExplorerItem, selectedPin: boolean) {
|
|
247
|
+
const label = escapeHtml(item.priceLabel || item.badge || item.title.slice(0, 18));
|
|
248
|
+
const selectedClass = selectedPin ? ' is-selected' : '';
|
|
249
|
+
return `<div class="r2-map-pin${selectedClass}"><span class="r2-map-pin-label">${label}</span><span class="r2-map-pin-tip"></span></div>`;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function clusterHtml(count: number) {
|
|
253
|
+
const size = count >= 100 ? 'lg' : count >= 20 ? 'md' : 'sm';
|
|
254
|
+
return `<div class="r2-map-cluster r2-map-cluster-${size}">${count}</div>`;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function selectItem(item: MapExplorerItem) {
|
|
258
|
+
selectedId = item.id;
|
|
259
|
+
detailOpen = true;
|
|
260
|
+
onselect?.(item);
|
|
261
|
+
const row = listEl?.querySelector(`[data-map-item="${item.id}"]`);
|
|
262
|
+
row?.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function closeDetail() {
|
|
266
|
+
selectedId = null;
|
|
267
|
+
detailOpen = false;
|
|
268
|
+
onselect?.(null);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Bounds/list refresh can drop the open item — close instead of an empty shell.
|
|
272
|
+
$effect(() => {
|
|
273
|
+
if (detailOpen && selectedId != null && !selected) {
|
|
274
|
+
closeDetail();
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
function applyQuery() {
|
|
279
|
+
onsearch?.(query);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function resetView() {
|
|
283
|
+
selectedId = null;
|
|
284
|
+
detailOpen = false;
|
|
285
|
+
filtersOpen = false;
|
|
286
|
+
searchAreaVisible = false;
|
|
287
|
+
lastFitToken = '';
|
|
288
|
+
if (boundsTimer) {
|
|
289
|
+
clearTimeout(boundsTimer);
|
|
290
|
+
boundsTimer = null;
|
|
291
|
+
}
|
|
292
|
+
const instance = map;
|
|
293
|
+
if (!instance) return;
|
|
294
|
+
skipNextMove = true;
|
|
295
|
+
instance.setView(defaultCenter, defaultZoom, { animate: false });
|
|
296
|
+
emitBounds(instance);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function searchVisibleArea() {
|
|
300
|
+
const instance = map;
|
|
301
|
+
if (!instance) return;
|
|
302
|
+
searchAreaVisible = false;
|
|
303
|
+
emitBounds(instance, true);
|
|
304
|
+
onboundschange?.(currentBounds(instance), instance.getZoom());
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
async function locate() {
|
|
308
|
+
if (typeof navigator === 'undefined' || !navigator.geolocation) return;
|
|
309
|
+
locating = true;
|
|
310
|
+
navigator.geolocation.getCurrentPosition(
|
|
311
|
+
(pos) => {
|
|
312
|
+
locating = false;
|
|
313
|
+
const coords = { lat: pos.coords.latitude, lng: pos.coords.longitude };
|
|
314
|
+
const instance = map;
|
|
315
|
+
if (instance) {
|
|
316
|
+
skipNextMove = true;
|
|
317
|
+
searchAreaVisible = false;
|
|
318
|
+
instance.flyTo([coords.lat, coords.lng], Math.max(instance.getZoom(), 12), {
|
|
319
|
+
duration: 0.7
|
|
320
|
+
});
|
|
321
|
+
instance.once('moveend', () => emitBounds(instance));
|
|
322
|
+
}
|
|
323
|
+
onlocate?.(coords);
|
|
324
|
+
},
|
|
325
|
+
() => {
|
|
326
|
+
locating = false;
|
|
327
|
+
},
|
|
328
|
+
{ enableHighAccuracy: true, timeout: 8000, maximumAge: 60_000 }
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
$effect(() => {
|
|
333
|
+
const el = mapEl;
|
|
334
|
+
if (!el) return;
|
|
335
|
+
|
|
336
|
+
let cancelled = false;
|
|
337
|
+
let instance: LeafletMap | null = null;
|
|
338
|
+
|
|
339
|
+
(async () => {
|
|
340
|
+
await import('leaflet/dist/leaflet.css');
|
|
341
|
+
await import('leaflet.markercluster/dist/MarkerCluster.css');
|
|
342
|
+
await import('leaflet.markercluster/dist/MarkerCluster.Default.css');
|
|
343
|
+
const mod = await import('leaflet');
|
|
344
|
+
const L = ((mod as { default?: typeof import('leaflet') }).default ??
|
|
345
|
+
mod) as typeof import('leaflet');
|
|
346
|
+
(window as unknown as { L: typeof L }).L = L;
|
|
347
|
+
await import('leaflet.markercluster');
|
|
348
|
+
if (cancelled) return;
|
|
349
|
+
|
|
350
|
+
instance = L.map(el, { zoomControl: false, attributionControl: true }).setView(
|
|
351
|
+
defaultCenter,
|
|
352
|
+
defaultZoom
|
|
353
|
+
);
|
|
354
|
+
L.control.zoom({ position: 'bottomright' }).addTo(instance);
|
|
355
|
+
instance.on('moveend', () => scheduleBounds(instance!));
|
|
356
|
+
leaflet = L;
|
|
357
|
+
map = instance;
|
|
358
|
+
skipNextMove = true;
|
|
359
|
+
requestAnimationFrame(() => {
|
|
360
|
+
instance?.invalidateSize();
|
|
361
|
+
if (instance) emitBounds(instance);
|
|
362
|
+
});
|
|
363
|
+
if (locateOnLoad) void locate();
|
|
364
|
+
})();
|
|
365
|
+
|
|
366
|
+
return () => {
|
|
367
|
+
cancelled = true;
|
|
368
|
+
if (boundsTimer) clearTimeout(boundsTimer);
|
|
369
|
+
instance?.remove();
|
|
370
|
+
map = null;
|
|
371
|
+
leaflet = null;
|
|
372
|
+
tileLayer = null;
|
|
373
|
+
pinGroup = null;
|
|
374
|
+
clusterLayer = null;
|
|
375
|
+
};
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
$effect(() => {
|
|
379
|
+
const instance = map;
|
|
380
|
+
const L = leaflet;
|
|
381
|
+
const url = activeTileUrl;
|
|
382
|
+
if (!instance || !L) return;
|
|
383
|
+
const next = L.tileLayer(url, {
|
|
384
|
+
maxZoom: 19,
|
|
385
|
+
attribution: tileAttribution
|
|
386
|
+
});
|
|
387
|
+
next.addTo(instance);
|
|
388
|
+
tileLayer?.remove();
|
|
389
|
+
tileLayer = next;
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
$effect(() => {
|
|
393
|
+
const instance = map;
|
|
394
|
+
const L = leaflet;
|
|
395
|
+
const pins = mapPins;
|
|
396
|
+
const groups = clusters;
|
|
397
|
+
const currentId = selectedId;
|
|
398
|
+
if (!instance || !L) return;
|
|
399
|
+
|
|
400
|
+
if (pinGroup) {
|
|
401
|
+
instance.removeLayer(pinGroup as never);
|
|
402
|
+
pinGroup = null;
|
|
403
|
+
}
|
|
404
|
+
if (clusterLayer) {
|
|
405
|
+
instance.removeLayer(clusterLayer as never);
|
|
406
|
+
clusterLayer = null;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
const ClusterGroup = (
|
|
410
|
+
L as typeof L & { markerClusterGroup?: (opts: Record<string, unknown>) => unknown }
|
|
411
|
+
).markerClusterGroup;
|
|
412
|
+
if (pins.length && ClusterGroup) {
|
|
413
|
+
const group = ClusterGroup({
|
|
414
|
+
showCoverageOnHover: false,
|
|
415
|
+
maxClusterRadius: 48,
|
|
416
|
+
spiderfyOnMaxZoom: true
|
|
417
|
+
}) as { addLayer: (layer: unknown) => void };
|
|
418
|
+
for (const item of pins) {
|
|
419
|
+
if (!Number.isFinite(item.lat) || !Number.isFinite(item.lng)) continue;
|
|
420
|
+
const icon = L.divIcon({
|
|
421
|
+
className: 'r2-map-pin-wrap',
|
|
422
|
+
html: pinHtml(item, item.id === currentId),
|
|
423
|
+
iconSize: [1, 1],
|
|
424
|
+
iconAnchor: [36, 36]
|
|
425
|
+
});
|
|
426
|
+
const marker = L.marker([item.lat, item.lng], { icon });
|
|
427
|
+
marker.on('click', () => selectItem(item));
|
|
428
|
+
group.addLayer(marker);
|
|
429
|
+
}
|
|
430
|
+
instance.addLayer(group as never);
|
|
431
|
+
pinGroup = group;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
if (groups.length) {
|
|
435
|
+
const layer = L.layerGroup();
|
|
436
|
+
for (const cluster of groups) {
|
|
437
|
+
if (!Number.isFinite(cluster.lat) || !Number.isFinite(cluster.lng)) continue;
|
|
438
|
+
const icon = L.divIcon({
|
|
439
|
+
className: 'r2-map-pin-wrap',
|
|
440
|
+
html: clusterHtml(cluster.count),
|
|
441
|
+
iconSize: [1, 1],
|
|
442
|
+
iconAnchor: [22, 22]
|
|
443
|
+
});
|
|
444
|
+
const marker = L.marker([cluster.lat, cluster.lng], { icon, zIndexOffset: 400 });
|
|
445
|
+
marker.on('click', () => {
|
|
446
|
+
onclusterclick?.(cluster);
|
|
447
|
+
skipNextMove = true;
|
|
448
|
+
instance.setView([cluster.lat, cluster.lng], Math.min(instance.getZoom() + 2, 16));
|
|
449
|
+
instance.once('moveend', () => emitBounds(instance));
|
|
450
|
+
});
|
|
451
|
+
layer.addLayer(marker);
|
|
452
|
+
}
|
|
453
|
+
layer.addTo(instance);
|
|
454
|
+
clusterLayer = layer;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (fitToken && fitToken !== lastFitToken) {
|
|
458
|
+
lastFitToken = fitToken;
|
|
459
|
+
const pts: [number, number][] = [
|
|
460
|
+
...pins.map((p) => [p.lat, p.lng] as [number, number]),
|
|
461
|
+
...groups.map((c) => [c.lat, c.lng] as [number, number])
|
|
462
|
+
].filter(([lat, lng]) => Number.isFinite(lat) && Number.isFinite(lng));
|
|
463
|
+
if (pts.length === 1) {
|
|
464
|
+
skipNextMove = true;
|
|
465
|
+
instance.setView(pts[0], 12);
|
|
466
|
+
} else if (pts.length > 1) {
|
|
467
|
+
skipNextMove = true;
|
|
468
|
+
instance.fitBounds(pts, { padding: [48, 48], maxZoom: 12 });
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
requestAnimationFrame(() => instance.invalidateSize());
|
|
473
|
+
});
|
|
474
|
+
</script>
|
|
475
|
+
|
|
476
|
+
<div
|
|
477
|
+
class={['r2-map-explorer min-h-0 bg-surface flex flex-1 flex-col', className]}
|
|
478
|
+
data-dark={dark ? 'true' : undefined}
|
|
479
|
+
data-tile-invert={invertTiles ? 'true' : undefined}
|
|
480
|
+
>
|
|
481
|
+
<div
|
|
482
|
+
class="border-border bg-surface/95 gap-3 px-4 py-3 backdrop-blur-md lg:flex-row lg:items-center lg:justify-between z-20 flex flex-col border-b"
|
|
483
|
+
>
|
|
484
|
+
<div class="min-w-0">
|
|
485
|
+
<h1 class="text-primary text-lg font-semibold tracking-tight">{title}</h1>
|
|
486
|
+
{#if description}
|
|
487
|
+
<Text size="sm" tone="muted">{description}</Text>
|
|
488
|
+
{/if}
|
|
489
|
+
</div>
|
|
490
|
+
<div class="min-w-0 gap-2 flex flex-1 flex-wrap items-center justify-end">
|
|
491
|
+
<div class="min-w-48 sm:max-w-sm flex-1">
|
|
492
|
+
<SearchInput
|
|
493
|
+
placeholder={searchPlaceholder}
|
|
494
|
+
size="sm"
|
|
495
|
+
bind:value={query}
|
|
496
|
+
onsubmit={applyQuery}
|
|
497
|
+
/>
|
|
498
|
+
</div>
|
|
499
|
+
<Button variant="secondary" size="sm" onclick={() => (filtersOpen = true)} class="relative">
|
|
500
|
+
<Filter class="h-4 w-4" />
|
|
501
|
+
{filtersTitle}
|
|
502
|
+
{#if activeFilterCount}
|
|
503
|
+
<CountBadge count={activeFilterCount} />
|
|
504
|
+
{/if}
|
|
505
|
+
</Button>
|
|
506
|
+
<div class="border-border bg-surface-elevated rounded-lg p-0.5 flex border">
|
|
507
|
+
<IconButton
|
|
508
|
+
label={listViewLabel}
|
|
509
|
+
size="sm"
|
|
510
|
+
variant={listView === 'list' ? 'secondary' : 'ghost'}
|
|
511
|
+
onclick={() => (listView = 'list')}
|
|
512
|
+
>
|
|
513
|
+
<LayoutList class="h-4 w-4" />
|
|
514
|
+
</IconButton>
|
|
515
|
+
<IconButton
|
|
516
|
+
label={gridViewLabel}
|
|
517
|
+
size="sm"
|
|
518
|
+
variant={listView === 'grid' ? 'secondary' : 'ghost'}
|
|
519
|
+
onclick={() => (listView = 'grid')}
|
|
520
|
+
>
|
|
521
|
+
<LayoutGrid class="h-4 w-4" />
|
|
522
|
+
</IconButton>
|
|
523
|
+
</div>
|
|
524
|
+
<Button variant="secondary" size="sm" loading={locating} onclick={() => void locate()}>
|
|
525
|
+
<LocateFixed class="h-4 w-4" />
|
|
526
|
+
<span class="sm:inline hidden">{locateLabel}</span>
|
|
527
|
+
</Button>
|
|
528
|
+
<div class="border-border bg-surface-elevated rounded-lg p-0.5 lg:hidden flex border">
|
|
529
|
+
<IconButton
|
|
530
|
+
label={listLabel}
|
|
531
|
+
size="sm"
|
|
532
|
+
variant={panel === 'list' ? 'secondary' : 'ghost'}
|
|
533
|
+
onclick={() => (panel = 'list')}
|
|
534
|
+
>
|
|
535
|
+
<List class="h-4 w-4" />
|
|
536
|
+
</IconButton>
|
|
537
|
+
<IconButton
|
|
538
|
+
label={mapLabel}
|
|
539
|
+
size="sm"
|
|
540
|
+
variant={panel === 'map' ? 'secondary' : 'ghost'}
|
|
541
|
+
onclick={() => (panel = 'map')}
|
|
542
|
+
>
|
|
543
|
+
<MapIcon class="h-4 w-4" />
|
|
544
|
+
</IconButton>
|
|
545
|
+
</div>
|
|
546
|
+
<Text size="sm" tone="muted" class="sm:block hidden tabular-nums">{resultsText}</Text>
|
|
547
|
+
</div>
|
|
548
|
+
</div>
|
|
549
|
+
|
|
550
|
+
<div class="min-h-0 relative flex flex-1">
|
|
551
|
+
<aside
|
|
552
|
+
class={[
|
|
553
|
+
'border-border bg-surface min-h-0 lg:flex lg:w-[26rem] xl:w-[32rem] w-full shrink-0 flex-col overflow-hidden border-r',
|
|
554
|
+
panel === 'list' ? 'flex' : 'hidden'
|
|
555
|
+
]}
|
|
556
|
+
>
|
|
557
|
+
<div
|
|
558
|
+
bind:this={listEl}
|
|
559
|
+
class={[
|
|
560
|
+
'min-h-0 p-3 flex-1 overflow-y-auto',
|
|
561
|
+
listView === 'grid' ? 'gap-3 sm:grid-cols-2 grid grid-cols-1 content-start' : 'space-y-3'
|
|
562
|
+
]}
|
|
563
|
+
>
|
|
564
|
+
{#if items.length === 0 && !loading}
|
|
565
|
+
<div class="col-span-full">
|
|
566
|
+
<EmptyState title={emptyTitle} description={emptyDescription}>
|
|
567
|
+
{#snippet action()}
|
|
568
|
+
{#if emptyAction}
|
|
569
|
+
{@render emptyAction()}
|
|
570
|
+
{/if}
|
|
571
|
+
{/snippet}
|
|
572
|
+
</EmptyState>
|
|
573
|
+
</div>
|
|
574
|
+
{:else}
|
|
575
|
+
{#each items as item (item.id)}
|
|
576
|
+
<div data-map-item={item.id} class={listView === 'grid' ? 'min-w-0' : undefined}>
|
|
577
|
+
{#if card}
|
|
578
|
+
{@render card(item, {
|
|
579
|
+
select: () => selectItem(item),
|
|
580
|
+
selected: selectedId === item.id,
|
|
581
|
+
layout: listView
|
|
582
|
+
})}
|
|
583
|
+
{:else}
|
|
584
|
+
<Card
|
|
585
|
+
hoverable
|
|
586
|
+
padding="none"
|
|
587
|
+
class={[
|
|
588
|
+
'h-full overflow-hidden',
|
|
589
|
+
selectedId === item.id && 'ring-brand-500 ring-2'
|
|
590
|
+
]}
|
|
591
|
+
onclick={() => selectItem(item)}
|
|
592
|
+
>
|
|
593
|
+
{#if listView === 'grid'}
|
|
594
|
+
{#if item.imageUrl}
|
|
595
|
+
<div class="h-36 w-full overflow-hidden">
|
|
596
|
+
<Image
|
|
597
|
+
src={item.imageUrl}
|
|
598
|
+
alt={item.title}
|
|
599
|
+
class="h-full w-full"
|
|
600
|
+
objectFit="cover"
|
|
601
|
+
/>
|
|
602
|
+
</div>
|
|
603
|
+
{:else}
|
|
604
|
+
<div
|
|
605
|
+
class="bg-brand-500/10 text-brand-700 dark:text-brand-300 h-36 text-2xl font-semibold flex items-center justify-center"
|
|
606
|
+
>
|
|
607
|
+
{item.title.slice(0, 1)}
|
|
608
|
+
</div>
|
|
609
|
+
{/if}
|
|
610
|
+
<div class="space-y-1.5 p-3">
|
|
611
|
+
<div class="gap-1 flex flex-wrap">
|
|
612
|
+
{#if item.badge}
|
|
613
|
+
<Badge size="sm">{item.badge}</Badge>
|
|
614
|
+
{/if}
|
|
615
|
+
{#if item.chip}
|
|
616
|
+
<Badge size="sm" variant="secondary">{item.chip}</Badge>
|
|
617
|
+
{/if}
|
|
618
|
+
</div>
|
|
619
|
+
<p class="text-primary text-sm font-semibold line-clamp-2">{item.title}</p>
|
|
620
|
+
{#if item.subtitle}
|
|
621
|
+
<Text size="xs" tone="muted">{item.subtitle}</Text>
|
|
622
|
+
{/if}
|
|
623
|
+
<div class="gap-2 flex items-center justify-between">
|
|
624
|
+
{#if item.meta}
|
|
625
|
+
<Text size="xs">{item.meta}</Text>
|
|
626
|
+
{/if}
|
|
627
|
+
{#if item.priceLabel}
|
|
628
|
+
<Text size="xs" class="font-medium">{item.priceLabel}</Text>
|
|
629
|
+
{/if}
|
|
630
|
+
</div>
|
|
631
|
+
</div>
|
|
632
|
+
{:else}
|
|
633
|
+
<div class="flex min-h-[7.5rem] flex-1 items-stretch overflow-hidden">
|
|
634
|
+
{#if item.imageUrl}
|
|
635
|
+
<div class="w-28 relative shrink-0 overflow-hidden">
|
|
636
|
+
<Image
|
|
637
|
+
src={item.imageUrl}
|
|
638
|
+
alt={item.title}
|
|
639
|
+
class="inset-0 absolute h-full w-full"
|
|
640
|
+
objectFit="cover"
|
|
641
|
+
/>
|
|
642
|
+
</div>
|
|
643
|
+
{:else}
|
|
644
|
+
<div
|
|
645
|
+
class="bg-brand-500/10 text-brand-700 dark:text-brand-300 w-28 text-xl font-semibold flex shrink-0 items-center justify-center"
|
|
646
|
+
>
|
|
647
|
+
{item.title.slice(0, 1)}
|
|
648
|
+
</div>
|
|
649
|
+
{/if}
|
|
650
|
+
<div class="min-w-0 p-3 flex-1">
|
|
651
|
+
<div class="gap-1 flex flex-wrap">
|
|
652
|
+
{#if item.badge}
|
|
653
|
+
<Badge size="sm">{item.badge}</Badge>
|
|
654
|
+
{/if}
|
|
655
|
+
{#if item.chip}
|
|
656
|
+
<Badge size="sm" variant="secondary">{item.chip}</Badge>
|
|
657
|
+
{/if}
|
|
658
|
+
</div>
|
|
659
|
+
<p class="text-primary mt-1 text-sm font-semibold line-clamp-2">
|
|
660
|
+
{item.title}
|
|
661
|
+
</p>
|
|
662
|
+
{#if item.subtitle}
|
|
663
|
+
<Text size="xs" tone="muted">{item.subtitle}</Text>
|
|
664
|
+
{/if}
|
|
665
|
+
<div class="mt-1 gap-2 flex items-center justify-between">
|
|
666
|
+
{#if item.meta}
|
|
667
|
+
<Text size="xs">{item.meta}</Text>
|
|
668
|
+
{/if}
|
|
669
|
+
{#if item.priceLabel}
|
|
670
|
+
<Text size="xs" class="font-medium">{item.priceLabel}</Text>
|
|
671
|
+
{/if}
|
|
672
|
+
</div>
|
|
673
|
+
</div>
|
|
674
|
+
</div>
|
|
675
|
+
{/if}
|
|
676
|
+
</Card>
|
|
677
|
+
{/if}
|
|
678
|
+
</div>
|
|
679
|
+
{/each}
|
|
680
|
+
{/if}
|
|
681
|
+
</div>
|
|
682
|
+
</aside>
|
|
683
|
+
|
|
684
|
+
<div class={['min-h-0 min-w-0 relative flex-1', panel === 'map' ? 'block' : 'lg:block hidden']}>
|
|
685
|
+
<div
|
|
686
|
+
bind:this={mapEl}
|
|
687
|
+
class="r2-map-explorer-map bg-neutral-100 dark:bg-neutral-950 h-full min-h-[22rem] w-full"
|
|
688
|
+
></div>
|
|
689
|
+
{#if searchAreaVisible && showSearchArea}
|
|
690
|
+
<div class="top-4 right-0 left-0 pointer-events-none absolute z-400 flex justify-center">
|
|
691
|
+
<Button size="sm" class="shadow-lg pointer-events-auto" onclick={searchVisibleArea}>
|
|
692
|
+
{searchAreaLabel}
|
|
693
|
+
</Button>
|
|
694
|
+
</div>
|
|
695
|
+
{/if}
|
|
696
|
+
{#if loading}
|
|
697
|
+
<div
|
|
698
|
+
class="bg-surface/40 top-4 right-4 px-3 py-1 text-xs font-medium backdrop-blur-md pointer-events-none absolute z-400 rounded-full"
|
|
699
|
+
>
|
|
700
|
+
…
|
|
701
|
+
</div>
|
|
702
|
+
{/if}
|
|
703
|
+
</div>
|
|
704
|
+
</div>
|
|
705
|
+
</div>
|
|
706
|
+
|
|
707
|
+
<Drawer
|
|
708
|
+
bind:open={filtersOpen}
|
|
709
|
+
title={filtersTitle}
|
|
710
|
+
description={filtersHint}
|
|
711
|
+
side="right"
|
|
712
|
+
size="sm"
|
|
713
|
+
>
|
|
714
|
+
<div class="gap-4 flex flex-col">
|
|
715
|
+
<SearchInput
|
|
716
|
+
label={searchPlaceholder}
|
|
717
|
+
placeholder={searchPlaceholder}
|
|
718
|
+
bind:value={query}
|
|
719
|
+
onsubmit={applyQuery}
|
|
720
|
+
/>
|
|
721
|
+
{#each filters as filter (filter.id)}
|
|
722
|
+
{#if filter.type === 'chips'}
|
|
723
|
+
<div class="space-y-2">
|
|
724
|
+
<Text size="sm" class="font-medium">{filter.label}</Text>
|
|
725
|
+
<FilterChips
|
|
726
|
+
items={filter.options.map((o) => ({ id: o.value, label: o.label }))}
|
|
727
|
+
value={filter.value ? [filter.value] : []}
|
|
728
|
+
multiple={false}
|
|
729
|
+
onchange={(value) => onfilterchange?.(filter.id, value[0] ?? '')}
|
|
730
|
+
/>
|
|
731
|
+
</div>
|
|
732
|
+
{:else}
|
|
733
|
+
<Select
|
|
734
|
+
label={filter.label}
|
|
735
|
+
placeholder={filter.placeholder ?? filter.label}
|
|
736
|
+
options={filter.options}
|
|
737
|
+
value={filter.value}
|
|
738
|
+
searchable={filter.searchable ?? true}
|
|
739
|
+
onchange={(value) => onfilterchange?.(filter.id, value)}
|
|
740
|
+
/>
|
|
741
|
+
{/if}
|
|
742
|
+
{/each}
|
|
743
|
+
</div>
|
|
744
|
+
{#snippet footer()}
|
|
745
|
+
<Button
|
|
746
|
+
variant="outline"
|
|
747
|
+
fullWidth
|
|
748
|
+
disabled={activeFilterCount === 0 && !query}
|
|
749
|
+
onclick={() => {
|
|
750
|
+
query = '';
|
|
751
|
+
resetView();
|
|
752
|
+
onclearfilters?.();
|
|
753
|
+
}}
|
|
754
|
+
>
|
|
755
|
+
{clearFiltersLabel}
|
|
756
|
+
</Button>
|
|
757
|
+
{/snippet}
|
|
758
|
+
</Drawer>
|
|
759
|
+
|
|
760
|
+
<Drawer
|
|
761
|
+
bind:open={detailOpen}
|
|
762
|
+
title={selected?.title ?? ''}
|
|
763
|
+
description={selected?.subtitle}
|
|
764
|
+
side="right"
|
|
765
|
+
size="lg"
|
|
766
|
+
modal={false}
|
|
767
|
+
closeOnBackdrop={false}
|
|
768
|
+
blurBackdrop={false}
|
|
769
|
+
onclose={closeDetail}
|
|
770
|
+
>
|
|
771
|
+
{#if selected}
|
|
772
|
+
{#if detail}
|
|
773
|
+
{@render detail(selected)}
|
|
774
|
+
{:else}
|
|
775
|
+
<div class="space-y-4">
|
|
776
|
+
{#if selected.imageUrl}
|
|
777
|
+
<Image
|
|
778
|
+
src={selected.imageUrl}
|
|
779
|
+
alt={selected.title}
|
|
780
|
+
aspectRatio="16 / 9"
|
|
781
|
+
objectFit="cover"
|
|
782
|
+
rounded="lg"
|
|
783
|
+
/>
|
|
784
|
+
{/if}
|
|
785
|
+
<div class="gap-1.5 flex flex-wrap">
|
|
786
|
+
{#if selected.badge}
|
|
787
|
+
<Badge>{selected.badge}</Badge>
|
|
788
|
+
{/if}
|
|
789
|
+
{#if selected.chip}
|
|
790
|
+
<Badge variant="secondary">{selected.chip}</Badge>
|
|
791
|
+
{/if}
|
|
792
|
+
</div>
|
|
793
|
+
{#if selected.meta}
|
|
794
|
+
<Text>{selected.meta}</Text>
|
|
795
|
+
{/if}
|
|
796
|
+
{#if selected.priceLabel}
|
|
797
|
+
<p class="text-primary text-2xl font-bold">{selected.priceLabel}</p>
|
|
798
|
+
{/if}
|
|
799
|
+
</div>
|
|
800
|
+
{/if}
|
|
801
|
+
{/if}
|
|
802
|
+
{#snippet footer()}
|
|
803
|
+
{#if selected?.href}
|
|
804
|
+
<Button href={selected.href} fullWidth>{detailCtaLabel}</Button>
|
|
805
|
+
{/if}
|
|
806
|
+
{/snippet}
|
|
807
|
+
</Drawer>
|
|
808
|
+
|
|
809
|
+
<style>
|
|
810
|
+
.r2-map-explorer-map {
|
|
811
|
+
height: 100%;
|
|
812
|
+
min-height: 0;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
:global(.r2-map-explorer-map.leaflet-container) {
|
|
816
|
+
height: 100%;
|
|
817
|
+
font-family: inherit;
|
|
818
|
+
background: transparent;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
:global(.r2-map-explorer[data-tile-invert='true'] .leaflet-container) {
|
|
822
|
+
background: #0a0a0a;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
:global(.r2-map-explorer[data-tile-invert='true'] .leaflet-tile-pane) {
|
|
826
|
+
filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.95);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
:global(.r2-map-explorer[data-dark='true'] .leaflet-control-zoom a) {
|
|
830
|
+
background: var(--color-surface-elevated, #18181b);
|
|
831
|
+
color: var(--color-primary, #e5e5e5);
|
|
832
|
+
border-color: var(--color-border, #27272a);
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
:global(.r2-map-explorer[data-dark='true'] .leaflet-control-attribution) {
|
|
836
|
+
background: rgb(24 24 27 / 0.8);
|
|
837
|
+
color: #a3a3a3;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
:global(.r2-map-pin-wrap) {
|
|
841
|
+
background: transparent;
|
|
842
|
+
border: none;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
:global(.r2-map-pin) {
|
|
846
|
+
display: flex;
|
|
847
|
+
flex-direction: column;
|
|
848
|
+
align-items: center;
|
|
849
|
+
transform: translate(-50%, -100%);
|
|
850
|
+
cursor: pointer;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
:global(.r2-map-pin-label) {
|
|
854
|
+
border-radius: 0.65rem;
|
|
855
|
+
background: var(--color-brand-600, #2563eb);
|
|
856
|
+
color: #fff;
|
|
857
|
+
font-size: 0.75rem;
|
|
858
|
+
font-weight: 700;
|
|
859
|
+
line-height: 1;
|
|
860
|
+
padding: 0.4rem 0.6rem;
|
|
861
|
+
box-shadow: 0 8px 18px rgb(0 0 0 / 0.18);
|
|
862
|
+
white-space: nowrap;
|
|
863
|
+
border: 1px solid rgb(255 255 255 / 0.25);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
:global(.r2-map-pin-tip) {
|
|
867
|
+
width: 0;
|
|
868
|
+
height: 0;
|
|
869
|
+
border-left: 6px solid transparent;
|
|
870
|
+
border-right: 6px solid transparent;
|
|
871
|
+
border-top: 8px solid var(--color-brand-600, #2563eb);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
:global(.r2-map-pin.is-selected .r2-map-pin-label) {
|
|
875
|
+
background: var(--color-neutral-900, #171717);
|
|
876
|
+
transform: scale(1.06);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
:global(.r2-map-explorer[data-dark='true'] .r2-map-pin.is-selected .r2-map-pin-label) {
|
|
880
|
+
background: #fff;
|
|
881
|
+
color: #171717;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
:global(.r2-map-cluster) {
|
|
885
|
+
display: flex;
|
|
886
|
+
align-items: center;
|
|
887
|
+
justify-content: center;
|
|
888
|
+
border-radius: 999px;
|
|
889
|
+
background: rgb(37 99 235 / 0.92);
|
|
890
|
+
color: #fff;
|
|
891
|
+
font-weight: 700;
|
|
892
|
+
box-shadow: 0 8px 20px rgb(37 99 235 / 0.35);
|
|
893
|
+
border: 3px solid rgb(255 255 255 / 0.85);
|
|
894
|
+
transform: translate(-50%, -50%);
|
|
895
|
+
cursor: pointer;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
:global(.r2-map-cluster-sm) {
|
|
899
|
+
width: 2.4rem;
|
|
900
|
+
height: 2.4rem;
|
|
901
|
+
font-size: 0.75rem;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
:global(.r2-map-cluster-md) {
|
|
905
|
+
width: 2.9rem;
|
|
906
|
+
height: 2.9rem;
|
|
907
|
+
font-size: 0.8rem;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
:global(.r2-map-cluster-lg) {
|
|
911
|
+
width: 3.4rem;
|
|
912
|
+
height: 3.4rem;
|
|
913
|
+
font-size: 0.85rem;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
:global(.r2-map-explorer[data-dark='true'] .marker-cluster-small),
|
|
917
|
+
:global(.r2-map-explorer[data-dark='true'] .marker-cluster-medium),
|
|
918
|
+
:global(.r2-map-explorer[data-dark='true'] .marker-cluster-large) {
|
|
919
|
+
background-color: rgb(59 130 246 / 0.35);
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
:global(.r2-map-explorer[data-dark='true'] .marker-cluster-small div),
|
|
923
|
+
:global(.r2-map-explorer[data-dark='true'] .marker-cluster-medium div),
|
|
924
|
+
:global(.r2-map-explorer[data-dark='true'] .marker-cluster-large div) {
|
|
925
|
+
background-color: rgb(37 99 235 / 0.85);
|
|
926
|
+
color: #fff;
|
|
927
|
+
}
|
|
928
|
+
</style>
|