monobill-mintui 0.6.721 → 0.6.722

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.
@@ -15,9 +15,8 @@ declare class MintOffCanvas extends HTMLElement {
15
15
  private _closeButton;
16
16
  private _contentObserver;
17
17
  private _renderFrame;
18
+ private _enterFrame;
18
19
  private _exitTimer;
19
- private _enterPending;
20
- private _exitPending;
21
20
  private _previousFocus;
22
21
  private _dialogWasOpen;
23
22
  private _dialogKeydownHandler;
@@ -37,11 +36,11 @@ declare class MintOffCanvas extends HTMLElement {
37
36
  open(): void;
38
37
  close(): void;
39
38
  render(): void;
40
- private _getTransformValue;
41
39
  private _observeContentMutations;
42
40
  private _getDialogFocusableElements;
43
41
  private _animateEnter;
44
42
  private _animateExit;
43
+ private _finishExit;
45
44
  }
46
45
  export default MintOffCanvas;
47
46
  //# sourceMappingURL=OffCanvas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OffCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/off-canvas/OffCanvas.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,CAAA;AACxB,OAAO,eAAe,CAAA;AACtB,OAAO,qBAAqB,CAAA;AAC5B,OAAO,eAAe,CAAA;AACtB,OAAO,gBAAgB,CAAA;AAEvB,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D,cAAM,aAAc,SAAQ,WAAW;IACrC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,gBAAgB,CAAgC;IACxD,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,qBAAqB,CAAgD;;IAO7E,iBAAiB,IAAI,IAAI;IAuCzB,oBAAoB,IAAI,IAAI;IAqB5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,OAAO,CAAC,eAAe;IAQvB,KAAK,IAAI,MAAM;IAIf,UAAU,IAAI,MAAM;IAIpB,WAAW,IAAI,iBAAiB;IAQhC,UAAU,IAAI,OAAO;IAKrB,QAAQ,IAAI,MAAM;IAMlB,SAAS,IAAI,MAAM;IAMnB,OAAO,CAAC,kBAAkB;IAS1B,MAAM,IAAI,OAAO;IAKjB,IAAI,IAAI,IAAI;IAIZ,KAAK,IAAI,IAAI;IAIb,MAAM,IAAI,IAAI;IA0Md,OAAO,CAAC,kBAAkB;IAgC1B,OAAO,CAAC,wBAAwB;IAchC,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,aAAa;IAgDrB,OAAO,CAAC,YAAY;CAmCrB;AAOD,eAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"OffCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/off-canvas/OffCanvas.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,CAAA;AACxB,OAAO,eAAe,CAAA;AACtB,OAAO,qBAAqB,CAAA;AAC5B,OAAO,eAAe,CAAA;AACtB,OAAO,gBAAgB,CAAA;AAEvB,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D,cAAM,aAAc,SAAQ,WAAW;IACrC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,gBAAgB,CAAgC;IACxD,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,qBAAqB,CAAgD;;IAO7E,iBAAiB,IAAI,IAAI;IAsCzB,oBAAoB,IAAI,IAAI;IAyB5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,OAAO,CAAC,eAAe;IAQvB,KAAK,IAAI,MAAM;IAIf,UAAU,IAAI,MAAM;IAIpB,WAAW,IAAI,iBAAiB;IAQhC,UAAU,IAAI,OAAO;IAKrB,QAAQ,IAAI,MAAM;IAMlB,SAAS,IAAI,MAAM;IAMnB,OAAO,CAAC,kBAAkB;IAS1B,MAAM,IAAI,OAAO;IAKjB,IAAI,IAAI,IAAI;IAIZ,KAAK,IAAI,IAAI;IAIb,MAAM,IAAI,IAAI;IA0Md,OAAO,CAAC,wBAAwB;IAchC,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,aAAa;IAsCrB,OAAO,CAAC,YAAY;IAkCpB,OAAO,CAAC,WAAW;CAcpB;AAOD,eAAe,aAAa,CAAA"}
@@ -36,10 +36,10 @@ var t = class extends HTMLElement {
36
36
  ];
37
37
  }
38
38
  constructor() {
39
- super(), this._overlay = null, this._offCanvas = null, this._header = null, this._headingSlot = null, this._bodySlot = null, this._actionsSlot = null, this._closeButton = null, this._contentObserver = null, this._renderFrame = null, this._exitTimer = null, this._enterPending = !1, this._exitPending = !1, this._previousFocus = null, this._dialogWasOpen = !1, this._dialogKeydownHandler = null;
39
+ super(), this._overlay = null, this._offCanvas = null, this._header = null, this._headingSlot = null, this._bodySlot = null, this._actionsSlot = null, this._closeButton = null, this._contentObserver = null, this._renderFrame = null, this._enterFrame = null, this._exitTimer = null, this._previousFocus = null, this._dialogWasOpen = !1, this._dialogKeydownHandler = null;
40
40
  }
41
41
  connectedCallback() {
42
- this.classList.add("mint-off-canvas-host"), this.isOpen() || (this.classList.add("mint-off-canvas-hidden"), this.style.display = "none"), this.render(), this._observeContentMutations(), this._dialogKeydownHandler = (e) => {
42
+ this.classList.add("mint-off-canvas-host"), this.style.display = "none", this.render(), this._observeContentMutations(), this._dialogKeydownHandler = (e) => {
43
43
  if (!this.isOpen()) return;
44
44
  if (e.key === "Escape") {
45
45
  e.preventDefault(), e.stopPropagation(), this.close();
@@ -58,7 +58,7 @@ var t = class extends HTMLElement {
58
58
  }, document.addEventListener("keydown", this._dialogKeydownHandler, !0);
59
59
  }
60
60
  disconnectedCallback() {
61
- this._dialogKeydownHandler &&= (document.removeEventListener("keydown", this._dialogKeydownHandler, !0), null), this._contentObserver &&= (this._contentObserver.disconnect(), null), this._renderFrame !== null && (cancelAnimationFrame(this._renderFrame), this._renderFrame = null), this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null), this._enterPending = !1, this._exitPending = !1;
61
+ this._dialogKeydownHandler &&= (document.removeEventListener("keydown", this._dialogKeydownHandler, !0), null), this._contentObserver &&= (this._contentObserver.disconnect(), null), this._renderFrame !== null && (cancelAnimationFrame(this._renderFrame), this._renderFrame = null), this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null), this._enterFrame !== null && (cancelAnimationFrame(this._enterFrame), this._enterFrame = null), this._overlay?.remove(), this._offCanvas?.remove();
62
62
  }
63
63
  attributeChangedCallback(e, t, n) {
64
64
  t !== n && this.isConnected && this.render();
@@ -101,43 +101,29 @@ var t = class extends HTMLElement {
101
101
  }
102
102
  render() {
103
103
  let e = this.getId(), t = this.getHeading(), n = this.isOpen(), r = this.getPosition(), i = this.isFullPage(), a = this.getHeight();
104
- e && (this.id = e), this._overlay || (this._overlay = document.createElement("div"), this._overlay.className = "mint-off-canvas-overlay", this._overlay.setAttribute("aria-hidden", "true"), this._overlay.addEventListener("click", () => this.close()), this.appendChild(this._overlay)), this._offCanvas || (this._offCanvas = document.createElement("div"), this.appendChild(this._offCanvas)), this._offCanvas.className = "mint-off-canvas-shell", this._offCanvas.dataset.position = r, this._offCanvas.dataset.fullPage = String(i);
105
- let o = this._offCanvas.querySelector(".mint-off-canvas-panel");
106
- o || (o = document.createElement("div"), o.className = "mint-off-canvas-panel", o.style.transform = this._getTransformValue(r, !1), this._offCanvas.appendChild(o)), o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.hasAttribute("tabindex") || (o.tabIndex = -1), n ? this._animateEnter() : this._animateExit(), o.style.removeProperty("--off-canvas-width"), o.style.removeProperty("--off-canvas-height"), r === "top" || r === "bottom" ? a && o.style.setProperty("--off-canvas-height", this._normalizeCssValue(a)) : o.style.setProperty("--off-canvas-width", this._normalizeCssValue(this.getWidth())), this._header || (this._header = document.createElement("div"), this._header.className = "mint-off-canvas-header", o.appendChild(this._header)), this._headingSlot || (this._headingSlot = document.createElement("div"), this._headingSlot.className = "mint-off-canvas-heading", this._headingSlot.setAttribute("slot", "heading"), this._header.appendChild(this._headingSlot));
107
- let s = this._headingSlot.querySelector("mint-text");
108
- if (t ? (s || (s = document.createElement("mint-text"), s.setAttribute("size", "sub-heading"), s.setAttribute("bold", "true"), this._headingSlot.appendChild(s)), s.textContent = t, s.id = `${e || "mint-off-canvas"}-heading`, o.setAttribute("aria-labelledby", s.id), o.removeAttribute("aria-label")) : s && s.remove(), !t) {
104
+ e && (this.id = e), this._overlay || (this._overlay = document.createElement("div"), this._overlay.className = "mint-off-canvas-overlay mint-off-canvas-hidden", this._overlay.setAttribute("aria-hidden", "true"), this._overlay.addEventListener("click", () => this.close())), this._offCanvas || (this._offCanvas = document.createElement("div"), this._offCanvas.className = "mint-off-canvas-shell mint-off-canvas-hidden");
105
+ let o = document.body ?? document.documentElement;
106
+ this._overlay.parentElement !== o && o.appendChild(this._overlay), this._offCanvas.parentElement !== o && o.appendChild(this._offCanvas), this._offCanvas.classList.add("mint-off-canvas-shell"), this._offCanvas.dataset.position = r, this._offCanvas.dataset.fullPage = String(i);
107
+ let s = this._offCanvas.querySelector(".mint-off-canvas-panel");
108
+ s || (s = document.createElement("div"), s.className = "mint-off-canvas-panel", this._offCanvas.appendChild(s)), s.setAttribute("role", "dialog"), s.setAttribute("aria-modal", "true"), s.hasAttribute("tabindex") || (s.tabIndex = -1), s.style.removeProperty("--off-canvas-width"), s.style.removeProperty("--off-canvas-height"), r === "top" || r === "bottom" ? a && s.style.setProperty("--off-canvas-height", this._normalizeCssValue(a)) : s.style.setProperty("--off-canvas-width", this._normalizeCssValue(this.getWidth())), this._header || (this._header = document.createElement("div"), this._header.className = "mint-off-canvas-header", s.appendChild(this._header)), this._headingSlot || (this._headingSlot = document.createElement("div"), this._headingSlot.className = "mint-off-canvas-heading", this._headingSlot.setAttribute("slot", "heading"), this._header.appendChild(this._headingSlot));
109
+ let c = this._headingSlot.querySelector("mint-text");
110
+ if (t ? (c || (c = document.createElement("mint-text"), c.setAttribute("size", "sub-heading"), c.setAttribute("bold", "true"), this._headingSlot.appendChild(c)), c.textContent = t, c.id = `${e || "mint-off-canvas"}-heading`, s.setAttribute("aria-labelledby", c.id), s.removeAttribute("aria-label")) : c && c.remove(), !t) {
109
111
  let e = this.getAttribute("aria-label")?.trim();
110
- e ? o.setAttribute("aria-label", e) : o.hasAttribute("aria-label") || o.setAttribute("aria-label", "Dialog");
112
+ e ? s.setAttribute("aria-label", e) : s.hasAttribute("aria-label") || s.setAttribute("aria-label", "Dialog");
111
113
  }
112
114
  Array.from(this.children).filter((e) => e !== this._overlay && e !== this._offCanvas && e !== this._headingSlot && e.getAttribute("slot") === "heading").forEach((e) => {
113
115
  this._headingSlot && e.parentElement !== this._headingSlot && this._headingSlot.appendChild(e);
114
- }), this._closeButton || (this._closeButton = document.createElement("mint-button"), this._closeButton.setAttribute("variant", "ghost"), this._closeButton.setAttribute("icon", "close"), this._closeButton.setAttribute("aria-label", "Close panel"), this._closeButton.addEventListener("click", () => this.close()), this._header.appendChild(this._closeButton)), this._bodySlot || (this._bodySlot = document.createElement("div"), this._bodySlot.className = "mint-off-canvas-body", this._bodySlot.setAttribute("slot", "body"), o.appendChild(this._bodySlot)), Array.from(this.children).filter((e) => e !== this._overlay && e !== this._offCanvas && e !== this._bodySlot && e.getAttribute("slot") === "body").forEach((e) => {
116
+ }), this._closeButton || (this._closeButton = document.createElement("mint-button"), this._closeButton.setAttribute("variant", "ghost"), this._closeButton.setAttribute("icon", "close"), this._closeButton.setAttribute("aria-label", "Close panel"), this._closeButton.addEventListener("click", () => this.close()), this._header.appendChild(this._closeButton)), this._bodySlot || (this._bodySlot = document.createElement("div"), this._bodySlot.className = "mint-off-canvas-body", this._bodySlot.setAttribute("slot", "body"), s.appendChild(this._bodySlot)), Array.from(this.children).filter((e) => e !== this._overlay && e !== this._offCanvas && e !== this._bodySlot && e.getAttribute("slot") === "body").forEach((e) => {
115
117
  this._bodySlot && e.parentElement !== this._bodySlot && this._bodySlot.appendChild(e);
116
- }), this._actionsSlot || (this._actionsSlot = document.createElement("div"), this._actionsSlot.className = "mint-off-canvas-actions", this._actionsSlot.setAttribute("slot", "actions"), o.appendChild(this._actionsSlot));
117
- let c = this._actionsSlot.querySelector("mint-stack");
118
- c || (c = document.createElement("mint-stack"), c.setAttribute("direction", "horizontal"), c.className = "mint-off-canvas-actions-stack", this._actionsSlot.appendChild(c)), Array.from(this.children).filter((e) => e !== this._overlay && e !== this._offCanvas && e !== this._actionsSlot && e.getAttribute("slot") === "actions").forEach((e) => {
118
+ }), this._actionsSlot || (this._actionsSlot = document.createElement("div"), this._actionsSlot.className = "mint-off-canvas-actions", this._actionsSlot.setAttribute("slot", "actions"), s.appendChild(this._actionsSlot));
119
+ let l = this._actionsSlot.querySelector("mint-stack");
120
+ l || (l = document.createElement("mint-stack"), l.setAttribute("direction", "horizontal"), l.className = "mint-off-canvas-actions-stack", this._actionsSlot.appendChild(l)), Array.from(this.children).filter((e) => e !== this._overlay && e !== this._offCanvas && e !== this._actionsSlot && e.getAttribute("slot") === "actions").forEach((e) => {
119
121
  Array.from(e.children).forEach((e) => {
120
- e.parentElement !== c && c.appendChild(e);
122
+ e.parentElement !== l && l.appendChild(e);
121
123
  }), e.parentElement && e.remove();
122
124
  }), Array.from(this.children).forEach((e) => {
123
125
  e !== this._overlay && e !== this._offCanvas && e.getAttribute("slot") !== "heading" && e.getAttribute("slot") !== "body" && e.getAttribute("slot") !== "actions" && e !== this._headingSlot && e !== this._bodySlot && e !== this._actionsSlot && e.parentElement !== this._bodySlot && this._bodySlot.appendChild(e);
124
- });
125
- }
126
- _getTransformValue(e, t) {
127
- if (t) switch (e) {
128
- case "top": return "translateY(0)";
129
- case "bottom": return "translateY(0)";
130
- case "left": return "translateX(0)";
131
- case "right": return "translateX(0)";
132
- default: return "translateX(0)";
133
- }
134
- else switch (e) {
135
- case "top": return "translateY(-100%)";
136
- case "bottom": return "translateY(100%)";
137
- case "left": return "translateX(-100%)";
138
- case "right": return "translateX(100%)";
139
- default: return "translateX(100%)";
140
- }
126
+ }), n ? this._animateEnter() : this._animateExit();
141
127
  }
142
128
  _observeContentMutations() {
143
129
  this._contentObserver ||= new MutationObserver(() => {
@@ -156,40 +142,42 @@ var t = class extends HTMLElement {
156
142
  });
157
143
  }
158
144
  _animateEnter() {
159
- let e = this._offCanvas?.querySelector(".mint-off-canvas-panel");
160
- if (!e || (this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null), this._exitPending = !1, this._enterPending || this.classList.contains("mint-off-canvas-open"))) return;
161
- this._enterPending = !0;
162
- let t = this.getPosition(), n = !this._dialogWasOpen;
163
- if (n) {
145
+ let e = this._offCanvas?.querySelector(".mint-off-canvas-panel"), t = this._offCanvas, n = this._overlay;
146
+ if (!e || !t || !n || this._enterFrame !== null || t.classList.contains("mint-off-canvas-open")) return;
147
+ this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null);
148
+ let r = !this._dialogWasOpen;
149
+ if (r) {
164
150
  this._dialogWasOpen = !0;
165
151
  let e = document.activeElement;
166
152
  this._previousFocus = e instanceof HTMLElement && e !== document.body ? e : null;
167
153
  }
168
- e.style.transition = "none", e.style.transform = this._getTransformValue(t, !1), this.style.display = "block", this.classList.remove("mint-off-canvas-hidden"), e.getBoundingClientRect(), e.style.transition = "transform 200ms ease-out", requestAnimationFrame(() => {
169
- requestAnimationFrame(() => {
170
- if (!this.isOpen()) {
171
- this._enterPending = !1;
172
- return;
173
- }
174
- this.classList.add("mint-off-canvas-open"), e.style.transform = this._getTransformValue(t, !0), this._enterPending = !1, n && (this._getDialogFocusableElements(e)[0] ?? e).focus();
175
- });
154
+ n.classList.remove("mint-off-canvas-hidden", "mint-off-canvas-open"), t.classList.remove("mint-off-canvas-hidden", "mint-off-canvas-open"), e.getBoundingClientRect(), this._enterFrame = requestAnimationFrame(() => {
155
+ this._enterFrame = null, this.isOpen() && (n.classList.add("mint-off-canvas-open"), t.classList.add("mint-off-canvas-open"), r && (this._getDialogFocusableElements(e)[0] ?? e).focus());
176
156
  });
177
157
  }
178
158
  _animateExit() {
179
- if (this.classList.contains("mint-off-canvas-hidden") || this._exitPending) return;
180
- this._enterPending = !1, this._exitPending = !0, this.classList.remove("mint-off-canvas-open");
181
- let e = this._offCanvas?.querySelector(".mint-off-canvas-panel");
182
- if (!e) {
183
- this.classList.add("mint-off-canvas-hidden"), this.style.display = "none", this._dialogWasOpen = !1, this._exitPending = !1;
184
- return;
159
+ let e = this._offCanvas, t = this._overlay;
160
+ if (!(!e || !t || e.classList.contains("mint-off-canvas-hidden"))) {
161
+ if (!this._offCanvas?.querySelector(".mint-off-canvas-panel")) {
162
+ t.classList.add("mint-off-canvas-hidden"), e.classList.add("mint-off-canvas-hidden"), this._dialogWasOpen = !1;
163
+ return;
164
+ }
165
+ if (this._enterFrame !== null) {
166
+ cancelAnimationFrame(this._enterFrame), this._enterFrame = null, t.classList.add("mint-off-canvas-hidden"), e.classList.add("mint-off-canvas-hidden"), this._dialogWasOpen = !1;
167
+ let n = this._previousFocus;
168
+ this._previousFocus = null, n?.isConnected && n.focus();
169
+ return;
170
+ }
171
+ e.classList.contains("mint-off-canvas-open") && (t.classList.remove("mint-off-canvas-open"), e.classList.remove("mint-off-canvas-open"), this._exitTimer !== null && clearTimeout(this._exitTimer), this._exitTimer = window.setTimeout(() => {
172
+ this._finishExit();
173
+ }, 220));
185
174
  }
186
- let t = this.getPosition();
187
- e.style.transition = "transform 200ms ease-in", e.style.transform = this._getTransformValue(t, !1), this._exitTimer !== null && clearTimeout(this._exitTimer), this._exitTimer = window.setTimeout(() => {
188
- if (this._exitTimer = null, this.isOpen()) return;
189
- this.classList.add("mint-off-canvas-hidden"), this.style.display = "none", e.style.transform = "", e.style.transition = "", this._exitPending = !1;
190
- let t = this._previousFocus;
191
- this._previousFocus = null, t?.isConnected && t.focus();
192
- }, 200);
175
+ }
176
+ _finishExit() {
177
+ if (this.isOpen()) return;
178
+ this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null), this._overlay?.classList.add("mint-off-canvas-hidden"), this._offCanvas?.classList.add("mint-off-canvas-hidden"), this._dialogWasOpen = !1;
179
+ let e = this._previousFocus;
180
+ this._previousFocus = null, e?.isConnected && e.focus();
193
181
  }
194
182
  };
195
183
  customElements.get("mint-off-canvas") || e("mint-off-canvas", t);
@@ -1 +1 @@
1
- require(`../chunks/icon-B9P0jyS2.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/text-CfvRRKGZ.js`),require(`../chunks/button-B4BMYTk1.js`),require(`../chunks/stack-CK2o4-As.js`);var t=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`,`position`,`full-page`,`width`,`height`]}constructor(){super(),this._overlay=null,this._offCanvas=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._contentObserver=null,this._renderFrame=null,this._exitTimer=null,this._enterPending=!1,this._exitPending=!1,this._previousFocus=null,this._dialogWasOpen=!1,this._dialogKeydownHandler=null}connectedCallback(){this.classList.add(`mint-off-canvas-host`),this.isOpen()||(this.classList.add(`mint-off-canvas-hidden`),this.style.display=`none`),this.render(),this._observeContentMutations(),this._dialogKeydownHandler=e=>{if(!this.isOpen())return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this.close();return}if(e.key!==`Tab`)return;let t=this._offCanvas?.querySelector(`.mint-off-canvas-panel`);if(!t)return;let n=this._getDialogFocusableElements(t);if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||!t.contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===i||!t.contains(a))&&(e.preventDefault(),r.focus())},document.addEventListener(`keydown`,this._dialogKeydownHandler,!0)}disconnectedCallback(){this._dialogKeydownHandler&&=(document.removeEventListener(`keydown`,this._dialogKeydownHandler,!0),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null),this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null),this._enterPending=!1,this._exitPending=!1}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}getPosition(){let e=this.getAttribute(`position`)?.toLowerCase();return e===`top`||e===`bottom`||e===`left`||e===`right`?e:`right`}isFullPage(){return this.getAttribute(`full-page`)===`true`}getWidth(){return this.getAttribute(`width`)||`320px`}getHeight(){return this.getAttribute(`height`)||``}_normalizeCssValue(e){return/^\d+(\.\d+)?$/.test(e.trim())?`${e.trim()}px`:e.trim()}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen(),r=this.getPosition(),i=this.isFullPage(),a=this.getHeight();e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`mint-off-canvas-overlay`,this._overlay.setAttribute(`aria-hidden`,`true`),this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._offCanvas||(this._offCanvas=document.createElement(`div`),this.appendChild(this._offCanvas)),this._offCanvas.className=`mint-off-canvas-shell`,this._offCanvas.dataset.position=r,this._offCanvas.dataset.fullPage=String(i);let o=this._offCanvas.querySelector(`.mint-off-canvas-panel`);o||(o=document.createElement(`div`),o.className=`mint-off-canvas-panel`,o.style.transform=this._getTransformValue(r,!1),this._offCanvas.appendChild(o)),o.setAttribute(`role`,`dialog`),o.setAttribute(`aria-modal`,`true`),o.hasAttribute(`tabindex`)||(o.tabIndex=-1),n?this._animateEnter():this._animateExit(),o.style.removeProperty(`--off-canvas-width`),o.style.removeProperty(`--off-canvas-height`),r===`top`||r===`bottom`?a&&o.style.setProperty(`--off-canvas-height`,this._normalizeCssValue(a)):o.style.setProperty(`--off-canvas-width`,this._normalizeCssValue(this.getWidth())),this._header||(this._header=document.createElement(`div`),this._header.className=`mint-off-canvas-header`,o.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`mint-off-canvas-heading`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let s=this._headingSlot.querySelector(`mint-text`);if(t?(s||(s=document.createElement(`mint-text`),s.setAttribute(`size`,`sub-heading`),s.setAttribute(`bold`,`true`),this._headingSlot.appendChild(s)),s.textContent=t,s.id=`${e||`mint-off-canvas`}-heading`,o.setAttribute(`aria-labelledby`,s.id),o.removeAttribute(`aria-label`)):s&&s.remove(),!t){let e=this.getAttribute(`aria-label`)?.trim();e?o.setAttribute(`aria-label`,e):o.hasAttribute(`aria-label`)||o.setAttribute(`aria-label`,`Dialog`)}Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{this._headingSlot&&e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-button`),this._closeButton.setAttribute(`variant`,`ghost`),this._closeButton.setAttribute(`icon`,`close`),this._closeButton.setAttribute(`aria-label`,`Close panel`),this._closeButton.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`mint-off-canvas-body`,this._bodySlot.setAttribute(`slot`,`body`),o.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{this._bodySlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`mint-off-canvas-actions`,this._actionsSlot.setAttribute(`slot`,`actions`),o.appendChild(this._actionsSlot));let c=this._actionsSlot.querySelector(`mint-stack`);c||(c=document.createElement(`mint-stack`),c.setAttribute(`direction`,`horizontal`),c.className=`mint-off-canvas-actions-stack`,this._actionsSlot.appendChild(c)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==c&&c.appendChild(e)}),e.parentElement&&e.remove()}),Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._offCanvas&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)})}_getTransformValue(e,t){if(t)switch(e){case`top`:return`translateY(0)`;case`bottom`:return`translateY(0)`;case`left`:return`translateX(0)`;case`right`:return`translateX(0)`;default:return`translateX(0)`}else switch(e){case`top`:return`translateY(-100%)`;case`bottom`:return`translateY(100%)`;case`left`:return`translateX(-100%)`;case`right`:return`translateX(100%)`;default:return`translateX(100%)`}}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_getDialogFocusableElements(e){return Array.from(e.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>{if(e.closest(`[hidden], [aria-hidden="true"]`))return!1;let t=window.getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}_animateEnter(){let e=this._offCanvas?.querySelector(`.mint-off-canvas-panel`);if(!e||(this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null),this._exitPending=!1,this._enterPending||this.classList.contains(`mint-off-canvas-open`)))return;this._enterPending=!0;let t=this.getPosition(),n=!this._dialogWasOpen;if(n){this._dialogWasOpen=!0;let e=document.activeElement;this._previousFocus=e instanceof HTMLElement&&e!==document.body?e:null}e.style.transition=`none`,e.style.transform=this._getTransformValue(t,!1),this.style.display=`block`,this.classList.remove(`mint-off-canvas-hidden`),e.getBoundingClientRect(),e.style.transition=`transform 200ms ease-out`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(!this.isOpen()){this._enterPending=!1;return}this.classList.add(`mint-off-canvas-open`),e.style.transform=this._getTransformValue(t,!0),this._enterPending=!1,n&&(this._getDialogFocusableElements(e)[0]??e).focus()})})}_animateExit(){if(this.classList.contains(`mint-off-canvas-hidden`)||this._exitPending)return;this._enterPending=!1,this._exitPending=!0,this.classList.remove(`mint-off-canvas-open`);let e=this._offCanvas?.querySelector(`.mint-off-canvas-panel`);if(!e){this.classList.add(`mint-off-canvas-hidden`),this.style.display=`none`,this._dialogWasOpen=!1,this._exitPending=!1;return}let t=this.getPosition();e.style.transition=`transform 200ms ease-in`,e.style.transform=this._getTransformValue(t,!1),this._exitTimer!==null&&clearTimeout(this._exitTimer),this._exitTimer=window.setTimeout(()=>{if(this._exitTimer=null,this.isOpen())return;this.classList.add(`mint-off-canvas-hidden`),this.style.display=`none`,e.style.transform=``,e.style.transition=``,this._exitPending=!1;let t=this._previousFocus;this._previousFocus=null,t?.isConnected&&t.focus()},200)}};customElements.get(`mint-off-canvas`)||e.t(`mint-off-canvas`,t),module.exports=t;
1
+ require(`../chunks/icon-B9P0jyS2.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/text-CfvRRKGZ.js`),require(`../chunks/button-B4BMYTk1.js`),require(`../chunks/stack-CK2o4-As.js`);var t=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`,`position`,`full-page`,`width`,`height`]}constructor(){super(),this._overlay=null,this._offCanvas=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._contentObserver=null,this._renderFrame=null,this._enterFrame=null,this._exitTimer=null,this._previousFocus=null,this._dialogWasOpen=!1,this._dialogKeydownHandler=null}connectedCallback(){this.classList.add(`mint-off-canvas-host`),this.style.display=`none`,this.render(),this._observeContentMutations(),this._dialogKeydownHandler=e=>{if(!this.isOpen())return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this.close();return}if(e.key!==`Tab`)return;let t=this._offCanvas?.querySelector(`.mint-off-canvas-panel`);if(!t)return;let n=this._getDialogFocusableElements(t);if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||!t.contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===i||!t.contains(a))&&(e.preventDefault(),r.focus())},document.addEventListener(`keydown`,this._dialogKeydownHandler,!0)}disconnectedCallback(){this._dialogKeydownHandler&&=(document.removeEventListener(`keydown`,this._dialogKeydownHandler,!0),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null),this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null),this._enterFrame!==null&&(cancelAnimationFrame(this._enterFrame),this._enterFrame=null),this._overlay?.remove(),this._offCanvas?.remove()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}getPosition(){let e=this.getAttribute(`position`)?.toLowerCase();return e===`top`||e===`bottom`||e===`left`||e===`right`?e:`right`}isFullPage(){return this.getAttribute(`full-page`)===`true`}getWidth(){return this.getAttribute(`width`)||`320px`}getHeight(){return this.getAttribute(`height`)||``}_normalizeCssValue(e){return/^\d+(\.\d+)?$/.test(e.trim())?`${e.trim()}px`:e.trim()}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen(),r=this.getPosition(),i=this.isFullPage(),a=this.getHeight();e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`mint-off-canvas-overlay mint-off-canvas-hidden`,this._overlay.setAttribute(`aria-hidden`,`true`),this._overlay.addEventListener(`click`,()=>this.close())),this._offCanvas||(this._offCanvas=document.createElement(`div`),this._offCanvas.className=`mint-off-canvas-shell mint-off-canvas-hidden`);let o=document.body??document.documentElement;this._overlay.parentElement!==o&&o.appendChild(this._overlay),this._offCanvas.parentElement!==o&&o.appendChild(this._offCanvas),this._offCanvas.classList.add(`mint-off-canvas-shell`),this._offCanvas.dataset.position=r,this._offCanvas.dataset.fullPage=String(i);let s=this._offCanvas.querySelector(`.mint-off-canvas-panel`);s||(s=document.createElement(`div`),s.className=`mint-off-canvas-panel`,this._offCanvas.appendChild(s)),s.setAttribute(`role`,`dialog`),s.setAttribute(`aria-modal`,`true`),s.hasAttribute(`tabindex`)||(s.tabIndex=-1),s.style.removeProperty(`--off-canvas-width`),s.style.removeProperty(`--off-canvas-height`),r===`top`||r===`bottom`?a&&s.style.setProperty(`--off-canvas-height`,this._normalizeCssValue(a)):s.style.setProperty(`--off-canvas-width`,this._normalizeCssValue(this.getWidth())),this._header||(this._header=document.createElement(`div`),this._header.className=`mint-off-canvas-header`,s.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`mint-off-canvas-heading`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let c=this._headingSlot.querySelector(`mint-text`);if(t?(c||(c=document.createElement(`mint-text`),c.setAttribute(`size`,`sub-heading`),c.setAttribute(`bold`,`true`),this._headingSlot.appendChild(c)),c.textContent=t,c.id=`${e||`mint-off-canvas`}-heading`,s.setAttribute(`aria-labelledby`,c.id),s.removeAttribute(`aria-label`)):c&&c.remove(),!t){let e=this.getAttribute(`aria-label`)?.trim();e?s.setAttribute(`aria-label`,e):s.hasAttribute(`aria-label`)||s.setAttribute(`aria-label`,`Dialog`)}Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{this._headingSlot&&e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-button`),this._closeButton.setAttribute(`variant`,`ghost`),this._closeButton.setAttribute(`icon`,`close`),this._closeButton.setAttribute(`aria-label`,`Close panel`),this._closeButton.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`mint-off-canvas-body`,this._bodySlot.setAttribute(`slot`,`body`),s.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{this._bodySlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`mint-off-canvas-actions`,this._actionsSlot.setAttribute(`slot`,`actions`),s.appendChild(this._actionsSlot));let l=this._actionsSlot.querySelector(`mint-stack`);l||(l=document.createElement(`mint-stack`),l.setAttribute(`direction`,`horizontal`),l.className=`mint-off-canvas-actions-stack`,this._actionsSlot.appendChild(l)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==l&&l.appendChild(e)}),e.parentElement&&e.remove()}),Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._offCanvas&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),n?this._animateEnter():this._animateExit()}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_getDialogFocusableElements(e){return Array.from(e.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>{if(e.closest(`[hidden], [aria-hidden="true"]`))return!1;let t=window.getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}_animateEnter(){let e=this._offCanvas?.querySelector(`.mint-off-canvas-panel`),t=this._offCanvas,n=this._overlay;if(!e||!t||!n||this._enterFrame!==null||t.classList.contains(`mint-off-canvas-open`))return;this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null);let r=!this._dialogWasOpen;if(r){this._dialogWasOpen=!0;let e=document.activeElement;this._previousFocus=e instanceof HTMLElement&&e!==document.body?e:null}n.classList.remove(`mint-off-canvas-hidden`,`mint-off-canvas-open`),t.classList.remove(`mint-off-canvas-hidden`,`mint-off-canvas-open`),e.getBoundingClientRect(),this._enterFrame=requestAnimationFrame(()=>{this._enterFrame=null,this.isOpen()&&(n.classList.add(`mint-off-canvas-open`),t.classList.add(`mint-off-canvas-open`),r&&(this._getDialogFocusableElements(e)[0]??e).focus())})}_animateExit(){let e=this._offCanvas,t=this._overlay;if(!(!e||!t||e.classList.contains(`mint-off-canvas-hidden`))){if(!this._offCanvas?.querySelector(`.mint-off-canvas-panel`)){t.classList.add(`mint-off-canvas-hidden`),e.classList.add(`mint-off-canvas-hidden`),this._dialogWasOpen=!1;return}if(this._enterFrame!==null){cancelAnimationFrame(this._enterFrame),this._enterFrame=null,t.classList.add(`mint-off-canvas-hidden`),e.classList.add(`mint-off-canvas-hidden`),this._dialogWasOpen=!1;let n=this._previousFocus;this._previousFocus=null,n?.isConnected&&n.focus();return}e.classList.contains(`mint-off-canvas-open`)&&(t.classList.remove(`mint-off-canvas-open`),e.classList.remove(`mint-off-canvas-open`),this._exitTimer!==null&&clearTimeout(this._exitTimer),this._exitTimer=window.setTimeout(()=>{this._finishExit()},220))}}_finishExit(){if(this.isOpen())return;this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null),this._overlay?.classList.add(`mint-off-canvas-hidden`),this._offCanvas?.classList.add(`mint-off-canvas-hidden`),this._dialogWasOpen=!1;let e=this._previousFocus;this._previousFocus=null,e?.isConnected&&e.focus()}};customElements.get(`mint-off-canvas`)||e.t(`mint-off-canvas`,t),module.exports=t;
@@ -24,10 +24,10 @@ var t = class extends HTMLElement {
24
24
  ];
25
25
  }
26
26
  constructor() {
27
- super(), this._overlay = null, this._offCanvas = null, this._header = null, this._headingSlot = null, this._bodySlot = null, this._actionsSlot = null, this._closeButton = null, this._contentObserver = null, this._renderFrame = null, this._exitTimer = null, this._enterPending = !1, this._exitPending = !1, this._previousFocus = null, this._dialogWasOpen = !1, this._dialogKeydownHandler = null;
27
+ super(), this._overlay = null, this._offCanvas = null, this._header = null, this._headingSlot = null, this._bodySlot = null, this._actionsSlot = null, this._closeButton = null, this._contentObserver = null, this._renderFrame = null, this._enterFrame = null, this._exitTimer = null, this._previousFocus = null, this._dialogWasOpen = !1, this._dialogKeydownHandler = null;
28
28
  }
29
29
  connectedCallback() {
30
- this.classList.add("mint-off-canvas-host"), this.isOpen() || (this.classList.add("mint-off-canvas-hidden"), this.style.display = "none"), this.render(), this._observeContentMutations(), this._dialogKeydownHandler = (e) => {
30
+ this.classList.add("mint-off-canvas-host"), this.style.display = "none", this.render(), this._observeContentMutations(), this._dialogKeydownHandler = (e) => {
31
31
  if (!this.isOpen()) return;
32
32
  if (e.key === "Escape") {
33
33
  e.preventDefault(), e.stopPropagation(), this.close();
@@ -46,7 +46,7 @@ var t = class extends HTMLElement {
46
46
  }, document.addEventListener("keydown", this._dialogKeydownHandler, !0);
47
47
  }
48
48
  disconnectedCallback() {
49
- this._dialogKeydownHandler &&= (document.removeEventListener("keydown", this._dialogKeydownHandler, !0), null), this._contentObserver &&= (this._contentObserver.disconnect(), null), this._renderFrame !== null && (cancelAnimationFrame(this._renderFrame), this._renderFrame = null), this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null), this._enterPending = !1, this._exitPending = !1;
49
+ this._dialogKeydownHandler &&= (document.removeEventListener("keydown", this._dialogKeydownHandler, !0), null), this._contentObserver &&= (this._contentObserver.disconnect(), null), this._renderFrame !== null && (cancelAnimationFrame(this._renderFrame), this._renderFrame = null), this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null), this._enterFrame !== null && (cancelAnimationFrame(this._enterFrame), this._enterFrame = null), this._overlay?.remove(), this._offCanvas?.remove();
50
50
  }
51
51
  attributeChangedCallback(e, t, n) {
52
52
  t !== n && this.isConnected && this.render();
@@ -89,43 +89,29 @@ var t = class extends HTMLElement {
89
89
  }
90
90
  render() {
91
91
  let e = this.getId(), t = this.getHeading(), n = this.isOpen(), r = this.getPosition(), i = this.isFullPage(), a = this.getHeight();
92
- e && (this.id = e), this._overlay || (this._overlay = document.createElement("div"), this._overlay.className = "mint-off-canvas-overlay", this._overlay.setAttribute("aria-hidden", "true"), this._overlay.addEventListener("click", () => this.close()), this.appendChild(this._overlay)), this._offCanvas || (this._offCanvas = document.createElement("div"), this.appendChild(this._offCanvas)), this._offCanvas.className = "mint-off-canvas-shell", this._offCanvas.dataset.position = r, this._offCanvas.dataset.fullPage = String(i);
93
- let o = this._offCanvas.querySelector(".mint-off-canvas-panel");
94
- o || (o = document.createElement("div"), o.className = "mint-off-canvas-panel", o.style.transform = this._getTransformValue(r, !1), this._offCanvas.appendChild(o)), o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.hasAttribute("tabindex") || (o.tabIndex = -1), n ? this._animateEnter() : this._animateExit(), o.style.removeProperty("--off-canvas-width"), o.style.removeProperty("--off-canvas-height"), r === "top" || r === "bottom" ? a && o.style.setProperty("--off-canvas-height", this._normalizeCssValue(a)) : o.style.setProperty("--off-canvas-width", this._normalizeCssValue(this.getWidth())), this._header || (this._header = document.createElement("div"), this._header.className = "mint-off-canvas-header", o.appendChild(this._header)), this._headingSlot || (this._headingSlot = document.createElement("div"), this._headingSlot.className = "mint-off-canvas-heading", this._headingSlot.setAttribute("slot", "heading"), this._header.appendChild(this._headingSlot));
95
- let s = this._headingSlot.querySelector("mint-text");
96
- if (t ? (s || (s = document.createElement("mint-text"), s.setAttribute("size", "sub-heading"), s.setAttribute("bold", "true"), this._headingSlot.appendChild(s)), s.textContent = t, s.id = `${e || "mint-off-canvas"}-heading`, o.setAttribute("aria-labelledby", s.id), o.removeAttribute("aria-label")) : s && s.remove(), !t) {
92
+ e && (this.id = e), this._overlay || (this._overlay = document.createElement("div"), this._overlay.className = "mint-off-canvas-overlay mint-off-canvas-hidden", this._overlay.setAttribute("aria-hidden", "true"), this._overlay.addEventListener("click", () => this.close())), this._offCanvas || (this._offCanvas = document.createElement("div"), this._offCanvas.className = "mint-off-canvas-shell mint-off-canvas-hidden");
93
+ let o = document.body ?? document.documentElement;
94
+ this._overlay.parentElement !== o && o.appendChild(this._overlay), this._offCanvas.parentElement !== o && o.appendChild(this._offCanvas), this._offCanvas.classList.add("mint-off-canvas-shell"), this._offCanvas.dataset.position = r, this._offCanvas.dataset.fullPage = String(i);
95
+ let s = this._offCanvas.querySelector(".mint-off-canvas-panel");
96
+ s || (s = document.createElement("div"), s.className = "mint-off-canvas-panel", this._offCanvas.appendChild(s)), s.setAttribute("role", "dialog"), s.setAttribute("aria-modal", "true"), s.hasAttribute("tabindex") || (s.tabIndex = -1), s.style.removeProperty("--off-canvas-width"), s.style.removeProperty("--off-canvas-height"), r === "top" || r === "bottom" ? a && s.style.setProperty("--off-canvas-height", this._normalizeCssValue(a)) : s.style.setProperty("--off-canvas-width", this._normalizeCssValue(this.getWidth())), this._header || (this._header = document.createElement("div"), this._header.className = "mint-off-canvas-header", s.appendChild(this._header)), this._headingSlot || (this._headingSlot = document.createElement("div"), this._headingSlot.className = "mint-off-canvas-heading", this._headingSlot.setAttribute("slot", "heading"), this._header.appendChild(this._headingSlot));
97
+ let c = this._headingSlot.querySelector("mint-text");
98
+ if (t ? (c || (c = document.createElement("mint-text"), c.setAttribute("size", "sub-heading"), c.setAttribute("bold", "true"), this._headingSlot.appendChild(c)), c.textContent = t, c.id = `${e || "mint-off-canvas"}-heading`, s.setAttribute("aria-labelledby", c.id), s.removeAttribute("aria-label")) : c && c.remove(), !t) {
97
99
  let e = this.getAttribute("aria-label")?.trim();
98
- e ? o.setAttribute("aria-label", e) : o.hasAttribute("aria-label") || o.setAttribute("aria-label", "Dialog");
100
+ e ? s.setAttribute("aria-label", e) : s.hasAttribute("aria-label") || s.setAttribute("aria-label", "Dialog");
99
101
  }
100
102
  Array.from(this.children).filter((e) => e !== this._overlay && e !== this._offCanvas && e !== this._headingSlot && e.getAttribute("slot") === "heading").forEach((e) => {
101
103
  this._headingSlot && e.parentElement !== this._headingSlot && this._headingSlot.appendChild(e);
102
- }), this._closeButton || (this._closeButton = document.createElement("mint-button"), this._closeButton.setAttribute("variant", "ghost"), this._closeButton.setAttribute("icon", "close"), this._closeButton.setAttribute("aria-label", "Close panel"), this._closeButton.addEventListener("click", () => this.close()), this._header.appendChild(this._closeButton)), this._bodySlot || (this._bodySlot = document.createElement("div"), this._bodySlot.className = "mint-off-canvas-body", this._bodySlot.setAttribute("slot", "body"), o.appendChild(this._bodySlot)), Array.from(this.children).filter((e) => e !== this._overlay && e !== this._offCanvas && e !== this._bodySlot && e.getAttribute("slot") === "body").forEach((e) => {
104
+ }), this._closeButton || (this._closeButton = document.createElement("mint-button"), this._closeButton.setAttribute("variant", "ghost"), this._closeButton.setAttribute("icon", "close"), this._closeButton.setAttribute("aria-label", "Close panel"), this._closeButton.addEventListener("click", () => this.close()), this._header.appendChild(this._closeButton)), this._bodySlot || (this._bodySlot = document.createElement("div"), this._bodySlot.className = "mint-off-canvas-body", this._bodySlot.setAttribute("slot", "body"), s.appendChild(this._bodySlot)), Array.from(this.children).filter((e) => e !== this._overlay && e !== this._offCanvas && e !== this._bodySlot && e.getAttribute("slot") === "body").forEach((e) => {
103
105
  this._bodySlot && e.parentElement !== this._bodySlot && this._bodySlot.appendChild(e);
104
- }), this._actionsSlot || (this._actionsSlot = document.createElement("div"), this._actionsSlot.className = "mint-off-canvas-actions", this._actionsSlot.setAttribute("slot", "actions"), o.appendChild(this._actionsSlot));
105
- let c = this._actionsSlot.querySelector("mint-stack");
106
- c || (c = document.createElement("mint-stack"), c.setAttribute("direction", "horizontal"), c.className = "mint-off-canvas-actions-stack", this._actionsSlot.appendChild(c)), Array.from(this.children).filter((e) => e !== this._overlay && e !== this._offCanvas && e !== this._actionsSlot && e.getAttribute("slot") === "actions").forEach((e) => {
106
+ }), this._actionsSlot || (this._actionsSlot = document.createElement("div"), this._actionsSlot.className = "mint-off-canvas-actions", this._actionsSlot.setAttribute("slot", "actions"), s.appendChild(this._actionsSlot));
107
+ let l = this._actionsSlot.querySelector("mint-stack");
108
+ l || (l = document.createElement("mint-stack"), l.setAttribute("direction", "horizontal"), l.className = "mint-off-canvas-actions-stack", this._actionsSlot.appendChild(l)), Array.from(this.children).filter((e) => e !== this._overlay && e !== this._offCanvas && e !== this._actionsSlot && e.getAttribute("slot") === "actions").forEach((e) => {
107
109
  Array.from(e.children).forEach((e) => {
108
- e.parentElement !== c && c.appendChild(e);
110
+ e.parentElement !== l && l.appendChild(e);
109
111
  }), e.parentElement && e.remove();
110
112
  }), Array.from(this.children).forEach((e) => {
111
113
  e !== this._overlay && e !== this._offCanvas && e.getAttribute("slot") !== "heading" && e.getAttribute("slot") !== "body" && e.getAttribute("slot") !== "actions" && e !== this._headingSlot && e !== this._bodySlot && e !== this._actionsSlot && e.parentElement !== this._bodySlot && this._bodySlot.appendChild(e);
112
- });
113
- }
114
- _getTransformValue(e, t) {
115
- if (t) switch (e) {
116
- case "top": return "translateY(0)";
117
- case "bottom": return "translateY(0)";
118
- case "left": return "translateX(0)";
119
- case "right": return "translateX(0)";
120
- default: return "translateX(0)";
121
- }
122
- else switch (e) {
123
- case "top": return "translateY(-100%)";
124
- case "bottom": return "translateY(100%)";
125
- case "left": return "translateX(-100%)";
126
- case "right": return "translateX(100%)";
127
- default: return "translateX(100%)";
128
- }
114
+ }), n ? this._animateEnter() : this._animateExit();
129
115
  }
130
116
  _observeContentMutations() {
131
117
  this._contentObserver ||= new MutationObserver(() => {
@@ -144,40 +130,42 @@ var t = class extends HTMLElement {
144
130
  });
145
131
  }
146
132
  _animateEnter() {
147
- let e = this._offCanvas?.querySelector(".mint-off-canvas-panel");
148
- if (!e || (this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null), this._exitPending = !1, this._enterPending || this.classList.contains("mint-off-canvas-open"))) return;
149
- this._enterPending = !0;
150
- let t = this.getPosition(), n = !this._dialogWasOpen;
151
- if (n) {
133
+ let e = this._offCanvas?.querySelector(".mint-off-canvas-panel"), t = this._offCanvas, n = this._overlay;
134
+ if (!e || !t || !n || this._enterFrame !== null || t.classList.contains("mint-off-canvas-open")) return;
135
+ this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null);
136
+ let r = !this._dialogWasOpen;
137
+ if (r) {
152
138
  this._dialogWasOpen = !0;
153
139
  let e = document.activeElement;
154
140
  this._previousFocus = e instanceof HTMLElement && e !== document.body ? e : null;
155
141
  }
156
- e.style.transition = "none", e.style.transform = this._getTransformValue(t, !1), this.style.display = "block", this.classList.remove("mint-off-canvas-hidden"), e.getBoundingClientRect(), e.style.transition = "transform 200ms ease-out", requestAnimationFrame(() => {
157
- requestAnimationFrame(() => {
158
- if (!this.isOpen()) {
159
- this._enterPending = !1;
160
- return;
161
- }
162
- this.classList.add("mint-off-canvas-open"), e.style.transform = this._getTransformValue(t, !0), this._enterPending = !1, n && (this._getDialogFocusableElements(e)[0] ?? e).focus();
163
- });
142
+ n.classList.remove("mint-off-canvas-hidden", "mint-off-canvas-open"), t.classList.remove("mint-off-canvas-hidden", "mint-off-canvas-open"), e.getBoundingClientRect(), this._enterFrame = requestAnimationFrame(() => {
143
+ this._enterFrame = null, this.isOpen() && (n.classList.add("mint-off-canvas-open"), t.classList.add("mint-off-canvas-open"), r && (this._getDialogFocusableElements(e)[0] ?? e).focus());
164
144
  });
165
145
  }
166
146
  _animateExit() {
167
- if (this.classList.contains("mint-off-canvas-hidden") || this._exitPending) return;
168
- this._enterPending = !1, this._exitPending = !0, this.classList.remove("mint-off-canvas-open");
169
- let e = this._offCanvas?.querySelector(".mint-off-canvas-panel");
170
- if (!e) {
171
- this.classList.add("mint-off-canvas-hidden"), this.style.display = "none", this._dialogWasOpen = !1, this._exitPending = !1;
172
- return;
147
+ let e = this._offCanvas, t = this._overlay;
148
+ if (!(!e || !t || e.classList.contains("mint-off-canvas-hidden"))) {
149
+ if (!this._offCanvas?.querySelector(".mint-off-canvas-panel")) {
150
+ t.classList.add("mint-off-canvas-hidden"), e.classList.add("mint-off-canvas-hidden"), this._dialogWasOpen = !1;
151
+ return;
152
+ }
153
+ if (this._enterFrame !== null) {
154
+ cancelAnimationFrame(this._enterFrame), this._enterFrame = null, t.classList.add("mint-off-canvas-hidden"), e.classList.add("mint-off-canvas-hidden"), this._dialogWasOpen = !1;
155
+ let n = this._previousFocus;
156
+ this._previousFocus = null, n?.isConnected && n.focus();
157
+ return;
158
+ }
159
+ e.classList.contains("mint-off-canvas-open") && (t.classList.remove("mint-off-canvas-open"), e.classList.remove("mint-off-canvas-open"), this._exitTimer !== null && clearTimeout(this._exitTimer), this._exitTimer = window.setTimeout(() => {
160
+ this._finishExit();
161
+ }, 220));
173
162
  }
174
- let t = this.getPosition();
175
- e.style.transition = "transform 200ms ease-in", e.style.transform = this._getTransformValue(t, !1), this._exitTimer !== null && clearTimeout(this._exitTimer), this._exitTimer = window.setTimeout(() => {
176
- if (this._exitTimer = null, this.isOpen()) return;
177
- this.classList.add("mint-off-canvas-hidden"), this.style.display = "none", e.style.transform = "", e.style.transition = "", this._exitPending = !1;
178
- let t = this._previousFocus;
179
- this._previousFocus = null, t?.isConnected && t.focus();
180
- }, 200);
163
+ }
164
+ _finishExit() {
165
+ if (this.isOpen()) return;
166
+ this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null), this._overlay?.classList.add("mint-off-canvas-hidden"), this._offCanvas?.classList.add("mint-off-canvas-hidden"), this._dialogWasOpen = !1;
167
+ let e = this._previousFocus;
168
+ this._previousFocus = null, e?.isConnected && e.focus();
181
169
  }
182
170
  };
183
171
  customElements.get("mint-off-canvas") || e("mint-off-canvas", t);