@@ -109,10 +109,13 @@ function _ComboboxPopoverProvider(props: { children?: React.ReactNode }) {
109109 )
110110}
111111
112- function ComboboxTriggerMultiValue ( props : {
112+ function ComboboxTriggerMultiValue ( {
113+ className,
114+ children,
115+ ...props
116+ } : {
113117 children ?: ( ( selectedItem : Item [ ] | undefined ) => React . ReactElement ) | React . ReactNode
114- className ?: string
115- } ) {
118+ } & Omit < React . ComponentPropsWithRef < typeof PopoverTrigger > , 'children' > ) {
116119 const ctx = useCombobox ( )
117120
118121 const selectedItems = ctx . items . filter ( ( item ) => ctx . value . includes ( item . value ) )
@@ -149,13 +152,15 @@ function ComboboxTriggerMultiValue(props: {
149152 < PopoverTrigger
150153 asChild
151154 onKeyDown = { onTriggerKeyDown }
152- className = { cn ( 'w-[200px] min-h-18 justify-between flex h-auto relative' , props . className ) }
155+ className = { cn ( 'w-[200px] min-h-18 justify-between flex h-auto relative' , className ) }
153156 aria-expanded = { ctx . open }
157+ { ...props }
158+ // These properties will be merged down to a children
154159 >
155- { typeof props . children === 'function' ? (
156- props . children ( selectedItems )
157- ) : props . children ? (
158- props . children
160+ { typeof children === 'function' ? (
161+ children ( selectedItems )
162+ ) : children ? (
163+ children
159164 ) : (
160165 < Button variant = "outline" role = "combobox" >
161166 { selectedItems . length > 0 ? renderItems : 'Please select item' }
@@ -166,10 +171,13 @@ function ComboboxTriggerMultiValue(props: {
166171 )
167172}
168173
169- function ComboboxTrigger ( props : {
174+ function ComboboxTrigger ( {
175+ className,
176+ children,
177+ ...props
178+ } : {
170179 children ?: ( ( selectedItem : Item | undefined ) => React . ReactElement ) | React . ReactNode
171- className ?: string
172- } ) {
180+ } & Omit < React . ComponentPropsWithRef < typeof PopoverTrigger > , 'children' > ) {
173181 const ctx = useCombobox ( )
174182
175183 if ( ctx . multipleItems ) {
@@ -188,13 +196,14 @@ function ComboboxTrigger(props: {
188196 < PopoverTrigger
189197 asChild
190198 onKeyDown = { onTriggerKeyDown }
191- className = { cn ( 'w-[200px] justify-between' , props . className ) }
199+ className = { cn ( 'w-[200px] justify-between' , className ) }
192200 aria-expanded = { ctx . open }
201+ { ...props }
193202 >
194- { typeof props . children === 'function' ? (
195- props . children ( selectedItem )
196- ) : props . children ? (
197- props . children
203+ { typeof children === 'function' ? (
204+ children ( selectedItem )
205+ ) : children ? (
206+ children
198207 ) : (
199208 < Button variant = "outline" role = "combobox" >
200209 { selectedItem ?. label || 'Please select item' }
0 commit comments