@combine-labs/combine-polaris
Version:
Combine Lab's product component library. Forked from Shopify's Polaris.
50 lines (49 loc) • 1.42 kB
TypeScript
import * as React from 'react';
import { Panel } from './components';
export interface TabDescriptor {
/** A unique identifier for the tab */
id: string;
/** A destination to link to */
url?: string;
/** Content for the tab */
content: string;
/** A unique identifier for the panel */
panelID?: string;
/** Visually hidden text for screen readers */
accessibilityLabel?: string;
}
export interface Props {
/** Content to display in tabs */
children?: React.ReactNode;
/** Index of selected tab */
selected: number;
/** List of tabs */
tabs: TabDescriptor[];
/** Fit tabs to container */
fitted?: boolean;
/** Callback when tab is selected */
onSelect?(selectedTabIndex: number): void;
}
export interface State {
disclosureWidth: number;
tabWidths: number[];
visibleTabs: number[];
hiddenTabs: number[];
containerWidth: number;
showDisclosure: boolean;
tabToFocus: number;
}
export default class Tabs extends React.PureComponent<Props, State> {
static Panel: typeof Panel;
state: State;
componentWillReceiveProps(nextProps: Props): void;
render(): JSX.Element;
private handleKeyPress;
private renderTabMarkup;
private handleFocus;
private handleBlur;
private handleDisclosureActivatorClick;
private handleClose;
private handleMeasurement;
private handleTabClick;
}