import{r as s,h as t,H as i,a}from"./p-B2f84Zog.js";const e=":host{--tabs-dimension-panel-margin-top:var(--pine-dimension-none);--tabs-dimension-panel-padding:0;display:block}.pds-tabs__tablist{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--pine-dimension-md)}:host(.pds-tabs--availability) .pds-tabs__tablist{gap:var(--pine-dimension-xs)}:host(.pds-tabs--filter) .pds-tabs__tablist{gap:var(--pine-dimension-sm)}:host(.pds-tabs--pill) .pds-tabs__tablist{background-color:var(--pine-color-background-app);border:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);border-radius:var(--pine-dimension-100);display:-ms-inline-flexbox;display:inline-flex;display:-ms-flexbox;display:flex;gap:0;height:var(--pine-dimension-450)}";const n=class{constructor(t){s(this,t)}tabClickHandler(s){if(this.componentId===s.detail[1]){this.activeTabIndex=s.detail[0];this.activeTabName=this.tabs[this.activeTabIndex].name}}handleKeyDown(s){const t=["ArrowLeft","ArrowRight","Home","End"];const i=s.target;const a=i.closest("pds-tab");const e=a&&a.closest("pds-tabs")===this.el;if(t.includes(s.key)&&e){s.preventDefault();this.moveActiveTab(s.key)}}moveActiveTab(s){const t=0;const i=this.tabs.length-1;let a=null;switch(s){case"ArrowLeft":a=this.activeTabIndex===t?i:this.activeTabIndex+-1;break;case"ArrowRight":a=this.activeTabIndex===i?t:this.activeTabIndex+1;break;case"Home":a=t;break;case"End":a=i;break}this.tabs[a].children[0].focus();this.activeTabName=this.tabs[a].name;this.activeTabIndex=a}findAllChildren(){const s=Array.from(this.el.querySelectorAll("pds-tab"));const t=Array.from(this.el.querySelectorAll("pds-tabpanel"));this.tabs=s.filter((s=>s.closest("pds-tabs")===this.el));this.tabPanels=t.filter((s=>s.closest("pds-tabs")===this.el))}propGeneration(s,t=0){s.parentComponentId=this.componentId.toString();s.variant=this.variant.toString();s.selected=this.activeTabName===s.name?true:false;s["index"]=t}passPropsToChildren(){this.tabs.forEach(((s,t)=>{if(this.activeTabName===s.name)this.activeTabIndex=t;this.propGeneration(s,t)}));this.tabPanels.forEach((s=>{this.propGeneration(s)}))}classNames(){let s=`pds-tabs`;if(this.variant&&this.variant!="primary"){const t=`pds-tabs--${this.variant}`;s+=" "+t}return s}componentWillLoad(){this.findAllChildren()}componentWillRender(){this.passPropsToChildren()}render(){return t(i,{key:"213dfbe8f2828b430ab81dce23f43c2137206861","active-tab-name":this.activeTabName,class:this.classNames(),id:this.componentId},t("div",{key:"68989e852e2eeed180f91e5ac901c4318d6c0d70",class:"pds-tabs__tablist",role:"tablist","aria-label":this.tablistLabel,part:"tab-list"},t("slot",{key:"4a06996745c049fdaf830460e8d57caefd50900b",name:"tabs"})),t("slot",{key:"e0558392bff0955defb133b36dd4e7360f33acce",name:"tabpanels"}))}get el(){return a(this)}};n.style=e;export{n as pds_tabs};
//# sourceMappingURL=p-06713f25.entry.js.map