app/assets/stylesheets/twitter/bootstrap/_mixins.scss in bootstrap-sass-rails-3.0.0.3 vs app/assets/stylesheets/twitter/bootstrap/_mixins.scss in bootstrap-sass-rails-3.0.1.0

- old
+ new

@@ -25,15 +25,15 @@ &:after { clear: both; } } -// Webkit-style focus +// WebKit-style focus @mixin tab-focus() { // Default outline: thin dotted #333; - // Webkit + // WebKit outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } // Center-align a block level element @@ -67,18 +67,34 @@ text-overflow: ellipsis; white-space: nowrap; } // CSS image replacement +// +// Heads up! v3 launched with with only `.hide-text()`, but per our pattern for +// mixins being reused as classes with the same name, this doesn't hold up. As +// of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. Note +// that we cannot chain the mixins together in Less, so they are repeated. +// // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757 + +// Deprecated as of v3.0.1 (will be removed in v4) @mixin hide-text() { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; } +// New mixin to use as of v3.0.1 +@mixin text-hide() { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} // CSS3 PROPERTIES // -------------------------------------------------- @@ -110,10 +126,14 @@ // Transitions @mixin transition($transition...) { -webkit-transition: $transition; transition: $transition; } +@mixin transition-property($transition-property) { + -webkit-transition-property: $transition-property; + transition-property: $transition-property; +} @mixin transition-delay($transition-delay) { -webkit-transition-delay: $transition-delay; transition-delay: $transition-delay; } @mixin transition-duration($transition-duration) { @@ -151,14 +171,45 @@ @mixin translate3d($x, $y, $z) { -webkit-transform: translate3d($x, $y, $z); transform: translate3d($x, $y, $z); } +@mixin rotateX($degrees) { + -webkit-transform: rotateX($degrees); + -ms-transform: rotateX($degrees); // IE9+ + transform: rotateX($degrees); +} +@mixin rotateY($degrees) { + -webkit-transform: rotateY($degrees); + -ms-transform: rotateY($degrees); // IE9+ + transform: rotateY($degrees); +} +@mixin perspective($perspective) { + -webkit-perspective: $perspective; + -moz-perspective: $perspective; + perspective: $perspective; +} +@mixin perspective-origin($perspective) { + -webkit-perspective-origin: $perspective; + -moz-perspective-origin: $perspective; + perspective-origin: $perspective; +} +@mixin transform-origin($origin) { + -webkit-transform-origin: $origin; + -moz-transform-origin: $origin; + transform-origin: $origin; +} + +// Animations +@mixin animation($animation) { + -webkit-animation: $animation; + animation: $animation; +} + // Backface visibility // Prevent browsers from flickering when using CSS 3D transforms. // Default value is `visible`, but can be changed to `hidden` -// See git pull https://github.com/dannykeane/bootstrap.git backface-visibility for examples @mixin backface-visibility($visibility){ -webkit-backface-visibility: $visibility; -moz-backface-visibility: $visibility; backface-visibility: $visibility; } @@ -238,11 +289,11 @@ // // Creates two color stops, start and end, by specifying a color and position for each color stop. // Color stops are not available in IE9 and below. @mixin gradient-vertical($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) { background-image: -webkit-gradient(linear, left $start-percent, left $end-percent, from($start-color), to($end-color)); // Safari 4+, Chrome 2+ - background-image: -webkit-linear-gradient(top, $start-color, $start-percent, $end-color, $end-percent); // Safari 5.1+, Chrome 10+ + background-image: -webkit-linear-gradient(top, $start-color $start-percent, $end-color $end-percent); // Safari 5.1+, Chrome 10+ background-image: -moz-linear-gradient(top, $start-color $start-percent, $end-color $end-percent); // FF 3.6+ background-image: linear-gradient(to bottom, $start-color $start-percent, $end-color $end-percent); // Standard, IE10 background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#{ie-hex-str($start-color)}, endColorstr=#{ie-hex-str($end-color)}, GradientType=0); // IE9 and down } @@ -274,15 +325,15 @@ background-image: -webkit-radial-gradient(circle, $inner-color, $outer-color); background-image: -moz-radial-gradient(circle, $inner-color, $outer-color); background-image: radial-gradient(circle, $inner-color, $outer-color); background-repeat: no-repeat; } -@mixin gradient-striped($color: #555, $angle: 45deg) { - background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, rgba(255,255,255,.15)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255,255,255,.15)), color-stop(.75, rgba(255,255,255,.15)), color-stop(.75, transparent), to(transparent)); - background-image: -webkit-linear-gradient($angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); - background-image: -moz-linear-gradient($angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); - background-image: linear-gradient($angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); +@mixin gradient-striped($color: rgba(255,255,255,.15), $angle: 45deg) { + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, $color), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, $color), color-stop(.75, $color), color-stop(.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent); + background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent); } // Reset filters for IE // // When you need to remove a gradient background, do not forget to use this to reset @@ -296,20 +347,20 @@ // Retina images // // Short retina mixin for setting background-image and -size @mixin img-retina($file-1x, $file-2x, $width-1x, $height-1x) { - background-image: image-url($file-1x); + background-image: image-url("#{$file-1x}"); @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and ( min-device-pixel-ratio: 2), only screen and ( min-resolution: 192dpi), only screen and ( min-resolution: 2dppx) { - background-image: image-url($file-2x); + background-image: image-url("#{$file-2x}"); background-size: $width-1x $height-1x; } } @@ -339,17 +390,22 @@ // Panels // ------------------------- @mixin panel-variant($border, $heading-text-color, $heading-bg-color, $heading-border) { border-color: $border; + & > .panel-heading { color: $heading-text-color; background-color: $heading-bg-color; border-color: $heading-border; + + .panel-collapse .panel-body { border-top-color: $border; } + & > .dropdown .caret { + border-color: $heading-text-color transparent; + } } & > .panel-footer { + .panel-collapse .panel-body { border-bottom-color: $border; } @@ -360,10 +416,11 @@ // ------------------------- @mixin alert-variant($background, $border, $text-color) { background-color: $background; border-color: $border; color: $text-color; + hr { border-top-color: darken($border, 5%); } .alert-link { color: darken($text-color, 10%); @@ -381,22 +438,21 @@ > td.#{$state}, > th.#{$state}, &.#{$state} > td, &.#{$state} > th { background-color: $background; - border-color: $border; } } // Hover states for `.table-hover` // Note: this is not available for cells or rows within `thead` or `tfoot`. .table-hover > tbody > tr { > td.#{$state}:hover, > th.#{$state}:hover, - &.#{$state}:hover > td { + &.#{$state}:hover > td, + &.#{$state}:hover > th { background-color: darken($background, 5%); - border-color: darken($border, 5%); } } } // Button variants @@ -441,11 +497,11 @@ &:hover, &:focus, &:active, &.active { background-color: $background; - border-color: $border + border-color: $border; } } } // Button sizes @@ -505,11 +561,11 @@ // Progress bars // ------------------------- @mixin progress-bar-variant($color) { background-color: $color; .progress-striped & { - @include gradient-striped($color); + @include gradient-striped(); } } // Responsive utilities // ------------------------- @@ -520,16 +576,17 @@ th#{$parent}, td#{$parent} { display: table-cell !important; } } @mixin responsive-invisibility($parent) { - #{$parent} { display: none !important; } - tr#{$parent} { display: none !important; } + #{$parent}, + tr#{$parent}, th#{$parent}, td#{$parent} { display: none !important; } } + // Grid System // ----------- // Centered container element @mixin container-fixed() { @@ -567,29 +624,29 @@ // Inner gutter via padding padding-left: ($gutter / 2); padding-right: ($gutter / 2); // Calculate width based on number of columns available - @media (min-width: $screen-sm) { + @media (min-width: $screen-sm-min) { float: left; width: percentage(($columns / $grid-columns)); } } // Generate the small column offsets @mixin make-sm-column-offset($columns) { - @media (min-width: $screen-sm) { + @media (min-width: $screen-sm-min) { margin-left: percentage(($columns / $grid-columns)); } } @mixin make-sm-column-push($columns) { - @media (min-width: $screen-sm) { + @media (min-width: $screen-sm-min) { left: percentage(($columns / $grid-columns)); } } @mixin make-sm-column-pull($columns) { - @media (min-width: $screen-sm) { + @media (min-width: $screen-sm-min) { right: percentage(($columns / $grid-columns)); } } // Generate the medium columns @@ -600,29 +657,29 @@ // Inner gutter via padding padding-left: ($gutter / 2); padding-right: ($gutter / 2); // Calculate width based on number of columns available - @media (min-width: $screen-md) { + @media (min-width: $screen-md-min) { float: left; width: percentage(($columns / $grid-columns)); } } -// Generate the large column offsets +// Generate the medium column offsets @mixin make-md-column-offset($columns) { - @media (min-width: $screen-md) { + @media (min-width: $screen-md-min) { margin-left: percentage(($columns / $grid-columns)); } } @mixin make-md-column-push($columns) { @media (min-width: $screen-md) { left: percentage(($columns / $grid-columns)); } } @mixin make-md-column-pull($columns) { - @media (min-width: $screen-md) { + @media (min-width: $screen-md-min) { right: percentage(($columns / $grid-columns)); } } // Generate the large columns @@ -633,42 +690,109 @@ // Inner gutter via padding padding-left: ($gutter / 2); padding-right: ($gutter / 2); // Calculate width based on number of columns available - @media (min-width: $screen-lg) { + @media (min-width: $screen-lg-min) { float: left; width: percentage(($columns / $grid-columns)); } } // Generate the large column offsets @mixin make-lg-column-offset($columns) { - @media (min-width: $screen-lg) { + @media (min-width: $screen-lg-min) { margin-left: percentage(($columns / $grid-columns)); } } @mixin make-lg-column-push($columns) { - @media (min-width: $screen-lg) { + @media (min-width: $screen-lg-min) { left: percentage(($columns / $grid-columns)); } } @mixin make-lg-column-pull($columns) { - @media (min-width: $screen-lg) { + @media (min-width: $screen-lg-min) { right: percentage(($columns / $grid-columns)); } } +// Framework grid generation +// +// Used only by Bootstrap to generate the correct number of grid classes given +// any value of `$grid-columns`. + +@mixin make-grid-columns() { + $list: (); + @for $index from 1 through $grid-columns { + $list: append($list, unquote(".col-xs-#{$index}, .col-sm-#{$index}, .col-md-#{$index}, .col-lg-#{$index}"), comma); + } + #{$list} { + position: relative; + // Prevent columns from collapsing when empty + min-height: 1px; + // Inner gutter via padding + padding-left: ($grid-gutter-width / 2); + padding-right: ($grid-gutter-width / 2); + } +} + + +@mixin make-grid-columns-float($class) { + $list: (); + @for $index from 1 to $grid-columns { + $list: append($list, unquote(".col-#{$class}-#{$index}"), comma); + } + #{$list} { + float: left; + } +} + + +@mixin calc-grid($index, $class, $type) { + @if $type == width { + .col-#{$class}-#{$index} { + width: percentage(($index / $grid-columns)); + } + } + @if $type == push { + .col-#{$class}-push-#{$index} { + left: percentage(($index / $grid-columns)); + } + } + @if $type == pull { + .col-#{$class}-pull-#{$index} { + right: percentage(($index / $grid-columns)); + } + } + @if $type == offset { + .col-#{$class}-offset-#{$index} { + margin-left: percentage(($index / $grid-columns)); + } + } +} + +@mixin make-grid($index, $class, $type) { + @for $i from 1 through $index { + @include calc-grid($i, $class, $type); + } +} + + + // Form validation states // // Used in forms.less to generate the form validation CSS for warnings, errors, // and successes. @mixin form-control-validation($text-color: #555, $border-color: #ccc, $background-color: #f5f5f5) { // Color the label and help text .help-block, - .control-label { + .control-label, + .radio, + .checkbox, + .radio-inline, + .checkbox-inline { color: $text-color; } // Set the border and box shadow on specific inputs to match .form-control { border-color: $border-color;