Conversation
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
|
@HendrikThePendric The multi select feature failed, it does not fail locally. I assume that's another issue with the |
Yeah I think we need to take another look at the select in general. I've added an issue for this here: #64. |
Oh man 🤦 that's very unfortunate. It's not really an issue with |
It's weird, I tried rerunning the integration tests, but now they're failing completely: |
|
I've had a quick attempt at reviewing these PRs but I got the distinct impression that the vast majority was just a matter of moving things around. @Mohammer5 would it be possible to indicate where you have actually changed an existing implementation? |
|
yeah, so most work has bee done on functions that use the value of the
If you want to, we could schedule a meeting where I go over what's changed @HendrikThePendric @ismay |
HendrikThePendric
left a comment
There was a problem hiding this comment.
This is looking very good. Only thing I am a little worried about is the way we work with custom options. I've left a suggestion for changing that.
| @@ -75,9 +64,9 @@ export const multiSelectedPropType = propTypes.arrayOf(singleSelectedPropType) | |||
| * rest of the library | |||
| */ | |||
| export const Transfer = ({ | |||
There was a problem hiding this comment.
I've been thinking about rendering custom options and how we could stay a little bit more consistent here with other components that may require customisation. It's quite difficult to come up with something that is exactly the same, since this options prop pattern is fundamentally different than the children pattern we use elsewhere. After chatting a little bit with @ismay I came up with an idea (not sure whether Ismay will fully agree).
I'll place a few comments in the component code to list the changes I'd like to suggest.
| leftFooter, | ||
| leftHeader, | ||
| maxSelections, | ||
| optionComponent: TransferOption, |
There was a problem hiding this comment.
change to an optional prop called renderOption of type function
| const Option = option.component || TransferOption | ||
| const highlighted = !!highlightedSourceOptions.find( | ||
| highlightedSourceOption => | ||
| highlightedSourceOption === option.value | ||
| ) | ||
|
|
||
| return ( | ||
| <Option | ||
| key={option.value} | ||
| disabled={option.disabled} | ||
| option={option} | ||
| highlighted={highlighted} | ||
| {...getOptionClickHandlers( | ||
| option, | ||
| selectSingleOption, | ||
| toggleHighlightedSourceOption | ||
| )} | ||
| /> | ||
| ) |
There was a problem hiding this comment.
Change this part to this
const renderFn = option.render || renderOption
const optionProps = {
disabled: option.disabled,
option: option,
highlighted: !!highlightedSourceOptions.find(
highlightedSourceOption =>
highlightedSourceOption === option.value
),
...getOptionClickHandlers(
option,
selectSingleOption,
toggleHighlightedSourceOption
),
}
return typeof renderFn === 'function' ? (
renderFn(optionProps)
) : (
<TransferOption {...optionProps} />
)| propTypes.shape({ | ||
| label: propTypes.string.isRequired, | ||
| value: propTypes.string.isRequired, | ||
| component: propTypes.func, |
There was a problem hiding this comment.
change to render
| leftFooter: propTypes.node, | ||
| leftHeader: propTypes.node, | ||
| maxSelections: propTypes.oneOf([1, Infinity]), | ||
| optionComponent: propTypes.func, |
There was a problem hiding this comment.
change to renderOption
|
@HendrikThePendric and I talked a bit about this. In general we're thinking of the same thing, though my preference would be a slightly more conservative approach. In pseudo code I'm thinking of: // Allow the user to override the default option rendering
renderOption = option.renderOption || defaultOptionRenderer
// ...
// option rendering just maps over all the options,
// and calls renderOption with the args needed for rendering options
// renderOption is expected to return (react) renderable content
options.map(option => {
renderOption({ option, etc. })
})So what I'm omitting compared to @HendrikThePendric's approach is allowing the render prop on an option in the options array. the way I see it, you can already implement everything you want in the |
|
We also briefly discussed the option of adhering to the |
Yeah that'd be nice 👍. If we can align on everything tomorrow then we could maybe finish up the remaining tasks for v5 this week. |
|
I've introduced this the way @ismay proposed because there's a performance implication. The prop should either always expect a component or a function. I've removed the custom option functionality from the individual option items as that can be done through the |
This commit does several things: * Use strings as selected values * Use strings to store which options are highlighted * Removes jest test abstractions * Simplifies internal names * Replaces `common.js` files with files whose names match their content * Moves the Transfer component from `core` to `widgets` * Adds the `.js` extension to all import statements where applicable * Provides the correct `disabled` & `dataTest` props to the re-order up button's icon BREAKING CHANGE: The Transfer component now expects strings as selected values instead of option objects. BREAKING CHANGE: The Transfer component is now part of `widgets`
|
🎉 This PR is included in version 5.0.0-alpha.20 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 5.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |


Fixes #50
This commit does several things:
common.jsfiles with files whose names match their contentcoretowidgets.jsextension to all import statements where applicabledisabled&dataTestprops to the re-order upbutton's icon
BREAKING CHANGE: The Transfer component now expects options to be passed in as objects, not as children. Custom components can be provided via the
optionComponentprop for all options or via thecomponentproperty on an individual option.BREAKING CHANGE: The Transfer component now expects strings as selected
values instead of option objects.
BREAKING CHANGE: The Transfer component is now part of
widgets