@regardio/react 0.3.3 → 0.4.0
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/background-slideshow.d.ts +7 -5
- package/dist/components/background-slideshow.js +172 -74
- package/dist/components/blurry-gradient.d.ts +11 -4
- package/dist/components/blurry-gradient.js +121 -5
- package/dist/components/box.d.ts +12 -9
- package/dist/components/box.js +48 -23
- package/dist/components/carousel.d.ts +12 -10
- package/dist/components/carousel.js +146 -66
- package/dist/components/countdown.d.ts +5 -2
- package/dist/components/countdown.js +55 -21
- package/dist/components/definition-list.d.ts +19 -16
- package/dist/components/definition-list.js +83 -51
- package/dist/components/generic-error.d.ts +25 -5
- package/dist/components/generic-error.js +42 -34
- package/dist/components/heading.d.ts +13 -10
- package/dist/components/heading.js +114 -25
- package/dist/components/highlight.d.ts +11 -8
- package/dist/components/highlight.js +65 -17
- package/dist/components/icon-button.d.ts +7 -4
- package/dist/components/icon-button.js +16 -5
- package/dist/components/if.d.ts +6 -4
- package/dist/components/if.js +22 -14
- package/dist/components/iframe.d.ts +6 -4
- package/dist/components/iframe.js +26 -3
- package/dist/components/item.d.ts +17 -14
- package/dist/components/item.js +504 -301
- package/dist/components/leaflet-map.d.ts +5 -4
- package/dist/components/leaflet-map.js +192 -186
- package/dist/components/link.d.ts +24 -16
- package/dist/components/link.js +191 -102
- package/dist/components/list-item.d.ts +11 -8
- package/dist/components/list-item.js +35 -17
- package/dist/components/maptiler-map.d.ts +5 -4
- package/dist/components/maptiler-map.js +125 -112
- package/dist/components/markdown-container.d.ts +10 -8
- package/dist/components/markdown-container.js +181 -82
- package/dist/components/password-input.d.ts +7 -5
- package/dist/components/password-input.js +50 -8
- package/dist/components/picture.d.ts +19 -7
- package/dist/components/picture.js +75 -34
- package/dist/components/protected-email.d.ts +14 -3
- package/dist/components/protected-email.js +29 -15
- package/dist/components/text.d.ts +12 -9
- package/dist/components/text.js +42 -24
- package/dist/components/unordered-list.d.ts +11 -8
- package/dist/components/unordered-list.js +37 -19
- package/dist/hooks/use-current-route-data.d.ts +7 -2
- package/dist/hooks/use-current-route-data.js +13 -9
- package/dist/hooks/use-focus-search.d.ts +6 -3
- package/dist/hooks/use-focus-search.js +17 -13
- package/dist/hooks/use-matches-data.d.ts +9 -2
- package/dist/hooks/use-matches-data.js +12 -8
- package/dist/hooks/use-media-query.d.ts +8 -2
- package/dist/hooks/use-media-query.js +19 -15
- package/dist/hooks/use-mobile.d.ts +3 -2
- package/dist/hooks/use-mobile.js +18 -14
- package/dist/hooks/use-nonce.d.ts +12 -5
- package/dist/hooks/use-nonce.js +11 -7
- package/dist/hooks/use-orientation.d.ts +11 -3
- package/dist/hooks/use-orientation.js +28 -24
- package/dist/hooks/use-user.d.ts +43 -8
- package/dist/hooks/use-user.js +21 -13
- package/dist/utils/author.d.ts +4 -4
- package/dist/utils/author.js +49 -31
- package/dist/utils/cn.d.ts +8 -4
- package/dist/utils/cn.js +12 -8
- package/dist/utils/is-route-active.d.ts +19 -3
- package/dist/utils/is-route-active.js +45 -43
- package/dist/utils/locale.d.ts +66 -4
- package/dist/utils/locale.js +33 -22
- package/dist/utils/text.d.ts +24 -7
- package/dist/utils/text.js +114 -89
- package/package.json +4 -3
- package/dist/components/background-slideshow.d.ts.map +0 -1
- package/dist/components/blurry-gradient.d.ts.map +0 -1
- package/dist/components/box.d.ts.map +0 -1
- package/dist/components/carousel.d.ts.map +0 -1
- package/dist/components/countdown.d.ts.map +0 -1
- package/dist/components/definition-list.d.ts.map +0 -1
- package/dist/components/generic-error.d.ts.map +0 -1
- package/dist/components/heading.d.ts.map +0 -1
- package/dist/components/highlight.d.ts.map +0 -1
- package/dist/components/icon-button.d.ts.map +0 -1
- package/dist/components/if.d.ts.map +0 -1
- package/dist/components/iframe.d.ts.map +0 -1
- package/dist/components/item.d.ts.map +0 -1
- package/dist/components/leaflet-map.d.ts.map +0 -1
- package/dist/components/link.d.ts.map +0 -1
- package/dist/components/link.test.d.ts +0 -2
- package/dist/components/link.test.d.ts.map +0 -1
- package/dist/components/link.test.js +0 -204
- package/dist/components/list-item.d.ts.map +0 -1
- package/dist/components/maptiler-map.d.ts.map +0 -1
- package/dist/components/markdown-container.d.ts.map +0 -1
- package/dist/components/password-input.d.ts.map +0 -1
- package/dist/components/picture.d.ts.map +0 -1
- package/dist/components/protected-email.d.ts.map +0 -1
- package/dist/components/text.d.ts.map +0 -1
- package/dist/components/unordered-list.d.ts.map +0 -1
- package/dist/hooks/use-current-route-data.d.ts.map +0 -1
- package/dist/hooks/use-focus-search.d.ts.map +0 -1
- package/dist/hooks/use-matches-data.d.ts.map +0 -1
- package/dist/hooks/use-media-query.d.ts.map +0 -1
- package/dist/hooks/use-mobile.d.ts.map +0 -1
- package/dist/hooks/use-nonce.d.ts.map +0 -1
- package/dist/hooks/use-nonce.test.d.ts +0 -2
- package/dist/hooks/use-nonce.test.d.ts.map +0 -1
- package/dist/hooks/use-nonce.test.js +0 -27
- package/dist/hooks/use-orientation.d.ts.map +0 -1
- package/dist/hooks/use-user.d.ts.map +0 -1
- package/dist/shadcn/accordion.d.ts +0 -25
- package/dist/shadcn/accordion.d.ts.map +0 -1
- package/dist/shadcn/accordion.js +0 -45
- package/dist/shadcn/alert-dialog.d.ts +0 -73
- package/dist/shadcn/alert-dialog.d.ts.map +0 -1
- package/dist/shadcn/alert-dialog.js +0 -93
- package/dist/shadcn/alert.d.ts +0 -34
- package/dist/shadcn/alert.d.ts.map +0 -1
- package/dist/shadcn/alert.js +0 -42
- package/dist/shadcn/aspect-ratio.d.ts +0 -6
- package/dist/shadcn/aspect-ratio.d.ts.map +0 -1
- package/dist/shadcn/aspect-ratio.js +0 -7
- package/dist/shadcn/avatar.d.ts +0 -16
- package/dist/shadcn/avatar.d.ts.map +0 -1
- package/dist/shadcn/avatar.js +0 -27
- package/dist/shadcn/badge.d.ts +0 -29
- package/dist/shadcn/badge.d.ts.map +0 -1
- package/dist/shadcn/badge.js +0 -29
- package/dist/shadcn/breadcrumb.d.ts +0 -42
- package/dist/shadcn/breadcrumb.d.ts.map +0 -1
- package/dist/shadcn/breadcrumb.js +0 -74
- package/dist/shadcn/button.d.ts +0 -38
- package/dist/shadcn/button.d.ts.map +0 -1
- package/dist/shadcn/button.js +0 -38
- package/dist/shadcn/calendar.d.ts +0 -23
- package/dist/shadcn/calendar.d.ts.map +0 -1
- package/dist/shadcn/calendar.js +0 -163
- package/dist/shadcn/card.d.ts +0 -31
- package/dist/shadcn/card.d.ts.map +0 -1
- package/dist/shadcn/card.js +0 -55
- package/dist/shadcn/carousel.d.ts +0 -51
- package/dist/shadcn/carousel.d.ts.map +0 -1
- package/dist/shadcn/carousel.js +0 -161
- package/dist/shadcn/chart.d.ts +0 -103
- package/dist/shadcn/chart.d.ts.map +0 -1
- package/dist/shadcn/chart.js +0 -248
- package/dist/shadcn/checkbox.d.ts +0 -8
- package/dist/shadcn/checkbox.d.ts.map +0 -1
- package/dist/shadcn/checkbox.js +0 -22
- package/dist/shadcn/collapsible.d.ts +0 -16
- package/dist/shadcn/collapsible.d.ts.map +0 -1
- package/dist/shadcn/collapsible.js +0 -19
- package/dist/shadcn/command.d.ts +0 -61
- package/dist/shadcn/command.d.ts.map +0 -1
- package/dist/shadcn/command.js +0 -123
- package/dist/shadcn/context-menu.d.ts +0 -107
- package/dist/shadcn/context-menu.d.ts.map +0 -1
- package/dist/shadcn/context-menu.js +0 -151
- package/dist/shadcn/dialog.d.ts +0 -57
- package/dist/shadcn/dialog.d.ts.map +0 -1
- package/dist/shadcn/dialog.js +0 -96
- package/dist/shadcn/drawer.d.ts +0 -54
- package/dist/shadcn/drawer.d.ts.map +0 -1
- package/dist/shadcn/drawer.js +0 -96
- package/dist/shadcn/dropdown-menu.d.ts +0 -110
- package/dist/shadcn/dropdown-menu.d.ts.map +0 -1
- package/dist/shadcn/dropdown-menu.js +0 -152
- package/dist/shadcn/form.d.ts +0 -59
- package/dist/shadcn/form.d.ts.map +0 -1
- package/dist/shadcn/form.js +0 -99
- package/dist/shadcn/hover-card.d.ts +0 -20
- package/dist/shadcn/hover-card.d.ts.map +0 -1
- package/dist/shadcn/hover-card.js +0 -26
- package/dist/shadcn/input-otp.d.ts +0 -25
- package/dist/shadcn/input-otp.d.ts.map +0 -1
- package/dist/shadcn/input-otp.js +0 -54
- package/dist/shadcn/input.d.ts +0 -14
- package/dist/shadcn/input.d.ts.map +0 -1
- package/dist/shadcn/input.js +0 -48
- package/dist/shadcn/label.d.ts +0 -8
- package/dist/shadcn/label.d.ts.map +0 -1
- package/dist/shadcn/label.js +0 -16
- package/dist/shadcn/menubar.d.ts +0 -108
- package/dist/shadcn/menubar.d.ts.map +0 -1
- package/dist/shadcn/menubar.js +0 -174
- package/dist/shadcn/navigation-menu.d.ts +0 -79
- package/dist/shadcn/navigation-menu.d.ts.map +0 -1
- package/dist/shadcn/navigation-menu.js +0 -108
- package/dist/shadcn/pagination.d.ts +0 -45
- package/dist/shadcn/pagination.d.ts.map +0 -1
- package/dist/shadcn/pagination.js +0 -83
- package/dist/shadcn/popover.d.ts +0 -19
- package/dist/shadcn/popover.d.ts.map +0 -1
- package/dist/shadcn/popover.js +0 -29
- package/dist/shadcn/progress.d.ts +0 -9
- package/dist/shadcn/progress.d.ts.map +0 -1
- package/dist/shadcn/progress.js +0 -17
- package/dist/shadcn/radio-group.d.ts +0 -12
- package/dist/shadcn/radio-group.d.ts.map +0 -1
- package/dist/shadcn/radio-group.js +0 -32
- package/dist/shadcn/resizable.d.ts +0 -20
- package/dist/shadcn/resizable.d.ts.map +0 -1
- package/dist/shadcn/resizable.js +0 -32
- package/dist/shadcn/scroll-area.d.ts +0 -16
- package/dist/shadcn/scroll-area.d.ts.map +0 -1
- package/dist/shadcn/scroll-area.js +0 -40
- package/dist/shadcn/select.d.ts +0 -63
- package/dist/shadcn/select.d.ts.map +0 -1
- package/dist/shadcn/select.js +0 -120
- package/dist/shadcn/separator.d.ts +0 -10
- package/dist/shadcn/separator.d.ts.map +0 -1
- package/dist/shadcn/separator.js +0 -18
- package/dist/shadcn/sheet.d.ts +0 -48
- package/dist/shadcn/sheet.d.ts.map +0 -1
- package/dist/shadcn/sheet.js +0 -99
- package/dist/shadcn/sidebar.d.ts +0 -200
- package/dist/shadcn/sidebar.d.ts.map +0 -1
- package/dist/shadcn/sidebar.js +0 -528
- package/dist/shadcn/skeleton.d.ts +0 -6
- package/dist/shadcn/skeleton.d.ts.map +0 -1
- package/dist/shadcn/skeleton.js +0 -11
- package/dist/shadcn/slider.d.ts +0 -12
- package/dist/shadcn/slider.d.ts.map +0 -1
- package/dist/shadcn/slider.js +0 -50
- package/dist/shadcn/sonner.d.ts +0 -7
- package/dist/shadcn/sonner.d.ts.map +0 -1
- package/dist/shadcn/sonner.js +0 -20
- package/dist/shadcn/switch.d.ts +0 -8
- package/dist/shadcn/switch.d.ts.map +0 -1
- package/dist/shadcn/switch.js +0 -22
- package/dist/shadcn/table.d.ts +0 -35
- package/dist/shadcn/table.d.ts.map +0 -1
- package/dist/shadcn/table.js +0 -73
- package/dist/shadcn/tabs.d.ts +0 -20
- package/dist/shadcn/tabs.d.ts.map +0 -1
- package/dist/shadcn/tabs.js +0 -40
- package/dist/shadcn/textarea.d.ts +0 -7
- package/dist/shadcn/textarea.d.ts.map +0 -1
- package/dist/shadcn/textarea.js +0 -14
- package/dist/shadcn/toggle-group.d.ts +0 -22
- package/dist/shadcn/toggle-group.d.ts.map +0 -1
- package/dist/shadcn/toggle-group.js +0 -43
- package/dist/shadcn/toggle.d.ts +0 -29
- package/dist/shadcn/toggle.d.ts.map +0 -1
- package/dist/shadcn/toggle.js +0 -31
- package/dist/shadcn/tooltip.d.ts +0 -20
- package/dist/shadcn/tooltip.d.ts.map +0 -1
- package/dist/shadcn/tooltip.js +0 -40
- package/dist/stories/BackgroundSlideshow.stories.d.ts +0 -9
- package/dist/stories/BackgroundSlideshow.stories.d.ts.map +0 -1
- package/dist/stories/BackgroundSlideshow.stories.js +0 -60
- package/dist/stories/BlurryGradient.stories.d.ts +0 -11
- package/dist/stories/BlurryGradient.stories.d.ts.map +0 -1
- package/dist/stories/BlurryGradient.stories.js +0 -53
- package/dist/stories/Box.stories.d.ts +0 -13
- package/dist/stories/Box.stories.d.ts.map +0 -1
- package/dist/stories/Box.stories.js +0 -50
- package/dist/stories/Carousel.stories.d.ts +0 -9
- package/dist/stories/Carousel.stories.d.ts.map +0 -1
- package/dist/stories/Carousel.stories.js +0 -30
- package/dist/stories/Countdown.stories.d.ts +0 -7
- package/dist/stories/Countdown.stories.d.ts.map +0 -1
- package/dist/stories/Countdown.stories.js +0 -11
- package/dist/stories/DefinitionList.stories.d.ts +0 -9
- package/dist/stories/DefinitionList.stories.d.ts.map +0 -1
- package/dist/stories/DefinitionList.stories.js +0 -20
- package/dist/stories/GenericError.stories.d.ts +0 -9
- package/dist/stories/GenericError.stories.d.ts.map +0 -1
- package/dist/stories/GenericError.stories.js +0 -39
- package/dist/stories/Heading.stories.d.ts +0 -15
- package/dist/stories/Heading.stories.d.ts.map +0 -1
- package/dist/stories/Heading.stories.js +0 -61
- package/dist/stories/Highlight.stories.d.ts +0 -8
- package/dist/stories/Highlight.stories.d.ts.map +0 -1
- package/dist/stories/Highlight.stories.js +0 -19
- package/dist/stories/IconButton.stories.d.ts +0 -10
- package/dist/stories/IconButton.stories.d.ts.map +0 -1
- package/dist/stories/IconButton.stories.js +0 -32
- package/dist/stories/If.stories.d.ts +0 -13
- package/dist/stories/If.stories.d.ts.map +0 -1
- package/dist/stories/If.stories.js +0 -54
- package/dist/stories/Iframe.stories.d.ts +0 -8
- package/dist/stories/Iframe.stories.d.ts.map +0 -1
- package/dist/stories/Iframe.stories.js +0 -23
- package/dist/stories/Item.stories.d.ts +0 -10
- package/dist/stories/Item.stories.d.ts.map +0 -1
- package/dist/stories/Item.stories.js +0 -32
- package/dist/stories/Link.stories.d.ts +0 -10
- package/dist/stories/Link.stories.d.ts.map +0 -1
- package/dist/stories/Link.stories.js +0 -36
- package/dist/stories/ListItem.stories.d.ts +0 -9
- package/dist/stories/ListItem.stories.d.ts.map +0 -1
- package/dist/stories/ListItem.stories.js +0 -26
- package/dist/stories/MarkdownContainer.stories.d.ts +0 -11
- package/dist/stories/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/stories/MarkdownContainer.stories.js +0 -66
- package/dist/stories/PasswordInput.stories.d.ts +0 -9
- package/dist/stories/PasswordInput.stories.d.ts.map +0 -1
- package/dist/stories/PasswordInput.stories.js +0 -27
- package/dist/stories/Picture.stories.d.ts +0 -10
- package/dist/stories/Picture.stories.d.ts.map +0 -1
- package/dist/stories/Picture.stories.js +0 -46
- package/dist/stories/ProtectedEmail.stories.d.ts +0 -10
- package/dist/stories/ProtectedEmail.stories.d.ts.map +0 -1
- package/dist/stories/ProtectedEmail.stories.js +0 -34
- package/dist/stories/Text.stories.d.ts +0 -10
- package/dist/stories/Text.stories.d.ts.map +0 -1
- package/dist/stories/Text.stories.js +0 -31
- package/dist/stories/UnorderedList.stories.d.ts +0 -10
- package/dist/stories/UnorderedList.stories.d.ts.map +0 -1
- package/dist/stories/UnorderedList.stories.js +0 -24
- package/dist/test-setup.d.ts +0 -2
- package/dist/test-setup.d.ts.map +0 -1
- package/dist/test-setup.js +0 -1
- package/dist/utils/author.d.ts.map +0 -1
- package/dist/utils/author.test.d.ts +0 -2
- package/dist/utils/author.test.d.ts.map +0 -1
- package/dist/utils/author.test.js +0 -46
- package/dist/utils/cn.d.ts.map +0 -1
- package/dist/utils/cn.test.d.ts +0 -2
- package/dist/utils/cn.test.d.ts.map +0 -1
- package/dist/utils/cn.test.js +0 -33
- package/dist/utils/is-route-active.d.ts.map +0 -1
- package/dist/utils/is-route-active.test.d.ts +0 -2
- package/dist/utils/is-route-active.test.d.ts.map +0 -1
- package/dist/utils/is-route-active.test.js +0 -61
- package/dist/utils/locale.d.ts.map +0 -1
- package/dist/utils/locale.test.d.ts +0 -2
- package/dist/utils/locale.test.d.ts.map +0 -1
- package/dist/utils/locale.test.js +0 -99
- package/dist/utils/text.d.ts.map +0 -1
- package/dist/utils/text.test.d.ts +0 -2
- package/dist/utils/text.test.d.ts.map +0 -1
- package/dist/utils/text.test.js +0 -122
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
2
3
|
interface MapMarker {
|
|
3
4
|
lat: number;
|
|
4
5
|
lng: number;
|
|
@@ -28,6 +29,6 @@ interface LeafletMapProps {
|
|
|
28
29
|
attribution?: string;
|
|
29
30
|
showPopupsOnHover?: boolean;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
declare const LeafletMap: ({ markers, mapUrl, center, zoom, icon, attribution, showPopupsOnHover, }: LeafletMapProps) => react_jsx_runtime.JSX.Element;
|
|
33
|
+
|
|
34
|
+
export { LeafletMap, LeafletMap as default };
|
|
@@ -1,195 +1,201 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import 'leaflet/dist/leaflet.css';
|
|
3
2
|
import L from 'leaflet';
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { useRef, useEffect } from 'react';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/components/leaflet-map.tsx
|
|
7
|
+
var LeafletMap = ({
|
|
8
|
+
markers,
|
|
9
|
+
mapUrl,
|
|
10
|
+
center,
|
|
11
|
+
zoom = 12,
|
|
12
|
+
icon = {
|
|
6
13
|
iconAnchor: [12, 41],
|
|
7
14
|
iconSize: [25, 41],
|
|
8
|
-
iconUrl:
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
catch (_error) {
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
mapRef.current.remove();
|
|
42
|
-
}
|
|
43
|
-
catch (_error) {
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const container = mapContainerRef.current;
|
|
47
|
-
if (container) {
|
|
48
|
-
container.innerHTML = '';
|
|
49
|
-
const leafletContainer = container;
|
|
50
|
-
if (leafletContainer._leaflet_id) {
|
|
51
|
-
delete leafletContainer._leaflet_id;
|
|
52
|
-
}
|
|
53
|
-
container.setAttribute('data-map-initialized', 'false');
|
|
54
|
-
}
|
|
55
|
-
const map = new L.Map(mapContainerRef.current, {
|
|
56
|
-
center: calculatedCenter,
|
|
57
|
-
scrollWheelZoom: false,
|
|
58
|
-
tapTolerance: 100,
|
|
59
|
-
zoom: zoom,
|
|
60
|
-
});
|
|
61
|
-
new L.TileLayer(mapUrl, {
|
|
62
|
-
attribution,
|
|
63
|
-
}).addTo(map);
|
|
64
|
-
const customIcon = new L.Icon({
|
|
65
|
-
iconAnchor: icon.iconAnchor,
|
|
66
|
-
iconSize: icon.iconSize,
|
|
67
|
-
iconUrl: icon.iconUrl,
|
|
68
|
-
});
|
|
69
|
-
const newMarkers = [];
|
|
70
|
-
markers.forEach((marker) => {
|
|
71
|
-
const markerLatLng = [marker.lat, marker.lng];
|
|
72
|
-
const leafletMarker = new L.Marker(markerLatLng, {
|
|
73
|
-
icon: customIcon,
|
|
74
|
-
}).addTo(map);
|
|
75
|
-
const offset = marker.offset || { x: 0, y: 0 };
|
|
76
|
-
let popupContent = '';
|
|
77
|
-
if (marker.htmlContent) {
|
|
78
|
-
popupContent = marker.htmlContent;
|
|
79
|
-
}
|
|
80
|
-
else if (marker.content) {
|
|
81
|
-
popupContent = marker.content;
|
|
82
|
-
}
|
|
83
|
-
if (marker.imageUrl) {
|
|
84
|
-
const imageHtml = `<img src="${marker.imageUrl}" alt="${marker.imageAlt || ''}" style="max-width: 100%; height: auto; display: block; margin-bottom: 8px;" />`;
|
|
85
|
-
popupContent = imageHtml + popupContent;
|
|
86
|
-
}
|
|
87
|
-
if (popupContent) {
|
|
88
|
-
const popup = new L.Popup({
|
|
89
|
-
className: 'custom-map-popup',
|
|
90
|
-
closeButton: false,
|
|
91
|
-
offset: [offset.x, offset.y],
|
|
92
|
-
}).setContent(popupContent);
|
|
93
|
-
leafletMarker.bindPopup(popup);
|
|
94
|
-
if (showPopupsOnHover) {
|
|
95
|
-
leafletMarker.on('mouseover', () => {
|
|
96
|
-
leafletMarker.openPopup();
|
|
97
|
-
});
|
|
98
|
-
leafletMarker.on('mouseout', () => {
|
|
99
|
-
leafletMarker.closePopup();
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
newMarkers.push(leafletMarker);
|
|
15
|
+
iconUrl: "/marker-icon-2x.png"
|
|
16
|
+
},
|
|
17
|
+
attribution = "",
|
|
18
|
+
showPopupsOnHover = false
|
|
19
|
+
}) => {
|
|
20
|
+
const mapContainerRef = useRef(null);
|
|
21
|
+
const mapRef = useRef(null);
|
|
22
|
+
const markersRef = useRef([]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!mapContainerRef.current || typeof window === "undefined") return;
|
|
25
|
+
let calculatedCenter;
|
|
26
|
+
if (center) {
|
|
27
|
+
calculatedCenter = [center.lat, center.lng];
|
|
28
|
+
} else if (markers.length > 0) {
|
|
29
|
+
const firstMarker = markers[0];
|
|
30
|
+
if (firstMarker) {
|
|
31
|
+
calculatedCenter = [firstMarker.lat, firstMarker.lng];
|
|
32
|
+
} else {
|
|
33
|
+
calculatedCenter = [52.520008, 13.404954];
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
calculatedCenter = [52.520008, 13.404954];
|
|
37
|
+
}
|
|
38
|
+
if (mapRef.current) {
|
|
39
|
+
try {
|
|
40
|
+
markersRef.current.forEach((marker) => {
|
|
41
|
+
try {
|
|
42
|
+
mapRef.current?.removeLayer(marker);
|
|
43
|
+
} catch (_error) {
|
|
44
|
+
}
|
|
104
45
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
46
|
+
mapRef.current.remove();
|
|
47
|
+
} catch (_error) {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const container = mapContainerRef.current;
|
|
51
|
+
if (container) {
|
|
52
|
+
container.innerHTML = "";
|
|
53
|
+
const leafletContainer = container;
|
|
54
|
+
if (leafletContainer._leaflet_id) {
|
|
55
|
+
delete leafletContainer._leaflet_id;
|
|
56
|
+
}
|
|
57
|
+
container.setAttribute("data-map-initialized", "false");
|
|
58
|
+
}
|
|
59
|
+
const map = new L.Map(mapContainerRef.current, {
|
|
60
|
+
center: calculatedCenter,
|
|
61
|
+
scrollWheelZoom: false,
|
|
62
|
+
tapTolerance: 100,
|
|
63
|
+
zoom
|
|
64
|
+
});
|
|
65
|
+
new L.TileLayer(mapUrl, {
|
|
66
|
+
attribution
|
|
67
|
+
}).addTo(map);
|
|
68
|
+
const customIcon = new L.Icon({
|
|
69
|
+
iconAnchor: icon.iconAnchor,
|
|
70
|
+
iconSize: icon.iconSize,
|
|
71
|
+
iconUrl: icon.iconUrl
|
|
72
|
+
});
|
|
73
|
+
const newMarkers = [];
|
|
74
|
+
markers.forEach((marker) => {
|
|
75
|
+
const markerLatLng = [marker.lat, marker.lng];
|
|
76
|
+
const leafletMarker = new L.Marker(markerLatLng, {
|
|
77
|
+
icon: customIcon
|
|
78
|
+
}).addTo(map);
|
|
79
|
+
const offset = marker.offset || { x: 0, y: 0 };
|
|
80
|
+
let popupContent = "";
|
|
81
|
+
if (marker.htmlContent) {
|
|
82
|
+
popupContent = marker.htmlContent;
|
|
83
|
+
} else if (marker.content) {
|
|
84
|
+
popupContent = marker.content;
|
|
85
|
+
}
|
|
86
|
+
if (marker.imageUrl) {
|
|
87
|
+
const imageHtml = `<img src="${marker.imageUrl}" alt="${marker.imageAlt || ""}" style="max-width: 100%; height: auto; display: block; margin-bottom: 8px;" />`;
|
|
88
|
+
popupContent = imageHtml + popupContent;
|
|
89
|
+
}
|
|
90
|
+
if (popupContent) {
|
|
91
|
+
const popup = new L.Popup({
|
|
92
|
+
className: "custom-map-popup",
|
|
93
|
+
closeButton: false,
|
|
94
|
+
offset: [offset.x, offset.y]
|
|
95
|
+
}).setContent(popupContent);
|
|
96
|
+
leafletMarker.bindPopup(popup);
|
|
97
|
+
if (showPopupsOnHover) {
|
|
98
|
+
leafletMarker.on("mouseover", () => {
|
|
99
|
+
leafletMarker.openPopup();
|
|
100
|
+
});
|
|
101
|
+
leafletMarker.on("mouseout", () => {
|
|
102
|
+
leafletMarker.closePopup();
|
|
103
|
+
});
|
|
109
104
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (mapContainerRef.current) {
|
|
124
|
-
mapContainerRef.current.innerHTML = '';
|
|
125
|
-
mapContainerRef.current.removeAttribute('data-map-initialized');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
catch (_error) {
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
markersRef.current = [];
|
|
132
|
-
};
|
|
133
|
-
}, [markers, mapUrl, zoom, icon, attribution, center, showPopupsOnHover]);
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
const map = mapRef.current;
|
|
136
|
-
if (!map || typeof window === 'undefined')
|
|
137
|
-
return;
|
|
138
|
-
markersRef.current.forEach((marker) => {
|
|
105
|
+
}
|
|
106
|
+
newMarkers.push(leafletMarker);
|
|
107
|
+
});
|
|
108
|
+
markersRef.current = newMarkers;
|
|
109
|
+
if (markers.length > 0) {
|
|
110
|
+
const bounds = new L.LatLngBounds(markers.map((m) => new L.LatLng(m.lat, m.lng)));
|
|
111
|
+
map.fitBounds(bounds, { padding: [20, 20] });
|
|
112
|
+
}
|
|
113
|
+
mapRef.current = map;
|
|
114
|
+
return () => {
|
|
115
|
+
if (mapRef.current) {
|
|
116
|
+
try {
|
|
117
|
+
markersRef.current.forEach((marker) => {
|
|
139
118
|
try {
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
119
|
+
mapRef.current?.removeLayer(marker);
|
|
120
|
+
} catch (_error) {
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
mapRef.current.remove();
|
|
124
|
+
mapRef.current = null;
|
|
125
|
+
if (mapContainerRef.current) {
|
|
126
|
+
mapContainerRef.current.innerHTML = "";
|
|
127
|
+
mapContainerRef.current.removeAttribute("data-map-initialized");
|
|
128
|
+
}
|
|
129
|
+
} catch (_error) {
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
markersRef.current = [];
|
|
133
|
+
};
|
|
134
|
+
}, [markers, mapUrl, zoom, icon, attribution, center, showPopupsOnHover]);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
const map = mapRef.current;
|
|
137
|
+
if (!map || typeof window === "undefined") return;
|
|
138
|
+
markersRef.current.forEach((marker) => {
|
|
139
|
+
try {
|
|
140
|
+
map.removeLayer(marker);
|
|
141
|
+
} catch (_error) {
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
markersRef.current = [];
|
|
145
|
+
const customIcon = new L.Icon({
|
|
146
|
+
iconAnchor: icon.iconAnchor,
|
|
147
|
+
iconSize: icon.iconSize,
|
|
148
|
+
iconUrl: icon.iconUrl
|
|
149
|
+
});
|
|
150
|
+
const newMarkers = [];
|
|
151
|
+
markers.forEach((marker) => {
|
|
152
|
+
const markerLatLng = [marker.lat, marker.lng];
|
|
153
|
+
const leafletMarker = new L.Marker(markerLatLng, {
|
|
154
|
+
icon: customIcon
|
|
155
|
+
}).addTo(map);
|
|
156
|
+
const offset = marker.offset || { x: 0, y: 0 };
|
|
157
|
+
let popupContent = "";
|
|
158
|
+
if (marker.htmlContent) {
|
|
159
|
+
popupContent = marker.htmlContent;
|
|
160
|
+
} else if (marker.content) {
|
|
161
|
+
popupContent = marker.content;
|
|
162
|
+
}
|
|
163
|
+
if (marker.imageUrl) {
|
|
164
|
+
const imageHtml = `<img src="${marker.imageUrl}" alt="${marker.imageAlt || ""}" style="max-width: 100%; height: auto; display: block; margin-bottom: 8px;" />`;
|
|
165
|
+
popupContent = imageHtml + popupContent;
|
|
166
|
+
}
|
|
167
|
+
if (popupContent) {
|
|
168
|
+
const popup = new L.Popup({
|
|
169
|
+
className: "custom-map-popup",
|
|
170
|
+
closeButton: false,
|
|
171
|
+
offset: [offset.x, offset.y]
|
|
172
|
+
}).setContent(popupContent);
|
|
173
|
+
leafletMarker.bindPopup(popup);
|
|
174
|
+
if (showPopupsOnHover) {
|
|
175
|
+
leafletMarker.on("mouseover", () => {
|
|
176
|
+
leafletMarker.openPopup();
|
|
177
|
+
});
|
|
178
|
+
leafletMarker.on("mouseout", () => {
|
|
179
|
+
leafletMarker.closePopup();
|
|
180
|
+
});
|
|
191
181
|
}
|
|
192
|
-
|
|
193
|
-
|
|
182
|
+
}
|
|
183
|
+
newMarkers.push(leafletMarker);
|
|
184
|
+
});
|
|
185
|
+
markersRef.current = newMarkers;
|
|
186
|
+
if (markers.length > 0) {
|
|
187
|
+
const bounds = new L.LatLngBounds(markers.map((m) => new L.LatLng(m.lat, m.lng)));
|
|
188
|
+
map.fitBounds(bounds, { padding: [20, 20] });
|
|
189
|
+
}
|
|
190
|
+
}, [markers, icon, showPopupsOnHover]);
|
|
191
|
+
return /* @__PURE__ */ jsx(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
className: "h-full w-full",
|
|
195
|
+
ref: mapContainerRef
|
|
196
|
+
}
|
|
197
|
+
);
|
|
194
198
|
};
|
|
195
|
-
|
|
199
|
+
var leaflet_map_default = LeafletMap;
|
|
200
|
+
|
|
201
|
+
export { LeafletMap, leaflet_map_default as default };
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import * as cva from 'cva';
|
|
2
|
+
import { VariantProps } from 'cva';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import { NavLinkProps } from 'react-router';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Context for providing a path resolver function.
|
|
9
|
+
* This allows projects to inject their own localization logic.
|
|
10
|
+
*/
|
|
11
|
+
type PathResolver = (routeKey: string) => string;
|
|
12
|
+
declare const PathResolverProvider: react.Provider<PathResolver | null>;
|
|
13
|
+
declare function usePathResolver(): PathResolver | null;
|
|
14
|
+
interface LinkBaseProps extends Omit<NavLinkProps, 'to'> {
|
|
7
15
|
to?: string | Partial<{
|
|
8
16
|
pathname?: string;
|
|
9
17
|
search?: string;
|
|
@@ -12,18 +20,18 @@ export interface LinkBaseProps extends Omit<NavLinkProps, 'to'> {
|
|
|
12
20
|
routeKey?: string;
|
|
13
21
|
viewTransition?: boolean;
|
|
14
22
|
}
|
|
15
|
-
|
|
23
|
+
declare const LinkBase: ({ className, to, routeKey, children, onClick, viewTransition, ...props }: LinkBaseProps) => react_jsx_runtime.JSX.Element;
|
|
16
24
|
declare const link: (props?: ({
|
|
17
25
|
arrow?: "darr" | "larr" | "rarr" | "uarr" | undefined;
|
|
18
|
-
variant?: "
|
|
26
|
+
variant?: "link" | "button" | "primary" | "code" | "navtitle" | "subtitle" | undefined;
|
|
19
27
|
} & ({
|
|
20
|
-
class?:
|
|
28
|
+
class?: cva.ClassValue;
|
|
21
29
|
className?: never;
|
|
22
30
|
} | {
|
|
23
31
|
class?: never;
|
|
24
|
-
className?:
|
|
32
|
+
className?: cva.ClassValue;
|
|
25
33
|
})) | undefined) => string;
|
|
26
|
-
|
|
34
|
+
interface LinkProps extends Omit<NavLinkProps, 'to'>, VariantProps<typeof link> {
|
|
27
35
|
to?: string | Partial<{
|
|
28
36
|
pathname?: string;
|
|
29
37
|
search?: string;
|
|
@@ -32,10 +40,10 @@ export interface LinkProps extends Omit<NavLinkProps, 'to'>, VariantProps<typeof
|
|
|
32
40
|
routeKey?: string;
|
|
33
41
|
viewTransition?: boolean;
|
|
34
42
|
}
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
declare const Link: ({ arrow, children, className, routeKey, to, variant, viewTransition, ...props }: LinkProps) => react_jsx_runtime.JSX.Element;
|
|
44
|
+
interface MarkdownLinkProps extends Omit<LinkProps, 'to'> {
|
|
37
45
|
href?: string;
|
|
38
46
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
declare const MarkdownLink: React.FC<MarkdownLinkProps>;
|
|
48
|
+
|
|
49
|
+
export { Link, LinkBase, type LinkBaseProps, type LinkProps, MarkdownLink, type MarkdownLinkProps, type PathResolver, PathResolverProvider, usePathResolver };
|