@cloud-ru/ds-tabs 1.0.14 → 1.0.15-preview-2e0a6d5c.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 (53) hide show
  1. package/README.md +31 -27
  2. package/dist/cjs/components/ScrollButton/ScrollButton.d.ts +3 -3
  3. package/dist/cjs/components/ScrollButton/ScrollButton.js +2 -2
  4. package/dist/cjs/components/ScrollButton/styles.module.css +16 -16
  5. package/dist/cjs/components/Tab/Tab.d.ts +1 -1
  6. package/dist/cjs/components/Tab/Tab.js +8 -7
  7. package/dist/cjs/components/Tab/styles.module.css +77 -58
  8. package/dist/cjs/components/TabBar/TabBar.d.ts +8 -10
  9. package/dist/cjs/components/TabBar/TabBar.js +16 -11
  10. package/dist/cjs/components/TabBar/hooks.d.ts +5 -1
  11. package/dist/cjs/components/TabBar/hooks.js +5 -2
  12. package/dist/cjs/components/TabBar/styles.module.css +43 -29
  13. package/dist/cjs/components/Tabs/Tabs.d.ts +4 -1
  14. package/dist/cjs/components/Tabs/Tabs.js +3 -9
  15. package/dist/cjs/constants.d.ts +3 -3
  16. package/dist/cjs/constants.js +4 -4
  17. package/dist/cjs/context.d.ts +4 -2
  18. package/dist/cjs/context.js +2 -0
  19. package/dist/cjs/style.css +136 -103
  20. package/dist/cjs/types.d.ts +5 -3
  21. package/dist/esm/components/ScrollButton/ScrollButton.d.ts +3 -3
  22. package/dist/esm/components/ScrollButton/ScrollButton.js +2 -2
  23. package/dist/esm/components/ScrollButton/styles.module.css +16 -16
  24. package/dist/esm/components/Tab/Tab.d.ts +1 -1
  25. package/dist/esm/components/Tab/Tab.js +9 -8
  26. package/dist/esm/components/Tab/styles.module.css +77 -58
  27. package/dist/esm/components/TabBar/TabBar.d.ts +8 -10
  28. package/dist/esm/components/TabBar/TabBar.js +17 -12
  29. package/dist/esm/components/TabBar/hooks.d.ts +5 -1
  30. package/dist/esm/components/TabBar/hooks.js +5 -2
  31. package/dist/esm/components/TabBar/styles.module.css +43 -29
  32. package/dist/esm/components/Tabs/Tabs.d.ts +4 -1
  33. package/dist/esm/components/Tabs/Tabs.js +3 -9
  34. package/dist/esm/constants.d.ts +3 -3
  35. package/dist/esm/constants.js +3 -3
  36. package/dist/esm/context.d.ts +4 -2
  37. package/dist/esm/context.js +2 -0
  38. package/dist/esm/style.css +136 -103
  39. package/dist/esm/types.d.ts +5 -3
  40. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  41. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  42. package/package.json +8 -7
  43. package/src/components/ScrollButton/ScrollButton.tsx +4 -4
  44. package/src/components/ScrollButton/styles.module.scss +4 -6
  45. package/src/components/Tab/Tab.tsx +15 -13
  46. package/src/components/Tab/styles.module.scss +41 -45
  47. package/src/components/TabBar/TabBar.tsx +36 -35
  48. package/src/components/TabBar/hooks.ts +9 -2
  49. package/src/components/TabBar/styles.module.scss +68 -29
  50. package/src/components/Tabs/Tabs.tsx +13 -14
  51. package/src/constants.ts +3 -3
  52. package/src/context.tsx +2 -0
  53. package/src/types.ts +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-ru/ds-tabs",
3
- "version": "1.0.14",
3
+ "version": "1.0.15-preview-2e0a6d5c.0",
4
4
  "description": "Пакет табов — compound-компонент Tabs c субкомпонентами TabBar, Tab и TabContent для горизонтальной и вертикальной навигации.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,12 +35,13 @@
35
35
  "dependencies": {
36
36
  "classnames": "^2.5.1",
37
37
  "react-indiana-drag-scroll": "^2.2.1",
38
- "@cloud-ru/ds-button": "^1.0.4",
39
- "@cloud-ru/ds-counter": "^1.0.3",
40
- "@cloud-ru/ds-divider": "^1.0.2",
41
- "@cloud-ru/ds-icons": "^1.6.0",
42
- "@cloud-ru/ds-typography": "^1.0.2",
43
- "@cloud-ru/ds-utils": "^1.2.0"
38
+ "@cloud-ru/ds-divider": "1.0.2",
39
+ "@cloud-ru/ds-button": "1.0.4",
40
+ "@cloud-ru/ds-counter": "1.0.3",
41
+ "@cloud-ru/ds-icons": "1.6.0",
42
+ "@cloud-ru/ds-utils": "1.2.0",
43
+ "@cloud-ru/ds-truncate-string": "1.0.14",
44
+ "@cloud-ru/ds-typography": "1.0.2"
44
45
  },
45
46
  "publishConfig": {
46
47
  "access": "public"
@@ -2,7 +2,7 @@ import { Button } from '@cloud-ru/ds-button';
2
2
  import { ChevronDownSVG, ChevronLeftSVG, ChevronRightSVG, ChevronUpSVG } from '@cloud-ru/ds-icons/interface/system';
3
3
  import { ReactElement } from 'react';
4
4
 
5
- import { Direction, Orientation, Size } from '../../types';
5
+ import { Direction, Orientation, Variant } from '../../types';
6
6
  import styles from './styles.module.scss';
7
7
 
8
8
  const MAP_DIRECTION_TO_ICON: Record<Direction, ReactElement> = {
@@ -13,18 +13,18 @@ const MAP_DIRECTION_TO_ICON: Record<Direction, ReactElement> = {
13
13
  };
14
14
 
15
15
  export type ScrollButtonProps = {
16
- size: Size;
16
+ variant: Variant;
17
17
  direction: Direction;
18
18
  orientation: Orientation;
19
19
  onClick(): void;
20
20
  };
21
21
 
22
- export function ScrollButton({ size, onClick, direction, orientation }: ScrollButtonProps) {
22
+ export function ScrollButton({ variant, onClick, direction, orientation }: ScrollButtonProps) {
23
23
  return (
24
24
  <div
25
25
  className={styles.scrollButton}
26
26
  data-direction={direction}
27
- data-size={size}
27
+ data-variant={variant}
28
28
  data-orientation={orientation}
29
29
  data-test-id={`tabs__scroll-button-${direction}`}
30
30
  >
@@ -8,13 +8,11 @@
8
8
  justify-content: center;
9
9
 
10
10
  // Паддинг только с той стороны, которой кнопка смотрит наружу, — как в макете.
11
- @each $size in ('m', 'l') {
12
- $padding: base.simple-var(tabs.$tabs, 'anatomy', 'size', $size, 'control', 'forward', 'padding');
13
-
14
- &[data-size='#{$size}'] {
15
- @each $direction, $side in ('left': 'left', 'right': 'right', 'top': 'top', 'bottom': 'bottom') {
11
+ @each $variant in ('secondary', 'primary') {
12
+ &[data-variant='#{$variant}'] {
13
+ @each $direction, $control in ('left': 'back', 'right': 'forward', 'top': 'back', 'bottom': 'forward') {
16
14
  &[data-direction='#{$direction}'] {
17
- padding-#{$side}: $padding;
15
+ padding-#{$direction}: base.simple-var(tabs.$tabs, 'anatomy', $variant, 'control', $control, 'padding');
18
16
  }
19
17
  }
20
18
  }
@@ -1,12 +1,13 @@
1
1
  import { Counter, CounterProps } from '@cloud-ru/ds-counter';
2
+ import { TruncateString } from '@cloud-ru/ds-truncate-string';
2
3
  import { Typography, TypographyProps } from '@cloud-ru/ds-typography';
3
4
  import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
4
5
  import cn from 'classnames';
5
6
  import { FocusEvent, KeyboardEvent, MouseEvent, useCallback, useEffect, useRef } from 'react';
6
7
 
7
- import { SIZE } from '../../constants';
8
+ import { ORIENTATION, VARIANT } from '../../constants';
8
9
  import { useTabBarContext, useTabsContext } from '../../context';
9
- import { Size } from '../../types';
10
+ import { Variant } from '../../types';
10
11
  import { getTabContentId } from '../../utils';
11
12
  import styles from './styles.module.scss';
12
13
 
@@ -22,7 +23,7 @@ export type TabProps = WithSupportProps<{
22
23
  /** Счетчик, отображающийся внутри кнопки переключения */
23
24
  counter?: {
24
25
  /** Значение счетчика */
25
- label: number;
26
+ value: number;
26
27
  /** Внешний вид */
27
28
  appearance?: CounterProps['appearance'];
28
29
  /** Роль, в которой применяется `appearance` счётчика */
@@ -32,11 +33,11 @@ export type TabProps = WithSupportProps<{
32
33
  onClick?(event: MouseEvent<HTMLButtonElement>): void;
33
34
  }>;
34
35
 
35
- const MAP_SIZE_TO_PROPS: Record<
36
- Size,
36
+ const MAP_VARIANT_TO_PROPS: Record<
37
+ Variant,
37
38
  { typographyProps: Pick<TypographyProps, 'variant' | 'size'>; counterProps: Pick<CounterProps, 'size'> }
38
39
  > = {
39
- [SIZE.L]: {
40
+ [VARIANT.Primary]: {
40
41
  typographyProps: {
41
42
  variant: 'title',
42
43
  size: 'm',
@@ -45,7 +46,7 @@ const MAP_SIZE_TO_PROPS: Record<
45
46
  size: 's',
46
47
  },
47
48
  },
48
- [SIZE.M]: {
49
+ [VARIANT.Secondary]: {
49
50
  typographyProps: {
50
51
  variant: 'title',
51
52
  size: 's',
@@ -58,7 +59,7 @@ const MAP_SIZE_TO_PROPS: Record<
58
59
 
59
60
  export function Tab({ label, value, disabled = false, className, onClick, counter, ...otherProps }: TabProps) {
60
61
  const ref = useRef<HTMLButtonElement>(null);
61
- const { onSelect, size, orientation, focusedTab, onFocus } = useTabBarContext();
62
+ const { onSelect, variant, orientation, focusedTab, onFocus } = useTabBarContext();
62
63
  const { selectedTab, setSelectedTab } = useTabsContext();
63
64
  const selected = value === selectedTab;
64
65
 
@@ -107,11 +108,11 @@ export function Tab({ label, value, disabled = false, className, onClick, counte
107
108
  [onFocus, value],
108
109
  );
109
110
 
110
- if (!size) {
111
+ if (!variant) {
111
112
  return null;
112
113
  }
113
114
 
114
- const { typographyProps, counterProps } = MAP_SIZE_TO_PROPS[size];
115
+ const { typographyProps, counterProps } = MAP_VARIANT_TO_PROPS[variant];
115
116
 
116
117
  return (
117
118
  <button
@@ -127,19 +128,20 @@ export function Tab({ label, value, disabled = false, className, onClick, counte
127
128
  aria-controls={getTabContentId(value)}
128
129
  aria-selected={selected}
129
130
  data-selected={selected || undefined}
130
- data-size={size}
131
+ data-variant={variant}
131
132
  data-orientation={orientation}
132
133
  onClick={handleClick}
133
134
  onFocus={onFocusHandler}
134
135
  onKeyDown={clickByEnterOrSpaceKey}
135
136
  >
136
137
  <Typography className={styles.container} as='div' {...typographyProps}>
137
- {label}
138
+ {orientation === ORIENTATION.Vertical ? <TruncateString text={label} className={styles.label} /> : label}
138
139
  {counter && (
139
140
  <Counter
141
+ className={styles.counter}
140
142
  appearance={counter.appearance}
141
143
  roleAppearance={counter.roleAppearance}
142
- value={counter.label}
144
+ value={counter.value}
143
145
  data-test-id={`tabs__tab-counter-${value}`}
144
146
  {...counterProps}
145
147
  />
@@ -1,7 +1,7 @@
1
1
  @use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
2
2
  @use '@cloud-ru/ds-figma-variables/build/scss/components/tabs.module' as tabs;
3
3
 
4
- $sizes: 'm', 'l';
4
+ $variant: 'secondary', 'primary';
5
5
 
6
6
  // TODO: тут подключаем state-layer (но триггер должен быть на .tab)
7
7
  @mixin internal-has-state-layer-as-child() {
@@ -16,7 +16,7 @@ $sizes: 'm', 'l';
16
16
  }
17
17
 
18
18
  @media (hover: hover) {
19
- &:hover:not([data-disabled], [data-loading]) {
19
+ &:hover:not([data-disabled], [data-loading], [data-selected]) {
20
20
  & .container > [data-state-layer] {
21
21
  &[data-state='emptyNeutralOnBackground'] {
22
22
  background: base.$sn-theme-color-material-stateLayer-neutral-onBackground-hovered-filled;
@@ -43,6 +43,7 @@ $sizes: 'm', 'l';
43
43
 
44
44
  display: inline-flex;
45
45
  flex-direction: row;
46
+ flex-shrink: 0;
46
47
  align-items: center;
47
48
 
48
49
  box-sizing: border-box;
@@ -50,64 +51,35 @@ $sizes: 'm', 'l';
50
51
  border-width: 0;
51
52
 
52
53
  color: base.$sn-theme-color-available-version-textSecondary;
54
+ white-space: nowrap;
53
55
 
54
56
  background-color: transparent;
55
57
  outline: none;
56
58
 
57
- @each $size in $sizes {
58
- &[data-orientation='horizontal'][data-size='#{$size}'] {
59
- @include base.composite-var(tabs.$tabs, 'anatomy', 'size', $size, 'tabsHorizontal', 'tabContainer');
59
+ @each $currentVariant in $variant {
60
+ &[data-orientation='horizontal'][data-variant='#{$currentVariant}'] {
61
+ @include base.composite-var(tabs.$tabs, 'anatomy', $currentVariant, 'tabsHorizontal', 'tabContainer');
60
62
 
61
63
  .container {
62
- @include base.composite-var(
63
- tabs.$tabs,
64
- 'anatomy',
65
- 'size',
66
- $size,
67
- 'tabsHorizontal',
68
- 'tabContainer',
69
- 'textWrapper'
70
- );
64
+ @include base.composite-var(tabs.$tabs, 'anatomy', $currentVariant, 'tabsHorizontal', 'tabContainer', 'textWrapper');
71
65
  }
72
66
  }
73
67
 
74
- &[data-orientation='vertical'][data-size='#{$size}'] {
75
- @include base.composite-var(tabs.$tabs, 'anatomy', 'size', $size, 'tabsVertical', 'tabContainer');
68
+ &[data-orientation='vertical'][data-variant='#{$currentVariant}'] {
69
+ @include base.composite-var(tabs.$tabs, 'anatomy', $currentVariant, 'tabsVertical', 'tabContainer');
76
70
 
77
71
  .container {
78
- @include base.composite-var(
79
- tabs.$tabs,
80
- 'anatomy',
81
- 'size',
82
- $size,
83
- 'tabsVertical',
84
- 'tabContainer',
85
- 'textWrapper'
86
- );
72
+ @include base.composite-var(tabs.$tabs, 'anatomy', $currentVariant, 'tabsVertical', 'tabContainer', 'textWrapper');
87
73
  }
88
74
  }
89
75
  }
90
76
 
91
- // Приватный мастер и выгрузка дают для `l` значение 8, а композиция `tabsVerticalL`
92
- // и живой рендер — 16; код следует композиции. Что считать эталоном, решает дизайн.
93
- // TODO FF-8772: снять, когда мастер и композиция сойдутся.
94
- &[data-orientation='vertical'][data-size='l'] {
95
- padding-right: base.simple-var(
96
- tabs.$tabs,
97
- 'anatomy',
98
- 'size',
99
- 'm',
100
- 'tabsVertical',
101
- 'tabContainer',
102
- 'padding-right'
103
- );
104
- padding-left: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'm', 'tabsVertical', 'tabContainer', 'padding-left');
105
- }
106
-
107
- &[data-selected='true'],
108
- &:focus-visible,
109
- &:hover {
110
- color: base.$sn-theme-color-available-version-textMain;
77
+ &:not([data-disabled]) {
78
+ &[data-selected='true'],
79
+ &:focus-visible,
80
+ &:hover {
81
+ color: base.$sn-theme-color-available-version-textMain;
82
+ }
111
83
  }
112
84
 
113
85
  // В макете отключённый таб гасится целиком, а не только цветом текста: иначе счётчик остаётся ярким.
@@ -122,10 +94,34 @@ $sizes: 'm', 'l';
122
94
  position: relative;
123
95
 
124
96
  display: flex;
97
+ flex-shrink: 0;
125
98
  align-items: center;
126
99
  justify-content: center;
127
100
 
128
101
  box-sizing: border-box;
102
+ width: max-content;
103
+ }
104
+
105
+ &[data-orientation='vertical'] {
106
+ min-width: 0;
107
+
108
+ .container {
109
+ flex-wrap: 1;
110
+ justify-content: flex-start;
111
+ width: 100%;
112
+ min-width: 0;
113
+ }
114
+
115
+ .label {
116
+ flex-grow: 0;
117
+ flex-shrink: 1;
118
+ min-width: 0;
119
+ text-align: left;
120
+ }
121
+
122
+ .counter {
123
+ flex-shrink: 0;
124
+ }
129
125
  }
130
126
 
131
127
  &:focus-visible .container {
@@ -14,9 +14,9 @@ import {
14
14
  } from 'react';
15
15
  import ScrollContainer from 'react-indiana-drag-scroll';
16
16
 
17
- import { MARKER_POSITION, ORIENTATION, SIZE } from '../../constants';
17
+ import { MARKER_POSITION, ORIENTATION, VARIANT } from '../../constants';
18
18
  import { TabBarContext, useTabsContext } from '../../context';
19
- import { MarkerPosition, Orientation, Size } from '../../types';
19
+ import { MarkerPosition, Orientation, Variant } from '../../types';
20
20
  import { ScrollButton } from '../ScrollButton';
21
21
  import { TabProps } from '../Tab';
22
22
  import { useFocusControl, useScrollContainer } from './hooks';
@@ -32,11 +32,9 @@ export type TabBarProps = WithSupportProps<{
32
32
  children: ReactElement<TabProps>[];
33
33
  /**
34
34
  * Слот действия: контент после списка табов — справа при горизонтальной
35
- * ориентации, снизу при вертикальной. Разделитель под ним не продолжается.
35
+ * ориентации, снизу при вертикальной. Разделитель проходит вдоль всей панели.
36
36
  */
37
- slotActionButton?: ReactNode;
38
- /** Ориентация */
39
- orientation?: Orientation;
37
+ afterContent?: ReactNode;
40
38
  /**
41
39
  * Позиция маркера относительно таб-бара.
42
40
  *
@@ -45,10 +43,10 @@ export type TabBarProps = WithSupportProps<{
45
43
  * `after` = Figma `bottom` (horizontal) / `right` (vertical).
46
44
  */
47
45
  markerPosition?: MarkerPosition;
48
- /** Размер панели табов: L — верхнеуровневый, M — на уровне контента */
49
- size?: Size;
50
- /** Скрыть разделитель под/рядом с панелью табов */
51
- disableDivider?: boolean;
46
+ /** Вариант панели: primary — верхнеуровневый, secondary — на уровне контента */
47
+ variant?: Variant;
48
+ /** Показывать разделитель под/рядом с панелью табов */
49
+ divider?: boolean;
52
50
  /** CSS-класс */
53
51
  className?: string;
54
52
  }>;
@@ -63,16 +61,19 @@ type MarkerScrollPosition = {
63
61
  export function TabBar({
64
62
  children,
65
63
  className,
66
- size = SIZE.L,
67
- orientation = ORIENTATION.Horizontal,
64
+ variant = VARIANT.Primary,
68
65
  markerPosition = MARKER_POSITION.After,
69
- slotActionButton,
70
- disableDivider = false,
66
+ afterContent,
67
+ divider = true,
71
68
  ...otherProps
72
69
  }: TabBarProps) {
73
70
  const scrollContainerRef = useRef<HTMLDivElement>(null);
74
- const { selectedTab, setSelectedTab } = useTabsContext();
75
- const { hasOverflow, scrollLeft, scrollRight, scrollTop, scrollBottom } = useScrollContainer(scrollContainerRef);
71
+ const tabsRowRef = useRef<HTMLDivElement>(null);
72
+ const { selectedTab, setSelectedTab, orientation } = useTabsContext();
73
+ const { hasOverflow, scrollLeft, scrollRight, scrollTop, scrollBottom } = useScrollContainer({
74
+ container: scrollContainerRef,
75
+ tabsRow: tabsRowRef,
76
+ });
76
77
  const selectedRef = useRef<HTMLButtonElement | null>(null);
77
78
  const [markerScrollPosition, setMarkerScrollPosition] = useState<MarkerScrollPosition>({});
78
79
  const [focusedTab, setFocusedTab] = useState<string | undefined>();
@@ -124,7 +125,7 @@ export function TabBar({
124
125
  return () => {
125
126
  resizeObserver.disconnect();
126
127
  };
127
- }, [children, size, updateMarkPosition]);
128
+ }, [children, variant, updateMarkPosition]);
128
129
 
129
130
  const scrollContainerToElement = useCallback(
130
131
  (element: HTMLElement) => {
@@ -193,17 +194,15 @@ export function TabBar({
193
194
  className={cn(styles.tabBar, className)}
194
195
  role='tablist'
195
196
  data-orientation={orientation}
196
- data-size={size}
197
+ data-variant={variant}
197
198
  {...extractSupportProps(otherProps)}
198
199
  >
199
- {/* Область списка: слот табов, кнопки прокрутки и линия. Слот действия (`slotActionButton`)
200
- лежит снаружи — по макету линия под ним не продолжается. */}
200
+ {divider && (
201
+ <div className={styles.divider} data-position={markerPosition}>
202
+ <Divider variant='regular' orientation={orientation} />
203
+ </div>
204
+ )}
201
205
  <div className={styles.tabListWrapper} data-orientation={orientation}>
202
- {!disableDivider && (
203
- <div className={styles.divider} data-position={markerPosition}>
204
- <Divider variant='regular' orientation={orientation} />
205
- </div>
206
- )}
207
206
  <div className={styles.tabBarScrollZone} data-orientation={orientation}>
208
207
  <div className={styles.tabBarMain} data-testid='tabs__bar-wrap' data-orientation={orientation}>
209
208
  <ScrollContainer
@@ -212,18 +211,20 @@ export function TabBar({
212
211
  >
213
212
  <div
214
213
  className={styles.tabsRow}
215
- data-size={size}
214
+ data-variant={variant}
216
215
  data-orientation={orientation}
217
216
  onKeyDown={handleKeyDown}
218
217
  role='presentation'
218
+ ref={tabsRowRef}
219
219
  >
220
220
  <TabBarContext.Provider
221
221
  value={{
222
222
  onSelect: onSelectHandler,
223
- size,
223
+ variant,
224
224
  orientation,
225
225
  focusedTab,
226
226
  onFocus: onFocusHandler,
227
+ markerPosition,
227
228
  }}
228
229
  >
229
230
  {children}
@@ -240,28 +241,28 @@ export function TabBar({
240
241
  </div>
241
242
 
242
243
  {orientation === ORIENTATION.Horizontal && hasOverflow.left && (
243
- <ScrollButton direction='left' onClick={scrollLeft} orientation={orientation} size={size} />
244
+ <ScrollButton direction='left' onClick={scrollLeft} orientation={orientation} variant={variant} />
244
245
  )}
245
246
  {orientation === ORIENTATION.Horizontal && hasOverflow.right && (
246
- <ScrollButton direction='right' onClick={scrollRight} orientation={orientation} size={size} />
247
+ <ScrollButton direction='right' onClick={scrollRight} orientation={orientation} variant={variant} />
247
248
  )}
248
249
  {orientation === ORIENTATION.Vertical && hasOverflow.top && (
249
- <ScrollButton direction='top' onClick={scrollTop} orientation={orientation} size={size} />
250
+ <ScrollButton direction='top' onClick={scrollTop} orientation={orientation} variant={variant} />
250
251
  )}
251
252
  {orientation === ORIENTATION.Vertical && hasOverflow.bottom && (
252
- <ScrollButton direction='bottom' onClick={scrollBottom} orientation={orientation} size={size} />
253
+ <ScrollButton direction='bottom' onClick={scrollBottom} orientation={orientation} variant={variant} />
253
254
  )}
254
255
  </div>
255
256
  </div>
256
257
 
257
- {slotActionButton && (
258
+ {afterContent && (
258
259
  <div
259
260
  data-test-id='tabs__bar__after'
260
261
  data-orientation={orientation}
261
- data-size={size}
262
- className={styles.tabBarAfter}
262
+ data-variant={variant}
263
+ className={styles.actionWrapper}
263
264
  >
264
- {slotActionButton}
265
+ {afterContent}
265
266
  </div>
266
267
  )}
267
268
  </div>
@@ -22,7 +22,12 @@ const defaultOverflowState: OverflowState = {
22
22
  right: false,
23
23
  };
24
24
 
25
- export function useScrollContainer(container: RefObject<HTMLElement | null>): ScrollContainerControl {
25
+ type UseScrollContainerProps = {
26
+ container: RefObject<HTMLElement | null>;
27
+ tabsRow: RefObject<HTMLElement | null>;
28
+ };
29
+
30
+ export function useScrollContainer({ container, tabsRow }: UseScrollContainerProps): ScrollContainerControl {
26
31
  const [hasOverflow, setHasOverflow] = useState<OverflowState>(defaultOverflowState);
27
32
 
28
33
  useLayoutEffect(() => {
@@ -65,6 +70,8 @@ export function useScrollContainer(container: RefObject<HTMLElement | null>): Sc
65
70
 
66
71
  const resizeObserver = new ResizeObserver(recheck);
67
72
  resizeObserver.observe(element);
73
+ // Размер содержимого меняется при переключении типа и плотности без изменения viewport.
74
+ if (tabsRow.current) resizeObserver.observe(tabsRow.current);
68
75
  element.addEventListener('scroll', recheck);
69
76
  element.addEventListener('wheel', onWheel);
70
77
 
@@ -80,7 +87,7 @@ export function useScrollContainer(container: RefObject<HTMLElement | null>): Sc
80
87
  element.removeEventListener('scroll', recheck);
81
88
  element.removeEventListener('wheel', onWheel);
82
89
  };
83
- }, [container]);
90
+ }, [container, tabsRow]);
84
91
 
85
92
  const [scrollLeft, scrollRight, scrollTop, scrollBottom] = useMemo(() => {
86
93
  function scroll(direction: Direction) {