@mapfirst.ai/react 0.0.86 → 0.0.88
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 +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +48 -1
- package/dist/index.mjs +51 -3
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _mapfirst_ai_core from '@mapfirst.ai/core';
|
|
2
|
-
import { PropertyType, PriceLevel, BaseMapFirstOptions, MapFirstCore, MapState, Property, MapLibreNamespace, MarkerOptions, GoogleMapsNamespace, MapboxNamespace } from '@mapfirst.ai/core';
|
|
3
|
-
export { ActiveLocation, ApiFiltersResponse, BaseMapFirstOptions, Environment, FilterSchema, FilterState, GoogleMapsNamespace, MapBounds, MapFirstCore, MapFirstOptions, MapLibreNamespace, MapState, MapStateCallbacks, MapStateUpdate, MapboxNamespace, Price, PriceLevel, PropertiesFetchError, Property, PropertyType, TripAdvisorImage, TripAdvisorImageResponse, ViewState, convertToApiFilters, fetchImages, fetchProperties, processApiFilters } from '@mapfirst.ai/core';
|
|
2
|
+
import { PropertyType, PriceLevel, BaseMapFirstOptions, MapFirstCore, MapState, Property, MapLibreNamespace, MarkerOptions, GoogleMapsNamespace, MapboxNamespace, LeafletNamespace } from '@mapfirst.ai/core';
|
|
3
|
+
export { ActiveLocation, ApiFiltersResponse, BaseMapFirstOptions, Environment, FilterSchema, FilterState, GoogleMapsNamespace, LeafletAdapter, MapBounds, MapFirstCore, MapFirstOptions, MapLibreNamespace, MapState, MapStateCallbacks, MapStateUpdate, MapboxNamespace, Price, PriceLevel, PropertiesFetchError, Property, PropertyType, TripAdvisorImage, TripAdvisorImageResponse, ViewState, convertToApiFilters, fetchImages, fetchProperties, isWebGLSupported, processApiFilters } from '@mapfirst.ai/core';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import React__default, { FunctionComponent, CSSProperties, ReactNode } from 'react';
|
|
6
6
|
|
|
@@ -297,6 +297,10 @@ declare function useMapFirst(options: BaseMapFirstOptions): {
|
|
|
297
297
|
onMarkerClick?: (marker: Property) => void;
|
|
298
298
|
markerOptions?: MarkerOptions;
|
|
299
299
|
}) => void;
|
|
300
|
+
attachLeaflet: (map: any, leaflet: LeafletNamespace, options?: {
|
|
301
|
+
onMarkerClick?: (marker: Property) => void;
|
|
302
|
+
markerOptions?: MarkerOptions;
|
|
303
|
+
}) => void;
|
|
300
304
|
};
|
|
301
305
|
|
|
302
306
|
export { Chip, type ChipProps, CloseIcon, EditIcon, type Filter, FilterChips, type FilterChipsProps, type IconProps, type Locale, MinRatingFilterChip, NextIcon, PriceRangeFilterChip, type PriceRangeValue, RestaurantPriceLevelChip, type RestaurantPriceLevelChipProps, SearchIcon, SmartFilter$1 as SmartFilter, type SmartFilterProps, StarIcon, TransformedQueryChip, type TransformedQueryChipProps, createMinRatingFilterLabel, createPriceRangeFilterLabel, formatRatingValue, renderStars, useFilterScroll, useMapFirst, useTranslation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _mapfirst_ai_core from '@mapfirst.ai/core';
|
|
2
|
-
import { PropertyType, PriceLevel, BaseMapFirstOptions, MapFirstCore, MapState, Property, MapLibreNamespace, MarkerOptions, GoogleMapsNamespace, MapboxNamespace } from '@mapfirst.ai/core';
|
|
3
|
-
export { ActiveLocation, ApiFiltersResponse, BaseMapFirstOptions, Environment, FilterSchema, FilterState, GoogleMapsNamespace, MapBounds, MapFirstCore, MapFirstOptions, MapLibreNamespace, MapState, MapStateCallbacks, MapStateUpdate, MapboxNamespace, Price, PriceLevel, PropertiesFetchError, Property, PropertyType, TripAdvisorImage, TripAdvisorImageResponse, ViewState, convertToApiFilters, fetchImages, fetchProperties, processApiFilters } from '@mapfirst.ai/core';
|
|
2
|
+
import { PropertyType, PriceLevel, BaseMapFirstOptions, MapFirstCore, MapState, Property, MapLibreNamespace, MarkerOptions, GoogleMapsNamespace, MapboxNamespace, LeafletNamespace } from '@mapfirst.ai/core';
|
|
3
|
+
export { ActiveLocation, ApiFiltersResponse, BaseMapFirstOptions, Environment, FilterSchema, FilterState, GoogleMapsNamespace, LeafletAdapter, MapBounds, MapFirstCore, MapFirstOptions, MapLibreNamespace, MapState, MapStateCallbacks, MapStateUpdate, MapboxNamespace, Price, PriceLevel, PropertiesFetchError, Property, PropertyType, TripAdvisorImage, TripAdvisorImageResponse, ViewState, convertToApiFilters, fetchImages, fetchProperties, isWebGLSupported, processApiFilters } from '@mapfirst.ai/core';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import React__default, { FunctionComponent, CSSProperties, ReactNode } from 'react';
|
|
6
6
|
|
|
@@ -297,6 +297,10 @@ declare function useMapFirst(options: BaseMapFirstOptions): {
|
|
|
297
297
|
onMarkerClick?: (marker: Property) => void;
|
|
298
298
|
markerOptions?: MarkerOptions;
|
|
299
299
|
}) => void;
|
|
300
|
+
attachLeaflet: (map: any, leaflet: LeafletNamespace, options?: {
|
|
301
|
+
onMarkerClick?: (marker: Property) => void;
|
|
302
|
+
markerOptions?: MarkerOptions;
|
|
303
|
+
}) => void;
|
|
300
304
|
};
|
|
301
305
|
|
|
302
306
|
export { Chip, type ChipProps, CloseIcon, EditIcon, type Filter, FilterChips, type FilterChipsProps, type IconProps, type Locale, MinRatingFilterChip, NextIcon, PriceRangeFilterChip, type PriceRangeValue, RestaurantPriceLevelChip, type RestaurantPriceLevelChipProps, SearchIcon, SmartFilter$1 as SmartFilter, type SmartFilterProps, StarIcon, TransformedQueryChip, type TransformedQueryChipProps, createMinRatingFilterLabel, createPriceRangeFilterLabel, formatRatingValue, renderStars, useFilterScroll, useMapFirst, useTranslation };
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
CloseIcon: () => CloseIcon,
|
|
35
35
|
EditIcon: () => EditIcon,
|
|
36
36
|
FilterChips: () => FilterChips,
|
|
37
|
+
LeafletAdapter: () => import_core2.LeafletAdapter,
|
|
37
38
|
MapFirstCore: () => import_core2.MapFirstCore,
|
|
38
39
|
MinRatingFilterChip: () => MinRatingFilterChip,
|
|
39
40
|
NextIcon: () => NextIcon,
|
|
@@ -50,6 +51,7 @@ __export(index_exports, {
|
|
|
50
51
|
fetchImages: () => import_core2.fetchImages,
|
|
51
52
|
fetchProperties: () => import_core2.fetchProperties,
|
|
52
53
|
formatRatingValue: () => formatRatingValue,
|
|
54
|
+
isWebGLSupported: () => import_core2.isWebGLSupported,
|
|
53
55
|
processApiFilters: () => import_core2.processApiFilters,
|
|
54
56
|
renderStars: () => renderStars,
|
|
55
57
|
useFilterScroll: () => useFilterScroll,
|
|
@@ -1562,6 +1564,48 @@ function useMapFirst(options) {
|
|
|
1562
1564
|
},
|
|
1563
1565
|
[]
|
|
1564
1566
|
);
|
|
1567
|
+
const leafletAttachedRef = import_react9.default.useRef(false);
|
|
1568
|
+
const attachLeaflet = import_react9.default.useCallback(
|
|
1569
|
+
(map, leaflet, options2) => {
|
|
1570
|
+
if (!instanceRef.current || !map || leafletAttachedRef.current) return;
|
|
1571
|
+
const adapter = new import_core.LeafletAdapter(map);
|
|
1572
|
+
adapter.initialize({
|
|
1573
|
+
leaflet,
|
|
1574
|
+
onMarkerClick: (marker) => {
|
|
1575
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1576
|
+
if (marker.location) {
|
|
1577
|
+
(_a = instanceRef.current) == null ? void 0 : _a.flyMapTo(
|
|
1578
|
+
marker.location.lon,
|
|
1579
|
+
marker.location.lat,
|
|
1580
|
+
14
|
|
1581
|
+
);
|
|
1582
|
+
}
|
|
1583
|
+
if (marker.type !== ((_b = instanceRef.current) == null ? void 0 : _b.primaryType)) {
|
|
1584
|
+
(_c = instanceRef.current) == null ? void 0 : _c.setPrimaryType(marker.type);
|
|
1585
|
+
}
|
|
1586
|
+
(_e = instanceRef.current) == null ? void 0 : _e.setSelectedMarker(
|
|
1587
|
+
marker.tripadvisor_id === ((_d = instanceRef.current) == null ? void 0 : _d.selectedMarkerId) ? null : marker.tripadvisor_id
|
|
1588
|
+
);
|
|
1589
|
+
(_f = options2 == null ? void 0 : options2.onMarkerClick) == null ? void 0 : _f.call(options2, marker);
|
|
1590
|
+
},
|
|
1591
|
+
markerOptions: options2 == null ? void 0 : options2.markerOptions,
|
|
1592
|
+
onRefresh: () => {
|
|
1593
|
+
var _a;
|
|
1594
|
+
return (_a = instanceRef.current) == null ? void 0 : _a.refresh();
|
|
1595
|
+
},
|
|
1596
|
+
onMapMoveEnd: (bounds) => {
|
|
1597
|
+
var _a;
|
|
1598
|
+
return (_a = instanceRef.current) == null ? void 0 : _a.setBounds(bounds);
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1601
|
+
instanceRef.current.adapter = adapter;
|
|
1602
|
+
instanceRef.current.isMapAttached = true;
|
|
1603
|
+
instanceRef.current.currentPlatform = "leaflet";
|
|
1604
|
+
instanceRef.current.refresh();
|
|
1605
|
+
leafletAttachedRef.current = true;
|
|
1606
|
+
},
|
|
1607
|
+
[]
|
|
1608
|
+
);
|
|
1565
1609
|
return {
|
|
1566
1610
|
instance: instanceRef.current,
|
|
1567
1611
|
state,
|
|
@@ -1573,7 +1617,8 @@ function useMapFirst(options) {
|
|
|
1573
1617
|
boundsSearch,
|
|
1574
1618
|
attachMapLibre,
|
|
1575
1619
|
attachGoogle,
|
|
1576
|
-
attachMapbox
|
|
1620
|
+
attachMapbox,
|
|
1621
|
+
attachLeaflet
|
|
1577
1622
|
};
|
|
1578
1623
|
}
|
|
1579
1624
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1582,6 +1627,7 @@ function useMapFirst(options) {
|
|
|
1582
1627
|
CloseIcon,
|
|
1583
1628
|
EditIcon,
|
|
1584
1629
|
FilterChips,
|
|
1630
|
+
LeafletAdapter,
|
|
1585
1631
|
MapFirstCore,
|
|
1586
1632
|
MinRatingFilterChip,
|
|
1587
1633
|
NextIcon,
|
|
@@ -1598,6 +1644,7 @@ function useMapFirst(options) {
|
|
|
1598
1644
|
fetchImages,
|
|
1599
1645
|
fetchProperties,
|
|
1600
1646
|
formatRatingValue,
|
|
1647
|
+
isWebGLSupported,
|
|
1601
1648
|
processApiFilters,
|
|
1602
1649
|
renderStars,
|
|
1603
1650
|
useFilterScroll,
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/index.tsx
|
|
2
2
|
import React6 from "react";
|
|
3
3
|
import {
|
|
4
|
-
MapFirstCore
|
|
4
|
+
MapFirstCore,
|
|
5
|
+
LeafletAdapter
|
|
5
6
|
} from "@mapfirst.ai/core";
|
|
6
7
|
import {
|
|
7
8
|
processApiFilters,
|
|
@@ -9,7 +10,9 @@ import {
|
|
|
9
10
|
PropertiesFetchError,
|
|
10
11
|
fetchImages,
|
|
11
12
|
fetchProperties,
|
|
12
|
-
MapFirstCore as MapFirstCore2
|
|
13
|
+
MapFirstCore as MapFirstCore2,
|
|
14
|
+
LeafletAdapter as LeafletAdapter2,
|
|
15
|
+
isWebGLSupported
|
|
13
16
|
} from "@mapfirst.ai/core";
|
|
14
17
|
|
|
15
18
|
// src/components/SmartFilter.tsx
|
|
@@ -1522,6 +1525,48 @@ function useMapFirst(options) {
|
|
|
1522
1525
|
},
|
|
1523
1526
|
[]
|
|
1524
1527
|
);
|
|
1528
|
+
const leafletAttachedRef = React6.useRef(false);
|
|
1529
|
+
const attachLeaflet = React6.useCallback(
|
|
1530
|
+
(map, leaflet, options2) => {
|
|
1531
|
+
if (!instanceRef.current || !map || leafletAttachedRef.current) return;
|
|
1532
|
+
const adapter = new LeafletAdapter(map);
|
|
1533
|
+
adapter.initialize({
|
|
1534
|
+
leaflet,
|
|
1535
|
+
onMarkerClick: (marker) => {
|
|
1536
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1537
|
+
if (marker.location) {
|
|
1538
|
+
(_a = instanceRef.current) == null ? void 0 : _a.flyMapTo(
|
|
1539
|
+
marker.location.lon,
|
|
1540
|
+
marker.location.lat,
|
|
1541
|
+
14
|
|
1542
|
+
);
|
|
1543
|
+
}
|
|
1544
|
+
if (marker.type !== ((_b = instanceRef.current) == null ? void 0 : _b.primaryType)) {
|
|
1545
|
+
(_c = instanceRef.current) == null ? void 0 : _c.setPrimaryType(marker.type);
|
|
1546
|
+
}
|
|
1547
|
+
(_e = instanceRef.current) == null ? void 0 : _e.setSelectedMarker(
|
|
1548
|
+
marker.tripadvisor_id === ((_d = instanceRef.current) == null ? void 0 : _d.selectedMarkerId) ? null : marker.tripadvisor_id
|
|
1549
|
+
);
|
|
1550
|
+
(_f = options2 == null ? void 0 : options2.onMarkerClick) == null ? void 0 : _f.call(options2, marker);
|
|
1551
|
+
},
|
|
1552
|
+
markerOptions: options2 == null ? void 0 : options2.markerOptions,
|
|
1553
|
+
onRefresh: () => {
|
|
1554
|
+
var _a;
|
|
1555
|
+
return (_a = instanceRef.current) == null ? void 0 : _a.refresh();
|
|
1556
|
+
},
|
|
1557
|
+
onMapMoveEnd: (bounds) => {
|
|
1558
|
+
var _a;
|
|
1559
|
+
return (_a = instanceRef.current) == null ? void 0 : _a.setBounds(bounds);
|
|
1560
|
+
}
|
|
1561
|
+
});
|
|
1562
|
+
instanceRef.current.adapter = adapter;
|
|
1563
|
+
instanceRef.current.isMapAttached = true;
|
|
1564
|
+
instanceRef.current.currentPlatform = "leaflet";
|
|
1565
|
+
instanceRef.current.refresh();
|
|
1566
|
+
leafletAttachedRef.current = true;
|
|
1567
|
+
},
|
|
1568
|
+
[]
|
|
1569
|
+
);
|
|
1525
1570
|
return {
|
|
1526
1571
|
instance: instanceRef.current,
|
|
1527
1572
|
state,
|
|
@@ -1533,7 +1578,8 @@ function useMapFirst(options) {
|
|
|
1533
1578
|
boundsSearch,
|
|
1534
1579
|
attachMapLibre,
|
|
1535
1580
|
attachGoogle,
|
|
1536
|
-
attachMapbox
|
|
1581
|
+
attachMapbox,
|
|
1582
|
+
attachLeaflet
|
|
1537
1583
|
};
|
|
1538
1584
|
}
|
|
1539
1585
|
export {
|
|
@@ -1541,6 +1587,7 @@ export {
|
|
|
1541
1587
|
CloseIcon,
|
|
1542
1588
|
EditIcon,
|
|
1543
1589
|
FilterChips,
|
|
1590
|
+
LeafletAdapter2 as LeafletAdapter,
|
|
1544
1591
|
MapFirstCore2 as MapFirstCore,
|
|
1545
1592
|
MinRatingFilterChip,
|
|
1546
1593
|
NextIcon,
|
|
@@ -1557,6 +1604,7 @@ export {
|
|
|
1557
1604
|
fetchImages,
|
|
1558
1605
|
fetchProperties,
|
|
1559
1606
|
formatRatingValue,
|
|
1607
|
+
isWebGLSupported,
|
|
1560
1608
|
processApiFilters,
|
|
1561
1609
|
renderStars,
|
|
1562
1610
|
useFilterScroll,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapfirst.ai/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.88",
|
|
4
4
|
"description": "React hooks for MapFirst SDK - Reactive state management for map properties",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"react": ">=17"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@mapfirst.ai/core": "0.0.
|
|
43
|
+
"@mapfirst.ai/core": "0.0.78"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsup src/index.tsx --format esm,cjs --dts --clean"
|