@ktnpm_devops/react-component 0.12.1 → 0.13.1
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/README.md +39 -0
- package/dist/constants.d.ts +26 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/geo/GeoMapCard/GeoMapCard.d.ts +7 -0
- package/dist/geo/GeoMapCard/GeoMapCard.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/GeoMapCard.types.d.ts +91 -0
- package/dist/geo/GeoMapCard/GeoMapCard.types.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/MapLegend.d.ts +12 -0
- package/dist/geo/GeoMapCard/MapLegend.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/MapViewport.d.ts +17 -0
- package/dist/geo/GeoMapCard/MapViewport.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/PointListing.d.ts +14 -0
- package/dist/geo/GeoMapCard/PointListing.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/buildMarkerStyle.d.ts +47 -0
- package/dist/geo/GeoMapCard/buildMarkerStyle.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/buildMarkerStyle.test.d.ts +2 -0
- package/dist/geo/GeoMapCard/buildMarkerStyle.test.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/index.d.ts +3 -0
- package/dist/geo/GeoMapCard/index.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/normalizePoints.d.ts +26 -0
- package/dist/geo/GeoMapCard/normalizePoints.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/normalizePoints.test.d.ts +2 -0
- package/dist/geo/GeoMapCard/normalizePoints.test.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/warnMissingLeafletStylesheet.d.ts +13 -0
- package/dist/geo/GeoMapCard/warnMissingLeafletStylesheet.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/warnMissingLeafletStylesheet.test.d.ts +2 -0
- package/dist/geo/GeoMapCard/warnMissingLeafletStylesheet.test.d.ts.map +1 -0
- package/dist/geo/index.d.ts +3 -0
- package/dist/geo/index.d.ts.map +1 -0
- package/dist/hooks/useThemeMode.d.ts +8 -0
- package/dist/hooks/useThemeMode.d.ts.map +1 -0
- package/dist/index.cjs +52 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +52 -48
- package/dist/index.js.map +1 -1
- package/dist/index10.cjs +45 -14
- package/dist/index10.cjs.map +1 -1
- package/dist/index10.js +46 -15
- package/dist/index10.js.map +1 -1
- package/dist/index100.cjs +35 -2
- package/dist/index100.cjs.map +1 -1
- package/dist/index100.js +36 -3
- package/dist/index100.js.map +1 -1
- package/dist/index101.cjs +52 -10
- package/dist/index101.cjs.map +1 -1
- package/dist/index101.js +52 -10
- package/dist/index101.js.map +1 -1
- package/dist/index102.cjs +134 -22
- package/dist/index102.cjs.map +1 -1
- package/dist/index102.js +133 -21
- package/dist/index102.js.map +1 -1
- package/dist/index103.cjs +42 -36
- package/dist/index103.cjs.map +1 -1
- package/dist/index103.js +42 -36
- package/dist/index103.js.map +1 -1
- package/dist/index104.cjs +35 -21
- package/dist/index104.cjs.map +1 -1
- package/dist/index104.js +34 -20
- package/dist/index104.js.map +1 -1
- package/dist/index105.cjs +43 -24
- package/dist/index105.cjs.map +1 -1
- package/dist/index105.js +42 -23
- package/dist/index105.js.map +1 -1
- package/dist/index106.cjs +27 -0
- package/dist/index106.cjs.map +1 -0
- package/dist/index106.js +27 -0
- package/dist/index106.js.map +1 -0
- package/dist/index107.cjs +22 -0
- package/dist/index107.cjs.map +1 -0
- package/dist/index107.js +22 -0
- package/dist/index107.js.map +1 -0
- package/dist/index108.cjs +16 -0
- package/dist/index108.cjs.map +1 -0
- package/dist/index108.js +16 -0
- package/dist/index108.js.map +1 -0
- package/dist/index109.cjs +63 -0
- package/dist/index109.cjs.map +1 -0
- package/dist/index109.js +63 -0
- package/dist/index109.js.map +1 -0
- package/dist/index11.cjs +14 -15
- package/dist/index11.cjs.map +1 -1
- package/dist/index11.js +15 -16
- package/dist/index11.js.map +1 -1
- package/dist/index110.cjs +36 -0
- package/dist/index110.cjs.map +1 -0
- package/dist/index110.js +36 -0
- package/dist/index110.js.map +1 -0
- package/dist/index111.cjs +18 -0
- package/dist/index111.cjs.map +1 -0
- package/dist/index111.js +18 -0
- package/dist/index111.js.map +1 -0
- package/dist/index112.cjs +27 -0
- package/dist/index112.cjs.map +1 -0
- package/dist/index112.js +27 -0
- package/dist/index112.js.map +1 -0
- package/dist/index113.cjs +21 -0
- package/dist/index113.cjs.map +1 -0
- package/dist/index113.js +21 -0
- package/dist/index113.js.map +1 -0
- package/dist/index12.cjs +15 -4
- package/dist/index12.cjs.map +1 -1
- package/dist/index12.js +15 -4
- package/dist/index12.js.map +1 -1
- package/dist/index13.cjs +4 -16
- package/dist/index13.cjs.map +1 -1
- package/dist/index13.js +4 -16
- package/dist/index13.js.map +1 -1
- package/dist/index14.cjs +16 -10
- package/dist/index14.cjs.map +1 -1
- package/dist/index14.js +16 -10
- package/dist/index14.js.map +1 -1
- package/dist/index15.cjs +10 -100
- package/dist/index15.cjs.map +1 -1
- package/dist/index15.js +11 -101
- package/dist/index15.js.map +1 -1
- package/dist/index16.cjs +100 -20
- package/dist/index16.cjs.map +1 -1
- package/dist/index16.js +101 -21
- package/dist/index16.js.map +1 -1
- package/dist/index17.cjs +20 -54
- package/dist/index17.cjs.map +1 -1
- package/dist/index17.js +20 -54
- package/dist/index17.js.map +1 -1
- package/dist/index18.cjs +52 -16
- package/dist/index18.cjs.map +1 -1
- package/dist/index18.js +54 -18
- package/dist/index18.js.map +1 -1
- package/dist/index19.cjs +16 -24
- package/dist/index19.cjs.map +1 -1
- package/dist/index19.js +17 -25
- package/dist/index19.js.map +1 -1
- package/dist/index20.cjs +22 -39
- package/dist/index20.cjs.map +1 -1
- package/dist/index20.js +23 -40
- package/dist/index20.js.map +1 -1
- package/dist/index21.cjs +38 -85
- package/dist/index21.cjs.map +1 -1
- package/dist/index21.js +40 -87
- package/dist/index21.js.map +1 -1
- package/dist/index22.cjs +84 -152
- package/dist/index22.cjs.map +1 -1
- package/dist/index22.js +87 -155
- package/dist/index22.js.map +1 -1
- package/dist/index23.cjs +149 -127
- package/dist/index23.cjs.map +1 -1
- package/dist/index23.js +150 -128
- package/dist/index23.js.map +1 -1
- package/dist/index24.cjs +121 -106
- package/dist/index24.cjs.map +1 -1
- package/dist/index24.js +122 -107
- package/dist/index24.js.map +1 -1
- package/dist/index25.cjs +121 -17
- package/dist/index25.cjs.map +1 -1
- package/dist/index25.js +121 -17
- package/dist/index25.js.map +1 -1
- package/dist/index26.cjs +16 -163
- package/dist/index26.cjs.map +1 -1
- package/dist/index26.js +16 -163
- package/dist/index26.js.map +1 -1
- package/dist/index27.cjs +163 -21
- package/dist/index27.cjs.map +1 -1
- package/dist/index27.js +164 -22
- package/dist/index27.js.map +1 -1
- package/dist/index28.cjs +20 -129
- package/dist/index28.cjs.map +1 -1
- package/dist/index28.js +21 -130
- package/dist/index28.js.map +1 -1
- package/dist/index29.cjs +129 -75
- package/dist/index29.cjs.map +1 -1
- package/dist/index29.js +131 -77
- package/dist/index29.js.map +1 -1
- package/dist/index30.cjs +152 -7
- package/dist/index30.cjs.map +1 -1
- package/dist/index30.js +154 -9
- package/dist/index30.js.map +1 -1
- package/dist/index31.cjs +74 -128
- package/dist/index31.cjs.map +1 -1
- package/dist/index31.js +75 -129
- package/dist/index31.js.map +1 -1
- package/dist/index32.cjs +6 -54
- package/dist/index32.cjs.map +1 -1
- package/dist/index32.js +8 -56
- package/dist/index32.js.map +1 -1
- package/dist/index33.cjs +128 -35
- package/dist/index33.cjs.map +1 -1
- package/dist/index33.js +129 -36
- package/dist/index33.js.map +1 -1
- package/dist/index34.cjs +50 -220
- package/dist/index34.cjs.map +1 -1
- package/dist/index34.js +53 -223
- package/dist/index34.js.map +1 -1
- package/dist/index35.cjs +38 -34
- package/dist/index35.cjs.map +1 -1
- package/dist/index35.js +39 -35
- package/dist/index35.js.map +1 -1
- package/dist/index36.cjs +221 -105
- package/dist/index36.cjs.map +1 -1
- package/dist/index36.js +224 -108
- package/dist/index36.js.map +1 -1
- package/dist/index37.cjs +30 -64
- package/dist/index37.cjs.map +1 -1
- package/dist/index37.js +31 -65
- package/dist/index37.js.map +1 -1
- package/dist/index38.cjs +105 -73
- package/dist/index38.cjs.map +1 -1
- package/dist/index38.js +108 -76
- package/dist/index38.js.map +1 -1
- package/dist/index39.cjs +63 -54
- package/dist/index39.cjs.map +1 -1
- package/dist/index39.js +64 -55
- package/dist/index39.js.map +1 -1
- package/dist/index40.cjs +68 -143
- package/dist/index40.cjs.map +1 -1
- package/dist/index40.js +70 -145
- package/dist/index40.js.map +1 -1
- package/dist/index41.cjs +57 -96
- package/dist/index41.cjs.map +1 -1
- package/dist/index41.js +59 -98
- package/dist/index41.js.map +1 -1
- package/dist/index42.cjs +147 -66
- package/dist/index42.cjs.map +1 -1
- package/dist/index42.js +149 -68
- package/dist/index42.js.map +1 -1
- package/dist/index43.cjs +97 -7
- package/dist/index43.cjs.map +1 -1
- package/dist/index43.js +99 -9
- package/dist/index43.js.map +1 -1
- package/dist/index44.cjs +72 -17
- package/dist/index44.cjs.map +1 -1
- package/dist/index44.js +73 -18
- package/dist/index44.js.map +1 -1
- package/dist/index45.cjs +7 -76
- package/dist/index45.cjs.map +1 -1
- package/dist/index45.js +9 -78
- package/dist/index45.js.map +1 -1
- package/dist/index46.cjs +17 -143
- package/dist/index46.cjs.map +1 -1
- package/dist/index46.js +17 -143
- package/dist/index46.js.map +1 -1
- package/dist/index47.cjs +72 -59
- package/dist/index47.cjs.map +1 -1
- package/dist/index47.js +74 -61
- package/dist/index47.js.map +1 -1
- package/dist/index48.cjs +135 -97
- package/dist/index48.cjs.map +1 -1
- package/dist/index48.js +136 -98
- package/dist/index48.js.map +1 -1
- package/dist/index49.cjs +49 -32
- package/dist/index49.cjs.map +1 -1
- package/dist/index49.js +49 -32
- package/dist/index49.js.map +1 -1
- package/dist/index50.cjs +105 -6
- package/dist/index50.cjs.map +1 -1
- package/dist/index50.js +106 -7
- package/dist/index50.js.map +1 -1
- package/dist/index51.cjs +44 -144
- package/dist/index51.cjs.map +1 -1
- package/dist/index51.js +45 -145
- package/dist/index51.js.map +1 -1
- package/dist/index52.cjs +6 -8
- package/dist/index52.cjs.map +1 -1
- package/dist/index52.js +6 -8
- package/dist/index52.js.map +1 -1
- package/dist/index53.cjs +145 -15
- package/dist/index53.cjs.map +1 -1
- package/dist/index53.js +147 -17
- package/dist/index53.js.map +1 -1
- package/dist/index54.cjs +7 -65
- package/dist/index54.cjs.map +1 -1
- package/dist/index54.js +9 -67
- package/dist/index54.js.map +1 -1
- package/dist/index55.cjs +19 -16
- package/dist/index55.cjs.map +1 -1
- package/dist/index55.js +18 -15
- package/dist/index55.js.map +1 -1
- package/dist/index56.cjs +67 -24
- package/dist/index56.cjs.map +1 -1
- package/dist/index56.js +66 -23
- package/dist/index56.js.map +1 -1
- package/dist/index57.cjs +15 -69
- package/dist/index57.cjs.map +1 -1
- package/dist/index57.js +15 -69
- package/dist/index57.js.map +1 -1
- package/dist/index59.cjs +26 -0
- package/dist/index59.cjs.map +1 -1
- package/dist/index59.js +26 -0
- package/dist/index59.js.map +1 -1
- package/dist/index60.cjs +13 -16
- package/dist/index60.cjs.map +1 -1
- package/dist/index60.js +13 -16
- package/dist/index60.js.map +1 -1
- package/dist/index61.cjs +10 -22
- package/dist/index61.cjs.map +1 -1
- package/dist/index61.js +11 -23
- package/dist/index61.js.map +1 -1
- package/dist/index62.cjs +13 -13
- package/dist/index62.js +13 -13
- package/dist/index63.cjs +20 -14
- package/dist/index63.cjs.map +1 -1
- package/dist/index63.js +20 -14
- package/dist/index63.js.map +1 -1
- package/dist/index64.cjs +34 -13
- package/dist/index64.cjs.map +1 -1
- package/dist/index64.js +34 -13
- package/dist/index64.js.map +1 -1
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +1 -1
- package/dist/index66.cjs +2 -20
- package/dist/index66.cjs.map +1 -1
- package/dist/index66.js +3 -21
- package/dist/index66.js.map +1 -1
- package/dist/index67.cjs +5 -23
- package/dist/index67.cjs.map +1 -1
- package/dist/index67.js +6 -24
- package/dist/index67.js.map +1 -1
- package/dist/index68.cjs +19 -19
- package/dist/index68.js +20 -20
- package/dist/index69.cjs +20 -5
- package/dist/index69.cjs.map +1 -1
- package/dist/index69.js +21 -6
- package/dist/index69.js.map +1 -1
- package/dist/index7.cjs +32 -64
- package/dist/index7.cjs.map +1 -1
- package/dist/index7.js +32 -64
- package/dist/index7.js.map +1 -1
- package/dist/index70.cjs +15 -15
- package/dist/index70.js +15 -15
- package/dist/index71.cjs +13 -28
- package/dist/index71.cjs.map +1 -1
- package/dist/index71.js +14 -29
- package/dist/index71.js.map +1 -1
- package/dist/index72.cjs +2 -20
- package/dist/index72.cjs.map +1 -1
- package/dist/index72.js +2 -20
- package/dist/index72.js.map +1 -1
- package/dist/index73.cjs +30 -3
- package/dist/index73.cjs.map +1 -1
- package/dist/index73.js +30 -3
- package/dist/index73.js.map +1 -1
- package/dist/index74.cjs +36 -3
- package/dist/index74.cjs.map +1 -1
- package/dist/index74.js +36 -3
- package/dist/index74.js.map +1 -1
- package/dist/index75.cjs +34 -13
- package/dist/index75.cjs.map +1 -1
- package/dist/index75.js +35 -14
- package/dist/index75.js.map +1 -1
- package/dist/index76.cjs +22 -13
- package/dist/index76.cjs.map +1 -1
- package/dist/index76.js +23 -14
- package/dist/index76.js.map +1 -1
- package/dist/index77.cjs +3 -30
- package/dist/index77.cjs.map +1 -1
- package/dist/index77.js +3 -30
- package/dist/index77.js.map +1 -1
- package/dist/index78.cjs +16 -10
- package/dist/index78.cjs.map +1 -1
- package/dist/index78.js +16 -10
- package/dist/index78.js.map +1 -1
- package/dist/index79.cjs +10 -34
- package/dist/index79.cjs.map +1 -1
- package/dist/index79.js +11 -35
- package/dist/index79.js.map +1 -1
- package/dist/index8.cjs +58 -75
- package/dist/index8.cjs.map +1 -1
- package/dist/index8.js +58 -75
- package/dist/index8.js.map +1 -1
- package/dist/index80.cjs +64 -10
- package/dist/index80.cjs.map +1 -1
- package/dist/index80.js +65 -11
- package/dist/index80.js.map +1 -1
- package/dist/index81.cjs +16 -4
- package/dist/index81.cjs.map +1 -1
- package/dist/index81.js +17 -5
- package/dist/index81.js.map +1 -1
- package/dist/index82.cjs +52 -134
- package/dist/index82.cjs.map +1 -1
- package/dist/index82.js +51 -133
- package/dist/index82.js.map +1 -1
- package/dist/index83.cjs +50 -38
- package/dist/index83.cjs.map +1 -1
- package/dist/index83.js +50 -38
- package/dist/index83.js.map +1 -1
- package/dist/index84.cjs +16 -76
- package/dist/index84.cjs.map +1 -1
- package/dist/index84.js +16 -76
- package/dist/index84.js.map +1 -1
- package/dist/index85.cjs +20 -2
- package/dist/index85.cjs.map +1 -1
- package/dist/index85.js +20 -2
- package/dist/index85.js.map +1 -1
- package/dist/index86.cjs +77 -44
- package/dist/index86.cjs.map +1 -1
- package/dist/index86.js +78 -45
- package/dist/index86.js.map +1 -1
- package/dist/index87.cjs +2 -53
- package/dist/index87.cjs.map +1 -1
- package/dist/index87.js +3 -54
- package/dist/index87.js.map +1 -1
- package/dist/index88.cjs +15 -36
- package/dist/index88.cjs.map +1 -1
- package/dist/index88.js +16 -37
- package/dist/index88.js.map +1 -1
- package/dist/index89.cjs +26 -14
- package/dist/index89.cjs.map +1 -1
- package/dist/index89.js +26 -14
- package/dist/index89.js.map +1 -1
- package/dist/index9.cjs +81 -45
- package/dist/index9.cjs.map +1 -1
- package/dist/index9.js +81 -45
- package/dist/index9.js.map +1 -1
- package/dist/index90.cjs +22 -116
- package/dist/index90.cjs.map +1 -1
- package/dist/index90.js +21 -115
- package/dist/index90.js.map +1 -1
- package/dist/index91.cjs +116 -43
- package/dist/index91.cjs.map +1 -1
- package/dist/index91.js +115 -42
- package/dist/index91.js.map +1 -1
- package/dist/index92.cjs +35 -32
- package/dist/index92.cjs.map +1 -1
- package/dist/index92.js +35 -32
- package/dist/index92.js.map +1 -1
- package/dist/index93.cjs +26 -17
- package/dist/index93.cjs.map +1 -1
- package/dist/index93.js +27 -18
- package/dist/index93.js.map +1 -1
- package/dist/index94.cjs +9 -39
- package/dist/index94.cjs.map +1 -1
- package/dist/index94.js +8 -38
- package/dist/index94.js.map +1 -1
- package/dist/index95.cjs +21 -92
- package/dist/index95.cjs.map +1 -1
- package/dist/index95.js +20 -91
- package/dist/index95.js.map +1 -1
- package/dist/index96.cjs +47 -32
- package/dist/index96.cjs.map +1 -1
- package/dist/index96.js +47 -32
- package/dist/index96.js.map +1 -1
- package/dist/index97.cjs +25 -49
- package/dist/index97.cjs.map +1 -1
- package/dist/index97.js +25 -49
- package/dist/index97.js.map +1 -1
- package/dist/index98.cjs +39 -30
- package/dist/index98.cjs.map +1 -1
- package/dist/index98.js +38 -29
- package/dist/index98.js.map +1 -1
- package/dist/index99.cjs +92 -57
- package/dist/index99.cjs.map +1 -1
- package/dist/index99.js +91 -56
- package/dist/index99.js.map +1 -1
- package/dist/style.css +207 -0
- package/dist/types/geo.types.d.ts +45 -0
- package/dist/types/geo.types.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +16 -2
package/dist/index30.cjs
CHANGED
|
@@ -2,11 +2,156 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const reactLeaflet = require("react-leaflet");
|
|
6
|
+
const clsx = require("./index57.cjs");
|
|
7
|
+
const useThemeMode = require("./index7.cjs");
|
|
8
|
+
const constants = require("./index59.cjs");
|
|
9
|
+
const normalizePoints = require("./index104.cjs");
|
|
10
|
+
const buildMarkerStyle = require("./index105.cjs");
|
|
11
|
+
const MapViewport = require("./index106.cjs");
|
|
12
|
+
const MapLegend = require("./index107.cjs");
|
|
13
|
+
const PointListing = require("./index108.cjs");
|
|
14
|
+
const GeoMapCard_module = require("./index109.cjs");
|
|
15
|
+
const EmptyState = require("./index28.cjs");
|
|
16
|
+
const buildNotice = (info, maxPoints) => {
|
|
17
|
+
const reasons = [];
|
|
18
|
+
if (info.skipped > 0) reasons.push(`${info.skipped} without usable coordinates`);
|
|
19
|
+
if (info.dropped > 0) reasons.push(`${info.dropped} over the ${maxPoints} marker cap`);
|
|
20
|
+
if (reasons.length === 0) return null;
|
|
21
|
+
return `Showing ${info.drawn} of ${info.total} points (${reasons.join(", ")}).`;
|
|
22
|
+
};
|
|
23
|
+
const describePoint = (point, categoryLabel) => [point.label, point.category != null ? `${categoryLabel}: ${point.category}` : null, point.detail].filter((part) => part != null && part !== "").join(" — ");
|
|
24
|
+
const GeoMapCard = ({
|
|
25
|
+
title,
|
|
26
|
+
points,
|
|
27
|
+
selectedIds,
|
|
28
|
+
onSelectPoint,
|
|
29
|
+
categoryLabel = "Category",
|
|
30
|
+
legendTitle = "Legend",
|
|
31
|
+
hideLegend = false,
|
|
32
|
+
maxPoints = constants.GEO_MAP.MAX_POINTS,
|
|
33
|
+
onRender,
|
|
34
|
+
fitBounds = true,
|
|
35
|
+
center,
|
|
36
|
+
zoom,
|
|
37
|
+
scrollWheelZoom = false,
|
|
38
|
+
basemap = "auto",
|
|
39
|
+
tileLayer,
|
|
40
|
+
compact = false,
|
|
41
|
+
toolbar,
|
|
42
|
+
actions,
|
|
43
|
+
isLoading = false,
|
|
44
|
+
error = null,
|
|
45
|
+
onRetry,
|
|
46
|
+
emptyTitle = "No mappable points",
|
|
47
|
+
emptyDescription = "None of the points received carry usable coordinates.",
|
|
48
|
+
retryLabel = "Retry",
|
|
49
|
+
loadingLabel = "Loading map...",
|
|
50
|
+
pointListLabel = "Map points",
|
|
51
|
+
className
|
|
52
|
+
}) => {
|
|
53
|
+
const theme = useThemeMode.useThemeMode();
|
|
54
|
+
const containerRef = react.useRef(null);
|
|
55
|
+
const { drawn, bounds, info } = react.useMemo(
|
|
56
|
+
() => normalizePoints.normalizePoints(points, maxPoints),
|
|
57
|
+
[points, maxPoints]
|
|
58
|
+
);
|
|
59
|
+
const categoryColors = react.useMemo(() => buildMarkerStyle.buildCategoryColors(points), [points]);
|
|
60
|
+
const legendItems = react.useMemo(() => buildMarkerStyle.buildLegendItems(categoryColors), [categoryColors]);
|
|
61
|
+
const markers = react.useMemo(() => {
|
|
62
|
+
const weightScale = buildMarkerStyle.buildWeightScale(points);
|
|
63
|
+
const selection = new Set(selectedIds ?? []);
|
|
64
|
+
return drawn.map(({ point, sourceIndex }) => {
|
|
65
|
+
const selected = selection.has(point.id);
|
|
66
|
+
return {
|
|
67
|
+
point,
|
|
68
|
+
sourceIndex,
|
|
69
|
+
selected,
|
|
70
|
+
style: buildMarkerStyle.buildMarkerStyle(point, { categoryColors, weightScale, selected, theme }),
|
|
71
|
+
description: describePoint(point, categoryLabel)
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
}, [drawn, points, selectedIds, categoryColors, theme, categoryLabel]);
|
|
75
|
+
const tiles = tileLayer ?? {
|
|
76
|
+
url: constants.BASEMAP_TILES[basemap === "auto" ? theme : basemap],
|
|
77
|
+
attribution: constants.BASEMAP_TILES.attribution
|
|
78
|
+
};
|
|
79
|
+
const shouldFitBounds = fitBounds && center == null && zoom == null;
|
|
80
|
+
const showLegend = !hideLegend && legendItems.length > 0;
|
|
81
|
+
const notice = buildNotice(info, maxPoints);
|
|
82
|
+
const hasMap = !isLoading && error == null && info.drawn > 0;
|
|
83
|
+
react.useEffect(() => {
|
|
84
|
+
onRender == null ? void 0 : onRender(info);
|
|
85
|
+
}, [onRender, info]);
|
|
86
|
+
react.useEffect(() => {
|
|
87
|
+
}, [hasMap]);
|
|
88
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx(GeoMapCard_module.default.root, compact && GeoMapCard_module.default.compact, className), children: [
|
|
89
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: GeoMapCard_module.default.header, children: [
|
|
90
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: GeoMapCard_module.default.title, children: title }),
|
|
91
|
+
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: GeoMapCard_module.default.headerActions, children: actions })
|
|
92
|
+
] }),
|
|
93
|
+
toolbar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: GeoMapCard_module.default.toolbar, children: toolbar }),
|
|
94
|
+
hasMap && notice && /* @__PURE__ */ jsxRuntime.jsx("div", { className: GeoMapCard_module.default.warning, role: "status", children: notice }),
|
|
95
|
+
isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: GeoMapCard_module.default.loading, children: loadingLabel }),
|
|
96
|
+
!isLoading && error != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: GeoMapCard_module.default.error, children: [
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: error }),
|
|
98
|
+
onRetry && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: GeoMapCard_module.default.retryButton, onClick: onRetry, children: retryLabel })
|
|
99
|
+
] }),
|
|
100
|
+
!isLoading && error == null && info.drawn === 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
101
|
+
EmptyState.EmptyState,
|
|
102
|
+
{
|
|
103
|
+
className: GeoMapCard_module.default.empty,
|
|
104
|
+
variant: "plain",
|
|
105
|
+
title: emptyTitle,
|
|
106
|
+
description: emptyDescription
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
hasMap && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
ref: containerRef,
|
|
113
|
+
className: GeoMapCard_module.default.mapContainer,
|
|
114
|
+
role: "figure",
|
|
115
|
+
"aria-label": `${title}: map of ${info.drawn} points`,
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
118
|
+
reactLeaflet.MapContainer,
|
|
119
|
+
{
|
|
120
|
+
className: GeoMapCard_module.default.map,
|
|
121
|
+
center: center ?? [...constants.GEO_MAP.DEFAULT_CENTER],
|
|
122
|
+
zoom: zoom ?? constants.GEO_MAP.DEFAULT_ZOOM,
|
|
123
|
+
scrollWheelZoom,
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactLeaflet.TileLayer, { url: tiles.url, attribution: tiles.attribution }, tiles.url),
|
|
126
|
+
/* @__PURE__ */ jsxRuntime.jsx(MapViewport.MapViewport, { bounds, fitBounds: shouldFitBounds }),
|
|
127
|
+
markers.map(({ point, sourceIndex, style, description }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
128
|
+
reactLeaflet.CircleMarker,
|
|
129
|
+
{
|
|
130
|
+
center: [point.latitude, point.longitude],
|
|
131
|
+
radius: style.radius,
|
|
132
|
+
pathOptions: style,
|
|
133
|
+
eventHandlers: onSelectPoint ? { click: () => onSelectPoint({ point, index: sourceIndex }) } : {},
|
|
134
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactLeaflet.Tooltip, { children: description })
|
|
135
|
+
},
|
|
136
|
+
point.id
|
|
137
|
+
)),
|
|
138
|
+
showLegend && /* @__PURE__ */ jsxRuntime.jsx(MapLegend.MapLegend, { items: legendItems, title: legendTitle })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
143
|
+
PointListing.PointListing,
|
|
144
|
+
{
|
|
145
|
+
markers,
|
|
146
|
+
label: pointListLabel,
|
|
147
|
+
onSelectPoint
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
] });
|
|
154
|
+
};
|
|
155
|
+
GeoMapCard.displayName = "GeoMapCard";
|
|
156
|
+
exports.GeoMapCard = GeoMapCard;
|
|
12
157
|
//# sourceMappingURL=index30.cjs.map
|
package/dist/index30.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index30.cjs","sources":["../src/primitives/Input/Input.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport clsx from 'clsx';\nimport styles from './Input.module.css';\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(\n ({ className, type = 'text', ...props }, ref) => (\n <input ref={ref} type={type} className={clsx(styles.root, className)} {...props} />\n ),\n);\n\nInput.displayName = 'Input';\n"],"names":["forwardRef","jsx","clsx","styles"],"mappings":";;;;;;AAMO,MAAM,QAAQA,MAAAA;AAAAA,EACnB,CAAC,EAAE,WAAW,OAAO,QAAQ,GAAG,SAAS,QACvCC,2BAAAA,IAAC,WAAM,KAAU,MAAY,WAAWC,UAAKC,aAAAA,QAAO,MAAM,SAAS,GAAI,GAAG,MAAA,CAAO;AAErF;AAEA,MAAM,cAAc;;"}
|
|
1
|
+
{"version":3,"file":"index30.cjs","sources":["../src/geo/GeoMapCard/GeoMapCard.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport { CircleMarker, MapContainer, TileLayer, Tooltip } from 'react-leaflet';\nimport clsx from 'clsx';\nimport { EmptyState } from '../../primitives/EmptyState';\nimport { useThemeMode } from '../../hooks/useThemeMode';\nimport { BASEMAP_TILES, GEO_MAP } from '../../constants';\nimport type { GeoPoint, GeoRenderInfo } from '../../types/geo.types';\nimport type { GeoMapCardProps, MarkerDescriptor } from './GeoMapCard.types';\nimport { normalizePoints } from './normalizePoints';\nimport { buildCategoryColors, buildLegendItems, buildMarkerStyle, buildWeightScale } from './buildMarkerStyle';\nimport { MapViewport } from './MapViewport';\nimport { MapLegend } from './MapLegend';\nimport { PointListing } from './PointListing';\nimport { warnMissingLeafletStylesheet } from './warnMissingLeafletStylesheet';\nimport styles from './GeoMapCard.module.css';\n\n/** States what was left out, so a truncated map never passes for a complete one. */\nconst buildNotice = (info: GeoRenderInfo, maxPoints: number): string | null => {\n const reasons: string[] = [];\n\n if (info.skipped > 0) reasons.push(`${info.skipped} without usable coordinates`);\n if (info.dropped > 0) reasons.push(`${info.dropped} over the ${maxPoints} marker cap`);\n\n if (reasons.length === 0) return null;\n\n return `Showing ${info.drawn} of ${info.total} points (${reasons.join(', ')}).`;\n};\n\n/** One line carrying everything the tooltip shows, for the screen reader too. */\nconst describePoint = (point: GeoPoint, categoryLabel: string): string =>\n [point.label, point.category != null ? `${categoryLabel}: ${point.category}` : null, point.detail]\n .filter((part): part is string => part != null && part !== '')\n .join(' — ');\n\nexport const GeoMapCard = ({\n title,\n points,\n selectedIds,\n onSelectPoint,\n categoryLabel = 'Category',\n legendTitle = 'Legend',\n hideLegend = false,\n maxPoints = GEO_MAP.MAX_POINTS,\n onRender,\n fitBounds = true,\n center,\n zoom,\n scrollWheelZoom = false,\n basemap = 'auto',\n tileLayer,\n compact = false,\n toolbar,\n actions,\n isLoading = false,\n error = null,\n onRetry,\n emptyTitle = 'No mappable points',\n emptyDescription = 'None of the points received carry usable coordinates.',\n retryLabel = 'Retry',\n loadingLabel = 'Loading map...',\n pointListLabel = 'Map points',\n className,\n}: GeoMapCardProps) => {\n const theme = useThemeMode();\n const containerRef = useRef<HTMLDivElement>(null);\n\n const { drawn, bounds, info } = useMemo(\n () => normalizePoints(points, maxPoints),\n [points, maxPoints],\n );\n\n const categoryColors = useMemo(() => buildCategoryColors(points), [points]);\n const legendItems = useMemo(() => buildLegendItems(categoryColors), [categoryColors]);\n\n const markers = useMemo<MarkerDescriptor[]>(() => {\n const weightScale = buildWeightScale(points);\n const selection = new Set(selectedIds ?? []);\n\n return drawn.map(({ point, sourceIndex }) => {\n const selected = selection.has(point.id);\n\n return {\n point,\n sourceIndex,\n selected,\n style: buildMarkerStyle(point, { categoryColors, weightScale, selected, theme }),\n description: describePoint(point, categoryLabel),\n };\n });\n }, [drawn, points, selectedIds, categoryColors, theme, categoryLabel]);\n\n const tiles = tileLayer ?? {\n url: BASEMAP_TILES[basemap === 'auto' ? theme : basemap],\n attribution: BASEMAP_TILES.attribution,\n };\n\n // Manual framing and automatic framing would fight over the viewport.\n const shouldFitBounds = fitBounds && center == null && zoom == null;\n const showLegend = !hideLegend && legendItems.length > 0;\n const notice = buildNotice(info, maxPoints);\n const hasMap = !isLoading && error == null && info.drawn > 0;\n\n useEffect(() => {\n onRender?.(info);\n }, [onRender, info]);\n\n useEffect(() => {\n if (import.meta.env.DEV && hasMap) warnMissingLeafletStylesheet(containerRef.current);\n }, [hasMap]);\n\n return (\n <div className={clsx(styles.root, compact && styles.compact, className)}>\n <header className={styles.header}>\n <h3 className={styles.title}>{title}</h3>\n {actions && <div className={styles.headerActions}>{actions}</div>}\n </header>\n\n {toolbar && <div className={styles.toolbar}>{toolbar}</div>}\n\n {hasMap && notice && (\n <div className={styles.warning} role=\"status\">\n {notice}\n </div>\n )}\n\n {isLoading && <div className={styles.loading}>{loadingLabel}</div>}\n\n {!isLoading && error != null && (\n <div className={styles.error}>\n <span>{error}</span>\n {onRetry && (\n <button type=\"button\" className={styles.retryButton} onClick={onRetry}>\n {retryLabel}\n </button>\n )}\n </div>\n )}\n\n {!isLoading && error == null && info.drawn === 0 && (\n <EmptyState\n className={styles.empty}\n variant=\"plain\"\n title={emptyTitle}\n description={emptyDescription}\n />\n )}\n\n {hasMap && (\n <div\n ref={containerRef}\n className={styles.mapContainer}\n role=\"figure\"\n aria-label={`${title}: map of ${info.drawn} points`}\n >\n <MapContainer\n className={styles.map}\n center={center ?? [...GEO_MAP.DEFAULT_CENTER]}\n zoom={zoom ?? GEO_MAP.DEFAULT_ZOOM}\n scrollWheelZoom={scrollWheelZoom}\n >\n <TileLayer key={tiles.url} url={tiles.url} attribution={tiles.attribution} />\n <MapViewport bounds={bounds} fitBounds={shouldFitBounds} />\n\n {markers.map(({ point, sourceIndex, style, description }) => (\n <CircleMarker\n key={point.id}\n center={[point.latitude, point.longitude]}\n radius={style.radius}\n pathOptions={style}\n eventHandlers={\n onSelectPoint ? { click: () => onSelectPoint({ point, index: sourceIndex }) } : {}\n }\n >\n <Tooltip>{description}</Tooltip>\n </CircleMarker>\n ))}\n\n {showLegend && <MapLegend items={legendItems} title={legendTitle} />}\n </MapContainer>\n\n <PointListing\n markers={markers}\n label={pointListLabel}\n onSelectPoint={onSelectPoint}\n />\n </div>\n )}\n </div>\n );\n};\n\nGeoMapCard.displayName = 'GeoMapCard';\n"],"names":["GEO_MAP","useThemeMode","useRef","useMemo","normalizePoints","buildCategoryColors","buildLegendItems","buildWeightScale","buildMarkerStyle","BASEMAP_TILES","useEffect","jsxs","clsx","styles","jsx","EmptyState","MapContainer","TileLayer","MapViewport","CircleMarker","Tooltip","MapLegend","PointListing"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAM,cAAc,CAAC,MAAqB,cAAqC;AAC7E,QAAM,UAAoB,CAAA;AAE1B,MAAI,KAAK,UAAU,EAAG,SAAQ,KAAK,GAAG,KAAK,OAAO,6BAA6B;AAC/E,MAAI,KAAK,UAAU,EAAG,SAAQ,KAAK,GAAG,KAAK,OAAO,aAAa,SAAS,aAAa;AAErF,MAAI,QAAQ,WAAW,EAAG,QAAO;AAEjC,SAAO,WAAW,KAAK,KAAK,OAAO,KAAK,KAAK,YAAY,QAAQ,KAAK,IAAI,CAAC;AAC7E;AAGA,MAAM,gBAAgB,CAAC,OAAiB,kBACtC,CAAC,MAAM,OAAO,MAAM,YAAY,OAAO,GAAG,aAAa,KAAK,MAAM,QAAQ,KAAK,MAAM,MAAM,MAAM,EAC9F,OAAO,CAAC,SAAyB,QAAQ,QAAQ,SAAS,EAAE,EAC5D,KAAK,KAAK;AAER,MAAM,aAAa,CAAC;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,YAAYA,UAAAA,QAAQ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AeC,qBAAA,EAAU,OAAO,aAAa,OAAO,aAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGpEP,2BAAAA;AAAAA,YAACQ,aAAAA;AAAAA,YAAA;AAAA,cACC;AAAA,cACA,OAAO;AAAA,cACP;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GAEJ;AAEJ;AAEA,WAAW,cAAc;;"}
|
package/dist/index30.js
CHANGED
|
@@ -1,12 +1,157 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useMemo, useEffect } from "react";
|
|
3
|
+
import { MapContainer, TileLayer, CircleMarker, Tooltip } from "react-leaflet";
|
|
4
|
+
import { clsx } from "./index57.js";
|
|
5
|
+
import { useThemeMode } from "./index7.js";
|
|
6
|
+
import { GEO_MAP, BASEMAP_TILES } from "./index59.js";
|
|
7
|
+
import { normalizePoints } from "./index104.js";
|
|
8
|
+
import { buildCategoryColors, buildLegendItems, buildWeightScale, buildMarkerStyle } from "./index105.js";
|
|
9
|
+
import { MapViewport } from "./index106.js";
|
|
10
|
+
import { MapLegend } from "./index107.js";
|
|
11
|
+
import { PointListing } from "./index108.js";
|
|
12
|
+
import styles from "./index109.js";
|
|
13
|
+
import { EmptyState } from "./index28.js";
|
|
14
|
+
const buildNotice = (info, maxPoints) => {
|
|
15
|
+
const reasons = [];
|
|
16
|
+
if (info.skipped > 0) reasons.push(`${info.skipped} without usable coordinates`);
|
|
17
|
+
if (info.dropped > 0) reasons.push(`${info.dropped} over the ${maxPoints} marker cap`);
|
|
18
|
+
if (reasons.length === 0) return null;
|
|
19
|
+
return `Showing ${info.drawn} of ${info.total} points (${reasons.join(", ")}).`;
|
|
20
|
+
};
|
|
21
|
+
const describePoint = (point, categoryLabel) => [point.label, point.category != null ? `${categoryLabel}: ${point.category}` : null, point.detail].filter((part) => part != null && part !== "").join(" — ");
|
|
22
|
+
const GeoMapCard = ({
|
|
23
|
+
title,
|
|
24
|
+
points,
|
|
25
|
+
selectedIds,
|
|
26
|
+
onSelectPoint,
|
|
27
|
+
categoryLabel = "Category",
|
|
28
|
+
legendTitle = "Legend",
|
|
29
|
+
hideLegend = false,
|
|
30
|
+
maxPoints = GEO_MAP.MAX_POINTS,
|
|
31
|
+
onRender,
|
|
32
|
+
fitBounds = true,
|
|
33
|
+
center,
|
|
34
|
+
zoom,
|
|
35
|
+
scrollWheelZoom = false,
|
|
36
|
+
basemap = "auto",
|
|
37
|
+
tileLayer,
|
|
38
|
+
compact = false,
|
|
39
|
+
toolbar,
|
|
40
|
+
actions,
|
|
41
|
+
isLoading = false,
|
|
42
|
+
error = null,
|
|
43
|
+
onRetry,
|
|
44
|
+
emptyTitle = "No mappable points",
|
|
45
|
+
emptyDescription = "None of the points received carry usable coordinates.",
|
|
46
|
+
retryLabel = "Retry",
|
|
47
|
+
loadingLabel = "Loading map...",
|
|
48
|
+
pointListLabel = "Map points",
|
|
49
|
+
className
|
|
50
|
+
}) => {
|
|
51
|
+
const theme = useThemeMode();
|
|
52
|
+
const containerRef = useRef(null);
|
|
53
|
+
const { drawn, bounds, info } = useMemo(
|
|
54
|
+
() => normalizePoints(points, maxPoints),
|
|
55
|
+
[points, maxPoints]
|
|
56
|
+
);
|
|
57
|
+
const categoryColors = useMemo(() => buildCategoryColors(points), [points]);
|
|
58
|
+
const legendItems = useMemo(() => buildLegendItems(categoryColors), [categoryColors]);
|
|
59
|
+
const markers = useMemo(() => {
|
|
60
|
+
const weightScale = buildWeightScale(points);
|
|
61
|
+
const selection = new Set(selectedIds ?? []);
|
|
62
|
+
return drawn.map(({ point, sourceIndex }) => {
|
|
63
|
+
const selected = selection.has(point.id);
|
|
64
|
+
return {
|
|
65
|
+
point,
|
|
66
|
+
sourceIndex,
|
|
67
|
+
selected,
|
|
68
|
+
style: buildMarkerStyle(point, { categoryColors, weightScale, selected, theme }),
|
|
69
|
+
description: describePoint(point, categoryLabel)
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
}, [drawn, points, selectedIds, categoryColors, theme, categoryLabel]);
|
|
73
|
+
const tiles = tileLayer ?? {
|
|
74
|
+
url: BASEMAP_TILES[basemap === "auto" ? theme : basemap],
|
|
75
|
+
attribution: BASEMAP_TILES.attribution
|
|
76
|
+
};
|
|
77
|
+
const shouldFitBounds = fitBounds && center == null && zoom == null;
|
|
78
|
+
const showLegend = !hideLegend && legendItems.length > 0;
|
|
79
|
+
const notice = buildNotice(info, maxPoints);
|
|
80
|
+
const hasMap = !isLoading && error == null && info.drawn > 0;
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
onRender == null ? void 0 : onRender(info);
|
|
83
|
+
}, [onRender, info]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
}, [hasMap]);
|
|
86
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx(styles.root, compact && styles.compact, className), children: [
|
|
87
|
+
/* @__PURE__ */ jsxs("header", { className: styles.header, children: [
|
|
88
|
+
/* @__PURE__ */ jsx("h3", { className: styles.title, children: title }),
|
|
89
|
+
actions && /* @__PURE__ */ jsx("div", { className: styles.headerActions, children: actions })
|
|
90
|
+
] }),
|
|
91
|
+
toolbar && /* @__PURE__ */ jsx("div", { className: styles.toolbar, children: toolbar }),
|
|
92
|
+
hasMap && notice && /* @__PURE__ */ jsx("div", { className: styles.warning, role: "status", children: notice }),
|
|
93
|
+
isLoading && /* @__PURE__ */ jsx("div", { className: styles.loading, children: loadingLabel }),
|
|
94
|
+
!isLoading && error != null && /* @__PURE__ */ jsxs("div", { className: styles.error, children: [
|
|
95
|
+
/* @__PURE__ */ jsx("span", { children: error }),
|
|
96
|
+
onRetry && /* @__PURE__ */ jsx("button", { type: "button", className: styles.retryButton, onClick: onRetry, children: retryLabel })
|
|
97
|
+
] }),
|
|
98
|
+
!isLoading && error == null && info.drawn === 0 && /* @__PURE__ */ jsx(
|
|
99
|
+
EmptyState,
|
|
100
|
+
{
|
|
101
|
+
className: styles.empty,
|
|
102
|
+
variant: "plain",
|
|
103
|
+
title: emptyTitle,
|
|
104
|
+
description: emptyDescription
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
hasMap && /* @__PURE__ */ jsxs(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
ref: containerRef,
|
|
111
|
+
className: styles.mapContainer,
|
|
112
|
+
role: "figure",
|
|
113
|
+
"aria-label": `${title}: map of ${info.drawn} points`,
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ jsxs(
|
|
116
|
+
MapContainer,
|
|
117
|
+
{
|
|
118
|
+
className: styles.map,
|
|
119
|
+
center: center ?? [...GEO_MAP.DEFAULT_CENTER],
|
|
120
|
+
zoom: zoom ?? GEO_MAP.DEFAULT_ZOOM,
|
|
121
|
+
scrollWheelZoom,
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsx(TileLayer, { url: tiles.url, attribution: tiles.attribution }, tiles.url),
|
|
124
|
+
/* @__PURE__ */ jsx(MapViewport, { bounds, fitBounds: shouldFitBounds }),
|
|
125
|
+
markers.map(({ point, sourceIndex, style, description }) => /* @__PURE__ */ jsx(
|
|
126
|
+
CircleMarker,
|
|
127
|
+
{
|
|
128
|
+
center: [point.latitude, point.longitude],
|
|
129
|
+
radius: style.radius,
|
|
130
|
+
pathOptions: style,
|
|
131
|
+
eventHandlers: onSelectPoint ? { click: () => onSelectPoint({ point, index: sourceIndex }) } : {},
|
|
132
|
+
children: /* @__PURE__ */ jsx(Tooltip, { children: description })
|
|
133
|
+
},
|
|
134
|
+
point.id
|
|
135
|
+
)),
|
|
136
|
+
showLegend && /* @__PURE__ */ jsx(MapLegend, { items: legendItems, title: legendTitle })
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ jsx(
|
|
141
|
+
PointListing,
|
|
142
|
+
{
|
|
143
|
+
markers,
|
|
144
|
+
label: pointListLabel,
|
|
145
|
+
onSelectPoint
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
] });
|
|
152
|
+
};
|
|
153
|
+
GeoMapCard.displayName = "GeoMapCard";
|
|
9
154
|
export {
|
|
10
|
-
|
|
155
|
+
GeoMapCard
|
|
11
156
|
};
|
|
12
157
|
//# sourceMappingURL=index30.js.map
|
package/dist/index30.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index30.js","sources":["../src/primitives/Input/Input.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport clsx from 'clsx';\nimport styles from './Input.module.css';\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(\n ({ className, type = 'text', ...props }, ref) => (\n <input ref={ref} type={type} className={clsx(styles.root, className)} {...props} />\n ),\n);\n\nInput.displayName = 'Input';\n"],"names":[],"mappings":";;;;AAMO,MAAM,QAAQ;AAAA,EACnB,CAAC,EAAE,WAAW,OAAO,QAAQ,GAAG,SAAS,QACvC,oBAAC,WAAM,KAAU,MAAY,WAAW,KAAK,OAAO,MAAM,SAAS,GAAI,GAAG,MAAA,CAAO;AAErF;AAEA,MAAM,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index30.js","sources":["../src/geo/GeoMapCard/GeoMapCard.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport { CircleMarker, MapContainer, TileLayer, Tooltip } from 'react-leaflet';\nimport clsx from 'clsx';\nimport { EmptyState } from '../../primitives/EmptyState';\nimport { useThemeMode } from '../../hooks/useThemeMode';\nimport { BASEMAP_TILES, GEO_MAP } from '../../constants';\nimport type { GeoPoint, GeoRenderInfo } from '../../types/geo.types';\nimport type { GeoMapCardProps, MarkerDescriptor } from './GeoMapCard.types';\nimport { normalizePoints } from './normalizePoints';\nimport { buildCategoryColors, buildLegendItems, buildMarkerStyle, buildWeightScale } from './buildMarkerStyle';\nimport { MapViewport } from './MapViewport';\nimport { MapLegend } from './MapLegend';\nimport { PointListing } from './PointListing';\nimport { warnMissingLeafletStylesheet } from './warnMissingLeafletStylesheet';\nimport styles from './GeoMapCard.module.css';\n\n/** States what was left out, so a truncated map never passes for a complete one. */\nconst buildNotice = (info: GeoRenderInfo, maxPoints: number): string | null => {\n const reasons: string[] = [];\n\n if (info.skipped > 0) reasons.push(`${info.skipped} without usable coordinates`);\n if (info.dropped > 0) reasons.push(`${info.dropped} over the ${maxPoints} marker cap`);\n\n if (reasons.length === 0) return null;\n\n return `Showing ${info.drawn} of ${info.total} points (${reasons.join(', ')}).`;\n};\n\n/** One line carrying everything the tooltip shows, for the screen reader too. */\nconst describePoint = (point: GeoPoint, categoryLabel: string): string =>\n [point.label, point.category != null ? `${categoryLabel}: ${point.category}` : null, point.detail]\n .filter((part): part is string => part != null && part !== '')\n .join(' — ');\n\nexport const GeoMapCard = ({\n title,\n points,\n selectedIds,\n onSelectPoint,\n categoryLabel = 'Category',\n legendTitle = 'Legend',\n hideLegend = false,\n maxPoints = GEO_MAP.MAX_POINTS,\n onRender,\n fitBounds = true,\n center,\n zoom,\n scrollWheelZoom = false,\n basemap = 'auto',\n tileLayer,\n compact = false,\n toolbar,\n actions,\n isLoading = false,\n error = null,\n onRetry,\n emptyTitle = 'No mappable points',\n emptyDescription = 'None of the points received carry usable coordinates.',\n retryLabel = 'Retry',\n loadingLabel = 'Loading map...',\n pointListLabel = 'Map points',\n className,\n}: GeoMapCardProps) => {\n const theme = useThemeMode();\n const containerRef = useRef<HTMLDivElement>(null);\n\n const { drawn, bounds, info } = useMemo(\n () => normalizePoints(points, maxPoints),\n [points, maxPoints],\n );\n\n const categoryColors = useMemo(() => buildCategoryColors(points), [points]);\n const legendItems = useMemo(() => buildLegendItems(categoryColors), [categoryColors]);\n\n const markers = useMemo<MarkerDescriptor[]>(() => {\n const weightScale = buildWeightScale(points);\n const selection = new Set(selectedIds ?? []);\n\n return drawn.map(({ point, sourceIndex }) => {\n const selected = selection.has(point.id);\n\n return {\n point,\n sourceIndex,\n selected,\n style: buildMarkerStyle(point, { categoryColors, weightScale, selected, theme }),\n description: describePoint(point, categoryLabel),\n };\n });\n }, [drawn, points, selectedIds, categoryColors, theme, categoryLabel]);\n\n const tiles = tileLayer ?? {\n url: BASEMAP_TILES[basemap === 'auto' ? theme : basemap],\n attribution: BASEMAP_TILES.attribution,\n };\n\n // Manual framing and automatic framing would fight over the viewport.\n const shouldFitBounds = fitBounds && center == null && zoom == null;\n const showLegend = !hideLegend && legendItems.length > 0;\n const notice = buildNotice(info, maxPoints);\n const hasMap = !isLoading && error == null && info.drawn > 0;\n\n useEffect(() => {\n onRender?.(info);\n }, [onRender, info]);\n\n useEffect(() => {\n if (import.meta.env.DEV && hasMap) warnMissingLeafletStylesheet(containerRef.current);\n }, [hasMap]);\n\n return (\n <div className={clsx(styles.root, compact && styles.compact, className)}>\n <header className={styles.header}>\n <h3 className={styles.title}>{title}</h3>\n {actions && <div className={styles.headerActions}>{actions}</div>}\n </header>\n\n {toolbar && <div className={styles.toolbar}>{toolbar}</div>}\n\n {hasMap && notice && (\n <div className={styles.warning} role=\"status\">\n {notice}\n </div>\n )}\n\n {isLoading && <div className={styles.loading}>{loadingLabel}</div>}\n\n {!isLoading && error != null && (\n <div className={styles.error}>\n <span>{error}</span>\n {onRetry && (\n <button type=\"button\" className={styles.retryButton} onClick={onRetry}>\n {retryLabel}\n </button>\n )}\n </div>\n )}\n\n {!isLoading && error == null && info.drawn === 0 && (\n <EmptyState\n className={styles.empty}\n variant=\"plain\"\n title={emptyTitle}\n description={emptyDescription}\n />\n )}\n\n {hasMap && (\n <div\n ref={containerRef}\n className={styles.mapContainer}\n role=\"figure\"\n aria-label={`${title}: map of ${info.drawn} points`}\n >\n <MapContainer\n className={styles.map}\n center={center ?? [...GEO_MAP.DEFAULT_CENTER]}\n zoom={zoom ?? GEO_MAP.DEFAULT_ZOOM}\n scrollWheelZoom={scrollWheelZoom}\n >\n <TileLayer key={tiles.url} url={tiles.url} attribution={tiles.attribution} />\n <MapViewport bounds={bounds} fitBounds={shouldFitBounds} />\n\n {markers.map(({ point, sourceIndex, style, description }) => (\n <CircleMarker\n key={point.id}\n center={[point.latitude, point.longitude]}\n radius={style.radius}\n pathOptions={style}\n eventHandlers={\n onSelectPoint ? { click: () => onSelectPoint({ point, index: sourceIndex }) } : {}\n }\n >\n <Tooltip>{description}</Tooltip>\n </CircleMarker>\n ))}\n\n {showLegend && <MapLegend items={legendItems} title={legendTitle} />}\n </MapContainer>\n\n <PointListing\n markers={markers}\n label={pointListLabel}\n onSelectPoint={onSelectPoint}\n />\n </div>\n )}\n </div>\n );\n};\n\nGeoMapCard.displayName = 'GeoMapCard';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,cAAc,CAAC,MAAqB,cAAqC;AAC7E,QAAM,UAAoB,CAAA;AAE1B,MAAI,KAAK,UAAU,EAAG,SAAQ,KAAK,GAAG,KAAK,OAAO,6BAA6B;AAC/E,MAAI,KAAK,UAAU,EAAG,SAAQ,KAAK,GAAG,KAAK,OAAO,aAAa,SAAS,aAAa;AAErF,MAAI,QAAQ,WAAW,EAAG,QAAO;AAEjC,SAAO,WAAW,KAAK,KAAK,OAAO,KAAK,KAAK,YAAY,QAAQ,KAAK,IAAI,CAAC;AAC7E;AAGA,MAAM,gBAAgB,CAAC,OAAiB,kBACtC,CAAC,MAAM,OAAO,MAAM,YAAY,OAAO,GAAG,aAAa,KAAK,MAAM,QAAQ,KAAK,MAAM,MAAM,MAAM,EAC9F,OAAO,CAAC,SAAyB,QAAQ,QAAQ,SAAS,EAAE,EAC5D,KAAK,KAAK;AAER,MAAM,aAAa,CAAC;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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ag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const clsx = require("./
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}) =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (!onColumnResize) return;
|
|
43
|
-
const col = columns.find((c) => c.key === columnKey);
|
|
44
|
-
const minW = (col == null ? void 0 : col.minWidth) ?? constants.MIN_COLUMN_WIDTH;
|
|
45
|
-
const onMouseMove = (e) => {
|
|
46
|
-
const newWidth = Math.max(minW, startWidth + e.clientX - startX);
|
|
47
|
-
onColumnResize(columnKey, newWidth);
|
|
48
|
-
};
|
|
49
|
-
const onMouseUp = () => {
|
|
50
|
-
document.removeEventListener("mousemove", onMouseMove);
|
|
51
|
-
document.removeEventListener("mouseup", onMouseUp);
|
|
52
|
-
document.body.style.cursor = "";
|
|
53
|
-
document.body.style.userSelect = "";
|
|
54
|
-
};
|
|
55
|
-
document.addEventListener("mousemove", onMouseMove);
|
|
56
|
-
document.addEventListener("mouseup", onMouseUp);
|
|
57
|
-
document.body.style.cursor = "col-resize";
|
|
58
|
-
document.body.style.userSelect = "none";
|
|
59
|
-
},
|
|
60
|
-
[onColumnResize, columns]
|
|
61
|
-
);
|
|
62
|
-
const getSortAria = (key) => {
|
|
63
|
-
if ((sortState == null ? void 0 : sortState.column) !== key) return "none";
|
|
64
|
-
return sortState.direction === "asc" ? "ascending" : "descending";
|
|
65
|
-
};
|
|
66
|
-
const renderCell = (col, row) => {
|
|
67
|
-
const value = row[col.key];
|
|
68
|
-
if (col.render) return col.render(value, row);
|
|
69
|
-
return String(value ?? "");
|
|
70
|
-
};
|
|
71
|
-
const containerStyle = maxHeight ? { maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight } : void 0;
|
|
72
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx(LiveExplorerTable_module.default.root, className), children: [
|
|
73
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: LiveExplorerTable_module.default.tableContainer, style: containerStyle, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: LiveExplorerTable_module.default.table, children: [
|
|
74
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
75
|
-
"th",
|
|
76
|
-
{
|
|
77
|
-
scope: "col",
|
|
78
|
-
className: clsx.clsx(LiveExplorerTable_module.default.th, { [LiveExplorerTable_module.default.sortable]: col.sortable }),
|
|
79
|
-
style: col.width ? { width: `${col.width}px` } : void 0,
|
|
80
|
-
"aria-sort": col.sortable ? getSortAria(col.key) : void 0,
|
|
81
|
-
onClick: col.sortable ? () => handleSort(col.key) : void 0,
|
|
82
|
-
children: [
|
|
83
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: LiveExplorerTable_module.default.thContent, children: [
|
|
84
|
-
col.label,
|
|
85
|
-
col.sortable && (sortState == null ? void 0 : sortState.column) === col.key && /* @__PURE__ */ jsxRuntime.jsx("span", { className: LiveExplorerTable_module.default.sortIndicator, "aria-hidden": "true", children: sortState.direction === "asc" ? "▲" : "▼" })
|
|
86
|
-
] }),
|
|
87
|
-
onColumnResize && /* @__PURE__ */ jsxRuntime.jsx(
|
|
88
|
-
"span",
|
|
5
|
+
const clsx = require("./index57.cjs");
|
|
6
|
+
const HeatmapMatrix_module = require("./index97.cjs");
|
|
7
|
+
function activateOnKey(event, action) {
|
|
8
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
9
|
+
event.preventDefault();
|
|
10
|
+
action();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const HeatmapMatrix = react.forwardRef(
|
|
14
|
+
({
|
|
15
|
+
columns,
|
|
16
|
+
rows,
|
|
17
|
+
cornerLabel,
|
|
18
|
+
getCell,
|
|
19
|
+
onRowHeaderClick,
|
|
20
|
+
onCellClick,
|
|
21
|
+
maxHeight,
|
|
22
|
+
className,
|
|
23
|
+
style,
|
|
24
|
+
...props
|
|
25
|
+
}, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
ref,
|
|
29
|
+
className: clsx.clsx(HeatmapMatrix_module.default.wrap, className),
|
|
30
|
+
style: { maxHeight, ...style },
|
|
31
|
+
...props,
|
|
32
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: HeatmapMatrix_module.default.root, children: [
|
|
33
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: HeatmapMatrix_module.default.corner, "aria-hidden": cornerLabel == null, children: cornerLabel }),
|
|
35
|
+
columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: HeatmapMatrix_module.default.colh, title: col.title, children: col.label }, col.key))
|
|
36
|
+
] }) }),
|
|
37
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row) => {
|
|
38
|
+
const rowInteractive = Boolean(onRowHeaderClick);
|
|
39
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
41
|
+
"th",
|
|
89
42
|
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
handleResizeStart(col.key, e.clientX, (th == null ? void 0 : th.offsetWidth) ?? FULL_PERCENT);
|
|
98
|
-
}
|
|
43
|
+
scope: "row",
|
|
44
|
+
className: clsx.clsx(HeatmapMatrix_module.default.rowh, rowInteractive && HeatmapMatrix_module.default.clickable),
|
|
45
|
+
role: rowInteractive ? "button" : void 0,
|
|
46
|
+
tabIndex: rowInteractive ? 0 : void 0,
|
|
47
|
+
onClick: rowInteractive ? () => onRowHeaderClick == null ? void 0 : onRowHeaderClick(row.key) : void 0,
|
|
48
|
+
onKeyDown: rowInteractive ? (event) => activateOnKey(event, () => onRowHeaderClick == null ? void 0 : onRowHeaderClick(row.key)) : void 0,
|
|
49
|
+
children: row.label
|
|
99
50
|
}
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
) })
|
|
131
|
-
] });
|
|
132
|
-
};
|
|
133
|
-
LiveExplorerTable.displayName = "LiveExplorerTable";
|
|
134
|
-
exports.LiveExplorerTable = LiveExplorerTable;
|
|
51
|
+
),
|
|
52
|
+
columns.map((col) => {
|
|
53
|
+
const cell = getCell(row.key, col.key);
|
|
54
|
+
const cellInteractive = Boolean(onCellClick);
|
|
55
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
+
"td",
|
|
57
|
+
{
|
|
58
|
+
title: cell.title,
|
|
59
|
+
className: clsx.clsx(
|
|
60
|
+
HeatmapMatrix_module.default.cell,
|
|
61
|
+
cell.state && HeatmapMatrix_module.default[cell.state],
|
|
62
|
+
cellInteractive && HeatmapMatrix_module.default.clickable
|
|
63
|
+
),
|
|
64
|
+
role: cellInteractive ? "button" : void 0,
|
|
65
|
+
tabIndex: cellInteractive ? 0 : void 0,
|
|
66
|
+
onClick: cellInteractive ? () => onCellClick == null ? void 0 : onCellClick(row.key, col.key) : void 0,
|
|
67
|
+
onKeyDown: cellInteractive ? (event) => activateOnKey(event, () => onCellClick == null ? void 0 : onCellClick(row.key, col.key)) : void 0,
|
|
68
|
+
children: cell.value
|
|
69
|
+
},
|
|
70
|
+
col.key
|
|
71
|
+
);
|
|
72
|
+
})
|
|
73
|
+
] }, row.key);
|
|
74
|
+
}) })
|
|
75
|
+
] })
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
HeatmapMatrix.displayName = "HeatmapMatrix";
|
|
80
|
+
exports.HeatmapMatrix = HeatmapMatrix;
|
|
135
81
|
//# sourceMappingURL=index31.cjs.map
|