@vaadin/combo-box 24.8.0-alpha8 → 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
package/README.md
CHANGED
|
@@ -39,29 +39,6 @@ Once installed, import the component in your application:
|
|
|
39
39
|
import '@vaadin/combo-box';
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
## Themes
|
|
43
|
-
|
|
44
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
45
|
-
The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/combo-box/vaadin-combo-box.js) of the package uses the Lumo theme.
|
|
46
|
-
|
|
47
|
-
To use the Material theme, import the component from the `theme/material` folder:
|
|
48
|
-
|
|
49
|
-
```js
|
|
50
|
-
import '@vaadin/combo-box/theme/material/vaadin-combo-box.js';
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
You can also import the Lumo version of the component explicitly:
|
|
54
|
-
|
|
55
|
-
```js
|
|
56
|
-
import '@vaadin/combo-box/theme/lumo/vaadin-combo-box.js';
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
|
|
60
|
-
|
|
61
|
-
```js
|
|
62
|
-
import '@vaadin/combo-box/src/vaadin-combo-box.js';
|
|
63
|
-
```
|
|
64
|
-
|
|
65
42
|
## Contributing
|
|
66
43
|
|
|
67
44
|
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/combo-box",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,34 +32,30 @@
|
|
|
32
32
|
"Vaadin",
|
|
33
33
|
"combo-box",
|
|
34
34
|
"web-components",
|
|
35
|
-
"web-component"
|
|
36
|
-
"polymer"
|
|
35
|
+
"web-component"
|
|
37
36
|
],
|
|
38
37
|
"dependencies": {
|
|
39
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@
|
|
41
|
-
"@vaadin/
|
|
42
|
-
"@vaadin/
|
|
43
|
-
"@vaadin/
|
|
44
|
-
"@vaadin/
|
|
45
|
-
"@vaadin/
|
|
46
|
-
"@vaadin/
|
|
47
|
-
"@vaadin/
|
|
48
|
-
"@vaadin/vaadin-
|
|
49
|
-
"@vaadin/vaadin-material-styles": "24.8.0-alpha8",
|
|
50
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
|
|
39
|
+
"@vaadin/a11y-base": "25.0.0-alpha1",
|
|
40
|
+
"@vaadin/component-base": "25.0.0-alpha1",
|
|
41
|
+
"@vaadin/field-base": "25.0.0-alpha1",
|
|
42
|
+
"@vaadin/input-container": "25.0.0-alpha1",
|
|
43
|
+
"@vaadin/item": "25.0.0-alpha1",
|
|
44
|
+
"@vaadin/lit-renderer": "25.0.0-alpha1",
|
|
45
|
+
"@vaadin/overlay": "25.0.0-alpha1",
|
|
46
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
|
|
47
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
|
|
51
48
|
"lit": "^3.0.0"
|
|
52
49
|
},
|
|
53
50
|
"devDependencies": {
|
|
54
|
-
"@vaadin/chai-plugins": "
|
|
55
|
-
"@vaadin/test-runner-commands": "
|
|
51
|
+
"@vaadin/chai-plugins": "25.0.0-alpha1",
|
|
52
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha1",
|
|
56
53
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
57
|
-
"@vaadin/text-field": "24.8.0-alpha8",
|
|
58
54
|
"sinon": "^18.0.0"
|
|
59
55
|
},
|
|
60
56
|
"web-types": [
|
|
61
57
|
"web-types.json",
|
|
62
58
|
"web-types.lit.json"
|
|
63
59
|
],
|
|
64
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
|
|
65
61
|
}
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { css, html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
10
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
11
|
import { ComboBoxItemMixin } from './vaadin-combo-box-item-mixin.js';
|
|
11
12
|
|
|
@@ -36,28 +37,32 @@ import { ComboBoxItemMixin } from './vaadin-combo-box-item-mixin.js';
|
|
|
36
37
|
* @mixes DirMixin
|
|
37
38
|
* @private
|
|
38
39
|
*/
|
|
39
|
-
export class ComboBoxItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(
|
|
40
|
-
static get
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
:host {
|
|
44
|
-
display: block;
|
|
45
|
-
}
|
|
40
|
+
export class ComboBoxItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
|
|
41
|
+
static get is() {
|
|
42
|
+
return 'vaadin-combo-box-item';
|
|
43
|
+
}
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
static get styles() {
|
|
46
|
+
return css`
|
|
47
|
+
:host {
|
|
48
|
+
display: block;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([hidden]) {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** @protected */
|
|
58
|
+
render() {
|
|
59
|
+
return html`
|
|
51
60
|
<span part="checkmark" aria-hidden="true"></span>
|
|
52
61
|
<div part="content">
|
|
53
62
|
<slot></slot>
|
|
54
63
|
</div>
|
|
55
64
|
`;
|
|
56
65
|
}
|
|
57
|
-
|
|
58
|
-
static get is() {
|
|
59
|
-
return 'vaadin-combo-box-item';
|
|
60
|
-
}
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
defineCustomElement(ComboBoxItem);
|
|
@@ -8,10 +8,8 @@ import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
|
8
8
|
import { isElementFocused, isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
|
|
9
9
|
import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
|
|
10
10
|
import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
|
|
11
|
-
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
12
11
|
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
13
12
|
import { get } from '@vaadin/component-base/src/path-utils.js';
|
|
14
|
-
import { processTemplates } from '@vaadin/component-base/src/templates.js';
|
|
15
13
|
import { InputMixin } from '@vaadin/field-base/src/input-mixin.js';
|
|
16
14
|
import { ValidateMixin } from '@vaadin/field-base/src/validate-mixin.js';
|
|
17
15
|
import { VirtualKeyboardController } from '@vaadin/field-base/src/virtual-keyboard-controller.js';
|
|
@@ -47,7 +45,6 @@ function findItemIndex(items, callback) {
|
|
|
47
45
|
|
|
48
46
|
/**
|
|
49
47
|
* @polymerMixin
|
|
50
|
-
* @mixes ControllerMixin
|
|
51
48
|
* @mixes ValidateMixin
|
|
52
49
|
* @mixes DisabledMixin
|
|
53
50
|
* @mixes InputMixin
|
|
@@ -58,7 +55,7 @@ function findItemIndex(items, callback) {
|
|
|
58
55
|
*/
|
|
59
56
|
export const ComboBoxMixin = (subclass) =>
|
|
60
57
|
class ComboBoxMixinClass extends OverlayClassMixin(
|
|
61
|
-
|
|
58
|
+
ValidateMixin(FocusMixin(KeyboardMixin(InputMixin(DisabledMixin(subclass))))),
|
|
62
59
|
) {
|
|
63
60
|
static get properties() {
|
|
64
61
|
return {
|
|
@@ -383,8 +380,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
383
380
|
this.addEventListener('mousedown', bringToFrontListener);
|
|
384
381
|
this.addEventListener('touchstart', bringToFrontListener);
|
|
385
382
|
|
|
386
|
-
processTemplates(this);
|
|
387
|
-
|
|
388
383
|
this.addController(new VirtualKeyboardController(this));
|
|
389
384
|
}
|
|
390
385
|
|
|
@@ -431,25 +426,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
431
426
|
this.opened = false;
|
|
432
427
|
}
|
|
433
428
|
|
|
434
|
-
/**
|
|
435
|
-
* Override Polymer lifecycle callback to handle `filter` property change after
|
|
436
|
-
* the observer for `opened` property is triggered. This is needed when opening
|
|
437
|
-
* combo-box on user input to ensure the focused index is set correctly.
|
|
438
|
-
*
|
|
439
|
-
* @param {!Object} currentProps Current accessor values
|
|
440
|
-
* @param {?Object} changedProps Properties changed since the last call
|
|
441
|
-
* @param {?Object} oldProps Previous values for each changed property
|
|
442
|
-
* @protected
|
|
443
|
-
* @override
|
|
444
|
-
*/
|
|
445
|
-
_propertiesChanged(currentProps, changedProps, oldProps) {
|
|
446
|
-
super._propertiesChanged(currentProps, changedProps, oldProps);
|
|
447
|
-
|
|
448
|
-
if (changedProps.filter !== undefined) {
|
|
449
|
-
this._filterChanged(changedProps.filter);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
429
|
/**
|
|
454
430
|
* Override LitElement lifecycle callback to handle filter property change.
|
|
455
431
|
* @param {Object} props
|
|
@@ -64,7 +64,7 @@ export const ComboBoxOverlayMixin = (superClass) =>
|
|
|
64
64
|
/** @protected */
|
|
65
65
|
_updateOverlayWidth() {
|
|
66
66
|
const propPrefix = this.localName;
|
|
67
|
-
this.style.setProperty(`--_${propPrefix}-default-width`, `${this.positionTarget.
|
|
67
|
+
this.style.setProperty(`--_${propPrefix}-default-width`, `${this.positionTarget.offsetWidth}px`);
|
|
68
68
|
|
|
69
69
|
const customWidth = getComputedStyle(this._comboBox).getPropertyValue(`--${propPrefix}-width`);
|
|
70
70
|
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { css, html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
10
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
10
11
|
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
11
|
-
import {
|
|
12
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
13
|
import { ComboBoxOverlayMixin } from './vaadin-combo-box-overlay-mixin.js';
|
|
13
14
|
|
|
14
15
|
const comboBoxOverlayStyles = css`
|
|
@@ -23,10 +24,6 @@ const comboBoxOverlayStyles = css`
|
|
|
23
24
|
}
|
|
24
25
|
`;
|
|
25
26
|
|
|
26
|
-
registerStyles('vaadin-combo-box-overlay', [overlayStyles, comboBoxOverlayStyles], {
|
|
27
|
-
moduleId: 'vaadin-combo-box-overlay-styles',
|
|
28
|
-
});
|
|
29
|
-
|
|
30
27
|
/**
|
|
31
28
|
* An element used internally by `<vaadin-combo-box>`. Not intended to be used separately.
|
|
32
29
|
*
|
|
@@ -38,12 +35,19 @@ registerStyles('vaadin-combo-box-overlay', [overlayStyles, comboBoxOverlayStyles
|
|
|
38
35
|
* @mixes ThemableMixin
|
|
39
36
|
* @private
|
|
40
37
|
*/
|
|
41
|
-
export class ComboBoxOverlay extends ComboBoxOverlayMixin(
|
|
38
|
+
export class ComboBoxOverlay extends ComboBoxOverlayMixin(
|
|
39
|
+
OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))),
|
|
40
|
+
) {
|
|
42
41
|
static get is() {
|
|
43
42
|
return 'vaadin-combo-box-overlay';
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
static get
|
|
45
|
+
static get styles() {
|
|
46
|
+
return [overlayStyles, comboBoxOverlayStyles];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @protected */
|
|
50
|
+
render() {
|
|
47
51
|
return html`
|
|
48
52
|
<div id="backdrop" part="backdrop" hidden></div>
|
|
49
53
|
<div part="overlay" id="overlay">
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { css, html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
8
9
|
import { ComboBoxScrollerMixin } from './vaadin-combo-box-scroller-mixin.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -15,36 +16,40 @@ import { ComboBoxScrollerMixin } from './vaadin-combo-box-scroller-mixin.js';
|
|
|
15
16
|
* @mixes ComboBoxScrollerMixin
|
|
16
17
|
* @private
|
|
17
18
|
*/
|
|
18
|
-
export class ComboBoxScroller extends ComboBoxScrollerMixin(
|
|
19
|
+
export class ComboBoxScroller extends ComboBoxScrollerMixin(PolylitMixin(LitElement)) {
|
|
19
20
|
static get is() {
|
|
20
21
|
return 'vaadin-combo-box-scroller';
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
static get
|
|
24
|
+
static get styles() {
|
|
25
|
+
return css`
|
|
26
|
+
:host {
|
|
27
|
+
display: block;
|
|
28
|
+
min-height: 1px;
|
|
29
|
+
overflow: auto;
|
|
30
|
+
|
|
31
|
+
/* Fixes item background from getting on top of scrollbars on Safari */
|
|
32
|
+
transform: translate3d(0, 0, 0);
|
|
33
|
+
|
|
34
|
+
/* Enable momentum scrolling on iOS */
|
|
35
|
+
-webkit-overflow-scrolling: touch;
|
|
36
|
+
|
|
37
|
+
/* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
|
|
38
|
+
box-shadow: 0 0 0 white;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#selector {
|
|
42
|
+
border-width: var(--_vaadin-combo-box-items-container-border-width);
|
|
43
|
+
border-style: var(--_vaadin-combo-box-items-container-border-style);
|
|
44
|
+
border-color: var(--_vaadin-combo-box-items-container-border-color, transparent);
|
|
45
|
+
position: relative;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** @protected */
|
|
51
|
+
render() {
|
|
24
52
|
return html`
|
|
25
|
-
<style>
|
|
26
|
-
:host {
|
|
27
|
-
display: block;
|
|
28
|
-
min-height: 1px;
|
|
29
|
-
overflow: auto;
|
|
30
|
-
|
|
31
|
-
/* Fixes item background from getting on top of scrollbars on Safari */
|
|
32
|
-
transform: translate3d(0, 0, 0);
|
|
33
|
-
|
|
34
|
-
/* Enable momentum scrolling on iOS */
|
|
35
|
-
-webkit-overflow-scrolling: touch;
|
|
36
|
-
|
|
37
|
-
/* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
|
|
38
|
-
box-shadow: 0 0 0 white;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
#selector {
|
|
42
|
-
border-width: var(--_vaadin-combo-box-items-container-border-width);
|
|
43
|
-
border-style: var(--_vaadin-combo-box-items-container-border-style);
|
|
44
|
-
border-color: var(--_vaadin-combo-box-items-container-border-color, transparent);
|
|
45
|
-
position: relative;
|
|
46
|
-
}
|
|
47
|
-
</style>
|
|
48
53
|
<div id="selector">
|
|
49
54
|
<slot></slot>
|
|
50
55
|
</div>
|
|
@@ -7,7 +7,6 @@ import type { DelegateFocusMixinClass } from '@vaadin/a11y-base/src/delegate-foc
|
|
|
7
7
|
import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
|
|
8
8
|
import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
9
9
|
import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
|
|
10
|
-
import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
|
|
11
10
|
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
12
11
|
import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
|
|
13
12
|
import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
@@ -24,6 +23,7 @@ import type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaad
|
|
|
24
23
|
import type { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
|
|
25
24
|
import type { ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
|
|
26
25
|
import type { ComboBoxDefaultItem } from './vaadin-combo-box-mixin.js';
|
|
26
|
+
|
|
27
27
|
export {
|
|
28
28
|
ComboBoxDataProvider,
|
|
29
29
|
ComboBoxDataProviderCallback,
|
|
@@ -190,9 +190,6 @@ export interface ComboBoxEventMap<TItem> extends HTMLElementEventMap {
|
|
|
190
190
|
* `opened` | Set when the combo box dropdown is open | :host
|
|
191
191
|
* `loading` | Set when new items are expected | :host
|
|
192
192
|
*
|
|
193
|
-
* If you want to replace the default `<input>` and its container with a custom implementation to get full control
|
|
194
|
-
* over the input field, consider using the [`<vaadin-combo-box-light>`](#/elements/vaadin-combo-box-light) element.
|
|
195
|
-
*
|
|
196
193
|
* ### Internal components
|
|
197
194
|
*
|
|
198
195
|
* In addition to `<vaadin-combo-box>` itself, the following internal
|
|
@@ -249,8 +246,7 @@ interface ComboBox<TItem = ComboBoxDefaultItem>
|
|
|
249
246
|
DelegateFocusMixinClass,
|
|
250
247
|
ThemableMixinClass,
|
|
251
248
|
ThemePropertyMixinClass,
|
|
252
|
-
ElementMixinClass
|
|
253
|
-
ControllerMixinClass {}
|
|
249
|
+
ElementMixinClass {}
|
|
254
250
|
|
|
255
251
|
declare global {
|
|
256
252
|
interface HTMLElementTagNameMap {
|
package/src/vaadin-combo-box.js
CHANGED
|
@@ -7,21 +7,21 @@ import '@vaadin/input-container/src/vaadin-input-container.js';
|
|
|
7
7
|
import './vaadin-combo-box-item.js';
|
|
8
8
|
import './vaadin-combo-box-overlay.js';
|
|
9
9
|
import './vaadin-combo-box-scroller.js';
|
|
10
|
-
import { html,
|
|
10
|
+
import { css, html, LitElement } from 'lit';
|
|
11
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
12
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
12
13
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
14
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
13
15
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
14
16
|
import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
15
17
|
import { InputController } from '@vaadin/field-base/src/input-controller.js';
|
|
16
18
|
import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
|
|
17
19
|
import { PatternMixin } from '@vaadin/field-base/src/pattern-mixin.js';
|
|
18
20
|
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
19
|
-
import {
|
|
21
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
20
22
|
import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
|
|
21
23
|
import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
|
|
22
24
|
|
|
23
|
-
registerStyles('vaadin-combo-box', inputFieldShared, { moduleId: 'vaadin-combo-box-styles' });
|
|
24
|
-
|
|
25
25
|
/**
|
|
26
26
|
* `<vaadin-combo-box>` is a web component for choosing a value from a filterable list of options
|
|
27
27
|
* presented in a dropdown overlay. The options can be provided as a list of strings or objects
|
|
@@ -121,9 +121,6 @@ registerStyles('vaadin-combo-box', inputFieldShared, { moduleId: 'vaadin-combo-b
|
|
|
121
121
|
* `opened` | Set when the combo box dropdown is open | :host
|
|
122
122
|
* `loading` | Set when new items are expected | :host
|
|
123
123
|
*
|
|
124
|
-
* If you want to replace the default `<input>` and its container with a custom implementation to get full control
|
|
125
|
-
* over the input field, consider using the [`<vaadin-combo-box-light>`](#/elements/vaadin-combo-box-light) element.
|
|
126
|
-
*
|
|
127
124
|
* ### Internal components
|
|
128
125
|
*
|
|
129
126
|
* In addition to `<vaadin-combo-box>` itself, the following internal
|
|
@@ -157,32 +154,58 @@ registerStyles('vaadin-combo-box', inputFieldShared, { moduleId: 'vaadin-combo-b
|
|
|
157
154
|
* @mixes ComboBoxMixin
|
|
158
155
|
*/
|
|
159
156
|
class ComboBox extends ComboBoxDataProviderMixin(
|
|
160
|
-
ComboBoxMixin(PatternMixin(InputControlMixin(ThemableMixin(ElementMixin(
|
|
157
|
+
ComboBoxMixin(PatternMixin(InputControlMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))))),
|
|
161
158
|
) {
|
|
162
159
|
static get is() {
|
|
163
160
|
return 'vaadin-combo-box';
|
|
164
161
|
}
|
|
165
162
|
|
|
166
|
-
static get
|
|
167
|
-
return
|
|
168
|
-
|
|
163
|
+
static get styles() {
|
|
164
|
+
return [
|
|
165
|
+
inputFieldShared,
|
|
166
|
+
css`
|
|
169
167
|
:host([opened]) {
|
|
170
168
|
pointer-events: auto;
|
|
171
169
|
}
|
|
172
|
-
|
|
170
|
+
`,
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
static get properties() {
|
|
175
|
+
return {
|
|
176
|
+
/**
|
|
177
|
+
* @protected
|
|
178
|
+
*/
|
|
179
|
+
_positionTarget: {
|
|
180
|
+
type: Object,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
187
|
+
* @protected
|
|
188
|
+
* @return {!HTMLElement}
|
|
189
|
+
*/
|
|
190
|
+
get clearElement() {
|
|
191
|
+
return this.$.clearButton;
|
|
192
|
+
}
|
|
173
193
|
|
|
194
|
+
/** @protected */
|
|
195
|
+
render() {
|
|
196
|
+
return html`
|
|
174
197
|
<div class="vaadin-combo-box-container">
|
|
175
198
|
<div part="label">
|
|
176
199
|
<slot name="label"></slot>
|
|
177
|
-
<span part="required-indicator" aria-hidden="true"
|
|
200
|
+
<span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
|
|
178
201
|
</div>
|
|
179
202
|
|
|
180
203
|
<vaadin-input-container
|
|
181
204
|
part="input-field"
|
|
182
|
-
readonly="
|
|
183
|
-
disabled="
|
|
184
|
-
invalid="
|
|
185
|
-
theme
|
|
205
|
+
.readonly="${this.readonly}"
|
|
206
|
+
.disabled="${this.disabled}"
|
|
207
|
+
.invalid="${this.invalid}"
|
|
208
|
+
theme="${ifDefined(this._theme)}"
|
|
186
209
|
>
|
|
187
210
|
<slot name="prefix" slot="prefix"></slot>
|
|
188
211
|
<slot name="input"></slot>
|
|
@@ -201,10 +224,10 @@ class ComboBox extends ComboBoxDataProviderMixin(
|
|
|
201
224
|
|
|
202
225
|
<vaadin-combo-box-overlay
|
|
203
226
|
id="overlay"
|
|
204
|
-
opened="
|
|
205
|
-
loading
|
|
206
|
-
theme
|
|
207
|
-
|
|
227
|
+
.opened="${this._overlayOpened}"
|
|
228
|
+
?loading="${this.loading}"
|
|
229
|
+
theme="${ifDefined(this._theme)}"
|
|
230
|
+
.positionTarget="${this._positionTarget}"
|
|
208
231
|
no-vertical-overlap
|
|
209
232
|
></vaadin-combo-box-overlay>
|
|
210
233
|
|
|
@@ -212,26 +235,6 @@ class ComboBox extends ComboBoxDataProviderMixin(
|
|
|
212
235
|
`;
|
|
213
236
|
}
|
|
214
237
|
|
|
215
|
-
static get properties() {
|
|
216
|
-
return {
|
|
217
|
-
/**
|
|
218
|
-
* @protected
|
|
219
|
-
*/
|
|
220
|
-
_positionTarget: {
|
|
221
|
-
type: Object,
|
|
222
|
-
},
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
228
|
-
* @protected
|
|
229
|
-
* @return {!HTMLElement}
|
|
230
|
-
*/
|
|
231
|
-
get clearElement() {
|
|
232
|
-
return this.$.clearButton;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
238
|
/** @protected */
|
|
236
239
|
ready() {
|
|
237
240
|
super.ready();
|