1 | @use 'sass:map';
|
2 | @use '../core/density/private/compatibility';
|
3 | @use '../core/style/variables';
|
4 | @use '../core/theming/theming';
|
5 | @use '../core/typography/typography';
|
6 | @use '../core/typography/typography-utils';
|
7 | @use './toolbar-variables';
|
8 |
|
9 | @mixin _height($height) {
|
10 | .mat-toolbar-multiple-rows {
|
11 | min-height: $height;
|
12 | }
|
13 | .mat-toolbar-row, .mat-toolbar-single-row {
|
14 | height: $height;
|
15 | }
|
16 | }
|
17 |
|
18 | @mixin _palette-styles($palette) {
|
19 | background: theming.get-color-from-palette($palette);
|
20 | color: theming.get-color-from-palette($palette, default-contrast);
|
21 | }
|
22 |
|
23 | @mixin _form-field-overrides {
|
24 | .mat-form-field-underline,
|
25 | .mat-form-field-ripple,
|
26 | .mat-focused .mat-form-field-ripple {
|
27 | background-color: currentColor;
|
28 | }
|
29 |
|
30 | .mat-form-field-label,
|
31 | .mat-focused .mat-form-field-label,
|
32 | .mat-select-value,
|
33 | .mat-select-arrow,
|
34 | .mat-form-field.mat-focused .mat-select-arrow {
|
35 | color: inherit;
|
36 | }
|
37 |
|
38 | .mat-input-element {
|
39 | caret-color: currentColor;
|
40 | }
|
41 | }
|
42 |
|
43 | @mixin color($config-or-theme) {
|
44 | $config: theming.get-color-config($config-or-theme);
|
45 | $primary: map.get($config, primary);
|
46 | $accent: map.get($config, accent);
|
47 | $warn: map.get($config, warn);
|
48 | $background: map.get($config, background);
|
49 | $foreground: map.get($config, foreground);
|
50 |
|
51 | .mat-toolbar {
|
52 | background: theming.get-color-from-palette($background, app-bar);
|
53 | color: theming.get-color-from-palette($foreground, text);
|
54 |
|
55 | &.mat-primary {
|
56 | @include _palette-styles($primary);
|
57 | }
|
58 |
|
59 | &.mat-accent {
|
60 | @include _palette-styles($accent);
|
61 | }
|
62 |
|
63 | &.mat-warn {
|
64 | @include _palette-styles($warn);
|
65 | }
|
66 |
|
67 | @include _form-field-overrides;
|
68 | }
|
69 | }
|
70 |
|
71 | @mixin typography($config-or-theme) {
|
72 | $config: typography.private-typography-to-2014-config(
|
73 | theming.get-typography-config($config-or-theme));
|
74 | .mat-toolbar,
|
75 | .mat-toolbar h1,
|
76 | .mat-toolbar h2,
|
77 | .mat-toolbar h3,
|
78 | .mat-toolbar h4,
|
79 | .mat-toolbar h5,
|
80 | .mat-toolbar h6 {
|
81 | @include typography-utils.typography-level($config, title);
|
82 | margin: 0;
|
83 | }
|
84 | }
|
85 |
|
86 | @mixin density($config-or-theme) {
|
87 | $density-scale: theming.get-density-config($config-or-theme);
|
88 | $height-desktop: compatibility.private-density-prop-value(
|
89 | toolbar-variables.$desktop-density-config, $density-scale, height);
|
90 | $height-mobile: compatibility.private-density-prop-value(
|
91 | toolbar-variables.$mobile-density-config, $density-scale, height);
|
92 |
|
93 | @include compatibility.private-density-legacy-compatibility() {
|
94 |
|
95 | @include _height($height-desktop);
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | @media (variables.$xsmall) {
|
101 | @include _height($height-mobile);
|
102 | }
|
103 | }
|
104 | }
|
105 |
|
106 | @mixin theme($theme-or-color-config) {
|
107 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
108 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-toolbar') {
|
109 | $color: theming.get-color-config($theme);
|
110 | $density: theming.get-density-config($theme);
|
111 | $typography: theming.get-typography-config($theme);
|
112 |
|
113 | @if $color != null {
|
114 | @include color($color);
|
115 | }
|
116 | @if $density != null {
|
117 | @include density($density);
|
118 | }
|
119 | @if $typography != null {
|
120 | @include typography($typography);
|
121 | }
|
122 | }
|
123 | }
|