| 1 |
// The following features have been deprecated and will be removed in the next MAJOR version release |
| 2 |
|
| 3 |
@mixin inline-block { |
| 4 |
@include _bourbon-deprecate("inline-block"); |
| 5 |
|
| 6 |
display: inline-block; |
| 7 |
} |
| 8 |
|
| 9 |
@mixin button ($style: simple, $base-color: #4294f0, $text-size: inherit, $padding: 7px 18px) { |
| 10 |
@include _bourbon-deprecate("button"); |
| 11 |
|
| 12 |
@if type-of($style) == string and type-of($base-color) == color { |
| 13 |
@include buttonstyle($style, $base-color, $text-size, $padding); |
| 14 |
} |
| 15 |
|
| 16 |
@if type-of($style) == string and type-of($base-color) == number { |
| 17 |
$padding: $text-size; |
| 18 |
$text-size: $base-color; |
| 19 |
$base-color: #4294f0; |
| 20 |
|
| 21 |
@if $padding == inherit { |
| 22 |
$padding: 7px 18px; |
| 23 |
} |
| 24 |
|
| 25 |
@include buttonstyle($style, $base-color, $text-size, $padding); |
| 26 |
} |
| 27 |
|
| 28 |
@if type-of($style) == color and type-of($base-color) == color { |
| 29 |
$base-color: $style; |
| 30 |
$style: simple; |
| 31 |
@include buttonstyle($style, $base-color, $text-size, $padding); |
| 32 |
} |
| 33 |
|
| 34 |
@if type-of($style) == color and type-of($base-color) == number { |
| 35 |
$padding: $text-size; |
| 36 |
$text-size: $base-color; |
| 37 |
$base-color: $style; |
| 38 |
$style: simple; |
| 39 |
|
| 40 |
@if $padding == inherit { |
| 41 |
$padding: 7px 18px; |
| 42 |
} |
| 43 |
|
| 44 |
@include buttonstyle($style, $base-color, $text-size, $padding); |
| 45 |
} |
| 46 |
|
| 47 |
@if type-of($style) == number { |
| 48 |
$padding: $base-color; |
| 49 |
$text-size: $style; |
| 50 |
$base-color: #4294f0; |
| 51 |
$style: simple; |
| 52 |
|
| 53 |
@if $padding == #4294f0 { |
| 54 |
$padding: 7px 18px; |
| 55 |
} |
| 56 |
|
| 57 |
@include buttonstyle($style, $base-color, $text-size, $padding); |
| 58 |
} |
| 59 |
|
| 60 |
&:disabled { |
| 61 |
cursor: not-allowed; |
| 62 |
opacity: 0.5; |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
// Selector Style Button |
| 67 |
@mixin buttonstyle($type, $b-color, $t-size, $pad) { |
| 68 |
// Grayscale button |
| 69 |
@if $type == simple and $b-color == grayscale($b-color) { |
| 70 |
@include simple($b-color, true, $t-size, $pad); |
| 71 |
} |
| 72 |
|
| 73 |
@if $type == shiny and $b-color == grayscale($b-color) { |
| 74 |
@include shiny($b-color, true, $t-size, $pad); |
| 75 |
} |
| 76 |
|
| 77 |
@if $type == pill and $b-color == grayscale($b-color) { |
| 78 |
@include pill($b-color, true, $t-size, $pad); |
| 79 |
} |
| 80 |
|
| 81 |
@if $type == flat and $b-color == grayscale($b-color) { |
| 82 |
@include flat($b-color, true, $t-size, $pad); |
| 83 |
} |
| 84 |
|
| 85 |
// Colored button |
| 86 |
@if $type == simple { |
| 87 |
@include simple($b-color, false, $t-size, $pad); |
| 88 |
} |
| 89 |
|
| 90 |
@else if $type == shiny { |
| 91 |
@include shiny($b-color, false, $t-size, $pad); |
| 92 |
} |
| 93 |
|
| 94 |
@else if $type == pill { |
| 95 |
@include pill($b-color, false, $t-size, $pad); |
| 96 |
} |
| 97 |
|
| 98 |
@else if $type == flat { |
| 99 |
@include flat($b-color, false, $t-size, $pad); |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
// Simple Button |
| 104 |
@mixin simple($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { |
| 105 |
$color: hsl(0, 0, 100%); |
| 106 |
$border: adjust-color($base-color, $saturation: 9%, $lightness: -14%); |
| 107 |
$inset-shadow: adjust-color($base-color, $saturation: -8%, $lightness: 15%); |
| 108 |
$stop-gradient: adjust-color($base-color, $saturation: 9%, $lightness: -11%); |
| 109 |
$text-shadow: adjust-color($base-color, $saturation: 15%, $lightness: -18%); |
| 110 |
|
| 111 |
@if is-light($base-color) { |
| 112 |
$color: hsl(0, 0, 20%); |
| 113 |
$text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); |
| 114 |
} |
| 115 |
|
| 116 |
@if $grayscale == true { |
| 117 |
$border: grayscale($border); |
| 118 |
$inset-shadow: grayscale($inset-shadow); |
| 119 |
$stop-gradient: grayscale($stop-gradient); |
| 120 |
$text-shadow: grayscale($text-shadow); |
| 121 |
} |
| 122 |
|
| 123 |
border: 1px solid $border; |
| 124 |
border-radius: 3px; |
| 125 |
box-shadow: inset 0 1px 0 0 $inset-shadow; |
| 126 |
color: $color; |
| 127 |
display: inline-block; |
| 128 |
font-size: $textsize; |
| 129 |
font-weight: bold; |
| 130 |
@include linear-gradient ($base-color, $stop-gradient); |
| 131 |
padding: $padding; |
| 132 |
text-decoration: none; |
| 133 |
text-shadow: 0 1px 0 $text-shadow; |
| 134 |
background-clip: padding-box; |
| 135 |
|
| 136 |
&:hover:not(:disabled) { |
| 137 |
$base-color-hover: adjust-color($base-color, $saturation: -4%, $lightness: -5%); |
| 138 |
$inset-shadow-hover: adjust-color($base-color, $saturation: -7%, $lightness: 5%); |
| 139 |
$stop-gradient-hover: adjust-color($base-color, $saturation: 8%, $lightness: -14%); |
| 140 |
|
| 141 |
@if $grayscale == true { |
| 142 |
$base-color-hover: grayscale($base-color-hover); |
| 143 |
$inset-shadow-hover: grayscale($inset-shadow-hover); |
| 144 |
$stop-gradient-hover: grayscale($stop-gradient-hover); |
| 145 |
} |
| 146 |
|
| 147 |
@include linear-gradient ($base-color-hover, $stop-gradient-hover); |
| 148 |
|
| 149 |
box-shadow: inset 0 1px 0 0 $inset-shadow-hover; |
| 150 |
cursor: pointer; |
| 151 |
} |
| 152 |
|
| 153 |
&:active:not(:disabled), |
| 154 |
&:focus:not(:disabled) { |
| 155 |
$border-active: adjust-color($base-color, $saturation: 9%, $lightness: -14%); |
| 156 |
$inset-shadow-active: adjust-color($base-color, $saturation: 7%, $lightness: -17%); |
| 157 |
|
| 158 |
@if $grayscale == true { |
| 159 |
$border-active: grayscale($border-active); |
| 160 |
$inset-shadow-active: grayscale($inset-shadow-active); |
| 161 |
} |
| 162 |
|
| 163 |
border: 1px solid $border-active; |
| 164 |
box-shadow: inset 0 0 8px 4px $inset-shadow-active, inset 0 0 8px 4px $inset-shadow-active; |
| 165 |
} |
| 166 |
} |
| 167 |
|
| 168 |
// Shiny Button |
| 169 |
@mixin shiny($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { |
| 170 |
$color: hsl(0, 0, 100%); |
| 171 |
$border: adjust-color($base-color, $red: -117, $green: -111, $blue: -81); |
| 172 |
$border-bottom: adjust-color($base-color, $red: -126, $green: -127, $blue: -122); |
| 173 |
$fourth-stop: adjust-color($base-color, $red: -79, $green: -70, $blue: -46); |
| 174 |
$inset-shadow: adjust-color($base-color, $red: 37, $green: 29, $blue: 12); |
| 175 |
$second-stop: adjust-color($base-color, $red: -56, $green: -50, $blue: -33); |
| 176 |
$text-shadow: adjust-color($base-color, $red: -140, $green: -141, $blue: -114); |
| 177 |
$third-stop: adjust-color($base-color, $red: -86, $green: -75, $blue: -48); |
| 178 |
|
| 179 |
@if is-light($base-color) { |
| 180 |
$color: hsl(0, 0, 20%); |
| 181 |
$text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); |
| 182 |
} |
| 183 |
|
| 184 |
@if $grayscale == true { |
| 185 |
$border: grayscale($border); |
| 186 |
$border-bottom: grayscale($border-bottom); |
| 187 |
$fourth-stop: grayscale($fourth-stop); |
| 188 |
$inset-shadow: grayscale($inset-shadow); |
| 189 |
$second-stop: grayscale($second-stop); |
| 190 |
$text-shadow: grayscale($text-shadow); |
| 191 |
$third-stop: grayscale($third-stop); |
| 192 |
} |
| 193 |
|
| 194 |
@include linear-gradient(top, $base-color 0%, $second-stop 50%, $third-stop 50%, $fourth-stop 100%); |
| 195 |
|
| 196 |
border: 1px solid $border; |
| 197 |
border-bottom: 1px solid $border-bottom; |
| 198 |
border-radius: 5px; |
| 199 |
box-shadow: inset 0 1px 0 0 $inset-shadow; |
| 200 |
color: $color; |
| 201 |
display: inline-block; |
| 202 |
font-size: $textsize; |
| 203 |
font-weight: bold; |
| 204 |
padding: $padding; |
| 205 |
text-align: center; |
| 206 |
text-decoration: none; |
| 207 |
text-shadow: 0 -1px 1px $text-shadow; |
| 208 |
|
| 209 |
&:hover:not(:disabled) { |
| 210 |
$first-stop-hover: adjust-color($base-color, $red: -13, $green: -15, $blue: -18); |
| 211 |
$second-stop-hover: adjust-color($base-color, $red: -66, $green: -62, $blue: -51); |
| 212 |
$third-stop-hover: adjust-color($base-color, $red: -93, $green: -85, $blue: -66); |
| 213 |
$fourth-stop-hover: adjust-color($base-color, $red: -86, $green: -80, $blue: -63); |
| 214 |
|
| 215 |
@if $grayscale == true { |
| 216 |
$first-stop-hover: grayscale($first-stop-hover); |
| 217 |
$second-stop-hover: grayscale($second-stop-hover); |
| 218 |
$third-stop-hover: grayscale($third-stop-hover); |
| 219 |
$fourth-stop-hover: grayscale($fourth-stop-hover); |
| 220 |
} |
| 221 |
|
| 222 |
@include linear-gradient(top, $first-stop-hover 0%, |
| 223 |
$second-stop-hover 50%, |
| 224 |
$third-stop-hover 50%, |
| 225 |
$fourth-stop-hover 100%); |
| 226 |
cursor: pointer; |
| 227 |
} |
| 228 |
|
| 229 |
&:active:not(:disabled), |
| 230 |
&:focus:not(:disabled) { |
| 231 |
$inset-shadow-active: adjust-color($base-color, $red: -111, $green: -116, $blue: -122); |
| 232 |
|
| 233 |
@if $grayscale == true { |
| 234 |
$inset-shadow-active: grayscale($inset-shadow-active); |
| 235 |
} |
| 236 |
|
| 237 |
box-shadow: inset 0 0 20px 0 $inset-shadow-active; |
| 238 |
} |
| 239 |
} |
| 240 |
|
| 241 |
// Pill Button |
| 242 |
@mixin pill($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { |
| 243 |
$color: hsl(0, 0, 100%); |
| 244 |
$border-bottom: adjust-color($base-color, $hue: 8, $saturation: -11%, $lightness: -26%); |
| 245 |
$border-sides: adjust-color($base-color, $hue: 4, $saturation: -21%, $lightness: -21%); |
| 246 |
$border-top: adjust-color($base-color, $hue: -1, $saturation: -30%, $lightness: -15%); |
| 247 |
$inset-shadow: adjust-color($base-color, $hue: -1, $saturation: -1%, $lightness: 7%); |
| 248 |
$stop-gradient: adjust-color($base-color, $hue: 8, $saturation: 14%, $lightness: -10%); |
| 249 |
$text-shadow: adjust-color($base-color, $hue: 5, $saturation: -19%, $lightness: -15%); |
| 250 |
|
| 251 |
@if is-light($base-color) { |
| 252 |
$color: hsl(0, 0, 20%); |
| 253 |
$text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); |
| 254 |
} |
| 255 |
|
| 256 |
@if $grayscale == true { |
| 257 |
$border-bottom: grayscale($border-bottom); |
| 258 |
$border-sides: grayscale($border-sides); |
| 259 |
$border-top: grayscale($border-top); |
| 260 |
$inset-shadow: grayscale($inset-shadow); |
| 261 |
$stop-gradient: grayscale($stop-gradient); |
| 262 |
$text-shadow: grayscale($text-shadow); |
| 263 |
} |
| 264 |
|
| 265 |
border: 1px solid $border-top; |
| 266 |
border-color: $border-top $border-sides $border-bottom; |
| 267 |
border-radius: 16px; |
| 268 |
box-shadow: inset 0 1px 0 0 $inset-shadow; |
| 269 |
color: $color; |
| 270 |
display: inline-block; |
| 271 |
font-size: $textsize; |
| 272 |
font-weight: normal; |
| 273 |
line-height: 1; |
| 274 |
@include linear-gradient ($base-color, $stop-gradient); |
| 275 |
padding: $padding; |
| 276 |
text-align: center; |
| 277 |
text-decoration: none; |
| 278 |
text-shadow: 0 -1px 1px $text-shadow; |
| 279 |
background-clip: padding-box; |
| 280 |
|
| 281 |
&:hover:not(:disabled) { |
| 282 |
$base-color-hover: adjust-color($base-color, $lightness: -4.5%); |
| 283 |
$border-bottom: adjust-color($base-color, $hue: 8, $saturation: 13.5%, $lightness: -32%); |
| 284 |
$border-sides: adjust-color($base-color, $hue: 4, $saturation: -2%, $lightness: -27%); |
| 285 |
$border-top: adjust-color($base-color, $hue: -1, $saturation: -17%, $lightness: -21%); |
| 286 |
$inset-shadow-hover: adjust-color($base-color, $saturation: -1%, $lightness: 3%); |
| 287 |
$stop-gradient-hover: adjust-color($base-color, $hue: 8, $saturation: -4%, $lightness: -15.5%); |
| 288 |
$text-shadow-hover: adjust-color($base-color, $hue: 5, $saturation: -5%, $lightness: -22%); |
| 289 |
|
| 290 |
@if $grayscale == true { |
| 291 |
$base-color-hover: grayscale($base-color-hover); |
| 292 |
$border-bottom: grayscale($border-bottom); |
| 293 |
$border-sides: grayscale($border-sides); |
| 294 |
$border-top: grayscale($border-top); |
| 295 |
$inset-shadow-hover: grayscale($inset-shadow-hover); |
| 296 |
$stop-gradient-hover: grayscale($stop-gradient-hover); |
| 297 |
$text-shadow-hover: grayscale($text-shadow-hover); |
| 298 |
} |
| 299 |
|
| 300 |
@include linear-gradient ($base-color-hover, $stop-gradient-hover); |
| 301 |
|
| 302 |
background-clip: padding-box; |
| 303 |
border: 1px solid $border-top; |
| 304 |
border-color: $border-top $border-sides $border-bottom; |
| 305 |
box-shadow: inset 0 1px 0 0 $inset-shadow-hover; |
| 306 |
cursor: pointer; |
| 307 |
text-shadow: 0 -1px 1px $text-shadow-hover; |
| 308 |
} |
| 309 |
|
| 310 |
&:active:not(:disabled), |
| 311 |
&:focus:not(:disabled) { |
| 312 |
$active-color: adjust-color($base-color, $hue: 4, $saturation: -12%, $lightness: -10%); |
| 313 |
$border-active: adjust-color($base-color, $hue: 6, $saturation: -2.5%, $lightness: -30%); |
| 314 |
$border-bottom-active: adjust-color($base-color, $hue: 11, $saturation: 6%, $lightness: -31%); |
| 315 |
$inset-shadow-active: adjust-color($base-color, $hue: 9, $saturation: 2%, $lightness: -21.5%); |
| 316 |
$text-shadow-active: adjust-color($base-color, $hue: 5, $saturation: -12%, $lightness: -21.5%); |
| 317 |
|
| 318 |
@if $grayscale == true { |
| 319 |
$active-color: grayscale($active-color); |
| 320 |
$border-active: grayscale($border-active); |
| 321 |
$border-bottom-active: grayscale($border-bottom-active); |
| 322 |
$inset-shadow-active: grayscale($inset-shadow-active); |
| 323 |
$text-shadow-active: grayscale($text-shadow-active); |
| 324 |
} |
| 325 |
|
| 326 |
background: $active-color; |
| 327 |
border: 1px solid $border-active; |
| 328 |
border-bottom: 1px solid $border-bottom-active; |
| 329 |
box-shadow: inset 0 0 6px 3px $inset-shadow-active; |
| 330 |
text-shadow: 0 -1px 1px $text-shadow-active; |
| 331 |
} |
| 332 |
} |
| 333 |
|
| 334 |
// Flat Button |
| 335 |
@mixin flat($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { |
| 336 |
$color: hsl(0, 0, 100%); |
| 337 |
|
| 338 |
@if is-light($base-color) { |
| 339 |
$color: hsl(0, 0, 20%); |
| 340 |
} |
| 341 |
|
| 342 |
background-color: $base-color; |
| 343 |
border-radius: 3px; |
| 344 |
border: 0; |
| 345 |
color: $color; |
| 346 |
display: inline-block; |
| 347 |
font-size: $textsize; |
| 348 |
font-weight: bold; |
| 349 |
padding: $padding; |
| 350 |
text-decoration: none; |
| 351 |
background-clip: padding-box; |
| 352 |
|
| 353 |
&:hover:not(:disabled){ |
| 354 |
$base-color-hover: adjust-color($base-color, $saturation: 4%, $lightness: 5%); |
| 355 |
|
| 356 |
@if $grayscale == true { |
| 357 |
$base-color-hover: grayscale($base-color-hover); |
| 358 |
} |
| 359 |
|
| 360 |
background-color: $base-color-hover; |
| 361 |
cursor: pointer; |
| 362 |
} |
| 363 |
|
| 364 |
&:active:not(:disabled), |
| 365 |
&:focus:not(:disabled) { |
| 366 |
$base-color-active: adjust-color($base-color, $saturation: -4%, $lightness: -5%); |
| 367 |
|
| 368 |
@if $grayscale == true { |
| 369 |
$base-color-active: grayscale($base-color-active); |
| 370 |
} |
| 371 |
|
| 372 |
background-color: $base-color-active; |
| 373 |
cursor: pointer; |
| 374 |
} |
| 375 |
} |
| 376 |
|
| 377 |
// Flexible grid |
| 378 |
@function flex-grid($columns, $container-columns: $fg-max-columns) { |
| 379 |
@if $output-bourbon-deprecation-warnings == true { |
| 380 |
@warn "[Bourbon] [Deprecation] `flex-grid` is deprecated and will be " + |
| 381 |
"removed in 5.0.0. For grid functions, check out Bourbon's sister library" + |
| 382 |
"Neat."; |
| 383 |
} |
| 384 |
|
| 385 |
$width: $columns * $fg-column + ($columns - 1) * $fg-gutter; |
| 386 |
$container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter; |
| 387 |
@return percentage($width / $container-width); |
| 388 |
} |
| 389 |
|
| 390 |
// Flexible gutter |
| 391 |
@function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) { |
| 392 |
@if $output-bourbon-deprecation-warnings == true { |
| 393 |
@warn "[Bourbon] [Deprecation] `flex-gutter` is deprecated and will be " + |
| 394 |
"removed in 5.0.0. For grid functions, check out Bourbon's sister library" + |
| 395 |
"Neat."; |
| 396 |
} |
| 397 |
|
| 398 |
$container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter; |
| 399 |
@return percentage($gutter / $container-width); |
| 400 |
} |
| 401 |
|
| 402 |
@function grid-width($n) { |
| 403 |
@if $output-bourbon-deprecation-warnings == true { |
| 404 |
@warn "[Bourbon] [Deprecation] `grid-width` is deprecated and will be " + |
| 405 |
"removed in 5.0.0. For grid functions, check out Bourbon's sister library" + |
| 406 |
"Neat."; |
| 407 |
} |
| 408 |
|
| 409 |
@return $n * $gw-column + ($n - 1) * $gw-gutter; |
| 410 |
} |
| 411 |
|
| 412 |
@function golden-ratio($value, $increment) { |
| 413 |
@if $output-bourbon-deprecation-warnings == true { |
| 414 |
@warn "[Bourbon] [Deprecation] `golden-ratio` is deprecated and will be " + |
| 415 |
"removed in 5.0.0. You can use the `modular-scale` function instead."; |
| 416 |
} |
| 417 |
|
| 418 |
@return modular-scale($increment, $value, $ratio: $golden); |
| 419 |
} |
| 420 |
|
| 421 |
@mixin box-sizing($box) { |
| 422 |
@include _bourbon-deprecate-for-prefixing("box-sizing"); |
| 423 |
|
| 424 |
@include prefixer(box-sizing, $box, webkit moz spec); |
| 425 |
} |