feat(number-input): forward focus, blur events to input (#1033)

This commit is contained in:
Eric Liu 2022-01-22 08:58:59 -08:00 committed by GitHub
commit 493568f08d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 1 deletions

View file

@ -2603,6 +2603,8 @@ export type NumberInputTranslationId = "increment" | "decrement";
| mouseenter | forwarded | -- | | mouseenter | forwarded | -- |
| mouseleave | forwarded | -- | | mouseleave | forwarded | -- |
| input | forwarded | -- | | input | forwarded | -- |
| focus | forwarded | -- |
| blur | forwarded | -- |
## `NumberInputSkeleton` ## `NumberInputSkeleton`

View file

@ -7232,7 +7232,9 @@
{ "type": "forwarded", "name": "mouseover", "element": "div" }, { "type": "forwarded", "name": "mouseover", "element": "div" },
{ "type": "forwarded", "name": "mouseenter", "element": "div" }, { "type": "forwarded", "name": "mouseenter", "element": "div" },
{ "type": "forwarded", "name": "mouseleave", "element": "div" }, { "type": "forwarded", "name": "mouseleave", "element": "div" },
{ "type": "forwarded", "name": "input", "element": "input" } { "type": "forwarded", "name": "input", "element": "input" },
{ "type": "forwarded", "name": "focus", "element": "input" },
{ "type": "forwarded", "name": "blur", "element": "input" }
], ],
"typedefs": [ "typedefs": [
{ {

View file

@ -215,6 +215,8 @@
on:input="{({ target }) => { on:input="{({ target }) => {
inputValue = target.value; inputValue = target.value;
}}" }}"
on:focus
on:blur
/> />
<button <button
type="button" type="button"
@ -268,6 +270,8 @@
on:input="{({ target }) => { on:input="{({ target }) => {
inputValue = target.value; inputValue = target.value;
}}" }}"
on:focus
on:blur
/> />
{#if invalid} {#if invalid}
<WarningFilled16 class="bx--number__invalid" /> <WarningFilled16 class="bx--number__invalid" />

View file

@ -153,6 +153,8 @@ export default class NumberInput extends SvelteComponentTyped<
mouseenter: WindowEventMap["mouseenter"]; mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"]; mouseleave: WindowEventMap["mouseleave"];
input: WindowEventMap["input"]; input: WindowEventMap["input"];
focus: WindowEventMap["focus"];
blur: WindowEventMap["blur"];
}, },
{ label: {} } { label: {} }
> { > {