Warning, /iDDS/monitor/data/scss/bootstrap/mixins/_breakpoints.scss is written in an unsupported language. File is not indexed.
0001 // Breakpoint viewport sizes and media queries.
0002 //
0003 // Breakpoints are defined as a map of (name: minimum width), order from small to large:
0004 //
0005 // (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)
0006 //
0007 // The map defined in the `$grid-breakpoints` global variable is used as the `$breakpoints` argument by default.
0008
0009 // Name of the next breakpoint, or null for the last breakpoint.
0010 //
0011 // >> breakpoint-next(sm)
0012 // md
0013 // >> breakpoint-next(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
0014 // md
0015 // >> breakpoint-next(sm, $breakpoint-names: (xs sm md lg xl))
0016 // md
0017 @function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
0018 $n: index($breakpoint-names, $name);
0019 @if not $n {
0020 @error "breakpoint `#{$name}` not found in `#{$breakpoints}`";
0021 }
0022 @return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
0023 }
0024
0025 // Minimum breakpoint width. Null for the smallest (first) breakpoint.
0026 //
0027 // >> breakpoint-min(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
0028 // 576px
0029 @function breakpoint-min($name, $breakpoints: $grid-breakpoints) {
0030 $min: map-get($breakpoints, $name);
0031 @return if($min != 0, $min, null);
0032 }
0033
0034 // Maximum breakpoint width.
0035 // The maximum value is reduced by 0.02px to work around the limitations of
0036 // `min-` and `max-` prefixes and viewports with fractional widths.
0037 // See https://www.w3.org/TR/mediaqueries-4/#mq-min-max
0038 // Uses 0.02px rather than 0.01px to work around a current rounding bug in Safari.
0039 // See https://bugs.webkit.org/show_bug.cgi?id=178261
0040 //
0041 // >> breakpoint-max(md, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
0042 // 767.98px
0043 @function breakpoint-max($name, $breakpoints: $grid-breakpoints) {
0044 $max: map-get($breakpoints, $name);
0045 @return if($max and $max > 0, $max - .02, null);
0046 }
0047
0048 // Returns a blank string if smallest breakpoint, otherwise returns the name with a dash in front.
0049 // Useful for making responsive utilities.
0050 //
0051 // >> breakpoint-infix(xs, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
0052 // "" (Returns a blank string)
0053 // >> breakpoint-infix(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
0054 // "-sm"
0055 @function breakpoint-infix($name, $breakpoints: $grid-breakpoints) {
0056 @return if(breakpoint-min($name, $breakpoints) == null, "", "-#{$name}");
0057 }
0058
0059 // Media of at least the minimum breakpoint width. No query for the smallest breakpoint.
0060 // Makes the @content apply to the given breakpoint and wider.
0061 @mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {
0062 $min: breakpoint-min($name, $breakpoints);
0063 @if $min {
0064 @media (min-width: $min) {
0065 @content;
0066 }
0067 } @else {
0068 @content;
0069 }
0070 }
0071
0072 // Media of at most the maximum breakpoint width. No query for the largest breakpoint.
0073 // Makes the @content apply to the given breakpoint and narrower.
0074 @mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) {
0075 $max: breakpoint-max($name, $breakpoints);
0076 @if $max {
0077 @media (max-width: $max) {
0078 @content;
0079 }
0080 } @else {
0081 @content;
0082 }
0083 }
0084
0085 // Media that spans multiple breakpoint widths.
0086 // Makes the @content apply between the min and max breakpoints
0087 @mixin media-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {
0088 $min: breakpoint-min($lower, $breakpoints);
0089 $max: breakpoint-max($upper, $breakpoints);
0090
0091 @if $min != null and $max != null {
0092 @media (min-width: $min) and (max-width: $max) {
0093 @content;
0094 }
0095 } @else if $max == null {
0096 @include media-breakpoint-up($lower, $breakpoints) {
0097 @content;
0098 }
0099 } @else if $min == null {
0100 @include media-breakpoint-down($upper, $breakpoints) {
0101 @content;
0102 }
0103 }
0104 }
0105
0106 // Media between the breakpoint's minimum and maximum widths.
0107 // No minimum for the smallest breakpoint, and no maximum for the largest one.
0108 // Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.
0109 @mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) {
0110 $min: breakpoint-min($name, $breakpoints);
0111 $next: breakpoint-next($name, $breakpoints);
0112 $max: breakpoint-max($next);
0113
0114 @if $min != null and $max != null {
0115 @media (min-width: $min) and (max-width: $max) {
0116 @content;
0117 }
0118 } @else if $max == null {
0119 @include media-breakpoint-up($name, $breakpoints) {
0120 @content;
0121 }
0122 } @else if $min == null {
0123 @include media-breakpoint-down($next, $breakpoints) {
0124 @content;
0125 }
0126 }
0127 }