@geotab/zenith 3.10.0-beta.0 → 3.10.0-beta.1
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 +5 -0
- package/dist/absolute/absolute.d.ts +7 -1
- package/dist/absolute/absolute.js +8 -4
- package/dist/betaPill/betaPill.d.ts +13 -2
- package/dist/betaPill/betaPill.js +6 -4
- package/dist/checkbox/checkbox.js +2 -2
- package/dist/controlledPopup/controlledPopup.d.ts +2 -1
- package/dist/controlledPopup/controlledPopup.js +2 -2
- package/dist/headerTitle/headerTitle.d.ts +3 -1
- package/dist/headerTitle/headerTitle.js +2 -2
- package/dist/index.css +18 -12
- package/dist/menu/controlledMenu.d.ts +1 -0
- package/dist/menu/controlledMenu.js +2 -2
- package/esm/absolute/absolute.d.ts +7 -1
- package/esm/absolute/absolute.js +8 -4
- package/esm/betaPill/betaPill.d.ts +13 -2
- package/esm/betaPill/betaPill.js +6 -4
- package/esm/checkbox/checkbox.js +2 -2
- package/esm/controlledPopup/controlledPopup.d.ts +2 -1
- package/esm/controlledPopup/controlledPopup.js +2 -2
- package/esm/headerTitle/headerTitle.d.ts +3 -1
- package/esm/headerTitle/headerTitle.js +2 -2
- package/esm/menu/controlledMenu.d.ts +1 -0
- package/esm/menu/controlledMenu.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,6 +57,11 @@ Zenith library provides components defined in Zenith Design System. It includes
|
|
|
57
57
|
- Flip icons for Arabic (RTL) language
|
|
58
58
|
- `Dropdown` search and select-all improvements
|
|
59
59
|
- Fix system font fallback in Storybook pages
|
|
60
|
+
- [MYG-128651](https://geotab.atlassian.net/browse/MYG-128651): Update Zenith beta pill parameters to take optional custom text
|
|
61
|
+
- Increase max height of zen popup
|
|
62
|
+
- [MYG-128520](https://geotab.atlassian.net/browse/MYG-128520): Fix SidePanel not animating open due to RTL regression
|
|
63
|
+
- [MYG-121631](https://geotab.atlassian.net/browse/MYG-121631): Add `closeOnScroll` prop to close `ContextMenu` on scroll
|
|
64
|
+
- [MYG-123578](https://geotab.atlassian.net/browse/MYG-123578): Fix checkbox accessibility by moving input inside label wrapper
|
|
60
65
|
|
|
61
66
|
### 3.9.1
|
|
62
67
|
|
|
@@ -22,8 +22,14 @@ export interface IAbsolute extends IZenComponentProps {
|
|
|
22
22
|
ariaLabelledby?: string;
|
|
23
23
|
alignmentsFn?: IAlignment;
|
|
24
24
|
recalculateOnScroll?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* When true, closes the popup on scroll instead of repositioning it.
|
|
27
|
+
* Mutually exclusive with `recalculateOnScroll` — setting both causes a
|
|
28
|
+
* wasted position recalculation before the popup closes.
|
|
29
|
+
*/
|
|
30
|
+
closeOnScroll?: boolean;
|
|
25
31
|
recalculateTrigger?: boolean;
|
|
26
32
|
/** Whether to focus the first focusable element when popup opens. Default: true */
|
|
27
33
|
focusOnOpen?: boolean;
|
|
28
34
|
}
|
|
29
|
-
export declare const Absolute: ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, recalculateTrigger, focusOnOpen }: IAbsolute) => import("react/jsx-runtime").JSX.Element | "" | null;
|
|
35
|
+
export declare const Absolute: ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, closeOnScroll, recalculateTrigger, focusOnOpen }: IAbsolute) => import("react/jsx-runtime").JSX.Element | "" | null;
|
|
@@ -19,7 +19,7 @@ const useScroll_1 = require("../commonHelpers/hooks/useScroll");
|
|
|
19
19
|
const getScrollableParent_1 = require("../utils/getScrollableParent");
|
|
20
20
|
const useClientReady_1 = require("../commonHelpers/hooks/useClientReady");
|
|
21
21
|
const zen_1 = require("../utils/zen");
|
|
22
|
-
const Absolute = ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger = "off", shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, recalculateTrigger = true, focusOnOpen = true }) => {
|
|
22
|
+
const Absolute = ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger = "off", shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, closeOnScroll, recalculateTrigger = true, focusOnOpen = true }) => {
|
|
23
23
|
const popupRef = (0, react_1.useRef)(null);
|
|
24
24
|
const prevScroll = (0, react_1.useRef)(0);
|
|
25
25
|
const { dark } = (0, react_1.useContext)(themeContext_1.themeContext);
|
|
@@ -47,14 +47,18 @@ const Absolute = ({ isOpen, id, paddingX, paddingY, className, children, trigger
|
|
|
47
47
|
return "";
|
|
48
48
|
};
|
|
49
49
|
const parent = (0, react_1.useMemo)(() => {
|
|
50
|
-
if (!isOpen || !recalculateOnScroll) {
|
|
50
|
+
if (!isOpen || (!recalculateOnScroll && !closeOnScroll)) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
return (0, getScrollableParent_1.getScrollableParent)(triggerRef.current);
|
|
54
|
-
}, [triggerRef, isOpen, recalculateOnScroll]);
|
|
54
|
+
}, [triggerRef, isOpen, recalculateOnScroll, closeOnScroll]);
|
|
55
55
|
const calculatePosition = (0, react_1.useCallback)(() => (0, calculatePosition_1.calculatePosition)(triggerRef, popupRef, paddingX, paddingY, inline, alignment, alignmentsFn, parent ? parent : undefined), [triggerRef, paddingX, paddingY, inline, alignment, alignmentsFn, popupRef, parent]);
|
|
56
|
+
const handleCloseOnScroll = (0, react_1.useCallback)(() => {
|
|
57
|
+
onOpenChange(false);
|
|
58
|
+
}, [onOpenChange]);
|
|
56
59
|
(0, useResize_1.useResize)(calculatePosition, isOpen);
|
|
57
|
-
(0, useScroll_1.useScroll)(calculatePosition, isOpen, parent);
|
|
60
|
+
(0, useScroll_1.useScroll)(calculatePosition, isOpen && !!recalculateOnScroll, parent);
|
|
61
|
+
(0, useScroll_1.useScroll)(handleCloseOnScroll, isOpen && !!closeOnScroll, parent);
|
|
58
62
|
(0, react_1.useLayoutEffect)(calculatePosition, [isOpen, children, recalculateTrigger, calculatePosition]);
|
|
59
63
|
function handleEscape() {
|
|
60
64
|
onOpenChange(false);
|
|
@@ -6,10 +6,21 @@ export interface IBetaPillActions {
|
|
|
6
6
|
link?: string;
|
|
7
7
|
linkOptions?: ILinkOptions;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface IBetaPillBase {
|
|
10
10
|
className?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
}
|
|
13
|
+
interface IBetaPillWithActions extends IBetaPillBase {
|
|
11
14
|
feedbackAction?: IBetaPillActions;
|
|
12
15
|
betaOptionAction?: IBetaPillActions;
|
|
16
|
+
description?: string;
|
|
17
|
+
}
|
|
18
|
+
interface IBetaPillWithoutActions extends IBetaPillBase {
|
|
19
|
+
feedbackAction?: never;
|
|
20
|
+
betaOptionAction?: never;
|
|
21
|
+
description?: never;
|
|
13
22
|
}
|
|
14
|
-
export
|
|
23
|
+
export type IBetaPill = IBetaPillWithActions | IBetaPillWithoutActions;
|
|
24
|
+
export declare const BetaPill: ({ className, feedbackAction, betaOptionAction, name, description }: IBetaPill) => import("react/jsx-runtime").JSX.Element;
|
|
15
25
|
export declare const TRANSLATIONS: string[];
|
|
26
|
+
export {};
|
|
@@ -127,7 +127,9 @@ injectString("ar-SA", "Beta", "\u062A\u062C\u0631\u064A\u0628\u064A");
|
|
|
127
127
|
const BetaPill = ({
|
|
128
128
|
className,
|
|
129
129
|
feedbackAction,
|
|
130
|
-
betaOptionAction
|
|
130
|
+
betaOptionAction,
|
|
131
|
+
name,
|
|
132
|
+
description
|
|
131
133
|
}) => {
|
|
132
134
|
const {
|
|
133
135
|
translate
|
|
@@ -147,8 +149,8 @@ const BetaPill = ({
|
|
|
147
149
|
return (0, jsx_runtime_1.jsx)(pillExpandable_1.PillExpandable, {
|
|
148
150
|
isBeta: true,
|
|
149
151
|
icon: iconLab_1.IconLab,
|
|
150
|
-
description: translate("This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements."),
|
|
151
|
-
text: translate("Beta"),
|
|
152
|
+
description: description !== null && description !== void 0 ? description : translate("This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements."),
|
|
153
|
+
text: name !== null && name !== void 0 ? name : translate("Beta"),
|
|
152
154
|
type: "info",
|
|
153
155
|
className: pillClasses,
|
|
154
156
|
mainAction: resolvedMainAction,
|
|
@@ -161,7 +163,7 @@ const BetaPill = ({
|
|
|
161
163
|
type: "info",
|
|
162
164
|
children: !isMobile && (0, jsx_runtime_1.jsx)("span", {
|
|
163
165
|
className: "zen-caption__content",
|
|
164
|
-
children: translate("Beta")
|
|
166
|
+
children: name !== null && name !== void 0 ? name : translate("Beta")
|
|
165
167
|
})
|
|
166
168
|
});
|
|
167
169
|
};
|
|
@@ -54,10 +54,10 @@ const Checkbox = (_a) => {
|
|
|
54
54
|
const isMobile = (0, useMobile_1.useMobile)();
|
|
55
55
|
const checkboxIconClasses = (0, react_1.useMemo)(() => (0, classNames_1.classNames)(["zen-checkbox__icon", disabled ? "zen-checkbox__icon--disabled" : ""]), [disabled]);
|
|
56
56
|
const checkbox = ((0, jsx_runtime_1.jsx)(triStateCheckbox_1.TriStateCheckbox, Object.assign({ className: "zen-checkbox__input", id: intId, checked: checked, indeterminate: indeterminate, disabled: disabled, "aria-label": title, "aria-describedby": describedBy }, rest)));
|
|
57
|
-
const iconAndLabel = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-checkbox__box", children: state === checkboxState_1.CheckboxState.Indeterminate ? ((0, jsx_runtime_1.jsx)(checkboxIconMinus_1.CheckboxIconMinus, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : state === checkboxState_1.CheckboxState.On ? ((0, jsx_runtime_1.jsx)(checkboxIconCheckmark_1.CheckboxIconCheckmark, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : null }), children ? ((0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-checkbox__label-text", fullWidth ? "zen-checkbox__label-text--full-width" : ""]), children: children })) : null] }));
|
|
57
|
+
const iconAndLabel = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-checkbox__box", "aria-hidden": true, children: state === checkboxState_1.CheckboxState.Indeterminate ? ((0, jsx_runtime_1.jsx)(checkboxIconMinus_1.CheckboxIconMinus, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : state === checkboxState_1.CheckboxState.On ? ((0, jsx_runtime_1.jsx)(checkboxIconCheckmark_1.CheckboxIconCheckmark, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : null }), children ? ((0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-checkbox__label-text", fullWidth ? "zen-checkbox__label-text--full-width" : ""]), children: children })) : null] }));
|
|
58
58
|
if (wrapped) {
|
|
59
59
|
return ((0, jsx_runtime_1.jsxs)("label", { className: (0, classNames_1.classNames)(["zen-checkbox", driveClasses || "", className]), title: title, children: [checkbox, (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-checkbox__label", reverse ? "zen-checkbox__label--reverse" : ""]), children: iconAndLabel })] }));
|
|
60
60
|
}
|
|
61
|
-
return ((0, jsx_runtime_1.
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-checkbox", isMobile && !driveClasses ? "zen-checkbox--mobile" : "", driveClasses || "", className]), children: (0, jsx_runtime_1.jsxs)("label", { className: (0, classNames_1.classNames)(["zen-checkbox__label", reverse ? "zen-checkbox__label--reverse" : ""]), title: title, children: [checkbox, iconAndLabel] }) }));
|
|
62
62
|
};
|
|
63
63
|
exports.Checkbox = Checkbox;
|
|
@@ -23,8 +23,9 @@ export interface IControlledPopup extends IZenComponentProps {
|
|
|
23
23
|
ariaLabel?: string;
|
|
24
24
|
ariaLabelledby?: string;
|
|
25
25
|
recalculateOnScroll?: boolean;
|
|
26
|
+
closeOnScroll?: boolean;
|
|
26
27
|
preventAttributesAutoSet?: boolean;
|
|
27
28
|
/** Whether to focus the first focusable element when popup opens. Default: true */
|
|
28
29
|
focusOnOpen?: boolean;
|
|
29
30
|
}
|
|
30
|
-
export declare const ControlledPopup: ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, preventAttributesAutoSet, focusOnOpen, role }: IControlledPopup) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare const ControlledPopup: ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, closeOnScroll, preventAttributesAutoSet, focusOnOpen, role }: IControlledPopup) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const absolute_1 = require("../absolute/absolute");
|
|
7
7
|
const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
8
8
|
const useClientReady_1 = require("../commonHelpers/hooks/useClientReady");
|
|
9
|
-
const ControlledPopup = ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, preventAttributesAutoSet, focusOnOpen, role = "dialog" }) => {
|
|
9
|
+
const ControlledPopup = ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, closeOnScroll, preventAttributesAutoSet, focusOnOpen, role = "dialog" }) => {
|
|
10
10
|
const autoId = (0, react_1.useId)();
|
|
11
11
|
const popupId = id || autoId;
|
|
12
12
|
const isClientReady = (0, useClientReady_1.useClientReady)();
|
|
@@ -24,6 +24,6 @@ const ControlledPopup = ({ isOpen, id, paddingX, paddingY, triggerRef, className
|
|
|
24
24
|
triggerRef.current.setAttribute("aria-expanded", isOpen ? "true" : "false");
|
|
25
25
|
triggerRef.current.setAttribute("aria-controls", popupId);
|
|
26
26
|
}, [triggerRef, isOpen, popupId, preventAttributesAutoSet, isClientReady]);
|
|
27
|
-
return ((0, jsx_runtime_1.jsx)(absolute_1.Absolute, Object.assign({ triggerRef: triggerRef, alignment: alignment, id: popupId, isOpen: isOpen, className: (0, classNames_1.classNames)(["zen-popup", className ? className : ""]), paddingX: paddingX, paddingY: paddingY, inline: inline, onOpenChange: onOpenChange, useTrapFocusWithTrigger: useTrapFocusWithTrigger, shouldHoldScroll: shouldHoldScroll }, (role !== false && typeof role === "string" ? { role } : {}), (role !== false && ariaLabel ? { ariaLabel } : {}), (role !== false && ariaLabelledby ? { ariaLabelledby } : {}), { recalculateOnScroll: recalculateOnScroll, focusOnOpen: focusOnOpen, children: children })));
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(absolute_1.Absolute, Object.assign({ triggerRef: triggerRef, alignment: alignment, id: popupId, isOpen: isOpen, className: (0, classNames_1.classNames)(["zen-popup", className ? className : ""]), paddingX: paddingX, paddingY: paddingY, inline: inline, onOpenChange: onOpenChange, useTrapFocusWithTrigger: useTrapFocusWithTrigger, shouldHoldScroll: shouldHoldScroll }, (role !== false && typeof role === "string" ? { role } : {}), (role !== false && ariaLabel ? { ariaLabel } : {}), (role !== false && ariaLabelledby ? { ariaLabelledby } : {}), { recalculateOnScroll: recalculateOnScroll, closeOnScroll: closeOnScroll, focusOnOpen: focusOnOpen, children: children })));
|
|
28
28
|
};
|
|
29
29
|
exports.ControlledPopup = ControlledPopup;
|
|
@@ -16,9 +16,11 @@ export interface IHeaderTitle extends IZenComponentProps {
|
|
|
16
16
|
allowBookmarkWithBack?: boolean;
|
|
17
17
|
feedBackAction?: IBetaPillActions;
|
|
18
18
|
betaOptionAction?: IBetaPillActions;
|
|
19
|
+
betaPillName?: string;
|
|
20
|
+
betaPillDescription?: string;
|
|
19
21
|
}
|
|
20
22
|
export declare const HeaderTitle: {
|
|
21
|
-
({ id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction }: IHeaderTitle): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
({ id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction, betaPillName, betaPillDescription }: IHeaderTitle): import("react/jsx-runtime").JSX.Element;
|
|
22
24
|
displayName: string;
|
|
23
25
|
};
|
|
24
26
|
export declare const TRANSLATIONS: string[];
|
|
@@ -10,7 +10,7 @@ const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
|
|
|
10
10
|
const headerBack_1 = require("../header/headerBack");
|
|
11
11
|
const bookmark_1 = require("../bookmark/bookmark");
|
|
12
12
|
exports.HeaderTitleDisplayName = "PageHeader";
|
|
13
|
-
const HeaderTitle = ({ id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction }) => {
|
|
13
|
+
const HeaderTitle = ({ id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction, betaPillName, betaPillDescription }) => {
|
|
14
14
|
const isMobile = (0, useMobile_1.useMobile)();
|
|
15
15
|
const driveMainLineClassName = (0, useDriveClassName_1.useDriveClassName)("zen-page-header__main-line");
|
|
16
16
|
const drivePageNameClassName = (0, useDriveClassName_1.useDriveClassName)("zen-page-header__page-name");
|
|
@@ -33,7 +33,7 @@ const HeaderTitle = ({ id, children, className, pageName, subline, isBeta, isMob
|
|
|
33
33
|
});
|
|
34
34
|
return [b, b.length && !allowBookmarkWithBack ? o.filter(el => el.type !== bookmark_1.Bookmark) : o];
|
|
35
35
|
}, [children, allowBookmarkWithBack]);
|
|
36
|
-
return ((0, jsx_runtime_1.jsxs)("header", { id: id, className: clsNames, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-page-header__main-line", driveMainLineClassName || ""]), children: [back.length ? back : null, pageName ? (0, jsx_runtime_1.jsx)("h1", { className: (0, classNames_1.classNames)(["zen-page-header__page-name", drivePageNameClassName || ""]), children: pageName }) : null, isBeta ? (0, jsx_runtime_1.jsx)(betaPill_1.BetaPill, { feedbackAction: feedBackAction, betaOptionAction: betaOptionAction, className: "zen-page-header__beta" }) : null, other.length ? other : null] }), subline || ""] }));
|
|
36
|
+
return ((0, jsx_runtime_1.jsxs)("header", { id: id, className: clsNames, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-page-header__main-line", driveMainLineClassName || ""]), children: [back.length ? back : null, pageName ? (0, jsx_runtime_1.jsx)("h1", { className: (0, classNames_1.classNames)(["zen-page-header__page-name", drivePageNameClassName || ""]), children: pageName }) : null, isBeta ? ((0, jsx_runtime_1.jsx)(betaPill_1.BetaPill, { feedbackAction: feedBackAction, betaOptionAction: betaOptionAction, name: betaPillName, description: betaPillDescription, className: "zen-page-header__beta" })) : null, other.length ? other : null] }), subline || ""] }));
|
|
37
37
|
};
|
|
38
38
|
exports.HeaderTitle = HeaderTitle;
|
|
39
39
|
exports.HeaderTitle.displayName = exports.HeaderTitleDisplayName;
|
package/dist/index.css
CHANGED
|
@@ -3443,7 +3443,7 @@ html:lang(ar) .zen-menu-button__action--drive-tablet {
|
|
|
3443
3443
|
box-sizing: border-box;
|
|
3444
3444
|
background-color: var(--backgrounds-main);
|
|
3445
3445
|
padding: 4px 0;
|
|
3446
|
-
max-height:
|
|
3446
|
+
max-height: 90vh;
|
|
3447
3447
|
border: 0px;
|
|
3448
3448
|
min-height: 30px;
|
|
3449
3449
|
min-width: 170px;
|
|
@@ -3523,6 +3523,9 @@ html:lang(ar) .zen-side-panel {
|
|
|
3523
3523
|
visibility: visible;
|
|
3524
3524
|
pointer-events: auto;
|
|
3525
3525
|
}
|
|
3526
|
+
.zen-side-panel.zen-side-panel--shown {
|
|
3527
|
+
transform: translateX(0);
|
|
3528
|
+
}
|
|
3526
3529
|
.zen-side-panel--shown .zen-form-field--new-component {
|
|
3527
3530
|
display: flex;
|
|
3528
3531
|
}
|
|
@@ -4849,42 +4852,45 @@ html:lang(ar) .zen-checkbox__label-text {
|
|
|
4849
4852
|
.zen-checkbox__icon--disabled {
|
|
4850
4853
|
fill: var(--backgrounds-content-0);
|
|
4851
4854
|
}
|
|
4852
|
-
.zen-
|
|
4853
|
-
.zen-
|
|
4855
|
+
.zen-checkbox:has(.zen-checkbox__input:checked) .zen-checkbox__box,
|
|
4856
|
+
.zen-checkbox:has(.zen-checkbox__input:indeterminate) .zen-checkbox__box {
|
|
4854
4857
|
border-color: var(--borders-form-field--active);
|
|
4855
4858
|
background-color: var(--borders-form-field--active);
|
|
4856
4859
|
fill: var(--text-reverse-primary);
|
|
4857
4860
|
color: var(--text-reverse-primary);
|
|
4858
4861
|
stroke: var(--text-reverse-primary);
|
|
4859
4862
|
}
|
|
4860
|
-
.zen-
|
|
4861
|
-
.zen-
|
|
4863
|
+
.zen-checkbox:has(.zen-checkbox__input:checked) .zen-checkbox__box .zen-checkbox__icon,
|
|
4864
|
+
.zen-checkbox:has(.zen-checkbox__input:indeterminate) .zen-checkbox__box .zen-checkbox__icon {
|
|
4862
4865
|
display: block;
|
|
4863
4866
|
}
|
|
4864
|
-
.zen-
|
|
4867
|
+
.zen-checkbox:has(.zen-checkbox__input:focus) .zen-checkbox__box,
|
|
4868
|
+
.zen-checkbox:has(.zen-checkbox__input:focus) .zen-checkbox__label {
|
|
4865
4869
|
outline: 1px solid var(--zen-checkbox-outline, var(--borders-form-field--active));
|
|
4866
4870
|
outline-offset: var(--border-width-default);
|
|
4867
4871
|
}
|
|
4868
4872
|
/* This was added because safari just added support for :focus-visible. Can be removed after 3 versions of safari browser. */
|
|
4869
4873
|
@supports selector(:focus-visible) {
|
|
4870
|
-
.zen-
|
|
4874
|
+
.zen-checkbox:has(.zen-checkbox__input:focus) .zen-checkbox__box,
|
|
4875
|
+
.zen-checkbox:has(.zen-checkbox__input:focus) .zen-checkbox__label {
|
|
4871
4876
|
outline: none;
|
|
4872
4877
|
}
|
|
4873
|
-
.zen-checkbox__input:focus-visible
|
|
4878
|
+
.zen-checkbox:has(.zen-checkbox__input:focus-visible) .zen-checkbox__box,
|
|
4879
|
+
.zen-checkbox:has(.zen-checkbox__input:focus-visible) .zen-checkbox__label {
|
|
4874
4880
|
outline: 1px solid var(--zen-checkbox-outline, var(--borders-form-field--active));
|
|
4875
4881
|
outline-offset: var(--border-width-default);
|
|
4876
4882
|
}
|
|
4877
4883
|
}
|
|
4878
|
-
.zen-checkbox__input:disabled
|
|
4884
|
+
.zen-checkbox:has(.zen-checkbox__input:disabled) .zen-checkbox__label {
|
|
4879
4885
|
fill: var(--text-reverse-primary);
|
|
4880
4886
|
color: var(--text-button-disabled);
|
|
4881
4887
|
}
|
|
4882
|
-
.zen-
|
|
4888
|
+
.zen-checkbox:has(.zen-checkbox__input:disabled) .zen-checkbox__box {
|
|
4883
4889
|
border-color: var(--borders-general);
|
|
4884
4890
|
background-color: var(--backgrounds-field-disabled);
|
|
4885
4891
|
}
|
|
4886
|
-
.zen-checkbox__input:disabled:checked
|
|
4887
|
-
.zen-checkbox__input:disabled:indeterminate
|
|
4892
|
+
.zen-checkbox:has(.zen-checkbox__input:disabled:checked) .zen-checkbox__box,
|
|
4893
|
+
.zen-checkbox:has(.zen-checkbox__input:disabled:indeterminate) .zen-checkbox__box {
|
|
4888
4894
|
border-color: var(--borders-general);
|
|
4889
4895
|
background-color: var(--borders-general);
|
|
4890
4896
|
}
|
|
@@ -23,7 +23,7 @@ const generateId_1 = require("../commonHelpers/generateId");
|
|
|
23
23
|
const pathProvider_1 = require("./contexts/pathProvider");
|
|
24
24
|
const menuSeparator_1 = require("./components/menuSeparator");
|
|
25
25
|
const focusableSelector_1 = require("../utils/focusableSelector");
|
|
26
|
-
const ControlledMenu = ({ children, isOpen, setIsOpen, triggerRef, ariaLabel, ariaLabelledby, id, title, className = "", listClassName = "", paddingX = 0, paddingY = 0, alignment }) => {
|
|
26
|
+
const ControlledMenu = ({ children, isOpen, setIsOpen, triggerRef, ariaLabel, ariaLabelledby, id, title, className = "", listClassName = "", paddingX = 0, paddingY = 0, alignment, closeOnScroll = true }) => {
|
|
27
27
|
const [deviceType, setDeviceType] = (0, react_1.useState)(deviceType_1.DeviceType.Desktop);
|
|
28
28
|
const isMobile = deviceType === deviceType_1.DeviceType.Mobile;
|
|
29
29
|
const memoizedOnChange = (0, react_1.useCallback)(setIsOpen, [setIsOpen]);
|
|
@@ -218,7 +218,7 @@ const ControlledMenu = ({ children, isOpen, setIsOpen, triggerRef, ariaLabel, ar
|
|
|
218
218
|
if (isMobile) {
|
|
219
219
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(pathProvider_1.PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { label: title, isOpen: isOpen, triggerRef: triggerRef, onHidePanel: hideMenu, onCloseClick: hideMenu, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { children: title }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: renderMenuList() })] }) }) }));
|
|
220
220
|
}
|
|
221
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(pathProvider_1.PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { id: id, useTrapFocusWithTrigger: "on", className: (0, classNames_1.classNames)(["zen-controlled-menu", className]), onOpenChange: memoizedOnChange, isOpen: isOpen, triggerRef: triggerRef, paddingX: paddingX, paddingY: paddingY, alignment: alignment, ariaLabelledby: ariaLabelledby, ariaLabel: ariaLabel || title,
|
|
221
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(pathProvider_1.PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { id: id, useTrapFocusWithTrigger: "on", className: (0, classNames_1.classNames)(["zen-controlled-menu", className]), onOpenChange: memoizedOnChange, isOpen: isOpen, triggerRef: triggerRef, paddingX: paddingX, paddingY: paddingY, alignment: alignment, ariaLabelledby: ariaLabelledby, ariaLabel: ariaLabel || title, closeOnScroll: closeOnScroll,
|
|
222
222
|
// focusOnOpen is false - ControlledMenu handles focus based on input method
|
|
223
223
|
// (keyboard vs mouse) in its own useEffect
|
|
224
224
|
focusOnOpen: false, children: renderMenuList() }) }) }));
|
|
@@ -22,8 +22,14 @@ export interface IAbsolute extends IZenComponentProps {
|
|
|
22
22
|
ariaLabelledby?: string;
|
|
23
23
|
alignmentsFn?: IAlignment;
|
|
24
24
|
recalculateOnScroll?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* When true, closes the popup on scroll instead of repositioning it.
|
|
27
|
+
* Mutually exclusive with `recalculateOnScroll` — setting both causes a
|
|
28
|
+
* wasted position recalculation before the popup closes.
|
|
29
|
+
*/
|
|
30
|
+
closeOnScroll?: boolean;
|
|
25
31
|
recalculateTrigger?: boolean;
|
|
26
32
|
/** Whether to focus the first focusable element when popup opens. Default: true */
|
|
27
33
|
focusOnOpen?: boolean;
|
|
28
34
|
}
|
|
29
|
-
export declare const Absolute: ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, recalculateTrigger, focusOnOpen }: IAbsolute) => import("react/jsx-runtime").JSX.Element | "" | null;
|
|
35
|
+
export declare const Absolute: ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, closeOnScroll, recalculateTrigger, focusOnOpen }: IAbsolute) => import("react/jsx-runtime").JSX.Element | "" | null;
|
package/esm/absolute/absolute.js
CHANGED
|
@@ -16,7 +16,7 @@ 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
|
-
export const Absolute = ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger = "off", shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, recalculateTrigger = true, focusOnOpen = true }) => {
|
|
19
|
+
export const Absolute = ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger = "off", shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, closeOnScroll, recalculateTrigger = true, focusOnOpen = true }) => {
|
|
20
20
|
const popupRef = useRef(null);
|
|
21
21
|
const prevScroll = useRef(0);
|
|
22
22
|
const { dark } = useContext(themeContext);
|
|
@@ -44,14 +44,18 @@ export const Absolute = ({ isOpen, id, paddingX, paddingY, className, children,
|
|
|
44
44
|
return "";
|
|
45
45
|
};
|
|
46
46
|
const parent = useMemo(() => {
|
|
47
|
-
if (!isOpen || !recalculateOnScroll) {
|
|
47
|
+
if (!isOpen || (!recalculateOnScroll && !closeOnScroll)) {
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
50
|
return getScrollableParent(triggerRef.current);
|
|
51
|
-
}, [triggerRef, isOpen, recalculateOnScroll]);
|
|
51
|
+
}, [triggerRef, isOpen, recalculateOnScroll, closeOnScroll]);
|
|
52
52
|
const calculatePosition = useCallback(() => calculatePos(triggerRef, popupRef, paddingX, paddingY, inline, alignment, alignmentsFn, parent ? parent : undefined), [triggerRef, paddingX, paddingY, inline, alignment, alignmentsFn, popupRef, parent]);
|
|
53
|
+
const handleCloseOnScroll = useCallback(() => {
|
|
54
|
+
onOpenChange(false);
|
|
55
|
+
}, [onOpenChange]);
|
|
53
56
|
useResize(calculatePosition, isOpen);
|
|
54
|
-
useScroll(calculatePosition, isOpen, parent);
|
|
57
|
+
useScroll(calculatePosition, isOpen && !!recalculateOnScroll, parent);
|
|
58
|
+
useScroll(handleCloseOnScroll, isOpen && !!closeOnScroll, parent);
|
|
55
59
|
useLayoutEffect(calculatePosition, [isOpen, children, recalculateTrigger, calculatePosition]);
|
|
56
60
|
function handleEscape() {
|
|
57
61
|
onOpenChange(false);
|
|
@@ -6,10 +6,21 @@ export interface IBetaPillActions {
|
|
|
6
6
|
link?: string;
|
|
7
7
|
linkOptions?: ILinkOptions;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface IBetaPillBase {
|
|
10
10
|
className?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
}
|
|
13
|
+
interface IBetaPillWithActions extends IBetaPillBase {
|
|
11
14
|
feedbackAction?: IBetaPillActions;
|
|
12
15
|
betaOptionAction?: IBetaPillActions;
|
|
16
|
+
description?: string;
|
|
17
|
+
}
|
|
18
|
+
interface IBetaPillWithoutActions extends IBetaPillBase {
|
|
19
|
+
feedbackAction?: never;
|
|
20
|
+
betaOptionAction?: never;
|
|
21
|
+
description?: never;
|
|
13
22
|
}
|
|
14
|
-
export
|
|
23
|
+
export type IBetaPill = IBetaPillWithActions | IBetaPillWithoutActions;
|
|
24
|
+
export declare const BetaPill: ({ className, feedbackAction, betaOptionAction, name, description }: IBetaPill) => import("react/jsx-runtime").JSX.Element;
|
|
15
25
|
export declare const TRANSLATIONS: string[];
|
|
26
|
+
export {};
|
package/esm/betaPill/betaPill.js
CHANGED
|
@@ -119,7 +119,9 @@ injectString("ar-SA", "Beta", "\u062A\u062C\u0631\u064A\u0628\u064A");
|
|
|
119
119
|
export const BetaPill = ({
|
|
120
120
|
className,
|
|
121
121
|
feedbackAction,
|
|
122
|
-
betaOptionAction
|
|
122
|
+
betaOptionAction,
|
|
123
|
+
name,
|
|
124
|
+
description
|
|
123
125
|
}) => {
|
|
124
126
|
const {
|
|
125
127
|
translate
|
|
@@ -139,8 +141,8 @@ export const BetaPill = ({
|
|
|
139
141
|
return _jsx(PillExpandable, {
|
|
140
142
|
isBeta: true,
|
|
141
143
|
icon: IconLab,
|
|
142
|
-
description: translate("This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements."),
|
|
143
|
-
text: translate("Beta"),
|
|
144
|
+
description: description !== null && description !== void 0 ? description : translate("This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements."),
|
|
145
|
+
text: name !== null && name !== void 0 ? name : translate("Beta"),
|
|
144
146
|
type: "info",
|
|
145
147
|
className: pillClasses,
|
|
146
148
|
mainAction: resolvedMainAction,
|
|
@@ -153,7 +155,7 @@ export const BetaPill = ({
|
|
|
153
155
|
type: "info",
|
|
154
156
|
children: !isMobile && _jsx("span", {
|
|
155
157
|
className: "zen-caption__content",
|
|
156
|
-
children: translate("Beta")
|
|
158
|
+
children: name !== null && name !== void 0 ? name : translate("Beta")
|
|
157
159
|
})
|
|
158
160
|
});
|
|
159
161
|
};
|
package/esm/checkbox/checkbox.js
CHANGED
|
@@ -28,9 +28,9 @@ export const Checkbox = (_a) => {
|
|
|
28
28
|
const isMobile = useMobile();
|
|
29
29
|
const checkboxIconClasses = useMemo(() => classNames(["zen-checkbox__icon", disabled ? "zen-checkbox__icon--disabled" : ""]), [disabled]);
|
|
30
30
|
const checkbox = (_jsx(TriStateCheckbox, Object.assign({ className: "zen-checkbox__input", id: intId, checked: checked, indeterminate: indeterminate, disabled: disabled, "aria-label": title, "aria-describedby": describedBy }, rest)));
|
|
31
|
-
const iconAndLabel = (_jsxs(_Fragment, { children: [_jsx("div", { className: "zen-checkbox__box", children: state === CheckboxState.Indeterminate ? (_jsx(CheckboxIconMinus, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : state === CheckboxState.On ? (_jsx(CheckboxIconCheckmark, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : null }), children ? (_jsx("div", { className: classNames(["zen-checkbox__label-text", fullWidth ? "zen-checkbox__label-text--full-width" : ""]), children: children })) : null] }));
|
|
31
|
+
const iconAndLabel = (_jsxs(_Fragment, { children: [_jsx("div", { className: "zen-checkbox__box", "aria-hidden": true, children: state === CheckboxState.Indeterminate ? (_jsx(CheckboxIconMinus, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : state === CheckboxState.On ? (_jsx(CheckboxIconCheckmark, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : null }), children ? (_jsx("div", { className: classNames(["zen-checkbox__label-text", fullWidth ? "zen-checkbox__label-text--full-width" : ""]), children: children })) : null] }));
|
|
32
32
|
if (wrapped) {
|
|
33
33
|
return (_jsxs("label", { className: classNames(["zen-checkbox", driveClasses || "", className]), title: title, children: [checkbox, _jsx("div", { className: classNames(["zen-checkbox__label", reverse ? "zen-checkbox__label--reverse" : ""]), children: iconAndLabel })] }));
|
|
34
34
|
}
|
|
35
|
-
return (
|
|
35
|
+
return (_jsx("div", { className: classNames(["zen-checkbox", isMobile && !driveClasses ? "zen-checkbox--mobile" : "", driveClasses || "", className]), children: _jsxs("label", { className: classNames(["zen-checkbox__label", reverse ? "zen-checkbox__label--reverse" : ""]), title: title, children: [checkbox, iconAndLabel] }) }));
|
|
36
36
|
};
|
|
@@ -23,8 +23,9 @@ export interface IControlledPopup extends IZenComponentProps {
|
|
|
23
23
|
ariaLabel?: string;
|
|
24
24
|
ariaLabelledby?: string;
|
|
25
25
|
recalculateOnScroll?: boolean;
|
|
26
|
+
closeOnScroll?: boolean;
|
|
26
27
|
preventAttributesAutoSet?: boolean;
|
|
27
28
|
/** Whether to focus the first focusable element when popup opens. Default: true */
|
|
28
29
|
focusOnOpen?: boolean;
|
|
29
30
|
}
|
|
30
|
-
export declare const ControlledPopup: ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, preventAttributesAutoSet, focusOnOpen, role }: IControlledPopup) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare const ControlledPopup: ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, closeOnScroll, preventAttributesAutoSet, focusOnOpen, role }: IControlledPopup) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { useEffect, useId } from "react";
|
|
|
3
3
|
import { Absolute } from "../absolute/absolute";
|
|
4
4
|
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
5
5
|
import { useClientReady } from "../commonHelpers/hooks/useClientReady";
|
|
6
|
-
export const ControlledPopup = ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, preventAttributesAutoSet, focusOnOpen, role = "dialog" }) => {
|
|
6
|
+
export const ControlledPopup = ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, closeOnScroll, preventAttributesAutoSet, focusOnOpen, role = "dialog" }) => {
|
|
7
7
|
const autoId = useId();
|
|
8
8
|
const popupId = id || autoId;
|
|
9
9
|
const isClientReady = useClientReady();
|
|
@@ -21,5 +21,5 @@ export const ControlledPopup = ({ isOpen, id, paddingX, paddingY, triggerRef, cl
|
|
|
21
21
|
triggerRef.current.setAttribute("aria-expanded", isOpen ? "true" : "false");
|
|
22
22
|
triggerRef.current.setAttribute("aria-controls", popupId);
|
|
23
23
|
}, [triggerRef, isOpen, popupId, preventAttributesAutoSet, isClientReady]);
|
|
24
|
-
return (_jsx(Absolute, Object.assign({ 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 !== false && typeof role === "string" ? { role } : {}), (role !== false && ariaLabel ? { ariaLabel } : {}), (role !== false && ariaLabelledby ? { ariaLabelledby } : {}), { recalculateOnScroll: recalculateOnScroll, focusOnOpen: focusOnOpen, children: children })));
|
|
24
|
+
return (_jsx(Absolute, Object.assign({ 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 !== false && typeof role === "string" ? { role } : {}), (role !== false && ariaLabel ? { ariaLabel } : {}), (role !== false && ariaLabelledby ? { ariaLabelledby } : {}), { recalculateOnScroll: recalculateOnScroll, closeOnScroll: closeOnScroll, focusOnOpen: focusOnOpen, children: children })));
|
|
25
25
|
};
|
|
@@ -16,9 +16,11 @@ export interface IHeaderTitle extends IZenComponentProps {
|
|
|
16
16
|
allowBookmarkWithBack?: boolean;
|
|
17
17
|
feedBackAction?: IBetaPillActions;
|
|
18
18
|
betaOptionAction?: IBetaPillActions;
|
|
19
|
+
betaPillName?: string;
|
|
20
|
+
betaPillDescription?: string;
|
|
19
21
|
}
|
|
20
22
|
export declare const HeaderTitle: {
|
|
21
|
-
({ id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction }: IHeaderTitle): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
({ id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction, betaPillName, betaPillDescription }: IHeaderTitle): import("react/jsx-runtime").JSX.Element;
|
|
22
24
|
displayName: string;
|
|
23
25
|
};
|
|
24
26
|
export declare const TRANSLATIONS: string[];
|
|
@@ -7,7 +7,7 @@ import { useDriveClassName } from "../utils/theme/useDriveClassName";
|
|
|
7
7
|
import { HeaderBack } from "../header/headerBack";
|
|
8
8
|
import { Bookmark } from "../bookmark/bookmark";
|
|
9
9
|
export const HeaderTitleDisplayName = "PageHeader";
|
|
10
|
-
export const HeaderTitle = ({ id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction }) => {
|
|
10
|
+
export const HeaderTitle = ({ id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction, betaPillName, betaPillDescription }) => {
|
|
11
11
|
const isMobile = useMobile();
|
|
12
12
|
const driveMainLineClassName = useDriveClassName("zen-page-header__main-line");
|
|
13
13
|
const drivePageNameClassName = useDriveClassName("zen-page-header__page-name");
|
|
@@ -30,7 +30,7 @@ export const HeaderTitle = ({ id, children, className, pageName, subline, isBeta
|
|
|
30
30
|
});
|
|
31
31
|
return [b, b.length && !allowBookmarkWithBack ? o.filter(el => el.type !== Bookmark) : o];
|
|
32
32
|
}, [children, allowBookmarkWithBack]);
|
|
33
|
-
return (_jsxs("header", { id: id, className: clsNames, children: [_jsxs("div", { className: classNames(["zen-page-header__main-line", driveMainLineClassName || ""]), children: [back.length ? back : null, pageName ? _jsx("h1", { className: classNames(["zen-page-header__page-name", drivePageNameClassName || ""]), children: pageName }) : null, isBeta ? _jsx(BetaPill, { feedbackAction: feedBackAction, betaOptionAction: betaOptionAction, className: "zen-page-header__beta" }) : null, other.length ? other : null] }), subline || ""] }));
|
|
33
|
+
return (_jsxs("header", { id: id, className: clsNames, children: [_jsxs("div", { className: classNames(["zen-page-header__main-line", driveMainLineClassName || ""]), children: [back.length ? back : null, pageName ? _jsx("h1", { className: classNames(["zen-page-header__page-name", drivePageNameClassName || ""]), children: pageName }) : null, isBeta ? (_jsx(BetaPill, { feedbackAction: feedBackAction, betaOptionAction: betaOptionAction, name: betaPillName, description: betaPillDescription, className: "zen-page-header__beta" })) : null, other.length ? other : null] }), subline || ""] }));
|
|
34
34
|
};
|
|
35
35
|
HeaderTitle.displayName = HeaderTitleDisplayName;
|
|
36
36
|
export const TRANSLATIONS = [...BetaPillTranslations];
|
|
@@ -20,7 +20,7 @@ import { generateId } from "../commonHelpers/generateId";
|
|
|
20
20
|
import { PathProvider } from "./contexts/pathProvider";
|
|
21
21
|
import { isSeparator, MenuSeparator } from "./components/menuSeparator";
|
|
22
22
|
import { FOCUSABLE_SELECTOR } from "../utils/focusableSelector";
|
|
23
|
-
export const ControlledMenu = ({ children, isOpen, setIsOpen, triggerRef, ariaLabel, ariaLabelledby, id, title, className = "", listClassName = "", paddingX = 0, paddingY = 0, alignment }) => {
|
|
23
|
+
export const ControlledMenu = ({ children, isOpen, setIsOpen, triggerRef, ariaLabel, ariaLabelledby, id, title, className = "", listClassName = "", paddingX = 0, paddingY = 0, alignment, closeOnScroll = true }) => {
|
|
24
24
|
const [deviceType, setDeviceType] = useState(DeviceType.Desktop);
|
|
25
25
|
const isMobile = deviceType === DeviceType.Mobile;
|
|
26
26
|
const memoizedOnChange = useCallback(setIsOpen, [setIsOpen]);
|
|
@@ -215,7 +215,7 @@ export const ControlledMenu = ({ children, isOpen, setIsOpen, triggerRef, ariaLa
|
|
|
215
215
|
if (isMobile) {
|
|
216
216
|
return (_jsx(_Fragment, { children: _jsx(PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: _jsxs(MobileSheet, { label: title, isOpen: isOpen, triggerRef: triggerRef, onHidePanel: hideMenu, onCloseClick: hideMenu, children: [_jsx(MobileSheet.Title, { children: title }), _jsx(MobileSheet.Content, { children: renderMenuList() })] }) }) }));
|
|
217
217
|
}
|
|
218
|
-
return (_jsx(_Fragment, { children: _jsx(PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: _jsx(ControlledPopup, { id: id, useTrapFocusWithTrigger: "on", className: classNames(["zen-controlled-menu", className]), onOpenChange: memoizedOnChange, isOpen: isOpen, triggerRef: triggerRef, paddingX: paddingX, paddingY: paddingY, alignment: alignment, ariaLabelledby: ariaLabelledby, ariaLabel: ariaLabel || title,
|
|
218
|
+
return (_jsx(_Fragment, { children: _jsx(PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: _jsx(ControlledPopup, { id: id, useTrapFocusWithTrigger: "on", className: classNames(["zen-controlled-menu", className]), onOpenChange: memoizedOnChange, isOpen: isOpen, triggerRef: triggerRef, paddingX: paddingX, paddingY: paddingY, alignment: alignment, ariaLabelledby: ariaLabelledby, ariaLabel: ariaLabel || title, closeOnScroll: closeOnScroll,
|
|
219
219
|
// focusOnOpen is false - ControlledMenu handles focus based on input method
|
|
220
220
|
// (keyboard vs mouse) in its own useEffect
|
|
221
221
|
focusOnOpen: false, children: renderMenuList() }) }) }));
|