@dracoui/ember
Version:
Draco Design System for Ember
3 lines (2 loc) • 3.21 kB
JavaScript
import{_ as t,b as e}from"../../../../_rollupPluginBabelHelpers-CLoDr8uC.js";import{action as o}from"@ember/object";import n from"@glimmer/component";import{guidFor as s}from"@ember/object/internals";import{precompileTemplate as i}from"@ember/template-compilation";import{setComponentTemplate as r}from"@ember/component";var d,a=i('<li class={{this.classNames}} ...attributes role="presentation">\n {{!-- Make this a Draco::Button Component --}}\n <button\n role="tab"\n type="button"\n id={{this._tabId}}\n disabled={{this.disabled}}\n class="draco-tabs__tab-button"\n aria-controls={{this.coupledPanelId}}\n aria-selected={{if this.isSelected "true" "false"}}\n tabindex={{unless this.isSelected "-1"}}\n {{did-insert this.didInsertNode @isSelected}}\n {{did-update this.didUpdateNode @count @isSelected}}\n {{will-destroy this.willDestroyNode}}\n {{on "click" this.onClick}}\n {{on "keyup" this.onKeyUp}}\n >\n {{#if this.icon}}\n <Draco::Icon @name={{this.icon}} @size={{this.iconSize}} />\n {{/if}}\n\n {{yield}}\n\n {{#if this.text}}\n <span class="draco-tabs__tab__text">\n {{this.text}}\n </span>\n {{/if}}\n\n {{#if @count}}\n <span>Insert Count Element Here</span>\n {{/if}}\n </button>\n</li>');let p=(t((d=class extends n{constructor(...t){super(...t),e(this,"componentName","Draco::Tabs::Tab"),e(this,"_tabId","tab-"+s(this))}get nodeIndex(){return this.args.tabIds?.indexOf(this._tabId)}get icon(){return this.args.icon??void 0}get iconSize(){const{iconSize:t,size:e}=this.args;if(!t)switch(e){case"medium":return 16;case"large":return 18}return t}get disabled(){return this.args.disabled??!1}get isSelected(){return void 0!==this.nodeIndex&&this.nodeIndex===this.args.selectedTabIndex}get text(){return this.args.text??void 0}get coupledPanelId(){return void 0!==this.nodeIndex?this.args.panelIds?.[this.nodeIndex]:void 0}get classNames(){const t=["draco-tabs__tab"];return this.disabled&&t.push("draco-tabs__tab--disabled"),this.isSelected&&t.push("draco-tabs__tab--selected"),t.join(" ")}didInsertNode(t,e){const{didInsertNode:o}=this.args,n=e[0];"function"==typeof o&&o(t,n)}didUpdateNode(){const{didUpdateNode:t}=this.args;"function"==typeof t&&void 0!==this.nodeIndex&&t(this.nodeIndex,this.args.isSelected)}willDestroyNode(t){const{willDestroyNode:e}=this.args;"function"==typeof e&&e(t)}onClick(t){const{onClick:e}=this.args;if("function"!=typeof e||void 0===this.nodeIndex)return!1;e(t,this.nodeIndex)}onKeyUp(t){const{onKeyUp:e}=this.args;"function"==typeof e&&void 0!==this.nodeIndex&&e(this.nodeIndex,t)}}).prototype,"didInsertNode",[o],Object.getOwnPropertyDescriptor(d.prototype,"didInsertNode"),d.prototype),t(d.prototype,"didUpdateNode",[o],Object.getOwnPropertyDescriptor(d.prototype,"didUpdateNode"),d.prototype),t(d.prototype,"willDestroyNode",[o],Object.getOwnPropertyDescriptor(d.prototype,"willDestroyNode"),d.prototype),t(d.prototype,"onClick",[o],Object.getOwnPropertyDescriptor(d.prototype,"onClick"),d.prototype),t(d.prototype,"onKeyUp",[o],Object.getOwnPropertyDescriptor(d.prototype,"onKeyUp"),d.prototype),d);r(a,p);export{p as default};
//# sourceMappingURL=index.js.map