@tpzdsp/next-toolkit 1.2.4 → 1.2.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tpzdsp/next-toolkit",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "A reusable React component library for Next.js applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -28,11 +28,6 @@
|
|
|
28
28
|
"import": "./src/index.ts",
|
|
29
29
|
"require": "./src/index.ts"
|
|
30
30
|
},
|
|
31
|
-
"./test": {
|
|
32
|
-
"types": "./src/test/index.ts",
|
|
33
|
-
"import": "./src/test/index.ts",
|
|
34
|
-
"require": "./src/test/index.ts"
|
|
35
|
-
},
|
|
36
31
|
"./utils": {
|
|
37
32
|
"types": "./src/utils/index.ts",
|
|
38
33
|
"import": "./src/utils/index.ts",
|
package/src/index.ts
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Export all components.
|
|
2
|
-
// export * from './components';
|
|
3
|
-
|
|
4
|
-
// Export all utilities (these can be used in both client and server)
|
|
5
|
-
// export * from './utils';
|
|
6
|
-
|
|
7
|
-
// Export all map related code (these can be used in both client and server)
|
|
8
|
-
// export * from './map';
|
|
9
|
-
|
|
10
|
-
// Export all types
|
|
11
|
-
// export * from './types';
|
|
@@ -9,9 +9,9 @@ import { fromLonLat } from 'ol/proj';
|
|
|
9
9
|
import { initializeBasemapLayers } from './basemaps';
|
|
10
10
|
import { initializeGeocoder } from './geocoder';
|
|
11
11
|
import { LayerSwitcherControl } from './LayerSwitcherControl';
|
|
12
|
-
import { getPopupPositionClass } from './map';
|
|
13
12
|
import { useMap } from './MapContext';
|
|
14
13
|
import { Popup } from './Popup';
|
|
14
|
+
import { getPopupPositionClass } from './utils';
|
|
15
15
|
import type { MapConfig, PopupDirection } from '../types/map';
|
|
16
16
|
|
|
17
17
|
export type MapComponentProps = {
|
package/src/map/MapContext.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import ClusterSource from 'ol/source/Cluster';
|
|
|
12
12
|
import VectorSource from 'ol/source/Vector';
|
|
13
13
|
|
|
14
14
|
import './projections';
|
|
15
|
-
import { LAYER_NAMES } from './
|
|
15
|
+
import { LAYER_NAMES } from './utils';
|
|
16
16
|
import type { MapConfig } from '../types/map';
|
|
17
17
|
|
|
18
18
|
export type MapContextType = {
|
package/src/map/index.ts
CHANGED
|
@@ -2,8 +2,8 @@ export * from './basemaps';
|
|
|
2
2
|
export * from './geocoder';
|
|
3
3
|
export * from './geometries';
|
|
4
4
|
export * from './LayerSwitcherControl';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
5
|
+
export * from './utils';
|
|
6
|
+
export * from './MapComponent';
|
|
7
7
|
export * from './MapContext';
|
|
8
8
|
export * from './osOpenNamesSearch';
|
|
9
9
|
export * from './Popup';
|
|
@@ -4,6 +4,13 @@ export type SearchOption = {
|
|
|
4
4
|
url?: string;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
export type SearchResult = {
|
|
8
|
+
lon: number;
|
|
9
|
+
lat: number;
|
|
10
|
+
address?: string;
|
|
11
|
+
bbox?: number[];
|
|
12
|
+
};
|
|
13
|
+
|
|
7
14
|
/**
|
|
8
15
|
* Custom provider for OS OpenNames search.
|
|
9
16
|
*/
|
|
@@ -37,18 +44,28 @@ export const osOpenNamesSearch = (options?: SearchOption) => {
|
|
|
37
44
|
return [];
|
|
38
45
|
}
|
|
39
46
|
|
|
40
|
-
return features
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
return features
|
|
48
|
+
.map((feature) => {
|
|
49
|
+
if (feature.geometry.type === 'Point') {
|
|
50
|
+
const result: SearchResult = {
|
|
51
|
+
lon: feature.geometry.coordinates[0],
|
|
52
|
+
lat: feature.geometry.coordinates[1],
|
|
53
|
+
address: feature?.properties?.address,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Only include bbox if it's not empty
|
|
57
|
+
if (feature.bbox && Array.isArray(feature.bbox) && feature.bbox.length > 0) {
|
|
58
|
+
result.bbox = feature.bbox;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
console.error('Geometry type is not Point');
|
|
65
|
+
|
|
66
|
+
return null;
|
|
67
|
+
})
|
|
68
|
+
.filter(Boolean);
|
|
52
69
|
},
|
|
53
70
|
};
|
|
54
71
|
};
|
|
File without changes
|