@optimum-intelligence/opti-ui 0.7.2 → 0.7.4
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/CHANGELOG.md +58 -0
- package/README.md +3 -1
- package/dist/components/app-shell/AppShell.d.ts +12 -3
- package/dist/components/app-shell/AppShell.js +45 -26
- package/dist/components/app-shell/AppShell.js.map +1 -1
- package/dist/components/data-table/DataTable.d.ts +34 -7
- package/dist/components/data-table/DataTable.js +257 -96
- package/dist/components/data-table/DataTable.js.map +1 -1
- package/dist/components/data-table/DataTableContent.d.ts +6 -1
- package/dist/components/data-table/DataTableContent.js +306 -409
- package/dist/components/data-table/DataTableContent.js.map +1 -1
- package/dist/components/data-table/DataTableFilters.d.ts +10 -2
- package/dist/components/data-table/DataTableFilters.js +71 -46
- package/dist/components/data-table/DataTableFilters.js.map +1 -1
- package/dist/components/data-table/DataTableRow.js +2 -0
- package/dist/components/data-table/DataTableRow.js.map +1 -1
- package/dist/components/data-table/types.d.ts +14 -1
- package/dist/components/data-table/useDataTable.js +2 -0
- package/dist/components/data-table/useDataTable.js.map +1 -1
- package/dist/components/drawer/Drawer.d.ts +7 -4
- package/dist/components/drawer/Drawer.js +2 -1
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/map/Map.d.ts +50 -9
- package/dist/components/map/Map.js +549 -356
- package/dist/components/map/Map.js.map +1 -1
- package/dist/components/stat-card/StatCard.d.ts +2 -2
- package/dist/components/stat-card/StatCard.js +1 -1
- package/dist/components/stat-card/StatCard.js.map +1 -1
- package/dist/components/stepper/Stepper.d.ts +7 -1
- package/dist/components/stepper/Stepper.js +46 -27
- package/dist/components/stepper/Stepper.js.map +1 -1
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.js +3 -1
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/tabs/Tabs.d.ts +4 -1
- package/dist/components/tabs/Tabs.js +33 -23
- package/dist/components/tabs/Tabs.js.map +1 -1
- package/dist/components/toggle/Toggle.d.ts +1 -1
- package/dist/components/toggle/Toggle.js.map +1 -1
- package/dist/components.json +111 -35
- package/dist/icons/index.d.ts +8 -0
- package/dist/icons/index.js +11 -1
- package/dist/icons/index.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/llms-full.txt +70 -26
- package/dist/llms.txt +8 -8
- package/dist/opti-ui.css +389 -30
- package/dist/utils/media.d.ts +4 -0
- package/dist/utils/media.js +34 -0
- package/dist/utils/media.js.map +1 -0
- package/dist/utils/scroll-fade.d.ts +9 -0
- package/dist/utils/scroll-fade.js +45 -0
- package/dist/utils/scroll-fade.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx } from "../../utils/cx.js";
|
|
3
3
|
import { seriesColor } from "../../theme/series.js";
|
|
4
|
-
import { EyeIcon, EyeOffIcon } from "../../icons/index.js";
|
|
4
|
+
import { EyeIcon, EyeOffIcon, LayersIcon } from "../../icons/index.js";
|
|
5
|
+
import { IconButton } from "../button/Button.js";
|
|
5
6
|
import { SegmentedControl } from "../toggle/Toggle.js";
|
|
6
7
|
import { useResolvedColors } from "./colors.js";
|
|
7
8
|
import { c } from "react/compiler-runtime";
|
|
@@ -34,7 +35,8 @@ var defaultLabels = {
|
|
|
34
35
|
depot: "Depot",
|
|
35
36
|
noData: "No data to show",
|
|
36
37
|
expand: "Expand map",
|
|
37
|
-
collapse: "Exit expanded map"
|
|
38
|
+
collapse: "Exit expanded map",
|
|
39
|
+
baseLayer: "Base map"
|
|
38
40
|
};
|
|
39
41
|
var MapContext = React.createContext(null);
|
|
40
42
|
function useMapContext(part) {
|
|
@@ -42,15 +44,22 @@ function useMapContext(part) {
|
|
|
42
44
|
if (!ctx) throw new Error(`${part} must be used inside Map.Root`);
|
|
43
45
|
return ctx;
|
|
44
46
|
}
|
|
47
|
+
/** Glyph server for text labels (`Map.Points` `label`); OpenFreeMap's serves `Noto Sans Bold`. */
|
|
48
|
+
var DEFAULT_GLYPHS = "https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf";
|
|
49
|
+
/** Font stack of `Map.Points` labels. Glyph servers without it make MapLibre draw the digits with a local font. */
|
|
50
|
+
var LABEL_FONT = ["Noto Sans Bold"];
|
|
45
51
|
/**
|
|
46
52
|
* Builds a MapLibre style from a raster tile URL template (`{z}`, `{x}`, `{y}`), for `MapBaseLayer.style`.
|
|
53
|
+
* The style gets a `glyphs` URL (OpenFreeMap's font server by default) so `Map.Points` labels can render;
|
|
54
|
+
* pass your own `glyphs` URL to use another font server.
|
|
47
55
|
*
|
|
48
56
|
* @example
|
|
49
57
|
* const satellite = rasterStyle('https://tiles.example.com/{z}/{x}/{y}.jpg', '© Example');
|
|
50
58
|
*/
|
|
51
|
-
function rasterStyle(tiles, attribution, tileSize = 256) {
|
|
59
|
+
function rasterStyle(tiles, attribution, tileSize = 256, glyphs = DEFAULT_GLYPHS) {
|
|
52
60
|
return {
|
|
53
61
|
version: 8,
|
|
62
|
+
glyphs,
|
|
54
63
|
sources: { raster: {
|
|
55
64
|
type: "raster",
|
|
56
65
|
tiles: Array.isArray(tiles) ? tiles : [tiles],
|
|
@@ -369,7 +378,7 @@ function usePartId(prefix) {
|
|
|
369
378
|
* </Map.Root>
|
|
370
379
|
*/
|
|
371
380
|
function MapRoot(t0) {
|
|
372
|
-
const $ = c(
|
|
381
|
+
const $ = c(87);
|
|
373
382
|
let baseLayer;
|
|
374
383
|
let baseLayers;
|
|
375
384
|
let children;
|
|
@@ -387,8 +396,9 @@ function MapRoot(t0) {
|
|
|
387
396
|
let t1;
|
|
388
397
|
let t2;
|
|
389
398
|
let t3;
|
|
399
|
+
let t4;
|
|
390
400
|
if ($[0] !== t0) {
|
|
391
|
-
({ref, baseLayers, baseLayer, defaultBaseLayer, onBaseLayerChange, initialView, fit: t1, labels, controlsPosition: t2, expandable: t3, className, style, children, onClick, onMouseMove, onMouseOut, ...props} = t0);
|
|
401
|
+
({ref, baseLayers, baseLayer, defaultBaseLayer, onBaseLayerChange, initialView, fit: t1, labels, controlsPosition: t2, expandable: t3, attributionCollapsed: t4, className, style, children, onClick, onMouseMove, onMouseOut, ...props} = t0);
|
|
392
402
|
$[0] = t0;
|
|
393
403
|
$[1] = baseLayer;
|
|
394
404
|
$[2] = baseLayers;
|
|
@@ -407,6 +417,7 @@ function MapRoot(t0) {
|
|
|
407
417
|
$[15] = t1;
|
|
408
418
|
$[16] = t2;
|
|
409
419
|
$[17] = t3;
|
|
420
|
+
$[18] = t4;
|
|
410
421
|
} else {
|
|
411
422
|
baseLayer = $[1];
|
|
412
423
|
baseLayers = $[2];
|
|
@@ -425,62 +436,64 @@ function MapRoot(t0) {
|
|
|
425
436
|
t1 = $[15];
|
|
426
437
|
t2 = $[16];
|
|
427
438
|
t3 = $[17];
|
|
439
|
+
t4 = $[18];
|
|
428
440
|
}
|
|
429
441
|
const fit = t1 === void 0 ? "data" : t1;
|
|
430
442
|
const controlsPosition = t2 === void 0 ? "top-right" : t2;
|
|
431
443
|
const expandable = t3 === void 0 ? false : t3;
|
|
444
|
+
const attributionCollapsed = t4 === void 0 ? false : t4;
|
|
432
445
|
const [element, setElement] = React.useState(null);
|
|
433
446
|
const [map, setMap] = React.useState(null);
|
|
434
|
-
let t4;
|
|
435
|
-
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
436
|
-
t4 = {};
|
|
437
|
-
$[18] = t4;
|
|
438
|
-
} else t4 = $[18];
|
|
439
|
-
const [parts, setParts] = React.useState(t4);
|
|
440
|
-
const [internalLayer, setInternalLayer] = React.useState(defaultBaseLayer ?? baseLayers[0]?.id ?? "");
|
|
441
|
-
const [cursor, setCursor] = React.useState("");
|
|
442
|
-
const [expanded, setExpanded] = React.useState(false);
|
|
443
447
|
let t5;
|
|
444
448
|
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
445
449
|
t5 = {};
|
|
446
450
|
$[19] = t5;
|
|
447
451
|
} else t5 = $[19];
|
|
448
|
-
const
|
|
452
|
+
const [parts, setParts] = React.useState(t5);
|
|
453
|
+
const [internalLayer, setInternalLayer] = React.useState(defaultBaseLayer ?? baseLayers[0]?.id ?? "");
|
|
454
|
+
const [cursor, setCursor] = React.useState("");
|
|
455
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
456
|
+
let t6;
|
|
457
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
458
|
+
t6 = {};
|
|
459
|
+
$[20] = t6;
|
|
460
|
+
} else t6 = $[20];
|
|
461
|
+
const handlers = React.useRef(t6);
|
|
449
462
|
const hovered = React.useRef(null);
|
|
450
463
|
const colors = useResolvedColors(element);
|
|
451
|
-
let
|
|
452
|
-
if ($[
|
|
453
|
-
|
|
464
|
+
let t7;
|
|
465
|
+
if ($[21] !== labels) {
|
|
466
|
+
t7 = {
|
|
454
467
|
...defaultLabels,
|
|
455
468
|
...labels
|
|
456
469
|
};
|
|
457
|
-
$[
|
|
458
|
-
$[
|
|
459
|
-
} else
|
|
460
|
-
const text =
|
|
470
|
+
$[21] = labels;
|
|
471
|
+
$[22] = t7;
|
|
472
|
+
} else t7 = $[22];
|
|
473
|
+
const text = t7;
|
|
461
474
|
const currentId = baseLayer ?? internalLayer;
|
|
462
|
-
let t7;
|
|
463
|
-
if ($[22] !== baseLayers || $[23] !== currentId) {
|
|
464
|
-
t7 = baseLayers.find((l) => l.id === currentId) ?? baseLayers[0];
|
|
465
|
-
$[22] = baseLayers;
|
|
466
|
-
$[23] = currentId;
|
|
467
|
-
$[24] = t7;
|
|
468
|
-
} else t7 = $[24];
|
|
469
|
-
const current = t7;
|
|
470
|
-
const mapStyle = colors.dark && current?.darkStyle ? current.darkStyle : current?.style;
|
|
471
475
|
let t8;
|
|
472
|
-
if ($[
|
|
473
|
-
t8 = (
|
|
476
|
+
if ($[23] !== baseLayers || $[24] !== currentId) {
|
|
477
|
+
t8 = baseLayers.find((l) => l.id === currentId) ?? baseLayers[0];
|
|
478
|
+
$[23] = baseLayers;
|
|
479
|
+
$[24] = currentId;
|
|
480
|
+
$[25] = t8;
|
|
481
|
+
} else t8 = $[25];
|
|
482
|
+
const current = t8;
|
|
483
|
+
const mapStyle = colors.dark && current?.darkStyle ? current.darkStyle : current?.style;
|
|
484
|
+
let t9;
|
|
485
|
+
if ($[26] !== onBaseLayerChange) {
|
|
486
|
+
t9 = (id) => {
|
|
474
487
|
setInternalLayer(id);
|
|
475
488
|
onBaseLayerChange?.(id);
|
|
476
489
|
};
|
|
477
|
-
$[
|
|
478
|
-
$[
|
|
479
|
-
} else
|
|
480
|
-
const setBaseLayer =
|
|
481
|
-
let
|
|
482
|
-
if ($[
|
|
483
|
-
|
|
490
|
+
$[26] = onBaseLayerChange;
|
|
491
|
+
$[27] = t9;
|
|
492
|
+
} else t9 = $[27];
|
|
493
|
+
const setBaseLayer = t9;
|
|
494
|
+
let t10;
|
|
495
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
496
|
+
t10 = (partId, part) => {
|
|
484
497
|
setParts((prev) => {
|
|
485
498
|
const next = { ...prev };
|
|
486
499
|
if (part) next[partId] = part;
|
|
@@ -488,61 +501,61 @@ function MapRoot(t0) {
|
|
|
488
501
|
return next;
|
|
489
502
|
});
|
|
490
503
|
};
|
|
491
|
-
$[
|
|
492
|
-
} else
|
|
493
|
-
const register =
|
|
494
|
-
let
|
|
495
|
-
if ($[
|
|
496
|
-
|
|
504
|
+
$[28] = t10;
|
|
505
|
+
} else t10 = $[28];
|
|
506
|
+
const register = t10;
|
|
507
|
+
let t11;
|
|
508
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
509
|
+
t11 = (partId_0, value) => {
|
|
497
510
|
if (value) handlers.current[partId_0] = value;
|
|
498
511
|
else delete handlers.current[partId_0];
|
|
499
512
|
};
|
|
500
|
-
$[
|
|
501
|
-
} else
|
|
502
|
-
const setHandlers =
|
|
513
|
+
$[29] = t11;
|
|
514
|
+
} else t11 = $[29];
|
|
515
|
+
const setHandlers = t11;
|
|
503
516
|
let dataKey;
|
|
504
517
|
let empty;
|
|
505
518
|
let interactiveLayerIds;
|
|
506
519
|
let ownerOf;
|
|
507
|
-
let
|
|
508
|
-
if ($[
|
|
520
|
+
let t12;
|
|
521
|
+
if ($[30] !== fit || $[31] !== parts) {
|
|
509
522
|
const entries = Object.entries(parts);
|
|
510
523
|
interactiveLayerIds = entries.flatMap(_temp3);
|
|
511
|
-
ownerOf = (layerId) => entries.find((
|
|
512
|
-
const [, part_1] =
|
|
524
|
+
ownerOf = (layerId) => entries.find((t13) => {
|
|
525
|
+
const [, part_1] = t13;
|
|
513
526
|
return part_1.layerIds.includes(layerId);
|
|
514
527
|
})?.[0];
|
|
515
528
|
empty = entries.length > 0 && entries.every(_temp4);
|
|
516
529
|
const corners = _temp5;
|
|
517
530
|
const boundsKey = _temp7;
|
|
518
|
-
dataKey = fit === "none" ? "" : boundsKey(extend(null, entries.map((
|
|
519
|
-
const [, part_3] =
|
|
531
|
+
dataKey = fit === "none" ? "" : boundsKey(extend(null, entries.map((t14) => {
|
|
532
|
+
const [, part_3] = t14;
|
|
520
533
|
return corners(part_3.bounds);
|
|
521
534
|
})));
|
|
522
|
-
|
|
523
|
-
const [, part_4] =
|
|
535
|
+
t12 = fit === "selected" ? boundsKey(extend(null, entries.map((t15) => {
|
|
536
|
+
const [, part_4] = t15;
|
|
524
537
|
return corners(part_4.selectedBounds);
|
|
525
538
|
}))) : "";
|
|
526
|
-
$[
|
|
527
|
-
$[
|
|
528
|
-
$[
|
|
529
|
-
$[
|
|
530
|
-
$[
|
|
531
|
-
$[
|
|
532
|
-
$[
|
|
539
|
+
$[30] = fit;
|
|
540
|
+
$[31] = parts;
|
|
541
|
+
$[32] = dataKey;
|
|
542
|
+
$[33] = empty;
|
|
543
|
+
$[34] = interactiveLayerIds;
|
|
544
|
+
$[35] = ownerOf;
|
|
545
|
+
$[36] = t12;
|
|
533
546
|
} else {
|
|
534
|
-
dataKey = $[
|
|
535
|
-
empty = $[
|
|
536
|
-
interactiveLayerIds = $[
|
|
537
|
-
ownerOf = $[
|
|
538
|
-
|
|
547
|
+
dataKey = $[32];
|
|
548
|
+
empty = $[33];
|
|
549
|
+
interactiveLayerIds = $[34];
|
|
550
|
+
ownerOf = $[35];
|
|
551
|
+
t12 = $[36];
|
|
539
552
|
}
|
|
540
|
-
const selectionKey =
|
|
553
|
+
const selectionKey = t12;
|
|
541
554
|
const userMoved = React.useRef(false);
|
|
542
|
-
let t12;
|
|
543
555
|
let t13;
|
|
544
|
-
|
|
545
|
-
|
|
556
|
+
let t14;
|
|
557
|
+
if ($[37] !== map) {
|
|
558
|
+
t13 = () => {
|
|
546
559
|
const instance = map?.getMap();
|
|
547
560
|
if (!instance) return;
|
|
548
561
|
const onMoveStart = (event) => {
|
|
@@ -553,28 +566,28 @@ function MapRoot(t0) {
|
|
|
553
566
|
instance.off("movestart", onMoveStart);
|
|
554
567
|
};
|
|
555
568
|
};
|
|
556
|
-
|
|
557
|
-
$[
|
|
558
|
-
$[37] = t12;
|
|
569
|
+
t14 = [map];
|
|
570
|
+
$[37] = map;
|
|
559
571
|
$[38] = t13;
|
|
572
|
+
$[39] = t14;
|
|
560
573
|
} else {
|
|
561
|
-
t12 = $[37];
|
|
562
574
|
t13 = $[38];
|
|
575
|
+
t14 = $[39];
|
|
563
576
|
}
|
|
564
|
-
React.useEffect(
|
|
565
|
-
let
|
|
566
|
-
if ($[
|
|
567
|
-
|
|
577
|
+
React.useEffect(t13, t14);
|
|
578
|
+
let t15;
|
|
579
|
+
if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
|
|
580
|
+
t15 = {
|
|
568
581
|
data: "",
|
|
569
582
|
selection: ""
|
|
570
583
|
};
|
|
571
|
-
$[
|
|
572
|
-
} else
|
|
573
|
-
const fitted = React.useRef(
|
|
574
|
-
let t15;
|
|
584
|
+
$[40] = t15;
|
|
585
|
+
} else t15 = $[40];
|
|
586
|
+
const fitted = React.useRef(t15);
|
|
575
587
|
let t16;
|
|
576
|
-
|
|
577
|
-
|
|
588
|
+
let t17;
|
|
589
|
+
if ($[41] !== dataKey || $[42] !== map || $[43] !== selectionKey) {
|
|
590
|
+
t16 = () => {
|
|
578
591
|
if (!map) return;
|
|
579
592
|
const prev_0 = fitted.current;
|
|
580
593
|
fitted.current = {
|
|
@@ -592,24 +605,24 @@ function MapRoot(t0) {
|
|
|
592
605
|
duration: 400
|
|
593
606
|
});
|
|
594
607
|
};
|
|
595
|
-
|
|
608
|
+
t17 = [
|
|
596
609
|
map,
|
|
597
610
|
dataKey,
|
|
598
611
|
selectionKey
|
|
599
612
|
];
|
|
600
|
-
$[
|
|
601
|
-
$[
|
|
602
|
-
$[
|
|
603
|
-
$[43] = t15;
|
|
613
|
+
$[41] = dataKey;
|
|
614
|
+
$[42] = map;
|
|
615
|
+
$[43] = selectionKey;
|
|
604
616
|
$[44] = t16;
|
|
617
|
+
$[45] = t17;
|
|
605
618
|
} else {
|
|
606
|
-
t15 = $[43];
|
|
607
619
|
t16 = $[44];
|
|
620
|
+
t17 = $[45];
|
|
608
621
|
}
|
|
609
|
-
React.useEffect(
|
|
610
|
-
let
|
|
611
|
-
if ($[
|
|
612
|
-
|
|
622
|
+
React.useEffect(t16, t17);
|
|
623
|
+
let t18;
|
|
624
|
+
if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
|
|
625
|
+
t18 = (next_0, event_0) => {
|
|
613
626
|
const prev_1 = hovered.current;
|
|
614
627
|
const key_0 = _temp8;
|
|
615
628
|
if (key_0(prev_1) === key_0(next_0)) return;
|
|
@@ -625,13 +638,13 @@ function MapRoot(t0) {
|
|
|
625
638
|
hovered.current = next_0;
|
|
626
639
|
setCursor(next_0 ? "pointer" : "");
|
|
627
640
|
};
|
|
628
|
-
$[
|
|
629
|
-
} else
|
|
630
|
-
const setHover =
|
|
631
|
-
let t18;
|
|
641
|
+
$[46] = t18;
|
|
642
|
+
} else t18 = $[46];
|
|
643
|
+
const setHover = t18;
|
|
632
644
|
let t19;
|
|
633
|
-
|
|
634
|
-
|
|
645
|
+
let t20;
|
|
646
|
+
if ($[47] !== expanded) {
|
|
647
|
+
t19 = () => {
|
|
635
648
|
if (!expanded) return;
|
|
636
649
|
const onKeyDown = (event_1) => {
|
|
637
650
|
if (event_1.key === "Escape" && !event_1.defaultPrevented) setExpanded(false);
|
|
@@ -639,35 +652,66 @@ function MapRoot(t0) {
|
|
|
639
652
|
document.addEventListener("keydown", onKeyDown);
|
|
640
653
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
641
654
|
};
|
|
642
|
-
|
|
643
|
-
$[
|
|
644
|
-
$[47] = t18;
|
|
655
|
+
t20 = [expanded];
|
|
656
|
+
$[47] = expanded;
|
|
645
657
|
$[48] = t19;
|
|
658
|
+
$[49] = t20;
|
|
646
659
|
} else {
|
|
647
|
-
t18 = $[47];
|
|
648
660
|
t19 = $[48];
|
|
661
|
+
t20 = $[49];
|
|
649
662
|
}
|
|
650
|
-
React.useEffect(
|
|
651
|
-
let t20;
|
|
652
|
-
if ($[49] !== initialView) {
|
|
653
|
-
t20 = initialView && "bounds" in initialView ? {
|
|
654
|
-
bounds: initialView.bounds,
|
|
655
|
-
fitBoundsOptions: { padding: 48 }
|
|
656
|
-
} : initialView;
|
|
657
|
-
$[49] = initialView;
|
|
658
|
-
$[50] = t20;
|
|
659
|
-
} else t20 = $[50];
|
|
660
|
-
const initialViewState = t20;
|
|
663
|
+
React.useEffect(t19, t20);
|
|
661
664
|
let t21;
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
+
let t22;
|
|
666
|
+
if ($[50] !== attributionCollapsed || $[51] !== element) {
|
|
667
|
+
t21 = () => {
|
|
668
|
+
if (!element || !attributionCollapsed) return;
|
|
669
|
+
const collapse = () => {
|
|
670
|
+
const attribution = element.querySelector(".maplibregl-ctrl-attrib.maplibregl-compact-show:not([data-oui-collapsed])");
|
|
671
|
+
if (!attribution) return;
|
|
672
|
+
attribution.classList.remove("maplibregl-compact-show");
|
|
673
|
+
attribution.setAttribute("data-oui-collapsed", "");
|
|
674
|
+
};
|
|
675
|
+
const observer = new MutationObserver(collapse);
|
|
676
|
+
observer.observe(element, {
|
|
677
|
+
subtree: true,
|
|
678
|
+
childList: true,
|
|
679
|
+
attributes: true,
|
|
680
|
+
attributeFilter: ["class"]
|
|
681
|
+
});
|
|
682
|
+
collapse();
|
|
683
|
+
return () => observer.disconnect();
|
|
684
|
+
};
|
|
685
|
+
t22 = [element, attributionCollapsed];
|
|
686
|
+
$[50] = attributionCollapsed;
|
|
687
|
+
$[51] = element;
|
|
665
688
|
$[52] = t21;
|
|
666
|
-
|
|
667
|
-
|
|
689
|
+
$[53] = t22;
|
|
690
|
+
} else {
|
|
691
|
+
t21 = $[52];
|
|
692
|
+
t22 = $[53];
|
|
693
|
+
}
|
|
694
|
+
React.useEffect(t21, t22);
|
|
668
695
|
let t23;
|
|
669
|
-
if ($[
|
|
670
|
-
t23 =
|
|
696
|
+
if ($[54] !== initialView) {
|
|
697
|
+
t23 = initialView && "bounds" in initialView ? {
|
|
698
|
+
bounds: initialView.bounds,
|
|
699
|
+
fitBoundsOptions: { padding: 48 }
|
|
700
|
+
} : initialView;
|
|
701
|
+
$[54] = initialView;
|
|
702
|
+
$[55] = t23;
|
|
703
|
+
} else t23 = $[55];
|
|
704
|
+
const initialViewState = t23;
|
|
705
|
+
let t24;
|
|
706
|
+
if ($[56] !== className) {
|
|
707
|
+
t24 = cx("oui-map", className);
|
|
708
|
+
$[56] = className;
|
|
709
|
+
$[57] = t24;
|
|
710
|
+
} else t24 = $[57];
|
|
711
|
+
const t25 = expanded || void 0;
|
|
712
|
+
let t26;
|
|
713
|
+
if ($[58] !== baseLayers || $[59] !== children || $[60] !== colors || $[61] !== controlsPosition || $[62] !== current?.attribution || $[63] !== current?.id || $[64] !== cursor || $[65] !== element || $[66] !== empty || $[67] !== expandable || $[68] !== expanded || $[69] !== initialViewState || $[70] !== interactiveLayerIds || $[71] !== map || $[72] !== mapStyle || $[73] !== onClick || $[74] !== onMouseMove || $[75] !== onMouseOut || $[76] !== ownerOf || $[77] !== props || $[78] !== ref || $[79] !== setBaseLayer || $[80] !== text) {
|
|
714
|
+
t26 = element && /* @__PURE__ */ jsx(Map, {
|
|
671
715
|
...props,
|
|
672
716
|
mapLib: loadMapLib(),
|
|
673
717
|
ref: (instance_1) => {
|
|
@@ -737,47 +781,47 @@ function MapRoot(t0) {
|
|
|
737
781
|
]
|
|
738
782
|
})
|
|
739
783
|
});
|
|
740
|
-
$[
|
|
741
|
-
$[
|
|
742
|
-
$[
|
|
743
|
-
$[
|
|
744
|
-
$[
|
|
745
|
-
$[
|
|
746
|
-
$[
|
|
747
|
-
$[
|
|
748
|
-
$[
|
|
749
|
-
$[
|
|
750
|
-
$[
|
|
751
|
-
$[
|
|
752
|
-
$[
|
|
753
|
-
$[
|
|
754
|
-
$[
|
|
755
|
-
$[
|
|
756
|
-
$[
|
|
757
|
-
$[
|
|
758
|
-
$[
|
|
759
|
-
$[
|
|
760
|
-
$[
|
|
761
|
-
$[
|
|
762
|
-
$[
|
|
763
|
-
$[
|
|
764
|
-
} else
|
|
765
|
-
let
|
|
766
|
-
if ($[
|
|
767
|
-
|
|
784
|
+
$[58] = baseLayers;
|
|
785
|
+
$[59] = children;
|
|
786
|
+
$[60] = colors;
|
|
787
|
+
$[61] = controlsPosition;
|
|
788
|
+
$[62] = current?.attribution;
|
|
789
|
+
$[63] = current?.id;
|
|
790
|
+
$[64] = cursor;
|
|
791
|
+
$[65] = element;
|
|
792
|
+
$[66] = empty;
|
|
793
|
+
$[67] = expandable;
|
|
794
|
+
$[68] = expanded;
|
|
795
|
+
$[69] = initialViewState;
|
|
796
|
+
$[70] = interactiveLayerIds;
|
|
797
|
+
$[71] = map;
|
|
798
|
+
$[72] = mapStyle;
|
|
799
|
+
$[73] = onClick;
|
|
800
|
+
$[74] = onMouseMove;
|
|
801
|
+
$[75] = onMouseOut;
|
|
802
|
+
$[76] = ownerOf;
|
|
803
|
+
$[77] = props;
|
|
804
|
+
$[78] = ref;
|
|
805
|
+
$[79] = setBaseLayer;
|
|
806
|
+
$[80] = text;
|
|
807
|
+
$[81] = t26;
|
|
808
|
+
} else t26 = $[81];
|
|
809
|
+
let t27;
|
|
810
|
+
if ($[82] !== style || $[83] !== t24 || $[84] !== t25 || $[85] !== t26) {
|
|
811
|
+
t27 = /* @__PURE__ */ jsx("div", {
|
|
768
812
|
ref: setElement,
|
|
769
|
-
className:
|
|
813
|
+
className: t24,
|
|
770
814
|
style,
|
|
771
|
-
"data-expanded":
|
|
772
|
-
children:
|
|
815
|
+
"data-expanded": t25,
|
|
816
|
+
children: t26
|
|
773
817
|
});
|
|
774
|
-
$[
|
|
775
|
-
$[
|
|
776
|
-
$[
|
|
777
|
-
$[
|
|
778
|
-
$[
|
|
779
|
-
} else
|
|
780
|
-
return
|
|
818
|
+
$[82] = style;
|
|
819
|
+
$[83] = t24;
|
|
820
|
+
$[84] = t25;
|
|
821
|
+
$[85] = t26;
|
|
822
|
+
$[86] = t27;
|
|
823
|
+
} else t27 = $[86];
|
|
824
|
+
return t27;
|
|
781
825
|
}
|
|
782
826
|
/** The expand button as a MapLibre control, so it stacks with the zoom buttons in the same corner. */
|
|
783
827
|
function _temp9(value_0) {
|
|
@@ -1338,25 +1382,36 @@ function _temp11(item) {
|
|
|
1338
1382
|
return item.geometry.coordinates;
|
|
1339
1383
|
}
|
|
1340
1384
|
/**
|
|
1341
|
-
* Many simple points (sensors, stops, events) as one circle layer.
|
|
1342
|
-
*
|
|
1385
|
+
* Many simple points (sensors, stops, events) as one circle layer. Items with a `label` get it drawn in
|
|
1386
|
+
* the circle by a symbol layer on the same source, so thousands of numbered stops stay fast. For a few
|
|
1387
|
+
* dozen styled pins with HTML content, use `Map.Marker` instead.
|
|
1343
1388
|
*
|
|
1344
1389
|
* @example
|
|
1345
1390
|
* <Map.Points items={sensors.map((s) => ({ id: s.id, coordinates: s.position, tone: s.ok ? 'success' : 'danger' }))} />
|
|
1391
|
+
*
|
|
1392
|
+
* @example
|
|
1393
|
+
* // Stops numbered in visiting order, one colour per truck.
|
|
1394
|
+
* <Map.Points
|
|
1395
|
+
* items={trucks.flatMap((truck, t) =>
|
|
1396
|
+
* truck.stops.map((stop, i) => ({ id: stop.id, coordinates: stop.position, colorIndex: t, label: i + 1 })),
|
|
1397
|
+
* )}
|
|
1398
|
+
* />
|
|
1346
1399
|
*/
|
|
1347
1400
|
function MapPoints(t0) {
|
|
1348
|
-
const $ = c(
|
|
1401
|
+
const $ = c(43);
|
|
1349
1402
|
const { items, selectedIds, onItemClick, onItemHover } = t0;
|
|
1350
1403
|
const sourceId = usePartId("points");
|
|
1351
1404
|
const circleId = `${sourceId}-circle`;
|
|
1405
|
+
const labelId = `${sourceId}-label`;
|
|
1352
1406
|
let t1;
|
|
1353
|
-
if ($[0] !== circleId) {
|
|
1354
|
-
t1 = [circleId];
|
|
1407
|
+
if ($[0] !== circleId || $[1] !== labelId) {
|
|
1408
|
+
t1 = [circleId, labelId];
|
|
1355
1409
|
$[0] = circleId;
|
|
1356
|
-
$[1] =
|
|
1357
|
-
|
|
1410
|
+
$[1] = labelId;
|
|
1411
|
+
$[2] = t1;
|
|
1412
|
+
} else t1 = $[2];
|
|
1358
1413
|
let t2;
|
|
1359
|
-
if ($[
|
|
1414
|
+
if ($[3] !== items || $[4] !== onItemClick || $[5] !== onItemHover || $[6] !== selectedIds || $[7] !== t1) {
|
|
1360
1415
|
t2 = {
|
|
1361
1416
|
items,
|
|
1362
1417
|
selectedIds,
|
|
@@ -1365,119 +1420,178 @@ function MapPoints(t0) {
|
|
|
1365
1420
|
onItemClick,
|
|
1366
1421
|
onItemHover
|
|
1367
1422
|
};
|
|
1368
|
-
$[
|
|
1369
|
-
$[
|
|
1370
|
-
$[
|
|
1371
|
-
$[
|
|
1372
|
-
$[
|
|
1373
|
-
$[
|
|
1374
|
-
} else t2 = $[
|
|
1423
|
+
$[3] = items;
|
|
1424
|
+
$[4] = onItemClick;
|
|
1425
|
+
$[5] = onItemHover;
|
|
1426
|
+
$[6] = selectedIds;
|
|
1427
|
+
$[7] = t1;
|
|
1428
|
+
$[8] = t2;
|
|
1429
|
+
} else t2 = $[8];
|
|
1375
1430
|
const { colors, hasSelection, valid } = useDataPart("Map.Points", sourceId, t2);
|
|
1431
|
+
let data;
|
|
1432
|
+
let opacity;
|
|
1376
1433
|
let t3;
|
|
1377
|
-
if ($[
|
|
1434
|
+
if ($[9] !== colors || $[10] !== hasSelection || $[11] !== items || $[12] !== valid) {
|
|
1378
1435
|
let t4;
|
|
1379
|
-
if ($[
|
|
1436
|
+
if ($[16] !== colors || $[17] !== valid) {
|
|
1380
1437
|
t4 = (item_0, index) => valid.has(item_0) ? [{
|
|
1381
1438
|
type: "Feature",
|
|
1382
1439
|
properties: {
|
|
1383
1440
|
id: item_0.id,
|
|
1384
|
-
color: colors.color(item_0.color ?? (item_0.tone ? toneColors[item_0.tone].solid : seriesColor(item_0.colorIndex ?? index)))
|
|
1441
|
+
color: colors.color(item_0.color ?? (item_0.tone ? toneColors[item_0.tone].solid : seriesColor(item_0.colorIndex ?? index))),
|
|
1442
|
+
...item_0.label != null && item_0.label !== "" && { label: String(item_0.label) }
|
|
1385
1443
|
},
|
|
1386
1444
|
geometry: {
|
|
1387
1445
|
type: "Point",
|
|
1388
1446
|
coordinates: item_0.coordinates
|
|
1389
1447
|
}
|
|
1390
1448
|
}] : [];
|
|
1391
|
-
$[
|
|
1392
|
-
$[
|
|
1393
|
-
$[
|
|
1394
|
-
} else t4 = $[
|
|
1395
|
-
|
|
1396
|
-
$[8] = colors;
|
|
1397
|
-
$[9] = items;
|
|
1398
|
-
$[10] = valid;
|
|
1399
|
-
$[11] = t3;
|
|
1400
|
-
} else t3 = $[11];
|
|
1401
|
-
let t4;
|
|
1402
|
-
if ($[15] !== t3) {
|
|
1403
|
-
t4 = {
|
|
1449
|
+
$[16] = colors;
|
|
1450
|
+
$[17] = valid;
|
|
1451
|
+
$[18] = t4;
|
|
1452
|
+
} else t4 = $[18];
|
|
1453
|
+
data = {
|
|
1404
1454
|
type: "FeatureCollection",
|
|
1405
|
-
features:
|
|
1455
|
+
features: items.flatMap(t4)
|
|
1406
1456
|
};
|
|
1457
|
+
let t5;
|
|
1458
|
+
if ($[19] !== colors || $[20] !== hasSelection) {
|
|
1459
|
+
t5 = dimmed(hasSelection, colors.number("--oui-map-dim-opacity", .35));
|
|
1460
|
+
$[19] = colors;
|
|
1461
|
+
$[20] = hasSelection;
|
|
1462
|
+
$[21] = t5;
|
|
1463
|
+
} else t5 = $[21];
|
|
1464
|
+
opacity = t5;
|
|
1465
|
+
t3 = data.features.some(_temp13);
|
|
1466
|
+
$[9] = colors;
|
|
1467
|
+
$[10] = hasSelection;
|
|
1468
|
+
$[11] = items;
|
|
1469
|
+
$[12] = valid;
|
|
1470
|
+
$[13] = data;
|
|
1471
|
+
$[14] = opacity;
|
|
1407
1472
|
$[15] = t3;
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
} else t5 = $[19];
|
|
1418
|
-
const opacity = t5;
|
|
1419
|
-
let t6;
|
|
1420
|
-
let t7;
|
|
1421
|
-
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1422
|
-
t6 = ["get", "color"];
|
|
1423
|
-
t7 = [
|
|
1473
|
+
} else {
|
|
1474
|
+
data = $[13];
|
|
1475
|
+
opacity = $[14];
|
|
1476
|
+
t3 = $[15];
|
|
1477
|
+
}
|
|
1478
|
+
const hasLabels = t3;
|
|
1479
|
+
let t4;
|
|
1480
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1481
|
+
t4 = [
|
|
1424
1482
|
"case",
|
|
1425
1483
|
ACTIVE,
|
|
1426
|
-
|
|
1427
|
-
|
|
1484
|
+
2,
|
|
1485
|
+
0
|
|
1428
1486
|
];
|
|
1429
|
-
$[
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1487
|
+
$[22] = t4;
|
|
1488
|
+
} else t4 = $[22];
|
|
1489
|
+
let t5;
|
|
1490
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1491
|
+
t5 = ["has", "label"];
|
|
1492
|
+
$[23] = t5;
|
|
1493
|
+
} else t5 = $[23];
|
|
1494
|
+
let t6;
|
|
1495
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1496
|
+
t6 = [
|
|
1497
|
+
"+",
|
|
1498
|
+
t4,
|
|
1499
|
+
[
|
|
1500
|
+
"case",
|
|
1501
|
+
t5,
|
|
1502
|
+
[
|
|
1503
|
+
"step",
|
|
1504
|
+
["length", ["get", "label"]],
|
|
1505
|
+
9,
|
|
1506
|
+
3,
|
|
1507
|
+
11
|
|
1508
|
+
],
|
|
1509
|
+
5
|
|
1510
|
+
]
|
|
1511
|
+
];
|
|
1512
|
+
$[24] = t6;
|
|
1513
|
+
} else t6 = $[24];
|
|
1514
|
+
const radius = t6;
|
|
1515
|
+
let t7;
|
|
1516
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1517
|
+
t7 = ["get", "color"];
|
|
1518
|
+
$[25] = t7;
|
|
1519
|
+
} else t7 = $[25];
|
|
1435
1520
|
let t8;
|
|
1436
|
-
if ($[
|
|
1521
|
+
if ($[26] !== colors) {
|
|
1437
1522
|
t8 = colors.color("var(--oui-map-casing-color)");
|
|
1438
|
-
$[
|
|
1439
|
-
$[
|
|
1440
|
-
} else t8 = $[
|
|
1523
|
+
$[26] = colors;
|
|
1524
|
+
$[27] = t8;
|
|
1525
|
+
} else t8 = $[27];
|
|
1441
1526
|
let t9;
|
|
1442
|
-
if ($[
|
|
1527
|
+
if ($[28] !== opacity || $[29] !== t8) {
|
|
1443
1528
|
t9 = {
|
|
1444
|
-
"circle-color":
|
|
1445
|
-
"circle-radius":
|
|
1529
|
+
"circle-color": t7,
|
|
1530
|
+
"circle-radius": radius,
|
|
1446
1531
|
"circle-stroke-color": t8,
|
|
1447
1532
|
"circle-stroke-width": 1.5,
|
|
1448
1533
|
"circle-opacity": opacity,
|
|
1449
1534
|
"circle-stroke-opacity": opacity
|
|
1450
1535
|
};
|
|
1451
|
-
$[
|
|
1452
|
-
$[
|
|
1453
|
-
$[
|
|
1454
|
-
} else t9 = $[
|
|
1536
|
+
$[28] = opacity;
|
|
1537
|
+
$[29] = t8;
|
|
1538
|
+
$[30] = t9;
|
|
1539
|
+
} else t9 = $[30];
|
|
1455
1540
|
let t10;
|
|
1456
|
-
if ($[
|
|
1541
|
+
if ($[31] !== circleId || $[32] !== t9) {
|
|
1457
1542
|
t10 = /* @__PURE__ */ jsx(Layer, {
|
|
1458
1543
|
id: circleId,
|
|
1459
1544
|
type: "circle",
|
|
1460
1545
|
paint: t9
|
|
1461
1546
|
});
|
|
1462
|
-
$[
|
|
1463
|
-
$[
|
|
1464
|
-
$[
|
|
1465
|
-
} else t10 = $[
|
|
1547
|
+
$[31] = circleId;
|
|
1548
|
+
$[32] = t9;
|
|
1549
|
+
$[33] = t10;
|
|
1550
|
+
} else t10 = $[33];
|
|
1466
1551
|
let t11;
|
|
1467
|
-
if ($[
|
|
1468
|
-
t11 = /* @__PURE__ */ jsx(
|
|
1552
|
+
if ($[34] !== hasLabels || $[35] !== labelId || $[36] !== opacity) {
|
|
1553
|
+
t11 = hasLabels && /* @__PURE__ */ jsx(Layer, {
|
|
1554
|
+
id: labelId,
|
|
1555
|
+
type: "symbol",
|
|
1556
|
+
filter: ["has", "label"],
|
|
1557
|
+
layout: {
|
|
1558
|
+
"text-field": ["get", "label"],
|
|
1559
|
+
"text-font": LABEL_FONT,
|
|
1560
|
+
"text-size": 10,
|
|
1561
|
+
"text-allow-overlap": true,
|
|
1562
|
+
"text-ignore-placement": true
|
|
1563
|
+
},
|
|
1564
|
+
paint: {
|
|
1565
|
+
"text-color": "#ffffff",
|
|
1566
|
+
"text-halo-color": "rgba(0, 0, 0, 0.55)",
|
|
1567
|
+
"text-halo-width": 1,
|
|
1568
|
+
"text-opacity": opacity
|
|
1569
|
+
}
|
|
1570
|
+
});
|
|
1571
|
+
$[34] = hasLabels;
|
|
1572
|
+
$[35] = labelId;
|
|
1573
|
+
$[36] = opacity;
|
|
1574
|
+
$[37] = t11;
|
|
1575
|
+
} else t11 = $[37];
|
|
1576
|
+
let t12;
|
|
1577
|
+
if ($[38] !== data || $[39] !== sourceId || $[40] !== t10 || $[41] !== t11) {
|
|
1578
|
+
t12 = /* @__PURE__ */ jsxs(Source, {
|
|
1469
1579
|
id: sourceId,
|
|
1470
1580
|
type: "geojson",
|
|
1471
1581
|
data,
|
|
1472
1582
|
promoteId: "id",
|
|
1473
|
-
children: t10
|
|
1583
|
+
children: [t10, t11]
|
|
1474
1584
|
});
|
|
1475
|
-
$[
|
|
1476
|
-
$[
|
|
1477
|
-
$[
|
|
1478
|
-
$[
|
|
1479
|
-
|
|
1480
|
-
|
|
1585
|
+
$[38] = data;
|
|
1586
|
+
$[39] = sourceId;
|
|
1587
|
+
$[40] = t10;
|
|
1588
|
+
$[41] = t11;
|
|
1589
|
+
$[42] = t12;
|
|
1590
|
+
} else t12 = $[42];
|
|
1591
|
+
return t12;
|
|
1592
|
+
}
|
|
1593
|
+
function _temp13(feature) {
|
|
1594
|
+
return "label" in feature.properties;
|
|
1481
1595
|
}
|
|
1482
1596
|
function _temp12(item) {
|
|
1483
1597
|
return item.coordinates;
|
|
@@ -1773,7 +1887,7 @@ function MapOverlay(t0) {
|
|
|
1773
1887
|
* />
|
|
1774
1888
|
*/
|
|
1775
1889
|
function MapLegend(t0) {
|
|
1776
|
-
const $ = c(
|
|
1890
|
+
const $ = c(50);
|
|
1777
1891
|
let className;
|
|
1778
1892
|
let items;
|
|
1779
1893
|
let onSelectedIdsChange;
|
|
@@ -1783,8 +1897,9 @@ function MapLegend(t0) {
|
|
|
1783
1897
|
let t1;
|
|
1784
1898
|
let t2;
|
|
1785
1899
|
let t3;
|
|
1900
|
+
let t4;
|
|
1786
1901
|
if ($[0] !== t0) {
|
|
1787
|
-
({items, selectionMode: t1, selectedIds: t2, onSelectedIdsChange, onVisibilityChange, showAllToggle: t3, className, ref, ...props} = t0);
|
|
1902
|
+
({items, selectionMode: t1, selectedIds: t2, onSelectedIdsChange, onVisibilityChange, showAllToggle: t3, size: t4, className, ref, ...props} = t0);
|
|
1788
1903
|
$[0] = t0;
|
|
1789
1904
|
$[1] = className;
|
|
1790
1905
|
$[2] = items;
|
|
@@ -1795,6 +1910,7 @@ function MapLegend(t0) {
|
|
|
1795
1910
|
$[7] = t1;
|
|
1796
1911
|
$[8] = t2;
|
|
1797
1912
|
$[9] = t3;
|
|
1913
|
+
$[10] = t4;
|
|
1798
1914
|
} else {
|
|
1799
1915
|
className = $[1];
|
|
1800
1916
|
items = $[2];
|
|
@@ -1805,63 +1921,65 @@ function MapLegend(t0) {
|
|
|
1805
1921
|
t1 = $[7];
|
|
1806
1922
|
t2 = $[8];
|
|
1807
1923
|
t3 = $[9];
|
|
1924
|
+
t4 = $[10];
|
|
1808
1925
|
}
|
|
1809
1926
|
const selectionMode = t1 === void 0 ? "none" : t1;
|
|
1810
|
-
let
|
|
1811
|
-
if ($[
|
|
1812
|
-
|
|
1813
|
-
$[
|
|
1814
|
-
$[
|
|
1815
|
-
} else
|
|
1816
|
-
const selectedIds =
|
|
1927
|
+
let t5;
|
|
1928
|
+
if ($[11] !== t2) {
|
|
1929
|
+
t5 = t2 === void 0 ? [] : t2;
|
|
1930
|
+
$[11] = t2;
|
|
1931
|
+
$[12] = t5;
|
|
1932
|
+
} else t5 = $[12];
|
|
1933
|
+
const selectedIds = t5;
|
|
1817
1934
|
const showAllToggle = t3 === void 0 ? false : t3;
|
|
1935
|
+
const size = t4 === void 0 ? "md" : t4;
|
|
1818
1936
|
const labels = React.use(MapContext)?.labels ?? defaultLabels;
|
|
1819
|
-
let t5;
|
|
1820
|
-
if ($[12] !== items) {
|
|
1821
|
-
t5 = items.every(_temp13);
|
|
1822
|
-
$[12] = items;
|
|
1823
|
-
$[13] = t5;
|
|
1824
|
-
} else t5 = $[13];
|
|
1825
|
-
const allVisible = t5;
|
|
1826
1937
|
let t6;
|
|
1827
|
-
if ($[
|
|
1828
|
-
t6 = (
|
|
1938
|
+
if ($[13] !== items) {
|
|
1939
|
+
t6 = items.every(_temp14);
|
|
1940
|
+
$[13] = items;
|
|
1941
|
+
$[14] = t6;
|
|
1942
|
+
} else t6 = $[14];
|
|
1943
|
+
const allVisible = t6;
|
|
1944
|
+
let t7;
|
|
1945
|
+
if ($[15] !== onSelectedIdsChange || $[16] !== selectedIds || $[17] !== selectionMode) {
|
|
1946
|
+
t7 = (id) => {
|
|
1829
1947
|
const on = selectedIds.includes(id);
|
|
1830
1948
|
if (selectionMode === "single") onSelectedIdsChange?.(on ? [] : [id]);
|
|
1831
1949
|
else onSelectedIdsChange?.(on ? selectedIds.filter((s) => s !== id) : [...selectedIds, id]);
|
|
1832
1950
|
};
|
|
1833
|
-
$[
|
|
1834
|
-
$[
|
|
1835
|
-
$[
|
|
1836
|
-
$[
|
|
1837
|
-
} else
|
|
1838
|
-
const toggle =
|
|
1839
|
-
let t7;
|
|
1840
|
-
if ($[18] !== className) {
|
|
1841
|
-
t7 = cx("oui-map-legend", className);
|
|
1842
|
-
$[18] = className;
|
|
1843
|
-
$[19] = t7;
|
|
1844
|
-
} else t7 = $[19];
|
|
1951
|
+
$[15] = onSelectedIdsChange;
|
|
1952
|
+
$[16] = selectedIds;
|
|
1953
|
+
$[17] = selectionMode;
|
|
1954
|
+
$[18] = t7;
|
|
1955
|
+
} else t7 = $[18];
|
|
1956
|
+
const toggle = t7;
|
|
1845
1957
|
let t8;
|
|
1846
|
-
if ($[
|
|
1847
|
-
t8 =
|
|
1958
|
+
if ($[19] !== className) {
|
|
1959
|
+
t8 = cx("oui-map-legend", className);
|
|
1960
|
+
$[19] = className;
|
|
1961
|
+
$[20] = t8;
|
|
1962
|
+
} else t8 = $[20];
|
|
1963
|
+
let t9;
|
|
1964
|
+
if ($[21] !== allVisible || $[22] !== items || $[23] !== labels || $[24] !== onVisibilityChange || $[25] !== showAllToggle) {
|
|
1965
|
+
t9 = onVisibilityChange && showAllToggle && /* @__PURE__ */ jsx("button", {
|
|
1848
1966
|
type: "button",
|
|
1849
1967
|
className: "oui-map-legend__toggle-all",
|
|
1850
|
-
onClick: () => onVisibilityChange(items.map(
|
|
1968
|
+
onClick: () => onVisibilityChange(items.map(_temp15), !allVisible),
|
|
1851
1969
|
children: allVisible ? labels.hideAll : labels.showAll
|
|
1852
1970
|
});
|
|
1853
|
-
$[
|
|
1854
|
-
$[
|
|
1855
|
-
$[
|
|
1856
|
-
$[
|
|
1857
|
-
$[
|
|
1858
|
-
$[
|
|
1859
|
-
} else
|
|
1860
|
-
let
|
|
1861
|
-
if ($[
|
|
1862
|
-
let
|
|
1863
|
-
if ($[
|
|
1864
|
-
|
|
1971
|
+
$[21] = allVisible;
|
|
1972
|
+
$[22] = items;
|
|
1973
|
+
$[23] = labels;
|
|
1974
|
+
$[24] = onVisibilityChange;
|
|
1975
|
+
$[25] = showAllToggle;
|
|
1976
|
+
$[26] = t9;
|
|
1977
|
+
} else t9 = $[26];
|
|
1978
|
+
let t10;
|
|
1979
|
+
if ($[27] !== items || $[28] !== labels || $[29] !== onVisibilityChange || $[30] !== selectedIds || $[31] !== selectionMode || $[32] !== toggle) {
|
|
1980
|
+
let t11;
|
|
1981
|
+
if ($[34] !== labels || $[35] !== onVisibilityChange || $[36] !== selectedIds || $[37] !== selectionMode || $[38] !== toggle) {
|
|
1982
|
+
t11 = (item_1) => {
|
|
1865
1983
|
const selected = selectedIds.includes(item_1.id);
|
|
1866
1984
|
const visible = item_1.visible !== false;
|
|
1867
1985
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1900,95 +2018,170 @@ function MapLegend(t0) {
|
|
|
1900
2018
|
})]
|
|
1901
2019
|
}, item_1.id);
|
|
1902
2020
|
};
|
|
1903
|
-
$[
|
|
1904
|
-
$[
|
|
1905
|
-
$[
|
|
1906
|
-
$[
|
|
1907
|
-
$[
|
|
1908
|
-
$[
|
|
1909
|
-
} else
|
|
1910
|
-
|
|
1911
|
-
$[
|
|
1912
|
-
$[
|
|
1913
|
-
$[
|
|
1914
|
-
$[
|
|
1915
|
-
$[
|
|
1916
|
-
$[
|
|
1917
|
-
$[
|
|
1918
|
-
} else
|
|
1919
|
-
let
|
|
1920
|
-
if ($[
|
|
1921
|
-
|
|
2021
|
+
$[34] = labels;
|
|
2022
|
+
$[35] = onVisibilityChange;
|
|
2023
|
+
$[36] = selectedIds;
|
|
2024
|
+
$[37] = selectionMode;
|
|
2025
|
+
$[38] = toggle;
|
|
2026
|
+
$[39] = t11;
|
|
2027
|
+
} else t11 = $[39];
|
|
2028
|
+
t10 = items.map(t11);
|
|
2029
|
+
$[27] = items;
|
|
2030
|
+
$[28] = labels;
|
|
2031
|
+
$[29] = onVisibilityChange;
|
|
2032
|
+
$[30] = selectedIds;
|
|
2033
|
+
$[31] = selectionMode;
|
|
2034
|
+
$[32] = toggle;
|
|
2035
|
+
$[33] = t10;
|
|
2036
|
+
} else t10 = $[33];
|
|
2037
|
+
let t11;
|
|
2038
|
+
if ($[40] !== t10) {
|
|
2039
|
+
t11 = /* @__PURE__ */ jsx("ul", {
|
|
1922
2040
|
className: "oui-map-legend__list",
|
|
1923
|
-
children:
|
|
2041
|
+
children: t10
|
|
1924
2042
|
});
|
|
1925
|
-
$[39] = t9;
|
|
1926
2043
|
$[40] = t10;
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
2044
|
+
$[41] = t11;
|
|
2045
|
+
} else t11 = $[41];
|
|
2046
|
+
let t12;
|
|
2047
|
+
if ($[42] !== props || $[43] !== ref || $[44] !== selectionMode || $[45] !== size || $[46] !== t11 || $[47] !== t8 || $[48] !== t9) {
|
|
2048
|
+
t12 = /* @__PURE__ */ jsxs("div", {
|
|
1931
2049
|
ref,
|
|
1932
|
-
className:
|
|
2050
|
+
className: t8,
|
|
1933
2051
|
"data-selection-mode": selectionMode,
|
|
2052
|
+
"data-size": size,
|
|
1934
2053
|
...props,
|
|
1935
|
-
children: [
|
|
2054
|
+
children: [t9, t11]
|
|
1936
2055
|
});
|
|
1937
|
-
$[
|
|
1938
|
-
$[
|
|
1939
|
-
$[
|
|
1940
|
-
$[
|
|
1941
|
-
$[
|
|
1942
|
-
$[
|
|
1943
|
-
$[
|
|
1944
|
-
|
|
1945
|
-
|
|
2056
|
+
$[42] = props;
|
|
2057
|
+
$[43] = ref;
|
|
2058
|
+
$[44] = selectionMode;
|
|
2059
|
+
$[45] = size;
|
|
2060
|
+
$[46] = t11;
|
|
2061
|
+
$[47] = t8;
|
|
2062
|
+
$[48] = t9;
|
|
2063
|
+
$[49] = t12;
|
|
2064
|
+
} else t12 = $[49];
|
|
2065
|
+
return t12;
|
|
1946
2066
|
}
|
|
1947
|
-
function
|
|
2067
|
+
function _temp15(item_0) {
|
|
1948
2068
|
return item_0.id;
|
|
1949
2069
|
}
|
|
1950
|
-
function
|
|
2070
|
+
function _temp14(item) {
|
|
1951
2071
|
return item.visible !== false;
|
|
1952
2072
|
}
|
|
1953
|
-
/**
|
|
2073
|
+
/**
|
|
2074
|
+
* Switch between the root's `baseLayers` (e.g. streets and satellite): a segmented switch, or with
|
|
2075
|
+
* `variant="icon"` a single button that cycles them. Put it in a `Map.Overlay`.
|
|
2076
|
+
*/
|
|
1954
2077
|
function MapBaseLayerSwitch(t0) {
|
|
1955
|
-
const $ = c(
|
|
2078
|
+
const $ = c(33);
|
|
2079
|
+
let className;
|
|
1956
2080
|
let props;
|
|
1957
2081
|
let t1;
|
|
2082
|
+
let t2;
|
|
1958
2083
|
if ($[0] !== t0) {
|
|
1959
|
-
({
|
|
2084
|
+
({variant: t1, size: t2, className, ...props} = t0);
|
|
1960
2085
|
$[0] = t0;
|
|
1961
|
-
$[1] =
|
|
1962
|
-
$[2] =
|
|
2086
|
+
$[1] = className;
|
|
2087
|
+
$[2] = props;
|
|
2088
|
+
$[3] = t1;
|
|
2089
|
+
$[4] = t2;
|
|
1963
2090
|
} else {
|
|
1964
|
-
|
|
1965
|
-
|
|
2091
|
+
className = $[1];
|
|
2092
|
+
props = $[2];
|
|
2093
|
+
t1 = $[3];
|
|
2094
|
+
t2 = $[4];
|
|
2095
|
+
}
|
|
2096
|
+
const variant = t1 === void 0 ? "segmented" : t1;
|
|
2097
|
+
const size = t2 === void 0 ? "sm" : t2;
|
|
2098
|
+
const { baseLayers, baseLayer, setBaseLayer, labels } = useMapContext("Map.BaseLayerSwitch");
|
|
2099
|
+
if (variant === "icon") {
|
|
2100
|
+
let t3;
|
|
2101
|
+
if ($[5] !== baseLayer || $[6] !== baseLayers) {
|
|
2102
|
+
let t4;
|
|
2103
|
+
if ($[8] !== baseLayer) {
|
|
2104
|
+
t4 = (layer) => layer.id === baseLayer;
|
|
2105
|
+
$[8] = baseLayer;
|
|
2106
|
+
$[9] = t4;
|
|
2107
|
+
} else t4 = $[9];
|
|
2108
|
+
t3 = baseLayers.findIndex(t4);
|
|
2109
|
+
$[5] = baseLayer;
|
|
2110
|
+
$[6] = baseLayers;
|
|
2111
|
+
$[7] = t3;
|
|
2112
|
+
} else t3 = $[7];
|
|
2113
|
+
const index = Math.max(0, t3);
|
|
2114
|
+
const shown = baseLayers[index];
|
|
2115
|
+
const name = `${labels.baseLayer}: ${typeof shown?.label === "string" ? shown.label : shown?.id ?? ""}`;
|
|
2116
|
+
const t4 = typeof className === "string" && className;
|
|
2117
|
+
let t5;
|
|
2118
|
+
if ($[10] !== t4) {
|
|
2119
|
+
t5 = cx("oui-map__layer-switch", t4);
|
|
2120
|
+
$[10] = t4;
|
|
2121
|
+
$[11] = t5;
|
|
2122
|
+
} else t5 = $[11];
|
|
2123
|
+
const t6 = baseLayers.length < 2;
|
|
2124
|
+
let t7;
|
|
2125
|
+
if ($[12] !== baseLayers || $[13] !== index || $[14] !== setBaseLayer) {
|
|
2126
|
+
t7 = () => setBaseLayer(baseLayers[(index + 1) % baseLayers.length].id);
|
|
2127
|
+
$[12] = baseLayers;
|
|
2128
|
+
$[13] = index;
|
|
2129
|
+
$[14] = setBaseLayer;
|
|
2130
|
+
$[15] = t7;
|
|
2131
|
+
} else t7 = $[15];
|
|
2132
|
+
let t8;
|
|
2133
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2134
|
+
t8 = /* @__PURE__ */ jsx(LayersIcon, {});
|
|
2135
|
+
$[16] = t8;
|
|
2136
|
+
} else t8 = $[16];
|
|
2137
|
+
let t9;
|
|
2138
|
+
if ($[17] !== name || $[18] !== size || $[19] !== t5 || $[20] !== t6 || $[21] !== t7) {
|
|
2139
|
+
t9 = /* @__PURE__ */ jsx(IconButton, {
|
|
2140
|
+
variant: "secondary",
|
|
2141
|
+
size,
|
|
2142
|
+
className: t5,
|
|
2143
|
+
"aria-label": name,
|
|
2144
|
+
title: name,
|
|
2145
|
+
disabled: t6,
|
|
2146
|
+
onClick: t7,
|
|
2147
|
+
children: t8
|
|
2148
|
+
});
|
|
2149
|
+
$[17] = name;
|
|
2150
|
+
$[18] = size;
|
|
2151
|
+
$[19] = t5;
|
|
2152
|
+
$[20] = t6;
|
|
2153
|
+
$[21] = t7;
|
|
2154
|
+
$[22] = t9;
|
|
2155
|
+
} else t9 = $[22];
|
|
2156
|
+
return t9;
|
|
1966
2157
|
}
|
|
1967
|
-
const size = t1 === void 0 ? "sm" : t1;
|
|
1968
|
-
const { baseLayers, baseLayer, setBaseLayer } = useMapContext("Map.BaseLayerSwitch");
|
|
1969
|
-
let t2;
|
|
1970
|
-
if ($[3] !== baseLayers) {
|
|
1971
|
-
t2 = baseLayers.map(_temp15);
|
|
1972
|
-
$[3] = baseLayers;
|
|
1973
|
-
$[4] = t2;
|
|
1974
|
-
} else t2 = $[4];
|
|
1975
2158
|
let t3;
|
|
1976
|
-
if ($[
|
|
1977
|
-
t3 =
|
|
2159
|
+
if ($[23] !== baseLayers) {
|
|
2160
|
+
t3 = baseLayers.map(_temp16);
|
|
2161
|
+
$[23] = baseLayers;
|
|
2162
|
+
$[24] = t3;
|
|
2163
|
+
} else t3 = $[24];
|
|
2164
|
+
let t4;
|
|
2165
|
+
if ($[25] !== baseLayer || $[26] !== className || $[27] !== props || $[28] !== setBaseLayer || $[29] !== size || $[30] !== t3 || $[31] !== variant) {
|
|
2166
|
+
t4 = /* @__PURE__ */ jsx(SegmentedControl, {
|
|
2167
|
+
variant,
|
|
1978
2168
|
size,
|
|
1979
|
-
|
|
2169
|
+
className,
|
|
2170
|
+
options: t3,
|
|
1980
2171
|
value: baseLayer,
|
|
1981
2172
|
onValueChange: setBaseLayer,
|
|
1982
2173
|
...props
|
|
1983
2174
|
});
|
|
1984
|
-
$[
|
|
1985
|
-
$[
|
|
1986
|
-
$[
|
|
1987
|
-
$[
|
|
1988
|
-
$[
|
|
1989
|
-
$[
|
|
1990
|
-
|
|
1991
|
-
|
|
2175
|
+
$[25] = baseLayer;
|
|
2176
|
+
$[26] = className;
|
|
2177
|
+
$[27] = props;
|
|
2178
|
+
$[28] = setBaseLayer;
|
|
2179
|
+
$[29] = size;
|
|
2180
|
+
$[30] = t3;
|
|
2181
|
+
$[31] = variant;
|
|
2182
|
+
$[32] = t4;
|
|
2183
|
+
} else t4 = $[32];
|
|
2184
|
+
return t4;
|
|
1992
2185
|
}
|
|
1993
2186
|
/**
|
|
1994
2187
|
* Map components on MapLibre, from `@optimum-intelligence/opti-ui/map`. `Map.Root` holds the map; inside
|
|
@@ -2008,10 +2201,10 @@ function MapBaseLayerSwitch(t0) {
|
|
|
2008
2201
|
* </Map.Overlay>
|
|
2009
2202
|
* </Map.Root>
|
|
2010
2203
|
*/
|
|
2011
|
-
function
|
|
2204
|
+
function _temp16(layer_0) {
|
|
2012
2205
|
return {
|
|
2013
|
-
value:
|
|
2014
|
-
label:
|
|
2206
|
+
value: layer_0.id,
|
|
2207
|
+
label: layer_0.label
|
|
2015
2208
|
};
|
|
2016
2209
|
}
|
|
2017
2210
|
var Map$1 = {
|