@use "@wordpress/base-styles/colors" as *;
@use "@wordpress/base-styles/mixins" as *;
@use "@wordpress/base-styles/variables" as *;
@use "../utils/theme-variables" as *;

.components-menu-item__button,
.components-menu-item__button.components-button {
	width: 100%;
	font-weight: $font-weight-regular;

	&[role="menuitemradio"],
	&[role="menuitemcheckbox"] {
		.components-menu-item__item:only-child {
			// Ensure unchecked items have clearance for consistency
			// with checked items containing an icon or shortcut.
			padding-right: $grid-unit-60;
			box-sizing: initial;
		}
	}

	.components-menu-items__item-icon {
		display: inline-block;
		flex: 0 0 auto;
		&.has-icon-right {
			margin-right: -2px; // This optically balances the icon.
			margin-left: $grid-unit-30;
		}
	}

	.components-menu-item__shortcut + .components-menu-items__item-icon.has-icon-right {
		margin-left: $grid-unit-10;
	}

	// If a block item is shown inline (such as transforms), space it correctly.
	.block-editor-block-icon {
		margin-left: -2px; // This optically balances the icon.
		margin-right: $grid-unit-10;
	}

	&.is-primary {
		justify-content: center;

		.components-menu-item__item {
			// Override the default right margin.
			margin-right: 0;
		}
	}

	&:disabled,
	&[aria-disabled="true"] {
		// Override the button component's tertiary background and color.
		&.is-tertiary {
			background: none;
			color: $components-color-accent-darker-10;
			opacity: 0.3;
		}
	}
}

.components-menu-item__info-wrapper {
	display: flex;
	flex-direction: column;
	margin-right: auto;
}

.components-menu-item__info {
	margin-top: $grid-unit-05;
	font-size: $helptext-font-size;
	color: $gray-700;
	white-space: normal;
}

.components-menu-item__item {
	// Provide a minimum width for text items in menus.
	white-space: nowrap;
	min-width: 160px;

	margin-right: auto;
	display: inline-flex;
	align-items: center;
}

.components-menu-item__shortcut {
	align-self: center;
	margin-right: 0;
	margin-left: auto;
	padding-left: $grid-unit-30;
	color: currentColor;

	// Hide the keyboard shortcuts on mobile, because they aren't super-useful
	// for most mobile users and it frees up screen space for any item
	// with a long description.
	display: none;
	@include break-mobile() {
		display: inline;
	}
}
