@deque/cauldron-react 4.4.0 → 4.5.0-canary.21294bb6

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 (32) hide show
  1. package/lib/cauldron.css +0 -1
  2. package/lib/components/Accordion/Accordion.d.ts +42 -0
  3. package/lib/components/Accordion/index.d.ts +3 -0
  4. package/lib/components/Breadcrumb/Breadcrumb.d.ts +5 -9
  5. package/lib/components/Breadcrumb/BreadcrumbLink.d.ts +1 -1
  6. package/lib/components/Button/index.d.ts +1 -1
  7. package/lib/components/Code/index.d.ts +2 -2
  8. package/lib/components/Dialog/index.d.ts +1 -1
  9. package/lib/components/ExpandCollapsePanel/PanelTrigger.d.ts +10 -8
  10. package/lib/components/Icon/types.d.ts +1 -1
  11. package/lib/components/Loader/index.d.ts +1 -8
  12. package/lib/components/OptionsMenu/OptionsMenu.d.ts +1 -0
  13. package/lib/components/Pagination/Pagination.d.ts +20 -0
  14. package/lib/components/Pagination/index.d.ts +2 -19
  15. package/lib/components/Pagination/usePagination.d.ts +24 -0
  16. package/lib/components/Panel/index.d.ts +4 -13
  17. package/lib/components/ProgressBar/index.d.ts +6 -12
  18. package/lib/components/RadioCardGroup/index.d.ts +38 -0
  19. package/lib/components/Select/index.d.ts +1 -1
  20. package/lib/components/SideBar/SideBarItem.d.ts +1 -1
  21. package/lib/components/Toast/index.d.ts +1 -0
  22. package/lib/components/Tooltip/index.d.ts +1 -1
  23. package/lib/components/TopBar/TopBarTrigger.d.ts +1 -1
  24. package/lib/components/TwoColumnPanel/ColumnLeft.d.ts +3 -5
  25. package/lib/components/TwoColumnPanel/ColumnRight.d.ts +3 -5
  26. package/lib/filter-solid.js +24 -0
  27. package/lib/index.d.ts +3 -1
  28. package/lib/index.js +515 -325
  29. package/lib/play.js +25 -0
  30. package/lib/recycle-square.js +24 -0
  31. package/lib/utils/remove-ids/index.d.ts +1 -1
  32. package/package.json +13 -12
package/lib/index.js CHANGED
@@ -9,9 +9,9 @@ var React = require('react');
9
9
  var React__default = _interopDefault(React);
10
10
  var PropTypes = _interopDefault(require('prop-types'));
11
11
  var classNames = _interopDefault(require('classnames'));
12
- var keyname = _interopDefault(require('keyname'));
13
12
  var nextId = require('react-id-generator');
14
13
  var nextId__default = _interopDefault(nextId);
14
+ var keyname = _interopDefault(require('keyname'));
15
15
  var reactDom = require('react-dom');
16
16
  var FocusTrap = _interopDefault(require('focus-trap-react'));
17
17
  var reactPopper = require('react-popper');
@@ -151,6 +151,7 @@ var iconTypes = [
151
151
  'exchange',
152
152
  'external-link',
153
153
  'eye',
154
+ 'filter-solid',
154
155
  'filter',
155
156
  'flag',
156
157
  'gears',
@@ -170,10 +171,12 @@ var iconTypes = [
170
171
  'new',
171
172
  'no',
172
173
  'pencil',
174
+ 'play',
173
175
  'plus',
174
176
  'question-circle',
175
177
  'radio-checked',
176
178
  'radio-unchecked',
179
+ 'recycle-square',
177
180
  'recycle',
178
181
  'resend',
179
182
  'robot',
@@ -218,6 +221,7 @@ function __variableDynamicImportRuntime0__(path) {
218
221
  case './icons/exchange.svg': return Promise.resolve().then(function () { return require('./exchange.js'); });
219
222
  case './icons/external-link.svg': return Promise.resolve().then(function () { return require('./external-link.js'); });
220
223
  case './icons/eye.svg': return Promise.resolve().then(function () { return require('./eye.js'); });
224
+ case './icons/filter-solid.svg': return Promise.resolve().then(function () { return require('./filter-solid.js'); });
221
225
  case './icons/filter.svg': return Promise.resolve().then(function () { return require('./filter.js'); });
222
226
  case './icons/flag.svg': return Promise.resolve().then(function () { return require('./flag.js'); });
223
227
  case './icons/gears.svg': return Promise.resolve().then(function () { return require('./gears.js'); });
@@ -237,10 +241,12 @@ function __variableDynamicImportRuntime0__(path) {
237
241
  case './icons/new.svg': return Promise.resolve().then(function () { return require('./new.js'); });
238
242
  case './icons/no.svg': return Promise.resolve().then(function () { return require('./no.js'); });
239
243
  case './icons/pencil.svg': return Promise.resolve().then(function () { return require('./pencil.js'); });
244
+ case './icons/play.svg': return Promise.resolve().then(function () { return require('./play.js'); });
240
245
  case './icons/plus.svg': return Promise.resolve().then(function () { return require('./plus.js'); });
241
246
  case './icons/question-circle.svg': return Promise.resolve().then(function () { return require('./question-circle.js'); });
242
247
  case './icons/radio-checked.svg': return Promise.resolve().then(function () { return require('./radio-checked.js'); });
243
248
  case './icons/radio-unchecked.svg': return Promise.resolve().then(function () { return require('./radio-unchecked.js'); });
249
+ case './icons/recycle-square.svg': return Promise.resolve().then(function () { return require('./recycle-square.js'); });
244
250
  case './icons/recycle.svg': return Promise.resolve().then(function () { return require('./recycle.js'); });
245
251
  case './icons/resend.svg': return Promise.resolve().then(function () { return require('./resend.js'); });
246
252
  case './icons/robot.svg': return Promise.resolve().then(function () { return require('./robot.js'); });
@@ -279,19 +285,19 @@ var Icon = React.forwardRef(function (_a, ref) {
279
285
  if (process.env.NODE_ENV === 'test') {
280
286
  return;
281
287
  }
282
- __variableDynamicImportRuntime0__("./icons/" + name + ".svg")
288
+ __variableDynamicImportRuntime0__("./icons/".concat(name, ".svg"))
283
289
  .then(function (icon) {
284
290
  isMounted.current && setIcon(function () { return icon["default"]; });
285
291
  })["catch"](function () {
286
- console.error("Could not find icon type \"" + type + "\".");
292
+ console.error("Could not find icon type \"".concat(type, "\"."));
287
293
  isMounted.current && setIcon(null);
288
294
  });
289
295
  return function () {
290
296
  isMounted.current = false;
291
297
  };
292
298
  }, [type]);
293
- var data = tslib.__assign(tslib.__assign({}, other), { 'aria-hidden': !label, className: classNames('Icon', "Icon--" + type, className, (_b = {},
294
- _b["Icon__" + direction] = !!direction,
299
+ var data = tslib.__assign(tslib.__assign({}, other), { 'aria-hidden': !label, className: classNames('Icon', "Icon--".concat(type), className, (_b = {},
300
+ _b["Icon__".concat(direction)] = !!direction,
295
301
  _b)) });
296
302
  return (React__default.createElement("div", tslib.__assign({ ref: ref }, data),
297
303
  label && React__default.createElement(Offscreen, null, label),
@@ -305,6 +311,207 @@ Icon.propTypes = {
305
311
  };
306
312
  Icon.displayName = 'Icon';
307
313
 
314
+ var PanelTrigger = function (_a) {
315
+ var children = _a.children, className = _a.className, open = _a.open, fullWidth = _a.fullWidth, onClick = _a.onClick, _b = _a.iconExpanded, iconExpanded = _b === void 0 ? 'chevron-down' : _b, _c = _a.iconCollapsed, iconCollapsed = _c === void 0 ? 'chevron-right' : _c, heading = _a.heading, otherProps = tslib.__rest(_a, ["children", "className", "open", "fullWidth", "onClick", "iconExpanded", "iconCollapsed", "heading"]);
316
+ var Header = typeof heading === 'object' && 'level' in heading && !!heading.level
317
+ ? "h".concat(heading.level)
318
+ : React__default.Fragment;
319
+ return (React__default.createElement(Header, null,
320
+ React__default.createElement("button", tslib.__assign({ className: classNames(className, 'ExpandCollapse__trigger', {
321
+ fullWidth: fullWidth
322
+ }), type: "button", "aria-expanded": open, onClick: onClick }, otherProps),
323
+ React__default.createElement("div", { className: "ExpandCollapse__trigger-title" }, typeof children === 'function'
324
+ ? children({ open: !!open })
325
+ : children),
326
+ React__default.createElement(Icon, { type: open ? iconExpanded : iconCollapsed }))));
327
+ };
328
+ PanelTrigger.propTypes = {
329
+ children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
330
+ open: PropTypes.bool,
331
+ iconExpanded: PropTypes.string,
332
+ iconCollapsed: PropTypes.string,
333
+ heading: PropTypes.number
334
+ };
335
+ PanelTrigger.displayName = 'PanelTrigger';
336
+ var PanelTrigger$1 = React__default.memo(PanelTrigger);
337
+
338
+ var injectStyleTag = function () {
339
+ var style = document.createElement('style');
340
+ document.head.appendChild(style);
341
+ return style;
342
+ };
343
+ var setStyle = function (tag, cssString) {
344
+ tag.textContent = cssString;
345
+ };
346
+ var removeStyleTag = function (tag) {
347
+ document.head.removeChild(tag);
348
+ };
349
+
350
+ var ExpandCollapsePanel = /** @class */ (function (_super) {
351
+ tslib.__extends(ExpandCollapsePanel, _super);
352
+ function ExpandCollapsePanel() {
353
+ var _this = _super !== null && _super.apply(this, arguments) || this;
354
+ _this.state = {
355
+ controlled: typeof _this.props.open !== 'undefined',
356
+ isOpen: typeof _this.props.open !== 'undefined' ? _this.props.open : false
357
+ };
358
+ _this.panel = React__default.createRef();
359
+ _this.handleToggle = function (e) {
360
+ var onToggle = _this.props.onToggle;
361
+ var _a = _this.state, isOpen = _a.isOpen, controlled = _a.controlled;
362
+ onToggle(e);
363
+ if (!controlled) {
364
+ _this.setState({ isOpen: !isOpen, isAnimating: true });
365
+ }
366
+ };
367
+ _this.animateOpen = function () {
368
+ var panel = _this.panel.current;
369
+ var animationTiming = _this.props.animationTiming;
370
+ if (!animationTiming) {
371
+ _this.setState({ isAnimating: false });
372
+ return;
373
+ }
374
+ var rect = panel === null || panel === void 0 ? void 0 : panel.getBoundingClientRect();
375
+ if (!rect) {
376
+ return;
377
+ }
378
+ if (!_this.styleTag) {
379
+ _this.styleTag = injectStyleTag();
380
+ }
381
+ setStyle(_this.styleTag, "\n @keyframes expandOpenAnimation {\n 0% { opacity: 0; height: 0; }\n 100% { opacity: 1; height: ".concat(rect.height, "px; }\n }\n\n .cauldron-expand-open {\n will-change: opacity, height;\n overflow: hidden;\n animation: expandOpenAnimation ease-in-out ").concat(animationTiming, "ms forwards;\n }\n "));
382
+ _this.setState({ animationClass: 'cauldron-expand-open' }, function () {
383
+ setTimeout(function () {
384
+ _this.setState({ animationClass: '', isAnimating: false });
385
+ setStyle(_this.styleTag, '');
386
+ }, animationTiming);
387
+ });
388
+ };
389
+ _this.animateClose = function () {
390
+ var panel = _this.panel.current;
391
+ var animationTiming = _this.props.animationTiming;
392
+ if (!animationTiming) {
393
+ _this.setState({ isAnimating: false });
394
+ return;
395
+ }
396
+ if (!_this.styleTag) {
397
+ _this.styleTag = injectStyleTag();
398
+ }
399
+ var rect = panel === null || panel === void 0 ? void 0 : panel.getBoundingClientRect();
400
+ if (!rect)
401
+ return;
402
+ setStyle(_this.styleTag, "\n @keyframes collapseCloseAnimation {\n 0% { opacity: 1; height: ".concat(rect.height, "px; }\n 100% { opacity: 0; height: 0; }\n }\n\n .cauldron-collapse-close {\n will-change: opacity, height;\n overflow: hidden;\n animation: collapseCloseAnimation ease-in-out ").concat(animationTiming, "ms forwards;\n }\n "));
403
+ _this.setState({ animationClass: 'cauldron-collapse-close' }, function () {
404
+ setTimeout(function () {
405
+ _this.setState({ animationClass: '', isAnimating: false });
406
+ setStyle(_this.styleTag, '');
407
+ }, animationTiming);
408
+ });
409
+ };
410
+ return _this;
411
+ }
412
+ ExpandCollapsePanel.prototype.componentWillUnmount = function () {
413
+ var styleTag = this.styleTag;
414
+ if (styleTag) {
415
+ removeStyleTag(styleTag);
416
+ }
417
+ };
418
+ ExpandCollapsePanel.prototype.componentDidUpdate = function (prevProps, prevState) {
419
+ var _a = this.state, openState = _a.isOpen, controlled = _a.controlled;
420
+ var openProp = this.props.open;
421
+ if (controlled && openState !== openProp) {
422
+ this.setState({ isOpen: !!openProp, isAnimating: true });
423
+ }
424
+ if (typeof openProp !== typeof prevProps.open) {
425
+ this.setState({ controlled: typeof openProp !== 'undefined' });
426
+ }
427
+ if (prevState.isOpen !== openState && openState) {
428
+ this.animateOpen();
429
+ }
430
+ else if (prevState.isOpen !== openState && !openState) {
431
+ this.animateClose();
432
+ }
433
+ };
434
+ ExpandCollapsePanel.prototype.render = function () {
435
+ var _a = this.props, children = _a.children, animationTiming = _a.animationTiming, className = _a.className, onToggle = _a.onToggle, open = _a.open, otherProps = tslib.__rest(_a, ["children", "animationTiming", "className", "onToggle", "open"]);
436
+ var _b = this.state, isOpen = _b.isOpen, isAnimating = _b.isAnimating, animationClass = _b.animationClass;
437
+ var trigger = React__default.Children.toArray(children).find(function (child) { return child.type === PanelTrigger$1; });
438
+ var panelElements = React__default.Children.toArray(children).filter(function (child) {
439
+ return typeof child === 'string' ||
440
+ child.type !== PanelTrigger$1;
441
+ });
442
+ return (React__default.createElement(React__default.Fragment, null,
443
+ trigger &&
444
+ React__default.cloneElement(trigger, {
445
+ open: isOpen,
446
+ onClick: this.handleToggle
447
+ }),
448
+ React__default.createElement("div", tslib.__assign({ className: classNames(className, 'ExpandCollapse__panel', animationClass, {
449
+ 'is--hidden': !isOpen && !isAnimating
450
+ }), ref: this.panel }, otherProps), panelElements)));
451
+ };
452
+ ExpandCollapsePanel.defaultProps = {
453
+ animationTiming: 250,
454
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
455
+ onToggle: function () { }
456
+ };
457
+ ExpandCollapsePanel.propTypes = {
458
+ open: PropTypes.bool,
459
+ children: PropTypes.node.isRequired,
460
+ className: PropTypes.string,
461
+ animationTiming: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
462
+ onToggle: PropTypes.func
463
+ };
464
+ return ExpandCollapsePanel;
465
+ }(React__default.Component));
466
+
467
+ var AccordionTrigger = function (_a) {
468
+ var children = _a.children, triggerProps = tslib.__rest(_a, ["children"]);
469
+ return React__default.createElement(React__default.Fragment, null, children);
470
+ };
471
+ var AccordionContent = function (_a) {
472
+ var children = _a.children, className = _a.className, otherProps = tslib.__rest(_a, ["children", "className"]);
473
+ return (React__default.createElement("div", tslib.__assign({ className: classNames('Accordion__panel', className) }, otherProps), children));
474
+ };
475
+ var Accordion = function (_a) {
476
+ var children = _a.children;
477
+ var childrenArray = React__default.Children.toArray(children);
478
+ var trigger = childrenArray.find(function (child) { return child.type === AccordionTrigger; });
479
+ var panelElement = childrenArray.find(function (child) {
480
+ return typeof child === 'string' ||
481
+ child.type === AccordionContent;
482
+ });
483
+ var isValid = !!(React__default.isValidElement(trigger) && React__default.isValidElement(panelElement));
484
+ if (!isValid) {
485
+ console.warn('Must provide <AccordionTrigger /> and <AccordionContent /> element(s). You provided:', {
486
+ trigger: trigger,
487
+ panelElement: panelElement,
488
+ isValid: isValid
489
+ });
490
+ return null;
491
+ }
492
+ var _b = trigger.props, triggerClassName = _b.className, triggerProps = tslib.__rest(_b, ["className"]);
493
+ var elementId = nextId.useId();
494
+ return (React__default.createElement("div", { className: "Accordion" },
495
+ React__default.createElement(ExpandCollapsePanel, tslib.__assign({ id: panelElement.props.id || "".concat(elementId, "-panel") }, panelElement.props),
496
+ React__default.createElement(PanelTrigger$1, tslib.__assign({ iconCollapsed: "triangle-right", iconExpanded: "triangle-down", className: classNames('Accordion__trigger', trigger.props.className), "aria-controls": panelElement.props.id || "".concat(elementId, "-panel"), heading: trigger.props.heading }, trigger.props), trigger),
497
+ panelElement)));
498
+ };
499
+ Accordion.displayName = 'Accordion';
500
+ AccordionContent.displayName = 'AccordionContent';
501
+ AccordionTrigger.displayName = 'AccordionTrigger';
502
+ Accordion.propTypes = {
503
+ children: PropTypes.node,
504
+ className: PropTypes.string
505
+ };
506
+ AccordionTrigger.propTypes = {
507
+ children: PropTypes.node,
508
+ heading: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', undefined])
509
+ };
510
+ AccordionContent.propTypes = {
511
+ children: PropTypes.node.isRequired,
512
+ className: PropTypes.string
513
+ };
514
+
308
515
  var Scrim = /** @class */ (function (_super) {
309
516
  tslib.__extends(Scrim, _super);
310
517
  function Scrim(props) {
@@ -364,7 +571,7 @@ var Scrim = /** @class */ (function (_super) {
364
571
  if (destroy) {
365
572
  return null;
366
573
  }
367
- return (React__default.createElement("div", { ref: function (el) { return (_this.el = el); }, className: "Scrim " + animationClass }));
574
+ return (React__default.createElement("div", { ref: function (el) { return (_this.el = el); }, className: "Scrim ".concat(animationClass) }));
368
575
  };
369
576
  Scrim.propTypes = {
370
577
  show: PropTypes.bool.isRequired
@@ -498,9 +705,9 @@ var TopBar = /** @class */ (function (_super) {
498
705
  args[_i] = arguments[_i];
499
706
  }
500
707
  // @ts-ignore we're just spreading the original args
501
- _this.onKeyDown.apply(_this, tslib.__spread(args));
708
+ _this.onKeyDown.apply(_this, tslib.__spreadArray([], tslib.__read(args), false));
502
709
  if (child.props.onKeyDown) {
503
- (_a = child.props).onKeyDown.apply(_a, tslib.__spread(args));
710
+ (_a = child.props).onKeyDown.apply(_a, tslib.__spreadArray([], tslib.__read(args), false));
504
711
  }
505
712
  },
506
713
  tabIndex: 0,
@@ -536,7 +743,7 @@ var TopBar = /** @class */ (function (_super) {
536
743
  };
537
744
  TopBar.prototype.onKeyDown = function (e) {
538
745
  var key = keyname(e.which);
539
- var menuItems = tslib.__spread(this.menuItems);
746
+ var menuItems = tslib.__spreadArray([], tslib.__read(this.menuItems), false);
540
747
  // account for hidden side bar trigger (hamburger)
541
748
  if (this.state.wide && this.props.hasTrigger) {
542
749
  menuItems.shift();
@@ -592,6 +799,7 @@ var TopBarTrigger = function (_a) {
592
799
  };
593
800
  TopBarTrigger.displayName = 'TopBarTrigger';
594
801
  TopBarTrigger.propTypes = {
802
+ // @ts-expect-error
595
803
  children: PropTypes.node.isRequired,
596
804
  className: PropTypes.string
597
805
  };
@@ -787,7 +995,7 @@ var OptionsMenuList = /** @class */ (function (_super) {
787
995
  /* eslint-enable @typescript-eslint/no-unused-vars */
788
996
  var items = React__default.Children.toArray(children).map(function (child, i) {
789
997
  var _a = child.props, className = _a.className, other = tslib.__rest(_a, ["className"]);
790
- return React__default.cloneElement(child, tslib.__assign({ key: "list-item-" + i, className: classNames('OptionsMenu__list-item', className), tabIndex: -1, role: 'menuitem', ref: function (el) { return (_this.itemRefs[i] = el); } }, other));
998
+ return React__default.cloneElement(child, tslib.__assign({ key: "list-item-".concat(i), className: classNames('OptionsMenu__list-item', className), tabIndex: -1, role: 'menuitem', ref: function (el) { return (_this.itemRefs[i] = el); } }, other));
791
999
  });
792
1000
  // Key event is being handled in componentDidMount
793
1001
  /* eslint-disable jsx-a11y/click-events-have-key-events */
@@ -1167,7 +1375,8 @@ var SideBar = /** @class */ (function (_super) {
1167
1375
  setTimeout(function () {
1168
1376
  var _a, _b;
1169
1377
  _this.setState({ animateClass: second });
1170
- var firstFocusable = show && ((_b = (_a = _this.navList) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.querySelector(focusableSelector));
1378
+ var firstFocusable = show &&
1379
+ ((_b = (_a = _this.navList) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.querySelector(focusableSelector));
1171
1380
  if (firstFocusable) {
1172
1381
  firstFocusable.focus();
1173
1382
  }
@@ -1216,6 +1425,7 @@ SideBarItem.defaultProps = {
1216
1425
  autoClickLink: true
1217
1426
  };
1218
1427
  SideBarItem.propTypes = {
1428
+ // @ts-expect-error
1219
1429
  children: PropTypes.node.isRequired,
1220
1430
  autoClickLink: PropTypes.bool
1221
1431
  };
@@ -1305,7 +1515,7 @@ var Dialog = /** @class */ (function (_super) {
1305
1515
  var close = !forceAction ? (React__default.createElement("button", { className: "Dialog__close", type: "button", onClick: this.close },
1306
1516
  React__default.createElement(Icon, { type: "close", "aria-hidden": "true" }),
1307
1517
  React__default.createElement(Offscreen, null, closeButtonText))) : null;
1308
- var Heading = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
1518
+ var Heading = "h".concat(typeof heading === 'object' && 'level' in heading && !!heading.level
1309
1519
  ? heading.level
1310
1520
  : 2);
1311
1521
  var Dialog = (React__default.createElement(FocusTrap, { focusTrapOptions: {
@@ -1464,7 +1674,7 @@ var SkipLink = /** @class */ (function (_super) {
1464
1674
  target: function (props, propName, componentName) {
1465
1675
  var value = props[propName];
1466
1676
  if (!value || typeof value !== 'string' || value[0] !== '#') {
1467
- return new Error("Invalid prop " + propName + " supplied to " + componentName + " (must be string starting with \"#\")");
1677
+ return new Error("Invalid prop ".concat(propName, " supplied to ").concat(componentName, " (must be string starting with \"#\")"));
1468
1678
  }
1469
1679
  },
1470
1680
  skipText: PropTypes.string,
@@ -1480,6 +1690,8 @@ var Button = React.forwardRef(function (_a, ref) {
1480
1690
  'Button--secondary': variant === 'secondary',
1481
1691
  'Button--error': variant === 'error',
1482
1692
  Link: variant === 'link',
1693
+ Tag: variant === 'tag',
1694
+ 'Button--tag': variant === 'tag',
1483
1695
  'Button--thin': thin
1484
1696
  }), ref: ref || buttonRef }, other), children));
1485
1697
  });
@@ -1609,8 +1821,8 @@ function Tooltip(_a) {
1609
1821
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.setAttribute(association, [id, attrText].filter(Boolean).join(' '));
1610
1822
  }
1611
1823
  }, [targetElement, id]);
1612
- return (showTooltip || hideElementOnHidden) && isBrowser()
1613
- ? reactDom.createPortal(React__default.createElement("div", tslib.__assign({ id: id, className: classNames('Tooltip', "Tooltip--" + placement, className, {
1824
+ return (React__default.createElement(React__default.Fragment, null, (showTooltip || hideElementOnHidden) && isBrowser()
1825
+ ? reactDom.createPortal(React__default.createElement("div", tslib.__assign({ id: id, className: classNames('Tooltip', "Tooltip--".concat(placement), className, {
1614
1826
  TooltipInfo: variant === 'info',
1615
1827
  'Tooltip--hidden': !showTooltip && hideElementOnHidden,
1616
1828
  'Tooltip--big': variant === 'big'
@@ -1618,7 +1830,7 @@ function Tooltip(_a) {
1618
1830
  variant !== 'big' && (React__default.createElement("div", { className: "TooltipArrow", ref: setArrowElement, style: styles.arrow })),
1619
1831
  children), (portal && 'current' in portal ? portal.current : portal) ||
1620
1832
  document.body)
1621
- : null;
1833
+ : null));
1622
1834
  }
1623
1835
  Tooltip.displayName = 'Tooltip';
1624
1836
  Tooltip.propTypes = {
@@ -1681,6 +1893,7 @@ IconButton.propTypes = {
1681
1893
  as: PropTypes.elementType,
1682
1894
  // @ts-expect-error
1683
1895
  icon: PropTypes.string.isRequired,
1896
+ // @ts-expect-error
1684
1897
  label: PropTypes.node.isRequired,
1685
1898
  // @ts-expect-error
1686
1899
  tooltipPlacement: PropTypes.string,
@@ -1695,7 +1908,7 @@ IconButton.displayName = 'IconButton';
1695
1908
  var i = 0;
1696
1909
  var randomId = function () {
1697
1910
  var num = Math.floor(Math.random() * 10000) + 1;
1698
- return "x_" + i++ + "_" + num;
1911
+ return "x_".concat(i++, "_").concat(num);
1699
1912
  };
1700
1913
 
1701
1914
  /*
@@ -1790,16 +2003,15 @@ var Pointout = /** @class */ (function (_super) {
1790
2003
  visibleFocusable[elementIndex].classList.remove('Pointout--focus-active');
1791
2004
  };
1792
2005
  _this.positionRelativeToTarget = function () {
1793
- var _a, _b;
1794
- var _c = _this.props, target = _c.target, portal = _c.portal, arrowPosition = _c.arrowPosition, position = _c.position;
2006
+ var _a = _this.props, target = _a.target, portal = _a.portal, arrowPosition = _a.arrowPosition, position = _a.position;
1795
2007
  if (!target) {
1796
2008
  return;
1797
2009
  }
1798
- var targetNode = ((_a = target) === null || _a === void 0 ? void 0 : _a.current) ||
2010
+ var targetNode = (target === null || target === void 0 ? void 0 : target.current) ||
1799
2011
  target;
1800
- var portalNode = ((_b = portal) === null || _b === void 0 ? void 0 : _b.current) ||
2012
+ var portalNode = (portal === null || portal === void 0 ? void 0 : portal.current) ||
1801
2013
  portal;
1802
- var _d = targetNode.getBoundingClientRect(), top = _d.top, left = _d.left, width = _d.width, height = _d.height;
2014
+ var _b = targetNode.getBoundingClientRect(), top = _b.top, left = _b.left, width = _b.width, height = _b.height;
1803
2015
  if (portalNode && portalNode !== document.body) {
1804
2016
  // If the portal is not placed on document.body
1805
2017
  // position the FTPO relative to the portal
@@ -1807,48 +2019,48 @@ var Pointout = /** @class */ (function (_super) {
1807
2019
  top -= rect.top - portalNode.scrollTop;
1808
2020
  left -= rect.left - portalNode.scrollLeft;
1809
2021
  }
1810
- var _e = tslib.__read(arrowPosition.split('-'), 1), arrowBoxSide = _e[0];
2022
+ var _c = tslib.__read(arrowPosition.split('-'), 1), arrowBoxSide = _c[0];
1811
2023
  var style;
1812
2024
  switch (arrowBoxSide) {
1813
2025
  case 'right':
1814
2026
  style = {
1815
- left: left + "px",
1816
- top: (position === 'center'
2027
+ left: "".concat(left, "px"),
2028
+ top: "".concat(position === 'center'
1817
2029
  ? top + height / 2
1818
2030
  : position === 'start'
1819
2031
  ? top
1820
- : top + height) + "px"
2032
+ : top + height, "px")
1821
2033
  };
1822
2034
  break;
1823
2035
  case 'bottom':
1824
2036
  style = {
1825
- top: top + "px",
1826
- left: (position === 'center'
2037
+ top: "".concat(top, "px"),
2038
+ left: "".concat(position === 'center'
1827
2039
  ? left + width / 2
1828
2040
  : position === 'start'
1829
2041
  ? left
1830
- : left + width) + "px"
2042
+ : left + width, "px")
1831
2043
  };
1832
2044
  break;
1833
2045
  case 'left':
1834
2046
  style = {
1835
- left: left + width + "px",
1836
- top: (position === 'center'
2047
+ left: "".concat(left + width, "px"),
2048
+ top: "".concat(position === 'center'
1837
2049
  ? top + height / 2
1838
2050
  : position === 'start'
1839
2051
  ? top
1840
- : top + height) + "px"
2052
+ : top + height, "px")
1841
2053
  };
1842
2054
  break;
1843
2055
  case 'top':
1844
2056
  default:
1845
2057
  style = {
1846
- top: top + height + "px",
1847
- left: (position === 'center'
2058
+ top: "".concat(top + height, "px"),
2059
+ left: "".concat(position === 'center'
1848
2060
  ? left + width / 2
1849
2061
  : position === 'start'
1850
2062
  ? left
1851
- : left + width) + "px"
2063
+ : left + width, "px")
1852
2064
  };
1853
2065
  break;
1854
2066
  }
@@ -1860,7 +2072,7 @@ var Pointout = /** @class */ (function (_super) {
1860
2072
  }
1861
2073
  Pointout.prototype.getFocusableElements = function (root) {
1862
2074
  return root
1863
- ? Array.from(root.querySelectorAll(focusable + ", [data-focusable]"))
2075
+ ? Array.from(root.querySelectorAll("".concat(focusable, ", [data-focusable]")))
1864
2076
  : [];
1865
2077
  };
1866
2078
  Pointout.prototype.componentDidMount = function () {
@@ -1930,11 +2142,11 @@ var Pointout = /** @class */ (function (_super) {
1930
2142
  'Pointout--no-arrow': noArrow,
1931
2143
  'Pointout--auto': !!target
1932
2144
  },
1933
- _a["Pointout__arrow--" + arrowPosition] = !!arrowPosition && !noArrow,
1934
- _a["Pointout--" + position] = !!target,
2145
+ _a["Pointout__arrow--".concat(arrowPosition)] = !!arrowPosition && !noArrow,
2146
+ _a["Pointout--".concat(position)] = !!target,
1935
2147
  _a)), style: style, role: target ? undefined : 'region', "aria-labelledby": heading ? headingId : undefined, "aria-hidden": !!target && !disableOffscreenPointout, ref: function (el) { return (_this.visibleRef = el); } },
1936
2148
  noArrow ? null : (React__default.createElement("div", { className: classNames('Pointout__arrow', (_b = {},
1937
- _b["Pointout__arrow--" + arrowPosition] = !!arrowPosition && !noArrow,
2149
+ _b["Pointout__arrow--".concat(arrowPosition)] = !!arrowPosition && !noArrow,
1938
2150
  _b)) },
1939
2151
  React__default.createElement("div", { className: "Pointout__arrow-pointer" }))),
1940
2152
  React__default.createElement("div", { className: "Pointout__box" },
@@ -2115,7 +2327,7 @@ var Toast = /** @class */ (function (_super) {
2115
2327
  var scrim = type === 'action-needed' && show ? (React__default.createElement("div", { className: "Scrim--light Scrim--show Scrim--fade-in" })) : null;
2116
2328
  var defaultProps = {
2117
2329
  tabIndex: -1,
2118
- className: "Toast Toast--" + typeMap[type].className + " " + animationClass
2330
+ className: "Toast Toast--".concat(typeMap[type].className, " ").concat(animationClass)
2119
2331
  };
2120
2332
  if (!focus) {
2121
2333
  defaultProps.role = 'alert';
@@ -2223,7 +2435,7 @@ Link.propTypes = {
2223
2435
  };
2224
2436
  Link.displayName = 'Link';
2225
2437
 
2226
- function Loader(_a) {
2438
+ var Loader = React__default.forwardRef(function (_a, ref) {
2227
2439
  var className = _a.className, _b = _a.variant, variant = _b === void 0 ? 'small' : _b, label = _a.label, props = tslib.__rest(_a, ["className", "variant", "label"]);
2228
2440
  if (label === null || label === void 0 ? void 0 : label.length) {
2229
2441
  props['role'] = 'alert';
@@ -2232,12 +2444,8 @@ function Loader(_a) {
2232
2444
  else {
2233
2445
  props['aria-hidden'] = true;
2234
2446
  }
2235
- return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader', className, variant === 'large'
2236
- ? 'Loader--large'
2237
- : variant === 'small'
2238
- ? 'Loader--small'
2239
- : '') }, props)));
2240
- }
2447
+ return (React__default.createElement("div", tslib.__assign({ ref: ref, className: classNames('Loader', className, variant === 'large' && 'Loader--large', variant === 'small' && 'Loader--small') }, props)));
2448
+ });
2241
2449
  Loader.propTypes = {
2242
2450
  className: PropTypes.string
2243
2451
  };
@@ -2305,9 +2513,10 @@ var Select = React__default.forwardRef(function (_a, ref) {
2305
2513
  'Field__select--disabled': disabled,
2306
2514
  'Field--has-error': !!error
2307
2515
  }) },
2308
- React__default.createElement("select", tslib.__assign({ ref: ref, id: selectId, disabled: disabled, required: required, onChange: handleChange }, dynamicProps, rest), (options === null || options === void 0 ? void 0 : options.length) ? options.map(function (option) {
2309
- return (React__default.createElement("option", { className: "Field__option", key: option.key, value: option.value, disabled: option.disabled }, option.label || option.value));
2310
- })
2516
+ React__default.createElement("select", tslib.__assign({ ref: ref, id: selectId, disabled: disabled, required: required, onChange: handleChange }, dynamicProps, rest), (options === null || options === void 0 ? void 0 : options.length)
2517
+ ? options.map(function (option) {
2518
+ return (React__default.createElement("option", { className: "Field__option", key: option.key, value: option.value, disabled: option.disabled }, option.label || option.value));
2519
+ })
2311
2520
  : children),
2312
2521
  React__default.createElement("div", { className: "arrow-down" })),
2313
2522
  error && (React__default.createElement("div", { id: errorId, className: "Error" }, error))));
@@ -2356,7 +2565,7 @@ var RadioGroup = function (_a) {
2356
2565
  var _a;
2357
2566
  handleChange(radioValue);
2358
2567
  onChange(radio, (_a = inputs.current) === null || _a === void 0 ? void 0 : _a[index]);
2359
- }, disabled: disabled, checked: isChecked, "aria-describedby": labelDescription ? id + "Desc" : undefined }, other)),
2568
+ }, disabled: disabled, checked: isChecked, "aria-describedby": labelDescription ? "".concat(id, "Desc") : undefined }, other)),
2360
2569
  React__default.createElement("label", { htmlFor: id, className: classNames('Field__label', {
2361
2570
  'Field__label--disabled': disabled
2362
2571
  }) }, label),
@@ -2364,7 +2573,7 @@ var RadioGroup = function (_a) {
2364
2573
  'Radio__overlay--focused': isFocused,
2365
2574
  'Radio__overlay--disabled': disabled
2366
2575
  }), type: isChecked ? 'radio-checked' : 'radio-unchecked', "aria-hidden": "true", onClick: function () { return onRadioClick(index); } }),
2367
- labelDescription && (React__default.createElement("span", { id: id + "Desc", className: classNames('Field__labelDescription', {
2576
+ labelDescription && (React__default.createElement("span", { id: "".concat(id, "Desc"), className: classNames('Field__labelDescription', {
2368
2577
  'Field__labelDescription--disabled': disabled
2369
2578
  }) }, labelDescription))));
2370
2579
  });
@@ -2384,7 +2593,7 @@ RadioGroup.propTypes = {
2384
2593
  })).isRequired,
2385
2594
  hasLabel: function (props, propName, componentName) {
2386
2595
  if (!props['aria-label'] && !props['aria-labelledby']) {
2387
- return new Error(componentName + " must have an \"aria-label\" or \"aria-labelledby\" prop");
2596
+ return new Error("".concat(componentName, " must have an \"aria-label\" or \"aria-labelledby\" prop"));
2388
2597
  }
2389
2598
  },
2390
2599
  className: PropTypes.string,
@@ -2393,6 +2602,125 @@ RadioGroup.propTypes = {
2393
2602
  };
2394
2603
  RadioGroup.displayName = 'RadioGroup';
2395
2604
 
2605
+ var Card = function (_a) {
2606
+ var className = _a.className, variant = _a.variant, other = tslib.__rest(_a, ["className", "variant"]);
2607
+ return (React__default.createElement("div", tslib.__assign({ className: classNames(className, {
2608
+ 'Card--simple': variant === 'simple',
2609
+ Card: !variant
2610
+ }) }, other)));
2611
+ };
2612
+ Card.displayName = 'Card';
2613
+ Card.propTypes = {
2614
+ className: PropTypes.string,
2615
+ variant: PropTypes.string
2616
+ };
2617
+
2618
+ var CardHeader = function (_a) {
2619
+ var className = _a.className, other = tslib.__rest(_a, ["className"]);
2620
+ return (React__default.createElement("div", tslib.__assign({ className: classNames('Card__header', className) }, other)));
2621
+ };
2622
+ CardHeader.displayName = 'CardHeader';
2623
+ CardHeader.propTypes = {
2624
+ className: PropTypes.string
2625
+ };
2626
+
2627
+ var CardContent = function (_a) {
2628
+ var className = _a.className, other = tslib.__rest(_a, ["className"]);
2629
+ return (React__default.createElement("div", tslib.__assign({ className: classNames('Card__content', className) }, other)));
2630
+ };
2631
+ CardContent.displayName = 'CardContent';
2632
+ CardContent.propTypes = {
2633
+ className: PropTypes.string
2634
+ };
2635
+
2636
+ var CardFooter = function (_a) {
2637
+ var className = _a.className, other = tslib.__rest(_a, ["className"]);
2638
+ return (React__default.createElement("div", tslib.__assign({ className: classNames('Card__footer', className) }, other)));
2639
+ };
2640
+ CardFooter.displayName = 'CardFooter';
2641
+ CardFooter.propTypes = {
2642
+ className: PropTypes.string
2643
+ };
2644
+
2645
+ var RadioCardGroup = function (_a) {
2646
+ var name = _a.name, radios = _a.radios, defaultValue = _a.defaultValue, value = _a.value,
2647
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
2648
+ _b = _a.onChange,
2649
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
2650
+ onChange = _b === void 0 ? function () { } : _b, className = _a.className, other = tslib.__rest(_a, ["name", "radios", "defaultValue", "value", "onChange", "className"]);
2651
+ var _c = tslib.__read(React.useState(value !== null && value !== void 0 ? value : defaultValue), 2), currentValue = _c[0], setCurrentValue = _c[1];
2652
+ var _d = tslib.__read(React.useState(null), 2), focusIndex = _d[0], setFocusIndex = _d[1];
2653
+ var inputs = React.useRef([]);
2654
+ var handleChange = function (value) { return setCurrentValue(value); };
2655
+ var onRadioFocus = function (index) { return setFocusIndex(index); };
2656
+ var onRadioBlur = function () { return setFocusIndex(null); };
2657
+ var onRadioClick = function (index) {
2658
+ var _a;
2659
+ var radio = (_a = inputs.current) === null || _a === void 0 ? void 0 : _a[index];
2660
+ if (!radio) {
2661
+ return;
2662
+ }
2663
+ radio.click();
2664
+ radio.focus();
2665
+ };
2666
+ React.useEffect(function () {
2667
+ if (typeof value === 'undefined') {
2668
+ return;
2669
+ }
2670
+ setCurrentValue(value);
2671
+ }, [value]);
2672
+ var radioButtons = radios.map(function (radio, index) {
2673
+ var label = radio.label, disabled = radio.disabled, radioValue = radio.value, cardImg = radio.cardImg, cardIcon = radio.cardIcon, id = radio.id, className = radio.className, other = tslib.__rest(radio, ["label", "disabled", "value", "cardImg", "cardIcon", "id", "className"]);
2674
+ var isChecked = currentValue === radioValue;
2675
+ var isFocused = focusIndex === index;
2676
+ return (React__default.createElement("div", { className: classNames('RadioCard'), key: index },
2677
+ React__default.createElement(Card, { variant: "simple", className: classNames('RadioCardGroup__Card RadioCard__overlay', {
2678
+ 'RadioCard__overlay--focused': isFocused,
2679
+ 'RadioCard__overlay--checked': isChecked,
2680
+ 'RadioCard__overlay--disabled': disabled
2681
+ }), onClick: function () { return onRadioClick(index); } },
2682
+ React__default.createElement("input", tslib.__assign({ type: "radio", name: name, value: radioValue, id: id, ref: function (input) {
2683
+ if (!input) {
2684
+ return;
2685
+ }
2686
+ inputs.current.push(input);
2687
+ }, onFocus: function () { return onRadioFocus(index); }, onBlur: function () { return onRadioBlur(); }, onChange: function () {
2688
+ var _a;
2689
+ handleChange(radioValue);
2690
+ onChange(radio, (_a = inputs.current) === null || _a === void 0 ? void 0 : _a[index]);
2691
+ }, disabled: disabled, checked: isChecked }, other)),
2692
+ React__default.createElement(CardContent, null,
2693
+ React__default.createElement("div", { className: classNames('RadioCardGroup__Checked') }, isChecked && (React__default.createElement(Icon, { className: classNames('RadioCardGroup__Icon'), type: cardIcon }))),
2694
+ React__default.createElement("div", { className: classNames('RadioCardGroup__Base') },
2695
+ React__default.createElement("div", { className: classNames('RadioCardGroup__Image') }, cardImg),
2696
+ React__default.createElement("label", { htmlFor: id, className: classNames('RadioCardGroup__Label') }, label))))));
2697
+ });
2698
+ // reset the input refs array
2699
+ // refs get clobbered every re-render anyway and this supports "dynamic" radios
2700
+ // (changing the number of radio buttons for example)
2701
+ inputs.current = [];
2702
+ return (React__default.createElement("div", tslib.__assign({ className: classNames('RadioCardGroup'), role: "radiogroup" }, other), radioButtons));
2703
+ };
2704
+ RadioCardGroup.propTypes = {
2705
+ name: PropTypes.string,
2706
+ radios: PropTypes.arrayOf(PropTypes.shape({
2707
+ value: PropTypes.string.isRequired,
2708
+ id: PropTypes.string.isRequired,
2709
+ label: PropTypes.string.isRequired,
2710
+ cardImg: PropTypes.element.isRequired,
2711
+ cardIcon: PropTypes.string.isRequired
2712
+ })).isRequired,
2713
+ hasLabel: function (props, propName, componentName) {
2714
+ if (!props['aria-label'] && !props['aria-labelledby']) {
2715
+ return new Error("".concat(componentName, " must have an \"aria-label\" or \"aria-labelledby\" prop"));
2716
+ }
2717
+ },
2718
+ className: PropTypes.string,
2719
+ defaultValue: PropTypes.string,
2720
+ onChange: PropTypes.func
2721
+ };
2722
+ RadioCardGroup.displayName = 'RadioCardGroup';
2723
+
2396
2724
  var Checkbox = React.forwardRef(function (_a, ref) {
2397
2725
  var id = _a.id, label = _a.label, labelDescription = _a.labelDescription, error = _a.error, checkboxRef = _a.checkboxRef, className = _a.className, onChange = _a.onChange, ariaDescribedby = _a["aria-describedby"], _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, other = tslib.__rest(_a, ["id", "label", "labelDescription", "error", "checkboxRef", "className", "onChange", 'aria-describedby', "disabled", "checked"]);
2398
2726
  var _d = tslib.__read(React.useState(checked), 2), isChecked = _d[0], setIsChecked = _d[1];
@@ -2462,46 +2790,6 @@ function TooltipTabstop(_a) {
2462
2790
  }
2463
2791
  TooltipTabstop.displayName = 'TooltipTabstop';
2464
2792
 
2465
- var Card = function (_a) {
2466
- var className = _a.className, variant = _a.variant, other = tslib.__rest(_a, ["className", "variant"]);
2467
- return (React__default.createElement("div", tslib.__assign({ className: classNames(className, {
2468
- 'Card--simple': variant === 'simple',
2469
- Card: !variant
2470
- }) }, other)));
2471
- };
2472
- Card.displayName = 'Card';
2473
- Card.propTypes = {
2474
- className: PropTypes.string,
2475
- variant: PropTypes.string
2476
- };
2477
-
2478
- var CardHeader = function (_a) {
2479
- var className = _a.className, other = tslib.__rest(_a, ["className"]);
2480
- return (React__default.createElement("div", tslib.__assign({ className: classNames('Card__header', className) }, other)));
2481
- };
2482
- CardHeader.displayName = 'CardHeader';
2483
- CardHeader.propTypes = {
2484
- className: PropTypes.string
2485
- };
2486
-
2487
- var CardContent = function (_a) {
2488
- var className = _a.className, other = tslib.__rest(_a, ["className"]);
2489
- return (React__default.createElement("div", tslib.__assign({ className: classNames('Card__content', className) }, other)));
2490
- };
2491
- CardContent.displayName = 'CardContent';
2492
- CardContent.propTypes = {
2493
- className: PropTypes.string
2494
- };
2495
-
2496
- var CardFooter = function (_a) {
2497
- var className = _a.className, other = tslib.__rest(_a, ["className"]);
2498
- return (React__default.createElement("div", tslib.__assign({ className: classNames('Card__footer', className) }, other)));
2499
- };
2500
- CardFooter.displayName = 'CardFooter';
2501
- CardFooter.propTypes = {
2502
- className: PropTypes.string
2503
- };
2504
-
2505
2793
  var TextField = /** @class */ (function (_super) {
2506
2794
  tslib.__extends(TextField, _super);
2507
2795
  function TextField(props) {
@@ -2595,152 +2883,6 @@ var TextField = /** @class */ (function (_super) {
2595
2883
  return TextField;
2596
2884
  }(React__default.Component));
2597
2885
 
2598
- function PanelTrigger(_a) {
2599
- var children = _a.children, className = _a.className, open = _a.open, fullWidth = _a.fullWidth, onClick = _a.onClick, _b = _a.iconExpanded, iconExpanded = _b === void 0 ? 'chevron-down' : _b, _c = _a.iconCollapsed, iconCollapsed = _c === void 0 ? 'chevron-right' : _c, other = tslib.__rest(_a, ["children", "className", "open", "fullWidth", "onClick", "iconExpanded", "iconCollapsed"]);
2600
- return (React__default.createElement("button", tslib.__assign({}, other, { className: classNames('ExpandCollapse__trigger', fullWidth ? 'fullWidth' : '', className), type: "button", "aria-expanded": open, onClick: onClick }),
2601
- React__default.createElement("div", { className: "ExpandCollapse__trigger-title" }, typeof children === 'function' ? children({ open: !!open }) : children),
2602
- React__default.createElement(Icon, { type: open ? iconExpanded : iconCollapsed })));
2603
- }
2604
- PanelTrigger.propTypes = {
2605
- children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
2606
- open: PropTypes.bool,
2607
- onClick: PropTypes.func,
2608
- className: PropTypes.string,
2609
- iconExpanded: PropTypes.string,
2610
- iconCollapsed: PropTypes.string
2611
- };
2612
- var PanelTrigger$1 = React__default.memo(PanelTrigger);
2613
-
2614
- var injectStyleTag = function () {
2615
- var style = document.createElement('style');
2616
- document.head.appendChild(style);
2617
- return style;
2618
- };
2619
- var setStyle = function (tag, cssString) {
2620
- tag.textContent = cssString;
2621
- };
2622
- var removeStyleTag = function (tag) {
2623
- document.head.removeChild(tag);
2624
- };
2625
-
2626
- var ExpandCollapsePanel = /** @class */ (function (_super) {
2627
- tslib.__extends(ExpandCollapsePanel, _super);
2628
- function ExpandCollapsePanel() {
2629
- var _this = _super !== null && _super.apply(this, arguments) || this;
2630
- _this.state = {
2631
- controlled: typeof _this.props.open !== 'undefined',
2632
- isOpen: typeof _this.props.open !== 'undefined' ? _this.props.open : false
2633
- };
2634
- _this.panel = React__default.createRef();
2635
- _this.handleToggle = function (e) {
2636
- var onToggle = _this.props.onToggle;
2637
- var _a = _this.state, isOpen = _a.isOpen, controlled = _a.controlled;
2638
- onToggle(e);
2639
- if (!controlled) {
2640
- _this.setState({ isOpen: !isOpen, isAnimating: true });
2641
- }
2642
- };
2643
- _this.animateOpen = function () {
2644
- var panel = _this.panel.current;
2645
- var animationTiming = _this.props.animationTiming;
2646
- if (!animationTiming) {
2647
- _this.setState({ isAnimating: false });
2648
- return;
2649
- }
2650
- var rect = panel === null || panel === void 0 ? void 0 : panel.getBoundingClientRect();
2651
- if (!rect) {
2652
- return;
2653
- }
2654
- if (!_this.styleTag) {
2655
- _this.styleTag = injectStyleTag();
2656
- }
2657
- setStyle(_this.styleTag, "\n @keyframes expandOpenAnimation {\n 0% { opacity: 0; height: 0; }\n 100% { opacity: 1; height: " + rect.height + "px; }\n }\n\n .cauldron-expand-open {\n will-change: opacity, height;\n overflow: hidden;\n animation: expandOpenAnimation ease-in-out " + animationTiming + "ms forwards;\n }\n ");
2658
- _this.setState({ animationClass: 'cauldron-expand-open' }, function () {
2659
- setTimeout(function () {
2660
- _this.setState({ animationClass: '', isAnimating: false });
2661
- setStyle(_this.styleTag, '');
2662
- }, animationTiming);
2663
- });
2664
- };
2665
- _this.animateClose = function () {
2666
- var panel = _this.panel.current;
2667
- var animationTiming = _this.props.animationTiming;
2668
- if (!animationTiming) {
2669
- _this.setState({ isAnimating: false });
2670
- return;
2671
- }
2672
- if (!_this.styleTag) {
2673
- _this.styleTag = injectStyleTag();
2674
- }
2675
- var rect = panel === null || panel === void 0 ? void 0 : panel.getBoundingClientRect();
2676
- if (!rect)
2677
- return;
2678
- setStyle(_this.styleTag, "\n @keyframes collapseCloseAnimation {\n 0% { opacity: 1; height: " + rect.height + "px; }\n 100% { opacity: 0; height: 0; }\n }\n\n .cauldron-collapse-close {\n will-change: opacity, height;\n overflow: hidden;\n animation: collapseCloseAnimation ease-in-out " + animationTiming + "ms forwards;\n }\n ");
2679
- _this.setState({ animationClass: 'cauldron-collapse-close' }, function () {
2680
- setTimeout(function () {
2681
- _this.setState({ animationClass: '', isAnimating: false });
2682
- setStyle(_this.styleTag, '');
2683
- }, animationTiming);
2684
- });
2685
- };
2686
- return _this;
2687
- }
2688
- ExpandCollapsePanel.prototype.componentWillUnmount = function () {
2689
- var styleTag = this.styleTag;
2690
- if (styleTag) {
2691
- removeStyleTag(styleTag);
2692
- }
2693
- };
2694
- ExpandCollapsePanel.prototype.componentDidUpdate = function (prevProps, prevState) {
2695
- var _a = this.state, openState = _a.isOpen, controlled = _a.controlled;
2696
- var openProp = this.props.open;
2697
- if (controlled && openState !== openProp) {
2698
- this.setState({ isOpen: !!openProp, isAnimating: true });
2699
- }
2700
- if (typeof openProp !== typeof prevProps.open) {
2701
- this.setState({ controlled: typeof openProp !== 'undefined' });
2702
- }
2703
- if (prevState.isOpen !== openState && openState) {
2704
- this.animateOpen();
2705
- }
2706
- else if (prevState.isOpen !== openState && !openState) {
2707
- this.animateClose();
2708
- }
2709
- };
2710
- ExpandCollapsePanel.prototype.render = function () {
2711
- /* eslint-disable no-unused-vars */
2712
- var _a = this.props, children = _a.children, animationTiming = _a.animationTiming, className = _a.className, onToggle = _a.onToggle, open = _a.open, other = tslib.__rest(_a, ["children", "animationTiming", "className", "onToggle", "open"]);
2713
- /* eslint-enable no-unused-vars */
2714
- var _b = this.state, isOpen = _b.isOpen, isAnimating = _b.isAnimating, animationClass = _b.animationClass;
2715
- var trigger = React__default.Children.toArray(children).find(function (child) { return child.type === PanelTrigger$1; });
2716
- var panelElements = React__default.Children.toArray(children).filter(function (child) {
2717
- return typeof child === 'string' ||
2718
- child.type !== PanelTrigger$1;
2719
- });
2720
- return (React__default.createElement(React__default.Fragment, null,
2721
- trigger &&
2722
- React__default.cloneElement(trigger, {
2723
- open: isOpen,
2724
- onClick: this.handleToggle
2725
- }),
2726
- React__default.createElement("div", tslib.__assign({}, other, { className: classNames('ExpandCollapse__panel', animationClass, className, {
2727
- 'is--hidden': !isOpen && !isAnimating
2728
- }), ref: this.panel }), panelElements)));
2729
- };
2730
- ExpandCollapsePanel.defaultProps = {
2731
- animationTiming: 250,
2732
- onToggle: function () { }
2733
- };
2734
- ExpandCollapsePanel.propTypes = {
2735
- open: PropTypes.bool,
2736
- children: PropTypes.node.isRequired,
2737
- className: PropTypes.string,
2738
- animationTiming: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
2739
- onToggle: PropTypes.func
2740
- };
2741
- return ExpandCollapsePanel;
2742
- }(React__default.Component));
2743
-
2744
2886
  function _objectWithoutPropertiesLoose(source, excluded) {
2745
2887
  if (source == null) return {};
2746
2888
  var target = {};
@@ -2843,27 +2985,6 @@ function _defineProperty(obj, key, value) {
2843
2985
 
2844
2986
  var defineProperty = _defineProperty;
2845
2987
 
2846
- function _objectSpread(target) {
2847
- for (var i = 1; i < arguments.length; i++) {
2848
- var source = arguments[i] != null ? Object(arguments[i]) : {};
2849
- var ownKeys = Object.keys(source);
2850
-
2851
- if (typeof Object.getOwnPropertySymbols === 'function') {
2852
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
2853
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2854
- }));
2855
- }
2856
-
2857
- ownKeys.forEach(function (key) {
2858
- defineProperty(target, key, source[key]);
2859
- });
2860
- }
2861
-
2862
- return target;
2863
- }
2864
-
2865
- var objectSpread = _objectSpread;
2866
-
2867
2988
  function createCommonjsModule(fn, basedir, module) {
2868
2989
  return module = {
2869
2990
  path: basedir,
@@ -2900,6 +3021,9 @@ function _extends() {
2900
3021
  module.exports = _extends;
2901
3022
  });
2902
3023
 
3024
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3025
+
3026
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2903
3027
  //
2904
3028
  // Super simple, non-algorithmic solution since the
2905
3029
  // number of class names will not be greater than 4
@@ -2945,7 +3069,7 @@ function createStyleObject(classNames) {
2945
3069
  });
2946
3070
  var classNamesCombinations = getClassNameCombinations(nonTokenClassNames);
2947
3071
  return classNamesCombinations.reduce(function (styleObject, className) {
2948
- return objectSpread({}, styleObject, stylesheet[className]);
3072
+ return _objectSpread(_objectSpread({}, styleObject), stylesheet[className]);
2949
3073
  }, elementStyle);
2950
3074
  }
2951
3075
  function createClassNameString(classNames) {
@@ -2984,7 +3108,7 @@ function createElement(_ref) {
2984
3108
  var props;
2985
3109
 
2986
3110
  if (!useInlineStyles) {
2987
- props = objectSpread({}, properties, {
3111
+ props = _objectSpread(_objectSpread({}, properties), {}, {
2988
3112
  className: createClassNameString(properties.className)
2989
3113
  });
2990
3114
  } else {
@@ -2999,14 +3123,14 @@ function createElement(_ref) {
2999
3123
  var className = properties.className && startingClassName.concat(properties.className.filter(function (className) {
3000
3124
  return !allStylesheetSelectors.includes(className);
3001
3125
  }));
3002
- props = objectSpread({}, properties, {
3126
+ props = _objectSpread(_objectSpread({}, properties), {}, {
3003
3127
  className: createClassNameString(className) || undefined,
3004
3128
  style: createStyleObject(properties.className, Object.assign({}, properties.style, style), stylesheet)
3005
3129
  });
3006
3130
  }
3007
3131
 
3008
3132
  var children = childrenCreator(node.children);
3009
- return React__default.createElement(TagName, _extends_1({
3133
+ return /*#__PURE__*/React__default.createElement(TagName, _extends_1({
3010
3134
  key: key
3011
3135
  }, props), children);
3012
3136
  }
@@ -3017,6 +3141,11 @@ var checkForListedLanguage = (function (astGenerator, language) {
3017
3141
  return langs.indexOf(language) !== -1;
3018
3142
  });
3019
3143
 
3144
+ var _excluded = ["language", "children", "style", "customStyle", "codeTagProps", "useInlineStyles", "showLineNumbers", "showInlineLineNumbers", "startingLineNumber", "lineNumberContainerStyle", "lineNumberStyle", "wrapLines", "wrapLongLines", "lineProps", "renderer", "PreTag", "CodeTag", "code", "astGenerator"];
3145
+
3146
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3147
+
3148
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3020
3149
  var newLineRegex = /\n/g;
3021
3150
 
3022
3151
  function getNewLines(str) {
@@ -3029,7 +3158,7 @@ function getAllLineNumbers(_ref) {
3029
3158
  style = _ref.style;
3030
3159
  return lines.map(function (_, i) {
3031
3160
  var number = i + startingLineNumber;
3032
- return React__default.createElement("span", {
3161
+ return /*#__PURE__*/React__default.createElement("span", {
3033
3162
  key: "line-".concat(i),
3034
3163
  className: "react-syntax-highlighter-line-number",
3035
3164
  style: typeof style === 'function' ? style(number) : style
@@ -3042,13 +3171,13 @@ function AllLineNumbers(_ref2) {
3042
3171
  codeStyle = _ref2.codeStyle,
3043
3172
  _ref2$containerStyle = _ref2.containerStyle,
3044
3173
  containerStyle = _ref2$containerStyle === void 0 ? {
3045
- float: 'left',
3174
+ "float": 'left',
3046
3175
  paddingRight: '10px'
3047
3176
  } : _ref2$containerStyle,
3048
3177
  _ref2$numberStyle = _ref2.numberStyle,
3049
3178
  numberStyle = _ref2$numberStyle === void 0 ? {} : _ref2$numberStyle,
3050
3179
  startingLineNumber = _ref2.startingLineNumber;
3051
- return React__default.createElement("code", {
3180
+ return /*#__PURE__*/React__default.createElement("code", {
3052
3181
  style: Object.assign({}, codeStyle, containerStyle)
3053
3182
  }, getAllLineNumbers({
3054
3183
  lines: codeString.replace(/\n$/, '').split('\n'),
@@ -3089,7 +3218,7 @@ function assembleLineNumberStyles(lineNumberStyle, lineNumber, largestLineNumber
3089
3218
 
3090
3219
  var customLineNumberStyle = typeof lineNumberStyle === 'function' ? lineNumberStyle(lineNumber) : lineNumberStyle; // combine
3091
3220
 
3092
- var assembledStyle = objectSpread({}, defaultLineNumberStyle, customLineNumberStyle);
3221
+ var assembledStyle = _objectSpread$1(_objectSpread$1({}, defaultLineNumberStyle), customLineNumberStyle);
3093
3222
 
3094
3223
  return assembledStyle;
3095
3224
  }
@@ -3115,7 +3244,7 @@ function createLineElement(_ref3) {
3115
3244
  }
3116
3245
 
3117
3246
  if (wrapLongLines & showLineNumbers) {
3118
- properties.style = objectSpread({}, properties.style, {
3247
+ properties.style = _objectSpread$1(_objectSpread$1({}, properties.style), {}, {
3119
3248
  display: 'flex'
3120
3249
  });
3121
3250
  }
@@ -3142,7 +3271,9 @@ function flattenCodeTree(tree) {
3142
3271
  }));
3143
3272
  } else if (node.children) {
3144
3273
  var classNames = className.concat(node.properties.className);
3145
- newTree = newTree.concat(flattenCodeTree(node.children, classNames));
3274
+ flattenCodeTree(node.children, classNames).forEach(function (i) {
3275
+ return newTree.push(i);
3276
+ });
3146
3277
  }
3147
3278
  }
3148
3279
 
@@ -3211,19 +3342,19 @@ function processLines(codeTree, wrapLines, lineProps, showLineNumbers, showInlin
3211
3342
  newTree.push(_line); // if it's the last line
3212
3343
  } else if (i === splitValue.length - 1) {
3213
3344
  var stringChild = tree[index + 1] && tree[index + 1].children && tree[index + 1].children[0];
3345
+ var lastLineInPreviousSpan = {
3346
+ type: 'text',
3347
+ value: "".concat(text)
3348
+ };
3214
3349
 
3215
3350
  if (stringChild) {
3216
- var lastLineInPreviousSpan = {
3217
- type: 'text',
3218
- value: "".concat(text)
3219
- };
3220
3351
  var newElem = createLineElement({
3221
3352
  children: [lastLineInPreviousSpan],
3222
3353
  className: node.properties.className
3223
3354
  });
3224
3355
  tree.splice(index + 1, 0, newElem);
3225
3356
  } else {
3226
- var _children2 = [newChild];
3357
+ var _children2 = [lastLineInPreviousSpan];
3227
3358
 
3228
3359
  var _line2 = createLine(_children2, lineNumber, node.properties.className);
3229
3360
 
@@ -3329,7 +3460,7 @@ function highlight (defaultAstGenerator, defaultStyle) {
3329
3460
  _ref7$codeTagProps = _ref7.codeTagProps,
3330
3461
  codeTagProps = _ref7$codeTagProps === void 0 ? {
3331
3462
  className: language ? "language-".concat(language) : undefined,
3332
- style: objectSpread({}, style['code[class*="language-"]'], style["code[class*=\"language-".concat(language, "\"]")])
3463
+ style: _objectSpread$1(_objectSpread$1({}, style['code[class*="language-"]']), style["code[class*=\"language-".concat(language, "\"]")])
3333
3464
  } : _ref7$codeTagProps,
3334
3465
  _ref7$useInlineStyles = _ref7.useInlineStyles,
3335
3466
  useInlineStyles = _ref7$useInlineStyles === void 0 ? true : _ref7$useInlineStyles,
@@ -3353,12 +3484,12 @@ function highlight (defaultAstGenerator, defaultStyle) {
3353
3484
  _ref7$CodeTag = _ref7.CodeTag,
3354
3485
  CodeTag = _ref7$CodeTag === void 0 ? 'code' : _ref7$CodeTag,
3355
3486
  _ref7$code = _ref7.code,
3356
- code = _ref7$code === void 0 ? Array.isArray(children) ? children[0] : children : _ref7$code,
3487
+ code = _ref7$code === void 0 ? (Array.isArray(children) ? children[0] : children) || '' : _ref7$code,
3357
3488
  astGenerator = _ref7.astGenerator,
3358
- rest = objectWithoutProperties(_ref7, ["language", "children", "style", "customStyle", "codeTagProps", "useInlineStyles", "showLineNumbers", "showInlineLineNumbers", "startingLineNumber", "lineNumberContainerStyle", "lineNumberStyle", "wrapLines", "wrapLongLines", "lineProps", "renderer", "PreTag", "CodeTag", "code", "astGenerator"]);
3489
+ rest = objectWithoutProperties(_ref7, _excluded);
3359
3490
 
3360
3491
  astGenerator = astGenerator || defaultAstGenerator;
3361
- var allLineNumbers = showLineNumbers ? React__default.createElement(AllLineNumbers, {
3492
+ var allLineNumbers = showLineNumbers ? /*#__PURE__*/React__default.createElement(AllLineNumbers, {
3362
3493
  containerStyle: lineNumberContainerStyle,
3363
3494
  codeStyle: codeTagProps.style || {},
3364
3495
  numberStyle: lineNumberStyle,
@@ -3376,8 +3507,18 @@ function highlight (defaultAstGenerator, defaultStyle) {
3376
3507
  style: Object.assign({}, customStyle)
3377
3508
  });
3378
3509
 
3510
+ if (wrapLongLines) {
3511
+ codeTagProps.style = _objectSpread$1(_objectSpread$1({}, codeTagProps.style), {}, {
3512
+ whiteSpace: 'pre-wrap'
3513
+ });
3514
+ } else {
3515
+ codeTagProps.style = _objectSpread$1(_objectSpread$1({}, codeTagProps.style), {}, {
3516
+ whiteSpace: 'pre'
3517
+ });
3518
+ }
3519
+
3379
3520
  if (!astGenerator) {
3380
- return React__default.createElement(PreTag, preProps, allLineNumbers, React__default.createElement(CodeTag, codeTagProps, code));
3521
+ return /*#__PURE__*/React__default.createElement(PreTag, preProps, allLineNumbers, /*#__PURE__*/React__default.createElement(CodeTag, codeTagProps, code));
3381
3522
  }
3382
3523
  /*
3383
3524
  * Some custom renderers rely on individual row elements so we need to turn wrapLines on
@@ -3405,18 +3546,7 @@ function highlight (defaultAstGenerator, defaultStyle) {
3405
3546
 
3406
3547
  var largestLineNumber = codeTree.value.length + startingLineNumber;
3407
3548
  var rows = processLines(codeTree, wrapLines, lineProps, showLineNumbers, showInlineLineNumbers, startingLineNumber, largestLineNumber, lineNumberStyle, wrapLongLines);
3408
-
3409
- if (wrapLongLines) {
3410
- codeTagProps.style = objectSpread({}, codeTagProps.style, {
3411
- whiteSpace: 'pre-wrap'
3412
- });
3413
- } else {
3414
- codeTagProps.style = objectSpread({}, codeTagProps.style, {
3415
- whiteSpace: 'pre'
3416
- });
3417
- }
3418
-
3419
- return React__default.createElement(PreTag, preProps, React__default.createElement(CodeTag, codeTagProps, !showInlineLineNumbers && allLineNumbers, renderer({
3549
+ return /*#__PURE__*/React__default.createElement(PreTag, preProps, /*#__PURE__*/React__default.createElement(CodeTag, codeTagProps, !showInlineLineNumbers && allLineNumbers, renderer({
3420
3550
  rows: rows,
3421
3551
  stylesheet: style,
3422
3552
  useInlineStyles: useInlineStyles
@@ -7981,15 +8111,19 @@ SyntaxHighlighter.registerLanguage('javascript', javascript_1);
7981
8111
  SyntaxHighlighter.registerLanguage('css', css_1);
7982
8112
  SyntaxHighlighter.registerLanguage('html', xml_1);
7983
8113
  SyntaxHighlighter.registerLanguage('yaml', yaml_1);
8114
+ // HACK: This is a workaround for a bug in react-syntax-highlighter's types.
8115
+ var Highlighter = SyntaxHighlighter;
7984
8116
  var Code = function (_a) {
7985
8117
  var children = _a.children, className = _a.className, tabIndex = _a.tabIndex, props = tslib.__rest(_a, ["children", "className", "tabIndex"]);
7986
- return (React__default.createElement(SyntaxHighlighter, tslib.__assign({}, props, { useInlineStyles: false, className: classNames('Code', className), tabIndex: tabIndex }), children));
8118
+ return (React__default.createElement(React__default.Fragment, null,
8119
+ React__default.createElement(Highlighter, tslib.__assign({}, props, { useInlineStyles: false, className: classNames('Code', className), tabIndex: tabIndex }), children)));
7987
8120
  };
7988
8121
  Code.displayName = 'Code';
7989
8122
  Code.propTypes = {
7990
8123
  children: PropTypes.string.isRequired,
7991
8124
  language: PropTypes.oneOf(['javascript', 'css', 'html', 'yaml']),
7992
- className: PropTypes.string
8125
+ className: PropTypes.string,
8126
+ tabIndex: PropTypes.number
7993
8127
  };
7994
8128
 
7995
8129
  function AxeLoader() {
@@ -8023,6 +8157,17 @@ function useSharedRef(ref) {
8023
8157
  var LoaderOverlay = React.forwardRef(function (_a, ref) {
8024
8158
  var className = _a.className, variant = _a.variant, label = _a.label, children = _a.children, focusOnInitialRender = _a.focusOnInitialRender, _b = _a.focusTrap, focusTrap = _b === void 0 ? false : _b, other = tslib.__rest(_a, ["className", "variant", "label", "children", "focusOnInitialRender", "focusTrap"]);
8025
8159
  var overlayRef = useSharedRef(ref);
8160
+ React.useEffect(function () {
8161
+ var isolator = overlayRef.current
8162
+ ? new AriaIsolate(overlayRef.current)
8163
+ : null;
8164
+ if (isolator) {
8165
+ focusTrap ? isolator.activate() : isolator.deactivate();
8166
+ }
8167
+ return function () {
8168
+ isolator === null || isolator === void 0 ? void 0 : isolator.deactivate();
8169
+ };
8170
+ }, [focusTrap, overlayRef.current]);
8026
8171
  React.useEffect(function () {
8027
8172
  if (!!focusOnInitialRender && overlayRef.current) {
8028
8173
  setTimeout(function () {
@@ -8057,6 +8202,7 @@ LoaderOverlay.propTypes = {
8057
8202
  variant: PropTypes.oneOf(['large', 'small']),
8058
8203
  label: PropTypes.string,
8059
8204
  focusOnInitialRender: PropTypes.bool,
8205
+ // @ts-expect-error
8060
8206
  children: PropTypes.node
8061
8207
  };
8062
8208
  LoaderOverlay.displayName = 'LoaderOverlay';
@@ -8176,6 +8322,7 @@ Tab.displayName = 'Tab';
8176
8322
  Tab.propTypes = {
8177
8323
  target: PropTypes.any.isRequired,
8178
8324
  id: PropTypes.string,
8325
+ // @ts-expect-error
8179
8326
  children: PropTypes.node
8180
8327
  };
8181
8328
 
@@ -8270,7 +8417,8 @@ var Tabs = function (_a) {
8270
8417
  React.useEffect(function () {
8271
8418
  var _a, _b;
8272
8419
  index === activeIndex
8273
- ? (_a = target.current) === null || _a === void 0 ? void 0 : _a.classList.remove('TabPanel--hidden') : (_b = target.current) === null || _b === void 0 ? void 0 : _b.classList.add('TabPanel--hidden');
8420
+ ? (_a = target.current) === null || _a === void 0 ? void 0 : _a.classList.remove('TabPanel--hidden')
8421
+ : (_b = target.current) === null || _b === void 0 ? void 0 : _b.classList.add('TabPanel--hidden');
8274
8422
  }, [activeIndex]);
8275
8423
  var config = tslib.__assign((_a = { id: id, className: classNames('Tab', {
8276
8424
  'Tab--active': selected
@@ -8310,6 +8458,7 @@ var TabPanel = React.forwardRef(function (_a, ref) {
8310
8458
  TabPanel.displayName = 'TabPanel';
8311
8459
  TabPanel.propTypes = {
8312
8460
  id: PropTypes.string,
8461
+ // @ts-expect-error
8313
8462
  children: PropTypes.node,
8314
8463
  className: PropTypes.string
8315
8464
  };
@@ -8356,12 +8505,12 @@ var Step = function (props) {
8356
8505
  var liProps;
8357
8506
  var isTooltip = isTooltipProps(other);
8358
8507
  if (isTooltip) {
8359
- (_a = other, (tooltip = _a.tooltip, tooltipText = _a.tooltipText, _a), liProps = tslib.__rest(_a, ["tooltip", "tooltipText"]));
8508
+ (_a = other, (tooltip = _a.tooltip, tooltipText = _a.tooltipText), liProps = tslib.__rest(_a, ["tooltip", "tooltipText"]));
8360
8509
  }
8361
8510
  else {
8362
8511
  liProps = other;
8363
8512
  }
8364
- return (React__default.createElement("li", tslib.__assign({ className: classNames('Stepper__step', "Stepper__step--" + status, className), "aria-current": status === 'current' ? 'step' : 'false' }, liProps),
8513
+ return (React__default.createElement("li", tslib.__assign({ className: classNames('Stepper__step', "Stepper__step--".concat(status), className), "aria-current": status === 'current' ? 'step' : 'false' }, liProps),
8365
8514
  React__default.createElement("div", { className: "Stepper__step-line" }),
8366
8515
  React__default.createElement("div", { className: "Stepper__step-content" }, isTooltip ? (React__default.createElement(TooltipTabstop, { placement: "bottom", tooltip: tooltip,
8367
8516
  // the pseudo content (ex: "1") is conveyed
@@ -8391,7 +8540,7 @@ Stepper.propTypes = {
8391
8540
  className: PropTypes.string
8392
8541
  };
8393
8542
 
8394
- var Panel = function (_a) {
8543
+ var Panel = React.forwardRef(function (_a, ref) {
8395
8544
  var _b;
8396
8545
  var children = _a.children, collapsed = _a.collapsed, className = _a.className, heading = _a.heading, other = tslib.__rest(_a, ["children", "collapsed", "className", "heading"]);
8397
8546
  var headingId = !heading
@@ -8403,22 +8552,27 @@ var Panel = function (_a) {
8403
8552
  if (!headingId) {
8404
8553
  return null;
8405
8554
  }
8406
- var HeadingComponent = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
8555
+ var HeadingComponent = "h".concat(heading &&
8556
+ typeof heading === 'object' &&
8557
+ 'level' in heading &&
8558
+ !!heading.level
8407
8559
  ? heading.level
8408
8560
  : 2);
8409
- return (React__default.createElement(HeadingComponent, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
8561
+ return (React__default.createElement(HeadingComponent, { id: headingId, className: "Panel__Heading" }, heading && typeof heading === 'object' && 'text' in heading
8410
8562
  ? heading.text
8411
8563
  : heading));
8412
8564
  };
8413
8565
  return (React__default.createElement("section", tslib.__assign({ "aria-labelledby": headingId, className: classNames('Panel', className, (_b = {},
8414
8566
  _b['Panel--collapsed'] = collapsed,
8415
- _b)) }, other),
8567
+ _b)), ref: ref }, other),
8416
8568
  React__default.createElement(Heading, null),
8417
8569
  children));
8418
- };
8570
+ });
8419
8571
  Panel.displayName = 'Panel';
8420
8572
  Panel.propTypes = {
8573
+ // @ts-expect-error
8421
8574
  children: PropTypes.node.isRequired,
8575
+ // @ts-expect-error
8422
8576
  heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]),
8423
8577
  className: PropTypes.string
8424
8578
  };
@@ -8428,7 +8582,7 @@ var IssuePanel = function (_a) {
8428
8582
  return (React__default.createElement("div", { className: classNames('IssuePanel', className) },
8429
8583
  React__default.createElement("div", { className: "IssuePanel__Header" },
8430
8584
  title && React__default.createElement("div", { className: "IssuePanel__Header-title" }, title),
8431
- actions && React__default.createElement("div", { className: "IssuePanel__Header-actions" }, actions)),
8585
+ actions && (React__default.createElement("div", { className: "IssuePanel__Header-actions" }, actions))),
8432
8586
  React__default.createElement("div", { className: "IssuePanel__Content" }, children)));
8433
8587
  };
8434
8588
  IssuePanel.displayName = 'IssuePanel';
@@ -8441,7 +8595,7 @@ var ProgressBar = React.forwardRef(function (_a, ref) {
8441
8595
  var _b = _a.progress, progress = _b === void 0 ? 0 : _b, _c = _a.progressMax, progressMax = _c === void 0 ? 100 : _c, _d = _a.progressMin, progressMin = _d === void 0 ? 0 : _d, props = tslib.__rest(_a, ["progress", "progressMax", "progressMin"]);
8442
8596
  var className = props.className, otherProps = tslib.__rest(props, ["className"]);
8443
8597
  return (React__default.createElement("div", tslib.__assign({ className: classNames('ProgressBar', className), role: "progressbar", "aria-valuemin": progressMin, "aria-valuemax": progressMax, "aria-valuenow": progress, ref: ref }, otherProps),
8444
- React__default.createElement("div", { className: "ProgressBar--fill", style: { width: Math.min((progress / progressMax) * 100, 100) + "%" } })));
8598
+ React__default.createElement("div", { className: "ProgressBar--fill", style: { width: "".concat(Math.min((progress / progressMax) * 100, 100), "%") } })));
8445
8599
  });
8446
8600
  ProgressBar.displayName = 'ProgressBar';
8447
8601
 
@@ -8522,12 +8676,41 @@ Pagination.propTypes = {
8522
8676
  className: PropTypes.string
8523
8677
  };
8524
8678
 
8679
+ var usePagination = function (_a) {
8680
+ var totalItems = _a.totalItems, _b = _a.initialPageSize, initialPageSize = _b === void 0 ? 10 : _b, _c = _a.initialPage, initialPage = _c === void 0 ? 1 : _c;
8681
+ var _d = tslib.__read(React.useState(initialPage), 2), currentPage = _d[0], setCurrentPage = _d[1];
8682
+ var pageStart = currentPage * initialPageSize - initialPageSize + 1;
8683
+ var pageEnd = Math.min(pageStart + initialPageSize - 1, totalItems);
8684
+ var onFirstPageClick = function () { return setCurrentPage(1); };
8685
+ var onPreviousPageClick = function () { return setCurrentPage(currentPage - 1); };
8686
+ var onNextPageClick = function () { return setCurrentPage(currentPage + 1); };
8687
+ var onLastPageClick = function () {
8688
+ return setCurrentPage(Math.ceil(totalItems / initialPageSize));
8689
+ };
8690
+ var pagination = {
8691
+ totalItems: totalItems,
8692
+ currentPage: currentPage,
8693
+ itemsPerPage: initialPageSize,
8694
+ onFirstPageClick: onFirstPageClick,
8695
+ onPreviousPageClick: onPreviousPageClick,
8696
+ onNextPageClick: onNextPageClick,
8697
+ onLastPageClick: onLastPageClick
8698
+ };
8699
+ var pageStatus = {
8700
+ currentPage: currentPage,
8701
+ pageStart: pageStart,
8702
+ pageEnd: pageEnd
8703
+ };
8704
+ return { pagination: pagination, pageStatus: pageStatus };
8705
+ };
8706
+
8525
8707
  var FieldWrap = React__default.forwardRef(function (_a, ref) {
8526
8708
  var children = _a.children, className = _a.className, _b = _a.as, Component = _b === void 0 ? 'div' : _b, props = tslib.__rest(_a, ["children", "className", "as"]);
8527
8709
  return (React__default.createElement(Component, tslib.__assign({ ref: ref, className: classNames('Panel', className) }, props), children));
8528
8710
  });
8529
8711
  FieldWrap.displayName = 'FieldWrap';
8530
8712
  FieldWrap.propTypes = {
8713
+ // @ts-expect-error
8531
8714
  children: PropTypes.node.isRequired,
8532
8715
  className: PropTypes.string,
8533
8716
  as: PropTypes.string
@@ -8548,7 +8731,7 @@ var Breadcrumb = React.forwardRef(function (_a, ref) {
8548
8731
  }
8549
8732
  });
8550
8733
  return (React__default.createElement("nav", tslib.__assign({ className: classNames('Breadcrumb', className), ref: ref }, props),
8551
- React__default.createElement("ol", null, childrenWithSeparators.map(function (child, index) { return (React__default.createElement("li", { className: "Breadcrumb__Item", key: "breadcrumb-" + index }, child)); }))));
8734
+ React__default.createElement("ol", null, childrenWithSeparators.map(function (child, index) { return (React__default.createElement("li", { className: "Breadcrumb__Item", key: "breadcrumb-".concat(index) }, child)); }))));
8552
8735
  });
8553
8736
  Breadcrumb.displayName = 'Breadcrumb';
8554
8737
 
@@ -8561,6 +8744,7 @@ var BreadcrumbLink = React.forwardRef(function (_a, ref) {
8561
8744
  var className = _a.className, _b = _a.as, ElementType = _b === void 0 ? 'a' : _b, children = _a.children, props = tslib.__rest(_a, ["className", "as", "children"]);
8562
8745
  return (React__default.createElement(ElementType, tslib.__assign({ className: classNames('Link', 'Breadcrumb__Link', className), ref: ref }, props), children));
8563
8746
  });
8747
+ BreadcrumbLink.displayName = 'BreadcrumbLink';
8564
8748
 
8565
8749
  var ColumnLeft = React.forwardRef(function (_a, ref) {
8566
8750
  var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
@@ -8579,6 +8763,11 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
8579
8763
  var _f = tslib.__read(React.useState(initialCollapsed), 2), isCollapsed = _f[0], setCollapsed = _f[1];
8580
8764
  var _g = tslib.__read(React.useState(false), 2), isFocusTrap = _g[0], setIsFocusTrap = _g[1];
8581
8765
  var _h = tslib.__read(React.useState(!initialCollapsed), 2), showPanel = _h[0], setShowPanel = _h[1];
8766
+ var toggleButtonRef = React.useRef(null);
8767
+ var closeButtonRef = React.useRef(null);
8768
+ var columnLeftRef = React.useRef(null);
8769
+ var columnRightRef = React.useRef(null);
8770
+ var columnLeft = React__default.Children.toArray(children).find(function (child) { return child.type === ColumnLeft; });
8582
8771
  var togglePanel = function () {
8583
8772
  if (isCollapsed) {
8584
8773
  setShowPanel(true);
@@ -8596,11 +8785,6 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
8596
8785
  }
8597
8786
  });
8598
8787
  };
8599
- var toggleButtonRef = React.useRef(null);
8600
- var closeButtonRef = React.useRef(null);
8601
- var columnLeftRef = React.useRef(null);
8602
- var columnRightRef = React.useRef(null);
8603
- var columnLeft = React__default.Children.toArray(children).find(function (child) { return child.type === ColumnLeft; });
8604
8788
  // The ColumnLeftComponent will end up being a focus trap when < 720px
8605
8789
  // This component also gets unmounted when not visible meaning that any
8606
8790
  // aria relationships cannot be set to items inside the component since
@@ -8615,11 +8799,11 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
8615
8799
  React__default.createElement("button", { type: "button", onClick: togglePanel, ref: closeButtonRef, "aria-label": hideCollapsedPanelLabel },
8616
8800
  React__default.createElement(Icon, { type: "close" })),
8617
8801
  React__default.createElement(Tooltip, { target: closeButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, hideCollapsedPanelLabel)));
8618
- var children_1 = tslib.__spread([
8802
+ var children_1 = tslib.__spreadArray([
8619
8803
  CloseButton
8620
- ], React__default.Children.toArray(columnLeft.props.children));
8804
+ ], tslib.__read(React__default.Children.toArray(columnLeft.props.children)), false);
8621
8805
  ColumnLeftComponent = React.cloneElement(columnLeft, { id: id, ref: ref_1, tabIndex: -1 }, children_1.map(function (child, index) {
8622
- return React.cloneElement(child, { key: "left-" + index });
8806
+ return React.cloneElement(child, { key: "left-".concat(index) });
8623
8807
  }));
8624
8808
  }
8625
8809
  var columnRight = React__default.Children.toArray(children).find(function (child) { return child.type === ColumnRight; });
@@ -8630,11 +8814,11 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
8630
8814
  React__default.createElement("button", { type: "button", onClick: togglePanel, ref: toggleButtonRef, "aria-label": !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel, "aria-expanded": !isCollapsed, "aria-controls": columnLeftId },
8631
8815
  React__default.createElement(Icon, { type: !isCollapsed ? 'chevron-double-left' : 'chevron-double-right' })),
8632
8816
  React__default.createElement(Tooltip, { target: toggleButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel)));
8633
- var children_2 = tslib.__spread([
8817
+ var children_2 = tslib.__spreadArray([
8634
8818
  ToggleButton
8635
- ], React__default.Children.toArray(columnRight.props.children));
8819
+ ], tslib.__read(React__default.Children.toArray(columnRight.props.children)), false);
8636
8820
  ColumnRightComponent = React.cloneElement(columnRight, { ref: ref_2, tabIndex: -1 }, children_2.map(function (child, index) {
8637
- return React.cloneElement(child, { key: "right-" + index });
8821
+ return React.cloneElement(child, { key: "right-".concat(index) });
8638
8822
  }));
8639
8823
  }
8640
8824
  React.useLayoutEffect(function () {
@@ -8699,15 +8883,16 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
8699
8883
  'TwoColumnPanel--show': !isCollapsed,
8700
8884
  'TwoColumnPanel--hide': isCollapsed
8701
8885
  }) }, props, { ref: ref }),
8702
- React__default.createElement(FocusTrap, { active: !isCollapsed && isFocusTrap, focusTrapOptions: {
8703
- escapeDeactivates: true,
8704
- allowOutsideClick: true,
8705
- fallbackFocus: columnLeftRef.current
8706
- }, containerElements: [columnLeftRef.current] }),
8707
- React__default.createElement(ClickOutsideListener, { onClickOutside: handleClickOutside, target: columnLeftRef.current }),
8708
- isCollapsed ? null : skipLink,
8709
- showPanel ? ColumnLeftComponent : null,
8710
- ColumnRightComponent));
8886
+ React__default.createElement(React__default.Fragment, null,
8887
+ React__default.createElement(FocusTrap, { active: !isCollapsed && isFocusTrap, focusTrapOptions: {
8888
+ escapeDeactivates: true,
8889
+ allowOutsideClick: true,
8890
+ fallbackFocus: columnLeftRef.current
8891
+ }, containerElements: [columnLeftRef.current] }),
8892
+ React__default.createElement(ClickOutsideListener, { onClickOutside: handleClickOutside, target: columnLeftRef.current }),
8893
+ isCollapsed ? null : skipLink,
8894
+ showPanel ? ColumnLeftComponent : null,
8895
+ ColumnRightComponent)));
8711
8896
  });
8712
8897
  TwoColumnPanel.displayName = 'TwoColumnPanel';
8713
8898
 
@@ -8788,6 +8973,9 @@ ThemeProvider.propTypes = {
8788
8973
  initialTheme: PropTypes.string
8789
8974
  };
8790
8975
 
8976
+ exports.Accordion = Accordion;
8977
+ exports.AccordionContent = AccordionContent;
8978
+ exports.AccordionTrigger = AccordionTrigger;
8791
8979
  exports.Address = Address;
8792
8980
  exports.AddressCityStateZip = AddressCityStateZip;
8793
8981
  exports.AddressLine = AddressLine;
@@ -8847,6 +9035,7 @@ exports.Panel = Panel;
8847
9035
  exports.PanelTrigger = PanelTrigger$1;
8848
9036
  exports.Pointout = Pointout;
8849
9037
  exports.ProgressBar = ProgressBar;
9038
+ exports.RadioCardGroup = RadioCardGroup;
8850
9039
  exports.RadioGroup = RadioGroup;
8851
9040
  exports.Scrim = Scrim;
8852
9041
  exports.Select = Select;
@@ -8884,4 +9073,5 @@ exports.Workspace = Workspace;
8884
9073
  exports.focusableSelector = focusableSelector;
8885
9074
  exports.iconTypes = iconTypes;
8886
9075
  exports.useDidUpdate = useDidUpdate;
9076
+ exports.usePagination = usePagination;
8887
9077
  exports.useThemeContext = useThemeContext;