@florid-kit/components 0.10.21 → 0.10.22

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.
@@ -33,6 +33,7 @@ export declare class OccitaneSidePanel extends LitElement {
33
33
  showDetail: boolean;
34
34
  isHidingDetail: boolean;
35
35
  private previousFocusedElement;
36
+ private previousFocusedSelector;
36
37
  static styles: import('lit').CSSResult;
37
38
  static focusablesSelector: string;
38
39
  static focusablesCustomElementsSelector: string;
package/index.js CHANGED
@@ -374,7 +374,7 @@
374
374
  .sr-only {
375
375
  display: none;
376
376
  }
377
- `;R([a({type:String,reflect:!0})],B.prototype,"bgstyle",2);R([a({type:String,reflect:!0})],B.prototype,"size",2);R([a({type:String,reflect:!0})],B.prototype,"status",2);R([a({type:String,reflect:!0})],B.prototype,"type",2);R([a({type:String})],B.prototype,"strokewidth",2);R([a({type:String})],B.prototype,"icon",2);R([a({type:Boolean,reflect:!0})],B.prototype,"disabled",2);R([a({type:Boolean})],B.prototype,"showSrLabel",2);R([a({type:String})],B.prototype,"srLabel",2);B=R([b("o-icon-button")],B);var Ro=Object.defineProperty,Uo=Object.getOwnPropertyDescriptor,y=(o,t,e,n)=>{for(var i=n>1?void 0:n?Uo(t,e):t,r=o.length-1,s;r>=0;r--)(s=o[r])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&Ro(t,e,i),i};let p=class extends u{constructor(){super(...arguments),this.open=!1,this.showHeader=!0,this.showFooter=!1,this.showHeaderStartIcon=!1,this.headerTitle="",this.headerTitleClassName="panel-title",this.labelDialog="",this.addToBagProductCount="",this.closeButtonLabel="Close the modal",this.goBackButtonLabel="Go back to",this.firstButtonLabel="Close",this.firstButtonVariant="primary",this.firstButtonProps={},this.onFirstButtonClickClose=!1,this.secondButtonLabel="",this.secondButtonVariant="secondary",this.secondButtonProps={},this.onSecondButtonClickClose=!1,this.disablePortal=!1,this.zIndex=99,this.initialized=!1,this.showDetail=!1,this.isHidingDetail=!1,this.previousFocusedElement=null,this._onOpenDetail=async o=>{var e,n;const t=((e=o.detail)==null?void 0:e.origin)??document.activeElement;if(this._detailOriginEl=t,this._detailOriginClass=(t==null?void 0:t.className)??"",this.showDetail=!0,this.showHeaderStartIcon=!0,await this.updateComplete,this._detailOriginClass){const i=(n=this.shadowRoot)==null?void 0:n.querySelector(".detail-view");i&&i.setAttribute("fromelement",this._detailOriginClass)}await this.focusDetailReturnBtn()},this._detailOriginEl=null,this._detailOriginClass="",this.handleKeyDown=o=>{this.open&&(o.key==="Escape"?this.closePanel():o.key==="Tab"&&this.trapFocus(o))},this.handleClosePanel=o=>{if(o instanceof KeyboardEvent&&o.key!=="Enter"&&o.key!==" ")return;o.preventDefault(),o.stopPropagation();const t=o.currentTarget,e=(t==null?void 0:t.getAttribute("data-role"))==="back";if(this.showDetail&&e){this.isHidingDetail=!0;const n=this.renderRoot.querySelector(".content"),i=async()=>{this.showDetail=!1,this.isHidingDetail=!1,this.showHeaderStartIcon=!1,await this.updateComplete,this._restoreFocusToOrigin()};if(n){this.showHeaderStartIcon=!1;const r=()=>{this.showDetail=!1,this.isHidingDetail=!1,n.removeEventListener("animationend",r),i()};n.addEventListener("animationend",r)}else this.showDetail=!1,this.isHidingDetail=!1,this.showHeaderStartIcon=!1;return}this.closePanel()}}focusFirstInPanel(){var t,e,n;(n=this.getFocusableElements().map(i=>this.resolveFocusable(i)).filter(i=>!!i&&!i.hasAttribute("disabled"))[0]??((t=this.shadowRoot)==null?void 0:t.querySelector(".close-btn"))??((e=this.shadowRoot)==null?void 0:e.querySelector(".panel")))==null||n.focus({preventScroll:!0})}resolveFocusable(o){var e;const t=o.tagName.toLowerCase();return t==="o-icon-button"||t==="o-button"?((e=o.shadowRoot)==null?void 0:e.querySelector("button, .button"))??o:o}connectedCallback(){super.connectedCallback(),!this.disablePortal&&this.parentElement!==document.body&&document.body.appendChild(this),this.addEventListener("keydown",this.handleKeyDown),this.updateComplete.then(()=>{this.initialized=!0}),this.addEventListener("open-detail",this._onOpenDetail),this.addEventListener("focusin",o=>{o.composedPath()[0]===this&&this.focusFirstInPanel()})}disconnectedCallback(){document.body.style.overflow="",document.body.removeAttribute("data-side-panel"),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback(),this.removeEventListener("open-detail",this._onOpenDetail)}async focusDetailReturnBtn(){var i,r,s,c,h;await this.updateComplete;const o=this.getDeepActiveElement(document);if(o&&o!==document.body)try{o.blur()}catch{}await new Promise(requestAnimationFrame);const t=(i=this.shadowRoot)==null?void 0:i.querySelector(".detail-view .return-btn");if(!t)return;t.updateComplete&&await t.updateComplete,(c=(s=((r=t.shadowRoot)==null?void 0:r.querySelector("button"))??t)==null?void 0:s.focus)==null||c.call(s,{preventScroll:!0});const n=(h=this.shadowRoot)==null?void 0:h.querySelector('.panel[role="dialog"]');n&&n.setAttribute("aria-label",this.headerTitle)}_restoreFocusToOrigin(){var t,e;const o=this._detailOriginEl;!o||!document.contains(o)||((e=(t=document.activeElement)==null?void 0:t.blur)==null||e.call(t),requestAnimationFrame(()=>{var i;o.classList.add("a--tabfocus"),(((i=o.shadowRoot)==null?void 0:i.querySelector('button, .button, [tabindex]:not([tabindex="-1"])'))??null??o).focus({preventScroll:!0})}))}getDeepActiveElement(o=this.shadowRoot){let t=o.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}trapFocus(o){var r;if(o.key!=="Tab")return;const t=this.shadowRoot;if(!t)return;const e=this.getDeepActiveElement();if(this.showDetail){const s=t.querySelector(".detail-view .return-btn"),c=t.querySelector(".detail-view .close-btn"),h=s?this.resolveFocusable(s):null,f=c?this.resolveFocusable(c):null;if(o.shiftKey&&h&&e===h&&f){o.preventDefault(),o.stopPropagation(),f.focus({preventScroll:!0});return}if(!o.shiftKey&&f&&e===f){o.preventDefault(),o.stopPropagation(),(((r=t.querySelector(".detail-scroller"))==null?void 0:r.querySelector(p.focusablesSelector))??h??f).focus({preventScroll:!0});return}}if(document.querySelector("#refineandsortpopin")){const s=t.querySelector(".close-btn"),c=s?this.resolveFocusable(s):null,h=t.querySelector(".js-clear-refinements"),f=h?this.resolveFocusable(h):null,x=g=>{o.preventDefault(),o.stopPropagation(),g.focus({preventScroll:!0})};if(c&&f){if(!o.shiftKey&&e===f)return x(c);if(o.shiftKey&&e===c)return x(f)}}const i=this.renderRoot.querySelector(".close-btn");if(!o.shiftKey&&i&&i.contains(e)){o.preventDefault();const s=this.renderRoot.querySelector(".o-whats-inside--content p");s==null||s.focus()}}getFocusableElements(){const o=this.renderRoot.querySelector(".panel");if(!o)return[];function t(i){return!(i.disabled||i.hasAttribute("disabled")||i.hasAttribute("tabindex")&&i.getAttribute("tabindex")==="-1")}function e(i){var s;const r=[i.matches(p.focusablesSelector)?i:[]];if(!["o-icon-button","o-button"].includes(i.tagName.toLowerCase())){const c=Array.from(i instanceof HTMLSlotElement?i.assignedElements({flatten:!0}):[]).filter(t).flatMap(e),h=Array.from(((s=i.shadowRoot)==null?void 0:s.querySelectorAll("*"))||[]).filter(t).flatMap(e);r.push(...c,...h)}return r.flat()}return Array.from(o.querySelectorAll("*")).filter(t).flatMap(e)}openPanel(){this.removeAttribute("hidden"),this.getBoundingClientRect(),this.previousFocusedElement=document.activeElement,this.open=!0,document.body.style.overflow="hidden",document.body.setAttribute("data-side-panel","open");const o=this.renderRoot.querySelector(".panel");o&&o.setAttribute("aria-modal","true"),this.updateComplete.then(()=>{var t,e;if(this.showHeader){const n=(t=this.shadowRoot)==null?void 0:t.querySelector(".panel .close-btn"),i=this.resolveFocusable(n);(e=i==null?void 0:i.focus)==null||e.call(i,{preventScroll:!0})}else this.focusFirstInPanel()}),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0}))}closePanel(){var t,e,n,i,r;this.open=!1,this.showDetail=!1,document.body.style.overflow="",document.body.removeAttribute("data-side-panel"),((t=this.previousFocusedElement)==null?void 0:t.tagName.toLowerCase())==="o-button"?(i=(n=(e=this.previousFocusedElement.shadowRoot)==null?void 0:e.querySelector(".button"))==null?void 0:n.focus)==null||i.call(n):(r=this.previousFocusedElement)==null||r.focus();const o=this.renderRoot.querySelector(".panel");o&&o.removeAttribute("aria-modal"),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}handleFirstClick(o){o instanceof KeyboardEvent&&o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),o.stopPropagation(),this.onFirstButtonClickClose&&this.closePanel(),this.dispatchEvent(new CustomEvent("firstbuttonclick",{bubbles:!0,composed:!0,cancelable:!0,detail:{button:"first",target:o.target}})))}handleSecondClick(o){o instanceof KeyboardEvent&&o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),o.stopPropagation(),this.onSecondButtonClickClose&&this.closePanel(),this.dispatchEvent(new CustomEvent("secondbuttonclick",{bubbles:!0,composed:!0,cancelable:!0,detail:{button:"second",target:o.target}})))}updated(){this.style.setProperty("--z-overlay",`${this.zIndex||99}`),this.style.setProperty("--z-panel",`${this.zIndex?this.zIndex+1:99}`),this.open||setTimeout(()=>{this.setAttribute("hidden","hidden")},500)}render(){const o=this.showHeader?l`
377
+ `;R([a({type:String,reflect:!0})],B.prototype,"bgstyle",2);R([a({type:String,reflect:!0})],B.prototype,"size",2);R([a({type:String,reflect:!0})],B.prototype,"status",2);R([a({type:String,reflect:!0})],B.prototype,"type",2);R([a({type:String})],B.prototype,"strokewidth",2);R([a({type:String})],B.prototype,"icon",2);R([a({type:Boolean,reflect:!0})],B.prototype,"disabled",2);R([a({type:Boolean})],B.prototype,"showSrLabel",2);R([a({type:String})],B.prototype,"srLabel",2);B=R([b("o-icon-button")],B);var Ro=Object.defineProperty,Uo=Object.getOwnPropertyDescriptor,y=(o,t,e,n)=>{for(var i=n>1?void 0:n?Uo(t,e):t,r=o.length-1,s;r>=0;r--)(s=o[r])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&Ro(t,e,i),i};let p=class extends u{constructor(){super(...arguments),this.open=!1,this.showHeader=!0,this.showFooter=!1,this.showHeaderStartIcon=!1,this.headerTitle="",this.headerTitleClassName="panel-title",this.labelDialog="",this.addToBagProductCount="",this.closeButtonLabel="Close the modal",this.goBackButtonLabel="Go back to",this.firstButtonLabel="Close",this.firstButtonVariant="primary",this.firstButtonProps={},this.onFirstButtonClickClose=!1,this.secondButtonLabel="",this.secondButtonVariant="secondary",this.secondButtonProps={},this.onSecondButtonClickClose=!1,this.disablePortal=!1,this.zIndex=99,this.initialized=!1,this.showDetail=!1,this.isHidingDetail=!1,this.previousFocusedElement=null,this.previousFocusedSelector=null,this._onOpenDetail=async o=>{var e,n;const t=((e=o.detail)==null?void 0:e.origin)??document.activeElement;if(this._detailOriginEl=t,this._detailOriginClass=(t==null?void 0:t.className)??"",this.showDetail=!0,this.showHeaderStartIcon=!0,await this.updateComplete,this._detailOriginClass){const i=(n=this.shadowRoot)==null?void 0:n.querySelector(".detail-view");i&&i.setAttribute("fromelement",this._detailOriginClass)}await this.focusDetailReturnBtn()},this._detailOriginEl=null,this._detailOriginClass="",this.handleKeyDown=o=>{this.open&&(o.key==="Escape"?this.closePanel():o.key==="Tab"&&this.trapFocus(o))},this.handleClosePanel=o=>{if(o instanceof KeyboardEvent&&o.key!=="Enter"&&o.key!==" ")return;o.preventDefault(),o.stopPropagation();const t=o.currentTarget,e=(t==null?void 0:t.getAttribute("data-role"))==="back";if(this.showDetail&&e){this.isHidingDetail=!0;const n=this.renderRoot.querySelector(".content"),i=async()=>{this.showDetail=!1,this.isHidingDetail=!1,this.showHeaderStartIcon=!1,await this.updateComplete,this._restoreFocusToOrigin()};if(n){this.showHeaderStartIcon=!1;const r=()=>{this.showDetail=!1,this.isHidingDetail=!1,n.removeEventListener("animationend",r),i()};n.addEventListener("animationend",r)}else this.showDetail=!1,this.isHidingDetail=!1,this.showHeaderStartIcon=!1;return}this.closePanel()}}focusFirstInPanel(){var t,e,n;(n=this.getFocusableElements().map(i=>this.resolveFocusable(i)).filter(i=>!!i&&!i.hasAttribute("disabled"))[0]??((t=this.shadowRoot)==null?void 0:t.querySelector(".close-btn"))??((e=this.shadowRoot)==null?void 0:e.querySelector(".panel")))==null||n.focus({preventScroll:!0})}resolveFocusable(o){var e;const t=o.tagName.toLowerCase();return t==="o-icon-button"||t==="o-button"?((e=o.shadowRoot)==null?void 0:e.querySelector("button, .button"))??o:o}connectedCallback(){super.connectedCallback(),!this.disablePortal&&this.parentElement!==document.body&&document.body.appendChild(this),this.addEventListener("keydown",this.handleKeyDown),this.updateComplete.then(()=>{this.initialized=!0}),this.addEventListener("open-detail",this._onOpenDetail),this.addEventListener("focusin",o=>{o.composedPath()[0]===this&&this.focusFirstInPanel()})}disconnectedCallback(){document.body.style.overflow="",document.body.removeAttribute("data-side-panel"),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback(),this.removeEventListener("open-detail",this._onOpenDetail)}async focusDetailReturnBtn(){var i,r,s,c,h;await this.updateComplete;const o=this.getDeepActiveElement(document);if(o&&o!==document.body)try{o.blur()}catch{}await new Promise(requestAnimationFrame);const t=(i=this.shadowRoot)==null?void 0:i.querySelector(".detail-view .return-btn");if(!t)return;t.updateComplete&&await t.updateComplete,(c=(s=((r=t.shadowRoot)==null?void 0:r.querySelector("button"))??t)==null?void 0:s.focus)==null||c.call(s,{preventScroll:!0});const n=(h=this.shadowRoot)==null?void 0:h.querySelector('.panel[role="dialog"]');n&&n.setAttribute("aria-label",this.headerTitle)}_restoreFocusToOrigin(){var t,e;const o=this._detailOriginEl;!o||!document.contains(o)||((e=(t=document.activeElement)==null?void 0:t.blur)==null||e.call(t),requestAnimationFrame(()=>{var i;o.classList.add("a--tabfocus"),(((i=o.shadowRoot)==null?void 0:i.querySelector('button, .button, [tabindex]:not([tabindex="-1"])'))??null??o).focus({preventScroll:!0})}))}getDeepActiveElement(o=this.shadowRoot){let t=o.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}trapFocus(o){var r;if(o.key!=="Tab")return;const t=this.shadowRoot;if(!t)return;const e=this.getDeepActiveElement();if(this.showDetail){const s=t.querySelector(".detail-view .return-btn"),c=t.querySelector(".detail-view .close-btn"),h=s?this.resolveFocusable(s):null,f=c?this.resolveFocusable(c):null;if(o.shiftKey&&h&&e===h&&f){o.preventDefault(),o.stopPropagation(),f.focus({preventScroll:!0});return}if(!o.shiftKey&&f&&e===f){o.preventDefault(),o.stopPropagation(),(((r=t.querySelector(".detail-scroller"))==null?void 0:r.querySelector(p.focusablesSelector))??h??f).focus({preventScroll:!0});return}}if(document.querySelector("#refineandsortpopin")){const s=t.querySelector(".close-btn"),c=s?this.resolveFocusable(s):null,h=t.querySelector(".js-clear-refinements"),f=h?this.resolveFocusable(h):null,x=g=>{o.preventDefault(),o.stopPropagation(),g.focus({preventScroll:!0})};if(c&&f){if(!o.shiftKey&&e===f)return x(c);if(o.shiftKey&&e===c)return x(f)}}const i=this.renderRoot.querySelector(".close-btn");if(!o.shiftKey&&i&&i.contains(e)){o.preventDefault();const s=this.renderRoot.querySelector(".o-whats-inside--content p");s==null||s.focus()}}getFocusableElements(){const o=this.renderRoot.querySelector(".panel");if(!o)return[];function t(i){return!(i.disabled||i.hasAttribute("disabled")||i.hasAttribute("tabindex")&&i.getAttribute("tabindex")==="-1")}function e(i){var s;const r=[i.matches(p.focusablesSelector)?i:[]];if(!["o-icon-button","o-button"].includes(i.tagName.toLowerCase())){const c=Array.from(i instanceof HTMLSlotElement?i.assignedElements({flatten:!0}):[]).filter(t).flatMap(e),h=Array.from(((s=i.shadowRoot)==null?void 0:s.querySelectorAll("*"))||[]).filter(t).flatMap(e);r.push(...c,...h)}return r.flat()}return Array.from(o.querySelectorAll("*")).filter(t).flatMap(e)}openPanel(){var t;this.removeAttribute("hidden"),this.getBoundingClientRect(),this.previousFocusedElement=document.activeElement,this.previousFocusedSelector=(t=this.previousFocusedElement)==null?void 0:t.getAttribute("paneltarget"),this.open=!0,document.body.style.overflow="hidden",document.body.setAttribute("data-side-panel","open");const o=this.renderRoot.querySelector(".panel");o&&o.setAttribute("aria-modal","true"),this.updateComplete.then(()=>{var e,n;if(this.showHeader){const i=(e=this.shadowRoot)==null?void 0:e.querySelector(".panel .close-btn"),r=this.resolveFocusable(i);(n=r==null?void 0:r.focus)==null||n.call(r,{preventScroll:!0})}else this.focusFirstInPanel()}),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0}))}closePanel(){var e,n,i;this.open=!1,this.showDetail=!1,document.body.style.overflow="",document.body.removeAttribute("data-side-panel");let o=this.previousFocusedElement;o!=null&&o.isConnected||(o=document.querySelector(`[paneltarget="${this.previousFocusedSelector}"]`)),(o==null?void 0:o.tagName.toLowerCase())==="o-button"?(i=(n=(e=o.shadowRoot)==null?void 0:e.querySelector(".button"))==null?void 0:n.focus)==null||i.call(n):o==null||o.focus();const t=this.renderRoot.querySelector(".panel");t&&t.removeAttribute("aria-modal"),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}handleFirstClick(o){o instanceof KeyboardEvent&&o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),o.stopPropagation(),this.onFirstButtonClickClose&&this.closePanel(),this.dispatchEvent(new CustomEvent("firstbuttonclick",{bubbles:!0,composed:!0,cancelable:!0,detail:{button:"first",target:o.target}})))}handleSecondClick(o){o instanceof KeyboardEvent&&o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),o.stopPropagation(),this.onSecondButtonClickClose&&this.closePanel(),this.dispatchEvent(new CustomEvent("secondbuttonclick",{bubbles:!0,composed:!0,cancelable:!0,detail:{button:"second",target:o.target}})))}updated(){this.style.setProperty("--z-overlay",`${this.zIndex||99}`),this.style.setProperty("--z-panel",`${this.zIndex?this.zIndex+1:99}`),this.open||setTimeout(()=>{this.setAttribute("hidden","hidden")},500)}render(){const o=this.showHeader?l`
378
378
  <div tabindex="-1" class="header ${this.showDetail?"detail-view-header":""}">
379
379
  ${this.showHeaderStartIcon?l`
380
380
  <o-icon-button
package/index.mjs CHANGED
@@ -1310,7 +1310,7 @@ var Ro = Object.defineProperty, Uo = Object.getOwnPropertyDescriptor, y = (o, t,
1310
1310
  };
1311
1311
  let p = class extends u {
1312
1312
  constructor() {
1313
- super(...arguments), this.open = !1, this.showHeader = !0, this.showFooter = !1, this.showHeaderStartIcon = !1, this.headerTitle = "", this.headerTitleClassName = "panel-title", this.labelDialog = "", this.addToBagProductCount = "", this.closeButtonLabel = "Close the modal", this.goBackButtonLabel = "Go back to", this.firstButtonLabel = "Close", this.firstButtonVariant = "primary", this.firstButtonProps = {}, this.onFirstButtonClickClose = !1, this.secondButtonLabel = "", this.secondButtonVariant = "secondary", this.secondButtonProps = {}, this.onSecondButtonClickClose = !1, this.disablePortal = !1, this.zIndex = 99, this.initialized = !1, this.showDetail = !1, this.isHidingDetail = !1, this.previousFocusedElement = null, this._onOpenDetail = async (o) => {
1313
+ super(...arguments), this.open = !1, this.showHeader = !0, this.showFooter = !1, this.showHeaderStartIcon = !1, this.headerTitle = "", this.headerTitleClassName = "panel-title", this.labelDialog = "", this.addToBagProductCount = "", this.closeButtonLabel = "Close the modal", this.goBackButtonLabel = "Go back to", this.firstButtonLabel = "Close", this.firstButtonVariant = "primary", this.firstButtonProps = {}, this.onFirstButtonClickClose = !1, this.secondButtonLabel = "", this.secondButtonVariant = "secondary", this.secondButtonProps = {}, this.onSecondButtonClickClose = !1, this.disablePortal = !1, this.zIndex = 99, this.initialized = !1, this.showDetail = !1, this.isHidingDetail = !1, this.previousFocusedElement = null, this.previousFocusedSelector = null, this._onOpenDetail = async (o) => {
1314
1314
  var e, n;
1315
1315
  const t = ((e = o.detail) == null ? void 0 : e.origin) ?? document.activeElement;
1316
1316
  if (this._detailOriginEl = t, this._detailOriginClass = (t == null ? void 0 : t.className) ?? "", this.showDetail = !0, this.showHeaderStartIcon = !0, await this.updateComplete, this._detailOriginClass) {
@@ -1451,13 +1451,14 @@ let p = class extends u {
1451
1451
  return Array.from(o.querySelectorAll("*")).filter(t).flatMap(e);
1452
1452
  }
1453
1453
  openPanel() {
1454
- this.removeAttribute("hidden"), this.getBoundingClientRect(), this.previousFocusedElement = document.activeElement, this.open = !0, document.body.style.overflow = "hidden", document.body.setAttribute("data-side-panel", "open");
1454
+ var t;
1455
+ this.removeAttribute("hidden"), this.getBoundingClientRect(), this.previousFocusedElement = document.activeElement, this.previousFocusedSelector = (t = this.previousFocusedElement) == null ? void 0 : t.getAttribute("paneltarget"), this.open = !0, document.body.style.overflow = "hidden", document.body.setAttribute("data-side-panel", "open");
1455
1456
  const o = this.renderRoot.querySelector(".panel");
1456
1457
  o && o.setAttribute("aria-modal", "true"), this.updateComplete.then(() => {
1457
- var t, e;
1458
+ var e, n;
1458
1459
  if (this.showHeader) {
1459
- const n = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".panel .close-btn"), i = this.resolveFocusable(n);
1460
- (e = i == null ? void 0 : i.focus) == null || e.call(i, { preventScroll: !0 });
1460
+ const i = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".panel .close-btn"), r = this.resolveFocusable(i);
1461
+ (n = r == null ? void 0 : r.focus) == null || n.call(r, { preventScroll: !0 });
1461
1462
  } else
1462
1463
  this.focusFirstInPanel();
1463
1464
  }), this.dispatchEvent(
@@ -1465,10 +1466,12 @@ let p = class extends u {
1465
1466
  );
1466
1467
  }
1467
1468
  closePanel() {
1468
- var t, e, n, i, r;
1469
- this.open = !1, this.showDetail = !1, document.body.style.overflow = "", document.body.removeAttribute("data-side-panel"), ((t = this.previousFocusedElement) == null ? void 0 : t.tagName.toLowerCase()) === "o-button" ? (i = (n = (e = this.previousFocusedElement.shadowRoot) == null ? void 0 : e.querySelector(".button")) == null ? void 0 : n.focus) == null || i.call(n) : (r = this.previousFocusedElement) == null || r.focus();
1470
- const o = this.renderRoot.querySelector(".panel");
1471
- o && o.removeAttribute("aria-modal"), this.dispatchEvent(
1469
+ var e, n, i;
1470
+ this.open = !1, this.showDetail = !1, document.body.style.overflow = "", document.body.removeAttribute("data-side-panel");
1471
+ let o = this.previousFocusedElement;
1472
+ o != null && o.isConnected || (o = document.querySelector(`[paneltarget="${this.previousFocusedSelector}"]`)), (o == null ? void 0 : o.tagName.toLowerCase()) === "o-button" ? (i = (n = (e = o.shadowRoot) == null ? void 0 : e.querySelector(".button")) == null ? void 0 : n.focus) == null || i.call(n) : o == null || o.focus();
1473
+ const t = this.renderRoot.querySelector(".panel");
1474
+ t && t.removeAttribute("aria-modal"), this.dispatchEvent(
1472
1475
  new CustomEvent("close", { bubbles: !0, composed: !0 })
1473
1476
  );
1474
1477
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@florid-kit/components",
3
- "version": "0.10.21",
3
+ "version": "0.10.22",
4
4
  "main": "index.js",
5
5
  "module": "index.mjs",
6
6
  "typings": "index.d.ts",