devroom.io/content/css/zurb-foundation/foundation/components/_custom-forms.scss

241 lines
7.9 KiB
SCSS
Raw Normal View History

2013-06-07 12:35:24 +00:00
//
// Custom Form Variables
//
// We use these to control the basic form styles input styles
$custom-form-border-color: #ccc !default;
$custom-form-bg: #fff !default;
$custom-form-bg-disabled: #ddd !default;
$custom-form-check-color: #222 !default;
// We use these to style the custom select form element.
$custom-select-bg: #fff !default;
$custom-select-fade-to-color: #f3f3f3 !default;
$custom-select-border-color: #ddd !default;
$custom-select-triangle-color: #aaa !default;
$custom-select-triangle-color-open: #222 !default;
$custom-select-height: emCalc(13px) + ($form-spacing * 1.5) !default;
$custom-select-margin-bottom: emCalc(20px) !default;
$custom-select-font-color-selected: #141414 !default;
$custom-select-disabled-color: #888 !default;
// We use these to control the style of the custom select dropdown element.
$custom-dropdown-height: 200px !default;
$custom-dropdown-bg: #fff !default;
$custom-dropdown-border-color: darken(#fff, 20%) !default;
$custom-dropdown-border-width: 1px !default;
$custom-dropdown-border-style: solid !default;
$custom-dropdown-font-color: #555 !default;
$custom-dropdown-font-size: emCalc(14px) !default;
$custom-dropdown-color-selected: #eeeeee !default;
$custom-dropdown-font-color-selected: #000 !default;
$custom-dropdown-shadow: 0 2px 2px 0px rgba(0,0,0,0.1) !default;
$custom-dropdown-offset-top: auto !default;
$custom-dropdown-list-padding: emCalc(4px) !default;
$custom-dropdown-default-float-padding: emCalc(6px) !default;
$custom-dropdown-opposite-padding: emCalc(38px) !default;
$custom-dropdown-list-item-min-height: emCalc(24px) !default;
$custom-dropdown-width-small: 134px !default;
$custom-dropdown-width-medium: 254px !default;
$custom-dropdown-width-large: 434px !default;
// We decided not to make a mixin for the custom forms because
// they rely on a very specific class naming structure.
// We may look at updating this in the future.
// Only include these classes if the variable is true, otherwise they'll be left out.
@if $include-html-button-classes {
/* Custom Checkbox and Radio Inputs */
form.custom {
.custom {
display: inline-block;
width: 16px;
height: 16px;
position: relative;
top: 2px;
border: solid 1px $custom-form-border-color;
background: $custom-form-bg;
&.radio { @include radius(1000px); }
&.checkbox {
&:before {
content: "";
display: block;
line-height: 0.8;
height: 14px;
width: 14px;
text-align: center;
position: absolute;
top: 0;
#{$default-float}: 0;
font-size: 14px;
color: #fff;
}
}
&.radio.checked {
&:before {
content: "";
display: block;
width: 8px;
height: 8px;
@include radius(1000px);
background: $custom-form-check-color;
position: relative;
top: 3px;
#{$default-float}: 3px;
}
}
&.checkbox.checked {
&:before {
content: "\00d7";
color: $custom-form-check-color;
}
}
}
}
/* Custom Select Options and Dropdowns */
form.custom {
.custom.dropdown {
display: block;
position: relative;
top: 0;
height: $custom-select-height;
margin-bottom: $custom-select-margin-bottom;
margin-top: 0px;
padding: 0px;
width: 100%;
background: $custom-dropdown-bg;
background: -moz-linear-gradient(top, $custom-dropdown-bg 0%, $custom-select-fade-to-color 100%);
background: -webkit-linear-gradient(top, $custom-dropdown-bg 0%,$custom-select-fade-to-color 100%);
background: linear-gradient(to bottom, $custom-dropdown-bg 0%,$custom-select-fade-to-color 100%);
-webkit-box-shadow: none;
box-shadow: none;
font-size: $custom-dropdown-font-size;
vertical-align: top;
ul {
overflow-y: auto;
max-height: $custom-dropdown-height;
}
.current {
cursor:default;
white-space: nowrap;
line-height: $custom-select-height - emCalc(1px);
color: $input-font-color;
text-decoration: none;
overflow: hidden;
display: block;
margin-#{$default-float}: $form-spacing / 2;
margin-#{$opposite-direction}: $custom-select-height;
}
.selector {
cursor:default;
position: absolute;
width: $form-spacing * 2.5;
height: $custom-select-height;
display: block;
#{$opposite-direction}: 0;
top: 0;
&:after {
content: "";
display: block;
@include css-triangle(5px, $custom-select-triangle-color, top);
position: absolute;
#{$default-float}: ($form-spacing * 2.5) / 2 - emCalc(5px);
top: 50%;
margin-top: -3px;
}
}
&:hover, &.open {
a.selector {
&:after { @include css-triangle(5px, $custom-select-triangle-color-open, top); }
}
}
.disabled {
color: $custom-select-disabled-color;
&:hover {
background: transparent;
color: $custom-select-disabled-color;
&:after { display: none; }
}
}
&.open ul {
display: block;
z-index: 10;
min-width:100%;
@include box-sizing(content-box);
}
&.small { max-width: $custom-dropdown-width-small; }
&.medium { max-width: $custom-dropdown-width-medium; }
&.large { max-width: $custom-dropdown-width-large; }
&.expand { width: 100% !important; }
&.open.small ul { min-width: $custom-dropdown-width-small; @include box-sizing(border-box); }
&.open.medium ul { min-width: $custom-dropdown-width-medium; @include box-sizing(border-box); }
&.open.large ul { min-width: $custom-dropdown-width-large; @include box-sizing(border-box); }
}
.custom.dropdown ul {
position: absolute;
width: auto;
display: none;
margin: 0;
#{$default-float}: -$input-border-width;
top: $custom-dropdown-offset-top;
-webkit-box-shadow: $custom-dropdown-shadow;
box-shadow: $custom-dropdown-shadow;
margin: 0;
padding: 0;
background: $custom-dropdown-bg;
border: $custom-dropdown-border-style $custom-dropdown-border-width $custom-dropdown-border-color;
font-size: $em-base;
li {
color: $custom-dropdown-font-color;
font-size: $custom-dropdown-font-size;
cursor: default;
padding-top: $custom-dropdown-list-padding;
padding-bottom: $custom-dropdown-list-padding;
padding-#{$default-float}: $custom-dropdown-default-float-padding;
padding-#{$opposite-direction}: $custom-dropdown-opposite-padding;
min-height: $custom-dropdown-list-item-min-height;
line-height: $custom-dropdown-list-item-min-height;
margin: 0;
white-space: nowrap;
list-style: none;
&.selected {
background: $custom-dropdown-color-selected;
color: $custom-dropdown-font-color-selected;
}
&:hover {
background-color: darken($custom-dropdown-color-selected, 4%);
color: $custom-dropdown-font-color-selected;
}
&.selected:hover {
background: $custom-dropdown-color-selected;
cursor: default;
color: $custom-dropdown-font-color-selected;
}
}
&.show { display: block; }
}
/* Custom input, disabled */
.custom.disabled { background-color: $custom-form-bg-disabled; }
}
}