@csegames/camelot-unchained
Version:
Camelot Unchained Client Library
55 lines (54 loc) • 1.55 kB
TypeScript
/// <reference types="react" />
import * as React from 'react';
import { StyleDeclaration } from 'aphrodite';
export interface TabPanelStyle extends StyleDeclaration {
tabPanel: React.CSSProperties;
tabs: React.CSSProperties;
tab: React.CSSProperties;
activeTab: React.CSSProperties;
contentContainer: React.CSSProperties;
content: React.CSSProperties;
contentHidden: React.CSSProperties;
}
export declare const defaultTabPanelStyle: TabPanelStyle;
export interface TabItem {
name?: string;
tab: RenderItem<Partial<{
active: boolean;
}>>;
rendersContent: string;
}
export interface ContentItem {
name?: string;
content: RenderItem<Partial<{
active: boolean;
}>>;
}
export interface RenderItem<T> {
render: (props: T) => JSX.Element;
props?: any;
}
export interface TabPanelProps {
styles?: Partial<TabPanelStyle>;
tabs: TabItem[];
content: ContentItem[];
defaultTabIndex?: number;
onActiveTabChanged?: (tabIndex: number, name: string) => void;
alwaysRenderContent?: boolean;
}
export interface TabPanelState {
activeIndex: number;
}
export declare class TabPanel extends React.Component<TabPanelProps, TabPanelState> {
private didMount;
activeTabIndex: number;
constructor(props: TabPanelProps);
render(): JSX.Element;
componentDidMount(): void;
componentWillUnmount(): void;
private renderTabs;
private renderAllContent;
private renderActiveContent;
private selectIndex;
}
export default TabPanel;