@synergy-design-system/components
Version:
171 lines (145 loc) • 5.46 kB
JavaScript
// src/components/option/option.styles.ts
import { css } from "lit";
var option_styles_default = css`
:host {
display: block;
/* stylelint-disable-next-line property-no-vendor-prefix */
-webkit-user-select: none;
user-select: none;
}
:host(:focus) {
outline: none;
}
/**
* syn-option is now able to adjust its height from a parent item
* This is done by exposing multiple css variables to the outside:
*
* --option-min-height (defaults to 48px) The minimal height of an element
* --option-padding (defaults to var(--syn-spacing-small) var(--syn-spacing-medium)) The padding to use
* --option-font-size (defaults to var(--syn-font-size-medium)) The font size to use
* --option-icon-size (defaults to var(--syn-spacing-large)) The size of the checkmark
*
* See below for usage of these variables
*/
.option {
align-items: center;
/*
* #988: Brand2025 defines a small gap between options
* and rounded corners. We achieve that using an border
* that simulates the gap using the menu background color.
*/
border: solid var(--syn-panel-background-color);
/**
* Border Radius needs to be increased to cover the outline
* Note this also needs to take the following into account:
* - 2018 does not have a focus ring, so the border radius is as small as the border, essentially negating it to "0"
* - 2025 needs to adapt with another pixel to make it match the rounding of the focus ring
*/
border-radius: calc(calc(var(--syn-focus-ring-border-radius) * 2) + var(--option-inset-border-vertical) - 2px) / calc(calc(var(--syn-focus-ring-border-radius) * 2) + var(--option-inset-border-vertical) - 4px);
border-width: var(--option-inset-border-horizontal) var(--option-inset-border-vertical);
color: var(--syn-color-neutral-700);
cursor: pointer;
display: flex;
font-family: var(--syn-font-sans);
font-size: var(--option-font-size, var(--syn-font-size-medium));
font-weight: var(--syn-font-weight-normal);
letter-spacing: var(--syn-letter-spacing-normal);
line-height: var(--syn-line-height-normal);
/* Height is dependent on line-height of .option__label, which does not fit completely to layout */
min-height: var(--option-min-height, var(--syn-input-height-medium));
padding: 0 calc(var(--option-padding) - var(--option-inset-border-vertical));
position: relative;
transition: var(--syn-transition-fast) fill;
}
.option:not(.option--current) {
color: var(--syn-option-color);
}
.option--current,
.option--current.option--hover:not(.option--disabled) {
background-color: var(--syn-option-background-color-active);
color: var(--syn-option-color-active);
}
.option--hover:not(.option--current):not(.option--disabled) {
background-color: var(--syn-option-background-color-hover);
color: var(--syn-option-color-hover);
}
.option--disabled {
cursor: not-allowed;
opacity: var(--syn-input-disabled-opacity); /* #429: Use token for opacity */
outline: none;
}
.option--current.option--disabled {
background-color: var(--syn-option-background-color-hover);
color: var(--syn-option-color-hover);
}
.option__label {
display: inline-block;
flex: 1 1 auto;
line-height: var(--syn-line-height-normal);
}
.option__check {
color: var(--syn-option-check-color);
font-size: var(--option-icon-size, var(--syn-spacing-large));
}
.option .option__check {
align-items: center;
display: flex;
flex: 0 0 auto;
justify-content: center;
padding-inline-end: var(--syn-spacing-small);
visibility: hidden;
}
/* Invert the check mark when keyboard navigation is used */
.option--current .option__check {
color: var(--syn-option-check-color-active);
}
.option--selected .option__check {
visibility: visible;
}
.option--hover:not(.option--current) .option__check {
color: var(--syn-option-check-color-hover);
}
.option__prefix,
.option__suffix {
align-items: center;
display: flex;
flex: 0 0 auto;
}
/* Use larger spacing between icons and content */
.option__prefix::slotted(*) {
margin-inline-end: var(--syn-spacing-small);
}
.option__suffix::slotted(*) {
margin-inline-start: var(--syn-spacing-small);
}
/* Set correct icon size when someone uses syn-icon in the slots */
.option__prefix::slotted(syn-icon),
.option__suffix::slotted(syn-icon) {
color: var(--syn-option-icon-color);
font-size: var(--option-icon-size, var(--syn-spacing-large));
}
.option--current .option__prefix::slotted(syn-icon),
.option--current .option__suffix::slotted(syn-icon) {
color: var(--syn-option-icon-color-active);
}
.option--hover:not(.option--disabled) .option__prefix::slotted(syn-icon),
.option--hover:not(.option--disabled) .option__suffix::slotted(syn-icon) {
color: var(--syn-option-icon-color-hover);
}
/* This is needed for the highlight styling of the options in syn-combobox */
.option__label::slotted(.syn-highlight-style) {
background-color: transparent;
color: unset;
font: var(--syn-body-medium-bold);
}
@media (forced-colors: active) {
:host(:hover:not([aria-disabled='true'])) .option {
outline: dashed 1px SelectedItem;
outline-offset: -1px;
}
}
`;
export {
option_styles_default
};
//# sourceMappingURL=chunk.D64TGJ7Y.js.map