@vaadin/multi-select-combo-box 25.0.0-alpha18 → 25.0.0-alpha19

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": "25.0.0-alpha18",
3
+ "version": "25.0.0-alpha19",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,27 +36,27 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
- "@vaadin/a11y-base": "25.0.0-alpha18",
40
- "@vaadin/combo-box": "25.0.0-alpha18",
41
- "@vaadin/component-base": "25.0.0-alpha18",
42
- "@vaadin/field-base": "25.0.0-alpha18",
43
- "@vaadin/input-container": "25.0.0-alpha18",
44
- "@vaadin/item": "25.0.0-alpha18",
45
- "@vaadin/lit-renderer": "25.0.0-alpha18",
46
- "@vaadin/overlay": "25.0.0-alpha18",
47
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha18",
39
+ "@vaadin/a11y-base": "25.0.0-alpha19",
40
+ "@vaadin/combo-box": "25.0.0-alpha19",
41
+ "@vaadin/component-base": "25.0.0-alpha19",
42
+ "@vaadin/field-base": "25.0.0-alpha19",
43
+ "@vaadin/input-container": "25.0.0-alpha19",
44
+ "@vaadin/item": "25.0.0-alpha19",
45
+ "@vaadin/lit-renderer": "25.0.0-alpha19",
46
+ "@vaadin/overlay": "25.0.0-alpha19",
47
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha19",
48
48
  "lit": "^3.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@vaadin/chai-plugins": "25.0.0-alpha18",
52
- "@vaadin/test-runner-commands": "25.0.0-alpha18",
51
+ "@vaadin/chai-plugins": "25.0.0-alpha19",
52
+ "@vaadin/test-runner-commands": "25.0.0-alpha19",
53
53
  "@vaadin/testing-helpers": "^2.0.0",
54
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha18",
54
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha19",
55
55
  "sinon": "^21.0.0"
56
56
  },
57
57
  "web-types": [
58
58
  "web-types.json",
59
59
  "web-types.lit.json"
60
60
  ],
61
- "gitHead": "cb5cafb5687a117ebead1b81e2116991cec13abe"
61
+ "gitHead": "1f9af1ce5f0bae8daff044176c8a8df697763881"
62
62
  }
@@ -13,6 +13,7 @@ import type { ComboBoxBaseMixinClass } from '@vaadin/combo-box/src/vaadin-combo-
13
13
  import type { ComboBoxDataProviderMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-data-provider-mixin.js';
14
14
  import type { ComboBoxItemsMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-items-mixin.js';
15
15
  import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
16
+ import type { I18nMixinClass } from '@vaadin/component-base/src/i18n-mixin.js';
16
17
  import type { ResizeMixinClass } from '@vaadin/component-base/src/resize-mixin.js';
17
18
  import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
18
19
  import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js';
@@ -31,11 +32,11 @@ export type MultiSelectComboBoxRenderer<TItem> = (
31
32
  ) => void;
32
33
 
33
34
  export interface MultiSelectComboBoxI18n {
34
- cleared: string;
35
- focused: string;
36
- selected: string;
37
- deselected: string;
38
- total: string;
35
+ cleared?: string;
36
+ focused?: string;
37
+ selected?: string;
38
+ deselected?: string;
39
+ total?: string;
39
40
  }
40
41
 
41
42
  export declare function MultiSelectComboBoxMixin<TItem, T extends Constructor<HTMLElement>>(
@@ -49,6 +50,7 @@ export declare function MultiSelectComboBoxMixin<TItem, T extends Constructor<HT
49
50
  Constructor<DisabledMixinClass> &
50
51
  Constructor<FieldMixinClass> &
51
52
  Constructor<FocusMixinClass> &
53
+ Constructor<I18nMixinClass<MultiSelectComboBoxI18n>> &
52
54
  Constructor<InputConstraintsMixinClass> &
53
55
  Constructor<InputControlMixinClass> &
54
56
  Constructor<InputMixinClass> &
@@ -97,12 +99,12 @@ export declare class MultiSelectComboBoxMixinClass<TItem> {
97
99
  itemIdPath: string;
98
100
 
99
101
  /**
100
- * The object used to localize this component.
101
- * To change the default localization, replace the entire
102
- * _i18n_ object or just the property you want to modify.
102
+ * The object used to localize this component. To change the default
103
+ * localization, replace this with an object that provides all properties, or
104
+ * just the individual properties you want to change.
103
105
  *
104
106
  * The object has the following JSON structure and default values:
105
- * ```
107
+ * ```js
106
108
  * {
107
109
  * // Screen reader announcement on clear button click.
108
110
  * cleared: 'Selection cleared',
@@ -7,6 +7,7 @@ import { announce } from '@vaadin/a11y-base/src/announce.js';
7
7
  import { ComboBoxDataProviderMixin } from '@vaadin/combo-box/src/vaadin-combo-box-data-provider-mixin.js';
8
8
  import { ComboBoxItemsMixin } from '@vaadin/combo-box/src/vaadin-combo-box-items-mixin.js';
9
9
  import { ComboBoxPlaceholder } from '@vaadin/combo-box/src/vaadin-combo-box-placeholder.js';
10
+ import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
10
11
  import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
11
12
  import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
12
13
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
@@ -14,16 +15,26 @@ import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js
14
15
  import { InputController } from '@vaadin/field-base/src/input-controller.js';
15
16
  import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
16
17
 
18
+ const DEFAULT_I18N = {
19
+ cleared: 'Selection cleared',
20
+ focused: 'focused. Press Backspace to remove',
21
+ selected: 'added to selection',
22
+ deselected: 'removed from selection',
23
+ total: '{count} items selected',
24
+ };
25
+
17
26
  /**
18
27
  * @polymerMixin
19
28
  * @mixes ComboBoxDataProviderMixin
20
29
  * @mixes ComboBoxItemsMixin
30
+ * @mixes I18nMixin
21
31
  * @mixes InputControlMixin
22
32
  * @mixes ResizeMixin
23
33
  */
24
34
  export const MultiSelectComboBoxMixin = (superClass) =>
25
- class MultiSelectComboBoxMixinClass extends ComboBoxDataProviderMixin(
26
- ComboBoxItemsMixin(InputControlMixin(ResizeMixin(superClass))),
35
+ class MultiSelectComboBoxMixinClass extends I18nMixin(
36
+ DEFAULT_I18N,
37
+ ComboBoxDataProviderMixin(ComboBoxItemsMixin(InputControlMixin(ResizeMixin(superClass)))),
27
38
  ) {
28
39
  static get properties() {
29
40
  return {
@@ -72,43 +83,6 @@ export const MultiSelectComboBoxMixin = (superClass) =>
72
83
  sync: true,
73
84
  },
74
85
 
75
- /**
76
- * The object used to localize this component.
77
- * To change the default localization, replace the entire
78
- * _i18n_ object or just the property you want to modify.
79
- *
80
- * The object has the following JSON structure and default values:
81
- * ```
82
- * {
83
- * // Screen reader announcement on clear button click.
84
- * cleared: 'Selection cleared',
85
- * // Screen reader announcement when a chip is focused.
86
- * focused: ' focused. Press Backspace to remove',
87
- * // Screen reader announcement when item is selected.
88
- * selected: 'added to selection',
89
- * // Screen reader announcement when item is deselected.
90
- * deselected: 'removed from selection',
91
- * // Screen reader announcement of the selected items count.
92
- * // {count} is replaced with the actual count of items.
93
- * total: '{count} items selected',
94
- * }
95
- * ```
96
- * @type {!MultiSelectComboBoxI18n}
97
- * @default {English/US}
98
- */
99
- i18n: {
100
- type: Object,
101
- value: () => {
102
- return {
103
- cleared: 'Selection cleared',
104
- focused: 'focused. Press Backspace to remove',
105
- selected: 'added to selection',
106
- deselected: 'removed from selection',
107
- total: '{count} items selected',
108
- };
109
- },
110
- },
111
-
112
86
  /**
113
87
  * When true, filter string isn't cleared after selecting an item.
114
88
  */
@@ -244,6 +218,37 @@ export const MultiSelectComboBoxMixin = (superClass) =>
244
218
  ];
245
219
  }
246
220
 
221
+ /**
222
+ * The object used to localize this component. To change the default
223
+ * localization, replace this with an object that provides all properties, or
224
+ * just the individual properties you want to change.
225
+ *
226
+ * The object has the following JSON structure and default values:
227
+ * ```js
228
+ * {
229
+ * // Screen reader announcement on clear button click.
230
+ * cleared: 'Selection cleared',
231
+ * // Screen reader announcement when a chip is focused.
232
+ * focused: ' focused. Press Backspace to remove',
233
+ * // Screen reader announcement when item is selected.
234
+ * selected: 'added to selection',
235
+ * // Screen reader announcement when item is deselected.
236
+ * deselected: 'removed from selection',
237
+ * // Screen reader announcement of the selected items count.
238
+ * // {count} is replaced with the actual count of items.
239
+ * total: '{count} items selected',
240
+ * }
241
+ * ```
242
+ * @return {!MultiSelectComboBoxI18n}
243
+ */
244
+ get i18n() {
245
+ return super.i18n;
246
+ }
247
+
248
+ set i18n(value) {
249
+ super.i18n = value;
250
+ }
251
+
247
252
  /** @protected */
248
253
  get slotStyles() {
249
254
  const tag = this.localName;
@@ -384,7 +389,7 @@ export const MultiSelectComboBoxMixin = (superClass) =>
384
389
  clear() {
385
390
  this.__updateSelection([]);
386
391
 
387
- announce(this.i18n.cleared);
392
+ announce(this.__effectiveI18n.cleared);
388
393
  }
389
394
 
390
395
  /**
@@ -750,8 +755,8 @@ export const MultiSelectComboBoxMixin = (superClass) =>
750
755
  /** @private */
751
756
  __announceItem(itemLabel, isSelected, itemCount) {
752
757
  const state = isSelected ? 'selected' : 'deselected';
753
- const total = this.i18n.total.replace('{count}', itemCount || 0);
754
- announce(`${itemLabel} ${this.i18n[state]} ${total}`);
758
+ const total = this.__effectiveI18n.total.replace('{count}', itemCount || 0);
759
+ announce(`${itemLabel} ${this.__effectiveI18n[state]} ${total}`);
755
760
  }
756
761
 
757
762
  /** @private */
@@ -1218,7 +1223,7 @@ export const MultiSelectComboBoxMixin = (superClass) =>
1218
1223
  if (focusedIndex > -1) {
1219
1224
  const item = chips[focusedIndex].item;
1220
1225
  const itemLabel = this._getItemLabel(item);
1221
- announce(`${itemLabel} ${this.i18n.focused}`);
1226
+ announce(`${itemLabel} ${this.__effectiveI18n.focused}`);
1222
1227
  }
1223
1228
  }
1224
1229
  }
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": "25.0.0-alpha18",
4
+ "version": "25.0.0-alpha19",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -109,6 +109,15 @@
109
109
  ]
110
110
  }
111
111
  },
112
+ {
113
+ "name": "i18n",
114
+ "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
115
+ "value": {
116
+ "type": [
117
+ "Object"
118
+ ]
119
+ }
120
+ },
112
121
  {
113
122
  "name": "autofocus",
114
123
  "description": "Specify that this control should have input focus when the page loads.",
@@ -485,6 +494,15 @@
485
494
  ]
486
495
  }
487
496
  },
497
+ {
498
+ "name": "i18n",
499
+ "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n```js\n{\n // Screen reader announcement on clear button click.\n cleared: 'Selection cleared',\n // Screen reader announcement when a chip is focused.\n focused: ' focused. Press Backspace to remove',\n // Screen reader announcement when item is selected.\n selected: 'added to selection',\n // Screen reader announcement when item is deselected.\n deselected: 'removed from selection',\n // Screen reader announcement of the selected items count.\n // {count} is replaced with the actual count of items.\n total: '{count} items selected',\n}\n```",
500
+ "value": {
501
+ "type": [
502
+ "MultiSelectComboBoxI18n"
503
+ ]
504
+ }
505
+ },
488
506
  {
489
507
  "name": "autofocus",
490
508
  "description": "Specify that this control should have input focus when the page loads.",
@@ -694,15 +712,6 @@
694
712
  ]
695
713
  }
696
714
  },
697
- {
698
- "name": "i18n",
699
- "description": "The object used to localize this component.\nTo change the default localization, replace the entire\n_i18n_ object or just the property you want to modify.\n\nThe object has the following JSON structure and default values:\n```\n{\n // Screen reader announcement on clear button click.\n cleared: 'Selection cleared',\n // Screen reader announcement when a chip is focused.\n focused: ' focused. Press Backspace to remove',\n // Screen reader announcement when item is selected.\n selected: 'added to selection',\n // Screen reader announcement when item is deselected.\n deselected: 'removed from selection',\n // Screen reader announcement of the selected items count.\n // {count} is replaced with the actual count of items.\n total: '{count} items selected',\n}\n```",
700
- "value": {
701
- "type": [
702
- "MultiSelectComboBoxI18n"
703
- ]
704
- }
705
- },
706
715
  {
707
716
  "name": "keepFilter",
708
717
  "description": "When true, filter string isn't cleared after selecting an 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": "25.0.0-alpha18",
4
+ "version": "25.0.0-alpha19",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -187,6 +187,13 @@
187
187
  "kind": "expression"
188
188
  }
189
189
  },
190
+ {
191
+ "name": ".i18n",
192
+ "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n```js\n{\n // Screen reader announcement on clear button click.\n cleared: 'Selection cleared',\n // Screen reader announcement when a chip is focused.\n focused: ' focused. Press Backspace to remove',\n // Screen reader announcement when item is selected.\n selected: 'added to selection',\n // Screen reader announcement when item is deselected.\n deselected: 'removed from selection',\n // Screen reader announcement of the selected items count.\n // {count} is replaced with the actual count of items.\n total: '{count} items selected',\n}\n```",
193
+ "value": {
194
+ "kind": "expression"
195
+ }
196
+ },
190
197
  {
191
198
  "name": ".label",
192
199
  "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
@@ -264,13 +271,6 @@
264
271
  "kind": "expression"
265
272
  }
266
273
  },
267
- {
268
- "name": ".i18n",
269
- "description": "The object used to localize this component.\nTo change the default localization, replace the entire\n_i18n_ object or just the property you want to modify.\n\nThe object has the following JSON structure and default values:\n```\n{\n // Screen reader announcement on clear button click.\n cleared: 'Selection cleared',\n // Screen reader announcement when a chip is focused.\n focused: ' focused. Press Backspace to remove',\n // Screen reader announcement when item is selected.\n selected: 'added to selection',\n // Screen reader announcement when item is deselected.\n deselected: 'removed from selection',\n // Screen reader announcement of the selected items count.\n // {count} is replaced with the actual count of items.\n total: '{count} items selected',\n}\n```",
270
- "value": {
271
- "kind": "expression"
272
- }
273
- },
274
274
  {
275
275
  "name": ".selectedItems",
276
276
  "description": "The list of selected items.\nNote: modifying the selected items creates a new array each time.",