-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[TextField] Add characterCount attribute #3540
Conversation
@heetvachhani I haven't reviewed the changes, but looks like some linter errors have cropped up, should be a quick fix. |
9ef7c54
to
34d11e4
Compare
@@ -296,6 +312,9 @@ const TextField = React.createClass({ | |||
hasValue: isValid(props.value) || isValid(props.defaultValue) || | |||
(props.valueLink && isValid(props.valueLink.value)), | |||
muiTheme: this.context.muiTheme || getMuiTheme(), | |||
currentCharCount: 0, |
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 should be char count of defaultValue.
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.
will do the change
34d11e4
to
dabc921
Compare
@alitaheri I'm not able to put 'currentCharCount' into default value as it's state not props |
@heetvachhani What I mean is, if you have |
oh got your point @alitaheri. Thanks!! 👍 didn't thought of that case 😅 |
Oh, I almost forgot about |
dabc921
to
617813b
Compare
@alitaheri i guess it will work now 😄 |
3936295
to
7d8611f
Compare
7d8611f
to
3d7c721
Compare
/** | ||
* Maximum number of character in the Textfield | ||
*/ | ||
charCountMax: React.PropTypes.number, |
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.
Should we just consider using the standard html maxlength
attribute?
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 think maxlength
would block the input from going over the max character count, which can be exceeded with a warning for the character counter in the material spec.
}; | ||
|
||
const defaultProps = { | ||
}; |
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 can cut this out if not using any defaultProps 👍
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.
@nathanmarks yes will remove it.
@newoga I set this to on-hold while we figure out a couple of the questions surrounding |
@mbrookes As it stands -- this implementation is not making it into the lib. Can we close in favour of a new PR once the |
I agree. @heetvachhani, sorry you caught another one of these! |
Was this ever implemented? I have the same requirement for my new customer. Seems like a obvious addition |
This is my first draft. I will add example once you guys go through this.
Thanks!!
References #2416