1 | @use 'sass:map';
|
2 | @use '../core/theming/theming';
|
3 | @use '../core/typography/typography';
|
4 | @use '../core/typography/typography-utils';
|
5 |
|
6 |
|
7 | @mixin color($config-or-theme) {
|
8 | $config: theming.get-color-config($config-or-theme);
|
9 | $is-dark-theme: map.get($config, is-dark);
|
10 | $primary: map.get($config, primary);
|
11 | $accent: map.get($config, accent);
|
12 | $warn: map.get($config, warn);
|
13 | $background: map.get($config, background);
|
14 | $foreground: map.get($config, foreground);
|
15 |
|
16 |
|
17 |
|
18 | $checkbox-mark-color: theming.get-color-from-palette($background, background);
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | $white-30pct-opacity-on-dark: #686868;
|
24 | $black-26pct-opacity-on-light: #b0b0b0;
|
25 | $disabled-color: if($is-dark-theme, $white-30pct-opacity-on-dark, $black-26pct-opacity-on-light);
|
26 |
|
27 | .mat-checkbox-frame {
|
28 | border-color: theming.get-color-from-palette($foreground, secondary-text);
|
29 | }
|
30 |
|
31 | .mat-checkbox-checkmark {
|
32 | fill: $checkbox-mark-color;
|
33 | }
|
34 |
|
35 | .mat-checkbox-checkmark-path {
|
36 |
|
37 |
|
38 | stroke: $checkbox-mark-color !important;
|
39 | }
|
40 |
|
41 | .mat-checkbox-mixedmark {
|
42 | background-color: $checkbox-mark-color;
|
43 | }
|
44 |
|
45 | .mat-checkbox-indeterminate, .mat-checkbox-checked {
|
46 | &.mat-primary .mat-checkbox-background {
|
47 | background-color: theming.get-color-from-palette($primary);
|
48 | }
|
49 |
|
50 | &.mat-accent .mat-checkbox-background {
|
51 | background-color: theming.get-color-from-palette($accent);
|
52 | }
|
53 |
|
54 | &.mat-warn .mat-checkbox-background {
|
55 | background-color: theming.get-color-from-palette($warn);
|
56 | }
|
57 | }
|
58 |
|
59 | .mat-checkbox-disabled {
|
60 | &.mat-checkbox-checked,
|
61 | &.mat-checkbox-indeterminate {
|
62 | .mat-checkbox-background {
|
63 | background-color: $disabled-color;
|
64 | }
|
65 | }
|
66 |
|
67 | &:not(.mat-checkbox-checked) {
|
68 | .mat-checkbox-frame {
|
69 | border-color: $disabled-color;
|
70 | }
|
71 | }
|
72 |
|
73 | .mat-checkbox-label {
|
74 | color: theming.get-color-from-palette($foreground, disabled);
|
75 | }
|
76 | }
|
77 |
|
78 |
|
79 |
|
80 | .mat-checkbox .mat-ripple-element {
|
81 | background-color: map.get(map.get($config, foreground), base);
|
82 | }
|
83 |
|
84 | .mat-checkbox-checked:not(.mat-checkbox-disabled),
|
85 | .mat-checkbox:active:not(.mat-checkbox-disabled) {
|
86 | &.mat-primary .mat-ripple-element {
|
87 | background: theming.get-color-from-palette($primary);
|
88 | }
|
89 |
|
90 | &.mat-accent .mat-ripple-element {
|
91 | background: theming.get-color-from-palette($accent);
|
92 | }
|
93 |
|
94 | &.mat-warn .mat-ripple-element {
|
95 | background: theming.get-color-from-palette($warn);
|
96 | }
|
97 | }
|
98 | }
|
99 |
|
100 | @mixin typography($config-or-theme) {
|
101 | $config: typography.private-typography-to-2014-config(
|
102 | theming.get-typography-config($config-or-theme));
|
103 | .mat-checkbox {
|
104 | font-family: typography-utils.font-family($config);
|
105 | }
|
106 |
|
107 |
|
108 | .mat-checkbox-layout .mat-checkbox-label {
|
109 | line-height: typography-utils.line-height($config, body-2);
|
110 | }
|
111 | }
|
112 |
|
113 | @mixin _density($config-or-theme) {}
|
114 |
|
115 | @mixin theme($theme-or-color-config) {
|
116 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
117 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-checkbox') {
|
118 | $color: theming.get-color-config($theme);
|
119 | $density: theming.get-density-config($theme);
|
120 | $typography: theming.get-typography-config($theme);
|
121 |
|
122 | @if $color != null {
|
123 | @include color($color);
|
124 | }
|
125 | @if $density != null {
|
126 | @include _density($density);
|
127 | }
|
128 | @if $typography != null {
|
129 | @include typography($typography);
|
130 | }
|
131 | }
|
132 | }
|