@@ -3,6 +3,12 @@ import { customElement } from 'lit/decorators/custom-element.js';
33import styles from './pf-radio.css' ;
44import { property } from 'lit/decorators/property.js' ;
55
6+ export class PfRadioChangeEvent extends Event {
7+ constructor ( public event : Event , public value : string ) {
8+ super ( 'change' , { bubbles : true } ) ;
9+ }
10+ }
11+
612/**
713 * Radio
814 * @slot - Place element content here
@@ -52,7 +58,7 @@ export class PfRadio extends LitElement {
5258 document . addEventListener ( 'keydown' , this . #onKeyPress) ;
5359 }
5460
55- #onRadioButtonClick( ) {
61+ #onRadioButtonClick( event : Event ) {
5662 if ( ! this . checked ) {
5763 const root : Node = this . getRootNode ( ) ;
5864 let radioGroup : NodeListOf < PfRadio > ;
@@ -65,6 +71,7 @@ export class PfRadio extends LitElement {
6571 } ) ;
6672 this . checked = true ;
6773 this . tabIndex = 0 ;
74+ this . dispatchEvent ( new PfRadioChangeEvent ( event , this . value ) ) ;
6875 }
6976 }
7077 }
@@ -118,6 +125,7 @@ export class PfRadio extends LitElement {
118125 const nextIndex : number = ( index + direction + radioGroup . length ) % radioGroup . length ;
119126 radioGroup [ nextIndex ] . focus ( ) ;
120127 radioGroup [ nextIndex ] . checked = true ;
128+ this . dispatchEvent ( new PfRadioChangeEvent ( event , radioGroup [ nextIndex ] . value ) ) ;
121129 }
122130 } ) ;
123131 }
@@ -131,6 +139,7 @@ export class PfRadio extends LitElement {
131139 id =${ this . id }
132140 .name=${ this . name }
133141 type='radio'
142+ value=${ this . value }
134143 tabindex=${ this . tabIndex }
135144 .checked=${ this . checked }
136145 />
0 commit comments