From 2b0acaa5d4fdaf0916dc557ce88c3e4946c0c5b8 Mon Sep 17 00:00:00 2001 From: sebastien_andreu Date: Thu, 11 Dec 2014 13:17:22 +0000 Subject: [PATCH 1/3] Working disabled input --- src/js/input.jsx | 3 ++- src/less/components/input.less | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/js/input.jsx b/src/js/input.jsx index fc59b21615820e..2c502ab62ad466 100644 --- a/src/js/input.jsx +++ b/src/js/input.jsx @@ -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 ? diff --git a/src/less/components/input.less b/src/less/components/input.less index f220091a5e7884..082f786edd649a 100644 --- a/src/less/components/input.less +++ b/src/less/components/input.less @@ -14,7 +14,7 @@ padding-bottom: 14px; width: @input-width; - &:focus, &:valid { + &:focus, &:valid, &[disabled]:not([value=""]) { outline: none; box-shadow: none; padding: 0; @@ -53,7 +53,7 @@ } } - &:not(:focus):valid { + &:not(:focus):valid, &[disabled]:not([value=""]) { &+.mui-input-placeholder { font-size: 13px; color: gray; @@ -103,7 +103,7 @@ width: @input-width; } - &:focus, &:valid { + &:focus, &:valid, &[disabled]:not([value=""]) { outline: none; box-shadow: none; &~.mui-input-placeholder { @@ -129,7 +129,7 @@ } } - &:not(:focus):valid { + &:not(:focus):valid, &[disabled]:not([value=""]) { &+.mui-input-placeholder { color: gray; @@ -299,6 +299,8 @@ } } } + + &.mui-disabled { opacity: 0.4 }; } ::-webkit-input-placeholder { From be2b49dad7ef0630c541e5c8d0c25a09480b5fb6 Mon Sep 17 00:00:00 2001 From: sebastien_andreu Date: Sat, 13 Dec 2014 22:42:01 +0000 Subject: [PATCH 2/3] Update label style when no value attribute on input --- src/less/components/input.less | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/less/components/input.less b/src/less/components/input.less index 082f786edd649a..7353bd5904313f 100644 --- a/src/less/components/input.less +++ b/src/less/components/input.less @@ -14,7 +14,7 @@ padding-bottom: 14px; width: @input-width; - &:focus, &:valid, &[disabled]:not([value=""]) { + &:focus, &:valid, &:disabled:not([value=""]), &:disabled:not([value]) { outline: none; box-shadow: none; padding: 0; @@ -53,7 +53,7 @@ } } - &:not(:focus):valid, &[disabled]:not([value=""]) { + &:not(:focus):valid, &:disabled:not([value=""]), &:disabled:not([value]) { &+.mui-input-placeholder { font-size: 13px; color: gray; @@ -103,7 +103,7 @@ width: @input-width; } - &:focus, &:valid, &[disabled]:not([value=""]) { + &:focus, &:valid, &:disabled:not([value=""]), &:disabled:not([value]) { outline: none; box-shadow: none; &~.mui-input-placeholder { @@ -129,7 +129,7 @@ } } - &:not(:focus):valid, &[disabled]:not([value=""]) { + &:not(:focus):valid, &:disabled:not([value=""]), &:disabled:not([value]) { &+.mui-input-placeholder { color: gray; From 640b63a64abcd2a95390b8ca5fc5faf54b99e089 Mon Sep 17 00:00:00 2001 From: sebastien_andreu Date: Sun, 21 Dec 2014 22:31:36 +0000 Subject: [PATCH 3/3] Bugfix empty value for disabled inputs + docs update --- docs/src/app/components/pages/components/inputs.jsx | 2 ++ src/less/components/input.less | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/src/app/components/pages/components/inputs.jsx b/docs/src/app/components/pages/components/inputs.jsx index 0111845371cf39..0fca962f383ebd 100644 --- a/docs/src/app/components/pages/components/inputs.jsx +++ b/docs/src/app/components/pages/components/inputs.jsx @@ -15,6 +15,8 @@ var InputsPage = React.createClass({
+ + diff --git a/src/less/components/input.less b/src/less/components/input.less index 7353bd5904313f..d7628f11060adb 100644 --- a/src/less/components/input.less +++ b/src/less/components/input.less @@ -14,7 +14,7 @@ padding-bottom: 14px; width: @input-width; - &:focus, &:valid, &:disabled:not([value=""]), &:disabled:not([value]) { + &:focus, &:valid, &:disabled[value]:not([value=""]) { outline: none; box-shadow: none; padding: 0; @@ -53,7 +53,7 @@ } } - &:not(:focus):valid, &:disabled:not([value=""]), &:disabled:not([value]) { + &:not(:focus):valid, &:disabled[value]:not([value=""]) { &+.mui-input-placeholder { font-size: 13px; color: gray; @@ -103,7 +103,7 @@ width: @input-width; } - &:focus, &:valid, &:disabled:not([value=""]), &:disabled:not([value]) { + &:focus, &:valid, &:disabled[value]:not([value=""]) { outline: none; box-shadow: none; &~.mui-input-placeholder { @@ -129,7 +129,7 @@ } } - &:not(:focus):valid, &:disabled:not([value=""]), &:disabled:not([value]) { + &:not(:focus):valid, &:disabled[value]:not([value=""]) { &+.mui-input-placeholder { color: gray;