@@ -36,7 +36,7 @@ export function autocomplete<TItem>({
3636 const form = document . createElement ( 'form' ) ;
3737 const label = document . createElement ( 'label' ) ;
3838 const resetButton = document . createElement ( 'button' ) ;
39- const dropdown = document . createElement ( 'div' ) ;
39+ const panel = document . createElement ( 'div' ) ;
4040
4141 const autocomplete = createAutocomplete < TItem > ( {
4242 ...props ,
@@ -51,13 +51,13 @@ export function autocomplete<TItem>({
5151 } ) ;
5252
5353 const onResize = debounce ( ( ) => {
54- if ( ! dropdown . hasAttribute ( 'hidden' ) ) {
54+ if ( ! panel . hasAttribute ( 'hidden' ) ) {
5555 setDropdownPosition ( ) ;
5656 }
5757 } , 100 ) ;
5858
5959 function setDropdownPosition ( ) {
60- setProperties ( dropdown , {
60+ setProperties ( panel , {
6161 style : getDropdownPositionStyle ( {
6262 dropdownPlacement,
6363 container : root ,
@@ -70,7 +70,7 @@ export function autocomplete<TItem>({
7070 setProperties ( window as any , {
7171 ...autocomplete . getEnvironmentProps ( {
7272 searchBoxElement : form ,
73- dropdownElement : dropdown ,
73+ dropdownElement : panel ,
7474 inputElement : input ,
7575 } ) ,
7676 onResize,
@@ -85,9 +85,7 @@ export function autocomplete<TItem>({
8585 class : concatClassNames ( [ 'aa-Form' , classNames . form ] ) ,
8686 } ) ;
8787 setProperties ( inputWrapper , {
88- class : [ 'aa-InputWrapper' , classNames . inputWrapper ]
89- . filter ( Boolean )
90- . join ( ' ' ) ,
88+ class : concatClassNames ( [ 'aa-InputWrapper' , classNames . inputWrapper ] ) ,
9189 } ) ;
9290 setProperties ( input , {
9391 ...autocomplete . getInputProps ( { inputElement : input } ) ,
@@ -104,10 +102,10 @@ export function autocomplete<TItem>({
104102 class : concatClassNames ( [ 'aa-ResetButton' , classNames . resetButton ] ) ,
105103 innerHTML : resetIcon ,
106104 } ) ;
107- setProperties ( dropdown , {
105+ setProperties ( panel , {
108106 ...autocomplete . getDropdownProps ( ) ,
109107 hidden : true ,
110- class : concatClassNames ( [ 'aa-Dropdown ' , classNames . dropdown ] ) ,
108+ class : concatClassNames ( [ 'aa-Panel ' , classNames . panel ] ) ,
111109 } ) ;
112110
113111 function render ( state : AutocompleteCoreState < TItem > ) {
@@ -117,23 +115,23 @@ export function autocomplete<TItem>({
117115 autocomplete . getInputProps ( { inputElement : input } )
118116 ) ;
119117
120- dropdown . innerHTML = '' ;
118+ panel . innerHTML = '' ;
121119
122120 if ( state . isOpen ) {
123- setProperties ( dropdown , {
121+ setProperties ( panel , {
124122 hidden : false ,
125123 } ) ;
126124 } else {
127- setProperties ( dropdown , {
125+ setProperties ( panel , {
128126 hidden : true ,
129127 } ) ;
130128 return ;
131129 }
132130
133131 if ( state . status === 'stalled' ) {
134- dropdown . classList . add ( 'aa-Dropdown --stalled' ) ;
132+ panel . classList . add ( 'aa-panel --stalled' ) ;
135133 } else {
136- dropdown . classList . remove ( 'aa-Dropdown --stalled' ) ;
134+ panel . classList . remove ( 'aa-panel --stalled' ) ;
137135 }
138136
139137 const sections = state . collections . map ( ( collection ) => {
@@ -142,16 +140,13 @@ export function autocomplete<TItem>({
142140
143141 const section = document . createElement ( 'section' ) ;
144142 setProperties ( section , {
145- class : concatClassNames ( [ 'aa-Section ' , classNames . section ] ) ,
143+ class : concatClassNames ( [ 'aa-Source ' , classNames . source ] ) ,
146144 } ) ;
147145
148146 if ( source . templates . header ) {
149147 const header = document . createElement ( 'div' ) ;
150148 setProperties ( header , {
151- class : concatClassNames ( [
152- 'aa-SectionHeader' ,
153- classNames . sectionHeader ,
154- ] ) ,
149+ class : concatClassNames ( [ 'aa-SourceHeader' , classNames . sourceHeader ] ) ,
155150 } ) ;
156151 renderTemplate (
157152 source . templates . header ( { root : header , state } ) ,
@@ -164,14 +159,14 @@ export function autocomplete<TItem>({
164159 const menu = document . createElement ( 'ul' ) ;
165160 setProperties ( menu , {
166161 ...autocomplete . getMenuProps ( ) ,
167- class : concatClassNames ( [ 'aa-Menu ' , classNames . menu ] ) ,
162+ class : concatClassNames ( [ 'aa-List ' , classNames . list ] ) ,
168163 } ) ;
169164
170165 const menuItems = items . map ( ( item ) => {
171166 const li = document . createElement ( 'li' ) ;
172167 setProperties ( li , {
173168 ...autocomplete . getItemProps ( { item, source } ) ,
174- class : concatClassNames ( [ 'aa-Item' , classNames . item ] ) ,
169+ class : concatClassNames ( [ 'aa-Item' , classNames . Item ] ) ,
175170 } ) ;
176171 renderTemplate ( source . templates . item ( { root : li , item, state } ) , li ) ;
177172
@@ -188,10 +183,7 @@ export function autocomplete<TItem>({
188183 if ( source . templates . footer ) {
189184 const footer = document . createElement ( 'div' ) ;
190185 setProperties ( footer , {
191- class : concatClassNames ( [
192- 'aa-SectionFooter' ,
193- classNames . sectionFooter ,
194- ] ) ,
186+ class : concatClassNames ( [ 'aa-SourceFooter' , classNames . sourceFooter ] ) ,
195187 } ) ;
196188 renderTemplate (
197189 source . templates . footer ( { root : footer , state } ) ,
@@ -203,15 +195,15 @@ export function autocomplete<TItem>({
203195 return section ;
204196 } ) ;
205197
206- renderDropdown ( { root : dropdown , sections, state } ) ;
198+ renderDropdown ( { root : panel , sections, state } ) ;
207199 }
208200
209201 inputWrapper . appendChild ( input ) ;
210202 inputWrapper . appendChild ( label ) ;
211203 inputWrapper . appendChild ( resetButton ) ;
212204 form . appendChild ( inputWrapper ) ;
213205 root . appendChild ( form ) ;
214- root . appendChild ( dropdown ) ;
206+ root . appendChild ( panel ) ;
215207 containerElement . appendChild ( root ) ;
216208
217209 setDropdownPosition ( ) ;
0 commit comments