@@ -384,19 +384,19 @@ export type ComboboxProps<
384
384
}
385
385
386
386
function ComboboxFn < TValue , TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG > (
387
- props : ComboboxProps < TValue , true , true , TTag > & RefProp < TTag > ,
387
+ props : ComboboxProps < TValue , true , true , TTag > ,
388
388
ref : Ref < TTag >
389
389
) : JSX . Element
390
390
function ComboboxFn < TValue , TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG > (
391
- props : ComboboxProps < TValue , true , false , TTag > & RefProp < TTag > ,
391
+ props : ComboboxProps < TValue , true , false , TTag > ,
392
392
ref : Ref < TTag >
393
393
) : JSX . Element
394
394
function ComboboxFn < TValue , TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG > (
395
- props : ComboboxProps < TValue , false , false , TTag > & RefProp < TTag > ,
395
+ props : ComboboxProps < TValue , false , false , TTag > ,
396
396
ref : Ref < TTag >
397
397
) : JSX . Element
398
398
function ComboboxFn < TValue , TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG > (
399
- props : ComboboxProps < TValue , false , true , TTag > & RefProp < TTag > ,
399
+ props : ComboboxProps < TValue , false , true , TTag > ,
400
400
ref : Ref < TTag >
401
401
) : JSX . Element
402
402
@@ -718,7 +718,7 @@ function InputFn<
718
718
// TODO: One day we will be able to infer this type from the generic in Combobox itself.
719
719
// But today is not that day..
720
720
TType = Parameters < typeof ComboboxRoot > [ 0 ] [ 'value' ]
721
- > ( props : ComboboxInputProps < TTag , TType > & RefProp < HTMLInputElement > , ref : Ref < HTMLInputElement > ) {
721
+ > ( props : ComboboxInputProps < TTag , TType > , ref : Ref < HTMLInputElement > ) {
722
722
let internalId = useId ( )
723
723
let {
724
724
id = `headlessui-combobox-input-${ internalId } ` ,
@@ -1027,7 +1027,7 @@ export type ComboboxButtonProps<TTag extends ElementType> = Props<
1027
1027
>
1028
1028
1029
1029
function ButtonFn < TTag extends ElementType = typeof DEFAULT_BUTTON_TAG > (
1030
- props : ComboboxButtonProps < TTag > & RefProp < HTMLButtonElement > ,
1030
+ props : ComboboxButtonProps < TTag > ,
1031
1031
ref : Ref < HTMLButtonElement >
1032
1032
) {
1033
1033
let data = useData ( 'Combobox.Button' )
@@ -1140,7 +1140,7 @@ export type ComboboxLabelProps<TTag extends ElementType> = Props<
1140
1140
>
1141
1141
1142
1142
function LabelFn < TTag extends ElementType = typeof DEFAULT_LABEL_TAG > (
1143
- props : ComboboxLabelProps < TTag > & RefProp < HTMLLabelElement > ,
1143
+ props : ComboboxLabelProps < TTag > ,
1144
1144
ref : Ref < HTMLLabelElement >
1145
1145
) {
1146
1146
let internalId = useId ( )
@@ -1189,7 +1189,7 @@ export type ComboboxOptionsProps<TTag extends ElementType> = Props<
1189
1189
}
1190
1190
1191
1191
function OptionsFn < TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG > (
1192
- props : ComboboxOptionsProps < TTag > & RefProp < typeof HTMLUListElement > ,
1192
+ props : ComboboxOptionsProps < TTag > ,
1193
1193
ref : Ref < HTMLUListElement >
1194
1194
) {
1195
1195
let internalId = useId ( )
@@ -1279,7 +1279,7 @@ function OptionFn<
1279
1279
// TODO: One day we will be able to infer this type from the generic in Combobox itself.
1280
1280
// But today is not that day..
1281
1281
TType = Parameters < typeof ComboboxRoot > [ 0 ] [ 'value' ]
1282
- > ( props : ComboboxOptionProps < TTag , TType > & RefProp < HTMLLIElement > , ref : Ref < HTMLLIElement > ) {
1282
+ > ( props : ComboboxOptionProps < TTag , TType > , ref : Ref < HTMLLIElement > ) {
1283
1283
let internalId = useId ( )
1284
1284
let {
1285
1285
id = `headlessui-combobox-option-${ internalId } ` ,
@@ -1419,11 +1419,59 @@ function OptionFn<
1419
1419
1420
1420
// ---
1421
1421
1422
- let ComboboxRoot = forwardRefWithAs ( ComboboxFn )
1423
- let Button = forwardRefWithAs ( ButtonFn )
1424
- let Input = forwardRefWithAs ( InputFn )
1425
- let Label = forwardRefWithAs ( LabelFn )
1426
- let Options = forwardRefWithAs ( OptionsFn )
1427
- let Option = forwardRefWithAs ( OptionFn )
1422
+ export interface ComponentCombobox extends HasDisplayName {
1423
+ < TValue , TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG > (
1424
+ props : ComboboxProps < TValue , true , true , TTag > & RefProp < typeof ComboboxFn >
1425
+ ) : JSX . Element
1426
+ < TValue , TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG > (
1427
+ props : ComboboxProps < TValue , true , false , TTag > & RefProp < typeof ComboboxFn >
1428
+ ) : JSX . Element
1429
+ < TValue , TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG > (
1430
+ props : ComboboxProps < TValue , false , false , TTag > & RefProp < typeof ComboboxFn >
1431
+ ) : JSX . Element
1432
+ < TValue , TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG > (
1433
+ props : ComboboxProps < TValue , false , true , TTag > & RefProp < typeof ComboboxFn >
1434
+ ) : JSX . Element
1435
+ }
1436
+
1437
+ export interface ComponentComboboxButton extends HasDisplayName {
1438
+ < TTag extends ElementType = typeof DEFAULT_BUTTON_TAG > (
1439
+ props : ComboboxButtonProps < TTag > & RefProp < typeof ButtonFn >
1440
+ ) : JSX . Element
1441
+ }
1442
+
1443
+ export interface ComponentComboboxInput extends HasDisplayName {
1444
+ < TType , TTag extends ElementType = typeof DEFAULT_INPUT_TAG > (
1445
+ props : ComboboxInputProps < TTag , TType > & RefProp < typeof InputFn >
1446
+ ) : JSX . Element
1447
+ }
1448
+
1449
+ export interface ComponentComboboxLabel extends HasDisplayName {
1450
+ < TTag extends ElementType = typeof DEFAULT_LABEL_TAG > (
1451
+ props : ComboboxLabelProps < TTag > & RefProp < typeof LabelFn >
1452
+ ) : JSX . Element
1453
+ }
1454
+
1455
+ export interface ComponentComboboxOptions extends HasDisplayName {
1456
+ < TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG > (
1457
+ props : ComboboxOptionsProps < TTag > & RefProp < typeof OptionsFn >
1458
+ ) : JSX . Element
1459
+ }
1460
+
1461
+ export interface ComponentComboboxOption extends HasDisplayName {
1462
+ <
1463
+ TTag extends ElementType = typeof DEFAULT_OPTION_TAG ,
1464
+ TType = Parameters < typeof ComboboxRoot > [ 0 ] [ 'value' ]
1465
+ > (
1466
+ props : ComboboxOptionProps < TTag , TType > & RefProp < typeof OptionFn >
1467
+ ) : JSX . Element
1468
+ }
1469
+
1470
+ let ComboboxRoot = forwardRefWithAs ( ComboboxFn ) as unknown as ComponentCombobox
1471
+ let Button = forwardRefWithAs ( ButtonFn ) as unknown as ComponentComboboxButton
1472
+ let Input = forwardRefWithAs ( InputFn ) as unknown as ComponentComboboxInput
1473
+ let Label = forwardRefWithAs ( LabelFn ) as unknown as ComponentComboboxLabel
1474
+ let Options = forwardRefWithAs ( OptionsFn ) as unknown as ComponentComboboxOptions
1475
+ let Option = forwardRefWithAs ( OptionFn ) as unknown as ComponentComboboxOption
1428
1476
1429
1477
export let Combobox = Object . assign ( ComboboxRoot , { Input, Button, Label, Options, Option } )
0 commit comments