text-areapackage.theme.lumo.vaadin-text-area-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!
/**
* @license
* Copyright (c) 2017 - 2024 Vaadin Ltd.
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import '@vaadin/input-container/theme/lumo/vaadin-input-container-styles.js';
import '@vaadin/vaadin-lumo-styles/color.js';
import '@vaadin/vaadin-lumo-styles/sizing.js';
import '@vaadin/vaadin-lumo-styles/typography.js';
import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
const textArea = css`
[part='input-field'],
[part='input-field'] ::slotted(textarea) {
height: auto;
box-sizing: border-box;
}
[part='input-field'] {
/* Equal to the implicit padding in vaadin-text-field */
padding-top: calc((var(--lumo-text-field-size) - 1em * var(--lumo-line-height-s)) / 2);
padding-bottom: calc((var(--lumo-text-field-size) - 1em * var(--lumo-line-height-s)) / 2);
transition: background-color 0.1s;
line-height: var(--lumo-line-height-s);
}
:host(:not([readonly])) [part='input-field']::after {
display: none;
}
:host([readonly]) [part='input-field'] {
border: var(--vaadin-input-field-readonly-border, 1px dashed var(--lumo-contrast-30pct));
}
:host([readonly]) [part='input-field']::after {
border: none;
}
:host(:hover:not([readonly]):not([focused]):not([invalid])) [part='input-field'] {
background-color: var(--lumo-contrast-20pct);
}
@media (pointer: coarse) {
:host(:hover:not([readonly]):not([focused]):not([invalid])) [part='input-field'] {
background-color: var(--lumo-contrast-10pct);
}
:host(:active:not([readonly]):not([focused])) [part='input-field'] {
background-color: var(--lumo-contrast-20pct);
}
}
[part='input-field'] ::slotted(textarea) {
line-height: inherit;
--_lumo-text-field-overflow-mask-image: none;
}
/* Use sticky positioning to keep prefix/suffix/clear button visible when scrolling textarea container */
[part='input-field'] ::slotted([slot$='fix']),
[part='clear-button'] {
position: sticky;
top: 0;
align-self: flex-start;
}
/* Vertically align icon prefix/suffix/clear button with the first line of text */
[part='input-field'] ::slotted(vaadin-icon[slot$='fix']),
[part='clear-button'] {
top: calc((var(--lumo-icon-size-m) - 1em * var(--lumo-line-height-s)) / -2);
margin-top: calc((var(--lumo-icon-size-m) - 1em * var(--lumo-line-height-s)) / -2);
}
`;
registerStyles('vaadin-text-area', [inputFieldShared, textArea], {
moduleId: 'lumo-text-area',
});