Debian Codegraph @

node/@patternfly/react-core/dist/esm/components/Tabs/Tabs.d.ts

raw
1 /// <reference types="node" />
2 import { Component } from 'react';
3 import { PickOptional } from '../../helpers/typeUtils';
4 import { TabProps } from './Tab';
5 import { HorizontalOverflowPopperProps } from './OverflowTab';
6 import { OUIAProps } from '../../helpers';
7 export declare enum TabsComponent {
8 div = "div",
9 nav = "nav"
10 }
11 export interface HorizontalOverflowObject {
12 /** Flag which shows the count of overflowing tabs when enabled */
13 showTabCount?: boolean;
14 /** The text which displays when an overflowing tab isn't selected */
15 defaultTitleText?: string;
16 /** The aria label applied to the button which toggles the tab overflow menu */
17 toggleAriaLabel?: string;
18 /** Additional props to spread to the popper menu. */
19 popperProps?: HorizontalOverflowPopperProps;
20 }
21 type TabElement = React.ReactElement<TabProps, React.JSXElementConstructor<TabProps>>;
22 type TabsChild = TabElement | boolean | null | undefined;
23 export interface TabsProps extends Omit<React.HTMLProps<HTMLElement | HTMLDivElement>, 'onSelect' | 'onToggle'>, OUIAProps {
24 /** Content rendered inside the tabs component. Only `Tab` components or expressions resulting in a falsy value are allowed here. */
25 children: TabsChild | TabsChild[];
26 /** Additional classes added to the tabs */
27 className?: string;
28 /** Tabs background color variant */
29 variant?: 'default' | 'secondary';
30 /** The index of the active tab */
31 activeKey?: number | string;
32 /** The index of the default active tab. Set this for uncontrolled Tabs */
33 defaultActiveKey?: number | string;
34 /** Callback to handle tab selection */
35 onSelect?: (event: React.MouseEvent<HTMLElement, MouseEvent>, eventKey: TabProps['eventKey']) => void;
36 /** Callback to handle tab closing and adds a basic close button to all tabs. This is overridden by the tab actions property. */
37 onClose?: (event: React.MouseEvent<HTMLElement, MouseEvent>, eventKey: TabProps['eventKey']) => void;
38 /** Callback for the add button. Passing this property inserts the add button */
39 onAdd?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
40 /** Aria-label for the add button */
41 addButtonAriaLabel?: string;
42 /** A readable string to create an accessible name for the tablist element. This can be used to differentiate multiple tablists on a page, and should be used for subtabs. */
43 tabListAriaLabel?: string;
44 /** Id of an element that provides an accessible name for the tablist. Use this when a visible label already exists on the page. */
45 tabListAriaLabelledBy?: string;
46 /** Uniquely identifies the tabs */
47 id?: string;
48 /** Flag indicating that the add button is disabled when onAdd is passed in */
49 isAddButtonDisabled?: boolean;
50 /** Enables the filled tab list layout */
51 isFilled?: boolean;
52 /** Enables subtab tab styling */
53 isSubtab?: boolean;
54 /** @beta Enables horizontal nav tab styling */
55 isNav?: boolean;
56 /** Enables box styling to the tab component */
57 isBox?: boolean;
58 /** Enables vertical tab styling */
59 isVertical?: boolean;
60 /** Disables border bottom tab styling on tabs. Defaults to false. To remove the bottom border, set this prop to true. */
61 hasNoBorderBottom?: boolean;
62 /** @deprecated Please use backScrollAriaLabel. Aria-label for the left scroll button */
63 leftScrollAriaLabel?: string;
64 /** @deprecated Please use forwardScrollAriaLabel. Aria-label for the right scroll button */
65 rightScrollAriaLabel?: string;
66 /** Aria-label for the back scroll button */
67 backScrollAriaLabel?: string;
68 /** Aria-label for the forward scroll button */
69 forwardScrollAriaLabel?: string;
70 /** Determines what tag is used around the tabs. Use "nav" to define the tabs inside a navigation region */
71 component?: 'div' | 'nav';
72 /** Provides an accessible label for the tabs. Labels should be unique for each set of tabs that are present on a page. When component is set to nav, this prop should be defined to differentiate the tabs from other navigation regions on the page. */
73 'aria-label'?: string;
74 /** Waits until the first "enter" transition to mount tab children (add them to the DOM) */
75 mountOnEnter?: boolean;
76 /** Unmounts tab children (removes them from the DOM) when they are no longer visible */
77 unmountOnExit?: boolean;
78 /** Flag indicates that the tabs should use page insets. */
79 usePageInsets?: boolean;
80 /** Insets at various breakpoints. */
81 inset?: {
82 default?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
83 sm?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
84 md?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
85 lg?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
86 xl?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
87 '2xl'?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
88 };
89 /** Enable expandable vertical tabs at various breakpoints. (isVertical should be set to true for this to work) */
90 expandable?: {
91 default?: 'expandable' | 'nonExpandable';
92 sm?: 'expandable' | 'nonExpandable';
93 md?: 'expandable' | 'nonExpandable';
94 lg?: 'expandable' | 'nonExpandable';
95 xl?: 'expandable' | 'nonExpandable';
96 '2xl'?: 'expandable' | 'nonExpandable';
97 };
98 /** Flag to indicate if the vertical tabs are expanded */
99 isExpanded?: boolean;
100 /** Flag indicating the default expanded state for uncontrolled expand/collapse of */
101 defaultIsExpanded?: boolean;
102 /** Text that appears in the expandable toggle */
103 toggleText?: string;
104 /** Aria-label for the expandable toggle */
105 toggleAriaLabel?: string;
106 /** Callback function to toggle the expandable tabs. */
107 onToggle?: (event: React.MouseEvent, isExpanded: boolean) => void;
108 /** Flag which places overflowing tabs into a menu triggered by the last tab. Additionally an object can be passed with custom settings for the overflow tab. */
109 isOverflowHorizontal?: boolean | HorizontalOverflowObject;
110 /** Value to overwrite the randomly generated data-ouia-component-id.*/
111 ouiaId?: number | string;
112 /** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */
113 ouiaSafe?: boolean;
114 }
115 interface TabsState {
116 /** Used to signal if the scroll buttons should be used */
117 enableScrollButtons: boolean;
118 /** Used to control if the scroll buttons should be shown to the user via the pf-m-scrollable class */
119 showScrollButtons: boolean;
120 /** Used to control if the scroll buttons should be rendered. Rendering must occur before the scroll buttons are
121 * shown and rendering must be stopped after they stop being shown to preserve CSS transitions.
122 */
123 renderScrollButtons: boolean;
124 disableBackScrollButton: boolean;
125 disableForwardScrollButton: boolean;
126 shownKeys: (string | number)[];
127 uncontrolledActiveKey: number | string;
128 uncontrolledIsExpandedLocal: boolean;
129 overflowingTabCount: number;
130 isInitializingAccent: boolean;
131 currentLinkAccentLength: string;
132 currentLinkAccentStart: string;
133 }
134 declare class Tabs extends Component<TabsProps, TabsState> {
135 static displayName: string;
136 tabList: import("react").RefObject<HTMLUListElement>;
137 leftScrollButtonRef: import("react").RefObject<HTMLButtonElement>;
138 private direction;
139 constructor(props: TabsProps);
140 scrollTimeout: NodeJS.Timeout;
141 static defaultProps: PickOptional<TabsProps>;
142 handleTabClick(event: React.MouseEvent<HTMLElement, MouseEvent>, eventKey: number | string, tabContentRef: React.RefObject<any>): void;
143 countOverflowingElements: (container: HTMLUListElement) => number;
144 handleScrollButtons: () => void;
145 scrollBack: () => void;
146 scrollForward: () => void;
147 hideScrollButtons: () => void;
148 setAccentStyles: (shouldInitializeStyle?: boolean) => void;
149 handleResize: () => void;
150 componentDidMount(): void;
151 componentWillUnmount(): void;
152 componentDidUpdate(prevProps: TabsProps, prevState: TabsState): void;
153 static getDerivedStateFromProps(nextProps: TabsProps, prevState: TabsState): {
154 uncontrolledActiveKey: string | number;
155 shownKeys: (string | number)[];
156 };
157 render(): import("react/jsx-runtime").JSX.Element;
158 }
159 export { Tabs };
160 //# sourceMappingURL=Tabs.d.ts.map