UNPKG

finpro

Version:
12 lines (11 loc) 4.22 kB
import{a as l,b as i,f as d,g as b,h as o}from"./chunk-GBPY57YZ.js";import{a as t}from"./chunk-NZ3RGSR6.js";var n=l`.tabs{background-color:var(--fp-color-primary-background);border-bottom:var(--fp-size-5xs) solid var(--fp-color-secondary-background);display:flex;flex-direction:row}.tabs-list{--overflow-x:'auto';--overflow-y:'auto';--border-radius:var(--fp-border-radius-l);overflow-x:var(--overflow-x);overflow-y:var(--overflow-y);border-radius:var(--border-radius)}:host([overflowX='auto']) .tabs-list{--overflow-x:'auto'}:host([overflowX='clip']) .tabs-list{--overflow-x:clip}:host([overflowX='hidden']) .tabs-list{--overflow-x:hidden}:host([overflowX='inherit']) .tabs-list{--overflow-x:inherit}:host([overflowX='initial']) .tabs-list{--overflow-x:initial}:host([overflowX='overlay']) .tabs-list{--overflow-x:overlay}:host([overflowX='revert']) .tabs-list{--overflow-x:revert}:host([overflowX='scroll']) .tabs-list{--overflow-x:scroll}:host([overflowX='unset']) .tabs-list{--overflow-x:unset}:host([overflowX='visible']) .tabs-list{--overflow-x:visible}:host([overflowY='auto']) .tabs-list{--overflow-y:auto}:host([overflowY='clip']) .tabs-list{--overflow-y:clip}:host([overflowY='hidden']) .tabs-list{--overflow-y:hidden}:host([overflowY='inherit']) .tabs-list{--overflow-y:inherit}:host([overflowY='initial']) .tabs-list{--overflow-y:initial}:host([overflowY='overlay']) .tabs-list{--overflow-y:overlay}:host([overflowY='revert']) .tabs-list{--overflow-y:revert}:host([overflowY='scroll']) .tabs-list{--overflow-y:scroll}:host([overflowY='unset']) .tabs-list{--overflow-y:unset}:host([overflowY='visible']) .tabs-list{--overflow-y:visible}:host([borderRadius='n']) .tabs-list{--border-radius:0}:host([borderRadius='2xs']) .tabs-list{--border-radius:var(--fp-border-radius-2xs) var(--fp-border-radius-2xs) 0 0}:host([borderRadius='xs']) .tabs-list{--border-radius:var(--fp-border-radius-xs) var(--fp-border-radius-xs) 0 0}:host([borderRadius='s']) .tabs-list{--border-radius:var(--fp-border-radius-s) var(--fp-border-radius-s) 0 0}:host([borderRadius='m']) .tabs-list{--border-radius:var(--fp-border-radius-m) var(--fp-border-radius-m) 0 0}:host([borderRadius='l']) .tabs-list{--border-radius:var(--fp-border-radius-l) var(--fp-border-radius-l) 0 0}:host([borderRadius='xl']) .tabs-list{--border-radius:var(--fp-border-radius-xl) var(--fp-border-radius-xl) 0 0}:host([borderRadius='2xl']) .tabs-list{--border-radius:var(--fp-border-radius-2xl) var(--fp-border-radius-2xl) 0 0}.panels{border-radius:0 0 var(--fp-border-radius-l) var(--fp-border-radius-l)}`,v=n;var s=class extends d{constructor(){super(...arguments);this.overflowX="auto";this.overflowY="auto";this.borderRadius="l";this._connectedTabs=[];this._connectedPanels=[]}static get styles(){return[v]}get tabs(){return this._connectedTabs}get panels(){return this._connectedPanels}registerTab(e){let r=this._connectedTabs.filter(a=>!a.disabled).length===0&&!e.disabled;this._connectedTabs.push(e),(!e.disabled&&e.selected||r)&&(this.selectedTabName=e.name)}unregisterTab(e){var r;this._connectedTabs.splice(this._connectedTabs.indexOf(e),1),e.selected&&((r=this._connectedTabs.find(a=>!a.disabled))==null||r.select())}registerTabPanel(e){e.visible=e.tab===this.selectedTabName,this._connectedPanels.push(e)}unregisterTabPanel(e){this._connectedTabs.splice(this._connectedPanels.indexOf(e),1)}get selectedTabName(){return this._selectedTabName}set selectedTabName(e){this._selectedTabName=e,this._connectedTabs.forEach(r=>{r.selected=e===r.name}),this._connectedPanels.forEach(r=>{r.visible=r.tab===this._selectedTabName})}_handleTabSelected(e){this.selectedTabName=e.detail}render(){return i` <div class="container" @fp-tab-selected="${this._handleTabSelected}"> <div role="tablist" class="tabs-list"> <div class="tabs"> <slot name="tabs"></slot> </div> </div> <div role="tabpanel" class="panels"> <slot></slot> </div> </div>`}};t([o({type:String,reflect:!0})],s.prototype,"overflowX",2),t([o({type:String,reflect:!0})],s.prototype,"overflowY",2),t([o({type:String,reflect:!0})],s.prototype,"borderRadius",2),s=t([b("fp-tab-group")],s);export{s as a}; //# sourceMappingURL=chunk-FCYPQIGV.js.map