|
1 | 1 | @use 'sass:map'; |
| 2 | +@use 'sass:meta'; |
2 | 3 | @use '@angular/cdk'; |
3 | 4 | @use '../style/layout-common'; |
| 5 | +@use '../theming/theming'; |
4 | 6 |
|
5 | 7 | // Private sass variables that will be used as reference throughout component stylesheets. |
6 | 8 | $default-border-width: 3px; |
@@ -84,3 +86,93 @@ $default-border-radius: 4px; |
84 | 86 | } |
85 | 87 | } |
86 | 88 | } |
| 89 | + |
| 90 | +@mixin strong-focus-indicators($config: ()) { |
| 91 | + // Default focus indicator config. |
| 92 | + $default-config: ( |
| 93 | + border-color: black, |
| 94 | + display: block, |
| 95 | + ); |
| 96 | + |
| 97 | + // Merge default config with user config. |
| 98 | + $config: map.merge($default-config, $config); |
| 99 | + |
| 100 | + @include customize-focus-indicators($config, 'mat'); |
| 101 | +} |
| 102 | + |
| 103 | +@mixin mdc-strong-focus-indicators($config: ()) { |
| 104 | + // Default focus indicator config. |
| 105 | + $default-config: ( |
| 106 | + border-color: black, |
| 107 | + display: block, |
| 108 | + ); |
| 109 | + |
| 110 | + // Merge default config with user config. |
| 111 | + $config: map.merge($default-config, $config); |
| 112 | + |
| 113 | + @include customize-focus-indicators($config, 'mat-mdc'); |
| 114 | +} |
| 115 | + |
| 116 | +@mixin strong-focus-indicators-color($config-or-theme-or-color) { |
| 117 | + @if meta.type-of($config-or-theme-or-color) == 'color' { |
| 118 | + @include customize-focus-indicators(( |
| 119 | + border-color: $config-or-theme-or-color |
| 120 | + ), 'mat'); |
| 121 | + } |
| 122 | + @else { |
| 123 | + $config: theming.get-color-config($config-or-theme-or-color); |
| 124 | + $border-color: theming.get-color-from-palette(map.get($config, primary)); |
| 125 | + @include customize-focus-indicators(( |
| 126 | + border-color: $border-color |
| 127 | + ), 'mat'); |
| 128 | + } |
| 129 | +} |
| 130 | + |
| 131 | +@mixin strong-focus-indicators-theme($theme-or-color-config-or-color) { |
| 132 | + @if meta.type-of($theme-or-color-config-or-color) == 'color' { |
| 133 | + @include customize-focus-indicators(( |
| 134 | + border-color: $theme-or-color-config-or-color |
| 135 | + ), 'mat'); |
| 136 | + } |
| 137 | + @else { |
| 138 | + $theme: theming.private-legacy-get-theme($theme-or-color-config-or-color); |
| 139 | + @include theming.private-check-duplicate-theme-styles($theme, 'mat-focus-indicators') { |
| 140 | + $color: theming.get-color-config($theme); |
| 141 | + @if $color != null { |
| 142 | + @include strong-focus-indicators-color($color); |
| 143 | + } |
| 144 | + } |
| 145 | + } |
| 146 | +} |
| 147 | + |
| 148 | +@mixin mdc-strong-focus-indicators-color($config-or-theme-or-color) { |
| 149 | + @if meta.type-of($config-or-theme-or-color) == 'color' { |
| 150 | + @include customize-focus-indicators(( |
| 151 | + border-color: $config-or-theme-or-color |
| 152 | + ), 'mat-mdc'); |
| 153 | + } |
| 154 | + @else { |
| 155 | + $config: theming.get-color-config($config-or-theme-or-color); |
| 156 | + $border-color: theming.get-color-from-palette(map.get($config, primary)); |
| 157 | + @include customize-focus-indicators(( |
| 158 | + border-color: $border-color |
| 159 | + ), 'mat-mdc'); |
| 160 | + } |
| 161 | +} |
| 162 | + |
| 163 | +@mixin mdc-strong-focus-indicators-theme($theme-or-color-config-or-color) { |
| 164 | + @if meta.type-of($theme-or-color-config-or-color) == 'color' { |
| 165 | + @include customize-focus-indicators(( |
| 166 | + border-color: $theme-or-color-config-or-color |
| 167 | + ), 'mat-mdc'); |
| 168 | + } |
| 169 | + @else { |
| 170 | + $theme: theming.private-legacy-get-theme($theme-or-color-config-or-color); |
| 171 | + @include theming.private-check-duplicate-theme-styles($theme, 'mat-mdc-focus-indicators') { |
| 172 | + $color: theming.get-color-config($theme); |
| 173 | + @if $color != null { |
| 174 | + @include mdc-strong-focus-indicators-color($color); |
| 175 | + } |
| 176 | + } |
| 177 | + } |
| 178 | +} |
0 commit comments