Skip to content

Commit 73b8628

Browse files
committed
refactor: add config for getResetStyles
1 parent 8dbe50f commit 73b8628

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/util/genStyleUtils.tsx

+14-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ export type CSSVarRegisterProps = {
9191
};
9292
};
9393

94-
export type GetResetStyles<AliasToken extends TokenType> = (token: AliasToken) => CSSInterpolation;
94+
type GetResetStylesConfig = {
95+
prefix: ReturnType<UsePrefix>;
96+
csp: ReturnType<UseCSP>
97+
};
98+
99+
export type GetResetStyles<AliasToken extends TokenType> = (token: AliasToken, config?: GetResetStylesConfig) => CSSInterpolation;
95100

96101
export type GetCompUnitless<CompTokenMap extends TokenMap, AliasToken extends TokenType> = <
97102
C extends TokenMapKey<CompTokenMap>,
@@ -348,7 +353,14 @@ function genStyleUtils<
348353
// Generate style for all need reset tags.
349354
useStyleRegister(
350355
{ ...sharedConfig, clientOnly: false, path: ['Shared', rootPrefixCls] },
351-
() => (typeof getResetStyles === 'function' ? getResetStyles(token) : []),
356+
() => (
357+
typeof getResetStyles === 'function'
358+
? getResetStyles(token, {
359+
prefix: { rootPrefixCls, iconPrefixCls },
360+
csp,
361+
})
362+
: []
363+
),
352364
);
353365

354366
const wrapSSR = useStyleRegister(

0 commit comments

Comments
 (0)