@longline/aqua-ui 1.0.339 → 1.0.340

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.
Files changed (251) hide show
  1. package/containers/Anchor/Anchor.d.ts +5 -0
  2. package/containers/Anchor/Anchor.js +20 -8
  3. package/containers/Dock/Dock.d.ts +5 -0
  4. package/containers/Dock/Dock.js +1 -1
  5. package/containers/Dock/Dockable.d.ts +5 -0
  6. package/containers/Dock/Dockable.js +20 -12
  7. package/containers/DragBar/DragBar.d.ts +5 -0
  8. package/containers/DragBar/DragBar.js +16 -5
  9. package/containers/Form/Field.d.ts +0 -3
  10. package/containers/Form/Field.js +3 -6
  11. package/containers/Form/Form.js +5 -36
  12. package/containers/Form/Validation.d.ts +1 -1
  13. package/containers/Form/Validation.js +6 -6
  14. package/containers/Form/context/FormContext.d.ts +1 -2
  15. package/containers/Form/context/useForm.d.ts +1 -1
  16. package/containers/Form/elements/BoxWrapper.js +2 -0
  17. package/containers/GlassPane/GlassPane.d.ts +7 -2
  18. package/containers/GlassPane/GlassPane.js +3 -3
  19. package/containers/InfoBox/InfoBox.d.ts +5 -0
  20. package/containers/InfoBox/InfoBox.js +1 -1
  21. package/containers/List/List.d.ts +5 -0
  22. package/containers/List/List.js +1 -1
  23. package/containers/List/ListCell.d.ts +5 -0
  24. package/containers/List/ListCell.js +1 -1
  25. package/containers/List/ListRow.d.ts +7 -2
  26. package/containers/List/ListRow.js +1 -1
  27. package/containers/Message/Error.d.ts +2 -0
  28. package/containers/Message/Error.js +1 -1
  29. package/containers/Message/Message.d.ts +5 -0
  30. package/containers/Message/Message.js +1 -1
  31. package/containers/Message/NoData.d.ts +2 -0
  32. package/containers/Message/NoData.js +1 -1
  33. package/containers/Message/NoFilteredData.d.ts +2 -0
  34. package/containers/Message/NoFilteredData.js +1 -1
  35. package/containers/Openable/Openable.d.ts +5 -0
  36. package/containers/Openable/Openable.js +8 -8
  37. package/containers/PublicRoute/PublicRoute.d.ts +9 -1
  38. package/containers/PublicRoute/PublicRoute.js +3 -7
  39. package/containers/Tabs/Pane.d.ts +5 -0
  40. package/containers/Tabs/Pane.js +3 -3
  41. package/containers/Tabs/Tabs.d.ts +5 -0
  42. package/containers/Tabs/Tabs.js +3 -3
  43. package/controls/Chip/Chip.d.ts +15 -3
  44. package/controls/Chip/Chip.js +7 -6
  45. package/controls/CircularProgress/CircularProgress.d.ts +11 -0
  46. package/controls/CircularProgress/CircularProgress.js +19 -11
  47. package/controls/Dropzone/Dropzone.d.ts +11 -1
  48. package/controls/Dropzone/Dropzone.js +18 -7
  49. package/controls/Fab/Fab.d.ts +14 -6
  50. package/controls/Fab/Fab.js +7 -20
  51. package/controls/Ghost/Ghost.js +3 -3
  52. package/controls/Gradient/Gradient.d.ts +5 -0
  53. package/controls/Gradient/Gradient.js +7 -4
  54. package/controls/Histogram/Histogram.d.ts +8 -2
  55. package/controls/Histogram/Histogram.js +9 -9
  56. package/controls/Histogram/HistogramBar.d.ts +2 -2
  57. package/controls/Icon/Icon.d.ts +10 -4
  58. package/controls/Icon/Icon.js +23 -6
  59. package/controls/Key/Key.d.ts +5 -0
  60. package/controls/Key/Key.js +2 -5
  61. package/controls/LinearChart/LinearChart.d.ts +9 -0
  62. package/controls/LinearChart/LinearChart.js +11 -6
  63. package/controls/ListButton/ListButton.d.ts +46 -3
  64. package/controls/ListButton/ListButton.js +70 -9
  65. package/controls/ListView/ColumnsManager/ColumnDraggable.js +11 -5
  66. package/controls/ListView/ColumnsManager/SourceColumns.js +1 -1
  67. package/controls/ListView/IListViewProps.d.ts +9 -2
  68. package/controls/ListView/ListView.js +13 -12
  69. package/controls/ListView/defaults.d.ts +3 -0
  70. package/controls/ListView/defaults.js +6 -0
  71. package/controls/ListView/elements/Body.d.ts +1 -1
  72. package/controls/ListView/elements/Body.js +23 -12
  73. package/controls/ListView/elements/Ghost.js +3 -2
  74. package/controls/ListView/elements/Header.js +3 -2
  75. package/controls/ListView/elements/HeaderCell.js +3 -3
  76. package/controls/ListView/elements/Table.js +16 -10
  77. package/controls/Mouse/Mouse.d.ts +6 -4
  78. package/controls/Mouse/Mouse.js +15 -8
  79. package/controls/PrimaryButton/PrimaryButton.d.ts +9 -3
  80. package/controls/PrimaryButton/PrimaryButton.js +5 -5
  81. package/controls/Progress/Progress.d.ts +9 -0
  82. package/controls/Progress/Progress.js +12 -8
  83. package/controls/SecondaryButton/SecondaryButton.d.ts +8 -3
  84. package/controls/SecondaryButton/SecondaryButton.js +1 -1
  85. package/controls/SpeechRecognizer/EditorRegistry.js +1 -2
  86. package/controls/SpeechRecognizer/SpeechRecognizer.d.ts +9 -1
  87. package/controls/SpeechRecognizer/SpeechRecognizer.js +16 -9
  88. package/controls/TabBar/TabBar.d.ts +5 -0
  89. package/controls/TabBar/TabBar.js +14 -6
  90. package/controls/TabBar/Underliner.js +1 -1
  91. package/controls/TertiaryButton/TertiaryButton.d.ts +9 -3
  92. package/controls/TertiaryButton/TertiaryButton.js +5 -3
  93. package/controls/ToggleButton/ToggleButton.d.ts +8 -2
  94. package/controls/ToggleButton/ToggleButton.js +1 -1
  95. package/controls/View/View.d.ts +5 -0
  96. package/controls/View/View.js +1 -1
  97. package/formatters/CountryFormatter/CountryFormatter.d.ts +3 -2
  98. package/formatters/CountryFormatter/CountryUtil.d.ts +3 -3
  99. package/formatters/DateTimeFormatter/DateTimeFormatter.d.ts +11 -10
  100. package/formatters/DateTimeFormatter/elements/Custom.d.ts +1 -1
  101. package/formatters/DateTimeFormatter/elements/DistanceDate.d.ts +1 -1
  102. package/formatters/DateTimeFormatter/elements/LongDate.d.ts +1 -1
  103. package/formatters/DateTimeFormatter/elements/LongDateTime.d.ts +1 -1
  104. package/formatters/DateTimeFormatter/elements/LongTime.d.ts +1 -1
  105. package/formatters/DateTimeFormatter/elements/Month.d.ts +1 -1
  106. package/formatters/DateTimeFormatter/elements/ShortDate.d.ts +1 -1
  107. package/formatters/DateTimeFormatter/elements/ShortDateTime.d.ts +1 -1
  108. package/formatters/DateTimeFormatter/elements/ShortTime.d.ts +1 -1
  109. package/formatters/DivisionFormatter/DivisionFormatter.d.ts +2 -2
  110. package/formatters/DivisionFormatter/DivisionFormatter.js +1 -1
  111. package/formatters/DivisionFormatter/DivisionUtil.d.ts +1 -1
  112. package/formatters/DivisionFormatter/DivisionUtil.js +5 -3
  113. package/formatters/FilesizeFormatter/FilesizeFormatter.d.ts +3 -3
  114. package/formatters/GIS/CoordinateFormatter.d.ts +2 -2
  115. package/formatters/GIS/LatitudeFormatter.d.ts +2 -2
  116. package/formatters/GIS/LongitudeFormatter.d.ts +2 -2
  117. package/formatters/HumanFormatter/HumanFormatter.d.ts +3 -3
  118. package/formatters/NumberFormatter/NumberFormatter.d.ts +3 -3
  119. package/formatters/PhoneFormatter/PhoneFormatter.d.ts +3 -3
  120. package/formatters/StringFormatter/StringFormatter.d.ts +3 -3
  121. package/formatters/StringFormatter/StringFormatter.js +1 -4
  122. package/helper/DMS.d.ts +1 -1
  123. package/helper/DMS.js +2 -2
  124. package/hooks/useOutsideClose/useOutsideClose.js +20 -11
  125. package/hooks/useSpeechAIRecorder/useSpeechAIRecorder.js +10 -7
  126. package/index.js +1 -0
  127. package/inputs/DateInput/Body.d.ts +2 -2
  128. package/inputs/DateInput/Body.js +11 -7
  129. package/inputs/DateInput/Calendar.d.ts +1 -1
  130. package/inputs/DateInput/Calendar.js +3 -5
  131. package/inputs/DateInput/DateInput.d.ts +11 -3
  132. package/inputs/DateInput/DateInput.js +11 -3
  133. package/inputs/DateInput/Day.d.ts +1 -1
  134. package/inputs/DateInput/InfiniteList.js +6 -3
  135. package/inputs/DateInput/Navbar.js +3 -2
  136. package/inputs/DateInput/NumericInput.js +3 -0
  137. package/inputs/DateInput/Selector.d.ts +1 -1
  138. package/inputs/DateInput/Selector.js +9 -6
  139. package/inputs/Dropdown/Body.d.ts +2 -2
  140. package/inputs/Dropdown/Column.d.ts +1 -1
  141. package/inputs/Dropdown/Dropdown.d.ts +5 -0
  142. package/inputs/Dropdown/Dropdown.js +36 -63
  143. package/inputs/Dropdown/Pill.js +1 -1
  144. package/inputs/Dropdown/Selection.js +1 -1
  145. package/inputs/Editor/Editor.d.ts +5 -0
  146. package/inputs/Editor/Editor.js +16 -6
  147. package/inputs/Editor/buttons/SpeechAIButton.js +2 -0
  148. package/inputs/Editor/buttons/TextAIButton.d.ts +0 -13
  149. package/inputs/Editor/buttons/TextAIButton.js +30 -14
  150. package/inputs/Editor/buttons/TextAIMenu.js +1 -1
  151. package/inputs/Editor/menu/MenuBar.d.ts +1 -1
  152. package/inputs/Editor/menu/MenuBar.js +1 -1
  153. package/inputs/Editor/menu/MenuButton.js +1 -1
  154. package/inputs/Input/Clear.js +1 -1
  155. package/inputs/Input/Input.d.ts +5 -0
  156. package/inputs/Input/Input.js +8 -6
  157. package/inputs/Input/InputWrapper.d.ts +2 -0
  158. package/inputs/Input/InputWrapper.js +1 -1
  159. package/inputs/Input/Reveal.js +1 -1
  160. package/inputs/MonthRange/Body.d.ts +1 -1
  161. package/inputs/MonthRange/Calendar.d.ts +2 -2
  162. package/inputs/MonthRange/Calendar.js +6 -9
  163. package/inputs/MonthRange/MonthRange.d.ts +7 -1
  164. package/inputs/MonthRange/MonthRange.js +14 -6
  165. package/inputs/MonthRange/Selector.d.ts +1 -1
  166. package/inputs/MonthRange/Selector.js +12 -11
  167. package/inputs/PhoneInput/PhoneInput.d.ts +5 -0
  168. package/inputs/PhoneInput/PhoneInput.js +2 -2
  169. package/inputs/Selector/Selector.d.ts +5 -0
  170. package/inputs/Selector/Selector.js +4 -1
  171. package/inputs/Slider/Slider.d.ts +75 -22
  172. package/inputs/Slider/Slider.js +104 -22
  173. package/inputs/Textarea/Textarea.d.ts +5 -5
  174. package/inputs/Textarea/Textarea.js +3 -2
  175. package/map/Map/Map.d.ts +2 -2
  176. package/map/Map/Map.js +20 -14
  177. package/map/PositionsManager/PositionBox.js +7 -3
  178. package/map/PositionsManager/PositionsManager.js +33 -13
  179. package/map/controls/CompassButton/CompassButton.js +1 -1
  180. package/map/controls/FullscreenButton/FullscreenButton.js +1 -1
  181. package/map/controls/Geocoder/Geocoder.js +28 -14
  182. package/map/controls/Geocoder/GeocoderApi.js +2 -0
  183. package/map/controls/Geocoder/GeocoderSelector.js +1 -1
  184. package/map/controls/Graticule/Graticule.js +1 -5
  185. package/map/controls/MapLoader/MapLoader.js +1 -1
  186. package/map/controls/ScaleControl/ScaleControl.js +1 -1
  187. package/map/controls/ZoomInButton/ZoomInButton.js +1 -1
  188. package/map/controls/ZoomOutButton/ZoomOutButton.d.ts +1 -1
  189. package/map/controls/ZoomOutButton/ZoomOutButton.js +2 -2
  190. package/map/controls/base/MapButton/MapButton.d.ts +8 -2
  191. package/map/controls/base/MapButton/MapButton.js +11 -2
  192. package/map/controls/base/MapControl/MapControl.d.ts +5 -0
  193. package/map/controls/base/MapControl/MapControl.js +10 -7
  194. package/map/layers/ClusterLayer/ClusterLayer.d.ts +1 -1
  195. package/map/layers/ClusterLayer/ClusterLayer.js +7 -3
  196. package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer.js +8 -4
  197. package/map/layers/IdwBlendLayer/IdwBlendLayer.js +9 -4
  198. package/map/layers/IdwLayer/IdwLayer.d.ts +2 -1
  199. package/map/layers/IdwLayer/IdwLayer.js +271 -215
  200. package/map/layers/InterpolationLayer/ContoursFragmentShader.d.ts +1 -1
  201. package/map/layers/InterpolationLayer/ContoursFragmentShader.js +1 -1
  202. package/map/layers/InterpolationLayer/InterpolationLayer.d.ts +4 -3
  203. package/map/layers/InterpolationLayer/InterpolationLayer.js +362 -275
  204. package/map/layers/ParticlesLayer/ParticlesLayer.d.ts +8 -7
  205. package/map/layers/ParticlesLayer/ParticlesLayer.js +528 -404
  206. package/map/markers/ClusterMarker/ClusterMarker.d.ts +6 -1
  207. package/map/markers/ClusterMarker/ClusterMarker.js +15 -6
  208. package/map/markers/RiskMarker/RiskMarker.d.ts +5 -1
  209. package/map/markers/RiskMarker/RiskMarker.js +4 -4
  210. package/modules/CountryDropdown/CountryDropdown.js +10 -1
  211. package/modules/Filter/Filter.d.ts +5 -0
  212. package/modules/Filter/Filter.js +10 -6
  213. package/modules/Globe/Globe.d.ts +5 -0
  214. package/modules/Globe/Globe.js +4 -4
  215. package/modules/MainMenu/Item.d.ts +9 -2
  216. package/modules/MainMenu/Item.js +8 -5
  217. package/modules/MainMenu/MainMenu.d.ts +5 -0
  218. package/modules/MainMenu/MainMenu.js +1 -1
  219. package/modules/ParticleGlobe/GL.d.ts +1 -1
  220. package/modules/ParticleGlobe/ParticleGlobe.d.ts +5 -0
  221. package/modules/ParticleGlobe/ParticleGlobe.js +69 -40
  222. package/modules/Public/Public.d.ts +5 -0
  223. package/modules/Public/Public.js +3 -3
  224. package/package.json +1 -1
  225. package/services/Auth/Auth.js +13 -7
  226. package/services/Auth/AuthContext.js +9 -1
  227. package/services/Dialog/Dialog.d.ts +7 -2
  228. package/services/Dialog/Dialog.js +7 -6
  229. package/services/Dialog/DialogWindow.d.ts +3 -1
  230. package/services/Dialog/DialogWindow.js +1 -1
  231. package/services/Dialog/XhrDialog.d.ts +1 -1
  232. package/services/Toast/Toast.js +5 -3
  233. package/services/Toast/ToastContainer.js +3 -1
  234. package/services/Toast/ToastContext.d.ts +1 -1
  235. package/services/Toast/ToastProvider.js +2 -0
  236. package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer copy.d.ts +0 -35
  237. package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer copy.js +0 -176
  238. package/modules/Root/Content.d.ts +0 -16
  239. package/modules/Root/Content.js +0 -25
  240. package/modules/Root/Overlay.d.ts +0 -23
  241. package/modules/Root/Overlay.js +0 -33
  242. package/modules/Root/Root.d.ts +0 -10
  243. package/modules/Root/Root.js +0 -46
  244. package/modules/Root/Shader.d.ts +0 -15
  245. package/modules/Root/Shader.js +0 -24
  246. package/modules/Root/Sidebar.d.ts +0 -13
  247. package/modules/Root/Sidebar.js +0 -24
  248. package/modules/Root/index.d.ts +0 -1
  249. package/modules/Root/index.js +0 -1
  250. package/modules/Root/stories/SampleContent.d.ts +0 -7
  251. package/modules/Root/stories/SampleContent.js +0 -44
@@ -47,7 +47,20 @@ import { RgbColor } from '../../helper/RgbColor';
47
47
  var VERTEX_TEXTURE_SIZE = 2048; // horizontal and vertical resolution
48
48
  var UV_TEXTURE_SIZE = 1024;
49
49
  var OUTPUT_TEXTURE_SIZE = 2048;
50
+ // Prop defaults (shared by the base fallbacks and the export wrapper):
51
+ var DEFAULT_NUM_PARTICLES = 100000;
52
+ var DEFAULT_TRAILS = 0;
53
+ var DEFAULT_POINT_SIZE = 1;
54
+ var DEFAULT_ANGLE_X = 15;
55
+ var DEFAULT_ANGLE_Y = 0;
56
+ var DEFAULT_DELTA_X = 0;
57
+ var DEFAULT_DELTA_Y = 0.02;
58
+ var DEFAULT_MIN_LIFETIME = 60;
59
+ var DEFAULT_MAX_LIFETIME = 1000;
60
+ var DEFAULT_GLOW = 0;
61
+ var DEFAULT_SPEED_FACTOR = 1000.0;
50
62
  var ParticleGlobeBase = function (props) {
63
+ var _a, _b;
51
64
  var wrapperRef = React.useRef(null);
52
65
  var canvasRef = React.useRef(null);
53
66
  var gl = React.useRef(null);
@@ -79,19 +92,20 @@ var ParticleGlobeBase = function (props) {
79
92
  var sphereElementCount = React.useRef(0);
80
93
  // Other:
81
94
  var animationID = React.useRef(null);
82
- var angleX = React.useRef(props.angleX);
83
- var angleY = React.useRef(props.angleY);
95
+ var angleX = React.useRef((_a = props.angleX) !== null && _a !== void 0 ? _a : DEFAULT_ANGLE_X);
96
+ var angleY = React.useRef((_b = props.angleY) !== null && _b !== void 0 ? _b : DEFAULT_ANGLE_Y);
84
97
  var frame = React.useRef(0);
85
98
  var swap = React.useRef(false);
86
99
  var mouseX = React.useRef(0);
87
100
  var mouseY = React.useRef(0);
88
101
  var createSourceTexture = function (gl, size) {
102
+ var _a;
89
103
  // Prepare x,y positions for vertices;
90
104
  // Reserve 2 bytes for X-position, and 2 bytes for Y-position,
91
105
  // so a total of 4 bytes per vertex.
92
106
  var arr = new Uint8Array(VERTEX_TEXTURE_SIZE * VERTEX_TEXTURE_SIZE * 4);
93
107
  arr.fill(255);
94
- for (var i = 0; i < props.numParticles; i++) {
108
+ for (var i = 0; i < ((_a = props.numParticles) !== null && _a !== void 0 ? _a : DEFAULT_NUM_PARTICLES); i++) {
95
109
  var x = Math.random();
96
110
  var y = Math.random();
97
111
  // Multiply this by 65536 to occupy two bytes.
@@ -114,11 +128,12 @@ var ParticleGlobeBase = function (props) {
114
128
  return GL.createImageTexture(gl, image, true);
115
129
  };
116
130
  var createPointsBuffer = function (gl) {
131
+ var _a;
117
132
  pointsBuffer.current = gl.createBuffer();
118
133
  gl.bindBuffer(gl.ARRAY_BUFFER, pointsBuffer.current);
119
134
  var positions = [];
120
135
  // Create vertex indices: 0, 1, 2, ...
121
- for (var i = 0; i < props.numParticles; i++)
136
+ for (var i = 0; i < ((_a = props.numParticles) !== null && _a !== void 0 ? _a : DEFAULT_NUM_PARTICLES); i++)
122
137
  positions.push(i);
123
138
  gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW);
124
139
  };
@@ -205,16 +220,17 @@ var ParticleGlobeBase = function (props) {
205
220
  sphereElementCount.current = positions.length / 3;
206
221
  };
207
222
  var drawVertices = function (gl, sourceTexture) {
223
+ var _a, _b, _c, _d;
208
224
  var program = pointsProgram.current;
209
225
  gl.useProgram(program);
210
226
  // Random seed:
211
227
  gl.uniform1i(gl.getUniformLocation(program, "u_frame"), frame.current);
212
228
  gl.uniform1f(gl.getUniformLocation(program, "u_seed"), Math.random());
213
229
  // Particle lifetime:
214
- gl.uniform1f(gl.getUniformLocation(program, "u_minlifetime"), props.minLifetime);
215
- gl.uniform1f(gl.getUniformLocation(program, "u_maxlifetime"), props.maxLifetime);
230
+ gl.uniform1f(gl.getUniformLocation(program, "u_minlifetime"), (_a = props.minLifetime) !== null && _a !== void 0 ? _a : DEFAULT_MIN_LIFETIME);
231
+ gl.uniform1f(gl.getUniformLocation(program, "u_maxlifetime"), (_b = props.maxLifetime) !== null && _b !== void 0 ? _b : DEFAULT_MAX_LIFETIME);
216
232
  // Speed factor:
217
- gl.uniform1f(gl.getUniformLocation(program, "u_speedfactor"), props.speedFactor);
233
+ gl.uniform1f(gl.getUniformLocation(program, "u_speedfactor"), (_c = props.speedFactor) !== null && _c !== void 0 ? _c : DEFAULT_SPEED_FACTOR);
218
234
  // Texture:
219
235
  gl.activeTexture(gl.TEXTURE0);
220
236
  gl.bindTexture(gl.TEXTURE_2D, sourceTexture);
@@ -229,7 +245,7 @@ var ParticleGlobeBase = function (props) {
229
245
  gl.vertexAttribPointer(aIndex, 1, gl.FLOAT, false, 0, 0);
230
246
  gl.enableVertexAttribArray(aIndex);
231
247
  gl.disable(gl.BLEND);
232
- gl.drawArrays(gl.POINTS, 0, props.numParticles);
248
+ gl.drawArrays(gl.POINTS, 0, (_d = props.numParticles) !== null && _d !== void 0 ? _d : DEFAULT_NUM_PARTICLES);
233
249
  };
234
250
  var drawTexture = function (gl, texture, blend, flip, brightness) {
235
251
  if (blend === void 0) { blend = true; }
@@ -264,15 +280,17 @@ var ParticleGlobeBase = function (props) {
264
280
  gl.drawArrays(gl.TRIANGLES, 0, 6);
265
281
  };
266
282
  var drawOutput = function (gl, texture) {
283
+ var _a, _b, _c;
267
284
  var program = outputProgram.current;
268
285
  gl.useProgram(program);
269
286
  // Stops - fill up to 12 stops by using values > 1 for filler stops.
270
287
  // e.g. [0.0, 0.5, 1.0, 2.0....] means that only the first 3 stops are used.
271
- var stops = __spreadArray([], props.gradientStops.map(function (s) { return s.pos; }), true);
288
+ var gradientStops = (_a = props.gradientStops) !== null && _a !== void 0 ? _a : [];
289
+ var stops = __spreadArray([], gradientStops.map(function (s) { return s.pos; }), true);
272
290
  while (stops.length < 12)
273
291
  stops.push(2.0);
274
292
  gl.uniform1fv(gl.getUniformLocation(program, 'u_gradientStops'), new Float32Array(stops));
275
- var colors = props.gradientStops.map(function (s) { return RgbColor.toRGBA(s.color); }).flat();
293
+ var colors = gradientStops.map(function (s) { return RgbColor.toRGBA(s.color); }).flat();
276
294
  gl.uniform4fv(gl.getUniformLocation(program, 'u_gradientColors'), new Float32Array(colors));
277
295
  // The vertex atlas texture goes in:
278
296
  gl.activeTexture(gl.TEXTURE0);
@@ -284,7 +302,7 @@ var ParticleGlobeBase = function (props) {
284
302
  gl.uniform1i(gl.getUniformLocation(program, "u_uvtexture"), 1);
285
303
  gl.uniform1f(gl.getUniformLocation(program, "u_uvresolution"), UV_TEXTURE_SIZE);
286
304
  // Point size:
287
- gl.uniform1f(gl.getUniformLocation(program, "u_pointsize"), props.pointSize);
305
+ gl.uniform1f(gl.getUniformLocation(program, "u_pointsize"), (_b = props.pointSize) !== null && _b !== void 0 ? _b : DEFAULT_POINT_SIZE);
288
306
  // Vertex indices:
289
307
  var aIndex = gl.getAttribLocation(program, "a_index");
290
308
  gl.bindBuffer(gl.ARRAY_BUFFER, pointsBuffer.current);
@@ -293,7 +311,7 @@ var ParticleGlobeBase = function (props) {
293
311
  // Draw points:
294
312
  gl.enable(gl.BLEND);
295
313
  gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
296
- gl.drawArrays(gl.POINTS, 0, props.numParticles);
314
+ gl.drawArrays(gl.POINTS, 0, (_c = props.numParticles) !== null && _c !== void 0 ? _c : DEFAULT_NUM_PARTICLES);
297
315
  };
298
316
  var drawOutline = function (gl) {
299
317
  var program = outlineProgram.current;
@@ -371,6 +389,7 @@ var ParticleGlobeBase = function (props) {
371
389
  gl.drawArrays(gl.TRIANGLES, 0, 6);
372
390
  };
373
391
  var draw = function (gl) {
392
+ var _a;
374
393
  frame.current++;
375
394
  swap.current = !swap.current;
376
395
  // Draw into swapping framebuffer:
@@ -378,7 +397,7 @@ var ParticleGlobeBase = function (props) {
378
397
  gl.bindFramebuffer(gl.FRAMEBUFFER, swap.current ? fbo2.current : fbo1.current);
379
398
  gl.clearColor(0.0, 0.0, 0.0, 1.0); // clear to transparent
380
399
  gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
381
- drawVertices(gl, swap.current ? texture1.current : texture2.current);
400
+ drawVertices(gl, (swap.current ? texture1.current : texture2.current));
382
401
  // Draw result into "out" framebuffer:
383
402
  gl.viewport(0, 0, OUTPUT_TEXTURE_SIZE, OUTPUT_TEXTURE_SIZE);
384
403
  gl.bindFramebuffer(gl.FRAMEBUFFER, fboOut.current);
@@ -387,10 +406,10 @@ var ParticleGlobeBase = function (props) {
387
406
  gl.clear(gl.COLOR_BUFFER_BIT);
388
407
  }
389
408
  else {
390
- if (frame.current % props.trails == 0)
409
+ if (frame.current % ((_a = props.trails) !== null && _a !== void 0 ? _a : DEFAULT_TRAILS) == 0)
391
410
  drawFade(gl);
392
411
  }
393
- drawOutput(gl, swap.current ? texture2.current : texture1.current);
412
+ drawOutput(gl, (swap.current ? texture2.current : texture1.current));
394
413
  if (props.outlines) {
395
414
  drawOutline(gl);
396
415
  }
@@ -422,39 +441,45 @@ var ParticleGlobeBase = function (props) {
422
441
  }
423
442
  };
424
443
  var handleMouseMove = function (e) {
444
+ if (!wrapperRef.current)
445
+ return;
425
446
  mouseX.current = e.clientX / wrapperRef.current.clientWidth * 2.0 - 1.0;
426
447
  mouseY.current = e.clientY / wrapperRef.current.clientHeight * 2.0 - 1.0;
427
448
  };
428
449
  var animate = function () {
450
+ var _a, _b;
429
451
  draw(gl.current);
430
- angleX.current = (angleX.current + props.deltaX) % 360;
431
- angleY.current = (angleY.current + props.deltaY) % 360;
452
+ angleX.current = (angleX.current + ((_a = props.deltaX) !== null && _a !== void 0 ? _a : DEFAULT_DELTA_X)) % 360;
453
+ angleY.current = (angleY.current + ((_b = props.deltaY) !== null && _b !== void 0 ? _b : DEFAULT_DELTA_Y)) % 360;
432
454
  animationID.current = requestAnimationFrame(animate);
433
455
  };
434
456
  var setup = function (uvImage, nightImage) {
435
457
  if (!canvasRef.current)
436
458
  return;
437
459
  gl.current = canvasRef.current.getContext("webgl");
438
- pointsProgram.current = GL.createProgram(gl.current, PointsVertexShader, PointsFragmentShader);
439
- outputProgram.current = GL.createProgram(gl.current, OutputVertexShader, OutputFragmentShader);
440
- fadeProgram.current = GL.createProgram(gl.current, FadeVertexShader, FadeFragmentShader);
441
- outlineProgram.current = GL.createProgram(gl.current, OutlineVertexShader, OutlineFragmentShader);
442
- sphereProgram.current = GL.createProgram(gl.current, SphereVertexShader, SphereFragmentShader);
443
- textureProgram.current = GL.createProgram(gl.current, TextureVertexShader, TextureFragmentShader);
444
- createPointsBuffer(gl.current);
445
- createSquareBuffer(gl.current);
446
- createSphere(gl.current, 1, 60, 60);
447
- texture1.current = createSourceTexture(gl.current, VERTEX_TEXTURE_SIZE);
448
- texture2.current = createEmptyTexture(gl.current, VERTEX_TEXTURE_SIZE);
449
- textureUV.current = createUVTexture(gl.current, uvImage);
450
- textureOut.current = createEmptyTexture(gl.current, OUTPUT_TEXTURE_SIZE);
460
+ var context = gl.current;
461
+ if (!context)
462
+ return;
463
+ pointsProgram.current = GL.createProgram(context, PointsVertexShader, PointsFragmentShader);
464
+ outputProgram.current = GL.createProgram(context, OutputVertexShader, OutputFragmentShader);
465
+ fadeProgram.current = GL.createProgram(context, FadeVertexShader, FadeFragmentShader);
466
+ outlineProgram.current = GL.createProgram(context, OutlineVertexShader, OutlineFragmentShader);
467
+ sphereProgram.current = GL.createProgram(context, SphereVertexShader, SphereFragmentShader);
468
+ textureProgram.current = GL.createProgram(context, TextureVertexShader, TextureFragmentShader);
469
+ createPointsBuffer(context);
470
+ createSquareBuffer(context);
471
+ createSphere(context, 1, 60, 60);
472
+ texture1.current = createSourceTexture(context, VERTEX_TEXTURE_SIZE);
473
+ texture2.current = createEmptyTexture(context, VERTEX_TEXTURE_SIZE);
474
+ textureUV.current = createUVTexture(context, uvImage);
475
+ textureOut.current = createEmptyTexture(context, OUTPUT_TEXTURE_SIZE);
451
476
  if (props.landmass != 'none')
452
- textureLandmass.current = createLandmassTexture(gl.current, nightImage);
453
- textureSphere.current = createEmptyTexture(gl.current, OUTPUT_TEXTURE_SIZE);
454
- fbo1.current = GL.createFrameBuffer(gl.current, texture1.current);
455
- fbo2.current = GL.createFrameBuffer(gl.current, texture2.current);
456
- fboOut.current = GL.createFrameBuffer(gl.current, textureOut.current);
457
- fboSphere.current = GL.createFrameBuffer(gl.current, textureSphere.current);
477
+ textureLandmass.current = createLandmassTexture(context, nightImage);
478
+ textureSphere.current = createEmptyTexture(context, OUTPUT_TEXTURE_SIZE);
479
+ fbo1.current = GL.createFrameBuffer(context, texture1.current);
480
+ fbo2.current = GL.createFrameBuffer(context, texture2.current);
481
+ fboOut.current = GL.createFrameBuffer(context, textureOut.current);
482
+ fboSphere.current = GL.createFrameBuffer(context, textureSphere.current);
458
483
  animationID.current = window.requestAnimationFrame(animate);
459
484
  };
460
485
  var step2 = function (image) {
@@ -477,19 +502,23 @@ var ParticleGlobeBase = function (props) {
477
502
  if (props.responsive)
478
503
  document.addEventListener('mousemove', handleMouseMove);
479
504
  return function () {
480
- window.cancelAnimationFrame(animationID.current);
505
+ if (animationID.current !== null)
506
+ window.cancelAnimationFrame(animationID.current);
481
507
  document.removeEventListener('mousemove', handleMouseMove);
482
508
  };
483
509
  }, []);
484
- return (React.createElement("div", { className: props.className, ref: wrapperRef },
510
+ return (React.createElement("div", { className: props.className, style: props.style, ref: wrapperRef },
485
511
  React.createElement("canvas", { ref: canvasRef, width: "1024", height: "768" })));
486
512
  };
487
- var ParticleGlobeStyled = styled(ParticleGlobeBase)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: transparent;\n box-sizing: border-box;\n ", "\n canvas {\n width: 100%;\n height: 100%;\n }\n ", "\n"], ["\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: transparent;\n box-sizing: border-box;\n ", "\n canvas {\n width: 100%;\n height: 100%;\n }\n ", "\n"])), function (p) { return p.globe && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: ", "px;\n "], ["\n padding: ", "px;\n "])), p.glow); }, function (p) { return p.globe && css(templateObject_2 || (templateObject_2 = __makeTemplateObject([" \n &:before {\n position: absolute;\n z-index: -1;\n content: '';\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n background: radial-gradient(circle closest-side at center, black 0%, black calc(100% - ", "px), white calc(100% - ", "px), transparent 100%);\n }\n "], [" \n &:before {\n position: absolute;\n z-index: -1;\n content: '';\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n background: radial-gradient(circle closest-side at center, black 0%, black calc(100% - ", "px), white calc(100% - ", "px), transparent 100%);\n }\n "])), p.glow + 2, p.glow + 2); });
513
+ var ParticleGlobeStyled = styled(ParticleGlobeBase)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: transparent;\n box-sizing: border-box;\n ", "\n canvas {\n width: 100%;\n height: 100%;\n }\n ", "\n"], ["\n position: relative;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: transparent;\n box-sizing: border-box;\n ", "\n canvas {\n width: 100%;\n height: 100%;\n }\n ", "\n"])), function (p) { return p.globe && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: ", "px;\n "], ["\n padding: ", "px;\n "])), p.glow); }, function (p) {
514
+ var _a, _b;
515
+ return p.globe && css(templateObject_2 || (templateObject_2 = __makeTemplateObject([" \n &:before {\n position: absolute;\n z-index: -1;\n content: '';\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n background: radial-gradient(circle closest-side at center, black 0%, black calc(100% - ", "px), white calc(100% - ", "px), transparent 100%);\n }\n "], [" \n &:before {\n position: absolute;\n z-index: -1;\n content: '';\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n background: radial-gradient(circle closest-side at center, black 0%, black calc(100% - ", "px), white calc(100% - ", "px), transparent 100%);\n }\n "])), ((_a = p.glow) !== null && _a !== void 0 ? _a : DEFAULT_GLOW) + 2, ((_b = p.glow) !== null && _b !== void 0 ? _b : DEFAULT_GLOW) + 2);
516
+ });
488
517
  var ParticleGlobeWrapper = function (props) {
489
518
  return React.createElement(ParticleGlobeStyled, __assign({}, props));
490
519
  };
491
520
  var ParticleGlobe = function (_a) {
492
- var _b = _a.numParticles, numParticles = _b === void 0 ? 100000 : _b, _c = _a.globe, globe = _c === void 0 ? false : _c, _d = _a.trails, trails = _d === void 0 ? 0 : _d, _e = _a.pointSize, pointSize = _e === void 0 ? 1 : _e, _f = _a.angleX, angleX = _f === void 0 ? 15 : _f, _g = _a.angleY, angleY = _g === void 0 ? 0 : _g, _h = _a.deltaX, deltaX = _h === void 0 ? 0 : _h, _j = _a.deltaY, deltaY = _j === void 0 ? 0.02 : _j, _k = _a.outlines, outlines = _k === void 0 ? false : _k, _l = _a.minLifetime, minLifetime = _l === void 0 ? 60 : _l, _m = _a.maxLifetime, maxLifetime = _m === void 0 ? 1000 : _m, _o = _a.glow, glow = _o === void 0 ? 0 : _o, _p = _a.landmass, landmass = _p === void 0 ? 'none' : _p, _q = _a.brightness, brightness = _q === void 0 ? 1.0 : _q, _r = _a.speedFactor, speedFactor = _r === void 0 ? 1000.0 : _r, _s = _a.responsive, responsive = _s === void 0 ? false : _s, _t = _a.gradientStops, gradientStops = _t === void 0 ? [
521
+ var _b = _a.numParticles, numParticles = _b === void 0 ? DEFAULT_NUM_PARTICLES : _b, _c = _a.globe, globe = _c === void 0 ? false : _c, _d = _a.trails, trails = _d === void 0 ? DEFAULT_TRAILS : _d, _e = _a.pointSize, pointSize = _e === void 0 ? DEFAULT_POINT_SIZE : _e, _f = _a.angleX, angleX = _f === void 0 ? DEFAULT_ANGLE_X : _f, _g = _a.angleY, angleY = _g === void 0 ? DEFAULT_ANGLE_Y : _g, _h = _a.deltaX, deltaX = _h === void 0 ? DEFAULT_DELTA_X : _h, _j = _a.deltaY, deltaY = _j === void 0 ? DEFAULT_DELTA_Y : _j, _k = _a.outlines, outlines = _k === void 0 ? false : _k, _l = _a.minLifetime, minLifetime = _l === void 0 ? DEFAULT_MIN_LIFETIME : _l, _m = _a.maxLifetime, maxLifetime = _m === void 0 ? DEFAULT_MAX_LIFETIME : _m, _o = _a.glow, glow = _o === void 0 ? DEFAULT_GLOW : _o, _p = _a.landmass, landmass = _p === void 0 ? 'none' : _p, _q = _a.brightness, brightness = _q === void 0 ? 1.0 : _q, _r = _a.speedFactor, speedFactor = _r === void 0 ? DEFAULT_SPEED_FACTOR : _r, _s = _a.responsive, responsive = _s === void 0 ? false : _s, _t = _a.gradientStops, gradientStops = _t === void 0 ? [
493
522
  { pos: 0.0, color: '#2c425300' },
494
523
  { pos: 0.01, color: '#2c425300' },
495
524
  { pos: 0.1, color: '#2c4253ff' },
@@ -29,6 +29,11 @@ interface IProps {
29
29
  * Optional additional header content.
30
30
  */
31
31
  header?: React.ReactNode;
32
+ /**
33
+ * Optional inline styles applied to the outer element, for one-off overrides
34
+ * of the default styling.
35
+ */
36
+ style?: React.CSSProperties;
32
37
  }
33
38
  declare const Public: (props: IProps) => React.JSX.Element;
34
39
  export { Public };
@@ -13,15 +13,15 @@ var Public = function (props) {
13
13
  var wrapperRef = React.useRef(null);
14
14
  var _a = React.useState(false), showHint = _a[0], setShowHint = _a[1];
15
15
  useOutsideClose({
16
- open: true,
16
+ open: showHint,
17
17
  refs: [wrapperRef],
18
18
  onClose: function () { return setShowHint(false); },
19
19
  escapeToClose: true,
20
20
  blurToClose: false,
21
21
  });
22
22
  return (React.createElement(React.Fragment, null,
23
- React.createElement(Box, { "data-testid": "Box", ref: wrapperRef },
24
- React.createElement(Header, { logoUrl: props.logoUrl, logoAspectRatio: props.logoAspectRatio, onClick: props.hint ? function () { return setShowHint(!showHint); } : null, children: props.header }),
23
+ React.createElement(Box, { "data-testid": "Box", ref: wrapperRef, style: props.style },
24
+ React.createElement(Header, { logoUrl: props.logoUrl, logoAspectRatio: props.logoAspectRatio, onClick: props.hint ? function () { return setShowHint(!showHint); } : undefined, children: props.header }),
25
25
  React.createElement(Body, { height: props.height },
26
26
  props.hint && React.createElement(Hint, { active: showHint }, props.hint),
27
27
  props.children)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longline/aqua-ui",
3
- "version": "1.0.339",
3
+ "version": "1.0.340",
4
4
  "description": "AquaUI",
5
5
  "author": "Alexander van Oostenrijk / Longline Environment",
6
6
  "license": "Commercial",
@@ -33,14 +33,20 @@ import { AuthContext } from './AuthContext';
33
33
  */
34
34
  var Auth = function (props) {
35
35
  var getInitialState = function () {
36
- // Try to load Auth from session storage.
37
- var authStr = sessionStorage.getItem('auth');
38
- var authData = authStr ? JSON.parse(authStr) : {};
39
36
  var initialState = {
40
- access_token: null,
41
- refresh_token: null
37
+ access_token: '',
38
+ refresh_token: ''
42
39
  };
43
- initialState = __assign(__assign({}, initialState), authData);
40
+ // Try to load Auth from session storage. Guard against SSR (no
41
+ // sessionStorage) and corrupt stored JSON.
42
+ try {
43
+ var authStr = typeof sessionStorage !== 'undefined' ? sessionStorage.getItem('auth') : null;
44
+ if (authStr)
45
+ initialState = __assign(__assign({}, initialState), JSON.parse(authStr));
46
+ }
47
+ catch (_a) {
48
+ // Ignore corrupt stored auth and fall back to the empty state.
49
+ }
44
50
  return initialState;
45
51
  };
46
52
  var _a = React.useState(getInitialState()), data = _a[0], setData = _a[1];
@@ -54,7 +60,7 @@ var Auth = function (props) {
54
60
  sessionStorage.setItem('auth', JSON.stringify(newData));
55
61
  };
56
62
  var signout = function () {
57
- setData({ access_token: null, refresh_token: null });
63
+ setData({ access_token: '', refresh_token: '' });
58
64
  // Remove auth from session:
59
65
  sessionStorage.removeItem('auth');
60
66
  };
@@ -1,3 +1,11 @@
1
1
  import * as React from 'react';
2
- var AuthContext = React.createContext(null);
2
+ // Default no-op context used when there is no <Auth> provider above. The public
3
+ // IAuthContext shape is unchanged; tokens default to empty strings (not null) so
4
+ // access_token / refresh_token remain non-nullable strings.
5
+ var AuthContext = React.createContext({
6
+ access_token: '',
7
+ refresh_token: '',
8
+ signin: function () { },
9
+ signout: function () { }
10
+ });
3
11
  export { AuthContext };
@@ -36,6 +36,11 @@ interface IDialogProps extends ITestable {
36
36
  * @default null
37
37
  */
38
38
  onClose?: () => void;
39
+ /**
40
+ * Optional inline styles applied to the dialog window, for one-off overrides
41
+ * of the default styling.
42
+ */
43
+ style?: React.CSSProperties;
39
44
  }
40
45
  declare const Dialog: {
41
46
  ({ open, canClose, width, inverted, ...props }: IDialogProps): React.JSX.Element;
@@ -88,8 +93,8 @@ declare const Dialog: {
88
93
  * <Dialog.Confirm
89
94
  * open={showConfirm}
90
95
  * title="Delete Item"
91
- * onYes={handleDelete}
92
- * onNo={() => setShowConfirm(false)}
96
+ * onConfirm={handleDelete}
97
+ * onClose={() => setShowConfirm(false)}
93
98
  * >
94
99
  * Are you sure you want to delete this item?
95
100
  * </Dialog.Confirm>
@@ -93,21 +93,22 @@ import { useOutsideClose } from '../../hooks/useOutsideClose';
93
93
  * a maximum of 400px to ensure proper display on mobile devices.
94
94
  */
95
95
  var DialogBase = function (props) {
96
+ var _a;
96
97
  var windowRef = React.useRef(null);
97
- var _a = useTransitionState({
98
+ var _b = useTransitionState({
98
99
  timeout: 500,
99
100
  mountOnEnter: true,
100
101
  initialEntered: false,
101
102
  preEnter: true,
102
103
  unmountOnExit: true
103
- }), _b = _a[0], status = _b.status, isMounted = _b.isMounted, isEnter = _b.isEnter, toggle = _a[1];
104
+ }), _c = _b[0], status = _c.status, isMounted = _c.isMounted, isEnter = _c.isEnter, toggle = _b[1];
104
105
  var close = function () {
105
106
  if (!props.canClose || !props.onClose)
106
107
  return;
107
108
  props.onClose();
108
109
  };
109
110
  useOutsideClose({
110
- open: props.open,
111
+ open: (_a = props.open) !== null && _a !== void 0 ? _a : false,
111
112
  refs: [windowRef],
112
113
  onClose: close,
113
114
  escapeToClose: true,
@@ -118,7 +119,7 @@ var DialogBase = function (props) {
118
119
  }, [props.open]);
119
120
  return (React.createElement(React.Fragment, null, isMounted && React.createElement(React.Fragment, null,
120
121
  createPortal(React.createElement(DialogBackground, { "data-testid": "Dialog.Background", status: status }), document.body),
121
- createPortal(React.createElement(DialogWindow, { "data-testid": props['data-testid'] || "Dialog.Window", inverted: props.inverted, width: props.width, ref: windowRef, status: status }, props.children), document.body))));
122
+ createPortal(React.createElement(DialogWindow, { "data-testid": props['data-testid'] || "Dialog.Window", inverted: props.inverted, width: props.width, style: props.style, ref: windowRef, status: status }, props.children), document.body))));
122
123
  };
123
124
  var Dialog = function (_a) {
124
125
  var _b = _a.open, open = _b === void 0 ? false : _b, _c = _a.canClose, canClose = _c === void 0 ? true : _c, _d = _a.width, width = _d === void 0 ? 600 : _d, _e = _a.inverted, inverted = _e === void 0 ? false : _e, props = __rest(_a, ["open", "canClose", "width", "inverted"]);
@@ -161,8 +162,8 @@ Dialog.Alert = AlertDialog;
161
162
  * <Dialog.Confirm
162
163
  * open={showConfirm}
163
164
  * title="Delete Item"
164
- * onYes={handleDelete}
165
- * onNo={() => setShowConfirm(false)}
165
+ * onConfirm={handleDelete}
166
+ * onClose={() => setShowConfirm(false)}
166
167
  * >
167
168
  * Are you sure you want to delete this item?
168
169
  * </Dialog.Confirm>
@@ -14,8 +14,10 @@ interface IDialogWindowProps extends ITestable {
14
14
  * useTransitionState class
15
15
  */
16
16
  status: string;
17
+ /** Optional inline styles applied to the dialog window. */
18
+ style?: React.CSSProperties;
17
19
  }
18
20
  declare const DialogWindow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<IDialogWindowProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
19
- ref?: React.Ref<HTMLDivElement>;
21
+ ref?: React.RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
20
22
  }, never>> & string & Omit<React.ForwardRefExoticComponent<IDialogWindowProps & React.RefAttributes<HTMLDivElement>>, keyof React.Component<any, {}, any>>;
21
23
  export { DialogWindow };
@@ -9,7 +9,7 @@ var DialogWindowBase = React.forwardRef(function (props, ref) {
9
9
  // Stop any keyboard interaction propagating to parent components.
10
10
  ev.stopPropagation();
11
11
  };
12
- return (React.createElement("div", { "data-testid": props['data-testid'] || "DialogWindow", className: "".concat(props.className, " ").concat(props.status), ref: ref, onKeyDown: handleKeyDown }, props.children));
12
+ return (React.createElement("div", { "data-testid": props['data-testid'] || "DialogWindow", className: "".concat(props.className, " ").concat(props.status), style: props.style, ref: ref, onKeyDown: handleKeyDown, role: "dialog", "aria-modal": "true" }, props.children));
13
13
  });
14
14
  var DialogWindow = styled(DialogWindowBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: fixed;\n z-index: 3000;\n left: 50%;\n top: 50%;\n transform-origin: center center;\n border-radius: ", "px;\n background-color: ", ";\n box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.5);\n\n ", "\n\n // Font:\n font: ", ";\n color: ", "; \n\n /* Dialog window width:\n * Narrower on small screen. */\n width: ", ";\n @media (max-width: ", "px) {\n width: ", ";\n }\n\n /* useTransitionState classes */\n transition: opacity 0.5s ease, transform 0.5s cubic-bezier(.17,.89,.35,1.67);\n opacity: 0;\n &.preEnter, &.exiting {\n opacity: 0;\n transform: translateX(-50%) translateY(-50%) scale(0.8);\n }\n &.entering {\n opacity: 1;\n transform: translateX(-50%) translateY(-50%);\n }\n &.entered {\n opacity: 1;\n transform: translateX(-50%) translateY(-50%);\n }\n\n"], ["\n position: fixed;\n z-index: 3000;\n left: 50%;\n top: 50%;\n transform-origin: center center;\n border-radius: ", "px;\n background-color: ", ";\n box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.5);\n\n ", "\n\n // Font:\n font: ", ";\n color: ", "; \n\n /* Dialog window width:\n * Narrower on small screen. */\n width: ", ";\n @media (max-width: ", "px) {\n width: ", ";\n }\n\n /* useTransitionState classes */\n transition: opacity 0.5s ease, transform 0.5s cubic-bezier(.17,.89,.35,1.67);\n opacity: 0;\n &.preEnter, &.exiting {\n opacity: 0;\n transform: translateX(-50%) translateY(-50%) scale(0.8);\n }\n &.entering {\n opacity: 1;\n transform: translateX(-50%) translateY(-50%);\n }\n &.entered {\n opacity: 1;\n transform: translateX(-50%) translateY(-50%);\n }\n\n"])), function (p) { return p.theme.radius.normal; }, function (p) { return p.inverted ? p.theme.colors.primary[3] : p.theme.colors.neutral[100]; }, function (p) { return p.inverted && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .footer {\n background: ", ";\n } \n "], ["\n .footer {\n background: ", ";\n } \n "])), function (p) { return p.theme.colors.primary[5]; }); }, function (p) { return p.theme.font.bodyMedium; }, function (p) { return p.inverted ? p.theme.colors.neutral[100] : p.theme.colors.neutral[10]; }, function (p) {
15
15
  if (!p.width)
@@ -22,7 +22,7 @@ interface IXhrDialogProps {
22
22
  onRetry?: () => void;
23
23
  /**
24
24
  * Title for dialog.
25
- * @default "Network error"
25
+ * @default "Server error"
26
26
  */
27
27
  title?: string;
28
28
  /**
@@ -54,14 +54,16 @@ var ToastBase = function (props) {
54
54
  props.onClose();
55
55
  }, props.duration);
56
56
  return function () {
57
- window.clearTimeout(timerHandle.current);
57
+ if (timerHandle.current !== null)
58
+ window.clearTimeout(timerHandle.current);
58
59
  };
59
60
  }, []);
60
61
  //
61
62
  // Clicking the Action also closes the Toast.
62
63
  //
63
64
  var handleAction = function () {
64
- props.action();
65
+ var _a;
66
+ (_a = props.action) === null || _a === void 0 ? void 0 : _a.call(props);
65
67
  props.onClose();
66
68
  };
67
69
  return (React.createElement(React.Fragment, null, isMounted && React.createElement("div", { className: "".concat(props.className, " ").concat(status) },
@@ -74,7 +76,7 @@ var ToastBase = function (props) {
74
76
  var Message = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n flex: 1;\n padding-left: 16px;\n padding-right: 16px;\n"], ["\n display: flex;\n align-items: center;\n flex: 1;\n padding-left: 16px;\n padding-right: 16px;\n"])));
75
77
  var CloseButton = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n cursor: pointer;\n\n svg {\n fill: ", ";\n width: 20px;\n height: 20px;\n } \n &:hover {\n svg {\n fill: ", ";\n }\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n cursor: pointer;\n\n svg {\n fill: ", ";\n width: 20px;\n height: 20px;\n } \n &:hover {\n svg {\n fill: ", ";\n }\n }\n"])), function (p) { return p.theme.colors.neutral[95]; }, function (p) { return p.theme.colors.neutral[100]; });
76
78
  var Action = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding-left: 8px;\n color: ", ";\n cursor: pointer;\n white-space: nowrap;\n font: ", ";\n text-transform: uppercase;\n transition: color ease-in-out ", "ms;\n &:hover {\n color: ", ";\n }\n &:last-child {\n padding-right: 16px;\n }\n"], ["\n display: flex;\n align-items: center;\n padding-left: 8px;\n color: ", ";\n cursor: pointer;\n white-space: nowrap;\n font: ", ";\n text-transform: uppercase;\n transition: color ease-in-out ", "ms;\n &:hover {\n color: ", ";\n }\n &:last-child {\n padding-right: 16px;\n }\n"])), function (p) { return p.theme.colors.primary[4]; }, function (p) { return p.theme.font.labelCaps; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.colors.primary[2]; });
77
- var ToastStyled = styled(ToastBase)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n // Position and size:\n display: flex;\n width: 344px;\n box-sizing: border-box;\n align-items: stretch;\n justify-content: space-between;\n user-select: none;\n pointer-events: all;\n\n // Space between toasts:\n margin: 8px 0 8px 0; \n\n // Appearance:\n padding: 14px 0 14px 0;\n background-color: ", ";\n color: #fff;\n border-radius: ", "px;\n font: ", ";\n\n // Content:\n a {\n color: ", " !important;\n }\n\n /* useTransitionState classes */\n transition: opacity ", "ms ease;\n &.preEnter, &.exiting, &.unmounted {\n opacity: 0;\n }\n &.entering {\n opacity: 1;\n }\n &.entered {\n opacity: 1;\n }\n\n"], ["\n // Position and size:\n display: flex;\n width: 344px;\n box-sizing: border-box;\n align-items: stretch;\n justify-content: space-between;\n user-select: none;\n pointer-events: all;\n\n // Space between toasts:\n margin: 8px 0 8px 0; \n\n // Appearance:\n padding: 14px 0 14px 0;\n background-color: ", ";\n color: #fff;\n border-radius: ", "px;\n font: ", ";\n\n // Content:\n a {\n color: ", " !important;\n }\n\n /* useTransitionState classes */\n transition: opacity ", "ms ease;\n &.preEnter, &.exiting, &.unmounted {\n opacity: 0;\n }\n &.entering {\n opacity: 1;\n }\n &.entered {\n opacity: 1;\n }\n\n"])), function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.theme.radius.normal; }, function (p) { return p.theme.font.bodyMedium; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.theme.animation.duration * 2; });
79
+ var ToastStyled = styled(ToastBase)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n // Position and size:\n display: flex;\n width: 344px;\n box-sizing: border-box;\n align-items: stretch;\n justify-content: space-between;\n user-select: none;\n pointer-events: all;\n\n // Space between toasts:\n margin: 8px 0 8px 0; \n\n // Appearance:\n padding: 14px 0 14px 0;\n background-color: ", ";\n color: ", ";\n border-radius: ", "px;\n font: ", ";\n\n // Content:\n a {\n color: ", " !important;\n }\n\n /* useTransitionState classes */\n transition: opacity ", "ms ease;\n &.preEnter, &.exiting, &.unmounted {\n opacity: 0;\n }\n &.entering {\n opacity: 1;\n }\n &.entered {\n opacity: 1;\n }\n\n"], ["\n // Position and size:\n display: flex;\n width: 344px;\n box-sizing: border-box;\n align-items: stretch;\n justify-content: space-between;\n user-select: none;\n pointer-events: all;\n\n // Space between toasts:\n margin: 8px 0 8px 0; \n\n // Appearance:\n padding: 14px 0 14px 0;\n background-color: ", ";\n color: ", ";\n border-radius: ", "px;\n font: ", ";\n\n // Content:\n a {\n color: ", " !important;\n }\n\n /* useTransitionState classes */\n transition: opacity ", "ms ease;\n &.preEnter, &.exiting, &.unmounted {\n opacity: 0;\n }\n &.entering {\n opacity: 1;\n }\n &.entered {\n opacity: 1;\n }\n\n"])), function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.theme.colors.font; }, function (p) { return p.theme.radius.normal; }, function (p) { return p.theme.font.bodyMedium; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.theme.animation.duration * 2; });
78
80
  /**
79
81
  * A brief notification message that appears temporarily to provide feedback to the user.
80
82
  *
@@ -34,7 +34,9 @@ var ToastContainerBase = function (props) {
34
34
  var handleClose = function (key) {
35
35
  toastProvider.remove(key);
36
36
  };
37
- return (React.createElement("div", { className: props.className }, Object.keys(toastProvider.messages).map(function (key) {
37
+ return (
38
+ // Live region so screen readers announce toasts as they appear.
39
+ React.createElement("div", { className: props.className, "aria-live": "polite" }, Object.keys(toastProvider.messages).map(function (key) {
38
40
  return React.createElement(Toast, __assign({ key: key, message: toastProvider.messages[key].message, onClose: function () { return handleClose(key); } }, toastProvider.messages[key].options));
39
41
  })));
40
42
  };
@@ -22,6 +22,6 @@ interface IToastContext {
22
22
  */
23
23
  remove: (key: string) => void;
24
24
  }
25
- declare const ToastContext: React.Context<IToastContext>;
25
+ declare const ToastContext: React.Context<IToastContext | null>;
26
26
  export { ToastContext };
27
27
  export type { IToastContext };
@@ -47,6 +47,8 @@ var ToastProvider = function (_a) {
47
47
  // Remove excess messages:
48
48
  while (keys.length >= maxToasts) {
49
49
  var oldestKey = keys.shift();
50
+ if (oldestKey === undefined)
51
+ break;
50
52
  var _b = newMessages, _c = oldestKey, _ = _b[_c], rest = __rest(_b, [typeof _c === "symbol" ? _c : _c + ""]);
51
53
  newMessages = rest;
52
54
  }
@@ -1,35 +0,0 @@
1
- import * as React from 'react';
2
- interface IHtmlMarkerLayerProps {
3
- /**
4
- * Function that returns a marker component. Properties that `HtmlMarkerLayer`
5
- * makes available to the component are passed in as `props`.
6
- * e.g. `{(p) => <MyMarker {...p} bordered flashing/>}`
7
- */
8
- children?: (props: any) => React.ReactNode;
9
- /**
10
- * ID of the source that's queried.
11
- */
12
- sourceId: string;
13
- /**
14
- * Every feature must have a unique ID in its properties. This is used to
15
- * tell features apart. If the `source` should ever change, then it is
16
- * important that new items have new IDs, so that old markers get removed
17
- * correctly. Features that do not have an ID field are not displayed.
18
- */
19
- idField: string;
20
- /**
21
- * Minimum zoom level at which to show markers.
22
- * @default 0
23
- */
24
- minZoom?: number;
25
- /**
26
- * Maximum zoom level at which to show markers.
27
- * @default 99
28
- */
29
- maxZoom?: number;
30
- }
31
- declare const HtmlMarkerLayer: {
32
- ({ minZoom, maxZoom, ...props }: IHtmlMarkerLayerProps): React.JSX.Element;
33
- displayName: string;
34
- };
35
- export { HtmlMarkerLayer, IHtmlMarkerLayerProps };