File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 11< div class ="container ">
22 < h1 > Search with autocomplete</ h1 >
3- < pf-search-input placeholder ="Search ">
3+ < pf-search-input id =" search-input " placeholder ="Search ">
44 < pf-option value ="Alabama "> Alabama </ pf-option >
55 < pf-option value ="New Jersey "> New Jersey </ pf-option >
66 < pf-option value ="New York "> New York </ pf-option >
@@ -26,6 +26,15 @@ <h1>Search with autocomplete</h1>
2626
2727< script type ="module ">
2828 import '@patternfly/elements/pf-search-input/pf-search-input.js' ;
29+
30+ const searchInput = document . getElementById ( 'search-input' ) ;
31+
32+ searchInput . addEventListener ( 'change' , ( event ) => {
33+ /* eslint-disable no-console */
34+ console . log ( 'Selected:' , event . target . value ) ;
35+ /* eslint-disable no-console */
36+ } ) ;
37+ </ script
2938</ script>
3039
3140< style >
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import styles from './pf-search-input.css';
2020import { PfOption } from '../pf-select/pf-option.js' ;
2121import { bound } from '@patternfly/pfe-core/decorators.js' ;
2222
23- export class PfSelectChangeEvent extends Event {
23+ export class PfSearchChangeEvent extends Event {
2424 constructor ( ) {
2525 super ( 'change' , { bubbles : true } ) ;
2626 }
@@ -246,7 +246,7 @@ export class PfSearchInput extends LitElement {
246246 @observes ( 'value' )
247247 private valueChanged ( ) {
248248 this . #internals. setFormValue ( this . value ?? '' ) ;
249- this . dispatchEvent ( new PfSelectChangeEvent ( ) ) ;
249+ this . dispatchEvent ( new PfSearchChangeEvent ( ) ) ;
250250 }
251251
252252
You can’t perform that action at this time.
0 commit comments