@vaadin/number-field 25.0.0-alpha9 → 25.0.0-beta2
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 +11 -14
- package/src/styles/vaadin-number-field-base-styles.js +3 -3
- package/src/vaadin-number-field-mixin.js +1 -1
- package/src/vaadin-number-field.d.ts +29 -7
- package/src/vaadin-number-field.js +31 -11
- package/vaadin-number-field.js +1 -1
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
- package/src/styles/vaadin-number-field-core-styles.d.ts +0 -8
- package/src/styles/vaadin-number-field-core-styles.js +0 -30
- package/theme/lumo/vaadin-number-field-styles.d.ts +0 -7
- package/theme/lumo/vaadin-number-field-styles.js +0 -52
- package/theme/lumo/vaadin-number-field.d.ts +0 -7
- package/theme/lumo/vaadin-number-field.js +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/number-field",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-beta2",
|
|
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-
|
|
41
|
-
"@vaadin/component-base": "25.0.0-
|
|
42
|
-
"@vaadin/field-base": "25.0.0-
|
|
43
|
-
"@vaadin/input-container": "25.0.0-
|
|
44
|
-
"@vaadin/vaadin-
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha9",
|
|
37
|
+
"@vaadin/a11y-base": "25.0.0-beta2",
|
|
38
|
+
"@vaadin/component-base": "25.0.0-beta2",
|
|
39
|
+
"@vaadin/field-base": "25.0.0-beta2",
|
|
40
|
+
"@vaadin/input-container": "25.0.0-beta2",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-beta2",
|
|
46
42
|
"lit": "^3.0.0"
|
|
47
43
|
},
|
|
48
44
|
"devDependencies": {
|
|
49
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
50
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
45
|
+
"@vaadin/chai-plugins": "25.0.0-beta2",
|
|
46
|
+
"@vaadin/test-runner-commands": "25.0.0-beta2",
|
|
51
47
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
52
|
-
"
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-beta2",
|
|
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": "
|
|
55
|
+
"gitHead": "e078f8371ae266f05c7ca1ec25686cc489c83f24"
|
|
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
|
|
14
|
+
[part~='decrease-button']::before {
|
|
15
15
|
mask-image: var(--_vaadin-icon-minus);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
[part
|
|
18
|
+
[part~='increase-button']::before {
|
|
19
19
|
mask-image: var(--_vaadin-icon-plus);
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -57,18 +57,40 @@ export interface NumberFieldEventMap extends HTMLElementEventMap, NumberFieldCus
|
|
|
57
57
|
*
|
|
58
58
|
* ### Styling
|
|
59
59
|
*
|
|
60
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
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-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
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}"
|
package/vaadin-number-field.js
CHANGED
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-
|
|
4
|
+
"version": "25.0.0-beta2",
|
|
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\
|
|
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",
|
package/web-types.lit.json
CHANGED
|
@@ -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-
|
|
4
|
+
"version": "25.0.0-beta2",
|
|
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\
|
|
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,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
|
-
});
|