source: trip-planner-front/node_modules/@angular/material/input/_input-theme.scss@ eed0bf8

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

initial commit

  • Property mode set to 100644
File size: 3.3 KB
Line 
1@use 'sass:map';
2@use '../core/theming/palette';
3@use '../core/theming/theming';
4@use '../core/style/private';
5@use '../core/style/form-common';
6@use '../core/typography/typography';
7@use '../core/typography/typography-utils';
8@use '../core/style/vendor-prefixes';
9
10
11@mixin color($config-or-theme) {
12 $config: theming.get-color-config($config-or-theme);
13 $primary: map.get($config, primary);
14 $accent: map.get($config, accent);
15 $warn: map.get($config, warn);
16 $foreground: map.get($config, foreground);
17
18 .mat-form-field-type-mat-native-select .mat-form-field-infix::after {
19 color: theming.get-color-from-palette($foreground, secondary-text);
20 }
21
22 .mat-input-element:disabled,
23 .mat-form-field-type-mat-native-select.mat-form-field-disabled .mat-form-field-infix::after {
24 color: theming.get-color-from-palette($foreground, disabled-text);
25 }
26
27 .mat-input-element {
28 caret-color: theming.get-color-from-palette($primary, text);
29
30 @include vendor-prefixes.input-placeholder {
31 color: form-common.private-control-placeholder-color($config);
32 }
33
34 // On dark themes we set the native `select` color to some shade of white,
35 // however the color propagates to all of the `option` elements, which are
36 // always on a white background inside the dropdown, causing them to blend in.
37 // Since we can't change background of the dropdown, we need to explicitly
38 // reset the color of the options to something dark.
39 @if (map.get($config, is-dark)) {
40 option {
41 color: palette.$dark-primary-text;
42 }
43
44 option:disabled {
45 color: palette.$dark-disabled-text;
46 }
47 }
48 }
49
50 .mat-form-field.mat-accent .mat-input-element {
51 caret-color: theming.get-color-from-palette($accent, text);
52 }
53
54 .mat-form-field.mat-warn .mat-input-element,
55 .mat-form-field-invalid .mat-input-element {
56 caret-color: theming.get-color-from-palette($warn, text);
57 }
58
59 .mat-form-field-type-mat-native-select.mat-form-field-invalid .mat-form-field-infix::after {
60 color: theming.get-color-from-palette($warn, text);
61 }
62}
63
64@mixin typography($config-or-theme) {
65 $config: typography.private-typography-to-2014-config(
66 theming.get-typography-config($config-or-theme));
67 // The unit-less line-height from the font config.
68 $line-height: typography-utils.line-height($config, input);
69
70 // The amount of space between the top of the line and the top of the actual text
71 // (as a fraction of the font-size).
72 $line-spacing: private.private-div($line-height - 1, 2);
73
74 // <input> elements seem to have their height set slightly too large on Safari causing the text to
75 // be misaligned w.r.t. the placeholder. Adding this margin corrects it.
76 input.mat-input-element {
77 margin-top: typography-utils.private-coerce-unitless-to-em(-$line-spacing);
78 }
79}
80
81@mixin _density($config-or-theme) {}
82
83@mixin theme($theme-or-color-config) {
84 $theme: theming.private-legacy-get-theme($theme-or-color-config);
85 @include theming.private-check-duplicate-theme-styles($theme, 'mat-input') {
86 $color: theming.get-color-config($theme);
87 $density: theming.get-density-config($theme);
88 $typography: theming.get-typography-config($theme);
89
90 @if $color != null {
91 @include color($color);
92 }
93 @if $density != null {
94 @include _density($density);
95 }
96 @if $typography != null {
97 @include typography($typography);
98 }
99 }
100}
Note: See TracBrowser for help on using the repository browser.