import{r as registerInstance,h,H as Host,g as getElement}from"./index-4a3a9179.js";var pdsTabsCss=":host{--panel-margin-top:0;--panel-padding:0;--gap-md:var(--pine-spacing-md);--gap-xs:var(--pine-spacing-xs);--gap-sm:16px var(--pine-spacing-sm);--outline:2px solid var(--pine-color-primary-200);display:block}*:focus{outline:var(--outline)}.pds-tabs__tablist{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--gap-md)}:host(.pds-tabs--availability) .pds-tabs__tablist{gap:var(--gap-xs)}:host(.pds-tabs--filter) .pds-tabs__tablist{gap:var(--gap-sm)}";var PdsTabsStyle0=pdsTabsCss;var PdsTabs=function(){function s(s){registerInstance(this,s);this.tablistLabel=undefined;this.componentId=undefined;this.variant=undefined;this.activeTabName=undefined;this.activeTabIndex=undefined}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"];if(t.includes(s.key)){s.preventDefault();this.moveActiveTab(s.key)}};s.prototype.moveActiveTab=function(s){var t=0;var a=this.tabs.length-1;var 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};s.prototype.findAllChildren=function(){this.tabs=this.el.querySelectorAll("pds-tab");this.tabPanels=this.el.querySelectorAll("pds-tabpanel")};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,a){if(s.activeTabName===t.name)s.activeTabIndex=a;s.propGeneration(t,a)}));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:"230c4abd9bf8632802f34df2a517ca2c1cc029bd","active-tab-name":this.activeTabName,class:this.classNames(),id:this.componentId},h("div",{key:"ad7935e2494c8fa731abaf17979f61ffa70d8ac3",class:"pds-tabs__tablist",role:"tablist","aria-label":this.tablistLabel},h("slot",{key:"3e3b604d8aa3391b23539914cd91bd6cafcfc4c9",name:"tabs"})),h("slot",{key:"7d8a5ee7b1b147816bedf6be0b24f8a57b422fe7",name:"tabpanels"}))};Object.defineProperty(s.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return s}();PdsTabs.style=PdsTabsStyle0;export{PdsTabs as pds_tabs};
//# sourceMappingURL=pds-tabs.entry.js.map