digidem / react-mapfilter

Visualizing, exploring, filtering and printing geographic data and geotagged photos and video
https://lab.digital-democracy.org/mapfilter
29 stars 11 forks source link

Select Multiple component #101

Closed thibautRe closed 4 years ago

thibautRe commented 4 years ago

Fixes https://github.com/digidem/mapeo-desktop/issues/345

Overview

This adds a usable <SelectMultiple /> component. It is a thin wrapper above @material-ui/lab/Autocomplete that enables freeSolo (user can write anything) and multiple (enables "tag" UI).

digidem-selectmultiple

I also added an example of what SelectOne could be if it were to use Autocomplete. I noticed some specific logic related to how the options are being filtered in the current solution - I don't know if this is still relevant or not so I left the current component as is and exposed the new one under a SelectOnev2 name. It is available in the storybook if you want to test it for yourself.

Component API changes

okdistribute commented 4 years ago

Hi @thibautRe, this is amazing! Great work.

I talked to @gmaclennan and @jencastrodoesstuff, who works directly with our partners. We decided that we do want to retire the old SelectOne behavior. That custom solution was implemented before the new material UI components.

It would be ideal to be able to turn off freeSolo based upon the settings given on a per-project basis, which will be passed in through the presets. It should default to true.

Thanks so much! We can probably merge this soon, after a review from @gmaclennan

gmaclennan commented 4 years ago

Thanks so much for this @thibautRe! We have a couple of big funding proposals that we need to finalise this week and I am re-locating back home after being stuck away from home during lockdown, so I might not get to review this until the end of next week, but looks like great work!

thibautRe commented 4 years ago

Thank you for the feedback! @gmaclennan no worries for the delayed review, I'll try to improve the typings of the SelectMultiple component props, and retire the previous SelectOne's downshift component in the meantime.

okdistribute commented 4 years ago

Thanks @thibautRe!