diff --git a/components/_util/theme/util/genComponentStyleHook.ts b/components/_util/theme/util/genComponentStyleHook.ts index 40090059c3..8c5fd760b4 100644 --- a/components/_util/theme/util/genComponentStyleHook.ts +++ b/components/_util/theme/util/genComponentStyleHook.ts @@ -15,12 +15,13 @@ export type StyleInfo = { rootPrefixCls: string; iconPrefixCls: string; }; -export type TokenWithComponentCls = T & { +export type TokenWithCommonCls = T & { componentCls: string; prefixCls: string; iconCls: string; + antCls: string; }; -export type FullToken = TokenWithComponentCls< +export type FullToken = TokenWithCommonCls< GlobalTokenWithComponent >; @@ -34,6 +35,7 @@ function genComponentStyleHook( return (prefixCls: string): UseComponentStyleResult => { const [theme, token, hashId] = useToken(); const { getPrefixCls, iconPrefixCls } = useContext(ConfigContext); + const rootPrefixCls = getPrefixCls(); return [ useStyleRegister({ theme, token, hashId, path: [prefixCls] }, () => { @@ -51,17 +53,22 @@ function genComponentStyleHook( }); } const mergedToken = mergeToken< - TokenWithComponentCls> + TokenWithCommonCls> >( proxyToken, - { componentCls: `.${prefixCls}`, prefixCls, iconCls: `.${iconPrefixCls}` }, + { + componentCls: `.${prefixCls}`, + prefixCls, + iconCls: `.${iconPrefixCls}`, + antCls: `.${rootPrefixCls}`, + }, mergedComponentToken, ); const styleInterpolation = styleFn(mergedToken as unknown as FullToken, { hashId, prefixCls, - rootPrefixCls: getPrefixCls(), + rootPrefixCls, iconPrefixCls, }); flush(component);