source: trip-planner-front/node_modules/@angular/material/tabs/_tabs-theme.scss@ b738035

Last change on this file since b738035 was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 5.6 KB
Line 
1@use 'sass:map';
2@use '../core/theming/theming';
3@use '../core/typography/typography';
4@use '../core/typography/typography-utils';
5
6@mixin color($config-or-theme) {
7 $config: theming.get-color-config($config-or-theme);
8 $primary: map.get($config, primary);
9 $accent: map.get($config, accent);
10 $warn: map.get($config, warn);
11 $background: map.get($config, background);
12 $foreground: map.get($config, foreground);
13 $header-border: 1px solid theming.get-color-from-palette($foreground, divider);
14
15 .mat-tab-nav-bar,
16 .mat-tab-header {
17 border-bottom: $header-border;
18 }
19
20 .mat-tab-group-inverted-header {
21 .mat-tab-nav-bar,
22 .mat-tab-header {
23 border-top: $header-border;
24 border-bottom: none;
25 }
26 }
27
28 .mat-tab-label, .mat-tab-link {
29 color: theming.get-color-from-palette($foreground, text);
30
31 &.mat-tab-disabled {
32 color: theming.get-color-from-palette($foreground, disabled-text);
33 }
34 }
35
36 .mat-tab-header-pagination-chevron {
37 border-color: theming.get-color-from-palette($foreground, text);
38 }
39
40 .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron {
41 border-color: theming.get-color-from-palette($foreground, disabled-text);
42 }
43
44 // Remove header border when there is a background color
45 .mat-tab-group[class*='mat-background-'] > .mat-tab-header,
46 .mat-tab-nav-bar[class*='mat-background-'] {
47 border-bottom: none;
48 border-top: none;
49 }
50
51 .mat-tab-group, .mat-tab-nav-bar {
52 $theme-colors: (
53 primary: $primary,
54 accent: $accent,
55 warn: $warn
56 );
57
58 @each $name, $color in $theme-colors {
59 // Set the foreground color of the tabs
60 &.mat-#{$name} {
61 @include _label-focus-color($color);
62 @include _ink-bar-color($color);
63
64 // Override ink bar when background color is the same
65 &.mat-background-#{$name} {
66 > .mat-tab-header, > .mat-tab-link-container {
67 @include _ink-bar-color($color, default-contrast);
68 }
69 }
70 }
71 }
72
73 @each $name, $color in $theme-colors {
74 // Set background color of the tabs and override focus color
75 &.mat-background-#{$name} {
76 @include _label-focus-color($color);
77 @include _tabs-background($color);
78 }
79 }
80 }
81}
82
83@mixin _ink-bar-color($color, $hue: default) {
84 .mat-ink-bar {
85 background-color: theming.get-color-from-palette($color, $hue);
86 }
87}
88
89@mixin _label-focus-color($tab-focus-color) {
90 .mat-tab-label,
91 .mat-tab-link {
92 &.cdk-keyboard-focused,
93 &.cdk-program-focused {
94 &:not(.mat-tab-disabled) {
95 background-color: theming.get-color-from-palette($tab-focus-color, lighter, 0.3);
96 }
97 }
98 }
99}
100
101@mixin _tabs-background($background-color) {
102 // Note that these selectors target direct descendants so
103 // that the styles don't apply to any nested tab groups.
104
105 // Set background color for the tab group
106 > .mat-tab-header, > .mat-tab-link-container, > .mat-tab-header-pagination {
107 background-color: theming.get-color-from-palette($background-color);
108 }
109
110 // Set labels to contrast against background
111 > .mat-tab-header .mat-tab-label, > .mat-tab-link-container .mat-tab-link {
112 color: theming.get-color-from-palette($background-color, default-contrast);
113
114 &.mat-tab-disabled {
115 color: theming.get-color-from-palette($background-color, default-contrast, 0.4);
116 }
117 }
118
119 // Set pagination chevrons to contrast background
120 > .mat-tab-header .mat-tab-header-pagination-chevron,
121 > .mat-tab-header-pagination .mat-tab-header-pagination-chevron,
122 > .mat-tab-link-container .mat-focus-indicator::before,
123 > .mat-tab-header .mat-focus-indicator::before {
124 border-color: theming.get-color-from-palette($background-color, default-contrast);
125 }
126
127 > .mat-tab-header .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron,
128 > .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron {
129 // Set the color opacity via `opacity`, rather than `rgba`, because it may be a CSS variable.
130 border-color: theming.get-color-from-palette($background-color, default-contrast, 1);
131 opacity: 0.4;
132 }
133
134 // Set ripples color to be the contrast color of the new background. Otherwise the ripple
135 // color will be based on the app background color.
136 > .mat-tab-header .mat-ripple-element,
137 > .mat-tab-link-container .mat-ripple-element,
138 > .mat-tab-header-pagination .mat-ripple-element {
139 // Set the color opacity via `opacity`, rather than `rgba`, because it may be a CSS variable.
140 background-color: theming.get-color-from-palette($background-color, default-contrast, 1);
141 opacity: 0.12;
142 }
143}
144
145@mixin typography($config-or-theme) {
146 $config: typography.private-typography-to-2014-config(
147 theming.get-typography-config($config-or-theme));
148 .mat-tab-group {
149 font-family: typography-utils.font-family($config);
150 }
151
152 .mat-tab-label, .mat-tab-link {
153 font: {
154 family: typography-utils.font-family($config, button);
155 size: typography-utils.font-size($config, button);
156 weight: typography-utils.font-weight($config, button);
157 }
158 }
159}
160
161@mixin _density($config-or-theme) {}
162
163@mixin theme($theme-or-color-config) {
164 $theme: theming.private-legacy-get-theme($theme-or-color-config);
165 @include theming.private-check-duplicate-theme-styles($theme, 'mat-tabs') {
166 $color: theming.get-color-config($theme);
167 $density: theming.get-density-config($theme);
168 $typography: theming.get-typography-config($theme);
169
170 @if $color != null {
171 @include color($color);
172 }
173 @if $density != null {
174 @include _density($density);
175 }
176 @if $typography != null {
177 @include typography($typography);
178 }
179 }
180}
Note: See TracBrowser for help on using the repository browser.