{"version":3,"mappings":"0LAAAA,6GAGAA,SACEA,iBACEA,iBACEA,iBACFA,QACAA,iBACEA,iBACFA,QACFA,QACFA,+BACAA,SACEA,kBACAA,kBACAA,kBACFA,uBCcO,IAAMC,EAAb,MAAM,QAqBJC,YAAoBC,EAA6CC,GAA7CC,kBAA6CA,gBAf1DA,aAA0B,UAO1BA,cAAU,EAsBTA,cAAYF,IAClBE,KAAKD,SAASE,SAASH,EAAWI,cAAe,WAbnDC,wBAEMH,KAAKI,UAAUC,QAA2B,WAAjBL,KAAKM,SAAyC,gBAAjBN,KAAKM,QAE7DN,KAAKI,UAAUG,QAAQP,KAAKC,UAEzBD,KAAKC,SAASD,KAAKF,0DA7BfF,GAAgBD,oDAAhBC,EAAgBY,scD/B7Bb,8BAGAA,gCAUAA,uCAZGA,0EAEYA,4DAUAA,w8LCkBFC,GAAb,EAAaA","names":["i0","LoadingComponent","constructor","elementRef","renderer","this","addClass","nativeElement","ngAfterContentChecked","queryList","length","variant","forEach","selectors"],"sources":["../ui/src/lib/loading/loading.component.html","../ui/src/lib/loading/loading.component.ts"],"sourcesContent":["\n\n \n\n\n \n \n \n\n","import {\n AfterContentChecked,\n ChangeDetectionStrategy,\n Component,\n ContentChildren,\n ElementRef,\n HostBinding,\n Input,\n QueryList,\n Renderer2,\n ViewEncapsulation,\n} from \"@angular/core\";\n\nexport type LoadingVariant = \"circle-spin\" | \"shimmer\" | \"spinner\" | \"typing\";\n\n/**\n * Vattenfall UI `ui-loading` is a shimmering indicator of progress and activity.\n *\n * The loading element inherits the width and height of either its host element – ``, or any element provided as content children to the loading element that has an `#loader` template reference – ``. If the loading element contains a single text node then the loader will be styled in a fashion which more closely resembles the text it is supposed to represent.\n *\n * The spinner will span the entire height and width of the host element if it is not empty, but none of its child elements has an `loader` template reference.\n *\n * The circle-spin and the typing loading indicator does not accept `loader` child elements.\n */\n@Component({\n selector: \"ui-loading, [ui-loading]\",\n templateUrl: \"./loading.component.html\",\n styleUrls: [\"./loading.component.scss\"],\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class LoadingComponent implements AfterContentChecked {\n /**\n * The variants to show this component in\n */\n @HostBinding(\"attr.variant\")\n @Input()\n public variant: LoadingVariant = \"shimmer\";\n\n /**\n * Whether the component loading state is activated\n */\n @HostBinding(\"attr.loading\")\n @Input()\n public loading = true;\n\n /**\n * Holds all elements passed as content children with `#loader` template reference ID.\n */\n @ContentChildren(\"loader\", { descendants: true })\n private queryList!: QueryList>;\n\n constructor(private elementRef: ElementRef, private renderer: Renderer2) {}\n\n ngAfterContentChecked() {\n // The provided content children has elements with `loader` references\n if (this.queryList.length && this.variant !== \"typing\" && this.variant !== \"circle-spin\")\n // Add class names to content children\n this.queryList.forEach(this.addClass);\n // Add class names to host element\n else this.addClass(this.elementRef);\n }\n\n /**\n * Adds class names to host element or nested content children depending on the display type of that element\n */\n private addClass = (elementRef: ElementRef): void => {\n this.renderer.addClass(elementRef.nativeElement, \"loader\");\n };\n}\n"],"sourceRoot":"webpack:///","file":"common.js"}