From ddd0630caa49a485750dda6ae46084b3a66ea83f Mon Sep 17 00:00:00 2001 From: gburnett Date: Tue, 5 Apr 2022 08:21:29 +0000 Subject: [PATCH 1/3] Adds event handler and ref types to inner input. --- components/input/private/inner-input.d.ts | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/components/input/private/inner-input.d.ts b/components/input/private/inner-input.d.ts index 9128b670aa..d9eb2b83e5 100644 --- a/components/input/private/inner-input.d.ts +++ b/components/input/private/inner-input.d.ts @@ -81,7 +81,7 @@ declare module '@salesforce/design-system-react/components/input/private/inner-i /** * This callback exposes the input reference / DOM node to parent components. ` this.input = inputComponent} /> */ - inputRef?: (v: any) => any; + inputRef?: React.LegacyRef; /** * Displays the value of the input statically. This follows the static input UX pattern. */ @@ -90,23 +90,23 @@ declare module '@salesforce/design-system-react/components/input/private/inner-i * This label appears above the input. */ label?: string; - onBlur?: (v: any) => any; + onBlur?: React.FocusEventHandler; /** * This callback fires when the input changes. The synthetic React event will be the first parameter to the callback. You will probably want to reference `event.target.value` in your callback. No custom data object is provided. */ - onChange?: (v: any) => any; + onChange?: React.ChangeEventHandler; /** * This event fires when the input is clicked. */ - onClick?: (v: any) => any; - onFocus?: (v: any) => any; - onInput?: (v: any) => any; - onInvalid?: (v: any) => any; - onKeyDown?: (v: any) => any; - onKeyPress?: (v: any) => any; - onKeyUp?: (v: any) => any; - onSelect?: (v: any) => any; - onSubmit?: (v: any) => any; + onClick?: React.MouseEventHandler; + onFocus?: React.FocusEventHandler; + onInput?: React.FormEventHandler; + onInvalid?: React.FormEventHandler; + onKeyDown?: React.KeyboardEventHandler; + onKeyPress?: React.KeyboardEventHandler; + onKeyUp?: React.KeyboardEventHandler; + onSelect?: React.ReactEventHandler; + onSubmit?: React.ReactEventHandler; /** * Text that will appear in an empty input. */ From 5a448db3a07797e1bc5d6222bfa124d96abb102b Mon Sep 17 00:00:00 2001 From: gburnett Date: Tue, 5 Apr 2022 08:32:58 +0000 Subject: [PATCH 2/3] Adds event handler and ref types to input. --- components/input.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/components/input.d.ts b/components/input.d.ts index e035f8b34e..304dfaecc8 100644 --- a/components/input.d.ts +++ b/components/input.d.ts @@ -116,7 +116,7 @@ declare module '@salesforce/design-system-react/components/input' { /** * This callback exposes the input reference / DOM node to parent components. ` this.input = inputComponent} /> */ - inputRef?: (v: any) => any; + inputRef?: React.RefCallback; /** * Displays the value of the input statically. This follows the static input UX pattern. */ @@ -128,50 +128,50 @@ declare module '@salesforce/design-system-react/components/input' { /** * Triggered when focus is removed. */ - onBlur?: (v: any) => any; + onBlur?: React.FocusEventHandler; /** * This callback fires when the input changes. Passes in `event, { value }`. */ onChange?: ( - e: React.KeyboardEvent, + e: React.ChangeEvent, value: { value: any } ) => any; /** * This event fires when the input is clicked. */ - onClick?: (v: any) => any; + onClick?: React.MouseEventHandler; /** * Triggered when component is focused. */ - onFocus?: (v: any) => any; + onFocus?: React.FocusEventHandler; /** * Similar to `onchange`. Triggered when an element gets user input. */ - onInput?: (v: any) => any; + onInput?: React.FormEventHandler; /** * Triggered when a submittable `` element is invalid. */ - onInvalid?: (v: any) => any; + onInvalid?: React.FormEventHandler; /** * Triggered when a key is pressed down */ - onKeyDown?: (v: any) => any; + onKeyDown?: React.KeyboardEventHandler; /** * Triggered when a key is pressed and released */ - onKeyPress?: (v: any) => any; + onKeyPress?: React.KeyboardEventHandler; /** * Triggered when a key is released */ - onKeyUp?: (v: any) => any; + onKeyUp?: React.KeyboardEventHandler; /** * Triggered after some text has been selected in an element. */ - onSelect?: (v: any) => any; + onSelect?: React.ReactEventHandler; /** * Fires when a form is submitted. */ - onSubmit?: (v: any) => any; + onSubmit?: React.ReactEventHandler; /** * Text that will appear in an empty input. */ From e830f6f8cc99732ab0444923a8d45b3ecd283c32 Mon Sep 17 00:00:00 2001 From: gburnett Date: Wed, 6 Apr 2022 10:23:51 +0000 Subject: [PATCH 3/3] Updates types for performStep. --- components/input.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/input.d.ts b/components/input.d.ts index 304dfaecc8..6feee0b88e 100644 --- a/components/input.d.ts +++ b/components/input.d.ts @@ -133,8 +133,11 @@ declare module '@salesforce/design-system-react/components/input' { * This callback fires when the input changes. Passes in `event, { value }`. */ onChange?: ( - e: React.ChangeEvent, - value: { value: any } + e: + | React.ChangeEvent + | React.KeyboardEvent + | React.MouseEvent, + value: { value: string; number?: number } ) => any; /** * This event fires when the input is clicked.