@luzmo/analytics-components-kit 1.0.1-alpha.3 → 1.0.1-alpha.4
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/LICENSE +18 -0
- package/custom-elements.json +1550 -0
- package/lib/area-chart-slots.config-BLxiYX05.cjs +20 -0
- package/lib/area-chart-slots.config-C0c2ZzBh.js +52 -0
- package/lib/async-directive-CPjMHOPu.cjs +24 -0
- package/lib/async-directive-SCUUQ3Mh.js +114 -0
- package/lib/bar-chart-slots.config-GSSL7XVA.js +47 -0
- package/lib/bar-chart-slots.config-Jx1PveTM.cjs +20 -0
- package/lib/bar-chart.config-B57geUzJ.cjs +20 -0
- package/lib/bar-chart.config-CQ6HAvs2.js +153 -0
- package/lib/bar-chart.en-BqYbiHO3.cjs +20 -0
- package/lib/bar-chart.en-FwT00qdU.js +69 -0
- package/lib/bar-chart.fr-DGx9smEh.cjs +20 -0
- package/lib/bar-chart.fr-DbxKiM0j.js +44 -0
- package/lib/bar-chart.nl-BYzVExsz.cjs +20 -0
- package/lib/bar-chart.nl-ahX1ARpH.js +44 -0
- package/lib/button-base-B4PdJFVe.cjs +27 -0
- package/lib/button-base-CtfPWS-P.js +142 -0
- package/lib/column-chart.config-B57geUzJ.cjs +20 -0
- package/lib/column-chart.config-C9hP0kX7.js +153 -0
- package/lib/cs-DVZ0Tapy.js +89 -0
- package/lib/cs-I9E81keK.cjs +20 -0
- package/lib/da-DHy05oSR.js +97 -0
- package/lib/da-QkdvupDg.cjs +20 -0
- package/lib/de-Dn5mUzha.cjs +20 -0
- package/lib/de-iM39JlAt.js +109 -0
- package/lib/decompose-numeric-format-B3rVVHpO.cjs +20 -0
- package/lib/decompose-numeric-format-BuZcjH2k.js +39 -0
- package/lib/directive-helpers-BSB0tfc9.cjs +32 -0
- package/lib/directive-helpers-eY1rHtyn.js +154 -0
- package/lib/divider.module-BW8qaMVq.js +211 -0
- package/lib/divider.module-DEy88Ieh.cjs +20 -0
- package/lib/donut-chart-slots.config-BEwhfq27.js +39 -0
- package/lib/donut-chart-slots.config-DIp-24lO.cjs +20 -0
- package/lib/donut-chart.config-3DhKiSSM.js +177 -0
- package/lib/donut-chart.config-DLWJUlHx.cjs +20 -0
- package/lib/donut-chart.en-Blb9oSdU.cjs +20 -0
- package/lib/donut-chart.en-CzjT4-XN.js +85 -0
- package/lib/donut-chart.fr-BeTVa2wh.cjs +20 -0
- package/lib/donut-chart.fr-DftPrKbG.js +39 -0
- package/lib/donut-chart.nl-D9YGbOce.cjs +20 -0
- package/lib/donut-chart.nl-NMatXfhK.js +39 -0
- package/lib/draggable-data-item/index.cjs +20 -0
- package/lib/draggable-data-item/index.js +30 -0
- package/lib/droppable-slot/index.cjs +20 -0
- package/lib/droppable-slot/index.js +30 -0
- package/lib/en-BDBzmAXX.cjs +202 -0
- package/lib/en-CIeY2T5K.js +1980 -0
- package/lib/en-GB-BqYHIX1v.cjs +20 -0
- package/lib/en-GB-CYx--4nh.js +28 -0
- package/lib/es-CwyPlN5d.cjs +20 -0
- package/lib/es-KhTq4jX8.js +305 -0
- package/lib/fi-Dh_ebgpe.js +97 -0
- package/lib/fi-rijeZE5V.cjs +20 -0
- package/lib/fr-BcgE-6S_.cjs +20 -0
- package/lib/fr-CU727YF1.js +305 -0
- package/lib/get-css-variable-BHHQ0SnL.js +1444 -0
- package/lib/get-css-variable-D439CdH9.cjs +24 -0
- package/lib/he-Au3xg6lR.js +89 -0
- package/lib/he-O6Ih8Bqh.cjs +20 -0
- package/lib/hu-BnZ8y3xQ.cjs +20 -0
- package/lib/hu-DNJ-P_MW.js +97 -0
- package/lib/if-defined-BbzmSG-O.js +757 -0
- package/lib/if-defined-V7yEJWI3.cjs +54 -0
- package/lib/imageobject.config-B7ld9bj3.cjs +20 -0
- package/lib/imageobject.config-DZLp9Elq.js +127 -0
- package/lib/index-0314DjEl.cjs +20 -0
- package/lib/index-B9h2L_hV.js +3048 -0
- package/lib/index-BDXFsKUM.cjs +146 -0
- package/lib/index-Bd4cKS9O.js +155 -0
- package/lib/index-BmAD29P2.js +106 -0
- package/lib/index-Bo1DpZ-1.cjs +58 -0
- package/lib/index-C4ePDYEC.cjs +41 -0
- package/lib/index-C9xEN5Ji.js +82 -0
- package/lib/index-CBCm4_7S.js +869 -0
- package/lib/index-CM80_HQw.js +442 -0
- package/lib/index-CcF-9wyF.cjs +71 -0
- package/lib/index-CfEm5P0J.cjs +196 -0
- package/lib/index-CrWoFMZ3.cjs +22 -0
- package/lib/index-CtEJZdT0.js +1627 -0
- package/lib/index-CvX-HLY1.cjs +322 -0
- package/lib/index-D37RwuEH.js +1584 -0
- package/lib/index-D5puKlcm.cjs +96 -0
- package/lib/index-DGz6jCKo.cjs +26 -0
- package/lib/index-DJp_9h0l.js +327 -0
- package/lib/index-DSbgZduE.js +501 -0
- package/lib/index-D_KYpfBM.js +24 -0
- package/lib/index-DdtjeKYI.js +928 -0
- package/lib/index-Dj7PF4Q9.cjs +63 -0
- package/lib/index-Dq3HAOaM.js +127 -0
- package/lib/index-DrIA0eFE.js +392 -0
- package/lib/index-jt6FL_uE.cjs +20 -0
- package/lib/index-kJR406YZ.cjs +112 -0
- package/lib/index-v8ZTprPO.cjs +51 -0
- package/lib/index.cjs +875 -0
- package/lib/index.js +6367 -302
- package/lib/it-Bh5U73z6.js +305 -0
- package/lib/it-PshtLMkq.cjs +20 -0
- package/lib/ja-CCcHUL61.js +89 -0
- package/lib/ja-KIS2HdaG.cjs +20 -0
- package/lib/ko--l4qmjLV.cjs +20 -0
- package/lib/ko-DhapsZMM.js +89 -0
- package/lib/line-chart.config-BZcvfO2c.cjs +20 -0
- package/lib/line-chart.config-CIVN6uLI.js +115 -0
- package/lib/mk-B9HPSuKa.js +97 -0
- package/lib/mk-DZlj-edb.cjs +20 -0
- package/lib/nl-BKlDqOXb.cjs +20 -0
- package/lib/nl-BwSt5Bf4.js +109 -0
- package/lib/no-D-DofYnx.js +109 -0
- package/lib/no-D_SzxhTu.cjs +20 -0
- package/lib/observe-slot-text-DOYmGOZe.js +181 -0
- package/lib/observe-slot-text-oJ0a2KY9.cjs +42 -0
- package/lib/picker/index.cjs +20 -0
- package/lib/picker/index.js +32 -0
- package/lib/pl-D_L_0Boq.js +97 -0
- package/lib/pl-PIK23rK_.cjs +20 -0
- package/lib/popover-Bwnkg-5-.js +67 -0
- package/lib/popover-CQGN8nbX.cjs +32 -0
- package/lib/progress-circle/index.cjs +35 -0
- package/lib/progress-circle/index.js +104 -0
- package/lib/pt-B0BBS5VB.js +89 -0
- package/lib/pt-Dqlu4MS5.cjs +20 -0
- package/lib/ru-Vo-m3O_2.js +108 -0
- package/lib/ru-zyNDTB04.cjs +20 -0
- package/lib/sv-1DPTltNQ.cjs +20 -0
- package/lib/sv-CiozMaev.js +89 -0
- package/lib/textobject.config-C8opcGG4.js +52 -0
- package/lib/textobject.config-DbAajFz8.cjs +20 -0
- package/lib/tr-BkmWvOG2.cjs +20 -0
- package/lib/tr-D_D4i5iv.js +109 -0
- package/lib/zh-CN-DTZ4OmdP.cjs +20 -0
- package/lib/zh-CN-wsl7eFSd.js +89 -0
- package/lib/zh-TW-DTZ4OmdP.cjs +20 -0
- package/lib/zh-TW-wsl7eFSd.js +89 -0
- package/package.json +16 -12
- package/lib/37.js +0 -1
- package/lib/729.js +0 -1
- package/lib/common-31743c5a.js +0 -13
- package/lib/common-b02547a0.js +0 -1
- package/lib/common-b49d9a9d.js +0 -1
- package/lib/common-b5232813.js +0 -56
- package/lib/common-cefd4f4c.js +0 -1
- package/lib/common-d6cb565f.js +0 -1
- package/lib/common-fd868059.js +0 -1
- package/lib/common-fedaf338.js +0 -32
- package/lib/edit-option-picker/index.js +0 -314
- package/lib/edit-option-slider/index.js +0 -102
- package/lib/edit-option-toggle/index.js +0 -114
- package/lib/vendors-93cc3efa.js +0 -1
- package/lib/vendors-bb3d84b5.js +0 -1
@@ -0,0 +1,869 @@
|
|
1
|
+
/*! * A kit of modern Luzmo Web Components for analytics in your web application.
|
2
|
+
*
|
3
|
+
* Copyright © 2024 Luzmo
|
4
|
+
* All rights reserved.
|
5
|
+
* Luzmo web components (“Luzmo Web Components”)
|
6
|
+
* must be used according to the Luzmo Terms of Service.
|
7
|
+
* This license allows users with a current active Luzmo account
|
8
|
+
* to use the Luzmo Web Components. This license terminates
|
9
|
+
* automatically if a user no longer has an active Luzmo account.
|
10
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
11
|
+
*
|
12
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
14
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
15
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
16
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
17
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
18
|
+
* SOFTWARE.
|
19
|
+
* */
|
20
|
+
import { O as D, m as J, T as Q } from "./index-DdtjeKYI.js";
|
21
|
+
import { f as ee, i as L, a as te, b as re } from "./async-directive-SCUUQ3Mh.js";
|
22
|
+
import { E as M, S as oe, r as A, x as S, n as c, e as ie } from "./if-defined-BbzmSG-O.js";
|
23
|
+
import { e as se } from "./directive-helpers-eY1rHtyn.js";
|
24
|
+
import { B as ne } from "./button-base-CtfPWS-P.js";
|
25
|
+
import { L as le } from "./index-CtEJZdT0.js";
|
26
|
+
const T = Symbol(
|
27
|
+
"language resolver updated"
|
28
|
+
);
|
29
|
+
class de {
|
30
|
+
constructor(e) {
|
31
|
+
this.language = document.documentElement.lang || navigator.language, this.host = e, this.host.addController(this);
|
32
|
+
}
|
33
|
+
hostConnected() {
|
34
|
+
this.resolveLanguage();
|
35
|
+
}
|
36
|
+
hostDisconnected() {
|
37
|
+
var e;
|
38
|
+
(e = this.unsubscribe) == null || e.call(this);
|
39
|
+
}
|
40
|
+
resolveLanguage() {
|
41
|
+
const e = new CustomEvent(
|
42
|
+
"luzmo-language-context",
|
43
|
+
{
|
44
|
+
bubbles: !0,
|
45
|
+
composed: !0,
|
46
|
+
detail: {
|
47
|
+
callback: (t, r) => {
|
48
|
+
const o = this.language;
|
49
|
+
this.language = t, this.unsubscribe = r, this.host.requestUpdate(T, o);
|
50
|
+
}
|
51
|
+
},
|
52
|
+
cancelable: !0
|
53
|
+
}
|
54
|
+
);
|
55
|
+
this.host.dispatchEvent(e);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
const f = [
|
59
|
+
"",
|
60
|
+
() => {
|
61
|
+
}
|
62
|
+
];
|
63
|
+
class ae extends ee {
|
64
|
+
constructor() {
|
65
|
+
super(...arguments), this.start = f, this.streamInside = f, this.end = f, this.streamOutside = f, this.state = "off", this.handleStart = (e) => {
|
66
|
+
this.clearStream(), this.callHandler(this.start[1], e), !e.defaultPrevented && (this.removeListeners(), this.addListeners("on"));
|
67
|
+
}, this.handleInside = (e) => {
|
68
|
+
this.handleStream(this.streamInside[1], e);
|
69
|
+
}, this.handleEnd = (e) => {
|
70
|
+
this.clearStream(), this.callHandler(this.end[1], e), this.removeListeners(), this.addListeners("off");
|
71
|
+
}, this.handleOutside = (e) => {
|
72
|
+
this.handleStream(this.streamOutside[1], e);
|
73
|
+
};
|
74
|
+
}
|
75
|
+
/* c8 ignore next 4 */
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
77
|
+
render(e) {
|
78
|
+
return M;
|
79
|
+
}
|
80
|
+
update(e, [
|
81
|
+
{
|
82
|
+
start: t,
|
83
|
+
end: r,
|
84
|
+
streamInside: o = f,
|
85
|
+
streamOutside: i = f
|
86
|
+
}
|
87
|
+
]) {
|
88
|
+
var n;
|
89
|
+
this.element !== e.element && (this.element = e.element, this.removeListeners()), this.host = ((n = e.options) == null ? void 0 : n.host) || this.element, this.start = t, this.end = r, this.streamInside = o, this.streamOutside = i, this.addListeners();
|
90
|
+
}
|
91
|
+
addListeners(e) {
|
92
|
+
this.state = e || this.state, this.state === "off" ? (this.addListener(this.streamOutside[0], this.handleOutside), this.addListener(this.start[0], this.handleStart)) : this.state === "on" && (this.addListener(this.streamInside[0], this.handleInside), this.addListener(this.end[0], this.handleEnd));
|
93
|
+
}
|
94
|
+
callHandler(e, t) {
|
95
|
+
typeof e == "function" ? e.call(this.host, t) : e.handleEvent(t);
|
96
|
+
}
|
97
|
+
handleStream(e, t) {
|
98
|
+
this.stream || (this.callHandler(e, t), this.stream = requestAnimationFrame(() => {
|
99
|
+
this.stream = void 0;
|
100
|
+
}));
|
101
|
+
}
|
102
|
+
clearStream() {
|
103
|
+
this.stream != null && (cancelAnimationFrame(this.stream), this.stream = void 0);
|
104
|
+
}
|
105
|
+
addListener(e, t) {
|
106
|
+
Array.isArray(e) ? e.map((r) => {
|
107
|
+
this.element.addEventListener(r, t);
|
108
|
+
}) : this.element.addEventListener(e, t);
|
109
|
+
}
|
110
|
+
removeListener(e, t) {
|
111
|
+
Array.isArray(e) ? e.map((r) => {
|
112
|
+
this.element.removeEventListener(r, t);
|
113
|
+
}) : this.element.removeEventListener(e, t);
|
114
|
+
}
|
115
|
+
removeListeners() {
|
116
|
+
this.removeListener(this.start[0], this.handleStart), this.removeListener(this.streamInside[0], this.handleInside), this.removeListener(this.end[0], this.handleEnd), this.removeListener(this.streamOutside[0], this.handleOutside);
|
117
|
+
}
|
118
|
+
disconnected() {
|
119
|
+
this.removeListeners();
|
120
|
+
}
|
121
|
+
/* c8 ignore next 3 */
|
122
|
+
reconnected() {
|
123
|
+
this.addListeners();
|
124
|
+
}
|
125
|
+
}
|
126
|
+
const ue = se(
|
127
|
+
ae
|
128
|
+
);
|
129
|
+
let F = /* @__PURE__ */ new Map(), P = !1;
|
130
|
+
try {
|
131
|
+
P = new Intl.NumberFormat("de-DE", {
|
132
|
+
signDisplay: "exceptZero"
|
133
|
+
}).resolvedOptions().signDisplay === "exceptZero";
|
134
|
+
} catch {
|
135
|
+
}
|
136
|
+
let y = !1;
|
137
|
+
try {
|
138
|
+
y = new Intl.NumberFormat("de-DE", {
|
139
|
+
style: "unit",
|
140
|
+
unit: "degree"
|
141
|
+
}).resolvedOptions().style === "unit";
|
142
|
+
} catch {
|
143
|
+
}
|
144
|
+
const j = {
|
145
|
+
degree: {
|
146
|
+
narrow: {
|
147
|
+
default: "°",
|
148
|
+
"ja-JP": " 度",
|
149
|
+
"zh-TW": "度",
|
150
|
+
"sl-SI": " °"
|
151
|
+
}
|
152
|
+
}
|
153
|
+
};
|
154
|
+
class z {
|
155
|
+
/** Formats a number value as a string, according to the locale and options provided to the constructor. */
|
156
|
+
format(e) {
|
157
|
+
let t = "";
|
158
|
+
if (!P && this.options.signDisplay != null ? t = be(this.numberFormatter, this.options.signDisplay, e) : t = this.numberFormatter.format(e), this.options.style === "unit" && !y) {
|
159
|
+
var r;
|
160
|
+
let { unit: o, unitDisplay: i = "short", locale: n } = this.resolvedOptions();
|
161
|
+
if (!o) return t;
|
162
|
+
let l = (r = j[o]) === null || r === void 0 ? void 0 : r[i];
|
163
|
+
t += l[n] || l.default;
|
164
|
+
}
|
165
|
+
return t;
|
166
|
+
}
|
167
|
+
/** Formats a number to an array of parts such as separators, digits, punctuation, and more. */
|
168
|
+
formatToParts(e) {
|
169
|
+
return this.numberFormatter.formatToParts(e);
|
170
|
+
}
|
171
|
+
/** Formats a number range as a string. */
|
172
|
+
formatRange(e, t) {
|
173
|
+
if (typeof this.numberFormatter.formatRange == "function") return this.numberFormatter.formatRange(e, t);
|
174
|
+
if (t < e) throw new RangeError("End date must be >= start date");
|
175
|
+
return `${this.format(e)} – ${this.format(t)}`;
|
176
|
+
}
|
177
|
+
/** Formats a number range as an array of parts. */
|
178
|
+
formatRangeToParts(e, t) {
|
179
|
+
if (typeof this.numberFormatter.formatRangeToParts == "function") return this.numberFormatter.formatRangeToParts(e, t);
|
180
|
+
if (t < e) throw new RangeError("End date must be >= start date");
|
181
|
+
let r = this.numberFormatter.formatToParts(e), o = this.numberFormatter.formatToParts(t);
|
182
|
+
return [
|
183
|
+
...r.map((i) => ({
|
184
|
+
...i,
|
185
|
+
source: "startRange"
|
186
|
+
})),
|
187
|
+
{
|
188
|
+
type: "literal",
|
189
|
+
value: " – ",
|
190
|
+
source: "shared"
|
191
|
+
},
|
192
|
+
...o.map((i) => ({
|
193
|
+
...i,
|
194
|
+
source: "endRange"
|
195
|
+
}))
|
196
|
+
];
|
197
|
+
}
|
198
|
+
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
199
|
+
resolvedOptions() {
|
200
|
+
let e = this.numberFormatter.resolvedOptions();
|
201
|
+
return !P && this.options.signDisplay != null && (e = {
|
202
|
+
...e,
|
203
|
+
signDisplay: this.options.signDisplay
|
204
|
+
}), !y && this.options.style === "unit" && (e = {
|
205
|
+
...e,
|
206
|
+
style: "unit",
|
207
|
+
unit: this.options.unit,
|
208
|
+
unitDisplay: this.options.unitDisplay
|
209
|
+
}), e;
|
210
|
+
}
|
211
|
+
constructor(e, t = {}) {
|
212
|
+
this.numberFormatter = ce(e, t), this.options = t;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
function ce(s, e = {}) {
|
216
|
+
let { numberingSystem: t } = e;
|
217
|
+
if (t && s.includes("-nu-") && (s.includes("-u-") || (s += "-u-"), s += `-nu-${t}`), e.style === "unit" && !y) {
|
218
|
+
var r;
|
219
|
+
let { unit: n, unitDisplay: l = "short" } = e;
|
220
|
+
if (!n) throw new Error('unit option must be provided with style: "unit"');
|
221
|
+
if (!(!((r = j[n]) === null || r === void 0) && r[l])) throw new Error(`Unsupported unit ${n} with unitDisplay = ${l}`);
|
222
|
+
e = {
|
223
|
+
...e,
|
224
|
+
style: "decimal"
|
225
|
+
};
|
226
|
+
}
|
227
|
+
let o = s + (e ? Object.entries(e).sort((n, l) => n[0] < l[0] ? -1 : 1).join() : "");
|
228
|
+
if (F.has(o)) return F.get(o);
|
229
|
+
let i = new Intl.NumberFormat(s, e);
|
230
|
+
return F.set(o, i), i;
|
231
|
+
}
|
232
|
+
function be(s, e, t) {
|
233
|
+
if (e === "auto") return s.format(t);
|
234
|
+
if (e === "never") return s.format(Math.abs(t));
|
235
|
+
{
|
236
|
+
let r = !1;
|
237
|
+
if (e === "always" ? r = t > 0 || Object.is(t, 0) : e === "exceptZero" && (Object.is(t, -0) || Object.is(t, 0) ? t = Math.abs(t) : r = t > 0), r) {
|
238
|
+
let o = s.format(-t), i = s.format(t), n = o.replace(i, "").replace(/\u200e|\u061C/, "");
|
239
|
+
return [
|
240
|
+
...n
|
241
|
+
].length !== 1 && console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"), o.replace(i, "!!!").replace(n, "+").replace("!!!", i);
|
242
|
+
} else return s.format(t);
|
243
|
+
}
|
244
|
+
}
|
245
|
+
const he = new RegExp("^.*\\(.*\\).*$"), pe = [
|
246
|
+
"latn",
|
247
|
+
"arab",
|
248
|
+
"hanidec",
|
249
|
+
"deva",
|
250
|
+
"beng"
|
251
|
+
];
|
252
|
+
class C {
|
253
|
+
/**
|
254
|
+
* Parses the given string to a number. Returns NaN if a valid number could not be parsed.
|
255
|
+
*/
|
256
|
+
parse(e) {
|
257
|
+
return $(this.locale, this.options, e).parse(e);
|
258
|
+
}
|
259
|
+
/**
|
260
|
+
* Returns whether the given string could potentially be a valid number. This should be used to
|
261
|
+
* validate user input as the user types. If a `minValue` or `maxValue` is provided, the validity
|
262
|
+
* of the minus/plus sign characters can be checked.
|
263
|
+
*/
|
264
|
+
isValidPartialNumber(e, t, r) {
|
265
|
+
return $(this.locale, this.options, e).isValidPartialNumber(e, t, r);
|
266
|
+
}
|
267
|
+
/**
|
268
|
+
* Returns a numbering system for which the given string is valid in the current locale.
|
269
|
+
* If no numbering system could be detected, the default numbering system for the current
|
270
|
+
* locale is returned.
|
271
|
+
*/
|
272
|
+
getNumberingSystem(e) {
|
273
|
+
return $(this.locale, this.options, e).options.numberingSystem;
|
274
|
+
}
|
275
|
+
constructor(e, t = {}) {
|
276
|
+
this.locale = e, this.options = t;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
const q = /* @__PURE__ */ new Map();
|
280
|
+
function $(s, e, t) {
|
281
|
+
let r = V(s, e);
|
282
|
+
if (!s.includes("-nu-") && !r.isValidPartialNumber(t)) {
|
283
|
+
for (let o of pe) if (o !== r.options.numberingSystem) {
|
284
|
+
let i = V(s + (s.includes("-u-") ? "-nu-" : "-u-nu-") + o, e);
|
285
|
+
if (i.isValidPartialNumber(t)) return i;
|
286
|
+
}
|
287
|
+
}
|
288
|
+
return r;
|
289
|
+
}
|
290
|
+
function V(s, e) {
|
291
|
+
let t = s + (e ? Object.entries(e).sort((o, i) => o[0] < i[0] ? -1 : 1).join() : ""), r = q.get(t);
|
292
|
+
return r || (r = new fe(s, e), q.set(t, r)), r;
|
293
|
+
}
|
294
|
+
class fe {
|
295
|
+
parse(e) {
|
296
|
+
let t = this.sanitize(e);
|
297
|
+
if (this.symbols.group && (t = v(t, this.symbols.group, "")), this.symbols.decimal && (t = t.replace(this.symbols.decimal, ".")), this.symbols.minusSign && (t = t.replace(this.symbols.minusSign, "-")), t = t.replace(this.symbols.numeral, this.symbols.index), this.options.style === "percent") {
|
298
|
+
let n = t.indexOf("-");
|
299
|
+
t = t.replace("-", "");
|
300
|
+
let l = t.indexOf(".");
|
301
|
+
l === -1 && (l = t.length), t = t.replace(".", ""), l - 2 === 0 ? t = `0.${t}` : l - 2 === -1 ? t = `0.0${t}` : l - 2 === -2 ? t = "0.00" : t = `${t.slice(0, l - 2)}.${t.slice(l - 2)}`, n > -1 && (t = `-${t}`);
|
302
|
+
}
|
303
|
+
let r = t ? +t : NaN;
|
304
|
+
if (isNaN(r)) return NaN;
|
305
|
+
if (this.options.style === "percent") {
|
306
|
+
var o, i;
|
307
|
+
let n = {
|
308
|
+
...this.options,
|
309
|
+
style: "decimal",
|
310
|
+
minimumFractionDigits: Math.min(((o = this.options.minimumFractionDigits) !== null && o !== void 0 ? o : 0) + 2, 20),
|
311
|
+
maximumFractionDigits: Math.min(((i = this.options.maximumFractionDigits) !== null && i !== void 0 ? i : 0) + 2, 20)
|
312
|
+
};
|
313
|
+
return new C(this.locale, n).parse(new z(this.locale, n).format(r));
|
314
|
+
}
|
315
|
+
return this.options.currencySign === "accounting" && he.test(e) && (r = -1 * r), r;
|
316
|
+
}
|
317
|
+
sanitize(e) {
|
318
|
+
return e = e.replace(this.symbols.literals, ""), this.symbols.minusSign && (e = e.replace("-", this.symbols.minusSign)), this.options.numberingSystem === "arab" && (this.symbols.decimal && (e = e.replace(",", this.symbols.decimal), e = e.replace("،", this.symbols.decimal)), this.symbols.group && (e = v(e, ".", this.symbols.group))), this.options.locale === "fr-FR" && (e = v(e, ".", " ")), e;
|
319
|
+
}
|
320
|
+
isValidPartialNumber(e, t = -1 / 0, r = 1 / 0) {
|
321
|
+
return e = this.sanitize(e), this.symbols.minusSign && e.startsWith(this.symbols.minusSign) && t < 0 ? e = e.slice(this.symbols.minusSign.length) : this.symbols.plusSign && e.startsWith(this.symbols.plusSign) && r > 0 && (e = e.slice(this.symbols.plusSign.length)), this.symbols.group && e.startsWith(this.symbols.group) || this.symbols.decimal && e.indexOf(this.symbols.decimal) > -1 && this.options.maximumFractionDigits === 0 ? !1 : (this.symbols.group && (e = v(e, this.symbols.group, "")), e = e.replace(this.symbols.numeral, ""), this.symbols.decimal && (e = e.replace(this.symbols.decimal, "")), e.length === 0);
|
322
|
+
}
|
323
|
+
constructor(e, t = {}) {
|
324
|
+
this.locale = e, this.formatter = new Intl.NumberFormat(e, t), this.options = this.formatter.resolvedOptions(), this.symbols = ve(e, this.formatter, this.options, t);
|
325
|
+
var r, o;
|
326
|
+
this.options.style === "percent" && (((r = this.options.minimumFractionDigits) !== null && r !== void 0 ? r : 0) > 18 || ((o = this.options.maximumFractionDigits) !== null && o !== void 0 ? o : 0) > 18) && console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.");
|
327
|
+
}
|
328
|
+
}
|
329
|
+
const I = /* @__PURE__ */ new Set([
|
330
|
+
"decimal",
|
331
|
+
"fraction",
|
332
|
+
"integer",
|
333
|
+
"minusSign",
|
334
|
+
"plusSign",
|
335
|
+
"group"
|
336
|
+
]), me = [
|
337
|
+
0,
|
338
|
+
4,
|
339
|
+
2,
|
340
|
+
1,
|
341
|
+
11,
|
342
|
+
20,
|
343
|
+
3,
|
344
|
+
7,
|
345
|
+
100,
|
346
|
+
21,
|
347
|
+
0.1,
|
348
|
+
1.1
|
349
|
+
];
|
350
|
+
function ve(s, e, t, r) {
|
351
|
+
var o, i, n, l;
|
352
|
+
let a = new Intl.NumberFormat(s, {
|
353
|
+
...t,
|
354
|
+
// Resets so we get the full range of symbols
|
355
|
+
minimumSignificantDigits: 1,
|
356
|
+
maximumSignificantDigits: 21,
|
357
|
+
roundingIncrement: 1,
|
358
|
+
roundingPriority: "auto",
|
359
|
+
roundingMode: "halfExpand"
|
360
|
+
}), u = a.formatToParts(-10000.111), m = a.formatToParts(10000.111), B = me.map((d) => a.formatToParts(d));
|
361
|
+
var k;
|
362
|
+
let U = (k = (o = u.find((d) => d.type === "minusSign")) === null || o === void 0 ? void 0 : o.value) !== null && k !== void 0 ? k : "-", x = (i = m.find((d) => d.type === "plusSign")) === null || i === void 0 ? void 0 : i.value;
|
363
|
+
!x && ((r == null ? void 0 : r.signDisplay) === "exceptZero" || (r == null ? void 0 : r.signDisplay) === "always") && (x = "+");
|
364
|
+
let H = (n = new Intl.NumberFormat(s, {
|
365
|
+
...t,
|
366
|
+
minimumFractionDigits: 2,
|
367
|
+
maximumFractionDigits: 2
|
368
|
+
}).formatToParts(1e-3).find((d) => d.type === "decimal")) === null || n === void 0 ? void 0 : n.value, G = (l = u.find((d) => d.type === "group")) === null || l === void 0 ? void 0 : l.value, K = u.filter((d) => !I.has(d.type)).map((d) => R(d.value)), W = B.flatMap((d) => d.filter((p) => !I.has(p.type)).map((p) => R(p.value))), N = [
|
369
|
+
.../* @__PURE__ */ new Set([
|
370
|
+
...K,
|
371
|
+
...W
|
372
|
+
])
|
373
|
+
].sort((d, p) => p.length - d.length), Y = N.length === 0 ? new RegExp("[\\p{White_Space}]", "gu") : new RegExp(`${N.join("|")}|[\\p{White_Space}]`, "gu"), _ = [
|
374
|
+
...new Intl.NumberFormat(t.locale, {
|
375
|
+
useGrouping: !1
|
376
|
+
}).format(9876543210)
|
377
|
+
].reverse(), X = new Map(_.map((d, p) => [
|
378
|
+
d,
|
379
|
+
p
|
380
|
+
])), Z = new RegExp(`[${_.join("")}]`, "g");
|
381
|
+
return {
|
382
|
+
minusSign: U,
|
383
|
+
plusSign: x,
|
384
|
+
decimal: H,
|
385
|
+
group: G,
|
386
|
+
literals: Y,
|
387
|
+
numeral: Z,
|
388
|
+
index: (d) => String(X.get(d))
|
389
|
+
};
|
390
|
+
}
|
391
|
+
function v(s, e, t) {
|
392
|
+
return s.replaceAll ? s.replaceAll(e, t) : s.split(e).join(t);
|
393
|
+
}
|
394
|
+
function R(s) {
|
395
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
396
|
+
}
|
397
|
+
const ge = "@media (forced-colors: active){:host(:is(:active,[active])):not(:disabled),:host(:focus-visible):not(:disabled){--highcontrast-infield-button-border-color: Highlight}}@media (forced-colors: active) and (hover: hover){:host(:hover):not(:disabled){--highcontrast-infield-button-border-color: Highlight}}:host{background-color:initial;cursor:pointer;block-size:var(--luzmo-infield-button-height, var(--infield-button-height));inline-size:var(--luzmo-infield-button-width, var(--infield-button-width));padding:var(--luzmo-infield-button-edge-to-fill, var(--infield-button-edge-to-fill));color:var(--infield-button-content-color, inherit);border-style:none;justify-content:center;align-items:center;display:flex}.fill{block-size:100%;inline-size:100%;background-color:var(--luzmo-infield-button-background-color, var(--infield-button-background-color));border-width:var(--luzmo-infield-button-border-width, var(--infield-button-border-width));border-style:solid;border-color:var(--highcontrast-infield-button-border-color, var(--luzmo-infield-button-border-color, var(--infield-button-border-color)));padding:var(--luzmo-infield-button-fill-padding, var(--infield-button-fill-padding));border-start-start-radius:var(--luzmo-infield-button-border-radius, var(--infield-button-border-radius));border-start-end-radius:var(--luzmo-infield-button-border-radius, var(--infield-button-border-radius));border-end-end-radius:var(--luzmo-infield-button-border-radius, var(--infield-button-border-radius));border-end-start-radius:var(--luzmo-infield-button-border-radius, var(--infield-button-border-radius))}::slotted(*){color:var(--luzmo-infield-button-icon-color, var(--infield-button-icon-color))}:host([inline=end]) .fill{border-start-start-radius:var(--luzmo-infield-button-border-radius-reset, var(--infield-button-border-radius-reset));border-end-start-radius:var(--luzmo-infield-button-border-radius-reset, var(--infield-button-border-radius-reset))}:host([inline=start]) .fill{border-start-end-radius:var(--luzmo-infield-button-border-radius-reset, var(--infield-button-border-radius-reset));border-end-end-radius:var(--luzmo-infield-button-border-radius-reset, var(--infield-button-border-radius-reset))}:host([block=end]),:host([block=start]){--infield-button-width: var(--luzmo-infield-button-width-stacked, 28px)}:host([block=end][size=s]),:host([block=start][size=s]){--infield-button-width: var(--luzmo-infield-button-width-stacked, 20px)}:host([block=end][size=l]),:host([block=start][size=l]){--infield-button-width: var(--luzmo-infield-button-width-stacked, 36px)}:host([block=end][size=xl]),:host([block=start][size=xl]){--infield-button-width: var(--luzmo-infield-button-width-stacked, 44px)}:host([quiet]){--infield-button-background-color: var( --luzmo-infield-button-background-color-quiet, transparent );--infield-button-background-color-hover: var( --luzmo-infield-button-background-color-hover-quiet, transparent );--infield-button-background-color-down: var( --luzmo-infield-button-background-color-down-quiet, transparent );--infield-button-background-color-key-focus: var( --luzmo-infield-button-background-color-key-focus-quiet, transparent );--infield-border-color: var(--luzmo-infield-border-color-quiet, transparent);--infield-button-border-width: var( --luzmo-infield-button-border-width-quiet, 0 )}:host([quiet][disabled]){--infield-button-background-color: var( --luzmo-infield-button-background-color-quiet-disabled, transparent );--infield-button-border-color: var( --luzmo-infield-button-border-color-quiet-disabled, transparent )}:host([disabled]){--infield-button-background-color: var( --luzmo-infield-button-background-color-disabled, var(--luzmo-background-color-disabled) );--infield-button-background-color-hover: var( --luzmo-infield-button-background-color-hover-disabled, var(--luzmo-background-color-disabled) );--infield-button-background-color-down: var( --luzmo-infield-button-background-color-down-disabled, var(--luzmo-background-color-disabled) );--infield-button-border-color: var( --luzmo-infield-button-border-color-disabled, var(--luzmo-background-color-disabled) );--infield-button-content-color: var( --luzmo-infield-button-content-color-disabled, var(--luzmo-color-disabled) );--infield-button-icon-color: var( --luzmo-infield-button-icon-color-disabled, var(--luzmo-color-disabled) );--infield-button-icon-color-hover: var( --luzmo-infield-button-icon-color-hover-disabled, var(--luzmo-color-disabled) );--infield-button-icon-color-down: var( --luzmo-infield-button-icon-color-down-disabled, var(--luzmo-color-disabled) );--infield-button-icon-color-key-focus: var( --luzmo-infield-button-icon-color-key-focus-disabled, var(--luzmo-color-disabled) );cursor:auto}@media (hover: hover){:host(:hover) .fill{background-color:var(--luzmo-infield-button-background-color-hover, var(--infield-button-background-color-hover))}:host(:hover) ::slotted(*){color:var(--luzmo-infield-button-icon-color-hover, var(--infield-button-icon-color-hover))}}:host(:is(:active,[active])) .fill{background-color:var(--luzmo-infield-button-background-color-down, var(--infield-button-background-color-down))}:host(:is(:active,[active])) ::slotted(*){color:var(--luzmo-infield-button-icon-color-down, var(--infield-button-icon-color-down))}:host(:focus-visible){outline:none}:host(:focus-visible) .fill{background-color:var(--luzmo-infield-button-background-color-key-focus, var(--infield-button-background-color-key-focus))}:host(:focus-visible) ::slotted(*){color:var(--luzmo-infield-button-icon-color-key-focus, var(--infield-button-icon-color-key-focus))}.fill{align-items:center;justify-content:var(--luzmo-infield-button-fill-justify-content, var(--infield-button-fill-justify-content));display:flex}:host([block=end]),:host([block=start]){block-size:calc(var(--luzmo-infield-button-height, var(--infield-button-height)) / 2)}:host([block=end]) .fill,:host([block=start]) .fill{box-sizing:border-box;padding-inline-start:calc(var(--luzmo-infield-button-stacked-fill-padding-inline, var(--infield-button-stacked-fill-padding-inline)) - var(--luzmo-infield-button-edge-to-fill, var(--infield-button-edge-to-fill)) - var(--luzmo-infield-button-border-width, var(--infield-button-border-width)));padding-inline-end:calc(var(--luzmo-infield-button-stacked-fill-padding-inline, var(--infield-button-stacked-fill-padding-inline)) - var(--luzmo-infield-button-edge-to-fill, var(--infield-button-edge-to-fill)) - var(--luzmo-infield-button-border-width, var(--infield-button-border-width)))}:host([block=start]){padding-block-end:var(--luzmo-infield-button-inner-edge-to-fill, var(--infield-button-inner-edge-to-fill))}:host([block=start]) .fill{border-block-end:none;border-start-start-radius:var(--luzmo-infield-button-stacked-top-border-radius-start-start, var(--infield-button-stacked-top-border-radius-start-start));border-end-end-radius:var(--luzmo-infield-button-stacked-border-radius-reset, var(--infield-button-stacked-border-radius-reset));border-end-start-radius:var(--luzmo-infield-button-stacked-border-radius-reset, var(--infield-button-stacked-border-radius-reset));padding-block-start:calc(var(--luzmo-infield-button-stacked-fill-padding-outer, var(--infield-button-stacked-fill-padding-outer)) - var(--luzmo-infield-button-edge-to-fill, var(--infield-button-edge-to-fill)) - var(--luzmo-infield-button-border-width, var(--infield-button-border-width)));padding-block-end:calc(var(--luzmo-infield-button-stacked-fill-padding-inner, var(--infield-button-stacked-fill-padding-inner)) - var(--luzmo-infield-button-inner-edge-to-fill, var(--infield-button-inner-edge-to-fill)))}:host([block=end]){padding-block-start:var(--luzmo-infield-button-inner-edge-to-fill, var(--infield-button-inner-edge-to-fill))}:host([block=end]) .fill{border-block-end-width:var(--luzmo-infield-button-stacked-bottom-border-block-end-width, var(--luzmo-infield-button-border-width, var(--infield-button-border-width)));border-start-start-radius:var(--luzmo-infield-button-stacked-border-radius-reset, var(--infield-button-stacked-border-radius-reset));border-start-end-radius:var(--luzmo-infield-button-stacked-border-radius-reset, var(--infield-button-stacked-border-radius-reset));border-end-end-radius:var(--luzmo-infield-button-stacked-bottom-border-radius-end-end, var(--luzmo-infield-button-border-radius, var(--infield-button-border-radius)));border-end-start-radius:var(--luzmo-infield-button-stacked-bottom-border-radius-end-start, var(--infield-button-stacked-bottom-border-radius-end-start));padding-block-start:calc(var(--luzmo-infield-button-stacked-fill-padding-inner, var(--infield-button-stacked-fill-padding-inner)) - var(--luzmo-infield-button-edge-to-fill, var(--infield-button-edge-to-fill)) - var(--luzmo-infield-button-border-width, var(--infield-button-border-width)));padding-block-end:calc(var(--luzmo-infield-button-stacked-fill-padding-outer, var(--infield-button-stacked-fill-padding-outer)) - var(--luzmo-infield-button-inner-edge-to-fill, var(--infield-button-inner-edge-to-fill)) - var(--luzmo-infield-button-border-width, var(--infield-button-border-width)))}::slotted(*){display:initial;flex-shrink:0;margin:0!important}:host{--infield-button-border-width: var(--luzmo-border-width);--infield-button-border-color: inherit;--infield-button-border-radius: var(--luzmo-border-radius-s);--infield-button-border-radius-reset: 0;--infield-button-stacked-top-border-radius-start-start: 0;--infield-button-stacked-bottom-border-radius-end-start: 0;--infield-button-background-color: var(--luzmo-background-color);--infield-button-background-color-hover: var(--luzmo-background-color-hover);--infield-button-background-color-down: var(--luzmo-background-color-down);--infield-button-background-color-key-focus: var( --luzmo-background-color-focus );--infield-button-height: var(--luzmo-component-height);--infield-button-width: var(--luzmo-component-height);--infield-button-stacked-border-radius-reset: 0px;--infield-button-edge-to-fill: 0px;--infield-button-inner-edge-to-fill: 0px;--infield-button-fill-padding: 0px;--infield-button-stacked-fill-padding-inline: 9px;--infield-button-stacked-fill-padding-outer: 3px;--infield-button-stacked-fill-padding-inner: 3px;--infield-button-animation-duration: var(--luzmo-animation-duration);--infield-button-icon-color: var(--luzmo-font-color);--infield-button-icon-color-hover: var(--luzmo-font-color-hard);--infield-button-icon-color-down: var(--luzmo-font-color-hard);--infield-button-icon-color-key-focus: var(--luzmo-font-color-hard);--infield-button-fill-justify-content: center}:host([disabled]){--infield-button-background-color: var(--luzmo-background-color-disabled);--infield-button-background-color-hover: var( --luzmo-background-color-disabled );--infield-button-background-color-down: var( --luzmo-background-color-disabled );--infield-button-border-color: var(--luzmo-border-color-disabled);--infield-button-content-color: var(--luzmo-color-disabled);--infield-button-icon-color: var(--luzmo-color-disabled);--infield-button-icon-color-hover: var(--luzmo-color-disabled);--infield-button-icon-color-down: var(--luzmo-color-disabled);--infield-button-icon-color-key-focus: var(--luzmo-color-disabled)}:host([size=s]){--infield-button-height: var(--luzmo-component-height-s);--infield-button-width: var(--luzmo-component-height-s);--infield-button-stacked-fill-padding-inline: 7px;--infield-button-stacked-fill-padding-outer: 3px;--infield-button-stacked-fill-padding-inner: 3px}:host([size=l]){--infield-button-height: var(--luzmo-component-height-l);--infield-button-width: var(--luzmo-component-height-l);--infield-button-stacked-fill-padding-inline: 13px;--infield-button-stacked-fill-padding-outer: 4px;--infield-button-stacked-fill-padding-inner: 4px}:host([size=xl]){--infield-button-height: var(--luzmo-component-height-xl);--infield-button-width: var(--luzmo-component-height-xl);--infield-button-stacked-fill-padding-inline: 16px;--infield-button-stacked-fill-padding-outer: 5px;--infield-button-stacked-fill-padding-inner: 5px}:host([block=start]){--infield-button-width: 20px}:host([block=end]){--infield-button-width: 20px}:host([block=start][size=s]){--infield-button-width: 16px}:host([block=end][size=s]){--infield-button-width: 16px}:host([block=start][size=l]){--infield-button-width: 28px}:host([block=end][size=l]){--infield-button-width: 28px}:host([block=start][size=xl]){--infield-button-width: 36px}:host([block=end][size=xl]){--infield-button-width: 36px}:host([quiet]){--infield-button-background-color: transparent;--infield-button-background-color-hover: transparent;--infield-button-background-color-down: transparent;--infield-button-background-color-key-focus: transparent;--infield-border-color: transparent;--infield-button-border-width: 0}:host([quiet][disabled]){--infield-button-background-color: transparent;--infield-button-border-color: transparent}:host{box-sizing:border-box;-webkit-user-select:none;user-select:none}::slotted(*){--parent-element-icon-vertical-align: 1px;--icon-size: inherit}";
|
398
|
+
var ze = Object.defineProperty, E = (s, e, t, r) => {
|
399
|
+
for (var o = void 0, i = s.length - 1, n; i >= 0; i--)
|
400
|
+
(n = s[i]) && (o = n(e, t, o) || o);
|
401
|
+
return o && ze(e, t, o), o;
|
402
|
+
};
|
403
|
+
class w extends oe(ne, {
|
404
|
+
noDefaultSize: !0,
|
405
|
+
validSizes: ["s", "m", "l", "xl"]
|
406
|
+
}) {
|
407
|
+
constructor() {
|
408
|
+
super(...arguments), this.quiet = !1;
|
409
|
+
}
|
410
|
+
static get styles() {
|
411
|
+
return [...super.styles, A(ge)];
|
412
|
+
}
|
413
|
+
get buttonContent() {
|
414
|
+
return [S`
|
415
|
+
<div class="fill">
|
416
|
+
<slot></slot>
|
417
|
+
</div>
|
418
|
+
`];
|
419
|
+
}
|
420
|
+
}
|
421
|
+
E([
|
422
|
+
c()
|
423
|
+
], w.prototype, "block");
|
424
|
+
E([
|
425
|
+
c()
|
426
|
+
], w.prototype, "inline");
|
427
|
+
E([
|
428
|
+
c({ type: Boolean, reflect: !0 })
|
429
|
+
], w.prototype, "quiet");
|
430
|
+
customElements.get("luzmo-infield-button") || customElements.define("luzmo-infield-button", w);
|
431
|
+
const ye = '#text-field{--stepper-width: calc( var(--luzmo-stepper-height, var(--stepper-height)) * var( --luzmo-stepper-min-width-multiplier, var(--stepper-min-width-multiplier) ) + var(--luzmo-stepper-button-width, var(--stepper-button-width)) + var(--luzmo-stepper-border-width, var(--stepper-border-width)) * 2 );--luzmo-infield-button-border-color: var( --highcontrast-stepper-border-color, var( --luzmo-stepper-buttons-border-color, var(--stepper-buttons-border-color) ) );--luzmo-infield-button-border-width: var( --luzmo-stepper-button-border-width, var(--stepper-button-border-width) );--luzmo-infield-button-border-radius-reset: var( --stepper-button-border-radius-reset );--luzmo-text-field-border-width: var( --luzmo-stepper-border-width, var(--stepper-border-width) );inline-size:var(--luzmo-stepper-width, var(--stepper-width));block-size:var(--luzmo-stepper-height, var(--stepper-height));border-radius:var(--luzmo-stepper-border-radius, var(--stepper-border-radius));border-color:var(--highcontrast-stepper-border-color, var(--luzmo-stepper-border-color, var(--stepper-border-color)));flex-flow:row;display:inline-flex;position:relative}#text-field:after{content:"";inline-size:100%;block-size:var(--luzmo-stepper-focus-indicator-width, var(--stepper-focus-indicator-width));position:absolute;inset-block-end:calc((var(--luzmo-stepper-focus-indicator-gap, var(--stepper-focus-indicator-gap)) + var(--luzmo-stepper-focus-indicator-width, var(--stepper-focus-indicator-width))) * -1);inset-inline-start:0}:host([focused]) #text-field,#text-field:focus{--luzmo-stepper-border-color: var( --highcontrast-stepper-border-color-focus, var(--luzmo-stepper-border-color-focus, var(--stepper-border-color-focus)) );--luzmo-infield-button-border-color: var( --highcontrast-stepper-border-color-focus, var( --luzmo-stepper-buttons-border-color-focus, var(--stepper-buttons-border-color-focus) ) )}:host([focused]:not([disabled])) #text-field .input,:host(:not([disabled])) #text-field:focus .input{outline:none}:host([focused]:not([disabled])) #text-field .buttons,:host([focused]:not([disabled])) #text-field .input,:host(:not([disabled])) #text-field:focus .buttons,:host(:not([disabled])) #text-field:focus .input{border-color:var(--highcontrast-stepper-border-color-focus, var(--luzmo-stepper-border-color-focus, var(--stepper-border-color-focus)))}:host([keyboard-focused]) #text-field,#text-field:focus-visible{--luzmo-stepper-border-color: var( --highcontrast-stepper-border-color-keyboard-focus, var( --luzmo-stepper-buttons-border-color-keyboard-focus, var(--stepper-buttons-border-color-keyboard-focus) ) );--luzmo-infield-button-border-color: var( --highcontrast-stepper-border-color-keyboard-focus, var( --luzmo-stepper-buttons-border-color-keyboard-focus, var(--stepper-buttons-border-color-keyboard-focus) ) )}:host([keyboard-focused]:not([disabled])) #text-field,:host(:not([disabled])) #text-field:focus-visible{outline:var(--luzmo-stepper-focus-indicator-width, var(--stepper-focus-indicator-width)) solid;outline-color:var(--highcontrast-stepper-focus-indicator-color, var(--luzmo-stepper-focus-indicator-color, var(--stepper-focus-indicator-color)));outline-offset:var(--luzmo-stepper-focus-indicator-gap, var(--stepper-focus-indicator-gap))}:host([keyboard-focused]:not([disabled])) #text-field .input,:host(:not([disabled])) #text-field:focus-visible .input{outline:none}:host([keyboard-focused]:not([disabled])) #text-field .buttons,:host([keyboard-focused]:not([disabled])) #text-field .input,:host(:not([disabled])) #text-field:focus-visible .buttons,:host(:not([disabled])) #text-field:focus-visible .input{border-color:var(--highcontrast-stepper-border-color-keyboard-focus, var(--luzmo-stepper-border-color-keyboard-focus, var(--stepper-border-color-keyboard-focus)))}:host([invalid]:not([disabled])) #text-field{--luzmo-stepper-border-color: var( --luzmo-stepper-border-color-invalid, var(--stepper-border-color-invalid) );--luzmo-stepper-border-color-hover: var( --luzmo-stepper-border-color-hover-invalid, var(--stepper-border-color-hover-invalid) );--luzmo-stepper-border-color-focus: var( --luzmo-stepper-border-color-focus-invalid, var(--stepper-border-color-focus-invalid) );--luzmo-stepper-border-color-focus-hover: var( --luzmo-stepper-border-color-focus-hover-invalid, var(--stepper-border-color-focus-hover-invalid) );--luzmo-stepper-border-color-keyboard-focus: var( --luzmo-stepper-border-color-keyboard-focus-invalid, var(--stepper-border-color-keyboard-focus-invalid) );--luzmo-infield-button-border-color: var( --luzmo-stepper-border-color-invalid, var(--stepper-border-color-invalid) );--luzmo-text-field-icon-spacing-inline-start-invalid: 0}:host([invalid][focused]:not([disabled])) #text-field,:host([invalid]:not([disabled])) #text-field:focus{--luzmo-infield-button-border-color: var( --luzmo-stepper-border-color-focus-invalid, var(--stepper-border-color-focus-invalid) )}:host([invalid][keyboard-focused]:not([disabled])) #text-field,:host([invalid]:not([disabled])) #text-field:focus-visible{--luzmo-infield-button-border-color: var( --luzmo-stepper-border-color-keyboard-focus-invalid, var(--stepper-border-color-keyboard-focus-invalid) )}:host([disabled]) #text-field{--luzmo-stepper-border-color: var(--stepper-button-border-color-disabled);--luzmo-stepper-border-color-hover: var( --stepper-button-border-color-disabled );--luzmo-stepper-border-color-focus: var( --stepper-button-border-color-disabled );--luzmo-stepper-border-color-focus-hover: var( --stepper-button-border-color-disabled );--luzmo-stepper-border-color-keyboard-focus: var( --stepper-button-border-color-disabled );--luzmo-stepper-buttons-background-color: var( --stepper-buttons-background-color-disabled );--luzmo-infield-button-border-width: var( --stepper-button-border-width-disabled );--luzmo-infield-button-border-color: var( --stepper-button-border-color-disabled );--luzmo-text-field-border-color-disabled: var( --stepper-button-border-color-disabled )}#text-field .input{border-color:var(--highcontrast-stepper-border-color, var(--luzmo-stepper-border-color, var(--stepper-border-color)));border-inline-end-width:0;border-start-end-radius:0;border-end-end-radius:0}#text-field.hide-stepper .input{border-inline-end-width:var(--luzmo-stepper-border-width, var(--stepper-border-width));border-start-end-radius:var(--luzmo-stepper-border-radius, var(--stepper-border-radius));border-end-end-radius:var(--luzmo-stepper-border-radius, var(--stepper-border-radius))}#text-field .buttons{box-sizing:border-box;block-size:var(--luzmo-stepper-height, var(--stepper-height));inline-size:var(--luzmo-stepper-button-width, var(--stepper-button-width));border-color:var(--highcontrast-stepper-border-color, var(--luzmo-stepper-border-color, var(--stepper-border-color)));border-style:var(--luzmo-stepper-buttons-border-style, var(--stepper-buttons-border-style));border-width:var(--highcontrast-stepper-buttons-border-width, var(--luzmo-stepper-buttons-border-width, var(--stepper-buttons-border-width)));background-color:var(--highcontrast-stepper-buttons-background-color, var(--luzmo-stepper-buttons-background-color, var(--stepper-buttons-background-color)));transition:border-color var(--luzmo-stepper-animation-duration, var(--stepper-animation-duration)) ease-in-out;border-inline-start-width:0;border-start-end-radius:var(--luzmo-stepper-border-radius, var(--stepper-border-radius));border-end-end-radius:var(--luzmo-stepper-border-radius, var(--stepper-border-radius));flex-direction:column;justify-content:center;display:flex}:host([quiet]) #text-field{border-start-start-radius:0;border-start-end-radius:0;border-end-end-radius:0;border-end-start-radius:0}:host([quiet]) #text-field .input{--luzmo-text-field-focus-indicator-color: transparent}:host([quiet]) #text-field.hide-stepper .input{border-inline-end-width:0;border-end-end-radius:0}:host([quiet]) #text-field .buttons{--luzmo-infield-button-border-color: transparent;border-width:0;border-block-end-width:var(--luzmo-stepper-border-width, var(--stepper-border-width));border-block-end-color:var(--highcontrast-stepper-border-color, var(--luzmo-stepper-border-color, var(--stepper-border-color)));border-block-end-style:solid;border-end-end-radius:0}:host([quiet]) #text-field .button{--luzmo-infield-button-width-stacked: var( --luzmo-stepper-button-width-quiet, var(--stepper-button-width) );--luzmo-infield-button-border-color: var( --luzmo-stepper-border-color-quiet, var(--stepper-button-border-color-quiet) );--luzmo-infield-button-stacked-bottom-border-block-end-width: var( --luzmo-stepper-border-width, var(--stepper-border-width) );--luzmo-infield-button-stacked-bottom-border-radius-end-end: 0;--luzmo-infield-button-stacked-bottom-border-radius-end-start: 0;--luzmo-infield-button-fill-justify-content: flex-end;padding:0}:host([quiet]) #text-field .buttons,:host([quiet]) #text-field .input{background-color:initial}:host([quiet][focused]) #text-field,:host([quiet]) #text-field:focus{--luzmo-infield-button-border-color: var( --highcontrast-stepper-border-color-focus, var(--luzmo-stepper-border-color-focus, var(--stepper-border-color-focus)) )}:host([quiet][keyboard-focused]:not([disabled])) #text-field{--luzmo-infield-button-border-color: var( --highcontrast-stepper-border-color-keyboard-focus, var( --luzmo-stepper-border-color-keyboard-focus, var(--stepper-border-color-keyboard-focus) ) );outline:none}:host([quiet][keyboard-focused]:not([disabled])) #text-field:after{background-color:var(--highcontrast-stepper-focus-indicator-color, var(--luzmo-stepper-focus-indicator-color, var(--stepper-focus-indicator-color)))}@media (hover: hover){:host(:hover:not([disabled])) #text-field{--luzmo-stepper-border-color: var( --highcontrast-stepper-border-color-hover, var(--luzmo-stepper-border-color-hover, var(--stepper-border-color-hover)) );--luzmo-infield-button-border-color: var( --highcontrast-stepper-border-color-hover, var( --luzmo-stepper-buttons-border-color-hover, var(--stepper-buttons-border-color-hover) ) )}:host([focused]:hover) #text-field,:host(:hover) #text-field:focus{--luzmo-stepper-border-color: var( --highcontrast-stepper-border-color-focus-hover, var( --luzmo-stepper-buttons-border-color-focus-hover, var(--stepper-buttons-border-color-focus-hover) ) );--luzmo-infield-button-border-color: var( --highcontrast-stepper-border-color-focus-hover, var( --luzmo-stepper-buttons-border-color-focus-hover, var(--stepper-buttons-border-color-focus-hover) ) )}:host([focused]:hover) #text-field .buttons,:host([focused]:hover) #text-field .input,:host(:hover) #text-field:focus .buttons,:host(:hover) #text-field:focus .input{border-color:var(--highcontrast-stepper-border-color-focus-hover, var(--luzmo-stepper-border-color-focus-hover, var(--stepper-border-color-focus-hover)))}:host([invalid]:not([disabled]):hover) #text-field{--luzmo-infield-button-border-color: var( --luzmo-stepper-border-color-hover-invalid, var(--stepper-border-color-hover-invalid) )}:host([invalid][focused]:not([disabled]):hover) #text-field,:host([invalid]:not([disabled]):hover) #text-field:focus{--luzmo-infield-button-border-color: var( --luzmo-stepper-border-color-focus-hover-invalid, var(--stepper-border-color-focus-hover-invalid) )}:host([quiet]:not([disabled]):hover) #text-field{--luzmo-infield-button-border-color: var( --highcontrast-stepper-border-color-hover, var(--luzmo-stepper-border-color-hover, var(--stepper-border-color-hover)) )}:host([quiet]:not([disabled]):hover) #text-field .buttons{background-color:initial}:host([quiet][focused]:hover) #text-field,:host([quiet]:hover) #text-field:focus{--luzmo-infield-button-border-color: var( --highcontrast-stepper-border-color-focus-hover, var( --luzmo-stepper-border-color-focus-hover, var(--stepper-border-color-focus-hover) ) )}:host([quiet][keyboard-focused]:not([disabled]):hover) #text-field{--luzmo-infield-button-border-color: var( --highcontrast-stepper-border-color-hover, var(--luzmo-stepper-border-color-hover, var(--stepper-border-color-hover)) )}}@media (forced-colors: active){:host{--highcontrast-stepper-border-color: CanvasText;--highcontrast-stepper-border-color-hover: Highlight;--highcontrast-stepper-border-color-focus: Highlight;--highcontrast-stepper-border-color-focus-hover: Highlight;--highcontrast-stepper-border-color-keyboard-focus: CanvasText;--highcontrast-stepper-button-background-color-default: Canvas;--highcontrast-stepper-button-background-color-hover: Canvas;--highcontrast-stepper-button-background-color-focus: Canvas;--highcontrast-stepper-button-background-color-keyboard-focus: Canvas;--highcontrast-stepper-focus-indicator-color: Highlight}:host([invalid]) #text-field{--highcontrast-stepper-border-color: Highlight;--highcontrast-stepper-border-color-hover: Highlight;--highcontrast-stepper-border-color-focus: Highlight;--highcontrast-stepper-border-color-focus-hover: Highlight;--highcontrast-stepper-border-color-keyboard-focus: Highlight;--highcontrast-infield-button-border-color: Highlight}:host([disabled]) #text-field{--highcontrast-stepper-border-color: GrayText;--highcontrast-infield-button-border-color: GrayText;--highcontrast-stepper-buttons-border-width: var( --luzmo-stepper-border-width, var(--stepper-border-width) )}}:host{--text-field-minimum-width-multiplier: 1.75;--stepper-border-width: var(--luzmo-border-width);--stepper-border-color: var(--luzmo-border-color);--stepper-border-color-hover: var(--luzmo-border-color-full-hover);--stepper-border-color-focus: var(--luzmo-border-color-full-focus);--stepper-border-color-focus-hover: var(--luzmo-border-color-full-focus);--stepper-border-color-keyboard-focus: var(--luzmo-border-color-full-focus);--stepper-border-radius: var(--luzmo-border-radius-s);--stepper-min-width-multiplier: 1.5;--stepper-animation-duration: var(--luzmo-animation-duration);--stepper-buttons-background-color: var(--luzmo-background-color);--stepper-buttons-border-style: none;--stepper-buttons-border-width: 0;--stepper-buttons-border-color: var(--luzmo-border-color);--stepper-buttons-border-color-hover: var(--luzmo-border-color-full-hover);--stepper-buttons-border-color-focus: var(--luzmo-border-color-full-focus);--stepper-buttons-border-color-keyboard-focus: var( --luzmo-border-color-focus );--stepper-button-padding: 0px;--stepper-button-border-radius-reset: 0;--stepper-button-border-width: var(--luzmo-border-width);--stepper-button-background-color-focus: var(--luzmo-background-color-focus);--stepper-button-background-color-keyboard-focus: var( --luzmo-background-color-focus );--stepper-border-color-invalid: var(--luzmo-color-negative);--stepper-border-color-hover-invalid: var(--luzmo-color-negative-hover);--stepper-border-color-focus-invalid: var(--luzmo-color-negative-focus);--stepper-border-color-focus-hover-invalid: var(--luzmo-color-negative-focus);--stepper-border-color-keyboard-focus-invalid: var( --luzmo-color-negative-focus );--stepper-focus-indicator-width: var(--luzmo-indicator-width);--stepper-focus-indicator-gap: calc(-1 * var(--luzmo-border-width));--stepper-focus-indicator-color: var(--luzmo-indicator-color);--stepper-button-border-color-quiet: transparent;--stepper-button-border-color-disabled: var(--luzmo-border-color-disabled);--stepper-button-border-width-disabled: var(--luzmo-border-width);--stepper-buttons-background-color-disabled: var( --luzmo-background-color-disabled );--stepper-button-width: 28px;--stepper-height: var(--luzmo-component-height)}:host([size=s]) #text-field{--stepper-button-width: 16px;--stepper-height: var(--luzmo-component-height-s)}:host([size=m]) #text-field{--stepper-button-width: 20px;--stepper-height: var(--luzmo-component-height)}:host([size=l]) #text-field{--stepper-button-width: 28px;--stepper-height: var(--luzmo-component-height-l)}:host([size=xl]) #text-field{--stepper-button-width: 36px;--stepper-height: var(--luzmo-component-height-xl)}:host{inline-size:var(--luzmo-stepper-width, var(--stepper-width));--swc-number-field-width: calc( var(--luzmo-stepper-height, var(--stepper-height)) * var( --luzmo-stepper-min-width-multiplier, var(--text-field-minimum-width-multiplier) ) + var(--luzmo-stepper-button-width, var(--stepper-button-width)) + var(--luzmo-stepper-border-width, var(--stepper-border-width)) * 2 );--luzmo-infield-button-border-width: var(--unset-value-resets-inheritance);--stepper-width: var(--swc-number-field-width)}:host([size=s]){--stepper-width: calc(var(--swc-number-field-width) / 5 * 4)}:host([size=l]){--stepper-width: calc(var(--swc-number-field-width) * 1.25)}:host([size=xl]){--stepper-width: calc(var(--swc-number-field-width) * 1.25 * 1.25)}#text-field{inline-size:100%}.input{font-variant-numeric:tabular-nums}:host([readonly]) .buttons{pointer-events:none;visibility:hidden}:host([readonly]:not([disabled],[invalid],[focused],[keyboard-focused])) #text-field:hover .input{border-color:transparent}:host([hide-stepper]:not([quiet])) #text-field input{border:var(--luzmo-text-field-border-width, var(--text-field-border-width)) solid var(--luzmo-text-field-border-color, var(--text-field-border-color));border-radius:var(--text-field-corner-radius)}:host([quiet]) #text-field .button{--luzmo-infield-button-border-color: var( --luzmo-infield-border-color-quiet, transparent );--luzmo-infield-button-edge-to-fill: 0;--luzmo-infield-button-border-width: var( --luzmo-infield-button-border-width-quiet, 0 )}';
|
432
|
+
var we = Object.defineProperty, ke = Object.getOwnPropertyDescriptor, h = (s, e, t, r) => {
|
433
|
+
for (var o = r > 1 ? void 0 : r ? ke(e, t) : e, i = s.length - 1, n; i >= 0; i--)
|
434
|
+
(n = s[i]) && (o = (r ? n(e, t, o) : n(o)) || o);
|
435
|
+
return r && o && we(e, t, o), o;
|
436
|
+
};
|
437
|
+
const xe = 5, Fe = 100, g = "-", O = {
|
438
|
+
"1": "1",
|
439
|
+
"2": "2",
|
440
|
+
"3": "3",
|
441
|
+
"4": "4",
|
442
|
+
"5": "5",
|
443
|
+
"6": "6",
|
444
|
+
"7": "7",
|
445
|
+
"8": "8",
|
446
|
+
"9": "9",
|
447
|
+
"0": "0",
|
448
|
+
"、": ",",
|
449
|
+
",": ",",
|
450
|
+
"。": ".",
|
451
|
+
".": ".",
|
452
|
+
"%": "%",
|
453
|
+
"+": "+",
|
454
|
+
ー: "-",
|
455
|
+
一: "1",
|
456
|
+
二: "2",
|
457
|
+
三: "3",
|
458
|
+
四: "4",
|
459
|
+
五: "5",
|
460
|
+
六: "6",
|
461
|
+
七: "7",
|
462
|
+
八: "8",
|
463
|
+
九: "9",
|
464
|
+
零: "0"
|
465
|
+
};
|
466
|
+
class b extends le {
|
467
|
+
constructor() {
|
468
|
+
super(...arguments), this.focused = !1, this._forcedUnit = "", this.formatOptions = {}, this.hideStepper = !1, this.indeterminate = !1, this.keyboardFocused = !1, this.managedInput = !1, this.stepModifier = 10, this._value = Number.NaN, this._trackingValue = "", this.decimalsChars = /* @__PURE__ */ new Set([".", ","]), this.valueBeforeFocus = "", this.isIntentDecimal = !1, this.changeCount = 0, this.languageResolver = new de(this), this.wasIndeterminate = !1, this.hasRecentlyReceivedPointerDown = !1, this.applyFocusElementLabel = (e) => {
|
469
|
+
this.appliedLabel = e;
|
470
|
+
}, this.isComposing = !1;
|
471
|
+
}
|
472
|
+
static get styles() {
|
473
|
+
return [...super.styles, A(ye)];
|
474
|
+
}
|
475
|
+
set value(e) {
|
476
|
+
const t = this.validateInput(e);
|
477
|
+
if (t === this.value)
|
478
|
+
return;
|
479
|
+
this.lastCommitedValue = t;
|
480
|
+
const r = this._value;
|
481
|
+
this._value = t, this.requestUpdate("value", r);
|
482
|
+
}
|
483
|
+
get value() {
|
484
|
+
return this._value;
|
485
|
+
}
|
486
|
+
get inputValue() {
|
487
|
+
return this.indeterminate ? this.formattedValue : this.inputElement.value;
|
488
|
+
}
|
489
|
+
setValue(e = this.value) {
|
490
|
+
const t = this.lastCommitedValue;
|
491
|
+
this.value = e, !(t === void 0 || t === this.value) && (this.lastCommitedValue = this.value, this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })));
|
492
|
+
}
|
493
|
+
/**
|
494
|
+
* Retreive the value of the element parsed to a Number.
|
495
|
+
*/
|
496
|
+
get valueAsString() {
|
497
|
+
return this._value.toString();
|
498
|
+
}
|
499
|
+
set valueAsString(e) {
|
500
|
+
this.value = this.numberParser.parse(e);
|
501
|
+
}
|
502
|
+
get formattedValue() {
|
503
|
+
return Number.isNaN(this.value) ? "" : this.numberFormatter.format(this.value) + (this.focused ? "" : this._forcedUnit);
|
504
|
+
}
|
505
|
+
convertValueToNumber(e) {
|
506
|
+
let t = [...e].map((i) => O[i] || i).join("");
|
507
|
+
const r = [...this.valueBeforeFocus].filter(
|
508
|
+
(i) => this.decimalsChars.has(i)
|
509
|
+
), o = new Set(r);
|
510
|
+
if (L() && this.inputElement.inputMode === "decimal" && t !== this.valueBeforeFocus) {
|
511
|
+
const n = this.numberFormatter.formatToParts(1000.1).find(
|
512
|
+
(u) => u.type === "decimal"
|
513
|
+
).value;
|
514
|
+
for (const u of o)
|
515
|
+
!(u === n) && !this.isIntentDecimal && (t = t.replaceAll(
|
516
|
+
new RegExp(u, "g"),
|
517
|
+
""
|
518
|
+
));
|
519
|
+
let l = !1;
|
520
|
+
const a = [...t];
|
521
|
+
for (let u = a.length - 1; u >= 0; u--) {
|
522
|
+
const m = a[u];
|
523
|
+
this.decimalsChars.has(m) && (l ? a[u] = "" : (a[u] = n, l = !0));
|
524
|
+
}
|
525
|
+
t = a.join("");
|
526
|
+
}
|
527
|
+
return this.numberParser.parse(t);
|
528
|
+
}
|
529
|
+
get _step() {
|
530
|
+
var e;
|
531
|
+
return this.step !== void 0 ? this.step : ((e = this.formatOptions) == null ? void 0 : e.style) === "percent" ? 0.01 : 1;
|
532
|
+
}
|
533
|
+
handlePointerdown(e) {
|
534
|
+
if (e.button !== 0) {
|
535
|
+
e.preventDefault();
|
536
|
+
return;
|
537
|
+
}
|
538
|
+
this.managedInput = !0, this.buttons.setPointerCapture(e.pointerId);
|
539
|
+
const t = this.buttons.children[0].getBoundingClientRect(), r = this.buttons.children[1].getBoundingClientRect();
|
540
|
+
this.findChange = (o) => {
|
541
|
+
o.clientX >= t.x && o.clientY >= t.y && o.clientX <= t.x + t.width && o.clientY <= t.y + t.height ? this.change = (i) => this.increment(i.shiftKey ? this.stepModifier : 1) : o.clientX >= r.x && o.clientY >= r.y && o.clientX <= r.x + r.width && o.clientY <= r.y + r.height && (this.change = (i) => this.decrement(i.shiftKey ? this.stepModifier : 1));
|
542
|
+
}, this.findChange(e), this.startChange(e);
|
543
|
+
}
|
544
|
+
startChange(e) {
|
545
|
+
this.changeCount = 0, this.doChange(e), this.safty = setTimeout(() => {
|
546
|
+
this.doNextChange(e);
|
547
|
+
}, 400);
|
548
|
+
}
|
549
|
+
doChange(e) {
|
550
|
+
this.change(e);
|
551
|
+
}
|
552
|
+
handlePointermove(e) {
|
553
|
+
this.findChange(e);
|
554
|
+
}
|
555
|
+
handlePointerup(e) {
|
556
|
+
this.buttons.releasePointerCapture(e.pointerId), cancelAnimationFrame(this.nextChange), clearTimeout(this.safty), this.managedInput = !1, this.setValue();
|
557
|
+
}
|
558
|
+
doNextChange(e) {
|
559
|
+
return this.changeCount += 1, this.changeCount % xe === 0 && this.doChange(e), requestAnimationFrame(() => {
|
560
|
+
this.nextChange = this.doNextChange(e);
|
561
|
+
});
|
562
|
+
}
|
563
|
+
stepBy(e) {
|
564
|
+
if (this.disabled || this.readonly)
|
565
|
+
return;
|
566
|
+
const t = this.min === void 0 ? 0 : this.min;
|
567
|
+
let r = this.value;
|
568
|
+
r += e * this._step, Number.isNaN(this.value) && (r = t), r = this.valueWithLimits(r), this.requestUpdate(), this._value = this.validateInput(r), this.inputElement.value = this.numberFormatter.format(r), this.inputElement.dispatchEvent(
|
569
|
+
new Event("input", { bubbles: !0, composed: !0 })
|
570
|
+
), this.indeterminate = !1, this.focus();
|
571
|
+
}
|
572
|
+
increment(e = 1) {
|
573
|
+
this.stepBy(1 * e);
|
574
|
+
}
|
575
|
+
decrement(e = 1) {
|
576
|
+
this.stepBy(-1 * e);
|
577
|
+
}
|
578
|
+
handleKeydown(e) {
|
579
|
+
if (!this.isComposing)
|
580
|
+
switch (e.code) {
|
581
|
+
case "ArrowUp": {
|
582
|
+
e.preventDefault(), this.increment(e.shiftKey ? this.stepModifier : 1), this.setValue();
|
583
|
+
break;
|
584
|
+
}
|
585
|
+
case "ArrowDown": {
|
586
|
+
e.preventDefault(), this.decrement(e.shiftKey ? this.stepModifier : 1), this.setValue();
|
587
|
+
break;
|
588
|
+
}
|
589
|
+
}
|
590
|
+
}
|
591
|
+
onScroll(e) {
|
592
|
+
e.preventDefault(), this.managedInput = !0;
|
593
|
+
const t = e.shiftKey ? e.deltaX / Math.abs(e.deltaX) : e.deltaY / Math.abs(e.deltaY);
|
594
|
+
t !== 0 && !Number.isNaN(t) && (this.stepBy(t * (e.shiftKey ? this.stepModifier : 1)), clearTimeout(this.queuedChangeEvent), this.queuedChangeEvent = setTimeout(() => {
|
595
|
+
this.setValue();
|
596
|
+
}, Fe)), this.managedInput = !1;
|
597
|
+
}
|
598
|
+
onFocus() {
|
599
|
+
super.onFocus(), this._trackingValue = this.inputValue, this.keyboardFocused = !this.readonly && !0, this.addEventListener("wheel", this.onScroll, { passive: !1 }), this.valueBeforeFocus = this.inputElement.value;
|
600
|
+
}
|
601
|
+
onBlur(e) {
|
602
|
+
super.onBlur(e), this.keyboardFocused = !this.readonly && !1, this.removeEventListener("wheel", this.onScroll), this.isIntentDecimal = !1;
|
603
|
+
}
|
604
|
+
handleFocusin() {
|
605
|
+
this.focused = !this.readonly && !0, this.keyboardFocused = !this.readonly && !0;
|
606
|
+
}
|
607
|
+
handleFocusout() {
|
608
|
+
this.focused = !this.readonly && !1, this.keyboardFocused = !this.readonly && !1;
|
609
|
+
}
|
610
|
+
handleChange() {
|
611
|
+
const e = this.convertValueToNumber(this.inputValue);
|
612
|
+
if (this.wasIndeterminate && (this.wasIndeterminate = !1, this.indeterminateValue = void 0, Number.isNaN(e))) {
|
613
|
+
this.indeterminate = !0;
|
614
|
+
return;
|
615
|
+
}
|
616
|
+
this.setValue(e), this.inputElement.value = this.formattedValue;
|
617
|
+
}
|
618
|
+
handleCompositionStart() {
|
619
|
+
this.isComposing = !0;
|
620
|
+
}
|
621
|
+
handleCompositionEnd() {
|
622
|
+
this.isComposing = !1, requestAnimationFrame(() => {
|
623
|
+
this.inputElement.dispatchEvent(
|
624
|
+
new Event("input", {
|
625
|
+
composed: !0,
|
626
|
+
bubbles: !0
|
627
|
+
})
|
628
|
+
);
|
629
|
+
});
|
630
|
+
}
|
631
|
+
handleInputElementPointerdown() {
|
632
|
+
this.hasRecentlyReceivedPointerDown = !0, this.updateComplete.then(() => {
|
633
|
+
requestAnimationFrame(() => {
|
634
|
+
this.hasRecentlyReceivedPointerDown = !1;
|
635
|
+
});
|
636
|
+
});
|
637
|
+
}
|
638
|
+
handleInput(e) {
|
639
|
+
if (this.isComposing) {
|
640
|
+
if (e.data) {
|
641
|
+
const a = this.convertValueToNumber(e.data);
|
642
|
+
Number.isNaN(a) && (this.inputElement.value = this.indeterminate ? g : this._trackingValue, this.isComposing = !1);
|
643
|
+
}
|
644
|
+
e.stopPropagation();
|
645
|
+
return;
|
646
|
+
}
|
647
|
+
this.indeterminate && (this.wasIndeterminate = !0, this.indeterminateValue = this.value, this.inputElement.value = this.inputElement.value.replace(
|
648
|
+
g,
|
649
|
+
""
|
650
|
+
)), e.data && this.decimalsChars.has(e.data) && (this.isIntentDecimal = !0);
|
651
|
+
const { value: t, selectionStart: r } = this.inputElement, o = [...t].map((a) => O[a] || a).join("");
|
652
|
+
if (this.numberParser.isValidPartialNumber(o)) {
|
653
|
+
this.lastCommitedValue = this.lastCommitedValue ?? this.value;
|
654
|
+
const a = this.convertValueToNumber(o);
|
655
|
+
!o && this.indeterminateValue ? (this.indeterminate = !0, this._value = this.indeterminateValue) : (this.indeterminate = !1, this._value = this.validateInput(a)), this._trackingValue = o, this.inputElement.value = o, this.inputElement.setSelectionRange(r, r);
|
656
|
+
return;
|
657
|
+
}
|
658
|
+
this.inputElement.value = this.indeterminate ? g : this._trackingValue, e.stopPropagation();
|
659
|
+
const i = o.length, n = this._trackingValue.length, l = (r || i) - (i - n);
|
660
|
+
this.inputElement.setSelectionRange(l, l);
|
661
|
+
}
|
662
|
+
valueWithLimits(e) {
|
663
|
+
let t = e;
|
664
|
+
return this.min !== void 0 && (t = Math.max(this.min, t)), this.max !== void 0 && (t = Math.min(this.max, t)), t;
|
665
|
+
}
|
666
|
+
validateInput(e) {
|
667
|
+
e = this.valueWithLimits(e);
|
668
|
+
const t = e < 0 ? -1 : 1;
|
669
|
+
if (e *= t, this.step) {
|
670
|
+
const r = this.min === void 0 ? 0 : this.min, o = Number.parseFloat(
|
671
|
+
this.valueFormatter.format((e - r) % this.step)
|
672
|
+
);
|
673
|
+
if (o === 0 || (Math.round(o / this.step) === 1 ? e += this.step - o : e -= o), this.max !== void 0)
|
674
|
+
for (; e > this.max; )
|
675
|
+
e -= this.step;
|
676
|
+
e = Number.parseFloat(this.valueFormatter.format(e));
|
677
|
+
}
|
678
|
+
return e *= t, e;
|
679
|
+
}
|
680
|
+
get displayValue() {
|
681
|
+
const e = this.focused ? "" : g;
|
682
|
+
return this.indeterminate ? e : this.formattedValue;
|
683
|
+
}
|
684
|
+
clearNumberFormatterCache() {
|
685
|
+
this._numberFormatter = void 0, this._numberParser = void 0;
|
686
|
+
}
|
687
|
+
get numberFormatter() {
|
688
|
+
if (!this._numberFormatter || !this._numberFormatterFocused) {
|
689
|
+
const {
|
690
|
+
style: e,
|
691
|
+
unit: t,
|
692
|
+
unitDisplay: r,
|
693
|
+
...o
|
694
|
+
} = this.formatOptions;
|
695
|
+
e !== "unit" && (o.style = e), this._numberFormatterFocused = new z(
|
696
|
+
this.languageResolver.language,
|
697
|
+
o
|
698
|
+
);
|
699
|
+
try {
|
700
|
+
this._numberFormatter = new z(
|
701
|
+
this.languageResolver.language,
|
702
|
+
this.formatOptions
|
703
|
+
), this._forcedUnit = "", this._numberFormatter.format(1);
|
704
|
+
} catch {
|
705
|
+
e === "unit" && (this._forcedUnit = t), this._numberFormatter = this._numberFormatterFocused;
|
706
|
+
}
|
707
|
+
}
|
708
|
+
return this.focused ? this._numberFormatterFocused : this._numberFormatter;
|
709
|
+
}
|
710
|
+
clearValueFormatterCache() {
|
711
|
+
this._valueFormatter = void 0;
|
712
|
+
}
|
713
|
+
get valueFormatter() {
|
714
|
+
if (!this._valueFormatter) {
|
715
|
+
const e = this.step ? this.step === Math.floor(this.step) ? 0 : this.step.toString().split(".")[1].length : 0;
|
716
|
+
this._valueFormatter = new z("en", {
|
717
|
+
useGrouping: !1,
|
718
|
+
maximumFractionDigits: e
|
719
|
+
});
|
720
|
+
}
|
721
|
+
return this._valueFormatter;
|
722
|
+
}
|
723
|
+
get numberParser() {
|
724
|
+
if (!this._numberParser || !this._numberParserFocused) {
|
725
|
+
const {
|
726
|
+
style: e,
|
727
|
+
unit: t,
|
728
|
+
unitDisplay: r,
|
729
|
+
...o
|
730
|
+
} = this.formatOptions;
|
731
|
+
e !== "unit" && (o.style = e), this._numberParserFocused = new C(
|
732
|
+
this.languageResolver.language,
|
733
|
+
o
|
734
|
+
);
|
735
|
+
try {
|
736
|
+
this._numberParser = new C(
|
737
|
+
this.languageResolver.language,
|
738
|
+
this.formatOptions
|
739
|
+
), this._forcedUnit = "", this._numberParser.parse("0");
|
740
|
+
} catch {
|
741
|
+
e === "unit" && (this._forcedUnit = t), this._numberParser = this._numberParserFocused;
|
742
|
+
}
|
743
|
+
}
|
744
|
+
return this.focused ? this._numberParserFocused : this._numberParser;
|
745
|
+
}
|
746
|
+
renderField() {
|
747
|
+
return this.autocomplete = "off", S`
|
748
|
+
${super.renderField()}
|
749
|
+
${this.hideStepper ? M : S`
|
750
|
+
<span
|
751
|
+
class="buttons"
|
752
|
+
@focusin=${this.handleFocusin}
|
753
|
+
@focusout=${this.handleFocusout}
|
754
|
+
${ue({
|
755
|
+
start: ["pointerdown", this.handlePointerdown],
|
756
|
+
streamInside: [
|
757
|
+
[
|
758
|
+
"pointermove",
|
759
|
+
"pointerenter",
|
760
|
+
"pointerleave",
|
761
|
+
"pointerover",
|
762
|
+
"pointerout"
|
763
|
+
],
|
764
|
+
this.handlePointermove
|
765
|
+
],
|
766
|
+
end: [
|
767
|
+
["pointerup", "pointercancel", "pointerleave"],
|
768
|
+
this.handlePointerup
|
769
|
+
]
|
770
|
+
})}
|
771
|
+
>
|
772
|
+
<luzmo-infield-button
|
773
|
+
inline="end"
|
774
|
+
block="start"
|
775
|
+
class="button step-up"
|
776
|
+
aria-hidden="true"
|
777
|
+
label=${"Increase " + this.appliedLabel}
|
778
|
+
size=${this.size}
|
779
|
+
tabindex="-1"
|
780
|
+
?focused=${this.focused}
|
781
|
+
?disabled=${this.disabled || this.readonly || this.max !== void 0 && this.value === this.max}
|
782
|
+
?quiet=${this.quiet}
|
783
|
+
>
|
784
|
+
${D(J)}
|
785
|
+
</luzmo-infield-button>
|
786
|
+
<luzmo-infield-button
|
787
|
+
inline="end"
|
788
|
+
block="end"
|
789
|
+
class="button step-down"
|
790
|
+
aria-hidden="true"
|
791
|
+
label=${"Decrease " + this.appliedLabel}
|
792
|
+
size=${this.size}
|
793
|
+
tabindex="-1"
|
794
|
+
?focused=${this.focused}
|
795
|
+
?disabled=${this.disabled || this.readonly || this.min !== void 0 && this.value === this.min}
|
796
|
+
?quiet=${this.quiet}
|
797
|
+
>
|
798
|
+
${D(Q)}
|
799
|
+
</luzmo-infield-button>
|
800
|
+
</span>
|
801
|
+
`}
|
802
|
+
`;
|
803
|
+
}
|
804
|
+
update(e) {
|
805
|
+
if ((e.has("formatOptions") || e.has("resolvedLanguage")) && this.clearNumberFormatterCache(), e.has("value") || e.has("max") || e.has("min") || e.has("step")) {
|
806
|
+
const t = this.numberParser.parse(
|
807
|
+
this.formattedValue.replace(this._forcedUnit, "")
|
808
|
+
);
|
809
|
+
this.value = t, this.clearValueFormatterCache();
|
810
|
+
}
|
811
|
+
super.update(e);
|
812
|
+
}
|
813
|
+
willUpdate(e) {
|
814
|
+
this.multiline = !1, e.has(T) && this.clearNumberFormatterCache();
|
815
|
+
}
|
816
|
+
firstUpdated(e) {
|
817
|
+
super.firstUpdated(e), this.addEventListener("keydown", this.handleKeydown), this.addEventListener("compositionstart", this.handleCompositionStart), this.addEventListener("compositionend", this.handleCompositionEnd);
|
818
|
+
}
|
819
|
+
updated(e) {
|
820
|
+
if (!(!this.inputElement || !this.isConnected)) {
|
821
|
+
if (e.has("min") || e.has("formatOptions")) {
|
822
|
+
const t = this.min !== void 0 && this.min >= 0, { maximumFractionDigits: r } = this.numberFormatter.resolvedOptions(), o = r && r > 0;
|
823
|
+
let i = "numeric";
|
824
|
+
te() && !t ? i = "text" : (L() && o || re() && o && t) && (i = "decimal"), this.inputElement.inputMode = i;
|
825
|
+
}
|
826
|
+
e.has("focused") && this.focused && !this.hasRecentlyReceivedPointerDown && this.formatOptions.unit && this.setSelectionRange(0, this.displayValue.length);
|
827
|
+
}
|
828
|
+
}
|
829
|
+
}
|
830
|
+
h([
|
831
|
+
ie(".buttons")
|
832
|
+
], b.prototype, "buttons", 2);
|
833
|
+
h([
|
834
|
+
c({ type: Boolean, reflect: !0 })
|
835
|
+
], b.prototype, "focused", 2);
|
836
|
+
h([
|
837
|
+
c({ type: Object, attribute: "format-options" })
|
838
|
+
], b.prototype, "formatOptions", 2);
|
839
|
+
h([
|
840
|
+
c({ type: Boolean, reflect: !0, attribute: "hide-stepper" })
|
841
|
+
], b.prototype, "hideStepper", 2);
|
842
|
+
h([
|
843
|
+
c({ type: Boolean, reflect: !0 })
|
844
|
+
], b.prototype, "indeterminate", 2);
|
845
|
+
h([
|
846
|
+
c({ type: Boolean, reflect: !0, attribute: "keyboard-focused" })
|
847
|
+
], b.prototype, "keyboardFocused", 2);
|
848
|
+
h([
|
849
|
+
c({ type: Number })
|
850
|
+
], b.prototype, "max", 2);
|
851
|
+
h([
|
852
|
+
c({ type: Number })
|
853
|
+
], b.prototype, "min", 2);
|
854
|
+
h([
|
855
|
+
c({ type: Number })
|
856
|
+
], b.prototype, "step", 2);
|
857
|
+
h([
|
858
|
+
c({ type: Number, reflect: !0, attribute: "step-modifier" })
|
859
|
+
], b.prototype, "stepModifier", 2);
|
860
|
+
h([
|
861
|
+
c({ type: Number })
|
862
|
+
], b.prototype, "value", 1);
|
863
|
+
customElements.get("luzmo-number-field") || customElements.define("luzmo-number-field", b);
|
864
|
+
export {
|
865
|
+
de as L,
|
866
|
+
w as a,
|
867
|
+
b,
|
868
|
+
ue as s
|
869
|
+
};
|