radar-sdk-js 4.1.4 → 4.1.5

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 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.1.4/radar.min.js"></script>
59
+ <script src="https://js.radar.com/v4.1.5/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.1.4/radar.css" rel="stylesheet">
77
- <script src="https://js.radar.com/v4.1.4/radar.min.js"></script>
76
+ <link href="https://js.radar.com/v4.1.5/radar.css" rel="stylesheet">
77
+ <script src="https://js.radar.com/v4.1.5/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.1.4/radar.css" rel="stylesheet">
102
- <script src="https://js.radar.com/v4.1.4/radar.min.js"></script>
101
+ <link href="https://js.radar.com/v4.1.5/radar.css" rel="stylesheet">
102
+ <script src="https://js.radar.com/v4.1.5/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.1.4/radar.css" rel="stylesheet">
134
- <script src="https://js.radar.com/v4.1.4/radar.min.js"></script>
133
+ <link href="https://js.radar.com/v4.1.5/radar.css" rel="stylesheet">
134
+ <script src="https://js.radar.com/v4.1.5/radar.min.js"></script>
135
135
  </head>
136
136
 
137
137
  <body>
package/dist/radar.js CHANGED
@@ -565,7 +565,7 @@ var Navigator = /** @class */ (function () {
565
565
  return Navigator;
566
566
  }());
567
567
 
568
- var SDK_VERSION = '4.1.4';
568
+ var SDK_VERSION = '4.1.5';
569
569
 
570
570
  var Http = /** @class */ (function () {
571
571
  function Http() {
@@ -1696,6 +1696,12 @@ var MapUI = /** @class */ (function () {
1696
1696
  if (markerOptions.color) {
1697
1697
  maplibreOptions.color = markerOptions.color;
1698
1698
  }
1699
+ if (markerOptions.element) {
1700
+ maplibreOptions.element = markerOptions.element;
1701
+ }
1702
+ if (markerOptions.scale) {
1703
+ maplibreOptions.scale = markerOptions.scale;
1704
+ }
1699
1705
  var marker = new maplibregl.Marker(maplibreOptions);
1700
1706
  // set popup text or HTML
1701
1707
  if (markerOptions.text) {
@@ -1735,24 +1741,31 @@ var defaultAutocompleteOptions = {
1735
1741
  disabled: false,
1736
1742
  showMarkers: true,
1737
1743
  };
1738
- var DEFAULT_WIDTH = 400;
1739
- var formatWidth = function (width) {
1740
- if (typeof width === 'number') {
1741
- return "".concat(width, "px");
1744
+ // determine whether to use px or CSS string
1745
+ var formatCSSValue = function (value) {
1746
+ if (typeof value === 'number') {
1747
+ return "".concat(value, "px");
1742
1748
  }
1743
- return width;
1749
+ return value;
1744
1750
  };
1751
+ var DEFAULT_WIDTH = 400;
1745
1752
  var setWidth = function (input, options) {
1746
1753
  // if responsive and width is provided, treat it as maxWidth
1747
1754
  if (options.responsive) {
1748
1755
  input.style.width = '100%';
1749
1756
  if (options.width) {
1750
- input.style.maxWidth = formatWidth(options.width);
1757
+ input.style.maxWidth = formatCSSValue(options.width);
1751
1758
  }
1752
1759
  return;
1753
1760
  }
1754
1761
  // if not responsive, set fixed width
1755
- input.style.width = formatWidth(options.width || DEFAULT_WIDTH);
1762
+ input.style.width = formatCSSValue(options.width || DEFAULT_WIDTH);
1763
+ };
1764
+ var setHeight = function (resultsList, options) {
1765
+ if (options.maxHeight) {
1766
+ resultsList.style.maxHeight = formatCSSValue(options.maxHeight);
1767
+ resultsList.style.overflowY = 'auto'; /* allow overflow when maxHeight is applied */
1768
+ }
1756
1769
  };
1757
1770
  var getMarkerIcon = function (color) {
1758
1771
  if (color === void 0) { color = "#ACBDC8"; }
@@ -1797,6 +1810,7 @@ var AutocompleteUI = /** @class */ (function () {
1797
1810
  // result list element
1798
1811
  this.resultsList = document.createElement('ul');
1799
1812
  this.resultsList.classList.add(CLASSNAMES.RESULTS_LIST);
1813
+ setHeight(this.resultsList, this.config);
1800
1814
  if (containerEL.nodeName === 'INPUT') {
1801
1815
  // if an <input> element is provided, use that as the inputField,
1802
1816
  // and append the resultList to it's parent container
package/dist/radar.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"radar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/types.d.ts CHANGED
@@ -341,6 +341,8 @@ export interface RadarMarkerOptions {
341
341
  color?: string;
342
342
  text?: string;
343
343
  html?: string;
344
+ element?: HTMLElement;
345
+ scale?: number;
344
346
  }
345
347
  export interface RadarAutocompleteUIOptions {
346
348
  container: string | HTMLElement;
@@ -358,6 +360,7 @@ export interface RadarAutocompleteUIOptions {
358
360
  disabled?: boolean;
359
361
  responsive?: boolean;
360
362
  width?: string | number;
363
+ maxHeight?: string | number;
361
364
  showMarkers?: boolean;
362
365
  markerColor?: string;
363
366
  }
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "4.1.4";
1
+ declare const _default: "4.1.5";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radar-sdk-js",
3
- "version": "4.1.4",
3
+ "version": "4.1.5",
4
4
  "description": "Web Javascript SDK for Radar, location infrastructure for mobile and web apps.",
5
5
  "homepage": "https://radar.com",
6
6
  "type": "module",
package/src/types.ts CHANGED
@@ -455,6 +455,8 @@ export interface RadarMarkerOptions {
455
455
  color?: string;
456
456
  text?: string;
457
457
  html?: string;
458
+ element?: HTMLElement;
459
+ scale?: number;
458
460
  }
459
461
 
460
462
  export interface RadarAutocompleteUIOptions {
@@ -473,6 +475,7 @@ export interface RadarAutocompleteUIOptions {
473
475
  disabled?: boolean,
474
476
  responsive?: boolean;
475
477
  width?: string | number;
478
+ maxHeight?: string | number;
476
479
  showMarkers?: boolean;
477
480
  markerColor?: string;
478
481
  }
@@ -31,26 +31,34 @@ const defaultAutocompleteOptions: RadarAutocompleteUIOptions = {
31
31
  showMarkers: true,
32
32
  };
33
33
 
34
- const DEFAULT_WIDTH = 400;
35
- const formatWidth = (width: string | number) => {
36
- if (typeof width === 'number') {
37
- return `${width}px`;
34
+ // determine whether to use px or CSS string
35
+ const formatCSSValue = (value: string | number) => {
36
+ if (typeof value === 'number') {
37
+ return `${value}px`;
38
38
  }
39
- return width;
39
+ return value;
40
40
  };
41
41
 
42
+ const DEFAULT_WIDTH = 400;
42
43
  const setWidth = (input: HTMLElement, options: RadarAutocompleteUIOptions) => {
43
44
  // if responsive and width is provided, treat it as maxWidth
44
45
  if (options.responsive) {
45
46
  input.style.width = '100%';
46
47
  if (options.width) {
47
- input.style.maxWidth = formatWidth(options.width);
48
+ input.style.maxWidth = formatCSSValue(options.width);
48
49
  }
49
50
  return;
50
51
  }
51
52
 
52
53
  // if not responsive, set fixed width
53
- input.style.width = formatWidth(options.width || DEFAULT_WIDTH);
54
+ input.style.width = formatCSSValue(options.width || DEFAULT_WIDTH);
55
+ };
56
+
57
+ const setHeight = (resultsList: HTMLElement, options: RadarAutocompleteUIOptions) => {
58
+ if (options.maxHeight) {
59
+ resultsList.style.maxHeight = formatCSSValue(options.maxHeight);
60
+ resultsList.style.overflowY = 'auto'; /* allow overflow when maxHeight is applied */
61
+ }
54
62
  };
55
63
 
56
64
  const getMarkerIcon = (color: string = "#ACBDC8") => {
@@ -120,6 +128,7 @@ class AutocompleteUI {
120
128
  // result list element
121
129
  this.resultsList = document.createElement('ul');
122
130
  this.resultsList.classList.add(CLASSNAMES.RESULTS_LIST);
131
+ setHeight(this.resultsList, this.config);
123
132
 
124
133
  if (containerEL.nodeName === 'INPUT') {
125
134
  // if an <input> element is provided, use that as the inputField,
package/src/ui/map.ts CHANGED
@@ -133,6 +133,12 @@ class MapUI {
133
133
  if (markerOptions.color) {
134
134
  maplibreOptions.color = markerOptions.color;
135
135
  }
136
+ if (markerOptions.element) {
137
+ maplibreOptions.element = markerOptions.element;
138
+ }
139
+ if (markerOptions.scale) {
140
+ maplibreOptions.scale = markerOptions.scale;
141
+ }
136
142
 
137
143
  const marker = new maplibregl.Marker(maplibreOptions);
138
144
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '4.1.4';
1
+ export default '4.1.5';