@vaadin/message-input 24.8.0-alpha3 → 24.8.0-alpha5

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/message-input",
3
- "version": "24.8.0-alpha3",
3
+ "version": "24.8.0-alpha5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,17 +37,17 @@
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/button": "24.8.0-alpha3",
41
- "@vaadin/component-base": "24.8.0-alpha3",
42
- "@vaadin/text-area": "24.8.0-alpha3",
43
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha3",
44
- "@vaadin/vaadin-material-styles": "24.8.0-alpha3",
45
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha3",
40
+ "@vaadin/button": "24.8.0-alpha5",
41
+ "@vaadin/component-base": "24.8.0-alpha5",
42
+ "@vaadin/text-area": "24.8.0-alpha5",
43
+ "@vaadin/vaadin-lumo-styles": "24.8.0-alpha5",
44
+ "@vaadin/vaadin-material-styles": "24.8.0-alpha5",
45
+ "@vaadin/vaadin-themable-mixin": "24.8.0-alpha5",
46
46
  "lit": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@vaadin/chai-plugins": "24.8.0-alpha3",
50
- "@vaadin/test-runner-commands": "24.8.0-alpha3",
49
+ "@vaadin/chai-plugins": "24.8.0-alpha5",
50
+ "@vaadin/test-runner-commands": "24.8.0-alpha5",
51
51
  "@vaadin/testing-helpers": "^1.1.0",
52
52
  "sinon": "^18.0.0"
53
53
  },
@@ -55,5 +55,5 @@
55
55
  "web-types.json",
56
56
  "web-types.lit.json"
57
57
  ],
58
- "gitHead": "8c49e2337a1905ae68d0d7aee2e672500ea72343"
58
+ "gitHead": "3bb64b9ad9b00ac3adb94eb1bedd81b0f4ae574e"
59
59
  }
@@ -5,15 +5,19 @@
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
  import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
8
+ import type { I18nMixinClass } from '@vaadin/component-base/src/i18n-mixin.js';
8
9
 
9
10
  export interface MessageInputI18n {
10
- send: string;
11
- message: string;
11
+ send?: string;
12
+ message?: string;
12
13
  }
13
14
 
14
15
  export declare function MessageInputMixin<T extends Constructor<HTMLElement>>(
15
16
  base: T,
16
- ): Constructor<ControllerMixinClass> & Constructor<MessageInputMixinClass> & T;
17
+ ): Constructor<ControllerMixinClass> &
18
+ Constructor<I18nMixinClass<MessageInputI18n>> &
19
+ Constructor<MessageInputMixinClass> &
20
+ T;
17
21
 
18
22
  export declare class MessageInputMixinClass {
19
23
  /**
@@ -22,12 +26,11 @@ export declare class MessageInputMixinClass {
22
26
  value: string | null | undefined;
23
27
 
24
28
  /**
25
- * The object used to localize this component.
26
- * For changing the default localization, change the entire
27
- * `i18n` object.
29
+ * The object used to localize this component. To change the default
30
+ * localization, replace this with an object that provides all properties, or
31
+ * just the individual properties you want to change.
28
32
  *
29
33
  * The object has the following JSON structure and default values:
30
- *
31
34
  * ```
32
35
  * {
33
36
  * // Used as the button label
@@ -4,15 +4,21 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
7
+ import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
7
8
  import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
8
9
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
9
10
 
11
+ const DEFAULT_I18N = {
12
+ send: 'Send',
13
+ message: 'Message',
14
+ };
15
+
10
16
  /**
11
17
  * @polymerMixin
12
18
  * @mixes ControllerMixin
13
19
  */
14
20
  export const MessageInputMixin = (superClass) =>
15
- class MessageInputMixinClass extends ControllerMixin(superClass) {
21
+ class MessageInputMixinClass extends I18nMixin(DEFAULT_I18N, ControllerMixin(superClass)) {
16
22
  static get properties() {
17
23
  return {
18
24
  /**
@@ -24,35 +30,6 @@ export const MessageInputMixin = (superClass) =>
24
30
  sync: true,
25
31
  },
26
32
 
27
- /**
28
- * The object used to localize this component.
29
- * For changing the default localization, change the entire
30
- * `i18n` object.
31
- *
32
- * The object has the following JSON structure and default values:
33
- *
34
- * ```
35
- * {
36
- * // Used as the button label
37
- * send: 'Send',
38
- *
39
- * // Used as the input field's placeholder and aria-label
40
- * message: 'Message'
41
- * }
42
- * ```
43
- *
44
- * @type {!MessageInputI18n}
45
- * @default {English}
46
- */
47
- i18n: {
48
- type: Object,
49
- sync: true,
50
- value: () => ({
51
- send: 'Send',
52
- message: 'Message',
53
- }),
54
- },
55
-
56
33
  /**
57
34
  * Set to true to disable this element.
58
35
  * @type {boolean}
@@ -80,11 +57,36 @@ export const MessageInputMixin = (superClass) =>
80
57
 
81
58
  static get observers() {
82
59
  return [
83
- '__buttonPropsChanged(_button, disabled, i18n)',
84
- '__textAreaPropsChanged(_textArea, disabled, i18n, value)',
60
+ '__buttonPropsChanged(_button, disabled, __effectiveI18n)',
61
+ '__textAreaPropsChanged(_textArea, disabled, __effectiveI18n, value)',
85
62
  ];
86
63
  }
87
64
 
65
+ /**
66
+ * The object used to localize this component. To change the default
67
+ * localization, replace this with an object that provides all properties, or
68
+ * just the individual properties you want to change.
69
+ *
70
+ * The object has the following JSON structure and default values:
71
+ * ```
72
+ * {
73
+ * // Used as the button label
74
+ * send: 'Send',
75
+ *
76
+ * // Used as the input field's placeholder and aria-label
77
+ * message: 'Message'
78
+ * }
79
+ * ```
80
+ * @return {!MessageInputI18n}
81
+ */
82
+ get i18n() {
83
+ return super.i18n;
84
+ }
85
+
86
+ set i18n(value) {
87
+ super.i18n = value;
88
+ }
89
+
88
90
  /** @protected */
89
91
  ready() {
90
92
  super.ready();
@@ -134,20 +136,20 @@ export const MessageInputMixin = (superClass) =>
134
136
  }
135
137
 
136
138
  /** @private */
137
- __buttonPropsChanged(button, disabled, i18n) {
139
+ __buttonPropsChanged(button, disabled, effectiveI18n) {
138
140
  if (button) {
139
141
  button.disabled = disabled;
140
- button.textContent = i18n.send;
142
+ button.textContent = effectiveI18n.send;
141
143
  }
142
144
  }
143
145
 
144
146
  /** @private */
145
- __textAreaPropsChanged(textArea, disabled, i18n, value) {
147
+ __textAreaPropsChanged(textArea, disabled, effectiveI18n, value) {
146
148
  if (textArea) {
147
149
  textArea.disabled = disabled;
148
150
  textArea.value = value;
149
151
 
150
- const message = i18n.message;
152
+ const message = effectiveI18n.message;
151
153
  textArea.placeholder = message;
152
154
  textArea.accessibleName = message;
153
155
  }
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/message-input",
4
- "version": "24.8.0-alpha3",
4
+ "version": "24.8.0-alpha5",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -45,22 +45,22 @@
45
45
  "js": {
46
46
  "properties": [
47
47
  {
48
- "name": "value",
49
- "description": "Current content of the text input field",
48
+ "name": "i18n",
49
+ "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```\n{\n // Used as the button label\n send: 'Send',\n\n // Used as the input field's placeholder and aria-label\n message: 'Message'\n}\n```",
50
50
  "value": {
51
51
  "type": [
52
- "string",
53
- "null",
54
- "undefined"
52
+ "MessageInputI18n"
55
53
  ]
56
54
  }
57
55
  },
58
56
  {
59
- "name": "i18n",
60
- "description": "The object used to localize this component.\nFor changing the default localization, change the entire\n`i18n` object.\n\nThe object has the following JSON structure and default values:\n\n```\n{\n // Used as the button label\n send: 'Send',\n\n // Used as the input field's placeholder and aria-label\n message: 'Message'\n}\n```",
57
+ "name": "value",
58
+ "description": "Current content of the text input field",
61
59
  "value": {
62
60
  "type": [
63
- "MessageInputI18n"
61
+ "string",
62
+ "null",
63
+ "undefined"
64
64
  ]
65
65
  }
66
66
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/message-input",
4
- "version": "24.8.0-alpha3",
4
+ "version": "24.8.0-alpha5",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -27,15 +27,15 @@
27
27
  }
28
28
  },
29
29
  {
30
- "name": ".value",
31
- "description": "Current content of the text input field",
30
+ "name": ".i18n",
31
+ "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```\n{\n // Used as the button label\n send: 'Send',\n\n // Used as the input field's placeholder and aria-label\n message: 'Message'\n}\n```",
32
32
  "value": {
33
33
  "kind": "expression"
34
34
  }
35
35
  },
36
36
  {
37
- "name": ".i18n",
38
- "description": "The object used to localize this component.\nFor changing the default localization, change the entire\n`i18n` object.\n\nThe object has the following JSON structure and default values:\n\n```\n{\n // Used as the button label\n send: 'Send',\n\n // Used as the input field's placeholder and aria-label\n message: 'Message'\n}\n```",
37
+ "name": ".value",
38
+ "description": "Current content of the text input field",
39
39
  "value": {
40
40
  "kind": "expression"
41
41
  }