1- import { UUID } from '../components/ItemContext' ;
1+ import { ID } from '../components/ItemContext' ;
22
33export interface InjectedPanelAttributes {
44 role : string | undefined ;
@@ -22,7 +22,7 @@ export interface InjectedButtonAttributes {
2222}
2323
2424export default class AccordionStore {
25- public readonly expanded : UUID [ ] ;
25+ public readonly expanded : ID [ ] ;
2626 public readonly allowMultipleExpanded : boolean ;
2727 public readonly allowZeroExpanded : boolean ;
2828
@@ -31,7 +31,7 @@ export default class AccordionStore {
3131 allowMultipleExpanded = false ,
3232 allowZeroExpanded = false ,
3333 } : {
34- expanded ?: UUID [ ] ;
34+ expanded ?: ID [ ] ;
3535 allowMultipleExpanded ?: boolean ;
3636 allowZeroExpanded ?: boolean ;
3737 } ) {
@@ -40,7 +40,7 @@ export default class AccordionStore {
4040 this . allowZeroExpanded = allowZeroExpanded ;
4141 }
4242
43- public readonly toggleExpanded = ( uuid : UUID ) : AccordionStore => {
43+ public readonly toggleExpanded = ( uuid : ID ) : AccordionStore => {
4444 if ( this . isItemDisabled ( uuid ) ) {
4545 return this ;
4646 }
@@ -55,7 +55,7 @@ export default class AccordionStore {
5555 } else {
5656 return this . augment ( {
5757 expanded : this . expanded . filter (
58- ( expandedUuid : UUID ) : boolean => expandedUuid !== uuid ,
58+ ( expandedUuid : ID ) : boolean => expandedUuid !== uuid ,
5959 ) ,
6060 } ) ;
6161 }
@@ -68,7 +68,7 @@ export default class AccordionStore {
6868 * and if the accordion does not permit the panel to be collapsed, the
6969 * header button element has aria-disabled set to true.”
7070 */
71- public readonly isItemDisabled = ( uuid : UUID ) : boolean => {
71+ public readonly isItemDisabled = ( uuid : ID ) : boolean => {
7272 const isExpanded = this . isItemExpanded ( uuid ) ;
7373 const isOnlyOneExpanded = this . expanded . length === 1 ;
7474
@@ -77,12 +77,12 @@ export default class AccordionStore {
7777 ) ;
7878 } ;
7979
80- public readonly isItemExpanded = ( uuid : UUID ) : boolean => {
80+ public readonly isItemExpanded = ( uuid : ID ) : boolean => {
8181 return this . expanded . indexOf ( uuid ) !== - 1 ;
8282 } ;
8383
8484 public readonly getPanelAttributes = (
85- uuid : UUID ,
85+ uuid : ID ,
8686 dangerouslySetExpanded ?: boolean ,
8787 ) : InjectedPanelAttributes => {
8888 const expanded = dangerouslySetExpanded ?? this . isItemExpanded ( uuid ) ;
@@ -104,7 +104,7 @@ export default class AccordionStore {
104104 } ;
105105
106106 public readonly getButtonAttributes = (
107- uuid : UUID ,
107+ uuid : ID ,
108108 dangerouslySetExpanded ?: boolean ,
109109 ) : InjectedButtonAttributes => {
110110 const expanded = dangerouslySetExpanded ?? this . isItemExpanded ( uuid ) ;
@@ -120,14 +120,13 @@ export default class AccordionStore {
120120 } ;
121121 } ;
122122
123- private readonly getPanelId = ( uuid : UUID ) : string =>
124- `accordion__panel-${ uuid } ` ;
123+ private readonly getPanelId = ( id : ID ) : string => `accordion__panel-${ id } ` ;
125124
126- private readonly getButtonId = ( uuid : UUID ) : string =>
127- `accordion__heading-${ uuid } ` ;
125+ private readonly getButtonId = ( id : ID ) : string =>
126+ `accordion__heading-${ id } ` ;
128127
129128 private readonly augment = ( args : {
130- expanded ?: UUID [ ] ;
129+ expanded ?: ID [ ] ;
131130 allowMultipleExpanded ?: boolean ;
132131 allowZeroExpanded ?: boolean ;
133132 } ) : AccordionStore => {
0 commit comments