@splunk/react-ui 5.8.0 → 5.9.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/Dropdown.js CHANGED
@@ -171,7 +171,7 @@
171
171
  toggle: a().element.isRequired
172
172
  };
173
173
  function O(e) {
174
- var o = e["aria-labelledby"], t = e.align, a = t === void 0 ? "center" : t, l = e.canCoverAnchor, u = l === void 0 ? true : l, p = e.children, v = e.closeReasons, y = v === void 0 ? C : v, g = e.defaultPlacement, b = g === void 0 ? "below" : g, m = e.elementRef, h = e.focusToggleReasons, O = h === void 0 ? k : h, w = e.inputId, R = e.open, S = e.openWithArrowKeys, A = e.onRequestClose, I = e.onRequestOpen, q = e.repositionMode, P = q === void 0 ? "flip" : q, K = e.retainFocus, j = K === void 0 ? false : K, D = e.takeFocus, M = D === void 0 ? true : D, T = e.toggle;
174
+ var o = e["aria-labelledby"], t = e.align, a = t === void 0 ? "center" : t, l = e.canCoverAnchor, u = l === void 0 ? true : l, p = e.children, v = e.closeReasons, y = v === void 0 ? C : v, g = e.defaultPlacement, b = g === void 0 ? "below" : g, m = e.elementRef, h = e.focusToggleReasons, O = h === void 0 ? k : h, w = e.inputId, R = e.open, S = e.openWithArrowKeys, A = e.onRequestClose, I = e.onRequestOpen, q = e.repositionMode, P = q === void 0 ? "flip" : q, D = e.retainFocus, K = D === void 0 ? false : D, j = e.takeFocus, M = j === void 0 ? true : j, T = e.toggle;
175
175
  // @docs-props-type DropdownPropsBase
176
176
  var F = (0, n.useState)(null), E = d(F, 2), N = E[0], _ = E[1];
177
177
  var x = (0, n.useState)(false), W = d(x, 2), U = W[0], z = W[1];
@@ -198,8 +198,13 @@
198
198
  // TS: ref does not exist on React.ReactElement - technically, this is undocumented API
199
199
  f(T.ref, e);
200
200
  }), [ T ]);
201
- var Z = (0, n.useCallback)((function(e) {
201
+ var Z = T.props.disabled;
202
+ var ee = Z === true || Z === "disabled" || Z === "dimmed";
203
+ var oe = (0, n.useCallback)((function(e) {
202
204
  var o, n;
205
+ if (ee) {
206
+ return;
207
+ }
203
208
  (o = (n = T.props).onKeyDown) === null || o === void 0 ? void 0 : o.call(n, e);
204
209
  if (!S) {
205
210
  return;
@@ -214,8 +219,8 @@
214
219
  z(true);
215
220
  }
216
221
  }
217
- }), [ $, S, I, T ]);
218
- var ee = (0, n.useCallback)((function(e) {
222
+ }), [ $, ee, S, I, T ]);
223
+ var ne = (0, n.useCallback)((function(e) {
219
224
  var o = e.event, n = e.reason;
220
225
  if (o && n === "clickAway") {
221
226
  var r = o.target;
@@ -238,17 +243,21 @@
238
243
  A === null || A === void 0 ? void 0 : A(e);
239
244
  }
240
245
  }), [ y, O, $, B, A ]);
241
- var oe = (0, n.useCallback)((function(e) {
242
- ee({
246
+ var re = (0, n.useCallback)((function(e) {
247
+ ne({
243
248
  reason: "contentClick",
244
249
  event: e
245
250
  });
246
- }), [ ee ]);
247
- var ne = (0, n.useCallback)((function(e) {
251
+ }), [ ne ]);
252
+ var te = (0, n.useCallback)((function(e) {
248
253
  var o, n;
254
+ if (ee) {
255
+ e.preventDefault();
256
+ return;
257
+ }
249
258
  (o = (n = T.props).onClick) === null || o === void 0 ? void 0 : o.call(n, e);
250
259
  if (B) {
251
- ee({
260
+ ne({
252
261
  reason: "toggleClick",
253
262
  event: e
254
263
  });
@@ -260,10 +269,10 @@
260
269
  z(true);
261
270
  }
262
271
  }
263
- }), [ ee, $, B, I, T ]);
264
- var re = (0, n.cloneElement)(T, {
265
- onClick: ne,
266
- onKeyDown: Z,
272
+ }), [ ne, $, B, ee, I, T ]);
273
+ var ae = (0, n.cloneElement)(T, {
274
+ onClick: te,
275
+ onKeyDown: oe,
267
276
  ref: Y,
268
277
  "aria-controls": B ? L : undefined,
269
278
  "aria-haspopup": T.props["aria-haspopup"] || true,
@@ -273,16 +282,16 @@
273
282
  id: X
274
283
  });
275
284
 
276
- return r().createElement(r().Fragment, null, re, r().createElement(i(), {
285
+ return r().createElement(r().Fragment, null, ae, r().createElement(i(), {
277
286
  align: a,
278
287
  open: !!N && B,
279
288
  autoCloseWhenOffScreen: y.includes("offScreen"),
280
289
  anchor: N,
281
290
  canCoverAnchor: u,
282
291
  elementRef: m,
283
- retainFocus: j,
292
+ retainFocus: K,
284
293
  defaultPlacement: b,
285
- onRequestClose: ee,
294
+ onRequestClose: ne,
286
295
  repositionMode: P,
287
296
  id: L,
288
297
  "aria-labelledby": "".concat(o !== null && o !== void 0 ? o : "", " ").concat(X).trim(),
@@ -292,13 +301,13 @@
292
301
 
293
302
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
294
303
  return r().createElement("div", {
295
- onClick: oe
304
+ onClick: re
296
305
  }, p.apply(void 0, arguments));
297
306
  } :
298
307
 
299
308
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
300
309
  r().createElement("div", {
301
- onClick: oe
310
+ onClick: re
302
311
  }, p)));
303
312
  }
304
313
  O.propTypes = h;
package/File.js CHANGED
@@ -136,7 +136,7 @@
136
136
  return !n && (0, h.css)([ "&:hover{background-color:", ";", "{color:", ";}", "{fill:", ";}}" ], w.variables.actionColorBackgroundSubtleHover, /* sc-sel */ _, w.variables.contentColorAccentStrong, /* sc-sel */ E, w.variables.contentColorAccentStrong);
137
137
  }), (function(e) {
138
138
  var n = e.$screenMode;
139
- return n === "normal" && (0, h.css)([ "border:", " dashed ", ";" ], w.variables.inputBorderWidth, w.variables.borderColor);
139
+ return n === "normal" && (0, h.css)([ "border:", " dashed ", ";" ], w.variables.inputBorderWidth, w.variables.interactiveColorBorder);
140
140
  }), (function(e) {
141
141
  var n = e.$dragOver, r = e.$focused, t = e.$error;
142
142
  return (n || r && !t) && (0, h.css)([ "", "{color:", ";}", "{fill:", ";}" ], /* sc-sel */ _, w.variables.contentColorAccentStrong, /* sc-sel */ E, w.variables.contentColorAccentStrong);
@@ -148,7 +148,7 @@
148
148
  return n && (0, h.css)([ "box-shadow:", ";" ], w.variables.focusShadow);
149
149
  }), (function(e) {
150
150
  var n = e.$disabled;
151
- return n && (0, h.css)([ "border-color:", ";cursor:not-allowed;", ",", "{color:", ";}", "{fill:", ";}" ], w.variables.borderColorWeak, /* sc-sel */ _, /* sc-sel */ R, w.variables.contentColorDisabled, /* sc-sel */ E, w.variables.contentColorDisabled);
151
+ return n && (0, h.css)([ "border-color:", ";cursor:not-allowed;", ",", "{color:", ";}", "{fill:", ";}" ], w.variables.interactiveColorBorderDisabled, /* sc-sel */ _, /* sc-sel */ R, w.variables.contentColorDisabled, /* sc-sel */ E, w.variables.contentColorDisabled);
152
152
  }), (function(e) {
153
153
  var n = e.$error, r = e.$dragOver;
154
154
  return n && !r && (0, h.css)([ "border-color:", ";" ], w.variables.interactiveColorAccentError);
@@ -167,10 +167,10 @@
167
167
  })([ "display:flex;flex-direction:column;gap:", ";" ], w.variables.spacingXSmall);
168
168
  // CONCATENATED MODULE: external "@splunk/react-icons/ArrowsCircularDouble"
169
169
  const j = require("@splunk/react-icons/ArrowsCircularDouble");
170
- var N = e.n(j);
170
+ var D = e.n(j);
171
171
  // CONCATENATED MODULE: external "@splunk/react-icons/Cross"
172
- const D = require("@splunk/react-icons/Cross");
173
- var M = e.n(D);
172
+ const N = require("@splunk/react-icons/Cross");
173
+ var M = e.n(N);
174
174
  // CONCATENATED MODULE: external "@splunk/react-icons/TrashCanCross"
175
175
  const $ = require("@splunk/react-icons/TrashCanCross");
176
176
  var B = e.n($);
@@ -179,10 +179,10 @@
179
179
  var X = e.n(L);
180
180
  // CONCATENATED MODULE: external "@splunk/react-icons/FileCss"
181
181
  const U = require("@splunk/react-icons/FileCss");
182
- var W = e.n(U);
182
+ var z = e.n(U);
183
183
  // CONCATENATED MODULE: external "@splunk/react-icons/FileCsv"
184
- const z = require("@splunk/react-icons/FileCsv");
185
- var H = e.n(z);
184
+ const H = require("@splunk/react-icons/FileCsv");
185
+ var W = e.n(H);
186
186
  // CONCATENATED MODULE: external "@splunk/react-icons/FileDat"
187
187
  const J = require("@splunk/react-icons/FileDat");
188
188
  var G = e.n(J);
@@ -248,10 +248,10 @@
248
248
  var Pe = e.n(Te);
249
249
  // CONCATENATED MODULE: external "@splunk/react-icons/FilePng"
250
250
  const je = require("@splunk/react-icons/FilePng");
251
- var Ne = e.n(je);
251
+ var De = e.n(je);
252
252
  // CONCATENATED MODULE: external "@splunk/react-icons/FilePpt"
253
- const De = require("@splunk/react-icons/FilePpt");
254
- var Me = e.n(De);
253
+ const Ne = require("@splunk/react-icons/FilePpt");
254
+ var Me = e.n(Ne);
255
255
  // CONCATENATED MODULE: external "@splunk/react-icons/FileRar"
256
256
  const $e = require("@splunk/react-icons/FileRar");
257
257
  var Be = e.n($e);
@@ -260,10 +260,10 @@
260
260
  var Xe = e.n(Le);
261
261
  // CONCATENATED MODULE: external "@splunk/react-icons/FileSql"
262
262
  const Ue = require("@splunk/react-icons/FileSql");
263
- var We = e.n(Ue);
263
+ var ze = e.n(Ue);
264
264
  // CONCATENATED MODULE: external "@splunk/react-icons/FileSvg"
265
- const ze = require("@splunk/react-icons/FileSvg");
266
- var He = e.n(ze);
265
+ const He = require("@splunk/react-icons/FileSvg");
266
+ var We = e.n(He);
267
267
  // CONCATENATED MODULE: external "@splunk/react-icons/FileText"
268
268
  const Je = require("@splunk/react-icons/FileText");
269
269
  var Ge = e.n(Je);
@@ -341,8 +341,8 @@
341
341
  var xn = {
342
342
  aif: X(),
343
343
  aiff: X(),
344
- css: W(),
345
- csv: H(),
344
+ css: z(),
345
+ csv: W(),
346
346
  dat: G(),
347
347
  db: Z(),
348
348
  dbf: Q(),
@@ -364,12 +364,12 @@
364
364
  mpg: Re(),
365
365
  pdf: Ae(),
366
366
  php: Pe(),
367
- png: Ne(),
367
+ png: De(),
368
368
  ppt: Me(),
369
369
  rar: Be(),
370
370
  rtf: Xe(),
371
- sql: We(),
372
- svg: He(),
371
+ sql: ze(),
372
+ svg: We(),
373
373
  txt: Ge(),
374
374
  tgz: Ze(),
375
375
  tiff: Qe(),
@@ -501,7 +501,7 @@
501
501
  onClick: q,
502
502
  "aria-label": F,
503
503
  appearance: "subtle"
504
- }, t().createElement(N(), {
504
+ }, t().createElement(D(), {
505
505
  "aria-label": (0, m._)("Retry")
506
506
  })), !_ && (p === undefined && !o ? t().createElement(wn, {
507
507
  "data-test": "remove",
@@ -577,12 +577,12 @@
577
577
  search: ""
578
578
  }
579
579
  };
580
- function Nn() {
580
+ function Dn() {
581
581
  var e = typeof document !== "undefined" ? document : jn;
582
582
  return e;
583
583
  }
584
- var Dn = Nn();
585
- /* harmony default export */ const Mn = /* unused pure expression or super */ null && Dn;
584
+ var Nn = Dn();
585
+ /* harmony default export */ const Mn = /* unused pure expression or super */ null && Nn;
586
586
  // CONCATENATED MODULE: ./src/utils/ssrWindow.ts
587
587
  /* eslint-disable @typescript-eslint/no-empty-function */
588
588
  var $n = {
@@ -658,13 +658,13 @@
658
658
  return e;
659
659
  }, Un.apply(null, arguments);
660
660
  }
661
- function Wn(e, n) {
662
- return Vn(e) || Gn(e, n) || Hn(e, n) || zn();
661
+ function zn(e, n) {
662
+ return Vn(e) || Gn(e, n) || Wn(e, n) || Hn();
663
663
  }
664
- function zn() {
664
+ function Hn() {
665
665
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
666
666
  }
667
- function Hn(e, n) {
667
+ function Wn(e, n) {
668
668
  if (e) {
669
669
  if ("string" == typeof e) return Jn(e, n);
670
670
  var r = {}.toString.call(e).slice(8, -1);
@@ -750,13 +750,13 @@
750
750
  * file readers, only a reference to the file. This can be used to post binary content, or
751
751
  * upload using an array buffer.
752
752
  */ function Yn(e) {
753
- var n = e.accept, a = e.allowMultiple, o = e.children, s = e.disabled, u = e.dropAnywhere, d = e.elementRef, p = e.error, b = e.fullscreen, h = e.help, k = e.inputId, S = e.name, q = e.onRequestAdd, w = e.onRequestRemove, C = e.onRequestRetry, x = e.required, j = e.supportsMessage, N = Zn(e, [ "accept", "allowMultiple", "children", "disabled", "dropAnywhere", "elementRef", "error", "fullscreen", "help", "inputId", "name", "onRequestAdd", "onRequestRemove", "onRequestRetry", "required", "supportsMessage" ]);
753
+ var n = e.accept, a = e.allowMultiple, o = e.children, s = e.disabled, u = e.dropAnywhere, d = e.elementRef, p = e.error, b = e.fullscreen, h = e.help, k = e.inputId, S = e.name, q = e.onRequestAdd, w = e.onRequestRemove, C = e.onRequestRetry, x = e.required, j = e.supportsMessage, D = Zn(e, [ "accept", "allowMultiple", "children", "disabled", "dropAnywhere", "elementRef", "error", "fullscreen", "help", "inputId", "name", "onRequestAdd", "onRequestRemove", "onRequestRetry", "required", "supportsMessage" ]);
754
754
  // @docs-props-type FilePropsBase
755
- var D = (0, r.useState)(false), M = Wn(D, 2), $ = M[0], B = M[1];
756
- var L = (0, r.useState)(false), X = Wn(L, 2), U = X[0], W = X[1];
755
+ var N = (0, r.useState)(false), M = zn(N, 2), $ = M[0], B = M[1];
756
+ var L = (0, r.useState)(false), X = zn(L, 2), U = X[0], z = X[1];
757
757
  /* Each time a file is uploaded this is incremented and used to generate the
758
- * file input's key. In this way we get a new input without a value. */ var z = (0,
759
- r.useState)(0), H = Wn(z, 2), J = H[0], G = H[1];
758
+ * file input's key. In this way we get a new input without a value. */ var H = (0,
759
+ r.useState)(0), W = zn(H, 2), J = W[0], G = W[1];
760
760
  var V = (0, r.useMemo)((function() {
761
761
  return k || (0, y.createDOMID)("file");
762
762
  }), [ k ]);
@@ -780,10 +780,10 @@
780
780
  Z((n = e.currentTarget.files) !== null && n !== void 0 ? n : undefined);
781
781
  }), [ Z ]);
782
782
  var Q = (0, r.useCallback)((function() {
783
- W(true);
783
+ z(true);
784
784
  }), []);
785
785
  var Y = (0, r.useCallback)((function() {
786
- W(false);
786
+ z(false);
787
787
  }), []);
788
788
  var ee = (0, r.useCallback)((function(e) {
789
789
  if (!$) {
@@ -856,7 +856,7 @@
856
856
  "data-test": "file",
857
857
  "data-test-disabled": s ? "disabled" : undefined,
858
858
  "data-test-error": !!p
859
- }, N), t().createElement("label", {
859
+ }, D), t().createElement("label", {
860
860
  htmlFor: V,
861
861
  "data-test": "file-label"
862
862
  }, t().createElement(O, {