@geotab/zenith 3.6.0-ssr.beta.0 → 3.6.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 +4 -1
- package/dist/absolute/absolute.d.ts +1 -1
- package/dist/absolute/absolute.js +6 -3
- package/dist/controlledPopup/controlledPopup.js +4 -2
- package/dist/dialog/dialog.js +13 -5
- package/dist/feedbackContainer/feedbackContainer.js +5 -2
- package/dist/filtersBar/filtersBar.js +5 -1
- package/dist/groupsFilterRaw/groupsFilterRaw.js +42 -26
- package/dist/header/header.js +6 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +17 -19
- package/dist/layout/layout.d.ts +1 -1
- package/dist/layout/layout.js +17 -5
- package/dist/mobileSheet/mobileSheet.js +9 -3
- package/dist/modal/modal.js +26 -14
- package/dist/sidePanel/sidePanel.js +13 -6
- package/esm/absolute/absolute.d.ts +1 -1
- package/esm/absolute/absolute.js +6 -3
- package/esm/controlledPopup/controlledPopup.js +4 -2
- package/esm/dialog/dialog.js +13 -5
- package/esm/feedbackContainer/feedbackContainer.js +5 -2
- package/esm/filtersBar/filtersBar.js +5 -1
- package/esm/groupsFilterRaw/groupsFilterRaw.js +42 -26
- package/esm/header/header.js +6 -3
- package/esm/index.d.ts +0 -1
- package/esm/index.js +0 -1
- package/esm/layout/layout.d.ts +1 -1
- package/esm/layout/layout.js +17 -5
- package/esm/mobileSheet/mobileSheet.js +9 -3
- package/esm/modal/modal.js +26 -14
- package/esm/sidePanel/sidePanel.js +13 -6
- package/package.json +4 -1
package/dist/modal/modal.js
CHANGED
|
@@ -84,8 +84,9 @@ const dialogHelpers_1 = require("../dialog/dialogHelpers");
|
|
|
84
84
|
const themeContext_1 = require("../utils/theme/themeContext");
|
|
85
85
|
const modalHelpers_1 = require("./modalHelpers");
|
|
86
86
|
const textIconButton_1 = require("../textIconButton/textIconButton");
|
|
87
|
-
const
|
|
87
|
+
const useClientReady_1 = require("../commonHelpers/hooks/useClientReady");
|
|
88
88
|
const zen_1 = require("../utils/zen");
|
|
89
|
+
const react_dom_1 = require("react-dom");
|
|
89
90
|
const Modal = ({
|
|
90
91
|
isOpen,
|
|
91
92
|
children,
|
|
@@ -100,26 +101,34 @@ const Modal = ({
|
|
|
100
101
|
}) => {
|
|
101
102
|
var _a, _b, _c;
|
|
102
103
|
const lastActiveOutsideElement = (0, react_1.useRef)((_a = zen_1.zen.document) === null || _a === void 0 ? void 0 : _a.activeElement);
|
|
103
|
-
// eslint-disable-next-line
|
|
104
|
-
const modalRoot = ((_b = zen_1.zen === null || zen_1.zen === void 0 ? void 0 : zen_1.zen.document) === null || _b === void 0 ? void 0 : _b.fullscreenElement) || ((_c = zen_1.zen === null || zen_1.zen === void 0 ? void 0 : zen_1.zen.document) === null || _c === void 0 ? void 0 : _c.body);
|
|
105
104
|
const [top, setTop] = (0, react_1.useState)(`${zen_1.zen.pageYOffset || 0}px`);
|
|
106
105
|
const {
|
|
107
106
|
dark
|
|
108
107
|
} = (0, react_1.useContext)(themeContext_1.themeContext);
|
|
108
|
+
const isClientReady = (0, useClientReady_1.useClientReady)();
|
|
109
109
|
const onOutSideClick = (0, react_1.useCallback)(() => {
|
|
110
|
+
if (!isClientReady) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
110
113
|
if (!isOpen || !closeOnClickOutside || !onClose) {
|
|
111
114
|
return;
|
|
112
115
|
}
|
|
113
116
|
onClose();
|
|
114
|
-
}, [isOpen, closeOnClickOutside, onClose]);
|
|
117
|
+
}, [isClientReady, isOpen, closeOnClickOutside, onClose]);
|
|
115
118
|
(0, react_1.useEffect)(() => {
|
|
119
|
+
if (!isClientReady) {
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
116
122
|
const copyActive = lastActiveOutsideElement.current;
|
|
117
123
|
return () => {
|
|
118
124
|
(0, dialogHelpers_1.isFocusable)(copyActive) && copyActive.focus();
|
|
119
125
|
};
|
|
120
|
-
}, []);
|
|
126
|
+
}, [isClientReady]);
|
|
121
127
|
(0, react_1.useEffect)(() => {
|
|
122
128
|
var _a, _b;
|
|
129
|
+
if (!isClientReady) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
123
132
|
(_a = zen_1.zen.document) === null || _a === void 0 ? void 0 : _a.body.classList.remove("zen-modal-content--hidden-overflow");
|
|
124
133
|
if (isOpen) {
|
|
125
134
|
(_b = zen_1.zen.document) === null || _b === void 0 ? void 0 : _b.body.classList.add("zen-modal-content--hidden-overflow");
|
|
@@ -128,9 +137,12 @@ const Modal = ({
|
|
|
128
137
|
var _a;
|
|
129
138
|
(_a = zen_1.zen.document) === null || _a === void 0 ? void 0 : _a.body.classList.remove("zen-modal-content--hidden-overflow");
|
|
130
139
|
};
|
|
131
|
-
}, [isOpen]);
|
|
140
|
+
}, [isClientReady, isOpen]);
|
|
132
141
|
(0, react_1.useEffect)(() => {
|
|
133
142
|
var _a, _b;
|
|
143
|
+
if (!isClientReady) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
134
146
|
const changeTopSpace = () => {
|
|
135
147
|
setTop(`${zen_1.zen.pageYOffset || 0}px`);
|
|
136
148
|
};
|
|
@@ -141,7 +153,7 @@ const Modal = ({
|
|
|
141
153
|
(_a = zen_1.zen.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, "resize", changeTopSpace);
|
|
142
154
|
(_b = zen_1.zen.removeEventListener) === null || _b === void 0 ? void 0 : _b.call(zen_1.zen, "scroll", changeTopSpace);
|
|
143
155
|
};
|
|
144
|
-
}, []);
|
|
156
|
+
}, [isClientReady]);
|
|
145
157
|
const labeledId = (0, react_1.useId)();
|
|
146
158
|
const darkClass = dark ? "zen-dark" : "";
|
|
147
159
|
const modalContent = (0, react_1.useMemo)(() => {
|
|
@@ -176,11 +188,11 @@ const Modal = ({
|
|
|
176
188
|
onClick: onOutSideClick
|
|
177
189
|
})]
|
|
178
190
|
}), [darkClass, modalContainerClassName, labeledId, top, onClose, maxWidth, title, className, type, focus, modalContent, onOutSideClick]);
|
|
179
|
-
|
|
180
|
-
if (!isOpen) {
|
|
191
|
+
if (!isOpen || !isClientReady) {
|
|
181
192
|
return null;
|
|
182
193
|
}
|
|
183
|
-
|
|
194
|
+
const modalRoot = ((_b = zen_1.zen.document) === null || _b === void 0 ? void 0 : _b.fullscreenElement) || ((_c = zen_1.zen.document) === null || _c === void 0 ? void 0 : _c.body);
|
|
195
|
+
return (0, react_dom_1.createPortal)(dialogHTML(labeledId), modalRoot);
|
|
184
196
|
};
|
|
185
197
|
exports.Modal = Modal;
|
|
186
198
|
const dummyOnClose = () => {};
|
|
@@ -203,10 +215,10 @@ const DialogContentNew = ({
|
|
|
203
215
|
const lastActiveOutsideElement = (0, react_1.useRef)((_a = zen_1.zen.document) === null || _a === void 0 ? void 0 : _a.activeElement);
|
|
204
216
|
const iconDriveClassName = (0, useDriveClassName_1.useDriveClassName)("icon");
|
|
205
217
|
const iconsByType = (0, react_1.useMemo)(() => ({
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
218
|
+
error: iconException_1.IconException,
|
|
219
|
+
success: iconCheckRadio_1.IconCheckRadio,
|
|
220
|
+
warning: iconWarning_1.IconWarning,
|
|
221
|
+
info: iconInfoCircle_1.IconInfoCircle
|
|
210
222
|
}), []);
|
|
211
223
|
const subscriptionCondition = (0, react_1.useCallback)(trigger => trigger.current !== null, []);
|
|
212
224
|
(0, useTrapFocus_1.useTrapFocus)(contentRef, undefined, contentRef, subscriptionCondition);
|
|
@@ -18,6 +18,7 @@ const useMobile_1 = require("../commonHelpers/hooks/useMobile");
|
|
|
18
18
|
const isAlertTarget_1 = require("../alert/utils/isAlertTarget");
|
|
19
19
|
const isToastTarget_1 = require("../toast/utils/isToastTarget");
|
|
20
20
|
const usePortal_1 = require("../commonHelpers/hooks/usePortal");
|
|
21
|
+
const useClientReady_1 = require("../commonHelpers/hooks/useClientReady");
|
|
21
22
|
const zen_1 = require("../utils/zen");
|
|
22
23
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
23
24
|
const isChildPopup = (target, stopElement) => {
|
|
@@ -65,16 +66,16 @@ const SidePanel = ({ label, className, id, isOpen, onHidePanel, children, trigge
|
|
|
65
66
|
const autoId = (0, react_1.useId)();
|
|
66
67
|
const popupId = id || autoId;
|
|
67
68
|
const prevReadyForFocus = (0, react_1.useRef)(false);
|
|
68
|
-
|
|
69
|
+
const isClientReady = (0, useClientReady_1.useClientReady)();
|
|
69
70
|
(0, react_1.useEffect)(() => {
|
|
70
|
-
if (triggerRef && triggerRef.current) {
|
|
71
|
+
if (triggerRef && triggerRef.current && isClientReady) {
|
|
71
72
|
const triggerRole = triggerRef.current.dataset.role;
|
|
72
73
|
triggerRef.current.setAttribute("aria-haspopup", triggerRole ? triggerRole : "true");
|
|
73
74
|
triggerRef.current.setAttribute("aria-expanded", renderComponent ? "true" : "false");
|
|
74
75
|
triggerRef.current.setAttribute("aria-controls", popupId);
|
|
75
76
|
triggerRef.current.setAttribute("data-popup-id", popupId);
|
|
76
77
|
}
|
|
77
|
-
}, [triggerRef, renderComponent, popupId]);
|
|
78
|
+
}, [triggerRef, renderComponent, popupId, isClientReady]);
|
|
78
79
|
function handleEscape() {
|
|
79
80
|
onHidePanel(SidePanelCloseReason.Escape);
|
|
80
81
|
if (!triggerRef || !triggerRef.current) {
|
|
@@ -87,10 +88,13 @@ const SidePanel = ({ label, className, id, isOpen, onHidePanel, children, trigge
|
|
|
87
88
|
const focusable = Array.from(triggerRef.current.querySelectorAll(focusableSelector_1.FOCUSABLE_SELECTOR));
|
|
88
89
|
(focusable[0] || triggerRef.current).focus();
|
|
89
90
|
}
|
|
90
|
-
(0, useTrapFocus_1.useTrapFocus)(sidePanelRef, useTrapFocusWithTrigger ? triggerRef : undefined, showContent);
|
|
91
|
-
(0, useEscape_1.useEscape)(sidePanelRef, handleEscape, renderComponent);
|
|
91
|
+
(0, useTrapFocus_1.useTrapFocus)(sidePanelRef, useTrapFocusWithTrigger ? triggerRef : undefined, showContent && isClientReady);
|
|
92
|
+
(0, useEscape_1.useEscape)(sidePanelRef, handleEscape, renderComponent && isClientReady);
|
|
92
93
|
(0, react_1.useEffect)(() => {
|
|
93
94
|
var _a, _b, _c;
|
|
95
|
+
if (!isClientReady) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
94
98
|
// eslint-disable-next-line complexity
|
|
95
99
|
const closeOnClickOutside = (e) => {
|
|
96
100
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -148,7 +152,7 @@ const SidePanel = ({ label, className, id, isOpen, onHidePanel, children, trigge
|
|
|
148
152
|
prevReadyForFocus.current = false;
|
|
149
153
|
}
|
|
150
154
|
return () => { var _a; return (_a = zen_1.zen.document) === null || _a === void 0 ? void 0 : _a.body.removeEventListener("click", closeOnClickOutside, true); };
|
|
151
|
-
}, [renderComponent, readyForFocus, onHidePanel, triggerRef, useTrapFocusWithTrigger, preventFirstFocus]);
|
|
155
|
+
}, [renderComponent, readyForFocus, onHidePanel, triggerRef, useTrapFocusWithTrigger, preventFirstFocus, isClientReady]);
|
|
152
156
|
(0, react_1.useEffect)(() => {
|
|
153
157
|
setIsOpen(isOpen);
|
|
154
158
|
}, [isOpen, setIsOpen]);
|
|
@@ -174,6 +178,9 @@ const SidePanel = ({ label, className, id, isOpen, onHidePanel, children, trigge
|
|
|
174
178
|
if (!renderComponent && !isOpen) {
|
|
175
179
|
return null;
|
|
176
180
|
}
|
|
181
|
+
if (!isClientReady) {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
177
184
|
return portal;
|
|
178
185
|
};
|
|
179
186
|
exports.SidePanel = SidePanel;
|
|
@@ -24,4 +24,4 @@ export interface IAbsolute extends IZenComponentProps {
|
|
|
24
24
|
recalculateOnScroll?: boolean;
|
|
25
25
|
recalculateTrigger?: boolean;
|
|
26
26
|
}
|
|
27
|
-
export declare const Absolute: ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, recalculateTrigger }: IAbsolute) => import("react/jsx-runtime").JSX.Element | "";
|
|
27
|
+
export declare const Absolute: ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, recalculateTrigger }: IAbsolute) => import("react/jsx-runtime").JSX.Element | "" | null;
|
package/esm/absolute/absolute.js
CHANGED
|
@@ -14,13 +14,13 @@ import { useArrowKey } from "../commonHelpers/hooks/useArrowKey";
|
|
|
14
14
|
import { themeContext } from "../utils/theme/themeContext";
|
|
15
15
|
import { useScroll } from "../commonHelpers/hooks/useScroll";
|
|
16
16
|
import { getScrollableParent } from "../utils/getScrollableParent";
|
|
17
|
-
|
|
17
|
+
import { useClientReady } from "../commonHelpers/hooks/useClientReady";
|
|
18
18
|
import { zen } from "../utils/zen";
|
|
19
19
|
export const Absolute = ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger = "off", shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, recalculateTrigger = true }) => {
|
|
20
20
|
const popupRef = useRef(null);
|
|
21
21
|
const prevScroll = useRef(0);
|
|
22
22
|
const { dark } = useContext(themeContext);
|
|
23
|
-
|
|
23
|
+
const isClientReady = useClientReady();
|
|
24
24
|
const onScrollHandler = e => {
|
|
25
25
|
var _a;
|
|
26
26
|
prevScroll.current = (_a = e.target) === null || _a === void 0 ? void 0 : _a.scrollTop;
|
|
@@ -113,7 +113,7 @@ export const Absolute = ({ isOpen, id, paddingX, paddingY, className, children,
|
|
|
113
113
|
calculatePosition();
|
|
114
114
|
}
|
|
115
115
|
return () => { };
|
|
116
|
-
}, [calculatePosition, children, isOpen]);
|
|
116
|
+
}, [calculatePosition, children, isOpen, isClientReady]);
|
|
117
117
|
useEffect(() => {
|
|
118
118
|
if (isOpen) {
|
|
119
119
|
if (popupRef.current && prevScroll.current && shouldHoldScroll) {
|
|
@@ -124,5 +124,8 @@ export const Absolute = ({ isOpen, id, paddingX, paddingY, className, children,
|
|
|
124
124
|
prevScroll.current = 0;
|
|
125
125
|
}
|
|
126
126
|
}, [children, isOpen, shouldHoldScroll]);
|
|
127
|
+
if (!isClientReady) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
127
130
|
return renderPopup();
|
|
128
131
|
};
|
|
@@ -2,11 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useId } from "react";
|
|
3
3
|
import { Absolute } from "../absolute/absolute";
|
|
4
4
|
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
5
|
+
import { useClientReady } from "../commonHelpers/hooks/useClientReady";
|
|
5
6
|
export const ControlledPopup = ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, preventAttributesAutoSet }) => {
|
|
6
7
|
const autoId = useId();
|
|
7
8
|
const popupId = id || autoId;
|
|
9
|
+
const isClientReady = useClientReady();
|
|
8
10
|
useEffect(() => {
|
|
9
|
-
if (!triggerRef.current) {
|
|
11
|
+
if (!triggerRef.current || !isClientReady) {
|
|
10
12
|
return;
|
|
11
13
|
}
|
|
12
14
|
triggerRef.current.setAttribute("data-popup-id", popupId);
|
|
@@ -18,6 +20,6 @@ export const ControlledPopup = ({ isOpen, id, paddingX, paddingY, triggerRef, cl
|
|
|
18
20
|
triggerRef.current.setAttribute("aria-haspopup", triggerRole ? triggerRole : refTriggerRole === "menuitem" ? "menu" : "true");
|
|
19
21
|
triggerRef.current.setAttribute("aria-expanded", isOpen ? "true" : "false");
|
|
20
22
|
triggerRef.current.setAttribute("aria-controls", popupId);
|
|
21
|
-
}, [triggerRef, isOpen, popupId, preventAttributesAutoSet]);
|
|
23
|
+
}, [triggerRef, isOpen, popupId, preventAttributesAutoSet, isClientReady]);
|
|
22
24
|
return (_jsx(Absolute, { triggerRef: triggerRef, alignment: alignment, id: popupId, isOpen: isOpen, className: classNames(["zen-popup", className ? className : ""]), paddingX: paddingX, paddingY: paddingY, inline: inline, onOpenChange: onOpenChange, useTrapFocusWithTrigger: useTrapFocusWithTrigger, shouldHoldScroll: shouldHoldScroll, role: "dialog", ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, recalculateOnScroll: recalculateOnScroll, children: children }));
|
|
23
25
|
};
|
package/esm/dialog/dialog.js
CHANGED
|
@@ -6,7 +6,7 @@ import { themeContext } from "../utils/theme/themeContext";
|
|
|
6
6
|
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
7
7
|
import { useBodyScroll } from "../utils/useBodyScroll";
|
|
8
8
|
import { usePortal } from "../commonHelpers/hooks/usePortal";
|
|
9
|
-
|
|
9
|
+
import { useClientReady } from "../commonHelpers/hooks/useClientReady";
|
|
10
10
|
import { zen } from "../utils/zen";
|
|
11
11
|
/**
|
|
12
12
|
* @deprecated - use Modal instead
|
|
@@ -17,15 +17,21 @@ export const Dialog = ({ isOpen, children, isElementVisible }) => {
|
|
|
17
17
|
const modalRoot = ((_b = zen.document) === null || _b === void 0 ? void 0 : _b.fullscreenElement) || ((_c = zen.document) === null || _c === void 0 ? void 0 : _c.body);
|
|
18
18
|
const { dark } = useContext(themeContext);
|
|
19
19
|
const { resetScroll } = useBodyScroll();
|
|
20
|
-
|
|
20
|
+
const isClientReady = useClientReady();
|
|
21
21
|
useEffect(() => {
|
|
22
|
+
if (!isClientReady) {
|
|
23
|
+
return () => { };
|
|
24
|
+
}
|
|
22
25
|
const copyActive = lastActiveOutsideElement.current;
|
|
23
26
|
return () => {
|
|
24
27
|
isFocusable(copyActive) && copyActive.focus();
|
|
25
28
|
};
|
|
26
|
-
}, []);
|
|
29
|
+
}, [isClientReady]);
|
|
27
30
|
useEffect(() => {
|
|
28
31
|
var _a;
|
|
32
|
+
if (!isClientReady) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
29
35
|
if (isOpen) {
|
|
30
36
|
return;
|
|
31
37
|
}
|
|
@@ -33,11 +39,13 @@ export const Dialog = ({ isOpen, children, isElementVisible }) => {
|
|
|
33
39
|
if (!(modalCont === null || modalCont === void 0 ? void 0 : modalCont.length)) {
|
|
34
40
|
resetScroll();
|
|
35
41
|
}
|
|
36
|
-
}, [isOpen, resetScroll]);
|
|
42
|
+
}, [isClientReady, isOpen, resetScroll]);
|
|
37
43
|
const labeledId = useId();
|
|
38
44
|
const darkClass = dark ? "zen-dark" : "";
|
|
39
45
|
const createDialog = (id) => _jsxs("div", { className: classNames(["zen-dialog", darkClass]), "aria-modal": "true", role: "dialog", "aria-labelledby": labeledId, style: { top: `${zen.pageYOffset || 0}px` }, children: [_jsx(DialogContent, Object.assign({}, children.props, { labeledId: id, isElementVisible: isElementVisible })), _jsx("div", { className: "zen-dialog__shield" })] });
|
|
40
46
|
const portal = usePortal(isOpen && isValidElement(children) ? createDialog(labeledId) : null, modalRoot, "ModalPortal");
|
|
41
|
-
|
|
47
|
+
if (!isClientReady) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
42
50
|
return portal;
|
|
43
51
|
};
|
|
@@ -8,7 +8,7 @@ import { classNames } from "../commonHelpers/classNames/classNames";
|
|
|
8
8
|
import { getAlertAnimation } from "./utils/getAlertAnimation";
|
|
9
9
|
import { getToastAnimation } from "./utils/getToastAnimation";
|
|
10
10
|
import { usePortal } from "../commonHelpers/hooks/usePortal";
|
|
11
|
-
|
|
11
|
+
import { useClientReady } from "../commonHelpers/hooks/useClientReady";
|
|
12
12
|
import { zen } from "../utils/zen";
|
|
13
13
|
export const FeedbackContainer = () => {
|
|
14
14
|
var _a, _b;
|
|
@@ -16,7 +16,7 @@ export const FeedbackContainer = () => {
|
|
|
16
16
|
const prevAlertsLength = React.useRef(alerts.length);
|
|
17
17
|
const prevToastsLength = React.useRef(toasts.length);
|
|
18
18
|
const isAPIMode = mode === "api";
|
|
19
|
-
|
|
19
|
+
const isClientReady = useClientReady();
|
|
20
20
|
const isMobile = useMobile();
|
|
21
21
|
const isAlertAdded = alerts.length > prevAlertsLength.current;
|
|
22
22
|
const isToastAdded = toasts.length > prevToastsLength.current;
|
|
@@ -44,5 +44,8 @@ export const FeedbackContainer = () => {
|
|
|
44
44
|
}, type: toast.type, hasIcon: toast.hasIcon, action: toast.action }, toast.id)), [toasts, sameToastsLength, isToastAdded, removedToastId, isMobile, activeFeedback, removeToast]);
|
|
45
45
|
const alertsPortal = usePortal(_jsx("div", { className: alertClasses, children: alertsToRender }), (_a = zen.document) === null || _a === void 0 ? void 0 : _a.body);
|
|
46
46
|
const toastsPortal = usePortal(_jsx("div", { className: toastClasses, children: toastsToRender }), (_b = zen.document) === null || _b === void 0 ? void 0 : _b.body);
|
|
47
|
+
if (!isClientReady) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
47
50
|
return _jsxs(_Fragment, { children: [!isAPIMode && alertsPortal, !isAPIMode && toastsPortal] });
|
|
48
51
|
};
|
|
@@ -21,6 +21,7 @@ import { useSearchComponent } from "./filtersBarProviderSearch";
|
|
|
21
21
|
import { useMobileTrigger } from "./filtersBarProviderTrigger";
|
|
22
22
|
import { FOCUSABLE_SELECTOR } from "../utils/focusableSelector";
|
|
23
23
|
import { FiltersBarDateInput } from "./components/filtersBarDateInput/filtersBarDateInput";
|
|
24
|
+
import { useClientReady } from "../commonHelpers/hooks/useClientReady";
|
|
24
25
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
25
26
|
export const FiltersBarDisplayName = "FiltersBar";
|
|
26
27
|
const getChildren = (children) => (!children
|
|
@@ -83,7 +84,7 @@ export const FiltersBar = ({ className, children, isAllFiltersVisible, hideAllFi
|
|
|
83
84
|
const stateFromChildren = useMemo(() => getCurrentFiltersState(filterBarChildren), [filterBarChildren]);
|
|
84
85
|
const [filtersBarState, dispatchFiltersBarState] = useReducer(filtersBarReducer, getInitialFiltersBarState(stateFromChildren, getDefaultFiltersState, onApplyAllFilters === undefined));
|
|
85
86
|
const [sidePanelState, dispatchSidePanelState] = useReducer(sidePanelReducer, stateFromChildren);
|
|
86
|
-
|
|
87
|
+
const isClientReady = useClientReady();
|
|
87
88
|
useEffect(() => {
|
|
88
89
|
// need for dynamic items loading
|
|
89
90
|
if (Object.keys(stateFromChildren).length > Object.keys(sidePanelState).length) {
|
|
@@ -195,6 +196,9 @@ export const FiltersBar = ({ className, children, isAllFiltersVisible, hideAllFi
|
|
|
195
196
|
pillName, pillIcon, pillType, sidePanelState, filterBarChildren]);
|
|
196
197
|
const noActions = useMemo(() => isAllFiltersButtonHidden && (selectedQuantity === undefined && filtersBarState.currentNumberOfChangedFilters === 0 || selectedQuantity === 0)
|
|
197
198
|
&& (!isApplyButtonShown || onApplyAllFilters === undefined), [isAllFiltersButtonHidden, selectedQuantity, filtersBarState.currentNumberOfChangedFilters, isApplyButtonShown, onApplyAllFilters]);
|
|
199
|
+
if (!isClientReady) {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
198
202
|
return _jsxs(_Fragment, { children: [!isMobile && _jsxs("div", { ref: toolbarRef, className: classNames(["zen-filters-toolbar", noActions ? "zen-filters-toolbar--no-actions" : "", className !== null && className !== void 0 ? className : ""]), children: [_jsx(FiltersContainer, { children: filterBarChildren }), _jsx(FiltersBarActions, { allFiltersRef: allFiltersRef, onShowAllFilters: () => toggleAllFiltersCallback(true), onClearFilters: handleClearClick, selectedQuantity: selectedQuantity !== undefined ? selectedQuantity : filtersBarState.currentNumberOfChangedFilters, selectedQuantityToDisplay: selectedQuantity !== undefined ? selectedQuantity : filtersBarState.numberOfChangedFilters, hideAllFiltersButton: isAllFiltersButtonHidden, onApplyButtonClick: onApplyAllFilters ? handleApplyAllFilters(false) : undefined, isApplyButtonShown: isApplyButtonShown })] }), !isAllFiltersButtonHidden ? sidePanel : null] });
|
|
199
203
|
};
|
|
200
204
|
FiltersBar.Search = FiltersBarSearch;
|
|
@@ -295,8 +295,13 @@ export const GroupsFilterRaw = props => {
|
|
|
295
295
|
const prevSearchField = useRef("");
|
|
296
296
|
const groupsFilterId = useId();
|
|
297
297
|
const popupId = useId();
|
|
298
|
-
const isDataLoadedRef = useRef(false);
|
|
299
298
|
const blocksMap = useMemo(() => [["builtInGroups", "userGroups"], ["advancedGroups", "builtInGroups", "userGroups"], ["builtInGroups", "userGroups"]], []);
|
|
299
|
+
const onOptionsToggle = useCallback(() => {
|
|
300
|
+
dispatchUiState({
|
|
301
|
+
type: UiStateActionType.ToggleOpen,
|
|
302
|
+
payload: undefined
|
|
303
|
+
});
|
|
304
|
+
}, []);
|
|
300
305
|
const handleSetStep = useCallback(newStep => {
|
|
301
306
|
var _a;
|
|
302
307
|
uiState.step !== FilterMenuStep.CurrentlySelected && dispatchUiState({
|
|
@@ -545,8 +550,7 @@ export const GroupsFilterRaw = props => {
|
|
|
545
550
|
errorHandler(e);
|
|
546
551
|
return [];
|
|
547
552
|
}), [dataLoader, errorHandler]);
|
|
548
|
-
|
|
549
|
-
isDataLoadedRef.current = true;
|
|
553
|
+
useEffect(() => {
|
|
550
554
|
dispatchUiState({
|
|
551
555
|
type: UiStateActionType.SetLoadWithError,
|
|
552
556
|
payload: {
|
|
@@ -575,32 +579,9 @@ export const GroupsFilterRaw = props => {
|
|
|
575
579
|
isLoading: false
|
|
576
580
|
}
|
|
577
581
|
});
|
|
578
|
-
isDataLoadedRef.current = false;
|
|
579
582
|
errorHandler(e);
|
|
580
583
|
});
|
|
581
584
|
}, [dataLoader, errorHandler]);
|
|
582
|
-
useEffect(() => {
|
|
583
|
-
if (isDataLoadedRef.current) {
|
|
584
|
-
return;
|
|
585
|
-
}
|
|
586
|
-
loadData();
|
|
587
|
-
}, [loadData]);
|
|
588
|
-
const onOptionsToggle = useCallback(() => {
|
|
589
|
-
const willBeOpen = !uiState.isOpen;
|
|
590
|
-
dispatchUiState({
|
|
591
|
-
type: UiStateActionType.ToggleOpen,
|
|
592
|
-
payload: undefined
|
|
593
|
-
});
|
|
594
|
-
if (willBeOpen && !isDataLoadedRef.current && !uiState.isLoading) {
|
|
595
|
-
loadData();
|
|
596
|
-
}
|
|
597
|
-
}, [uiState.isOpen, uiState.isLoading, loadData]);
|
|
598
|
-
const isEmptyMap = dataItems.length === 0;
|
|
599
|
-
useEffect(() => {
|
|
600
|
-
if (isEmptyMap && uiState.isOpen && !uiState.isLoading && !uiState.hasError) {
|
|
601
|
-
loadData();
|
|
602
|
-
}
|
|
603
|
-
}, [uiState.isOpen, isEmptyMap, uiState.isLoading, uiState.hasError, loadData]);
|
|
604
585
|
useEffect(() => {
|
|
605
586
|
const step = uiState.step;
|
|
606
587
|
if (step !== FilterMenuStep.CurrentlySelected) {
|
|
@@ -841,6 +822,41 @@ export const GroupsFilterRaw = props => {
|
|
|
841
822
|
children: translate("Clear")
|
|
842
823
|
})]
|
|
843
824
|
}), [handleApply, handleCancel, handleReset, isApplyDisabled, translate]);
|
|
825
|
+
const isEmptyMap = dataItems.length === 0;
|
|
826
|
+
useEffect(() => {
|
|
827
|
+
if (isEmptyMap && uiState.isOpen && !uiState.isLoading && !uiState.hasError) {
|
|
828
|
+
dispatchUiState({
|
|
829
|
+
type: UiStateActionType.SetLoadWithError,
|
|
830
|
+
payload: {
|
|
831
|
+
hasError: false,
|
|
832
|
+
isLoading: true
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
dataLoader().then(groups => {
|
|
836
|
+
dispatchState({
|
|
837
|
+
type: StateActionType.CreateGroupsMap,
|
|
838
|
+
payload: groups
|
|
839
|
+
});
|
|
840
|
+
dispatchUiState({
|
|
841
|
+
type: UiStateActionType.SetLoadWithError,
|
|
842
|
+
payload: {
|
|
843
|
+
hasError: false,
|
|
844
|
+
isLoading: false
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
setDataItems(groups);
|
|
848
|
+
}).catch(e => {
|
|
849
|
+
dispatchUiState({
|
|
850
|
+
type: UiStateActionType.SetLoadWithError,
|
|
851
|
+
payload: {
|
|
852
|
+
hasError: true,
|
|
853
|
+
isLoading: false
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
errorHandler(e);
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
}, [uiState.isOpen, isEmptyMap, uiState.isLoading, uiState.hasError, dataLoader, errorHandler]);
|
|
844
860
|
const memoizedMobileView = useMemo(() => _jsxs(MobileSheet, {
|
|
845
861
|
label: translate("Organization groups filter"),
|
|
846
862
|
triggerRef: triggerRef,
|
package/esm/header/header.js
CHANGED
|
@@ -23,7 +23,7 @@ import { SearchContextProvider } from "../filtersBar/filtersBarProviderSearch";
|
|
|
23
23
|
import { useDriveClassName } from "../utils/theme/useDriveClassName";
|
|
24
24
|
import { TriggerContextProvider } from "../filtersBar/filtersBarProviderTrigger";
|
|
25
25
|
import { useHeaderButtons } from "../utils/headerButtons/headerButtonsProvider";
|
|
26
|
-
|
|
26
|
+
import { useClientReady } from "../commonHelpers/hooks/useClientReady";
|
|
27
27
|
import { zen } from "../utils/zen";
|
|
28
28
|
export var HeaderType;
|
|
29
29
|
(function (HeaderType) {
|
|
@@ -35,7 +35,7 @@ export const Header = ({ children, className, onFiltersBarOpen
|
|
|
35
35
|
// eslint-disable-next-line complexity
|
|
36
36
|
}) => {
|
|
37
37
|
var _a, _b;
|
|
38
|
-
|
|
38
|
+
const isClientReady = useClientReady();
|
|
39
39
|
const toolbarRef = useRef(null);
|
|
40
40
|
const leftElementsRef = useRef(null);
|
|
41
41
|
const rightElementsRef = useRef(null);
|
|
@@ -168,7 +168,7 @@ export const Header = ({ children, className, onFiltersBarOpen
|
|
|
168
168
|
}, [result === null || result === void 0 ? void 0 : result.contentRect.width, calculateMiddleWidth]);
|
|
169
169
|
useEffect(() => {
|
|
170
170
|
calculateMiddleWidth();
|
|
171
|
-
}, [calculateMiddleWidth]);
|
|
171
|
+
}, [calculateMiddleWidth, isClientReady]);
|
|
172
172
|
const moreButton = useMemo(() => _jsx(PageToolbarCollapsedItemsControl, { children: nonFittingElements }, "pageCollapsedToolbar"), [nonFittingElements]);
|
|
173
173
|
const mobileSearch = useMemo(() => searchComponent && memoizedFiltersBar ? (_jsx(MobileSearchControl, { state: searchExpandedState, searchInput: searchComponent, onClick: (state) => setSearchExpandedState(state) })) : null, [memoizedFiltersBar, searchComponent, searchExpandedState]);
|
|
174
174
|
const mobileFilterButton = useMemo(() => (isMobile && memoizedFiltersBar ? _jsx(MobileFilterControl, { count: numberOfChangedFilters, onClick: filtersBarToggler, ref: mobileFilterControlRef }) : null), [filtersBarToggler, isMobile, memoizedFiltersBar, numberOfChangedFilters]);
|
|
@@ -253,6 +253,9 @@ export const Header = ({ children, className, onFiltersBarOpen
|
|
|
253
253
|
return;
|
|
254
254
|
}
|
|
255
255
|
}, [mobileFilterControlRef, mobileFilterNewLineControlRef, isMobileFilterButtonExists, mobileFilterTrigger, isFilterInNewLine]);
|
|
256
|
+
if (!isClientReady) {
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
256
259
|
return (_jsx(HeaderMenuProvider, { alignment: "left-top", children: _jsx(HeaderCustomContent.Provider, { value: { content, setContent }, children: _jsx(FiltersBarContextProvider, { value: { setFiltersBarToggleAllFiltersFn, onUpdateNumberOfChangedFiltersFn: setNumberOfChangedFilters }, children: _jsx(SearchContextProvider, { value: { setSearchComponent: handleSearchChange }, children: _jsx(TriggerContextProvider, { value: { triggerComponent: mobileFilterTrigger }, children: _jsxs("div", { className: fullClassName, ref: headerRef, children: [mainLineContainer, newLineContainer, tabs ? (_jsxs("div", { className: classNames(["zen-main-header__tabs", "zen-main-header--border", isMobile ? "zen-main-header__tabs--mobile" : "", driveClassnameTab || ""]), children: [" ", tabs, " "] })) : null, memoizedFiltersBar ? _jsx("div", { className: "zen-main-header__filtersBar", children: memoizedFiltersBar }) : null, _jsx("div", { className: "zen-main-header__section zen-main-header__section--hidden", ref: hiddenContainerRef, children: hiddenItemForRender }), _jsx("div", { className: "zen-main-header__section zen-main-header__section--hidden", children: _jsx("div", { className: "zen-main-header__section--inline", ref: moreButtonRef, children: moreButton }) })] }) }) }) }) }) }));
|
|
257
260
|
};
|
|
258
261
|
export const HeaderDisplayName = "Header";
|
package/esm/index.d.ts
CHANGED
|
@@ -50,7 +50,6 @@ export { type IEntityWithId } from "./commonHelpers/entity";
|
|
|
50
50
|
export { generateId } from "./commonHelpers/generateId";
|
|
51
51
|
export { DeviceContext, DeviceProvider } from "./commonHelpers/hooks/deviceProvider";
|
|
52
52
|
export { DeviceType } from "./commonHelpers/hooks/deviceType";
|
|
53
|
-
export { useClientReady } from "./commonHelpers/hooks/useClientReady";
|
|
54
53
|
export { useDebounce } from "./commonHelpers/hooks/useDebounce";
|
|
55
54
|
export { useDebouncedMemo } from "./commonHelpers/hooks/useDebouncedMemo";
|
|
56
55
|
export { useDeviceType } from "./commonHelpers/hooks/useDeviceType";
|
package/esm/index.js
CHANGED
|
@@ -50,7 +50,6 @@ export { hexToRGBA } from "./commonHelpers/colorUtils";
|
|
|
50
50
|
export { generateId } from "./commonHelpers/generateId";
|
|
51
51
|
export { DeviceContext, DeviceProvider } from "./commonHelpers/hooks/deviceProvider";
|
|
52
52
|
export { DeviceType } from "./commonHelpers/hooks/deviceType";
|
|
53
|
-
export { useClientReady } from "./commonHelpers/hooks/useClientReady";
|
|
54
53
|
export { useDebounce } from "./commonHelpers/hooks/useDebounce";
|
|
55
54
|
export { useDebouncedMemo } from "./commonHelpers/hooks/useDebouncedMemo";
|
|
56
55
|
export { useDeviceType } from "./commonHelpers/hooks/useDeviceType";
|
package/esm/layout/layout.d.ts
CHANGED
|
@@ -22,5 +22,5 @@ interface ILayoutComponents {
|
|
|
22
22
|
FullScreenButton: React.FC<IFullScreenButton>;
|
|
23
23
|
}
|
|
24
24
|
export declare const getContentPaddings: (isMobile: boolean, startWithToolbar: boolean) => number;
|
|
25
|
-
export declare const Layout: (({ id, className, pageScrolling, children }: ILayout) => import("react/jsx-runtime").JSX.Element) & ILayoutComponents;
|
|
25
|
+
export declare const Layout: (({ id, className, pageScrolling, children }: ILayout) => import("react/jsx-runtime").JSX.Element | null) & ILayoutComponents;
|
|
26
26
|
export {};
|
package/esm/layout/layout.js
CHANGED
|
@@ -20,7 +20,7 @@ import { SummaryTileDisplayName } from "../summaryTile/summaryTile";
|
|
|
20
20
|
import { FullScreenButton } from "../dataGrid/entitiesListActions/actions/fullscreenButton";
|
|
21
21
|
import { useMobile } from "../commonHelpers/hooks/useMobile";
|
|
22
22
|
import { PageHeaderDisplayName } from "../pageHeader/pageHeader";
|
|
23
|
-
|
|
23
|
+
import { useClientReady } from "../commonHelpers/hooks/useClientReady";
|
|
24
24
|
import { zen } from "../utils/zen";
|
|
25
25
|
export const getContentPaddings = (isMobile, startWithToolbar) => {
|
|
26
26
|
const paddingsCount = startWithToolbar ? 1 : 2;
|
|
@@ -36,7 +36,7 @@ const LayoutInner = ({ id, className, pageScrolling = true, children }) => {
|
|
|
36
36
|
const [minHeight, setMinHeight] = useState(zen.innerHeight || 0);
|
|
37
37
|
const [startWithToolbar, setStartWithToolbar] = useState(false);
|
|
38
38
|
const isFullScreen = useCallback(() => fullScreenElement !== undefined, [fullScreenElement]);
|
|
39
|
-
|
|
39
|
+
const isClientReady = useClientReady();
|
|
40
40
|
const [header, banners, summaryTileBar, content] = useMemo(() => {
|
|
41
41
|
const h = [];
|
|
42
42
|
const b = [];
|
|
@@ -149,16 +149,22 @@ const LayoutInner = ({ id, className, pageScrolling = true, children }) => {
|
|
|
149
149
|
useResize(resizeCallBack, true);
|
|
150
150
|
const isFullScreenCurrent = isFullScreen();
|
|
151
151
|
useEffect(() => {
|
|
152
|
+
if (!isClientReady) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
152
155
|
calculateLayoutParams(layoutRef.current, middleRef.current);
|
|
153
|
-
}, [calculateLayoutParams, layoutRef, middleRef]);
|
|
156
|
+
}, [calculateLayoutParams, isClientReady, layoutRef, middleRef]);
|
|
154
157
|
useEffect(() => {
|
|
155
158
|
var _a;
|
|
159
|
+
if (!isClientReady) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
156
162
|
const timeoutId = (_a = zen.setTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, () => {
|
|
157
163
|
const isStartWithToolbar = checkIsStartWithToolbar(isFullScreenCurrent);
|
|
158
164
|
setStartWithToolbar(isStartWithToolbar);
|
|
159
165
|
}, 0);
|
|
160
166
|
return () => { var _a; return (_a = zen.clearTimeout) === null || _a === void 0 ? void 0 : _a.call(zen, timeoutId); };
|
|
161
|
-
}, [isFullScreenCurrent, checkIsStartWithToolbar]);
|
|
167
|
+
}, [isFullScreenCurrent, checkIsStartWithToolbar, isClientReady]);
|
|
162
168
|
const memoizedHeader = useMemo(() => header, [header]);
|
|
163
169
|
const memoizedBanners = useMemo(() => banners, [banners]);
|
|
164
170
|
const memoizedContent = useMemo(() => content, [content]);
|
|
@@ -182,6 +188,9 @@ const LayoutInner = ({ id, className, pageScrolling = true, children }) => {
|
|
|
182
188
|
}, [isFullScreenCurrent, minHeight, pageScrolling]);
|
|
183
189
|
useEffect(() => {
|
|
184
190
|
var _a, _b;
|
|
191
|
+
if (!isClientReady) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
185
194
|
if (isFullScreenCurrent) {
|
|
186
195
|
const fullscreenEl = (_a = layoutRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(".zen-layout__full-screen-element--visible");
|
|
187
196
|
if (fullscreenEl) {
|
|
@@ -200,7 +209,10 @@ const LayoutInner = ({ id, className, pageScrolling = true, children }) => {
|
|
|
200
209
|
});
|
|
201
210
|
}
|
|
202
211
|
}
|
|
203
|
-
}, [isFullScreenCurrent, layoutRef]);
|
|
212
|
+
}, [isClientReady, isFullScreenCurrent, layoutRef]);
|
|
213
|
+
if (!isClientReady) {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
204
216
|
return (_jsx("section", Object.assign({ id: id || layoutId, ref: layoutRef, className: classNames(["zen-layout", !pageScrolling ? "zen-layout--no-scroll" : "", className || ""]) }, heightStyle, { children: _jsx(LayoutFullScreenProvider, { isFullScreen: isFullScreen, setFullScreenElement: handleSetFullScreenElement, fullScreenElement: fullScreenElement, children: _jsxs(LayoutSizeProvider, { contentHeight: memoizedContentHeight, outerContentHeight: memoizedOuterContentHeight, isSetHeight: !pageScrolling, children: [isFullScreenCurrent ? null : memoizedHeader, isFullScreenCurrent ? null : memoizedBanners, isFullScreenCurrent ? null : memoizedSummaryTileBar, memoizedContent] }) }) })));
|
|
205
217
|
};
|
|
206
218
|
export const Layout = memo(LayoutInner);
|
|
@@ -16,7 +16,7 @@ import { useDriveClassName } from "../utils/theme/useDriveClassName";
|
|
|
16
16
|
import { useLanguage } from "../utils/localization/useLanguage";
|
|
17
17
|
import { useUniqueId } from "../commonHelpers/useUniqueId";
|
|
18
18
|
import { useFadeComponent } from "../utils/useFadeComponent";
|
|
19
|
-
|
|
19
|
+
import { useClientReady } from "../commonHelpers/hooks/useClientReady";
|
|
20
20
|
import { zen } from "../utils/zen";
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
22
22
|
injectString("cs", "Back", "Zp\u011Bt");
|
|
@@ -132,12 +132,15 @@ export const MobileSheet = ({
|
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
}, [onHidePanel, dataShieldId]);
|
|
135
|
-
|
|
135
|
+
const isClientReady = useClientReady();
|
|
136
136
|
useEffect(() => {
|
|
137
137
|
setIsOpen(isOpen);
|
|
138
138
|
}, [isOpen, setIsOpen]);
|
|
139
139
|
useEffect(() => {
|
|
140
140
|
var _a, _b, _c, _d;
|
|
141
|
+
if (!isClientReady) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
141
144
|
if (useTrapFocusWithTrigger) {
|
|
142
145
|
return;
|
|
143
146
|
}
|
|
@@ -145,7 +148,7 @@ export const MobileSheet = ({
|
|
|
145
148
|
return;
|
|
146
149
|
}
|
|
147
150
|
showContent && !preventFirstFocus && ((_d = (_c = ref.current) === null || _c === void 0 ? void 0 : _c.querySelector(FOCUSABLE_SELECTOR)) === null || _d === void 0 ? void 0 : _d.focus());
|
|
148
|
-
}, [content, showContent, readyForFocus, useTrapFocusWithTrigger, preventFirstFocus]);
|
|
151
|
+
}, [content, showContent, readyForFocus, useTrapFocusWithTrigger, preventFirstFocus, isClientReady]);
|
|
149
152
|
useEffect(() => {
|
|
150
153
|
var _a;
|
|
151
154
|
if (triggerRef && !renderComponent && !readyForFocus && ((_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.getAttribute("aria-expanded")) === "true") {
|
|
@@ -153,6 +156,9 @@ export const MobileSheet = ({
|
|
|
153
156
|
triggerRef.current.focus();
|
|
154
157
|
}
|
|
155
158
|
}, [triggerRef, renderComponent, readyForFocus]);
|
|
159
|
+
if (!isClientReady) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
156
162
|
if (!renderComponent && !isOpen) {
|
|
157
163
|
return null;
|
|
158
164
|
}
|