@gravity-ui/navigation 3.6.3 → 3.7.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CUI-2dbs.js');
3
+ var index = require('./index-Cfkp4RxD.js');
4
4
  require('react');
5
5
  require('@bem-react/classname');
6
6
  require('@gravity-ui/uikit');
@@ -14,6 +14,7 @@ export type CompositeBarProps = CompositeBarItems & {
14
14
  multipleTooltip?: boolean;
15
15
  menuMoreTitle?: string;
16
16
  onMoreClick?: () => void;
17
+ compositeId?: string;
17
18
  };
18
19
  export declare const CompositeBar: FC<CompositeBarProps>;
19
20
  export {};
@@ -42,6 +42,7 @@ export interface MenuItem extends QAProps {
42
42
  * The category to which the menu item belongs. Need for grouping in the display/editing mode of all pages
43
43
  */
44
44
  category?: string;
45
+ className?: string;
45
46
  }
46
47
  export type SubheaderMenuItem = Omit<ItemProps, 'onItemClick' | 'onItemClickCapture'>;
47
48
  export interface LogoProps {
@@ -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-Dz2PNf_D.js').then((module) => ({ default: module.TopAlert })));
124
+ const TopAlert$1 = React__default.lazy(() => import('./index-BckFwvaf.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]);
@@ -1569,7 +1569,7 @@ const Item$1 = (props) => {
1569
1569
  ? ['a', { href: item.link }]
1570
1570
  : ['button', {}];
1571
1571
  const createdNode = (React__default.createElement(React__default.Fragment, null,
1572
- React__default.createElement(Tag, Object.assign({}, tagProps, { className: b$r({ type, current, compact }, className), ref: ref, "data-qa": item.qa, onClick: (event) => {
1572
+ React__default.createElement(Tag, Object.assign({}, tagProps, { className: b$r({ type, current, compact }, [className, item.className]), ref: ref, "data-qa": item.qa, onClick: (event) => {
1573
1573
  if (collapsedItem) {
1574
1574
  /**
1575
1575
  * If we call onItemClick for collapsedItem then:
@@ -1702,7 +1702,7 @@ var css_248z$o = ".gn-composite-bar{flex:1 0 auto;min-height:40px;width:100%}.gn
1702
1702
  styleInject(css_248z$o);
1703
1703
 
1704
1704
  const b$p = block('composite-bar');
1705
- const CompositeBarView = ({ type, items, onItemClick, onMoreClick, collapseItems, multipleTooltip = false, }) => {
1705
+ const CompositeBarView = ({ type, items, onItemClick, onMoreClick, collapseItems, multipleTooltip = false, compositeId, }) => {
1706
1706
  const ref = useRef(null);
1707
1707
  const tooltipRef = useRef(null);
1708
1708
  const { setValue: setMultipleTooltipContextValue, active: multipleTooltipActive, activeIndex, lastClickedItemIndex, } = useContext(MultipleTooltipContext);
@@ -1806,7 +1806,7 @@ const CompositeBarView = ({ type, items, onItemClick, onMoreClick, collapseItems
1806
1806
  ]);
1807
1807
  return (React__default.createElement(React__default.Fragment, null,
1808
1808
  React__default.createElement("div", { ref: tooltipRef, onMouseEnter: onTooltipMouseEnter, onMouseLeave: onTooltipMouseLeave },
1809
- React__default.createElement(List, { ref: ref, items: items, selectedItemIndex: type === 'menu' ? getSelectedItemIndex$1(items) : undefined, itemHeight: getItemHeight$1, itemsHeight: getItemsHeight, itemClassName: b$p('root-menu-item'), virtualized: false, filterable: false, sortable: false, renderItem: (item, _isItemActive, itemIndex) => {
1809
+ React__default.createElement(List, { id: compositeId, ref: ref, items: items, selectedItemIndex: type === 'menu' ? getSelectedItemIndex$1(items) : undefined, itemHeight: getItemHeight$1, itemsHeight: getItemsHeight, itemClassName: b$p('root-menu-item'), virtualized: false, filterable: false, sortable: false, renderItem: (item, _isItemActive, itemIndex) => {
1810
1810
  const itemExtraProps = isMenuItem(item) ? { item } : item;
1811
1811
  const enableTooltip = isMenuItem(item)
1812
1812
  ? !multipleTooltip
@@ -1815,7 +1815,7 @@ const CompositeBarView = ({ type, items, onItemClick, onMoreClick, collapseItems
1815
1815
  } })),
1816
1816
  type === 'menu' && multipleTooltip && (React__default.createElement(MultipleTooltip, { open: compact && multipleTooltipActive, anchorRef: tooltipRef, placement: ['right-start'], items: items }))));
1817
1817
  };
1818
- const CompositeBar = ({ type, items, menuMoreTitle, onItemClick, onMoreClick, multipleTooltip = false, }) => {
1818
+ const CompositeBar = ({ type, items, menuMoreTitle, onItemClick, onMoreClick, multipleTooltip = false, compositeId, }) => {
1819
1819
  if (items.length === 0) {
1820
1820
  return null;
1821
1821
  }
@@ -1828,7 +1828,7 @@ const CompositeBar = ({ type, items, menuMoreTitle, onItemClick, onMoreClick, mu
1828
1828
  const height = Number.isNaN(size.height) ? 0 : size.height;
1829
1829
  const { listItems, collapseItems } = getAutosizeListItems(items, height, collapseItem);
1830
1830
  return (React__default.createElement("div", { style: { width, height } },
1831
- React__default.createElement(CompositeBarView, { type: "menu", items: listItems, onItemClick: onItemClick, onMoreClick: onMoreClick, collapseItems: collapseItems, multipleTooltip: multipleTooltip })));
1831
+ React__default.createElement(CompositeBarView, { compositeId: compositeId, type: "menu", items: listItems, onItemClick: onItemClick, onMoreClick: onMoreClick, collapseItems: collapseItems, multipleTooltip: multipleTooltip })));
1832
1832
  }))));
1833
1833
  }
1834
1834
  else {
@@ -1945,6 +1945,7 @@ var SvgDividerCollapsed = function SvgDividerCollapsed(props) {
1945
1945
  };
1946
1946
 
1947
1947
  const DEFAULT_SUBHEADER_ITEMS = [];
1948
+ const HEADER_COMPOSITE_ID = 'gravity-ui/navigation-header-composite-bar';
1948
1949
  const Header = () => {
1949
1950
  const { logo, onItemClick, onClosePanel, headerDecoration, subheaderItems } = useAsideHeaderInnerContext();
1950
1951
  const { compact } = useAsideHeaderContext();
@@ -1955,7 +1956,7 @@ const Header = () => {
1955
1956
  }, [onClosePanel, logo]);
1956
1957
  return (React__default.createElement("div", { className: b$v('header', { ['with-decoration']: headerDecoration }) },
1957
1958
  logo && (React__default.createElement(Logo, Object.assign({}, logo, { onClick: onLogoClick, compact: compact, buttonClassName: b$v('logo-button'), iconPlaceClassName: b$v('logo-icon-place') }))),
1958
- React__default.createElement(CompositeBar, { type: "subheader", items: subheaderItems || DEFAULT_SUBHEADER_ITEMS, onItemClick: onItemClick }),
1959
+ React__default.createElement(CompositeBar, { compositeId: HEADER_COMPOSITE_ID, type: "subheader", items: subheaderItems || DEFAULT_SUBHEADER_ITEMS, onItemClick: onItemClick }),
1959
1960
  headerDecoration && (React__default.createElement(Icon, { data: SvgDividerCollapsed, className: b$v('header-divider'), width: ASIDE_HEADER_COMPACT_WIDTH, height: HEADER_DIVIDER_HEIGHT }))));
1960
1961
  };
1961
1962
 
@@ -4571,6 +4572,7 @@ const Panels = () => {
4571
4572
  return panelItems ? (React__default.createElement(Drawer, { className: b$v('panels'), onVeilClick: onClosePanel, onEscape: onClosePanel, style: { left: size } }, panelItems.map((item) => (React__default.createElement(DrawerItem, Object.assign({ key: item.id }, item)))))) : null;
4572
4573
  };
4573
4574
 
4575
+ const MENU_ITEMS_COMPOSITE_ID = 'gravity-ui/navigation-menu-items-composite-bar';
4574
4576
  const FirstPanel = React__default.forwardRef((_props, ref) => {
4575
4577
  const { size, onItemClick, headerDecoration, multipleTooltip, menuMoreTitle, onMenuMoreClick, renderFooter, compact, customBackground, customBackgroundClassName, className, hideCollapseButton, qa, } = useAsideHeaderInnerContext();
4576
4578
  const visibleMenuItems = useVisibleMenuItems();
@@ -4584,7 +4586,7 @@ const FirstPanel = React__default.forwardRef((_props, ref) => {
4584
4586
  customBackground && (React__default.createElement("div", { className: b$v('aside-custom-background', customBackgroundClassName) }, customBackground)),
4585
4587
  React__default.createElement("div", { className: b$v('aside-content', { ['with-decoration']: headerDecoration }) },
4586
4588
  React__default.createElement(Header, null),
4587
- (visibleMenuItems === null || visibleMenuItems === undefined ? undefined : visibleMenuItems.length) ? (React__default.createElement(CompositeBar, { type: "menu", items: visibleMenuItems, menuMoreTitle: menuMoreTitle !== null && menuMoreTitle !== undefined ? menuMoreTitle : i18n$3('label_more'), onItemClick: onItemClick, onMoreClick: onMenuMoreClick, multipleTooltip: multipleTooltip })) : (React__default.createElement("div", { className: b$v('menu-items') })),
4589
+ (visibleMenuItems === null || visibleMenuItems === undefined ? undefined : visibleMenuItems.length) ? (React__default.createElement(CompositeBar, { compositeId: MENU_ITEMS_COMPOSITE_ID, type: "menu", items: visibleMenuItems, menuMoreTitle: menuMoreTitle !== null && menuMoreTitle !== undefined ? menuMoreTitle : i18n$3('label_more'), onItemClick: onItemClick, onMoreClick: onMenuMoreClick, multipleTooltip: multipleTooltip })) : (React__default.createElement("div", { className: b$v('menu-items') })),
4588
4590
  React__default.createElement("div", { className: b$v('footer') }, renderFooter === null || renderFooter === undefined ? undefined : renderFooter({
4589
4591
  size,
4590
4592
  compact: Boolean(compact),
@@ -5667,7 +5669,7 @@ const OverlapPanel = ({ title, renderContent, className, onClose, action, closeT
5667
5669
  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}";
5668
5670
  styleInject(css_248z$4);
5669
5671
 
5670
- const TopAlert = React__default.lazy(() => import('./index-Dz2PNf_D.js').then((module) => ({ default: module.TopAlert })));
5672
+ const TopAlert = React__default.lazy(() => import('./index-BckFwvaf.js').then((module) => ({ default: module.TopAlert })));
5671
5673
  const b$4 = block('mobile-header');
5672
5674
  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) => {
5673
5675
  const targetRef = useForwardRef(ref);
@@ -5958,4 +5960,4 @@ const MobileFooter = ({ className, menuItems: providedMenuItems, withDivider, mo
5958
5960
  };
5959
5961
 
5960
5962
  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 };
5961
- //# sourceMappingURL=index-CI_SBVwl.js.map
5963
+ //# sourceMappingURL=index-BYgSDqdV.js.map