@@ -7,43 +7,41 @@ import { useChakra } from './use-chakra'
7
7
export function useStyleConfig (
8
8
themeKey : string ,
9
9
themingProps : ThemingProps ,
10
- options : { isMultiPart : true } ,
11
- userStyleConfig ?: any
10
+ options : { isMultiPart : true }
12
11
) : ComputedRef < Record < string , SystemStyleObject > >
13
12
14
13
export function useStyleConfig (
15
14
themeKey : string ,
16
15
themingProps ?: ThemingProps ,
17
- options ?: { isMultiPart ?: boolean } ,
18
- userStyleConfig ?: any
16
+ options ?: { isMultiPart ?: boolean }
19
17
) : ComputedRef < SystemStyleObject >
20
18
21
19
export function useStyleConfig (
22
20
themeKey : any ,
23
21
themingProps : any ,
24
- options : any = { } ,
25
- userStyleConfig ?: any
22
+ options : any = { }
26
23
) {
27
24
return computed ( ( ) => {
25
+ const { styleConfig : styleConfigProp , ...rest } = themingProps
28
26
const { theme, colorMode } = useChakra ( )
29
27
const themeStyleConfig = get ( theme , `components.${ themeKey } ` )
30
28
31
- const styleConfig = userStyleConfig || themeStyleConfig
29
+ const styleConfig = styleConfigProp || themeStyleConfig
32
30
33
31
const mergedProps = mergeWith (
34
32
{ theme : theme , colorMode : colorMode . value } ,
35
33
styleConfig ?. defaultProps ?? { } ,
36
- filterUndefined ( themingProps )
34
+ filterUndefined ( rest )
37
35
)
38
36
39
- const baseStyles = runIfFn ( styleConfig . baseStyle ?? { } , mergedProps )
37
+ const baseStyles = runIfFn ( styleConfig ? .baseStyle ?? { } , mergedProps )
40
38
const variants = runIfFn (
41
- styleConfig . variants ?. [ mergedProps . variant ] ?? { } ,
39
+ styleConfig ? .variants ?. [ mergedProps . variant ] ?? { } ,
42
40
mergedProps
43
41
)
44
42
45
43
const sizes = runIfFn (
46
- styleConfig . sizes ?. [ mergedProps . size ] ?? { } ,
44
+ styleConfig ? .sizes ?. [ mergedProps . size ] ?? { } ,
47
45
mergedProps
48
46
)
49
47
0 commit comments