@fluid-topics/ft-number-field 1.3.14 → 1.3.15
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/build/ft-number-field.js
CHANGED
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { html, nothing } from "lit";
|
|
8
|
-
import { FtLitElement,
|
|
8
|
+
import { FtLitElement, numberProperty } from "@fluid-topics/ft-wc-utils";
|
|
9
9
|
import { styles } from "./ft-number-field.styles";
|
|
10
10
|
import { property, query, state } from "lit/decorators.js";
|
|
11
11
|
import { classMap } from "lit/directives/class-map.js";
|
|
@@ -80,9 +80,9 @@ class FtNumberField extends FtLitElement {
|
|
|
80
80
|
this.setValue(+event.target.value);
|
|
81
81
|
}
|
|
82
82
|
setValue(value) {
|
|
83
|
-
|
|
83
|
+
const oldValue = this.value;
|
|
84
84
|
this.value = value;
|
|
85
|
-
|
|
85
|
+
const boundedValue = this.value == undefined ? undefined : this.lowerBound(this.upperBound(this.value));
|
|
86
86
|
setTimeout(() => {
|
|
87
87
|
this.value = boundedValue;
|
|
88
88
|
if (oldValue !== boundedValue) {
|
|
@@ -110,7 +110,7 @@ __decorate([
|
|
|
110
110
|
property()
|
|
111
111
|
], FtNumberField.prototype, "label", void 0);
|
|
112
112
|
__decorate([
|
|
113
|
-
|
|
113
|
+
numberProperty()
|
|
114
114
|
], FtNumberField.prototype, "value", void 0);
|
|
115
115
|
__decorate([
|
|
116
116
|
property({ type: String })
|
|
@@ -122,10 +122,10 @@ __decorate([
|
|
|
122
122
|
property({ type: Boolean })
|
|
123
123
|
], FtNumberField.prototype, "disabled", void 0);
|
|
124
124
|
__decorate([
|
|
125
|
-
|
|
125
|
+
numberProperty()
|
|
126
126
|
], FtNumberField.prototype, "min", void 0);
|
|
127
127
|
__decorate([
|
|
128
|
-
|
|
128
|
+
numberProperty()
|
|
129
129
|
], FtNumberField.prototype, "max", void 0);
|
|
130
130
|
__decorate([
|
|
131
131
|
state()
|
|
@@ -574,7 +574,7 @@ Also for action icons.`,t.colorGray200),contentGlobalSubtle:e.extend("--ft-conte
|
|
|
574
574
|
${this.helper}
|
|
575
575
|
</ft-typography>`:X.nothing}
|
|
576
576
|
</div>
|
|
577
|
-
`}update(r){super.update(r),(r.has("max")||r.has("min"))&&this.setValue(this.value)}lowerBound(r){return this.min!=null?Math.max(this.min,r):r}upperBound(r){return this.max!=null?Math.min(this.max,r):r}onChange(r){r.preventDefault(),r.stopPropagation(),this.setValue(+r.target.value)}setValue(r){let n=this.value;this.value=r;let i=this.value==null?void 0:this.lowerBound(this.upperBound(this.value));setTimeout(()=>{this.value=i,n!==i&&this.dispatchEvent(new CustomEvent("change",{detail:this.value}))})}onFocus(){this.focused=!0}onMainPanelBlur(){var r;!((r=this.mainPanel)===null||r===void 0)&&r.matches(":focus-within")||(this.focused=!1)}};z.elementDefinitions={"ft-input-label":k,"ft-ripple":C,"ft-typography":K};z.styles=Kt;H([(0,P.property)()],z.prototype,"label",void 0);H([(0,se.
|
|
577
|
+
`}update(r){super.update(r),(r.has("max")||r.has("min"))&&this.setValue(this.value)}lowerBound(r){return this.min!=null?Math.max(this.min,r):r}upperBound(r){return this.max!=null?Math.min(this.max,r):r}onChange(r){r.preventDefault(),r.stopPropagation(),this.setValue(+r.target.value)}setValue(r){let n=this.value;this.value=r;let i=this.value==null?void 0:this.lowerBound(this.upperBound(this.value));setTimeout(()=>{this.value=i,n!==i&&this.dispatchEvent(new CustomEvent("change",{detail:this.value}))})}onFocus(){this.focused=!0}onMainPanelBlur(){var r;!((r=this.mainPanel)===null||r===void 0)&&r.matches(":focus-within")||(this.focused=!1)}};z.elementDefinitions={"ft-input-label":k,"ft-ripple":C,"ft-typography":K};z.styles=Kt;H([(0,P.property)()],z.prototype,"label",void 0);H([(0,se.numberProperty)()],z.prototype,"value",void 0);H([(0,P.property)({type:String})],z.prototype,"helper",void 0);H([(0,P.property)({type:Boolean})],z.prototype,"outlined",void 0);H([(0,P.property)({type:Boolean})],z.prototype,"disabled",void 0);H([(0,se.numberProperty)()],z.prototype,"min",void 0);H([(0,se.numberProperty)()],z.prototype,"max",void 0);H([(0,P.state)()],z.prototype,"focused",void 0);H([(0,P.query)(".ft-number-field--input")],z.prototype,"input",void 0);H([(0,P.query)(".ft-number-field--main-panel")],z.prototype,"mainPanel",void 0);(0,Oo.customElement)("ft-number-field")(z);})();
|
|
578
578
|
/*! Bundled license information:
|
|
579
579
|
|
|
580
580
|
lit-html/directives/when.js:
|