-
Notifications
You must be signed in to change notification settings - Fork 2.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
feat(text-field): Added support for character counter. #4244
Conversation
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 haven't gotten a chance to look at the code yet, but upon quick testing, it looks like the character counter and helper text don't line up with each other vertically.
I also sent some questions to our designer which I've CC'd you on which may have bearing on this PR.
packages/mdc-textfield/character-counter/mdc-text-field-character-counter.scss
Outdated
Show resolved
Hide resolved
packages/mdc-textfield/character-counter/mdc-text-field-character-counter.scss
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #4244 +/- ##
==========================================
+ Coverage 98.4% 98.48% +0.08%
==========================================
Files 127 130 +3
Lines 5688 5736 +48
Branches 757 766 +9
==========================================
+ Hits 5597 5649 +52
+ Misses 91 87 -4
Continue to review full report at Codecov.
|
…t for text field foundation
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 with a few more doc comments
...screenshot/spec/mdc-textfield/classes/baseline-helper-text-persistent-character-counter.html
Show resolved
Hide resolved
test/screenshot/spec/mdc-textfield/classes/baseline-helper-text-persistent-validation-msg.html
Outdated
Show resolved
Hide resolved
…o feat/textfield_char_counter
…o feat/textfield_char_counter
This change adds support for character counter that displays the ratio of characters used and the total character limit.
Character counter is added as subcomponent of text field (similar to
helper-text
) which can be rendered insidehelper-text
subcomponent or insidemdc-text-field
root for multi-line text field (textarea).Single-line text field
New helper class
mdc-text-field-helper-line
is introduced to render two subcomponents -helper-text
andcharacter-counter
in a flexbox. These two subcomponents are optional.Multi-line text field
Character counter subcomponent can be independently used and is rendered inside
mdc-text-field
root as first element. Text field leaves a space at the bottom of textarea for character counter using sibling selector (.mdc-text-field-character-counter + .mdc-text-field__input
) only for multi-line text field (textarea) variant.Fixes #13.
BREAKING CHANGE: Changed the layout of MDCTextField's
helper-text
to add support for character counter feature.