import React from 'react'; import type { ColorToken, LatLng, MapPrecision, MapScale } from './map.types'; /** Shape of the rendered mark. `'pin'` reproduces the classic teardrop. */ export type MapMarkerShape = 'pin' | 'circle' | 'square'; export type MapTooltipDirection = 'top' | 'right' | 'bottom' | 'left'; export interface MapMarkerData { position: LatLng; /** Single glyph printed *inside* the pin. Not a cartographic caption. */ label?: string; title?: string; info?: string; /** Literal color. Prefer `colorToken` so the mark follows the theme. */ customColor?: string; icon?: string; iconSvg?: string; iconColor?: string; /** Custom HTML for the InfoWindow. */ infoWindowContent?: string; /** Custom React content for the InfoWindow. */ richContent?: React.ReactNode; /** Stable identity. Required for selection and hover events. */ id?: string; /** @default 'pin' */ shape?: MapMarkerShape; /** Fixed radius in pixels for `shape: 'circle' | 'square'`. */ radiusPx?: number; /** Derives the radius from a data value — proportional symbology. */ scale?: MapScale; /** Semantic color token, e.g. `'--chart-1'`. Wins over `customColor`. */ colorToken?: ColorToken; /** Fill translucency for non-pin shapes. @default 0.85 */ fillOpacity?: number; /** Instant label on hover and on keyboard focus. Does not open the InfoWindow. */ tooltip?: React.ReactNode; /** @default 'top' */ tooltipDirection?: MapTooltipDirection; /** Overrides the generated accessible name. */ ariaLabel?: string; /** How this position was obtained. Surfaced to the user, never inferred. */ precision?: MapPrecision; /** Human-readable explanation of `precision`. */ precisionLabel?: string; /** Arbitrary payload echoed back on selection and hover events. */ data?: unknown; /** Count shown on the marker when it stands for several records. */ badge?: number; /** Accessible description of the badge, e.g. `"12 unidades"`. */ badgeLabel?: string; /** * Cartographic caption drawn *beside* the marker. * * Distinct from `label`, which is the glyph printed *inside* the pin — that * field already exists with that meaning and could not be repurposed. */ caption?: string; /** @default 'none' */ captionMode?: 'permanent' | 'hover' | 'none'; /** @default 'right' */ captionDirection?: 'top' | 'right' | 'bottom' | 'left'; /** Rich content opened on activation, with a way back to the parent. */ popup?: MapMarkerPopup; /** Ties the marker to a `dataLayers` entry. */ layerId?: string; } export interface MapMarkerPopup { content: React.ReactNode; /** Width in pixels. @default 320 */ width?: number; } /** Minimal surface of the `gmp-advanced-marker` custom element we depend on. */ type AdvancedMarkerElement = HTMLElement & { position?: LatLng; innerMarker?: unknown; }; export interface MapMarkerProps { marker: MapMarkerData; index: number; /** Already resolved to a literal — markers never resolve tokens themselves. */ color: string; iconColor: string; selected: boolean; /** True when the map has selection wired up at all. */ selectable: boolean; onActivate: (index: number, element: AdvancedMarkerElement) => void; onHoverChange: (index: number, hovering: boolean) => void; } export interface MapMarkerContentProps { marker: MapMarkerData; index: number; color: string; iconColor: string; selected: boolean; selectable: boolean; onActivate: () => void; onHoverChange: (hovering: boolean) => void; } /** * One marker on the map: its shape, its color, its interaction and its label. * * @description * Extracted into its own component so each marker owns a real `useEffect` with a * cleanup — the previous inline `ref` callback added a `gmp-click` listener on * every render and never removed any of them. * * Interaction is handled on the React content element rather than only on the * custom element, so clicking, focusing and keyboard activation behave the same * whether or not Google has upgraded `gmp-advanced-marker` yet. */ export declare function MapMarker({ marker, index, color, iconColor, selected, selectable, onActivate, onHoverChange, }: MapMarkerProps): React.JSX.Element; /** * The marker itself: shape, color, interaction, accessibility and tooltip. * * @description * Deliberately free of any `google.maps` reference. `MapMarker` hosts it inside * `gmp-advanced-marker`, and the keyless renderer hosts it inside a plain * positioned div — same pixels, same keyboard behavior, same ARIA, whether or * not the Maps script ever loads. */ export declare function MapMarkerContent({ marker, index, color, iconColor, selected, selectable, onActivate, onHoverChange, }: MapMarkerContentProps): React.JSX.Element; export {};