interface.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { MouseEvent, ReactNode, ComponentType, CSSProperties } from 'react';
  2. import { Motion } from '../_base/base';
  3. export type TabType = 'line' | 'card' | 'button';
  4. export type TabSize = 'small' | 'medium' | 'large';
  5. export type TabPosition = 'top' | 'left';
  6. export interface PlainTab {
  7. disabled?: boolean;
  8. icon?: ReactNode;
  9. itemKey: string;
  10. tab?: ReactNode;
  11. }
  12. export interface TabsProps {
  13. activeKey?: string;
  14. children?: ReactNode | Array<ReactNode>;
  15. className?: string;
  16. collapsible?: boolean;
  17. contentStyle?: CSSProperties;
  18. defaultActiveKey?: string;
  19. keepDOM?: boolean;
  20. lazyRender?: boolean;
  21. onChange?: (activeKey: string) => void;
  22. onTabClick?: (activeKey: string, e: MouseEvent<Element>) => void;
  23. renderTabBar?: (tabBarProps: TabBarProps, defaultTabBar: ComponentType) => ReactNode;
  24. size?: TabSize;
  25. style?: CSSProperties;
  26. tabBarClassName?: string;
  27. tabBarExtraContent?: ReactNode;
  28. tabBarStyle?: CSSProperties;
  29. tabList?: PlainTab[];
  30. tabPaneMotion?: boolean;
  31. tabPosition?: TabPosition;
  32. type?: TabType;
  33. }
  34. export interface TabBarProps {
  35. activeKey?: string;
  36. className?: string;
  37. collapsible?: boolean;
  38. list?: Array<PlainTab>;
  39. onTabClick?: (activeKey: string, event: MouseEvent<Element>) => void;
  40. size?: TabSize;
  41. style?: CSSProperties;
  42. tabBarExtraContent?: ReactNode;
  43. tabPosition?: TabPosition;
  44. type?: TabType;
  45. dropdownClassName?: string;
  46. dropdownStyle?: CSSProperties;
  47. }
  48. export interface TabPaneProps {
  49. className?: string;
  50. disabled?: boolean;
  51. icon?: string;
  52. itemKey?: string;
  53. style?: CSSProperties;
  54. tab?: ReactNode;
  55. }
  56. export interface TabPaneTransitionProps {
  57. [key: string]: any;
  58. children?: ((p: { transform?: string; opacity: number }) => ReactNode | undefined) | undefined;
  59. direction?: boolean;
  60. mode?: 'vertical' | 'horizontal';
  61. motion?: Motion;
  62. }
  63. export interface TabContextValue {
  64. activeKey?: string;
  65. lazyRender?: boolean;
  66. panes?: Array<PlainTab>;
  67. tabPaneMotion?: boolean;
  68. tabPosition?: TabPosition;
  69. }