@splunk/react-ui 4.23.0 → 4.24.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 (36) hide show
  1. package/Breadcrumbs.js +99 -124
  2. package/CHANGELOG.md +11 -0
  3. package/ComboBox.js +49 -37
  4. package/JSONTree.js +210 -177
  5. package/Menu.js +643 -472
  6. package/Modal.js +261 -222
  7. package/Multiselect.js +634 -620
  8. package/ResultsMenu.js +863 -148
  9. package/Search.js +3 -1
  10. package/Select.js +427 -416
  11. package/TabBar.js +2 -2
  12. package/Table.js +2 -2
  13. package/Tree.js +617 -0
  14. package/package.json +1 -1
  15. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +7 -1
  16. package/types/src/Breadcrumbs/Item.d.ts +8 -2
  17. package/types/src/ComboBox/ComboBox.d.ts +6 -0
  18. package/types/src/JSONTree/JSONTree.d.ts +2 -1
  19. package/types/src/Menu/Menu.d.ts +14 -1
  20. package/types/src/Modal/Modal.d.ts +6 -0
  21. package/types/src/Multiselect/Compact.d.ts +6 -0
  22. package/types/src/Multiselect/Multiselect.d.ts +7 -0
  23. package/types/src/ResultsMenu/ResultsMenu.d.ts +53 -1
  24. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedItem.d.ts +9 -0
  25. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +33 -0
  26. package/types/src/ResultsMenu/VirtualizedResultsMenu/groupChildren.d.ts +16 -0
  27. package/types/src/ResultsMenu/VirtualizedResultsMenu/index.d.ts +3 -0
  28. package/types/src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.d.ts +21 -0
  29. package/types/src/ResultsMenu/index.d.ts +2 -1
  30. package/types/src/Select/Select.d.ts +2 -0
  31. package/types/src/Select/SelectBase.d.ts +6 -0
  32. package/types/src/Tree/Tree.d.ts +24 -0
  33. package/types/src/Tree/TreeContext.d.ts +13 -0
  34. package/types/src/Tree/TreeItem.d.ts +31 -0
  35. package/types/src/Tree/index.d.ts +3 -0
  36. package/types/src/Tree/treeUtils.d.ts +29 -0
package/Modal.js CHANGED
@@ -61,10 +61,10 @@
61
61
  e.r(t);
62
62
  // EXPORTS
63
63
  e.d(t, {
64
- Body: () => /* reexport */ F,
65
- Footer: () => /* reexport */ K,
66
- Header: () => /* reexport */ ae,
67
- default: () => /* reexport */ qe
64
+ Body: () => /* reexport */ R,
65
+ Footer: () => /* reexport */ V,
66
+ Header: () => /* reexport */ ce,
67
+ default: () => /* reexport */ Re
68
68
  });
69
69
  // CONCATENATED MODULE: external "react"
70
70
  const r = require("react");
@@ -78,47 +78,50 @@
78
78
  // CONCATENATED MODULE: external "lodash/keys"
79
79
  const c = require("lodash/keys");
80
80
  var s = e.n(c);
81
- // CONCATENATED MODULE: external "lodash/omit"
82
- const u = require("lodash/omit");
81
+ // CONCATENATED MODULE: external "lodash/memoize"
82
+ const u = require("lodash/memoize");
83
83
  var p = e.n(u);
84
- // CONCATENATED MODULE: external "@splunk/react-ui/ModalLayer"
85
- const f = require("@splunk/react-ui/ModalLayer");
84
+ // CONCATENATED MODULE: external "lodash/omit"
85
+ const f = require("lodash/omit");
86
86
  var d = e.n(f);
87
+ // CONCATENATED MODULE: external "@splunk/react-ui/ModalLayer"
88
+ const y = require("@splunk/react-ui/ModalLayer");
89
+ var m = e.n(y);
87
90
  // CONCATENATED MODULE: external "@splunk/ui-utils/focus"
88
- const y = require("@splunk/ui-utils/focus");
91
+ const b = require("@splunk/ui-utils/focus");
89
92
  // CONCATENATED MODULE: external "@splunk/ui-utils/id"
90
- const b = require("@splunk/ui-utils/id");
93
+ const v = require("@splunk/ui-utils/id");
91
94
  // CONCATENATED MODULE: external "@splunk/react-ui/ScrollContainerContext"
92
- const m = require("@splunk/react-ui/ScrollContainerContext");
95
+ const h = require("@splunk/react-ui/ScrollContainerContext");
93
96
  // CONCATENATED MODULE: external "styled-components"
94
- const v = require("styled-components");
95
- var h = e.n(v);
96
- // CONCATENATED MODULE: external "@splunk/react-ui/Box"
97
- const g = require("@splunk/react-ui/Box");
97
+ const g = require("styled-components");
98
98
  var x = e.n(g);
99
+ // CONCATENATED MODULE: external "@splunk/react-ui/Box"
100
+ const O = require("@splunk/react-ui/Box");
101
+ var S = e.n(O);
99
102
  // CONCATENATED MODULE: external "@splunk/themes"
100
- const O = require("@splunk/themes");
103
+ const w = require("@splunk/themes");
101
104
  // CONCATENATED MODULE: ./src/Modal/BodyStyles.ts
102
- var w = h()(x()).withConfig({
105
+ var k = x()(S()).withConfig({
103
106
  displayName: "BodyStyles__StyledBox",
104
107
  componentId: "lv54z7-0"
105
108
  })([ "background-color:", ";", " flex:0 1 auto;overflow:auto;@media all and (-ms-high-contrast:none){*::-ms-backdrop,&{max-height:calc(100vh - 180px);}}" ], (0,
106
- O.pick)({
107
- enterprise: O.variables.backgroundColor,
108
- prisma: O.variables.backgroundColorDialog
109
- }), (0, O.pick)({
109
+ w.pick)({
110
+ enterprise: w.variables.backgroundColor,
111
+ prisma: w.variables.backgroundColorDialog
112
+ }), (0, w.pick)({
110
113
  enterprise: {
111
- comfortable: (0, v.css)([ "padding:28px;" ]),
112
- compact: (0, v.css)([ "padding:24px;" ])
114
+ comfortable: (0, g.css)([ "padding:28px;" ]),
115
+ compact: (0, g.css)([ "padding:24px;" ])
113
116
  },
114
117
  prisma: {
115
- comfortable: (0, v.css)([ "padding:12px 24px;&:first-child{padding-top:36px;}&:last-child{padding-bottom:36px;}" ]),
116
- compact: (0, v.css)([ "padding:8px 24px;&:first-child{padding-top:26px;}&:last-child{padding-bottom:26px;}" ])
118
+ comfortable: (0, g.css)([ "padding:12px 24px;&:first-child{padding-top:36px;}&:last-child{padding-bottom:36px;}" ]),
119
+ compact: (0, g.css)([ "padding:8px 24px;&:first-child{padding-top:26px;}&:last-child{padding-bottom:26px;}" ])
117
120
  }
118
121
  }));
119
122
  // CONCATENATED MODULE: ./src/Modal/Body.tsx
120
- function S() {
121
- S = Object.assign || function(e) {
123
+ function j() {
124
+ j = Object.assign || function(e) {
122
125
  for (var t = 1; t < arguments.length; t++) {
123
126
  var r = arguments[t];
124
127
  for (var n in r) {
@@ -129,30 +132,30 @@
129
132
  }
130
133
  return e;
131
134
  };
132
- return S.apply(this, arguments);
135
+ return j.apply(this, arguments);
133
136
  }
134
- function k(e, t) {
135
- return _(e) || P(e, t) || C(e, t) || j();
137
+ function C(e, t) {
138
+ return M(e) || E(e, t) || P(e, t) || I();
136
139
  }
137
- function j() {
140
+ function I() {
138
141
  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
142
  }
140
- function C(e, t) {
143
+ function P(e, t) {
141
144
  if (!e) return;
142
- if (typeof e === "string") return I(e, t);
145
+ if (typeof e === "string") return _(e, t);
143
146
  var r = Object.prototype.toString.call(e).slice(8, -1);
144
147
  if (r === "Object" && e.constructor) r = e.constructor.name;
145
148
  if (r === "Map" || r === "Set") return Array.from(e);
146
- if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return I(e, t);
149
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return _(e, t);
147
150
  }
148
- function I(e, t) {
151
+ function _(e, t) {
149
152
  if (t == null || t > e.length) t = e.length;
150
153
  for (var r = 0, n = new Array(t); r < t; r++) {
151
154
  n[r] = e[r];
152
155
  }
153
156
  return n;
154
157
  }
155
- function P(e, t) {
158
+ function E(e, t) {
156
159
  if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
157
160
  var r = [];
158
161
  var n = true;
@@ -175,12 +178,12 @@
175
178
  }
176
179
  return r;
177
180
  }
178
- function _(e) {
181
+ function M(e) {
179
182
  if (Array.isArray(e)) return e;
180
183
  }
181
- function E(e, t) {
184
+ function T(e, t) {
182
185
  if (e == null) return {};
183
- var r = T(e, t);
186
+ var r = q(e, t);
184
187
  var n, o;
185
188
  if (Object.getOwnPropertySymbols) {
186
189
  var i = Object.getOwnPropertySymbols(e);
@@ -193,7 +196,7 @@
193
196
  }
194
197
  return r;
195
198
  }
196
- function T(e, t) {
199
+ function q(e, t) {
197
200
  if (e == null) return {};
198
201
  var r = {};
199
202
  var n = Object.keys(e);
@@ -205,53 +208,53 @@
205
208
  }
206
209
  return r;
207
210
  }
208
- var M = {
211
+ var F = {
209
212
  children: i().node
210
213
  };
211
214
  /**
212
215
  * A styled container for `Modal` body content.
213
- */ function q(e) {
214
- var t = e.children, o = E(e, [ "children" ]);
216
+ */ function D(e) {
217
+ var t = e.children, o = T(e, [ "children" ]);
215
218
  // @docs-props-type BodyPropsBase
216
- var i = (0, r.useState)(), a = k(i, 2), l = a[0], c = a[1];
219
+ var i = (0, r.useState)(), a = C(i, 2), l = a[0], c = a[1];
217
220
  var s = (0, r.useCallback)((function(e) {
218
221
  c(e);
219
222
  }), []);
220
223
 
221
- return n().createElement(w, S({
224
+ return n().createElement(k, j({
222
225
  "data-test": "body"
223
226
  }, o, {
224
227
  elementRef: s
225
- }), n().createElement(m.ScrollContainerProvider, {
228
+ }), n().createElement(h.ScrollContainerProvider, {
226
229
  value: l
227
230
  }, t));
228
231
  }
229
- q.propTypes = M;
230
- /* harmony default export */ const F = q;
232
+ D.propTypes = F;
233
+ /* harmony default export */ const R = D;
231
234
  // CONCATENATED MODULE: external "@splunk/react-ui/Divider"
232
- const D = require("@splunk/react-ui/Divider");
233
- var R = e.n(D);
235
+ const A = require("@splunk/react-ui/Divider");
236
+ var B = e.n(A);
234
237
  // CONCATENATED MODULE: ./src/Modal/FooterStyles.ts
235
- var A = h()(x()).withConfig({
238
+ var H = x()(S()).withConfig({
236
239
  displayName: "FooterStyles__StyledBox",
237
240
  componentId: "yszcmv-0"
238
241
  })([ "flex:0 0 auto;text-align:right;padding:", ";background-color:", ";& > button{min-width:80px;}" ], (0,
239
- O.pick)({
240
- enterprise: O.variables.spacing,
242
+ w.pick)({
243
+ enterprise: w.variables.spacing,
241
244
  prisma: {
242
245
  comfortable: "24px",
243
246
  compact: "18px 24px"
244
247
  }
245
- }), (0, O.pick)({
246
- enterprise: O.variables.backgroundColor,
247
- prisma: O.variables.backgroundColorDialog
248
+ }), (0, w.pick)({
249
+ enterprise: w.variables.backgroundColor,
250
+ prisma: w.variables.backgroundColorDialog
248
251
  }));
249
252
  // CONCATENATED MODULE: ./src/Modal/ModalContext.tsx
250
- var B = (0, r.createContext)({});
251
- /* harmony default export */ const H = B;
253
+ var N = (0, r.createContext)({});
254
+ /* harmony default export */ const z = N;
252
255
  // CONCATENATED MODULE: ./src/Modal/Footer.tsx
253
- function N() {
254
- N = Object.assign || function(e) {
256
+ function L() {
257
+ L = Object.assign || function(e) {
255
258
  for (var t = 1; t < arguments.length; t++) {
256
259
  var r = arguments[t];
257
260
  for (var n in r) {
@@ -262,11 +265,11 @@
262
265
  }
263
266
  return e;
264
267
  };
265
- return N.apply(this, arguments);
268
+ return L.apply(this, arguments);
266
269
  }
267
- function z(e, t) {
270
+ function X(e, t) {
268
271
  if (e == null) return {};
269
- var r = L(e, t);
272
+ var r = $(e, t);
270
273
  var n, o;
271
274
  if (Object.getOwnPropertySymbols) {
272
275
  var i = Object.getOwnPropertySymbols(e);
@@ -279,7 +282,7 @@
279
282
  }
280
283
  return r;
281
284
  }
282
- function L(e, t) {
285
+ function $(e, t) {
283
286
  if (e == null) return {};
284
287
  var r = {};
285
288
  var n = Object.keys(e);
@@ -291,43 +294,43 @@
291
294
  }
292
295
  return r;
293
296
  }
294
- var X = {
297
+ var K = {
295
298
  children: i().node
296
299
  };
297
300
  /**
298
301
  * A styled container for `Modal` footer content.
299
- */ function $(e) {
300
- var t = e.children, o = z(e, [ "children" ]);
302
+ */ function U(e) {
303
+ var t = e.children, o = X(e, [ "children" ]);
301
304
  // @docs-props-type FooterPropsBase
302
- var i = (0, r.useContext)(H), a = i.divider;
305
+ var i = (0, r.useContext)(z), a = i.divider;
303
306
  var l = a === "both" || a === "footer";
304
307
 
305
- return n().createElement(n().Fragment, null, l && n().createElement(R(), {
308
+ return n().createElement(n().Fragment, null, l && n().createElement(B(), {
306
309
  "aria-hidden": true
307
- }), n().createElement(A, N({
310
+ }), n().createElement(H, L({
308
311
  "data-test": "footer"
309
312
  }, o), t));
310
313
  }
311
- $.propTypes = X;
312
- /* harmony default export */ const K = $;
314
+ U.propTypes = K;
315
+ /* harmony default export */ const V = U;
313
316
  // CONCATENATED MODULE: external "@splunk/react-ui/CloseButton"
314
- const U = require("@splunk/react-ui/CloseButton");
315
- var W = e.n(U);
317
+ const W = require("@splunk/react-ui/CloseButton");
318
+ var G = e.n(W);
316
319
  // CONCATENATED MODULE: ./src/Modal/HeaderStyles.ts
317
- var V = h()(x()).withConfig({
320
+ var J = x()(S()).withConfig({
318
321
  displayName: "HeaderStyles__StyledBox",
319
322
  componentId: "sc-1y722ut-0"
320
- })([ "", ";flex:0 0 auto;position:relative;min-height:", ";background-color:", ";padding:", ";align-items:center;padding-right:", ";" ], O.mixins.reset("flex"), (0,
321
- O.pick)({
323
+ })([ "", ";flex:0 0 auto;position:relative;min-height:", ";background-color:", ";padding:", ";align-items:center;padding-right:", ";" ], w.mixins.reset("flex"), (0,
324
+ w.pick)({
322
325
  enterprise: "30px",
323
326
  prisma: {
324
327
  comfortable: "60px",
325
328
  compact: "52px"
326
329
  }
327
- }), (0, O.pick)({
328
- enterprise: O.variables.backgroundColor,
329
- prisma: O.variables.backgroundColorDialog
330
- }), (0, O.pick)({
330
+ }), (0, w.pick)({
331
+ enterprise: w.variables.backgroundColor,
332
+ prisma: w.variables.backgroundColorDialog
333
+ }), (0, w.pick)({
331
334
  enterprise: "25px 28px",
332
335
  prisma: {
333
336
  comfortable: "18px 24px",
@@ -335,7 +338,7 @@
335
338
  }
336
339
  }), (function(e) {
337
340
  var t = e.$close;
338
- return t && (0, O.pick)({
341
+ return t && (0, w.pick)({
339
342
  enterprise: "54px",
340
343
  prisma: {
341
344
  comfortable: "64px",
@@ -343,68 +346,68 @@
343
346
  }
344
347
  });
345
348
  }));
346
- var G = h().div.withConfig({
349
+ var Q = x().div.withConfig({
347
350
  displayName: "HeaderStyles__StyledTitleWrapper",
348
351
  componentId: "sc-1y722ut-1"
349
- })([ "", ";flex-direction:column;" ], O.mixins.reset("flex"));
350
- var J = h().div.withConfig({
352
+ })([ "", ";flex-direction:column;" ], w.mixins.reset("flex"));
353
+ var Y = x().div.withConfig({
351
354
  displayName: "HeaderStyles__StyledIcon",
352
355
  componentId: "sc-1y722ut-2"
353
- })([ "", ";align-items:center;justify-content:center;margin-right:", ";", " width:", ";height:", ";flex-shrink:0;" ], O.mixins.reset("inline-flex"), O.variables.spacingLarge, (0,
354
- O.pick)({
355
- prisma: (0, v.css)([ "background-color:", ";" ], O.variables.transparent)
356
- }), (0, O.pick)({
356
+ })([ "", ";align-items:center;justify-content:center;margin-right:", ";", " width:", ";height:", ";flex-shrink:0;" ], w.mixins.reset("inline-flex"), w.variables.spacingLarge, (0,
357
+ w.pick)({
358
+ prisma: (0, g.css)([ "background-color:", ";" ], w.variables.transparent)
359
+ }), (0, w.pick)({
357
360
  comfortable: "40px",
358
361
  compact: "32px"
359
- }), (0, O.pick)({
362
+ }), (0, w.pick)({
360
363
  comfortable: "40px",
361
364
  compact: "32px"
362
365
  }));
363
- var Q = h().div.withConfig({
366
+ var Z = x().div.withConfig({
364
367
  displayName: "HeaderStyles__StyledTitle",
365
368
  componentId: "sc-1y722ut-3"
366
- })([ "", ";font-size:20px;margin:0;overflow-wrap:break-word;font-weight:", ";", "" ], O.mixins.reset("block"), O.variables.fontWeightSemiBold, (0,
367
- O.pick)({
368
- enterprise: (0, v.css)([ "line-height:22px;" ]),
369
- prisma: (0, v.css)([ "color:", ";line-height:24px;" ], O.variables.contentColorActive)
369
+ })([ "", ";font-size:20px;margin:0;overflow-wrap:break-word;font-weight:", ";", "" ], w.mixins.reset("block"), w.variables.fontWeightSemiBold, (0,
370
+ w.pick)({
371
+ enterprise: (0, g.css)([ "line-height:22px;" ]),
372
+ prisma: (0, g.css)([ "color:", ";line-height:24px;" ], w.variables.contentColorActive)
370
373
  }));
371
- var Y = h().div.withConfig({
374
+ var ee = x().div.withConfig({
372
375
  displayName: "HeaderStyles__StyledSubtitle",
373
376
  componentId: "sc-1y722ut-4"
374
- })([ "", ";font-size:14px;overflow-wrap:break-word;line-height:", ";" ], O.mixins.reset("block"), (0,
375
- O.pick)({
376
- enterprise: O.variables.lineHeight,
377
+ })([ "", ";font-size:14px;overflow-wrap:break-word;line-height:", ";" ], w.mixins.reset("block"), (0,
378
+ w.pick)({
379
+ enterprise: w.variables.lineHeight,
377
380
  prisma: "20px"
378
381
  }));
379
- var Z = h().div.withConfig({
382
+ var te = x().div.withConfig({
380
383
  displayName: "HeaderStyles__StyledButtonsWrapper",
381
384
  componentId: "sc-1y722ut-5"
382
- })([ "", ";position:absolute;top:", ";right:", ";bottom:50%;", " max-height:35px;transform-origin:bottom right;transform:rotate(-90deg) translateX(100%);" ], O.mixins.reset("block"), (0,
383
- O.pick)({
385
+ })([ "", ";position:absolute;top:", ";right:", ";bottom:50%;", " max-height:35px;transform-origin:bottom right;transform:rotate(-90deg) translateX(100%);" ], w.mixins.reset("block"), (0,
386
+ w.pick)({
384
387
  enterprise: 0,
385
388
  prisma: {
386
389
  comfortable: "-2px",
387
390
  compact: "-6px"
388
391
  }
389
- }), (0, O.pick)({
392
+ }), (0, w.pick)({
390
393
  enterprise: 0,
391
394
  prisma: {
392
395
  comfortable: "-2px",
393
396
  compact: "-6px"
394
397
  }
395
- }), (0, O.pick)({
398
+ }), (0, w.pick)({
396
399
  prisma: {
397
- comfortable: (0, v.css)([ "min-height:35px;" ]),
398
- compact: (0, v.css)([ "min-height:30px;" ])
400
+ comfortable: (0, g.css)([ "min-height:35px;" ]),
401
+ compact: (0, g.css)([ "min-height:30px;" ])
399
402
  }
400
403
  }));
401
- var ee = h().div.withConfig({
404
+ var re = x().div.withConfig({
402
405
  displayName: "HeaderStyles__StyledClose",
403
406
  componentId: "sc-1y722ut-6"
404
- })([ "", ";position:absolute;right:0;top:0;transform:rotate(90deg) translate(-50%,-50%);" ], O.mixins.reset("block"));
407
+ })([ "", ";position:absolute;right:0;top:0;transform:rotate(90deg) translate(-50%,-50%);" ], w.mixins.reset("block"));
405
408
  // CONCATENATED MODULE: ./src/Modal/Header.tsx
406
- function te() {
407
- te = Object.assign || function(e) {
409
+ function ne() {
410
+ ne = Object.assign || function(e) {
408
411
  for (var t = 1; t < arguments.length; t++) {
409
412
  var r = arguments[t];
410
413
  for (var n in r) {
@@ -415,11 +418,11 @@
415
418
  }
416
419
  return e;
417
420
  };
418
- return te.apply(this, arguments);
421
+ return ne.apply(this, arguments);
419
422
  }
420
- function re(e, t) {
423
+ function oe(e, t) {
421
424
  if (e == null) return {};
422
- var r = ne(e, t);
425
+ var r = ie(e, t);
423
426
  var n, o;
424
427
  if (Object.getOwnPropertySymbols) {
425
428
  var i = Object.getOwnPropertySymbols(e);
@@ -432,7 +435,7 @@
432
435
  }
433
436
  return r;
434
437
  }
435
- function ne(e, t) {
438
+ function ie(e, t) {
436
439
  if (e == null) return {};
437
440
  var r = {};
438
441
  var n = Object.keys(e);
@@ -444,7 +447,7 @@
444
447
  }
445
448
  return r;
446
449
  }
447
- var oe = {
450
+ var ae = {
448
451
  children: i().node,
449
452
  icon: i().node,
450
453
  onRequestClose: i().func,
@@ -453,43 +456,62 @@
453
456
  };
454
457
  /**
455
458
  * A styled container for `Modal` header content.
456
- */ function ie(e) {
457
- var t = e.children, o = e.icon, i = e.onRequestClose, a = e.subtitle, l = e.title, c = re(e, [ "children", "icon", "onRequestClose", "subtitle", "title" ]);
459
+ */ function le(e) {
460
+ var t = e.children, o = e.icon, i = e.onRequestClose, a = e.subtitle, l = e.title, c = oe(e, [ "children", "icon", "onRequestClose", "subtitle", "title" ]);
458
461
  // @docs-props-type StepPropsBase
459
- var s = (0, r.useContext)(H), u = s.titleId, p = s.divider;
462
+ var s = (0, r.useContext)(z), u = s.titleId, p = s.divider;
460
463
  var f = p === "both" || p === "header";
461
464
 
462
- return n().createElement(n().Fragment, null, n().createElement(V, te({
465
+ return n().createElement(n().Fragment, null, n().createElement(J, ne({
463
466
  $close: !!i,
464
467
  "data-test": "header"
465
- }, c), o && n().createElement(J, null, o), l ? n().createElement(G, null, l && n().createElement(Q, {
468
+ }, c), o && n().createElement(Y, null, o), l ? n().createElement(Q, null, l && n().createElement(Z, {
466
469
  id: u,
467
470
  "data-test": "title"
468
- }, l), a && n().createElement(Y, {
471
+ }, l), a && n().createElement(ee, {
469
472
  "data-test": "subtitle"
470
- }, a)) : t, i && n().createElement(Z, null, i && n().createElement(ee, null, n().createElement(W(), {
473
+ }, a)) : t, i && n().createElement(te, null, i && n().createElement(re, null, n().createElement(G(), {
471
474
  onClick: i,
472
475
  "data-test": "close"
473
- })))), f && n().createElement(R(), {
476
+ })))), f && n().createElement(B(), {
474
477
  "aria-hidden": true
475
478
  }));
476
479
  }
477
- ie.propTypes = oe;
478
- /* harmony default export */ const ae = ie;
480
+ le.propTypes = ae;
481
+ /* harmony default export */ const ce = le;
479
482
  // CONCATENATED MODULE: external "react-spring"
480
- const le = require("react-spring");
483
+ const se = require("react-spring");
481
484
  // CONCATENATED MODULE: ./src/Modal/ModalStyles.ts
482
- var ce = h()(le.animated.div).withConfig({
485
+ var ue = x()(se.animated.div).withConfig({
483
486
  displayName: "ModalStyles__Styled",
484
487
  componentId: "sc-5fn8ds-0"
485
- })([ "", ";flex-direction:column;position:fixed;left:50%;transform:translateX(-50%);z-index:", ";", "" ], O.mixins.reset("flex"), O.variables.zindexModal, (0,
486
- O.pick)({
487
- enterprise: (0, v.css)([ "box-shadow:0 1px 5px ", ";max-height:calc(100vh - ", " * 4);max-width:calc(100vw - ", " * 4);" ], O.variables.black, O.variables.spacing, O.variables.spacing),
488
- prisma: (0, v.css)([ "box-shadow:", ";max-height:calc(100vh - ", " * 4);max-width:calc(100vw - ", " * 4);border-radius:", ";overflow:hidden;" ], O.variables.modalShadow, O.variables.spacingXLarge, O.variables.spacingXLarge, O.variables.borderRadius)
488
+ })([ "", ";flex-direction:column;position:fixed;left:50%;transform:translateX(-50%);z-index:", ";", "" ], w.mixins.reset("flex"), w.variables.zindexModal, (0,
489
+ w.pick)({
490
+ enterprise: (0, g.css)([ "box-shadow:0 1px 5px ", ";max-height:calc(100vh - ", " * 4);max-width:calc(100vw - ", " * 4);" ], w.variables.black, w.variables.spacing, w.variables.spacing),
491
+ prisma: (0, g.css)([ "box-shadow:", ";max-height:calc(100vh - ", " * 4);max-width:calc(100vw - ", " * 4);border-radius:", ";overflow:hidden;" ], w.variables.modalShadow, w.variables.spacingXLarge, w.variables.spacingXLarge, w.variables.borderRadius)
489
492
  }));
493
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
494
+ /**
495
+ * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
496
+ *
497
+ * @param ref - The React callback or object ref. Can be `null` or `undefined`.
498
+ * @param current - The new value of the ref.
499
+ */
500
+ function pe(e, t) {
501
+ if (e) {
502
+ if (typeof e === "function") {
503
+ e(t);
504
+ } else {
505
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
506
+ // the intention here is to signal "we will take care of setting 'current', not you".
507
+ e.current = t;
508
+ // eslint-disable-line no-param-reassign
509
+ }
510
+ }
511
+ }
490
512
  // CONCATENATED MODULE: ./src/Modal/Modal.tsx
491
- function se() {
492
- se = Object.assign || function(e) {
513
+ function fe() {
514
+ fe = Object.assign || function(e) {
493
515
  for (var t = 1; t < arguments.length; t++) {
494
516
  var r = arguments[t];
495
517
  for (var n in r) {
@@ -500,36 +522,36 @@
500
522
  }
501
523
  return e;
502
524
  };
503
- return se.apply(this, arguments);
525
+ return fe.apply(this, arguments);
504
526
  }
505
- function ue(e) {
506
- return ye(e) || de(e) || fe(e) || pe();
527
+ function de(e) {
528
+ return ve(e) || be(e) || me(e) || ye();
507
529
  }
508
- function pe() {
530
+ function ye() {
509
531
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
510
532
  }
511
- function fe(e, t) {
533
+ function me(e, t) {
512
534
  if (!e) return;
513
- if (typeof e === "string") return be(e, t);
535
+ if (typeof e === "string") return he(e, t);
514
536
  var r = Object.prototype.toString.call(e).slice(8, -1);
515
537
  if (r === "Object" && e.constructor) r = e.constructor.name;
516
538
  if (r === "Map" || r === "Set") return Array.from(e);
517
- if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return be(e, t);
539
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return he(e, t);
518
540
  }
519
- function de(e) {
541
+ function be(e) {
520
542
  if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
521
543
  }
522
- function ye(e) {
523
- if (Array.isArray(e)) return be(e);
544
+ function ve(e) {
545
+ if (Array.isArray(e)) return he(e);
524
546
  }
525
- function be(e, t) {
547
+ function he(e, t) {
526
548
  if (t == null || t > e.length) t = e.length;
527
549
  for (var r = 0, n = new Array(t); r < t; r++) {
528
550
  n[r] = e[r];
529
551
  }
530
552
  return n;
531
553
  }
532
- function me(e, t) {
554
+ function ge(e, t) {
533
555
  var r = Object.keys(e);
534
556
  if (Object.getOwnPropertySymbols) {
535
557
  var n = Object.getOwnPropertySymbols(e);
@@ -540,42 +562,42 @@
540
562
  }
541
563
  return r;
542
564
  }
543
- function ve(e) {
565
+ function xe(e) {
544
566
  for (var t = 1; t < arguments.length; t++) {
545
567
  var r = arguments[t] != null ? arguments[t] : {};
546
568
  if (t % 2) {
547
- me(Object(r), true).forEach((function(t) {
548
- _e(e, t, r[t]);
569
+ ge(Object(r), true).forEach((function(t) {
570
+ Te(e, t, r[t]);
549
571
  }));
550
572
  } else if (Object.getOwnPropertyDescriptors) {
551
573
  Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
552
574
  } else {
553
- me(Object(r)).forEach((function(t) {
575
+ ge(Object(r)).forEach((function(t) {
554
576
  Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
555
577
  }));
556
578
  }
557
579
  }
558
580
  return e;
559
581
  }
560
- function he(e) {
582
+ function Oe(e) {
561
583
  "@babel/helpers - typeof";
562
584
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
563
- he = function e(t) {
585
+ Oe = function e(t) {
564
586
  return typeof t;
565
587
  };
566
588
  } else {
567
- he = function e(t) {
589
+ Oe = function e(t) {
568
590
  return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
569
591
  };
570
592
  }
571
- return he(e);
593
+ return Oe(e);
572
594
  }
573
- function ge(e, t) {
595
+ function Se(e, t) {
574
596
  if (!(e instanceof t)) {
575
597
  throw new TypeError("Cannot call a class as a function");
576
598
  }
577
599
  }
578
- function xe(e, t) {
600
+ function we(e, t) {
579
601
  for (var r = 0; r < t.length; r++) {
580
602
  var n = t[r];
581
603
  n.enumerable = n.enumerable || false;
@@ -584,12 +606,12 @@
584
606
  Object.defineProperty(e, n.key, n);
585
607
  }
586
608
  }
587
- function Oe(e, t, r) {
588
- if (t) xe(e.prototype, t);
589
- if (r) xe(e, r);
609
+ function ke(e, t, r) {
610
+ if (t) we(e.prototype, t);
611
+ if (r) we(e, r);
590
612
  return e;
591
613
  }
592
- function we(e, t) {
614
+ function je(e, t) {
593
615
  if (typeof t !== "function" && t !== null) {
594
616
  throw new TypeError("Super expression must either be null or a function");
595
617
  }
@@ -600,41 +622,41 @@
600
622
  configurable: true
601
623
  }
602
624
  });
603
- if (t) Se(e, t);
625
+ if (t) Ce(e, t);
604
626
  }
605
- function Se(e, t) {
606
- Se = Object.setPrototypeOf || function e(t, r) {
627
+ function Ce(e, t) {
628
+ Ce = Object.setPrototypeOf || function e(t, r) {
607
629
  t.__proto__ = r;
608
630
  return t;
609
631
  };
610
- return Se(e, t);
632
+ return Ce(e, t);
611
633
  }
612
- function ke(e) {
613
- var t = Ie();
634
+ function Ie(e) {
635
+ var t = Ee();
614
636
  return function r() {
615
- var n = Pe(e), o;
637
+ var n = Me(e), o;
616
638
  if (t) {
617
- var i = Pe(this).constructor;
639
+ var i = Me(this).constructor;
618
640
  o = Reflect.construct(n, arguments, i);
619
641
  } else {
620
642
  o = n.apply(this, arguments);
621
643
  }
622
- return je(this, o);
644
+ return Pe(this, o);
623
645
  };
624
646
  }
625
- function je(e, t) {
626
- if (t && (he(t) === "object" || typeof t === "function")) {
647
+ function Pe(e, t) {
648
+ if (t && (Oe(t) === "object" || typeof t === "function")) {
627
649
  return t;
628
650
  }
629
- return Ce(e);
651
+ return _e(e);
630
652
  }
631
- function Ce(e) {
653
+ function _e(e) {
632
654
  if (e === void 0) {
633
655
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
634
656
  }
635
657
  return e;
636
658
  }
637
- function Ie() {
659
+ function Ee() {
638
660
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
639
661
  if (Reflect.construct.sham) return false;
640
662
  if (typeof Proxy === "function") return true;
@@ -645,13 +667,13 @@
645
667
  return false;
646
668
  }
647
669
  }
648
- function Pe(e) {
649
- Pe = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
670
+ function Me(e) {
671
+ Me = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
650
672
  return t.__proto__ || Object.getPrototypeOf(t);
651
673
  };
652
- return Pe(e);
674
+ return Me(e);
653
675
  }
654
- function _e(e, t, r) {
676
+ function Te(e, t, r) {
655
677
  if (t in e) {
656
678
  Object.defineProperty(e, t, {
657
679
  value: r,
@@ -664,37 +686,38 @@
664
686
  }
665
687
  return e;
666
688
  }
667
- /** @public */ var Ee = {
689
+ /** @public */ var qe = {
668
690
  children: i().node,
691
+ divider: i().oneOf([ "header", "footer", "both", "none" ]),
692
+ elementRef: i().oneOfType([ i().func, i().object ]),
669
693
  initialFocus: i().oneOfType([ i().object, i().oneOf([ "first", "container" ]) ]),
670
694
  onRequestClose: i().func,
671
- open: i().bool,
672
- divider: i().oneOf([ "header", "footer", "both", "none" ])
695
+ open: i().bool
673
696
  };
674
- var Te = {
697
+ var Fe = {
698
+ divider: "both",
675
699
  initialFocus: "first",
676
- open: false,
677
- divider: "both"
700
+ open: false
678
701
  };
679
- var Me = function(e) {
680
- we(o, e);
681
- var t = ke(o);
702
+ var De = function(e) {
703
+ je(o, e);
704
+ var t = Ie(o);
682
705
  // @docs-props-type ModalPropsBase
683
706
  // this timeout ensures that the Modal is finished rendering before setting the focus
684
707
  function o(e) {
685
708
  var i;
686
- ge(this, o);
709
+ Se(this, o);
687
710
  i = t.call(this, e);
688
- _e(Ce(i), "el", null);
689
- _e(Ce(i), "initialFocusTimeoutId", undefined);
690
- _e(Ce(i), "initialFocus", null);
691
- _e(Ce(i), "headerTitleId", void 0);
692
- _e(Ce(i), "getDefaultMotionStyle", (function() {
711
+ Te(_e(i), "el", null);
712
+ Te(_e(i), "initialFocusTimeoutId", undefined);
713
+ Te(_e(i), "initialFocus", null);
714
+ Te(_e(i), "headerTitleId", void 0);
715
+ Te(_e(i), "getDefaultMotionStyle", (function() {
693
716
  return {
694
717
  top: 0
695
718
  };
696
719
  }));
697
- _e(Ce(i), "getMotionStyle", (function() {
720
+ Te(_e(i), "getMotionStyle", (function() {
698
721
  if (i.props.open) {
699
722
  return {
700
723
  top: 40
@@ -704,7 +727,7 @@
704
727
  top: 0
705
728
  };
706
729
  }));
707
- _e(Ce(i), "handleInitialFocus", (function() {
730
+ Te(_e(i), "handleInitialFocus", (function() {
708
731
  var e = i.props, t = e.initialFocus, r = e.open;
709
732
  if (r) {
710
733
  i.initialFocusTimeoutId = l()((function() {
@@ -717,11 +740,11 @@
717
740
  if (i.el) {
718
741
  /* eslint-disable prefer-destructuring */
719
742
  /* prefer-desturucting leads to harder-to-read syntax in this case */
720
- e = (0, y.getSortedTabbableElements)(i.el)[0];
743
+ e = (0, b.getSortedTabbableElements)(i.el)[0];
721
744
  /* eslint-enable prefer-destructuring */ }
722
745
  } else if (t === "container") {
723
746
  e = i.el;
724
- } else if (he(t) === "object") {
747
+ } else if (Oe(t) === "object") {
725
748
  e = t;
726
749
  }
727
750
  // Typescript isn't happy with optional chaining here
@@ -736,46 +759,62 @@
736
759
  clearTimeout(i.initialFocusTimeoutId);
737
760
  }
738
761
  }));
739
- _e(Ce(i), "handleModalMount", (function(e) {
762
+ Te(_e(i), "handleModalMount", (function(e) {
740
763
  i.el = e;
764
+ pe(i.props.elementRef, e);
741
765
  }));
742
- _e(Ce(i), "handleModalKeyDown", (function(e) {
766
+ Te(_e(i), "handleModalKeyDown", (function(e) {
743
767
  if (i.el !== null) {
744
- (0, y.handleTab)(i.el, e.nativeEvent);
768
+ (0, b.handleTab)(i.el, e.nativeEvent);
745
769
  }
746
770
  }));
747
- _e(Ce(i), "handleRequestClose", (function(e) {
771
+ Te(_e(i), "handleRequestClose", (function(e) {
748
772
  var t, r;
749
773
  i.initialFocus = null;
750
774
  (t = (r = i.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(r, e);
751
775
  }));
752
- _e(Ce(i), "renderModal", (function(e) {
753
- var t = i.props, a = t.style, l = t.children, c = t.divider;
754
- var u = e.top, f = e.opacity;
755
- var d = r.Children.toArray(l).filter(r.isValidElement);
776
+ Te(_e(i), "getProviderValue", p()((function(e) {
777
+ var t = e.titleId, r = e.divider;
778
+ return {
779
+ titleId: t,
780
+ divider: r
781
+ };
782
+ })));
783
+ Te(_e(i), "getModalStyles", p()((function(e) {
784
+ var t = e.opacity, r = e.style, n = e.top;
785
+ return xe(xe({}, r), {}, {
786
+ opacity: t,
787
+ top: n
788
+ });
789
+ })));
790
+ Te(_e(i), "renderModal", (function(e) {
791
+ var t = i.props, a = t.children, l = t.divider, c = t.style;
792
+ var u = e.top, p = e.opacity;
793
+ var f = r.Children.toArray(a).filter(r.isValidElement);
756
794
 
757
- return n().createElement(ce, se({
795
+ return n().createElement(ue, fe({
758
796
  ref: i.handleModalMount,
759
797
  "data-test": "modal",
760
- style: ve(ve({}, a), {}, {
761
- top: u,
762
- opacity: f
798
+ style: i.getModalStyles({
799
+ opacity: p,
800
+ style: c,
801
+ top: u
763
802
  }),
764
803
  tabIndex: -1,
765
804
  onKeyDown: i.handleModalKeyDown,
766
805
  role: "dialog",
767
806
  "aria-labelledby": i.headerTitleId
768
- }, p()(i.props, [].concat(ue(s()(o.propTypes)), [ "style" ]))), n().createElement(H.Provider, {
769
- value: {
807
+ }, d()(i.props, [].concat(de(s()(o.propTypes)), [ "style" ]))), n().createElement(z.Provider, {
808
+ value: i.getProviderValue({
770
809
  titleId: i.headerTitleId,
771
- divider: c
772
- }
773
- }, d));
810
+ divider: l
811
+ })
812
+ }, f));
774
813
  }));
775
- i.headerTitleId = (0, b.createDOMID)("titleId");
814
+ i.headerTitleId = (0, v.createDOMID)("titleId");
776
815
  return i;
777
816
  }
778
- Oe(o, [ {
817
+ ke(o, [ {
779
818
  key: "componentDidMount",
780
819
  value: function e() {
781
820
  this.handleInitialFocus();
@@ -795,7 +834,7 @@
795
834
  key: "render",
796
835
  value: function e() {
797
836
 
798
- return n().createElement(d(), {
837
+ return n().createElement(m(), {
799
838
  open: this.props.open,
800
839
  getDefaultMotionStyle: this.getDefaultMotionStyle,
801
840
  renderModal: this.renderModal,
@@ -806,12 +845,12 @@
806
845
  } ]);
807
846
  return o;
808
847
  }(r.Component);
809
- _e(Me, "propTypes", Ee);
810
- _e(Me, "defaultProps", Te);
811
- _e(Me, "Header", ae);
812
- _e(Me, "Body", F);
813
- _e(Me, "Footer", K);
814
- /* harmony default export */ const qe = Me;
848
+ Te(De, "propTypes", qe);
849
+ Te(De, "defaultProps", Fe);
850
+ Te(De, "Header", ce);
851
+ Te(De, "Body", R);
852
+ Te(De, "Footer", V);
853
+ /* harmony default export */ const Re = De;
815
854
  // CONCATENATED MODULE: ./src/Modal/index.ts
816
855
  module.exports = t;
817
856
  /******/})();