@vaadin/number-field 24.2.0-dev.f254716fe → 24.3.0-alpha2

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.2.0-dev.f254716fe",
3
+ "version": "24.3.0-alpha2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,23 +38,23 @@
38
38
  "dependencies": {
39
39
  "@open-wc/dedupe-mixin": "^1.3.0",
40
40
  "@polymer/polymer": "^3.0.0",
41
- "@vaadin/a11y-base": "24.2.0-dev.f254716fe",
42
- "@vaadin/component-base": "24.2.0-dev.f254716fe",
43
- "@vaadin/field-base": "24.2.0-dev.f254716fe",
44
- "@vaadin/input-container": "24.2.0-dev.f254716fe",
45
- "@vaadin/vaadin-lumo-styles": "24.2.0-dev.f254716fe",
46
- "@vaadin/vaadin-material-styles": "24.2.0-dev.f254716fe",
47
- "@vaadin/vaadin-themable-mixin": "24.2.0-dev.f254716fe",
41
+ "@vaadin/a11y-base": "24.3.0-alpha2",
42
+ "@vaadin/component-base": "24.3.0-alpha2",
43
+ "@vaadin/field-base": "24.3.0-alpha2",
44
+ "@vaadin/input-container": "24.3.0-alpha2",
45
+ "@vaadin/vaadin-lumo-styles": "24.3.0-alpha2",
46
+ "@vaadin/vaadin-material-styles": "24.3.0-alpha2",
47
+ "@vaadin/vaadin-themable-mixin": "24.3.0-alpha2",
48
48
  "lit": "^2.0.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@esm-bundle/chai": "^4.3.4",
52
- "@vaadin/testing-helpers": "^0.4.3",
52
+ "@vaadin/testing-helpers": "^0.5.0",
53
53
  "sinon": "^13.0.2"
54
54
  },
55
55
  "web-types": [
56
56
  "web-types.json",
57
57
  "web-types.lit.json"
58
58
  ],
59
- "gitHead": "da54950b9f8c14c6451ede0d426e16a489c7fb9b"
59
+ "gitHead": "0fd437292fa2a2f65e29b424d2456909ad2d684b"
60
60
  }
@@ -10,6 +10,7 @@ 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
11
  import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
12
12
  import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
13
+ import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
13
14
  import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js';
14
15
  import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
15
16
  import type { InputConstraintsMixinClass } from '@vaadin/field-base/src/input-constraints-mixin.js';
@@ -17,7 +18,6 @@ import type { InputControlMixinClass } from '@vaadin/field-base/src/input-contro
17
18
  import type { InputFieldMixinClass } from '@vaadin/field-base/src/input-field-mixin.js';
18
19
  import type { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
19
20
  import type { LabelMixinClass } from '@vaadin/field-base/src/label-mixin.js';
20
- import type { SlotStylesMixinClass } from '@vaadin/field-base/src/slot-styles-mixin.js';
21
21
  import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
22
22
 
23
23
  /**
@@ -66,6 +66,7 @@ export const NumberFieldMixin = (superClass) =>
66
66
  constructor() {
67
67
  super();
68
68
  this._setType('number');
69
+ this.__onWheel = this.__onWheel.bind(this);
69
70
  }
70
71
 
71
72
  /** @protected */
@@ -134,6 +135,50 @@ export const NumberFieldMixin = (superClass) =>
134
135
  return !this.invalid;
135
136
  }
136
137
 
138
+ /**
139
+ * Override the method from `InputMixin` to add
140
+ * a wheel event listener to the input element.
141
+ *
142
+ * @param {HTMLElement} input
143
+ * @override
144
+ * @protected
145
+ */
146
+ _addInputListeners(input) {
147
+ super._addInputListeners(input);
148
+ input.addEventListener('wheel', this.__onWheel);
149
+ }
150
+
151
+ /**
152
+ * Override the method from `InputMixin` to remove
153
+ * the wheel event listener from the input element.
154
+ *
155
+ * @param {HTMLElement} input
156
+ * @override
157
+ * @protected
158
+ */
159
+ _removeInputListeners(input) {
160
+ super._removeInputListeners(input);
161
+ input.removeEventListener('wheel', this.__onWheel);
162
+ }
163
+
164
+ /**
165
+ * Prevents default browser behavior for wheel events on the input element
166
+ * when it's focused. More precisely, this prevents the browser from attempting
167
+ * to increment or decrement the value when the mouse wheel is used within
168
+ * the input element.
169
+ *
170
+ * CAVEAT: As a side-effect, this also prevents page scrolling when
171
+ * the pointer is positioned over the field and the field is focused.
172
+ *
173
+ * @param {WheelEvent} event
174
+ * @private
175
+ */
176
+ __onWheel(event) {
177
+ if (this.hasAttribute('focused')) {
178
+ event.preventDefault();
179
+ }
180
+ }
181
+
137
182
  /** @protected */
138
183
  _onDecreaseButtonTouchend(e) {
139
184
  // Cancel the following click and focus events
@@ -217,6 +262,7 @@ export const NumberFieldMixin = (superClass) =>
217
262
  /** @private */
218
263
  _setValue(value) {
219
264
  this.value = this.inputElement.value = String(parseFloat(value));
265
+ this.validate();
220
266
  this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
221
267
  }
222
268
 
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import '@vaadin/input-container/src/vaadin-input-container.js';
7
7
  import { html, PolymerElement } from '@polymer/polymer';
8
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
9
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
10
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
10
11
  import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
@@ -45,6 +46,7 @@ registerStyles('vaadin-number-field', [inputFieldShared, numberFieldStyles], {
45
46
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
46
47
  * @fires {CustomEvent} validated - Fired whenever the field is validated.
47
48
  *
49
+ * @customElement
48
50
  * @extends HTMLElement
49
51
  * @mixes NumberFieldMixin
50
52
  * @mixes ElementMixin
@@ -114,7 +116,8 @@ export class NumberField extends NumberFieldMixin(ThemableMixin(ElementMixin(Pol
114
116
  this._tooltipController = new TooltipController(this);
115
117
  this.addController(this._tooltipController);
116
118
  this._tooltipController.setPosition('top');
119
+ this._tooltipController.setAriaTarget(this.inputElement);
117
120
  }
118
121
  }
119
122
 
120
- customElements.define(NumberField.is, NumberField);
123
+ defineCustomElement(NumberField);
@@ -3,6 +3,7 @@
3
3
  * Copyright (c) 2021 - 2023 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/input-container/theme/lumo/vaadin-input-container-styles.js';
6
7
  import '@vaadin/vaadin-lumo-styles/sizing.js';
7
8
  import { fieldButton } from '@vaadin/vaadin-lumo-styles/mixins/field-button.js';
8
9
  import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
@@ -3,6 +3,5 @@
3
3
  * Copyright (c) 2021 - 2023 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/input-container/theme/lumo/vaadin-input-container.js';
7
6
  import './vaadin-number-field-styles.js';
8
7
  import '../../src/vaadin-number-field.js';
@@ -3,6 +3,7 @@
3
3
  * Copyright (c) 2021 - 2023 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/input-container/theme/material/vaadin-input-container-styles.js';
6
7
  import { fieldButton } from '@vaadin/vaadin-material-styles/mixins/field-button.js';
7
8
  import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
8
9
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -3,6 +3,5 @@
3
3
  * Copyright (c) 2021 - 2023 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/input-container/theme/material/vaadin-input-container.js';
7
6
  import './vaadin-number-field-styles.js';
8
7
  import '../../src/vaadin-number-field.js';
package/web-types.json ADDED
@@ -0,0 +1,579 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/web-types",
3
+ "name": "@vaadin/number-field",
4
+ "version": "24.3.0-alpha2",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
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.3.0-alpha2/#/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.",
12
+ "attributes": [
13
+ {
14
+ "name": "disabled",
15
+ "description": "If true, the user cannot interact with this element.",
16
+ "value": {
17
+ "type": [
18
+ "boolean",
19
+ "null",
20
+ "undefined"
21
+ ]
22
+ }
23
+ },
24
+ {
25
+ "name": "autofocus",
26
+ "description": "Specify that this control should have input focus when the page loads.",
27
+ "value": {
28
+ "type": [
29
+ "boolean",
30
+ "null",
31
+ "undefined"
32
+ ]
33
+ }
34
+ },
35
+ {
36
+ "name": "label",
37
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
38
+ "value": {
39
+ "type": [
40
+ "string",
41
+ "null",
42
+ "undefined"
43
+ ]
44
+ }
45
+ },
46
+ {
47
+ "name": "invalid",
48
+ "description": "Set to true when the field is invalid.",
49
+ "value": {
50
+ "type": [
51
+ "boolean",
52
+ "null",
53
+ "undefined"
54
+ ]
55
+ }
56
+ },
57
+ {
58
+ "name": "required",
59
+ "description": "Specifies that the user must fill in a value.",
60
+ "value": {
61
+ "type": [
62
+ "boolean",
63
+ "null",
64
+ "undefined"
65
+ ]
66
+ }
67
+ },
68
+ {
69
+ "name": "error-message",
70
+ "description": "Error to show when the field is invalid.",
71
+ "value": {
72
+ "type": [
73
+ "string",
74
+ "null",
75
+ "undefined"
76
+ ]
77
+ }
78
+ },
79
+ {
80
+ "name": "helper-text",
81
+ "description": "String used for the helper text.",
82
+ "value": {
83
+ "type": [
84
+ "string",
85
+ "null",
86
+ "undefined"
87
+ ]
88
+ }
89
+ },
90
+ {
91
+ "name": "accessible-name",
92
+ "description": "String used to label the component to screen reader users.",
93
+ "value": {
94
+ "type": [
95
+ "string",
96
+ "null",
97
+ "undefined"
98
+ ]
99
+ }
100
+ },
101
+ {
102
+ "name": "accessible-name-ref",
103
+ "description": "Id of the element used as label of the component to screen reader users.",
104
+ "value": {
105
+ "type": [
106
+ "string",
107
+ "null",
108
+ "undefined"
109
+ ]
110
+ }
111
+ },
112
+ {
113
+ "name": "value",
114
+ "description": "The value of the field.",
115
+ "value": {
116
+ "type": [
117
+ "string",
118
+ "null",
119
+ "undefined"
120
+ ]
121
+ }
122
+ },
123
+ {
124
+ "name": "clear-button-visible",
125
+ "description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
126
+ "value": {
127
+ "type": [
128
+ "boolean",
129
+ "null",
130
+ "undefined"
131
+ ]
132
+ }
133
+ },
134
+ {
135
+ "name": "allowed-char-pattern",
136
+ "description": "A pattern matched against individual characters the user inputs.\n\nWhen set, the field will prevent:\n- `keydown` events if the entered key doesn't match `/^allowedCharPattern$/`\n- `paste` events if the pasted text doesn't match `/^allowedCharPattern*$/`\n- `drop` events if the dropped text doesn't match `/^allowedCharPattern*$/`\n\nFor example, to allow entering only numbers and minus signs, use:\n`allowedCharPattern = \"[\\\\d-]\"`",
137
+ "value": {
138
+ "type": [
139
+ "string",
140
+ "null",
141
+ "undefined"
142
+ ]
143
+ }
144
+ },
145
+ {
146
+ "name": "autoselect",
147
+ "description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
148
+ "value": {
149
+ "type": [
150
+ "boolean",
151
+ "null",
152
+ "undefined"
153
+ ]
154
+ }
155
+ },
156
+ {
157
+ "name": "name",
158
+ "description": "The name of this field.",
159
+ "value": {
160
+ "type": [
161
+ "string",
162
+ "null",
163
+ "undefined"
164
+ ]
165
+ }
166
+ },
167
+ {
168
+ "name": "placeholder",
169
+ "description": "A hint to the user of what can be entered in the field.",
170
+ "value": {
171
+ "type": [
172
+ "string",
173
+ "null",
174
+ "undefined"
175
+ ]
176
+ }
177
+ },
178
+ {
179
+ "name": "readonly",
180
+ "description": "When present, it specifies that the field is read-only.",
181
+ "value": {
182
+ "type": [
183
+ "boolean",
184
+ "null",
185
+ "undefined"
186
+ ]
187
+ }
188
+ },
189
+ {
190
+ "name": "title",
191
+ "description": "The text usually displayed in a tooltip popup when the mouse is over the field.",
192
+ "value": {
193
+ "type": [
194
+ "string",
195
+ "null",
196
+ "undefined"
197
+ ]
198
+ }
199
+ },
200
+ {
201
+ "name": "autocomplete",
202
+ "description": "Whether the value of the control can be automatically completed by the browser.\nList of available options at:\nhttps://developer.mozilla.org/en/docs/Web/HTML/Element/input#attr-autocomplete",
203
+ "value": {
204
+ "type": [
205
+ "string",
206
+ "null",
207
+ "undefined"
208
+ ]
209
+ }
210
+ },
211
+ {
212
+ "name": "autocorrect",
213
+ "description": "This is a property supported by Safari that is used to control whether\nautocorrection should be enabled when the user is entering/editing the text.\nPossible values are:\non: Enable autocorrection.\noff: Disable autocorrection.",
214
+ "value": {
215
+ "type": [
216
+ "string",
217
+ "null",
218
+ "undefined"
219
+ ]
220
+ }
221
+ },
222
+ {
223
+ "name": "autocapitalize",
224
+ "description": "This is a property supported by Safari and Chrome that is used to control whether\nautocapitalization should be enabled when the user is entering/editing the text.\nPossible values are:\ncharacters: Characters capitalization.\nwords: Words capitalization.\nsentences: Sentences capitalization.\nnone: No capitalization.",
225
+ "value": {
226
+ "type": [
227
+ "string",
228
+ "null",
229
+ "undefined"
230
+ ]
231
+ }
232
+ },
233
+ {
234
+ "name": "min",
235
+ "description": "The minimum value of the field.",
236
+ "value": {
237
+ "type": [
238
+ "number",
239
+ "null",
240
+ "undefined"
241
+ ]
242
+ }
243
+ },
244
+ {
245
+ "name": "max",
246
+ "description": "The maximum value of the field.",
247
+ "value": {
248
+ "type": [
249
+ "number",
250
+ "null",
251
+ "undefined"
252
+ ]
253
+ }
254
+ },
255
+ {
256
+ "name": "step",
257
+ "description": "Specifies the allowed number intervals of the field.",
258
+ "value": {
259
+ "type": [
260
+ "number"
261
+ ]
262
+ }
263
+ },
264
+ {
265
+ "name": "step-buttons-visible",
266
+ "description": "Set to true to show increase/decrease buttons.",
267
+ "value": {
268
+ "type": [
269
+ "boolean",
270
+ "null",
271
+ "undefined"
272
+ ]
273
+ }
274
+ },
275
+ {
276
+ "name": "theme",
277
+ "description": "The theme variants to apply to the component.",
278
+ "value": {
279
+ "type": [
280
+ "string",
281
+ "null",
282
+ "undefined"
283
+ ]
284
+ }
285
+ }
286
+ ],
287
+ "js": {
288
+ "properties": [
289
+ {
290
+ "name": "disabled",
291
+ "description": "If true, the user cannot interact with this element.",
292
+ "value": {
293
+ "type": [
294
+ "boolean",
295
+ "null",
296
+ "undefined"
297
+ ]
298
+ }
299
+ },
300
+ {
301
+ "name": "autofocus",
302
+ "description": "Specify that this control should have input focus when the page loads.",
303
+ "value": {
304
+ "type": [
305
+ "boolean",
306
+ "null",
307
+ "undefined"
308
+ ]
309
+ }
310
+ },
311
+ {
312
+ "name": "label",
313
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
314
+ "value": {
315
+ "type": [
316
+ "string",
317
+ "null",
318
+ "undefined"
319
+ ]
320
+ }
321
+ },
322
+ {
323
+ "name": "invalid",
324
+ "description": "Set to true when the field is invalid.",
325
+ "value": {
326
+ "type": [
327
+ "boolean",
328
+ "null",
329
+ "undefined"
330
+ ]
331
+ }
332
+ },
333
+ {
334
+ "name": "required",
335
+ "description": "Specifies that the user must fill in a value.",
336
+ "value": {
337
+ "type": [
338
+ "boolean",
339
+ "null",
340
+ "undefined"
341
+ ]
342
+ }
343
+ },
344
+ {
345
+ "name": "errorMessage",
346
+ "description": "Error to show when the field is invalid.",
347
+ "value": {
348
+ "type": [
349
+ "string",
350
+ "null",
351
+ "undefined"
352
+ ]
353
+ }
354
+ },
355
+ {
356
+ "name": "helperText",
357
+ "description": "String used for the helper text.",
358
+ "value": {
359
+ "type": [
360
+ "string",
361
+ "null",
362
+ "undefined"
363
+ ]
364
+ }
365
+ },
366
+ {
367
+ "name": "accessibleName",
368
+ "description": "String used to label the component to screen reader users.",
369
+ "value": {
370
+ "type": [
371
+ "string",
372
+ "null",
373
+ "undefined"
374
+ ]
375
+ }
376
+ },
377
+ {
378
+ "name": "accessibleNameRef",
379
+ "description": "Id of the element used as label of the component to screen reader users.",
380
+ "value": {
381
+ "type": [
382
+ "string",
383
+ "null",
384
+ "undefined"
385
+ ]
386
+ }
387
+ },
388
+ {
389
+ "name": "value",
390
+ "description": "The value of the field.",
391
+ "value": {
392
+ "type": [
393
+ "string",
394
+ "null",
395
+ "undefined"
396
+ ]
397
+ }
398
+ },
399
+ {
400
+ "name": "clearButtonVisible",
401
+ "description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
402
+ "value": {
403
+ "type": [
404
+ "boolean",
405
+ "null",
406
+ "undefined"
407
+ ]
408
+ }
409
+ },
410
+ {
411
+ "name": "allowedCharPattern",
412
+ "description": "A pattern matched against individual characters the user inputs.\n\nWhen set, the field will prevent:\n- `keydown` events if the entered key doesn't match `/^allowedCharPattern$/`\n- `paste` events if the pasted text doesn't match `/^allowedCharPattern*$/`\n- `drop` events if the dropped text doesn't match `/^allowedCharPattern*$/`\n\nFor example, to allow entering only numbers and minus signs, use:\n`allowedCharPattern = \"[\\\\d-]\"`",
413
+ "value": {
414
+ "type": [
415
+ "string",
416
+ "null",
417
+ "undefined"
418
+ ]
419
+ }
420
+ },
421
+ {
422
+ "name": "autoselect",
423
+ "description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
424
+ "value": {
425
+ "type": [
426
+ "boolean",
427
+ "null",
428
+ "undefined"
429
+ ]
430
+ }
431
+ },
432
+ {
433
+ "name": "name",
434
+ "description": "The name of this field.",
435
+ "value": {
436
+ "type": [
437
+ "string",
438
+ "null",
439
+ "undefined"
440
+ ]
441
+ }
442
+ },
443
+ {
444
+ "name": "placeholder",
445
+ "description": "A hint to the user of what can be entered in the field.",
446
+ "value": {
447
+ "type": [
448
+ "string",
449
+ "null",
450
+ "undefined"
451
+ ]
452
+ }
453
+ },
454
+ {
455
+ "name": "readonly",
456
+ "description": "When present, it specifies that the field is read-only.",
457
+ "value": {
458
+ "type": [
459
+ "boolean",
460
+ "null",
461
+ "undefined"
462
+ ]
463
+ }
464
+ },
465
+ {
466
+ "name": "title",
467
+ "description": "The text usually displayed in a tooltip popup when the mouse is over the field.",
468
+ "value": {
469
+ "type": [
470
+ "string",
471
+ "null",
472
+ "undefined"
473
+ ]
474
+ }
475
+ },
476
+ {
477
+ "name": "autocomplete",
478
+ "description": "Whether the value of the control can be automatically completed by the browser.\nList of available options at:\nhttps://developer.mozilla.org/en/docs/Web/HTML/Element/input#attr-autocomplete",
479
+ "value": {
480
+ "type": [
481
+ "string",
482
+ "null",
483
+ "undefined"
484
+ ]
485
+ }
486
+ },
487
+ {
488
+ "name": "autocorrect",
489
+ "description": "This is a property supported by Safari that is used to control whether\nautocorrection should be enabled when the user is entering/editing the text.\nPossible values are:\non: Enable autocorrection.\noff: Disable autocorrection.",
490
+ "value": {
491
+ "type": [
492
+ "string",
493
+ "null",
494
+ "undefined"
495
+ ]
496
+ }
497
+ },
498
+ {
499
+ "name": "autocapitalize",
500
+ "description": "This is a property supported by Safari and Chrome that is used to control whether\nautocapitalization should be enabled when the user is entering/editing the text.\nPossible values are:\ncharacters: Characters capitalization.\nwords: Words capitalization.\nsentences: Sentences capitalization.\nnone: No capitalization.",
501
+ "value": {
502
+ "type": [
503
+ "string",
504
+ "null",
505
+ "undefined"
506
+ ]
507
+ }
508
+ },
509
+ {
510
+ "name": "min",
511
+ "description": "The minimum value of the field.",
512
+ "value": {
513
+ "type": [
514
+ "number",
515
+ "null",
516
+ "undefined"
517
+ ]
518
+ }
519
+ },
520
+ {
521
+ "name": "max",
522
+ "description": "The maximum value of the field.",
523
+ "value": {
524
+ "type": [
525
+ "number",
526
+ "null",
527
+ "undefined"
528
+ ]
529
+ }
530
+ },
531
+ {
532
+ "name": "step",
533
+ "description": "Specifies the allowed number intervals of the field.",
534
+ "value": {
535
+ "type": [
536
+ "number"
537
+ ]
538
+ }
539
+ },
540
+ {
541
+ "name": "stepButtonsVisible",
542
+ "description": "Set to true to show increase/decrease buttons.",
543
+ "value": {
544
+ "type": [
545
+ "boolean",
546
+ "null",
547
+ "undefined"
548
+ ]
549
+ }
550
+ }
551
+ ],
552
+ "events": [
553
+ {
554
+ "name": "validated",
555
+ "description": "Fired whenever the field is validated."
556
+ },
557
+ {
558
+ "name": "change",
559
+ "description": "Fired when the user commits a value change."
560
+ },
561
+ {
562
+ "name": "input",
563
+ "description": "Fired when the value is changed by the user: on every typing keystroke,\nand the value is cleared using the clear button."
564
+ },
565
+ {
566
+ "name": "invalid-changed",
567
+ "description": "Fired when the `invalid` property changes."
568
+ },
569
+ {
570
+ "name": "value-changed",
571
+ "description": "Fired when the `value` property changes."
572
+ }
573
+ ]
574
+ }
575
+ }
576
+ ]
577
+ }
578
+ }
579
+ }
@@ -0,0 +1,230 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/web-types",
3
+ "name": "@vaadin/number-field",
4
+ "version": "24.3.0-alpha2",
5
+ "description-markup": "markdown",
6
+ "framework": "lit",
7
+ "framework-config": {
8
+ "enable-when": {
9
+ "node-packages": [
10
+ "lit"
11
+ ]
12
+ }
13
+ },
14
+ "contributions": {
15
+ "html": {
16
+ "elements": [
17
+ {
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.3.0-alpha2/#/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.",
20
+ "extension": true,
21
+ "attributes": [
22
+ {
23
+ "name": "?disabled",
24
+ "description": "If true, the user cannot interact with this element.",
25
+ "value": {
26
+ "kind": "expression"
27
+ }
28
+ },
29
+ {
30
+ "name": "?autofocus",
31
+ "description": "Specify that this control should have input focus when the page loads.",
32
+ "value": {
33
+ "kind": "expression"
34
+ }
35
+ },
36
+ {
37
+ "name": "?invalid",
38
+ "description": "Set to true when the field is invalid.",
39
+ "value": {
40
+ "kind": "expression"
41
+ }
42
+ },
43
+ {
44
+ "name": "?required",
45
+ "description": "Specifies that the user must fill in a value.",
46
+ "value": {
47
+ "kind": "expression"
48
+ }
49
+ },
50
+ {
51
+ "name": "?clearButtonVisible",
52
+ "description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
53
+ "value": {
54
+ "kind": "expression"
55
+ }
56
+ },
57
+ {
58
+ "name": "?autoselect",
59
+ "description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
60
+ "value": {
61
+ "kind": "expression"
62
+ }
63
+ },
64
+ {
65
+ "name": "?readonly",
66
+ "description": "When present, it specifies that the field is read-only.",
67
+ "value": {
68
+ "kind": "expression"
69
+ }
70
+ },
71
+ {
72
+ "name": "?stepButtonsVisible",
73
+ "description": "Set to true to show increase/decrease buttons.",
74
+ "value": {
75
+ "kind": "expression"
76
+ }
77
+ },
78
+ {
79
+ "name": ".label",
80
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
81
+ "value": {
82
+ "kind": "expression"
83
+ }
84
+ },
85
+ {
86
+ "name": ".errorMessage",
87
+ "description": "Error to show when the field is invalid.",
88
+ "value": {
89
+ "kind": "expression"
90
+ }
91
+ },
92
+ {
93
+ "name": ".helperText",
94
+ "description": "String used for the helper text.",
95
+ "value": {
96
+ "kind": "expression"
97
+ }
98
+ },
99
+ {
100
+ "name": ".accessibleName",
101
+ "description": "String used to label the component to screen reader users.",
102
+ "value": {
103
+ "kind": "expression"
104
+ }
105
+ },
106
+ {
107
+ "name": ".accessibleNameRef",
108
+ "description": "Id of the element used as label of the component to screen reader users.",
109
+ "value": {
110
+ "kind": "expression"
111
+ }
112
+ },
113
+ {
114
+ "name": ".value",
115
+ "description": "The value of the field.",
116
+ "value": {
117
+ "kind": "expression"
118
+ }
119
+ },
120
+ {
121
+ "name": ".allowedCharPattern",
122
+ "description": "A pattern matched against individual characters the user inputs.\n\nWhen set, the field will prevent:\n- `keydown` events if the entered key doesn't match `/^allowedCharPattern$/`\n- `paste` events if the pasted text doesn't match `/^allowedCharPattern*$/`\n- `drop` events if the dropped text doesn't match `/^allowedCharPattern*$/`\n\nFor example, to allow entering only numbers and minus signs, use:\n`allowedCharPattern = \"[\\\\d-]\"`",
123
+ "value": {
124
+ "kind": "expression"
125
+ }
126
+ },
127
+ {
128
+ "name": ".name",
129
+ "description": "The name of this field.",
130
+ "value": {
131
+ "kind": "expression"
132
+ }
133
+ },
134
+ {
135
+ "name": ".placeholder",
136
+ "description": "A hint to the user of what can be entered in the field.",
137
+ "value": {
138
+ "kind": "expression"
139
+ }
140
+ },
141
+ {
142
+ "name": ".title",
143
+ "description": "The text usually displayed in a tooltip popup when the mouse is over the field.",
144
+ "value": {
145
+ "kind": "expression"
146
+ }
147
+ },
148
+ {
149
+ "name": ".autocomplete",
150
+ "description": "Whether the value of the control can be automatically completed by the browser.\nList of available options at:\nhttps://developer.mozilla.org/en/docs/Web/HTML/Element/input#attr-autocomplete",
151
+ "value": {
152
+ "kind": "expression"
153
+ }
154
+ },
155
+ {
156
+ "name": ".autocorrect",
157
+ "description": "This is a property supported by Safari that is used to control whether\nautocorrection should be enabled when the user is entering/editing the text.\nPossible values are:\non: Enable autocorrection.\noff: Disable autocorrection.",
158
+ "value": {
159
+ "kind": "expression"
160
+ }
161
+ },
162
+ {
163
+ "name": ".autocapitalize",
164
+ "description": "This is a property supported by Safari and Chrome that is used to control whether\nautocapitalization should be enabled when the user is entering/editing the text.\nPossible values are:\ncharacters: Characters capitalization.\nwords: Words capitalization.\nsentences: Sentences capitalization.\nnone: No capitalization.",
165
+ "value": {
166
+ "kind": "expression"
167
+ }
168
+ },
169
+ {
170
+ "name": ".min",
171
+ "description": "The minimum value of the field.",
172
+ "value": {
173
+ "kind": "expression"
174
+ }
175
+ },
176
+ {
177
+ "name": ".max",
178
+ "description": "The maximum value of the field.",
179
+ "value": {
180
+ "kind": "expression"
181
+ }
182
+ },
183
+ {
184
+ "name": ".step",
185
+ "description": "Specifies the allowed number intervals of the field.",
186
+ "value": {
187
+ "kind": "expression"
188
+ }
189
+ },
190
+ {
191
+ "name": "@validated",
192
+ "description": "Fired whenever the field is validated.",
193
+ "value": {
194
+ "kind": "expression"
195
+ }
196
+ },
197
+ {
198
+ "name": "@change",
199
+ "description": "Fired when the user commits a value change.",
200
+ "value": {
201
+ "kind": "expression"
202
+ }
203
+ },
204
+ {
205
+ "name": "@input",
206
+ "description": "Fired when the value is changed by the user: on every typing keystroke,\nand the value is cleared using the clear button.",
207
+ "value": {
208
+ "kind": "expression"
209
+ }
210
+ },
211
+ {
212
+ "name": "@invalid-changed",
213
+ "description": "Fired when the `invalid` property changes.",
214
+ "value": {
215
+ "kind": "expression"
216
+ }
217
+ },
218
+ {
219
+ "name": "@value-changed",
220
+ "description": "Fired when the `value` property changes.",
221
+ "value": {
222
+ "kind": "expression"
223
+ }
224
+ }
225
+ ]
226
+ }
227
+ ]
228
+ }
229
+ }
230
+ }