bootstrap-on-rails 0.0.2 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +16 -7
  4. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  5. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +47 -47
  6. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  7. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  8. data/app/assets/javascripts/bootstrap/affix.js +48 -32
  9. data/app/assets/javascripts/bootstrap/alert.js +14 -20
  10. data/app/assets/javascripts/bootstrap/button.js +34 -33
  11. data/app/assets/javascripts/bootstrap/carousel.js +60 -54
  12. data/app/assets/javascripts/bootstrap/collapse.js +27 -36
  13. data/app/assets/javascripts/bootstrap/dropdown.js +36 -39
  14. data/app/assets/javascripts/bootstrap/modal.js +90 -56
  15. data/app/assets/javascripts/bootstrap/popover.js +21 -25
  16. data/app/assets/javascripts/bootstrap/scrollspy.js +56 -44
  17. data/app/assets/javascripts/bootstrap/tab.js +17 -24
  18. data/app/assets/javascripts/bootstrap/tooltip.js +158 -87
  19. data/app/assets/javascripts/bootstrap/transition.js +24 -21
  20. data/app/assets/stylesheets/bootstrap/alerts.less +4 -3
  21. data/app/assets/stylesheets/bootstrap/badges.less +27 -23
  22. data/app/assets/stylesheets/bootstrap/bootstrap.less +3 -2
  23. data/app/assets/stylesheets/bootstrap/breadcrumbs.less +4 -1
  24. data/app/assets/stylesheets/bootstrap/button-groups.less +36 -49
  25. data/app/assets/stylesheets/bootstrap/buttons.less +16 -17
  26. data/app/assets/stylesheets/bootstrap/carousel.less +18 -6
  27. data/app/assets/stylesheets/bootstrap/close.less +0 -0
  28. data/app/assets/stylesheets/bootstrap/code.less +16 -1
  29. data/app/assets/stylesheets/bootstrap/component-animations.less +6 -4
  30. data/app/assets/stylesheets/bootstrap/dropdowns.less +33 -10
  31. data/app/assets/stylesheets/bootstrap/forms.less +236 -60
  32. data/app/assets/stylesheets/bootstrap/glyphicons.less +5 -9
  33. data/app/assets/stylesheets/bootstrap/grid.less +40 -49
  34. data/app/assets/stylesheets/bootstrap/input-groups.less +51 -21
  35. data/app/assets/stylesheets/bootstrap/jumbotron.less +15 -7
  36. data/app/assets/stylesheets/bootstrap/labels.less +7 -1
  37. data/app/assets/stylesheets/bootstrap/list-group.less +47 -4
  38. data/app/assets/stylesheets/bootstrap/media.less +0 -0
  39. data/app/assets/stylesheets/bootstrap/mixins.less +35 -854
  40. data/app/assets/stylesheets/bootstrap/mixins/alerts.less +14 -0
  41. data/app/assets/stylesheets/bootstrap/mixins/background-variant.less +8 -0
  42. data/app/assets/stylesheets/bootstrap/mixins/border-radius.less +18 -0
  43. data/app/assets/stylesheets/bootstrap/mixins/buttons.less +50 -0
  44. data/app/assets/stylesheets/bootstrap/mixins/center-block.less +7 -0
  45. data/app/assets/stylesheets/bootstrap/mixins/clearfix.less +22 -0
  46. data/app/assets/stylesheets/bootstrap/mixins/forms.less +81 -0
  47. data/app/assets/stylesheets/bootstrap/mixins/gradients.less +59 -0
  48. data/app/assets/stylesheets/bootstrap/mixins/grid-framework.less +91 -0
  49. data/app/assets/stylesheets/bootstrap/mixins/grid.less +122 -0
  50. data/app/assets/stylesheets/bootstrap/mixins/hide-text.less +21 -0
  51. data/app/assets/stylesheets/bootstrap/mixins/image.less +34 -0
  52. data/app/assets/stylesheets/bootstrap/mixins/labels.less +12 -0
  53. data/app/assets/stylesheets/bootstrap/mixins/list-group.less +29 -0
  54. data/app/assets/stylesheets/bootstrap/mixins/nav-divider.less +10 -0
  55. data/app/assets/stylesheets/bootstrap/mixins/nav-vertical-align.less +9 -0
  56. data/app/assets/stylesheets/bootstrap/mixins/opacity.less +8 -0
  57. data/app/assets/stylesheets/bootstrap/mixins/pagination.less +23 -0
  58. data/app/assets/stylesheets/bootstrap/mixins/panels.less +24 -0
  59. data/app/assets/stylesheets/bootstrap/mixins/progress-bar.less +10 -0
  60. data/app/assets/stylesheets/bootstrap/mixins/reset-filter.less +8 -0
  61. data/app/assets/stylesheets/bootstrap/mixins/resize.less +6 -0
  62. data/app/assets/stylesheets/bootstrap/mixins/responsive-visibility.less +15 -0
  63. data/app/assets/stylesheets/bootstrap/mixins/size.less +10 -0
  64. data/app/assets/stylesheets/bootstrap/mixins/tab-focus.less +9 -0
  65. data/app/assets/stylesheets/bootstrap/mixins/table-row.less +28 -0
  66. data/app/assets/stylesheets/bootstrap/mixins/text-emphasis.less +8 -0
  67. data/app/assets/stylesheets/bootstrap/mixins/text-overflow.less +8 -0
  68. data/app/assets/stylesheets/bootstrap/mixins/vendor-prefixes.less +224 -0
  69. data/app/assets/stylesheets/bootstrap/modals.less +38 -20
  70. data/app/assets/stylesheets/bootstrap/navbar.less +103 -72
  71. data/app/assets/stylesheets/bootstrap/navs.less +3 -23
  72. data/app/assets/stylesheets/bootstrap/normalize.less +153 -134
  73. data/app/assets/stylesheets/bootstrap/pager.less +5 -5
  74. data/app/assets/stylesheets/bootstrap/pagination.less +6 -3
  75. data/app/assets/stylesheets/bootstrap/panels.less +117 -46
  76. data/app/assets/stylesheets/bootstrap/popovers.less +12 -12
  77. data/app/assets/stylesheets/bootstrap/print.less +0 -4
  78. data/app/assets/stylesheets/bootstrap/progress-bars.less +27 -14
  79. data/app/assets/stylesheets/bootstrap/responsive-embed.less +34 -0
  80. data/app/assets/stylesheets/bootstrap/responsive-utilities.less +109 -124
  81. data/app/assets/stylesheets/bootstrap/scaffolding.less +34 -3
  82. data/app/assets/stylesheets/bootstrap/tables.less +23 -26
  83. data/app/assets/stylesheets/bootstrap/theme.less +12 -1
  84. data/app/assets/stylesheets/bootstrap/thumbnails.less +10 -4
  85. data/app/assets/stylesheets/bootstrap/tooltip.less +1 -1
  86. data/app/assets/stylesheets/bootstrap/type.less +151 -117
  87. data/app/assets/stylesheets/bootstrap/utilities.less +1 -0
  88. data/app/assets/stylesheets/bootstrap/variables.less +399 -190
  89. data/app/assets/stylesheets/bootstrap/wells.less +1 -1
  90. data/bootstrap-on-rails.gemspec +1 -1
  91. data/lib/bootstrap-on-rails/version.rb +1 -1
  92. metadata +33 -3
@@ -21,14 +21,16 @@
21
21
  // Account for jankitude on images
22
22
  > img,
23
23
  > a > img {
24
- .img-responsive();
24
+ &:extend(.img-responsive);
25
25
  line-height: 1;
26
26
  }
27
27
  }
28
28
 
29
29
  > .active,
30
30
  > .next,
31
- > .prev { display: block; }
31
+ > .prev {
32
+ display: block;
33
+ }
32
34
 
33
35
  > .active {
34
36
  left: 0;
@@ -91,6 +93,7 @@
91
93
  // Hover/focus state
92
94
  &:hover,
93
95
  &:focus {
96
+ outline: 0;
94
97
  color: @carousel-control-color;
95
98
  text-decoration: none;
96
99
  .opacity(.9);
@@ -109,20 +112,22 @@
109
112
  .icon-prev,
110
113
  .glyphicon-chevron-left {
111
114
  left: 50%;
115
+ margin-left: -10px;
112
116
  }
113
117
  .icon-next,
114
118
  .glyphicon-chevron-right {
115
119
  right: 50%;
120
+ margin-right: -10px;
116
121
  }
117
122
  .icon-prev,
118
123
  .icon-next {
119
124
  width: 20px;
120
125
  height: 20px;
121
126
  margin-top: -10px;
122
- margin-left: -10px;
123
127
  font-family: serif;
124
128
  }
125
129
 
130
+
126
131
  .icon-prev {
127
132
  &:before {
128
133
  content: '\2039';// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)
@@ -205,16 +210,23 @@
205
210
 
206
211
  // Scale up the controls a smidge
207
212
  .carousel-control {
208
- .glyphicons-chevron-left,
209
- .glyphicons-chevron-right,
213
+ .glyphicon-chevron-left,
214
+ .glyphicon-chevron-right,
210
215
  .icon-prev,
211
216
  .icon-next {
212
217
  width: 30px;
213
218
  height: 30px;
214
219
  margin-top: -15px;
215
- margin-left: -15px;
216
220
  font-size: 30px;
217
221
  }
222
+ .glyphicon-chevron-left,
223
+ .icon-prev {
224
+ margin-left: -15px;
225
+ }
226
+ .glyphicon-chevron-right,
227
+ .icon-next {
228
+ margin-right: -15px;
229
+ }
218
230
  }
219
231
 
220
232
  // Show and left align the captions
@@ -17,10 +17,25 @@ code {
17
17
  font-size: 90%;
18
18
  color: @code-color;
19
19
  background-color: @code-bg;
20
- white-space: nowrap;
21
20
  border-radius: @border-radius-base;
22
21
  }
23
22
 
23
+ // User input typically entered via keyboard
24
+ kbd {
25
+ padding: 2px 4px;
26
+ font-size: 90%;
27
+ color: @kbd-color;
28
+ background-color: @kbd-bg;
29
+ border-radius: @border-radius-small;
30
+ box-shadow: inset 0 -1px 0 rgba(0,0,0,.25);
31
+
32
+ kbd {
33
+ padding: 0;
34
+ font-size: 100%;
35
+ box-shadow: none;
36
+ }
37
+ }
38
+
24
39
  // Blocks of code
25
40
  pre {
26
41
  display: block;
@@ -5,7 +5,7 @@
5
5
  // Heads up!
6
6
  //
7
7
  // We don't use the `.opacity()` mixin here since it causes a bug with text
8
- // fields in IE7-8. Source: https://github.com/twitter/bootstrap/pull/3552.
8
+ // fields in IE7-8. Source: https://github.com/twbs/bootstrap/pull/3552.
9
9
 
10
10
  .fade {
11
11
  opacity: 0;
@@ -17,10 +17,12 @@
17
17
 
18
18
  .collapse {
19
19
  display: none;
20
- &.in {
21
- display: block;
22
- }
20
+
21
+ &.in { display: block; }
22
+ tr&.in { display: table-row; }
23
+ tbody&.in { display: table-row-group; }
23
24
  }
25
+
24
26
  .collapsing {
25
27
  position: relative;
26
28
  height: 0;
@@ -10,12 +10,9 @@
10
10
  height: 0;
11
11
  margin-left: 2px;
12
12
  vertical-align: middle;
13
- border-top: @caret-width-base solid @dropdown-caret-color;
13
+ border-top: @caret-width-base solid;
14
14
  border-right: @caret-width-base solid transparent;
15
15
  border-left: @caret-width-base solid transparent;
16
- // Firefox fix for https://github.com/twbs/bootstrap/issues/9538. Once fixed,
17
- // we can just straight up remove this.
18
- border-bottom: 0 dotted;
19
16
  }
20
17
 
21
18
  // The dropdown wrapper (div)
@@ -41,6 +38,7 @@
41
38
  margin: 2px 0 0; // override default ul
42
39
  list-style: none;
43
40
  font-size: @font-size-base;
41
+ text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer)
44
42
  background-color: @dropdown-bg;
45
43
  border: 1px solid @dropdown-fallback-border; // IE8 fallback
46
44
  border: 1px solid @dropdown-border;
@@ -49,6 +47,8 @@
49
47
  background-clip: padding-box;
50
48
 
51
49
  // Aligns the dropdown menu to right
50
+ //
51
+ // Deprecated as of 3.1.0 in favor of `.dropdown-menu-[dir]`
52
52
  &.pull-right {
53
53
  right: 0;
54
54
  left: auto;
@@ -129,6 +129,25 @@
129
129
  }
130
130
  }
131
131
 
132
+ // Menu positioning
133
+ //
134
+ // Add extra class to `.dropdown-menu` to flip the alignment of the dropdown
135
+ // menu with the parent.
136
+ .dropdown-menu-right {
137
+ left: auto; // Reset the default from `.dropdown-menu`
138
+ right: 0;
139
+ }
140
+ // With v3, we enabled auto-flipping if you have a dropdown within a right
141
+ // aligned nav component. To enable the undoing of that, we provide an override
142
+ // to restore the default dropdown menu alignment.
143
+ //
144
+ // This is only for left-aligning a dropdown menu within a `.navbar-right` or
145
+ // `.pull-right` nav component.
146
+ .dropdown-menu-left {
147
+ left: 0;
148
+ right: auto;
149
+ }
150
+
132
151
  // Dropdown section headers
133
152
  .dropdown-header {
134
153
  display: block;
@@ -136,6 +155,7 @@
136
155
  font-size: @font-size-small;
137
156
  line-height: @line-height-base;
138
157
  color: @dropdown-header-color;
158
+ white-space: nowrap; // as with > li > a
139
159
  }
140
160
 
141
161
  // Backdrop to catch body clicks on mobile, etc.
@@ -145,7 +165,7 @@
145
165
  right: 0;
146
166
  bottom: 0;
147
167
  top: 0;
148
- z-index: @zindex-dropdown - 10;
168
+ z-index: (@zindex-dropdown - 10);
149
169
  }
150
170
 
151
171
  // Right aligned dropdowns
@@ -163,10 +183,8 @@
163
183
  .navbar-fixed-bottom .dropdown {
164
184
  // Reverse the caret
165
185
  .caret {
166
- // Firefox fix for https://github.com/twbs/bootstrap/issues/9538. Once this
167
- // gets fixed, restore `border-top: 0;`.
168
- border-top: 0 dotted;
169
- border-bottom: @caret-width-base solid @dropdown-caret-color;
186
+ border-top: 0;
187
+ border-bottom: @caret-width-base solid;
170
188
  content: "";
171
189
  }
172
190
  // Different positioning for bottom up menu
@@ -185,7 +203,12 @@
185
203
  @media (min-width: @grid-float-breakpoint) {
186
204
  .navbar-right {
187
205
  .dropdown-menu {
188
- .pull-right > .dropdown-menu();
206
+ .dropdown-menu-right();
207
+ }
208
+ // Necessary for overrides of the default right aligned menu.
209
+ // Will remove come v4 in all likelihood.
210
+ .dropdown-menu-left {
211
+ .dropdown-menu-left();
189
212
  }
190
213
  }
191
214
  }
@@ -11,6 +11,10 @@ fieldset {
11
11
  padding: 0;
12
12
  margin: 0;
13
13
  border: 0;
14
+ // Chrome and Firefox set a `min-width: min-content;` on fieldsets,
15
+ // so we reset that to ensure it behaves more like a standard block element.
16
+ // See https://github.com/twbs/bootstrap/issues/12359.
17
+ min-width: 0;
14
18
  }
15
19
 
16
20
  legend {
@@ -27,12 +31,17 @@ legend {
27
31
 
28
32
  label {
29
33
  display: inline-block;
34
+ max-width: 100%; // Force IE8 to wrap long content (see https://github.com/twbs/bootstrap/issues/13141)
30
35
  margin-bottom: 5px;
31
36
  font-weight: bold;
32
37
  }
33
38
 
34
39
 
35
40
  // Normalize form controls
41
+ //
42
+ // While most of our form styles require extra classes, some basic normalization
43
+ // is required to ensure optimum display with or without those classes to better
44
+ // address browser inconsistencies.
36
45
 
37
46
  // Override content-box in Normalize (* isn't specific enough)
38
47
  input[type="search"] {
@@ -43,45 +52,34 @@ input[type="search"] {
43
52
  input[type="radio"],
44
53
  input[type="checkbox"] {
45
54
  margin: 4px 0 0;
46
- margin-top: 1px \9; /* IE8-9 */
55
+ margin-top: 1px \9; // IE8-9
47
56
  line-height: normal;
48
57
  }
49
58
 
50
- // Set the height of select and file controls to match text inputs
59
+ // Set the height of file controls to match text inputs
51
60
  input[type="file"] {
52
61
  display: block;
53
62
  }
54
63
 
64
+ // Make range inputs behave like textual form controls
65
+ input[type="range"] {
66
+ display: block;
67
+ width: 100%;
68
+ }
69
+
55
70
  // Make multiple select elements height not fixed
56
71
  select[multiple],
57
72
  select[size] {
58
73
  height: auto;
59
74
  }
60
75
 
61
- // Fix optgroup Firefox bug per https://github.com/twbs/bootstrap/issues/7611
62
- select optgroup {
63
- font-size: inherit;
64
- font-style: inherit;
65
- font-family: inherit;
66
- }
67
-
68
- // Focus for select, file, radio, and checkbox
76
+ // Focus for file, radio, and checkbox
69
77
  input[type="file"]:focus,
70
78
  input[type="radio"]:focus,
71
79
  input[type="checkbox"]:focus {
72
80
  .tab-focus();
73
81
  }
74
82
 
75
- // Fix for Chrome number input
76
- // Setting certain font-sizes causes the `I` bar to appear on hover of the bottom increment button.
77
- // See https://github.com/twbs/bootstrap/issues/8350 for more.
78
- input[type="number"] {
79
- &::-webkit-outer-spin-button,
80
- &::-webkit-inner-spin-button {
81
- height: auto;
82
- }
83
- }
84
-
85
83
  // Adjust output element
86
84
  output {
87
85
  display: block;
@@ -89,7 +87,6 @@ output {
89
87
  font-size: @font-size-base;
90
88
  line-height: @line-height-base;
91
89
  color: @input-color;
92
- vertical-align: middle;
93
90
  }
94
91
 
95
92
 
@@ -123,7 +120,6 @@ output {
123
120
  font-size: @font-size-base;
124
121
  line-height: @line-height-base;
125
122
  color: @input-color;
126
- vertical-align: middle;
127
123
  background-color: @input-bg;
128
124
  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
129
125
  border: 1px solid @input-border;
@@ -135,20 +131,19 @@ output {
135
131
  .form-control-focus();
136
132
 
137
133
  // Placeholder
138
- //
139
- // Placeholder text gets special styles because when browsers invalidate entire
140
- // lines if it doesn't understand a selector/
141
134
  .placeholder();
142
135
 
143
136
  // Disabled and read-only inputs
144
- // Note: HTML5 says that controls under a fieldset > legend:first-child won't
145
- // be disabled if the fieldset is disabled. Due to implementation difficulty,
146
- // we don't honor that edge case; we style them as disabled anyway.
137
+ //
138
+ // HTML5 says that controls under a fieldset > legend:first-child won't be
139
+ // disabled if the fieldset is disabled. Due to implementation difficulty, we
140
+ // don't honor that edge case; we style them as disabled anyway.
147
141
  &[disabled],
148
142
  &[readonly],
149
143
  fieldset[disabled] & {
150
144
  cursor: not-allowed;
151
145
  background-color: @input-bg-disabled;
146
+ opacity: 1; // iOS fix for unreadable disabled content
152
147
  }
153
148
 
154
149
  // Reset height for `textarea`s
@@ -158,6 +153,43 @@ output {
158
153
  }
159
154
 
160
155
 
156
+ // Search inputs in iOS
157
+ //
158
+ // This overrides the extra rounded corners on search inputs in iOS so that our
159
+ // `.form-control` class can properly style them. Note that this cannot simply
160
+ // be added to `.form-control` as it's not specific enough. For details, see
161
+ // https://github.com/twbs/bootstrap/issues/11586.
162
+
163
+ input[type="search"] {
164
+ -webkit-appearance: none;
165
+ }
166
+
167
+
168
+ // Special styles for iOS temporal inputs
169
+ //
170
+ // In Mobile Safari, setting `display: block` on temporal inputs causes the
171
+ // text within the input to become vertically misaligned.
172
+ // As a workaround, we set a pixel line-height that matches the
173
+ // given height of the input. Since this fucks up everything else, we have to
174
+ // appropriately reset it for Internet Explorer and the size variations.
175
+
176
+ input[type="date"],
177
+ input[type="time"],
178
+ input[type="datetime-local"],
179
+ input[type="month"] {
180
+ line-height: @input-height-base;
181
+ // IE8+ misaligns the text within date inputs, so we reset
182
+ line-height: @line-height-base ~"\0";
183
+
184
+ &.input-sm {
185
+ line-height: @input-height-small;
186
+ }
187
+ &.input-lg {
188
+ line-height: @input-height-large;
189
+ }
190
+ }
191
+
192
+
161
193
  // Form groups
162
194
  //
163
195
  // Designed to help with the organization and spacing of vertical forms. For
@@ -174,14 +206,14 @@ output {
174
206
 
175
207
  .radio,
176
208
  .checkbox {
209
+ position: relative;
177
210
  display: block;
178
211
  min-height: @line-height-computed; // clear the floating input if there is no label text
179
212
  margin-top: 10px;
180
213
  margin-bottom: 10px;
181
- padding-left: 20px;
182
- vertical-align: middle;
214
+
183
215
  label {
184
- display: inline;
216
+ padding-left: 20px;
185
217
  margin-bottom: 0;
186
218
  font-weight: normal;
187
219
  cursor: pointer;
@@ -191,9 +223,11 @@ output {
191
223
  .radio-inline input[type="radio"],
192
224
  .checkbox input[type="checkbox"],
193
225
  .checkbox-inline input[type="checkbox"] {
194
- float: left;
226
+ position: absolute;
195
227
  margin-left: -20px;
228
+ margin-top: 4px \9;
196
229
  }
230
+
197
231
  .radio + .radio,
198
232
  .checkbox + .checkbox {
199
233
  margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing
@@ -216,21 +250,62 @@ output {
216
250
  }
217
251
 
218
252
  // Apply same disabled cursor tweak as for inputs
253
+ // Some special care is needed because <label>s don't inherit their parent's `cursor`.
219
254
  //
220
255
  // Note: Neither radios nor checkboxes can be readonly.
221
256
  input[type="radio"],
222
- input[type="checkbox"],
223
- .radio,
257
+ input[type="checkbox"] {
258
+ &[disabled],
259
+ &.disabled,
260
+ fieldset[disabled] & {
261
+ cursor: not-allowed;
262
+ }
263
+ }
264
+ // These classes are used directly on <label>s
224
265
  .radio-inline,
225
- .checkbox,
226
266
  .checkbox-inline {
227
- &[disabled],
267
+ &.disabled,
228
268
  fieldset[disabled] & {
229
269
  cursor: not-allowed;
230
270
  }
231
271
  }
272
+ // These classes are used on elements with <label> descendants
273
+ .radio,
274
+ .checkbox {
275
+ &.disabled,
276
+ fieldset[disabled] & {
277
+ label {
278
+ cursor: not-allowed;
279
+ }
280
+ }
281
+ }
282
+
283
+
284
+ // Static form control text
285
+ //
286
+ // Apply class to a `p` element to make any string of text align with labels in
287
+ // a horizontal form layout.
288
+
289
+ .form-control-static {
290
+ // Size it appropriately next to real form controls
291
+ padding-top: (@padding-base-vertical + 1);
292
+ padding-bottom: (@padding-base-vertical + 1);
293
+ // Remove default margin from `p`
294
+ margin-bottom: 0;
295
+
296
+ &.input-lg,
297
+ &.input-sm {
298
+ padding-left: 0;
299
+ padding-right: 0;
300
+ }
301
+ }
302
+
232
303
 
233
304
  // Form control sizing
305
+ //
306
+ // Build on `.form-control` with modifier classes to decrease or increase the
307
+ // height and font-size of form controls.
308
+
234
309
  .input-sm {
235
310
  .input-size(@input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small);
236
311
  }
@@ -244,27 +319,53 @@ input[type="checkbox"],
244
319
  //
245
320
  // Apply contextual and semantic states to individual form controls.
246
321
 
247
- // Warning
322
+ .has-feedback {
323
+ // Enable absolute positioning
324
+ position: relative;
325
+
326
+ // Ensure icons don't overlap text
327
+ .form-control {
328
+ padding-right: (@input-height-base * 1.25);
329
+ }
330
+ }
331
+ // Feedback icon (requires .glyphicon classes)
332
+ .form-control-feedback {
333
+ position: absolute;
334
+ top: (@line-height-computed + 5); // Height of the `label` and its margin
335
+ right: 0;
336
+ z-index: 2; // Ensure icon is above input groups
337
+ display: block;
338
+ width: @input-height-base;
339
+ height: @input-height-base;
340
+ line-height: @input-height-base;
341
+ text-align: center;
342
+ }
343
+ .input-lg + .form-control-feedback {
344
+ width: @input-height-large;
345
+ height: @input-height-large;
346
+ line-height: @input-height-large;
347
+ }
348
+ .input-sm + .form-control-feedback {
349
+ width: @input-height-small;
350
+ height: @input-height-small;
351
+ line-height: @input-height-small;
352
+ }
353
+
354
+ // Feedback states
355
+ .has-success {
356
+ .form-control-validation(@state-success-text; @state-success-text; @state-success-bg);
357
+ }
248
358
  .has-warning {
249
359
  .form-control-validation(@state-warning-text; @state-warning-text; @state-warning-bg);
250
360
  }
251
- // Error
252
361
  .has-error {
253
362
  .form-control-validation(@state-danger-text; @state-danger-text; @state-danger-bg);
254
363
  }
255
- // Success
256
- .has-success {
257
- .form-control-validation(@state-success-text; @state-success-text; @state-success-bg);
258
- }
259
364
 
260
365
 
261
- // Static form control text
262
- //
263
- // Apply class to a `p` element to make any string of text align with labels in
264
- // a horizontal form layout.
265
-
266
- .form-control-static {
267
- margin-bottom: 0; // Remove default margin from `p`
366
+ // Reposition feedback icon if label is hidden with "screenreader only" state
367
+ .has-feedback label.sr-only ~ .form-control-feedback {
368
+ top: 0;
268
369
  }
269
370
 
270
371
 
@@ -296,9 +397,9 @@ input[type="checkbox"],
296
397
  .form-inline {
297
398
 
298
399
  // Kick in the inline
299
- @media (min-width: @screen-sm) {
400
+ @media (min-width: @screen-sm-min) {
300
401
  // Inline-block all the things for "inline"
301
- .form-group {
402
+ .form-group {
302
403
  display: inline-block;
303
404
  margin-bottom: 0;
304
405
  vertical-align: middle;
@@ -307,6 +408,29 @@ input[type="checkbox"],
307
408
  // In navbar-form, allow folks to *not* use `.form-group`
308
409
  .form-control {
309
410
  display: inline-block;
411
+ width: auto; // Prevent labels from stacking above inputs in `.form-group`
412
+ vertical-align: middle;
413
+ }
414
+
415
+ .input-group {
416
+ display: inline-table;
417
+ vertical-align: middle;
418
+
419
+ .input-group-addon,
420
+ .input-group-btn,
421
+ .form-control {
422
+ width: auto;
423
+ }
424
+ }
425
+
426
+ // Input groups need that 100% width though
427
+ .input-group > .form-control {
428
+ width: 100%;
429
+ }
430
+
431
+ .control-label {
432
+ margin-bottom: 0;
433
+ vertical-align: middle;
310
434
  }
311
435
 
312
436
  // Remove default margin on radios/checkboxes that were used for stacking, and
@@ -317,13 +441,25 @@ input[type="checkbox"],
317
441
  display: inline-block;
318
442
  margin-top: 0;
319
443
  margin-bottom: 0;
320
- padding-left: 0;
444
+ vertical-align: middle;
445
+
446
+ label {
447
+ padding-left: 0;
448
+ }
321
449
  }
322
450
  .radio input[type="radio"],
323
451
  .checkbox input[type="checkbox"] {
324
- float: none;
452
+ position: relative;
325
453
  margin-left: 0;
326
454
  }
455
+
456
+ // Validation states
457
+ //
458
+ // Reposition the icon because it's now within a grid column and columns have
459
+ // `position: relative;` on them. Also accounts for the grid gutter padding.
460
+ .has-feedback .form-control-feedback {
461
+ top: 0;
462
+ }
327
463
  }
328
464
  }
329
465
 
@@ -335,8 +471,9 @@ input[type="checkbox"],
335
471
 
336
472
  .form-horizontal {
337
473
 
338
- // Consistent vertical alignment of labels, radios, and checkboxes
339
- .control-label,
474
+ // Consistent vertical alignment of radios and checkboxes
475
+ //
476
+ // Labels also get some reset styles, but that is scoped to a media query below.
340
477
  .radio,
341
478
  .checkbox,
342
479
  .radio-inline,
@@ -345,20 +482,59 @@ input[type="checkbox"],
345
482
  margin-bottom: 0;
346
483
  padding-top: (@padding-base-vertical + 1); // Default padding plus a border
347
484
  }
485
+ // Account for padding we're adding to ensure the alignment and of help text
486
+ // and other content below items
487
+ .radio,
488
+ .checkbox {
489
+ min-height: (@line-height-computed + (@padding-base-vertical + 1));
490
+ }
348
491
 
349
492
  // Make form groups behave like rows
350
493
  .form-group {
351
494
  .make-row();
352
495
  }
353
496
 
354
- .form-control-static {
355
- padding-top: (@padding-base-vertical + 1);
356
- }
357
-
358
- // Only right align form labels here when the columns stop stacking
497
+ // Reset spacing and right align labels, but scope to media queries so that
498
+ // labels on narrow viewports stack the same as a default form example.
359
499
  @media (min-width: @screen-sm-min) {
360
500
  .control-label {
361
501
  text-align: right;
502
+ margin-bottom: 0;
503
+ padding-top: (@padding-base-vertical + 1); // Default padding plus a border
504
+ }
505
+ }
506
+
507
+ // Validation states
508
+ //
509
+ // Reposition the icon because it's now within a grid column and columns have
510
+ // `position: relative;` on them. Also accounts for the grid gutter padding.
511
+ .has-feedback .form-control-feedback {
512
+ top: 0;
513
+ right: (@grid-gutter-width / 2);
514
+ }
515
+
516
+ // Form group sizes
517
+ //
518
+ // Quick utility class for applying `.input-lg` and `.input-sm` styles to the
519
+ // inputs and labels within a `.form-group`.
520
+ .form-group-lg {
521
+ @media (min-width: @screen-sm-min) {
522
+ .control-label {
523
+ padding-top: ((@padding-large-vertical * @line-height-large) + 1);
524
+ }
525
+ }
526
+ .form-control {
527
+ &:extend(.input-lg);
528
+ }
529
+ }
530
+ .form-group-sm {
531
+ @media (min-width: @screen-sm-min) {
532
+ .control-label {
533
+ padding-top: (@padding-small-vertical + 1);
534
+ }
535
+ }
536
+ .form-control {
537
+ &:extend(.input-sm);
362
538
  }
363
539
  }
364
540
  }