@@ -15,6 +15,7 @@ import {
1515 iconClassName ,
1616 inlineBleedClass ,
1717 visiblyHiddenClass ,
18+ busySpinnerClass ,
1819} from './button.css.js' ;
1920import { differentOriginLinkProps } from './component-utils.js' ;
2021import { useStringLikeDetector } from './hooks/use-string-like.js' ;
@@ -68,17 +69,11 @@ export type ButtonIconProps<
6869 }
6970> ;
7071
71- /** @private */
72- const IconBox : FC < {
72+ const IconBox : FC < BoxProps < 'span' > & {
7373 icon : ReactElement | FC ;
74- busy ?: boolean | Falsy ;
7574 capSize ?: FontSize ;
76- } > = ( { icon, busy, ...props } ) => (
77- < Box
78- { ...props }
79- component = "span"
80- className = { [ iconClassName , busy && visiblyHiddenClass ] }
81- >
75+ } > = ( { icon, className, ...props } ) => (
76+ < Box { ...props } component = "span" className = { [ className , iconClassName ] } >
8277 { isValidElement < ReactElementDefaultPropsType > ( icon )
8378 ? icon
8479 : icon ( { } /* { className: iconClassName } */ ) }
@@ -199,10 +194,10 @@ export const Button = forwardRef(
199194 ] }
200195 >
201196 { iconStart && (
202- < IconBox capSize = { fontSize } busy = { busy } icon = { iconStart } />
197+ < IconBox capSize = { fontSize } icon = { iconStart } { ... busyAttributes } />
203198 ) }
204199
205- { ! busy && hasStringChildren && (
200+ { hasStringChildren && (
206201 < ExactText
207202 component = "span"
208203 textAlign = { textAlign }
@@ -213,15 +208,17 @@ export const Button = forwardRef(
213208 </ ExactText >
214209 ) }
215210
216- { ! busy && children && ! hasStringChildren && (
211+ { ! hasStringChildren && children && (
217212 < Box flexGrow component = "span" { ...busyAttributes } >
218213 { children }
219214 </ Box >
220215 ) }
221216
222- { busy && < Spinner capSize = { fontSize } /> }
217+ { busy && < Spinner className = { busySpinnerClass } capSize = { fontSize } /> }
223218
224- { iconEnd && < IconBox capSize = { fontSize } busy = { busy } icon = { iconEnd } /> }
219+ { iconEnd && (
220+ < IconBox capSize = { fontSize } icon = { iconEnd } { ...busyAttributes } />
221+ ) }
225222 </ UnstyledButton >
226223 ) ;
227224 } ,
0 commit comments