File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 11{
2- "version" : " 0.2.23 " ,
2+ "version" : " 0.2.24 " ,
33 "license" : " MIT" ,
44 "main" : " dist/index.js" ,
55 "typings" : " dist/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ export type CardProps = {
3838 titleExtra ?: ReactNode ;
3939 collapsible ?: boolean ;
4040 defaultOpen ?: boolean ;
41+ onToggle ?: ( open : boolean ) => void ;
42+ id ?: string ;
4143} ;
4244
4345export function Card ( {
@@ -51,11 +53,12 @@ export function Card({
5153 titleExtra,
5254 collapsible,
5355 defaultOpen = true ,
56+ id,
5457} : CardProps ) {
5558 const [ isOpen , setIsOpen ] = useState ( defaultOpen ) ;
56- const id = useId ( ) ;
57- const contentId = `${ id } -content` ,
58- headerId = `${ id } -heading` ;
59+ const idPrefix = useId ( id ) ;
60+ const contentId = `${ idPrefix } -content` ,
61+ headerId = `${ idPrefix } -heading` ;
5962 const defaultTitle = (
6063 < Text textSize = "xlarge" elementType = "h3" weight = "heavy" >
6164 { title }
@@ -105,7 +108,7 @@ export function Card({
105108 'is-open' : isOpen ,
106109 } ) }
107110 >
108- < header css = { headerCSS ( { bordered : true } ) } >
111+ < header css = { headerCSS ( { bordered : true } ) } id = { headerId } >
109112 { titleComponent }
110113 { extra }
111114 </ header >
You can’t perform that action at this time.
0 commit comments