1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | $has-tip-cursor: help !default;
|
12 |
|
13 |
|
14 |
|
15 | $has-tip-font-weight: $global-weight-bold !default;
|
16 |
|
17 |
|
18 |
|
19 | $has-tip-border-bottom: dotted 1px $dark-gray !default;
|
20 |
|
21 |
|
22 |
|
23 | $tooltip-background-color: $black !default;
|
24 |
|
25 |
|
26 |
|
27 | $tooltip-color: $white !default;
|
28 |
|
29 |
|
30 |
|
31 | $tooltip-padding: 0.75rem !default;
|
32 |
|
33 |
|
34 |
|
35 | $tooltip-max-width: 10rem !default;
|
36 |
|
37 |
|
38 |
|
39 | $tooltip-font-size: $small-font-size !default;
|
40 |
|
41 |
|
42 |
|
43 | $tooltip-pip-width: 0.75rem !default;
|
44 |
|
45 |
|
46 |
|
47 | $tooltip-pip-height: $tooltip-pip-width * 0.866 !default;
|
48 |
|
49 |
|
50 |
|
51 | $tooltip-radius: $global-radius !default;
|
52 |
|
53 | @mixin has-tip {
|
54 | position: relative;
|
55 | display: inline-block;
|
56 |
|
57 | border-bottom: $has-tip-border-bottom;
|
58 | font-weight: $has-tip-font-weight;
|
59 | cursor: $has-tip-cursor;
|
60 | }
|
61 |
|
62 | @mixin tooltip {
|
63 | position: absolute;
|
64 | top: calc(100% + #{$tooltip-pip-height});
|
65 | z-index: 1200;
|
66 |
|
67 | max-width: $tooltip-max-width;
|
68 | padding: $tooltip-padding;
|
69 |
|
70 | border-radius: $tooltip-radius;
|
71 | background-color: $tooltip-background-color;
|
72 | font-size: $tooltip-font-size;
|
73 | color: $tooltip-color;
|
74 |
|
75 | &::before {
|
76 | position: absolute;
|
77 | }
|
78 |
|
79 | &.bottom {
|
80 | &::before {
|
81 | @include css-triangle($tooltip-pip-width, $tooltip-background-color, up);
|
82 | bottom: 100%;
|
83 | }
|
84 |
|
85 | &.align-center::before {
|
86 | left: 50%;
|
87 | transform: translateX(-50%);
|
88 | }
|
89 | }
|
90 |
|
91 | &.top {
|
92 | &::before {
|
93 | @include css-triangle($tooltip-pip-width, $tooltip-background-color, down);
|
94 | top: 100%;
|
95 | bottom: auto;
|
96 | }
|
97 |
|
98 | &.align-center::before {
|
99 | left: 50%;
|
100 | transform: translateX(-50%);
|
101 | }
|
102 | }
|
103 |
|
104 | &.left {
|
105 | &::before {
|
106 | @include css-triangle($tooltip-pip-width, $tooltip-background-color, right);
|
107 | left: 100%;
|
108 | }
|
109 |
|
110 | &.align-center::before {
|
111 | bottom: auto;
|
112 | top: 50%;
|
113 | transform: translateY(-50%);
|
114 | }
|
115 | }
|
116 |
|
117 | &.right {
|
118 | &::before {
|
119 | @include css-triangle($tooltip-pip-width, $tooltip-background-color, left);
|
120 | right: 100%;
|
121 | left: auto;
|
122 | }
|
123 |
|
124 | &.align-center::before {
|
125 | bottom: auto;
|
126 | top: 50%;
|
127 | transform: translateY(-50%);
|
128 | }
|
129 | }
|
130 |
|
131 | &.align-top::before {
|
132 | bottom: auto;
|
133 | top: 10%;
|
134 | }
|
135 |
|
136 | &.align-bottom::before {
|
137 | bottom: 10%;
|
138 | top: auto;
|
139 | }
|
140 |
|
141 | &.align-left::before {
|
142 | left: 10%;
|
143 | right: auto;
|
144 | }
|
145 |
|
146 | &.align-right::before {
|
147 | left: auto;
|
148 | right: 10%;
|
149 | }
|
150 | }
|
151 |
|
152 | @mixin foundation-tooltip {
|
153 | .has-tip {
|
154 | @include has-tip;
|
155 | }
|
156 |
|
157 | .tooltip {
|
158 | @include tooltip;
|
159 | }
|
160 | }
|