import{r as registerInstance,h,H as Host,g as getElement}from"./index-ca411ad2.js";var pdsTabsCss=":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)}";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 a=["ArrowLeft","ArrowRight","Home","End"];if(a.includes(s.key)){s.preventDefault();this.moveActiveTab(s.key)}};s.prototype.moveActiveTab=function(s){var a=0;var t=this.tabs.length-1;var i=null;switch(s){case"ArrowLeft":i=this.activeTabIndex===a?t:this.activeTabIndex+-1;break;case"ArrowRight":i=this.activeTabIndex===t?a:this.activeTabIndex+1;break;case"Home":i=a;break;case"End":i=t;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,a){if(a===void 0){a=0}s.parentComponentId=this.componentId.toString();s.variant=this.variant.toString();s.selected=this.activeTabName===s.name?true:false;s["index"]=a};s.prototype.passPropsToChildren=function(){var s=this;this.tabs.forEach((function(a,t){if(s.activeTabName===a.name)s.activeTabIndex=t;s.propGeneration(a,t)}));this.tabPanels.forEach((function(a){s.propGeneration(a)}))};s.prototype.classNames=function(){var s="pds-tabs";if(this.variant&&this.variant!="primary"){var a="pds-tabs--".concat(this.variant);s+=" "+a}return s};s.prototype.componentWillLoad=function(){this.findAllChildren()};s.prototype.componentWillRender=function(){this.passPropsToChildren()};s.prototype.render=function(){return h(Host,{key:"a36e242d5e746954f80778cf515879ca82258978","active-tab-name":this.activeTabName,class:this.classNames(),id:this.componentId},h("div",{key:"d6d89fd90a9a534f249c549e34308ed245773f60",class:"pds-tabs__tablist",role:"tablist","aria-label":this.tablistLabel},h("slot",{key:"9b5e5268c27ecf2a5331cec64d2c7121cef366a1",name:"tabs"})),h("slot",{key:"b835cf1befe68f54b1751a976846d271ce97634e",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