From f76e82f78b12065d46a659c7192246eb9e7e0c08 Mon Sep 17 00:00:00 2001 From: Federico Zivolo Date: Tue, 23 Sep 2014 10:15:40 +0200 Subject: [PATCH] fix for material wells and for multiple selects --- css-compiled/material-wfont.css | 5 +- css-compiled/material.css | 400 ++++++-------------------------- less/material.less | 2 +- scripts/material.js | 2 +- 4 files changed, 78 insertions(+), 331 deletions(-) diff --git a/css-compiled/material-wfont.css b/css-compiled/material-wfont.css index 0c8b4cd7..bdf33ade 100644 --- a/css-compiled/material-wfont.css +++ b/css-compiled/material-wfont.css @@ -2070,7 +2070,10 @@ body [class^="well well-material"], .container-fluid [class^="well well-material"], body [class^="well well-material"] .form-control, .container [class^="well well-material"] .form-control, -.container-fluid [class^="well well-material"] .form-control { +.container-fluid [class^="well well-material"] .form-control, +body [class^="well well-material"] .floating-label, +.container [class^="well well-material"] .floating-label, +.container-fluid [class^="well well-material"] .floating-label { color: rgba(255, 255, 255, 0.84); } body [class^="well well-material"] .form-control, diff --git a/css-compiled/material.css b/css-compiled/material.css index 1dade12e..9b18a097 100644 --- a/css-compiled/material.css +++ b/css-compiled/material.css @@ -13,20 +13,6 @@ opacity: 0; } } -@-moz-keyframes input-highlight { - 0% { - left: 20%; - width: 20%; - } - 99% { - width: 0; - left: 0; - opacity: 1; - } - 100% { - opacity: 0; - } -} @keyframes input-highlight { 0% { left: 20%; @@ -94,7 +80,8 @@ h6, text-transform: uppercase; text-decoration: none; color: rgba(255, 255, 255, 0.84); - transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); + -webkit-transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); + transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); outline: none !important; } .btn:hover { @@ -192,7 +179,8 @@ h6, } .btn-raised { box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); - transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); + -webkit-transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); + transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); } .btn-raised:active:not(.btn-link) { box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); @@ -279,7 +267,8 @@ h6, border-radius: 4px; margin: 10px 1px; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); - transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); + -webkit-transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); + transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); } .btn-group:active:not(.btn-link), .btn-group-vertical:active:not(.btn-link) { @@ -292,7 +281,8 @@ h6, .btn-group.btn-group-raised, .btn-group-vertical.btn-group-raised { box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); - transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); + -webkit-transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); + transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); } .btn-group.btn-group-raised:active:not(.btn-link), .btn-group-vertical.btn-group-raised:active:not(.btn-link) { @@ -429,7 +419,8 @@ h6, padding-top: 15px; } .checkbox { - transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); } .checkbox label { cursor: pointer; @@ -440,7 +431,8 @@ h6, display: block; position: absolute; left: 0px; - transition-duration: 0.2s; + -webkit-transition-duration: 0.2s; + transition-duration: 0.2s; } .checkbox label .check:after { display: block; @@ -463,9 +455,6 @@ h6, height: 20px; width: 20px; -webkit-transition-delay: 0.2s; - -moz-transition-delay: 0.2s; - -o-transition-delay: 0.2s; - -ms-transition-delay: 0.2s; transition-delay: 0.2s; } .checkbox .check, @@ -550,30 +539,22 @@ h6, border: solid 2px; border-color: #5a5a5a; -webkit-animation: uncheck 300ms ease-out forwards; - -moz-animation: uncheck 300ms ease-out forwards; -ms-animation: uncheck 300ms ease-out forwards; - -o-animation: uncheck 300ms ease-out forwards; animation: uncheck 300ms ease-out forwards; } .checkbox input[type=checkbox]:checked ~ .check:before { -webkit-animation: check 300ms ease-out forwards; - -moz-animation: check 300ms ease-out forwards; -ms-animation: check 300ms ease-out forwards; - -o-animation: check 300ms ease-out forwards; animation: check 300ms ease-out forwards; } .checkbox input[type=checkbox]:not(:checked) ~ .check:after { -webkit-animation: rippleOff 500ms; - -moz-animation: rippleOff 500ms; -ms-animation: rippleOff 500ms; - -o-animation: rippleOff 500ms; animation: rippleOff 500ms; } .checkbox input[type=checkbox]:checked ~ .check:after { -webkit-animation: rippleOn 500ms; - -moz-animation: rippleOn 500ms; -ms-animation: rippleOn 500ms; - -o-animation: rippleOn 500ms; animation: rippleOn 500ms; } .checkbox input[type=checkbox][disabled]:not(:checked) ~ .check:before { @@ -581,7 +562,8 @@ h6, } .checkbox input[type=checkbox][disabled] ~ .check:after { background-color: rgba(0, 0, 0, 0.84); - transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); } .checkbox input[type=checkbox]:checked ~ .check:after, .checkbox-default input[type=checkbox]:checked ~ .check:after { @@ -662,14 +644,16 @@ h6, border-color: #0f9d58; border-left-color: transparent; border-top-color: transparent; - transform: rotate(45deg); + -webkit-transform: rotate(45deg); + transform: rotate(45deg); } 50% { top: 14px; left: 17px; width: 4px; height: 4px; - transform: rotate(45deg); + -webkit-transform: rotate(45deg); + transform: rotate(45deg); border-color: #0f9d58; border-left-color: transparent; border-top-color: transparent; @@ -684,7 +668,8 @@ h6, left: 12px; width: 18px; height: 18px; - transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); border-color: #5a5a5a; border-left-color: #5a5a5a; border-top-color: #5a5a5a; @@ -696,7 +681,8 @@ h6, left: 17px; width: 10px; height: 21px; - transform: rotate(45deg); + -webkit-transform: rotate(45deg); + transform: rotate(45deg); border-color: #0f9d58; border-left-color: transparent; border-top-color: transparent; @@ -710,7 +696,8 @@ h6, left: 17px; width: 4px; height: 4px; - transform: rotate(45deg); + -webkit-transform: rotate(45deg); + transform: rotate(45deg); border-color: #5a5a5a; border-left-color: #5a5a5a; border-top-color: #5a5a5a; @@ -720,43 +707,8 @@ h6, left: 12px; width: 18px; height: 18px; - transform: rotate(0deg); - border-color: #5a5a5a; - border-left-color: #5a5a5a; - border-top-color: #5a5a5a; - } -} -@-moz-keyframes check { - 100% { - top: -3px; - left: 17px; - width: 10px; - height: 21px; - transform: rotate(45deg); - border-color: #0f9d58; - border-left-color: transparent; - border-top-color: transparent; - } - 51% { - border-left: transparent; - border-top-color: transparent; - } - 50% { - top: 14px; - left: 17px; - width: 4px; - height: 4px; - transform: rotate(45deg); - border-color: #5a5a5a; - border-left-color: #5a5a5a; - border-top-color: #5a5a5a; - } - 0% { - top: 1px; - left: 12px; - width: 18px; - height: 18px; - transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); border-color: #5a5a5a; border-left-color: #5a5a5a; border-top-color: #5a5a5a; @@ -798,49 +750,14 @@ h6, border-top-color: #5a5a5a; } } -@-o-keyframes check { - 100% { - top: -3px; - left: 17px; - width: 10px; - height: 21px; - transform: rotate(45deg); - border-color: #0f9d58; - border-left-color: transparent; - border-top-color: transparent; - } - 51% { - border-left: transparent; - border-top-color: transparent; - } - 50% { - top: 14px; - left: 17px; - width: 4px; - height: 4px; - transform: rotate(45deg); - border-color: #5a5a5a; - border-left-color: #5a5a5a; - border-top-color: #5a5a5a; - } - 0% { - top: 1px; - left: 12px; - width: 18px; - height: 18px; - transform: rotate(0deg); - border-color: #5a5a5a; - border-left-color: #5a5a5a; - border-top-color: #5a5a5a; - } -} @keyframes check { 100% { top: -3px; left: 17px; width: 10px; height: 21px; - transform: rotate(45deg); + -webkit-transform: rotate(45deg); + transform: rotate(45deg); border-color: #0f9d58; border-left-color: transparent; border-top-color: transparent; @@ -854,7 +771,8 @@ h6, left: 17px; width: 4px; height: 4px; - transform: rotate(45deg); + -webkit-transform: rotate(45deg); + transform: rotate(45deg); border-color: #5a5a5a; border-left-color: #5a5a5a; border-top-color: #5a5a5a; @@ -864,7 +782,8 @@ h6, left: 12px; width: 18px; height: 18px; - transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); border-color: #5a5a5a; border-left-color: #5a5a5a; border-top-color: #5a5a5a; @@ -890,26 +809,6 @@ h6, opacity: 0; } } -@-moz-keyframes rippleOn { - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } -} @-ms-keyframes rippleOn { 0% { opacity: 0; @@ -930,26 +829,6 @@ h6, opacity: 0; } } -@-o-keyframes rippleOn { - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } -} @keyframes rippleOn { 0% { opacity: 0; @@ -990,26 +869,6 @@ h6, opacity: 0; } } -@-moz-keyframes rippleOff { - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } -} @-ms-keyframes rippleOn { 0% { opacity: 0; @@ -1030,26 +889,6 @@ h6, opacity: 0; } } -@-o-keyframes rippleOff { - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } -} @keyframes rippleOff { 0% { opacity: 0; @@ -1083,7 +922,8 @@ h6, position: absolute; left: 10px; top: 2px; - transition-duration: 0.2s; + -webkit-transition-duration: 0.2s; + transition-duration: 0.2s; } .radio label .circle { border: 2px solid rgba(0, 0, 0, 0.84); @@ -1096,7 +936,8 @@ h6, width: 15px; border-radius: 100%; background-color: rgba(0, 0, 0, 0.84); - transform: scale(0); + -webkit-transform: scale(0); + transform: scale(0); } .radio label .check:after { display: block; @@ -1111,20 +952,17 @@ h6, z-index: 1; opacity: 0; margin: 0; - transform: scale(1.5); + -webkit-transform: scale(1.5); + transform: scale(1.5); } .radio label input[type=radio]:not(:checked) ~ .check:after { -webkit-animation: rippleOff 500ms; - -moz-animation: rippleOff 500ms; -ms-animation: rippleOff 500ms; - -o-animation: rippleOff 500ms; animation: rippleOff 500ms; } .radio label input[type=radio]:checked ~ .check:after { -webkit-animation: rippleOn 500ms; - -moz-animation: rippleOn 500ms; -ms-animation: rippleOn 500ms; - -o-animation: rippleOn 500ms; animation: rippleOn 500ms; } .radio input[type=radio]:checked ~ .check, @@ -1275,7 +1113,8 @@ h6, display: none; } .radio input[type=radio]:checked ~ .check { - transform: scale(0.55); + -webkit-transform: scale(0.55); + transform: scale(0.55); } .radio input[type=radio][disabled] ~ .circle { border-color: rgba(0, 0, 0, 0.84); @@ -1303,26 +1142,6 @@ h6, opacity: 0; } } -@-moz-keyframes rippleOn { - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } -} @-ms-keyframes rippleOn { 0% { opacity: 0; @@ -1343,26 +1162,6 @@ h6, opacity: 0; } } -@-o-keyframes rippleOn { - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } -} @keyframes rippleOn { 0% { opacity: 0; @@ -1403,26 +1202,6 @@ h6, opacity: 0; } } -@-moz-keyframes rippleOff { - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } -} @-ms-keyframes rippleOn { 0% { opacity: 0; @@ -1443,26 +1222,6 @@ h6, opacity: 0; } } -@-o-keyframes rippleOff { - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } - 0% { - opacity: 0; - } - 50% { - opacity: 0.2; - } - 100% { - opacity: 0; - } -} @keyframes rippleOff { 0% { opacity: 0; @@ -1545,7 +1304,8 @@ select[multiple].form-control.focus { pointer-events: none; left: 0px; top: 5px; - transition: 0.2s ease all; + -webkit-transition: 0.2s ease all; + transition: 0.2s ease all; opacity: 0; } .form-control-wrapper .form-control:not(.empty) ~ .floating-label { @@ -1578,13 +1338,17 @@ select[multiple].form-control.focus { height: 2px; background-color: #5264ae; bottom: -1px; - transform: scaleX(0); - transition: transform 0s; + -webkit-transform: scaleX(0); + transform: scaleX(0); + -webkit-transition: -webkit-transform 0s; + transition: transform 0s; } .form-control-wrapper .form-control:focus ~ .material-input:before, .form-control-wrapper .form-control.focus ~ .material-input:before { - transform: scaleX(1); - transition: transform 0.2s ease-out; + -webkit-transform: scaleX(1); + transform: scaleX(1); + -webkit-transition: -webkit-transform 0.2s ease-out; + transition: transform 0.2s ease-out; } .form-control-wrapper .material-input:after { content: ""; @@ -1596,7 +1360,8 @@ select[multiple].form-control.focus { left: 0; pointer-events: none; opacity: 0.9; - transform-origin: left; + -webkit-transform-origin: left; + transform-origin: left; } .form-control-wrapper .input-lg ~ .material-input:after { height: 26px; @@ -2032,24 +1797,12 @@ select.form-control.focus { @-webkit-keyframes input-highlight { 0% { left: 20%; - transform: scaleX(20%); + -webkit-transform: scaleX(20%); + transform: scaleX(20%); } 99% { - transform: scaleX(0); - left: 0; - opacity: 1; - } - 100% { - opacity: 0; - } -} -@-moz-keyframes input-highlight { - 0% { - left: 20%; - transform: scaleX(20%); - } - 99% { - transform: scaleX(0); + -webkit-transform: scaleX(0); + transform: scaleX(0); left: 0; opacity: 1; } @@ -2071,27 +1824,15 @@ select.form-control.focus { opacity: 0; } } -@-o-keyframes input-highlight { - 0% { - left: 20%; - transform: scaleX(20%); - } - 99% { - transform: scaleX(0); - left: 0; - opacity: 1; - } - 100% { - opacity: 0; - } -} @keyframes input-highlight { 0% { left: 20%; - transform: scaleX(20%); + -webkit-transform: scaleX(20%); + transform: scaleX(20%); } 99% { - transform: scaleX(0); + -webkit-transform: scaleX(0); + transform: scaleX(0); left: 0; opacity: 1; } @@ -2328,7 +2069,10 @@ body [class^="well well-material"], .container-fluid [class^="well well-material"], body [class^="well well-material"] .form-control, .container [class^="well well-material"] .form-control, -.container-fluid [class^="well well-material"] .form-control { +.container-fluid [class^="well well-material"] .form-control, +body [class^="well well-material"] .floating-label, +.container [class^="well well-material"] .floating-label, +.container-fluid [class^="well well-material"] .floating-label { color: rgba(255, 255, 255, 0.84); } body [class^="well well-material"] .form-control, @@ -3017,10 +2761,8 @@ fieldset[disabled] .navbar .btn-link:focus { border-radius: 2px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); height: 0; - -moz-transition: -moz-transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s, padding 0 linear 0.2s, height 0 linear 0.2s; -webkit-transition: -webkit-transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s, padding 0 linear 0.2s, height 0 linear 0.2s; transition: transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s, padding 0 linear 0.2s, height 0 linear 0.2s; - -moz-transform: translateY(200%); -webkit-transform: translateY(200%); transform: translateY(200%); } @@ -3028,10 +2770,8 @@ fieldset[disabled] .navbar .btn-link:focus { padding: 14px 15px; margin-bottom: 20px; height: auto; - -moz-transition: -moz-transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s; -webkit-transition: -webkit-transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s; transition: transform 0.2s ease-in-out, opacity 0.2s ease-in, height 0 linear 0.2s, height 0 linear 0.2s; - -moz-transform: none; -webkit-transform: none; transform: none; } @@ -3063,7 +2803,8 @@ fieldset[disabled] .navbar .btn-link:focus { .noUi-handle { position: relative; z-index: 1; - box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; -webkit-box-sizing: border-box; } .noUi-stacking .noUi-handle { @@ -3083,7 +2824,8 @@ fieldset[disabled] .navbar .btn-link:focus { height: 10px; } .noUi-horizontal .noUi-handle { - box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; width: 12px; height: 12px; left: -10px; @@ -3117,11 +2859,13 @@ fieldset[disabled] .navbar .btn-link:focus { .noUi-handle { border-radius: 100%; cursor: default; - transition: all 0.2s ease-out; + -webkit-transition: all 0.2s ease-out; + transition: all 0.2s ease-out; border: 1px solid; } .noUi-horizontal .noUi-handle:active { - transform: scale(2.5); + -webkit-transform: scale(2.5); + transform: scale(2.5); } [disabled].noUi-slider { opacity: 0.5; diff --git a/less/material.less b/less/material.less index 7e12ad69..10fab714 100644 --- a/less/material.less +++ b/less/material.less @@ -51,7 +51,7 @@ body, .container, .container-fluid { .variations(~"", background-color, #FFF); } [class^="well well-material"] { - &, .form-control { + &, .form-control, .floating-label { color: @darkbg-text; } .form-control { diff --git a/scripts/material.js b/scripts/material.js index 2abb8072..c5653288 100644 --- a/scripts/material.js +++ b/scripts/material.js @@ -19,7 +19,7 @@ $(function (){ $(this).attr("placeholder", null).removeClass("floating-label"); $(this).after("
" + placeholder + "
"); } - if ($(this).val() === "") { + if ($(this).is(":empty") || $(this).val() === null || $(this).val() == "undefined" || $(this).val() === "") { $(this).addClass("empty"); }