@alfalab/core-components-navigation-bar 0.8.6 → 1.0.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.
Files changed (126) hide show
  1. package/Component.d.ts +70 -5
  2. package/Component.js +25 -128
  3. package/components/action-icon-addon/Component.d.ts +22 -0
  4. package/components/action-icon-addon/Component.js +32 -0
  5. package/components/action-icon-addon/index.css +44 -0
  6. package/components/action-icon-addon/index.js +9 -0
  7. package/components/action-text-addon/Component.d.ts +26 -0
  8. package/components/action-text-addon/Component.js +25 -0
  9. package/{cssm/components/closer/index.module.css → components/action-text-addon/index.css} +8 -32
  10. package/components/action-text-addon/index.js +9 -0
  11. package/cssm/Component.d.ts +70 -5
  12. package/cssm/Component.js +24 -127
  13. package/cssm/components/action-icon-addon/Component.d.ts +22 -0
  14. package/cssm/components/action-icon-addon/Component.js +31 -0
  15. package/cssm/components/action-icon-addon/index.js +9 -0
  16. package/{modern/components/closer/index.css → cssm/components/action-icon-addon/index.module.css} +23 -28
  17. package/cssm/components/action-text-addon/Component.d.ts +26 -0
  18. package/cssm/components/action-text-addon/Component.js +24 -0
  19. package/cssm/components/action-text-addon/index.js +9 -0
  20. package/cssm/{vars.css → components/action-text-addon/index.module.css} +6 -4
  21. package/cssm/index.d.ts +0 -1
  22. package/cssm/index.module.css +46 -76
  23. package/cssm/shared/index.d.ts +3 -2
  24. package/cssm/shared/index.js +6 -4
  25. package/cssm/utils.d.ts +6 -0
  26. package/cssm/utils.js +15 -0
  27. package/esm/Component.d.ts +70 -5
  28. package/esm/Component.js +26 -128
  29. package/esm/components/action-icon-addon/Component.d.ts +22 -0
  30. package/esm/components/action-icon-addon/Component.js +23 -0
  31. package/esm/components/action-icon-addon/index.css +44 -0
  32. package/esm/components/action-icon-addon/index.js +1 -0
  33. package/esm/components/action-text-addon/Component.d.ts +26 -0
  34. package/esm/components/action-text-addon/Component.js +16 -0
  35. package/esm/components/{closer → action-text-addon}/index.css +8 -33
  36. package/esm/components/action-text-addon/index.js +1 -0
  37. package/esm/index.css +49 -78
  38. package/esm/index.d.ts +0 -1
  39. package/esm/shared/index.d.ts +3 -2
  40. package/esm/shared/index.js +3 -2
  41. package/esm/utils.d.ts +6 -0
  42. package/esm/utils.js +11 -0
  43. package/index.css +49 -78
  44. package/index.d.ts +0 -1
  45. package/modern/Component.d.ts +70 -5
  46. package/modern/Component.js +26 -133
  47. package/modern/components/action-icon-addon/Component.d.ts +22 -0
  48. package/modern/components/action-icon-addon/Component.js +18 -0
  49. package/modern/components/action-icon-addon/index.css +44 -0
  50. package/modern/components/action-icon-addon/index.js +1 -0
  51. package/modern/components/action-text-addon/Component.d.ts +26 -0
  52. package/modern/components/action-text-addon/Component.js +12 -0
  53. package/{components/closer → modern/components/action-text-addon}/index.css +8 -33
  54. package/modern/components/action-text-addon/index.js +1 -0
  55. package/modern/index.css +49 -78
  56. package/modern/index.d.ts +0 -1
  57. package/modern/shared/index.d.ts +3 -2
  58. package/modern/shared/index.js +3 -2
  59. package/modern/utils.d.ts +6 -0
  60. package/modern/utils.js +11 -0
  61. package/package.json +6 -9
  62. package/shared/index.d.ts +3 -2
  63. package/shared/index.js +6 -4
  64. package/src/Component.tsx +183 -264
  65. package/src/components/action-icon-addon/Component.tsx +58 -0
  66. package/src/components/action-icon-addon/index.module.css +40 -0
  67. package/src/components/action-text-addon/Component.tsx +61 -0
  68. package/src/components/action-text-addon/index.module.css +9 -0
  69. package/src/index.module.css +39 -79
  70. package/src/index.ts +0 -1
  71. package/src/shared/index.ts +3 -2
  72. package/src/utils.ts +9 -0
  73. package/utils.d.ts +6 -0
  74. package/utils.js +15 -0
  75. package/components/back-arrow-addon/Component.d.ts +0 -26
  76. package/components/back-arrow-addon/Component.js +0 -35
  77. package/components/back-arrow-addon/index.css +0 -76
  78. package/components/back-arrow-addon/index.js +0 -9
  79. package/components/closer/Component.d.ts +0 -35
  80. package/components/closer/Component.js +0 -32
  81. package/components/closer/index.js +0 -9
  82. package/cssm/components/back-arrow-addon/Component.d.ts +0 -26
  83. package/cssm/components/back-arrow-addon/Component.js +0 -34
  84. package/cssm/components/back-arrow-addon/index.js +0 -9
  85. package/cssm/components/back-arrow-addon/index.module.css +0 -75
  86. package/cssm/components/closer/Component.d.ts +0 -35
  87. package/cssm/components/closer/Component.js +0 -31
  88. package/cssm/components/closer/index.js +0 -9
  89. package/cssm/types.d.ts +0 -118
  90. package/cssm/types.js +0 -2
  91. package/esm/components/back-arrow-addon/Component.d.ts +0 -26
  92. package/esm/components/back-arrow-addon/Component.js +0 -26
  93. package/esm/components/back-arrow-addon/index.css +0 -76
  94. package/esm/components/back-arrow-addon/index.js +0 -1
  95. package/esm/components/closer/Component.d.ts +0 -35
  96. package/esm/components/closer/Component.js +0 -23
  97. package/esm/components/closer/index.js +0 -1
  98. package/esm/types.d.ts +0 -118
  99. package/esm/types.js +0 -1
  100. package/modern/components/back-arrow-addon/Component.d.ts +0 -26
  101. package/modern/components/back-arrow-addon/Component.js +0 -23
  102. package/modern/components/back-arrow-addon/index.css +0 -76
  103. package/modern/components/back-arrow-addon/index.js +0 -1
  104. package/modern/components/closer/Component.d.ts +0 -35
  105. package/modern/components/closer/Component.js +0 -20
  106. package/modern/components/closer/index.js +0 -1
  107. package/modern/types.d.ts +0 -118
  108. package/modern/types.js +0 -1
  109. package/src/components/back-arrow-addon/Component.tsx +0 -79
  110. package/src/components/back-arrow-addon/index.module.css +0 -69
  111. package/src/components/closer/Component.tsx +0 -80
  112. package/src/components/closer/index.module.css +0 -32
  113. package/src/types.ts +0 -143
  114. package/src/vars.css +0 -9
  115. package/types.d.ts +0 -118
  116. package/types.js +0 -2
  117. /package/components/{back-arrow-addon → action-icon-addon}/index.d.ts +0 -0
  118. /package/components/{closer → action-text-addon}/index.d.ts +0 -0
  119. /package/cssm/components/{back-arrow-addon → action-icon-addon}/index.d.ts +0 -0
  120. /package/cssm/components/{closer → action-text-addon}/index.d.ts +0 -0
  121. /package/esm/components/{back-arrow-addon → action-icon-addon}/index.d.ts +0 -0
  122. /package/esm/components/{closer → action-text-addon}/index.d.ts +0 -0
  123. /package/modern/components/{back-arrow-addon → action-icon-addon}/index.d.ts +0 -0
  124. /package/modern/components/{closer → action-text-addon}/index.d.ts +0 -0
  125. /package/src/components/{back-arrow-addon → action-icon-addon}/index.ts +0 -0
  126. /package/src/components/{closer → action-text-addon}/index.ts +0 -0
@@ -1,5 +1,70 @@
1
- /// <reference types="react" />
2
- import React from 'react';
3
- import { NavigationBarProps } from "./types";
4
- declare const NavigationBar: React.ForwardRefExoticComponent<NavigationBarProps & React.RefAttributes<HTMLDivElement>>;
5
- export { NavigationBar };
1
+ import { FC, ReactNode } from 'react';
2
+ interface NavigationBarProps {
3
+ /**
4
+ * Заголовок
5
+ */
6
+ title?: string;
7
+ /**
8
+ * Подзаголовок
9
+ */
10
+ subtitle?: string;
11
+ /**
12
+ * Контент шапки
13
+ */
14
+ children?: ReactNode;
15
+ /**
16
+ * Выравнивание заголовка
17
+ * @default center
18
+ */
19
+ align?: 'left' | 'center';
20
+ /**
21
+ * Цвет фона
22
+ */
23
+ backgroundColor?: string;
24
+ /**
25
+ * Наличие бордера
26
+ */
27
+ border?: boolean;
28
+ /**
29
+ * Фиксирует шапку
30
+ */
31
+ sticky?: boolean;
32
+ /**
33
+ * Слот снизу
34
+ */
35
+ bottomAddons?: ReactNode;
36
+ /**
37
+ * Слот слева
38
+ */
39
+ leftAddons?: ReactNode;
40
+ /**
41
+ * Слот справа
42
+ */
43
+ rightAddons?: ReactNode;
44
+ /**
45
+ * Дополнительный класс для контента
46
+ */
47
+ contentClassName?: string;
48
+ /**
49
+ * Дополнительный класс
50
+ */
51
+ className?: string;
52
+ /**
53
+ * Дополнительный класс для правого аддона
54
+ */
55
+ rightAddonsClassName?: string;
56
+ /**
57
+ * Дополнительный класс для левого аддона
58
+ */
59
+ leftAddonsClassName?: string;
60
+ /**
61
+ * Дополнительный класс для нижнего аддона
62
+ */
63
+ bottomAddonsClassName?: string;
64
+ /**
65
+ * Идентификатор для систем автоматизированного тестирования.
66
+ */
67
+ dataTestId?: string;
68
+ }
69
+ declare const NavigationBar: FC<NavigationBarProps>;
70
+ export { NavigationBarProps, NavigationBar };
package/esm/Component.js CHANGED
@@ -1,41 +1,21 @@
1
1
  import { __assign } from 'tslib';
2
- import React, { forwardRef, useState, useRef, useEffect } from 'react';
3
- import mergeRefs from 'react-merge-refs';
2
+ import React, { useState, useRef, useEffect } from 'react';
4
3
  import cn from 'classnames';
5
4
  import { getDataTestId } from '@alfalab/core-components-shared/esm';
6
- import { useLayoutEffect_SAFE_FOR_SSR } from '@alfalab/hooks';
7
- import { BackArrowAddon } from './components/back-arrow-addon/Component.js';
8
- import { Closer } from './components/closer/Component.js';
9
5
 
10
- var styles = {"header":"navigation-bar__header_1svpa","backgroundImage":"navigation-bar__backgroundImage_1svpa","mainLine":"navigation-bar__mainLine_1svpa","mainLineSticky":"navigation-bar__mainLineSticky_1svpa","mainLineWithImageBg":"navigation-bar__mainLineWithImageBg_1svpa","content":"navigation-bar__content_1svpa","withBothAddons":"navigation-bar__withBothAddons_1svpa","withCompactTitle":"navigation-bar__withCompactTitle_1svpa","children":"navigation-bar__children_1svpa","title":"navigation-bar__title_1svpa","contentOnBotDesktop":"navigation-bar__contentOnBotDesktop_1svpa","contentOnBotMobile":"navigation-bar__contentOnBotMobile_1svpa","subtitle":"navigation-bar__subtitle_1svpa","addonsWrapper":"navigation-bar__addonsWrapper_1svpa","rightAddons":"navigation-bar__rightAddons_1svpa","addon":"navigation-bar__addon_1svpa","bottomAddons":"navigation-bar__bottomAddons_1svpa","closer":"navigation-bar__closer_1svpa","left":"navigation-bar__left_1svpa","center":"navigation-bar__center_1svpa","trim":"navigation-bar__trim_1svpa"};
6
+ var styles = {"component":"navigation-bar__component_chxq7","sticky":"navigation-bar__sticky_chxq7","border":"navigation-bar__border_chxq7","mainLine":"navigation-bar__mainLine_chxq7","left":"navigation-bar__left_chxq7","center":"navigation-bar__center_chxq7","children":"navigation-bar__children_chxq7","content":"navigation-bar__content_chxq7","title":"navigation-bar__title_chxq7","subtitle":"navigation-bar__subtitle_chxq7","addons":"navigation-bar__addons_chxq7","rightAddons":"navigation-bar__rightAddons_chxq7"};
11
7
  require('./index.css')
12
8
 
13
- var ADDONS_HEIGHT = 48;
14
- var NavigationBar = forwardRef(function (_a, ref) {
9
+ var NavigationBar = function (_a) {
15
10
  var _b, _c, _d;
16
- var addonClassName = _a.addonClassName, className = _a.className, contentClassName = _a.contentClassName, closerClassName = _a.closerClassName, leftAddons = _a.leftAddons, rightAddons = _a.rightAddons, bottomAddons = _a.bottomAddons, bottomAddonsClassName = _a.bottomAddonsClassName, children = _a.children, _e = _a.align, align = _e === void 0 ? 'left' : _e, _f = _a.trim, trim = _f === void 0 ? true : _f, title = _a.title, _g = _a.titleSize, titleSize = _g === void 0 ? 'default' : _g, subtitle = _a.subtitle, hasCloser = _a.hasCloser, hasBackButton = _a.hasBackButton, backButtonClassName = _a.backButtonClassName, backButtonProps = _a.backButtonProps, dataTestId = _a.dataTestId, imageUrl = _a.imageUrl, closerIcon = _a.closerIcon, onClose = _a.onClose, view = _a.view, scrollableParentRef = _a.scrollableParentRef, sticky = _a.sticky, onBack = _a.onBack;
17
- var _h = useState(0), scrollTop = _h[0], setScrollTop = _h[1];
18
- var _j = useState({ left: 0, right: 0 }), titleMargin = _j[0], setTitleMargin = _j[1];
19
- var bottomContentRef = useRef(null);
20
- var headerRef = useRef(null);
21
- var mainLinePaddingTopRef = useRef('0px');
11
+ var _e = _a.align, align = _e === void 0 ? 'center' : _e, rightAddons = _a.rightAddons, leftAddons = _a.leftAddons, bottomAddons = _a.bottomAddons, sticky = _a.sticky, border = _a.border, subtitle = _a.subtitle, title = _a.title, children = _a.children, _f = _a.backgroundColor, backgroundColor = _f === void 0 ? 'var(--color-light-base-bg-primary)' : _f, className = _a.className, contentClassName = _a.contentClassName, rightAddonsClassName = _a.rightAddonsClassName, leftAddonsClassName = _a.leftAddonsClassName, bottomAddonsClassName = _a.bottomAddonsClassName, dataTestId = _a.dataTestId;
12
+ var _g = useState({ left: 0, right: 0 }), titleMargin = _g[0], setTitleMargin = _g[1];
22
13
  var leftAddonsRef = useRef(null);
23
14
  var rightAddonsRef = useRef(null);
24
- var compactTitle = view === 'mobile' && titleSize === 'compact';
25
- var hasLeftPart = Boolean(leftAddons || hasBackButton);
26
- var hasRightPart = Boolean(rightAddons || hasCloser);
27
- var hasContent = Boolean(title || children);
28
- var withAnimation = Boolean(view === 'mobile' && hasLeftPart && sticky && !compactTitle);
29
- var showContentOnTop = hasContent && (compactTitle || !hasLeftPart);
30
- var showContentOnBot = hasContent && !compactTitle && hasLeftPart;
31
- var showStaticContentOnTop = !withAnimation && showContentOnTop;
32
- var showStaticContentOnBot = !withAnimation && showContentOnBot;
33
- var showAnimatedContentOnTop = withAnimation && showContentOnBot && scrollTop > ADDONS_HEIGHT;
34
- var showAnimatedContentOnBot = withAnimation && showContentOnBot;
35
- var headerPaddingTop = mainLinePaddingTopRef.current;
36
- useLayoutEffect_SAFE_FOR_SSR(function () {
15
+ var hasLeftAddons = leftAddons && align !== 'left';
16
+ useEffect(function () {
37
17
  var _a, _b;
38
- if (align === 'center' && (showStaticContentOnTop || showAnimatedContentOnTop)) {
18
+ if (hasLeftAddons) {
39
19
  var leftAddonsWidth = ((_a = leftAddonsRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0;
40
20
  var rightAddonsWidth = ((_b = rightAddonsRef.current) === null || _b === void 0 ? void 0 : _b.offsetWidth) || 0;
41
21
  var marginSize_1 = Math.abs(rightAddonsWidth - leftAddonsWidth);
@@ -48,108 +28,26 @@ var NavigationBar = forwardRef(function (_a, ref) {
48
28
  return isStateChanged ? newState : prev;
49
29
  });
50
30
  }
51
- }, [
52
- align,
53
- showStaticContentOnTop,
54
- showAnimatedContentOnTop,
55
- leftAddons,
56
- rightAddons,
57
- hasBackButton,
58
- hasCloser,
59
- ]);
60
- useEffect(function () {
61
- var parent = scrollableParentRef === null || scrollableParentRef === void 0 ? void 0 : scrollableParentRef.current;
62
- var handleScroll = function (ev) {
63
- var divElement = ev.target;
64
- setScrollTop(divElement.scrollTop);
65
- };
66
- if (withAnimation && headerRef.current) {
67
- mainLinePaddingTopRef.current = getComputedStyle(headerRef.current).paddingTop;
68
- }
69
- if (withAnimation && parent) {
70
- parent.addEventListener('scroll', handleScroll);
71
- }
72
- return function () { return parent === null || parent === void 0 ? void 0 : parent.removeEventListener('scroll', handleScroll); };
73
- }, [scrollableParentRef, withAnimation]);
74
- var renderBackButton = function () {
75
- var textOpacity = 1;
76
- if (withAnimation) {
77
- var height = hasContent ? ADDONS_HEIGHT : ADDONS_HEIGHT / 2;
78
- textOpacity = Math.max(0, 1 - scrollTop / height);
79
- }
80
- else if (compactTitle) {
81
- textOpacity = 0;
82
- }
83
- return (React.createElement("div", { className: cn(styles.addon, backButtonClassName) },
84
- React.createElement(BackArrowAddon, __assign({ "data-test-id": getDataTestId(dataTestId, 'back-button') }, backButtonProps, { textOpacity: textOpacity, view: view, onClick: onBack }))));
85
- };
86
- var renderContent = function (args) {
87
- var _a;
88
- if (args === void 0) { args = {}; }
89
- var extraClassName = args.extraClassName, wrapperRef = args.wrapperRef, style = args.style, hidden = args.hidden;
90
- return (React.createElement("div", { style: __assign(__assign({}, style), { visibility: hidden ? 'hidden' : 'visible' }), ref: wrapperRef, className: cn(styles.content, extraClassName, contentClassName, styles[align], (_a = {},
91
- _a[styles.trim] = trim,
92
- _a[styles.withCompactTitle] = view === 'mobile' && compactTitle && hasContent,
93
- _a)), "aria-hidden": hidden },
31
+ }, [hasLeftAddons, leftAddons, rightAddons]);
32
+ return (React.createElement("div", { className: cn(styles.component, (_b = {},
33
+ _b[styles.border] = border,
34
+ _b[styles.sticky] = sticky,
35
+ _b), className), style: __assign({}, (backgroundColor && { backgroundColor: backgroundColor })), "data-test-id": dataTestId },
36
+ React.createElement("div", { className: cn(styles.mainLine, styles[align], contentClassName) },
37
+ hasLeftAddons && (React.createElement("div", { className: cn(styles.addons, leftAddonsClassName), ref: leftAddonsRef }, leftAddons)),
94
38
  children && React.createElement("div", { className: styles.children }, children),
95
- title && (React.createElement("div", { className: styles.title, "data-test-id": hidden ? undefined : getDataTestId(dataTestId, 'title') }, title)),
96
- compactTitle && subtitle && React.createElement("div", { className: styles.subtitle }, subtitle)));
97
- };
98
- var renderCloser = function () { return (React.createElement("div", { className: cn(styles.addon, styles.closer, closerClassName) },
99
- React.createElement(Closer, { view: view, icon: closerIcon, dataTestId: getDataTestId(dataTestId, 'closer'), onClose: onClose }))); };
100
- return (React.createElement("div", { ref: mergeRefs([ref, headerRef]), className: cn(styles.header, className, (_b = {}, _b[styles.backgroundImage] = imageUrl, _b)), "data-test-id": getDataTestId(dataTestId), style: __assign(__assign({}, (imageUrl && { backgroundImage: "url(".concat(imageUrl, ")") })), (withAnimation &&
101
- bottomContentRef.current && {
102
- top: -bottomContentRef.current.scrollHeight,
103
- })) },
104
- React.createElement("div", { className: cn(styles.mainLine, (_c = {},
105
- _c[styles.mainLineSticky] = withAnimation,
106
- _c[styles.mainLineWithImageBg] = imageUrl,
107
- _c)), style: __assign({}, (withAnimation
108
- ? {
109
- marginTop: "-".concat(headerPaddingTop),
110
- paddingTop: headerPaddingTop,
111
- }
112
- : null)) },
113
- hasLeftPart && (React.createElement("div", { className: styles.addonsWrapper, ref: leftAddonsRef },
114
- hasBackButton && renderBackButton(),
115
- leftAddons && (React.createElement("div", { className: cn(styles.addon, addonClassName) }, leftAddons)))),
116
- showStaticContentOnTop &&
117
- renderContent(__assign({}, (align === 'center'
39
+ title && (React.createElement("div", { className: cn(styles.content, (_c = {}, _c[styles[align]] = !hasLeftAddons, _c)), style: __assign({}, (align === 'center'
118
40
  ? {
119
- style: {
120
- marginLeft: titleMargin.left,
121
- marginRight: titleMargin.right,
122
- },
41
+ marginLeft: titleMargin.left,
42
+ marginRight: titleMargin.right,
123
43
  }
124
- : null))),
125
- showAnimatedContentOnTop &&
126
- renderContent({
127
- extraClassName: styles.withBothAddons,
128
- style: __assign({ opacity: Math.min(1, (scrollTop - ADDONS_HEIGHT) / ADDONS_HEIGHT) }, (align === 'center'
129
- ? {
130
- marginLeft: titleMargin.left,
131
- marginRight: titleMargin.right,
132
- }
133
- : null)),
134
- }),
135
- hasRightPart && (React.createElement("div", { className: cn(styles.addonsWrapper, styles.rightAddons), ref: rightAddonsRef },
136
- rightAddons && (React.createElement("div", { className: cn(styles.addon, addonClassName) }, rightAddons)),
137
- hasCloser && renderCloser()))),
138
- showAnimatedContentOnBot &&
139
- renderContent({
140
- wrapperRef: bottomContentRef,
141
- extraClassName: styles.underAddons,
142
- style: { opacity: Math.max(0, 1 - scrollTop / ADDONS_HEIGHT) },
143
- hidden: scrollTop / ADDONS_HEIGHT > 1,
144
- }),
145
- showStaticContentOnBot &&
146
- renderContent({
147
- extraClassName: cn((_d = {},
148
- _d[styles.contentOnBotDesktop] = view === 'desktop',
149
- _d[styles.contentOnBotMobile] = view === 'mobile',
150
- _d)),
151
- }),
152
- bottomAddons && (React.createElement("div", { className: cn(styles.bottomAddons, bottomAddonsClassName) }, bottomAddons))));
153
- });
44
+ : null)) },
45
+ React.createElement("div", { className: cn(styles.title, (_d = {},
46
+ _d[styles[align]] = !hasLeftAddons && !subtitle,
47
+ _d)), "data-test-id": getDataTestId(dataTestId, 'title') }, title),
48
+ subtitle && (React.createElement("div", { className: styles.subtitle, "data-test-id": getDataTestId(dataTestId, 'subtitle') }, subtitle)))),
49
+ rightAddons && (React.createElement("div", { className: cn(styles.rightAddons, styles.addons, rightAddonsClassName), ref: rightAddonsRef }, rightAddons))),
50
+ bottomAddons && React.createElement("div", { className: bottomAddonsClassName }, bottomAddons)));
51
+ };
154
52
 
155
53
  export { NavigationBar };
@@ -0,0 +1,22 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ interface ActionIconAddonProps extends React.HTMLAttributes<HTMLButtonElement> {
4
+ /**
5
+ * Тип действия
6
+ */
7
+ action?: 'back' | 'floatingBack' | 'close';
8
+ /**
9
+ * Дополнительный класс
10
+ */
11
+ className?: string;
12
+ /**
13
+ * Обработчик клика
14
+ */
15
+ onClick?: () => void;
16
+ /**
17
+ * Идентификатор для систем автоматизированного тестирования.
18
+ */
19
+ dataTestId?: string;
20
+ }
21
+ declare const ActionIconAddon: React.FC<ActionIconAddonProps>;
22
+ export { ActionIconAddonProps, ActionIconAddon };
@@ -0,0 +1,23 @@
1
+ import { __rest, __assign } from 'tslib';
2
+ import React from 'react';
3
+ import cn from 'classnames';
4
+ import { ButtonDesktop } from '@alfalab/core-components-button/esm/desktop';
5
+ import { ChevronLeftMIcon } from '@alfalab/icons-glyph/ChevronLeftMIcon';
6
+ import { CrossMIcon } from '@alfalab/icons-glyph/CrossMIcon';
7
+
8
+ var styles = {"component":"navigation-bar__component_1ngip","iconWrapper":"navigation-bar__iconWrapper_1ngip","back":"navigation-bar__back_1ngip","floating":"navigation-bar__floating_1ngip"};
9
+ require('./index.css')
10
+
11
+ var iconComponents = {
12
+ back: React.createElement(ChevronLeftMIcon, null),
13
+ floatingBack: React.createElement(ChevronLeftMIcon, { className: styles.floating }),
14
+ close: React.createElement(CrossMIcon, { className: styles.floating }),
15
+ };
16
+ var ActionIconAddon = function (_a) {
17
+ var _b;
18
+ var onClick = _a.onClick, className = _a.className, _c = _a.action, action = _c === void 0 ? 'back' : _c, dataTestId = _a.dataTestId, htmlAttributes = __rest(_a, ["onClick", "className", "action", "dataTestId"]);
19
+ return (React.createElement(ButtonDesktop, __assign({ view: 'text', size: 's', onClick: onClick, "aria-label": action === 'close' ? 'закрыть' : 'назад', className: cn(styles.component, className), dataTestId: dataTestId }, htmlAttributes),
20
+ React.createElement("div", { className: cn(styles.iconWrapper, (_b = {}, _b[styles[action]] = Boolean(styles[action]), _b)) }, iconComponents[action])));
21
+ };
22
+
23
+ export { ActionIconAddon };
@@ -0,0 +1,44 @@
1
+ /* hash: aan4f */
2
+ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
+ } /* deprecated */ :root {
4
+ --color-light-neutral-translucent-100: rgba(38, 55, 88, 0.06);
5
+ --color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47);
6
+ --color-light-neutral-translucent-700-hover: rgba(4, 4, 19, 0.55);
7
+ --color-light-neutral-translucent-700-press: rgba(1, 1, 12, 0.63); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
8
+ } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
9
+ } :root {
10
+ } :root {
11
+
12
+ /* Hard */
13
+
14
+ /* Up */
15
+
16
+ /* Hard up */
17
+ } :root {
18
+ --border-radius-circle: 50%;
19
+ --border-radius-pill: 99px;
20
+ } :root {
21
+ } :root {
22
+ } :root {
23
+ } .navigation-bar__component_1ngip {
24
+ height: 100%;
25
+ border-radius: var(--border-radius-pill);
26
+ min-width: 48px;
27
+ } .navigation-bar__iconWrapper_1ngip {
28
+ display: inline-flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ height: 30px;
32
+ width: 30px;
33
+ border-radius: var(--border-radius-circle);
34
+ background: var(--color-light-neutral-translucent-100);
35
+ vertical-align: middle
36
+ } .navigation-bar__iconWrapper_1ngip.navigation-bar__back_1ngip {
37
+ background: transparent;
38
+ } .navigation-bar__floating_1ngip path {
39
+ fill: var(--color-light-neutral-translucent-700);
40
+ } .navigation-bar__floating_1ngip:hover path {
41
+ fill: var(--color-light-neutral-translucent-700-hover);
42
+ } .navigation-bar__floating_1ngip:active path {
43
+ fill: var(--color-light-neutral-translucent-700-press);
44
+ }
@@ -0,0 +1 @@
1
+ export { ActionIconAddon } from './Component.js';
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ interface ActionTextAddonProps extends React.HTMLAttributes<HTMLButtonElement> {
4
+ /**
5
+ * Текст после иконки
6
+ */
7
+ text: string;
8
+ /**
9
+ * Тип действия
10
+ */
11
+ action?: 'primary' | 'secondary';
12
+ /**
13
+ * Дополнительный класс
14
+ */
15
+ className?: string;
16
+ /**
17
+ * Обработчик клика
18
+ */
19
+ onClick?: () => void;
20
+ /**
21
+ * Идентификатор для систем автоматизированного тестирования.
22
+ */
23
+ dataTestId?: string;
24
+ }
25
+ declare const ActionTextAddon: React.FC<ActionTextAddonProps>;
26
+ export { ActionTextAddonProps, ActionTextAddon };
@@ -0,0 +1,16 @@
1
+ import { __rest, __assign } from 'tslib';
2
+ import React from 'react';
3
+ import cn from 'classnames';
4
+ import { ButtonDesktop } from '@alfalab/core-components-button/esm/desktop';
5
+ import { Typography } from '@alfalab/core-components-typography/esm';
6
+
7
+ var styles = {"component":"navigation-bar__component_bdo4g","text":"navigation-bar__text_bdo4g"};
8
+ require('./index.css')
9
+
10
+ var ActionTextAddon = function (_a) {
11
+ var _b = _a.text, text = _b === void 0 ? 'Назад' : _b, onClick = _a.onClick, className = _a.className, action = _a.action, dataTestId = _a.dataTestId, htmlAttributes = __rest(_a, ["text", "onClick", "className", "action", "dataTestId"]);
12
+ return (React.createElement(ButtonDesktop, __assign({ view: 'text', size: 's', onClick: onClick, "aria-label": text, className: cn(styles.component, className), dataTestId: dataTestId }, htmlAttributes),
13
+ React.createElement(Typography.Text, { className: styles.text, view: 'component', weight: action === 'primary' ? 'medium' : 'regular' }, text)));
14
+ };
15
+
16
+ export { ActionTextAddon };
@@ -1,10 +1,6 @@
1
- /* hash: esnlp */
1
+ /* hash: 1mmbp */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
- } /* deprecated */ :root {
4
- --color-light-neutral-1500: #0e0e0e;
5
- --color-light-neutral-translucent-100: rgba(38, 55, 88, 0.06);
6
- --color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
7
- --color-light-bg-primary-alpha-40: rgba(255, 255, 255, 0.4);
3
+ } /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
8
4
  } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
9
5
  } :root {
10
6
  } :root {
@@ -15,34 +11,13 @@
15
11
 
16
12
  /* Hard up */
17
13
  } :root {
18
- --border-radius-circle: 50%;
19
14
  } :root {
15
+ --gap-xs: 8px;
16
+ --gap-m: 16px;
20
17
  } :root {
21
18
  } :root {
22
- } :root {
23
- /* closer-mobile */
24
- --navigation-bar-closer-mobile-color: var(--color-light-neutral-translucent-700);
25
-
26
- /* back-arrow */
27
- } .navigation-bar__closer_1a9q8 {
28
- flex-shrink: 0;
29
- width: 48px;
30
- height: 48px;
31
- margin-left: auto;
32
- display: flex;
33
- align-items: center;
34
- justify-content: center;
35
- } .navigation-bar__button_1a9q8 {
36
- background: var(--color-light-bg-primary-alpha-40);
37
- -webkit-backdrop-filter: blur(10px);
38
- backdrop-filter: blur(10px);
39
- color: var(--color-light-neutral-1500)
40
- } .navigation-bar__button_1a9q8.navigation-bar__mobile_1a9q8 {
41
- background: var(--color-light-neutral-translucent-100);
42
- color: var(--navigation-bar-closer-mobile-color);
43
- } .navigation-bar__button_1a9q8.navigation-bar__button_1a9q8 {
44
- border-radius: var(--border-radius-circle);
45
- } .navigation-bar__sticky_1a9q8 {
46
- position: sticky;
47
- top: 0;
19
+ } .navigation-bar__component_bdo4g {
20
+ height: 100%;
21
+ } .navigation-bar__text_bdo4g {
22
+ padding: var(--gap-xs) var(--gap-m);
48
23
  }
@@ -0,0 +1 @@
1
+ export { ActionTextAddon } from './Component.js';
package/esm/index.css CHANGED
@@ -1,7 +1,8 @@
1
- /* hash: 1ktx4 */
1
+ /* hash: enrea */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
- --color-light-text-primary: #0e0e0e;
4
+ --color-light-neutral-300: #e7e8eb;
5
+ --color-light-text-primary: rgba(3, 3, 6, 0.88);
5
6
  --color-light-text-secondary: rgba(4, 4, 19, 0.55); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
7
  } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
7
8
  } :root {
@@ -15,94 +16,64 @@
15
16
  } :root {
16
17
  } :root {
17
18
  --gap-2xs: 4px;
18
- --gap-s: 12px;
19
+ --gap-xs: 8px;
20
+ --gap-m: 16px;
19
21
  } :root {
20
22
  } :root {
21
- } .navigation-bar__header_1svpa {
22
- width: 100%;
23
+ } .navigation-bar__component_chxq7 {
24
+ padding: var(--gap-xs) var(--gap-2xs);
23
25
  box-sizing: border-box;
24
- transition: box-shadow 0.2s ease, background 0.2s ease
25
- } .navigation-bar__header_1svpa.navigation-bar__header_1svpa.navigation-bar__backgroundImage_1svpa {
26
- background-repeat: no-repeat;
27
- background-position: center;
28
- background-size: cover;
29
- } .navigation-bar__mainLine_1svpa {
30
- display: flex;
31
- align-items: stretch;
32
- justify-content: space-between;
33
- z-index: 1;
34
- background-color: inherit;
35
- } .navigation-bar__mainLineSticky_1svpa {
26
+ width: 100%;
27
+ } .navigation-bar__sticky_chxq7 {
36
28
  position: sticky;
37
29
  top: 0;
38
- } .navigation-bar__mainLineWithImageBg_1svpa {
39
- background-color: initial;
40
- } .navigation-bar__content_1svpa {
41
- color: var(--color-light-text-primary);
30
+ z-index: 1;
31
+ } .navigation-bar__border_chxq7 {
32
+ box-shadow: 0 1px 0 0 var(--color-light-neutral-300);
33
+ } .navigation-bar__mainLine_chxq7 {
34
+ display: flex;
35
+ background-color: inherit;
36
+ justify-content: space-between;
37
+ min-height: 40px;
38
+ align-items: stretch;
39
+ } .navigation-bar__left_chxq7 {
40
+ text-align: left;
41
+ } .navigation-bar__center_chxq7 {
42
+ text-align: center;
43
+ } .navigation-bar__children_chxq7 {
44
+ width: 100%;
45
+ } .navigation-bar__content_chxq7 {
42
46
  display: flex;
43
- flex-flow: column nowrap;
44
- justify-content: center;
45
47
  flex-grow: 1;
46
- align-self: baseline;
47
- box-sizing: border-box;
48
- min-height: 48px
49
- } .navigation-bar__content_1svpa.navigation-bar__withBothAddons_1svpa,
50
- .navigation-bar__content_1svpa.navigation-bar__withCompactTitle_1svpa {
51
- font-size: 16px;
52
- line-height: 20px;
53
- font-weight: 500;
54
- align-self: center;
55
- padding-top: var(--gap-2xs);
56
- padding-bottom: var(--gap-2xs)
57
- } .navigation-bar__content_1svpa.navigation-bar__withBothAddons_1svpa > .navigation-bar__children_1svpa,
58
- .navigation-bar__content_1svpa.navigation-bar__withBothAddons_1svpa > .navigation-bar__title_1svpa,
59
- .navigation-bar__content_1svpa.navigation-bar__withCompactTitle_1svpa > .navigation-bar__children_1svpa,
60
- .navigation-bar__content_1svpa.navigation-bar__withCompactTitle_1svpa > .navigation-bar__title_1svpa {
61
- -webkit-line-clamp: 1;
62
- word-break: break-all;
63
- } .navigation-bar__content_1svpa.navigation-bar__contentOnBotDesktop_1svpa.navigation-bar__contentOnBotDesktop_1svpa {
64
- padding-top: var(--gap-s);
65
- } .navigation-bar__content_1svpa.navigation-bar__contentOnBotMobile_1svpa.navigation-bar__contentOnBotMobile_1svpa {
66
- padding-top: var(--gap-s);
67
- } .navigation-bar__title_1svpa {
68
- word-break: break-word;
69
- } .navigation-bar__subtitle_1svpa {
48
+ justify-content: center;
49
+ flex-flow: column nowrap;
50
+ color: var(--color-light-text-primary)
51
+ } .navigation-bar__content_chxq7.navigation-bar__left_chxq7 {
52
+ padding: 0 var(--gap-m);
53
+ } .navigation-bar__content_chxq7 > .navigation-bar__title_chxq7,
54
+ .navigation-bar__content_chxq7 > .navigation-bar__subtitle_chxq7 {
55
+ -webkit-line-clamp: 1;
56
+ display: -webkit-box;
57
+ -webkit-box-orient: vertical;
58
+ overflow: hidden;
59
+ word-break: break-all;
60
+ } .navigation-bar__title_chxq7 {
61
+ font-size: 16px;
62
+ line-height: 20px;
63
+ font-weight: 500
64
+ } .navigation-bar__title_chxq7.navigation-bar__left_chxq7 {
65
+ font-size: 20px;
66
+ line-height: 28px;
67
+ font-weight: 600;
68
+ } .navigation-bar__subtitle_chxq7 {
70
69
  font-size: 14px;
71
70
  line-height: 20px;
72
71
  font-weight: 400;
73
- -webkit-line-clamp: 1;
74
- display: -webkit-box;
75
- -webkit-box-orient: vertical;
76
- overflow: hidden;
77
-
78
72
  color: var(--color-light-text-secondary);
79
- word-break: break-all;
80
- } .navigation-bar__addonsWrapper_1svpa {
81
- display: flex;
82
- } .navigation-bar__rightAddons_1svpa {
83
- margin-left: auto;
84
- } .navigation-bar__addon_1svpa {
73
+ } .navigation-bar__addons_chxq7 {
85
74
  min-width: 48px;
86
- height: 48px;
87
75
  display: flex;
88
76
  justify-content: center;
89
- align-items: center;
90
- flex-shrink: 0;
91
- pointer-events: all;
92
- } .navigation-bar__bottomAddons_1svpa {
93
- pointer-events: all;
94
- } .navigation-bar__closer_1svpa {
77
+ } .navigation-bar__rightAddons_chxq7 {
95
78
  margin-left: auto;
96
- } .navigation-bar__left_1svpa {
97
- text-align: left;
98
- } .navigation-bar__center_1svpa {
99
- text-align: center;
100
- } .navigation-bar__trim_1svpa {
101
- overflow: hidden
102
- } .navigation-bar__trim_1svpa .navigation-bar__title_1svpa,
103
- .navigation-bar__trim_1svpa .navigation-bar__children_1svpa {
104
- -webkit-line-clamp: 2;
105
- display: -webkit-box;
106
- -webkit-box-orient: vertical;
107
- overflow: hidden;
108
- }
79
+ }
package/esm/index.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export * from "./Component";
2
- export type { NavigationBarProps } from "./types";
@@ -1,2 +1,3 @@
1
- export * from "../components/closer/index";
2
- export * from "../components/back-arrow-addon/index";
1
+ export * from "../components/action-icon-addon/index";
2
+ export * from "../components/action-text-addon/index";
3
+ export { getNavigationBarTestIds } from "../utils";