Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 espaco 1
//
2
// Mixins
3
// Based on Twitter Bootstrap's _mixings.scss
4
 
5
 
6
// Clearfix
7
// Source: http://nicolasgallagher.com/micro-clearfix-hack/
8
 
9
@mixin clearfix() {
10
  &:before,
11
  &:after {
12
    content: " "; // 1
13
    display: table; // 2
14
  }
15
  &:after {
16
    clear: both;
17
  }
18
}
19
 
20
// Opacity
21
 
22
@mixin opacity($value) {
23
  opacity: $value;
24
  filter: alpha(opacity=#{$value * 100});
25
}
26
 
27
// Border radius.
28
 
29
@mixin border-radius($radius, $important: '') {
30
  -webkit-border-radius: $radius#{$important};
31
  -moz-border-radius: $radius#{$important};
32
  -ms-border-radius: $radius#{$important};
33
  -o-border-radius: $radius#{$important};
34
  border-radius: $radius#{$important};
35
}
36
 
37
// Placeholder text
38
// -------------------------
39
@mixin placeholder($color: $input-color-placeholder) {
40
  &::-moz-placeholder           { color: $color; opacity: 1; } // See https://github.com/twbs/bootstrap/pull/11526
41
  &:-ms-input-placeholder       { color: $color; } // Internet Explorer 10+
42
  &::-webkit-input-placeholder  { color: $color; } // Safari and Chrome
43
}
44
 
45
// Drop shadows
46
// By default set to: none
47
@mixin box-shadow($shadow) {
48
  -webkit-box-shadow: none; // iOS <4.3 & Android <4.1
49
          box-shadow: none;
50
}
51
 
52
// Vertical gradient, from top to bottom
53
// By default set to: none
54
@mixin gradient-striped($color: rgba(255,255,255,.15), $angle: 45deg) {
55
  background-image: none;
56
  background-image: none;
57
}
58
 
59
// Panels
60
// -------------------------
61
@mixin panel-variant($border, $heading-text-color, $heading-bg-color, $heading-border) {
62
  border-color: $border;
63
 
64
  & > .panel-heading {
65
    color: $heading-text-color;
66
    background-color: $heading-bg-color;
67
    border-color: $heading-border;
68
 
69
    + .panel-collapse .panel-body {
70
      border-top-color: $border;
71
    }
72
  }
73
  & > .panel-footer {
74
    + .panel-collapse .panel-body {
75
      border-bottom-color: $border;
76
    }
77
  }
78
}
79
 
80
// Alerts
81
// -------------------------
82
@mixin alert-variant($background, $border, $text-color) {
83
  background-color: $background;
84
  border-color: $border;
85
  color: $text-color;
86
 
87
  hr {
88
    border-top-color: darken($border, 5%);
89
  }
90
  .alert-link {
91
    color: darken($text-color, 10%);
92
  }
93
}
94
 
95
// Tables
96
// -------------------------
97
@mixin table-row-variant($state, $background, $text) {
98
  // Exact selectors below required to override `.table-striped` and prevent
99
  // inheritance to nested tables.
100
 
101
  .table > thead > tr,
102
  .table > tbody > tr,
103
  .table > tfoot > tr {
104
    > td.#{$state},
105
    > th.#{$state},
106
    &.#{$state} > td,
107
    &.#{$state} > th {
108
      background: $background;
109
      color: $text;
110
    }
111
  }
112
 
113
  // Hover states for `.table-hover`
114
  // Note: this is not available for cells or rows within `thead` or `tfoot`.
115
  .table-hover > tbody > tr {
116
    > td.#{$state}:hover,
117
    > th.#{$state}:hover,
118
    &.#{$state}:hover > td,
119
    &.#{$state}:hover > th {
120
      background: darken($background, 5%);
121
    }
122
  }
123
}
124
 
125
// List Groups
126
// -------------------------
127
@mixin list-group-item-variant($state, $background, $color) {
128
  .list-group-item-#{$state} {
129
    color: $color;
130
    background-color: $background;
131
 
132
    // [converter] extracted a& to a.list-group-item-#{$state}
133
  }
134
 
135
  a.list-group-item-#{$state} {
136
    color: $color;
137
 
138
    .list-group-item-heading { color: inherit; }
139
 
140
    &:hover,
141
    &:focus {
142
      color: $color;
143
      background-color: darken($background, 5%);
144
    }
145
    &.active,
146
    &.active:hover,
147
    &.active:focus {
148
      color: #fff;
149
      background-color: $color;
150
      border-color: $color;
151
    }
152
  }
153
}
154
 
155
// Button variants
156
// -------------------------
157
// Easily pump out default styles, as well as :hover, :focus, :active,
158
// and disabled options for all buttons
159
@mixin button-variant($color, $background, $border) {
160
  color: $color;
161
  background-color: $background;
162
  border-color: $border;
163
 
164
  &:hover,
165
  &:focus,
166
  &:active,
167
  &.active {
168
    color: $color;
169
    background-color: darken($background, 7%);
170
    @if $border != "" { border-color: darken($border, 10%); }
171
  }
172
  .open & { &.dropdown-toggle {
173
    color: $color;
174
    background-color: darken($background, 7%);
175
    @if $border != "" { border-color: darken($border, 10%); }
176
  } }
177
  &:active,
178
  &.active {
179
    background-image: none;
180
    background-color: darken($background, 12%);
181
 
182
    &:hover {
183
      background-color: darken($background, 10%);
184
    }
185
  }
186
  .open & { &.dropdown-toggle {
187
    background-image: none;
188
  } }
189
  &.disabled,
190
  &[disabled],
191
  fieldset[disabled] & {
192
    &,
193
    &:hover,
194
    &:focus,
195
    &:active,
196
    &.active {
197
      background-color: $background;
198
      @if $border != "" { border-color: $border; }
199
    }
200
  }
201
 
202
  .badge {
203
    color: $background;
204
    background-color: $color;
205
  }
206
}
207
 
208
// Labels
209
// -------------------------
210
@mixin label-variant($color) {
211
  background-color: $color;
212
  &[href] {
213
    &:hover,
214
    &:focus {
215
      background-color: darken($color, 10%);
216
    }
217
  }
218
}
219
 
220
// Progress bars
221
// -------------------------
222
@mixin progress-bar-variant($color) {
223
  background-color: $color;
224
  .progress-striped & {
225
    @include gradient-striped();
226
  }
227
}
228
 
229
// Form validation states
230
//
231
// Used in forms.less to generate the form validation CSS for warnings, errors,
232
// and successes.
233
 
234
@mixin form-control-validation($text-color: #555, $border-color: #ccc, $background-color: #f5f5f5) {
235
  // Color the label and help text
236
  .help-block,
237
  .help-inline,
238
  .control-label,
239
  .radio,
240
  .checkbox,
241
  .radio-inline,
242
  .checkbox-inline  {
243
    color: $text-color;
244
  }
245
  // Set the border and box shadow on specific inputs to match
246
  .form-control {
247
    border-color: $border-color;
248
    @include box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
249
    &:focus {
250
      border-color: darken($border-color, 10%);
251
      $shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten($border-color, 20%);
252
      @include box-shadow($shadow);
253
    }
254
  }
255
  // Set validation states also for addons
256
  .input-group-addon {
257
    color: $text-color;
258
    border-color: $border-color;
259
    background-color: $background-color;
260
  }
261
  // Optional feedback icon
262
  .form-control-feedback {
263
    color: $text-color;
264
  }
265
}