@vaadin/number-field 24.0.0-alpha5 → 24.0.0-alpha7

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": "24.0.0-alpha5",
3
+ "version": "24.0.0-alpha7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,12 +35,12 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/component-base": "24.0.0-alpha5",
39
- "@vaadin/field-base": "24.0.0-alpha5",
40
- "@vaadin/input-container": "24.0.0-alpha5",
41
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha5",
42
- "@vaadin/vaadin-material-styles": "24.0.0-alpha5",
43
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha5"
38
+ "@vaadin/component-base": "24.0.0-alpha7",
39
+ "@vaadin/field-base": "24.0.0-alpha7",
40
+ "@vaadin/input-container": "24.0.0-alpha7",
41
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha7",
42
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha7",
43
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha7"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@esm-bundle/chai": "^4.3.4",
@@ -51,5 +51,5 @@
51
51
  "web-types.json",
52
52
  "web-types.lit.json"
53
53
  ],
54
- "gitHead": "fc0b1721eda9e39cb289b239e440fc9e29573a31"
54
+ "gitHead": "aeb4535336813636736759e0a5de148b26bfc3b6"
55
55
  }
@@ -205,7 +205,7 @@ export class NumberField extends InputFieldMixin(ThemableMixin(ElementMixin(Poly
205
205
  direction: rtl;
206
206
  }
207
207
 
208
- ${tag}[dir='rtl']:not([has-controls]) input[type="number"]::placeholder {
208
+ ${tag}[dir='rtl']:not([step-buttons-visible]) input[type="number"]::placeholder {
209
209
  text-align: left;
210
210
  }
211
211
  `,
@@ -429,6 +429,22 @@ export class NumberField extends InputFieldMixin(ThemableMixin(ElementMixin(Poly
429
429
 
430
430
  super._onKeyDown(event);
431
431
  }
432
+
433
+ /**
434
+ * Native [type=number] inputs don't update their value
435
+ * when you are entering input that the browser is unable to parse
436
+ * e.g. "--5", hence we have to override this method from `InputMixin`
437
+ * so that, when value is empty, it would additionally check
438
+ * for bad input based on the native `validity.badInput` property.
439
+ *
440
+ * @param {InputEvent} event
441
+ * @protected
442
+ * @override
443
+ */
444
+ _setHasInputValue(event) {
445
+ const target = event.composedPath()[0];
446
+ this._hasInputValue = target.value.length > 0 || target.validity.badInput;
447
+ }
432
448
  }
433
449
 
434
450
  customElements.define(NumberField.is, NumberField);
@@ -13,7 +13,7 @@ const numberField = css`
13
13
  width: 8em;
14
14
  }
15
15
 
16
- :host([has-controls]:not([theme~='align-right'])) ::slotted(input) {
16
+ :host([step-buttons-visible]:not([theme~='align-right'])) ::slotted(input) {
17
17
  text-align: center;
18
18
  }
19
19
 
@@ -21,7 +21,7 @@ const numberField = css`
21
21
  opacity: 0.2;
22
22
  }
23
23
 
24
- :host([has-controls]) [part='input-field'] {
24
+ :host([step-buttons-visible]) [part='input-field'] {
25
25
  padding: 0;
26
26
  }
27
27
 
@@ -12,7 +12,7 @@ const numberField = css`
12
12
  width: 8em;
13
13
  }
14
14
 
15
- :host([has-controls]) ::slotted(input) {
15
+ :host([step-buttons-visible]) ::slotted(input) {
16
16
  text-align: center;
17
17
  }
18
18
 
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/number-field",
4
- "version": "24.0.0-alpha5",
4
+ "version": "24.0.0-alpha7",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-number-field",
11
- "description": "`<vaadin-number-field>` is an input field web component that only accepts numeric input.\n\n```html\n<vaadin-number-field label=\"Balance\"></vaadin-number-field>\n```\n\n### Styling\n\n`<vaadin-number-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha5/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n------------------|-------------------------\n`increase-button` | Increase (\"plus\") button\n`decrease-button` | Decrease (\"minus\") button\n\nNote, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
11
+ "description": "`<vaadin-number-field>` is an input field web component that only accepts numeric input.\n\n```html\n<vaadin-number-field label=\"Balance\"></vaadin-number-field>\n```\n\n### Styling\n\n`<vaadin-number-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha7/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n------------------|-------------------------\n`increase-button` | Increase (\"plus\") button\n`decrease-button` | Decrease (\"minus\") button\n\nNote, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -462,6 +462,44 @@
462
462
  ]
463
463
  }
464
464
  },
465
+ {
466
+ "name": "rootPath",
467
+ "description": "",
468
+ "value": {
469
+ "type": [
470
+ "string"
471
+ ]
472
+ }
473
+ },
474
+ {
475
+ "name": "importPath",
476
+ "description": "",
477
+ "value": {
478
+ "type": [
479
+ "string"
480
+ ]
481
+ }
482
+ },
483
+ {
484
+ "name": "root",
485
+ "description": "",
486
+ "value": {
487
+ "type": [
488
+ "StampedTemplate",
489
+ "HTMLElement",
490
+ "ShadowRoot"
491
+ ]
492
+ }
493
+ },
494
+ {
495
+ "name": "$",
496
+ "description": "",
497
+ "value": {
498
+ "type": [
499
+ "Object.<string, Element>"
500
+ ]
501
+ }
502
+ },
465
503
  {
466
504
  "name": "stepButtonsVisible",
467
505
  "description": "Set to true to show increase/decrease buttons.",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/number-field",
4
- "version": "24.0.0-alpha5",
4
+ "version": "24.0.0-alpha7",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,7 +16,7 @@
16
16
  "elements": [
17
17
  {
18
18
  "name": "vaadin-number-field",
19
- "description": "`<vaadin-number-field>` is an input field web component that only accepts numeric input.\n\n```html\n<vaadin-number-field label=\"Balance\"></vaadin-number-field>\n```\n\n### Styling\n\n`<vaadin-number-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha5/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n------------------|-------------------------\n`increase-button` | Increase (\"plus\") button\n`decrease-button` | Decrease (\"minus\") button\n\nNote, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
19
+ "description": "`<vaadin-number-field>` is an input field web component that only accepts numeric input.\n\n```html\n<vaadin-number-field label=\"Balance\"></vaadin-number-field>\n```\n\n### Styling\n\n`<vaadin-number-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha7/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n------------------|-------------------------\n`increase-button` | Increase (\"plus\") button\n`decrease-button` | Decrease (\"minus\") button\n\nNote, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -152,6 +152,34 @@
152
152
  "kind": "expression"
153
153
  }
154
154
  },
155
+ {
156
+ "name": ".rootPath",
157
+ "description": "",
158
+ "value": {
159
+ "kind": "expression"
160
+ }
161
+ },
162
+ {
163
+ "name": ".importPath",
164
+ "description": "",
165
+ "value": {
166
+ "kind": "expression"
167
+ }
168
+ },
169
+ {
170
+ "name": ".root",
171
+ "description": "",
172
+ "value": {
173
+ "kind": "expression"
174
+ }
175
+ },
176
+ {
177
+ "name": ".$",
178
+ "description": "",
179
+ "value": {
180
+ "kind": "expression"
181
+ }
182
+ },
155
183
  {
156
184
  "name": ".min",
157
185
  "description": "The minimum value of the field.",