@vaadin/multi-select-combo-box 24.0.0-alpha12 → 24.0.0-alpha13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/multi-select-combo-box",
3
- "version": "24.0.0-alpha12",
3
+ "version": "24.0.0-alpha13",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,18 +37,18 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/combo-box": "24.0.0-alpha12",
41
- "@vaadin/component-base": "24.0.0-alpha12",
42
- "@vaadin/field-base": "24.0.0-alpha12",
43
- "@vaadin/input-container": "24.0.0-alpha12",
44
- "@vaadin/lit-renderer": "24.0.0-alpha12",
45
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha12",
46
- "@vaadin/vaadin-material-styles": "24.0.0-alpha12",
47
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha12"
40
+ "@vaadin/combo-box": "24.0.0-alpha13",
41
+ "@vaadin/component-base": "24.0.0-alpha13",
42
+ "@vaadin/field-base": "24.0.0-alpha13",
43
+ "@vaadin/input-container": "24.0.0-alpha13",
44
+ "@vaadin/lit-renderer": "24.0.0-alpha13",
45
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha13",
46
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha13",
47
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha13"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@esm-bundle/chai": "^4.3.4",
51
- "@vaadin/testing-helpers": "^0.3.2",
51
+ "@vaadin/testing-helpers": "^0.4.0",
52
52
  "lit": "^2.0.0",
53
53
  "sinon": "^13.0.2"
54
54
  },
@@ -56,5 +56,5 @@
56
56
  "web-types.json",
57
57
  "web-types.lit.json"
58
58
  ],
59
- "gitHead": "7e29eee4d522fb7b03ac8e7e385e9057d71c79ce"
59
+ "gitHead": "a423ad309c12b4e4f847737ee9f491f83ea60ff0"
60
60
  }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2018 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { ComboBoxDefaultItem, ComboBoxItemMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-item-mixin.js';
7
+ import type { DirMixinClass } from '@vaadin/component-base/src/dir-mixin.js';
8
+ import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
+ import type { MultiSelectComboBox } from './vaadin-multi-select-combo-box.js';
10
+
11
+ /**
12
+ * An item element used by the `<vaadin-multi-select-combo-box>` dropdown.
13
+ *
14
+ * ### Styling
15
+ *
16
+ * The following shadow DOM parts are available for styling:
17
+ *
18
+ * Part name | Description
19
+ * ------------|--------------
20
+ * `checkmark` | The graphical checkmark shown for a selected item
21
+ * `content` | The element that wraps the item content
22
+ *
23
+ * The following state attributes are exposed for styling:
24
+ *
25
+ * Attribute | Description
26
+ * -------------|-------------
27
+ * `selected` | Set when the item is selected
28
+ * `focused` | Set when the item is focused
29
+ *
30
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
31
+ */
32
+ declare class MultiSelectComboBoxItem extends HTMLElement {}
33
+
34
+ interface MultiSelectComboBoxItem<TItem = ComboBoxDefaultItem>
35
+ extends ComboBoxItemMixinClass<TItem, MultiSelectComboBox>,
36
+ DirMixinClass,
37
+ ThemableMixinClass {}
38
+
39
+ declare global {
40
+ interface HTMLElementTagNameMap {
41
+ 'vaadin-multi-select-combo-box-item': MultiSelectComboBoxItem;
42
+ }
43
+ }
44
+
45
+ export { MultiSelectComboBoxItem };
@@ -3,35 +3,59 @@
3
3
  * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { ComboBoxItem } from '@vaadin/combo-box/src/vaadin-combo-box-item.js';
6
+ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
+ import { ComboBoxItemMixin } from '@vaadin/combo-box/src/vaadin-combo-box-item-mixin.js';
8
+ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
10
 
8
11
  /**
9
- * An element used for items in `<vaadin-multi-select-combo-box>`.
12
+ * An item element used by the `<vaadin-multi-select-combo-box>` dropdown.
10
13
  *
11
14
  * ### Styling
12
15
  *
13
16
  * The following shadow DOM parts are available for styling:
14
17
  *
15
- * Part name | Description
16
- * ----------|-------------
17
- * `content` | The element that wraps the item content
18
+ * Part name | Description
19
+ * ------------|--------------
20
+ * `checkmark` | The graphical checkmark shown for a selected item
21
+ * `content` | The element that wraps the item content
18
22
  *
19
23
  * The following state attributes are exposed for styling:
20
24
  *
21
- * Attribute | Description | Part name
22
- * -----------|-------------------------------|-----------
23
- * `selected` | Set when the item is selected | :host
24
- * `focused` | Set when the item is focused | :host
25
+ * Attribute | Description
26
+ * -------------|-------------
27
+ * `selected` | Set when the item is selected
28
+ * `focused` | Set when the item is focused
25
29
  *
26
30
  * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
27
31
  *
28
- * @extends ComboBoxItem
32
+ * @mixes ComboBoxItemMixin
33
+ * @mixes ThemableMixin
34
+ * @mixes DirMixin
29
35
  * @private
30
36
  */
31
- class MultiSelectComboBoxItem extends ComboBoxItem {
37
+ export class MultiSelectComboBoxItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(PolymerElement))) {
32
38
  static get is() {
33
39
  return 'vaadin-multi-select-combo-box-item';
34
40
  }
41
+
42
+ static get template() {
43
+ return html`
44
+ <style>
45
+ :host {
46
+ display: block;
47
+ }
48
+
49
+ :host([hidden]) {
50
+ display: none !important;
51
+ }
52
+ </style>
53
+ <span part="checkmark" aria-hidden="true"></span>
54
+ <div part="content">
55
+ <slot></slot>
56
+ </div>
57
+ `;
58
+ }
35
59
  }
36
60
 
37
61
  customElements.define(MultiSelectComboBoxItem.is, MultiSelectComboBoxItem);
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { ComboBoxOverlayMixin } from '@vaadin/combo-box/src/vaadin-combo-box-overlay-mixin.js';
7
+ import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
8
+
9
+ /**
10
+ * An element used internally by `<vaadin-multi-select-combo-box>`. Not intended to be used separately.
11
+ */
12
+ declare class MultiSelectComboBoxOverlay extends ComboBoxOverlayMixin(Overlay) {}
13
+
14
+ declare global {
15
+ interface HTMLElementTagNameMap {
16
+ 'vaadin-multi-select-combo-box-overlay': MultiSelectComboBoxOverlay;
17
+ }
18
+ }
19
+
20
+ export { MultiSelectComboBoxOverlay };
@@ -3,7 +3,8 @@
3
3
  * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { ComboBoxOverlay } from '@vaadin/combo-box/src/vaadin-combo-box-overlay.js';
6
+ import { ComboBoxOverlayMixin } from '@vaadin/combo-box/src/vaadin-combo-box-overlay-mixin.js';
7
+ import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
7
8
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
9
 
9
10
  registerStyles(
@@ -15,20 +16,44 @@ registerStyles(
15
16
  var(--_vaadin-multi-select-combo-box-overlay-default-width, auto)
16
17
  );
17
18
  }
19
+
20
+ [part='content'] {
21
+ display: flex;
22
+ flex-direction: column;
23
+ height: 100%;
24
+ }
18
25
  `,
19
26
  { moduleId: 'vaadin-multi-select-combo-box-overlay-styles' },
20
27
  );
21
28
 
29
+ let memoizedTemplate;
30
+
22
31
  /**
23
32
  * An element used internally by `<vaadin-multi-select-combo-box>`. Not intended to be used separately.
24
33
  *
25
34
  * @extends ComboBoxOverlay
26
35
  * @private
27
36
  */
28
- class MultiSelectComboBoxOverlay extends ComboBoxOverlay {
37
+ class MultiSelectComboBoxOverlay extends ComboBoxOverlayMixin(Overlay) {
29
38
  static get is() {
30
39
  return 'vaadin-multi-select-combo-box-overlay';
31
40
  }
41
+
42
+ static get template() {
43
+ if (!memoizedTemplate) {
44
+ memoizedTemplate = super.template.cloneNode(true);
45
+
46
+ const overlay = memoizedTemplate.content.querySelector('[part~="overlay"]');
47
+ overlay.removeAttribute('tabindex');
48
+
49
+ const loader = document.createElement('div');
50
+ loader.setAttribute('part', 'loader');
51
+
52
+ overlay.insertBefore(loader, overlay.firstElementChild);
53
+ }
54
+
55
+ return memoizedTemplate;
56
+ }
32
57
  }
33
58
 
34
59
  customElements.define(MultiSelectComboBoxOverlay.is, MultiSelectComboBoxOverlay);
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { ComboBoxScrollerMixin } from '@vaadin/combo-box/src/vaadin-combo-box-scroller-mixin.js';
7
+
8
+ /**
9
+ * An element used internally by `<vaadin-multi-select-combo-box>`. Not intended to be used separately.
10
+ */
11
+ declare class MultiSelectComboBoxScroller extends ComboBoxScrollerMixin(HTMLElement) {}
12
+
13
+ declare global {
14
+ interface HTMLElementTagNameMap {
15
+ 'vaadin-multi-select-combo-box-scroller': MultiSelectComboBoxScroller;
16
+ }
17
+ }
18
+
19
+ export { MultiSelectComboBoxScroller };
@@ -3,20 +3,52 @@
3
3
  * Copyright (c) 2021 - 2023 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, PolymerElement } from '@polymer/polymer/polymer-element.js';
6
7
  import { ComboBoxPlaceholder } from '@vaadin/combo-box/src/vaadin-combo-box-placeholder.js';
7
- import { ComboBoxScroller } from '@vaadin/combo-box/src/vaadin-combo-box-scroller.js';
8
+ import { ComboBoxScrollerMixin } from '@vaadin/combo-box/src/vaadin-combo-box-scroller-mixin.js';
8
9
 
9
10
  /**
10
11
  * An element used internally by `<vaadin-multi-select-combo-box>`. Not intended to be used separately.
11
12
  *
12
- * @extends ComboBoxScroller
13
+ * @extends HTMLElement
14
+ * @mixes ComboBoxScrollerMixin
13
15
  * @private
14
16
  */
15
- class MultiSelectComboBoxScroller extends ComboBoxScroller {
17
+ export class MultiSelectComboBoxScroller extends ComboBoxScrollerMixin(PolymerElement) {
16
18
  static get is() {
17
19
  return 'vaadin-multi-select-combo-box-scroller';
18
20
  }
19
21
 
22
+ static get template() {
23
+ return html`
24
+ <style>
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-multi-select-combo-box-items-container-border-width);
42
+ border-style: var(--_vaadin-multi-select-combo-box-items-container-border-style);
43
+ border-color: var(--_vaadin-multi-select-combo-box-items-container-border-color, transparent);
44
+ }
45
+ </style>
46
+ <div id="selector">
47
+ <slot></slot>
48
+ </div>
49
+ `;
50
+ }
51
+
20
52
  /** @protected */
21
53
  ready() {
22
54
  super.ready();
@@ -24,30 +56,32 @@ class MultiSelectComboBoxScroller extends ComboBoxScroller {
24
56
  this.setAttribute('aria-multiselectable', 'true');
25
57
  }
26
58
 
27
- /** @private */
28
- __getAriaSelected(_focusedIndex, itemIndex) {
29
- const item = this.items[itemIndex];
30
- return this.__isItemSelected(item, null, this.itemIdPath).toString();
31
- }
32
-
33
- /** @private */
34
- __isItemSelected(item, _selectedItem, itemIdPath) {
59
+ /**
60
+ * @protected
61
+ * @override
62
+ */
63
+ _isItemSelected(item, _selectedItem, itemIdPath) {
35
64
  if (item instanceof ComboBoxPlaceholder) {
36
65
  return false;
37
66
  }
38
67
 
39
- if (this.comboBox.readonly) {
68
+ if (this.owner.readonly) {
40
69
  return false;
41
70
  }
42
71
 
43
- return this.comboBox._findIndex(item, this.comboBox.selectedItems, itemIdPath) > -1;
72
+ return this.owner._findIndex(item, this.owner.selectedItems, itemIdPath) > -1;
44
73
  }
45
74
 
46
- /** @private */
47
- __updateElement(el, index) {
48
- super.__updateElement(el, index);
75
+ /**
76
+ * @param {HTMLElement} el
77
+ * @param {number} index
78
+ * @protected
79
+ * @override
80
+ */
81
+ _updateElement(el, index) {
82
+ super._updateElement(el, index);
49
83
 
50
- el.toggleAttribute('readonly', this.comboBox.readonly);
84
+ el.toggleAttribute('readonly', this.owner.readonly);
51
85
  }
52
86
  }
53
87
 
@@ -7,22 +7,44 @@ import '@vaadin/vaadin-lumo-styles/color.js';
7
7
  import '@vaadin/vaadin-lumo-styles/font-icons.js';
8
8
  import '@vaadin/vaadin-lumo-styles/style.js';
9
9
  import '@vaadin/vaadin-lumo-styles/typography.js';
10
+ import { comboBoxItem } from '@vaadin/combo-box/theme/lumo/vaadin-combo-box-item-styles.js';
11
+ import { comboBoxLoader, comboBoxOverlay } from '@vaadin/combo-box/theme/lumo/vaadin-combo-box-overlay-styles.js';
12
+ import { item } from '@vaadin/item/theme/lumo/vaadin-item-styles.js';
10
13
  import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
14
+ import { loader } from '@vaadin/vaadin-lumo-styles/mixins/loader.js';
15
+ import { menuOverlayCore } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
16
+ import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
11
17
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
18
 
19
+ const multiSelectComboBoxItem = css`
20
+ @media (any-hover: hover) {
21
+ :host(:hover[readonly]) {
22
+ background-color: transparent;
23
+ cursor: default;
24
+ }
25
+ }
26
+ `;
27
+
28
+ registerStyles('vaadin-multi-select-combo-box-item', [item, comboBoxItem, multiSelectComboBoxItem], {
29
+ moduleId: 'lumo-multi-select-combo-box-item',
30
+ });
31
+
13
32
  registerStyles(
14
- 'vaadin-multi-select-combo-box-item',
15
- css`
16
- @media (any-hover: hover) {
17
- :host(:hover[readonly]) {
18
- background-color: transparent;
19
- cursor: default;
33
+ 'vaadin-multi-select-combo-box-overlay',
34
+ [
35
+ overlay,
36
+ menuOverlayCore,
37
+ comboBoxOverlay,
38
+ loader,
39
+ comboBoxLoader,
40
+ css`
41
+ :host {
42
+ --_vaadin-multi-select-combo-box-items-container-border-width: var(--lumo-space-xs);
43
+ --_vaadin-multi-select-combo-box-items-container-border-style: solid;
20
44
  }
21
- }
22
- `,
23
- {
24
- moduleId: 'lumo-multi-select-combo-box-item',
25
- },
45
+ `,
46
+ ],
47
+ { moduleId: 'lumo-multi-select-combo-box-overlay' },
26
48
  );
27
49
 
28
50
  const multiSelectComboBox = css`
@@ -3,9 +3,8 @@
3
3
  * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import '@vaadin/combo-box/theme/lumo/vaadin-combo-box-item-styles.js';
7
- import '@vaadin/combo-box/theme/lumo/vaadin-combo-box-dropdown-styles.js';
8
6
  import '@vaadin/input-container/theme/lumo/vaadin-input-container.js';
7
+ import '@vaadin/overlay/theme/lumo/vaadin-overlay.js';
9
8
  import './vaadin-multi-select-combo-box-chip-styles.js';
10
9
  import './vaadin-multi-select-combo-box-styles.js';
11
10
  import '../../src/vaadin-multi-select-combo-box.js';
@@ -6,22 +6,42 @@
6
6
  import '@vaadin/vaadin-material-styles/color.js';
7
7
  import '@vaadin/vaadin-material-styles/font-icons.js';
8
8
  import '@vaadin/vaadin-material-styles/typography.js';
9
+ import { comboBoxItem } from '@vaadin/combo-box/theme/material/vaadin-combo-box-item-styles.js';
10
+ import { comboBoxLoader, comboBoxOverlay } from '@vaadin/combo-box/theme/material/vaadin-combo-box-overlay-styles.js';
11
+ import { item } from '@vaadin/item/theme/material/vaadin-item-styles.js';
9
12
  import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
13
+ import { loader } from '@vaadin/vaadin-material-styles/mixins/loader.js';
14
+ import { menuOverlay } from '@vaadin/vaadin-material-styles/mixins/menu-overlay.js';
10
15
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
16
 
17
+ const multiSelectComboBoxItem = css`
18
+ @media (any-hover: hover) {
19
+ :host(:hover[readonly]) {
20
+ background-color: transparent;
21
+ cursor: default;
22
+ }
23
+ }
24
+ `;
25
+
26
+ registerStyles('vaadin-multi-select-combo-box-item', [item, comboBoxItem, multiSelectComboBoxItem], {
27
+ moduleId: 'material-multi-select-combo-box-item',
28
+ });
29
+
12
30
  registerStyles(
13
- 'vaadin-multi-select-combo-box-item',
14
- css`
15
- @media (any-hover: hover) {
16
- :host(:hover[readonly]) {
17
- background-color: transparent;
18
- cursor: default;
31
+ 'vaadin-multi-select-combo-box-overlay',
32
+ [
33
+ menuOverlay,
34
+ comboBoxOverlay,
35
+ loader,
36
+ comboBoxLoader,
37
+ css`
38
+ :host {
39
+ --_vaadin-multi-select-combo-box-items-container-border-width: 8px 0;
40
+ --_vaadin-multi-select-combo-box-items-container-border-style: solid;
19
41
  }
20
- }
21
- `,
22
- {
23
- moduleId: 'material-multi-select-combo-box-item',
24
- },
42
+ `,
43
+ ],
44
+ { moduleId: 'material-multi-select-combo-box-overlay' },
25
45
  );
26
46
 
27
47
  const multiSelectComboBox = css`
@@ -3,9 +3,8 @@
3
3
  * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import '@vaadin/combo-box/theme/material/vaadin-combo-box-item-styles.js';
7
- import '@vaadin/combo-box/theme/material/vaadin-combo-box-dropdown-styles.js';
8
6
  import '@vaadin/input-container/theme/material/vaadin-input-container.js';
7
+ import '@vaadin/overlay/theme/material/vaadin-overlay.js';
9
8
  import './vaadin-multi-select-combo-box-chip-styles.js';
10
9
  import './vaadin-multi-select-combo-box-styles.js';
11
10
  import '../../src/vaadin-multi-select-combo-box.js';
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/multi-select-combo-box",
4
- "version": "24.0.0-alpha12",
4
+ "version": "24.0.0-alpha13",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/multi-select-combo-box",
4
- "version": "24.0.0-alpha12",
4
+ "version": "24.0.0-alpha13",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {