@use '../core/style/layout-common'; @use '../core/tokens/m2/mat/list' as tokens-mat-list; @use '../core/tokens/m2/mdc/list' as tokens-mdc-list; @use '../core/tokens/token-utils'; @use './list-item-hcm-indicator'; @use './list-inherited-structure'; @include list-inherited-structure.private-list-inherited-structural-styles; // Add additional slots for the MDC list tokens, needed in Angular Material. @include token-utils.use-tokens(tokens-mdc-list.$prefix, tokens-mdc-list.get-token-slots()) { // MDC allows focus and hover colors to take precedence over disabled color. We add the disabled // color here with higher specificity so that the disabled color takes precedence. // TODO(mmalerba): Dicuss with MDC whether to change this in their code. .mdc-list-item.mdc-list-item--disabled .mdc-list-item__primary-text { @include token-utils.create-token-slot(color, list-item-disabled-label-text-color); } // We don't use MDC's state layer since it's tied in with their ripple. Instead we emit slots // for our own state layer. // TODO(mmalerba): Consider using MDC's ripple & state layer. .mdc-list-item:hover::before { @include token-utils.create-token-slot(background-color, list-item-hover-state-layer-color); @include token-utils.create-token-slot(opacity, list-item-hover-state-layer-opacity); } .mdc-list-item.mdc-list-item--disabled::before { @include token-utils.create-token-slot(background-color, list-item-disabled-state-layer-color); @include token-utils.create-token-slot(opacity, list-item-disabled-state-layer-opacity); } .mdc-list-item:focus::before { @include token-utils.create-token-slot(background-color, list-item-focus-state-layer-color); @include token-utils.create-token-slot(opacity, list-item-focus-state-layer-opacity); } // Apply the disabled opacity to the checkbox/radio indicators. // TODO(mmalerba): We should probably stop doing this and allow the checkbox/radio to decide // what their disabled state looks like. This is done for now to avoid screenshot diffs. .mdc-list-item--disabled { .mdc-radio, .mdc-checkbox { @include token-utils.create-token-slot(opacity, list-item-disabled-label-text-opacity); } } // In Angular Material we put the avatar class directly on the .mdc-list-item__start element, // rather than nested inside it, so we need to emit avatar slots ourselves. // TODO(mmalerba): We should try to change MDC's recommended DOM or change ours to match their // recommendation. .mdc-list-item--with-leading-avatar .mat-mdc-list-item-avatar { @include token-utils.create-token-slot(border-radius, list-item-leading-avatar-shape); @include token-utils.create-token-slot(background-color, list-item-leading-avatar-color); } // Set font-size of leading icon to same value as its width and height. Ensure icon scales to // "list-item-leading-icon-size" token. In Angular Material, the icon is on the same element as // ".mdc-list-item__start", rather than a child of ".mdc-list-item__start". .mat-mdc-list-item-icon { @include token-utils.create-token-slot(font-size, list-item-leading-icon-size); } } a.mdc-list-item--activated { // Improve accessibility for Window High Contrast Mode (HCM) by adding an idicator on active // links. @include list-item-hcm-indicator.private-high-contrast-list-item-indicator(); } // MDC expects the list element to be a `