@vaadin/multi-select-combo-box 24.8.0-alpha8 → 24.8.0-beta1

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.8.0-alpha8",
3
+ "version": "24.8.0-beta1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,22 +39,22 @@
39
39
  "dependencies": {
40
40
  "@open-wc/dedupe-mixin": "^1.3.0",
41
41
  "@polymer/polymer": "^3.0.0",
42
- "@vaadin/a11y-base": "24.8.0-alpha8",
43
- "@vaadin/combo-box": "24.8.0-alpha8",
44
- "@vaadin/component-base": "24.8.0-alpha8",
45
- "@vaadin/field-base": "24.8.0-alpha8",
46
- "@vaadin/input-container": "24.8.0-alpha8",
47
- "@vaadin/item": "24.8.0-alpha8",
48
- "@vaadin/lit-renderer": "24.8.0-alpha8",
49
- "@vaadin/overlay": "24.8.0-alpha8",
50
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha8",
51
- "@vaadin/vaadin-material-styles": "24.8.0-alpha8",
52
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
42
+ "@vaadin/a11y-base": "24.8.0-beta1",
43
+ "@vaadin/combo-box": "24.8.0-beta1",
44
+ "@vaadin/component-base": "24.8.0-beta1",
45
+ "@vaadin/field-base": "24.8.0-beta1",
46
+ "@vaadin/input-container": "24.8.0-beta1",
47
+ "@vaadin/item": "24.8.0-beta1",
48
+ "@vaadin/lit-renderer": "24.8.0-beta1",
49
+ "@vaadin/overlay": "24.8.0-beta1",
50
+ "@vaadin/vaadin-lumo-styles": "24.8.0-beta1",
51
+ "@vaadin/vaadin-material-styles": "24.8.0-beta1",
52
+ "@vaadin/vaadin-themable-mixin": "24.8.0-beta1",
53
53
  "lit": "^3.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@vaadin/chai-plugins": "24.8.0-alpha8",
57
- "@vaadin/test-runner-commands": "24.8.0-alpha8",
56
+ "@vaadin/chai-plugins": "24.8.0-beta1",
57
+ "@vaadin/test-runner-commands": "24.8.0-beta1",
58
58
  "@vaadin/testing-helpers": "^1.1.0",
59
59
  "sinon": "^18.0.0"
60
60
  },
@@ -62,5 +62,5 @@
62
62
  "web-types.json",
63
63
  "web-types.lit.json"
64
64
  ],
65
- "gitHead": "d914bb8f669d7e3d1981feb8eac05688ab9870b4"
65
+ "gitHead": "57ce3a90de99e49049312b0ba4041d3e7542e9d8"
66
66
  }
@@ -10,13 +10,22 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
10
10
  import { multiSelectComboBoxChip } from './vaadin-multi-select-combo-box-styles.js';
11
11
 
12
12
  /**
13
- * LitElement based version of `<vaadin-multi-select-combo-box-chip>` web component.
13
+ * An element used by `<vaadin-multi-select-combo-box>` to display selected items.
14
14
  *
15
- * ## Disclaimer
15
+ * ### Styling
16
16
  *
17
- * This component is an experiment and not yet a part of Vaadin platform.
18
- * There is no ETA regarding specific Vaadin version where it'll land.
19
- * Feel free to try this code in your apps as per Apache 2.0 license.
17
+ * The following shadow DOM parts are available for styling:
18
+ *
19
+ * Part name | Description
20
+ * -----------------|-------------
21
+ * `label` | Element containing the label
22
+ * `remove-button` | Remove button
23
+ *
24
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
25
+ *
26
+ * @customElement
27
+ * @extends HTMLElement
28
+ * @private
20
29
  */
21
30
  class MultiSelectComboBoxChip extends ThemableMixin(PolylitMixin(LitElement)) {
22
31
  static get is() {
@@ -11,13 +11,31 @@ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
11
11
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
12
 
13
13
  /**
14
- * LitElement based version of `<vaadin-multi-select-combo-box-item>` web component.
14
+ * An item element used by the `<vaadin-multi-select-combo-box>` dropdown.
15
15
  *
16
- * ## Disclaimer
16
+ * ### Styling
17
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.
18
+ * The following shadow DOM parts are available for styling:
19
+ *
20
+ * Part name | Description
21
+ * ------------|--------------
22
+ * `checkmark` | The graphical checkmark shown for a selected item
23
+ * `content` | The element that wraps the item content
24
+ *
25
+ * The following state attributes are exposed for styling:
26
+ *
27
+ * Attribute | Description
28
+ * -------------|-------------
29
+ * `selected` | Set when the item is selected
30
+ * `focused` | Set when the item is focused
31
+ *
32
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
33
+ *
34
+ * @customElement
35
+ * @mixes ComboBoxItemMixin
36
+ * @mixes ThemableMixin
37
+ * @mixes DirMixin
38
+ * @private
21
39
  */
22
40
  export class MultiSelectComboBoxItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
23
41
  static get is() {
@@ -758,11 +758,26 @@ export const MultiSelectComboBoxMixin = (superClass) =>
758
758
  __updateTopGroup(selectedItemsOnTop, selectedItems, opened) {
759
759
  if (!selectedItemsOnTop) {
760
760
  this._topGroup = [];
761
- } else if (!opened) {
761
+ } else if (!opened || this.__needToSyncTopGroup()) {
762
762
  this._topGroup = [...selectedItems];
763
763
  }
764
764
  }
765
765
 
766
+ /** @private */
767
+ __needToSyncTopGroup() {
768
+ // Only sync for object items
769
+ if (!this.itemIdPath) {
770
+ return false;
771
+ }
772
+ return (
773
+ this._topGroup &&
774
+ this._topGroup.some((item) => {
775
+ const selectedItem = this.selectedItems[this._findIndex(item, this.selectedItems, this.itemIdPath)];
776
+ return selectedItem && item !== selectedItem;
777
+ })
778
+ );
779
+ }
780
+
766
781
  /** @private */
767
782
  __createChip(item) {
768
783
  const chip = document.createElement('vaadin-multi-select-combo-box-chip');
@@ -877,14 +892,17 @@ export const MultiSelectComboBoxMixin = (superClass) =>
877
892
  this.insertBefore(chip, refNode);
878
893
 
879
894
  // When auto expanding vertically, no need to measure remaining width
880
- if (!this.autoExpandVertically && this.$.chips.clientWidth > remainingWidth) {
881
- // Always show at least last selected item as a chip
882
- if (refNode === null) {
883
- chip.style.maxWidth = `${Math.max(chipMinWidth, remainingWidth)}px`;
884
- } else {
885
- chip.remove();
886
- break;
895
+ if (!this.autoExpandVertically) {
896
+ if (this.$.chips.clientWidth > remainingWidth) {
897
+ // If there is no more space for chips, or if there is at least one
898
+ // chip already shown, collapse all remaining chips to the overflow
899
+ if (remainingWidth < chipMinWidth || refNode !== null) {
900
+ chip.remove();
901
+ break;
902
+ }
887
903
  }
904
+
905
+ chip.style.maxWidth = `${remainingWidth}px`;
888
906
  }
889
907
 
890
908
  items.pop();
@@ -7,6 +7,7 @@ import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
7
 
8
8
  export const multiSelectComboBox = css`
9
9
  :host {
10
+ max-width: 100%;
10
11
  --input-min-width: var(--vaadin-multi-select-combo-box-input-min-width, 4em);
11
12
  --_chip-min-width: var(--vaadin-multi-select-combo-box-chip-min-width, 50px);
12
13
  }
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.8.0-alpha8",
4
+ "version": "24.8.0-beta1",
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.8.0-alpha8",
4
+ "version": "24.8.0-beta1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -1 +0,0 @@
1
- export * from './vaadin-multi-select-combo-box.js';