| 1 |
// CSS3 Flexible Box Model and property defaults |
| 2 |
|
| 3 |
// Custom shorthand notation for flexbox |
| 4 |
@mixin box($orient: inline-axis, $pack: start, $align: stretch) { |
| 5 |
@include _bourbon-deprecate-for-prefixing("box"); |
| 6 |
|
| 7 |
@include display-box; |
| 8 |
@include box-orient($orient); |
| 9 |
@include box-pack($pack); |
| 10 |
@include box-align($align); |
| 11 |
} |
| 12 |
|
| 13 |
@mixin display-box { |
| 14 |
@include _bourbon-deprecate-for-prefixing("display-box"); |
| 15 |
|
| 16 |
display: -webkit-box; |
| 17 |
display: -moz-box; |
| 18 |
display: -ms-flexbox; // IE 10 |
| 19 |
display: box; |
| 20 |
} |
| 21 |
|
| 22 |
@mixin box-orient($orient: inline-axis) { |
| 23 |
@include _bourbon-deprecate-for-prefixing("box-orient"); |
| 24 |
|
| 25 |
// horizontal|vertical|inline-axis|block-axis|inherit |
| 26 |
@include prefixer(box-orient, $orient, webkit moz spec); |
| 27 |
} |
| 28 |
|
| 29 |
@mixin box-pack($pack: start) { |
| 30 |
@include _bourbon-deprecate-for-prefixing("box-pack"); |
| 31 |
|
| 32 |
// start|end|center|justify |
| 33 |
@include prefixer(box-pack, $pack, webkit moz spec); |
| 34 |
-ms-flex-pack: $pack; // IE 10 |
| 35 |
} |
| 36 |
|
| 37 |
@mixin box-align($align: stretch) { |
| 38 |
@include _bourbon-deprecate-for-prefixing("box-align"); |
| 39 |
|
| 40 |
// start|end|center|baseline|stretch |
| 41 |
@include prefixer(box-align, $align, webkit moz spec); |
| 42 |
-ms-flex-align: $align; // IE 10 |
| 43 |
} |
| 44 |
|
| 45 |
@mixin box-direction($direction: normal) { |
| 46 |
@include _bourbon-deprecate-for-prefixing("box-direction"); |
| 47 |
|
| 48 |
// normal|reverse|inherit |
| 49 |
@include prefixer(box-direction, $direction, webkit moz spec); |
| 50 |
-ms-flex-direction: $direction; // IE 10 |
| 51 |
} |
| 52 |
|
| 53 |
@mixin box-lines($lines: single) { |
| 54 |
@include _bourbon-deprecate-for-prefixing("box-lines"); |
| 55 |
|
| 56 |
// single|multiple |
| 57 |
@include prefixer(box-lines, $lines, webkit moz spec); |
| 58 |
} |
| 59 |
|
| 60 |
@mixin box-ordinal-group($int: 1) { |
| 61 |
@include _bourbon-deprecate-for-prefixing("box-ordinal-group"); |
| 62 |
|
| 63 |
@include prefixer(box-ordinal-group, $int, webkit moz spec); |
| 64 |
-ms-flex-order: $int; // IE 10 |
| 65 |
} |
| 66 |
|
| 67 |
@mixin box-flex($value: 0) { |
| 68 |
@include _bourbon-deprecate-for-prefixing("box-flex"); |
| 69 |
|
| 70 |
@include prefixer(box-flex, $value, webkit moz spec); |
| 71 |
-ms-flex: $value; // IE 10 |
| 72 |
} |
| 73 |
|
| 74 |
@mixin box-flex-group($int: 1) { |
| 75 |
@include _bourbon-deprecate-for-prefixing("box-flex-group"); |
| 76 |
|
| 77 |
@include prefixer(box-flex-group, $int, webkit moz spec); |
| 78 |
} |
| 79 |
|
| 80 |
// CSS3 Flexible Box Model and property defaults |
| 81 |
// Unified attributes for 2009, 2011, and 2012 flavours. |
| 82 |
|
| 83 |
// 2009 - display (box | inline-box) |
| 84 |
// 2011 - display (flexbox | inline-flexbox) |
| 85 |
// 2012 - display (flex | inline-flex) |
| 86 |
@mixin display($value) { |
| 87 |
@include _bourbon-deprecate-for-prefixing("display"); |
| 88 |
|
| 89 |
// flex | inline-flex |
| 90 |
@if $value == "flex" { |
| 91 |
// 2009 |
| 92 |
display: -webkit-box; |
| 93 |
display: -moz-box; |
| 94 |
display: box; |
| 95 |
|
| 96 |
// 2012 |
| 97 |
display: -webkit-flex; |
| 98 |
display: -moz-flex; |
| 99 |
display: -ms-flexbox; // 2011 (IE 10) |
| 100 |
display: flex; |
| 101 |
} @else if $value == "inline-flex" { |
| 102 |
display: -webkit-inline-box; |
| 103 |
display: -moz-inline-box; |
| 104 |
display: inline-box; |
| 105 |
|
| 106 |
display: -webkit-inline-flex; |
| 107 |
display: -moz-inline-flex; |
| 108 |
display: -ms-inline-flexbox; |
| 109 |
display: inline-flex; |
| 110 |
} @else { |
| 111 |
display: $value; |
| 112 |
} |
| 113 |
} |
| 114 |
|
| 115 |
// 2009 - box-flex (integer) |
| 116 |
// 2011 - flex (decimal | width decimal) |
| 117 |
// 2012 - flex (integer integer width) |
| 118 |
@mixin flex($value) { |
| 119 |
@include _bourbon-deprecate-for-prefixing("flex"); |
| 120 |
|
| 121 |
// Grab flex-grow for older browsers. |
| 122 |
$flex-grow: nth($value, 1); |
| 123 |
|
| 124 |
// 2009 |
| 125 |
@include prefixer(box-flex, $flex-grow, webkit moz spec); |
| 126 |
|
| 127 |
// 2011 (IE 10), 2012 |
| 128 |
@include prefixer(flex, $value, webkit moz ms spec); |
| 129 |
} |
| 130 |
|
| 131 |
// 2009 - box-orient ( horizontal | vertical | inline-axis | block-axis) |
| 132 |
// - box-direction (normal | reverse) |
| 133 |
// 2011 - flex-direction (row | row-reverse | column | column-reverse) |
| 134 |
// 2012 - flex-direction (row | row-reverse | column | column-reverse) |
| 135 |
@mixin flex-direction($value: row) { |
| 136 |
@include _bourbon-deprecate-for-prefixing("flex-direction"); |
| 137 |
|
| 138 |
// Alt values. |
| 139 |
$value-2009: $value; |
| 140 |
$value-2011: $value; |
| 141 |
$direction: normal; |
| 142 |
|
| 143 |
@if $value == row { |
| 144 |
$value-2009: horizontal; |
| 145 |
} @else if $value == "row-reverse" { |
| 146 |
$value-2009: horizontal; |
| 147 |
$direction: reverse; |
| 148 |
} @else if $value == column { |
| 149 |
$value-2009: vertical; |
| 150 |
} @else if $value == "column-reverse" { |
| 151 |
$value-2009: vertical; |
| 152 |
$direction: reverse; |
| 153 |
} |
| 154 |
|
| 155 |
// 2009 |
| 156 |
@include prefixer(box-orient, $value-2009, webkit moz spec); |
| 157 |
@include prefixer(box-direction, $direction, webkit moz spec); |
| 158 |
|
| 159 |
// 2012 |
| 160 |
@include prefixer(flex-direction, $value, webkit moz spec); |
| 161 |
|
| 162 |
// 2011 (IE 10) |
| 163 |
-ms-flex-direction: $value; |
| 164 |
} |
| 165 |
|
| 166 |
// 2009 - box-lines (single | multiple) |
| 167 |
// 2011 - flex-wrap (nowrap | wrap | wrap-reverse) |
| 168 |
// 2012 - flex-wrap (nowrap | wrap | wrap-reverse) |
| 169 |
@mixin flex-wrap($value: nowrap) { |
| 170 |
@include _bourbon-deprecate-for-prefixing("flex-wrap"); |
| 171 |
|
| 172 |
// Alt values |
| 173 |
$alt-value: $value; |
| 174 |
@if $value == nowrap { |
| 175 |
$alt-value: single; |
| 176 |
} @else if $value == wrap { |
| 177 |
$alt-value: multiple; |
| 178 |
} @else if $value == "wrap-reverse" { |
| 179 |
$alt-value: multiple; |
| 180 |
} |
| 181 |
|
| 182 |
@include prefixer(box-lines, $alt-value, webkit moz spec); |
| 183 |
@include prefixer(flex-wrap, $value, webkit moz ms spec); |
| 184 |
} |
| 185 |
|
| 186 |
// 2009 - TODO: parse values into flex-direction/flex-wrap |
| 187 |
// 2011 - TODO: parse values into flex-direction/flex-wrap |
| 188 |
// 2012 - flex-flow (flex-direction || flex-wrap) |
| 189 |
@mixin flex-flow($value) { |
| 190 |
@include _bourbon-deprecate-for-prefixing("flex-flow"); |
| 191 |
|
| 192 |
@include prefixer(flex-flow, $value, webkit moz spec); |
| 193 |
} |
| 194 |
|
| 195 |
// 2009 - box-ordinal-group (integer) |
| 196 |
// 2011 - flex-order (integer) |
| 197 |
// 2012 - order (integer) |
| 198 |
@mixin order($int: 0) { |
| 199 |
@include _bourbon-deprecate-for-prefixing("order"); |
| 200 |
|
| 201 |
// 2009 |
| 202 |
@include prefixer(box-ordinal-group, $int, webkit moz spec); |
| 203 |
|
| 204 |
// 2012 |
| 205 |
@include prefixer(order, $int, webkit moz spec); |
| 206 |
|
| 207 |
// 2011 (IE 10) |
| 208 |
-ms-flex-order: $int; |
| 209 |
} |
| 210 |
|
| 211 |
// 2012 - flex-grow (number) |
| 212 |
@mixin flex-grow($number: 0) { |
| 213 |
@include _bourbon-deprecate-for-prefixing("flex-grow"); |
| 214 |
|
| 215 |
@include prefixer(flex-grow, $number, webkit moz spec); |
| 216 |
-ms-flex-positive: $number; |
| 217 |
} |
| 218 |
|
| 219 |
// 2012 - flex-shrink (number) |
| 220 |
@mixin flex-shrink($number: 1) { |
| 221 |
@include _bourbon-deprecate-for-prefixing("flex-shrink"); |
| 222 |
|
| 223 |
@include prefixer(flex-shrink, $number, webkit moz spec); |
| 224 |
-ms-flex-negative: $number; |
| 225 |
} |
| 226 |
|
| 227 |
// 2012 - flex-basis (number) |
| 228 |
@mixin flex-basis($width: auto) { |
| 229 |
@include _bourbon-deprecate-for-prefixing("flex-basis"); |
| 230 |
|
| 231 |
@include prefixer(flex-basis, $width, webkit moz spec); |
| 232 |
-ms-flex-preferred-size: $width; |
| 233 |
} |
| 234 |
|
| 235 |
// 2009 - box-pack (start | end | center | justify) |
| 236 |
// 2011 - flex-pack (start | end | center | justify) |
| 237 |
// 2012 - justify-content (flex-start | flex-end | center | space-between | space-around) |
| 238 |
@mixin justify-content($value: flex-start) { |
| 239 |
@include _bourbon-deprecate-for-prefixing("justify-content"); |
| 240 |
|
| 241 |
// Alt values. |
| 242 |
$alt-value: $value; |
| 243 |
@if $value == "flex-start" { |
| 244 |
$alt-value: start; |
| 245 |
} @else if $value == "flex-end" { |
| 246 |
$alt-value: end; |
| 247 |
} @else if $value == "space-between" { |
| 248 |
$alt-value: justify; |
| 249 |
} @else if $value == "space-around" { |
| 250 |
$alt-value: distribute; |
| 251 |
} |
| 252 |
|
| 253 |
// 2009 |
| 254 |
@include prefixer(box-pack, $alt-value, webkit moz spec); |
| 255 |
|
| 256 |
// 2012 |
| 257 |
@include prefixer(justify-content, $value, webkit moz ms o spec); |
| 258 |
|
| 259 |
// 2011 (IE 10) |
| 260 |
-ms-flex-pack: $alt-value; |
| 261 |
} |
| 262 |
|
| 263 |
// 2009 - box-align (start | end | center | baseline | stretch) |
| 264 |
// 2011 - flex-align (start | end | center | baseline | stretch) |
| 265 |
// 2012 - align-items (flex-start | flex-end | center | baseline | stretch) |
| 266 |
@mixin align-items($value: stretch) { |
| 267 |
@include _bourbon-deprecate-for-prefixing("align-items"); |
| 268 |
|
| 269 |
$alt-value: $value; |
| 270 |
|
| 271 |
@if $value == "flex-start" { |
| 272 |
$alt-value: start; |
| 273 |
} @else if $value == "flex-end" { |
| 274 |
$alt-value: end; |
| 275 |
} |
| 276 |
|
| 277 |
// 2009 |
| 278 |
@include prefixer(box-align, $alt-value, webkit moz spec); |
| 279 |
|
| 280 |
// 2012 |
| 281 |
@include prefixer(align-items, $value, webkit moz ms o spec); |
| 282 |
|
| 283 |
// 2011 (IE 10) |
| 284 |
-ms-flex-align: $alt-value; |
| 285 |
} |
| 286 |
|
| 287 |
// 2011 - flex-item-align (auto | start | end | center | baseline | stretch) |
| 288 |
// 2012 - align-self (auto | flex-start | flex-end | center | baseline | stretch) |
| 289 |
@mixin align-self($value: auto) { |
| 290 |
@include _bourbon-deprecate-for-prefixing("align-self"); |
| 291 |
|
| 292 |
$value-2011: $value; |
| 293 |
@if $value == "flex-start" { |
| 294 |
$value-2011: start; |
| 295 |
} @else if $value == "flex-end" { |
| 296 |
$value-2011: end; |
| 297 |
} |
| 298 |
|
| 299 |
// 2012 |
| 300 |
@include prefixer(align-self, $value, webkit moz spec); |
| 301 |
|
| 302 |
// 2011 (IE 10) |
| 303 |
-ms-flex-item-align: $value-2011; |
| 304 |
} |
| 305 |
|
| 306 |
// 2011 - flex-line-pack (start | end | center | justify | distribute | stretch) |
| 307 |
// 2012 - align-content (flex-start | flex-end | center | space-between | space-around | stretch) |
| 308 |
@mixin align-content($value: stretch) { |
| 309 |
@include _bourbon-deprecate-for-prefixing("align-content"); |
| 310 |
|
| 311 |
$value-2011: $value; |
| 312 |
@if $value == "flex-start" { |
| 313 |
$value-2011: start; |
| 314 |
} @else if $value == "flex-end" { |
| 315 |
$value-2011: end; |
| 316 |
} @else if $value == "space-between" { |
| 317 |
$value-2011: justify; |
| 318 |
} @else if $value == "space-around" { |
| 319 |
$value-2011: distribute; |
| 320 |
} |
| 321 |
|
| 322 |
// 2012 |
| 323 |
@include prefixer(align-content, $value, webkit moz spec); |
| 324 |
|
| 325 |
// 2011 (IE 10) |
| 326 |
-ms-flex-line-pack: $value-2011; |
| 327 |
} |