@splunk/react-ui 4.23.0 → 4.25.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 (68) hide show
  1. package/Breadcrumbs.js +99 -124
  2. package/Button.js +8 -7
  3. package/ButtonSimple.js +40 -39
  4. package/CHANGELOG.md +22 -0
  5. package/Code.js +193 -100
  6. package/Color.js +18 -15
  7. package/ComboBox.js +49 -37
  8. package/JSONTree.js +210 -177
  9. package/Menu.js +643 -472
  10. package/Modal.js +265 -226
  11. package/Multiselect.js +634 -620
  12. package/RadioList.js +12 -11
  13. package/ResultsMenu.js +863 -148
  14. package/Search.js +3 -1
  15. package/Select.js +427 -416
  16. package/TabBar.js +2 -2
  17. package/Table.js +2 -2
  18. package/Tree.js +617 -0
  19. package/cypress/README.md +11 -0
  20. package/cypress/support/commands.ts +1 -0
  21. package/cypress/support/component.ts +0 -1
  22. package/cypress/tsconfig.cypress.json +14 -0
  23. package/package.json +12 -12
  24. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +7 -1
  25. package/types/src/Breadcrumbs/Item.d.ts +8 -2
  26. package/types/src/Button/Button.d.ts +4 -2
  27. package/types/src/Button/docs/examples/Block.d.ts +2 -2
  28. package/types/src/Button/docs/examples/Dimmed.d.ts +2 -0
  29. package/types/src/Button/docs/examples/Disabled.d.ts +2 -2
  30. package/types/src/Button/docs/examples/Icons.d.ts +2 -2
  31. package/types/src/Button/docs/examples/Menus.d.ts +2 -2
  32. package/types/src/Button/docs/examples/To.d.ts +2 -2
  33. package/types/src/Button/docs/examples/Truncated.d.ts +2 -2
  34. package/types/src/Button/docs/examples/prisma/Basic.d.ts +2 -2
  35. package/types/src/Button/docs/examples/prisma/Block.d.ts +2 -2
  36. package/types/src/Button/docs/examples/prisma/Dimmed.d.ts +2 -0
  37. package/types/src/Button/docs/examples/prisma/Disabled.d.ts +2 -2
  38. package/types/src/Button/docs/examples/prisma/Menus.d.ts +2 -2
  39. package/types/src/Button/docs/examples/prisma/To.d.ts +2 -2
  40. package/types/src/Button/docs/examples/prisma/Truncated.d.ts +2 -2
  41. package/types/src/ButtonSimple/ButtonSimple.d.ts +4 -2
  42. package/types/src/Color/Color.d.ts +5 -3
  43. package/types/src/ComboBox/ComboBox.d.ts +6 -0
  44. package/types/src/JSONTree/JSONTree.d.ts +3 -2
  45. package/types/src/Menu/Menu.d.ts +14 -1
  46. package/types/src/Modal/Header.d.ts +0 -2
  47. package/types/src/Modal/Modal.d.ts +7 -0
  48. package/types/src/Modal/ModalContext.d.ts +1 -0
  49. package/types/src/Multiselect/Compact.d.ts +6 -0
  50. package/types/src/Multiselect/Multiselect.d.ts +7 -0
  51. package/types/src/RadioList/RadioList.d.ts +27 -27
  52. package/types/src/RadioList/RadioListContext.d.ts +5 -4
  53. package/types/src/ResultsMenu/ResultsMenu.d.ts +53 -1
  54. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedItem.d.ts +9 -0
  55. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +33 -0
  56. package/types/src/ResultsMenu/VirtualizedResultsMenu/groupChildren.d.ts +16 -0
  57. package/types/src/ResultsMenu/VirtualizedResultsMenu/index.d.ts +3 -0
  58. package/types/src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.d.ts +21 -0
  59. package/types/src/ResultsMenu/index.d.ts +2 -1
  60. package/types/src/Select/Select.d.ts +2 -0
  61. package/types/src/Select/SelectBase.d.ts +6 -0
  62. package/types/src/Tree/Tree.d.ts +24 -0
  63. package/types/src/Tree/TreeContext.d.ts +13 -0
  64. package/types/src/Tree/TreeItem.d.ts +31 -0
  65. package/types/src/Tree/index.d.ts +3 -0
  66. package/types/src/Tree/treeUtils.d.ts +29 -0
  67. package/types/unit-test-setup-testing-library.d.ts +1 -0
  68. package/types/src/Modal/docs/examples/prisma/TypicalUsage.d.ts +0 -2
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 b = e.n(y);
87
90
  // CONCATENATED MODULE: external "@splunk/ui-utils/focus"
88
- const y = require("@splunk/ui-utils/focus");
91
+ const m = 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 j = 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 k() {
124
+ k = 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 k.apply(this, arguments);
133
136
  }
134
- function k(e, t) {
135
- return _(e) || P(e, t) || C(e, t) || j();
137
+ function I(e, t) {
138
+ return M(e) || E(e, t) || P(e, t) || C();
136
139
  }
137
- function j() {
140
+ function C() {
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 D = {
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 F(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 = I(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(j, k({
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
+ F.propTypes = D;
233
+ /* harmony default export */ const R = F;
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,62 @@
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:", ";background-color:", ";width:", ";height:", ";flex-shrink:0;" ], w.mixins.reset("inline-flex"), w.variables.spacingLarge, w.variables.transparent, (0,
357
+ w.pick)({
357
358
  comfortable: "40px",
358
359
  compact: "32px"
359
- }), (0, O.pick)({
360
+ }), (0, w.pick)({
360
361
  comfortable: "40px",
361
362
  compact: "32px"
362
363
  }));
363
- var Q = h().div.withConfig({
364
+ var Z = x().div.withConfig({
364
365
  displayName: "HeaderStyles__StyledTitle",
365
366
  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)
367
+ })([ "", ";font-size:20px;margin:0;overflow-wrap:break-word;font-weight:", ";color:", ";", "" ], w.mixins.reset("block"), w.variables.fontWeightSemiBold, w.variables.contentColorActive, (0,
368
+ w.pick)({
369
+ enterprise: (0, g.css)([ "line-height:22px;" ]),
370
+ prisma: (0, g.css)([ "line-height:24px;" ])
370
371
  }));
371
- var Y = h().div.withConfig({
372
+ var ee = x().div.withConfig({
372
373
  displayName: "HeaderStyles__StyledSubtitle",
373
374
  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
- prisma: "20px"
378
- }));
379
- var Z = h().div.withConfig({
375
+ })([ "", ";font-size:14px;overflow-wrap:break-word;line-height:", ";" ], w.mixins.reset("block"), w.variables.lineHeight);
376
+ var te = x().div.withConfig({
380
377
  displayName: "HeaderStyles__StyledButtonsWrapper",
381
378
  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)({
379
+ })([ "", ";position:absolute;top:", ";right:", ";bottom:50%;", " max-height:35px;transform-origin:bottom right;transform:rotate(-90deg) translateX(100%);" ], w.mixins.reset("block"), (0,
380
+ w.pick)({
384
381
  enterprise: 0,
385
382
  prisma: {
386
383
  comfortable: "-2px",
387
384
  compact: "-6px"
388
385
  }
389
- }), (0, O.pick)({
386
+ }), (0, w.pick)({
390
387
  enterprise: 0,
391
388
  prisma: {
392
389
  comfortable: "-2px",
393
390
  compact: "-6px"
394
391
  }
395
- }), (0, O.pick)({
392
+ }), (0, w.pick)({
396
393
  prisma: {
397
- comfortable: (0, v.css)([ "min-height:35px;" ]),
398
- compact: (0, v.css)([ "min-height:30px;" ])
394
+ comfortable: (0, g.css)([ "min-height:35px;" ]),
395
+ compact: (0, g.css)([ "min-height:30px;" ])
399
396
  }
400
397
  }));
401
- var ee = h().div.withConfig({
398
+ var re = x().div.withConfig({
402
399
  displayName: "HeaderStyles__StyledClose",
403
400
  componentId: "sc-1y722ut-6"
404
- })([ "", ";position:absolute;right:0;top:0;transform:rotate(90deg) translate(-50%,-50%);" ], O.mixins.reset("block"));
401
+ })([ "", ";position:absolute;right:0;top:0;transform:rotate(90deg) translate(-50%,-50%);" ], w.mixins.reset("block"));
405
402
  // CONCATENATED MODULE: ./src/Modal/Header.tsx
406
- function te() {
407
- te = Object.assign || function(e) {
403
+ function ne() {
404
+ ne = Object.assign || function(e) {
408
405
  for (var t = 1; t < arguments.length; t++) {
409
406
  var r = arguments[t];
410
407
  for (var n in r) {
@@ -415,11 +412,11 @@
415
412
  }
416
413
  return e;
417
414
  };
418
- return te.apply(this, arguments);
415
+ return ne.apply(this, arguments);
419
416
  }
420
- function re(e, t) {
417
+ function oe(e, t) {
421
418
  if (e == null) return {};
422
- var r = ne(e, t);
419
+ var r = ie(e, t);
423
420
  var n, o;
424
421
  if (Object.getOwnPropertySymbols) {
425
422
  var i = Object.getOwnPropertySymbols(e);
@@ -432,7 +429,7 @@
432
429
  }
433
430
  return r;
434
431
  }
435
- function ne(e, t) {
432
+ function ie(e, t) {
436
433
  if (e == null) return {};
437
434
  var r = {};
438
435
  var n = Object.keys(e);
@@ -444,7 +441,7 @@
444
441
  }
445
442
  return r;
446
443
  }
447
- var oe = {
444
+ var ae = {
448
445
  children: i().node,
449
446
  icon: i().node,
450
447
  onRequestClose: i().func,
@@ -453,43 +450,63 @@
453
450
  };
454
451
  /**
455
452
  * 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" ]);
453
+ */ function le(e) {
454
+ 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
455
  // @docs-props-type StepPropsBase
459
- var s = (0, r.useContext)(H), u = s.titleId, p = s.divider;
460
- var f = p === "both" || p === "header";
456
+ var s = (0, r.useContext)(z), u = s.titleId, p = s.subtitleId, f = s.divider;
457
+ var d = f === "both" || f === "header";
461
458
 
462
- return n().createElement(n().Fragment, null, n().createElement(V, te({
459
+ return n().createElement(n().Fragment, null, n().createElement(J, ne({
463
460
  $close: !!i,
464
461
  "data-test": "header"
465
- }, c), o && n().createElement(J, null, o), l ? n().createElement(G, null, l && n().createElement(Q, {
462
+ }, c), o && n().createElement(Y, null, o), l ? n().createElement(Q, null, l && n().createElement(Z, {
466
463
  id: u,
467
464
  "data-test": "title"
468
- }, l), a && n().createElement(Y, {
465
+ }, l), a && n().createElement(ee, {
466
+ id: p,
469
467
  "data-test": "subtitle"
470
- }, a)) : t, i && n().createElement(Z, null, i && n().createElement(ee, null, n().createElement(W(), {
468
+ }, a)) : t, i && n().createElement(te, null, i && n().createElement(re, null, n().createElement(G(), {
471
469
  onClick: i,
472
470
  "data-test": "close"
473
- })))), f && n().createElement(R(), {
471
+ })))), d && n().createElement(B(), {
474
472
  "aria-hidden": true
475
473
  }));
476
474
  }
477
- ie.propTypes = oe;
478
- /* harmony default export */ const ae = ie;
475
+ le.propTypes = ae;
476
+ /* harmony default export */ const ce = le;
479
477
  // CONCATENATED MODULE: external "react-spring"
480
- const le = require("react-spring");
478
+ const se = require("react-spring");
481
479
  // CONCATENATED MODULE: ./src/Modal/ModalStyles.ts
482
- var ce = h()(le.animated.div).withConfig({
480
+ var ue = x()(se.animated.div).withConfig({
483
481
  displayName: "ModalStyles__Styled",
484
482
  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)
483
+ })([ "", ";flex-direction:column;position:fixed;left:50%;transform:translateX(-50%);z-index:", ";", "" ], w.mixins.reset("flex"), w.variables.zindexModal, (0,
484
+ w.pick)({
485
+ 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),
486
+ 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
487
  }));
488
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
489
+ /**
490
+ * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
491
+ *
492
+ * @param ref - The React callback or object ref. Can be `null` or `undefined`.
493
+ * @param current - The new value of the ref.
494
+ */
495
+ function pe(e, t) {
496
+ if (e) {
497
+ if (typeof e === "function") {
498
+ e(t);
499
+ } else {
500
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
501
+ // the intention here is to signal "we will take care of setting 'current', not you".
502
+ e.current = t;
503
+ // eslint-disable-line no-param-reassign
504
+ }
505
+ }
506
+ }
490
507
  // CONCATENATED MODULE: ./src/Modal/Modal.tsx
491
- function se() {
492
- se = Object.assign || function(e) {
508
+ function fe() {
509
+ fe = Object.assign || function(e) {
493
510
  for (var t = 1; t < arguments.length; t++) {
494
511
  var r = arguments[t];
495
512
  for (var n in r) {
@@ -500,36 +517,36 @@
500
517
  }
501
518
  return e;
502
519
  };
503
- return se.apply(this, arguments);
520
+ return fe.apply(this, arguments);
504
521
  }
505
- function ue(e) {
506
- return ye(e) || de(e) || fe(e) || pe();
522
+ function de(e) {
523
+ return ve(e) || me(e) || be(e) || ye();
507
524
  }
508
- function pe() {
525
+ function ye() {
509
526
  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
527
  }
511
- function fe(e, t) {
528
+ function be(e, t) {
512
529
  if (!e) return;
513
- if (typeof e === "string") return be(e, t);
530
+ if (typeof e === "string") return he(e, t);
514
531
  var r = Object.prototype.toString.call(e).slice(8, -1);
515
532
  if (r === "Object" && e.constructor) r = e.constructor.name;
516
533
  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);
534
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return he(e, t);
518
535
  }
519
- function de(e) {
536
+ function me(e) {
520
537
  if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
521
538
  }
522
- function ye(e) {
523
- if (Array.isArray(e)) return be(e);
539
+ function ve(e) {
540
+ if (Array.isArray(e)) return he(e);
524
541
  }
525
- function be(e, t) {
542
+ function he(e, t) {
526
543
  if (t == null || t > e.length) t = e.length;
527
544
  for (var r = 0, n = new Array(t); r < t; r++) {
528
545
  n[r] = e[r];
529
546
  }
530
547
  return n;
531
548
  }
532
- function me(e, t) {
549
+ function ge(e, t) {
533
550
  var r = Object.keys(e);
534
551
  if (Object.getOwnPropertySymbols) {
535
552
  var n = Object.getOwnPropertySymbols(e);
@@ -540,42 +557,42 @@
540
557
  }
541
558
  return r;
542
559
  }
543
- function ve(e) {
560
+ function xe(e) {
544
561
  for (var t = 1; t < arguments.length; t++) {
545
562
  var r = arguments[t] != null ? arguments[t] : {};
546
563
  if (t % 2) {
547
- me(Object(r), true).forEach((function(t) {
548
- _e(e, t, r[t]);
564
+ ge(Object(r), true).forEach((function(t) {
565
+ Te(e, t, r[t]);
549
566
  }));
550
567
  } else if (Object.getOwnPropertyDescriptors) {
551
568
  Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
552
569
  } else {
553
- me(Object(r)).forEach((function(t) {
570
+ ge(Object(r)).forEach((function(t) {
554
571
  Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
555
572
  }));
556
573
  }
557
574
  }
558
575
  return e;
559
576
  }
560
- function he(e) {
577
+ function Oe(e) {
561
578
  "@babel/helpers - typeof";
562
579
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
563
- he = function e(t) {
580
+ Oe = function e(t) {
564
581
  return typeof t;
565
582
  };
566
583
  } else {
567
- he = function e(t) {
584
+ Oe = function e(t) {
568
585
  return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
569
586
  };
570
587
  }
571
- return he(e);
588
+ return Oe(e);
572
589
  }
573
- function ge(e, t) {
590
+ function Se(e, t) {
574
591
  if (!(e instanceof t)) {
575
592
  throw new TypeError("Cannot call a class as a function");
576
593
  }
577
594
  }
578
- function xe(e, t) {
595
+ function we(e, t) {
579
596
  for (var r = 0; r < t.length; r++) {
580
597
  var n = t[r];
581
598
  n.enumerable = n.enumerable || false;
@@ -584,12 +601,12 @@
584
601
  Object.defineProperty(e, n.key, n);
585
602
  }
586
603
  }
587
- function Oe(e, t, r) {
588
- if (t) xe(e.prototype, t);
589
- if (r) xe(e, r);
604
+ function je(e, t, r) {
605
+ if (t) we(e.prototype, t);
606
+ if (r) we(e, r);
590
607
  return e;
591
608
  }
592
- function we(e, t) {
609
+ function ke(e, t) {
593
610
  if (typeof t !== "function" && t !== null) {
594
611
  throw new TypeError("Super expression must either be null or a function");
595
612
  }
@@ -600,41 +617,41 @@
600
617
  configurable: true
601
618
  }
602
619
  });
603
- if (t) Se(e, t);
620
+ if (t) Ie(e, t);
604
621
  }
605
- function Se(e, t) {
606
- Se = Object.setPrototypeOf || function e(t, r) {
622
+ function Ie(e, t) {
623
+ Ie = Object.setPrototypeOf || function e(t, r) {
607
624
  t.__proto__ = r;
608
625
  return t;
609
626
  };
610
- return Se(e, t);
627
+ return Ie(e, t);
611
628
  }
612
- function ke(e) {
613
- var t = Ie();
629
+ function Ce(e) {
630
+ var t = Ee();
614
631
  return function r() {
615
- var n = Pe(e), o;
632
+ var n = Me(e), o;
616
633
  if (t) {
617
- var i = Pe(this).constructor;
634
+ var i = Me(this).constructor;
618
635
  o = Reflect.construct(n, arguments, i);
619
636
  } else {
620
637
  o = n.apply(this, arguments);
621
638
  }
622
- return je(this, o);
639
+ return Pe(this, o);
623
640
  };
624
641
  }
625
- function je(e, t) {
626
- if (t && (he(t) === "object" || typeof t === "function")) {
642
+ function Pe(e, t) {
643
+ if (t && (Oe(t) === "object" || typeof t === "function")) {
627
644
  return t;
628
645
  }
629
- return Ce(e);
646
+ return _e(e);
630
647
  }
631
- function Ce(e) {
648
+ function _e(e) {
632
649
  if (e === void 0) {
633
650
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
634
651
  }
635
652
  return e;
636
653
  }
637
- function Ie() {
654
+ function Ee() {
638
655
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
639
656
  if (Reflect.construct.sham) return false;
640
657
  if (typeof Proxy === "function") return true;
@@ -645,13 +662,13 @@
645
662
  return false;
646
663
  }
647
664
  }
648
- function Pe(e) {
649
- Pe = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
665
+ function Me(e) {
666
+ Me = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
650
667
  return t.__proto__ || Object.getPrototypeOf(t);
651
668
  };
652
- return Pe(e);
669
+ return Me(e);
653
670
  }
654
- function _e(e, t, r) {
671
+ function Te(e, t, r) {
655
672
  if (t in e) {
656
673
  Object.defineProperty(e, t, {
657
674
  value: r,
@@ -664,37 +681,39 @@
664
681
  }
665
682
  return e;
666
683
  }
667
- /** @public */ var Ee = {
684
+ /** @public */ var qe = {
668
685
  children: i().node,
686
+ divider: i().oneOf([ "header", "footer", "both", "none" ]),
687
+ elementRef: i().oneOfType([ i().func, i().object ]),
669
688
  initialFocus: i().oneOfType([ i().object, i().oneOf([ "first", "container" ]) ]),
670
689
  onRequestClose: i().func,
671
- open: i().bool,
672
- divider: i().oneOf([ "header", "footer", "both", "none" ])
690
+ open: i().bool
673
691
  };
674
- var Te = {
692
+ var De = {
693
+ divider: "both",
675
694
  initialFocus: "first",
676
- open: false,
677
- divider: "both"
695
+ open: false
678
696
  };
679
- var Me = function(e) {
680
- we(o, e);
681
- var t = ke(o);
697
+ var Fe = function(e) {
698
+ ke(o, e);
699
+ var t = Ce(o);
682
700
  // @docs-props-type ModalPropsBase
683
701
  // this timeout ensures that the Modal is finished rendering before setting the focus
684
702
  function o(e) {
685
703
  var i;
686
- ge(this, o);
704
+ Se(this, o);
687
705
  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() {
706
+ Te(_e(i), "el", null);
707
+ Te(_e(i), "initialFocusTimeoutId", undefined);
708
+ Te(_e(i), "initialFocus", null);
709
+ Te(_e(i), "headerTitleId", void 0);
710
+ Te(_e(i), "headerSubtitleId", void 0);
711
+ Te(_e(i), "getDefaultMotionStyle", (function() {
693
712
  return {
694
713
  top: 0
695
714
  };
696
715
  }));
697
- _e(Ce(i), "getMotionStyle", (function() {
716
+ Te(_e(i), "getMotionStyle", (function() {
698
717
  if (i.props.open) {
699
718
  return {
700
719
  top: 40
@@ -704,7 +723,7 @@
704
723
  top: 0
705
724
  };
706
725
  }));
707
- _e(Ce(i), "handleInitialFocus", (function() {
726
+ Te(_e(i), "handleInitialFocus", (function() {
708
727
  var e = i.props, t = e.initialFocus, r = e.open;
709
728
  if (r) {
710
729
  i.initialFocusTimeoutId = l()((function() {
@@ -717,11 +736,11 @@
717
736
  if (i.el) {
718
737
  /* eslint-disable prefer-destructuring */
719
738
  /* prefer-desturucting leads to harder-to-read syntax in this case */
720
- e = (0, y.getSortedTabbableElements)(i.el)[0];
739
+ e = (0, m.getSortedTabbableElements)(i.el)[0];
721
740
  /* eslint-enable prefer-destructuring */ }
722
741
  } else if (t === "container") {
723
742
  e = i.el;
724
- } else if (he(t) === "object") {
743
+ } else if (Oe(t) === "object") {
725
744
  e = t;
726
745
  }
727
746
  // Typescript isn't happy with optional chaining here
@@ -736,46 +755,66 @@
736
755
  clearTimeout(i.initialFocusTimeoutId);
737
756
  }
738
757
  }));
739
- _e(Ce(i), "handleModalMount", (function(e) {
758
+ Te(_e(i), "handleModalMount", (function(e) {
740
759
  i.el = e;
760
+ pe(i.props.elementRef, e);
741
761
  }));
742
- _e(Ce(i), "handleModalKeyDown", (function(e) {
762
+ Te(_e(i), "handleModalKeyDown", (function(e) {
743
763
  if (i.el !== null) {
744
- (0, y.handleTab)(i.el, e.nativeEvent);
764
+ (0, m.handleTab)(i.el, e.nativeEvent);
745
765
  }
746
766
  }));
747
- _e(Ce(i), "handleRequestClose", (function(e) {
767
+ Te(_e(i), "handleRequestClose", (function(e) {
748
768
  var t, r;
749
769
  i.initialFocus = null;
750
770
  (t = (r = i.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(r, e);
751
771
  }));
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);
772
+ Te(_e(i), "getProviderValue", p()((function(e) {
773
+ var t = e.titleId, r = e.subtitleId, n = e.divider;
774
+ return {
775
+ titleId: t,
776
+ subtitleId: r,
777
+ divider: n
778
+ };
779
+ })));
780
+ Te(_e(i), "getModalStyles", p()((function(e) {
781
+ var t = e.opacity, r = e.style, n = e.top;
782
+ return xe(xe({}, r), {}, {
783
+ opacity: t,
784
+ top: n
785
+ });
786
+ })));
787
+ Te(_e(i), "renderModal", (function(e) {
788
+ var t = i.props, a = t.children, l = t.divider, c = t.style;
789
+ var u = e.top, p = e.opacity;
790
+ var f = r.Children.toArray(a).filter(r.isValidElement);
756
791
 
757
- return n().createElement(ce, se({
792
+ return n().createElement(ue, fe({
758
793
  ref: i.handleModalMount,
759
794
  "data-test": "modal",
760
- style: ve(ve({}, a), {}, {
761
- top: u,
762
- opacity: f
795
+ style: i.getModalStyles({
796
+ opacity: p,
797
+ style: c,
798
+ top: u
763
799
  }),
764
800
  tabIndex: -1,
765
801
  onKeyDown: i.handleModalKeyDown,
766
802
  role: "dialog",
767
- "aria-labelledby": i.headerTitleId
768
- }, p()(i.props, [].concat(ue(s()(o.propTypes)), [ "style" ]))), n().createElement(H.Provider, {
769
- value: {
803
+ "aria-labelledby": i.headerTitleId,
804
+ "aria-describedby": i.headerSubtitleId
805
+ }, d()(i.props, [].concat(de(s()(o.propTypes)), [ "style" ]))), n().createElement(z.Provider, {
806
+ value: i.getProviderValue({
770
807
  titleId: i.headerTitleId,
771
- divider: c
772
- }
773
- }, d));
808
+ subtitleId: i.headerSubtitleId,
809
+ divider: l
810
+ })
811
+ }, f));
774
812
  }));
775
- i.headerTitleId = (0, b.createDOMID)("titleId");
813
+ i.headerTitleId = (0, v.createDOMID)("titleId");
814
+ i.headerSubtitleId = (0, v.createDOMID)("subtitleId");
776
815
  return i;
777
816
  }
778
- Oe(o, [ {
817
+ je(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(b(), {
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(Fe, "propTypes", qe);
849
+ Te(Fe, "defaultProps", De);
850
+ Te(Fe, "Header", ce);
851
+ Te(Fe, "Body", R);
852
+ Te(Fe, "Footer", V);
853
+ /* harmony default export */ const Re = Fe;
815
854
  // CONCATENATED MODULE: ./src/Modal/index.ts
816
855
  module.exports = t;
817
856
  /******/})();