diff --git a/packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx b/packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx index 38e70fad421..33361b3f763 100644 --- a/packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx +++ b/packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx @@ -310,7 +310,7 @@ export const CalendarMonth = ({ aria-label={yearInputAriaLabel} type="number" value={yearFormatted} - onChange={(year: string, ev: React.FormEvent) => { + onChange={(ev: React.FormEvent, year: string) => { const newDate = new Date(focusedDate); newDate.setFullYear(+year); setFocusedDate(newDate); diff --git a/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx b/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx index 6414534d6ea..d772fdd298a 100644 --- a/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx +++ b/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx @@ -136,7 +136,7 @@ export class ClipboardCopy extends React.Component { + updateText = (event: React.FormEvent, text: string | number) => { this.setState({ text }); this.props.onChange(event, text); }; @@ -265,7 +265,7 @@ export class ClipboardCopy extends React.Component this.updateText(text, event)} + onChange={this.updateText} > {this.state.text} diff --git a/packages/react-core/src/components/DatePicker/DatePicker.tsx b/packages/react-core/src/components/DatePicker/DatePicker.tsx index f0a165a3125..4a3088512c4 100644 --- a/packages/react-core/src/components/DatePicker/DatePicker.tsx +++ b/packages/react-core/src/components/DatePicker/DatePicker.tsx @@ -140,7 +140,7 @@ const DatePickerBase = ( setErrorText(validators.map((validator) => validator(date)).join('\n') || ''); }; - const onTextInput = (value: string, event: React.FormEvent) => { + const onTextInput = (event: React.FormEvent, value: string) => { setValue(value); setErrorText(''); const newValueDate = dateParse(value); diff --git a/packages/react-core/src/components/Form/examples/FormBasic.tsx b/packages/react-core/src/components/Form/examples/FormBasic.tsx index c6d4a63c2c1..61d18071ee6 100644 --- a/packages/react-core/src/components/Form/examples/FormBasic.tsx +++ b/packages/react-core/src/components/Form/examples/FormBasic.tsx @@ -19,15 +19,15 @@ export const FormBasic: React.FunctionComponent = () => { const [email, setEmail] = React.useState(''); const [phone, setPhone] = React.useState(''); - const handleNameChange = (name: string) => { + const handleNameChange = (_event, name: string) => { setName(name); }; - const handleEmailChange = (email: string) => { + const handleEmailChange = (_event, email: string) => { setEmail(email); }; - const handlePhoneChange = (phone: string) => { + const handlePhoneChange = (_event, phone: string) => { setPhone(phone); }; diff --git a/packages/react-core/src/components/Form/examples/FormFieldGroups.tsx b/packages/react-core/src/components/Form/examples/FormFieldGroups.tsx index 535143537c7..5f8c1db0b39 100644 --- a/packages/react-core/src/components/Form/examples/FormFieldGroups.tsx +++ b/packages/react-core/src/components/Form/examples/FormFieldGroups.tsx @@ -38,7 +38,7 @@ export const FormFieldGroups: React.FunctionComponent = () => { const [inputValues, setInputValues] = React.useState(initialValues); - const handleChange = (value: string, event: React.FormEvent) => { + const handleChange = (event, value: string) => { const { name } = event.currentTarget; setInputValues({ ...inputValues, [name]: value }); }; diff --git a/packages/react-core/src/components/Form/examples/FormGrid.tsx b/packages/react-core/src/components/Form/examples/FormGrid.tsx index 1c66a9375e2..fd937405890 100644 --- a/packages/react-core/src/components/Form/examples/FormGrid.tsx +++ b/packages/react-core/src/components/Form/examples/FormGrid.tsx @@ -15,15 +15,15 @@ export const FormGrid: React.FunctionComponent = () => { const [email, setEmail] = React.useState(''); const [phone, setPhone] = React.useState(''); - const handleNameChange = (name: string) => { + const handleNameChange = (_event, name: string) => { setName(name); }; - const handleEmailChange = (email: string) => { + const handleEmailChange = (_event, email: string) => { setEmail(email); }; - const handlePhoneChange = (phone: string) => { + const handlePhoneChange = (_event, phone: string) => { setPhone(phone); }; diff --git a/packages/react-core/src/components/Form/examples/FormGroupLabelInfo.tsx b/packages/react-core/src/components/Form/examples/FormGroupLabelInfo.tsx index 80ad6605971..b63c4d5ca41 100644 --- a/packages/react-core/src/components/Form/examples/FormGroupLabelInfo.tsx +++ b/packages/react-core/src/components/Form/examples/FormGroupLabelInfo.tsx @@ -13,7 +13,7 @@ import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon'; export const FormGroupLabelInfo: React.FunctionComponent = () => { const [name, setName] = React.useState(''); - const handleNameChange = (name: string, _event: React.FormEvent) => { + const handleNameChange = (_event, name: string) => { setName(name); }; diff --git a/packages/react-core/src/components/Form/examples/FormHorizontal.tsx b/packages/react-core/src/components/Form/examples/FormHorizontal.tsx index 9c7eb8dc65b..b8d4b13c60c 100644 --- a/packages/react-core/src/components/Form/examples/FormHorizontal.tsx +++ b/packages/react-core/src/components/Form/examples/FormHorizontal.tsx @@ -21,11 +21,11 @@ export const FormHorizontal: React.FunctionComponent = () => { const [experience, setExperience] = React.useState(''); const [option, setOption] = React.useState('please choose'); - const handleNameChange = (name: string) => { + const handleNameChange = (_event, name: string) => { setName(name); }; - const handleEmailChange = (email: string) => { + const handleEmailChange = (_event, email: string) => { setEmail(email); }; diff --git a/packages/react-core/src/components/Form/examples/FormInvalid.tsx b/packages/react-core/src/components/Form/examples/FormInvalid.tsx index 12847e1b0d4..23bbab072d7 100644 --- a/packages/react-core/src/components/Form/examples/FormInvalid.tsx +++ b/packages/react-core/src/components/Form/examples/FormInvalid.tsx @@ -8,7 +8,7 @@ export const FormInvalid: React.FunctionComponent = () => { const [age, setAge] = React.useState('Five'); const [validated, setValidated] = React.useState('error'); - const handleAgeChange = (age: string, _event: React.FormEvent) => { + const handleAgeChange = (_event, age: string) => { setAge(age); if (age === '') { setValidated('default'); diff --git a/packages/react-core/src/components/Form/examples/FormInvalidWithFormAlert.tsx b/packages/react-core/src/components/Form/examples/FormInvalidWithFormAlert.tsx index 00347c1193a..aba3441b39e 100644 --- a/packages/react-core/src/components/Form/examples/FormInvalidWithFormAlert.tsx +++ b/packages/react-core/src/components/Form/examples/FormInvalidWithFormAlert.tsx @@ -17,7 +17,7 @@ export const FormInvalidWithAlert: React.FunctionComponent = () => { const [age, setAge] = React.useState('Five'); const [validated, setValidated] = React.useState('error'); - const handleAgeChange = (age: string, _event: React.FormEvent) => { + const handleAgeChange = (_event, age: string) => { setAge(age); if (age === '') { setValidated('default'); diff --git a/packages/react-core/src/components/Form/examples/FormLimitWidth.tsx b/packages/react-core/src/components/Form/examples/FormLimitWidth.tsx index dfb9b71d758..83d79a30caf 100644 --- a/packages/react-core/src/components/Form/examples/FormLimitWidth.tsx +++ b/packages/react-core/src/components/Form/examples/FormLimitWidth.tsx @@ -19,15 +19,15 @@ export const FormLimitWidth: React.FunctionComponent = () => { const [email, setEmail] = React.useState(''); const [phone, setPhone] = React.useState(''); - const handleNameChange = (name: string) => { + const handleNameChange = (_event, name: string) => { setName(name); }; - const handleEmailChange = (email: string) => { + const handleEmailChange = (_event, email: string) => { setEmail(email); }; - const handlePhoneChange = (phone: string) => { + const handlePhoneChange = (_event, phone: string) => { setPhone(phone); }; diff --git a/packages/react-core/src/components/Form/examples/FormSections.tsx b/packages/react-core/src/components/Form/examples/FormSections.tsx index f780e43ceee..b6c195f121d 100644 --- a/packages/react-core/src/components/Form/examples/FormSections.tsx +++ b/packages/react-core/src/components/Form/examples/FormSections.tsx @@ -5,11 +5,11 @@ export const FormSections: React.FunctionComponent = () => { const [input1, setInput1] = React.useState(''); const [input2, setInput2] = React.useState(''); - const handleInputChange1 = (input1: string, _event: React.FormEvent) => { + const handleInputChange1 = (_event, input1: string) => { setInput1(input1); }; - const handleInputChange2 = (input2: string, _event: React.FormEvent) => { + const handleInputChange2 = (_event, input2: string) => { setInput2(input2); }; diff --git a/packages/react-core/src/components/Form/examples/FormState.tsx b/packages/react-core/src/components/Form/examples/FormState.tsx index 2c352b50a40..c36b120b8c2 100644 --- a/packages/react-core/src/components/Form/examples/FormState.tsx +++ b/packages/react-core/src/components/Form/examples/FormState.tsx @@ -31,7 +31,7 @@ export const FormState = () => { { + onChange={(_event, value) => { setValue('input-id', value); setError('input-id', undefined); }} diff --git a/packages/react-core/src/components/Form/examples/FormValidated.tsx b/packages/react-core/src/components/Form/examples/FormValidated.tsx index ac8987676d7..19991464371 100644 --- a/packages/react-core/src/components/Form/examples/FormValidated.tsx +++ b/packages/react-core/src/components/Form/examples/FormValidated.tsx @@ -9,7 +9,7 @@ export const FormValidated: React.FunctionComponent = () => { const [validated, setValidated] = React.useState('default'); const [helperText, setHelperText] = React.useState('Enter your age to continue'); - const handleAgeChange = (age: string, _event: React.FormEvent) => { + const handleAgeChange = (_event, age: string) => { setAge(age); setValidated('default'); setHelperText('Validating...'); diff --git a/packages/react-core/src/components/LabelGroup/examples/LabelGroupEditableAddModal.tsx b/packages/react-core/src/components/LabelGroup/examples/LabelGroupEditableAddModal.tsx index 71d21b4ba32..e2946e748e0 100644 --- a/packages/react-core/src/components/LabelGroup/examples/LabelGroupEditableAddModal.tsx +++ b/packages/react-core/src/components/LabelGroup/examples/LabelGroupEditableAddModal.tsx @@ -276,7 +276,7 @@ export const LabelGroupEditableAddModal: React.FunctionComponent = () => { id="create-label-form-label-text" name="create-label-form-label-text" value={labelText} - onChange={setLabelText} + onChange={(_event: React.FormEvent, value: string) => setLabelText(value)} ref={labelInputRef} /> diff --git a/packages/react-core/src/components/LoginPage/LoginForm.tsx b/packages/react-core/src/components/LoginPage/LoginForm.tsx index 39fd0712989..a014682ffb4 100644 --- a/packages/react-core/src/components/LoginPage/LoginForm.tsx +++ b/packages/react-core/src/components/LoginPage/LoginForm.tsx @@ -91,7 +91,7 @@ export const LoginForm: React.FunctionComponent = ({ name="pf-login-password-id" validated={isValidPassword ? ValidatedOptions.default : ValidatedOptions.error} value={passwordValue} - onChange={onChangePassword} + onChange={(event, value) => onChangePassword(value, event)} /> ); @@ -115,7 +115,7 @@ export const LoginForm: React.FunctionComponent = ({ type="text" name="pf-login-username-id" value={usernameValue} - onChange={onChangeUsername} + onChange={(event, value) => onChangeUsername(value, event)} /> diff --git a/packages/react-core/src/components/Modal/examples/ModalWithForm.tsx b/packages/react-core/src/components/Modal/examples/ModalWithForm.tsx index daad00d2c35..5398755371a 100644 --- a/packages/react-core/src/components/Modal/examples/ModalWithForm.tsx +++ b/packages/react-core/src/components/Modal/examples/ModalWithForm.tsx @@ -12,14 +12,14 @@ export const ModalWithForm: React.FunctionComponent = () => { setModalOpen(!isModalOpen); }; - const handleNameInputChange = (value: string) => { + const handleNameInputChange = (_event, value: string) => { setNameValue(value); }; - const handleEmailInputChange = (value: string) => { + const handleEmailInputChange = (_event, value: string) => { setEmailValue(value); }; - const handleAddressInputChange = (value: string) => { + const handleAddressInputChange = (_event, value: string) => { setAddressValue(value); }; diff --git a/packages/react-core/src/components/NumberInput/NumberInput.tsx b/packages/react-core/src/components/NumberInput/NumberInput.tsx index d4d3ed43954..c9e05186f54 100644 --- a/packages/react-core/src/components/NumberInput/NumberInput.tsx +++ b/packages/react-core/src/components/NumberInput/NumberInput.tsx @@ -134,7 +134,7 @@ export const NumberInput: React.FunctionComponent = ({ name={inputName} aria-label={inputAriaLabel} {...(isDisabled && { isDisabled })} - {...(onChange && { onChange: (value, event) => onChange(event) })} + {...(onChange && { onChange: (event, _value) => onChange(event) })} onBlur={handleBlur} {...(!onChange && { isReadOnly: true })} onKeyDown={keyDownHandler} diff --git a/packages/react-core/src/components/SearchInput/AdvancedSearchMenu.tsx b/packages/react-core/src/components/SearchInput/AdvancedSearchMenu.tsx index b1f603e0592..6512163b5e8 100644 --- a/packages/react-core/src/components/SearchInput/AdvancedSearchMenu.tsx +++ b/packages/react-core/src/components/SearchInput/AdvancedSearchMenu.tsx @@ -172,7 +172,7 @@ export const AdvancedSearchMenu: React.FunctionComponent handleValueChange(queryAttr, value, evt)} + onChange={(evt, value) => handleValueChange(queryAttr, value, evt)} /> ); @@ -183,7 +183,7 @@ export const AdvancedSearchMenu: React.FunctionComponent handleValueChange(queryAttr, value, evt)} + onChange={(evt, value) => handleValueChange(queryAttr, value, evt)} /> ); @@ -197,7 +197,7 @@ export const AdvancedSearchMenu: React.FunctionComponent handleValueChange('haswords', value, evt)} + onChange={(evt, value) => handleValueChange('haswords', value, evt)} /> )} diff --git a/packages/react-core/src/components/Slider/Slider.tsx b/packages/react-core/src/components/Slider/Slider.tsx index 733fb3608d2..6c77ac443e5 100644 --- a/packages/react-core/src/components/Slider/Slider.tsx +++ b/packages/react-core/src/components/Slider/Slider.tsx @@ -131,7 +131,7 @@ export const Slider: React.FunctionComponent = ({ const widthChars = React.useMemo(() => localInputValue.toString().length, [localInputValue]); const inputStyle = { '--pf-c-slider__value--c-form-control--width-chars': widthChars } as React.CSSProperties; - const onChangeHandler = (value: string) => { + const onChangeHandler = (_event: React.FormEvent, value: string) => { setLocalInputValue(Number(value)); }; diff --git a/packages/react-core/src/components/TextInput/TextInput.tsx b/packages/react-core/src/components/TextInput/TextInput.tsx index b018adec1e9..8df0e0200fe 100644 --- a/packages/react-core/src/components/TextInput/TextInput.tsx +++ b/packages/react-core/src/components/TextInput/TextInput.tsx @@ -25,6 +25,7 @@ export enum TextInputReadOnlyVariant { plain = 'plain' } + export interface TextInputProps extends Omit, 'onChange' | 'onFocus' | 'onBlur' | 'disabled' | 'ref'>, OUIAProps { @@ -43,7 +44,7 @@ export interface TextInputProps */ validated?: 'success' | 'warning' | 'error' | 'default'; /** A callback for when the text input value changes. */ - onChange?: (value: string, event: React.FormEvent) => void; + onChange?: (event: React.FormEvent, value: string) => void; /** Type that the text input accepts. */ type?: | 'text' @@ -118,7 +119,7 @@ export class TextInputBase extends React.Component) => { if (this.props.onChange) { - this.props.onChange(event.currentTarget.value, event); + this.props.onChange(event, event.currentTarget.value); } }; diff --git a/packages/react-core/src/components/TextInput/__tests__/TextInput.test.tsx b/packages/react-core/src/components/TextInput/__tests__/TextInput.test.tsx index 812e1a36702..914f3cacac1 100644 --- a/packages/react-core/src/components/TextInput/__tests__/TextInput.test.tsx +++ b/packages/react-core/src/components/TextInput/__tests__/TextInput.test.tsx @@ -18,7 +18,7 @@ describe('TextInput', () => { render(); await user.type(screen.getByLabelText('test input'), 'a'); - expect(props.onChange).toHaveBeenCalledWith('a', expect.any(Object)); + expect(props.onChange).toHaveBeenCalledWith(expect.any(Object), 'a'); }); test('simple text input', () => { diff --git a/packages/react-core/src/components/TextInput/examples/TextInputBasic.tsx b/packages/react-core/src/components/TextInput/examples/TextInputBasic.tsx index 5fdefea7b9d..25ef9a5f592 100644 --- a/packages/react-core/src/components/TextInput/examples/TextInputBasic.tsx +++ b/packages/react-core/src/components/TextInput/examples/TextInputBasic.tsx @@ -3,5 +3,5 @@ import { TextInput } from '@patternfly/react-core'; export const TextInputBasic: React.FunctionComponent = () => { const [value, setValue] = React.useState(''); - return setValue(value)} aria-label="text input example" />; + return setValue(value)} aria-label="text input example" />; }; diff --git a/packages/react-core/src/components/TextInput/examples/TextInputIcon.tsx b/packages/react-core/src/components/TextInput/examples/TextInputIcon.tsx index 4ac710553fe..fa16412715e 100644 --- a/packages/react-core/src/components/TextInput/examples/TextInputIcon.tsx +++ b/packages/react-core/src/components/TextInput/examples/TextInputIcon.tsx @@ -12,7 +12,7 @@ export const TextInputIcon: React.FunctionComponent = () => { value={calendar} type="text" iconVariant="calendar" - onChange={value => setCalendar(value)} + onChange={(_event, value) => setCalendar(value)} aria-label="text input example" />
@@ -21,7 +21,7 @@ export const TextInputIcon: React.FunctionComponent = () => { value={clock} type="text" iconVariant="clock" - onChange={value => setClock(value)} + onChange={(_event, value) => setClock(value)} aria-label="text input example" />
@@ -31,7 +31,7 @@ export const TextInputIcon: React.FunctionComponent = () => { type="text" customIconDimensions="24px 24px" customIconUrl='data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"%3E%3Cpath fill="%23a18fff" d="M158.87.15c-16.16-1.52-31.2 8.42-35.33 24.12l-14.81 56.27c187.62 5.49 314.54 130.61 322.48 317l56.94-15.78c15.72-4.36 25.49-19.68 23.62-35.9C490.89 165.08 340.78 17.32 158.87.15zm-58.47 112L.55 491.64a16.21 16.21 0 0 0 20 19.75l379-105.1c-4.27-174.89-123.08-292.14-299.15-294.1zM128 416a32 32 0 1 1 32-32 32 32 0 0 1-32 32zm48-152a32 32 0 1 1 32-32 32 32 0 0 1-32 32zm104 104a32 32 0 1 1 32-32 32 32 0 0 1-32 32z"/%3E%3C/svg%3E' - onChange={value => setCustom(value)} + onChange={(_event, value) => setCustom(value)} aria-label="text input example" /> diff --git a/packages/react-core/src/components/TextInput/examples/TextInputIconSprite.tsx b/packages/react-core/src/components/TextInput/examples/TextInputIconSprite.tsx index 89b39fc6406..a8f72af2939 100644 --- a/packages/react-core/src/components/TextInput/examples/TextInputIconSprite.tsx +++ b/packages/react-core/src/components/TextInput/examples/TextInputIconSprite.tsx @@ -15,7 +15,7 @@ export const TextInputIconSprite: React.FunctionComponent = () => { validated={'success'} isIconSprite type="text" - onChange={value => setSuccess(value)} + onChange={(_event, value) => setSuccess(value)} aria-label="success icon sprite text input example" />
@@ -25,7 +25,7 @@ export const TextInputIconSprite: React.FunctionComponent = () => { validated={'warning'} isIconSprite type="text" - onChange={value => setWarning(value)} + onChange={(_event, value) => setWarning(value)} aria-label="warning icon sprite text input example" />
@@ -35,7 +35,7 @@ export const TextInputIconSprite: React.FunctionComponent = () => { validated={'error'} isIconSprite type="text" - onChange={value => setError(value)} + onChange={(_event, value) => setError(value)} aria-label="error icon sprite text input example" />
@@ -45,7 +45,7 @@ export const TextInputIconSprite: React.FunctionComponent = () => { isIconSprite type="text" iconVariant="calendar" - onChange={value => setCalendar(value)} + onChange={(_event, value) => setCalendar(value)} aria-label="calendar icon sprite text input example" />
@@ -55,7 +55,7 @@ export const TextInputIconSprite: React.FunctionComponent = () => { isIconSprite type="text" iconVariant="clock" - onChange={value => setClock(value)} + onChange={(_event, value) => setClock(value)} aria-label="clock icon sprite text input example" /> diff --git a/packages/react-core/src/components/TextInput/examples/TextInputInvalid.tsx b/packages/react-core/src/components/TextInput/examples/TextInputInvalid.tsx index b76a0e78463..f30e8495013 100644 --- a/packages/react-core/src/components/TextInput/examples/TextInputInvalid.tsx +++ b/packages/react-core/src/components/TextInput/examples/TextInputInvalid.tsx @@ -6,7 +6,7 @@ export const TextInputInvalid: React.FunctionComponent = () => { return ( setValue(value)} + onChange={(_event, value) => setValue(value)} isRequired validated={ValidatedOptions.error} type="text" diff --git a/packages/react-core/src/components/TextInput/examples/TextInputLeftTruncated.tsx b/packages/react-core/src/components/TextInput/examples/TextInputLeftTruncated.tsx index e1c9ab72b99..a85edc91b0a 100644 --- a/packages/react-core/src/components/TextInput/examples/TextInputLeftTruncated.tsx +++ b/packages/react-core/src/components/TextInput/examples/TextInputLeftTruncated.tsx @@ -10,7 +10,7 @@ export const LeftTruncatedTextInput: React.FunctionComponent = () => { isLeftTruncated value={value} type="text" - onChange={value => setValue(value)} + onChange={(_event, value) => setValue(value)} aria-label="left-truncated text input example" /> ); diff --git a/packages/react-core/src/components/TextInput/examples/TextInputSelectUsingRef.tsx b/packages/react-core/src/components/TextInput/examples/TextInputSelectUsingRef.tsx index b5bf30d7aa3..3bc8ae757a4 100644 --- a/packages/react-core/src/components/TextInput/examples/TextInputSelectUsingRef.tsx +++ b/packages/react-core/src/components/TextInput/examples/TextInputSelectUsingRef.tsx @@ -9,7 +9,7 @@ export const TextInputSelectUsingRef: React.FunctionComponent = () => { ref={ref} value={value} onFocus={() => ref?.current?.select()} - onChange={value => setValue(value)} + onChange={(_event, value) => setValue(value)} aria-label="select-all" /> ); diff --git a/packages/react-core/src/components/TimePicker/TimePicker.tsx b/packages/react-core/src/components/TimePicker/TimePicker.tsx index 9996550f117..8ade50b1436 100644 --- a/packages/react-core/src/components/TimePicker/TimePicker.tsx +++ b/packages/react-core/src/components/TimePicker/TimePicker.tsx @@ -406,7 +406,7 @@ export class TimePicker extends React.Component) => { + onInputChange = (event: React.FormEvent, newTime: string) => { const { onChange } = this.props; const { timeRegex } = this.state; if (onChange) { diff --git a/packages/react-core/src/components/Tooltip/examples/TooltipOptions.tsx b/packages/react-core/src/components/Tooltip/examples/TooltipOptions.tsx index b7c75663cec..ea010b2e216 100644 --- a/packages/react-core/src/components/Tooltip/examples/TooltipOptions.tsx +++ b/packages/react-core/src/components/Tooltip/examples/TooltipOptions.tsx @@ -149,21 +149,21 @@ export const TooltipOptions: React.FunctionComponent = () => { setEntryDelayInput(Number(val))} + onChange={(_event, val) => setEntryDelayInput(Number(val))} aria-label="entry delay" /> Exit delay (ms){' '} setExitDelayInput(Number(val))} + onChange={(_event, val) => setExitDelayInput(Number(val))} aria-label="exit delay" /> Animation duration (ms){' '} setAnimationDuration(Number(val))} + onChange={(_event, val) => setAnimationDuration(Number(val))} aria-label="animation duration" /> diff --git a/packages/react-core/src/components/Wizard/examples/WizardEnabledOnFormValidation.tsx b/packages/react-core/src/components/Wizard/examples/WizardEnabledOnFormValidation.tsx index 06f9f7cc507..2de46234ea4 100644 --- a/packages/react-core/src/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +++ b/packages/react-core/src/components/Wizard/examples/WizardEnabledOnFormValidation.tsx @@ -12,7 +12,7 @@ interface SampleFormProps { const SampleForm: React.FunctionComponent = ({ value, isValid, setValue, setIsValid }) => { const validated = isValid ? 'default' : 'error'; - const handleTextInputChange = (value: string) => { + const handleTextInputChange = (_event, value: string) => { const isValid = /^\d+$/.test(value); setValue(value); diff --git a/packages/react-core/src/components/Wizard/examples/WizardValidateOnButtonPress.tsx b/packages/react-core/src/components/Wizard/examples/WizardValidateOnButtonPress.tsx index 6277a61954d..8f1d824304a 100644 --- a/packages/react-core/src/components/Wizard/examples/WizardValidateOnButtonPress.tsx +++ b/packages/react-core/src/components/Wizard/examples/WizardValidateOnButtonPress.tsx @@ -115,7 +115,7 @@ interface SampleFormProps { const SampleForm: React.FunctionComponent = ({ value, isValid, setValue, setIsValid }) => { const validated = isValid ? 'default' : 'error'; - const handleTextInputChange = (value: string) => { + const handleTextInputChange = (_event, value: string) => { const isValid = /^\d+$/.test(value); setValue(value); diff --git a/packages/react-core/src/demos/PasswordGenerator.md b/packages/react-core/src/demos/PasswordGenerator.md index 4603e9c8f3b..3beb06cb79f 100644 --- a/packages/react-core/src/demos/PasswordGenerator.md +++ b/packages/react-core/src/demos/PasswordGenerator.md @@ -54,7 +54,7 @@ const PasswordGenerator: React.FunctionComponent = () => { }; }, [isAutocompleteOpen, searchInputRef.current]); - const onChange = (newValue: string) => { + const onChange = (_event: React.FormEvent, newValue: string) => { if (searchInputRef && searchInputRef.current && searchInputRef.current.contains(document.activeElement)) { setIsAutocompleteOpen(true); } else { diff --git a/packages/react-core/src/demos/examples/HelperText/HelperTextDynamicVariantStaticText.tsx b/packages/react-core/src/demos/examples/HelperText/HelperTextDynamicVariantStaticText.tsx index 44e94433e88..127959f66d6 100644 --- a/packages/react-core/src/demos/examples/HelperText/HelperTextDynamicVariantStaticText.tsx +++ b/packages/react-core/src/demos/examples/HelperText/HelperTextDynamicVariantStaticText.tsx @@ -36,7 +36,7 @@ export const HelperTextDynamicVariantDynamicText: React.FunctionComponent = () = setInputValidation({ ruleLength: lengthStatus, ruleCharacterTypes: typeStatus }); }, [value, ruleLength, ruleCharacterTypes]); - const handleInputChange = (inputValue: string) => { + const handleInputChange = (_event, inputValue: string) => { setValue(inputValue); }; diff --git a/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantDynamicText.tsx b/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantDynamicText.tsx index 3d8283834ac..d191a20b43a 100644 --- a/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantDynamicText.tsx +++ b/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantDynamicText.tsx @@ -5,7 +5,7 @@ export const HelperTextStaticVariantDynamicText: React.FunctionComponent = () => const [value, setValue] = React.useState(''); const [inputValidation, setInputValidation] = React.useState('default'); - const handleInputChange = (inputValue: string) => { + const handleInputChange = (_event, inputValue: string) => { setValue(inputValue); }; diff --git a/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantStaticText.tsx b/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantStaticText.tsx index efd75d31612..a351be55e54 100644 --- a/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantStaticText.tsx +++ b/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantStaticText.tsx @@ -4,7 +4,7 @@ import { Form, FormGroup, FormHelperText, TextInput, HelperText, HelperTextItem export const HelperTextStaticVariantStaticText: React.FunctionComponent = () => { const [value, setValue] = React.useState(''); - const handleInputChange = (inputValue: string) => { + const handleInputChange = (_event, inputValue: string) => { setValue(inputValue); }; diff --git a/packages/react-core/src/deprecated/components/Wizard/examples/WizardEnabledOnFormValidation.tsx b/packages/react-core/src/deprecated/components/Wizard/examples/WizardEnabledOnFormValidation.tsx index 349ba669c48..ec3473a668f 100644 --- a/packages/react-core/src/deprecated/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +++ b/packages/react-core/src/deprecated/components/Wizard/examples/WizardEnabledOnFormValidation.tsx @@ -16,7 +16,7 @@ const SampleForm: React.FunctionComponent = (props: sampleFormP const [value, setValue] = React.useState(props.formValue); const [isValid, setIsValid] = React.useState(props.isFormValid); - const handleTextInputChange = (value: string) => { + const handleTextInputChange = (_event, value: string) => { const valid = /^\d+$/.test(value); setValue(value); setIsValid(valid); diff --git a/packages/react-core/src/deprecated/components/Wizard/examples/WizardValidateOnButtonPress.tsx b/packages/react-core/src/deprecated/components/Wizard/examples/WizardValidateOnButtonPress.tsx index d08d289d20c..9ad028ef3dd 100644 --- a/packages/react-core/src/deprecated/components/Wizard/examples/WizardValidateOnButtonPress.tsx +++ b/packages/react-core/src/deprecated/components/Wizard/examples/WizardValidateOnButtonPress.tsx @@ -82,7 +82,7 @@ const SampleForm: React.FunctionComponent = (props: sampleFormP const [value, setValue] = React.useState(props.formValue); const [isValid, setIsValid] = React.useState(props.isFormValid); - const handleTextInputChange = (value: string) => { + const handleTextInputChange = (_event, value: string) => { const valid = /^\d+$/.test(value); setValue(value); setIsValid(valid); diff --git a/packages/react-integration/demo-app-ts/src/components/demos/FormDemo/FormDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/FormDemo/FormDemo.tsx index e44a1c4781b..7b77a572fd5 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/FormDemo/FormDemo.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/FormDemo/FormDemo.tsx @@ -47,10 +47,10 @@ export class FormDemo extends Component { this.handleCheckboxChange = this.handleCheckboxChange.bind(this); } - handleTextInputChange = (value: string) => { + handleTextInputChange = (_event: React.FormEvent, value: string) => { this.setState({ value, isValid: /^\d+$/.test(value) }); }; - handleValidatedTextInputChange = (value: string) => { + handleValidatedTextInputChange = (_event: React.FormEvent, value: string) => { let validated = ValidatedOptions.default; if (value.length === 0) { validated = ValidatedOptions.warning; diff --git a/packages/react-integration/demo-app-ts/src/components/demos/TextInputDemo/TextInputDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/TextInputDemo/TextInputDemo.tsx index 2d20b20b74c..b7c4e0dedca 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/TextInputDemo/TextInputDemo.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/TextInputDemo/TextInputDemo.tsx @@ -13,11 +13,11 @@ export class TextInputDemo extends Component { ref = React.createRef(); - handleTextInputChange = (value: string) => { + handleTextInputChange = (_event: React.FormEvent, value: string) => { this.setState({ value }); }; - handleValidatedTextInputChange = (value: string) => { + handleValidatedTextInputChange = (_event: React.FormEvent, value: string) => { // If the text input contains less than 5 characters, set validated to error. If empty set to warning. let validated = ValidatedOptions.default; if (value.length === 0) { @@ -28,11 +28,11 @@ export class TextInputDemo extends Component { this.setState({ validatedTextInputValue: value, validated }); }; - handleLeftTruncatedTextInputChange = (leftTruncatedTextInputValue: string) => { + handleLeftTruncatedTextInputChange = (_event: React.FormEvent, leftTruncatedTextInputValue: string) => { this.setState({ leftTruncatedTextInputValue }); }; - handleTextUsingRefInputChange = (selectTextUsingRefValue: string) => { + handleTextUsingRefInputChange = (_event: React.FormEvent, selectTextUsingRefValue: string) => { this.setState({ selectTextUsingRefValue }); }; diff --git a/packages/react-integration/demo-app-ts/src/components/demos/ToolbarDemo/ToolbarDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/ToolbarDemo/ToolbarDemo.tsx index fb776886659..ae7370676cd 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/ToolbarDemo/ToolbarDemo.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/ToolbarDemo/ToolbarDemo.tsx @@ -72,7 +72,7 @@ export class ToolbarDemo extends React.Component { })); }; - onInputChange = (newValue: string) => { + onInputChange = (_event: React.FormEvent, newValue: string) => { this.setState({ inputValue: newValue }); }; diff --git a/packages/react-table/src/components/Table/EditableTextCell.tsx b/packages/react-table/src/components/Table/EditableTextCell.tsx index fb35ed1fbfc..3f21092df1b 100644 --- a/packages/react-table/src/components/Table/EditableTextCell.tsx +++ b/packages/react-table/src/components/Table/EditableTextCell.tsx @@ -44,7 +44,7 @@ export const EditableTextCell: React.FunctionComponent = ({ value={props.editableValue !== undefined ? props.editableValue : value} validated={props.isValid !== false ? 'default' : 'error'} type="text" - onChange={(newValue, event) => { + onChange={(event, newValue) => { handleTextInputChange(newValue, event, rowIndex, cellIndex); }} aria-label={inputAriaLabel}