///
import React from 'react';
import type { Coordinate, ElementType, FeatureType, Styler } from './types';
export declare type MapClickEvent = {
x: number;
y: number;
lat: number;
lng: number;
event: React.MouseEvent;
};
export declare type Library = 'maps' | 'places' | 'geocoding' | 'routes' | 'marker' | 'geometry' | 'elevation' | 'streetView' | 'journeySharing' | 'drawing' | 'visualization';
export declare type LoaderOptions = {
key: string;
id?: string;
version?: string;
region?: string;
/**
* @see https://developers.google.com/maps/documentation/javascript/libraries#libraries-for-dynamic-library-import
*/
libraries?: Library[];
};
export declare type MapType = 'roadmap' | 'satellite' | 'hybrid' | 'terrain';
export declare type MapOptions = {
/**
* The Map ID of the map. This parameter cannot be set or changed after a map is instantiated.
*/
mapId?: string;
/**
* When false, map icons are not clickable.
* @default true
*/
clickableIcons?: boolean;
/**
* @default { lat: 0, lng: 0 }
*/
defaultCenter?: {
lat: number;
lng: number;
};
/**
* disables all default UI buttons.
* @default false
*/
disableDefaultUI?: boolean;
/**
* disables zoom and center on double click.
* @default false
*/
disableDoubleClickZoom?: boolean;
/**
* @default 2
*/
defaultZoom?: number;
/**
* "cooperative": Scroll events and one-finger touch gestures scroll the page, and do not zoom or pan the map. Two-finger touch gestures pan and zoom the map. Scroll events with a ctrl or command key pressed zoom the map.\
* "greedy": All touch gestures and scroll events pan or zoom the map.\
* "none": The map cannot be panned or zoomed by user gestures.\
* "auto": Gesture handling is either cooperative or greedy, depending on whether the page is scrollable or in an iframe.\
* @default 'auto'
*/
gestureHandling?: 'cooperative' | 'greedy' | 'none' | 'auto';
/**
* @default 18
*/
maxZoom?: number;
/**
* @default 0
*/
minZoom?: number;
/**
* hybrid This map type displays a transparent layer of major streets on satellite images.
* roadmap This map type displays a normal street map.
* satellite This map type displays satellite images.
* terrain This map type displays maps with physical features such as terrain and vegetation.
* @default 'roadmap'
*/
mapType?: MapType;
styles?: {
elementType?: ElementType | undefined;
featureType?: FeatureType | undefined;
stylers: Styler[];
}[];
};
export declare type MapApi = {
getZoom: () => number;
setZoom: (zoom: number) => void;
getBounds: () => [westLng: number, southLat: number, eastLng: number, northLat: number];
panTo: (coordinate: Coordinate) => void;
fitBounds: (coordinates: Coordinate[]) => void;
getCenter: () => {
lat: number;
lng: number;
};
setMapType: (mapType: MapType) => void;
isBoundContains: (coordinate: Coordinate) => boolean;
getPlaceDetails: (params: {
placeId: string;
fields?: string[];
language: google.maps.places.PlaceDetailsRequest['language'];
}) => Promise;
};
export declare type Maps = {
map: google.maps.Map;
maps: typeof google.maps;
};
export declare const useMap: () => Maps & {
api: MapApi;
};
declare const Map: React.ForwardRefExoticComponent<{
loaderOptions: LoaderOptions;
mapOptions: MapOptions;
onMapClick?: ((event: MapClickEvent) => void) | undefined;
onApiLoaded?: ((maps: Maps) => void) | undefined;
/**
* `loaderOptions.libraries` should include `'places'` to use this.\
* `mapOptions.clickableIcons` should be `true` to use this.\
* clickableIcons can modify with `mapOptions.styles`
*/
onPlaceClick?: ((placeId: string) => void) | undefined;
children?: React.ReactNode;
} & React.RefAttributes>;
export { Map };