-
Notifications
You must be signed in to change notification settings - Fork 130
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
Align API and styles of boolean inputs #2105
Conversation
🦋 Changeset detectedLatest commit: 5c0b401 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov Report
@@ Coverage Diff @@
## main #2105 +/- ##
==========================================
+ Coverage 92.04% 92.10% +0.05%
==========================================
Files 170 170
Lines 3571 3595 +24
Branches 1248 1266 +18
==========================================
+ Hits 3287 3311 +24
Misses 263 263
Partials 21 21
|
3df00f9
to
0106192
Compare
0106192
to
cd62e9c
Compare
cd62e9c
to
060892a
Compare
@@ -29,8 +29,7 @@ const baseStyles = () => css` | |||
display: block; | |||
color: var(--cui-fg-subtle); | |||
|
|||
// TODO: Remove the next line once the Selector component is wrapped in the FieldWrapper component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This component is no longer used in the Selector component.
@@ -186,7 +187,7 @@ const RadioButtonInput = styled('input')<InputElProps>( | |||
); | |||
|
|||
/** | |||
* RadioButton component for forms. | |||
* @deprecated Use the {@link RadioButtonGroup} component instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying out this new JSDoc syntax. In my editor it's just displayed as plain text, but ideally it links to the type definition of the RadioButtonGroup component.
@robinmetral Requesting an early review from you to get some feedback on the changes if you have time before you leave. The only thing missing are the rewritten/expanded unit tests. I plan to release a canary version of these changes to test that there are no inadvertent breaking changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really really like the improvements here!! Super nice to align component APIs, docs, stories. Thank you! 💯
Is this the one that you were thinking of releasing as a canary? While it looks fine to me I think it might be worth testing in an app before the stable release 🙂
- **Don not** rely on tooltips to explain a checkbox | ||
- **Do not** use commas or semicolons at the end of each line | ||
- **Do** accompany the checkbox with a descriptive label | ||
- **Do** write the label in a positive manner (e.g. _"Send me reports"_ instead of _"Do not send me reports"_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should review these with Frank at some point 😬 but fine to keep in here for now
Side note: I started to move away from the do/don't bullet points in some new docs (I usually moved the points to relevant sections, e.g. accessibility, or component variations). At some point it might make sense to rethink structure for the docs and make it consistent across components
packages/circuit-ui/components/RadioButtonGroup/RadioButtonGroup.mdx
Outdated
Show resolved
Hide resolved
Co-authored-by: Robin Métral <robin.metral@sumup.com>
5a29875
to
83bb776
Compare
Squashed commit of the following: * Clarify label docs * Add tests for empty options * Refactor test suite * Update packages/circuit-ui/components/CheckboxGroup/CheckboxGroup.mdx * Align options prop type * Only log deprecation warning outside group components * Revise the boolean input docs * Uncontrolled boolean inputs * Use field atoms in CheckboxGroup * Deprecate the RadioButton and Selector components * Align SelectorGroup with other boolean inputs
Addresses #1875.
Purpose
The Checkbox, RadioButton, and Selector components and their grouped variants provide a way for users to select one or multiple options from a predefined list. Conidering their similarities, it's surprising how inconsistent their user experience and APIs are.
This PR aims to align the components as much as possible without introducing breaking changes.
Approach and changes
options
prop. Added the ability to mark fields as optional using the newrequired
andoptionalLabel
props.react-hook-form
. Group props take precedence over option props. New props:defaultValue
,onBlur
.Definition of done