@bpd-library/components 1.2.3-beta.3 → 1.2.3
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/esm/atoms/button/button.js +33 -0
- package/dist/esm/atoms/button/button.js.map +1 -0
- package/dist/esm/atoms/col/col.js +22 -0
- package/dist/esm/atoms/col/col.js.map +1 -0
- package/dist/esm/atoms/container/container.js +6 -0
- package/dist/esm/atoms/container/container.js.map +1 -0
- package/dist/esm/atoms/form-elements/range-slider/range-slider.js +21 -0
- package/dist/esm/atoms/form-elements/range-slider/range-slider.js.map +1 -0
- package/dist/esm/atoms/form-elements/utilities/range-slider.js +100 -0
- package/dist/esm/atoms/form-elements/utilities/range-slider.js.map +1 -0
- package/dist/esm/atoms/image/image.js +18 -0
- package/dist/esm/atoms/image/image.js.map +1 -0
- package/dist/esm/atoms/image/utilities/create-image-url.js +15 -0
- package/dist/esm/atoms/image/utilities/create-image-url.js.map +1 -0
- package/dist/esm/atoms/row/row.js +6 -0
- package/dist/esm/atoms/row/row.js.map +1 -0
- package/dist/esm/atoms/svg/svg.js +25 -0
- package/dist/esm/atoms/svg/svg.js.map +1 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/molecules/infobox/infobox.js +20 -0
- package/dist/esm/molecules/infobox/infobox.js.map +1 -0
- package/dist/esm/molecules/map/map.js +256 -0
- package/dist/esm/molecules/map/map.js.map +1 -0
- package/dist/esm/molecules/map/store/map/store.js +150 -0
- package/dist/esm/molecules/map/store/map/store.js.map +1 -0
- package/dist/esm/molecules/map/utilities/fit-bounds.js +4 -0
- package/dist/esm/molecules/map/utilities/fit-bounds.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/add-data.js +54 -0
- package/dist/esm/molecules/map/utilities/mapbox/add-data.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/center.js +15 -0
- package/dist/esm/molecules/map/utilities/mapbox/center.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/constants.js +5 -0
- package/dist/esm/molecules/map/utilities/mapbox/constants.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/index.js +3 -0
- package/dist/esm/molecules/map/utilities/mapbox/index.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/mapbox.js +27 -0
- package/dist/esm/molecules/map/utilities/mapbox/mapbox.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/parse-feature-properties.js +18 -0
- package/dist/esm/molecules/map/utilities/mapbox/parse-feature-properties.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/pointers/setup-pointers.js +151 -0
- package/dist/esm/molecules/map/utilities/mapbox/pointers/setup-pointers.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/polygons/feature-state.js +11 -0
- package/dist/esm/molecules/map/utilities/mapbox/polygons/feature-state.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/polygons/geojson.js +10 -0
- package/dist/esm/molecules/map/utilities/mapbox/polygons/geojson.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/polygons/interaction.js +34 -0
- package/dist/esm/molecules/map/utilities/mapbox/polygons/interaction.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/polygons/layer.js +110 -0
- package/dist/esm/molecules/map/utilities/mapbox/polygons/layer.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/raster.js +43 -0
- package/dist/esm/molecules/map/utilities/mapbox/raster.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/search/alternative-city-suggestions.js +27 -0
- package/dist/esm/molecules/map/utilities/mapbox/search/alternative-city-suggestions.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/search/search.js +174 -0
- package/dist/esm/molecules/map/utilities/mapbox/search/search.js.map +1 -0
- package/dist/esm/molecules/map/utilities/mapbox/tooltip.js +26 -0
- package/dist/esm/molecules/map/utilities/mapbox/tooltip.js.map +1 -0
- package/dist/esm/molecules/tooltip/tooltip.js +14 -0
- package/dist/esm/molecules/tooltip/tooltip.js.map +1 -0
- package/dist/esm/node_modules/tslib/tslib.es6.js +24 -0
- package/dist/esm/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/lib/atoms/button/button.js +31 -0
- package/dist/lib/atoms/button/button.js.map +1 -0
- package/dist/lib/atoms/button/index.js +2 -0
- package/dist/lib/atoms/button/index.js.map +1 -0
- package/dist/lib/atoms/col/col.js +19 -0
- package/dist/lib/atoms/col/col.js.map +1 -0
- package/dist/lib/atoms/container/container.js +3 -0
- package/dist/lib/atoms/container/container.js.map +1 -0
- package/dist/lib/atoms/form-elements/range-slider/range-slider.js +18 -0
- package/dist/lib/atoms/form-elements/range-slider/range-slider.js.map +1 -0
- package/dist/lib/atoms/form-elements/utilities/range-slider.js +97 -0
- package/dist/lib/atoms/form-elements/utilities/range-slider.js.map +1 -0
- package/dist/lib/atoms/image/image.js +15 -0
- package/dist/lib/atoms/image/image.js.map +1 -0
- package/dist/lib/atoms/image/index.js +2 -0
- package/dist/lib/atoms/image/index.js.map +1 -0
- package/dist/lib/atoms/image/utilities/create-image-url.js +14 -0
- package/dist/lib/atoms/image/utilities/create-image-url.js.map +1 -0
- package/dist/lib/atoms/image/utilities/detect-responsive-images.js +24 -0
- package/dist/lib/atoms/image/utilities/detect-responsive-images.js.map +1 -0
- package/dist/lib/atoms/image/utilities/image.js +86 -0
- package/dist/lib/atoms/image/utilities/image.js.map +1 -0
- package/dist/lib/atoms/image/utilities/object-fit.js +35 -0
- package/dist/lib/atoms/image/utilities/object-fit.js.map +1 -0
- package/dist/lib/atoms/row/row.js +3 -0
- package/dist/lib/atoms/row/row.js.map +1 -0
- package/dist/lib/atoms/svg/svg.js +23 -0
- package/dist/lib/atoms/svg/svg.js.map +1 -0
- package/dist/lib/index.js +12 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/molecules/infobox/index.js +2 -0
- package/dist/lib/molecules/infobox/index.js.map +1 -0
- package/dist/lib/molecules/infobox/infobox.js +17 -0
- package/dist/lib/molecules/infobox/infobox.js.map +1 -0
- package/dist/lib/molecules/map/hooks/use-style-loaded.js +14 -0
- package/dist/lib/molecules/map/hooks/use-style-loaded.js.map +1 -0
- package/dist/lib/molecules/map/index.js +4 -0
- package/dist/lib/molecules/map/index.js.map +1 -0
- package/dist/lib/molecules/map/map.js +256 -0
- package/dist/lib/molecules/map/map.js.map +1 -0
- package/dist/lib/molecules/map/store/map/index.js +2 -0
- package/dist/lib/molecules/map/store/map/index.js.map +1 -0
- package/dist/lib/molecules/map/store/map/store.js +147 -0
- package/dist/lib/molecules/map/store/map/store.js.map +1 -0
- package/dist/lib/molecules/map/storybook/themes.js +54 -0
- package/dist/lib/molecules/map/storybook/themes.js.map +1 -0
- package/dist/lib/molecules/map/utilities/fit-bounds.js +2 -0
- package/dist/lib/molecules/map/utilities/fit-bounds.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/add-data.js +52 -0
- package/dist/lib/molecules/map/utilities/mapbox/add-data.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/center.js +13 -0
- package/dist/lib/molecules/map/utilities/mapbox/center.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/constants.js +3 -0
- package/dist/lib/molecules/map/utilities/mapbox/constants.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/index.js +3 -0
- package/dist/lib/molecules/map/utilities/mapbox/index.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/mapbox.js +25 -0
- package/dist/lib/molecules/map/utilities/mapbox/mapbox.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/parse-feature-properties.js +16 -0
- package/dist/lib/molecules/map/utilities/mapbox/parse-feature-properties.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/pointers/setup-pointers.js +151 -0
- package/dist/lib/molecules/map/utilities/mapbox/pointers/setup-pointers.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/polygons/feature-state.js +10 -0
- package/dist/lib/molecules/map/utilities/mapbox/polygons/feature-state.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/polygons/geojson.js +9 -0
- package/dist/lib/molecules/map/utilities/mapbox/polygons/geojson.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/polygons/interaction.js +32 -0
- package/dist/lib/molecules/map/utilities/mapbox/polygons/interaction.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/polygons/layer.js +109 -0
- package/dist/lib/molecules/map/utilities/mapbox/polygons/layer.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/raster.js +42 -0
- package/dist/lib/molecules/map/utilities/mapbox/raster.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/search/alternative-city-suggestions.js +26 -0
- package/dist/lib/molecules/map/utilities/mapbox/search/alternative-city-suggestions.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/search/search.js +172 -0
- package/dist/lib/molecules/map/utilities/mapbox/search/search.js.map +1 -0
- package/dist/lib/molecules/map/utilities/mapbox/tooltip.js +24 -0
- package/dist/lib/molecules/map/utilities/mapbox/tooltip.js.map +1 -0
- package/dist/lib/molecules/tooltip/index.js +2 -0
- package/dist/lib/molecules/tooltip/index.js.map +1 -0
- package/dist/lib/molecules/tooltip/tooltip.js +11 -0
- package/dist/lib/molecules/tooltip/tooltip.js.map +1 -0
- package/dist/molecules/map/map.js +0 -6
- package/dist/molecules/map/map.js.map +1 -1
- package/dist/molecules/map/store/map/store.d.ts +1 -3
- package/dist/molecules/map/store/map/store.js +0 -8
- package/dist/molecules/map/store/map/store.js.map +1 -1
- package/dist/molecules/map/utilities/mapbox/directions/directions.d.ts +5 -0
- package/dist/molecules/map/utilities/mapbox/directions/directions.js +72 -0
- package/dist/molecules/map/utilities/mapbox/directions/directions.js.map +1 -0
- package/dist/molecules/map/utilities/mapbox/isochrone.d.ts +3 -2
- package/dist/molecules/map/utilities/mapbox/isochrone.js +108 -40
- package/dist/molecules/map/utilities/mapbox/isochrone.js.map +1 -1
- package/dist/molecules/map/utilities/mapbox/mapbox.d.ts +1 -2
- package/dist/molecules/map/utilities/mapbox/mapbox.js +0 -2
- package/dist/molecules/map/utilities/mapbox/mapbox.js.map +1 -1
- package/dist/types/atoms/button/button.d.ts +17 -0
- package/dist/types/atoms/button/index.d.ts +1 -0
- package/dist/types/atoms/col/col.d.ts +11 -0
- package/dist/types/atoms/container/container.d.ts +6 -0
- package/dist/types/atoms/form-elements/range-slider/range-slider.d.ts +11 -0
- package/dist/types/atoms/form-elements/utilities/range-slider.d.ts +7 -0
- package/dist/types/atoms/image/image.d.ts +14 -0
- package/dist/types/atoms/image/index.d.ts +1 -0
- package/dist/types/atoms/image/utilities/create-image-url.d.ts +6 -0
- package/dist/types/atoms/image/utilities/detect-responsive-images.d.ts +7 -0
- package/dist/types/atoms/image/utilities/image.d.ts +18 -0
- package/dist/types/atoms/image/utilities/object-fit.d.ts +7 -0
- package/dist/types/atoms/row/row.d.ts +6 -0
- package/dist/types/atoms/svg/svg.d.ts +4 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/molecules/infobox/index.d.ts +1 -0
- package/dist/types/molecules/infobox/infobox.d.ts +7 -0
- package/dist/types/molecules/map/hooks/use-style-loaded.d.ts +2 -0
- package/dist/types/molecules/map/index.d.ts +3 -0
- package/dist/types/molecules/map/map.d.ts +2 -0
- package/dist/types/molecules/map/store/map/index.d.ts +1 -0
- package/dist/types/molecules/map/store/map/store.d.ts +60 -0
- package/dist/types/molecules/map/storybook/themes.d.ts +3 -0
- package/dist/types/molecules/map/utilities/fit-bounds.d.ts +3 -0
- package/dist/types/molecules/map/utilities/mapbox/add-data.d.ts +3 -0
- package/dist/types/molecules/map/utilities/mapbox/center.d.ts +3 -0
- package/dist/types/molecules/map/utilities/mapbox/constants.d.ts +2 -0
- package/dist/types/molecules/map/utilities/mapbox/index.d.ts +2 -0
- package/dist/types/molecules/map/utilities/mapbox/mapbox.d.ts +16 -0
- package/dist/types/molecules/map/utilities/mapbox/parse-feature-properties.d.ts +6 -0
- package/dist/types/molecules/map/utilities/mapbox/pointers/setup-pointers.d.ts +3 -0
- package/dist/types/molecules/map/utilities/mapbox/polygons/feature-state.d.ts +2 -0
- package/dist/types/molecules/map/utilities/mapbox/polygons/geojson.d.ts +3 -0
- package/dist/types/molecules/map/utilities/mapbox/polygons/interaction.d.ts +3 -0
- package/dist/types/molecules/map/utilities/mapbox/polygons/layer.d.ts +3 -0
- package/dist/types/molecules/map/utilities/mapbox/raster.d.ts +3 -0
- package/dist/types/molecules/map/utilities/mapbox/search/alternative-city-suggestions.d.ts +3 -0
- package/dist/types/molecules/map/utilities/mapbox/search/search.d.ts +4 -0
- package/dist/types/molecules/map/utilities/mapbox/tooltip.d.ts +4 -0
- package/dist/types/molecules/tooltip/index.d.ts +1 -0
- package/dist/types/molecules/tooltip/tooltip.d.ts +7 -0
- package/package.json +4 -4
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -79
- package/coverage/index.html +0 -95
- package/coverage/lcov.info +0 -0
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -170
|
@@ -1,46 +1,114 @@
|
|
|
1
|
-
import { environment } from '@bpd-library/utilities';
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { calculateBoundingBox, environment } from '@bpd-library/utilities';
|
|
2
|
+
const OUTER_COORDINATES = [
|
|
3
|
+
[
|
|
4
|
+
[-42, 74],
|
|
5
|
+
[-42, 1],
|
|
6
|
+
[80, 1],
|
|
7
|
+
[80, 74],
|
|
8
|
+
[-42, 74],
|
|
9
|
+
],
|
|
10
|
+
];
|
|
11
|
+
const ISOCHRONE_SOURCE = 'isochrone';
|
|
12
|
+
const DEFAULT_FILL_COLOR = '#000000';
|
|
13
|
+
const DEFAULT_STROKE_COLOR = '#32C1DE';
|
|
14
|
+
let mask;
|
|
15
|
+
let polygon;
|
|
16
|
+
const addIsochrone = async (map, isochroneSetting) => {
|
|
17
|
+
await init();
|
|
18
|
+
async function init() {
|
|
19
|
+
if (!mask || !polygon) {
|
|
20
|
+
const maskPackage = await import('@turf/mask');
|
|
21
|
+
const helpersPackage = await import('@turf/helpers');
|
|
22
|
+
mask = await maskPackage.default;
|
|
23
|
+
polygon = await helpersPackage.polygon;
|
|
16
24
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
if (!map.getSource(ISOCHRONE_SOURCE)) {
|
|
26
|
+
setupSource();
|
|
27
|
+
setupLayer();
|
|
28
|
+
}
|
|
29
|
+
const { coordinate, minutes, profile, fitBounds } = isochroneSetting;
|
|
30
|
+
const accessToken = window.__ENVIRONMENT_DETAILS__.mapbox.accessToken;
|
|
31
|
+
try {
|
|
32
|
+
let url = `https://api.mapbox.com/isochrone/v1/mapbox/${profile}/${coordinate[0]},${coordinate[1]}?contours_minutes=${minutes}&polygons=true&access_token=${accessToken}`;
|
|
33
|
+
if (profile === 'driving') {
|
|
34
|
+
url += '&generalize=100';
|
|
35
|
+
}
|
|
36
|
+
const result = await fetch(url);
|
|
37
|
+
const parsedResult = await result.json();
|
|
38
|
+
if (parsedResult) {
|
|
39
|
+
const source = map.getSource(ISOCHRONE_SOURCE);
|
|
40
|
+
const invertedCoordinates = invertCoordinates(parsedResult);
|
|
41
|
+
if (fitBounds) {
|
|
42
|
+
fitApiResultBounds(parsedResult);
|
|
43
|
+
}
|
|
44
|
+
source === null || source === void 0 ? void 0 : source.setData(invertedCoordinates);
|
|
45
|
+
}
|
|
21
46
|
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
if (environment.isLocal) {
|
|
49
|
+
console.error(e);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function setupSource() {
|
|
54
|
+
map.addSource(ISOCHRONE_SOURCE, {
|
|
55
|
+
type: 'geojson',
|
|
56
|
+
data: {
|
|
57
|
+
type: 'FeatureCollection',
|
|
58
|
+
features: [],
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function setupLayer() {
|
|
63
|
+
const { fill = DEFAULT_FILL_COLOR, stroke = DEFAULT_STROKE_COLOR } = isochroneSetting.color || {};
|
|
64
|
+
map.addLayer({
|
|
65
|
+
id: 'isochroneFill',
|
|
66
|
+
type: 'fill',
|
|
67
|
+
source: ISOCHRONE_SOURCE,
|
|
68
|
+
layout: {},
|
|
69
|
+
paint: {
|
|
70
|
+
'fill-color': fill,
|
|
71
|
+
'fill-opacity': 0.07,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
map.addLayer({
|
|
75
|
+
id: 'isochroneStroke',
|
|
76
|
+
type: 'line',
|
|
77
|
+
source: ISOCHRONE_SOURCE,
|
|
78
|
+
layout: {},
|
|
79
|
+
paint: {
|
|
80
|
+
'line-color': stroke,
|
|
81
|
+
'line-width': 1,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function invertCoordinates(apiResult) {
|
|
86
|
+
var _a;
|
|
87
|
+
const apiCoordinates = (_a = apiResult.features[0]) === null || _a === void 0 ? void 0 : _a.geometry.coordinates;
|
|
88
|
+
const outerPolygon = polygon(apiCoordinates);
|
|
89
|
+
const innerPolygon = polygon([...OUTER_COORDINATES]);
|
|
90
|
+
const invertedPolygon = mask(outerPolygon, innerPolygon);
|
|
91
|
+
return invertedPolygon;
|
|
92
|
+
}
|
|
93
|
+
function fitApiResultBounds(apiResult) {
|
|
94
|
+
var _a;
|
|
95
|
+
const coordinates = (_a = apiResult.features[0]) === null || _a === void 0 ? void 0 : _a.geometry.coordinates;
|
|
96
|
+
const boundingBox = calculateBoundingBox(coordinates);
|
|
97
|
+
map.fitBounds(boundingBox, {
|
|
98
|
+
padding: 20,
|
|
99
|
+
animate: true,
|
|
100
|
+
duration: 1000,
|
|
101
|
+
});
|
|
22
102
|
}
|
|
23
103
|
};
|
|
24
|
-
|
|
25
|
-
map.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
104
|
+
const removeIsochrone = (map) => {
|
|
105
|
+
const source = map.getSource(ISOCHRONE_SOURCE);
|
|
106
|
+
if (!source)
|
|
107
|
+
return;
|
|
108
|
+
source.setData({
|
|
109
|
+
type: 'FeatureCollection',
|
|
110
|
+
features: [],
|
|
31
111
|
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
map.addLayer({
|
|
35
|
-
id: 'isochroneLayer',
|
|
36
|
-
type: 'fill',
|
|
37
|
-
source: 'isochrone',
|
|
38
|
-
layout: {},
|
|
39
|
-
paint: {
|
|
40
|
-
'fill-color': '#5a3fc0',
|
|
41
|
-
'fill-opacity': 0.3,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
export default isochrone;
|
|
112
|
+
};
|
|
113
|
+
export { addIsochrone, removeIsochrone };
|
|
46
114
|
//# sourceMappingURL=isochrone.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isochrone.js","sourceRoot":"","sources":["../../../../../src/molecules/map/utilities/mapbox/isochrone.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"isochrone.js","sourceRoot":"","sources":["../../../../../src/molecules/map/utilities/mapbox/isochrone.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG3E,MAAM,iBAAiB,GAAgB;IACnC;QACI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC;QACT,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACR,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,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,CAAC,CAAC;IACP,CAAC;IAED,SAAS,iBAAiB,CAAC,SAA6B;;QACpD,MAAM,cAAc,SAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,0CAAE,QAAQ,CAAC,WAAW,CAAC;QAEnE,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;QAC7C,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC;QAErD,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAEzD,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED,SAAS,kBAAkB,CAAC,SAA6B;;QACrD,MAAM,WAAW,GAAG,MAAA,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,0CAAE,QAAQ,CAAC,WAA0B,CAAC;QAC/E,MAAM,WAAW,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;QAEtD,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE;YACvB,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACjB,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,GAAiB,EAAE,EAAE;IAC1C,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,gBAAgB,CAAuC,CAAC;IAErF,IAAI,CAAC,MAAM;QAAE,OAAO;IAEpB,MAAM,CAAC,OAAO,CAAC;QACX,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,EAAE;KACf,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { Coordinates, MapIsochroneSetting } from '@bpd-library/types';\nimport { calculateBoundingBox, environment } from '@bpd-library/utilities';\nimport mapboxgl from 'mapbox-gl';\n\nconst OUTER_COORDINATES: Coordinates = [\n [\n [-42, 74],\n [-42, 1],\n [80, 1],\n [80, 74],\n [-42, 74],\n ],\n];\nconst ISOCHRONE_SOURCE = 'isochrone';\nconst DEFAULT_FILL_COLOR = '#000000';\nconst DEFAULT_STROKE_COLOR = '#32C1DE';\n\ntype IsochroneApiResult = GeoJSON.FeatureCollection<GeoJSON.Polygon>;\n\nlet mask: any;\nlet polygon: any;\n\nconst addIsochrone = async (map: mapboxgl.Map, isochroneSetting: MapIsochroneSetting) => {\n await init();\n\n async function init() {\n // Lazyload turf package\n if (!mask || !polygon) {\n const maskPackage = await import('@turf/mask');\n const helpersPackage = await import('@turf/helpers');\n\n mask = await maskPackage.default;\n polygon = await helpersPackage.polygon;\n }\n\n // Setup source and layer, if not existing\n if (!map.getSource(ISOCHRONE_SOURCE)) {\n setupSource();\n setupLayer();\n }\n\n const { coordinate, minutes, profile, fitBounds } = isochroneSetting;\n\n const accessToken = window.__ENVIRONMENT_DETAILS__.mapbox.accessToken;\n\n try {\n let url: string = `https://api.mapbox.com/isochrone/v1/mapbox/${profile}/${coordinate[0]},${coordinate[1]}?contours_minutes=${minutes}&polygons=true&access_token=${accessToken}`;\n\n // To simplify the polygon. Makes calculating boundingBoxes more performant\n if (profile === 'driving') {\n url += '&generalize=100';\n }\n\n const result = await fetch(url);\n const parsedResult: IsochroneApiResult = await result.json();\n\n if (parsedResult) {\n const source = map.getSource(ISOCHRONE_SOURCE) as\n | mapboxgl.GeoJSONSource\n | undefined;\n\n const invertedCoordinates = invertCoordinates(parsedResult);\n\n if (fitBounds) {\n fitApiResultBounds(parsedResult);\n }\n\n source?.setData(invertedCoordinates);\n }\n } catch (e) {\n if (environment.isLocal) {\n console.error(e);\n }\n }\n }\n\n function setupSource() {\n map.addSource(ISOCHRONE_SOURCE, {\n type: 'geojson',\n data: {\n type: 'FeatureCollection',\n features: [],\n },\n });\n }\n\n function setupLayer() {\n const {\n fill = DEFAULT_FILL_COLOR,\n stroke = DEFAULT_STROKE_COLOR\n } = isochroneSetting.color || {};\n\n map.addLayer({\n id: 'isochroneFill',\n type: 'fill',\n source: ISOCHRONE_SOURCE,\n layout: {},\n paint: {\n 'fill-color': fill,\n 'fill-opacity': 0.07,\n },\n });\n\n map.addLayer({\n id: 'isochroneStroke',\n type: 'line',\n source: ISOCHRONE_SOURCE,\n layout: {},\n paint: {\n 'line-color': stroke,\n 'line-width': 1,\n },\n });\n }\n\n function invertCoordinates(apiResult: IsochroneApiResult) {\n const apiCoordinates = apiResult.features[0]?.geometry.coordinates;\n\n const outerPolygon = polygon(apiCoordinates);\n const innerPolygon = polygon([...OUTER_COORDINATES]);\n\n const invertedPolygon = mask(outerPolygon, innerPolygon);\n\n return invertedPolygon;\n }\n\n function fitApiResultBounds(apiResult: IsochroneApiResult) {\n const coordinates = apiResult.features[0]?.geometry.coordinates as Coordinates;\n const boundingBox = calculateBoundingBox(coordinates);\n\n map.fitBounds(boundingBox, {\n padding: 20,\n animate: true,\n duration: 1000,\n });\n }\n};\n\nconst removeIsochrone = (map: mapboxgl.Map) => {\n const source = map.getSource(ISOCHRONE_SOURCE) as mapboxgl.GeoJSONSource | undefined;\n\n if (!source) return;\n\n source.setData({\n type: 'FeatureCollection',\n features: [],\n });\n};\n\nexport { addIsochrone, removeIsochrone };\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Coordinates, MapData, MapDataItem,
|
|
1
|
+
import { Coordinates, MapData, MapDataItem, MapOptions, MapSearchOptions, MapTheme, PolygonThemeSetting } from '@bpd-library/types';
|
|
2
2
|
import { MapLayerRasterSettings } from '../../store/map';
|
|
3
3
|
declare const mapbox: (map: mapboxgl.Map, options: MapOptions, theme: MapTheme) => {
|
|
4
4
|
raster: (settings: MapLayerRasterSettings) => void;
|
|
@@ -12,6 +12,5 @@ declare const mapbox: (map: mapboxgl.Map, options: MapOptions, theme: MapTheme)
|
|
|
12
12
|
removeTooltip: () => void;
|
|
13
13
|
setFeatureState: (variant: string, id: string, type: 'hover' | 'focus', hover: boolean) => void;
|
|
14
14
|
search: (searchOptions: MapSearchOptions) => Promise<void>;
|
|
15
|
-
isochrone: (isochroneSetting: MapIsochroneSetting) => Promise<void>;
|
|
16
15
|
};
|
|
17
16
|
export default mapbox;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import addData from './add-data';
|
|
2
2
|
import center from './center';
|
|
3
|
-
import isochrone from './isochrone';
|
|
4
3
|
import setupPointers from './pointers/setup-pointers';
|
|
5
4
|
import setFeatureState from './polygons/feature-state';
|
|
6
5
|
import geojson from './polygons/geojson';
|
|
@@ -21,7 +20,6 @@ const mapbox = (map, options, theme) => ({
|
|
|
21
20
|
removeTooltip,
|
|
22
21
|
setFeatureState: (variant, id, type, hover) => setFeatureState(map, variant, id, type, hover),
|
|
23
22
|
search: (searchOptions) => search(map, searchOptions, options),
|
|
24
|
-
isochrone: (isochroneSetting) => isochrone(map, isochroneSetting),
|
|
25
23
|
});
|
|
26
24
|
export default mapbox;
|
|
27
25
|
//# sourceMappingURL=mapbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapbox.js","sourceRoot":"","sources":["../../../../../src/molecules/map/utilities/mapbox/mapbox.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mapbox.js","sourceRoot":"","sources":["../../../../../src/molecules/map/utilities/mapbox/mapbox.ts"],"names":[],"mappings":"AAWA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,eAAe,MAAM,0BAA0B,CAAC;AACvD,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEtD,MAAM,MAA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from '@bpd-library/types';\n\nimport { MapLayerRasterSettings } from '../../store/map';\nimport addData from './add-data';\nimport center from './center';\nimport setupPointers from './pointers/setup-pointers';\nimport setFeatureState from './polygons/feature-state';\nimport geojson from './polygons/geojson';\nimport interaction from './polygons/interaction';\nimport layer from './polygons/layer';\nimport raster from './raster';\nimport search from './search/search';\nimport { addTooltip, removeTooltip } from './tooltip';\n\nconst mapbox = (map: mapboxgl.Map, options: MapOptions, theme: MapTheme) => ({\n raster: (settings: MapLayerRasterSettings) => raster(map, settings),\n geojson: (setting: PolygonThemeSetting) => geojson(map, setting),\n layer: (setting: PolygonThemeSetting) => layer(map, setting),\n interaction: (setting: PolygonThemeSetting) => interaction(map, setting),\n center: (coordinates: Coordinates) => center(map, coordinates),\n setupPointers: (element: HTMLElement) => setupPointers(map, theme, element),\n addData: (data: MapData) => addData(map, data, theme),\n addTooltip: (coordinates: Coordinates, mapDataItem: MapDataItem) =>\n addTooltip(map, coordinates, mapDataItem, options.openInTab),\n removeTooltip,\n setFeatureState: (variant: string, id: string, type: 'hover' | 'focus', hover: boolean) =>\n setFeatureState(map, variant, id, type, hover),\n search: (searchOptions: MapSearchOptions) => search(map, searchOptions, options),\n});\n\nexport default mapbox;\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ButtonInterface {
|
|
2
|
+
label: string | Text;
|
|
3
|
+
variant?: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
size?: string;
|
|
6
|
+
classes?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
hook?: string;
|
|
10
|
+
controls?: string;
|
|
11
|
+
onClick?: Function;
|
|
12
|
+
target?: string;
|
|
13
|
+
attr?: {};
|
|
14
|
+
}
|
|
15
|
+
declare const Button: (data: ButtonInterface) => any;
|
|
16
|
+
declare const ButtonA: (data: ButtonInterface) => any;
|
|
17
|
+
export { Button, ButtonA };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface ColInterface {
|
|
2
|
+
extraClass?: string;
|
|
3
|
+
children?: NodeList;
|
|
4
|
+
cols?: (number | undefined)[];
|
|
5
|
+
push?: (number | undefined)[];
|
|
6
|
+
pull?: (number | undefined)[];
|
|
7
|
+
pre?: (number | undefined)[];
|
|
8
|
+
post?: (number | undefined)[];
|
|
9
|
+
}
|
|
10
|
+
export declare const Col: ({ extraClass, children, cols, push, pull, pre, post, }: ColInterface) => any;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface RangeSliderProps {
|
|
2
|
+
min: number;
|
|
3
|
+
max: number;
|
|
4
|
+
increment: number;
|
|
5
|
+
start: number[];
|
|
6
|
+
onChange: (e: CustomEvent) => void;
|
|
7
|
+
name: string;
|
|
8
|
+
classes?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const RangeSliderElement: ({ classes, disabled, min, max, increment, start, name, onChange, }: RangeSliderProps) => any;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Setting, Settings } from './utilities/image';
|
|
2
|
+
export interface ImageInterface {
|
|
3
|
+
image: string;
|
|
4
|
+
alt: string;
|
|
5
|
+
settings?: Settings;
|
|
6
|
+
preload?: Setting;
|
|
7
|
+
srcset?: string;
|
|
8
|
+
classes?: string;
|
|
9
|
+
caption?: string;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
objectFit?: boolean | 'contain';
|
|
12
|
+
disableCrossFade?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const Image: (data: ImageInterface) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './image';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Setting {
|
|
2
|
+
width?: number;
|
|
3
|
+
height?: number;
|
|
4
|
+
src?: boolean | undefined;
|
|
5
|
+
}
|
|
6
|
+
export interface Settings {
|
|
7
|
+
[key: string]: Setting;
|
|
8
|
+
}
|
|
9
|
+
export declare class BPDImage extends HTMLElement {
|
|
10
|
+
img: HTMLImageElement;
|
|
11
|
+
componentDidLoad(): void;
|
|
12
|
+
disconnectedCallback(): void;
|
|
13
|
+
private parseSettings;
|
|
14
|
+
private generateSrc;
|
|
15
|
+
private generateSrcset;
|
|
16
|
+
private loadImage;
|
|
17
|
+
private renderImage;
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare type ImageElement = HTMLImageElement | HTMLImageElement[];
|
|
2
|
+
export default class ObjectFit {
|
|
3
|
+
static polyfillObjectFit(element: ImageElement): void;
|
|
4
|
+
static getObjectfitImages(element: ImageElement): HTMLImageElement[];
|
|
5
|
+
private static polyfillImage;
|
|
6
|
+
}
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './atoms/button';
|
|
2
|
+
export * from './atoms/col/col';
|
|
3
|
+
export * from './atoms/container/container';
|
|
4
|
+
export * from './atoms/form-elements/range-slider/range-slider';
|
|
5
|
+
export * from './atoms/form-elements/utilities/range-slider';
|
|
6
|
+
export * from './atoms/image';
|
|
7
|
+
export * from './atoms/row/row';
|
|
8
|
+
export * from './atoms/svg/svg';
|
|
9
|
+
export * from './molecules/infobox';
|
|
10
|
+
export * from './molecules/map';
|
|
11
|
+
export * from './molecules/tooltip';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './infobox';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MapInfobox } from '@bpd-library/types';
|
|
2
|
+
interface InfoboxInterface extends MapInfobox {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
openInTab?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const Infobox: ({ title, image, tags, description, link, onClose, openInTab, }: InfoboxInterface) => any;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './store';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/// <reference types="mapbox-gl" />
|
|
2
|
+
import { BoundingBox, MapDataItem } from '@bpd-library/types';
|
|
3
|
+
export declare type SearchResult = {
|
|
4
|
+
items: MapDataItem[];
|
|
5
|
+
result: any;
|
|
6
|
+
originalBoundingBox?: BoundingBox;
|
|
7
|
+
expandedBoundingBox?: BoundingBox;
|
|
8
|
+
};
|
|
9
|
+
interface MapFocusOptions {
|
|
10
|
+
zoom?: boolean;
|
|
11
|
+
toggleTooltip?: boolean;
|
|
12
|
+
static?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface MapLayerRasterSettings {
|
|
15
|
+
layerRaster: string;
|
|
16
|
+
minzoom?: number;
|
|
17
|
+
maxzoom?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface MapState {
|
|
20
|
+
data: MapDataItem[];
|
|
21
|
+
mapInstance?: mapboxgl.Map;
|
|
22
|
+
hover: {
|
|
23
|
+
current?: MapDataItem;
|
|
24
|
+
previous?: MapDataItem;
|
|
25
|
+
};
|
|
26
|
+
filter?: MapDataItem[];
|
|
27
|
+
click?: MapDataItem;
|
|
28
|
+
focus: {
|
|
29
|
+
current?: MapDataItem[];
|
|
30
|
+
previous?: MapDataItem[];
|
|
31
|
+
options?: MapFocusOptions;
|
|
32
|
+
};
|
|
33
|
+
searchResult?: SearchResult;
|
|
34
|
+
searchIsMoving: boolean;
|
|
35
|
+
manualSearch?: string;
|
|
36
|
+
layerRasterSettings?: MapLayerRasterSettings;
|
|
37
|
+
}
|
|
38
|
+
export declare const mapStore: import("@atomify/kit/dist/utilities/store/store.types").Store<MapState>;
|
|
39
|
+
export declare const updateMapData: (data: MapDataItem[]) => void;
|
|
40
|
+
export declare const clearHover: () => void;
|
|
41
|
+
export declare const updateHover: (hover: MapDataItem) => void;
|
|
42
|
+
export declare const updateClick: (click: MapDataItem) => void;
|
|
43
|
+
export declare const setFocus: (ids: string[], options?: MapFocusOptions) => void;
|
|
44
|
+
export declare const clearFocus: () => void;
|
|
45
|
+
export declare const updateSearchResult: (searchResult: SearchResult) => void;
|
|
46
|
+
export declare const clearSearchResult: () => void;
|
|
47
|
+
export declare const setFilter: (data: MapDataItem[]) => void;
|
|
48
|
+
export declare const clearFilter: () => void;
|
|
49
|
+
export declare const setMapInstance: (mapInstance: mapboxgl.Map) => void;
|
|
50
|
+
export declare const manualSearch: (query: string) => void;
|
|
51
|
+
export declare const updateSearchIsMoving: (isMoving: boolean) => void;
|
|
52
|
+
export declare const setLayerRaster: (layerRasterSettings: MapLayerRasterSettings) => void;
|
|
53
|
+
export declare const getMapboxData: () => MapDataItem[];
|
|
54
|
+
export declare const getHover: () => {
|
|
55
|
+
current?: MapDataItem | undefined;
|
|
56
|
+
previous?: MapDataItem | undefined;
|
|
57
|
+
};
|
|
58
|
+
export declare const getMapInstance: () => import("mapbox-gl").Map | undefined;
|
|
59
|
+
export declare const getSearchIsMoving: () => boolean;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Coordinates, MapData, MapDataItem, MapOptions, MapSearchOptions, MapTheme, PolygonThemeSetting } from '@bpd-library/types';
|
|
2
|
+
import { MapLayerRasterSettings } from '../../store/map';
|
|
3
|
+
declare const mapbox: (map: mapboxgl.Map, options: MapOptions, theme: MapTheme) => {
|
|
4
|
+
raster: (settings: MapLayerRasterSettings) => void;
|
|
5
|
+
geojson: (setting: PolygonThemeSetting) => void;
|
|
6
|
+
layer: (setting: PolygonThemeSetting) => void;
|
|
7
|
+
interaction: (setting: PolygonThemeSetting) => void;
|
|
8
|
+
center: (coordinates: Coordinates) => void;
|
|
9
|
+
setupPointers: (element: HTMLElement) => void;
|
|
10
|
+
addData: (data: MapData) => Promise<void>;
|
|
11
|
+
addTooltip: (coordinates: Coordinates, mapDataItem: MapDataItem) => void;
|
|
12
|
+
removeTooltip: () => void;
|
|
13
|
+
setFeatureState: (variant: string, id: string, type: 'hover' | 'focus', hover: boolean) => void;
|
|
14
|
+
search: (searchOptions: MapSearchOptions) => Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
export default mapbox;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MapOptions, MapSearchOptions } from '@bpd-library/types';
|
|
2
|
+
import mapboxgl from 'mapbox-gl';
|
|
3
|
+
declare const search: (map: mapboxgl.Map, { hook, kmPadding, onSearchSuggestion }: MapSearchOptions, { searchCountryIsoCodes, language }: MapOptions) => Promise<void>;
|
|
4
|
+
export default search;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Coordinates, MapDataItem } from '@bpd-library/types';
|
|
2
|
+
declare const addTooltip: (map: mapboxgl.Map, coordinates: Coordinates, mapDataItem: MapDataItem, openInTab?: boolean | undefined) => void;
|
|
3
|
+
declare const removeTooltip: () => void;
|
|
4
|
+
export { addTooltip, removeTooltip };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tooltip';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpd-library/components",
|
|
3
|
-
"version": "1.2.3
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Description",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "45a33e7e61e9054ec889ecd2c6dc8a88da52f5ed",
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@atomify/core": "2.4.1",
|
|
52
52
|
"@atomify/hooks": "1.1.11",
|
|
53
53
|
"@atomify/jsx": "1.7.1",
|
|
54
54
|
"@atomify/kit": "1.1.11",
|
|
55
|
-
"@bpd-library/types": "^1.2.3
|
|
56
|
-
"@bpd-library/utilities": "^1.2.3
|
|
55
|
+
"@bpd-library/types": "^1.2.3",
|
|
56
|
+
"@bpd-library/utilities": "^1.2.3",
|
|
57
57
|
"@mapbox/mapbox-gl-geocoder": "^4.7.0",
|
|
58
58
|
"@mapbox/mapbox-gl-language": "^0.10.1",
|
|
59
59
|
"@types/mapbox-gl": "^2.4.1",
|