@@ -103,6 +103,15 @@ export class UUIComboboxElement extends UUIFormControlMixin(LitElement, '') {
103103 @property ( { type : Boolean , reflect : true } )
104104 disabled = false ;
105105
106+ /**
107+ * Removes the expand symbol.
108+ * @type {boolean }
109+ * @attr
110+ * @default false
111+ */
112+ @property ( { type : Boolean , reflect : false , attribute : 'hide-expand-symbol' } )
113+ hideExpandSymbol = false ;
114+
106115 /**
107116 * Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
108117 * @type {boolean }
@@ -337,9 +346,11 @@ export class UUIComboboxElement extends UUIFormControlMixin(LitElement, '') {
337346 @keydown = ${ this . #onKeyDown} >
338347 <slot name= "input-prepend" slot = "prepend" > </ slot>
339348 ${ this . #renderClearButton( ) }
340- <div id= "expand-symbol-wrapper" slot = "append" >
341- <uui- symbol- expand .open = ${ this . _isOpen } > </ uui- symbol- expand >
342- </ div>
349+ ${ this . hideExpandSymbol
350+ ? nothing
351+ : html `<div id= "expand-symbol-wrapper" slot = "append" >
352+ <uui- symbol- expand .open = ${ this . _isOpen } > </ uui- symbol- expand >
353+ </ div> ` }
343354 <slot name= "input-append" slot = "append" > </ slot>
344355 </ uui- input> ` ;
345356 } ;
@@ -348,18 +359,18 @@ export class UUIComboboxElement extends UUIFormControlMixin(LitElement, '') {
348359 if ( this . disabled ) return nothing ;
349360 if ( this . readonly ) return nothing ;
350361
351- return this . value || this . search
352- ? html `<uui - butto n
353- id = "clear-button"
354- @click = ${ this . #onClear}
355- @keydown = ${ this . #onClear }
356- label = "clear "
357- slot = "append"
358- compact
359- style = "height: 100%;" >
360- <uui - icon name = "remove" . fallback = ${ iconRemove . strings [ 0 ] } > < / uui - icon >
361- </ uui- but to n > `
362- : '' ;
362+ return html `<uui - but to n
363+ id = "clear -button"
364+ @click = ${ this . #onClear }
365+ @keydown = ${ this . #onClear}
366+ label = "clear"
367+ slot = "append "
368+ compact
369+ style = "height: 100%;"
370+ tab-index = ${ this . value || this . search ? '' : '-1' }
371+ class = ${ this . value || this . search ? 'visible' : '' } >
372+ <uui - icon name = "remove" . fallback = ${ iconRemove . strings [ 0 ] } > </ uui- icon >
373+ < / uui - but to n > ` ;
363374 } ;
364375
365376 #renderDropdown = ( ) => {
@@ -418,6 +429,17 @@ export class UUIComboboxElement extends UUIFormControlMixin(LitElement, '') {
418429 justify-content : center;
419430 }
420431
432+ # clear-button {
433+ opacity : 0 ;
434+ transition : opacity 80ms ;
435+ }
436+
437+ : host (: not ([disabled ]): not ([readonly ]): focus-within )
438+ # clear-button .visible ,
439+ : host (: not ([disabled ]): not ([readonly ]): hover ) # clear-button .visible {
440+ opacity : 1 ;
441+ }
442+
421443 # dropdown {
422444 overflow : hidden;
423445 z-index : -1 ;
0 commit comments