D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
diafdxji
/
shihty.com
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
surecart
/
Filename :
p-d862a270.entry.js
back
Copy
import{r as t,c as s,h as i,a as e}from"./p-e97fde0a.js";const a=":host{display:block;--sc-tabs-min-width:225px}.tab-group{display:flex;flex-wrap:wrap;position:relative;border:solid 1px transparent;border-radius:0;flex-direction:row}@media screen and (min-width: 750px){.tab-group{flex-wrap:nowrap}}.tab-group__tabs{display:flex;flex-wrap:wrap;flex:0 0 auto;flex-direction:column;margin-bottom:var(--sc-spacing-xx-large)}.tab-group__nav-container{order:1;flex:1 0 100%}@media screen and (min-width: 750px){.tab-group__nav-container{min-width:var(--sc-tabs-min-width);flex:0 1 auto}}.tab-group__body{flex:1 1 auto;order:2}@media screen and (min-width: 750px){.tab-group__body{padding:0 var(--sc-spacing-xx-large)}}::slotted(sc-tab){margin-bottom:var(--sc-spacing-xx-small)}";const o=a;const r=class{constructor(i){t(this,i);this.scTabHide=s(this,"scTabHide",7);this.scTabShow=s(this,"scTabShow",7);this.tabs=[];this.panels=[];this.activeTab=undefined}componentDidLoad(){this.syncTabsAndPanels();this.setAriaLabels();this.setActiveTab(this.getActiveTab()||this.tabs[0],{emitEvents:false});this.mutationObserver=new MutationObserver((()=>{this.syncTabsAndPanels()}));this.mutationObserver.observe(this.el,{attributes:true,childList:true,subtree:true})}disconnectedCallback(){this.mutationObserver.disconnect()}syncTabsAndPanels(){this.tabs=this.getAllTabs();this.panels=this.getAllPanels()}setAriaLabels(){this.tabs.map((t=>{const s=this.panels.find((s=>s.name===t.panel));if(s){t.setAttribute("aria-controls",s.getAttribute("id"));s.setAttribute("aria-labelledby",t.getAttribute("id"))}}))}handleClick(t){const s=t.target;const i=s.closest("sc-tab");const e=i===null||i===void 0?void 0:i.closest("sc-tab-group");if(e!==this.el){return}if(i){this.setActiveTab(i,{scrollBehavior:"smooth"})}}handleKeyDown(t){const s=t.target;const i=s.closest("sc-tab");const e=i===null||i===void 0?void 0:i.closest("sc-tab-group");if(e!==this.el){return true}if(["Enter"," "].includes(t.key)){if(i){this.setActiveTab(i,{scrollBehavior:"smooth"})}}if(["ArrowUp","ArrowDown","Home","End"].includes(t.key)){const s=document.activeElement;if(s&&s.tagName.toLowerCase()==="sc-tab"){let i=this.tabs.indexOf(s);if(t.key==="Home"){i=0}else if(t.key==="End"){i=this.tabs.length-1}else if(t.key==="ArrowUp"){i=Math.max(0,i-1)}else if(t.key==="ArrowDown"){i=Math.min(this.tabs.length-1,i+1)}this.tabs[i].triggerFocus({preventScroll:true});t.preventDefault()}}}setActiveTab(t,s){s=Object.assign({emitEvents:true,scrollBehavior:"auto"},s);if(t&&t!==this.activeTab&&!t.disabled){const i=this.activeTab;this.activeTab=t;this.tabs.map((t=>t.active=t===this.activeTab));this.panels.map((t=>t.active=t.name===this.activeTab.panel));if(s.emitEvents){if(i){this.scTabHide.emit(i.panel)}this.scTabShow.emit(this.activeTab.panel)}}}getActiveTab(){const t=this.getAllTabs();return t.find((t=>t.active))}getAllChildren(){const t=this.el.shadowRoot.querySelectorAll("slot");const s=["sc-tab","sc-tab-panel"];const i=Array.from(t).map((t=>{var s;return(s=t===null||t===void 0?void 0:t.assignedElements)===null||s===void 0?void 0:s.call(t,{flatten:true})})).flat();return i.reduce(((t,s)=>{var i;return t.concat(s,[...((i=s===null||s===void 0?void 0:s.querySelectorAll)===null||i===void 0?void 0:i.call(s,"*"))||[]])}),[]).filter((t=>{var i,e;return s.includes((e=(i=t===null||t===void 0?void 0:t.tagName)===null||i===void 0?void 0:i.toLowerCase)===null||e===void 0?void 0:e.call(i))}))}getAllTabs(t=false){return this.getAllChildren().filter((s=>t?s.tagName.toLowerCase()==="sc-tab":s.tagName.toLowerCase()==="sc-tab"&&!s.disabled))}getAllPanels(){return this.getAllChildren().filter((t=>t.tagName.toLowerCase()==="sc-tab-panel"))}render(){return i("div",{key:"6db418090da7a490097c1957fbe62221f9c52f82",part:"base",class:{"tab-group":true},onClick:t=>this.handleClick(t),onKeyDown:t=>this.handleKeyDown(t)},i("div",{key:"5b803ebe415624dc3c3fb80452bca1e29901fb08",class:"tab-group__nav-container",part:"nav"},i("div",{key:"88d46da46e9fe1c429d962f31bf63800ce42c566",class:"tab-group__nav"},i("div",{key:"ba6bc25bce35fb166e00d881eb00e242bff25dba",part:"tabs",class:"tab-group__tabs",role:"tablist"},i("slot",{key:"1b7e3c2faa6aa402ac03e76a0edb5419729a4e03",onSlotchange:()=>this.syncTabsAndPanels(),name:"nav"})))),i("div",{key:"2cc04c39158d4cee0f93f4f8c5597cb2317773cb",part:"body",class:"tab-group__body"},i("slot",{key:"9ac01bf13e0529ca5bf2971b31ce9c305059c694",onSlotchange:()=>this.syncTabsAndPanels()})))}get el(){return e(this)}};r.style=o;export{r as sc_tab_group}; //# sourceMappingURL=p-d862a270.entry.js.map