@@ -61,6 +61,8 @@ export interface MapViewProps extends MapboxCoreOptions {
6161 style : mapboxgl . StyleSpecification ,
6262 ) => mapboxgl . StyleSpecification ;
6363 loadingIgnoredSources ?: string [ ] ;
64+ id ?: string ;
65+ className ?: string ;
6466}
6567
6668export interface MapboxOptionsExt extends MapboxCoreOptions {
@@ -126,12 +128,22 @@ export function MapView(props: MapViewProps) {
126128 transformStyle,
127129 trackResize = true ,
128130 loadingIgnoredSources = [ "elevationMarker" , "crossSectionEndpoints" ] ,
131+ id = "map" ,
132+ className,
129133 ...rest
130134 } = props ;
131135 if ( enableTerrain ) {
132136 terrainSourceID ??= "mapbox-3d-dem" ;
133137 }
134138
139+ useEffect ( ( ) => {
140+ if ( id != null ) {
141+ console . warn (
142+ "Setting a specific element ID for the map is deprecated. Please use className instead." ,
143+ ) ;
144+ }
145+ } , [ id ] ) ;
146+
135147 const _mapboxToken = mapboxToken ?? accessToken ;
136148
137149 if ( _mapboxToken != null ) {
@@ -213,23 +225,26 @@ export function MapView(props: MapViewProps) {
213225 // Get map projection
214226 const _projection = mapRef . current ?. getProjection ( ) ?. name ?? "mercator" ;
215227
216- const className = classNames (
228+ const mapClassName = classNames (
217229 {
218230 "is-rotated" : mapIsRotated ?? false ,
219231 "is-3d-available" : is3DAvailable ,
220232 } ,
221233 `${ _projection } -projection` ,
222234 ) ;
223235
224- const parentClassName = classNames ( {
225- standalone,
226- } ) ;
236+ const parentClassName = classNames (
237+ {
238+ standalone,
239+ } ,
240+ className ,
241+ ) ;
227242
228243 return h (
229244 "div.map-view-container.main-view" ,
230245 { ref : parentRef , className : parentClassName } ,
231246 [
232- h ( "div.mapbox-map# map" , { ref, className } ) ,
247+ h ( "div.mapbox-map. map-view " , { ref, className : mapClassName , id } ) ,
233248 h ( MapLoadingReporter , {
234249 ignoredSources : loadingIgnoredSources ,
235250 } ) ,
0 commit comments