1"use strict";(globalThis.webpackChunk_roots_bud_sage_components=globalThis.webpackChunk_roots_bud_sage_components||[]).push([[266],{
1"./styles/components/container/tabs.scss":()=>{},
1"./scripts/components/container/tabs.js":()=>{class t extends HTMLElement{constructor(){super()}connectedCallback(){this.restructureDOM(),this.tabs=[...this.querySelectorAll('[role="tab"]')],this.panels=[...this.querySelectorAll('[role="tabpanel"]')],this.show(this.tabs.find(t=>"true"===t.getAttribute("aria-selected"))||this.tabs[0]),this.tabs.forEach(t=>{t.addEventListener("click",()=>this.show(t)),t.addEventListener("keydown",e=>this.onTabKeydown(e,t)),t.addEventListener("keydown",e=>this.onArrowKeydown(e,t))}),this.panels.forEach((t,e)=>{t.addEventListener("keydown",s=>this.onPanelKeydown(s,t,e))})}restructureDOM(){let t=this.querySelector('[role="tablist"]');t||(t=document.createElement("div"),t.role="tablist",t.className="bt-tabs__tab",this.prepend(t)),this.querySelectorAll('[role="tab"]').forEach(e=>t.appendChild(e))}show(t){const e=this.tabs.indexOf(t);this.tabs.forEach((t,s)=>{const n=s===e;t.ariaSelected=n,t.tabIndex=n?0:-1}),this.panels.forEach((t,s)=>{const n=s===e;t.hidden=!n,t.classList.toggle("is-active",n)})}onTabKeydown(t,e){if("Tab"!==t.key)return;const s=this.tabs.indexOf(e),n=this.panels[s],o=[...this.getFocusable(n)];if(t.shiftKey){const e=o.indexOf(document.activeElement);if(e>0)return t.preventDefault(),void o[e-1].focus();const n=this.tabs[s-1];return void(n&&(t.preventDefault(),this.show(n),n.focus()))}const a=o.indexOf(document.activeElement);if(a<o.length-1)return t.preventDefault(),void o[a+1].focus();const i=this.tabs[s+1];i&&(t.preventDefault(),this.show(i),i.focus())}onArrowKeydown(t,e){const s=this.tabs.indexOf(e);if("ArrowRight"===t.key){const e=this.getNextTab(s);e&&(t.preventDefault(),this.focusTab(e))}else if("ArrowLeft"===t.key){const e=this.getPrevTab(s);e&&(t.preventDefault(),this.focusTab(e))}}onPanelKeydown(t,e,s){if("Tab"!==t.key)return;const n=[...this.getFocusable(e)],o=n.indexOf(document.activeElement);if(t.shiftKey)return;if(o<n.length-1)return t.preventDefault(),void n[o+1].focus();const a=this.tabs[s+1];a&&(t.preventDefault(),this.show(a),a.focus())}focusTab(t){this.show(t),t.focus()}getFocusable(t){return t.querySelectorAll('a[href], button:not([disabled]), input, textarea, select, [tabindex]:not([tabindex="-1"])')}getNextTab(t){return this.tabs[t+1]||this.tabs[0]}getPrevTab(t){return this.tabs[t-1]||this.tabs.at(-1)}}void 0===customElements.get("bt-tabs")&&customElements.define("bt-tabs",t)}
1},t=>{var e=e=>t(t.s=e);e("./styles/components/container/tabs.scss"),e("./scripts/components/container/tabs.js")}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.