mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
254 lines
5.1 KiB
SCSS
254 lines
5.1 KiB
SCSS
|
|
// Forms
|
|
// -------------------------------
|
|
|
|
// Make all forms have space below them
|
|
form {
|
|
margin: 0 0 $line-height-base;
|
|
}
|
|
|
|
// Groups of fields with labels on top (legends)
|
|
legend {
|
|
display: block;
|
|
margin-bottom: $line-height-base;
|
|
padding: 0;
|
|
width: 100%;
|
|
border: 0;
|
|
border-bottom: 1px solid #e5e5e5;
|
|
color: $gray-dark;
|
|
font-size: $font-size-base * 1.5;
|
|
line-height: $line-height-base * 2;
|
|
|
|
// Small
|
|
small {
|
|
color: $gray-light;
|
|
font-size: $line-height-base * .75;
|
|
}
|
|
}
|
|
|
|
// Set font for forms
|
|
label,
|
|
input,
|
|
button,
|
|
select,
|
|
textarea {
|
|
@include font-shorthand($font-size-base, normal, $line-height-base); // Set size, weight, line-height here
|
|
}
|
|
input,
|
|
button,
|
|
select,
|
|
textarea {
|
|
font-family: $base-font-family; // And only set font-family here for those that need it (note the missing label element)
|
|
}
|
|
|
|
|
|
// Input groups
|
|
// -------------------------------
|
|
|
|
.input-group {
|
|
display: block;
|
|
overflow: hidden;
|
|
border-top: $input-border-width solid $input-border-color;
|
|
border-bottom: $input-border-width solid $input-border-color;
|
|
background-color: $input-bg;
|
|
}
|
|
.padded > .input-group,
|
|
.input-group.margin {
|
|
@include border-radius($input-border-radius);
|
|
border-right: $input-border-width solid $input-border-color;
|
|
border-left: $input-border-width solid $input-border-color;
|
|
}
|
|
|
|
.input-group .input-row + .input-row {
|
|
border-top: $input-border-width solid $input-border-color;
|
|
}
|
|
|
|
.input-group + .input-group {
|
|
margin-top: $content-padding;
|
|
}
|
|
|
|
.input-row {
|
|
position: relative;
|
|
display: -webkit-flex;
|
|
display: flex;
|
|
overflow: hidden;
|
|
padding: 6px 8px 5px;
|
|
|
|
input {
|
|
@include border-radius(0);
|
|
margin: 0;
|
|
background-color: transparent;
|
|
flex: 1 0 220px;
|
|
-webkit-appearance: none;
|
|
}
|
|
|
|
.input-label {
|
|
padding: 7px 10px 7px 3px;
|
|
max-width: 200px;
|
|
color: $input-label-color;
|
|
font-weight: bold;
|
|
flex: 1 0 100px;
|
|
}
|
|
[class^="icon-"], [class*=" icon-"] {
|
|
display: inline-block;
|
|
text-align: center;
|
|
font-size: 16px;
|
|
flex: 0 0 24px;
|
|
align-self: center;
|
|
}
|
|
.placeholder-icon {
|
|
color: #999;
|
|
}
|
|
}
|
|
|
|
.input-group.stacked-label,
|
|
.input-group.stacked-label .input-row {
|
|
display: block;
|
|
border: 0;
|
|
background-color: transparent;
|
|
|
|
.input-label, [class^="icon-"], [class*=" icon-"] {
|
|
display: inline-block;
|
|
padding: 4px 0;
|
|
vertical-align: middle;
|
|
}
|
|
}
|
|
|
|
.input-group.stacked-label input,
|
|
.input-group.stacked-label textarea
|
|
{
|
|
@include border-radius($input-border-radius);
|
|
overflow: hidden;
|
|
padding: 4px 8px 3px;
|
|
border: $input-border-width solid $input-border-color;
|
|
background-color: $input-bg;
|
|
}
|
|
.input-group.stacked-label input {
|
|
height: $line-height-computed + $font-size-base + 12px;
|
|
}
|
|
|
|
|
|
// Form Controls
|
|
// -------------------------------
|
|
|
|
// Shared size and type resets
|
|
select,
|
|
textarea,
|
|
input[type="text"],
|
|
input[type="password"],
|
|
input[type="datetime"],
|
|
input[type="datetime-local"],
|
|
input[type="date"],
|
|
input[type="month"],
|
|
input[type="time"],
|
|
input[type="week"],
|
|
input[type="number"],
|
|
input[type="email"],
|
|
input[type="url"],
|
|
input[type="search"],
|
|
input[type="tel"],
|
|
input[type="color"] {
|
|
display: inline-block;
|
|
height: $line-height-computed + $font-size-base;
|
|
color: $gray;
|
|
vertical-align: middle;
|
|
font-size: $font-size-base;
|
|
line-height: $line-height-computed;
|
|
}
|
|
|
|
input,
|
|
textarea {
|
|
width: 100%;
|
|
}
|
|
|
|
// Reset height since textareas have rows
|
|
textarea {
|
|
height: auto;
|
|
}
|
|
|
|
// Everything else
|
|
textarea,
|
|
input[type="text"],
|
|
input[type="password"],
|
|
input[type="datetime"],
|
|
input[type="datetime-local"],
|
|
input[type="date"],
|
|
input[type="month"],
|
|
input[type="time"],
|
|
input[type="week"],
|
|
input[type="number"],
|
|
input[type="email"],
|
|
input[type="url"],
|
|
input[type="search"],
|
|
input[type="tel"],
|
|
input[type="color"] {
|
|
border: 0;
|
|
}
|
|
|
|
// Position radios and checkboxes better
|
|
input[type="radio"],
|
|
input[type="checkbox"] {
|
|
margin: 0;
|
|
line-height: normal;
|
|
}
|
|
|
|
// Reset width of input images, buttons, radios, checkboxes
|
|
input[type="file"],
|
|
input[type="image"],
|
|
input[type="submit"],
|
|
input[type="reset"],
|
|
input[type="button"],
|
|
input[type="radio"],
|
|
input[type="checkbox"] {
|
|
width: auto; // Override of generic input selector
|
|
}
|
|
|
|
// Set the height of select and file controls to match text inputs
|
|
select,
|
|
input[type="file"] {
|
|
line-height: $input-height-base;
|
|
}
|
|
|
|
// Make select elements obey height by applying a border
|
|
select {
|
|
border: $input-border-width solid $input-border-color;
|
|
background-color: $input-bg; // Chrome on Linux and Mobile Safari need background-color
|
|
}
|
|
|
|
// Make multiple select elements height not fixed
|
|
select[multiple],
|
|
select[size] {
|
|
height: auto;
|
|
}
|
|
|
|
|
|
// Placeholder
|
|
// -------------------------------
|
|
input,
|
|
textarea {
|
|
@include placeholder();
|
|
}
|
|
|
|
|
|
// DISABLED STATE
|
|
// -------------------------------
|
|
|
|
// Disabled and read-only inputs
|
|
input[disabled],
|
|
select[disabled],
|
|
textarea[disabled],
|
|
input[readonly],
|
|
select[readonly],
|
|
textarea[readonly] {
|
|
background-color: $input-bg-disabled;
|
|
cursor: not-allowed;
|
|
}
|
|
// Explicitly reset the colors here
|
|
input[type="radio"][disabled],
|
|
input[type="checkbox"][disabled],
|
|
input[type="radio"][readonly],
|
|
input[type="checkbox"][readonly] {
|
|
background-color: transparent;
|
|
}
|
|
|