@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/Date.js CHANGED
@@ -61,8 +61,8 @@
61
61
  e.r(n);
62
62
  // EXPORTS
63
63
  e.d(n, {
64
- default: () => /* reexport */ $,
65
- validateValue: () => /* reexport */ K
64
+ default: () => /* reexport */ V,
65
+ validateValue: () => /* reexport */ F
66
66
  });
67
67
  // CONCATENATED MODULE: external "react"
68
68
  const t = require("react");
@@ -72,13 +72,13 @@
72
72
  var o = e.n(a);
73
73
  // CONCATENATED MODULE: external "lodash/omit"
74
74
  const l = require("lodash/omit");
75
- var i = e.n(l);
75
+ var u = e.n(l);
76
76
  // CONCATENATED MODULE: external "moment"
77
- const u = require("moment");
78
- var c = e.n(u);
77
+ const i = require("moment");
78
+ var c = e.n(i);
79
79
  // CONCATENATED MODULE: external "@splunk/react-ui/Calendar"
80
- const s = require("@splunk/react-ui/Calendar");
81
- var f = e.n(s);
80
+ const f = require("@splunk/react-ui/Calendar");
81
+ var s = e.n(f);
82
82
  // CONCATENATED MODULE: external "@splunk/react-ui/Popover"
83
83
  const d = require("@splunk/react-ui/Popover");
84
84
  var v = e.n(d);
@@ -87,34 +87,24 @@
87
87
  var y = e.n(p);
88
88
  // CONCATENATED MODULE: external "@splunk/ui-utils/id"
89
89
  const m = require("@splunk/ui-utils/id");
90
- // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
91
- const b = require("@splunk/ui-utils/keyboard");
92
90
  // CONCATENATED MODULE: external "styled-components"
93
- const g = require("styled-components");
94
- var h = e.n(g);
91
+ const b = require("styled-components");
92
+ var g = e.n(b);
95
93
  // CONCATENATED MODULE: external "@splunk/react-icons/Calendar"
96
- const C = require("@splunk/react-icons/Calendar");
97
- var k = e.n(C);
94
+ const h = require("@splunk/react-icons/Calendar");
95
+ var C = e.n(h);
98
96
  // CONCATENATED MODULE: external "@splunk/react-ui/Text"
99
- const S = require("@splunk/react-ui/Text");
100
- var O = e.n(S);
101
- // CONCATENATED MODULE: external "@splunk/themes"
102
- const w = require("@splunk/themes");
97
+ const k = require("@splunk/react-ui/Text");
98
+ var S = e.n(k);
103
99
  // CONCATENATED MODULE: ./src/Date/DateStyles.ts
104
- var D = h()(O()).withConfig({
100
+ var O = g()(S()).withConfig({
105
101
  displayName: "DateStyles__StyledText",
106
102
  componentId: "kacgdc-0"
107
- })([ "cursor:", ";&[data-inline]{width:160px;}" ], (0, w.pickVariant)("$disabled", {
108
- false: "text",
109
- true: "not-allowed"
110
- }));
111
- var q = h()(k()).withConfig({
103
+ })([ "&[data-inline]{width:160px;}" ]);
104
+ var w = g()(C()).withConfig({
112
105
  displayName: "DateStyles__StyledCalendarIcon",
113
106
  componentId: "kacgdc-1"
114
- })([ "color:", ";transform:translateY(1px);" ], (0, w.pickVariant)("$disabled", {
115
- false: w.variables.contentColorMuted,
116
- true: w.variables.contentColorDisabled
117
- }));
107
+ })([ "transform:translateY(1px);" ]);
118
108
  // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
119
109
  /**
120
110
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
@@ -122,7 +112,7 @@
122
112
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
123
113
  * @param current - The new value of the ref.
124
114
  */
125
- function j(e, n) {
115
+ function D(e, n) {
126
116
  if (e) {
127
117
  if (typeof e === "function") {
128
118
  e(n);
@@ -135,8 +125,8 @@
135
125
  }
136
126
  }
137
127
  // CONCATENATED MODULE: ./src/Date/Date.tsx
138
- function I() {
139
- return I = Object.assign ? Object.assign.bind() : function(e) {
128
+ function j() {
129
+ return j = Object.assign ? Object.assign.bind() : function(e) {
140
130
  for (var n = 1; n < arguments.length; n++) {
141
131
  var t = arguments[n];
142
132
  for (var r in t) {
@@ -144,56 +134,56 @@
144
134
  }
145
135
  }
146
136
  return e;
147
- }, I.apply(null, arguments);
137
+ }, j.apply(null, arguments);
148
138
  }
149
- function x(e, n) {
150
- return E(e) || P(e, n) || T(e, n) || M();
139
+ function I(e, n) {
140
+ return E(e) || A(e, n) || T(e, n) || q();
151
141
  }
152
- function M() {
142
+ function q() {
153
143
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
154
144
  }
155
145
  function T(e, n) {
156
146
  if (e) {
157
- if ("string" == typeof e) return A(e, n);
147
+ if ("string" == typeof e) return x(e, n);
158
148
  var t = {}.toString.call(e).slice(8, -1);
159
- return "Object" === t && e.constructor && (t = e.constructor.name), "Map" === t || "Set" === t ? Array.from(e) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? A(e, n) : void 0;
149
+ return "Object" === t && e.constructor && (t = e.constructor.name), "Map" === t || "Set" === t ? Array.from(e) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? x(e, n) : void 0;
160
150
  }
161
151
  }
162
- function A(e, n) {
152
+ function x(e, n) {
163
153
  (null == n || n > e.length) && (n = e.length);
164
154
  for (var t = 0, r = Array(n); t < n; t++) {
165
155
  r[t] = e[t];
166
156
  }
167
157
  return r;
168
158
  }
169
- function P(e, n) {
159
+ function A(e, n) {
170
160
  var t = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
171
161
  if (null != t) {
172
- var r, a, o, l, i = [], u = !0, c = !1;
162
+ var r, a, o, l, u = [], i = !0, c = !1;
173
163
  try {
174
164
  if (o = (t = t.call(e)).next, 0 === n) {
175
165
  if (Object(t) !== t) return;
176
- u = !1;
177
- } else for (;!(u = (r = o.call(t)).done) && (i.push(r.value), i.length !== n); u = !0) {
166
+ i = !1;
167
+ } else for (;!(i = (r = o.call(t)).done) && (u.push(r.value), u.length !== n); i = !0) {
178
168
  }
179
169
  } catch (e) {
180
170
  c = !0, a = e;
181
171
  } finally {
182
172
  try {
183
- if (!u && null != t["return"] && (l = t["return"](), Object(l) !== l)) return;
173
+ if (!i && null != t["return"] && (l = t["return"](), Object(l) !== l)) return;
184
174
  } finally {
185
175
  if (c) throw a;
186
176
  }
187
177
  }
188
- return i;
178
+ return u;
189
179
  }
190
180
  }
191
181
  function E(e) {
192
182
  if (Array.isArray(e)) return e;
193
183
  }
194
- function _(e, n) {
184
+ function M(e, n) {
195
185
  if (null == e) return {};
196
- var t, r, a = R(e, n);
186
+ var t, r, a = P(e, n);
197
187
  if (Object.getOwnPropertySymbols) {
198
188
  var o = Object.getOwnPropertySymbols(e);
199
189
  for (r = 0; r < o.length; r++) {
@@ -202,7 +192,7 @@
202
192
  }
203
193
  return a;
204
194
  }
205
- function R(e, n) {
195
+ function P(e, n) {
206
196
  if (null == e) return {};
207
197
  var t = {};
208
198
  for (var r in e) {
@@ -215,7 +205,7 @@
215
205
  }
216
206
  /** @public */
217
207
  /** @public */
218
- /** @public */ var V = {
208
+ /** @public */ var _ = {
219
209
  defaultValue: o().string,
220
210
  describedBy: o().string,
221
211
  disabled: o().bool,
@@ -245,40 +235,40 @@
245
235
  * @name momentFormat
246
236
  * @memberOf Date
247
237
  * @type string
248
- */ var F = "YYYY-MM-DD";
249
- var K = function e(n) {
238
+ */ var R = "YYYY-MM-DD";
239
+ var F = function e(n) {
250
240
  if (n === "") {
251
241
  return;
252
242
  }
253
- if (!c()(n, F).isValid()) {
243
+ if (!c()(n, R).isValid()) {
254
244
  // eslint-disable-next-line no-console
255
245
  console.error('Invalid date string value "'.concat(n, '" provided to Moment.'));
256
246
  }
257
247
  };
258
- function Y(e) {
259
- var n = e.defaultValue, a = e.disabled, o = e.elementRef, l = e.highlightToday, u = e.inline, d = u === void 0 ? true : u, p = e.inputOnly, g = e.locale, h = g === void 0 ? "en_US" : g, C = e.name, k = e.onChange, S = e.onClick, O = e.onFocus, w = e.onKeyDown, M = e.value, T = _(e, [ "defaultValue", "disabled", "elementRef", "highlightToday", "inline", "inputOnly", "locale", "name", "onChange", "onClick", "onFocus", "onKeyDown", "value" ]);
248
+ function K(e) {
249
+ var n = e.defaultValue, a = e.disabled, o = e.elementRef, l = e.highlightToday, i = e.inline, d = i === void 0 ? true : i, p = e.inputOnly, b = e.locale, g = b === void 0 ? "en_US" : b, h = e.name, C = e.onChange, k = e.onClick, S = e.onFocus, q = e.onKeyDown, T = e.value, x = M(e, [ "defaultValue", "disabled", "elementRef", "highlightToday", "inline", "inputOnly", "locale", "name", "onChange", "onClick", "onFocus", "onKeyDown", "value" ]);
260
250
  // @docs-props-type DatePropsBase
261
251
  var A = y()({
262
252
  componentName: "Date",
263
253
  /* eslint-disable-next-line prefer-rest-params */
264
254
  componentProps: arguments[0]
265
255
  });
266
- var P = (0, t.useState)(null), E = x(P, 2), R = E[0], V = E[1];
267
- var K = (0, t.useState)(false), $ = x(K, 2), B = $[0], N = $[1];
268
- var U = (0, t.useState)(), z = x(U, 2), G = z[0], H = z[1];
269
- var J = (0, t.useState)((function() {
256
+ var E = (0, t.useState)(null), P = I(E, 2), _ = P[0], F = P[1];
257
+ var V = (0, t.useState)(false), Y = I(V, 2), B = Y[0], N = Y[1];
258
+ var U = (0, t.useState)(), z = I(U, 2), $ = z[0], G = z[1];
259
+ var H = (0, t.useState)((function() {
270
260
  if (typeof n === "string") {
271
261
  return n;
272
262
  }
273
- return c()().locale(h).format(F);
274
- })), L = x(J, 2), Q = L[0], W = L[1];
275
- var X = (0, t.useState)(null), Z = x(X, 2), ee = Z[0], ne = Z[1];
276
- var te = (0, t.useState)(null), re = x(te, 2), ae = re[0], oe = re[1];
277
- var le = (0, t.useRef)(false);
278
- var ie = (0, m.createDOMID)("calendar");
263
+ return c()().locale(g).format(R);
264
+ })), J = I(H, 2), L = J[0], Q = J[1];
265
+ var W = (0, t.useState)(null), X = I(W, 2), Z = X[0], ee = X[1];
266
+ var ne = (0, t.useState)(null), te = I(ne, 2), re = te[0], ae = te[1];
267
+ var oe = (0, t.useRef)(false);
268
+ var le = (0, m.createDOMID)("calendar");
279
269
  var ue = (0, t.useMemo)((function() {
280
- return A ? M : Q;
281
- }), [ A, M, Q ]);
270
+ return A ? T : L;
271
+ }), [ A, T, L ]);
282
272
  (0, t.useEffect)((function() {
283
273
  if (false) {}
284
274
  }), [ ue ]);
@@ -287,156 +277,153 @@
287
277
  * If `openWithFocus` and `calendarOpen` are set the user is attempting to navigate to the dropdown, but it's closed.
288
278
  * On the first update following the state change set focus to the active day within the calendar.
289
279
  */
290
- if (le.current && B) {
291
- le.current = false;
292
- (0, s.focusActiveDay)(ee);
280
+ if (oe.current && B) {
281
+ oe.current = false;
282
+ (0, f.focusActiveDay)(Z);
293
283
  }
294
- }), [ ee, B ]);
295
- var ce = (0, t.useMemo)((function() {
296
- if (G === undefined) {
284
+ }), [ Z, B ]);
285
+ var ie = (0, t.useMemo)((function() {
286
+ if ($ === undefined) {
297
287
  if (ue === undefined || ue === "") {
298
288
  return "";
299
289
  }
300
- return c()(ue, F, h).format("l");
290
+ return c()(ue, R, g).format("l");
301
291
  }
302
- return G;
303
- }), [ ue, h, G ]);
304
- var se = (0, t.useCallback)((function(e, n, t) {
292
+ return $;
293
+ }), [ ue, g, $ ]);
294
+ var ce = (0, t.useCallback)((function(e, n, t) {
305
295
  var r = n.value;
306
296
  if (t !== "textInput") {
307
- ae === null || ae === void 0 ? void 0 : ae.focus();
297
+ re === null || re === void 0 ? void 0 : re.focus();
308
298
  }
309
299
  if (ue !== r) {
310
300
  N(false);
311
- H(undefined);
312
- W(A ? undefined : r);
313
- k === null || k === void 0 ? void 0 : k(e, {
301
+ G(undefined);
302
+ Q(A ? undefined : r);
303
+ C === null || C === void 0 ? void 0 : C(e, {
314
304
  value: r,
315
- name: C
305
+ name: h
316
306
  });
317
307
  } else {
318
308
  N(false);
319
309
  }
320
- }), [ ue, ae, A, C, k ]);
310
+ }), [ ue, re, A, h, C ]);
321
311
  var fe = (0, t.useCallback)((function(e) {
322
- var n = c()(G, "l", h);
323
- if (G === "") {
324
- se(e, {
312
+ var n = c()($, "l", g);
313
+ if ($ === "") {
314
+ ce(e, {
325
315
  value: ""
326
316
  }, "textInput");
327
317
  } else if (n.isValid()) {
328
- se(e, {
329
- value: n.format(Y.momentFormat)
318
+ ce(e, {
319
+ value: n.format(K.momentFormat)
330
320
  }, "textInput");
331
321
  } else {
332
322
  N(false);
333
- H(undefined);
323
+ G(undefined);
334
324
  }
335
- }), [ se, h, G ]);
336
- var de = (0, t.useCallback)((function(e, n) {
325
+ }), [ ce, g, $ ]);
326
+ var se = (0, t.useCallback)((function(e, n) {
337
327
  if (!p) {
338
328
  N(true);
339
329
  }
340
- O === null || O === void 0 ? void 0 : O(e, n);
341
- }), [ p, O ]);
342
- var ve = (0, t.useCallback)((function(e) {
330
+ S === null || S === void 0 ? void 0 : S(e, n);
331
+ }), [ p, S ]);
332
+ var de = (0, t.useCallback)((function(e) {
343
333
  if (!p && !B) {
344
334
  N(true);
345
335
  }
346
- S === null || S === void 0 ? void 0 : S(e);
347
- }), [ B, p, S ]);
348
- var pe = (0, t.useCallback)((function(e, n) {
336
+ k === null || k === void 0 ? void 0 : k(e);
337
+ }), [ B, p, k ]);
338
+ var ve = (0, t.useCallback)((function(e, n) {
349
339
  var t = n.value;
350
- H(t);
340
+ G(t);
351
341
  N(!p);
352
342
  }), [ p ]);
353
- var ye = (0, t.useCallback)((function(e) {
354
- var n = (0, b.keycode)(e.nativeEvent);
355
- if (n === "enter" || n === "tab") {
343
+ var pe = (0, t.useCallback)((function(e) {
344
+ var n = e.key;
345
+ if (n === "Enter" || n === "Tab") {
356
346
  fe(e);
357
- } else if (!p && n === "down") {
347
+ } else if (!p && n === "ArrowDown") {
358
348
  e.preventDefault();
359
349
  if (!B) {
360
- le.current = true;
350
+ oe.current = true;
361
351
  N(true);
362
- } else if (ee) {
363
- (0, s.focusActiveDay)(ee);
352
+ } else if (Z) {
353
+ (0, f.focusActiveDay)(Z);
364
354
  }
365
- } else if (n === "esc") {
355
+ } else if (n === "Escape") {
366
356
  N(false);
367
- H(undefined);
368
- ae === null || ae === void 0 ? void 0 : ae.focus();
357
+ G(undefined);
358
+ re === null || re === void 0 ? void 0 : re.focus();
369
359
  }
370
- w === null || w === void 0 ? void 0 : w(e);
371
- }), [ fe, ee, B, ae, p, w ]);
372
- var me = (0, t.useCallback)((function(e) {
373
- V(e);
374
- j(o, e);
360
+ q === null || q === void 0 ? void 0 : q(e);
361
+ }), [ fe, Z, B, re, p, q ]);
362
+ var ye = (0, t.useCallback)((function(e) {
363
+ F(e);
364
+ D(o, e);
375
365
  }), [ o ]);
366
+ var me = (0, t.useCallback)((function(e) {
367
+ ae(e);
368
+ }), []);
376
369
  var be = (0, t.useCallback)((function(e) {
377
- oe(e);
370
+ ee(e);
378
371
  }), []);
379
372
  var ge = (0, t.useCallback)((function(e) {
380
- ne(e);
381
- }), []);
382
- var he = (0, t.useCallback)((function(e) {
383
373
  var n = e.event, t = e.reason;
384
- if ((t === "clickAway" || t === "escapeKey") && n !== undefined && n.target !== R) {
374
+ if ((t === "clickAway" || t === "escapeKey") && n !== undefined && n.target !== _) {
385
375
  fe(n);
386
376
  if (t === "escapeKey") {
387
- ae === null || ae === void 0 ? void 0 : ae.focus();
377
+ re === null || re === void 0 ? void 0 : re.focus();
388
378
  }
389
379
  }
390
- }), [ R, ae, fe ]);
391
- var Ce = !p && r().createElement(q, {
392
- $disabled: a
393
- });
394
- var ke;
395
- var Se = {};
380
+ }), [ _, re, fe ]);
381
+ var he = !p && r().createElement(w, null);
382
+ var Ce;
383
+ var ke = {};
396
384
  if (!p) {
397
- Se.role = "combobox";
398
- Se["aria-controls"] = B ? ie : undefined;
399
- Se["aria-expanded"] = a ? false : B;
400
- Se["aria-haspopup"] = true;
401
- ke = r().createElement(v(), {
402
- anchor: R,
403
- id: ie,
385
+ ke.role = "combobox";
386
+ ke["aria-controls"] = B ? le : undefined;
387
+ ke["aria-expanded"] = a ? false : B;
388
+ ke["aria-haspopup"] = true;
389
+ Ce = r().createElement(v(), {
390
+ anchor: _,
391
+ id: le,
404
392
  open: a ? false : B,
405
- onRequestClose: he
406
- }, r().createElement(f(), {
407
- elementRef: ge,
393
+ onRequestClose: ge
394
+ }, r().createElement(s(), {
395
+ elementRef: be,
408
396
  highlightToday: l,
409
- locale: h,
410
- onChange: se,
397
+ locale: g,
398
+ onChange: ce,
411
399
  value: ue === "" ? undefined : ue
412
400
  }));
413
401
  }
414
402
 
415
- return r().createElement(D, I({
403
+ return r().createElement(O, j({
416
404
  autoCapitalize: "off",
417
405
  autoComplete: "off",
418
406
  autoCorrect: "off",
419
407
  spellCheck: false,
420
408
  "data-test": "date",
421
409
  "data-test-value": ue,
422
- "data-test-popover-id": ie,
410
+ "data-test-popover-id": le,
423
411
  disabled: a,
424
- elementRef: me,
412
+ elementRef: ye,
425
413
  inline: d,
426
- inputRef: be,
427
- name: C,
428
- onChange: pe,
429
- onClick: ve,
430
- onFocus: de,
431
- onKeyDown: ye,
432
- value: ce,
433
- startAdornment: Ce,
434
- $disabled: a
435
- }, Se, i()(T, "multiline", "onSelect", "spellCheck")), ke);
414
+ inputRef: me,
415
+ name: h,
416
+ onChange: ve,
417
+ onClick: de,
418
+ onFocus: se,
419
+ onKeyDown: pe,
420
+ value: ie,
421
+ startAdornment: he
422
+ }, ke, u()(x, "multiline", "onSelect", "spellCheck")), Ce);
436
423
  }
437
- Y.propTypes = V;
438
- Y.momentFormat = F;
439
- /* harmony default export */ const $ = Y;
424
+ K.propTypes = _;
425
+ K.momentFormat = R;
426
+ /* harmony default export */ const V = K;
440
427
  // only for styled components using Date
441
428
  // CONCATENATED MODULE: ./src/Date/index.ts
442
429
  module.exports = n;