File tree Expand file tree Collapse file tree 4 files changed +14
-13
lines changed
packages/react/src/components Expand file tree Collapse file tree 4 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,14 @@ const Button: ButtonComponent = React.forwardRef(
205205 }
206206
207207 return (
208+ // @ts -expect-error - `IconButton` does not support all `size`s that
209+ // `Button` supports.
210+ //
211+ // TODO: What should be done here?
212+ // 1. Should the `IconButton` not be rendered if the `size` is not
213+ // supported?
214+ // 2. Should an error be thrown?
215+ // 3. Something else?
208216 < IconButton
209217 { ...rest }
210218 ref = { ref }
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const ButtonBase = React.forwardRef(function ButtonBase<
4545 [ `${ prefix } --btn` ] : true ,
4646 [ `${ prefix } --btn--sm` ] : size === 'sm' && ! isExpressive , // TODO: V12 - Remove this class
4747 [ `${ prefix } --btn--md` ] : size === 'md' && ! isExpressive , // TODO: V12 - Remove this class
48+ [ `${ prefix } --btn--lg` ] : size === 'lg' && ! isExpressive , // TODO: V12 - Remove this class
4849 [ `${ prefix } --btn--xl` ] : size === 'xl' , // TODO: V12 - Remove this class
4950 [ `${ prefix } --btn--2xl` ] : size === '2xl' , // TODO: V12 - Remove this class
5051 [ `${ prefix } --layout--size-${ size } ` ] : size ,
Original file line number Diff line number Diff line change @@ -97,11 +97,7 @@ describe('Button', () => {
9797 ] ) (
9898 'should set the expected classes for the button of kind: `%s`' ,
9999 ( kind , className ) => {
100- render (
101- < Button className = { className } kind = { kind } >
102- test
103- </ Button >
104- ) ;
100+ render ( < Button kind = { kind } > test</ Button > ) ;
105101 expect ( screen . getByText ( 'test' ) ) . toHaveClass ( className ) ;
106102 }
107103 ) ;
@@ -115,11 +111,7 @@ describe('Button', () => {
115111 ] ) (
116112 'should set the expected classes for the button of size: `%s`' ,
117113 ( size , className ) => {
118- render (
119- < Button className = { className } size = { size } >
120- test
121- </ Button >
122- ) ;
114+ render ( < Button size = { size } > test</ Button > ) ;
123115 expect ( screen . getByText ( 'test' ) ) . toHaveClass ( className ) ;
124116 }
125117 ) ;
Original file line number Diff line number Diff line change @@ -161,9 +161,9 @@ export interface IconButtonProps
161161 rel ?: React . AnchorHTMLAttributes < HTMLAnchorElement > [ 'rel' ] ;
162162
163163 /**
164- * Specify the size of the Button. Defaults to `md`.
164+ * Specify the size of the Button.
165165 */
166- size ?: ButtonSize ;
166+ size ?: Extract < ButtonSize , 'sm' | 'md' | 'lg' > ;
167167
168168 /**
169169 * Optionally specify a `target` when using an `<a>` element.
@@ -381,7 +381,7 @@ IconButton.propTypes = {
381381 rel : PropTypes . string ,
382382
383383 /**
384- * Specify the size of the Button. Defaults to `md`.
384+ * Specify the size of the Button.
385385 */
386386 size : PropTypes . oneOf ( [ 'sm' , 'md' , 'lg' ] ) ,
387387
You can’t perform that action at this time.
0 commit comments