@@ -4,13 +4,12 @@ import ButtonDesign from '@ui5/webcomponents/dist/types/ButtonDesign.js';
4
4
import IconMode from '@ui5/webcomponents/dist/types/IconMode.js' ;
5
5
import InputType from '@ui5/webcomponents/dist/types/InputType.js' ;
6
6
import ListSelectionMode from '@ui5/webcomponents/dist/types/ListSelectionMode.js' ;
7
- import iconDecline from '@ui5/webcomponents-icons/dist/decline.js' ;
8
7
import iconSearch from '@ui5/webcomponents-icons/dist/search.js' ;
9
8
import { enrichEventWithDetails , useI18nBundle , useStylesheet , useSyncRef } from '@ui5/webcomponents-react-base' ;
10
9
import { clsx } from 'clsx' ;
11
10
import type { ReactNode } from 'react' ;
12
11
import { 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' ;
14
13
import { Button , Dialog , FlexBox , FlexBoxAlignItems , Icon , Input , List , Text , Title } from '../../index.js' ;
15
14
import type { Ui5CustomEvent } from '../../types/index.js' ;
16
15
import type {
@@ -113,6 +112,7 @@ export interface SelectDialogPropTypes
113
112
onSearch ?:
114
113
| ( ( event : Ui5CustomEvent < InputDomRef , { value : string } > ) => void )
115
114
| ( ( event : Ui5CustomEvent < IconDomRef , { value : string } > ) => void ) ;
115
+ // todo: remove `nativeDetail` in next major version
116
116
/**
117
117
* This event will be fired when the reset button has been clicked in the search field or when the dialog is closed.
118
118
*/
@@ -196,6 +196,10 @@ const SelectDialog = forwardRef<DialogDomRef, SelectDialogPropTypes>((props, ref
196
196
} ;
197
197
198
198
const handleSearchInput = ( e ) => {
199
+ if ( ! e . target . value && e . detail . inputType === '' ) {
200
+ handleResetSearch ( e ) ;
201
+ }
202
+
199
203
if ( typeof onSearchInput === 'function' ) {
200
204
onSearchInput ( enrichEventWithDetails ( e , { value : e . target . value } ) ) ;
201
205
}
@@ -318,20 +322,12 @@ const SelectDialog = forwardRef<DialogDomRef, SelectDialogPropTypes>((props, ref
318
322
onInput = { handleSearchInput }
319
323
onKeyUp = { handleSearchSubmit }
320
324
type = { InputType . Search }
325
+ showClearIcon
321
326
icon = {
322
327
< >
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)*/ }
333
329
< Icon
334
- mode = { IconMode . Interactive }
330
+ mode = { IconMode . Decorative }
335
331
name = { iconSearch }
336
332
className = { classNames . inputIcon }
337
333
onClick = { handleSearchSubmit }
0 commit comments