UNPKG

1.48 kBSCSSView Raw
1@mixin caret-down {
2 border-top: $caret-width solid;
3 border-right: $caret-width solid transparent;
4 border-bottom: 0;
5 border-left: $caret-width solid transparent;
6}
7
8@mixin caret-up {
9 border-top: 0;
10 border-right: $caret-width solid transparent;
11 border-bottom: $caret-width solid;
12 border-left: $caret-width solid transparent;
13}
14
15@mixin caret-right {
16 border-top: $caret-width solid transparent;
17 border-right: 0;
18 border-bottom: $caret-width solid transparent;
19 border-left: $caret-width solid;
20}
21
22@mixin caret-left {
23 border-top: $caret-width solid transparent;
24 border-right: $caret-width solid;
25 border-bottom: $caret-width solid transparent;
26}
27
28@mixin caret($direction: down) {
29 @if $enable-caret {
30 &::after {
31 display: inline-block;
32 width: 0;
33 height: 0;
34 margin-left: $caret-width * .85;
35 vertical-align: $caret-width * .85;
36 content: "";
37 @if $direction == down {
38 @include caret-down;
39 } @else if $direction == up {
40 @include caret-up;
41 } @else if $direction == right {
42 @include caret-right;
43 }
44 }
45
46 @if $direction == left {
47 &::after {
48 display: none;
49 }
50
51 &::before {
52 display: inline-block;
53 width: 0;
54 height: 0;
55 margin-right: $caret-width * .85;
56 vertical-align: $caret-width * .85;
57 content: "";
58 @include caret-left;
59 }
60 }
61
62 &:empty::after {
63 margin-left: 0;
64 }
65 }
66}