@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
@@ -16,7 +16,7 @@ var __assign = (this && this.__assign) || function () {
16
16
  import * as React from 'react';
17
17
  import styled, { keyframes } from 'styled-components';
18
18
  var GhostBase = function (props) {
19
- return React.createElement("div", { "data-testid": props['data-testid'] || "Ghost", className: props.className, style: props.style },
19
+ return React.createElement("div", { "data-testid": props['data-testid'] || "Ghost", className: props.className, style: props.style, "aria-hidden": "true" },
20
20
  React.createElement(Gradient1, null),
21
21
  React.createElement(Gradient2, null));
22
22
  };
@@ -24,8 +24,8 @@ var COLOR1 = "#2C4E68";
24
24
  var COLOR2 = "#6B8BA2";
25
25
  var anim = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n"], ["\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n"])));
26
26
  var anim2 = keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n 0% {\n opacity: 0;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n"], ["\n 0% {\n opacity: 0;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n"])));
27
- var Gradient1 = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n opacity: 1;\n background: linear-gradient(-45deg, ", ", ", ");\n animation: ", " 4s infinite linear;\n"], ["\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n opacity: 1;\n background: linear-gradient(-45deg, ", ", ", ");\n animation: ", " 4s infinite linear;\n"])), COLOR1, COLOR2, anim2);
28
- var Gradient2 = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n opacity: 1;\n background: linear-gradient(-45deg, ", ", ", ");\n animation: ", " 4s infinite linear;\n"], ["\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n opacity: 1;\n background: linear-gradient(-45deg, ", ", ", ");\n animation: ", " 4s infinite linear;\n"])), COLOR2, COLOR1, anim);
27
+ var Gradient1 = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n opacity: 1;\n background: linear-gradient(-45deg, ", ", ", ");\n animation: ", " 4s infinite linear;\n\n @media (prefers-reduced-motion: reduce) {\n animation: none;\n }\n"], ["\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n opacity: 1;\n background: linear-gradient(-45deg, ", ", ", ");\n animation: ", " 4s infinite linear;\n\n @media (prefers-reduced-motion: reduce) {\n animation: none;\n }\n"])), COLOR1, COLOR2, anim2);
28
+ var Gradient2 = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n opacity: 1;\n background: linear-gradient(-45deg, ", ", ", ");\n animation: ", " 4s infinite linear;\n\n @media (prefers-reduced-motion: reduce) {\n animation: none;\n }\n"], ["\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n opacity: 1;\n background: linear-gradient(-45deg, ", ", ", ");\n animation: ", " 4s infinite linear;\n\n @media (prefers-reduced-motion: reduce) {\n animation: none;\n }\n"])), COLOR2, COLOR1, anim);
29
29
  var GhostStyled = styled(GhostBase)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: relative;\n min-width: 5px;\n min-height: 5px;\n border-radius: ", "px;\n overflow: hidden;\n pointer-events: none;\n opacity: 0.3;\n"], ["\n position: relative;\n min-width: 5px;\n min-height: 5px;\n border-radius: ", "px;\n overflow: hidden;\n pointer-events: none;\n opacity: 0.3;\n"
30
30
  /**
31
31
  * A placeholder element that displays a subtle animated gradient while content is loading.
@@ -23,6 +23,11 @@ interface IGradientProps extends ITestable {
23
23
  * @default false
24
24
  */
25
25
  checkered?: boolean;
26
+ /**
27
+ * Optional inline styles applied to the outer element, for one-off overrides
28
+ * of the default styling.
29
+ */
30
+ style?: React.CSSProperties;
26
31
  }
27
32
  /**
28
33
  * A horizontal color gradient bar for visualizing color scales or ranges.
@@ -26,20 +26,23 @@ var __rest = (this && this.__rest) || function (s, e) {
26
26
  };
27
27
  import * as React from 'react';
28
28
  import styled from 'styled-components';
29
+ var DEFAULT_THICKNESS = 5;
29
30
  var GradientBase = function (props) {
30
31
  // Runtime guard:
31
32
  if (!Array.isArray(props.gradientStops) || props.gradientStops.length === 0) {
32
33
  console.warn("Gradient: Missing or invalid 'gradientStops'");
33
34
  return null;
34
35
  }
35
- return React.createElement("div", { "data-testid": props['data-testid'] || "Gradient", className: props.className });
36
+ return React.createElement("div", { "data-testid": props['data-testid'] || "Gradient", className: props.className, style: props.style });
36
37
  };
37
38
  var generateGradient = function (stops) {
38
- return "linear-gradient(to right, ".concat(stops.map(function (gs) { return "".concat(gs.color, " ").concat(gs.pos * 100, "%"); }).join(', '), ")");
39
+ return !Array.isArray(stops) || stops.length === 0
40
+ ? 'none'
41
+ : "linear-gradient(to right, ".concat(stops.map(function (gs) { return "".concat(gs.color, " ").concat(gs.pos * 100, "%"); }).join(', '), ")");
39
42
  };
40
43
  var GradientStyled = styled(GradientBase).attrs(function (p) {
41
44
  var _a;
42
- var thickness = (_a = p.thickness) !== null && _a !== void 0 ? _a : 5;
45
+ var thickness = (_a = p.thickness) !== null && _a !== void 0 ? _a : DEFAULT_THICKNESS;
43
46
  var background = p.checkered
44
47
  ? "".concat(generateGradient(p.gradientStops), ", repeating-conic-gradient(#808080 0% 25%, #fff 0% 50%) 50% / 10px 10px")
45
48
  : generateGradient(p.gradientStops);
@@ -153,7 +156,7 @@ var GradientStyled = styled(GradientBase).attrs(function (p) {
153
156
  * with transparency, making alpha values visible.
154
157
  */
155
158
  var Gradient = function (_a) {
156
- var _b = _a.thickness, thickness = _b === void 0 ? 5 : _b, _c = _a.checkered, checkered = _c === void 0 ? false : _c, props = __rest(_a, ["thickness", "checkered"]);
159
+ var _b = _a.thickness, thickness = _b === void 0 ? DEFAULT_THICKNESS : _b, _c = _a.checkered, checkered = _c === void 0 ? false : _c, props = __rest(_a, ["thickness", "checkered"]);
157
160
  return React.createElement(GradientStyled, __assign({ thickness: thickness, checkered: checkered }, props));
158
161
  };
159
162
  Gradient.displayName = "Gradient";
@@ -40,9 +40,15 @@ interface IHistogramProps extends ITestable {
40
40
  */
41
41
  nodata?: React.ReactNode;
42
42
  /**
43
- * Optional click event includes the index of the bar clicked (0-based):
43
+ * Fired when a bar is clicked. Receives the 0-based bar index and the
44
+ * originating mouse event.
44
45
  */
45
- onClick?: (idx: number) => void;
46
+ onClick?: (idx: number, e: React.MouseEvent) => void;
47
+ /**
48
+ * Optional inline styles applied to the outer element, for one-off overrides
49
+ * of the default styling.
50
+ */
51
+ style?: React.CSSProperties;
46
52
  }
47
53
  /**
48
54
  * A bar chart visualization for displaying binned data distributions.
@@ -31,28 +31,28 @@ import { HistogramBar } from './HistogramBar';
31
31
  import { HistogramTick } from './HistogramTick';
32
32
  import { DefaultHistogramAppearance } from './HistogramAppearance';
33
33
  var HistogramBase = function (props) {
34
+ var _a;
34
35
  // Abort if there are no bins.
35
36
  if (props.bins.length === 0)
36
37
  return React.createElement(HistogramNoData, null, props.nodata);
37
38
  // Find tallest bar. This is used to calculate the percentage height
38
39
  // of each bar.
39
- var maxHeight = Math.max.apply(Math, props.bins.map(function (b) { return b.count; }));
40
+ var maxHeight = Math.max.apply(Math, props.bins.map(function (b) { var _a; return (_a = b.count) !== null && _a !== void 0 ? _a : 0; }));
40
41
  // Abort if bins are all empty.
41
42
  if (maxHeight === 0)
42
43
  return React.createElement(HistogramNoData, null, props.nodata);
43
- return (React.createElement("div", { "data-testid": props['data-testid'] || "Histogram", className: props.className },
44
+ return (React.createElement("div", { "data-testid": props['data-testid'] || "Histogram", className: props.className, style: props.style },
44
45
  React.createElement(ChartArea, null,
45
46
  React.createElement(Indent, null,
46
47
  React.createElement(BarArea, null, props.bins.map(function (bin, idx) {
47
- return React.createElement(HistogramBar, { key: idx, values: props.values, value: bin.count, label: bin.name, height: 100 * bin.count / maxHeight, onClick: props.onClick ? function () { return props.onClick(idx); } : null, loading: props.loading, appearance: props.appearance });
48
+ var _a, _b, _c;
49
+ return React.createElement(HistogramBar, { key: idx, values: props.values, value: (_a = bin.count) !== null && _a !== void 0 ? _a : 0, label: bin.name, height: 100 * ((_b = bin.count) !== null && _b !== void 0 ? _b : 0) / maxHeight, onClick: props.onClick ? function (e) { return props.onClick(idx, e); } : undefined, loading: props.loading, appearance: (_c = props.appearance) !== null && _c !== void 0 ? _c : DefaultHistogramAppearance });
48
50
  })))),
49
51
  props.tickStyle !== 'none' && React.createElement(AxisArea, null,
50
52
  React.createElement(Indent, null,
51
- props.bins.map(function (bin, idx) {
52
- return React.createElement(HistogramTick, { key: idx, showValue: props.tickStyle === 'value', left: 100 * idx / props.bins.length, value: bin.binStart });
53
- }),
53
+ props.bins.map(function (bin, idx) { var _a; return React.createElement(HistogramTick, { key: idx, showValue: props.tickStyle === 'value', left: 100 * idx / props.bins.length, value: (_a = bin.binStart) !== null && _a !== void 0 ? _a : 0 }); }),
54
54
  props.bins.length > 0 &&
55
- React.createElement(HistogramTick, { left: 100, showValue: props.tickStyle === 'value', value: props.bins[props.bins.length - 1].binEnd }))),
55
+ React.createElement(HistogramTick, { left: 100, showValue: props.tickStyle === 'value', value: (_a = props.bins[props.bins.length - 1].binEnd) !== null && _a !== void 0 ? _a : 0 }))),
56
56
  props.unit && React.createElement(UnitArea, null, props.unit)));
57
57
  };
58
58
  var ChartArea = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
@@ -60,7 +60,7 @@ var AxisArea = styled.div(templateObject_2 || (templateObject_2 = __makeTemplate
60
60
  var UnitArea = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject([""], [""])));
61
61
  var BarArea = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject([""], [""])));
62
62
  var Indent = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject([""], [""])));
63
- var HistogramStyled = styled(HistogramBase)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n // Chart elements are stacked vertically:\n display: flex;\n flex-direction: column;\n // Histogram fills available space:\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n\n ", " {\n position: relative;\n flex: 1;\n }\n ", " {\n position: relative;\n flex: 0;\n height: 22px;\n min-height: 22px;\n box-sizing: border-box;\n }\n ", " {\n flex: 0;\n height: 20px;\n min-height: 20px;\n font-size: 10px;\n color: #fff;\n user-select: none; \n display: flex;\n flex-direction: column;\n justify-content: end;\n align-items: center;\n }\n ", " {\n // BarArea takes up an absolute position:\n position: absolute;\n width: 100%;\n height: 100%;\n // Bars are placed using flexbox:\n display: flex;\n flex-direction: row; \n justify-content: center;\n align-items: flex-end;\n overflow-y: hidden;\n overflow-x: hidden;\n }\n ", " {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 5%;\n right: 5%;\n }\n"], ["\n // Chart elements are stacked vertically:\n display: flex;\n flex-direction: column;\n // Histogram fills available space:\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n\n ", " {\n position: relative;\n flex: 1;\n }\n ", " {\n position: relative;\n flex: 0;\n height: 22px;\n min-height: 22px;\n box-sizing: border-box;\n }\n ", " {\n flex: 0;\n height: 20px;\n min-height: 20px;\n font-size: 10px;\n color: #fff;\n user-select: none; \n display: flex;\n flex-direction: column;\n justify-content: end;\n align-items: center;\n }\n ", " {\n // BarArea takes up an absolute position:\n position: absolute;\n width: 100%;\n height: 100%;\n // Bars are placed using flexbox:\n display: flex;\n flex-direction: row; \n justify-content: center;\n align-items: flex-end;\n overflow-y: hidden;\n overflow-x: hidden;\n }\n ", " {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 5%;\n right: 5%;\n }\n"
63
+ var HistogramStyled = styled(HistogramBase)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n // Chart elements are stacked vertically:\n display: flex;\n flex-direction: column;\n // Histogram fills available space:\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n\n ", " {\n position: relative;\n flex: 1;\n }\n ", " {\n position: relative;\n flex: 0;\n height: 22px;\n min-height: 22px;\n box-sizing: border-box;\n }\n ", " {\n flex: 0;\n height: 20px;\n min-height: 20px;\n font-size: 10px;\n color: ", ";\n user-select: none;\n display: flex;\n flex-direction: column;\n justify-content: end;\n align-items: center;\n }\n ", " {\n // BarArea takes up an absolute position:\n position: absolute;\n width: 100%;\n height: 100%;\n // Bars are placed using flexbox:\n display: flex;\n flex-direction: row; \n justify-content: center;\n align-items: flex-end;\n overflow-y: hidden;\n overflow-x: hidden;\n }\n ", " {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 5%;\n right: 5%;\n }\n"], ["\n // Chart elements are stacked vertically:\n display: flex;\n flex-direction: column;\n // Histogram fills available space:\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n\n ", " {\n position: relative;\n flex: 1;\n }\n ", " {\n position: relative;\n flex: 0;\n height: 22px;\n min-height: 22px;\n box-sizing: border-box;\n }\n ", " {\n flex: 0;\n height: 20px;\n min-height: 20px;\n font-size: 10px;\n color: ", ";\n user-select: none;\n display: flex;\n flex-direction: column;\n justify-content: end;\n align-items: center;\n }\n ", " {\n // BarArea takes up an absolute position:\n position: absolute;\n width: 100%;\n height: 100%;\n // Bars are placed using flexbox:\n display: flex;\n flex-direction: row; \n justify-content: center;\n align-items: flex-end;\n overflow-y: hidden;\n overflow-x: hidden;\n }\n ", " {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 5%;\n right: 5%;\n }\n"
64
64
  /**
65
65
  * A bar chart visualization for displaying binned data distributions.
66
66
  *
@@ -103,7 +103,7 @@ var HistogramStyled = styled(HistogramBase)(templateObject_6 || (templateObject_
103
103
  * gaps, opacity, and border radius. `DefaultHistogramAppearance` and
104
104
  * `BlueHistogramAppearance` presets are available.
105
105
  */
106
- ])), ChartArea, AxisArea, UnitArea, BarArea, Indent);
106
+ ])), ChartArea, AxisArea, UnitArea, function (p) { return p.theme.colors.font; }, BarArea, Indent);
107
107
  /**
108
108
  * A bar chart visualization for displaying binned data distributions.
109
109
  *
@@ -16,8 +16,8 @@ interface IProps {
16
16
  loading?: boolean;
17
17
  /** Histogram appearance. */
18
18
  appearance: IHistogramAppearance;
19
- /** Fired if bar is clicked. */
20
- onClick?: () => void;
19
+ /** Fired if bar is clicked. Receives the originating mouse event. */
20
+ onClick?: (e: React.MouseEvent) => void;
21
21
  }
22
22
  declare const HistogramBar: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<IProps, never>> & string & Omit<(props: IProps) => React.JSX.Element, keyof React.Component<any, {}, any>>;
23
23
  export { HistogramBar };
@@ -60,15 +60,21 @@ interface IIconProps extends ITestable {
60
60
  */
61
61
  padded?: boolean;
62
62
  /**
63
- * An icon can have an `onClick` handler. It is triggered when the icon
64
- * is clicked.
63
+ * An icon can have an `onClick` handler, triggered when the icon is clicked
64
+ * or, for keyboard users, activated with Enter/Space. Receives the
65
+ * originating mouse or keyboard event. When set, the icon is exposed as a
66
+ * focusable `button` to assistive technology.
65
67
  */
66
- onClick?: (e?: React.MouseEvent) => void;
68
+ onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
69
+ /**
70
+ * Optional inline styles applied to the outer element, for one-off overrides
71
+ * of the default styling.
72
+ */
73
+ style?: React.CSSProperties;
67
74
  }
68
75
  declare const IconBase: (props: IIconProps) => React.JSX.Element;
69
76
  interface IStyledProps {
70
77
  $realSize: string;
71
- $color: string;
72
78
  }
73
79
  declare const IconStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<IIconProps, IIconProps>, IIconProps & Partial<IStyledProps>>, IIconProps>> & string & Omit<(props: IIconProps) => React.JSX.Element, keyof React.Component<any, {}, any>>;
74
80
  /**
@@ -29,25 +29,42 @@ import styled, { keyframes, css } from 'styled-components';
29
29
  // Helpers
30
30
  import { lighten } from '../../helper/lighten';
31
31
  import { scaleSize } from '../../helper/SizeHelper';
32
+ // Default prop values, referenced both by the IconStyled fallbacks and the
33
+ // Icon wrapper below.
34
+ var DEFAULT_SIZE = 'medium';
35
+ var DEFAULT_COLOR = 'white';
32
36
  var IconBase = function (props) {
37
+ // An icon with an onClick behaves as a button; otherwise it is presentational.
38
+ var interactive = !!props.onClick && !props.disabled;
33
39
  var handleClick = function (e) {
34
40
  if (props.disabled)
35
41
  return;
36
42
  if (props.onClick)
37
43
  props.onClick(e);
38
44
  };
39
- return (React.createElement("svg", { "data-testid": props['data-testid'] || "Icon", className: props.className, onClick: handleClick, focusable: "false", role: "img" },
45
+ var handleKeyDown = function (e) {
46
+ var _a;
47
+ if (props.disabled)
48
+ return;
49
+ if (e.key === 'Enter' || e.key === ' ') {
50
+ e.preventDefault();
51
+ (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
52
+ }
53
+ };
54
+ return (React.createElement("svg", { "data-testid": props['data-testid'] || "Icon", className: props.className, style: props.style, onClick: handleClick, onKeyDown: interactive ? handleKeyDown : undefined, tabIndex: interactive ? 0 : undefined, role: interactive ? 'button' : props.title ? 'img' : undefined, "aria-label": interactive ? props.title : undefined, "aria-hidden": !interactive && !props.title ? true : undefined, focusable: interactive ? undefined : "false" },
40
55
  props.title && React.createElement("title", null, props.title),
41
56
  React.createElement("use", { xlinkHref: props.url })));
42
57
  };
43
58
  var rotate = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from { rotate: 0deg; }\n to { rotate: 360deg; }\n"], ["\n from { rotate: 0deg; }\n to { rotate: 360deg; }\n"])));
44
59
  var IconStyled = styled(IconBase).attrs(function (p) {
45
- var _a, _b;
60
+ var _a;
46
61
  return ({
47
- $realSize: typeof p.size === 'number' ? "".concat(p.size, "px") : "".concat(scaleSize((_a = p.size) !== null && _a !== void 0 ? _a : 'medium', 1, 'minorThird'), "em"),
48
- $color: (_b = p.$color) !== null && _b !== void 0 ? _b : p.theme.colors.neutral[100]
62
+ $realSize: typeof p.size === 'number' ? "".concat(p.size, "px") : "".concat(scaleSize((_a = p.size) !== null && _a !== void 0 ? _a : DEFAULT_SIZE, 1, 'minorThird'), "em")
49
63
  });
50
- })(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n position: relative;\n shape-rendering: geometricPrecision;\n box-sizing: border-box;\n\n // Circle:\n ", "\n \n // Spacing around icon:\n ", "\n\n // Clickable icons have a cursor hint:\n ", "\n\n // Disabled:\n ", "\n\n // Sizes:\n width: ", "; \n height: ", ";\n // Don't be squished when in a flex:\n min-width: ", "; \n min-height: ", ";\n\n // Transformations:\n transform-origin: center;\n transform: ", " ", " ", ";\n\n // Icon colors:\n fill: ", ";\n ", "\n\n // Animated:\n ", "\n"], ["\n position: relative;\n shape-rendering: geometricPrecision;\n box-sizing: border-box;\n\n // Circle:\n ", "\n \n // Spacing around icon:\n ", "\n\n // Clickable icons have a cursor hint:\n ", "\n\n // Disabled:\n ", "\n\n // Sizes:\n width: ", "; \n height: ", ";\n // Don't be squished when in a flex:\n min-width: ", "; \n min-height: ", ";\n\n // Transformations:\n transform-origin: center;\n transform: ", " ", " ", ";\n\n // Icon colors:\n fill: ", ";\n ", "\n\n // Animated:\n ", "\n"])), function (p) { return p.circle && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 50%;\n border: solid 1px ", ";\n "], ["\n border-radius: 50%;\n border: solid 1px ", ";\n "])), p.color); }, function (p) { return p.padded && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["margin: 2px;"], ["margin: 2px;"]))); }, function (p) { return p.onClick && !p.disabled && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["cursor: pointer;"], ["cursor: pointer;"]))); }, function (p) { return p.disabled && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n pointer-events: none;\n opacity: 0.6;\n "], ["\n pointer-events: none;\n opacity: 0.6;\n "]))); }, function (p) { return p.$realSize; }, function (p) { return p.$realSize; }, function (p) { return p.$realSize; }, function (p) { return p.$realSize; }, function (p) { return p.flipped ? 'scaleY(-1)' : ''; }, function (p) { return p.mirrored ? 'scaleX(-1)' : ''; }, function (p) { return p.rotated ? "rotate(".concat(p.rotated, "deg)") : ''; }, function (p) { return p.color; }, function (p) { return p.onClick && css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n transition: \n fill ", "ms ease, \n border-color ", "ms ease,\n outline-color ", "ms ease;\n &:hover {\n fill: ", ";\n border-color: ", ";\n }\n "], ["\n transition: \n fill ", "ms ease, \n border-color ", "ms ease,\n outline-color ", "ms ease;\n &:hover {\n fill: ", ";\n border-color: ", ";\n }\n "])), function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, lighten(0.3, p.color), lighten(0.3, p.color)); }, function (p) { return p.animated && css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n animation: ", " 2s linear infinite;\n "], ["\n animation: ", " 2s linear infinite;\n "])), rotate); });
64
+ })(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n position: relative;\n shape-rendering: geometricPrecision;\n box-sizing: border-box;\n\n // Circle:\n ", "\n \n // Spacing around icon:\n ", "\n\n // Clickable icons have a cursor hint:\n ", "\n\n // Disabled:\n ", "\n\n // Sizes:\n width: ", "; \n height: ", ";\n // Don't be squished when in a flex:\n min-width: ", "; \n min-height: ", ";\n\n // Transformations:\n transform-origin: center;\n transform: ", " ", " ", ";\n\n // Icon colors:\n fill: ", ";\n ", "\n\n // Animated:\n ", "\n"], ["\n position: relative;\n shape-rendering: geometricPrecision;\n box-sizing: border-box;\n\n // Circle:\n ", "\n \n // Spacing around icon:\n ", "\n\n // Clickable icons have a cursor hint:\n ", "\n\n // Disabled:\n ", "\n\n // Sizes:\n width: ", "; \n height: ", ";\n // Don't be squished when in a flex:\n min-width: ", "; \n min-height: ", ";\n\n // Transformations:\n transform-origin: center;\n transform: ", " ", " ", ";\n\n // Icon colors:\n fill: ", ";\n ", "\n\n // Animated:\n ", "\n"])), function (p) { return p.circle && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 50%;\n border: solid 1px ", ";\n "], ["\n border-radius: 50%;\n border: solid 1px ", ";\n "])), p.color); }, function (p) { return p.padded && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["margin: 2px;"], ["margin: 2px;"]))); }, function (p) { return p.onClick && !p.disabled && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["cursor: pointer;"], ["cursor: pointer;"]))); }, function (p) { return p.disabled && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n pointer-events: none;\n opacity: 0.6;\n "], ["\n pointer-events: none;\n opacity: 0.6;\n "]))); }, function (p) { return p.$realSize; }, function (p) { return p.$realSize; }, function (p) { return p.$realSize; }, function (p) { return p.$realSize; }, function (p) { return p.flipped ? 'scaleY(-1)' : ''; }, function (p) { return p.mirrored ? 'scaleX(-1)' : ''; }, function (p) { return p.rotated ? "rotate(".concat(p.rotated, "deg)") : ''; }, function (p) { return p.color; }, function (p) {
65
+ var _a, _b;
66
+ return p.onClick && css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n transition: \n fill ", "ms ease, \n border-color ", "ms ease,\n outline-color ", "ms ease;\n &:hover {\n fill: ", ";\n border-color: ", ";\n }\n "], ["\n transition: \n fill ", "ms ease, \n border-color ", "ms ease,\n outline-color ", "ms ease;\n &:hover {\n fill: ", ";\n border-color: ", ";\n }\n "])), function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, lighten(0.3, (_a = p.color) !== null && _a !== void 0 ? _a : DEFAULT_COLOR), lighten(0.3, (_b = p.color) !== null && _b !== void 0 ? _b : DEFAULT_COLOR));
67
+ }, function (p) { return p.animated && css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n animation: ", " 2s linear infinite;\n "], ["\n animation: ", " 2s linear infinite;\n "])), rotate); });
51
68
  /**
52
69
  * An SVG icon from a sprite sheet with support for sizing, colors, and transformations.
53
70
  *
@@ -102,7 +119,7 @@ var IconStyled = styled(IconBase).attrs(function (p) {
102
119
  * | `animated` | Continuous rotation animation |
103
120
  */
104
121
  var Icon = function (_a) {
105
- var _b = _a.size, size = _b === void 0 ? 'medium' : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.flipped, flipped = _d === void 0 ? false : _d, _e = _a.mirrored, mirrored = _e === void 0 ? false : _e, _f = _a.animated, animated = _f === void 0 ? false : _f, _g = _a.padded, padded = _g === void 0 ? false : _g, _h = _a.circle, circle = _h === void 0 ? false : _h, _j = _a.color, color = _j === void 0 ? "white" : _j, props = __rest(_a, ["size", "disabled", "flipped", "mirrored", "animated", "padded", "circle", "color"]);
122
+ var _b = _a.size, size = _b === void 0 ? DEFAULT_SIZE : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.flipped, flipped = _d === void 0 ? false : _d, _e = _a.mirrored, mirrored = _e === void 0 ? false : _e, _f = _a.animated, animated = _f === void 0 ? false : _f, _g = _a.padded, padded = _g === void 0 ? false : _g, _h = _a.circle, circle = _h === void 0 ? false : _h, _j = _a.color, color = _j === void 0 ? DEFAULT_COLOR : _j, props = __rest(_a, ["size", "disabled", "flipped", "mirrored", "animated", "padded", "circle", "color"]);
106
123
  return React.createElement(IconStyled, __assign({ size: size, disabled: disabled, flipped: flipped, mirrored: mirrored, animated: animated, padded: padded, circle: circle, color: color }, props));
107
124
  };
108
125
  export { IconBase, Icon, IconStyled };
@@ -12,6 +12,11 @@ interface IKeyProps extends ITestable {
12
12
  * Fakes a Mac keyboard.
13
13
  */
14
14
  _fakeMac?: boolean;
15
+ /**
16
+ * Optional inline styles applied to the outer element, for one-off overrides
17
+ * of the default styling.
18
+ */
19
+ style?: React.CSSProperties;
15
20
  }
16
21
  /**
17
22
  * A visual representation of a keyboard key for displaying shortcuts or instructions.
@@ -18,7 +18,7 @@ import styled from 'styled-components';
18
18
  import { Icon } from '../Icon';
19
19
  import { SVG } from '../../svg';
20
20
  var KeyBase = function (props) {
21
- var isMac = navigator.userAgent.includes('Mac') || props._fakeMac;
21
+ var isMac = (typeof navigator !== 'undefined' && navigator.userAgent.includes('Mac')) || props._fakeMac;
22
22
  // symbol and wide depend only on isMac and props.value, so we memoize them:
23
23
  var _a = React.useMemo(function () {
24
24
  var sym = props.value;
@@ -48,10 +48,7 @@ var KeyBase = function (props) {
48
48
  }
49
49
  return { symbol: sym, wide: isWide };
50
50
  }, [props.value, isMac]), symbol = _a.symbol, wide = _a.wide;
51
- return (React.createElement("span", { "data-testid": props['data-testid'] || "Key", className: props.className, style: {
52
- maxWidth: wide ? 'auto' : '16px',
53
- minWidth: wide ? '36px' : 'auto'
54
- }, "aria-label": props.value },
51
+ return (React.createElement("span", { "data-testid": props['data-testid'] || "Key", className: props.className, style: __assign({ maxWidth: wide ? 'auto' : '16px', minWidth: wide ? '36px' : 'auto' }, props.style), role: "img", "aria-label": props.value },
55
52
  React.createElement(Inner, { style: { justifyContent: wide ? 'flex-start' : 'center' } }, symbol)));
56
53
  };
57
54
  var Inner = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n display: flex;\n align-items: center;\n height: 100%;\n"], ["\n position: relative;\n display: flex;\n align-items: center;\n height: 100%;\n"])));
@@ -27,6 +27,15 @@ interface ILinearChartProps extends ITestable {
27
27
  * @default false
28
28
  */
29
29
  ghost?: boolean;
30
+ /**
31
+ * Accessible name for the progress bar, announced by screen readers.
32
+ */
33
+ ariaLabel?: string;
34
+ /**
35
+ * Optional inline styles applied to the outer element, for one-off overrides
36
+ * of the default styling.
37
+ */
38
+ style?: React.CSSProperties;
30
39
  }
31
40
  /**
32
41
  * A horizontal progress bar for visualizing percentage values.
@@ -27,22 +27,27 @@ var __rest = (this && this.__rest) || function (s, e) {
27
27
  import * as React from 'react';
28
28
  import styled from 'styled-components';
29
29
  import { Ghost } from '../Ghost';
30
+ // Clamp a value into the 0..100 progress range, guarding against non-finite input.
31
+ var clampPercent = function (v) { return Number.isFinite(v) ? Math.max(0, Math.min(100, v)) : 0; };
30
32
  var LinearChartBase = function (props) {
31
- var percentage = Math.round(Math.max(0, Math.min(100, props.value))) + "%";
32
- return (React.createElement("div", { "data-testid": props['data-testid'] || "LinearChart", className: props.className, role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(props.value) },
33
+ var value = clampPercent(props.value);
34
+ var percentage = Math.round(value) + "%";
35
+ return (React.createElement("div", { "data-testid": props['data-testid'] || "LinearChart", className: props.className, style: props.style, role: "progressbar", "aria-label": props.ariaLabel, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(value) },
33
36
  props.label && React.createElement(Label, null,
34
37
  props.ghost && React.createElement(Ghost, { style: { position: 'absolute', left: 0, top: '2px', right: 0, bottom: '2px' } }),
35
38
  !props.ghost && props.label),
36
- !props.ghost && props.numbered && React.createElement(Number, null, percentage),
39
+ !props.ghost && props.numbered && React.createElement(Percentage, null, percentage),
37
40
  !props.ghost && React.createElement(Bar, null),
38
41
  props.ghost && React.createElement(GhostWrapper, null,
39
42
  React.createElement(Ghost, { style: { position: 'absolute', left: 0, top: '2px', right: 0, bottom: '2px' } }))));
40
43
  };
41
44
  var Label = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n width: 120px;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n height: 18px;\n line-height: 18px; // If not, will chop accents of \u00C3 and \u00C7.\n"], ["\n position: relative;\n width: 120px;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n height: 18px;\n line-height: 18px; // If not, will chop accents of \u00C3 and \u00C7.\n"])));
42
- var Number = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 40px;\n text-align: right;\n height: 18px; // If not, will chop accents of \u00C3 and \u00C7.\n line-height: 18px;\n"], ["\n width: 40px;\n text-align: right;\n height: 18px; // If not, will chop accents of \u00C3 and \u00C7.\n line-height: 18px;\n"])));
45
+ var Percentage = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 40px;\n text-align: right;\n height: 18px; // If not, will chop accents of \u00C3 and \u00C7.\n line-height: 18px;\n"], ["\n width: 40px;\n text-align: right;\n height: 18px; // If not, will chop accents of \u00C3 and \u00C7.\n line-height: 18px;\n"])));
43
46
  var Bar = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative; \n box-sizing: border-box;\n flex: 1;\n height: 14px;\n\n background-color: ", ";\n border-radius: 7px;\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n box-sizing: border-box;\n transition: width ", "ms ease;\n border-radius: 7px;\n } \n"], ["\n position: relative; \n box-sizing: border-box;\n flex: 1;\n height: 14px;\n\n background-color: ", ";\n border-radius: 7px;\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n box-sizing: border-box;\n transition: width ", "ms ease;\n border-radius: 7px;\n } \n"])), function (p) { return p.theme.colors.primary[4]; }, function (p) { return p.theme.animation.duration * 2; });
44
47
  var GhostWrapper = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: relative;\n height: 18px;\n flex: 1;\n"], ["\n position: relative;\n height: 18px;\n flex: 1;\n"])));
45
- var LinearChartStyled = styled(LinearChartBase)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: space-between;\n height: 18px;\n gap: 8px;\n min-width: 200px;\n user-select: none;\n\n font: ", ";\n color: ", ";\n line-height: 0;\n text-transform: uppercase;\n\n ", " {\n &:before {\n width: ", "%;\n background-color: ", ";\n }\n }\n"], ["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: space-between;\n height: 18px;\n gap: 8px;\n min-width: 200px;\n user-select: none;\n\n font: ", ";\n color: ", ";\n line-height: 0;\n text-transform: uppercase;\n\n ", " {\n &:before {\n width: ", "%;\n background-color: ", ";\n }\n }\n"
48
+ var LinearChartStyled = styled(LinearChartBase).attrs(function (p) { return ({
49
+ $fill: clampPercent(p.value)
50
+ }); })(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: space-between;\n height: 18px;\n gap: 8px;\n min-width: 200px;\n user-select: none;\n\n font: ", ";\n color: ", ";\n line-height: 0;\n text-transform: uppercase;\n\n ", " {\n &:before {\n width: ", "%;\n background-color: ", ";\n }\n }\n"], ["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: space-between;\n height: 18px;\n gap: 8px;\n min-width: 200px;\n user-select: none;\n\n font: ", ";\n color: ", ";\n line-height: 0;\n text-transform: uppercase;\n\n ", " {\n &:before {\n width: ", "%;\n background-color: ", ";\n }\n }\n"
46
51
  /**
47
52
  * A horizontal progress bar for visualizing percentage values.
48
53
  *
@@ -78,7 +83,7 @@ var LinearChartStyled = styled(LinearChartBase)(templateObject_5 || (templateObj
78
83
  *
79
84
  * Includes `role="progressbar"` with `aria-valuenow`, `aria-valuemin`, and `aria-valuemax`.
80
85
  */
81
- ])), function (p) { return p.theme.font.dataLarge; }, function (p) { return p.theme.colors.font; }, Bar, function (p) { return Math.max(0, Math.min(100, p.value)); }, function (p) { var _a; return (_a = p.color) !== null && _a !== void 0 ? _a : p.theme.colors.primary[1]; });
86
+ ])), function (p) { return p.theme.font.dataLarge; }, function (p) { return p.theme.colors.font; }, Bar, function (p) { return p.$fill; }, function (p) { var _a; return (_a = p.color) !== null && _a !== void 0 ? _a : p.theme.colors.primary[1]; });
82
87
  /**
83
88
  * A horizontal progress bar for visualizing percentage values.
84
89
  *
@@ -4,9 +4,14 @@ import { ITestable } from '../../Types';
4
4
  interface IListButtonProps extends ITestable {
5
5
  /** @ignore */
6
6
  children?: React.ReactNode;
7
- /** Toggle control that opens/closes the list. Receives an `onClick` handler. */
7
+ /**
8
+ * Toggle control that opens/closes the list. It is cloned with an `onClick`
9
+ * handler and `aria-haspopup` / `aria-expanded` attributes.
10
+ */
8
11
  toggle: React.ReactElement<{
9
12
  onClick?: React.MouseEventHandler;
13
+ 'aria-haspopup'?: boolean;
14
+ 'aria-expanded'?: boolean;
10
15
  }>;
11
16
  /**
12
17
  * Pane width in pixels.
@@ -18,12 +23,50 @@ interface IListButtonProps extends ITestable {
18
23
  * @default top-start
19
24
  */
20
25
  placement?: Placement;
26
+ /**
27
+ * Maximum number of list rows shown before the pane scrolls.
28
+ * @default 6
29
+ */
30
+ maxItems?: number;
31
+ /**
32
+ * Optional inline styles applied to the outer (trigger) element, for one-off
33
+ * overrides of the default styling.
34
+ */
35
+ style?: React.CSSProperties;
21
36
  }
22
37
  /**
23
- * Best used with `<ListRow>` children.
38
+ * A trigger element that opens a floating panel of list rows, positioned
39
+ * relative to the trigger with Popper.
40
+ *
41
+ * You provide any element as the `toggle` (typically a button or icon); it is
42
+ * cloned with a click handler that opens/closes the panel, plus
43
+ * `aria-haspopup` / `aria-expanded`. The panel contents are best expressed as
44
+ * `<ListRow>` children. The panel closes on outside click or `Escape`.
45
+ *
46
+ * ## Usage
47
+ *
48
+ * ```tsx
49
+ * <ListButton toggle={<Fab icon={SVG.Icons.More} onClick={() => {}} />}>
50
+ * <ListRow onClick={rename}>Rename</ListRow>
51
+ * <ListRow onClick={remove}>Delete</ListRow>
52
+ * </ListButton>
53
+ *
54
+ * // Custom width and placement
55
+ * <ListButton toggle={<Button>Options</Button>} width={320} placement="bottom-end">
56
+ * ...
57
+ * </ListButton>
58
+ * ```
59
+ *
60
+ * ## Display Options
61
+ *
62
+ * | Prop | Default | Description |
63
+ * |------|---------|-------------|
64
+ * | `width` | `250` | Panel width in pixels |
65
+ * | `placement` | `top-start` | Popper placement of the panel |
66
+ * | `maxItems` | `6` | Rows shown before the panel scrolls |
24
67
  */
25
68
  declare const ListButton: {
26
- ({ width, placement, ...props }: IListButtonProps): React.JSX.Element;
69
+ ({ width, placement, maxItems, ...props }: IListButtonProps): React.JSX.Element;
27
70
  displayName: string;
28
71
  };
29
72
  export { ListButton };
@@ -30,10 +30,15 @@ import { usePopper } from 'react-popper';
30
30
  import { createPortal } from 'react-dom';
31
31
  import { useOutsideClose } from '../../hooks/useOutsideClose';
32
32
  import { List } from '../../containers/List';
33
+ // Default prop values, referenced both by the ListButtonBase fallbacks and the
34
+ // ListButton wrapper below.
35
+ var DEFAULT_WIDTH = 250;
36
+ var DEFAULT_MAX_ITEMS = 6;
33
37
  var ListButtonBase = function (props) {
38
+ var _a, _b;
34
39
  var buttonRef = React.useRef(null);
35
40
  var paneRef = React.useRef(null);
36
- var _a = React.useState(false), open = _a[0], setOpen = _a[1];
41
+ var _c = React.useState(false), open = _c[0], setOpen = _c[1];
37
42
  useOutsideClose({
38
43
  open: open,
39
44
  refs: [paneRef, buttonRef],
@@ -41,7 +46,7 @@ var ListButtonBase = function (props) {
41
46
  escapeToClose: true,
42
47
  blurToClose: false
43
48
  });
44
- var _b = usePopper(buttonRef.current, paneRef.current, {
49
+ var _d = usePopper(buttonRef.current, paneRef.current, {
45
50
  placement: props.placement,
46
51
  modifiers: [
47
52
  {
@@ -51,7 +56,7 @@ var ListButtonBase = function (props) {
51
56
  },
52
57
  }
53
58
  ]
54
- }), styles = _b.styles, attributes = _b.attributes, update = _b.update;
59
+ }), styles = _d.styles, attributes = _d.attributes, update = _d.update;
55
60
  var toggleOpen = function () {
56
61
  setOpen(!open);
57
62
  // Update popper.
@@ -59,20 +64,76 @@ var ListButtonBase = function (props) {
59
64
  update();
60
65
  };
61
66
  return (React.createElement(React.Fragment, null,
62
- React.createElement("div", { "data-testid": props['data-testid'] || "ListButton", ref: buttonRef, style: { display: 'inline-block' } }, React.cloneElement(props.toggle, { onClick: toggleOpen })),
63
- createPortal(React.createElement(Pane, __assign({ "$open": open, "$width": props.width, style: styles.popper }, attributes.popper, { ref: paneRef }), open && React.createElement(List, { maxItems: 6, contract: true }, props.children)), document.body)));
67
+ React.createElement("div", { "data-testid": props['data-testid'] || "ListButton", ref: buttonRef, style: __assign({ display: 'inline-block' }, props.style) }, React.cloneElement(props.toggle, { onClick: toggleOpen, 'aria-haspopup': true, 'aria-expanded': open })),
68
+ createPortal(React.createElement(Pane, __assign({ "$open": open, "$width": (_a = props.width) !== null && _a !== void 0 ? _a : DEFAULT_WIDTH, style: styles.popper }, attributes.popper, { ref: paneRef }), open && React.createElement(List, { maxItems: (_b = props.maxItems) !== null && _b !== void 0 ? _b : DEFAULT_MAX_ITEMS, contract: true }, props.children)), document.body)));
64
69
  };
65
70
  var Pane = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n width: ", "px;\n z-index: 2500;\n"], ["\n display: ", ";\n width: ", "px;\n z-index: 2500;\n"
66
71
  /**
67
- * Best used with `<ListRow>` children.
72
+ * A trigger element that opens a floating panel of list rows, positioned
73
+ * relative to the trigger with Popper.
74
+ *
75
+ * You provide any element as the `toggle` (typically a button or icon); it is
76
+ * cloned with a click handler that opens/closes the panel, plus
77
+ * `aria-haspopup` / `aria-expanded`. The panel contents are best expressed as
78
+ * `<ListRow>` children. The panel closes on outside click or `Escape`.
79
+ *
80
+ * ## Usage
81
+ *
82
+ * ```tsx
83
+ * <ListButton toggle={<Fab icon={SVG.Icons.More} onClick={() => {}} />}>
84
+ * <ListRow onClick={rename}>Rename</ListRow>
85
+ * <ListRow onClick={remove}>Delete</ListRow>
86
+ * </ListButton>
87
+ *
88
+ * // Custom width and placement
89
+ * <ListButton toggle={<Button>Options</Button>} width={320} placement="bottom-end">
90
+ * ...
91
+ * </ListButton>
92
+ * ```
93
+ *
94
+ * ## Display Options
95
+ *
96
+ * | Prop | Default | Description |
97
+ * |------|---------|-------------|
98
+ * | `width` | `250` | Panel width in pixels |
99
+ * | `placement` | `top-start` | Popper placement of the panel |
100
+ * | `maxItems` | `6` | Rows shown before the panel scrolls |
68
101
  */
69
102
  ])), function (p) { return p.$open ? 'block' : 'none'; }, function (p) { return p.$width; });
70
103
  /**
71
- * Best used with `<ListRow>` children.
104
+ * A trigger element that opens a floating panel of list rows, positioned
105
+ * relative to the trigger with Popper.
106
+ *
107
+ * You provide any element as the `toggle` (typically a button or icon); it is
108
+ * cloned with a click handler that opens/closes the panel, plus
109
+ * `aria-haspopup` / `aria-expanded`. The panel contents are best expressed as
110
+ * `<ListRow>` children. The panel closes on outside click or `Escape`.
111
+ *
112
+ * ## Usage
113
+ *
114
+ * ```tsx
115
+ * <ListButton toggle={<Fab icon={SVG.Icons.More} onClick={() => {}} />}>
116
+ * <ListRow onClick={rename}>Rename</ListRow>
117
+ * <ListRow onClick={remove}>Delete</ListRow>
118
+ * </ListButton>
119
+ *
120
+ * // Custom width and placement
121
+ * <ListButton toggle={<Button>Options</Button>} width={320} placement="bottom-end">
122
+ * ...
123
+ * </ListButton>
124
+ * ```
125
+ *
126
+ * ## Display Options
127
+ *
128
+ * | Prop | Default | Description |
129
+ * |------|---------|-------------|
130
+ * | `width` | `250` | Panel width in pixels |
131
+ * | `placement` | `top-start` | Popper placement of the panel |
132
+ * | `maxItems` | `6` | Rows shown before the panel scrolls |
72
133
  */
73
134
  var ListButton = function (_a) {
74
- var _b = _a.width, width = _b === void 0 ? 250 : _b, _c = _a.placement, placement = _c === void 0 ? 'top-start' : _c, props = __rest(_a, ["width", "placement"]);
75
- return React.createElement(ListButtonBase, __assign({ width: width, placement: placement }, props));
135
+ var _b = _a.width, width = _b === void 0 ? DEFAULT_WIDTH : _b, _c = _a.placement, placement = _c === void 0 ? 'top-start' : _c, _d = _a.maxItems, maxItems = _d === void 0 ? DEFAULT_MAX_ITEMS : _d, props = __rest(_a, ["width", "placement", "maxItems"]);
136
+ return React.createElement(ListButtonBase, __assign({ width: width, placement: placement, maxItems: maxItems }, props));
76
137
  };
77
138
  ListButton.displayName = "ListButton";
78
139
  export { ListButton };
@@ -22,9 +22,13 @@ var ColumnDraggableBase = function (props) {
22
22
  var theme = useTheme();
23
23
  var wrapperRef = React.useRef(null);
24
24
  var handleMouseDown = function () {
25
+ if (!wrapperRef.current)
26
+ return;
25
27
  wrapperRef.current.draggable = true;
26
28
  };
27
29
  var handleMouseUp = function () {
30
+ if (!wrapperRef.current)
31
+ return;
28
32
  wrapperRef.current.draggable = false;
29
33
  };
30
34
  var handleDragStart = function (ev) {
@@ -56,20 +60,22 @@ var ColumnDraggableBase = function (props) {
56
60
  return target;
57
61
  };
58
62
  var handleDragEnter = function (ev) {
63
+ var _a;
59
64
  ev.preventDefault();
60
- getDropzone(ev.target).classList.add('drop');
65
+ (_a = getDropzone(ev.target)) === null || _a === void 0 ? void 0 : _a.classList.add('drop');
61
66
  };
62
67
  var handleDragLeave = function (ev) {
68
+ var _a, _b, _c, _d;
63
69
  // If the destination is not a dropzone, remove my class.
64
70
  if (!getDropzone(ev.relatedTarget)) {
65
- getDropzone(ev.target).classList.remove('drop');
71
+ (_a = getDropzone(ev.target)) === null || _a === void 0 ? void 0 : _a.classList.remove('drop');
66
72
  return;
67
73
  }
68
74
  // The destination is a dropzone. Is it the same as the current one?
69
- var src_name = getDropzone(ev.target).getAttribute('x-name');
70
- var dest_name = getDropzone(ev.relatedTarget).getAttribute('x-name');
75
+ var src_name = (_b = getDropzone(ev.target)) === null || _b === void 0 ? void 0 : _b.getAttribute('x-name');
76
+ var dest_name = (_c = getDropzone(ev.relatedTarget)) === null || _c === void 0 ? void 0 : _c.getAttribute('x-name');
71
77
  if (src_name != dest_name) {
72
- getDropzone(ev.target).classList.remove('drop');
78
+ (_d = getDropzone(ev.target)) === null || _d === void 0 ? void 0 : _d.classList.remove('drop');
73
79
  return;
74
80
  }
75
81
  };
@@ -36,7 +36,7 @@ var SourceColumnsBase = function (props) {
36
36
  */
37
37
  var reactNodeToString = function (node) {
38
38
  if (node === null || node === undefined || typeof node === 'boolean')
39
- return null;
39
+ return '';
40
40
  if (typeof node === 'string' || typeof node === 'number')
41
41
  return String(node);
42
42
  // If it's an array of nodes, recursively join them