@splunk/react-ui 4.27.0 → 4.28.1

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