@splunk/react-ui 5.3.0 → 5.4.0

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 (60) hide show
  1. package/Accordion.js +31 -31
  2. package/Avatar.js +13 -13
  3. package/Breadcrumbs.js +66 -63
  4. package/ButtonSimple.js +52 -52
  5. package/CHANGELOG.md +16 -0
  6. package/CardLayout.js +39 -36
  7. package/Clickable.js +5 -6
  8. package/Code.js +424 -528
  9. package/CollapsiblePanel.js +1 -1
  10. package/Color.js +903 -1025
  11. package/DefinitionList.js +1 -1
  12. package/FormRows.js +13 -11
  13. package/JSONTree.js +682 -1408
  14. package/Link.js +5 -5
  15. package/Markdown.js +9 -5
  16. package/Menu.js +72 -67
  17. package/Multiselect.js +2692 -2780
  18. package/Popover.js +201 -196
  19. package/Resize.js +11 -8
  20. package/ResultsMenu.js +913 -1030
  21. package/ScreenReaderContent.js +86 -130
  22. package/Scroll.js +366 -425
  23. package/Select.js +1741 -1832
  24. package/Slider.js +1 -1
  25. package/SlidingPanels.js +129 -127
  26. package/StepBar.js +123 -97
  27. package/Switch.js +115 -111
  28. package/TabBar.js +10 -10
  29. package/Table.js +1239 -1240
  30. package/TextArea.js +596 -684
  31. package/Tree.js +638 -682
  32. package/package.json +11 -11
  33. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  34. package/types/src/Breadcrumbs/BreadcrumbsContext.d.ts +7 -0
  35. package/types/src/Breadcrumbs/Item.d.ts +1 -1
  36. package/types/src/ButtonSimple/mixin.d.ts +1 -1
  37. package/types/src/JSONTree/JSONTreeItem.d.ts +1 -1
  38. package/types/src/JSONTree/renderTreeItems.d.ts +1 -1
  39. package/types/src/Modal/ModalContext.d.ts +1 -1
  40. package/types/src/Multiselect/Compact.d.ts +2 -2
  41. package/types/src/Multiselect/Normal.d.ts +2 -2
  42. package/types/src/Number/utils.d.ts +1 -1
  43. package/types/src/Popover/getPlacement.d.ts +1 -1
  44. package/types/src/RadioList/Option.d.ts +1 -1
  45. package/types/src/RadioList/RadioListContext.d.ts +1 -1
  46. package/types/src/StepBar/StepBar.d.ts +4 -1
  47. package/types/src/StepBar/StepBarContext.d.ts +1 -0
  48. package/types/src/StepBar/docs/examples/Vertical.d.ts +6 -0
  49. package/types/src/Switch/Switch.d.ts +7 -1
  50. package/types/src/TabBar/Tab.d.ts +3 -1
  51. package/types/src/TabBar/docs/examples/Icons.d.ts +4 -0
  52. package/types/src/TabBar/docs/examples/Tooltips.d.ts +3 -0
  53. package/types/src/TabLayout/Panel.d.ts +2 -0
  54. package/types/src/Table/Head.d.ts +1 -1
  55. package/types/src/Table/Row.d.ts +1 -1
  56. package/types/src/Table/Table.d.ts +1 -0
  57. package/types/src/Tree/TreeContext.d.ts +1 -1
  58. package/useControlled.js +61 -97
  59. package/usePrevious.js +30 -62
  60. package/useResizeObserver.js +95 -127
package/JSONTree.js CHANGED
@@ -1,755 +1,34 @@
1
1
  /******/ (() => {
2
2
  // webpackBootstrap
3
3
  /******/ "use strict";
4
- /******/ var e = {
5
- /***/ 8655:
6
- /***/ (e, n, r) => {
7
- // EXPORTS
8
- r.d(n, {
9
- default: () => /* reexport */ ce
10
- });
11
- // UNUSED EXPORTS: Item
12
- // EXTERNAL MODULE: external "react"
13
- var t = r(9497);
14
- var o = r.n(t);
15
- // EXTERNAL MODULE: external "prop-types"
16
- var a = r(23);
17
- var i = r.n(a);
18
- // EXTERNAL MODULE: external "styled-components"
19
- var l = r(232);
20
- var u = r.n(l);
21
- // EXTERNAL MODULE: external "@splunk/themes"
22
- var c = r(3563);
23
- // CONCATENATED MODULE: ./src/Tree/ItemStyles.ts
24
- var f = u().span.withConfig({
25
- displayName: "ItemStyles__StyledTreeItemContentWrapper",
26
- componentId: "sc-1ig9nmy-0"
27
- })([ "display:inline-block;min-height:100%;" ]);
28
- var d = u().span.withConfig({
29
- displayName: "ItemStyles__StyledTreeItemIndent",
30
- componentId: "sc-1ig9nmy-1"
31
- })([ "white-space:pre;" ]);
32
- var s = u().span.withConfig({
33
- displayName: "ItemStyles__StyledTreeItemContent",
34
- componentId: "sc-1ig9nmy-2"
35
- })([ "display:", ";min-height:100%;&:focus{outline:3px solid ", ";outline-offset:1px;&:active{outline:none;}}&:hover{background-color:", ";cursor:pointer;}" ], (function(e) {
36
- var n = e.$hasCustomIndent;
37
- return n ? "inline" : "inline-block";
38
- }), c.variables.focusColor, c.variables.actionColorBackgroundSecondaryHover);
39
- // CONCATENATED MODULE: ./src/Tree/TreeContext.tsx
40
- var v = (0, t.createContext)({
41
- defaultIndent: true
42
- });
43
- /* harmony default export */ const p = v;
44
- // CONCATENATED MODULE: ./src/Tree/TreeStyles.ts
45
- var y = u().ul.withConfig({
46
- displayName: "TreeStyles__StyledUnorderedList",
47
- componentId: "sc-13pokwt-0"
48
- })([ "", ";list-style:none;white-space:inherit;", ";" ], c.mixins.reset("ul"), (function(e) {
49
- var n = e.$defaultIndent;
50
- return n && (0, l.css)([ "padding-inline-start:", ";" ], c.variables.spacingXXXLarge);
51
- }));
52
- // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
53
- /**
54
- * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
55
- *
56
- * @param ref - The React callback or object ref. Can be `null` or `undefined`.
57
- * @param current - The new value of the ref.
58
- */
59
- function m(e, n) {
60
- if (e) {
61
- if (typeof e === "function") {
62
- e(n);
63
- } else {
64
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
65
- // the intention here is to signal "we will take care of setting 'current', not you".
66
- e.current = n;
67
- // eslint-disable-line no-param-reassign
68
- }
69
- }
70
- }
71
- // CONCATENATED MODULE: ./src/Tree/Item.tsx
72
- function b(e) {
73
- "@babel/helpers - typeof";
74
- return b = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
75
- return typeof e;
76
- } : function(e) {
77
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
78
- }, b(e);
79
- }
80
- function h() {
81
- return h = Object.assign ? Object.assign.bind() : function(e) {
82
- for (var n = 1; n < arguments.length; n++) {
83
- var r = arguments[n];
84
- for (var t in r) {
85
- ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]);
86
- }
87
- }
88
- return e;
89
- }, h.apply(null, arguments);
90
- }
91
- function g(e, n) {
92
- var r = Object.keys(e);
93
- if (Object.getOwnPropertySymbols) {
94
- var t = Object.getOwnPropertySymbols(e);
95
- n && (t = t.filter((function(n) {
96
- return Object.getOwnPropertyDescriptor(e, n).enumerable;
97
- }))), r.push.apply(r, t);
98
- }
99
- return r;
100
- }
101
- function S(e) {
102
- for (var n = 1; n < arguments.length; n++) {
103
- var r = null != arguments[n] ? arguments[n] : {};
104
- n % 2 ? g(Object(r), !0).forEach((function(n) {
105
- O(e, n, r[n]);
106
- })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : g(Object(r)).forEach((function(n) {
107
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
108
- }));
109
- }
110
- return e;
111
- }
112
- function O(e, n, r) {
113
- return (n = w(n)) in e ? Object.defineProperty(e, n, {
114
- value: r,
115
- enumerable: !0,
116
- configurable: !0,
117
- writable: !0
118
- }) : e[n] = r, e;
119
- }
120
- function w(e) {
121
- var n = k(e, "string");
122
- return "symbol" == b(n) ? n : n + "";
123
- }
124
- function k(e, n) {
125
- if ("object" != b(e) || !e) return e;
126
- var r = e[Symbol.toPrimitive];
127
- if (void 0 !== r) {
128
- var t = r.call(e, n || "default");
129
- if ("object" != b(t)) return t;
130
- throw new TypeError("@@toPrimitive must return a primitive value.");
131
- }
132
- return ("string" === n ? String : Number)(e);
133
- }
134
- function I(e, n) {
135
- return T(e) || E(e, n) || j(e, n) || x();
136
- }
137
- function x() {
138
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
139
- }
140
- function j(e, n) {
141
- if (e) {
142
- if ("string" == typeof e) return C(e, n);
143
- var r = {}.toString.call(e).slice(8, -1);
144
- return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? C(e, n) : void 0;
145
- }
146
- }
147
- function C(e, n) {
148
- (null == n || n > e.length) && (n = e.length);
149
- for (var r = 0, t = Array(n); r < n; r++) {
150
- t[r] = e[r];
151
- }
152
- return t;
153
- }
154
- function E(e, n) {
155
- var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
156
- if (null != r) {
157
- var t, o, a, i, l = [], u = !0, c = !1;
158
- try {
159
- if (a = (r = r.call(e)).next, 0 === n) {
160
- if (Object(r) !== r) return;
161
- u = !1;
162
- } else for (;!(u = (t = a.call(r)).done) && (l.push(t.value), l.length !== n); u = !0) {
163
- }
164
- } catch (e) {
165
- c = !0, o = e;
166
- } finally {
167
- try {
168
- if (!u && null != r["return"] && (i = r["return"](), Object(i) !== i)) return;
169
- } finally {
170
- if (c) throw o;
171
- }
172
- }
173
- return l;
174
- }
175
- }
176
- function T(e) {
177
- if (Array.isArray(e)) return e;
178
- }
179
- function A(e, n) {
180
- if (null == e) return {};
181
- var r, t, o = P(e, n);
182
- if (Object.getOwnPropertySymbols) {
183
- var a = Object.getOwnPropertySymbols(e);
184
- for (t = 0; t < a.length; t++) {
185
- r = a[t], -1 === n.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (o[r] = e[r]);
186
- }
187
- }
188
- return o;
189
- }
190
- function P(e, n) {
191
- if (null == e) return {};
192
- var r = {};
193
- for (var t in e) {
194
- if ({}.hasOwnProperty.call(e, t)) {
195
- if (-1 !== n.indexOf(t)) continue;
196
- r[t] = e[t];
197
- }
198
- }
199
- return r;
200
- }
201
- var R = {
202
- id: i().string,
203
- children: i().node,
204
- content: i().node,
205
- customIndent: i().node,
206
- elementRef: i().oneOfType([ i().func, i().object ]),
207
- endAdornment: i().node,
208
- expanded: i().bool,
209
- onFocus: i().func,
210
- onKeyDown: i().func,
211
- onToggleSelection: i().func,
212
- onToggleExpansion: i().func
213
- };
214
- /** @public */
215
- /** @public */ function _(e) {
216
- var n = e.id, r = e.children, a = e.content, i = e.customIndent, l = e.elementRef, u = e.endAdornment, c = e.expanded, v = e.onFocus, b = e.onKeyDown, g = e.onToggleExpansion, O = e.onToggleSelection, w = A(e, [ "id", "children", "content", "customIndent", "elementRef", "endAdornment", "expanded", "onFocus", "onKeyDown", "onToggleExpansion", "onToggleSelection" ]);
217
- // @docs-props-type TreeItemPropsBase
218
- var k = (0, t.useContext)(p), x = k.defaultIndent, j = x === void 0 ? true : x, C = k.onItemKeyDown, E = k.onItemClick, T = k.removeNode, P = k.setNode, R = k.itemPaths, _ = k.focusedItemId;
219
- // make first tree item tabbable
220
- var K = (0, t.useState)((R === null || R === void 0 ? void 0 : R.get("".concat(n))) === "0" ? 0 : -1), D = I(K, 2), N = D[0], V = D[1];
221
- var L = (0, t.useRef)(null);
222
- var q = (0, t.useRef)(null);
223
- var F = t.Children.toArray(r).filter(t.isValidElement);
224
- F.forEach((function(e, r) {
225
- if (e.props.id) {
226
- if (c && P) {
227
- P("".concat(e.props.id), "".concat(R === null || R === void 0 ? void 0 : R.get("".concat(n)), "-").concat(r));
228
- } else if (T) {
229
- T(e.props.id);
230
- }
231
- }
232
- }));
233
- var M = (0, t.useCallback)((function(e) {
234
- m(L, e);
235
- m(l, e);
236
- }), [ l ]);
237
- var $ = (0, t.useCallback)((function(e) {
238
- var n;
239
- var r = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
240
- // For consistency, if not provided but found in the event then add it to `data` on callback.
241
- // This allows for common handling of both click and keyboard events in the consumer.
242
- var t = S({}, r);
243
- if (!r.treeItemId && ((n = e.currentTarget) === null || n === void 0 ? void 0 : n.id)) {
244
- t.treeItemId = e.currentTarget.id;
245
- }
246
- g === null || g === void 0 ? void 0 : g(e, t);
247
- }), [ g ]);
248
- var J = (0, t.useCallback)((function(e) {
249
- E === null || E === void 0 ? void 0 : E(e, n);
250
- }), [ n, E ]);
251
- var U = (0, t.useCallback)((function(e) {
252
- var n;
253
- e.stopPropagation();
254
- q === null || q === void 0 ? void 0 : (n = q.current) === null || n === void 0 ? void 0 : n.focus();
255
- v === null || v === void 0 ? void 0 : v(e);
256
- }), [ v ]);
257
- var B = (0, t.useCallback)((function() {
258
- if ((R === null || R === void 0 ? void 0 : R.get("".concat(n))) === "0") {
259
- V(0);
260
- }
261
- }), [ n, R ]);
262
- (0, t.useEffect)((function() {
263
- if (_ === n) {
264
- var e;
265
- L === null || L === void 0 ? void 0 : (e = L.current) === null || e === void 0 ? void 0 : e.focus();
266
- }
267
- }), [ _, n, L ]);
268
- var X = (0, t.useCallback)((function(e) {
269
- e.stopPropagation();
270
- }), []);
271
- var G = (0, t.useCallback)((function(e) {
272
- e.stopPropagation();
273
- if (e.key === " ") {
274
- e.preventDefault();
275
- O === null || O === void 0 ? void 0 : O(e, {
276
- treeItemId: n
277
- });
278
- return;
279
- }
280
- // Used to ensure first item in Tree is tab navigable, i.e. in JSONTree when focus is manually set to the root item,
281
- // this allows user to tab backwards to previous item. Tab index is reset to 0 onBlur.
282
- if (e.shiftKey && e.key === "Tab" && (R === null || R === void 0 ? void 0 : R.get("".concat(n))) === "0") {
283
- V(-1);
284
- }
285
- C === null || C === void 0 ? void 0 : C(e, n, c, F, $);
286
- b === null || b === void 0 ? void 0 : b(e);
287
- }), [ F, c, $, n, R, C, b, O ]);
288
-
289
- return o().createElement("li", h({
290
- "data-test": "tree-item"
291
- }, w, {
292
- id: n,
293
- ref: M,
294
- tabIndex: N,
295
- onBlur: B,
296
- onFocus: U,
297
- onKeyDown: G,
298
- role: "treeitem",
299
- "aria-expanded": F.length ? c || "false" : undefined
300
- }), o().createElement(f, null, o().createElement(d, null, i), o().createElement(s, {
301
- $hasCustomIndent: !!i,
302
- "data-test": "tree-item-content",
303
- ref: q,
304
- tabIndex: -1,
305
- onFocus: X,
306
- onClick: J
307
- }, a, !c && u)), c && o().createElement(o().Fragment, null, o().createElement(y, {
308
- role: "group",
309
- $defaultIndent: j
310
- }, r), u));
311
- }
312
- _.propTypes = R;
313
- /* harmony default export */ const K = _;
314
- // CONCATENATED MODULE: ./src/Tree/treeUtils.ts
315
- function D(e, n) {
316
- return F(e) || q(e, n) || V(e, n) || N();
317
- }
318
- function N() {
319
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
320
- }
321
- function V(e, n) {
322
- if (e) {
323
- if ("string" == typeof e) return L(e, n);
324
- var r = {}.toString.call(e).slice(8, -1);
325
- return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? L(e, n) : void 0;
326
- }
327
- }
328
- function L(e, n) {
329
- (null == n || n > e.length) && (n = e.length);
330
- for (var r = 0, t = Array(n); r < n; r++) {
331
- t[r] = e[r];
332
- }
333
- return t;
334
- }
335
- function q(e, n) {
336
- var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
337
- if (null != r) {
338
- var t, o, a, i, l = [], u = !0, c = !1;
339
- try {
340
- if (a = (r = r.call(e)).next, 0 === n) {
341
- if (Object(r) !== r) return;
342
- u = !1;
343
- } else for (;!(u = (t = a.call(r)).done) && (l.push(t.value), l.length !== n); u = !0) {
344
- }
345
- } catch (e) {
346
- c = !0, o = e;
347
- } finally {
348
- try {
349
- if (!u && null != r["return"] && (i = r["return"](), Object(i) !== i)) return;
350
- } finally {
351
- if (c) throw o;
352
- }
353
- }
354
- return l;
355
- }
356
- }
357
- function F(e) {
358
- if (Array.isArray(e)) return e;
359
- }
360
- /**
361
- * A helper function to get first key in Map that matches given value
362
- */ function M(e, n) {
363
- var r;
364
- var t = Array.from(e.entries());
365
- return (r = t.find((function(e) {
366
- var r = D(e, 2), t = r[1];
367
- return t === n;
368
- }))) === null || r === void 0 ? void 0 : r[0];
369
- }
370
- /**
371
- * A helper function to get parent path of current item path
372
- */ function $(e) {
373
- // remove last index number of the current item path string to get parent
374
- return e.split("-").slice(0, -1).join("-");
375
- }
376
- /**
377
- * A helper function to get next path of current item path in same level
378
- */ function J(e, n) {
379
- return e === null || e === void 0 ? void 0 : e.replace(/([^-]*)$/, "".concat(n + 1));
380
- }
381
- /**
382
- * A helper function to get the last index number of an item path string
383
- */ function U(e) {
384
- var n = e.split("-").pop();
385
- if (!n) {
386
- return 0;
387
- }
388
- return parseInt(n, 10) || 0;
389
- }
390
- function B(e, n) {
391
- var r = e.get(n);
392
- if (!r) {
393
- return n;
394
- }
395
- var t = $(r);
396
- return M(e, t) || n;
397
- }
398
- /**
399
- * A helper function for getNextTreeItem
400
- */ function X(e, n) {
401
- var r = $(n);
402
- if (!r) {
403
- return M(e, n);
404
- }
405
- // get next node in the parent level
406
- var t = U(r);
407
- var o = J(r, t);
408
- var a = M(e, o);
409
- if (a) {
410
- return a;
411
- }
412
- // continue getting parents until find next node or reach root
413
- return X(e, o);
414
- }
415
- function G(e, n) {
416
- var r = e.get(n);
417
- if (!r) {
418
- return n;
419
- }
420
- // case where next tree item is the first visible child
421
- var t = M(e, "".concat(r, "-0"));
422
- if (t) {
423
- return t;
424
- }
425
- // case where next tree item is the next node in the same level
426
- var o = U(r);
427
- var a = J(r, o);
428
- var i = M(e, a);
429
- if (i) {
430
- return i;
431
- }
432
- // case where next tree item is a higher level or does not exist
433
- return X(e, r) || n;
434
- }
435
- /**
436
- * A helper function for getPrevTreeItem
437
- */ function H(e, n) {
438
- var r = M(e, "".concat(n, "-0"));
439
- if (!r) {
440
- return M(e, n);
441
- }
442
- var t = M(e, n);
443
- var o = "".concat(n, "-0");
444
- // get the last child in current node, and continue to find its children recursively
445
- while (t) {
446
- var a = U(o);
447
- var i = J(o, a);
448
- t = M(e, i);
449
- if (t) {
450
- o = i;
451
- }
452
- }
453
- return H(e, o);
454
- }
455
- function W(e, n) {
456
- var r = e.get(n);
457
- if (!r) {
458
- return n;
459
- }
460
- var t = U(r);
461
- // case where current is first child of parent or root item
462
- if (t === 0) {
463
- return B(e, n);
464
- }
465
- // case where previous tree item is or is a child of previous node in same level
466
- var o = r.replace(/[^-]+$/, "".concat(t - 1));
467
- return H(e, o) || n;
468
- }
469
- function z(e) {
470
- return M(e, "0");
471
- }
472
- function Q(e) {
473
- var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "0";
474
- var r = M(e, n);
475
- var t = n;
476
- // find last child in current node
477
- while (r) {
478
- var o = U(t);
479
- r = M(e, J(t, o));
480
- if (r) {
481
- t = J(t, o);
482
- }
483
- }
484
- // check if last child has children
485
- var a = M(e, "".concat(t, "-0"));
486
- if (!a) {
487
- return M(e, t);
488
- }
489
- // continue to find its last child recursively
490
- t = "".concat(t, "-0");
491
- return Q(e, t);
492
- }
493
- // CONCATENATED MODULE: ./src/Tree/Tree.tsx
494
- function Y() {
495
- return Y = Object.assign ? Object.assign.bind() : function(e) {
496
- for (var n = 1; n < arguments.length; n++) {
497
- var r = arguments[n];
498
- for (var t in r) {
499
- ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]);
500
- }
501
- }
502
- return e;
503
- }, Y.apply(null, arguments);
504
- }
505
- function Z(e, n) {
506
- return oe(e) || te(e, n) || ne(e, n) || ee();
507
- }
508
- function ee() {
509
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
510
- }
511
- function ne(e, n) {
512
- if (e) {
513
- if ("string" == typeof e) return re(e, n);
514
- var r = {}.toString.call(e).slice(8, -1);
515
- return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? re(e, n) : void 0;
516
- }
517
- }
518
- function re(e, n) {
519
- (null == n || n > e.length) && (n = e.length);
520
- for (var r = 0, t = Array(n); r < n; r++) {
521
- t[r] = e[r];
522
- }
523
- return t;
524
- }
525
- function te(e, n) {
526
- var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
527
- if (null != r) {
528
- var t, o, a, i, l = [], u = !0, c = !1;
529
- try {
530
- if (a = (r = r.call(e)).next, 0 === n) {
531
- if (Object(r) !== r) return;
532
- u = !1;
533
- } else for (;!(u = (t = a.call(r)).done) && (l.push(t.value), l.length !== n); u = !0) {
534
- }
535
- } catch (e) {
536
- c = !0, o = e;
537
- } finally {
538
- try {
539
- if (!u && null != r["return"] && (i = r["return"](), Object(i) !== i)) return;
540
- } finally {
541
- if (c) throw o;
542
- }
543
- }
544
- return l;
545
- }
546
- }
547
- function oe(e) {
548
- if (Array.isArray(e)) return e;
549
- }
550
- function ae(e, n) {
551
- if (null == e) return {};
552
- var r, t, o = ie(e, n);
553
- if (Object.getOwnPropertySymbols) {
554
- var a = Object.getOwnPropertySymbols(e);
555
- for (t = 0; t < a.length; t++) {
556
- r = a[t], -1 === n.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (o[r] = e[r]);
557
- }
558
- }
559
- return o;
560
- }
561
- function ie(e, n) {
562
- if (null == e) return {};
563
- var r = {};
564
- for (var t in e) {
565
- if ({}.hasOwnProperty.call(e, t)) {
566
- if (-1 !== n.indexOf(t)) continue;
567
- r[t] = e[t];
568
- }
569
- }
570
- return r;
571
- }
572
- var le = {
573
- children: i().node,
574
- defaultIndent: i().bool,
575
- elementRef: i().oneOfType([ i().func, i().object ])
576
- };
577
- /**
578
- * Used to present a hierarchical list.
579
- */ function ue(e) {
580
- var n = e.children, r = e.defaultIndent, a = r === void 0 ? true : r, i = e.elementRef, l = ae(e, [ "children", "defaultIndent", "elementRef" ]);
581
- // @docs-props-type TreePropsBase
582
- var u = (0, t.useState)(), c = Z(u, 2), f = c[0], d = c[1];
583
- var s = (0, t.useMemo)((function() {
584
- return new Map;
585
- }), []);
586
- var v = (0, t.useCallback)((function(e, n, r, t, o) {
587
- e.stopPropagation();
588
- var a = r && (t === null || t === void 0 ? void 0 : t.length);
589
- switch (e.key) {
590
- case "ArrowUp":
591
- e.preventDefault();
592
- d(W(s, n));
593
- break;
594
-
595
- case "ArrowDown":
596
- e.preventDefault();
597
- d(G(s, n));
598
- break;
599
-
600
- case "ArrowLeft":
601
- e.preventDefault();
602
- if (a) {
603
- o(e, {
604
- treeItemId: n
605
- });
606
- } else {
607
- d(B(s, n));
608
- }
609
- break;
610
-
611
- case "ArrowRight":
612
- e.preventDefault();
613
- if (a) {
614
- d(G(s, n));
615
- } else {
616
- o(e, {
617
- treeItemId: n
618
- });
619
- }
620
- break;
621
-
622
- case "Home":
623
- e.preventDefault();
624
- d(z(s));
625
- break;
626
-
627
- case "End":
628
- e.preventDefault();
629
- d(Q(s));
630
- break;
631
-
632
- case "Enter":
633
- e.preventDefault();
634
- o(e, {
635
- treeItemId: n
636
- });
637
- break;
638
-
639
- default:
640
- // do nothing
641
- }
642
- }), [ s ]);
643
- var m = function e(n, r) {
644
- n.preventDefault();
645
- d(r);
646
- };
647
- var b = (0, t.useCallback)((function(e) {
648
- s["delete"](e);
649
- }), [ s ]);
650
- var h = (0, t.useCallback)((function(e, n) {
651
- s.set(e, n);
652
- }), [ s ]);
653
- var g = t.Children.toArray(n).filter(t.isValidElement);
654
- g.forEach((function(e, n) {
655
- if (e.props.id && h) {
656
- h("".concat(e.props.id), "".concat(n));
657
- }
658
- }));
659
- var S = (0, t.useMemo)((function() {
660
- return {
661
- defaultIndent: a,
662
- onItemKeyDown: v,
663
- onItemClick: m,
664
- removeNode: b,
665
- setNode: h,
666
- itemPaths: s,
667
- focusedItemId: f
668
- };
669
- }), [ a, f, s, v, b, h ]);
670
-
671
- return o().createElement(p.Provider, {
672
- value: S
673
- }, o().createElement(y, Y({
674
- "data-test": "tree",
675
- ref: i,
676
- role: "tree",
677
- $defaultIndent: a
678
- }, l), n));
679
- }
680
- ue.propTypes = le;
681
- ue.Item = K;
682
- /* harmony default export */ const ce = ue;
683
- } // CONCATENATED MODULE: ./src/Tree/index.ts
684
- /***/ ,
685
- /***/ 3563:
686
- /***/ e => {
687
- e.exports = require("@splunk/themes");
688
- /***/ },
689
- /***/ 23:
690
- /***/ e => {
691
- e.exports = require("prop-types");
692
- /***/ },
693
- /***/ 9497:
694
- /***/ e => {
695
- e.exports = require("react");
696
- /***/ },
697
- /***/ 232:
698
- /***/ e => {
699
- e.exports = require("styled-components");
700
- /***/
701
- /******/ }
702
- };
703
- /************************************************************************/
704
- /******/ // The module cache
705
- /******/ var n = {};
706
- /******/
707
- /******/ // The require function
708
- /******/ function r(t) {
709
- /******/ // Check if module is in cache
710
- /******/ var o = n[t];
711
- /******/ if (o !== undefined) {
712
- /******/ return o.exports;
713
- /******/ }
714
- /******/ // Create a new module (and put it into the cache)
715
- /******/ var a = n[t] = {
716
- /******/ // no module.id needed
717
- /******/ // no module.loaded needed
718
- /******/ exports: {}
719
- /******/ };
720
- /******/
721
- /******/ // Execute the module function
722
- /******/ e[t](a, a.exports, r);
723
- /******/
724
- /******/ // Return the exports of the module
725
- /******/ return a.exports;
726
- /******/ }
4
+ /******/ // The require scope
5
+ /******/ var e = {};
727
6
  /******/
728
7
  /************************************************************************/
729
8
  /******/ /* webpack/runtime/compat get default export */
730
9
  /******/ (() => {
731
10
  /******/ // getDefaultExport function for compatibility with non-harmony modules
732
- /******/ r.n = e => {
733
- /******/ var n = e && e.__esModule ?
734
- /******/ () => e["default"]
735
- /******/ : () => e
11
+ /******/ e.n = n => {
12
+ /******/ var r = n && n.__esModule ?
13
+ /******/ () => n["default"]
14
+ /******/ : () => n
736
15
  /******/;
737
- r.d(n, {
738
- a: n
16
+ e.d(r, {
17
+ a: r
739
18
  });
740
- /******/ return n;
19
+ /******/ return r;
741
20
  /******/ };
742
21
  /******/ })();
743
22
  /******/
744
23
  /******/ /* webpack/runtime/define property getters */
745
24
  /******/ (() => {
746
25
  /******/ // define getter functions for harmony exports
747
- /******/ r.d = (e, n) => {
748
- /******/ for (var t in n) {
749
- /******/ if (r.o(n, t) && !r.o(e, t)) {
750
- /******/ Object.defineProperty(e, t, {
26
+ /******/ e.d = (n, r) => {
27
+ /******/ for (var t in r) {
28
+ /******/ if (e.o(r, t) && !e.o(n, t)) {
29
+ /******/ Object.defineProperty(n, t, {
751
30
  enumerable: true,
752
- get: n[t]
31
+ get: r[t]
753
32
  });
754
33
  /******/ }
755
34
  /******/ }
@@ -758,14 +37,14 @@
758
37
  /******/
759
38
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
760
39
  /******/ (() => {
761
- /******/ r.o = (e, n) => Object.prototype.hasOwnProperty.call(e, n)
40
+ /******/ e.o = (e, n) => Object.prototype.hasOwnProperty.call(e, n)
762
41
  /******/;
763
42
  })();
764
43
  /******/
765
44
  /******/ /* webpack/runtime/make namespace object */
766
45
  /******/ (() => {
767
46
  /******/ // define __esModule on exports
768
- /******/ r.r = e => {
47
+ /******/ e.r = e => {
769
48
  /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
770
49
  /******/ Object.defineProperty(e, Symbol.toStringTag, {
771
50
  value: "Module"
@@ -777,722 +56,717 @@
777
56
  /******/ };
778
57
  /******/ })();
779
58
  /******/
780
- /************************************************************************/ var t = {};
781
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
782
- (() => {
783
- // ESM COMPAT FLAG
784
- r.r(t);
785
- // EXPORTS
786
- r.d(t, {
787
- default: () => /* reexport */ Re
788
- });
789
- // EXTERNAL MODULE: external "react"
790
- var e = r(9497);
791
- var n = r.n(e);
792
- // CONCATENATED MODULE: external "lodash/isString"
793
- const o = require("lodash/isString");
794
- var a = r.n(o);
795
- // EXTERNAL MODULE: external "prop-types"
796
- var i = r(23);
797
- var l = r.n(i);
798
- // CONCATENATED MODULE: external "@splunk/ui-utils/id"
799
- const u = require("@splunk/ui-utils/id");
800
- // EXTERNAL MODULE: external "styled-components"
801
- var c = r(232);
802
- var f = r.n(c);
803
- // CONCATENATED MODULE: external "@splunk/react-ui/Tree"
804
- const d = require("@splunk/react-ui/Tree");
805
- var s = r.n(d);
806
- // EXTERNAL MODULE: external "@splunk/themes"
807
- var v = r(3563);
808
- // CONCATENATED MODULE: ./src/JSONTree/JSONTreeStyles.ts
809
- var p = (0, c.css)([ "", ";", ";color:", ";padding:4px;" ], v.mixins.reset("block"), v.mixins.typography({
810
- family: "monospace"
811
- }), v.variables.syntaxGray);
812
- var y = f().code.withConfig({
813
- displayName: "JSONTreeStyles__StyledScrollCode",
814
- componentId: "vrdt21-0"
815
- })([ "", ";overflow-x:auto;white-space:nowrap;" ], p);
816
- var m = f()(s()).withConfig({
817
- displayName: "JSONTreeStyles__StyledTree",
818
- componentId: "vrdt21-1"
819
- })([ "font-family:inherit;ul{font-family:inherit;}" ]);
820
- var b = f().code.withConfig({
821
- displayName: "JSONTreeStyles__StyledWrapCode",
822
- componentId: "vrdt21-2"
823
- })([ "", ";white-space:pre-wrap;" ], p);
824
- // CONCATENATED MODULE: external "lodash/fill"
825
- const h = require("lodash/fill");
826
- var g = r.n(h);
827
- // CONCATENATED MODULE: external "lodash/isArray"
828
- const S = require("lodash/isArray");
829
- var O = r.n(S);
830
- // CONCATENATED MODULE: external "lodash/isEmpty"
831
- const w = require("lodash/isEmpty");
832
- var k = r.n(w);
833
- // CONCATENATED MODULE: external "lodash/isNumber"
834
- const I = require("lodash/isNumber");
835
- var x = r.n(I);
836
- // CONCATENATED MODULE: external "lodash/isObject"
837
- const j = require("lodash/isObject");
838
- var C = r.n(j);
839
- // CONCATENATED MODULE: external "lodash/keys"
840
- const E = require("lodash/keys");
841
- var T = r.n(E);
842
- // CONCATENATED MODULE: external "lodash/repeat"
843
- const A = require("lodash/repeat");
844
- var P = r.n(A);
845
- // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
846
- const R = require("@splunk/ui-utils/i18n");
847
- // CONCATENATED MODULE: external "@splunk/react-ui/ButtonSimple"
848
- const _ = require("@splunk/react-ui/ButtonSimple");
849
- var K = r.n(_);
850
- // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
851
- const D = require("@splunk/react-ui/Clickable");
852
- var N = r.n(D);
853
- // CONCATENATED MODULE: external "@splunk/react-ui/Tooltip"
854
- const V = require("@splunk/react-ui/Tooltip");
855
- var L = r.n(V);
856
- // CONCATENATED MODULE: ./src/JSONTree/JSONTreeItemStyles.ts
857
- var q = {
858
- string: v.variables.syntaxTeal,
859
- number: v.variables.syntaxBlue,
860
- boolean: v.variables.syntaxPurple,
861
- null: v.variables.syntaxBrown,
862
- object: v.variables.syntaxGray,
863
- array: v.variables.syntaxGray
864
- };
865
- var F = (0, c.css)([ "word-break:break-word;word-wrap:break-word;" ]);
866
- var M = (0, c.css)([ "white-space:nowrap;" ]);
867
- /* Using this magic number to set the height to be at least the minimum target size of 24 by 24 */ var $ = (0,
868
- c.css)([ "padding-block:2px;" ]);
869
- var J = (0, c.css)([ "font-family:inherit;&:focus{box-shadow:", ";outline:0;&:active{box-shadow:none;}}&:hover{background-color:", ";}" ], v.variables.focusShadow, v.variables.neutral50);
870
- var U = (0, c.css)([ "color:", ";", ";", "" ], (function(e) {
871
- var n = e.valueType;
872
- return q[n];
873
- }), (function(e) {
874
- var n = e.overflowType;
875
- return n === "wrap" ? F : M;
876
- }), $);
877
- var B = f().span.withConfig({
878
- displayName: "JSONTreeItemStyles__StyledContentWrapper",
879
- componentId: "o558h3-0"
880
- })([ "color:", ";" ], v.variables.syntaxGray);
881
- var X = f().span.withConfig({
882
- displayName: "JSONTreeItemStyles__StyledValue",
883
- componentId: "o558h3-1"
884
- })([ "", "" ], U);
885
- var G = f()(N()).withConfig({
886
- displayName: "JSONTreeItemStyles__StyledValueInteractiveClickable",
887
- componentId: "o558h3-2"
888
- })([ "", " ", " min-width:24px;text-align:center;" ], U, J);
889
- var H = (0, c.css)([ "", " color:", ";" ], $, v.variables.syntaxRed);
890
- var W = f().span.withConfig({
891
- displayName: "JSONTreeItemStyles__StyledProperty",
892
- componentId: "o558h3-3"
893
- })([ "", "" ], H);
894
- var z = f()(N()).withConfig({
895
- displayName: "JSONTreeItemStyles__StyledPropertyInteractiveClickable",
896
- componentId: "o558h3-4"
897
- })([ "", " ", "" ], H, J);
898
- var Q = f()(K()).withConfig({
899
- displayName: "JSONTreeItemStyles__StyledExpandLinkClickable",
900
- componentId: "o558h3-5"
901
- })([ "", ";border:none;border-radius:0;font-family:inherit;padding:1px ", " 3px ", ";&:hover{background-color:", ";text-decoration:none;}&:focus{box-shadow:", ";&:active{box-shadow:none;}}" ], $, v.variables.spacingXSmall, v.variables.spacingXSmall, v.variables.actionColorBackgroundSubtleHover, v.variables.focusShadowInset);
902
- var Y = f()(L()).withConfig({
903
- displayName: "JSONTreeItemStyles__StyledTooltip",
904
- componentId: "o558h3-6"
905
- })([ "font-family:", ";" ], v.variables.monoFontFamily);
906
- // CONCATENATED MODULE: ./src/JSONTree/JSONTreeItem.tsx
907
- function Z() {
908
- return Z = Object.assign ? Object.assign.bind() : function(e) {
909
- for (var n = 1; n < arguments.length; n++) {
910
- var r = arguments[n];
911
- for (var t in r) {
912
- ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]);
913
- }
914
- }
915
- return e;
916
- }, Z.apply(null, arguments);
917
- }
918
- function ee(e, n) {
919
- return ae(e) || oe(e, n) || re(e, n) || ne();
920
- }
921
- function ne() {
922
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
923
- }
924
- function re(e, n) {
925
- if (e) {
926
- if ("string" == typeof e) return te(e, n);
927
- var r = {}.toString.call(e).slice(8, -1);
928
- return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? te(e, n) : void 0;
929
- }
59
+ /************************************************************************/ var n = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(n);
62
+ // EXPORTS
63
+ e.d(n, {
64
+ default: () => /* reexport */ Ae
65
+ });
66
+ // CONCATENATED MODULE: external "react"
67
+ const r = require("react");
68
+ var t = e.n(r);
69
+ // CONCATENATED MODULE: external "lodash/isString"
70
+ const a = require("lodash/isString");
71
+ var o = e.n(a);
72
+ // CONCATENATED MODULE: external "prop-types"
73
+ const l = require("prop-types");
74
+ var i = e.n(l);
75
+ // CONCATENATED MODULE: external "@splunk/ui-utils/id"
76
+ const u = require("@splunk/ui-utils/id");
77
+ // CONCATENATED MODULE: external "styled-components"
78
+ const c = require("styled-components");
79
+ var d = e.n(c);
80
+ // CONCATENATED MODULE: external "@splunk/react-ui/Tree"
81
+ const s = require("@splunk/react-ui/Tree");
82
+ var f = e.n(s);
83
+ // CONCATENATED MODULE: external "@splunk/themes"
84
+ const p = require("@splunk/themes");
85
+ // CONCATENATED MODULE: ./src/JSONTree/JSONTreeStyles.ts
86
+ var v = (0, c.css)([ "", ";", ";color:", ";padding:4px;" ], p.mixins.reset("block"), p.mixins.typography({
87
+ family: "monospace"
88
+ }), p.variables.syntaxGray);
89
+ var y = d().code.withConfig({
90
+ displayName: "JSONTreeStyles__StyledScrollCode",
91
+ componentId: "vrdt21-0"
92
+ })([ "", ";overflow-x:auto;white-space:nowrap;" ], v);
93
+ var b = d()(f()).withConfig({
94
+ displayName: "JSONTreeStyles__StyledTree",
95
+ componentId: "vrdt21-1"
96
+ })([ "font-family:inherit;ul{font-family:inherit;}" ]);
97
+ var m = d().code.withConfig({
98
+ displayName: "JSONTreeStyles__StyledWrapCode",
99
+ componentId: "vrdt21-2"
100
+ })([ "", ";white-space:pre-wrap;" ], v);
101
+ // CONCATENATED MODULE: external "lodash/fill"
102
+ const h = require("lodash/fill");
103
+ var g = e.n(h);
104
+ // CONCATENATED MODULE: external "lodash/isArray"
105
+ const S = require("lodash/isArray");
106
+ var k = e.n(S);
107
+ // CONCATENATED MODULE: external "lodash/isEmpty"
108
+ const x = require("lodash/isEmpty");
109
+ var O = e.n(x);
110
+ // CONCATENATED MODULE: external "lodash/isNumber"
111
+ const w = require("lodash/isNumber");
112
+ var C = e.n(w);
113
+ // CONCATENATED MODULE: external "lodash/isObject"
114
+ const E = require("lodash/isObject");
115
+ var I = e.n(E);
116
+ // CONCATENATED MODULE: external "lodash/keys"
117
+ const j = require("lodash/keys");
118
+ var T = e.n(j);
119
+ // CONCATENATED MODULE: external "lodash/repeat"
120
+ const R = require("lodash/repeat");
121
+ var A = e.n(R);
122
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
123
+ const P = require("@splunk/ui-utils/i18n");
124
+ // CONCATENATED MODULE: external "@splunk/react-ui/ButtonSimple"
125
+ const _ = require("@splunk/react-ui/ButtonSimple");
126
+ var K = e.n(_);
127
+ // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
128
+ const N = require("@splunk/react-ui/Clickable");
129
+ var V = e.n(N);
130
+ // CONCATENATED MODULE: external "@splunk/react-ui/Tooltip"
131
+ const q = require("@splunk/react-ui/Tooltip");
132
+ var L = e.n(q);
133
+ // CONCATENATED MODULE: ./src/JSONTree/JSONTreeItemStyles.ts
134
+ var D = {
135
+ string: p.variables.syntaxTeal,
136
+ number: p.variables.syntaxBlue,
137
+ boolean: p.variables.syntaxPurple,
138
+ null: p.variables.syntaxBrown,
139
+ object: p.variables.syntaxGray,
140
+ array: p.variables.syntaxGray
141
+ };
142
+ var F = (0, c.css)([ "word-break:break-word;word-wrap:break-word;" ]);
143
+ var J = (0, c.css)([ "white-space:nowrap;" ]);
144
+ /* Using this magic number to set the height to be at least the minimum target size of 24 by 24 */ var M = (0,
145
+ c.css)([ "padding-block:2px;" ]);
146
+ var B = (0, c.css)([ "font-family:inherit;&:focus{box-shadow:", ";outline:0;&:active{box-shadow:none;}}&:hover{background-color:", ";}" ], p.variables.focusShadow, p.variables.neutral50);
147
+ var G = (0, c.css)([ "color:", ";", ";", "" ], (function(e) {
148
+ var n = e.valueType;
149
+ return D[n];
150
+ }), (function(e) {
151
+ var n = e.overflowType;
152
+ return n === "wrap" ? F : J;
153
+ }), M);
154
+ var U = d().span.withConfig({
155
+ displayName: "JSONTreeItemStyles__StyledContentWrapper",
156
+ componentId: "o558h3-0"
157
+ })([ "color:", ";" ], p.variables.syntaxGray);
158
+ var $ = d().span.withConfig({
159
+ displayName: "JSONTreeItemStyles__StyledValue",
160
+ componentId: "o558h3-1"
161
+ })([ "", "" ], G);
162
+ var W = d()(V()).withConfig({
163
+ displayName: "JSONTreeItemStyles__StyledValueInteractiveClickable",
164
+ componentId: "o558h3-2"
165
+ })([ "", " ", " min-width:24px;text-align:center;" ], G, B);
166
+ var X = (0, c.css)([ "", " color:", ";" ], M, p.variables.syntaxRed);
167
+ var H = d().span.withConfig({
168
+ displayName: "JSONTreeItemStyles__StyledProperty",
169
+ componentId: "o558h3-3"
170
+ })([ "", "" ], X);
171
+ var z = d()(V()).withConfig({
172
+ displayName: "JSONTreeItemStyles__StyledPropertyInteractiveClickable",
173
+ componentId: "o558h3-4"
174
+ })([ "", " ", "" ], X, B);
175
+ var Q = d()(K()).withConfig({
176
+ displayName: "JSONTreeItemStyles__StyledExpandLinkClickable",
177
+ componentId: "o558h3-5"
178
+ })([ "", ";border:none;border-radius:0;font-family:inherit;padding:1px ", " 3px ", ";&:hover{background-color:", ";text-decoration:none;}&:focus{box-shadow:", ";&:active{box-shadow:none;}}" ], M, p.variables.spacingXSmall, p.variables.spacingXSmall, p.variables.actionColorBackgroundSubtleHover, p.variables.focusShadowInset);
179
+ var Y = d()(L()).withConfig({
180
+ displayName: "JSONTreeItemStyles__StyledTooltip",
181
+ componentId: "o558h3-6"
182
+ })([ "font-family:", ";" ], p.variables.monoFontFamily);
183
+ // CONCATENATED MODULE: ./src/JSONTree/JSONTreeItem.tsx
184
+ function Z() {
185
+ return Z = Object.assign ? Object.assign.bind() : function(e) {
186
+ for (var n = 1; n < arguments.length; n++) {
187
+ var r = arguments[n];
188
+ for (var t in r) {
189
+ ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]);
190
+ }
191
+ }
192
+ return e;
193
+ }, Z.apply(null, arguments);
194
+ }
195
+ function ee(e, n) {
196
+ return oe(e) || ae(e, n) || re(e, n) || ne();
197
+ }
198
+ function ne() {
199
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
200
+ }
201
+ function re(e, n) {
202
+ if (e) {
203
+ if ("string" == typeof e) return te(e, n);
204
+ var r = {}.toString.call(e).slice(8, -1);
205
+ return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? te(e, n) : void 0;
930
206
  }
931
- function te(e, n) {
932
- (null == n || n > e.length) && (n = e.length);
933
- for (var r = 0, t = Array(n); r < n; r++) {
934
- t[r] = e[r];
935
- }
936
- return t;
207
+ }
208
+ function te(e, n) {
209
+ (null == n || n > e.length) && (n = e.length);
210
+ for (var r = 0, t = Array(n); r < n; r++) {
211
+ t[r] = e[r];
937
212
  }
938
- function oe(e, n) {
939
- var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
940
- if (null != r) {
941
- var t, o, a, i, l = [], u = !0, c = !1;
213
+ return t;
214
+ }
215
+ function ae(e, n) {
216
+ var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
217
+ if (null != r) {
218
+ var t, a, o, l, i = [], u = !0, c = !1;
219
+ try {
220
+ if (o = (r = r.call(e)).next, 0 === n) {
221
+ if (Object(r) !== r) return;
222
+ u = !1;
223
+ } else for (;!(u = (t = o.call(r)).done) && (i.push(t.value), i.length !== n); u = !0) {
224
+ }
225
+ } catch (e) {
226
+ c = !0, a = e;
227
+ } finally {
942
228
  try {
943
- if (a = (r = r.call(e)).next, 0 === n) {
944
- if (Object(r) !== r) return;
945
- u = !1;
946
- } else for (;!(u = (t = a.call(r)).done) && (l.push(t.value), l.length !== n); u = !0) {
947
- }
948
- } catch (e) {
949
- c = !0, o = e;
229
+ if (!u && null != r["return"] && (l = r["return"](), Object(l) !== l)) return;
950
230
  } finally {
951
- try {
952
- if (!u && null != r["return"] && (i = r["return"](), Object(i) !== i)) return;
953
- } finally {
954
- if (c) throw o;
955
- }
231
+ if (c) throw a;
956
232
  }
957
- return l;
958
233
  }
234
+ return i;
959
235
  }
960
- function ae(e) {
961
- if (Array.isArray(e)) return e;
962
- }
963
- function ie(e, n) {
964
- if (null == e) return {};
965
- var r, t, o = le(e, n);
966
- if (Object.getOwnPropertySymbols) {
967
- var a = Object.getOwnPropertySymbols(e);
968
- for (t = 0; t < a.length; t++) {
969
- r = a[t], -1 === n.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (o[r] = e[r]);
970
- }
236
+ }
237
+ function oe(e) {
238
+ if (Array.isArray(e)) return e;
239
+ }
240
+ function le(e, n) {
241
+ if (null == e) return {};
242
+ var r, t, a = ie(e, n);
243
+ if (Object.getOwnPropertySymbols) {
244
+ var o = Object.getOwnPropertySymbols(e);
245
+ for (t = 0; t < o.length; t++) {
246
+ r = o[t], -1 === n.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
971
247
  }
972
- return o;
973
248
  }
974
- function le(e, n) {
975
- if (null == e) return {};
976
- var r = {};
977
- for (var t in e) {
978
- if ({}.hasOwnProperty.call(e, t)) {
979
- if (-1 !== n.indexOf(t)) continue;
980
- r[t] = e[t];
981
- }
249
+ return a;
250
+ }
251
+ function ie(e, n) {
252
+ if (null == e) return {};
253
+ var r = {};
254
+ for (var t in e) {
255
+ if ({}.hasOwnProperty.call(e, t)) {
256
+ if (-1 !== n.indexOf(t)) continue;
257
+ r[t] = e[t];
982
258
  }
983
- return r;
984
259
  }
985
- var ue = {
986
- clickableKeyRef: l().object,
987
- clickableValRef: l().object,
988
- hasChildren: l().bool,
989
- indentArray: l().arrayOf(l().string),
990
- index: l().number,
991
- initialOpenState: l().bool,
992
- isRoot: l().bool,
993
- properties: l().arrayOf(l().string),
994
- propertyDataPath: l().string,
995
- propertyElement: l().node,
996
- renderExpandLink: l().func,
997
- representation: l().node,
998
- value: l().oneOfType([ l().string, l().object, l().array, l().number, l().bool ])
999
- };
1000
- function ce(r) {
1001
- var t = r.clickableKeyRef, o = r.clickableValRef, a = r.hasChildren, i = r.indentArray, l = r.index, u = r.initialOpenState, c = r.isRoot, f = r.onFocus, d = r.properties, v = r.propertyDataPath, p = r.propertyElement, y = r.renderExpandLink, m = r.representation, b = r.value, h = ie(r, [ "clickableKeyRef", "clickableValRef", "hasChildren", "indentArray", "index", "initialOpenState", "isRoot", "onFocus", "properties", "propertyDataPath", "propertyElement", "renderExpandLink", "representation", "value" ]);
1002
- // @docs-props-type JSONTreeItemPropsBase
1003
- var g = (0, e.useState)(u), S = ee(g, 2), w = S[0], k = S[1];
1004
- var I = (0, e.useCallback)((function() {
1005
- k((function(e) {
1006
- return !e;
1007
- }));
1008
- }), []);
1009
- var x = (0, e.useRef)(null);
1010
- var j = y ? y({
1011
- onToggleExpansion: I,
1012
- open: w,
1013
- withTooltip: true,
1014
- expandLinkRef: x
1015
- }) : {
1016
- expandLink: undefined
1017
- }, C = j.expandLink;
1018
- var E = (d === null || d === void 0 ? void 0 : d.length) && l + 1 < (d === null || d === void 0 ? void 0 : d.length) ? "," : null;
1019
-
1020
- return n().createElement(s().Item, Z({
1021
- content: n().createElement(B, null, p, a && (O()(b) ? "[" : "{"), !a && n().createElement(n().Fragment, null, m, E), a && C),
1022
- customIndent: i,
1023
- "data-test": a ? "node" : null,
1024
- "data-test-path": v,
1025
- endAdornment: a && n().createElement(B, null, w && i, O()(b) ? "]" : "}", E),
1026
- expanded: w,
1027
- onFocus: function e(n) {
1028
- f === null || f === void 0 ? void 0 : f(n);
1029
- // check if onFocus was triggered by a click event or expand link
1030
- var r = n.relatedTarget === (t === null || t === void 0 ? void 0 : t.current) || n.relatedTarget === (o === null || o === void 0 ? void 0 : o.current) || n.relatedTarget === (x === null || x === void 0 ? void 0 : x.current) ? n.relatedTarget : null;
1031
- if (c) {
1032
- var a;
1033
- x === null || x === void 0 ? void 0 : (a = x.current) === null || a === void 0 ? void 0 : a.focus();
1034
- }
1035
- if (!r) {
1036
- // if JSONTreeItem contains clickable keys/vals, focus should go there
1037
- if (p && (t === null || t === void 0 ? void 0 : t.current)) {
1038
- var i;
1039
- (i = t.current) === null || i === void 0 ? void 0 : i.focus();
1040
- } else if (o === null || o === void 0 ? void 0 : o.current) {
1041
- var l;
1042
- (l = o.current) === null || l === void 0 ? void 0 : l.focus();
1043
- }
1044
- } else {
1045
- r.focus();
260
+ return r;
261
+ }
262
+ var ue = {
263
+ clickableKeyRef: i().object,
264
+ clickableValRef: i().object,
265
+ hasChildren: i().bool,
266
+ indentArray: i().arrayOf(i().string),
267
+ index: i().number,
268
+ initialOpenState: i().bool,
269
+ isRoot: i().bool,
270
+ properties: i().arrayOf(i().string),
271
+ propertyDataPath: i().string,
272
+ propertyElement: i().node,
273
+ renderExpandLink: i().func,
274
+ representation: i().node,
275
+ value: i().oneOfType([ i().string, i().object, i().array, i().number, i().bool ])
276
+ };
277
+ function ce(e) {
278
+ var n = e.clickableKeyRef, a = e.clickableValRef, o = e.hasChildren, l = e.indentArray, i = e.index, u = e.initialOpenState, c = e.isRoot, d = e.onFocus, s = e.properties, p = e.propertyDataPath, v = e.propertyElement, y = e.renderExpandLink, b = e.representation, m = e.value, h = le(e, [ "clickableKeyRef", "clickableValRef", "hasChildren", "indentArray", "index", "initialOpenState", "isRoot", "onFocus", "properties", "propertyDataPath", "propertyElement", "renderExpandLink", "representation", "value" ]);
279
+ // @docs-props-type JSONTreeItemPropsBase
280
+ var g = (0, r.useState)(u), S = ee(g, 2), x = S[0], O = S[1];
281
+ var w = (0, r.useCallback)((function() {
282
+ O((function(e) {
283
+ return !e;
284
+ }));
285
+ }), []);
286
+ var C = (0, r.useRef)(null);
287
+ var E = y ? y({
288
+ onToggleExpansion: w,
289
+ open: x,
290
+ withTooltip: true,
291
+ expandLinkRef: C
292
+ }) : {
293
+ expandLink: undefined
294
+ }, I = E.expandLink;
295
+ var j = (s === null || s === void 0 ? void 0 : s.length) && i + 1 < (s === null || s === void 0 ? void 0 : s.length) ? "," : null;
296
+
297
+ return t().createElement(f().Item, Z({
298
+ content: t().createElement(U, null, v, o && (k()(m) ? "[" : "{"), !o && t().createElement(t().Fragment, null, b, j), o && I),
299
+ customIndent: l,
300
+ "data-test": o ? "node" : null,
301
+ "data-test-path": p,
302
+ endAdornment: o && t().createElement(U, null, x && l, k()(m) ? "]" : "}", j),
303
+ expanded: x,
304
+ onFocus: function e(r) {
305
+ d === null || d === void 0 ? void 0 : d(r);
306
+ // check if onFocus was triggered by a click event or expand link
307
+ var t = r.relatedTarget === (n === null || n === void 0 ? void 0 : n.current) || r.relatedTarget === (a === null || a === void 0 ? void 0 : a.current) || r.relatedTarget === (C === null || C === void 0 ? void 0 : C.current) ? r.relatedTarget : null;
308
+ if (c) {
309
+ var o;
310
+ C === null || C === void 0 ? void 0 : (o = C.current) === null || o === void 0 ? void 0 : o.focus();
311
+ }
312
+ if (!t) {
313
+ // if JSONTreeItem contains clickable keys/vals, focus should go there
314
+ if (v && (n === null || n === void 0 ? void 0 : n.current)) {
315
+ var l;
316
+ (l = n.current) === null || l === void 0 ? void 0 : l.focus();
317
+ } else if (a === null || a === void 0 ? void 0 : a.current) {
318
+ var i;
319
+ (i = a.current) === null || i === void 0 ? void 0 : i.focus();
1046
320
  }
1047
- },
1048
- onToggleExpansion: I,
1049
- tabIndex: 0
1050
- }, h), a && m);
1051
- }
1052
- ce.propTypes = ue;
1053
- // EXTERNAL MODULE: ./src/Tree/index.ts + 7 modules
1054
- var fe = r(8655);
1055
- // CONCATENATED MODULE: ./src/JSONTree/renderTreeItems.tsx
1056
- function de(e) {
1057
- "@babel/helpers - typeof";
1058
- return de = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
1059
- return typeof e;
1060
- } : function(e) {
1061
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
1062
- }, de(e);
1063
- }
1064
- function se(e) {
1065
- return me(e) || ye(e) || pe(e) || ve();
321
+ } else {
322
+ t.focus();
323
+ }
324
+ },
325
+ onToggleExpansion: w,
326
+ tabIndex: 0
327
+ }, h), o && b);
328
+ }
329
+ ce.propTypes = ue;
330
+ // CONCATENATED MODULE: ./src/JSONTree/renderTreeItems.tsx
331
+ function de(e) {
332
+ "@babel/helpers - typeof";
333
+ return de = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
334
+ return typeof e;
335
+ } : function(e) {
336
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
337
+ }, de(e);
338
+ }
339
+ function se(e) {
340
+ return ye(e) || ve(e) || pe(e) || fe();
341
+ }
342
+ function fe() {
343
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
344
+ }
345
+ function pe(e, n) {
346
+ if (e) {
347
+ if ("string" == typeof e) return be(e, n);
348
+ var r = {}.toString.call(e).slice(8, -1);
349
+ return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? be(e, n) : void 0;
1066
350
  }
1067
- function ve() {
1068
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
351
+ }
352
+ function ve(e) {
353
+ if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
354
+ }
355
+ function ye(e) {
356
+ if (Array.isArray(e)) return be(e);
357
+ }
358
+ function be(e, n) {
359
+ (null == n || n > e.length) && (n = e.length);
360
+ for (var r = 0, t = Array(n); r < n; r++) {
361
+ t[r] = e[r];
1069
362
  }
1070
- function pe(e, n) {
1071
- if (e) {
1072
- if ("string" == typeof e) return be(e, n);
1073
- var r = {}.toString.call(e).slice(8, -1);
1074
- return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? be(e, n) : void 0;
363
+ return t;
364
+ }
365
+ function me(e) {
366
+ var n = e.id, a = e.childKey, o = e.index, l = e.value, i = e.properties, u = e.propertyDataPath, c = e.obj, d = e.renderValue, s = e.renderKey, f = e.getInitialOpenState, p = e.indentArray, v = e.renderExpandLink, y = e.onFocus;
367
+ var b = (0, r.useRef)(null);
368
+ var m = (0, r.useRef)(null);
369
+ var h = d({
370
+ key: a,
371
+ value: l,
372
+ clickValueRef: b
373
+ }), g = h.representation, S = h.clickableValRef;
374
+ var x = !k()(c) ? s(a, m) : {
375
+ propertyElement: undefined,
376
+ clickableKeyRef: undefined
377
+ }, w = x.propertyElement, C = x.clickableKeyRef;
378
+ var E = I()(l) && !O()(l) || k()(l) && l.length > 0;
379
+
380
+ return t().createElement(ce, {
381
+ id: n,
382
+ propertyDataPath: u,
383
+ propertyElement: w,
384
+ hasChildren: E,
385
+ initialOpenState: f(),
386
+ representation: g,
387
+ indentArray: p,
388
+ value: l,
389
+ index: o,
390
+ properties: i,
391
+ renderExpandLink: v,
392
+ clickableKeyRef: C,
393
+ clickableValRef: S,
394
+ onFocus: function e() {
395
+ y(C, S);
1075
396
  }
1076
- }
1077
- function ye(e) {
1078
- if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
1079
- }
1080
- function me(e) {
1081
- if (Array.isArray(e)) return be(e);
1082
- }
1083
- function be(e, n) {
1084
- (null == n || n > e.length) && (n = e.length);
1085
- for (var r = 0, t = Array(n); r < n; r++) {
1086
- t[r] = e[r];
397
+ });
398
+ }
399
+ function he(e) {
400
+ var n = e.baseId, a = e.renderValue, o = e.obj;
401
+ var l = (0, r.useRef)(null);
402
+ var i = a({
403
+ value: o,
404
+ clickValueRef: l
405
+ }), u = i.representation;
406
+
407
+ return t().createElement(f().Item, {
408
+ id: "".concat(n, "-0"),
409
+ "data-test-path": ".",
410
+ content: u
411
+ });
412
+ }
413
+ function ge(e) {
414
+ var n = e.baseId, r = e.defaultOpen, a = r === void 0 ? false : r, l = e.defaultExpanded, i = l === void 0 ? false : l, u = e.expandChildrenOnShiftKey, c = u === void 0 ? false : u, d = e.indent, s = d === void 0 ? 4 : d, f = e.indentLevel, p = f === void 0 ? 1 : f, v = e.obj, y = e.onClickKey, b = e.onClickValue, m = e.overflow, h = m === void 0 ? "scroll" : m, S = e.path, x = S === void 0 ? [] : S, w = e.shift, E = e.updateShift;
415
+ var j = g()(Array(p), A()(" ", s));
416
+ var R;
417
+ var _;
418
+ var K = function e() {
419
+ if (i && w == null) {
420
+ return true;
421
+ }
422
+ if (c) {
423
+ return !!w;
424
+ }
425
+ return a;
426
+ };
427
+ var N = function e(n) {
428
+ if (c && E != null) {
429
+ E(n.shiftKey);
1087
430
  }
1088
- return t;
1089
- }
1090
- function he(r) {
1091
- var t = r.id, o = r.childKey, a = r.index, i = r.value, l = r.properties, u = r.propertyDataPath, c = r.obj, f = r.renderValue, d = r.renderKey, s = r.getInitialOpenState, v = r.indentArray, p = r.renderExpandLink, y = r.onFocus;
1092
- var m = (0, e.useRef)(null);
1093
- var b = (0, e.useRef)(null);
1094
- var h = f({
1095
- key: o,
1096
- value: i,
1097
- clickValueRef: m
1098
- }), g = h.representation, S = h.clickableValRef;
1099
- var w = !O()(c) ? d(o, b) : {
1100
- propertyElement: undefined,
1101
- clickableKeyRef: undefined
1102
- }, I = w.propertyElement, x = w.clickableKeyRef;
1103
- var j = C()(i) && !k()(i) || O()(i) && i.length > 0;
1104
-
1105
- return n().createElement(ce, {
1106
- id: t,
1107
- propertyDataPath: u,
1108
- propertyElement: I,
1109
- hasChildren: j,
1110
- initialOpenState: s(),
1111
- representation: g,
1112
- indentArray: v,
1113
- value: i,
1114
- index: a,
1115
- properties: l,
1116
- renderExpandLink: p,
1117
- clickableKeyRef: x,
1118
- clickableValRef: S,
1119
- onFocus: function e() {
1120
- y(x, S);
1121
- }
431
+ };
432
+ var V = function e(n, r) {
433
+ var t, a;
434
+ // When rendering a single value key is not present, here we prevent `[undefined]` in path
435
+ var o = r !== undefined ? [].concat(se(x), [ r ]) : se(x);
436
+ var l = ".".concat(o.join("."));
437
+ (t = _) === null || t === void 0 ? void 0 : (a = t.current) === null || a === void 0 ? void 0 : a.focus();
438
+ y === null || y === void 0 ? void 0 : y(n, {
439
+ key: l,
440
+ keyPath: o
1122
441
  });
1123
- }
1124
- function ge(r) {
1125
- var t = r.baseId, o = r.renderValue, a = r.obj;
1126
- var i = (0, e.useRef)(null);
1127
- var l = o({
1128
- value: a,
1129
- clickValueRef: i
1130
- }), u = l.representation;
1131
-
1132
- return n().createElement(fe["default"].Item, {
1133
- id: "".concat(t, "-0"),
1134
- "data-test-path": ".",
1135
- content: u
442
+ };
443
+ var q = function e(n, r) {
444
+ var t, a;
445
+ // When rendering a single value key is not present, here we prevent `[undefined]` in path
446
+ var o = r !== undefined ? [].concat(se(x), [ r ]) : se(x);
447
+ var l = ".".concat(o.join("."));
448
+ (t = R) === null || t === void 0 ? void 0 : (a = t.current) === null || a === void 0 ? void 0 : a.focus();
449
+ b === null || b === void 0 ? void 0 : b(n, {
450
+ key: l,
451
+ keyPath: o,
452
+ value: n.target.textContent
1136
453
  });
1137
- }
1138
- function Se(e) {
1139
- var r = e.baseId, t = e.defaultOpen, o = t === void 0 ? false : t, i = e.defaultExpanded, l = i === void 0 ? false : i, u = e.expandChildrenOnShiftKey, c = u === void 0 ? false : u, f = e.indent, d = f === void 0 ? 4 : f, s = e.indentLevel, v = s === void 0 ? 1 : s, p = e.obj, y = e.onClickKey, m = e.onClickValue, b = e.overflow, h = b === void 0 ? "scroll" : b, S = e.path, w = S === void 0 ? [] : S, I = e.shift, j = e.updateShift;
1140
- var E = g()(Array(v), P()(" ", d));
1141
- var A;
1142
- var _;
1143
- var K = function e() {
1144
- if (l && I == null) {
1145
- return true;
1146
- }
1147
- if (c) {
1148
- return !!I;
1149
- }
1150
- return o;
1151
- };
1152
- var D = function e(n) {
1153
- if (c && j != null) {
1154
- j(n.shiftKey);
1155
- }
1156
- };
1157
- var N = function e(n, r) {
1158
- var t, o;
1159
- // When rendering a single value key is not present, here we prevent `[undefined]` in path
1160
- var a = r !== undefined ? [].concat(se(w), [ r ]) : se(w);
1161
- var i = ".".concat(a.join("."));
1162
- (t = _) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
1163
- y === null || y === void 0 ? void 0 : y(n, {
1164
- key: i,
1165
- keyPath: a
1166
- });
1167
- };
1168
- var V = function e(n, r) {
1169
- var t, o;
1170
- // When rendering a single value key is not present, here we prevent `[undefined]` in path
1171
- var a = r !== undefined ? [].concat(se(w), [ r ]) : se(w);
1172
- var i = ".".concat(a.join("."));
1173
- (t = A) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
1174
- m === null || m === void 0 ? void 0 : m(n, {
1175
- key: i,
1176
- keyPath: a,
1177
- value: n.target.textContent
1178
- });
1179
- };
1180
- var L = function e(n, r) {
1181
- var t, o;
1182
- var a = n.key;
1183
- if (a === "ArrowLeft" && y && ((t = _) === null || t === void 0 ? void 0 : t.current) && !r) {
1184
- var i;
1185
- n.stopPropagation();
1186
- (i = _.current) === null || i === void 0 ? void 0 : i.focus();
1187
- }
1188
- if (a === "ArrowRight" && m && ((o = A) === null || o === void 0 ? void 0 : o.current) && r) {
1189
- var l;
1190
- n.stopPropagation();
1191
- (l = A.current) === null || l === void 0 ? void 0 : l.focus();
1192
- }
1193
- };
1194
- var q = function e(r) {
1195
- var t = r.onToggleExpansion, o = r.open, a = r.withTooltip, i = r.expandLinkRef;
1196
- var l = o ? "[-]" : "[+]";
1197
- var u = o ? (0, R._)("Collapse all") : (0, R._)("Shift click to expand all");
1198
- var f = n().createElement(Q, {
1199
- appearance: "subtle",
1200
- elementRef: i,
1201
- tabIndex: -1,
1202
- onClick: function e(n) {
1203
- D(n);
1204
- t === null || t === void 0 ? void 0 : t(n);
1205
- },
1206
- "aria-expanded": o,
1207
- "data-test": "toggle"
1208
- }, l);
1209
- if (c && a) {
1210
- return {
1211
- expandLink: n().createElement(Y, {
1212
- contentRelationship: "description",
1213
- openDelay: "secondary",
1214
- defaultPlacement: "above",
1215
- content: (0, R._)(u)
1216
- }, f),
1217
- expandLinkRef: i
1218
- };
1219
- }
454
+ };
455
+ var L = function e(n, r) {
456
+ var t, a;
457
+ var o = n.key;
458
+ if (o === "ArrowLeft" && y && ((t = _) === null || t === void 0 ? void 0 : t.current) && !r) {
459
+ var l;
460
+ n.stopPropagation();
461
+ (l = _.current) === null || l === void 0 ? void 0 : l.focus();
462
+ }
463
+ if (o === "ArrowRight" && b && ((a = R) === null || a === void 0 ? void 0 : a.current) && r) {
464
+ var i;
465
+ n.stopPropagation();
466
+ (i = R.current) === null || i === void 0 ? void 0 : i.focus();
467
+ }
468
+ };
469
+ var D = function e(n) {
470
+ var r = n.onToggleExpansion, a = n.open, o = n.withTooltip, l = n.expandLinkRef;
471
+ var i = a ? "[-]" : "[+]";
472
+ var u = a ? (0, P._)("Collapse all") : (0, P._)("Shift click to expand all");
473
+ var d = t().createElement(Q, {
474
+ appearance: "subtle",
475
+ elementRef: l,
476
+ tabIndex: -1,
477
+ onClick: function e(n) {
478
+ N(n);
479
+ r === null || r === void 0 ? void 0 : r(n);
480
+ },
481
+ "aria-expanded": a,
482
+ "data-test": "toggle"
483
+ }, i);
484
+ if (c && o) {
1220
485
  return {
1221
- expandLink: f,
1222
- expandLinkRef: i
486
+ expandLink: t().createElement(Y, {
487
+ contentRelationship: "description",
488
+ openDelay: "secondary",
489
+ defaultPlacement: "above",
490
+ content: (0, P._)(u)
491
+ }, d),
492
+ expandLinkRef: l
1223
493
  };
494
+ }
495
+ return {
496
+ expandLink: d,
497
+ expandLinkRef: l
1224
498
  };
1225
- var F = function e(t) {
1226
- var o = t.value, i = t.key, u = t.clickValueRef;
1227
- var f;
1228
- if (!C()(o)) {
1229
- if (typeof o === "string") {
1230
- f = '"'.concat(o, '"');
1231
- } else if (typeof o === "boolean") {
1232
- f = o.toString();
1233
- } else if (o === null) {
1234
- f = "null";
1235
- } else {
1236
- f = o;
1237
- }
1238
- } else if (k()(o)) {
1239
- // isObject is true for arrays
1240
- f = O()(o) ? "[]" : "{}";
499
+ };
500
+ var F = function e(r) {
501
+ var a = r.value, l = r.key, u = r.clickValueRef;
502
+ var d;
503
+ if (!I()(a)) {
504
+ if (typeof a === "string") {
505
+ d = '"'.concat(a, '"');
506
+ } else if (typeof a === "boolean") {
507
+ d = a.toString();
508
+ } else if (a === null) {
509
+ d = "null";
1241
510
  } else {
1242
- f = Se({
1243
- baseId: r,
1244
- defaultOpen: l === true,
1245
- defaultExpanded: l,
1246
- expandChildrenOnShiftKey: c,
1247
- onClickKey: y,
1248
- onClickValue: m,
1249
- overflow: h,
1250
- obj: o,
1251
- path: i !== undefined ? [].concat(se(w), [ i ]) : se(w),
1252
- indentLevel: v + 1,
1253
- shift: I,
1254
- updateShift: j
1255
- });
1256
- }
1257
- if (a()(f) || x()(f)) {
1258
- var d = o === null ? "null" : // TS: bigint, function, symbol are prevented by JSONElement type
1259
- de(o);
1260
- if (m) {
1261
- return {
1262
- representation: n().createElement(G, {
1263
- elementRef: u,
1264
- valueType: d,
1265
- overflowType: h,
1266
- onClick: function e(n) {
1267
- A = u;
1268
- V(n, i);
1269
- },
1270
- onKeyDown: function e(n) {
1271
- L(n, false);
1272
- },
1273
- tabIndex: -1
1274
- }, f),
1275
- clickableValRef: u
1276
- };
1277
- }
1278
- return {
1279
- representation: n().createElement(X, {
1280
- valueType: d,
1281
- overflowType: h
1282
- }, f)
1283
- };
1284
- }
1285
- return {
1286
- representation: f
1287
- };
1288
- };
1289
- var M = function e(r, t) {
1290
- if (y) {
511
+ d = a;
512
+ }
513
+ } else if (O()(a)) {
514
+ // isObject is true for arrays
515
+ d = k()(a) ? "[]" : "{}";
516
+ } else {
517
+ d = ge({
518
+ baseId: n,
519
+ defaultOpen: i === true,
520
+ defaultExpanded: i,
521
+ expandChildrenOnShiftKey: c,
522
+ onClickKey: y,
523
+ onClickValue: b,
524
+ overflow: h,
525
+ obj: a,
526
+ path: l !== undefined ? [].concat(se(x), [ l ]) : se(x),
527
+ indentLevel: p + 1,
528
+ shift: w,
529
+ updateShift: E
530
+ });
531
+ }
532
+ if (o()(d) || C()(d)) {
533
+ var s = a === null ? "null" : // TS: bigint, function, symbol are prevented by JSONElement type
534
+ de(a);
535
+ if (b) {
1291
536
  return {
1292
- propertyElement: n().createElement(n().Fragment, null, n().createElement(z, {
1293
- elementRef: t,
1294
- tabIndex: -1,
537
+ representation: t().createElement(W, {
538
+ elementRef: u,
539
+ valueType: s,
540
+ overflowType: h,
1295
541
  onClick: function e(n) {
1296
- _ = t;
1297
- N(n, r);
542
+ R = u;
543
+ q(n, l);
1298
544
  },
1299
545
  onKeyDown: function e(n) {
1300
- L(n, true);
1301
- }
1302
- }, r), ":", " "),
1303
- clickableKeyRef: t
546
+ L(n, false);
547
+ },
548
+ tabIndex: -1
549
+ }, d),
550
+ clickableValRef: u
1304
551
  };
1305
552
  }
1306
553
  return {
1307
- propertyElement: n().createElement(n().Fragment, null, n().createElement(W, null, r), ":", " ")
554
+ representation: t().createElement($, {
555
+ valueType: s,
556
+ overflowType: h
557
+ }, d)
1308
558
  };
559
+ }
560
+ return {
561
+ representation: d
1309
562
  };
1310
- if (C()(p) && !k()(p) || O()(p) && p.length > 0) {
1311
- var $ = T()(p).map((function(e, t, o) {
1312
- var a = p[e];
1313
- // TS: should be safe based on (recursive) JSONElement type
1314
- var i = O()(p) ? parseInt(e, 10) : e;
1315
- var l = w.length === 0 ? ".".concat(i) : ".".concat(w.join("."), ".").concat(i);
1316
-
1317
- return n().createElement(he, {
1318
- id: "".concat(r, "-").concat(l),
1319
- key: l,
1320
- propertyDataPath: l,
1321
- childKey: i,
1322
- index: t,
1323
- value: a,
1324
- properties: o,
1325
- obj: p,
1326
- renderValue: F,
1327
- renderKey: M,
1328
- getInitialOpenState: K,
1329
- indentArray: E,
1330
- renderExpandLink: q,
1331
- onFocus: function e(n, r) {
1332
- _ = n;
1333
- A = r;
563
+ };
564
+ var J = function e(n, r) {
565
+ if (y) {
566
+ return {
567
+ propertyElement: t().createElement(t().Fragment, null, t().createElement(z, {
568
+ elementRef: r,
569
+ tabIndex: -1,
570
+ onClick: function e(t) {
571
+ _ = r;
572
+ V(t, n);
573
+ },
574
+ onKeyDown: function e(n) {
575
+ L(n, true);
1334
576
  }
1335
- });
1336
- }));
1337
- if (w.length === 0) {
1338
- var J = C()(p) && !k()(p) || O()(p) && p.length > 0;
1339
-
1340
- return n().createElement(ce, {
1341
- id: "".concat(r, "-root"),
1342
- isRoot: true,
1343
- propertyDataPath: ".",
1344
- key: ".",
1345
- hasChildren: J,
1346
- initialOpenState: o || l,
1347
- value: p,
1348
- index: 0,
1349
- renderExpandLink: q,
1350
- representation: $
1351
- });
1352
- }
1353
- return $;
577
+ }, n), ":", " "),
578
+ clickableKeyRef: r
579
+ };
1354
580
  }
1355
- // edge case: a single number/string/boolean being rendered (still valid JSON)
1356
-
1357
- return n().createElement(ge, {
1358
- baseId: r,
1359
- obj: p,
1360
- renderValue: F
1361
- });
1362
- }
1363
- // CONCATENATED MODULE: ./src/JSONTree/JSONTree.tsx
1364
- function Oe() {
1365
- return Oe = Object.assign ? Object.assign.bind() : function(e) {
1366
- for (var n = 1; n < arguments.length; n++) {
1367
- var r = arguments[n];
1368
- for (var t in r) {
1369
- ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]);
581
+ return {
582
+ propertyElement: t().createElement(t().Fragment, null, t().createElement(H, null, n), ":", " ")
583
+ };
584
+ };
585
+ if (I()(v) && !O()(v) || k()(v) && v.length > 0) {
586
+ var M = T()(v).map((function(e, r, a) {
587
+ var o = v[e];
588
+ // TS: should be safe based on (recursive) JSONElement type
589
+ var l = k()(v) ? parseInt(e, 10) : e;
590
+ var i = x.length === 0 ? ".".concat(l) : ".".concat(x.join("."), ".").concat(l);
591
+
592
+ return t().createElement(me, {
593
+ id: "".concat(n, "-").concat(i),
594
+ key: i,
595
+ propertyDataPath: i,
596
+ childKey: l,
597
+ index: r,
598
+ value: o,
599
+ properties: a,
600
+ obj: v,
601
+ renderValue: F,
602
+ renderKey: J,
603
+ getInitialOpenState: K,
604
+ indentArray: j,
605
+ renderExpandLink: D,
606
+ onFocus: function e(n, r) {
607
+ _ = n;
608
+ R = r;
1370
609
  }
1371
- }
1372
- return e;
1373
- }, Oe.apply(null, arguments);
1374
- }
1375
- function we(e, n) {
1376
- return Ce(e) || je(e, n) || Ie(e, n) || ke();
1377
- }
1378
- function ke() {
1379
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1380
- }
1381
- function Ie(e, n) {
1382
- if (e) {
1383
- if ("string" == typeof e) return xe(e, n);
1384
- var r = {}.toString.call(e).slice(8, -1);
1385
- return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? xe(e, n) : void 0;
610
+ });
611
+ }));
612
+ if (x.length === 0) {
613
+ var B = I()(v) && !O()(v) || k()(v) && v.length > 0;
614
+
615
+ return t().createElement(ce, {
616
+ id: "".concat(n, "-root"),
617
+ isRoot: true,
618
+ propertyDataPath: ".",
619
+ key: ".",
620
+ hasChildren: B,
621
+ initialOpenState: a || i,
622
+ value: v,
623
+ index: 0,
624
+ renderExpandLink: D,
625
+ representation: M
626
+ });
1386
627
  }
628
+ return M;
1387
629
  }
1388
- function xe(e, n) {
1389
- (null == n || n > e.length) && (n = e.length);
1390
- for (var r = 0, t = Array(n); r < n; r++) {
1391
- t[r] = e[r];
1392
- }
1393
- return t;
630
+ // edge case: a single number/string/boolean being rendered (still valid JSON)
631
+
632
+ return t().createElement(he, {
633
+ baseId: n,
634
+ obj: v,
635
+ renderValue: F
636
+ });
637
+ }
638
+ // CONCATENATED MODULE: ./src/JSONTree/JSONTree.tsx
639
+ function Se() {
640
+ return Se = Object.assign ? Object.assign.bind() : function(e) {
641
+ for (var n = 1; n < arguments.length; n++) {
642
+ var r = arguments[n];
643
+ for (var t in r) {
644
+ ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]);
645
+ }
646
+ }
647
+ return e;
648
+ }, Se.apply(null, arguments);
649
+ }
650
+ function ke(e, n) {
651
+ return Ee(e) || Ce(e, n) || Oe(e, n) || xe();
652
+ }
653
+ function xe() {
654
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
655
+ }
656
+ function Oe(e, n) {
657
+ if (e) {
658
+ if ("string" == typeof e) return we(e, n);
659
+ var r = {}.toString.call(e).slice(8, -1);
660
+ return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? we(e, n) : void 0;
661
+ }
662
+ }
663
+ function we(e, n) {
664
+ (null == n || n > e.length) && (n = e.length);
665
+ for (var r = 0, t = Array(n); r < n; r++) {
666
+ t[r] = e[r];
1394
667
  }
1395
- function je(e, n) {
1396
- var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
1397
- if (null != r) {
1398
- var t, o, a, i, l = [], u = !0, c = !1;
668
+ return t;
669
+ }
670
+ function Ce(e, n) {
671
+ var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
672
+ if (null != r) {
673
+ var t, a, o, l, i = [], u = !0, c = !1;
674
+ try {
675
+ if (o = (r = r.call(e)).next, 0 === n) {
676
+ if (Object(r) !== r) return;
677
+ u = !1;
678
+ } else for (;!(u = (t = o.call(r)).done) && (i.push(t.value), i.length !== n); u = !0) {
679
+ }
680
+ } catch (e) {
681
+ c = !0, a = e;
682
+ } finally {
1399
683
  try {
1400
- if (a = (r = r.call(e)).next, 0 === n) {
1401
- if (Object(r) !== r) return;
1402
- u = !1;
1403
- } else for (;!(u = (t = a.call(r)).done) && (l.push(t.value), l.length !== n); u = !0) {
1404
- }
1405
- } catch (e) {
1406
- c = !0, o = e;
684
+ if (!u && null != r["return"] && (l = r["return"](), Object(l) !== l)) return;
1407
685
  } finally {
1408
- try {
1409
- if (!u && null != r["return"] && (i = r["return"](), Object(i) !== i)) return;
1410
- } finally {
1411
- if (c) throw o;
1412
- }
686
+ if (c) throw a;
1413
687
  }
1414
- return l;
1415
688
  }
689
+ return i;
1416
690
  }
1417
- function Ce(e) {
1418
- if (Array.isArray(e)) return e;
1419
- }
1420
- function Ee(e, n) {
1421
- if (null == e) return {};
1422
- var r, t, o = Te(e, n);
1423
- if (Object.getOwnPropertySymbols) {
1424
- var a = Object.getOwnPropertySymbols(e);
1425
- for (t = 0; t < a.length; t++) {
1426
- r = a[t], -1 === n.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (o[r] = e[r]);
1427
- }
691
+ }
692
+ function Ee(e) {
693
+ if (Array.isArray(e)) return e;
694
+ }
695
+ function Ie(e, n) {
696
+ if (null == e) return {};
697
+ var r, t, a = je(e, n);
698
+ if (Object.getOwnPropertySymbols) {
699
+ var o = Object.getOwnPropertySymbols(e);
700
+ for (t = 0; t < o.length; t++) {
701
+ r = o[t], -1 === n.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
1428
702
  }
1429
- return o;
1430
703
  }
1431
- function Te(e, n) {
1432
- if (null == e) return {};
1433
- var r = {};
1434
- for (var t in e) {
1435
- if ({}.hasOwnProperty.call(e, t)) {
1436
- if (-1 !== n.indexOf(t)) continue;
1437
- r[t] = e[t];
1438
- }
704
+ return a;
705
+ }
706
+ function je(e, n) {
707
+ if (null == e) return {};
708
+ var r = {};
709
+ for (var t in e) {
710
+ if ({}.hasOwnProperty.call(e, t)) {
711
+ if (-1 !== n.indexOf(t)) continue;
712
+ r[t] = e[t];
1439
713
  }
1440
- return r;
1441
714
  }
1442
- /** @public */
1443
- /** @public */
1444
- /** @public */ var Ae = {
1445
- elementRef: l().oneOfType([ l().func, l().object ]),
1446
- defaultExpanded: l().bool,
1447
- indent: l().number,
1448
- json: l().oneOfType([ l().string, l().object, l().array, l().number, l().bool ]).isRequired,
1449
- onClickKey: l().func,
1450
- onClickValue: l().func,
1451
- overflow: l().oneOf([ "wrap", "scroll" ]),
1452
- expandChildrenOnShiftKey: l().bool
1453
- };
1454
- /**
715
+ return r;
716
+ }
717
+ /** @public */
718
+ /** @public */
719
+ /** @public */ var Te = {
720
+ elementRef: i().oneOfType([ i().func, i().object ]),
721
+ defaultExpanded: i().bool,
722
+ indent: i().number,
723
+ json: i().oneOfType([ i().string, i().object, i().array, i().number, i().bool ]).isRequired,
724
+ onClickKey: i().func,
725
+ onClickValue: i().func,
726
+ overflow: i().oneOf([ "wrap", "scroll" ]),
727
+ expandChildrenOnShiftKey: i().bool
728
+ };
729
+ /**
1455
730
  * Used to visualize a JSON string.
1456
- */ function Pe(r) {
1457
- var t = r.elementRef, o = r.defaultExpanded, i = o === void 0 ? false : o, l = r.indent, c = l === void 0 ? 4 : l, f = r.json, d = r.onClickKey, s = r.onClickValue, v = r.overflow, p = v === void 0 ? "scroll" : v, h = r.expandChildrenOnShiftKey, g = h === void 0 ? true : h, S = Ee(r, [ "elementRef", "defaultExpanded", "indent", "json", "onClickKey", "onClickValue", "overflow", "expandChildrenOnShiftKey" ]);
1458
- // @docs-props-type JSONTreePropsBase
1459
- var O = (0, e.useMemo)((function() {
1460
- return S.id || (0, u.createDOMID)("json-tree");
1461
- }), [ S.id ]);
1462
- var w = a()(f) ? JSON.parse(f) : f;
1463
- var k = p === "wrap" ? b : y;
1464
- var I = (0, e.useState)(undefined), x = we(I, 2), j = x[0], C = x[1];
1465
- var E = (0, e.useCallback)((function(e) {
1466
- C(e);
1467
- }), []);
1468
- var T = (0, e.useMemo)((function() {
1469
- return Se({
1470
- baseId: O,
1471
- defaultOpen: true,
1472
- defaultExpanded: i,
1473
- expandChildrenOnShiftKey: g,
1474
- indent: c,
1475
- obj: w,
1476
- onClickKey: d,
1477
- onClickValue: s,
1478
- overflow: p,
1479
- shift: j,
1480
- updateShift: E
1481
- });
1482
- }), [ O, i, g, c, w, d, s, p, j, E ]);
1483
-
1484
- return n().createElement(k, Oe({
1485
- "data-language": "language-json",
1486
- "data-test": "json-tree",
1487
- ref: t,
1488
- role: "tree"
1489
- }, S), n().createElement(m, {
1490
- defaultIndent: false
1491
- }, T));
1492
- }
1493
- Pe.propTypes = Ae;
1494
- /* harmony default export */ const Re = Pe;
1495
- }) // CONCATENATED MODULE: ./src/JSONTree/index.ts
1496
- ();
1497
- module.exports = t;
731
+ */ function Re(e) {
732
+ var n = e.elementRef, a = e.defaultExpanded, l = a === void 0 ? false : a, i = e.indent, c = i === void 0 ? 4 : i, d = e.json, s = e.onClickKey, f = e.onClickValue, p = e.overflow, v = p === void 0 ? "scroll" : p, h = e.expandChildrenOnShiftKey, g = h === void 0 ? true : h, S = Ie(e, [ "elementRef", "defaultExpanded", "indent", "json", "onClickKey", "onClickValue", "overflow", "expandChildrenOnShiftKey" ]);
733
+ // @docs-props-type JSONTreePropsBase
734
+ var k = (0, r.useMemo)((function() {
735
+ return S.id || (0, u.createDOMID)("json-tree");
736
+ }), [ S.id ]);
737
+ var x = o()(d) ? JSON.parse(d) : d;
738
+ var O = v === "wrap" ? m : y;
739
+ var w = (0, r.useState)(undefined), C = ke(w, 2), E = C[0], I = C[1];
740
+ var j = (0, r.useCallback)((function(e) {
741
+ I(e);
742
+ }), []);
743
+ var T = (0, r.useMemo)((function() {
744
+ return ge({
745
+ baseId: k,
746
+ defaultOpen: true,
747
+ defaultExpanded: l,
748
+ expandChildrenOnShiftKey: g,
749
+ indent: c,
750
+ obj: x,
751
+ onClickKey: s,
752
+ onClickValue: f,
753
+ overflow: v,
754
+ shift: E,
755
+ updateShift: j
756
+ });
757
+ }), [ k, l, g, c, x, s, f, v, E, j ]);
758
+
759
+ return t().createElement(O, Se({
760
+ "data-language": "language-json",
761
+ "data-test": "json-tree",
762
+ ref: n,
763
+ role: "tree"
764
+ }, S), t().createElement(b, {
765
+ defaultIndent: false
766
+ }, T));
767
+ }
768
+ Re.propTypes = Te;
769
+ /* harmony default export */ const Ae = Re;
770
+ // CONCATENATED MODULE: ./src/JSONTree/index.ts
771
+ module.exports = n;
1498
772
  /******/})();