[
  {
    "tags": [],
    "description": {
      "full": "",
      "summary": "",
      "body": ""
    },
    "isPrivate": false,
    "isConstructor": false,
    "line": 1,
    "codeStart": null,
    "code": "import {\n  children,\n  customElement\n} from 'aurelia-framework';\n\nimport * as UIkit from 'uikit';\nimport {AireTab}  from \"aire/tabs/tab\";\nimport {TabPanel} from \"uikit\";\n\nimport {Aire}     from 'aire/core/application';\n\n@customElement('aire-tab-panel')\nexport class AireTabPanel {\n\n\n\n  private panel: TabPanel;\n  private element: HTMLElement;\n  private container: HTMLDivElement;\n\n  @children('aire-tab')\n  private children: AireTab[];\n\n  private activeTab: AireTab;\n\n  private cid = Aire.id;\n\n  attached() : void {\n    this.panel = UIkit.tab(this.element);\n    Aire.listen(this.container, 'beforeshow', this.beforeShow.bind(this));\n  }\n\n  public get active() : AireTab {\n    return this.activeTab;\n  }\n\n\n  private beforeShow(a: CustomEvent) {\n    let source = a.srcElement,\n      target = a.target,\n      children = this.children,\n      sourceTab : AireTab,\n      targetTab : AireTab;\n\n    if(children) {\n\n      for(let c of children) {\n        if(c.el === source) {\n          sourceTab = c;\n        }\n        if(c.el === target) {\n          targetTab = c;\n        }\n      }\n      this.activeTab = targetTab;\n    }\n\n\n\n    if(sourceTab) {\n      sourceTab.deactivate(a);\n    }\n\n    if(targetTab) {\n      targetTab.activate(a);\n    }\n  }\n\n\n}",
    "ctx": false
  }
]