selectpackage.src.vaadin-lit-select.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/src/vaadin-lit-input-container.js';
import './vaadin-lit-select-item.js';
import './vaadin-lit-select-list-box.js';
import './vaadin-lit-select-overlay.js';
import './vaadin-lit-select-value-button.js';
import { css, html, LitElement } from 'lit';
import { screenReaderOnly } from '@vaadin/a11y-base/src/styles/sr-only-styles.js';
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
import { fieldShared } from '@vaadin/field-base/src/styles/field-shared-styles.js';
import { inputFieldContainer } from '@vaadin/field-base/src/styles/input-field-container-styles.js';
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { SelectBaseMixin } from './vaadin-select-base-mixin.js';
/**
* LitElement based version of `` web component.
*
* ## Disclaimer
*
* This component is an experiment and not yet a part of Vaadin platform.
* There is no ETA regarding specific Vaadin version where it'll land.
* Feel free to try this code in your apps as per Apache 2.0 license.
*
* @extends HTMLElement
*/
class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
static get is() {
return 'vaadin-select';
}
static get styles() {
return [
fieldShared,
inputFieldContainer,
screenReaderOnly,
css`
:host {
position: relative;
}
::slotted([slot='value']) {
flex-grow: 1;
}
`,
];
}
/** @protected */
render() {
return html`
`;
}
/** @protected */
ready() {
super.ready();
const overlay = this.shadowRoot.querySelector('vaadin-select-overlay');
overlay.owner = this;
this._overlayElement = overlay;
}
/** @private */
_onOpenedChanged(event) {
this.opened = event.detail.value;
}
/** @private */
_onOverlayOpen() {
if (this._menuElement) {
this._menuElement.focus();
}
}
}
defineCustomElement(Select);
export { Select };