@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
@@ -13,42 +13,6 @@ var __assign = (this && this.__assign) || function () {
13
13
  };
14
14
  return __assign.apply(this, arguments);
15
15
  };
16
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
- return new (P || (P = Promise))(function (resolve, reject) {
19
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
- step((generator = generator.apply(thisArg, _arguments || [])).next());
23
- });
24
- };
25
- var __generator = (this && this.__generator) || function (thisArg, body) {
26
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
27
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
- function verb(n) { return function (v) { return step([n, v]); }; }
29
- function step(op) {
30
- if (f) throw new TypeError("Generator is already executing.");
31
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
- if (y = 0, t) op = [op[0] & 2, t.value];
34
- switch (op[0]) {
35
- case 0: case 1: t = op; break;
36
- case 4: _.label++; return { value: op[1], done: false };
37
- case 5: _.label++; y = op[1]; op = [0]; continue;
38
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
- default:
40
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
- if (t[2]) _.ops.pop();
45
- _.trys.pop(); continue;
46
- }
47
- op = body.call(thisArg, _);
48
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
- }
51
- };
52
16
  var __rest = (this && this.__rest) || function (s, e) {
53
17
  var t = {};
54
18
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -97,18 +61,21 @@ var sameWidth = {
97
61
  state.elements.popper.style.width = "".concat(state.elements.reference.offsetWidth, "px");
98
62
  }
99
63
  };
64
+ // Default number of items shown before the body scrolls; shared by base and wrapper.
65
+ var DEFAULT_MAX_ITEMS = 6;
100
66
  var DropdownBase = function (props) {
67
+ var _a;
101
68
  // Current value. Keeps track of current value without waiting for new
102
69
  // value from form, in case there is no form parent.
103
- var _a = React.useState(props.value), value = _a[0], setValue = _a[1];
70
+ var _b = React.useState(props.value), value = _b[0], setValue = _b[1];
104
71
  // Ref to wrapper:
105
72
  var wrapperRef = React.useRef(null);
106
73
  // Ref to scrollable body content:
107
74
  var bodyRef = React.useRef(null);
108
75
  // Is dropdown currently open?
109
- var _b = React.useState(false), open = _b[0], setOpen = _b[1];
76
+ var _c = React.useState(false), open = _c[0], setOpen = _c[1];
110
77
  // Current search query.
111
- var _c = React.useState(null), search = _c[0], setSearch = _c[1];
78
+ var _d = React.useState(null), search = _d[0], setSearch = _d[1];
112
79
  // When value props changes, change local state value also.
113
80
  React.useEffect(function () {
114
81
  setValue(props.value);
@@ -126,8 +93,10 @@ var DropdownBase = function (props) {
126
93
  // If a search box is present, move focus to it:
127
94
  if (props.onSearch) {
128
95
  setTimeout(function () {
96
+ if (!bodyRef.current)
97
+ return;
129
98
  var input = bodyRef.current.querySelector('input');
130
- input.focus();
99
+ input === null || input === void 0 ? void 0 : input.focus();
131
100
  // In IE/Chrome, body content scrolls up a little when setting focus
132
101
  // to search input. Scroll it back to top.
133
102
  bodyRef.current.children[0].scrollTop = 0;
@@ -136,9 +105,10 @@ var DropdownBase = function (props) {
136
105
  };
137
106
  // Close the dropdown.
138
107
  var doClose = function () {
108
+ var _a;
139
109
  setOpen(false);
140
110
  // Focus was on popper; restore focus to Dropdown.
141
- wrapperRef.current.focus();
111
+ (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.focus();
142
112
  // When the dropdown is closed, an onClose event may be fired.
143
113
  // It is fired 300ms after dropdown closure to give the close
144
114
  // animation a chance to run, before any changes are made
@@ -178,12 +148,13 @@ var DropdownBase = function (props) {
178
148
  c = c.toLowerCase();
179
149
  // Go through all (non-null) data records:
180
150
  var idx = (props.data || []).filter(function (r) { return r != null; }).findIndex(function (row) {
151
+ var _a, _b;
181
152
  // Build a list of strings contained in the data row:
182
153
  var strings = [];
183
154
  // If data row is an object, convert all its keys to string.
184
155
  if (typeof row === 'object' && row != null) {
185
156
  for (var p in row)
186
- strings.push(row[p].toString());
157
+ strings.push((_b = (_a = row[p]) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '');
187
158
  // If data row is not an object, just convert its value to a string.
188
159
  }
189
160
  else {
@@ -230,6 +201,7 @@ var DropdownBase = function (props) {
230
201
  // A key was pressed while the selector had focus.
231
202
  //
232
203
  var handleKeyDown = function (e) {
204
+ var _a;
233
205
  if (props.disabled || props.ghost)
234
206
  return;
235
207
  var key = e.key;
@@ -257,7 +229,7 @@ var DropdownBase = function (props) {
257
229
  }
258
230
  // The keys after this check won't have any effect if onSearch has
259
231
  // focus.
260
- if (!wrapperRef.current.contains(document.activeElement))
232
+ if (!((_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement)))
261
233
  return;
262
234
  if (key == ' ') {
263
235
  e.stopPropagation();
@@ -334,13 +306,13 @@ var DropdownBase = function (props) {
334
306
  };
335
307
  // Remove item from selection.
336
308
  var handleDelete = function (item) {
337
- // Find item in value array:
338
- var array = value;
309
+ // Copy the value array before mutating it (never splice state in place).
310
+ var array = __spreadArray([], value, true);
339
311
  var index = array.findIndex(function (x) { return match(x, item); });
340
312
  // Remove item from selection:
341
313
  array.splice(index, 1);
342
314
  // Set new selection:
343
- updateValueAndClose(__spreadArray([], array, true));
315
+ updateValueAndClose(array);
344
316
  };
345
317
  var handleClear = function () {
346
318
  if (props.multiple) {
@@ -350,16 +322,16 @@ var DropdownBase = function (props) {
350
322
  updateValueAndClose(null);
351
323
  }
352
324
  };
353
- // Search is debounced by 350ms:
354
- var doSearch = function (value) { return props.onSearch(value); };
355
- var doSearchBebounced = AwesomeDebouncePromise(doSearch, 350);
356
- var handleSearch = function (value) { return __awaiter(void 0, void 0, void 0, function () {
357
- return __generator(this, function (_a) {
358
- setSearch(value);
359
- doSearchBebounced(value);
360
- return [2 /*return*/];
361
- });
362
- }); };
325
+ // Search is debounced by 350ms. The debounced function is created once (via
326
+ // useMemo) so it actually coalesces keystrokes; a ref keeps it pointing at
327
+ // the latest onSearch. (Recreating it each render defeated debouncing.)
328
+ var onSearchRef = React.useRef(props.onSearch);
329
+ onSearchRef.current = props.onSearch;
330
+ var doSearchDebounced = React.useMemo(function () { return AwesomeDebouncePromise(function (value) { var _a; return (_a = onSearchRef.current) === null || _a === void 0 ? void 0 : _a.call(onSearchRef, value); }, 350); }, []);
331
+ var handleSearch = function (value) {
332
+ setSearch(value);
333
+ doSearchDebounced(value);
334
+ };
363
335
  // Determine body rows:
364
336
  var getBodyChildren = function () {
365
337
  var columns = React.Children.map(props.children, function (child) {
@@ -405,9 +377,10 @@ var DropdownBase = function (props) {
405
377
  }
406
378
  // If Dropdown is clicked, then click Selector.
407
379
  var handleClickDropdown = function () {
408
- wrapperRef.current.children[0].click();
380
+ if (wrapperRef.current)
381
+ wrapperRef.current.children[0].click();
409
382
  };
410
- var _d = usePopper(wrapperRef.current, bodyRef.current, {
383
+ var _e = usePopper(wrapperRef.current, bodyRef.current, {
411
384
  placement: props.direction == 'down' ? 'bottom' : 'top',
412
385
  modifiers: [
413
386
  {
@@ -418,10 +391,10 @@ var DropdownBase = function (props) {
418
391
  },
419
392
  sameWidth
420
393
  ]
421
- }), styles = _d.styles, attributes = _d.attributes, update = _d.update;
422
- return (React.createElement("div", { "data-testid": props['data-testid'] || "Dropdown", className: props.className, tabIndex: props.disabled ? -1 : 0, ref: wrapperRef, onKeyDown: handleKeyDown, onClick: handleClickDropdown },
423
- React.createElement(Selection, { open: open, error: props.error, disabled: props.disabled, transparent: props.transparent, ghost: props.ghost, multiple: props.multiple, onClick: handleSelectorClicked, onClear: (props.clearable && !showPlaceholder) ? handleClear : null, placeholder: showPlaceholder }, label),
424
- createPortal(React.createElement(Body, { ref: bodyRef, open: open, transparent: props.transparent, maxItems: props.maxItems, onSearch: props.onSearch ? handleSearch : null, search: search, tall: props.tall, minBodyWidth: props.minBodyWidth, styles: styles, attributes: attributes }, getBodyChildren()), document.body)));
394
+ }), styles = _e.styles, attributes = _e.attributes, update = _e.update;
395
+ return (React.createElement("div", { "data-testid": props['data-testid'] || "Dropdown", className: props.className, style: props.style, tabIndex: props.disabled ? -1 : 0, ref: wrapperRef, onKeyDown: handleKeyDown, onClick: handleClickDropdown },
396
+ React.createElement(Selection, { open: open, error: props.error, disabled: props.disabled, transparent: props.transparent, ghost: props.ghost, multiple: props.multiple, onClick: handleSelectorClicked, onClear: (props.clearable && !showPlaceholder) ? handleClear : undefined, placeholder: showPlaceholder }, label),
397
+ createPortal(React.createElement(Body, { ref: bodyRef, open: open, transparent: props.transparent, maxItems: (_a = props.maxItems) !== null && _a !== void 0 ? _a : DEFAULT_MAX_ITEMS, onSearch: props.onSearch ? handleSearch : undefined, search: search, tall: props.tall, minBodyWidth: props.minBodyWidth, styles: styles, attributes: attributes }, getBodyChildren()), document.body)));
425
398
  };
426
399
  var DropdownStyled = styled(DropdownBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n // Dropdown has a minimum width. \n width: 250px;\n // A fluid Dropdown occupies all available horizontal width. \n ", " \n outline: none;\n user-select: none;\n font: ", ";\n color: ", ";\n"], ["\n position: relative;\n // Dropdown has a minimum width. \n width: 250px;\n // A fluid Dropdown occupies all available horizontal width. \n ", " \n outline: none;\n user-select: none;\n font: ", ";\n color: ", ";\n"
427
400
  /**
@@ -460,7 +433,7 @@ var DropdownStyled = styled(DropdownBase)(templateObject_2 || (templateObject_2
460
433
  * ```
461
434
  */
462
435
  var Dropdown = function (_a) {
463
- var _b = _a.direction, direction = _b === void 0 ? 'down' : _b, _c = _a.fluid, fluid = _c === void 0 ? false : _c, _d = _a.clearable, clearable = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.transparent, transparent = _f === void 0 ? false : _f, _g = _a.error, error = _g === void 0 ? false : _g, _h = _a.multiple, multiple = _h === void 0 ? false : _h, _j = _a.resetOnOpen, resetOnOpen = _j === void 0 ? false : _j, _k = _a.gap, gap = _k === void 0 ? 16 : _k, _l = _a.maxItems, maxItems = _l === void 0 ? 6 : _l, _m = _a.tall, tall = _m === void 0 ? false : _m, _o = _a.label, label = _o === void 0 ? function (item) { return item; } : _o, _p = _a.match, match = _p === void 0 ? 'json' : _p, props = __rest(_a, ["direction", "fluid", "clearable", "disabled", "transparent", "error", "multiple", "resetOnOpen", "gap", "maxItems", "tall", "label", "match"]);
436
+ var _b = _a.direction, direction = _b === void 0 ? 'down' : _b, _c = _a.fluid, fluid = _c === void 0 ? false : _c, _d = _a.clearable, clearable = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.transparent, transparent = _f === void 0 ? false : _f, _g = _a.error, error = _g === void 0 ? false : _g, _h = _a.multiple, multiple = _h === void 0 ? false : _h, _j = _a.resetOnOpen, resetOnOpen = _j === void 0 ? false : _j, _k = _a.gap, gap = _k === void 0 ? 16 : _k, _l = _a.maxItems, maxItems = _l === void 0 ? DEFAULT_MAX_ITEMS : _l, _m = _a.tall, tall = _m === void 0 ? false : _m, _o = _a.label, label = _o === void 0 ? function (item) { return item; } : _o, _p = _a.match, match = _p === void 0 ? 'json' : _p, props = __rest(_a, ["direction", "fluid", "clearable", "disabled", "transparent", "error", "multiple", "resetOnOpen", "gap", "maxItems", "tall", "label", "match"]);
464
437
  return (React.createElement(DropdownStyled, __assign({ direction: direction, fluid: fluid, clearable: clearable, disabled: disabled, transparent: transparent, error: error, multiple: multiple, resetOnOpen: resetOnOpen, gap: gap, maxItems: maxItems, tall: tall, label: label, match: match }, props)));
465
438
  };
466
439
  Dropdown.displayName = 'Dropdown';
@@ -18,6 +18,6 @@ var PillBase = function (props) {
18
18
  React.createElement("use", { xlinkHref: SVG.Icons.Cross }))));
19
19
  };
20
20
  var Text = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n overflow: hidden;\n text-overflow: ellipsis; \n"], ["\n overflow: hidden;\n text-overflow: ellipsis; \n"])));
21
- var Pill = styled(PillBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // Position:\n position: relative;\n margin-right: 4px;\n flex: flex-shrink;\n min-width: 60px;\n overflow: hidden;\n \n // Layout:\n display: inline-flex;\n height: 20px;\n gap: 2px;\n align-items: center;\n box-sizing: border-box;\n padding: 0 3px 0 8px;\n\n // Appearance:\n border-radius: ", "px;\n background-color: ", ";\n color: ", ";\n white-space: nowrap;\n user-select: none;\n\n &>svg {\n width: 14px;\n height: 14px; \n min-width: 14px;\n fill: ", ";\n transition: \n fill ", "ms ease,\n background-color ", "ms ease;\n border-radius: 50%;\n }\n\n transition: background-color ", "ms ease;\n &:hover {\n background-color: ", ";\n outline-offset: -1px;\n &>svg {\n fill: #fff;\n background-color: ", ";\n }\n }\n"], ["\n // Position:\n position: relative;\n margin-right: 4px;\n flex: flex-shrink;\n min-width: 60px;\n overflow: hidden;\n \n // Layout:\n display: inline-flex;\n height: 20px;\n gap: 2px;\n align-items: center;\n box-sizing: border-box;\n padding: 0 3px 0 8px;\n\n // Appearance:\n border-radius: ", "px;\n background-color: ", ";\n color: ", ";\n white-space: nowrap;\n user-select: none;\n\n &>svg {\n width: 14px;\n height: 14px; \n min-width: 14px;\n fill: ", ";\n transition: \n fill ", "ms ease,\n background-color ", "ms ease;\n border-radius: 50%;\n }\n\n transition: background-color ", "ms ease;\n &:hover {\n background-color: ", ";\n outline-offset: -1px;\n &>svg {\n fill: #fff;\n background-color: ", ";\n }\n }\n"])), function (p) { return p.theme.radius.normal; }, function (p) { return p.theme.colors.primary[2]; }, function (p) { return p.theme.colors.font; }, function (p) { return p.theme.colors.font; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.colors.negative; }, function (p) { return p.theme.colors.neutral[10]; });
21
+ var Pill = styled(PillBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // Position:\n position: relative;\n margin-right: 4px;\n min-width: 60px;\n overflow: hidden;\n \n // Layout:\n display: inline-flex;\n height: 20px;\n gap: 2px;\n align-items: center;\n box-sizing: border-box;\n padding: 0 3px 0 8px;\n\n // Appearance:\n border-radius: ", "px;\n background-color: ", ";\n color: ", ";\n white-space: nowrap;\n user-select: none;\n\n &>svg {\n width: 14px;\n height: 14px; \n min-width: 14px;\n fill: ", ";\n transition: \n fill ", "ms ease,\n background-color ", "ms ease;\n border-radius: 50%;\n }\n\n transition: background-color ", "ms ease;\n &:hover {\n background-color: ", ";\n outline-offset: -1px;\n &>svg {\n fill: ", ";\n background-color: ", ";\n }\n }\n"], ["\n // Position:\n position: relative;\n margin-right: 4px;\n min-width: 60px;\n overflow: hidden;\n \n // Layout:\n display: inline-flex;\n height: 20px;\n gap: 2px;\n align-items: center;\n box-sizing: border-box;\n padding: 0 3px 0 8px;\n\n // Appearance:\n border-radius: ", "px;\n background-color: ", ";\n color: ", ";\n white-space: nowrap;\n user-select: none;\n\n &>svg {\n width: 14px;\n height: 14px; \n min-width: 14px;\n fill: ", ";\n transition: \n fill ", "ms ease,\n background-color ", "ms ease;\n border-radius: 50%;\n }\n\n transition: background-color ", "ms ease;\n &:hover {\n background-color: ", ";\n outline-offset: -1px;\n &>svg {\n fill: ", ";\n background-color: ", ";\n }\n }\n"])), function (p) { return p.theme.radius.normal; }, function (p) { return p.theme.colors.primary[2]; }, function (p) { return p.theme.colors.font; }, function (p) { return p.theme.colors.font; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.colors.negative; }, function (p) { return p.theme.colors.font; }, function (p) { return p.theme.colors.neutral[10]; });
22
22
  export { Pill };
23
23
  var templateObject_1, templateObject_2;
@@ -8,7 +8,7 @@ import styled, { css } from 'styled-components';
8
8
  import { SVG } from '../../svg';
9
9
  import { InputWrapper } from '../Input/InputWrapper';
10
10
  var Selection = function (props) {
11
- return (React.createElement(InputWrapper, { fluid: true, ghost: props.ghost, error: props.error, disabled: props.disabled, transparent: props.transparent, onClick: props.onClick, onClear: props.onClear, icon: props.onClear ? null : SVG.Icons.Caret, iconPosition: 'right' },
11
+ return (React.createElement(InputWrapper, { fluid: true, ghost: props.ghost, error: props.error, disabled: props.disabled, transparent: props.transparent, onClick: props.onClick, onClear: props.onClear, icon: props.onClear ? undefined : SVG.Icons.Caret, iconPosition: 'right' },
12
12
  React.createElement(Inner, { tabIndex: -1, "$multiple": props.multiple, "$placeholder": props.placeholder }, props.children)));
13
13
  };
14
14
  var Inner = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 100%;\n outline: none;\n overflow-x: hidden;\n overflow-y: hidden;\n white-space: nowrap;\n ", " \n // Multiple selections use a flexbox for individual overflows: \n ", "\n // Add ellipsis to selection text:\n ", " \n"], ["\n width: 100%;\n outline: none;\n overflow-x: hidden;\n overflow-y: hidden;\n white-space: nowrap;\n ", " \n // Multiple selections use a flexbox for individual overflows: \n ", "\n // Add ellipsis to selection text:\n ", " \n"])), function (p) { return p.$placeholder && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: rgb(from ", " r g b / 50%);\n "], ["\n color: rgb(from ", " r g b / 50%);\n "])), function (p) { return p.theme.colors.primary[3]; }); }, function (p) { return p.$multiple && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n "], ["\n display: flex;\n "]))); }, function (p) { return !p.$multiple && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["text-overflow: ellipsis;"], ["text-overflow: ellipsis;"]))); });
@@ -68,6 +68,11 @@ interface IEditorProps extends ITestable {
68
68
  * Listeners are notified whenever the user interacts with the Editor.
69
69
  */
70
70
  onChange?: (value: any) => void;
71
+ /**
72
+ * Optional inline styles applied to the outer element, for one-off overrides
73
+ * of the default styling.
74
+ */
75
+ style?: React.CSSProperties;
71
76
  }
72
77
  declare const Editor: {
73
78
  ({ fluid, error, disabled, transparent, ghost, allowFullscreen, codeButtons, ...props }: IEditorProps): React.JSX.Element;
@@ -97,19 +97,27 @@ var EditorBase = function (props) {
97
97
  return function () { return document.removeEventListener('fullscreenchange', handleFullscreenChange); };
98
98
  }, []);
99
99
  var handleToggleFullscreen = function () {
100
+ var _a;
100
101
  if (document.fullscreenElement) {
101
102
  document.exitFullscreen();
102
103
  }
103
104
  else {
104
- wrapperRef.current.requestFullscreen();
105
+ (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.requestFullscreen();
105
106
  }
106
107
  };
107
108
  var editor = useEditor({
108
109
  extensions: extensions,
109
110
  content: sanitizeEditorHTML(props.value),
110
111
  injectCSS: false,
112
+ editable: !props.disabled && !props.ghost,
111
113
  onUpdate: handleUpdate
112
114
  });
115
+ // Keep TipTap's editable state in sync: CSS pointer-events only blocks the
116
+ // mouse, so without this a disabled/ghosted editor could still be edited via
117
+ // the keyboard.
118
+ React.useEffect(function () {
119
+ editor === null || editor === void 0 ? void 0 : editor.setEditable(!props.disabled && !props.ghost);
120
+ }, [props.disabled, props.ghost, editor]);
113
121
  React.useEffect(function () {
114
122
  // If props.value is exactly what the editor just emitted, this is a
115
123
  // round-trip from our own onChange — skip sanitizing and re-setting
@@ -118,7 +126,7 @@ var EditorBase = function (props) {
118
126
  if (props.value === lastEmittedRef.current)
119
127
  return;
120
128
  var safeValue = sanitizeEditorHTML(props.value);
121
- if (editor.getHTML() !== safeValue) {
129
+ if (editor && editor.getHTML() !== safeValue) {
122
130
  editor.commands.setContent(safeValue, true, { preserveWhitespace: "full" });
123
131
  }
124
132
  }, [props.value]);
@@ -128,16 +136,18 @@ var EditorBase = function (props) {
128
136
  if (r == null || r == contentEditableRef.current)
129
137
  return;
130
138
  contentEditableRef.current = r.querySelector('.tiptap');
131
- EditorRegistry.addEditor(contentEditableRef.current, editor);
139
+ if (contentEditableRef.current && editor)
140
+ EditorRegistry.addEditor(contentEditableRef.current, editor);
132
141
  };
133
142
  // Upon unmount, an editor is removed from the EditorRegistry.
134
143
  React.useEffect(function () { return function () {
135
- EditorRegistry.removeEditor(contentEditableRef.current);
144
+ if (contentEditableRef.current)
145
+ EditorRegistry.removeEditor(contentEditableRef.current);
136
146
  }; }, []);
137
147
  return (React.createElement(InputWrapper, { fluid: props.fluid, ghost: props.ghost, error: props.error, disabled: props.disabled, transparent: props.transparent, flex: props.flex },
138
- React.createElement("div", { "data-testid": props['data-testid'] || "Editor", className: props.className, ref: wrapperRef },
148
+ React.createElement("div", { "data-testid": props['data-testid'] || "Editor", className: props.className, style: props.style, ref: wrapperRef },
139
149
  React.createElement(OverlayScrollbarsComponent, { className: "scroller ".concat(fullscreen ? 'fullscreen' : ''), defer: true, options: { scrollbars: { theme: 'os-theme-dark', autoHide: 'leave' } } },
140
- !props.disabled && !props.ghost &&
150
+ !props.disabled && !props.ghost && editor &&
141
151
  React.createElement(MenuBar, { allowFullscreen: props.allowFullscreen, codeButtons: props.codeButtons, fullscreen: fullscreen, editor: editor, onToggleFullscreen: handleToggleFullscreen, textAIurl: props.textAIurl, speechAIurl: props.speechAIurl, authToken: props.authToken }),
142
152
  React.createElement(EditorContent, { editor: editor, ref: setRef })))));
143
153
  };
@@ -6,6 +6,8 @@ var SpeechAIButton = function (props) {
6
6
  var fromRef = useRef(null);
7
7
  var transcriptRef = useRef("");
8
8
  var onTranscript = function (text) {
9
+ if (fromRef.current == null)
10
+ return;
9
11
  var _a = props.editor, state = _a.state, view = _a.view;
10
12
  var transaction = state.tr
11
13
  .insertText(text, fromRef.current, fromRef.current + transcriptRef.current.length);
@@ -11,18 +11,5 @@ interface IProps {
11
11
  */
12
12
  authToken?: string;
13
13
  }
14
- /**
15
- * `TextAIButton` provides a menu button that allows the user to run various
16
- * AI-powered text transformations on selected editor content.
17
- *
18
- * Available transformations include:
19
- * - Summarizing selected content
20
- * - Extracting key points
21
- * - Translating
22
- *
23
- * When triggered, the selected content is cut, sent to the configured Text AI
24
- * back-end, and replaced with the transformed version. Streaming support
25
- * allows real-time insertion with animated progress.
26
- */
27
14
  declare const TextAIButton: (props: IProps) => React.JSX.Element;
28
15
  export { TextAIButton };
@@ -34,7 +34,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
34
34
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
35
  }
36
36
  };
37
- import React, { useState } from 'react';
37
+ import React, { useState, useEffect } from 'react';
38
38
  import { marked } from 'marked';
39
39
  import { DOMParser as ProseMirrorDOMParser } from 'prosemirror-model';
40
40
  import { useTextAIStream } from '../../../hooks/useTextAIStream';
@@ -52,12 +52,15 @@ import { TextAIMenu } from './TextAIMenu';
52
52
  * back-end, and replaced with the transformed version. Streaming support
53
53
  * allows real-time insertion with animated progress.
54
54
  */
55
+ // The DOM parser is stateless, so a single shared instance is reused across
56
+ // renders and stream chunks.
57
+ var domParser = new DOMParser();
55
58
  var TextAIButton = function (props) {
56
- var streamTextAI = useTextAIStream(props.url, props.authToken).stream;
57
- var _a = useState(false), streaming = _a[0], setStreaming = _a[1];
58
- // The DOM parser is only created once, then used many times as content
59
- // is streamed in.
60
- var domParser = new DOMParser();
59
+ var _a = useTextAIStream(props.url, props.authToken), streamTextAI = _a.stream, cancel = _a.cancel;
60
+ var _b = useState(false), streaming = _b[0], setStreaming = _b[1];
61
+ // Abort any in-flight stream when the button unmounts, so onText doesn't run
62
+ // against a torn-down editor.
63
+ useEffect(function () { return cancel; }, [cancel]);
61
64
  /**
62
65
  * Copy the selected content, then remove it. The selection may be empty.
63
66
  * @returns {string} The plain text that was selected and removed.
@@ -138,11 +141,13 @@ var TextAIButton = function (props) {
138
141
  // Remove the node from the document.
139
142
  var _a = props.editor, state = _a.state, view = _a.view;
140
143
  var node = state.doc.nodeAt(nodePos);
144
+ if (node == null)
145
+ return;
141
146
  var tr = state.tr.delete(nodePos, nodePos + node.nodeSize);
142
147
  view.dispatch(tr);
143
148
  };
144
149
  var stream = function (prompt) { return __awaiter(void 0, void 0, void 0, function () {
145
- var id, text;
150
+ var id, text_1, e_1;
146
151
  return __generator(this, function (_a) {
147
152
  switch (_a.label) {
148
153
  case 0:
@@ -152,29 +157,40 @@ var TextAIButton = function (props) {
152
157
  case 1:
153
158
  // Create initial node.
154
159
  _a.sent();
155
- text = "";
160
+ _a.label = 2;
161
+ case 2:
162
+ _a.trys.push([2, 5, , 6]);
163
+ text_1 = "";
156
164
  return [4 /*yield*/, streamTextAI(prompt, function (chunk) { return __awaiter(void 0, void 0, void 0, function () {
157
165
  return __generator(this, function (_a) {
158
166
  switch (_a.label) {
159
167
  case 0:
160
- text += chunk;
168
+ text_1 += chunk;
161
169
  removeNode(id);
162
- return [4 /*yield*/, addNode(id, text, true)];
170
+ return [4 /*yield*/, addNode(id, text_1, true)];
163
171
  case 1:
164
172
  _a.sent();
165
173
  return [2 /*return*/];
166
174
  }
167
175
  });
168
176
  }); })];
169
- case 2:
177
+ case 3:
170
178
  _a.sent();
171
179
  // Replace the node one more time, this time without a blinking <mark>
172
180
  // cursor.
173
181
  removeNode(id);
174
- return [4 /*yield*/, addNode(id, text, false)];
175
- case 3:
182
+ return [4 /*yield*/, addNode(id, text_1, false)];
183
+ case 4:
176
184
  _a.sent();
177
- return [2 /*return*/];
185
+ return [3 /*break*/, 6];
186
+ case 5:
187
+ e_1 = _a.sent();
188
+ // On failure, remove the dangling stream node rather than leaving the
189
+ // placeholder in the document.
190
+ removeNode(id);
191
+ console.warn('Text AI stream failed:', e_1);
192
+ return [3 /*break*/, 6];
193
+ case 6: return [2 /*return*/];
178
194
  }
179
195
  });
180
196
  }); };
@@ -23,7 +23,7 @@ var TextAIMenu = function (props) {
23
23
  React.createElement("div", { style: { minWidth: '150px' } },
24
24
  React.createElement(List, { maxItems: 4, contract: true },
25
25
  React.createElement(ListRow, { disabled: selectionIsEmpty, onClick: function () { return handleClick(function (text) {
26
- return "Produce a list of the key points in the following text, returning only the result: \n\n".concat(text);
26
+ return "Summarize the following text, returning only the result: \n\n".concat(text);
27
27
  }); } }, "Summarize"),
28
28
  React.createElement(ListRow, { disabled: selectionIsEmpty, onClick: function () { return handleClick(function (text) {
29
29
  return "Produce a list of the key points in the following text, returning only the result: \n\n".concat(text);
@@ -32,5 +32,5 @@ interface IProps {
32
32
  /** Fired when fullscreen mode must be toggled. */
33
33
  onToggleFullscreen: () => void;
34
34
  }
35
- declare const MenuBar: 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>>;
35
+ declare const MenuBar: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<IProps, never>> & string & Omit<(props: IProps) => React.JSX.Element | null, keyof React.Component<any, {}, any>>;
36
36
  export { MenuBar };
@@ -31,7 +31,7 @@ var MenuBarBase = function (props) {
31
31
  React.createElement(MenuSeparator, null),
32
32
  React.createElement(CodeButton, { editor: props.editor }),
33
33
  React.createElement(CodeBlockButton, { editor: props.editor })),
34
- (props.textAIurl || props.allowFullscreen) && React.createElement(MenuSeparator, null),
34
+ (props.textAIurl || props.speechAIurl || props.allowFullscreen) && React.createElement(MenuSeparator, null),
35
35
  props.textAIurl &&
36
36
  React.createElement(TextAIButton, { url: props.textAIurl, editor: props.editor, authToken: props.authToken }),
37
37
  props.speechAIurl &&
@@ -46,7 +46,7 @@ var MenuButtonBase = function (props) {
46
46
  }
47
47
  ]
48
48
  }), styles = _a.styles, attributes = _a.attributes, update = _a.update;
49
- return (React.createElement("button", { className: props.className, disabled: props.disabled, onClick: props.onClick, ref: buttonRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
49
+ return (React.createElement("button", { className: props.className, disabled: props.disabled, onClick: props.onClick, ref: buttonRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, "aria-label": typeof props.hint === 'string' ? props.hint : undefined },
50
50
  React.createElement(Icon, __assign({}, (typeof props.icon === 'string' ? { url: props.icon } : props.icon))),
51
51
  buttonRef.current && createPortal(React.createElement(MenuButtonHint, { keys: props.keys, ref: hintRef, styles: styles, attributes: attributes }, props.hint), buttonRef.current)));
52
52
  };
@@ -6,7 +6,7 @@ var Clear = function (props) {
6
6
  var theme = useTheme();
7
7
  var handleClick = function (e) {
8
8
  // Stop propagation, or color/date controls will open on click.
9
- e.stopPropagation();
9
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
10
10
  props.onClick();
11
11
  };
12
12
  return (React.createElement(Icon, { size: 17, url: SVG.Icons.Cross, circle: true, color: theme.colors.primary[3], onClick: handleClick }));
@@ -129,6 +129,11 @@ interface IInputProps extends ITestable {
129
129
  * Listeners are notified when the Input receives focus.
130
130
  */
131
131
  onFocus?: () => void;
132
+ /**
133
+ * Optional inline styles applied to the outer element, for one-off overrides
134
+ * of the default styling.
135
+ */
136
+ style?: React.CSSProperties;
132
137
  }
133
138
  declare const Input: {
134
139
  (props: IInputProps): React.JSX.Element;
@@ -35,8 +35,9 @@ var InputBase = function (props) {
35
35
  };
36
36
  // When input is cleared, its value is set to NULL.
37
37
  var handleClear = function () {
38
+ var _a;
38
39
  setValue("");
39
- inputRef.current.focus();
40
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
40
41
  if (props.onChange) {
41
42
  props.onChange(null);
42
43
  }
@@ -57,8 +58,9 @@ var InputBase = function (props) {
57
58
  }, []);
58
59
  // Handle hotkey check.
59
60
  var handleKeyDown = function (e) {
61
+ var _a, _b;
60
62
  // If not the hotkey, then abort.
61
- if (e.key.toLowerCase() != props.hotKey.toLowerCase())
63
+ if (!props.hotKey || e.key.toLowerCase() != props.hotKey.toLowerCase())
62
64
  return;
63
65
  // Check modifier keys:
64
66
  if (props.hotKeyCtrl && !e.ctrlKey)
@@ -68,13 +70,13 @@ var InputBase = function (props) {
68
70
  if (props.hotKeyShift && !e.shiftKey)
69
71
  return;
70
72
  // It's our key. Focus the input.
71
- inputRef.current.focus();
72
- inputRef.current.select();
73
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
74
+ (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.select();
73
75
  };
74
- return (React.createElement(InputWrapper, { fluid: props.fluid, ghost: props.ghost, error: props.error, disabled: props.disabled, transparent: props.transparent, icon: props.icon, iconPosition: props.iconPosition, onClear: (props.clearable && props.value) ? handleClear : null, onToggleReveal: props.revealable ? handleToggleReveal : null, revealed: revealed, unit: props.unit },
76
+ return (React.createElement(InputWrapper, { fluid: props.fluid, ghost: props.ghost, error: props.error, disabled: props.disabled, transparent: props.transparent, icon: props.icon, iconPosition: props.iconPosition, onClear: (props.clearable && props.value) ? handleClear : undefined, onToggleReveal: props.revealable ? handleToggleReveal : undefined, revealed: revealed, unit: props.unit, style: props.style },
75
77
  React.createElement("input", { "data-testid": props['data-testid'] || "Input", className: props.className, ref: inputRef, tabIndex: props.noTabIndex ? -1 : 0, value: value, placeholder: props.placeholder, disabled: props.disabled, type: props.type == 'password' ? (revealed ? 'text' : 'password') : props.type, maxLength: props.maxLength, autoComplete: props.autocomplete, onChange: handleChange, onFocus: props.onFocus })));
76
78
  };
77
- var InputStyled = styled(InputBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // Dimensions:\n width: 100%;\n box-sizing: border-box;\n z-index: 0;\n border: none;\n\n outline: solid 3px rebeccapurple;\n background: transparent;\n padding: 0;\n margin: 0;\n outline: none;\n\n // Font\n font: ", ";\n text-align: left;\n color: ", ";\n\n // Define colors for placeholder text.\n &::placeholder {\n color: rgb(from ", " r g b / 50%);\n opacity: 1 !important; /* Firefox applies opacity */\n }\n\n // Focus:\n &:focus {\n &::placeholder {\n color: rgb(from ", " r g b / 30%);\n }\n }\n\n ", "\n\n // Make sure HTML5 validation does not show up.\n &:valid {\n box-shadow: none;\n }\n &:invalid {\n box-shadow: none;\n }\n\n // Turn off number spinners.\n &[type=number]::-webkit-inner-spin-button, \n &[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none; /* Webkit (Chrome) */\n margin: 0; \n } \n &[type=number] {\n appearance:textfield;\n -moz-appearance:textfield; /* Firefox */\n } \n"], ["\n // Dimensions:\n width: 100%;\n box-sizing: border-box;\n z-index: 0;\n border: none;\n\n outline: solid 3px rebeccapurple;\n background: transparent;\n padding: 0;\n margin: 0;\n outline: none;\n\n // Font\n font: ", ";\n text-align: left;\n color: ", ";\n\n // Define colors for placeholder text.\n &::placeholder {\n color: rgb(from ", " r g b / 50%);\n opacity: 1 !important; /* Firefox applies opacity */\n }\n\n // Focus:\n &:focus {\n &::placeholder {\n color: rgb(from ", " r g b / 30%);\n }\n }\n\n ", "\n\n // Make sure HTML5 validation does not show up.\n &:valid {\n box-shadow: none;\n }\n &:invalid {\n box-shadow: none;\n }\n\n // Turn off number spinners.\n &[type=number]::-webkit-inner-spin-button, \n &[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none; /* Webkit (Chrome) */\n margin: 0; \n } \n &[type=number] {\n appearance:textfield;\n -moz-appearance:textfield; /* Firefox */\n } \n"])), function (p) { return p.theme.font.bodyMedium; }, function (p) { return p.theme.colors.primary[3]; }, function (p) { return p.theme.colors.primary[3]; }, function (p) { return p.theme.colors.primary[3]; }, function (p) { return p.disabled && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), p.theme.colors.neutral[50]); });
79
+ var InputStyled = styled(InputBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // Dimensions:\n width: 100%;\n box-sizing: border-box;\n z-index: 0;\n border: none;\n\n background: transparent;\n padding: 0;\n margin: 0;\n outline: none;\n\n // Font\n font: ", ";\n text-align: left;\n color: ", ";\n\n // Define colors for placeholder text.\n &::placeholder {\n color: rgb(from ", " r g b / 50%);\n opacity: 1 !important; /* Firefox applies opacity */\n }\n\n // Focus:\n &:focus {\n &::placeholder {\n color: rgb(from ", " r g b / 30%);\n }\n }\n\n ", "\n\n // Make sure HTML5 validation does not show up.\n &:valid {\n box-shadow: none;\n }\n &:invalid {\n box-shadow: none;\n }\n\n // Turn off number spinners.\n &[type=number]::-webkit-inner-spin-button, \n &[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none; /* Webkit (Chrome) */\n margin: 0; \n } \n &[type=number] {\n appearance:textfield;\n -moz-appearance:textfield; /* Firefox */\n } \n"], ["\n // Dimensions:\n width: 100%;\n box-sizing: border-box;\n z-index: 0;\n border: none;\n\n background: transparent;\n padding: 0;\n margin: 0;\n outline: none;\n\n // Font\n font: ", ";\n text-align: left;\n color: ", ";\n\n // Define colors for placeholder text.\n &::placeholder {\n color: rgb(from ", " r g b / 50%);\n opacity: 1 !important; /* Firefox applies opacity */\n }\n\n // Focus:\n &:focus {\n &::placeholder {\n color: rgb(from ", " r g b / 30%);\n }\n }\n\n ", "\n\n // Make sure HTML5 validation does not show up.\n &:valid {\n box-shadow: none;\n }\n &:invalid {\n box-shadow: none;\n }\n\n // Turn off number spinners.\n &[type=number]::-webkit-inner-spin-button, \n &[type=number]::-webkit-outer-spin-button { \n -webkit-appearance: none; /* Webkit (Chrome) */\n margin: 0; \n } \n &[type=number] {\n appearance:textfield;\n -moz-appearance:textfield; /* Firefox */\n } \n"])), function (p) { return p.theme.font.bodyMedium; }, function (p) { return p.theme.colors.primary[3]; }, function (p) { return p.theme.colors.primary[3]; }, function (p) { return p.theme.colors.primary[3]; }, function (p) { return p.disabled && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), p.theme.colors.neutral[50]); });
78
80
  var Input = function (props) { return React.createElement(InputStyled, __assign({}, props)); };
79
81
  Input.displayName = 'Input';
80
82
  export { Input };
@@ -18,6 +18,8 @@ interface IProps extends ITestable {
18
18
  */
19
19
  iconPosition?: 'left' | 'right';
20
20
  unit?: React.ReactNode;
21
+ /** Optional inline styles applied to the wrapper's outer element. */
22
+ style?: React.CSSProperties;
21
23
  onClear?: () => void;
22
24
  onClick?: () => void;
23
25
  revealed?: boolean;
@@ -42,7 +42,7 @@ var InputWrapperBase = function (props) {
42
42
  else if (props.icon != null) {
43
43
  icon = (React.createElement(Icon, __assign({ size: 17, color: (_a = props.icon.color) !== null && _a !== void 0 ? _a : theme.colors.primary[3] }, props.icon)));
44
44
  }
45
- return (React.createElement("div", { "data-testid": props['data-testid'] || "InputWrapper", className: props.className, onClick: props.onClick },
45
+ return (React.createElement("div", { "data-testid": props['data-testid'] || "InputWrapper", className: props.className, style: props.style, onClick: props.onClick },
46
46
  props.ghost && React.createElement(Ghost, { style: { position: 'absolute', left: 0, top: 0, right: 0, bottom: 0, zIndex: 100 } }),
47
47
  icon && !props.ghost && props.iconPosition == 'left' && icon,
48
48
  React.createElement(Content, null, props.children),
@@ -6,7 +6,7 @@ var Reveal = function (props) {
6
6
  var theme = useTheme();
7
7
  var handleClick = function (e) {
8
8
  // Stop propagation, or color/date controls will open on click.
9
- e.stopPropagation();
9
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
10
10
  props.onClick();
11
11
  };
12
12
  return (React.createElement(Icon, { size: 17, url: props.revealed ? SVG.Icons.EyeClosed : SVG.Icons.Eye, color: theme.colors.primary[3], onClick: handleClick }));
@@ -23,6 +23,6 @@ interface IProps {
23
23
  attributes: any;
24
24
  }
25
25
  declare const Body: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<IProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
26
- ref?: React.Ref<HTMLDivElement>;
26
+ 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;
27
27
  }, never>> & string & Omit<React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLDivElement>>, keyof React.Component<any, {}, any>>;
28
28
  export { Body };
@@ -5,9 +5,9 @@ interface IProps {
5
5
  /** Calendar year */
6
6
  year: number;
7
7
  /** Selected start date */
8
- start: Date;
8
+ start: Date | null;
9
9
  /** Selected end date */
10
- end: Date;
10
+ end: Date | null;
11
11
  /** Fired when calendar changes year */
12
12
  onChangeYear: (year: number) => void;
13
13
  /** Fired when month is clicked. */