@deque/cauldron-react 4.1.0 → 4.2.0-canary.abded4e2
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/Icon/types.d.ts +1 -1
- 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 +316 -90
- package/lib/minus.js +25 -0
- package/lib/utils/is-browser/index.d.ts +1 -0
- package/package.json +3 -3
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,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' | 'resend' | 'robot' | 'run-again' | 'save' | 'share' | 'sort-triangle' | 'sort' | 'star' | 'sun' | 'tag' | 'target' | 'trash' | 'triangle-up' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'upload';
|
|
5
|
+
export declare type IconType = 'add-user' | 'arrow-circle-up' | 'arrow-circle-down' | 'arrow-circle-left' | 'arrow-circle-right' | 'arrow-up' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrows-alt' | 'bolt' | 'caution' | 'check-circle' | 'check-shield' | 'check-solid' | 'check' | 'checkbox-checked' | 'checkbox-unchecked' | 'chevron-double-up' | 'chevron-double-down' | 'chevron-double-left' | 'chevron-double-right' | 'chevron-up' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'close' | 'code' | 'copy' | 'download' | 'exchange' | 'external-link' | 'eye' | 'filter' | 'flag' | 'gears' | 'grid' | 'hamburger-menu' | 'highlight' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'minus' | '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
|
|
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
|
@@ -164,6 +164,7 @@ var iconTypes = [
|
|
|
164
164
|
'lock',
|
|
165
165
|
'magnifying-glass',
|
|
166
166
|
'menu',
|
|
167
|
+
'minus',
|
|
167
168
|
'new-releases',
|
|
168
169
|
'new',
|
|
169
170
|
'no',
|
|
@@ -229,6 +230,7 @@ function __variableDynamicImportRuntime0__(path) {
|
|
|
229
230
|
case './icons/lock.svg': return Promise.resolve().then(function () { return require('./lock.js'); });
|
|
230
231
|
case './icons/magnifying-glass.svg': return Promise.resolve().then(function () { return require('./magnifying-glass.js'); });
|
|
231
232
|
case './icons/menu.svg': return Promise.resolve().then(function () { return require('./menu.js'); });
|
|
233
|
+
case './icons/minus.svg': return Promise.resolve().then(function () { return require('./minus.js'); });
|
|
232
234
|
case './icons/new-releases.svg': return Promise.resolve().then(function () { return require('./new-releases.js'); });
|
|
233
235
|
case './icons/new.svg': return Promise.resolve().then(function () { return require('./new.js'); });
|
|
234
236
|
case './icons/no.svg': return Promise.resolve().then(function () { return require('./no.js'); });
|
|
@@ -446,7 +448,18 @@ var MenuItem = /** @class */ (function (_super) {
|
|
|
446
448
|
|
|
447
449
|
var MENU_BREAKPOINT = 1024;
|
|
448
450
|
|
|
449
|
-
|
|
451
|
+
function isBrowser() {
|
|
452
|
+
return (typeof window !== 'undefined' &&
|
|
453
|
+
!!window.document &&
|
|
454
|
+
!!window.document.createElement);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
var isWide = function () {
|
|
458
|
+
if (!isBrowser()) {
|
|
459
|
+
return false;
|
|
460
|
+
}
|
|
461
|
+
return window.innerWidth >= MENU_BREAKPOINT;
|
|
462
|
+
};
|
|
450
463
|
|
|
451
464
|
var TopBar = /** @class */ (function (_super) {
|
|
452
465
|
tslib.__extends(TopBar, _super);
|
|
@@ -608,12 +621,13 @@ var ClickOutsideListener = /** @class */ (function (_super) {
|
|
|
608
621
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
609
622
|
_this.handleEvent = function (event) {
|
|
610
623
|
var _a = _this, nodeRef = _a.nodeRef, props = _a.props;
|
|
611
|
-
var onClickOutside = props.onClickOutside;
|
|
624
|
+
var onClickOutside = props.onClickOutside, target = props.target;
|
|
612
625
|
if (event.defaultPrevented) {
|
|
613
626
|
return;
|
|
614
627
|
}
|
|
615
|
-
var
|
|
616
|
-
if (
|
|
628
|
+
var eventTarget = event.target;
|
|
629
|
+
if ((target && !target.contains(eventTarget)) ||
|
|
630
|
+
(nodeRef && !nodeRef.contains(eventTarget))) {
|
|
617
631
|
onClickOutside(event);
|
|
618
632
|
}
|
|
619
633
|
};
|
|
@@ -656,16 +670,19 @@ var ClickOutsideListener = /** @class */ (function (_super) {
|
|
|
656
670
|
};
|
|
657
671
|
ClickOutsideListener.prototype.render = function () {
|
|
658
672
|
var _a = this, props = _a.props, resolveRef = _a.resolveRef;
|
|
659
|
-
return
|
|
660
|
-
|
|
661
|
-
|
|
673
|
+
return !props.children
|
|
674
|
+
? null
|
|
675
|
+
: React__default.cloneElement(props.children, {
|
|
676
|
+
ref: resolveRef
|
|
677
|
+
});
|
|
662
678
|
};
|
|
663
679
|
ClickOutsideListener.defaultProps = {
|
|
664
680
|
mouseEvent: 'click',
|
|
665
681
|
touchEvent: 'touchend'
|
|
666
682
|
};
|
|
667
683
|
ClickOutsideListener.propTypes = {
|
|
668
|
-
children: PropTypes.node
|
|
684
|
+
children: PropTypes.node,
|
|
685
|
+
target: PropTypes.any,
|
|
669
686
|
onClickOutside: PropTypes.func.isRequired,
|
|
670
687
|
mouseEvent: PropTypes.oneOf(['mousedown', 'click', 'mouseup', false]),
|
|
671
688
|
touchEvent: PropTypes.oneOf(['touchstart', 'touchend', false])
|
|
@@ -1278,10 +1295,11 @@ var Dialog = /** @class */ (function (_super) {
|
|
|
1278
1295
|
};
|
|
1279
1296
|
Dialog.prototype.render = function () {
|
|
1280
1297
|
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) {
|
|
1298
|
+
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"]);
|
|
1299
|
+
if (!show || !isBrowser()) {
|
|
1283
1300
|
return null;
|
|
1284
1301
|
}
|
|
1302
|
+
var portal = this.props.portal || document.body;
|
|
1285
1303
|
var close = !forceAction ? (React__default.createElement("button", { className: "Dialog__close", type: "button", onClick: this.close },
|
|
1286
1304
|
React__default.createElement(Icon, { type: "close", "aria-hidden": "true" }),
|
|
1287
1305
|
React__default.createElement(Offscreen, null, closeButtonText))) : null;
|
|
@@ -1409,6 +1427,9 @@ var SkipLink = /** @class */ (function (_super) {
|
|
|
1409
1427
|
React__default.createElement("span", { className: "SkipLink__item--second" }, targetText))));
|
|
1410
1428
|
};
|
|
1411
1429
|
SkipLink.prototype.onClick = function () {
|
|
1430
|
+
if (!isBrowser()) {
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1412
1433
|
var element = document.querySelector(this.props.target);
|
|
1413
1434
|
if (element) {
|
|
1414
1435
|
element.tabIndex = -1;
|
|
@@ -1475,15 +1496,14 @@ var fireCustomEvent = function (show, button) {
|
|
|
1475
1496
|
};
|
|
1476
1497
|
function Tooltip(_a) {
|
|
1477
1498
|
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,
|
|
1499
|
+
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
1500
|
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, {
|
|
1501
|
+
var hideTimeoutRef = React.useRef(null);
|
|
1502
|
+
var _h = tslib.__read(React.useState(!!initialShow), 2), showTooltip = _h[0], setShowTooltip = _h[1];
|
|
1503
|
+
var _j = tslib.__read(React.useState(null), 2), targetElement = _j[0], setTargetElement = _j[1];
|
|
1504
|
+
var _k = tslib.__read(React.useState(null), 2), tooltipElement = _k[0], setTooltipElement = _k[1];
|
|
1505
|
+
var _l = tslib.__read(React.useState(null), 2), arrowElement = _l[0], setArrowElement = _l[1];
|
|
1506
|
+
var _m = reactPopper.usePopper(targetElement, tooltipElement, {
|
|
1487
1507
|
placement: initialPlacement,
|
|
1488
1508
|
modifiers: [
|
|
1489
1509
|
{ name: 'preventOverflow', options: { padding: 8 } },
|
|
@@ -1491,11 +1511,17 @@ function Tooltip(_a) {
|
|
|
1491
1511
|
{ name: 'offset', options: { offset: [0, 8] } },
|
|
1492
1512
|
{ name: 'arrow', options: { padding: 5, element: arrowElement } }
|
|
1493
1513
|
]
|
|
1494
|
-
}), styles =
|
|
1495
|
-
|
|
1514
|
+
}), styles = _m.styles, attributes = _m.attributes, update = _m.update;
|
|
1515
|
+
// Show the tooltip
|
|
1516
|
+
var show = React.useCallback(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
1496
1517
|
return tslib.__generator(this, function (_a) {
|
|
1497
1518
|
switch (_a.label) {
|
|
1498
1519
|
case 0:
|
|
1520
|
+
// Clear the hide timeout if there was one pending
|
|
1521
|
+
if (hideTimeoutRef.current) {
|
|
1522
|
+
clearTimeout(hideTimeoutRef.current);
|
|
1523
|
+
hideTimeoutRef.current = null;
|
|
1524
|
+
}
|
|
1499
1525
|
if (!update) return [3 /*break*/, 2];
|
|
1500
1526
|
return [4 /*yield*/, update()];
|
|
1501
1527
|
case 1:
|
|
@@ -1507,45 +1533,31 @@ function Tooltip(_a) {
|
|
|
1507
1533
|
return [2 /*return*/];
|
|
1508
1534
|
}
|
|
1509
1535
|
});
|
|
1510
|
-
}); }
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1536
|
+
}); }, [
|
|
1537
|
+
targetElement,
|
|
1538
|
+
// update starts off as null
|
|
1539
|
+
update
|
|
1540
|
+
]);
|
|
1541
|
+
// Hide the tooltip
|
|
1542
|
+
var hide = React.useCallback(function () {
|
|
1543
|
+
if (!hideTimeoutRef.current) {
|
|
1544
|
+
hideTimeoutRef.current = setTimeout(function () {
|
|
1545
|
+
hideTimeoutRef.current = null;
|
|
1546
|
+
setShowTooltip(false);
|
|
1547
|
+
fireCustomEvent(false, targetElement);
|
|
1519
1548
|
}, TIP_HIDE_DELAY);
|
|
1520
1549
|
}
|
|
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
|
-
};
|
|
1550
|
+
}, [targetElement]);
|
|
1551
|
+
// Keep targetElement in sync with target prop
|
|
1537
1552
|
React.useEffect(function () {
|
|
1538
1553
|
var targetElement = target && 'current' in target ? target.current : target;
|
|
1539
1554
|
setTargetElement(targetElement);
|
|
1540
1555
|
}, [target]);
|
|
1541
|
-
|
|
1556
|
+
// Get popper placement
|
|
1557
|
+
var placement = (attributes.popper &&
|
|
1542
1558
|
attributes.popper['data-popper-placement']) ||
|
|
1543
1559
|
initialPlacement;
|
|
1544
|
-
|
|
1545
|
-
if (popperPlacement) {
|
|
1546
|
-
setPlacement(popperPlacement);
|
|
1547
|
-
}
|
|
1548
|
-
}, [popperPlacement]);
|
|
1560
|
+
// Only listen to key ups when the tooltip is visible
|
|
1549
1561
|
React.useEffect(function () {
|
|
1550
1562
|
var handleEscape = function (event) {
|
|
1551
1563
|
if (event.key === 'Escape' ||
|
|
@@ -1564,38 +1576,37 @@ function Tooltip(_a) {
|
|
|
1564
1576
|
return function () {
|
|
1565
1577
|
targetElement.removeEventListener('keyup', handleEscape);
|
|
1566
1578
|
};
|
|
1567
|
-
}, [
|
|
1579
|
+
}, [showTooltip]);
|
|
1580
|
+
// Handle hover and focus events for the targetElement
|
|
1568
1581
|
React.useEffect(function () {
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusout', hide);
|
|
1574
|
-
}
|
|
1582
|
+
targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseenter', show);
|
|
1583
|
+
targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseleave', hide);
|
|
1584
|
+
targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusin', show);
|
|
1585
|
+
targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusout', hide);
|
|
1575
1586
|
return function () {
|
|
1576
1587
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseenter', show);
|
|
1577
1588
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseleave', hide);
|
|
1578
1589
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusin', show);
|
|
1579
1590
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusout', hide);
|
|
1580
1591
|
};
|
|
1581
|
-
}, [targetElement,
|
|
1592
|
+
}, [targetElement, show, hide]);
|
|
1593
|
+
// Handle hover events for the tooltipElement
|
|
1582
1594
|
React.useEffect(function () {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', handleTipMouseLeave);
|
|
1586
|
-
}
|
|
1595
|
+
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseenter', show);
|
|
1596
|
+
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', hide);
|
|
1587
1597
|
return function () {
|
|
1588
|
-
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter',
|
|
1589
|
-
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseleave',
|
|
1598
|
+
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter', show);
|
|
1599
|
+
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseleave', hide);
|
|
1590
1600
|
};
|
|
1591
|
-
}, [tooltipElement]);
|
|
1601
|
+
}, [tooltipElement, show, hide]);
|
|
1602
|
+
// Keep the target's id in sync
|
|
1592
1603
|
React.useEffect(function () {
|
|
1593
1604
|
var attrText = targetElement === null || targetElement === void 0 ? void 0 : targetElement.getAttribute(association);
|
|
1594
1605
|
if (!(attrText === null || attrText === void 0 ? void 0 : attrText.includes(id || ''))) {
|
|
1595
1606
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.setAttribute(association, [id, attrText].filter(Boolean).join(' '));
|
|
1596
1607
|
}
|
|
1597
1608
|
}, [targetElement, id]);
|
|
1598
|
-
return showTooltip || hideElementOnHidden
|
|
1609
|
+
return (showTooltip || hideElementOnHidden) && isBrowser()
|
|
1599
1610
|
? reactDom.createPortal(React__default.createElement("div", tslib.__assign({ id: id, className: classNames('Tooltip', "Tooltip--" + placement, className, {
|
|
1600
1611
|
TooltipInfo: variant === 'info',
|
|
1601
1612
|
'Tooltip--hidden': !showTooltip && hideElementOnHidden,
|
|
@@ -1913,10 +1924,11 @@ var Pointout = /** @class */ (function (_super) {
|
|
|
1913
1924
|
var _this = this;
|
|
1914
1925
|
var _c;
|
|
1915
1926
|
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) {
|
|
1927
|
+
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;
|
|
1928
|
+
if (!show || !isBrowser()) {
|
|
1918
1929
|
return null;
|
|
1919
1930
|
}
|
|
1931
|
+
var portal = this.props.portal || document.body;
|
|
1920
1932
|
var FTPO = (React__default.createElement("div", { className: classNames(className, 'Pointout', (_a = {
|
|
1921
1933
|
'Pointout--no-arrow': noArrow,
|
|
1922
1934
|
'Pointout--auto': !!target
|
|
@@ -2013,6 +2025,9 @@ var Pointout = /** @class */ (function (_super) {
|
|
|
2013
2025
|
*/
|
|
2014
2026
|
var queryAll = function (selector, context) {
|
|
2015
2027
|
if (context === void 0) { context = document; }
|
|
2028
|
+
if (!isBrowser()) {
|
|
2029
|
+
return [];
|
|
2030
|
+
}
|
|
2016
2031
|
return Array.prototype.slice.call(context.querySelectorAll(selector));
|
|
2017
2032
|
};
|
|
2018
2033
|
|
|
@@ -2022,7 +2037,7 @@ var queryAll = function (selector, context) {
|
|
|
2022
2037
|
var typeMap = {
|
|
2023
2038
|
confirmation: {
|
|
2024
2039
|
className: 'success',
|
|
2025
|
-
icon: '
|
|
2040
|
+
icon: 'check-circle'
|
|
2026
2041
|
},
|
|
2027
2042
|
caution: {
|
|
2028
2043
|
className: 'warning',
|
|
@@ -2196,7 +2211,8 @@ var Link = function (_a) {
|
|
|
2196
2211
|
var children = _a.children, linkRef = _a.linkRef, className = _a.className, variant = _a.variant, other = tslib.__rest(_a, ["children", "linkRef", "className", "variant"]);
|
|
2197
2212
|
return (React__default.createElement("a", tslib.__assign({ ref: linkRef, className: classNames(className, {
|
|
2198
2213
|
Link: !variant,
|
|
2199
|
-
'Button--primary': variant === 'button'
|
|
2214
|
+
'Button--primary': variant === 'button',
|
|
2215
|
+
'Button--secondary': variant === 'button-secondary'
|
|
2200
2216
|
}) }, other), children));
|
|
2201
2217
|
};
|
|
2202
2218
|
Link.propTypes = {
|
|
@@ -7984,22 +8000,39 @@ function AxeLoader() {
|
|
|
7984
8000
|
}
|
|
7985
8001
|
|
|
7986
8002
|
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"]);
|
|
8003
|
+
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"]);
|
|
8004
|
+
var overlayRef = typeof ref === 'function' || !ref ? React.createRef() : ref;
|
|
8005
|
+
React.useEffect(function () {
|
|
8006
|
+
if (!!focusOnInitialRender && overlayRef.current) {
|
|
8007
|
+
setTimeout(function () {
|
|
8008
|
+
var _a;
|
|
8009
|
+
return (_a = overlayRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
8010
|
+
});
|
|
8011
|
+
}
|
|
8012
|
+
return;
|
|
8013
|
+
}, [overlayRef.current]);
|
|
8014
|
+
React.useEffect(function () {
|
|
8015
|
+
if (typeof ref === 'function') {
|
|
8016
|
+
ref(overlayRef.current);
|
|
8017
|
+
}
|
|
8018
|
+
}, [ref]);
|
|
7988
8019
|
return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader__overlay', className, variant === 'large'
|
|
7989
8020
|
? 'Loader__overlay--large'
|
|
7990
8021
|
: variant === 'small'
|
|
7991
8022
|
? 'Loader__overlay--small'
|
|
7992
|
-
: ''), ref:
|
|
8023
|
+
: ''), ref: overlayRef, tabIndex: -1 }, other),
|
|
7993
8024
|
React__default.createElement("div", { className: "Loader__overlay__loader" },
|
|
7994
8025
|
React__default.createElement(Loader, { variant: variant }),
|
|
7995
8026
|
React__default.createElement(AxeLoader, null)),
|
|
7996
8027
|
label ? React__default.createElement("span", { className: "Loader__overlay__label" }, label) : null,
|
|
7997
|
-
|
|
8028
|
+
children));
|
|
7998
8029
|
});
|
|
7999
8030
|
LoaderOverlay.propTypes = {
|
|
8000
8031
|
className: PropTypes.string,
|
|
8001
8032
|
variant: PropTypes.oneOf(['large', 'small']),
|
|
8002
|
-
label: PropTypes.string
|
|
8033
|
+
label: PropTypes.string,
|
|
8034
|
+
focusOnInitialRender: PropTypes.bool,
|
|
8035
|
+
children: PropTypes.node
|
|
8003
8036
|
};
|
|
8004
8037
|
LoaderOverlay.displayName = 'LoaderOverlay';
|
|
8005
8038
|
|
|
@@ -8275,23 +8308,34 @@ var DescriptionDetails = function (_a) {
|
|
|
8275
8308
|
DescriptionDetails.displayName = 'DescriptionDetails';
|
|
8276
8309
|
DescriptionDetails.propTypes = commonPropTypes;
|
|
8277
8310
|
|
|
8278
|
-
var
|
|
8311
|
+
var isTooltipProps = function (props) {
|
|
8279
8312
|
return !!props.tooltip;
|
|
8280
8313
|
};
|
|
8281
8314
|
var Step = function (props) {
|
|
8282
|
-
var
|
|
8283
|
-
|
|
8315
|
+
var _a;
|
|
8316
|
+
var children = props.children, status = props.status, className = props.className, other = tslib.__rest(props, ["children", "status", "className"]);
|
|
8317
|
+
var tooltip;
|
|
8318
|
+
var tooltipText;
|
|
8319
|
+
var liProps;
|
|
8320
|
+
var isTooltip = isTooltipProps(other);
|
|
8321
|
+
if (isTooltip) {
|
|
8322
|
+
(_a = other, (tooltip = _a.tooltip, tooltipText = _a.tooltipText, _a), liProps = tslib.__rest(_a, ["tooltip", "tooltipText"]));
|
|
8323
|
+
}
|
|
8324
|
+
else {
|
|
8325
|
+
liProps = other;
|
|
8326
|
+
}
|
|
8327
|
+
return (React__default.createElement("li", tslib.__assign({ className: classNames('Stepper__step', "Stepper__step--" + status, className), "aria-current": status === 'current' ? 'step' : 'false' }, liProps),
|
|
8284
8328
|
React__default.createElement("div", { className: "Stepper__step-line" }),
|
|
8285
|
-
React__default.createElement("div", { className: "Stepper__step-content" }, isTooltip
|
|
8329
|
+
React__default.createElement("div", { className: "Stepper__step-content" }, isTooltip ? (React__default.createElement(TooltipTabstop, { placement: "bottom", tooltip: tooltip,
|
|
8286
8330
|
// the pseudo content (ex: "1") is conveyed
|
|
8287
8331
|
// by the list item's position in the set of
|
|
8288
8332
|
// list items, therefore it is safe to clobber
|
|
8289
8333
|
// it with the contents of the tooltip in the
|
|
8290
8334
|
// tab stop's accessible name.
|
|
8291
|
-
association: "aria-labelledby", "aria-label":
|
|
8335
|
+
association: "aria-labelledby", "aria-label": tooltipText },
|
|
8292
8336
|
React__default.createElement("div", { className: "Stepper__step-indicator" }))) : (React__default.createElement(React__default.Fragment, null,
|
|
8293
8337
|
React__default.createElement("div", { className: "Stepper__step-indicator" }),
|
|
8294
|
-
|
|
8338
|
+
children ? (React__default.createElement("div", { className: "Stepper__step-label" }, children)) : null)))));
|
|
8295
8339
|
};
|
|
8296
8340
|
Step.displayName = 'Step';
|
|
8297
8341
|
Step.propTypes = {
|
|
@@ -8313,22 +8357,32 @@ Stepper.propTypes = {
|
|
|
8313
8357
|
var Panel = function (_a) {
|
|
8314
8358
|
var _b;
|
|
8315
8359
|
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
|
-
|
|
8360
|
+
var headingId = !heading
|
|
8361
|
+
? undefined
|
|
8362
|
+
: typeof heading === 'object' && 'id' in heading
|
|
8363
|
+
? heading.id
|
|
8364
|
+
: randomId();
|
|
8365
|
+
var Heading = function () {
|
|
8366
|
+
if (!headingId) {
|
|
8367
|
+
return null;
|
|
8368
|
+
}
|
|
8369
|
+
var HeadingComponent = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
|
|
8370
|
+
? heading.level
|
|
8371
|
+
: 2);
|
|
8372
|
+
return (React__default.createElement(HeadingComponent, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
|
|
8373
|
+
? heading.text
|
|
8374
|
+
: heading));
|
|
8375
|
+
};
|
|
8320
8376
|
return (React__default.createElement("section", tslib.__assign({ "aria-labelledby": headingId, className: classNames('Panel', className, (_b = {},
|
|
8321
8377
|
_b['Panel--collapsed'] = collapsed,
|
|
8322
8378
|
_b)) }, other),
|
|
8323
|
-
React__default.createElement(Heading,
|
|
8324
|
-
? heading.text
|
|
8325
|
-
: heading),
|
|
8379
|
+
React__default.createElement(Heading, null),
|
|
8326
8380
|
children));
|
|
8327
8381
|
};
|
|
8328
8382
|
Panel.displayName = 'Panel';
|
|
8329
8383
|
Panel.propTypes = {
|
|
8330
8384
|
children: PropTypes.node.isRequired,
|
|
8331
|
-
heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node])
|
|
8385
|
+
heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]),
|
|
8332
8386
|
className: PropTypes.string
|
|
8333
8387
|
};
|
|
8334
8388
|
|
|
@@ -8402,7 +8456,7 @@ var Pagination = React__default.forwardRef(function (_a, ref) {
|
|
|
8402
8456
|
React__default.createElement("span", { role: "log", "aria-atomic": "true" }, statusLabel || (React__default.createElement("span", null,
|
|
8403
8457
|
"Showing ",
|
|
8404
8458
|
React__default.createElement("strong", null, itemStart),
|
|
8405
|
-
"
|
|
8459
|
+
" to",
|
|
8406
8460
|
' ',
|
|
8407
8461
|
React__default.createElement("strong", null, itemEnd),
|
|
8408
8462
|
" of ",
|
|
@@ -8471,6 +8525,172 @@ var BreadcrumbLink = React.forwardRef(function (_a, ref) {
|
|
|
8471
8525
|
return (React__default.createElement(ElementType, tslib.__assign({ className: classNames('Link', 'Breadcrumb__Link', className), ref: ref }, props), children));
|
|
8472
8526
|
});
|
|
8473
8527
|
|
|
8528
|
+
var TwoColumnPanel = React.forwardRef(function (_a, ref) {
|
|
8529
|
+
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"]);
|
|
8530
|
+
var _e = tslib.__read(React.useState(initialCollapsed), 2), isCollapsed = _e[0], setCollapsed = _e[1];
|
|
8531
|
+
var _f = tslib.__read(React.useState(false), 2), isFocusTrap = _f[0], setIsFocusTrap = _f[1];
|
|
8532
|
+
var _g = tslib.__read(React.useState(!initialCollapsed), 2), showPanel = _g[0], setShowPanel = _g[1];
|
|
8533
|
+
var togglePanel = function () {
|
|
8534
|
+
if (isCollapsed) {
|
|
8535
|
+
setShowPanel(true);
|
|
8536
|
+
}
|
|
8537
|
+
// Set collapsed state on next tick so css transitions can be applied
|
|
8538
|
+
requestAnimationFrame(function () {
|
|
8539
|
+
var _a, _b;
|
|
8540
|
+
var collapsed = !isCollapsed;
|
|
8541
|
+
setCollapsed(collapsed);
|
|
8542
|
+
if (!collapsed) {
|
|
8543
|
+
(_a = columnLeftRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
8544
|
+
}
|
|
8545
|
+
else {
|
|
8546
|
+
(_b = columnRightRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
8547
|
+
}
|
|
8548
|
+
});
|
|
8549
|
+
};
|
|
8550
|
+
var toggleButtonRef = React.useRef(null);
|
|
8551
|
+
var closeButtonRef = React.useRef(null);
|
|
8552
|
+
var columnLeftRef = React.useRef(null);
|
|
8553
|
+
var columnRightRef = React.useRef(null);
|
|
8554
|
+
var columnLeft = React__default.Children.toArray(children).find(function (child) { return child.type === ColumnLeft; });
|
|
8555
|
+
// The ColumnLeftComponent will end up being a focus trap when < 720px
|
|
8556
|
+
// This component also gets unmounted when not visible meaning that any
|
|
8557
|
+
// aria relationships cannot be set to items inside the component since
|
|
8558
|
+
// they will not be present in the dom
|
|
8559
|
+
var ColumnLeftComponent;
|
|
8560
|
+
var columnLeftId;
|
|
8561
|
+
if (React.isValidElement(columnLeft)) {
|
|
8562
|
+
var ref_1 = columnLeft.props.ref || columnLeftRef;
|
|
8563
|
+
var id = (columnLeftId =
|
|
8564
|
+
columnLeft.props.id || nextId.useId(undefined, 'sidebar-')[0]);
|
|
8565
|
+
var CloseButton = (React__default.createElement("div", { className: "TwoColumnPanel__Close" },
|
|
8566
|
+
React__default.createElement("button", { type: "button", onClick: togglePanel, ref: closeButtonRef, "aria-label": hideCollapsedPanelLabel },
|
|
8567
|
+
React__default.createElement(Icon, { type: "close" })),
|
|
8568
|
+
React__default.createElement(Tooltip, { target: closeButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, hideCollapsedPanelLabel)));
|
|
8569
|
+
var children_1 = tslib.__spread([
|
|
8570
|
+
CloseButton
|
|
8571
|
+
], React__default.Children.toArray(columnLeft.props.children));
|
|
8572
|
+
ColumnLeftComponent = React.cloneElement(columnLeft, { id: id, ref: ref_1, tabIndex: -1 }, children_1.map(function (child, index) {
|
|
8573
|
+
return React.cloneElement(child, { key: "left-" + index });
|
|
8574
|
+
}));
|
|
8575
|
+
}
|
|
8576
|
+
var columnRight = React__default.Children.toArray(children).find(function (child) { return child.type === ColumnRight; });
|
|
8577
|
+
var ColumnRightComponent;
|
|
8578
|
+
if (React.isValidElement(columnRight)) {
|
|
8579
|
+
var ref_2 = columnRight.props.ref || columnRightRef;
|
|
8580
|
+
var ToggleButton = (React__default.createElement("div", { className: "TwoColumnPanel__ButtonToggle" },
|
|
8581
|
+
React__default.createElement("button", { type: "button", onClick: togglePanel, ref: toggleButtonRef, "aria-label": !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel, "aria-expanded": !isCollapsed, "aria-controls": columnLeftId },
|
|
8582
|
+
React__default.createElement(Icon, { type: !isCollapsed ? 'chevron-double-left' : 'chevron-double-right' })),
|
|
8583
|
+
React__default.createElement(Tooltip, { target: toggleButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel)));
|
|
8584
|
+
var children_2 = tslib.__spread([
|
|
8585
|
+
ToggleButton
|
|
8586
|
+
], React__default.Children.toArray(columnRight.props.children));
|
|
8587
|
+
ColumnRightComponent = React.cloneElement(columnRight, { ref: ref_2, tabIndex: -1 }, children_2.map(function (child, index) {
|
|
8588
|
+
return React.cloneElement(child, { key: "right-" + index });
|
|
8589
|
+
}));
|
|
8590
|
+
}
|
|
8591
|
+
React.useLayoutEffect(function () {
|
|
8592
|
+
var _a;
|
|
8593
|
+
var handleTransitionEnd = function () {
|
|
8594
|
+
if (columnLeftRef.current && isCollapsed) {
|
|
8595
|
+
setShowPanel(false);
|
|
8596
|
+
}
|
|
8597
|
+
};
|
|
8598
|
+
(_a = columnLeftRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('transitionend', handleTransitionEnd);
|
|
8599
|
+
return function () {
|
|
8600
|
+
var _a;
|
|
8601
|
+
(_a = columnLeftRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('transitionend', handleTransitionEnd);
|
|
8602
|
+
};
|
|
8603
|
+
}, [columnLeftRef.current, isCollapsed]);
|
|
8604
|
+
// When the collapsable panel starts to overlay content, it needs to become a focus trap and collapsed by default
|
|
8605
|
+
React.useLayoutEffect(function () {
|
|
8606
|
+
var mediaQueryList = matchMedia('(max-width: 45rem)');
|
|
8607
|
+
var handleMatch = function (matches) {
|
|
8608
|
+
setIsFocusTrap(matches);
|
|
8609
|
+
var collapsed = matches ? true : isCollapsed;
|
|
8610
|
+
setCollapsed(collapsed);
|
|
8611
|
+
setShowPanel(!collapsed);
|
|
8612
|
+
};
|
|
8613
|
+
var listener = function (_a) {
|
|
8614
|
+
var matches = _a.matches;
|
|
8615
|
+
return handleMatch(matches);
|
|
8616
|
+
};
|
|
8617
|
+
if (mediaQueryList.matches) {
|
|
8618
|
+
handleMatch(mediaQueryList.matches);
|
|
8619
|
+
}
|
|
8620
|
+
mediaQueryList.addEventListener('change', listener);
|
|
8621
|
+
return function () {
|
|
8622
|
+
mediaQueryList.removeEventListener('change', listener);
|
|
8623
|
+
};
|
|
8624
|
+
}, []);
|
|
8625
|
+
React.useEffect(function () {
|
|
8626
|
+
var handleEscape = function (event) {
|
|
8627
|
+
if (event.key === 'Escape' ||
|
|
8628
|
+
event.key === 'Esc' ||
|
|
8629
|
+
event.keyCode === 27) {
|
|
8630
|
+
setCollapsed(true);
|
|
8631
|
+
}
|
|
8632
|
+
};
|
|
8633
|
+
var targetElement = document.body;
|
|
8634
|
+
if (isFocusTrap) {
|
|
8635
|
+
targetElement.addEventListener('keyup', handleEscape);
|
|
8636
|
+
}
|
|
8637
|
+
else {
|
|
8638
|
+
targetElement.removeEventListener('keyup', handleEscape);
|
|
8639
|
+
}
|
|
8640
|
+
return function () {
|
|
8641
|
+
targetElement.removeEventListener('keyup', handleEscape);
|
|
8642
|
+
};
|
|
8643
|
+
}, [isFocusTrap]);
|
|
8644
|
+
var handleClickOutside = function () {
|
|
8645
|
+
if (!isCollapsed && isFocusTrap) {
|
|
8646
|
+
setCollapsed(true);
|
|
8647
|
+
}
|
|
8648
|
+
};
|
|
8649
|
+
return (React__default.createElement("div", tslib.__assign({ className: classNames('TwoColumnPanel', className, {
|
|
8650
|
+
'TwoColumnPanel--show': !isCollapsed,
|
|
8651
|
+
'TwoColumnPanel--hide': isCollapsed
|
|
8652
|
+
}) }, props, { ref: ref }),
|
|
8653
|
+
React__default.createElement(FocusTrap, { active: !isCollapsed && isFocusTrap, focusTrapOptions: {
|
|
8654
|
+
escapeDeactivates: true,
|
|
8655
|
+
allowOutsideClick: true,
|
|
8656
|
+
fallbackFocus: columnLeftRef.current
|
|
8657
|
+
}, containerElements: [columnLeftRef.current] }),
|
|
8658
|
+
React__default.createElement(ClickOutsideListener, { onClickOutside: handleClickOutside, target: columnLeftRef.current }),
|
|
8659
|
+
showPanel ? ColumnLeftComponent : null,
|
|
8660
|
+
ColumnRightComponent));
|
|
8661
|
+
});
|
|
8662
|
+
TwoColumnPanel.displayName = 'TwoColumnPanel';
|
|
8663
|
+
|
|
8664
|
+
var ColumnHeader = React.forwardRef(function (_a, ref) {
|
|
8665
|
+
var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
|
|
8666
|
+
return (React__default.createElement("div", tslib.__assign({ className: classNames('TwoColumnPanel__Header', className) }, props, { ref: ref }), children));
|
|
8667
|
+
});
|
|
8668
|
+
ColumnHeader.displayName = 'ColumnHeader';
|
|
8669
|
+
|
|
8670
|
+
var ColumnGroupHeader = React.forwardRef(function (_a, ref) {
|
|
8671
|
+
var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
|
|
8672
|
+
return (React__default.createElement("div", tslib.__assign({ className: classNames('TwoColumnPanel__GroupHeader', className) }, props, { ref: ref }), children));
|
|
8673
|
+
});
|
|
8674
|
+
ColumnGroupHeader.displayName = 'ColumnGroupHeader';
|
|
8675
|
+
|
|
8676
|
+
var ColumnLeft = React.forwardRef(function (_a, ref) {
|
|
8677
|
+
var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
|
|
8678
|
+
return (React__default.createElement("section", tslib.__assign({ className: classNames('TwoColumnPanel__Left', className) }, props, { ref: ref }), children));
|
|
8679
|
+
});
|
|
8680
|
+
ColumnLeft.displayName = 'ColumnLeft';
|
|
8681
|
+
|
|
8682
|
+
var ColumnRight = React.forwardRef(function (_a, ref) {
|
|
8683
|
+
var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
|
|
8684
|
+
return (React__default.createElement("section", tslib.__assign({ className: classNames('TwoColumnPanel__Right', className) }, props, { ref: ref }), children));
|
|
8685
|
+
});
|
|
8686
|
+
ColumnRight.displayName = 'ColumnRight';
|
|
8687
|
+
|
|
8688
|
+
var ColumnList = React.forwardRef(function (_a, ref) {
|
|
8689
|
+
var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
|
|
8690
|
+
return (React__default.createElement("div", tslib.__assign({ className: classNames('TwoColumnPanel__List', className) }, props, { ref: ref }), children));
|
|
8691
|
+
});
|
|
8692
|
+
ColumnList.displayName = 'ColumnList';
|
|
8693
|
+
|
|
8474
8694
|
var LIGHT_THEME_CLASS = 'cauldron--theme-light';
|
|
8475
8695
|
var DARK_THEME_CLASS = 'cauldron--theme-dark';
|
|
8476
8696
|
var ThemeContext = React.createContext({});
|
|
@@ -8548,6 +8768,11 @@ exports.CardHeader = CardHeader;
|
|
|
8548
8768
|
exports.Checkbox = Checkbox;
|
|
8549
8769
|
exports.ClickOutsideListener = ClickOutsideListener;
|
|
8550
8770
|
exports.Code = Code;
|
|
8771
|
+
exports.ColumnGroupHeader = ColumnGroupHeader;
|
|
8772
|
+
exports.ColumnHeader = ColumnHeader;
|
|
8773
|
+
exports.ColumnLeft = ColumnLeft;
|
|
8774
|
+
exports.ColumnList = ColumnList;
|
|
8775
|
+
exports.ColumnRight = ColumnRight;
|
|
8551
8776
|
exports.DescriptionDetails = DescriptionDetails;
|
|
8552
8777
|
exports.DescriptionList = DescriptionList;
|
|
8553
8778
|
exports.DescriptionListItem = DescriptionListItem;
|
|
@@ -8616,6 +8841,7 @@ exports.TopBar = TopBar$1;
|
|
|
8616
8841
|
exports.TopBarItem = MenuItem;
|
|
8617
8842
|
exports.TopBarMenu = TopBarMenu;
|
|
8618
8843
|
exports.TopBarTrigger = TopBarTrigger;
|
|
8844
|
+
exports.TwoColumnPanel = TwoColumnPanel;
|
|
8619
8845
|
exports.Workspace = Workspace;
|
|
8620
8846
|
exports.focusableSelector = focusableSelector;
|
|
8621
8847
|
exports.iconTypes = iconTypes;
|
package/lib/minus.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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 SvgMinus = props => /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
overflow: "visible",
|
|
15
|
+
preserveAspectRatio: "none",
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
height: 24,
|
|
18
|
+
width: 24
|
|
19
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
20
|
+
d: "M19 13H5v-2h14v2z",
|
|
21
|
+
vectorEffect: "non-scaling-stroke",
|
|
22
|
+
fill: "currentColor"
|
|
23
|
+
})));
|
|
24
|
+
|
|
25
|
+
exports.default = SvgMinus;
|
|
@@ -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-canary.abded4e2",
|
|
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",
|
|
@@ -124,4 +124,4 @@
|
|
|
124
124
|
"\\.svg$": "<rootDir>/__tests__/svgMock.js"
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
}
|
|
127
|
+
}
|