@mapfirst.ai/react 0.0.96 → 0.0.98
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/index.d.mts +41 -34
- package/dist/index.d.ts +41 -34
- package/dist/index.js +201 -160
- package/dist/index.mjs +165 -122
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.tsx
|
|
2
|
-
import
|
|
2
|
+
import React7 from "react";
|
|
3
3
|
import {
|
|
4
4
|
MapFirstCore,
|
|
5
5
|
LeafletAdapter
|
|
@@ -16,10 +16,12 @@ import {
|
|
|
16
16
|
} from "@mapfirst.ai/core";
|
|
17
17
|
|
|
18
18
|
// src/components/SmartFilter.tsx
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
useCallback as useCallback3
|
|
21
|
+
} from "react";
|
|
20
22
|
|
|
21
23
|
// src/components/smart-filter/FilterChips.tsx
|
|
22
|
-
import
|
|
24
|
+
import React6 from "react";
|
|
23
25
|
|
|
24
26
|
// src/components/smart-filter/CloseButton.tsx
|
|
25
27
|
import React from "react";
|
|
@@ -186,14 +188,23 @@ import {
|
|
|
186
188
|
|
|
187
189
|
// src/hooks/useTranslation.ts
|
|
188
190
|
import { useCallback, useMemo, useState } from "react";
|
|
191
|
+
|
|
192
|
+
// src/context/TranslationContext.tsx
|
|
193
|
+
import React2 from "react";
|
|
194
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
195
|
+
var TranslationContext = React2.createContext(void 0);
|
|
196
|
+
var TranslationProvider = ({ value, children }) => /* @__PURE__ */ jsx4(TranslationContext.Provider, { value, children });
|
|
197
|
+
var useCustomTranslationsContext = () => React2.useContext(TranslationContext);
|
|
198
|
+
|
|
199
|
+
// src/hooks/useTranslation.ts
|
|
189
200
|
var defaultTranslations = {
|
|
190
201
|
"smartFilter.typingPrompt": "Search for hotels, restaurants, or attractions...",
|
|
191
202
|
"smartFilter.nav.previous": "Previous filters",
|
|
192
203
|
"smartFilter.nav.next": "Next filters",
|
|
193
204
|
"smartFilter.toast.locationRequired": "Please select a location first",
|
|
194
205
|
"smartFilter.clearAll": "Clear all",
|
|
195
|
-
"smartFilter.minRating.suffix": "
|
|
196
|
-
"smartFilter.minRating.label": "{{value}}
|
|
206
|
+
"smartFilter.minRating.suffix": "& up",
|
|
207
|
+
"smartFilter.minRating.label": "{{value}} & up",
|
|
197
208
|
"smartFilter.minRating.remove": "Remove rating filter",
|
|
198
209
|
"smartFilter.minRating.setTo": "Set rating to {{rating}}",
|
|
199
210
|
"smartFilter.priceRange.label": "Price Range",
|
|
@@ -217,10 +228,12 @@ var formatCurrencyDefault = (value, currency = "USD") => {
|
|
|
217
228
|
}).format(value);
|
|
218
229
|
};
|
|
219
230
|
var useTranslation = (customTranslations, customFormatCurrency) => {
|
|
231
|
+
const contextTranslations = useCustomTranslationsContext();
|
|
232
|
+
const merged = customTranslations != null ? customTranslations : contextTranslations;
|
|
220
233
|
const [locale, setLocale] = useState("en");
|
|
221
234
|
const translations = useMemo(
|
|
222
|
-
() => ({ ...defaultTranslations, ...
|
|
223
|
-
[
|
|
235
|
+
() => ({ ...defaultTranslations, ...merged }),
|
|
236
|
+
[merged]
|
|
224
237
|
);
|
|
225
238
|
const t = useCallback(
|
|
226
239
|
(key, params) => {
|
|
@@ -255,7 +268,7 @@ var useTranslation = (customTranslations, customFormatCurrency) => {
|
|
|
255
268
|
};
|
|
256
269
|
|
|
257
270
|
// src/components/smart-filter/utils.tsx
|
|
258
|
-
import { jsx as
|
|
271
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
259
272
|
var STAR_BASE_STYLES = {
|
|
260
273
|
display: "block",
|
|
261
274
|
width: "12px",
|
|
@@ -287,19 +300,19 @@ var renderStars = (rating) => {
|
|
|
287
300
|
const fullStars = Math.floor(rating);
|
|
288
301
|
const hasHalfStar = rating % 1 !== 0;
|
|
289
302
|
for (let i = 0; i < fullStars; i += 1) {
|
|
290
|
-
stars.push(/* @__PURE__ */
|
|
303
|
+
stars.push(/* @__PURE__ */ jsx5("span", { style: STAR_FULL_STYLES }, `full-${i}`));
|
|
291
304
|
}
|
|
292
305
|
if (hasHalfStar) {
|
|
293
|
-
stars.push(/* @__PURE__ */
|
|
306
|
+
stars.push(/* @__PURE__ */ jsx5("span", { style: STAR_HALF_STYLES }, "half"));
|
|
294
307
|
}
|
|
295
308
|
const remainingStars = Math.max(0, 5 - Math.ceil(rating));
|
|
296
309
|
for (let i = 0; i < remainingStars; i += 1) {
|
|
297
|
-
stars.push(/* @__PURE__ */
|
|
310
|
+
stars.push(/* @__PURE__ */ jsx5("span", { style: STAR_BASE_STYLES }, `empty-${i}`));
|
|
298
311
|
}
|
|
299
312
|
return stars;
|
|
300
313
|
};
|
|
301
314
|
var createMinRatingFilterLabel = (rating, suffix) => /* @__PURE__ */ jsxs3("span", { style: MIN_RATING_LABEL_STYLES, children: [
|
|
302
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ jsx5("span", { style: MIN_RATING_STARS_WRAPPER_STYLES, children: renderStars(rating) }),
|
|
303
316
|
" ",
|
|
304
317
|
suffix
|
|
305
318
|
] });
|
|
@@ -310,7 +323,7 @@ var createPriceRangeFilterLabel = (min, max, currency, formatCurrencyFn) => `${f
|
|
|
310
323
|
)}`;
|
|
311
324
|
|
|
312
325
|
// src/components/smart-filter/MinRatingFilterChip.tsx
|
|
313
|
-
import { jsx as
|
|
326
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
314
327
|
var chipContainerStyles = {
|
|
315
328
|
position: "relative",
|
|
316
329
|
backgroundColor: "white",
|
|
@@ -349,7 +362,7 @@ var buttonBaseStyles = {
|
|
|
349
362
|
border: "none",
|
|
350
363
|
padding: 0
|
|
351
364
|
};
|
|
352
|
-
var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false }) => {
|
|
365
|
+
var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false, style }) => {
|
|
353
366
|
const [hoverRating, setHoverRating] = useState2(null);
|
|
354
367
|
const { t } = useTranslation();
|
|
355
368
|
const displayRating = hoverRating != null ? hoverRating : rating;
|
|
@@ -380,14 +393,14 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false }) => {
|
|
|
380
393
|
setHoverRating(null);
|
|
381
394
|
}
|
|
382
395
|
};
|
|
383
|
-
return /* @__PURE__ */ jsxs4("div", { style: chipContainerStyles, "data-min-rating-chip": true, children: [
|
|
396
|
+
return /* @__PURE__ */ jsxs4("div", { style: { ...chipContainerStyles, ...style }, "data-min-rating-chip": true, children: [
|
|
384
397
|
/* @__PURE__ */ jsxs4(
|
|
385
398
|
"div",
|
|
386
399
|
{
|
|
387
400
|
style: { display: "flex", alignItems: "center", gap: "4px" },
|
|
388
401
|
onMouseLeave: () => setHoverRating(null),
|
|
389
402
|
children: [
|
|
390
|
-
/* @__PURE__ */
|
|
403
|
+
/* @__PURE__ */ jsx6("div", { style: starContainerStyles, children: Array.from({ length: 5 }).map((_, index) => {
|
|
391
404
|
const fillState = getFillForStar(index);
|
|
392
405
|
const starNumber = index + 1;
|
|
393
406
|
const halfValue = starNumber - 0.5;
|
|
@@ -412,15 +425,15 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false }) => {
|
|
|
412
425
|
},
|
|
413
426
|
xmlns: "http://www.w3.org/2000/svg",
|
|
414
427
|
children: [
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ jsx6("defs", { children: /* @__PURE__ */ jsxs4("linearGradient", { id: `star-gradient-${index}`, children: [
|
|
429
|
+
/* @__PURE__ */ jsx6(
|
|
417
430
|
"stop",
|
|
418
431
|
{
|
|
419
432
|
offset: fillState === "half" ? "50%" : "0%",
|
|
420
433
|
stopColor: "#03852e"
|
|
421
434
|
}
|
|
422
435
|
),
|
|
423
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ jsx6(
|
|
424
437
|
"stop",
|
|
425
438
|
{
|
|
426
439
|
offset: fillState === "half" ? "50%" : "0%",
|
|
@@ -428,7 +441,7 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false }) => {
|
|
|
428
441
|
}
|
|
429
442
|
)
|
|
430
443
|
] }) }),
|
|
431
|
-
/* @__PURE__ */
|
|
444
|
+
/* @__PURE__ */ jsx6(
|
|
432
445
|
"path",
|
|
433
446
|
{
|
|
434
447
|
d: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",
|
|
@@ -440,7 +453,7 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false }) => {
|
|
|
440
453
|
]
|
|
441
454
|
}
|
|
442
455
|
),
|
|
443
|
-
/* @__PURE__ */
|
|
456
|
+
/* @__PURE__ */ jsx6(
|
|
444
457
|
"button",
|
|
445
458
|
{
|
|
446
459
|
type: "button",
|
|
@@ -458,7 +471,7 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false }) => {
|
|
|
458
471
|
title: formatLabel(halfValue)
|
|
459
472
|
}
|
|
460
473
|
),
|
|
461
|
-
/* @__PURE__ */
|
|
474
|
+
/* @__PURE__ */ jsx6(
|
|
462
475
|
"button",
|
|
463
476
|
{
|
|
464
477
|
type: "button",
|
|
@@ -491,13 +504,13 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false }) => {
|
|
|
491
504
|
{
|
|
492
505
|
style: { position: "relative", width: "12px", height: "12px" },
|
|
493
506
|
children: [
|
|
494
|
-
/* @__PURE__ */
|
|
507
|
+
/* @__PURE__ */ jsx6(
|
|
495
508
|
"span",
|
|
496
509
|
{
|
|
497
510
|
style: fillState === "half" ? halfCircleStyles : circleStyles
|
|
498
511
|
}
|
|
499
512
|
),
|
|
500
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ jsx6(
|
|
501
514
|
"button",
|
|
502
515
|
{
|
|
503
516
|
type: "button",
|
|
@@ -517,7 +530,7 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false }) => {
|
|
|
517
530
|
title: formatLabel(halfValue)
|
|
518
531
|
}
|
|
519
532
|
),
|
|
520
|
-
/* @__PURE__ */
|
|
533
|
+
/* @__PURE__ */ jsx6(
|
|
521
534
|
"button",
|
|
522
535
|
{
|
|
523
536
|
type: "button",
|
|
@@ -542,11 +555,11 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false }) => {
|
|
|
542
555
|
index
|
|
543
556
|
);
|
|
544
557
|
}) }),
|
|
545
|
-
/* @__PURE__ */
|
|
558
|
+
/* @__PURE__ */ jsx6("span", { style: { whiteSpace: "nowrap" }, children: formatLabel(displayRating) })
|
|
546
559
|
]
|
|
547
560
|
}
|
|
548
561
|
),
|
|
549
|
-
/* @__PURE__ */
|
|
562
|
+
/* @__PURE__ */ jsx6(CloseButton, { onClick: onRemove })
|
|
550
563
|
] });
|
|
551
564
|
};
|
|
552
565
|
|
|
@@ -555,7 +568,7 @@ import {
|
|
|
555
568
|
useEffect,
|
|
556
569
|
useState as useState3
|
|
557
570
|
} from "react";
|
|
558
|
-
import { Fragment, jsx as
|
|
571
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
559
572
|
var chipStyles2 = {
|
|
560
573
|
position: "relative",
|
|
561
574
|
backgroundColor: "white",
|
|
@@ -602,7 +615,8 @@ var PriceBoundaryChip = ({
|
|
|
602
615
|
editLabel,
|
|
603
616
|
showAddWhenEmpty = false,
|
|
604
617
|
onCommit,
|
|
605
|
-
onRemove
|
|
618
|
+
onRemove,
|
|
619
|
+
style
|
|
606
620
|
}) => {
|
|
607
621
|
const [draft, setDraft] = useState3(
|
|
608
622
|
value !== void 0 ? String(value) : ""
|
|
@@ -662,8 +676,8 @@ var PriceBoundaryChip = ({
|
|
|
662
676
|
event.preventDefault();
|
|
663
677
|
}
|
|
664
678
|
};
|
|
665
|
-
return /* @__PURE__ */ jsxs5("div", { style: chipStyles2, children: [
|
|
666
|
-
/* @__PURE__ */
|
|
679
|
+
return /* @__PURE__ */ jsxs5("div", { style: { ...chipStyles2, ...style }, children: [
|
|
680
|
+
/* @__PURE__ */ jsx7(
|
|
667
681
|
"span",
|
|
668
682
|
{
|
|
669
683
|
style: {
|
|
@@ -675,7 +689,7 @@ var PriceBoundaryChip = ({
|
|
|
675
689
|
children: label
|
|
676
690
|
}
|
|
677
691
|
),
|
|
678
|
-
isEditing ? /* @__PURE__ */
|
|
692
|
+
isEditing ? /* @__PURE__ */ jsx7(
|
|
679
693
|
"input",
|
|
680
694
|
{
|
|
681
695
|
value: draft,
|
|
@@ -692,13 +706,13 @@ var PriceBoundaryChip = ({
|
|
|
692
706
|
style: inputStyles,
|
|
693
707
|
autoFocus: true
|
|
694
708
|
}
|
|
695
|
-
) : hasValue ? /* @__PURE__ */
|
|
709
|
+
) : hasValue ? /* @__PURE__ */ jsx7(
|
|
696
710
|
"span",
|
|
697
711
|
{
|
|
698
712
|
style: { fontSize: "16px", fontWeight: 600, textAlign: "center" },
|
|
699
713
|
children: value
|
|
700
714
|
}
|
|
701
|
-
) : showAddWhenEmpty ? /* @__PURE__ */
|
|
715
|
+
) : showAddWhenEmpty ? /* @__PURE__ */ jsx7(
|
|
702
716
|
"button",
|
|
703
717
|
{
|
|
704
718
|
type: "button",
|
|
@@ -714,8 +728,8 @@ var PriceBoundaryChip = ({
|
|
|
714
728
|
"aria-label": editLabel,
|
|
715
729
|
children: "+"
|
|
716
730
|
}
|
|
717
|
-
) : /* @__PURE__ */
|
|
718
|
-
(!showAddWhenEmpty || showAddWhenEmpty && isEditing) && /* @__PURE__ */
|
|
731
|
+
) : /* @__PURE__ */ jsx7("span", { style: { fontSize: "16px", color: "#737373" }, children: "-" }),
|
|
732
|
+
(!showAddWhenEmpty || showAddWhenEmpty && isEditing) && /* @__PURE__ */ jsx7(
|
|
719
733
|
"span",
|
|
720
734
|
{
|
|
721
735
|
style: {
|
|
@@ -727,7 +741,7 @@ var PriceBoundaryChip = ({
|
|
|
727
741
|
children: currency
|
|
728
742
|
}
|
|
729
743
|
),
|
|
730
|
-
!isEditing && (!showAddWhenEmpty || hasValue) && /* @__PURE__ */
|
|
744
|
+
!isEditing && (!showAddWhenEmpty || hasValue) && /* @__PURE__ */ jsx7(
|
|
731
745
|
"button",
|
|
732
746
|
{
|
|
733
747
|
type: "button",
|
|
@@ -740,13 +754,13 @@ var PriceBoundaryChip = ({
|
|
|
740
754
|
onClick: () => setIsEditing(true),
|
|
741
755
|
onMouseEnter: () => setEditHover(true),
|
|
742
756
|
onMouseLeave: () => setEditHover(false),
|
|
743
|
-
children: /* @__PURE__ */
|
|
757
|
+
children: /* @__PURE__ */ jsx7(EditIcon, {})
|
|
744
758
|
}
|
|
745
759
|
),
|
|
746
|
-
showRemoveButton && /* @__PURE__ */
|
|
760
|
+
showRemoveButton && /* @__PURE__ */ jsx7(CloseButton, { onClick: onRemove })
|
|
747
761
|
] });
|
|
748
762
|
};
|
|
749
|
-
var PriceRangeFilterChip = ({ priceRange, currency, onChange, onRemove }) => {
|
|
763
|
+
var PriceRangeFilterChip = ({ priceRange, currency, onChange, onRemove, style }) => {
|
|
750
764
|
const { t } = useTranslation();
|
|
751
765
|
const minLabel = "Min";
|
|
752
766
|
const maxChipLabel = "Max";
|
|
@@ -772,7 +786,7 @@ var PriceRangeFilterChip = ({ priceRange, currency, onChange, onRemove }) => {
|
|
|
772
786
|
}
|
|
773
787
|
};
|
|
774
788
|
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
775
|
-
/* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ jsx7(
|
|
776
790
|
PriceBoundaryChip,
|
|
777
791
|
{
|
|
778
792
|
label: minLabel,
|
|
@@ -781,10 +795,11 @@ var PriceRangeFilterChip = ({ priceRange, currency, onChange, onRemove }) => {
|
|
|
781
795
|
editLabel,
|
|
782
796
|
showRemoveButton: priceRange.min !== void 0 && priceRange.min !== 0,
|
|
783
797
|
onCommit: (value) => handleBoundaryCommit("min", value),
|
|
784
|
-
onRemove
|
|
798
|
+
onRemove,
|
|
799
|
+
style
|
|
785
800
|
}
|
|
786
801
|
),
|
|
787
|
-
/* @__PURE__ */
|
|
802
|
+
/* @__PURE__ */ jsx7(
|
|
788
803
|
PriceBoundaryChip,
|
|
789
804
|
{
|
|
790
805
|
label: maxChipLabel,
|
|
@@ -795,14 +810,15 @@ var PriceRangeFilterChip = ({ priceRange, currency, onChange, onRemove }) => {
|
|
|
795
810
|
editLabel,
|
|
796
811
|
showAddWhenEmpty: true,
|
|
797
812
|
onCommit: (value) => handleBoundaryCommit("max", value),
|
|
798
|
-
onRemove
|
|
813
|
+
onRemove,
|
|
814
|
+
style
|
|
799
815
|
}
|
|
800
816
|
)
|
|
801
817
|
] });
|
|
802
818
|
};
|
|
803
819
|
|
|
804
820
|
// src/components/smart-filter/RestaurantPriceLevelChip.tsx
|
|
805
|
-
import { jsx as
|
|
821
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
806
822
|
var chipStyles3 = {
|
|
807
823
|
position: "relative",
|
|
808
824
|
backgroundColor: "white",
|
|
@@ -823,7 +839,7 @@ var PRICE_LEVEL_OPTIONS = [
|
|
|
823
839
|
{ value: "Mid Range", key: "midRange" },
|
|
824
840
|
{ value: "Fine Dining", key: "fineDining" }
|
|
825
841
|
];
|
|
826
|
-
var RestaurantPriceLevelChip = ({ values, onChange, onRemove }) => {
|
|
842
|
+
var RestaurantPriceLevelChip = ({ values, onChange, onRemove, style }) => {
|
|
827
843
|
const { t } = useTranslation();
|
|
828
844
|
const label = t("smartFilter.restaurantPriceLevel.label");
|
|
829
845
|
const removeLabel = t("smartFilter.restaurantPriceLevel.remove");
|
|
@@ -842,7 +858,7 @@ var RestaurantPriceLevelChip = ({ values, onChange, onRemove }) => {
|
|
|
842
858
|
).map((option) => option.value);
|
|
843
859
|
onChange(orderedSelection);
|
|
844
860
|
};
|
|
845
|
-
return /* @__PURE__ */ jsxs6("div", { style: chipStyles3, children: [
|
|
861
|
+
return /* @__PURE__ */ jsxs6("div", { style: { ...chipStyles3, ...style }, children: [
|
|
846
862
|
/* @__PURE__ */ jsxs6(
|
|
847
863
|
"div",
|
|
848
864
|
{
|
|
@@ -853,7 +869,7 @@ var RestaurantPriceLevelChip = ({ values, onChange, onRemove }) => {
|
|
|
853
869
|
flexWrap: "wrap"
|
|
854
870
|
},
|
|
855
871
|
children: [
|
|
856
|
-
/* @__PURE__ */
|
|
872
|
+
/* @__PURE__ */ jsx8(
|
|
857
873
|
"span",
|
|
858
874
|
{
|
|
859
875
|
style: {
|
|
@@ -883,7 +899,7 @@ var RestaurantPriceLevelChip = ({ values, onChange, onRemove }) => {
|
|
|
883
899
|
cursor: "pointer"
|
|
884
900
|
},
|
|
885
901
|
children: [
|
|
886
|
-
/* @__PURE__ */
|
|
902
|
+
/* @__PURE__ */ jsx8(
|
|
887
903
|
"input",
|
|
888
904
|
{
|
|
889
905
|
id: checkboxId,
|
|
@@ -894,18 +910,18 @@ var RestaurantPriceLevelChip = ({ values, onChange, onRemove }) => {
|
|
|
894
910
|
style: { accentColor: "#03852e", cursor: "pointer" }
|
|
895
911
|
}
|
|
896
912
|
),
|
|
897
|
-
/* @__PURE__ */
|
|
913
|
+
/* @__PURE__ */ jsx8("span", { children: optionLabel })
|
|
898
914
|
]
|
|
899
915
|
},
|
|
900
916
|
option.value
|
|
901
917
|
);
|
|
902
918
|
}),
|
|
903
|
-
values.length === 0 && /* @__PURE__ */
|
|
919
|
+
values.length === 0 && /* @__PURE__ */ jsx8("span", { style: { fontSize: "12px", color: "#737373" }, children: noneSelectedLabel })
|
|
904
920
|
] })
|
|
905
921
|
]
|
|
906
922
|
}
|
|
907
923
|
),
|
|
908
|
-
/* @__PURE__ */
|
|
924
|
+
/* @__PURE__ */ jsx8(CloseButton, { onClick: onRemove })
|
|
909
925
|
] });
|
|
910
926
|
};
|
|
911
927
|
|
|
@@ -915,7 +931,7 @@ import {
|
|
|
915
931
|
useRef,
|
|
916
932
|
useState as useState4
|
|
917
933
|
} from "react";
|
|
918
|
-
import { jsx as
|
|
934
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
919
935
|
var chipStyles4 = {
|
|
920
936
|
position: "relative",
|
|
921
937
|
backgroundColor: "white",
|
|
@@ -953,7 +969,7 @@ var editButtonStyles2 = {
|
|
|
953
969
|
alignItems: "center",
|
|
954
970
|
justifyContent: "center"
|
|
955
971
|
};
|
|
956
|
-
var TransformedQueryChip = ({ value, onChange, onRemove }) => {
|
|
972
|
+
var TransformedQueryChip = ({ value, onChange, onRemove, style }) => {
|
|
957
973
|
const inputRef = useRef(null);
|
|
958
974
|
const [draft, setDraft] = useState4(value);
|
|
959
975
|
const [isEditing, setIsEditing] = useState4(false);
|
|
@@ -992,9 +1008,9 @@ var TransformedQueryChip = ({ value, onChange, onRemove }) => {
|
|
|
992
1008
|
return;
|
|
993
1009
|
}
|
|
994
1010
|
};
|
|
995
|
-
return /* @__PURE__ */ jsxs7("div", { style: chipStyles4, children: [
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
isEditing ? /* @__PURE__ */
|
|
1011
|
+
return /* @__PURE__ */ jsxs7("div", { style: { ...chipStyles4, ...style }, children: [
|
|
1012
|
+
/* @__PURE__ */ jsx9(SearchIcon, { style: { width: "16px", height: "16px", color: "#03852e" } }),
|
|
1013
|
+
isEditing ? /* @__PURE__ */ jsx9(
|
|
998
1014
|
"input",
|
|
999
1015
|
{
|
|
1000
1016
|
ref: inputRef,
|
|
@@ -1009,8 +1025,8 @@ var TransformedQueryChip = ({ value, onChange, onRemove }) => {
|
|
|
1009
1025
|
style: inputStyles2,
|
|
1010
1026
|
autoFocus: true
|
|
1011
1027
|
}
|
|
1012
|
-
) : /* @__PURE__ */
|
|
1013
|
-
!isEditing && /* @__PURE__ */
|
|
1028
|
+
) : /* @__PURE__ */ jsx9("span", { style: { fontSize: "16px" }, children: value }),
|
|
1029
|
+
!isEditing && /* @__PURE__ */ jsx9(
|
|
1014
1030
|
"button",
|
|
1015
1031
|
{
|
|
1016
1032
|
type: "button",
|
|
@@ -1023,10 +1039,10 @@ var TransformedQueryChip = ({ value, onChange, onRemove }) => {
|
|
|
1023
1039
|
onClick: () => setIsEditing(true),
|
|
1024
1040
|
onMouseEnter: () => setEditHover(true),
|
|
1025
1041
|
onMouseLeave: () => setEditHover(false),
|
|
1026
|
-
children: /* @__PURE__ */
|
|
1042
|
+
children: /* @__PURE__ */ jsx9(EditIcon, {})
|
|
1027
1043
|
}
|
|
1028
1044
|
),
|
|
1029
|
-
/* @__PURE__ */
|
|
1045
|
+
/* @__PURE__ */ jsx9(CloseButton, { onClick: onRemove })
|
|
1030
1046
|
] });
|
|
1031
1047
|
};
|
|
1032
1048
|
|
|
@@ -1081,7 +1097,7 @@ var useFilterScroll = (dependency) => {
|
|
|
1081
1097
|
};
|
|
1082
1098
|
|
|
1083
1099
|
// src/components/smart-filter/FilterChips.tsx
|
|
1084
|
-
import { jsx as
|
|
1100
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1085
1101
|
var containerStyles = {
|
|
1086
1102
|
position: "relative",
|
|
1087
1103
|
width: "100%"
|
|
@@ -1127,20 +1143,22 @@ var FilterChips = ({
|
|
|
1127
1143
|
formatCurrency: _formatCurrency,
|
|
1128
1144
|
onFilterChange,
|
|
1129
1145
|
onResetFilters: _onResetFilters,
|
|
1130
|
-
onClearAll
|
|
1146
|
+
onClearAll,
|
|
1147
|
+
beforeContent,
|
|
1148
|
+
styles
|
|
1131
1149
|
}) => {
|
|
1132
1150
|
const { scrollerRef, atStart, atEnd, scrollByDir } = useFilterScroll(
|
|
1133
1151
|
filters.length
|
|
1134
1152
|
);
|
|
1135
|
-
const [navHover, setNavHover] =
|
|
1136
|
-
const [clearHover, setClearHover] =
|
|
1137
|
-
const removeFilter =
|
|
1153
|
+
const [navHover, setNavHover] = React6.useState(null);
|
|
1154
|
+
const [clearHover, setClearHover] = React6.useState(false);
|
|
1155
|
+
const removeFilter = React6.useCallback(
|
|
1138
1156
|
(filterId) => {
|
|
1139
1157
|
void onFilterChange(filters.filter((f) => f.id !== filterId));
|
|
1140
1158
|
},
|
|
1141
1159
|
[filters, onFilterChange]
|
|
1142
1160
|
);
|
|
1143
|
-
const patchFilter =
|
|
1161
|
+
const patchFilter = React6.useCallback(
|
|
1144
1162
|
(filterId, patch) => {
|
|
1145
1163
|
const nextFilters = filters.map(
|
|
1146
1164
|
(f) => f.id === filterId ? { ...f, ...patch } : f
|
|
@@ -1157,22 +1175,25 @@ var FilterChips = ({
|
|
|
1157
1175
|
style: {
|
|
1158
1176
|
...scrollContainerBase,
|
|
1159
1177
|
padding: "8px",
|
|
1160
|
-
WebkitOverflowScrolling: "touch"
|
|
1178
|
+
WebkitOverflowScrolling: "touch",
|
|
1179
|
+
...styles == null ? void 0 : styles.scrollContainer
|
|
1161
1180
|
},
|
|
1162
1181
|
children: [
|
|
1163
|
-
/* @__PURE__ */
|
|
1182
|
+
/* @__PURE__ */ jsx10("style", { children: `
|
|
1164
1183
|
div::-webkit-scrollbar {
|
|
1165
1184
|
display: none;
|
|
1166
1185
|
}
|
|
1167
1186
|
` }),
|
|
1187
|
+
beforeContent,
|
|
1168
1188
|
filters.map((filter) => {
|
|
1169
1189
|
var _a, _b;
|
|
1170
|
-
const renderStandardChip = () => /* @__PURE__ */
|
|
1190
|
+
const renderStandardChip = () => /* @__PURE__ */ jsx10(
|
|
1171
1191
|
Chip,
|
|
1172
1192
|
{
|
|
1173
1193
|
label: filter.label,
|
|
1174
1194
|
icon: filter.icon,
|
|
1175
|
-
remove: () => removeFilter(filter.id)
|
|
1195
|
+
remove: () => removeFilter(filter.id),
|
|
1196
|
+
style: styles == null ? void 0 : styles.chip
|
|
1176
1197
|
},
|
|
1177
1198
|
filter.id
|
|
1178
1199
|
);
|
|
@@ -1181,7 +1202,7 @@ var FilterChips = ({
|
|
|
1181
1202
|
if (!Number.isFinite(currentRating)) {
|
|
1182
1203
|
return renderStandardChip();
|
|
1183
1204
|
}
|
|
1184
|
-
return /* @__PURE__ */
|
|
1205
|
+
return /* @__PURE__ */ jsx10(
|
|
1185
1206
|
MinRatingFilterChip,
|
|
1186
1207
|
{
|
|
1187
1208
|
star: filter.type === "starRating",
|
|
@@ -1192,13 +1213,14 @@ var FilterChips = ({
|
|
|
1192
1213
|
value: String(nextRating)
|
|
1193
1214
|
});
|
|
1194
1215
|
},
|
|
1195
|
-
onRemove: () => removeFilter(filter.id)
|
|
1216
|
+
onRemove: () => removeFilter(filter.id),
|
|
1217
|
+
style: styles == null ? void 0 : styles.minRatingChip
|
|
1196
1218
|
},
|
|
1197
1219
|
filter.id
|
|
1198
1220
|
);
|
|
1199
1221
|
}
|
|
1200
1222
|
if (filter.type === "priceRange" && filter.priceRange) {
|
|
1201
|
-
return /* @__PURE__ */
|
|
1223
|
+
return /* @__PURE__ */ jsx10(
|
|
1202
1224
|
PriceRangeFilterChip,
|
|
1203
1225
|
{
|
|
1204
1226
|
priceRange: filter.priceRange,
|
|
@@ -1206,40 +1228,43 @@ var FilterChips = ({
|
|
|
1206
1228
|
onChange: (nextRange) => {
|
|
1207
1229
|
patchFilter(filter.id, { priceRange: nextRange });
|
|
1208
1230
|
},
|
|
1209
|
-
onRemove: () => removeFilter(filter.id)
|
|
1231
|
+
onRemove: () => removeFilter(filter.id),
|
|
1232
|
+
style: styles == null ? void 0 : styles.priceRangeChip
|
|
1210
1233
|
},
|
|
1211
1234
|
filter.id
|
|
1212
1235
|
);
|
|
1213
1236
|
}
|
|
1214
1237
|
if (filter.type === "transformed_query") {
|
|
1215
|
-
return /* @__PURE__ */
|
|
1238
|
+
return /* @__PURE__ */ jsx10(
|
|
1216
1239
|
TransformedQueryChip,
|
|
1217
1240
|
{
|
|
1218
1241
|
value: filter.value,
|
|
1219
1242
|
onChange: (nextValue) => {
|
|
1220
1243
|
patchFilter(filter.id, { value: nextValue });
|
|
1221
1244
|
},
|
|
1222
|
-
onRemove: () => removeFilter(filter.id)
|
|
1245
|
+
onRemove: () => removeFilter(filter.id),
|
|
1246
|
+
style: styles == null ? void 0 : styles.transformedQueryChip
|
|
1223
1247
|
},
|
|
1224
1248
|
filter.id
|
|
1225
1249
|
);
|
|
1226
1250
|
}
|
|
1227
1251
|
if (filter.type === "selected_restaurant_price_levels") {
|
|
1228
|
-
return /* @__PURE__ */
|
|
1252
|
+
return /* @__PURE__ */ jsx10(
|
|
1229
1253
|
RestaurantPriceLevelChip,
|
|
1230
1254
|
{
|
|
1231
1255
|
values: (_b = filter.priceLevels) != null ? _b : [],
|
|
1232
1256
|
onChange: (nextLevels) => {
|
|
1233
1257
|
patchFilter(filter.id, { priceLevels: nextLevels });
|
|
1234
1258
|
},
|
|
1235
|
-
onRemove: () => removeFilter(filter.id)
|
|
1259
|
+
onRemove: () => removeFilter(filter.id),
|
|
1260
|
+
style: styles == null ? void 0 : styles.restaurantPriceLevelChip
|
|
1236
1261
|
},
|
|
1237
1262
|
filter.id
|
|
1238
1263
|
);
|
|
1239
1264
|
}
|
|
1240
1265
|
return renderStandardChip();
|
|
1241
1266
|
}),
|
|
1242
|
-
/* @__PURE__ */
|
|
1267
|
+
/* @__PURE__ */ jsx10(
|
|
1243
1268
|
"button",
|
|
1244
1269
|
{
|
|
1245
1270
|
style: {
|
|
@@ -1251,7 +1276,8 @@ var FilterChips = ({
|
|
|
1251
1276
|
userSelect: "none",
|
|
1252
1277
|
backgroundColor: clearHover ? "#e5e5e5" : "transparent",
|
|
1253
1278
|
color: "black",
|
|
1254
|
-
border: "none"
|
|
1279
|
+
border: "none",
|
|
1280
|
+
...styles == null ? void 0 : styles.clearAllButton
|
|
1255
1281
|
},
|
|
1256
1282
|
onClick: onClearAll,
|
|
1257
1283
|
onMouseEnter: () => setClearHover(true),
|
|
@@ -1262,7 +1288,7 @@ var FilterChips = ({
|
|
|
1262
1288
|
]
|
|
1263
1289
|
}
|
|
1264
1290
|
),
|
|
1265
|
-
!atStart && /* @__PURE__ */
|
|
1291
|
+
!atStart && /* @__PURE__ */ jsx10(
|
|
1266
1292
|
"div",
|
|
1267
1293
|
{
|
|
1268
1294
|
"aria-hidden": "true",
|
|
@@ -1273,7 +1299,7 @@ var FilterChips = ({
|
|
|
1273
1299
|
}
|
|
1274
1300
|
}
|
|
1275
1301
|
),
|
|
1276
|
-
!atEnd && /* @__PURE__ */
|
|
1302
|
+
!atEnd && /* @__PURE__ */ jsx10(
|
|
1277
1303
|
"div",
|
|
1278
1304
|
{
|
|
1279
1305
|
"aria-hidden": "true",
|
|
@@ -1284,7 +1310,7 @@ var FilterChips = ({
|
|
|
1284
1310
|
}
|
|
1285
1311
|
}
|
|
1286
1312
|
),
|
|
1287
|
-
!atStart && /* @__PURE__ */
|
|
1313
|
+
!atStart && /* @__PURE__ */ jsx10(
|
|
1288
1314
|
"button",
|
|
1289
1315
|
{
|
|
1290
1316
|
type: "button",
|
|
@@ -1293,15 +1319,16 @@ var FilterChips = ({
|
|
|
1293
1319
|
...navButtonStyles,
|
|
1294
1320
|
left: "4px",
|
|
1295
1321
|
transform: "translateY(-50%) rotate(180deg)",
|
|
1296
|
-
backgroundColor: navHover === "prev" ? "#e5e5e5" : "white"
|
|
1322
|
+
backgroundColor: navHover === "prev" ? "#e5e5e5" : "white",
|
|
1323
|
+
...styles == null ? void 0 : styles.navButton
|
|
1297
1324
|
},
|
|
1298
1325
|
onClick: () => scrollByDir("prev"),
|
|
1299
1326
|
onMouseEnter: () => setNavHover("prev"),
|
|
1300
1327
|
onMouseLeave: () => setNavHover(null),
|
|
1301
|
-
children: /* @__PURE__ */
|
|
1328
|
+
children: /* @__PURE__ */ jsx10(NextIcon, { style: { width: "20px", height: "20px" } })
|
|
1302
1329
|
}
|
|
1303
1330
|
),
|
|
1304
|
-
!atEnd && /* @__PURE__ */
|
|
1331
|
+
!atEnd && /* @__PURE__ */ jsx10(
|
|
1305
1332
|
"button",
|
|
1306
1333
|
{
|
|
1307
1334
|
type: "button",
|
|
@@ -1309,19 +1336,20 @@ var FilterChips = ({
|
|
|
1309
1336
|
style: {
|
|
1310
1337
|
...navButtonStyles,
|
|
1311
1338
|
right: "4px",
|
|
1312
|
-
backgroundColor: navHover === "next" ? "#e5e5e5" : "white"
|
|
1339
|
+
backgroundColor: navHover === "next" ? "#e5e5e5" : "white",
|
|
1340
|
+
...styles == null ? void 0 : styles.navButton
|
|
1313
1341
|
},
|
|
1314
1342
|
onClick: () => scrollByDir("next"),
|
|
1315
1343
|
onMouseEnter: () => setNavHover("next"),
|
|
1316
1344
|
onMouseLeave: () => setNavHover(null),
|
|
1317
|
-
children: /* @__PURE__ */
|
|
1345
|
+
children: /* @__PURE__ */ jsx10(NextIcon, { style: { width: "20px", height: "20px" } })
|
|
1318
1346
|
}
|
|
1319
1347
|
)
|
|
1320
1348
|
] });
|
|
1321
1349
|
};
|
|
1322
1350
|
|
|
1323
1351
|
// src/components/SmartFilter.tsx
|
|
1324
|
-
import { jsx as
|
|
1352
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1325
1353
|
var containerStyles2 = {
|
|
1326
1354
|
position: "relative",
|
|
1327
1355
|
display: "flex",
|
|
@@ -1335,6 +1363,8 @@ var SmartFilter = ({
|
|
|
1335
1363
|
onFilterChange,
|
|
1336
1364
|
customTranslations,
|
|
1337
1365
|
currency = "USD",
|
|
1366
|
+
beforeContent,
|
|
1367
|
+
styles,
|
|
1338
1368
|
containerStyle,
|
|
1339
1369
|
style
|
|
1340
1370
|
}) => {
|
|
@@ -1362,19 +1392,32 @@ var SmartFilter = ({
|
|
|
1362
1392
|
const clearAllFilters = useCallback3(() => {
|
|
1363
1393
|
void handleFilterChange([], true);
|
|
1364
1394
|
}, [handleFilterChange]);
|
|
1365
|
-
return /* @__PURE__ */
|
|
1366
|
-
|
|
1395
|
+
return /* @__PURE__ */ jsx11(TranslationProvider, { value: customTranslations, children: /* @__PURE__ */ jsx11(
|
|
1396
|
+
"div",
|
|
1367
1397
|
{
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1398
|
+
style: {
|
|
1399
|
+
...containerStyles2,
|
|
1400
|
+
...styles == null ? void 0 : styles.container,
|
|
1401
|
+
...containerStyle,
|
|
1402
|
+
...style
|
|
1403
|
+
},
|
|
1404
|
+
children: filters.length > 0 && /* @__PURE__ */ jsx11(
|
|
1405
|
+
FilterChips,
|
|
1406
|
+
{
|
|
1407
|
+
filters,
|
|
1408
|
+
currency,
|
|
1409
|
+
minRatingSuffix,
|
|
1410
|
+
clearAllLabel,
|
|
1411
|
+
previousFiltersLabel,
|
|
1412
|
+
nextFiltersLabel,
|
|
1413
|
+
formatCurrency,
|
|
1414
|
+
onFilterChange: handleFilterChange,
|
|
1415
|
+
onResetFilters: resetFilters,
|
|
1416
|
+
onClearAll: clearAllFilters,
|
|
1417
|
+
beforeContent,
|
|
1418
|
+
styles
|
|
1419
|
+
}
|
|
1420
|
+
)
|
|
1378
1421
|
}
|
|
1379
1422
|
) });
|
|
1380
1423
|
};
|
|
@@ -1393,12 +1436,12 @@ function attachMapOnce(instanceRef, attachedRef, map, config) {
|
|
|
1393
1436
|
attachedRef.current = true;
|
|
1394
1437
|
}
|
|
1395
1438
|
function useMapFirst(options) {
|
|
1396
|
-
const optionsRef =
|
|
1397
|
-
|
|
1439
|
+
const optionsRef = React7.useRef(options);
|
|
1440
|
+
React7.useEffect(() => {
|
|
1398
1441
|
optionsRef.current = options;
|
|
1399
1442
|
});
|
|
1400
|
-
const callbacksRef =
|
|
1401
|
-
const instanceRef =
|
|
1443
|
+
const callbacksRef = React7.useRef({});
|
|
1444
|
+
const instanceRef = React7.useRef(null);
|
|
1402
1445
|
if (instanceRef.current === null) {
|
|
1403
1446
|
instanceRef.current = new MapFirstCore({
|
|
1404
1447
|
adapter: null,
|
|
@@ -1406,10 +1449,10 @@ function useMapFirst(options) {
|
|
|
1406
1449
|
callbacks: callbacksRef.current
|
|
1407
1450
|
});
|
|
1408
1451
|
}
|
|
1409
|
-
const [state, setState] =
|
|
1452
|
+
const [state, setState] = React7.useState(
|
|
1410
1453
|
() => instanceRef.current.getState()
|
|
1411
1454
|
);
|
|
1412
|
-
|
|
1455
|
+
React7.useEffect(() => {
|
|
1413
1456
|
if (!instanceRef.current) {
|
|
1414
1457
|
callbacksRef.current = {};
|
|
1415
1458
|
instanceRef.current = new MapFirstCore({
|
|
@@ -1488,17 +1531,17 @@ function useMapFirst(options) {
|
|
|
1488
1531
|
instanceRef.current = null;
|
|
1489
1532
|
};
|
|
1490
1533
|
}, []);
|
|
1491
|
-
const setPrimaryType =
|
|
1534
|
+
const setPrimaryType = React7.useCallback((type) => {
|
|
1492
1535
|
if (instanceRef.current) {
|
|
1493
1536
|
instanceRef.current.setPrimaryType(type);
|
|
1494
1537
|
}
|
|
1495
1538
|
}, []);
|
|
1496
|
-
const setSelectedMarker =
|
|
1539
|
+
const setSelectedMarker = React7.useCallback((id) => {
|
|
1497
1540
|
if (instanceRef.current) {
|
|
1498
1541
|
instanceRef.current.setSelectedMarker(id);
|
|
1499
1542
|
}
|
|
1500
1543
|
}, []);
|
|
1501
|
-
const setUseApi =
|
|
1544
|
+
const setUseApi = React7.useCallback(
|
|
1502
1545
|
(useApi, autoLoad = true) => {
|
|
1503
1546
|
if (instanceRef.current) {
|
|
1504
1547
|
instanceRef.current.setUseApi(useApi, autoLoad);
|
|
@@ -1506,7 +1549,7 @@ function useMapFirst(options) {
|
|
|
1506
1549
|
},
|
|
1507
1550
|
[]
|
|
1508
1551
|
);
|
|
1509
|
-
const propertiesSearch =
|
|
1552
|
+
const propertiesSearch = React7.useCallback(
|
|
1510
1553
|
async (options2) => {
|
|
1511
1554
|
if (!instanceRef.current) {
|
|
1512
1555
|
throw new Error("MapFirst instance not available");
|
|
@@ -1515,7 +1558,7 @@ function useMapFirst(options) {
|
|
|
1515
1558
|
},
|
|
1516
1559
|
[]
|
|
1517
1560
|
);
|
|
1518
|
-
const smartFilterSearch =
|
|
1561
|
+
const smartFilterSearch = React7.useCallback(
|
|
1519
1562
|
async (options2) => {
|
|
1520
1563
|
if (!instanceRef.current) {
|
|
1521
1564
|
throw new Error("MapFirst instance not available");
|
|
@@ -1524,14 +1567,14 @@ function useMapFirst(options) {
|
|
|
1524
1567
|
},
|
|
1525
1568
|
[]
|
|
1526
1569
|
);
|
|
1527
|
-
const boundsSearch =
|
|
1570
|
+
const boundsSearch = React7.useCallback(async () => {
|
|
1528
1571
|
if (!instanceRef.current) {
|
|
1529
1572
|
return null;
|
|
1530
1573
|
}
|
|
1531
1574
|
return await instanceRef.current.performBoundsSearch();
|
|
1532
1575
|
}, []);
|
|
1533
|
-
const mapLibreAttachedRef =
|
|
1534
|
-
const attachMapLibre =
|
|
1576
|
+
const mapLibreAttachedRef = React7.useRef(false);
|
|
1577
|
+
const attachMapLibre = React7.useCallback(
|
|
1535
1578
|
(map, maplibregl, options2) => {
|
|
1536
1579
|
attachMapOnce(instanceRef, mapLibreAttachedRef, map, {
|
|
1537
1580
|
platform: "maplibre",
|
|
@@ -1542,8 +1585,8 @@ function useMapFirst(options) {
|
|
|
1542
1585
|
},
|
|
1543
1586
|
[]
|
|
1544
1587
|
);
|
|
1545
|
-
const googleMapsAttachedRef =
|
|
1546
|
-
const attachGoogle =
|
|
1588
|
+
const googleMapsAttachedRef = React7.useRef(false);
|
|
1589
|
+
const attachGoogle = React7.useCallback(
|
|
1547
1590
|
(map, google, options2) => {
|
|
1548
1591
|
attachMapOnce(instanceRef, googleMapsAttachedRef, map, {
|
|
1549
1592
|
platform: "google",
|
|
@@ -1554,8 +1597,8 @@ function useMapFirst(options) {
|
|
|
1554
1597
|
},
|
|
1555
1598
|
[]
|
|
1556
1599
|
);
|
|
1557
|
-
const mapboxAttachedRef =
|
|
1558
|
-
const attachMapbox =
|
|
1600
|
+
const mapboxAttachedRef = React7.useRef(false);
|
|
1601
|
+
const attachMapbox = React7.useCallback(
|
|
1559
1602
|
(map, mapboxgl, options2) => {
|
|
1560
1603
|
attachMapOnce(instanceRef, mapboxAttachedRef, map, {
|
|
1561
1604
|
platform: "mapbox",
|
|
@@ -1566,8 +1609,8 @@ function useMapFirst(options) {
|
|
|
1566
1609
|
},
|
|
1567
1610
|
[]
|
|
1568
1611
|
);
|
|
1569
|
-
const leafletAttachedRef =
|
|
1570
|
-
const attachLeaflet =
|
|
1612
|
+
const leafletAttachedRef = React7.useRef(false);
|
|
1613
|
+
const attachLeaflet = React7.useCallback(
|
|
1571
1614
|
(map, leaflet, options2) => {
|
|
1572
1615
|
if (!instanceRef.current || !map || leafletAttachedRef.current) return;
|
|
1573
1616
|
const adapter = new LeafletAdapter(map);
|