import{r as registerInstance,h,H as Host,a as getElement}from"./index-B2f84Zog.js";var pdsTabsCss=":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)}";var PdsTabs=function(){function s(s){registerInstance(this,s)}s.prototype.tabClickHandler=function(s){if(this.componentId===s.detail[1]){this.activeTabIndex=s.detail[0];this.activeTabName=this.tabs[this.activeTabIndex].name}};s.prototype.handleKeyDown=function(s){var t=["ArrowLeft","ArrowRight","Home","End"];var i=s.target;var a=i.closest("pds-tab");var e=a&&a.closest("pds-tabs")===this.el;if(t.includes(s.key)&&e){s.preventDefault();this.moveActiveTab(s.key)}};s.prototype.moveActiveTab=function(s){var t=0;var i=this.tabs.length-1;var 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};s.prototype.findAllChildren=function(){var s=this;var t=Array.from(this.el.querySelectorAll("pds-tab"));var i=Array.from(this.el.querySelectorAll("pds-tabpanel"));this.tabs=t.filter((function(t){return t.closest("pds-tabs")===s.el}));this.tabPanels=i.filter((function(t){return t.closest("pds-tabs")===s.el}))};s.prototype.propGeneration=function(s,t){if(t===void 0){t=0}s.parentComponentId=this.componentId.toString();s.variant=this.variant.toString();s.selected=this.activeTabName===s.name?true:false;s["index"]=t};s.prototype.passPropsToChildren=function(){var s=this;this.tabs.forEach((function(t,i){if(s.activeTabName===t.name)s.activeTabIndex=i;s.propGeneration(t,i)}));this.tabPanels.forEach((function(t){s.propGeneration(t)}))};s.prototype.classNames=function(){var s="pds-tabs";if(this.variant&&this.variant!="primary"){var t="pds-tabs--".concat(this.variant);s+=" "+t}return s};s.prototype.componentWillLoad=function(){this.findAllChildren()};s.prototype.componentWillRender=function(){this.passPropsToChildren()};s.prototype.render=function(){return h(Host,{key:"213dfbe8f2828b430ab81dce23f43c2137206861","active-tab-name":this.activeTabName,class:this.classNames(),id:this.componentId},h("div",{key:"68989e852e2eeed180f91e5ac901c4318d6c0d70",class:"pds-tabs__tablist",role:"tablist","aria-label":this.tablistLabel,part:"tab-list"},h("slot",{key:"4a06996745c049fdaf830460e8d57caefd50900b",name:"tabs"})),h("slot",{key:"e0558392bff0955defb133b36dd4e7360f33acce",name:"tabpanels"}))};Object.defineProperty(s.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return s}();PdsTabs.style=pdsTabsCss;export{PdsTabs as pds_tabs};
//# sourceMappingURL=pds-tabs.entry.js.map