@vaadin/number-field 25.0.0-alpha8 → 25.0.0-beta1

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": "25.0.0-alpha8",
3
+ "version": "25.0.0-beta1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,9 +21,6 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "!src/styles/*-base-styles.d.ts",
25
- "!src/styles/*-base-styles.js",
26
- "theme",
27
24
  "vaadin-*.d.ts",
28
25
  "vaadin-*.js",
29
26
  "web-types.json",
@@ -37,23 +34,23 @@
37
34
  ],
38
35
  "dependencies": {
39
36
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@vaadin/a11y-base": "25.0.0-alpha8",
41
- "@vaadin/component-base": "25.0.0-alpha8",
42
- "@vaadin/field-base": "25.0.0-alpha8",
43
- "@vaadin/input-container": "25.0.0-alpha8",
44
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha8",
45
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha8",
37
+ "@vaadin/a11y-base": "25.0.0-beta1",
38
+ "@vaadin/component-base": "25.0.0-beta1",
39
+ "@vaadin/field-base": "25.0.0-beta1",
40
+ "@vaadin/input-container": "25.0.0-beta1",
41
+ "@vaadin/vaadin-themable-mixin": "25.0.0-beta1",
46
42
  "lit": "^3.0.0"
47
43
  },
48
44
  "devDependencies": {
49
- "@vaadin/chai-plugins": "25.0.0-alpha8",
50
- "@vaadin/test-runner-commands": "25.0.0-alpha8",
45
+ "@vaadin/chai-plugins": "25.0.0-beta1",
46
+ "@vaadin/test-runner-commands": "25.0.0-beta1",
51
47
  "@vaadin/testing-helpers": "^2.0.0",
52
- "sinon": "^18.0.0"
48
+ "@vaadin/vaadin-lumo-styles": "25.0.0-beta1",
49
+ "sinon": "^21.0.0"
53
50
  },
54
51
  "web-types": [
55
52
  "web-types.json",
56
53
  "web-types.lit.json"
57
54
  ],
58
- "gitHead": "ebf53673d5f639d2b1b6f2b31f640f530643ee2f"
55
+ "gitHead": "1d20cf54e582d1f2e209126d4586f8b4c01c50e0"
59
56
  }
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import '@vaadin/component-base/src/style-props.js';
6
+ import '@vaadin/component-base/src/styles/style-props.js';
7
7
  import { css } from 'lit';
8
8
 
9
9
  export const numberFieldStyles = css`
@@ -11,11 +11,11 @@ export const numberFieldStyles = css`
11
11
  text-align: center;
12
12
  }
13
13
 
14
- [part='decrease-button']::before {
14
+ [part~='decrease-button']::before {
15
15
  mask-image: var(--_vaadin-icon-minus);
16
16
  }
17
17
 
18
- [part='increase-button']::before {
18
+ [part~='increase-button']::before {
19
19
  mask-image: var(--_vaadin-icon-plus);
20
20
  }
21
21
 
@@ -436,7 +436,7 @@ export const NumberFieldMixin = (superClass) =>
436
436
  * Override this method from `InputControlMixin`
437
437
  * to stop propagation of the native change event.
438
438
  *
439
- * @param {Event}
439
+ * @param {Event} event
440
440
  * @override
441
441
  * @protected
442
442
  */
@@ -57,18 +57,40 @@ export interface NumberFieldEventMap extends HTMLElementEventMap, NumberFieldCus
57
57
  *
58
58
  * ### Styling
59
59
  *
60
- * `<vaadin-number-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.
61
- * See [`<vaadin-text-field>`](#/elements/vaadin-text-field) for the styling documentation.
60
+ * The following shadow DOM parts are available for styling:
62
61
  *
63
- * In addition to `<vaadin-text-field>` parts, the following parts are available for theming:
62
+ * Part name | Description
63
+ * ---------------------|----------------
64
+ * `label` | The label element
65
+ * `input-field` | The element that wraps prefix, value and suffix
66
+ * `field-button` | Set on clear, decrease and increase buttons
67
+ * `clear-button` | The clear button
68
+ * `error-message` | The error message element
69
+ * `helper-text` | The helper text element wrapper
70
+ * `required-indicator` | The `required` state indicator element
71
+ * `increase-button` | Increase ("plus") button
72
+ * `decrease-button` | Decrease ("minus") button
64
73
  *
65
- * Part name | Description
66
- * ------------------|-------------------------
67
- * `increase-button` | Increase ("plus") button
68
- * `decrease-button` | Decrease ("minus") button
74
+ * The following state attributes are available for styling:
75
+ *
76
+ * Attribute | Description
77
+ * ---------------------|---------------------------------
78
+ * `disabled` | Set when the element is disabled
79
+ * `has-value` | Set when the element has a value
80
+ * `has-label` | Set when the element has a label
81
+ * `has-helper` | Set when the element has helper text or slot
82
+ * `has-error-message` | Set when the element has an error message
83
+ * `has-tooltip` | Set when the element has a slotted tooltip
84
+ * `invalid` | Set when the element is invalid
85
+ * `input-prevented` | Temporarily set when invalid input is prevented
86
+ * `focused` | Set when the element is focused
87
+ * `focus-ring` | Set when the element is keyboard focused
88
+ * `readonly` | Set when the element is readonly
69
89
  *
70
90
  * Note, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.
71
91
  *
92
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
93
+ *
72
94
  * ### Change events
73
95
  *
74
96
  * Depending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,
@@ -12,7 +12,7 @@ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
12
12
  import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
13
13
  import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
14
14
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
- import { numberFieldStyles } from './styles/vaadin-number-field-core-styles.js';
15
+ import { numberFieldStyles } from './styles/vaadin-number-field-base-styles.js';
16
16
  import { NumberFieldMixin } from './vaadin-number-field-mixin.js';
17
17
 
18
18
  /**
@@ -24,15 +24,35 @@ import { NumberFieldMixin } from './vaadin-number-field-mixin.js';
24
24
  *
25
25
  * ### Styling
26
26
  *
27
- * `<vaadin-number-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.
28
- * See [`<vaadin-text-field>`](#/elements/vaadin-text-field) for the styling documentation.
27
+ * The following shadow DOM parts are available for styling:
29
28
  *
30
- * In addition to `<vaadin-text-field>` parts, the following parts are available for theming:
29
+ * Part name | Description
30
+ * ---------------------|----------------
31
+ * `label` | The label element
32
+ * `input-field` | The element that wraps prefix, value and suffix
33
+ * `field-button` | Set on clear, decrease and increase buttons
34
+ * `clear-button` | The clear button
35
+ * `error-message` | The error message element
36
+ * `helper-text` | The helper text element wrapper
37
+ * `required-indicator` | The `required` state indicator element
38
+ * `increase-button` | Increase ("plus") button
39
+ * `decrease-button` | Decrease ("minus") button
31
40
  *
32
- * Part name | Description
33
- * ------------------|-------------------------
34
- * `increase-button` | Increase ("plus") button
35
- * `decrease-button` | Decrease ("minus") button
41
+ * The following state attributes are available for styling:
42
+ *
43
+ * Attribute | Description
44
+ * ---------------------|---------------------------------
45
+ * `disabled` | Set when the element is disabled
46
+ * `has-value` | Set when the element has a value
47
+ * `has-label` | Set when the element has a label
48
+ * `has-helper` | Set when the element has helper text or slot
49
+ * `has-error-message` | Set when the element has an error message
50
+ * `has-tooltip` | Set when the element has a slotted tooltip
51
+ * `invalid` | Set when the element is invalid
52
+ * `input-prevented` | Temporarily set when invalid input is prevented
53
+ * `focused` | Set when the element is focused
54
+ * `focus-ring` | Set when the element is keyboard focused
55
+ * `readonly` | Set when the element is readonly
36
56
  *
37
57
  * Note, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.
38
58
  *
@@ -96,7 +116,7 @@ class NumberField extends NumberFieldMixin(ThemableMixin(ElementMixin(PolylitMix
96
116
  theme="${ifDefined(this._theme)}"
97
117
  >
98
118
  <div
99
- part="decrease-button"
119
+ part="field-button decrease-button"
100
120
  ?disabled="${!this._isButtonEnabled(-1, this.value, this.min, this.max, this.step)}"
101
121
  ?hidden="${!this.stepButtonsVisible}"
102
122
  @click="${this._onDecreaseButtonClick}"
@@ -107,9 +127,9 @@ class NumberField extends NumberFieldMixin(ThemableMixin(ElementMixin(PolylitMix
107
127
  <slot name="prefix" slot="prefix"></slot>
108
128
  <slot name="input"></slot>
109
129
  <slot name="suffix" slot="suffix"></slot>
110
- <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
130
+ <div id="clearButton" part="field-button clear-button" slot="suffix" aria-hidden="true"></div>
111
131
  <div
112
- part="increase-button"
132
+ part="field-button increase-button"
113
133
  ?disabled="${!this._isButtonEnabled(1, this.value, this.min, this.max, this.step)}"
114
134
  ?hidden="${!this.stepButtonsVisible}"
115
135
  @click="${this._onIncreaseButtonClick}"
@@ -1,3 +1,3 @@
1
- import './theme/lumo/vaadin-number-field.js';
1
+ import './src/vaadin-number-field.js';
2
2
 
3
3
  export * from './src/vaadin-number-field.js';
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": "25.0.0-alpha8",
4
+ "version": "25.0.0-beta1",
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/25.0.0-alpha8/#/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/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-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\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and suffix\n`field-button` | Set on clear, decrease and increase buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`increase-button` | Increase (\"plus\") button\n`decrease-button` | Decrease (\"minus\") button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`input-prevented` | Temporarily set when invalid input is prevented\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n\nNote, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.\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/number-field",
4
- "version": "25.0.0-alpha8",
4
+ "version": "25.0.0-beta1",
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/25.0.0-alpha8/#/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/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-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\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and suffix\n`field-button` | Set on clear, decrease and increase buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`increase-button` | Increase (\"plus\") button\n`decrease-button` | Decrease (\"minus\") button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`input-prevented` | Temporarily set when invalid input is prevented\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n\nNote, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.\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,8 +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 type { CSSResult } from 'lit';
7
-
8
- export const numberFieldStyles: CSSResult;
@@ -1,30 +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 { css } from 'lit';
7
-
8
- export const numberFieldStyles = css`
9
- :host([readonly]) [part$='button'] {
10
- pointer-events: none;
11
- }
12
-
13
- [part='decrease-button']::before {
14
- content: '\\2212';
15
- }
16
-
17
- [part='increase-button']::before {
18
- content: '+';
19
- }
20
-
21
- [part='decrease-button'],
22
- [part='increase-button'] {
23
- -webkit-user-select: none;
24
- user-select: none;
25
- }
26
-
27
- :host([dir='rtl']) [part='input-field'] {
28
- direction: ltr;
29
- }
30
- `;
@@ -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/input-container/theme/lumo/vaadin-input-container-styles.js';
7
- import '@vaadin/vaadin-lumo-styles/sizing.js';
@@ -1,52 +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/input-container/theme/lumo/vaadin-input-container-styles.js';
7
- import '@vaadin/vaadin-lumo-styles/sizing.js';
8
- import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
9
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
-
11
- const numberField = css`
12
- :host([step-buttons-visible]:not([theme~='align-right'])) ::slotted(input) {
13
- text-align: center;
14
- }
15
-
16
- :host(:not([disabled])) [part$='button'][disabled] {
17
- opacity: 0.2;
18
- }
19
-
20
- :host([step-buttons-visible]) [part='input-field'] {
21
- padding: 0;
22
- }
23
-
24
- [part='decrease-button'],
25
- [part='increase-button'] {
26
- cursor: pointer;
27
- width: 1.5em;
28
- height: 1.5em;
29
- }
30
-
31
- [part='decrease-button']::before,
32
- [part='increase-button']::before {
33
- margin-top: 0.25em;
34
- }
35
-
36
- [part='decrease-button']::before {
37
- content: var(--lumo-icons-minus);
38
- }
39
-
40
- [part='increase-button']::before {
41
- content: var(--lumo-icons-plus);
42
- }
43
-
44
- /* RTL specific styles */
45
- :host([dir='rtl']:not([theme~='align-right'])) ::slotted(input) {
46
- --_lumo-text-field-overflow-mask-image: linear-gradient(to left, transparent, #000 1.25em);
47
- }
48
- `;
49
-
50
- registerStyles('vaadin-number-field', [inputFieldShared, numberField], {
51
- moduleId: 'lumo-number-field',
52
- });
@@ -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-styles.js';
7
- import '../../src/vaadin-number-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-styles.js';
7
- import '../../src/vaadin-number-field.js';