selectpackage.src.vaadin-lit-select-overlay.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 { css, html, LitElement } from 'lit';
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { SelectOverlayMixin } from './vaadin-select-overlay-mixin.js';
/**
* An element used internally by ``. Not intended to be used separately.
*
* @extends HTMLElement
* @mixes SelectOverlayMixin
* @mixes ThemableMixin
* @protected
*/
class SelectOverlay extends SelectOverlayMixin(ThemableMixin(PolylitMixin(LitElement))) {
static get is() {
return 'vaadin-select-overlay';
}
static get styles() {
return [
overlayStyles,
css`
:host {
align-items: flex-start;
justify-content: flex-start;
}
:host(:not([phone])) [part='overlay'] {
min-width: var(--vaadin-select-overlay-width, var(--vaadin-select-text-field-width));
}
@media (forced-colors: active) {
[part='overlay'] {
outline: 3px solid;
}
}
`,
];
}
/** @protected */
render() {
return html`
`;
}
/** @protected */
updated(props) {
super.updated(props);
if (props.has('renderer')) {
this.requestContentUpdate();
}
}
requestContentUpdate() {
super.requestContentUpdate();
if (this.owner) {
// Ensure menuElement reference is correct.
const menuElement = this._getMenuElement();
this.owner._assignMenuElement(menuElement);
}
}
}
defineCustomElement(SelectOverlay);