@vaadin/number-field 24.8.4 → 25.0.0-alpha10
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 +0 -23
- package/package.json +13 -13
- package/src/styles/vaadin-number-field-base-styles.js +29 -0
- package/{theme/material/vaadin-number-field-styles.d.ts → src/styles/vaadin-number-field-core-styles.d.ts} +3 -1
- package/src/vaadin-number-field-mixin.d.ts +0 -2
- package/src/vaadin-number-field-mixin.js +2 -2
- package/src/vaadin-number-field.js +28 -22
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
- package/src/vaadin-lit-number-field.js +0 -91
- package/theme/lumo/vaadin-lit-number-field.d.ts +0 -2
- package/theme/lumo/vaadin-lit-number-field.js +0 -2
- package/theme/material/vaadin-lit-number-field.d.ts +0 -2
- package/theme/material/vaadin-lit-number-field.js +0 -2
- package/theme/material/vaadin-number-field-styles.js +0 -28
- package/theme/material/vaadin-number-field.d.ts +0 -7
- package/theme/material/vaadin-number-field.js +0 -7
- package/vaadin-lit-number-field.d.ts +0 -1
- package/vaadin-lit-number-field.js +0 -3
- /package/src/{vaadin-number-field-core-styles.d.ts → styles/vaadin-number-field-base-styles.d.ts} +0 -0
- /package/src/{vaadin-number-field-core-styles.js → styles/vaadin-number-field-core-styles.js} +0 -0
package/README.md
CHANGED
|
@@ -24,29 +24,6 @@ Once installed, import the component in your application:
|
|
|
24
24
|
import '@vaadin/number-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/number-field/vaadin-number-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/number-field/theme/material/vaadin-number-field.js';
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
You can also import the Lumo version of the component explicitly:
|
|
39
|
-
|
|
40
|
-
```js
|
|
41
|
-
import '@vaadin/number-field/theme/lumo/vaadin-number-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/number-field/src/vaadin-number-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/number-field",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
+
"!src/styles/*-base-styles.d.ts",
|
|
25
|
+
"!src/styles/*-base-styles.js",
|
|
24
26
|
"theme",
|
|
25
27
|
"vaadin-*.d.ts",
|
|
26
28
|
"vaadin-*.js",
|
|
@@ -35,25 +37,23 @@
|
|
|
35
37
|
],
|
|
36
38
|
"dependencies": {
|
|
37
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@
|
|
39
|
-
"@vaadin/
|
|
40
|
-
"@vaadin/
|
|
41
|
-
"@vaadin/
|
|
42
|
-
"@vaadin/
|
|
43
|
-
"@vaadin/vaadin-
|
|
44
|
-
"@vaadin/vaadin-material-styles": "~24.8.4",
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "~24.8.4",
|
|
40
|
+
"@vaadin/a11y-base": "25.0.0-alpha10",
|
|
41
|
+
"@vaadin/component-base": "25.0.0-alpha10",
|
|
42
|
+
"@vaadin/field-base": "25.0.0-alpha10",
|
|
43
|
+
"@vaadin/input-container": "25.0.0-alpha10",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
|
|
46
46
|
"lit": "^3.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@vaadin/chai-plugins": "
|
|
50
|
-
"@vaadin/test-runner-commands": "
|
|
51
|
-
"@vaadin/testing-helpers": "^
|
|
49
|
+
"@vaadin/chai-plugins": "25.0.0-alpha10",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha10",
|
|
51
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
52
52
|
"sinon": "^18.0.0"
|
|
53
53
|
},
|
|
54
54
|
"web-types": [
|
|
55
55
|
"web-types.json",
|
|
56
56
|
"web-types.lit.json"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
|
|
59
59
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const numberFieldStyles = css`
|
|
10
|
+
:host([step-buttons-visible]) ::slotted(input) {
|
|
11
|
+
text-align: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[part='decrease-button']::before {
|
|
15
|
+
mask-image: var(--_vaadin-icon-minus);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
[part='increase-button']::before {
|
|
19
|
+
mask-image: var(--_vaadin-icon-plus);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host([dir='rtl']) [part='input-field'] {
|
|
23
|
+
direction: ltr;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host([readonly]) [part$='button'] {
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
@@ -3,4 +3,6 @@
|
|
|
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 '
|
|
6
|
+
import type { CSSResult } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const numberFieldStyles: CSSResult;
|
|
@@ -8,7 +8,6 @@ import type { DelegateFocusMixinClass } from '@vaadin/a11y-base/src/delegate-foc
|
|
|
8
8
|
import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
|
|
9
9
|
import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
10
10
|
import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
|
|
11
|
-
import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
|
|
12
11
|
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
13
12
|
import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
|
14
13
|
import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js';
|
|
@@ -26,7 +25,6 @@ import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.j
|
|
|
26
25
|
export declare function NumberFieldMixin<T extends Constructor<HTMLElement>>(
|
|
27
26
|
base: T,
|
|
28
27
|
): Constructor<ClearButtonMixinClass> &
|
|
29
|
-
Constructor<ControllerMixinClass> &
|
|
30
28
|
Constructor<DelegateFocusMixinClass> &
|
|
31
29
|
Constructor<DelegateStateMixinClass> &
|
|
32
30
|
Constructor<DisabledMixinClass> &
|
|
@@ -87,12 +87,12 @@ export const NumberFieldMixin = (superClass) =>
|
|
|
87
87
|
`
|
|
88
88
|
${tag} input[type="number"]::-webkit-outer-spin-button,
|
|
89
89
|
${tag} input[type="number"]::-webkit-inner-spin-button {
|
|
90
|
-
|
|
90
|
+
appearance: none;
|
|
91
91
|
margin: 0;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
${tag} input[type="number"] {
|
|
95
|
-
|
|
95
|
+
appearance: textfield;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
${tag}[dir='rtl'] input[type="number"]::placeholder {
|
|
@@ -4,18 +4,17 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/input-container/src/vaadin-input-container.js';
|
|
7
|
-
import { html,
|
|
7
|
+
import { html, LitElement } from 'lit';
|
|
8
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
8
9
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
12
|
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
14
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
15
|
+
import { numberFieldStyles } from './styles/vaadin-number-field-core-styles.js';
|
|
13
16
|
import { NumberFieldMixin } from './vaadin-number-field-mixin.js';
|
|
14
17
|
|
|
15
|
-
registerStyles('vaadin-number-field', [inputFieldShared, numberFieldStyles], {
|
|
16
|
-
moduleId: 'vaadin-number-field-styles',
|
|
17
|
-
});
|
|
18
|
-
|
|
19
18
|
/**
|
|
20
19
|
* `<vaadin-number-field>` is an input field web component that only accepts numeric input.
|
|
21
20
|
*
|
|
@@ -71,32 +70,37 @@ registerStyles('vaadin-number-field', [inputFieldShared, numberFieldStyles], {
|
|
|
71
70
|
* @mixes ElementMixin
|
|
72
71
|
* @mixes ThemableMixin
|
|
73
72
|
*/
|
|
74
|
-
|
|
73
|
+
class NumberField extends NumberFieldMixin(ThemableMixin(ElementMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
75
74
|
static get is() {
|
|
76
75
|
return 'vaadin-number-field';
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
static get
|
|
78
|
+
static get styles() {
|
|
79
|
+
return [inputFieldShared, numberFieldStyles];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** @protected */
|
|
83
|
+
render() {
|
|
80
84
|
return html`
|
|
81
85
|
<div class="vaadin-field-container">
|
|
82
86
|
<div part="label">
|
|
83
87
|
<slot name="label"></slot>
|
|
84
|
-
<span part="required-indicator" aria-hidden="true"
|
|
88
|
+
<span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
|
|
85
89
|
</div>
|
|
86
90
|
|
|
87
91
|
<vaadin-input-container
|
|
88
92
|
part="input-field"
|
|
89
|
-
readonly="
|
|
90
|
-
disabled="
|
|
91
|
-
invalid="
|
|
92
|
-
theme
|
|
93
|
+
.readonly="${this.readonly}"
|
|
94
|
+
.disabled="${this.disabled}"
|
|
95
|
+
.invalid="${this.invalid}"
|
|
96
|
+
theme="${ifDefined(this._theme)}"
|
|
93
97
|
>
|
|
94
98
|
<div
|
|
95
|
-
disabled$="[[!_isButtonEnabled(-1, value, min, max, step)]]"
|
|
96
99
|
part="decrease-button"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
?disabled="${!this._isButtonEnabled(-1, this.value, this.min, this.max, this.step)}"
|
|
101
|
+
?hidden="${!this.stepButtonsVisible}"
|
|
102
|
+
@click="${this._onDecreaseButtonClick}"
|
|
103
|
+
@touchend="${this._onDecreaseButtonTouchend}"
|
|
100
104
|
aria-hidden="true"
|
|
101
105
|
slot="prefix"
|
|
102
106
|
></div>
|
|
@@ -105,11 +109,11 @@ export class NumberField extends NumberFieldMixin(ThemableMixin(ElementMixin(Pol
|
|
|
105
109
|
<slot name="suffix" slot="suffix"></slot>
|
|
106
110
|
<div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
|
|
107
111
|
<div
|
|
108
|
-
disabled$="[[!_isButtonEnabled(1, value, min, max, step)]]"
|
|
109
112
|
part="increase-button"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
?disabled="${!this._isButtonEnabled(1, this.value, this.min, this.max, this.step)}"
|
|
114
|
+
?hidden="${!this.stepButtonsVisible}"
|
|
115
|
+
@click="${this._onIncreaseButtonClick}"
|
|
116
|
+
@touchend="${this._onIncreaseButtonTouchend}"
|
|
113
117
|
aria-hidden="true"
|
|
114
118
|
slot="suffix"
|
|
115
119
|
></div>
|
|
@@ -130,3 +134,5 @@ export class NumberField extends NumberFieldMixin(ThemableMixin(ElementMixin(Pol
|
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
defineCustomElement(NumberField);
|
|
137
|
+
|
|
138
|
+
export { NumberField };
|
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": "
|
|
4
|
+
"version": "25.0.0-alpha10",
|
|
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/
|
|
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-alpha10/#/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.",
|
|
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": "
|
|
4
|
+
"version": "25.0.0-alpha10",
|
|
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/
|
|
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-alpha10/#/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.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -1,91 +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/src/vaadin-lit-input-container.js';
|
|
7
|
-
import { html, LitElement } from 'lit';
|
|
8
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
|
-
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
13
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
|
-
import { numberFieldStyles } from './vaadin-number-field-core-styles.js';
|
|
15
|
-
import { NumberFieldMixin } from './vaadin-number-field-mixin.js';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* LitElement based version of `<vaadin-number-field>` web component.
|
|
19
|
-
*
|
|
20
|
-
* ## Disclaimer
|
|
21
|
-
*
|
|
22
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
23
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
24
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
25
|
-
*/
|
|
26
|
-
class NumberField extends NumberFieldMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
|
|
27
|
-
static get is() {
|
|
28
|
-
return 'vaadin-number-field';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
static get styles() {
|
|
32
|
-
return [inputFieldShared, numberFieldStyles];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** @protected */
|
|
36
|
-
render() {
|
|
37
|
-
return html`
|
|
38
|
-
<div class="vaadin-field-container">
|
|
39
|
-
<div part="label">
|
|
40
|
-
<slot name="label"></slot>
|
|
41
|
-
<span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
|
|
42
|
-
</div>
|
|
43
|
-
|
|
44
|
-
<vaadin-input-container
|
|
45
|
-
part="input-field"
|
|
46
|
-
.readonly="${this.readonly}"
|
|
47
|
-
.disabled="${this.disabled}"
|
|
48
|
-
.invalid="${this.invalid}"
|
|
49
|
-
theme="${ifDefined(this._theme)}"
|
|
50
|
-
>
|
|
51
|
-
<div
|
|
52
|
-
part="decrease-button"
|
|
53
|
-
?disabled="${!this._isButtonEnabled(-1, this.value, this.min, this.max, this.step)}"
|
|
54
|
-
?hidden="${!this.stepButtonsVisible}"
|
|
55
|
-
@click="${this._onDecreaseButtonClick}"
|
|
56
|
-
@touchend="${this._onDecreaseButtonTouchend}"
|
|
57
|
-
aria-hidden="true"
|
|
58
|
-
slot="prefix"
|
|
59
|
-
></div>
|
|
60
|
-
<slot name="prefix" slot="prefix"></slot>
|
|
61
|
-
<slot name="input"></slot>
|
|
62
|
-
<slot name="suffix" slot="suffix"></slot>
|
|
63
|
-
<div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
|
|
64
|
-
<div
|
|
65
|
-
part="increase-button"
|
|
66
|
-
?disabled="${!this._isButtonEnabled(1, this.value, this.min, this.max, this.step)}"
|
|
67
|
-
?hidden="${!this.stepButtonsVisible}"
|
|
68
|
-
@click="${this._onIncreaseButtonClick}"
|
|
69
|
-
@touchend="${this._onIncreaseButtonTouchend}"
|
|
70
|
-
aria-hidden="true"
|
|
71
|
-
slot="suffix"
|
|
72
|
-
></div>
|
|
73
|
-
</vaadin-input-container>
|
|
74
|
-
|
|
75
|
-
<div part="helper-text">
|
|
76
|
-
<slot name="helper"></slot>
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
<div part="error-message">
|
|
80
|
-
<slot name="error-message"></slot>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<slot name="tooltip"></slot>
|
|
85
|
-
`;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
defineCustomElement(NumberField);
|
|
90
|
-
|
|
91
|
-
export { NumberField };
|
|
@@ -1,28 +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/material/vaadin-input-container-styles.js';
|
|
7
|
-
import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
|
|
8
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
-
|
|
10
|
-
const numberField = css`
|
|
11
|
-
:host([step-buttons-visible]) ::slotted(input) {
|
|
12
|
-
text-align: center;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
:host(:not([disabled])) [part$='button'][disabled] {
|
|
16
|
-
opacity: 0.2;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
[part$='decrease-button'] {
|
|
20
|
-
cursor: pointer;
|
|
21
|
-
font-size: var(--material-body-font-size);
|
|
22
|
-
padding-bottom: 0.21em;
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
registerStyles('vaadin-number-field', [inputFieldShared, numberField], {
|
|
27
|
-
moduleId: 'material-number-field',
|
|
28
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-number-field.js';
|
/package/src/{vaadin-number-field-core-styles.d.ts → styles/vaadin-number-field-base-styles.d.ts}
RENAMED
|
File without changes
|
/package/src/{vaadin-number-field-core-styles.js → styles/vaadin-number-field-core-styles.js}
RENAMED
|
File without changes
|