@mapfirst.ai/react 0.1.0 → 0.1.2
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 +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +170 -146
- package/dist/index.mjs +123 -101
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.tsx
|
|
2
|
-
import
|
|
2
|
+
import React8 from "react";
|
|
3
3
|
import {
|
|
4
4
|
MapFirstCore,
|
|
5
5
|
LeafletAdapter
|
|
@@ -21,9 +21,12 @@ import {
|
|
|
21
21
|
} from "react";
|
|
22
22
|
|
|
23
23
|
// src/components/smart-filter/FilterChips.tsx
|
|
24
|
-
import
|
|
24
|
+
import React7 from "react";
|
|
25
25
|
|
|
26
26
|
// src/components/smart-filter/CloseButton.tsx
|
|
27
|
+
import React2 from "react";
|
|
28
|
+
|
|
29
|
+
// src/context/IconsContext.tsx
|
|
27
30
|
import React from "react";
|
|
28
31
|
|
|
29
32
|
// src/components/Icons.tsx
|
|
@@ -77,7 +80,7 @@ var EditIcon = ({ className, style }) => /* @__PURE__ */ jsxs(
|
|
|
77
80
|
{
|
|
78
81
|
d: "M.75,17.5A.751.751,0,0,1,0,16.75V12.569a.755.755,0,0,1,.22-.53L11.461.8a2.72,2.72,0,0,1,3.848,0L16.7,2.191a2.72,2.72,0,0,1,0,3.848L5.462,17.28a.747.747,0,0,1-.531.22ZM1.5,12.879V16h3.12l7.91-7.91L9.41,4.97ZM13.591,7.03l2.051-2.051a1.223,1.223,0,0,0,0-1.727L14.249,1.858a1.222,1.222,0,0,0-1.727,0L10.47,3.91Z",
|
|
79
82
|
transform: "translate(3.25 3.25)",
|
|
80
|
-
fill: "
|
|
83
|
+
fill: "#141124"
|
|
81
84
|
}
|
|
82
85
|
)
|
|
83
86
|
]
|
|
@@ -118,8 +121,20 @@ var StarIcon = ({
|
|
|
118
121
|
}
|
|
119
122
|
);
|
|
120
123
|
|
|
121
|
-
// src/
|
|
124
|
+
// src/context/IconsContext.tsx
|
|
122
125
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
126
|
+
var defaultIcons = {
|
|
127
|
+
CloseIcon,
|
|
128
|
+
EditIcon,
|
|
129
|
+
NextIcon,
|
|
130
|
+
SearchIcon
|
|
131
|
+
};
|
|
132
|
+
var IconsContext = React.createContext(defaultIcons);
|
|
133
|
+
var IconsProvider = ({ value, children }) => /* @__PURE__ */ jsx2(IconsContext.Provider, { value: value ? { ...defaultIcons, ...value } : defaultIcons, children });
|
|
134
|
+
var useIcons = () => React.useContext(IconsContext);
|
|
135
|
+
|
|
136
|
+
// src/components/smart-filter/CloseButton.tsx
|
|
137
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
123
138
|
var closeButtonStyles = {
|
|
124
139
|
position: "absolute",
|
|
125
140
|
top: "-8px",
|
|
@@ -139,8 +154,9 @@ var iconStyles = {
|
|
|
139
154
|
height: "17px"
|
|
140
155
|
};
|
|
141
156
|
var CloseButton = ({ onClick, style }) => {
|
|
142
|
-
const [isHovering, setIsHovering] =
|
|
143
|
-
|
|
157
|
+
const [isHovering, setIsHovering] = React2.useState(false);
|
|
158
|
+
const { CloseIcon: CloseIcon2 } = useIcons();
|
|
159
|
+
return /* @__PURE__ */ jsx3(
|
|
144
160
|
"button",
|
|
145
161
|
{
|
|
146
162
|
style: {
|
|
@@ -152,13 +168,13 @@ var CloseButton = ({ onClick, style }) => {
|
|
|
152
168
|
onMouseEnter: () => setIsHovering(true),
|
|
153
169
|
onMouseLeave: () => setIsHovering(false),
|
|
154
170
|
"aria-label": "Remove filter",
|
|
155
|
-
children: /* @__PURE__ */
|
|
171
|
+
children: /* @__PURE__ */ jsx3(CloseIcon2, { style: iconStyles })
|
|
156
172
|
}
|
|
157
173
|
);
|
|
158
174
|
};
|
|
159
175
|
|
|
160
176
|
// src/components/smart-filter/Chip.tsx
|
|
161
|
-
import { jsx as
|
|
177
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
162
178
|
var chipStyles = {
|
|
163
179
|
position: "relative",
|
|
164
180
|
backgroundColor: "white",
|
|
@@ -176,9 +192,9 @@ var chipStyles = {
|
|
|
176
192
|
};
|
|
177
193
|
var Chip = ({ label, icon, remove, style }) => {
|
|
178
194
|
return /* @__PURE__ */ jsxs2("div", { style: { ...chipStyles, ...style }, children: [
|
|
179
|
-
icon && /* @__PURE__ */
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
-
/* @__PURE__ */
|
|
195
|
+
icon && /* @__PURE__ */ jsx4("span", { style: { display: "flex", alignItems: "center" }, children: icon }),
|
|
196
|
+
/* @__PURE__ */ jsx4("span", { style: { whiteSpace: "nowrap" }, children: label }),
|
|
197
|
+
/* @__PURE__ */ jsx4(CloseButton, { onClick: remove })
|
|
182
198
|
] });
|
|
183
199
|
};
|
|
184
200
|
|
|
@@ -191,11 +207,11 @@ import {
|
|
|
191
207
|
import { useCallback, useMemo, useState } from "react";
|
|
192
208
|
|
|
193
209
|
// src/context/TranslationContext.tsx
|
|
194
|
-
import
|
|
195
|
-
import { jsx as
|
|
196
|
-
var TranslationContext =
|
|
197
|
-
var TranslationProvider = ({ value, children }) => /* @__PURE__ */
|
|
198
|
-
var useCustomTranslationsContext = () =>
|
|
210
|
+
import React3 from "react";
|
|
211
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
212
|
+
var TranslationContext = React3.createContext(void 0);
|
|
213
|
+
var TranslationProvider = ({ value, children }) => /* @__PURE__ */ jsx5(TranslationContext.Provider, { value, children });
|
|
214
|
+
var useCustomTranslationsContext = () => React3.useContext(TranslationContext);
|
|
199
215
|
|
|
200
216
|
// src/hooks/useTranslation.ts
|
|
201
217
|
var defaultTranslations = {
|
|
@@ -269,7 +285,7 @@ var useTranslation = (customTranslations, customFormatCurrency) => {
|
|
|
269
285
|
};
|
|
270
286
|
|
|
271
287
|
// src/components/smart-filter/utils.tsx
|
|
272
|
-
import { jsx as
|
|
288
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
273
289
|
var STAR_BASE_STYLES = {
|
|
274
290
|
display: "block",
|
|
275
291
|
width: "12px",
|
|
@@ -301,19 +317,19 @@ var renderStars = (rating) => {
|
|
|
301
317
|
const fullStars = Math.floor(rating);
|
|
302
318
|
const hasHalfStar = rating % 1 !== 0;
|
|
303
319
|
for (let i = 0; i < fullStars; i += 1) {
|
|
304
|
-
stars.push(/* @__PURE__ */
|
|
320
|
+
stars.push(/* @__PURE__ */ jsx6("span", { style: STAR_FULL_STYLES }, `full-${i}`));
|
|
305
321
|
}
|
|
306
322
|
if (hasHalfStar) {
|
|
307
|
-
stars.push(/* @__PURE__ */
|
|
323
|
+
stars.push(/* @__PURE__ */ jsx6("span", { style: STAR_HALF_STYLES }, "half"));
|
|
308
324
|
}
|
|
309
325
|
const remainingStars = Math.max(0, 5 - Math.ceil(rating));
|
|
310
326
|
for (let i = 0; i < remainingStars; i += 1) {
|
|
311
|
-
stars.push(/* @__PURE__ */
|
|
327
|
+
stars.push(/* @__PURE__ */ jsx6("span", { style: STAR_BASE_STYLES }, `empty-${i}`));
|
|
312
328
|
}
|
|
313
329
|
return stars;
|
|
314
330
|
};
|
|
315
331
|
var createMinRatingFilterLabel = (rating, suffix) => /* @__PURE__ */ jsxs3("span", { style: MIN_RATING_LABEL_STYLES, children: [
|
|
316
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ jsx6("span", { style: MIN_RATING_STARS_WRAPPER_STYLES, children: renderStars(rating) }),
|
|
317
333
|
" ",
|
|
318
334
|
suffix
|
|
319
335
|
] });
|
|
@@ -324,7 +340,7 @@ var createPriceRangeFilterLabel = (min, max, currency, formatCurrencyFn) => `${f
|
|
|
324
340
|
)}`;
|
|
325
341
|
|
|
326
342
|
// src/components/smart-filter/MinRatingFilterChip.tsx
|
|
327
|
-
import { jsx as
|
|
343
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
328
344
|
var chipContainerStyles = {
|
|
329
345
|
position: "relative",
|
|
330
346
|
backgroundColor: "white",
|
|
@@ -401,7 +417,7 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false, style })
|
|
|
401
417
|
style: { display: "flex", alignItems: "center", gap: "4px" },
|
|
402
418
|
onMouseLeave: () => setHoverRating(null),
|
|
403
419
|
children: [
|
|
404
|
-
/* @__PURE__ */
|
|
420
|
+
/* @__PURE__ */ jsx7("div", { style: starContainerStyles, children: Array.from({ length: 5 }).map((_, index) => {
|
|
405
421
|
const fillState = getFillForStar(index);
|
|
406
422
|
const starNumber = index + 1;
|
|
407
423
|
const halfValue = starNumber - 0.5;
|
|
@@ -426,15 +442,15 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false, style })
|
|
|
426
442
|
},
|
|
427
443
|
xmlns: "http://www.w3.org/2000/svg",
|
|
428
444
|
children: [
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
/* @__PURE__ */
|
|
445
|
+
/* @__PURE__ */ jsx7("defs", { children: /* @__PURE__ */ jsxs4("linearGradient", { id: `star-gradient-${index}`, children: [
|
|
446
|
+
/* @__PURE__ */ jsx7(
|
|
431
447
|
"stop",
|
|
432
448
|
{
|
|
433
449
|
offset: fillState === "half" ? "50%" : "0%",
|
|
434
450
|
stopColor: "#03852e"
|
|
435
451
|
}
|
|
436
452
|
),
|
|
437
|
-
/* @__PURE__ */
|
|
453
|
+
/* @__PURE__ */ jsx7(
|
|
438
454
|
"stop",
|
|
439
455
|
{
|
|
440
456
|
offset: fillState === "half" ? "50%" : "0%",
|
|
@@ -442,7 +458,7 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false, style })
|
|
|
442
458
|
}
|
|
443
459
|
)
|
|
444
460
|
] }) }),
|
|
445
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ jsx7(
|
|
446
462
|
"path",
|
|
447
463
|
{
|
|
448
464
|
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",
|
|
@@ -454,7 +470,7 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false, style })
|
|
|
454
470
|
]
|
|
455
471
|
}
|
|
456
472
|
),
|
|
457
|
-
/* @__PURE__ */
|
|
473
|
+
/* @__PURE__ */ jsx7(
|
|
458
474
|
"button",
|
|
459
475
|
{
|
|
460
476
|
type: "button",
|
|
@@ -472,7 +488,7 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false, style })
|
|
|
472
488
|
title: formatLabel(halfValue)
|
|
473
489
|
}
|
|
474
490
|
),
|
|
475
|
-
/* @__PURE__ */
|
|
491
|
+
/* @__PURE__ */ jsx7(
|
|
476
492
|
"button",
|
|
477
493
|
{
|
|
478
494
|
type: "button",
|
|
@@ -505,13 +521,13 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false, style })
|
|
|
505
521
|
{
|
|
506
522
|
style: { position: "relative", width: "12px", height: "12px" },
|
|
507
523
|
children: [
|
|
508
|
-
/* @__PURE__ */
|
|
524
|
+
/* @__PURE__ */ jsx7(
|
|
509
525
|
"span",
|
|
510
526
|
{
|
|
511
527
|
style: fillState === "half" ? halfCircleStyles : circleStyles
|
|
512
528
|
}
|
|
513
529
|
),
|
|
514
|
-
/* @__PURE__ */
|
|
530
|
+
/* @__PURE__ */ jsx7(
|
|
515
531
|
"button",
|
|
516
532
|
{
|
|
517
533
|
type: "button",
|
|
@@ -531,7 +547,7 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false, style })
|
|
|
531
547
|
title: formatLabel(halfValue)
|
|
532
548
|
}
|
|
533
549
|
),
|
|
534
|
-
/* @__PURE__ */
|
|
550
|
+
/* @__PURE__ */ jsx7(
|
|
535
551
|
"button",
|
|
536
552
|
{
|
|
537
553
|
type: "button",
|
|
@@ -556,11 +572,11 @@ var MinRatingFilterChip = ({ rating, onChange, onRemove, star = false, style })
|
|
|
556
572
|
index
|
|
557
573
|
);
|
|
558
574
|
}) }),
|
|
559
|
-
/* @__PURE__ */
|
|
575
|
+
/* @__PURE__ */ jsx7("span", { style: { whiteSpace: "nowrap" }, children: formatLabel(displayRating) })
|
|
560
576
|
]
|
|
561
577
|
}
|
|
562
578
|
),
|
|
563
|
-
/* @__PURE__ */
|
|
579
|
+
/* @__PURE__ */ jsx7(CloseButton, { onClick: onRemove })
|
|
564
580
|
] });
|
|
565
581
|
};
|
|
566
582
|
|
|
@@ -569,7 +585,7 @@ import {
|
|
|
569
585
|
useEffect,
|
|
570
586
|
useState as useState3
|
|
571
587
|
} from "react";
|
|
572
|
-
import { Fragment, jsx as
|
|
588
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
573
589
|
var chipStyles2 = {
|
|
574
590
|
position: "relative",
|
|
575
591
|
backgroundColor: "white",
|
|
@@ -678,7 +694,7 @@ var PriceBoundaryChip = ({
|
|
|
678
694
|
}
|
|
679
695
|
};
|
|
680
696
|
return /* @__PURE__ */ jsxs5("div", { style: { ...chipStyles2, ...style }, children: [
|
|
681
|
-
/* @__PURE__ */
|
|
697
|
+
/* @__PURE__ */ jsx8(
|
|
682
698
|
"span",
|
|
683
699
|
{
|
|
684
700
|
style: {
|
|
@@ -690,7 +706,7 @@ var PriceBoundaryChip = ({
|
|
|
690
706
|
children: label
|
|
691
707
|
}
|
|
692
708
|
),
|
|
693
|
-
isEditing ? /* @__PURE__ */
|
|
709
|
+
isEditing ? /* @__PURE__ */ jsx8(
|
|
694
710
|
"input",
|
|
695
711
|
{
|
|
696
712
|
value: draft,
|
|
@@ -707,13 +723,13 @@ var PriceBoundaryChip = ({
|
|
|
707
723
|
style: inputStyles,
|
|
708
724
|
autoFocus: true
|
|
709
725
|
}
|
|
710
|
-
) : hasValue ? /* @__PURE__ */
|
|
726
|
+
) : hasValue ? /* @__PURE__ */ jsx8(
|
|
711
727
|
"span",
|
|
712
728
|
{
|
|
713
729
|
style: { fontSize: "16px", fontWeight: 600, textAlign: "center" },
|
|
714
730
|
children: value
|
|
715
731
|
}
|
|
716
|
-
) : showAddWhenEmpty ? /* @__PURE__ */
|
|
732
|
+
) : showAddWhenEmpty ? /* @__PURE__ */ jsx8(
|
|
717
733
|
"button",
|
|
718
734
|
{
|
|
719
735
|
type: "button",
|
|
@@ -729,8 +745,8 @@ var PriceBoundaryChip = ({
|
|
|
729
745
|
"aria-label": editLabel,
|
|
730
746
|
children: "+"
|
|
731
747
|
}
|
|
732
|
-
) : /* @__PURE__ */
|
|
733
|
-
(!showAddWhenEmpty || showAddWhenEmpty && isEditing) && /* @__PURE__ */
|
|
748
|
+
) : /* @__PURE__ */ jsx8("span", { style: { fontSize: "16px", color: "#737373" }, children: "-" }),
|
|
749
|
+
(!showAddWhenEmpty || showAddWhenEmpty && isEditing) && /* @__PURE__ */ jsx8(
|
|
734
750
|
"span",
|
|
735
751
|
{
|
|
736
752
|
style: {
|
|
@@ -742,7 +758,7 @@ var PriceBoundaryChip = ({
|
|
|
742
758
|
children: currency
|
|
743
759
|
}
|
|
744
760
|
),
|
|
745
|
-
!isEditing && (!showAddWhenEmpty || hasValue) && /* @__PURE__ */
|
|
761
|
+
!isEditing && (!showAddWhenEmpty || hasValue) && /* @__PURE__ */ jsx8(
|
|
746
762
|
"button",
|
|
747
763
|
{
|
|
748
764
|
type: "button",
|
|
@@ -755,10 +771,10 @@ var PriceBoundaryChip = ({
|
|
|
755
771
|
onClick: () => setIsEditing(true),
|
|
756
772
|
onMouseEnter: () => setEditHover(true),
|
|
757
773
|
onMouseLeave: () => setEditHover(false),
|
|
758
|
-
children: /* @__PURE__ */
|
|
774
|
+
children: /* @__PURE__ */ jsx8(EditIcon, {})
|
|
759
775
|
}
|
|
760
776
|
),
|
|
761
|
-
showRemoveButton && /* @__PURE__ */
|
|
777
|
+
showRemoveButton && /* @__PURE__ */ jsx8(CloseButton, { onClick: onRemove })
|
|
762
778
|
] });
|
|
763
779
|
};
|
|
764
780
|
var PriceRangeFilterChip = ({ priceRange, currency, onChange, onRemove, style }) => {
|
|
@@ -787,7 +803,7 @@ var PriceRangeFilterChip = ({ priceRange, currency, onChange, onRemove, style })
|
|
|
787
803
|
}
|
|
788
804
|
};
|
|
789
805
|
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
790
|
-
/* @__PURE__ */
|
|
806
|
+
/* @__PURE__ */ jsx8(
|
|
791
807
|
PriceBoundaryChip,
|
|
792
808
|
{
|
|
793
809
|
label: minLabel,
|
|
@@ -800,7 +816,7 @@ var PriceRangeFilterChip = ({ priceRange, currency, onChange, onRemove, style })
|
|
|
800
816
|
style
|
|
801
817
|
}
|
|
802
818
|
),
|
|
803
|
-
/* @__PURE__ */
|
|
819
|
+
/* @__PURE__ */ jsx8(
|
|
804
820
|
PriceBoundaryChip,
|
|
805
821
|
{
|
|
806
822
|
label: maxChipLabel,
|
|
@@ -819,7 +835,7 @@ var PriceRangeFilterChip = ({ priceRange, currency, onChange, onRemove, style })
|
|
|
819
835
|
};
|
|
820
836
|
|
|
821
837
|
// src/components/smart-filter/RestaurantPriceLevelChip.tsx
|
|
822
|
-
import { jsx as
|
|
838
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
823
839
|
var chipStyles3 = {
|
|
824
840
|
position: "relative",
|
|
825
841
|
backgroundColor: "white",
|
|
@@ -870,7 +886,7 @@ var RestaurantPriceLevelChip = ({ values, onChange, onRemove, style }) => {
|
|
|
870
886
|
flexWrap: "wrap"
|
|
871
887
|
},
|
|
872
888
|
children: [
|
|
873
|
-
/* @__PURE__ */
|
|
889
|
+
/* @__PURE__ */ jsx9(
|
|
874
890
|
"span",
|
|
875
891
|
{
|
|
876
892
|
style: {
|
|
@@ -900,7 +916,7 @@ var RestaurantPriceLevelChip = ({ values, onChange, onRemove, style }) => {
|
|
|
900
916
|
cursor: "pointer"
|
|
901
917
|
},
|
|
902
918
|
children: [
|
|
903
|
-
/* @__PURE__ */
|
|
919
|
+
/* @__PURE__ */ jsx9(
|
|
904
920
|
"input",
|
|
905
921
|
{
|
|
906
922
|
id: checkboxId,
|
|
@@ -911,18 +927,18 @@ var RestaurantPriceLevelChip = ({ values, onChange, onRemove, style }) => {
|
|
|
911
927
|
style: { accentColor: "#03852e", cursor: "pointer" }
|
|
912
928
|
}
|
|
913
929
|
),
|
|
914
|
-
/* @__PURE__ */
|
|
930
|
+
/* @__PURE__ */ jsx9("span", { children: optionLabel })
|
|
915
931
|
]
|
|
916
932
|
},
|
|
917
933
|
option.value
|
|
918
934
|
);
|
|
919
935
|
}),
|
|
920
|
-
values.length === 0 && /* @__PURE__ */
|
|
936
|
+
values.length === 0 && /* @__PURE__ */ jsx9("span", { style: { fontSize: "12px", color: "#737373" }, children: noneSelectedLabel })
|
|
921
937
|
] })
|
|
922
938
|
]
|
|
923
939
|
}
|
|
924
940
|
),
|
|
925
|
-
/* @__PURE__ */
|
|
941
|
+
/* @__PURE__ */ jsx9(CloseButton, { onClick: onRemove })
|
|
926
942
|
] });
|
|
927
943
|
};
|
|
928
944
|
|
|
@@ -932,7 +948,7 @@ import {
|
|
|
932
948
|
useRef,
|
|
933
949
|
useState as useState4
|
|
934
950
|
} from "react";
|
|
935
|
-
import { jsx as
|
|
951
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
936
952
|
var chipStyles4 = {
|
|
937
953
|
position: "relative",
|
|
938
954
|
backgroundColor: "white",
|
|
@@ -976,6 +992,7 @@ var TransformedQueryChip = ({ value, onChange, onRemove, style }) => {
|
|
|
976
992
|
const [isEditing, setIsEditing] = useState4(false);
|
|
977
993
|
const [editHover, setEditHover] = useState4(false);
|
|
978
994
|
const { t } = useTranslation();
|
|
995
|
+
const { SearchIcon: SearchIcon2, EditIcon: EditIcon2 } = useIcons();
|
|
979
996
|
const removeLabel = t("smartFilter.transformedQuery.remove");
|
|
980
997
|
const editLabel = t("smartFilter.transformedQuery.edit");
|
|
981
998
|
useEffect2(() => {
|
|
@@ -1010,8 +1027,8 @@ var TransformedQueryChip = ({ value, onChange, onRemove, style }) => {
|
|
|
1010
1027
|
}
|
|
1011
1028
|
};
|
|
1012
1029
|
return /* @__PURE__ */ jsxs7("div", { style: { ...chipStyles4, ...style }, children: [
|
|
1013
|
-
/* @__PURE__ */
|
|
1014
|
-
isEditing ? /* @__PURE__ */
|
|
1030
|
+
/* @__PURE__ */ jsx10(SearchIcon2, { style: { width: "16px", height: "16px", color: "#03852e" } }),
|
|
1031
|
+
isEditing ? /* @__PURE__ */ jsx10(
|
|
1015
1032
|
"input",
|
|
1016
1033
|
{
|
|
1017
1034
|
ref: inputRef,
|
|
@@ -1026,8 +1043,8 @@ var TransformedQueryChip = ({ value, onChange, onRemove, style }) => {
|
|
|
1026
1043
|
style: inputStyles2,
|
|
1027
1044
|
autoFocus: true
|
|
1028
1045
|
}
|
|
1029
|
-
) : /* @__PURE__ */
|
|
1030
|
-
!isEditing && /* @__PURE__ */
|
|
1046
|
+
) : /* @__PURE__ */ jsx10("span", { style: { fontSize: "16px" }, children: value }),
|
|
1047
|
+
!isEditing && /* @__PURE__ */ jsx10(
|
|
1031
1048
|
"button",
|
|
1032
1049
|
{
|
|
1033
1050
|
type: "button",
|
|
@@ -1040,10 +1057,10 @@ var TransformedQueryChip = ({ value, onChange, onRemove, style }) => {
|
|
|
1040
1057
|
onClick: () => setIsEditing(true),
|
|
1041
1058
|
onMouseEnter: () => setEditHover(true),
|
|
1042
1059
|
onMouseLeave: () => setEditHover(false),
|
|
1043
|
-
children: /* @__PURE__ */
|
|
1060
|
+
children: /* @__PURE__ */ jsx10(EditIcon2, {})
|
|
1044
1061
|
}
|
|
1045
1062
|
),
|
|
1046
|
-
/* @__PURE__ */
|
|
1063
|
+
/* @__PURE__ */ jsx10(CloseButton, { onClick: onRemove })
|
|
1047
1064
|
] });
|
|
1048
1065
|
};
|
|
1049
1066
|
|
|
@@ -1098,7 +1115,7 @@ var useFilterScroll = (dependency) => {
|
|
|
1098
1115
|
};
|
|
1099
1116
|
|
|
1100
1117
|
// src/components/smart-filter/FilterChips.tsx
|
|
1101
|
-
import { jsx as
|
|
1118
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1102
1119
|
var containerStyles = {
|
|
1103
1120
|
position: "relative",
|
|
1104
1121
|
width: "100%"
|
|
@@ -1151,15 +1168,16 @@ var FilterChips = ({
|
|
|
1151
1168
|
const { scrollerRef, atStart, atEnd, scrollByDir } = useFilterScroll(
|
|
1152
1169
|
filters.length
|
|
1153
1170
|
);
|
|
1154
|
-
const
|
|
1155
|
-
const [
|
|
1156
|
-
const
|
|
1171
|
+
const { NextIcon: NextIcon2 } = useIcons();
|
|
1172
|
+
const [navHover, setNavHover] = React7.useState(null);
|
|
1173
|
+
const [clearHover, setClearHover] = React7.useState(false);
|
|
1174
|
+
const removeFilter = React7.useCallback(
|
|
1157
1175
|
(filterId) => {
|
|
1158
1176
|
void onFilterChange(filters.filter((f) => f.id !== filterId));
|
|
1159
1177
|
},
|
|
1160
1178
|
[filters, onFilterChange]
|
|
1161
1179
|
);
|
|
1162
|
-
const patchFilter =
|
|
1180
|
+
const patchFilter = React7.useCallback(
|
|
1163
1181
|
(filterId, patch) => {
|
|
1164
1182
|
const nextFilters = filters.map(
|
|
1165
1183
|
(f) => f.id === filterId ? { ...f, ...patch } : f
|
|
@@ -1180,7 +1198,7 @@ var FilterChips = ({
|
|
|
1180
1198
|
...styles == null ? void 0 : styles.scrollContainer
|
|
1181
1199
|
},
|
|
1182
1200
|
children: [
|
|
1183
|
-
/* @__PURE__ */
|
|
1201
|
+
/* @__PURE__ */ jsx11("style", { children: `
|
|
1184
1202
|
div::-webkit-scrollbar {
|
|
1185
1203
|
display: none;
|
|
1186
1204
|
}
|
|
@@ -1188,7 +1206,7 @@ var FilterChips = ({
|
|
|
1188
1206
|
beforeContent,
|
|
1189
1207
|
filters.map((filter) => {
|
|
1190
1208
|
var _a, _b;
|
|
1191
|
-
const renderStandardChip = () => /* @__PURE__ */
|
|
1209
|
+
const renderStandardChip = () => /* @__PURE__ */ jsx11(
|
|
1192
1210
|
Chip,
|
|
1193
1211
|
{
|
|
1194
1212
|
label: filter.label,
|
|
@@ -1203,7 +1221,7 @@ var FilterChips = ({
|
|
|
1203
1221
|
if (!Number.isFinite(currentRating)) {
|
|
1204
1222
|
return renderStandardChip();
|
|
1205
1223
|
}
|
|
1206
|
-
return /* @__PURE__ */
|
|
1224
|
+
return /* @__PURE__ */ jsx11(
|
|
1207
1225
|
MinRatingFilterChip,
|
|
1208
1226
|
{
|
|
1209
1227
|
star: filter.type === "starRating",
|
|
@@ -1221,7 +1239,7 @@ var FilterChips = ({
|
|
|
1221
1239
|
);
|
|
1222
1240
|
}
|
|
1223
1241
|
if (filter.type === "priceRange" && filter.priceRange) {
|
|
1224
|
-
return /* @__PURE__ */
|
|
1242
|
+
return /* @__PURE__ */ jsx11(
|
|
1225
1243
|
PriceRangeFilterChip,
|
|
1226
1244
|
{
|
|
1227
1245
|
priceRange: filter.priceRange,
|
|
@@ -1236,7 +1254,7 @@ var FilterChips = ({
|
|
|
1236
1254
|
);
|
|
1237
1255
|
}
|
|
1238
1256
|
if (filter.type === "transformed_query") {
|
|
1239
|
-
return /* @__PURE__ */
|
|
1257
|
+
return /* @__PURE__ */ jsx11(
|
|
1240
1258
|
TransformedQueryChip,
|
|
1241
1259
|
{
|
|
1242
1260
|
value: filter.value,
|
|
@@ -1250,7 +1268,7 @@ var FilterChips = ({
|
|
|
1250
1268
|
);
|
|
1251
1269
|
}
|
|
1252
1270
|
if (filter.type === "selected_restaurant_price_levels") {
|
|
1253
|
-
return /* @__PURE__ */
|
|
1271
|
+
return /* @__PURE__ */ jsx11(
|
|
1254
1272
|
RestaurantPriceLevelChip,
|
|
1255
1273
|
{
|
|
1256
1274
|
values: (_b = filter.priceLevels) != null ? _b : [],
|
|
@@ -1265,9 +1283,10 @@ var FilterChips = ({
|
|
|
1265
1283
|
}
|
|
1266
1284
|
return renderStandardChip();
|
|
1267
1285
|
}),
|
|
1268
|
-
/* @__PURE__ */
|
|
1286
|
+
/* @__PURE__ */ jsx11(
|
|
1269
1287
|
"button",
|
|
1270
1288
|
{
|
|
1289
|
+
className: "mapfirst-clear-all-button",
|
|
1271
1290
|
style: {
|
|
1272
1291
|
flexShrink: 0,
|
|
1273
1292
|
padding: "4px 16px",
|
|
@@ -1289,7 +1308,7 @@ var FilterChips = ({
|
|
|
1289
1308
|
]
|
|
1290
1309
|
}
|
|
1291
1310
|
),
|
|
1292
|
-
!atStart && /* @__PURE__ */
|
|
1311
|
+
!atStart && /* @__PURE__ */ jsx11(
|
|
1293
1312
|
"div",
|
|
1294
1313
|
{
|
|
1295
1314
|
"aria-hidden": "true",
|
|
@@ -1300,7 +1319,7 @@ var FilterChips = ({
|
|
|
1300
1319
|
}
|
|
1301
1320
|
}
|
|
1302
1321
|
),
|
|
1303
|
-
!atEnd && /* @__PURE__ */
|
|
1322
|
+
!atEnd && /* @__PURE__ */ jsx11(
|
|
1304
1323
|
"div",
|
|
1305
1324
|
{
|
|
1306
1325
|
"aria-hidden": "true",
|
|
@@ -1311,7 +1330,7 @@ var FilterChips = ({
|
|
|
1311
1330
|
}
|
|
1312
1331
|
}
|
|
1313
1332
|
),
|
|
1314
|
-
!atStart && /* @__PURE__ */
|
|
1333
|
+
!atStart && /* @__PURE__ */ jsx11(
|
|
1315
1334
|
"button",
|
|
1316
1335
|
{
|
|
1317
1336
|
type: "button",
|
|
@@ -1326,10 +1345,10 @@ var FilterChips = ({
|
|
|
1326
1345
|
onClick: () => scrollByDir("prev"),
|
|
1327
1346
|
onMouseEnter: () => setNavHover("prev"),
|
|
1328
1347
|
onMouseLeave: () => setNavHover(null),
|
|
1329
|
-
children: /* @__PURE__ */
|
|
1348
|
+
children: /* @__PURE__ */ jsx11(NextIcon2, { style: { width: "20px", height: "20px" } })
|
|
1330
1349
|
}
|
|
1331
1350
|
),
|
|
1332
|
-
!atEnd && /* @__PURE__ */
|
|
1351
|
+
!atEnd && /* @__PURE__ */ jsx11(
|
|
1333
1352
|
"button",
|
|
1334
1353
|
{
|
|
1335
1354
|
type: "button",
|
|
@@ -1343,14 +1362,14 @@ var FilterChips = ({
|
|
|
1343
1362
|
onClick: () => scrollByDir("next"),
|
|
1344
1363
|
onMouseEnter: () => setNavHover("next"),
|
|
1345
1364
|
onMouseLeave: () => setNavHover(null),
|
|
1346
|
-
children: /* @__PURE__ */
|
|
1365
|
+
children: /* @__PURE__ */ jsx11(NextIcon2, { style: { width: "20px", height: "20px" } })
|
|
1347
1366
|
}
|
|
1348
1367
|
)
|
|
1349
1368
|
] });
|
|
1350
1369
|
};
|
|
1351
1370
|
|
|
1352
1371
|
// src/components/SmartFilter.tsx
|
|
1353
|
-
import { jsx as
|
|
1372
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1354
1373
|
var containerStyles2 = {
|
|
1355
1374
|
position: "relative",
|
|
1356
1375
|
display: "flex",
|
|
@@ -1366,6 +1385,7 @@ var SmartFilter = ({
|
|
|
1366
1385
|
currency = "USD",
|
|
1367
1386
|
beforeContent,
|
|
1368
1387
|
styles,
|
|
1388
|
+
customIcons,
|
|
1369
1389
|
containerStyle,
|
|
1370
1390
|
style
|
|
1371
1391
|
}) => {
|
|
@@ -1393,7 +1413,7 @@ var SmartFilter = ({
|
|
|
1393
1413
|
const clearAllFilters = useCallback3(() => {
|
|
1394
1414
|
void handleFilterChange([], true);
|
|
1395
1415
|
}, [handleFilterChange]);
|
|
1396
|
-
return /* @__PURE__ */
|
|
1416
|
+
return /* @__PURE__ */ jsx12(IconsProvider, { value: customIcons, children: /* @__PURE__ */ jsx12(TranslationProvider, { value: customTranslations, children: /* @__PURE__ */ jsx12(
|
|
1397
1417
|
"div",
|
|
1398
1418
|
{
|
|
1399
1419
|
style: {
|
|
@@ -1402,7 +1422,7 @@ var SmartFilter = ({
|
|
|
1402
1422
|
...containerStyle,
|
|
1403
1423
|
...style
|
|
1404
1424
|
},
|
|
1405
|
-
children: filters.length > 0 && /* @__PURE__ */
|
|
1425
|
+
children: filters.length > 0 && /* @__PURE__ */ jsx12(
|
|
1406
1426
|
FilterChips,
|
|
1407
1427
|
{
|
|
1408
1428
|
filters,
|
|
@@ -1420,7 +1440,7 @@ var SmartFilter = ({
|
|
|
1420
1440
|
}
|
|
1421
1441
|
)
|
|
1422
1442
|
}
|
|
1423
|
-
) });
|
|
1443
|
+
) }) });
|
|
1424
1444
|
};
|
|
1425
1445
|
|
|
1426
1446
|
// src/index.tsx
|
|
@@ -1437,12 +1457,12 @@ function attachMapOnce(instanceRef, attachedRef, map, config) {
|
|
|
1437
1457
|
attachedRef.current = true;
|
|
1438
1458
|
}
|
|
1439
1459
|
function useMapFirst(options) {
|
|
1440
|
-
const optionsRef =
|
|
1441
|
-
|
|
1460
|
+
const optionsRef = React8.useRef(options);
|
|
1461
|
+
React8.useEffect(() => {
|
|
1442
1462
|
optionsRef.current = options;
|
|
1443
1463
|
});
|
|
1444
|
-
const callbacksRef =
|
|
1445
|
-
const instanceRef =
|
|
1464
|
+
const callbacksRef = React8.useRef({});
|
|
1465
|
+
const instanceRef = React8.useRef(null);
|
|
1446
1466
|
if (instanceRef.current === null) {
|
|
1447
1467
|
instanceRef.current = new MapFirstCore({
|
|
1448
1468
|
adapter: null,
|
|
@@ -1450,10 +1470,10 @@ function useMapFirst(options) {
|
|
|
1450
1470
|
callbacks: callbacksRef.current
|
|
1451
1471
|
});
|
|
1452
1472
|
}
|
|
1453
|
-
const [state, setState] =
|
|
1473
|
+
const [state, setState] = React8.useState(
|
|
1454
1474
|
() => instanceRef.current.getState()
|
|
1455
1475
|
);
|
|
1456
|
-
|
|
1476
|
+
React8.useEffect(() => {
|
|
1457
1477
|
if (!instanceRef.current) {
|
|
1458
1478
|
callbacksRef.current = {};
|
|
1459
1479
|
instanceRef.current = new MapFirstCore({
|
|
@@ -1532,17 +1552,17 @@ function useMapFirst(options) {
|
|
|
1532
1552
|
instanceRef.current = null;
|
|
1533
1553
|
};
|
|
1534
1554
|
}, []);
|
|
1535
|
-
const setPrimaryType =
|
|
1555
|
+
const setPrimaryType = React8.useCallback((type) => {
|
|
1536
1556
|
if (instanceRef.current) {
|
|
1537
1557
|
instanceRef.current.setPrimaryType(type);
|
|
1538
1558
|
}
|
|
1539
1559
|
}, []);
|
|
1540
|
-
const setSelectedMarker =
|
|
1560
|
+
const setSelectedMarker = React8.useCallback((id) => {
|
|
1541
1561
|
if (instanceRef.current) {
|
|
1542
1562
|
instanceRef.current.setSelectedMarker(id);
|
|
1543
1563
|
}
|
|
1544
1564
|
}, []);
|
|
1545
|
-
const setUseApi =
|
|
1565
|
+
const setUseApi = React8.useCallback(
|
|
1546
1566
|
(useApi, autoLoad = true) => {
|
|
1547
1567
|
if (instanceRef.current) {
|
|
1548
1568
|
instanceRef.current.setUseApi(useApi, autoLoad);
|
|
@@ -1550,7 +1570,7 @@ function useMapFirst(options) {
|
|
|
1550
1570
|
},
|
|
1551
1571
|
[]
|
|
1552
1572
|
);
|
|
1553
|
-
const propertiesSearch =
|
|
1573
|
+
const propertiesSearch = React8.useCallback(
|
|
1554
1574
|
async (options2) => {
|
|
1555
1575
|
if (!instanceRef.current) {
|
|
1556
1576
|
throw new Error("MapFirst instance not available");
|
|
@@ -1559,7 +1579,7 @@ function useMapFirst(options) {
|
|
|
1559
1579
|
},
|
|
1560
1580
|
[]
|
|
1561
1581
|
);
|
|
1562
|
-
const smartFilterSearch =
|
|
1582
|
+
const smartFilterSearch = React8.useCallback(
|
|
1563
1583
|
async (options2) => {
|
|
1564
1584
|
if (!instanceRef.current) {
|
|
1565
1585
|
throw new Error("MapFirst instance not available");
|
|
@@ -1568,14 +1588,14 @@ function useMapFirst(options) {
|
|
|
1568
1588
|
},
|
|
1569
1589
|
[]
|
|
1570
1590
|
);
|
|
1571
|
-
const boundsSearch =
|
|
1591
|
+
const boundsSearch = React8.useCallback(async () => {
|
|
1572
1592
|
if (!instanceRef.current) {
|
|
1573
1593
|
return null;
|
|
1574
1594
|
}
|
|
1575
1595
|
return await instanceRef.current.performBoundsSearch();
|
|
1576
1596
|
}, []);
|
|
1577
|
-
const mapLibreAttachedRef =
|
|
1578
|
-
const attachMapLibre =
|
|
1597
|
+
const mapLibreAttachedRef = React8.useRef(false);
|
|
1598
|
+
const attachMapLibre = React8.useCallback(
|
|
1579
1599
|
(map, maplibregl, options2) => {
|
|
1580
1600
|
attachMapOnce(instanceRef, mapLibreAttachedRef, map, {
|
|
1581
1601
|
platform: "maplibre",
|
|
@@ -1586,8 +1606,8 @@ function useMapFirst(options) {
|
|
|
1586
1606
|
},
|
|
1587
1607
|
[]
|
|
1588
1608
|
);
|
|
1589
|
-
const googleMapsAttachedRef =
|
|
1590
|
-
const attachGoogle =
|
|
1609
|
+
const googleMapsAttachedRef = React8.useRef(false);
|
|
1610
|
+
const attachGoogle = React8.useCallback(
|
|
1591
1611
|
(map, google, options2) => {
|
|
1592
1612
|
attachMapOnce(instanceRef, googleMapsAttachedRef, map, {
|
|
1593
1613
|
platform: "google",
|
|
@@ -1598,8 +1618,8 @@ function useMapFirst(options) {
|
|
|
1598
1618
|
},
|
|
1599
1619
|
[]
|
|
1600
1620
|
);
|
|
1601
|
-
const mapboxAttachedRef =
|
|
1602
|
-
const attachMapbox =
|
|
1621
|
+
const mapboxAttachedRef = React8.useRef(false);
|
|
1622
|
+
const attachMapbox = React8.useCallback(
|
|
1603
1623
|
(map, mapboxgl, options2) => {
|
|
1604
1624
|
attachMapOnce(instanceRef, mapboxAttachedRef, map, {
|
|
1605
1625
|
platform: "mapbox",
|
|
@@ -1610,8 +1630,8 @@ function useMapFirst(options) {
|
|
|
1610
1630
|
},
|
|
1611
1631
|
[]
|
|
1612
1632
|
);
|
|
1613
|
-
const leafletAttachedRef =
|
|
1614
|
-
const attachLeaflet =
|
|
1633
|
+
const leafletAttachedRef = React8.useRef(false);
|
|
1634
|
+
const attachLeaflet = React8.useCallback(
|
|
1615
1635
|
(map, leaflet, options2) => {
|
|
1616
1636
|
if (!instanceRef.current || !map || leafletAttachedRef.current) return;
|
|
1617
1637
|
const adapter = new LeafletAdapter(map);
|
|
@@ -1672,6 +1692,7 @@ export {
|
|
|
1672
1692
|
CloseIcon,
|
|
1673
1693
|
EditIcon,
|
|
1674
1694
|
FilterChips,
|
|
1695
|
+
IconsProvider,
|
|
1675
1696
|
LeafletAdapter2 as LeafletAdapter,
|
|
1676
1697
|
MapFirstCore2 as MapFirstCore,
|
|
1677
1698
|
MinRatingFilterChip,
|
|
@@ -1693,6 +1714,7 @@ export {
|
|
|
1693
1714
|
processApiFilters,
|
|
1694
1715
|
renderStars,
|
|
1695
1716
|
useFilterScroll,
|
|
1717
|
+
useIcons,
|
|
1696
1718
|
useMapFirst,
|
|
1697
1719
|
useTranslation
|
|
1698
1720
|
};
|