@splunk/react-ui 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/Avatar.js +57 -52
  2. package/Box.js +2 -1
  3. package/CHANGELOG.md +31 -0
  4. package/Calendar.js +8 -4
  5. package/Checkbox.d.ts +2 -0
  6. package/Checkbox.js +350 -0
  7. package/Code.js +151 -132
  8. package/CollapsiblePanel.js +184 -210
  9. package/Color.js +4 -2
  10. package/ControlGroup.js +2 -1
  11. package/Date.js +123 -119
  12. package/DefinitionList.js +100 -77
  13. package/Dropdown.js +2 -2
  14. package/DualListbox.js +409 -353
  15. package/File.js +102 -99
  16. package/JSONTree.js +317 -303
  17. package/Link.js +11 -11
  18. package/MIGRATION.md +27 -0
  19. package/Markdown.js +162 -151
  20. package/Menu.js +44 -42
  21. package/Modal.js +3 -3
  22. package/Multiselect.js +454 -435
  23. package/Paginator.js +2 -1
  24. package/ResultsMenu.js +2 -1
  25. package/Scroll.js +2 -1
  26. package/Search.js +131 -127
  27. package/Select.js +3 -2
  28. package/Switch.js +197 -229
  29. package/Table.js +24 -16
  30. package/Text.js +180 -206
  31. package/TextArea.js +233 -224
  32. package/Tooltip.js +144 -139
  33. package/package.json +9 -10
  34. package/tsconfig.check-docs.json +8 -0
  35. package/types/src/Avatar/docs/examples/Basic.d.ts +1 -1
  36. package/types/src/Checkbox/Checkbox.d.ts +90 -0
  37. package/types/src/Checkbox/docs/examples/Basic.d.ts +7 -0
  38. package/types/src/Checkbox/docs/examples/Disabled.d.ts +6 -0
  39. package/types/src/Checkbox/docs/examples/Error.d.ts +6 -0
  40. package/types/src/Checkbox/docs/examples/Uncontrolled.d.ts +7 -0
  41. package/types/src/Checkbox/index.d.ts +2 -0
  42. package/types/src/Code/Code.d.ts +4 -1
  43. package/types/src/Code/LineHighlights.d.ts +1 -0
  44. package/types/src/Code/LineNumbers.d.ts +2 -1
  45. package/types/src/Code/docs/examples/CustomizeContainer.d.ts +7 -0
  46. package/types/src/ControlGroup/docs/examples/CustomizedLabelTarget.d.ts +3 -3
  47. package/types/src/Date/Date.d.ts +7 -1
  48. package/types/src/DefinitionList/DefinitionList.d.ts +7 -2
  49. package/types/src/DefinitionList/DefinitionListContext.d.ts +1 -1
  50. package/types/src/DefinitionList/docs/examples/StackedLayout.d.ts +6 -0
  51. package/types/src/DualListbox/DualListbox.d.ts +1 -1
  52. package/types/src/DualListbox/Label.d.ts +7 -7
  53. package/types/src/DualListbox/Listbox.d.ts +2 -2
  54. package/types/src/DualListbox/ListboxContext.d.ts +1 -1
  55. package/types/src/File/File.d.ts +7 -1
  56. package/types/src/JSONTree/JSONTreeItem.d.ts +4 -2
  57. package/types/src/JSONTree/renderTreeItems.d.ts +2 -1
  58. package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +2 -1
  59. package/types/src/Menu/docs/examples/Dimmed.d.ts +1 -1
  60. package/types/src/Menu/docs/examples/Disabled.d.ts +1 -0
  61. package/types/src/Multiselect/Compact.d.ts +7 -1
  62. package/types/src/Multiselect/Multiselect.d.ts +7 -1
  63. package/types/src/Multiselect/Normal.d.ts +7 -1
  64. package/types/src/Search/Search.d.ts +5 -1
  65. package/types/src/Switch/Switch.d.ts +7 -1
  66. package/types/src/Switch/docs/examples/Basic.d.ts +2 -10
  67. package/types/src/Switch/docs/examples/Disabled.d.ts +2 -9
  68. package/types/src/Table/ExpandButton.d.ts +1 -1
  69. package/types/src/Tooltip/Tooltip.d.ts +14 -1
  70. package/NonInteractiveCheckbox.js +0 -101
  71. package/types/src/CollapsiblePanel/icons/ExpandPanel.d.ts +0 -12
  72. package/types/src/NonInteractiveCheckbox/NonInteractiveCheckbox.d.ts +0 -22
  73. package/types/src/NonInteractiveCheckbox/index.d.ts +0 -1
  74. package/types/src/Switch/docs/examples/Error.d.ts +0 -6
  75. package/types/src/Text/IconOutlinedHide.d.ts +0 -3
  76. package/types/src/Text/IconOutlinedView.d.ts +0 -3
  77. /package/cypress/{tsconfig.cypress.json → tsconfig.check-cypress.json} +0 -0
package/JSONTree.js CHANGED
@@ -131,10 +131,10 @@
131
131
  }
132
132
  return ("string" === n ? String : Number)(e);
133
133
  }
134
- function x(e, n) {
135
- return T(e) || E(e, n) || j(e, n) || I();
134
+ function I(e, n) {
135
+ return T(e) || E(e, n) || j(e, n) || x();
136
136
  }
137
- function I() {
137
+ function x() {
138
138
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
139
139
  }
140
140
  function j(e, n) {
@@ -215,9 +215,9 @@
215
215
  /** @public */ function _(e) {
216
216
  var n = e.id, r = e.children, a = e.content, i = e.customIndent, l = e.elementRef, u = e.endAdornment, c = e.expanded, v = e.onFocus, b = e.onKeyDown, g = e.onToggleExpansion, O = e.onToggleSelection, w = A(e, [ "id", "children", "content", "customIndent", "elementRef", "endAdornment", "expanded", "onFocus", "onKeyDown", "onToggleExpansion", "onToggleSelection" ]);
217
217
  // @docs-props-type TreeItemPropsBase
218
- var k = (0, t.useContext)(p), I = k.defaultIndent, j = I === void 0 ? true : I, C = k.onItemKeyDown, E = k.onItemClick, T = k.removeNode, P = k.setNode, R = k.itemPaths, _ = k.focusedItemId;
218
+ var k = (0, t.useContext)(p), x = k.defaultIndent, j = x === void 0 ? true : x, C = k.onItemKeyDown, E = k.onItemClick, T = k.removeNode, P = k.setNode, R = k.itemPaths, _ = k.focusedItemId;
219
219
  // make first tree item tabbable
220
- var K = (0, t.useState)((R === null || R === void 0 ? void 0 : R.get("".concat(n))) === "0" ? 0 : -1), N = x(K, 2), D = N[0], V = N[1];
220
+ var K = (0, t.useState)((R === null || R === void 0 ? void 0 : R.get("".concat(n))) === "0" ? 0 : -1), D = I(K, 2), N = D[0], V = D[1];
221
221
  var L = (0, t.useRef)(null);
222
222
  var q = (0, t.useRef)(null);
223
223
  var F = t.Children.toArray(r).filter(t.isValidElement);
@@ -230,11 +230,11 @@
230
230
  }
231
231
  }
232
232
  }));
233
- var $ = (0, t.useCallback)((function(e) {
233
+ var M = (0, t.useCallback)((function(e) {
234
234
  m(L, e);
235
235
  m(l, e);
236
236
  }), [ l ]);
237
- var M = (0, t.useCallback)((function(e) {
237
+ var $ = (0, t.useCallback)((function(e) {
238
238
  var n;
239
239
  var r = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
240
240
  // For consistency, if not provided but found in the event then add it to `data` on callback.
@@ -282,16 +282,16 @@
282
282
  if (e.shiftKey && e.key === "Tab" && (R === null || R === void 0 ? void 0 : R.get("".concat(n))) === "0") {
283
283
  V(-1);
284
284
  }
285
- C === null || C === void 0 ? void 0 : C(e, n, c, F, M);
285
+ C === null || C === void 0 ? void 0 : C(e, n, c, F, $);
286
286
  b === null || b === void 0 ? void 0 : b(e);
287
- }), [ F, c, M, n, R, C, b, O ]);
287
+ }), [ F, c, $, n, R, C, b, O ]);
288
288
 
289
289
  return o().createElement("li", h({
290
290
  "data-test": "tree-item"
291
291
  }, w, {
292
292
  id: n,
293
- ref: $,
294
- tabIndex: D,
293
+ ref: M,
294
+ tabIndex: N,
295
295
  onBlur: B,
296
296
  onFocus: U,
297
297
  onKeyDown: G,
@@ -312,10 +312,10 @@
312
312
  _.propTypes = R;
313
313
  /* harmony default export */ const K = _;
314
314
  // CONCATENATED MODULE: ./src/Tree/treeUtils.ts
315
- function N(e, n) {
316
- return F(e) || q(e, n) || V(e, n) || D();
315
+ function D(e, n) {
316
+ return F(e) || q(e, n) || V(e, n) || N();
317
317
  }
318
- function D() {
318
+ function N() {
319
319
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
320
320
  }
321
321
  function V(e, n) {
@@ -359,17 +359,17 @@
359
359
  }
360
360
  /**
361
361
  * A helper function to get first key in Map that matches given value
362
- */ function $(e, n) {
362
+ */ function M(e, n) {
363
363
  var r;
364
364
  var t = Array.from(e.entries());
365
365
  return (r = t.find((function(e) {
366
- var r = N(e, 2), t = r[1];
366
+ var r = D(e, 2), t = r[1];
367
367
  return t === n;
368
368
  }))) === null || r === void 0 ? void 0 : r[0];
369
369
  }
370
370
  /**
371
371
  * A helper function to get parent path of current item path
372
- */ function M(e) {
372
+ */ function $(e) {
373
373
  // remove last index number of the current item path string to get parent
374
374
  return e.split("-").slice(0, -1).join("-");
375
375
  }
@@ -392,20 +392,20 @@
392
392
  if (!r) {
393
393
  return n;
394
394
  }
395
- var t = M(r);
396
- return $(e, t) || n;
395
+ var t = $(r);
396
+ return M(e, t) || n;
397
397
  }
398
398
  /**
399
399
  * A helper function for getNextTreeItem
400
400
  */ function X(e, n) {
401
- var r = M(n);
401
+ var r = $(n);
402
402
  if (!r) {
403
- return $(e, n);
403
+ return M(e, n);
404
404
  }
405
405
  // get next node in the parent level
406
406
  var t = U(r);
407
407
  var o = J(r, t);
408
- var a = $(e, o);
408
+ var a = M(e, o);
409
409
  if (a) {
410
410
  return a;
411
411
  }
@@ -418,14 +418,14 @@
418
418
  return n;
419
419
  }
420
420
  // case where next tree item is the first visible child
421
- var t = $(e, "".concat(r, "-0"));
421
+ var t = M(e, "".concat(r, "-0"));
422
422
  if (t) {
423
423
  return t;
424
424
  }
425
425
  // case where next tree item is the next node in the same level
426
426
  var o = U(r);
427
427
  var a = J(r, o);
428
- var i = $(e, a);
428
+ var i = M(e, a);
429
429
  if (i) {
430
430
  return i;
431
431
  }
@@ -435,17 +435,17 @@
435
435
  /**
436
436
  * A helper function for getPrevTreeItem
437
437
  */ function H(e, n) {
438
- var r = $(e, "".concat(n, "-0"));
438
+ var r = M(e, "".concat(n, "-0"));
439
439
  if (!r) {
440
- return $(e, n);
440
+ return M(e, n);
441
441
  }
442
- var t = $(e, n);
442
+ var t = M(e, n);
443
443
  var o = "".concat(n, "-0");
444
444
  // get the last child in current node, and continue to find its children recursively
445
445
  while (t) {
446
446
  var a = U(o);
447
447
  var i = J(o, a);
448
- t = $(e, i);
448
+ t = M(e, i);
449
449
  if (t) {
450
450
  o = i;
451
451
  }
@@ -467,24 +467,24 @@
467
467
  return H(e, o) || n;
468
468
  }
469
469
  function z(e) {
470
- return $(e, "0");
470
+ return M(e, "0");
471
471
  }
472
472
  function Q(e) {
473
473
  var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "0";
474
- var r = $(e, n);
474
+ var r = M(e, n);
475
475
  var t = n;
476
476
  // find last child in current node
477
477
  while (r) {
478
478
  var o = U(t);
479
- r = $(e, J(t, o));
479
+ r = M(e, J(t, o));
480
480
  if (r) {
481
481
  t = J(t, o);
482
482
  }
483
483
  }
484
484
  // check if last child has children
485
- var a = $(e, "".concat(t, "-0"));
485
+ var a = M(e, "".concat(t, "-0"));
486
486
  if (!a) {
487
- return $(e, t);
487
+ return M(e, t);
488
488
  }
489
489
  // continue to find its last child recursively
490
490
  t = "".concat(t, "-0");
@@ -784,7 +784,7 @@
784
784
  r.r(t);
785
785
  // EXPORTS
786
786
  r.d(t, {
787
- default: () => /* reexport */ Pe
787
+ default: () => /* reexport */ Re
788
788
  });
789
789
  // EXTERNAL MODULE: external "react"
790
790
  var e = r(9497);
@@ -795,114 +795,114 @@
795
795
  // EXTERNAL MODULE: external "prop-types"
796
796
  var i = r(23);
797
797
  var l = r.n(i);
798
+ // CONCATENATED MODULE: external "@splunk/ui-utils/id"
799
+ const u = require("@splunk/ui-utils/id");
798
800
  // EXTERNAL MODULE: external "styled-components"
799
- var u = r(232);
800
- var c = r.n(u);
801
+ var c = r(232);
802
+ var f = r.n(c);
801
803
  // CONCATENATED MODULE: external "@splunk/react-ui/Tree"
802
- const f = require("@splunk/react-ui/Tree");
803
- var d = r.n(f);
804
+ const d = require("@splunk/react-ui/Tree");
805
+ var s = r.n(d);
804
806
  // EXTERNAL MODULE: external "@splunk/themes"
805
- var s = r(3563);
807
+ var v = r(3563);
806
808
  // CONCATENATED MODULE: ./src/JSONTree/JSONTreeStyles.ts
807
- var v = (0, u.css)([ "", ";", ";color:", ";padding:4px;" ], s.mixins.reset("block"), s.mixins.typography({
809
+ var p = (0, c.css)([ "", ";", ";color:", ";padding:4px;" ], v.mixins.reset("block"), v.mixins.typography({
808
810
  family: "monospace"
809
- }), s.variables.syntaxGray);
810
- var p = c().code.withConfig({
811
+ }), v.variables.syntaxGray);
812
+ var y = f().code.withConfig({
811
813
  displayName: "JSONTreeStyles__StyledScrollCode",
812
814
  componentId: "vrdt21-0"
813
- })([ "", ";overflow-x:auto;white-space:nowrap;" ], v);
814
- var y = c()(d()).withConfig({
815
+ })([ "", ";overflow-x:auto;white-space:nowrap;" ], p);
816
+ var m = f()(s()).withConfig({
815
817
  displayName: "JSONTreeStyles__StyledTree",
816
818
  componentId: "vrdt21-1"
817
819
  })([ "font-family:inherit;ul{font-family:inherit;}" ]);
818
- var m = c().code.withConfig({
820
+ var b = f().code.withConfig({
819
821
  displayName: "JSONTreeStyles__StyledWrapCode",
820
822
  componentId: "vrdt21-2"
821
- })([ "", ";white-space:pre-wrap;" ], v);
823
+ })([ "", ";white-space:pre-wrap;" ], p);
822
824
  // CONCATENATED MODULE: external "lodash/fill"
823
- const b = require("lodash/fill");
824
- var h = r.n(b);
825
+ const h = require("lodash/fill");
826
+ var g = r.n(h);
825
827
  // CONCATENATED MODULE: external "lodash/isArray"
826
- const g = require("lodash/isArray");
827
- var S = r.n(g);
828
+ const S = require("lodash/isArray");
829
+ var O = r.n(S);
828
830
  // CONCATENATED MODULE: external "lodash/isEmpty"
829
- const O = require("lodash/isEmpty");
830
- var w = r.n(O);
831
+ const w = require("lodash/isEmpty");
832
+ var k = r.n(w);
831
833
  // CONCATENATED MODULE: external "lodash/isNumber"
832
- const k = require("lodash/isNumber");
833
- var x = r.n(k);
834
+ const I = require("lodash/isNumber");
835
+ var x = r.n(I);
834
836
  // CONCATENATED MODULE: external "lodash/isObject"
835
- const I = require("lodash/isObject");
836
- var j = r.n(I);
837
+ const j = require("lodash/isObject");
838
+ var C = r.n(j);
837
839
  // CONCATENATED MODULE: external "lodash/keys"
838
- const C = require("lodash/keys");
839
- var E = r.n(C);
840
+ const E = require("lodash/keys");
841
+ var T = r.n(E);
840
842
  // CONCATENATED MODULE: external "lodash/repeat"
841
- const T = require("lodash/repeat");
842
- var A = r.n(T);
843
+ const A = require("lodash/repeat");
844
+ var P = r.n(A);
843
845
  // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
844
- const P = require("@splunk/ui-utils/i18n");
846
+ const R = require("@splunk/ui-utils/i18n");
845
847
  // CONCATENATED MODULE: external "@splunk/react-ui/ButtonSimple"
846
- const R = require("@splunk/react-ui/ButtonSimple");
847
- var _ = r.n(R);
848
+ const _ = require("@splunk/react-ui/ButtonSimple");
849
+ var K = r.n(_);
848
850
  // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
849
- const K = require("@splunk/react-ui/Clickable");
850
- var N = r.n(K);
851
+ const D = require("@splunk/react-ui/Clickable");
852
+ var N = r.n(D);
851
853
  // CONCATENATED MODULE: external "@splunk/react-ui/Tooltip"
852
- const D = require("@splunk/react-ui/Tooltip");
853
- var V = r.n(D);
854
+ const V = require("@splunk/react-ui/Tooltip");
855
+ var L = r.n(V);
854
856
  // CONCATENATED MODULE: ./src/JSONTree/JSONTreeItemStyles.ts
855
- var L = {
856
- string: s.variables.syntaxTeal,
857
- number: s.variables.syntaxBlue,
858
- boolean: s.variables.syntaxPurple,
859
- null: s.variables.syntaxBrown,
860
- object: s.variables.syntaxGray,
861
- array: s.variables.syntaxGray
857
+ var q = {
858
+ string: v.variables.syntaxTeal,
859
+ number: v.variables.syntaxBlue,
860
+ boolean: v.variables.syntaxPurple,
861
+ null: v.variables.syntaxBrown,
862
+ object: v.variables.syntaxGray,
863
+ array: v.variables.syntaxGray
862
864
  };
863
- var q = (0, u.css)([ "word-break:break-word;word-wrap:break-word;" ]);
864
- var F = (0, u.css)([ "white-space:nowrap;" ]);
865
+ var F = (0, c.css)([ "word-break:break-word;word-wrap:break-word;" ]);
866
+ var M = (0, c.css)([ "white-space:nowrap;" ]);
865
867
  /* Using this magic number to set the height to be at least the minimum target size of 24 by 24 */ var $ = (0,
866
- u.css)([ "padding-block:2px;" ]);
867
- var M = (0, u.css)([ "font-family:inherit;&:focus{box-shadow:", ";outline:0;&:active{box-shadow:none;}}&:hover{background-color:", ";}" ], s.variables.focusShadow, s.variables.neutral50);
868
- var J = (0, u.css)([ "color:", ";", ";", "" ], (function(e) {
868
+ c.css)([ "padding-block:2px;" ]);
869
+ var J = (0, c.css)([ "font-family:inherit;&:focus{box-shadow:", ";outline:0;&:active{box-shadow:none;}}&:hover{background-color:", ";}" ], v.variables.focusShadow, v.variables.neutral50);
870
+ var U = (0, c.css)([ "color:", ";", ";", "" ], (function(e) {
869
871
  var n = e.valueType;
870
- return L[n];
872
+ return q[n];
871
873
  }), (function(e) {
872
874
  var n = e.overflowType;
873
- return n === "wrap" ? q : F;
875
+ return n === "wrap" ? F : M;
874
876
  }), $);
875
- var U = c().span.withConfig({
877
+ var B = f().span.withConfig({
876
878
  displayName: "JSONTreeItemStyles__StyledContentWrapper",
877
879
  componentId: "o558h3-0"
878
- })([ "color:", ";" ], s.variables.syntaxGray);
879
- var B = c().span.withConfig({
880
+ })([ "color:", ";" ], v.variables.syntaxGray);
881
+ var X = f().span.withConfig({
880
882
  displayName: "JSONTreeItemStyles__StyledValue",
881
883
  componentId: "o558h3-1"
882
- })([ "", "" ], J);
883
- var X = c()(N()).withConfig({
884
+ })([ "", "" ], U);
885
+ var G = f()(N()).withConfig({
884
886
  displayName: "JSONTreeItemStyles__StyledValueInteractiveClickable",
885
887
  componentId: "o558h3-2"
886
- })([ "", " ", " min-width:24px;text-align:center;" ], J, M);
887
- var G = (0, u.css)([ "", " color:", ";" ], $, s.variables.syntaxRed);
888
- var H = c().span.withConfig({
888
+ })([ "", " ", " min-width:24px;text-align:center;" ], U, J);
889
+ var H = (0, c.css)([ "", " color:", ";" ], $, v.variables.syntaxRed);
890
+ var W = f().span.withConfig({
889
891
  displayName: "JSONTreeItemStyles__StyledProperty",
890
892
  componentId: "o558h3-3"
891
- })([ "", "" ], G);
892
- var W = c()(N()).withConfig({
893
+ })([ "", "" ], H);
894
+ var z = f()(N()).withConfig({
893
895
  displayName: "JSONTreeItemStyles__StyledPropertyInteractiveClickable",
894
896
  componentId: "o558h3-4"
895
- })([ "", " ", "" ], G, M);
896
- var z = c()(_()).withConfig({
897
+ })([ "", " ", "" ], H, J);
898
+ var Q = f()(K()).withConfig({
897
899
  displayName: "JSONTreeItemStyles__StyledExpandLinkClickable",
898
900
  componentId: "o558h3-5"
899
- })([ "", ";border:none;border-radius:0;font-family:inherit;padding:1px ", " 3px ", ";&:hover{background-color:", ";text-decoration:none;}&:focus{box-shadow:", ";&:active{box-shadow:none;}}" ], $, s.variables.spacingXSmall, s.variables.spacingXSmall, s.variables.actionColorBackgroundSubtleHover, s.variables.focusShadowInset);
900
- var Q = c()(V()).withConfig({
901
+ })([ "", ";border:none;border-radius:0;font-family:inherit;padding:1px ", " 3px ", ";&:hover{background-color:", ";text-decoration:none;}&:focus{box-shadow:", ";&:active{box-shadow:none;}}" ], $, v.variables.spacingXSmall, v.variables.spacingXSmall, v.variables.actionColorBackgroundSubtleHover, v.variables.focusShadowInset);
902
+ var Y = f()(L()).withConfig({
901
903
  displayName: "JSONTreeItemStyles__StyledTooltip",
902
904
  componentId: "o558h3-6"
903
- })([ "font-family:", ";" ], s.variables.monoFontFamily);
904
- // EXTERNAL MODULE: ./src/Tree/index.ts + 7 modules
905
- var Y = r(8655);
905
+ })([ "font-family:", ";" ], v.variables.monoFontFamily);
906
906
  // CONCATENATED MODULE: ./src/JSONTree/JSONTreeItem.tsx
907
907
  function Z() {
908
908
  return Z = Object.assign ? Object.assign.bind() : function(e) {
@@ -989,6 +989,7 @@
989
989
  indentArray: l().arrayOf(l().string),
990
990
  index: l().number,
991
991
  initialOpenState: l().bool,
992
+ isRoot: l().bool,
992
993
  properties: l().arrayOf(l().string),
993
994
  propertyDataPath: l().string,
994
995
  propertyElement: l().node,
@@ -997,42 +998,43 @@
997
998
  value: l().oneOfType([ l().string, l().object, l().array, l().number, l().bool ])
998
999
  };
999
1000
  function ce(r) {
1000
- var t = r.clickableKeyRef, o = r.clickableValRef, a = r.hasChildren, i = r.indentArray, l = r.index, u = r.initialOpenState, c = r.onFocus, f = r.properties, d = r.propertyDataPath, s = r.propertyElement, v = r.renderExpandLink, p = r.representation, y = r.value, m = ie(r, [ "clickableKeyRef", "clickableValRef", "hasChildren", "indentArray", "index", "initialOpenState", "onFocus", "properties", "propertyDataPath", "propertyElement", "renderExpandLink", "representation", "value" ]);
1001
- var b = (0, e.useState)(u), h = ee(b, 2), g = h[0], O = h[1];
1002
- var w = (0, e.useCallback)((function() {
1003
- O((function(e) {
1001
+ var t = r.clickableKeyRef, o = r.clickableValRef, a = r.hasChildren, i = r.indentArray, l = r.index, u = r.initialOpenState, c = r.isRoot, f = r.onFocus, d = r.properties, v = r.propertyDataPath, p = r.propertyElement, y = r.renderExpandLink, m = r.representation, b = r.value, h = ie(r, [ "clickableKeyRef", "clickableValRef", "hasChildren", "indentArray", "index", "initialOpenState", "isRoot", "onFocus", "properties", "propertyDataPath", "propertyElement", "renderExpandLink", "representation", "value" ]);
1002
+ // @docs-props-type JSONTreeItemPropsBase
1003
+ var g = (0, e.useState)(u), S = ee(g, 2), w = S[0], k = S[1];
1004
+ var I = (0, e.useCallback)((function() {
1005
+ k((function(e) {
1004
1006
  return !e;
1005
1007
  }));
1006
1008
  }), []);
1007
- var k = (0, e.useRef)(null);
1008
- var x = v ? v({
1009
- onToggleExpansion: w,
1010
- open: g,
1009
+ var x = (0, e.useRef)(null);
1010
+ var j = y ? y({
1011
+ onToggleExpansion: I,
1012
+ open: w,
1011
1013
  withTooltip: true,
1012
- expandLinkRef: k
1014
+ expandLinkRef: x
1013
1015
  }) : {
1014
1016
  expandLink: undefined
1015
- }, I = x.expandLink;
1016
- var j = (f === null || f === void 0 ? void 0 : f.length) && l + 1 < (f === null || f === void 0 ? void 0 : f.length) ? "," : null;
1017
+ }, C = j.expandLink;
1018
+ var E = (d === null || d === void 0 ? void 0 : d.length) && l + 1 < (d === null || d === void 0 ? void 0 : d.length) ? "," : null;
1017
1019
 
1018
- return n().createElement(Y["default"].Item, Z({
1019
- content: n().createElement(U, null, s, a && (S()(y) ? "[" : "{"), !a && n().createElement(n().Fragment, null, p, j), a && I),
1020
+ return n().createElement(s().Item, Z({
1021
+ content: n().createElement(B, null, p, a && (O()(b) ? "[" : "{"), !a && n().createElement(n().Fragment, null, m, E), a && C),
1020
1022
  customIndent: i,
1021
1023
  "data-test": a ? "node" : null,
1022
- "data-test-path": d,
1023
- endAdornment: a && n().createElement(U, null, g && i, S()(y) ? "]" : "}", j),
1024
- expanded: g,
1024
+ "data-test-path": v,
1025
+ endAdornment: a && n().createElement(B, null, w && i, O()(b) ? "]" : "}", E),
1026
+ expanded: w,
1025
1027
  onFocus: function e(n) {
1026
- c === null || c === void 0 ? void 0 : c(n);
1028
+ f === null || f === void 0 ? void 0 : f(n);
1027
1029
  // check if onFocus was triggered by a click event or expand link
1028
- var r = n.relatedTarget === (t === null || t === void 0 ? void 0 : t.current) || n.relatedTarget === (o === null || o === void 0 ? void 0 : o.current) || n.relatedTarget === (k === null || k === void 0 ? void 0 : k.current) ? n.relatedTarget : null;
1029
- if (m.id === "root") {
1030
+ var r = n.relatedTarget === (t === null || t === void 0 ? void 0 : t.current) || n.relatedTarget === (o === null || o === void 0 ? void 0 : o.current) || n.relatedTarget === (x === null || x === void 0 ? void 0 : x.current) ? n.relatedTarget : null;
1031
+ if (c) {
1030
1032
  var a;
1031
- k === null || k === void 0 ? void 0 : (a = k.current) === null || a === void 0 ? void 0 : a.focus();
1033
+ x === null || x === void 0 ? void 0 : (a = x.current) === null || a === void 0 ? void 0 : a.focus();
1032
1034
  }
1033
1035
  if (!r) {
1034
1036
  // if JSONTreeItem contains clickable keys/vals, focus should go there
1035
- if (s && (t === null || t === void 0 ? void 0 : t.current)) {
1037
+ if (p && (t === null || t === void 0 ? void 0 : t.current)) {
1036
1038
  var i;
1037
1039
  (i = t.current) === null || i === void 0 ? void 0 : i.focus();
1038
1040
  } else if (o === null || o === void 0 ? void 0 : o.current) {
@@ -1043,47 +1045,49 @@
1043
1045
  r.focus();
1044
1046
  }
1045
1047
  },
1046
- onToggleExpansion: w,
1048
+ onToggleExpansion: I,
1047
1049
  tabIndex: 0
1048
- }, m), a && p);
1050
+ }, h), a && m);
1049
1051
  }
1050
1052
  ce.propTypes = ue;
1053
+ // EXTERNAL MODULE: ./src/Tree/index.ts + 7 modules
1054
+ var fe = r(8655);
1051
1055
  // CONCATENATED MODULE: ./src/JSONTree/renderTreeItems.tsx
1052
- function fe(e) {
1056
+ function de(e) {
1053
1057
  "@babel/helpers - typeof";
1054
- return fe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
1058
+ return de = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
1055
1059
  return typeof e;
1056
1060
  } : function(e) {
1057
1061
  return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
1058
- }, fe(e);
1062
+ }, de(e);
1059
1063
  }
1060
- function de(e) {
1061
- return ye(e) || pe(e) || ve(e) || se();
1064
+ function se(e) {
1065
+ return me(e) || ye(e) || pe(e) || ve();
1062
1066
  }
1063
- function se() {
1067
+ function ve() {
1064
1068
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1065
1069
  }
1066
- function ve(e, n) {
1070
+ function pe(e, n) {
1067
1071
  if (e) {
1068
- if ("string" == typeof e) return me(e, n);
1072
+ if ("string" == typeof e) return be(e, n);
1069
1073
  var r = {}.toString.call(e).slice(8, -1);
1070
- return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? me(e, n) : void 0;
1074
+ return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? be(e, n) : void 0;
1071
1075
  }
1072
1076
  }
1073
- function pe(e) {
1077
+ function ye(e) {
1074
1078
  if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
1075
1079
  }
1076
- function ye(e) {
1077
- if (Array.isArray(e)) return me(e);
1080
+ function me(e) {
1081
+ if (Array.isArray(e)) return be(e);
1078
1082
  }
1079
- function me(e, n) {
1083
+ function be(e, n) {
1080
1084
  (null == n || n > e.length) && (n = e.length);
1081
1085
  for (var r = 0, t = Array(n); r < n; r++) {
1082
1086
  t[r] = e[r];
1083
1087
  }
1084
1088
  return t;
1085
1089
  }
1086
- function be(r) {
1090
+ function he(r) {
1087
1091
  var t = r.id, o = r.childKey, a = r.index, i = r.value, l = r.properties, u = r.propertyDataPath, c = r.obj, f = r.renderValue, d = r.renderKey, s = r.getInitialOpenState, v = r.indentArray, p = r.renderExpandLink, y = r.onFocus;
1088
1092
  var m = (0, e.useRef)(null);
1089
1093
  var b = (0, e.useRef)(null);
@@ -1091,18 +1095,18 @@
1091
1095
  key: o,
1092
1096
  value: i,
1093
1097
  clickValueRef: m
1094
- }), g = h.representation, O = h.clickableValRef;
1095
- var k = !S()(c) ? d(o, b) : {
1098
+ }), g = h.representation, S = h.clickableValRef;
1099
+ var w = !O()(c) ? d(o, b) : {
1096
1100
  propertyElement: undefined,
1097
1101
  clickableKeyRef: undefined
1098
- }, x = k.propertyElement, I = k.clickableKeyRef;
1099
- var C = j()(i) && !w()(i) || S()(i) && i.length > 0;
1102
+ }, I = w.propertyElement, x = w.clickableKeyRef;
1103
+ var j = C()(i) && !k()(i) || O()(i) && i.length > 0;
1100
1104
 
1101
1105
  return n().createElement(ce, {
1102
1106
  id: t,
1103
1107
  propertyDataPath: u,
1104
- propertyElement: x,
1105
- hasChildren: C,
1108
+ propertyElement: I,
1109
+ hasChildren: j,
1106
1110
  initialOpenState: s(),
1107
1111
  representation: g,
1108
1112
  indentArray: v,
@@ -1110,105 +1114,105 @@
1110
1114
  index: a,
1111
1115
  properties: l,
1112
1116
  renderExpandLink: p,
1113
- clickableKeyRef: I,
1114
- clickableValRef: O,
1117
+ clickableKeyRef: x,
1118
+ clickableValRef: S,
1115
1119
  onFocus: function e() {
1116
- y(I, O);
1120
+ y(x, S);
1117
1121
  }
1118
1122
  });
1119
1123
  }
1120
- function he(r) {
1121
- var t = r.renderValue, o = r.obj;
1122
- var a = (0, e.useRef)(null);
1123
- var i = t({
1124
- value: o,
1125
- clickValueRef: a
1126
- }), l = i.representation;
1124
+ function ge(r) {
1125
+ var t = r.baseId, o = r.renderValue, a = r.obj;
1126
+ var i = (0, e.useRef)(null);
1127
+ var l = o({
1128
+ value: a,
1129
+ clickValueRef: i
1130
+ }), u = l.representation;
1127
1131
 
1128
- return n().createElement(Y["default"].Item, {
1129
- id: "0",
1132
+ return n().createElement(fe["default"].Item, {
1133
+ id: "".concat(t, "-0"),
1130
1134
  "data-test-path": ".",
1131
- content: l
1135
+ content: u
1132
1136
  });
1133
1137
  }
1134
- function ge(e) {
1135
- var r = e.defaultOpen, t = r === void 0 ? false : r, o = e.defaultExpanded, i = o === void 0 ? false : o, l = e.expandChildrenOnShiftKey, u = l === void 0 ? false : l, c = e.indent, f = c === void 0 ? 4 : c, d = e.indentLevel, s = d === void 0 ? 1 : d, v = e.obj, p = e.onClickKey, y = e.onClickValue, m = e.overflow, b = m === void 0 ? "scroll" : m, g = e.path, O = g === void 0 ? [] : g, k = e.shift, I = e.updateShift;
1136
- var C = h()(Array(s), A()(" ", f));
1137
- var T;
1138
- var R;
1139
- var _ = function e() {
1140
- if (i && k == null) {
1138
+ function Se(e) {
1139
+ var r = e.baseId, t = e.defaultOpen, o = t === void 0 ? false : t, i = e.defaultExpanded, l = i === void 0 ? false : i, u = e.expandChildrenOnShiftKey, c = u === void 0 ? false : u, f = e.indent, d = f === void 0 ? 4 : f, s = e.indentLevel, v = s === void 0 ? 1 : s, p = e.obj, y = e.onClickKey, m = e.onClickValue, b = e.overflow, h = b === void 0 ? "scroll" : b, S = e.path, w = S === void 0 ? [] : S, I = e.shift, j = e.updateShift;
1140
+ var E = g()(Array(v), P()(" ", d));
1141
+ var A;
1142
+ var _;
1143
+ var K = function e() {
1144
+ if (l && I == null) {
1141
1145
  return true;
1142
1146
  }
1143
- if (u) {
1144
- return !!k;
1147
+ if (c) {
1148
+ return !!I;
1145
1149
  }
1146
- return t;
1150
+ return o;
1147
1151
  };
1148
- var K = function e(n) {
1149
- if (u && I != null) {
1150
- I(n.shiftKey);
1152
+ var D = function e(n) {
1153
+ if (c && j != null) {
1154
+ j(n.shiftKey);
1151
1155
  }
1152
1156
  };
1153
1157
  var N = function e(n, r) {
1154
1158
  var t, o;
1155
1159
  // When rendering a single value key is not present, here we prevent `[undefined]` in path
1156
- var a = r !== undefined ? [].concat(de(O), [ r ]) : de(O);
1160
+ var a = r !== undefined ? [].concat(se(w), [ r ]) : se(w);
1157
1161
  var i = ".".concat(a.join("."));
1158
- (t = R) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
1159
- p === null || p === void 0 ? void 0 : p(n, {
1162
+ (t = _) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
1163
+ y === null || y === void 0 ? void 0 : y(n, {
1160
1164
  key: i,
1161
1165
  keyPath: a
1162
1166
  });
1163
1167
  };
1164
- var D = function e(n, r) {
1168
+ var V = function e(n, r) {
1165
1169
  var t, o;
1166
1170
  // When rendering a single value key is not present, here we prevent `[undefined]` in path
1167
- var a = r !== undefined ? [].concat(de(O), [ r ]) : de(O);
1171
+ var a = r !== undefined ? [].concat(se(w), [ r ]) : se(w);
1168
1172
  var i = ".".concat(a.join("."));
1169
- (t = T) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
1170
- y === null || y === void 0 ? void 0 : y(n, {
1173
+ (t = A) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
1174
+ m === null || m === void 0 ? void 0 : m(n, {
1171
1175
  key: i,
1172
1176
  keyPath: a,
1173
1177
  value: n.target.textContent
1174
1178
  });
1175
1179
  };
1176
- var V = function e(n, r) {
1180
+ var L = function e(n, r) {
1177
1181
  var t, o;
1178
1182
  var a = n.key;
1179
- if (a === "ArrowLeft" && p && ((t = R) === null || t === void 0 ? void 0 : t.current) && !r) {
1183
+ if (a === "ArrowLeft" && y && ((t = _) === null || t === void 0 ? void 0 : t.current) && !r) {
1180
1184
  var i;
1181
1185
  n.stopPropagation();
1182
- (i = R.current) === null || i === void 0 ? void 0 : i.focus();
1186
+ (i = _.current) === null || i === void 0 ? void 0 : i.focus();
1183
1187
  }
1184
- if (a === "ArrowRight" && y && ((o = T) === null || o === void 0 ? void 0 : o.current) && r) {
1188
+ if (a === "ArrowRight" && m && ((o = A) === null || o === void 0 ? void 0 : o.current) && r) {
1185
1189
  var l;
1186
1190
  n.stopPropagation();
1187
- (l = T.current) === null || l === void 0 ? void 0 : l.focus();
1191
+ (l = A.current) === null || l === void 0 ? void 0 : l.focus();
1188
1192
  }
1189
1193
  };
1190
- var L = function e(r) {
1194
+ var q = function e(r) {
1191
1195
  var t = r.onToggleExpansion, o = r.open, a = r.withTooltip, i = r.expandLinkRef;
1192
1196
  var l = o ? "[-]" : "[+]";
1193
- var c = o ? (0, P._)("Collapse all") : (0, P._)("Shift click to expand all");
1194
- var f = n().createElement(z, {
1197
+ var u = o ? (0, R._)("Collapse all") : (0, R._)("Shift click to expand all");
1198
+ var f = n().createElement(Q, {
1195
1199
  appearance: "subtle",
1196
1200
  elementRef: i,
1197
1201
  tabIndex: -1,
1198
1202
  onClick: function e(n) {
1199
- K(n);
1203
+ D(n);
1200
1204
  t === null || t === void 0 ? void 0 : t(n);
1201
1205
  },
1202
1206
  "aria-expanded": o,
1203
1207
  "data-test": "toggle"
1204
1208
  }, l);
1205
- if (u && a) {
1209
+ if (c && a) {
1206
1210
  return {
1207
- expandLink: n().createElement(Q, {
1211
+ expandLink: n().createElement(Y, {
1208
1212
  contentRelationship: "description",
1209
1213
  openDelay: "secondary",
1210
1214
  defaultPlacement: "above",
1211
- content: (0, P._)(c)
1215
+ content: (0, R._)(u)
1212
1216
  }, f),
1213
1217
  expandLinkRef: i
1214
1218
  };
@@ -1218,129 +1222,131 @@
1218
1222
  expandLinkRef: i
1219
1223
  };
1220
1224
  };
1221
- var q = function e(r) {
1222
- var t = r.value, o = r.key, l = r.clickValueRef;
1223
- var c;
1224
- if (!j()(t)) {
1225
- if (typeof t === "string") {
1226
- c = '"'.concat(t, '"');
1227
- } else if (typeof t === "boolean") {
1228
- c = t.toString();
1229
- } else if (t === null) {
1230
- c = "null";
1225
+ var F = function e(t) {
1226
+ var o = t.value, i = t.key, u = t.clickValueRef;
1227
+ var f;
1228
+ if (!C()(o)) {
1229
+ if (typeof o === "string") {
1230
+ f = '"'.concat(o, '"');
1231
+ } else if (typeof o === "boolean") {
1232
+ f = o.toString();
1233
+ } else if (o === null) {
1234
+ f = "null";
1231
1235
  } else {
1232
- c = t;
1236
+ f = o;
1233
1237
  }
1234
- } else if (w()(t)) {
1238
+ } else if (k()(o)) {
1235
1239
  // isObject is true for arrays
1236
- c = S()(t) ? "[]" : "{}";
1240
+ f = O()(o) ? "[]" : "{}";
1237
1241
  } else {
1238
- c = ge({
1239
- defaultOpen: i === true,
1240
- defaultExpanded: i,
1241
- expandChildrenOnShiftKey: u,
1242
- onClickKey: p,
1243
- onClickValue: y,
1244
- overflow: b,
1245
- obj: t,
1246
- path: o !== undefined ? [].concat(de(O), [ o ]) : de(O),
1247
- indentLevel: s + 1,
1248
- shift: k,
1249
- updateShift: I
1242
+ f = Se({
1243
+ baseId: r,
1244
+ defaultOpen: l === true,
1245
+ defaultExpanded: l,
1246
+ expandChildrenOnShiftKey: c,
1247
+ onClickKey: y,
1248
+ onClickValue: m,
1249
+ overflow: h,
1250
+ obj: o,
1251
+ path: i !== undefined ? [].concat(se(w), [ i ]) : se(w),
1252
+ indentLevel: v + 1,
1253
+ shift: I,
1254
+ updateShift: j
1250
1255
  });
1251
1256
  }
1252
- if (a()(c) || x()(c)) {
1253
- var f = t === null ? "null" : // TS: bigint, function, symbol are prevented by JSONElement type
1254
- fe(t);
1255
- if (y) {
1257
+ if (a()(f) || x()(f)) {
1258
+ var d = o === null ? "null" : // TS: bigint, function, symbol are prevented by JSONElement type
1259
+ de(o);
1260
+ if (m) {
1256
1261
  return {
1257
- representation: n().createElement(X, {
1258
- elementRef: l,
1259
- valueType: f,
1260
- overflowType: b,
1262
+ representation: n().createElement(G, {
1263
+ elementRef: u,
1264
+ valueType: d,
1265
+ overflowType: h,
1261
1266
  onClick: function e(n) {
1262
- T = l;
1263
- D(n, o);
1267
+ A = u;
1268
+ V(n, i);
1264
1269
  },
1265
1270
  onKeyDown: function e(n) {
1266
- V(n, false);
1271
+ L(n, false);
1267
1272
  },
1268
1273
  tabIndex: -1
1269
- }, c),
1270
- clickableValRef: l
1274
+ }, f),
1275
+ clickableValRef: u
1271
1276
  };
1272
1277
  }
1273
1278
  return {
1274
- representation: n().createElement(B, {
1275
- valueType: f,
1276
- overflowType: b
1277
- }, c)
1279
+ representation: n().createElement(X, {
1280
+ valueType: d,
1281
+ overflowType: h
1282
+ }, f)
1278
1283
  };
1279
1284
  }
1280
1285
  return {
1281
- representation: c
1286
+ representation: f
1282
1287
  };
1283
1288
  };
1284
- var F = function e(r, t) {
1285
- if (p) {
1289
+ var M = function e(r, t) {
1290
+ if (y) {
1286
1291
  return {
1287
- propertyElement: n().createElement(n().Fragment, null, n().createElement(W, {
1292
+ propertyElement: n().createElement(n().Fragment, null, n().createElement(z, {
1288
1293
  elementRef: t,
1289
1294
  tabIndex: -1,
1290
1295
  onClick: function e(n) {
1291
- R = t;
1296
+ _ = t;
1292
1297
  N(n, r);
1293
1298
  },
1294
1299
  onKeyDown: function e(n) {
1295
- V(n, true);
1300
+ L(n, true);
1296
1301
  }
1297
1302
  }, r), ":", " "),
1298
1303
  clickableKeyRef: t
1299
1304
  };
1300
1305
  }
1301
1306
  return {
1302
- propertyElement: n().createElement(n().Fragment, null, n().createElement(H, null, r), ":", " ")
1307
+ propertyElement: n().createElement(n().Fragment, null, n().createElement(W, null, r), ":", " ")
1303
1308
  };
1304
1309
  };
1305
- if (j()(v) && !w()(v) || S()(v) && v.length > 0) {
1306
- var $ = E()(v).map((function(e, r, t) {
1307
- var o = v[e];
1310
+ if (C()(p) && !k()(p) || O()(p) && p.length > 0) {
1311
+ var $ = T()(p).map((function(e, t, o) {
1312
+ var a = p[e];
1308
1313
  // TS: should be safe based on (recursive) JSONElement type
1309
- var a = S()(v) ? parseInt(e, 10) : e;
1310
- var i = O.length === 0 ? ".".concat(a) : ".".concat(O.join("."), ".").concat(a);
1314
+ var i = O()(p) ? parseInt(e, 10) : e;
1315
+ var l = w.length === 0 ? ".".concat(i) : ".".concat(w.join("."), ".").concat(i);
1311
1316
 
1312
- return n().createElement(be, {
1313
- id: i,
1314
- key: i,
1315
- propertyDataPath: i,
1316
- childKey: a,
1317
- index: r,
1318
- value: o,
1319
- properties: t,
1320
- obj: v,
1321
- renderValue: q,
1322
- renderKey: F,
1323
- getInitialOpenState: _,
1324
- indentArray: C,
1325
- renderExpandLink: L,
1317
+ return n().createElement(he, {
1318
+ id: "".concat(r, "-").concat(l),
1319
+ key: l,
1320
+ propertyDataPath: l,
1321
+ childKey: i,
1322
+ index: t,
1323
+ value: a,
1324
+ properties: o,
1325
+ obj: p,
1326
+ renderValue: F,
1327
+ renderKey: M,
1328
+ getInitialOpenState: K,
1329
+ indentArray: E,
1330
+ renderExpandLink: q,
1326
1331
  onFocus: function e(n, r) {
1327
- R = n;
1328
- T = r;
1332
+ _ = n;
1333
+ A = r;
1329
1334
  }
1330
1335
  });
1331
1336
  }));
1332
- if (O.length === 0) {
1333
- var M = j()(v) && !w()(v) || S()(v) && v.length > 0;
1337
+ if (w.length === 0) {
1338
+ var J = C()(p) && !k()(p) || O()(p) && p.length > 0;
1334
1339
 
1335
1340
  return n().createElement(ce, {
1336
- id: "root",
1341
+ id: "".concat(r, "-root"),
1342
+ isRoot: true,
1337
1343
  propertyDataPath: ".",
1338
1344
  key: ".",
1339
- hasChildren: M,
1340
- initialOpenState: t || i,
1341
- value: v,
1345
+ hasChildren: J,
1346
+ initialOpenState: o || l,
1347
+ value: p,
1342
1348
  index: 0,
1343
- renderExpandLink: L,
1349
+ renderExpandLink: q,
1344
1350
  representation: $
1345
1351
  });
1346
1352
  }
@@ -1348,14 +1354,15 @@
1348
1354
  }
1349
1355
  // edge case: a single number/string/boolean being rendered (still valid JSON)
1350
1356
 
1351
- return n().createElement(he, {
1352
- obj: v,
1353
- renderValue: q
1357
+ return n().createElement(ge, {
1358
+ baseId: r,
1359
+ obj: p,
1360
+ renderValue: F
1354
1361
  });
1355
1362
  }
1356
1363
  // CONCATENATED MODULE: ./src/JSONTree/JSONTree.tsx
1357
- function Se() {
1358
- return Se = Object.assign ? Object.assign.bind() : function(e) {
1364
+ function Oe() {
1365
+ return Oe = Object.assign ? Object.assign.bind() : function(e) {
1359
1366
  for (var n = 1; n < arguments.length; n++) {
1360
1367
  var r = arguments[n];
1361
1368
  for (var t in r) {
@@ -1363,15 +1370,15 @@
1363
1370
  }
1364
1371
  }
1365
1372
  return e;
1366
- }, Se.apply(null, arguments);
1373
+ }, Oe.apply(null, arguments);
1367
1374
  }
1368
- function Oe(e, n) {
1369
- return je(e) || Ie(e, n) || ke(e, n) || we();
1375
+ function we(e, n) {
1376
+ return Ce(e) || je(e, n) || Ie(e, n) || ke();
1370
1377
  }
1371
- function we() {
1378
+ function ke() {
1372
1379
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1373
1380
  }
1374
- function ke(e, n) {
1381
+ function Ie(e, n) {
1375
1382
  if (e) {
1376
1383
  if ("string" == typeof e) return xe(e, n);
1377
1384
  var r = {}.toString.call(e).slice(8, -1);
@@ -1385,7 +1392,7 @@
1385
1392
  }
1386
1393
  return t;
1387
1394
  }
1388
- function Ie(e, n) {
1395
+ function je(e, n) {
1389
1396
  var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
1390
1397
  if (null != r) {
1391
1398
  var t, o, a, i, l = [], u = !0, c = !1;
@@ -1407,12 +1414,12 @@
1407
1414
  return l;
1408
1415
  }
1409
1416
  }
1410
- function je(e) {
1417
+ function Ce(e) {
1411
1418
  if (Array.isArray(e)) return e;
1412
1419
  }
1413
- function Ce(e, n) {
1420
+ function Ee(e, n) {
1414
1421
  if (null == e) return {};
1415
- var r, t, o = Ee(e, n);
1422
+ var r, t, o = Te(e, n);
1416
1423
  if (Object.getOwnPropertySymbols) {
1417
1424
  var a = Object.getOwnPropertySymbols(e);
1418
1425
  for (t = 0; t < a.length; t++) {
@@ -1421,7 +1428,7 @@
1421
1428
  }
1422
1429
  return o;
1423
1430
  }
1424
- function Ee(e, n) {
1431
+ function Te(e, n) {
1425
1432
  if (null == e) return {};
1426
1433
  var r = {};
1427
1434
  for (var t in e) {
@@ -1434,7 +1441,7 @@
1434
1441
  }
1435
1442
  /** @public */
1436
1443
  /** @public */
1437
- /** @public */ var Te = {
1444
+ /** @public */ var Ae = {
1438
1445
  elementRef: l().oneOfType([ l().func, l().object ]),
1439
1446
  defaultExpanded: l().bool,
1440
1447
  indent: l().number,
@@ -1446,38 +1453,45 @@
1446
1453
  };
1447
1454
  /**
1448
1455
  * Used to visualize a JSON string.
1449
- */ function Ae(r) {
1450
- var t = r.elementRef, o = r.defaultExpanded, i = o === void 0 ? false : o, l = r.indent, u = l === void 0 ? 4 : l, c = r.json, f = r.onClickKey, d = r.onClickValue, s = r.overflow, v = s === void 0 ? "scroll" : s, b = r.expandChildrenOnShiftKey, h = b === void 0 ? true : b, g = Ce(r, [ "elementRef", "defaultExpanded", "indent", "json", "onClickKey", "onClickValue", "overflow", "expandChildrenOnShiftKey" ]);
1456
+ */ function Pe(r) {
1457
+ var t = r.elementRef, o = r.defaultExpanded, i = o === void 0 ? false : o, l = r.indent, c = l === void 0 ? 4 : l, f = r.json, d = r.onClickKey, s = r.onClickValue, v = r.overflow, p = v === void 0 ? "scroll" : v, h = r.expandChildrenOnShiftKey, g = h === void 0 ? true : h, S = Ee(r, [ "elementRef", "defaultExpanded", "indent", "json", "onClickKey", "onClickValue", "overflow", "expandChildrenOnShiftKey" ]);
1451
1458
  // @docs-props-type JSONTreePropsBase
1452
- var S = a()(c) ? JSON.parse(c) : c;
1453
- var O = v === "wrap" ? m : p;
1454
- var w = (0, e.useState)(undefined), k = Oe(w, 2), x = k[0], I = k[1];
1455
- var j = function e(n) {
1456
- I(n);
1457
- };
1459
+ var O = (0, e.useMemo)((function() {
1460
+ return S.id || (0, u.createDOMID)("json-tree");
1461
+ }), [ S.id ]);
1462
+ var w = a()(f) ? JSON.parse(f) : f;
1463
+ var k = p === "wrap" ? b : y;
1464
+ var I = (0, e.useState)(undefined), x = we(I, 2), j = x[0], C = x[1];
1465
+ var E = (0, e.useCallback)((function(e) {
1466
+ C(e);
1467
+ }), []);
1468
+ var T = (0, e.useMemo)((function() {
1469
+ return Se({
1470
+ baseId: O,
1471
+ defaultOpen: true,
1472
+ defaultExpanded: i,
1473
+ expandChildrenOnShiftKey: g,
1474
+ indent: c,
1475
+ obj: w,
1476
+ onClickKey: d,
1477
+ onClickValue: s,
1478
+ overflow: p,
1479
+ shift: j,
1480
+ updateShift: E
1481
+ });
1482
+ }), [ O, i, g, c, w, d, s, p, j, E ]);
1458
1483
 
1459
- return n().createElement(O, Se({
1484
+ return n().createElement(k, Oe({
1460
1485
  "data-language": "language-json",
1461
1486
  "data-test": "json-tree",
1462
1487
  ref: t,
1463
1488
  role: "tree"
1464
- }, g), n().createElement(y, {
1489
+ }, S), n().createElement(m, {
1465
1490
  defaultIndent: false
1466
- }, ge({
1467
- defaultOpen: true,
1468
- defaultExpanded: i,
1469
- expandChildrenOnShiftKey: h,
1470
- indent: u,
1471
- obj: S,
1472
- onClickKey: f,
1473
- onClickValue: d,
1474
- overflow: v,
1475
- shift: x,
1476
- updateShift: j
1477
- })));
1491
+ }, T));
1478
1492
  }
1479
- Ae.propTypes = Te;
1480
- /* harmony default export */ const Pe = Ae;
1493
+ Pe.propTypes = Ae;
1494
+ /* harmony default export */ const Re = Pe;
1481
1495
  }) // CONCATENATED MODULE: ./src/JSONTree/index.ts
1482
1496
  ();
1483
1497
  module.exports = t;