@editora/ui-core 0.1.12 → 0.1.13
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/README.md +1 -1
- package/dist/alert-dialog.cjs.js +18 -18
- package/dist/alert-dialog.esm.js +130 -117
- package/dist/app-header.cjs.js +22 -2
- package/dist/app-header.esm.js +22 -2
- package/dist/badge.cjs.js +5 -5
- package/dist/badge.esm.js +9 -8
- package/dist/color-picker.cjs.js +4 -4
- package/dist/color-picker.esm.js +39 -31
- package/dist/combobox.cjs.js +21 -21
- package/dist/combobox.esm.js +79 -40
- package/dist/command-palette.cjs.js +1 -1
- package/dist/command-palette.esm.js +2 -2
- package/dist/components/date-time-utils.d.ts +2 -1
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-alert-dialog.d.ts +2 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-app-header.d.ts.map +1 -1
- package/dist/components/ui-badge.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts +4 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts +3 -0
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts +3 -0
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts +3 -0
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts +3 -0
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +3 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts +14 -0
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts +1 -0
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts +1 -0
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-quick-actions.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts +47 -0
- package/dist/components/ui-radio.d.ts.map +1 -0
- package/dist/components/ui-select.d.ts +8 -0
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-selection-popup.d.ts.map +1 -1
- package/dist/components/ui-stepper.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts +3 -0
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/context-menu.cjs.js +2 -2
- package/dist/context-menu.esm.js +2 -2
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.esm.js +2 -2
- package/dist/date-picker.cjs.js +13 -13
- package/dist/date-picker.esm.js +100 -67
- package/dist/date-range-picker.cjs.js +14 -14
- package/dist/date-range-picker.esm.js +98 -65
- package/dist/date-range-time-picker.cjs.js +13 -13
- package/dist/date-range-time-picker.esm.js +76 -45
- package/dist/date-time-picker.cjs.js +13 -13
- package/dist/date-time-picker.esm.js +132 -101
- package/dist/date-time-utils-378ecc21.js +1 -0
- package/dist/{date-time-utils-bdceb7af.mjs → date-time-utils-a8b17ea7.mjs} +128 -102
- package/dist/dialog.cjs.js +29 -20
- package/dist/dialog.esm.js +90 -70
- package/dist/drawer.cjs.js +16 -16
- package/dist/drawer.esm.js +216 -98
- package/dist/floating-toolbar.cjs.js +3 -13
- package/dist/floating-toolbar.esm.js +17 -27
- package/dist/hover-card.cjs.js +1 -1
- package/dist/hover-card.esm.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +246 -244
- package/dist/menu.cjs.js +2 -2
- package/dist/menu.esm.js +118 -110
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +83 -78
- package/dist/{overlayManager-ece06517.js → overlayManager-0eda4e08.js} +1 -1
- package/dist/{overlayManager-86454af7.mjs → overlayManager-5bbd4dc3.mjs} +1 -1
- package/dist/popover.cjs.js +1 -1
- package/dist/popover.esm.js +2 -2
- package/dist/{portal-1cf392ca.mjs → portal-9060f7a6.mjs} +7 -7
- package/dist/portal-d9bae456.js +1 -0
- package/dist/{positioner-fbd61bf1.mjs → positioner-16f3cca1.mjs} +16 -16
- package/dist/positioner-43b1c75a.js +1 -0
- package/dist/positioner.cjs.js +1 -1
- package/dist/positioner.esm.js +1 -1
- package/dist/quick-actions.cjs.js +10 -4
- package/dist/quick-actions.esm.js +27 -21
- package/dist/radio.cjs.js +259 -0
- package/dist/radio.esm.js +455 -0
- package/dist/{runtime-5f282bc8.js → runtime-668914fe.js} +1 -1
- package/dist/{runtime-4ac0107b.mjs → runtime-864efe2f.mjs} +1 -1
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +2 -2
- package/dist/scroll-lock-31da444f.mjs +56 -0
- package/dist/scroll-lock-d7b0df21.js +1 -0
- package/dist/scroll-lock.d.ts.map +1 -1
- package/dist/select.cjs.js +14 -15
- package/dist/select.esm.js +117 -97
- package/dist/selection-popup.cjs.js +4 -7
- package/dist/selection-popup.esm.js +8 -11
- package/dist/split-button.cjs.js +1 -1
- package/dist/split-button.esm.js +2 -2
- package/dist/standalone/radio.d.ts +2 -0
- package/dist/standalone/radio.d.ts.map +1 -0
- package/dist/stepper.cjs.js +19 -50
- package/dist/stepper.esm.js +17 -48
- package/dist/time-field.cjs.js +1 -1
- package/dist/time-field.esm.js +14 -14
- package/dist/time-picker.cjs.js +15 -15
- package/dist/time-picker.esm.js +99 -68
- package/dist/tooltip.cjs.js +1 -1
- package/dist/tooltip.esm.js +1 -1
- package/package.json +2 -2
- package/dist/date-time-utils-5cf58cd0.js +0 -1
- package/dist/portal-d8d7fbca.js +0 -1
- package/dist/positioner-accc6e5f.js +0 -1
- package/dist/scroll-lock-48793569.js +0 -1
- package/dist/scroll-lock-9de6d328.mjs +0 -53
package/dist/alert-dialog.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import { a as L, r as
|
|
3
|
-
const
|
|
1
|
+
import { E as J } from "./ElementBase-909688f3.mjs";
|
|
2
|
+
import { a as L, r as S } from "./scroll-lock-31da444f.mjs";
|
|
3
|
+
const Q = `
|
|
4
4
|
:host {
|
|
5
5
|
display: block;
|
|
6
6
|
color-scheme: light dark;
|
|
@@ -499,53 +499,65 @@ const G = `
|
|
|
499
499
|
border: 1px solid CanvasText;
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
`,
|
|
503
|
-
function
|
|
504
|
-
if (
|
|
502
|
+
`, X = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
503
|
+
function p(e, t) {
|
|
504
|
+
if (e == null)
|
|
505
505
|
return t;
|
|
506
|
-
const
|
|
507
|
-
return
|
|
506
|
+
const i = e.trim().toLowerCase();
|
|
507
|
+
return i !== "false" && i !== "0" && i !== "off";
|
|
508
508
|
}
|
|
509
|
-
function a(
|
|
510
|
-
return String(
|
|
509
|
+
function a(e) {
|
|
510
|
+
return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
511
511
|
}
|
|
512
|
-
function
|
|
513
|
-
return
|
|
512
|
+
function tt(e) {
|
|
513
|
+
return e === "info" || e === "success" || e === "warning" || e === "danger" ? e : "neutral";
|
|
514
514
|
}
|
|
515
|
-
function
|
|
516
|
-
return
|
|
515
|
+
function it(e) {
|
|
516
|
+
return e === "sm" || e === "1" ? "sm" : e === "lg" || e === "3" ? "lg" : "md";
|
|
517
517
|
}
|
|
518
|
-
function
|
|
519
|
-
return
|
|
518
|
+
function et(e) {
|
|
519
|
+
return e === "soft" || e === "outline" || e === "solid" ? e : "surface";
|
|
520
520
|
}
|
|
521
|
-
function
|
|
522
|
-
return
|
|
521
|
+
function rt(e) {
|
|
522
|
+
return e === "none" || e === "high" ? e : "low";
|
|
523
523
|
}
|
|
524
|
-
function
|
|
525
|
-
return
|
|
524
|
+
function st(e) {
|
|
525
|
+
return e === "none" ? "none" : "line";
|
|
526
526
|
}
|
|
527
|
-
function
|
|
528
|
-
if (
|
|
527
|
+
function at(e, t = "var(--base-alert-dialog-radius, var(--ui-radius, 4px))") {
|
|
528
|
+
if (e == null)
|
|
529
529
|
return t;
|
|
530
|
-
const
|
|
531
|
-
return
|
|
530
|
+
const i = e.trim().toLowerCase();
|
|
531
|
+
return i ? i === "full" || i === "pill" ? "999px" : /^-?\d+(\.\d+)?$/.test(i) ? `${i}px` : e : t;
|
|
532
532
|
}
|
|
533
|
-
const
|
|
534
|
-
function
|
|
535
|
-
return
|
|
533
|
+
const ot = /* @__PURE__ */ new Set(["tone", "size", "variant", "elevation", "indicator", "radius"]);
|
|
534
|
+
function nt(e) {
|
|
535
|
+
return e === "success" ? '<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M5 10.2 8.3 13.4 15 6.8"></path></svg>' : e === "warning" ? '<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M10 3.6 17 16.4H3L10 3.6Z"></path><path d="M10 8v3.4"></path><circle cx="10" cy="14.1" r="0.9" fill="currentColor" stroke="none"></circle></svg>' : e === "danger" ? '<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="7.1"></circle><path d="m7.5 7.5 5 5M12.5 7.5l-5 5"></path></svg>' : e === "info" ? '<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="7.1"></circle><path d="M10 13v-3.8"></path><circle cx="10" cy="6.5" r="0.9" fill="currentColor" stroke="none"></circle></svg>' : '<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M6 10h8"></path><circle cx="10" cy="10" r="7.1"></circle></svg>';
|
|
536
536
|
}
|
|
537
537
|
function l() {
|
|
538
538
|
return typeof window < "u" && typeof document < "u";
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function $() {
|
|
541
541
|
if (!l())
|
|
542
542
|
return null;
|
|
543
|
-
const
|
|
544
|
-
return
|
|
543
|
+
const e = document.activeElement;
|
|
544
|
+
return e instanceof HTMLElement ? e : null;
|
|
545
545
|
}
|
|
546
|
-
|
|
546
|
+
function v(e) {
|
|
547
|
+
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => e()) : window.setTimeout(e, 16);
|
|
548
|
+
}
|
|
549
|
+
function h(e) {
|
|
550
|
+
if (e) {
|
|
551
|
+
if (typeof cancelAnimationFrame == "function") {
|
|
552
|
+
cancelAnimationFrame(e);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
window.clearTimeout(e);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
const B = class c extends J {
|
|
547
559
|
constructor() {
|
|
548
|
-
super(), this._lastActive = null, this._active = !1, this._terminalEmitted = !1, this._closeMeta = null, this._uid = Math.random().toString(36).slice(2, 10), this._dialogId = "", this._config = {}, this._inputValue = "", this._checked = !1, this._runtimeError = "", this._activeHeadless = !1, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onFocusIn = this._onFocusIn.bind(this), this._onInput = this._onInput.bind(this), this._dialogId = this._uid;
|
|
560
|
+
super(), this._lastActive = null, this._active = !1, this._terminalEmitted = !1, this._closeMeta = null, this._uid = Math.random().toString(36).slice(2, 10), this._dialogId = "", this._config = {}, this._inputValue = "", this._checked = !1, this._runtimeError = "", this._activeHeadless = !1, this._focusInitialFrame = 0, this._restoreFocusFrame = 0, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onFocusIn = this._onFocusIn.bind(this), this._onInput = this._onInput.bind(this), this._dialogId = this._uid;
|
|
549
561
|
}
|
|
550
562
|
static get observedAttributes() {
|
|
551
563
|
return [
|
|
@@ -579,11 +591,11 @@ const $ = class c extends Z {
|
|
|
579
591
|
super.connectedCallback(), this.root.addEventListener("click", this._onClick), this.root.addEventListener("keydown", this._onKeyDown), this.root.addEventListener("input", this._onInput), this._syncFromAttributes(), this._syncVisualTokens(), this._syncOpenState();
|
|
580
592
|
}
|
|
581
593
|
disconnectedCallback() {
|
|
582
|
-
this.root.removeEventListener("click", this._onClick), this.root.removeEventListener("keydown", this._onKeyDown), this.root.removeEventListener("input", this._onInput), this._active && !this._terminalEmitted && this.close("dismiss", "unmount"), this._deactivate(), super.disconnectedCallback();
|
|
594
|
+
this.root.removeEventListener("click", this._onClick), this.root.removeEventListener("keydown", this._onKeyDown), this.root.removeEventListener("input", this._onInput), this._focusInitialFrame && (h(this._focusInitialFrame), this._focusInitialFrame = 0), this._restoreFocusFrame && (h(this._restoreFocusFrame), this._restoreFocusFrame = 0), this._active && !this._terminalEmitted && this.close("dismiss", "unmount"), this._deactivate(), super.disconnectedCallback();
|
|
583
595
|
}
|
|
584
|
-
attributeChangedCallback(t,
|
|
585
|
-
if (
|
|
586
|
-
if (
|
|
596
|
+
attributeChangedCallback(t, i, r) {
|
|
597
|
+
if (i !== r) {
|
|
598
|
+
if (ot.has(t)) {
|
|
587
599
|
this._syncVisualTokens();
|
|
588
600
|
return;
|
|
589
601
|
}
|
|
@@ -611,25 +623,25 @@ const $ = class c extends Z {
|
|
|
611
623
|
t ? this.setAttribute("headless", "") : this.removeAttribute("headless");
|
|
612
624
|
}
|
|
613
625
|
get dismissible() {
|
|
614
|
-
return
|
|
626
|
+
return p(this.getAttribute("dismissible"), !0);
|
|
615
627
|
}
|
|
616
628
|
set dismissible(t) {
|
|
617
629
|
this.setAttribute("dismissible", String(t));
|
|
618
630
|
}
|
|
619
631
|
get closeOnEsc() {
|
|
620
|
-
return
|
|
632
|
+
return p(this.getAttribute("close-on-esc"), this.dismissible);
|
|
621
633
|
}
|
|
622
634
|
set closeOnEsc(t) {
|
|
623
635
|
this.setAttribute("close-on-esc", String(t));
|
|
624
636
|
}
|
|
625
637
|
get closeOnBackdrop() {
|
|
626
|
-
return
|
|
638
|
+
return p(this.getAttribute("close-on-backdrop"), this.dismissible);
|
|
627
639
|
}
|
|
628
640
|
set closeOnBackdrop(t) {
|
|
629
641
|
this.setAttribute("close-on-backdrop", String(t));
|
|
630
642
|
}
|
|
631
643
|
get lockWhileLoading() {
|
|
632
|
-
return
|
|
644
|
+
return p(this.getAttribute("lock-while-loading"), !0);
|
|
633
645
|
}
|
|
634
646
|
set lockWhileLoading(t) {
|
|
635
647
|
this.setAttribute("lock-while-loading", String(t));
|
|
@@ -641,7 +653,7 @@ const $ = class c extends Z {
|
|
|
641
653
|
this.setAttribute("role", t);
|
|
642
654
|
}
|
|
643
655
|
get tone() {
|
|
644
|
-
return
|
|
656
|
+
return tt(this.getAttribute("tone"));
|
|
645
657
|
}
|
|
646
658
|
set tone(t) {
|
|
647
659
|
if (t === "neutral") {
|
|
@@ -651,7 +663,7 @@ const $ = class c extends Z {
|
|
|
651
663
|
this.setAttribute("tone", t);
|
|
652
664
|
}
|
|
653
665
|
get size() {
|
|
654
|
-
return
|
|
666
|
+
return it(this.getAttribute("size"));
|
|
655
667
|
}
|
|
656
668
|
set size(t) {
|
|
657
669
|
if (t === "md") {
|
|
@@ -661,7 +673,7 @@ const $ = class c extends Z {
|
|
|
661
673
|
this.setAttribute("size", t);
|
|
662
674
|
}
|
|
663
675
|
get variant() {
|
|
664
|
-
return
|
|
676
|
+
return et(this.getAttribute("variant"));
|
|
665
677
|
}
|
|
666
678
|
set variant(t) {
|
|
667
679
|
if (t === "surface") {
|
|
@@ -671,7 +683,7 @@ const $ = class c extends Z {
|
|
|
671
683
|
this.setAttribute("variant", t);
|
|
672
684
|
}
|
|
673
685
|
get elevation() {
|
|
674
|
-
return
|
|
686
|
+
return rt(this.getAttribute("elevation"));
|
|
675
687
|
}
|
|
676
688
|
set elevation(t) {
|
|
677
689
|
if (t === "low") {
|
|
@@ -681,7 +693,7 @@ const $ = class c extends Z {
|
|
|
681
693
|
this.setAttribute("elevation", t);
|
|
682
694
|
}
|
|
683
695
|
get indicator() {
|
|
684
|
-
return
|
|
696
|
+
return st(this.getAttribute("indicator"));
|
|
685
697
|
}
|
|
686
698
|
set indicator(t) {
|
|
687
699
|
if (t === "line") {
|
|
@@ -731,8 +743,8 @@ const $ = class c extends Z {
|
|
|
731
743
|
return this._config;
|
|
732
744
|
}
|
|
733
745
|
set config(t) {
|
|
734
|
-
var
|
|
735
|
-
this._config = t || {}, this._config.id && (this._dialogId = this._config.id), this._config.dismissible != null && (this.dismissible = !!this._config.dismissible), this._config.closeOnEsc != null && (this.closeOnEsc = !!this._config.closeOnEsc), this._config.closeOnBackdrop != null && (this.closeOnBackdrop = !!this._config.closeOnBackdrop), this._config.lockWhileLoading != null && (this.lockWhileLoading = !!this._config.lockWhileLoading), this._config.role && (this.roleType = this._config.role), this._config.tone && (this.tone = this._config.tone), this._config.size && (this.size = this._config.size), this._config.variant && (this.variant = this._config.variant), this._config.elevation && (this.elevation = this._config.elevation), this._config.indicator && (this.indicator = this._config.indicator), this._config.radius != null && (this.radius = String(this._config.radius)), this._config.ariaLabel && this.setAttribute("aria-label", this._config.ariaLabel), this._config.ariaLabelledby && this.setAttribute("aria-labelledby", this._config.ariaLabelledby), this._config.ariaDescribedby && this.setAttribute("aria-describedby", this._config.ariaDescribedby), this._config.initialFocus && (this.initialFocus = this._config.initialFocus), this._config.headless != null && (this.headless = !!this._config.headless), this._inputValue = ((
|
|
746
|
+
var i, r;
|
|
747
|
+
this._config = t || {}, this._config.id && (this._dialogId = this._config.id), this._config.dismissible != null && (this.dismissible = !!this._config.dismissible), this._config.closeOnEsc != null && (this.closeOnEsc = !!this._config.closeOnEsc), this._config.closeOnBackdrop != null && (this.closeOnBackdrop = !!this._config.closeOnBackdrop), this._config.lockWhileLoading != null && (this.lockWhileLoading = !!this._config.lockWhileLoading), this._config.role && (this.roleType = this._config.role), this._config.tone && (this.tone = this._config.tone), this._config.size && (this.size = this._config.size), this._config.variant && (this.variant = this._config.variant), this._config.elevation && (this.elevation = this._config.elevation), this._config.indicator && (this.indicator = this._config.indicator), this._config.radius != null && (this.radius = String(this._config.radius)), this._config.ariaLabel && this.setAttribute("aria-label", this._config.ariaLabel), this._config.ariaLabelledby && this.setAttribute("aria-labelledby", this._config.ariaLabelledby), this._config.ariaDescribedby && this.setAttribute("aria-describedby", this._config.ariaDescribedby), this._config.initialFocus && (this.initialFocus = this._config.initialFocus), this._config.headless != null && (this.headless = !!this._config.headless), this._inputValue = ((i = this._config.input) == null ? void 0 : i.value) ?? this._inputValue, this._checked = ((r = this._config.checkbox) == null ? void 0 : r.checked) ?? this._checked, this._runtimeError = this._config.errorMessage || "", this._syncVisualTokens(), this.requestRender();
|
|
736
748
|
}
|
|
737
749
|
getInputValue() {
|
|
738
750
|
const t = this.root.querySelector(".input");
|
|
@@ -740,8 +752,8 @@ const $ = class c extends Z {
|
|
|
740
752
|
}
|
|
741
753
|
setInputValue(t) {
|
|
742
754
|
this._inputValue = t;
|
|
743
|
-
const
|
|
744
|
-
|
|
755
|
+
const i = this.root.querySelector(".input");
|
|
756
|
+
i && (i.value = t);
|
|
745
757
|
}
|
|
746
758
|
getChecked() {
|
|
747
759
|
const t = this.root.querySelector(".checkbox-input");
|
|
@@ -749,8 +761,8 @@ const $ = class c extends Z {
|
|
|
749
761
|
}
|
|
750
762
|
setChecked(t) {
|
|
751
763
|
this._checked = t;
|
|
752
|
-
const
|
|
753
|
-
|
|
764
|
+
const i = this.root.querySelector(".checkbox-input");
|
|
765
|
+
i && (i.checked = t);
|
|
754
766
|
}
|
|
755
767
|
setError(t) {
|
|
756
768
|
this._runtimeError = t, this.state = t ? "error" : "idle", this.requestRender();
|
|
@@ -758,14 +770,14 @@ const $ = class c extends Z {
|
|
|
758
770
|
clearError() {
|
|
759
771
|
this._runtimeError = "", this.state === "error" && (this.state = "idle"), this.requestRender();
|
|
760
772
|
}
|
|
761
|
-
close(t = "dismiss",
|
|
762
|
-
this._terminalEmitted || (this._closeMeta = { action: t, source:
|
|
773
|
+
close(t = "dismiss", i, r) {
|
|
774
|
+
this._terminalEmitted || (this._closeMeta = { action: t, source: i, reason: r }, this.hasAttribute("open") && this.removeAttribute("open"), this._syncOpenState());
|
|
763
775
|
}
|
|
764
776
|
_syncFromAttributes() {
|
|
765
777
|
this.hasAttribute("role") || this.setAttribute("role", "alertdialog");
|
|
766
778
|
}
|
|
767
779
|
_syncVisualTokens() {
|
|
768
|
-
this.style.setProperty("--ui-alert-radius",
|
|
780
|
+
this.style.setProperty("--ui-alert-radius", at(this.getAttribute("radius")));
|
|
769
781
|
}
|
|
770
782
|
_syncOpenState() {
|
|
771
783
|
const t = this.hasAttribute("open");
|
|
@@ -776,18 +788,18 @@ const $ = class c extends Z {
|
|
|
776
788
|
!t && this._active && this._deactivate();
|
|
777
789
|
}
|
|
778
790
|
_activate() {
|
|
779
|
-
this._active = !0, this._activeHeadless = this.headless, this._terminalEmitted = !1, this._closeMeta = null, c._openStack.includes(this) || c._openStack.push(this), this._lastActive = this.headless ? null :
|
|
791
|
+
this._active = !0, this._activeHeadless = this.headless, this._terminalEmitted = !1, this._closeMeta = null, c._openStack.includes(this) || c._openStack.push(this), this._lastActive = this.headless ? null : $(), this.headless || L(), l() && !this.headless && document.addEventListener("focusin", this._onFocusIn, !0);
|
|
780
792
|
const t = this.dialogId || this._uid;
|
|
781
|
-
this._dispatchWithLegacy("ui-open", "open", { id: t }), this.headless ||
|
|
782
|
-
this._focusInitial();
|
|
783
|
-
}
|
|
793
|
+
this._dispatchWithLegacy("ui-open", "open", { id: t }), this.headless || (this._focusInitialFrame && h(this._focusInitialFrame), this._focusInitialFrame = v(() => {
|
|
794
|
+
this._focusInitialFrame = 0, this._focusInitial();
|
|
795
|
+
})), this.requestRender();
|
|
784
796
|
}
|
|
785
797
|
_deactivate() {
|
|
786
798
|
if (!this._active)
|
|
787
799
|
return;
|
|
788
800
|
this._active = !1;
|
|
789
801
|
const t = c._openStack.lastIndexOf(this);
|
|
790
|
-
if (t >= 0 && c._openStack.splice(t, 1), l() && !this._activeHeadless && document.removeEventListener("focusin", this._onFocusIn, !0), this._activeHeadless ||
|
|
802
|
+
if (t >= 0 && c._openStack.splice(t, 1), l() && !this._activeHeadless && document.removeEventListener("focusin", this._onFocusIn, !0), this._activeHeadless || S(), !this._terminalEmitted) {
|
|
791
803
|
const r = this._closeMeta || { action: "dismiss", source: "abort" }, s = this.dialogId || this._uid;
|
|
792
804
|
r.action === "cancel" ? this._dispatchWithLegacy("ui-cancel", "cancel", { id: s }) : r.action === "dismiss" && this._dispatchWithLegacy("ui-dismiss", "dismiss", {
|
|
793
805
|
id: s,
|
|
@@ -800,26 +812,27 @@ const $ = class c extends Z {
|
|
|
800
812
|
reason: r.reason
|
|
801
813
|
}), this._terminalEmitted = !0, this._closeMeta = null;
|
|
802
814
|
}
|
|
803
|
-
const
|
|
804
|
-
this._lastActive = null,
|
|
815
|
+
const i = this._lastActive;
|
|
816
|
+
this._lastActive = null, i && !this._activeHeadless && (this._restoreFocusFrame && h(this._restoreFocusFrame), this._restoreFocusFrame = v(() => {
|
|
817
|
+
this._restoreFocusFrame = 0;
|
|
805
818
|
try {
|
|
806
|
-
|
|
819
|
+
i.focus();
|
|
807
820
|
} catch {
|
|
808
821
|
}
|
|
809
|
-
}
|
|
822
|
+
})), this._activeHeadless = !1, this.requestRender();
|
|
810
823
|
}
|
|
811
824
|
_syncActiveEnvironment() {
|
|
812
825
|
if (this._active && this.headless !== this._activeHeadless) {
|
|
813
826
|
if (this.headless) {
|
|
814
|
-
l() && document.removeEventListener("focusin", this._onFocusIn, !0),
|
|
827
|
+
l() && document.removeEventListener("focusin", this._onFocusIn, !0), S(), this._lastActive = null, this._activeHeadless = !0;
|
|
815
828
|
return;
|
|
816
829
|
}
|
|
817
|
-
this._lastActive =
|
|
818
|
-
this._focusInitial();
|
|
819
|
-
}
|
|
830
|
+
this._lastActive = $(), L(), l() && document.addEventListener("focusin", this._onFocusIn, !0), this._activeHeadless = !1, this._focusInitialFrame && h(this._focusInitialFrame), this._focusInitialFrame = v(() => {
|
|
831
|
+
this._focusInitialFrame = 0, this._focusInitial();
|
|
832
|
+
});
|
|
820
833
|
}
|
|
821
834
|
}
|
|
822
|
-
_dispatchWithLegacy(t,
|
|
835
|
+
_dispatchWithLegacy(t, i, r, s = !1) {
|
|
823
836
|
const o = new CustomEvent(t, {
|
|
824
837
|
detail: r,
|
|
825
838
|
bubbles: !0,
|
|
@@ -827,7 +840,7 @@ const $ = class c extends Z {
|
|
|
827
840
|
cancelable: s
|
|
828
841
|
});
|
|
829
842
|
this.dispatchEvent(o);
|
|
830
|
-
const n = new CustomEvent(
|
|
843
|
+
const n = new CustomEvent(i, {
|
|
831
844
|
detail: r,
|
|
832
845
|
bubbles: !0,
|
|
833
846
|
composed: !0,
|
|
@@ -845,10 +858,10 @@ const $ = class c extends Z {
|
|
|
845
858
|
return this.root.querySelector(".dialog");
|
|
846
859
|
}
|
|
847
860
|
_collectFocusable(t) {
|
|
848
|
-
return Array.from(t.querySelectorAll(
|
|
849
|
-
if (
|
|
861
|
+
return Array.from(t.querySelectorAll(X)).filter((i) => {
|
|
862
|
+
if (i.disabled || i.getAttribute("aria-hidden") === "true")
|
|
850
863
|
return !1;
|
|
851
|
-
const s = l() ? window.getComputedStyle(
|
|
864
|
+
const s = l() ? window.getComputedStyle(i) : null;
|
|
852
865
|
return !(s && (s.display === "none" || s.visibility === "hidden"));
|
|
853
866
|
});
|
|
854
867
|
}
|
|
@@ -858,9 +871,9 @@ const $ = class c extends Z {
|
|
|
858
871
|
const t = this._queryPanel();
|
|
859
872
|
if (!t)
|
|
860
873
|
return;
|
|
861
|
-
const
|
|
862
|
-
if (
|
|
863
|
-
const n = t.querySelector(
|
|
874
|
+
const i = this.initialFocus;
|
|
875
|
+
if (i) {
|
|
876
|
+
const n = t.querySelector(i);
|
|
864
877
|
if (n && typeof n.focus == "function") {
|
|
865
878
|
n.focus();
|
|
866
879
|
return;
|
|
@@ -876,17 +889,17 @@ const $ = class c extends Z {
|
|
|
876
889
|
_handleTab(t) {
|
|
877
890
|
if (t.key !== "Tab")
|
|
878
891
|
return;
|
|
879
|
-
const
|
|
880
|
-
if (!
|
|
892
|
+
const i = this._queryPanel();
|
|
893
|
+
if (!i)
|
|
881
894
|
return;
|
|
882
|
-
const r = this._collectFocusable(
|
|
895
|
+
const r = this._collectFocusable(i);
|
|
883
896
|
if (!r.length) {
|
|
884
|
-
t.preventDefault(),
|
|
897
|
+
t.preventDefault(), i.focus();
|
|
885
898
|
return;
|
|
886
899
|
}
|
|
887
900
|
const s = this.root.activeElement || document.activeElement, o = r[0], n = r[r.length - 1];
|
|
888
901
|
if (t.shiftKey) {
|
|
889
|
-
(s === o || !s || !
|
|
902
|
+
(s === o || !s || !i.contains(s)) && (t.preventDefault(), n.focus());
|
|
890
903
|
return;
|
|
891
904
|
}
|
|
892
905
|
s === n && (t.preventDefault(), o.focus());
|
|
@@ -894,15 +907,15 @@ const $ = class c extends Z {
|
|
|
894
907
|
_onFocusIn(t) {
|
|
895
908
|
if (!this.open || !this._isTopMost())
|
|
896
909
|
return;
|
|
897
|
-
const
|
|
898
|
-
if (!
|
|
910
|
+
const i = this._queryPanel();
|
|
911
|
+
if (!i)
|
|
899
912
|
return;
|
|
900
913
|
const r = t.target;
|
|
901
|
-
(typeof t.composedPath == "function" ? t.composedPath() : []).includes(
|
|
914
|
+
(typeof t.composedPath == "function" ? t.composedPath() : []).includes(i) || r && i.contains(r) || this._focusInitial();
|
|
902
915
|
}
|
|
903
916
|
_onInput(t) {
|
|
904
|
-
const
|
|
905
|
-
|
|
917
|
+
const i = t.target;
|
|
918
|
+
i && (i.classList.contains("input") && (this._inputValue = i.value), i.classList.contains("checkbox-input") && (this._checked = i.checked), this._dispatchWithLegacy("ui-change", "change", {
|
|
906
919
|
id: this.dialogId || this._uid,
|
|
907
920
|
inputValue: this._inputValue,
|
|
908
921
|
checked: this._checked
|
|
@@ -911,8 +924,8 @@ const $ = class c extends Z {
|
|
|
911
924
|
_isInteractionLocked() {
|
|
912
925
|
return this.state === "loading" && this.lockWhileLoading;
|
|
913
926
|
}
|
|
914
|
-
_requestDismiss(t,
|
|
915
|
-
this._isInteractionLocked() || this.close("dismiss", t,
|
|
927
|
+
_requestDismiss(t, i) {
|
|
928
|
+
this._isInteractionLocked() || this.close("dismiss", t, i);
|
|
916
929
|
}
|
|
917
930
|
_handleConfirm() {
|
|
918
931
|
const t = {
|
|
@@ -928,21 +941,21 @@ const $ = class c extends Z {
|
|
|
928
941
|
_onClick(t) {
|
|
929
942
|
if (!this.open || !this._isTopMost())
|
|
930
943
|
return;
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
933
|
-
if (
|
|
944
|
+
const i = t.target;
|
|
945
|
+
if (i) {
|
|
946
|
+
if (i.classList.contains("backdrop") && this.closeOnBackdrop) {
|
|
934
947
|
this._requestDismiss("backdrop");
|
|
935
948
|
return;
|
|
936
949
|
}
|
|
937
|
-
if (
|
|
950
|
+
if (i.closest(".close")) {
|
|
938
951
|
this._requestDismiss("close-icon");
|
|
939
952
|
return;
|
|
940
953
|
}
|
|
941
|
-
if (
|
|
954
|
+
if (i.closest(".btn-confirm")) {
|
|
942
955
|
this._handleConfirm();
|
|
943
956
|
return;
|
|
944
957
|
}
|
|
945
|
-
|
|
958
|
+
i.closest(".btn-cancel") && this._handleCancel();
|
|
946
959
|
}
|
|
947
960
|
}
|
|
948
961
|
_onKeyDown(t) {
|
|
@@ -957,77 +970,77 @@ const $ = class c extends Z {
|
|
|
957
970
|
}
|
|
958
971
|
}
|
|
959
972
|
render() {
|
|
960
|
-
var
|
|
973
|
+
var A, F, z, I, E, C;
|
|
961
974
|
if (!this.open) {
|
|
962
975
|
this.setContent("");
|
|
963
976
|
return;
|
|
964
977
|
}
|
|
965
|
-
const t = this._config.title ?? this.getAttribute("title") ?? "",
|
|
966
|
-
|
|
967
|
-
const d =
|
|
978
|
+
const t = this._config.title ?? this.getAttribute("title") ?? "", i = this._config.description ?? this.getAttribute("description") ?? "", r = this._config.confirmText ?? this.getAttribute("confirm-text") ?? "Confirm", s = this._config.cancelText ?? this.getAttribute("cancel-text") ?? "Cancel", o = this._config.loadingText ?? this.getAttribute("loading-text") ?? "Working...", n = !!((A = this._config.input) != null && A.enabled), T = ((F = this._config.input) == null ? void 0 : F.label) || "Value", q = ((z = this._config.input) == null ? void 0 : z.placeholder) || "", D = !!((I = this._config.input) != null && I.required), M = !!((E = this._config.checkbox) != null && E.enabled), O = ((C = this._config.checkbox) == null ? void 0 : C.label) || "Remember this choice", V = this.state, f = this._runtimeError || this._config.errorMessage || this.getAttribute("error-message") || "", x = `ui-alert-title-${this._uid}`, _ = `ui-alert-description-${this._uid}`, k = `ui-alert-error-${this._uid}`, H = !!this.querySelector('[slot="title"]'), W = !!this.querySelector('[slot="description"]'), R = !!this.querySelector('[slot="icon"]'), P = !!this.querySelector('[slot="footer"]'), j = !!this.querySelector('[slot="content"]'), g = H || !!t, b = W || !!i, K = R || g || b, Y = this._config.showCancel ?? this.dismissible, U = this._config.showClose ?? this.dismissible, N = this.tone, Z = this.getAttribute("aria-label") || "", G = this.getAttribute("aria-labelledby") || "", y = this.getAttribute("aria-describedby") || "", m = G || (g ? x : ""), w = Z || (m ? "" : t || i || "Dialog"), u = [];
|
|
979
|
+
y ? u.push(y) : (b && u.push(_), f && u.push(k));
|
|
980
|
+
const d = V === "loading";
|
|
968
981
|
this.setContent(`
|
|
969
|
-
<style>${
|
|
982
|
+
<style>${Q}</style>
|
|
970
983
|
<div class="backdrop" part="backdrop" role="presentation" data-open="${String(this.open)}">
|
|
971
984
|
<section
|
|
972
985
|
class="dialog"
|
|
973
986
|
part="dialog"
|
|
974
987
|
role="${a(this.roleType)}"
|
|
975
988
|
aria-modal="true"
|
|
976
|
-
${
|
|
977
|
-
${
|
|
989
|
+
${w ? `aria-label="${a(w)}"` : ""}
|
|
990
|
+
${m ? `aria-labelledby="${a(m)}"` : ""}
|
|
978
991
|
${u.length ? `aria-describedby="${a(u.join(" "))}"` : ""}
|
|
979
992
|
tabindex="-1"
|
|
980
993
|
>
|
|
981
|
-
${
|
|
994
|
+
${U ? `<button class="close" part="close" aria-label="Close dialog">
|
|
982
995
|
<svg width="14" height="14" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round">
|
|
983
996
|
<path d="m6 6 8 8M14 6l-8 8"></path>
|
|
984
997
|
</svg>
|
|
985
998
|
</button>` : ""}
|
|
986
999
|
|
|
987
|
-
${
|
|
1000
|
+
${K ? `<header class="header">
|
|
988
1001
|
<div class="header-main">
|
|
989
1002
|
<span class="icon-wrap" part="icon-wrap" aria-hidden="true">
|
|
990
1003
|
<span class="icon" part="icon">
|
|
991
|
-
<slot name="icon">${
|
|
1004
|
+
<slot name="icon">${nt(N)}</slot>
|
|
992
1005
|
</span>
|
|
993
1006
|
</span>
|
|
994
1007
|
<div class="heading">
|
|
995
|
-
${g ? `<h2 id="${
|
|
996
|
-
${b ? `<p id="${
|
|
1008
|
+
${g ? `<h2 id="${x}" class="title" part="title"><slot name="title">${a(t)}</slot></h2>` : ""}
|
|
1009
|
+
${b ? `<p id="${_}" class="description" part="description"><slot name="description">${a(i)}</slot></p>` : ""}
|
|
997
1010
|
</div>
|
|
998
1011
|
</div>
|
|
999
1012
|
</header>` : ""}
|
|
1000
1013
|
|
|
1001
1014
|
<div class="content" part="content">
|
|
1002
|
-
${
|
|
1015
|
+
${j ? '<slot name="content"></slot>' : "<slot></slot>"}
|
|
1003
1016
|
|
|
1004
1017
|
${n ? `<label class="input-wrap">
|
|
1005
|
-
<span class="label">${a(
|
|
1018
|
+
<span class="label">${a(T)}</span>
|
|
1006
1019
|
<input
|
|
1007
1020
|
class="input"
|
|
1008
1021
|
part="input"
|
|
1009
1022
|
type="text"
|
|
1010
1023
|
value="${a(this.getInputValue())}"
|
|
1011
|
-
placeholder="${a(
|
|
1012
|
-
${
|
|
1024
|
+
placeholder="${a(q)}"
|
|
1025
|
+
${D ? "required" : ""}
|
|
1013
1026
|
${d ? "disabled" : ""}
|
|
1014
1027
|
/>
|
|
1015
1028
|
</label>` : ""}
|
|
1016
1029
|
|
|
1017
|
-
${
|
|
1030
|
+
${M ? `<label class="checkbox" part="checkbox">
|
|
1018
1031
|
<span class="checkbox-line">
|
|
1019
1032
|
<input class="checkbox-input" type="checkbox" ${this.getChecked() ? "checked" : ""} ${d ? "disabled" : ""} />
|
|
1020
|
-
<span>${a(
|
|
1033
|
+
<span>${a(O)}</span>
|
|
1021
1034
|
</span>
|
|
1022
1035
|
</label>` : ""}
|
|
1023
1036
|
</div>
|
|
1024
1037
|
|
|
1025
|
-
<div class="error" id="${
|
|
1038
|
+
<div class="error" id="${k}" part="error" aria-live="polite" data-empty="${String(!f)}">${a(f)}</div>
|
|
1026
1039
|
|
|
1027
1040
|
<footer class="footer" part="footer">
|
|
1028
1041
|
${d ? `<span class="loading"><span class="spinner" aria-hidden="true"></span><span>${a(o)}</span></span>` : '<span aria-hidden="true"></span>'}
|
|
1029
1042
|
|
|
1030
|
-
${
|
|
1043
|
+
${P ? '<slot name="footer"></slot>' : `${Y ? `<button class="btn btn-cancel" part="cancel" type="button" ${d ? "disabled" : ""}>${a(s)}</button>` : ""}
|
|
1031
1044
|
<button class="btn btn-confirm" part="confirm" type="button" ${d ? "disabled" : ""}>${a(r)}</button>`}
|
|
1032
1045
|
</footer>
|
|
1033
1046
|
</section>
|
|
@@ -1035,9 +1048,9 @@ const $ = class c extends Z {
|
|
|
1035
1048
|
`);
|
|
1036
1049
|
}
|
|
1037
1050
|
};
|
|
1038
|
-
|
|
1039
|
-
let
|
|
1040
|
-
typeof customElements < "u" && !customElements.get("ui-alert-dialog") && customElements.define("ui-alert-dialog",
|
|
1051
|
+
B._openStack = [];
|
|
1052
|
+
let lt = B;
|
|
1053
|
+
typeof customElements < "u" && !customElements.get("ui-alert-dialog") && customElements.define("ui-alert-dialog", lt);
|
|
1041
1054
|
export {
|
|
1042
|
-
|
|
1055
|
+
lt as UIAlertDialog
|
|
1043
1056
|
};
|
package/dist/app-header.cjs.js
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
--ui-app-header-height-large: 76px;
|
|
7
7
|
--ui-app-header-bg-base: var(--base-app-header-bg, var(--color-panel, var(--ui-color-surface, #ffffff)));
|
|
8
8
|
--ui-app-header-bg: var(--ui-app-header-bg-base);
|
|
9
|
+
--ui-app-header-sticky-bg-base: var(--base-app-header-sticky-bg, var(--ui-color-surface, #ffffff));
|
|
10
|
+
--ui-app-header-surface-bg: var(--ui-app-header-bg);
|
|
11
|
+
--ui-app-header-surface-backdrop: blur(6px) saturate(1.05);
|
|
9
12
|
--ui-app-header-color: var(--ui-color-text, var(--ui-text, #202020));
|
|
10
13
|
--ui-app-header-muted: color-mix(in srgb, var(--ui-app-header-color) 56%, var(--ui-color-muted, var(--ui-muted, #646464)) 44%);
|
|
11
14
|
--ui-app-header-accent: var(--ui-color-primary, var(--ui-primary, #2563eb));
|
|
@@ -114,6 +117,22 @@
|
|
|
114
117
|
position: sticky;
|
|
115
118
|
top: 0;
|
|
116
119
|
z-index: var(--ui-app-header-z);
|
|
120
|
+
--ui-app-header-surface-bg: var(--ui-app-header-sticky-bg-base);
|
|
121
|
+
--ui-app-header-surface-backdrop: none;
|
|
122
|
+
contain: paint;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host([sticky][variant='soft']) {
|
|
126
|
+
--ui-app-header-surface-bg: color-mix(in srgb, var(--ui-app-header-accent) 8%, var(--ui-app-header-sticky-bg-base));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:host([sticky][variant='solid']) {
|
|
130
|
+
--ui-app-header-surface-bg: var(--ui-app-header-accent);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:host([sticky]) header {
|
|
134
|
+
transform: translateZ(0);
|
|
135
|
+
backface-visibility: hidden;
|
|
117
136
|
}
|
|
118
137
|
|
|
119
138
|
header {
|
|
@@ -123,14 +142,15 @@
|
|
|
123
142
|
grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
|
|
124
143
|
align-items: center;
|
|
125
144
|
gap: var(--ui-app-header-gap);
|
|
126
|
-
background: var(--ui-app-header-bg);
|
|
145
|
+
background: var(--ui-app-header-surface-bg);
|
|
127
146
|
color: var(--ui-app-header-color);
|
|
128
147
|
border: var(--ui-app-header-border);
|
|
129
148
|
padding: 0 var(--ui-app-header-padding-x);
|
|
130
149
|
box-sizing: border-box;
|
|
131
150
|
border-radius: var(--ui-app-header-radius);
|
|
132
151
|
box-shadow: var(--ui-app-header-shadow);
|
|
133
|
-
backdrop-filter:
|
|
152
|
+
-webkit-backdrop-filter: var(--ui-app-header-surface-backdrop);
|
|
153
|
+
backdrop-filter: var(--ui-app-header-surface-backdrop);
|
|
134
154
|
transition:
|
|
135
155
|
background var(--ui-app-header-duration) var(--ui-app-header-easing),
|
|
136
156
|
border-color var(--ui-app-header-duration) var(--ui-app-header-easing),
|