@@ -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,13 @@ export type ButtonIconProps<
6869 }
6970> ;
7071
71- /** @private */
72- const IconBox : FC < {
73- icon : ReactElement | FC ;
74- busy ?: boolean | Falsy ;
75- capSize ?: FontSize ;
76- } > = ( { icon, busy, ...props } ) => (
77- < Box
78- { ...props }
79- component = "span"
80- className = { [ iconClassName , busy && visiblyHiddenClass ] }
81- >
72+ const IconBox : FC <
73+ BoxProps < 'span' > & {
74+ icon : ReactElement | FC ;
75+ capSize ?: FontSize ;
76+ }
77+ > = ( { icon, className, ...props } ) => (
78+ < Box { ...props } component = "span" className = { [ className , iconClassName ] } >
8279 { isValidElement < ReactElementDefaultPropsType > ( icon )
8380 ? icon
8481 : icon ( { } /* { className: iconClassName } */ ) }
@@ -199,10 +196,10 @@ export const Button = forwardRef(
199196 ] }
200197 >
201198 { iconStart && (
202- < IconBox capSize = { fontSize } busy = { busy } icon = { iconStart } />
199+ < IconBox capSize = { fontSize } icon = { iconStart } { ... busyAttributes } />
203200 ) }
204201
205- { ! busy && hasStringChildren && (
202+ { hasStringChildren && (
206203 < ExactText
207204 component = "span"
208205 textAlign = { textAlign }
@@ -213,15 +210,17 @@ export const Button = forwardRef(
213210 </ ExactText >
214211 ) }
215212
216- { ! busy && children && ! hasStringChildren && (
213+ { ! hasStringChildren && children && (
217214 < Box flexGrow component = "span" { ...busyAttributes } >
218215 { children }
219216 </ Box >
220217 ) }
221218
222- { busy && < Spinner capSize = { fontSize } /> }
219+ { busy && < Spinner className = { busySpinnerClass } capSize = { fontSize } /> }
223220
224- { iconEnd && < IconBox capSize = { fontSize } busy = { busy } icon = { iconEnd } /> }
221+ { iconEnd && (
222+ < IconBox capSize = { fontSize } icon = { iconEnd } { ...busyAttributes } />
223+ ) }
225224 </ UnstyledButton >
226225 ) ;
227226 } ,
0 commit comments