UNPKG

2.4 kBTypeScriptView Raw
1import PropTypes from 'prop-types';
2import { TabsProps } from '@restart/ui/Tabs';
3import { TransitionType } from './helpers';
4export interface TabContainerProps extends Omit<TabsProps, 'transition'> {
5 transition?: TransitionType;
6}
7declare const TabContainer: {
8 ({ transition, ...props }: TabContainerProps): JSX.Element;
9 propTypes: {
10 /**
11 * HTML id attribute, required if no `generateChildId` prop
12 * is specified.
13 *
14 * @type {string}
15 */
16 id: PropTypes.Requireable<string>;
17 /**
18 * Sets a default animation strategy for all children `<TabPane>`s.
19 * Defaults to `<Fade>` animation; else, use `false` to disable, or a
20 * custom react-transition-group `<Transition/>` component.
21 *
22 * @type {{Transition | false}}
23 * @default {Fade}
24 */
25 transition: PropTypes.Requireable<NonNullable<boolean | PropTypes.ReactComponentLike | null | undefined>>;
26 /**
27 * Wait until the first "enter" transition to mount tabs (add them to the DOM)
28 */
29 mountOnEnter: PropTypes.Requireable<boolean>;
30 /**
31 * Unmount tabs (remove it from the DOM) when they are no longer visible
32 */
33 unmountOnExit: PropTypes.Requireable<boolean>;
34 /**
35 * A function that takes an `eventKey` and `type` and returns a unique id for
36 * child tab `<NavItem>`s and `<TabPane>`s. The function _must_ be a pure
37 * function, meaning it should always return the _same_ id for the same set
38 * of inputs. The default value requires that an `id` to be set for the
39 * `<TabContainer>`.
40 *
41 * The `type` argument will either be `"tab"` or `"pane"`.
42 *
43 * @defaultValue (eventKey, type) => `${props.id}-${type}-${eventKey}`
44 */
45 generateChildId: PropTypes.Requireable<(...args: any[]) => any>;
46 /**
47 * A callback fired when a tab is selected.
48 *
49 * @controllable activeKey
50 */
51 onSelect: PropTypes.Requireable<(...args: any[]) => any>;
52 /**
53 * The `eventKey` of the currently active tab.
54 *
55 * @controllable onSelect
56 */
57 activeKey: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
58 };
59 displayName: string;
60};
61export default TabContainer;