department-of-veterans-affairs / va-forms-system-core

VA Forms System Core will be a React library hosted in NPM that will allow engineers and designers to easily interact with Forms inside of vets-website.
https://department-of-veterans-affairs.github.io/va-forms-system-core/
6 stars 4 forks source link

Pass a custom function when onChange is triggered for a component #531

Closed taylorkaren closed 2 years ago

taylorkaren commented 2 years ago

Context

This comes from the 8/9/22 walkthrough session with Adam Whitlock (notes page).

Adam previously submitted a PR that added the ability to pass a custom function when onChange is triggered for the text field component.

This ticket is to look into passing a custom function when onChange is triggered for any component so that there is a way to do this in general for all components instead of addressing them one at a time.

Task Description

Considerations

Acceptance Criteria

harshil1793 commented 2 years ago

@micahchiang The email field is already using the TextField component so I believe we don't need to make any changes to Email field, right?

micahchiang commented 2 years ago

@harshil1793 - Users should be able to pass their own onChange handler to email field. Can they do that now? I see this is returned:

  return (
    <TextField
      id={id}
      {...props}
      onChange={field.onChange}
      value={value}
      onBlur={() => helpers.setTouched(true)}
    />

I think they need to be able to pass a handler as a prop to email field.

va-vsp-bot commented 2 years ago

:tada: This issue has been resolved in version 1.4.6 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: