@@ -23,6 +23,7 @@ import {
2323 type AriaOnFilter ,
2424 type AriaLiveMessages ,
2525} from "react-select"
26+ import ReactSelectAsync from "react-select/async"
2627
2728// usage aria stuff:
2829// https://react-select.com/advanced
@@ -312,6 +313,7 @@ type InnerProps<
312313 IsMulti extends boolean = boolean ,
313314> = PickedCreateableProps < ValueType , IsMulti > & {
314315 isCreateable ?: boolean
316+ isAsync ?: boolean
315317 testId ?: string
316318 innerRef ?: React . Ref < SelectInstance <
317319 OptionType < ValueType > ,
@@ -328,6 +330,7 @@ type InnerProps<
328330
329331const SelectInner = < ValueType , IsMulti extends boolean = boolean > ( {
330332 isCreateable,
333+ isAsync,
331334 formatCreateLabel,
332335 testId,
333336 innerRef,
@@ -525,6 +528,12 @@ const SelectInner = <ValueType, IsMulti extends boolean = boolean>({
525528 _components ,
526529 ] )
527530
531+ if ( isAsync && isCreateable ) {
532+ throw new Error (
533+ "Select - isAsync and isCreateable cannot be true at the same time" ,
534+ )
535+ }
536+
528537 if ( isCreateable ) {
529538 return (
530539 < ReactSelectCreatable <
@@ -560,6 +569,31 @@ const SelectInner = <ValueType, IsMulti extends boolean = boolean>({
560569 )
561570 }
562571
572+ if ( isAsync ) {
573+ return (
574+ < ReactSelectAsync <
575+ OptionType < ValueType > ,
576+ IsMulti ,
577+ OptionGroupType < ValueType >
578+ >
579+ placeholder = {
580+ ( props . placeholder ?? locale . startsWith ( "de" ) )
581+ ? "Auswahl..."
582+ : "Select..."
583+ }
584+ ref = { locRef }
585+ unstyled
586+ inputId = { inputId }
587+ classNames = { classNamesConfig }
588+ data-testid = { testId }
589+ data-invalid = { invalid }
590+ styles = { customStyles }
591+ components = { components }
592+ { ...props }
593+ />
594+ )
595+ }
596+
563597 return (
564598 < RSelect < OptionType < ValueType > , IsMulti , OptionGroupType < ValueType > >
565599 placeholder = {
@@ -613,6 +647,7 @@ type SelectPropsProtoOld<
613647 usePortal ?: boolean
614648 disabled ?: boolean
615649 isCreateable ?: boolean
650+ isAsync ?: boolean
616651 dropdownLabel ?: ( isOpen : boolean ) => string
617652 clearValuesButtonLabel ?: string
618653 removeValueButtonLabel ?: string
@@ -764,6 +799,7 @@ function SelectInForm<
764799 const innerProps : InnerProps < ValueType , IsMulti > = {
765800 ...props ,
766801 isCreateable : props . isCreateable ,
802+ isAsync : props . isAsync ,
767803 testId,
768804 innerRef : ref ,
769805 invalid,
0 commit comments