1 | import * as React from "react";
|
2 | import { AbstractPureComponent, type Props } from "../../common";
|
3 | import { Tab, type TabId } from "./tab";
|
4 | /**
|
5 | * Component that may be inserted between any two children of `<Tabs>` to right-align all subsequent children.
|
6 | */
|
7 | export declare const TabsExpander: React.FC;
|
8 | /** @deprecated use `TabsExpander` instead */
|
9 | export declare const Expander: React.FC<{}>;
|
10 | export interface TabsProps extends Props {
|
11 | /**
|
12 | * Whether the selected tab indicator should animate its movement.
|
13 | *
|
14 | * @default true
|
15 | */
|
16 | animate?: boolean;
|
17 | /** Tab elements. */
|
18 | children?: React.ReactNode;
|
19 | /**
|
20 | * Initial selected tab `id`, for uncontrolled usage.
|
21 | * Note that this prop refers only to `<Tab>` children; other types of elements are ignored.
|
22 | *
|
23 | * @default first tab
|
24 | */
|
25 | defaultSelectedTabId?: TabId;
|
26 | /**
|
27 | * Unique identifier for this `Tabs` container. This will be combined with the `id` of each
|
28 | * `Tab` child to generate ARIA accessibility attributes. IDs are required and should be
|
29 | * unique on the page to support server-side rendering.
|
30 | */
|
31 | id: TabId;
|
32 | /**
|
33 | * If set to `true`, the tab titles will display with larger styling.
|
34 | * This will apply large styles only to the tabs at this level, not to nested tabs.
|
35 | *
|
36 | * @default false
|
37 | */
|
38 | large?: boolean;
|
39 | /**
|
40 | * Whether inactive tab panels should be removed from the DOM and unmounted in React.
|
41 | * This can be a performance enhancement when rendering many complex panels, but requires
|
42 | * careful support for unmounting and remounting.
|
43 | *
|
44 | * @default false
|
45 | */
|
46 | renderActiveTabPanelOnly?: boolean;
|
47 | /**
|
48 | * Selected tab `id`, for controlled usage.
|
49 | * Providing this prop will put the component in controlled mode.
|
50 | * Unknown ids will result in empty selection (no errors).
|
51 | */
|
52 | selectedTabId?: TabId;
|
53 | /**
|
54 | * Whether to show tabs stacked vertically on the left side.
|
55 | *
|
56 | * @default false
|
57 | */
|
58 | vertical?: boolean;
|
59 | /**
|
60 | * Whether to make the tabs list fill the height of its parent.
|
61 | *
|
62 | * This has no effect when `vertical={true}`.
|
63 | * This is not recommended when tab panels are defined within this component subtree, as the height computation will
|
64 | * include the panel height, which is usually not intended. Instead, it works well if the panels are rendered
|
65 | * elsewhere in the React tree.
|
66 | *
|
67 | * @default false
|
68 | */
|
69 | fill?: boolean;
|
70 | /**
|
71 | * A callback function that is invoked when a tab in the tab list is clicked.
|
72 | */
|
73 | onChange?(newTabId: TabId, prevTabId: TabId | undefined, event: React.MouseEvent<HTMLElement>): void;
|
74 | }
|
75 | export interface TabsState {
|
76 | indicatorWrapperStyle?: React.CSSProperties;
|
77 | selectedTabId?: TabId;
|
78 | }
|
79 | /**
|
80 | * Tabs component.
|
81 | *
|
82 | * @see https://blueprintjs.com/docs/#core/components/tabs
|
83 | */
|
84 | export declare class Tabs extends AbstractPureComponent<TabsProps, TabsState> {
|
85 | /**
|
86 | * Insert a `TabsExpander` between any two children to right-align all subsequent children.
|
87 | *
|
88 | * @deprecated use `TabsExpander`
|
89 | */
|
90 | static Expander: React.FC<{}>;
|
91 | static Tab: typeof Tab;
|
92 | static defaultProps: Partial<TabsProps>;
|
93 | static displayName: string;
|
94 | static getDerivedStateFromProps({ selectedTabId }: TabsProps): {
|
95 | selectedTabId: TabId;
|
96 | } | null;
|
97 | private tablistElement;
|
98 | private refHandlers;
|
99 | constructor(props: TabsProps);
|
100 | render(): React.JSX.Element;
|
101 | componentDidMount(): void;
|
102 | componentDidUpdate(prevProps: TabsProps, prevState: TabsState): void;
|
103 | private getInitialSelectedTabId;
|
104 | private getTabChildrenProps;
|
105 | /** Filters children to only `<Tab>`s */
|
106 | private getTabChildren;
|
107 | /** Queries root HTML element for all tabs with optional filter selector */
|
108 | private getTabElements;
|
109 | private handleKeyDown;
|
110 | private handleKeyPress;
|
111 | private handleTabClick;
|
112 | /**
|
113 | * Calculate the new height, width, and position of the tab indicator.
|
114 | * Store the CSS values so the transition animation can start.
|
115 | */
|
116 | private moveSelectionIndicator;
|
117 | private renderTabPanel;
|
118 | private renderTabTitle;
|
119 | }
|