twitter-bootstrap-rails 2.2.8 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of twitter-bootstrap-rails might be problematic. Click here for more details.

Files changed (185) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +229 -322
  3. data/Rakefile +4 -6
  4. data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  5. data/app/assets/fonts/glyphicons-halflings-regular.svg +288 -0
  6. data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  7. data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  8. data/app/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
  9. data/app/assets/javascripts/twitter/bootstrap.js +12 -13
  10. data/app/assets/javascripts/twitter/bootstrap/affix.js +162 -0
  11. data/app/assets/javascripts/twitter/bootstrap/alert.js +94 -0
  12. data/app/assets/javascripts/twitter/bootstrap/button.js +120 -0
  13. data/app/assets/javascripts/twitter/bootstrap/carousel.js +237 -0
  14. data/app/assets/javascripts/twitter/bootstrap/collapse.js +211 -0
  15. data/app/assets/javascripts/twitter/bootstrap/dropdown.js +165 -0
  16. data/app/assets/javascripts/twitter/bootstrap/modal.js +337 -0
  17. data/app/assets/javascripts/twitter/bootstrap/popover.js +108 -0
  18. data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +172 -0
  19. data/app/assets/javascripts/twitter/bootstrap/tab.js +155 -0
  20. data/app/assets/javascripts/twitter/bootstrap/tooltip.js +514 -0
  21. data/app/assets/javascripts/twitter/bootstrap/transition.js +59 -0
  22. data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +1 -890
  23. data/app/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +1 -146
  24. data/app/helpers/bootstrap_flash_helper.rb +14 -7
  25. data/app/helpers/form_errors_helper.rb +22 -0
  26. data/app/helpers/glyph_helper.rb +12 -6
  27. data/app/helpers/modal_helper.rb +26 -22
  28. data/app/helpers/navbar_helper.rb +47 -32
  29. data/app/helpers/twitter_breadcrumbs_helper.rb +6 -2
  30. data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +8 -8
  31. data/lib/generators/bootstrap/install/install_generator.rb +3 -2
  32. data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.css +3 -4
  33. data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +9 -18
  34. data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +5 -0
  35. data/lib/generators/bootstrap/layout/layout_generator.rb +1 -4
  36. data/lib/generators/bootstrap/layout/templates/layout.html.erb +27 -48
  37. data/lib/generators/bootstrap/layout/templates/layout.html.haml +19 -34
  38. data/lib/generators/bootstrap/layout/templates/layout.html.slim +13 -30
  39. data/lib/generators/bootstrap/partial/templates/_login.html.erb +2 -3
  40. data/lib/generators/bootstrap/themed/templates/_form.html.erb +30 -10
  41. data/lib/generators/bootstrap/themed/templates/_form.html.haml +10 -8
  42. data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -9
  43. data/lib/generators/bootstrap/themed/templates/edit.html.slim +1 -1
  44. data/lib/generators/bootstrap/themed/templates/index.html.erb +4 -2
  45. data/lib/generators/bootstrap/themed/templates/index.html.haml +3 -2
  46. data/lib/generators/bootstrap/themed/templates/index.html.slim +6 -5
  47. data/lib/generators/bootstrap/themed/templates/new.html.slim +1 -1
  48. data/lib/generators/bootstrap/themed/templates/show.html.erb +5 -7
  49. data/lib/generators/bootstrap/themed/templates/show.html.haml +4 -4
  50. data/lib/generators/bootstrap/themed/templates/show.html.slim +6 -7
  51. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +5 -5
  52. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +3 -3
  53. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +4 -4
  54. data/lib/generators/bootstrap/themed/themed_generator.rb +2 -2
  55. data/lib/twitter/bootstrap/rails/breadcrumbs.rb +69 -0
  56. data/lib/twitter/bootstrap/rails/engine.rb +17 -10
  57. data/lib/twitter/bootstrap/rails/version.rb +2 -2
  58. data/spec/lib/breadcrumbs_spec.rb +99 -0
  59. data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +12 -4
  60. data/spec/lib/twitter_bootstrap_rails/bootstrap_flash_helper_spec.rb +128 -0
  61. data/spec/lib/twitter_bootstrap_rails/form_errors_helper_spec.rb +148 -0
  62. data/spec/lib/twitter_bootstrap_rails/glyph_helper_spec.rb +24 -0
  63. data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +15 -15
  64. data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +207 -173
  65. data/spec/lib/twitter_bootstrap_rails/uri_state_spec.rb +18 -16
  66. data/spec/spec_helper.rb +11 -1
  67. data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +5796 -1
  68. data/vendor/static-source/bootstrap.less +0 -1
  69. data/vendor/static-source/sprites.less +1 -1
  70. data/vendor/toolkit/twitter/bootstrap/alerts.less +51 -57
  71. data/vendor/toolkit/twitter/bootstrap/badges.less +66 -0
  72. data/vendor/toolkit/twitter/bootstrap/bootstrap.less +29 -36
  73. data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +11 -9
  74. data/vendor/toolkit/twitter/bootstrap/button-groups.less +167 -152
  75. data/vendor/toolkit/twitter/bootstrap/buttons.less +107 -169
  76. data/vendor/toolkit/twitter/bootstrap/carousel.less +177 -65
  77. data/vendor/toolkit/twitter/bootstrap/close.less +21 -19
  78. data/vendor/toolkit/twitter/bootstrap/code.less +38 -30
  79. data/vendor/toolkit/twitter/bootstrap/component-animations.less +15 -4
  80. data/vendor/toolkit/twitter/bootstrap/dropdowns.less +120 -152
  81. data/vendor/toolkit/twitter/bootstrap/forms.less +470 -547
  82. data/vendor/toolkit/twitter/bootstrap/glyphicons.less +305 -0
  83. data/vendor/toolkit/twitter/bootstrap/grid.less +74 -11
  84. data/vendor/toolkit/twitter/bootstrap/input-groups.less +171 -0
  85. data/vendor/toolkit/twitter/bootstrap/jumbotron.less +54 -0
  86. data/vendor/toolkit/twitter/bootstrap/labels.less +64 -0
  87. data/vendor/toolkit/twitter/bootstrap/list-group.less +130 -0
  88. data/vendor/toolkit/twitter/bootstrap/media.less +40 -29
  89. data/vendor/toolkit/twitter/bootstrap/mixins.less +37 -699
  90. data/vendor/toolkit/twitter/bootstrap/mixins/alerts.less +14 -0
  91. data/vendor/toolkit/twitter/bootstrap/mixins/background-variant.less +9 -0
  92. data/vendor/toolkit/twitter/bootstrap/mixins/border-radius.less +18 -0
  93. data/vendor/toolkit/twitter/bootstrap/mixins/buttons.less +65 -0
  94. data/vendor/toolkit/twitter/bootstrap/mixins/center-block.less +7 -0
  95. data/vendor/toolkit/twitter/bootstrap/mixins/clearfix.less +22 -0
  96. data/vendor/toolkit/twitter/bootstrap/mixins/forms.less +85 -0
  97. data/vendor/toolkit/twitter/bootstrap/mixins/gradients.less +59 -0
  98. data/vendor/toolkit/twitter/bootstrap/mixins/grid-framework.less +91 -0
  99. data/vendor/toolkit/twitter/bootstrap/mixins/grid.less +122 -0
  100. data/vendor/toolkit/twitter/bootstrap/mixins/hide-text.less +21 -0
  101. data/vendor/toolkit/twitter/bootstrap/mixins/image.less +33 -0
  102. data/vendor/toolkit/twitter/bootstrap/mixins/labels.less +12 -0
  103. data/vendor/toolkit/twitter/bootstrap/mixins/list-group.less +30 -0
  104. data/vendor/toolkit/twitter/bootstrap/mixins/nav-divider.less +10 -0
  105. data/vendor/toolkit/twitter/bootstrap/mixins/nav-vertical-align.less +9 -0
  106. data/vendor/toolkit/twitter/bootstrap/mixins/opacity.less +8 -0
  107. data/vendor/toolkit/twitter/bootstrap/mixins/pagination.less +24 -0
  108. data/vendor/toolkit/twitter/bootstrap/mixins/panels.less +24 -0
  109. data/vendor/toolkit/twitter/bootstrap/mixins/progress-bar.less +10 -0
  110. data/vendor/toolkit/twitter/bootstrap/mixins/reset-filter.less +8 -0
  111. data/vendor/toolkit/twitter/bootstrap/mixins/reset-text.less +18 -0
  112. data/vendor/toolkit/twitter/bootstrap/mixins/resize.less +6 -0
  113. data/vendor/toolkit/twitter/bootstrap/mixins/responsive-visibility.less +15 -0
  114. data/vendor/toolkit/twitter/bootstrap/mixins/size.less +10 -0
  115. data/vendor/toolkit/twitter/bootstrap/mixins/tab-focus.less +9 -0
  116. data/vendor/toolkit/twitter/bootstrap/mixins/table-row.less +28 -0
  117. data/vendor/toolkit/twitter/bootstrap/mixins/text-emphasis.less +9 -0
  118. data/vendor/toolkit/twitter/bootstrap/mixins/text-overflow.less +8 -0
  119. data/vendor/toolkit/twitter/bootstrap/mixins/vendor-prefixes.less +227 -0
  120. data/vendor/toolkit/twitter/bootstrap/modals.less +109 -54
  121. data/vendor/toolkit/twitter/bootstrap/navbar.less +547 -384
  122. data/vendor/toolkit/twitter/bootstrap/navs.less +192 -359
  123. data/vendor/toolkit/twitter/bootstrap/normalize.less +424 -0
  124. data/vendor/toolkit/twitter/bootstrap/pager.less +45 -34
  125. data/vendor/toolkit/twitter/bootstrap/pagination.less +71 -105
  126. data/vendor/toolkit/twitter/bootstrap/panels.less +271 -0
  127. data/vendor/toolkit/twitter/bootstrap/popovers.less +66 -68
  128. data/vendor/toolkit/twitter/bootstrap/print.less +101 -0
  129. data/vendor/toolkit/twitter/bootstrap/progress-bars.less +40 -75
  130. data/vendor/toolkit/twitter/bootstrap/responsive-embed.less +35 -0
  131. data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +177 -42
  132. data/vendor/toolkit/twitter/bootstrap/scaffolding.less +131 -23
  133. data/vendor/toolkit/twitter/bootstrap/tables.less +172 -182
  134. data/vendor/toolkit/twitter/bootstrap/theme.less +291 -0
  135. data/vendor/toolkit/twitter/bootstrap/thumbnails.less +27 -44
  136. data/vendor/toolkit/twitter/bootstrap/tooltip.less +58 -27
  137. data/vendor/toolkit/twitter/bootstrap/type.less +209 -154
  138. data/vendor/toolkit/twitter/bootstrap/utilities.less +32 -7
  139. data/vendor/toolkit/twitter/bootstrap/variables.less +784 -216
  140. data/vendor/toolkit/twitter/bootstrap/wells.less +7 -7
  141. metadata +156 -141
  142. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  143. data/app/assets/fonts/fontawesome-webfont.svg +0 -399
  144. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  145. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  146. data/app/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  147. data/app/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  148. data/app/assets/javascripts/twitter/bootstrap/bootstrap-affix.js +0 -117
  149. data/app/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +0 -99
  150. data/app/assets/javascripts/twitter/bootstrap/bootstrap-button.js +0 -105
  151. data/app/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +0 -207
  152. data/app/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +0 -167
  153. data/app/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +0 -169
  154. data/app/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +0 -247
  155. data/app/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +0 -114
  156. data/app/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +0 -162
  157. data/app/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +0 -144
  158. data/app/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +0 -361
  159. data/app/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +0 -60
  160. data/app/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +0 -335
  161. data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +0 -787
  162. data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +0 -42
  163. data/test/lib/breadcrumbs_test.rb +0 -75
  164. data/test/test_helper.rb +0 -11
  165. data/vendor/static-source/fontawesome.less +0 -9
  166. data/vendor/toolkit/fontawesome/bootstrap.less +0 -84
  167. data/vendor/toolkit/fontawesome/core.less +0 -129
  168. data/vendor/toolkit/fontawesome/extras.less +0 -93
  169. data/vendor/toolkit/fontawesome/font-awesome-ie7.less +0 -1953
  170. data/vendor/toolkit/fontawesome/font-awesome.less +0 -33
  171. data/vendor/toolkit/fontawesome/icons.less +0 -381
  172. data/vendor/toolkit/fontawesome/mixins.less +0 -48
  173. data/vendor/toolkit/fontawesome/path.less +0 -14
  174. data/vendor/toolkit/fontawesome/variables.less +0 -735
  175. data/vendor/toolkit/twitter/bootstrap/accordion.less +0 -34
  176. data/vendor/toolkit/twitter/bootstrap/hero-unit.less +0 -25
  177. data/vendor/toolkit/twitter/bootstrap/labels-badges.less +0 -84
  178. data/vendor/toolkit/twitter/bootstrap/layouts.less +0 -16
  179. data/vendor/toolkit/twitter/bootstrap/reset.less +0 -216
  180. data/vendor/toolkit/twitter/bootstrap/responsive-1200px-min.less +0 -28
  181. data/vendor/toolkit/twitter/bootstrap/responsive-767px-max.less +0 -193
  182. data/vendor/toolkit/twitter/bootstrap/responsive-768px-979px.less +0 -19
  183. data/vendor/toolkit/twitter/bootstrap/responsive-navbar.less +0 -189
  184. data/vendor/toolkit/twitter/bootstrap/responsive.less +0 -48
  185. data/vendor/toolkit/twitter/bootstrap/sprites.less +0 -197
@@ -3,167 +3,67 @@
3
3
  // --------------------------------------------------
4
4
 
5
5
 
6
- // GENERAL STYLES
7
- // --------------
8
-
9
- // Make all forms have space below them
10
- form {
11
- margin: 0 0 @baseLineHeight;
12
- }
6
+ // Normalize non-controls
7
+ //
8
+ // Restyle and baseline non-control form elements.
13
9
 
14
10
  fieldset {
15
11
  padding: 0;
16
12
  margin: 0;
17
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;
18
18
  }
19
19
 
20
- // Groups of fields with labels on top (legends)
21
20
  legend {
22
21
  display: block;
23
22
  width: 100%;
24
23
  padding: 0;
25
- margin-bottom: @baseLineHeight;
26
- font-size: @baseFontSize * 1.5;
27
- line-height: @baseLineHeight * 2;
28
- color: @grayDark;
24
+ margin-bottom: @line-height-computed;
25
+ font-size: (@font-size-base * 1.5);
26
+ line-height: inherit;
27
+ color: @legend-color;
29
28
  border: 0;
30
- border-bottom: 1px solid #e5e5e5;
31
-
32
- // Small
33
- small {
34
- font-size: @baseLineHeight * .75;
35
- color: @grayLight;
36
- }
37
- }
38
-
39
- // Set font for forms
40
- label,
41
- input,
42
- button,
43
- select,
44
- textarea {
45
- #font > .shorthand(@baseFontSize,normal,@baseLineHeight); // Set size, weight, line-height here
46
- }
47
- input,
48
- button,
49
- select,
50
- textarea {
51
- font-family: @baseFontFamily; // And only set font-family here for those that need it (note the missing label element)
29
+ border-bottom: 1px solid @legend-border-color;
52
30
  }
53
31
 
54
- // Identify controls by their labels
55
32
  label {
56
- display: block;
33
+ display: inline-block;
34
+ max-width: 100%; // Force IE8 to wrap long content (see https://github.com/twbs/bootstrap/issues/13141)
57
35
  margin-bottom: 5px;
36
+ font-weight: bold;
58
37
  }
59
38
 
60
- // Form controls
61
- // -------------------------
62
-
63
- // Shared size and type resets
64
- select,
65
- textarea,
66
- input[type="text"],
67
- input[type="password"],
68
- input[type="datetime"],
69
- input[type="datetime-local"],
70
- input[type="date"],
71
- input[type="month"],
72
- input[type="time"],
73
- input[type="week"],
74
- input[type="number"],
75
- input[type="email"],
76
- input[type="url"],
77
- input[type="search"],
78
- input[type="tel"],
79
- input[type="color"],
80
- .uneditable-input {
81
- display: inline-block;
82
- height: @baseLineHeight;
83
- padding: 4px 6px;
84
- margin-bottom: @baseLineHeight / 2;
85
- font-size: @baseFontSize;
86
- line-height: @baseLineHeight;
87
- color: @gray;
88
- .border-radius(@inputBorderRadius);
89
- vertical-align: middle;
90
- }
91
39
 
92
- // Reset appearance properties for textual inputs and textarea
93
- // Declare width for legacy (can't be on input[type=*] selectors or it's too specific)
94
- input,
95
- textarea,
96
- .uneditable-input {
97
- width: 206px; // plus 12px padding and 2px border
98
- }
99
- // Reset height since textareas have rows
100
- textarea {
101
- height: auto;
102
- }
103
- // Everything else
104
- textarea,
105
- input[type="text"],
106
- input[type="password"],
107
- input[type="datetime"],
108
- input[type="datetime-local"],
109
- input[type="date"],
110
- input[type="month"],
111
- input[type="time"],
112
- input[type="week"],
113
- input[type="number"],
114
- input[type="email"],
115
- input[type="url"],
116
- input[type="search"],
117
- input[type="tel"],
118
- input[type="color"],
119
- .uneditable-input {
120
- background-color: @inputBackground;
121
- border: 1px solid @inputBorder;
122
- .box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
123
- .transition(~"border linear .2s, box-shadow linear .2s");
124
-
125
- // Focus state
126
- &:focus {
127
- border-color: rgba(82,168,236,.8);
128
- outline: 0;
129
- outline: thin dotted \9; /* IE6-9 */
130
- .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)");
131
- }
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.
45
+
46
+ // Override content-box in Normalize (* isn't specific enough)
47
+ input[type="search"] {
48
+ .box-sizing(border-box);
132
49
  }
133
50
 
134
51
  // Position radios and checkboxes better
135
52
  input[type="radio"],
136
53
  input[type="checkbox"] {
137
54
  margin: 4px 0 0;
138
- *margin-top: 0; /* IE7 */
139
- margin-top: 1px \9; /* IE8-9 */
55
+ margin-top: 1px \9; // IE8-9
140
56
  line-height: normal;
141
57
  }
142
58
 
143
- // Reset width of input images, buttons, radios, checkboxes
144
- input[type="file"],
145
- input[type="image"],
146
- input[type="submit"],
147
- input[type="reset"],
148
- input[type="button"],
149
- input[type="radio"],
150
- input[type="checkbox"] {
151
- width: auto; // Override of generic input selector
152
- }
153
-
154
- // Set the height of select and file controls to match text inputs
155
- select,
156
59
  input[type="file"] {
157
- height: @inputHeight; /* In IE7, the height of the select element cannot be changed by height, only font-size */
158
- *margin-top: 4px; /* For IE7, add top margin to align select with labels */
159
- line-height: @inputHeight;
60
+ display: block;
160
61
  }
161
62
 
162
- // Make select elements obey height by applying a border
163
- select {
164
- width: 220px; // default input width + 10px of padding that doesn't get applied
165
- border: 1px solid @inputBorder;
166
- background-color: @inputBackground; // Chrome on Linux and Mobile Safari need background-color
63
+ // Make range inputs behave like textual form controls
64
+ input[type="range"] {
65
+ display: block;
66
+ width: 100%;
167
67
  }
168
68
 
169
69
  // Make multiple select elements height not fixed
@@ -172,519 +72,542 @@ select[size] {
172
72
  height: auto;
173
73
  }
174
74
 
175
- // Focus for select, file, radio, and checkbox
176
- select:focus,
75
+ // Focus for file, radio, and checkbox
177
76
  input[type="file"]:focus,
178
77
  input[type="radio"]:focus,
179
78
  input[type="checkbox"]:focus {
180
79
  .tab-focus();
181
80
  }
182
81
 
82
+ // Adjust output element
83
+ output {
84
+ display: block;
85
+ padding-top: (@padding-base-vertical + 1);
86
+ font-size: @font-size-base;
87
+ line-height: @line-height-base;
88
+ color: @input-color;
89
+ }
90
+
91
+
92
+ // Common form controls
93
+ //
94
+ // Shared size and type resets for form controls. Apply `.form-control` to any
95
+ // of the following form controls:
96
+ //
97
+ // select
98
+ // textarea
99
+ // input[type="text"]
100
+ // input[type="password"]
101
+ // input[type="datetime"]
102
+ // input[type="datetime-local"]
103
+ // input[type="date"]
104
+ // input[type="month"]
105
+ // input[type="time"]
106
+ // input[type="week"]
107
+ // input[type="number"]
108
+ // input[type="email"]
109
+ // input[type="url"]
110
+ // input[type="search"]
111
+ // input[type="tel"]
112
+ // input[type="color"]
113
+
114
+ .form-control {
115
+ display: block;
116
+ width: 100%;
117
+ height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border)
118
+ padding: @padding-base-vertical @padding-base-horizontal;
119
+ font-size: @font-size-base;
120
+ line-height: @line-height-base;
121
+ color: @input-color;
122
+ background-color: @input-bg;
123
+ background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
124
+ border: 1px solid @input-border;
125
+ border-radius: @input-border-radius; // Note: This has no effect on <select>s in some browsers, due to the limited stylability of <select>s in CSS.
126
+ .box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
127
+ .transition(~"border-color ease-in-out .15s, box-shadow ease-in-out .15s");
183
128
 
184
- // Uneditable inputs
185
- // -------------------------
129
+ // Customize the `:focus` state to imitate native WebKit styles.
130
+ .form-control-focus();
186
131
 
187
- // Make uneditable inputs look inactive
188
- .uneditable-input,
189
- .uneditable-textarea {
190
- color: @grayLight;
191
- background-color: darken(@inputBackground, 1%);
192
- border-color: @inputBorder;
193
- .box-shadow(inset 0 1px 2px rgba(0,0,0,.025));
194
- cursor: not-allowed;
132
+ // Placeholder
133
+ .placeholder();
134
+
135
+ // Unstyle the caret on `<select>`s in IE10+.
136
+ &::-ms-expand {
137
+ border: 0;
138
+ background-color: transparent;
139
+ }
140
+
141
+ // Disabled and read-only inputs
142
+ //
143
+ // HTML5 says that controls under a fieldset > legend:first-child won't be
144
+ // disabled if the fieldset is disabled. Due to implementation difficulty, we
145
+ // don't honor that edge case; we style them as disabled anyway.
146
+ &[disabled],
147
+ &[readonly],
148
+ fieldset[disabled] & {
149
+ background-color: @input-bg-disabled;
150
+ opacity: 1; // iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655
151
+ }
152
+
153
+ &[disabled],
154
+ fieldset[disabled] & {
155
+ cursor: @cursor-disabled;
156
+ }
157
+
158
+ // Reset height for `textarea`s
159
+ textarea& {
160
+ height: auto;
161
+ }
195
162
  }
196
163
 
197
- // For text that needs to appear as an input but should not be an input
198
- .uneditable-input {
199
- overflow: hidden; // prevent text from wrapping, but still cut it off like an input does
200
- white-space: nowrap;
164
+
165
+ // Search inputs in iOS
166
+ //
167
+ // This overrides the extra rounded corners on search inputs in iOS so that our
168
+ // `.form-control` class can properly style them. Note that this cannot simply
169
+ // be added to `.form-control` as it's not specific enough. For details, see
170
+ // https://github.com/twbs/bootstrap/issues/11586.
171
+
172
+ input[type="search"] {
173
+ -webkit-appearance: none;
201
174
  }
202
175
 
203
- // Make uneditable textareas behave like a textarea
204
- .uneditable-textarea {
205
- width: auto;
206
- height: auto;
176
+
177
+ // Special styles for iOS temporal inputs
178
+ //
179
+ // In Mobile Safari, setting `display: block` on temporal inputs causes the
180
+ // text within the input to become vertically misaligned. As a workaround, we
181
+ // set a pixel line-height that matches the given height of the input, but only
182
+ // for Safari. See https://bugs.webkit.org/show_bug.cgi?id=139848
183
+ //
184
+ // Note that as of 8.3, iOS doesn't support `datetime` or `week`.
185
+
186
+ @media screen and (-webkit-min-device-pixel-ratio: 0) {
187
+ input[type="date"],
188
+ input[type="time"],
189
+ input[type="datetime-local"],
190
+ input[type="month"] {
191
+ &.form-control {
192
+ line-height: @input-height-base;
193
+ }
194
+
195
+ &.input-sm,
196
+ .input-group-sm & {
197
+ line-height: @input-height-small;
198
+ }
199
+
200
+ &.input-lg,
201
+ .input-group-lg & {
202
+ line-height: @input-height-large;
203
+ }
204
+ }
207
205
  }
208
206
 
209
207
 
210
- // Placeholder
211
- // -------------------------
208
+ // Form groups
209
+ //
210
+ // Designed to help with the organization and spacing of vertical forms. For
211
+ // horizontal forms, use the predefined grid classes.
212
212
 
213
- // Placeholder text gets special styles because when browsers invalidate entire lines if it doesn't understand a selector
214
- input,
215
- textarea {
216
- .placeholder();
213
+ .form-group {
214
+ margin-bottom: @form-group-margin-bottom;
217
215
  }
218
216
 
219
217
 
220
- // CHECKBOXES & RADIOS
221
- // -------------------
218
+ // Checkboxes and radios
219
+ //
220
+ // Indent the labels to position radios/checkboxes as hanging controls.
222
221
 
223
- // Indent the labels to position radios/checkboxes as hanging
224
222
  .radio,
225
223
  .checkbox {
226
- min-height: @baseLineHeight; // clear the floating input if there is no label text
227
- padding-left: 20px;
224
+ position: relative;
225
+ display: block;
226
+ margin-top: 10px;
227
+ margin-bottom: 10px;
228
+
229
+ label {
230
+ min-height: @line-height-computed; // Ensure the input doesn't jump when there is no text
231
+ padding-left: 20px;
232
+ margin-bottom: 0;
233
+ font-weight: normal;
234
+ cursor: pointer;
235
+ }
228
236
  }
229
237
  .radio input[type="radio"],
230
- .checkbox input[type="checkbox"] {
231
- float: left;
238
+ .radio-inline input[type="radio"],
239
+ .checkbox input[type="checkbox"],
240
+ .checkbox-inline input[type="checkbox"] {
241
+ position: absolute;
232
242
  margin-left: -20px;
243
+ margin-top: 4px \9;
233
244
  }
234
245
 
235
- // Move the options list down to align with labels
236
- .controls > .radio:first-child,
237
- .controls > .checkbox:first-child {
238
- padding-top: 5px; // has to be padding because margin collaspes
246
+ .radio + .radio,
247
+ .checkbox + .checkbox {
248
+ margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing
239
249
  }
240
250
 
241
251
  // Radios and checkboxes on same line
242
- // TODO v3: Convert .inline to .control-inline
243
- .radio.inline,
244
- .checkbox.inline {
252
+ .radio-inline,
253
+ .checkbox-inline {
254
+ position: relative;
245
255
  display: inline-block;
246
- padding-top: 5px;
256
+ padding-left: 20px;
247
257
  margin-bottom: 0;
248
258
  vertical-align: middle;
259
+ font-weight: normal;
260
+ cursor: pointer;
249
261
  }
250
- .radio.inline + .radio.inline,
251
- .checkbox.inline + .checkbox.inline {
262
+ .radio-inline + .radio-inline,
263
+ .checkbox-inline + .checkbox-inline {
264
+ margin-top: 0;
252
265
  margin-left: 10px; // space out consecutive inline controls
253
266
  }
254
267
 
255
-
256
-
257
- // INPUT SIZES
258
- // -----------
259
-
260
- // General classes for quick sizes
261
- .input-mini { width: 60px; }
262
- .input-small { width: 90px; }
263
- .input-medium { width: 150px; }
264
- .input-large { width: 210px; }
265
- .input-xlarge { width: 270px; }
266
- .input-xxlarge { width: 530px; }
267
-
268
- // Grid style input sizes
269
- input[class*="span"],
270
- select[class*="span"],
271
- textarea[class*="span"],
272
- .uneditable-input[class*="span"],
273
- // Redeclare since the fluid row class is more specific
274
- .row-fluid input[class*="span"],
275
- .row-fluid select[class*="span"],
276
- .row-fluid textarea[class*="span"],
277
- .row-fluid .uneditable-input[class*="span"] {
278
- float: none;
279
- margin-left: 0;
280
- }
281
- // Ensure input-prepend/append never wraps
282
- .input-append input[class*="span"],
283
- .input-append .uneditable-input[class*="span"],
284
- .input-prepend input[class*="span"],
285
- .input-prepend .uneditable-input[class*="span"],
286
- .row-fluid input[class*="span"],
287
- .row-fluid select[class*="span"],
288
- .row-fluid textarea[class*="span"],
289
- .row-fluid .uneditable-input[class*="span"],
290
- .row-fluid .input-prepend [class*="span"],
291
- .row-fluid .input-append [class*="span"] {
292
- display: inline-block;
268
+ // Apply same disabled cursor tweak as for inputs
269
+ // Some special care is needed because <label>s don't inherit their parent's `cursor`.
270
+ //
271
+ // Note: Neither radios nor checkboxes can be readonly.
272
+ input[type="radio"],
273
+ input[type="checkbox"] {
274
+ &[disabled],
275
+ &.disabled,
276
+ fieldset[disabled] & {
277
+ cursor: @cursor-disabled;
278
+ }
279
+ }
280
+ // These classes are used directly on <label>s
281
+ .radio-inline,
282
+ .checkbox-inline {
283
+ &.disabled,
284
+ fieldset[disabled] & {
285
+ cursor: @cursor-disabled;
286
+ }
287
+ }
288
+ // These classes are used on elements with <label> descendants
289
+ .radio,
290
+ .checkbox {
291
+ &.disabled,
292
+ fieldset[disabled] & {
293
+ label {
294
+ cursor: @cursor-disabled;
295
+ }
296
+ }
293
297
  }
294
298
 
295
299
 
300
+ // Static form control text
301
+ //
302
+ // Apply class to a `p` element to make any string of text align with labels in
303
+ // a horizontal form layout.
304
+
305
+ .form-control-static {
306
+ // Size it appropriately next to real form controls
307
+ padding-top: (@padding-base-vertical + 1);
308
+ padding-bottom: (@padding-base-vertical + 1);
309
+ // Remove default margin from `p`
310
+ margin-bottom: 0;
311
+ min-height: (@line-height-computed + @font-size-base);
296
312
 
297
- // GRID SIZING FOR INPUTS
298
- // ----------------------
313
+ &.input-lg,
314
+ &.input-sm {
315
+ padding-left: 0;
316
+ padding-right: 0;
317
+ }
318
+ }
299
319
 
300
- // Grid sizes
301
- #grid > .input(@gridColumnWidth, @gridGutterWidth);
302
320
 
303
- // Control row for multiple inputs per line
304
- .controls-row {
305
- .clearfix(); // Clear the float from controls
321
+ // Form control sizing
322
+ //
323
+ // Build on `.form-control` with modifier classes to decrease or increase the
324
+ // height and font-size of form controls.
325
+ //
326
+ // The `.form-group-* form-control` variations are sadly duplicated to avoid the
327
+ // issue documented in https://github.com/twbs/bootstrap/issues/15074.
328
+
329
+ .input-sm {
330
+ .input-size(@input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @input-border-radius-small);
331
+ }
332
+ .form-group-sm {
333
+ .form-control {
334
+ height: @input-height-small;
335
+ padding: @padding-small-vertical @padding-small-horizontal;
336
+ font-size: @font-size-small;
337
+ line-height: @line-height-small;
338
+ border-radius: @input-border-radius-small;
339
+ }
340
+ select.form-control {
341
+ height: @input-height-small;
342
+ line-height: @input-height-small;
343
+ }
344
+ textarea.form-control,
345
+ select[multiple].form-control {
346
+ height: auto;
347
+ }
348
+ .form-control-static {
349
+ height: @input-height-small;
350
+ min-height: (@line-height-computed + @font-size-small);
351
+ padding: (@padding-small-vertical + 1) @padding-small-horizontal;
352
+ font-size: @font-size-small;
353
+ line-height: @line-height-small;
354
+ }
306
355
  }
307
356
 
308
- // Float to collapse white-space for proper grid alignment
309
- .controls-row [class*="span"],
310
- // Redeclare the fluid grid collapse since we undo the float for inputs
311
- .row-fluid .controls-row [class*="span"] {
312
- float: left;
357
+ .input-lg {
358
+ .input-size(@input-height-large; @padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @input-border-radius-large);
313
359
  }
314
- // Explicity set top padding on all checkboxes/radios, not just first-child
315
- .controls-row .checkbox[class*="span"],
316
- .controls-row .radio[class*="span"] {
317
- padding-top: 5px;
360
+ .form-group-lg {
361
+ .form-control {
362
+ height: @input-height-large;
363
+ padding: @padding-large-vertical @padding-large-horizontal;
364
+ font-size: @font-size-large;
365
+ line-height: @line-height-large;
366
+ border-radius: @input-border-radius-large;
367
+ }
368
+ select.form-control {
369
+ height: @input-height-large;
370
+ line-height: @input-height-large;
371
+ }
372
+ textarea.form-control,
373
+ select[multiple].form-control {
374
+ height: auto;
375
+ }
376
+ .form-control-static {
377
+ height: @input-height-large;
378
+ min-height: (@line-height-computed + @font-size-large);
379
+ padding: (@padding-large-vertical + 1) @padding-large-horizontal;
380
+ font-size: @font-size-large;
381
+ line-height: @line-height-large;
382
+ }
318
383
  }
319
384
 
320
385
 
386
+ // Form control feedback states
387
+ //
388
+ // Apply contextual and semantic states to individual form controls.
321
389
 
390
+ .has-feedback {
391
+ // Enable absolute positioning
392
+ position: relative;
322
393
 
323
- // DISABLED STATE
324
- // --------------
325
-
326
- // Disabled and read-only inputs
327
- input[disabled],
328
- select[disabled],
329
- textarea[disabled],
330
- input[readonly],
331
- select[readonly],
332
- textarea[readonly] {
333
- cursor: not-allowed;
334
- background-color: @inputDisabledBackground;
394
+ // Ensure icons don't overlap text
395
+ .form-control {
396
+ padding-right: (@input-height-base * 1.25);
397
+ }
335
398
  }
336
- // Explicitly reset the colors here
337
- input[type="radio"][disabled],
338
- input[type="checkbox"][disabled],
339
- input[type="radio"][readonly],
340
- input[type="checkbox"][readonly] {
341
- background-color: transparent;
399
+ // Feedback icon (requires .glyphicon classes)
400
+ .form-control-feedback {
401
+ position: absolute;
402
+ top: 0;
403
+ right: 0;
404
+ z-index: 2; // Ensure icon is above input groups
405
+ display: block;
406
+ width: @input-height-base;
407
+ height: @input-height-base;
408
+ line-height: @input-height-base;
409
+ text-align: center;
410
+ pointer-events: none;
342
411
  }
343
-
344
-
345
-
346
-
347
- // FORM FIELD FEEDBACK STATES
348
- // --------------------------
349
-
350
- // Warning
351
- .control-group.warning {
352
- .formFieldState(@warningText, @warningText, @warningBackground);
412
+ .input-lg + .form-control-feedback,
413
+ .input-group-lg + .form-control-feedback,
414
+ .form-group-lg .form-control + .form-control-feedback {
415
+ width: @input-height-large;
416
+ height: @input-height-large;
417
+ line-height: @input-height-large;
353
418
  }
354
- // Error
355
- .control-group.error {
356
- .formFieldState(@errorText, @errorText, @errorBackground);
419
+ .input-sm + .form-control-feedback,
420
+ .input-group-sm + .form-control-feedback,
421
+ .form-group-sm .form-control + .form-control-feedback {
422
+ width: @input-height-small;
423
+ height: @input-height-small;
424
+ line-height: @input-height-small;
357
425
  }
358
- // Success
359
- .control-group.success {
360
- .formFieldState(@successText, @successText, @successBackground);
426
+
427
+ // Feedback states
428
+ .has-success {
429
+ .form-control-validation(@state-success-text; @state-success-text; @state-success-bg);
361
430
  }
362
- // Success
363
- .control-group.info {
364
- .formFieldState(@infoText, @infoText, @infoBackground);
431
+ .has-warning {
432
+ .form-control-validation(@state-warning-text; @state-warning-text; @state-warning-bg);
365
433
  }
366
-
367
- // HTML5 invalid states
368
- // Shares styles with the .control-group.error above
369
- input:focus:invalid,
370
- textarea:focus:invalid,
371
- select:focus:invalid {
372
- color: #b94a48;
373
- border-color: #ee5f5b;
374
- &:focus {
375
- border-color: darken(#ee5f5b, 10%);
376
- @shadow: 0 0 6px lighten(#ee5f5b, 20%);
377
- .box-shadow(@shadow);
378
- }
434
+ .has-error {
435
+ .form-control-validation(@state-danger-text; @state-danger-text; @state-danger-bg);
379
436
  }
380
437
 
438
+ // Reposition feedback icon if input has visible label above
439
+ .has-feedback label {
381
440
 
382
-
383
- // FORM ACTIONS
384
- // ------------
385
-
386
- .form-actions {
387
- padding: (@baseLineHeight - 1) 20px @baseLineHeight;
388
- margin-top: @baseLineHeight;
389
- margin-bottom: @baseLineHeight;
390
- background-color: @formActionsBackground;
391
- border-top: 1px solid #e5e5e5;
392
- .clearfix(); // Adding clearfix to allow for .pull-right button containers
441
+ & ~ .form-control-feedback {
442
+ top: (@line-height-computed + 5); // Height of the `label` and its margin
443
+ }
444
+ &.sr-only ~ .form-control-feedback {
445
+ top: 0;
446
+ }
393
447
  }
394
448
 
395
449
 
396
-
397
- // HELP TEXT
398
- // ---------
399
-
400
- .help-block,
401
- .help-inline {
402
- color: lighten(@textColor, 15%); // lighten the text some for contrast
403
- }
450
+ // Help text
451
+ //
452
+ // Apply to any element you wish to create light text for placement immediately
453
+ // below a form control. Use for general help, formatting, or instructional text.
404
454
 
405
455
  .help-block {
406
456
  display: block; // account for any element using help-block
407
- margin-bottom: @baseLineHeight / 2;
457
+ margin-top: 5px;
458
+ margin-bottom: 10px;
459
+ color: lighten(@text-color, 25%); // lighten the text some for contrast
408
460
  }
409
461
 
410
- .help-inline {
411
- display: inline-block;
412
- .ie7-inline-block();
413
- vertical-align: middle;
414
- padding-left: 5px;
415
- }
416
462
 
463
+ // Inline forms
464
+ //
465
+ // Make forms appear inline(-block) by adding the `.form-inline` class. Inline
466
+ // forms begin stacked on extra small (mobile) devices and then go inline when
467
+ // viewports reach <768px.
468
+ //
469
+ // Requires wrapping inputs and labels with `.form-group` for proper display of
470
+ // default HTML form controls and our custom form controls (e.g., input groups).
471
+ //
472
+ // Heads up! This is mixin-ed into `.navbar-form` in navbars.less.
417
473
 
474
+ .form-inline {
418
475
 
419
- // INPUT GROUPS
420
- // ------------
421
-
422
- // Allow us to put symbols and text within the input field for a cleaner look
423
- .input-append,
424
- .input-prepend {
425
- display: inline-block;
426
- margin-bottom: @baseLineHeight / 2;
427
- vertical-align: middle;
428
- font-size: 0; // white space collapse hack
429
- white-space: nowrap; // Prevent span and input from separating
430
-
431
- // Reset the white space collapse hack
432
- input,
433
- select,
434
- .uneditable-input,
435
- .dropdown-menu,
436
- .popover {
437
- font-size: @baseFontSize;
438
- }
439
-
440
- input,
441
- select,
442
- .uneditable-input {
443
- 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
444
- margin-bottom: 0; // prevent bottom margin from screwing up alignment in stacked forms
445
- *margin-left: 0;
446
- vertical-align: top;
447
- .border-radius(0 @inputBorderRadius @inputBorderRadius 0);
448
- // Make input on top when focused so blue border and shadow always show
449
- &:focus {
450
- z-index: 2;
476
+ // Kick in the inline
477
+ @media (min-width: @screen-sm-min) {
478
+ // Inline-block all the things for "inline"
479
+ .form-group {
480
+ display: inline-block;
481
+ margin-bottom: 0;
482
+ vertical-align: middle;
451
483
  }
452
- }
453
- .add-on {
454
- display: inline-block;
455
- width: auto;
456
- height: @baseLineHeight;
457
- min-width: 16px;
458
- padding: 4px 5px;
459
- font-size: @baseFontSize;
460
- font-weight: normal;
461
- line-height: @baseLineHeight;
462
- text-align: center;
463
- text-shadow: 0 1px 0 @white;
464
- background-color: @grayLighter;
465
- border: 1px solid #ccc;
466
- }
467
- .add-on,
468
- .btn,
469
- .btn-group > .dropdown-toggle {
470
- vertical-align: top;
471
- .border-radius(0);
472
- }
473
- .active {
474
- background-color: lighten(@green, 30);
475
- border-color: @green;
476
- }
477
- }
478
484
 
479
- .input-prepend {
480
- .add-on,
481
- .btn {
482
- margin-right: -1px;
483
- }
484
- .add-on:first-child,
485
- .btn:first-child {
486
- // FYI, `.btn:first-child` accounts for a button group that's prepended
487
- .border-radius(@inputBorderRadius 0 0 @inputBorderRadius);
488
- }
489
- }
490
-
491
- .input-append {
492
- input,
493
- select,
494
- .uneditable-input {
495
- .border-radius(@inputBorderRadius 0 0 @inputBorderRadius);
496
- + .btn-group .btn:last-child {
497
- .border-radius(0 @inputBorderRadius @inputBorderRadius 0);
485
+ // In navbar-form, allow folks to *not* use `.form-group`
486
+ .form-control {
487
+ display: inline-block;
488
+ width: auto; // Prevent labels from stacking above inputs in `.form-group`
489
+ vertical-align: middle;
498
490
  }
499
- }
500
- .add-on,
501
- .btn,
502
- .btn-group {
503
- margin-left: -1px;
504
- }
505
- .add-on:last-child,
506
- .btn:last-child,
507
- .btn-group:last-child > .dropdown-toggle {
508
- .border-radius(0 @inputBorderRadius @inputBorderRadius 0);
509
- }
510
- }
511
491
 
512
- // Remove all border-radius for inputs with both prepend and append
513
- .input-prepend.input-append {
514
- input,
515
- select,
516
- .uneditable-input {
517
- .border-radius(0);
518
- + .btn-group .btn {
519
- .border-radius(0 @inputBorderRadius @inputBorderRadius 0);
492
+ // Make static controls behave like regular ones
493
+ .form-control-static {
494
+ display: inline-block;
520
495
  }
521
- }
522
- .add-on:first-child,
523
- .btn:first-child {
524
- margin-right: -1px;
525
- .border-radius(@inputBorderRadius 0 0 @inputBorderRadius);
526
- }
527
- .add-on:last-child,
528
- .btn:last-child {
529
- margin-left: -1px;
530
- .border-radius(0 @inputBorderRadius @inputBorderRadius 0);
531
- }
532
- .btn-group:first-child {
533
- margin-left: 0;
534
- }
535
- }
536
496
 
497
+ .input-group {
498
+ display: inline-table;
499
+ vertical-align: middle;
537
500
 
501
+ .input-group-addon,
502
+ .input-group-btn,
503
+ .form-control {
504
+ width: auto;
505
+ }
506
+ }
538
507
 
508
+ // Input groups need that 100% width though
509
+ .input-group > .form-control {
510
+ width: 100%;
511
+ }
539
512
 
540
- // SEARCH FORM
541
- // -----------
513
+ .control-label {
514
+ margin-bottom: 0;
515
+ vertical-align: middle;
516
+ }
542
517
 
543
- input.search-query {
544
- padding-right: 14px;
545
- padding-right: 4px \9;
546
- padding-left: 14px;
547
- padding-left: 4px \9; /* IE7-8 doesn't have border-radius, so don't indent the padding */
548
- margin-bottom: 0; // Remove the default margin on all inputs
549
- .border-radius(15px);
550
- }
518
+ // Remove default margin on radios/checkboxes that were used for stacking, and
519
+ // then undo the floating of radios and checkboxes to match.
520
+ .radio,
521
+ .checkbox {
522
+ display: inline-block;
523
+ margin-top: 0;
524
+ margin-bottom: 0;
525
+ vertical-align: middle;
526
+
527
+ label {
528
+ padding-left: 0;
529
+ }
530
+ }
531
+ .radio input[type="radio"],
532
+ .checkbox input[type="checkbox"] {
533
+ position: relative;
534
+ margin-left: 0;
535
+ }
551
536
 
552
- /* Allow for input prepend/append in search forms */
553
- .form-search .input-append .search-query,
554
- .form-search .input-prepend .search-query {
555
- .border-radius(0); // Override due to specificity
556
- }
557
- .form-search .input-append .search-query {
558
- .border-radius(14px 0 0 14px);
559
- }
560
- .form-search .input-append .btn {
561
- .border-radius(0 14px 14px 0);
562
- }
563
- .form-search .input-prepend .search-query {
564
- .border-radius(0 14px 14px 0);
565
- }
566
- .form-search .input-prepend .btn {
567
- .border-radius(14px 0 0 14px);
537
+ // Re-override the feedback icon.
538
+ .has-feedback .form-control-feedback {
539
+ top: 0;
540
+ }
541
+ }
568
542
  }
569
543
 
570
544
 
545
+ // Horizontal forms
546
+ //
547
+ // Horizontal forms are built on grid classes and allow you to create forms with
548
+ // labels on the left and inputs on the right.
571
549
 
572
-
573
- // HORIZONTAL & VERTICAL FORMS
574
- // ---------------------------
575
-
576
- // Common properties
577
- // -----------------
578
-
579
- .form-search,
580
- .form-inline,
581
550
  .form-horizontal {
582
- input,
583
- textarea,
584
- select,
585
- .help-inline,
586
- .uneditable-input,
587
- .input-prepend,
588
- .input-append {
589
- display: inline-block;
590
- .ie7-inline-block();
551
+
552
+ // Consistent vertical alignment of radios and checkboxes
553
+ //
554
+ // Labels also get some reset styles, but that is scoped to a media query below.
555
+ .radio,
556
+ .checkbox,
557
+ .radio-inline,
558
+ .checkbox-inline {
559
+ margin-top: 0;
591
560
  margin-bottom: 0;
592
- vertical-align: middle;
561
+ padding-top: (@padding-base-vertical + 1); // Default padding plus a border
593
562
  }
594
- // Re-hide hidden elements due to specifity
595
- .hide {
596
- display: none;
563
+ // Account for padding we're adding to ensure the alignment and of help text
564
+ // and other content below items
565
+ .radio,
566
+ .checkbox {
567
+ min-height: (@line-height-computed + (@padding-base-vertical + 1));
597
568
  }
598
- }
599
- .form-search label,
600
- .form-inline label,
601
- .form-search .btn-group,
602
- .form-inline .btn-group {
603
- display: inline-block;
604
- }
605
- // Remove margin for input-prepend/-append
606
- .form-search .input-append,
607
- .form-inline .input-append,
608
- .form-search .input-prepend,
609
- .form-inline .input-prepend {
610
- margin-bottom: 0;
611
- }
612
- // Inline checkbox/radio labels (remove padding on left)
613
- .form-search .radio,
614
- .form-search .checkbox,
615
- .form-inline .radio,
616
- .form-inline .checkbox {
617
- padding-left: 0;
618
- margin-bottom: 0;
619
- vertical-align: middle;
620
- }
621
- // Remove float and margin, set to inline-block
622
- .form-search .radio input[type="radio"],
623
- .form-search .checkbox input[type="checkbox"],
624
- .form-inline .radio input[type="radio"],
625
- .form-inline .checkbox input[type="checkbox"] {
626
- float: left;
627
- margin-right: 3px;
628
- margin-left: 0;
629
- }
630
-
631
569
 
632
- // Margin to space out fieldsets
633
- .control-group {
634
- margin-bottom: @baseLineHeight / 2;
635
- }
636
-
637
- // Legend collapses margin, so next element is responsible for spacing
638
- legend + .control-group {
639
- margin-top: @baseLineHeight;
640
- -webkit-margin-top-collapse: separate;
641
- }
642
-
643
- // Horizontal-specific styles
644
- // --------------------------
645
-
646
- .form-horizontal {
647
- // Increase spacing between groups
648
- .control-group {
649
- margin-bottom: @baseLineHeight;
650
- .clearfix();
651
- }
652
- // Float the labels left
653
- .control-label {
654
- float: left;
655
- width: @horizontalComponentOffset - 20;
656
- padding-top: 5px;
657
- text-align: right;
570
+ // Make form groups behave like rows
571
+ .form-group {
572
+ .make-row();
658
573
  }
659
- // Move over all input controls and content
660
- .controls {
661
- // Super jank IE7 fix to ensure the inputs in .input-append and input-prepend
662
- // don't inherit the margin of the parent, in this case .controls
663
- *display: inline-block;
664
- *padding-left: 20px;
665
- margin-left: @horizontalComponentOffset;
666
- *margin-left: 0;
667
- &:first-child {
668
- *padding-left: @horizontalComponentOffset;
574
+
575
+ // Reset spacing and right align labels, but scope to media queries so that
576
+ // labels on narrow viewports stack the same as a default form example.
577
+ @media (min-width: @screen-sm-min) {
578
+ .control-label {
579
+ text-align: right;
580
+ margin-bottom: 0;
581
+ padding-top: (@padding-base-vertical + 1); // Default padding plus a border
669
582
  }
670
583
  }
671
- // Remove bottom margin on block level help text since that's accounted for on .control-group
672
- .help-block {
673
- margin-bottom: 0;
584
+
585
+ // Validation states
586
+ //
587
+ // Reposition the icon because it's now within a grid column and columns have
588
+ // `position: relative;` on them. Also accounts for the grid gutter padding.
589
+ .has-feedback .form-control-feedback {
590
+ right: floor((@grid-gutter-width / 2));
674
591
  }
675
- // And apply it only to .help-block instances that follow a form control
676
- input,
677
- select,
678
- textarea,
679
- .uneditable-input,
680
- .input-prepend,
681
- .input-append {
682
- + .help-block {
683
- margin-top: @baseLineHeight / 2;
592
+
593
+ // Form group sizes
594
+ //
595
+ // Quick utility class for applying `.input-lg` and `.input-sm` styles to the
596
+ // inputs and labels within a `.form-group`.
597
+ .form-group-lg {
598
+ @media (min-width: @screen-sm-min) {
599
+ .control-label {
600
+ padding-top: (@padding-large-vertical + 1);
601
+ font-size: @font-size-large;
602
+ }
684
603
  }
685
604
  }
686
- // Move over buttons in .form-actions to align with .controls
687
- .form-actions {
688
- padding-left: @horizontalComponentOffset;
605
+ .form-group-sm {
606
+ @media (min-width: @screen-sm-min) {
607
+ .control-label {
608
+ padding-top: (@padding-small-vertical + 1);
609
+ font-size: @font-size-small;
610
+ }
611
+ }
689
612
  }
690
613
  }