@vaadin/combo-box 24.8.0-alpha9 → 25.0.0-alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -23
- package/package.json +14 -18
- package/src/vaadin-combo-box-item.js +21 -16
- package/src/vaadin-combo-box-mixin.js +1 -25
- package/src/vaadin-combo-box-overlay-mixin.js +1 -1
- package/src/vaadin-combo-box-overlay.js +12 -8
- package/src/vaadin-combo-box-scroller.js +31 -26
- package/src/vaadin-combo-box.d.ts +2 -6
- package/src/vaadin-combo-box.js +44 -41
- package/web-types.json +2 -487
- package/web-types.lit.json +2 -247
- package/src/vaadin-combo-box-light-mixin.d.ts +0 -26
- package/src/vaadin-combo-box-light-mixin.js +0 -129
- package/src/vaadin-combo-box-light.d.ts +0 -161
- package/src/vaadin-combo-box-light.js +0 -94
- package/src/vaadin-lit-combo-box-item.js +0 -50
- package/src/vaadin-lit-combo-box-light.js +0 -57
- package/src/vaadin-lit-combo-box-overlay.js +0 -60
- package/src/vaadin-lit-combo-box-scroller.js +0 -59
- package/src/vaadin-lit-combo-box.js +0 -169
- package/theme/lumo/vaadin-combo-box-light.d.ts +0 -3
- package/theme/lumo/vaadin-combo-box-light.js +0 -3
- package/theme/lumo/vaadin-lit-combo-box-light.d.ts +0 -3
- package/theme/lumo/vaadin-lit-combo-box-light.js +0 -3
- package/theme/lumo/vaadin-lit-combo-box.d.ts +0 -4
- package/theme/lumo/vaadin-lit-combo-box.js +0 -4
- package/theme/material/vaadin-combo-box-item-styles.d.ts +0 -5
- package/theme/material/vaadin-combo-box-item-styles.js +0 -20
- package/theme/material/vaadin-combo-box-light.d.ts +0 -3
- package/theme/material/vaadin-combo-box-light.js +0 -3
- package/theme/material/vaadin-combo-box-overlay-styles.d.ts +0 -4
- package/theme/material/vaadin-combo-box-overlay-styles.js +0 -51
- package/theme/material/vaadin-combo-box-styles.d.ts +0 -3
- package/theme/material/vaadin-combo-box-styles.js +0 -21
- package/theme/material/vaadin-combo-box.d.ts +0 -4
- package/theme/material/vaadin-combo-box.js +0 -4
- package/theme/material/vaadin-lit-combo-box-light.d.ts +0 -3
- package/theme/material/vaadin-lit-combo-box-light.js +0 -3
- package/theme/material/vaadin-lit-combo-box.d.ts +0 -4
- package/theme/material/vaadin-lit-combo-box.js +0 -4
- package/vaadin-combo-box-light.d.ts +0 -1
- package/vaadin-combo-box-light.js +0 -2
- package/vaadin-lit-combo-box-light.d.ts +0 -1
- package/vaadin-lit-combo-box-light.js +0 -2
- package/vaadin-lit-combo-box.d.ts +0 -1
- package/vaadin-lit-combo-box.js +0 -2
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import './vaadin-combo-box-item.js';
|
|
7
|
-
import './vaadin-combo-box-overlay.js';
|
|
8
|
-
import './vaadin-combo-box-scroller.js';
|
|
9
|
-
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
10
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
11
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
-
import { ComboBoxLightMixin } from './vaadin-combo-box-light-mixin.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* `<vaadin-combo-box-light>` is a customizable version of the `<vaadin-combo-box>` providing
|
|
16
|
-
* only the dropdown functionality and leaving the input field definition to the user.
|
|
17
|
-
*
|
|
18
|
-
* The element has the same API as `<vaadin-combo-box>`.
|
|
19
|
-
*
|
|
20
|
-
* To create a custom input field, you need to add a child element which has a two-way
|
|
21
|
-
* data-bindable property representing the input value. The property name is expected
|
|
22
|
-
* to be `value` by default. For example, you can use `<vaadin-text-field>` element:
|
|
23
|
-
*
|
|
24
|
-
* ```html
|
|
25
|
-
* <vaadin-combo-box-light>
|
|
26
|
-
* <vaadin-text-field></vaadin-text-field>
|
|
27
|
-
* </vaadin-combo-box-light>
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* If you are using custom input field that has other property for value,
|
|
31
|
-
* set `class="input"` to enable corresponding logic, and use `attr-for-value`
|
|
32
|
-
* attribute to specify which property to use:
|
|
33
|
-
*
|
|
34
|
-
* ```html
|
|
35
|
-
* <vaadin-combo-box-light attr-for-value="input-value">
|
|
36
|
-
* <custom-input class="input"></custom-input>
|
|
37
|
-
* </vaadin-combo-box-light>
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* You can also pass custom toggle and clear buttons with corresponding classes:
|
|
41
|
-
*
|
|
42
|
-
* ```html
|
|
43
|
-
* <vaadin-combo-box-light>
|
|
44
|
-
* <custom-input class="input" attr-for-value="input-value">
|
|
45
|
-
* <button slot="suffix" class="clear-button">Clear</button>
|
|
46
|
-
* <button slot="suffix" class="toggle-button">Toggle</button>
|
|
47
|
-
* </custom-input>
|
|
48
|
-
* </vaadin-combo-box-light>
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @fires {Event} change - Fired when the user commits a value change.
|
|
52
|
-
* @fires {CustomEvent} custom-value-set - Fired when the user sets a custom value.
|
|
53
|
-
* @fires {CustomEvent} filter-changed - Fired when the `filter` property changes.
|
|
54
|
-
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
55
|
-
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
56
|
-
* @fires {CustomEvent} selected-item-changed - Fired when the `selectedItem` property changes.
|
|
57
|
-
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
58
|
-
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
59
|
-
*
|
|
60
|
-
* @customElement
|
|
61
|
-
* @extends HTMLElement
|
|
62
|
-
* @mixes ComboBoxLightMixin
|
|
63
|
-
* @mixes ThemableMixin
|
|
64
|
-
*/
|
|
65
|
-
class ComboBoxLight extends ComboBoxLightMixin(ThemableMixin(PolymerElement)) {
|
|
66
|
-
static get is() {
|
|
67
|
-
return 'vaadin-combo-box-light';
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
static get template() {
|
|
71
|
-
return html`
|
|
72
|
-
<style>
|
|
73
|
-
:host([opened]) {
|
|
74
|
-
pointer-events: auto;
|
|
75
|
-
}
|
|
76
|
-
</style>
|
|
77
|
-
|
|
78
|
-
<slot></slot>
|
|
79
|
-
|
|
80
|
-
<vaadin-combo-box-overlay
|
|
81
|
-
id="overlay"
|
|
82
|
-
opened="[[_overlayOpened]]"
|
|
83
|
-
loading$="[[loading]]"
|
|
84
|
-
theme$="[[_theme]]"
|
|
85
|
-
position-target="[[inputElement]]"
|
|
86
|
-
no-vertical-overlap
|
|
87
|
-
></vaadin-combo-box-overlay>
|
|
88
|
-
`;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
defineCustomElement(ComboBoxLight);
|
|
93
|
-
|
|
94
|
-
export { ComboBoxLight };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { css, html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
-
import { ComboBoxItemMixin } from './vaadin-combo-box-item-mixin.js';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* LitElement based version of `<vaadin-combo-box-item>` web component.
|
|
15
|
-
*
|
|
16
|
-
* ## Disclaimer
|
|
17
|
-
*
|
|
18
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
19
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
20
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
21
|
-
*/
|
|
22
|
-
export class ComboBoxItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
|
|
23
|
-
static get is() {
|
|
24
|
-
return 'vaadin-combo-box-item';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static get styles() {
|
|
28
|
-
return css`
|
|
29
|
-
:host {
|
|
30
|
-
display: block;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
:host([hidden]) {
|
|
34
|
-
display: none;
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** @protected */
|
|
40
|
-
render() {
|
|
41
|
-
return html`
|
|
42
|
-
<span part="checkmark" aria-hidden="true"></span>
|
|
43
|
-
<div part="content">
|
|
44
|
-
<slot></slot>
|
|
45
|
-
</div>
|
|
46
|
-
`;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
defineCustomElement(ComboBoxItem);
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import './vaadin-lit-combo-box-item.js';
|
|
7
|
-
import './vaadin-lit-combo-box-overlay.js';
|
|
8
|
-
import './vaadin-lit-combo-box-scroller.js';
|
|
9
|
-
import { css, html, LitElement } from 'lit';
|
|
10
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
12
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
13
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
|
-
import { ComboBoxLightMixin } from './vaadin-combo-box-light-mixin.js';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* LitElement based version of `<vaadin-combo-box-light>` web component.
|
|
18
|
-
*
|
|
19
|
-
* ## Disclaimer
|
|
20
|
-
*
|
|
21
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
22
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
23
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
24
|
-
*/
|
|
25
|
-
class ComboBoxLight extends ComboBoxLightMixin(ThemableMixin(PolylitMixin(LitElement))) {
|
|
26
|
-
static get is() {
|
|
27
|
-
return 'vaadin-combo-box-light';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static get styles() {
|
|
31
|
-
return css`
|
|
32
|
-
:host([opened]) {
|
|
33
|
-
pointer-events: auto;
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** @protected */
|
|
39
|
-
render() {
|
|
40
|
-
return html`
|
|
41
|
-
<slot></slot>
|
|
42
|
-
|
|
43
|
-
<vaadin-combo-box-overlay
|
|
44
|
-
id="overlay"
|
|
45
|
-
.opened="${this._overlayOpened}"
|
|
46
|
-
?loading="${this.loading}"
|
|
47
|
-
theme="${ifDefined(this._theme)}"
|
|
48
|
-
.positionTarget="${this.inputElement}"
|
|
49
|
-
no-vertical-overlap
|
|
50
|
-
></vaadin-combo-box-overlay>
|
|
51
|
-
`;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
defineCustomElement(ComboBoxLight);
|
|
56
|
-
|
|
57
|
-
export { ComboBoxLight };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { css, html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
11
|
-
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
12
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
-
import { ComboBoxOverlayMixin } from './vaadin-combo-box-overlay-mixin.js';
|
|
14
|
-
|
|
15
|
-
const comboBoxOverlayStyles = css`
|
|
16
|
-
#overlay {
|
|
17
|
-
width: var(--vaadin-combo-box-overlay-width, var(--_vaadin-combo-box-overlay-default-width, auto));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
[part='content'] {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
height: 100%;
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* An element used internally by `<vaadin-combo-box>`. Not intended to be used separately.
|
|
29
|
-
*
|
|
30
|
-
* @extends HTMLElement
|
|
31
|
-
* @mixes ComboBoxOverlayMixin
|
|
32
|
-
* @mixes DirMixin
|
|
33
|
-
* @mixes OverlayMixin
|
|
34
|
-
* @mixes ThemableMixin
|
|
35
|
-
* @private
|
|
36
|
-
*/
|
|
37
|
-
export class ComboBoxOverlay extends ComboBoxOverlayMixin(
|
|
38
|
-
OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))),
|
|
39
|
-
) {
|
|
40
|
-
static get is() {
|
|
41
|
-
return 'vaadin-combo-box-overlay';
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
static get styles() {
|
|
45
|
-
return [overlayStyles, comboBoxOverlayStyles, comboBoxOverlayStyles];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/** @protected */
|
|
49
|
-
render() {
|
|
50
|
-
return html`
|
|
51
|
-
<div id="backdrop" part="backdrop" hidden></div>
|
|
52
|
-
<div part="overlay" id="overlay">
|
|
53
|
-
<div part="loader"></div>
|
|
54
|
-
<div part="content" id="content"><slot></slot></div>
|
|
55
|
-
</div>
|
|
56
|
-
`;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
defineCustomElement(ComboBoxOverlay);
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { css, html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
|
-
import { ComboBoxScrollerMixin } from './vaadin-combo-box-scroller-mixin.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* An element used internally by `<vaadin-combo-box>`. Not intended to be used separately.
|
|
13
|
-
*
|
|
14
|
-
* @extends HTMLElement
|
|
15
|
-
* @mixes ComboBoxScrollerMixin
|
|
16
|
-
* @private
|
|
17
|
-
*/
|
|
18
|
-
export class ComboBoxScroller extends ComboBoxScrollerMixin(PolylitMixin(LitElement)) {
|
|
19
|
-
static get is() {
|
|
20
|
-
return 'vaadin-combo-box-scroller';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static get styles() {
|
|
24
|
-
return css`
|
|
25
|
-
:host {
|
|
26
|
-
display: block;
|
|
27
|
-
min-height: 1px;
|
|
28
|
-
overflow: auto;
|
|
29
|
-
|
|
30
|
-
/* Fixes item background from getting on top of scrollbars on Safari */
|
|
31
|
-
transform: translate3d(0, 0, 0);
|
|
32
|
-
|
|
33
|
-
/* Enable momentum scrolling on iOS */
|
|
34
|
-
-webkit-overflow-scrolling: touch;
|
|
35
|
-
|
|
36
|
-
/* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
|
|
37
|
-
box-shadow: 0 0 0 white;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
#selector {
|
|
41
|
-
border-width: var(--_vaadin-combo-box-items-container-border-width);
|
|
42
|
-
border-style: var(--_vaadin-combo-box-items-container-border-style);
|
|
43
|
-
border-color: var(--_vaadin-combo-box-items-container-border-color, transparent);
|
|
44
|
-
position: relative;
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** @protected */
|
|
50
|
-
render() {
|
|
51
|
-
return html`
|
|
52
|
-
<div id="selector">
|
|
53
|
-
<slot></slot>
|
|
54
|
-
</div>
|
|
55
|
-
`;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
defineCustomElement(ComboBoxScroller);
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import '@vaadin/input-container/src/vaadin-lit-input-container.js';
|
|
7
|
-
import './vaadin-lit-combo-box-item.js';
|
|
8
|
-
import './vaadin-lit-combo-box-overlay.js';
|
|
9
|
-
import './vaadin-lit-combo-box-scroller.js';
|
|
10
|
-
import { css, html, LitElement } from 'lit';
|
|
11
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
12
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
14
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
15
|
-
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
16
|
-
import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
17
|
-
import { InputController } from '@vaadin/field-base/src/input-controller.js';
|
|
18
|
-
import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
|
|
19
|
-
import { PatternMixin } from '@vaadin/field-base/src/pattern-mixin.js';
|
|
20
|
-
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
21
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
22
|
-
import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
|
|
23
|
-
import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* LitElement based version of `<vaadin-combo-box>` web component.
|
|
27
|
-
*
|
|
28
|
-
* ## Disclaimer
|
|
29
|
-
*
|
|
30
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
31
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
32
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
33
|
-
*/
|
|
34
|
-
class ComboBox extends ComboBoxDataProviderMixin(
|
|
35
|
-
ComboBoxMixin(PatternMixin(InputControlMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))))),
|
|
36
|
-
) {
|
|
37
|
-
static get is() {
|
|
38
|
-
return 'vaadin-combo-box';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
static get styles() {
|
|
42
|
-
return [
|
|
43
|
-
inputFieldShared,
|
|
44
|
-
css`
|
|
45
|
-
:host([opened]) {
|
|
46
|
-
pointer-events: auto;
|
|
47
|
-
}
|
|
48
|
-
`,
|
|
49
|
-
];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
static get properties() {
|
|
53
|
-
return {
|
|
54
|
-
/**
|
|
55
|
-
* @protected
|
|
56
|
-
*/
|
|
57
|
-
_positionTarget: {
|
|
58
|
-
type: Object,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
65
|
-
* @protected
|
|
66
|
-
* @return {!HTMLElement}
|
|
67
|
-
*/
|
|
68
|
-
get clearElement() {
|
|
69
|
-
return this.$.clearButton;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** @protected */
|
|
73
|
-
render() {
|
|
74
|
-
return html`
|
|
75
|
-
<div class="vaadin-combo-box-container">
|
|
76
|
-
<div part="label">
|
|
77
|
-
<slot name="label"></slot>
|
|
78
|
-
<span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
<vaadin-input-container
|
|
82
|
-
part="input-field"
|
|
83
|
-
.readonly="${this.readonly}"
|
|
84
|
-
.disabled="${this.disabled}"
|
|
85
|
-
.invalid="${this.invalid}"
|
|
86
|
-
theme="${ifDefined(this._theme)}"
|
|
87
|
-
>
|
|
88
|
-
<slot name="prefix" slot="prefix"></slot>
|
|
89
|
-
<slot name="input"></slot>
|
|
90
|
-
<div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
|
|
91
|
-
<div id="toggleButton" part="toggle-button" slot="suffix" aria-hidden="true"></div>
|
|
92
|
-
</vaadin-input-container>
|
|
93
|
-
|
|
94
|
-
<div part="helper-text">
|
|
95
|
-
<slot name="helper"></slot>
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
<div part="error-message">
|
|
99
|
-
<slot name="error-message"></slot>
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
|
-
|
|
103
|
-
<vaadin-combo-box-overlay
|
|
104
|
-
id="overlay"
|
|
105
|
-
.opened="${this._overlayOpened}"
|
|
106
|
-
?loading="${this.loading}"
|
|
107
|
-
theme="${ifDefined(this._theme)}"
|
|
108
|
-
.positionTarget="${this._positionTarget}"
|
|
109
|
-
no-vertical-overlap
|
|
110
|
-
></vaadin-combo-box-overlay>
|
|
111
|
-
|
|
112
|
-
<slot name="tooltip"></slot>
|
|
113
|
-
`;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/** @protected */
|
|
117
|
-
ready() {
|
|
118
|
-
super.ready();
|
|
119
|
-
|
|
120
|
-
this.addController(
|
|
121
|
-
new InputController(this, (input) => {
|
|
122
|
-
this._setInputElement(input);
|
|
123
|
-
this._setFocusElement(input);
|
|
124
|
-
this.stateTarget = input;
|
|
125
|
-
this.ariaTarget = input;
|
|
126
|
-
}),
|
|
127
|
-
);
|
|
128
|
-
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
129
|
-
|
|
130
|
-
this._tooltipController = new TooltipController(this);
|
|
131
|
-
this.addController(this._tooltipController);
|
|
132
|
-
this._tooltipController.setPosition('top');
|
|
133
|
-
this._tooltipController.setShouldShow((target) => !target.opened);
|
|
134
|
-
|
|
135
|
-
this._positionTarget = this.shadowRoot.querySelector('[part="input-field"]');
|
|
136
|
-
this._toggleElement = this.$.toggleButton;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Override the method from `InputControlMixin`
|
|
141
|
-
* to stop event propagation to prevent `ComboBoxMixin`
|
|
142
|
-
* from handling this click event also on its own.
|
|
143
|
-
*
|
|
144
|
-
* @param {Event} event
|
|
145
|
-
* @protected
|
|
146
|
-
* @override
|
|
147
|
-
*/
|
|
148
|
-
_onClearButtonClick(event) {
|
|
149
|
-
event.stopPropagation();
|
|
150
|
-
super._onClearButtonClick(event);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @param {Event} event
|
|
155
|
-
* @protected
|
|
156
|
-
*/
|
|
157
|
-
_onHostClick(event) {
|
|
158
|
-
const path = event.composedPath();
|
|
159
|
-
|
|
160
|
-
// Open dropdown only when clicking on the label or input field
|
|
161
|
-
if (path.includes(this._labelNode) || path.includes(this._positionTarget)) {
|
|
162
|
-
super._onHostClick(event);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
defineCustomElement(ComboBox);
|
|
168
|
-
|
|
169
|
-
export { ComboBox };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-material-styles/font-icons.js';
|
|
3
|
-
import '@vaadin/vaadin-material-styles/typography.js';
|
|
4
|
-
import { item } from '@vaadin/item/theme/material/vaadin-item-styles.js';
|
|
5
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
6
|
-
|
|
7
|
-
const comboBoxItem = css`
|
|
8
|
-
:host {
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
-webkit-tap-highlight-color: transparent;
|
|
11
|
-
padding: 4px 10px;
|
|
12
|
-
--_material-item-selected-icon-display: block;
|
|
13
|
-
}
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
registerStyles('vaadin-combo-box-item', [item, comboBoxItem], {
|
|
17
|
-
moduleId: 'material-combo-box-item',
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { comboBoxItem };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
2
|
-
import { loader } from '@vaadin/vaadin-material-styles/mixins/loader.js';
|
|
3
|
-
import { menuOverlay } from '@vaadin/vaadin-material-styles/mixins/menu-overlay.js';
|
|
4
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
5
|
-
|
|
6
|
-
const comboBoxOverlay = css`
|
|
7
|
-
[part='overlay'] {
|
|
8
|
-
position: relative;
|
|
9
|
-
border-top-left-radius: 0;
|
|
10
|
-
border-top-right-radius: 0;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/* Overflow needs to be auto by default to make overlay sizing logic work */
|
|
14
|
-
/* When loading, overflow needs to be visible to make loading indicator visible */
|
|
15
|
-
:host([loading]) [part='overlay'] {
|
|
16
|
-
overflow: visible;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
[part='content'] {
|
|
20
|
-
padding: 0;
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
const comboBoxLoader = css`
|
|
25
|
-
[part~='loader'] {
|
|
26
|
-
position: absolute;
|
|
27
|
-
z-index: 1;
|
|
28
|
-
top: -2px;
|
|
29
|
-
left: 0;
|
|
30
|
-
right: 0;
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
registerStyles(
|
|
35
|
-
'vaadin-combo-box-overlay',
|
|
36
|
-
[
|
|
37
|
-
menuOverlay,
|
|
38
|
-
comboBoxOverlay,
|
|
39
|
-
loader,
|
|
40
|
-
comboBoxLoader,
|
|
41
|
-
css`
|
|
42
|
-
:host {
|
|
43
|
-
--_vaadin-combo-box-items-container-border-width: 8px 0;
|
|
44
|
-
--_vaadin-combo-box-items-container-border-style: solid;
|
|
45
|
-
}
|
|
46
|
-
`,
|
|
47
|
-
],
|
|
48
|
-
{ moduleId: 'material-combo-box-overlay' },
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
export { comboBoxLoader, comboBoxOverlay };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import '@vaadin/input-container/theme/material/vaadin-input-container-styles.js';
|
|
2
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
3
|
-
import '@vaadin/vaadin-material-styles/font-icons.js';
|
|
4
|
-
import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
|
|
5
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
6
|
-
|
|
7
|
-
const comboBox = css`
|
|
8
|
-
:host {
|
|
9
|
-
-webkit-tap-highlight-color: transparent;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
[part='toggle-button']::before {
|
|
13
|
-
content: var(--material-icons-dropdown);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
:host([opened]) [part='toggle-button'] {
|
|
17
|
-
transform: rotate(180deg);
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
registerStyles('vaadin-combo-box', [inputFieldShared, comboBox], { moduleId: 'material-combo-box' });
|