Commit 51b1a027 authored by Mark Otto's avatar Mark Otto

Merge branch 'bs3-input-groups' into 3.0.0-wip

Conflicts:
	docs/assets/css/bootstrap.css
parents 840e47ea 26b999b7
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
cursor: pointer; cursor: pointer;
white-space: nowrap;
.buttonBackground(@btn-background, @btn-background-highlight, @grayDark, 0 1px 1px rgba(255,255,255,.75)); .buttonBackground(@btn-background, @btn-background-highlight, @grayDark, 0 1px 1px rgba(255,255,255,.75));
border: 1px solid @btn-border; border: 1px solid @btn-border;
border-bottom-color: darken(@btn-border, 10%); border-bottom-color: darken(@btn-border, 10%);
......
...@@ -216,5 +216,4 @@ ...@@ -216,5 +216,4 @@
// --------- // ---------
.typeahead { .typeahead {
z-index: 1051; z-index: 1051;
margin-top: 2px; // give it some space to breathe
} }
...@@ -422,273 +422,112 @@ select:focus:invalid { ...@@ -422,273 +422,112 @@ select:focus:invalid {
// INPUT GROUPS
// ------------
// Allow us to put symbols and text within the input field for a cleaner look
.input-append,
.input-prepend {
margin-bottom: 5px;
font-size: 0; // white space collapse hack
white-space: nowrap; // Prevent span and input from separating
// Reset the white space collapse hack // Input groups
input, // --------------------------------------------------
select,
.uneditable-input,
.dropdown-menu {
font-size: @font-size-base;
}
input, // Base styles
select, // -------------------------
.uneditable-input { .input-group {
position: relative; // placed here by default so that on :focus we can place the input above the .add-on for full border and box-shadow goodness display: table;
float: none; // Undo the float from grid sizing
margin: 0; // Prevent bottom margin from screwing up alignment in stacked forms
font-size: @font-size-base;
vertical-align: top;
border-radius: 0 @input-border-radius @input-border-radius 0;
// Make input on top when focused so blue border and shadow always show
&:focus {
z-index: 2;
}
}
input[class*="span"],
select[class*="span"],
.uneditable-input[class*="span"] {
margin: 0;
}
.add-on {
display: inline-block;
width: auto;
height: @line-height-base;
min-width: 16px;
padding: 6px;
font-size: @font-size-base;
font-weight: normal;
line-height: @line-height-base;
text-align: center;
text-shadow: 0 1px 0 #fff;
background-color: @grayLighter;
border: 1px solid #ccc;
}
.add-on,
.btn,
.btn-group > .dropdown-toggle {
vertical-align: top;
border-radius: 0;
}
.active {
background-color: @state-success-background;
border-color: @state-success-text;
}
}
.input-prepend { // Undo padding and float of grid classes
.add-on, &[class*="span"] {
.btn { float: none;
margin-right: -1px; padding: 0;
} }
.add-on:first-child,
.btn:first-child {
// FYI, `.btn:first-child` accounts for a button group that's prepended
border-radius: @input-border-radius 0 0 @input-border-radius;
}
}
.input-append {
input, input,
select, select,
.uneditable-input { .uneditable-input {
border-radius: @input-border-radius 0 0 @input-border-radius; width: 100%;
+ .btn-group .btn,
+ .btn-group .btn:last-child {
border-radius: 0 @input-border-radius @input-border-radius 0;
}
}
.add-on,
.btn,
.btn-group {
margin-left: -1px;
}
.add-on:last-child,
.btn:last-child,
.btn-group:last-child > .dropdown-toggle {
border-radius: 0 @input-border-radius @input-border-radius 0;
} }
} }
// Remove all border-radius for inputs with both prepend and append // Display as table-cell
.input-prepend.input-append { // -------------------------
input, .input-group-addon,
select, .input-group-btn,
.uneditable-input { .input-group input,
border-radius: 0; .input-group .uneditable-input {
+ .btn-group .btn { display: table-cell;
border-radius: 0 @input-border-radius @input-border-radius 0; margin: 0;
} border-radius: 0;
}
.add-on:first-child,
.btn:first-child {
margin-right: -1px;
border-radius: @input-border-radius 0 0 @input-border-radius;
}
.add-on:last-child,
.btn:last-child {
margin-left: -1px;
border-radius: 0 @input-border-radius @input-border-radius 0;
}
.btn-group:first-child {
margin-left: 0;
}
} }
// Addon and addon wrapper for buttons
.input-group-addon,
.input-group-btn {
width: 1%;
// SEARCH FORM vertical-align: middle; // Match the inputs
// -----------
input.search-query {
padding-right: 14px;
padding-right: 4px \9;
padding-left: 14px;
padding-left: 4px \9; /* IE8 doesn't have border radius, so don't indent the padding */
margin-bottom: 0; // Remove the default margin on all inputs
border-radius: @input-border-radius-search;
} }
/* Allow for input prepend/append in search forms */ // Text input groups
.form-search .input-append .search-query, // -------------------------
.form-search .input-prepend .search-query { .input-group-addon {
border-radius: 0; // Override due to specificity .box-sizing(border-box);
padding: 6px 8px;
font-size: @font-size-base;
font-weight: normal;
line-height: @line-height-base;
text-align: center;
text-shadow: 0 1px 0 #fff;
background-color: @grayLighter;
border: 1px solid #ccc;
} }
.form-search .input-append .search-query {
border-radius: @input-border-radius-search 0 0 @input-border-radius-search; // Reset rounded corners
.input-group input:first-child,
.input-group .uneditable-input:first-child,
.input-group-addon:first-child {
.border-left-radius(@border-radius-base);
} }
.form-search .input-append .btn { .input-group-addon:first-child {
border-radius: 0 @input-border-radius-search @input-border-radius-search 0; border-right: 0;
} }
.form-search .input-prepend .search-query { .input-group input:last-child,
border-radius: 0 @input-border-radius-search @input-border-radius-search 0; .input-group .uneditable-input:last-child,
.input-group-addon:last-child {
.border-right-radius(@border-radius-base);
} }
.form-search .input-prepend .btn { .input-group-addon:last-child {
border-radius: @input-border-radius-search 0 0 @input-border-radius-search; border-left: 0;
} }
// Button input groups
// -------------------------
.input-group-btn,
// HORIZONTAL & VERTICAL FORMS .input-group-btn .btn {
// --------------------------- white-space: nowrap;
// Common properties
// -----------------
.form-search,
.form-inline,
.form-horizontal {
input,
textarea,
select,
.help-inline,
.uneditable-input,
.input-prepend,
.input-append {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
// Re-hide hidden elements due to specifity
.hide {
display: none;
}
}
.form-search label,
.form-inline label,
.form-search .btn-group,
.form-inline .btn-group {
display: inline-block;
}
// Remove margin for input-prepend/-append
.form-search .input-append,
.form-inline .input-append,
.form-search .input-prepend,
.form-inline .input-prepend {
margin-bottom: 0;
} }
// Inline checkbox/radio labels (remove padding on left) .input-group-btn > .btn {
.form-search .radio, float: left; // Collapse white-space
.form-search .checkbox, border-radius: 0;
.form-inline .radio, + .btn {
.form-inline .checkbox { border-left: 0;
display: inline-block;
padding-left: 0;
label {
margin-bottom: 0;
vertical-align: middle;
} }
} }
// Remove float and margin, set to inline-block .input-group-btn.btn-group {
.form-search .radio input[type="radio"], display: table-cell;
.form-search .checkbox input[type="checkbox"],
.form-inline .radio input[type="radio"],
.form-inline .checkbox input[type="checkbox"] {
float: left;
margin-right: 3px;
margin-left: 0;
}
// Margin to space out fieldsets
.control-group {
margin-bottom: @line-height-base / 2;
}
// Legend collapses margin, so next element is responsible for spacing
legend + .control-group {
margin-top: @line-height-base;
-webkit-margin-top-collapse: separate;
} }
// Prepend
// Horizontal-specific styles .input-group-btn {
// -------------------------- &:first-child > .btn,
&.btn-group:first-child > .btn {
.form-horizontal { border-right: 0;
// Increase spacing between groups
.control-group {
margin-bottom: @line-height-base;
.clearfix();
}
// Float the labels left
.control-label {
float: left;
width: @component-offset-horizontal - 20;
padding-top: 5px;
text-align: right;
} }
// Move over all input controls and content &:first-child > .btn,
.controls { &.btn-group:first-child > .btn {
margin-left: @component-offset-horizontal; border-radius: @border-radius-base 0 0 @border-radius-base;
} }
// Remove bottom margin on block level help text since that's accounted for on .control-group }
.help-block { // Append
margin-bottom: 0; .input-group-btn {
} &:last-child > .btn,
// And apply it only to .help-block instances that follow a form control &.btn-group:last-child > .btn:first-child {
input, border-left: 0;
select,
textarea,
.uneditable-input,
.input-prepend,
.input-append {
+ .help-block {
margin-top: @line-height-base / 2;
}
} }
// Move over buttons in .form-actions to align with .controls &:last-child > .btn,
.form-actions { &.btn-group:last-child > .btn {
padding-left: @component-offset-horizontal; border-radius: 0 @border-radius-base @border-radius-base 0;
} }
} }
...@@ -76,8 +76,8 @@ ...@@ -76,8 +76,8 @@
// Buttons // Buttons
// ------------------------- // -------------------------
@btn-background: #fff; @btn-background: #fafafa;
@btn-background-highlight: darken(#fff, 10%); @btn-background-highlight: darken(@btn-background, 10%);
@btn-border: #bbb; @btn-border: #bbb;
@btn-backround-primary: @link-color; @btn-backround-primary: @link-color;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment