Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SelectInput: explicitly declare props #119

Merged
merged 3 commits into from
Oct 2, 2018

Conversation

dferber90
Copy link
Contributor

@dferber90 dferber90 commented Oct 1, 2018

Summary

  • tightens API of SelectInput (drops support for currently unused props)
  • adapts story and docs to updated props
  • ensures values are shown in correct order
  • shortens the docs of statically exported components
  • moves SelectInput out of beta status

Details

So far we've been lax on the props we accept for SelectInput. We forwarded all props to react-select and just excluded the ones intended for SelectInput itself.

This has been good in the beginning when the usage of SelectInput was still unclear. Now that things have become more concrete, it's time to be stricter on the API.

This PR removes the generic pass-through of props and instead only forwards supported props. It also updates the documentation to mention all supported properties instead of referring to the react-select documentation.

In theory we should be able to replace react-select with any other implementation without having to touch the consumers. It is thus good to be explicit on the supported properties. This also makes it easier for consumers to see what we're supporting officially.

We can extend what SelectInput forwards to react-select in case any consumer ever needs to use a property supported by react-select but not currently forwarded by SelectInput.

Fix

The selected values had been shown in the order they appear in the options instead of the order they were selected in. This is quite confusing when using the component and so I changed it. They are now shown in the order they were selected in.

Note

This is a breaking change, but it should not affect the MC apps. I looked through the usages and the removed props were not used by any of our apps.

@dferber90 dferber90 requested review from pa3, islam3zzat and lufego October 1, 2018 15:51
@dferber90 dferber90 changed the title SelectInput: Explicitly declare props SelectInput: explicitly declare props Oct 1, 2018
Limits the props supported by SelectInput. Explicitly drops support for some props.

BREAKING CHANGE: removed support for some props, avoid blindly forwarding props. See commit for details.
id (prev: inputId): The id of the input element.

containerId (prev: id): The id of the search container.

BREAKING CHANGE: removed inputId prop, changed target of id prop.
@dferber90 dferber90 force-pushed the df-explicitly-delcare-react-select-props branch from cd1eda4 to ac0ddea Compare October 2, 2018 09:47
@dferber90 dferber90 merged commit 44189a6 into master Oct 2, 2018
@dferber90 dferber90 deleted the df-explicitly-delcare-react-select-props branch October 4, 2018 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💅 Type: Enhancement Improves existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants