viur-ignite-css
Version:
Core of VIUR Ignite - a less framework
571 lines (524 loc) • 12.7 kB
text/less
@charset "UTF-8";
/**
* FORM PARTS
*/
@inputValidColor: @successColor;
@inputDangerColor: @failColor;
@inputHintColor: @hintColor;
@inputRequiredColor: @mainColor;
@inputColor: #ffffff;
@inputShadow: 0px 1px 1px rgba(0,0,0,0.4);
@inputHoverShadow: 0 3px 3px rgba(0,0,0,0.4);
.input {
padding: 7px 14px;
width: 250px;
margin:6px 0;
background-color: @inputColor;
border: 1px solid darken(@inputColor,10%);
color:contrast(@inputColor, #222222, #f4f4f4);
vertical-align: middle;
display: inline-block;
transition: all .3s ease;
background-position: 150% center;
background-size: 15px;
background-repeat: no-repeat;
.inputGroup.is-invalid &,
&.is-invalid {
color: darken(@inputDangerColor, 15%);
border-color: @inputDangerColor;
background-color: lighten(@inputDangerColor, 40%);
background-image: url(../icons/cross.svg);
background-position: 95% center;
&:focus {
color: contrast(@inputColor, #222222, #f4f4f4);
background-color: @inputColor;
border: 1px solid darken(@inputColor, 10%);
background-position: 150% center;
}
}
.inputGroup.is-recommended &,
&.is-recommended {
color: darken(@inputHintColor, 15%);
border-color: @inputHintColor;
background-color: lighten(@inputHintColor, 40%);
background-image: url(../icons/pen.svg);
background-position: 95% center;
&:focus {
color: contrast(@inputColor, #222222, #f4f4f4);
background-color: @inputColor;
border: 1px solid darken(@inputColor, 10%);
background-position: 150% center;
}
}
.inputGroup.is-valid &,
&.is-valid {
color: darken(@inputValidColor, 15%);
border-color: @inputValidColor;
background-color: lighten(@inputValidColor, 40%);
background-image: url(../icons/check.svg);
background-position: 95% center;
&:focus {
color: contrast(@inputColor, #222222, #f4f4f4);
background-color: @inputColor;
border: 1px solid darken(@inputColor, 10%);
background-position: 150% center;
}
}
&.is-readonly,
&:read-only {
color: contrast(@inputColor, #222222, #f4f4f4);
cursor: default;
box-shadow: none;
border: 1px dashed darken(@inputColor,15%);
border-bottom-style: solid;
background-color: darken(@inputColor, 5%);
}
&.is-disabled,
&:disabled {
color: #aaaaaa;
cursor: not-allowed;
box-shadow: none;
border: 1px dashed darken(@inputColor,20%);
background-color: darken(@inputColor, 5%);
background-image:url('../icons/not-allowed.svg');
background-position: 95% center;
}
}
// placeholder text color
.input::-webkit-input-placeholder {color:lighten(contrast(@inputColor, #222222, #f4f4f4), 50%); opacity: 1;}
.input:-moz-placeholder {color:lighten(contrast(@inputColor, #222222, #f4f4f4), 50%); opacity: 1;}
.input::-moz-placeholder {color:lighten(contrast(@inputColor, #222222, #f4f4f4), 50%); opacity: 1;}
.input:-ms-input-placeholder {color:lighten(contrast(@inputColor, #222222, #f4f4f4), 50%); opacity: 1;}
// required input
// readonly inputs
// textareas
.input-vContrast {
background-color: darken(@inputColor,5%);
border: 1px solid darken(@inputColor,15%);
color:contrast(darken(@inputColor,5%), #000000, #ffffff);
}
.input-vSmall {
width: 180px;
padding: 3px 7px;
font-size: .8em;
font-weight: 400;
}
.input-vLarge {
padding: 8px 11.5px;
font-size: 1.25em;
width: 280px;
}
.input-vBlock {
width: 100%;
margin: 0;
}
// Place a input or textarea as block next to a label
.label + .input-vBlock {
width: calc(~"100% - 154px");
}
.label + .textarea-vBlock {
width: calc(~"100% - 150px");
margin-top: 6px;
}
.label {
vertical-align: middle;
display: inline-block;
padding: 7px 14px;
background-color: darken(@inputColor,2%);
border: 1px solid darken(@inputColor,12%);
color:contrast(darken(@inputColor,2%), #000000, #ffffff);
margin:6px 0;
min-width: 150px;
.inputGroup.is-required &,
&.is-required {
border-left: 2px solid @inputRequiredColor;
color: @inputRequiredColor;
font-weight: 600;
}
.inputGroup.is-required &:after,
&.is-required:after {
content:'\00a0*';
}
.inputGroup.is-invalid &,
&.is-invalid {
color: darken(@inputDangerColor, 25%);
border-color: @inputDangerColor;
background-color: lighten(@inputDangerColor, 20%);
}
.inputGroup.is-recommended &,
&.is-recommended {
color: darken(@inputHintColor, 25%);
border-color: @inputHintColor;
background-color: lighten(@inputHintColor, 20%);
}
.inputGroup.is-valid &,
&.is-valid {
color: darken(@inputValidColor, 25%);
border-color: @inputValidColor;
background-color: lighten(@inputValidColor, 20%);
}
&.is-disabled,
&:disabled {
color:#777777;
cursor: not-allowed;
box-shadow: none;
border: 1px dashed darken(@inputColor,20%);
background-color: darken(@inputColor, 5%);
}
&.has-icon:before {
content: "";
position: relative;
display: inline-block;
height: 1em;
width: 1em;
vertical-align: text-top;
margin: 4px 7px 0 -4px;
background-size: cover;
background-position: top left;
background-repeat: no-repeat;
background-color: inherit;
background-blend-mode: multiply;
//set background-image via icon.less
}
.icon {margin: 4px 4px 0 -4px;}
}
.label-vSmall {
padding: 3px 7px;
font-size: .8em;
font-weight: 400;
}
.label-vBlock {
width: 100%;
margin: 0;
}
.select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border-radius: 0px;
vertical-align: middle;
display: inline-block;
padding: 8px 20px;
padding-right: 38px;
background-color: #ffffff;
border: 1px solid #dddddd;
.arrowsUpDownBg(); //import from image.less: arrows (up and down) in base64
background-size: 20px;
background-repeat: no-repeat;
background-position: right center;
transition: all .3s ease;
&:hover {
box-shadow: @inputHoverShadow;
}
}
.select-vSmall {
padding: 3px 7px 4px;
font-size: .8em;
font-weight: 400;
background-size: 10px;
}
.inputGroup {
display: block;
margin-bottom: 15px;
&:after {
content: '';
display: block;
clear: both; // Clearfix for inputGroup.
height: 0;
}
}
.inputGroup .input,
.inputGroup .btn,
.inputGroup .select,
.inputGroup .label,
.inputGroup .switch,
.inputGroup > .radio,
.inputGroup .optionGroup {
margin: 6px 0px;
float: left;
position: relative;
}
.inputGroup .input,
.inputGroup .label,
.inputGroup .textarea,
.inputGroup .switch,
.inputGroup > .radio,
.inputGroup .optionGroup {
box-shadow: @inputShadow;
}
.inputGroup .label {
&:first-child{border-right-width:0;}
&:last-child{border-left-width: 0;}
}
.inputGroup .btn {
margin-left: -1px;
}
// Use formGroups to separate different inputs or inputGroups.
.formGroup {
margin-bottom: 15px;
}
.textarea {
resize: none;
margin-top: 6px;
padding: 7px 14px;
width: 250px;
height: 180px;
background-color: @inputColor;
border: 1px solid darken(@inputColor,10%);
color:contrast(@inputColor, #222222, #f4f4f4);
transition: all .3s ease;
background-position: 150% center;
background-size: 15px;
background-repeat: no-repeat;
text-align: left;
}
.textarea-vBlock {
width:100%;
margin: 0;
}
.checkbox {
margin-right: 5px;
cursor: pointer;
}
.note {
font-size: 0.8em;
margin: 0;
}
.note-vOffset {
padding-left: 22px;
}
// A simple, yet elegant, boolean switch.
.switch {
margin: 6px 0;
vertical-align: middle;
display: inline-block;
padding: 7px 14px;
background-color: darken(@inputColor, 2%);
border: 1px solid darken(@inputColor, 12%);
color: contrast(darken(@inputColor, 2%), #000000, #ffffff);
}
.switch-input {
display: none;
&:checked + .switch-label {
background: lighten(@inputValidColor, 20%);
}
&:checked + .switch-label:after {
left: 50%;
}
}
.switch-label {
background: darken(@inputColor, 10%);
padding: 2px;
transition: all .4s ease;
outline: 0;
display: block;
width: 3em;
height: 1.5em;
position: relative;
cursor: pointer;
user-select: none;
&:after {
left: 0;
position: relative;
display: block;
content: "";
width: 50%;
height: 100%;
background: #fff;
transition: all .2s ease;
box-shadow: @inputShadow;
}
}
.radio {
margin: 6px 0;
vertical-align: middle;
display: inline-block;
background-color: darken(@inputColor, 2%);
border: 1px solid darken(@inputColor, 12%);
color: contrast(darken(@inputColor, 2%), #000000, #ffffff);
}
.radio-input {
opacity: 0;
position: absolute;
}
.radio-label {
position: relative;
display: inline-block;
padding: 7px 14px;
outline: 0;
cursor: pointer;
&:before {
content:'';
background: #fff;
border: 2px solid darken(@inputColor, 10%);;
display: inline-block;
vertical-align: middle;
width: 1em;
height: 1em;
margin-right: 10px;
margin-top:-2px;
text-align: center;
border-radius: 50%;
transition: all .4s ease;
box-shadow: inset 0px 0px 0px 2px #fff;
}
&:hover {
background-color: @inputColor;
}
}
.radio-input:checked + .radio-label:before {
background: lighten(@inputValidColor, 20%);
border: 2px solid lighten(@inputValidColor, 10%);
}
.check {
margin: 6px 0;
vertical-align: middle;
display: inline-block;
background-color: darken(@inputColor, 2%);
border: 1px solid darken(@inputColor, 12%);
color: contrast(darken(@inputColor, 2%), #000000, #ffffff);
}
.check-input {
opacity: 0;
position: absolute;
}
.check-label {
position: relative;
display: inline-block;
padding: 7px 14px;
outline: 0;
cursor: pointer;
&:before {
content:'';
background: #fff;
border: 2px solid darken(@inputColor, 10%);;
display: inline-block;
vertical-align: middle;
width: 1em;
height: 1em;
margin-right: 10px;
margin-top:-2px;
text-align: center;
transition: all .4s ease;
box-shadow: inset 0px 0px 0px 2px #fff;
}
&:hover {
background-color: @inputColor;
}
}
.check-input:checked + .check-label:before {
background: lighten(@inputValidColor, 20%);
border: 2px solid lighten(@inputValidColor, 10%);
}
.optionGroup {
display: flex;
flex-direction: column;
.check,
.radio {
margin:0;
border-width: 0 1px;
&:first-child {
border-width: 1px;
border-bottom-width: 0;
}
&:last-child {
border-width: 1px;
border-top-width: 0;
}
}
}
.optionGroup-vSelectionList {
max-height: 150px;
overflow-y: auto;
overflow-x: hidden;
.radio,
.check {flex:1 0 auto;}
.radio-label,
.check-label {
white-space: nowrap;
padding-right: 30px;
}
.radio:not(:last-child) .radio-label,
.check:not(:last-child) .check-label {
border-bottom: 1px solid darken(@inputColor, 20%);
}
.radio-label:before,
.check-label:before {content:none;}
.radio-input:checked + .radio-label,
.check-input:checked + .check-label {
background: lighten(@inputValidColor, 20%);
border-bottom: 1px solid lighten(@inputValidColor, 10%);
color: #fff;
&:hover {
background-color: lighten(@inputValidColor, 10%);;
}
}
}
// Use .formActions to float submit buttons to the right at the end of your form.
// #DEPRECATED: .formActions are deprecated -- please use the .bar element instead.
.formActions {
&:after {
content: '';
display: block;
clear: both; // Clearfix for formActions.
height: 0;
}
.btn {float:right;}
.btn+.btn {margin-right: 10px;}
}
// => form Media Queries
.media-mixin(@break) when (@break = @breakSmall) {
.inputGroup .label,
.label {
border-width: 0 1px;
width: 100%;
margin: 0;
&:first-child{
border-width:1px;
border-bottom-width: 0;
}
&:last-child{
border-width: 1px;
border-top-width: 0;
}
}
.inputGroup .input,
.inputGroup .label,
.inputGroup .switch,
.inputGroup .textarea,
.inputGroup > .radio,
.inputGroup > .check,
.inputGroup .optionGroup {
box-shadow: none;
}
.input,
.label + .input-vBlock,
.label + .textarea-vBlock,
.select,
.switch,
.radio {
width: 100%;
margin: 0;
margin-bottom: 5px;
}
.inputGroup .select,
.inputGroup .input,
.inputGroup .btn,
.inputGroup .switch,
.inputGroup .textarea,
.inputGroup > .radio,
.inputGroup > .check,
.inputGroup .optionGroup,
.optionGroup .radio,
.optionGroup .check {
width: 100%;
margin: 0;
}
.inputGroup .btn {
margin-top: -1px;
}
}
.media-mixin(@break) when (@break = @breakLarge) {
}
.media-mixin(@break) when (@break = @breakPrint) {
}