@splunk/react-ui 5.0.0-beta.5 → 5.0.0-rc.2

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 (52) hide show
  1. package/ButtonSimple.js +92 -168
  2. package/{CHANGELOG.v5.mdx → CHANGELOG.v5.md} +43 -0
  3. package/Calendar.js +148 -151
  4. package/Card.js +139 -139
  5. package/Code.js +197 -167
  6. package/CollapsiblePanel.js +172 -164
  7. package/Color.js +584 -506
  8. package/ComboBox.js +51 -51
  9. package/ControlGroup.js +132 -127
  10. package/Date.js +137 -150
  11. package/Dropdown.js +97 -96
  12. package/DualListbox.js +468 -469
  13. package/FetchOptions.d.ts +2 -2
  14. package/FormRows.js +158 -157
  15. package/JSONTree.js +354 -360
  16. package/{MIGRATION.mdx → MIGRATION.md} +13 -43
  17. package/{MIGRATION.v5.mdx → MIGRATION.v5.md} +67 -1
  18. package/Markdown.js +3 -4
  19. package/Menu.js +194 -195
  20. package/Modal.js +18 -18
  21. package/ModalLayer.js +171 -217
  22. package/Multiselect.js +785 -778
  23. package/Number.js +103 -102
  24. package/Popover.js +48 -46
  25. package/RadioBar.js +144 -146
  26. package/Resize.js +149 -151
  27. package/ResultsMenu.js +112 -114
  28. package/Search.js +49 -49
  29. package/Select.js +455 -457
  30. package/Slider.js +328 -331
  31. package/Switch.js +251 -178
  32. package/TabBar.js +277 -280
  33. package/Table.js +1212 -1178
  34. package/Text.js +45 -46
  35. package/Tooltip.js +192 -189
  36. package/Tree.js +177 -188
  37. package/package.json +10 -9
  38. package/types/src/Code/Code.d.ts +1 -1
  39. package/types/src/Color/Color.d.ts +2 -2
  40. package/types/src/ControlGroup/ControlGroup.d.ts +1 -2
  41. package/types/src/Dropdown/Dropdown.d.ts +5 -2
  42. package/types/src/Layer/Layer.d.ts +2 -1
  43. package/types/src/Layer/index.d.ts +1 -0
  44. package/types/src/ModalLayer/ModalLayer.d.ts +16 -21
  45. package/types/src/Number/Number.d.ts +1 -1
  46. package/types/src/Popover/Popover.d.ts +5 -2
  47. package/types/src/Table/HeadCell.d.ts +6 -1
  48. package/types/src/Table/HeadInner.d.ts +3 -1
  49. package/types/src/Tooltip/Tooltip.d.ts +7 -7
  50. package/types/src/fixtures/useFetchOptions.d.ts +33 -0
  51. package/useRovingFocus.js +20 -23
  52. package/types/src/fixtures/FetchOptions.d.ts +0 -76
package/Popover.js CHANGED
@@ -82,8 +82,8 @@
82
82
  const f = require("lodash/every");
83
83
  var s = e.n(f);
84
84
  // CONCATENATED MODULE: external "lodash/has"
85
- const v = require("lodash/has");
86
- var p = e.n(v);
85
+ const p = require("lodash/has");
86
+ var v = e.n(p);
87
87
  // CONCATENATED MODULE: external "lodash/intersection"
88
88
  const d = require("lodash/intersection");
89
89
  var h = e.n(d);
@@ -209,8 +209,8 @@
209
209
  function _(e) {
210
210
  var t = e.align, r = e.anchorPos, n = e.scrollContainerPos, o = e.canCoverAnchor, a = e.defaultPlacement, i = e.outerContainerEl, l = e.padding, c = e.repositionMode, u = e.windowHeight, f = e.windowWidth;
211
211
  var s = c === "flip";
212
- var v = c === "any";
213
- var p = s || v;
212
+ var p = c === "any";
213
+ var v = s || p;
214
214
  var d = e.placement || a;
215
215
  // Translate vertical/horizontal to above/below/left/right
216
216
  if (a === "vertical") {
@@ -243,18 +243,18 @@
243
243
  var R = (t === "edge" ? r.top + i.offsetHeight - l : r.bottom + i.offsetHeight / 2) > u;
244
244
  // Handle each of the four placement options individually.
245
245
  if (O === "above") {
246
- if (!P && p) {
246
+ if (!P && v) {
247
247
  if (j) {
248
248
  return _(I(I({}, e), {}, {
249
249
  placement: "below"
250
250
  }));
251
251
  }
252
- if (v && E) {
252
+ if (p && E) {
253
253
  return _(I(I({}, e), {}, {
254
254
  placement: "right"
255
255
  }));
256
256
  }
257
- if (v && C) {
257
+ if (p && C) {
258
258
  return _(I(I({}, e), {}, {
259
259
  placement: "left"
260
260
  }));
@@ -281,18 +281,18 @@
281
281
  }
282
282
  }
283
283
  if (O === "below") {
284
- if (!j && p) {
284
+ if (!j && v) {
285
285
  if (P && x) {
286
286
  return _(I(I({}, e), {}, {
287
287
  placement: "above"
288
288
  }));
289
289
  }
290
- if (v && E) {
290
+ if (p && E) {
291
291
  return _(I(I({}, e), {}, {
292
292
  placement: "right"
293
293
  }));
294
294
  }
295
- if (v && C) {
295
+ if (p && C) {
296
296
  return _(I(I({}, e), {}, {
297
297
  placement: "left"
298
298
  }));
@@ -315,18 +315,18 @@
315
315
  }
316
316
  }
317
317
  if (O === "left") {
318
- if (!C && p) {
318
+ if (!C && v) {
319
319
  if (E) {
320
320
  return _(I(I({}, e), {}, {
321
321
  placement: "right"
322
322
  }));
323
323
  }
324
- if (v && j) {
324
+ if (p && j) {
325
325
  return _(I(I({}, e), {}, {
326
326
  placement: "below"
327
327
  }));
328
328
  }
329
- if (v && P) {
329
+ if (p && P) {
330
330
  return _(I(I({}, e), {}, {
331
331
  placement: "above"
332
332
  }));
@@ -346,18 +346,18 @@
346
346
  }
347
347
  }
348
348
  if (O === "right") {
349
- if (!E && p) {
349
+ if (!E && v) {
350
350
  if (C) {
351
351
  return _(I(I({}, e), {}, {
352
352
  placement: "left"
353
353
  }));
354
354
  }
355
- if (v && j) {
355
+ if (p && j) {
356
356
  return _(I(I({}, e), {}, {
357
357
  placement: "below"
358
358
  }));
359
359
  }
360
- if (v && P) {
360
+ if (p && P) {
361
361
  return _(I(I({}, e), {}, {
362
362
  placement: "above"
363
363
  }));
@@ -508,10 +508,10 @@
508
508
  var u = "0 ".concat(l);
509
509
  var f = "".concat(a.width, " ").concat(l);
510
510
  var s = "".concat(i, " ").concat(l);
511
- var v = "".concat(i, " ").concat(c);
512
- var p = "".concat(i + r.width, " ").concat(l);
511
+ var p = "".concat(i, " ").concat(c);
512
+ var v = "".concat(i + r.width, " ").concat(l);
513
513
  var d = "".concat(i + r.width, " ").concat(c);
514
- var h = "\n M ".concat(u, "\n S ").concat(s, " , ").concat(v, "\n L ").concat(s, "\n L ").concat(p, "\n L ").concat(d, "\n S ").concat(p, " , ").concat(f, "\n ");
514
+ var h = "\n M ".concat(u, "\n S ").concat(s, " , ").concat(p, "\n L ").concat(s, "\n L ").concat(v, "\n L ").concat(d, "\n S ").concat(v, " , ").concat(f, "\n ");
515
515
  return {
516
516
  hitAreaPath: h,
517
517
  hitAreaStyle: {
@@ -556,7 +556,7 @@
556
556
  var le = n().forwardRef((function(e, t) {
557
557
  var o = e.anchorRect, a = e.popoverEl, i = e.popoverPlacement;
558
558
  var l = (0, r.useState)(null), c = Z(l, 2), u = c[0], f = c[1];
559
- var s = (0, r.useState)({}), v = Z(s, 2), p = v[0], d = v[1];
559
+ var s = (0, r.useState)({}), p = Z(s, 2), v = p[0], d = p[1];
560
560
  (0, r.useEffect)((function() {
561
561
  var e = ie({
562
562
  anchorRect: o,
@@ -570,7 +570,7 @@
570
570
 
571
571
  return n().createElement(Q, {
572
572
  "data-test": "popover-hit-area",
573
- style: p
573
+ style: v
574
574
  }, n().createElement("path", {
575
575
  d: u,
576
576
  ref: t
@@ -603,7 +603,7 @@
603
603
  se.propTypes = fe;
604
604
  // CONCATENATED MODULE: ./src/utils/ssrDocument.ts
605
605
  /* eslint-disable @typescript-eslint/no-empty-function */
606
- var ve = {
606
+ var pe = {
607
607
  body: {
608
608
  appendChild: function e() {
609
609
  return [];
@@ -657,16 +657,16 @@
657
657
  search: ""
658
658
  }
659
659
  };
660
- function pe() {
661
- var e = typeof document !== "undefined" ? document : ve;
660
+ function ve() {
661
+ var e = typeof document !== "undefined" ? document : pe;
662
662
  return e;
663
663
  }
664
- var de = pe();
664
+ var de = ve();
665
665
  /* harmony default export */ const he = /* unused pure expression or super */ null && de;
666
666
  // CONCATENATED MODULE: ./src/utils/ssrWindow.ts
667
667
  /* eslint-disable @typescript-eslint/no-empty-function */
668
668
  var me = {
669
- document: ve,
669
+ document: pe,
670
670
  navigator: {
671
671
  userAgent: ""
672
672
  },
@@ -1026,22 +1026,22 @@
1026
1026
  // top edge
1027
1027
  var f = -(a.offsetHeight / 2 - (X + r + X / 2));
1028
1028
  var s = t.center - (o.top + a.offsetHeight / 2) - X / 2;
1029
- var v = l()(s, f, u);
1029
+ var p = l()(s, f, u);
1030
1030
  // right edge
1031
- var p = a.offsetWidth / 2 - (c + X + r);
1031
+ var v = a.offsetWidth / 2 - (c + X + r);
1032
1032
  // left edge
1033
1033
  var d = -(a.offsetWidth / 2 - (X + r));
1034
1034
  var h = t.middle - (o.left + a.offsetWidth / 2) - X;
1035
- var m = l()(h, d, p);
1035
+ var m = l()(h, d, v);
1036
1036
  var b = {
1037
1037
  left: {
1038
1038
  translateX: X / 2,
1039
- translateY: v,
1039
+ translateY: p,
1040
1040
  rotate: 90
1041
1041
  },
1042
1042
  right: {
1043
1043
  translateX: -X / 2,
1044
- translateY: v,
1044
+ translateY: p,
1045
1045
  rotate: -90
1046
1046
  },
1047
1047
  above: {
@@ -1083,8 +1083,8 @@
1083
1083
  width: Math.round(a.width),
1084
1084
  height: Math.round(a.height)
1085
1085
  };
1086
- var l = o && p()(o, "x");
1087
- var c = o && p()(o, "y");
1086
+ var l = o && v()(o, "x");
1087
+ var c = o && v()(o, "y");
1088
1088
  i.left = l ? a.left + ((o === null || o === void 0 ? void 0 : o.x) || 0) : a.left;
1089
1089
  i.top = c ? a.top + ((o === null || o === void 0 ? void 0 : o.y) || 0) : a.top;
1090
1090
  i.right = l ? i.left + i.width : a.left + i.width || a.right;
@@ -1125,9 +1125,10 @@
1125
1125
  * `Dropdown` covers use cases where you might consider using `Popover` directly.
1126
1126
  */ function tt(e) {
1127
1127
  var t, o;
1128
- var a = e.align, i = a === void 0 ? "center" : a, l = e.anchor, c = e.animation, f = c === void 0 ? true : c, s = e.animationConfig, v = s === void 0 ? et : s, p = e.appearance, d = p === void 0 ? "normal" : p, m = e.autoCloseWhenOffScreen, b = m === void 0 ? true : m, y = e.canCoverAnchor, w = e.children, O = e.closeReasons, C = O === void 0 ? Ke : O, x = e.defaultPlacement, k = x === void 0 ? "below" : x, R = e.elementRef, q = e.hideArrow, H = e.hitAreaRef, I = e.id, L = e.onRequestClose, D = e.open, F = e.outerRef, $ = e.pointTo, N = e.repositionMode, V = N === void 0 ? "flip" : N, z = e.retainFocus, K = z === void 0 ? true : z, Y = e.takeFocus, Q = Ve(e, [ "align", "anchor", "animation", "animationConfig", "appearance", "autoCloseWhenOffScreen", "canCoverAnchor", "children", "closeReasons", "defaultPlacement", "elementRef", "hideArrow", "hitAreaRef", "id", "onRequestClose", "open", "outerRef", "pointTo", "repositionMode", "retainFocus", "takeFocus" ]);
1128
+ var a = e.align, i = a === void 0 ? "center" : a, l = e.anchor, c = e.animation, f = c === void 0 ? true : c, s = e.animationConfig, p = s === void 0 ? et : s, v = e.appearance, d = v === void 0 ? "normal" : v, m = e.autoCloseWhenOffScreen, b = m === void 0 ? true : m, y = e.canCoverAnchor, w = e.children, O = e.closeReasons, C = O === void 0 ? Ke : O, x = e.defaultPlacement, k = x === void 0 ? "below" : x, R = e.elementRef, q = e.hideArrow, H = e.hitAreaRef, I = e.id, L = e.onRequestClose, D = e.open, F = e.outerRef, $ = e.pointTo, N = e.repositionMode, V = N === void 0 ? "flip" : N, z = e.retainFocus, K = z === void 0 ? true : z, Y = e.takeFocus, Q = Ve(e, [ "align", "anchor", "animation", "animationConfig", "appearance", "autoCloseWhenOffScreen", "canCoverAnchor", "children", "closeReasons", "defaultPlacement", "elementRef", "hideArrow", "hitAreaRef", "id", "onRequestClose", "open", "outerRef", "pointTo", "repositionMode", "retainFocus", "takeFocus" ]);
1129
1129
  // @docs-props-type PopoverPropsBase
1130
- var Z = (0, r.useState)(D), ee = Le(Z, 2), te = ee[0], re = ee[1];
1130
+ if (false) {}
1131
+ var Z = (0, r.useState)(D), ee = Le(Z, 2), te = ee[0], re = ee[1];
1131
1132
  var ne = (0, r.useState)(false), oe = Le(ne, 2), ae = oe[0], ie = oe[1];
1132
1133
  if (D !== ae) {
1133
1134
  // formerly implemented by componentWillReceiveProps
@@ -1140,8 +1141,8 @@
1140
1141
  }
1141
1142
  // this is a single state object because all these properties
1142
1143
  // are updated at the same time by setPlacement
1143
- var le = (0, r.useState)({}), fe = Le(le, 2), se = fe[0], ve = fe[1];
1144
- var pe = (0, r.useRef)(true);
1144
+ var le = (0, r.useState)({}), fe = Le(le, 2), se = fe[0], pe = fe[1];
1145
+ var ve = (0, r.useRef)(true);
1145
1146
  var de = (0, r.useRef)(false);
1146
1147
  var he = (0, r.useRef)(null);
1147
1148
  var me = (0, r.useRef)(null);
@@ -1190,7 +1191,7 @@
1190
1191
  var Fe = xe ? De : X;
1191
1192
  // do not call this directly - use setPlacement (the throttled version) instead
1192
1193
  var $e = (0, r.useCallback)((function(e) {
1193
- ve((function(t) {
1194
+ pe((function(t) {
1194
1195
  var r, n;
1195
1196
  // If these conditions are not met, we cannot set the popover.
1196
1197
  if (!D || !ye.current || !l) {
@@ -1228,8 +1229,8 @@
1228
1229
  padding: Fe,
1229
1230
  windowWidth: Se.innerWidth,
1230
1231
  windowHeight: Se.innerHeight
1231
- }), f = u.placement, s = u.outerContainerStyle, v = u.maxHeight, p = u.maxWidth;
1232
- var d = Ye(a, t.anchorPos) && Ye(s, t.outerContainerStyle) && f === t.placement && v === t.maxHeight && p === t.maxWidth;
1232
+ }), f = u.placement, s = u.outerContainerStyle, p = u.maxHeight, v = u.maxWidth;
1233
+ var d = Ye(a, t.anchorPos) && Ye(s, t.outerContainerStyle) && f === t.placement && p === t.maxHeight && v === t.maxWidth;
1233
1234
  var h = true;
1234
1235
  var m = {};
1235
1236
  var g;
@@ -1256,8 +1257,8 @@
1256
1257
  arrowStyleTransformMeta: g,
1257
1258
  outerContainerStyle: s,
1258
1259
  placement: f,
1259
- maxHeight: v,
1260
- maxWidth: p
1260
+ maxHeight: p,
1261
+ maxWidth: v
1261
1262
  };
1262
1263
  }));
1263
1264
  }), [ i, l, b, Ie, Fe, y, Te, k, D, $, V, Pe, Se.innerHeight, Se.innerWidth ]);
@@ -1295,7 +1296,7 @@
1295
1296
  ze.cancel();
1296
1297
  _e.cancel();
1297
1298
  Ne.cancel();
1298
- pe.current = false;
1299
+ ve.current = false;
1299
1300
  };
1300
1301
  // no dependencies here since this needs to set up a cleanup function exactly once
1301
1302
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1322,7 +1323,7 @@
1322
1323
  })) : null;
1323
1324
  var tt = (0, r.useCallback)((function() {
1324
1325
  // checking allowAnimationUpdates avoids trying to update state after the component has been unmounted - see SUI-3666
1325
- if (pe.current) {
1326
+ if (ve.current) {
1326
1327
  re(false);
1327
1328
  }
1328
1329
  }), []);
@@ -1365,8 +1366,8 @@
1365
1366
  tension: 300,
1366
1367
  friction: 20,
1367
1368
  clamp: true
1368
- }, v);
1369
- }), [ v ]);
1369
+ }, p);
1370
+ }), [ p ]);
1370
1371
  var lt = (0, j.useAnimation)({
1371
1372
  from: at,
1372
1373
  to: we,
@@ -1417,6 +1418,7 @@
1417
1418
  }, ft))))));
1418
1419
  }
1419
1420
  tt.propTypes = Xe;
1421
+ tt.possibleCloseReasons = Ke;
1420
1422
  /* harmony default export */ const rt = tt;
1421
1423
  // CONCATENATED MODULE: ./src/Popover/PopoverMenuContext.tsx
1422
1424
  var nt = (0, r.createContext)({});