1 | import type React from 'react';
|
2 | import type { CSSMotionProps } from 'rc-motion';
|
3 | import type { TabNavListProps } from './TabNavList';
|
4 | import type { TabPaneProps } from './TabPanelList/TabPane';
|
5 | export type SizeInfo = [width: number, height: number];
|
6 | export type TabSizeMap = Map<React.Key, {
|
7 | width: number;
|
8 | height: number;
|
9 | left: number;
|
10 | top: number;
|
11 | }>;
|
12 | export interface TabOffset {
|
13 | width: number;
|
14 | height: number;
|
15 | left: number;
|
16 | right: number;
|
17 | top: number;
|
18 | }
|
19 | export type TabOffsetMap = Map<React.Key, TabOffset>;
|
20 | export type TabPosition = 'left' | 'right' | 'top' | 'bottom';
|
21 | export interface Tab extends Omit<TabPaneProps, 'tab'> {
|
22 | key: string;
|
23 | label: React.ReactNode;
|
24 | }
|
25 | type RenderTabBarProps = {
|
26 | id: string;
|
27 | activeKey: string;
|
28 | animated: AnimatedConfig;
|
29 | tabPosition: TabPosition;
|
30 | rtl: boolean;
|
31 | mobile: boolean;
|
32 | editable: EditableConfig;
|
33 | locale: TabsLocale;
|
34 | moreIcon: React.ReactNode;
|
35 | moreTransitionName: string;
|
36 | tabBarGutter: number;
|
37 | onTabClick: (key: string, e: React.MouseEvent | React.KeyboardEvent) => void;
|
38 | onTabScroll: OnTabScroll;
|
39 | extra: TabBarExtraContent;
|
40 | style: React.CSSProperties;
|
41 |
|
42 | panes: React.ReactNode;
|
43 | };
|
44 | export type RenderTabBar = (props: RenderTabBarProps, DefaultTabBar: React.ComponentType<TabNavListProps>) => React.ReactElement;
|
45 | export interface TabsLocale {
|
46 | dropdownAriaLabel?: string;
|
47 | removeAriaLabel?: string;
|
48 | addAriaLabel?: string;
|
49 | }
|
50 | export interface EditableConfig {
|
51 | onEdit: (type: 'add' | 'remove', info: {
|
52 | key?: string;
|
53 | event: React.MouseEvent | React.KeyboardEvent;
|
54 | }) => void;
|
55 | showAdd?: boolean;
|
56 | removeIcon?: React.ReactNode;
|
57 | addIcon?: React.ReactNode;
|
58 | }
|
59 | export interface AnimatedConfig {
|
60 | inkBar?: boolean;
|
61 | tabPane?: boolean;
|
62 | tabPaneMotion?: CSSMotionProps;
|
63 | }
|
64 | export type OnTabScroll = (info: {
|
65 | direction: 'left' | 'right' | 'top' | 'bottom';
|
66 | }) => void;
|
67 | export type TabBarExtraPosition = 'left' | 'right';
|
68 | export type TabBarExtraMap = Partial<Record<TabBarExtraPosition, React.ReactNode>>;
|
69 | export type TabBarExtraContent = React.ReactNode | TabBarExtraMap;
|
70 | export {};
|