@vaadin/combo-box 24.8.0-alpha9 → 25.0.0-alpha2
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 +17 -19
- package/src/styles/vaadin-combo-box-base-styles.d.ts +8 -0
- package/src/styles/vaadin-combo-box-base-styles.js +17 -0
- package/src/styles/vaadin-combo-box-core-styles.d.ts +8 -0
- package/src/styles/vaadin-combo-box-core-styles.js +12 -0
- package/src/styles/vaadin-combo-box-overlay-base-styles.js +63 -0
- package/src/styles/vaadin-combo-box-overlay-core-styles.js +18 -0
- package/src/styles/vaadin-combo-box-scroller-base-styles.js +29 -0
- package/src/styles/vaadin-combo-box-scroller-core-styles.js +30 -0
- package/src/vaadin-combo-box-item.js +14 -16
- package/src/vaadin-combo-box-mixin.js +9 -45
- package/src/vaadin-combo-box-overlay-mixin.js +1 -1
- package/src/vaadin-combo-box-overlay.js +13 -20
- package/src/vaadin-combo-box-scroller.js +10 -26
- package/src/vaadin-combo-box.d.ts +2 -6
- package/src/vaadin-combo-box.js +41 -44
- 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-alpha2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"lit.d.ts",
|
|
23
23
|
"lit.js",
|
|
24
24
|
"src",
|
|
25
|
+
"!src/styles/*-base-styles.d.ts",
|
|
26
|
+
"!src/styles/*-base-styles.js",
|
|
25
27
|
"theme",
|
|
26
28
|
"vaadin-*.d.ts",
|
|
27
29
|
"vaadin-*.js",
|
|
@@ -32,34 +34,30 @@
|
|
|
32
34
|
"Vaadin",
|
|
33
35
|
"combo-box",
|
|
34
36
|
"web-components",
|
|
35
|
-
"web-component"
|
|
36
|
-
"polymer"
|
|
37
|
+
"web-component"
|
|
37
38
|
],
|
|
38
39
|
"dependencies": {
|
|
39
40
|
"@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-alpha9",
|
|
50
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha9",
|
|
41
|
+
"@vaadin/a11y-base": "25.0.0-alpha2",
|
|
42
|
+
"@vaadin/component-base": "25.0.0-alpha2",
|
|
43
|
+
"@vaadin/field-base": "25.0.0-alpha2",
|
|
44
|
+
"@vaadin/input-container": "25.0.0-alpha2",
|
|
45
|
+
"@vaadin/item": "25.0.0-alpha2",
|
|
46
|
+
"@vaadin/lit-renderer": "25.0.0-alpha2",
|
|
47
|
+
"@vaadin/overlay": "25.0.0-alpha2",
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
|
|
49
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
|
|
51
50
|
"lit": "^3.0.0"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
|
-
"@vaadin/chai-plugins": "
|
|
55
|
-
"@vaadin/test-runner-commands": "
|
|
56
|
-
"@vaadin/testing-helpers": "^
|
|
57
|
-
"@vaadin/text-field": "24.8.0-alpha9",
|
|
53
|
+
"@vaadin/chai-plugins": "25.0.0-alpha2",
|
|
54
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha2",
|
|
55
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
58
56
|
"sinon": "^18.0.0"
|
|
59
57
|
},
|
|
60
58
|
"web-types": [
|
|
61
59
|
"web-types.json",
|
|
62
60
|
"web-types.lit.json"
|
|
63
61
|
],
|
|
64
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
|
|
65
63
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const comboBoxStyles = css`
|
|
10
|
+
:host([opened]) {
|
|
11
|
+
pointer-events: auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[part='toggle-button']::before {
|
|
15
|
+
mask-image: var(--_vaadin-icon-chevron-down);
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
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 } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const comboBoxStyles = css`
|
|
9
|
+
:host([opened]) {
|
|
10
|
+
pointer-events: auto;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
@@ -0,0 +1,63 @@
|
|
|
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/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const comboBoxOverlayStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
--vaadin-item-checkmark-display: block;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[part='overlay'] {
|
|
15
|
+
position: relative;
|
|
16
|
+
width: var(--vaadin-combo-box-overlay-width, var(--_vaadin-combo-box-overlay-default-width, auto));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[part='loader'] {
|
|
20
|
+
animation: spin 1s linear infinite;
|
|
21
|
+
border: 2px solid;
|
|
22
|
+
--_spinner-color: var(--vaadin-combo-box-spinner-color, var(--_vaadin-color-strong));
|
|
23
|
+
border-color: var(--_spinner-color) var(--_spinner-color) hsl(from var(--_spinner-color) h s l / 0.2)
|
|
24
|
+
hsl(from var(--_spinner-color) h s l / 0.2);
|
|
25
|
+
border-radius: var(--_vaadin-radius-full);
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
display: none;
|
|
28
|
+
height: var(--vaadin-icon-size, 1lh);
|
|
29
|
+
inset: calc(var(--vaadin-item-overlay-padding, 4px) + 2px);
|
|
30
|
+
inset-block-end: auto;
|
|
31
|
+
inset-inline-start: auto;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
position: absolute;
|
|
34
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[part='content'] {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
height: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([loading]) [part='loader'] {
|
|
44
|
+
display: block;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host([loading]) [part='content'] {
|
|
48
|
+
--_items-min-height: calc(var(--vaadin-icon-size, 1lh) + 4px);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@keyframes spin {
|
|
52
|
+
to {
|
|
53
|
+
rotate: 1turn;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (forced-colors: active) {
|
|
58
|
+
[part='loader'] {
|
|
59
|
+
forced-color-adjust: none;
|
|
60
|
+
--vaadin-combo-box-spinner-color: CanvasText;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const comboBoxOverlayStyles = css`
|
|
9
|
+
#overlay {
|
|
10
|
+
width: var(--vaadin-combo-box-overlay-width, var(--_vaadin-combo-box-overlay-default-width, auto));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[part='content'] {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const comboBoxScrollerStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
/* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
|
|
11
|
+
box-shadow: 0 0 0 white;
|
|
12
|
+
display: block;
|
|
13
|
+
min-height: 1px;
|
|
14
|
+
overflow: auto;
|
|
15
|
+
/* Fixes item background from getting on top of scrollbars on Safari */
|
|
16
|
+
transform: translate3d(0, 0, 0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#selector {
|
|
20
|
+
border: var(--vaadin-item-overlay-padding, 4px) solid transparent;
|
|
21
|
+
position: relative;
|
|
22
|
+
forced-color-adjust: none;
|
|
23
|
+
min-height: var(--_items-min-height, auto);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#selector > * {
|
|
27
|
+
forced-color-adjust: auto;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const comboBoxScrollerStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
min-height: 1px;
|
|
12
|
+
overflow: auto;
|
|
13
|
+
|
|
14
|
+
/* Fixes item background from getting on top of scrollbars on Safari */
|
|
15
|
+
transform: translate3d(0, 0, 0);
|
|
16
|
+
|
|
17
|
+
/* Enable momentum scrolling on iOS */
|
|
18
|
+
-webkit-overflow-scrolling: touch;
|
|
19
|
+
|
|
20
|
+
/* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
|
|
21
|
+
box-shadow: 0 0 0 white;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#selector {
|
|
25
|
+
border-width: var(--_vaadin-combo-box-items-container-border-width);
|
|
26
|
+
border-style: var(--_vaadin-combo-box-items-container-border-style);
|
|
27
|
+
border-color: var(--_vaadin-combo-box-items-container-border-color, transparent);
|
|
28
|
+
position: relative;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
@@ -3,9 +3,11 @@
|
|
|
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 { 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';
|
|
10
|
+
import { itemStyles } from '@vaadin/item/src/vaadin-item-core-styles.js';
|
|
9
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
12
|
import { ComboBoxItemMixin } from './vaadin-combo-box-item-mixin.js';
|
|
11
13
|
|
|
@@ -36,28 +38,24 @@ import { ComboBoxItemMixin } from './vaadin-combo-box-item-mixin.js';
|
|
|
36
38
|
* @mixes DirMixin
|
|
37
39
|
* @private
|
|
38
40
|
*/
|
|
39
|
-
export class ComboBoxItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(
|
|
40
|
-
static get
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
export class ComboBoxItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
|
|
42
|
+
static get is() {
|
|
43
|
+
return 'vaadin-combo-box-item';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static get styles() {
|
|
47
|
+
return itemStyles;
|
|
48
|
+
}
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
</style>
|
|
50
|
+
/** @protected */
|
|
51
|
+
render() {
|
|
52
|
+
return html`
|
|
51
53
|
<span part="checkmark" aria-hidden="true"></span>
|
|
52
54
|
<div part="content">
|
|
53
55
|
<slot></slot>
|
|
54
56
|
</div>
|
|
55
57
|
`;
|
|
56
58
|
}
|
|
57
|
-
|
|
58
|
-
static get is() {
|
|
59
|
-
return 'vaadin-combo-box-item';
|
|
60
|
-
}
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
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 {
|
|
@@ -319,26 +316,14 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
319
316
|
return 'vaadin-combo-box';
|
|
320
317
|
}
|
|
321
318
|
|
|
322
|
-
/**
|
|
323
|
-
* Get a reference to the native `<input>` element.
|
|
324
|
-
* Override to provide a custom input.
|
|
325
|
-
* @protected
|
|
326
|
-
* @return {HTMLInputElement | undefined}
|
|
327
|
-
*/
|
|
328
|
-
get _nativeInput() {
|
|
329
|
-
return this.inputElement;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
319
|
/**
|
|
333
320
|
* Override method inherited from `InputMixin`
|
|
334
321
|
* to customize the input element.
|
|
335
322
|
* @protected
|
|
336
323
|
* @override
|
|
337
324
|
*/
|
|
338
|
-
_inputElementChanged(
|
|
339
|
-
super._inputElementChanged(
|
|
340
|
-
|
|
341
|
-
const input = this._nativeInput;
|
|
325
|
+
_inputElementChanged(input) {
|
|
326
|
+
super._inputElementChanged(input);
|
|
342
327
|
|
|
343
328
|
if (input) {
|
|
344
329
|
input.autocomplete = 'off';
|
|
@@ -355,10 +340,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
355
340
|
input.setAttribute('autocorrect', 'off');
|
|
356
341
|
|
|
357
342
|
this._revertInputValueToValue();
|
|
358
|
-
|
|
359
|
-
if (this.clearElement) {
|
|
360
|
-
this.clearElement.addEventListener('mousedown', this._boundOnClearButtonMouseDown);
|
|
361
|
-
}
|
|
362
343
|
}
|
|
363
344
|
}
|
|
364
345
|
|
|
@@ -374,6 +355,10 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
374
355
|
this.addEventListener('click', this._boundOnClick);
|
|
375
356
|
this.addEventListener('touchend', this._boundOnTouchend);
|
|
376
357
|
|
|
358
|
+
if (this.clearElement) {
|
|
359
|
+
this.clearElement.addEventListener('mousedown', this._boundOnClearButtonMouseDown);
|
|
360
|
+
}
|
|
361
|
+
|
|
377
362
|
const bringToFrontListener = () => {
|
|
378
363
|
requestAnimationFrame(() => {
|
|
379
364
|
this._overlayElement.bringToFront();
|
|
@@ -383,8 +368,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
383
368
|
this.addEventListener('mousedown', bringToFrontListener);
|
|
384
369
|
this.addEventListener('touchstart', bringToFrontListener);
|
|
385
370
|
|
|
386
|
-
processTemplates(this);
|
|
387
|
-
|
|
388
371
|
this.addController(new VirtualKeyboardController(this));
|
|
389
372
|
}
|
|
390
373
|
|
|
@@ -431,25 +414,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
431
414
|
this.opened = false;
|
|
432
415
|
}
|
|
433
416
|
|
|
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
417
|
/**
|
|
454
418
|
* Override LitElement lifecycle callback to handle filter property change.
|
|
455
419
|
* @param {Object} props
|
|
@@ -581,7 +545,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
581
545
|
|
|
582
546
|
/** @private */
|
|
583
547
|
_updateActiveDescendant(index) {
|
|
584
|
-
const input = this.
|
|
548
|
+
const input = this.inputElement;
|
|
585
549
|
if (!input) {
|
|
586
550
|
return;
|
|
587
551
|
}
|
|
@@ -613,7 +577,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
613
577
|
this._onClosed();
|
|
614
578
|
}
|
|
615
579
|
|
|
616
|
-
const input = this.
|
|
580
|
+
const input = this.inputElement;
|
|
617
581
|
if (input) {
|
|
618
582
|
input.setAttribute('aria-expanded', !!opened);
|
|
619
583
|
|
|
@@ -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,30 +3,16 @@
|
|
|
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 { 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';
|
|
13
|
+
import { comboBoxOverlayStyles } from './styles/vaadin-combo-box-overlay-core-styles.js';
|
|
12
14
|
import { ComboBoxOverlayMixin } from './vaadin-combo-box-overlay-mixin.js';
|
|
13
15
|
|
|
14
|
-
const comboBoxOverlayStyles = css`
|
|
15
|
-
#overlay {
|
|
16
|
-
width: var(--vaadin-combo-box-overlay-width, var(--_vaadin-combo-box-overlay-default-width, auto));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
[part='content'] {
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
height: 100%;
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
registerStyles('vaadin-combo-box-overlay', [overlayStyles, comboBoxOverlayStyles], {
|
|
27
|
-
moduleId: 'vaadin-combo-box-overlay-styles',
|
|
28
|
-
});
|
|
29
|
-
|
|
30
16
|
/**
|
|
31
17
|
* An element used internally by `<vaadin-combo-box>`. Not intended to be used separately.
|
|
32
18
|
*
|
|
@@ -38,12 +24,19 @@ registerStyles('vaadin-combo-box-overlay', [overlayStyles, comboBoxOverlayStyles
|
|
|
38
24
|
* @mixes ThemableMixin
|
|
39
25
|
* @private
|
|
40
26
|
*/
|
|
41
|
-
export class ComboBoxOverlay extends ComboBoxOverlayMixin(
|
|
27
|
+
export class ComboBoxOverlay extends ComboBoxOverlayMixin(
|
|
28
|
+
OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))),
|
|
29
|
+
) {
|
|
42
30
|
static get is() {
|
|
43
31
|
return 'vaadin-combo-box-overlay';
|
|
44
32
|
}
|
|
45
33
|
|
|
46
|
-
static get
|
|
34
|
+
static get styles() {
|
|
35
|
+
return [overlayStyles, comboBoxOverlayStyles];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** @protected */
|
|
39
|
+
render() {
|
|
47
40
|
return html`
|
|
48
41
|
<div id="backdrop" part="backdrop" hidden></div>
|
|
49
42
|
<div part="overlay" id="overlay">
|
|
@@ -3,8 +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 { 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';
|
|
9
|
+
import { comboBoxScrollerStyles } from './styles/vaadin-combo-box-scroller-core-styles.js';
|
|
8
10
|
import { ComboBoxScrollerMixin } from './vaadin-combo-box-scroller-mixin.js';
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -15,36 +17,18 @@ import { ComboBoxScrollerMixin } from './vaadin-combo-box-scroller-mixin.js';
|
|
|
15
17
|
* @mixes ComboBoxScrollerMixin
|
|
16
18
|
* @private
|
|
17
19
|
*/
|
|
18
|
-
export class ComboBoxScroller extends ComboBoxScrollerMixin(
|
|
20
|
+
export class ComboBoxScroller extends ComboBoxScrollerMixin(PolylitMixin(LitElement)) {
|
|
19
21
|
static get is() {
|
|
20
22
|
return 'vaadin-combo-box-scroller';
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
static get
|
|
24
|
-
return
|
|
25
|
-
|
|
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
|
-
}
|
|
25
|
+
static get styles() {
|
|
26
|
+
return comboBoxScrollerStyles;
|
|
27
|
+
}
|
|
40
28
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
border-color: var(--_vaadin-combo-box-items-container-border-color, transparent);
|
|
45
|
-
position: relative;
|
|
46
|
-
}
|
|
47
|
-
</style>
|
|
29
|
+
/** @protected */
|
|
30
|
+
render() {
|
|
31
|
+
return html`
|
|
48
32
|
<div id="selector">
|
|
49
33
|
<slot></slot>
|
|
50
34
|
</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 {
|