-
-
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] Make it meet guidelines #6566
Merged
oliviertassinari
merged 45 commits into
mui:next
from
kybarg:next-text-field-guidelines
May 30, 2017
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
7f966d0
Adjusted styles accordingto specs, fixed #6425
kybarg 10a5c0f
Merge branch 'callemall/next' into next-text-field-guidelines
kybarg 6e8ad06
Fixes, simplified styles
kybarg b5fb82a
Removed dead `TextFieldLabel` component as for #6580
kybarg 6cece85
Added colors according to specs, `InputLabel` disabled prop
kybarg 7b7fa13
Avoiding label flicker and blurry text in webkit browsers
kybarg 4716659
More smooth label animation.
kybarg 6f83e5b
More smooth font-size animation
kybarg 186a251
Proper error color, added `FormHelperText` component
kybarg 7abcec9
FormHelperText docs
kybarg d02154c
Fixed lint errors
kybarg dffc976
Added new component to styles order, fixes
kybarg 890217f
Merge remote-tracking branch 'refs/remotes/callemall/next' into next-…
kybarg 0b15230
Fixed disabled border style
kybarg f27ea99
Solve conflicts
kybarg b11a2e8
FormHelperText exports
kybarg 7a3d1f4
Merge remote-tracking branch 'refs/remotes/callemall/next' into next-…
kybarg 710e605
Remove unused TextFieldLabel
kybarg ff1abe5
Merge remote-tracking branch 'callemall/next' into next-text-field-gu…
kybarg 0061db1
Form helper fixes, test, docs
kybarg 6af7c88
Merge remote-tracking branch 'refs/remotes/callemall/next' into next-…
kybarg 0565e94
TextField tests for FormHelperText
kybarg c3bde34
Get rid of TextFieldLabel.md, added tests for InputLabel
kybarg c740da2
Added tests for FormControl
kybarg 760eb25
Merge remote-tracking branch 'refs/remotes/callemall/next' into next-…
kybarg 4e16f7c
Make dirty if `defaultValue` is set
kybarg e7e7f47
Fix helper text font
kybarg 38d4043
Fix label "flicker" in webkit browsers.
kybarg 2f70c6c
Use `theme.spacing.unit` instead of number values
kybarg 1457b96
Disabled composed text field demo
kybarg 5fe667a
Fixed type check
kybarg 5d6970d
Fixed type check error
kybarg 612b02c
Make `ComposedTextFiled` accept disabled prop
kybarg ae3d010
Fixed lint
kybarg 3cd4b99
Fixed docs and input
kybarg 9b40eee
Exposed FormHelperTextProps and InputLabelProps
kybarg 428d870
Fixed docs
kybarg 489de60
Merge remote-tracking branch 'refs/remotes/callemall/next' into next-…
kybarg a8a9a6c
Fixed multiline styles
kybarg 3043877
Placeholder + Label behaviour
kybarg f30dbea
Fixes
kybarg 0419922
Fixed lint errors
kybarg c37fe6e
Merge remote-tracking branch 'refs/remotes/callemall/next' into next-…
kybarg 30be343
Typo fixes
kybarg 60ae4d7
Typo fixes 2
kybarg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
components: Input, TextField, TextFieldLabel | ||
components: Input, TextField, FormHelperText | ||
--- | ||
|
||
# Text Fields | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// @flow weak | ||
|
||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import { createStyleSheet } from 'jss-theme-reactor'; | ||
import withStyles from '../styles/withStyles'; | ||
|
||
export const styleSheet = createStyleSheet('MuiFormHelperText', theme => ({ | ||
root: { | ||
color: theme.palette.input.helperText, | ||
fontFamily: theme.typography.fontFamily, | ||
fontSize: 12, | ||
lineHeight: 1.4, | ||
margin: 0, | ||
}, | ||
error: { | ||
color: theme.palette.error.A400, | ||
}, | ||
disabled: { | ||
color: theme.palette.input.disabled, | ||
}, | ||
})); | ||
|
||
function FormHelperText(props, context) { | ||
const { | ||
children, | ||
classes, | ||
className: classNameProp, | ||
disabled: disabledProp, | ||
error: errorProp, | ||
...other | ||
} = props; | ||
const { muiFormControl } = context; | ||
|
||
let disabled = disabledProp; | ||
let error = errorProp; | ||
|
||
if (muiFormControl && typeof disabled === 'undefined') { | ||
disabled = muiFormControl.disabled; | ||
} | ||
|
||
if (muiFormControl && typeof error === 'undefined') { | ||
error = muiFormControl.error; | ||
} | ||
|
||
const className = classNames( | ||
classes.root, | ||
{ | ||
[classes.disabled]: disabled, | ||
[classes.error]: error, | ||
}, | ||
classNameProp, | ||
); | ||
|
||
return ( | ||
<p className={className} {...other}> | ||
{children} | ||
</p> | ||
); | ||
} | ||
|
||
FormHelperText.propTypes = { | ||
/** | ||
* The content of the component. | ||
*/ | ||
children: PropTypes.node, | ||
/** | ||
* Useful to extend the style applied to components. | ||
*/ | ||
classes: PropTypes.object.isRequired, | ||
/** | ||
* @ignore | ||
*/ | ||
className: PropTypes.string, | ||
/** | ||
* If `true`, the helper text should be displayed in a disabled state. | ||
*/ | ||
disabled: PropTypes.bool, | ||
/** | ||
* If `true`, helper text should be displayed in an error state. | ||
*/ | ||
error: PropTypes.bool, | ||
}; | ||
|
||
FormHelperText.contextTypes = { | ||
muiFormControl: PropTypes.object, | ||
}; | ||
|
||
export default withStyles(styleSheet)(FormHelperText); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Also, Firefox do not like that example:

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.
@oliviertassinari I guess
jss
doens't prefixplaceholder
selector. My bad 😞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.
which Firefox version is it?