@mailwoman/react 9.3.0 → 10.0.0
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/fonts.css +59 -0
- package/lib/common/About.tsx +105 -0
- package/lib/common/KindBadge.tsx +2 -7
- package/lib/common/confidence-tiers.ts +50 -0
- package/lib/common/index.ts +22 -0
- package/lib/common/text-tokens.ts +88 -0
- package/lib/index.ts +10 -103
- package/lib/map/BackendControl.tsx +7 -3
- package/lib/map/CompareToggle.tsx +5 -4
- package/lib/map/{GeocoderDemo.tsx → Geocoder.tsx} +81 -61
- package/lib/map/GeocoderControls.tsx +352 -0
- package/lib/map/{DemoMap.tsx → MapCanvas.tsx} +15 -15
- package/lib/map/MapChipRow.tsx +77 -0
- package/lib/map/MapCompass.tsx +77 -0
- package/lib/map/MapControlStack.tsx +98 -0
- package/lib/map/MapFooter.tsx +115 -0
- package/lib/map/MapProgressBar.tsx +58 -0
- package/lib/map/MapSearchBar.tsx +68 -0
- package/lib/map/MapSheet.tsx +62 -0
- package/lib/map/PlaceMarker.tsx +1 -1
- package/lib/map/ResolvedPlaceLayers.tsx +3 -3
- package/lib/map/ResultCamera.tsx +1 -1
- package/lib/map/ResultPanel.tsx +2 -2
- package/lib/map/VersionPicker.tsx +3 -3
- package/lib/map/fake-runtime.ts +122 -0
- package/lib/map/index.ts +35 -16
- package/lib/map/map-debug.ts +51 -0
- package/lib/map/place-render.ts +3 -2
- package/lib/map/types.ts +58 -42
- package/lib/map/{useDemoGeocode.ts → useGeocode.ts} +8 -8
- package/lib/map/useMapBearing.ts +56 -0
- package/lib/map/useMapLabelPick.ts +123 -0
- package/lib/pipeline/CandidatePicker.tsx +1 -1
- package/lib/pipeline/ComponentTable.tsx +1 -2
- package/lib/pipeline/ConfidenceCell.tsx +7 -19
- package/lib/pipeline/FailureDiagnostic.tsx +56 -0
- package/lib/pipeline/ResolvedPlace.tsx +17 -4
- package/lib/pipeline/SpanHighlight.tsx +97 -0
- package/lib/pipeline/TimingPanel.tsx +65 -0
- package/lib/pipeline/TreeView.tsx +55 -0
- package/lib/pipeline/copy.ts +1 -1
- package/lib/pipeline/index.ts +36 -0
- package/lib/pipeline/types.ts +2 -75
- package/lib/pipeline/useParsePipeline.ts +31 -19
- package/lib/poi/index.ts +39 -0
- package/lib/poi/types.ts +2 -1
- package/lib/runtime/index.ts +16 -0
- package/lib/runtime/{useDemoRuntime.ts → useReleaseRuntime.ts} +22 -24
- package/out/common/About.d.ts +21 -0
- package/out/common/About.d.ts.map +1 -0
- package/out/common/About.js +8 -0
- package/out/common/About.js.map +1 -0
- package/out/common/KindBadge.d.ts +2 -9
- package/out/common/KindBadge.d.ts.map +1 -1
- package/out/common/KindBadge.js.map +1 -1
- package/out/common/confidence-tiers.d.ts +36 -0
- package/out/common/confidence-tiers.d.ts.map +1 -0
- package/out/common/confidence-tiers.js +42 -0
- package/out/common/confidence-tiers.js.map +1 -0
- package/out/common/index.d.ts +22 -0
- package/out/common/index.d.ts.map +1 -0
- package/out/common/index.js +15 -0
- package/out/common/index.js.map +1 -0
- package/out/common/text-tokens.d.ts +46 -0
- package/out/common/text-tokens.d.ts.map +1 -0
- package/out/common/text-tokens.js +52 -0
- package/out/common/text-tokens.js.map +1 -0
- package/out/index.d.ts +5 -51
- package/out/index.d.ts.map +1 -1
- package/out/index.js +4 -30
- package/out/index.js.map +1 -1
- package/out/map/BackendControl.d.ts.map +1 -1
- package/out/map/BackendControl.js +1 -1
- package/out/map/BackendControl.js.map +1 -1
- package/out/map/CompareToggle.d.ts +2 -2
- package/out/map/CompareToggle.d.ts.map +1 -1
- package/out/map/CompareToggle.js +1 -1
- package/out/map/CompareToggle.js.map +1 -1
- package/out/map/Geocoder.d.ts +67 -0
- package/out/map/Geocoder.d.ts.map +1 -0
- package/out/map/Geocoder.js +98 -0
- package/out/map/Geocoder.js.map +1 -0
- package/out/map/GeocoderControls.d.ts +81 -0
- package/out/map/GeocoderControls.d.ts.map +1 -0
- package/out/map/GeocoderControls.js +79 -0
- package/out/map/GeocoderControls.js.map +1 -0
- package/out/map/{DemoMap.d.ts → MapCanvas.d.ts} +15 -15
- package/out/map/MapCanvas.d.ts.map +1 -0
- package/out/map/{DemoMap.js → MapCanvas.js} +2 -2
- package/out/map/MapCanvas.js.map +1 -0
- package/out/map/MapChipRow.d.ts +47 -0
- package/out/map/MapChipRow.d.ts.map +1 -0
- package/out/map/MapChipRow.js +12 -0
- package/out/map/MapChipRow.js.map +1 -0
- package/out/map/MapCompass.d.ts +42 -0
- package/out/map/MapCompass.d.ts.map +1 -0
- package/out/map/MapCompass.js +11 -0
- package/out/map/MapCompass.js.map +1 -0
- package/out/map/MapControlStack.d.ts +57 -0
- package/out/map/MapControlStack.d.ts.map +1 -0
- package/out/map/MapControlStack.js +15 -0
- package/out/map/MapControlStack.js.map +1 -0
- package/out/map/MapFooter.d.ts +40 -0
- package/out/map/MapFooter.d.ts.map +1 -0
- package/out/map/MapFooter.js +51 -0
- package/out/map/MapFooter.js.map +1 -0
- package/out/map/MapProgressBar.d.ts +34 -0
- package/out/map/MapProgressBar.d.ts.map +1 -0
- package/out/map/MapProgressBar.js +8 -0
- package/out/map/MapProgressBar.js.map +1 -0
- package/out/map/MapSearchBar.d.ts +49 -0
- package/out/map/MapSearchBar.d.ts.map +1 -0
- package/out/map/MapSearchBar.js +6 -0
- package/out/map/MapSearchBar.js.map +1 -0
- package/out/map/MapSheet.d.ts +32 -0
- package/out/map/MapSheet.d.ts.map +1 -0
- package/out/map/MapSheet.js +33 -0
- package/out/map/MapSheet.js.map +1 -0
- package/out/map/OverlayLayers.js +1 -1
- package/out/map/PlaceMarker.d.ts +1 -1
- package/out/map/ResolvedPlaceLayers.d.ts +3 -3
- package/out/map/ResolvedPlaceLayers.js +1 -1
- package/out/map/ResultCamera.d.ts +1 -1
- package/out/map/ResultCamera.js +1 -1
- package/out/map/ResultPanel.d.ts +2 -2
- package/out/map/ResultPanel.d.ts.map +1 -1
- package/out/map/ResultPanel.js +1 -1
- package/out/map/ResultPanel.js.map +1 -1
- package/out/map/VersionPicker.d.ts +3 -3
- package/out/map/VersionPicker.d.ts.map +1 -1
- package/out/map/fake-runtime.d.ts +38 -0
- package/out/map/fake-runtime.d.ts.map +1 -0
- package/out/map/fake-runtime.js +107 -0
- package/out/map/fake-runtime.js.map +1 -0
- package/out/map/index.d.ts +27 -10
- package/out/map/index.d.ts.map +1 -1
- package/out/map/index.js +16 -6
- package/out/map/index.js.map +1 -1
- package/out/map/map-debug.d.ts +31 -0
- package/out/map/map-debug.d.ts.map +1 -0
- package/out/map/map-debug.js +31 -0
- package/out/map/map-debug.js.map +1 -0
- package/out/map/place-render.d.ts +2 -2
- package/out/map/place-render.d.ts.map +1 -1
- package/out/map/place-render.js +1 -1
- package/out/map/place-render.js.map +1 -1
- package/out/map/types.d.ts +60 -42
- package/out/map/types.d.ts.map +1 -1
- package/out/map/types.js +5 -5
- package/out/map/{useDemoGeocode.d.ts → useGeocode.d.ts} +9 -9
- package/out/map/useGeocode.d.ts.map +1 -0
- package/out/map/{useDemoGeocode.js → useGeocode.js} +4 -4
- package/out/map/useGeocode.js.map +1 -0
- package/out/map/useMapBearing.d.ts +28 -0
- package/out/map/useMapBearing.d.ts.map +1 -0
- package/out/map/useMapBearing.js +35 -0
- package/out/map/useMapBearing.js.map +1 -0
- package/out/map/useMapLabelPick.d.ts +23 -0
- package/out/map/useMapLabelPick.d.ts.map +1 -0
- package/out/map/useMapLabelPick.js +104 -0
- package/out/map/useMapLabelPick.js.map +1 -0
- package/out/pipeline/CandidatePicker.d.ts +1 -1
- package/out/pipeline/CandidatePicker.d.ts.map +1 -1
- package/out/pipeline/CandidatePicker.js +1 -1
- package/out/pipeline/CandidatePicker.js.map +1 -1
- package/out/pipeline/ComponentTable.d.ts +1 -1
- package/out/pipeline/ComponentTable.d.ts.map +1 -1
- package/out/pipeline/ComponentTable.js.map +1 -1
- package/out/pipeline/ConfidenceCell.d.ts +2 -2
- package/out/pipeline/ConfidenceCell.d.ts.map +1 -1
- package/out/pipeline/ConfidenceCell.js +4 -16
- package/out/pipeline/ConfidenceCell.js.map +1 -1
- package/out/pipeline/FailureDiagnostic.d.ts +15 -0
- package/out/pipeline/FailureDiagnostic.d.ts.map +1 -0
- package/out/pipeline/FailureDiagnostic.js +21 -0
- package/out/pipeline/FailureDiagnostic.js.map +1 -0
- package/out/pipeline/PipelineExplorer.js +1 -1
- package/out/pipeline/QueryForm.js +1 -1
- package/out/pipeline/ResolvedPlace.d.ts +1 -1
- package/out/pipeline/ResolvedPlace.d.ts.map +1 -1
- package/out/pipeline/ResolvedPlace.js +4 -10
- package/out/pipeline/ResolvedPlace.js.map +1 -1
- package/out/pipeline/SpanHighlight.d.ts +23 -0
- package/out/pipeline/SpanHighlight.d.ts.map +1 -0
- package/out/pipeline/SpanHighlight.js +31 -0
- package/out/pipeline/SpanHighlight.js.map +1 -0
- package/out/pipeline/TimingPanel.d.ts +16 -0
- package/out/pipeline/TimingPanel.d.ts.map +1 -0
- package/out/pipeline/TimingPanel.js +20 -0
- package/out/pipeline/TimingPanel.js.map +1 -0
- package/out/pipeline/TreeView.d.ts +17 -0
- package/out/pipeline/TreeView.d.ts.map +1 -0
- package/out/pipeline/TreeView.js +15 -0
- package/out/pipeline/TreeView.js.map +1 -0
- package/out/pipeline/copy.d.ts +1 -1
- package/out/pipeline/copy.d.ts.map +1 -1
- package/out/pipeline/index.d.ts +33 -0
- package/out/pipeline/index.d.ts.map +1 -0
- package/out/pipeline/index.js +21 -0
- package/out/pipeline/index.js.map +1 -0
- package/out/pipeline/types.d.ts +2 -68
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +1 -1
- package/out/pipeline/useParsePipeline.d.ts +7 -3
- package/out/pipeline/useParsePipeline.d.ts.map +1 -1
- package/out/pipeline/useParsePipeline.js +6 -2
- package/out/pipeline/useParsePipeline.js.map +1 -1
- package/out/poi/LiveResultsBlock.js +1 -1
- package/out/poi/POIExplorer.js +1 -1
- package/out/poi/SubjectPanel.js +1 -1
- package/out/poi/index.d.ts +23 -0
- package/out/poi/index.d.ts.map +1 -0
- package/out/poi/index.js +15 -0
- package/out/poi/index.js.map +1 -0
- package/out/poi/runtime.d.ts.map +1 -1
- package/out/poi/types.d.ts +2 -1
- package/out/poi/types.d.ts.map +1 -1
- package/out/runtime/index.d.ts +9 -0
- package/out/runtime/index.d.ts.map +1 -0
- package/out/runtime/index.js +8 -0
- package/out/runtime/index.js.map +1 -0
- package/out/runtime/{useDemoRuntime.d.ts → useReleaseRuntime.d.ts} +18 -20
- package/out/runtime/useReleaseRuntime.d.ts.map +1 -0
- package/out/runtime/{useDemoRuntime.js → useReleaseRuntime.js} +4 -4
- package/out/runtime/useReleaseRuntime.js.map +1 -0
- package/package.json +222 -31
- package/styleframe.config.ts +329 -0
- package/styles.css +1995 -663
- package/tokens/index.css +116 -0
- package/tokens/tokens.json +528 -0
- package/tokens/tokens.resolver.json +185 -0
- package/lib/map/DemoControls.tsx +0 -194
- package/out/map/DemoControls.d.ts +0 -64
- package/out/map/DemoControls.d.ts.map +0 -1
- package/out/map/DemoControls.js +0 -30
- package/out/map/DemoControls.js.map +0 -1
- package/out/map/DemoMap.d.ts.map +0 -1
- package/out/map/DemoMap.js.map +0 -1
- package/out/map/GeocoderDemo.d.ts +0 -57
- package/out/map/GeocoderDemo.d.ts.map +0 -1
- package/out/map/GeocoderDemo.js +0 -98
- package/out/map/GeocoderDemo.js.map +0 -1
- package/out/map/useDemoGeocode.d.ts.map +0 -1
- package/out/map/useDemoGeocode.js.map +0 -1
- package/out/runtime/useDemoRuntime.d.ts.map +0 -1
- package/out/runtime/useDemoRuntime.js.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `<
|
|
6
|
+
* `<MapCanvas>` — the declarative map shell for the geocoder demo, over `react-map-gl/maplibre` (v8).
|
|
7
7
|
* Phase 1 is the shell only: a `<Map>` that takes a host-composed `mapStyle`, an initial (or
|
|
8
8
|
* controlled) view state, and a `children` slot for the overlays/markers that land in later phases.
|
|
9
9
|
* No overlay/marker/camera logic lives here yet.
|
|
@@ -15,27 +15,27 @@
|
|
|
15
15
|
* the root barrel.
|
|
16
16
|
*
|
|
17
17
|
* CSS: the package imports no CSS from its modules (the node-safe invariant), so a host that renders
|
|
18
|
-
* `<
|
|
19
|
-
* for the `.mw-demo-map` container). `<
|
|
18
|
+
* `<MapCanvas>` must import `maplibre-gl/dist/maplibre-gl.css` itself (plus `@mailwoman/react/styles.css`
|
|
19
|
+
* for the `.mw-demo-map` container). `<MapCanvas>` is intrinsically a client component — a host that
|
|
20
20
|
* server-renders should wrap it in a client boundary (the package's `ClientOnly`), exactly as the
|
|
21
|
-
* composed `
|
|
21
|
+
* composed `Geocoder` will in a later phase.
|
|
22
22
|
*/
|
|
23
23
|
import type { CSSProperties, ReactNode, Ref } from "react";
|
|
24
24
|
import type { MapProps, MapRef, ViewStateChangeEvent } from "react-map-gl/maplibre";
|
|
25
25
|
/**
|
|
26
|
-
* The style a `<
|
|
26
|
+
* The style a `<MapCanvas>` renders — a style URL or an inline/composed `StyleSpecification`.
|
|
27
27
|
*/
|
|
28
|
-
export type
|
|
28
|
+
export type MapCanvasStyle = NonNullable<MapProps["mapStyle"]>;
|
|
29
29
|
/**
|
|
30
|
-
* Override for the `<Map>` props `<
|
|
31
|
-
* `maplibreLogo`). The controlled fields
|
|
30
|
+
* Override for the `<Map>` props `<MapCanvas>` does not surface explicitly (e.g. `minZoom`, `attributionControl`,
|
|
31
|
+
* `maplibreLogo`). The controlled fields MapCanvas owns are omitted so they can't be set twice.
|
|
32
32
|
*/
|
|
33
|
-
export type
|
|
34
|
-
export interface
|
|
33
|
+
export type MapCanvasExtraProps = Partial<Omit<MapProps, "mapStyle" | "initialViewState" | "viewState" | "onMove" | "children" | "style" | "ref">>;
|
|
34
|
+
export interface MapCanvasProps {
|
|
35
35
|
/**
|
|
36
36
|
* The map style — host-composed `StyleSpecification` or a style URL.
|
|
37
37
|
*/
|
|
38
|
-
mapStyle:
|
|
38
|
+
mapStyle: MapCanvasStyle;
|
|
39
39
|
/**
|
|
40
40
|
* Uncontrolled initial camera. Use this OR `viewState`, not both.
|
|
41
41
|
*/
|
|
@@ -69,13 +69,13 @@ export interface DemoMapProps {
|
|
|
69
69
|
*/
|
|
70
70
|
style?: CSSProperties;
|
|
71
71
|
/**
|
|
72
|
-
* Remaining `<Map>` props
|
|
72
|
+
* Remaining `<Map>` props MapCanvas does not surface explicitly.
|
|
73
73
|
*/
|
|
74
|
-
mapProps?:
|
|
74
|
+
mapProps?: MapCanvasExtraProps;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* The controlled-viewport map shell. Renders a sized wrapper around a `react-map-gl/maplibre` `<Map>`; everything
|
|
78
78
|
* host-specific (the composed `mapStyle`, the initial center) is injected, and overlays ride in as `children`.
|
|
79
79
|
*/
|
|
80
|
-
export declare function
|
|
81
|
-
//# sourceMappingURL=
|
|
80
|
+
export declare function MapCanvas({ mapStyle, initialViewState, viewState, onMove, projection, mapRef, children, className, style, mapProps, }: MapCanvasProps): ReactNode;
|
|
81
|
+
//# sourceMappingURL=MapCanvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapCanvas.d.ts","sourceRoot":"","sources":["../../lib/map/MapCanvas.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAEnF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAA;AAE9D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,CACxC,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,kBAAkB,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC,CACvG,CAAA;AAED,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAA;IAC/C;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAA;IACjC;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAC9C;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAA;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,mBAAmB,CAAA;CAC9B;AAID;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACzB,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,MAAM,EACN,UAAoB,EACpB,MAAM,EACN,QAAQ,EACR,SAAS,EACT,KAAK,EACL,QAAQ,GACR,EAAE,cAAc,GAAG,SAAS,CAmB5B"}
|
|
@@ -5,8 +5,8 @@ const FILL = { width: "100%", height: "100%" };
|
|
|
5
5
|
* The controlled-viewport map shell. Renders a sized wrapper around a `react-map-gl/maplibre` `<Map>`; everything
|
|
6
6
|
* host-specific (the composed `mapStyle`, the initial center) is injected, and overlays ride in as `children`.
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export function MapCanvas({ mapStyle, initialViewState, viewState, onMove, projection = "globe", mapRef, children, className, style, mapProps, }) {
|
|
9
9
|
const wrapperClassName = className ? `mw-demo-map ${className}` : "mw-demo-map";
|
|
10
10
|
return (_jsx("div", { className: wrapperClassName, style: style, children: _jsx(Map, { ...mapProps, ref: mapRef, mapStyle: mapStyle, initialViewState: initialViewState, viewState: viewState, onMove: onMove, projection: projection, style: FILL, children: children }) }));
|
|
11
11
|
}
|
|
12
|
-
//# sourceMappingURL=
|
|
12
|
+
//# sourceMappingURL=MapCanvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapCanvas.js","sourceRoot":"","sources":["../../lib/map/MapCanvas.tsx"],"names":[],"mappings":";AAwBA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AA2D3C,MAAM,IAAI,GAAkB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AAE7D;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,EACzB,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,MAAM,EACN,UAAU,GAAG,OAAO,EACpB,MAAM,EACN,QAAQ,EACR,SAAS,EACT,KAAK,EACL,QAAQ,GACQ;IAChB,MAAM,gBAAgB,GAAG,SAAS,CAAC,CAAC,CAAC,eAAe,SAAS,EAAE,CAAC,CAAC,CAAC,aAAa,CAAA;IAE/E,OAAO,CACN,cAAK,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,YAC7C,KAAC,GAAG,OACC,QAAQ,EACZ,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,IAAI,YAEV,QAAQ,GACJ,GACD,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `<MapChipRow>` — the row of example queries under a search bar.
|
|
7
|
+
*
|
|
8
|
+
* It SCROLLS horizontally and never wraps. Earth's twelve examples wrapped down five ragged rows (3/3/2/1/1/1) and
|
|
9
|
+
* took a third of the panel; one scrolling line is the shape the reference map apps use, and it costs a fixed
|
|
10
|
+
* height whatever the number of examples.
|
|
11
|
+
*
|
|
12
|
+
* NODE-SAFE: pure React, no maplibre.
|
|
13
|
+
*/
|
|
14
|
+
import type { ReactNode } from "react";
|
|
15
|
+
export interface MapChip {
|
|
16
|
+
/**
|
|
17
|
+
* What the chip reads.
|
|
18
|
+
*/
|
|
19
|
+
label: string;
|
|
20
|
+
/**
|
|
21
|
+
* The query the chip stands for, handed back on press. Defaults to the label.
|
|
22
|
+
*/
|
|
23
|
+
value?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Rendered before the label — a category mark.
|
|
26
|
+
*/
|
|
27
|
+
icon?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
export interface MapChipRowProps {
|
|
30
|
+
chips: MapChip[];
|
|
31
|
+
/**
|
|
32
|
+
* Fired with the chip's `value` (or its label) when one is pressed.
|
|
33
|
+
*/
|
|
34
|
+
onPick: (value: string) => void;
|
|
35
|
+
/**
|
|
36
|
+
* The chip matching this value reads as pressed.
|
|
37
|
+
*/
|
|
38
|
+
activeValue?: string;
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
className?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Accessible name for the row, e.g. "Example addresses".
|
|
43
|
+
*/
|
|
44
|
+
label?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare function MapChipRow({ chips, onPick, activeValue, disabled, className, label }: MapChipRowProps): ReactNode;
|
|
47
|
+
//# sourceMappingURL=MapChipRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapChipRow.d.ts","sourceRoot":"","sources":["../../lib/map/MapChipRow.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB;;OAEG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,eAAe,GAAG,SAAS,CAyBjH"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "#common/cx";
|
|
3
|
+
export function MapChipRow({ chips, onPick, activeValue, disabled, className, label }) {
|
|
4
|
+
if (!chips.length)
|
|
5
|
+
return null;
|
|
6
|
+
return (_jsx("div", { className: cx("mw-map-chiprow", className), role: "group", "aria-label": label, children: chips.map((chip) => {
|
|
7
|
+
const value = chip.value ?? chip.label;
|
|
8
|
+
const active = value === activeValue;
|
|
9
|
+
return (_jsxs("button", { type: "button", className: cx("mw-map-chip", active && "mw-map-chip--active"), "aria-pressed": active, disabled: disabled, onClick: () => onPick(value), children: [chip.icon ? _jsx("span", { className: "mw-map-chip__icon", children: chip.icon }) : null, chip.label] }, value));
|
|
10
|
+
}) }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=MapChipRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapChipRow.js","sourceRoot":"","sources":["../../lib/map/MapChipRow.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAmC/B,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAmB;IACrG,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IAE9B,OAAO,CACN,cAAK,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE,IAAI,EAAC,OAAO,gBAAa,KAAK,YAC7E,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACnB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAA;YACtC,MAAM,MAAM,GAAG,KAAK,KAAK,WAAW,CAAA;YAEpC,OAAO,CACN,kBAEC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,MAAM,IAAI,qBAAqB,CAAC,kBAC/C,MAAM,EACpB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,aAE3B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,mBAAmB,YAAE,IAAI,CAAC,IAAI,GAAQ,CAAC,CAAC,CAAC,IAAI,EACzE,IAAI,CAAC,KAAK,KARN,KAAK,CASF,CACT,CAAA;QACF,CAAC,CAAC,GACG,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `<MapCompass>` — the needle that appears when the map leaves north and fades out when it returns.
|
|
7
|
+
*
|
|
8
|
+
* It is a compass ROSE, the way the reference map apps draw it: a ringed dial carrying a two-tone needle whose red
|
|
9
|
+
* half points north and whose pale half points south. A single-color arrow cannot say which end is north, so a
|
|
10
|
+
* reader has to already know the convention to read it; two tones say it outright. There is no `N` on the dial —
|
|
11
|
+
* at this size the letter and the needle's north tip want the same few pixels, and the tip is the clearer of them.
|
|
12
|
+
*
|
|
13
|
+
* The whole dial counter-rotates the bearing, so the needle keeps pointing at true north while the map turns under
|
|
14
|
+
* it. Pressing it returns the map to north, which is why the control is a button rather than an ornament.
|
|
15
|
+
*
|
|
16
|
+
* It stays mounted through the fade rather than unmounting on the bearing crossing zero, because a control that
|
|
17
|
+
* vanishes mid-gesture is the thing that reads as a glitch. `HIDE_BELOW_DEGREES` is the dead zone: a map settled by
|
|
18
|
+
* a snap-to-north lands a fraction off zero, and a compass that lingers over that fraction never goes away.
|
|
19
|
+
*
|
|
20
|
+
* Under `prefers-reduced-motion` it appears and disappears with no transition, and the dial still rotates —
|
|
21
|
+
* rotation IS the information, not decoration.
|
|
22
|
+
*
|
|
23
|
+
* NODE-SAFE: pure React, no maplibre. The host reads the bearing off its own map and passes it in.
|
|
24
|
+
*/
|
|
25
|
+
import type { ReactNode } from "react";
|
|
26
|
+
export interface MapCompassProps {
|
|
27
|
+
/**
|
|
28
|
+
* The map's bearing in degrees, as MapLibre reports it: 0 is north, positive is counter-clockwise.
|
|
29
|
+
*/
|
|
30
|
+
bearing: number;
|
|
31
|
+
/**
|
|
32
|
+
* Fired when the compass is pressed — the host resets its map to north.
|
|
33
|
+
*/
|
|
34
|
+
onResetNorth: () => void;
|
|
35
|
+
/**
|
|
36
|
+
* The control's accessible name. @default "Reset bearing to north"
|
|
37
|
+
*/
|
|
38
|
+
label?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function MapCompass({ bearing, onResetNorth, label, className }: MapCompassProps): ReactNode;
|
|
42
|
+
//# sourceMappingURL=MapCompass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapCompass.d.ts","sourceRoot":"","sources":["../../lib/map/MapCompass.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAStC,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,eAAe,GAAG,SAAS,CA0BlG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "#common/cx";
|
|
3
|
+
/**
|
|
4
|
+
* Below this many degrees off north the compass is treated as pointing north and fades out.
|
|
5
|
+
*/
|
|
6
|
+
const HIDE_BELOW_DEGREES = 0.5;
|
|
7
|
+
export function MapCompass({ bearing, onResetNorth, label, className }) {
|
|
8
|
+
const facingNorth = Math.abs(bearing) < HIDE_BELOW_DEGREES;
|
|
9
|
+
return (_jsx("button", { type: "button", className: cx("mw-map-compass", facingNorth && "mw-map-compass--north", className), "aria-label": label ?? "Reset bearing to north", title: label ?? "Reset bearing to north", "aria-hidden": facingNorth, tabIndex: facingNorth ? -1 : 0, onClick: onResetNorth, children: _jsx("svg", { viewBox: "0 0 32 32", width: "26", height: "26", "aria-hidden": "true", focusable: "false", children: _jsxs("g", { style: { transform: `rotate(${-bearing}deg)`, transformOrigin: "16px 16px" }, children: [_jsx("circle", { cx: "16", cy: "16", r: "12.5", className: "mw-map-compass__dial" }), _jsx("path", { d: "M16 5.5 L20.5 16 L16 16 Z M16 5.5 L11.5 16 L16 16 Z", className: "mw-map-compass__north" }), _jsx("path", { d: "M16 26.5 L20.5 16 L16 16 Z M16 26.5 L11.5 16 L16 16 Z", className: "mw-map-compass__south" })] }) }) }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=MapCompass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapCompass.js","sourceRoot":"","sources":["../../lib/map/MapCompass.tsx"],"names":[],"mappings":";AA2BA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAE/B;;GAEG;AACH,MAAM,kBAAkB,GAAG,GAAG,CAAA;AAkB9B,MAAM,UAAU,UAAU,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAmB;IACtF,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAA;IAE1D,OAAO,CACN,iBACC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,WAAW,IAAI,uBAAuB,EAAE,SAAS,CAAC,gBACtE,KAAK,IAAI,wBAAwB,EAC7C,KAAK,EAAE,KAAK,IAAI,wBAAwB,iBAG3B,WAAW,EACxB,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC9B,OAAO,EAAE,YAAY,YAErB,cAAK,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,iBAAa,MAAM,EAAC,SAAS,EAAC,OAAO,YACnF,aAAG,KAAK,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,OAAO,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,aAC9E,iBAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,MAAM,EAAC,SAAS,EAAC,sBAAsB,GAAG,EAGpE,eAAM,CAAC,EAAC,qDAAqD,EAAC,SAAS,EAAC,uBAAuB,GAAG,EAClG,eAAM,CAAC,EAAC,uDAAuD,EAAC,SAAS,EAAC,uBAAuB,GAAG,IACjG,GACC,GACE,CACT,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `<MapControlStack>` — the column of map controls down one edge, and `<MapControlButton>`, the control inside it.
|
|
7
|
+
*
|
|
8
|
+
* Controls sit in GROUPS: a group is one glass capsule with hairlines between its buttons, and separate groups are
|
|
9
|
+
* separate capsules with a gap. That grouping is the whole layout idea — related controls read as one object, and
|
|
10
|
+
* an unrelated one (a compass that comes and goes) does not join a capsule it would resize.
|
|
11
|
+
*
|
|
12
|
+
* NODE-SAFE: pure React, no maplibre.
|
|
13
|
+
*/
|
|
14
|
+
import type { ReactNode } from "react";
|
|
15
|
+
export interface MapControlButtonProps {
|
|
16
|
+
/**
|
|
17
|
+
* The mark inside the control — an SVG icon or a single glyph.
|
|
18
|
+
*/
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* The control's accessible name. Required: the visible content is a mark, not a word.
|
|
22
|
+
*/
|
|
23
|
+
label: string;
|
|
24
|
+
onPress: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* Reads as active, for a control that toggles a layer or a mode.
|
|
27
|
+
*/
|
|
28
|
+
active?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function MapControlButton({ children, label, onPress, active, disabled, className, }: MapControlButtonProps): ReactNode;
|
|
33
|
+
export interface MapControlGroupProps {
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One capsule. Put related controls in the same group; give an unrelated one its own.
|
|
39
|
+
*/
|
|
40
|
+
export declare function MapControlGroup({ children, className }: MapControlGroupProps): ReactNode;
|
|
41
|
+
export interface MapControlStackProps {
|
|
42
|
+
/**
|
|
43
|
+
* Groups, top to bottom.
|
|
44
|
+
*/
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Which edge the column sits against. @default "right"
|
|
48
|
+
*/
|
|
49
|
+
side?: "left" | "right";
|
|
50
|
+
className?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Accessible name for the column, e.g. "Map controls".
|
|
53
|
+
*/
|
|
54
|
+
label?: string;
|
|
55
|
+
}
|
|
56
|
+
export declare function MapControlStack({ children, side, className, label }: MapControlStackProps): ReactNode;
|
|
57
|
+
//# sourceMappingURL=MapControlStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapControlStack.d.ts","sourceRoot":"","sources":["../../lib/map/MapControlStack.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,gBAAgB,CAAC,EAChC,QAAQ,EACR,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,SAAS,GACT,EAAE,qBAAqB,GAAG,SAAS,CAcnC;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,oBAAoB,GAAG,SAAS,CAExF;AAED,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,IAAc,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,oBAAoB,GAAG,SAAS,CAU/G"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "#common/cx";
|
|
3
|
+
export function MapControlButton({ children, label, onPress, active, disabled, className, }) {
|
|
4
|
+
return (_jsx("button", { type: "button", className: cx("mw-map-control", active && "mw-map-control--active", className), "aria-label": label, "aria-pressed": active, title: label, disabled: disabled, onClick: onPress, children: children }));
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* One capsule. Put related controls in the same group; give an unrelated one its own.
|
|
8
|
+
*/
|
|
9
|
+
export function MapControlGroup({ children, className }) {
|
|
10
|
+
return _jsx("div", { className: cx("mw-map-control-group", className), children: children });
|
|
11
|
+
}
|
|
12
|
+
export function MapControlStack({ children, side = "right", className, label }) {
|
|
13
|
+
return (_jsx("div", { className: cx("mw-map-control-stack", `mw-map-control-stack--${side}`, className), role: "group", "aria-label": label, children: children }));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=MapControlStack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapControlStack.js","sourceRoot":"","sources":["../../lib/map/MapControlStack.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAoB/B,MAAM,UAAU,gBAAgB,CAAC,EAChC,QAAQ,EACR,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,SAAS,GACc;IACvB,OAAO,CACN,iBACC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,MAAM,IAAI,wBAAwB,EAAE,SAAS,CAAC,gBAClE,KAAK,kBACH,MAAM,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,YAEf,QAAQ,GACD,CACT,CAAA;AACF,CAAC;AAOD;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAwB;IAC5E,OAAO,cAAK,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,YAAG,QAAQ,GAAO,CAAA;AAC/E,CAAC;AAkBD,MAAM,UAAU,eAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,EAAE,SAAS,EAAE,KAAK,EAAwB;IACnG,OAAO,CACN,cACC,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,yBAAyB,IAAI,EAAE,EAAE,SAAS,CAAC,EACjF,IAAI,EAAC,OAAO,gBACA,KAAK,YAEhB,QAAQ,GACJ,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `<MapFooter>` — the strip along the bottom of a map: identity and load status on the left, an attribution button
|
|
7
|
+
* on the right.
|
|
8
|
+
*
|
|
9
|
+
* Attribution is a licence obligation for every source these apps draw, so it is a first-class slot rather than
|
|
10
|
+
* something an app remembers to add. It sits behind a button because the strip has to stay ONE line: spelled out, the
|
|
11
|
+
* credits ran three lines deep on a phone and covered the sheet above them. The button names the obligation, and
|
|
12
|
+
* pressing it shows every credit — which is the treatment the reference map apps use.
|
|
13
|
+
*
|
|
14
|
+
* The status slot is where the loader says WHAT it is fetching while the bar at the top of the viewport says how far
|
|
15
|
+
* along it is.
|
|
16
|
+
*
|
|
17
|
+
* NODE-SAFE: pure React, no maplibre.
|
|
18
|
+
*/
|
|
19
|
+
import { type ReactNode } from "react";
|
|
20
|
+
export interface MapFooterProps {
|
|
21
|
+
/**
|
|
22
|
+
* The left side: a wordmark, a body name, a line saying what the page does.
|
|
23
|
+
*/
|
|
24
|
+
identity?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Beside the identity: what is loading right now. Absent when nothing is.
|
|
27
|
+
*/
|
|
28
|
+
status?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The credits, one entry per source. Shown in the popover the attribution button opens.
|
|
31
|
+
*/
|
|
32
|
+
attribution?: ReactNode[];
|
|
33
|
+
/**
|
|
34
|
+
* What the attribution button reads. @default "Sources"
|
|
35
|
+
*/
|
|
36
|
+
attributionLabel?: string;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function MapFooter({ identity, status, attribution, attributionLabel, className, }: MapFooterProps): ReactNode;
|
|
40
|
+
//# sourceMappingURL=MapFooter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapFooter.d.ts","sourceRoot":"","sources":["../../lib/map/MapFooter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAsC,MAAM,OAAO,CAAA;AAI1E,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,EAAE,CAAA;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,SAAS,CAAC,EACzB,QAAQ,EACR,MAAM,EACN,WAAW,EACX,gBAA4B,EAC5B,SAAS,GACT,EAAE,cAAc,GAAG,SAAS,CAiE5B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @copyright Sister Software
|
|
4
|
+
* @license AGPL-3.0
|
|
5
|
+
* @author Teffen Ellis, et al.
|
|
6
|
+
*
|
|
7
|
+
* `<MapFooter>` — the strip along the bottom of a map: identity and load status on the left, an attribution button
|
|
8
|
+
* on the right.
|
|
9
|
+
*
|
|
10
|
+
* Attribution is a licence obligation for every source these apps draw, so it is a first-class slot rather than
|
|
11
|
+
* something an app remembers to add. It sits behind a button because the strip has to stay ONE line: spelled out, the
|
|
12
|
+
* credits ran three lines deep on a phone and covered the sheet above them. The button names the obligation, and
|
|
13
|
+
* pressing it shows every credit — which is the treatment the reference map apps use.
|
|
14
|
+
*
|
|
15
|
+
* The status slot is where the loader says WHAT it is fetching while the bar at the top of the viewport says how far
|
|
16
|
+
* along it is.
|
|
17
|
+
*
|
|
18
|
+
* NODE-SAFE: pure React, no maplibre.
|
|
19
|
+
*/
|
|
20
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
21
|
+
import { cx } from "#common/cx";
|
|
22
|
+
export function MapFooter({ identity, status, attribution, attributionLabel = "Sources", className, }) {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
const popoverID = useId();
|
|
25
|
+
const root = useRef(null);
|
|
26
|
+
// A popover closes when the conversation moves elsewhere: a press outside it, or Escape.
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!open)
|
|
29
|
+
return;
|
|
30
|
+
const onPointerDown = (event) => {
|
|
31
|
+
if (!root.current?.contains(event.target)) {
|
|
32
|
+
setOpen(false);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const onKeyDown = (event) => {
|
|
36
|
+
if (event.key === "Escape") {
|
|
37
|
+
setOpen(false);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
41
|
+
document.addEventListener("keydown", onKeyDown);
|
|
42
|
+
return () => {
|
|
43
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
44
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
45
|
+
};
|
|
46
|
+
}, [open]);
|
|
47
|
+
if (!identity && !status && !attribution?.length)
|
|
48
|
+
return null;
|
|
49
|
+
return (_jsxs("footer", { className: cx("mw-map-footer", className), ref: root, children: [_jsxs("div", { className: "mw-map-footer__identity", children: [identity, status ? _jsx("span", { className: "mw-map-footer__status", children: status }) : null] }), attribution?.length ? (_jsxs("div", { className: "mw-map-footer__sources", children: [open ? (_jsx("div", { className: "mw-map-footer__popover", id: popoverID, role: "group", "aria-label": "Map data sources", children: attribution.map((entry, index) => (_jsx("span", { className: "mw-map-footer__credit", children: entry }, index))) })) : null, _jsx("button", { type: "button", className: "mw-map-footer__attribution-button", "aria-expanded": open, "aria-controls": open ? popoverID : undefined, onClick: () => setOpen((value) => !value), children: attributionLabel })] })) : null] }));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=MapFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapFooter.js","sourceRoot":"","sources":["../../lib/map/MapFooter.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAkB,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE1E,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAsB/B,MAAM,UAAU,SAAS,CAAC,EACzB,QAAQ,EACR,MAAM,EACN,WAAW,EACX,gBAAgB,GAAG,SAAS,EAC5B,SAAS,GACO;IAChB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACvC,MAAM,SAAS,GAAG,KAAK,EAAE,CAAA;IACzB,MAAM,IAAI,GAAG,MAAM,CAAc,IAAI,CAAC,CAAA;IAEtC,yFAAyF;IACzF,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,IAAI;YAAE,OAAM;QAEjB,MAAM,aAAa,GAAG,CAAC,KAAmB,EAAE,EAAE;YAC7C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,EAAE,CAAC;gBACnD,OAAO,CAAC,KAAK,CAAC,CAAA;YACf,CAAC;QACF,CAAC,CAAA;QAED,MAAM,SAAS,GAAG,CAAC,KAAoB,EAAE,EAAE;YAC1C,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;gBAC5B,OAAO,CAAC,KAAK,CAAC,CAAA;YACf,CAAC;QACF,CAAC,CAAA;QAED,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAA;QACvD,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QAE/C,OAAO,GAAG,EAAE;YACX,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAA;YAC1D,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QACnD,CAAC,CAAA;IACF,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEV,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,MAAM;QAAE,OAAO,IAAI,CAAA;IAE7D,OAAO,CACN,kBAAQ,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,aAC3D,eAAK,SAAS,EAAC,yBAAyB,aACtC,QAAQ,EACR,MAAM,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,uBAAuB,YAAE,MAAM,GAAQ,CAAC,CAAC,CAAC,IAAI,IACnE,EAEL,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CACtB,eAAK,SAAS,EAAC,wBAAwB,aACrC,IAAI,CAAC,CAAC,CAAC,CACP,cAAK,SAAS,EAAC,wBAAwB,EAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAC,OAAO,gBAAY,kBAAkB,YAC/F,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAElC,eAAkB,SAAS,EAAC,uBAAuB,YACjD,KAAK,IADI,KAAK,CAET,CACP,CAAC,GACG,CACN,CAAC,CAAC,CAAC,IAAI,EAER,iBACC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,mCAAmC,mBAC9B,IAAI,mBACJ,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAC3C,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,YAExC,gBAAgB,GACT,IACJ,CACN,CAAC,CAAC,CAAC,IAAI,IACA,CACT,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `<MapProgressBar>` — the loading bar pinned across the top of the viewport.
|
|
7
|
+
*
|
|
8
|
+
* Loading a 38 MB model is a page-level event, not a control-level one, so it reports at the page's edge rather than
|
|
9
|
+
* inside the search field: a spinner in the field resizes the one control a visitor is trying to type into, and a
|
|
10
|
+
* staged list in the result sheet claims the space an answer will need.
|
|
11
|
+
*
|
|
12
|
+
* It reports a FRACTION when the loader names its steps and runs indeterminate when it does not, because a bar that
|
|
13
|
+
* invents a percentage is worse than one that admits it is only saying "still working".
|
|
14
|
+
*
|
|
15
|
+
* NODE-SAFE: pure React, no maplibre.
|
|
16
|
+
*/
|
|
17
|
+
import type { ReactNode } from "react";
|
|
18
|
+
export interface MapProgressBarProps {
|
|
19
|
+
/**
|
|
20
|
+
* Whether the bar is showing at all. It stays mounted through its fade rather than unmounting on the transition.
|
|
21
|
+
*/
|
|
22
|
+
active: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Completed steps over total steps, in [0, 1]. Omit for work whose length is unknown.
|
|
25
|
+
*/
|
|
26
|
+
fraction?: number | null;
|
|
27
|
+
/**
|
|
28
|
+
* The bar's accessible name — what is loading, in a few words.
|
|
29
|
+
*/
|
|
30
|
+
label: string;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function MapProgressBar({ active, fraction, label, className }: MapProgressBarProps): ReactNode;
|
|
34
|
+
//# sourceMappingURL=MapProgressBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapProgressBar.d.ts","sourceRoot":"","sources":["../../lib/map/MapProgressBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,mBAAmB,GAAG,SAAS,CAoBrG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "#common/cx";
|
|
3
|
+
export function MapProgressBar({ active, fraction, label, className }) {
|
|
4
|
+
const determinate = typeof fraction === "number" && Number.isFinite(fraction);
|
|
5
|
+
const clamped = determinate ? Math.min(1, Math.max(0, fraction)) : 0;
|
|
6
|
+
return (_jsx("div", { className: cx("mw-map-progress", !active && "mw-map-progress--idle", className), role: "progressbar", "aria-label": label, "aria-hidden": !active, "aria-valuemin": determinate ? 0 : undefined, "aria-valuemax": determinate ? 100 : undefined, "aria-valuenow": determinate ? Math.round(clamped * 100) : undefined, children: _jsx("div", { className: cx("mw-map-progress__fill", !determinate && "mw-map-progress__fill--indeterminate"), style: determinate ? { transform: `scaleX(${clamped})` } : undefined }) }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=MapProgressBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapProgressBar.js","sourceRoot":"","sources":["../../lib/map/MapProgressBar.tsx"],"names":[],"mappings":";AAmBA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAkB/B,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAuB;IACzF,MAAM,WAAW,GAAG,OAAO,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAC7E,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEpE,OAAO,CACN,cACC,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,CAAC,MAAM,IAAI,uBAAuB,EAAE,SAAS,CAAC,EAC/E,IAAI,EAAC,aAAa,gBACN,KAAK,iBACJ,CAAC,MAAM,mBACL,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,mBAC3B,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,mBAC7B,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,YAElE,cACC,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,CAAC,WAAW,IAAI,sCAAsC,CAAC,EAC9F,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,GACnE,GACG,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `<MapSearchBar>` — the floating search pill that sits over a map. Presentational only: it supplies the glass
|
|
7
|
+
* material, the pill shape and the two icon slots, and the host supplies the input and whatever backend answers it.
|
|
8
|
+
* Earth searches an address through the geocoder runtime and the planetary apps search a nomenclature artifact, so
|
|
9
|
+
* nothing about the query belongs here.
|
|
10
|
+
*
|
|
11
|
+
* The slots are elements rather than icon names because a leading mark and a trailing control differ per app — a
|
|
12
|
+
* magnifier on one, a body glyph on another.
|
|
13
|
+
*
|
|
14
|
+
* BUSY IS A LINE, NOT A SLOT. A spinner placed in the trailing slot changed the pill's height on every submit,
|
|
15
|
+
* because a slot is laid out and an indicator is not part of the query. `busy` draws a hairline across the pill's
|
|
16
|
+
* lower edge instead, which costs no layout. A host that wants `type="search"` also gets the browser's own clear
|
|
17
|
+
* button in that corner, and two crosses side by side is one control too many.
|
|
18
|
+
*
|
|
19
|
+
* NODE-SAFE: pure React, no maplibre.
|
|
20
|
+
*/
|
|
21
|
+
import type { ReactNode } from "react";
|
|
22
|
+
export interface MapSearchBarProps {
|
|
23
|
+
/**
|
|
24
|
+
* The input (or combobox) the host owns. Rendered between the two slots.
|
|
25
|
+
*/
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Rendered before the input — a magnifier, a body mark, a back arrow.
|
|
29
|
+
*/
|
|
30
|
+
leading?: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Rendered after the input — a microphone, a menu. Not a spinner: pass {@link busy} instead.
|
|
33
|
+
*/
|
|
34
|
+
trailing?: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* A query is running. Draws a progress hairline along the pill's lower edge, which takes no layout.
|
|
37
|
+
*/
|
|
38
|
+
busy?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Extra class on the pill.
|
|
41
|
+
*/
|
|
42
|
+
className?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Accessible name for the surrounding region, when the bar is the app's primary search.
|
|
45
|
+
*/
|
|
46
|
+
label?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare function MapSearchBar({ children, leading, trailing, busy, className, label }: MapSearchBarProps): ReactNode;
|
|
49
|
+
//# sourceMappingURL=MapSearchBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapSearchBar.d.ts","sourceRoot":"","sources":["../../lib/map/MapSearchBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,iBAAiB,GAAG,SAAS,CAelH"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "#common/cx";
|
|
3
|
+
export function MapSearchBar({ children, leading, trailing, busy, className, label }) {
|
|
4
|
+
return (_jsxs("div", { className: cx("mw-map-searchbar", busy && "mw-map-searchbar--busy", className), role: label ? "search" : undefined, "aria-label": label, "aria-busy": busy, children: [leading ? _jsx("span", { className: "mw-map-searchbar__slot mw-map-searchbar__slot--leading", children: leading }) : null, _jsx("span", { className: "mw-map-searchbar__field", children: children }), trailing ? _jsx("span", { className: "mw-map-searchbar__slot mw-map-searchbar__slot--trailing", children: trailing }) : null] }));
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=MapSearchBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapSearchBar.js","sourceRoot":"","sources":["../../lib/map/MapSearchBar.tsx"],"names":[],"mappings":";AAuBA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AA6B/B,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAqB;IACtG,OAAO,CACN,eACC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,IAAI,IAAI,wBAAwB,EAAE,SAAS,CAAC,EAC9E,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,gBACtB,KAAK,eACN,IAAI,aAEd,OAAO,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,wDAAwD,YAAE,OAAO,GAAQ,CAAC,CAAC,CAAC,IAAI,EAE3G,eAAM,SAAS,EAAC,yBAAyB,YAAE,QAAQ,GAAQ,EAE1D,QAAQ,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,yDAAyD,YAAE,QAAQ,GAAQ,CAAC,CAAC,CAAC,IAAI,IACzG,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `<MapSheet>` — a side panel over the map: a title, a close button, and content.
|
|
7
|
+
*
|
|
8
|
+
* The close button is not optional. On a wide screen the control that opened the sheet stays visible beside it and
|
|
9
|
+
* could close it again, but on a phone the sheet is the whole panel and covers that control — so a sheet without its
|
|
10
|
+
* own close is a sheet a phone cannot dismiss. One component carries it so the four sheets in these apps cannot
|
|
11
|
+
* disagree about that.
|
|
12
|
+
*
|
|
13
|
+
* Escape closes it too, because a panel over the whole screen is a modal in every way that matters to someone
|
|
14
|
+
* holding a keyboard.
|
|
15
|
+
*
|
|
16
|
+
* NODE-SAFE: pure React, no maplibre.
|
|
17
|
+
*/
|
|
18
|
+
import { type ReactNode } from "react";
|
|
19
|
+
export interface MapSheetProps {
|
|
20
|
+
/**
|
|
21
|
+
* The sheet's heading, and its accessible name.
|
|
22
|
+
*/
|
|
23
|
+
title: string;
|
|
24
|
+
/**
|
|
25
|
+
* Dismiss the sheet.
|
|
26
|
+
*/
|
|
27
|
+
onClose: () => void;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function MapSheet({ title, onClose, children, className }: MapSheetProps): ReactNode;
|
|
32
|
+
//# sourceMappingURL=MapSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapSheet.d.ts","sourceRoot":"","sources":["../../lib/map/MapSheet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAA;AAIjD,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,aAAa,GAAG,SAAS,CA0B1F"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @copyright Sister Software
|
|
4
|
+
* @license AGPL-3.0
|
|
5
|
+
* @author Teffen Ellis, et al.
|
|
6
|
+
*
|
|
7
|
+
* `<MapSheet>` — a side panel over the map: a title, a close button, and content.
|
|
8
|
+
*
|
|
9
|
+
* The close button is not optional. On a wide screen the control that opened the sheet stays visible beside it and
|
|
10
|
+
* could close it again, but on a phone the sheet is the whole panel and covers that control — so a sheet without its
|
|
11
|
+
* own close is a sheet a phone cannot dismiss. One component carries it so the four sheets in these apps cannot
|
|
12
|
+
* disagree about that.
|
|
13
|
+
*
|
|
14
|
+
* Escape closes it too, because a panel over the whole screen is a modal in every way that matters to someone
|
|
15
|
+
* holding a keyboard.
|
|
16
|
+
*
|
|
17
|
+
* NODE-SAFE: pure React, no maplibre.
|
|
18
|
+
*/
|
|
19
|
+
import { useEffect } from "react";
|
|
20
|
+
import { cx } from "#common/cx";
|
|
21
|
+
export function MapSheet({ title, onClose, children, className }) {
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const onKeyDown = (event) => {
|
|
24
|
+
if (event.key === "Escape") {
|
|
25
|
+
onClose();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
document.addEventListener("keydown", onKeyDown);
|
|
29
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
30
|
+
}, [onClose]);
|
|
31
|
+
return (_jsxs("aside", { className: cx("mw-map-sheet mw-map-sheet--side", className), "aria-label": title, children: [_jsxs("div", { className: "mw-map-sheet__header", children: [_jsx("h2", { className: "mw-map-sheet__title", children: title }), _jsx("button", { type: "button", className: "mw-map-sheet__close", "aria-label": `Close ${title}`, onClick: onClose, children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) })] }), _jsx("div", { className: "mw-map-sheet__body", children: children })] }));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=MapSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapSheet.js","sourceRoot":"","sources":["../../lib/map/MapSheet.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAkB,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjD,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAe/B,MAAM,UAAU,QAAQ,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAiB;IAC9E,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,SAAS,GAAG,CAAC,KAAoB,EAAE,EAAE;YAC1C,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;gBAC5B,OAAO,EAAE,CAAA;YACV,CAAC;QACF,CAAC,CAAA;QAED,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QAE/C,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IAChE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAEb,OAAO,CACN,iBAAO,SAAS,EAAE,EAAE,CAAC,iCAAiC,EAAE,SAAS,CAAC,gBAAc,KAAK,aACpF,eAAK,SAAS,EAAC,sBAAsB,aACpC,aAAI,SAAS,EAAC,qBAAqB,YAAE,KAAK,GAAM,EAEhD,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,qBAAqB,gBAAa,SAAS,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,YACnG,8BAAkB,MAAM,uBAAS,GACzB,IACJ,EAEN,cAAK,SAAS,EAAC,oBAAoB,YAAE,QAAQ,GAAO,IAC7C,CACR,CAAA;AACF,CAAC"}
|
package/out/map/OverlayLayers.js
CHANGED