@r2digisolutions/components 0.24.6 → 0.24.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/atoms/Avatar/Avatar.svelte +8 -3
- package/dist/components/molecules/LocationMap/LocationMap.svelte +175 -0
- package/dist/components/molecules/LocationMap/LocationMap.svelte.d.ts +13 -0
- package/dist/components/molecules/Tabs/Tabs.svelte +1 -1
- package/dist/components/organisms/AuthShell/AuthShell.svelte +14 -10
- package/dist/components/organisms/Footer/Footer.svelte +16 -17
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +4 -4
|
@@ -79,12 +79,17 @@
|
|
|
79
79
|
const showImage = $derived(!!src && !imgError);
|
|
80
80
|
</script>
|
|
81
81
|
|
|
82
|
-
<span
|
|
82
|
+
<span
|
|
83
|
+
class={[
|
|
84
|
+
'relative inline-flex aspect-square shrink-0 overflow-hidden rounded-full',
|
|
85
|
+
sizeClasses[size],
|
|
86
|
+
className
|
|
87
|
+
]}
|
|
88
|
+
>
|
|
83
89
|
<span
|
|
84
90
|
class={[
|
|
85
|
-
'inline-flex
|
|
91
|
+
'inline-flex h-full w-full items-center justify-center rounded-full',
|
|
86
92
|
ringed && 'ring-2 ring-surface-elevated',
|
|
87
|
-
sizeClasses[size],
|
|
88
93
|
!showImage && [bgColor, 'text-white font-semibold']
|
|
89
94
|
]}
|
|
90
95
|
role={alt ? 'img' : undefined}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Map as LeafletMap, Marker } from 'leaflet';
|
|
3
|
+
import { untrack } from 'svelte';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
lat,
|
|
7
|
+
lng,
|
|
8
|
+
label = '',
|
|
9
|
+
zoom = 14,
|
|
10
|
+
href,
|
|
11
|
+
linkLabel = 'OpenStreetMap',
|
|
12
|
+
class: className = '',
|
|
13
|
+
heightClass = 'h-56 sm:h-64'
|
|
14
|
+
}: {
|
|
15
|
+
lat: number;
|
|
16
|
+
lng: number;
|
|
17
|
+
label?: string;
|
|
18
|
+
zoom?: number;
|
|
19
|
+
href?: string;
|
|
20
|
+
linkLabel?: string;
|
|
21
|
+
class?: string;
|
|
22
|
+
heightClass?: string;
|
|
23
|
+
} = $props();
|
|
24
|
+
|
|
25
|
+
let mapEl: HTMLDivElement | undefined = $state();
|
|
26
|
+
let mapReady = $state(false);
|
|
27
|
+
let dark = $state(false);
|
|
28
|
+
|
|
29
|
+
/** Leaflet handles are non-reactive; sync via mapReady + props. */
|
|
30
|
+
let map: LeafletMap | null = null;
|
|
31
|
+
let marker: Marker | null = null;
|
|
32
|
+
let leaflet: typeof import('leaflet') | null = null;
|
|
33
|
+
|
|
34
|
+
const OSM_TILES = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
|
|
35
|
+
const invertTiles = $derived(dark);
|
|
36
|
+
|
|
37
|
+
$effect(() => {
|
|
38
|
+
if (typeof document === 'undefined') return;
|
|
39
|
+
const root = document.documentElement;
|
|
40
|
+
const sync = () => {
|
|
41
|
+
dark = root.classList.contains('dark');
|
|
42
|
+
};
|
|
43
|
+
sync();
|
|
44
|
+
const observer = new MutationObserver(sync);
|
|
45
|
+
observer.observe(root, { attributes: true, attributeFilter: ['class'] });
|
|
46
|
+
return () => observer.disconnect();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
function syncView(m: LeafletMap, nextLat: number, nextLng: number, nextZoom: number) {
|
|
50
|
+
const latLng: [number, number] = [nextLat, nextLng];
|
|
51
|
+
marker?.setLatLng(latLng);
|
|
52
|
+
m.setView(latLng, nextZoom);
|
|
53
|
+
requestAnimationFrame(() => m.invalidateSize());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
$effect(() => {
|
|
57
|
+
const el = mapEl;
|
|
58
|
+
if (!el) return;
|
|
59
|
+
|
|
60
|
+
let cancelled = false;
|
|
61
|
+
let instance: LeafletMap | null = null;
|
|
62
|
+
let resizeObserver: ResizeObserver | null = null;
|
|
63
|
+
|
|
64
|
+
(async () => {
|
|
65
|
+
const mod = await import('leaflet');
|
|
66
|
+
const L = ((mod as { default?: typeof import('leaflet') }).default ??
|
|
67
|
+
mod) as typeof import('leaflet');
|
|
68
|
+
await import('leaflet/dist/leaflet.css');
|
|
69
|
+
if (cancelled) return;
|
|
70
|
+
|
|
71
|
+
// Vite does not resolve Leaflet's default icon URLs from CSS; import assets.
|
|
72
|
+
const [iconRetina, icon, shadow] = await Promise.all([
|
|
73
|
+
import('leaflet/dist/images/marker-icon-2x.png'),
|
|
74
|
+
import('leaflet/dist/images/marker-icon.png'),
|
|
75
|
+
import('leaflet/dist/images/marker-shadow.png')
|
|
76
|
+
]);
|
|
77
|
+
delete (L.Icon.Default.prototype as unknown as { _getIconUrl?: unknown })._getIconUrl;
|
|
78
|
+
L.Icon.Default.mergeOptions({
|
|
79
|
+
iconRetinaUrl: iconRetina.default,
|
|
80
|
+
iconUrl: icon.default,
|
|
81
|
+
shadowUrl: shadow.default
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const initial = untrack(() => ({ lat, lng, zoom }));
|
|
85
|
+
instance = L.map(el, { scrollWheelZoom: false }).setView(
|
|
86
|
+
[initial.lat, initial.lng],
|
|
87
|
+
initial.zoom
|
|
88
|
+
);
|
|
89
|
+
L.tileLayer(OSM_TILES, {
|
|
90
|
+
maxZoom: 19,
|
|
91
|
+
attribution: '© OpenStreetMap contributors'
|
|
92
|
+
}).addTo(instance);
|
|
93
|
+
|
|
94
|
+
marker = L.marker([initial.lat, initial.lng]).addTo(instance);
|
|
95
|
+
leaflet = L;
|
|
96
|
+
map = instance;
|
|
97
|
+
mapReady = true;
|
|
98
|
+
|
|
99
|
+
resizeObserver = new ResizeObserver(() => {
|
|
100
|
+
instance?.invalidateSize({ animate: false });
|
|
101
|
+
});
|
|
102
|
+
resizeObserver.observe(el);
|
|
103
|
+
requestAnimationFrame(() => instance?.invalidateSize({ animate: false }));
|
|
104
|
+
})();
|
|
105
|
+
|
|
106
|
+
return () => {
|
|
107
|
+
cancelled = true;
|
|
108
|
+
resizeObserver?.disconnect();
|
|
109
|
+
mapReady = false;
|
|
110
|
+
instance?.remove();
|
|
111
|
+
map = null;
|
|
112
|
+
marker = null;
|
|
113
|
+
leaflet = null;
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
$effect(() => {
|
|
118
|
+
const L = leaflet;
|
|
119
|
+
const m = map;
|
|
120
|
+
if (!mapReady || !L || !m) return;
|
|
121
|
+
syncView(m, lat, lng, zoom);
|
|
122
|
+
});
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<div
|
|
126
|
+
class="r2-location-map border-border overflow-hidden rounded-2xl border bg-surface {className}"
|
|
127
|
+
data-dark={dark ? 'true' : 'false'}
|
|
128
|
+
data-tile-invert={invertTiles ? 'true' : 'false'}
|
|
129
|
+
>
|
|
130
|
+
<div class="relative w-full {heightClass}">
|
|
131
|
+
<div
|
|
132
|
+
bind:this={mapEl}
|
|
133
|
+
class="r2-location-map-canvas absolute inset-0 h-full w-full"
|
|
134
|
+
aria-label={label || 'Map'}
|
|
135
|
+
></div>
|
|
136
|
+
</div>
|
|
137
|
+
{#if label}
|
|
138
|
+
<p class="text-muted px-3 py-2 text-xs">{label}</p>
|
|
139
|
+
{/if}
|
|
140
|
+
{#if href}
|
|
141
|
+
<p class="border-border border-t px-3 py-2">
|
|
142
|
+
<a
|
|
143
|
+
{href}
|
|
144
|
+
target="_blank"
|
|
145
|
+
rel="noopener noreferrer"
|
|
146
|
+
class="text-muted hover:text-primary text-xs underline-offset-2 hover:underline"
|
|
147
|
+
>
|
|
148
|
+
{linkLabel}
|
|
149
|
+
</a>
|
|
150
|
+
</p>
|
|
151
|
+
{/if}
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<style>
|
|
155
|
+
:global(.r2-location-map-canvas.leaflet-container) {
|
|
156
|
+
height: 100%;
|
|
157
|
+
width: 100%;
|
|
158
|
+
z-index: 0;
|
|
159
|
+
font: inherit;
|
|
160
|
+
background: transparent;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
:global(.r2-location-map[data-tile-invert='true'] .leaflet-container) {
|
|
164
|
+
background: #0a0a0a;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
:global(.r2-location-map[data-tile-invert='true'] .leaflet-tile-pane) {
|
|
168
|
+
filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.95);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
:global(.r2-location-map[data-dark='true'] .leaflet-control-attribution) {
|
|
172
|
+
background: rgb(24 24 27 / 0.8);
|
|
173
|
+
color: #a3a3a3;
|
|
174
|
+
}
|
|
175
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
lat: number;
|
|
3
|
+
lng: number;
|
|
4
|
+
label?: string;
|
|
5
|
+
zoom?: number;
|
|
6
|
+
href?: string;
|
|
7
|
+
linkLabel?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
heightClass?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const LocationMap: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
12
|
+
type LocationMap = ReturnType<typeof LocationMap>;
|
|
13
|
+
export default LocationMap;
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
class={[
|
|
90
90
|
'relative px-3 py-2 text-sm font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-brand-500/30',
|
|
91
91
|
fullWidth && 'flex-1 text-center',
|
|
92
|
-
item.disabled
|
|
92
|
+
item.disabled ? 'cursor-not-allowed opacity-40' : 'cursor-pointer',
|
|
93
93
|
variant === 'underline' &&
|
|
94
94
|
(activeId === item.id
|
|
95
95
|
? 'text-brand-700 dark:text-brand-300'
|
|
@@ -142,9 +142,11 @@
|
|
|
142
142
|
<div
|
|
143
143
|
class={[
|
|
144
144
|
'bg-surface flex w-full flex-col overflow-hidden',
|
|
145
|
-
// h-
|
|
145
|
+
// Prefer h-full so embedded browsers (IDE Simple Browser) don't exceed the
|
|
146
|
+
// iframe: h-dvh tracks the OS window and causes a second outer scrollbar.
|
|
147
|
+
// min-h-dvh keeps a viewport floor when html/body have no explicit height.
|
|
146
148
|
fillParent && 'min-h-0 h-full',
|
|
147
|
-
!fillParent && fullHeight && 'h-
|
|
149
|
+
!fillParent && fullHeight && 'h-full min-h-dvh',
|
|
148
150
|
!fillParent && !fullHeight && 'min-h-[32rem]',
|
|
149
151
|
className
|
|
150
152
|
]}
|
|
@@ -179,14 +181,16 @@
|
|
|
179
181
|
</div>
|
|
180
182
|
{/if}
|
|
181
183
|
|
|
182
|
-
<!--
|
|
183
|
-
<div
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
{
|
|
189
|
-
|
|
184
|
+
<!-- Scroll outer, center inner (min-h-full): one scrollbar when tall -->
|
|
185
|
+
<div class="min-h-0 flex h-full flex-1 flex-col overflow-y-auto">
|
|
186
|
+
<div
|
|
187
|
+
class="px-5 py-8 sm:px-8 sm:py-10 flex min-h-full flex-1 flex-col items-center justify-center"
|
|
188
|
+
>
|
|
189
|
+
<div class="max-w-md mx-auto w-full shrink-0">
|
|
190
|
+
{#if children}
|
|
191
|
+
{@render children()}
|
|
192
|
+
{/if}
|
|
193
|
+
</div>
|
|
190
194
|
</div>
|
|
191
195
|
</div>
|
|
192
196
|
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
variant === 'compact' ? 'py-6' : variant === 'mega' ? 'py-12' : 'py-10'
|
|
77
77
|
);
|
|
78
78
|
|
|
79
|
-
const maxW = $derived(variant === 'mega' ? 'max-w-
|
|
79
|
+
const maxW = $derived(variant === 'mega' ? 'max-w-screen-2xl' : 'max-w-6xl');
|
|
80
80
|
|
|
81
81
|
function handleLink(link: FooterLink, event: MouseEvent) {
|
|
82
82
|
link.onclick?.(event);
|
|
@@ -330,22 +330,21 @@
|
|
|
330
330
|
</div>
|
|
331
331
|
</div>
|
|
332
332
|
|
|
333
|
-
<div
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
{
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
{/if}
|
|
333
|
+
<div class={['mx-auto w-full px-4 sm:px-6', maxW]}>
|
|
334
|
+
<div
|
|
335
|
+
class="flex w-full flex-col gap-2 border-t border-border py-4 text-xs text-muted sm:flex-row sm:items-center sm:justify-between"
|
|
336
|
+
>
|
|
337
|
+
<span>{resolvedCopyright}</span>
|
|
338
|
+
<div class="flex flex-wrap items-center gap-x-4 gap-y-1">
|
|
339
|
+
{#if bottomLinks.length}
|
|
340
|
+
{#each bottomLinks as link (link.id)}
|
|
341
|
+
{@render linkItem(link, 'transition-colors hover:text-primary')}
|
|
342
|
+
{/each}
|
|
343
|
+
{/if}
|
|
344
|
+
{#if legal}
|
|
345
|
+
{@render legal()}
|
|
346
|
+
{/if}
|
|
347
|
+
</div>
|
|
349
348
|
</div>
|
|
350
349
|
</div>
|
|
351
350
|
{/if}
|
package/dist/index.d.ts
CHANGED
|
@@ -817,6 +817,7 @@ export { default as AssetPickerPage } from './components/organisms/AssetPickerPa
|
|
|
817
817
|
export type { AssetPickerView, PickerAsset } from './components/organisms/AssetPickerPage/AssetPickerPage.svelte';
|
|
818
818
|
export { default as ExploreFeedPage } from './components/organisms/ExploreFeedPage/ExploreFeedPage.svelte';
|
|
819
819
|
export type { ExploreFeedItem, ExploreFeedGroup, ExploreSuggestion, ExploreFeaturedItem } from './components/organisms/ExploreFeedPage/ExploreFeedPage.svelte';
|
|
820
|
+
export { default as LocationMap } from './components/molecules/LocationMap/LocationMap.svelte';
|
|
820
821
|
export { default as MapExplorer } from './components/organisms/MapExplorer/MapExplorer.svelte';
|
|
821
822
|
export type { MapExplorerBounds, MapExplorerCluster, MapExplorerFilter, MapExplorerCardContext, MapExplorerItem, MapExplorerListView, MapExplorerPanel } from './components/organisms/MapExplorer/MapExplorer.svelte';
|
|
822
823
|
export { default as MultiWorkspaceDashboard } from './components/organisms/MultiWorkspaceDashboard/MultiWorkspaceDashboard.svelte';
|
package/dist/index.js
CHANGED
|
@@ -555,6 +555,7 @@ export { default as MobileAccountPage } from './components/organisms/MobileAccou
|
|
|
555
555
|
export { default as BacklogPage } from './components/organisms/BacklogPage/BacklogPage.svelte';
|
|
556
556
|
export { default as AssetPickerPage } from './components/organisms/AssetPickerPage/AssetPickerPage.svelte';
|
|
557
557
|
export { default as ExploreFeedPage } from './components/organisms/ExploreFeedPage/ExploreFeedPage.svelte';
|
|
558
|
+
export { default as LocationMap } from './components/molecules/LocationMap/LocationMap.svelte';
|
|
558
559
|
export { default as MapExplorer } from './components/organisms/MapExplorer/MapExplorer.svelte';
|
|
559
560
|
export { default as MultiWorkspaceDashboard } from './components/organisms/MultiWorkspaceDashboard/MultiWorkspaceDashboard.svelte';
|
|
560
561
|
export { default as LeadDetailPage } from './components/organisms/LeadDetailPage/LeadDetailPage.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r2digisolutions/components",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
|
|
6
6
|
"license": "MIT",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@eslint/js": "^10.0.1",
|
|
69
|
-
"@lucide/svelte": "^1.
|
|
69
|
+
"@lucide/svelte": "^1.48.0",
|
|
70
70
|
"@playwright/test": "^1.63.0",
|
|
71
71
|
"@storybook/addon-a11y": "^10.6.0",
|
|
72
72
|
"@storybook/addon-docs": "^10.6.0",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"tailwindcss": "^4.3.3",
|
|
101
101
|
"typescript": "6.0.3",
|
|
102
102
|
"typescript-eslint": "^8.70.1",
|
|
103
|
-
"vite": "^8.3.
|
|
103
|
+
"vite": "^8.3.1",
|
|
104
104
|
"vitest": "^5.0.1",
|
|
105
105
|
"vitest-browser-svelte": "^3.1.0"
|
|
106
106
|
},
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"atomic-design"
|
|
114
114
|
],
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@xyflow/svelte": "^1.
|
|
116
|
+
"@xyflow/svelte": "^1.7.0",
|
|
117
117
|
"leaflet": "^1.9.4",
|
|
118
118
|
"leaflet.markercluster": "^1.5.3"
|
|
119
119
|
}
|