@@ -87,6 +87,7 @@ export class Accordion implements ComponentInterface {
8787 @State ( ) state : AccordionState = AccordionState . Collapsed ;
8888 @State ( ) isNext = false ;
8989 @State ( ) isPrevious = false ;
90+ @State ( ) isLast = false ;
9091 /**
9192 * Tracks whether a user-initiated interaction has occurred.
9293 * Animations are disabled until the first interaction happens.
@@ -431,6 +432,12 @@ export class Accordion implements ComponentInterface {
431432
432433 const shouldExpand = Array . isArray ( value ) ? value . includes ( accordionValue ) : value === accordionValue ;
433434
435+ /**
436+ * Check if this is the last accordion in the group.
437+ */
438+ const nextAccordion = this . getNextSibling ( ) ;
439+ this . isLast = nextAccordion === undefined ;
440+
434441 if ( shouldExpand ) {
435442 this . expandAccordion ( ) ;
436443 this . isNext = this . isPrevious = false ;
@@ -444,7 +451,6 @@ export class Accordion implements ComponentInterface {
444451 * applied. Check to see if the
445452 * next or previous accordion is selected.
446453 */
447- const nextAccordion = this . getNextSibling ( ) ;
448454 const nextAccordionValue = nextAccordion ?. value ;
449455
450456 if ( nextAccordionValue !== undefined ) {
@@ -525,6 +531,7 @@ export class Accordion implements ComponentInterface {
525531
526532 'accordion-next' : this . isNext ,
527533 'accordion-previous' : this . isPrevious ,
534+ 'accordion-last' : this . isLast ,
528535
529536 'accordion-disabled' : disabled ,
530537 'accordion-readonly' : readonly ,
0 commit comments