Skip to content
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

Working disabled input #140

Merged
merged 3 commits into from
Dec 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/src/app/components/pages/components/inputs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var InputsPage = React.createClass({
<br />
<mui.Input ref="firstname" onChange={this._onChange} type="text" name="firstname" placeholder="First Name" description="Your first name as it appears on your credit card." />
<mui.Input ref="lastname" type="text" name="lastname" placeholder="Last Name" description="Your last name as it appears on your credit card.." />
<mui.Input ref="disabled" type="text" name="disabled" disabled={true} placeholder="Disabled input" />
<mui.Input ref="disabled_v" type="text" name="disabled_v" disabled={true} defaultValue="with value" placeholder="Disabled input" />
<mui.Input ref="addressline1" type="text" name="addressline1" placeholder="Address Line 1" description="Your address as it appears on your credit card." />
<mui.Input ref="addressline2" type="text" name="zipcode" placeholder="Zip Code" description="Your zip code as it appears on your credit card." />
<mui.Input ref="city" type="text" name="city" placeholder="City" description="Your city as it appears on your credit card." />
Expand Down
3 changes: 2 additions & 1 deletion src/js/input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ var Input = React.createClass({
var classes = this.getClasses('mui-input', {
'mui-floating': this.props.inputStyle === 'floating',
'mui-text': this.props.type === 'text',
'mui-error': this.props.error !== undefined && this.props.error !== null
'mui-error': this.props.error !== undefined && this.props.error !== null,
'mui-disabled': !!this.props.disabled,
}),
placeholder = this.props.inlinePlaceholder ? this.props.placeholder : "",
inputElement = this.props.multiline ?
Expand Down
10 changes: 6 additions & 4 deletions src/less/components/input.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
padding-bottom: 14px;
width: @input-width;

&:focus, &:valid {
&:focus, &:valid, &:disabled[value]:not([value=""]) {
outline: none;
box-shadow: none;
padding: 0;
Expand Down Expand Up @@ -53,7 +53,7 @@
}
}

&:not(:focus):valid {
&:not(:focus):valid, &:disabled[value]:not([value=""]) {
&+.mui-input-placeholder {
font-size: 13px;
color: gray;
Expand Down Expand Up @@ -103,7 +103,7 @@
width: @input-width;
}

&:focus, &:valid {
&:focus, &:valid, &:disabled[value]:not([value=""]) {
outline: none;
box-shadow: none;
&~.mui-input-placeholder {
Expand All @@ -129,7 +129,7 @@
}
}

&:not(:focus):valid {
&:not(:focus):valid, &:disabled[value]:not([value=""]) {
&+.mui-input-placeholder {
color: gray;

Expand Down Expand Up @@ -299,6 +299,8 @@
}
}
}

&.mui-disabled { opacity: 0.4 };
}

::-webkit-input-placeholder {
Expand Down