@deque/cauldron-react 4.0.0-canary.debe968f → 4.1.0-canary.20bef562

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,3 +11,9 @@ and pull in the styles:
11
11
  ```sh
12
12
  $ npm install @deque/cauldron-styles --save
13
13
  ```
14
+
15
+ ## server-side rendering
16
+
17
+ Avoid referencing `window` properties, such as `document`, unless you are sure the code will only be executed in a browser environment. For instance, it is safe to reference `document` in an [Effect Hook](https://reactjs.org/docs/hooks-effect.html) or a lifecycle method like `componentDidMount()`, but not in the `render()` method of a class component.
18
+
19
+ Ensuring you only reference these objects when it is safe to do so will ensure that library consumers can use Cauldron with platforms that use an SSR engine, such as GatsbyJS and NextJS.
package/lib/cauldron.css CHANGED
@@ -34,7 +34,8 @@
34
34
  --expandcollapse-panel-color: var(--accent-light);
35
35
  }
36
36
 
37
- a.Button--primary {
37
+ a.Button--primary,
38
+ a.Button--secondary {
38
39
  text-decoration: none;
39
40
  padding: 9px 18px;
40
41
  }
@@ -2,6 +2,7 @@ import React, { InputHTMLAttributes, Ref } from 'react';
2
2
  export interface CheckboxProps extends InputHTMLAttributes<HTMLInputElement> {
3
3
  id: string;
4
4
  label: React.ReactNode;
5
+ labelDescription?: string;
5
6
  error?: React.ReactNode;
6
7
  customIcon?: React.ReactNode;
7
8
  checkboxRef?: Ref<HTMLInputElement>;
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- export interface ClickOutsideListenerProps {
4
- children: React.ReactNode;
3
+ export interface ClickOutsideListenerProps<T extends HTMLElement = HTMLElement> {
4
+ children?: React.ReactNode;
5
5
  onClickOutside: (e: MouseEvent | TouchEvent) => void;
6
6
  mouseEvent?: 'mousedown' | 'click' | 'mouseup' | false;
7
7
  touchEvent?: 'touchstart' | 'touchend' | false;
8
+ target?: T;
8
9
  }
9
10
  export default class ClickOutsideListener extends React.Component<ClickOutsideListenerProps> {
10
11
  static defaultProps: {
@@ -12,7 +13,8 @@ export default class ClickOutsideListener extends React.Component<ClickOutsideLi
12
13
  touchEvent: string;
13
14
  };
14
15
  static propTypes: {
15
- children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
16
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
17
+ target: PropTypes.Requireable<any>;
16
18
  onClickOutside: PropTypes.Validator<(...args: any[]) => any>;
17
19
  mouseEvent: PropTypes.Requireable<string | boolean>;
18
20
  touchEvent: PropTypes.Requireable<string | boolean>;
@@ -27,5 +29,5 @@ export default class ClickOutsideListener extends React.Component<ClickOutsideLi
27
29
  resolveRef: (node: HTMLElement) => void;
28
30
  render(): React.FunctionComponentElement<{
29
31
  ref: (node: HTMLElement) => void;
30
- }>;
32
+ }> | null;
31
33
  }
@@ -2,6 +2,6 @@
2
2
  * GENERATED CODE. DO NOT EDIT DIRECTLY!
3
3
  */
4
4
  /** IconType represents each valid icon type. */
5
- export declare type IconType = 'add-user' | 'arrow-circle-up' | 'arrow-circle-down' | 'arrow-circle-left' | 'arrow-circle-right' | 'arrow-up' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrows-alt' | 'bolt' | 'caution' | 'check-circle' | 'check-shield' | 'check-solid' | 'check' | 'checkbox-checked' | 'checkbox-unchecked' | 'chevron-double-up' | 'chevron-double-down' | 'chevron-double-left' | 'chevron-double-right' | 'chevron-up' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'close' | 'code' | 'copy' | 'download' | 'exchange' | 'external-link' | 'eye' | 'filter' | 'flag' | 'gears' | 'grid' | 'hamburger-menu' | 'highlight' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'new-releases' | 'new' | 'no' | 'pencil' | 'plus' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle' | 'robot' | 'run-again' | 'save' | 'share' | 'sort-triangle' | 'sort' | 'star' | 'sun' | 'tag' | 'target' | 'trash' | 'triangle-up' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'upload';
5
+ export declare type IconType = 'add-user' | 'arrow-circle-up' | 'arrow-circle-down' | 'arrow-circle-left' | 'arrow-circle-right' | 'arrow-up' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrows-alt' | 'bolt' | 'caution' | 'check-circle' | 'check-shield' | 'check-solid' | 'check' | 'checkbox-checked' | 'checkbox-unchecked' | 'chevron-double-up' | 'chevron-double-down' | 'chevron-double-left' | 'chevron-double-right' | 'chevron-up' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'close' | 'code' | 'copy' | 'download' | 'exchange' | 'external-link' | 'eye' | 'filter' | 'flag' | 'gears' | 'grid' | 'hamburger-menu' | 'highlight' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'new-releases' | 'new' | 'no' | 'pencil' | 'plus' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle' | 'resend' | 'robot' | 'run-again' | 'save' | 'share' | 'sort-triangle' | 'sort' | 'star' | 'sun' | 'tag' | 'target' | 'trash' | 'triangle-up' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'upload';
6
6
  /** iconTypes holds each valid icon type. */
7
7
  export declare const iconTypes: string[];
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
4
4
  linkRef?: React.Ref<HTMLAnchorElement>;
5
- variant?: 'button';
5
+ variant?: 'button' | 'button-secondary';
6
6
  }
7
7
  declare const Link: {
8
8
  ({ children, linkRef, className, variant, ...other }: LinkProps): JSX.Element;
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  interface LoaderOverlayProps extends React.HTMLAttributes<HTMLDivElement> {
3
3
  variant?: 'large' | 'small';
4
4
  label?: string;
5
+ focusOnInitialRender?: boolean;
6
+ children?: React.ReactNode;
5
7
  }
6
8
  declare const LoaderOverlay: React.ForwardRefExoticComponent<LoaderOverlayProps & React.RefAttributes<HTMLDivElement>>;
7
9
  export default LoaderOverlay;
@@ -2,7 +2,7 @@ import { HTMLAttributes, ReactElement, ReactNode } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  interface PanelProps extends HTMLAttributes<HTMLElement> {
4
4
  children: ReactNode;
5
- heading: ReactElement<any> | {
5
+ heading?: ReactElement<any> | {
6
6
  id?: string;
7
7
  text: ReactElement<any>;
8
8
  level: number | undefined;
@@ -15,7 +15,7 @@ declare const Panel: {
15
15
  displayName: string;
16
16
  propTypes: {
17
17
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
18
- heading: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
18
+ heading: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
19
19
  className: PropTypes.Requireable<string>;
20
20
  };
21
21
  };
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
  export interface RadioItem extends React.InputHTMLAttributes<HTMLInputElement> {
4
4
  label: string;
5
5
  value?: string;
6
+ labelDescription?: string;
6
7
  }
7
8
  export interface RadioGroupProps {
8
9
  name?: string;
@@ -20,6 +21,7 @@ declare const RadioGroup: {
20
21
  value: PropTypes.Validator<string>;
21
22
  id: PropTypes.Validator<string>;
22
23
  label: PropTypes.Validator<string>;
24
+ labelDescription: PropTypes.Requireable<string>;
23
25
  }> | null | undefined)[]>;
24
26
  hasLabel: (props: {
25
27
  [key: string]: string;
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- interface BaseStepProps {
3
+ interface BaseStepProps extends React.LiHTMLAttributes<HTMLLIElement> {
4
4
  status: 'current' | 'complete' | 'future';
5
- className?: string;
6
5
  }
7
6
  interface StepWithChildren extends BaseStepProps {
8
7
  children: React.ReactNode;
@@ -11,7 +11,7 @@ export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
11
11
  portal?: React.RefObject<HTMLElement> | HTMLElement;
12
12
  hideElementOnHidden?: boolean;
13
13
  }
14
- declare function Tooltip({ id: propId, placement: initialPlacement, children, portal, target, association, variant, show: showProp, hideElementOnHidden, className, ...props }: TooltipProps): React.ReactPortal | null;
14
+ declare function Tooltip({ id: propId, placement: initialPlacement, children, portal, target, association, variant, show: initialShow, hideElementOnHidden, className, ...props }: TooltipProps): React.ReactPortal | null;
15
15
  declare namespace Tooltip {
16
16
  var displayName: string;
17
17
  var propTypes: {
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ interface ColumnGroupHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ }
4
+ declare const ColumnGroupHeader: React.ForwardRefExoticComponent<ColumnGroupHeaderProps & React.RefAttributes<HTMLDivElement>>;
5
+ export default ColumnGroupHeader;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ interface ColumnHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ }
4
+ declare const ColumnHeader: React.ForwardRefExoticComponent<ColumnHeaderProps & React.RefAttributes<HTMLDivElement>>;
5
+ export default ColumnHeader;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ declare const ColumnLeft: React.ForwardRefExoticComponent<(React.HTMLAttributes<HTMLDivElement> & {
3
+ 'aria-label': string;
4
+ } & React.RefAttributes<HTMLDivElement>) | (React.HTMLAttributes<HTMLDivElement> & {
5
+ 'aria-labelledby': string;
6
+ } & React.RefAttributes<HTMLDivElement>)>;
7
+ export default ColumnLeft;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ interface ColumnListProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ }
4
+ declare const ColumnList: React.ForwardRefExoticComponent<ColumnListProps & React.RefAttributes<HTMLDivElement>>;
5
+ export default ColumnList;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ declare const ColumnRight: React.ForwardRefExoticComponent<(React.HTMLAttributes<HTMLDivElement> & {
3
+ 'aria-label': string;
4
+ } & React.RefAttributes<HTMLDivElement>) | (React.HTMLAttributes<HTMLDivElement> & {
5
+ 'aria-labelledby': string;
6
+ } & React.RefAttributes<HTMLDivElement>)>;
7
+ export default ColumnRight;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface TwoColumnPanelProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ initialCollapsed?: boolean;
4
+ showCollapsedPanelLabel?: string;
5
+ hideCollapsedPanelLabel?: string;
6
+ }
7
+ declare const TwoColumnPanel: React.ForwardRefExoticComponent<TwoColumnPanelProps & React.RefAttributes<HTMLDivElement>>;
8
+ export default TwoColumnPanel;
@@ -0,0 +1,6 @@
1
+ export { default } from './TwoColumnPanel';
2
+ export { default as ColumnHeader } from './ColumnHeader';
3
+ export { default as ColumnGroupHeader } from './ColumnGroupHeader';
4
+ export { default as ColumnLeft } from './ColumnLeft';
5
+ export { default as ColumnRight } from './ColumnRight';
6
+ export { default as ColumnList } from './ColumnList';
package/lib/index.d.ts CHANGED
@@ -48,6 +48,7 @@ export { Address, AddressLine, AddressCityStateZip } from './components/Address'
48
48
  export { default as Pagination } from './components/Pagination';
49
49
  export { default as FieldWrap } from './components/FieldWrap';
50
50
  export { default as Breadcrumb, BreadcrumbItem, BreadcrumbLink } from './components/Breadcrumb';
51
+ export { default as TwoColumnPanel, ColumnHeader, ColumnGroupHeader, ColumnLeft, ColumnRight, ColumnList } from './components/TwoColumnPanel';
51
52
  /**
52
53
  * Helpers / Utils
53
54
  */
package/lib/index.js CHANGED
@@ -173,6 +173,7 @@ var iconTypes = [
173
173
  'radio-checked',
174
174
  'radio-unchecked',
175
175
  'recycle',
176
+ 'resend',
176
177
  'robot',
177
178
  'run-again',
178
179
  'save',
@@ -237,6 +238,7 @@ function __variableDynamicImportRuntime0__(path) {
237
238
  case './icons/radio-checked.svg': return Promise.resolve().then(function () { return require('./radio-checked.js'); });
238
239
  case './icons/radio-unchecked.svg': return Promise.resolve().then(function () { return require('./radio-unchecked.js'); });
239
240
  case './icons/recycle.svg': return Promise.resolve().then(function () { return require('./recycle.js'); });
241
+ case './icons/resend.svg': return Promise.resolve().then(function () { return require('./resend.js'); });
240
242
  case './icons/robot.svg': return Promise.resolve().then(function () { return require('./robot.js'); });
241
243
  case './icons/run-again.svg': return Promise.resolve().then(function () { return require('./run-again.js'); });
242
244
  case './icons/save.svg': return Promise.resolve().then(function () { return require('./save.js'); });
@@ -444,7 +446,18 @@ var MenuItem = /** @class */ (function (_super) {
444
446
 
445
447
  var MENU_BREAKPOINT = 1024;
446
448
 
447
- var isWide = function () { return window.innerWidth >= MENU_BREAKPOINT; };
449
+ function isBrowser() {
450
+ return (typeof window !== 'undefined' &&
451
+ !!window.document &&
452
+ !!window.document.createElement);
453
+ }
454
+
455
+ var isWide = function () {
456
+ if (!isBrowser()) {
457
+ return false;
458
+ }
459
+ return window.innerWidth >= MENU_BREAKPOINT;
460
+ };
448
461
 
449
462
  var TopBar = /** @class */ (function (_super) {
450
463
  tslib.__extends(TopBar, _super);
@@ -606,12 +619,13 @@ var ClickOutsideListener = /** @class */ (function (_super) {
606
619
  var _this = _super !== null && _super.apply(this, arguments) || this;
607
620
  _this.handleEvent = function (event) {
608
621
  var _a = _this, nodeRef = _a.nodeRef, props = _a.props;
609
- var onClickOutside = props.onClickOutside;
622
+ var onClickOutside = props.onClickOutside, target = props.target;
610
623
  if (event.defaultPrevented) {
611
624
  return;
612
625
  }
613
- var target = event.target;
614
- if (nodeRef && !nodeRef.contains(target)) {
626
+ var eventTarget = event.target;
627
+ if ((target && !target.contains(eventTarget)) ||
628
+ (nodeRef && !nodeRef.contains(eventTarget))) {
615
629
  onClickOutside(event);
616
630
  }
617
631
  };
@@ -654,16 +668,19 @@ var ClickOutsideListener = /** @class */ (function (_super) {
654
668
  };
655
669
  ClickOutsideListener.prototype.render = function () {
656
670
  var _a = this, props = _a.props, resolveRef = _a.resolveRef;
657
- return React__default.cloneElement(props.children, {
658
- ref: resolveRef
659
- });
671
+ return !props.children
672
+ ? null
673
+ : React__default.cloneElement(props.children, {
674
+ ref: resolveRef
675
+ });
660
676
  };
661
677
  ClickOutsideListener.defaultProps = {
662
678
  mouseEvent: 'click',
663
679
  touchEvent: 'touchend'
664
680
  };
665
681
  ClickOutsideListener.propTypes = {
666
- children: PropTypes.node.isRequired,
682
+ children: PropTypes.node,
683
+ target: PropTypes.any,
667
684
  onClickOutside: PropTypes.func.isRequired,
668
685
  mouseEvent: PropTypes.oneOf(['mousedown', 'click', 'mouseup', false]),
669
686
  touchEvent: PropTypes.oneOf(['touchstart', 'touchend', false])
@@ -1276,10 +1293,11 @@ var Dialog = /** @class */ (function (_super) {
1276
1293
  };
1277
1294
  Dialog.prototype.render = function () {
1278
1295
  var _this = this;
1279
- var _a = this.props, dialogRef = _a.dialogRef, forceAction = _a.forceAction, className = _a.className, children = _a.children, closeButtonText = _a.closeButtonText, heading = _a.heading, show = _a.show, _b = _a.portal, portal = _b === void 0 ? document.body : _b, other = tslib.__rest(_a, ["dialogRef", "forceAction", "className", "children", "closeButtonText", "heading", "show", "portal"]);
1280
- if (!show) {
1296
+ var _a = this.props, dialogRef = _a.dialogRef, forceAction = _a.forceAction, className = _a.className, children = _a.children, closeButtonText = _a.closeButtonText, heading = _a.heading, show = _a.show, other = tslib.__rest(_a, ["dialogRef", "forceAction", "className", "children", "closeButtonText", "heading", "show"]);
1297
+ if (!show || !isBrowser()) {
1281
1298
  return null;
1282
1299
  }
1300
+ var portal = this.props.portal || document.body;
1283
1301
  var close = !forceAction ? (React__default.createElement("button", { className: "Dialog__close", type: "button", onClick: this.close },
1284
1302
  React__default.createElement(Icon, { type: "close", "aria-hidden": "true" }),
1285
1303
  React__default.createElement(Offscreen, null, closeButtonText))) : null;
@@ -1407,6 +1425,9 @@ var SkipLink = /** @class */ (function (_super) {
1407
1425
  React__default.createElement("span", { className: "SkipLink__item--second" }, targetText))));
1408
1426
  };
1409
1427
  SkipLink.prototype.onClick = function () {
1428
+ if (!isBrowser()) {
1429
+ return;
1430
+ }
1410
1431
  var element = document.querySelector(this.props.target);
1411
1432
  if (element) {
1412
1433
  element.tabIndex = -1;
@@ -1473,15 +1494,14 @@ var fireCustomEvent = function (show, button) {
1473
1494
  };
1474
1495
  function Tooltip(_a) {
1475
1496
  var _this = this;
1476
- var propId = _a.id, _b = _a.placement, initialPlacement = _b === void 0 ? 'auto' : _b, children = _a.children, portal = _a.portal, target = _a.target, _c = _a.association, association = _c === void 0 ? 'aria-describedby' : _c, _d = _a.variant, variant = _d === void 0 ? 'text' : _d, _e = _a.show, showProp = _e === void 0 ? false : _e, _f = _a.hideElementOnHidden, hideElementOnHidden = _f === void 0 ? false : _f, className = _a.className, props = tslib.__rest(_a, ["id", "placement", "children", "portal", "target", "association", "variant", "show", "hideElementOnHidden", "className"]);
1497
+ var propId = _a.id, _b = _a.placement, initialPlacement = _b === void 0 ? 'auto' : _b, children = _a.children, portal = _a.portal, target = _a.target, _c = _a.association, association = _c === void 0 ? 'aria-describedby' : _c, _d = _a.variant, variant = _d === void 0 ? 'text' : _d, _e = _a.show, initialShow = _e === void 0 ? false : _e, _f = _a.hideElementOnHidden, hideElementOnHidden = _f === void 0 ? false : _f, className = _a.className, props = tslib.__rest(_a, ["id", "placement", "children", "portal", "target", "association", "variant", "show", "hideElementOnHidden", "className"]);
1477
1498
  var _g = tslib.__read(propId ? [propId] : nextId.useId(1, 'tooltip'), 1), id = _g[0];
1478
- var hovering = React.useRef(false);
1479
- var _h = tslib.__read(React.useState(initialPlacement), 2), placement = _h[0], setPlacement = _h[1];
1480
- var _j = tslib.__read(React.useState(!!showProp), 2), showTooltip = _j[0], setShowTooltip = _j[1];
1481
- var _k = tslib.__read(React.useState(null), 2), targetElement = _k[0], setTargetElement = _k[1];
1482
- var _l = tslib.__read(React.useState(null), 2), tooltipElement = _l[0], setTooltipElement = _l[1];
1483
- var _m = tslib.__read(React.useState(null), 2), arrowElement = _m[0], setArrowElement = _m[1];
1484
- var _o = reactPopper.usePopper(targetElement, tooltipElement, {
1499
+ var hideTimeoutRef = React.useRef(null);
1500
+ var _h = tslib.__read(React.useState(!!initialShow), 2), showTooltip = _h[0], setShowTooltip = _h[1];
1501
+ var _j = tslib.__read(React.useState(null), 2), targetElement = _j[0], setTargetElement = _j[1];
1502
+ var _k = tslib.__read(React.useState(null), 2), tooltipElement = _k[0], setTooltipElement = _k[1];
1503
+ var _l = tslib.__read(React.useState(null), 2), arrowElement = _l[0], setArrowElement = _l[1];
1504
+ var _m = reactPopper.usePopper(targetElement, tooltipElement, {
1485
1505
  placement: initialPlacement,
1486
1506
  modifiers: [
1487
1507
  { name: 'preventOverflow', options: { padding: 8 } },
@@ -1489,11 +1509,17 @@ function Tooltip(_a) {
1489
1509
  { name: 'offset', options: { offset: [0, 8] } },
1490
1510
  { name: 'arrow', options: { padding: 5, element: arrowElement } }
1491
1511
  ]
1492
- }), styles = _o.styles, attributes = _o.attributes, update = _o.update;
1493
- var show = function () { return tslib.__awaiter(_this, void 0, void 0, function () {
1512
+ }), styles = _m.styles, attributes = _m.attributes, update = _m.update;
1513
+ // Show the tooltip
1514
+ var show = React.useCallback(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
1494
1515
  return tslib.__generator(this, function (_a) {
1495
1516
  switch (_a.label) {
1496
1517
  case 0:
1518
+ // Clear the hide timeout if there was one pending
1519
+ if (hideTimeoutRef.current) {
1520
+ clearTimeout(hideTimeoutRef.current);
1521
+ hideTimeoutRef.current = null;
1522
+ }
1497
1523
  if (!update) return [3 /*break*/, 2];
1498
1524
  return [4 /*yield*/, update()];
1499
1525
  case 1:
@@ -1505,45 +1531,31 @@ function Tooltip(_a) {
1505
1531
  return [2 /*return*/];
1506
1532
  }
1507
1533
  });
1508
- }); };
1509
- var hide = function (_a) {
1510
- var target = _a.target;
1511
- if (document.activeElement !== target) {
1512
- setTimeout(function () {
1513
- if (!hovering.current) {
1514
- setShowTooltip(false);
1515
- fireCustomEvent(false, targetElement);
1516
- }
1534
+ }); }, [
1535
+ targetElement,
1536
+ // update starts off as null
1537
+ update
1538
+ ]);
1539
+ // Hide the tooltip
1540
+ var hide = React.useCallback(function () {
1541
+ if (!hideTimeoutRef.current) {
1542
+ hideTimeoutRef.current = setTimeout(function () {
1543
+ hideTimeoutRef.current = null;
1544
+ setShowTooltip(false);
1545
+ fireCustomEvent(false, targetElement);
1517
1546
  }, TIP_HIDE_DELAY);
1518
1547
  }
1519
- };
1520
- var handleTriggerMouseEnter = function () {
1521
- hovering.current = true;
1522
- show();
1523
- };
1524
- var handleTriggerMouseLeave = function (e) {
1525
- hovering.current = false;
1526
- hide(e);
1527
- };
1528
- var handleTipMouseEnter = function () {
1529
- hovering.current = true;
1530
- };
1531
- var handleTipMouseLeave = function (e) {
1532
- hovering.current = false;
1533
- hide(e);
1534
- };
1548
+ }, [targetElement]);
1549
+ // Keep targetElement in sync with target prop
1535
1550
  React.useEffect(function () {
1536
1551
  var targetElement = target && 'current' in target ? target.current : target;
1537
1552
  setTargetElement(targetElement);
1538
1553
  }, [target]);
1539
- var popperPlacement = (attributes.popper &&
1554
+ // Get popper placement
1555
+ var placement = (attributes.popper &&
1540
1556
  attributes.popper['data-popper-placement']) ||
1541
1557
  initialPlacement;
1542
- React.useEffect(function () {
1543
- if (popperPlacement) {
1544
- setPlacement(popperPlacement);
1545
- }
1546
- }, [popperPlacement]);
1558
+ // Only listen to key ups when the tooltip is visible
1547
1559
  React.useEffect(function () {
1548
1560
  var handleEscape = function (event) {
1549
1561
  if (event.key === 'Escape' ||
@@ -1562,38 +1574,37 @@ function Tooltip(_a) {
1562
1574
  return function () {
1563
1575
  targetElement.removeEventListener('keyup', handleEscape);
1564
1576
  };
1565
- }, [showProp]);
1577
+ }, [showTooltip]);
1578
+ // Handle hover and focus events for the targetElement
1566
1579
  React.useEffect(function () {
1567
- if (typeof showProp !== undefined) {
1568
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseenter', handleTriggerMouseEnter);
1569
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseleave', handleTriggerMouseLeave);
1570
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusin', show);
1571
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusout', hide);
1572
- }
1580
+ targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseenter', show);
1581
+ targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseleave', hide);
1582
+ targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusin', show);
1583
+ targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusout', hide);
1573
1584
  return function () {
1574
1585
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseenter', show);
1575
1586
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseleave', hide);
1576
1587
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusin', show);
1577
1588
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusout', hide);
1578
1589
  };
1579
- }, [targetElement, showProp]);
1590
+ }, [targetElement, show, hide]);
1591
+ // Handle hover events for the tooltipElement
1580
1592
  React.useEffect(function () {
1581
- if (tooltipElement) {
1582
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseenter', handleTipMouseEnter);
1583
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', handleTipMouseLeave);
1584
- }
1593
+ tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseenter', show);
1594
+ tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', hide);
1585
1595
  return function () {
1586
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter', handleTipMouseEnter);
1587
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseleave', handleTipMouseLeave);
1596
+ tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter', show);
1597
+ tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseleave', hide);
1588
1598
  };
1589
- }, [tooltipElement]);
1599
+ }, [tooltipElement, show, hide]);
1600
+ // Keep the target's id in sync
1590
1601
  React.useEffect(function () {
1591
1602
  var attrText = targetElement === null || targetElement === void 0 ? void 0 : targetElement.getAttribute(association);
1592
1603
  if (!(attrText === null || attrText === void 0 ? void 0 : attrText.includes(id || ''))) {
1593
1604
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.setAttribute(association, [id, attrText].filter(Boolean).join(' '));
1594
1605
  }
1595
1606
  }, [targetElement, id]);
1596
- return showTooltip || hideElementOnHidden
1607
+ return (showTooltip || hideElementOnHidden) && isBrowser()
1597
1608
  ? reactDom.createPortal(React__default.createElement("div", tslib.__assign({ id: id, className: classNames('Tooltip', "Tooltip--" + placement, className, {
1598
1609
  TooltipInfo: variant === 'info',
1599
1610
  'Tooltip--hidden': !showTooltip && hideElementOnHidden,
@@ -1911,10 +1922,11 @@ var Pointout = /** @class */ (function (_super) {
1911
1922
  var _this = this;
1912
1923
  var _c;
1913
1924
  var _d = this.state, show = _d.show, style = _d.style, offscreenContentFocus = _d.offscreenContentFocus, headingId = _d.headingId;
1914
- var _e = this.props, heading = _e.heading, ftpoRef = _e.ftpoRef, children = _e.children, noArrow = _e.noArrow, dismissText = _e.dismissText, previousText = _e.previousText, nextText = _e.nextText, showNext = _e.showNext, showPrevious = _e.showPrevious, arrowPosition = _e.arrowPosition, position = _e.position, className = _e.className, target = _e.target, disableOffscreenPointout = _e.disableOffscreenPointout, _f = _e.portal, portal = _f === void 0 ? document.body : _f, previousButtonProps = _e.previousButtonProps, nextButtonProps = _e.nextButtonProps, closeButtonProps = _e.closeButtonProps;
1915
- if (!show) {
1925
+ var _e = this.props, heading = _e.heading, ftpoRef = _e.ftpoRef, children = _e.children, noArrow = _e.noArrow, dismissText = _e.dismissText, previousText = _e.previousText, nextText = _e.nextText, showNext = _e.showNext, showPrevious = _e.showPrevious, arrowPosition = _e.arrowPosition, position = _e.position, className = _e.className, target = _e.target, disableOffscreenPointout = _e.disableOffscreenPointout, previousButtonProps = _e.previousButtonProps, nextButtonProps = _e.nextButtonProps, closeButtonProps = _e.closeButtonProps;
1926
+ if (!show || !isBrowser()) {
1916
1927
  return null;
1917
1928
  }
1929
+ var portal = this.props.portal || document.body;
1918
1930
  var FTPO = (React__default.createElement("div", { className: classNames(className, 'Pointout', (_a = {
1919
1931
  'Pointout--no-arrow': noArrow,
1920
1932
  'Pointout--auto': !!target
@@ -2011,6 +2023,9 @@ var Pointout = /** @class */ (function (_super) {
2011
2023
  */
2012
2024
  var queryAll = function (selector, context) {
2013
2025
  if (context === void 0) { context = document; }
2026
+ if (!isBrowser()) {
2027
+ return [];
2028
+ }
2014
2029
  return Array.prototype.slice.call(context.querySelectorAll(selector));
2015
2030
  };
2016
2031
 
@@ -2020,7 +2035,7 @@ var queryAll = function (selector, context) {
2020
2035
  var typeMap = {
2021
2036
  confirmation: {
2022
2037
  className: 'success',
2023
- icon: 'info-circle'
2038
+ icon: 'check-circle'
2024
2039
  },
2025
2040
  caution: {
2026
2041
  className: 'warning',
@@ -2194,7 +2209,8 @@ var Link = function (_a) {
2194
2209
  var children = _a.children, linkRef = _a.linkRef, className = _a.className, variant = _a.variant, other = tslib.__rest(_a, ["children", "linkRef", "className", "variant"]);
2195
2210
  return (React__default.createElement("a", tslib.__assign({ ref: linkRef, className: classNames(className, {
2196
2211
  Link: !variant,
2197
- 'Button--primary': variant === 'button'
2212
+ 'Button--primary': variant === 'button',
2213
+ 'Button--secondary': variant === 'button-secondary'
2198
2214
  }) }, other), children));
2199
2215
  };
2200
2216
  Link.propTypes = {
@@ -2328,7 +2344,7 @@ var RadioGroup = function (_a) {
2328
2344
  setCurrentValue(value);
2329
2345
  }, [value]);
2330
2346
  var radioButtons = radios.map(function (radio, index) {
2331
- var label = radio.label, disabled = radio.disabled, radioValue = radio.value, id = radio.id, className = radio.className, other = tslib.__rest(radio, ["label", "disabled", "value", "id", "className"]);
2347
+ var label = radio.label, disabled = radio.disabled, radioValue = radio.value, labelDescription = radio.labelDescription, id = radio.id, className = radio.className, other = tslib.__rest(radio, ["label", "disabled", "value", "labelDescription", "id", "className"]);
2332
2348
  var isChecked = currentValue === radioValue;
2333
2349
  var isFocused = focusIndex === index;
2334
2350
  return (React__default.createElement("div", { className: classNames('Radio is--flex-row', className), key: id },
@@ -2341,14 +2357,17 @@ var RadioGroup = function (_a) {
2341
2357
  var _a;
2342
2358
  handleChange(radioValue);
2343
2359
  onChange(radio, (_a = inputs.current) === null || _a === void 0 ? void 0 : _a[index]);
2344
- }, disabled: disabled, checked: isChecked }, other)),
2360
+ }, disabled: disabled, checked: isChecked, "aria-describedby": labelDescription && id + "Desc" }, other)),
2345
2361
  React__default.createElement("label", { htmlFor: id, className: classNames('Field__label', {
2346
2362
  'Field__label--disabled': disabled
2347
2363
  }) }, label),
2348
2364
  React__default.createElement(Icon, { className: classNames('Radio__overlay', {
2349
2365
  'Radio__overlay--focused': isFocused,
2350
2366
  'Radio__overlay--disabled': disabled
2351
- }), type: isChecked ? 'radio-checked' : 'radio-unchecked', "aria-hidden": "true", onClick: function () { return onRadioClick(index); } })));
2367
+ }), type: isChecked ? 'radio-checked' : 'radio-unchecked', "aria-hidden": "true", onClick: function () { return onRadioClick(index); } }),
2368
+ labelDescription && (React__default.createElement("span", { id: id + "Desc", className: classNames('Field__labelDescription', {
2369
+ 'Field__labelDescription--disabled': disabled
2370
+ }) }, labelDescription))));
2352
2371
  });
2353
2372
  // reset the input refs array
2354
2373
  // refs get clobbered every re-render anyway and this supports "dynamic" radios
@@ -2361,7 +2380,8 @@ RadioGroup.propTypes = {
2361
2380
  radios: PropTypes.arrayOf(PropTypes.shape({
2362
2381
  value: PropTypes.string.isRequired,
2363
2382
  id: PropTypes.string.isRequired,
2364
- label: PropTypes.string.isRequired
2383
+ label: PropTypes.string.isRequired,
2384
+ labelDescription: PropTypes.string
2365
2385
  })).isRequired,
2366
2386
  hasLabel: function (props, propName, componentName) {
2367
2387
  if (!props['aria-label'] && !props['aria-labelledby']) {
@@ -2375,7 +2395,7 @@ RadioGroup.propTypes = {
2375
2395
  RadioGroup.displayName = 'RadioGroup';
2376
2396
 
2377
2397
  var Checkbox = React.forwardRef(function (_a, ref) {
2378
- var id = _a.id, label = _a.label, 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", "error", "checkboxRef", "className", "onChange", 'aria-describedby', "disabled", "checked"]);
2398
+ 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"]);
2379
2399
  var _d = tslib.__read(React.useState(checked), 2), isChecked = _d[0], setIsChecked = _d[1];
2380
2400
  var _e = tslib.__read(React.useState(false), 2), focused = _e[0], setFocused = _e[1];
2381
2401
  var checkRef = React.useRef(null);
@@ -2386,10 +2406,19 @@ var Checkbox = React.forwardRef(function (_a, ref) {
2386
2406
  if (typeof refProp === 'function') {
2387
2407
  refProp(checkRef.current);
2388
2408
  }
2389
- var errorId = React.useMemo(function () { return nextId__default(); }, []);
2390
- var ariaDescribedbyId = error
2391
- ? tokenList(errorId, ariaDescribedby)
2392
- : ariaDescribedby;
2409
+ var _f = React.useMemo(function () {
2410
+ return {
2411
+ labelDescriptionId: nextId__default(),
2412
+ errorId: nextId__default()
2413
+ };
2414
+ }, []), errorId = _f.errorId, labelDescriptionId = _f.labelDescriptionId;
2415
+ var ariaDescribedbyId = ariaDescribedby;
2416
+ if (error) {
2417
+ ariaDescribedbyId = tokenList(errorId, ariaDescribedbyId);
2418
+ }
2419
+ if (labelDescription) {
2420
+ ariaDescribedbyId = tokenList(labelDescriptionId, ariaDescribedbyId);
2421
+ }
2393
2422
  return (React__default.createElement(React__default.Fragment, null,
2394
2423
  React__default.createElement("div", { className: classNames('Checkbox is--flex-row', className) },
2395
2424
  React__default.createElement("input", tslib.__assign({ id: id, ref: typeof refProp === 'function' || !refProp ? checkRef : refProp, type: "checkbox", checked: isChecked, disabled: disabled, onFocus: function () { return setFocused(true); }, onBlur: function () { return setFocused(false); }, "aria-describedby": ariaDescribedbyId, onChange: function (e) {
@@ -2413,8 +2442,9 @@ var Checkbox = React.forwardRef(function (_a, ref) {
2413
2442
  else {
2414
2443
  (_b = checkRef.current) === null || _b === void 0 ? void 0 : _b.click();
2415
2444
  }
2416
- } })),
2417
- error && (React__default.createElement("div", { id: errorId, className: "Error" }, error))));
2445
+ } }),
2446
+ labelDescription && (React__default.createElement("span", { id: labelDescriptionId, className: "Field__labelDescription" }, labelDescription)),
2447
+ error && (React__default.createElement("div", { id: errorId, className: "Error" }, error)))));
2418
2448
  });
2419
2449
  Checkbox.displayName = 'Checkbox';
2420
2450
 
@@ -7968,22 +7998,39 @@ function AxeLoader() {
7968
7998
  }
7969
7999
 
7970
8000
  var LoaderOverlay = React__default.forwardRef(function (_a, ref) {
7971
- var className = _a.className, variant = _a.variant, label = _a.label, other = tslib.__rest(_a, ["className", "variant", "label"]);
8001
+ var className = _a.className, variant = _a.variant, label = _a.label, children = _a.children, focusOnInitialRender = _a.focusOnInitialRender, other = tslib.__rest(_a, ["className", "variant", "label", "children", "focusOnInitialRender"]);
8002
+ var overlayRef = typeof ref === 'function' || !ref ? React.createRef() : ref;
8003
+ React.useEffect(function () {
8004
+ if (!!focusOnInitialRender && overlayRef.current) {
8005
+ setTimeout(function () {
8006
+ var _a;
8007
+ return (_a = overlayRef.current) === null || _a === void 0 ? void 0 : _a.focus();
8008
+ });
8009
+ }
8010
+ return;
8011
+ }, [overlayRef.current]);
8012
+ React.useEffect(function () {
8013
+ if (typeof ref === 'function') {
8014
+ ref(overlayRef.current);
8015
+ }
8016
+ }, [ref]);
7972
8017
  return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader__overlay', className, variant === 'large'
7973
8018
  ? 'Loader__overlay--large'
7974
8019
  : variant === 'small'
7975
8020
  ? 'Loader__overlay--small'
7976
- : ''), ref: ref }, other),
8021
+ : ''), ref: overlayRef, tabIndex: -1 }, other),
7977
8022
  React__default.createElement("div", { className: "Loader__overlay__loader" },
7978
8023
  React__default.createElement(Loader, { variant: variant }),
7979
8024
  React__default.createElement(AxeLoader, null)),
7980
8025
  label ? React__default.createElement("span", { className: "Loader__overlay__label" }, label) : null,
7981
- other.children));
8026
+ children));
7982
8027
  });
7983
8028
  LoaderOverlay.propTypes = {
7984
8029
  className: PropTypes.string,
7985
8030
  variant: PropTypes.oneOf(['large', 'small']),
7986
- label: PropTypes.string
8031
+ label: PropTypes.string,
8032
+ focusOnInitialRender: PropTypes.bool,
8033
+ children: PropTypes.node
7987
8034
  };
7988
8035
  LoaderOverlay.displayName = 'LoaderOverlay';
7989
8036
 
@@ -8259,23 +8306,34 @@ var DescriptionDetails = function (_a) {
8259
8306
  DescriptionDetails.displayName = 'DescriptionDetails';
8260
8307
  DescriptionDetails.propTypes = commonPropTypes;
8261
8308
 
8262
- var isTooltip = function (props) {
8309
+ var isTooltipProps = function (props) {
8263
8310
  return !!props.tooltip;
8264
8311
  };
8265
8312
  var Step = function (props) {
8266
- var status = props.status, className = props.className, other = tslib.__rest(props, ["status", "className"]);
8267
- return (React__default.createElement("li", tslib.__assign({ className: classNames('Stepper__step', "Stepper__step--" + status, className), "aria-current": status === 'current' ? 'step' : 'false' }, other),
8313
+ var _a;
8314
+ var children = props.children, status = props.status, className = props.className, other = tslib.__rest(props, ["children", "status", "className"]);
8315
+ var tooltip;
8316
+ var tooltipText;
8317
+ var liProps;
8318
+ var isTooltip = isTooltipProps(other);
8319
+ if (isTooltip) {
8320
+ (_a = other, (tooltip = _a.tooltip, tooltipText = _a.tooltipText, _a), liProps = tslib.__rest(_a, ["tooltip", "tooltipText"]));
8321
+ }
8322
+ else {
8323
+ liProps = other;
8324
+ }
8325
+ return (React__default.createElement("li", tslib.__assign({ className: classNames('Stepper__step', "Stepper__step--" + status, className), "aria-current": status === 'current' ? 'step' : 'false' }, liProps),
8268
8326
  React__default.createElement("div", { className: "Stepper__step-line" }),
8269
- React__default.createElement("div", { className: "Stepper__step-content" }, isTooltip(props) ? (React__default.createElement(TooltipTabstop, { placement: "bottom", tooltip: props.tooltip,
8327
+ React__default.createElement("div", { className: "Stepper__step-content" }, isTooltip ? (React__default.createElement(TooltipTabstop, { placement: "bottom", tooltip: tooltip,
8270
8328
  // the pseudo content (ex: "1") is conveyed
8271
8329
  // by the list item's position in the set of
8272
8330
  // list items, therefore it is safe to clobber
8273
8331
  // it with the contents of the tooltip in the
8274
8332
  // tab stop's accessible name.
8275
- association: "aria-labelledby", "aria-label": isTooltip(props) ? props.tooltipText : undefined },
8333
+ association: "aria-labelledby", "aria-label": tooltipText },
8276
8334
  React__default.createElement("div", { className: "Stepper__step-indicator" }))) : (React__default.createElement(React__default.Fragment, null,
8277
8335
  React__default.createElement("div", { className: "Stepper__step-indicator" }),
8278
- 'children' in props && (React__default.createElement("div", { className: "Stepper__step-label" }, props.children)))))));
8336
+ children ? (React__default.createElement("div", { className: "Stepper__step-label" }, children)) : null)))));
8279
8337
  };
8280
8338
  Step.displayName = 'Step';
8281
8339
  Step.propTypes = {
@@ -8297,22 +8355,32 @@ Stepper.propTypes = {
8297
8355
  var Panel = function (_a) {
8298
8356
  var _b;
8299
8357
  var children = _a.children, collapsed = _a.collapsed, className = _a.className, heading = _a.heading, other = tslib.__rest(_a, ["children", "collapsed", "className", "heading"]);
8300
- var Heading = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
8301
- ? heading.level
8302
- : 2);
8303
- var headingId = typeof heading === 'object' && 'id' in heading ? heading.id : randomId();
8358
+ var headingId = !heading
8359
+ ? undefined
8360
+ : typeof heading === 'object' && 'id' in heading
8361
+ ? heading.id
8362
+ : randomId();
8363
+ var Heading = function () {
8364
+ if (!headingId) {
8365
+ return null;
8366
+ }
8367
+ var HeadingComponent = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
8368
+ ? heading.level
8369
+ : 2);
8370
+ return (React__default.createElement(HeadingComponent, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
8371
+ ? heading.text
8372
+ : heading));
8373
+ };
8304
8374
  return (React__default.createElement("section", tslib.__assign({ "aria-labelledby": headingId, className: classNames('Panel', className, (_b = {},
8305
8375
  _b['Panel--collapsed'] = collapsed,
8306
8376
  _b)) }, other),
8307
- React__default.createElement(Heading, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
8308
- ? heading.text
8309
- : heading),
8377
+ React__default.createElement(Heading, null),
8310
8378
  children));
8311
8379
  };
8312
8380
  Panel.displayName = 'Panel';
8313
8381
  Panel.propTypes = {
8314
8382
  children: PropTypes.node.isRequired,
8315
- heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]).isRequired,
8383
+ heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]),
8316
8384
  className: PropTypes.string
8317
8385
  };
8318
8386
 
@@ -8386,7 +8454,7 @@ var Pagination = React__default.forwardRef(function (_a, ref) {
8386
8454
  React__default.createElement("span", { role: "log", "aria-atomic": "true" }, statusLabel || (React__default.createElement("span", null,
8387
8455
  "Showing ",
8388
8456
  React__default.createElement("strong", null, itemStart),
8389
- " of",
8457
+ " to",
8390
8458
  ' ',
8391
8459
  React__default.createElement("strong", null, itemEnd),
8392
8460
  " of ",
@@ -8455,6 +8523,172 @@ var BreadcrumbLink = React.forwardRef(function (_a, ref) {
8455
8523
  return (React__default.createElement(ElementType, tslib.__assign({ className: classNames('Link', 'Breadcrumb__Link', className), ref: ref }, props), children));
8456
8524
  });
8457
8525
 
8526
+ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
8527
+ var className = _a.className, children = _a.children, _b = _a.initialCollapsed, initialCollapsed = _b === void 0 ? false : _b, _c = _a.showCollapsedPanelLabel, showCollapsedPanelLabel = _c === void 0 ? 'Show Panel' : _c, _d = _a.hideCollapsedPanelLabel, hideCollapsedPanelLabel = _d === void 0 ? 'Hide Panel' : _d, props = tslib.__rest(_a, ["className", "children", "initialCollapsed", "showCollapsedPanelLabel", "hideCollapsedPanelLabel"]);
8528
+ var _e = tslib.__read(React.useState(initialCollapsed), 2), isCollapsed = _e[0], setCollapsed = _e[1];
8529
+ var _f = tslib.__read(React.useState(false), 2), isFocusTrap = _f[0], setIsFocusTrap = _f[1];
8530
+ var _g = tslib.__read(React.useState(!initialCollapsed), 2), showPanel = _g[0], setShowPanel = _g[1];
8531
+ var togglePanel = function () {
8532
+ if (isCollapsed) {
8533
+ setShowPanel(true);
8534
+ }
8535
+ // Set collapsed state on next tick so css transitions can be applied
8536
+ requestAnimationFrame(function () {
8537
+ var _a, _b;
8538
+ var collapsed = !isCollapsed;
8539
+ setCollapsed(collapsed);
8540
+ if (!collapsed) {
8541
+ (_a = columnLeftRef.current) === null || _a === void 0 ? void 0 : _a.focus();
8542
+ }
8543
+ else {
8544
+ (_b = columnRightRef.current) === null || _b === void 0 ? void 0 : _b.focus();
8545
+ }
8546
+ });
8547
+ };
8548
+ var toggleButtonRef = React.useRef(null);
8549
+ var closeButtonRef = React.useRef(null);
8550
+ var columnLeftRef = React.useRef(null);
8551
+ var columnRightRef = React.useRef(null);
8552
+ var columnLeft = React__default.Children.toArray(children).find(function (child) { return child.type === ColumnLeft; });
8553
+ // The ColumnLeftComponent will end up being a focus trap when < 720px
8554
+ // This component also gets unmounted when not visible meaning that any
8555
+ // aria relationships cannot be set to items inside the component since
8556
+ // they will not be present in the dom
8557
+ var ColumnLeftComponent;
8558
+ var columnLeftId;
8559
+ if (React.isValidElement(columnLeft)) {
8560
+ var ref_1 = columnLeft.props.ref || columnLeftRef;
8561
+ var id = (columnLeftId =
8562
+ columnLeft.props.id || nextId.useId(undefined, 'sidebar-')[0]);
8563
+ var CloseButton = (React__default.createElement("div", { className: "TwoColumnPanel__Close" },
8564
+ React__default.createElement("button", { type: "button", onClick: togglePanel, ref: closeButtonRef, "aria-label": hideCollapsedPanelLabel },
8565
+ React__default.createElement(Icon, { type: "close" })),
8566
+ React__default.createElement(Tooltip, { target: closeButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, hideCollapsedPanelLabel)));
8567
+ var children_1 = tslib.__spread([
8568
+ CloseButton
8569
+ ], React__default.Children.toArray(columnLeft.props.children));
8570
+ ColumnLeftComponent = React.cloneElement(columnLeft, { id: id, ref: ref_1, tabIndex: -1 }, children_1.map(function (child, index) {
8571
+ return React.cloneElement(child, { key: "left-" + index });
8572
+ }));
8573
+ }
8574
+ var columnRight = React__default.Children.toArray(children).find(function (child) { return child.type === ColumnRight; });
8575
+ var ColumnRightComponent;
8576
+ if (React.isValidElement(columnRight)) {
8577
+ var ref_2 = columnRight.props.ref || columnRightRef;
8578
+ var ToggleButton = (React__default.createElement("div", { className: "TwoColumnPanel__ButtonToggle" },
8579
+ React__default.createElement("button", { type: "button", onClick: togglePanel, ref: toggleButtonRef, "aria-label": !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel, "aria-expanded": !isCollapsed, "aria-controls": columnLeftId },
8580
+ React__default.createElement(Icon, { type: !isCollapsed ? 'chevron-double-left' : 'chevron-double-right' })),
8581
+ React__default.createElement(Tooltip, { target: toggleButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel)));
8582
+ var children_2 = tslib.__spread([
8583
+ ToggleButton
8584
+ ], React__default.Children.toArray(columnRight.props.children));
8585
+ ColumnRightComponent = React.cloneElement(columnRight, { ref: ref_2, tabIndex: -1 }, children_2.map(function (child, index) {
8586
+ return React.cloneElement(child, { key: "right-" + index });
8587
+ }));
8588
+ }
8589
+ React.useLayoutEffect(function () {
8590
+ var _a;
8591
+ var handleTransitionEnd = function () {
8592
+ if (columnLeftRef.current && isCollapsed) {
8593
+ setShowPanel(false);
8594
+ }
8595
+ };
8596
+ (_a = columnLeftRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('transitionend', handleTransitionEnd);
8597
+ return function () {
8598
+ var _a;
8599
+ (_a = columnLeftRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('transitionend', handleTransitionEnd);
8600
+ };
8601
+ }, [columnLeftRef.current, isCollapsed]);
8602
+ // When the collapsable panel starts to overlay content, it needs to become a focus trap and collapsed by default
8603
+ React.useLayoutEffect(function () {
8604
+ var mediaQueryList = matchMedia('(max-width: 45rem)');
8605
+ var handleMatch = function (matches) {
8606
+ setIsFocusTrap(matches);
8607
+ var collapsed = matches ? true : isCollapsed;
8608
+ setCollapsed(collapsed);
8609
+ setShowPanel(!collapsed);
8610
+ };
8611
+ var listener = function (_a) {
8612
+ var matches = _a.matches;
8613
+ return handleMatch(matches);
8614
+ };
8615
+ if (mediaQueryList.matches) {
8616
+ handleMatch(mediaQueryList.matches);
8617
+ }
8618
+ mediaQueryList.addEventListener('change', listener);
8619
+ return function () {
8620
+ mediaQueryList.removeEventListener('change', listener);
8621
+ };
8622
+ }, []);
8623
+ React.useEffect(function () {
8624
+ var handleEscape = function (event) {
8625
+ if (event.key === 'Escape' ||
8626
+ event.key === 'Esc' ||
8627
+ event.keyCode === 27) {
8628
+ setCollapsed(true);
8629
+ }
8630
+ };
8631
+ var targetElement = document.body;
8632
+ if (isFocusTrap) {
8633
+ targetElement.addEventListener('keyup', handleEscape);
8634
+ }
8635
+ else {
8636
+ targetElement.removeEventListener('keyup', handleEscape);
8637
+ }
8638
+ return function () {
8639
+ targetElement.removeEventListener('keyup', handleEscape);
8640
+ };
8641
+ }, [isFocusTrap]);
8642
+ var handleClickOutside = function () {
8643
+ if (!isCollapsed && isFocusTrap) {
8644
+ setCollapsed(true);
8645
+ }
8646
+ };
8647
+ return (React__default.createElement("div", tslib.__assign({ className: classNames('TwoColumnPanel', className, {
8648
+ 'TwoColumnPanel--show': !isCollapsed,
8649
+ 'TwoColumnPanel--hide': isCollapsed
8650
+ }) }, props, { ref: ref }),
8651
+ React__default.createElement(FocusTrap, { active: !isCollapsed && isFocusTrap, focusTrapOptions: {
8652
+ escapeDeactivates: true,
8653
+ allowOutsideClick: true,
8654
+ fallbackFocus: columnLeftRef.current
8655
+ }, containerElements: [columnLeftRef.current] }),
8656
+ React__default.createElement(ClickOutsideListener, { onClickOutside: handleClickOutside, target: columnLeftRef.current }),
8657
+ showPanel ? ColumnLeftComponent : null,
8658
+ ColumnRightComponent));
8659
+ });
8660
+ TwoColumnPanel.displayName = 'TwoColumnPanel';
8661
+
8662
+ var ColumnHeader = React.forwardRef(function (_a, ref) {
8663
+ var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
8664
+ return (React__default.createElement("div", tslib.__assign({ className: classNames('TwoColumnPanel__Header', className) }, props, { ref: ref }), children));
8665
+ });
8666
+ ColumnHeader.displayName = 'ColumnHeader';
8667
+
8668
+ var ColumnGroupHeader = React.forwardRef(function (_a, ref) {
8669
+ var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
8670
+ return (React__default.createElement("div", tslib.__assign({ className: classNames('TwoColumnPanel__GroupHeader', className) }, props, { ref: ref }), children));
8671
+ });
8672
+ ColumnGroupHeader.displayName = 'ColumnGroupHeader';
8673
+
8674
+ var ColumnLeft = React.forwardRef(function (_a, ref) {
8675
+ var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
8676
+ return (React__default.createElement("section", tslib.__assign({ className: classNames('TwoColumnPanel__Left', className) }, props, { ref: ref }), children));
8677
+ });
8678
+ ColumnLeft.displayName = 'ColumnLeft';
8679
+
8680
+ var ColumnRight = React.forwardRef(function (_a, ref) {
8681
+ var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
8682
+ return (React__default.createElement("section", tslib.__assign({ className: classNames('TwoColumnPanel__Right', className) }, props, { ref: ref }), children));
8683
+ });
8684
+ ColumnRight.displayName = 'ColumnRight';
8685
+
8686
+ var ColumnList = React.forwardRef(function (_a, ref) {
8687
+ var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
8688
+ return (React__default.createElement("div", tslib.__assign({ className: classNames('TwoColumnPanel__List', className) }, props, { ref: ref }), children));
8689
+ });
8690
+ ColumnList.displayName = 'ColumnList';
8691
+
8458
8692
  var LIGHT_THEME_CLASS = 'cauldron--theme-light';
8459
8693
  var DARK_THEME_CLASS = 'cauldron--theme-dark';
8460
8694
  var ThemeContext = React.createContext({});
@@ -8532,6 +8766,11 @@ exports.CardHeader = CardHeader;
8532
8766
  exports.Checkbox = Checkbox;
8533
8767
  exports.ClickOutsideListener = ClickOutsideListener;
8534
8768
  exports.Code = Code;
8769
+ exports.ColumnGroupHeader = ColumnGroupHeader;
8770
+ exports.ColumnHeader = ColumnHeader;
8771
+ exports.ColumnLeft = ColumnLeft;
8772
+ exports.ColumnList = ColumnList;
8773
+ exports.ColumnRight = ColumnRight;
8535
8774
  exports.DescriptionDetails = DescriptionDetails;
8536
8775
  exports.DescriptionList = DescriptionList;
8537
8776
  exports.DescriptionListItem = DescriptionListItem;
@@ -8600,6 +8839,7 @@ exports.TopBar = TopBar$1;
8600
8839
  exports.TopBarItem = MenuItem;
8601
8840
  exports.TopBarMenu = TopBarMenu;
8602
8841
  exports.TopBarTrigger = TopBarTrigger;
8842
+ exports.TwoColumnPanel = TwoColumnPanel;
8603
8843
  exports.Workspace = Workspace;
8604
8844
  exports.focusableSelector = focusableSelector;
8605
8845
  exports.iconTypes = iconTypes;
package/lib/resend.js ADDED
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
+
5
+ var React = require('react');
6
+ var React__default = _interopDefault(React);
7
+
8
+ var _path;
9
+
10
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
11
+
12
+ const SvgResend = props => /*#__PURE__*/React.createElement("svg", _extends({
13
+ overflow: "visible",
14
+ preserveAspectRatio: "none",
15
+ viewBox: "0 0 24 24",
16
+ height: 24,
17
+ width: 24
18
+ }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
19
+ d: "M5.19 10.13a.649.649 0 0 1-.02-.92c.01 0 .01-.01.02-.02l4.13-4.14v-.72a.616.616 0 0 0-.41-.61.612.612 0 0 0-.73.15L2.86 9.19c-.26.25-.27.66-.02.92l.02.02 5.33 5.33c.12.13.29.2.47.2.09 0 .18-.02.26-.05.26-.1.42-.35.4-.62v-.72l-4.13-4.14zm16.13 4.53c.14-1.93-.49-3.84-1.76-5.3-1.33-1.33-3.41-2.1-6.24-2.3V4.33a.616.616 0 0 0-.41-.61.598.598 0 0 0-.73.15L6.86 9.19c-.26.25-.27.66-.02.92l.02.02 5.33 5.33c.12.13.29.2.47.2.09 0 .18-.02.26-.05.26-.1.42-.35.4-.62v-2.61c.95.06 1.89.24 2.79.55.68.23 1.29.63 1.78 1.15 1.03 1.15 1.39 3.12 1.1 5.91-.02.16.08.31.24.35h.09c.12.01.24-.07.29-.18l.21-.42c.1-.19.24-.51.42-.94.18-.43.35-.87.5-1.3.16-.47.29-.95.4-1.44.11-.45.17-.92.18-1.4z",
20
+ fill: "currentColor",
21
+ vectorEffect: "non-scaling-stroke"
22
+ })));
23
+
24
+ exports.default = SvgResend;
@@ -0,0 +1 @@
1
+ export declare function isBrowser(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "4.0.0-canary.debe968f",
3
+ "version": "4.1.0-canary.20bef562",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@popperjs/core": "^2.5.4",
25
25
  "classnames": "^2.2.6",
26
- "focus-trap-react": "^3.0.5",
26
+ "focus-trap-react": "^8.9.0",
27
27
  "focusable": "^2.3.0",
28
28
  "keyname": "^0.1.0",
29
29
  "prop-types": "^15.6.0",