@@ -14,7 +14,7 @@ import React, {
1414 FC ,
1515} from 'react' ;
1616import classnames from 'classnames' ;
17- import { AutoAlign } from './AutoAlign' ;
17+ import { AutoAlign , AutoAlignInjectedProps } from './AutoAlign' ;
1818import { Button } from './Button' ;
1919import { FormElement , FormElementProps } from './FormElement' ;
2020import { Icon , IconCategory } from './Icon' ;
@@ -181,22 +181,31 @@ const LookupSelectedState: FC<LookupSelectedStateProps> = ({
181181 */
182182type LookupScopeSelectorContainerProps = {
183183 scopeListboxId : string ;
184- autoAlignContentRef : Ref < HTMLElement | null > ;
185184 children : React . ReactNode ;
186- } ;
185+ } & AutoAlignInjectedProps ;
187186
188187/**
189188 * Container component for scope selector dropdown with AutoAlign
190189 */
191190const LookupScopeSelectorContainer : FC < LookupScopeSelectorContainerProps > = ( {
192191 scopeListboxId,
193- autoAlignContentRef,
194192 children,
193+ alignment,
194+ autoAlignContentRef,
195195} ) => {
196+ const [ vertAlign , align ] = alignment ;
197+ const dropdownClassNames = classnames (
198+ 'slds-dropdown' ,
199+ vertAlign ? `slds-dropdown_${ vertAlign } ` : undefined ,
200+ align ? `slds-dropdown_${ align } ` : undefined ,
201+ 'slds-dropdown_length-with-icon-7' ,
202+ 'slds-dropdown_fluid'
203+ ) ;
204+
196205 return (
197206 < div
198207 id = { scopeListboxId }
199- className = 'react-slds-lookup-dropdown slds-dropdown slds-dropdown_length-with-icon-7 slds-dropdown_fluid'
208+ className = { dropdownClassNames }
200209 role = 'listbox'
201210 aria-label = 'Scope Options'
202211 ref = { useMergeRefs ( [ autoAlignContentRef ] ) }
@@ -424,10 +433,10 @@ const LookupScopeSelector: FC<LookupScopeSelectorProps> = ({
424433 alignmentStyle = 'menu'
425434 portalClassName = { portalClassName }
426435 >
427- { ( { autoAlignContentRef } ) => (
436+ { ( injectedProps ) => (
428437 < LookupScopeSelectorContainer
429438 scopeListboxId = { scopeListboxId }
430- autoAlignContentRef = { autoAlignContentRef }
439+ { ... injectedProps }
431440 >
432441 < ul
433442 className = 'slds-listbox slds-listbox_vertical'
@@ -668,9 +677,8 @@ type LookupDropdownContainerProps = {
668677 listboxId : string ;
669678 loading ?: boolean ;
670679 dropdownRef : Ref < HTMLDivElement > ;
671- autoAlignContentRef : Ref < HTMLElement | null > ;
672680 children : React . ReactNode ;
673- } ;
681+ } & AutoAlignInjectedProps ;
674682
675683/**
676684 * Container component for dropdown with merged refs
@@ -679,13 +687,25 @@ const LookupDropdownContainer: FC<LookupDropdownContainerProps> = ({
679687 listboxId,
680688 loading,
681689 dropdownRef,
682- autoAlignContentRef,
683690 children,
691+ alignment,
692+ autoAlignContentRef,
684693} ) => {
694+ const [ vertAlign , align ] = alignment ;
695+ const dropdownClassNames = classnames (
696+ 'react-slds-lookup-dropdown-main' ,
697+ 'slds-dropdown' ,
698+ vertAlign ? `slds-dropdown_${ vertAlign } ` : undefined ,
699+ align ? `slds-dropdown_${ align } ` : undefined ,
700+ 'slds-dropdown_length-with-icon-7' ,
701+ 'slds-dropdown_fluid' ,
702+ 'slds-scrollable_none'
703+ ) ;
704+
685705 return (
686706 < div
687707 id = { listboxId }
688- className = 'react-slds-lookup-dropdown react-slds-lookup-dropdown-main slds-dropdown slds-dropdown_length-with-icon-7 slds-dropdown_fluid slds-scrollable_none'
708+ className = { dropdownClassNames }
689709 role = 'listbox'
690710 aria-label = 'Search Results'
691711 tabIndex = { 0 }
@@ -748,12 +768,12 @@ const LookupDropdown: FC<LookupDropdownProps> = ({
748768 alignmentStyle = 'menu'
749769 portalClassName = { portalClassName }
750770 >
751- { ( { autoAlignContentRef } ) => (
771+ { ( injectedProps ) => (
752772 < LookupDropdownContainer
753773 listboxId = { listboxId }
754774 loading = { loading }
755775 dropdownRef = { dropdownRef }
756- autoAlignContentRef = { autoAlignContentRef }
776+ { ... injectedProps }
757777 >
758778 { listHeader ? (
759779 < ul
@@ -857,7 +877,6 @@ function useInitComponentStyle() {
857877 '.react-slds-lookup-scope-down-icon-container .react-slds-lookup-scope-down-icon' ,
858878 '{ width: 0.8rem; height: 0.8rem; }' ,
859879 ] ,
860- [ '.react-slds-lookup-dropdown' , '{ left: 0; transform: translateX(0); }' ] ,
861880 [
862881 '.react-slds-lookup-dropdown-main' ,
863882 `{ max-height: ${ LIST_PARENT_MAX_HEIGHT } ; min-width: 15rem; }` ,
0 commit comments