@voidable/ui 0.2.0 → 0.4.0
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/dist/index.d.ts +252 -0
- package/dist/ui.js +1130 -218
- package/package.json +1 -1
package/dist/ui.js
CHANGED
|
@@ -18,7 +18,7 @@ function s(e, t, n, r) {
|
|
|
18
18
|
//#region src/components/badge.ts
|
|
19
19
|
var c = class extends o {
|
|
20
20
|
constructor(...e) {
|
|
21
|
-
super(...e), this.color = "default", this.size = "md";
|
|
21
|
+
super(...e), this.color = "default", this.variant = "filled", this.size = "md";
|
|
22
22
|
}
|
|
23
23
|
connectedCallback() {
|
|
24
24
|
super.connectedCallback(), this.setAttribute("role", "status");
|
|
@@ -30,6 +30,9 @@ s([r({
|
|
|
30
30
|
})], c.prototype, "color", void 0), s([r({
|
|
31
31
|
type: String,
|
|
32
32
|
reflect: !0
|
|
33
|
+
})], c.prototype, "variant", void 0), s([r({
|
|
34
|
+
type: String,
|
|
35
|
+
reflect: !0
|
|
33
36
|
})], c.prototype, "size", void 0), customElements.get("void-badge") || customElements.define("void-badge", c);
|
|
34
37
|
//#endregion
|
|
35
38
|
//#region src/components/button.ts
|
|
@@ -323,7 +326,7 @@ var h = class extends o {
|
|
|
323
326
|
}
|
|
324
327
|
render() {
|
|
325
328
|
let e = Math.min(100, Math.max(0, this.value / this.max * 100));
|
|
326
|
-
return t`<div class="void-progress-track"><div class="void-progress-fill" style="
|
|
329
|
+
return t`<div class="void-progress-track"><div class="void-progress-fill" style="--void-progress-fill: ${this.indeterminate ? "0%" : e + "%"}"></div></div>`;
|
|
327
330
|
}
|
|
328
331
|
};
|
|
329
332
|
s([r({
|
|
@@ -344,7 +347,7 @@ s([r({
|
|
|
344
347
|
})], h.prototype, "indeterminate", void 0), customElements.get("void-progress") || customElements.define("void-progress", h);
|
|
345
348
|
//#endregion
|
|
346
349
|
//#region src/components/panel.ts
|
|
347
|
-
var
|
|
350
|
+
var re = class extends o {
|
|
348
351
|
constructor(...e) {
|
|
349
352
|
super(...e), this.label = "", this.variant = "default", this._userContent = [], this._didSetup = !1;
|
|
350
353
|
}
|
|
@@ -364,13 +367,13 @@ var g = class extends o {
|
|
|
364
367
|
s([r({
|
|
365
368
|
type: String,
|
|
366
369
|
reflect: !0
|
|
367
|
-
})],
|
|
370
|
+
})], re.prototype, "label", void 0), s([r({
|
|
368
371
|
type: String,
|
|
369
372
|
reflect: !0
|
|
370
|
-
})],
|
|
373
|
+
})], re.prototype, "variant", void 0), customElements.get("void-panel") || customElements.define("void-panel", re);
|
|
371
374
|
//#endregion
|
|
372
375
|
//#region src/components/input.ts
|
|
373
|
-
var
|
|
376
|
+
var g = class extends o {
|
|
374
377
|
constructor(...e) {
|
|
375
378
|
super(...e), this.type = "text", this.value = "", this.placeholder = "", this.disabled = !1, this.readonly = !1, this.required = !1, this.name = "", this.size = "md", this.error = "";
|
|
376
379
|
}
|
|
@@ -414,31 +417,31 @@ var _ = class extends o {
|
|
|
414
417
|
s([r({
|
|
415
418
|
type: String,
|
|
416
419
|
reflect: !0
|
|
417
|
-
})],
|
|
420
|
+
})], g.prototype, "type", void 0), s([r({ type: String })], g.prototype, "value", void 0), s([r({
|
|
418
421
|
type: String,
|
|
419
422
|
reflect: !0
|
|
420
|
-
})],
|
|
423
|
+
})], g.prototype, "placeholder", void 0), s([r({
|
|
421
424
|
type: Boolean,
|
|
422
425
|
reflect: !0
|
|
423
|
-
})],
|
|
426
|
+
})], g.prototype, "disabled", void 0), s([r({
|
|
424
427
|
type: Boolean,
|
|
425
428
|
reflect: !0
|
|
426
|
-
})],
|
|
429
|
+
})], g.prototype, "readonly", void 0), s([r({
|
|
427
430
|
type: Boolean,
|
|
428
431
|
reflect: !0
|
|
429
|
-
})],
|
|
432
|
+
})], g.prototype, "required", void 0), s([r({
|
|
430
433
|
type: String,
|
|
431
434
|
reflect: !0
|
|
432
|
-
})],
|
|
435
|
+
})], g.prototype, "name", void 0), s([r({
|
|
433
436
|
type: String,
|
|
434
437
|
reflect: !0
|
|
435
|
-
})],
|
|
438
|
+
})], g.prototype, "size", void 0), s([r({
|
|
436
439
|
type: String,
|
|
437
440
|
reflect: !0
|
|
438
|
-
})],
|
|
441
|
+
})], g.prototype, "error", void 0), customElements.get("void-input") || customElements.define("void-input", g);
|
|
439
442
|
//#endregion
|
|
440
443
|
//#region src/components/textarea.ts
|
|
441
|
-
var
|
|
444
|
+
var _ = class extends o {
|
|
442
445
|
constructor(...e) {
|
|
443
446
|
super(...e), this.value = "", this.placeholder = "", this.disabled = !1, this.readonly = !1, this.required = !1, this.name = "", this.rows = 3, this.resize = "vertical", this.size = "md", this.error = "";
|
|
444
447
|
}
|
|
@@ -455,7 +458,7 @@ var v = class extends o {
|
|
|
455
458
|
?required=${this.required}
|
|
456
459
|
name=${this.name}
|
|
457
460
|
rows=${this.rows}
|
|
458
|
-
style="resize: ${this.resize}"
|
|
461
|
+
style="--void-textarea-resize: ${this.resize}"
|
|
459
462
|
aria-invalid=${this.error ? "true" : "false"}
|
|
460
463
|
@input=${this._onInput}
|
|
461
464
|
@change=${this._onChange}
|
|
@@ -480,37 +483,37 @@ var v = class extends o {
|
|
|
480
483
|
}));
|
|
481
484
|
}
|
|
482
485
|
};
|
|
483
|
-
s([r({ type: String })],
|
|
486
|
+
s([r({ type: String })], _.prototype, "value", void 0), s([r({
|
|
484
487
|
type: String,
|
|
485
488
|
reflect: !0
|
|
486
|
-
})],
|
|
489
|
+
})], _.prototype, "placeholder", void 0), s([r({
|
|
487
490
|
type: Boolean,
|
|
488
491
|
reflect: !0
|
|
489
|
-
})],
|
|
492
|
+
})], _.prototype, "disabled", void 0), s([r({
|
|
490
493
|
type: Boolean,
|
|
491
494
|
reflect: !0
|
|
492
|
-
})],
|
|
495
|
+
})], _.prototype, "readonly", void 0), s([r({
|
|
493
496
|
type: Boolean,
|
|
494
497
|
reflect: !0
|
|
495
|
-
})],
|
|
498
|
+
})], _.prototype, "required", void 0), s([r({
|
|
496
499
|
type: String,
|
|
497
500
|
reflect: !0
|
|
498
|
-
})],
|
|
501
|
+
})], _.prototype, "name", void 0), s([r({
|
|
499
502
|
type: Number,
|
|
500
503
|
reflect: !0
|
|
501
|
-
})],
|
|
504
|
+
})], _.prototype, "rows", void 0), s([r({
|
|
502
505
|
type: String,
|
|
503
506
|
reflect: !0
|
|
504
|
-
})],
|
|
507
|
+
})], _.prototype, "resize", void 0), s([r({
|
|
505
508
|
type: String,
|
|
506
509
|
reflect: !0
|
|
507
|
-
})],
|
|
510
|
+
})], _.prototype, "size", void 0), s([r({
|
|
508
511
|
type: String,
|
|
509
512
|
reflect: !0
|
|
510
|
-
})],
|
|
513
|
+
})], _.prototype, "error", void 0), customElements.get("void-textarea") || customElements.define("void-textarea", _);
|
|
511
514
|
//#endregion
|
|
512
515
|
//#region src/components/select.ts
|
|
513
|
-
var
|
|
516
|
+
var v = class extends o {
|
|
514
517
|
constructor(...e) {
|
|
515
518
|
super(...e), this.value = "", this.disabled = !1, this.required = !1, this.name = "", this.size = "md", this.error = "", this.placeholder = "", this._options = [], this._didSetup = !1;
|
|
516
519
|
}
|
|
@@ -548,28 +551,28 @@ var y = class extends o {
|
|
|
548
551
|
}));
|
|
549
552
|
}
|
|
550
553
|
};
|
|
551
|
-
s([r({ type: String })],
|
|
554
|
+
s([r({ type: String })], v.prototype, "value", void 0), s([r({
|
|
552
555
|
type: Boolean,
|
|
553
556
|
reflect: !0
|
|
554
|
-
})],
|
|
557
|
+
})], v.prototype, "disabled", void 0), s([r({
|
|
555
558
|
type: Boolean,
|
|
556
559
|
reflect: !0
|
|
557
|
-
})],
|
|
560
|
+
})], v.prototype, "required", void 0), s([r({
|
|
558
561
|
type: String,
|
|
559
562
|
reflect: !0
|
|
560
|
-
})],
|
|
563
|
+
})], v.prototype, "name", void 0), s([r({
|
|
561
564
|
type: String,
|
|
562
565
|
reflect: !0
|
|
563
|
-
})],
|
|
566
|
+
})], v.prototype, "size", void 0), s([r({
|
|
564
567
|
type: String,
|
|
565
568
|
reflect: !0
|
|
566
|
-
})],
|
|
569
|
+
})], v.prototype, "error", void 0), s([r({
|
|
567
570
|
type: String,
|
|
568
571
|
reflect: !0
|
|
569
|
-
})],
|
|
572
|
+
})], v.prototype, "placeholder", void 0), customElements.get("void-select") || customElements.define("void-select", v);
|
|
570
573
|
//#endregion
|
|
571
574
|
//#region src/components/checkbox.ts
|
|
572
|
-
var
|
|
575
|
+
var y = class extends o {
|
|
573
576
|
constructor(...e) {
|
|
574
577
|
super(...e), this.checked = !1, this.disabled = !1, this.indeterminate = !1, this.name = "", this.value = "", this.color = "default", this.size = "md", this._userContent = [], this._didSetup = !1, this._handleClick = (e) => {
|
|
575
578
|
if (this.disabled) {
|
|
@@ -603,8 +606,8 @@ var b = class extends o {
|
|
|
603
606
|
return t`
|
|
604
607
|
<input type="checkbox" .checked=${this.checked} .indeterminate=${this.indeterminate} ?disabled=${this.disabled} name=${this.name} value=${this.value} tabindex="-1" aria-hidden="true" />
|
|
605
608
|
<span class="void-checkbox-box">
|
|
606
|
-
${this.checked ? t`<svg viewBox="0 0 12 12" fill="none"><path d="M2.5 6l2.5 2.5 4.5-5" stroke="currentColor" stroke-width="
|
|
607
|
-
${this.indeterminate && !this.checked ? t`<svg viewBox="0 0 12 12" fill="none"><path d="M3 6h6" stroke="currentColor" stroke-width="
|
|
609
|
+
${this.checked ? t`<svg viewBox="0 0 12 12" fill="none"><path d="M2.5 6l2.5 2.5 4.5-5" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/></svg>` : ""}
|
|
610
|
+
${this.indeterminate && !this.checked ? t`<svg viewBox="0 0 12 12" fill="none"><path d="M3 6h6" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round"/></svg>` : ""}
|
|
608
611
|
</span>
|
|
609
612
|
`;
|
|
610
613
|
}
|
|
@@ -612,28 +615,28 @@ var b = class extends o {
|
|
|
612
615
|
s([r({
|
|
613
616
|
type: Boolean,
|
|
614
617
|
reflect: !0
|
|
615
|
-
})],
|
|
618
|
+
})], y.prototype, "checked", void 0), s([r({
|
|
616
619
|
type: Boolean,
|
|
617
620
|
reflect: !0
|
|
618
|
-
})],
|
|
621
|
+
})], y.prototype, "disabled", void 0), s([r({
|
|
619
622
|
type: Boolean,
|
|
620
623
|
reflect: !0
|
|
621
|
-
})],
|
|
624
|
+
})], y.prototype, "indeterminate", void 0), s([r({
|
|
622
625
|
type: String,
|
|
623
626
|
reflect: !0
|
|
624
|
-
})],
|
|
627
|
+
})], y.prototype, "name", void 0), s([r({
|
|
625
628
|
type: String,
|
|
626
629
|
reflect: !0
|
|
627
|
-
})],
|
|
630
|
+
})], y.prototype, "value", void 0), s([r({
|
|
628
631
|
type: String,
|
|
629
632
|
reflect: !0
|
|
630
|
-
})],
|
|
633
|
+
})], y.prototype, "color", void 0), s([r({
|
|
631
634
|
type: String,
|
|
632
635
|
reflect: !0
|
|
633
|
-
})],
|
|
636
|
+
})], y.prototype, "size", void 0), customElements.get("void-checkbox") || customElements.define("void-checkbox", y);
|
|
634
637
|
//#endregion
|
|
635
638
|
//#region src/components/radio.ts
|
|
636
|
-
var
|
|
639
|
+
var b = class extends o {
|
|
637
640
|
constructor(...e) {
|
|
638
641
|
super(...e), this.checked = !1, this.disabled = !1, this.name = "", this.value = "", this.color = "default", this.size = "md", this._userContent = [], this._didSetup = !1, this._handleClick = (e) => {
|
|
639
642
|
if (this.disabled || this.checked) {
|
|
@@ -678,25 +681,25 @@ var x = class extends o {
|
|
|
678
681
|
s([r({
|
|
679
682
|
type: Boolean,
|
|
680
683
|
reflect: !0
|
|
681
|
-
})],
|
|
684
|
+
})], b.prototype, "checked", void 0), s([r({
|
|
682
685
|
type: Boolean,
|
|
683
686
|
reflect: !0
|
|
684
|
-
})],
|
|
687
|
+
})], b.prototype, "disabled", void 0), s([r({
|
|
685
688
|
type: String,
|
|
686
689
|
reflect: !0
|
|
687
|
-
})],
|
|
690
|
+
})], b.prototype, "name", void 0), s([r({
|
|
688
691
|
type: String,
|
|
689
692
|
reflect: !0
|
|
690
|
-
})],
|
|
693
|
+
})], b.prototype, "value", void 0), s([r({
|
|
691
694
|
type: String,
|
|
692
695
|
reflect: !0
|
|
693
|
-
})],
|
|
696
|
+
})], b.prototype, "color", void 0), s([r({
|
|
694
697
|
type: String,
|
|
695
698
|
reflect: !0
|
|
696
|
-
})],
|
|
699
|
+
})], b.prototype, "size", void 0), customElements.get("void-radio") || customElements.define("void-radio", b);
|
|
697
700
|
//#endregion
|
|
698
701
|
//#region src/components/radio-group.ts
|
|
699
|
-
var
|
|
702
|
+
var x = class extends o {
|
|
700
703
|
constructor(...e) {
|
|
701
704
|
super(...e), this.label = "", this.value = "", this.name = "", this.orientation = "vertical", this._userContent = [], this._didSetup = !1, this._handleChildChange = (e) => {
|
|
702
705
|
let t = e.target;
|
|
@@ -741,13 +744,13 @@ var S = class extends o {
|
|
|
741
744
|
`;
|
|
742
745
|
}
|
|
743
746
|
};
|
|
744
|
-
s([r({ type: String })],
|
|
747
|
+
s([r({ type: String })], x.prototype, "label", void 0), s([r({ type: String })], x.prototype, "value", void 0), s([r({ type: String })], x.prototype, "name", void 0), s([r({
|
|
745
748
|
type: String,
|
|
746
749
|
reflect: !0
|
|
747
|
-
})],
|
|
750
|
+
})], x.prototype, "orientation", void 0), customElements.get("void-radio-group") || customElements.define("void-radio-group", x);
|
|
748
751
|
//#endregion
|
|
749
752
|
//#region src/components/field.ts
|
|
750
|
-
var
|
|
753
|
+
var S = class extends o {
|
|
751
754
|
constructor(...e) {
|
|
752
755
|
super(...e), this.label = "", this.error = "", this.helper = "", this.required = !1, this._userContent = [], this._didSetup = !1;
|
|
753
756
|
}
|
|
@@ -772,19 +775,19 @@ var C = class extends o {
|
|
|
772
775
|
s([r({
|
|
773
776
|
type: String,
|
|
774
777
|
reflect: !0
|
|
775
|
-
})],
|
|
778
|
+
})], S.prototype, "label", void 0), s([r({
|
|
776
779
|
type: String,
|
|
777
780
|
reflect: !0
|
|
778
|
-
})],
|
|
781
|
+
})], S.prototype, "error", void 0), s([r({
|
|
779
782
|
type: String,
|
|
780
783
|
reflect: !0
|
|
781
|
-
})],
|
|
784
|
+
})], S.prototype, "helper", void 0), s([r({
|
|
782
785
|
type: Boolean,
|
|
783
786
|
reflect: !0
|
|
784
|
-
})],
|
|
787
|
+
})], S.prototype, "required", void 0), customElements.get("void-field") || customElements.define("void-field", S);
|
|
785
788
|
//#endregion
|
|
786
789
|
//#region src/components/multiselect.ts
|
|
787
|
-
var
|
|
790
|
+
var ie = class extends o {
|
|
788
791
|
constructor(...e) {
|
|
789
792
|
super(...e), this.value = "", this.selected = !1;
|
|
790
793
|
}
|
|
@@ -792,11 +795,11 @@ var w = class extends o {
|
|
|
792
795
|
s([r({
|
|
793
796
|
type: String,
|
|
794
797
|
reflect: !0
|
|
795
|
-
})],
|
|
798
|
+
})], ie.prototype, "value", void 0), s([r({
|
|
796
799
|
type: Boolean,
|
|
797
800
|
reflect: !0
|
|
798
|
-
})],
|
|
799
|
-
var
|
|
801
|
+
})], ie.prototype, "selected", void 0), customElements.get("void-option") || customElements.define("void-option", ie);
|
|
802
|
+
var C = class extends o {
|
|
800
803
|
constructor(...e) {
|
|
801
804
|
super(...e), this.placeholder = "Select...", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this._open = !1, this._options = [], this._didSetup = !1, this._onTriggerClick = (e) => {
|
|
802
805
|
this.disabled || (e.stopPropagation(), this._open = !this._open, this.requestUpdate());
|
|
@@ -856,7 +859,7 @@ var T = class extends o {
|
|
|
856
859
|
}}
|
|
857
860
|
>
|
|
858
861
|
<span class="void-multiselect-checkbox">
|
|
859
|
-
${e.selected ? t`<svg viewBox="0 0 12 12" fill="none"><path d="M2.5 6l2.5 2.5 4.5-5" stroke="currentColor" stroke-width="
|
|
862
|
+
${e.selected ? t`<svg viewBox="0 0 12 12" fill="none"><path d="M2.5 6l2.5 2.5 4.5-5" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/></svg>` : n}
|
|
860
863
|
</span>
|
|
861
864
|
<span class="void-multiselect-option-label">${e.textContent?.trim() || e.value}</span>
|
|
862
865
|
</div>
|
|
@@ -881,22 +884,22 @@ var T = class extends o {
|
|
|
881
884
|
}));
|
|
882
885
|
}
|
|
883
886
|
};
|
|
884
|
-
s([r({ type: String })],
|
|
887
|
+
s([r({ type: String })], C.prototype, "placeholder", void 0), s([r({
|
|
885
888
|
type: Boolean,
|
|
886
889
|
reflect: !0
|
|
887
|
-
})],
|
|
890
|
+
})], C.prototype, "disabled", void 0), s([r({
|
|
888
891
|
type: String,
|
|
889
892
|
reflect: !0
|
|
890
|
-
})],
|
|
893
|
+
})], C.prototype, "size", void 0), s([r({
|
|
891
894
|
type: String,
|
|
892
895
|
reflect: !0
|
|
893
|
-
})],
|
|
896
|
+
})], C.prototype, "error", void 0), s([r({
|
|
894
897
|
type: String,
|
|
895
898
|
reflect: !0
|
|
896
|
-
})],
|
|
899
|
+
})], C.prototype, "name", void 0), customElements.get("void-multiselect") || customElements.define("void-multiselect", C);
|
|
897
900
|
//#endregion
|
|
898
901
|
//#region src/components/dialog.ts
|
|
899
|
-
var
|
|
902
|
+
var w = class extends o {
|
|
900
903
|
constructor(...e) {
|
|
901
904
|
super(...e), this.open = !1, this.heading = "", this.size = "md", this.closable = !0, this._userContent = [], this._didSetup = !1, this._handleKeydown = (e) => {
|
|
902
905
|
e.key === "Escape" && this.closable && this._close();
|
|
@@ -947,13 +950,13 @@ var E = class extends o {
|
|
|
947
950
|
s([r({
|
|
948
951
|
type: Boolean,
|
|
949
952
|
reflect: !0
|
|
950
|
-
})],
|
|
953
|
+
})], w.prototype, "open", void 0), s([r({ type: String })], w.prototype, "heading", void 0), s([r({
|
|
951
954
|
type: String,
|
|
952
955
|
reflect: !0
|
|
953
|
-
})],
|
|
956
|
+
})], w.prototype, "size", void 0), s([r({ type: Boolean })], w.prototype, "closable", void 0), customElements.get("void-dialog") || customElements.define("void-dialog", w);
|
|
954
957
|
//#endregion
|
|
955
958
|
//#region src/components/tabs.ts
|
|
956
|
-
var
|
|
959
|
+
var ae = class extends o {
|
|
957
960
|
constructor(...e) {
|
|
958
961
|
super(...e), this.tab = "", this.label = "", this.active = !1;
|
|
959
962
|
}
|
|
@@ -967,14 +970,14 @@ var D = class extends o {
|
|
|
967
970
|
s([r({
|
|
968
971
|
type: String,
|
|
969
972
|
reflect: !0
|
|
970
|
-
})],
|
|
973
|
+
})], ae.prototype, "tab", void 0), s([r({
|
|
971
974
|
type: String,
|
|
972
975
|
reflect: !0
|
|
973
|
-
})],
|
|
976
|
+
})], ae.prototype, "label", void 0), s([r({
|
|
974
977
|
type: Boolean,
|
|
975
978
|
reflect: !0
|
|
976
|
-
})],
|
|
977
|
-
var
|
|
979
|
+
})], ae.prototype, "active", void 0), customElements.get("void-tab-panel") || customElements.define("void-tab-panel", ae);
|
|
980
|
+
var oe = class extends o {
|
|
978
981
|
constructor(...e) {
|
|
979
982
|
super(...e), this.value = "", this.size = "md", this._panels = [];
|
|
980
983
|
}
|
|
@@ -1017,13 +1020,13 @@ var O = class extends o {
|
|
|
1017
1020
|
e.key === "ArrowRight" ? (e.preventDefault(), n[(t + 1) % n.length].focus()) : e.key === "ArrowLeft" && (e.preventDefault(), n[(t - 1 + n.length) % n.length].focus());
|
|
1018
1021
|
}
|
|
1019
1022
|
};
|
|
1020
|
-
s([r({ type: String })],
|
|
1023
|
+
s([r({ type: String })], oe.prototype, "value", void 0), s([r({
|
|
1021
1024
|
type: String,
|
|
1022
1025
|
reflect: !0
|
|
1023
|
-
})],
|
|
1026
|
+
})], oe.prototype, "size", void 0), customElements.get("void-tabs") || customElements.define("void-tabs", oe);
|
|
1024
1027
|
//#endregion
|
|
1025
1028
|
//#region src/components/accordion.ts
|
|
1026
|
-
var
|
|
1029
|
+
var se = class extends o {
|
|
1027
1030
|
constructor(...e) {
|
|
1028
1031
|
super(...e), this.multiple = !1;
|
|
1029
1032
|
}
|
|
@@ -1031,13 +1034,13 @@ var k = class extends o {
|
|
|
1031
1034
|
s([r({
|
|
1032
1035
|
type: Boolean,
|
|
1033
1036
|
reflect: !0
|
|
1034
|
-
})],
|
|
1035
|
-
var
|
|
1037
|
+
})], se.prototype, "multiple", void 0), customElements.get("void-accordion") || customElements.define("void-accordion", se);
|
|
1038
|
+
var ce = class extends o {
|
|
1036
1039
|
constructor(...e) {
|
|
1037
1040
|
super(...e), this.heading = "", this.open = !1, this._id = Math.random().toString(36).slice(2), this._userContent = [], this._didSetup = !1, this._handleClick = (e) => {
|
|
1038
1041
|
e.preventDefault(), this.open = !this.open;
|
|
1039
1042
|
let t = this.parentElement;
|
|
1040
|
-
if (t instanceof
|
|
1043
|
+
if (t instanceof se && !t.multiple) {
|
|
1041
1044
|
let e = Array.from(t.querySelectorAll("void-accordion-item"));
|
|
1042
1045
|
for (let t of e) t !== this && (t.open = !1);
|
|
1043
1046
|
}
|
|
@@ -1072,7 +1075,7 @@ var A = class extends o {
|
|
|
1072
1075
|
>
|
|
1073
1076
|
${this.heading}
|
|
1074
1077
|
<svg class="void-accordion-chevron" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
1075
|
-
<path d="M6 4l4 4-4 4" stroke="currentColor" stroke-width="
|
|
1078
|
+
<path d="M6 4l4 4-4 4" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1076
1079
|
</svg>
|
|
1077
1080
|
</button>
|
|
1078
1081
|
<div
|
|
@@ -1084,13 +1087,13 @@ var A = class extends o {
|
|
|
1084
1087
|
`;
|
|
1085
1088
|
}
|
|
1086
1089
|
};
|
|
1087
|
-
s([r({ type: String })],
|
|
1090
|
+
s([r({ type: String })], ce.prototype, "heading", void 0), s([r({
|
|
1088
1091
|
type: Boolean,
|
|
1089
1092
|
reflect: !0
|
|
1090
|
-
})],
|
|
1093
|
+
})], ce.prototype, "open", void 0), customElements.get("void-accordion-item") || customElements.define("void-accordion-item", ce);
|
|
1091
1094
|
//#endregion
|
|
1092
1095
|
//#region src/components/breadcrumbs.ts
|
|
1093
|
-
var
|
|
1096
|
+
var le = class extends o {
|
|
1094
1097
|
constructor(...e) {
|
|
1095
1098
|
super(...e), this.separator = "/", this._items = [], this._didSetup = !1;
|
|
1096
1099
|
}
|
|
@@ -1115,10 +1118,10 @@ var re = class extends o {
|
|
|
1115
1118
|
return t`<ol class="void-breadcrumbs-list"></ol>`;
|
|
1116
1119
|
}
|
|
1117
1120
|
};
|
|
1118
|
-
s([r({ type: String })],
|
|
1121
|
+
s([r({ type: String })], le.prototype, "separator", void 0), customElements.get("void-breadcrumbs") || customElements.define("void-breadcrumbs", le);
|
|
1119
1122
|
//#endregion
|
|
1120
1123
|
//#region src/components/list.ts
|
|
1121
|
-
var
|
|
1124
|
+
var ue = class extends o {
|
|
1122
1125
|
constructor(...e) {
|
|
1123
1126
|
super(...e), this.dividers = !1;
|
|
1124
1127
|
}
|
|
@@ -1129,8 +1132,8 @@ var ie = class extends o {
|
|
|
1129
1132
|
s([r({
|
|
1130
1133
|
type: Boolean,
|
|
1131
1134
|
reflect: !0
|
|
1132
|
-
})],
|
|
1133
|
-
var
|
|
1135
|
+
})], ue.prototype, "dividers", void 0), customElements.get("void-list") || customElements.define("void-list", ue);
|
|
1136
|
+
var T = class extends o {
|
|
1134
1137
|
constructor(...e) {
|
|
1135
1138
|
super(...e), this.selected = !1, this.disabled = !1, this.interactive = !1, this._handleClick = () => {
|
|
1136
1139
|
this.disabled || this.dispatchEvent(new CustomEvent("void-click", {
|
|
@@ -1150,16 +1153,16 @@ var j = class extends o {
|
|
|
1150
1153
|
s([r({
|
|
1151
1154
|
type: Boolean,
|
|
1152
1155
|
reflect: !0
|
|
1153
|
-
})],
|
|
1156
|
+
})], T.prototype, "selected", void 0), s([r({
|
|
1154
1157
|
type: Boolean,
|
|
1155
1158
|
reflect: !0
|
|
1156
|
-
})],
|
|
1159
|
+
})], T.prototype, "disabled", void 0), s([r({
|
|
1157
1160
|
type: Boolean,
|
|
1158
1161
|
reflect: !0
|
|
1159
|
-
})],
|
|
1162
|
+
})], T.prototype, "interactive", void 0), customElements.get("void-list-item") || customElements.define("void-list-item", T);
|
|
1160
1163
|
//#endregion
|
|
1161
1164
|
//#region src/components/toast.ts
|
|
1162
|
-
var
|
|
1165
|
+
var E = class extends o {
|
|
1163
1166
|
constructor(...e) {
|
|
1164
1167
|
super(...e), this.color = "default", this.duration = 5e3, this.dismissable = !0, this.heading = "";
|
|
1165
1168
|
}
|
|
@@ -1185,11 +1188,11 @@ var M = class extends o {
|
|
|
1185
1188
|
s([r({
|
|
1186
1189
|
type: String,
|
|
1187
1190
|
reflect: !0
|
|
1188
|
-
})],
|
|
1191
|
+
})], E.prototype, "color", void 0), s([r({ type: Number })], E.prototype, "duration", void 0), s([r({
|
|
1189
1192
|
type: Boolean,
|
|
1190
1193
|
reflect: !0
|
|
1191
|
-
})],
|
|
1192
|
-
var
|
|
1194
|
+
})], E.prototype, "dismissable", void 0), s([r({ type: String })], E.prototype, "heading", void 0), customElements.get("void-toast") || customElements.define("void-toast", E);
|
|
1195
|
+
var de = class extends o {
|
|
1193
1196
|
constructor(...e) {
|
|
1194
1197
|
super(...e), this.position = "bottom-right";
|
|
1195
1198
|
}
|
|
@@ -1206,10 +1209,10 @@ var ae = class extends o {
|
|
|
1206
1209
|
s([r({
|
|
1207
1210
|
type: String,
|
|
1208
1211
|
reflect: !0
|
|
1209
|
-
})],
|
|
1212
|
+
})], de.prototype, "position", void 0), customElements.get("void-toast-container") || customElements.define("void-toast-container", de);
|
|
1210
1213
|
//#endregion
|
|
1211
1214
|
//#region src/components/stepper.ts
|
|
1212
|
-
var
|
|
1215
|
+
var fe = class extends o {
|
|
1213
1216
|
constructor(...e) {
|
|
1214
1217
|
super(...e), this.value = 0, this.steps = "";
|
|
1215
1218
|
}
|
|
@@ -1227,11 +1230,11 @@ var N = class extends o {
|
|
|
1227
1230
|
<span class="void-stepper-circle"
|
|
1228
1231
|
>${i === "completed" ? t`<svg
|
|
1229
1232
|
viewBox="0 0 12 12"
|
|
1230
|
-
width="
|
|
1231
|
-
height="
|
|
1233
|
+
width="1em"
|
|
1234
|
+
height="1em"
|
|
1232
1235
|
fill="none"
|
|
1233
1236
|
stroke="currentColor"
|
|
1234
|
-
stroke-width="
|
|
1237
|
+
stroke-width="var(--void-icon-stroke-width)"
|
|
1235
1238
|
stroke-linecap="round"
|
|
1236
1239
|
stroke-linejoin="round"
|
|
1237
1240
|
>
|
|
@@ -1246,10 +1249,10 @@ var N = class extends o {
|
|
|
1246
1249
|
s([r({
|
|
1247
1250
|
type: Number,
|
|
1248
1251
|
reflect: !0
|
|
1249
|
-
})],
|
|
1252
|
+
})], fe.prototype, "value", void 0), s([r({ reflect: !0 })], fe.prototype, "steps", void 0), customElements.get("void-stepper") || customElements.define("void-stepper", fe);
|
|
1250
1253
|
//#endregion
|
|
1251
1254
|
//#region src/components/drawer.ts
|
|
1252
|
-
var
|
|
1255
|
+
var D = class extends o {
|
|
1253
1256
|
constructor(...e) {
|
|
1254
1257
|
super(...e), this.open = !1, this.side = "right", this.size = "md", this.heading = "", this.closable = !0, this._userContent = [], this._didSetup = !1, this._handleKeydown = (e) => {
|
|
1255
1258
|
e.key === "Escape" && this.open && this.closable && this._close();
|
|
@@ -1294,19 +1297,19 @@ var P = class extends o {
|
|
|
1294
1297
|
s([r({
|
|
1295
1298
|
type: Boolean,
|
|
1296
1299
|
reflect: !0
|
|
1297
|
-
})],
|
|
1300
|
+
})], D.prototype, "open", void 0), s([r({
|
|
1298
1301
|
type: String,
|
|
1299
1302
|
reflect: !0
|
|
1300
|
-
})],
|
|
1303
|
+
})], D.prototype, "side", void 0), s([r({
|
|
1301
1304
|
type: String,
|
|
1302
1305
|
reflect: !0
|
|
1303
|
-
})],
|
|
1306
|
+
})], D.prototype, "size", void 0), s([r({ type: String })], D.prototype, "heading", void 0), s([r({
|
|
1304
1307
|
type: Boolean,
|
|
1305
1308
|
reflect: !0
|
|
1306
|
-
})],
|
|
1309
|
+
})], D.prototype, "closable", void 0), customElements.get("void-drawer") || customElements.define("void-drawer", D);
|
|
1307
1310
|
//#endregion
|
|
1308
1311
|
//#region src/components/card.ts
|
|
1309
|
-
var
|
|
1312
|
+
var O = class extends o {
|
|
1310
1313
|
constructor(...e) {
|
|
1311
1314
|
super(...e), this.heading = "", this.variant = "default", this.padding = "md", this._userContent = [], this._didSetup = !1;
|
|
1312
1315
|
}
|
|
@@ -1324,16 +1327,16 @@ var F = class extends o {
|
|
|
1324
1327
|
return t`${this.heading ? t`<div class="void-card-header"><span class="void-card-heading">${this.heading}</span></div>` : n}<div class="void-card-body"></div>`;
|
|
1325
1328
|
}
|
|
1326
1329
|
};
|
|
1327
|
-
s([r({ type: String })],
|
|
1330
|
+
s([r({ type: String })], O.prototype, "heading", void 0), s([r({
|
|
1328
1331
|
type: String,
|
|
1329
1332
|
reflect: !0
|
|
1330
|
-
})],
|
|
1333
|
+
})], O.prototype, "variant", void 0), s([r({
|
|
1331
1334
|
type: String,
|
|
1332
1335
|
reflect: !0
|
|
1333
|
-
})],
|
|
1336
|
+
})], O.prototype, "padding", void 0), customElements.get("void-card") || customElements.define("void-card", O);
|
|
1334
1337
|
//#endregion
|
|
1335
1338
|
//#region src/components/popover.ts
|
|
1336
|
-
var
|
|
1339
|
+
var k = class extends o {
|
|
1337
1340
|
constructor(...e) {
|
|
1338
1341
|
super(...e), this.open = !1, this.position = "bottom", this.trigger = "click", this._triggerEl = null, this._contentNodes = [], this._didSetup = !1, this._handleTriggerClick = () => {
|
|
1339
1342
|
this.open = !this.open, this.open || this._dispatchClose();
|
|
@@ -1372,16 +1375,16 @@ var I = class extends o {
|
|
|
1372
1375
|
s([r({
|
|
1373
1376
|
type: Boolean,
|
|
1374
1377
|
reflect: !0
|
|
1375
|
-
})],
|
|
1378
|
+
})], k.prototype, "open", void 0), s([r({
|
|
1376
1379
|
type: String,
|
|
1377
1380
|
reflect: !0
|
|
1378
|
-
})],
|
|
1381
|
+
})], k.prototype, "position", void 0), s([r({
|
|
1379
1382
|
type: String,
|
|
1380
1383
|
reflect: !0
|
|
1381
|
-
})],
|
|
1384
|
+
})], k.prototype, "trigger", void 0), customElements.get("void-popover") || customElements.define("void-popover", k);
|
|
1382
1385
|
//#endregion
|
|
1383
1386
|
//#region src/components/tooltip.ts
|
|
1384
|
-
var
|
|
1387
|
+
var A = class extends o {
|
|
1385
1388
|
constructor(...e) {
|
|
1386
1389
|
super(...e), this.text = "", this.position = "top", this.delay = 200, this._visible = !1, this._tooltipId = "void-tooltip-" + Math.random().toString(36).slice(2), this._userContent = [], this._didSetup = !1, this._onMouseEnter = () => {
|
|
1387
1390
|
clearTimeout(this._timerId), this._timerId = setTimeout(() => {
|
|
@@ -1396,7 +1399,7 @@ var L = class extends o {
|
|
|
1396
1399
|
};
|
|
1397
1400
|
}
|
|
1398
1401
|
connectedCallback() {
|
|
1399
|
-
this._userContent = Array.from(this.childNodes), super.connectedCallback(), this.
|
|
1402
|
+
this._userContent = Array.from(this.childNodes), super.connectedCallback(), this.addEventListener("mouseenter", this._onMouseEnter), this.addEventListener("mouseleave", this._onMouseLeave), this.addEventListener("focusin", this._onFocusIn), this.addEventListener("focusout", this._onFocusOut);
|
|
1400
1403
|
}
|
|
1401
1404
|
disconnectedCallback() {
|
|
1402
1405
|
super.disconnectedCallback(), clearTimeout(this._timerId), this.removeEventListener("mouseenter", this._onMouseEnter), this.removeEventListener("mouseleave", this._onMouseLeave), this.removeEventListener("focusin", this._onFocusIn), this.removeEventListener("focusout", this._onFocusOut);
|
|
@@ -1415,13 +1418,13 @@ var L = class extends o {
|
|
|
1415
1418
|
return t`<span id="${this._tooltipId}" class="void-tooltip-bubble" role="tooltip" aria-label=${this.text}>${this.text}</span>`;
|
|
1416
1419
|
}
|
|
1417
1420
|
};
|
|
1418
|
-
s([r({ type: String })],
|
|
1421
|
+
s([r({ type: String })], A.prototype, "text", void 0), s([r({
|
|
1419
1422
|
type: String,
|
|
1420
1423
|
reflect: !0
|
|
1421
|
-
})],
|
|
1424
|
+
})], A.prototype, "position", void 0), s([r({ type: Number })], A.prototype, "delay", void 0), s([a()], A.prototype, "_visible", void 0), customElements.get("void-tooltip") || customElements.define("void-tooltip", A);
|
|
1422
1425
|
//#endregion
|
|
1423
1426
|
//#region src/components/banner.ts
|
|
1424
|
-
var
|
|
1427
|
+
var j = class extends o {
|
|
1425
1428
|
constructor(...e) {
|
|
1426
1429
|
super(...e), this.color = "default", this.dismissable = !1, this.variant = "subtle", this._userContent = [], this._didSetup = !1;
|
|
1427
1430
|
}
|
|
@@ -1447,16 +1450,16 @@ var R = class extends o {
|
|
|
1447
1450
|
s([r({
|
|
1448
1451
|
type: String,
|
|
1449
1452
|
reflect: !0
|
|
1450
|
-
})],
|
|
1453
|
+
})], j.prototype, "color", void 0), s([r({
|
|
1451
1454
|
type: Boolean,
|
|
1452
1455
|
reflect: !0
|
|
1453
|
-
})],
|
|
1456
|
+
})], j.prototype, "dismissable", void 0), s([r({
|
|
1454
1457
|
type: String,
|
|
1455
1458
|
reflect: !0
|
|
1456
|
-
})],
|
|
1459
|
+
})], j.prototype, "variant", void 0), customElements.get("void-banner") || customElements.define("void-banner", j);
|
|
1457
1460
|
//#endregion
|
|
1458
1461
|
//#region src/components/scroll-area.ts
|
|
1459
|
-
var
|
|
1462
|
+
var pe = class extends o {
|
|
1460
1463
|
constructor(...e) {
|
|
1461
1464
|
super(...e), this.maxHeight = "", this.direction = "vertical", this._userContent = [], this._didSetup = !1;
|
|
1462
1465
|
}
|
|
@@ -1469,20 +1472,19 @@ var z = class extends o {
|
|
|
1469
1472
|
let e = this.querySelector(".void-scroll-area-viewport");
|
|
1470
1473
|
for (let t of this._userContent) e.appendChild(t);
|
|
1471
1474
|
}
|
|
1472
|
-
|
|
1473
|
-
t && (t.style.maxHeight = this.maxHeight || "");
|
|
1475
|
+
this.style.setProperty("--void-scroll-area-max-height", this.maxHeight || "");
|
|
1474
1476
|
}
|
|
1475
1477
|
render() {
|
|
1476
1478
|
return t`<div class="void-scroll-area-viewport"></div>`;
|
|
1477
1479
|
}
|
|
1478
1480
|
};
|
|
1479
|
-
s([r({ type: String })],
|
|
1481
|
+
s([r({ type: String })], pe.prototype, "maxHeight", void 0), s([r({
|
|
1480
1482
|
type: String,
|
|
1481
1483
|
reflect: !0
|
|
1482
|
-
})],
|
|
1484
|
+
})], pe.prototype, "direction", void 0), customElements.get("void-scroll-area") || customElements.define("void-scroll-area", pe);
|
|
1483
1485
|
//#endregion
|
|
1484
1486
|
//#region src/components/table.ts
|
|
1485
|
-
var
|
|
1487
|
+
var M = class extends o {
|
|
1486
1488
|
constructor(...e) {
|
|
1487
1489
|
super(...e), this.striped = !1, this.hoverable = !1, this.compact = !1, this.bordered = !1;
|
|
1488
1490
|
}
|
|
@@ -1490,19 +1492,19 @@ var B = class extends o {
|
|
|
1490
1492
|
s([r({
|
|
1491
1493
|
type: Boolean,
|
|
1492
1494
|
reflect: !0
|
|
1493
|
-
})],
|
|
1495
|
+
})], M.prototype, "striped", void 0), s([r({
|
|
1494
1496
|
type: Boolean,
|
|
1495
1497
|
reflect: !0
|
|
1496
|
-
})],
|
|
1498
|
+
})], M.prototype, "hoverable", void 0), s([r({
|
|
1497
1499
|
type: Boolean,
|
|
1498
1500
|
reflect: !0
|
|
1499
|
-
})],
|
|
1501
|
+
})], M.prototype, "compact", void 0), s([r({
|
|
1500
1502
|
type: Boolean,
|
|
1501
1503
|
reflect: !0
|
|
1502
|
-
})],
|
|
1504
|
+
})], M.prototype, "bordered", void 0), customElements.get("void-table") || customElements.define("void-table", M);
|
|
1503
1505
|
//#endregion
|
|
1504
1506
|
//#region src/components/pagination.ts
|
|
1505
|
-
var
|
|
1507
|
+
var N = class extends o {
|
|
1506
1508
|
constructor(...e) {
|
|
1507
1509
|
super(...e), this.total = 1, this.value = 1, this.siblings = 1, this.size = "md";
|
|
1508
1510
|
}
|
|
@@ -1547,16 +1549,16 @@ var V = class extends o {
|
|
|
1547
1549
|
`;
|
|
1548
1550
|
}
|
|
1549
1551
|
};
|
|
1550
|
-
s([r({ type: Number })],
|
|
1552
|
+
s([r({ type: Number })], N.prototype, "total", void 0), s([r({
|
|
1551
1553
|
type: Number,
|
|
1552
1554
|
reflect: !0
|
|
1553
|
-
})],
|
|
1555
|
+
})], N.prototype, "value", void 0), s([r({ type: Number })], N.prototype, "siblings", void 0), s([r({
|
|
1554
1556
|
type: String,
|
|
1555
1557
|
reflect: !0
|
|
1556
|
-
})],
|
|
1558
|
+
})], N.prototype, "size", void 0), customElements.get("void-pagination") || customElements.define("void-pagination", N);
|
|
1557
1559
|
//#endregion
|
|
1558
1560
|
//#region src/components/error-fallback.ts
|
|
1559
|
-
var
|
|
1561
|
+
var P = class extends o {
|
|
1560
1562
|
constructor(...e) {
|
|
1561
1563
|
super(...e), this.heading = "Something went wrong", this.message = "", this.retryable = !1, this.retryLabel = "Try again", this.icon = !0;
|
|
1562
1564
|
}
|
|
@@ -1580,13 +1582,13 @@ var H = class extends o {
|
|
|
1580
1582
|
`;
|
|
1581
1583
|
}
|
|
1582
1584
|
};
|
|
1583
|
-
s([r({ type: String })],
|
|
1585
|
+
s([r({ type: String })], P.prototype, "heading", void 0), s([r({ type: String })], P.prototype, "message", void 0), s([r({
|
|
1584
1586
|
type: Boolean,
|
|
1585
1587
|
reflect: !0
|
|
1586
|
-
})],
|
|
1588
|
+
})], P.prototype, "retryable", void 0), s([r({ type: String })], P.prototype, "retryLabel", void 0), s([r({ type: Boolean })], P.prototype, "icon", void 0), customElements.get("void-error-fallback") || customElements.define("void-error-fallback", P);
|
|
1587
1589
|
//#endregion
|
|
1588
1590
|
//#region src/components/checkbox-group.ts
|
|
1589
|
-
var
|
|
1591
|
+
var me = class extends o {
|
|
1590
1592
|
constructor(...e) {
|
|
1591
1593
|
super(...e), this.label = "", this.orientation = "vertical", this._userContent = [], this._didSetup = !1, this._handleChildChange = (e) => {
|
|
1592
1594
|
let t = e.target;
|
|
@@ -1623,13 +1625,13 @@ var U = class extends o {
|
|
|
1623
1625
|
s([r({
|
|
1624
1626
|
type: String,
|
|
1625
1627
|
reflect: !0
|
|
1626
|
-
})],
|
|
1628
|
+
})], me.prototype, "label", void 0), s([r({
|
|
1627
1629
|
type: String,
|
|
1628
1630
|
reflect: !0
|
|
1629
|
-
})],
|
|
1631
|
+
})], me.prototype, "orientation", void 0), customElements.get("void-checkbox-group") || customElements.define("void-checkbox-group", me);
|
|
1630
1632
|
//#endregion
|
|
1631
1633
|
//#region src/components/combobox.ts
|
|
1632
|
-
var
|
|
1634
|
+
var F = class extends o {
|
|
1633
1635
|
constructor(...e) {
|
|
1634
1636
|
super(...e), this.value = "", this.placeholder = "Search...", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this._open = !1, this._query = "", this._options = [], this._onInputFocus = () => {
|
|
1635
1637
|
this.disabled || (this._open = !0, this._query = "", this.requestUpdate());
|
|
@@ -1698,22 +1700,22 @@ var W = class extends o {
|
|
|
1698
1700
|
}));
|
|
1699
1701
|
}
|
|
1700
1702
|
};
|
|
1701
|
-
s([r({ type: String })],
|
|
1703
|
+
s([r({ type: String })], F.prototype, "value", void 0), s([r({ type: String })], F.prototype, "placeholder", void 0), s([r({
|
|
1702
1704
|
type: Boolean,
|
|
1703
1705
|
reflect: !0
|
|
1704
|
-
})],
|
|
1706
|
+
})], F.prototype, "disabled", void 0), s([r({
|
|
1705
1707
|
type: String,
|
|
1706
1708
|
reflect: !0
|
|
1707
|
-
})],
|
|
1709
|
+
})], F.prototype, "size", void 0), s([r({
|
|
1708
1710
|
type: String,
|
|
1709
1711
|
reflect: !0
|
|
1710
|
-
})],
|
|
1712
|
+
})], F.prototype, "error", void 0), s([r({
|
|
1711
1713
|
type: String,
|
|
1712
1714
|
reflect: !0
|
|
1713
|
-
})],
|
|
1715
|
+
})], F.prototype, "name", void 0), customElements.get("void-combobox") || customElements.define("void-combobox", F);
|
|
1714
1716
|
//#endregion
|
|
1715
1717
|
//#region src/components/slider.ts
|
|
1716
|
-
var
|
|
1718
|
+
var I = class extends o {
|
|
1717
1719
|
constructor(...e) {
|
|
1718
1720
|
super(...e), this.value = 50, this.min = 0, this.max = 100, this.step = 1, this.disabled = !1, this.name = "", this.showValue = !1, this.size = "md";
|
|
1719
1721
|
}
|
|
@@ -1753,7 +1755,7 @@ var G = class extends o {
|
|
|
1753
1755
|
step=${this.step}
|
|
1754
1756
|
?disabled=${this.disabled}
|
|
1755
1757
|
name=${this.name}
|
|
1756
|
-
style="--fill: ${e}%"
|
|
1758
|
+
style="--void-slider-fill: ${e}%"
|
|
1757
1759
|
@input=${this._onInput}
|
|
1758
1760
|
@change=${this._onChange}
|
|
1759
1761
|
/>
|
|
@@ -1761,22 +1763,22 @@ var G = class extends o {
|
|
|
1761
1763
|
`;
|
|
1762
1764
|
}
|
|
1763
1765
|
};
|
|
1764
|
-
s([r({ type: Number })],
|
|
1766
|
+
s([r({ type: Number })], I.prototype, "value", void 0), s([r({ type: Number })], I.prototype, "min", void 0), s([r({ type: Number })], I.prototype, "max", void 0), s([r({ type: Number })], I.prototype, "step", void 0), s([r({
|
|
1765
1767
|
type: Boolean,
|
|
1766
1768
|
reflect: !0
|
|
1767
|
-
})],
|
|
1769
|
+
})], I.prototype, "disabled", void 0), s([r({
|
|
1768
1770
|
type: String,
|
|
1769
1771
|
reflect: !0
|
|
1770
|
-
})],
|
|
1772
|
+
})], I.prototype, "name", void 0), s([r({
|
|
1771
1773
|
type: Boolean,
|
|
1772
1774
|
reflect: !0
|
|
1773
|
-
})],
|
|
1775
|
+
})], I.prototype, "showValue", void 0), s([r({
|
|
1774
1776
|
type: String,
|
|
1775
1777
|
reflect: !0
|
|
1776
|
-
})],
|
|
1778
|
+
})], I.prototype, "size", void 0), customElements.get("void-slider") || customElements.define("void-slider", I);
|
|
1777
1779
|
//#endregion
|
|
1778
1780
|
//#region src/components/file-upload.ts
|
|
1779
|
-
var
|
|
1781
|
+
var L = class extends o {
|
|
1780
1782
|
constructor(...e) {
|
|
1781
1783
|
super(...e), this.accept = "", this.multiple = !1, this.disabled = !1, this.maxSize = 0, this.error = "", this._files = [], this._onDropzoneClick = () => {
|
|
1782
1784
|
this.disabled || this._input?.click();
|
|
@@ -1802,7 +1804,7 @@ var K = class extends o {
|
|
|
1802
1804
|
return t`
|
|
1803
1805
|
<input
|
|
1804
1806
|
type="file"
|
|
1805
|
-
|
|
1807
|
+
class="void-file-upload-input"
|
|
1806
1808
|
accept=${this.accept || n}
|
|
1807
1809
|
?multiple=${this.multiple}
|
|
1808
1810
|
?disabled=${this.disabled}
|
|
@@ -1857,19 +1859,19 @@ var K = class extends o {
|
|
|
1857
1859
|
}));
|
|
1858
1860
|
}
|
|
1859
1861
|
};
|
|
1860
|
-
s([r({ type: String })],
|
|
1862
|
+
s([r({ type: String })], L.prototype, "accept", void 0), s([r({
|
|
1861
1863
|
type: Boolean,
|
|
1862
1864
|
reflect: !0
|
|
1863
|
-
})],
|
|
1865
|
+
})], L.prototype, "multiple", void 0), s([r({
|
|
1864
1866
|
type: Boolean,
|
|
1865
1867
|
reflect: !0
|
|
1866
|
-
})],
|
|
1868
|
+
})], L.prototype, "disabled", void 0), s([r({ type: Number })], L.prototype, "maxSize", void 0), s([r({
|
|
1867
1869
|
type: String,
|
|
1868
1870
|
reflect: !0
|
|
1869
|
-
})],
|
|
1871
|
+
})], L.prototype, "error", void 0), customElements.get("void-file-upload") || customElements.define("void-file-upload", L);
|
|
1870
1872
|
//#endregion
|
|
1871
1873
|
//#region src/components/nav-bar.ts
|
|
1872
|
-
var
|
|
1874
|
+
var R = class extends o {
|
|
1873
1875
|
constructor(...e) {
|
|
1874
1876
|
super(...e), this.sticky = !1, this.bordered = !0, this.variant = "default", this._userContent = [], this._didSetup = !1;
|
|
1875
1877
|
}
|
|
@@ -1890,16 +1892,16 @@ var q = class extends o {
|
|
|
1890
1892
|
s([r({
|
|
1891
1893
|
type: Boolean,
|
|
1892
1894
|
reflect: !0
|
|
1893
|
-
})],
|
|
1895
|
+
})], R.prototype, "sticky", void 0), s([r({
|
|
1894
1896
|
type: Boolean,
|
|
1895
1897
|
reflect: !0
|
|
1896
|
-
})],
|
|
1898
|
+
})], R.prototype, "bordered", void 0), s([r({
|
|
1897
1899
|
type: String,
|
|
1898
1900
|
reflect: !0
|
|
1899
|
-
})],
|
|
1901
|
+
})], R.prototype, "variant", void 0), customElements.get("void-nav-bar") || customElements.define("void-nav-bar", R);
|
|
1900
1902
|
//#endregion
|
|
1901
1903
|
//#region src/components/hamburger.ts
|
|
1902
|
-
var
|
|
1904
|
+
var he = class extends o {
|
|
1903
1905
|
constructor(...e) {
|
|
1904
1906
|
super(...e), this.active = !1, this.size = "md", this._handleClick = () => {
|
|
1905
1907
|
this.active = !this.active, this.dispatchEvent(new CustomEvent("void-toggle", {
|
|
@@ -1933,13 +1935,13 @@ var oe = class extends o {
|
|
|
1933
1935
|
s([r({
|
|
1934
1936
|
type: Boolean,
|
|
1935
1937
|
reflect: !0
|
|
1936
|
-
})],
|
|
1938
|
+
})], he.prototype, "active", void 0), s([r({
|
|
1937
1939
|
type: String,
|
|
1938
1940
|
reflect: !0
|
|
1939
|
-
})],
|
|
1941
|
+
})], he.prototype, "size", void 0), customElements.get("void-hamburger") || customElements.define("void-hamburger", he);
|
|
1940
1942
|
//#endregion
|
|
1941
1943
|
//#region src/components/compose-input.ts
|
|
1942
|
-
var
|
|
1944
|
+
var z = class extends o {
|
|
1943
1945
|
constructor(...e) {
|
|
1944
1946
|
super(...e), this.value = "", this.placeholder = "Type a message...", this.disabled = !1, this.maxlength = 0;
|
|
1945
1947
|
}
|
|
@@ -1964,7 +1966,7 @@ var J = class extends o {
|
|
|
1964
1966
|
aria-label="Send"
|
|
1965
1967
|
>
|
|
1966
1968
|
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1967
|
-
<path d="M2 8L14 8M14 8L9 3M14 8L9 13" stroke="currentColor" stroke-width="
|
|
1969
|
+
<path d="M2 8L14 8M14 8L9 3M14 8L9 13" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1968
1970
|
</svg>
|
|
1969
1971
|
</button>
|
|
1970
1972
|
</div>
|
|
@@ -1972,7 +1974,9 @@ var J = class extends o {
|
|
|
1972
1974
|
}
|
|
1973
1975
|
_onInput(e) {
|
|
1974
1976
|
let t = e.target;
|
|
1975
|
-
this.value = t.value, t.style.height = "auto"
|
|
1977
|
+
this.value = t.value, t.style.height = "auto";
|
|
1978
|
+
let n = t.scrollHeight;
|
|
1979
|
+
t.style.height = "", this.style.setProperty("--void-compose-input-height", `${n}px`), this.dispatchEvent(new CustomEvent("void-input", {
|
|
1976
1980
|
bubbles: !0,
|
|
1977
1981
|
composed: !0,
|
|
1978
1982
|
detail: { value: this.value }
|
|
@@ -1984,28 +1988,28 @@ var J = class extends o {
|
|
|
1984
1988
|
_onSend() {
|
|
1985
1989
|
if (this.disabled || !this.value) return;
|
|
1986
1990
|
let e = this.value;
|
|
1987
|
-
this.value = "", this._textarea && (this._textarea.style.height = "
|
|
1991
|
+
this.value = "", this._textarea && (this._textarea.style.height = "", this.style.removeProperty("--void-compose-input-height")), this.dispatchEvent(new CustomEvent("void-submit", {
|
|
1988
1992
|
bubbles: !0,
|
|
1989
1993
|
composed: !0,
|
|
1990
1994
|
detail: { value: e }
|
|
1991
1995
|
}));
|
|
1992
1996
|
}
|
|
1993
1997
|
};
|
|
1994
|
-
s([r({ type: String })],
|
|
1998
|
+
s([r({ type: String })], z.prototype, "value", void 0), s([r({
|
|
1995
1999
|
type: String,
|
|
1996
2000
|
reflect: !0
|
|
1997
|
-
})],
|
|
2001
|
+
})], z.prototype, "placeholder", void 0), s([r({
|
|
1998
2002
|
type: Boolean,
|
|
1999
2003
|
reflect: !0
|
|
2000
|
-
})],
|
|
2004
|
+
})], z.prototype, "disabled", void 0), s([r({
|
|
2001
2005
|
type: Number,
|
|
2002
2006
|
reflect: !0
|
|
2003
|
-
})],
|
|
2007
|
+
})], z.prototype, "maxlength", void 0), s([i(".void-compose-input-textarea")], z.prototype, "_textarea", void 0), customElements.get("void-compose-input") || customElements.define("void-compose-input", z);
|
|
2004
2008
|
//#endregion
|
|
2005
2009
|
//#region src/components/sidebar.ts
|
|
2006
|
-
var
|
|
2010
|
+
var B = class extends o {
|
|
2007
2011
|
constructor(...e) {
|
|
2008
|
-
super(...e), this.collapsed = !1, this.width = "
|
|
2012
|
+
super(...e), this.collapsed = !1, this.width = "var(--void-sidebar-width)", this.collapsedWidth = "var(--void-sidebar-collapsed-width)", this.position = "left";
|
|
2009
2013
|
}
|
|
2010
2014
|
connectedCallback() {
|
|
2011
2015
|
super.connectedCallback(), this.setAttribute("role", "navigation"), this.setAttribute("aria-label", "Sidebar navigation"), this._updateWidth();
|
|
@@ -2027,19 +2031,19 @@ var Y = class extends o {
|
|
|
2027
2031
|
s([r({
|
|
2028
2032
|
type: Boolean,
|
|
2029
2033
|
reflect: !0
|
|
2030
|
-
})],
|
|
2034
|
+
})], B.prototype, "collapsed", void 0), s([r({
|
|
2031
2035
|
type: String,
|
|
2032
2036
|
reflect: !0
|
|
2033
|
-
})],
|
|
2037
|
+
})], B.prototype, "width", void 0), s([r({
|
|
2034
2038
|
type: String,
|
|
2035
2039
|
reflect: !0
|
|
2036
|
-
})],
|
|
2040
|
+
})], B.prototype, "collapsedWidth", void 0), s([r({
|
|
2037
2041
|
type: String,
|
|
2038
2042
|
reflect: !0
|
|
2039
|
-
})],
|
|
2043
|
+
})], B.prototype, "position", void 0), customElements.get("void-sidebar") || customElements.define("void-sidebar", B);
|
|
2040
2044
|
//#endregion
|
|
2041
2045
|
//#region src/components/toggle.ts
|
|
2042
|
-
var
|
|
2046
|
+
var V = class extends o {
|
|
2043
2047
|
constructor(...e) {
|
|
2044
2048
|
super(...e), this.pressed = !1, this.disabled = !1, this.color = "default", this.size = "md", this.variant = "outline", this._handleClick = () => {
|
|
2045
2049
|
this.disabled || (this.pressed = !this.pressed, this.dispatchEvent(new CustomEvent("void-change", {
|
|
@@ -2064,22 +2068,98 @@ var X = class extends o {
|
|
|
2064
2068
|
s([r({
|
|
2065
2069
|
type: Boolean,
|
|
2066
2070
|
reflect: !0
|
|
2067
|
-
})],
|
|
2071
|
+
})], V.prototype, "pressed", void 0), s([r({
|
|
2068
2072
|
type: Boolean,
|
|
2069
2073
|
reflect: !0
|
|
2070
|
-
})],
|
|
2074
|
+
})], V.prototype, "disabled", void 0), s([r({
|
|
2071
2075
|
type: String,
|
|
2072
2076
|
reflect: !0
|
|
2073
|
-
})],
|
|
2077
|
+
})], V.prototype, "color", void 0), s([r({
|
|
2074
2078
|
type: String,
|
|
2075
2079
|
reflect: !0
|
|
2076
|
-
})],
|
|
2080
|
+
})], V.prototype, "size", void 0), s([r({
|
|
2077
2081
|
type: String,
|
|
2078
2082
|
reflect: !0
|
|
2079
|
-
})],
|
|
2083
|
+
})], V.prototype, "variant", void 0), customElements.get("void-toggle") || customElements.define("void-toggle", V);
|
|
2084
|
+
//#endregion
|
|
2085
|
+
//#region src/components/toggle-group.ts
|
|
2086
|
+
var H = class extends o {
|
|
2087
|
+
constructor(...e) {
|
|
2088
|
+
super(...e), this.value = "", this.multiple = !1, this.disabled = !1, this.size = "md", this.color = "default", this.orientation = "horizontal", this._handleChildChange = (e) => {
|
|
2089
|
+
let t = e.target.closest("void-toggle");
|
|
2090
|
+
if (!t || t.closest("void-toggle-group") !== this) return;
|
|
2091
|
+
e.stopImmediatePropagation();
|
|
2092
|
+
let n = t.getAttribute("value") || "";
|
|
2093
|
+
if (n) if (this.multiple) {
|
|
2094
|
+
let e = this._selectedValues(), t = e.indexOf(n);
|
|
2095
|
+
t >= 0 ? e.splice(t, 1) : e.push(n), this.value = e.join(","), this._syncToggles(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
2096
|
+
bubbles: !0,
|
|
2097
|
+
composed: !0,
|
|
2098
|
+
detail: { value: e }
|
|
2099
|
+
}));
|
|
2100
|
+
} else {
|
|
2101
|
+
let e = this.value === n ? "" : n;
|
|
2102
|
+
this.value = e, this._syncToggles(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
2103
|
+
bubbles: !0,
|
|
2104
|
+
composed: !0,
|
|
2105
|
+
detail: { value: e }
|
|
2106
|
+
}));
|
|
2107
|
+
}
|
|
2108
|
+
}, this._handleKeydown = (e) => {
|
|
2109
|
+
let t = this._toggles().filter((e) => !e.disabled);
|
|
2110
|
+
if (!t.length) return;
|
|
2111
|
+
let n = this.orientation === "horizontal", r = n ? "ArrowRight" : "ArrowDown", i = n ? "ArrowLeft" : "ArrowUp";
|
|
2112
|
+
if (e.key !== r && e.key !== i) return;
|
|
2113
|
+
e.preventDefault();
|
|
2114
|
+
let a = t.indexOf(e.target), o;
|
|
2115
|
+
o = e.key === r ? a < 0 ? 0 : (a + 1) % t.length : a < 0 ? t.length - 1 : (a - 1 + t.length) % t.length, t[o].focus();
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
connectedCallback() {
|
|
2119
|
+
super.connectedCallback(), this.setAttribute("role", "group"), this.addEventListener("void-change", this._handleChildChange), this.addEventListener("keydown", this._handleKeydown), this._syncToggles();
|
|
2120
|
+
}
|
|
2121
|
+
disconnectedCallback() {
|
|
2122
|
+
super.disconnectedCallback(), this.removeEventListener("void-change", this._handleChildChange), this.removeEventListener("keydown", this._handleKeydown);
|
|
2123
|
+
}
|
|
2124
|
+
updated(e) {
|
|
2125
|
+
(e.has("value") || e.has("disabled") || e.has("size") || e.has("color")) && this._syncToggles();
|
|
2126
|
+
}
|
|
2127
|
+
_toggles() {
|
|
2128
|
+
return Array.from(this.querySelectorAll("void-toggle"));
|
|
2129
|
+
}
|
|
2130
|
+
_selectedValues() {
|
|
2131
|
+
return this.value ? this.value.split(",").map((e) => e.trim()).filter(Boolean) : [];
|
|
2132
|
+
}
|
|
2133
|
+
_syncToggles() {
|
|
2134
|
+
let e = this._selectedValues();
|
|
2135
|
+
for (let t of this._toggles()) {
|
|
2136
|
+
let n = t.getAttribute("value") || "";
|
|
2137
|
+
t.pressed = e.includes(n), this.disabled && (t.disabled = !0), t.size = this.size, this.color !== "default" && (t.color = this.color);
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
};
|
|
2141
|
+
s([r({
|
|
2142
|
+
type: String,
|
|
2143
|
+
reflect: !0
|
|
2144
|
+
})], H.prototype, "value", void 0), s([r({
|
|
2145
|
+
type: Boolean,
|
|
2146
|
+
reflect: !0
|
|
2147
|
+
})], H.prototype, "multiple", void 0), s([r({
|
|
2148
|
+
type: Boolean,
|
|
2149
|
+
reflect: !0
|
|
2150
|
+
})], H.prototype, "disabled", void 0), s([r({
|
|
2151
|
+
type: String,
|
|
2152
|
+
reflect: !0
|
|
2153
|
+
})], H.prototype, "size", void 0), s([r({
|
|
2154
|
+
type: String,
|
|
2155
|
+
reflect: !0
|
|
2156
|
+
})], H.prototype, "color", void 0), s([r({
|
|
2157
|
+
type: String,
|
|
2158
|
+
reflect: !0
|
|
2159
|
+
})], H.prototype, "orientation", void 0), customElements.get("void-toggle-group") || customElements.define("void-toggle-group", H);
|
|
2080
2160
|
//#endregion
|
|
2081
2161
|
//#region src/components/segmented-control.ts
|
|
2082
|
-
var
|
|
2162
|
+
var ge = class extends o {
|
|
2083
2163
|
constructor(...e) {
|
|
2084
2164
|
super(...e), this.value = "", this.disabled = !1;
|
|
2085
2165
|
}
|
|
@@ -2093,11 +2173,11 @@ var se = class extends o {
|
|
|
2093
2173
|
s([r({
|
|
2094
2174
|
type: String,
|
|
2095
2175
|
reflect: !0
|
|
2096
|
-
})],
|
|
2176
|
+
})], ge.prototype, "value", void 0), s([r({
|
|
2097
2177
|
type: Boolean,
|
|
2098
2178
|
reflect: !0
|
|
2099
|
-
})],
|
|
2100
|
-
var
|
|
2179
|
+
})], ge.prototype, "disabled", void 0), customElements.get("void-segmented-control-item") || customElements.define("void-segmented-control-item", ge);
|
|
2180
|
+
var U = class extends o {
|
|
2101
2181
|
constructor(...e) {
|
|
2102
2182
|
super(...e), this.value = "", this.size = "md", this.color = "default", this._handleClick = (e) => {
|
|
2103
2183
|
let t = e.target.closest("void-segmented-control-item");
|
|
@@ -2136,16 +2216,16 @@ var Z = class extends o {
|
|
|
2136
2216
|
s([r({
|
|
2137
2217
|
type: String,
|
|
2138
2218
|
reflect: !0
|
|
2139
|
-
})],
|
|
2219
|
+
})], U.prototype, "value", void 0), s([r({
|
|
2140
2220
|
type: String,
|
|
2141
2221
|
reflect: !0
|
|
2142
|
-
})],
|
|
2222
|
+
})], U.prototype, "size", void 0), s([r({
|
|
2143
2223
|
type: String,
|
|
2144
2224
|
reflect: !0
|
|
2145
|
-
})],
|
|
2225
|
+
})], U.prototype, "color", void 0), customElements.get("void-segmented-control") || customElements.define("void-segmented-control", U);
|
|
2146
2226
|
//#endregion
|
|
2147
2227
|
//#region src/components/stat.ts
|
|
2148
|
-
var
|
|
2228
|
+
var W = class extends o {
|
|
2149
2229
|
constructor(...e) {
|
|
2150
2230
|
super(...e), this.label = "", this.value = "", this.delta = "", this.trend = null, this.color = "default", this.size = "md";
|
|
2151
2231
|
}
|
|
@@ -2163,25 +2243,562 @@ var Q = class extends o {
|
|
|
2163
2243
|
s([r({
|
|
2164
2244
|
type: String,
|
|
2165
2245
|
reflect: !0
|
|
2166
|
-
})],
|
|
2246
|
+
})], W.prototype, "label", void 0), s([r({
|
|
2247
|
+
type: String,
|
|
2248
|
+
reflect: !0
|
|
2249
|
+
})], W.prototype, "value", void 0), s([r({
|
|
2250
|
+
type: String,
|
|
2251
|
+
reflect: !0
|
|
2252
|
+
})], W.prototype, "delta", void 0), s([r({
|
|
2253
|
+
type: String,
|
|
2254
|
+
reflect: !0
|
|
2255
|
+
})], W.prototype, "trend", void 0), s([r({
|
|
2256
|
+
type: String,
|
|
2257
|
+
reflect: !0
|
|
2258
|
+
})], W.prototype, "color", void 0), s([r({
|
|
2259
|
+
type: String,
|
|
2260
|
+
reflect: !0
|
|
2261
|
+
})], W.prototype, "size", void 0), customElements.get("void-stat") || customElements.define("void-stat", W);
|
|
2262
|
+
//#endregion
|
|
2263
|
+
//#region src/components/calendar.ts
|
|
2264
|
+
function G(e) {
|
|
2265
|
+
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
2266
|
+
return t ? [
|
|
2267
|
+
Number(t[1]),
|
|
2268
|
+
Number(t[2]) - 1,
|
|
2269
|
+
Number(t[3])
|
|
2270
|
+
] : null;
|
|
2271
|
+
}
|
|
2272
|
+
function K(e, t, n) {
|
|
2273
|
+
return `${String(e).padStart(4, "0")}-${String(t + 1).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
|
|
2274
|
+
}
|
|
2275
|
+
function _e() {
|
|
2276
|
+
let e = /* @__PURE__ */ new Date();
|
|
2277
|
+
return K(e.getFullYear(), e.getMonth(), e.getDate());
|
|
2278
|
+
}
|
|
2279
|
+
function ve(e, t) {
|
|
2280
|
+
return new Date(e, t + 1, 0).getDate();
|
|
2281
|
+
}
|
|
2282
|
+
function ye(e, t, n) {
|
|
2283
|
+
return t && e < t ? t : n && e > n ? n : e;
|
|
2284
|
+
}
|
|
2285
|
+
function be(e, t) {
|
|
2286
|
+
let n = G(e);
|
|
2287
|
+
if (!n) return e;
|
|
2288
|
+
let [r, i, a] = n;
|
|
2289
|
+
return t.replace("YYYY", String(r).padStart(4, "0")).replace("MM", String(i + 1).padStart(2, "0")).replace("DD", String(a).padStart(2, "0"));
|
|
2290
|
+
}
|
|
2291
|
+
var q = class extends o {
|
|
2292
|
+
constructor(...e) {
|
|
2293
|
+
super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this._viewYear = 0, this._viewMonth = 0, this._view = "days", this._focusDate = "", this._yearsPageStart = 0, this._didInit = !1, this._prevMonth = () => {
|
|
2294
|
+
this._viewMonth === 0 ? (this._viewMonth = 11, this._viewYear--) : this._viewMonth--, this.requestUpdate();
|
|
2295
|
+
}, this._nextMonth = () => {
|
|
2296
|
+
this._viewMonth === 11 ? (this._viewMonth = 0, this._viewYear++) : this._viewMonth++, this.requestUpdate();
|
|
2297
|
+
}, this._prevYear = () => {
|
|
2298
|
+
this._viewYear--, this.requestUpdate();
|
|
2299
|
+
}, this._nextYear = () => {
|
|
2300
|
+
this._viewYear++, this.requestUpdate();
|
|
2301
|
+
}, this._prevYearsPage = () => {
|
|
2302
|
+
this._yearsPageStart -= 12, this.requestUpdate();
|
|
2303
|
+
}, this._nextYearsPage = () => {
|
|
2304
|
+
this._yearsPageStart += 12, this.requestUpdate();
|
|
2305
|
+
}, this._showMonths = () => {
|
|
2306
|
+
this._view = "months", this.requestUpdate();
|
|
2307
|
+
}, this._showYears = () => {
|
|
2308
|
+
this._yearsPageStart = this._viewYear - this._viewYear % 12, this._view = "years", this.requestUpdate();
|
|
2309
|
+
}, this._onDayKeydown = (e) => {
|
|
2310
|
+
if (this.disabled) return;
|
|
2311
|
+
let t = e.target.getAttribute("data-date");
|
|
2312
|
+
if (!t) return;
|
|
2313
|
+
let n = G(t);
|
|
2314
|
+
if (!n) return;
|
|
2315
|
+
let [r, i] = n, a = n[2], o = !0;
|
|
2316
|
+
switch (e.key) {
|
|
2317
|
+
case "ArrowLeft":
|
|
2318
|
+
a--;
|
|
2319
|
+
break;
|
|
2320
|
+
case "ArrowRight":
|
|
2321
|
+
a++;
|
|
2322
|
+
break;
|
|
2323
|
+
case "ArrowUp":
|
|
2324
|
+
a -= 7;
|
|
2325
|
+
break;
|
|
2326
|
+
case "ArrowDown":
|
|
2327
|
+
a += 7;
|
|
2328
|
+
break;
|
|
2329
|
+
case "Enter":
|
|
2330
|
+
case " ":
|
|
2331
|
+
this._selectDate(t), e.preventDefault();
|
|
2332
|
+
return;
|
|
2333
|
+
default: o = !1;
|
|
2334
|
+
}
|
|
2335
|
+
if (!o) return;
|
|
2336
|
+
e.preventDefault();
|
|
2337
|
+
let s = new Date(r, i, a), c = ye(K(s.getFullYear(), s.getMonth(), s.getDate()), this.min || void 0, this.max || void 0);
|
|
2338
|
+
this._focusDate = c;
|
|
2339
|
+
let l = G(c);
|
|
2340
|
+
l && (this._viewYear = l[0], this._viewMonth = l[1]), this.requestUpdate(), this.updateComplete.then(() => {
|
|
2341
|
+
this.querySelector(`[data-date="${c}"]`)?.focus();
|
|
2342
|
+
});
|
|
2343
|
+
};
|
|
2344
|
+
}
|
|
2345
|
+
connectedCallback() {
|
|
2346
|
+
super.connectedCallback(), this.setAttribute("role", "group"), this.setAttribute("aria-label", "Calendar"), this._didInit || (this._didInit = !0, this._initView());
|
|
2347
|
+
}
|
|
2348
|
+
updated(e) {
|
|
2349
|
+
super.updated(e), e.has("value") && this._syncViewToValue();
|
|
2350
|
+
}
|
|
2351
|
+
_initView() {
|
|
2352
|
+
let e = G(this.value);
|
|
2353
|
+
if (e) this._viewYear = e[0], this._viewMonth = e[1], this._focusDate = this.value;
|
|
2354
|
+
else {
|
|
2355
|
+
let e = /* @__PURE__ */ new Date();
|
|
2356
|
+
this._viewYear = e.getFullYear(), this._viewMonth = e.getMonth(), this._focusDate = _e();
|
|
2357
|
+
}
|
|
2358
|
+
this._yearsPageStart = this._viewYear - this._viewYear % 12;
|
|
2359
|
+
}
|
|
2360
|
+
_syncViewToValue() {
|
|
2361
|
+
let e = G(this.value);
|
|
2362
|
+
e && (this._viewYear = e[0], this._viewMonth = e[1], this._focusDate = this.value, this._yearsPageStart = this._viewYear - this._viewYear % 12, this.requestUpdate());
|
|
2363
|
+
}
|
|
2364
|
+
render() {
|
|
2365
|
+
return this._view === "years" ? this._renderYears() : this._view === "months" ? this._renderMonths() : this._renderDays();
|
|
2366
|
+
}
|
|
2367
|
+
_renderDays() {
|
|
2368
|
+
let e = this._getDayNames(), n = this._buildDayCells(), r = this._getMonthName(this._viewMonth);
|
|
2369
|
+
return t`
|
|
2370
|
+
<div class="void-calendar-header">
|
|
2371
|
+
<button
|
|
2372
|
+
class="void-calendar-nav"
|
|
2373
|
+
aria-label="Previous month"
|
|
2374
|
+
?disabled=${this.disabled}
|
|
2375
|
+
@click=${this._prevMonth}
|
|
2376
|
+
>
|
|
2377
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 18 9 12 15 6"></polyline></svg>
|
|
2378
|
+
</button>
|
|
2379
|
+
<button
|
|
2380
|
+
class="void-calendar-title"
|
|
2381
|
+
aria-label="Switch to month picker"
|
|
2382
|
+
?disabled=${this.disabled}
|
|
2383
|
+
@click=${this._showMonths}
|
|
2384
|
+
>${r} ${this._viewYear}</button>
|
|
2385
|
+
<button
|
|
2386
|
+
class="void-calendar-nav"
|
|
2387
|
+
aria-label="Next month"
|
|
2388
|
+
?disabled=${this.disabled}
|
|
2389
|
+
@click=${this._nextMonth}
|
|
2390
|
+
>
|
|
2391
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg>
|
|
2392
|
+
</button>
|
|
2393
|
+
</div>
|
|
2394
|
+
<div class="void-calendar-grid" role="grid" @keydown=${this._onDayKeydown}>
|
|
2395
|
+
<div class="void-calendar-weekdays">
|
|
2396
|
+
${e.map((e) => t`<div class="void-calendar-weekday">${e}</div>`)}
|
|
2397
|
+
</div>
|
|
2398
|
+
<div class="void-calendar-days">
|
|
2399
|
+
${n.map((e) => {
|
|
2400
|
+
let n = e.iso === this.value, r = e.iso === _e(), i = e.outside, a = this.disabled || e.disabled;
|
|
2401
|
+
return t`
|
|
2402
|
+
<button
|
|
2403
|
+
class="void-calendar-day${n ? " selected" : ""}${r ? " today" : ""}${i ? " outside" : ""}"
|
|
2404
|
+
?disabled=${a}
|
|
2405
|
+
aria-selected=${n ? "true" : "false"}
|
|
2406
|
+
aria-label=${e.iso}
|
|
2407
|
+
tabindex=${e.iso === this._focusDate ? "0" : "-1"}
|
|
2408
|
+
data-date=${e.iso}
|
|
2409
|
+
@click=${() => this._selectDate(e.iso)}
|
|
2410
|
+
>${e.day}</button>
|
|
2411
|
+
`;
|
|
2412
|
+
})}
|
|
2413
|
+
</div>
|
|
2414
|
+
</div>
|
|
2415
|
+
`;
|
|
2416
|
+
}
|
|
2417
|
+
_getDayNames() {
|
|
2418
|
+
let e = new Intl.DateTimeFormat(this.locale, { weekday: "short" }), t = [];
|
|
2419
|
+
for (let n = 0; n < 7; n++) {
|
|
2420
|
+
let r = new Date(2024, 0, 7 + (this.firstDay + n) % 7);
|
|
2421
|
+
t.push(e.format(r));
|
|
2422
|
+
}
|
|
2423
|
+
return t;
|
|
2424
|
+
}
|
|
2425
|
+
_getMonthName(e) {
|
|
2426
|
+
return new Intl.DateTimeFormat(this.locale, { month: "long" }).format(new Date(2024, e, 1));
|
|
2427
|
+
}
|
|
2428
|
+
_buildDayCells() {
|
|
2429
|
+
let e = this._viewYear, t = this._viewMonth, n = ve(e, t), r = (new Date(e, t, 1).getDay() - this.firstDay + 7) % 7, i = [], a = t === 0 ? 11 : t - 1, o = t === 0 ? e - 1 : e, s = ve(o, a);
|
|
2430
|
+
for (let e = r - 1; e >= 0; e--) {
|
|
2431
|
+
let t = s - e, n = K(o, a, t);
|
|
2432
|
+
i.push({
|
|
2433
|
+
day: t,
|
|
2434
|
+
iso: n,
|
|
2435
|
+
outside: !0,
|
|
2436
|
+
disabled: this._isOutOfRange(n)
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
for (let r = 1; r <= n; r++) {
|
|
2440
|
+
let n = K(e, t, r);
|
|
2441
|
+
i.push({
|
|
2442
|
+
day: r,
|
|
2443
|
+
iso: n,
|
|
2444
|
+
outside: !1,
|
|
2445
|
+
disabled: this._isOutOfRange(n)
|
|
2446
|
+
});
|
|
2447
|
+
}
|
|
2448
|
+
let c = t === 11 ? 0 : t + 1, l = t === 11 ? e + 1 : e, u = 42 - i.length;
|
|
2449
|
+
for (let e = 1; e <= u; e++) {
|
|
2450
|
+
let t = K(l, c, e);
|
|
2451
|
+
i.push({
|
|
2452
|
+
day: e,
|
|
2453
|
+
iso: t,
|
|
2454
|
+
outside: !0,
|
|
2455
|
+
disabled: this._isOutOfRange(t)
|
|
2456
|
+
});
|
|
2457
|
+
}
|
|
2458
|
+
return i;
|
|
2459
|
+
}
|
|
2460
|
+
_isOutOfRange(e) {
|
|
2461
|
+
return !!(this.min && e < this.min || this.max && e > this.max);
|
|
2462
|
+
}
|
|
2463
|
+
_renderMonths() {
|
|
2464
|
+
let e = new Intl.DateTimeFormat(this.locale, { month: "short" }), n = Array.from({ length: 12 }, (t, n) => ({
|
|
2465
|
+
index: n,
|
|
2466
|
+
name: e.format(new Date(2024, n, 1))
|
|
2467
|
+
}));
|
|
2468
|
+
return t`
|
|
2469
|
+
<div class="void-calendar-header">
|
|
2470
|
+
<button
|
|
2471
|
+
class="void-calendar-nav"
|
|
2472
|
+
aria-label="Previous year"
|
|
2473
|
+
?disabled=${this.disabled}
|
|
2474
|
+
@click=${this._prevYear}
|
|
2475
|
+
>
|
|
2476
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 18 9 12 15 6"></polyline></svg>
|
|
2477
|
+
</button>
|
|
2478
|
+
<button
|
|
2479
|
+
class="void-calendar-title"
|
|
2480
|
+
aria-label="Switch to year picker"
|
|
2481
|
+
?disabled=${this.disabled}
|
|
2482
|
+
@click=${this._showYears}
|
|
2483
|
+
>${this._viewYear}</button>
|
|
2484
|
+
<button
|
|
2485
|
+
class="void-calendar-nav"
|
|
2486
|
+
aria-label="Next year"
|
|
2487
|
+
?disabled=${this.disabled}
|
|
2488
|
+
@click=${this._nextYear}
|
|
2489
|
+
>
|
|
2490
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg>
|
|
2491
|
+
</button>
|
|
2492
|
+
</div>
|
|
2493
|
+
<div class="void-calendar-months">
|
|
2494
|
+
${n.map((e) => t`
|
|
2495
|
+
<button
|
|
2496
|
+
class="void-calendar-month${e.index === this._viewMonth && this._viewYear === (/* @__PURE__ */ new Date()).getFullYear() ? " current" : ""}"
|
|
2497
|
+
?disabled=${this.disabled}
|
|
2498
|
+
@click=${() => this._pickMonth(e.index)}
|
|
2499
|
+
>${e.name}</button>
|
|
2500
|
+
`)}
|
|
2501
|
+
</div>
|
|
2502
|
+
`;
|
|
2503
|
+
}
|
|
2504
|
+
_renderYears() {
|
|
2505
|
+
let e = this._yearsPageStart, n = Array.from({ length: 12 }, (t, n) => e + n), r = (/* @__PURE__ */ new Date()).getFullYear();
|
|
2506
|
+
return t`
|
|
2507
|
+
<div class="void-calendar-header">
|
|
2508
|
+
<button
|
|
2509
|
+
class="void-calendar-nav"
|
|
2510
|
+
aria-label="Previous years"
|
|
2511
|
+
?disabled=${this.disabled}
|
|
2512
|
+
@click=${this._prevYearsPage}
|
|
2513
|
+
>
|
|
2514
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 18 9 12 15 6"></polyline></svg>
|
|
2515
|
+
</button>
|
|
2516
|
+
<span class="void-calendar-title void-calendar-title--static">${e} – ${e + 11}</span>
|
|
2517
|
+
<button
|
|
2518
|
+
class="void-calendar-nav"
|
|
2519
|
+
aria-label="Next years"
|
|
2520
|
+
?disabled=${this.disabled}
|
|
2521
|
+
@click=${this._nextYearsPage}
|
|
2522
|
+
>
|
|
2523
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg>
|
|
2524
|
+
</button>
|
|
2525
|
+
</div>
|
|
2526
|
+
<div class="void-calendar-years">
|
|
2527
|
+
${n.map((e) => t`
|
|
2528
|
+
<button
|
|
2529
|
+
class="void-calendar-year${e === r ? " current" : ""}"
|
|
2530
|
+
?disabled=${this.disabled}
|
|
2531
|
+
@click=${() => this._pickYear(e)}
|
|
2532
|
+
>${e}</button>
|
|
2533
|
+
`)}
|
|
2534
|
+
</div>
|
|
2535
|
+
`;
|
|
2536
|
+
}
|
|
2537
|
+
_pickMonth(e) {
|
|
2538
|
+
this._viewMonth = e, this._view = "days", this.requestUpdate();
|
|
2539
|
+
}
|
|
2540
|
+
_pickYear(e) {
|
|
2541
|
+
this._viewYear = e, this._yearsPageStart = e - e % 12, this._view = "months", this.requestUpdate();
|
|
2542
|
+
}
|
|
2543
|
+
_selectDate(e) {
|
|
2544
|
+
if (this.disabled || this._isOutOfRange(e)) return;
|
|
2545
|
+
this.value = e, this._focusDate = e;
|
|
2546
|
+
let t = G(e);
|
|
2547
|
+
this._viewYear = t[0], this._viewMonth = t[1], this._view = "days", this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
2548
|
+
bubbles: !0,
|
|
2549
|
+
composed: !0,
|
|
2550
|
+
detail: {
|
|
2551
|
+
value: e,
|
|
2552
|
+
date: new Date(t[0], t[1], t[2])
|
|
2553
|
+
}
|
|
2554
|
+
}));
|
|
2555
|
+
}
|
|
2556
|
+
};
|
|
2557
|
+
s([r({
|
|
2558
|
+
type: String,
|
|
2559
|
+
reflect: !0
|
|
2560
|
+
})], q.prototype, "value", void 0), s([r({ type: String })], q.prototype, "min", void 0), s([r({ type: String })], q.prototype, "max", void 0), s([r({
|
|
2561
|
+
type: Boolean,
|
|
2562
|
+
reflect: !0
|
|
2563
|
+
})], q.prototype, "disabled", void 0), s([r({
|
|
2167
2564
|
type: String,
|
|
2168
2565
|
reflect: !0
|
|
2169
|
-
})],
|
|
2566
|
+
})], q.prototype, "size", void 0), s([r({ type: String })], q.prototype, "locale", void 0), s([r({
|
|
2567
|
+
attribute: "first-day",
|
|
2568
|
+
type: Number
|
|
2569
|
+
})], q.prototype, "firstDay", void 0), customElements.get("void-calendar") || customElements.define("void-calendar", q);
|
|
2570
|
+
var J = class extends o {
|
|
2571
|
+
constructor(...e) {
|
|
2572
|
+
super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this.open = !1, this.placeholder = "Select date", this.format = "MM/DD/YYYY", this.color = "default", this._toggle = () => {
|
|
2573
|
+
this.disabled || (this.open = !this.open, this.requestUpdate());
|
|
2574
|
+
}, this._onCalendarChange = (e) => {
|
|
2575
|
+
e.stopPropagation(), this.value = e.detail.value, this.open = !1, this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
2576
|
+
bubbles: !0,
|
|
2577
|
+
composed: !0,
|
|
2578
|
+
detail: e.detail
|
|
2579
|
+
}));
|
|
2580
|
+
}, this._onDocumentClick = (e) => {
|
|
2581
|
+
this.open && !this.contains(e.target) && (this.open = !1, this.requestUpdate());
|
|
2582
|
+
}, this._onDocumentKeydown = (e) => {
|
|
2583
|
+
e.key === "Escape" && this.open && (this.open = !1, this.requestUpdate());
|
|
2584
|
+
}, this._onInputKeydown = (e) => {
|
|
2585
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._toggle()), e.key === "Escape" && this.open && (this.open = !1, this.requestUpdate());
|
|
2586
|
+
};
|
|
2587
|
+
}
|
|
2588
|
+
connectedCallback() {
|
|
2589
|
+
super.connectedCallback(), this.setAttribute("role", "combobox"), this.setAttribute("aria-haspopup", "dialog"), document.addEventListener("mousedown", this._onDocumentClick), document.addEventListener("keydown", this._onDocumentKeydown);
|
|
2590
|
+
}
|
|
2591
|
+
disconnectedCallback() {
|
|
2592
|
+
super.disconnectedCallback(), document.removeEventListener("mousedown", this._onDocumentClick), document.removeEventListener("keydown", this._onDocumentKeydown);
|
|
2593
|
+
}
|
|
2594
|
+
updated(e) {
|
|
2595
|
+
super.updated(e), this.setAttribute("aria-expanded", String(this.open));
|
|
2596
|
+
}
|
|
2597
|
+
render() {
|
|
2598
|
+
return t`
|
|
2599
|
+
<div class="void-date-picker-anchor">
|
|
2600
|
+
<input
|
|
2601
|
+
class="void-date-picker-input"
|
|
2602
|
+
.value=${this.value ? be(this.value, this.format) : ""}
|
|
2603
|
+
placeholder=${this.placeholder}
|
|
2604
|
+
?disabled=${this.disabled}
|
|
2605
|
+
readonly
|
|
2606
|
+
aria-expanded=${String(this.open)}
|
|
2607
|
+
aria-haspopup="dialog"
|
|
2608
|
+
@click=${this._toggle}
|
|
2609
|
+
@keydown=${this._onInputKeydown}
|
|
2610
|
+
/>
|
|
2611
|
+
<button
|
|
2612
|
+
class="void-date-picker-icon"
|
|
2613
|
+
aria-label="Toggle calendar"
|
|
2614
|
+
?disabled=${this.disabled}
|
|
2615
|
+
tabindex="-1"
|
|
2616
|
+
@click=${this._toggle}
|
|
2617
|
+
>
|
|
2618
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
2619
|
+
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
|
|
2620
|
+
<line x1="16" y1="2" x2="16" y2="6"></line>
|
|
2621
|
+
<line x1="8" y1="2" x2="8" y2="6"></line>
|
|
2622
|
+
<line x1="3" y1="10" x2="21" y2="10"></line>
|
|
2623
|
+
</svg>
|
|
2624
|
+
</button>
|
|
2625
|
+
</div>
|
|
2626
|
+
${this.open ? t`
|
|
2627
|
+
<div class="void-date-picker-dropdown" role="dialog" aria-label="Choose date">
|
|
2628
|
+
<void-calendar
|
|
2629
|
+
value=${this.value}
|
|
2630
|
+
min=${this.min}
|
|
2631
|
+
max=${this.max}
|
|
2632
|
+
?disabled=${this.disabled}
|
|
2633
|
+
size=${this.size}
|
|
2634
|
+
locale=${this.locale}
|
|
2635
|
+
first-day=${this.firstDay}
|
|
2636
|
+
@void-change=${this._onCalendarChange}
|
|
2637
|
+
></void-calendar>
|
|
2638
|
+
</div>
|
|
2639
|
+
` : n}
|
|
2640
|
+
`;
|
|
2641
|
+
}
|
|
2642
|
+
};
|
|
2643
|
+
s([r({
|
|
2644
|
+
type: String,
|
|
2645
|
+
reflect: !0
|
|
2646
|
+
})], J.prototype, "value", void 0), s([r({ type: String })], J.prototype, "min", void 0), s([r({ type: String })], J.prototype, "max", void 0), s([r({
|
|
2647
|
+
type: Boolean,
|
|
2648
|
+
reflect: !0
|
|
2649
|
+
})], J.prototype, "disabled", void 0), s([r({
|
|
2170
2650
|
type: String,
|
|
2171
2651
|
reflect: !0
|
|
2172
|
-
})],
|
|
2652
|
+
})], J.prototype, "size", void 0), s([r({ type: String })], J.prototype, "locale", void 0), s([r({
|
|
2653
|
+
attribute: "first-day",
|
|
2654
|
+
type: Number
|
|
2655
|
+
})], J.prototype, "firstDay", void 0), s([r({
|
|
2656
|
+
type: Boolean,
|
|
2657
|
+
reflect: !0
|
|
2658
|
+
})], J.prototype, "open", void 0), s([r({ type: String })], J.prototype, "placeholder", void 0), s([r({ type: String })], J.prototype, "format", void 0), s([r({
|
|
2173
2659
|
type: String,
|
|
2174
2660
|
reflect: !0
|
|
2175
|
-
})],
|
|
2661
|
+
})], J.prototype, "color", void 0), customElements.get("void-date-picker") || customElements.define("void-date-picker", J);
|
|
2662
|
+
//#endregion
|
|
2663
|
+
//#region src/components/carousel.ts
|
|
2664
|
+
var xe = class extends o {
|
|
2665
|
+
connectedCallback() {
|
|
2666
|
+
super.connectedCallback(), this.setAttribute("role", "group"), this.setAttribute("aria-roledescription", "slide");
|
|
2667
|
+
}
|
|
2668
|
+
};
|
|
2669
|
+
customElements.get("void-carousel-slide") || customElements.define("void-carousel-slide", xe);
|
|
2670
|
+
var Y = class extends o {
|
|
2671
|
+
constructor(...e) {
|
|
2672
|
+
super(...e), this.active = 0, this.loop = !1, this.autoplay = !1, this.interval = 5e3, this.size = "md", this.controls = !0, this.indicators = !0, this.orientation = "horizontal", this._slides = [], this._autoplayTimer = null, this._userContent = [], this._didSetup = !1, this._prev = () => {
|
|
2673
|
+
this._goTo(this.active - 1);
|
|
2674
|
+
}, this._next = () => {
|
|
2675
|
+
this._goTo(this.active + 1);
|
|
2676
|
+
}, this._onMouseEnter = () => {
|
|
2677
|
+
this.autoplay && this._stopAutoplay();
|
|
2678
|
+
}, this._onMouseLeave = () => {
|
|
2679
|
+
this.autoplay && this._startAutoplay();
|
|
2680
|
+
}, this._onKeydown = (e) => {
|
|
2681
|
+
let t = this.orientation === "horizontal", n = t ? "ArrowLeft" : "ArrowUp", r = t ? "ArrowRight" : "ArrowDown";
|
|
2682
|
+
e.key === n ? (e.preventDefault(), this._prev()) : e.key === r && (e.preventDefault(), this._next());
|
|
2683
|
+
};
|
|
2684
|
+
}
|
|
2685
|
+
connectedCallback() {
|
|
2686
|
+
super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes)), this.setAttribute("role", "region"), this.setAttribute("aria-roledescription", "carousel"), this.addEventListener("mouseenter", this._onMouseEnter), this.addEventListener("mouseleave", this._onMouseLeave), this.addEventListener("keydown", this._onKeydown);
|
|
2687
|
+
}
|
|
2688
|
+
disconnectedCallback() {
|
|
2689
|
+
super.disconnectedCallback(), this._stopAutoplay(), this.removeEventListener("mouseenter", this._onMouseEnter), this.removeEventListener("mouseleave", this._onMouseLeave), this.removeEventListener("keydown", this._onKeydown);
|
|
2690
|
+
}
|
|
2691
|
+
updated(e) {
|
|
2692
|
+
super.updated(e);
|
|
2693
|
+
let t = !1;
|
|
2694
|
+
if (!this._didSetup) {
|
|
2695
|
+
this._didSetup = !0;
|
|
2696
|
+
let e = this.querySelector(".void-carousel-track");
|
|
2697
|
+
if (e) for (let t of this._userContent) e.appendChild(t);
|
|
2698
|
+
t = !0;
|
|
2699
|
+
}
|
|
2700
|
+
this._slides = Array.from(this.querySelectorAll("void-carousel-slide")), this._syncSlides(), (e.has("autoplay") || e.has("interval")) && (this._stopAutoplay(), this.autoplay && this._startAutoplay()), this.style.setProperty("--void-carousel-offset", String(this.active)), t && this.requestUpdate();
|
|
2701
|
+
}
|
|
2702
|
+
_syncSlides() {
|
|
2703
|
+
for (let e = 0; e < this._slides.length; e++) {
|
|
2704
|
+
let t = this._slides[e];
|
|
2705
|
+
t.setAttribute("aria-label", `Slide ${e + 1} of ${this._slides.length}`), e === this.active ? t.setAttribute("active", "") : t.removeAttribute("active");
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
_goTo(e) {
|
|
2709
|
+
let t = this._slides.length;
|
|
2710
|
+
if (t === 0) return;
|
|
2711
|
+
let n = this.active;
|
|
2712
|
+
e = this.loop ? (e % t + t) % t : Math.max(0, Math.min(e, t - 1)), e !== n && (this.active = e, this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
2713
|
+
bubbles: !0,
|
|
2714
|
+
composed: !0,
|
|
2715
|
+
detail: {
|
|
2716
|
+
index: this.active,
|
|
2717
|
+
previous: n
|
|
2718
|
+
}
|
|
2719
|
+
})));
|
|
2720
|
+
}
|
|
2721
|
+
_goToSlide(e) {
|
|
2722
|
+
this._goTo(e);
|
|
2723
|
+
}
|
|
2724
|
+
_startAutoplay() {
|
|
2725
|
+
this._autoplayTimer ||= setInterval(() => {
|
|
2726
|
+
this._next();
|
|
2727
|
+
}, this.interval);
|
|
2728
|
+
}
|
|
2729
|
+
_stopAutoplay() {
|
|
2730
|
+
this._autoplayTimer &&= (clearInterval(this._autoplayTimer), null);
|
|
2731
|
+
}
|
|
2732
|
+
render() {
|
|
2733
|
+
let e = this._slides.length, n = !this.loop && this.active === 0, r = !this.loop && this.active === e - 1;
|
|
2734
|
+
return t`
|
|
2735
|
+
<div class="void-carousel-viewport">
|
|
2736
|
+
<div class="void-carousel-track" aria-live="polite"></div>
|
|
2737
|
+
</div>
|
|
2738
|
+
${this.controls ? t`
|
|
2739
|
+
<button
|
|
2740
|
+
class="void-carousel-prev"
|
|
2741
|
+
aria-label="Previous slide"
|
|
2742
|
+
?disabled=${n}
|
|
2743
|
+
@click=${this._prev}
|
|
2744
|
+
>
|
|
2745
|
+
<svg viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
2746
|
+
<path d="M10 4L6 8l4 4" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2747
|
+
</svg>
|
|
2748
|
+
</button>
|
|
2749
|
+
<button
|
|
2750
|
+
class="void-carousel-next"
|
|
2751
|
+
aria-label="Next slide"
|
|
2752
|
+
?disabled=${r}
|
|
2753
|
+
@click=${this._next}
|
|
2754
|
+
>
|
|
2755
|
+
<svg viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
2756
|
+
<path d="M6 4l4 4-4 4" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2757
|
+
</svg>
|
|
2758
|
+
</button>
|
|
2759
|
+
` : ""}
|
|
2760
|
+
${this.indicators ? t`
|
|
2761
|
+
<div class="void-carousel-indicators" role="tablist" aria-label="Slide indicators">
|
|
2762
|
+
${this._slides.map((e, n) => t`
|
|
2763
|
+
<button
|
|
2764
|
+
class="void-carousel-dot"
|
|
2765
|
+
role="tab"
|
|
2766
|
+
aria-selected=${n === this.active ? "true" : "false"}
|
|
2767
|
+
aria-label="Go to slide ${n + 1}"
|
|
2768
|
+
?active=${n === this.active}
|
|
2769
|
+
@click=${() => this._goToSlide(n)}
|
|
2770
|
+
></button>
|
|
2771
|
+
`)}
|
|
2772
|
+
</div>
|
|
2773
|
+
` : ""}
|
|
2774
|
+
`;
|
|
2775
|
+
}
|
|
2776
|
+
};
|
|
2777
|
+
s([r({
|
|
2778
|
+
type: Number,
|
|
2779
|
+
reflect: !0
|
|
2780
|
+
})], Y.prototype, "active", void 0), s([r({
|
|
2781
|
+
type: Boolean,
|
|
2782
|
+
reflect: !0
|
|
2783
|
+
})], Y.prototype, "loop", void 0), s([r({
|
|
2784
|
+
type: Boolean,
|
|
2785
|
+
reflect: !0
|
|
2786
|
+
})], Y.prototype, "autoplay", void 0), s([r({ type: Number })], Y.prototype, "interval", void 0), s([r({
|
|
2176
2787
|
type: String,
|
|
2177
2788
|
reflect: !0
|
|
2178
|
-
})],
|
|
2789
|
+
})], Y.prototype, "size", void 0), s([r({
|
|
2790
|
+
type: Boolean,
|
|
2791
|
+
reflect: !0
|
|
2792
|
+
})], Y.prototype, "controls", void 0), s([r({
|
|
2793
|
+
type: Boolean,
|
|
2794
|
+
reflect: !0
|
|
2795
|
+
})], Y.prototype, "indicators", void 0), s([r({
|
|
2179
2796
|
type: String,
|
|
2180
2797
|
reflect: !0
|
|
2181
|
-
})],
|
|
2798
|
+
})], Y.prototype, "orientation", void 0), customElements.get("void-carousel") || customElements.define("void-carousel", Y);
|
|
2182
2799
|
//#endregion
|
|
2183
2800
|
//#region src/components/dropdown-menu.ts
|
|
2184
|
-
var
|
|
2801
|
+
var Se = class extends o {
|
|
2185
2802
|
constructor(...e) {
|
|
2186
2803
|
super(...e), this.open = !1, this.position = "bottom-start", this._triggerEl = null, this._panel = null, this._handleTriggerClick = () => {
|
|
2187
2804
|
this.open = !this.open;
|
|
@@ -2210,11 +2827,11 @@ var ce = class extends o {
|
|
|
2210
2827
|
s([r({
|
|
2211
2828
|
type: Boolean,
|
|
2212
2829
|
reflect: !0
|
|
2213
|
-
})],
|
|
2830
|
+
})], Se.prototype, "open", void 0), s([r({
|
|
2214
2831
|
type: String,
|
|
2215
2832
|
reflect: !0
|
|
2216
|
-
})],
|
|
2217
|
-
var
|
|
2833
|
+
})], Se.prototype, "position", void 0), customElements.get("void-dropdown-menu") || customElements.define("void-dropdown-menu", Se);
|
|
2834
|
+
var Ce = class extends o {
|
|
2218
2835
|
constructor(...e) {
|
|
2219
2836
|
super(...e), this.disabled = !1, this.destructive = !1, this._handleClick = (e) => {
|
|
2220
2837
|
if (this.disabled) {
|
|
@@ -2243,13 +2860,13 @@ var le = class extends o {
|
|
|
2243
2860
|
s([r({
|
|
2244
2861
|
type: Boolean,
|
|
2245
2862
|
reflect: !0
|
|
2246
|
-
})],
|
|
2863
|
+
})], Ce.prototype, "disabled", void 0), s([r({
|
|
2247
2864
|
type: Boolean,
|
|
2248
2865
|
reflect: !0
|
|
2249
|
-
})],
|
|
2866
|
+
})], Ce.prototype, "destructive", void 0), customElements.get("void-dropdown-menu-item") || customElements.define("void-dropdown-menu-item", Ce);
|
|
2250
2867
|
//#endregion
|
|
2251
2868
|
//#region src/components/indicator.ts
|
|
2252
|
-
var
|
|
2869
|
+
var X = class extends o {
|
|
2253
2870
|
constructor(...e) {
|
|
2254
2871
|
super(...e), this.color = "default", this.position = "top-right", this.count = null, this.ping = !1, this.size = "md";
|
|
2255
2872
|
}
|
|
@@ -2269,18 +2886,313 @@ var $ = class extends o {
|
|
|
2269
2886
|
s([r({
|
|
2270
2887
|
type: String,
|
|
2271
2888
|
reflect: !0
|
|
2272
|
-
})],
|
|
2889
|
+
})], X.prototype, "color", void 0), s([r({
|
|
2273
2890
|
type: String,
|
|
2274
2891
|
reflect: !0
|
|
2275
|
-
})],
|
|
2892
|
+
})], X.prototype, "position", void 0), s([r({
|
|
2276
2893
|
type: Number,
|
|
2277
2894
|
reflect: !0
|
|
2278
|
-
})],
|
|
2895
|
+
})], X.prototype, "count", void 0), s([r({
|
|
2279
2896
|
type: Boolean,
|
|
2280
2897
|
reflect: !0
|
|
2281
|
-
})],
|
|
2898
|
+
})], X.prototype, "ping", void 0), s([r({
|
|
2899
|
+
type: String,
|
|
2900
|
+
reflect: !0
|
|
2901
|
+
})], X.prototype, "size", void 0), customElements.get("void-indicator") || customElements.define("void-indicator", X);
|
|
2902
|
+
//#endregion
|
|
2903
|
+
//#region src/components/menu.ts
|
|
2904
|
+
var Z = class extends o {
|
|
2905
|
+
constructor(...e) {
|
|
2906
|
+
super(...e), this.open = !1, this.searchable = !1, this.size = "md", this.placeholder = "Search...", this._query = "", this._userContent = [], this._didSetup = !1, this._handleKeydown = (e) => {
|
|
2907
|
+
if (this.open) {
|
|
2908
|
+
if (e.key === "Escape") {
|
|
2909
|
+
e.preventDefault(), this.open = !1, this._clearSearch();
|
|
2910
|
+
return;
|
|
2911
|
+
}
|
|
2912
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
2913
|
+
e.preventDefault();
|
|
2914
|
+
let t = Array.from(this.querySelectorAll("void-menu-item:not([disabled]):not([hidden])"));
|
|
2915
|
+
if (!t.length) return;
|
|
2916
|
+
let n = t.indexOf(document.activeElement);
|
|
2917
|
+
e.key === "ArrowDown" ? (t[n + 1] ?? t[0]).focus() : (t[n - 1] ?? t[t.length - 1]).focus();
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
}, this._onSearchInput = (e) => {
|
|
2921
|
+
this._query = e.target.value, this._filterItems();
|
|
2922
|
+
};
|
|
2923
|
+
}
|
|
2924
|
+
connectedCallback() {
|
|
2925
|
+
super.connectedCallback(), this.setAttribute("role", "menu"), this._didSetup || (this._userContent = Array.from(this.childNodes)), document.addEventListener("keydown", this._handleKeydown);
|
|
2926
|
+
}
|
|
2927
|
+
disconnectedCallback() {
|
|
2928
|
+
super.disconnectedCallback(), document.removeEventListener("keydown", this._handleKeydown);
|
|
2929
|
+
}
|
|
2930
|
+
updated(e) {
|
|
2931
|
+
if (super.updated(e), !this._didSetup) {
|
|
2932
|
+
this._didSetup = !0;
|
|
2933
|
+
let e = this.querySelector(".void-menu-list");
|
|
2934
|
+
if (e) for (let t of this._userContent) e.appendChild(t);
|
|
2935
|
+
}
|
|
2936
|
+
e.has("open") && this.open && this.searchable && requestAnimationFrame(() => {
|
|
2937
|
+
this.querySelector(".void-menu-search")?.focus();
|
|
2938
|
+
});
|
|
2939
|
+
}
|
|
2940
|
+
_filterItems() {
|
|
2941
|
+
let e = this._query.toLowerCase();
|
|
2942
|
+
this.querySelectorAll("void-menu-item").forEach((t) => {
|
|
2943
|
+
let n = (t.textContent?.trim() ?? "").toLowerCase(), r = (t.getAttribute("value") ?? "").toLowerCase();
|
|
2944
|
+
!e || n.includes(e) || r.includes(e) ? t.removeAttribute("hidden") : t.setAttribute("hidden", "");
|
|
2945
|
+
}), this.querySelectorAll("void-menu-group").forEach((e) => {
|
|
2946
|
+
e.querySelectorAll("void-menu-item:not([hidden])").length === 0 ? e.setAttribute("hidden", "") : e.removeAttribute("hidden");
|
|
2947
|
+
}), this._updateEmptyState();
|
|
2948
|
+
}
|
|
2949
|
+
_updateEmptyState() {
|
|
2950
|
+
let e = this.querySelector(".void-menu-list");
|
|
2951
|
+
if (!e) return;
|
|
2952
|
+
let t = this.querySelector(".void-menu-empty");
|
|
2953
|
+
this.querySelectorAll("void-menu-item:not([hidden])").length === 0 && this._query ? t || (t = document.createElement("div"), t.className = "void-menu-empty", t.textContent = "No results found", e.appendChild(t)) : t && t.remove();
|
|
2954
|
+
}
|
|
2955
|
+
_clearSearch() {
|
|
2956
|
+
this._query = "";
|
|
2957
|
+
let e = this.querySelector(".void-menu-search");
|
|
2958
|
+
e && (e.value = ""), this.querySelectorAll("void-menu-item[hidden], void-menu-group[hidden]").forEach((e) => {
|
|
2959
|
+
e.removeAttribute("hidden");
|
|
2960
|
+
});
|
|
2961
|
+
let t = this.querySelector(".void-menu-empty");
|
|
2962
|
+
t && t.remove();
|
|
2963
|
+
}
|
|
2964
|
+
render() {
|
|
2965
|
+
return this.open ? t`
|
|
2966
|
+
${this.searchable ? t`
|
|
2967
|
+
<input
|
|
2968
|
+
class="void-menu-search"
|
|
2969
|
+
type="text"
|
|
2970
|
+
placeholder=${this.placeholder}
|
|
2971
|
+
autocomplete="off"
|
|
2972
|
+
@input=${this._onSearchInput}
|
|
2973
|
+
/>
|
|
2974
|
+
` : n}
|
|
2975
|
+
<div class="void-menu-list" role="listbox" aria-label="Menu options"></div>
|
|
2976
|
+
` : n;
|
|
2977
|
+
}
|
|
2978
|
+
};
|
|
2979
|
+
s([r({
|
|
2980
|
+
type: Boolean,
|
|
2981
|
+
reflect: !0
|
|
2982
|
+
})], Z.prototype, "open", void 0), s([r({
|
|
2983
|
+
type: Boolean,
|
|
2984
|
+
reflect: !0
|
|
2985
|
+
})], Z.prototype, "searchable", void 0), s([r({
|
|
2986
|
+
type: String,
|
|
2987
|
+
reflect: !0
|
|
2988
|
+
})], Z.prototype, "size", void 0), s([r({ type: String })], Z.prototype, "placeholder", void 0), customElements.get("void-menu") || customElements.define("void-menu", Z);
|
|
2989
|
+
var Q = class extends o {
|
|
2990
|
+
constructor(...e) {
|
|
2991
|
+
super(...e), this.value = "", this.disabled = !1, this.shortcut = "", this.icon = "", this._originalContent = null, this._handleClick = (e) => {
|
|
2992
|
+
if (this.disabled) {
|
|
2993
|
+
e.stopImmediatePropagation();
|
|
2994
|
+
return;
|
|
2995
|
+
}
|
|
2996
|
+
this.dispatchEvent(new CustomEvent("void-select", {
|
|
2997
|
+
bubbles: !0,
|
|
2998
|
+
composed: !0,
|
|
2999
|
+
detail: { value: this.value }
|
|
3000
|
+
}));
|
|
3001
|
+
}, this._handleKeydown = (e) => {
|
|
3002
|
+
(e.key === "Enter" || e.key === " ") && !this.disabled && (e.preventDefault(), this._handleClick(e));
|
|
3003
|
+
};
|
|
3004
|
+
}
|
|
3005
|
+
connectedCallback() {
|
|
3006
|
+
super.connectedCallback(), this.setAttribute("role", "menuitem"), this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown), this._originalContent === null && (this._originalContent = Array.from(this.childNodes).map((e) => e.cloneNode(!0))), this._buildContent();
|
|
3007
|
+
}
|
|
3008
|
+
disconnectedCallback() {
|
|
3009
|
+
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
|
|
3010
|
+
}
|
|
3011
|
+
updated(e) {
|
|
3012
|
+
e.has("disabled") && (this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.setAttribute("aria-disabled", String(this.disabled)));
|
|
3013
|
+
}
|
|
3014
|
+
_buildContent() {
|
|
3015
|
+
if (!this.icon && !this.shortcut) return;
|
|
3016
|
+
let e = document.createDocumentFragment();
|
|
3017
|
+
if (this.icon) {
|
|
3018
|
+
let t = document.createElement("span");
|
|
3019
|
+
t.className = "void-menu-item-icon", t.textContent = this.icon, e.appendChild(t);
|
|
3020
|
+
}
|
|
3021
|
+
let t = document.createElement("span");
|
|
3022
|
+
if (t.className = "void-menu-item-label", this._originalContent) for (let e of this._originalContent) t.appendChild(e.cloneNode(!0));
|
|
3023
|
+
if (e.appendChild(t), this.shortcut) {
|
|
3024
|
+
let t = document.createElement("span");
|
|
3025
|
+
t.className = "void-menu-item-shortcut", t.textContent = this.shortcut, e.appendChild(t);
|
|
3026
|
+
}
|
|
3027
|
+
this.textContent = "", this.appendChild(e);
|
|
3028
|
+
}
|
|
3029
|
+
};
|
|
3030
|
+
s([r({ type: String })], Q.prototype, "value", void 0), s([r({
|
|
3031
|
+
type: Boolean,
|
|
3032
|
+
reflect: !0
|
|
3033
|
+
})], Q.prototype, "disabled", void 0), s([r({ type: String })], Q.prototype, "shortcut", void 0), s([r({ type: String })], Q.prototype, "icon", void 0), customElements.get("void-menu-item") || customElements.define("void-menu-item", Q);
|
|
3034
|
+
var we = class extends o {
|
|
3035
|
+
constructor(...e) {
|
|
3036
|
+
super(...e), this.label = "", this._userContent = [], this._didSetup = !1;
|
|
3037
|
+
}
|
|
3038
|
+
connectedCallback() {
|
|
3039
|
+
super.connectedCallback(), this.setAttribute("role", "group"), this.label && this.setAttribute("aria-label", this.label), this._didSetup || (this._userContent = Array.from(this.childNodes));
|
|
3040
|
+
}
|
|
3041
|
+
updated(e) {
|
|
3042
|
+
if (super.updated(e), e.has("label") && this.label && this.setAttribute("aria-label", this.label), !this._didSetup) {
|
|
3043
|
+
this._didSetup = !0;
|
|
3044
|
+
let e = this.querySelector(".void-menu-group-items");
|
|
3045
|
+
if (e) for (let t of this._userContent) e.appendChild(t);
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
render() {
|
|
3049
|
+
return t`
|
|
3050
|
+
${this.label ? t`<div class="void-menu-group-label">${this.label}</div>` : n}
|
|
3051
|
+
<div class="void-menu-group-items"></div>
|
|
3052
|
+
`;
|
|
3053
|
+
}
|
|
3054
|
+
};
|
|
3055
|
+
s([r({
|
|
3056
|
+
type: String,
|
|
3057
|
+
reflect: !0
|
|
3058
|
+
})], we.prototype, "label", void 0), customElements.get("void-menu-group") || customElements.define("void-menu-group", we);
|
|
3059
|
+
//#endregion
|
|
3060
|
+
//#region src/components/number-input.ts
|
|
3061
|
+
var $ = class extends o {
|
|
3062
|
+
constructor(...e) {
|
|
3063
|
+
super(...e), this.value = 0, this.min = -Infinity, this.max = Infinity, this.step = 1, this.precision = -1, this.disabled = !1, this.readonly = !1, this.size = "md", this.color = "default", this.placeholder = "", this.controls = "sides", this.label = "", this._pressTimer = null, this._repeatTimer = null, this._repeatInterval = 300, this._repeatCount = 0;
|
|
3064
|
+
}
|
|
3065
|
+
connectedCallback() {
|
|
3066
|
+
super.connectedCallback(), this.setAttribute("role", "spinbutton"), this.label && this.setAttribute("aria-label", this.label), isFinite(this.min) && this.setAttribute("aria-valuemin", String(this.min)), isFinite(this.max) && this.setAttribute("aria-valuemax", String(this.max)), this.setAttribute("aria-valuenow", String(this.value));
|
|
3067
|
+
}
|
|
3068
|
+
updated(e) {
|
|
3069
|
+
e.has("value") && this.setAttribute("aria-valuenow", String(this.value)), e.has("min") && isFinite(this.min) && this.setAttribute("aria-valuemin", String(this.min)), e.has("max") && isFinite(this.max) && this.setAttribute("aria-valuemax", String(this.max)), e.has("label") && this.setAttribute("aria-label", this.label);
|
|
3070
|
+
}
|
|
3071
|
+
disconnectedCallback() {
|
|
3072
|
+
super.disconnectedCallback(), this._stopRepeat();
|
|
3073
|
+
}
|
|
3074
|
+
_clamp(e) {
|
|
3075
|
+
return Math.min(Math.max(e, this.min), this.max);
|
|
3076
|
+
}
|
|
3077
|
+
_format(e) {
|
|
3078
|
+
return this.precision >= 0 ? e.toFixed(this.precision) : String(e);
|
|
3079
|
+
}
|
|
3080
|
+
_commit(e) {
|
|
3081
|
+
let t = this._clamp(e);
|
|
3082
|
+
if (t === this.value) return;
|
|
3083
|
+
let n = this.value;
|
|
3084
|
+
this.value = t, this._input && (this._input.value = this._format(t)), this.dispatchEvent(new CustomEvent("void-change", {
|
|
3085
|
+
bubbles: !0,
|
|
3086
|
+
composed: !0,
|
|
3087
|
+
detail: {
|
|
3088
|
+
value: t,
|
|
3089
|
+
previous: n
|
|
3090
|
+
}
|
|
3091
|
+
}));
|
|
3092
|
+
}
|
|
3093
|
+
_increment() {
|
|
3094
|
+
this.disabled || this.readonly || this._commit(this.value + this.step);
|
|
3095
|
+
}
|
|
3096
|
+
_decrement() {
|
|
3097
|
+
this.disabled || this.readonly || this._commit(this.value - this.step);
|
|
3098
|
+
}
|
|
3099
|
+
_startRepeat(e) {
|
|
3100
|
+
e(), this._pressTimer = setTimeout(() => {
|
|
3101
|
+
this._repeatInterval = 300, this._repeatCount = 0, this._repeatTimer = setInterval(() => {
|
|
3102
|
+
if (e(), this._repeatCount++, this._repeatCount % 5 == 0 && this._repeatInterval > 50) {
|
|
3103
|
+
let t = Math.max(50, Math.floor(this._repeatInterval / 2));
|
|
3104
|
+
t !== this._repeatInterval && (this._repeatInterval = t, clearInterval(this._repeatTimer), this._repeatTimer = setInterval(() => {
|
|
3105
|
+
e(), this._repeatCount++;
|
|
3106
|
+
}, this._repeatInterval));
|
|
3107
|
+
}
|
|
3108
|
+
}, this._repeatInterval);
|
|
3109
|
+
}, 400);
|
|
3110
|
+
}
|
|
3111
|
+
_stopRepeat() {
|
|
3112
|
+
this._pressTimer !== null && (clearTimeout(this._pressTimer), this._pressTimer = null), this._repeatTimer !== null && (clearInterval(this._repeatTimer), this._repeatTimer = null), this._repeatCount = 0;
|
|
3113
|
+
}
|
|
3114
|
+
_onKeydown(e) {
|
|
3115
|
+
this.disabled || this.readonly || (e.key === "ArrowUp" ? (e.preventDefault(), this._increment()) : e.key === "ArrowDown" && (e.preventDefault(), this._decrement()));
|
|
3116
|
+
}
|
|
3117
|
+
_onBlur() {
|
|
3118
|
+
if (!this._input || this.readonly) return;
|
|
3119
|
+
let e = parseFloat(this._input.value);
|
|
3120
|
+
isNaN(e) ? this._input.value = this._format(this.value) : this._commit(e);
|
|
3121
|
+
}
|
|
3122
|
+
_onInputChange() {}
|
|
3123
|
+
render() {
|
|
3124
|
+
let e = t`
|
|
3125
|
+
<button
|
|
3126
|
+
class="void-number-input-btn void-number-input-btn-dec"
|
|
3127
|
+
type="button"
|
|
3128
|
+
?disabled=${this.disabled || this.readonly || this.value <= this.min}
|
|
3129
|
+
aria-label="Decrement"
|
|
3130
|
+
@pointerdown=${(e) => {
|
|
3131
|
+
e.preventDefault(), this._startRepeat(() => this._decrement());
|
|
3132
|
+
}}
|
|
3133
|
+
@pointerup=${() => this._stopRepeat()}
|
|
3134
|
+
@pointerleave=${() => this._stopRepeat()}
|
|
3135
|
+
>
|
|
3136
|
+
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em">
|
|
3137
|
+
<line x1="3" y1="8" x2="13" y2="8"/>
|
|
3138
|
+
</svg>
|
|
3139
|
+
</button>
|
|
3140
|
+
`, n = t`
|
|
3141
|
+
<button
|
|
3142
|
+
class="void-number-input-btn void-number-input-btn-inc"
|
|
3143
|
+
type="button"
|
|
3144
|
+
?disabled=${this.disabled || this.readonly || this.value >= this.max}
|
|
3145
|
+
aria-label="Increment"
|
|
3146
|
+
@pointerdown=${(e) => {
|
|
3147
|
+
e.preventDefault(), this._startRepeat(() => this._increment());
|
|
3148
|
+
}}
|
|
3149
|
+
@pointerup=${() => this._stopRepeat()}
|
|
3150
|
+
@pointerleave=${() => this._stopRepeat()}
|
|
3151
|
+
>
|
|
3152
|
+
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em">
|
|
3153
|
+
<line x1="8" y1="3" x2="8" y2="13"/>
|
|
3154
|
+
<line x1="3" y1="8" x2="13" y2="8"/>
|
|
3155
|
+
</svg>
|
|
3156
|
+
</button>
|
|
3157
|
+
`;
|
|
3158
|
+
return t`
|
|
3159
|
+
${this.controls !== "none" && this.controls !== "right" ? e : ""}
|
|
3160
|
+
<input
|
|
3161
|
+
class="void-number-input-field"
|
|
3162
|
+
type="text"
|
|
3163
|
+
inputmode="numeric"
|
|
3164
|
+
.value=${this._format(this.value)}
|
|
3165
|
+
placeholder=${this.placeholder}
|
|
3166
|
+
?disabled=${this.disabled}
|
|
3167
|
+
?readonly=${this.readonly}
|
|
3168
|
+
aria-label=${this.label || "Number input"}
|
|
3169
|
+
@keydown=${this._onKeydown}
|
|
3170
|
+
@blur=${this._onBlur}
|
|
3171
|
+
@change=${this._onInputChange}
|
|
3172
|
+
/>
|
|
3173
|
+
${this.controls === "right" ? t`<div class="void-number-input-btn-group">${n}${e}</div>` : ""}
|
|
3174
|
+
${this.controls === "sides" ? n : ""}
|
|
3175
|
+
`;
|
|
3176
|
+
}
|
|
3177
|
+
};
|
|
3178
|
+
s([r({
|
|
3179
|
+
type: Number,
|
|
3180
|
+
reflect: !0
|
|
3181
|
+
})], $.prototype, "value", void 0), s([r({ type: Number })], $.prototype, "min", void 0), s([r({ type: Number })], $.prototype, "max", void 0), s([r({ type: Number })], $.prototype, "step", void 0), s([r({ type: Number })], $.prototype, "precision", void 0), s([r({
|
|
3182
|
+
type: Boolean,
|
|
3183
|
+
reflect: !0
|
|
3184
|
+
})], $.prototype, "disabled", void 0), s([r({
|
|
3185
|
+
type: Boolean,
|
|
3186
|
+
reflect: !0
|
|
3187
|
+
})], $.prototype, "readonly", void 0), s([r({
|
|
3188
|
+
type: String,
|
|
3189
|
+
reflect: !0
|
|
3190
|
+
})], $.prototype, "size", void 0), s([r({
|
|
3191
|
+
type: String,
|
|
3192
|
+
reflect: !0
|
|
3193
|
+
})], $.prototype, "color", void 0), s([r({ type: String })], $.prototype, "placeholder", void 0), s([r({
|
|
2282
3194
|
type: String,
|
|
2283
3195
|
reflect: !0
|
|
2284
|
-
})], $.prototype, "
|
|
3196
|
+
})], $.prototype, "controls", void 0), s([r({ type: String })], $.prototype, "label", void 0), s([i(".void-number-input-field")], $.prototype, "_input", void 0), customElements.get("void-number-input") || customElements.define("void-number-input", $);
|
|
2285
3197
|
//#endregion
|
|
2286
|
-
export {
|
|
3198
|
+
export { se as VoidAccordion, ce as VoidAccordionItem, p as VoidAlert, f as VoidAvatar, c as VoidBadge, j as VoidBanner, le as VoidBreadcrumbs, l as VoidButton, q as VoidCalendar, O as VoidCard, Y as VoidCarousel, xe as VoidCarouselSlide, y as VoidCheckbox, me as VoidCheckboxGroup, F as VoidCombobox, z as VoidComposeInput, J as VoidDatePicker, w as VoidDialog, u as VoidDivider, D as VoidDrawer, Se as VoidDropdownMenu, Ce as VoidDropdownMenuItem, o as VoidElement, P as VoidErrorFallback, S as VoidField, L as VoidFileUpload, he as VoidHamburger, X as VoidIndicator, g as VoidInput, ue as VoidList, T as VoidListItem, Z as VoidMenu, we as VoidMenuGroup, Q as VoidMenuItem, C as VoidMultiselect, R as VoidNavBar, $ as VoidNumberInput, ie as VoidOption, N as VoidPagination, re as VoidPanel, k as VoidPopover, h as VoidProgress, b as VoidRadio, x as VoidRadioGroup, pe as VoidScrollArea, U as VoidSegmentedControl, ge as VoidSegmentedControlItem, v as VoidSelect, B as VoidSidebar, te as VoidSkeleton, I as VoidSlider, ee as VoidSpinner, W as VoidStat, ne as VoidStatusDot, fe as VoidStepper, d as VoidSwitch, ae as VoidTabPanel, M as VoidTable, oe as VoidTabs, m as VoidTag, _ as VoidTextarea, E as VoidToast, de as VoidToastContainer, V as VoidToggle, H as VoidToggleGroup, A as VoidTooltip };
|