import{r as s,h as t,H as a,g as i}from"./p-05ee992c.js";const e=":host{--spacing-panel-margin-top:0;--spacing-panel-padding:0;--outline:2px solid var(--pine-color-blue-200);--spacing-gap-availability:var(--pine-spacing-100);--spacing-gap-default:var(--pine-spacing-300);--spacing-gap-filter:var(--pine-spacing-200);display:block}.pds-tabs__tablist{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--spacing-gap-default)}:host(.pds-tabs--availability) .pds-tabs__tablist{gap:var(--spacing-gap-availability)}:host(.pds-tabs--filter) .pds-tabs__tablist{gap:var(--spacing-gap-filter)}";const n=e;const p=class{constructor(t){s(this,t);this.tablistLabel=undefined;this.componentId=undefined;this.variant=undefined;this.activeTabName=undefined;this.activeTabIndex=undefined}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"];if(t.includes(s.key)){s.preventDefault();this.moveActiveTab(s.key)}}moveActiveTab(s){const t=0;const a=this.tabs.length-1;let i=null;switch(s){case"ArrowLeft":i=this.activeTabIndex===t?a:this.activeTabIndex+-1;break;case"ArrowRight":i=this.activeTabIndex===a?t:this.activeTabIndex+1;break;case"Home":i=t;break;case"End":i=a;break}this.tabs[i].children[0].focus();this.activeTabName=this.tabs[i].name;this.activeTabIndex=i}findAllChildren(){this.tabs=this.el.querySelectorAll("pds-tab");this.tabPanels=this.el.querySelectorAll("pds-tabpanel")}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(a,{key:"a36e242d5e746954f80778cf515879ca82258978","active-tab-name":this.activeTabName,class:this.classNames(),id:this.componentId},t("div",{key:"d6d89fd90a9a534f249c549e34308ed245773f60",class:"pds-tabs__tablist",role:"tablist","aria-label":this.tablistLabel},t("slot",{key:"9b5e5268c27ecf2a5331cec64d2c7121cef366a1",name:"tabs"})),t("slot",{key:"b835cf1befe68f54b1751a976846d271ce97634e",name:"tabpanels"}))}get el(){return i(this)}};p.style=n;export{p as pds_tabs};
//# sourceMappingURL=p-30dfdfdd.entry.js.map