@vaadin/number-field
Advanced tools
Comparing version 24.2.0-dev.f254716fe to 24.3.0-alpha1
{ | ||
"name": "@vaadin/number-field", | ||
"version": "24.2.0-dev.f254716fe", | ||
"version": "24.3.0-alpha1", | ||
"publishConfig": { | ||
@@ -41,9 +41,9 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/a11y-base": "24.2.0-dev.f254716fe", | ||
"@vaadin/component-base": "24.2.0-dev.f254716fe", | ||
"@vaadin/field-base": "24.2.0-dev.f254716fe", | ||
"@vaadin/input-container": "24.2.0-dev.f254716fe", | ||
"@vaadin/vaadin-lumo-styles": "24.2.0-dev.f254716fe", | ||
"@vaadin/vaadin-material-styles": "24.2.0-dev.f254716fe", | ||
"@vaadin/vaadin-themable-mixin": "24.2.0-dev.f254716fe", | ||
"@vaadin/a11y-base": "24.3.0-alpha1", | ||
"@vaadin/component-base": "24.3.0-alpha1", | ||
"@vaadin/field-base": "24.3.0-alpha1", | ||
"@vaadin/input-container": "24.3.0-alpha1", | ||
"@vaadin/vaadin-lumo-styles": "24.3.0-alpha1", | ||
"@vaadin/vaadin-material-styles": "24.3.0-alpha1", | ||
"@vaadin/vaadin-themable-mixin": "24.3.0-alpha1", | ||
"lit": "^2.0.0" | ||
@@ -53,3 +53,3 @@ }, | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@vaadin/testing-helpers": "^0.4.3", | ||
"@vaadin/testing-helpers": "^0.5.0", | ||
"sinon": "^13.0.2" | ||
@@ -61,3 +61,3 @@ }, | ||
], | ||
"gitHead": "da54950b9f8c14c6451ede0d426e16a489c7fb9b" | ||
"gitHead": "9ca6f3ca220a777e8eea181a1f5717e39a732240" | ||
} |
@@ -13,2 +13,3 @@ /** | ||
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js'; | ||
import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js'; | ||
import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js'; | ||
@@ -21,3 +22,2 @@ import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js'; | ||
import type { LabelMixinClass } from '@vaadin/field-base/src/label-mixin.js'; | ||
import type { SlotStylesMixinClass } from '@vaadin/field-base/src/slot-styles-mixin.js'; | ||
import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js'; | ||
@@ -24,0 +24,0 @@ |
@@ -69,2 +69,3 @@ /** | ||
this._setType('number'); | ||
this.__onWheel = this.__onWheel.bind(this); | ||
} | ||
@@ -138,2 +139,46 @@ | ||
/** | ||
* Override the method from `InputMixin` to add | ||
* a wheel event listener to the input element. | ||
* | ||
* @param {HTMLElement} input | ||
* @override | ||
* @protected | ||
*/ | ||
_addInputListeners(input) { | ||
super._addInputListeners(input); | ||
input.addEventListener('wheel', this.__onWheel); | ||
} | ||
/** | ||
* Override the method from `InputMixin` to remove | ||
* the wheel event listener from the input element. | ||
* | ||
* @param {HTMLElement} input | ||
* @override | ||
* @protected | ||
*/ | ||
_removeInputListeners(input) { | ||
super._removeInputListeners(input); | ||
input.removeEventListener('wheel', this.__onWheel); | ||
} | ||
/** | ||
* Prevents default browser behavior for wheel events on the input element | ||
* when it's focused. More precisely, this prevents the browser from attempting | ||
* to increment or decrement the value when the mouse wheel is used within | ||
* the input element. | ||
* | ||
* CAVEAT: As a side-effect, this also prevents page scrolling when | ||
* the pointer is positioned over the field and the field is focused. | ||
* | ||
* @param {WheelEvent} event | ||
* @private | ||
*/ | ||
__onWheel(event) { | ||
if (this.hasAttribute('focused')) { | ||
event.preventDefault(); | ||
} | ||
} | ||
/** @protected */ | ||
@@ -222,2 +267,3 @@ _onDecreaseButtonTouchend(e) { | ||
this.value = this.inputElement.value = String(parseFloat(value)); | ||
this.validate(); | ||
this.dispatchEvent(new CustomEvent('change', { bubbles: true })); | ||
@@ -224,0 +270,0 @@ } |
@@ -24,2 +24,7 @@ /** | ||
/** | ||
* Fired when the `dirty` property changes. | ||
*/ | ||
export type NumberFieldDirtyChangedEvent = CustomEvent<{ value: boolean }>; | ||
/** | ||
* Fired when the `value` property changes. | ||
@@ -37,2 +42,4 @@ */ | ||
'dirty-changed': NumberFieldDirtyChangedEvent; | ||
'value-changed': NumberFieldValueChangedEvent; | ||
@@ -71,2 +78,3 @@ | ||
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes. | ||
* @fires {CustomEvent} dirty-changed - Fired when the `dirty` property changes. | ||
* @fires {CustomEvent} value-changed - Fired when the `value` property changes. | ||
@@ -73,0 +81,0 @@ * @fires {CustomEvent} validated - Fired whenever the field is validated. |
@@ -8,2 +8,3 @@ /** | ||
import { html, PolymerElement } from '@polymer/polymer'; | ||
import { defineCustomElement } from '@vaadin/component-base/src/define.js'; | ||
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js'; | ||
@@ -49,2 +50,3 @@ import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js'; | ||
* | ||
* @customElement | ||
* @extends HTMLElement | ||
@@ -119,5 +121,6 @@ * @mixes NumberFieldMixin | ||
this._tooltipController.setPosition('top'); | ||
this._tooltipController.setAriaTarget(this.inputElement); | ||
} | ||
} | ||
customElements.define(NumberField.is, NumberField); | ||
defineCustomElement(NumberField); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70990
17
1579
+ Added@vaadin/a11y-base@24.3.0-alpha1(transitive)
+ Added@vaadin/component-base@24.3.0-alpha1(transitive)
+ Added@vaadin/field-base@24.3.0-alpha1(transitive)
+ Added@vaadin/icon@24.3.0-alpha1(transitive)
+ Added@vaadin/input-container@24.3.0-alpha1(transitive)
+ Added@vaadin/vaadin-lumo-styles@24.3.0-alpha1(transitive)
+ Added@vaadin/vaadin-material-styles@24.3.0-alpha1(transitive)
+ Added@vaadin/vaadin-themable-mixin@24.3.0-alpha1(transitive)
- Removed@vaadin/a11y-base@24.2.0-dev.f254716fe(transitive)
- Removed@vaadin/component-base@24.2.0-dev.f254716fe(transitive)
- Removed@vaadin/field-base@24.2.0-dev.f254716fe(transitive)
- Removed@vaadin/icon@24.2.0-dev.f254716fe(transitive)
- Removed@vaadin/input-container@24.2.0-dev.f254716fe(transitive)
- Removed@vaadin/vaadin-lumo-styles@24.2.0-dev.f254716fe(transitive)
- Removed@vaadin/vaadin-material-styles@24.2.0-dev.f254716fe(transitive)
- Removed@vaadin/vaadin-themable-mixin@24.2.0-dev.f254716fe(transitive)