|
57 | 57 | }
|
58 | 58 | }
|
59 | 59 |
|
60 |
| -@mixin mat-private-button-ripple($prefix, $slots) { |
61 |
| - @include token-utils.use-tokens($prefix, $slots) { |
62 |
| - .mat-ripple-element { |
63 |
| - background-color: token-utils.slot(ripple-color); |
64 |
| - } |
| 60 | +@mixin mat-private-button-ripple( |
| 61 | + $ripple-color-token, $state-layer-color-token, $disabled-state-layer-color-token, |
| 62 | + $hover-state-layer-opacity-token, $focus-state-layer-opacity-token, |
| 63 | + $pressed-state-layer-opacity-token |
| 64 | +) { |
| 65 | + .mat-ripple-element { |
| 66 | + background-color: token-utils.slot($ripple-color-token); |
| 67 | + } |
65 | 68 |
|
66 |
| - .mat-mdc-button-persistent-ripple::before { |
67 |
| - background-color: token-utils.slot(state-layer-color); |
68 |
| - } |
| 69 | + .mat-mdc-button-persistent-ripple::before { |
| 70 | + background-color: token-utils.slot($state-layer-color-token); |
| 71 | + } |
69 | 72 |
|
70 |
| - &.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before { |
71 |
| - background-color: token-utils.slot(disabled-state-layer-color); |
72 |
| - } |
| 73 | + &.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before { |
| 74 | + background-color: token-utils.slot($disabled-state-layer-color-token); |
| 75 | + } |
73 | 76 |
|
74 |
| - &:hover > .mat-mdc-button-persistent-ripple::before { |
75 |
| - opacity: token-utils.slot(hover-state-layer-opacity); |
76 |
| - } |
| 77 | + &:hover > .mat-mdc-button-persistent-ripple::before { |
| 78 | + opacity: token-utils.slot($hover-state-layer-opacity-token); |
| 79 | + } |
77 | 80 |
|
78 |
| - &.cdk-program-focused, |
79 |
| - &.cdk-keyboard-focused, |
80 |
| - &.mat-mdc-button-disabled-interactive:focus { |
81 |
| - > .mat-mdc-button-persistent-ripple::before { |
82 |
| - opacity: token-utils.slot(focus-state-layer-opacity); |
83 |
| - } |
| 81 | + &.cdk-program-focused, |
| 82 | + &.cdk-keyboard-focused, |
| 83 | + &.mat-mdc-button-disabled-interactive:focus { |
| 84 | + > .mat-mdc-button-persistent-ripple::before { |
| 85 | + opacity: token-utils.slot($focus-state-layer-opacity-token); |
84 | 86 | }
|
| 87 | + } |
85 | 88 |
|
86 |
| - &:active > .mat-mdc-button-persistent-ripple::before { |
87 |
| - opacity: token-utils.slot(pressed-state-layer-opacity); |
88 |
| - } |
| 89 | + &:active > .mat-mdc-button-persistent-ripple::before { |
| 90 | + opacity: token-utils.slot($pressed-state-layer-opacity-token); |
89 | 91 | }
|
90 | 92 | }
|
91 | 93 |
|
|
109 | 111 | }
|
110 | 112 | }
|
111 | 113 |
|
112 |
| -// Adds an elevation shadow to a button. |
113 |
| -@mixin mat-private-button-elevation($token-name) { |
114 |
| - // MDC outputs a variable that is the same as the token name, but suffixed with `-shadow`. |
115 |
| - box-shadow: token-utils.slot($token-name + '-shadow'); |
116 |
| -} |
117 |
| - |
118 |
| -@mixin mat-private-button-touch-target($is-square, $prefix, $slots) { |
| 114 | +@mixin mat-private-button-touch-target($is-square, $touch-target-display-token) { |
119 | 115 | .mat-mdc-button-touch-target {
|
120 | 116 | position: absolute;
|
121 | 117 | top: 50%;
|
122 | 118 | height: 48px;
|
| 119 | + display: token-utils.slot($touch-target-display-token); |
123 | 120 |
|
124 | 121 | @if $is-square {
|
125 | 122 | left: 50%;
|
|
130 | 127 | right: 0;
|
131 | 128 | transform: translateY(-50%);
|
132 | 129 | }
|
133 |
| - |
134 |
| - @include token-utils.use-tokens($prefix, $slots) { |
135 |
| - display: token-utils.slot(touch-target-display); |
136 |
| - } |
137 | 130 | }
|
138 | 131 | }
|
139 | 132 |
|
140 |
| -@mixin mat-private-button-horizontal-layout($prefix, $slots, $has-with-icon-padding) { |
141 |
| - @include token-utils.use-tokens($prefix, $slots) { |
142 |
| - $icon-spacing: token-utils.slot(icon-spacing, true); |
143 |
| - $icon-offset: token-utils.slot(icon-offset, true); |
144 |
| - |
145 |
| - @if ($has-with-icon-padding) { |
146 |
| - $with-icon-horizontal-padding: |
147 |
| - token-utils.slot(with-icon-horizontal-padding, true); |
148 |
| - |
149 |
| - // stylelint-disable-next-line selector-class-pattern |
150 |
| - &:has(.material-icons, mat-icon, [matButtonIcon]) { |
151 |
| - padding: 0 $with-icon-horizontal-padding; |
152 |
| - } |
153 |
| - } |
154 |
| - |
155 |
| - // MDC expects button icons to contain this HTML content: |
156 |
| - // ```html |
157 |
| - // <span class="mdc-button__icon material-icons">favorite</span> |
158 |
| - // ``` |
159 |
| - // However, Angular Material expects a `mat-icon` instead. The following |
160 |
| - // styles will lay out the icons appropriately. |
161 |
| - & > .mat-icon { |
162 |
| - margin-right: $icon-spacing; |
163 |
| - margin-left: $icon-offset; |
| 133 | +@mixin mat-private-button-horizontal-layout( |
| 134 | + $icon-spacing-token, $icon-offset-token, $with-icon-horizontal-padding-token: null) { |
| 135 | + $icon-spacing: token-utils.slot($icon-spacing-token, true); |
| 136 | + $icon-offset: token-utils.slot($icon-offset-token, true); |
164 | 137 |
|
165 |
| - [dir='rtl'] & { |
166 |
| - margin-right: $icon-offset; |
167 |
| - margin-left: $icon-spacing; |
168 |
| - } |
| 138 | + @if ($with-icon-horizontal-padding-token) { |
| 139 | + // stylelint-disable-next-line selector-class-pattern |
| 140 | + &:has(.material-icons, mat-icon, [matButtonIcon]) { |
| 141 | + padding: 0 token-utils.slot($with-icon-horizontal-padding-token, true); |
169 | 142 | }
|
| 143 | + } |
170 | 144 |
|
171 |
| - .mdc-button__label + .mat-icon { |
| 145 | + // MDC expects button icons to contain this HTML content: |
| 146 | + // ```html |
| 147 | + // <span class="mdc-button__icon material-icons">favorite</span> |
| 148 | + // ``` |
| 149 | + // However, Angular Material expects a `mat-icon` instead. The following |
| 150 | + // styles will lay out the icons appropriately. |
| 151 | + & > .mat-icon { |
| 152 | + margin-right: $icon-spacing; |
| 153 | + margin-left: $icon-offset; |
| 154 | + |
| 155 | + [dir='rtl'] & { |
172 | 156 | margin-right: $icon-offset;
|
173 | 157 | margin-left: $icon-spacing;
|
| 158 | + } |
| 159 | + } |
174 | 160 |
|
175 |
| - [dir='rtl'] & { |
176 |
| - margin-right: $icon-spacing; |
177 |
| - margin-left: $icon-offset; |
178 |
| - } |
| 161 | + .mdc-button__label + .mat-icon { |
| 162 | + margin-right: $icon-offset; |
| 163 | + margin-left: $icon-spacing; |
| 164 | + |
| 165 | + [dir='rtl'] & { |
| 166 | + margin-right: $icon-spacing; |
| 167 | + margin-left: $icon-offset; |
179 | 168 | }
|
180 | 169 | }
|
181 | 170 | }
|
0 commit comments