@turingpaper/ui 0.0.1-test.6 → 0.0.1-test.7
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/components/map.d.ts +192 -0
- package/dist/map.mjs +754 -0
- package/dist/provider.mjs +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { default as MapLibreGL, PopupOptions, MarkerOptions } from 'maplibre-gl';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
type Theme = "light" | "dark";
|
|
4
|
+
type MapContextValue = {
|
|
5
|
+
map: MapLibreGL.Map | null;
|
|
6
|
+
isLoaded: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare function useMap(): MapContextValue;
|
|
9
|
+
/** Map viewport state */
|
|
10
|
+
type MapViewport = {
|
|
11
|
+
/** Center coordinates [longitude, latitude] */
|
|
12
|
+
center: [number, number];
|
|
13
|
+
/** Zoom level */
|
|
14
|
+
zoom: number;
|
|
15
|
+
/** Bearing (rotation) in degrees */
|
|
16
|
+
bearing: number;
|
|
17
|
+
/** Pitch (tilt) in degrees */
|
|
18
|
+
pitch: number;
|
|
19
|
+
};
|
|
20
|
+
type MapStyleOption = string | MapLibreGL.StyleSpecification;
|
|
21
|
+
type MapRef = MapLibreGL.Map;
|
|
22
|
+
declare const Map: import('react').ForwardRefExoticComponent<{
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
/** Additional CSS classes for the map container */
|
|
25
|
+
className?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Theme for the map. If not provided, automatically detects system preference.
|
|
28
|
+
* Pass your theme value here.
|
|
29
|
+
*/
|
|
30
|
+
theme?: Theme;
|
|
31
|
+
/** Custom map styles for light and dark themes. Overrides the default Carto styles. */
|
|
32
|
+
styles?: {
|
|
33
|
+
light?: MapStyleOption;
|
|
34
|
+
dark?: MapStyleOption;
|
|
35
|
+
};
|
|
36
|
+
/** Map projection type. Use `{ type: "globe" }` for 3D globe view. */
|
|
37
|
+
projection?: MapLibreGL.ProjectionSpecification;
|
|
38
|
+
/**
|
|
39
|
+
* Controlled viewport. When provided with onViewportChange,
|
|
40
|
+
* the map becomes controlled and viewport is driven by this prop.
|
|
41
|
+
*/
|
|
42
|
+
viewport?: Partial<MapViewport>;
|
|
43
|
+
/**
|
|
44
|
+
* Callback fired continuously as the viewport changes (pan, zoom, rotate, pitch).
|
|
45
|
+
* Can be used standalone to observe changes, or with `viewport` prop
|
|
46
|
+
* to enable controlled mode where the map viewport is driven by your state.
|
|
47
|
+
*/
|
|
48
|
+
onViewportChange?: (viewport: MapViewport) => void;
|
|
49
|
+
/** Show a loading indicator on the map */
|
|
50
|
+
loading?: boolean;
|
|
51
|
+
} & Omit<MapLibreGL.MapOptions, "style" | "container"> & import('react').RefAttributes<MapLibreGL.Map>>;
|
|
52
|
+
type MapMarkerProps = {
|
|
53
|
+
/** Longitude coordinate for marker position */
|
|
54
|
+
longitude: number;
|
|
55
|
+
/** Latitude coordinate for marker position */
|
|
56
|
+
latitude: number;
|
|
57
|
+
/** Marker subcomponents (MarkerContent, MarkerPopup, MarkerTooltip, MarkerLabel) */
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
/** Callback when marker is clicked */
|
|
60
|
+
onClick?: (e: MouseEvent) => void;
|
|
61
|
+
/** Callback when mouse enters marker */
|
|
62
|
+
onMouseEnter?: (e: MouseEvent) => void;
|
|
63
|
+
/** Callback when mouse leaves marker */
|
|
64
|
+
onMouseLeave?: (e: MouseEvent) => void;
|
|
65
|
+
/** Callback when marker drag starts (requires draggable: true) */
|
|
66
|
+
onDragStart?: (lngLat: {
|
|
67
|
+
lng: number;
|
|
68
|
+
lat: number;
|
|
69
|
+
}) => void;
|
|
70
|
+
/** Callback during marker drag (requires draggable: true) */
|
|
71
|
+
onDrag?: (lngLat: {
|
|
72
|
+
lng: number;
|
|
73
|
+
lat: number;
|
|
74
|
+
}) => void;
|
|
75
|
+
/** Callback when marker drag ends (requires draggable: true) */
|
|
76
|
+
onDragEnd?: (lngLat: {
|
|
77
|
+
lng: number;
|
|
78
|
+
lat: number;
|
|
79
|
+
}) => void;
|
|
80
|
+
} & Omit<MarkerOptions, "element">;
|
|
81
|
+
declare function MapMarker({ longitude, latitude, children, onClick, onMouseEnter, onMouseLeave, onDragStart, onDrag, onDragEnd, draggable, ...markerOptions }: MapMarkerProps): import("react/jsx-runtime").JSX.Element;
|
|
82
|
+
type MarkerContentProps = {
|
|
83
|
+
/** Custom marker content. Defaults to a blue dot if not provided */
|
|
84
|
+
children?: ReactNode;
|
|
85
|
+
/** Additional CSS classes for the marker container */
|
|
86
|
+
className?: string;
|
|
87
|
+
};
|
|
88
|
+
declare function MarkerContent({ children, className }: MarkerContentProps): import('react').ReactPortal;
|
|
89
|
+
type MarkerPopupProps = {
|
|
90
|
+
/** Popup content */
|
|
91
|
+
children: ReactNode;
|
|
92
|
+
/** Additional CSS classes for the popup container */
|
|
93
|
+
className?: string;
|
|
94
|
+
/** Show a close button in the popup (default: false) */
|
|
95
|
+
closeButton?: boolean;
|
|
96
|
+
} & Omit<PopupOptions, "className" | "closeButton">;
|
|
97
|
+
declare function MarkerPopup({ children, className, closeButton, ...popupOptions }: MarkerPopupProps): import('react').ReactPortal;
|
|
98
|
+
type MarkerTooltipProps = {
|
|
99
|
+
/** Tooltip content */
|
|
100
|
+
children: ReactNode;
|
|
101
|
+
/** Additional CSS classes for the tooltip container */
|
|
102
|
+
className?: string;
|
|
103
|
+
} & Omit<PopupOptions, "className" | "closeButton" | "closeOnClick">;
|
|
104
|
+
declare function MarkerTooltip({ children, className, ...popupOptions }: MarkerTooltipProps): import('react').ReactPortal;
|
|
105
|
+
type MarkerLabelProps = {
|
|
106
|
+
/** Label text content */
|
|
107
|
+
children: ReactNode;
|
|
108
|
+
/** Additional CSS classes for the label */
|
|
109
|
+
className?: string;
|
|
110
|
+
/** Position of the label relative to the marker (default: "top") */
|
|
111
|
+
position?: "top" | "bottom";
|
|
112
|
+
};
|
|
113
|
+
declare function MarkerLabel({ children, className, position, }: MarkerLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
114
|
+
type MapControlsProps = {
|
|
115
|
+
/** Position of the controls on the map (default: "bottom-right") */
|
|
116
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
117
|
+
/** Show zoom in/out buttons (default: true) */
|
|
118
|
+
showZoom?: boolean;
|
|
119
|
+
/** Show compass button to reset bearing (default: false) */
|
|
120
|
+
showCompass?: boolean;
|
|
121
|
+
/** Show locate button to find user's location (default: false) */
|
|
122
|
+
showLocate?: boolean;
|
|
123
|
+
/** Show fullscreen toggle button (default: false) */
|
|
124
|
+
showFullscreen?: boolean;
|
|
125
|
+
/** Additional CSS classes for the controls container */
|
|
126
|
+
className?: string;
|
|
127
|
+
/** Callback with user coordinates when located */
|
|
128
|
+
onLocate?: (coords: {
|
|
129
|
+
longitude: number;
|
|
130
|
+
latitude: number;
|
|
131
|
+
}) => void;
|
|
132
|
+
};
|
|
133
|
+
declare function MapControls({ position, showZoom, showCompass, showLocate, showFullscreen, className, onLocate, }: MapControlsProps): import("react/jsx-runtime").JSX.Element;
|
|
134
|
+
type MapPopupProps = {
|
|
135
|
+
/** Longitude coordinate for popup position */
|
|
136
|
+
longitude: number;
|
|
137
|
+
/** Latitude coordinate for popup position */
|
|
138
|
+
latitude: number;
|
|
139
|
+
/** Callback when popup is closed */
|
|
140
|
+
onClose?: () => void;
|
|
141
|
+
/** Popup content */
|
|
142
|
+
children: ReactNode;
|
|
143
|
+
/** Additional CSS classes for the popup container */
|
|
144
|
+
className?: string;
|
|
145
|
+
/** Show a close button in the popup (default: false) */
|
|
146
|
+
closeButton?: boolean;
|
|
147
|
+
} & Omit<PopupOptions, "className" | "closeButton">;
|
|
148
|
+
declare function MapPopup({ longitude, latitude, onClose, children, className, closeButton, ...popupOptions }: MapPopupProps): import('react').ReactPortal;
|
|
149
|
+
type MapRouteProps = {
|
|
150
|
+
/** Optional unique identifier for the route layer */
|
|
151
|
+
id?: string;
|
|
152
|
+
/** Array of [longitude, latitude] coordinate pairs defining the route */
|
|
153
|
+
coordinates: [number, number][];
|
|
154
|
+
/** Line color as CSS color value (default: "#4285F4") */
|
|
155
|
+
color?: string;
|
|
156
|
+
/** Line width in pixels (default: 3) */
|
|
157
|
+
width?: number;
|
|
158
|
+
/** Line opacity from 0 to 1 (default: 0.8) */
|
|
159
|
+
opacity?: number;
|
|
160
|
+
/** Dash pattern [dash length, gap length] for dashed lines */
|
|
161
|
+
dashArray?: [number, number];
|
|
162
|
+
/** Callback when the route line is clicked */
|
|
163
|
+
onClick?: () => void;
|
|
164
|
+
/** Callback when mouse enters the route line */
|
|
165
|
+
onMouseEnter?: () => void;
|
|
166
|
+
/** Callback when mouse leaves the route line */
|
|
167
|
+
onMouseLeave?: () => void;
|
|
168
|
+
/** Whether the route is interactive - shows pointer cursor on hover (default: true) */
|
|
169
|
+
interactive?: boolean;
|
|
170
|
+
};
|
|
171
|
+
declare function MapRoute({ id: propId, coordinates, color, width, opacity, dashArray, onClick, onMouseEnter, onMouseLeave, interactive, }: MapRouteProps): null;
|
|
172
|
+
type MapClusterLayerProps<P extends GeoJSON.GeoJsonProperties = GeoJSON.GeoJsonProperties> = {
|
|
173
|
+
/** GeoJSON FeatureCollection data or URL to fetch GeoJSON from */
|
|
174
|
+
data: string | GeoJSON.FeatureCollection<GeoJSON.Point, P>;
|
|
175
|
+
/** Maximum zoom level to cluster points on (default: 14) */
|
|
176
|
+
clusterMaxZoom?: number;
|
|
177
|
+
/** Radius of each cluster when clustering points in pixels (default: 50) */
|
|
178
|
+
clusterRadius?: number;
|
|
179
|
+
/** Colors for cluster circles: [small, medium, large] based on point count (default: ["#22c55e", "#eab308", "#ef4444"]) */
|
|
180
|
+
clusterColors?: [string, string, string];
|
|
181
|
+
/** Point count thresholds for color/size steps: [medium, large] (default: [100, 750]) */
|
|
182
|
+
clusterThresholds?: [number, number];
|
|
183
|
+
/** Color for unclustered individual points (default: "#3b82f6") */
|
|
184
|
+
pointColor?: string;
|
|
185
|
+
/** Callback when an unclustered point is clicked */
|
|
186
|
+
onPointClick?: (feature: GeoJSON.Feature<GeoJSON.Point, P>, coordinates: [number, number]) => void;
|
|
187
|
+
/** Callback when a cluster is clicked. If not provided, zooms into the cluster */
|
|
188
|
+
onClusterClick?: (clusterId: number, coordinates: [number, number], pointCount: number) => void;
|
|
189
|
+
};
|
|
190
|
+
declare function MapClusterLayer<P extends GeoJSON.GeoJsonProperties = GeoJSON.GeoJsonProperties>({ data, clusterMaxZoom, clusterRadius, clusterColors, clusterThresholds, pointColor, onPointClick, onClusterClick, }: MapClusterLayerProps<P>): null;
|
|
191
|
+
export { Map, useMap, MapMarker, MarkerContent, MarkerPopup, MarkerTooltip, MarkerLabel, MapPopup, MapControls, MapRoute, MapClusterLayer, };
|
|
192
|
+
export type { MapRef, MapViewport };
|