@cloud-ru/ds-tabs 1.0.12-preview-46866d52.0 → 1.0.12-preview-e8fab9b7.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 (44) hide show
  1. package/CHANGELOG.md +0 -8
  2. package/README.md +20 -20
  3. package/dist/cjs/components/ScrollButton/ScrollButton.d.ts +3 -3
  4. package/dist/cjs/components/ScrollButton/ScrollButton.js +2 -2
  5. package/dist/cjs/components/ScrollButton/styles.module.css +16 -16
  6. package/dist/cjs/components/Tab/Tab.d.ts +1 -1
  7. package/dist/cjs/components/Tab/Tab.js +7 -7
  8. package/dist/cjs/components/Tab/styles.module.css +56 -57
  9. package/dist/cjs/components/TabBar/TabBar.d.ts +8 -8
  10. package/dist/cjs/components/TabBar/TabBar.js +9 -9
  11. package/dist/cjs/components/TabBar/hooks.js +0 -3
  12. package/dist/cjs/components/TabBar/styles.module.css +29 -43
  13. package/dist/cjs/constants.d.ts +3 -3
  14. package/dist/cjs/constants.js +4 -4
  15. package/dist/cjs/context.d.ts +2 -2
  16. package/dist/cjs/style.css +101 -116
  17. package/dist/cjs/types.d.ts +3 -3
  18. package/dist/esm/components/ScrollButton/ScrollButton.d.ts +3 -3
  19. package/dist/esm/components/ScrollButton/ScrollButton.js +2 -2
  20. package/dist/esm/components/ScrollButton/styles.module.css +16 -16
  21. package/dist/esm/components/Tab/Tab.d.ts +1 -1
  22. package/dist/esm/components/Tab/Tab.js +8 -8
  23. package/dist/esm/components/Tab/styles.module.css +56 -57
  24. package/dist/esm/components/TabBar/TabBar.d.ts +8 -8
  25. package/dist/esm/components/TabBar/TabBar.js +10 -10
  26. package/dist/esm/components/TabBar/hooks.js +0 -3
  27. package/dist/esm/components/TabBar/styles.module.css +29 -43
  28. package/dist/esm/constants.d.ts +3 -3
  29. package/dist/esm/constants.js +3 -3
  30. package/dist/esm/context.d.ts +2 -2
  31. package/dist/esm/style.css +101 -116
  32. package/dist/esm/types.d.ts +3 -3
  33. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  34. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  35. package/package.json +5 -5
  36. package/src/components/ScrollButton/ScrollButton.tsx +4 -4
  37. package/src/components/ScrollButton/styles.module.scss +6 -4
  38. package/src/components/Tab/Tab.tsx +12 -12
  39. package/src/components/Tab/styles.module.scss +41 -13
  40. package/src/components/TabBar/TabBar.tsx +30 -28
  41. package/src/components/TabBar/hooks.ts +0 -2
  42. package/src/components/TabBar/styles.module.scss +29 -66
  43. package/src/constants.ts +3 -3
  44. package/src/types.ts +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-ru/ds-tabs",
3
- "version": "1.0.12-preview-46866d52.0",
3
+ "version": "1.0.12-preview-e8fab9b7.0",
4
4
  "description": "Пакет табов — compound-компонент Tabs c субкомпонентами TabBar, Tab и TabContent для горизонтальной и вертикальной навигации.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,12 +35,12 @@
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",
38
+ "@cloud-ru/ds-counter": "1.0.3",
39
39
  "@cloud-ru/ds-divider": "1.0.2",
40
- "@cloud-ru/ds-utils": "1.2.0",
40
+ "@cloud-ru/ds-icons": "1.5.1-preview-e8fab9b7.0",
41
41
  "@cloud-ru/ds-typography": "1.0.1",
42
- "@cloud-ru/ds-icons": "1.5.0",
43
- "@cloud-ru/ds-counter": "1.0.3"
42
+ "@cloud-ru/ds-utils": "1.2.0",
43
+ "@cloud-ru/ds-button": "1.0.4"
44
44
  },
45
45
  "publishConfig": {
46
46
  "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, Variant } from '../../types';
5
+ import { Direction, Orientation, Size } 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
- variant: Variant;
16
+ size: Size;
17
17
  direction: Direction;
18
18
  orientation: Orientation;
19
19
  onClick(): void;
20
20
  };
21
21
 
22
- export function ScrollButton({ variant, onClick, direction, orientation }: ScrollButtonProps) {
22
+ export function ScrollButton({ size, onClick, direction, orientation }: ScrollButtonProps) {
23
23
  return (
24
24
  <div
25
25
  className={styles.scrollButton}
26
26
  data-direction={direction}
27
- data-variant={variant}
27
+ data-size={size}
28
28
  data-orientation={orientation}
29
29
  data-test-id={`tabs__scroll-button-${direction}`}
30
30
  >
@@ -8,11 +8,13 @@
8
8
  justify-content: center;
9
9
 
10
10
  // Паддинг только с той стороны, которой кнопка смотрит наружу, — как в макете.
11
- @each $type in ('secondary', 'primary') {
12
- &[data-variant='#{$type}'] {
13
- @each $direction, $control in ('left': 'back', 'right': 'forward', 'top': 'back', 'bottom': 'forward') {
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') {
14
16
  &[data-direction='#{$direction}'] {
15
- padding-#{$direction}: base.simple-var(tabs.$tabs, 'anatomy', $type, 'control', $control, 'padding');
17
+ padding-#{$side}: $padding;
16
18
  }
17
19
  }
18
20
  }
@@ -4,9 +4,9 @@ import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
4
4
  import cn from 'classnames';
5
5
  import { FocusEvent, KeyboardEvent, MouseEvent, useCallback, useEffect, useRef } from 'react';
6
6
 
7
- import { VARIANT } from '../../constants';
7
+ import { SIZE } from '../../constants';
8
8
  import { useTabBarContext, useTabsContext } from '../../context';
9
- import { Variant } from '../../types';
9
+ import { Size } from '../../types';
10
10
  import { getTabContentId } from '../../utils';
11
11
  import styles from './styles.module.scss';
12
12
 
@@ -22,7 +22,7 @@ export type TabProps = WithSupportProps<{
22
22
  /** Счетчик, отображающийся внутри кнопки переключения */
23
23
  counter?: {
24
24
  /** Значение счетчика */
25
- value: number;
25
+ label: number;
26
26
  /** Внешний вид */
27
27
  appearance?: CounterProps['appearance'];
28
28
  /** Роль, в которой применяется `appearance` счётчика */
@@ -32,11 +32,11 @@ export type TabProps = WithSupportProps<{
32
32
  onClick?(event: MouseEvent<HTMLButtonElement>): void;
33
33
  }>;
34
34
 
35
- const MAP_VARIANT_TO_PROPS: Record<
36
- Variant,
35
+ const MAP_SIZE_TO_PROPS: Record<
36
+ Size,
37
37
  { typographyProps: Pick<TypographyProps, 'variant' | 'size'>; counterProps: Pick<CounterProps, 'size'> }
38
38
  > = {
39
- [VARIANT.Primary]: {
39
+ [SIZE.L]: {
40
40
  typographyProps: {
41
41
  variant: 'title',
42
42
  size: 'm',
@@ -45,7 +45,7 @@ const MAP_VARIANT_TO_PROPS: Record<
45
45
  size: 's',
46
46
  },
47
47
  },
48
- [VARIANT.Secondary]: {
48
+ [SIZE.M]: {
49
49
  typographyProps: {
50
50
  variant: 'title',
51
51
  size: 's',
@@ -58,7 +58,7 @@ const MAP_VARIANT_TO_PROPS: Record<
58
58
 
59
59
  export function Tab({ label, value, disabled = false, className, onClick, counter, ...otherProps }: TabProps) {
60
60
  const ref = useRef<HTMLButtonElement>(null);
61
- const { onSelect, variant, orientation, focusedTab, onFocus } = useTabBarContext();
61
+ const { onSelect, size, orientation, focusedTab, onFocus } = useTabBarContext();
62
62
  const { selectedTab, setSelectedTab } = useTabsContext();
63
63
  const selected = value === selectedTab;
64
64
 
@@ -107,11 +107,11 @@ export function Tab({ label, value, disabled = false, className, onClick, counte
107
107
  [onFocus, value],
108
108
  );
109
109
 
110
- if (!variant) {
110
+ if (!size) {
111
111
  return null;
112
112
  }
113
113
 
114
- const { typographyProps, counterProps } = MAP_VARIANT_TO_PROPS[variant];
114
+ const { typographyProps, counterProps } = MAP_SIZE_TO_PROPS[size];
115
115
 
116
116
  return (
117
117
  <button
@@ -127,7 +127,7 @@ export function Tab({ label, value, disabled = false, className, onClick, counte
127
127
  aria-controls={getTabContentId(value)}
128
128
  aria-selected={selected}
129
129
  data-selected={selected || undefined}
130
- data-variant={variant}
130
+ data-size={size}
131
131
  data-orientation={orientation}
132
132
  onClick={handleClick}
133
133
  onFocus={onFocusHandler}
@@ -139,7 +139,7 @@ export function Tab({ label, value, disabled = false, className, onClick, counte
139
139
  <Counter
140
140
  appearance={counter.appearance}
141
141
  roleAppearance={counter.roleAppearance}
142
- value={counter.value}
142
+ value={counter.label}
143
143
  data-test-id={`tabs__tab-counter-${value}`}
144
144
  {...counterProps}
145
145
  />
@@ -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
- $types: 'secondary', 'primary';
4
+ $sizes: 'm', 'l';
5
5
 
6
6
  // TODO: тут подключаем state-layer (но триггер должен быть на .tab)
7
7
  @mixin internal-has-state-layer-as-child() {
@@ -16,7 +16,7 @@ $types: 'secondary', 'primary';
16
16
  }
17
17
 
18
18
  @media (hover: hover) {
19
- &:hover:not([data-disabled], [data-loading], [data-selected]) {
19
+ &:hover:not([data-disabled], [data-loading]) {
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,7 +43,6 @@ $types: 'secondary', 'primary';
43
43
 
44
44
  display: inline-flex;
45
45
  flex-direction: row;
46
- flex-shrink: 0;
47
46
  align-items: center;
48
47
 
49
48
  box-sizing: border-box;
@@ -51,29 +50,60 @@ $types: 'secondary', 'primary';
51
50
  border-width: 0;
52
51
 
53
52
  color: base.$sn-theme-color-available-version-textSecondary;
54
- white-space: nowrap;
55
53
 
56
54
  background-color: transparent;
57
55
  outline: none;
58
56
 
59
- @each $type in $types {
60
- &[data-orientation='horizontal'][data-variant='#{$type}'] {
61
- @include base.composite-var(tabs.$tabs, 'anatomy', $type, 'tabsHorizontal', 'tabContainer');
57
+ @each $size in $sizes {
58
+ &[data-orientation='horizontal'][data-size='#{$size}'] {
59
+ @include base.composite-var(tabs.$tabs, 'anatomy', 'size', $size, 'tabsHorizontal', 'tabContainer');
62
60
 
63
61
  .container {
64
- @include base.composite-var(tabs.$tabs, 'anatomy', $type, 'tabsHorizontal', 'tabContainer', 'textWrapper');
62
+ @include base.composite-var(
63
+ tabs.$tabs,
64
+ 'anatomy',
65
+ 'size',
66
+ $size,
67
+ 'tabsHorizontal',
68
+ 'tabContainer',
69
+ 'textWrapper'
70
+ );
65
71
  }
66
72
  }
67
73
 
68
- &[data-orientation='vertical'][data-variant='#{$type}'] {
69
- @include base.composite-var(tabs.$tabs, 'anatomy', $type, 'tabsVertical', 'tabContainer');
74
+ &[data-orientation='vertical'][data-size='#{$size}'] {
75
+ @include base.composite-var(tabs.$tabs, 'anatomy', 'size', $size, 'tabsVertical', 'tabContainer');
70
76
 
71
77
  .container {
72
- @include base.composite-var(tabs.$tabs, 'anatomy', $type, 'tabsVertical', 'tabContainer', 'textWrapper');
78
+ @include base.composite-var(
79
+ tabs.$tabs,
80
+ 'anatomy',
81
+ 'size',
82
+ $size,
83
+ 'tabsVertical',
84
+ 'tabContainer',
85
+ 'textWrapper'
86
+ );
73
87
  }
74
88
  }
75
89
  }
76
90
 
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
+
77
107
  &[data-selected='true'],
78
108
  &:focus-visible,
79
109
  &:hover {
@@ -92,12 +122,10 @@ $types: 'secondary', 'primary';
92
122
  position: relative;
93
123
 
94
124
  display: flex;
95
- flex-shrink: 0;
96
125
  align-items: center;
97
126
  justify-content: center;
98
127
 
99
128
  box-sizing: border-box;
100
- width: max-content;
101
129
  }
102
130
 
103
131
  &: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, VARIANT } from '../../constants';
17
+ import { MARKER_POSITION, ORIENTATION, SIZE } from '../../constants';
18
18
  import { TabBarContext, useTabsContext } from '../../context';
19
- import { MarkerPosition, Orientation, Variant } from '../../types';
19
+ import { MarkerPosition, Orientation, Size } from '../../types';
20
20
  import { ScrollButton } from '../ScrollButton';
21
21
  import { TabProps } from '../Tab';
22
22
  import { useFocusControl, useScrollContainer } from './hooks';
@@ -32,9 +32,9 @@ export type TabBarProps = WithSupportProps<{
32
32
  children: ReactElement<TabProps>[];
33
33
  /**
34
34
  * Слот действия: контент после списка табов — справа при горизонтальной
35
- * ориентации, снизу при вертикальной. Разделитель проходит вдоль всей панели.
35
+ * ориентации, снизу при вертикальной. Разделитель под ним не продолжается.
36
36
  */
37
- afterContent?: ReactNode;
37
+ slotActionButton?: ReactNode;
38
38
  /** Ориентация */
39
39
  orientation?: Orientation;
40
40
  /**
@@ -45,10 +45,10 @@ export type TabBarProps = WithSupportProps<{
45
45
  * `after` = Figma `bottom` (horizontal) / `right` (vertical).
46
46
  */
47
47
  markerPosition?: MarkerPosition;
48
- /** Вариант панели: primary — верхнеуровневый, secondary — на уровне контента */
49
- variant?: Variant;
50
- /** Показывать разделитель под/рядом с панелью табов */
51
- divider?: boolean;
48
+ /** Размер панели табов: L — верхнеуровневый, M — на уровне контента */
49
+ size?: Size;
50
+ /** Скрыть разделитель под/рядом с панелью табов */
51
+ disableDivider?: boolean;
52
52
  /** CSS-класс */
53
53
  className?: string;
54
54
  }>;
@@ -63,11 +63,11 @@ type MarkerScrollPosition = {
63
63
  export function TabBar({
64
64
  children,
65
65
  className,
66
- variant = VARIANT.Primary,
66
+ size = SIZE.L,
67
67
  orientation = ORIENTATION.Horizontal,
68
68
  markerPosition = MARKER_POSITION.After,
69
- afterContent,
70
- divider = true,
69
+ slotActionButton,
70
+ disableDivider = false,
71
71
  ...otherProps
72
72
  }: TabBarProps) {
73
73
  const scrollContainerRef = useRef<HTMLDivElement>(null);
@@ -124,7 +124,7 @@ export function TabBar({
124
124
  return () => {
125
125
  resizeObserver.disconnect();
126
126
  };
127
- }, [children, variant, updateMarkPosition]);
127
+ }, [children, size, updateMarkPosition]);
128
128
 
129
129
  const scrollContainerToElement = useCallback(
130
130
  (element: HTMLElement) => {
@@ -193,15 +193,17 @@ export function TabBar({
193
193
  className={cn(styles.tabBar, className)}
194
194
  role='tablist'
195
195
  data-orientation={orientation}
196
- data-variant={variant}
196
+ data-size={size}
197
197
  {...extractSupportProps(otherProps)}
198
198
  >
199
- {divider && (
200
- <div className={styles.divider} data-position={markerPosition}>
201
- <Divider variant='regular' orientation={orientation} />
202
- </div>
203
- )}
199
+ {/* Область списка: слот табов, кнопки прокрутки и линия. Слот действия (`slotActionButton`)
200
+ лежит снаружи — по макету линия под ним не продолжается. */}
204
201
  <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
+ )}
205
207
  <div className={styles.tabBarScrollZone} data-orientation={orientation}>
206
208
  <div className={styles.tabBarMain} data-testid='tabs__bar-wrap' data-orientation={orientation}>
207
209
  <ScrollContainer
@@ -210,7 +212,7 @@ export function TabBar({
210
212
  >
211
213
  <div
212
214
  className={styles.tabsRow}
213
- data-variant={variant}
215
+ data-size={size}
214
216
  data-orientation={orientation}
215
217
  onKeyDown={handleKeyDown}
216
218
  role='presentation'
@@ -218,7 +220,7 @@ export function TabBar({
218
220
  <TabBarContext.Provider
219
221
  value={{
220
222
  onSelect: onSelectHandler,
221
- variant,
223
+ size,
222
224
  orientation,
223
225
  focusedTab,
224
226
  onFocus: onFocusHandler,
@@ -238,28 +240,28 @@ export function TabBar({
238
240
  </div>
239
241
 
240
242
  {orientation === ORIENTATION.Horizontal && hasOverflow.left && (
241
- <ScrollButton direction='left' onClick={scrollLeft} orientation={orientation} variant={variant} />
243
+ <ScrollButton direction='left' onClick={scrollLeft} orientation={orientation} size={size} />
242
244
  )}
243
245
  {orientation === ORIENTATION.Horizontal && hasOverflow.right && (
244
- <ScrollButton direction='right' onClick={scrollRight} orientation={orientation} variant={variant} />
246
+ <ScrollButton direction='right' onClick={scrollRight} orientation={orientation} size={size} />
245
247
  )}
246
248
  {orientation === ORIENTATION.Vertical && hasOverflow.top && (
247
- <ScrollButton direction='top' onClick={scrollTop} orientation={orientation} variant={variant} />
249
+ <ScrollButton direction='top' onClick={scrollTop} orientation={orientation} size={size} />
248
250
  )}
249
251
  {orientation === ORIENTATION.Vertical && hasOverflow.bottom && (
250
- <ScrollButton direction='bottom' onClick={scrollBottom} orientation={orientation} variant={variant} />
252
+ <ScrollButton direction='bottom' onClick={scrollBottom} orientation={orientation} size={size} />
251
253
  )}
252
254
  </div>
253
255
  </div>
254
256
 
255
- {afterContent && (
257
+ {slotActionButton && (
256
258
  <div
257
259
  data-test-id='tabs__bar__after'
258
260
  data-orientation={orientation}
259
- data-variant={variant}
260
- className={styles.actionWrapper}
261
+ data-size={size}
262
+ className={styles.tabBarAfter}
261
263
  >
262
- {afterContent}
264
+ {slotActionButton}
263
265
  </div>
264
266
  )}
265
267
  </div>
@@ -65,8 +65,6 @@ export function useScrollContainer(container: RefObject<HTMLElement | null>): Sc
65
65
 
66
66
  const resizeObserver = new ResizeObserver(recheck);
67
67
  resizeObserver.observe(element);
68
- // Размер содержимого меняется при переключении типа и плотности без изменения viewport.
69
- if (element.firstElementChild) resizeObserver.observe(element.firstElementChild);
70
68
  element.addEventListener('scroll', recheck);
71
69
  element.addEventListener('wheel', onWheel);
72
70
 
@@ -2,7 +2,7 @@
2
2
  @use '@cloud-ru/ds-figma-variables/build/scss/components/tabs.module' as tabs;
3
3
 
4
4
  $orientations: 'vertical', 'horizontal';
5
- $types: 'primary', 'secondary';
5
+ $sizes: 'l', 'm';
6
6
 
7
7
  .tabBar {
8
8
  position: relative;
@@ -21,18 +21,20 @@ $types: 'primary', 'secondary';
21
21
  align-items: center;
22
22
  }
23
23
 
24
- // Зазор между областью списка и слотом действия (`afterContent`)
25
- @each $type in $types {
26
- &[data-variant='#{$type}'][data-orientation='horizontal'] {
27
- gap: base.simple-var(tabs.$tabs, 'anatomy', $type, 'tabsHorizontal', 'gap');
24
+ // Зазор между областью списка и слотом действия (`slotActionButton`)
25
+ @each $size in $sizes {
26
+ &[data-size='#{$size}'][data-orientation='horizontal'] {
27
+ gap: base.simple-var(tabs.$tabs, 'anatomy', 'size', $size, 'tabsHorizontal', 'actionSlot', 'gap');
28
28
  }
29
29
 
30
- &[data-variant='#{$type}'][data-orientation='vertical'] {
31
- gap: base.simple-var(tabs.$tabs, 'anatomy', $type, 'tabsVertical', 'gap');
30
+ &[data-size='#{$size}'][data-orientation='vertical'] {
31
+ gap: base.simple-var(tabs.$tabs, 'anatomy', 'size', $size, 'tabsVertical', 'actionSlot', 'gap');
32
32
  }
33
33
  }
34
34
  }
35
35
 
36
+ // Область списка: слот табов, кнопки прокрутки и линия. Линия под слотом действия
37
+ // не продолжается, поэтому её носитель — эта обёртка, а не вся панель.
36
38
  .tabListWrapper {
37
39
  position: relative;
38
40
 
@@ -131,31 +133,30 @@ $types: 'primary', 'secondary';
131
133
 
132
134
  white-space: nowrap;
133
135
 
134
- &[data-variant='primary'] {
136
+ &[data-size='l'] {
135
137
  &[data-orientation='horizontal'] {
136
- gap: base.simple-var(tabs.$tabs, 'anatomy', 'primary', 'tabsHorizontal', 'tabListWrapper', 'slot', 'gap');
138
+ gap: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'l', 'tabsHorizontal', 'gap');
137
139
  }
138
140
 
139
141
  &[data-orientation='vertical'] {
140
- gap: base.simple-var(tabs.$tabs, 'anatomy', 'primary', 'tabsVertical', 'tabListWrapper', 'slot', 'gap');
142
+ gap: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'l', 'tabsVertical', 'gap');
141
143
  }
142
144
  }
143
145
 
144
- &[data-variant='secondary'] {
146
+ &[data-size='m'] {
145
147
  &[data-orientation='horizontal'] {
146
- gap: base.simple-var(tabs.$tabs, 'anatomy', 'secondary', 'tabsHorizontal', 'tabListWrapper', 'slot', 'gap');
148
+ gap: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'm', 'tabsHorizontal', 'gap');
147
149
  }
148
150
 
149
151
  &[data-orientation='vertical'] {
150
- gap: base.simple-var(tabs.$tabs, 'anatomy', 'secondary', 'tabsVertical', 'tabListWrapper', 'slot', 'gap');
152
+ gap: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'm', 'tabsVertical', 'gap');
151
153
  }
152
154
  }
153
155
 
154
156
  &[data-orientation='vertical'] {
155
157
  flex-direction: column;
156
158
  // Ряд тянется на ширину списка: строки табов занимают её целиком, как в макете.
157
- width: max-content;
158
- min-width: 100%;
159
+ width: auto;
159
160
  min-height: min-content;
160
161
  }
161
162
 
@@ -175,30 +176,14 @@ $types: 'primary', 'secondary';
175
176
 
176
177
  &[data-orientation='horizontal'] {
177
178
  bottom: 0;
178
- height: base.simple-var(tabs.$tabs, 'anatomy', 'primary', 'tabsHorizontal', 'tabContainer', 'marker', 'height');
179
- border-radius: base.simple-var(
180
- tabs.$tabs,
181
- 'anatomy',
182
- 'primary',
183
- 'tabsHorizontal',
184
- 'tabContainer',
185
- 'marker',
186
- 'border-radius'
187
- );
179
+ height: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'l', 'tabsHorizontal', 'selected', 'height');
180
+ border-radius: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'l', 'tabsHorizontal', 'selected', 'border-radius');
188
181
  }
189
182
 
190
183
  &[data-orientation='vertical'] {
191
184
  right: 0;
192
- width: base.simple-var(tabs.$tabs, 'anatomy', 'primary', 'tabsVertical', 'tabContainer', 'marker', 'height');
193
- border-radius: base.simple-var(
194
- tabs.$tabs,
195
- 'anatomy',
196
- 'primary',
197
- 'tabsVertical',
198
- 'tabContainer',
199
- 'marker',
200
- 'border-radius'
201
- );
185
+ width: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'l', 'tabsVertical', 'selected', 'height');
186
+ border-radius: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'l', 'tabsVertical', 'selected', 'border-radius');
202
187
  }
203
188
 
204
189
  &[data-position='before'] {
@@ -212,31 +197,15 @@ $types: 'primary', 'secondary';
212
197
  }
213
198
  }
214
199
 
215
- .tabsRow[data-variant='secondary'] .marker {
200
+ .tabsRow[data-size='m'] .marker {
216
201
  &[data-orientation='horizontal'] {
217
- height: base.simple-var(tabs.$tabs, 'anatomy', 'secondary', 'tabsHorizontal', 'tabContainer', 'marker', 'height');
218
- border-radius: base.simple-var(
219
- tabs.$tabs,
220
- 'anatomy',
221
- 'secondary',
222
- 'tabsHorizontal',
223
- 'tabContainer',
224
- 'marker',
225
- 'border-radius'
226
- );
202
+ height: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'm', 'tabsHorizontal', 'selected', 'height');
203
+ border-radius: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'm', 'tabsHorizontal', 'selected', 'border-radius');
227
204
  }
228
205
 
229
206
  &[data-orientation='vertical'] {
230
- width: base.simple-var(tabs.$tabs, 'anatomy', 'secondary', 'tabsVertical', 'tabContainer', 'marker', 'height');
231
- border-radius: base.simple-var(
232
- tabs.$tabs,
233
- 'anatomy',
234
- 'secondary',
235
- 'tabsVertical',
236
- 'tabContainer',
237
- 'marker',
238
- 'border-radius'
239
- );
207
+ width: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'm', 'tabsVertical', 'selected', 'height');
208
+ border-radius: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'm', 'tabsVertical', 'selected', 'border-radius');
240
209
  }
241
210
  }
242
211
 
@@ -262,17 +231,11 @@ $types: 'primary', 'secondary';
262
231
  height: 100%;
263
232
  }
264
233
 
265
- .actionWrapper {
266
- flex-shrink: 0;
267
- box-sizing: border-box;
268
-
234
+ .tabBarAfter {
269
235
  &[data-orientation='vertical'] {
270
- width: 100%;
271
-
272
- @each $type in $types {
273
- &[data-variant='#{$type}'] {
274
- @include base.composite-var(tabs.$tabs, 'anatomy', $type, 'tabsVertical', 'actionWrapper');
275
- }
236
+ &[data-size='l'],
237
+ &[data-size='m'] {
238
+ min-height: auto;
276
239
  }
277
240
  }
278
241
  }
package/src/constants.ts CHANGED
@@ -8,9 +8,9 @@ export const MARKER_POSITION = {
8
8
  After: 'after',
9
9
  } as const;
10
10
 
11
- export const VARIANT = {
12
- Primary: 'primary',
13
- Secondary: 'secondary',
11
+ export const SIZE = {
12
+ L: 'l',
13
+ M: 'm',
14
14
  } as const;
15
15
 
16
16
  /**
package/src/types.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ValueOf } from '@cloud-ru/ds-utils';
2
2
 
3
- import { MARKER_POSITION, ORIENTATION, VARIANT } from './constants';
3
+ import { MARKER_POSITION, ORIENTATION, SIZE } from './constants';
4
4
 
5
- export type Variant = ValueOf<typeof VARIANT>;
5
+ export type Size = ValueOf<typeof SIZE>;
6
6
  export type Orientation = ValueOf<typeof ORIENTATION>;
7
7
  export type MarkerPosition = ValueOf<typeof MARKER_POSITION>;
8
8
  export type Direction = 'left' | 'right' | 'top' | 'bottom';
@@ -13,7 +13,7 @@ export type TabsContextValue = {
13
13
  };
14
14
 
15
15
  export type TabBarContextValue = Partial<{
16
- variant: Variant;
16
+ size: Size;
17
17
  orientation: Orientation;
18
18
  focusedTab: string;
19
19
  onSelect(element: HTMLButtonElement): void;