|
190 | 190 | );
|
191 | 191 | }
|
192 | 192 |
|
| 193 | +/// Generates custom tokens for the mat-chip. |
| 194 | +/// @param {Map} $systems The MDC system tokens |
| 195 | +/// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values |
| 196 | +/// @return {Map} A set of custom tokens for the mat-chip |
| 197 | +@function chip($systems, $exclude-hardcoded) { |
| 198 | + @return (( |
| 199 | + disabled-container-opacity: _hardcode(1, $exclude-hardcoded), |
| 200 | + selected-trailing-icon-color: map.get($systems, md-sys-color, on-secondary-container), |
| 201 | + selected-disabled-trailing-icon-color: map.get($systems, md-sys-color, on-surface), |
| 202 | + trailing-action-state-layer-color: map.get($systems, md-sys-color, on-surface-variant), |
| 203 | + selected-trailing-action-state-layer-color: |
| 204 | + map.get($systems, md-sys-color, on-secondary-container), |
| 205 | + trailing-action-hover-state-layer-opacity: |
| 206 | + map.get($systems, md-sys-state, hover-state-layer-opacity), |
| 207 | + trailing-action-focus-state-layer-opacity: |
| 208 | + map.get($systems, md-sys-state, focus-state-layer-opacity), |
| 209 | + ), ( |
| 210 | + primary: ( |
| 211 | + selected-trailing-icon-color: map.get($systems, md-sys-color, on-primary-container), |
| 212 | + selected-trailing-action-state-layer-color: |
| 213 | + map.get($systems, md-sys-color, on-primary-container), |
| 214 | + ), |
| 215 | + secondary: (), // Default, no overrides needed. |
| 216 | + tertiary: ( |
| 217 | + selected-trailing-icon-color: map.get($systems, md-sys-color, on-tertiary-container), |
| 218 | + selected-trailing-action-state-layer-color: |
| 219 | + map.get($systems, md-sys-color, on-tertiary-container), |
| 220 | + ), |
| 221 | + error: ( |
| 222 | + selected-trailing-icon-color: map.get($systems, md-sys-color, on-error-container), |
| 223 | + selected-trailing-action-state-layer-color: |
| 224 | + map.get($systems, md-sys-color, on-error-container), |
| 225 | + ), |
| 226 | + )); |
| 227 | +} |
| 228 | + |
193 | 229 | /// Generates custom tokens for the mdc-chip. (MDC has a chip component, but they
|
194 | 230 | /// seem to have made up the tokens rather than using ones generated from the token database,
|
195 | 231 | /// therefore we need a custom token function for it).
|
196 | 232 | /// @param {Map} $systems The MDC system tokens
|
197 | 233 | /// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
|
198 | 234 | /// @return {Map} A set of custom tokens for the mdc-chip
|
199 |
| -@function chip($systems, $exclude-hardcoded) { |
| 235 | +@function mdc-chip($systems, $exclude-hardcoded) { |
200 | 236 | @return (mat.private-merge-all(
|
201 | 237 | _generate-typography-tokens($systems, label-text, label-large),
|
202 | 238 | (
|
|
212 | 248 | ),
|
213 | 249 | with-icon-icon-size: _hardcode(18px, $exclude-hardcoded),
|
214 | 250 | with-icon-icon-color: map.get($systems, md-sys-color, on-surface-variant),
|
215 |
| - with-icon-disabled-icon-color: mat.private-safe-color-change( |
216 |
| - map.get($systems, md-sys-color, on-surface), |
217 |
| - $alpha: 0.38, |
218 |
| - ), |
| 251 | + with-icon-disabled-icon-color: map.get($systems, md-sys-color, on-surface), |
219 | 252 | with-icon-selected-icon-color: map.get($systems, md-sys-color, on-secondary-container),
|
220 | 253 | with-trailing-icon-trailing-icon-color: map.get($systems, md-sys-color, on-surface-variant),
|
221 |
| - with-trailing-icon-disabled-trailing-icon-color: mat.private-safe-color-change( |
222 |
| - map.get($systems, md-sys-color, on-surface), |
223 |
| - $alpha: 0.38, |
224 |
| - ), |
| 254 | + with-trailing-icon-disabled-trailing-icon-color: map.get($systems, md-sys-color, on-surface), |
225 | 255 | focus-state-layer-opacity: map.get($systems, md-sys-state, focus-state-layer-opacity),
|
226 | 256 | focus-state-layer-color: map.get($systems, md-sys-color, on-surface-variant),
|
227 | 257 | outline-width: _hardcode(1px, $exclude-hardcoded),
|
|
234 | 264 | hover-state-layer-color: map.get($systems, md-sys-color, on-surface-variant),
|
235 | 265 | hover-state-layer-opacity: map.get($systems, md-sys-state, hover-state-layer-opacity),
|
236 | 266 | with-avatar-disabled-avatar-opacity: _hardcode(0.38, $exclude-hardcoded),
|
| 267 | + elevated-selected-container-color: map.get($systems, md-sys-color, secondary-container), |
| 268 | + flat-selected-outline-width: _hardcode(0, $exclude-hardcoded), |
| 269 | + selected-label-text-color: map.get($systems, md-sys-color, on-secondary-container), |
| 270 | + flat-disabled-selected-container-color: mat.private-safe-color-change( |
| 271 | + map.get($systems, md-sys-color, on-surface), |
| 272 | + $alpha: 0.12, |
| 273 | + ), |
| 274 | + selected-hover-state-layer-color: map.get($systems, md-sys-color, on-secondary-container), |
| 275 | + selected-hover-state-layer-opacity: |
| 276 | + map.get($systems, md-sys-state, hover-state-layer-opacity), |
| 277 | + selected-focus-state-layer-color: map.get($systems, md-sys-color, on-secondary-container), |
| 278 | + selected-focus-state-layer-opacity: |
| 279 | + map.get($systems, md-sys-state, focus-state-layer-opacity), |
| 280 | + with-icon-disabled-icon-opacity: _hardcode(0.38, $exclude-hardcoded), |
237 | 281 | ),
|
238 | 282 | ), (
|
239 | 283 | // Color variants:
|
240 | 284 | primary: (
|
241 | 285 | with-icon-selected-icon-color: map.get($systems, md-sys-color, on-primary-container),
|
| 286 | + elevated-selected-container-color: map.get($systems, md-sys-color, primary-container), |
| 287 | + selected-label-text-color: map.get($systems, md-sys-color, on-primary-container), |
| 288 | + selected-hover-state-layer-color: map.get($systems, md-sys-color, on-primary-container), |
| 289 | + selected-focus-state-layer-color: map.get($systems, md-sys-color, on-primary-container), |
242 | 290 | ),
|
243 | 291 | secondary: (), // Default, no overrides needed.
|
244 | 292 | tertiary: (
|
245 | 293 | with-icon-selected-icon-color: map.get($systems, md-sys-color, on-tertiary-container),
|
| 294 | + elevated-selected-container-color: map.get($systems, md-sys-color, tertiary-container), |
| 295 | + selected-label-text-color: map.get($systems, md-sys-color, on-tertiary-container), |
| 296 | + selected-hover-state-layer-color: map.get($systems, md-sys-color, on-tertiary-container), |
| 297 | + selected-focus-state-layer-color: map.get($systems, md-sys-color, on-tertiary-container), |
246 | 298 | ),
|
247 | 299 | error: (
|
248 | 300 | with-icon-selected-icon-color: map.get($systems, md-sys-color, on-error-container),
|
| 301 | + elevated-selected-container-color: map.get($systems, md-sys-color, error-container), |
| 302 | + selected-label-text-color: map.get($systems, md-sys-color, on-error-container), |
| 303 | + selected-hover-state-layer-color: map.get($systems, md-sys-color, on-error-container), |
| 304 | + selected-focus-state-layer-color: map.get($systems, md-sys-color, on-error-container), |
249 | 305 | )
|
250 | 306 | ));
|
251 | 307 | }
|
|
0 commit comments