Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/AdaptiveTabs/AdaptiveTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export type TabItem<T> = T & {
title?: React.ReactNode;
hint?: string;
disabled?: boolean;
qa?: string;
};

export type TabsSize = 'm' | 'l' | 'xl';
Expand Down Expand Up @@ -118,6 +119,7 @@ export interface AdaptiveTabsProps<T> {
allowNotSelected?: boolean;
/** Settings to control popup with hidden tabs list */
moreControlProps?: Pick<SelectProps, 'virtualizationThreshold' | 'popupWidth'>;
qa?: string;
}

interface AdaptiveTabsState {
Expand Down Expand Up @@ -864,6 +866,7 @@ export class AdaptiveTabs<T> extends React.Component<AdaptiveTabsProps<T>, Adapt
this.onTabClick(item.id, e);
}
}}
data-qa={item.qa}
>
{wrapTo ? wrapTo(item, tabNode, tabIndex) : tabNode}
</div>
Expand Down Expand Up @@ -936,7 +939,7 @@ export class AdaptiveTabs<T> extends React.Component<AdaptiveTabsProps<T>, Adapt
}

render() {
const {items, className, size = 'm'} = this.props;
const {items, className, size = 'm', qa} = this.props;

return (
<div
Expand All @@ -948,6 +951,7 @@ export class AdaptiveTabs<T> extends React.Component<AdaptiveTabsProps<T>, Adapt
},
[className],
)}
data-qa={qa}
>
{(this.state.currentContainerWidthName === SMALL_CONTAINER_WIDTH_NAME ||
this.state.firstHiddenTabIndex === 0) &&
Expand Down
2 changes: 2 additions & 0 deletions src/components/AdaptiveTabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ with the caption `More'. If only one tab fits, the select is displayed instead o
| id | `String` | `true` | | Tab's ID |
| title | `String`, `React.ReactNode` | | | Tab's text |
| disabled | `Boolean` | | | Indicates that the user cannot interact with the tab |
| qa | `String` | | | HTML data-qa attribute, used in tests |

### AdaptiveTabs PropTypes

Expand All @@ -24,6 +25,7 @@ with the caption `More'. If only one tab fits, the select is displayed instead o
| className | `String` | | | Class name for the tabs container |
| [breakpointsConfig](#breakpointsConfig) | `Record<string, number>` | | | Breakpoints config which control the thersholds of tab size. |
| moreControlProps | `{popupWidth?: 'fit' \| number; virtualizationThreshold?: number;}` | | | Settings to control popup with hidden tabs list |
| qa | `String` | | | HTML data-qa attribute, used in tests |

### breakpointsConfig

Expand Down