@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.
package/README.md CHANGED
@@ -55,27 +55,27 @@ const markers = [
55
55
 
56
56
  ### MarkerMap Props
57
57
 
58
- | Prop | Type | Description |
59
- |--------------------|----------------------------------|-------------------------------------------------------------------------|
60
- | `markers` | `MarkerProps[]` | List of markers to display |
61
- | `center` | `LngLatLike` or `[number, number]` | Initial map center coordinates |
62
- | `zoom` | `number` | Initial zoom level |
63
- | `fitBounds` | `boolean` | Automatically fit the map to the bounds of all markers |
64
- | `fitBoundsPadding` | `number` | Padding around markers when fitting bounds |
65
- | `zoomFlyFrom` | `number` | Zoom level to fly in from |
66
- | `popupMaxWidth` | `string` | Max width for popups |
67
- | `width` | `number` or `string` | Map width |
68
- | `height` | `number` or `string` | Map height |
69
- | `loading` | `boolean` | Whether to show a loading state |
70
- | `markerImageURL` | `string` | Default marker image URL |
71
- | `containerStyle` | `SxProps` | Custom styles for the map container |
72
- | `disableFlyTo` | `boolean` | Disable flyTo animation on marker click |
73
- | `flyToDuration` | `number` | Duration of the flyTo animation |
74
- | `fitBoundDuration` | `number` | Duration of the fitBounds animation |
75
- | `square` | `boolean` | Forces the map to be square-shaped |
76
- | `openPopup` | `number` or `string` | ID of the marker with an open popup |
77
- | `openPopupOnHover` | `boolean` | Automatically open popups on marker hover |
78
- | `onMapClick` | `(lng: number, lat: number) => void` | Callback triggered when clicking on the map |
58
+ | Prop | Type | Description |
59
+ |--------------------|--------------------------------------|--------------------------------------------------------|
60
+ | `markers` | `MarkerProps[]` | List of markers to display |
61
+ | `center` | `LngLatLike` or `[number, number]` | Initial map center coordinates |
62
+ | `zoom` | `number` | Initial zoom level |
63
+ | `fitBounds` | `boolean` | Automatically fit the map to the bounds of all markers |
64
+ | `fitBoundsPadding` | `number` | Padding around markers when fitting bounds |
65
+ | `zoomFlyFrom` | `number` | Zoom level to fly in from |
66
+ | `popupMaxWidth` | `string` | Max width for popups |
67
+ | `width` | `number` or `string` | Map width |
68
+ | `height` | `number` or `string` | Map height |
69
+ | `loading` | `boolean` | Whether to show a loading state |
70
+ | `markerImageURL` | `string` | Default marker image URL |
71
+ | `containerStyle` | `SxProps` | Custom styles for the map container |
72
+ | `disableFlyTo` | `boolean` | Disable flyTo animation on marker click |
73
+ | `flyToDuration` | `number` | Duration of the flyTo animation |
74
+ | `fitBoundDuration` | `number` | Duration of the fitBounds animation |
75
+ | `square` | `boolean` | Forces the map to be square-shaped |
76
+ | `openPopup` | `number` or `string` | ID of the marker with an open popup |
77
+ | `openPopupOnHover` | `boolean` | Automatically open popups on marker hover |
78
+ | `onMapClick` | `(lng: number, lat: number) => void` | Callback triggered when clicking on the map |
79
79
 
80
80
  ### MarkerProps
81
81
 
@@ -93,9 +93,6 @@ const markers = [
93
93
  | `name` | `string` | Name of the marker |
94
94
  | `Icon` | `ReactNode` | Custom React component to render instead of default image |
95
95
 
96
- ## 🖼 Visual Example
97
-
98
- <img src="./src/assets/example.png" alt="MarkerMap Example" width="400" />
99
96
 
100
97
  ## 🧑‍💻 Contributing
101
98
 
@@ -1,4 +1,4 @@
1
- import { Map } from 'mapbox-gl';
1
+ import { Map as MapboxMap } from 'mapbox-gl';
2
2
  import { MarkerMapProps } from '../../types/MarkerMapProps';
3
3
  export declare const DEFAULT_CENTER_LNG = 2.333;
4
4
  export declare const DEFAULT_CENTER_LAT = 46.8677;
@@ -15,8 +15,9 @@ export declare const DEFAULT_CENTER_LAT = 46.8677;
15
15
  */
16
16
  declare const useMarkerMap: ({ markers, center, disableAnimation, openPopup, onMapClick, projection, theme, mapStyle, fitBoundsAnimationKey, baseMapView, zoom, fitBoundsPadding, fitBoundDuration, fitBounds, cooperativeGestures, doubleClickZoom, }: MarkerMapProps) => {
17
17
  containerRef: import('react').RefObject<string | HTMLDivElement>;
18
+ currentTheme: import('@tracktor/design-system').PaletteMode;
18
19
  isMapInitialized: boolean;
19
- map: import('react').RefObject<Map | null>;
20
- markers: import('../../main').MarkerProps[];
20
+ map: import('react').RefObject<MapboxMap | null>;
21
+ markers: import('../../main').MarkerProps<Record<string, unknown>>[];
21
22
  };
22
23
  export default useMarkerMap;
@@ -1,8 +1,8 @@
1
- import { Map } from 'mapbox-gl';
1
+ import { Map as MapboxMap } from 'mapbox-gl';
2
2
  import { RefObject } from 'react';
3
3
  import { MarkerProps } from '../types/MarkerProps.ts';
4
4
  type useFitBoundsProps = {
5
- map: RefObject<Map | null>;
5
+ map: RefObject<MapboxMap | null>;
6
6
  disableAnimation: boolean | undefined;
7
7
  fitBounds?: boolean;
8
8
  fitBoundDuration?: number;
@@ -1,9 +1,9 @@
1
1
  import { Palette } from '@tracktor/design-system';
2
- import { LngLatLike, Map } from 'mapbox-gl';
2
+ import { LngLatLike, Map as MapboxMap } from 'mapbox-gl';
3
3
  import { RefObject } from 'react';
4
4
  import { MarkerProps } from '../types/MarkerProps.ts';
5
5
  type UseInitializeMapProps = {
6
- map: RefObject<Map | null>;
6
+ map: RefObject<MapboxMap | null>;
7
7
  markers?: MarkerProps[];
8
8
  palette: Palette;
9
9
  isMapInitialized: boolean;
@@ -1,7 +1,7 @@
1
- import { Map } from 'mapbox-gl';
1
+ import { Map as MapboxMap } from 'mapbox-gl';
2
2
  import { RefObject } from 'react';
3
3
  type UseCorrectedMapClickProps = {
4
- map: RefObject<Map | null>;
4
+ map: RefObject<MapboxMap | null>;
5
5
  onMapClick?: (lng: number, lat: number) => void;
6
6
  isMapInitialized?: boolean;
7
7
  };
@@ -1,8 +1,8 @@
1
- import { Map } from 'mapbox-gl';
1
+ import { Map as MapboxMap } from 'mapbox-gl';
2
2
  import { RefObject } from 'react';
3
3
  import { MarkerProps } from '../types/MarkerProps';
4
4
  type UsePopupsProps = {
5
- map: RefObject<Map | null>;
5
+ map: RefObject<MapboxMap | null>;
6
6
  markers?: MarkerProps[];
7
7
  openPopup: string | number | undefined;
8
8
  isMapInitialized: boolean;
package/dist/main.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- export { DEFAULT_CENTER_LNG } from './constants/coordinates.ts';
2
- export { DEFAULT_CENTER_LAT } from './constants/coordinates.ts';
3
- export { default as MapProvider } from './context/MapProvider';
4
- export * from './context/MapProvider';
5
- export { default as MarkerMap } from './components/MarkerMap/MarkerMap';
6
1
  export * from './components/MarkerMap/MarkerMap';
7
- export { default as isValidLatLng } from './utils/isValidLatLng';
8
- export * from './utils/isValidLatLng';
9
- export * from './types/MarkerProps';
2
+ export { default as MarkerMap } from './components/MarkerMap/MarkerMap';
3
+ export { DEFAULT_CENTER_LAT, DEFAULT_CENTER_LNG } from './constants/coordinates.ts';
4
+ export * from './context/MapProvider';
5
+ export { default as MapProvider } from './context/MapProvider';
10
6
  export * from './types/MarkerMapProps';
7
+ export * from './types/MarkerProps';
8
+ export * from './utils/isValidLatLng';
9
+ export { default as isValidLatLng } from './utils/isValidLatLng';