@gravity-ui/navigation 3.4.0 → 3.5.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/build/cjs/components/AsideHeader/__stories__/AsideHeader.stories.d.ts +1 -0
- package/build/cjs/components/AsideHeader/__stories__/moc.d.ts +7 -0
- package/build/cjs/components/AsideHeader/components/CollapseButton/CollapseButton.d.ts +1 -1
- package/build/cjs/components/AsideHeader/types.d.ts +4 -0
- package/build/cjs/components/Drawer/Drawer.d.ts +4 -2
- package/build/cjs/{index-Duvas6w0.js → index-CCk1YYhe.js} +2 -2
- package/build/cjs/{index-Duvas6w0.js.map → index-CCk1YYhe.js.map} +1 -1
- package/build/cjs/{index-D40EbfWh.js → index-xx_lPj0v.js} +39 -19
- package/build/cjs/index-xx_lPj0v.js.map +1 -0
- package/build/cjs/index.js +1 -1
- package/build/esm/components/AsideHeader/__stories__/AsideHeader.stories.d.ts +1 -0
- package/build/esm/components/AsideHeader/__stories__/moc.d.ts +7 -0
- package/build/esm/components/AsideHeader/components/CollapseButton/CollapseButton.d.ts +1 -1
- package/build/esm/components/AsideHeader/types.d.ts +4 -0
- package/build/esm/components/Drawer/Drawer.d.ts +4 -2
- package/build/esm/{index-BHcJfNP_.js → index-B84DSZte.js} +2 -2
- package/build/esm/{index-BHcJfNP_.js.map → index-B84DSZte.js.map} +1 -1
- package/build/esm/{index-DWA-PD7D.js → index-C5bzWe6L.js} +39 -19
- package/build/esm/index-C5bzWe6L.js.map +1 -0
- package/build/esm/index.js +1 -1
- package/package.json +1 -1
- package/build/cjs/index-D40EbfWh.js.map +0 -1
- package/build/esm/index-DWA-PD7D.js.map +0 -1
package/build/cjs/index.js
CHANGED
|
@@ -16,3 +16,4 @@ export declare const Fallback: import("@storybook/csf").AnnotatedStoryFn<import(
|
|
|
16
16
|
}>;
|
|
17
17
|
/** @type {StoryFn} */
|
|
18
18
|
export declare function LineClamp(): React.JSX.Element;
|
|
19
|
+
export declare const CollapseButtonWrapper: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("@storybook/csf").Args>;
|
|
@@ -3,4 +3,11 @@ import { AsideHeaderProps } from '../types';
|
|
|
3
3
|
export declare const EMPTY_CONTEXT_VALUE: AsideHeaderContextType;
|
|
4
4
|
export declare const menuItemsShowcase: AsideHeaderProps['menuItems'];
|
|
5
5
|
export declare const text = "\nDid you attend? He sang by grove ripe -\nThe bard of love, the singer of his mourning.\nWhen fields were silent by the early morning,\nTo sad and simple sounds of a pipe\nDid you attend?\n\nDid you behold in dark of forest leaf\nThe bard of love, the singer of his sadness?\nThe trace of tears, the smile, the utter paleness,\nThe quiet look, full of eternal grief,\nDid you behold?\n\nThen did you sigh when hearing how cries\nThe bard of love, the singer of his dole?\nWhen in the woods you saw the young man, sole,\nAnd met the look of his extinguished eyes,\nThen did you sigh?\n";
|
|
6
|
+
export declare const DEFAULT_LOGO: {
|
|
7
|
+
text: string;
|
|
8
|
+
icon: import("node_modules/@gravity-ui/uikit/build/esm/components/Icon/types").SVGIconData;
|
|
9
|
+
href: string;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
'aria-label': string;
|
|
12
|
+
};
|
|
6
13
|
export declare const menuItemsClamped: import("../..").MenuItem[];
|
|
@@ -3,4 +3,4 @@ import './CollapseButton.scss';
|
|
|
3
3
|
export interface CollapseButtonProps {
|
|
4
4
|
className?: string;
|
|
5
5
|
}
|
|
6
|
-
export declare const CollapseButton: ({ className }: CollapseButtonProps) => React.JSX.Element;
|
|
6
|
+
export declare const CollapseButton: ({ className }: CollapseButtonProps) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
@@ -32,6 +32,10 @@ export interface AsideHeaderGeneralProps extends QAProps {
|
|
|
32
32
|
compact: boolean;
|
|
33
33
|
asideRef: React.RefObject<HTMLDivElement>;
|
|
34
34
|
}) => React.ReactNode;
|
|
35
|
+
collapseButtonWrapper?: (defaultButton: React.ReactNode, data: {
|
|
36
|
+
compact: boolean;
|
|
37
|
+
onChangeCompact?: (compact: boolean) => void;
|
|
38
|
+
}) => React.ReactNode;
|
|
35
39
|
editMenuProps?: EditMenuProps;
|
|
36
40
|
onClosePanel?: () => void;
|
|
37
41
|
onChangeCompact?: (compact: boolean) => void;
|
|
@@ -49,6 +49,8 @@ export interface DrawerItemProps {
|
|
|
49
49
|
* @default false
|
|
50
50
|
* */
|
|
51
51
|
keepMounted?: boolean;
|
|
52
|
+
/** Optional inline styles to be applied to the DrawerItem component. */
|
|
53
|
+
style?: React.CSSProperties;
|
|
52
54
|
}
|
|
53
55
|
export declare const DrawerItem: React.ForwardRefExoticComponent<DrawerItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
54
56
|
type DrawerChild = React.ReactElement<DrawerItemProps>;
|
|
@@ -63,11 +65,11 @@ export interface DrawerProps {
|
|
|
63
65
|
veilClassName?: string;
|
|
64
66
|
/** Optional callback function that is called when the veil (overlay) is clicked. */
|
|
65
67
|
onVeilClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
66
|
-
/** Optional callback function that is called when the escape key is pressed
|
|
68
|
+
/** Optional callback function that is called when the escape key is pressed if the drawer is open. */
|
|
67
69
|
onEscape?: (event: KeyboardEvent) => void;
|
|
68
70
|
/** Optional flag to hide the background darkening */
|
|
69
71
|
hideVeil?: boolean;
|
|
70
|
-
/** Optional flag to
|
|
72
|
+
/** Optional flag to doesn't use `Portal` for drawer */
|
|
71
73
|
disablePortal?: boolean;
|
|
72
74
|
/**
|
|
73
75
|
* Keep child components mounted when closed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { Alert, Text } from '@gravity-ui/uikit';
|
|
3
|
-
import { d as debounceFn, s as styleInject, b as block } from './index-
|
|
3
|
+
import { d as debounceFn, s as styleInject, b as block } from './index-C5bzWe6L.js';
|
|
4
4
|
import '@bem-react/classname';
|
|
5
5
|
import '@gravity-ui/icons';
|
|
6
6
|
import '@gravity-ui/uikit/i18n';
|
|
@@ -65,4 +65,4 @@ const TopAlert = ({ alert, className, mobileView = false }) => {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
export { TopAlert };
|
|
68
|
-
//# sourceMappingURL=index-
|
|
68
|
+
//# sourceMappingURL=index-B84DSZte.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-B84DSZte.js","sources":["../../../src/components/TopAlert/useTopAlertHeight.ts","../../../src/components/TopAlert/TopAlert.tsx"],"sourcesContent":["import React from 'react';\n\nimport debounceFn from 'lodash/debounce';\n\nimport {TopAlertProps} from '../types';\n\ntype TopAlertHeightControls = {\n alertRef: React.RefObject<HTMLDivElement>;\n updateTopSize: () => void;\n};\n\nconst G_ROOT_CLASS_NAME = 'g-root';\n\nexport const useTopAlertHeight = ({alert}: {alert?: TopAlertProps}): TopAlertHeightControls => {\n const alertRef = React.useRef<HTMLDivElement>(null);\n\n const setAsideTopPanelHeight = React.useCallback((clientHeight: number) => {\n const gRootElement = document\n .getElementsByClassName(G_ROOT_CLASS_NAME)\n .item(0) as HTMLElement | null;\n gRootElement?.style.setProperty('--gn-top-alert-height', clientHeight + 'px');\n }, []);\n\n const updateTopSize = React.useCallback(() => {\n setAsideTopPanelHeight(alertRef.current?.clientHeight || 0);\n }, [setAsideTopPanelHeight]);\n\n React.useLayoutEffect(() => {\n const updateTopSizeDebounce = debounceFn(updateTopSize, 200, {leading: true});\n\n if (alert) {\n window.addEventListener('resize', updateTopSizeDebounce);\n updateTopSizeDebounce();\n }\n return () => {\n window.removeEventListener('resize', updateTopSizeDebounce);\n setAsideTopPanelHeight(0);\n };\n }, [alert, alertRef, updateTopSize, setAsideTopPanelHeight]);\n\n return {\n alertRef,\n updateTopSize,\n };\n};\n","import React from 'react';\n\nimport {Alert, Text} from '@gravity-ui/uikit';\n\nimport {TopAlertProps} from '../types';\nimport {block} from '../utils/cn';\n\nimport {useTopAlertHeight} from './useTopAlertHeight';\n\nimport './TopAlert.scss';\n\nconst b = block('top-alert');\n\ntype Props = {\n alert?: TopAlertProps;\n className?: string;\n mobileView?: boolean;\n};\n\nexport const TopAlert = ({alert, className, mobileView = false}: Props) => {\n const {alertRef, updateTopSize} = useTopAlertHeight({alert});\n\n const [opened, setOpened] = React.useState(true);\n\n const handleClose = React.useCallback(() => {\n setOpened(false);\n alert?.onCloseTopAlert?.();\n }, [alert]);\n\n React.useEffect(() => {\n if (!opened) {\n updateTopSize();\n }\n }, [opened, updateTopSize]);\n\n if (!alert || !alert.message) {\n return null;\n }\n\n return (\n <div\n ref={alertRef}\n className={b('wrapper', {'with-bottom-border': !mobileView && opened}, className)}\n >\n {opened && (\n <Alert\n className={b('', {\n centered: alert.centered,\n dense: alert.dense,\n })}\n corners=\"square\"\n layout=\"horizontal\"\n align={alert.align}\n theme={alert.theme || 'warning'}\n view={alert.view}\n icon={alert.icon}\n title={alert.title}\n message={\n mobileView ? (\n <Text ellipsisLines={5} variant=\"body-2\">\n {alert.message}\n </Text>\n ) : (\n alert.message\n )\n }\n actions={alert.actions}\n onClose={alert.closable ? handleClose : undefined}\n />\n )}\n </div>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;AAWA,MAAM,iBAAiB,GAAG,QAAQ;AAE3B,MAAM,iBAAiB,GAAG,CAAC,EAAC,KAAK,EAA0B,KAA4B;IAC1F,MAAM,QAAQ,GAAGA,cAAK,CAAC,MAAM,CAAiB,IAAI,CAAC;IAEnD,MAAM,sBAAsB,GAAGA,cAAK,CAAC,WAAW,CAAC,CAAC,YAAoB,KAAI;QACtE,MAAM,YAAY,GAAG;aAChB,sBAAsB,CAAC,iBAAiB;aACxC,IAAI,CAAC,CAAC,CAAuB;AAClC,QAAA,YAAY,KAAZ,IAAA,IAAA,YAAY,KAAZ,SAAA,GAAA,SAAA,GAAA,YAAY,CAAE,KAAK,CAAC,WAAW,CAAC,uBAAuB,EAAE,YAAY,GAAG,IAAI,CAA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K,CAAC,QAAQ,GAAG,WAAW,GAAG,SAAS,EACnD,CAAA,CACL,CACC;AAEd;;;;"}
|
|
@@ -121,7 +121,7 @@ function styleInject(css, ref) {
|
|
|
121
121
|
var css_248z$u = ".g-root{--gn-aside-top-panel-height:0px}.gn-aside-header{--gn-aside-header-min-width:56px;--_--item-icon-background-size:38px;--_--background-color:var(--g-color-base-background);--_--decoration-collapsed-background-color:var(--g-color-base-warning-light);--_--decoration-expanded-background-color:var(--g-color-base-warning-light);--_--vertical-divider-line-color:var(--g-color-line-generic);--_--horizontal-divider-line-color:var(--g-color-line-generic);background-color:var(--g-color-base-background);height:100%;position:relative;width:100%}.gn-aside-header__aside{background-color:var(--gn-aside-header-expanded-background-color,var(--gn-aside-header-background-color,var(--_--background-color)));box-sizing:border-box;display:flex;flex-direction:column;height:100vh;left:0;margin-top:var(--gn-top-alert-height,0);max-height:calc(100vh - var(--gn-top-alert-height, 0));position:sticky;top:var(--gn-top-alert-height,0);width:inherit;z-index:var(--gn-aside-header-z-index,100)}.gn-aside-header__aside:after{background-color:var(--gn-aside-header-divider-vertical-color,var(--_--vertical-divider-line-color));content:\"\";height:100%;position:absolute;right:0;top:0;width:1px;z-index:2}.gn-aside-header__aside-popup-anchor{inset:0;position:absolute;z-index:1}.gn-aside-header__aside-content{--gradient-height:334px;display:flex;flex-direction:column;height:inherit;overflow-x:hidden;padding-top:var(--gn-aside-header-padding-top);position:relative;user-select:none;width:inherit;z-index:2}.gn-aside-header__aside-content>.gn-aside-header-logo{margin:8px 0}.gn-aside-header__aside-content_with-decoration{background:linear-gradient(180deg,var(--gn-aside-header-decoration-expanded-background-color,var(--_--decoration-expanded-background-color)) calc(var(--gradient-height)*.33),transparent calc(var(--gradient-height)*.88))}.gn-aside-header__aside-custom-background{bottom:0;display:flex;position:absolute;top:0;width:var(--gn-aside-header-size);z-index:-1}.gn-aside-header_compact .gn-aside-header__aside{background-color:var(--gn-aside-header-collapsed-background-color,var(--gn-aside-header-background-color,var(--_--background-color)))}.gn-aside-header_compact .gn-aside-header__aside-content{background:transparent}.gn-aside-header__header{--gn-aside-header-header-divider-height:29px;box-sizing:border-box;flex:none;padding-bottom:22px;padding-top:8px;position:relative;width:100%;z-index:1}.gn-aside-header__header .gn-aside-header__header-divider{bottom:0;color:var(--gn-aside-header-decoration-collapsed-background-color,var(--_--decoration-collapsed-background-color));display:none;left:0;position:absolute;z-index:-2}.gn-aside-header__header_with-decoration:before{background-color:var(--gn-aside-header-decoration-collapsed-background-color,var(--_--decoration-collapsed-background-color));content:\"\";display:none;height:calc(100% - var(--gn-aside-header-header-divider-height));left:0;position:absolute;top:0;width:100%;z-index:-2}.gn-aside-header__header:after{background-color:var(--gn-aside-header-divider-horizontal-color,var(--_--horizontal-divider-line-color));bottom:12px;content:\"\";height:1px;left:0;position:absolute;width:100%;z-index:-2}.gn-aside-header_compact .gn-aside-header__header:before,.gn-aside-header_compact .gn-aside-header__header_with-decoration .gn-aside-header__header-divider{display:block}.gn-aside-header_compact .gn-aside-header__header_with-decoration:after{display:none}.gn-aside-header__logo-button .gn-aside-header__logo-icon-place{height:var(--gn-aside-header-item-icon-background-size,var(--_--item-icon-background-size));width:var(--gn-aside-header-min-width)}.gn-aside-header__menu-items{flex-grow:1}.gn-aside-header__footer{display:flex;flex-direction:column;flex-shrink:0;margin:8px 0;width:100%}.gn-aside-header__panels{inset:var(--gn-top-alert-height,0) 0 0;max-height:calc(100vh - var(--gn-top-alert-height, 0));overflow:auto;position:fixed;z-index:var(--gn-aside-header-panel-z-index,98)}.gn-aside-header__panel{height:100%}.gn-aside-header__pane-container{display:flex;flex-direction:row;outline:none;overflow:visible;user-select:text}.gn-aside-header__top-alert{background:var(--g-color-base-background);position:fixed;top:0;width:100%;z-index:var(--gn-aside-header-pane-top-z-index,98)}.gn-aside-header__content{margin-top:var(--gn-top-alert-height,0);width:calc(100% - var(--gn-aside-header-size));z-index:var(--gn-aside-header-content-z-index,95)}";
|
|
122
122
|
styleInject(css_248z$u);
|
|
123
123
|
|
|
124
|
-
const TopAlert$1 = React__default.lazy(() => import('./index-
|
|
124
|
+
const TopAlert$1 = React__default.lazy(() => import('./index-B84DSZte.js').then((module) => ({ default: module.TopAlert })));
|
|
125
125
|
const Layout = ({ compact, className, children, topAlert }) => {
|
|
126
126
|
const size = compact ? ASIDE_HEADER_COMPACT_WIDTH : ASIDE_HEADER_EXPANDED_WIDTH;
|
|
127
127
|
const asideHeaderContextValue = useMemo(() => ({ size, compact }), [compact, size]);
|
|
@@ -1878,15 +1878,19 @@ styleInject(css_248z$n);
|
|
|
1878
1878
|
|
|
1879
1879
|
const b$o = block('collapse-button');
|
|
1880
1880
|
const CollapseButton = ({ className }) => {
|
|
1881
|
-
const { onChangeCompact, compact, expandTitle, collapseTitle } = useAsideHeaderInnerContext();
|
|
1881
|
+
const { onChangeCompact, compact, expandTitle, collapseTitle, collapseButtonWrapper } = useAsideHeaderInnerContext();
|
|
1882
1882
|
const onCollapseButtonClick = useCallback(() => {
|
|
1883
1883
|
onChangeCompact === null || onChangeCompact === undefined ? undefined : onChangeCompact(!compact);
|
|
1884
1884
|
}, [compact, onChangeCompact]);
|
|
1885
1885
|
const buttonTitle = compact
|
|
1886
1886
|
? expandTitle || i18n$3('button_expand')
|
|
1887
1887
|
: collapseTitle || i18n$3('button_collapse');
|
|
1888
|
-
|
|
1888
|
+
const defaultButton = (React__default.createElement("button", { className: b$o({ compact }, className), onClick: onCollapseButtonClick, title: buttonTitle },
|
|
1889
1889
|
React__default.createElement(Icon, { data: SvgControlMenuButton, className: b$o('icon'), width: "16", height: "10" })));
|
|
1890
|
+
if (collapseButtonWrapper) {
|
|
1891
|
+
return collapseButtonWrapper(defaultButton, { compact, onChangeCompact });
|
|
1892
|
+
}
|
|
1893
|
+
return defaultButton;
|
|
1890
1894
|
};
|
|
1891
1895
|
|
|
1892
1896
|
var css_248z$m = ".gn-logo{height:40px}.gn-logo,.gn-logo__btn-logo{align-items:center;display:flex}.gn-logo__btn-logo{cursor:pointer;flex-shrink:0;justify-content:center}.gn-logo__btn-logo,.gn-logo__btn-logo:active,.gn-logo__btn-logo:focus,.gn-logo__btn-logo:hover,.gn-logo__btn-logo:visited{color:inherit;outline:none;text-decoration:none}.gn-logo__btn-logo:focus-visible{outline:solid var(--g-color-line-misc);outline-offset:-2px}.gn-logo__logo-icon-place{align-items:center;display:flex;justify-content:center;width:36px}";
|
|
@@ -4471,7 +4475,7 @@ styleInject(css_248z$l);
|
|
|
4471
4475
|
const b$m = block('drawer');
|
|
4472
4476
|
const TIMEOUT = 300;
|
|
4473
4477
|
const DrawerItem = React__default.forwardRef(function DrawerItem(props, ref) {
|
|
4474
|
-
const { visible, content, children, direction = 'left', className, resizable, width, minResizeWidth, maxResizeWidth, onResizeStart, onResizeContinue, onResize, keepMounted = false, } = props;
|
|
4478
|
+
const { visible, content, children, direction = 'left', className, resizable, width, minResizeWidth, maxResizeWidth, onResizeStart, onResizeContinue, onResize, keepMounted = false, style = {}, } = props;
|
|
4475
4479
|
const [isInitialRender, setInitialRender] = React__default.useState(true);
|
|
4476
4480
|
const itemRef = React__default.useRef(null);
|
|
4477
4481
|
const handleRef = useForkRef(ref, itemRef);
|
|
@@ -4485,15 +4489,18 @@ const DrawerItem = React__default.forwardRef(function DrawerItem(props, ref) {
|
|
|
4485
4489
|
onResize,
|
|
4486
4490
|
onResizeContinue,
|
|
4487
4491
|
});
|
|
4488
|
-
const
|
|
4489
|
-
|
|
4490
|
-
if (
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4492
|
+
const innerStyle = React__default.useMemo(() => {
|
|
4493
|
+
const css = Object.assign({}, style);
|
|
4494
|
+
if (resizable) {
|
|
4495
|
+
if (['left', 'right'].includes(direction)) {
|
|
4496
|
+
css.width = `${resizedWidth}px`;
|
|
4497
|
+
}
|
|
4498
|
+
else {
|
|
4499
|
+
css.height = `${resizedWidth}px`;
|
|
4500
|
+
}
|
|
4495
4501
|
}
|
|
4496
|
-
|
|
4502
|
+
return css;
|
|
4503
|
+
}, [direction, resizable, resizedWidth, style]);
|
|
4497
4504
|
React__default.useEffect(() => {
|
|
4498
4505
|
setInitialRender(true);
|
|
4499
4506
|
}, [direction]);
|
|
@@ -4504,7 +4511,7 @@ const DrawerItem = React__default.forwardRef(function DrawerItem(props, ref) {
|
|
|
4504
4511
|
direction: cssDirection,
|
|
4505
4512
|
hidden: isInitialRender && !visible,
|
|
4506
4513
|
resize: isResizing,
|
|
4507
|
-
}, [className]), style:
|
|
4514
|
+
}, [className]), style: innerStyle },
|
|
4508
4515
|
resizerElement, children !== null && children !== undefined ? children : content)));
|
|
4509
4516
|
});
|
|
4510
4517
|
const Drawer = ({ className, veilClassName, children, style, onVeilClick, onEscape, hideVeil, disablePortal = true, keepMounted = false, scrollLock = false, }) => {
|
|
@@ -5627,10 +5634,23 @@ styleInject(css_248z$5);
|
|
|
5627
5634
|
|
|
5628
5635
|
const b$5 = block('mobile-overlap-panel');
|
|
5629
5636
|
const OverlapPanel = ({ title, renderContent, className, onClose, action, closeTitle = i18n('overlap_button_close'), visible, topOffset, }) => {
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5637
|
+
const topOffsetValue = typeof topOffset === 'number' ? `${topOffset}px` : topOffset;
|
|
5638
|
+
const [itemPosition, setItemPosition] = React__default.useState();
|
|
5639
|
+
const drawerStyle = React__default.useMemo(() => ({ top: `calc(${topOffsetValue} + var(--gn-top-alert-height, 0px))` }), [topOffsetValue]);
|
|
5640
|
+
const drawerItemStyle = React__default.useMemo(() => itemPosition === 'absolute'
|
|
5641
|
+
? {}
|
|
5642
|
+
: { top: `calc(${topOffsetValue} + var(--gn-top-alert-height, 0px))` }, [topOffsetValue, itemPosition]);
|
|
5643
|
+
const itemRef = React__default.useRef(null);
|
|
5644
|
+
// It is necessary to determine the position of the DrawerItem in order to correctly set the top offset
|
|
5645
|
+
React__default.useLayoutEffect(() => {
|
|
5646
|
+
if (itemRef.current) {
|
|
5647
|
+
const style = getComputedStyle(itemRef.current);
|
|
5648
|
+
const position = style.position;
|
|
5649
|
+
setItemPosition(position);
|
|
5650
|
+
}
|
|
5651
|
+
}, []);
|
|
5652
|
+
return (React__default.createElement(Drawer, { className: b$5('', { action: Boolean(action) }, className), onVeilClick: onClose, onEscape: onClose, style: drawerStyle },
|
|
5653
|
+
React__default.createElement(DrawerItem, { id: "overlap", ref: itemRef, visible: visible, className: b$5('drawer-item'), style: drawerItemStyle },
|
|
5634
5654
|
React__default.createElement("div", { className: b$5('header') },
|
|
5635
5655
|
React__default.createElement(Button, { size: "l", view: "flat", className: b$5('close'), onClick: onClose, "aria-label": closeTitle },
|
|
5636
5656
|
React__default.createElement(Icon, { className: b$5('icon'), data: ArrowLeft, size: MOBILE_HEADER_ICON_SIZE })),
|
|
@@ -5643,7 +5663,7 @@ const OverlapPanel = ({ title, renderContent, className, onClose, action, closeT
|
|
|
5643
5663
|
var css_248z$4 = ".gn-mobile-header{--mobile-header-min-heigth:50px;--mobile-header-icon-size:20px;background-color:var(--g-color-base-background)}.gn-mobile-header__header-container{background-color:var(--g-color-base-background);position:sticky;top:0;z-index:var(--gn-mobile-header-z-index,100)}.gn-mobile-header__header{align-items:center;border-bottom:1px solid var(--g-color-line-generic);box-sizing:border-box;display:flex;justify-content:space-between;padding:0 10px}.gn-mobile-header__burger{padding:12px}.gn-mobile-header__panel-item{--gn-drawer-item-position:var(--gn-mobile-header-panel-position,absolute)}.gn-mobile-header__burger-menu,.gn-mobile-header__panel-item{background-color:var(--g-color-base-background);max-height:100%;max-width:90vw;width:320px}.gn-mobile-header__user-menu{overflow-y:auto}.gn-mobile-header__overlap-panel,.gn-mobile-header__panels{z-index:var(--gn-mobile-header-panel-z-index,98)}.gn-mobile-header__panels{inset:var(--mobile-header-min-heigth) 0 0;overflow:hidden;position:fixed}.gn-mobile-header__panel-item{top:unset}.gn-mobile-header__content{overflow:auto}";
|
|
5644
5664
|
styleInject(css_248z$4);
|
|
5645
5665
|
|
|
5646
|
-
const TopAlert = React__default.lazy(() => import('./index-
|
|
5666
|
+
const TopAlert = React__default.lazy(() => import('./index-B84DSZte.js').then((module) => ({ default: module.TopAlert })));
|
|
5647
5667
|
const b$4 = block('mobile-header');
|
|
5648
5668
|
const MobileHeader = React__default.forwardRef(({ logo, burgerMenu, burgerCloseTitle = i18n('burger_button_close'), burgerOpenTitle = i18n('burger_button_open'), panelItems = [], renderContent, sideItemRenderContent, onClosePanel, onEvent, className, contentClassName, overlapPanel, topAlert, }, ref) => {
|
|
5649
5669
|
const targetRef = useForwardRef(ref);
|
|
@@ -5934,4 +5954,4 @@ const MobileFooter = ({ className, menuItems: providedMenuItems, withDivider, mo
|
|
|
5934
5954
|
};
|
|
5935
5955
|
|
|
5936
5956
|
export { AsideHeader as A, DrawerItem as D, FooterItem$1 as F, HotkeysPanel as H, Logo as L, MOBILE_HEADER_EVENT_NAMES as M, PageLayout as P, Settings as S, Title as T, AsideHeaderContextProvider as a, block as b, PageLayoutAside as c, debounceFn as d, AsideFallback as e, Drawer as f, PublicActionBar as g, useSettingsSelectionContext as h, useSettingsContext as i, FooterItem as j, getMobileHeaderCustomEvent as k, MobileHeader as l, MobileLogo as m, Footer as n, MobileFooter as o, styleInject as s, useAsideHeaderContext as u };
|
|
5937
|
-
//# sourceMappingURL=index-
|
|
5957
|
+
//# sourceMappingURL=index-C5bzWe6L.js.map
|