@opensite/ui 2.8.8 → 2.9.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/about-culture-tabs.cjs +174 -174
- package/dist/about-culture-tabs.js +174 -174
- package/dist/about-developer-profile.cjs +200 -200
- package/dist/about-developer-profile.js +198 -198
- package/dist/about-developer-story.cjs +142 -142
- package/dist/about-developer-story.js +142 -142
- package/dist/about-mission-dual-image.cjs +142 -142
- package/dist/about-mission-dual-image.js +142 -142
- package/dist/about-mission-features.cjs +142 -142
- package/dist/about-mission-features.js +142 -142
- package/dist/about-network-spotlight.cjs +142 -142
- package/dist/about-network-spotlight.js +142 -142
- package/dist/about-story-expertise.cjs +142 -142
- package/dist/about-story-expertise.js +142 -142
- package/dist/about-streamline-team.cjs +142 -142
- package/dist/about-streamline-team.js +142 -142
- package/dist/carousel-feature-badge.cjs +162 -42
- package/dist/carousel-feature-badge.d.cts +14 -1
- package/dist/carousel-feature-badge.d.ts +14 -1
- package/dist/carousel-feature-badge.js +163 -43
- package/dist/community-initiatives.cjs +142 -142
- package/dist/community-initiatives.js +142 -142
- package/dist/components.cjs +723 -1378
- package/dist/components.d.cts +0 -2
- package/dist/components.d.ts +0 -2
- package/dist/components.js +633 -1287
- package/dist/contact-map.cjs +14 -1083
- package/dist/contact-map.d.cts +13 -3
- package/dist/contact-map.d.ts +13 -3
- package/dist/contact-map.js +14 -1083
- package/dist/cta-feature-checklist.cjs +142 -142
- package/dist/cta-feature-checklist.js +142 -142
- package/dist/faq-numbered-grid.cjs +142 -142
- package/dist/faq-numbered-grid.js +142 -142
- package/dist/feature-animated-carousel.cjs +142 -142
- package/dist/feature-animated-carousel.js +142 -142
- package/dist/feature-bento-utilities.cjs +142 -142
- package/dist/feature-bento-utilities.js +142 -142
- package/dist/feature-capabilities-grid.cjs +142 -142
- package/dist/feature-capabilities-grid.js +142 -142
- package/dist/feature-category-image-cards.cjs +142 -142
- package/dist/feature-category-image-cards.js +142 -142
- package/dist/feature-icon-grid-bordered.cjs +142 -142
- package/dist/feature-icon-grid-bordered.js +142 -142
- package/dist/feature-icon-grid-muted.cjs +142 -142
- package/dist/feature-icon-grid-muted.js +142 -142
- package/dist/feature-numbered-cards.cjs +142 -142
- package/dist/feature-numbered-cards.js +142 -142
- package/dist/feature-three-column-values.cjs +142 -142
- package/dist/feature-three-column-values.js +142 -142
- package/dist/hero-ad-campaign-expert.cjs +142 -142
- package/dist/hero-ad-campaign-expert.js +142 -142
- package/dist/hero-adaptable-product-grid.cjs +142 -142
- package/dist/hero-adaptable-product-grid.js +142 -142
- package/dist/hero-agency-animated-images.cjs +142 -142
- package/dist/hero-agency-animated-images.js +142 -142
- package/dist/hero-announcement-badge.cjs +142 -142
- package/dist/hero-announcement-badge.js +142 -142
- package/dist/hero-badge-image-split.cjs +142 -142
- package/dist/hero-badge-image-split.js +142 -142
- package/dist/hero-business-carousel-dots.cjs +142 -142
- package/dist/hero-business-carousel-dots.js +142 -142
- package/dist/hero-business-operations-mosaic.cjs +142 -142
- package/dist/hero-business-operations-mosaic.js +142 -142
- package/dist/hero-conversation-intelligence.cjs +142 -142
- package/dist/hero-conversation-intelligence.js +142 -142
- package/dist/hero-creative-studio-stacked.cjs +142 -142
- package/dist/hero-creative-studio-stacked.js +142 -142
- package/dist/hero-crm-streamlined.cjs +142 -142
- package/dist/hero-crm-streamlined.js +142 -142
- package/dist/hero-customer-support-layered.cjs +142 -142
- package/dist/hero-customer-support-layered.js +142 -142
- package/dist/hero-design-showcase-logos.cjs +142 -142
- package/dist/hero-design-showcase-logos.js +142 -142
- package/dist/hero-design-system-3d.cjs +142 -142
- package/dist/hero-design-system-3d.js +142 -142
- package/dist/hero-developer-tools-code.cjs +142 -142
- package/dist/hero-developer-tools-code.js +142 -142
- package/dist/hero-digital-agency-fullscreen.cjs +142 -142
- package/dist/hero-digital-agency-fullscreen.js +142 -142
- package/dist/hero-ecommerce-product-showcase.cjs +174 -174
- package/dist/hero-ecommerce-product-showcase.js +174 -174
- package/dist/hero-event-registration.cjs +142 -142
- package/dist/hero-event-registration.js +142 -142
- package/dist/hero-fullscreen-background-image.cjs +142 -142
- package/dist/hero-fullscreen-background-image.js +142 -142
- package/dist/hero-gradient-avatars-rating.cjs +142 -142
- package/dist/hero-gradient-avatars-rating.js +142 -142
- package/dist/hero-gradient-client-focused.cjs +142 -142
- package/dist/hero-gradient-client-focused.js +142 -142
- package/dist/hero-hiring-animated-text.cjs +142 -142
- package/dist/hero-hiring-animated-text.js +142 -142
- package/dist/hero-image-left-content.cjs +142 -142
- package/dist/hero-image-left-content.js +142 -142
- package/dist/hero-innovation-image-grid.cjs +142 -142
- package/dist/hero-innovation-image-grid.js +142 -142
- package/dist/hero-mental-health-team.cjs +142 -142
- package/dist/hero-mental-health-team.js +142 -142
- package/dist/hero-minimal-centered-dark.cjs +174 -174
- package/dist/hero-minimal-centered-dark.js +174 -174
- package/dist/hero-presentation-platform-video.cjs +142 -142
- package/dist/hero-presentation-platform-video.js +142 -142
- package/dist/hero-product-showcase-floating.cjs +174 -174
- package/dist/hero-product-showcase-floating.js +174 -174
- package/dist/hero-shared-inbox-layered.cjs +142 -142
- package/dist/hero-shared-inbox-layered.js +142 -142
- package/dist/hero-software-growth-video-dialog.cjs +142 -142
- package/dist/hero-software-growth-video-dialog.js +142 -142
- package/dist/hero-spiral-pattern-cards.cjs +174 -174
- package/dist/hero-spiral-pattern-cards.js +174 -174
- package/dist/hero-split-geometric-shapes.cjs +142 -142
- package/dist/hero-split-geometric-shapes.js +142 -142
- package/dist/hero-startup-launch-cta.cjs +174 -174
- package/dist/hero-startup-launch-cta.js +174 -174
- package/dist/hero-stats-social-proof.cjs +174 -174
- package/dist/hero-stats-social-proof.js +174 -174
- package/dist/hero-task-timer-animated.cjs +142 -142
- package/dist/hero-task-timer-animated.js +142 -142
- package/dist/hero-testimonial-image-grid.cjs +142 -142
- package/dist/hero-testimonial-image-grid.js +142 -142
- package/dist/hero-therapy-testimonial-grid.cjs +142 -142
- package/dist/hero-therapy-testimonial-grid.js +142 -142
- package/dist/hero-ui-library-showcase.cjs +142 -142
- package/dist/hero-ui-library-showcase.js +142 -142
- package/dist/hero-video-background-dark.cjs +174 -174
- package/dist/hero-video-background-dark.js +174 -174
- package/dist/hero-video-dialog-gradient.cjs +142 -142
- package/dist/hero-video-dialog-gradient.js +142 -142
- package/dist/hero-video-overlay-stars.cjs +142 -142
- package/dist/hero-video-overlay-stars.js +142 -142
- package/dist/hero-welcome-asymmetric-images.cjs +142 -142
- package/dist/hero-welcome-asymmetric-images.js +142 -142
- package/dist/index.cjs +725 -1380
- package/dist/index.d.cts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +634 -1288
- package/dist/registry.cjs +2201 -2827
- package/dist/registry.js +948 -1574
- package/dist/testimonials-masonry-grid.cjs +142 -142
- package/dist/testimonials-masonry-grid.js +142 -142
- package/dist/testimonials-stats-header.cjs +159 -159
- package/dist/testimonials-stats-header.js +159 -159
- package/package.json +4 -7
- package/dist/geo-map.cjs +0 -1117
- package/dist/geo-map.d.cts +0 -92
- package/dist/geo-map.d.ts +0 -92
- package/dist/geo-map.js +0 -1095
package/dist/geo-map.js
DELETED
|
@@ -1,1095 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React4 from 'react';
|
|
3
|
-
import { MapLibre } from '@page-speed/maps';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
import { twMerge } from 'tailwind-merge';
|
|
6
|
-
import { cva } from 'class-variance-authority';
|
|
7
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import { Icon } from '@page-speed/icon';
|
|
9
|
-
import { Img } from '@page-speed/img';
|
|
10
|
-
|
|
11
|
-
// components/ui/geo-map.tsx
|
|
12
|
-
function cn(...inputs) {
|
|
13
|
-
return twMerge(clsx(inputs));
|
|
14
|
-
}
|
|
15
|
-
function normalizePhoneNumber(input) {
|
|
16
|
-
const trimmed = input.trim();
|
|
17
|
-
if (trimmed.toLowerCase().startsWith("tel:")) {
|
|
18
|
-
return trimmed;
|
|
19
|
-
}
|
|
20
|
-
const match = trimmed.match(/^[\s\+\-\(\)]*(\d[\d\s\-\(\)\.]*\d)[\s\-]*(x|ext\.?|extension)?[\s\-]*(\d+)?$/i);
|
|
21
|
-
if (match) {
|
|
22
|
-
const mainNumber = match[1].replace(/[\s\-\(\)\.]/g, "");
|
|
23
|
-
const extension = match[3];
|
|
24
|
-
const normalized = mainNumber.length >= 10 && !trimmed.startsWith("+") ? `+${mainNumber}` : mainNumber;
|
|
25
|
-
const withExtension = extension ? `${normalized};ext=${extension}` : normalized;
|
|
26
|
-
return `tel:${withExtension}`;
|
|
27
|
-
}
|
|
28
|
-
const cleaned = trimmed.replace(/[\s\-\(\)\.]/g, "");
|
|
29
|
-
return `tel:${cleaned}`;
|
|
30
|
-
}
|
|
31
|
-
function normalizeEmail(input) {
|
|
32
|
-
const trimmed = input.trim();
|
|
33
|
-
if (trimmed.toLowerCase().startsWith("mailto:")) {
|
|
34
|
-
return trimmed;
|
|
35
|
-
}
|
|
36
|
-
return `mailto:${trimmed}`;
|
|
37
|
-
}
|
|
38
|
-
function isEmail(input) {
|
|
39
|
-
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
40
|
-
return emailRegex.test(input.trim());
|
|
41
|
-
}
|
|
42
|
-
function isPhoneNumber(input) {
|
|
43
|
-
const trimmed = input.trim();
|
|
44
|
-
if (trimmed.toLowerCase().startsWith("tel:")) {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
const phoneRegex = /^[\s\+\-\(\)]*\d[\d\s\-\(\)\.]*\d[\s\-]*(x|ext\.?|extension)?[\s\-]*\d*$/i;
|
|
48
|
-
return phoneRegex.test(trimmed);
|
|
49
|
-
}
|
|
50
|
-
function isInternalUrl(href) {
|
|
51
|
-
if (typeof window === "undefined") {
|
|
52
|
-
return href.startsWith("/") && !href.startsWith("//");
|
|
53
|
-
}
|
|
54
|
-
const trimmed = href.trim();
|
|
55
|
-
if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
try {
|
|
59
|
-
const url = new URL(trimmed, window.location.href);
|
|
60
|
-
const currentOrigin = window.location.origin;
|
|
61
|
-
const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
|
|
62
|
-
return normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin);
|
|
63
|
-
} catch {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function toRelativePath(href) {
|
|
68
|
-
if (typeof window === "undefined") {
|
|
69
|
-
return href;
|
|
70
|
-
}
|
|
71
|
-
const trimmed = href.trim();
|
|
72
|
-
if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
|
|
73
|
-
return trimmed;
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
const url = new URL(trimmed, window.location.href);
|
|
77
|
-
const currentOrigin = window.location.origin;
|
|
78
|
-
const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
|
|
79
|
-
if (normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin)) {
|
|
80
|
-
return url.pathname + url.search + url.hash;
|
|
81
|
-
}
|
|
82
|
-
} catch {
|
|
83
|
-
}
|
|
84
|
-
return trimmed;
|
|
85
|
-
}
|
|
86
|
-
function useNavigation({
|
|
87
|
-
href,
|
|
88
|
-
onClick
|
|
89
|
-
} = {}) {
|
|
90
|
-
const linkType = React4.useMemo(() => {
|
|
91
|
-
if (!href || href.trim() === "") {
|
|
92
|
-
return onClick ? "none" : "none";
|
|
93
|
-
}
|
|
94
|
-
const trimmed = href.trim();
|
|
95
|
-
if (trimmed.toLowerCase().startsWith("mailto:") || isEmail(trimmed)) {
|
|
96
|
-
return "mailto";
|
|
97
|
-
}
|
|
98
|
-
if (trimmed.toLowerCase().startsWith("tel:") || isPhoneNumber(trimmed)) {
|
|
99
|
-
return "tel";
|
|
100
|
-
}
|
|
101
|
-
if (isInternalUrl(trimmed)) {
|
|
102
|
-
return "internal";
|
|
103
|
-
}
|
|
104
|
-
try {
|
|
105
|
-
new URL(trimmed, typeof window !== "undefined" ? window.location.href : "http://localhost");
|
|
106
|
-
return "external";
|
|
107
|
-
} catch {
|
|
108
|
-
return "internal";
|
|
109
|
-
}
|
|
110
|
-
}, [href, onClick]);
|
|
111
|
-
const normalizedHref = React4.useMemo(() => {
|
|
112
|
-
if (!href || href.trim() === "") {
|
|
113
|
-
return void 0;
|
|
114
|
-
}
|
|
115
|
-
const trimmed = href.trim();
|
|
116
|
-
switch (linkType) {
|
|
117
|
-
case "tel":
|
|
118
|
-
return normalizePhoneNumber(trimmed);
|
|
119
|
-
case "mailto":
|
|
120
|
-
return normalizeEmail(trimmed);
|
|
121
|
-
case "internal":
|
|
122
|
-
return toRelativePath(trimmed);
|
|
123
|
-
case "external":
|
|
124
|
-
return trimmed;
|
|
125
|
-
default:
|
|
126
|
-
return trimmed;
|
|
127
|
-
}
|
|
128
|
-
}, [href, linkType]);
|
|
129
|
-
const target = React4.useMemo(() => {
|
|
130
|
-
switch (linkType) {
|
|
131
|
-
case "external":
|
|
132
|
-
return "_blank";
|
|
133
|
-
case "internal":
|
|
134
|
-
return "_self";
|
|
135
|
-
case "mailto":
|
|
136
|
-
case "tel":
|
|
137
|
-
return void 0;
|
|
138
|
-
default:
|
|
139
|
-
return void 0;
|
|
140
|
-
}
|
|
141
|
-
}, [linkType]);
|
|
142
|
-
const rel = React4.useMemo(() => {
|
|
143
|
-
if (linkType === "external") {
|
|
144
|
-
return "noopener noreferrer";
|
|
145
|
-
}
|
|
146
|
-
return void 0;
|
|
147
|
-
}, [linkType]);
|
|
148
|
-
const isExternal = linkType === "external";
|
|
149
|
-
const isInternal = linkType === "internal";
|
|
150
|
-
const shouldUseRouter = isInternal && typeof normalizedHref === "string" && normalizedHref.startsWith("/");
|
|
151
|
-
const handleClick = React4.useCallback(
|
|
152
|
-
(event) => {
|
|
153
|
-
if (onClick) {
|
|
154
|
-
try {
|
|
155
|
-
onClick(event);
|
|
156
|
-
} catch (error) {
|
|
157
|
-
console.error("Error in user onClick handler:", error);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (event.defaultPrevented) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (shouldUseRouter && normalizedHref && event.button === 0 && // left-click only
|
|
164
|
-
!event.metaKey && !event.altKey && !event.ctrlKey && !event.shiftKey) {
|
|
165
|
-
if (typeof window !== "undefined") {
|
|
166
|
-
const handler = window.__opensiteNavigationHandler;
|
|
167
|
-
if (typeof handler === "function") {
|
|
168
|
-
try {
|
|
169
|
-
const handled = handler(normalizedHref, event.nativeEvent || event);
|
|
170
|
-
if (handled !== false) {
|
|
171
|
-
event.preventDefault();
|
|
172
|
-
}
|
|
173
|
-
} catch (error) {
|
|
174
|
-
console.error("Error in navigation handler:", error);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
[onClick, shouldUseRouter, normalizedHref]
|
|
181
|
-
);
|
|
182
|
-
return {
|
|
183
|
-
linkType,
|
|
184
|
-
normalizedHref,
|
|
185
|
-
target,
|
|
186
|
-
rel,
|
|
187
|
-
isExternal,
|
|
188
|
-
isInternal,
|
|
189
|
-
shouldUseRouter,
|
|
190
|
-
handleClick
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
var baseStyles = [
|
|
194
|
-
// Layout
|
|
195
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap shrink-0",
|
|
196
|
-
// Typography - using CSS variables with sensible defaults
|
|
197
|
-
"font-[var(--button-font-family,inherit)]",
|
|
198
|
-
"font-[var(--button-font-weight,500)]",
|
|
199
|
-
"tracking-[var(--button-letter-spacing,0)]",
|
|
200
|
-
"leading-[var(--button-line-height,1.25)]",
|
|
201
|
-
"[text-transform:var(--button-text-transform,none)]",
|
|
202
|
-
"text-sm",
|
|
203
|
-
// Border radius
|
|
204
|
-
"rounded-[var(--button-radius,var(--radius,0.375rem))]",
|
|
205
|
-
// Smooth transition - using [transition:...] to set full shorthand property (not just transition-property)
|
|
206
|
-
"[transition:var(--button-transition,all_250ms_cubic-bezier(0.4,0,0.2,1))]",
|
|
207
|
-
// Box shadow (master level) - using [box-shadow:...] for complex multi-value shadows
|
|
208
|
-
"[box-shadow:var(--button-shadow,none)]",
|
|
209
|
-
"hover:[box-shadow:var(--button-shadow-hover,var(--button-shadow,none))]",
|
|
210
|
-
// Disabled state
|
|
211
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
212
|
-
// SVG handling
|
|
213
|
-
"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
|
|
214
|
-
// Focus styles
|
|
215
|
-
"outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
216
|
-
// Invalid state
|
|
217
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
|
|
218
|
-
].join(" ");
|
|
219
|
-
var buttonVariants = cva(baseStyles, {
|
|
220
|
-
variants: {
|
|
221
|
-
variant: {
|
|
222
|
-
// Default (Primary) variant - full customization
|
|
223
|
-
default: [
|
|
224
|
-
"bg-[var(--button-default-bg,hsl(var(--primary)))]",
|
|
225
|
-
"text-[var(--button-default-fg,hsl(var(--primary-foreground)))]",
|
|
226
|
-
"border-[length:var(--button-default-border-width,0px)]",
|
|
227
|
-
"border-[color:var(--button-default-border,transparent)]",
|
|
228
|
-
"[box-shadow:var(--button-default-shadow,var(--button-shadow,none))]",
|
|
229
|
-
"hover:bg-[var(--button-default-hover-bg,hsl(var(--primary)/0.9))]",
|
|
230
|
-
"hover:text-[var(--button-default-hover-fg,var(--button-default-fg,hsl(var(--primary-foreground))))]",
|
|
231
|
-
"hover:border-[color:var(--button-default-hover-border,var(--button-default-border,transparent))]",
|
|
232
|
-
"hover:[box-shadow:var(--button-default-shadow-hover,var(--button-shadow-hover,var(--button-default-shadow,var(--button-shadow,none))))]"
|
|
233
|
-
].join(" "),
|
|
234
|
-
// Destructive variant - full customization
|
|
235
|
-
destructive: [
|
|
236
|
-
"bg-[var(--button-destructive-bg,hsl(var(--destructive)))]",
|
|
237
|
-
"text-[var(--button-destructive-fg,white)]",
|
|
238
|
-
"border-[length:var(--button-destructive-border-width,0px)]",
|
|
239
|
-
"border-[color:var(--button-destructive-border,transparent)]",
|
|
240
|
-
"[box-shadow:var(--button-destructive-shadow,var(--button-shadow,none))]",
|
|
241
|
-
"hover:bg-[var(--button-destructive-hover-bg,hsl(var(--destructive)/0.9))]",
|
|
242
|
-
"hover:text-[var(--button-destructive-hover-fg,var(--button-destructive-fg,white))]",
|
|
243
|
-
"hover:border-[color:var(--button-destructive-hover-border,var(--button-destructive-border,transparent))]",
|
|
244
|
-
"hover:[box-shadow:var(--button-destructive-shadow-hover,var(--button-shadow-hover,var(--button-destructive-shadow,var(--button-shadow,none))))]",
|
|
245
|
-
"focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
|
246
|
-
"dark:bg-destructive/60"
|
|
247
|
-
].join(" "),
|
|
248
|
-
// Outline variant - full customization with proper border handling
|
|
249
|
-
outline: [
|
|
250
|
-
"bg-[var(--button-outline-bg,hsl(var(--background)))]",
|
|
251
|
-
"text-[var(--button-outline-fg,inherit)]",
|
|
252
|
-
"border-[length:var(--button-outline-border-width,1px)]",
|
|
253
|
-
"border-[color:var(--button-outline-border,hsl(var(--border)))]",
|
|
254
|
-
"[box-shadow:var(--button-outline-shadow,var(--button-shadow,0_1px_2px_0_rgb(0_0_0/0.05)))]",
|
|
255
|
-
"hover:bg-[var(--button-outline-hover-bg,hsl(var(--accent)))]",
|
|
256
|
-
"hover:text-[var(--button-outline-hover-fg,hsl(var(--accent-foreground)))]",
|
|
257
|
-
"hover:border-[color:var(--button-outline-hover-border,var(--button-outline-border,hsl(var(--border))))]",
|
|
258
|
-
"hover:[box-shadow:var(--button-outline-shadow-hover,var(--button-shadow-hover,var(--button-outline-shadow,var(--button-shadow,none))))]",
|
|
259
|
-
"dark:bg-input/30 dark:border-input dark:hover:bg-input/50"
|
|
260
|
-
].join(" "),
|
|
261
|
-
// Secondary variant - full customization
|
|
262
|
-
secondary: [
|
|
263
|
-
"bg-[var(--button-secondary-bg,hsl(var(--secondary)))]",
|
|
264
|
-
"text-[var(--button-secondary-fg,hsl(var(--secondary-foreground)))]",
|
|
265
|
-
"border-[length:var(--button-secondary-border-width,0px)]",
|
|
266
|
-
"border-[color:var(--button-secondary-border,transparent)]",
|
|
267
|
-
"[box-shadow:var(--button-secondary-shadow,var(--button-shadow,none))]",
|
|
268
|
-
"hover:bg-[var(--button-secondary-hover-bg,hsl(var(--secondary)/0.8))]",
|
|
269
|
-
"hover:text-[var(--button-secondary-hover-fg,var(--button-secondary-fg,hsl(var(--secondary-foreground))))]",
|
|
270
|
-
"hover:border-[color:var(--button-secondary-hover-border,var(--button-secondary-border,transparent))]",
|
|
271
|
-
"hover:[box-shadow:var(--button-secondary-shadow-hover,var(--button-shadow-hover,var(--button-secondary-shadow,var(--button-shadow,none))))]"
|
|
272
|
-
].join(" "),
|
|
273
|
-
// Ghost variant - full customization
|
|
274
|
-
ghost: [
|
|
275
|
-
"bg-[var(--button-ghost-bg,transparent)]",
|
|
276
|
-
"text-[var(--button-ghost-fg,inherit)]",
|
|
277
|
-
"border-[length:var(--button-ghost-border-width,0px)]",
|
|
278
|
-
"border-[color:var(--button-ghost-border,transparent)]",
|
|
279
|
-
"[box-shadow:var(--button-ghost-shadow,var(--button-shadow,none))]",
|
|
280
|
-
"hover:bg-[var(--button-ghost-hover-bg,hsl(var(--accent)))]",
|
|
281
|
-
"hover:text-[var(--button-ghost-hover-fg,hsl(var(--accent-foreground)))]",
|
|
282
|
-
"hover:border-[color:var(--button-ghost-hover-border,var(--button-ghost-border,transparent))]",
|
|
283
|
-
"hover:[box-shadow:var(--button-ghost-shadow-hover,var(--button-shadow-hover,var(--button-ghost-shadow,var(--button-shadow,none))))]",
|
|
284
|
-
"dark:hover:bg-accent/50"
|
|
285
|
-
].join(" "),
|
|
286
|
-
// Link variant - full customization
|
|
287
|
-
link: [
|
|
288
|
-
"bg-[var(--button-link-bg,transparent)]",
|
|
289
|
-
"text-[var(--button-link-fg,hsl(var(--primary)))]",
|
|
290
|
-
"border-[length:var(--button-link-border-width,0px)]",
|
|
291
|
-
"border-[color:var(--button-link-border,transparent)]",
|
|
292
|
-
"[box-shadow:var(--button-link-shadow,none)]",
|
|
293
|
-
"hover:bg-[var(--button-link-hover-bg,transparent)]",
|
|
294
|
-
"hover:text-[var(--button-link-hover-fg,var(--button-link-fg,hsl(var(--primary))))]",
|
|
295
|
-
"hover:[box-shadow:var(--button-link-shadow-hover,none)]",
|
|
296
|
-
"underline-offset-4 hover:underline"
|
|
297
|
-
].join(" ")
|
|
298
|
-
},
|
|
299
|
-
size: {
|
|
300
|
-
default: [
|
|
301
|
-
"h-[var(--button-height-md,2.25rem)]",
|
|
302
|
-
"px-[var(--button-padding-x-md,1rem)]",
|
|
303
|
-
"py-[var(--button-padding-y-md,0.5rem)]",
|
|
304
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
|
|
305
|
-
].join(" "),
|
|
306
|
-
sm: [
|
|
307
|
-
"h-[var(--button-height-sm,2rem)]",
|
|
308
|
-
"px-[var(--button-padding-x-sm,0.75rem)]",
|
|
309
|
-
"py-[var(--button-padding-y-sm,0.25rem)]",
|
|
310
|
-
"gap-1.5",
|
|
311
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-sm,0.75rem)*0.83)]"
|
|
312
|
-
].join(" "),
|
|
313
|
-
md: [
|
|
314
|
-
"h-[var(--button-height-md,2.25rem)]",
|
|
315
|
-
"px-[var(--button-padding-x-md,1rem)]",
|
|
316
|
-
"py-[var(--button-padding-y-md,0.5rem)]",
|
|
317
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
|
|
318
|
-
].join(" "),
|
|
319
|
-
lg: [
|
|
320
|
-
"h-[var(--button-height-lg,2.5rem)]",
|
|
321
|
-
"px-[var(--button-padding-x-lg,1.5rem)]",
|
|
322
|
-
"py-[var(--button-padding-y-lg,0.5rem)]",
|
|
323
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-lg,1.5rem)*0.67)]"
|
|
324
|
-
].join(" "),
|
|
325
|
-
icon: "size-[var(--button-height-md,2.25rem)]",
|
|
326
|
-
"icon-sm": "size-[var(--button-height-sm,2rem)]",
|
|
327
|
-
"icon-lg": "size-[var(--button-height-lg,2.5rem)]"
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
defaultVariants: {
|
|
331
|
-
variant: "default",
|
|
332
|
-
size: "default"
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
var Pressable = React4.forwardRef(
|
|
336
|
-
({
|
|
337
|
-
children,
|
|
338
|
-
className,
|
|
339
|
-
href,
|
|
340
|
-
onClick,
|
|
341
|
-
variant,
|
|
342
|
-
size,
|
|
343
|
-
asButton = false,
|
|
344
|
-
fallbackComponentType = "span",
|
|
345
|
-
componentType,
|
|
346
|
-
"aria-label": ariaLabel,
|
|
347
|
-
"aria-describedby": ariaDescribedby,
|
|
348
|
-
id,
|
|
349
|
-
...props
|
|
350
|
-
}, ref) => {
|
|
351
|
-
const navigation = useNavigation({ href, onClick });
|
|
352
|
-
const {
|
|
353
|
-
normalizedHref,
|
|
354
|
-
target,
|
|
355
|
-
rel,
|
|
356
|
-
linkType,
|
|
357
|
-
isInternal,
|
|
358
|
-
handleClick
|
|
359
|
-
} = navigation;
|
|
360
|
-
const shouldRenderLink = normalizedHref && linkType !== "none";
|
|
361
|
-
const shouldRenderButton = !shouldRenderLink && onClick;
|
|
362
|
-
const effectiveComponentType = componentType || (shouldRenderLink ? "a" : shouldRenderButton ? "button" : fallbackComponentType);
|
|
363
|
-
const finalComponentType = isInternal && shouldRenderLink ? "a" : effectiveComponentType;
|
|
364
|
-
const shouldApplyButtonStyles = asButton || variant || size;
|
|
365
|
-
const combinedClassName = cn(
|
|
366
|
-
shouldApplyButtonStyles && buttonVariants({ variant, size }),
|
|
367
|
-
className
|
|
368
|
-
);
|
|
369
|
-
const dataProps = Object.fromEntries(
|
|
370
|
-
Object.entries(props).filter(([key]) => key.startsWith("data-"))
|
|
371
|
-
);
|
|
372
|
-
const buttonDataAttributes = shouldApplyButtonStyles ? {
|
|
373
|
-
"data-slot": "button",
|
|
374
|
-
"data-variant": variant ?? "default",
|
|
375
|
-
"data-size": size ?? "default"
|
|
376
|
-
} : {};
|
|
377
|
-
const commonProps = {
|
|
378
|
-
className: combinedClassName,
|
|
379
|
-
onClick: handleClick,
|
|
380
|
-
"aria-label": ariaLabel,
|
|
381
|
-
"aria-describedby": ariaDescribedby,
|
|
382
|
-
id,
|
|
383
|
-
...dataProps,
|
|
384
|
-
...buttonDataAttributes
|
|
385
|
-
};
|
|
386
|
-
if (finalComponentType === "a" && shouldRenderLink) {
|
|
387
|
-
return /* @__PURE__ */ jsx(
|
|
388
|
-
"a",
|
|
389
|
-
{
|
|
390
|
-
ref,
|
|
391
|
-
href: normalizedHref,
|
|
392
|
-
target,
|
|
393
|
-
rel,
|
|
394
|
-
...commonProps,
|
|
395
|
-
...props,
|
|
396
|
-
children
|
|
397
|
-
}
|
|
398
|
-
);
|
|
399
|
-
}
|
|
400
|
-
if (finalComponentType === "button") {
|
|
401
|
-
return /* @__PURE__ */ jsx(
|
|
402
|
-
"button",
|
|
403
|
-
{
|
|
404
|
-
ref,
|
|
405
|
-
type: props.type || "button",
|
|
406
|
-
...commonProps,
|
|
407
|
-
...props,
|
|
408
|
-
children
|
|
409
|
-
}
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
if (finalComponentType === "div") {
|
|
413
|
-
return /* @__PURE__ */ jsx(
|
|
414
|
-
"div",
|
|
415
|
-
{
|
|
416
|
-
ref,
|
|
417
|
-
...commonProps,
|
|
418
|
-
children
|
|
419
|
-
}
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
return /* @__PURE__ */ jsx(
|
|
423
|
-
"span",
|
|
424
|
-
{
|
|
425
|
-
ref,
|
|
426
|
-
...commonProps,
|
|
427
|
-
children
|
|
428
|
-
}
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
);
|
|
432
|
-
Pressable.displayName = "Pressable";
|
|
433
|
-
var DEFAULT_ICON_API_KEY = "au382bi7fsh96w9h9xlrnat2jglx";
|
|
434
|
-
var DynamicIcon = React4.memo(function DynamicIcon2({
|
|
435
|
-
apiKey,
|
|
436
|
-
...props
|
|
437
|
-
}) {
|
|
438
|
-
return /* @__PURE__ */ jsx(Icon, { ...props, apiKey: apiKey ?? DEFAULT_ICON_API_KEY });
|
|
439
|
-
});
|
|
440
|
-
DynamicIcon.displayName = "DynamicIcon";
|
|
441
|
-
var PANEL_POSITION_CLASS = {
|
|
442
|
-
"top-left": "left-4 top-4",
|
|
443
|
-
"top-right": "right-4 top-4",
|
|
444
|
-
"bottom-left": "bottom-4 left-4",
|
|
445
|
-
"bottom-right": "bottom-4 right-4"
|
|
446
|
-
};
|
|
447
|
-
var DEFAULT_VIEW_STATE = {
|
|
448
|
-
latitude: 39.5,
|
|
449
|
-
longitude: -98.35,
|
|
450
|
-
zoom: 3
|
|
451
|
-
};
|
|
452
|
-
var VIDEO_FILE_EXTENSION_REGEX = /\.(mp4|webm|ogg|mov|m4v|m3u8)(\?.*)?$/i;
|
|
453
|
-
function resolveMediaType(item) {
|
|
454
|
-
if (item.type) {
|
|
455
|
-
return item.type;
|
|
456
|
-
}
|
|
457
|
-
return VIDEO_FILE_EXTENSION_REGEX.test(item.src) ? "video" : "image";
|
|
458
|
-
}
|
|
459
|
-
function normalizeId(value, fallback) {
|
|
460
|
-
if (value === null || value === void 0 || value === "") {
|
|
461
|
-
return fallback;
|
|
462
|
-
}
|
|
463
|
-
return String(value);
|
|
464
|
-
}
|
|
465
|
-
function buildClusterCenter(markers) {
|
|
466
|
-
if (!markers.length) {
|
|
467
|
-
return null;
|
|
468
|
-
}
|
|
469
|
-
const total = markers.reduce(
|
|
470
|
-
(accumulator, marker) => ({
|
|
471
|
-
latitude: accumulator.latitude + marker.latitude,
|
|
472
|
-
longitude: accumulator.longitude + marker.longitude
|
|
473
|
-
}),
|
|
474
|
-
{ latitude: 0, longitude: 0 }
|
|
475
|
-
);
|
|
476
|
-
return {
|
|
477
|
-
latitude: total.latitude / markers.length,
|
|
478
|
-
longitude: total.longitude / markers.length
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
function resolveActionKey(action, index) {
|
|
482
|
-
if (typeof action.label === "string" && action.label.trim().length > 0) {
|
|
483
|
-
return `label:${action.label}:${index}`;
|
|
484
|
-
}
|
|
485
|
-
if (action.href) {
|
|
486
|
-
return `href:${action.href}:${index}`;
|
|
487
|
-
}
|
|
488
|
-
return `action:${index}`;
|
|
489
|
-
}
|
|
490
|
-
function MarkerActions({ actions }) {
|
|
491
|
-
if (!actions || actions.length === 0) {
|
|
492
|
-
return null;
|
|
493
|
-
}
|
|
494
|
-
return /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-wrap gap-2", children: actions.map((action, index) => {
|
|
495
|
-
const {
|
|
496
|
-
label,
|
|
497
|
-
icon,
|
|
498
|
-
iconAfter,
|
|
499
|
-
children,
|
|
500
|
-
href,
|
|
501
|
-
onClick,
|
|
502
|
-
className: actionClassName,
|
|
503
|
-
variant,
|
|
504
|
-
size,
|
|
505
|
-
asButton,
|
|
506
|
-
...rest
|
|
507
|
-
} = action;
|
|
508
|
-
return /* @__PURE__ */ jsx(
|
|
509
|
-
Pressable,
|
|
510
|
-
{
|
|
511
|
-
href,
|
|
512
|
-
onClick,
|
|
513
|
-
variant: variant ?? (index === 0 ? "default" : "outline"),
|
|
514
|
-
size: size ?? "sm",
|
|
515
|
-
asButton: asButton ?? true,
|
|
516
|
-
className: cn("inline-flex items-center gap-2", actionClassName),
|
|
517
|
-
...rest,
|
|
518
|
-
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
519
|
-
icon,
|
|
520
|
-
label,
|
|
521
|
-
iconAfter
|
|
522
|
-
] })
|
|
523
|
-
},
|
|
524
|
-
resolveActionKey(action, index)
|
|
525
|
-
);
|
|
526
|
-
}) });
|
|
527
|
-
}
|
|
528
|
-
function MarkerMediaCarousel({
|
|
529
|
-
mediaItems,
|
|
530
|
-
optixFlowConfig
|
|
531
|
-
}) {
|
|
532
|
-
const [activeIndex, setActiveIndex] = React4.useState(0);
|
|
533
|
-
const totalItems = mediaItems.length;
|
|
534
|
-
const mediaResetKey = React4.useMemo(
|
|
535
|
-
() => mediaItems.map((item, index) => {
|
|
536
|
-
const itemId = normalizeId(item.id, `media-${index}`);
|
|
537
|
-
return `${itemId}:${item.src}:${item.type ?? ""}:${item.poster ?? ""}`;
|
|
538
|
-
}).join("|"),
|
|
539
|
-
[mediaItems]
|
|
540
|
-
);
|
|
541
|
-
const activeItemIndex = Math.min(activeIndex, Math.max(0, totalItems - 1));
|
|
542
|
-
React4.useEffect(() => {
|
|
543
|
-
setActiveIndex(0);
|
|
544
|
-
}, [mediaResetKey]);
|
|
545
|
-
return /* @__PURE__ */ jsxs("div", { className: "relative border-b border-border/60 bg-muted/40", children: [
|
|
546
|
-
/* @__PURE__ */ jsx("div", { className: "relative aspect-video w-full overflow-hidden", children: mediaItems.map((item, index) => {
|
|
547
|
-
const isActive = index === activeItemIndex;
|
|
548
|
-
const mediaType = resolveMediaType(item);
|
|
549
|
-
return /* @__PURE__ */ jsx(
|
|
550
|
-
"div",
|
|
551
|
-
{
|
|
552
|
-
"aria-hidden": !isActive,
|
|
553
|
-
className: cn(
|
|
554
|
-
"absolute inset-0 transition-opacity duration-500 ease-in-out",
|
|
555
|
-
isActive ? "opacity-100 z-[1]" : "opacity-0 z-0 pointer-events-none"
|
|
556
|
-
),
|
|
557
|
-
children: mediaType === "video" ? /* @__PURE__ */ jsx(
|
|
558
|
-
"video",
|
|
559
|
-
{
|
|
560
|
-
className: "h-full w-full object-cover",
|
|
561
|
-
controls: isActive,
|
|
562
|
-
preload: "metadata",
|
|
563
|
-
poster: item.poster,
|
|
564
|
-
tabIndex: isActive ? 0 : -1,
|
|
565
|
-
children: /* @__PURE__ */ jsx("source", { src: item.src })
|
|
566
|
-
}
|
|
567
|
-
) : /* @__PURE__ */ jsx(
|
|
568
|
-
Img,
|
|
569
|
-
{
|
|
570
|
-
src: item.src,
|
|
571
|
-
alt: item.alt ?? "Map marker media",
|
|
572
|
-
className: "h-full w-full object-cover",
|
|
573
|
-
loading: "eager",
|
|
574
|
-
optixFlowConfig
|
|
575
|
-
}
|
|
576
|
-
)
|
|
577
|
-
},
|
|
578
|
-
normalizeId(item.id, `media-slide-${index}`)
|
|
579
|
-
);
|
|
580
|
-
}) }),
|
|
581
|
-
totalItems > 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
582
|
-
/* @__PURE__ */ jsx(
|
|
583
|
-
"button",
|
|
584
|
-
{
|
|
585
|
-
type: "button",
|
|
586
|
-
"aria-label": "Show previous media",
|
|
587
|
-
className: "absolute left-4 top-1/2 inline-flex size-10 -translate-y-1/2 items-center justify-center rounded-2xl bg-card text-card-foreground shadow-lg border-4 border-black hover:border-white hover:bg-black hover:text-white transition-all duration-500 z-[2]",
|
|
588
|
-
onClick: () => {
|
|
589
|
-
setActiveIndex(
|
|
590
|
-
(current) => (current - 1 + totalItems) % totalItems
|
|
591
|
-
);
|
|
592
|
-
},
|
|
593
|
-
children: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/arrow-left", size: 18 })
|
|
594
|
-
}
|
|
595
|
-
),
|
|
596
|
-
/* @__PURE__ */ jsx(
|
|
597
|
-
"button",
|
|
598
|
-
{
|
|
599
|
-
type: "button",
|
|
600
|
-
"aria-label": "Show next media",
|
|
601
|
-
className: "absolute right-4 top-1/2 inline-flex size-10 -translate-y-1/2 items-center justify-center rounded-2xl bg-card text-card-foreground shadow-lg border-4 border-black hover:border-white hover:bg-black hover:text-white transition-all duration-500 z-[2]",
|
|
602
|
-
onClick: () => {
|
|
603
|
-
setActiveIndex((current) => (current + 1) % totalItems);
|
|
604
|
-
},
|
|
605
|
-
children: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/arrow-right", size: 18 })
|
|
606
|
-
}
|
|
607
|
-
),
|
|
608
|
-
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 left-1/2 flex -translate-x-1/2 items-center gap-1.5 z-[2]", children: mediaItems.map((item, index) => /* @__PURE__ */ jsx(
|
|
609
|
-
"button",
|
|
610
|
-
{
|
|
611
|
-
type: "button",
|
|
612
|
-
"aria-label": `Show media item ${index + 1}`,
|
|
613
|
-
className: cn(
|
|
614
|
-
"h-2 rounded-full transition-all duration-300",
|
|
615
|
-
index === activeItemIndex ? "w-6 bg-card" : "w-2 bg-card opacity-50 hover:opacity-100"
|
|
616
|
-
),
|
|
617
|
-
onClick: () => setActiveIndex(index)
|
|
618
|
-
},
|
|
619
|
-
normalizeId(item.id, `media-dot-${index}`)
|
|
620
|
-
)) })
|
|
621
|
-
] }) : null
|
|
622
|
-
] });
|
|
623
|
-
}
|
|
624
|
-
function getMarkerTitle(marker, markerIndex) {
|
|
625
|
-
if (marker.title !== void 0 && marker.title !== null) {
|
|
626
|
-
return marker.title;
|
|
627
|
-
}
|
|
628
|
-
if (marker.label !== void 0 && marker.label !== null) {
|
|
629
|
-
return marker.label;
|
|
630
|
-
}
|
|
631
|
-
return `Location ${markerIndex + 1}`;
|
|
632
|
-
}
|
|
633
|
-
function GeoMap({
|
|
634
|
-
className,
|
|
635
|
-
mapWrapperClassName,
|
|
636
|
-
mapClassName,
|
|
637
|
-
panelClassName,
|
|
638
|
-
panelPosition = "top-left",
|
|
639
|
-
stadiaApiKey = "",
|
|
640
|
-
mapStyle = "osm-bright",
|
|
641
|
-
styleUrl,
|
|
642
|
-
mapLibreCssHref,
|
|
643
|
-
markers = [],
|
|
644
|
-
clusters = [],
|
|
645
|
-
viewState,
|
|
646
|
-
defaultViewState,
|
|
647
|
-
onViewStateChange,
|
|
648
|
-
onMapClick,
|
|
649
|
-
onMarkerDrag,
|
|
650
|
-
showNavigationControl = true,
|
|
651
|
-
showGeolocateControl = false,
|
|
652
|
-
navigationControlPosition = "top-right",
|
|
653
|
-
geolocateControlPosition = "top-left",
|
|
654
|
-
flyToOptions,
|
|
655
|
-
markerFocusZoom = 14,
|
|
656
|
-
clusterFocusZoom = 5,
|
|
657
|
-
selectedMarkerId,
|
|
658
|
-
initialSelectedMarkerId,
|
|
659
|
-
onSelectionChange,
|
|
660
|
-
clearSelectionOnMapClick = true,
|
|
661
|
-
mapChildren,
|
|
662
|
-
optixFlowConfig
|
|
663
|
-
}) {
|
|
664
|
-
const normalizedStandaloneMarkers = React4.useMemo(
|
|
665
|
-
() => markers.map((marker, index) => ({
|
|
666
|
-
...marker,
|
|
667
|
-
id: normalizeId(marker.id, `marker-${index}`)
|
|
668
|
-
})),
|
|
669
|
-
[markers]
|
|
670
|
-
);
|
|
671
|
-
const normalizedClusters = React4.useMemo(() => {
|
|
672
|
-
const results = [];
|
|
673
|
-
clusters.forEach((cluster, clusterIndex) => {
|
|
674
|
-
const clusterId = normalizeId(cluster.id, `cluster-${clusterIndex}`);
|
|
675
|
-
const normalizedClusterMarkers = cluster.markers.map(
|
|
676
|
-
(marker, markerIndex) => ({
|
|
677
|
-
...marker,
|
|
678
|
-
id: normalizeId(marker.id, `${clusterId}-marker-${markerIndex}`),
|
|
679
|
-
clusterId
|
|
680
|
-
})
|
|
681
|
-
);
|
|
682
|
-
const clusterCenter = cluster.latitude !== void 0 && cluster.longitude !== void 0 ? { latitude: cluster.latitude, longitude: cluster.longitude } : buildClusterCenter(normalizedClusterMarkers);
|
|
683
|
-
if (!clusterCenter) {
|
|
684
|
-
return;
|
|
685
|
-
}
|
|
686
|
-
results.push({
|
|
687
|
-
...cluster,
|
|
688
|
-
id: clusterId,
|
|
689
|
-
latitude: clusterCenter.latitude,
|
|
690
|
-
longitude: clusterCenter.longitude,
|
|
691
|
-
markers: normalizedClusterMarkers
|
|
692
|
-
});
|
|
693
|
-
});
|
|
694
|
-
return results;
|
|
695
|
-
}, [clusters]);
|
|
696
|
-
const markerLookup = React4.useMemo(() => {
|
|
697
|
-
const lookup = /* @__PURE__ */ new Map();
|
|
698
|
-
normalizedStandaloneMarkers.forEach((marker) => {
|
|
699
|
-
lookup.set(marker.id, marker);
|
|
700
|
-
});
|
|
701
|
-
normalizedClusters.forEach((cluster) => {
|
|
702
|
-
cluster.markers.forEach((marker) => {
|
|
703
|
-
lookup.set(marker.id, marker);
|
|
704
|
-
});
|
|
705
|
-
});
|
|
706
|
-
return lookup;
|
|
707
|
-
}, [normalizedClusters, normalizedStandaloneMarkers]);
|
|
708
|
-
const clusterLookup = React4.useMemo(() => {
|
|
709
|
-
const lookup = /* @__PURE__ */ new Map();
|
|
710
|
-
normalizedClusters.forEach((cluster) => {
|
|
711
|
-
lookup.set(cluster.id, cluster);
|
|
712
|
-
});
|
|
713
|
-
return lookup;
|
|
714
|
-
}, [normalizedClusters]);
|
|
715
|
-
const firstCoordinate = React4.useMemo(() => {
|
|
716
|
-
if (normalizedStandaloneMarkers.length > 0) {
|
|
717
|
-
const firstStandaloneMarker = normalizedStandaloneMarkers[0];
|
|
718
|
-
return {
|
|
719
|
-
latitude: firstStandaloneMarker.latitude,
|
|
720
|
-
longitude: firstStandaloneMarker.longitude
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
if (normalizedClusters.length > 0) {
|
|
724
|
-
const firstCluster = normalizedClusters[0];
|
|
725
|
-
return {
|
|
726
|
-
latitude: firstCluster.latitude,
|
|
727
|
-
longitude: firstCluster.longitude
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
return {
|
|
731
|
-
latitude: DEFAULT_VIEW_STATE.latitude,
|
|
732
|
-
longitude: DEFAULT_VIEW_STATE.longitude
|
|
733
|
-
};
|
|
734
|
-
}, [normalizedClusters, normalizedStandaloneMarkers]);
|
|
735
|
-
const [uncontrolledViewState, setUncontrolledViewState] = React4.useState({
|
|
736
|
-
latitude: defaultViewState?.latitude ?? firstCoordinate.latitude,
|
|
737
|
-
longitude: defaultViewState?.longitude ?? firstCoordinate.longitude,
|
|
738
|
-
zoom: defaultViewState?.zoom ?? DEFAULT_VIEW_STATE.zoom
|
|
739
|
-
});
|
|
740
|
-
const isControlledViewState = viewState !== void 0;
|
|
741
|
-
const resolvedViewState = isControlledViewState ? viewState : uncontrolledViewState;
|
|
742
|
-
const applyViewState = React4.useCallback(
|
|
743
|
-
(nextState) => {
|
|
744
|
-
if (!isControlledViewState) {
|
|
745
|
-
setUncontrolledViewState((current) => {
|
|
746
|
-
const next = { ...current, ...nextState };
|
|
747
|
-
const hasChanged = current.latitude !== next.latitude || current.longitude !== next.longitude || current.zoom !== next.zoom;
|
|
748
|
-
return hasChanged ? next : current;
|
|
749
|
-
});
|
|
750
|
-
}
|
|
751
|
-
onViewStateChange?.(nextState);
|
|
752
|
-
},
|
|
753
|
-
[isControlledViewState, onViewStateChange]
|
|
754
|
-
);
|
|
755
|
-
const [selection, setSelection] = React4.useState(() => {
|
|
756
|
-
if (initialSelectedMarkerId !== void 0 && initialSelectedMarkerId !== null) {
|
|
757
|
-
return {
|
|
758
|
-
type: "marker",
|
|
759
|
-
markerId: String(initialSelectedMarkerId)
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
return { type: "none" };
|
|
763
|
-
});
|
|
764
|
-
React4.useEffect(() => {
|
|
765
|
-
if (selectedMarkerId === void 0 || selectedMarkerId === null) {
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
setSelection({
|
|
769
|
-
type: "marker",
|
|
770
|
-
markerId: String(selectedMarkerId)
|
|
771
|
-
});
|
|
772
|
-
}, [selectedMarkerId]);
|
|
773
|
-
const selectedMarker = selection.markerId ? markerLookup.get(selection.markerId) : void 0;
|
|
774
|
-
const selectedCluster = selection.clusterId ? clusterLookup.get(selection.clusterId) : void 0;
|
|
775
|
-
React4.useEffect(() => {
|
|
776
|
-
if (selection.type === "marker" && selection.markerId && !selectedMarker) {
|
|
777
|
-
setSelection({ type: "none" });
|
|
778
|
-
onSelectionChange?.({ type: "none" });
|
|
779
|
-
}
|
|
780
|
-
}, [onSelectionChange, selectedMarker, selection]);
|
|
781
|
-
const emitSelectionChange = React4.useCallback(
|
|
782
|
-
(nextSelection) => {
|
|
783
|
-
if (nextSelection.type === "none") {
|
|
784
|
-
onSelectionChange?.({ type: "none" });
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
787
|
-
if (nextSelection.type === "marker") {
|
|
788
|
-
const parentCluster = nextSelection.marker.clusterId ? clusterLookup.get(nextSelection.marker.clusterId) : void 0;
|
|
789
|
-
onSelectionChange?.({
|
|
790
|
-
type: "marker",
|
|
791
|
-
marker: nextSelection.marker,
|
|
792
|
-
cluster: parentCluster
|
|
793
|
-
});
|
|
794
|
-
return;
|
|
795
|
-
}
|
|
796
|
-
onSelectionChange?.({
|
|
797
|
-
type: "cluster",
|
|
798
|
-
cluster: nextSelection.cluster
|
|
799
|
-
});
|
|
800
|
-
},
|
|
801
|
-
[clusterLookup, onSelectionChange]
|
|
802
|
-
);
|
|
803
|
-
const selectMarker = React4.useCallback(
|
|
804
|
-
(marker) => {
|
|
805
|
-
setSelection({
|
|
806
|
-
type: "marker",
|
|
807
|
-
markerId: marker.id,
|
|
808
|
-
clusterId: marker.clusterId
|
|
809
|
-
});
|
|
810
|
-
applyViewState({
|
|
811
|
-
latitude: marker.latitude,
|
|
812
|
-
longitude: marker.longitude,
|
|
813
|
-
zoom: markerFocusZoom
|
|
814
|
-
});
|
|
815
|
-
emitSelectionChange({ type: "marker", marker });
|
|
816
|
-
},
|
|
817
|
-
[applyViewState, emitSelectionChange, markerFocusZoom]
|
|
818
|
-
);
|
|
819
|
-
const selectCluster = React4.useCallback(
|
|
820
|
-
(cluster) => {
|
|
821
|
-
setSelection({
|
|
822
|
-
type: "cluster",
|
|
823
|
-
clusterId: cluster.id
|
|
824
|
-
});
|
|
825
|
-
applyViewState({
|
|
826
|
-
latitude: cluster.latitude,
|
|
827
|
-
longitude: cluster.longitude,
|
|
828
|
-
zoom: clusterFocusZoom
|
|
829
|
-
});
|
|
830
|
-
emitSelectionChange({ type: "cluster", cluster });
|
|
831
|
-
},
|
|
832
|
-
[applyViewState, clusterFocusZoom, emitSelectionChange]
|
|
833
|
-
);
|
|
834
|
-
const clearSelection = React4.useCallback(() => {
|
|
835
|
-
setSelection({ type: "none" });
|
|
836
|
-
emitSelectionChange({ type: "none" });
|
|
837
|
-
}, [emitSelectionChange]);
|
|
838
|
-
const mapMarkers = React4.useMemo(() => {
|
|
839
|
-
const resolvedMarkers = [];
|
|
840
|
-
normalizedClusters.forEach((cluster) => {
|
|
841
|
-
const isSelected = selection.type === "cluster" && selection.clusterId === cluster.id;
|
|
842
|
-
resolvedMarkers.push({
|
|
843
|
-
id: `cluster-pin:${cluster.id}`,
|
|
844
|
-
latitude: cluster.latitude,
|
|
845
|
-
longitude: cluster.longitude,
|
|
846
|
-
element: () => {
|
|
847
|
-
const customMarkerElement = cluster.markerElement;
|
|
848
|
-
const markerBody = typeof customMarkerElement === "function" ? customMarkerElement({
|
|
849
|
-
isSelected,
|
|
850
|
-
count: cluster.markers.length
|
|
851
|
-
}) : customMarkerElement;
|
|
852
|
-
return /* @__PURE__ */ jsx(
|
|
853
|
-
"button",
|
|
854
|
-
{
|
|
855
|
-
type: "button",
|
|
856
|
-
className: "group cursor-pointer",
|
|
857
|
-
onClick: (event) => {
|
|
858
|
-
event.preventDefault();
|
|
859
|
-
event.stopPropagation();
|
|
860
|
-
selectCluster(cluster);
|
|
861
|
-
},
|
|
862
|
-
"aria-label": `View ${cluster.markers.length} clustered locations`,
|
|
863
|
-
children: markerBody ?? /* @__PURE__ */ jsx(
|
|
864
|
-
"span",
|
|
865
|
-
{
|
|
866
|
-
className: cn(
|
|
867
|
-
"inline-flex min-h-10 min-w-10 items-center justify-center rounded-full border-2 border-white px-2 text-xs font-semibold text-white shadow-lg transition-transform duration-200 group-hover:scale-105",
|
|
868
|
-
isSelected && "ring-4 ring-primary/30",
|
|
869
|
-
cluster.pinClassName
|
|
870
|
-
),
|
|
871
|
-
style: {
|
|
872
|
-
backgroundColor: cluster.pinColor ?? "var(--foreground)"
|
|
873
|
-
},
|
|
874
|
-
children: cluster.markers.length
|
|
875
|
-
}
|
|
876
|
-
)
|
|
877
|
-
}
|
|
878
|
-
);
|
|
879
|
-
}
|
|
880
|
-
});
|
|
881
|
-
});
|
|
882
|
-
normalizedStandaloneMarkers.forEach((marker) => {
|
|
883
|
-
const isSelected = selection.type === "marker" && selection.markerId === marker.id;
|
|
884
|
-
const customMarkerElement = marker.markerElement;
|
|
885
|
-
resolvedMarkers.push({
|
|
886
|
-
id: marker.id,
|
|
887
|
-
latitude: marker.latitude,
|
|
888
|
-
longitude: marker.longitude,
|
|
889
|
-
draggable: marker.draggable,
|
|
890
|
-
element: () => {
|
|
891
|
-
const markerBody = typeof customMarkerElement === "function" ? customMarkerElement({ isSelected }) : customMarkerElement;
|
|
892
|
-
return /* @__PURE__ */ jsx(
|
|
893
|
-
"button",
|
|
894
|
-
{
|
|
895
|
-
type: "button",
|
|
896
|
-
className: "group cursor-pointer",
|
|
897
|
-
onClick: (event) => {
|
|
898
|
-
event.preventDefault();
|
|
899
|
-
event.stopPropagation();
|
|
900
|
-
selectMarker(marker);
|
|
901
|
-
},
|
|
902
|
-
"aria-label": typeof marker.title === "string" ? `View ${marker.title}` : "View location details",
|
|
903
|
-
children: markerBody ?? /* @__PURE__ */ jsx(
|
|
904
|
-
"span",
|
|
905
|
-
{
|
|
906
|
-
className: cn(
|
|
907
|
-
"inline-flex h-4 w-4 rounded-full border-2 border-white shadow-md transition-transform duration-200 group-hover:scale-110",
|
|
908
|
-
isSelected && "h-5 w-5 ring-4 ring-primary/30",
|
|
909
|
-
marker.pinClassName
|
|
910
|
-
),
|
|
911
|
-
style: {
|
|
912
|
-
backgroundColor: marker.pinColor ?? "#f43f5e"
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
)
|
|
916
|
-
}
|
|
917
|
-
);
|
|
918
|
-
}
|
|
919
|
-
});
|
|
920
|
-
});
|
|
921
|
-
return resolvedMarkers;
|
|
922
|
-
}, [
|
|
923
|
-
normalizedClusters,
|
|
924
|
-
normalizedStandaloneMarkers,
|
|
925
|
-
selectCluster,
|
|
926
|
-
selectMarker,
|
|
927
|
-
selection
|
|
928
|
-
]);
|
|
929
|
-
const renderMarkerPanel = () => {
|
|
930
|
-
if (selectedMarker) {
|
|
931
|
-
const markerMediaItems = selectedMarker.mediaItems ?? [];
|
|
932
|
-
return /* @__PURE__ */ jsxs(
|
|
933
|
-
"div",
|
|
934
|
-
{
|
|
935
|
-
className: cn(
|
|
936
|
-
"relative w-[min(24rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-border bg-card text-card-foreground shadow-2xl",
|
|
937
|
-
panelClassName
|
|
938
|
-
),
|
|
939
|
-
children: [
|
|
940
|
-
/* @__PURE__ */ jsx(
|
|
941
|
-
"button",
|
|
942
|
-
{
|
|
943
|
-
type: "button",
|
|
944
|
-
"aria-label": "Close marker details",
|
|
945
|
-
className: "\n flex size-12 items-center justify-center rounded-bl-lg rounded-br-0 rounded-t-0 bg-black text-white transition-all duration-500 absolute top-0 right-0 z-10 cursor-pointer ring-4 ring-white\n",
|
|
946
|
-
onClick: clearSelection,
|
|
947
|
-
children: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/x", size: 20 })
|
|
948
|
-
}
|
|
949
|
-
),
|
|
950
|
-
markerMediaItems.length > 0 ? /* @__PURE__ */ jsx(
|
|
951
|
-
MarkerMediaCarousel,
|
|
952
|
-
{
|
|
953
|
-
mediaItems: markerMediaItems,
|
|
954
|
-
optixFlowConfig
|
|
955
|
-
}
|
|
956
|
-
) : null,
|
|
957
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2 p-4", children: [
|
|
958
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-start justify-between gap-3", children: /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-1", children: [
|
|
959
|
-
selectedMarker.eyebrow ? /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold uppercase tracking-wide", children: selectedMarker.eyebrow }) : null,
|
|
960
|
-
/* @__PURE__ */ jsx("div", { className: "text-base font-semibold leading-tight", children: selectedMarker.title ?? selectedMarker.label ?? "Location" })
|
|
961
|
-
] }) }),
|
|
962
|
-
selectedMarker.summary ? /* @__PURE__ */ jsx("div", { className: "text-sm leading-relaxed", children: selectedMarker.summary }) : null,
|
|
963
|
-
selectedMarker.locationLine ? /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-start text-sm gap-2", children: [
|
|
964
|
-
/* @__PURE__ */ jsx(
|
|
965
|
-
DynamicIcon,
|
|
966
|
-
{
|
|
967
|
-
name: "lucide:map-pin",
|
|
968
|
-
className: "opacity-50",
|
|
969
|
-
size: 18
|
|
970
|
-
}
|
|
971
|
-
),
|
|
972
|
-
typeof selectedMarker.locationLine === "string" ? /* @__PURE__ */ jsx(
|
|
973
|
-
Pressable,
|
|
974
|
-
{
|
|
975
|
-
href: selectedMarker.locationUrl,
|
|
976
|
-
className: cn(
|
|
977
|
-
"transition-all duration-500",
|
|
978
|
-
"font-medium opacity-75 hover:opacity-100",
|
|
979
|
-
selectedMarker.locationUrl ? "underline underline-offset-4" : ""
|
|
980
|
-
),
|
|
981
|
-
children: selectedMarker.locationLine
|
|
982
|
-
}
|
|
983
|
-
) : selectedMarker.locationLine
|
|
984
|
-
] }) : null,
|
|
985
|
-
selectedMarker.hoursLine ? /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-start text-sm gap-2", children: [
|
|
986
|
-
/* @__PURE__ */ jsx(
|
|
987
|
-
DynamicIcon,
|
|
988
|
-
{
|
|
989
|
-
name: "lucide:clock",
|
|
990
|
-
className: "opacity-50",
|
|
991
|
-
size: 18
|
|
992
|
-
}
|
|
993
|
-
),
|
|
994
|
-
typeof selectedMarker.hoursLine === "string" ? /* @__PURE__ */ jsx("div", { className: "font-medium", children: selectedMarker.hoursLine }) : selectedMarker.hoursLine
|
|
995
|
-
] }) : null,
|
|
996
|
-
selectedMarker.markerContentComponent ? /* @__PURE__ */ jsx("div", { className: "relative", children: selectedMarker.markerContentComponent }) : null,
|
|
997
|
-
/* @__PURE__ */ jsx(MarkerActions, { actions: selectedMarker.actions })
|
|
998
|
-
] })
|
|
999
|
-
]
|
|
1000
|
-
}
|
|
1001
|
-
);
|
|
1002
|
-
}
|
|
1003
|
-
if (selectedCluster) {
|
|
1004
|
-
return /* @__PURE__ */ jsxs(
|
|
1005
|
-
"div",
|
|
1006
|
-
{
|
|
1007
|
-
className: cn(
|
|
1008
|
-
"relative w-[min(24rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-border bg-card text-card-foreground p-4 shadow-2xl",
|
|
1009
|
-
panelClassName
|
|
1010
|
-
),
|
|
1011
|
-
children: [
|
|
1012
|
-
/* @__PURE__ */ jsx(
|
|
1013
|
-
"button",
|
|
1014
|
-
{
|
|
1015
|
-
type: "button",
|
|
1016
|
-
"aria-label": "Close cluster details",
|
|
1017
|
-
className: "flex size-8 items-center justify-center rounded-full border border-border bg-card text-card-foreground transition hover:bg-muted hover:text-foreground absolute top-2 right-2 z-10",
|
|
1018
|
-
onClick: clearSelection,
|
|
1019
|
-
children: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/x", size: 20 })
|
|
1020
|
-
}
|
|
1021
|
-
),
|
|
1022
|
-
/* @__PURE__ */ jsx("div", { className: "mb-3 flex items-start justify-between gap-3", children: /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
1023
|
-
selectedCluster.label ? /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: selectedCluster.label }) : null,
|
|
1024
|
-
/* @__PURE__ */ jsx("div", { className: "text-base font-semibold leading-tight text-foreground", children: selectedCluster.title ?? "Clustered Locations" }),
|
|
1025
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: selectedCluster.summary ?? `${selectedCluster.markers.length} location${selectedCluster.markers.length === 1 ? "" : "s"} in this cluster.` })
|
|
1026
|
-
] }) }),
|
|
1027
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-56 space-y-2 overflow-y-auto pr-1", children: selectedCluster.markers.map((marker, markerIndex) => /* @__PURE__ */ jsxs(
|
|
1028
|
-
"button",
|
|
1029
|
-
{
|
|
1030
|
-
type: "button",
|
|
1031
|
-
className: "w-full rounded-lg border border-border/60 p-3 text-left transition hover:border-border hover:bg-muted/50",
|
|
1032
|
-
onClick: () => selectMarker(marker),
|
|
1033
|
-
children: [
|
|
1034
|
-
/* @__PURE__ */ jsx("div", { className: "line-clamp-1 text-sm font-semibold text-foreground", children: getMarkerTitle(marker, markerIndex) }),
|
|
1035
|
-
marker.summary ? /* @__PURE__ */ jsx("div", { className: "mt-1 line-clamp-2 text-xs text-muted-foreground", children: marker.summary }) : null
|
|
1036
|
-
]
|
|
1037
|
-
},
|
|
1038
|
-
marker.id
|
|
1039
|
-
)) })
|
|
1040
|
-
]
|
|
1041
|
-
}
|
|
1042
|
-
);
|
|
1043
|
-
}
|
|
1044
|
-
return null;
|
|
1045
|
-
};
|
|
1046
|
-
return /* @__PURE__ */ jsxs(
|
|
1047
|
-
"div",
|
|
1048
|
-
{
|
|
1049
|
-
className: cn(
|
|
1050
|
-
"relative overflow-hidden rounded-2xl border border-border bg-background",
|
|
1051
|
-
className
|
|
1052
|
-
),
|
|
1053
|
-
children: [
|
|
1054
|
-
/* @__PURE__ */ jsx("div", { className: cn("h-[520px] w-full", mapWrapperClassName), children: /* @__PURE__ */ jsx(
|
|
1055
|
-
MapLibre,
|
|
1056
|
-
{
|
|
1057
|
-
stadiaApiKey,
|
|
1058
|
-
mapStyle,
|
|
1059
|
-
styleUrl,
|
|
1060
|
-
mapLibreCssHref,
|
|
1061
|
-
viewState: resolvedViewState,
|
|
1062
|
-
onViewStateChange: applyViewState,
|
|
1063
|
-
markers: mapMarkers,
|
|
1064
|
-
onClick: (coord) => {
|
|
1065
|
-
onMapClick?.(coord);
|
|
1066
|
-
if (clearSelectionOnMapClick) {
|
|
1067
|
-
clearSelection();
|
|
1068
|
-
}
|
|
1069
|
-
},
|
|
1070
|
-
onMarkerDrag,
|
|
1071
|
-
showNavigationControl,
|
|
1072
|
-
showGeolocateControl,
|
|
1073
|
-
navigationControlPosition,
|
|
1074
|
-
geolocateControlPosition,
|
|
1075
|
-
flyToOptions,
|
|
1076
|
-
className: cn("h-full w-full", mapClassName),
|
|
1077
|
-
children: mapChildren
|
|
1078
|
-
}
|
|
1079
|
-
) }),
|
|
1080
|
-
selection.type !== "none" ? /* @__PURE__ */ jsx(
|
|
1081
|
-
"div",
|
|
1082
|
-
{
|
|
1083
|
-
className: cn(
|
|
1084
|
-
"pointer-events-none absolute z-20",
|
|
1085
|
-
PANEL_POSITION_CLASS[panelPosition]
|
|
1086
|
-
),
|
|
1087
|
-
children: /* @__PURE__ */ jsx("div", { className: "pointer-events-auto", children: renderMarkerPanel() })
|
|
1088
|
-
}
|
|
1089
|
-
) : null
|
|
1090
|
-
]
|
|
1091
|
-
}
|
|
1092
|
-
);
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
export { GeoMap };
|