{"version":3,"names":["tabCss","LgrTabStyle0","Tab","this","inheritedAttributes","handleTabItemSelection","e","itemsSlot","includes","target","forEach","element","selected","handleInverseChange","map","el","inverse","handleDisabledChange","disabled","componentDidLoad","slot","assignedElements","filter","tagName","toLowerCase","_a","length","shift","componentWillLoad","inheritAttributes","render","h","Host","key","role","class","addClass","fullWidth","name","ref"],"sources":["src/components/tab/tab.scss?tag=lgr-tab&encapsulation=shadow","src/components/tab/tab.tsx"],"sourcesContent":[":host {\n width: 100%;\n\n .lgr-tab-items-container {\n display: flex;\n box-sizing: border-box;\n flex-direction: row;\n height: var(--lgr-spacing-xs);\n margin: 0 0 var(--lgr-spacing-nano) 0;\n padding: 0;\n border: none;\n list-style: none;\n overflow-x: auto;\n\n &.full-width {\n border-bottom: var(--lgr-border-size-default) solid var(--lgr-color-neutral-low-light);\n }\n\n &.inverse {\n border-color: var(--lgr-color-neutral-high-pure);\n }\n }\n}\n","import { Component, h, Host, Element, Listen, Prop, Watch } from '@stencil/core';\nimport { addClass, inheritAttributes } from '../../utils/helpers/helpers';\n\n@Component({\n tag: 'lgr-tab',\n styleUrl: 'tab.scss',\n shadow: true,\n})\nexport class Tab {\n @Element() el!: HTMLLgrTabElement;\n /**\n * Inverse or not. This value will be aplied globally to all tab items.\n */\n @Prop({ reflect: true }) inverse: boolean = false;\n /**\n * Disabled or not. This value will be aplied globally to all tab items.\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n /**\n * Indicates whether the border should be placed under the entire width or\n * only below the tag names.\n */\n @Prop({ reflect: true }) fullWidth: boolean = false;\n\n private slot!: HTMLSlotElement;\n private itemsSlot!: HTMLLgrTabItemElement[];\n private inheritedAttributes: { [key: string]: string } = {};\n\n @Listen('lgrTabItemSelected', { target: 'body' })\n handleTabItemSelection(e: CustomEvent) {\n if (!this.itemsSlot.includes(e.target as HTMLLgrTabItemElement)) return;\n\n this.itemsSlot.forEach(element => {\n if (element !== e.target) {\n (element as HTMLLgrTabItemElement).selected = false;\n }\n });\n }\n\n @Watch('inverse')\n handleInverseChange() {\n this.itemsSlot.map(el => (el.inverse = this.inverse));\n }\n\n @Watch('disabled')\n handleDisabledChange() {\n this.itemsSlot.map(el => (el.disabled = this.disabled));\n }\n\n componentDidLoad() {\n try {\n this.itemsSlot = this.slot\n .assignedElements()\n .filter(el => el.tagName.toLowerCase() === 'lgr-tab-item')\n .map(el => el as HTMLLgrTabItemElement);\n } catch {\n return;\n }\n\n const selected = this.itemsSlot.filter(el => el.selected);\n\n if (selected.length === 0) {\n this.itemsSlot[0].selected = true;\n } else {\n selected.shift();\n selected.forEach(el => (el.selected = false));\n }\n\n if (this.inverse) {\n this.itemsSlot.map(el => (el.inverse = this.inverse));\n }\n if (this.disabled) {\n this.itemsSlot.map(el => (el.disabled = true));\n }\n }\n\n async componentWillLoad(): Promise {\n this.inheritedAttributes = inheritAttributes(this.el, ['aria-labelledby']);\n }\n\n render() {\n return (\n \n \n {\n this.slot = el as HTMLSlotElement;\n }}\n >\n \n\n
\n \n
\n
\n );\n }\n}\n"],"mappings":"+FAAA,MAAMA,EAAS,wbACf,MAAAC,EAAeD,E,MCOFE,EAAG,M,yBAkBNC,KAAAC,oBAAiD,G,aAbb,M,cAIC,M,eAKC,K,CAO9C,sBAAAC,CAAuBC,GACrB,IAAKH,KAAKI,UAAUC,SAASF,EAAEG,QAAkC,OAEjEN,KAAKI,UAAUG,SAAQC,IACrB,GAAIA,IAAYL,EAAEG,OAAQ,CACvBE,EAAkCC,SAAW,K,KAMpD,mBAAAC,GACEV,KAAKI,UAAUO,KAAIC,GAAOA,EAAGC,QAAUb,KAAKa,S,CAI9C,oBAAAC,GACEd,KAAKI,UAAUO,KAAIC,GAAOA,EAAGG,SAAWf,KAAKe,U,CAG/C,gBAAAC,GACE,IACEhB,KAAKI,UAAYJ,KAAKiB,KACnBC,mBACAC,QAAOP,GAAMA,EAAGQ,QAAQC,gBAAkB,iBAC1CV,KAAIC,GAAMA,G,CACb,MAAAU,GACA,M,CAGF,MAAM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