@vaadin/integer-field 24.8.0-alpha9 → 25.0.0-alpha1

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
@@ -24,29 +24,6 @@ Once installed, import the component in your application:
24
24
  import '@vaadin/integer-field';
25
25
  ```
26
26
 
27
- ## Themes
28
-
29
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
30
- The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/integer-field/vaadin-integer-field.js) of the package uses Lumo theme.
31
-
32
- To use the Material theme, import the component from the `theme/material` folder:
33
-
34
- ```js
35
- import '@vaadin/integer-field/theme/material/vaadin-integer-field.js';
36
- ```
37
-
38
- You can also import the Lumo version of the component explicitly:
39
-
40
- ```js
41
- import '@vaadin/integer-field/theme/lumo/vaadin-integer-field.js';
42
- ```
43
-
44
- Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
45
-
46
- ```js
47
- import '@vaadin/integer-field/src/vaadin-integer-field.js';
48
- ```
49
-
50
27
  ## Contributing
51
28
 
52
29
  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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/integer-field",
3
- "version": "24.8.0-alpha9",
3
+ "version": "25.0.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,15 +34,13 @@
34
34
  "web-component"
35
35
  ],
36
36
  "dependencies": {
37
- "@polymer/polymer": "^3.0.0",
38
- "@vaadin/component-base": "24.8.0-alpha9",
39
- "@vaadin/number-field": "24.8.0-alpha9",
40
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha9",
41
- "@vaadin/vaadin-material-styles": "24.8.0-alpha9"
37
+ "@vaadin/component-base": "25.0.0-alpha1",
38
+ "@vaadin/number-field": "25.0.0-alpha1",
39
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1"
42
40
  },
43
41
  "devDependencies": {
44
- "@vaadin/chai-plugins": "24.8.0-alpha9",
45
- "@vaadin/test-runner-commands": "24.8.0-alpha9",
42
+ "@vaadin/chai-plugins": "25.0.0-alpha1",
43
+ "@vaadin/test-runner-commands": "25.0.0-alpha1",
46
44
  "@vaadin/testing-helpers": "^1.1.0",
47
45
  "sinon": "^18.0.0"
48
46
  },
@@ -50,5 +48,5 @@
50
48
  "web-types.json",
51
49
  "web-types.lit.json"
52
50
  ],
53
- "gitHead": "4de3809275ddfd733b0d13fd02af8faf73eb6770"
51
+ "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
54
52
  }
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/integer-field",
4
- "version": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-integer-field",
11
- "description": "`<vaadin-integer-field>` is an input field web component that only accepts entering integer numbers.\n\n```html\n<vaadin-integer-field label=\"X\"></vaadin-integer-field>\n```\n\n### Styling\n\n`<vaadin-integer-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.8.0-alpha9/#/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\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | -\n\nNote, there is currently no way to detect unparsable => unparsable changes because the browser\ndoesn't provide access to unparsable values of native [type=number] inputs.",
11
+ "description": "`<vaadin-integer-field>` is an input field web component that only accepts entering integer numbers.\n\n```html\n<vaadin-integer-field label=\"X\"></vaadin-integer-field>\n```\n\n### Styling\n\n`<vaadin-integer-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/25.0.0-alpha1/#/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\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | -\n\nNote, there is currently no way to detect unparsable => unparsable changes because the browser\ndoesn't provide access to unparsable values of native [type=number] inputs.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/integer-field",
4
- "version": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha1",
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-integer-field",
19
- "description": "`<vaadin-integer-field>` is an input field web component that only accepts entering integer numbers.\n\n```html\n<vaadin-integer-field label=\"X\"></vaadin-integer-field>\n```\n\n### Styling\n\n`<vaadin-integer-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.8.0-alpha9/#/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\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | -\n\nNote, there is currently no way to detect unparsable => unparsable changes because the browser\ndoesn't provide access to unparsable values of native [type=number] inputs.",
19
+ "description": "`<vaadin-integer-field>` is an input field web component that only accepts entering integer numbers.\n\n```html\n<vaadin-integer-field label=\"X\"></vaadin-integer-field>\n```\n\n### Styling\n\n`<vaadin-integer-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/25.0.0-alpha1/#/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\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | -\n\nNote, there is currently no way to detect unparsable => unparsable changes because the browser\ndoesn't provide access to unparsable values of native [type=number] inputs.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -1,6 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- export * from './vaadin-integer-field.js';
@@ -1,77 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
7
- import { NumberField } from '@vaadin/number-field/src/vaadin-lit-number-field.js';
8
-
9
- /**
10
- * LitElement based version of `<vaadin-integer-field>` web component.
11
- *
12
- * ## Disclaimer
13
- *
14
- * This component is an experiment and not yet a part of Vaadin platform.
15
- * There is no ETA regarding specific Vaadin version where it'll land.
16
- * Feel free to try this code in your apps as per Apache 2.0 license.
17
- */
18
- export class IntegerField extends NumberField {
19
- static get is() {
20
- return 'vaadin-integer-field';
21
- }
22
-
23
- constructor() {
24
- super();
25
-
26
- this.allowedCharPattern = '[-+\\d]';
27
- }
28
-
29
- /**
30
- * Override an observer from `InputMixin` to clear the value
31
- * when trying to type invalid characters.
32
- * @param {string | undefined} newVal
33
- * @param {string | undefined} oldVal
34
- * @protected
35
- * @override
36
- */
37
- _valueChanged(newVal, oldVal) {
38
- if (newVal !== '' && !this.__isInteger(newVal)) {
39
- console.warn(`Trying to set non-integer value "${newVal}" to <vaadin-integer-field>. Clearing the value.`);
40
- this.value = '';
41
- return;
42
- }
43
- super._valueChanged(newVal, oldVal);
44
- }
45
-
46
- /**
47
- * Override an observer from `NumberField` to reset the step
48
- * property when an invalid step is set.
49
- * @param {number} newVal
50
- * @param {HTMLElement | undefined} inputElement
51
- * @protected
52
- * @override
53
- */
54
- _stepChanged(step, inputElement) {
55
- if (step != null && !this.__hasOnlyDigits(step)) {
56
- console.warn(
57
- `<vaadin-integer-field> The \`step\` property must be a positive integer but \`${step}\` was provided, so the property was reset to \`null\`.`,
58
- );
59
- this.step = null;
60
- return;
61
- }
62
-
63
- super._stepChanged(step, inputElement);
64
- }
65
-
66
- /** @private */
67
- __isInteger(value) {
68
- return /^(-\d)?\d*$/u.test(String(value));
69
- }
70
-
71
- /** @private */
72
- __hasOnlyDigits(value) {
73
- return /^\d+$/u.test(String(value));
74
- }
75
- }
76
-
77
- defineCustomElement(IntegerField);
@@ -1,2 +0,0 @@
1
- import '@vaadin/number-field/theme/lumo/vaadin-lit-number-field.js';
2
- import '../../src/vaadin-lit-integer-field.js';
@@ -1,2 +0,0 @@
1
- import '@vaadin/number-field/theme/lumo/vaadin-lit-number-field.js';
2
- import '../../src/vaadin-lit-integer-field.js';
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import '@vaadin/number-field/theme/material/vaadin-number-field.js';
7
- import '../../src/vaadin-integer-field.js';
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import '@vaadin/number-field/theme/material/vaadin-number-field.js';
7
- import '../../src/vaadin-integer-field.js';
@@ -1,2 +0,0 @@
1
- import '@vaadin/number-field/theme/material/vaadin-lit-number-field.js';
2
- import '../../src/vaadin-lit-integer-field.js';
@@ -1,2 +0,0 @@
1
- import '@vaadin/number-field/theme/material/vaadin-lit-number-field.js';
2
- import '../../src/vaadin-lit-integer-field.js';
@@ -1 +0,0 @@
1
- export * from './src/vaadin-integer-field.js';
@@ -1,3 +0,0 @@
1
- import './theme/lumo/vaadin-lit-integer-field.js';
2
-
3
- export * from './src/vaadin-lit-integer-field.js';