1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | @import '../../globals/scss/vars';
|
9 | @import '../../globals/scss/typography';
|
10 | @import '../../globals/scss/helper-mixins';
|
11 | @import '../../globals/scss/css--reset';
|
12 | @import '../../globals/scss/vendor/@carbon/elements/scss/import-once/import-once';
|
13 |
|
14 | @mixin content-switcher {
|
15 | .#{$prefix}--content-switcher {
|
16 | @include font-family;
|
17 | display: flex;
|
18 | height: rem(40px);
|
19 | }
|
20 |
|
21 | .#{$prefix}--content-switcher-btn {
|
22 | @include reset;
|
23 | @include font-smoothing;
|
24 | @include typescale('zeta');
|
25 | @include font-family;
|
26 | background-color: transparent;
|
27 | display: flex;
|
28 | align-items: center;
|
29 | padding: 0 $spacing-xl;
|
30 | margin: 0;
|
31 | text-decoration: none;
|
32 | border: 1px solid $brand-01;
|
33 | color: $brand-01;
|
34 |
|
35 | &:focus {
|
36 | outline: 1px solid transparent;
|
37 | background-color: $hover-primary;
|
38 | z-index: 2;
|
39 | border-color: $hover-primary;
|
40 | text-decoration: underline;
|
41 | color: $inverse-01;
|
42 | }
|
43 |
|
44 | &:hover {
|
45 | cursor: pointer;
|
46 | }
|
47 |
|
48 | &:hover,
|
49 | &:active {
|
50 | background-color: $hover-primary;
|
51 | border-color: $hover-primary;
|
52 | color: $inverse-01;
|
53 | }
|
54 | }
|
55 |
|
56 | .#{$prefix}--content-switcher__icon {
|
57 | margin-right: $spacing-xs;
|
58 | fill: currentColor;
|
59 |
|
60 | * {
|
61 | fill: currentColor;
|
62 | }
|
63 | }
|
64 |
|
65 | .#{$prefix}--content-switcher-btn:not(:last-of-type) {
|
66 | border-right: none;
|
67 | }
|
68 |
|
69 | .#{$prefix}--content-switcher-btn:not(:first-of-type) {
|
70 | border-left: $content-switcher-option-border;
|
71 |
|
72 | &:hover {
|
73 | border-left-color: $hover-primary;
|
74 | }
|
75 | }
|
76 |
|
77 | .#{$prefix}--content-switcher-btn:first-of-type {
|
78 | border-bottom-left-radius: $content-switcher-border-radius;
|
79 | border-top-left-radius: $content-switcher-border-radius;
|
80 |
|
81 | &:hover {
|
82 | border-color: $hover-primary;
|
83 | }
|
84 |
|
85 | &:focus {
|
86 | z-index: 0;
|
87 | }
|
88 | }
|
89 |
|
90 | .#{$prefix}--content-switcher-btn:last-of-type {
|
91 | border-top-right-radius: $content-switcher-border-radius;
|
92 | border-bottom-right-radius: $content-switcher-border-radius;
|
93 |
|
94 | &:hover {
|
95 | border-color: $hover-primary;
|
96 | }
|
97 |
|
98 | &:focus {
|
99 | z-index: 0;
|
100 | }
|
101 | }
|
102 |
|
103 | .#{$prefix}--content-switcher-btn.#{$prefix}--content-switcher--selected {
|
104 | background-color: $brand-01;
|
105 | color: $inverse-01;
|
106 | font-weight: 400;
|
107 | outline: 1px solid transparent;
|
108 |
|
109 | &:hover,
|
110 | &:focus {
|
111 | border-color: $hover-primary;
|
112 | background-color: $hover-primary;
|
113 | }
|
114 | }
|
115 | }
|
116 |
|
117 | @mixin content-switcher--x {
|
118 | .#{$prefix}--content-switcher {
|
119 | display: flex;
|
120 | justify-content: space-evenly;
|
121 | width: 100%;
|
122 | height: rem(32px);
|
123 | }
|
124 |
|
125 | .#{$prefix}--content-switcher--disabled {
|
126 | cursor: not-allowed;
|
127 | }
|
128 |
|
129 | .#{$prefix}--content-switcher-btn {
|
130 | @include reset;
|
131 | @include type-style('body-short-01');
|
132 | @include focus-outline('reset');
|
133 |
|
134 | background-color: $ui-01;
|
135 | display: inline-block;
|
136 | width: 100%;
|
137 | height: rem(40px);
|
138 | padding: $carbon--spacing-03 $carbon--spacing-05;
|
139 | margin: 0;
|
140 | white-space: nowrap;
|
141 | overflow: hidden;
|
142 | text-overflow: ellipsis;
|
143 | text-align: left;
|
144 | text-decoration: none;
|
145 | border: none;
|
146 | color: $text-02;
|
147 | transition: all $duration--fast-01 motion(standard, productive);
|
148 | position: relative;
|
149 |
|
150 | &:focus {
|
151 | box-shadow: inset 0 0 0 2px $focus;
|
152 | z-index: 3;
|
153 | }
|
154 |
|
155 | &:hover {
|
156 | cursor: pointer;
|
157 | }
|
158 |
|
159 | &:hover,
|
160 | &:active {
|
161 | background-color: $hover-ui;
|
162 | color: $text-01;
|
163 | z-index: 3;
|
164 | }
|
165 |
|
166 | &:disabled {
|
167 | color: $ui-03;
|
168 | pointer-events: none;
|
169 |
|
170 | &:hover {
|
171 | cursor: not-allowed;
|
172 | }
|
173 | }
|
174 | }
|
175 |
|
176 | .#{$prefix}--content-switcher-btn:first-child {
|
177 | border-top-left-radius: rem(4px);
|
178 | border-bottom-left-radius: rem(4px);
|
179 | }
|
180 |
|
181 | .#{$prefix}--content-switcher-btn:last-child {
|
182 | border-top-right-radius: rem(4px);
|
183 | border-bottom-right-radius: rem(4px);
|
184 | }
|
185 |
|
186 | .#{$prefix}--content-switcher-btn:not(:first-of-type)::before {
|
187 | content: '';
|
188 | display: block;
|
189 | height: rem(16px);
|
190 | width: rem(1px);
|
191 | background-color: $content-switcher-divider;
|
192 | position: absolute;
|
193 | z-index: 2;
|
194 | left: 0;
|
195 | }
|
196 |
|
197 | .#{$prefix}--content-switcher-btn.#{$prefix}--content-switcher--selected::before,
|
198 | .#{$prefix}--content-switcher-btn.#{$prefix}--content-switcher--selected + .#{$prefix}--content-switcher-btn::before,
|
199 | .#{$prefix}--content-switcher-btn:focus::before,
|
200 | .#{$prefix}--content-switcher-btn:focus + .#{$prefix}--content-switcher-btn::before,
|
201 | .#{$prefix}--content-switcher-btn:hover::before,
|
202 | .#{$prefix}--content-switcher-btn:hover + .#{$prefix}--content-switcher-btn::before {
|
203 | background-color: transparent;
|
204 | }
|
205 |
|
206 | .#{$prefix}--content-switcher__icon {
|
207 | fill: $text-02;
|
208 | transition: fill $duration--fast-01 motion(standard, productive);
|
209 | }
|
210 |
|
211 | .#{$prefix}--content-switcher__icon + span {
|
212 | margin-left: $carbon--spacing-03;
|
213 | }
|
214 |
|
215 | .#{$prefix}--content-switcher-btn:hover .#{$prefix}--content-switcher__icon,
|
216 | .#{$prefix}--content-switcher-btn:focus .#{$prefix}--content-switcher__icon {
|
217 | fill: $text-01;
|
218 | }
|
219 |
|
220 | .#{$prefix}--content-switcher-btn.#{$prefix}--content-switcher--selected {
|
221 | background-color: $ui-05;
|
222 | color: $inverse-01;
|
223 | z-index: 3;
|
224 |
|
225 |
|
226 | &:disabled {
|
227 | background-color: $ibm-color__gray-30;
|
228 | }
|
229 | }
|
230 |
|
231 | .#{$prefix}--content-switcher-btn.#{$prefix}--content-switcher--selected .#{$prefix}--content-switcher__icon {
|
232 | fill: $inverse-01;
|
233 | }
|
234 | }
|
235 |
|
236 | @include exports('content-switcher') {
|
237 | @if feature-flag-enabled('components-x') {
|
238 | @include content-switcher--x;
|
239 | } @else {
|
240 | @include content-switcher;
|
241 | }
|
242 | }
|