@dracoui/ember
Version:
Draco Design System for Ember
3 lines (2 loc) • 2.71 kB
JavaScript
import{DracoSkeletonSizeValues as e,DracoSkeletonAnimationValues as t,DracoSkeletonShapeValues as i}from"./types.js";import{assert as s}from"@ember/debug";import o from"@glimmer/component";import{precompileTemplate as n}from"@ember/template-compilation";import{setComponentTemplate as r}from"@ember/component";var h=n('<span\n class={{this.classNames}}\n {{style\n width=(if\n (or\n (and (eq (draco-typeof this.size) "number") (not this.args.width))\n this.args.width\n )\n (concat\n (if this.args.width this.args.width this.size)\n "px"\n )\n )\n height=(if\n (or\n (and (eq (draco-typeof this.size) "number") (not this.args.height))\n this.args.height\n )\n (concat\n (if this.args.height this.args.height this.size)\n "px"\n )\n )\n }}\n ...attributes\n/>\n');const a=e.Medium,c=i.Circle,l=t.Shimmer,u=Object.values(e),m=Object.values(i),d=Object.values(t);class g extends o{constructor(e,t){super(e,t);const{size:i,width:o,height:n}=t;s('@size cannot be used simultaneously with @width or @height for "Draco::Skeleton"',!(void 0!==i&&(void 0!==o||void 0!==n)))}get size(){const{size:e=a}=this.args;return s(`@size for "Draco::Skeleton" must be a number or one of the following: ${u.join(", ")}; received: ${this.args.size}`,"number"==typeof e||u.includes(e)),e}get animation(){const{animation:e=l}=this.args;return s(`@animation for "Draco::Skeleton" must be one of the following: ${d.join(", ")}; received: ${this.args.size}`,d.includes(e)),e}get width(){const{width:e}=this.args;return void 0!==e&&s(`@width for "Draco::Skeleton" must be a positive number; received: ${e}`,"number"==typeof e&&e>0),e}get height(){const{height:e}=this.args;return void 0!==e&&s(`@height for "Draco::Skeleton" must be a positive number; received: ${e}`,"number"==typeof e&&e>0),e}get shape(){const{shape:e=c,height:t,width:i}=this.args;return s(`@shape for "Draco::Skeleton" must be one of the following: ${m.join(", ")}; received: ${this.args.size}`,m.includes(e)),e}get isFullWidth(){const{isFullWidth:e=!1}=this.args;return s(`@isFullWidth for "Draco::Skeleton" must be a 'boolean'; received: ${e}`,"boolean"==typeof e),e}get classNames(){const e=["draco-skeleton"];return"number"!=typeof this.size&&e.push(`draco-skeleton--size-${this.size}`),this.isFullWidth&&e.push("draco-skeleton--width-full"),e.push(`draco-skeleton--shape-${this.shape}`),e.push(`draco-skeleton--animation-${this.animation}`),e.join(" ")}}r(h,g);export{d as AVAILABLE_ANIMATIONS,m as AVAILABLE_SHAPES,u as AVAILABLE_SIZES,l as DEFAULT_ANIMATION,c as DEFAULT_SHAPE,a as DEFAULT_SIZE,g as default};
//# sourceMappingURL=index.js.map