wheredoesyourmindgo / react-mui-mapbox-geocoder

A Material UI Autosuggest'ing Mapbox Geocoder for locating addresses and points of interest.
MIT License
10 stars 4 forks source link

Improved documentation + new feature: callback onInputClear #63

Closed clementlize closed 1 year ago

clementlize commented 1 year ago

Hi there! It's me again, I made modifications that I'd like you to review and merge :)

  1. I improved documentation by reformatting the comments in MatGeocoder.tsx. When building, they now appear above the types in MatGeocoder.d.ts, and users can see them by hovering the property in their code. I also added a comment on the inputValue property to explain how it works.
  2. I added a new callback function to pass to the component via its props. It's called onInputClear and it is triggered whenever the input is cleared. It's directly binded to the value and prevValue variables so the event can be triggered either by clicking on the cross button, or else by backspacing until the field becomes empty. My team and I needed this for our project and we weren't able to detect that the field had been cleared. I think this could be useful for others too.

Thanks in advance, we can discuss here if you want more info / have remarks. Good day!

pcwa-ahendricks commented 1 year ago

Looks great. Thanks for the pull request.

clementlize commented 1 year ago

You're welcome, can you publish the new version on npm when you have time please? 😄