@@ -19,6 +19,7 @@ import { observes } from '@patternfly/pfe-core/decorators/observes.js';
1919import { PfSearchInputOption } from './pf-search-input-option.js' ;
2020import styles from './pf-search-input.css' ;
2121import type { PfButton } from '../pf-button/pf-button.js' ;
22+ import { PfOption } from '../pf-select/pf-option.js' ;
2223import { bound } from '@patternfly/pfe-core/decorators.js' ;
2324
2425export class PfSelectChangeEvent extends Event {
@@ -83,11 +84,11 @@ export class PfSearchInput extends LitElement {
8384
8485 @query ( '#listbox-container' ) private _listboxContainer ?: HTMLElement ;
8586
86- @query ( '#placeholder' ) private _placeholder ?: PfSearchInputOption ;
87+ @query ( '#placeholder' ) private _placeholder ?: PfOption ;
8788
8889 @query ( '#outer' ) private _searchInputContainer ! : HTMLElement ;
8990
90- #isNotPlaceholderOption = ( option : PfSearchInputOption ) => option !== this . _placeholder ;
91+ #isNotPlaceholderOption = ( option : PfOption ) => option !== this . _placeholder ;
9192
9293 #internals = InternalsController . of ( this ) ;
9394
@@ -108,7 +109,7 @@ export class PfSearchInput extends LitElement {
108109 requestShowListbox : ( ) => void ( this . expanded ||= true ) ,
109110 requestHideListbox : ( ) => void ( this . expanded &&= false ) ,
110111 setItemHidden : ( item , hidden ) => ( item . id !== 'placeholder' ) && void ( item . hidden = hidden ) ,
111- isItem : item => item instanceof PfSearchInputOption ,
112+ isItem : item => item instanceof PfOption ,
112113 setItemActive : ( item , active ) => item . active = active ,
113114 setItemSelected : ( item , selected ) => item . selected = selected ,
114115 } ) ;
@@ -141,24 +142,24 @@ export class PfSearchInput extends LitElement {
141142 * or array of select option values for multi select.
142143 */
143144 @property ( { hasChanged : ( a , b ) => ! arraysAreEquivalent ( a , b ) } )
144- set selected ( selected : PfSearchInputOption | PfSearchInputOption [ ] ) {
145+ set selected ( selected : PfOption | PfOption [ ] ) {
145146 const list = Array . isArray ( selected ) ? selected : [ selected ] ;
146147 this . #combobox. selected = list ;
147148 }
148149
149- get selected ( ) : PfSearchInputOption [ ] {
150+ get selected ( ) : PfOption [ ] {
150151 return this . #combobox. selected ;
151152 }
152153
153154 /** List of options */
154- get options ( ) : PfSearchInputOption [ ] {
155+ get options ( ) : PfOption [ ] {
155156 if ( isServer ) {
156157 return [ ] ; // TODO: expose a DOM property to allow setting options in SSR scenarios
157158 } else {
158159 return [
159160 this . _placeholder ,
160- ...Array . from ( this . querySelectorAll ( 'pf-search-input- option' ) ) ,
161- ] . filter ( ( x ) : x is PfSearchInputOption => ! ! x && ! x . hidden ) ;
161+ ...Array . from ( this . querySelectorAll ( 'pf-option' ) ) ,
162+ ] . filter ( ( x ) : x is PfOption => ! ! x && ! x . hidden ) ;
162163 }
163164 }
164165
@@ -254,7 +255,7 @@ export class PfSearchInput extends LitElement {
254255 }
255256
256257 @observes ( 'selected' )
257- private async selectedChanged ( _ : PfSearchInputOption [ ] , selected : PfSearchInputOption [ ] ) {
258+ private async selectedChanged ( _ : PfOption [ ] , selected : PfOption [ ] ) {
258259 this . value = selected . map ( x => x . value ) . join ( ) ;
259260 await this . updateComplete ;
260261 this . _toggleInput ! . value = this . value ;
0 commit comments