@mapfirst.ai/react 0.0.85 → 0.0.87
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 +47 -1
- package/dist/index.mjs +50 -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,47 @@ 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.refresh();
|
|
1604
|
+
leafletAttachedRef.current = true;
|
|
1605
|
+
},
|
|
1606
|
+
[]
|
|
1607
|
+
);
|
|
1565
1608
|
return {
|
|
1566
1609
|
instance: instanceRef.current,
|
|
1567
1610
|
state,
|
|
@@ -1573,7 +1616,8 @@ function useMapFirst(options) {
|
|
|
1573
1616
|
boundsSearch,
|
|
1574
1617
|
attachMapLibre,
|
|
1575
1618
|
attachGoogle,
|
|
1576
|
-
attachMapbox
|
|
1619
|
+
attachMapbox,
|
|
1620
|
+
attachLeaflet
|
|
1577
1621
|
};
|
|
1578
1622
|
}
|
|
1579
1623
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1582,6 +1626,7 @@ function useMapFirst(options) {
|
|
|
1582
1626
|
CloseIcon,
|
|
1583
1627
|
EditIcon,
|
|
1584
1628
|
FilterChips,
|
|
1629
|
+
LeafletAdapter,
|
|
1585
1630
|
MapFirstCore,
|
|
1586
1631
|
MinRatingFilterChip,
|
|
1587
1632
|
NextIcon,
|
|
@@ -1598,6 +1643,7 @@ function useMapFirst(options) {
|
|
|
1598
1643
|
fetchImages,
|
|
1599
1644
|
fetchProperties,
|
|
1600
1645
|
formatRatingValue,
|
|
1646
|
+
isWebGLSupported,
|
|
1601
1647
|
processApiFilters,
|
|
1602
1648
|
renderStars,
|
|
1603
1649
|
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,47 @@ 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.refresh();
|
|
1565
|
+
leafletAttachedRef.current = true;
|
|
1566
|
+
},
|
|
1567
|
+
[]
|
|
1568
|
+
);
|
|
1525
1569
|
return {
|
|
1526
1570
|
instance: instanceRef.current,
|
|
1527
1571
|
state,
|
|
@@ -1533,7 +1577,8 @@ function useMapFirst(options) {
|
|
|
1533
1577
|
boundsSearch,
|
|
1534
1578
|
attachMapLibre,
|
|
1535
1579
|
attachGoogle,
|
|
1536
|
-
attachMapbox
|
|
1580
|
+
attachMapbox,
|
|
1581
|
+
attachLeaflet
|
|
1537
1582
|
};
|
|
1538
1583
|
}
|
|
1539
1584
|
export {
|
|
@@ -1541,6 +1586,7 @@ export {
|
|
|
1541
1586
|
CloseIcon,
|
|
1542
1587
|
EditIcon,
|
|
1543
1588
|
FilterChips,
|
|
1589
|
+
LeafletAdapter2 as LeafletAdapter,
|
|
1544
1590
|
MapFirstCore2 as MapFirstCore,
|
|
1545
1591
|
MinRatingFilterChip,
|
|
1546
1592
|
NextIcon,
|
|
@@ -1557,6 +1603,7 @@ export {
|
|
|
1557
1603
|
fetchImages,
|
|
1558
1604
|
fetchProperties,
|
|
1559
1605
|
formatRatingValue,
|
|
1606
|
+
isWebGLSupported,
|
|
1560
1607
|
processApiFilters,
|
|
1561
1608
|
renderStars,
|
|
1562
1609
|
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.87",
|
|
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.77"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsup src/index.tsx --format esm,cjs --dts --clean"
|