@@ -4,13 +4,12 @@ import ButtonDesign from '@ui5/webcomponents/dist/types/ButtonDesign.js';
44import IconMode from '@ui5/webcomponents/dist/types/IconMode.js' ;
55import InputType from '@ui5/webcomponents/dist/types/InputType.js' ;
66import ListSelectionMode from '@ui5/webcomponents/dist/types/ListSelectionMode.js' ;
7- import iconDecline from '@ui5/webcomponents-icons/dist/decline.js' ;
87import iconSearch from '@ui5/webcomponents-icons/dist/search.js' ;
98import { enrichEventWithDetails , useI18nBundle , useStylesheet , useSyncRef } from '@ui5/webcomponents-react-base' ;
109import { clsx } from 'clsx' ;
1110import type { ReactNode } from 'react' ;
1211import { forwardRef , useEffect , useState } from 'react' ;
13- import { CANCEL , CLEAR , RESET , SEARCH , SELECT , SELECTED } from '../../i18n/i18n-defaults.js' ;
12+ import { CANCEL , CLEAR , SEARCH , SELECT , SELECTED } from '../../i18n/i18n-defaults.js' ;
1413import { Button , Dialog , FlexBox , FlexBoxAlignItems , Icon , Input , List , Text , Title } from '../../index.js' ;
1514import type { Ui5CustomEvent } from '../../types/index.js' ;
1615import type {
@@ -113,6 +112,7 @@ export interface SelectDialogPropTypes
113112 onSearch ?:
114113 | ( ( event : Ui5CustomEvent < InputDomRef , { value : string } > ) => void )
115114 | ( ( event : Ui5CustomEvent < IconDomRef , { value : string } > ) => void ) ;
115+ // todo: remove `nativeDetail` in next major version
116116 /**
117117 * This event will be fired when the reset button has been clicked in the search field or when the dialog is closed.
118118 */
@@ -196,6 +196,10 @@ const SelectDialog = forwardRef<DialogDomRef, SelectDialogPropTypes>((props, ref
196196 } ;
197197
198198 const handleSearchInput = ( e ) => {
199+ if ( ! e . target . value && e . detail . inputType === '' ) {
200+ handleResetSearch ( e ) ;
201+ }
202+
199203 if ( typeof onSearchInput === 'function' ) {
200204 onSearchInput ( enrichEventWithDetails ( e , { value : e . target . value } ) ) ;
201205 }
@@ -318,20 +322,12 @@ const SelectDialog = forwardRef<DialogDomRef, SelectDialogPropTypes>((props, ref
318322 onInput = { handleSearchInput }
319323 onKeyUp = { handleSearchSubmit }
320324 type = { InputType . Search }
325+ showClearIcon
321326 icon = {
322327 < >
323- { searchValue && (
324- < Icon
325- accessibleName = { i18nBundle . getText ( RESET ) }
326- title = { i18nBundle . getText ( RESET ) }
327- name = { iconDecline }
328- mode = { IconMode . Interactive }
329- onClick = { handleResetSearch }
330- className = { classNames . inputIcon }
331- />
332- ) }
328+ { /*Decorative type while still being interactive is by design (see SapUI5 implementation)*/ }
333329 < Icon
334- mode = { IconMode . Interactive }
330+ mode = { IconMode . Decorative }
335331 name = { iconSearch }
336332 className = { classNames . inputIcon }
337333 onClick = { handleSearchSubmit }
0 commit comments