@cloud-ru/ds-tabs 1.0.11 → 1.0.12-preview-46866d52.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 +8 -0
  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 +57 -56
  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 +3 -0
  12. package/dist/cjs/components/TabBar/styles.module.css +43 -29
  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 +116 -101
  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 +57 -56
  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 +3 -0
  27. package/dist/esm/components/TabBar/styles.module.css +43 -29
  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 +116 -101
  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 +7 -7
  36. package/src/components/ScrollButton/ScrollButton.tsx +4 -4
  37. package/src/components/ScrollButton/styles.module.scss +4 -6
  38. package/src/components/Tab/Tab.tsx +12 -12
  39. package/src/components/Tab/styles.module.scss +13 -41
  40. package/src/components/TabBar/TabBar.tsx +28 -30
  41. package/src/components/TabBar/hooks.ts +2 -0
  42. package/src/components/TabBar/styles.module.scss +66 -29
  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.11",
3
+ "version": "1.0.12-preview-46866d52.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",
39
- "@cloud-ru/ds-counter": "^1.0.3",
40
- "@cloud-ru/ds-divider": "^1.0.2",
41
- "@cloud-ru/ds-typography": "^1.0.1",
42
- "@cloud-ru/ds-utils": "^1.2.0",
43
- "@cloud-ru/ds-icons": "^1.5.0"
38
+ "@cloud-ru/ds-button": "1.0.4",
39
+ "@cloud-ru/ds-divider": "1.0.2",
40
+ "@cloud-ru/ds-utils": "1.2.0",
41
+ "@cloud-ru/ds-typography": "1.0.1",
42
+ "@cloud-ru/ds-icons": "1.5.0",
43
+ "@cloud-ru/ds-counter": "1.0.3"
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, 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 $type in ('secondary', 'primary') {
12
+ &[data-variant='#{$type}'] {
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', $type, 'control', $control, 'padding');
18
16
  }
19
17
  }
20
18
  }
@@ -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 { SIZE } from '../../constants';
7
+ import { VARIANT } from '../../constants';
8
8
  import { useTabBarContext, useTabsContext } from '../../context';
9
- import { Size } from '../../types';
9
+ import { Variant } 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
- label: number;
25
+ value: 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_SIZE_TO_PROPS: Record<
36
- Size,
35
+ const MAP_VARIANT_TO_PROPS: Record<
36
+ Variant,
37
37
  { typographyProps: Pick<TypographyProps, 'variant' | 'size'>; counterProps: Pick<CounterProps, 'size'> }
38
38
  > = {
39
- [SIZE.L]: {
39
+ [VARIANT.Primary]: {
40
40
  typographyProps: {
41
41
  variant: 'title',
42
42
  size: 'm',
@@ -45,7 +45,7 @@ const MAP_SIZE_TO_PROPS: Record<
45
45
  size: 's',
46
46
  },
47
47
  },
48
- [SIZE.M]: {
48
+ [VARIANT.Secondary]: {
49
49
  typographyProps: {
50
50
  variant: 'title',
51
51
  size: 's',
@@ -58,7 +58,7 @@ const MAP_SIZE_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, size, orientation, focusedTab, onFocus } = useTabBarContext();
61
+ const { onSelect, variant, 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 (!size) {
110
+ if (!variant) {
111
111
  return null;
112
112
  }
113
113
 
114
- const { typographyProps, counterProps } = MAP_SIZE_TO_PROPS[size];
114
+ const { typographyProps, counterProps } = MAP_VARIANT_TO_PROPS[variant];
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-size={size}
130
+ data-variant={variant}
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.label}
142
+ value={counter.value}
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
- $sizes: 'm', 'l';
4
+ $types: '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,60 +51,29 @@ $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 $type in $types {
60
+ &[data-orientation='horizontal'][data-variant='#{$type}'] {
61
+ @include base.composite-var(tabs.$tabs, 'anatomy', $type, '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', $type, '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='#{$type}'] {
69
+ @include base.composite-var(tabs.$tabs, 'anatomy', $type, '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', $type, '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
77
  &[data-selected='true'],
108
78
  &:focus-visible,
109
79
  &:hover {
@@ -122,10 +92,12 @@ $sizes: 'm', 'l';
122
92
  position: relative;
123
93
 
124
94
  display: flex;
95
+ flex-shrink: 0;
125
96
  align-items: center;
126
97
  justify-content: center;
127
98
 
128
99
  box-sizing: border-box;
100
+ width: max-content;
129
101
  }
130
102
 
131
103
  &: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,9 +32,9 @@ export type TabBarProps = WithSupportProps<{
32
32
  children: ReactElement<TabProps>[];
33
33
  /**
34
34
  * Слот действия: контент после списка табов — справа при горизонтальной
35
- * ориентации, снизу при вертикальной. Разделитель под ним не продолжается.
35
+ * ориентации, снизу при вертикальной. Разделитель проходит вдоль всей панели.
36
36
  */
37
- slotActionButton?: ReactNode;
37
+ afterContent?: 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
- /** Размер панели табов: L — верхнеуровневый, M — на уровне контента */
49
- size?: Size;
50
- /** Скрыть разделитель под/рядом с панелью табов */
51
- disableDivider?: boolean;
48
+ /** Вариант панели: primary — верхнеуровневый, secondary — на уровне контента */
49
+ variant?: Variant;
50
+ /** Показывать разделитель под/рядом с панелью табов */
51
+ divider?: 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
- size = SIZE.L,
66
+ variant = VARIANT.Primary,
67
67
  orientation = ORIENTATION.Horizontal,
68
68
  markerPosition = MARKER_POSITION.After,
69
- slotActionButton,
70
- disableDivider = false,
69
+ afterContent,
70
+ divider = true,
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, size, updateMarkPosition]);
127
+ }, [children, variant, updateMarkPosition]);
128
128
 
129
129
  const scrollContainerToElement = useCallback(
130
130
  (element: HTMLElement) => {
@@ -193,17 +193,15 @@ export function TabBar({
193
193
  className={cn(styles.tabBar, className)}
194
194
  role='tablist'
195
195
  data-orientation={orientation}
196
- data-size={size}
196
+ data-variant={variant}
197
197
  {...extractSupportProps(otherProps)}
198
198
  >
199
- {/* Область списка: слот табов, кнопки прокрутки и линия. Слот действия (`slotActionButton`)
200
- лежит снаружи — по макету линия под ним не продолжается. */}
199
+ {divider && (
200
+ <div className={styles.divider} data-position={markerPosition}>
201
+ <Divider variant='regular' orientation={orientation} />
202
+ </div>
203
+ )}
201
204
  <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
205
  <div className={styles.tabBarScrollZone} data-orientation={orientation}>
208
206
  <div className={styles.tabBarMain} data-testid='tabs__bar-wrap' data-orientation={orientation}>
209
207
  <ScrollContainer
@@ -212,7 +210,7 @@ export function TabBar({
212
210
  >
213
211
  <div
214
212
  className={styles.tabsRow}
215
- data-size={size}
213
+ data-variant={variant}
216
214
  data-orientation={orientation}
217
215
  onKeyDown={handleKeyDown}
218
216
  role='presentation'
@@ -220,7 +218,7 @@ export function TabBar({
220
218
  <TabBarContext.Provider
221
219
  value={{
222
220
  onSelect: onSelectHandler,
223
- size,
221
+ variant,
224
222
  orientation,
225
223
  focusedTab,
226
224
  onFocus: onFocusHandler,
@@ -240,28 +238,28 @@ export function TabBar({
240
238
  </div>
241
239
 
242
240
  {orientation === ORIENTATION.Horizontal && hasOverflow.left && (
243
- <ScrollButton direction='left' onClick={scrollLeft} orientation={orientation} size={size} />
241
+ <ScrollButton direction='left' onClick={scrollLeft} orientation={orientation} variant={variant} />
244
242
  )}
245
243
  {orientation === ORIENTATION.Horizontal && hasOverflow.right && (
246
- <ScrollButton direction='right' onClick={scrollRight} orientation={orientation} size={size} />
244
+ <ScrollButton direction='right' onClick={scrollRight} orientation={orientation} variant={variant} />
247
245
  )}
248
246
  {orientation === ORIENTATION.Vertical && hasOverflow.top && (
249
- <ScrollButton direction='top' onClick={scrollTop} orientation={orientation} size={size} />
247
+ <ScrollButton direction='top' onClick={scrollTop} orientation={orientation} variant={variant} />
250
248
  )}
251
249
  {orientation === ORIENTATION.Vertical && hasOverflow.bottom && (
252
- <ScrollButton direction='bottom' onClick={scrollBottom} orientation={orientation} size={size} />
250
+ <ScrollButton direction='bottom' onClick={scrollBottom} orientation={orientation} variant={variant} />
253
251
  )}
254
252
  </div>
255
253
  </div>
256
254
 
257
- {slotActionButton && (
255
+ {afterContent && (
258
256
  <div
259
257
  data-test-id='tabs__bar__after'
260
258
  data-orientation={orientation}
261
- data-size={size}
262
- className={styles.tabBarAfter}
259
+ data-variant={variant}
260
+ className={styles.actionWrapper}
263
261
  >
264
- {slotActionButton}
262
+ {afterContent}
265
263
  </div>
266
264
  )}
267
265
  </div>
@@ -65,6 +65,8 @@ 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);
68
70
  element.addEventListener('scroll', recheck);
69
71
  element.addEventListener('wheel', onWheel);
70
72
 
@@ -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
- $sizes: 'l', 'm';
5
+ $types: 'primary', 'secondary';
6
6
 
7
7
  .tabBar {
8
8
  position: relative;
@@ -21,20 +21,18 @@ $sizes: 'l', 'm';
21
21
  align-items: center;
22
22
  }
23
23
 
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');
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');
28
28
  }
29
29
 
30
- &[data-size='#{$size}'][data-orientation='vertical'] {
31
- gap: base.simple-var(tabs.$tabs, 'anatomy', 'size', $size, 'tabsVertical', 'actionSlot', 'gap');
30
+ &[data-variant='#{$type}'][data-orientation='vertical'] {
31
+ gap: base.simple-var(tabs.$tabs, 'anatomy', $type, 'tabsVertical', 'gap');
32
32
  }
33
33
  }
34
34
  }
35
35
 
36
- // Область списка: слот табов, кнопки прокрутки и линия. Линия под слотом действия
37
- // не продолжается, поэтому её носитель — эта обёртка, а не вся панель.
38
36
  .tabListWrapper {
39
37
  position: relative;
40
38
 
@@ -133,30 +131,31 @@ $sizes: 'l', 'm';
133
131
 
134
132
  white-space: nowrap;
135
133
 
136
- &[data-size='l'] {
134
+ &[data-variant='primary'] {
137
135
  &[data-orientation='horizontal'] {
138
- gap: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'l', 'tabsHorizontal', 'gap');
136
+ gap: base.simple-var(tabs.$tabs, 'anatomy', 'primary', 'tabsHorizontal', 'tabListWrapper', 'slot', 'gap');
139
137
  }
140
138
 
141
139
  &[data-orientation='vertical'] {
142
- gap: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'l', 'tabsVertical', 'gap');
140
+ gap: base.simple-var(tabs.$tabs, 'anatomy', 'primary', 'tabsVertical', 'tabListWrapper', 'slot', 'gap');
143
141
  }
144
142
  }
145
143
 
146
- &[data-size='m'] {
144
+ &[data-variant='secondary'] {
147
145
  &[data-orientation='horizontal'] {
148
- gap: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'm', 'tabsHorizontal', 'gap');
146
+ gap: base.simple-var(tabs.$tabs, 'anatomy', 'secondary', 'tabsHorizontal', 'tabListWrapper', 'slot', 'gap');
149
147
  }
150
148
 
151
149
  &[data-orientation='vertical'] {
152
- gap: base.simple-var(tabs.$tabs, 'anatomy', 'size', 'm', 'tabsVertical', 'gap');
150
+ gap: base.simple-var(tabs.$tabs, 'anatomy', 'secondary', 'tabsVertical', 'tabListWrapper', 'slot', 'gap');
153
151
  }
154
152
  }
155
153
 
156
154
  &[data-orientation='vertical'] {
157
155
  flex-direction: column;
158
156
  // Ряд тянется на ширину списка: строки табов занимают её целиком, как в макете.
159
- width: auto;
157
+ width: max-content;
158
+ min-width: 100%;
160
159
  min-height: min-content;
161
160
  }
162
161
 
@@ -176,14 +175,30 @@ $sizes: 'l', 'm';
176
175
 
177
176
  &[data-orientation='horizontal'] {
178
177
  bottom: 0;
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');
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
+ );
181
188
  }
182
189
 
183
190
  &[data-orientation='vertical'] {
184
191
  right: 0;
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');
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
+ );
187
202
  }
188
203
 
189
204
  &[data-position='before'] {
@@ -197,15 +212,31 @@ $sizes: 'l', 'm';
197
212
  }
198
213
  }
199
214
 
200
- .tabsRow[data-size='m'] .marker {
215
+ .tabsRow[data-variant='secondary'] .marker {
201
216
  &[data-orientation='horizontal'] {
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');
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
+ );
204
227
  }
205
228
 
206
229
  &[data-orientation='vertical'] {
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');
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
+ );
209
240
  }
210
241
  }
211
242
 
@@ -231,11 +262,17 @@ $sizes: 'l', 'm';
231
262
  height: 100%;
232
263
  }
233
264
 
234
- .tabBarAfter {
265
+ .actionWrapper {
266
+ flex-shrink: 0;
267
+ box-sizing: border-box;
268
+
235
269
  &[data-orientation='vertical'] {
236
- &[data-size='l'],
237
- &[data-size='m'] {
238
- min-height: auto;
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
+ }
239
276
  }
240
277
  }
241
278
  }
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 SIZE = {
12
- L: 'l',
13
- M: 'm',
11
+ export const VARIANT = {
12
+ Primary: 'primary',
13
+ Secondary: 'secondary',
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, SIZE } from './constants';
3
+ import { MARKER_POSITION, ORIENTATION, VARIANT } from './constants';
4
4
 
5
- export type Size = ValueOf<typeof SIZE>;
5
+ export type Variant = ValueOf<typeof VARIANT>;
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
- size: Size;
16
+ variant: Variant;
17
17
  orientation: Orientation;
18
18
  focusedTab: string;
19
19
  onSelect(element: HTMLButtonElement): void;