|
| 1 | +@import "theme-variables"; |
| 2 | + |
| 3 | +// region //////////////////////////////////////////////// Font Icon Mixins |
| 4 | + |
| 5 | +@mixin icon-font { |
| 6 | + @if icon-feature("font-awesome") and mixin_exists(fa-icon) { |
| 7 | + //noinspection SassScssUnresolvedMixin |
| 8 | + @include fa-icon(); |
| 9 | + } @else { |
| 10 | + display: inline-block; |
| 11 | + font: normal normal normal #{$icon-font-size}/#{$icon-line-height} #{$icon-font-name}; // shortening font declaration |
| 12 | + text-rendering: auto; // optimizelegibility throws things off |
| 13 | + -webkit-font-smoothing: antialiased; |
| 14 | + -moz-osx-font-smoothing: grayscale; |
| 15 | + } |
| 16 | +} |
| 17 | + |
| 18 | +@mixin _font-psuedo($location, $icon-content: null, $opacity: 0, $color) { |
| 19 | + &::#{$location} { |
| 20 | + @include icon-font; |
| 21 | + @if $icon-content != null { |
| 22 | + content: $icon-content; |
| 23 | + } |
| 24 | + @if $color != null and $opacity != null and $opacity < 1 { |
| 25 | + color: rgba($color,$opacity); |
| 26 | + } @else if $color != null { |
| 27 | + color: $color; |
| 28 | + @if $opacity == 1 { |
| 29 | + opacity: 1; |
| 30 | + } |
| 31 | + } @else if $opacity > 0 { |
| 32 | + opacity: $opacity; |
| 33 | + } |
| 34 | + @content; |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | +@mixin font-before($icon-name, $opacity: null, $color: null) { |
| 39 | + @include _font-psuedo(before, $opacity, $color) { |
| 40 | + @content; |
| 41 | + } |
| 42 | +} |
| 43 | + |
| 44 | +@mixin font-after($icon-name, $opacity: null, $color: null) { |
| 45 | + @include _font-psuedo(after, $icon-name, $opacity, $color) { |
| 46 | + @content; |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +// endregion ///////////////////////////////////////////// End Font Icon Mixins |
| 51 | + |
| 52 | +// region //////////////////////////////////////////////// SVG Icon Mixins |
| 53 | + |
| 54 | +@mixin _svg-background($svg, $size: $icon-width) { |
| 55 | + $content: unquote($svg); |
| 56 | + background-image: inline-svg($svg) center center / $size $size no-repeat; |
| 57 | +} |
| 58 | + |
| 59 | +@mixin _svg-psuedo($location, $size: $icon-width, $svg: null, $opacity: null, $fill: null) { |
| 60 | + &::#{$location} { |
| 61 | + display: block; |
| 62 | + width: $size; |
| 63 | + height: $size; |
| 64 | + content: " "; |
| 65 | + // Set SVG as Background Image |
| 66 | + @if $svg != null { |
| 67 | + @include _svg-background($svg, $size); |
| 68 | + } |
| 69 | + // Add Fill & Opacity if Needed |
| 70 | + @if $fill != null and $opacity > 0 and $opacity < 1 { |
| 71 | + fill: rgba($fill,$opacity); |
| 72 | + } @else if $fill != null { |
| 73 | + fill: $fill; |
| 74 | + @if $opacity == 1 { |
| 75 | + opacity: 1; |
| 76 | + } |
| 77 | + } @else if $opacity > 0 { |
| 78 | + opacity: $opacity; |
| 79 | + } |
| 80 | + // Any Pass Through Content |
| 81 | + @content; |
| 82 | + } |
| 83 | +} |
| 84 | + |
| 85 | +@mixin svg-before($size: $icon-width, $svg-or-name: null, $opacity: null, $fill: null) { |
| 86 | + @include _svg-psuedo(before, $size, get-svg-icon($svg-or-name), $opacity, $fill); |
| 87 | +} |
| 88 | + |
| 89 | +@mixin svg-after($size: $icon-width, $svg-or-name: null, $opacity: null, $fill: null) { |
| 90 | + @include _svg-psuedo(after, $size, get-svg-icon($svg-or-name), $opacity, $fill); |
| 91 | +} |
| 92 | + |
| 93 | +// endregion ///////////////////////////////////////////// End SVG Icon Mixins |
| 94 | + |
| 95 | +// region //////////////////////////////////////////////// Component Icon Mixins |
| 96 | + |
| 97 | +@mixin button-icons($padding) { |
| 98 | + & + span { |
| 99 | + margin-left: $padding; |
| 100 | + } |
| 101 | +} |
| 102 | + |
| 103 | +@mixin card-panel-icons($padding) { |
| 104 | + > .#{$icon-css-prefix} { |
| 105 | + order: -1; |
| 106 | + flex: 0 0 auto; |
| 107 | + margin: 0 $padding 0 0; |
| 108 | + } |
| 109 | +} |
| 110 | + |
| 111 | +@mixin card-accordion-indicator($indicator, $size, $right-spacing) { |
| 112 | + .card-accordion > .card .card-title { |
| 113 | + a[data-toggle="collapse"] { |
| 114 | + @include svg-before($indicator, $size, .3) { |
| 115 | + transform-origin: center center; |
| 116 | + transition-duration: 0.35s; |
| 117 | + right: $right-spacing; |
| 118 | + position: absolute; |
| 119 | + } |
| 120 | + } |
| 121 | + a.collapsed::before { |
| 122 | + transform: rotate(180deg); |
| 123 | + } |
| 124 | + } |
| 125 | +} |
| 126 | + |
| 127 | +// endregion ///////////////////////////////////////////// End Component Icon Mixins |
| 128 | + |
| 129 | +// region //////////////////////////////////////////////// Theme Mixins |
| 130 | + |
| 131 | +@mixin elevation($level, $penumbra: $shadow-key-penumbra-opacity, $umbra: $shadow-key-umbra-opacity, $ambient: $shadow-ambient-shadow-opacity) { |
| 132 | + @if theme("shadows") { |
| 133 | + @if $level == 0 { |
| 134 | + box-shadow: none; |
| 135 | + } |
| 136 | + @if $level == 1 { |
| 137 | + box-shadow: 0 1px 1px 0 rgba(0, 0, 0, $penumbra), |
| 138 | + 0 2px 1px -1px rgba(0, 0, 0, $umbra), |
| 139 | + 0 1px 3px 0 rgba(0, 0, 0, $ambient); |
| 140 | + } |
| 141 | + @if $level == 2 { |
| 142 | + box-shadow: 0 2px 2px 0 rgba(0, 0, 0, $penumbra), |
| 143 | + 0 3px 1px -2px rgba(0, 0, 0, $umbra), |
| 144 | + 0 1px 5px 0 rgba(0, 0, 0, $ambient); |
| 145 | + } |
| 146 | + @else if $level == 3 { |
| 147 | + box-shadow: 0 3px 4px 0 rgba(0, 0, 0, $penumbra), |
| 148 | + 0 3px 3px -2px rgba(0, 0, 0, $umbra), |
| 149 | + 0 1px 8px 0 rgba(0, 0, 0, $ambient); |
| 150 | + } |
| 151 | + @else if $level == 4 { |
| 152 | + box-shadow: 0 4px 5px 0 rgba(0, 0, 0, $penumbra), |
| 153 | + 0 1px 10px 0 rgba(0, 0, 0, $umbra), |
| 154 | + 0 2px 4px -1px rgba(0, 0, 0, $ambient); |
| 155 | + } |
| 156 | + @else if $level == 6 { |
| 157 | + box-shadow: 0 6px 10px 0 rgba(0, 0, 0, $penumbra), |
| 158 | + 0 1px 18px 0 rgba(0, 0, 0, $umbra), |
| 159 | + 0 3px 5px -1px rgba(0, 0, 0, $ambient); |
| 160 | + } |
| 161 | + @else if $level == 8 { |
| 162 | + box-shadow: 0 8px 10px 1px rgba(0, 0, 0, $penumbra), |
| 163 | + 0 3px 14px 2px rgba(0, 0, 0, $umbra), |
| 164 | + 0 5px 5px -3px rgba(0, 0, 0, $ambient); |
| 165 | + } |
| 166 | + @else if $level == 16 { |
| 167 | + box-shadow: 0 16px 24px 2px rgba(0, 0, 0, $penumbra), |
| 168 | + 0 6px 30px 5px rgba(0, 0, 0, $umbra), |
| 169 | + 0 8px 10px -5px rgba(0, 0, 0, $ambient); |
| 170 | + } |
| 171 | + @else if $level == 24 { |
| 172 | + box-shadow: 0 9px 46px 8px rgba(0, 0, 0, $penumbra), |
| 173 | + 0 11px 15px -7px rgba(0, 0, 0, $umbra), |
| 174 | + 0 24px 38px 3px rgba(0, 0, 0, $ambient); |
| 175 | + } |
| 176 | + } |
| 177 | +} |
| 178 | + |
| 179 | +// endregion ///////////////////////////////////////////// End Theme Mixins |
| 180 | + |
| 181 | +// region //////////////////////////////////////////////// Rounding Mixins |
| 182 | + |
| 183 | +@mixin border-radius($radius: $border-radius) { |
| 184 | + @if theme("rounded") { |
| 185 | + border-radius: $radius; |
| 186 | + } |
| 187 | +} |
| 188 | + |
| 189 | +@mixin border-top-radius($radius: $border-radius) { |
| 190 | + @if theme("rounded") { |
| 191 | + border-top-right-radius: $radius; |
| 192 | + border-top-left-radius: $radius; |
| 193 | + } |
| 194 | +} |
| 195 | + |
| 196 | +@mixin border-right-radius($radius: $border-radius) { |
| 197 | + @if theme("rounded") { |
| 198 | + border-bottom-right-radius: $radius; |
| 199 | + border-top-right-radius: $radius; |
| 200 | + } |
| 201 | +} |
| 202 | + |
| 203 | +@mixin border-bottom-radius($radius: $border-radius) { |
| 204 | + @if theme("rounded") { |
| 205 | + border-bottom-right-radius: $radius; |
| 206 | + border-bottom-left-radius: $radius; |
| 207 | + } |
| 208 | +} |
| 209 | + |
| 210 | +@mixin border-left-radius($radius: $border-radius) { |
| 211 | + @if theme("rounded") { |
| 212 | + border-bottom-left-radius: $radius; |
| 213 | + border-top-left-radius: $radius; |
| 214 | + } |
| 215 | +} |
| 216 | + |
| 217 | +// endregion ///////////////////////////////////////////// End Rounding Mixins |
| 218 | + |
| 219 | + |
0 commit comments