Skip to content

Commit 5bacb8b

Browse files
authored
chore(ui5-input): add private hint property (#11176)
1 parent 0571300 commit 5bacb8b

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

packages/main/src/Input.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ import ValueStateMessageCss from "./generated/themes/ValueStateMessage.css.js";
8888
import SuggestionsCss from "./generated/themes/Suggestions.css.js";
8989
import type { ListItemClickEventDetail, ListSelectionChangeEventDetail } from "./List.js";
9090
import type ResponsivePopover from "./ResponsivePopover.js";
91+
import type InputKeyHint from "./types/InputKeyHint.js";
9192

9293
/**
9394
* Interface for components that represent a suggestion item, usable in `ui5-input`
@@ -494,6 +495,15 @@ class Input extends UI5Element implements SuggestionComponent, IFormInputElement
494495
@property({ type: Boolean })
495496
focused = false;
496497

498+
/**
499+
* Used to define enterkeyhint of the inner input.
500+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint
501+
*
502+
* @private
503+
*/
504+
@property()
505+
hint?: `${InputKeyHint}`;
506+
497507
@property({ type: Boolean })
498508
valueStateOpen = false;
499509

@@ -947,7 +957,7 @@ class Input extends UI5Element implements SuggestionComponent, IFormInputElement
947957

948958
if (this.value !== this.previousValue && this.value !== this.lastConfirmedValue && !this.open) {
949959
this.value = this.lastConfirmedValue ? this.lastConfirmedValue : this.previousValue;
950-
this.fireDecoratorEvent(INPUT_EVENTS.INPUT);
960+
this.fireDecoratorEvent(INPUT_EVENTS.INPUT, { inputType: "" });
951961

952962
return;
953963
}

packages/main/src/InputTemplate.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default function InputTemplate(this: Input, hooks?: { preContent: Templat
3636
placeholder={this._placeholder}
3737
maxlength={this.maxlength}
3838
role={this.accInfo.role}
39+
enterkeyhint={this.hint}
3940
aria-controls={this.accInfo.ariaControls}
4041
aria-invalid={this.accInfo.ariaInvalid}
4142
aria-haspopup={this.accInfo.ariaHasPopup}
@@ -63,6 +64,7 @@ export default function InputTemplate(this: Input, hooks?: { preContent: Templat
6364
<div
6465
tabindex={-1}
6566
class="ui5-input-clear-icon-wrapper inputIcon"
67+
part="clear-icon-wrapper"
6668
onClick={this._clear}
6769
onMouseDown={this._iconMouseDown}
6870
>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Different input key hints.
3+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint
4+
*
5+
* @private
6+
*/
7+
enum InputKeyHint {
8+
"Search" = "search",
9+
"Go" = "go",
10+
"Next" = "next",
11+
"Enter" = "enter",
12+
"Done" = "done",
13+
"Previous" = "previous",
14+
"Send" = "send",
15+
}
16+
17+
export default InputKeyHint;

0 commit comments

Comments
 (0)