feat: update input.search type (#52077) (#52083)

* feat: update input.search type and role (#52077)

* fix: remove input.search role
This commit is contained in:
SummerBetter 2024-12-23 09:49:09 +08:00 committed by GitHub
parent f96dacd712
commit 02792b8973
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 65 additions and 60 deletions

View File

@ -16125,7 +16125,7 @@ exports[`ConfigProvider components Input configProvider 1`] = `
>
<input
class="config-input config-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -16225,7 +16225,7 @@ exports[`ConfigProvider components Input configProvider componentDisabled 1`] =
<input
class="config-input config-input-disabled config-input-outlined"
disabled=""
type="text"
type="search"
value=""
/>
<span
@ -16326,7 +16326,7 @@ exports[`ConfigProvider components Input configProvider componentSize large 1`]
>
<input
class="config-input config-input-lg config-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -16424,7 +16424,7 @@ exports[`ConfigProvider components Input configProvider componentSize middle 1`]
>
<input
class="config-input config-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -16522,7 +16522,7 @@ exports[`ConfigProvider components Input configProvider componentSize small 1`]
>
<input
class="config-input config-input-sm config-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -16620,7 +16620,7 @@ exports[`ConfigProvider components Input normal 1`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -16718,7 +16718,7 @@ exports[`ConfigProvider components Input prefixCls 1`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span

View File

@ -150,6 +150,13 @@ const Search = React.forwardRef<InputRef, SearchProps>((props, ref) => {
className,
);
const newProps: InputProps = {
...restProps,
className: cls,
prefixCls: inputPrefixCls,
type: 'search',
};
const handleOnCompositionStart: React.CompositionEventHandler<HTMLInputElement> = (e) => {
composedRef.current = true;
onCompositionStart?.(e);
@ -164,15 +171,13 @@ const Search = React.forwardRef<InputRef, SearchProps>((props, ref) => {
<Input
ref={composeRef<InputRef>(inputRef, ref)}
onPressEnter={onPressEnter}
{...restProps}
{...newProps}
size={size}
onCompositionStart={handleOnCompositionStart}
onCompositionEnd={handleOnCompositionEnd}
prefixCls={inputPrefixCls}
addonAfter={button}
suffix={suffix}
onChange={onChange}
className={cls}
disabled={disabled}
/>
);

View File

@ -9,7 +9,7 @@ exports[`Input.Search rtl render component should be rendered correctly in RTL d
>
<input
class="ant-input ant-input-rtl ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -60,7 +60,7 @@ exports[`Input.Search should support ReactNode suffix without error 1`] = `
>
<input
class="ant-input"
type="text"
type="search"
value=""
/>
<span
@ -116,7 +116,7 @@ exports[`Input.Search should support addonAfter 1`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -167,7 +167,7 @@ exports[`Input.Search should support addonAfter 2`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -221,7 +221,7 @@ exports[`Input.Search should support addonAfter and suffix for loading 1`] = `
>
<input
class="ant-input"
type="text"
type="search"
value=""
/>
<span
@ -279,7 +279,7 @@ exports[`Input.Search should support addonAfter and suffix for loading 2`] = `
>
<input
class="ant-input"
type="text"
type="search"
value=""
/>
<span
@ -334,7 +334,7 @@ exports[`Input.Search should support custom Button 1`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -362,7 +362,7 @@ exports[`Input.Search should support custom button 1`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -387,7 +387,7 @@ exports[`Input.Search should support invalid addonAfter 1`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -438,7 +438,7 @@ exports[`Input.Search should support invalid suffix 1`] = `
>
<input
class="ant-input"
type="text"
type="search"
value=""
/>
<span
@ -490,7 +490,7 @@ exports[`Input.Search should support loading 1`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -538,7 +538,7 @@ exports[`Input.Search should support loading 2`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span

View File

@ -5801,7 +5801,7 @@ exports[`renders components/input/demo/compact-style.tsx extend context correctl
<input
class="ant-input"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -7021,7 +7021,7 @@ exports[`renders components/input/demo/group.tsx extend context correctly 1`] =
>
<input
class="ant-input"
type="text"
type="search"
value="0571"
/>
<span
@ -7101,7 +7101,7 @@ exports[`renders components/input/demo/group.tsx extend context correctly 1`] =
>
<input
class="ant-input"
type="text"
type="search"
value="26888888"
/>
<span
@ -10869,7 +10869,7 @@ exports[`renders components/input/demo/search-input.tsx extend context correctly
<input
class="ant-input ant-input-outlined"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -10923,7 +10923,7 @@ exports[`renders components/input/demo/search-input.tsx extend context correctly
<input
class="ant-input"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -11013,7 +11013,7 @@ exports[`renders components/input/demo/search-input.tsx extend context correctly
<input
class="ant-input"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -11094,7 +11094,7 @@ exports[`renders components/input/demo/search-input.tsx extend context correctly
<input
class="ant-input ant-input-outlined"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -11147,7 +11147,7 @@ exports[`renders components/input/demo/search-input.tsx extend context correctly
<input
class="ant-input ant-input-lg"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -11211,7 +11211,7 @@ exports[`renders components/input/demo/search-input.tsx extend context correctly
<input
class="ant-input ant-input-lg"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -11270,7 +11270,7 @@ Array [
<input
class="ant-input ant-input-outlined"
placeholder="input search loading default"
type="text"
type="search"
value=""
/>
<span
@ -11318,7 +11318,7 @@ Array [
<input
class="ant-input ant-input-outlined"
placeholder="input search loading with enterButton"
type="text"
type="search"
value=""
/>
<span
@ -11366,7 +11366,7 @@ Array [
<input
class="ant-input ant-input-lg ant-input-outlined"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span

View File

@ -1683,7 +1683,7 @@ exports[`renders components/input/demo/compact-style.tsx correctly 1`] = `
<input
class="ant-input"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -2714,7 +2714,7 @@ exports[`renders components/input/demo/group.tsx correctly 1`] = `
>
<input
class="ant-input"
type="text"
type="search"
value="0571"
/>
<span
@ -2794,7 +2794,7 @@ exports[`renders components/input/demo/group.tsx correctly 1`] = `
>
<input
class="ant-input"
type="text"
type="search"
value="26888888"
/>
<span
@ -4192,7 +4192,7 @@ exports[`renders components/input/demo/search-input.tsx correctly 1`] = `
<input
class="ant-input ant-input-outlined"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -4246,7 +4246,7 @@ exports[`renders components/input/demo/search-input.tsx correctly 1`] = `
<input
class="ant-input"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -4336,7 +4336,7 @@ exports[`renders components/input/demo/search-input.tsx correctly 1`] = `
<input
class="ant-input"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -4417,7 +4417,7 @@ exports[`renders components/input/demo/search-input.tsx correctly 1`] = `
<input
class="ant-input ant-input-outlined"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -4470,7 +4470,7 @@ exports[`renders components/input/demo/search-input.tsx correctly 1`] = `
<input
class="ant-input ant-input-lg"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -4534,7 +4534,7 @@ exports[`renders components/input/demo/search-input.tsx correctly 1`] = `
<input
class="ant-input ant-input-lg"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span
@ -4591,7 +4591,7 @@ Array [
<input
class="ant-input ant-input-outlined"
placeholder="input search loading default"
type="text"
type="search"
value=""
/>
<span
@ -4639,7 +4639,7 @@ Array [
<input
class="ant-input ant-input-outlined"
placeholder="input search loading with enterButton"
type="text"
type="search"
value=""
/>
<span
@ -4687,7 +4687,7 @@ Array [
<input
class="ant-input ant-input-lg ant-input-outlined"
placeholder="input search text"
type="text"
type="search"
value=""
/>
<span

View File

@ -901,7 +901,7 @@ exports[`renders components/space/demo/compact.tsx extend context correctly 1`]
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value="0571"
/>
<span
@ -950,7 +950,7 @@ exports[`renders components/space/demo/compact.tsx extend context correctly 1`]
>
<input
class="ant-input"
type="text"
type="search"
value="26888888"
/>
<span
@ -1027,7 +1027,7 @@ exports[`renders components/space/demo/compact.tsx extend context correctly 1`]
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value="+1"
/>
<span
@ -10918,7 +10918,7 @@ exports[`renders components/space/demo/compact-debug.tsx extend context correctl
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -10963,7 +10963,7 @@ exports[`renders components/space/demo/compact-debug.tsx extend context correctl
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -14524,7 +14524,7 @@ Array [
<input
class="ant-input ant-input-outlined"
placeholder="Search"
type="text"
type="search"
value=""
/>
<span

View File

@ -620,7 +620,7 @@ exports[`renders components/space/demo/compact.tsx correctly 1`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value="0571"
/>
<span
@ -669,7 +669,7 @@ exports[`renders components/space/demo/compact.tsx correctly 1`] = `
>
<input
class="ant-input"
type="text"
type="search"
value="26888888"
/>
<span
@ -746,7 +746,7 @@ exports[`renders components/space/demo/compact.tsx correctly 1`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value="+1"
/>
<span
@ -2910,7 +2910,7 @@ exports[`renders components/space/demo/compact-debug.tsx correctly 1`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -2955,7 +2955,7 @@ exports[`renders components/space/demo/compact-debug.tsx correctly 1`] = `
>
<input
class="ant-input ant-input-outlined"
type="text"
type="search"
value=""
/>
<span
@ -4145,7 +4145,7 @@ Array [
<input
class="ant-input ant-input-outlined"
placeholder="Search"
type="text"
type="search"
value=""
/>
<span

View File

@ -4362,7 +4362,7 @@ exports[`renders components/tree/demo/search.tsx extend context correctly 1`] =
<input
class="ant-input ant-input-outlined"
placeholder="Search"
type="text"
type="search"
value=""
/>
<span

View File

@ -4245,7 +4245,7 @@ exports[`renders components/tree/demo/search.tsx correctly 1`] = `
<input
class="ant-input ant-input-outlined"
placeholder="Search"
type="text"
type="search"
value=""
/>
<span