@sken-ds/primitives 0.3.0 → 0.3.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.
@@ -0,0 +1,538 @@
1
+ import { t as e } from "./decorate-D4FKzyDw.js";
2
+ import { LitElement as t, css as n, html as r, nothing as i } from "lit";
3
+ import { customElement as a, property as o } from "lit/decorators.js";
4
+ //#region src/components/sken-number-input.ts
5
+ var s = 1, c = !0, l = class extends t {
6
+ static {
7
+ this.formAssociated = !0;
8
+ }
9
+ #e;
10
+ constructor() {
11
+ super(), this.#e = null, this.defaultValue = void 0, this.value = void 0, this.min = void 0, this.max = void 0, this.step = s, this.showStepperButtons = c, this.placeholder = void 0, this.label = void 0, this.required = !1, this.disabled = !1, this.readonly = !1, this.helperText = void 0, this.infoText = void 0, this.warningText = void 0, this.validText = void 0, this.invalidText = void 0, this.textAlignment = "end", this.size = "md", this.invalid = !1, this.describedById = void 0, this.name = void 0, this.#t = "", this.#r = "0.5rem", this.#i = () => {
12
+ let e = this.renderRoot.querySelector("input"), t = this.renderRoot.querySelector(".steppers"), n = this.renderRoot.querySelector(".slot-end");
13
+ !e || !n || requestAnimationFrame(() => {
14
+ if (!e.isConnected) return;
15
+ let r = t && this.showStepperButtons ? t.getBoundingClientRect().width : 0, i = n.getBoundingClientRect().width, a = parseFloat(getComputedStyle(e).fontSize) * .5, o = r, s = o + a;
16
+ n.style.insetInlineEnd = s > 0 ? `${s}px` : "0.5rem";
17
+ let c = s + i, l = Math.max(o, c) + a;
18
+ e.style.paddingInlineEnd = `${l}px`;
19
+ });
20
+ }, this.#a = null, this.#o = null, this.#c = (e) => {
21
+ let t = e.target;
22
+ this.#t = t.value;
23
+ let n = this.#v(t.value);
24
+ this.value, this.#n(), this.dispatchEvent(new CustomEvent("sken-input", {
25
+ detail: n,
26
+ bubbles: !0,
27
+ composed: !0
28
+ }));
29
+ }, this.#l = (e) => {
30
+ let t = e.target, n = this.#v(t.value), r = this.#_(n);
31
+ r !== n && (this.#t = r === void 0 ? "" : String(r), t.value = this.#t), this.#n(), this.dispatchEvent(new CustomEvent("sken-change", {
32
+ detail: r,
33
+ bubbles: !0,
34
+ composed: !0
35
+ }));
36
+ }, this.#u = (e) => {
37
+ this.dispatchEvent(new CustomEvent("sken-focus", {
38
+ bubbles: !0,
39
+ composed: !0
40
+ }));
41
+ }, this.#d = (e) => {
42
+ this.dispatchEvent(new CustomEvent("sken-blur", {
43
+ bubbles: !0,
44
+ composed: !0
45
+ }));
46
+ }, this.#f = (e) => {
47
+ if (this.disabled || this.readonly) return;
48
+ let t = e.shiftKey || e.key === "PageUp" || e.key === "PageDown" ? 10 : 1;
49
+ e.key === "ArrowUp" ? (e.preventDefault(), this.#h(1, t)) : e.key === "ArrowDown" ? (e.preventDefault(), this.#h(-1, t)) : e.key === "PageUp" ? (e.preventDefault(), this.#h(1, 10)) : e.key === "PageDown" ? (e.preventDefault(), this.#h(-1, 10)) : e.key === "Home" && this.min !== void 0 ? (e.preventDefault(), this.#g(this.min)) : e.key === "End" && this.max !== void 0 ? (e.preventDefault(), this.#g(this.max)) : e.key;
50
+ }, this.#p = () => this.#h(1), this.#m = () => this.#h(-1);
51
+ try {
52
+ this.#e = this.attachInternals();
53
+ } catch {
54
+ this.#e = null;
55
+ }
56
+ }
57
+ #t;
58
+ connectedCallback() {
59
+ super.connectedCallback(), this.#t = this.value === void 0 ? this.defaultValue === void 0 ? "" : String(this.defaultValue) : String(this.value), this.#n();
60
+ }
61
+ disconnectedCallback() {
62
+ super.disconnectedCallback(), this.#a?.disconnect(), this.#o?.disconnect();
63
+ }
64
+ formResetCallback() {
65
+ if (this.value === void 0) {
66
+ this.#t = this.defaultValue === void 0 ? "" : String(this.defaultValue);
67
+ let e = this.renderRoot.querySelector("input");
68
+ e && (e.value = this.#t), this.#n();
69
+ } else this.requestUpdate();
70
+ }
71
+ formDisabledCallback(e) {
72
+ this.disabled = e;
73
+ }
74
+ #n() {
75
+ if (!this.#e) return;
76
+ let e = this.value === void 0 ? "" : String(this.value);
77
+ this.#e.setFormValue(e);
78
+ }
79
+ firstUpdated() {
80
+ let e = this.renderRoot.querySelector(".slot-end"), t = this.renderRoot.querySelector("slot[name=\"end\"]");
81
+ e && t && (this.#a = new MutationObserver(() => this.#i()), this.#a.observe(e, {
82
+ childList: !0,
83
+ subtree: !0,
84
+ attributes: !0
85
+ }), t.addEventListener("slotchange", this.#i)), this.#o = new IntersectionObserver((e) => {
86
+ for (let t of e) t.isIntersecting && this.#i();
87
+ }), this.#o.observe(this), this.#i();
88
+ }
89
+ #r;
90
+ #i;
91
+ #a;
92
+ #o;
93
+ static {
94
+ this.styles = n`
95
+ :host {
96
+ display: inline-block;
97
+ inline-size: 100%;
98
+ }
99
+
100
+ .field {
101
+ display: grid;
102
+ gap: 0.375rem;
103
+ }
104
+
105
+ .label {
106
+ font-size: 0.8125rem;
107
+ font-weight: 500;
108
+ color: var(--sken-foreground);
109
+ }
110
+
111
+ .label[data-required='true']::after {
112
+ content: ' *';
113
+ color: var(--sken-destructive);
114
+ }
115
+
116
+ .input-wrapper {
117
+ position: relative;
118
+ display: flex;
119
+ align-items: center;
120
+ inline-size: 100%;
121
+ }
122
+
123
+ input {
124
+ box-sizing: border-box;
125
+ inline-size: 100%;
126
+ border: 1px solid var(--sken-border);
127
+ border-radius: var(--sken-md);
128
+ background: var(--sken-input);
129
+ color: var(--sken-foreground);
130
+ font-family: var(--sken-family-sans);
131
+ font-size: var(--sken-size-md);
132
+ line-height: 1.25;
133
+ text-overflow: ellipsis;
134
+ padding-block: var(--sken-2);
135
+ padding-inline: var(--sken-3);
136
+ /* When the ± steppers are visible, reserve the right edge
137
+ for them so the value text never overlaps. 1.5rem (button)
138
+ + 2 * 0.25rem (insets) + 0.25rem (air) = 2.25rem. */
139
+ padding-inline-end: var(--sken-3);
140
+ min-block-size: 2.25rem;
141
+ transition:
142
+ border-color 120ms ease,
143
+ box-shadow 120ms ease;
144
+ /* Hide the native steppers: we render our own. */
145
+ -moz-appearance: textfield;
146
+ }
147
+
148
+ input::-webkit-outer-spin-button,
149
+ input::-webkit-inner-spin-button {
150
+ -webkit-appearance: none;
151
+ margin: 0;
152
+ }
153
+
154
+ input::placeholder {
155
+ color: var(--sken-muted-foreground);
156
+ opacity: 1;
157
+ }
158
+
159
+ /* ── Stepper buttons ───────────────────────────────────── */
160
+ /*
161
+ * The stepper column is a vertical pair of + and − buttons
162
+ * anchored to the right edge of the input. Sizes scale with
163
+ * the host's [size] attribute (sm / md / lg) so the buttons
164
+ * match the input's vertical rhythm. Default (md) is 24x20
165
+ * per button. Glyph color is --sken-foreground; hover swaps
166
+ * to --sken-primary. Disabled state uses --sken-disabled.
167
+ */
168
+ .steppers {
169
+ position: absolute;
170
+ inset-block: 0.25rem;
171
+ inset-inline-end: 0.25rem;
172
+ display: flex;
173
+ flex-direction: column;
174
+ gap: 2px;
175
+ align-items: center;
176
+ justify-content: center;
177
+ }
178
+
179
+ .stepper {
180
+ display: inline-flex;
181
+ align-items: center;
182
+ justify-content: center;
183
+ inline-size: 1.5rem;
184
+ block-size: 1.25rem;
185
+ background: transparent;
186
+ border: 0;
187
+ padding: 0;
188
+ color: var(--sken-foreground);
189
+ cursor: pointer;
190
+ font-family: inherit;
191
+ font-size: 1rem;
192
+ line-height: 1;
193
+ font-weight: 600;
194
+ border-radius: var(--sken-sm, 0.25rem);
195
+ /* The parent .steppers is a flex column; prevent the
196
+ buttons from being squashed when the host's vertical
197
+ rhythm is tight (sm). The explicit block-size wins. */
198
+ flex-shrink: 0;
199
+ transition: color 120ms ease, background-color 120ms ease;
200
+ }
201
+
202
+ .stepper:hover:not(:disabled) {
203
+ color: var(--sken-primary);
204
+ /* No background fill on hover. A background would paint
205
+ over the input's right border, hiding it. The color
206
+ change to --sken-primary is enough affordance for a
207
+ 20x24px icon button. */
208
+ background: transparent;
209
+ }
210
+
211
+ .stepper:focus-visible {
212
+ outline: 2px solid var(--sken-ring, currentColor);
213
+ outline-offset: 1px;
214
+ }
215
+
216
+ .stepper:disabled {
217
+ cursor: not-allowed;
218
+ opacity: var(--sken-disabled);
219
+ }
220
+
221
+ /* When the ± steppers are visible, reserve the right edge
222
+ of the input so the value text never overlaps. The
223
+ reservation is 2rem for the md size (default): 1.5rem
224
+ (button) + 2 * 0.25rem (column insets). The sm / lg
225
+ variants below override the button size, so the
226
+ reservation needs to scale too. */
227
+ :host([show-stepper-buttons]) input {
228
+ padding-inline-end: 2rem;
229
+ }
230
+
231
+ /* ── Stepper sizes ─────────────────────────────────────── */
232
+ :host([size='sm']) .steppers {
233
+ inset-block: 0.125rem;
234
+ inset-inline-end: 0.125rem;
235
+ gap: 1px;
236
+ }
237
+ :host([size='sm']) .stepper {
238
+ inline-size: 1.125rem;
239
+ block-size: 0.875rem;
240
+ font-size: 0.75rem;
241
+ }
242
+ /* sm: 1.125rem (button) + 2 * 0.125rem (insets) = 1.375rem,
243
+ plus 0.125rem of breathing air = 1.5rem. */
244
+ :host([size='sm'][show-stepper-buttons]) input {
245
+ padding-inline-end: 1.5rem;
246
+ }
247
+
248
+ :host([size='lg']) .steppers {
249
+ inset-block: 0.375rem;
250
+ inset-inline-end: 0.375rem;
251
+ gap: 3px;
252
+ }
253
+ :host([size='lg']) .stepper {
254
+ inline-size: 1.75rem;
255
+ block-size: 1.5rem;
256
+ font-size: 1.125rem;
257
+ }
258
+ /* lg: 1.75rem (button) + 2 * 0.375rem (insets) = 2.5rem,
259
+ plus 0.25rem of breathing air = 2.75rem. */
260
+ :host([size='lg'][show-stepper-buttons]) input {
261
+ padding-inline-end: 2.75rem;
262
+ }
263
+
264
+ /* Hide steppers on touch devices where they would be hard
265
+ to hit accurately. The user can still use ↑/↓ keys or
266
+ type directly. */
267
+ @media (hover: none) {
268
+ .steppers {
269
+ display: none;
270
+ }
271
+ input {
272
+ padding-inline-end: var(--sken-3);
273
+ }
274
+ :host([size='sm']) input {
275
+ padding-inline-end: var(--sken-2);
276
+ }
277
+ :host([size='lg']) input {
278
+ padding-inline-end: var(--sken-4);
279
+ }
280
+ }
281
+
282
+ /* ── Slot containers ────────────────────────────────────── */
283
+ .slot {
284
+ position: absolute;
285
+ display: flex;
286
+ align-items: center;
287
+ justify-content: center;
288
+ z-index: 1;
289
+ pointer-events: none;
290
+ color: var(--sken-muted-foreground);
291
+ }
292
+
293
+ .slot ::slotted(*) {
294
+ pointer-events: auto;
295
+ }
296
+
297
+ .slot-start {
298
+ inset-inline-start: 0.5rem;
299
+ }
300
+
301
+ /*
302
+ * The end slot's position is set in JS via the inline style
303
+ * (see #adjustLayout). The rule below is a fallback for the
304
+ * initial render before JS has measured the slot, and a
305
+ * sensible default when the slot is empty.
306
+ */
307
+ .slot-end {
308
+ inset-inline-end: 0.5rem;
309
+ }
310
+
311
+ /* ── States ─────────────────────────────────────────────── */
312
+ .input-wrapper:hover input:not(:disabled):not(:read-only) {
313
+ border-color: var(--sken-foreground);
314
+ }
315
+
316
+ .input-wrapper:focus-within input {
317
+ outline: 2px solid var(--sken-ring, currentColor);
318
+ outline-offset: 2px;
319
+ border-color: var(--sken-primary);
320
+ }
321
+
322
+ input:disabled {
323
+ cursor: not-allowed;
324
+ opacity: var(--sken-disabled);
325
+ }
326
+
327
+ input:read-only {
328
+ background: var(--sken-muted);
329
+ }
330
+
331
+ :host([invalid]) input {
332
+ border-color: var(--sken-destructive);
333
+ }
334
+
335
+ :host([invalid]) .input-wrapper:focus-within input {
336
+ outline-color: var(--sken-destructive);
337
+ }
338
+
339
+ /* ── Sizes ──────────────────────────────────────────────── */
340
+ :host([size='sm']) input {
341
+ padding-block: var(--sken-1);
342
+ padding-inline: var(--sken-2);
343
+ font-size: var(--sken-size-sm);
344
+ /* 2 × 0.875rem (buttons) + 1px (gap) + 2 × 0.125rem
345
+ (insets) = ~2.0625rem. Round up to 2.25rem for visual
346
+ breathing room. */
347
+ min-block-size: 2.25rem;
348
+ }
349
+ :host([size='md']) input {
350
+ /* Default styles above. */
351
+ }
352
+ :host([size='lg']) input {
353
+ padding-block: var(--sken-3);
354
+ padding-inline: var(--sken-4);
355
+ font-size: var(--sken-size-lg);
356
+ /* 2 × 1.5rem (buttons) + 3px (gap) + 2 × 0.375rem
357
+ (insets) = ~3.9375rem. Round up to 4rem. */
358
+ min-block-size: 4rem;
359
+ }
360
+
361
+ /* ── Validation messages ─────────────────────────────────── */
362
+ .messages {
363
+ display: grid;
364
+ gap: 0.25rem;
365
+ }
366
+
367
+ .message {
368
+ margin: 0;
369
+ font-size: 0.75rem;
370
+ line-height: 1.4;
371
+ }
372
+
373
+ .message[data-tone='info'] {
374
+ color: var(--sken-info, #0082ff);
375
+ }
376
+
377
+ .message[data-tone='warning'] {
378
+ color: var(--sken-warning, #f59e0b);
379
+ }
380
+
381
+ .message[data-tone='valid'] {
382
+ color: var(--sken-success, #10b981);
383
+ }
384
+
385
+ .message[data-tone='invalid'] {
386
+ color: var(--sken-destructive, #dc2626);
387
+ }
388
+
389
+ .message[data-tone='helper'] {
390
+ color: var(--sken-muted-foreground);
391
+ }
392
+ `;
393
+ }
394
+ render() {
395
+ let e = this.#s();
396
+ return r`
397
+ <div class="field" part="field">
398
+ ${this.label ? r`
399
+ <label class="label" part="label" data-required=${this.required}>
400
+ ${this.label}
401
+ </label>
402
+ ` : i}
403
+ <div class="input-wrapper" part="wrapper">
404
+ <div class="slot slot-start" part="slot-start">
405
+ <slot name="start"></slot>
406
+ </div>
407
+ <input
408
+ part="input"
409
+ type="number"
410
+ .value=${this.#t}
411
+ placeholder=${this.placeholder ?? ""}
412
+ ?disabled=${this.disabled}
413
+ ?readonly=${this.readonly}
414
+ ?required=${this.required}
415
+ min=${this.min ?? ""}
416
+ max=${this.max ?? ""}
417
+ step=${this.step}
418
+ aria-invalid=${this.invalid ? "true" : "false"}
419
+ aria-describedby=${this.describedById ?? ""}
420
+ name=${this.name ?? ""}
421
+ style="text-align: ${this.textAlignment}"
422
+ @input=${this.#c}
423
+ @change=${this.#l}
424
+ @focus=${this.#u}
425
+ @blur=${this.#d}
426
+ @keydown=${this.#f}
427
+ />
428
+ <div class="slot slot-end" part="slot-end">
429
+ <slot name="end"></slot>
430
+ </div>
431
+ ${this.showStepperButtons ? r`
432
+ <div class="steppers" part="steppers">
433
+ <button
434
+ class="stepper"
435
+ part="stepper stepper-up"
436
+ type="button"
437
+ aria-label="Increment"
438
+ ?disabled=${this.disabled || this.readonly || this.value !== void 0 && this.max !== void 0 && this.value >= this.max}
439
+ @click=${this.#p}
440
+ >
441
+ +
442
+ </button>
443
+ <button
444
+ class="stepper"
445
+ part="stepper stepper-down"
446
+ type="button"
447
+ aria-label="Decrement"
448
+ ?disabled=${this.disabled || this.readonly || this.value !== void 0 && this.min !== void 0 && this.value <= this.min}
449
+ @click=${this.#m}
450
+ >
451
+
452
+ </button>
453
+ </div>
454
+ ` : i}
455
+ </div>
456
+ ${e.length > 0 ? r`
457
+ <div class="messages" part="messages">${e}</div>
458
+ ` : i}
459
+ </div>
460
+ `;
461
+ }
462
+ #s() {
463
+ let e = [];
464
+ return this.invalidText && e.push(r`<p class="message" data-tone="invalid" part="message-invalid">
465
+ ${this.invalidText}
466
+ </p>`), this.warningText && e.push(r`<p class="message" data-tone="warning" part="message-warning">
467
+ ${this.warningText}
468
+ </p>`), this.infoText && e.push(r`<p class="message" data-tone="info" part="message-info">
469
+ ${this.infoText}
470
+ </p>`), this.validText && e.push(r`<p class="message" data-tone="valid" part="message-valid">
471
+ ${this.validText}
472
+ </p>`), this.helperText && e.length === 0 && e.push(r`<p class="message" data-tone="helper" part="message-helper">
473
+ ${this.helperText}
474
+ </p>`), e;
475
+ }
476
+ #c;
477
+ #l;
478
+ #u;
479
+ #d;
480
+ #f;
481
+ #p;
482
+ #m;
483
+ #h(e, t = 1) {
484
+ if (this.disabled || this.readonly) return;
485
+ let n = this.renderRoot.querySelector("input")?.value ?? "", r = n === "" ? this.value ?? 0 : Number(n);
486
+ if (!Number.isFinite(r)) return;
487
+ let i = r + e * this.step * t;
488
+ this.#g(i);
489
+ }
490
+ #g(e) {
491
+ let t = this.#_(e);
492
+ this.#t = t === void 0 ? "" : String(t);
493
+ let n = this.renderRoot.querySelector("input");
494
+ n && (n.value = this.#t), this.#n(), this.dispatchEvent(new CustomEvent("sken-input", {
495
+ detail: t,
496
+ bubbles: !0,
497
+ composed: !0
498
+ })), this.dispatchEvent(new CustomEvent("sken-change", {
499
+ detail: t,
500
+ bubbles: !0,
501
+ composed: !0
502
+ }));
503
+ }
504
+ #_(e) {
505
+ if (e === void 0 || Number.isNaN(e)) return;
506
+ let t = e;
507
+ return this.min !== void 0 && t < this.min && (t = this.min), this.max !== void 0 && t > this.max && (t = this.max), t;
508
+ }
509
+ #v(e) {
510
+ if (e === "" || e === "-") return;
511
+ let t = Number(e);
512
+ if (!Number.isNaN(t)) return t;
513
+ }
514
+ };
515
+ e([o({
516
+ attribute: "default-value",
517
+ type: Number
518
+ })], l.prototype, "defaultValue", void 0), e([o({ type: Number })], l.prototype, "value", void 0), e([o({ type: Number })], l.prototype, "min", void 0), e([o({ type: Number })], l.prototype, "max", void 0), e([o({ type: Number })], l.prototype, "step", void 0), e([o({
519
+ attribute: "show-stepper-buttons",
520
+ reflect: !0,
521
+ type: Boolean
522
+ })], l.prototype, "showStepperButtons", void 0), e([o()], l.prototype, "placeholder", void 0), e([o()], l.prototype, "label", void 0), e([o({
523
+ reflect: !0,
524
+ type: Boolean
525
+ })], l.prototype, "required", void 0), e([o({
526
+ reflect: !0,
527
+ type: Boolean
528
+ })], l.prototype, "disabled", void 0), e([o({
529
+ reflect: !0,
530
+ type: Boolean
531
+ })], l.prototype, "readonly", void 0), e([o({ attribute: "helper-text" })], l.prototype, "helperText", void 0), e([o({ attribute: "info-text" })], l.prototype, "infoText", void 0), e([o({ attribute: "warning-text" })], l.prototype, "warningText", void 0), e([o({ attribute: "valid-text" })], l.prototype, "validText", void 0), e([o({ attribute: "invalid-text" })], l.prototype, "invalidText", void 0), e([o({ attribute: "text-alignment" })], l.prototype, "textAlignment", void 0), e([o({ reflect: !0 })], l.prototype, "size", void 0), e([o({
532
+ reflect: !0,
533
+ type: Boolean
534
+ })], l.prototype, "invalid", void 0), e([o({ attribute: "described-by-id" })], l.prototype, "describedById", void 0), e([o()], l.prototype, "name", void 0), l = e([a("sken-number-input")], l);
535
+ //#endregion
536
+ export { l as SkenNumberInput };
537
+
538
+ //# sourceMappingURL=sken-number-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sken-number-input.js","names":["#rawText","#parseNumber","#syncFormValue","#clamp","#step","#commitValue","#internals","#slotEndObserver","#visibilityObserver","#adjustLayout","#renderMessages","#handleInput","#handleChange","#handleFocus","#handleBlur","#handleKeydown","#handleStepUp","#handleStepDown"],"sources":["../src/components/sken-number-input.ts"],"sourcesContent":["// ── <sken-number-input> — Sken-owned Web Component ─────────────────\n// Lit 3 primitive for numeric input with visible ± stepper buttons,\n// min/max clamping, and the same start/end slot system as\n// <sken-input>. Promoted from the SkenNumberInput PoC story (which\n// was a thin wrap of <ix-number-input>). The PoC proved the UX;\n// this primitive owns the contract.\n\nimport { LitElement, html, css, nothing } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport type { SkenNumberInputSize } from '@sken-ds/contracts'\n\n/**\n * Default step when the consumer does not pass one. Matches the\n * native `<input type=\"number\" step>` default.\n */\nconst DEFAULT_STEP = 1\n\n/**\n * Default value for `showStepperButtons`. The PoC validated that\n * the iX default of `false` is wrong for our use case: consumers\n * expect ± buttons for the numeric fields they use most (Alma\n * demo: quantity, temperature, score). The Sken primitive flips\n * the default to `true`; consumers who want a bare input pass\n * `showStepperButtons={false}` explicitly.\n */\nconst DEFAULT_SHOW_STEPPER_BUTTONS = true\n\n@customElement('sken-number-input')\nexport class SkenNumberInput extends LitElement {\n // Form-associated custom element. Same pattern as SkenInput /\n // SkenTextarea. The numeric value is stringified for\n // FormData (FormData is text-only); undefined becomes the\n // empty string. The implicit-submit-on-Enter rule still\n // applies, so a form with a single number input and a\n // submit button will submit on Enter.\n // https://lit.dev/docs/components/form/\n static formAssociated = true\n\n // ElementInternals handle. Created in the constructor.\n // Nullable to gracefully degrade in test environments.\n #internals: ElementInternals | null = null\n\n constructor() {\n super()\n try {\n this.#internals = this.attachInternals()\n } catch {\n this.#internals = null\n }\n }\n\n // ── Props ─────────────────────────────────────────────────────\n @property({ attribute: 'default-value', type: Number }) defaultValue: number | undefined = undefined\n @property({ type: Number }) value: number | undefined = undefined\n @property({ type: Number }) min: number | undefined = undefined\n @property({ type: Number }) max: number | undefined = undefined\n @property({ type: Number }) step: number = DEFAULT_STEP\n @property({ attribute: 'show-stepper-buttons', reflect: true, type: Boolean }) showStepperButtons =\n DEFAULT_SHOW_STEPPER_BUTTONS\n @property() placeholder: string | undefined = undefined\n @property() label: string | undefined = undefined\n @property({ reflect: true, type: Boolean }) required = false\n @property({ reflect: true, type: Boolean }) disabled = false\n @property({ reflect: true, type: Boolean }) readonly = false\n @property({ attribute: 'helper-text' }) helperText: string | undefined = undefined\n @property({ attribute: 'info-text' }) infoText: string | undefined = undefined\n @property({ attribute: 'warning-text' }) warningText: string | undefined = undefined\n @property({ attribute: 'valid-text' }) validText: string | undefined = undefined\n @property({ attribute: 'invalid-text' }) invalidText: string | undefined = undefined\n @property({ attribute: 'text-alignment' }) textAlignment: 'start' | 'end' = 'end'\n @property({ reflect: true }) size: SkenNumberInputSize = 'md'\n @property({ reflect: true, type: Boolean }) invalid = false\n @property({ attribute: 'described-by-id' }) describedById: string | undefined = undefined\n @property() name: string | undefined = undefined\n\n // ── Internal state ────────────────────────────────────────────\n /**\n * The raw text in the input. The DOM input is the source of\n * truth for the text (so the user can type a partial value like\n * \"-\", which is not a valid number yet). The numeric `value` is\n * derived from this on commit (blur, Enter, stepper).\n */\n #rawText: string = ''\n\n // ── DOM refs (queried on demand) ────────────────────────────\n\n // ── Lifecycle ─────────────────────────────────────────────────\n override connectedCallback(): void {\n super.connectedCallback()\n // Seed the raw text from the controlled value or the default.\n // We do NOT trigger a re-render here; the property is only\n // set after Lit has applied the host attributes, and the\n // first render will read the right value through this.value.\n if (this.value === undefined) {\n this.#rawText = this.defaultValue !== undefined ? String(this.defaultValue) : ''\n } else {\n this.#rawText = String(this.value)\n }\n // Publish the initial value to the surrounding form.\n this.#syncFormValue()\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback()\n this.#slotEndObserver?.disconnect()\n this.#visibilityObserver?.disconnect()\n }\n\n // ── Form-association callbacks ─────────────────────────────\n // formResetCallback: restore uncontrolled seed; re-render\n // controlled so Lit re-publishes the controlled value.\n formResetCallback(): void {\n if (this.value === undefined) {\n this.#rawText = this.defaultValue !== undefined ? String(this.defaultValue) : ''\n const inputEl = this.renderRoot.querySelector('input') as HTMLInputElement | null\n if (inputEl) inputEl.value = this.#rawText\n this.#syncFormValue()\n } else {\n this.requestUpdate()\n }\n }\n\n // formDisabledCallback: mirror the form's :disabled state\n // onto the prop. Lit re-renders; the inner <input> picks up\n // ?disabled=${this.disabled} in the template.\n formDisabledCallback(isDisabled: boolean): void {\n this.disabled = isDisabled\n }\n\n // Publish the current value to the form. FormData is\n // text-only, so we stringify the number (or empty string\n // for undefined). The string roundtrip preserves precision\n // for integers and finite decimals; consumers that need\n // BigInt or arbitrary precision should re-parse on the\n // server side.\n #syncFormValue(): void {\n if (!this.#internals) return\n const value = this.value !== undefined ? String(this.value) : ''\n this.#internals.setFormValue(value)\n }\n\n /**\n * Set up the dynamic layout once the shadow root has the\n * element children we need to measure. Same pattern as\n * SkenInput: MutationObserver on the slot container to\n * catch children being added/removed, IntersectionObserver\n * to catch the case where the input is hidden at first\n * connect (e.g. inside a closed <details> or an off-screen\n * tab), and slotchange as belt-and-braces.\n */\n protected override firstUpdated(): void {\n const endContainer = this.renderRoot.querySelector('.slot-end') as HTMLElement | null\n const endSlot = this.renderRoot.querySelector('slot[name=\"end\"]') as HTMLSlotElement | null\n if (endContainer && endSlot) {\n this.#slotEndObserver = new MutationObserver(() => this.#adjustLayout())\n this.#slotEndObserver.observe(endContainer, { childList: true, subtree: true, attributes: true })\n endSlot.addEventListener('slotchange', this.#adjustLayout)\n }\n this.#visibilityObserver = new IntersectionObserver(entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) this.#adjustLayout()\n }\n })\n this.#visibilityObserver.observe(this)\n this.#adjustLayout()\n }\n\n /**\n * The gap between a slot's edge and the input's text. 0.5rem\n * is what the SkenInput primitive uses (mirrors the iX rule).\n * The number input needs an extra \"air\" margin because the\n * stepper column is also on the right edge and we don't want\n * the value text to crash into the slot.\n */\n #SLOT_AIR = '0.5rem'\n\n /**\n * Measure the stepper column width and the end slot width, then\n * apply:\n * - The input's padding-inline-end so the value text never\n * overlaps the slot OR the stepper.\n * - The end slot's inset-inline-end so it sits to the LEFT of\n * the stepper (or at the right edge when no stepper).\n *\n * The math:\n * endInset = stepperReserve + air (slot's right edge)\n * paddingInline = max(endInset, stepperReserve) + air\n * If the end slot is empty, its width is 0 and the calc\n * falls back to the stepper-only reservation.\n */\n #adjustLayout = (): void => {\n const inputEl = this.renderRoot.querySelector('input') as HTMLInputElement | null\n const stepperEl = this.renderRoot.querySelector('.steppers') as HTMLElement | null\n const slotEndEl = this.renderRoot.querySelector('.slot-end') as HTMLElement | null\n if (!inputEl || !slotEndEl) return\n\n requestAnimationFrame(() => {\n if (!inputEl.isConnected) return\n const stepperWidth = stepperEl && this.showStepperButtons\n ? stepperEl.getBoundingClientRect().width\n : 0\n const endWidth = slotEndEl.getBoundingClientRect().width\n const air = parseFloat(getComputedStyle(inputEl).fontSize) * 0.5 // 0.5em in px\n const stepperReserve = stepperWidth\n // The slot's right edge sits at stepperReserve + air from\n // the input's right edge, so it never overlaps the stepper\n // column.\n const endInset = stepperReserve + air\n slotEndEl.style.insetInlineEnd = endInset > 0 ? `${endInset}px` : '0.5rem'\n // The input's padding-inline-end has to be at least the\n // wider of (stepperReserve, endInset + endWidth) so the\n // value text never overlaps either.\n const textReserve = endInset + endWidth\n const padEnd = Math.max(stepperReserve, textReserve) + air\n inputEl.style.paddingInlineEnd = `${padEnd}px`\n })\n }\n\n #slotEndObserver: MutationObserver | null = null\n #visibilityObserver: IntersectionObserver | null = null\n\n // ── Styles ────────────────────────────────────────────────────\n static styles = css`\n :host {\n display: inline-block;\n inline-size: 100%;\n }\n\n .field {\n display: grid;\n gap: 0.375rem;\n }\n\n .label {\n font-size: 0.8125rem;\n font-weight: 500;\n color: var(--sken-foreground);\n }\n\n .label[data-required='true']::after {\n content: ' *';\n color: var(--sken-destructive);\n }\n\n .input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n inline-size: 100%;\n }\n\n input {\n box-sizing: border-box;\n inline-size: 100%;\n border: 1px solid var(--sken-border);\n border-radius: var(--sken-md);\n background: var(--sken-input);\n color: var(--sken-foreground);\n font-family: var(--sken-family-sans);\n font-size: var(--sken-size-md);\n line-height: 1.25;\n text-overflow: ellipsis;\n padding-block: var(--sken-2);\n padding-inline: var(--sken-3);\n /* When the ± steppers are visible, reserve the right edge\n for them so the value text never overlaps. 1.5rem (button)\n + 2 * 0.25rem (insets) + 0.25rem (air) = 2.25rem. */\n padding-inline-end: var(--sken-3);\n min-block-size: 2.25rem;\n transition:\n border-color 120ms ease,\n box-shadow 120ms ease;\n /* Hide the native steppers: we render our own. */\n -moz-appearance: textfield;\n }\n\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n input::placeholder {\n color: var(--sken-muted-foreground);\n opacity: 1;\n }\n\n /* ── Stepper buttons ───────────────────────────────────── */\n /*\n * The stepper column is a vertical pair of + and − buttons\n * anchored to the right edge of the input. Sizes scale with\n * the host's [size] attribute (sm / md / lg) so the buttons\n * match the input's vertical rhythm. Default (md) is 24x20\n * per button. Glyph color is --sken-foreground; hover swaps\n * to --sken-primary. Disabled state uses --sken-disabled.\n */\n .steppers {\n position: absolute;\n inset-block: 0.25rem;\n inset-inline-end: 0.25rem;\n display: flex;\n flex-direction: column;\n gap: 2px;\n align-items: center;\n justify-content: center;\n }\n\n .stepper {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n inline-size: 1.5rem;\n block-size: 1.25rem;\n background: transparent;\n border: 0;\n padding: 0;\n color: var(--sken-foreground);\n cursor: pointer;\n font-family: inherit;\n font-size: 1rem;\n line-height: 1;\n font-weight: 600;\n border-radius: var(--sken-sm, 0.25rem);\n /* The parent .steppers is a flex column; prevent the\n buttons from being squashed when the host's vertical\n rhythm is tight (sm). The explicit block-size wins. */\n flex-shrink: 0;\n transition: color 120ms ease, background-color 120ms ease;\n }\n\n .stepper:hover:not(:disabled) {\n color: var(--sken-primary);\n /* No background fill on hover. A background would paint\n over the input's right border, hiding it. The color\n change to --sken-primary is enough affordance for a\n 20x24px icon button. */\n background: transparent;\n }\n\n .stepper:focus-visible {\n outline: 2px solid var(--sken-ring, currentColor);\n outline-offset: 1px;\n }\n\n .stepper:disabled {\n cursor: not-allowed;\n opacity: var(--sken-disabled);\n }\n\n /* When the ± steppers are visible, reserve the right edge\n of the input so the value text never overlaps. The\n reservation is 2rem for the md size (default): 1.5rem\n (button) + 2 * 0.25rem (column insets). The sm / lg\n variants below override the button size, so the\n reservation needs to scale too. */\n :host([show-stepper-buttons]) input {\n padding-inline-end: 2rem;\n }\n\n /* ── Stepper sizes ─────────────────────────────────────── */\n :host([size='sm']) .steppers {\n inset-block: 0.125rem;\n inset-inline-end: 0.125rem;\n gap: 1px;\n }\n :host([size='sm']) .stepper {\n inline-size: 1.125rem;\n block-size: 0.875rem;\n font-size: 0.75rem;\n }\n /* sm: 1.125rem (button) + 2 * 0.125rem (insets) = 1.375rem,\n plus 0.125rem of breathing air = 1.5rem. */\n :host([size='sm'][show-stepper-buttons]) input {\n padding-inline-end: 1.5rem;\n }\n\n :host([size='lg']) .steppers {\n inset-block: 0.375rem;\n inset-inline-end: 0.375rem;\n gap: 3px;\n }\n :host([size='lg']) .stepper {\n inline-size: 1.75rem;\n block-size: 1.5rem;\n font-size: 1.125rem;\n }\n /* lg: 1.75rem (button) + 2 * 0.375rem (insets) = 2.5rem,\n plus 0.25rem of breathing air = 2.75rem. */\n :host([size='lg'][show-stepper-buttons]) input {\n padding-inline-end: 2.75rem;\n }\n\n /* Hide steppers on touch devices where they would be hard\n to hit accurately. The user can still use ↑/↓ keys or\n type directly. */\n @media (hover: none) {\n .steppers {\n display: none;\n }\n input {\n padding-inline-end: var(--sken-3);\n }\n :host([size='sm']) input {\n padding-inline-end: var(--sken-2);\n }\n :host([size='lg']) input {\n padding-inline-end: var(--sken-4);\n }\n }\n\n /* ── Slot containers ────────────────────────────────────── */\n .slot {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1;\n pointer-events: none;\n color: var(--sken-muted-foreground);\n }\n\n .slot ::slotted(*) {\n pointer-events: auto;\n }\n\n .slot-start {\n inset-inline-start: 0.5rem;\n }\n\n /*\n * The end slot's position is set in JS via the inline style\n * (see #adjustLayout). The rule below is a fallback for the\n * initial render before JS has measured the slot, and a\n * sensible default when the slot is empty.\n */\n .slot-end {\n inset-inline-end: 0.5rem;\n }\n\n /* ── States ─────────────────────────────────────────────── */\n .input-wrapper:hover input:not(:disabled):not(:read-only) {\n border-color: var(--sken-foreground);\n }\n\n .input-wrapper:focus-within input {\n outline: 2px solid var(--sken-ring, currentColor);\n outline-offset: 2px;\n border-color: var(--sken-primary);\n }\n\n input:disabled {\n cursor: not-allowed;\n opacity: var(--sken-disabled);\n }\n\n input:read-only {\n background: var(--sken-muted);\n }\n\n :host([invalid]) input {\n border-color: var(--sken-destructive);\n }\n\n :host([invalid]) .input-wrapper:focus-within input {\n outline-color: var(--sken-destructive);\n }\n\n /* ── Sizes ──────────────────────────────────────────────── */\n :host([size='sm']) input {\n padding-block: var(--sken-1);\n padding-inline: var(--sken-2);\n font-size: var(--sken-size-sm);\n /* 2 × 0.875rem (buttons) + 1px (gap) + 2 × 0.125rem\n (insets) = ~2.0625rem. Round up to 2.25rem for visual\n breathing room. */\n min-block-size: 2.25rem;\n }\n :host([size='md']) input {\n /* Default styles above. */\n }\n :host([size='lg']) input {\n padding-block: var(--sken-3);\n padding-inline: var(--sken-4);\n font-size: var(--sken-size-lg);\n /* 2 × 1.5rem (buttons) + 3px (gap) + 2 × 0.375rem\n (insets) = ~3.9375rem. Round up to 4rem. */\n min-block-size: 4rem;\n }\n\n /* ── Validation messages ─────────────────────────────────── */\n .messages {\n display: grid;\n gap: 0.25rem;\n }\n\n .message {\n margin: 0;\n font-size: 0.75rem;\n line-height: 1.4;\n }\n\n .message[data-tone='info'] {\n color: var(--sken-info, #0082ff);\n }\n\n .message[data-tone='warning'] {\n color: var(--sken-warning, #f59e0b);\n }\n\n .message[data-tone='valid'] {\n color: var(--sken-success, #10b981);\n }\n\n .message[data-tone='invalid'] {\n color: var(--sken-destructive, #dc2626);\n }\n\n .message[data-tone='helper'] {\n color: var(--sken-muted-foreground);\n }\n `\n\n // ── Render ────────────────────────────────────────────────────\n protected override render() {\n const messages = this.#renderMessages()\n return html`\n <div class=\"field\" part=\"field\">\n ${this.label\n ? html`\n <label class=\"label\" part=\"label\" data-required=${this.required}>\n ${this.label}\n </label>\n `\n : nothing}\n <div class=\"input-wrapper\" part=\"wrapper\">\n <div class=\"slot slot-start\" part=\"slot-start\">\n <slot name=\"start\"></slot>\n </div>\n <input\n part=\"input\"\n type=\"number\"\n .value=${this.#rawText}\n placeholder=${this.placeholder ?? ''}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n min=${this.min ?? ''}\n max=${this.max ?? ''}\n step=${this.step}\n aria-invalid=${this.invalid ? 'true' : 'false'}\n aria-describedby=${this.describedById ?? ''}\n name=${this.name ?? ''}\n style=\"text-align: ${this.textAlignment}\"\n @input=${this.#handleInput}\n @change=${this.#handleChange}\n @focus=${this.#handleFocus}\n @blur=${this.#handleBlur}\n @keydown=${this.#handleKeydown}\n />\n <div class=\"slot slot-end\" part=\"slot-end\">\n <slot name=\"end\"></slot>\n </div>\n ${this.showStepperButtons\n ? html`\n <div class=\"steppers\" part=\"steppers\">\n <button\n class=\"stepper\"\n part=\"stepper stepper-up\"\n type=\"button\"\n aria-label=\"Increment\"\n ?disabled=${this.disabled || this.readonly ||\n (this.value !== undefined && this.max !== undefined && this.value >= this.max)}\n @click=${this.#handleStepUp}\n >\n +\n </button>\n <button\n class=\"stepper\"\n part=\"stepper stepper-down\"\n type=\"button\"\n aria-label=\"Decrement\"\n ?disabled=${this.disabled || this.readonly ||\n (this.value !== undefined && this.min !== undefined && this.value <= this.min)}\n @click=${this.#handleStepDown}\n >\n −\n </button>\n </div>\n `\n : nothing}\n </div>\n ${messages.length > 0\n ? html`\n <div class=\"messages\" part=\"messages\">${messages}</div>\n `\n : nothing}\n </div>\n `\n }\n\n #renderMessages() {\n const messages: ReturnType<typeof html>[] = []\n if (this.invalidText) {\n messages.push(\n html`<p class=\"message\" data-tone=\"invalid\" part=\"message-invalid\">\n ${this.invalidText}\n </p>`,\n )\n }\n if (this.warningText) {\n messages.push(\n html`<p class=\"message\" data-tone=\"warning\" part=\"message-warning\">\n ${this.warningText}\n </p>`,\n )\n }\n if (this.infoText) {\n messages.push(\n html`<p class=\"message\" data-tone=\"info\" part=\"message-info\">\n ${this.infoText}\n </p>`,\n )\n }\n if (this.validText) {\n messages.push(\n html`<p class=\"message\" data-tone=\"valid\" part=\"message-valid\">\n ${this.validText}\n </p>`,\n )\n }\n if (this.helperText && messages.length === 0) {\n messages.push(\n html`<p class=\"message\" data-tone=\"helper\" part=\"message-helper\">\n ${this.helperText}\n </p>`,\n )\n }\n return messages\n }\n\n // ── Event handlers ───────────────────────────────────────────\n #handleInput = (event: Event) => {\n const target = event.target as HTMLInputElement\n this.#rawText = target.value\n // Emit the parsed number (or undefined if empty / invalid).\n const parsed = this.#parseNumber(target.value)\n if (this.value === undefined) {\n // Uncontrolled: store internally, do not mutate this.value\n // because the contract is \"controlled by the consumer\".\n this.#syncFormValue()\n this.dispatchEvent(\n new CustomEvent<number | undefined>('sken-input', {\n detail: parsed,\n bubbles: true,\n composed: true,\n }),\n )\n } else {\n this.#syncFormValue()\n this.dispatchEvent(\n new CustomEvent<number | undefined>('sken-input', {\n detail: parsed,\n bubbles: true,\n composed: true,\n }),\n )\n }\n }\n\n #handleChange = (event: Event) => {\n const target = event.target as HTMLInputElement\n const parsed = this.#parseNumber(target.value)\n // Clamp on commit. If the user typed 150 with max=100, we\n // commit 100 and update the input text.\n const clamped = this.#clamp(parsed)\n if (clamped !== parsed) {\n this.#rawText = clamped !== undefined ? String(clamped) : ''\n target.value = this.#rawText\n }\n this.#syncFormValue()\n this.dispatchEvent(\n new CustomEvent<number | undefined>('sken-change', {\n detail: clamped,\n bubbles: true,\n composed: true,\n }),\n )\n }\n\n #handleFocus = (_event: FocusEvent) => {\n this.dispatchEvent(new CustomEvent('sken-focus', { bubbles: true, composed: true }))\n }\n\n #handleBlur = (_event: FocusEvent) => {\n this.dispatchEvent(new CustomEvent('sken-blur', { bubbles: true, composed: true }))\n }\n\n #handleKeydown = (event: KeyboardEvent) => {\n if (this.disabled || this.readonly) return\n // Shift+Arrow and PageUp/PageDown apply a 10x multiplier to\n // the step. This is the standard \"fast forward\" pattern in\n // numeric inputs across Mature DS (iX, Material, AntD). It\n // lets the consumer reach the target faster when the step\n // is small relative to the typical range.\n const multiplier = event.shiftKey || event.key === 'PageUp' || event.key === 'PageDown' ? 10 : 1\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n this.#step(+1, multiplier)\n } else if (event.key === 'ArrowDown') {\n event.preventDefault()\n this.#step(-1, multiplier)\n } else if (event.key === 'PageUp') {\n event.preventDefault()\n this.#step(+1, 10)\n } else if (event.key === 'PageDown') {\n event.preventDefault()\n this.#step(-1, 10)\n } else if (event.key === 'Home' && this.min !== undefined) {\n event.preventDefault()\n this.#commitValue(this.min)\n } else if (event.key === 'End' && this.max !== undefined) {\n event.preventDefault()\n this.#commitValue(this.max)\n } else if (event.key === 'Enter') {\n // Enter fires the change event naturally via the input;\n // no need to do anything here. The contract documents\n // \"Enter commits\" but the browser already does that.\n }\n }\n\n #handleStepUp = () => this.#step(+1)\n #handleStepDown = () => this.#step(-1)\n\n // ── Helpers ───────────────────────────────────────────────────\n /**\n * Increment / decrement the value by `step * multiplier`,\n * clamped at [min, max]. Emits `sken-input` and `sken-change`\n * (we treat the stepper as a commit, not a keystroke). The\n * `multiplier` defaults to 1; the keyboard handler passes 10\n * for Shift+Arrow and PageUp/PageDown (the \"fast forward\"\n * pattern).\n *\n * The current value is read from the rendered <input>, NOT\n * from `this.value`. Reading from the input is robust for\n * both modes:\n * - Controlled: the consumer is async (Vue's reactive update\n * applies on the next tick). By the time the second click\n * arrives, the consumer's `value` prop may still be the\n * pre-click value, but the input's `.value` is already\n * updated by #commitValue from the first click.\n * - Uncontrolled: the primitive owns the value. The input's\n * `.value` is the source of truth; `this.value` is the\n * initial seed and not maintained by the primitive in this\n * mode.\n */\n #step(direction: 1 | -1, multiplier: number = 1) {\n if (this.disabled || this.readonly) return\n const inputEl = this.renderRoot.querySelector('input') as HTMLInputElement | null\n const text = inputEl?.value ?? ''\n const current = text === '' ? (this.value ?? 0) : Number(text)\n if (!Number.isFinite(current)) return\n const next = current + direction * this.step * multiplier\n this.#commitValue(next)\n }\n\n /**\n * Commit a value: clamp, update internal state, emit events.\n * Same path used by the stepper buttons and the keyboard\n * Home / End shortcuts.\n */\n #commitValue(raw: number) {\n const clamped = this.#clamp(raw)\n this.#rawText = clamped !== undefined ? String(clamped) : ''\n // Update the DOM input so the next @input sees the new value\n const inputEl = this.renderRoot.querySelector('input') as HTMLInputElement | null\n if (inputEl) inputEl.value = this.#rawText\n this.#syncFormValue()\n this.dispatchEvent(\n new CustomEvent<number | undefined>('sken-input', {\n detail: clamped,\n bubbles: true,\n composed: true,\n }),\n )\n this.dispatchEvent(\n new CustomEvent<number | undefined>('sken-change', {\n detail: clamped,\n bubbles: true,\n composed: true,\n }),\n )\n }\n\n #clamp(value: number | undefined): number | undefined {\n if (value === undefined || Number.isNaN(value)) return undefined\n let v = value\n if (this.min !== undefined && v < this.min) v = this.min\n if (this.max !== undefined && v > this.max) v = this.max\n return v\n }\n\n #parseNumber(text: string): number | undefined {\n if (text === '' || text === '-') return undefined\n const n = Number(text)\n if (Number.isNaN(n)) return undefined\n return n\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sken-number-input': SkenNumberInput\n }\n}\n"],"mappings":";;;;AAeA,IAAM,IAAe,GAUf,IAA+B,IAGxB,IAAN,cAA8B,EAAW;;EAQtB,KAAA,iBAAA;;CAIxB;CAEA,cAAc;EAirBU,AAhrBtB,MAAM,GAH8B,KAAA,KAAA,MAYqD,KAAA,eAAA,KAAA,GACnC,KAAA,QAAA,KAAA,GACF,KAAA,MAAA,KAAA,GACA,KAAA,MAAA,KAAA,GACX,KAAA,OAAA,GAEzC,KAAA,qBAAA,GAC4C,KAAA,cAAA,KAAA,GACN,KAAA,QAAA,KAAA,GACe,KAAA,WAAA,IACA,KAAA,WAAA,IACA,KAAA,WAAA,IACkB,KAAA,aAAA,KAAA,GACJ,KAAA,WAAA,KAAA,GACM,KAAA,cAAA,KAAA,GACJ,KAAA,YAAA,KAAA,GACI,KAAA,cAAA,KAAA,GACC,KAAA,gBAAA,OACnB,KAAA,OAAA,MACH,KAAA,UAAA,IAC0B,KAAA,gBAAA,KAAA,GACzC,KAAA,OAAA,KAAA,GASpB,KAAA,KAAA,IA4FP,KAAA,KAAA,UAgBgB,KAAA,WAAA;GAC1B,IAAM,IAAU,KAAK,WAAW,cAAc,OAAO,GAC/C,IAAY,KAAK,WAAW,cAAc,WAAW,GACrD,IAAY,KAAK,WAAW,cAAc,WAAW;GACvD,CAAC,KAAW,CAAC,KAEjB,4BAA4B;IAC1B,IAAI,CAAC,EAAQ,aAAa;IAC1B,IAAM,IAAe,KAAa,KAAK,qBACnC,EAAU,sBAAsB,CAAC,CAAC,QAClC,GACE,IAAW,EAAU,sBAAsB,CAAC,CAAC,OAC7C,IAAM,WAAW,iBAAiB,CAAO,CAAC,CAAC,QAAQ,IAAI,IACvD,IAAiB,GAI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