@vaadin/number-field 23.1.2 → 23.2.0-alpha3

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/number-field",
3
- "version": "23.1.2",
3
+ "version": "23.2.0-alpha3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,17 +33,17 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@polymer/polymer": "^3.0.0",
36
- "@vaadin/component-base": "^23.1.2",
37
- "@vaadin/field-base": "^23.1.2",
38
- "@vaadin/input-container": "^23.1.2",
39
- "@vaadin/vaadin-lumo-styles": "^23.1.2",
40
- "@vaadin/vaadin-material-styles": "^23.1.2",
41
- "@vaadin/vaadin-themable-mixin": "^23.1.2"
36
+ "@vaadin/component-base": "23.2.0-alpha3",
37
+ "@vaadin/field-base": "23.2.0-alpha3",
38
+ "@vaadin/input-container": "23.2.0-alpha3",
39
+ "@vaadin/vaadin-lumo-styles": "23.2.0-alpha3",
40
+ "@vaadin/vaadin-material-styles": "23.2.0-alpha3",
41
+ "@vaadin/vaadin-themable-mixin": "23.2.0-alpha3"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@esm-bundle/chai": "^4.3.4",
45
45
  "@vaadin/testing-helpers": "^0.3.2",
46
46
  "sinon": "^13.0.2"
47
47
  },
48
- "gitHead": "6fb205c6e9a761feadfb779dd5d7af96d3102e56"
48
+ "gitHead": "06e5875be93ca50da2846dafc65a8531010c0576"
49
49
  }
@@ -25,10 +25,17 @@ export type NumberFieldInvalidChangedEvent = CustomEvent<{ value: boolean }>;
25
25
  */
26
26
  export type NumberFieldValueChangedEvent = CustomEvent<{ value: string }>;
27
27
 
28
+ /**
29
+ * Fired whenever the field is validated.
30
+ */
31
+ export type NumberFieldValidatedEvent = CustomEvent<{ valid: boolean }>;
32
+
28
33
  export interface NumberFieldCustomEventMap {
29
34
  'invalid-changed': NumberFieldInvalidChangedEvent;
30
35
 
31
36
  'value-changed': NumberFieldValueChangedEvent;
37
+
38
+ validated: NumberFieldValidatedEvent;
32
39
  }
33
40
 
34
41
  export interface NumberFieldEventMap extends HTMLElementEventMap, NumberFieldCustomEventMap {
@@ -54,12 +61,13 @@ export interface NumberFieldEventMap extends HTMLElementEventMap, NumberFieldCus
54
61
  * `increase-button` | Increase ("plus") button
55
62
  * `decrease-button` | Decrease ("minus") button
56
63
  *
57
- * Note, the `input-prevented` state attribute is not supported by `<vaadin-number-field>`.
64
+ * Note, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.
58
65
  *
59
66
  * @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.
60
67
  * @fires {Event} change - Fired when the user commits a value change.
61
68
  * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
62
69
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
70
+ * @fires {CustomEvent} validated - Fired whenever the field is validated.
63
71
  */
64
72
  declare class NumberField extends InputFieldMixin(SlotStylesMixin(ThemableMixin(ElementMixin(HTMLElement)))) {
65
73
  /**
@@ -34,7 +34,7 @@ registerStyles('vaadin-number-field', inputFieldShared, { moduleId: 'vaadin-numb
34
34
  * `increase-button` | Increase ("plus") button
35
35
  * `decrease-button` | Decrease ("minus") button
36
36
  *
37
- * Note, the `input-prevented` state attribute is not supported by `<vaadin-number-field>`.
37
+ * Note, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.
38
38
  *
39
39
  * See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
40
40
  *
@@ -42,6 +42,7 @@ registerStyles('vaadin-number-field', inputFieldShared, { moduleId: 'vaadin-numb
42
42
  * @fires {Event} change - Fired when the user commits a value change.
43
43
  * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
44
44
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
45
+ * @fires {CustomEvent} validated - Fired whenever the field is validated.
45
46
  *
46
47
  * @extends HTMLElement
47
48
  * @mixes InputFieldMixin
@@ -212,17 +213,6 @@ export class NumberField extends InputFieldMixin(SlotStylesMixin(ThemableMixin(E
212
213
  return this.$.clearButton;
213
214
  }
214
215
 
215
- /** @protected */
216
- connectedCallback() {
217
- super.connectedCallback();
218
-
219
- if (this.inputElement) {
220
- this.inputElement.min = this.min;
221
- this.inputElement.max = this.max;
222
- this.__applyStep(this.step);
223
- }
224
- }
225
-
226
216
  /** @protected */
227
217
  ready() {
228
218
  super.ready();
@@ -235,6 +225,11 @@ export class NumberField extends InputFieldMixin(SlotStylesMixin(ThemableMixin(E
235
225
  this.ariaTarget = input;
236
226
  }),
237
227
  );
228
+
229
+ this.inputElement.min = this.min;
230
+ this.inputElement.max = this.max;
231
+ this.__applyStep(this.step);
232
+
238
233
  this.addController(new LabelledInputController(this.inputElement, this._labelController));
239
234
  }
240
235
 
@@ -265,7 +260,7 @@ export class NumberField extends InputFieldMixin(SlotStylesMixin(ThemableMixin(E
265
260
  if (!isNumUnset(min) || !isNumUnset(max)) {
266
261
  this.validate();
267
262
  } else if (!required) {
268
- this.invalid = false;
263
+ this._setInvalid(false);
269
264
  }
270
265
  }
271
266