@road-labs/map-sdk 0.0.28-rc.7 → 0.0.28-rc.8
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 +21 -2
- package/dist/components/Pin/Pin.d.ts +15 -0
- package/dist/i18n.d.ts +3 -2
- package/dist/index.js +109 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3321 -2737
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/pinState.d.ts +41 -0
- package/dist/utils/pinState.test.d.ts +1 -0
- package/dist/utils/status.d.ts +16 -2
- package/dist/utils/statusFilters.d.ts +1 -1
- package/dist/utils/version.d.ts +3 -0
- package/dist/utils/version.test.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ The `App` component accepts the following props:
|
|
|
31
31
|
| `height` | Yes | Both | Both | Height of the map container in pixels. | `-` |
|
|
32
32
|
| `gestureHandling` | Yes | Both | Both | Google Maps SDK parameter controlling how gestures (scroll, pinch, etc.) interact with the map. Allowed values: `greedy`, `cooperative`, `none`, `auto`. We suggest a default value of `greedy`. | `-` |
|
|
33
33
|
| `authorization` | Yes | v2 | Both | The public map key. Besides granting access it decides what kind of map this is: its remote configuration carries the context (`cpo` or `msp`), the operators, publishing modes and Google Maps key. The context is never passed as a prop. On `cpo` maps the widget uses the `/1/map/cpo/*` endpoints, draws locations individually while the view holds at most 1000 of them, and colours pins and filters by the OCPP status the station reports (Faulted red, Unavailable amber, in-session blue, Available green, no report grey, a fault outranking everything else on a pin). `msp` maps keep the clustering, filters and colours the mobile apps use. | `-` |
|
|
34
|
-
| `version` | No | Both | Both | Which
|
|
34
|
+
| `version` | No | Both | Both | Which behaviour set the widget runs. `v1` is the legacy widget. `v2` authenticates with the map key, loads its remote configuration and shows the v2 details view. `v3` keeps everything in `v2` and draws the redesigned pins described under [Pins](#pins-v3); it also sends `version: v3` to the API, which then counts a bucket's statuses per EVSE (per connector on `cpo` maps) instead of per location. | `v1` |
|
|
35
35
|
| `language` | No | Both | Both | Language of the widget. Supported values: `en`, `nl`, `de`, `fr`, `it`, `es` and their regional variants (e.g. `nl-NL`, `de-AT`), matched case-insensitively. Unsupported values fall back to `en`. If nothing is set, the browser language is used. | Browser language |
|
|
36
36
|
| `position {lat,lng}` | No | Both | Both | Initial latitude/longitude to center the map on load. If not provided, defaults to visitor's IP-based location. | Visitor IP location |
|
|
37
37
|
| `useBrowserLocation` | No | Both | Both | Use the browser location to center the map. | `false` |
|
|
@@ -51,7 +51,7 @@ The `App` component accepts the following props:
|
|
|
51
51
|
| `showNoAdditionalFeeFilter` | No | v2 | msp | Used to configure whether we enable the user to filter out stations that come with additional fees. | `false` |
|
|
52
52
|
| `showPublishingModeFilter` | No | v2 | cpo | Used to configure whether we enable the user to filter out public or private stations. | `false` |
|
|
53
53
|
| `showOperatorOnly` | No | v2 | both | String value representing the operator name. Include a quick filter option to find a specific operator. | `-` |
|
|
54
|
-
| `showAnalytics` | No | v2 | Both | Shows status
|
|
54
|
+
| `showAnalytics` | No | v2 | Both | Shows a status pill next to the filter toggle for the current view and filters. On `msp` maps it lists EVSEs by roaming status. On `cpo` maps it defaults to connectors by the OCPP status the station reports, with an `EVSE Status \| Roaming Status` switch under the pill to flip to the roaming breakdown; only one shows at a time. Clicking a status toggles the matching status filter (the OCPP view on `cpo` maps, the roaming view on `msp` maps) and the selected statuses are highlighted; the roaming view on a `cpo` map is read-only because the CPO search filters on OCPP status. The counts ignore the status selection so every status in the view stays listed; all other filters apply. Fetched from `/1/map/analytics` (`/1/map/cpo/analytics` on `cpo` maps) whenever the view or filters change. Hidden on screens narrower than 768px. | `false` |
|
|
55
55
|
| `onMarkerClicked` | No | Both | Both | Callback function that is called when a marker is clicked. Receives an object with `ids` property containing the location IDs. | `-` |
|
|
56
56
|
|
|
57
57
|
### Example
|
|
@@ -84,6 +84,25 @@ function MyMap() {
|
|
|
84
84
|
|
|
85
85
|
**Note**: The `height`, `gestureHandling` and `authorization` props are required. All other props are optional. The map context (`cpo` or `msp`) is not a prop; it comes from the map key's remote configuration.
|
|
86
86
|
|
|
87
|
+
### Pins (v3)
|
|
88
|
+
|
|
89
|
+
With `version: "v3"` every location is a white teardrop anchored on its tail tip. Colour carries availability only and every state also has its own glyph, so the map still reads in greyscale:
|
|
90
|
+
|
|
91
|
+
| Pin | `msp` maps (EVSEs) | `cpo` maps (connectors) |
|
|
92
|
+
| :-- | :-- | :-- |
|
|
93
|
+
| Green ring, bolt | every EVSE free | every connector free |
|
|
94
|
+
| Green ring, `free/total` | some free, the rest out of order | some free, the rest unknown |
|
|
95
|
+
| Any ring, `free/total` | whatever else is going on, a free unit is always shown as a count | same |
|
|
96
|
+
| Amber ring, `free/total` | a session is running on at least one EVSE; the digits say how many are still free | at least one connector is taken out of service (`Unavailable`) |
|
|
97
|
+
| Blue ring, `free/total` | not used | a session is running (`Preparing`, `Charging`, `Suspended`, `Finishing`, `Reserved`) |
|
|
98
|
+
| Red ring, `free/total` or `!` | not used | at least one connector reports `Faulted`; the digits stay while anything is free, the `!` shows when nothing is |
|
|
99
|
+
| Grey ring, dash | nothing usable (`Inoperative`, `Out of order`, `Blocked`, `Closed`) or nothing reported | nothing reported |
|
|
100
|
+
| Dashed grey, `+` | every EVSE is `Planned` | not used |
|
|
101
|
+
|
|
102
|
+
The pin of the location open in the sidebar grows to 52px with a halo; the tail tip stays put. Below zoom 12 single pins shrink to a 26px dot without a glyph. Clusters of up to nine locations are a pin with two ghost pins behind it and the count as glyph; larger clusters are a circle with the count and a caption. A cluster whose locations are not all in the same state gets a ring split by that state, in proportion. On `msp` maps a cluster is green as soon as anything inside it is free; on `cpo` maps the operator priority above applies (fault, unavailable, in session, free).
|
|
103
|
+
|
|
104
|
+
The status pills and the status filter use the same colours as the pins on a `v3` map. Filters, clustering and the sidebar are unchanged.
|
|
105
|
+
|
|
87
106
|
### Theming with Shadow DOM
|
|
88
107
|
|
|
89
108
|
The theming options (`brandColor`, `backgroundColor`, `textColor`, `borderColor`, `fontFamily`) require the SDK to be rendered within a Shadow DOM context. This provides style encapsulation, preventing the map's styles from conflicting with your application's styles and vice versa.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { GeohashItem, MapKind } from '../../types';
|
|
3
|
+
export declare const pinStylesheet = "\n.roadmap-pin {\n position: absolute;\n left: 0;\n top: 0;\n display: block;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n -webkit-appearance: none;\n appearance: none;\n cursor: pointer;\n font-family: var(--roadmap-font-family, Inter), system-ui, -apple-system, sans-serif;\n animation: roadmap-pin-in 0.18s ease-out both;\n}\n.roadmap-pin:focus-visible {\n outline: none;\n}\n.roadmap-pin-body {\n position: absolute;\n inset: 0;\n box-sizing: border-box;\n border-radius: 50% 50% 50% 0;\n border: 3px solid currentColor;\n background: #fff;\n transform: rotate(-45deg);\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.12s ease, box-shadow 0.12s ease;\n}\n.roadmap-pin:hover .roadmap-pin-body {\n transform: rotate(-45deg) scale(1.06);\n}\n.roadmap-pin-ghost {\n position: absolute;\n box-sizing: border-box;\n border-radius: 50% 50% 50% 0;\n border: 2px solid;\n transform: rotate(-45deg);\n}\n.roadmap-pin-glyph {\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(45deg);\n line-height: 1;\n white-space: nowrap;\n font-family: \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-weight: 500;\n}\n.roadmap-pin-circle,\n.roadmap-pin-ring {\n position: absolute;\n inset: 0;\n box-sizing: border-box;\n border-radius: 50%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n line-height: 1;\n transition: transform 0.12s ease;\n}\n.roadmap-pin-circle {\n background: #fff;\n border: 3px solid currentColor;\n}\n.roadmap-pin:hover .roadmap-pin-circle,\n.roadmap-pin:hover .roadmap-pin-ring {\n transform: scale(1.06);\n}\n.roadmap-pin-ring-inner {\n width: calc(100% - 12px);\n height: calc(100% - 12px);\n border-radius: 50%;\n background: #fff;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.roadmap-pin-count {\n font-family: \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-weight: 500;\n line-height: 1;\n}\n.roadmap-pin-label {\n margin-top: 2px;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n line-height: 1;\n}\n@keyframes roadmap-pin-in {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: none; }\n}\n";
|
|
4
|
+
export declare function PinStyles(): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
interface Props {
|
|
6
|
+
data: GeohashItem;
|
|
7
|
+
map?: google.maps.Map;
|
|
8
|
+
kind: MapKind;
|
|
9
|
+
onClick: (payload: GeohashItem) => void;
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
compact?: boolean;
|
|
12
|
+
sitesLabel: string;
|
|
13
|
+
}
|
|
14
|
+
declare const Pin: React.FC<Props>;
|
|
15
|
+
export default Pin;
|
package/dist/i18n.d.ts
CHANGED
|
@@ -55,8 +55,9 @@ export type LabelsType = {
|
|
|
55
55
|
"ocpp.statusSuspendedEv": string;
|
|
56
56
|
"ocpp.statusFinishing": string;
|
|
57
57
|
"ocpp.statusFaulted": string;
|
|
58
|
-
"analytics.
|
|
59
|
-
"analytics.
|
|
58
|
+
"analytics.evseStatus": string;
|
|
59
|
+
"analytics.roamingStatus": string;
|
|
60
|
+
"pin.sites": string;
|
|
60
61
|
"filters.chargingAccessibility": string;
|
|
61
62
|
"filters.accessibilityAll": string;
|
|
62
63
|
"filters.accessibilityTesla": string;
|