@tracktor/map 1.0.4 → 1.0.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.
@@ -1,6 +1,6 @@
1
1
  import { ComponentType, ReactNode } from 'react';
2
2
  import { CustomMarkerMapProps } from '../utils/loadMarkers.tsx';
3
- export interface MarkerProps {
3
+ export interface MarkerProps<T = Record<string, unknown>> {
4
4
  /**
5
5
  * Optional unique identifier for the marker.
6
6
  */
@@ -52,7 +52,7 @@ export interface MarkerProps {
52
52
  /**
53
53
  * Optional props to pass to the IconComponent.
54
54
  */
55
- iconProps?: Record<string, any>;
55
+ iconProps?: T;
56
56
  /**
57
57
  * Optional custom React component to use as the marker icon.
58
58
  * Overrides iconImage if provided.
@@ -1,9 +1,9 @@
1
- import { Popup, Map } from 'mapbox-gl';
2
- import { RefObject, ReactNode } from 'react';
1
+ import { Map as MapboxMap, Popup } from 'mapbox-gl';
2
+ import { ReactNode, RefObject } from 'react';
3
3
  interface AddPopupProps {
4
4
  coordinates?: [number, number];
5
5
  tooltip?: ReactNode;
6
- map: RefObject<Map | null>;
6
+ map: RefObject<MapboxMap | null>;
7
7
  }
8
8
  /**
9
9
  * Adds a React-based popup to a Mapbox map
@@ -1,8 +1,8 @@
1
- import { Map } from 'mapbox-gl';
1
+ import { Map as MapboxMap, PointLike } from 'mapbox-gl';
2
2
  import { RefObject } from 'react';
3
3
  interface GetFeatureProps {
4
- map: RefObject<Map | null>;
5
- point: any;
4
+ map: RefObject<MapboxMap | null>;
5
+ point: PointLike;
6
6
  }
7
7
  /**
8
8
  * Handles map click events to display popups
@@ -14,5 +14,5 @@ interface GetFeatureProps {
14
14
  *
15
15
  * @param {GetFeatureProps} options - Configuration params
16
16
  */
17
- declare const getFeature: ({ map, point }: GetFeatureProps) => (import('mapbox-gl').GeoJSONFeature & import('../types/typeguard').ClickedFeature) | null | undefined;
17
+ declare const getFeature: ({ map, point }: GetFeatureProps) => (import('mapbox-gl').GeoJSONFeature & import('./typeguard').ClickedFeature) | null | undefined;
18
18
  export default getFeature;
@@ -1,5 +1,5 @@
1
1
  import { Palette } from '@tracktor/design-system';
2
- import { Map } from 'mapbox-gl';
2
+ import { Map as MapboxMap } from 'mapbox-gl';
3
3
  import { ComponentType, RefObject } from 'react';
4
4
  import { MarkerProps } from '../types/MarkerProps.ts';
5
5
  export interface CustomMarkerMapProps {
@@ -14,9 +14,9 @@ export interface CustomMarkerMapProps {
14
14
  zIndex: number;
15
15
  pointerEvents?: string;
16
16
  name?: string;
17
- iconProps?: Record<string, any>;
17
+ iconProps?: Record<string, unknown>;
18
18
  onClick?: (markerData?: CustomMarkerMapProps) => void;
19
- IconComponent?: ComponentType<any>;
19
+ IconComponent?: ComponentType<unknown>;
20
20
  };
21
21
  type: string;
22
22
  }
@@ -25,7 +25,7 @@ interface GenerateMarkersProps {
25
25
  type?: string;
26
26
  }
27
27
  interface LoadMarkersProps {
28
- map: RefObject<Map | null>;
28
+ map: RefObject<MapboxMap | null>;
29
29
  palette: Palette;
30
30
  markers: MarkerProps[];
31
31
  }
@@ -12,6 +12,14 @@ export interface ClickedFeature {
12
12
  properties: FeatureProperties;
13
13
  [key: string]: unknown;
14
14
  }
15
+ /**
16
+ * Type guard to check if the given geometry is a valid GeoJSON Point geometry
17
+ * @param geometry
18
+ */
15
19
  export declare const isFeatureGeometry: (geometry: unknown) => geometry is GeometryPoint;
20
+ /**
21
+ * Type guard to check if the given feature is a ClickedFeature
22
+ * @param feature
23
+ */
16
24
  export declare const isClickedFeature: (feature: unknown) => feature is ClickedFeature;
17
25
  export {};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A react library to easily display map with multiple tools",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
- "version": "1.0.4",
6
+ "version": "1.0.6",
7
7
  "type": "module",
8
8
  "main": "dist/main.umd.cjs",
9
9
  "module": "dist/main.js",
@@ -18,7 +18,8 @@
18
18
  "scripts": {
19
19
  "example": "vite",
20
20
  "build": "tsc && vite build",
21
- "lint": "eslint .",
21
+ "lint": "biome check --diagnostic-level=error . && tsc --noEmit --incremental",
22
+ "lint:fix": "biome check . --write",
22
23
  "prepublishOnly": "yarn build",
23
24
  "preview": "vite preview"
24
25
  },
@@ -33,12 +34,12 @@
33
34
  "mapbox-gl": "^3.12.0"
34
35
  },
35
36
  "devDependencies": {
37
+ "@tracktor/biome-config-react": "^1.1.1",
36
38
  "@types/mapbox-gl": "^3.4.1",
37
39
  "@types/node": "^22.14.0",
38
40
  "@types/react": "^19.0.0",
39
41
  "@types/react-dom": "^19.0.0",
40
42
  "@vitejs/plugin-react": "^4.6.0",
41
- "eslint-config-react-tracktor": "^1.10.0",
42
43
  "react": "^19.0.0",
43
44
  "react-dom": "^19.0.0",
44
45
  "typescript": "~5.8.3",