@deque/cauldron-react 4.6.0-canary.74cbb93c → 4.6.0-canary.8df85c5f
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.
|
@@ -5,6 +5,7 @@ interface TwoColumnPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
5
5
|
showCollapsedPanelLabel?: string;
|
|
6
6
|
hideCollapsedPanelLabel?: string;
|
|
7
7
|
skipLink?: SkipLink;
|
|
8
|
+
collapsedMediaQuery?: string;
|
|
8
9
|
}
|
|
9
10
|
declare const TwoColumnPanel: React.ForwardRefExoticComponent<TwoColumnPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
11
|
export default TwoColumnPanel;
|
package/lib/index.js
CHANGED
|
@@ -8777,10 +8777,10 @@ var ColumnRight = React.forwardRef(function (_a, ref) {
|
|
|
8777
8777
|
ColumnRight.displayName = 'ColumnRight';
|
|
8778
8778
|
|
|
8779
8779
|
var TwoColumnPanel = React.forwardRef(function (_a, ref) {
|
|
8780
|
-
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, _e = _a.skipLink, skipLink = _e === void 0 ? null : _e, props = tslib.__rest(_a, ["className", "children", "initialCollapsed", "showCollapsedPanelLabel", "hideCollapsedPanelLabel", "skipLink"]);
|
|
8781
|
-
var
|
|
8782
|
-
var
|
|
8783
|
-
var
|
|
8780
|
+
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, _e = _a.skipLink, skipLink = _e === void 0 ? null : _e, _f = _a.collapsedMediaQuery, collapsedMediaQuery = _f === void 0 ? '(max-width: 45rem)' : _f, props = tslib.__rest(_a, ["className", "children", "initialCollapsed", "showCollapsedPanelLabel", "hideCollapsedPanelLabel", "skipLink", "collapsedMediaQuery"]);
|
|
8781
|
+
var _g = tslib.__read(React.useState(initialCollapsed), 2), isCollapsed = _g[0], setCollapsed = _g[1];
|
|
8782
|
+
var _h = tslib.__read(React.useState(false), 2), isFocusTrap = _h[0], setIsFocusTrap = _h[1];
|
|
8783
|
+
var _j = tslib.__read(React.useState(!initialCollapsed), 2), showPanel = _j[0], setShowPanel = _j[1];
|
|
8784
8784
|
var toggleButtonRef = React.useRef(null);
|
|
8785
8785
|
var closeButtonRef = React.useRef(null);
|
|
8786
8786
|
var columnLeftRef = React.useRef(null);
|
|
@@ -8854,7 +8854,7 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
|
|
|
8854
8854
|
}, [columnLeftRef.current, isCollapsed]);
|
|
8855
8855
|
// When the collapsable panel starts to overlay content, it needs to become a focus trap and collapsed by default
|
|
8856
8856
|
React.useLayoutEffect(function () {
|
|
8857
|
-
var mediaQueryList = matchMedia(
|
|
8857
|
+
var mediaQueryList = matchMedia(collapsedMediaQuery);
|
|
8858
8858
|
var handleMatch = function (matches) {
|
|
8859
8859
|
setIsFocusTrap(matches);
|
|
8860
8860
|
var collapsed = matches ? true : isCollapsed;
|