@splunk/react-ui 4.35.0 → 4.37.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.
package/JSONTree.js CHANGED
@@ -60,7 +60,7 @@
60
60
  return b.apply(this, arguments);
61
61
  }
62
62
  function m(e, r) {
63
- return k(e) || w(e, r) || g(e, r) || h();
63
+ return w(e) || k(e, r) || g(e, r) || h();
64
64
  }
65
65
  function h() {
66
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.");
@@ -80,7 +80,7 @@
80
80
  }
81
81
  return t;
82
82
  }
83
- function w(e, r) {
83
+ function k(e, r) {
84
84
  if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
85
85
  var n = [];
86
86
  var t = true;
@@ -103,7 +103,7 @@
103
103
  }
104
104
  return n;
105
105
  }
106
- function k(e) {
106
+ function w(e) {
107
107
  if (Array.isArray(e)) return e;
108
108
  }
109
109
  function O(e, r) {
@@ -133,7 +133,7 @@
133
133
  }
134
134
  return n;
135
135
  }
136
- var C = {
136
+ var I = {
137
137
  id: i().string,
138
138
  children: i().node,
139
139
  content: i().node,
@@ -146,19 +146,19 @@
146
146
  open: i().bool,
147
147
  toggle: i().node
148
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;
149
+ function C(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, k = O(e, [ "id", "children", "content", "customIndent", "endAdornment", "labelledBy", "onFocus", "onKeyDown", "onToggle", "open", "toggle" ]);
151
+ var w = (0, t.useContext)(c), x = w.defaultIndent, I = x === void 0 ? true : x, C = w.onItemKeyDown, j = w.onItemClick, E = w.removeNode, A = w.setNode, T = w.itemPaths, P = w.focusedItemId;
152
152
  var R = (0, t.useState)(g), K = m(R, 2), _ = K[0], N = K[1];
153
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];
154
+ var D = (0, t.useState)((T === null || T === void 0 ? void 0 : T.get("".concat(r))) === "0" ? 0 : -1), V = m(D, 2), L = V[0], q = V[1];
155
155
  var F = (0, t.useRef)(null);
156
156
  var M = (0, t.useRef)(null);
157
157
  var $ = t.Children.toArray(n).filter(t.isValidElement);
158
158
  $.forEach((function(e, n) {
159
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));
160
+ if (_ && A) {
161
+ A("".concat(e.props.id), "".concat(T === null || T === void 0 ? void 0 : T.get("".concat(r)), "-").concat(n));
162
162
  } else if (E) {
163
163
  E(e.props.id);
164
164
  }
@@ -178,8 +178,8 @@
178
178
  f === null || f === void 0 ? void 0 : f(r);
179
179
  };
180
180
  var H = function e() {
181
- if ((A === null || A === void 0 ? void 0 : A.get("".concat(r))) === "0") {
182
- V(0);
181
+ if ((T === null || T === void 0 ? void 0 : T.get("".concat(r))) === "0") {
182
+ q(0);
183
183
  }
184
184
  };
185
185
  (0, t.useEffect)((function() {
@@ -195,10 +195,10 @@
195
195
  n.stopPropagation();
196
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
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);
198
+ if (n.shiftKey && n.key === "Tab" && (T === null || T === void 0 ? void 0 : T.get("".concat(r))) === "0") {
199
+ q(-1);
200
200
  }
201
- I === null || I === void 0 ? void 0 : I(n, r, _, $, J);
201
+ C === null || C === void 0 ? void 0 : C(n, r, _, $, J);
202
202
  d === null || d === void 0 ? void 0 : d(n);
203
203
  };
204
204
  var W = function e() {
@@ -217,9 +217,9 @@
217
217
  });
218
218
  };
219
219
 
220
- return o().createElement("li", b({}, w, {
220
+ return o().createElement("li", b({}, k, {
221
221
  ref: M,
222
- tabIndex: q,
222
+ tabIndex: L,
223
223
  onBlur: H,
224
224
  onFocus: B,
225
225
  onKeyDown: z,
@@ -233,19 +233,19 @@
233
233
  onClick: U
234
234
  }, o().createElement(s, null, a), W(), !_ && l), _ && o().createElement(o().Fragment, null, o().createElement(y, {
235
235
  role: "group",
236
- $defaultIndent: C
236
+ $defaultIndent: I
237
237
  }, n), l));
238
238
  }
239
- I.propTypes = C;
240
- /* harmony default export */ const j = I;
239
+ C.propTypes = I;
240
+ /* harmony default export */ const j = C;
241
241
  // CONCATENATED MODULE: ./src/Tree/treeUtils.ts
242
242
  function E(e, r) {
243
- return K(e) || R(e, r) || A(e, r) || T();
243
+ return K(e) || R(e, r) || T(e, r) || A();
244
244
  }
245
- function T() {
245
+ function A() {
246
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
247
  }
248
- function A(e, r) {
248
+ function T(e, r) {
249
249
  if (!e) return;
250
250
  if (typeof e === "string") return P(e, r);
251
251
  var n = Object.prototype.toString.call(e).slice(8, -1);
@@ -309,14 +309,14 @@
309
309
  }
310
310
  /**
311
311
  * A helper function to get the last index number of an item path string
312
- */ function L(e) {
312
+ */ function V(e) {
313
313
  var r = e.split("-").pop();
314
314
  if (!r) {
315
315
  return 0;
316
316
  }
317
317
  return parseInt(r, 10) || 0;
318
318
  }
319
- function q(e, r) {
319
+ function L(e, r) {
320
320
  var n = e.get(r);
321
321
  if (!n) {
322
322
  return r;
@@ -326,20 +326,20 @@
326
326
  }
327
327
  /**
328
328
  * A helper function for getNextTreeItem
329
- */ function V(e, r) {
329
+ */ function q(e, r) {
330
330
  var n = N(r);
331
331
  if (!n) {
332
332
  return _(e, r);
333
333
  }
334
334
  // get next node in the parent level
335
- var t = L(n);
335
+ var t = V(n);
336
336
  var o = D(n, t);
337
337
  var a = _(e, o);
338
338
  if (a) {
339
339
  return a;
340
340
  }
341
341
  // continue getting parents until find next node or reach root
342
- return V(e, o);
342
+ return q(e, o);
343
343
  }
344
344
  function F(e, r) {
345
345
  var n = e.get(r);
@@ -352,14 +352,14 @@
352
352
  return t;
353
353
  }
354
354
  // case where next tree item is the next node in the same level
355
- var o = L(n);
355
+ var o = V(n);
356
356
  var a = D(n, o);
357
357
  var i = _(e, a);
358
358
  if (i) {
359
359
  return i;
360
360
  }
361
361
  // case where next tree item is a higher level or does not exist
362
- return V(e, n) || r;
362
+ return q(e, n) || r;
363
363
  }
364
364
  /**
365
365
  * A helper function for getPrevTreeItem
@@ -372,7 +372,7 @@
372
372
  var o = "".concat(r, "-0");
373
373
  // get the last child in current node, and continue to find its children recursively
374
374
  while (t) {
375
- var a = L(o);
375
+ var a = V(o);
376
376
  var i = D(o, a);
377
377
  t = _(e, i);
378
378
  if (t) {
@@ -386,10 +386,10 @@
386
386
  if (!n) {
387
387
  return r;
388
388
  }
389
- var t = L(n);
389
+ var t = V(n);
390
390
  // case where current is first child of parent or root item
391
391
  if (t === 0) {
392
- return q(e, r);
392
+ return L(e, r);
393
393
  }
394
394
  // case where previous tree item is or is a child of previous node in same level
395
395
  var o = n.replace(/[^-]+$/, "".concat(t - 1));
@@ -404,7 +404,7 @@
404
404
  var t = r;
405
405
  // find last child in current node
406
406
  while (n) {
407
- var o = L(t);
407
+ var o = V(t);
408
408
  n = _(e, D(t, o));
409
409
  if (n) {
410
410
  t = D(t, o);
@@ -535,7 +535,7 @@
535
535
  if (t && (o === null || o === void 0 ? void 0 : o.length)) {
536
536
  a(false, r);
537
537
  } else {
538
- v(q(s, n));
538
+ v(L(s, n));
539
539
  }
540
540
  break;
541
541
 
@@ -705,7 +705,7 @@
705
705
  n.r(t);
706
706
  // EXPORTS
707
707
  n.d(t, {
708
- default: () => /* reexport */ ke
708
+ default: () => /* reexport */ xe
709
709
  });
710
710
  // EXTERNAL MODULE: external "react"
711
711
  var e = n(9497);
@@ -744,22 +744,22 @@
744
744
  var g = n.n(h);
745
745
  // CONCATENATED MODULE: external "lodash/isNumber"
746
746
  const S = require("lodash/isNumber");
747
- var w = n.n(S);
747
+ var k = n.n(S);
748
748
  // CONCATENATED MODULE: external "lodash/isObject"
749
- const k = require("lodash/isObject");
750
- var O = n.n(k);
749
+ const w = require("lodash/isObject");
750
+ var O = n.n(w);
751
751
  // CONCATENATED MODULE: external "lodash/keys"
752
752
  const x = require("lodash/keys");
753
- var C = n.n(x);
753
+ var I = n.n(x);
754
754
  // CONCATENATED MODULE: external "lodash/repeat"
755
- const I = require("lodash/repeat");
756
- var j = n.n(I);
755
+ const C = require("lodash/repeat");
756
+ var j = n.n(C);
757
757
  // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
758
758
  const E = require("@splunk/ui-utils/i18n");
759
759
  // EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
760
- var T = n(5295);
760
+ var A = n(5295);
761
761
  // EXTERNAL MODULE: ./src/Tree/index.ts + 6 modules
762
- var A = n(4610);
762
+ var T = n(4610);
763
763
  // CONCATENATED MODULE: ./src/JSONTree/JSONTreeItem.tsx
764
764
  function P() {
765
765
  P = Object.assign || function(e) {
@@ -776,7 +776,7 @@
776
776
  return P.apply(this, arguments);
777
777
  }
778
778
  function R(e, r) {
779
- return L(e) || D(e, r) || _(e, r) || K();
779
+ return V(e) || D(e, r) || _(e, r) || K();
780
780
  }
781
781
  function K() {
782
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.");
@@ -819,12 +819,12 @@
819
819
  }
820
820
  return n;
821
821
  }
822
- function L(e) {
822
+ function V(e) {
823
823
  if (Array.isArray(e)) return e;
824
824
  }
825
- function q(e, r) {
825
+ function L(e, r) {
826
826
  if (e == null) return {};
827
- var n = V(e, r);
827
+ var n = q(e, r);
828
828
  var t, o;
829
829
  if (Object.getOwnPropertySymbols) {
830
830
  var a = Object.getOwnPropertySymbols(e);
@@ -837,7 +837,7 @@
837
837
  }
838
838
  return n;
839
839
  }
840
- function V(e, r) {
840
+ function q(e, r) {
841
841
  if (e == null) return {};
842
842
  var n = {};
843
843
  var t = Object.keys(e);
@@ -864,33 +864,34 @@
864
864
  value: a().oneOfType([ a().string, a().object, a().array, a().number, a().bool ])
865
865
  };
866
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);
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 = L(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], k = g[1];
869
+ var w = function e(r) {
870
+ k(r);
871
871
  };
872
- var O = s ? s({
872
+ var O = (0, e.useRef)(null);
873
+ var x = s ? s({
873
874
  open: S,
874
- withTooltip: true
875
+ withTooltip: true,
876
+ expandLinkRef: O
875
877
  }) : {
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;
878
+ expandLink: undefined
879
+ }, I = x.expandLink;
880
+ var C = (f === null || f === void 0 ? void 0 : f.length) && l + 1 < (f === null || f === void 0 ? void 0 : f.length) ? "," : null;
880
881
 
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)),
882
+ return r().createElement(T["default"].TreeItem, P({
883
+ content: r().createElement(r().Fragment, null, v, a && (m()(y) ? "[" : "{"), !a && r().createElement(r().Fragment, null, p, C)),
883
884
  customIndent: i,
884
885
  "data-test": a ? "node" : null,
885
886
  "data-test-path": d,
886
- endAdornment: a && r().createElement(r().Fragment, null, S && i, m()(y) ? "]" : "}", I),
887
+ endAdornment: a && r().createElement(r().Fragment, null, S && i, m()(y) ? "]" : "}", C),
887
888
  onFocus: function e(r) {
888
889
  c === null || c === void 0 ? void 0 : c(r);
889
890
  // 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
+ 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 === (O === null || O === void 0 ? void 0 : O.current) ? r.relatedTarget : null;
891
892
  if (b.id === "root") {
892
893
  var a;
893
- C === null || C === void 0 ? void 0 : (a = C.current) === null || a === void 0 ? void 0 : a.focus();
894
+ O === null || O === void 0 ? void 0 : (a = O.current) === null || a === void 0 ? void 0 : a.focus();
894
895
  }
895
896
  if (!n) {
896
897
  // if JSONTreeItem contains clickable keys/vals, focus should go there
@@ -905,10 +906,10 @@
905
906
  n.focus();
906
907
  }
907
908
  },
908
- onToggle: k,
909
+ onToggle: w,
909
910
  open: u,
910
911
  tabIndex: 0,
911
- toggle: a ? x : undefined
912
+ toggle: a ? I : undefined
912
913
  }, b), a && p);
913
914
  }
914
915
  M.propTypes = F;
@@ -1028,33 +1029,81 @@
1028
1029
  return t;
1029
1030
  }
1030
1031
  function fe(n) {
1031
- 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;
1032
- var K = y()(Array(s), j()(" ", d));
1033
- var _;
1034
- var N;
1035
- var D = function e() {
1036
- if (i === true) {
1037
- return o;
1032
+ var t = n.id, o = n.childKey, a = n.index, i = n.value, l = n.properties, u = n.propertyDataPath, c = n.obj, f = n.renderValue, d = n.renderKey, v = n.getInitialOpenState, s = n.indentArray, p = n.renderExpandLink, y = n.onFocus;
1033
+ var b = (0, e.useRef)(null);
1034
+ var h = (0, e.useRef)(null);
1035
+ var S = f({
1036
+ key: o,
1037
+ value: i,
1038
+ clickValueRef: b
1039
+ }), k = S.representation, w = S.clickableValRef;
1040
+ var x = !m()(c) ? d(o, h) : {
1041
+ propertyElement: undefined,
1042
+ clickableKeyRef: undefined
1043
+ }, I = x.propertyElement, C = x.clickableKeyRef;
1044
+ var j = O()(i) && !g()(i) || m()(i) && i.length > 0;
1045
+
1046
+ return r().createElement(M, {
1047
+ id: t,
1048
+ propertyDataPath: u,
1049
+ propertyElement: I,
1050
+ hasChildren: j,
1051
+ initialOpenState: v(),
1052
+ representation: k,
1053
+ indentArray: s,
1054
+ value: i,
1055
+ index: a,
1056
+ properties: l,
1057
+ renderExpandLink: p,
1058
+ clickableKeyRef: C,
1059
+ clickableValRef: w,
1060
+ onFocus: function e() {
1061
+ y(C, w);
1062
+ }
1063
+ });
1064
+ }
1065
+ function de(n) {
1066
+ var t = n.renderValue, o = n.obj;
1067
+ var a = (0, e.useRef)(null);
1068
+ var i = t({
1069
+ value: o,
1070
+ clickValueRef: a
1071
+ }), l = i.representation;
1072
+
1073
+ return r().createElement(T["default"].TreeItem, {
1074
+ id: "0",
1075
+ "data-test-path": ".",
1076
+ content: l
1077
+ });
1078
+ }
1079
+ function ve(e) {
1080
+ var n = e.defaultOpen, t = n === void 0 ? false : n, o = e.expandChildren, a = o === void 0 ? false : o, i = e.expandChildrenOnShiftKey, u = i === void 0 ? false : i, c = e.indent, f = c === void 0 ? 4 : c, d = e.indentLevel, v = d === void 0 ? 1 : d, s = e.obj, p = e.onClickKey, b = e.onClickValue, h = e.overflow, S = h === void 0 ? "scroll" : h, w = e.path, x = w === void 0 ? [] : w, C = e.shift, T = e.updateShift;
1081
+ var P = y()(Array(v), j()(" ", f));
1082
+ var R;
1083
+ var K;
1084
+ var _ = function e() {
1085
+ if (a === true) {
1086
+ return t;
1038
1087
  }
1039
- if (i === "withShiftModifier" || c) {
1040
- return !!P;
1088
+ if (a === "withShiftModifier" || u) {
1089
+ return !!C;
1041
1090
  }
1042
1091
  return false;
1043
1092
  };
1044
- var L = function e(r) {
1045
- if (i === "withShiftModifier" || c) {
1046
- if (R != null) {
1047
- R(r.shiftKey);
1093
+ var N = function e(r) {
1094
+ if (a === "withShiftModifier" || u) {
1095
+ if (T != null) {
1096
+ T(r.shiftKey);
1048
1097
  }
1049
1098
  }
1050
1099
  };
1051
- var q = function e(r, n) {
1100
+ var D = function e(r, n) {
1052
1101
  var t, o;
1053
1102
  // When rendering a single value key is not present, here we prevent `[undefined]` in path
1054
- var a = n !== undefined ? [].concat(oe(I), [ n ]) : oe(I);
1103
+ var a = n !== undefined ? [].concat(oe(x), [ n ]) : oe(x);
1055
1104
  var i = ".".concat(a.join("."));
1056
- (t = N) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
1057
- b === null || b === void 0 ? void 0 : b(r, {
1105
+ (t = K) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
1106
+ p === null || p === void 0 ? void 0 : p(r, {
1058
1107
  key: i,
1059
1108
  keyPath: a
1060
1109
  });
@@ -1062,212 +1111,196 @@
1062
1111
  var V = function e(r, n) {
1063
1112
  var t, o;
1064
1113
  // When rendering a single value key is not present, here we prevent `[undefined]` in path
1065
- var a = n !== undefined ? [].concat(oe(I), [ n ]) : oe(I);
1114
+ var a = n !== undefined ? [].concat(oe(x), [ n ]) : oe(x);
1066
1115
  var i = ".".concat(a.join("."));
1067
- (t = _) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
1068
- h === null || h === void 0 ? void 0 : h(r, {
1116
+ (t = R) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
1117
+ b === null || b === void 0 ? void 0 : b(r, {
1069
1118
  key: i,
1070
1119
  keyPath: a,
1071
1120
  value: r.target.textContent
1072
1121
  });
1073
1122
  };
1074
- var F = function e(r, n) {
1123
+ var L = function e(r, n) {
1075
1124
  var t, o;
1076
- var a = (0, T.keycode)(r.nativeEvent);
1077
- if (a === "left" && b && ((t = N) === null || t === void 0 ? void 0 : t.current) && !n) {
1125
+ var a = (0, A.keycode)(r.nativeEvent);
1126
+ if (a === "left" && p && ((t = K) === null || t === void 0 ? void 0 : t.current) && !n) {
1078
1127
  var i;
1079
1128
  r.stopPropagation();
1080
- (i = N.current) === null || i === void 0 ? void 0 : i.focus();
1129
+ (i = K.current) === null || i === void 0 ? void 0 : i.focus();
1081
1130
  }
1082
- if (a === "right" && h && ((o = _) === null || o === void 0 ? void 0 : o.current) && n) {
1131
+ if (a === "right" && b && ((o = R) === null || o === void 0 ? void 0 : o.current) && n) {
1083
1132
  var l;
1084
1133
  r.stopPropagation();
1085
- (l = _.current) === null || l === void 0 ? void 0 : l.focus();
1134
+ (l = R.current) === null || l === void 0 ? void 0 : l.focus();
1086
1135
  }
1087
1136
  };
1088
- var $ = function n(t) {
1089
- var o = t.open, a = t.withTooltip;
1090
- var i = o ? "[-]" : "[+]";
1091
- var l = o ? (0, E._)("Collapse all") : (0, E._)("Shift click to expand all");
1092
- var u = (0, e.useRef)(null);
1093
- var f = r().createElement(re, {
1094
- elementRef: u,
1137
+ var q = function e(n) {
1138
+ var t = n.open, o = n.withTooltip, a = n.expandLinkRef;
1139
+ var i = t ? "[-]" : "[+]";
1140
+ var l = t ? (0, E._)("Collapse all") : (0, E._)("Shift click to expand all");
1141
+ var c = r().createElement(re, {
1142
+ elementRef: a,
1095
1143
  tabIndex: -1,
1096
1144
  onClick: function e(r) {
1097
- L(r);
1145
+ N(r);
1098
1146
  },
1099
- "aria-expanded": o,
1147
+ "aria-expanded": t,
1100
1148
  "data-test": "toggle"
1101
1149
  }, " ", i, " ");
1102
- if (c && a) {
1150
+ if (u && o) {
1103
1151
  return {
1104
1152
  expandLink: r().createElement(ne, {
1105
1153
  contentRelationship: "description",
1106
1154
  openDelay: "secondary",
1107
1155
  defaultPlacement: "above",
1108
1156
  content: (0, E._)(l)
1109
- }, f),
1110
- expandLinkRef: u
1157
+ }, c),
1158
+ expandLinkRef: a
1111
1159
  };
1112
1160
  }
1113
1161
  return {
1114
- expandLink: f,
1115
- expandLinkRef: u
1162
+ expandLink: c,
1163
+ expandLinkRef: a
1116
1164
  };
1117
1165
  };
1118
- var J = function n(t) {
1119
- var o = t.value, a = t.key;
1120
- var u;
1121
- var f = (0, e.useRef)(null);
1122
- if (!O()(o)) {
1123
- if (typeof o === "string") {
1124
- u = '"'.concat(o, '"');
1125
- } else if (typeof o === "boolean") {
1126
- u = o.toString();
1127
- } else if (o === null) {
1128
- u = "null";
1166
+ var F = function e(n) {
1167
+ var t = n.value, o = n.key, i = n.clickValueRef;
1168
+ var c;
1169
+ if (!O()(t)) {
1170
+ if (typeof t === "string") {
1171
+ c = '"'.concat(t, '"');
1172
+ } else if (typeof t === "boolean") {
1173
+ c = t.toString();
1174
+ } else if (t === null) {
1175
+ c = "null";
1129
1176
  } else {
1130
- u = o;
1177
+ c = t;
1131
1178
  }
1132
- } else if (g()(o)) {
1179
+ } else if (g()(t)) {
1133
1180
  // isObject is true for arrays
1134
- u = m()(o) ? "[]" : "{}";
1181
+ c = m()(t) ? "[]" : "{}";
1135
1182
  } else {
1136
- u = fe({
1137
- defaultOpen: i === true,
1138
- expandChildren: i,
1139
- expandChildrenOnShiftKey: c,
1140
- onClickKey: b,
1141
- onClickValue: h,
1142
- overflow: k,
1143
- obj: o,
1144
- path: a !== undefined ? [].concat(oe(I), [ a ]) : oe(I),
1145
- indentLevel: s + 1,
1146
- shift: P,
1147
- updateShift: R
1183
+ c = ve({
1184
+ defaultOpen: a === true,
1185
+ expandChildren: a,
1186
+ expandChildrenOnShiftKey: u,
1187
+ onClickKey: p,
1188
+ onClickValue: b,
1189
+ overflow: S,
1190
+ obj: t,
1191
+ path: o !== undefined ? [].concat(oe(x), [ o ]) : oe(x),
1192
+ indentLevel: v + 1,
1193
+ shift: C,
1194
+ updateShift: T
1148
1195
  });
1149
1196
  }
1150
- if (l()(u) || w()(u)) {
1151
- var d = o === null ? "null" : // TS: bigint, function, symbol are prevented by JSONElement type
1152
- te(o);
1153
- if (h) {
1197
+ if (l()(c) || k()(c)) {
1198
+ var f = t === null ? "null" : // TS: bigint, function, symbol are prevented by JSONElement type
1199
+ te(t);
1200
+ if (b) {
1154
1201
  return {
1155
1202
  representation: r().createElement(Q, {
1156
- elementRef: f,
1157
- valueType: d,
1158
- overflowType: k,
1203
+ elementRef: i,
1204
+ valueType: f,
1205
+ overflowType: S,
1159
1206
  onClick: function e(r) {
1160
- _ = f;
1161
- V(r, a);
1207
+ R = i;
1208
+ V(r, o);
1162
1209
  },
1163
1210
  onKeyDown: function e(r) {
1164
- F(r, false);
1211
+ L(r, false);
1165
1212
  },
1166
1213
  tabIndex: -1
1167
- }, u),
1168
- clickableValRef: f
1214
+ }, c),
1215
+ clickableValRef: i
1169
1216
  };
1170
1217
  }
1171
1218
  return {
1172
1219
  representation: r().createElement(G, {
1173
- valueType: d,
1174
- overflowType: k
1175
- }, u)
1220
+ valueType: f,
1221
+ overflowType: S
1222
+ }, c)
1176
1223
  };
1177
1224
  }
1178
1225
  return {
1179
- representation: u
1226
+ representation: c
1180
1227
  };
1181
1228
  };
1182
- var U = function n(t) {
1183
- var o = (0, e.useRef)(null);
1184
- if (b) {
1229
+ var $ = function e(n, t) {
1230
+ if (p) {
1185
1231
  return {
1186
1232
  propertyElement: r().createElement("span", null, r().createElement(ee, {
1187
- elementRef: o,
1233
+ elementRef: t,
1188
1234
  tabIndex: -1,
1189
1235
  onClick: function e(r) {
1190
- N = o;
1191
- q(r, t);
1236
+ K = t;
1237
+ D(r, n);
1192
1238
  },
1193
1239
  onKeyDown: function e(r) {
1194
- F(r, true);
1240
+ L(r, true);
1195
1241
  }
1196
- }, t), ":", " "),
1197
- clickableKeyRef: o
1242
+ }, n), ":", " "),
1243
+ clickableKeyRef: t
1198
1244
  };
1199
1245
  }
1200
1246
  return {
1201
- propertyElement: r().createElement("span", null, r().createElement(Z, null, t), ":", " ")
1247
+ propertyElement: r().createElement("span", null, r().createElement(Z, null, n), ":", " ")
1202
1248
  };
1203
1249
  };
1204
- if (O()(p) && !g()(p) || m()(p) && p.length > 0) {
1205
- var B = C()(p).map((function(e, n, t) {
1206
- var o = p[e];
1250
+ if (O()(s) && !g()(s) || m()(s) && s.length > 0) {
1251
+ var J = I()(s).map((function(e, n, t) {
1252
+ var o = s[e];
1207
1253
  // TS: should be safe based on (recursive) JSONElement type
1208
- var a = m()(p) ? parseInt(e, 10) : e;
1209
- var i = I.length === 0 ? ".".concat(a) : ".".concat(I.join("."), ".").concat(a);
1210
- var l = J({
1211
- key: a,
1212
- value: o
1213
- }), u = l.representation, c = l.clickableValRef;
1214
- var f = !m()(p) ? U(a) : {
1215
- propertyElement: undefined,
1216
- clickableKeyRef: undefined
1217
- }, d = f.propertyElement, v = f.clickableKeyRef;
1218
- var s = O()(o) && !g()(o) || m()(o) && o.length > 0;
1254
+ var a = m()(s) ? parseInt(e, 10) : e;
1255
+ var i = x.length === 0 ? ".".concat(a) : ".".concat(x.join("."), ".").concat(a);
1219
1256
 
1220
- return r().createElement(M, {
1257
+ return r().createElement(fe, {
1221
1258
  id: i,
1222
1259
  key: i,
1223
1260
  propertyDataPath: i,
1224
- propertyElement: d,
1225
- hasChildren: s,
1226
- initialOpenState: D(),
1227
- representation: u,
1228
- indentArray: K,
1229
- value: o,
1261
+ childKey: a,
1230
1262
  index: n,
1263
+ value: o,
1231
1264
  properties: t,
1232
- renderExpandLink: $,
1233
- clickableKeyRef: v,
1234
- clickableValRef: c,
1235
- onFocus: function e() {
1236
- N = v;
1237
- _ = c;
1265
+ obj: s,
1266
+ renderValue: F,
1267
+ renderKey: $,
1268
+ getInitialOpenState: _,
1269
+ indentArray: P,
1270
+ renderExpandLink: q,
1271
+ onFocus: function e(r, n) {
1272
+ K = r;
1273
+ R = n;
1238
1274
  }
1239
1275
  });
1240
1276
  }));
1241
- if (I.length === 0) {
1242
- var H = O()(p) && !g()(p) || m()(p) && p.length > 0;
1277
+ if (x.length === 0) {
1278
+ var U = O()(s) && !g()(s) || m()(s) && s.length > 0;
1243
1279
 
1244
1280
  return r().createElement(M, {
1245
1281
  id: "root",
1246
1282
  propertyDataPath: ".",
1247
- hasChildren: H,
1248
- initialOpenState: o,
1249
- value: p,
1283
+ key: ".",
1284
+ hasChildren: U,
1285
+ initialOpenState: t,
1286
+ value: s,
1250
1287
  index: 0,
1251
- renderExpandLink: $,
1252
- representation: B
1288
+ renderExpandLink: q,
1289
+ representation: J
1253
1290
  });
1254
1291
  }
1255
- return B;
1292
+ return J;
1256
1293
  }
1257
1294
  // edge case: a single number/string/boolean being rendered (still valid JSON)
1258
- var X = J({
1259
- value: p
1260
- }), z = X.representation;
1261
-
1262
- return r().createElement(A["default"].TreeItem, {
1263
- id: "0",
1264
- "data-test-path": ".",
1265
- content: z
1295
+
1296
+ return r().createElement(de, {
1297
+ obj: s,
1298
+ renderValue: F
1266
1299
  });
1267
1300
  }
1268
1301
  // CONCATENATED MODULE: ./src/JSONTree/JSONTree.tsx
1269
- function de() {
1270
- de = Object.assign || function(e) {
1302
+ function se() {
1303
+ se = Object.assign || function(e) {
1271
1304
  for (var r = 1; r < arguments.length; r++) {
1272
1305
  var n = arguments[r];
1273
1306
  for (var t in n) {
@@ -1278,30 +1311,30 @@
1278
1311
  }
1279
1312
  return e;
1280
1313
  };
1281
- return de.apply(this, arguments);
1314
+ return se.apply(this, arguments);
1282
1315
  }
1283
- function ve(e, r) {
1284
- return me(e) || be(e, r) || pe(e, r) || se();
1316
+ function pe(e, r) {
1317
+ return ge(e) || he(e, r) || be(e, r) || ye();
1285
1318
  }
1286
- function se() {
1319
+ function ye() {
1287
1320
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1288
1321
  }
1289
- function pe(e, r) {
1322
+ function be(e, r) {
1290
1323
  if (!e) return;
1291
- if (typeof e === "string") return ye(e, r);
1324
+ if (typeof e === "string") return me(e, r);
1292
1325
  var n = Object.prototype.toString.call(e).slice(8, -1);
1293
1326
  if (n === "Object" && e.constructor) n = e.constructor.name;
1294
1327
  if (n === "Map" || n === "Set") return Array.from(e);
1295
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ye(e, r);
1328
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return me(e, r);
1296
1329
  }
1297
- function ye(e, r) {
1330
+ function me(e, r) {
1298
1331
  if (r == null || r > e.length) r = e.length;
1299
1332
  for (var n = 0, t = new Array(r); n < r; n++) {
1300
1333
  t[n] = e[n];
1301
1334
  }
1302
1335
  return t;
1303
1336
  }
1304
- function be(e, r) {
1337
+ function he(e, r) {
1305
1338
  if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
1306
1339
  var n = [];
1307
1340
  var t = true;
@@ -1324,12 +1357,12 @@
1324
1357
  }
1325
1358
  return n;
1326
1359
  }
1327
- function me(e) {
1360
+ function ge(e) {
1328
1361
  if (Array.isArray(e)) return e;
1329
1362
  }
1330
- function he(e, r) {
1363
+ function Se(e, r) {
1331
1364
  if (e == null) return {};
1332
- var n = ge(e, r);
1365
+ var n = ke(e, r);
1333
1366
  var t, o;
1334
1367
  if (Object.getOwnPropertySymbols) {
1335
1368
  var a = Object.getOwnPropertySymbols(e);
@@ -1342,7 +1375,7 @@
1342
1375
  }
1343
1376
  return n;
1344
1377
  }
1345
- function ge(e, r) {
1378
+ function ke(e, r) {
1346
1379
  if (e == null) return {};
1347
1380
  var n = {};
1348
1381
  var t = Object.keys(e);
@@ -1354,7 +1387,7 @@
1354
1387
  }
1355
1388
  return n;
1356
1389
  }
1357
- var Se = {
1390
+ var we = {
1358
1391
  elementRef: a().oneOfType([ a().func, a().object ]),
1359
1392
  expandChildren: a().oneOfType([ a().bool, a().oneOf([ "withShiftModifier" ]) ]),
1360
1393
  indent: a().number,
@@ -1366,24 +1399,24 @@
1366
1399
  };
1367
1400
  /**
1368
1401
  * Used to visualize a JSON string.
1369
- */ function we(n) {
1370
- 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 = he(n, [ "elementRef", "expandChildren", "indent", "json", "onClickKey", "onClickValue", "overflow", "expandChildrenOnShiftKey" ]);
1402
+ */ function Oe(n) {
1403
+ 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 = Se(n, [ "elementRef", "expandChildren", "indent", "json", "onClickKey", "onClickValue", "overflow", "expandChildrenOnShiftKey" ]);
1371
1404
  // @docs-props-type JSONTreePropsBase
1372
1405
  var g = l()(c) ? JSON.parse(c) : c;
1373
1406
  var S = y === "wrap" ? s : v;
1374
- var w = (0, e.useState)(undefined), k = ve(w, 2), O = k[0], x = k[1];
1375
- var C = function e(r) {
1407
+ var k = (0, e.useState)(undefined), w = pe(k, 2), O = w[0], x = w[1];
1408
+ var I = function e(r) {
1376
1409
  x(r);
1377
1410
  };
1378
1411
 
1379
- return r().createElement(S, de({
1412
+ return r().createElement(S, se({
1380
1413
  "data-language": "language-json",
1381
1414
  "data-test": "json-tree",
1382
1415
  ref: t,
1383
1416
  role: "tree"
1384
- }, h), r().createElement(A["default"], {
1417
+ }, h), r().createElement(T["default"], {
1385
1418
  defaultIndent: false
1386
- }, fe({
1419
+ }, ve({
1387
1420
  defaultOpen: true,
1388
1421
  expandChildren: a,
1389
1422
  expandChildrenOnShiftKey: m,
@@ -1393,11 +1426,11 @@
1393
1426
  onClickValue: d,
1394
1427
  overflow: y,
1395
1428
  shift: O,
1396
- updateShift: C
1429
+ updateShift: I
1397
1430
  })));
1398
1431
  }
1399
- we.propTypes = Se;
1400
- /* harmony default export */ const ke = we;
1432
+ Oe.propTypes = we;
1433
+ /* harmony default export */ const xe = Oe;
1401
1434
  }) // CONCATENATED MODULE: ./src/JSONTree/index.ts
1402
1435
  ();
1403
1436
  module.exports = t;