radar-sdk-js 4.3.1-beta.2 → 4.3.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 +7 -7
- package/dist/radar.js +14 -9
- package/dist/radar.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/ui/RadarMarker.ts +17 -6
- package/src/ui/autocomplete.ts +3 -3
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Radar.initialize('prj_test_pk_...', { /* options */ });
|
|
|
56
56
|
|
|
57
57
|
Add the following script in your `html` file
|
|
58
58
|
```html
|
|
59
|
-
<script src="https://js.radar.com/v4.3.1
|
|
59
|
+
<script src="https://js.radar.com/v4.3.1/radar.min.js"></script>
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Then initialize the Radar SDK
|
|
@@ -73,8 +73,8 @@ To create a map, first initialize the Radar SDK with your publishable key. Then
|
|
|
73
73
|
```html
|
|
74
74
|
<html>
|
|
75
75
|
<head>
|
|
76
|
-
<link href="https://js.radar.com/v4.3.1
|
|
77
|
-
<script src="https://js.radar.com/v4.3.1
|
|
76
|
+
<link href="https://js.radar.com/v4.3.1/radar.css" rel="stylesheet">
|
|
77
|
+
<script src="https://js.radar.com/v4.3.1/radar.min.js"></script>
|
|
78
78
|
</head>
|
|
79
79
|
|
|
80
80
|
<body>
|
|
@@ -98,8 +98,8 @@ To create an autocomplete input, first initialize the Radar SDK with your publis
|
|
|
98
98
|
```html
|
|
99
99
|
<html>
|
|
100
100
|
<head>
|
|
101
|
-
<link href="https://js.radar.com/v4.3.1
|
|
102
|
-
<script src="https://js.radar.com/v4.3.1
|
|
101
|
+
<link href="https://js.radar.com/v4.3.1/radar.css" rel="stylesheet">
|
|
102
|
+
<script src="https://js.radar.com/v4.3.1/radar.min.js"></script>
|
|
103
103
|
</head>
|
|
104
104
|
|
|
105
105
|
<body>
|
|
@@ -130,8 +130,8 @@ To power [geofencing](https://radar.com/documentation/geofencing/overview) exper
|
|
|
130
130
|
```html
|
|
131
131
|
<html>
|
|
132
132
|
<head>
|
|
133
|
-
<link href="https://js.radar.com/v4.3.1
|
|
134
|
-
<script src="https://js.radar.com/v4.3.1
|
|
133
|
+
<link href="https://js.radar.com/v4.3.1/radar.css" rel="stylesheet">
|
|
134
|
+
<script src="https://js.radar.com/v4.3.1/radar.min.js"></script>
|
|
135
135
|
</head>
|
|
136
136
|
|
|
137
137
|
<body>
|
package/dist/radar.js
CHANGED
|
@@ -405,7 +405,7 @@ class Navigator {
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
-
var SDK_VERSION = '4.3.1
|
|
408
|
+
var SDK_VERSION = '4.3.1';
|
|
409
409
|
|
|
410
410
|
class Http {
|
|
411
411
|
static request({ method, path, data, host, version, headers = {}, responseType, }) {
|
|
@@ -1568,6 +1568,15 @@ class RadarMap extends maplibregl.Map {
|
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
|
+
class RadarMarkerMouseEvent {
|
|
1572
|
+
constructor(type, marker, originalEvent) {
|
|
1573
|
+
this.target = marker;
|
|
1574
|
+
this.originalEvent = originalEvent;
|
|
1575
|
+
this.point = marker._pos;
|
|
1576
|
+
this.lngLat = marker.getLngLat();
|
|
1577
|
+
this.type = type;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1571
1580
|
const createImageElement = (options) => {
|
|
1572
1581
|
const element = document.createElement('img');
|
|
1573
1582
|
element.src = options.url;
|
|
@@ -1685,11 +1694,7 @@ class RadarMarker extends maplibregl.Marker {
|
|
|
1685
1694
|
const element = this.getElement();
|
|
1686
1695
|
if (element) {
|
|
1687
1696
|
element.addEventListener('click', (e) => {
|
|
1688
|
-
|
|
1689
|
-
if (this._popup) {
|
|
1690
|
-
this.togglePopup();
|
|
1691
|
-
}
|
|
1692
|
-
this.fire('click', e);
|
|
1697
|
+
this.fire('click', new RadarMarkerMouseEvent('click', this, e));
|
|
1693
1698
|
});
|
|
1694
1699
|
}
|
|
1695
1700
|
}
|
|
@@ -1820,7 +1825,7 @@ class AutocompleteUI {
|
|
|
1820
1825
|
// result list element
|
|
1821
1826
|
this.resultsList = document.createElement('ul');
|
|
1822
1827
|
this.resultsList.classList.add(CLASSNAMES.RESULTS_LIST);
|
|
1823
|
-
this.resultsList.
|
|
1828
|
+
this.resultsList.setAttribute('id', CLASSNAMES.RESULTS_LIST);
|
|
1824
1829
|
this.resultsList.setAttribute('role', 'listbox');
|
|
1825
1830
|
this.resultsList.setAttribute('aria-live', 'polite');
|
|
1826
1831
|
this.resultsList.setAttribute('aria-label', 'Search results');
|
|
@@ -1951,7 +1956,7 @@ class AutocompleteUI {
|
|
|
1951
1956
|
const li = document.createElement('li');
|
|
1952
1957
|
li.classList.add(CLASSNAMES.RESULTS_ITEM);
|
|
1953
1958
|
li.setAttribute('role', 'option');
|
|
1954
|
-
li.setAttribute('id',
|
|
1959
|
+
li.setAttribute('id', `${CLASSNAMES.RESULTS_ITEM}}-${index}`);
|
|
1955
1960
|
// construct result with bolded label
|
|
1956
1961
|
let listContent;
|
|
1957
1962
|
if (result.formattedAddress.includes(result.addressLabel) && result.layer !== 'postalCode') {
|
|
@@ -2042,7 +2047,7 @@ class AutocompleteUI {
|
|
|
2042
2047
|
// add class name to newly highlighted item
|
|
2043
2048
|
resultItems[index].classList.add(CLASSNAMES.SELECTED_ITEM);
|
|
2044
2049
|
// set aria active descendant
|
|
2045
|
-
this.inputField.setAttribute('aria-activedescendant',
|
|
2050
|
+
this.inputField.setAttribute('aria-activedescendant', `${CLASSNAMES.RESULTS_ITEM}-${index}`);
|
|
2046
2051
|
this.highlightedIndex = index;
|
|
2047
2052
|
}
|
|
2048
2053
|
handleKeyboardNavigation(event) {
|
package/dist/radar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radar.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.3.1
|
|
1
|
+
declare const _default: "4.3.1";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
package/src/ui/RadarMarker.ts
CHANGED
|
@@ -7,13 +7,28 @@ import type RadarMap from './RadarMap';
|
|
|
7
7
|
|
|
8
8
|
import type { RadarMarkerOptions } from '../types';
|
|
9
9
|
|
|
10
|
+
class RadarMarkerMouseEvent {
|
|
11
|
+
type: 'click';
|
|
12
|
+
target: RadarMarker;
|
|
13
|
+
originalEvent: MouseEvent;
|
|
14
|
+
lngLat: maplibregl.LngLat;
|
|
15
|
+
point: maplibregl.Point2D;
|
|
16
|
+
|
|
17
|
+
constructor(type: 'click', marker: RadarMarker, originalEvent: MouseEvent) {
|
|
18
|
+
this.target = marker;
|
|
19
|
+
this.originalEvent = originalEvent;
|
|
20
|
+
this.point = marker._pos;
|
|
21
|
+
this.lngLat = marker.getLngLat();
|
|
22
|
+
this.type = type;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
10
26
|
interface ImageOptions {
|
|
11
27
|
url?: string;
|
|
12
28
|
width?: number | string;
|
|
13
29
|
height?: number | string;
|
|
14
30
|
}
|
|
15
31
|
|
|
16
|
-
|
|
17
32
|
const createImageElement = (options: ImageOptions) => {
|
|
18
33
|
const element = document.createElement('img');
|
|
19
34
|
element.src = options.url!;
|
|
@@ -145,11 +160,7 @@ class RadarMarker extends maplibregl.Marker {
|
|
|
145
160
|
const element = this.getElement();
|
|
146
161
|
if (element) {
|
|
147
162
|
element.addEventListener('click', (e) => {
|
|
148
|
-
|
|
149
|
-
if (this._popup) {
|
|
150
|
-
this.togglePopup();
|
|
151
|
-
}
|
|
152
|
-
this.fire('click', e);
|
|
163
|
+
this.fire('click', new RadarMarkerMouseEvent('click', this, e));
|
|
153
164
|
});
|
|
154
165
|
}
|
|
155
166
|
}
|
package/src/ui/autocomplete.ts
CHANGED
|
@@ -132,7 +132,7 @@ class AutocompleteUI {
|
|
|
132
132
|
// result list element
|
|
133
133
|
this.resultsList = document.createElement('ul');
|
|
134
134
|
this.resultsList.classList.add(CLASSNAMES.RESULTS_LIST);
|
|
135
|
-
this.resultsList.
|
|
135
|
+
this.resultsList.setAttribute('id', CLASSNAMES.RESULTS_LIST);
|
|
136
136
|
this.resultsList.setAttribute('role', 'listbox');
|
|
137
137
|
this.resultsList.setAttribute('aria-live', 'polite');
|
|
138
138
|
this.resultsList.setAttribute('aria-label', 'Search results');
|
|
@@ -284,7 +284,7 @@ class AutocompleteUI {
|
|
|
284
284
|
const li = document.createElement('li');
|
|
285
285
|
li.classList.add(CLASSNAMES.RESULTS_ITEM);
|
|
286
286
|
li.setAttribute('role', 'option');
|
|
287
|
-
li.setAttribute('id',
|
|
287
|
+
li.setAttribute('id', `${CLASSNAMES.RESULTS_ITEM}}-${index}`);
|
|
288
288
|
|
|
289
289
|
// construct result with bolded label
|
|
290
290
|
let listContent;
|
|
@@ -392,7 +392,7 @@ class AutocompleteUI {
|
|
|
392
392
|
resultItems[index].classList.add(CLASSNAMES.SELECTED_ITEM);
|
|
393
393
|
|
|
394
394
|
// set aria active descendant
|
|
395
|
-
this.inputField.setAttribute('aria-activedescendant',
|
|
395
|
+
this.inputField.setAttribute('aria-activedescendant', `${CLASSNAMES.RESULTS_ITEM}-${index}`);
|
|
396
396
|
|
|
397
397
|
this.highlightedIndex = index;
|
|
398
398
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.3.1
|
|
1
|
+
export default '4.3.1';
|