@deque/cauldron-react 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/lib/cauldron.css +2 -1
- package/lib/components/ClickOutsideListener/index.d.ts +6 -4
- package/lib/components/Link/index.d.ts +1 -1
- package/lib/components/LoaderOverlay/index.d.ts +2 -0
- package/lib/components/Panel/index.d.ts +2 -2
- package/lib/components/Stepper/index.d.ts +1 -2
- package/lib/components/Tooltip/index.d.ts +1 -1
- package/lib/components/TwoColumnPanel/ColumnGroupHeader.d.ts +5 -0
- package/lib/components/TwoColumnPanel/ColumnHeader.d.ts +5 -0
- package/lib/components/TwoColumnPanel/ColumnLeft.d.ts +7 -0
- package/lib/components/TwoColumnPanel/ColumnList.d.ts +5 -0
- package/lib/components/TwoColumnPanel/ColumnRight.d.ts +7 -0
- package/lib/components/TwoColumnPanel/TwoColumnPanel.d.ts +8 -0
- package/lib/components/TwoColumnPanel/index.d.ts +6 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +314 -90
- package/lib/utils/is-browser/index.d.ts +1 -0
- package/package.json +2 -2
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
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
export interface ClickOutsideListenerProps {
|
|
4
|
-
children
|
|
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.
|
|
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,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
|
|
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.
|
|
18
|
+
heading: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
19
19
|
className: PropTypes.Requireable<string>;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
@@ -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:
|
|
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,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,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
|
@@ -446,7 +446,18 @@ var MenuItem = /** @class */ (function (_super) {
|
|
|
446
446
|
|
|
447
447
|
var MENU_BREAKPOINT = 1024;
|
|
448
448
|
|
|
449
|
-
|
|
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
|
+
};
|
|
450
461
|
|
|
451
462
|
var TopBar = /** @class */ (function (_super) {
|
|
452
463
|
tslib.__extends(TopBar, _super);
|
|
@@ -608,12 +619,13 @@ var ClickOutsideListener = /** @class */ (function (_super) {
|
|
|
608
619
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
609
620
|
_this.handleEvent = function (event) {
|
|
610
621
|
var _a = _this, nodeRef = _a.nodeRef, props = _a.props;
|
|
611
|
-
var onClickOutside = props.onClickOutside;
|
|
622
|
+
var onClickOutside = props.onClickOutside, target = props.target;
|
|
612
623
|
if (event.defaultPrevented) {
|
|
613
624
|
return;
|
|
614
625
|
}
|
|
615
|
-
var
|
|
616
|
-
if (
|
|
626
|
+
var eventTarget = event.target;
|
|
627
|
+
if ((target && !target.contains(eventTarget)) ||
|
|
628
|
+
(nodeRef && !nodeRef.contains(eventTarget))) {
|
|
617
629
|
onClickOutside(event);
|
|
618
630
|
}
|
|
619
631
|
};
|
|
@@ -656,16 +668,19 @@ var ClickOutsideListener = /** @class */ (function (_super) {
|
|
|
656
668
|
};
|
|
657
669
|
ClickOutsideListener.prototype.render = function () {
|
|
658
670
|
var _a = this, props = _a.props, resolveRef = _a.resolveRef;
|
|
659
|
-
return
|
|
660
|
-
|
|
661
|
-
|
|
671
|
+
return !props.children
|
|
672
|
+
? null
|
|
673
|
+
: React__default.cloneElement(props.children, {
|
|
674
|
+
ref: resolveRef
|
|
675
|
+
});
|
|
662
676
|
};
|
|
663
677
|
ClickOutsideListener.defaultProps = {
|
|
664
678
|
mouseEvent: 'click',
|
|
665
679
|
touchEvent: 'touchend'
|
|
666
680
|
};
|
|
667
681
|
ClickOutsideListener.propTypes = {
|
|
668
|
-
children: PropTypes.node
|
|
682
|
+
children: PropTypes.node,
|
|
683
|
+
target: PropTypes.any,
|
|
669
684
|
onClickOutside: PropTypes.func.isRequired,
|
|
670
685
|
mouseEvent: PropTypes.oneOf(['mousedown', 'click', 'mouseup', false]),
|
|
671
686
|
touchEvent: PropTypes.oneOf(['touchstart', 'touchend', false])
|
|
@@ -1278,10 +1293,11 @@ var Dialog = /** @class */ (function (_super) {
|
|
|
1278
1293
|
};
|
|
1279
1294
|
Dialog.prototype.render = function () {
|
|
1280
1295
|
var _this = this;
|
|
1281
|
-
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,
|
|
1282
|
-
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()) {
|
|
1283
1298
|
return null;
|
|
1284
1299
|
}
|
|
1300
|
+
var portal = this.props.portal || document.body;
|
|
1285
1301
|
var close = !forceAction ? (React__default.createElement("button", { className: "Dialog__close", type: "button", onClick: this.close },
|
|
1286
1302
|
React__default.createElement(Icon, { type: "close", "aria-hidden": "true" }),
|
|
1287
1303
|
React__default.createElement(Offscreen, null, closeButtonText))) : null;
|
|
@@ -1409,6 +1425,9 @@ var SkipLink = /** @class */ (function (_super) {
|
|
|
1409
1425
|
React__default.createElement("span", { className: "SkipLink__item--second" }, targetText))));
|
|
1410
1426
|
};
|
|
1411
1427
|
SkipLink.prototype.onClick = function () {
|
|
1428
|
+
if (!isBrowser()) {
|
|
1429
|
+
return;
|
|
1430
|
+
}
|
|
1412
1431
|
var element = document.querySelector(this.props.target);
|
|
1413
1432
|
if (element) {
|
|
1414
1433
|
element.tabIndex = -1;
|
|
@@ -1475,15 +1494,14 @@ var fireCustomEvent = function (show, button) {
|
|
|
1475
1494
|
};
|
|
1476
1495
|
function Tooltip(_a) {
|
|
1477
1496
|
var _this = this;
|
|
1478
|
-
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,
|
|
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"]);
|
|
1479
1498
|
var _g = tslib.__read(propId ? [propId] : nextId.useId(1, 'tooltip'), 1), id = _g[0];
|
|
1480
|
-
var
|
|
1481
|
-
var _h = tslib.__read(React.useState(
|
|
1482
|
-
var _j = tslib.__read(React.useState(
|
|
1483
|
-
var _k = tslib.__read(React.useState(null), 2),
|
|
1484
|
-
var _l = tslib.__read(React.useState(null), 2),
|
|
1485
|
-
var _m =
|
|
1486
|
-
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, {
|
|
1487
1505
|
placement: initialPlacement,
|
|
1488
1506
|
modifiers: [
|
|
1489
1507
|
{ name: 'preventOverflow', options: { padding: 8 } },
|
|
@@ -1491,11 +1509,17 @@ function Tooltip(_a) {
|
|
|
1491
1509
|
{ name: 'offset', options: { offset: [0, 8] } },
|
|
1492
1510
|
{ name: 'arrow', options: { padding: 5, element: arrowElement } }
|
|
1493
1511
|
]
|
|
1494
|
-
}), styles =
|
|
1495
|
-
|
|
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 () {
|
|
1496
1515
|
return tslib.__generator(this, function (_a) {
|
|
1497
1516
|
switch (_a.label) {
|
|
1498
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
|
+
}
|
|
1499
1523
|
if (!update) return [3 /*break*/, 2];
|
|
1500
1524
|
return [4 /*yield*/, update()];
|
|
1501
1525
|
case 1:
|
|
@@ -1507,45 +1531,31 @@ function Tooltip(_a) {
|
|
|
1507
1531
|
return [2 /*return*/];
|
|
1508
1532
|
}
|
|
1509
1533
|
});
|
|
1510
|
-
}); }
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
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);
|
|
1519
1546
|
}, TIP_HIDE_DELAY);
|
|
1520
1547
|
}
|
|
1521
|
-
};
|
|
1522
|
-
|
|
1523
|
-
hovering.current = true;
|
|
1524
|
-
show();
|
|
1525
|
-
};
|
|
1526
|
-
var handleTriggerMouseLeave = function (e) {
|
|
1527
|
-
hovering.current = false;
|
|
1528
|
-
hide(e);
|
|
1529
|
-
};
|
|
1530
|
-
var handleTipMouseEnter = function () {
|
|
1531
|
-
hovering.current = true;
|
|
1532
|
-
};
|
|
1533
|
-
var handleTipMouseLeave = function (e) {
|
|
1534
|
-
hovering.current = false;
|
|
1535
|
-
hide(e);
|
|
1536
|
-
};
|
|
1548
|
+
}, [targetElement]);
|
|
1549
|
+
// Keep targetElement in sync with target prop
|
|
1537
1550
|
React.useEffect(function () {
|
|
1538
1551
|
var targetElement = target && 'current' in target ? target.current : target;
|
|
1539
1552
|
setTargetElement(targetElement);
|
|
1540
1553
|
}, [target]);
|
|
1541
|
-
|
|
1554
|
+
// Get popper placement
|
|
1555
|
+
var placement = (attributes.popper &&
|
|
1542
1556
|
attributes.popper['data-popper-placement']) ||
|
|
1543
1557
|
initialPlacement;
|
|
1544
|
-
|
|
1545
|
-
if (popperPlacement) {
|
|
1546
|
-
setPlacement(popperPlacement);
|
|
1547
|
-
}
|
|
1548
|
-
}, [popperPlacement]);
|
|
1558
|
+
// Only listen to key ups when the tooltip is visible
|
|
1549
1559
|
React.useEffect(function () {
|
|
1550
1560
|
var handleEscape = function (event) {
|
|
1551
1561
|
if (event.key === 'Escape' ||
|
|
@@ -1564,38 +1574,37 @@ function Tooltip(_a) {
|
|
|
1564
1574
|
return function () {
|
|
1565
1575
|
targetElement.removeEventListener('keyup', handleEscape);
|
|
1566
1576
|
};
|
|
1567
|
-
}, [
|
|
1577
|
+
}, [showTooltip]);
|
|
1578
|
+
// Handle hover and focus events for the targetElement
|
|
1568
1579
|
React.useEffect(function () {
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusout', hide);
|
|
1574
|
-
}
|
|
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);
|
|
1575
1584
|
return function () {
|
|
1576
1585
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseenter', show);
|
|
1577
1586
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseleave', hide);
|
|
1578
1587
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusin', show);
|
|
1579
1588
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusout', hide);
|
|
1580
1589
|
};
|
|
1581
|
-
}, [targetElement,
|
|
1590
|
+
}, [targetElement, show, hide]);
|
|
1591
|
+
// Handle hover events for the tooltipElement
|
|
1582
1592
|
React.useEffect(function () {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', handleTipMouseLeave);
|
|
1586
|
-
}
|
|
1593
|
+
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseenter', show);
|
|
1594
|
+
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', hide);
|
|
1587
1595
|
return function () {
|
|
1588
|
-
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter',
|
|
1589
|
-
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseleave',
|
|
1596
|
+
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter', show);
|
|
1597
|
+
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseleave', hide);
|
|
1590
1598
|
};
|
|
1591
|
-
}, [tooltipElement]);
|
|
1599
|
+
}, [tooltipElement, show, hide]);
|
|
1600
|
+
// Keep the target's id in sync
|
|
1592
1601
|
React.useEffect(function () {
|
|
1593
1602
|
var attrText = targetElement === null || targetElement === void 0 ? void 0 : targetElement.getAttribute(association);
|
|
1594
1603
|
if (!(attrText === null || attrText === void 0 ? void 0 : attrText.includes(id || ''))) {
|
|
1595
1604
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.setAttribute(association, [id, attrText].filter(Boolean).join(' '));
|
|
1596
1605
|
}
|
|
1597
1606
|
}, [targetElement, id]);
|
|
1598
|
-
return showTooltip || hideElementOnHidden
|
|
1607
|
+
return (showTooltip || hideElementOnHidden) && isBrowser()
|
|
1599
1608
|
? reactDom.createPortal(React__default.createElement("div", tslib.__assign({ id: id, className: classNames('Tooltip', "Tooltip--" + placement, className, {
|
|
1600
1609
|
TooltipInfo: variant === 'info',
|
|
1601
1610
|
'Tooltip--hidden': !showTooltip && hideElementOnHidden,
|
|
@@ -1913,10 +1922,11 @@ var Pointout = /** @class */ (function (_super) {
|
|
|
1913
1922
|
var _this = this;
|
|
1914
1923
|
var _c;
|
|
1915
1924
|
var _d = this.state, show = _d.show, style = _d.style, offscreenContentFocus = _d.offscreenContentFocus, headingId = _d.headingId;
|
|
1916
|
-
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,
|
|
1917
|
-
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()) {
|
|
1918
1927
|
return null;
|
|
1919
1928
|
}
|
|
1929
|
+
var portal = this.props.portal || document.body;
|
|
1920
1930
|
var FTPO = (React__default.createElement("div", { className: classNames(className, 'Pointout', (_a = {
|
|
1921
1931
|
'Pointout--no-arrow': noArrow,
|
|
1922
1932
|
'Pointout--auto': !!target
|
|
@@ -2013,6 +2023,9 @@ var Pointout = /** @class */ (function (_super) {
|
|
|
2013
2023
|
*/
|
|
2014
2024
|
var queryAll = function (selector, context) {
|
|
2015
2025
|
if (context === void 0) { context = document; }
|
|
2026
|
+
if (!isBrowser()) {
|
|
2027
|
+
return [];
|
|
2028
|
+
}
|
|
2016
2029
|
return Array.prototype.slice.call(context.querySelectorAll(selector));
|
|
2017
2030
|
};
|
|
2018
2031
|
|
|
@@ -2022,7 +2035,7 @@ var queryAll = function (selector, context) {
|
|
|
2022
2035
|
var typeMap = {
|
|
2023
2036
|
confirmation: {
|
|
2024
2037
|
className: 'success',
|
|
2025
|
-
icon: '
|
|
2038
|
+
icon: 'check-circle'
|
|
2026
2039
|
},
|
|
2027
2040
|
caution: {
|
|
2028
2041
|
className: 'warning',
|
|
@@ -2196,7 +2209,8 @@ var Link = function (_a) {
|
|
|
2196
2209
|
var children = _a.children, linkRef = _a.linkRef, className = _a.className, variant = _a.variant, other = tslib.__rest(_a, ["children", "linkRef", "className", "variant"]);
|
|
2197
2210
|
return (React__default.createElement("a", tslib.__assign({ ref: linkRef, className: classNames(className, {
|
|
2198
2211
|
Link: !variant,
|
|
2199
|
-
'Button--primary': variant === 'button'
|
|
2212
|
+
'Button--primary': variant === 'button',
|
|
2213
|
+
'Button--secondary': variant === 'button-secondary'
|
|
2200
2214
|
}) }, other), children));
|
|
2201
2215
|
};
|
|
2202
2216
|
Link.propTypes = {
|
|
@@ -7984,22 +7998,39 @@ function AxeLoader() {
|
|
|
7984
7998
|
}
|
|
7985
7999
|
|
|
7986
8000
|
var LoaderOverlay = React__default.forwardRef(function (_a, ref) {
|
|
7987
|
-
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]);
|
|
7988
8017
|
return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader__overlay', className, variant === 'large'
|
|
7989
8018
|
? 'Loader__overlay--large'
|
|
7990
8019
|
: variant === 'small'
|
|
7991
8020
|
? 'Loader__overlay--small'
|
|
7992
|
-
: ''), ref:
|
|
8021
|
+
: ''), ref: overlayRef, tabIndex: -1 }, other),
|
|
7993
8022
|
React__default.createElement("div", { className: "Loader__overlay__loader" },
|
|
7994
8023
|
React__default.createElement(Loader, { variant: variant }),
|
|
7995
8024
|
React__default.createElement(AxeLoader, null)),
|
|
7996
8025
|
label ? React__default.createElement("span", { className: "Loader__overlay__label" }, label) : null,
|
|
7997
|
-
|
|
8026
|
+
children));
|
|
7998
8027
|
});
|
|
7999
8028
|
LoaderOverlay.propTypes = {
|
|
8000
8029
|
className: PropTypes.string,
|
|
8001
8030
|
variant: PropTypes.oneOf(['large', 'small']),
|
|
8002
|
-
label: PropTypes.string
|
|
8031
|
+
label: PropTypes.string,
|
|
8032
|
+
focusOnInitialRender: PropTypes.bool,
|
|
8033
|
+
children: PropTypes.node
|
|
8003
8034
|
};
|
|
8004
8035
|
LoaderOverlay.displayName = 'LoaderOverlay';
|
|
8005
8036
|
|
|
@@ -8275,23 +8306,34 @@ var DescriptionDetails = function (_a) {
|
|
|
8275
8306
|
DescriptionDetails.displayName = 'DescriptionDetails';
|
|
8276
8307
|
DescriptionDetails.propTypes = commonPropTypes;
|
|
8277
8308
|
|
|
8278
|
-
var
|
|
8309
|
+
var isTooltipProps = function (props) {
|
|
8279
8310
|
return !!props.tooltip;
|
|
8280
8311
|
};
|
|
8281
8312
|
var Step = function (props) {
|
|
8282
|
-
var
|
|
8283
|
-
|
|
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),
|
|
8284
8326
|
React__default.createElement("div", { className: "Stepper__step-line" }),
|
|
8285
|
-
React__default.createElement("div", { className: "Stepper__step-content" }, isTooltip
|
|
8327
|
+
React__default.createElement("div", { className: "Stepper__step-content" }, isTooltip ? (React__default.createElement(TooltipTabstop, { placement: "bottom", tooltip: tooltip,
|
|
8286
8328
|
// the pseudo content (ex: "1") is conveyed
|
|
8287
8329
|
// by the list item's position in the set of
|
|
8288
8330
|
// list items, therefore it is safe to clobber
|
|
8289
8331
|
// it with the contents of the tooltip in the
|
|
8290
8332
|
// tab stop's accessible name.
|
|
8291
|
-
association: "aria-labelledby", "aria-label":
|
|
8333
|
+
association: "aria-labelledby", "aria-label": tooltipText },
|
|
8292
8334
|
React__default.createElement("div", { className: "Stepper__step-indicator" }))) : (React__default.createElement(React__default.Fragment, null,
|
|
8293
8335
|
React__default.createElement("div", { className: "Stepper__step-indicator" }),
|
|
8294
|
-
|
|
8336
|
+
children ? (React__default.createElement("div", { className: "Stepper__step-label" }, children)) : null)))));
|
|
8295
8337
|
};
|
|
8296
8338
|
Step.displayName = 'Step';
|
|
8297
8339
|
Step.propTypes = {
|
|
@@ -8313,22 +8355,32 @@ Stepper.propTypes = {
|
|
|
8313
8355
|
var Panel = function (_a) {
|
|
8314
8356
|
var _b;
|
|
8315
8357
|
var children = _a.children, collapsed = _a.collapsed, className = _a.className, heading = _a.heading, other = tslib.__rest(_a, ["children", "collapsed", "className", "heading"]);
|
|
8316
|
-
var
|
|
8317
|
-
?
|
|
8318
|
-
:
|
|
8319
|
-
|
|
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
|
+
};
|
|
8320
8374
|
return (React__default.createElement("section", tslib.__assign({ "aria-labelledby": headingId, className: classNames('Panel', className, (_b = {},
|
|
8321
8375
|
_b['Panel--collapsed'] = collapsed,
|
|
8322
8376
|
_b)) }, other),
|
|
8323
|
-
React__default.createElement(Heading,
|
|
8324
|
-
? heading.text
|
|
8325
|
-
: heading),
|
|
8377
|
+
React__default.createElement(Heading, null),
|
|
8326
8378
|
children));
|
|
8327
8379
|
};
|
|
8328
8380
|
Panel.displayName = 'Panel';
|
|
8329
8381
|
Panel.propTypes = {
|
|
8330
8382
|
children: PropTypes.node.isRequired,
|
|
8331
|
-
heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node])
|
|
8383
|
+
heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]),
|
|
8332
8384
|
className: PropTypes.string
|
|
8333
8385
|
};
|
|
8334
8386
|
|
|
@@ -8402,7 +8454,7 @@ var Pagination = React__default.forwardRef(function (_a, ref) {
|
|
|
8402
8454
|
React__default.createElement("span", { role: "log", "aria-atomic": "true" }, statusLabel || (React__default.createElement("span", null,
|
|
8403
8455
|
"Showing ",
|
|
8404
8456
|
React__default.createElement("strong", null, itemStart),
|
|
8405
|
-
"
|
|
8457
|
+
" to",
|
|
8406
8458
|
' ',
|
|
8407
8459
|
React__default.createElement("strong", null, itemEnd),
|
|
8408
8460
|
" of ",
|
|
@@ -8471,6 +8523,172 @@ var BreadcrumbLink = React.forwardRef(function (_a, ref) {
|
|
|
8471
8523
|
return (React__default.createElement(ElementType, tslib.__assign({ className: classNames('Link', 'Breadcrumb__Link', className), ref: ref }, props), children));
|
|
8472
8524
|
});
|
|
8473
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
|
+
|
|
8474
8692
|
var LIGHT_THEME_CLASS = 'cauldron--theme-light';
|
|
8475
8693
|
var DARK_THEME_CLASS = 'cauldron--theme-dark';
|
|
8476
8694
|
var ThemeContext = React.createContext({});
|
|
@@ -8548,6 +8766,11 @@ exports.CardHeader = CardHeader;
|
|
|
8548
8766
|
exports.Checkbox = Checkbox;
|
|
8549
8767
|
exports.ClickOutsideListener = ClickOutsideListener;
|
|
8550
8768
|
exports.Code = Code;
|
|
8769
|
+
exports.ColumnGroupHeader = ColumnGroupHeader;
|
|
8770
|
+
exports.ColumnHeader = ColumnHeader;
|
|
8771
|
+
exports.ColumnLeft = ColumnLeft;
|
|
8772
|
+
exports.ColumnList = ColumnList;
|
|
8773
|
+
exports.ColumnRight = ColumnRight;
|
|
8551
8774
|
exports.DescriptionDetails = DescriptionDetails;
|
|
8552
8775
|
exports.DescriptionList = DescriptionList;
|
|
8553
8776
|
exports.DescriptionListItem = DescriptionListItem;
|
|
@@ -8616,6 +8839,7 @@ exports.TopBar = TopBar$1;
|
|
|
8616
8839
|
exports.TopBarItem = MenuItem;
|
|
8617
8840
|
exports.TopBarMenu = TopBarMenu;
|
|
8618
8841
|
exports.TopBarTrigger = TopBarTrigger;
|
|
8842
|
+
exports.TwoColumnPanel = TwoColumnPanel;
|
|
8619
8843
|
exports.Workspace = Workspace;
|
|
8620
8844
|
exports.focusableSelector = focusableSelector;
|
|
8621
8845
|
exports.iconTypes = iconTypes;
|
|
@@ -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.
|
|
3
|
+
"version": "4.2.0",
|
|
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": "^
|
|
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",
|