|
1 | 1 | // Base class |
2 | 2 | .tooltip { |
| 3 | + // scss-docs-start tooltip-css-vars |
| 4 | + --#{$variable-prefix}tooltip-zindex: #{$zindex-tooltip}; |
| 5 | + --#{$variable-prefix}tooltip-max-width: #{$tooltip-max-width}; |
| 6 | + --#{$variable-prefix}tooltip-padding-x: #{$tooltip-padding-x}; |
| 7 | + --#{$variable-prefix}tooltip-padding-y: #{$tooltip-padding-y}; |
| 8 | + --#{$variable-prefix}tooltip-margin: #{$tooltip-margin}; |
| 9 | + --#{$variable-prefix}tooltip-font-size: #{$tooltip-font-size}; |
| 10 | + --#{$variable-prefix}tooltip-color: #{$tooltip-color}; |
| 11 | + --#{$variable-prefix}tooltip-bg: #{$tooltip-bg}; |
| 12 | + --#{$variable-prefix}tooltip-border-radius: #{$tooltip-border-radius}; |
| 13 | + --#{$variable-prefix}tooltip-opacity: #{$tooltip-opacity}; |
| 14 | + --#{$variable-prefix}tooltip-arrow-width: #{$tooltip-arrow-width}; |
| 15 | + --#{$variable-prefix}tooltip-arrow-height: #{$tooltip-arrow-height}; |
| 16 | + |
| 17 | + $tooltip-arrow-color: null; |
| 18 | + |
3 | 19 | position: absolute; |
4 | | - z-index: $zindex-tooltip; |
| 20 | + z-index: var(--#{$variable-prefix}tooltip-zindex); |
5 | 21 | display: block; |
6 | | - margin: $tooltip-margin; |
| 22 | + margin: var(--#{$variable-prefix}tooltip-margin); |
7 | 23 | // Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element. |
8 | 24 | // So reset our font and text properties to avoid inheriting weird values. |
9 | 25 | @include reset-text(); |
10 | | - @include font-size($tooltip-font-size); |
| 26 | + @include font-size(var(--#{$variable-prefix}tooltip-font-size)); |
11 | 27 | // Allow breaking very long words so they don't overflow the tooltip's bounds |
12 | 28 | word-wrap: break-word; |
13 | 29 | opacity: 0; |
14 | 30 |
|
15 | | - &.show { opacity: $tooltip-opacity; } |
| 31 | + &.show { opacity: var(--#{$variable-prefix}tooltip-opacity); } |
16 | 32 |
|
17 | 33 | .tooltip-arrow { |
18 | 34 | position: absolute; |
19 | 35 | display: block; |
20 | | - width: $tooltip-arrow-width; |
21 | | - height: $tooltip-arrow-height; |
| 36 | + width: var(--#{$variable-prefix}tooltip-arrow-width); |
| 37 | + height: var(--#{$variable-prefix}tooltip-arrow-height); |
22 | 38 |
|
23 | 39 | &::before { |
24 | 40 | position: absolute; |
|
30 | 46 | } |
31 | 47 |
|
32 | 48 | .bs-tooltip-top { |
33 | | - padding: $tooltip-arrow-height 0; |
| 49 | + padding: var(--#{$variable-prefix}tooltip-arrow-height) 0; |
34 | 50 |
|
35 | 51 | .tooltip-arrow { |
36 | 52 | bottom: 0; |
37 | 53 |
|
38 | 54 | &::before { |
39 | 55 | top: -1px; |
40 | | - border-width: $tooltip-arrow-height ($tooltip-arrow-width * .5) 0; |
41 | | - border-top-color: $tooltip-arrow-color; |
| 56 | + border-width: var(--#{$variable-prefix}tooltip-arrow-height) calc(var(--#{$variable-prefix}tooltip-arrow-width) * .5) 0; // stylelint-disable-line function-disallowed-list |
| 57 | + border-top-color: var(--#{$variable-prefix}tooltip-bg); |
42 | 58 | } |
43 | 59 | } |
44 | 60 | } |
45 | 61 |
|
46 | 62 | /* rtl:begin:ignore */ |
47 | 63 | .bs-tooltip-end { |
48 | | - padding: 0 $tooltip-arrow-height; |
| 64 | + padding: 0 var(--#{$variable-prefix}tooltip-arrow-height); |
49 | 65 |
|
50 | 66 | .tooltip-arrow { |
51 | 67 | left: 0; |
52 | | - width: $tooltip-arrow-height; |
53 | | - height: $tooltip-arrow-width; |
| 68 | + width: var(--#{$variable-prefix}tooltip-arrow-height); |
| 69 | + height: var(--#{$variable-prefix}tooltip-arrow-width); |
54 | 70 |
|
55 | 71 | &::before { |
56 | 72 | right: -1px; |
57 | | - border-width: ($tooltip-arrow-width * .5) $tooltip-arrow-height ($tooltip-arrow-width * .5) 0; |
58 | | - border-right-color: $tooltip-arrow-color; |
| 73 | + border-width: calc(var(--#{$variable-prefix}tooltip-arrow-width) * .5) var(--#{$variable-prefix}tooltip-arrow-height) calc(var(--#{$variable-prefix}tooltip-arrow-width) * .5) 0; // stylelint-disable-line function-disallowed-list |
| 74 | + border-right-color: var(--#{$variable-prefix}tooltip-bg); |
59 | 75 | } |
60 | 76 | } |
61 | 77 | } |
62 | 78 |
|
63 | 79 | /* rtl:end:ignore */ |
64 | 80 |
|
65 | 81 | .bs-tooltip-bottom { |
66 | | - padding: $tooltip-arrow-height 0; |
| 82 | + padding: var(--#{$variable-prefix}tooltip-arrow-height) 0; |
67 | 83 |
|
68 | 84 | .tooltip-arrow { |
69 | 85 | top: 0; |
70 | 86 |
|
71 | 87 | &::before { |
72 | 88 | bottom: -1px; |
73 | | - border-width: 0 ($tooltip-arrow-width * .5) $tooltip-arrow-height; |
74 | | - border-bottom-color: $tooltip-arrow-color; |
| 89 | + border-width: 0 calc(var(--#{$variable-prefix}tooltip-arrow-width) * .5) var(--#{$variable-prefix}tooltip-arrow-height); // stylelint-disable-line function-disallowed-list |
| 90 | + border-bottom-color: var(--#{$variable-prefix}tooltip-bg); |
75 | 91 | } |
76 | 92 | } |
77 | 93 | } |
78 | 94 |
|
79 | 95 | /* rtl:begin:ignore */ |
80 | 96 | .bs-tooltip-start { |
81 | | - padding: 0 $tooltip-arrow-height; |
| 97 | + padding: 0 var(--#{$variable-prefix}tooltip-arrow-height); |
82 | 98 |
|
83 | 99 | .tooltip-arrow { |
84 | 100 | right: 0; |
85 | | - width: $tooltip-arrow-height; |
86 | | - height: $tooltip-arrow-width; |
| 101 | + width: var(--#{$variable-prefix}tooltip-arrow-height); |
| 102 | + height: var(--#{$variable-prefix}tooltip-arrow-width); |
87 | 103 |
|
88 | 104 | &::before { |
89 | 105 | left: -1px; |
90 | | - border-width: ($tooltip-arrow-width * .5) 0 ($tooltip-arrow-width * .5) $tooltip-arrow-height; |
91 | | - border-left-color: $tooltip-arrow-color; |
| 106 | + border-width: calc(var(--#{$variable-prefix}tooltip-arrow-width) * .5) 0 calc(var(--#{$variable-prefix}tooltip-arrow-width) * .5) var(--#{$variable-prefix}tooltip-arrow-height); // stylelint-disable-line function-disallowed-list |
| 107 | + border-left-color: var(--#{$variable-prefix}tooltip-bg); |
92 | 108 | } |
93 | 109 | } |
94 | 110 | } |
|
112 | 128 |
|
113 | 129 | // Wrapper for the tooltip content |
114 | 130 | .tooltip-inner { |
115 | | - max-width: $tooltip-max-width; |
116 | | - padding: $tooltip-padding-y $tooltip-padding-x; |
117 | | - color: $tooltip-color; |
| 131 | + max-width: var(--#{$variable-prefix}tooltip-max-width); |
| 132 | + padding: var(--#{$variable-prefix}tooltip-padding-y) var(--#{$variable-prefix}tooltip-padding-x); |
| 133 | + color: var(--#{$variable-prefix}tooltip-color); |
118 | 134 | text-align: center; |
119 | | - background-color: $tooltip-bg; |
120 | | - @include border-radius($tooltip-border-radius); |
| 135 | + background-color: var(--#{$variable-prefix}tooltip-bg); |
| 136 | + border-radius: var(--#{$variable-prefix}tooltip-border-radius, 0); // stylelint-disable-line property-disallowed-list |
121 | 137 | } |
0 commit comments