chore: fix circular dependency

This commit is contained in:
🏎️ Yumo 2024-12-06 14:13:34 +08:00
parent 74729a6998
commit 807cca1997
3 changed files with 13 additions and 15 deletions

View File

@ -1,6 +1,7 @@
import { unit } from '@ant-design/cssinjs'; 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'; import type { AliasToken } from '../theme/internal';
export const textEllipsis: CSSObject = { 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 => ({ export const operationUnit = (token: AliasToken): CSSObject => ({
// FIXME: This use link but is a operation unit. Seems should be a colorPrimary. // 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. // And Typography use this to generate link style which should not do this.

View File

@ -3,10 +3,9 @@ import { genStyleUtils } from '@ant-design/cssinjs-utils';
import type { GetCompUnitless } from '@ant-design/cssinjs-utils/es/util/genStyleUtils'; import type { GetCompUnitless } from '@ant-design/cssinjs-utils/es/util/genStyleUtils';
import { ConfigContext } from '../../config-provider/context'; 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 type { AliasToken, ComponentTokenMap, SeedToken } from '../interface';
import useLocalToken, { unitless } from '../useToken'; import useLocalToken, { unitless } from '../useToken';
import { genIconStyle } from './useResetIconStyle';
export const { genStyleHooks, genComponentStyleHook, genSubStyleComponent } = genStyleUtils< export const { genStyleHooks, genComponentStyleHook, genSubStyleComponent } = genStyleUtils<
ComponentTokenMap, ComponentTokenMap,

View File

@ -1,20 +1,9 @@
import { useStyleRegister } from '@ant-design/cssinjs'; 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 type { CSPConfig } from '../../config-provider';
import { resetIcon } from '../../style'; import { genIconStyle } from '../../style';
import useToken from '../useToken'; import useToken from '../useToken';
export const genIconStyle = (iconPrefixCls = defaultIconPrefixCls): CSSObject => ({
[`.${iconPrefixCls}`]: {
...resetIcon(),
[`.${iconPrefixCls} .${iconPrefixCls}-icon`]: {
display: 'block',
},
},
});
const useResetIconStyle = (iconPrefixCls: string, csp?: CSPConfig) => { const useResetIconStyle = (iconPrefixCls: string, csp?: CSPConfig) => {
const [theme, token] = useToken(); const [theme, token] = useToken();