@@ -14,7 +14,7 @@ import SelectContextId from './select-context';
1414import { Opt } from './select-inline' ;
1515import { isBrowser } from '@builder.io/qwik/build' ;
1616
17- export type SelectProps = PropsOf < 'div' > & {
17+ export type SelectProps = Omit < PropsOf < 'div' > , 'onChange$ '> & {
1818 value ?: string ;
1919 'bind:value' ?: Signal < string > ;
2020
@@ -24,7 +24,7 @@ export type SelectProps = PropsOf<'div'> & {
2424 // when a value is passed, we check if it's an actual option value, and get its index at pre-render time.
2525 _valuePropIndex ?: number | null ;
2626
27- onChange$ ?: QRL < ( ) => void > ;
27+ onChange$ ?: QRL < ( value : string ) => void > ;
2828 onOpenChange$ ?: QRL < ( ) => void > ;
2929
3030 scrollOptions ?: ScrollIntoViewOptions ;
@@ -80,7 +80,7 @@ export const SelectImpl = component$<SelectProps>((props) => {
8080 useTask$ ( async function onChangeTask ( { track } ) {
8181 track ( ( ) => selectedIndexSig . value ) ;
8282 if ( isBrowser ) {
83- await props . onChange$ ?.( ) ;
83+ await props . onChange$ ?.( optionsSig . value [ selectedIndexSig . value ! ] . value ) ;
8484 }
8585 } ) ;
8686
@@ -108,14 +108,17 @@ export const SelectImpl = component$<SelectProps>((props) => {
108108 useContextProvider ( SelectContextId , context ) ;
109109
110110 return (
111- < div
112- role = "combobox"
113- ref = { rootRef }
114- data-open = { context . isListboxOpenSig . value ? '' : undefined }
115- data-closed = { ! context . isListboxOpenSig . value ? '' : undefined }
116- { ...props }
117- >
118- < Slot />
119- </ div >
111+ < >
112+ { /* @ts -expect-error Qwik expects onChange$ types */ }
113+ < div
114+ role = "combobox"
115+ ref = { rootRef }
116+ data-open = { context . isListboxOpenSig . value ? '' : undefined }
117+ data-closed = { ! context . isListboxOpenSig . value ? '' : undefined }
118+ { ...props }
119+ >
120+ < Slot />
121+ </ div >
122+ </ >
120123 ) ;
121124} ) ;
0 commit comments