@dracoui/ember
Version:
Draco Design System for Ember
3 lines (2 loc) • 2.56 kB
JavaScript
import{_ as e}from"../../../_rollupPluginBabelHelpers-CLoDr8uC.js";import r from"@glimmer/component";import{action as t}from"@ember/object";import{assert as o}from"@ember/debug";import{precompileTemplate as n}from"@ember/template-compilation";import{setComponentTemplate as a}from"@ember/component";var i,l=n('{{~#if @route~}}\n {{~#if this.isRouteExternal~}}\n <LinkToExternal\n draggable={{false}}\n @current-when={{@current-when}}\n @isRouteExternal={{this.isRouteExternal}}\n @models={{draco-link-to-models @model @models}}\n @query={{draco-link-to-query @query}}\n @replace={{@replace}}\n @route={{@route}}\n ...attributes\n >{{yield}}</LinkToExternal>\n {{~else~}}\n <LinkTo\n draggable={{false}}\n @current-when={{@current-when}}\n @models={{draco-link-to-models @model @models}}\n @query={{draco-link-to-query @query}}\n @replace={{@replace}}\n @route={{@route}}\n ...attributes\n >{{yield}}</LinkTo>\n {{~/if~}}\n{{~else if @href~}}\n {{~#if this.isHrefExternal~}}\n <a draggable={{false}} target="_blank" rel="noopener noreferrer" ...attributes href={{@href}} {{on "keyup" this.onKeyUp}}>{{yield}}</a>\n {{~else~}}\n <a draggable={{false}} ...attributes href={{@href}} {{on "keyup" this.onKeyUp}}>{{yield}}</a>\n {{~/if~}}\n{{~else~}}\n <button type="button" draggable={{false}} ...attributes>{{yield}}</button>\n{{~/if~}}');let s=(e((i=class extends r{constructor(e,r){super(e,r),o('@href and @route for "Draco::Interactive" cannot be set at the same time.',!(r.href&&r.route))}get isHrefExternal(){const{isHrefExternal:e,href:r}=this.args;if(o(`@isHrefExternal for "Draco::Interactive" must be a valid 'boolean'; received: ${e}`,void 0===e||"boolean"==typeof e),o(`@href for "Draco::Interactive" must be a valid 'string'; received: ${r}`,void 0===r||"string"==typeof r),"boolean"==typeof e)return e;if(r)try{return new URL(r,window.location.origin).origin!==window.location.origin}catch(e){return!1}return!1}get isRouteExternal(){const{isRouteExternal:e,route:r}=this.args;return o(`@isRouteExternal for "Draco::Interactive" must be a valid 'boolean'; received: ${e}`,void 0===e||"boolean"==typeof e),o(`@route for "Draco::Interactive" must be a valid 'string'; received: ${r}`,void 0===r||"string"==typeof r),"boolean"==typeof e&&e}onKeyUp(e){" "!==e.key&&"Space"!==e.key||e.target.click()}}).prototype,"onKeyUp",[t],Object.getOwnPropertyDescriptor(i.prototype,"onKeyUp"),i.prototype),i);a(l,s);export{s as default};
//# sourceMappingURL=index.js.map