diff --git a/components/style/index.tsx b/components/style/index.tsx index 624ef2c11f..46850fe069 100644 --- a/components/style/index.tsx +++ b/components/style/index.tsx @@ -1,6 +1,7 @@ import { unit } from '@ant-design/cssinjs'; -import type { CSSObject } from '@ant-design/cssinjs'; +import { defaultIconPrefixCls } from '../config-provider'; +import type { CSSObject } from '@ant-design/cssinjs'; import type { AliasToken } from '../theme/internal'; export const textEllipsis: CSSObject = { @@ -144,6 +145,15 @@ export const genFocusStyle = (token: AliasToken): CSSObject => ({ }, }); +export const genIconStyle = (iconPrefixCls = defaultIconPrefixCls): CSSObject => ({ + [`.${iconPrefixCls}`]: { + ...resetIcon(), + [`.${iconPrefixCls} .${iconPrefixCls}-icon`]: { + display: 'block', + }, + }, +}); + export const operationUnit = (token: AliasToken): CSSObject => ({ // FIXME: This use link but is a operation unit. Seems should be a colorPrimary. // And Typography use this to generate link style which should not do this. diff --git a/components/theme/util/genStyleUtils.ts b/components/theme/util/genStyleUtils.ts index 4d92365e75..487a48d7c0 100644 --- a/components/theme/util/genStyleUtils.ts +++ b/components/theme/util/genStyleUtils.ts @@ -3,10 +3,9 @@ import { genStyleUtils } from '@ant-design/cssinjs-utils'; import type { GetCompUnitless } from '@ant-design/cssinjs-utils/es/util/genStyleUtils'; import { ConfigContext } from '../../config-provider/context'; -import { genCommonStyle, genLinkStyle } from '../../style'; +import { genCommonStyle, genLinkStyle, genIconStyle } from '../../style'; import type { AliasToken, ComponentTokenMap, SeedToken } from '../interface'; import useLocalToken, { unitless } from '../useToken'; -import { genIconStyle } from './useResetIconStyle'; export const { genStyleHooks, genComponentStyleHook, genSubStyleComponent } = genStyleUtils< ComponentTokenMap, diff --git a/components/theme/util/useResetIconStyle.ts b/components/theme/util/useResetIconStyle.ts index 96f3b03f96..43ec8d47b9 100644 --- a/components/theme/util/useResetIconStyle.ts +++ b/components/theme/util/useResetIconStyle.ts @@ -1,20 +1,9 @@ import { useStyleRegister } from '@ant-design/cssinjs'; -import type { CSSObject } from '@ant-design/cssinjs'; -import { defaultIconPrefixCls } from '../../config-provider'; import type { CSPConfig } from '../../config-provider'; -import { resetIcon } from '../../style'; +import { genIconStyle } from '../../style'; import useToken from '../useToken'; -export const genIconStyle = (iconPrefixCls = defaultIconPrefixCls): CSSObject => ({ - [`.${iconPrefixCls}`]: { - ...resetIcon(), - [`.${iconPrefixCls} .${iconPrefixCls}-icon`]: { - display: 'block', - }, - }, -}); - const useResetIconStyle = (iconPrefixCls: string, csp?: CSPConfig) => { const [theme, token] = useToken();