@deque/cauldron-react 4.0.0 → 4.1.0-canary.1d6f49de

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' | '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;
@@ -1,14 +1,19 @@
1
1
  import React, { ThHTMLAttributes } from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ declare type SortDirection = 'ascending' | 'descending' | 'none';
3
4
  interface TableHeaderProps extends ThHTMLAttributes<HTMLTableCellElement> {
4
5
  children: React.ReactNode;
6
+ sortDirection?: SortDirection;
7
+ onSort?: () => void;
5
8
  className?: string;
6
9
  }
7
10
  declare const TableHeader: {
8
- ({ children, className, ...other }: TableHeaderProps): JSX.Element;
11
+ ({ children, sortDirection, onSort, className, ...other }: TableHeaderProps): JSX.Element;
9
12
  displayName: string;
10
13
  propTypes: {
11
14
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
15
+ sortDirection: PropTypes.Requireable<string>;
16
+ onSort: PropTypes.Requireable<(...args: any[]) => any>;
12
17
  className: PropTypes.Requireable<string>;
13
18
  };
14
19
  };
@@ -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,10 +173,12 @@ 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',
179
180
  'share',
181
+ 'sort-triangle',
180
182
  'sort',
181
183
  'star',
182
184
  'sun',
@@ -236,10 +238,12 @@ function __variableDynamicImportRuntime0__(path) {
236
238
  case './icons/radio-checked.svg': return Promise.resolve().then(function () { return require('./radio-checked.js'); });
237
239
  case './icons/radio-unchecked.svg': return Promise.resolve().then(function () { return require('./radio-unchecked.js'); });
238
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'); });
239
242
  case './icons/robot.svg': return Promise.resolve().then(function () { return require('./robot.js'); });
240
243
  case './icons/run-again.svg': return Promise.resolve().then(function () { return require('./run-again.js'); });
241
244
  case './icons/save.svg': return Promise.resolve().then(function () { return require('./save.js'); });
242
245
  case './icons/share.svg': return Promise.resolve().then(function () { return require('./share.js'); });
246
+ case './icons/sort-triangle.svg': return Promise.resolve().then(function () { return require('./sort-triangle.js'); });
243
247
  case './icons/sort.svg': return Promise.resolve().then(function () { return require('./sort.js'); });
244
248
  case './icons/star.svg': return Promise.resolve().then(function () { return require('./star.js'); });
245
249
  case './icons/sun.svg': return Promise.resolve().then(function () { return require('./sun.js'); });
@@ -442,7 +446,18 @@ var MenuItem = /** @class */ (function (_super) {
442
446
 
443
447
  var MENU_BREAKPOINT = 1024;
444
448
 
445
- 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
+ };
446
461
 
447
462
  var TopBar = /** @class */ (function (_super) {
448
463
  tslib.__extends(TopBar, _super);
@@ -604,12 +619,13 @@ var ClickOutsideListener = /** @class */ (function (_super) {
604
619
  var _this = _super !== null && _super.apply(this, arguments) || this;
605
620
  _this.handleEvent = function (event) {
606
621
  var _a = _this, nodeRef = _a.nodeRef, props = _a.props;
607
- var onClickOutside = props.onClickOutside;
622
+ var onClickOutside = props.onClickOutside, target = props.target;
608
623
  if (event.defaultPrevented) {
609
624
  return;
610
625
  }
611
- var target = event.target;
612
- if (nodeRef && !nodeRef.contains(target)) {
626
+ var eventTarget = event.target;
627
+ if ((target && !target.contains(eventTarget)) ||
628
+ (nodeRef && !nodeRef.contains(eventTarget))) {
613
629
  onClickOutside(event);
614
630
  }
615
631
  };
@@ -652,16 +668,19 @@ var ClickOutsideListener = /** @class */ (function (_super) {
652
668
  };
653
669
  ClickOutsideListener.prototype.render = function () {
654
670
  var _a = this, props = _a.props, resolveRef = _a.resolveRef;
655
- return React__default.cloneElement(props.children, {
656
- ref: resolveRef
657
- });
671
+ return !props.children
672
+ ? null
673
+ : React__default.cloneElement(props.children, {
674
+ ref: resolveRef
675
+ });
658
676
  };
659
677
  ClickOutsideListener.defaultProps = {
660
678
  mouseEvent: 'click',
661
679
  touchEvent: 'touchend'
662
680
  };
663
681
  ClickOutsideListener.propTypes = {
664
- children: PropTypes.node.isRequired,
682
+ children: PropTypes.node,
683
+ target: PropTypes.any,
665
684
  onClickOutside: PropTypes.func.isRequired,
666
685
  mouseEvent: PropTypes.oneOf(['mousedown', 'click', 'mouseup', false]),
667
686
  touchEvent: PropTypes.oneOf(['touchstart', 'touchend', false])
@@ -1274,10 +1293,11 @@ var Dialog = /** @class */ (function (_super) {
1274
1293
  };
1275
1294
  Dialog.prototype.render = function () {
1276
1295
  var _this = this;
1277
- 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"]);
1278
- 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()) {
1279
1298
  return null;
1280
1299
  }
1300
+ var portal = this.props.portal || document.body;
1281
1301
  var close = !forceAction ? (React__default.createElement("button", { className: "Dialog__close", type: "button", onClick: this.close },
1282
1302
  React__default.createElement(Icon, { type: "close", "aria-hidden": "true" }),
1283
1303
  React__default.createElement(Offscreen, null, closeButtonText))) : null;
@@ -1405,6 +1425,9 @@ var SkipLink = /** @class */ (function (_super) {
1405
1425
  React__default.createElement("span", { className: "SkipLink__item--second" }, targetText))));
1406
1426
  };
1407
1427
  SkipLink.prototype.onClick = function () {
1428
+ if (!isBrowser()) {
1429
+ return;
1430
+ }
1408
1431
  var element = document.querySelector(this.props.target);
1409
1432
  if (element) {
1410
1433
  element.tabIndex = -1;
@@ -1471,15 +1494,14 @@ var fireCustomEvent = function (show, button) {
1471
1494
  };
1472
1495
  function Tooltip(_a) {
1473
1496
  var _this = this;
1474
- 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"]);
1475
1498
  var _g = tslib.__read(propId ? [propId] : nextId.useId(1, 'tooltip'), 1), id = _g[0];
1476
- var hovering = React.useRef(false);
1477
- var _h = tslib.__read(React.useState(initialPlacement), 2), placement = _h[0], setPlacement = _h[1];
1478
- var _j = tslib.__read(React.useState(!!showProp), 2), showTooltip = _j[0], setShowTooltip = _j[1];
1479
- var _k = tslib.__read(React.useState(null), 2), targetElement = _k[0], setTargetElement = _k[1];
1480
- var _l = tslib.__read(React.useState(null), 2), tooltipElement = _l[0], setTooltipElement = _l[1];
1481
- var _m = tslib.__read(React.useState(null), 2), arrowElement = _m[0], setArrowElement = _m[1];
1482
- 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, {
1483
1505
  placement: initialPlacement,
1484
1506
  modifiers: [
1485
1507
  { name: 'preventOverflow', options: { padding: 8 } },
@@ -1487,11 +1509,17 @@ function Tooltip(_a) {
1487
1509
  { name: 'offset', options: { offset: [0, 8] } },
1488
1510
  { name: 'arrow', options: { padding: 5, element: arrowElement } }
1489
1511
  ]
1490
- }), styles = _o.styles, attributes = _o.attributes, update = _o.update;
1491
- 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 () {
1492
1515
  return tslib.__generator(this, function (_a) {
1493
1516
  switch (_a.label) {
1494
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
+ }
1495
1523
  if (!update) return [3 /*break*/, 2];
1496
1524
  return [4 /*yield*/, update()];
1497
1525
  case 1:
@@ -1503,45 +1531,31 @@ function Tooltip(_a) {
1503
1531
  return [2 /*return*/];
1504
1532
  }
1505
1533
  });
1506
- }); };
1507
- var hide = function (_a) {
1508
- var target = _a.target;
1509
- if (document.activeElement !== target) {
1510
- setTimeout(function () {
1511
- if (!hovering.current) {
1512
- setShowTooltip(false);
1513
- fireCustomEvent(false, targetElement);
1514
- }
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);
1515
1546
  }, TIP_HIDE_DELAY);
1516
1547
  }
1517
- };
1518
- var handleTriggerMouseEnter = function () {
1519
- hovering.current = true;
1520
- show();
1521
- };
1522
- var handleTriggerMouseLeave = function (e) {
1523
- hovering.current = false;
1524
- hide(e);
1525
- };
1526
- var handleTipMouseEnter = function () {
1527
- hovering.current = true;
1528
- };
1529
- var handleTipMouseLeave = function (e) {
1530
- hovering.current = false;
1531
- hide(e);
1532
- };
1548
+ }, [targetElement]);
1549
+ // Keep targetElement in sync with target prop
1533
1550
  React.useEffect(function () {
1534
1551
  var targetElement = target && 'current' in target ? target.current : target;
1535
1552
  setTargetElement(targetElement);
1536
1553
  }, [target]);
1537
- var popperPlacement = (attributes.popper &&
1554
+ // Get popper placement
1555
+ var placement = (attributes.popper &&
1538
1556
  attributes.popper['data-popper-placement']) ||
1539
1557
  initialPlacement;
1540
- React.useEffect(function () {
1541
- if (popperPlacement) {
1542
- setPlacement(popperPlacement);
1543
- }
1544
- }, [popperPlacement]);
1558
+ // Only listen to key ups when the tooltip is visible
1545
1559
  React.useEffect(function () {
1546
1560
  var handleEscape = function (event) {
1547
1561
  if (event.key === 'Escape' ||
@@ -1560,38 +1574,37 @@ function Tooltip(_a) {
1560
1574
  return function () {
1561
1575
  targetElement.removeEventListener('keyup', handleEscape);
1562
1576
  };
1563
- }, [showProp]);
1577
+ }, [showTooltip]);
1578
+ // Handle hover and focus events for the targetElement
1564
1579
  React.useEffect(function () {
1565
- if (typeof showProp !== undefined) {
1566
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseenter', handleTriggerMouseEnter);
1567
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseleave', handleTriggerMouseLeave);
1568
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusin', show);
1569
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusout', hide);
1570
- }
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);
1571
1584
  return function () {
1572
1585
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseenter', show);
1573
1586
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseleave', hide);
1574
1587
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusin', show);
1575
1588
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusout', hide);
1576
1589
  };
1577
- }, [targetElement, showProp]);
1590
+ }, [targetElement, show, hide]);
1591
+ // Handle hover events for the tooltipElement
1578
1592
  React.useEffect(function () {
1579
- if (tooltipElement) {
1580
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseenter', handleTipMouseEnter);
1581
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', handleTipMouseLeave);
1582
- }
1593
+ tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseenter', show);
1594
+ tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', hide);
1583
1595
  return function () {
1584
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter', handleTipMouseEnter);
1585
- 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);
1586
1598
  };
1587
- }, [tooltipElement]);
1599
+ }, [tooltipElement, show, hide]);
1600
+ // Keep the target's id in sync
1588
1601
  React.useEffect(function () {
1589
1602
  var attrText = targetElement === null || targetElement === void 0 ? void 0 : targetElement.getAttribute(association);
1590
1603
  if (!(attrText === null || attrText === void 0 ? void 0 : attrText.includes(id || ''))) {
1591
1604
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.setAttribute(association, [id, attrText].filter(Boolean).join(' '));
1592
1605
  }
1593
1606
  }, [targetElement, id]);
1594
- return showTooltip || hideElementOnHidden
1607
+ return (showTooltip || hideElementOnHidden) && isBrowser()
1595
1608
  ? reactDom.createPortal(React__default.createElement("div", tslib.__assign({ id: id, className: classNames('Tooltip', "Tooltip--" + placement, className, {
1596
1609
  TooltipInfo: variant === 'info',
1597
1610
  'Tooltip--hidden': !showTooltip && hideElementOnHidden,
@@ -1909,10 +1922,11 @@ var Pointout = /** @class */ (function (_super) {
1909
1922
  var _this = this;
1910
1923
  var _c;
1911
1924
  var _d = this.state, show = _d.show, style = _d.style, offscreenContentFocus = _d.offscreenContentFocus, headingId = _d.headingId;
1912
- 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;
1913
- 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()) {
1914
1927
  return null;
1915
1928
  }
1929
+ var portal = this.props.portal || document.body;
1916
1930
  var FTPO = (React__default.createElement("div", { className: classNames(className, 'Pointout', (_a = {
1917
1931
  'Pointout--no-arrow': noArrow,
1918
1932
  'Pointout--auto': !!target
@@ -2009,6 +2023,9 @@ var Pointout = /** @class */ (function (_super) {
2009
2023
  */
2010
2024
  var queryAll = function (selector, context) {
2011
2025
  if (context === void 0) { context = document; }
2026
+ if (!isBrowser()) {
2027
+ return [];
2028
+ }
2012
2029
  return Array.prototype.slice.call(context.querySelectorAll(selector));
2013
2030
  };
2014
2031
 
@@ -2018,7 +2035,7 @@ var queryAll = function (selector, context) {
2018
2035
  var typeMap = {
2019
2036
  confirmation: {
2020
2037
  className: 'success',
2021
- icon: 'info-circle'
2038
+ icon: 'check-circle'
2022
2039
  },
2023
2040
  caution: {
2024
2041
  className: 'warning',
@@ -2192,7 +2209,8 @@ var Link = function (_a) {
2192
2209
  var children = _a.children, linkRef = _a.linkRef, className = _a.className, variant = _a.variant, other = tslib.__rest(_a, ["children", "linkRef", "className", "variant"]);
2193
2210
  return (React__default.createElement("a", tslib.__assign({ ref: linkRef, className: classNames(className, {
2194
2211
  Link: !variant,
2195
- 'Button--primary': variant === 'button'
2212
+ 'Button--primary': variant === 'button',
2213
+ 'Button--secondary': variant === 'button-secondary'
2196
2214
  }) }, other), children));
2197
2215
  };
2198
2216
  Link.propTypes = {
@@ -2326,7 +2344,7 @@ var RadioGroup = function (_a) {
2326
2344
  setCurrentValue(value);
2327
2345
  }, [value]);
2328
2346
  var radioButtons = radios.map(function (radio, index) {
2329
- 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"]);
2330
2348
  var isChecked = currentValue === radioValue;
2331
2349
  var isFocused = focusIndex === index;
2332
2350
  return (React__default.createElement("div", { className: classNames('Radio is--flex-row', className), key: id },
@@ -2339,14 +2357,17 @@ var RadioGroup = function (_a) {
2339
2357
  var _a;
2340
2358
  handleChange(radioValue);
2341
2359
  onChange(radio, (_a = inputs.current) === null || _a === void 0 ? void 0 : _a[index]);
2342
- }, disabled: disabled, checked: isChecked }, other)),
2360
+ }, disabled: disabled, checked: isChecked, "aria-describedby": labelDescription && id + "Desc" }, other)),
2343
2361
  React__default.createElement("label", { htmlFor: id, className: classNames('Field__label', {
2344
2362
  'Field__label--disabled': disabled
2345
2363
  }) }, label),
2346
2364
  React__default.createElement(Icon, { className: classNames('Radio__overlay', {
2347
2365
  'Radio__overlay--focused': isFocused,
2348
2366
  'Radio__overlay--disabled': disabled
2349
- }), 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))));
2350
2371
  });
2351
2372
  // reset the input refs array
2352
2373
  // refs get clobbered every re-render anyway and this supports "dynamic" radios
@@ -2359,7 +2380,8 @@ RadioGroup.propTypes = {
2359
2380
  radios: PropTypes.arrayOf(PropTypes.shape({
2360
2381
  value: PropTypes.string.isRequired,
2361
2382
  id: PropTypes.string.isRequired,
2362
- label: PropTypes.string.isRequired
2383
+ label: PropTypes.string.isRequired,
2384
+ labelDescription: PropTypes.string
2363
2385
  })).isRequired,
2364
2386
  hasLabel: function (props, propName, componentName) {
2365
2387
  if (!props['aria-label'] && !props['aria-labelledby']) {
@@ -2373,7 +2395,7 @@ RadioGroup.propTypes = {
2373
2395
  RadioGroup.displayName = 'RadioGroup';
2374
2396
 
2375
2397
  var Checkbox = React.forwardRef(function (_a, ref) {
2376
- 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"]);
2377
2399
  var _d = tslib.__read(React.useState(checked), 2), isChecked = _d[0], setIsChecked = _d[1];
2378
2400
  var _e = tslib.__read(React.useState(false), 2), focused = _e[0], setFocused = _e[1];
2379
2401
  var checkRef = React.useRef(null);
@@ -2384,10 +2406,19 @@ var Checkbox = React.forwardRef(function (_a, ref) {
2384
2406
  if (typeof refProp === 'function') {
2385
2407
  refProp(checkRef.current);
2386
2408
  }
2387
- var errorId = React.useMemo(function () { return nextId__default(); }, []);
2388
- var ariaDescribedbyId = error
2389
- ? tokenList(errorId, ariaDescribedby)
2390
- : 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
+ }
2391
2422
  return (React__default.createElement(React__default.Fragment, null,
2392
2423
  React__default.createElement("div", { className: classNames('Checkbox is--flex-row', className) },
2393
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) {
@@ -2411,8 +2442,9 @@ var Checkbox = React.forwardRef(function (_a, ref) {
2411
2442
  else {
2412
2443
  (_b = checkRef.current) === null || _b === void 0 ? void 0 : _b.click();
2413
2444
  }
2414
- } })),
2415
- 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)))));
2416
2448
  });
2417
2449
  Checkbox.displayName = 'Checkbox';
2418
2450
 
@@ -7966,22 +7998,39 @@ function AxeLoader() {
7966
7998
  }
7967
7999
 
7968
8000
  var LoaderOverlay = React__default.forwardRef(function (_a, ref) {
7969
- 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]);
7970
8017
  return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader__overlay', className, variant === 'large'
7971
8018
  ? 'Loader__overlay--large'
7972
8019
  : variant === 'small'
7973
8020
  ? 'Loader__overlay--small'
7974
- : ''), ref: ref }, other),
8021
+ : ''), ref: overlayRef, tabIndex: -1 }, other),
7975
8022
  React__default.createElement("div", { className: "Loader__overlay__loader" },
7976
8023
  React__default.createElement(Loader, { variant: variant }),
7977
8024
  React__default.createElement(AxeLoader, null)),
7978
8025
  label ? React__default.createElement("span", { className: "Loader__overlay__label" }, label) : null,
7979
- other.children));
8026
+ children));
7980
8027
  });
7981
8028
  LoaderOverlay.propTypes = {
7982
8029
  className: PropTypes.string,
7983
8030
  variant: PropTypes.oneOf(['large', 'small']),
7984
- label: PropTypes.string
8031
+ label: PropTypes.string,
8032
+ focusOnInitialRender: PropTypes.bool,
8033
+ children: PropTypes.node
7985
8034
  };
7986
8035
  LoaderOverlay.displayName = 'LoaderOverlay';
7987
8036
 
@@ -8054,12 +8103,19 @@ TableHead.propTypes = {
8054
8103
  };
8055
8104
 
8056
8105
  var TableHeader = function (_a) {
8057
- var children = _a.children, className = _a.className, other = tslib.__rest(_a, ["children", "className"]);
8058
- return (React__default.createElement("th", tslib.__assign({ className: classNames('TableHeader', className) }, other), children));
8106
+ var children = _a.children, sortDirection = _a.sortDirection, onSort = _a.onSort, className = _a.className, other = tslib.__rest(_a, ["children", "sortDirection", "onSort", "className"]);
8107
+ return (React__default.createElement("th", tslib.__assign({ "aria-sort": sortDirection, className: classNames('TableHeader', className, {
8108
+ 'TableHeader--sort-ascending': sortDirection === 'ascending',
8109
+ 'TableHeader--sort-descending': sortDirection === 'descending'
8110
+ }) }, other), !!onSort && !!sortDirection ? (React__default.createElement("button", { onClick: onSort, className: "TableHeader__sort-button", type: "button" },
8111
+ children,
8112
+ React__default.createElement("span", { "aria-hidden": "true" }, sortDirection === 'none' ? (React__default.createElement(Icon, { type: "sort-triangle" })) : sortDirection === 'ascending' ? (React__default.createElement(Icon, { type: "triangle-up" })) : (React__default.createElement(Icon, { type: "triangle-down" }))))) : (children)));
8059
8113
  };
8060
8114
  TableHeader.displayName = 'TableHeader';
8061
8115
  TableHeader.propTypes = {
8062
8116
  children: PropTypes.node.isRequired,
8117
+ sortDirection: PropTypes.string,
8118
+ onSort: PropTypes.func,
8063
8119
  className: PropTypes.string
8064
8120
  };
8065
8121
 
@@ -8250,23 +8306,34 @@ var DescriptionDetails = function (_a) {
8250
8306
  DescriptionDetails.displayName = 'DescriptionDetails';
8251
8307
  DescriptionDetails.propTypes = commonPropTypes;
8252
8308
 
8253
- var isTooltip = function (props) {
8309
+ var isTooltipProps = function (props) {
8254
8310
  return !!props.tooltip;
8255
8311
  };
8256
8312
  var Step = function (props) {
8257
- var status = props.status, className = props.className, other = tslib.__rest(props, ["status", "className"]);
8258
- 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),
8259
8326
  React__default.createElement("div", { className: "Stepper__step-line" }),
8260
- 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,
8261
8328
  // the pseudo content (ex: "1") is conveyed
8262
8329
  // by the list item's position in the set of
8263
8330
  // list items, therefore it is safe to clobber
8264
8331
  // it with the contents of the tooltip in the
8265
8332
  // tab stop's accessible name.
8266
- association: "aria-labelledby", "aria-label": isTooltip(props) ? props.tooltipText : undefined },
8333
+ association: "aria-labelledby", "aria-label": tooltipText },
8267
8334
  React__default.createElement("div", { className: "Stepper__step-indicator" }))) : (React__default.createElement(React__default.Fragment, null,
8268
8335
  React__default.createElement("div", { className: "Stepper__step-indicator" }),
8269
- '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)))));
8270
8337
  };
8271
8338
  Step.displayName = 'Step';
8272
8339
  Step.propTypes = {
@@ -8288,22 +8355,32 @@ Stepper.propTypes = {
8288
8355
  var Panel = function (_a) {
8289
8356
  var _b;
8290
8357
  var children = _a.children, collapsed = _a.collapsed, className = _a.className, heading = _a.heading, other = tslib.__rest(_a, ["children", "collapsed", "className", "heading"]);
8291
- var Heading = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
8292
- ? heading.level
8293
- : 2);
8294
- 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
+ };
8295
8374
  return (React__default.createElement("section", tslib.__assign({ "aria-labelledby": headingId, className: classNames('Panel', className, (_b = {},
8296
8375
  _b['Panel--collapsed'] = collapsed,
8297
8376
  _b)) }, other),
8298
- React__default.createElement(Heading, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
8299
- ? heading.text
8300
- : heading),
8377
+ React__default.createElement(Heading, null),
8301
8378
  children));
8302
8379
  };
8303
8380
  Panel.displayName = 'Panel';
8304
8381
  Panel.propTypes = {
8305
8382
  children: PropTypes.node.isRequired,
8306
- heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]).isRequired,
8383
+ heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]),
8307
8384
  className: PropTypes.string
8308
8385
  };
8309
8386
 
@@ -8377,7 +8454,7 @@ var Pagination = React__default.forwardRef(function (_a, ref) {
8377
8454
  React__default.createElement("span", { role: "log", "aria-atomic": "true" }, statusLabel || (React__default.createElement("span", null,
8378
8455
  "Showing ",
8379
8456
  React__default.createElement("strong", null, itemStart),
8380
- " of",
8457
+ " to",
8381
8458
  ' ',
8382
8459
  React__default.createElement("strong", null, itemEnd),
8383
8460
  " of ",
@@ -8446,6 +8523,172 @@ var BreadcrumbLink = React.forwardRef(function (_a, ref) {
8446
8523
  return (React__default.createElement(ElementType, tslib.__assign({ className: classNames('Link', 'Breadcrumb__Link', className), ref: ref }, props), children));
8447
8524
  });
8448
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
+
8449
8692
  var LIGHT_THEME_CLASS = 'cauldron--theme-light';
8450
8693
  var DARK_THEME_CLASS = 'cauldron--theme-dark';
8451
8694
  var ThemeContext = React.createContext({});
@@ -8523,6 +8766,11 @@ exports.CardHeader = CardHeader;
8523
8766
  exports.Checkbox = Checkbox;
8524
8767
  exports.ClickOutsideListener = ClickOutsideListener;
8525
8768
  exports.Code = Code;
8769
+ exports.ColumnGroupHeader = ColumnGroupHeader;
8770
+ exports.ColumnHeader = ColumnHeader;
8771
+ exports.ColumnLeft = ColumnLeft;
8772
+ exports.ColumnList = ColumnList;
8773
+ exports.ColumnRight = ColumnRight;
8526
8774
  exports.DescriptionDetails = DescriptionDetails;
8527
8775
  exports.DescriptionList = DescriptionList;
8528
8776
  exports.DescriptionListItem = DescriptionListItem;
@@ -8591,6 +8839,7 @@ exports.TopBar = TopBar$1;
8591
8839
  exports.TopBarItem = MenuItem;
8592
8840
  exports.TopBarMenu = TopBarMenu;
8593
8841
  exports.TopBarTrigger = TopBarTrigger;
8842
+ exports.TwoColumnPanel = TwoColumnPanel;
8594
8843
  exports.Workspace = Workspace;
8595
8844
  exports.focusableSelector = focusableSelector;
8596
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,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 SvgSortTriangle = 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: "M17.13 13.54a.634.634 0 0 0-.47-.2H7.34c-.36 0-.66.29-.67.65 0 .18.07.35.2.48l4.66 4.66c.25.26.66.27.92.02l.02-.02 4.66-4.66c.26-.25.28-.65.03-.91-.01-.02-.02-.02-.03-.02zm0-4-4.66-4.66a.649.649 0 0 0-.92-.02l-.02.02-4.66 4.66c-.25.27-.24.69.03.95.12.11.28.18.44.18h9.33c.36 0 .66-.3.66-.66a.72.72 0 0 0-.2-.47z",
20
+ fill: "currentColor",
21
+ vectorEffect: "non-scaling-stroke"
22
+ })));
23
+
24
+ exports.default = SvgSortTriangle;
@@ -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",
3
+ "version": "4.1.0-canary.1d6f49de",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,9 +22,8 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@popperjs/core": "^2.5.4",
25
- "@rollup/plugin-dynamic-import-vars": "^1.4.2",
26
25
  "classnames": "^2.2.6",
27
- "focus-trap-react": "^3.0.5",
26
+ "focus-trap-react": "^8.9.0",
28
27
  "focusable": "^2.3.0",
29
28
  "keyname": "^0.1.0",
30
29
  "prop-types": "^15.6.0",
@@ -44,6 +43,7 @@
44
43
  "@babel/preset-typescript": "^7.9.0",
45
44
  "@babel/register": "^7.9.0",
46
45
  "@rollup/plugin-commonjs": "^14.0.0",
46
+ "@rollup/plugin-dynamic-import-vars": "^1.4.2",
47
47
  "@rollup/plugin-typescript": "^5.0.2",
48
48
  "@svgr/rollup": "^6.1.2",
49
49
  "@types/classnames": "^2.2.10",
@@ -124,4 +124,4 @@
124
124
  "\\.svg$": "<rootDir>/__tests__/svgMock.js"
125
125
  }
126
126
  }
127
- }
127
+ }