@alfalab/core-components-navigation-bar-private 0.5.7 → 0.6.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/Component.js +5 -5
- package/components/back-arrow-addon/Component.js +1 -1
- package/components/back-arrow-addon/index.css +16 -13
- package/components/closer/Component.js +1 -1
- package/components/closer/index.css +10 -7
- package/cssm/Component.js +4 -4
- package/cssm/components/back-arrow-addon/index.module.css +4 -1
- package/cssm/components/closer/index.module.css +4 -1
- package/cssm/index.module.css +4 -1
- package/cssm/types.d.ts +13 -1
- package/cssm/vars.css +3 -0
- package/esm/Component.js +5 -5
- package/esm/components/back-arrow-addon/Component.js +1 -1
- package/esm/components/back-arrow-addon/index.css +16 -13
- package/esm/components/closer/Component.js +1 -1
- package/esm/components/closer/index.css +10 -7
- package/esm/index.css +31 -28
- package/esm/types.d.ts +13 -1
- package/index.css +31 -28
- package/modern/Component.js +5 -5
- package/modern/components/back-arrow-addon/Component.js +1 -1
- package/modern/components/back-arrow-addon/index.css +16 -13
- package/modern/components/closer/Component.js +1 -1
- package/modern/components/closer/index.css +10 -7
- package/modern/index.css +31 -28
- package/modern/types.d.ts +13 -1
- package/moderncssm/Component.js +4 -4
- package/moderncssm/types.d.ts +13 -1
- package/package.json +7 -7
- package/src/Component.tsx +14 -2
- package/src/types.ts +16 -1
- package/types.d.ts +13 -1
package/modern/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ReactNode } from "react";
|
|
3
|
+
import { ReactNode, RefObject } from "react";
|
|
4
4
|
import { BackArrowAddonProps } from "./components/back-arrow-addon/index";
|
|
5
5
|
import { CloserProps } from "./components/closer/index";
|
|
6
6
|
type NavigationBarPrivateProps = {
|
|
@@ -108,6 +108,18 @@ type NavigationBarPrivateProps = {
|
|
|
108
108
|
* Ссылка на родительскую ноду overflow: auto
|
|
109
109
|
*/
|
|
110
110
|
scrollableParentRef?: React.RefObject<HTMLDivElement>;
|
|
111
|
+
/**
|
|
112
|
+
* Data атрибут для компонента
|
|
113
|
+
*/
|
|
114
|
+
dataName?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Дополнительный класс для title
|
|
117
|
+
*/
|
|
118
|
+
titleClassName?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Ref для title элемента
|
|
121
|
+
*/
|
|
122
|
+
titleRef?: RefObject<HTMLDivElement>;
|
|
111
123
|
};
|
|
112
124
|
type ContentParams = {
|
|
113
125
|
extraClassName?: string;
|
package/moderncssm/Component.js
CHANGED
|
@@ -9,7 +9,7 @@ import styles from './index.module.css';
|
|
|
9
9
|
|
|
10
10
|
/* eslint-disable complexity */
|
|
11
11
|
const ADDONS_HEIGHT = 48;
|
|
12
|
-
const NavigationBarPrivate = forwardRef(({ addonClassName, className, contentClassName, closerClassName, leftAddons, rightAddons, bottomAddons, bottomAddonsClassName, children, align = 'left', trim = true, title, titleSize = 'default', subtitle, hasCloser, hasBackButton, backButtonClassName, backButtonProps, dataTestId, imageUrl, closerIcon, onClose, view, scrollableParentRef, sticky, onBack, }, ref) => {
|
|
12
|
+
const NavigationBarPrivate = forwardRef(({ addonClassName, className, contentClassName, closerClassName, leftAddons, rightAddons, bottomAddons, bottomAddonsClassName, children, align = 'left', trim = true, title, titleSize = 'default', subtitle, hasCloser, hasBackButton, backButtonClassName, backButtonProps, dataTestId, imageUrl, closerIcon, onClose, view, scrollableParentRef, sticky, onBack, dataName, titleClassName, titleRef, }, ref) => {
|
|
13
13
|
const [scrollTop, setScrollTop] = useState(0);
|
|
14
14
|
const [titleMargin, setTitleMargin] = useState({ left: 0, right: 0 });
|
|
15
15
|
const bottomContentRef = useRef(null);
|
|
@@ -85,8 +85,8 @@ const NavigationBarPrivate = forwardRef(({ addonClassName, className, contentCla
|
|
|
85
85
|
[styles.withCompactTitle]: view === 'mobile' && compactTitle && hasContent,
|
|
86
86
|
}), "aria-hidden": hidden },
|
|
87
87
|
children && React.createElement("div", { className: styles.children }, children),
|
|
88
|
-
title && (React.createElement("div", { className: styles.title, "data-test-id": hidden ? undefined : getDataTestId(dataTestId, 'title') }, title)),
|
|
89
|
-
compactTitle && subtitle && React.createElement("div", { className: styles.subtitle }, subtitle)));
|
|
88
|
+
title && (React.createElement("div", { className: cn(styles.title, titleClassName), "data-test-id": hidden ? undefined : getDataTestId(dataTestId, 'title'), ref: titleRef }, title)),
|
|
89
|
+
compactTitle && subtitle && (React.createElement("div", { className: styles.subtitle, "data-test-id": getDataTestId(dataTestId, 'subtitle') }, subtitle))));
|
|
90
90
|
};
|
|
91
91
|
const renderCloser = () => (React.createElement("div", { className: cn(styles.addon, styles.closer, closerClassName) },
|
|
92
92
|
React.createElement(Closer, { view: view, icon: closerIcon, dataTestId: getDataTestId(dataTestId, 'closer'), onClose: onClose })));
|
|
@@ -96,7 +96,7 @@ const NavigationBarPrivate = forwardRef(({ addonClassName, className, contentCla
|
|
|
96
96
|
bottomContentRef.current && {
|
|
97
97
|
top: -bottomContentRef.current.scrollHeight,
|
|
98
98
|
}),
|
|
99
|
-
} },
|
|
99
|
+
}, "data-name": dataName },
|
|
100
100
|
React.createElement("div", { className: cn(styles.mainLine, {
|
|
101
101
|
[styles.mainLineSticky]: withAnimation,
|
|
102
102
|
[styles.mainLineWithImageBg]: imageUrl,
|
package/moderncssm/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ReactNode } from "react";
|
|
3
|
+
import { ReactNode, RefObject } from "react";
|
|
4
4
|
import { BackArrowAddonProps } from "./components/back-arrow-addon/index";
|
|
5
5
|
import { CloserProps } from "./components/closer/index";
|
|
6
6
|
type NavigationBarPrivateProps = {
|
|
@@ -108,6 +108,18 @@ type NavigationBarPrivateProps = {
|
|
|
108
108
|
* Ссылка на родительскую ноду overflow: auto
|
|
109
109
|
*/
|
|
110
110
|
scrollableParentRef?: React.RefObject<HTMLDivElement>;
|
|
111
|
+
/**
|
|
112
|
+
* Data атрибут для компонента
|
|
113
|
+
*/
|
|
114
|
+
dataName?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Дополнительный класс для title
|
|
117
|
+
*/
|
|
118
|
+
titleClassName?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Ref для title элемента
|
|
121
|
+
*/
|
|
122
|
+
titleRef?: RefObject<HTMLDivElement>;
|
|
111
123
|
};
|
|
112
124
|
type ContentParams = {
|
|
113
125
|
extraClassName?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-navigation-bar-private",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Navigation bar private component",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
},
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@alfalab/core-components-icon-button": "^6.11.
|
|
16
|
-
"@alfalab/core-components-button": "^11.11.
|
|
17
|
-
"@alfalab/core-components-typography": "^4.11.
|
|
18
|
-
"@alfalab/core-components-shared": "^0.
|
|
15
|
+
"@alfalab/core-components-icon-button": "^6.11.8",
|
|
16
|
+
"@alfalab/core-components-button": "^11.11.5",
|
|
17
|
+
"@alfalab/core-components-typography": "^4.11.4",
|
|
18
|
+
"@alfalab/core-components-shared": "^0.16.0",
|
|
19
19
|
"@alfalab/hooks": "^1.13.1",
|
|
20
20
|
"@alfalab/icons-glyph": "^2.210.0",
|
|
21
21
|
"classnames": "^2.5.1",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": "^16.9.0 || ^17.0.1 || ^18.0.0"
|
|
27
27
|
},
|
|
28
|
-
"themesVersion": "13.7.
|
|
29
|
-
"varsVersion": "9.
|
|
28
|
+
"themesVersion": "13.7.1",
|
|
29
|
+
"varsVersion": "9.18.0"
|
|
30
30
|
}
|
package/src/Component.tsx
CHANGED
|
@@ -43,6 +43,9 @@ export const NavigationBarPrivate = forwardRef<HTMLDivElement, NavigationBarPriv
|
|
|
43
43
|
scrollableParentRef,
|
|
44
44
|
sticky,
|
|
45
45
|
onBack,
|
|
46
|
+
dataName,
|
|
47
|
+
titleClassName,
|
|
48
|
+
titleRef,
|
|
46
49
|
},
|
|
47
50
|
ref,
|
|
48
51
|
) => {
|
|
@@ -157,13 +160,21 @@ export const NavigationBarPrivate = forwardRef<HTMLDivElement, NavigationBarPriv
|
|
|
157
160
|
{children && <div className={styles.children}>{children}</div>}
|
|
158
161
|
{title && (
|
|
159
162
|
<div
|
|
160
|
-
className={styles.title}
|
|
163
|
+
className={cn(styles.title, titleClassName)}
|
|
161
164
|
data-test-id={hidden ? undefined : getDataTestId(dataTestId, 'title')}
|
|
165
|
+
ref={titleRef}
|
|
162
166
|
>
|
|
163
167
|
{title}
|
|
164
168
|
</div>
|
|
165
169
|
)}
|
|
166
|
-
{compactTitle && subtitle &&
|
|
170
|
+
{compactTitle && subtitle && (
|
|
171
|
+
<div
|
|
172
|
+
className={styles.subtitle}
|
|
173
|
+
data-test-id={getDataTestId(dataTestId, 'subtitle')}
|
|
174
|
+
>
|
|
175
|
+
{subtitle}
|
|
176
|
+
</div>
|
|
177
|
+
)}
|
|
167
178
|
</div>
|
|
168
179
|
);
|
|
169
180
|
};
|
|
@@ -191,6 +202,7 @@ export const NavigationBarPrivate = forwardRef<HTMLDivElement, NavigationBarPriv
|
|
|
191
202
|
top: -bottomContentRef.current.scrollHeight,
|
|
192
203
|
}),
|
|
193
204
|
}}
|
|
205
|
+
data-name={dataName}
|
|
194
206
|
>
|
|
195
207
|
<div
|
|
196
208
|
className={cn(styles.mainLine, {
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode, RefObject } from 'react';
|
|
2
2
|
|
|
3
3
|
import { BackArrowAddonProps } from './components/back-arrow-addon';
|
|
4
4
|
import type { CloserProps } from './components/closer';
|
|
@@ -133,6 +133,21 @@ export type NavigationBarPrivateProps = {
|
|
|
133
133
|
* Ссылка на родительскую ноду overflow: auto
|
|
134
134
|
*/
|
|
135
135
|
scrollableParentRef?: React.RefObject<HTMLDivElement>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Data атрибут для компонента
|
|
139
|
+
*/
|
|
140
|
+
dataName?: string;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Дополнительный класс для title
|
|
144
|
+
*/
|
|
145
|
+
titleClassName?: string;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Ref для title элемента
|
|
149
|
+
*/
|
|
150
|
+
titleRef?: RefObject<HTMLDivElement>;
|
|
136
151
|
};
|
|
137
152
|
|
|
138
153
|
export type ContentParams = {
|
package/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ReactNode } from "react";
|
|
3
|
+
import { ReactNode, RefObject } from "react";
|
|
4
4
|
import { BackArrowAddonProps } from "./components/back-arrow-addon/index";
|
|
5
5
|
import { CloserProps } from "./components/closer/index";
|
|
6
6
|
type NavigationBarPrivateProps = {
|
|
@@ -108,6 +108,18 @@ type NavigationBarPrivateProps = {
|
|
|
108
108
|
* Ссылка на родительскую ноду overflow: auto
|
|
109
109
|
*/
|
|
110
110
|
scrollableParentRef?: React.RefObject<HTMLDivElement>;
|
|
111
|
+
/**
|
|
112
|
+
* Data атрибут для компонента
|
|
113
|
+
*/
|
|
114
|
+
dataName?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Дополнительный класс для title
|
|
117
|
+
*/
|
|
118
|
+
titleClassName?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Ref для title элемента
|
|
121
|
+
*/
|
|
122
|
+
titleRef?: RefObject<HTMLDivElement>;
|
|
111
123
|
};
|
|
112
124
|
type ContentParams = {
|
|
113
125
|
extraClassName?: string;
|