feat: introduce counterparts for ui-core form components#108
feat: introduce counterparts for ui-core form components#108HendrikThePendric merged 82 commits intomasterfrom
Conversation
# Conflicts: # yarn.lock
Moved to the `./.storybook` folder Switched to logging values directly, which is good for non-serializable things, such as File instances
- Stop using Toggle components to extract shared logic because it gets hard to reason about all these nested components - Implement shared hooks and propTypes to replace Toggle components - Update Checkbox/Switch(Group) to work with these shared hooks and proptypes - Remove `useOnChange` prop from FieldAdapter component, because this way of working is also hard to reason about - Refactor Checkbox and Switch to now implement onChange logic internally instead of delegating it to the FieldAdapter
- Throw an error if the payload cannot be processed - Make sure to check for the existence of properties instead of evaluating they are thruthy
|
One thing we should probably double check: the required prop has been removed from Switch, Checkbox and Radio in ui-core@4. We were talking above about the usefullness of a required single checkbox, switch, etc. Maybe it's not even possible with ui-core@4? And if so, why did the integration tests not catch this? |
I can understand the confusion when reading the release notes. That's because for the inputs, some of the functionality was moved from So, I have double checked this, and it is working as expected. |
Ah I see, that makes sense 👍 |
ghost
left a comment
There was a problem hiding this comment.
Left a couple of remarks. We could defer those until later, as we've done with other topics that were out of scope for these changes. Seems fine to merge to me 👍
# 1.0.0 (2020-02-13) ### Bug Fixes * **deps:** move @dhis2/props-types back to dependencies ([#156](#156)) ([9354cbc](9354cbc)) * **deps:** set dependencies provided by app-platform to peerDeps ([#152](#152)) ([db38005](db38005)) * force the optimize for speed flag for styled-jsx based on env ([5626711](5626711)) * force the optimize for speed flag for styled-jsx to true ([71183c1](71183c1)) * **conditional:** use render instead of onChange to have access to form ([615488d](615488d)) * **file:** show name of selected file ([d622b34](d622b34)) ### Features * add composeValidators & required and email validator functions ([9d6ec6a](9d6ec6a)) * add confitional HOC ([e677b7b](e677b7b)) * add File component ([308335f](308335f)) * add Form component & mutators ([2b0ba72](2b0ba72)) * add Radio and RadioGroup & update stories ([b93ce20](b93ce20)) * add required validator ([a7a5c37](a7a5c37)) * apply conditional HOC to File ([8559f28](8559f28)) * introduce counterparts for ui-core form components ([#108](#108)) ([9dbeb29](9dbeb29)), closes [#133](#133) [#134](#134) [#136](#136) [#146](#146) * synchronous validators ([#164](#164)) ([75cd2ea](75cd2ea)) * **conditional:** conditional as a regular component ([#16](#16)) ([8f6eae7](8f6eae7))
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
READY FOR REVIEW
Work that has been done
Some specific points of attention:
(resolved)FileInputis still a class component because I'd need anonRemovecallback on theFileListItems which are being mapped over. I believe hooks have some trouble in these type of scenarios. But I'd prefer to hook this component up too if possible.SwitchGroupandCheckboxGroupstories there are some examples of using our components being used in tandem withformat/parseprops on the field to produce different types of form data. I think this demonstrates (one of) the biggest advantages of using our inputs as value of thecomponentprop on the RFFFieldcomponent.Because switching to hooks simplified things quite a bit for me, I wonder if perhaps the(resolved)FieldAdaptershould be implemented as a hook too....Next steps
I have added this section firstly to inform about what I'm going to do once this is merged, but also to indicate that suggestions for improvements reg. the points above are regarded as out-of-scope (this PR already includes enough changes).
Implemented components
SwitchGroup(removed see feat: introduce counterparts for ui-core form components #108 (comment))