@cloud-ru/uikit-product-site-header 0.4.11 → 0.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 0.5.0 (2025-11-13)
7
+
8
+
9
+ ### Features
10
+
11
+ * **SITE-10174:** update headerItems for a/b test ([fee9eb7](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/fee9eb73144a9c68b8d109ee386fe97752aec9b2))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.4.11 (2025-11-13)
7
18
 
8
19
 
@@ -68,7 +68,7 @@ function HeaderItems({ linkItems, isMobileTabletView, activeLinkItemId }) {
68
68
  if (!linkItems || isMobileTabletView)
69
69
  return null;
70
70
  const isVisibleEmpty = visibleItems.length === 0;
71
- return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.wrapper, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.linkItemsContainer, styles_module_scss_1.default.hiddenRow), ref: hiddenRowElementRef, children: linkItems.map((linkItem, index) => ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.lastItemContainer, ref: setItemElement(linkItem, index), children: (0, jsx_runtime_1.jsx)(helperComponents_1.LinkItemHeader, { label: linkItem.label, target: linkItem.target, href: linkItem.href, onClick: linkItem.onClick }) }, linkItem.id))) }), (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.linkItemsContainer, {
71
+ return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.wrapper, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.linkItemsContainer, styles_module_scss_1.default.hiddenRow), ref: hiddenRowElementRef, children: linkItems.map((linkItem, index) => ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.lastItemContainer, linkItem.className), ref: setItemElement(linkItem, index) }, linkItem.dataAttributes, { children: (0, jsx_runtime_1.jsx)(helperComponents_1.LinkItemHeader, { label: linkItem.label, target: linkItem.target, href: linkItem.href, onClick: linkItem.onClick }) }), linkItem.id))) }), (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.linkItemsContainer, {
72
72
  [styles_module_scss_1.default.linkItemsFirstViewContainer]: isVisibleEmpty,
73
- }), children: [(isVisibleEmpty ? linkItems : visibleItems).map(linkItem => ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.lastItemContainer, children: (0, jsx_runtime_1.jsx)(helperComponents_1.LinkItemHeader, { label: linkItem.label, href: linkItem.href, onClick: linkItem.onClick, active: activeLinkItemId === linkItem.id }) }, linkItem.id))), hiddenItems.length > 0 && (0, jsx_runtime_1.jsx)(helperComponents_1.MoreButton, { linkItemsArray: hiddenItems, activeItemId: activeLinkItemId })] })] }));
73
+ }), children: [(isVisibleEmpty ? linkItems : visibleItems).map(linkItem => ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.lastItemContainer, linkItem.className) }, linkItem.dataAttributes, { children: (0, jsx_runtime_1.jsx)(helperComponents_1.LinkItemHeader, { label: linkItem.label, href: linkItem.href, onClick: linkItem.onClick, active: activeLinkItemId === linkItem.id }) }), linkItem.id))), hiddenItems.length > 0 && (0, jsx_runtime_1.jsx)(helperComponents_1.MoreButton, { linkItemsArray: hiddenItems, activeItemId: activeLinkItemId })] })] }));
74
74
  }
@@ -9,4 +9,10 @@ export type LinkItem = {
9
9
  href?: string;
10
10
  /** target для ссылки элемента */
11
11
  target?: string;
12
+ /** className для элемента списка */
13
+ className?: string;
14
+ /** Кастомные data-атрибуты для a/b теста и тд */
15
+ dataAttributes?: {
16
+ [key: string]: string;
17
+ };
12
18
  };
@@ -19,11 +19,11 @@ function MoreButton({ linkItemsArray, activeItemId }) {
19
19
  return ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { placement: 'bottom-start', open: open, outsideClick: () => {
20
20
  onClickOpen();
21
21
  return false;
22
- }, content: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.tagRowDropListScroll, children: linkItemsArray.map(item => ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.rowLinkMore, {
22
+ }, content: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.tagRowDropListScroll, children: linkItemsArray.map(item => ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.rowLinkMore, {
23
23
  [styles_module_scss_1.default.hovered]: !item.href,
24
24
  [styles_module_scss_1.default.active]: item.id === activeItemId && !item.href,
25
- }), children: (0, jsx_runtime_1.jsx)(LinkItemHeader_1.LinkItemHeader, { label: item.label, onClick: () => {
25
+ }, item.className) }, item.dataAttributes, { children: (0, jsx_runtime_1.jsx)(LinkItemHeader_1.LinkItemHeader, { label: item.label, onClick: () => {
26
26
  item.onClick && item.onClick();
27
27
  onClickOpen();
28
- }, href: item.href, withoutHover: true }) }, item.id))) }), children: (0, jsx_runtime_1.jsx)("button", { className: styles_module_scss_1.default.button, onClick: onClickOpen, children: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.MoreSVG, {}) }) }));
28
+ }, href: item.href, withoutHover: true }) }), item.id))) }), children: (0, jsx_runtime_1.jsx)("button", { className: styles_module_scss_1.default.button, onClick: onClickOpen, children: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.MoreSVG, {}) }) }));
29
29
  }
@@ -62,7 +62,7 @@ export function HeaderItems({ linkItems, isMobileTabletView, activeLinkItemId })
62
62
  if (!linkItems || isMobileTabletView)
63
63
  return null;
64
64
  const isVisibleEmpty = visibleItems.length === 0;
65
- return (_jsxs("div", { className: styles.wrapper, children: [_jsx("div", { className: cn(styles.linkItemsContainer, styles.hiddenRow), ref: hiddenRowElementRef, children: linkItems.map((linkItem, index) => (_jsx("div", { className: styles.lastItemContainer, ref: setItemElement(linkItem, index), children: _jsx(LinkItemHeader, { label: linkItem.label, target: linkItem.target, href: linkItem.href, onClick: linkItem.onClick }) }, linkItem.id))) }), _jsxs("div", { className: cn(styles.linkItemsContainer, {
65
+ return (_jsxs("div", { className: styles.wrapper, children: [_jsx("div", { className: cn(styles.linkItemsContainer, styles.hiddenRow), ref: hiddenRowElementRef, children: linkItems.map((linkItem, index) => (_jsx("div", Object.assign({ className: cn(styles.lastItemContainer, linkItem.className), ref: setItemElement(linkItem, index) }, linkItem.dataAttributes, { children: _jsx(LinkItemHeader, { label: linkItem.label, target: linkItem.target, href: linkItem.href, onClick: linkItem.onClick }) }), linkItem.id))) }), _jsxs("div", { className: cn(styles.linkItemsContainer, {
66
66
  [styles.linkItemsFirstViewContainer]: isVisibleEmpty,
67
- }), children: [(isVisibleEmpty ? linkItems : visibleItems).map(linkItem => (_jsx("div", { className: styles.lastItemContainer, children: _jsx(LinkItemHeader, { label: linkItem.label, href: linkItem.href, onClick: linkItem.onClick, active: activeLinkItemId === linkItem.id }) }, linkItem.id))), hiddenItems.length > 0 && _jsx(MoreButton, { linkItemsArray: hiddenItems, activeItemId: activeLinkItemId })] })] }));
67
+ }), children: [(isVisibleEmpty ? linkItems : visibleItems).map(linkItem => (_jsx("div", Object.assign({ className: cn(styles.lastItemContainer, linkItem.className) }, linkItem.dataAttributes, { children: _jsx(LinkItemHeader, { label: linkItem.label, href: linkItem.href, onClick: linkItem.onClick, active: activeLinkItemId === linkItem.id }) }), linkItem.id))), hiddenItems.length > 0 && _jsx(MoreButton, { linkItemsArray: hiddenItems, activeItemId: activeLinkItemId })] })] }));
68
68
  }
@@ -9,4 +9,10 @@ export type LinkItem = {
9
9
  href?: string;
10
10
  /** target для ссылки элемента */
11
11
  target?: string;
12
+ /** className для элемента списка */
13
+ className?: string;
14
+ /** Кастомные data-атрибуты для a/b теста и тд */
15
+ dataAttributes?: {
16
+ [key: string]: string;
17
+ };
12
18
  };
@@ -13,11 +13,11 @@ export function MoreButton({ linkItemsArray, activeItemId }) {
13
13
  return (_jsx(Dropdown, { placement: 'bottom-start', open: open, outsideClick: () => {
14
14
  onClickOpen();
15
15
  return false;
16
- }, content: _jsx("div", { className: styles.tagRowDropListScroll, children: linkItemsArray.map(item => (_jsx("div", { className: cn(styles.rowLinkMore, {
16
+ }, content: _jsx("div", { className: styles.tagRowDropListScroll, children: linkItemsArray.map(item => (_jsx("div", Object.assign({ className: cn(styles.rowLinkMore, {
17
17
  [styles.hovered]: !item.href,
18
18
  [styles.active]: item.id === activeItemId && !item.href,
19
- }), children: _jsx(LinkItemHeader, { label: item.label, onClick: () => {
19
+ }, item.className) }, item.dataAttributes, { children: _jsx(LinkItemHeader, { label: item.label, onClick: () => {
20
20
  item.onClick && item.onClick();
21
21
  onClickOpen();
22
- }, href: item.href, withoutHover: true }) }, item.id))) }), children: _jsx("button", { className: styles.button, onClick: onClickOpen, children: _jsx(MoreSVG, {}) }) }));
22
+ }, href: item.href, withoutHover: true }) }), item.id))) }), children: _jsx("button", { className: styles.button, onClick: onClickOpen, children: _jsx(MoreSVG, {}) }) }));
23
23
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloud-ru/uikit-product-site-header",
3
3
  "title": "Siteheader",
4
- "version": "0.4.11",
4
+ "version": "0.5.0",
5
5
  "sideEffects": [
6
6
  "*.css",
7
7
  "*.woff",
@@ -51,5 +51,5 @@
51
51
  "peerDependencies": {
52
52
  "@sbercloud/figma-tokens-web": "*"
53
53
  },
54
- "gitHead": "ce69097516055b330a0b05da5e29ac5b66e56284"
54
+ "gitHead": "bf902e38f3b6e267402a675b7640b5a62f1c4f71"
55
55
  }
@@ -90,7 +90,12 @@ export function HeaderItems({ linkItems, isMobileTabletView, activeLinkItemId }:
90
90
  <div className={styles.wrapper}>
91
91
  <div className={cn(styles.linkItemsContainer, styles.hiddenRow)} ref={hiddenRowElementRef}>
92
92
  {linkItems.map((linkItem, index) => (
93
- <div key={linkItem.id} className={styles.lastItemContainer} ref={setItemElement(linkItem, index)}>
93
+ <div
94
+ key={linkItem.id}
95
+ className={cn(styles.lastItemContainer, linkItem.className)}
96
+ ref={setItemElement(linkItem, index)}
97
+ {...linkItem.dataAttributes}
98
+ >
94
99
  <LinkItemHeader
95
100
  label={linkItem.label}
96
101
  target={linkItem.target}
@@ -107,7 +112,11 @@ export function HeaderItems({ linkItems, isMobileTabletView, activeLinkItemId }:
107
112
  >
108
113
  {/*Добавлено для сайта, так как используется next и приходит html без расчета js*/}
109
114
  {(isVisibleEmpty ? linkItems : visibleItems).map(linkItem => (
110
- <div key={linkItem.id} className={styles.lastItemContainer}>
115
+ <div
116
+ key={linkItem.id}
117
+ className={cn(styles.lastItemContainer, linkItem.className)}
118
+ {...linkItem.dataAttributes}
119
+ >
111
120
  <LinkItemHeader
112
121
  label={linkItem.label}
113
122
  href={linkItem.href}
@@ -9,4 +9,10 @@ export type LinkItem = {
9
9
  href?: string;
10
10
  /** target для ссылки элемента */
11
11
  target?: string;
12
+ /** className для элемента списка */
13
+ className?: string;
14
+ /** Кастомные data-атрибуты для a/b теста и тд */
15
+ dataAttributes?: {
16
+ [key: string]: string;
17
+ };
12
18
  };
@@ -32,10 +32,15 @@ export function MoreButton({ linkItemsArray, activeItemId }: MoreButtonProps) {
32
32
  {linkItemsArray.map(item => (
33
33
  <div
34
34
  key={item.id}
35
- className={cn(styles.rowLinkMore, {
36
- [styles.hovered]: !item.href,
37
- [styles.active]: item.id === activeItemId && !item.href,
38
- })}
35
+ className={cn(
36
+ styles.rowLinkMore,
37
+ {
38
+ [styles.hovered]: !item.href,
39
+ [styles.active]: item.id === activeItemId && !item.href,
40
+ },
41
+ item.className,
42
+ )}
43
+ {...item.dataAttributes}
39
44
  >
40
45
  <LinkItemHeader
41
46
  label={item.label}