-
Notifications
You must be signed in to change notification settings - Fork 1k
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
USWDS - Input: Move input width classes out of usa-form package #6232
Conversation
- remove overriding max-width style on usa-input, usa-input group - minimize impact on range and select
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.
question: Is this the best location for this file?
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.
One potential alternative is to move these to the properties file, although most of these values are set using system tokens.
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 is all looking and working pretty well @amyleadem ! I left a couple thoughts in comments but nothing that is necessarily a blocker.
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.
One potential alternative is to move these to the properties file, although most of these values are set using system tokens.
packages/usa-input-prefix-suffix/src/styles/_usa-input-prefix-suffix.scss
Outdated
Show resolved
Hide resolved
- Prevent overrides on usa-input--[width] classes
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.
LGTM! No perceived regressions from develop
Testing checklist
- Confirm the
.usa-input--[width]
and.usa-input-group--[width]
classes match the CSS (class names and values) in develop. - Confirm
usa-input--[width]
andusa-input-group--[width]
classes work as expected both with AND without a.usa-form
parent on the following elements:- [ ] Confirm no regressions as a result of removingmax-width: none
from.usa-form . usa-input
and.usa-form . usa-input
- Confirm that creating
$system-input-widths
inuswds-core
makes sense
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.
Nice work, the new features are a nice enhancement that avoid breaking changes. Also, shoutout to @mahoneycm for the thorough review.
I tested:
- Updating
$theme-input-max-width
and ensure there aren't conflicts. - Different sizes for input group for input prefix/suffix.
- Different sizes for input widths
- Compared against
develop
packages/usa-input-prefix-suffix/src/styles/_usa-input-prefix-suffix.scss
Outdated
Show resolved
Hide resolved
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.
Confirmed all the testing and review steps and confirmed previous requested changes look good. Approving!
@mlloydbixal @mahoneycm (cc: @aduth) I've updated the Sass to generate explicit |
This reverts commit d6d2eb4.
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 is working great! Great job covering all test cases and maintaining the current behaviors.
✅ ✅ ✅
Testing checklist
- Confirm the
.usa-input--[width]
and.usa-input-group--[width]
classes match the CSS (class names and values) indevelop
- Confirm
usa-input--[width]
andusa-input-group--[width]
classes work as expected both with AND without a.usa-form
parent on the following elements:-
usa-input
-
usa-textarea
-
usa-input-group
- Character count input (currently accepts the
usa-input--[width]
classes indevelop
) - Input mask input (currently accepts the
usa-input--[width]
classes indevelop
)
-
- Confirm no regressions as a result of removing
max-width: none
from.usa-form . usa-input
and.usa-form . usa-input
- Looks good. The max width from
usa-form
manages the max width without the need to set it individually on nested elements. - Should we remove range and select?
- Looks good. The max width from
- Confirm that creating
$system-input-widths
inuswds-core
makes sense
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.
Nice work, this one got a bit complicated!
Summary
Moved
.usa-input--[width]
and.usa-input-group--[width]
classes out of theusa-form
package.These classes are now generated in the
usa-input
andusa-input-prefix-suffix
packages and can be used without the.usa-form
parent element.Note
This is an alternative solution to PR #5935 (Thanks @aduth!)
Breaking change
This is not a breaking change.
Related issue
Closes #5312
Related pull requests
Changelog PR
Preview link
Problem statement
As a developer, I expect that if I include the package listed on a component's documentation (e.g. Text Input), all of the usage options documented for that component are available, so that I'm not confused by styles not existing despite being documented, or be forced to include more packages than I'd otherwise need for my optimized installation.
Solution
.usa-input--[width]
and.usa-input-group--[width]
class defintions into theusa-input
andusa-input-prefix-suffix
package, respectively.$system-input-widths
map in theuswds-core
package so that the values can be defined in a single location$system-input-widths
map to generateusa-input--[width]
andusa-input-group--[width]
classesmax-width: none
declaration from.usa-form .usa-input
and.usa-form .usa-textarea
to prevent specificity overridesTesting and review
.usa-input--[width]
and.usa-input-group--[width]
classes match the CSS (class names and values) indevelop
usa-input--[width]
andusa-input-group--[width]
classes work as expected both with AND without a.usa-form
parent on the following elements:usa-input
usa-textarea
usa-input-group
usa-input--[width]
classes indevelop
)usa-input--[width]
classes indevelop
)max-width: none
on.usa-form
children:$theme-input-max-width
to a value less than mobile (like "card" or 15)$system-input-widths
inuswds-core
makes sense and lives in the appropriate location