@@ -13,6 +13,9 @@ import type {IconProps} from '@primer/octicons-react'
13
13
import { PlusIcon } from '@primer/octicons-react'
14
14
import VisuallyHidden from '../_VisuallyHidden'
15
15
import { isElement } from 'react-is'
16
+ import { useFeatureFlag } from '../FeatureFlags'
17
+
18
+ import classes from './AutocompleteMenu.module.css'
16
19
17
20
type OnSelectedChange < T > = ( item : T | T [ ] ) => void
18
21
export type AutocompleteMenuItem = MandateProps < ActionListItemProps , 'id' > & {
@@ -117,6 +120,8 @@ export type AutocompleteMenuInternalProps<T extends AutocompleteItemProps> = {
117
120
[ 'aria-labelledby' ] : string
118
121
}
119
122
123
+ const CSS_MODULES_FEATURE_FLAG = 'primer_react_css_modules_team'
124
+
120
125
function AutocompleteMenu < T extends AutocompleteItemProps > ( props : AutocompleteMenuInternalProps < T > ) {
121
126
const autocompleteContext = useContext ( AutocompleteContext )
122
127
if ( autocompleteContext === null ) {
@@ -324,12 +329,20 @@ function AutocompleteMenu<T extends AutocompleteItemProps>(props: AutocompleteMe
324
329
throw new Error ( 'Autocomplete: selectionVariant "single" cannot be used with multiple selected items' )
325
330
}
326
331
332
+ const enabled = useFeatureFlag ( CSS_MODULES_FEATURE_FLAG )
333
+
327
334
return (
328
335
< VisuallyHidden isVisible = { showMenu } >
329
336
{ loading ? (
330
- < Box p = { 3 } display = "flex" justifyContent = "center" >
331
- < Spinner />
332
- </ Box >
337
+ enabled ? (
338
+ < Box className = { classes . SpinnerWrapper } >
339
+ < Spinner />
340
+ </ Box >
341
+ ) : (
342
+ < Box p = { 3 } display = "flex" justifyContent = "center" >
343
+ < Spinner />
344
+ </ Box >
345
+ )
333
346
) : (
334
347
< div ref = { listContainerRef } >
335
348
{ allItemsToRender . length ? (
@@ -367,7 +380,11 @@ function AutocompleteMenu<T extends AutocompleteItemProps>(props: AutocompleteMe
367
380
} ) }
368
381
</ ActionList >
369
382
) : emptyStateText !== false && emptyStateText !== null ? (
370
- < Box p = { 3 } > { emptyStateText } </ Box >
383
+ enabled ? (
384
+ < Box className = { classes . EmptyStateWrapper } > { emptyStateText } </ Box >
385
+ ) : (
386
+ < Box p = { 3 } > { emptyStateText } </ Box >
387
+ )
371
388
) : null }
372
389
</ div >
373
390
) }
0 commit comments