UNPKG

3.87 kBSCSSView Raw
1@use '@angular/cdk';
2
3@use '../core/style/variables';
4@use '../core/style/private';
5@use '../core/style/vendor-prefixes';
6
7$tab-bar-height: 48px !default;
8$tab-animation-duration: 500ms !default;
9
10// Mixin styles for labels that are contained within the tab header.
11@mixin tab-label {
12 height: $tab-bar-height;
13 padding: 0 24px;
14 cursor: pointer;
15 box-sizing: border-box;
16 opacity: 0.6;
17 min-width: 160px;
18 text-align: center;
19 display: inline-flex;
20 justify-content: center;
21 align-items: center;
22 white-space: nowrap;
23
24 &:focus {
25 outline: none;
26
27 &:not(.mat-tab-disabled) {
28 opacity: 1;
29 }
30
31 @include cdk.high-contrast(active, off) {
32 $outline-width: 2px;
33 outline: dotted $outline-width;
34 outline-offset: -$outline-width; // Not supported on IE, but looks better everywhere else.
35 }
36 }
37
38 &.mat-tab-disabled {
39 cursor: default;
40
41 @include cdk.high-contrast(active, off) {
42 opacity: 0.5;
43 }
44 }
45
46 .mat-tab-label-content {
47 display: inline-flex;
48 justify-content: center;
49 align-items: center;
50 white-space: nowrap;
51 }
52
53 @include cdk.high-contrast(active, off) {
54 opacity: 1;
55 }
56}
57
58// The ink bar that displays under the active tab label
59@mixin ink-bar {
60 $height: 2px;
61
62 @include private.private-animation-noop();
63 position: absolute;
64 bottom: 0;
65 height: $height;
66 transition: $tab-animation-duration variables.$ease-in-out-curve-function;
67
68 .mat-tab-group-inverted-header & {
69 bottom: auto;
70 top: 0;
71 }
72
73 @include cdk.high-contrast(active, off) {
74 outline: solid $height;
75 height: 0;
76 }
77}
78
79// Structural styles for a tab header. Used by both `mat-tab-header` and `mat-tab-nav-bar`.
80@mixin paginated-tab-header {
81 .mat-tab-header {
82 display: flex;
83 overflow: hidden;
84 position: relative;
85 flex-shrink: 0;
86 }
87
88 .mat-tab-header-pagination {
89 @include vendor-prefixes.user-select(none);
90 position: relative;
91 display: none;
92 justify-content: center;
93 align-items: center;
94 min-width: 32px;
95 cursor: pointer;
96 z-index: 2;
97 -webkit-tap-highlight-color: transparent;
98 touch-action: none;
99 box-sizing: content-box;
100 background: none;
101 border: none;
102 outline: 0;
103 padding: 0;
104
105 &::-moz-focus-inner {
106 border: 0;
107 }
108
109 .mat-tab-header-pagination-controls-enabled & {
110 display: flex;
111 }
112 }
113
114 // The pagination control that is displayed on the left side of the tab header.
115 .mat-tab-header-pagination-before, .mat-tab-header-rtl .mat-tab-header-pagination-after {
116 padding-left: 4px;
117 .mat-tab-header-pagination-chevron {
118 transform: rotate(-135deg);
119 }
120 }
121
122 // The pagination control that is displayed on the right side of the tab header.
123 .mat-tab-header-rtl .mat-tab-header-pagination-before, .mat-tab-header-pagination-after {
124 padding-right: 4px;
125 .mat-tab-header-pagination-chevron {
126 transform: rotate(45deg);
127 }
128 }
129
130 .mat-tab-header-pagination-chevron {
131 border-style: solid;
132 border-width: 2px 2px 0 0;
133 height: 8px;
134 width: 8px;
135 }
136
137 .mat-tab-header-pagination-disabled {
138 box-shadow: none;
139 cursor: default;
140 }
141
142 .mat-tab-list {
143 flex-grow: 1;
144 position: relative;
145 transition: transform 500ms cubic-bezier(0.35, 0, 0.25, 1);
146 }
147}
148
149// Structural styles for the element that wraps the paginated header items.
150@mixin paginated-tab-header-item-wrapper($parent) {
151 display: flex;
152
153 // We need to set the parent here explicitly, in order to prevent the alignment
154 // from any parent tab groups from propagating down to the children when nesting.
155 [mat-align-tabs='center'] > #{$parent} & {
156 justify-content: center;
157 }
158
159 [mat-align-tabs='end'] > #{$parent} & {
160 justify-content: flex-end;
161 }
162}
163
164@mixin paginated-tab-header-container {
165 display: flex;
166 flex-grow: 1;
167 overflow: hidden;
168 z-index: 1;
169}