@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
package/Component.d.ts CHANGED
@@ -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/Component.js CHANGED
@@ -4,48 +4,27 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
6
  var React = require('react');
7
- var mergeRefs = require('react-merge-refs');
8
7
  var cn = require('classnames');
9
8
  var coreComponentsShared = require('@alfalab/core-components-shared');
10
- var hooks = require('@alfalab/hooks');
11
- var components_backArrowAddon_Component = require('./components/back-arrow-addon/Component.js');
12
- var components_closer_Component = require('./components/closer/Component.js');
13
9
 
14
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
15
11
 
16
12
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
17
- var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
18
13
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
19
14
 
20
- 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"};
15
+ 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"};
21
16
  require('./index.css')
22
17
 
23
- var ADDONS_HEIGHT = 48;
24
- var NavigationBar = React.forwardRef(function (_a, ref) {
18
+ var NavigationBar = function (_a) {
25
19
  var _b, _c, _d;
26
- 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;
27
- var _h = React.useState(0), scrollTop = _h[0], setScrollTop = _h[1];
28
- var _j = React.useState({ left: 0, right: 0 }), titleMargin = _j[0], setTitleMargin = _j[1];
29
- var bottomContentRef = React.useRef(null);
30
- var headerRef = React.useRef(null);
31
- var mainLinePaddingTopRef = React.useRef('0px');
20
+ 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;
21
+ var _g = React.useState({ left: 0, right: 0 }), titleMargin = _g[0], setTitleMargin = _g[1];
32
22
  var leftAddonsRef = React.useRef(null);
33
23
  var rightAddonsRef = React.useRef(null);
34
- var compactTitle = view === 'mobile' && titleSize === 'compact';
35
- var hasLeftPart = Boolean(leftAddons || hasBackButton);
36
- var hasRightPart = Boolean(rightAddons || hasCloser);
37
- var hasContent = Boolean(title || children);
38
- var withAnimation = Boolean(view === 'mobile' && hasLeftPart && sticky && !compactTitle);
39
- var showContentOnTop = hasContent && (compactTitle || !hasLeftPart);
40
- var showContentOnBot = hasContent && !compactTitle && hasLeftPart;
41
- var showStaticContentOnTop = !withAnimation && showContentOnTop;
42
- var showStaticContentOnBot = !withAnimation && showContentOnBot;
43
- var showAnimatedContentOnTop = withAnimation && showContentOnBot && scrollTop > ADDONS_HEIGHT;
44
- var showAnimatedContentOnBot = withAnimation && showContentOnBot;
45
- var headerPaddingTop = mainLinePaddingTopRef.current;
46
- hooks.useLayoutEffect_SAFE_FOR_SSR(function () {
24
+ var hasLeftAddons = leftAddons && align !== 'left';
25
+ React.useEffect(function () {
47
26
  var _a, _b;
48
- if (align === 'center' && (showStaticContentOnTop || showAnimatedContentOnTop)) {
27
+ if (hasLeftAddons) {
49
28
  var leftAddonsWidth = ((_a = leftAddonsRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0;
50
29
  var rightAddonsWidth = ((_b = rightAddonsRef.current) === null || _b === void 0 ? void 0 : _b.offsetWidth) || 0;
51
30
  var marginSize_1 = Math.abs(rightAddonsWidth - leftAddonsWidth);
@@ -58,108 +37,26 @@ var NavigationBar = React.forwardRef(function (_a, ref) {
58
37
  return isStateChanged ? newState : prev;
59
38
  });
60
39
  }
61
- }, [
62
- align,
63
- showStaticContentOnTop,
64
- showAnimatedContentOnTop,
65
- leftAddons,
66
- rightAddons,
67
- hasBackButton,
68
- hasCloser,
69
- ]);
70
- React.useEffect(function () {
71
- var parent = scrollableParentRef === null || scrollableParentRef === void 0 ? void 0 : scrollableParentRef.current;
72
- var handleScroll = function (ev) {
73
- var divElement = ev.target;
74
- setScrollTop(divElement.scrollTop);
75
- };
76
- if (withAnimation && headerRef.current) {
77
- mainLinePaddingTopRef.current = getComputedStyle(headerRef.current).paddingTop;
78
- }
79
- if (withAnimation && parent) {
80
- parent.addEventListener('scroll', handleScroll);
81
- }
82
- return function () { return parent === null || parent === void 0 ? void 0 : parent.removeEventListener('scroll', handleScroll); };
83
- }, [scrollableParentRef, withAnimation]);
84
- var renderBackButton = function () {
85
- var textOpacity = 1;
86
- if (withAnimation) {
87
- var height = hasContent ? ADDONS_HEIGHT : ADDONS_HEIGHT / 2;
88
- textOpacity = Math.max(0, 1 - scrollTop / height);
89
- }
90
- else if (compactTitle) {
91
- textOpacity = 0;
92
- }
93
- return (React__default.default.createElement("div", { className: cn__default.default(styles.addon, backButtonClassName) },
94
- React__default.default.createElement(components_backArrowAddon_Component.BackArrowAddon, tslib.__assign({ "data-test-id": coreComponentsShared.getDataTestId(dataTestId, 'back-button') }, backButtonProps, { textOpacity: textOpacity, view: view, onClick: onBack }))));
95
- };
96
- var renderContent = function (args) {
97
- var _a;
98
- if (args === void 0) { args = {}; }
99
- var extraClassName = args.extraClassName, wrapperRef = args.wrapperRef, style = args.style, hidden = args.hidden;
100
- return (React__default.default.createElement("div", { style: tslib.__assign(tslib.__assign({}, style), { visibility: hidden ? 'hidden' : 'visible' }), ref: wrapperRef, className: cn__default.default(styles.content, extraClassName, contentClassName, styles[align], (_a = {},
101
- _a[styles.trim] = trim,
102
- _a[styles.withCompactTitle] = view === 'mobile' && compactTitle && hasContent,
103
- _a)), "aria-hidden": hidden },
40
+ }, [hasLeftAddons, leftAddons, rightAddons]);
41
+ return (React__default.default.createElement("div", { className: cn__default.default(styles.component, (_b = {},
42
+ _b[styles.border] = border,
43
+ _b[styles.sticky] = sticky,
44
+ _b), className), style: tslib.__assign({}, (backgroundColor && { backgroundColor: backgroundColor })), "data-test-id": dataTestId },
45
+ React__default.default.createElement("div", { className: cn__default.default(styles.mainLine, styles[align], contentClassName) },
46
+ hasLeftAddons && (React__default.default.createElement("div", { className: cn__default.default(styles.addons, leftAddonsClassName), ref: leftAddonsRef }, leftAddons)),
104
47
  children && React__default.default.createElement("div", { className: styles.children }, children),
105
- title && (React__default.default.createElement("div", { className: styles.title, "data-test-id": hidden ? undefined : coreComponentsShared.getDataTestId(dataTestId, 'title') }, title)),
106
- compactTitle && subtitle && React__default.default.createElement("div", { className: styles.subtitle }, subtitle)));
107
- };
108
- var renderCloser = function () { return (React__default.default.createElement("div", { className: cn__default.default(styles.addon, styles.closer, closerClassName) },
109
- React__default.default.createElement(components_closer_Component.Closer, { view: view, icon: closerIcon, dataTestId: coreComponentsShared.getDataTestId(dataTestId, 'closer'), onClose: onClose }))); };
110
- return (React__default.default.createElement("div", { ref: mergeRefs__default.default([ref, headerRef]), className: cn__default.default(styles.header, className, (_b = {}, _b[styles.backgroundImage] = imageUrl, _b)), "data-test-id": coreComponentsShared.getDataTestId(dataTestId), style: tslib.__assign(tslib.__assign({}, (imageUrl && { backgroundImage: "url(".concat(imageUrl, ")") })), (withAnimation &&
111
- bottomContentRef.current && {
112
- top: -bottomContentRef.current.scrollHeight,
113
- })) },
114
- React__default.default.createElement("div", { className: cn__default.default(styles.mainLine, (_c = {},
115
- _c[styles.mainLineSticky] = withAnimation,
116
- _c[styles.mainLineWithImageBg] = imageUrl,
117
- _c)), style: tslib.__assign({}, (withAnimation
118
- ? {
119
- marginTop: "-".concat(headerPaddingTop),
120
- paddingTop: headerPaddingTop,
121
- }
122
- : null)) },
123
- hasLeftPart && (React__default.default.createElement("div", { className: styles.addonsWrapper, ref: leftAddonsRef },
124
- hasBackButton && renderBackButton(),
125
- leftAddons && (React__default.default.createElement("div", { className: cn__default.default(styles.addon, addonClassName) }, leftAddons)))),
126
- showStaticContentOnTop &&
127
- renderContent(tslib.__assign({}, (align === 'center'
48
+ title && (React__default.default.createElement("div", { className: cn__default.default(styles.content, (_c = {}, _c[styles[align]] = !hasLeftAddons, _c)), style: tslib.__assign({}, (align === 'center'
128
49
  ? {
129
- style: {
130
- marginLeft: titleMargin.left,
131
- marginRight: titleMargin.right,
132
- },
50
+ marginLeft: titleMargin.left,
51
+ marginRight: titleMargin.right,
133
52
  }
134
- : null))),
135
- showAnimatedContentOnTop &&
136
- renderContent({
137
- extraClassName: styles.withBothAddons,
138
- style: tslib.__assign({ opacity: Math.min(1, (scrollTop - ADDONS_HEIGHT) / ADDONS_HEIGHT) }, (align === 'center'
139
- ? {
140
- marginLeft: titleMargin.left,
141
- marginRight: titleMargin.right,
142
- }
143
- : null)),
144
- }),
145
- hasRightPart && (React__default.default.createElement("div", { className: cn__default.default(styles.addonsWrapper, styles.rightAddons), ref: rightAddonsRef },
146
- rightAddons && (React__default.default.createElement("div", { className: cn__default.default(styles.addon, addonClassName) }, rightAddons)),
147
- hasCloser && renderCloser()))),
148
- showAnimatedContentOnBot &&
149
- renderContent({
150
- wrapperRef: bottomContentRef,
151
- extraClassName: styles.underAddons,
152
- style: { opacity: Math.max(0, 1 - scrollTop / ADDONS_HEIGHT) },
153
- hidden: scrollTop / ADDONS_HEIGHT > 1,
154
- }),
155
- showStaticContentOnBot &&
156
- renderContent({
157
- extraClassName: cn__default.default((_d = {},
158
- _d[styles.contentOnBotDesktop] = view === 'desktop',
159
- _d[styles.contentOnBotMobile] = view === 'mobile',
160
- _d)),
161
- }),
162
- bottomAddons && (React__default.default.createElement("div", { className: cn__default.default(styles.bottomAddons, bottomAddonsClassName) }, bottomAddons))));
163
- });
53
+ : null)) },
54
+ React__default.default.createElement("div", { className: cn__default.default(styles.title, (_d = {},
55
+ _d[styles[align]] = !hasLeftAddons && !subtitle,
56
+ _d)), "data-test-id": coreComponentsShared.getDataTestId(dataTestId, 'title') }, title),
57
+ subtitle && (React__default.default.createElement("div", { className: styles.subtitle, "data-test-id": coreComponentsShared.getDataTestId(dataTestId, 'subtitle') }, subtitle)))),
58
+ rightAddons && (React__default.default.createElement("div", { className: cn__default.default(styles.rightAddons, styles.addons, rightAddonsClassName), ref: rightAddonsRef }, rightAddons))),
59
+ bottomAddons && React__default.default.createElement("div", { className: bottomAddonsClassName }, bottomAddons)));
60
+ };
164
61
 
165
62
  exports.NavigationBar = 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,32 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var React = require('react');
7
+ var cn = require('classnames');
8
+ var desktop = require('@alfalab/core-components-button/desktop');
9
+ var ChevronLeftMIcon = require('@alfalab/icons-glyph/ChevronLeftMIcon');
10
+ var CrossMIcon = require('@alfalab/icons-glyph/CrossMIcon');
11
+
12
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
13
+
14
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
15
+ var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
16
+
17
+ var styles = {"component":"navigation-bar__component_1ngip","iconWrapper":"navigation-bar__iconWrapper_1ngip","back":"navigation-bar__back_1ngip","floating":"navigation-bar__floating_1ngip"};
18
+ require('./index.css')
19
+
20
+ var iconComponents = {
21
+ back: React__default.default.createElement(ChevronLeftMIcon.ChevronLeftMIcon, null),
22
+ floatingBack: React__default.default.createElement(ChevronLeftMIcon.ChevronLeftMIcon, { className: styles.floating }),
23
+ close: React__default.default.createElement(CrossMIcon.CrossMIcon, { className: styles.floating }),
24
+ };
25
+ var ActionIconAddon = function (_a) {
26
+ var _b;
27
+ var onClick = _a.onClick, className = _a.className, _c = _a.action, action = _c === void 0 ? 'back' : _c, dataTestId = _a.dataTestId, htmlAttributes = tslib.__rest(_a, ["onClick", "className", "action", "dataTestId"]);
28
+ return (React__default.default.createElement(desktop.ButtonDesktop, tslib.__assign({ view: 'text', size: 's', onClick: onClick, "aria-label": action === 'close' ? 'закрыть' : 'назад', className: cn__default.default(styles.component, className), dataTestId: dataTestId }, htmlAttributes),
29
+ React__default.default.createElement("div", { className: cn__default.default(styles.iconWrapper, (_b = {}, _b[styles[action]] = Boolean(styles[action]), _b)) }, iconComponents[action])));
30
+ };
31
+
32
+ exports.ActionIconAddon = 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,9 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var components_actionIconAddon_Component = require('./Component.js');
6
+
7
+
8
+
9
+ exports.ActionIconAddon = components_actionIconAddon_Component.ActionIconAddon;
@@ -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,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var React = require('react');
7
+ var cn = require('classnames');
8
+ var desktop = require('@alfalab/core-components-button/desktop');
9
+ var coreComponentsTypography = require('@alfalab/core-components-typography');
10
+
11
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
12
+
13
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
14
+ var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
15
+
16
+ var styles = {"component":"navigation-bar__component_bdo4g","text":"navigation-bar__text_bdo4g"};
17
+ require('./index.css')
18
+
19
+ var ActionTextAddon = function (_a) {
20
+ var _b = _a.text, text = _b === void 0 ? 'Назад' : _b, onClick = _a.onClick, className = _a.className, action = _a.action, dataTestId = _a.dataTestId, htmlAttributes = tslib.__rest(_a, ["text", "onClick", "className", "action", "dataTestId"]);
21
+ return (React__default.default.createElement(desktop.ButtonDesktop, tslib.__assign({ view: 'text', size: 's', onClick: onClick, "aria-label": text, className: cn__default.default(styles.component, className), dataTestId: dataTestId }, htmlAttributes),
22
+ React__default.default.createElement(coreComponentsTypography.Typography.Text, { className: styles.text, view: 'component', weight: action === 'primary' ? 'medium' : 'regular' }, text)));
23
+ };
24
+
25
+ exports.ActionTextAddon = ActionTextAddon;
@@ -1,9 +1,6 @@
1
+ /* hash: 1mmbp */
1
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 */
2
- } /* deprecated */ :root {
3
- --color-light-neutral-1500: #0e0e0e;
4
- --color-light-neutral-translucent-100: rgba(38, 55, 88, 0.06);
5
- --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 */
6
- --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 */
7
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 */
8
5
  } :root {
9
6
  } :root {
@@ -14,34 +11,13 @@
14
11
 
15
12
  /* Hard up */
16
13
  } :root {
17
- --border-radius-circle: 50%;
18
14
  } :root {
15
+ --gap-xs: 8px;
16
+ --gap-m: 16px;
19
17
  } :root {
20
18
  } :root {
21
- } :root {
22
- /* closer-mobile */
23
- --navigation-bar-closer-mobile-color: var(--color-light-neutral-translucent-700);
24
-
25
- /* back-arrow */
26
- } .closer {
27
- flex-shrink: 0;
28
- width: 48px;
29
- height: 48px;
30
- margin-left: auto;
31
- display: flex;
32
- align-items: center;
33
- justify-content: center;
34
- } .button {
35
- background: var(--color-light-bg-primary-alpha-40);
36
- -webkit-backdrop-filter: blur(10px);
37
- backdrop-filter: blur(10px);
38
- color: var(--color-light-neutral-1500)
39
- } .button.mobile {
40
- background: var(--color-light-neutral-translucent-100);
41
- color: var(--navigation-bar-closer-mobile-color);
42
- } .button.button {
43
- border-radius: var(--border-radius-circle);
44
- } .sticky {
45
- position: sticky;
46
- top: 0;
19
+ } .navigation-bar__component_bdo4g {
20
+ height: 100%;
21
+ } .navigation-bar__text_bdo4g {
22
+ padding: var(--gap-xs) var(--gap-m);
47
23
  }
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var components_actionTextAddon_Component = require('./Component.js');
6
+
7
+
8
+
9
+ exports.ActionTextAddon = components_actionTextAddon_Component.ActionTextAddon;
@@ -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 };