@classic-homes/maps-react 0.2.4 → 0.2.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/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { MapProps, SourceProps, MarkerProps, PopupProps, BaseLayerProps, FeatureClickEventParams, FeatureHoverEventParams, FillLayerProps, LineLayerProps, CircleLayerProps, SymbolLayerProps, FillExtrusionLayerProps, HeatmapLayerProps, LegendProps, LegendGroupProps, CoordinateDisplayProps, BasemapSwitcherProps, LayerManagerProps, MapTheme, MapStyleSpec } from '@classic-homes/maps-core';
3
- export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, BaseMapProps, BasemapApiKeys, BasemapCategory, BasemapDefinition, BasemapProvider, BasemapSwitcherProps, BoundsArray, CATEGORY_META, CITY_LIMITS, CircleLayerProps, ClusterExpandOptions, ClusterFeatureProperties, CoordinateDisplayProps, FLOOD_ZONES, FREE_BASEMAPS, FeatureClickEventParams, FeatureHoverEventParams, FillExtrusionLayerProps, FillLayerProps, GeoJSONFeature, GeoJSONFeatureCollection, GradientStop, HeatmapLayerProps, LayerManagerProps, LegendConfig, LegendGroupProps, LegendItem, LegendProps, LineLayerProps, LngLat, LoadGeoJSONOptions, LoadGeoJSONResult, MapBounds, MapClickEventParams, MapHoverEventParams, MapMoveEventParams, MapProps, MapViewport, MarkerClickEventParams, MarkerData, MarkerDragEventParams, MarkerProps, OSM_STANDARD, OverlayApiKeys, OverlayLayerCategory, OverlayLayerDefinition, OverlayLayerState, PARKS, PopupProps, SCHOOL_DISTRICTS, SPORTS_FACILITIES, SourceProps, SymbolLayerProps, THEME_DARK, THEME_LIGHT, TRAILS, TRANSIT_ROUTES, ValidationResult, WATERSHEDS, ZONING_DISTRICTS, calculateBounds, calculateCentroid, combineBounds, countFeaturesByType, createHoverExpression, createInitialLayerStates, createSelectionExpression, darkBasicStyle, darkTheme, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, formatArea, formatCoordinates, formatDistance, generateMapDescription, getAvailableBasemaps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getLayerCategories, getLayerStyleForTheme, getLayersByCategory, getSelectionStyle, groupLayersByCategory, isClusterFeature, isValidBounds, lightBasicStyle, lightTheme, loadGeoJSON, resolveBasemapStyle, resolveLayerSourceUrl, searchLayers, setLayerOpacity, toggleLayerVisibility, validateGeoJSON } from '@classic-homes/maps-core';
2
+ import { MapProps, PositioningCoordinator, SourceProps, MarkerProps, PopupProps, BaseLayerProps, FeatureClickEventParams, FeatureHoverEventParams, FillLayerProps, LineLayerProps, CircleLayerProps, SymbolLayerProps, FillExtrusionLayerProps, HeatmapLayerProps, LegendProps, LegendGroupProps, CoordinateDisplayProps, BasemapSwitcherProps, LayerManagerProps, ExtendedControlPosition, ControlPriority, ZIndexLayer, MapTheme, MapStyleSpec, ControlType, ControlOffset } from '@classic-homes/maps-core';
3
+ export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, BaseMapProps, BasemapApiKeys, BasemapCategory, BasemapDefinition, BasemapProvider, BasemapSwitcherProps, BoundsArray, CATEGORY_META, CITY_LIMITS, CircleLayerProps, ClusterExpandOptions, ClusterFeatureProperties, ControlOffset, ControlPriority, ControlType, CoordinateDisplayProps, DEFAULT_BASEMAP, ExtendedControlPosition, FLOOD_ZONES, FREE_BASEMAPS, FeatureClickEventParams, FeatureHoverEventParams, FillExtrusionLayerProps, FillLayerProps, GeoJSONFeature, GeoJSONFeatureCollection, GradientStop, HeatmapLayerProps, LayerManagerProps, LegendConfig, LegendGroupProps, LegendItem, LegendProps, LineLayerProps, LngLat, LoadGeoJSONOptions, LoadGeoJSONResult, MapBounds, MapClickEventParams, MapHoverEventParams, MapMoveEventParams, MapProps, MapViewport, MarkerClickEventParams, MarkerData, MarkerDragEventParams, MarkerProps, OSM_STANDARD, OverlayApiKeys, OverlayLayerCategory, OverlayLayerDefinition, OverlayLayerState, PARKS, PRIMARY_BASEMAPS, PopupProps, SATELLITE_BASEMAP, SCHOOL_DISTRICTS, SPORTS_FACILITIES, SourceProps, SymbolLayerProps, THEME_DARK, THEME_LIGHT, TOPO_BASEMAP, TRAILS, TRANSIT_ROUTES, ValidationResult, WATERSHEDS, ZIndexLayer, ZONING_DISTRICTS, calculateBounds, calculateCentroid, combineBounds, countFeaturesByType, createHoverExpression, createInitialLayerStates, createSelectionExpression, darkBasicStyle, darkTheme, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, formatArea, formatCoordinates, formatDistance, generateMapDescription, getAvailableBasemaps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getLayerCategories, getLayerStyleForTheme, getLayersByCategory, getSelectionStyle, groupLayersByCategory, isClusterFeature, isValidBounds, lightBasicStyle, lightTheme, loadGeoJSON, resolveBasemapStyle, resolveLayerSourceUrl, searchLayers, setLayerOpacity, toggleLayerVisibility, validateGeoJSON } from '@classic-homes/maps-core';
4
4
  import maplibregl, { Map as Map$1, StyleSpecification } from 'maplibre-gl';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
6
6
  import { VariantProps } from 'class-variance-authority';
@@ -100,10 +100,6 @@ interface MapComponentProps extends Omit<MapProps, 'class'> {
100
100
  */
101
101
  declare const Map: React.ForwardRefExoticComponent<MapComponentProps & React.RefAttributes<HTMLDivElement>>;
102
102
 
103
- /**
104
- * Control offset configuration for each position
105
- */
106
- type ControlOffsets = Record<string, number>;
107
103
  /**
108
104
  * Context for sharing the MapLibre map instance with child components
109
105
  */
@@ -112,18 +108,12 @@ interface MapContextValue {
112
108
  map: Map$1 | null;
113
109
  /** Whether the map has loaded */
114
110
  loaded: boolean;
115
- /** Pixel offsets for each position based on active controls */
116
- controlOffsets?: ControlOffsets;
117
- /** Register a custom control and get its vertical offset */
118
- registerControl?: (id: string, position: string, height: number) => number;
119
- /** Unregister a custom control */
120
- unregisterControl?: (id: string, position: string) => void;
121
- /** Get the vertical offset for a control */
122
- getCustomControlOffset?: (id: string, position: string) => number;
123
111
  /** Counter incremented on each style.load event, used to re-initialize sources/layers */
124
112
  styleVersion: number;
125
113
  /** Set the map style programmatically (e.g. basemap switching) */
126
114
  setMapStyle?: (style: string | StyleSpecification) => void;
115
+ /** Positioning coordinator for centralized control positioning */
116
+ positioningCoordinator: PositioningCoordinator;
127
117
  }
128
118
  declare const MapContext: React.Context<MapContextValue | null>;
129
119
  /**
@@ -350,6 +340,66 @@ interface LayerManagerComponentProps extends LayerManagerProps {
350
340
  */
351
341
  declare const LayerManager: React.FC<LayerManagerComponentProps>;
352
342
 
343
+ interface CustomControlProps {
344
+ /** Position on the map (default: 'top-right') */
345
+ position?: ExtendedControlPosition;
346
+ /** Fallback positions if primary is occupied */
347
+ fallbacks?: ExtendedControlPosition[];
348
+ /** Priority for collision resolution (default: 'normal') */
349
+ priority?: ControlPriority;
350
+ /** Z-index layer (default: 'interactive') */
351
+ zLayer?: ZIndexLayer;
352
+ /** Optional unique ID (auto-generated if not provided) */
353
+ id?: string;
354
+ /** Whether the control has an expandable state */
355
+ hasExpandedState?: boolean;
356
+ /** Additional CSS class names */
357
+ className?: string;
358
+ /** Inline styles (merged with positioning styles) */
359
+ style?: React.CSSProperties;
360
+ /** Child content */
361
+ children: React.ReactNode;
362
+ }
363
+ /**
364
+ * CustomControl component for positioning arbitrary content on the map
365
+ *
366
+ * This component integrates with the map's positioning coordinator for
367
+ * collision avoidance and proper stacking with other controls.
368
+ *
369
+ * @example
370
+ * ```tsx
371
+ * <Map>
372
+ * <CustomControl position="top-right">
373
+ * <div className="bg-white p-2 rounded shadow">
374
+ * Custom widget content
375
+ * </div>
376
+ * </CustomControl>
377
+ * </Map>
378
+ * ```
379
+ */
380
+ declare const CustomControl: React.FC<CustomControlProps>;
381
+ /**
382
+ * Context for accessing CustomControl methods from children
383
+ */
384
+ interface CustomControlContextValue {
385
+ /** Update the expanded state of the control */
386
+ setExpanded: (isExpanded: boolean) => void;
387
+ }
388
+ /**
389
+ * Hook to access the CustomControl context from child components
390
+ *
391
+ * @example
392
+ * ```tsx
393
+ * const MyExpandableContent = () => {
394
+ * const { setExpanded } = useCustomControl();
395
+ * return (
396
+ * <button onClick={() => setExpanded(true)}>Expand</button>
397
+ * );
398
+ * };
399
+ * ```
400
+ */
401
+ declare function useCustomControl(): CustomControlContextValue;
402
+
353
403
  /**
354
404
  * Props for the DeckOverlay component
355
405
  */
@@ -433,9 +483,72 @@ declare function useMapTheme(preference?: 'light' | 'dark' | 'auto'): {
433
483
  */
434
484
  declare function useReducedMotion(): boolean;
435
485
 
486
+ /**
487
+ * Options for useControlPosition hook
488
+ */
489
+ interface UseControlPositionOptions {
490
+ /** Unique identifier for the control instance */
491
+ id: string;
492
+ /** Type of control */
493
+ type: ControlType;
494
+ /** Primary position for the control */
495
+ position: ExtendedControlPosition;
496
+ /** Fallback positions to try if primary is occupied */
497
+ fallbacks?: ExtendedControlPosition[];
498
+ /** Priority level for collision resolution (default: 'normal') */
499
+ priority?: ControlPriority;
500
+ /** Z-index layer (default: 'interactive') */
501
+ zLayer?: ZIndexLayer;
502
+ /** Whether the control has an expanded state */
503
+ hasExpandedState?: boolean;
504
+ /** Whether the control is a built-in MapLibre control */
505
+ isBuiltIn?: boolean;
506
+ }
507
+ /**
508
+ * Return value from useControlPosition hook
509
+ */
510
+ interface UseControlPositionResult {
511
+ /** Current computed offset and position */
512
+ offset: ControlOffset | null;
513
+ /** Update the expanded state */
514
+ setExpanded: (isExpanded: boolean) => void;
515
+ /** Style object to apply to the control */
516
+ style: React.CSSProperties;
517
+ /** Whether the control should be visible */
518
+ visible: boolean;
519
+ }
520
+ /**
521
+ * Hook for registering a control with the positioning coordinator
522
+ *
523
+ * Handles auto-registration on mount, dimension updates via ResizeObserver,
524
+ * and cleanup on unmount.
525
+ *
526
+ * @param ref - Ref to the control element
527
+ * @param options - Control registration options
528
+ * @returns Position offset, visibility, and style to apply
529
+ *
530
+ * @example
531
+ * ```tsx
532
+ * const legendRef = useRef<HTMLDivElement>(null);
533
+ * const { style, visible, setExpanded } = useControlPosition(legendRef, {
534
+ * id: 'legend-1',
535
+ * type: 'legend',
536
+ * position: 'bottom-left',
537
+ * priority: 'normal',
538
+ * });
539
+ *
540
+ * return (
541
+ * <div ref={legendRef} style={style} hidden={!visible}>
542
+ * ...
543
+ * </div>
544
+ * );
545
+ * ```
546
+ */
547
+ declare function useControlPosition(ref: React.RefObject<HTMLElement | null>, options: UseControlPositionOptions): UseControlPositionResult;
548
+
436
549
  /**
437
550
  * Merge class names with Tailwind CSS conflict resolution
438
551
  */
439
552
  declare function cn(...inputs: ClassValue[]): string;
440
553
 
441
- export { BasemapSwitcher, type BasemapSwitcherComponentProps, CircleLayer, type CircleLayerComponentProps, CoordinateDisplay, type CoordinateDisplayComponentProps, DeckOverlay, type DeckOverlayProps, FillExtrusionLayer, type FillExtrusionLayerComponentProps, FillLayer, type FillLayerComponentProps, HeatmapLayer, type HeatmapLayerComponentProps, LayerManager, type LayerManagerComponentProps, Legend, type LegendComponentProps, LegendGroup, type LegendGroupComponentProps, LineLayer, type LineLayerComponentProps, Map, type MapComponentProps, MapContainer, type MapContainerProps, MapContext, type MapContextValue, MapEmpty, type MapEmptyProps, MapError, type MapErrorProps, MapSkeleton, type MapSkeletonProps, Marker, type MarkerComponentProps, Popup, PopupCard, type PopupCardProps, type PopupComponentProps, PopupContent, type PopupContentProps, PopupFooter, type PopupFooterProps, PopupHeader, type PopupHeaderProps, type ReactFeatureClickEventParams, type ReactFeatureHoverEventParams, Source, type SourceComponentProps, SymbolLayer, type SymbolLayerComponentProps, type UseLayerOptions, cn, useLayer, useMap, useMapInstance, useMapTheme, useReducedMotion };
554
+ export { BasemapSwitcher, type BasemapSwitcherComponentProps, CircleLayer, type CircleLayerComponentProps, CoordinateDisplay, type CoordinateDisplayComponentProps, CustomControl, type CustomControlContextValue, type CustomControlProps, DeckOverlay, type DeckOverlayProps, FillExtrusionLayer, type FillExtrusionLayerComponentProps, FillLayer, type FillLayerComponentProps, HeatmapLayer, type HeatmapLayerComponentProps, LayerManager, type LayerManagerComponentProps, Legend, type LegendComponentProps, LegendGroup, type LegendGroupComponentProps, LineLayer, type LineLayerComponentProps, Map, type MapComponentProps, MapContainer, type MapContainerProps, MapContext, type MapContextValue, MapEmpty, type MapEmptyProps, MapError, type MapErrorProps, MapSkeleton, type MapSkeletonProps, Marker, type MarkerComponentProps, Popup, PopupCard, type PopupCardProps, type PopupComponentProps, PopupContent, type PopupContentProps, PopupFooter, type PopupFooterProps, PopupHeader, type PopupHeaderProps, type ReactFeatureClickEventParams, type ReactFeatureHoverEventParams, Source, type SourceComponentProps, SymbolLayer, type SymbolLayerComponentProps, type UseControlPositionOptions, type UseControlPositionResult, type UseLayerOptions, cn, useControlPosition, useCustomControl, useLayer, useMap, useMapInstance, useMapTheme, useReducedMotion };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { MapProps, SourceProps, MarkerProps, PopupProps, BaseLayerProps, FeatureClickEventParams, FeatureHoverEventParams, FillLayerProps, LineLayerProps, CircleLayerProps, SymbolLayerProps, FillExtrusionLayerProps, HeatmapLayerProps, LegendProps, LegendGroupProps, CoordinateDisplayProps, BasemapSwitcherProps, LayerManagerProps, MapTheme, MapStyleSpec } from '@classic-homes/maps-core';
3
- export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, BaseMapProps, BasemapApiKeys, BasemapCategory, BasemapDefinition, BasemapProvider, BasemapSwitcherProps, BoundsArray, CATEGORY_META, CITY_LIMITS, CircleLayerProps, ClusterExpandOptions, ClusterFeatureProperties, CoordinateDisplayProps, FLOOD_ZONES, FREE_BASEMAPS, FeatureClickEventParams, FeatureHoverEventParams, FillExtrusionLayerProps, FillLayerProps, GeoJSONFeature, GeoJSONFeatureCollection, GradientStop, HeatmapLayerProps, LayerManagerProps, LegendConfig, LegendGroupProps, LegendItem, LegendProps, LineLayerProps, LngLat, LoadGeoJSONOptions, LoadGeoJSONResult, MapBounds, MapClickEventParams, MapHoverEventParams, MapMoveEventParams, MapProps, MapViewport, MarkerClickEventParams, MarkerData, MarkerDragEventParams, MarkerProps, OSM_STANDARD, OverlayApiKeys, OverlayLayerCategory, OverlayLayerDefinition, OverlayLayerState, PARKS, PopupProps, SCHOOL_DISTRICTS, SPORTS_FACILITIES, SourceProps, SymbolLayerProps, THEME_DARK, THEME_LIGHT, TRAILS, TRANSIT_ROUTES, ValidationResult, WATERSHEDS, ZONING_DISTRICTS, calculateBounds, calculateCentroid, combineBounds, countFeaturesByType, createHoverExpression, createInitialLayerStates, createSelectionExpression, darkBasicStyle, darkTheme, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, formatArea, formatCoordinates, formatDistance, generateMapDescription, getAvailableBasemaps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getLayerCategories, getLayerStyleForTheme, getLayersByCategory, getSelectionStyle, groupLayersByCategory, isClusterFeature, isValidBounds, lightBasicStyle, lightTheme, loadGeoJSON, resolveBasemapStyle, resolveLayerSourceUrl, searchLayers, setLayerOpacity, toggleLayerVisibility, validateGeoJSON } from '@classic-homes/maps-core';
2
+ import { MapProps, PositioningCoordinator, SourceProps, MarkerProps, PopupProps, BaseLayerProps, FeatureClickEventParams, FeatureHoverEventParams, FillLayerProps, LineLayerProps, CircleLayerProps, SymbolLayerProps, FillExtrusionLayerProps, HeatmapLayerProps, LegendProps, LegendGroupProps, CoordinateDisplayProps, BasemapSwitcherProps, LayerManagerProps, ExtendedControlPosition, ControlPriority, ZIndexLayer, MapTheme, MapStyleSpec, ControlType, ControlOffset } from '@classic-homes/maps-core';
3
+ export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, BaseMapProps, BasemapApiKeys, BasemapCategory, BasemapDefinition, BasemapProvider, BasemapSwitcherProps, BoundsArray, CATEGORY_META, CITY_LIMITS, CircleLayerProps, ClusterExpandOptions, ClusterFeatureProperties, ControlOffset, ControlPriority, ControlType, CoordinateDisplayProps, DEFAULT_BASEMAP, ExtendedControlPosition, FLOOD_ZONES, FREE_BASEMAPS, FeatureClickEventParams, FeatureHoverEventParams, FillExtrusionLayerProps, FillLayerProps, GeoJSONFeature, GeoJSONFeatureCollection, GradientStop, HeatmapLayerProps, LayerManagerProps, LegendConfig, LegendGroupProps, LegendItem, LegendProps, LineLayerProps, LngLat, LoadGeoJSONOptions, LoadGeoJSONResult, MapBounds, MapClickEventParams, MapHoverEventParams, MapMoveEventParams, MapProps, MapViewport, MarkerClickEventParams, MarkerData, MarkerDragEventParams, MarkerProps, OSM_STANDARD, OverlayApiKeys, OverlayLayerCategory, OverlayLayerDefinition, OverlayLayerState, PARKS, PRIMARY_BASEMAPS, PopupProps, SATELLITE_BASEMAP, SCHOOL_DISTRICTS, SPORTS_FACILITIES, SourceProps, SymbolLayerProps, THEME_DARK, THEME_LIGHT, TOPO_BASEMAP, TRAILS, TRANSIT_ROUTES, ValidationResult, WATERSHEDS, ZIndexLayer, ZONING_DISTRICTS, calculateBounds, calculateCentroid, combineBounds, countFeaturesByType, createHoverExpression, createInitialLayerStates, createSelectionExpression, darkBasicStyle, darkTheme, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, formatArea, formatCoordinates, formatDistance, generateMapDescription, getAvailableBasemaps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getLayerCategories, getLayerStyleForTheme, getLayersByCategory, getSelectionStyle, groupLayersByCategory, isClusterFeature, isValidBounds, lightBasicStyle, lightTheme, loadGeoJSON, resolveBasemapStyle, resolveLayerSourceUrl, searchLayers, setLayerOpacity, toggleLayerVisibility, validateGeoJSON } from '@classic-homes/maps-core';
4
4
  import maplibregl, { Map as Map$1, StyleSpecification } from 'maplibre-gl';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
6
6
  import { VariantProps } from 'class-variance-authority';
@@ -100,10 +100,6 @@ interface MapComponentProps extends Omit<MapProps, 'class'> {
100
100
  */
101
101
  declare const Map: React.ForwardRefExoticComponent<MapComponentProps & React.RefAttributes<HTMLDivElement>>;
102
102
 
103
- /**
104
- * Control offset configuration for each position
105
- */
106
- type ControlOffsets = Record<string, number>;
107
103
  /**
108
104
  * Context for sharing the MapLibre map instance with child components
109
105
  */
@@ -112,18 +108,12 @@ interface MapContextValue {
112
108
  map: Map$1 | null;
113
109
  /** Whether the map has loaded */
114
110
  loaded: boolean;
115
- /** Pixel offsets for each position based on active controls */
116
- controlOffsets?: ControlOffsets;
117
- /** Register a custom control and get its vertical offset */
118
- registerControl?: (id: string, position: string, height: number) => number;
119
- /** Unregister a custom control */
120
- unregisterControl?: (id: string, position: string) => void;
121
- /** Get the vertical offset for a control */
122
- getCustomControlOffset?: (id: string, position: string) => number;
123
111
  /** Counter incremented on each style.load event, used to re-initialize sources/layers */
124
112
  styleVersion: number;
125
113
  /** Set the map style programmatically (e.g. basemap switching) */
126
114
  setMapStyle?: (style: string | StyleSpecification) => void;
115
+ /** Positioning coordinator for centralized control positioning */
116
+ positioningCoordinator: PositioningCoordinator;
127
117
  }
128
118
  declare const MapContext: React.Context<MapContextValue | null>;
129
119
  /**
@@ -350,6 +340,66 @@ interface LayerManagerComponentProps extends LayerManagerProps {
350
340
  */
351
341
  declare const LayerManager: React.FC<LayerManagerComponentProps>;
352
342
 
343
+ interface CustomControlProps {
344
+ /** Position on the map (default: 'top-right') */
345
+ position?: ExtendedControlPosition;
346
+ /** Fallback positions if primary is occupied */
347
+ fallbacks?: ExtendedControlPosition[];
348
+ /** Priority for collision resolution (default: 'normal') */
349
+ priority?: ControlPriority;
350
+ /** Z-index layer (default: 'interactive') */
351
+ zLayer?: ZIndexLayer;
352
+ /** Optional unique ID (auto-generated if not provided) */
353
+ id?: string;
354
+ /** Whether the control has an expandable state */
355
+ hasExpandedState?: boolean;
356
+ /** Additional CSS class names */
357
+ className?: string;
358
+ /** Inline styles (merged with positioning styles) */
359
+ style?: React.CSSProperties;
360
+ /** Child content */
361
+ children: React.ReactNode;
362
+ }
363
+ /**
364
+ * CustomControl component for positioning arbitrary content on the map
365
+ *
366
+ * This component integrates with the map's positioning coordinator for
367
+ * collision avoidance and proper stacking with other controls.
368
+ *
369
+ * @example
370
+ * ```tsx
371
+ * <Map>
372
+ * <CustomControl position="top-right">
373
+ * <div className="bg-white p-2 rounded shadow">
374
+ * Custom widget content
375
+ * </div>
376
+ * </CustomControl>
377
+ * </Map>
378
+ * ```
379
+ */
380
+ declare const CustomControl: React.FC<CustomControlProps>;
381
+ /**
382
+ * Context for accessing CustomControl methods from children
383
+ */
384
+ interface CustomControlContextValue {
385
+ /** Update the expanded state of the control */
386
+ setExpanded: (isExpanded: boolean) => void;
387
+ }
388
+ /**
389
+ * Hook to access the CustomControl context from child components
390
+ *
391
+ * @example
392
+ * ```tsx
393
+ * const MyExpandableContent = () => {
394
+ * const { setExpanded } = useCustomControl();
395
+ * return (
396
+ * <button onClick={() => setExpanded(true)}>Expand</button>
397
+ * );
398
+ * };
399
+ * ```
400
+ */
401
+ declare function useCustomControl(): CustomControlContextValue;
402
+
353
403
  /**
354
404
  * Props for the DeckOverlay component
355
405
  */
@@ -433,9 +483,72 @@ declare function useMapTheme(preference?: 'light' | 'dark' | 'auto'): {
433
483
  */
434
484
  declare function useReducedMotion(): boolean;
435
485
 
486
+ /**
487
+ * Options for useControlPosition hook
488
+ */
489
+ interface UseControlPositionOptions {
490
+ /** Unique identifier for the control instance */
491
+ id: string;
492
+ /** Type of control */
493
+ type: ControlType;
494
+ /** Primary position for the control */
495
+ position: ExtendedControlPosition;
496
+ /** Fallback positions to try if primary is occupied */
497
+ fallbacks?: ExtendedControlPosition[];
498
+ /** Priority level for collision resolution (default: 'normal') */
499
+ priority?: ControlPriority;
500
+ /** Z-index layer (default: 'interactive') */
501
+ zLayer?: ZIndexLayer;
502
+ /** Whether the control has an expanded state */
503
+ hasExpandedState?: boolean;
504
+ /** Whether the control is a built-in MapLibre control */
505
+ isBuiltIn?: boolean;
506
+ }
507
+ /**
508
+ * Return value from useControlPosition hook
509
+ */
510
+ interface UseControlPositionResult {
511
+ /** Current computed offset and position */
512
+ offset: ControlOffset | null;
513
+ /** Update the expanded state */
514
+ setExpanded: (isExpanded: boolean) => void;
515
+ /** Style object to apply to the control */
516
+ style: React.CSSProperties;
517
+ /** Whether the control should be visible */
518
+ visible: boolean;
519
+ }
520
+ /**
521
+ * Hook for registering a control with the positioning coordinator
522
+ *
523
+ * Handles auto-registration on mount, dimension updates via ResizeObserver,
524
+ * and cleanup on unmount.
525
+ *
526
+ * @param ref - Ref to the control element
527
+ * @param options - Control registration options
528
+ * @returns Position offset, visibility, and style to apply
529
+ *
530
+ * @example
531
+ * ```tsx
532
+ * const legendRef = useRef<HTMLDivElement>(null);
533
+ * const { style, visible, setExpanded } = useControlPosition(legendRef, {
534
+ * id: 'legend-1',
535
+ * type: 'legend',
536
+ * position: 'bottom-left',
537
+ * priority: 'normal',
538
+ * });
539
+ *
540
+ * return (
541
+ * <div ref={legendRef} style={style} hidden={!visible}>
542
+ * ...
543
+ * </div>
544
+ * );
545
+ * ```
546
+ */
547
+ declare function useControlPosition(ref: React.RefObject<HTMLElement | null>, options: UseControlPositionOptions): UseControlPositionResult;
548
+
436
549
  /**
437
550
  * Merge class names with Tailwind CSS conflict resolution
438
551
  */
439
552
  declare function cn(...inputs: ClassValue[]): string;
440
553
 
441
- export { BasemapSwitcher, type BasemapSwitcherComponentProps, CircleLayer, type CircleLayerComponentProps, CoordinateDisplay, type CoordinateDisplayComponentProps, DeckOverlay, type DeckOverlayProps, FillExtrusionLayer, type FillExtrusionLayerComponentProps, FillLayer, type FillLayerComponentProps, HeatmapLayer, type HeatmapLayerComponentProps, LayerManager, type LayerManagerComponentProps, Legend, type LegendComponentProps, LegendGroup, type LegendGroupComponentProps, LineLayer, type LineLayerComponentProps, Map, type MapComponentProps, MapContainer, type MapContainerProps, MapContext, type MapContextValue, MapEmpty, type MapEmptyProps, MapError, type MapErrorProps, MapSkeleton, type MapSkeletonProps, Marker, type MarkerComponentProps, Popup, PopupCard, type PopupCardProps, type PopupComponentProps, PopupContent, type PopupContentProps, PopupFooter, type PopupFooterProps, PopupHeader, type PopupHeaderProps, type ReactFeatureClickEventParams, type ReactFeatureHoverEventParams, Source, type SourceComponentProps, SymbolLayer, type SymbolLayerComponentProps, type UseLayerOptions, cn, useLayer, useMap, useMapInstance, useMapTheme, useReducedMotion };
554
+ export { BasemapSwitcher, type BasemapSwitcherComponentProps, CircleLayer, type CircleLayerComponentProps, CoordinateDisplay, type CoordinateDisplayComponentProps, CustomControl, type CustomControlContextValue, type CustomControlProps, DeckOverlay, type DeckOverlayProps, FillExtrusionLayer, type FillExtrusionLayerComponentProps, FillLayer, type FillLayerComponentProps, HeatmapLayer, type HeatmapLayerComponentProps, LayerManager, type LayerManagerComponentProps, Legend, type LegendComponentProps, LegendGroup, type LegendGroupComponentProps, LineLayer, type LineLayerComponentProps, Map, type MapComponentProps, MapContainer, type MapContainerProps, MapContext, type MapContextValue, MapEmpty, type MapEmptyProps, MapError, type MapErrorProps, MapSkeleton, type MapSkeletonProps, Marker, type MarkerComponentProps, Popup, PopupCard, type PopupCardProps, type PopupComponentProps, PopupContent, type PopupContentProps, PopupFooter, type PopupFooterProps, PopupHeader, type PopupHeaderProps, type ReactFeatureClickEventParams, type ReactFeatureHoverEventParams, Source, type SourceComponentProps, SymbolLayer, type SymbolLayerComponentProps, type UseControlPositionOptions, type UseControlPositionResult, type UseLayerOptions, cn, useControlPosition, useCustomControl, useLayer, useMap, useMapInstance, useMapTheme, useReducedMotion };