index.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import * as React from 'react';
  2. import type { TabsProps as RcTabsProps } from 'rc-tabs';
  3. import RcTabs from 'rc-tabs';
  4. import type { GetIndicatorSize } from 'rc-tabs/lib/hooks/useIndicator';
  5. import type { MoreProps, Tab } from 'rc-tabs/lib/interface';
  6. import type { SizeType } from '../config-provider/SizeContext';
  7. import TabPane from './TabPane';
  8. import type { TabPaneProps } from './TabPane';
  9. export type TabsType = 'line' | 'card' | 'editable-card';
  10. export type TabsPosition = 'top' | 'right' | 'bottom' | 'left';
  11. export type { TabPaneProps };
  12. export interface CompatibilityProps {
  13. /** @deprecated Please use `destroyOnHidden` instead */
  14. destroyInactiveTabPane?: boolean;
  15. /**
  16. * @since 5.25.0
  17. */
  18. destroyOnHidden?: boolean;
  19. }
  20. export interface TabsRef {
  21. nativeElement: React.ComponentRef<typeof RcTabs> | null;
  22. }
  23. export interface TabsProps extends CompatibilityProps, Omit<RcTabsProps, 'editable' | 'destroyInactiveTabPane' | 'items'> {
  24. rootClassName?: string;
  25. type?: TabsType;
  26. size?: SizeType;
  27. hideAdd?: boolean;
  28. centered?: boolean;
  29. addIcon?: React.ReactNode;
  30. moreIcon?: React.ReactNode;
  31. more?: MoreProps;
  32. removeIcon?: React.ReactNode;
  33. onEdit?: (e: React.MouseEvent | React.KeyboardEvent | string, action: 'add' | 'remove') => void;
  34. children?: React.ReactNode;
  35. /** @deprecated Please use `indicator={{ size: ... }}` instead */
  36. indicatorSize?: GetIndicatorSize;
  37. items?: (Omit<Tab, 'destroyInactiveTabPane'> & CompatibilityProps)[];
  38. }
  39. declare const InternalTabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<TabsRef>>;
  40. type CompoundedComponent = typeof InternalTabs & {
  41. TabPane: typeof TabPane;
  42. };
  43. declare const Tabs: CompoundedComponent;
  44. export default Tabs;