@splunk/react-ui 4.21.1 → 4.22.1

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/Search.js CHANGED
@@ -63,63 +63,66 @@
63
63
  e.d(r, {
64
64
  Divider: () => /* reexport */ g.Divider,
65
65
  Heading: () => /* reexport */ g.Heading,
66
- Option: () => /* reexport */ W,
67
- default: () => /* reexport */ ue
66
+ Option: () => /* reexport */ U,
67
+ default: () => /* reexport */ fe
68
68
  });
69
69
  // CONCATENATED MODULE: external "react"
70
70
  const t = require("react");
71
71
  var n = e.n(t);
72
72
  // CONCATENATED MODULE: external "prop-types"
73
73
  const o = require("prop-types");
74
- var i = e.n(o);
74
+ var a = e.n(o);
75
75
  // CONCATENATED MODULE: external "lodash/extend"
76
- const a = require("lodash/extend");
77
- var u = e.n(a);
76
+ const i = require("lodash/extend");
77
+ var u = e.n(i);
78
78
  // CONCATENATED MODULE: external "lodash/has"
79
79
  const l = require("lodash/has");
80
80
  var c = e.n(l);
81
- // CONCATENATED MODULE: external "lodash/omit"
82
- const f = require("lodash/omit");
81
+ // CONCATENATED MODULE: external "lodash/memoize"
82
+ const f = require("lodash/memoize");
83
83
  var s = e.n(f);
84
- // CONCATENATED MODULE: external "lodash/pick"
85
- const d = require("lodash/pick");
84
+ // CONCATENATED MODULE: external "lodash/omit"
85
+ const d = require("lodash/omit");
86
86
  var v = e.n(d);
87
+ // CONCATENATED MODULE: external "lodash/pick"
88
+ const p = require("lodash/pick");
89
+ var b = e.n(p);
87
90
  // CONCATENATED MODULE: external "@splunk/ui-utils/id"
88
- const p = require("@splunk/ui-utils/id");
91
+ const y = require("@splunk/ui-utils/id");
89
92
  // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
90
- const b = require("@splunk/ui-utils/i18n");
93
+ const h = require("@splunk/ui-utils/i18n");
91
94
  // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
92
- const y = require("@splunk/ui-utils/keyboard");
95
+ const m = require("@splunk/ui-utils/keyboard");
93
96
  // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
94
97
  const g = require("@splunk/react-ui/Menu");
95
98
  // CONCATENATED MODULE: external "@splunk/react-ui/usePrevious"
96
- const h = require("@splunk/react-ui/usePrevious");
97
- var m = e.n(h);
98
- // CONCATENATED MODULE: external "@splunk/react-ui/Popover"
99
- const O = require("@splunk/react-ui/Popover");
99
+ const O = require("@splunk/react-ui/usePrevious");
100
100
  var j = e.n(O);
101
- // CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
102
- const w = require("@splunk/react-ui/ResultsMenu");
101
+ // CONCATENATED MODULE: external "@splunk/react-ui/Popover"
102
+ const w = require("@splunk/react-ui/Popover");
103
103
  var S = e.n(w);
104
- // CONCATENATED MODULE: external "@splunk/react-ui/Text"
105
- const P = require("@splunk/react-ui/Text");
104
+ // CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
105
+ const P = require("@splunk/react-ui/ResultsMenu");
106
106
  var k = e.n(P);
107
+ // CONCATENATED MODULE: external "@splunk/react-ui/Text"
108
+ const C = require("@splunk/react-ui/Text");
109
+ var R = e.n(C);
107
110
  // CONCATENATED MODULE: ./src/Search/Option.tsx
108
- function C(e) {
111
+ function M(e) {
109
112
  "@babel/helpers - typeof";
110
113
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
111
- C = function e(r) {
114
+ M = function e(r) {
112
115
  return typeof r;
113
116
  };
114
117
  } else {
115
- C = function e(r) {
118
+ M = function e(r) {
116
119
  return r && typeof Symbol === "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
117
120
  };
118
121
  }
119
- return C(e);
122
+ return M(e);
120
123
  }
121
- function R() {
122
- R = Object.assign || function(e) {
124
+ function E() {
125
+ E = Object.assign || function(e) {
123
126
  for (var r = 1; r < arguments.length; r++) {
124
127
  var t = arguments[r];
125
128
  for (var n in t) {
@@ -130,16 +133,16 @@
130
133
  }
131
134
  return e;
132
135
  };
133
- return R.apply(this, arguments);
136
+ return E.apply(this, arguments);
134
137
  }
135
- function M(e, r) {
138
+ function x(e, r) {
136
139
  if (e == null) return {};
137
- var t = E(e, r);
140
+ var t = D(e, r);
138
141
  var n, o;
139
142
  if (Object.getOwnPropertySymbols) {
140
- var i = Object.getOwnPropertySymbols(e);
141
- for (o = 0; o < i.length; o++) {
142
- n = i[o];
143
+ var a = Object.getOwnPropertySymbols(e);
144
+ for (o = 0; o < a.length; o++) {
145
+ n = a[o];
143
146
  if (r.indexOf(n) >= 0) continue;
144
147
  if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
145
148
  t[n] = e[n];
@@ -147,24 +150,24 @@
147
150
  }
148
151
  return t;
149
152
  }
150
- function E(e, r) {
153
+ function D(e, r) {
151
154
  if (e == null) return {};
152
155
  var t = {};
153
156
  var n = Object.keys(e);
154
- var o, i;
155
- for (i = 0; i < n.length; i++) {
156
- o = n[i];
157
+ var o, a;
158
+ for (a = 0; a < n.length; a++) {
159
+ o = n[a];
157
160
  if (r.indexOf(o) >= 0) continue;
158
161
  t[o] = e[o];
159
162
  }
160
163
  return t;
161
164
  }
162
- function D(e, r) {
165
+ function q(e, r) {
163
166
  if (!(e instanceof r)) {
164
167
  throw new TypeError("Cannot call a class as a function");
165
168
  }
166
169
  }
167
- function q(e, r) {
170
+ function I(e, r) {
168
171
  for (var t = 0; t < r.length; t++) {
169
172
  var n = r[t];
170
173
  n.enumerable = n.enumerable || false;
@@ -173,12 +176,12 @@
173
176
  Object.defineProperty(e, n.key, n);
174
177
  }
175
178
  }
176
- function x(e, r, t) {
177
- if (r) q(e.prototype, r);
178
- if (t) q(e, t);
179
+ function _(e, r, t) {
180
+ if (r) I(e.prototype, r);
181
+ if (t) I(e, t);
179
182
  return e;
180
183
  }
181
- function I(e, r) {
184
+ function A(e, r) {
182
185
  if (typeof r !== "function" && r !== null) {
183
186
  throw new TypeError("Super expression must either be null or a function");
184
187
  }
@@ -189,41 +192,41 @@
189
192
  configurable: true
190
193
  }
191
194
  });
192
- if (r) _(e, r);
195
+ if (r) T(e, r);
193
196
  }
194
- function _(e, r) {
195
- _ = Object.setPrototypeOf || function e(r, t) {
197
+ function T(e, r) {
198
+ T = Object.setPrototypeOf || function e(r, t) {
196
199
  r.__proto__ = t;
197
200
  return r;
198
201
  };
199
- return _(e, r);
202
+ return T(e, r);
200
203
  }
201
- function A(e) {
202
- var r = V();
204
+ function B(e) {
205
+ var r = L();
203
206
  return function t() {
204
- var n = L(e), o;
207
+ var n = K(e), o;
205
208
  if (r) {
206
- var i = L(this).constructor;
207
- o = Reflect.construct(n, arguments, i);
209
+ var a = K(this).constructor;
210
+ o = Reflect.construct(n, arguments, a);
208
211
  } else {
209
212
  o = n.apply(this, arguments);
210
213
  }
211
- return T(this, o);
214
+ return V(this, o);
212
215
  };
213
216
  }
214
- function T(e, r) {
215
- if (r && (C(r) === "object" || typeof r === "function")) {
217
+ function V(e, r) {
218
+ if (r && (M(r) === "object" || typeof r === "function")) {
216
219
  return r;
217
220
  }
218
- return B(e);
221
+ return H(e);
219
222
  }
220
- function B(e) {
223
+ function H(e) {
221
224
  if (e === void 0) {
222
225
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
223
226
  }
224
227
  return e;
225
228
  }
226
- function V() {
229
+ function L() {
227
230
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
228
231
  if (Reflect.construct.sham) return false;
229
232
  if (typeof Proxy === "function") return true;
@@ -234,13 +237,13 @@
234
237
  return false;
235
238
  }
236
239
  }
237
- function L(e) {
238
- L = Object.setPrototypeOf ? Object.getPrototypeOf : function e(r) {
240
+ function K(e) {
241
+ K = Object.setPrototypeOf ? Object.getPrototypeOf : function e(r) {
239
242
  return r.__proto__ || Object.getPrototypeOf(r);
240
243
  };
241
- return L(e);
244
+ return K(e);
242
245
  }
243
- function H(e, r, t) {
246
+ function N(e, r, t) {
244
247
  if (r in e) {
245
248
  Object.defineProperty(e, r, {
246
249
  value: t,
@@ -253,20 +256,20 @@
253
256
  }
254
257
  return e;
255
258
  }
256
- var K = {
259
+ var F = {
257
260
  /** @private */
258
- active: i().bool,
259
- description: i().string,
260
- descriptionPosition: i().oneOf([ "right", "bottom" ]),
261
- disabled: i().bool,
262
- icon: i().node,
263
- label: i().string,
261
+ active: a().bool,
262
+ description: a().string,
263
+ descriptionPosition: a().oneOf([ "right", "bottom" ]),
264
+ disabled: a().bool,
265
+ icon: a().node,
266
+ label: a().string,
264
267
  /** @private */
265
- onClick: i().func,
266
- truncate: i().bool,
267
- value: i().string.isRequired
268
+ onClick: a().func,
269
+ truncate: a().bool,
270
+ value: a().string.isRequired
268
271
  };
269
- var N = {
272
+ var W = {
270
273
  active: false,
271
274
  descriptionPosition: "bottom",
272
275
  disabled: false,
@@ -276,28 +279,28 @@
276
279
  * An option within a `Search`. This inherits from
277
280
  * [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
278
281
  * so any elements passed to it must also be pure.
279
- */ var F = function(e) {
280
- I(t, e);
281
- var r = A(t);
282
+ */ var z = function(e) {
283
+ A(t, e);
284
+ var r = B(t);
282
285
  function t() {
283
286
  var e;
284
- D(this, t);
285
- for (var n = arguments.length, o = new Array(n), i = 0; i < n; i++) {
286
- o[i] = arguments[i];
287
+ q(this, t);
288
+ for (var n = arguments.length, o = new Array(n), a = 0; a < n; a++) {
289
+ o[a] = arguments[a];
287
290
  }
288
291
  e = r.call.apply(r, [ this ].concat(o));
289
- H(B(e), "item", null);
290
- H(B(e), "handleClick", (function(r) {
291
- var t = e.props, n = t.disabled, o = t.onClick, i = t.value;
292
+ N(H(e), "item", null);
293
+ N(H(e), "handleClick", (function(r) {
294
+ var t = e.props, n = t.disabled, o = t.onClick, a = t.value;
292
295
  if (!n) {
293
296
  o === null || o === void 0 ? void 0 : o(r, {
294
- value: i
297
+ value: a
295
298
  });
296
299
  }
297
300
  }));
298
301
  return e;
299
302
  }
300
- x(t, [ {
303
+ _(t, [ {
301
304
  key: "scrollIntoViewIfNeeded",
302
305
  value: function e() {
303
306
  var r;
@@ -308,16 +311,16 @@
308
311
  value: function e() {
309
312
  var r = this;
310
313
  // eslint-disable-next-line no-unused-vars
311
- var t = this.props, o = t.value, i = t.label, a = M(t, [ "value", "label" ]);
312
- var u = i === undefined ? o : i;
314
+ var t = this.props, o = t.value, a = t.label, i = x(t, [ "value", "label" ]);
315
+ var u = a === undefined ? o : a;
313
316
 
314
- return n().createElement(g.Item, R({
317
+ return n().createElement(g.Item, E({
315
318
  ref: function e(t) {
316
319
  r.item = t;
317
320
  },
318
321
  "data-test": "search-option",
319
322
  "data-test-value": o
320
- }, a, {
323
+ }, i, {
321
324
  onClick: this.handleClick,
322
325
  role: "option",
323
326
  "aria-selected": false
@@ -326,10 +329,10 @@
326
329
  } ]);
327
330
  return t;
328
331
  }(t.PureComponent);
329
- H(F, "propTypes", K);
330
- H(F, "defaultProps", N);
331
- H(F, "type", g.Item);
332
- /* harmony default export */ const W = F;
332
+ N(z, "propTypes", F);
333
+ N(z, "defaultProps", W);
334
+ N(z, "type", g.Item);
335
+ /* harmony default export */ const U = z;
333
336
  // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
334
337
  /**
335
338
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
@@ -337,7 +340,7 @@
337
340
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
338
341
  * @param current - The new value of the ref.
339
342
  */
340
- function z(e, r) {
343
+ function X(e, r) {
341
344
  if (e) {
342
345
  if (typeof e === "function") {
343
346
  e(r);
@@ -350,8 +353,8 @@
350
353
  }
351
354
  }
352
355
  // CONCATENATED MODULE: ./src/Search/Search.tsx
353
- function U() {
354
- U = Object.assign || function(e) {
356
+ function Y() {
357
+ Y = Object.assign || function(e) {
355
358
  for (var r = 1; r < arguments.length; r++) {
356
359
  var t = arguments[r];
357
360
  for (var n in t) {
@@ -362,9 +365,9 @@
362
365
  }
363
366
  return e;
364
367
  };
365
- return U.apply(this, arguments);
368
+ return Y.apply(this, arguments);
366
369
  }
367
- function X(e, r) {
370
+ function $(e, r) {
368
371
  var t = Object.keys(e);
369
372
  if (Object.getOwnPropertySymbols) {
370
373
  var n = Object.getOwnPropertySymbols(e);
@@ -375,24 +378,24 @@
375
378
  }
376
379
  return t;
377
380
  }
378
- function Y(e) {
381
+ function G(e) {
379
382
  for (var r = 1; r < arguments.length; r++) {
380
383
  var t = arguments[r] != null ? arguments[r] : {};
381
384
  if (r % 2) {
382
- X(Object(t), true).forEach((function(r) {
383
- $(e, r, t[r]);
385
+ $(Object(t), true).forEach((function(r) {
386
+ J(e, r, t[r]);
384
387
  }));
385
388
  } else if (Object.getOwnPropertyDescriptors) {
386
389
  Object.defineProperties(e, Object.getOwnPropertyDescriptors(t));
387
390
  } else {
388
- X(Object(t)).forEach((function(r) {
391
+ $(Object(t)).forEach((function(r) {
389
392
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
390
393
  }));
391
394
  }
392
395
  }
393
396
  return e;
394
397
  }
395
- function $(e, r, t) {
398
+ function J(e, r, t) {
396
399
  if (r in e) {
397
400
  Object.defineProperty(e, r, {
398
401
  value: t,
@@ -405,61 +408,61 @@
405
408
  }
406
409
  return e;
407
410
  }
408
- function G(e, r) {
409
- return re(e) || ee(e, r) || Q(e, r) || J();
411
+ function Q(e, r) {
412
+ return ne(e) || te(e, r) || ee(e, r) || Z();
410
413
  }
411
- function J() {
414
+ function Z() {
412
415
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
413
416
  }
414
- function Q(e, r) {
417
+ function ee(e, r) {
415
418
  if (!e) return;
416
- if (typeof e === "string") return Z(e, r);
419
+ if (typeof e === "string") return re(e, r);
417
420
  var t = Object.prototype.toString.call(e).slice(8, -1);
418
421
  if (t === "Object" && e.constructor) t = e.constructor.name;
419
422
  if (t === "Map" || t === "Set") return Array.from(e);
420
- if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return Z(e, r);
423
+ if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return re(e, r);
421
424
  }
422
- function Z(e, r) {
425
+ function re(e, r) {
423
426
  if (r == null || r > e.length) r = e.length;
424
427
  for (var t = 0, n = new Array(r); t < r; t++) {
425
428
  n[t] = e[t];
426
429
  }
427
430
  return n;
428
431
  }
429
- function ee(e, r) {
432
+ function te(e, r) {
430
433
  if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
431
434
  var t = [];
432
435
  var n = true;
433
436
  var o = false;
434
- var i = undefined;
437
+ var a = undefined;
435
438
  try {
436
- for (var a = e[Symbol.iterator](), u; !(n = (u = a.next()).done); n = true) {
439
+ for (var i = e[Symbol.iterator](), u; !(n = (u = i.next()).done); n = true) {
437
440
  t.push(u.value);
438
441
  if (r && t.length === r) break;
439
442
  }
440
443
  } catch (e) {
441
444
  o = true;
442
- i = e;
445
+ a = e;
443
446
  } finally {
444
447
  try {
445
- if (!n && a["return"] != null) a["return"]();
448
+ if (!n && i["return"] != null) i["return"]();
446
449
  } finally {
447
- if (o) throw i;
450
+ if (o) throw a;
448
451
  }
449
452
  }
450
453
  return t;
451
454
  }
452
- function re(e) {
455
+ function ne(e) {
453
456
  if (Array.isArray(e)) return e;
454
457
  }
455
- function te(e, r) {
458
+ function oe(e, r) {
456
459
  if (e == null) return {};
457
- var t = ne(e, r);
460
+ var t = ae(e, r);
458
461
  var n, o;
459
462
  if (Object.getOwnPropertySymbols) {
460
- var i = Object.getOwnPropertySymbols(e);
461
- for (o = 0; o < i.length; o++) {
462
- n = i[o];
463
+ var a = Object.getOwnPropertySymbols(e);
464
+ for (o = 0; o < a.length; o++) {
465
+ n = a[o];
463
466
  if (r.indexOf(n) >= 0) continue;
464
467
  if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
465
468
  t[n] = e[n];
@@ -467,86 +470,94 @@
467
470
  }
468
471
  return t;
469
472
  }
470
- function ne(e, r) {
473
+ function ae(e, r) {
471
474
  if (e == null) return {};
472
475
  var t = {};
473
476
  var n = Object.keys(e);
474
- var o, i;
475
- for (i = 0; i < n.length; i++) {
476
- o = n[i];
477
+ var o, a;
478
+ for (a = 0; a < n.length; a++) {
479
+ o = n[a];
477
480
  if (r.indexOf(o) >= 0) continue;
478
481
  t[o] = e[o];
479
482
  }
480
483
  return t;
481
484
  }
482
- var oe = {
483
- animateLoading: i().bool,
484
- children: i().node,
485
- defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
486
- defaultValue: i().string,
487
- describedBy: i().string,
488
- disabled: i().bool,
489
- elementRef: i().oneOfType([ i().func, i().object ]),
490
- error: i().bool,
491
- footerMessage: i().node,
492
- inline: i().bool,
493
- inputRef: i().oneOfType([ i().func, i().object ]),
494
- isLoadingOptions: i().bool,
495
- labelledBy: i().string,
496
- loadingMessage: i().node,
497
- menuStyle: i().object,
498
- name: i().string,
499
- noOptionsMessage: i().node,
500
- onChange: i().func,
501
- onClose: i().func,
502
- onFocus: i().func,
503
- onKeyDown: i().func,
504
- onOpen: i().func,
505
- onScroll: i().func,
506
- placeholder: i().string,
507
- value: i().string
485
+ var ie = {
486
+ animateLoading: a().bool,
487
+ children: a().node,
488
+ defaultPlacement: a().oneOf([ "above", "below", "vertical" ]),
489
+ defaultValue: a().string,
490
+ describedBy: a().string,
491
+ disabled: a().bool,
492
+ elementRef: a().oneOfType([ a().func, a().object ]),
493
+ error: a().bool,
494
+ footerMessage: a().node,
495
+ inline: a().bool,
496
+ inputRef: a().oneOfType([ a().func, a().object ]),
497
+ isLoadingOptions: a().bool,
498
+ labelledBy: a().string,
499
+ loadingMessage: a().node,
500
+ menuStyle: a().object,
501
+ name: a().string,
502
+ noOptionsMessage: a().node,
503
+ onChange: a().func,
504
+ onClose: a().func,
505
+ onFocus: a().func,
506
+ onKeyDown: a().func,
507
+ onOpen: a().func,
508
+ onScroll: a().func,
509
+ placeholder: a().string,
510
+ value: a().string
508
511
  };
509
- function ie(e, r) {
512
+ function ue(e, r) {
510
513
  var t = r.clientX, n = r.clientY;
511
- var o = e.getBoundingClientRect(), i = o.top, a = o.left, u = o.bottom, l = o.right;
512
- return t > a && t < l && n > i && n < u;
514
+ var o = e.getBoundingClientRect(), a = o.top, i = o.left, u = o.bottom, l = o.right;
515
+ return t > i && t < l && n > a && n < u;
513
516
  }
514
- function ae(e) {
515
- var r = e.animateLoading, o = r === void 0 ? false : r, i = e.children, a = e.defaultPlacement, l = e.defaultValue, f = e.describedBy, d = e.disabled, g = d === void 0 ? false : d, h = e.elementRef, O = e.error, w = O === void 0 ? false : O, P = e.footerMessage, C = e.inline, R = C === void 0 ? false : C, M = e.inputRef, E = e.isLoadingOptions, D = E === void 0 ? false : E, q = e.labelledBy, x = e.loadingMessage, I = e.menuStyle, _ = I === void 0 ? {} : I, A = e.name, T = e.noOptionsMessage, B = e.onChange, V = e.onClose, L = e.onFocus, H = e.onKeyDown, K = e.onOpen, N = e.placeholder, F = N === void 0 ? (0,
516
- b._)("Search...") : N, W = e.value, X = te(e, [ "animateLoading", "children", "defaultPlacement", "defaultValue", "describedBy", "disabled", "elementRef", "error", "footerMessage", "inline", "inputRef", "isLoadingOptions", "labelledBy", "loadingMessage", "menuStyle", "name", "noOptionsMessage", "onChange", "onClose", "onFocus", "onKeyDown", "onOpen", "placeholder", "value" ]);
517
+ var le = s()((function(e) {
518
+ var r = e.anchorWidth, t = e.maxHeight, n = e.menuStyle;
519
+ return u()({
520
+ maxHeight: t,
521
+ overflow: "auto",
522
+ width: Math.max(r !== null && r !== void 0 ? r : 0, 200)
523
+ }, n);
524
+ }));
525
+ function ce(e) {
526
+ var r = e.animateLoading, o = r === void 0 ? false : r, a = e.children, i = e.defaultPlacement, u = e.defaultValue, l = e.describedBy, f = e.disabled, s = f === void 0 ? false : f, d = e.elementRef, p = e.error, g = p === void 0 ? false : p, O = e.footerMessage, w = e.inline, P = w === void 0 ? false : w, C = e.inputRef, M = e.isLoadingOptions, E = M === void 0 ? false : M, x = e.labelledBy, D = e.loadingMessage, q = e.menuStyle, I = q === void 0 ? {} : q, _ = e.name, A = e.noOptionsMessage, T = e.onChange, B = e.onClose, V = e.onFocus, H = e.onKeyDown, L = e.onOpen, K = e.placeholder, N = K === void 0 ? (0,
527
+ h._)("Search...") : K, F = e.value, W = oe(e, [ "animateLoading", "children", "defaultPlacement", "defaultValue", "describedBy", "disabled", "elementRef", "error", "footerMessage", "inline", "inputRef", "isLoadingOptions", "labelledBy", "loadingMessage", "menuStyle", "name", "noOptionsMessage", "onChange", "onClose", "onFocus", "onKeyDown", "onOpen", "placeholder", "value" ]);
517
528
  // @docs-props-type SearchPropsBase
518
529
  // state
519
- var $ = (0, t.useState)(0), J = G($, 2), Q = J[0], Z = J[1];
520
- var ee = (0, t.useState)(false), re = G(ee, 2), ne = re[0], oe = re[1];
521
- var ae = (0, t.useState)(undefined), ue = G(ae, 2), le = ue[0], ce = ue[1];
522
- var fe = (0, t.useState)(l || ""), se = G(fe, 2), de = se[0], ve = se[1];
530
+ var z = (0, t.useState)(0), U = Q(z, 2), $ = U[0], J = U[1];
531
+ var Z = (0, t.useState)(false), ee = Q(Z, 2), re = ee[0], te = ee[1];
532
+ var ne = (0, t.useState)(undefined), ae = Q(ne, 2), ie = ae[0], ce = ae[1];
533
+ var fe = (0, t.useState)(u || ""), se = Q(fe, 2), de = se[0], ve = se[1];
523
534
  // previous state
524
- var pe = m()(Q);
535
+ var pe = j()($);
525
536
  // refs
526
537
  var be = (0, t.useRef)(null);
527
538
  var ye = (0, t.useRef)(null);
528
- var ge = (0, t.useRef)(W !== undefined && W !== null);
529
- var he = (0, t.useRef)(false);
530
- var me = (0, t.useRef)([]);
531
- var Oe = (0, t.useRef)((0, p.createDOMID)("popover"));
539
+ var he = (0, t.useRef)(F !== undefined && F !== null);
540
+ var me = (0, t.useRef)(false);
541
+ var ge = (0, t.useRef)([]);
542
+ var Oe = (0, t.useRef)((0, y.createDOMID)("popover"));
532
543
  var je = (0, t.useRef)(pe);
533
- var we = (0, t.useRef)((0, p.createDOMID)("active-item"));
544
+ var we = (0, t.useRef)((0, y.createDOMID)("active-item"));
534
545
  var Se = (0, t.useRef)(undefined);
535
546
  var Pe = function e(r) {
536
- z(be, r);
537
- z(h, r);
547
+ X(be, r);
548
+ X(d, r);
538
549
  };
539
550
  var ke = function e(r) {
540
- z(ye, r);
541
- z(M, r);
551
+ X(ye, r);
552
+ X(C, r);
542
553
  };
543
554
  var Ce = function e() {
544
- return ge.current ? W : de;
555
+ return he.current ? F : de;
545
556
  };
546
557
  var Re = function e() {
547
558
  var r = Ce();
548
- var n = t.Children.toArray(i).filter(t.isValidElement);
549
- var o = !le && n.find((function(e) {
559
+ var n = t.Children.toArray(a).filter(t.isValidElement);
560
+ var o = !ie && n.find((function(e) {
550
561
  return e.props.label !== undefined && e.props.value === r;
551
562
  }));
552
563
  if (o) {
@@ -555,56 +566,56 @@
555
566
  return r;
556
567
  };
557
568
  var Me = function e() {
558
- return !!i || D;
569
+ return !!a || E;
559
570
  };
560
571
  var Ee = function e() {
561
- oe(true);
562
- Z(-1);
563
- K === null || K === void 0 ? void 0 : K();
572
+ te(true);
573
+ J(-1);
574
+ L === null || L === void 0 ? void 0 : L();
564
575
  };
565
- var De = function e() {
566
- oe(false);
576
+ var xe = function e() {
577
+ te(false);
567
578
  je.current = null;
568
- V === null || V === void 0 ? void 0 : V();
579
+ B === null || B === void 0 ? void 0 : B();
569
580
  };
570
- var qe = function e() {
581
+ var De = function e() {
571
582
  var r;
572
583
  (r = ye.current) === null || r === void 0 ? void 0 : r.focus();
573
584
  };
574
- var xe = function e(r) {
585
+ var qe = function e(r, t) {
575
586
  /* SUI-930 On IE 11 this handler is essentially deferred after calling
576
587
  * this.textInput.focus(). this.focusCalledInternally enables the focus event to be ignored
577
588
  * when the menu closes. */
578
- if (he.current) {
579
- he.current = false;
589
+ if (me.current) {
590
+ me.current = false;
580
591
  } else {
581
592
  Ee();
582
593
  }
583
- L === null || L === void 0 ? void 0 : L(r);
594
+ V === null || V === void 0 ? void 0 : V(r, t);
584
595
  };
585
596
  var Ie = function e(r, t) {
586
597
  var n = t.value;
587
- if (!ge.current) {
598
+ if (!he.current) {
588
599
  ve(n);
589
600
  }
590
- Z(-1);
601
+ J(-1);
591
602
  ce(n);
592
- B === null || B === void 0 ? void 0 : B(r, {
603
+ T === null || T === void 0 ? void 0 : T(r, {
593
604
  value: n,
594
- name: A
605
+ name: _
595
606
  });
596
607
  };
597
608
  var _e = function e(r, t) {
598
- Ie(r, Y({}, t));
599
- he.current = true;
600
- qe();
609
+ Ie(r, G({}, t));
610
+ me.current = true;
601
611
  De();
612
+ xe();
602
613
  };
603
614
  var Ae = function e(r) {
604
- var t = me.current.length;
615
+ var t = ge.current.length;
605
616
  var n = Se.current;
606
- var o = (0, y.keycode)(r.nativeEvent);
607
- if (ne) {
617
+ var o = (0, m.keycode)(r.nativeEvent);
618
+ if (re) {
608
619
  switch (o) {
609
620
  case "enter":
610
621
  {
@@ -617,21 +628,21 @@
617
628
  }
618
629
 
619
630
  case "tab":
620
- De();
631
+ xe();
621
632
  break;
622
633
 
623
634
  case "down":
624
- Z(Math.min(Q + 1, t - 1));
635
+ J(Math.min($ + 1, t - 1));
625
636
  break;
626
637
 
627
638
  case "up":
628
- Z(Math.max(Q - 1, 0));
639
+ J(Math.max($ - 1, 0));
629
640
  break;
630
641
 
631
642
  default:
632
643
  // do nothing
633
644
  }
634
- } else if ((0, y.addsCharacter)(r.nativeEvent) !== false || // Safari 9.0 returns undefined
645
+ } else if ((0, m.addsCharacter)(r.nativeEvent) !== false || // Safari 9.0 returns undefined
635
646
  o === "enter" || o === "backspace" || o === "down" || o === "up") {
636
647
  Ee();
637
648
  }
@@ -639,39 +650,39 @@
639
650
  };
640
651
  var Te = function e() {
641
652
  if (document.activeElement !== ye.current) {
642
- he.current = true;
643
- qe();
653
+ me.current = true;
654
+ De();
644
655
  }
645
- if (!ne && !g) {
656
+ if (!re && !s) {
646
657
  Ee();
647
658
  }
648
659
  };
649
660
  var Be = function e(r) {
650
661
  var t = r.event, n = r.reason;
651
- var o = n === "offScreen" || n === "escapeKey" || n === "clickAway" && be.current && !ie(be.current, t);
662
+ var o = n === "offScreen" || n === "escapeKey" || n === "clickAway" && be.current && !ue(be.current, t);
652
663
  if (o) {
653
- De();
664
+ xe();
654
665
  }
655
666
  };
656
667
  var Ve = function e(r) {
657
- if (je.current !== Q) {
668
+ if (je.current !== $) {
658
669
  r === null || r === void 0 ? void 0 : r.scrollIntoViewIfNeeded();
659
670
  }
660
671
  };
661
- var Le = function e(r) {
662
- var a = r.anchorWidth, l = r.maxHeight;
663
- var f = t.Children.toArray(i).filter(t.isValidElement);
672
+ var He = function e(r) {
673
+ var i = r.anchorWidth, u = r.maxHeight;
674
+ var l = t.Children.toArray(a).filter(t.isValidElement);
664
675
  // Highlight Active
665
676
  Se.current = undefined;
666
677
  // Only update the menu options if they are valid and the drodown is open.
667
678
  // This is necessary to handle the outro animation of the dropdown.
668
- if (Me() && ne) {
669
- me.current = f.map((function(e, r) {
679
+ if (Me() && re) {
680
+ ge.current = l.map((function(e, r) {
670
681
  if (!c()(e.props, "active")) {
671
682
  // ignore Headings and Dividers
672
683
  return e;
673
684
  }
674
- if (r === Q) {
685
+ if (r === $) {
675
686
  Se.current = e.props.value;
676
687
 
677
688
  return (0, t.cloneElement)(e, {
@@ -687,79 +698,80 @@
687
698
  });
688
699
  }));
689
700
  }
701
+ var f = le({
702
+ anchorWidth: i,
703
+ maxHeight: u,
704
+ menuStyle: I
705
+ });
690
706
 
691
- return n().createElement(S(), U({
692
- style: u()({
693
- overflow: "auto",
694
- width: Math.max(a !== null && a !== void 0 ? a : 0, 200)
695
- }, _),
707
+ return n().createElement(k(), Y({
708
+ style: f,
696
709
  controlledExternally: true,
697
- maxHeight: l !== null && l !== void 0 ? l : undefined,
698
- isLoading: D
699
- }, v()(X, "className", "onScroll"), {
700
- noOptionsMessage: T,
701
- footerMessage: P,
710
+ isLoading: E
711
+ }, b()(W, "className", "onScroll"), {
712
+ noOptionsMessage: A,
713
+ footerMessage: O,
702
714
  animateLoading: o,
703
- loadingMessage: x
704
- }), me.current);
715
+ loadingMessage: D
716
+ }), ge.current);
705
717
  };
706
- var He = Ce();
718
+ var Le = Ce();
707
719
  var Ke = Re();
708
- var Ne = ne && !!be.current && Me();
720
+ var Ne = re && !!be.current && Me();
709
721
  var Fe = {
710
722
  "aria-activedescendant": we.current,
711
723
  "aria-expanded": Ne,
712
724
  "aria-haspopup": Me(),
713
725
  "aria-controls": Ne ? Oe.current : undefined
714
726
  };
715
- if (!(q === null || q === void 0 ? void 0 : q.length)) {
716
- Fe["aria-label"] = (0, b._)("Value input");
727
+ if (!(x === null || x === void 0 ? void 0 : x.length)) {
728
+ Fe["aria-label"] = (0, h._)("Value input");
717
729
  }
718
730
 
719
- return n().createElement(k(), U({
731
+ return n().createElement(R(), Y({
720
732
  "data-test": "search"
721
- }, s()(X, "className", "onScroll"), {
733
+ }, v()(W, "className", "onScroll"), {
722
734
  appearance: "search",
723
735
  autoCapitalize: "off",
724
736
  autoComplete: "off",
725
737
  autoCorrect: "off",
726
738
  "data-test-popover-id": Oe.current,
727
739
  "data-test-label": Ke,
728
- "data-test-value": He,
740
+ "data-test-value": Le,
729
741
  "data-test-open": Ne,
730
- describedBy: f,
731
- disabled: g,
742
+ describedBy: l,
743
+ disabled: s,
732
744
  elementRef: Pe,
733
- error: w,
734
- inline: R,
745
+ error: g,
746
+ inline: P,
735
747
  inputRef: ke,
736
- labelledBy: q,
737
- name: A,
738
- onFocus: xe,
748
+ labelledBy: x,
749
+ name: _,
750
+ onFocus: qe,
739
751
  onClick: Te,
740
752
  onChange: Ie,
741
753
  onKeyDown: Ae,
742
- placeholder: F,
754
+ placeholder: N,
743
755
  spellCheck: false,
744
756
  value: Ke
745
- }, Fe), n().createElement(j(), {
757
+ }, Fe), n().createElement(S(), {
746
758
  anchor: function() {
747
759
  return be.current;
748
760
  }(),
749
761
  autoCloseWhenOffScreen: true,
750
762
  canCoverAnchor: false,
751
- defaultPlacement: a,
763
+ defaultPlacement: i,
752
764
  id: Oe.current,
753
765
  onRequestClose: Be,
754
766
  open: Ne,
755
767
  repositionMode: "flip"
756
- }, Le));
768
+ }, He));
757
769
  }
758
- ae.propTypes = oe;
759
- ae.Option = W;
760
- ae.Divider = g.Divider;
761
- ae.Heading = g.Heading;
762
- /* harmony default export */ const ue = ae;
770
+ ce.propTypes = ie;
771
+ ce.Option = U;
772
+ ce.Divider = g.Divider;
773
+ ce.Heading = g.Heading;
774
+ /* harmony default export */ const fe = ce;
763
775
  // CONCATENATED MODULE: ./src/Search/index.ts
764
776
  module.exports = r;
765
777
  /******/})();