itempackage.theme.lumo.vaadin-item-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
The newest version!
import '@vaadin/vaadin-lumo-styles/font-icons.js';
import '@vaadin/vaadin-lumo-styles/sizing.js';
import '@vaadin/vaadin-lumo-styles/spacing.js';
import '@vaadin/vaadin-lumo-styles/style.js';
import '@vaadin/vaadin-lumo-styles/typography.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
const item = css`
:host {
display: flex;
align-items: center;
box-sizing: border-box;
font-family: var(--lumo-font-family);
font-size: var(--lumo-font-size-m);
line-height: var(--lumo-line-height-xs);
padding: 0.5em calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4) 0.5em
var(--_lumo-list-box-item-padding-left, calc(var(--lumo-border-radius-m) / 4));
min-height: var(--lumo-size-m);
outline: none;
border-radius: var(--lumo-border-radius-m);
cursor: var(--lumo-clickable-cursor);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-tap-highlight-color: var(--lumo-primary-color-10pct);
--_focus-ring-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
--_focus-ring-width: var(--vaadin-focus-ring-width, 2px);
--_selection-color-text: var(--vaadin-selection-color-text, var(--lumo-primary-text-color));
}
/* Checkmark */
[part='checkmark']::before {
display: var(--_lumo-item-selected-icon-display, none);
content: var(--lumo-icons-checkmark);
font-family: lumo-icons;
font-size: var(--lumo-icon-size-m);
line-height: 1;
font-weight: normal;
width: 1em;
height: 1em;
margin: calc((1 - var(--lumo-line-height-xs)) * var(--lumo-font-size-m) / 2) 0;
color: var(--_selection-color-text);
flex: none;
opacity: 0;
transition:
transform 0.2s cubic-bezier(0.12, 0.32, 0.54, 2),
opacity 0.1s;
}
:host([selected]) [part='checkmark']::before {
opacity: 1;
}
:host([active]:not([selected])) [part='checkmark']::before {
transform: scale(0.8);
opacity: 0;
transition-duration: 0s;
}
[part='content'] {
flex: auto;
}
/* Disabled */
:host([disabled]) {
color: var(--lumo-disabled-text-color);
cursor: default;
pointer-events: none;
}
/* TODO a workaround until we have "focus-follows-mouse". After that, use the hover style for focus-ring as well */
@media (any-hover: hover) {
:host(:hover:not([disabled])) {
background-color: var(--lumo-primary-color-10pct);
}
}
:host([focus-ring]:not([disabled])) {
box-shadow: inset 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
}
/* RTL specific styles */
:host([dir='rtl']) {
padding-left: calc(var(--lumo-space-l) + var(--lumo-border-radius-m) / 4);
padding-right: var(--_lumo-list-box-item-padding-left, calc(var(--lumo-border-radius-m) / 4));
}
/* Slotted icons */
:host ::slotted(vaadin-icon) {
width: var(--lumo-icon-size-m);
height: var(--lumo-icon-size-m);
}
`;
registerStyles('vaadin-item', item, { moduleId: 'lumo-item' });
export { item };