@cashub/ui 0.19.2 → 0.19.3

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.
@@ -7,12 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9
9
 
10
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
-
12
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
13
-
14
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
15
-
16
10
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
17
11
 
18
12
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
@@ -29,94 +23,108 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
29
23
 
30
24
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
25
 
26
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27
+
28
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
+
30
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31
+
32
32
  // custom popup
33
33
  // https://developers.google.com/maps/documentation/javascript/examples/overlay-popup
34
- var GoogleMapPopup = /*#__PURE__*/function (_window$google$maps$O) {
35
- _inherits(GoogleMapPopup, _window$google$maps$O);
34
+ var GoogleMapPopup = /*#__PURE__*/_createClass(function GoogleMapPopup(options) {
35
+ _classCallCheck(this, GoogleMapPopup);
36
36
 
37
- var _super = _createSuper(GoogleMapPopup);
37
+ // wrap class to prevent cannot reference maps during bundler / compile stage
38
+ // because google map library will load after render map only
39
+ var MapPopup = /*#__PURE__*/function (_window$google$maps$O) {
40
+ _inherits(MapPopup, _window$google$maps$O);
38
41
 
39
- function GoogleMapPopup() {
40
- var _this;
42
+ var _super = _createSuper(MapPopup);
41
43
 
42
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
43
- maxWidth = _ref.maxWidth,
44
- offset = _ref.offset;
44
+ function MapPopup() {
45
+ var _this;
45
46
 
46
- _classCallCheck(this, GoogleMapPopup);
47
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
48
+ maxWidth = _ref.maxWidth,
49
+ offset = _ref.offset;
47
50
 
48
- _this = _super.call(this); // This zero-height div is positioned at the bottom of the tip.
51
+ _classCallCheck(this, MapPopup);
49
52
 
50
- _defineProperty(_assertThisInitialized(_this), "position", void 0);
53
+ _this = _super.call(this); // This zero-height div is positioned at the bottom of the tip.
51
54
 
52
- _defineProperty(_assertThisInitialized(_this), "containerDiv", void 0);
55
+ _defineProperty(_assertThisInitialized(_this), "position", void 0);
53
56
 
54
- _defineProperty(_assertThisInitialized(_this), "offset", 16);
57
+ _defineProperty(_assertThisInitialized(_this), "containerDiv", void 0);
55
58
 
56
- _this.containerDiv = document.createElement('div');
59
+ _defineProperty(_assertThisInitialized(_this), "offset", 16);
57
60
 
58
- _this.containerDiv.classList.add('google-popup-content-wrapper');
61
+ _this.containerDiv = document.createElement('div');
59
62
 
60
- if (maxWidth) {
61
- _this.containerDiv.style.maxWidth = "".concat(maxWidth, "px");
62
- }
63
-
64
- if (offset) {
65
- _this.offset = offset;
66
- } // Optionally stop clicks, etc., from bubbling up to the map.
63
+ _this.containerDiv.classList.add('google-popup-content-wrapper');
67
64
 
65
+ if (maxWidth) {
66
+ _this.containerDiv.style.maxWidth = "".concat(maxWidth, "px");
67
+ }
68
68
 
69
- GoogleMapPopup.preventMapHitsAndGesturesFrom(_this.containerDiv);
70
- return _this;
71
- }
72
- /** Called when the popup is added to the map. */
69
+ if (offset) {
70
+ _this.offset = offset;
71
+ } // Optionally stop clicks, etc., from bubbling up to the map.
73
72
 
74
73
 
75
- _createClass(GoogleMapPopup, [{
76
- key: "onAdd",
77
- value: function onAdd() {
78
- this.getPanes().floatPane.appendChild(this.containerDiv);
74
+ MapPopup.preventMapHitsAndGesturesFrom(_this.containerDiv);
75
+ return _this;
79
76
  }
80
- /** Called when the popup is removed from the map. */
77
+ /** Called when the popup is added to the map. */
81
78
 
82
- }, {
83
- key: "onRemove",
84
- value: function onRemove() {
85
- if (this.containerDiv.parentElement) {
86
- this.containerDiv.parentElement.removeChild(this.containerDiv);
79
+
80
+ _createClass(MapPopup, [{
81
+ key: "onAdd",
82
+ value: function onAdd() {
83
+ this.getPanes().floatPane.appendChild(this.containerDiv);
87
84
  }
88
- }
89
- /** Called each frame when the popup needs to draw itself. */
90
-
91
- }, {
92
- key: "draw",
93
- value: function draw() {
94
- if (this.position) {
95
- var divPosition = this.getProjection().fromLatLngToDivPixel(this.position);
96
- this.containerDiv.style.left = "".concat(divPosition.x, "px");
97
- this.containerDiv.style.top = "".concat(divPosition.y - this.offset, "px");
85
+ /** Called when the popup is removed from the map. */
86
+
87
+ }, {
88
+ key: "onRemove",
89
+ value: function onRemove() {
90
+ if (this.containerDiv.parentElement) {
91
+ this.containerDiv.parentElement.removeChild(this.containerDiv);
92
+ }
98
93
  }
99
- }
100
- }, {
101
- key: "setPosition",
102
- value: function setPosition(position) {
103
- this.position = position;
104
- }
105
- }, {
106
- key: "setContent",
107
- value: function setContent(content) {
108
- if (!content) return;
109
-
110
- if (_typeof(content) === 'object') {
111
- this.containerDiv.replaceChildren(content);
112
- } else {
113
- this.containerDiv.innerHTML = content;
94
+ /** Called each frame when the popup needs to draw itself. */
95
+
96
+ }, {
97
+ key: "draw",
98
+ value: function draw() {
99
+ if (this.position) {
100
+ var divPosition = this.getProjection().fromLatLngToDivPixel(this.position);
101
+ this.containerDiv.style.left = "".concat(divPosition.x, "px");
102
+ this.containerDiv.style.top = "".concat(divPosition.y - this.offset, "px");
103
+ }
114
104
  }
115
- }
116
- }]);
105
+ }, {
106
+ key: "setPosition",
107
+ value: function setPosition(position) {
108
+ this.position = position;
109
+ }
110
+ }, {
111
+ key: "setContent",
112
+ value: function setContent(content) {
113
+ if (!content) return;
114
+
115
+ if (_typeof(content) === 'object') {
116
+ this.containerDiv.replaceChildren(content);
117
+ } else {
118
+ this.containerDiv.innerHTML = content;
119
+ }
120
+ }
121
+ }]);
122
+
123
+ return MapPopup;
124
+ }(window.google.maps.OverlayView);
117
125
 
118
- return GoogleMapPopup;
119
- }(window.google.maps.OverlayView);
126
+ return new MapPopup(options);
127
+ });
120
128
 
121
129
  var _default = GoogleMapPopup;
122
130
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashub/ui",
3
- "version": "0.19.2",
3
+ "version": "0.19.3",
4
4
  "private": false,
5
5
  "author": "CASHUB Team",
6
6
  "description": "CASHUB UI components library",