import{r as registerInstance,h,H as Host,g as getElement}from"./index-8b335bbb.js";var baseCss=":where(*:not(slot),*:not(slot)::before,*:not(slot)::after){-webkit-box-sizing:border-box;box-sizing:border-box}:where(*:not(slot)){margin:0}:where(img,picture,video,canvas,svg){display:block;max-width:100%}:where(input,button,textarea,select){font:inherit}:where(p,h1,h2,h3,h4,h5,h6){overflow-wrap:break-word}:where(a:not([href]):not([class])){color:currentColor;text-decoration:none}:where(a:not([href]):not([class]):hover){color:currentColor;text-decoration:none}:where(ul[role=list],ol[role=list]){list-style:none}:where(table){border-collapse:collapse;border-spacing:0}:where(*:not(slot)){font:var(--pine-typography-body-md-default);letter-spacing:var(--pine-letter-spacing-body-md)}:where(h1,h2,h3,h4,h5,h6){font-family:var(--pine-font-family-heading);color:var(--pine-color-grey-950)}:where(h1){font:var(--pine-typography-heading-h1);letter-spacing:var(--pine-letter-spacing-heading-h1)}:where(h2){font:var(--pine-typography-heading-h2);letter-spacing:var(--pine-letter-spacing-heading-h2)}:where(h3){font:var(--pine-typography-heading-h3);letter-spacing:var(--pine-letter-spacing-heading-h3)}:where(h4){font:var(--pine-typography-heading-h4);letter-spacing:var(--pine-letter-spacing-heading-h4)}:where(h5){font:var(--pine-typography-heading-h5);letter-spacing:var(--pine-letter-spacing-heading-h5)}:where(h6){font:var(--pine-typography-heading-h6);letter-spacing:var(--pine-letter-spacing-heading-h6)}:where(div,label,p,span){color:var(--pine-color-text-default)}:where(code,kbd,pre,samp){font-family:monospace}:where([role=button]){cursor:pointer}:where(:focus){outline:0}:where(:focus-visible){outline:var(--pine-border-width-thick) solid var(--pine-color-purple-500)}:where([hidden]){display:none !important}";var PdsTabsStyle0=baseCss;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 PdsTabsStyle1=pdsTabsCss;var PdsTabs=function(){function e(e){registerInstance(this,e);this.tablistLabel=undefined;this.componentId=undefined;this.variant=undefined;this.activeTabName=undefined;this.activeTabIndex=undefined}e.prototype.tabClickHandler=function(e){if(this.componentId===e.detail[1]){this.activeTabIndex=e.detail[0];this.activeTabName=this.tabs[this.activeTabIndex].name}};e.prototype.handleKeyDown=function(e){var t=["ArrowLeft","ArrowRight","Home","End"];if(t.includes(e.key)){e.preventDefault();this.moveActiveTab(e.key)}};e.prototype.moveActiveTab=function(e){var t=0;var a=this.tabs.length-1;var i=null;switch(e){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};e.prototype.findAllChildren=function(){this.tabs=this.el.querySelectorAll("pds-tab");this.tabPanels=this.el.querySelectorAll("pds-tabpanel")};e.prototype.propGeneration=function(e,t){if(t===void 0){t=0}e.parentComponentId=this.componentId.toString();e.variant=this.variant.toString();e.selected=this.activeTabName===e.name?true:false;e["index"]=t};e.prototype.passPropsToChildren=function(){var e=this;this.tabs.forEach((function(t,a){if(e.activeTabName===t.name)e.activeTabIndex=a;e.propGeneration(t,a)}));this.tabPanels.forEach((function(t){e.propGeneration(t)}))};e.prototype.classNames=function(){var e="pds-tabs";if(this.variant&&this.variant!="primary"){var t="pds-tabs--".concat(this.variant);e+=" "+t}return e};e.prototype.componentWillLoad=function(){this.findAllChildren()};e.prototype.componentWillRender=function(){this.passPropsToChildren()};e.prototype.render=function(){return h(Host,{key:"590f66c80be5b92b015e6499ee60bef965bbaa1e","active-tab-name":this.activeTabName,class:this.classNames(),id:this.componentId},h("div",{key:"7251690cd8b8ac1425763212883c98826d15fed1",class:"pds-tabs__tablist",role:"tablist","aria-label":this.tablistLabel},h("slot",{key:"d07a6f7b621309db9cd7169184c8e7ae0b3b981f",name:"tabs"})),h("slot",{key:"dcc5b2ea9bdf45f33d3cb2b0a75fa4a2885ec00b",name:"tabpanels"}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();PdsTabs.style=PdsTabsStyle0+PdsTabsStyle1;export{PdsTabs as pds_tabs};
//# sourceMappingURL=pds-tabs.entry.js.map