@deftui/addons 0.1.4 → 0.1.5

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.
Files changed (26) hide show
  1. package/dist/react-hook-form/field.mjs +1 -1
  2. package/dist/styles.css +0 -21
  3. package/package.json +3 -9
  4. package/dist/map.d.mts +0 -30
  5. package/dist/map.mjs +0 -18
  6. package/dist/maplibregl/map.d.mts +0 -388
  7. package/dist/maplibregl/map.mjs +0 -1641
  8. package/dist/node_modules/.bun/@types_geojson@7946.0.16/node_modules/@types/geojson/index.d.mts +0 -174
  9. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/Icon.mjs +0 -37
  10. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/context.mjs +0 -12
  11. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/createLucideIcon.mjs +0 -23
  12. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/icons/loader-circle.mjs +0 -20
  13. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/icons/locate.mjs +0 -51
  14. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/icons/maximize.mjs +0 -33
  15. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/icons/minus.mjs +0 -19
  16. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/icons/plus.mjs +0 -22
  17. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/icons/x.mjs +0 -22
  18. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.mjs +0 -22
  19. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.mjs +0 -57
  20. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.mjs +0 -19
  21. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs +0 -12
  22. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs +0 -11
  23. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs +0 -22
  24. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs +0 -9
  25. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.mjs +0 -18
  26. package/dist/node_modules/.bun/lucide-react@1.66.0_c841d34b494ec30a/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs +0 -13
@@ -1,7 +1,7 @@
1
1
  import { Field } from "@deftui/react";
2
2
  import { Fragment, cloneElement, isValidElement, useId } from "react";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
3
  import { useController } from "react-hook-form";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
5
  // src/react-hook-form/field.tsx
6
6
  function RHFField(props) {
7
7
  const { label, description, injectControlProps = true, children, ...controllerProps } = props;
package/dist/styles.css CHANGED
@@ -1,22 +1 @@
1
1
  @source "./";
2
-
3
- @layer base {
4
- .maplibregl-popup-content {
5
- @apply rounded-none! bg-transparent! p-0! shadow-none!;
6
- }
7
- .maplibregl-popup-tip {
8
- @apply hidden!;
9
- }
10
- .maplibregl-ctrl-attrib {
11
- @apply bg-background! text-muted-foreground! border-border! rounded-md! border! shadow-sm!;
12
- }
13
- .maplibregl-ctrl-attrib a {
14
- @apply text-muted-foreground!;
15
- }
16
- .maplibregl-ctrl-attrib a:hover {
17
- @apply text-foreground!;
18
- }
19
- .maplibregl-ctrl-attrib-button {
20
- @apply bg-transparent! dark:invert;
21
- }
22
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftui/addons",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/KiriRainCat/deftui.git",
@@ -14,10 +14,6 @@
14
14
  "**/*.css"
15
15
  ],
16
16
  "exports": {
17
- "./map": {
18
- "types": "./dist/map.d.mts",
19
- "import": "./dist/map.mjs"
20
- },
21
17
  "./form": {
22
18
  "types": "./dist/form.d.mts",
23
19
  "import": "./dist/form.mjs"
@@ -44,9 +40,8 @@
44
40
  "fix": "vp check --fix"
45
41
  },
46
42
  "devDependencies": {
47
- "@deftui/react": "^0.1.4",
43
+ "@deftui/react": "^0.1.5",
48
44
  "@tanstack/react-router": "^1.170.46",
49
- "@types/geojson": "^7946.0.16",
50
45
  "@types/react": "^19.3.0",
51
46
  "@types/react-dom": "^19.3.0",
52
47
  "lucide-react": "^1.66.0",
@@ -54,9 +49,8 @@
54
49
  "vite-plus": "catalog:"
55
50
  },
56
51
  "peerDependencies": {
57
- "@deftui/react": "^0.1.4",
52
+ "@deftui/react": "^0.1.5",
58
53
  "@tanstack/react-router": "^1.170.0",
59
- "maplibre-gl": "^6.16.0",
60
54
  "react": "^19.0.0",
61
55
  "react-dom": "^19.0.0",
62
56
  "react-hook-form": "^7.91.0"
package/dist/map.d.mts DELETED
@@ -1,30 +0,0 @@
1
- import { MapArc, MapArcDatum, MapArcEvent, MapArcProps, MapClusterLayer, MapClusterLayerProps, MapControls, MapControlsProps, MapGeoJSON, MapGeoJSONData, MapGeoJSONEvent, MapGeoJSONFeature, MapGeoJSONProps, MapMarker, MapMarkerProps, MapPopup, MapPopupProps, MapProps, MapRef, MapRoute, MapRouteProps, MapStyleOption, MapViewport, MarkerContent, MarkerContentProps, MarkerLabel, MarkerLabelProps, MarkerPopup, MarkerPopupProps, MarkerTooltip, MarkerTooltipProps, RouteAnchor, RouteMarker, RouteMarkerProps, RouteProgress, RouteProgressProps, useMap } from "./maplibregl/map.mjs";
2
- export declare const Map: import("react").ForwardRefExoticComponent<{
3
- children?: import("react").ReactNode;
4
- className?: string;
5
- theme?: "dark" | "light";
6
- styles?: {
7
- light?: MapStyleOption;
8
- dark?: MapStyleOption;
9
- };
10
- blank?: boolean;
11
- projection?: import("maplibre-gl").ProjectionSpecification;
12
- viewport?: Partial<MapViewport>;
13
- onViewportChange?: (viewport: MapViewport) => void;
14
- loading?: boolean;
15
- } & Omit<import("maplibre-gl").MapOptions, "container" | "style"> & import("react").RefAttributes<import("maplibre-gl").Map>> & {
16
- Marker: typeof MapMarker;
17
- MarkerContent: typeof MarkerContent;
18
- MarkerPopup: typeof MarkerPopup;
19
- MarkerTooltip: typeof MarkerTooltip;
20
- MarkerLabel: typeof MarkerLabel;
21
- Popup: typeof MapPopup;
22
- Controls: typeof MapControls;
23
- Route: typeof MapRoute;
24
- RouteProgress: typeof RouteProgress;
25
- RouteMarker: typeof RouteMarker;
26
- Arc: typeof MapArc;
27
- GeoJSON: typeof MapGeoJSON;
28
- ClusterLayer: typeof MapClusterLayer;
29
- };
30
- export { type MapArc, type MapArcDatum, type MapArcEvent, type MapArcProps, type MapClusterLayer, type MapClusterLayerProps, type MapControls, type MapControlsProps, type MapGeoJSON, type MapGeoJSONData, type MapGeoJSONEvent, type MapGeoJSONFeature, type MapGeoJSONProps, type MapMarker, type MapMarkerProps, type MapPopup, type MapPopupProps, type MapProps, type MapRef, type MapRoute, type MapRouteProps, type MapStyleOption, type MapViewport, type MarkerContent, type MarkerContentProps, type MarkerLabel, type MarkerLabelProps, type MarkerPopup, type MarkerPopupProps, type MarkerTooltip, type MarkerTooltipProps, type RouteAnchor, type RouteMarker, type RouteMarkerProps, type RouteProgress, type RouteProgressProps, useMap };
package/dist/map.mjs DELETED
@@ -1,18 +0,0 @@
1
- import { Map as Map$1, MapArc, MapClusterLayer, MapControls, MapGeoJSON, MapMarker, MapPopup, MapRoute, MarkerContent, MarkerLabel, MarkerPopup, MarkerTooltip, RouteMarker, RouteProgress, useMap } from "./maplibregl/map.mjs";
2
- // src/maplibregl/index.ts
3
- const Map = /* @__PURE__ */ Object.assign(Map$1, {
4
- Marker: MapMarker,
5
- MarkerContent,
6
- MarkerPopup,
7
- MarkerTooltip,
8
- MarkerLabel,
9
- Popup: MapPopup,
10
- Controls: MapControls,
11
- Route: MapRoute,
12
- RouteProgress,
13
- RouteMarker,
14
- Arc: MapArc,
15
- GeoJSON: MapGeoJSON,
16
- ClusterLayer: MapClusterLayer
17
- });
18
- export { Map, useMap };
@@ -1,388 +0,0 @@
1
- import { Feature, FeatureCollection, GeoJsonProperties, Geometry, Point } from "../node_modules/.bun/@types_geojson@7946.0.16/node_modules/@types/geojson/index.mjs";
2
- import "maplibre-gl/dist/maplibre-gl.css";
3
- import { ReactNode } from "react";
4
- import * as MapLibreGL from "maplibre-gl";
5
- import { MarkerOptions, PopupOptions } from "maplibre-gl";
6
- type MapLibreModule = typeof MapLibreGL;
7
- type Theme = "light" | "dark";
8
- type MapContextValue = {
9
- map: MapLibreGL.Map | null;
10
- mapLib: MapLibreModule | null;
11
- isLoaded: boolean;
12
- resolvedTheme: Theme;
13
- };
14
- declare function useMap(): MapContextValue;
15
- /** Map viewport state */
16
- type MapViewport = {
17
- /** Center coordinates [longitude, latitude] */
18
- center: [number, number];
19
- /** Zoom level */
20
- zoom: number;
21
- /** Bearing (rotation) in degrees */
22
- bearing: number;
23
- /** Pitch (tilt) in degrees */
24
- pitch: number;
25
- };
26
- type MapStyleOption = string | MapLibreGL.StyleSpecification;
27
- type MapRef = MapLibreGL.Map;
28
- type MapProps = {
29
- children?: ReactNode;
30
- /** Additional CSS classes for the map container */
31
- className?: string;
32
- /**
33
- * Theme for the map. If not provided, automatically detects system preference.
34
- * Pass your theme value here.
35
- */
36
- theme?: Theme;
37
- /** Custom map styles for light and dark themes. Overrides the default Carto styles. */
38
- styles?: {
39
- light?: MapStyleOption;
40
- dark?: MapStyleOption;
41
- };
42
- /**
43
- * Use a transparent, tile-less basemap instead of the default Carto street
44
- * basemap — a blank canvas. Used alone it renders nothing; add your own
45
- * layers on top (`<MapGeoJSON>`, `<MapArc>`, markers, etc.). Ideal for data
46
- * visualizations (choropleths, arcs, dot maps). Globes get a tinted sphere.
47
- * Ignored when an explicit `styles` prop is provided.
48
- */
49
- blank?: boolean;
50
- /** Map projection type. Use `{ type: "globe" }` for 3D globe view. */
51
- projection?: MapLibreGL.ProjectionSpecification;
52
- /**
53
- * Controlled viewport. When provided with onViewportChange,
54
- * the map becomes controlled and viewport is driven by this prop.
55
- */
56
- viewport?: Partial<MapViewport>;
57
- /**
58
- * Callback fired continuously as the viewport changes (pan, zoom, rotate, pitch).
59
- * Can be used standalone to observe changes, or with `viewport` prop
60
- * to enable controlled mode where the map viewport is driven by your state.
61
- */
62
- onViewportChange?: (viewport: MapViewport) => void;
63
- /** Show a loading indicator on the map */
64
- loading?: boolean;
65
- } & Omit<MapLibreGL.MapOptions, "container" | "style">;
66
- type MapMarkerProps = {
67
- /** Longitude coordinate for marker position */
68
- longitude: number;
69
- /** Latitude coordinate for marker position */
70
- latitude: number;
71
- /** Marker subcomponents (MarkerContent, MarkerPopup, MarkerTooltip, MarkerLabel) */
72
- children: ReactNode;
73
- /** Callback when marker is clicked */
74
- onClick?: (e: MouseEvent) => void;
75
- /** Callback when mouse enters marker */
76
- onMouseEnter?: (e: MouseEvent) => void;
77
- /** Callback when mouse leaves marker */
78
- onMouseLeave?: (e: MouseEvent) => void;
79
- /** Callback when marker drag starts (requires draggable: true) */
80
- onDragStart?: (lngLat: {
81
- lng: number;
82
- lat: number;
83
- }) => void;
84
- /** Callback during marker drag (requires draggable: true) */
85
- onDrag?: (lngLat: {
86
- lng: number;
87
- lat: number;
88
- }) => void;
89
- /** Callback when marker drag ends (requires draggable: true) */
90
- onDragEnd?: (lngLat: {
91
- lng: number;
92
- lat: number;
93
- }) => void;
94
- } & Omit<MarkerOptions, "element">;
95
- declare function MapMarker({ longitude, latitude, children, onClick, onMouseEnter, onMouseLeave, onDragStart, onDrag, onDragEnd, draggable, ...markerOptions }: MapMarkerProps): import("react").JSX.Element;
96
- type MarkerContentProps = {
97
- /** Custom marker content. Defaults to a blue dot if not provided */
98
- children?: ReactNode;
99
- /** Additional CSS classes for the marker container */
100
- className?: string;
101
- };
102
- declare function MarkerContent({ children, className }: MarkerContentProps): import("react").ReactPortal;
103
- type MarkerPopupProps = {
104
- /** Popup content */
105
- children: ReactNode;
106
- /** Additional CSS classes for the popup container */
107
- className?: string;
108
- /** Show a close button in the popup (default: false) */
109
- closeButton?: boolean;
110
- } & Omit<PopupOptions, "className" | "closeButton">;
111
- declare function MarkerPopup({ children, className, closeButton, ...popupOptions }: MarkerPopupProps): import("react").ReactPortal;
112
- type MarkerTooltipProps = {
113
- /** Tooltip content */
114
- children: ReactNode;
115
- /** Additional CSS classes for the tooltip container */
116
- className?: string;
117
- } & Omit<PopupOptions, "className" | "closeButton" | "closeOnClick">;
118
- declare function MarkerTooltip({ children, className, ...popupOptions }: MarkerTooltipProps): import("react").ReactPortal;
119
- type MarkerLabelProps = {
120
- /** Label text content */
121
- children: ReactNode;
122
- /** Additional CSS classes for the label */
123
- className?: string;
124
- /** Position of the label relative to the marker (default: "top") */
125
- position?: "top" | "bottom";
126
- };
127
- declare function MarkerLabel({ children, className, position }: MarkerLabelProps): import("react").JSX.Element;
128
- type MapControlsProps = {
129
- /** Position of the controls on the map (default: "bottom-right") */
130
- position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
131
- /** Show zoom in/out buttons (default: true) */
132
- showZoom?: boolean;
133
- /** Show compass button to reset bearing (default: false) */
134
- showCompass?: boolean;
135
- /** Show locate button to find user's location (default: false) */
136
- showLocate?: boolean;
137
- /** Show fullscreen toggle button (default: false) */
138
- showFullscreen?: boolean;
139
- /** Additional CSS classes for the controls container */
140
- className?: string;
141
- /** Callback with user coordinates when located */
142
- onLocate?: (coords: {
143
- longitude: number;
144
- latitude: number;
145
- }) => void;
146
- };
147
- declare function MapControls({ position, showZoom, showCompass, showLocate, showFullscreen, className, onLocate }: MapControlsProps): import("react").JSX.Element;
148
- type MapPopupProps = {
149
- /** Longitude coordinate for popup position */
150
- longitude: number;
151
- /** Latitude coordinate for popup position */
152
- latitude: number;
153
- /** Callback when popup is closed */
154
- onClose?: () => void;
155
- /** Popup content */
156
- children: ReactNode;
157
- /** Additional CSS classes for the popup container */
158
- className?: string;
159
- /** Show a close button in the popup (default: false) */
160
- closeButton?: boolean;
161
- } & Omit<PopupOptions, "className" | "closeButton">;
162
- declare function MapPopup({ longitude, latitude, onClose, children, className, closeButton, ...popupOptions }: MapPopupProps): import("react").ReactPortal;
163
- /** A position along a route: an endpoint, the progress cut, or a 0-1 fraction. */
164
- type RouteAnchor = "start" | "end" | "progress" | number;
165
- type MapRouteProps = {
166
- /** Optional unique identifier for the route layer */
167
- id?: string;
168
- /**
169
- * The route as [longitude, latitude] pairs. This is the only input the
170
- * component needs, so any routing service works: fetch in the parent and
171
- * pass the geometry (for GeoJSON responses, `route.geometry.coordinates`).
172
- */
173
- coordinates: [number, number][];
174
- /** Line color as CSS color value (default: "#4285F4") */
175
- color?: string;
176
- /** Line width in pixels (default: 3) */
177
- width?: number;
178
- /** Line opacity from 0 to 1 (default: 0.8) */
179
- opacity?: number;
180
- /** Dash pattern [dash length, gap length] for dashed lines */
181
- dashArray?: [number, number];
182
- /**
183
- * Fraction of the route already covered, from 0 to 1. Drives `RouteProgress`
184
- * and the `"progress"` anchor on `RouteMarker`.
185
- */
186
- progress?: number;
187
- /**
188
- * Marks this route as the selected one: it moves above sibling routes and
189
- * switches to the `active*` styles below. (default: false)
190
- */
191
- active?: boolean;
192
- /** Line color while `active`. Falls back to `color`. */
193
- activeColor?: string;
194
- /** Line width while `active`. Falls back to `width`. */
195
- activeWidth?: number;
196
- /** Line opacity while `active`. Falls back to `opacity`. */
197
- activeOpacity?: number;
198
- /** Dash pattern while `active`. Falls back to `dashArray`. */
199
- activeDashArray?: [number, number];
200
- /** Optional MapLibre layer id to insert the route layers before (z-order control). */
201
- beforeId?: string;
202
- /** Callback when the route line is clicked */
203
- onClick?: () => void;
204
- /** Callback when mouse enters the route line */
205
- onMouseEnter?: () => void;
206
- /** Callback when mouse leaves the route line */
207
- onMouseLeave?: () => void;
208
- /** Whether the route is interactive - shows pointer cursor on hover (default: true) */
209
- interactive?: boolean;
210
- /** Route subcomponents (RouteProgress, RouteMarker) */
211
- children?: ReactNode;
212
- };
213
- declare function MapRoute({ id: propId, coordinates: coordinatesProp, color, width, opacity, dashArray, progress, active, activeColor, activeWidth, activeOpacity, activeDashArray, beforeId, onClick, onMouseEnter, onMouseLeave, interactive, children }: MapRouteProps): import("react").JSX.Element;
214
- type RouteProgressProps = {
215
- /** Line color for the traveled portion. Defaults to the route's color. */
216
- color?: string;
217
- /** Line width in pixels. Defaults to the route's width. */
218
- width?: number;
219
- /** Line opacity from 0 to 1. Defaults to the route's opacity. */
220
- opacity?: number;
221
- /** Dash pattern [dash length, gap length] for dashed lines. */
222
- dashArray?: [number, number];
223
- };
224
- /**
225
- * Draws the traveled portion of the parent `MapRoute` on top of the base line.
226
- * Renders nothing until the route has a `progress` value.
227
- */
228
- declare function RouteProgress({ color, width, opacity, dashArray }: RouteProgressProps): null;
229
- type RouteMarkerProps = {
230
- /**
231
- * Where to pin the marker: an endpoint, the route's progress point, or a
232
- * 0-1 fraction along the line.
233
- */
234
- at: RouteAnchor;
235
- } & Omit<MapMarkerProps, "longitude" | "latitude">;
236
- /**
237
- * A `MapMarker` anchored to a position along the parent `MapRoute`. Takes the
238
- * same children as `MapMarker` (`MarkerContent`, `MarkerPopup`, ...).
239
- */
240
- declare function RouteMarker({ at, children, ...markerProps }: RouteMarkerProps): import("react").JSX.Element | null;
241
- type MapGeoJSONData<P extends GeoJsonProperties = GeoJsonProperties> = FeatureCollection<Geometry, P> | Feature<Geometry, P> | Geometry | string;
242
- type MapFillPaint = NonNullable<MapLibreGL.FillLayerSpecification["paint"]>;
243
- type MapLinePaint = NonNullable<MapLibreGL.LineLayerSpecification["paint"]>;
244
- /** A rendered feature with strongly-typed `properties`. */
245
- type MapGeoJSONFeature<P extends GeoJsonProperties = GeoJsonProperties> = Omit<MapLibreGL.MapGeoJSONFeature, "properties"> & {
246
- properties: P;
247
- };
248
- /** Event payload passed to MapGeoJSON interaction callbacks. */
249
- type MapGeoJSONEvent<P extends GeoJsonProperties = GeoJsonProperties> = {
250
- /** The feature under the cursor, with its typed GeoJSON properties. */
251
- feature: MapGeoJSONFeature<P>;
252
- /** Longitude of the cursor at the time of the event. */
253
- longitude: number;
254
- /** Latitude of the cursor at the time of the event. */
255
- latitude: number;
256
- /** The underlying MapLibre mouse event for advanced use cases. */
257
- originalEvent: MapLibreGL.MapLayerMouseEvent;
258
- };
259
- type MapGeoJSONProps<P extends GeoJsonProperties = GeoJsonProperties> = {
260
- /** GeoJSON data (FeatureCollection, Feature, Geometry) or a URL to fetch it from. */
261
- data: MapGeoJSONData<P>;
262
- /** Optional unique identifier prefix for the source/layers. Auto-generated if not provided. */
263
- id?: string;
264
- /**
265
- * Feature property to promote to the feature `id`. Required for hover
266
- * feature-state (`fillHoverPaint`) and stable `onHover`/`onClick` payloads.
267
- */
268
- promoteId?: string;
269
- /**
270
- * Paint for the polygon fill layer. Merged on top of a theme-aware monochrome
271
- * surface tone (`fill-color`). Pass `false` to omit the fill layer entirely
272
- * (e.g. outlines only).
273
- */
274
- fillPaint?: MapFillPaint | false;
275
- /**
276
- * Paint for the outline layer. Merged on top of a hairline default
277
- * (`line-color` = a near-surface neutral, `line-width` = 0.5) for thin
278
- * separators. Override `line-color` if your container differs, or pass
279
- * `false` to omit the layer.
280
- */
281
- linePaint?: MapLinePaint | false;
282
- /**
283
- * Paint merged onto the fill layer for the feature under the cursor, applied
284
- * as a `case` expression keyed on hover feature-state. Requires `promoteId`.
285
- */
286
- fillHoverPaint?: MapFillPaint;
287
- /** Callback when a feature is clicked. */
288
- onClick?: (e: MapGeoJSONEvent<P>) => void;
289
- /** Callback fired when the hovered feature changes; `null` when the cursor leaves. */
290
- onHover?: (e: MapGeoJSONEvent<P> | null) => void;
291
- /** Whether features respond to mouse events (default: false). */
292
- interactive?: boolean;
293
- /** Optional MapLibre layer id to insert the layers before (z-order control). */
294
- beforeId?: string;
295
- };
296
- /**
297
- * Renders arbitrary GeoJSON as fill + outline layers on the map. Composes like
298
- * `MapRoute` / `MapArc` — drop it inside `<Map>` (typically with `blank`) for
299
- * choropleths and region/data maps. For full control over expressions and
300
- * multiple layers, manage layers directly via `useMap()` instead.
301
- */
302
- declare function MapGeoJSON<P extends GeoJsonProperties = GeoJsonProperties>({ data, id: propId, promoteId, fillPaint, linePaint, fillHoverPaint, onClick, onHover, interactive, beforeId }: MapGeoJSONProps<P>): null;
303
- /** A single arc to render inside <MapArc data={...}>. */
304
- type MapArcDatum = {
305
- /** Unique identifier for this arc. Required for hover state tracking and event payloads. */
306
- id: string | number;
307
- /** Start coordinate as [longitude, latitude]. */
308
- from: [number, number];
309
- /** End coordinate as [longitude, latitude]. */
310
- to: [number, number];
311
- };
312
- /** Event payload passed to MapArc interaction callbacks. */
313
- type MapArcEvent<T extends MapArcDatum = MapArcDatum> = {
314
- /** The arc datum that was hovered or clicked. */
315
- arc: T;
316
- /** Longitude of the cursor at the time of the event. */
317
- longitude: number;
318
- /** Latitude of the cursor at the time of the event. */
319
- latitude: number;
320
- /** The underlying MapLibre mouse event for advanced use cases. */
321
- originalEvent: MapLibreGL.MapMouseEvent;
322
- };
323
- type MapArcLinePaint = NonNullable<MapLibreGL.LineLayerSpecification["paint"]>;
324
- type MapArcLineLayout = NonNullable<MapLibreGL.LineLayerSpecification["layout"]>;
325
- type MapArcProps<T extends MapArcDatum = MapArcDatum> = {
326
- /** Array of arcs to render. Each arc must have a unique `id`. */
327
- data: T[];
328
- /** Optional unique identifier prefix for the arc source/layers. Auto-generated if not provided. */
329
- id?: string;
330
- /**
331
- * How far each arc bows away from a straight line. `0` renders straight
332
- * lines; higher values bend further. Negative values bend to the opposite
333
- * side. Arcs are computed as a quadratic Bézier in lng/lat space; the
334
- * destination longitude is unwrapped relative to the origin so that arcs
335
- * cross the antimeridian via the shorter great-circle direction. (default: 0.2)
336
- */
337
- curvature?: number;
338
- /** Number of samples used to render each curve. Higher = smoother. (default: 64) */
339
- samples?: number;
340
- /**
341
- * MapLibre paint properties for the arc layer. Merged on top of sensible
342
- * defaults (`line-color: #4285F4`, `line-width: 2`, `line-opacity: 0.85`).
343
- * Any value can be a MapLibre expression for per-feature styling, every
344
- * field on each arc datum (besides `from`/`to`) is exposed via `["get", ...]`.
345
- */
346
- paint?: MapArcLinePaint;
347
- /** MapLibre layout properties for the arc layer. Defaults to rounded joins/caps. */
348
- layout?: MapArcLineLayout;
349
- /**
350
- * Paint properties applied to the arc currently under the cursor. Each key
351
- * is merged into `paint` as a `case` expression keyed on per-feature hover
352
- * state, so only the hovered arc changes appearance.
353
- */
354
- hoverPaint?: MapArcLinePaint;
355
- /** Callback when an arc is clicked. */
356
- onClick?: (e: MapArcEvent<T>) => void;
357
- /**
358
- * Callback fired when the hovered arc changes. Receives the cursor's
359
- * lng/lat at the moment of entry, and `null` when the cursor leaves the
360
- * last hovered arc.
361
- */
362
- onHover?: (e: MapArcEvent<T> | null) => void;
363
- /** Whether arcs respond to mouse events (default: true). */
364
- interactive?: boolean;
365
- /** Optional MapLibre layer id to insert the arc layers before (z-order control). */
366
- beforeId?: string;
367
- };
368
- declare function MapArc<T extends MapArcDatum = MapArcDatum>({ data, id: propId, curvature, samples, paint, layout, hoverPaint, onClick, onHover, interactive, beforeId }: MapArcProps<T>): null;
369
- type MapClusterLayerProps<P extends GeoJsonProperties = GeoJsonProperties> = {
370
- /** GeoJSON FeatureCollection data or URL to fetch GeoJSON from */
371
- data: string | FeatureCollection<Point, P>;
372
- /** Maximum zoom level to cluster points on (default: 14) */
373
- clusterMaxZoom?: number;
374
- /** Radius of each cluster when clustering points in pixels (default: 50) */
375
- clusterRadius?: number;
376
- /** Colors for cluster circles: [small, medium, large] based on point count (default: ["#3b82f6", "#1d4ed8", "#1e3a8a"]) */
377
- clusterColors?: [string, string, string];
378
- /** Point count thresholds for color/size steps: [medium, large] (default: [100, 750]) */
379
- clusterThresholds?: [number, number];
380
- /** Color for unclustered individual points (default: "#3b82f6") */
381
- pointColor?: string;
382
- /** Callback when an unclustered point is clicked */
383
- onPointClick?: (feature: Feature<Point, P>, coordinates: [number, number]) => void;
384
- /** Callback when a cluster is clicked. If not provided, zooms into the cluster */
385
- onClusterClick?: (clusterId: number, coordinates: [number, number], pointCount: number) => void;
386
- };
387
- declare function MapClusterLayer<P extends GeoJsonProperties = GeoJsonProperties>({ data, clusterMaxZoom, clusterRadius, clusterColors, clusterThresholds, pointColor, onPointClick, onClusterClick }: MapClusterLayerProps<P>): null;
388
- export { MapArc, type MapArcDatum, type MapArcEvent, type MapArcProps, MapClusterLayer, type MapClusterLayerProps, MapControls, type MapControlsProps, MapGeoJSON, type MapGeoJSONData, type MapGeoJSONEvent, type MapGeoJSONFeature, type MapGeoJSONProps, MapMarker, type MapMarkerProps, MapPopup, type MapPopupProps, type MapProps, type MapRef, MapRoute, type MapRouteProps, type MapStyleOption, type MapViewport, MarkerContent, type MarkerContentProps, MarkerLabel, type MarkerLabelProps, MarkerPopup, type MarkerPopupProps, MarkerTooltip, type MarkerTooltipProps, type RouteAnchor, RouteMarker, type RouteMarkerProps, RouteProgress, type RouteProgressProps, useMap };