@cloud-ru/ds-tabs 1.0.12-preview-46866d52.0 → 1.0.12-preview-882bc8d5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -8
- package/README.md +20 -20
- package/dist/cjs/components/ScrollButton/ScrollButton.d.ts +3 -3
- package/dist/cjs/components/ScrollButton/ScrollButton.js +2 -2
- package/dist/cjs/components/ScrollButton/styles.module.css +16 -16
- package/dist/cjs/components/Tab/Tab.d.ts +1 -1
- package/dist/cjs/components/Tab/Tab.js +7 -7
- package/dist/cjs/components/Tab/styles.module.css +56 -57
- package/dist/cjs/components/TabBar/TabBar.d.ts +8 -8
- package/dist/cjs/components/TabBar/TabBar.js +9 -9
- package/dist/cjs/components/TabBar/hooks.js +0 -3
- package/dist/cjs/components/TabBar/styles.module.css +29 -43
- package/dist/cjs/constants.d.ts +3 -3
- package/dist/cjs/constants.js +4 -4
- package/dist/cjs/context.d.ts +2 -2
- package/dist/cjs/style.css +101 -116
- package/dist/cjs/types.d.ts +3 -3
- package/dist/esm/components/ScrollButton/ScrollButton.d.ts +3 -3
- package/dist/esm/components/ScrollButton/ScrollButton.js +2 -2
- package/dist/esm/components/ScrollButton/styles.module.css +16 -16
- package/dist/esm/components/Tab/Tab.d.ts +1 -1
- package/dist/esm/components/Tab/Tab.js +8 -8
- package/dist/esm/components/Tab/styles.module.css +56 -57
- package/dist/esm/components/TabBar/TabBar.d.ts +8 -8
- package/dist/esm/components/TabBar/TabBar.js +10 -10
- package/dist/esm/components/TabBar/hooks.js +0 -3
- package/dist/esm/components/TabBar/styles.module.css +29 -43
- package/dist/esm/constants.d.ts +3 -3
- package/dist/esm/constants.js +3 -3
- package/dist/esm/context.d.ts +2 -2
- package/dist/esm/style.css +101 -116
- package/dist/esm/types.d.ts +3 -3
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/ScrollButton/ScrollButton.tsx +4 -4
- package/src/components/ScrollButton/styles.module.scss +6 -4
- package/src/components/Tab/Tab.tsx +12 -12
- package/src/components/Tab/styles.module.scss +41 -13
- package/src/components/TabBar/TabBar.tsx +30 -28
- package/src/components/TabBar/hooks.ts +0 -2
- package/src/components/TabBar/styles.module.scss +29 -66
- package/src/constants.ts +3 -3
- package/src/types.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
## Unreleased
|
|
2
|
-
|
|
3
|
-
### BREAKING CHANGES
|
|
4
|
-
|
|
5
|
-
- `Tabs.TabBar.size` заменён на `type`: `l` → `primary`, `m` → `secondary`. По умолчанию используется `primary`. Экспорты `SIZE` и `Size` заменены на `TYPE` и `Type`; атрибут `data-size` — на `data-type`.
|
|
6
|
-
- Tabs использует новую анатомию токенов из коммита `27e53be4`; пакет необходимо выпускать вместе с обновлённым `@ds/figma-variables`.
|
|
7
|
-
- Разделитель проходит вдоль всей панели, включая действие. Высоты вкладок, отступы и action-область соответствуют Primary/Secondary. Длинные подписи остаются целиком в одной строке; hover выбранной вкладки не меняет её заливку.
|
|
8
|
-
|
|
9
1
|
# Change Log
|
|
10
2
|
|
|
11
3
|
All notable changes to this project will be documented in this file.
|
package/README.md
CHANGED
|
@@ -45,8 +45,8 @@ import { Tabs } from '@cloud-ru/ds-tabs'
|
|
|
45
45
|
#### Orientation
|
|
46
46
|
`horizontal` — табы в строку (дефолт), `vertical` — колонкой (для боковых навигаций).
|
|
47
47
|
|
|
48
|
-
####
|
|
49
|
-
`
|
|
48
|
+
#### Size
|
|
49
|
+
`m` — дефолт, `l` — для крупных лейаутов и посадочных страниц.
|
|
50
50
|
|
|
51
51
|
### Примеры использования
|
|
52
52
|
|
|
@@ -94,8 +94,8 @@ export function Uncontrolled() {
|
|
|
94
94
|
|
|
95
95
|
### Анатомия
|
|
96
96
|
|
|
97
|
-
####
|
|
98
|
-
|
|
97
|
+
#### Size
|
|
98
|
+
Высота таба: `m` — дефолт, `l` — для крупных лейаутов. Наследуется от `TabBar`.
|
|
99
99
|
|
|
100
100
|
#### Marker position
|
|
101
101
|
Положение активного маркера: `before` — перед содержимым, `after` — после. Наследуется от `TabBar`.
|
|
@@ -111,7 +111,7 @@ export function WithCounter() {
|
|
|
111
111
|
return (
|
|
112
112
|
<Tabs defaultValue='inbox'>
|
|
113
113
|
<Tabs.TabBar>
|
|
114
|
-
<Tabs.Tab value='inbox' label='Входящие' counter={{
|
|
114
|
+
<Tabs.Tab value='inbox' label='Входящие' counter={{ label: 12 }} />
|
|
115
115
|
<Tabs.Tab value='archive' label='Архив' />
|
|
116
116
|
</Tabs.TabBar>
|
|
117
117
|
</Tabs>
|
|
@@ -152,42 +152,42 @@ export function Disabled() {
|
|
|
152
152
|
|
|
153
153
|
## TabBar
|
|
154
154
|
|
|
155
|
-
Панель табов — задаёт
|
|
155
|
+
Панель табов — задаёт размер, ориентацию, позицию маркера и слот справа (slotActionButton) для дополнительных действий.
|
|
156
156
|
|
|
157
157
|
Панель переключателей табов. Задаёт:
|
|
158
158
|
|
|
159
|
-
- `
|
|
159
|
+
- `size` — `l` (верхнеуровневый) или `m` (внутри контента).
|
|
160
160
|
- `orientation` — `horizontal` (по умолчанию) или `vertical`.
|
|
161
161
|
- `markerPosition` — позиция активного маркера (`before` / `after`).
|
|
162
|
-
- `
|
|
162
|
+
- `slotActionButton` — слот справа от табов для дополнительных действий.
|
|
163
163
|
|
|
164
164
|
### Когда использовать
|
|
165
165
|
|
|
166
166
|
- Внутри `Tabs` как единственный контейнер списка кнопок-табов.
|
|
167
|
-
- Если нужно разместить дополнительные действия справа от табов (через слот `
|
|
167
|
+
- Если нужно разместить дополнительные действия справа от табов (через слот `slotActionButton`).
|
|
168
168
|
|
|
169
169
|
### Анатомия
|
|
170
170
|
|
|
171
171
|
#### Orientation
|
|
172
172
|
`horizontal` — бар в строку, `vertical` — колонкой.
|
|
173
173
|
|
|
174
|
-
####
|
|
175
|
-
`
|
|
174
|
+
#### Size
|
|
175
|
+
`m` — дефолт, `l` — для крупных лейаутов.
|
|
176
176
|
|
|
177
177
|
#### Marker position
|
|
178
178
|
Положение активного маркера относительно содержимого таба: `before` — перед, `after` — после.
|
|
179
179
|
|
|
180
180
|
### Примеры использования
|
|
181
181
|
|
|
182
|
-
####
|
|
182
|
+
#### Size L — верхнеуровневый
|
|
183
183
|
|
|
184
184
|
```tsx
|
|
185
|
-
import {
|
|
185
|
+
import { SIZE, Tabs } from '@cloud-ru/ds-tabs';
|
|
186
186
|
|
|
187
|
-
export function
|
|
187
|
+
export function SizeL() {
|
|
188
188
|
return (
|
|
189
189
|
<Tabs defaultValue='a'>
|
|
190
|
-
<Tabs.TabBar
|
|
190
|
+
<Tabs.TabBar size={SIZE.L}>
|
|
191
191
|
<Tabs.Tab value='a' label='Первая' />
|
|
192
192
|
<Tabs.Tab value='b' label='Вторая' />
|
|
193
193
|
</Tabs.TabBar>
|
|
@@ -219,14 +219,14 @@ export function Vertical() {
|
|
|
219
219
|
|
|
220
220
|
| Prop | Type | Default | Description |
|
|
221
221
|
|------|------|---------|-------------|
|
|
222
|
-
| `afterContent` | `ReactNode` | — | Слот действия: контент после списка табов — справа при горизонтальной <br/> ориентации, снизу при вертикальной. Разделитель проходит вдоль всей панели. |
|
|
223
222
|
| `children` | `TabProps` | — | Контент (элементы Tabs.Tab) |
|
|
224
223
|
| `className` | `string` | — | CSS-класс |
|
|
225
224
|
| `data-test-id` | `string` | — | |
|
|
226
|
-
| `
|
|
225
|
+
| `disableDivider` | `boolean` | `false` | Скрыть разделитель под/рядом с панелью табов |
|
|
227
226
|
| `markerPosition` | `"after"` \| `"before"` | `after` | Позиция маркера относительно таб-бара. <br/> Значения ориентационно-нейтральны, в Figma та же ось названа сторонами: <br/> `before` = Figma `top` (horizontal) / `left` (vertical), <br/> `after` = Figma `bottom` (horizontal) / `right` (vertical). |
|
|
228
227
|
| `orientation` | `"horizontal"` \| `"vertical"` | `horizontal` | Ориентация |
|
|
229
|
-
| `
|
|
228
|
+
| `size` | `"l"` \| `"m"` | `l` | Размер панели табов: L — верхнеуровневый, M — на уровне контента |
|
|
229
|
+
| `slotActionButton` | `ReactNode` | — | Слот действия: контент после списка табов — справа при горизонтальной <br/> ориентации, снизу при вертикальной. Разделитель под ним не продолжается. |
|
|
230
230
|
|
|
231
231
|
##### Related types
|
|
232
232
|
|
|
@@ -234,6 +234,8 @@ export function Vertical() {
|
|
|
234
234
|
|
|
235
235
|
- `Orientation` = `"horizontal"` \| `"vertical"`
|
|
236
236
|
|
|
237
|
+
- `Size` = `"l"` \| `"m"`
|
|
238
|
+
|
|
237
239
|
**TabProps**
|
|
238
240
|
|
|
239
241
|
| Prop | Type | Default | Description |
|
|
@@ -246,8 +248,6 @@ export function Vertical() {
|
|
|
246
248
|
| `onClick` | `((event: MouseEvent<HTMLButtonElement>) => void) \| undefined` | — | Колбек клика по кнопке переключения |
|
|
247
249
|
| `value` | `string` | — | Value вкладки |
|
|
248
250
|
|
|
249
|
-
- `Variant` = `"primary"` \| `"secondary"`
|
|
250
|
-
|
|
251
251
|
## TabContent
|
|
252
252
|
|
|
253
253
|
Контейнер контента таба — рендерится только когда его value совпадает с активным табом.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Direction, Orientation,
|
|
1
|
+
import { Direction, Orientation, Size } from '../../types';
|
|
2
2
|
export type ScrollButtonProps = {
|
|
3
|
-
|
|
3
|
+
size: Size;
|
|
4
4
|
direction: Direction;
|
|
5
5
|
orientation: Orientation;
|
|
6
6
|
onClick(): void;
|
|
7
7
|
};
|
|
8
|
-
export declare function ScrollButton({
|
|
8
|
+
export declare function ScrollButton({ size, onClick, direction, orientation }: ScrollButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,6 +14,6 @@ const MAP_DIRECTION_TO_ICON = {
|
|
|
14
14
|
top: (0, jsx_runtime_1.jsx)(system_1.ChevronUpSVG, {}),
|
|
15
15
|
bottom: (0, jsx_runtime_1.jsx)(system_1.ChevronDownSVG, {}),
|
|
16
16
|
};
|
|
17
|
-
function ScrollButton({
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.scrollButton, "data-direction": direction, "data-
|
|
17
|
+
function ScrollButton({ size, onClick, direction, orientation }) {
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.scrollButton, "data-direction": direction, "data-size": size, "data-orientation": orientation, "data-test-id": `tabs__scroll-button-${direction}`, children: (0, jsx_runtime_1.jsx)(button_1.Button, { tabIndex: -1, icon: MAP_DIRECTION_TO_ICON[direction], size: 's', view: 'elevated', appearance: 'neutral', onClick: onClick, "aria-label": `Scroll ${direction}` }) }));
|
|
19
19
|
}
|
|
@@ -4,29 +4,29 @@
|
|
|
4
4
|
align-items:center;
|
|
5
5
|
justify-content:center;
|
|
6
6
|
}
|
|
7
|
-
.scrollButton[data-
|
|
8
|
-
padding-left:var(--sn-tabs-anatomy-
|
|
7
|
+
.scrollButton[data-size=m][data-direction=left]{
|
|
8
|
+
padding-left:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
9
9
|
}
|
|
10
|
-
.scrollButton[data-
|
|
11
|
-
padding-right:var(--sn-tabs-anatomy-
|
|
10
|
+
.scrollButton[data-size=m][data-direction=right]{
|
|
11
|
+
padding-right:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
12
12
|
}
|
|
13
|
-
.scrollButton[data-
|
|
14
|
-
padding-top:var(--sn-tabs-anatomy-
|
|
13
|
+
.scrollButton[data-size=m][data-direction=top]{
|
|
14
|
+
padding-top:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
15
15
|
}
|
|
16
|
-
.scrollButton[data-
|
|
17
|
-
padding-bottom:var(--sn-tabs-anatomy-
|
|
16
|
+
.scrollButton[data-size=m][data-direction=bottom]{
|
|
17
|
+
padding-bottom:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
18
18
|
}
|
|
19
|
-
.scrollButton[data-
|
|
20
|
-
padding-left:var(--sn-tabs-anatomy-
|
|
19
|
+
.scrollButton[data-size=l][data-direction=left]{
|
|
20
|
+
padding-left:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
21
21
|
}
|
|
22
|
-
.scrollButton[data-
|
|
23
|
-
padding-right:var(--sn-tabs-anatomy-
|
|
22
|
+
.scrollButton[data-size=l][data-direction=right]{
|
|
23
|
+
padding-right:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
24
24
|
}
|
|
25
|
-
.scrollButton[data-
|
|
26
|
-
padding-top:var(--sn-tabs-anatomy-
|
|
25
|
+
.scrollButton[data-size=l][data-direction=top]{
|
|
26
|
+
padding-top:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
27
27
|
}
|
|
28
|
-
.scrollButton[data-
|
|
29
|
-
padding-bottom:var(--sn-tabs-anatomy-
|
|
28
|
+
.scrollButton[data-size=l][data-direction=bottom]{
|
|
29
|
+
padding-bottom:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
30
30
|
}
|
|
31
31
|
.scrollButton[data-direction=left]{
|
|
32
32
|
top:0;
|
|
@@ -13,7 +13,7 @@ export type TabProps = WithSupportProps<{
|
|
|
13
13
|
/** Счетчик, отображающийся внутри кнопки переключения */
|
|
14
14
|
counter?: {
|
|
15
15
|
/** Значение счетчика */
|
|
16
|
-
|
|
16
|
+
label: number;
|
|
17
17
|
/** Внешний вид */
|
|
18
18
|
appearance?: CounterProps['appearance'];
|
|
19
19
|
/** Роль, в которой применяется `appearance` счётчика */
|
|
@@ -14,8 +14,8 @@ const constants_1 = require("../../constants");
|
|
|
14
14
|
const context_1 = require("../../context");
|
|
15
15
|
const utils_2 = require("../../utils");
|
|
16
16
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
17
|
-
const
|
|
18
|
-
[constants_1.
|
|
17
|
+
const MAP_SIZE_TO_PROPS = {
|
|
18
|
+
[constants_1.SIZE.L]: {
|
|
19
19
|
typographyProps: {
|
|
20
20
|
variant: 'title',
|
|
21
21
|
size: 'm',
|
|
@@ -24,7 +24,7 @@ const MAP_VARIANT_TO_PROPS = {
|
|
|
24
24
|
size: 's',
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
|
-
[constants_1.
|
|
27
|
+
[constants_1.SIZE.M]: {
|
|
28
28
|
typographyProps: {
|
|
29
29
|
variant: 'title',
|
|
30
30
|
size: 's',
|
|
@@ -36,7 +36,7 @@ const MAP_VARIANT_TO_PROPS = {
|
|
|
36
36
|
};
|
|
37
37
|
function Tab({ label, value, disabled = false, className, onClick, counter, ...otherProps }) {
|
|
38
38
|
const ref = (0, react_1.useRef)(null);
|
|
39
|
-
const { onSelect,
|
|
39
|
+
const { onSelect, size, orientation, focusedTab, onFocus } = (0, context_1.useTabBarContext)();
|
|
40
40
|
const { selectedTab, setSelectedTab } = (0, context_1.useTabsContext)();
|
|
41
41
|
const selected = value === selectedTab;
|
|
42
42
|
(0, react_1.useEffect)(() => {
|
|
@@ -70,9 +70,9 @@ function Tab({ label, value, disabled = false, className, onClick, counter, ...o
|
|
|
70
70
|
const onFocusHandler = (0, react_1.useCallback)((e) => {
|
|
71
71
|
onFocus?.(e.target, value);
|
|
72
72
|
}, [onFocus, value]);
|
|
73
|
-
if (!
|
|
73
|
+
if (!size) {
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
|
-
const { typographyProps, counterProps } =
|
|
77
|
-
return ((0, jsx_runtime_1.jsx)("button", { type: 'button', role: 'tab', "data-test-id": `tabs__tab-${value}`, ...(0, utils_1.extractSupportProps)(otherProps), id: value, ref: ref, "aria-disabled": disabled, "data-disabled": disabled || undefined, className: (0, classnames_1.default)(styles_module_scss_1.default.tab, className), "aria-controls": (0, utils_2.getTabContentId)(value), "aria-selected": selected, "data-selected": selected || undefined, "data-
|
|
76
|
+
const { typographyProps, counterProps } = MAP_SIZE_TO_PROPS[size];
|
|
77
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: 'button', role: 'tab', "data-test-id": `tabs__tab-${value}`, ...(0, utils_1.extractSupportProps)(otherProps), id: value, ref: ref, "aria-disabled": disabled, "data-disabled": disabled || undefined, className: (0, classnames_1.default)(styles_module_scss_1.default.tab, className), "aria-controls": (0, utils_2.getTabContentId)(value), "aria-selected": selected, "data-selected": selected || undefined, "data-size": size, "data-orientation": orientation, onClick: handleClick, onFocus: onFocusHandler, onKeyDown: clickByEnterOrSpaceKey, children: (0, jsx_runtime_1.jsxs)(typography_1.Typography, { className: styles_module_scss_1.default.container, as: 'div', ...typographyProps, children: [label, counter && ((0, jsx_runtime_1.jsx)(counter_1.Counter, { appearance: counter.appearance, roleAppearance: counter.roleAppearance, value: counter.label, "data-test-id": `tabs__tab-counter-${value}`, ...counterProps })), (0, jsx_runtime_1.jsx)("span", { "data-state-layer": true, "aria-hidden": true, "data-state": 'emptyNeutralOnBackground' })] }) }));
|
|
78
78
|
}
|
|
@@ -3,67 +3,69 @@
|
|
|
3
3
|
position:relative;
|
|
4
4
|
display:inline-flex;
|
|
5
5
|
flex-direction:row;
|
|
6
|
-
flex-shrink:0;
|
|
7
6
|
align-items:center;
|
|
8
7
|
box-sizing:border-box;
|
|
9
8
|
padding:0;
|
|
10
9
|
border-width:0;
|
|
11
10
|
color:var(--sn-theme-color-available-version-textSecondary, var(--sn-brand-color-text-version-secondary, rgba(0, 0, 0, 0.7803921569)));
|
|
12
|
-
white-space:nowrap;
|
|
13
11
|
background-color:transparent;
|
|
14
12
|
outline:none;
|
|
15
13
|
}
|
|
16
|
-
.tab[data-orientation=horizontal][data-
|
|
17
|
-
min-height:var(--sn-tabs-anatomy-
|
|
18
|
-
padding-left:var(--sn-tabs-anatomy-
|
|
19
|
-
padding-right:var(--sn-tabs-anatomy-
|
|
20
|
-
}
|
|
21
|
-
.tab[data-orientation=horizontal][data-
|
|
22
|
-
padding-left:var(--sn-tabs-anatomy-
|
|
23
|
-
padding-right:var(--sn-tabs-anatomy-
|
|
24
|
-
border-radius:var(--sn-tabs-anatomy-
|
|
25
|
-
min-width:var(--sn-tabs-anatomy-
|
|
26
|
-
gap:var(--sn-tabs-anatomy-
|
|
27
|
-
min-height:var(--sn-tabs-anatomy-
|
|
28
|
-
}
|
|
29
|
-
.tab[data-orientation=vertical][data-
|
|
30
|
-
padding-left:var(--sn-tabs-anatomy-
|
|
31
|
-
padding-right:var(--sn-tabs-anatomy-
|
|
32
|
-
min-height:var(--sn-tabs-anatomy-
|
|
33
|
-
}
|
|
34
|
-
.tab[data-orientation=vertical][data-
|
|
35
|
-
min-width:var(--sn-tabs-anatomy-
|
|
36
|
-
gap:var(--sn-tabs-anatomy-
|
|
37
|
-
min-height:var(--sn-tabs-anatomy-
|
|
38
|
-
border-radius:var(--sn-tabs-anatomy-
|
|
39
|
-
padding-left:var(--sn-tabs-anatomy-
|
|
40
|
-
padding-right:var(--sn-tabs-anatomy-
|
|
41
|
-
}
|
|
42
|
-
.tab[data-orientation=horizontal][data-
|
|
43
|
-
min-height:var(--sn-tabs-anatomy-
|
|
44
|
-
padding-left:var(--sn-tabs-anatomy-
|
|
45
|
-
padding-right:var(--sn-tabs-anatomy-
|
|
46
|
-
}
|
|
47
|
-
.tab[data-orientation=horizontal][data-
|
|
48
|
-
min-width:var(--sn-tabs-anatomy-
|
|
49
|
-
min-height:var(--sn-tabs-anatomy-
|
|
50
|
-
gap:var(--sn-tabs-anatomy-
|
|
51
|
-
border-radius:var(--sn-tabs-anatomy-
|
|
52
|
-
padding-left:var(--sn-tabs-anatomy-
|
|
53
|
-
padding-right:var(--sn-tabs-anatomy-
|
|
54
|
-
}
|
|
55
|
-
.tab[data-orientation=vertical][data-
|
|
56
|
-
padding-left:var(--sn-tabs-anatomy-
|
|
57
|
-
padding-right:var(--sn-tabs-anatomy-
|
|
58
|
-
min-height:var(--sn-tabs-anatomy-
|
|
59
|
-
}
|
|
60
|
-
.tab[data-orientation=vertical][data-
|
|
61
|
-
min-width:var(--sn-tabs-anatomy-
|
|
62
|
-
padding-left:var(--sn-tabs-anatomy-
|
|
63
|
-
padding-right:var(--sn-tabs-anatomy-
|
|
64
|
-
border-radius:var(--sn-tabs-anatomy-
|
|
65
|
-
gap:var(--sn-tabs-anatomy-
|
|
66
|
-
min-height:var(--sn-tabs-anatomy-
|
|
14
|
+
.tab[data-orientation=horizontal][data-size=m]{
|
|
15
|
+
min-height:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-minHeight, var(--sn-density-size-m, var(--sn-density-scale-100-m, var(--sn-platform-comfort-scale-100-m, var(--sn-primitive-dimension-40, 40px)))));
|
|
16
|
+
padding-left:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-horizontalPadding, var(--sn-primitive-dimension-0, 0px));
|
|
17
|
+
padding-right:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-horizontalPadding, var(--sn-primitive-dimension-0, 0px));
|
|
18
|
+
}
|
|
19
|
+
.tab[data-orientation=horizontal][data-size=m] .container{
|
|
20
|
+
padding-left:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-vertical-m, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
21
|
+
padding-right:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-vertical-m, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
22
|
+
border-radius:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-borderRadius, var(--sn-brand-anatomy-radius-button-m, var(--sn-primitive-dimension-2, 2px)));
|
|
23
|
+
min-width:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-minWidth, var(--sn-density-size-m, var(--sn-density-scale-100-m, var(--sn-platform-comfort-scale-100-m, var(--sn-primitive-dimension-40, 40px)))));
|
|
24
|
+
gap:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-gap, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-vertical-m, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
25
|
+
min-height:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-minHeight, var(--sn-density-size-s, var(--sn-density-scale-100-s, var(--sn-platform-comfort-scale-100-s, var(--sn-primitive-dimension-32, 32px)))));
|
|
26
|
+
}
|
|
27
|
+
.tab[data-orientation=vertical][data-size=m]{
|
|
28
|
+
padding-left:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-interval-m, var(--sn-platform-comfort-spacing-interval-m, var(--sn-primitive-dimension-24, 24px))));
|
|
29
|
+
padding-right:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-interval-m, var(--sn-platform-comfort-spacing-interval-m, var(--sn-primitive-dimension-24, 24px))));
|
|
30
|
+
min-height:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-minHeight, var(--sn-density-size-m, var(--sn-density-scale-100-m, var(--sn-platform-comfort-scale-100-m, var(--sn-primitive-dimension-40, 40px)))));
|
|
31
|
+
}
|
|
32
|
+
.tab[data-orientation=vertical][data-size=m] .container{
|
|
33
|
+
min-width:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-minWidth, var(--sn-primitive-dimension-0, 0px));
|
|
34
|
+
gap:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-gap, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-vertical-m, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
35
|
+
min-height:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-minHeight, var(--sn-density-size-s, var(--sn-density-scale-100-s, var(--sn-platform-comfort-scale-100-s, var(--sn-primitive-dimension-32, 32px)))));
|
|
36
|
+
border-radius:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-borderRadius, var(--sn-brand-anatomy-radius-button-m, var(--sn-primitive-dimension-2, 2px)));
|
|
37
|
+
padding-left:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-vertical-m, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
38
|
+
padding-right:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-m, var(--sn-platform-comfort-spacing-control-wrapper-vertical-m, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
39
|
+
}
|
|
40
|
+
.tab[data-orientation=horizontal][data-size=l]{
|
|
41
|
+
min-height:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-minHeight, var(--sn-density-size-l, var(--sn-density-scale-100-l, var(--sn-platform-comfort-scale-100-l, var(--sn-primitive-dimension-48, 48px)))));
|
|
42
|
+
padding-left:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-horizontalPadding, var(--sn-density-spacing-control-container-horizontal-l, var(--sn-platform-comfort-spacing-control-container-horizontal-l, var(--sn-platform-comfort-scale-050-s, var(--sn-primitive-dimension-12, 12px)))));
|
|
43
|
+
padding-right:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-horizontalPadding, var(--sn-density-spacing-control-container-horizontal-l, var(--sn-platform-comfort-spacing-control-container-horizontal-l, var(--sn-platform-comfort-scale-050-s, var(--sn-primitive-dimension-12, 12px)))));
|
|
44
|
+
}
|
|
45
|
+
.tab[data-orientation=horizontal][data-size=l] .container{
|
|
46
|
+
min-width:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-minWidth, var(--sn-density-size-l, var(--sn-density-scale-100-l, var(--sn-platform-comfort-scale-100-l, var(--sn-primitive-dimension-48, 48px)))));
|
|
47
|
+
min-height:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-minHeight, var(--sn-density-size-m, var(--sn-density-scale-100-m, var(--sn-platform-comfort-scale-100-m, var(--sn-primitive-dimension-40, 40px)))));
|
|
48
|
+
gap:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-gap, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-vertical-l, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
49
|
+
border-radius:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-borderRadius, var(--sn-brand-anatomy-radius-button-l, var(--sn-primitive-dimension-2, 2px)));
|
|
50
|
+
padding-left:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-vertical-l, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
51
|
+
padding-right:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-vertical-l, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
52
|
+
}
|
|
53
|
+
.tab[data-orientation=vertical][data-size=l]{
|
|
54
|
+
padding-left:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-control-container-horizontal-l, var(--sn-platform-comfort-spacing-control-container-horizontal-l, var(--sn-platform-comfort-scale-050-s, var(--sn-primitive-dimension-12, 12px)))));
|
|
55
|
+
padding-right:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-control-container-horizontal-l, var(--sn-platform-comfort-spacing-control-container-horizontal-l, var(--sn-platform-comfort-scale-050-s, var(--sn-primitive-dimension-12, 12px)))));
|
|
56
|
+
min-height:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-minHeight, var(--sn-density-size-l, var(--sn-density-scale-100-l, var(--sn-platform-comfort-scale-100-l, var(--sn-primitive-dimension-48, 48px)))));
|
|
57
|
+
}
|
|
58
|
+
.tab[data-orientation=vertical][data-size=l] .container{
|
|
59
|
+
min-width:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-minWidth, var(--sn-density-size-l, var(--sn-density-scale-100-l, var(--sn-platform-comfort-scale-100-l, var(--sn-primitive-dimension-48, 48px)))));
|
|
60
|
+
padding-left:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-vertical-l, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
61
|
+
padding-right:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-vertical-l, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
62
|
+
border-radius:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-borderRadius, var(--sn-brand-anatomy-radius-button-l, var(--sn-primitive-dimension-2, 2px)));
|
|
63
|
+
gap:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-gap, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-horizontal-l, var(--sn-platform-comfort-spacing-control-wrapper-vertical-l, var(--sn-platform-comfort-scale-025-xs, var(--sn-primitive-dimension-4, 4px))))));
|
|
64
|
+
min-height:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-minHeight, var(--sn-density-size-m, var(--sn-density-scale-100-m, var(--sn-platform-comfort-scale-100-m, var(--sn-primitive-dimension-40, 40px)))));
|
|
65
|
+
}
|
|
66
|
+
.tab[data-orientation=vertical][data-size=l]{
|
|
67
|
+
padding-right:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-interval-m, var(--sn-platform-comfort-spacing-interval-m, var(--sn-primitive-dimension-24, 24px))));
|
|
68
|
+
padding-left:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-interval-m, var(--sn-platform-comfort-spacing-interval-m, var(--sn-primitive-dimension-24, 24px))));
|
|
67
69
|
}
|
|
68
70
|
.tab[data-selected=true], .tab:focus-visible, .tab:hover{
|
|
69
71
|
color:var(--sn-theme-color-available-version-textMain, var(--sn-brand-color-text-version-main, #000000));
|
|
@@ -81,7 +83,7 @@
|
|
|
81
83
|
background:var(--sn-theme-color-material-stateLayer-neutral-onBackground-defaultEmpty-filled, var(--sn-brand-color-state-neutral-forLightMode-default-background, rgba(0, 0, 0, 0)));
|
|
82
84
|
}
|
|
83
85
|
@media (hover: hover){
|
|
84
|
-
.tab:hover:not([data-disabled], [data-loading]
|
|
86
|
+
.tab:hover:not([data-disabled], [data-loading]) .container > [data-state-layer][data-state=emptyNeutralOnBackground]{
|
|
85
87
|
background:var(--sn-theme-color-material-stateLayer-neutral-onBackground-hovered-filled, var(--sn-brand-color-state-neutral-forLightMode-hovered-background, rgba(0, 0, 0, 0.0784313725)));
|
|
86
88
|
}
|
|
87
89
|
}
|
|
@@ -93,12 +95,9 @@
|
|
|
93
95
|
.tab .container{
|
|
94
96
|
position:relative;
|
|
95
97
|
display:flex;
|
|
96
|
-
flex-shrink:0;
|
|
97
98
|
align-items:center;
|
|
98
99
|
justify-content:center;
|
|
99
100
|
box-sizing:border-box;
|
|
100
|
-
width:-moz-max-content;
|
|
101
|
-
width:max-content;
|
|
102
101
|
}
|
|
103
102
|
.tab:focus-visible .container{
|
|
104
103
|
outline:var(--sn-primitive-strokeWeight-strokeSemiBold, 2px) solid var(--sn-theme-color-available-complementary, #000000);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
2
2
|
import { ReactElement, ReactNode } from 'react';
|
|
3
|
-
import { MarkerPosition, Orientation,
|
|
3
|
+
import { MarkerPosition, Orientation, Size } from '../../types';
|
|
4
4
|
import { TabProps } from '../Tab';
|
|
5
5
|
export type TabBarProps = WithSupportProps<{
|
|
6
6
|
/** Контент (элементы Tabs.Tab) */
|
|
7
7
|
children: ReactElement<TabProps>[];
|
|
8
8
|
/**
|
|
9
9
|
* Слот действия: контент после списка табов — справа при горизонтальной
|
|
10
|
-
* ориентации, снизу при вертикальной. Разделитель
|
|
10
|
+
* ориентации, снизу при вертикальной. Разделитель под ним не продолжается.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
slotActionButton?: ReactNode;
|
|
13
13
|
/** Ориентация */
|
|
14
14
|
orientation?: Orientation;
|
|
15
15
|
/**
|
|
@@ -20,11 +20,11 @@ export type TabBarProps = WithSupportProps<{
|
|
|
20
20
|
* `after` = Figma `bottom` (horizontal) / `right` (vertical).
|
|
21
21
|
*/
|
|
22
22
|
markerPosition?: MarkerPosition;
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
23
|
+
/** Размер панели табов: L — верхнеуровневый, M — на уровне контента */
|
|
24
|
+
size?: Size;
|
|
25
|
+
/** Скрыть разделитель под/рядом с панелью табов */
|
|
26
|
+
disableDivider?: boolean;
|
|
27
27
|
/** CSS-класс */
|
|
28
28
|
className?: string;
|
|
29
29
|
}>;
|
|
30
|
-
export declare function TabBar({ children, className,
|
|
30
|
+
export declare function TabBar({ children, className, size, orientation, markerPosition, slotActionButton, disableDivider, ...otherProps }: TabBarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -19,7 +19,7 @@ const SCROLL_CONTAINER_ORIENTATION_MAP = {
|
|
|
19
19
|
[constants_1.ORIENTATION.Horizontal]: styles_module_scss_1.default.horizontalScrollContainer,
|
|
20
20
|
[constants_1.ORIENTATION.Vertical]: styles_module_scss_1.default.verticalScrollContainer,
|
|
21
21
|
};
|
|
22
|
-
function TabBar({ children, className,
|
|
22
|
+
function TabBar({ children, className, size = constants_1.SIZE.L, orientation = constants_1.ORIENTATION.Horizontal, markerPosition = constants_1.MARKER_POSITION.After, slotActionButton, disableDivider = false, ...otherProps }) {
|
|
23
23
|
const scrollContainerRef = (0, react_1.useRef)(null);
|
|
24
24
|
const { selectedTab, setSelectedTab } = (0, context_1.useTabsContext)();
|
|
25
25
|
const { hasOverflow, scrollLeft, scrollRight, scrollTop, scrollBottom } = (0, hooks_1.useScrollContainer)(scrollContainerRef);
|
|
@@ -64,7 +64,7 @@ function TabBar({ children, className, variant = constants_1.VARIANT.Primary, or
|
|
|
64
64
|
return () => {
|
|
65
65
|
resizeObserver.disconnect();
|
|
66
66
|
};
|
|
67
|
-
}, [children,
|
|
67
|
+
}, [children, size, updateMarkPosition]);
|
|
68
68
|
const scrollContainerToElement = (0, react_1.useCallback)((element) => {
|
|
69
69
|
const container = scrollContainerRef.current;
|
|
70
70
|
if (element && container) {
|
|
@@ -109,11 +109,11 @@ function TabBar({ children, className, variant = constants_1.VARIANT.Primary, or
|
|
|
109
109
|
setFocusedTab(newFocusTab);
|
|
110
110
|
}
|
|
111
111
|
}, [getPrev, getNext, focusedTab, selectedTab]);
|
|
112
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.tabBar, className), role: 'tablist', "data-orientation": orientation, "data-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.tabBar, className), role: 'tablist', "data-orientation": orientation, "data-size": size, ...(0, utils_1.extractSupportProps)(otherProps), children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.tabListWrapper, "data-orientation": orientation, children: [!disableDivider && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.divider, "data-position": markerPosition, children: (0, jsx_runtime_1.jsx)(divider_1.Divider, { variant: 'regular', orientation: orientation }) })), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.tabBarScrollZone, "data-orientation": orientation, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.tabBarMain, "data-testid": 'tabs__bar-wrap', "data-orientation": orientation, children: (0, jsx_runtime_1.jsx)(react_indiana_drag_scroll_1.default, { className: (0, classnames_1.default)(SCROLL_CONTAINER_ORIENTATION_MAP[orientation], styles_module_scss_1.default.scrollArea), innerRef: scrollContainerRef, children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.tabsRow, "data-size": size, "data-orientation": orientation, onKeyDown: handleKeyDown, role: 'presentation', children: [(0, jsx_runtime_1.jsx)(context_1.TabBarContext.Provider, { value: {
|
|
113
|
+
onSelect: onSelectHandler,
|
|
114
|
+
size,
|
|
115
|
+
orientation,
|
|
116
|
+
focusedTab,
|
|
117
|
+
onFocus: onFocusHandler,
|
|
118
|
+
}, children: children }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.marker, style: markerScrollPosition, "data-position": markerPosition, "data-orientation": orientation })] }) }) }), orientation === constants_1.ORIENTATION.Horizontal && hasOverflow.left && ((0, jsx_runtime_1.jsx)(ScrollButton_1.ScrollButton, { direction: 'left', onClick: scrollLeft, orientation: orientation, size: size })), orientation === constants_1.ORIENTATION.Horizontal && hasOverflow.right && ((0, jsx_runtime_1.jsx)(ScrollButton_1.ScrollButton, { direction: 'right', onClick: scrollRight, orientation: orientation, size: size })), orientation === constants_1.ORIENTATION.Vertical && hasOverflow.top && ((0, jsx_runtime_1.jsx)(ScrollButton_1.ScrollButton, { direction: 'top', onClick: scrollTop, orientation: orientation, size: size })), orientation === constants_1.ORIENTATION.Vertical && hasOverflow.bottom && ((0, jsx_runtime_1.jsx)(ScrollButton_1.ScrollButton, { direction: 'bottom', onClick: scrollBottom, orientation: orientation, size: size }))] })] }), slotActionButton && ((0, jsx_runtime_1.jsx)("div", { "data-test-id": 'tabs__bar__after', "data-orientation": orientation, "data-size": size, className: styles_module_scss_1.default.tabBarAfter, children: slotActionButton }))] }));
|
|
119
119
|
}
|
|
@@ -43,9 +43,6 @@ function useScrollContainer(container) {
|
|
|
43
43
|
}
|
|
44
44
|
const resizeObserver = new ResizeObserver(recheck);
|
|
45
45
|
resizeObserver.observe(element);
|
|
46
|
-
// Размер содержимого меняется при переключении типа и плотности без изменения viewport.
|
|
47
|
-
if (element.firstElementChild)
|
|
48
|
-
resizeObserver.observe(element.firstElementChild);
|
|
49
46
|
element.addEventListener('scroll', recheck);
|
|
50
47
|
element.addEventListener('wheel', onWheel);
|
|
51
48
|
// Первичная проверка и после layout (важно для вертикального скролла)
|