import{r as t,h as i}from"./p-5da71329.js";var a=function(t){return function(i,a){return i===a||t.compare(i,a)<1?i:a}};var l=function(t){return function(i,a){return i===a||t.compare(i,a)>-1?i:a}};var s=function(t){var i=a(t);var s=l(t);return function(t,a){return function(l){return s(i(l,a),t)}}};var e={equals:function(t,i){return t===i}};var n={equals:e.equals,compare:function(t,i){return t<i?-1:t>i?1:0}};const r="stencila-tab-list.sc-stencila-tab-list-default{display:block}.sc-stencila-tab-list-default-h ul.sc-stencila-tab-list-default,stencila-tab-list.sc-stencila-tab-list-default ul.sc-stencila-tab-list-default,ul[role=tablist].sc-stencila-tab-list-default{background-color:#e9eaf1;background-color:var(--color-neutral-50,#e9eaf1);display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;margin:0;padding:0}";const c="stencila-tab-list.sc-stencila-tab-list-material{display:block}.sc-stencila-tab-list-material-h ul.sc-stencila-tab-list-material,ul[role=tablist].sc-stencila-tab-list-material{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;margin:0;padding:0}";let o=class{constructor(i){t(this,i);this.activeTabIndex=0;this.onKeyboardNavigateTabs=t=>{const i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;const a=s(n)(0,this.tabs.length-1);this.selectTab(a(this.activeTabIndex+i))};this.clickHandler=(t,i)=>a=>{var l;a.preventDefault();this.selectTab(i);(l=t.onClick)===null||l===void 0?void 0:l.call(t,a)}}selectTab(t){this.activeTabIndex=t}render(){return i("ul",{role:"tablist",onKeyDown:this.onKeyboardNavigateTabs},this.tabs.map(((t,a)=>i("stencila-tab",{isSelected:t.isSelected===true||t.isSelected===undefined&&a===this.activeTabIndex,label:t.label,onClick:this.clickHandler(t,a),tabIndex:a===this.activeTabIndex?0:-1}))))}};o.style={default:r,material:c};export{o as stencila_tab_list};
//# sourceMappingURL=p-8538026c.entry.js.map