UNPKG

5.77 kBTypeScriptView Raw
1import * as React from 'react';
2import type { WarningContextProps } from '../_util/warning';
3import type { Locale } from '../locale';
4import type { AlertConfig, BadgeConfig, ButtonConfig, CardConfig, CascaderConfig, CollapseConfig, ComponentStyleConfig, ConfigConsumerProps, CSPConfig, DatePickerConfig, DirectionType, DrawerConfig, FlexConfig, FloatButtonGroupConfig, FormConfig, ImageConfig, InputConfig, InputNumberConfig, ListConfig, MentionsConfig, MenuConfig, ModalConfig, NotificationConfig, PaginationConfig, PopupOverflow, RangePickerConfig, SelectConfig, SpaceConfig, SpinConfig, TableConfig, TabsConfig, TagConfig, TextAreaConfig, Theme, ThemeConfig, TimePickerConfig, TourConfig, TransferConfig, TreeSelectConfig, Variant, WaveConfig } from './context';
5import { ConfigConsumer, ConfigContext, defaultIconPrefixCls, defaultPrefixCls, Variants } from './context';
6import type { RenderEmptyHandler } from './defaultRenderEmpty';
7import useConfig from './hooks/useConfig';
8import type { SizeType } from './SizeContext';
9import SizeContext from './SizeContext';
10export type { Variant };
11export { Variants };
12export declare const warnContext: (componentName: string) => void;
13export { ConfigConsumer, ConfigContext, defaultPrefixCls, defaultIconPrefixCls, type ConfigConsumerProps, type CSPConfig, type DirectionType, type RenderEmptyHandler, type ThemeConfig, };
14export declare const configConsumerProps: string[];
15export interface ConfigProviderProps {
16 getTargetContainer?: () => HTMLElement | Window;
17 getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
18 prefixCls?: string;
19 iconPrefixCls?: string;
20 children?: React.ReactNode;
21 renderEmpty?: RenderEmptyHandler;
22 csp?: CSPConfig;
23 /** @deprecated Please use `{ button: { autoInsertSpace: boolean }}` instead */
24 autoInsertSpaceInButton?: boolean;
25 variant?: Variant;
26 form?: FormConfig;
27 input?: InputConfig;
28 inputNumber?: InputNumberConfig;
29 textArea?: TextAreaConfig;
30 select?: SelectConfig;
31 pagination?: PaginationConfig;
32 /**
33 * @descCN 语言包配置,语言包可到 `antd/locale` 目录下寻找。
34 * @descEN Language package setting, you can find the packages in `antd/locale`.
35 */
36 locale?: Locale;
37 componentSize?: SizeType;
38 componentDisabled?: boolean;
39 /**
40 * @descCN 设置布局展示方向。
41 * @descEN Set direction of layout.
42 * @default ltr
43 */
44 direction?: DirectionType;
45 space?: SpaceConfig;
46 /**
47 * @descCN 设置 `false` 时关闭虚拟滚动。
48 * @descEN Close the virtual scrolling when setting `false`.
49 * @default true
50 */
51 virtual?: boolean;
52 /** @deprecated Please use `popupMatchSelectWidth` instead */
53 dropdownMatchSelectWidth?: boolean;
54 popupMatchSelectWidth?: boolean;
55 popupOverflow?: PopupOverflow;
56 theme?: ThemeConfig;
57 warning?: WarningContextProps;
58 alert?: AlertConfig;
59 anchor?: ComponentStyleConfig;
60 button?: ButtonConfig;
61 calendar?: ComponentStyleConfig;
62 carousel?: ComponentStyleConfig;
63 cascader?: CascaderConfig;
64 treeSelect?: TreeSelectConfig;
65 collapse?: CollapseConfig;
66 divider?: ComponentStyleConfig;
67 drawer?: DrawerConfig;
68 typography?: ComponentStyleConfig;
69 skeleton?: ComponentStyleConfig;
70 spin?: SpinConfig;
71 segmented?: ComponentStyleConfig;
72 statistic?: ComponentStyleConfig;
73 steps?: ComponentStyleConfig;
74 image?: ImageConfig;
75 layout?: ComponentStyleConfig;
76 list?: ListConfig;
77 mentions?: MentionsConfig;
78 modal?: ModalConfig;
79 progress?: ComponentStyleConfig;
80 result?: ComponentStyleConfig;
81 slider?: ComponentStyleConfig;
82 breadcrumb?: ComponentStyleConfig;
83 menu?: MenuConfig;
84 floatButtonGroup?: FloatButtonGroupConfig;
85 checkbox?: ComponentStyleConfig;
86 descriptions?: ComponentStyleConfig;
87 empty?: ComponentStyleConfig;
88 badge?: BadgeConfig;
89 radio?: ComponentStyleConfig;
90 rate?: ComponentStyleConfig;
91 switch?: ComponentStyleConfig;
92 transfer?: TransferConfig;
93 avatar?: ComponentStyleConfig;
94 message?: ComponentStyleConfig;
95 tag?: TagConfig;
96 table?: TableConfig;
97 card?: CardConfig;
98 tabs?: TabsConfig;
99 timeline?: ComponentStyleConfig;
100 timePicker?: TimePickerConfig;
101 upload?: ComponentStyleConfig;
102 notification?: NotificationConfig;
103 tree?: ComponentStyleConfig;
104 colorPicker?: ComponentStyleConfig;
105 datePicker?: DatePickerConfig;
106 rangePicker?: RangePickerConfig;
107 dropdown?: ComponentStyleConfig;
108 flex?: FlexConfig;
109 /**
110 * Wave is special component which only patch on the effect of component interaction.
111 */
112 wave?: WaveConfig;
113 tour?: TourConfig;
114}
115type holderRenderType = (children: React.ReactNode) => React.ReactNode;
116declare function getGlobalIconPrefixCls(): string;
117interface GlobalConfigProps {
118 prefixCls?: string;
119 iconPrefixCls?: string;
120 theme?: Theme | ThemeConfig;
121 holderRender?: holderRenderType;
122}
123declare const setGlobalConfig: (props: GlobalConfigProps) => void;
124export declare const globalConfig: () => {
125 getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string;
126 getIconPrefixCls: typeof getGlobalIconPrefixCls;
127 getRootPrefixCls: () => string;
128 getTheme: () => ThemeConfig;
129 holderRender: holderRenderType | undefined;
130};
131declare const ConfigProvider: React.FC<ConfigProviderProps> & {
132 /** @private internal Usage. do not use in your production */
133 ConfigContext: typeof ConfigContext;
134 /** @deprecated Please use `ConfigProvider.useConfig().componentSize` instead */
135 SizeContext: typeof SizeContext;
136 config: typeof setGlobalConfig;
137 useConfig: typeof useConfig;
138};
139export default ConfigProvider;