context-menupackage.theme.lumo.vaadin-context-menu-list-box-styles.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vaadin-webcomponents Show documentation
Show all versions of vaadin-webcomponents Show documentation
Mvnpm composite: Vaadin webcomponents
import '@vaadin/vaadin-lumo-styles/color.js';
import '@vaadin/vaadin-lumo-styles/spacing.js';
import '@vaadin/vaadin-lumo-styles/style.js';
import { listBox } from '@vaadin/list-box/theme/lumo/vaadin-list-box-styles.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
const contextMenuListBox = css`
:host {
--_lumo-list-box-item-selected-icon-display: block;
}
/* Normal item */
[part='items'] ::slotted([role='menuitem']) {
-webkit-tap-highlight-color: var(--lumo-primary-color-10pct);
cursor: default;
outline: none;
border-radius: var(--lumo-border-radius-m);
padding-left: calc(var(--lumo-border-radius-m) / 4);
padding-right: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
}
/* Hovered item */
/* TODO a workaround until we have "focus-follows-mouse". After that, use the hover style for focus-ring as well */
[part='items'] ::slotted([role='menuitem']:hover:not([disabled])),
[part='items'] ::slotted([role='menuitem'][expanded]:not([disabled])) {
background-color: var(--lumo-primary-color-10pct);
}
/* RTL styles */
:host([dir='rtl']) [part='items'] ::slotted([role='menuitem']) {
padding-left: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
padding-right: calc(var(--lumo-border-radius-m) / 4);
}
/* Focused item */
@media (pointer: coarse) {
[part='items'] ::slotted([role='menuitem']:hover:not([expanded]):not([disabled])) {
background-color: transparent;
}
}
`;
registerStyles('vaadin-context-menu-list-box', [listBox, contextMenuListBox], {
moduleId: 'lumo-context-menu-list-box',
});
export { contextMenuListBox };