twitter-bootstrap-rails 2.2.3 → 3.2.2

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 (204) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +460 -185
  3. data/Rakefile +7 -1
  4. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  5. data/app/assets/fonts/fontawesome-webfont.svg +640 -0
  6. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  7. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  8. data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  9. data/app/assets/fonts/glyphicons-halflings-regular.svg +229 -0
  10. data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  11. data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  12. data/app/assets/javascripts/twitter/bootstrap.js +12 -0
  13. data/app/assets/javascripts/twitter/bootstrap/affix.js +142 -0
  14. data/app/assets/javascripts/twitter/bootstrap/alert.js +92 -0
  15. data/app/assets/javascripts/twitter/bootstrap/button.js +110 -0
  16. data/app/assets/javascripts/twitter/bootstrap/carousel.js +223 -0
  17. data/app/assets/javascripts/twitter/bootstrap/collapse.js +170 -0
  18. data/app/assets/javascripts/twitter/bootstrap/dropdown.js +151 -0
  19. data/app/assets/javascripts/twitter/bootstrap/modal.js +280 -0
  20. data/app/assets/javascripts/twitter/bootstrap/popover.js +113 -0
  21. data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +170 -0
  22. data/app/assets/javascripts/twitter/bootstrap/tab.js +128 -0
  23. data/app/assets/javascripts/twitter/bootstrap/tooltip.js +457 -0
  24. data/app/assets/javascripts/twitter/bootstrap/transition.js +59 -0
  25. data/{vendor → app}/assets/javascripts/twitter/bootstrap_ujs.js +0 -0
  26. data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +1 -0
  27. data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +2026 -0
  28. data/app/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +1 -0
  29. data/app/helpers/badge_label_helper.rb +16 -0
  30. data/app/helpers/bootstrap_flash_helper.rb +20 -6
  31. data/app/helpers/form_errors_helper.rb +22 -0
  32. data/app/helpers/glyph_helper.rb +13 -5
  33. data/app/helpers/modal_helper.rb +37 -20
  34. data/app/helpers/navbar_helper.rb +209 -0
  35. data/app/helpers/twitter_breadcrumbs_helper.rb +11 -2
  36. data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +9 -9
  37. data/lib/generators/bootstrap/install/install_generator.rb +13 -8
  38. data/lib/generators/bootstrap/install/templates/bootstrap.coffee +2 -3
  39. data/lib/generators/bootstrap/install/templates/bootstrap.js +2 -3
  40. data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +14 -13
  41. data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +11 -5
  42. data/lib/generators/bootstrap/layout/layout_generator.rb +1 -4
  43. data/lib/generators/bootstrap/layout/templates/layout.html.erb +34 -58
  44. data/lib/generators/bootstrap/layout/templates/layout.html.haml +25 -44
  45. data/lib/generators/bootstrap/layout/templates/layout.html.slim +20 -39
  46. data/lib/generators/bootstrap/partial/templates/_login.html.erb +2 -3
  47. data/lib/generators/bootstrap/themed/templates/_form.html.erb +30 -10
  48. data/lib/generators/bootstrap/themed/templates/_form.html.haml +10 -8
  49. data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -9
  50. data/lib/generators/bootstrap/themed/templates/edit.html.erb +1 -2
  51. data/lib/generators/bootstrap/themed/templates/edit.html.haml +1 -1
  52. data/lib/generators/bootstrap/themed/templates/edit.html.slim +2 -2
  53. data/lib/generators/bootstrap/themed/templates/index.html.erb +3 -3
  54. data/lib/generators/bootstrap/themed/templates/index.html.haml +3 -3
  55. data/lib/generators/bootstrap/themed/templates/index.html.slim +5 -6
  56. data/lib/generators/bootstrap/themed/templates/new.html.erb +1 -2
  57. data/lib/generators/bootstrap/themed/templates/new.html.haml +1 -1
  58. data/lib/generators/bootstrap/themed/templates/new.html.slim +2 -2
  59. data/lib/generators/bootstrap/themed/templates/show.html.erb +6 -8
  60. data/lib/generators/bootstrap/themed/templates/show.html.haml +5 -5
  61. data/lib/generators/bootstrap/themed/templates/show.html.slim +7 -8
  62. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +5 -5
  63. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +3 -3
  64. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +4 -4
  65. data/lib/generators/bootstrap/themed/themed_generator.rb +4 -4
  66. data/lib/twitter-bootstrap-rails.rb +4 -4
  67. data/lib/twitter/bootstrap/rails/breadcrumbs.rb +69 -0
  68. data/lib/twitter/bootstrap/rails/engine.rb +17 -7
  69. data/lib/twitter/bootstrap/rails/version.rb +1 -1
  70. data/spec/lib/breadcrumbs_spec.rb +99 -0
  71. data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +30 -0
  72. data/spec/lib/twitter_bootstrap_rails/bootstrap_flash_helper_spec.rb +128 -0
  73. data/spec/lib/twitter_bootstrap_rails/form_errors_helper_spec.rb +148 -0
  74. data/spec/lib/twitter_bootstrap_rails/glyph_helper_spec.rb +24 -0
  75. data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +62 -0
  76. data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +396 -0
  77. data/spec/lib/twitter_bootstrap_rails/uri_state_spec.rb +49 -0
  78. data/spec/spec_helper.rb +21 -0
  79. data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +5990 -195
  80. data/vendor/static-source/bootstrap.less +0 -1
  81. data/vendor/static-source/fontawesome.less +7 -6
  82. data/vendor/static-source/sprites.less +3 -3
  83. data/vendor/toolkit/fontawesome/bordered-pulled.less +16 -0
  84. data/vendor/toolkit/fontawesome/core.less +11 -0
  85. data/vendor/toolkit/fontawesome/fixed-width.less +6 -0
  86. data/vendor/toolkit/fontawesome/font-awesome.less +17 -0
  87. data/vendor/toolkit/fontawesome/icons.less +552 -0
  88. data/vendor/toolkit/fontawesome/larger.less +13 -0
  89. data/vendor/toolkit/fontawesome/list.less +19 -0
  90. data/vendor/toolkit/fontawesome/mixins.less +25 -0
  91. data/vendor/toolkit/fontawesome/path.less +14 -0
  92. data/vendor/toolkit/fontawesome/rotated-flipped.less +20 -0
  93. data/vendor/toolkit/fontawesome/spinning.less +29 -0
  94. data/vendor/toolkit/fontawesome/stacked.less +20 -0
  95. data/vendor/toolkit/fontawesome/variables.less +561 -0
  96. data/vendor/toolkit/twitter/bootstrap/alerts.less +47 -58
  97. data/vendor/toolkit/twitter/bootstrap/badges.less +55 -0
  98. data/vendor/toolkit/twitter/bootstrap/bootstrap.less +26 -39
  99. data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +11 -9
  100. data/vendor/toolkit/twitter/bootstrap/button-groups.less +168 -152
  101. data/vendor/toolkit/twitter/bootstrap/buttons.less +101 -170
  102. data/vendor/toolkit/twitter/bootstrap/carousel.less +150 -65
  103. data/vendor/toolkit/twitter/bootstrap/close.less +20 -19
  104. data/vendor/toolkit/twitter/bootstrap/code.less +38 -30
  105. data/vendor/toolkit/twitter/bootstrap/component-animations.less +12 -3
  106. data/vendor/toolkit/twitter/bootstrap/dropdowns.less +124 -146
  107. data/vendor/toolkit/twitter/bootstrap/forms.less +401 -547
  108. data/vendor/toolkit/twitter/bootstrap/glyphicons.less +234 -0
  109. data/vendor/toolkit/twitter/bootstrap/grid.less +74 -11
  110. data/vendor/toolkit/twitter/bootstrap/input-groups.less +166 -0
  111. data/vendor/toolkit/twitter/bootstrap/jumbotron.less +48 -0
  112. data/vendor/toolkit/twitter/bootstrap/labels.less +64 -0
  113. data/vendor/toolkit/twitter/bootstrap/list-group.less +132 -0
  114. data/vendor/toolkit/twitter/bootstrap/media.less +8 -7
  115. data/vendor/toolkit/twitter/bootstrap/mixins.less +36 -699
  116. data/vendor/toolkit/twitter/bootstrap/mixins/alerts.less +14 -0
  117. data/vendor/toolkit/twitter/bootstrap/mixins/background-variant.less +8 -0
  118. data/vendor/toolkit/twitter/bootstrap/mixins/border-radius.less +18 -0
  119. data/vendor/toolkit/twitter/bootstrap/mixins/buttons.less +52 -0
  120. data/vendor/toolkit/twitter/bootstrap/mixins/center-block.less +7 -0
  121. data/vendor/toolkit/twitter/bootstrap/mixins/clearfix.less +22 -0
  122. data/vendor/toolkit/twitter/bootstrap/mixins/forms.less +85 -0
  123. data/vendor/toolkit/twitter/bootstrap/mixins/gradients.less +59 -0
  124. data/vendor/toolkit/twitter/bootstrap/mixins/grid-framework.less +91 -0
  125. data/vendor/toolkit/twitter/bootstrap/mixins/grid.less +122 -0
  126. data/vendor/toolkit/twitter/bootstrap/mixins/hide-text.less +21 -0
  127. data/vendor/toolkit/twitter/bootstrap/mixins/image.less +33 -0
  128. data/vendor/toolkit/twitter/bootstrap/mixins/labels.less +12 -0
  129. data/vendor/toolkit/twitter/bootstrap/mixins/list-group.less +29 -0
  130. data/vendor/toolkit/twitter/bootstrap/mixins/nav-divider.less +10 -0
  131. data/vendor/toolkit/twitter/bootstrap/mixins/nav-vertical-align.less +9 -0
  132. data/vendor/toolkit/twitter/bootstrap/mixins/opacity.less +8 -0
  133. data/vendor/toolkit/twitter/bootstrap/mixins/pagination.less +23 -0
  134. data/vendor/toolkit/twitter/bootstrap/mixins/panels.less +24 -0
  135. data/vendor/toolkit/twitter/bootstrap/mixins/progress-bar.less +10 -0
  136. data/vendor/toolkit/twitter/bootstrap/mixins/reset-filter.less +8 -0
  137. data/vendor/toolkit/twitter/bootstrap/mixins/resize.less +6 -0
  138. data/vendor/toolkit/twitter/bootstrap/mixins/responsive-visibility.less +15 -0
  139. data/vendor/toolkit/twitter/bootstrap/mixins/size.less +10 -0
  140. data/vendor/toolkit/twitter/bootstrap/mixins/tab-focus.less +9 -0
  141. data/vendor/toolkit/twitter/bootstrap/mixins/table-row.less +28 -0
  142. data/vendor/toolkit/twitter/bootstrap/mixins/text-emphasis.less +8 -0
  143. data/vendor/toolkit/twitter/bootstrap/mixins/text-overflow.less +8 -0
  144. data/vendor/toolkit/twitter/bootstrap/mixins/vendor-prefixes.less +224 -0
  145. data/vendor/toolkit/twitter/bootstrap/modals.less +109 -54
  146. data/vendor/toolkit/twitter/bootstrap/navbar.less +542 -384
  147. data/vendor/toolkit/twitter/bootstrap/navs.less +192 -359
  148. data/vendor/toolkit/twitter/bootstrap/normalize.less +425 -0
  149. data/vendor/toolkit/twitter/bootstrap/pager.less +46 -34
  150. data/vendor/toolkit/twitter/bootstrap/pagination.less +70 -105
  151. data/vendor/toolkit/twitter/bootstrap/panels.less +248 -0
  152. data/vendor/toolkit/twitter/bootstrap/popovers.less +61 -61
  153. data/vendor/toolkit/twitter/bootstrap/print.less +101 -0
  154. data/vendor/toolkit/twitter/bootstrap/progress-bars.less +51 -73
  155. data/vendor/toolkit/twitter/bootstrap/responsive-embed.less +34 -0
  156. data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +177 -42
  157. data/vendor/toolkit/twitter/bootstrap/scaffolding.less +120 -23
  158. data/vendor/toolkit/twitter/bootstrap/tables.less +171 -182
  159. data/vendor/toolkit/twitter/bootstrap/theme.less +260 -0
  160. data/vendor/toolkit/twitter/bootstrap/thumbnails.less +26 -43
  161. data/vendor/toolkit/twitter/bootstrap/tooltip.less +49 -24
  162. data/vendor/toolkit/twitter/bootstrap/type.less +208 -147
  163. data/vendor/toolkit/twitter/bootstrap/utilities.less +33 -7
  164. data/vendor/toolkit/twitter/bootstrap/variables.less +761 -215
  165. data/vendor/toolkit/twitter/bootstrap/wells.less +7 -7
  166. metadata +199 -92
  167. data/lib/generators/bootstrap/partial/templates/_navbar.html.erb +0 -13
  168. data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +0 -42
  169. data/test/lib/breadcrumbs_test.rb +0 -75
  170. data/test/test_helper.rb +0 -8
  171. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  172. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  173. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  174. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  175. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  176. data/vendor/assets/javascripts/twitter/bootstrap.js +0 -13
  177. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-affix.js +0 -117
  178. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +0 -99
  179. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +0 -105
  180. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +0 -207
  181. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +0 -167
  182. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +0 -165
  183. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +0 -247
  184. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +0 -114
  185. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +0 -162
  186. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +0 -144
  187. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +0 -353
  188. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +0 -60
  189. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +0 -335
  190. data/vendor/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +0 -531
  191. data/vendor/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +0 -146
  192. data/vendor/toolkit/fontawesome-ie7.less +0 -350
  193. data/vendor/toolkit/fontawesome.less +0 -532
  194. data/vendor/toolkit/twitter/bootstrap/accordion.less +0 -34
  195. data/vendor/toolkit/twitter/bootstrap/hero-unit.less +0 -25
  196. data/vendor/toolkit/twitter/bootstrap/labels-badges.less +0 -84
  197. data/vendor/toolkit/twitter/bootstrap/layouts.less +0 -16
  198. data/vendor/toolkit/twitter/bootstrap/reset.less +0 -216
  199. data/vendor/toolkit/twitter/bootstrap/responsive-1200px-min.less +0 -28
  200. data/vendor/toolkit/twitter/bootstrap/responsive-767px-max.less +0 -193
  201. data/vendor/toolkit/twitter/bootstrap/responsive-768px-979px.less +0 -19
  202. data/vendor/toolkit/twitter/bootstrap/responsive-navbar.less +0 -189
  203. data/vendor/toolkit/twitter/bootstrap/responsive.less +0 -48
  204. data/vendor/toolkit/twitter/bootstrap/sprites.less +0 -197
@@ -3,167 +3,68 @@
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
39
 
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
- }
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.
91
45
 
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
- }
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,
59
+ // Set the height of file controls to match text inputs
156
60
  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;
61
+ display: block;
160
62
  }
161
63
 
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
64
+ // Make range inputs behave like textual form controls
65
+ input[type="range"] {
66
+ display: block;
67
+ width: 100%;
167
68
  }
168
69
 
169
70
  // Make multiple select elements height not fixed
@@ -172,519 +73,472 @@ select[size] {
172
73
  height: auto;
173
74
  }
174
75
 
175
- // Focus for select, file, radio, and checkbox
176
- select:focus,
76
+ // Focus for file, radio, and checkbox
177
77
  input[type="file"]:focus,
178
78
  input[type="radio"]:focus,
179
79
  input[type="checkbox"]:focus {
180
80
  .tab-focus();
181
81
  }
182
82
 
83
+ // Adjust output element
84
+ output {
85
+ display: block;
86
+ padding-top: (@padding-base-vertical + 1);
87
+ font-size: @font-size-base;
88
+ line-height: @line-height-base;
89
+ color: @input-color;
90
+ }
91
+
183
92
 
184
- // Uneditable inputs
185
- // -------------------------
93
+ // Common form controls
94
+ //
95
+ // Shared size and type resets for form controls. Apply `.form-control` to any
96
+ // of the following form controls:
97
+ //
98
+ // select
99
+ // textarea
100
+ // input[type="text"]
101
+ // input[type="password"]
102
+ // input[type="datetime"]
103
+ // input[type="datetime-local"]
104
+ // input[type="date"]
105
+ // input[type="month"]
106
+ // input[type="time"]
107
+ // input[type="week"]
108
+ // input[type="number"]
109
+ // input[type="email"]
110
+ // input[type="url"]
111
+ // input[type="search"]
112
+ // input[type="tel"]
113
+ // input[type="color"]
114
+
115
+ .form-control {
116
+ display: block;
117
+ width: 100%;
118
+ height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border)
119
+ padding: @padding-base-vertical @padding-base-horizontal;
120
+ font-size: @font-size-base;
121
+ line-height: @line-height-base;
122
+ color: @input-color;
123
+ background-color: @input-bg;
124
+ background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
125
+ border: 1px solid @input-border;
126
+ border-radius: @input-border-radius;
127
+ .box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
128
+ .transition(~"border-color ease-in-out .15s, box-shadow ease-in-out .15s");
129
+
130
+ // Customize the `:focus` state to imitate native WebKit styles.
131
+ .form-control-focus();
132
+
133
+ // Placeholder
134
+ .placeholder();
135
+
136
+ // Disabled and read-only inputs
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.
141
+ &[disabled],
142
+ &[readonly],
143
+ fieldset[disabled] & {
144
+ cursor: not-allowed;
145
+ background-color: @input-bg-disabled;
146
+ opacity: 1; // iOS fix for unreadable disabled content
147
+ }
186
148
 
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;
149
+ // Reset height for `textarea`s
150
+ textarea& {
151
+ height: auto;
152
+ }
195
153
  }
196
154
 
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;
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;
201
165
  }
202
166
 
203
- // Make uneditable textareas behave like a textarea
204
- .uneditable-textarea {
205
- width: auto;
206
- height: auto;
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
+ line-height: @line-height-small ~"\0";
187
+ }
188
+ &.input-lg {
189
+ line-height: @input-height-large;
190
+ line-height: @line-height-large ~"\0";
191
+ }
207
192
  }
208
193
 
209
194
 
210
- // Placeholder
211
- // -------------------------
195
+ // Form groups
196
+ //
197
+ // Designed to help with the organization and spacing of vertical forms. For
198
+ // horizontal forms, use the predefined grid classes.
212
199
 
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();
200
+ .form-group {
201
+ margin-bottom: 15px;
217
202
  }
218
203
 
219
204
 
220
- // CHECKBOXES & RADIOS
221
- // -------------------
205
+ // Checkboxes and radios
206
+ //
207
+ // Indent the labels to position radios/checkboxes as hanging controls.
222
208
 
223
- // Indent the labels to position radios/checkboxes as hanging
224
209
  .radio,
225
210
  .checkbox {
226
- min-height: @baseLineHeight; // clear the floating input if there is no label text
227
- padding-left: 20px;
211
+ position: relative;
212
+ display: block;
213
+ margin-top: 10px;
214
+ margin-bottom: 10px;
215
+
216
+ label {
217
+ min-height: @line-height-computed; // Ensure the input doesn't jump when there is no text
218
+ padding-left: 20px;
219
+ margin-bottom: 0;
220
+ font-weight: normal;
221
+ cursor: pointer;
222
+ }
228
223
  }
229
224
  .radio input[type="radio"],
230
- .checkbox input[type="checkbox"] {
231
- float: left;
225
+ .radio-inline input[type="radio"],
226
+ .checkbox input[type="checkbox"],
227
+ .checkbox-inline input[type="checkbox"] {
228
+ position: absolute;
232
229
  margin-left: -20px;
230
+ margin-top: 4px \9;
233
231
  }
234
232
 
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
233
+ .radio + .radio,
234
+ .checkbox + .checkbox {
235
+ margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing
239
236
  }
240
237
 
241
238
  // Radios and checkboxes on same line
242
- // TODO v3: Convert .inline to .control-inline
243
- .radio.inline,
244
- .checkbox.inline {
239
+ .radio-inline,
240
+ .checkbox-inline {
245
241
  display: inline-block;
246
- padding-top: 5px;
242
+ padding-left: 20px;
247
243
  margin-bottom: 0;
248
244
  vertical-align: middle;
245
+ font-weight: normal;
246
+ cursor: pointer;
249
247
  }
250
- .radio.inline + .radio.inline,
251
- .checkbox.inline + .checkbox.inline {
248
+ .radio-inline + .radio-inline,
249
+ .checkbox-inline + .checkbox-inline {
250
+ margin-top: 0;
252
251
  margin-left: 10px; // space out consecutive inline controls
253
252
  }
254
253
 
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;
293
- }
294
-
295
-
296
-
297
- // GRID SIZING FOR INPUTS
298
- // ----------------------
299
-
300
- // Grid sizes
301
- #grid > .input(@gridColumnWidth, @gridGutterWidth);
302
-
303
- // Control row for multiple inputs per line
304
- .controls-row {
305
- .clearfix(); // Clear the float from controls
254
+ // Apply same disabled cursor tweak as for inputs
255
+ // Some special care is needed because <label>s don't inherit their parent's `cursor`.
256
+ //
257
+ // Note: Neither radios nor checkboxes can be readonly.
258
+ input[type="radio"],
259
+ input[type="checkbox"] {
260
+ &[disabled],
261
+ &.disabled,
262
+ fieldset[disabled] & {
263
+ cursor: not-allowed;
264
+ }
306
265
  }
307
-
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;
266
+ // These classes are used directly on <label>s
267
+ .radio-inline,
268
+ .checkbox-inline {
269
+ &.disabled,
270
+ fieldset[disabled] & {
271
+ cursor: not-allowed;
272
+ }
313
273
  }
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;
274
+ // These classes are used on elements with <label> descendants
275
+ .radio,
276
+ .checkbox {
277
+ &.disabled,
278
+ fieldset[disabled] & {
279
+ label {
280
+ cursor: not-allowed;
281
+ }
282
+ }
318
283
  }
319
284
 
320
285
 
286
+ // Static form control text
287
+ //
288
+ // Apply class to a `p` element to make any string of text align with labels in
289
+ // a horizontal form layout.
290
+
291
+ .form-control-static {
292
+ // Size it appropriately next to real form controls
293
+ padding-top: (@padding-base-vertical + 1);
294
+ padding-bottom: (@padding-base-vertical + 1);
295
+ // Remove default margin from `p`
296
+ margin-bottom: 0;
297
+
298
+ &.input-lg,
299
+ &.input-sm {
300
+ padding-left: 0;
301
+ padding-right: 0;
302
+ }
303
+ }
321
304
 
322
305
 
323
- // DISABLED STATE
324
- // --------------
306
+ // Form control sizing
307
+ //
308
+ // Build on `.form-control` with modifier classes to decrease or increase the
309
+ // height and font-size of form controls.
325
310
 
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;
335
- }
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;
311
+ .input-sm,
312
+ .form-group-sm .form-control {
313
+ .input-size(@input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small);
342
314
  }
343
315
 
316
+ .input-lg,
317
+ .form-group-lg .form-control {
318
+ .input-size(@input-height-large; @padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large);
319
+ }
344
320
 
345
321
 
322
+ // Form control feedback states
323
+ //
324
+ // Apply contextual and semantic states to individual form controls.
346
325
 
347
- // FORM FIELD FEEDBACK STATES
348
- // --------------------------
326
+ .has-feedback {
327
+ // Enable absolute positioning
328
+ position: relative;
349
329
 
350
- // Warning
351
- .control-group.warning {
352
- .formFieldState(@warningText, @warningText, @warningBackground);
330
+ // Ensure icons don't overlap text
331
+ .form-control {
332
+ padding-right: (@input-height-base * 1.25);
333
+ }
353
334
  }
354
- // Error
355
- .control-group.error {
356
- .formFieldState(@errorText, @errorText, @errorBackground);
335
+ // Feedback icon (requires .glyphicon classes)
336
+ .form-control-feedback {
337
+ position: absolute;
338
+ top: 0;
339
+ right: 0;
340
+ z-index: 2; // Ensure icon is above input groups
341
+ display: block;
342
+ width: @input-height-base;
343
+ height: @input-height-base;
344
+ line-height: @input-height-base;
345
+ text-align: center;
346
+ pointer-events: none;
357
347
  }
358
- // Success
359
- .control-group.success {
360
- .formFieldState(@successText, @successText, @successBackground);
348
+ .input-lg + .form-control-feedback {
349
+ width: @input-height-large;
350
+ height: @input-height-large;
351
+ line-height: @input-height-large;
361
352
  }
362
- // Success
363
- .control-group.info {
364
- .formFieldState(@infoText, @infoText, @infoBackground);
353
+ .input-sm + .form-control-feedback {
354
+ width: @input-height-small;
355
+ height: @input-height-small;
356
+ line-height: @input-height-small;
365
357
  }
366
358
 
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
- }
359
+ // Feedback states
360
+ .has-success {
361
+ .form-control-validation(@state-success-text; @state-success-text; @state-success-bg);
379
362
  }
380
-
381
-
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
363
+ .has-warning {
364
+ .form-control-validation(@state-warning-text; @state-warning-text; @state-warning-bg);
365
+ }
366
+ .has-error {
367
+ .form-control-validation(@state-danger-text; @state-danger-text; @state-danger-bg);
393
368
  }
394
369
 
370
+ // Reposition feedback icon if input has visible label above
371
+ .has-feedback label {
395
372
 
373
+ & ~ .form-control-feedback {
374
+ top: (@line-height-computed + 5); // Height of the `label` and its margin
375
+ }
376
+ &.sr-only ~ .form-control-feedback {
377
+ top: 0;
378
+ }
379
+ }
396
380
 
397
- // HELP TEXT
398
- // ---------
399
381
 
400
- .help-block,
401
- .help-inline {
402
- color: lighten(@textColor, 15%); // lighten the text some for contrast
403
- }
382
+ // Help text
383
+ //
384
+ // Apply to any element you wish to create light text for placement immediately
385
+ // below a form control. Use for general help, formatting, or instructional text.
404
386
 
405
387
  .help-block {
406
388
  display: block; // account for any element using help-block
407
- margin-bottom: @baseLineHeight / 2;
408
- }
409
-
410
- .help-inline {
411
- display: inline-block;
412
- .ie7-inline-block();
413
- vertical-align: middle;
414
- padding-left: 5px;
389
+ margin-top: 5px;
390
+ margin-bottom: 10px;
391
+ color: lighten(@text-color, 25%); // lighten the text some for contrast
415
392
  }
416
393
 
417
394
 
395
+ // Inline forms
396
+ //
397
+ // Make forms appear inline(-block) by adding the `.form-inline` class. Inline
398
+ // forms begin stacked on extra small (mobile) devices and then go inline when
399
+ // viewports reach <768px.
400
+ //
401
+ // Requires wrapping inputs and labels with `.form-group` for proper display of
402
+ // default HTML form controls and our custom form controls (e.g., input groups).
403
+ //
404
+ // Heads up! This is mixin-ed into `.navbar-form` in navbars.less.
418
405
 
419
- // INPUT GROUPS
420
- // ------------
406
+ .form-inline {
421
407
 
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;
408
+ // Kick in the inline
409
+ @media (min-width: @screen-sm-min) {
410
+ // Inline-block all the things for "inline"
411
+ .form-group {
412
+ display: inline-block;
413
+ margin-bottom: 0;
414
+ vertical-align: middle;
451
415
  }
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
416
 
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);
417
+ // In navbar-form, allow folks to *not* use `.form-group`
418
+ .form-control {
419
+ display: inline-block;
420
+ width: auto; // Prevent labels from stacking above inputs in `.form-group`
421
+ vertical-align: middle;
498
422
  }
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
423
 
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);
424
+ // Make static controls behave like regular ones
425
+ .form-control-static {
426
+ display: inline-block;
520
427
  }
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
428
 
429
+ .input-group {
430
+ display: inline-table;
431
+ vertical-align: middle;
537
432
 
433
+ .input-group-addon,
434
+ .input-group-btn,
435
+ .form-control {
436
+ width: auto;
437
+ }
438
+ }
538
439
 
440
+ // Input groups need that 100% width though
441
+ .input-group > .form-control {
442
+ width: 100%;
443
+ }
539
444
 
540
- // SEARCH FORM
541
- // -----------
445
+ .control-label {
446
+ margin-bottom: 0;
447
+ vertical-align: middle;
448
+ }
542
449
 
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
- }
450
+ // Remove default margin on radios/checkboxes that were used for stacking, and
451
+ // then undo the floating of radios and checkboxes to match (which also avoids
452
+ // a bug in WebKit: https://github.com/twbs/bootstrap/issues/1969).
453
+ .radio,
454
+ .checkbox {
455
+ display: inline-block;
456
+ margin-top: 0;
457
+ margin-bottom: 0;
458
+ vertical-align: middle;
459
+
460
+ label {
461
+ padding-left: 0;
462
+ }
463
+ }
464
+ .radio input[type="radio"],
465
+ .checkbox input[type="checkbox"] {
466
+ position: relative;
467
+ margin-left: 0;
468
+ }
551
469
 
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);
470
+ // Re-override the feedback icon.
471
+ .has-feedback .form-control-feedback {
472
+ top: 0;
473
+ }
474
+ }
568
475
  }
569
476
 
570
477
 
478
+ // Horizontal forms
479
+ //
480
+ // Horizontal forms are built on grid classes and allow you to create forms with
481
+ // labels on the left and inputs on the right.
571
482
 
572
-
573
- // HORIZONTAL & VERTICAL FORMS
574
- // ---------------------------
575
-
576
- // Common properties
577
- // -----------------
578
-
579
- .form-search,
580
- .form-inline,
581
483
  .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();
484
+
485
+ // Consistent vertical alignment of radios and checkboxes
486
+ //
487
+ // Labels also get some reset styles, but that is scoped to a media query below.
488
+ .radio,
489
+ .checkbox,
490
+ .radio-inline,
491
+ .checkbox-inline {
492
+ margin-top: 0;
591
493
  margin-bottom: 0;
592
- vertical-align: middle;
494
+ padding-top: (@padding-base-vertical + 1); // Default padding plus a border
593
495
  }
594
- // Re-hide hidden elements due to specifity
595
- .hide {
596
- display: none;
496
+ // Account for padding we're adding to ensure the alignment and of help text
497
+ // and other content below items
498
+ .radio,
499
+ .checkbox {
500
+ min-height: (@line-height-computed + (@padding-base-vertical + 1));
597
501
  }
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
-
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
502
 
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;
503
+ // Make form groups behave like rows
504
+ .form-group {
505
+ .make-row();
658
506
  }
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;
507
+
508
+ // Reset spacing and right align labels, but scope to media queries so that
509
+ // labels on narrow viewports stack the same as a default form example.
510
+ @media (min-width: @screen-sm-min) {
511
+ .control-label {
512
+ text-align: right;
513
+ margin-bottom: 0;
514
+ padding-top: (@padding-base-vertical + 1); // Default padding plus a border
669
515
  }
670
516
  }
671
- // Remove bottom margin on block level help text since that's accounted for on .control-group
672
- .help-block {
673
- margin-bottom: 0;
517
+
518
+ // Validation states
519
+ //
520
+ // Reposition the icon because it's now within a grid column and columns have
521
+ // `position: relative;` on them. Also accounts for the grid gutter padding.
522
+ .has-feedback .form-control-feedback {
523
+ right: (@grid-gutter-width / 2);
674
524
  }
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;
525
+
526
+ // Form group sizes
527
+ //
528
+ // Quick utility class for applying `.input-lg` and `.input-sm` styles to the
529
+ // inputs and labels within a `.form-group`.
530
+ .form-group-lg {
531
+ @media (min-width: @screen-sm-min) {
532
+ .control-label {
533
+ padding-top: ((@padding-large-vertical * @line-height-large) + 1);
534
+ }
684
535
  }
685
536
  }
686
- // Move over buttons in .form-actions to align with .controls
687
- .form-actions {
688
- padding-left: @horizontalComponentOffset;
537
+ .form-group-sm {
538
+ @media (min-width: @screen-sm-min) {
539
+ .control-label {
540
+ padding-top: (@padding-small-vertical + 1);
541
+ }
542
+ }
689
543
  }
690
544
  }