@optimum-intelligence/opti-ui 0.7.3 → 0.7.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.
@@ -79,11 +79,13 @@ export type MapView = {
79
79
  };
80
80
  /**
81
81
  * Builds a MapLibre style from a raster tile URL template (`{z}`, `{x}`, `{y}`), for `MapBaseLayer.style`.
82
+ * The style gets a `glyphs` URL (OpenFreeMap's font server by default) so `Map.Points` labels can render;
83
+ * pass your own `glyphs` URL to use another font server.
82
84
  *
83
85
  * @example
84
86
  * const satellite = rasterStyle('https://tiles.example.com/{z}/{x}/{y}.jpg', '© Example');
85
87
  */
86
- export declare function rasterStyle(tiles: string | string[], attribution?: string, tileSize?: number): StyleSpecification;
88
+ export declare function rasterStyle(tiles: string | string[], attribution?: string, tileSize?: number, glyphs?: string): StyleSpecification;
87
89
  export interface MapRootProps extends Omit<MapProps, 'mapStyle' | 'initialViewState' | 'interactiveLayerIds' | 'cursor' | 'locale' | 'style' | 'children' | 'id' | 'attributionControl' | 'workerUrl' | 'mapLib'> {
88
90
  /** Ref to the map instance (`flyTo`, `getMap()`, …), set once the map has loaded MapLibre. */
89
91
  ref?: React.Ref<MapRef>;
@@ -222,6 +224,12 @@ export interface MapPointItem {
222
224
  * when you filter `items`; otherwise colours shift and stop matching the legend.
223
225
  */
224
226
  colorIndex?: number;
227
+ /**
228
+ * Short text drawn in the point, such as a stop number in visiting order. Labelled points are drawn
229
+ * larger so 1–3 digits fit; points without a label render as plain dots. Needs a style with a `glyphs`
230
+ * URL (OpenFreeMap styles and `rasterStyle()` have one).
231
+ */
232
+ label?: string | number;
225
233
  }
226
234
  export interface MapPointsProps {
227
235
  /** Points to draw, all in one GeoJSON source and one circle layer. */
@@ -234,11 +242,20 @@ export interface MapPointsProps {
234
242
  onItemHover?: (item: MapPointItem | null, event: MapLayerMouseEvent) => void;
235
243
  }
236
244
  /**
237
- * Many simple points (sensors, stops, events) as one circle layer. For a few dozen styled pins with HTML
238
- * content, use `Map.Marker` instead.
245
+ * Many simple points (sensors, stops, events) as one circle layer. Items with a `label` get it drawn in
246
+ * the circle by a symbol layer on the same source, so thousands of numbered stops stay fast. For a few
247
+ * dozen styled pins with HTML content, use `Map.Marker` instead.
239
248
  *
240
249
  * @example
241
250
  * <Map.Points items={sensors.map((s) => ({ id: s.id, coordinates: s.position, tone: s.ok ? 'success' : 'danger' }))} />
251
+ *
252
+ * @example
253
+ * // Stops numbered in visiting order, one colour per truck.
254
+ * <Map.Points
255
+ * items={trucks.flatMap((truck, t) =>
256
+ * truck.stops.map((stop, i) => ({ id: stop.id, coordinates: stop.position, colorIndex: t, label: i + 1 })),
257
+ * )}
258
+ * />
242
259
  */
243
260
  declare function MapPoints({ items, selectedIds, onItemClick, onItemHover }: MapPointsProps): React.JSX.Element;
244
261
  export interface MapMarkerProps {