Skip to content

Commit

Permalink
let's merge
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Aug 2, 2018
1 parent b8582b7 commit 62a44bc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
14 changes: 7 additions & 7 deletions packages/material-ui/src/FormHelperText/FormHelperText.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ function FormHelperText(props, context) {
const {
classes,
className: classNameProp,
component: Component,
disabled: disabledProp,
error: errorProp,
margin: marginProp,
component: Component,
filled: filledProp,
focused: focusedProp,
margin: marginProp,
required: requiredProp,
filled: filledProp,
...other
} = props;
const { muiFormControl } = context;

let disabled = disabledProp;
let error = errorProp;
let filled = filledProp;
let focused = focusedProp;
let margin = marginProp;
let required = requiredProp;
let focused = focusedProp;
let filled = filledProp;

if (muiFormControl) {
if (typeof disabled === 'undefined') {
Expand Down Expand Up @@ -85,9 +85,9 @@ function FormHelperText(props, context) {
{
[classes.disabled]: disabled,
[classes.error]: error,
[classes.marginDense]: margin === 'dense',
[classes.focused]: focused,
[classes.filled]: filled,
[classes.focused]: focused,
[classes.marginDense]: margin === 'dense',
[classes.required]: required,
},
classNameProp,
Expand Down
8 changes: 4 additions & 4 deletions packages/material-ui/src/FormLabel/FormLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ function FormLabel(props, context) {
component: Component,
disabled: disabledProp,
error: errorProp,
filled: filledProp,
focused: focusedProp,
required: requiredProp,
filled: filledProp,
...other
} = props;

const { muiFormControl } = context;

let required = requiredProp;
let focused = focusedProp;
let disabled = disabledProp;
let error = errorProp;
let filled = filledProp;
let focused = focusedProp;
let required = requiredProp;

if (muiFormControl) {
if (typeof required === 'undefined') {
Expand All @@ -81,10 +81,10 @@ function FormLabel(props, context) {
const className = classNames(
classes.root,
{
[classes.focused]: focused,
[classes.disabled]: disabled,
[classes.error]: error,
[classes.filled]: filled,
[classes.focused]: focused,
[classes.required]: required,
},
classNameProp,
Expand Down
6 changes: 6 additions & 0 deletions pages/api/form-helper-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ title: FormHelperText API
| <span class="prop-name">component</span> | <span class="prop-type">union:&nbsp;string&nbsp;&#124;<br>&nbsp;func&nbsp;&#124;<br>&nbsp;object<br> | <span class="prop-default">'p'</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">disabled</span> | <span class="prop-type">bool |   | If `true`, the helper text should be displayed in a disabled state. |
| <span class="prop-name">error</span> | <span class="prop-type">bool |   | If `true`, helper text should be displayed in an error state. |
| <span class="prop-name">filled</span> | <span class="prop-type">bool |   | If `true`, the helper text should use filled classes key. |
| <span class="prop-name">focused</span> | <span class="prop-type">bool |   | If `true`, the helper text should use focused classes key. |
| <span class="prop-name">margin</span> | <span class="prop-type">enum:&nbsp;'dense'<br> |   | If `dense`, will adjust vertical spacing. This is normally obtained via context from FormControl. |
| <span class="prop-name">required</span> | <span class="prop-type">bool |   | If `true`, the helper text should use required classes key. |

Any other properties supplied will be spread to the root element (native element).

Expand All @@ -36,6 +39,9 @@ This property accepts the following keys:
| <span class="prop-name">error</span> | Styles applied to the root element if `error={true}`.
| <span class="prop-name">disabled</span> | Styles applied to the root element if `disabled={true}`.
| <span class="prop-name">marginDense</span> | Styles applied to the root element if `margin="dense"`.
| <span class="prop-name">focused</span> | Styles applied to the root element if `focused={true}`.
| <span class="prop-name">filled</span> | Styles applied to the root element if `filled={true}`.
| <span class="prop-name">required</span> | Styles applied to the root element if `required={true}`.

Have a look at [overriding with classes](/customization/overrides#overriding-with-classes) section
and the [implementation of the component](https://github.com/mui-org/material-ui/tree/master/packages/material-ui/src/FormHelperText/FormHelperText.js)
Expand Down
3 changes: 3 additions & 0 deletions pages/api/form-label.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ title: FormLabel API
| <span class="prop-name">component</span> | <span class="prop-type">union:&nbsp;string&nbsp;&#124;<br>&nbsp;func&nbsp;&#124;<br>&nbsp;object<br> | <span class="prop-default">'label'</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">disabled</span> | <span class="prop-type">bool |   | If `true`, the label should be displayed in a disabled state. |
| <span class="prop-name">error</span> | <span class="prop-type">bool |   | If `true`, the label should be displayed in an error state. |
| <span class="prop-name">filled</span> | <span class="prop-type">bool |   | If `true`, the label should use filled classes key. |
| <span class="prop-name">focused</span> | <span class="prop-type">bool |   | If `true`, the input of this label is focused (used by `FormGroup` components). |
| <span class="prop-name">required</span> | <span class="prop-type">bool |   | If `true`, the label will indicate that the input is required. |

Expand All @@ -37,6 +38,8 @@ This property accepts the following keys:
| <span class="prop-name">focused</span> | Styles applied to the root element if `focused={true}`.
| <span class="prop-name">disabled</span> | Styles applied to the root element if `disabled={true}`.
| <span class="prop-name">error</span> | Styles applied to the root element if `error={true}`.
| <span class="prop-name">filled</span> | Styles applied to the root element if `filled={true}`.
| <span class="prop-name">required</span> | Styles applied to the root element if `required={true}`.
| <span class="prop-name">asterisk</span> |

Have a look at [overriding with classes](/customization/overrides#overriding-with-classes) section
Expand Down

0 comments on commit 62a44bc

Please sign in to comment.