1 | import * as React from 'react';
|
2 | import {StyletronComponent} from 'styletron-react';
|
3 | import {Override} from '../overrides';
|
4 |
|
5 |
|
6 |
|
7 | export enum ORIENTATION {
|
8 | horizontal = 'horizontal',
|
9 | vertical = 'vertical',
|
10 | }
|
11 |
|
12 | export enum FILL {
|
13 | intrinsic = 'intrinsic',
|
14 | fixed = 'fixed',
|
15 | }
|
16 |
|
17 | export enum STATE_CHANGE_TYPE {
|
18 | change = 'change',
|
19 | }
|
20 |
|
21 |
|
22 |
|
23 | export const getTabId: (uid: string, key: React.Key) => string;
|
24 | export const getTabPanelId: (uid: string, key: React.Key) => string;
|
25 | export const isHorizontal: (orientation: ORIENTATION) => boolean;
|
26 | export const isVertical: (orientation: ORIENTATION) => boolean;
|
27 | export const isIntrinsic: (fill: FILL) => boolean;
|
28 | export const isFixed: (fill: FILL) => boolean;
|
29 | export const isRTL: (direction: string) => boolean;
|
30 |
|
31 |
|
32 |
|
33 | export const StyledRoot: StyletronComponent<any>;
|
34 | export const StyledTabList: StyletronComponent<any>;
|
35 | export const StyledTab: StyletronComponent<any>;
|
36 | export const StyledArtworkContainer: StyletronComponent<any>;
|
37 | export const StyledTabBorder: StyletronComponent<any>;
|
38 | export const StyledTabHighlight: StyletronComponent<any>;
|
39 | export const StyledTabPanel: StyletronComponent<any>;
|
40 |
|
41 |
|
42 |
|
43 | interface TabsOverrides {
|
44 | Root?: Override<{
|
45 | $orientation?: ORIENTATION;
|
46 | }>;
|
47 | TabList?: Override<{
|
48 | $fill?: FILL;
|
49 | $orientation?: ORIENTATION;
|
50 | }>;
|
51 | TabHighlight?: Override<{
|
52 | $orientation?: ORIENTATION;
|
53 | $length?: number;
|
54 | $distance?: number;
|
55 | $animate?: boolean;
|
56 | }>;
|
57 | TabBorder?: Override<{
|
58 | $orientation?: ORIENTATION;
|
59 | }>;
|
60 | }
|
61 |
|
62 | interface TabsProps {
|
63 | children: React.ReactNode;
|
64 | activeKey?: React.Key;
|
65 | disabled?: boolean;
|
66 | fill?: FILL[keyof FILL];
|
67 | orientation?: ORIENTATION[keyof ORIENTATION];
|
68 | activateOnFocus?: boolean;
|
69 | renderAll?: boolean;
|
70 | onChange?: (params: {activeKey: React.Key}) => void;
|
71 | overrides?: TabsOverrides;
|
72 | }
|
73 |
|
74 | export const Tabs: React.FC<TabsProps>;
|
75 |
|
76 |
|
77 |
|
78 | interface TabOverrides {
|
79 | Tab?: Override<{
|
80 | $fill?: FILL;
|
81 | $orientation?: ORIENTATION;
|
82 | $focusVisible?: boolean;
|
83 | }>;
|
84 | ArtworkContainer?: Override<{
|
85 | $orientation?: ORIENTATION;
|
86 | }>;
|
87 | TabPanel?: Override<{
|
88 | $pad?: boolean;
|
89 | }>;
|
90 | }
|
91 |
|
92 | interface TabProps {
|
93 | title?: React.ReactNode;
|
94 | key?: React.Key;
|
95 | tabRef?: React.MutableRefObject<HTMLButtonElement | undefined>;
|
96 | overrides?: TabOverrides;
|
97 | artwork?: React.ReactNode;
|
98 | children?: React.ReactNode;
|
99 | }
|
100 |
|
101 | export const Tab: React.FC<TabProps>;
|
102 |
|
103 |
|
104 |
|
105 | interface State {
|
106 | activeKey: React.Key;
|
107 | }
|
108 |
|
109 | interface Action {
|
110 | type: STATE_CHANGE_TYPE[keyof STATE_CHANGE_TYPE];
|
111 | payload: React.Key;
|
112 | }
|
113 |
|
114 | type StateReducer = (state: State, action: Action) => State;
|
115 |
|
116 | type StatefulTabsProps = TabsProps & {
|
117 | initialState?: State;
|
118 | stateReducer?: StateReducer;
|
119 | };
|
120 |
|
121 | export const StatefulTabs: React.FC<StatefulTabsProps>;
|