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

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

primeNG components

  • Property mode set to 100644
File size: 3.4 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 &:not(.mat-native-select-inline) {
41 option {
42 color: palette.$dark-primary-text;
43 }
44
45 option:disabled {
46 color: palette.$dark-disabled-text;
47 }
48 }
49 }
50 }
51
52 .mat-form-field.mat-accent .mat-input-element {
53 caret-color: theming.get-color-from-palette($accent, text);
54 }
55
56 .mat-form-field.mat-warn .mat-input-element,
57 .mat-form-field-invalid .mat-input-element {
58 caret-color: theming.get-color-from-palette($warn, text);
59 }
60
61 .mat-form-field-type-mat-native-select.mat-form-field-invalid .mat-form-field-infix::after {
62 color: theming.get-color-from-palette($warn, text);
63 }
64}
65
66@mixin typography($config-or-theme) {
67 $config: typography.private-typography-to-2014-config(
68 theming.get-typography-config($config-or-theme));
69 // The unit-less line-height from the font config.
70 $line-height: typography-utils.line-height($config, input);
71
72 // The amount of space between the top of the line and the top of the actual text
73 // (as a fraction of the font-size).
74 $line-spacing: private.private-div($line-height - 1, 2);
75
76 // <input> elements seem to have their height set slightly too large on Safari causing the text to
77 // be misaligned w.r.t. the placeholder. Adding this margin corrects it.
78 input.mat-input-element {
79 margin-top: typography-utils.private-coerce-unitless-to-em(-$line-spacing);
80 }
81}
82
83@mixin _density($config-or-theme) {}
84
85@mixin theme($theme-or-color-config) {
86 $theme: theming.private-legacy-get-theme($theme-or-color-config);
87 @include theming.private-check-duplicate-theme-styles($theme, 'mat-input') {
88 $color: theming.get-color-config($theme);
89 $density: theming.get-density-config($theme);
90 $typography: theming.get-typography-config($theme);
91
92 @if $color != null {
93 @include color($color);
94 }
95 @if $density != null {
96 @include _density($density);
97 }
98 @if $typography != null {
99 @include typography($typography);
100 }
101 }
102}
Note: See TracBrowser for help on using the repository browser.