hypothesis / frontend-shared

UI components and styles for Hypothesis front-end applications
https://patterns.hypothes.is
5 stars 2 forks source link

Expose Select and MultiSelect aliases for SelectNext #1619

Closed acelaya closed 1 month ago

acelaya commented 1 month ago

This PR exposes two new aliases for SelectNext, which are Select and MultiSelect. These two implicitly have multiple={false} and multiple={true} respectively, and do not allow the multiple prop to be provided.

This change serves two purposes:

I tried to find a solution to the type inference at pure types definition level, but didn't quite get it, even after making types more complex, so I think this option is better, specially taking into consideration to additional benefit explained above.

[!NOTE]
This PR is easier to review ignoring whitespaces.

TODO

Out of scope

We can probably replace all usages in this library of SelectNext with either Select or MultiSelect, as they will provide the same coverage, and promote their usage over SelectNext.

Additionally, we could even mark SelectNext as deprecated as a standalone component, and recommend using one of the other two.

All that will come in follow-up PRs, to avoid distractions from the new API being introduced here.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (e2e88a3) to head (12d8e14).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1619 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 62 62 Lines 1066 1071 +5 Branches 410 410 ========================================= + Hits 1066 1071 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.