embd/bower_components/gumby/sass/ui/_forms.scss

393 lines
8.2 KiB
SCSS

/* Form Styles */
@import "../functions/forms";
form {
margin: 0 0 18px;
label {
display: block;
@include font-size($norm);
@include adjust-leading-to(1);
cursor: pointer;
margin-bottom: 9px;
&.inline {
display: inline-block;
padding-right: 20px;
}
}
dt {
margin: 0;
}
textarea {
height: 150px;
}
ul, ul li {
margin-left: 0;
list-style-type: none;
}
fieldset {
@include rhythm-borders(1px,1,$norm,solid);
border-color: darken($default-color, 10%);
margin: 18px 0;
legend {
padding: 5px 10px;
}
}
}
.field {
position: relative;
max-width: 100%;
margin-bottom: 10px;
vertical-align: middle;
// Font-size 16px for weird form style error
font-size: 16px;
overflow: hidden;
&.metro, .metro {
@include border-radius(0);
}
input, input[type="*"], textarea {
max-width: 100%;
width: 100%;
padding: 0;
margin: 0;
border: none;
outline: none;
resize: none;
-webkit-appearance: none;
font-family: $font-family;
font-weight: $font-weight-light;
@include font-size($norm);
@include box-shadow(none);
}
.input {
position: relative;
padding: 0 10px;
background: #fff;
border: 1px solid darken($default-color, 10%);
@include line-and-height(height-calc($norm));
@include font-size($norm);
@include border-radius(4px);
&.search {
@include line-and-height(height-calc($norm));
@include shape(oval);
padding-right: 0;
}
}
.input.textarea {
height: auto;
}
}
input, .input {
@each $width in $field-sizes {
&.#{nth($width, 1)} {
@include input-size(#{nth($width, 1)});
margin:0;
&:last-child {
margin-left: -4px;
}
&:first-child {
margin-right: 3.94%;
margin-left: 0;
}
&:first-child:last-child {
margin: 0;
}
}
}
}
label + {
@include input-sizes-list() {
&:last-child {
margin-left: 0;
}
}
}
@include respond(document-width) {
.xxwide:first-child, .xxwide:last-child {
margin-right: 0%;
}
}
/* remove inline-block white-space — A 0px font-size = 0px of white space */
.prepend, .append {
font-size: 0;
white-space: nowrap;
padding-bottom: 3.5px;
}
.prepend input,
.prepend .input,
.append input,
.append .input {
display: inline-block;
max-width: 100%;
margin-right: 0;
margin-left: 0;
}
.prepend input,
.prepend .input,
.prepend.append input:last-child,
.append *:last-child {
@include border-radius(0px $button-radius $button-radius 0);
}
.append input,
.append .input,
.prepend.append input:first-child,
.prepend *:first-child {
@include border-radius($button-radius 0 0 $button-radius);
}
.prepend.append input {
@include border-radius(0);
}
.prepend.append input:last-child {
margin-left: -1px;
}
.prepend .adjoined, .append .adjoined, .prepend .btn, .append .btn {
position: relative;
display: inline-block;
margin-bottom:0;
z-index: 99;
}
.prepend .btn, .append .btn {
a, input, button {
padding: 0 12px;
}
}
.prepend .adjoined, .append .adjoined {
padding: 0 10px 0 10px;
background: $default-color;
border: 1px solid darken($default-color, 10%);
font-family: $font-family;
font-weight: $font-weight-semibold;
color: $body-font-color;
@include font-size($norm);
@include line-and-height(height-calc($norm));
}
.prepend .adjoined, .prepend .btn {
margin-right: -1px;
}
.adjoined:first-child {
margin-left: 0 !important;
}
.append .adjoined, .append .btn {
margin-left: -1px;
}
.append button, .prepend button {
display: inline-block;
}
.prepend input:first-child,
.append input:first-child,
.prepend .input:first-child,
.append .input:first-child {
margin-right: 0;
}
.double input, .double .input {
width: 50% !important;
&:last-child {
margin-left: -1px;
}
}
.field {
input, .input, textarea, .textarea, .radio span, .checkbox span, .picker {
@include transition-duration(.2s);
}
@each $error in danger $danger-color, warning $warning-color, success $success-color {
&.#{nth($error, 1)} {
&:after {
@if($icons != ""){
font-family: "#{$icons}";
@if nth($error, 1) == danger {
content: "#{$entypo-icon-cancel-circled}";
}
@if nth($error, 1) == warning {
content: "#{$entypo-icon-attention}";
}
@if nth($error, 1) == success {
content: "#{$entypo-icon-check}";
}
font-size: $norm;
position: absolute;
top: percentage((strip-units($base-font-size)) / 100) - 2;
right: 15px;
z-index: 999;
color: nth($error, 2);
}
}
&.no-icon:after {
display: none;
}
// <input> does not allow :before & :after
// pseudo elements. Removing validation
// icons from those elements to avoid
// edge-case styling issues
&.append:after, &.prepend:after {
content: "";
}
input, .input, textarea, .textarea, .radio span, .checkbox span, .picker {
border-color: nth($error, 2);
background: lighten(nth($error, 2), 35%);
}
input, .input, textarea, .textarea,
.radio span, .checkbox span, .picker,
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder,
input:-moz-placeholder,
textarea:-moz-placeholder
textarea { color: nth($error, 2); }
}
}
.picker {
@each $error in danger $danger-color, warning $warning-color, success $success-color {
&.#{nth($error, 1)} {
border-color: nth($error, 2);
color: nth($error, 2);
background: lighten(nth($error, 2), 35%);
@include transition-duration(.2s);
select, &:after { color: nth($error, 2); }
}
}
}
}
.field .text input[type="search"] {
-webkit-appearance: textfield;
}
// checkboxes/radio buttons only styled where JS supported
.no-js {
.radio input {
-webkit-appearance: radio;
margin-left: 1px;
}
.checkbox input {
-webkit-appearance: checkbox;
}
.radio input, .checkbox input {
display: inline-block;
width: 16px;
}
}
.js .field {
.radio, .checkbox {
@each $error in danger $danger-color, warning $warning-color, success $success-color {
&.#{nth($error, 1)} {
color: nth($error, 2);
@if nth($error, 1) == success {
color: $body-font-color;
i { color: nth($error, 2); }
}
span {
border-color: nth($error, 2);
color: nth($error, 2);
background: lighten(nth($error, 2), 35%);
@include transition-duration(.2s);
}
}
}
position: relative;
&.checked i {
position: absolute;
top: -1px;
left: -8px;
line-height: 16px;
}
span {
display: inline-block;
width: 16px;
height: 16px;
position: relative;
top: 2px;
border: solid 1px #ccc;
background: #fefefe;
}
input[type="radio"], input[type="checkbox"] {
display: none;
}
}
.radio span {
@include border-radius(8px);
}
.checkbox span {
@include border-radius(3px);
}
}
.field .text input[type="search"] {
-webkit-appearance: textfield;
}
/* Form Picker Element (<select>) */
.picker {
position: relative;
width: auto;
display: inline-block;
margin: 0 0 2px 1.2%;
overflow: hidden;
border: 1px solid darken($default-color, 5%);
@include border-radius(4px);
font-family: $font-family;
font-weight: $font-weight-semibold;
height: auto;
@include background-image(linear-gradient(lighten($default-color, 20%), $default-color));
&:after {
content: "\25BE";
font-family: $icons;
z-index: 0;
position:absolute;
right: 8%;
top: 50%;
margin-top: -12px;
color: $body-font-color;
}
&:first-child {
margin-left: 0;
}
select {
position: relative;
display: block;
min-width: 100%;
width: 135%;
height: 34px;
padding: 6px 45px 6px 15px;
color: $body-font-color;
border: none;
background: transparent;
outline: none;
-webkit-appearance: none;
z-index: 99;
cursor: pointer;
@include font-size($norm);
}
select::-ms-expand {
display: none;
}
}