:root {
--actionListContent-paddingBlock: var(--control-medium-paddingBlock, 6px);
}
/* ActionList */
/*
*/
.ActionListWrap {
list-style: none;
}
.ActionListWrap--inset {
padding: var(--base-size-8, 8px);
}
/* list dividers */
.ActionListWrap--divided {
& .ActionListItem-label::before {
position: absolute;
top: calc(-1 * var(--actionListContent-paddingBlock));
display: block;
width: 100%;
height: 1px;
content: '';
background: var(--color-action-list-item-inline-divider);
}
/* if descriptionWrap--inline exists, move pseudo divider to wrapper */
& .ActionListItem-descriptionWrap--inline {
&::before {
position: absolute;
top: calc(-1 * var(--actionListContent-paddingBlock));
display: block;
width: 100%;
height: var(--borderWidth-thin, 1px);
content: '';
background: var(--color-action-list-item-inline-divider);
}
/* unset the default label pseudo */
& .ActionListItem-label::before {
content: unset;
}
}
/* hide divider if item is active */
& .ActionListItem--navActive {
& .ActionListItem-label::before,
& + .ActionListItem .ActionListItem-label::before {
visibility: hidden;
}
}
}
/* hide if item is first of type with label::before, or is the first item after a sectionDivider */
.ActionListItem:first-of-type .ActionListItem-label::before,
.ActionList-sectionDivider + .ActionListItem .ActionListItem-label::before {
visibility: hidden;
}
/* hide if item is first of type with label::before, or is the first item after a sectionDivider */
.ActionListItem:first-of-type .ActionListItem-descriptionWrap--inline::before,
.ActionList-sectionDivider + .ActionListItem .ActionListItem-descriptionWrap--inline::before {
visibility: hidden;
}
/* ActionList::Item */
.ActionListItem {
position: relative;
list-style: none;
background-color: transparent;
border-radius: var(--borderRadius-medium, 6px);
/* state */
&:hover,
&:active {
cursor: pointer;
}
/* hide dividers */
@media (hover: hover) {
&:hover {
& .ActionListItem-label::before,
& + .ActionListItem .ActionListItem-label::before {
visibility: hidden;
}
& .ActionListItem-descriptionWrap--inline::before,
& + .ActionListItem .ActionListItem-descriptionWrap--inline::before {
visibility: hidden;
}
}
}
/* Make sure that the first visible item isn't a divider */
&[hidden] + .ActionList-sectionDivider {
display: none;
}
/* collapse styles here */
&.ActionListItem--hasSubItem {
/* first child */
& > .ActionListContent {
z-index: 1;
@media (hover: hover) {
&:hover {
background-color: var(--color-action-list-item-default-hover-bg);
}
}
&:active {
background-color: var(--color-action-list-item-default-active-bg);
}
}
}
/* only hover li without list as children */
&:not(.ActionListItem--hasSubItem),
/* target contents of first child li if sub-item (li wraps item label + nested ul) */
&.ActionListItem--hasSubItem > .ActionListContent {
@media (hover: hover) {
&:hover {
cursor: pointer;
background-color: var(--color-action-list-item-default-hover-bg);
&:not(.ActionListItem--navActive, :focus-visible) {
/* Support for "Windows high contrast mode" */
outline: solid var(--borderWidth-thin, 1px) transparent;
outline-offset: calc(-1 * var(--borderWidth-thin, 1px));
box-shadow: var(--borderInset-thin, 1px) var(--color-action-list-item-default-active-border);
}
}
}
&:active {
background: var(--color-action-list-item-default-active-bg);
&:not(.ActionListItem--navActive) {
/* Support for "Windows high contrast mode" https:sarahmhigley.com/writing/whcm-quick-tips/ */
outline: solid var(--borderWidth-thin, 1px) transparent;
outline-offset: calc(-1 * var(--borderWidth-thin, 1px));
box-shadow: var(--borderInset-thin, 1px) var(--color-action-list-item-default-active-border);
}
& .ActionListItem-label::before,
& + .ActionListItem .ActionListItem-label::before {
visibility: hidden;
}
}
}
/*
* checkbox item [aria-checked]
* listbox [aria-selected]
*/
&[aria-checked='true'],
&[aria-selected='true'] {
/* multiselect checkmark */
& .ActionListItem-multiSelectCheckmark {
visibility: visible;
opacity: 1;
transition: visibility 0 linear 0, opacity 50ms;
}
/* singleselect checkmark */
& .ActionListItem-singleSelectCheckmark {
visibility: visible;
@media screen and (prefers-reduced-motion: no-preference) {
animation: checkmarkIn 200ms cubic-bezier(0.11, 0, 0.5, 0) forwards;
@keyframes checkmarkIn {
from {
clip-path: inset(16px 0 0 0);
}
to {
clip-path: inset(0 0 0 0);
}
}
}
}
/* checkbox */
& .ActionListItem-multiSelectIcon {
& .ActionListItem-multiSelectIconRect {
fill: var(--color-accent-fg);
stroke: var(--color-accent-fg);
stroke-width: var(--borderWidth-thin, 1px);
}
& .ActionListItem-multiSelectCheckmark {
fill: var(--color-fg-on-emphasis);
}
}
}
&[aria-checked='false'],
&[aria-selected='false'] {
/* multiselect checkmark */
& .ActionListItem-multiSelectCheckmark {
visibility: hidden;
opacity: 0;
transition: visibility 0 linear 50ms, opacity 50ms;
}
/* singleselect checkmark */
& .ActionListItem-singleSelectCheckmark {
visibility: hidden;
transition: visibility 0s linear 200ms;
clip-path: inset(16px 0 0 0);
@media screen and (prefers-reduced-motion: no-preference) {
animation: checkmarkOut 200ms cubic-bezier(0.11, 0, 0.5, 0) forwards;
@keyframes checkmarkOut {
from {
clip-path: inset(0 0 0 0);
}
to {
clip-path: inset(16px 0 0 0);
}
}
}
}
/* checkbox */
& .ActionListItem-multiSelectIcon {
& .ActionListItem-multiSelectIconRect {
fill: var(--color-canvas-default);
stroke: var(--color-border-default);
stroke-width: var(--borderWidth-thin, 1px);
}
}
& .ActionListItem-multiSelectIconRect {
fill: var(--color-canvas-default);
border: var(--borderWidth-thin, 1px) solid var(--color-border-default);
}
}
/* Autocomplete [aria-selected] items */
&[aria-selected='true'] {
font-weight: var(--base-text-weight-normal, 400);
background: var(--color-action-list-item-default-selected-bg);
@media (hover: hover) {
&:hover {
background-color: var(--color-action-list-item-default-hover-bg);
}
}
&::before,
& + .ActionListItem::before {
visibility: hidden;
}
/* blue accent line */
&::after {
@mixin activeIndicatorLine calc(-1 * var(--base-size-4, 4px));
}
}
/* active state [aria-current] */
&.ActionListItem--navActive {
&:not(.ActionListItem--subItem) {
& .ActionListItem-label {
font-weight: var(--base-text-weight-semibold, 600);
}
}
&:not(.ActionListItem--danger) {
background: var(--color-action-list-item-default-selected-bg);
@media (hover: hover) {
&:hover {
background-color: var(--color-action-list-item-default-hover-bg);
}
}
&::before,
& + .ActionListItem::before {
visibility: hidden;
}
/* blue accent line */
&::after {
@mixin activeIndicatorLine;
}
}
}
/* disabled */
&.ActionListItem--disabled,
&[aria-disabled='true'] {
& .ActionListContent {
& .ActionListItem-label,
& .ActionListItem-description {
color: var(--color-primer-fg-disabled);
}
& .ActionListItem-visual {
fill: var(--color-primer-fg-disabled);
}
}
@media (hover: hover) {
&:hover {
cursor: not-allowed;
background-color: transparent;
}
}
}
/* variants */
/* danger */
&.ActionListItem--danger {
& .ActionListItem-label {
color: var(--color-danger-fg);
}
& .ActionListItem-visual {
color: var(--color-danger-fg);
}
@media (hover: hover) {
&:hover {
background: var(--color-action-list-item-danger-hover-bg);
& .ActionListItem-label,
& .ActionListItem-visual {
color: var(--color-action-list-item-danger-hover-text);
}
}
}
& .ActionListContent {
&:active {
background: var(--color-action-list-item-danger-active-bg);
& .ActionListItem-label,
& .ActionListItem-visual {
color: var(--color-action-list-item-danger-hover-text);
}
}
}
}
}
/* button or a href */
.ActionListContent {
position: relative;
display: grid;
width: 100%;
padding-block: var(--actionListContent-paddingBlock);
padding-inline: var(--control-medium-paddingInline-condensed, 8px);
color: var(--color-fg-default);
text-align: left;
user-select: none;
background-color: transparent;
border: none;
border-radius: var(--borderRadius-medium, 6px);
transition: background 33.333ms linear;
touch-action: manipulation;
-webkit-tap-highlight-color: transparent;
grid-template-rows: min-content;
grid-template-areas: 'leadingAction leadingVisual label trailingVisual trailingAction';
grid-template-columns: min-content min-content minmax(0, auto) min-content min-content;
align-items: start;
/* column-gap persists with empty grid-areas, margin applies only when children exist */
& > :not(:last-child) {
margin-right: var(--control-medium-gap, 8px);
}
/* state */
&:hover {
text-decoration: none;
}
/* disabled */
&[aria-disabled='true'] {
& .ActionListItem-label,
& .ActionListItem-description {
color: var(--color-primer-fg-disabled);
}
& .ActionListItem-visual {
fill: var(--color-primer-fg-disabled);
}
@media (hover: hover) {
&:hover {
cursor: not-allowed;
background-color: transparent;
}
}
}
/* collapsible item [aria-expanded] */
/* nesting (single level)
target items inside expanded subgroups */
&[aria-expanded] {
& + .ActionList--subGroup {
@media screen and (prefers-reduced-motion: no-preference) {
transition: opacity 160ms cubic-bezier(0.25, 1, 0.5, 1), transform 160ms cubic-bezier(0.25, 1, 0.5, 1);
}
& .ActionListContent {
padding-left: var(--base-size-24, 24px);
}
}
/* has 16px leading visual */
&.ActionListContent--visual16 + .ActionList--subGroup {
& .ActionListContent {
padding-left: var(--base-size-32, 32px);
}
}
/* has 20px leading visual */
&.ActionListContent--visual20 + .ActionList--subGroup {
& .ActionListContent {
padding-left: var(--base-size-36, 36px);
}
}
/* has 24px leading visual */
&.ActionListContent--visual24 + .ActionList--subGroup {
& .ActionListContent {
padding-left: var(--base-size-40, 40px);
}
}
}
&[aria-expanded='true'] {
& .ActionListItem-collapseIcon {
transition: transform 120ms linear;
transform: scaleY(-1);
}
& + .ActionList--subGroup {
height: auto;
overflow: visible;
visibility: visible;
opacity: 1;
transform: translateY(0);
}
&.ActionListContent--hasActiveSubItem {
& > .ActionListItem-label {
font-weight: var(--base-text-weight-semibold, 600);
}
}
}
&[aria-expanded='false'] {
& .ActionListItem-collapseIcon {
transition: transform 120ms linear;
transform: scaleY(1);
}
& + .ActionList--subGroup {
height: 0;
overflow: hidden;
visibility: hidden;
opacity: 0;
transform: translateY(calc(-1 * var(--base-size-16, 16px)));
}
/* show active indicator on parent collapse if child is active */
&.ActionListContent--hasActiveSubItem {
background: var(--color-action-list-item-default-selected-bg);
& .ActionListItem-label {
font-weight: var(--base-text-weight-semibold, 600);
}
&::before,
& + .ActionListItem::before {
visibility: hidden;
}
/* blue accent line */
&::after {
@mixin activeIndicatorLine;
}
}
}
/* sizes */
&.ActionListContent--sizeLarge {
--actionListContent-paddingBlock: var(--control-large-paddingBlock, calc((2.5rem - 1.25rem) / 2));
}
&.ActionListContent--sizeXLarge {
--actionListContent-paddingBlock: var(--control-xlarge-paddingBlock, calc((3rem - 1.25rem) / 2));
}
/* On pointer:coarse (mobile), all list items are large */
@media (pointer: coarse) {
--actionListContent-paddingBlock: var(--control-large-paddingBlock, calc((2.5rem - 1.25rem) / 2));
}
&.ActionListContent--blockDescription {
/* if leading/trailing visual, align with first line of content */
& .ActionListItem-visual {
place-self: start;
}
}
}
/* place children on grid */
.ActionListItem-action--leading {
grid-area: leadingAction;
}
.ActionListItem-visual--leading {
grid-area: leadingVisual;
}
.ActionListItem-visual--trailing {
grid-area: trailingVisual;
}
.ActionListItem-action--trailing {
grid-area: trailingAction;
}
/* wrapper span
default block */
.ActionListItem-descriptionWrap {
grid-area: label;
display: flex;
flex-direction: column;
gap: var(--base-size-4, 4px);
& .ActionListItem-label {
font-weight: var(--base-text-weight-semibold, 600);
}
}
/* inline */
.ActionListItem-descriptionWrap--inline {
position: relative;
flex-direction: row;
align-items: baseline;
gap: var(--base-size-8, 8px);
}
/* description */
.ActionListItem-description {
font-size: var(--text-body-size-small, 12px);
font-weight: var(--base-text-weight-normal, 400);
line-height: var(--text-body-lineHeight-small, calc(20 / 12));
color: var(--color-fg-muted);
}
/* helper for grid alignment with multi-line content
span wrapping svg or text */
.ActionListItem-visual,
.ActionListItem-action {
display: flex;
min-height: var(--control-medium-lineBoxHeight, 20px);
color: var(--color-fg-muted);
pointer-events: none;
fill: var(--color-fg-muted);
align-items: center;
}
/* text */
.ActionListItem-label {
position: relative;
font-size: var(--text-body-size-medium, 14px);
font-weight: var(--base-text-weight-normal, 400);
line-height: var(--text-body-lineHeight-medium, calc(20 / 14));
color: var(--color-fg-default);
grid-area: label;
}
.ActionListItem-label--truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* nested lists (only supports 1 level currently)
target ActionListItem--subItem for padding-left to maintain :active :after state */
.ActionListItem--subItem > .ActionListContent > .ActionListItem-label {
font-size: var(--text-body-size-small, 12px);
line-height: var(--text-body-lineHeight-small, calc(20 / 12));
}
/* trailing action icon button */
.ActionListItem--withActions {
display: flex;
flex-wrap: nowrap;
align-items: center;
}
.ActionListItem-trailingAction {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
/* show trailing action button on hover */
.ActionListItem--trailingActionHover {
& .ActionListItem-trailingAction {
visibility: hidden;
}
&:hover,
&:focus-within {
& .ActionListItem-trailingAction {
visibility: visible;
}
}
}
/* ActionList::Divider */
.ActionList-sectionDivider {
/* with children */
&:not(:empty) {
display: flex;
padding-inline: var(--actionListContent-paddingBlock);
padding-block: var(--base-size-8, 8px);
font-size: var(--text-body-size-small, 12px);
line-height: var(--text-body-lineHeight-small, calc(20 / 12));
font-weight: var(--base-text-weight-semibold, 600);
color: var(--color-fg-muted);
flex-direction: column;
}
/* no children */
&:empty {
display: block;
height: var(--borderWidth-thin, 1px);
padding: 0;
margin-block-start: calc(var(--base-size-8, 8px) - var(--borderWidth-thin, 1px));
margin-block-end: var(--base-size-8, 8px);
margin-inline: calc(-1 * var(--base-size-8, 8px));
list-style: none;
background: var(--color-action-list-item-inline-divider);
border: 0;
}
& .ActionList-sectionDivider-title {
font-size: var(--text-body-size-small, 12px);
font-weight: var(--base-text-weight-semibold, 600);
color: var(--color-fg-muted);
}
}
.ActionList-sectionDivider--filled {
margin-block-start: calc(var(--base-size-8, 8px) - var(--borderWidth-thin, 1px));
margin-block-end: var(--base-size-8, 8px);
margin-inline: calc(-1 * var(--base-size-8, 8px));
background: var(--color-canvas-subtle);
border-top: solid var(--borderWidth-thin, 1px) var(--color-action-list-item-inline-divider);
border-bottom: solid var(--borderWidth-thin, 1px) var(--color-action-list-item-inline-divider);
/* if no children, treat as divider */
&:empty {
height: var(--base-size-8, 8px);
box-sizing: border-box;
}
&:first-child {
margin-block-start: 0;
}
}