@vaadin/multi-select-combo-box 24.4.6 → 24.5.0-alpha10

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 CHANGED
@@ -54,7 +54,7 @@ import '@vaadin/multi-select-combo-box/src/vaadin-multi-select-combo-box.js';
54
54
 
55
55
  ## Contributing
56
56
 
57
- Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
57
+ 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.
58
58
 
59
59
  ## License
60
60
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/multi-select-combo-box",
3
- "version": "24.4.6",
3
+ "version": "24.5.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,27 +38,27 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@polymer/polymer": "^3.0.0",
41
- "@vaadin/a11y-base": "~24.4.6",
42
- "@vaadin/combo-box": "~24.4.6",
43
- "@vaadin/component-base": "~24.4.6",
44
- "@vaadin/field-base": "~24.4.6",
45
- "@vaadin/input-container": "~24.4.6",
46
- "@vaadin/item": "~24.4.6",
47
- "@vaadin/lit-renderer": "~24.4.6",
48
- "@vaadin/overlay": "~24.4.6",
49
- "@vaadin/vaadin-lumo-styles": "~24.4.6",
50
- "@vaadin/vaadin-material-styles": "~24.4.6",
51
- "@vaadin/vaadin-themable-mixin": "~24.4.6"
41
+ "@vaadin/a11y-base": "24.5.0-alpha10",
42
+ "@vaadin/combo-box": "24.5.0-alpha10",
43
+ "@vaadin/component-base": "24.5.0-alpha10",
44
+ "@vaadin/field-base": "24.5.0-alpha10",
45
+ "@vaadin/input-container": "24.5.0-alpha10",
46
+ "@vaadin/item": "24.5.0-alpha10",
47
+ "@vaadin/lit-renderer": "24.5.0-alpha10",
48
+ "@vaadin/overlay": "24.5.0-alpha10",
49
+ "@vaadin/vaadin-lumo-styles": "24.5.0-alpha10",
50
+ "@vaadin/vaadin-material-styles": "24.5.0-alpha10",
51
+ "@vaadin/vaadin-themable-mixin": "24.5.0-alpha10"
52
52
  },
53
53
  "devDependencies": {
54
- "@esm-bundle/chai": "^4.3.4",
55
- "@vaadin/testing-helpers": "^0.6.0",
54
+ "@vaadin/chai-plugins": "24.5.0-alpha10",
55
+ "@vaadin/testing-helpers": "^1.0.0",
56
56
  "lit": "^3.0.0",
57
- "sinon": "^13.0.2"
57
+ "sinon": "^18.0.0"
58
58
  },
59
59
  "web-types": [
60
60
  "web-types.json",
61
61
  "web-types.lit.json"
62
62
  ],
63
- "gitHead": "46d3cdb72eb99d544c7bb86c3de95043b9e5857f"
63
+ "gitHead": "6f9c37308031af872a98017bfab4de89aeacda51"
64
64
  }
@@ -231,6 +231,14 @@ declare class MultiSelectComboBox<TItem = ComboBoxDefaultItem> extends HTMLEleme
231
231
  */
232
232
  items: TItem[] | undefined;
233
233
 
234
+ /**
235
+ * A function used to generate CSS class names for dropdown
236
+ * items and selected chips based on the item. The return
237
+ * value should be the generated class name as a string, or
238
+ * multiple class names separated by whitespace characters.
239
+ */
240
+ itemClassNameGenerator: (item: TItem) => string;
241
+
234
242
  /**
235
243
  * The item property used for a visual representation of the item.
236
244
  * @attr {string} item-label-path
@@ -180,6 +180,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
180
180
  filtered-items="[[filteredItems]]"
181
181
  selected-items="[[selectedItems]]"
182
182
  selected-items-on-top="[[selectedItemsOnTop]]"
183
+ item-class-name-generator="[[itemClassNameGenerator]]"
183
184
  top-group="[[_topGroup]]"
184
185
  opened="{{opened}}"
185
186
  renderer="[[renderer]]"
@@ -279,6 +280,17 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
279
280
  type: Array,
280
281
  },
281
282
 
283
+ /**
284
+ * A function used to generate CSS class names for dropdown
285
+ * items and selected chips based on the item. The return
286
+ * value should be the generated class name as a string, or
287
+ * multiple class names separated by whitespace characters.
288
+ */
289
+ itemClassNameGenerator: {
290
+ type: Object,
291
+ observer: '__itemClassNameGeneratorChanged',
292
+ },
293
+
282
294
  /**
283
295
  * The item property used for a visual representation of the item.
284
296
  * @attr {string} item-label-path
@@ -760,6 +772,13 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
760
772
  }
761
773
  }
762
774
 
775
+ /** @private */
776
+ __itemClassNameGeneratorChanged(generator, oldGenerator) {
777
+ if (generator || oldGenerator) {
778
+ this.__updateChips();
779
+ }
780
+ }
781
+
763
782
  /** @private */
764
783
  _pageSizeChanged(pageSize, oldPageSize) {
765
784
  if (Math.floor(pageSize) !== pageSize || pageSize <= 0) {
@@ -936,6 +955,10 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
936
955
  chip.label = label;
937
956
  chip.setAttribute('title', label);
938
957
 
958
+ if (typeof this.itemClassNameGenerator === 'function') {
959
+ chip.className = this.itemClassNameGenerator(item);
960
+ }
961
+
939
962
  chip.addEventListener('item-removed', (e) => this._onItemRemoved(e));
940
963
  chip.addEventListener('mousedown', (e) => this._preventBlur(e));
941
964
 
@@ -23,6 +23,10 @@ const chip = css`
23
23
  -moz-osx-font-smoothing: grayscale;
24
24
  }
25
25
 
26
+ :host([disabled]) {
27
+ background-color: var(--lumo-contrast-10pct);
28
+ }
29
+
26
30
  :host([focused]) [part='remove-button'] {
27
31
  color: inherit;
28
32
  }
@@ -72,8 +72,8 @@ const multiSelectComboBox = css`
72
72
  }
73
73
 
74
74
  /* Override input-container styles */
75
- ::slotted([slot='chip']),
76
- ::slotted([slot='overflow']) {
75
+ [part='input-field'] ::slotted([slot='chip']),
76
+ [part='input-field'] ::slotted([slot='overflow']) {
77
77
  min-height: auto;
78
78
  padding: 0.3125em calc(0.5em + var(--lumo-border-radius-s) / 4);
79
79
  color: var(--lumo-body-text-color);
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.4.6",
4
+ "version": "24.5.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -596,6 +596,17 @@
596
596
  ]
597
597
  }
598
598
  },
599
+ {
600
+ "name": "itemClassNameGenerator",
601
+ "description": "A function used to generate CSS class names for dropdown\nitems and selected chips based on the item. The return\nvalue should be the generated class name as a string, or\nmultiple class names separated by whitespace characters.",
602
+ "value": {
603
+ "type": [
604
+ "Object",
605
+ "null",
606
+ "undefined"
607
+ ]
608
+ }
609
+ },
599
610
  {
600
611
  "name": "itemLabelPath",
601
612
  "description": "The item property used for a visual representation of the item.",
@@ -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.4.6",
4
+ "version": "24.5.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -194,6 +194,13 @@
194
194
  "kind": "expression"
195
195
  }
196
196
  },
197
+ {
198
+ "name": ".itemClassNameGenerator",
199
+ "description": "A function used to generate CSS class names for dropdown\nitems and selected chips based on the item. The return\nvalue should be the generated class name as a string, or\nmultiple class names separated by whitespace characters.",
200
+ "value": {
201
+ "kind": "expression"
202
+ }
203
+ },
197
204
  {
198
205
  "name": ".itemLabelPath",
199
206
  "description": "The item property used for a visual representation of the item.",