@rescui/tab-list 0.17.0 → 0.17.1-RUI-293-Update-menu-component-6ca9d26d3.22
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/README.md +4 -3
- package/lib/_virtual/index.css.js +12 -12
- package/lib/index.css +180 -194
- package/lib/index.d.ts +6 -6
- package/lib/index.js +1 -1
- package/lib/parts/deep-map.d.ts +2 -2
- package/lib/parts/separator.p.module.css.js +3 -3
- package/lib/parts/tab-list-context.d.ts +13 -13
- package/lib/parts/tab-list.p.module.css.js +25 -16
- package/lib/parts/tab-separator.d.ts +8 -8
- package/lib/parts/tab.d.ts +35 -35
- package/lib/parts/use-indicator.d.ts +13 -13
- package/lib/parts/use-roving-tab-index.d.ts +8 -8
- package/lib/parts/use-scrollable-list.d.ts +18 -18
- package/lib/parts/use-scrollable-list.js +5 -8
- package/lib/tab-list.d.ts +43 -42
- package/lib/tab-list.js +78 -23
- package/llm/components/tab-list.md +447 -0
- package/llm/index.md +2 -0
- package/package.json +10 -9
- package/lib/parts/with-scroll-arrows.d.ts +0 -28
- package/lib/parts/with-scroll-arrows.js +0 -101
- package/lib/parts/with-scroll-arrows.p.module.css.js +0 -14
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
currentTabStopId: number;
|
|
5
|
-
onTabKeyDown: (e: React.KeyboardEvent<HTMLButtonElement | HTMLAnchorElement>, itemId: number) => void;
|
|
6
|
-
};
|
|
7
|
-
export
|
|
8
|
-
onChange: (value: TabListValueType) => void;
|
|
9
|
-
selectedId?: number;
|
|
10
|
-
rovingTabIndex?: TabListRovingTabIndexToolkit;
|
|
11
|
-
};
|
|
12
|
-
export declare const TabListContext: React.Context<TabListContextType>;
|
|
13
|
-
export declare const useTabListContext: () => TabListContextType;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type TabListValueType = string | number | symbol | object;
|
|
3
|
+
export type TabListRovingTabIndexToolkit = {
|
|
4
|
+
currentTabStopId: number;
|
|
5
|
+
onTabKeyDown: (e: React.KeyboardEvent<HTMLButtonElement | HTMLAnchorElement>, itemId: number) => void;
|
|
6
|
+
};
|
|
7
|
+
export type TabListContextType = {
|
|
8
|
+
onChange: (value: TabListValueType) => void;
|
|
9
|
+
selectedId?: number;
|
|
10
|
+
rovingTabIndex?: TabListRovingTabIndexToolkit;
|
|
11
|
+
};
|
|
12
|
+
export declare const TabListContext: React.Context<TabListContextType>;
|
|
13
|
+
export declare const useTabListContext: () => TabListContextType;
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"light": "
|
|
3
|
-
"dark": "
|
|
4
|
-
"sizeM": "
|
|
5
|
-
"sizeL": "
|
|
6
|
-
"classic": "
|
|
7
|
-
"rock": "
|
|
8
|
-
"sparse": "
|
|
9
|
-
"short": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
2
|
+
"light": "_light_1f0fs7_10",
|
|
3
|
+
"dark": "_dark_1f0fs7_13",
|
|
4
|
+
"sizeM": "_sizeM_1f0fs7_17",
|
|
5
|
+
"sizeL": "_sizeL_1f0fs7_20",
|
|
6
|
+
"classic": "_classic_1f0fs7_24",
|
|
7
|
+
"rock": "_rock_1f0fs7_27",
|
|
8
|
+
"sparse": "_sparse_1f0fs7_31",
|
|
9
|
+
"short": "_short_1f0fs7_35",
|
|
10
|
+
"wrapper": "_wrapper_1f0fs7_39",
|
|
11
|
+
"scrollable": "_scrollable_1f0fs7_49",
|
|
12
|
+
"arrow": "_arrow_1f0fs7_78",
|
|
13
|
+
"shown": "_shown_1f0fs7_98",
|
|
14
|
+
"arrowLeft": "_arrowLeft_1f0fs7_106",
|
|
15
|
+
"arrowRight": "_arrowRight_1f0fs7_111",
|
|
16
|
+
"withLeftArrow": "_withLeftArrow_1f0fs7_117",
|
|
17
|
+
"withRightArrow": "_withRightArrow_1f0fs7_126",
|
|
18
|
+
"arrowButton": "_arrowButton_1f0fs7_147",
|
|
19
|
+
"tabsContainer": "_tabsContainer_1f0fs7_151",
|
|
20
|
+
"indicator": "_indicator_1f0fs7_157",
|
|
21
|
+
"isIndicatorHidden": "_isIndicatorHidden_1f0fs7_172",
|
|
22
|
+
"iconLeft": "_iconLeft_1f0fs7_178",
|
|
23
|
+
"iconRight": "_iconRight_1f0fs7_181",
|
|
24
|
+
"tab": "_tab_1f0fs7_151",
|
|
25
|
+
"selected": "_selected_1f0fs7_272",
|
|
26
|
+
"icon": "_icon_1f0fs7_178"
|
|
18
27
|
};
|
|
19
28
|
export { styles as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Theme } from '@rescui/ui-contexts';
|
|
3
|
-
export
|
|
4
|
-
className?: string;
|
|
5
|
-
theme?: Theme;
|
|
6
|
-
};
|
|
7
|
-
declare const TabSeparator: React.FC<TabSeparatorProps>;
|
|
8
|
-
export default TabSeparator;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@rescui/ui-contexts';
|
|
3
|
+
export type TabSeparatorProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
theme?: Theme;
|
|
6
|
+
};
|
|
7
|
+
declare const TabSeparator: React.FC<TabSeparatorProps>;
|
|
8
|
+
export default TabSeparator;
|
package/lib/parts/tab.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TabListValueType } from './tab-list-context';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
className?: string;
|
|
6
|
-
value?: TabListValueType;
|
|
7
|
-
/** @ignore */
|
|
8
|
-
itemId?: number;
|
|
9
|
-
/** @ignore */
|
|
10
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
11
|
-
/** @ignore */
|
|
12
|
-
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
13
|
-
/** @ignore */
|
|
14
|
-
onMouseDown?: React.MouseEventHandler<HTMLElement>;
|
|
15
|
-
/** @ignore */
|
|
16
|
-
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
|
17
|
-
/** Identifier for e2e tests */
|
|
18
|
-
'data-e2e'?: string;
|
|
19
|
-
/** Href for link-type Tab */
|
|
20
|
-
href?: string;
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
} & ({
|
|
23
|
-
/** Additional icon */
|
|
24
|
-
icon: React.ReactNode;
|
|
25
|
-
/** Additional icon position */
|
|
26
|
-
iconPosition?: TabIconPosition;
|
|
27
|
-
} | {
|
|
28
|
-
icon?: never;
|
|
29
|
-
iconPosition?: never;
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export
|
|
34
|
-
declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
35
|
-
export default Tab;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TabListValueType } from './tab-list-context';
|
|
3
|
+
export type TabIconPosition = 'left' | 'right';
|
|
4
|
+
export type TabExplicitProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
value?: TabListValueType;
|
|
7
|
+
/** @ignore */
|
|
8
|
+
itemId?: number;
|
|
9
|
+
/** @ignore */
|
|
10
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
11
|
+
/** @ignore */
|
|
12
|
+
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
13
|
+
/** @ignore */
|
|
14
|
+
onMouseDown?: React.MouseEventHandler<HTMLElement>;
|
|
15
|
+
/** @ignore */
|
|
16
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
|
17
|
+
/** Identifier for e2e tests */
|
|
18
|
+
'data-e2e'?: string;
|
|
19
|
+
/** Href for link-type Tab */
|
|
20
|
+
href?: string;
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
} & ({
|
|
23
|
+
/** Additional icon */
|
|
24
|
+
icon: React.ReactNode;
|
|
25
|
+
/** Additional icon position */
|
|
26
|
+
iconPosition?: TabIconPosition;
|
|
27
|
+
} | {
|
|
28
|
+
icon?: never;
|
|
29
|
+
iconPosition?: never;
|
|
30
|
+
});
|
|
31
|
+
type TabButtonProps = TabExplicitProps & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
32
|
+
type TabAnchorProps = TabExplicitProps & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
33
|
+
export type TabProps = TabButtonProps | TabAnchorProps;
|
|
34
|
+
declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
35
|
+
export default Tab;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MutableRefObject } from 'react';
|
|
2
|
-
export declare const useIndicator: ({ activeNodeRef, containerRef, triggers }: {
|
|
3
|
-
activeNodeRef: MutableRefObject<HTMLElement>;
|
|
4
|
-
containerRef: MutableRefObject<HTMLDivElement>;
|
|
5
|
-
triggers: unknown[];
|
|
6
|
-
}) => {
|
|
7
|
-
indicator: {
|
|
8
|
-
left: number | string;
|
|
9
|
-
width: number | string;
|
|
10
|
-
transitionDuration?: string;
|
|
11
|
-
};
|
|
12
|
-
isIndicatorHidden: boolean;
|
|
13
|
-
};
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
export declare const useIndicator: ({ activeNodeRef, containerRef, triggers }: {
|
|
3
|
+
activeNodeRef: MutableRefObject<HTMLElement>;
|
|
4
|
+
containerRef: MutableRefObject<HTMLDivElement>;
|
|
5
|
+
triggers: unknown[];
|
|
6
|
+
}) => {
|
|
7
|
+
indicator: {
|
|
8
|
+
left: number | string;
|
|
9
|
+
width: number | string;
|
|
10
|
+
transitionDuration?: string;
|
|
11
|
+
};
|
|
12
|
+
isIndicatorHidden: boolean;
|
|
13
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const useRovingTabIndex: ({ selectedId, tabRefs }: {
|
|
3
|
-
selectedId?: number;
|
|
4
|
-
tabRefs?: React.MutableRefObject<Map<number, HTMLElement>>;
|
|
5
|
-
}) => {
|
|
6
|
-
currentTabStopId: number;
|
|
7
|
-
onTabKeyDown: (e: React.KeyboardEvent<HTMLButtonElement | HTMLAnchorElement>, itemId: number) => void;
|
|
8
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const useRovingTabIndex: ({ selectedId, tabRefs }: {
|
|
3
|
+
selectedId?: number;
|
|
4
|
+
tabRefs?: React.MutableRefObject<Map<number, HTMLElement>>;
|
|
5
|
+
}) => {
|
|
6
|
+
currentTabStopId: number;
|
|
7
|
+
onTabKeyDown: (e: React.KeyboardEvent<HTMLButtonElement | HTMLAnchorElement>, itemId: number) => void;
|
|
8
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export
|
|
3
|
-
export declare const useScrollableList: <T>({ children, compareValues, value, CompareItem }: {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
compareValues: ScrollableListCompareValueType<T>;
|
|
6
|
-
value: T;
|
|
7
|
-
CompareItem: React.ElementType;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
childrenWithValues: (string | number | React.ReactElement<
|
|
16
|
-
showLeftArrow: boolean;
|
|
17
|
-
showRightArrow: boolean;
|
|
18
|
-
};
|
|
1
|
+
import React, { MutableRefObject } from 'react';
|
|
2
|
+
export type ScrollableListCompareValueType<T> = (activeValue: T, itemValue: T) => boolean;
|
|
3
|
+
export declare const useScrollableList: <T>({ children, compareValues, value, CompareItem, activeNodeRef, scrollableRef, containerRef }: {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
compareValues: ScrollableListCompareValueType<T>;
|
|
6
|
+
value: T;
|
|
7
|
+
CompareItem: React.ElementType;
|
|
8
|
+
activeNodeRef: MutableRefObject<HTMLElement>;
|
|
9
|
+
scrollableRef: MutableRefObject<HTMLDivElement>;
|
|
10
|
+
containerRef: MutableRefObject<HTMLDivElement>;
|
|
11
|
+
}) => {
|
|
12
|
+
selectedId: number;
|
|
13
|
+
prepareDirectionScroller: (direction: "left" | "right") => () => void;
|
|
14
|
+
tabRefs: React.RefObject<Map<number, HTMLElement>>;
|
|
15
|
+
childrenWithValues: (string | number | bigint | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>>)[];
|
|
16
|
+
showLeftArrow: boolean;
|
|
17
|
+
showRightArrow: boolean;
|
|
18
|
+
};
|
|
@@ -114,12 +114,12 @@ const useScrollableList = _ref2 => {
|
|
|
114
114
|
children,
|
|
115
115
|
compareValues,
|
|
116
116
|
value,
|
|
117
|
-
CompareItem
|
|
117
|
+
CompareItem,
|
|
118
|
+
activeNodeRef,
|
|
119
|
+
scrollableRef,
|
|
120
|
+
containerRef
|
|
118
121
|
} = _ref2;
|
|
119
|
-
const
|
|
120
|
-
const tabRefs = useRef(new Map());
|
|
121
|
-
const scrollableRef = useRef(null);
|
|
122
|
-
const containerRef = useRef(null); // reset targeted element on scrolling by arrows
|
|
122
|
+
const tabRefs = useRef(new Map()); // reset targeted element on scrolling by arrows
|
|
123
123
|
// so on window resize there wouldn't scroll to it
|
|
124
124
|
|
|
125
125
|
const [targetedEl, setTargetedEl] = useState(null);
|
|
@@ -256,10 +256,7 @@ const useScrollableList = _ref2 => {
|
|
|
256
256
|
return {
|
|
257
257
|
selectedId,
|
|
258
258
|
prepareDirectionScroller,
|
|
259
|
-
activeNodeRef,
|
|
260
259
|
tabRefs,
|
|
261
|
-
scrollableRef,
|
|
262
|
-
containerRef,
|
|
263
260
|
childrenWithValues,
|
|
264
261
|
showLeftArrow,
|
|
265
262
|
showRightArrow
|
package/lib/tab-list.d.ts
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/** Optional a11y label for the tab list. Recommended to use either that or `aria-
|
|
24
|
-
'aria-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Theme } from '@rescui/ui-contexts';
|
|
4
|
+
import { TabListValueType } from './parts/tab-list-context';
|
|
5
|
+
import { ScrollableListCompareValueType } from './parts/use-scrollable-list';
|
|
6
|
+
export type TabListSizeType = 'l' | 'm';
|
|
7
|
+
export type TabListModeType = 'classic' | 'rock';
|
|
8
|
+
export type TabListProps<T extends TabListValueType> = {
|
|
9
|
+
className?: string;
|
|
10
|
+
size?: TabListSizeType;
|
|
11
|
+
/** Increase inner horizontal offset between the tabs. */
|
|
12
|
+
sparse?: boolean;
|
|
13
|
+
theme?: Theme;
|
|
14
|
+
mode?: TabListModeType;
|
|
15
|
+
short?: boolean;
|
|
16
|
+
value: T;
|
|
17
|
+
onChange: (value: T) => void;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
/** Identifier for e2e tests */
|
|
20
|
+
'data-e2e'?: string;
|
|
21
|
+
/** Optional a11y label for the tab list. Recommended to use either that or `aria-labelledby`. */
|
|
22
|
+
'aria-label'?: string;
|
|
23
|
+
/** Optional a11y label reference for the tab list. Recommended to use either that or `aria-label`. */
|
|
24
|
+
'aria-labelledby'?: string;
|
|
25
|
+
compareValues?: ScrollableListCompareValueType<T>;
|
|
26
|
+
};
|
|
27
|
+
declare const TabList: {
|
|
28
|
+
<T extends TabListValueType>({ size, sparse, className, mode, short, ["data-e2e"]: e2eId, compareValues, value, onChange, children, theme: themeFromProps, ...restProps }: TabListProps<T>): React.JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
propTypes: {
|
|
31
|
+
size: PropTypes.Requireable<string>;
|
|
32
|
+
sparse: PropTypes.Requireable<boolean>;
|
|
33
|
+
theme: PropTypes.Requireable<string>;
|
|
34
|
+
className: PropTypes.Requireable<string>;
|
|
35
|
+
mode: PropTypes.Requireable<string>;
|
|
36
|
+
short: PropTypes.Requireable<boolean>;
|
|
37
|
+
value: PropTypes.Requireable<NonNullable<string | number | symbol | object>>;
|
|
38
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
|
+
compareValues: PropTypes.Requireable<(...args: any[]) => any>;
|
|
40
|
+
'data-e2e': PropTypes.Requireable<string>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export default TabList;
|
package/lib/tab-list.js
CHANGED
|
@@ -1,37 +1,60 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import cn from 'classnames';
|
|
5
|
+
import { useThemeWithUndefined } from '@rescui/ui-contexts';
|
|
6
|
+
import { Button } from '@rescui/button';
|
|
7
|
+
import LeftOutlineIcon from './_virtual/left-outline.js';
|
|
8
|
+
import RightOutlineIcon from './_virtual/right-outline.js';
|
|
5
9
|
import Tab from './parts/tab.js';
|
|
6
10
|
import { TabListContext } from './parts/tab-list-context.js';
|
|
7
|
-
import { withScrollArrows } from './parts/with-scroll-arrows.js';
|
|
8
11
|
import { useIndicator } from './parts/use-indicator.js';
|
|
9
12
|
import { useRovingTabIndex } from './parts/use-roving-tab-index.js';
|
|
13
|
+
import { useScrollableList } from './parts/use-scrollable-list.js';
|
|
10
14
|
import styles from './parts/tab-list.p.module.css.js';
|
|
11
15
|
const STYLES_SIZES = {
|
|
12
16
|
m: styles.sizeM,
|
|
13
17
|
l: styles.sizeL
|
|
14
18
|
};
|
|
15
19
|
|
|
16
|
-
const
|
|
20
|
+
const compareTabsDefault = (activeValue, tabValue) => activeValue === tabValue; // eslint-disable-next-line complexity
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const TabList = _ref => {
|
|
17
24
|
let {
|
|
18
25
|
size = 'm',
|
|
19
26
|
sparse = false,
|
|
20
27
|
className,
|
|
21
28
|
mode = 'classic',
|
|
22
29
|
short = false,
|
|
23
|
-
|
|
30
|
+
['data-e2e']: e2eId,
|
|
31
|
+
compareValues = compareTabsDefault,
|
|
24
32
|
value,
|
|
25
33
|
onChange,
|
|
26
34
|
children,
|
|
35
|
+
theme: themeFromProps,
|
|
36
|
+
...restProps
|
|
37
|
+
} = _ref;
|
|
38
|
+
const activeNodeRef = useRef(null);
|
|
39
|
+
const scrollableRef = useRef(null);
|
|
40
|
+
const containerRef = useRef(null);
|
|
41
|
+
const theme = useThemeWithUndefined(themeFromProps);
|
|
42
|
+
const {
|
|
27
43
|
selectedId,
|
|
28
|
-
|
|
44
|
+
prepareDirectionScroller,
|
|
29
45
|
tabRefs,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
46
|
+
childrenWithValues,
|
|
47
|
+
showLeftArrow,
|
|
48
|
+
showRightArrow
|
|
49
|
+
} = useScrollableList({
|
|
50
|
+
children,
|
|
51
|
+
compareValues,
|
|
52
|
+
value,
|
|
53
|
+
CompareItem: Tab,
|
|
54
|
+
activeNodeRef,
|
|
55
|
+
scrollableRef,
|
|
56
|
+
containerRef
|
|
57
|
+
});
|
|
35
58
|
const {
|
|
36
59
|
indicator,
|
|
37
60
|
isIndicatorHidden
|
|
@@ -50,22 +73,56 @@ const InnerTabList = _ref => {
|
|
|
50
73
|
selectedId,
|
|
51
74
|
rovingTabIndex
|
|
52
75
|
}
|
|
76
|
+
}, /*#__PURE__*/React.createElement("div", { ...restProps,
|
|
77
|
+
className: cn(className, styles.wrapper, styles[theme], styles[mode], STYLES_SIZES[size], sparse && styles.sparse, short && styles.short, isIndicatorHidden && styles.isIndicatorHidden),
|
|
78
|
+
"data-e2e": e2eId,
|
|
79
|
+
"data-test": 'tab-list',
|
|
80
|
+
role: "tablist"
|
|
53
81
|
}, /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: cn(styles.
|
|
82
|
+
className: cn(styles.arrow, styles.arrowLeft, showLeftArrow && styles.shown),
|
|
83
|
+
"data-test": 'scrollable-list-arrow-left-wrapper'
|
|
84
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
85
|
+
theme: theme,
|
|
86
|
+
mode: "clear",
|
|
87
|
+
notFocusable: true,
|
|
88
|
+
onClick: prepareDirectionScroller('left'),
|
|
89
|
+
icon: /*#__PURE__*/React.createElement(LeftOutlineIcon, {
|
|
90
|
+
"data-render-all-sizes": true
|
|
91
|
+
}),
|
|
92
|
+
size: "s",
|
|
93
|
+
"data-e2e": e2eId ? `${e2eId}__left-arrow` : null,
|
|
94
|
+
"data-test": 'scrollable-list-arrow-left'
|
|
95
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: cn(styles.scrollable, showLeftArrow && styles.withLeftArrow, showRightArrow && styles.withRightArrow),
|
|
97
|
+
ref: scrollableRef,
|
|
98
|
+
tabIndex: -1
|
|
99
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
className: styles.tabsContainer,
|
|
55
101
|
"data-e2e": e2eId ? `${e2eId}__tabs-container` : null,
|
|
56
|
-
"data-test": 'tab-list',
|
|
57
102
|
ref: containerRef,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"aria-labelledby": ariaLabelledBy
|
|
61
|
-
}, children, /*#__PURE__*/React.createElement("span", {
|
|
103
|
+
"data-test": 'tab-list__tabs-container'
|
|
104
|
+
}, childrenWithValues, /*#__PURE__*/React.createElement("span", {
|
|
62
105
|
style: indicator,
|
|
63
106
|
className: styles.indicator
|
|
64
|
-
})))
|
|
107
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: cn(styles.arrow, styles.arrowRight, showRightArrow && styles.shown),
|
|
109
|
+
"data-test": 'scrollable-list-arrow-right-wrapper'
|
|
110
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
111
|
+
theme: theme,
|
|
112
|
+
mode: "clear",
|
|
113
|
+
notFocusable: true,
|
|
114
|
+
onClick: prepareDirectionScroller('right'),
|
|
115
|
+
icon: /*#__PURE__*/React.createElement(RightOutlineIcon, {
|
|
116
|
+
"data-render-all-sizes": true
|
|
117
|
+
}),
|
|
118
|
+
className: styles.arrowButton,
|
|
119
|
+
size: "s",
|
|
120
|
+
"data-e2e": e2eId ? `${e2eId}__right-arrow` : null,
|
|
121
|
+
"data-test": 'scrollable-list-arrow-right'
|
|
122
|
+
}))));
|
|
65
123
|
};
|
|
66
124
|
|
|
67
|
-
|
|
68
|
-
const TabList = withScrollArrows(InnerTabList, Tab);
|
|
125
|
+
TabList.displayName = 'TabList';
|
|
69
126
|
TabList.propTypes = {
|
|
70
127
|
size: PropTypes.oneOf(['m', 'l']),
|
|
71
128
|
sparse: PropTypes.bool,
|
|
@@ -76,8 +133,6 @@ TabList.propTypes = {
|
|
|
76
133
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.symbol, PropTypes.object]),
|
|
77
134
|
onChange: PropTypes.func,
|
|
78
135
|
compareValues: PropTypes.func,
|
|
79
|
-
'data-e2e': PropTypes.string
|
|
80
|
-
'aria-label': PropTypes.string,
|
|
81
|
-
'aria-labelledby': PropTypes.string
|
|
136
|
+
'data-e2e': PropTypes.string
|
|
82
137
|
};
|
|
83
|
-
export { TabList
|
|
138
|
+
export { TabList as default };
|