UNPKG

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