circletone.mjs 120 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442
  1. import * as i0 from '@angular/core';
  2. import { Component, ChangeDetectionStrategy, Input, EventEmitter, Output, Pipe, Directive, HostListener, forwardRef, ContentChildren, Injectable, inject, DestroyRef, Optional, SkipSelf, ContentChild, signal, ChangeDetectorRef, ViewChild } from '@angular/core';
  3. import { NgClass, AsyncPipe, NgTemplateOutlet, KeyValuePipe, DecimalPipe } from '@angular/common';
  4. import * as i1 from '@angular/platform-browser';
  5. import { RouterLink } from '@angular/router';
  6. import { TemplatePortal } from '@angular/cdk/portal';
  7. import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
  8. import { debounceTime, BehaviorSubject, skip, filter, Subject, fromEvent } from 'rxjs';
  9. import * as i1$1 from '@angular/cdk/overlay';
  10. import * as i1$2 from '@angular/forms';
  11. import { NG_VALUE_ACCESSOR, ControlContainer, FormGroupDirective } from '@angular/forms';
  12. import { distinctUntilChanged, debounceTime as debounceTime$1, map, startWith, tap } from 'rxjs/operators';
  13. class IconComponent {
  14. constructor() {
  15. this.icon = '';
  16. this.fill = 'currentColor';
  17. this.strokeWidth = 1.5;
  18. this.strokeColor = 'currentColor';
  19. this.size = 'base';
  20. this.variant = 'outline';
  21. }
  22. ngOnInit() {
  23. this.strokeColor = this.getFormattedColor(this.strokeColor);
  24. this.fill = this.getFormattedColor(this.fill);
  25. }
  26. get iconPath() {
  27. const icon = this.variant === 'solid' ? `${this.icon}-solid` : this.icon;
  28. return `/assets/images/icons.svg#${icon}`;
  29. }
  30. getFormattedColor(color) {
  31. if (color.startsWith('--')) {
  32. const rgbValue = getComputedStyle(document.documentElement).getPropertyValue(color).trim();
  33. return `rgb(${rgbValue})`;
  34. }
  35. return color;
  36. }
  37. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  38. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: IconComponent, isStandalone: true, selector: "ct-icon", inputs: { icon: "icon", fill: "fill", strokeWidth: "strokeWidth", strokeColor: "strokeColor", size: "size", variant: "variant" }, ngImport: i0, template: "<svg\n [attr.fill]=\"variant === 'solid' ? fill : 'none'\"\n [attr.stroke-width]=\"variant === 'outline' ? strokeWidth : 0\"\n [attr.stroke]=\"strokeColor\"\n class=\"flex\"\n [class.size-3]=\"size === 'xs'\"\n [class.size-4]=\"size === 'sm'\"\n [class.size-5]=\"size === 'base'\"\n [class.size-6]=\"size === 'lg'\"\n [class.size-8]=\"size === 'xl'\"\n [class.size-10]=\"size === '2xl'\">\n <use [attr.xlink:href]=\"iconPath\"></use>\n</svg>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  39. }
  40. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: IconComponent, decorators: [{
  41. type: Component,
  42. args: [{ selector: 'ct-icon', standalone: true, imports: [NgClass], changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg\n [attr.fill]=\"variant === 'solid' ? fill : 'none'\"\n [attr.stroke-width]=\"variant === 'outline' ? strokeWidth : 0\"\n [attr.stroke]=\"strokeColor\"\n class=\"flex\"\n [class.size-3]=\"size === 'xs'\"\n [class.size-4]=\"size === 'sm'\"\n [class.size-5]=\"size === 'base'\"\n [class.size-6]=\"size === 'lg'\"\n [class.size-8]=\"size === 'xl'\"\n [class.size-10]=\"size === '2xl'\">\n <use [attr.xlink:href]=\"iconPath\"></use>\n</svg>\n" }]
  43. }], propDecorators: { icon: [{
  44. type: Input
  45. }], fill: [{
  46. type: Input
  47. }], strokeWidth: [{
  48. type: Input
  49. }], strokeColor: [{
  50. type: Input
  51. }], size: [{
  52. type: Input
  53. }], variant: [{
  54. type: Input
  55. }] } });
  56. /**
  57. * This is the ButtonComponent, widely used among other components
  58. */
  59. class ButtonComponent {
  60. constructor() {
  61. this.iconPosition = 'left';
  62. this.role = 'button';
  63. this.disabled = false;
  64. this.fullSize = false;
  65. this.size = 'base';
  66. this.type = 'primary';
  67. this.variant = 'solid';
  68. }
  69. get cssClassmap() {
  70. return {
  71. [`text-on-${this.type} dark:text-on-${this.type}-dark`]: this.variant === 'solid' || this.variant === 'gradient' || this.variant === 'flat',
  72. [`text-${this.type} dark:text-${this.type}-dark hover:text-${this.type}-variant dark:hover:text-${this.type}-variant-dark`]: this.variant === 'blank' || this.variant === 'outline',
  73. [`bg-${this.type} dark:bg-${this.type}-dark hover:bg-${this.type}-variant hover:dark:bg-${this.type}-variant-dark`]: this.variant === 'solid',
  74. [`bg-${this.type}/25 dark:bg-${this.type}-dark/25 hover:bg-${this.type}-variant/25 hover:dark:bg-${this.type}-variant-dark/25`]: this.variant === 'flat',
  75. [`from-${this.type}-variant from-30% to-${this.type} bg-gradient-to-tl hover:bg-gradient-to-br dark:from-${this.type}-variant-dark dark:to-${this.type}-dark`]: this.variant === 'gradient',
  76. [`border border-2 border-${this.type} hover:border-${this.type}-variant dark:border-${this.type}-dark`]: this.variant === 'outline',
  77. 'px-3 py-2': (this.size === 'xs' || this.size === 'sm') && !this.hasJustIcon(),
  78. 'px-5 py-2.5': (this.size === 'base' || this.size === 'lg') && !this.hasJustIcon(),
  79. 'px-6 py-3': this.size === 'xl' && !this.hasJustIcon(),
  80. 'p-1': this.hasJustIcon() && this.variant !== 'blank',
  81. 'text-xs': this.size === 'xs',
  82. 'text-sm': this.size === 'sm' || this.size === 'base',
  83. 'text-base': this.size === 'lg' || this.size === 'xl',
  84. 'w-full grow': this.fullSize,
  85. 'opacity-50 hover:none': this.disabled,
  86. };
  87. }
  88. hasJustIcon() {
  89. return this.icon !== undefined && this.text === undefined;
  90. }
  91. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  92. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: ButtonComponent, isStandalone: true, selector: "ct-button", inputs: { text: "text", icon: "icon", iconPosition: "iconPosition", role: "role", disabled: "disabled", fullSize: "fullSize", size: "size", type: "type", variant: "variant" }, ngImport: i0, template: "<button\n [type]=\"role\"\n class=\"flex flex-row items-center justify-center gap-1.5 rounded-md font-primary font-medium\"\n [ngClass]=\"cssClassmap\"\n [disabled]=\"disabled\">\n @if (icon) {\n <ct-icon class=\"flex\" [size]=\"size\" [icon]=\"icon\" />\n }\n @if (text) {\n <span [class.order-first]=\"iconPosition === 'right'\">\n {{ text }}\n </span>\n }\n</button>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: IconComponent, selector: "ct-icon", inputs: ["icon", "fill", "strokeWidth", "strokeColor", "size", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  93. }
  94. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ButtonComponent, decorators: [{
  95. type: Component,
  96. args: [{ selector: 'ct-button', standalone: true, imports: [NgClass, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n [type]=\"role\"\n class=\"flex flex-row items-center justify-center gap-1.5 rounded-md font-primary font-medium\"\n [ngClass]=\"cssClassmap\"\n [disabled]=\"disabled\">\n @if (icon) {\n <ct-icon class=\"flex\" [size]=\"size\" [icon]=\"icon\" />\n }\n @if (text) {\n <span [class.order-first]=\"iconPosition === 'right'\">\n {{ text }}\n </span>\n }\n</button>\n" }]
  97. }], propDecorators: { text: [{
  98. type: Input
  99. }], icon: [{
  100. type: Input
  101. }], iconPosition: [{
  102. type: Input
  103. }], role: [{
  104. type: Input
  105. }], disabled: [{
  106. type: Input
  107. }], fullSize: [{
  108. type: Input
  109. }], size: [{
  110. type: Input
  111. }], type: [{
  112. type: Input
  113. }], variant: [{
  114. type: Input
  115. }] } });
  116. /**
  117. * The alert component is responsible to show alerts for diverse elements. Including `FormErrorComponent` among others.
  118. */
  119. class AlertComponent {
  120. constructor() {
  121. this.dismissable = false;
  122. this.fullSize = true;
  123. this.text = '';
  124. this.type = 'primary';
  125. this.variant = 'solid';
  126. this.size = 'base';
  127. this.withIcon = true;
  128. this.dismiss = new EventEmitter();
  129. }
  130. get icon() {
  131. switch (this.type) {
  132. case 'primary':
  133. case 'secondary':
  134. case 'neutral':
  135. return 'information-circle';
  136. case 'error':
  137. return 'exclamation-triangle';
  138. case 'warning':
  139. return 'exclamation-circle';
  140. case 'success':
  141. return 'check-circle';
  142. default:
  143. return '';
  144. }
  145. }
  146. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  147. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: AlertComponent, isStandalone: true, selector: "ct-alert", inputs: { dismissable: "dismissable", fullSize: "fullSize", text: "text", type: "type", variant: "variant", size: "size", withIcon: "withIcon" }, outputs: { dismiss: "dismiss" }, ngImport: i0, template: "<div\n class=\"flex flex-row items-center gap-1 rounded-lg font-primary\"\n [class.w-fit]=\"!fullSize\"\n [class.w-full]=\"fullSize\"\n role=\"alert\"\n [ngClass]=\"{\n 'text-xs': size === 'xs' || size === 'sm',\n 'text-sm': size === 'base',\n 'text-base': size === 'lg' || size === 'xl',\n 'text-primary dark:text-on-primary-dark': type === 'primary' && variant !== 'solid',\n 'text-neutral dark:text-on-neutral-dark': type === 'neutral' && variant !== 'solid',\n 'text-warning dark:text-warning-variant-dark': type === 'warning' && variant !== 'solid',\n 'text-error dark:text-error-variant-dark': type === 'error' && variant !== 'solid',\n 'text-success dark:texts-success-variant-dark': type === 'success' && variant !== 'solid',\n\n 'bg-primary dark:bg-primary-dark text-on-primary dark:text-on-primary-dark':\n type === 'primary' && variant === 'solid',\n 'bg-neutral dark:bg-neutral-dark text-on-neutral dark:text-on-neutral-dark':\n type === 'neutral' && variant === 'solid',\n 'bg-warning dark:bg-warning-dark text-on-warning dark:text-on-warning-dark':\n type === 'warning' && variant === 'solid',\n 'bg-error dark:bg-error-dark text-on-error dark:text-on-error-dark': type === 'error' && variant === 'solid',\n 'bg-success dark:bg-success-dark text-on-success dark:text-on-success-dark':\n type === 'success' && variant === 'solid',\n\n border: variant === 'outline',\n 'border-primary dark:border-primary-dark': type === 'primary' && variant === 'outline',\n 'border-warning dark:border-warning-dark': type === 'warning' && variant === 'outline',\n 'border-error dark:border-error-dark': type === 'error' && variant === 'outline',\n 'border-success dark:border-success-dark': type === 'success' && variant === 'outline',\n 'px-4 py-2': variant !== 'blank'\n }\">\n @if (withIcon) {\n <ct-icon [icon]=\"this.icon\" [size]=\"size\" />\n }\n <span class=\"grow font-semibold\">{{ text }}</span>\n @if (dismissable) {\n <ct-button\n icon=\"x-mark\"\n size=\"sm\"\n [variant]=\"this.variant === 'solid' ? 'solid' : 'blank'\"\n [type]=\"type\"\n (click)=\"dismiss.emit()\" />\n }\n</div>\n", dependencies: [{ kind: "component", type: IconComponent, selector: "ct-icon", inputs: ["icon", "fill", "strokeWidth", "strokeColor", "size", "variant"] }, { kind: "component", type: ButtonComponent, selector: "ct-button", inputs: ["text", "icon", "iconPosition", "role", "disabled", "fullSize", "size", "type", "variant"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  148. }
  149. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AlertComponent, decorators: [{
  150. type: Component,
  151. args: [{ selector: 'ct-alert', standalone: true, imports: [IconComponent, ButtonComponent, NgClass], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"flex flex-row items-center gap-1 rounded-lg font-primary\"\n [class.w-fit]=\"!fullSize\"\n [class.w-full]=\"fullSize\"\n role=\"alert\"\n [ngClass]=\"{\n 'text-xs': size === 'xs' || size === 'sm',\n 'text-sm': size === 'base',\n 'text-base': size === 'lg' || size === 'xl',\n 'text-primary dark:text-on-primary-dark': type === 'primary' && variant !== 'solid',\n 'text-neutral dark:text-on-neutral-dark': type === 'neutral' && variant !== 'solid',\n 'text-warning dark:text-warning-variant-dark': type === 'warning' && variant !== 'solid',\n 'text-error dark:text-error-variant-dark': type === 'error' && variant !== 'solid',\n 'text-success dark:texts-success-variant-dark': type === 'success' && variant !== 'solid',\n\n 'bg-primary dark:bg-primary-dark text-on-primary dark:text-on-primary-dark':\n type === 'primary' && variant === 'solid',\n 'bg-neutral dark:bg-neutral-dark text-on-neutral dark:text-on-neutral-dark':\n type === 'neutral' && variant === 'solid',\n 'bg-warning dark:bg-warning-dark text-on-warning dark:text-on-warning-dark':\n type === 'warning' && variant === 'solid',\n 'bg-error dark:bg-error-dark text-on-error dark:text-on-error-dark': type === 'error' && variant === 'solid',\n 'bg-success dark:bg-success-dark text-on-success dark:text-on-success-dark':\n type === 'success' && variant === 'solid',\n\n border: variant === 'outline',\n 'border-primary dark:border-primary-dark': type === 'primary' && variant === 'outline',\n 'border-warning dark:border-warning-dark': type === 'warning' && variant === 'outline',\n 'border-error dark:border-error-dark': type === 'error' && variant === 'outline',\n 'border-success dark:border-success-dark': type === 'success' && variant === 'outline',\n 'px-4 py-2': variant !== 'blank'\n }\">\n @if (withIcon) {\n <ct-icon [icon]=\"this.icon\" [size]=\"size\" />\n }\n <span class=\"grow font-semibold\">{{ text }}</span>\n @if (dismissable) {\n <ct-button\n icon=\"x-mark\"\n size=\"sm\"\n [variant]=\"this.variant === 'solid' ? 'solid' : 'blank'\"\n [type]=\"type\"\n (click)=\"dismiss.emit()\" />\n }\n</div>\n" }]
  152. }], propDecorators: { dismissable: [{
  153. type: Input
  154. }], fullSize: [{
  155. type: Input
  156. }], text: [{
  157. type: Input,
  158. args: [{ required: true }]
  159. }], type: [{
  160. type: Input
  161. }], variant: [{
  162. type: Input
  163. }], size: [{
  164. type: Input
  165. }], withIcon: [{
  166. type: Input
  167. }], dismiss: [{
  168. type: Output
  169. }] } });
  170. class SafeImagePipe {
  171. constructor(sanitizer) {
  172. this.sanitizer = sanitizer;
  173. }
  174. transform(value, type = 'image/webp') {
  175. const imageBase64 = `data:${type};base64,${value}`;
  176. return this.sanitizer.bypassSecurityTrustUrl(imageBase64);
  177. }
  178. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: SafeImagePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe }); }
  179. static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.5", ngImport: i0, type: SafeImagePipe, isStandalone: true, name: "safeImage" }); }
  180. }
  181. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: SafeImagePipe, decorators: [{
  182. type: Pipe,
  183. args: [{
  184. name: 'safeImage',
  185. standalone: true,
  186. }]
  187. }], ctorParameters: () => [{ type: i1.DomSanitizer }] });
  188. class AvatarComponent {
  189. constructor() {
  190. this.picture = '';
  191. this.title = '';
  192. this.titleInitials = '';
  193. }
  194. ngOnInit() {
  195. this.titleInitials = this.title
  196. .split(' ')
  197. .map(word => word[0]?.toLocaleUpperCase())
  198. .splice(0, 2)
  199. .join('');
  200. }
  201. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  202. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: AvatarComponent, isStandalone: true, selector: "ct-avatar", inputs: { picture: "picture", title: "title" }, ngImport: i0, template: "@if (picture) {\n <img\n [src]=\"picture | safeImage\"\n alt=\"{{ title }}\"\n class=\"size-20 rounded-full border-2 border-primary object-cover dark:border-primary-dark\" />\n} @else {\n <div\n class=\"size-16 truncate text-ellipsis rounded-full border border-primary bg-primary-container p-4 text-center text-on-primary-container dark:bg-primary-container-dark dark:text-on-primary-container-dark\">\n <span class=\"text-2xl font-medium\"> {{ titleInitials }}</span>\n </div>\n}\n", dependencies: [{ kind: "pipe", type: SafeImagePipe, name: "safeImage" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  203. }
  204. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AvatarComponent, decorators: [{
  205. type: Component,
  206. args: [{ selector: 'ct-avatar', standalone: true, imports: [IconComponent, SafeImagePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (picture) {\n <img\n [src]=\"picture | safeImage\"\n alt=\"{{ title }}\"\n class=\"size-20 rounded-full border-2 border-primary object-cover dark:border-primary-dark\" />\n} @else {\n <div\n class=\"size-16 truncate text-ellipsis rounded-full border border-primary bg-primary-container p-4 text-center text-on-primary-container dark:bg-primary-container-dark dark:text-on-primary-container-dark\">\n <span class=\"text-2xl font-medium\"> {{ titleInitials }}</span>\n </div>\n}\n" }]
  207. }], propDecorators: { picture: [{
  208. type: Input
  209. }], title: [{
  210. type: Input
  211. }] } });
  212. class HeaderComponent {
  213. constructor() {
  214. this.title = '';
  215. }
  216. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: HeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  217. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: HeaderComponent, isStandalone: true, selector: "ct-header", inputs: { title: "title" }, ngImport: i0, template: "<div\n class=\"flex h-14 w-full items-center justify-between bg-gradient-to-b from-surface to-primary px-4 py-2 dark:from-surface-variant-dark dark:to-primary-container-dark\">\n <div class=\"flex grow font-logo\">{{ title }}</div>\n <ng-content />\n</div>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  218. }
  219. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: HeaderComponent, decorators: [{
  220. type: Component,
  221. args: [{ selector: 'ct-header', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"flex h-14 w-full items-center justify-between bg-gradient-to-b from-surface to-primary px-4 py-2 dark:from-surface-variant-dark dark:to-primary-container-dark\">\n <div class=\"flex grow font-logo\">{{ title }}</div>\n <ng-content />\n</div>\n" }]
  222. }], propDecorators: { title: [{
  223. type: Input
  224. }] } });
  225. class OverlayDirective {
  226. constructor(overlay, elementRef, viewContainerRef, destroyRef) {
  227. this.overlay = overlay;
  228. this.elementRef = elementRef;
  229. this.viewContainerRef = viewContainerRef;
  230. this.destroyRef = destroyRef;
  231. this.verticalPositions = {
  232. bottomStart: {
  233. originX: 'start',
  234. originY: 'bottom',
  235. overlayX: 'start',
  236. overlayY: 'top',
  237. },
  238. topStart: {
  239. originX: 'start',
  240. originY: 'top',
  241. overlayX: 'start',
  242. overlayY: 'bottom',
  243. },
  244. bottomEnd: {
  245. originX: 'end',
  246. originY: 'bottom',
  247. overlayX: 'end',
  248. overlayY: 'top',
  249. },
  250. topEnd: {
  251. originX: 'end',
  252. originY: 'top',
  253. overlayX: 'end',
  254. overlayY: 'bottom',
  255. },
  256. };
  257. this.horizontalPositions = {
  258. bottomStart: {
  259. originX: 'end',
  260. originY: 'bottom',
  261. overlayX: 'start',
  262. overlayY: 'bottom',
  263. offsetY: 7,
  264. },
  265. topStart: {
  266. originX: 'start',
  267. originY: 'bottom',
  268. overlayX: 'end',
  269. overlayY: 'bottom',
  270. },
  271. };
  272. this.overlayRef = null;
  273. this.position = 'horizontal';
  274. this.opened = new EventEmitter();
  275. this.closed = new EventEmitter();
  276. }
  277. show() {
  278. this.openDropdown();
  279. this.opened.emit();
  280. }
  281. openDropdown() {
  282. if (!this.overlayRef) {
  283. this.overlayRef = this.overlay.create({
  284. positionStrategy: this.getOverlayPosition(),
  285. });
  286. this.overlayRef
  287. .outsidePointerEvents()
  288. .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(100))
  289. .subscribe(() => {
  290. this.closeDropdown();
  291. this.closed.emit();
  292. });
  293. }
  294. if (this.contentTemplate && !this.overlayRef.hasAttached()) {
  295. const portal = new TemplatePortal(this.contentTemplate, this.viewContainerRef);
  296. this.overlayRef.attach(portal);
  297. }
  298. }
  299. closeDropdown() {
  300. if (this.overlayRef?.hasAttached()) {
  301. this.overlayRef.detach();
  302. }
  303. }
  304. getOverlayPosition() {
  305. const positions = this.position === 'horizontal' ? this.horizontalPositions : this.verticalPositions;
  306. return this.overlay
  307. .position()
  308. .flexibleConnectedTo(this.elementRef)
  309. .withPositions(Object.keys(positions).map(positionKey => positions[positionKey]));
  310. }
  311. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: OverlayDirective, deps: [{ token: i1$1.Overlay }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Directive }); }
  312. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.5", type: OverlayDirective, isStandalone: true, selector: "[ctOverlay]", inputs: { contentTemplate: ["ctOverlay", "contentTemplate"], position: ["ctOverlayPosition", "position"] }, outputs: { opened: "opened", closed: "closed" }, host: { listeners: { "click": "show()", "touchstart": "show()" } }, ngImport: i0 }); }
  313. }
  314. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: OverlayDirective, decorators: [{
  315. type: Directive,
  316. args: [{
  317. selector: '[ctOverlay]',
  318. standalone: true,
  319. }]
  320. }], ctorParameters: () => [{ type: i1$1.Overlay }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.DestroyRef }], propDecorators: { contentTemplate: [{
  321. type: Input,
  322. args: ['ctOverlay']
  323. }], position: [{
  324. type: Input,
  325. args: ['ctOverlayPosition']
  326. }], opened: [{
  327. type: Output
  328. }], closed: [{
  329. type: Output
  330. }], show: [{
  331. type: HostListener,
  332. args: ['click']
  333. }, {
  334. type: HostListener,
  335. args: ['touchstart']
  336. }] } });
  337. class MenuComponent {
  338. constructor() {
  339. this.direction = 'vertical';
  340. this.iconDirection = 'horizontal';
  341. this.type = 'primary';
  342. this.variant = 'solid';
  343. this.gap = 2;
  344. this.fullSize = true;
  345. this.iconAlone = false;
  346. this.menusAppearVertical = false;
  347. }
  348. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: MenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  349. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: MenuComponent, isStandalone: true, selector: "ct-menu", inputs: { direction: "direction", iconDirection: "iconDirection", type: "type", variant: "variant", gap: "gap", fullSize: "fullSize", iconAlone: "iconAlone", menusAppearVertical: "menusAppearVertical" }, ngImport: i0, template: "<div\n class=\"flex flex-col gap-{{ gap }} z-10 rounded-md p-2 font-primary\"\n [ngClass]=\"{\n 'shadow-lg': variant === 'solid',\n 'bg-surface dark:bg-surface-dark': variant === 'solid'\n }\">\n <div\n class=\"flex justify-around\"\n [class.flex-col]=\"direction === 'vertical'\"\n [class.flex-row]=\"direction === 'horizontal'\">\n <ng-content></ng-content>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i0.forwardRef(() => NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  350. }
  351. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: MenuComponent, decorators: [{
  352. type: Component,
  353. args: [{ selector: 'ct-menu', standalone: true, imports: [NgClass, forwardRef(() => MenuItemComponent), OverlayDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"flex flex-col gap-{{ gap }} z-10 rounded-md p-2 font-primary\"\n [ngClass]=\"{\n 'shadow-lg': variant === 'solid',\n 'bg-surface dark:bg-surface-dark': variant === 'solid'\n }\">\n <div\n class=\"flex justify-around\"\n [class.flex-col]=\"direction === 'vertical'\"\n [class.flex-row]=\"direction === 'horizontal'\">\n <ng-content></ng-content>\n </div>\n</div>\n" }]
  354. }], propDecorators: { direction: [{
  355. type: Input
  356. }], iconDirection: [{
  357. type: Input
  358. }], type: [{
  359. type: Input
  360. }], variant: [{
  361. type: Input
  362. }], gap: [{
  363. type: Input
  364. }], fullSize: [{
  365. type: Input
  366. }], iconAlone: [{
  367. type: Input
  368. }], menusAppearVertical: [{
  369. type: Input
  370. }] } });
  371. class MenuItemComponent {
  372. constructor() {
  373. this.text = '';
  374. this.link = '';
  375. this.type = 'internal';
  376. this.size = 'base';
  377. this.icon = '';
  378. this.iconSize = 'base';
  379. this.iconAlone = false;
  380. this.iconDirection = 'horizontal';
  381. this.hasSubmenu = false;
  382. this.submenuPosition = 'horizontal';
  383. this.isActive = false;
  384. this.isOpen = new BehaviorSubject(false);
  385. }
  386. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: MenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  387. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: MenuItemComponent, isStandalone: true, selector: "ct-menu-item", inputs: { text: "text", link: "link", type: "type", size: "size", icon: "icon", iconSize: "iconSize", iconAlone: "iconAlone", iconDirection: "iconDirection", hasSubmenu: "hasSubmenu", submenuPosition: "submenuPosition", isActive: "isActive" }, queries: [{ propertyName: "menus", predicate: MenuComponent }], ngImport: i0, template: "@if (menus.length > 0) {\n <a\n [ctOverlay]=\"dropDown\"\n [ctOverlayPosition]=\"submenuPosition\"\n (closed)=\"isOpen.next(false)\"\n (opened)=\"isOpen.next(true)\"\n [ngClass]=\"{\n 'bg-surface-variant dark:bg-surface-variant-dark': isOpen | async\n }\"\n class=\"block cursor-pointer rounded-md px-4 py-2 font-medium text-on-surface hover:bg-surface-variant dark:text-on-surface-dark hover:dark:bg-surface-variant-dark\">\n <span\n class=\"flex items-center gap-3\"\n [class.flex-row]=\"iconDirection === 'horizontal'\"\n [class.flex-col]=\"iconDirection === 'vertical'\">\n @if (icon) {\n <ct-icon [icon]=\"icon\" [size]=\"iconSize\" />\n }\n @if (text && !iconAlone) {\n <span\n [class.text-sm]=\"size === 'xs' || size === 'sm'\"\n [class.text-base]=\"size === 'base' || size === 'lg'\"\n [class.text-xl]=\"size === 'xl'\"\n >{{ text }}</span\n >\n }\n @if (!iconAlone) {\n @if (isOpen | async) {\n <ct-icon [icon]=\"submenuPosition === 'vertical' ? 'chevron-up' : 'chevron-left'\" variant=\"blank\" />\n } @else {\n <ct-icon [icon]=\"submenuPosition === 'vertical' ? 'chevron-down' : 'chevron-right'\" variant=\"blank\" />\n }\n }\n </span>\n </a>\n <ng-template #dropDown><ng-content></ng-content></ng-template>\n} @else {\n <a\n class=\"block cursor-pointer rounded-md px-4 py-2 font-medium text-on-surface hover:bg-surface-variant dark:text-on-surface-dark dark:hover:bg-surface-variant-dark\"\n [routerLink]=\"link\"\n [ngClass]=\"{\n 'bg-surface-variant dark:bg-surface-variant-dark': isActive\n }\">\n <span\n class=\"flex items-center gap-3\"\n [class.flex-row]=\"iconDirection === 'horizontal'\"\n [class.flex-col]=\"iconDirection === 'vertical'\">\n @if (icon) {\n <ct-icon [icon]=\"icon\" variant=\"solid\" [size]=\"iconSize\" />\n }\n @if (text && !iconAlone) {\n <span\n [class.text-sm]=\"size === 'xs' || size === 'sm'\"\n [class.text-base]=\"size === 'base' || size === 'lg'\"\n [class.text-xl]=\"size === 'xl'\"\n >{{ text }}</span\n >\n }\n </span>\n </a>\n}\n", dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: IconComponent, selector: "ct-icon", inputs: ["icon", "fill", "strokeWidth", "strokeColor", "size", "variant"] }, { kind: "directive", type: OverlayDirective, selector: "[ctOverlay]", inputs: ["ctOverlay", "ctOverlayPosition"], outputs: ["opened", "closed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  388. }
  389. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: MenuItemComponent, decorators: [{
  390. type: Component,
  391. args: [{ selector: 'ct-menu-item', standalone: true, imports: [RouterLink, NgClass, AsyncPipe, IconComponent, ButtonComponent, OverlayDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (menus.length > 0) {\n <a\n [ctOverlay]=\"dropDown\"\n [ctOverlayPosition]=\"submenuPosition\"\n (closed)=\"isOpen.next(false)\"\n (opened)=\"isOpen.next(true)\"\n [ngClass]=\"{\n 'bg-surface-variant dark:bg-surface-variant-dark': isOpen | async\n }\"\n class=\"block cursor-pointer rounded-md px-4 py-2 font-medium text-on-surface hover:bg-surface-variant dark:text-on-surface-dark hover:dark:bg-surface-variant-dark\">\n <span\n class=\"flex items-center gap-3\"\n [class.flex-row]=\"iconDirection === 'horizontal'\"\n [class.flex-col]=\"iconDirection === 'vertical'\">\n @if (icon) {\n <ct-icon [icon]=\"icon\" [size]=\"iconSize\" />\n }\n @if (text && !iconAlone) {\n <span\n [class.text-sm]=\"size === 'xs' || size === 'sm'\"\n [class.text-base]=\"size === 'base' || size === 'lg'\"\n [class.text-xl]=\"size === 'xl'\"\n >{{ text }}</span\n >\n }\n @if (!iconAlone) {\n @if (isOpen | async) {\n <ct-icon [icon]=\"submenuPosition === 'vertical' ? 'chevron-up' : 'chevron-left'\" variant=\"blank\" />\n } @else {\n <ct-icon [icon]=\"submenuPosition === 'vertical' ? 'chevron-down' : 'chevron-right'\" variant=\"blank\" />\n }\n }\n </span>\n </a>\n <ng-template #dropDown><ng-content></ng-content></ng-template>\n} @else {\n <a\n class=\"block cursor-pointer rounded-md px-4 py-2 font-medium text-on-surface hover:bg-surface-variant dark:text-on-surface-dark dark:hover:bg-surface-variant-dark\"\n [routerLink]=\"link\"\n [ngClass]=\"{\n 'bg-surface-variant dark:bg-surface-variant-dark': isActive\n }\">\n <span\n class=\"flex items-center gap-3\"\n [class.flex-row]=\"iconDirection === 'horizontal'\"\n [class.flex-col]=\"iconDirection === 'vertical'\">\n @if (icon) {\n <ct-icon [icon]=\"icon\" variant=\"solid\" [size]=\"iconSize\" />\n }\n @if (text && !iconAlone) {\n <span\n [class.text-sm]=\"size === 'xs' || size === 'sm'\"\n [class.text-base]=\"size === 'base' || size === 'lg'\"\n [class.text-xl]=\"size === 'xl'\"\n >{{ text }}</span\n >\n }\n </span>\n </a>\n}\n" }]
  392. }], propDecorators: { text: [{
  393. type: Input
  394. }], link: [{
  395. type: Input,
  396. args: [{ required: true }]
  397. }], type: [{
  398. type: Input,
  399. args: [{ required: true }]
  400. }], size: [{
  401. type: Input
  402. }], icon: [{
  403. type: Input
  404. }], iconSize: [{
  405. type: Input
  406. }], iconAlone: [{
  407. type: Input
  408. }], iconDirection: [{
  409. type: Input
  410. }], hasSubmenu: [{
  411. type: Input
  412. }], submenuPosition: [{
  413. type: Input
  414. }], isActive: [{
  415. type: Input
  416. }], menus: [{
  417. type: ContentChildren,
  418. args: [MenuComponent]
  419. }] } });
  420. class AccordionRegistryService {
  421. constructor() {
  422. this.accordions = new Map();
  423. }
  424. register(id, element) {
  425. this.accordions.set(id, element);
  426. }
  427. get(id) {
  428. return this.accordions.get(id);
  429. }
  430. unregister(id) {
  431. this.accordions.delete(id);
  432. }
  433. getItem(accordionId, itemId) {
  434. const accordionObject = this.accordions.get(accordionId);
  435. return accordionObject.accordionItems.find(item => item.id === itemId);
  436. }
  437. openItem(accordionId, itemId) {
  438. this.getItem(accordionId, itemId)?.isOpen.next(true);
  439. }
  440. closeItem(accordionId, itemId) {
  441. this.getItem(accordionId, itemId)?.isOpen.next(false);
  442. }
  443. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AccordionRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
  444. static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AccordionRegistryService, providedIn: 'any' }); }
  445. }
  446. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AccordionRegistryService, decorators: [{
  447. type: Injectable,
  448. args: [{ providedIn: 'any' }]
  449. }] });
  450. class AccordionComponent {
  451. constructor(parent) {
  452. this.parent = parent;
  453. this.destroyRef = inject(DestroyRef);
  454. this.accordionRegistryService = inject(AccordionRegistryService);
  455. this.label = '';
  456. this.policy = 'collapse';
  457. this.gap = 0;
  458. }
  459. ngAfterViewInit() {
  460. this.accordionItems.forEach(accordionItem => {
  461. accordionItem.isOpen
  462. .pipe(takeUntilDestroyed(this.destroyRef), skip(1), filter(isOpen => isOpen), debounceTime(10))
  463. .subscribe(() => {
  464. if (this.parent) {
  465. this.parent?.isOpen.next(true);
  466. }
  467. if (this.policy === 'collapse') {
  468. this.accordionItems.forEach(otherAccordionItem => {
  469. if (accordionItem.id !== otherAccordionItem.id && otherAccordionItem.isOpen.getValue()) {
  470. otherAccordionItem.isOpen.next(false);
  471. }
  472. });
  473. }
  474. });
  475. });
  476. this.accordionRegistryService.register(this.id, this);
  477. }
  478. ngOnDestroy() {
  479. this.accordionRegistryService.unregister(this.id);
  480. }
  481. closePanes() {
  482. this.accordionItems.forEach(accordionItem => accordionItem.isOpen.next(false));
  483. }
  484. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AccordionComponent, deps: [{ token: AccordionItemComponent, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component }); }
  485. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: AccordionComponent, isStandalone: true, selector: "ct-accordion", inputs: { label: "label", id: "id", policy: "policy", gap: "gap" }, queries: [{ propertyName: "accordionItems", predicate: i0.forwardRef(() => AccordionItemComponent) }], ngImport: i0, template: "<div class=\"flex flex-col gap-{{ gap }}\">\n <ng-content></ng-content>\n</div>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  486. }
  487. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AccordionComponent, decorators: [{
  488. type: Component,
  489. args: [{ selector: 'ct-accordion', standalone: true, imports: [AsyncPipe, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-{{ gap }}\">\n <ng-content></ng-content>\n</div>\n" }]
  490. }], ctorParameters: () => [{ type: AccordionItemComponent, decorators: [{
  491. type: Optional
  492. }, {
  493. type: SkipSelf
  494. }] }], propDecorators: { label: [{
  495. type: Input
  496. }], id: [{
  497. type: Input,
  498. args: [{ required: true }]
  499. }], policy: [{
  500. type: Input
  501. }], gap: [{
  502. type: Input
  503. }], accordionItems: [{
  504. type: ContentChildren,
  505. args: [forwardRef(() => AccordionItemComponent)]
  506. }] } });
  507. class AccordionItemComponent {
  508. constructor() {
  509. this.destroyRef = inject(DestroyRef);
  510. this.id = '';
  511. this.label = '';
  512. this.isOpen = new BehaviorSubject(false);
  513. }
  514. ngAfterViewInit() {
  515. this.isOpen
  516. .pipe(takeUntilDestroyed(this.destroyRef), skip(1), filter(isOpen => !isOpen))
  517. .subscribe(() => {
  518. this.accordions.forEach(accordion => {
  519. accordion.closePanes();
  520. });
  521. });
  522. }
  523. togglePane() {
  524. this.isOpen.next(!this.isOpen.getValue());
  525. }
  526. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AccordionItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  527. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: AccordionItemComponent, isStandalone: true, selector: "ct-accordion-item", inputs: { id: "id", label: "label" }, queries: [{ propertyName: "headerTemplate", first: true, predicate: ["header"], descendants: true }, { propertyName: "accordions", predicate: AccordionComponent }], ngImport: i0, template: "<div class=\"flex flex-col\">\n <div tabindex=\"0\" (click)=\"togglePane()\" class=\"flex cursor-pointer flex-row rounded-md\">\n <ng-container *ngTemplateOutlet=\"headerTemplate; context: { isOpen: (isOpen | async) }\">\n <ng-content select=\"[header]\" />\n </ng-container>\n </div>\n <!-- providing a high value for max-height -->\n <div\n [style.max-height]=\"(isOpen | async) ? '1024px' : '0px'\"\n class=\"overflow-hidden transition-[max-height] duration-500 ease-in-out\">\n @if (isOpen | async) {\n <ng-content />\n }\n </div>\n</div>\n", dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  528. }
  529. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AccordionItemComponent, decorators: [{
  530. type: Component,
  531. args: [{ selector: 'ct-accordion-item', standalone: true, imports: [IconComponent, AsyncPipe, NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col\">\n <div tabindex=\"0\" (click)=\"togglePane()\" class=\"flex cursor-pointer flex-row rounded-md\">\n <ng-container *ngTemplateOutlet=\"headerTemplate; context: { isOpen: (isOpen | async) }\">\n <ng-content select=\"[header]\" />\n </ng-container>\n </div>\n <!-- providing a high value for max-height -->\n <div\n [style.max-height]=\"(isOpen | async) ? '1024px' : '0px'\"\n class=\"overflow-hidden transition-[max-height] duration-500 ease-in-out\">\n @if (isOpen | async) {\n <ng-content />\n }\n </div>\n</div>\n" }]
  532. }], propDecorators: { id: [{
  533. type: Input,
  534. args: [{ required: true }]
  535. }], label: [{
  536. type: Input
  537. }], headerTemplate: [{
  538. type: ContentChild,
  539. args: ['header']
  540. }], accordions: [{
  541. type: ContentChildren,
  542. args: [AccordionComponent]
  543. }] } });
  544. class TabButtonComponent {
  545. constructor() {
  546. this.key = '';
  547. this.title = '';
  548. this.subTitle = '';
  549. this.clicked = new EventEmitter();
  550. this.isActive = signal(false);
  551. }
  552. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: TabButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  553. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: TabButtonComponent, isStandalone: true, selector: "ct-tab-button", inputs: { key: "key", title: "title", subTitle: "subTitle" }, outputs: { clicked: "clicked" }, ngImport: i0, template: "<div\n tabindex=\"0\"\n class=\"flex w-full cursor-pointer flex-col rounded-md p-1 text-center hover:bg-surface-variant dark:hover:bg-surface-variant-dark\"\n [ngClass]=\"{\n 'bg-surface dark:bg-surface-dark': isActive()\n }\"\n (click)=\"clicked.emit(key)\">\n <span class=\"font-bold\">{{ title }}</span>\n <p class=\"text-sm\">{{ subTitle }}</p>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  554. }
  555. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: TabButtonComponent, decorators: [{
  556. type: Component,
  557. args: [{ selector: 'ct-tab-button', standalone: true, imports: [NgClass, AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n tabindex=\"0\"\n class=\"flex w-full cursor-pointer flex-col rounded-md p-1 text-center hover:bg-surface-variant dark:hover:bg-surface-variant-dark\"\n [ngClass]=\"{\n 'bg-surface dark:bg-surface-dark': isActive()\n }\"\n (click)=\"clicked.emit(key)\">\n <span class=\"font-bold\">{{ title }}</span>\n <p class=\"text-sm\">{{ subTitle }}</p>\n</div>\n" }]
  558. }], propDecorators: { key: [{
  559. type: Input,
  560. args: [{ required: true }]
  561. }], title: [{
  562. type: Input
  563. }], subTitle: [{
  564. type: Input
  565. }], clicked: [{
  566. type: Output
  567. }] } });
  568. class ListItemComponent {
  569. constructor() {
  570. this.header = '';
  571. this.subHeader = '';
  572. this.avatar = '';
  573. this.subTitle = '';
  574. }
  575. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  576. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: ListItemComponent, isStandalone: true, selector: "ct-list-item", inputs: { header: "header", subHeader: "subHeader", avatar: "avatar", subTitle: "subTitle" }, ngImport: i0, template: "<li\n class=\"flex cursor-pointer flex-row items-center gap-4 px-4 py-2 hover:bg-surface-variant dark:text-on-surface-dark hover:dark:bg-surface-dark\">\n <div class=\"flex-none\">\n <ct-avatar [picture]=\"avatar\" [title]=\"header\" />\n </div>\n <div class=\"w-fit flex-1\">\n <div class=\"flex flex-col overflow-hidden\">\n @if (header) {\n <span class=\"overflow-hidden text-ellipsis text-lg font-semibold\" [innerHTML]=\"header\"></span>\n }\n @if (subHeader) {\n <span class=\"overflow-hidden text-ellipsis text-sm\" [innerHTML]=\"subHeader\"></span>\n }\n </div>\n </div>\n <div class=\"relative flex-none rounded-r-xl\">\n <div class=\"flex h-full flex-col justify-center gap-2\">\n <div class=\"flex flex-row items-center px-4\">\n <span class=\"text-xs\">{{ subTitle }}</span>\n </div>\n <div class=\"flex grow-0 flex-row justify-center text-sm\">\n <ct-menu-item\n [iconAlone]=\"true\"\n icon=\"list-bullet\"\n link=\"#\"\n type=\"external\"\n submenuPosition=\"vertical\"\n size=\"xs\">\n <ct-menu direction=\"vertical\">\n <ct-menu-item text=\"Item 2\" link=\"#\" type=\"external\" />\n </ct-menu>\n </ct-menu-item>\n </div>\n </div>\n </div>\n</li>\n", dependencies: [{ kind: "component", type: AvatarComponent, selector: "ct-avatar", inputs: ["picture", "title"] }, { kind: "component", type: MenuComponent, selector: "ct-menu", inputs: ["direction", "iconDirection", "type", "variant", "gap", "fullSize", "iconAlone", "menusAppearVertical"] }, { kind: "component", type: MenuItemComponent, selector: "ct-menu-item", inputs: ["text", "link", "type", "size", "icon", "iconSize", "iconAlone", "iconDirection", "hasSubmenu", "submenuPosition", "isActive"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  577. }
  578. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ListItemComponent, decorators: [{
  579. type: Component,
  580. args: [{ selector: 'ct-list-item', standalone: true, imports: [AvatarComponent, IconComponent, MenuComponent, MenuItemComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<li\n class=\"flex cursor-pointer flex-row items-center gap-4 px-4 py-2 hover:bg-surface-variant dark:text-on-surface-dark hover:dark:bg-surface-dark\">\n <div class=\"flex-none\">\n <ct-avatar [picture]=\"avatar\" [title]=\"header\" />\n </div>\n <div class=\"w-fit flex-1\">\n <div class=\"flex flex-col overflow-hidden\">\n @if (header) {\n <span class=\"overflow-hidden text-ellipsis text-lg font-semibold\" [innerHTML]=\"header\"></span>\n }\n @if (subHeader) {\n <span class=\"overflow-hidden text-ellipsis text-sm\" [innerHTML]=\"subHeader\"></span>\n }\n </div>\n </div>\n <div class=\"relative flex-none rounded-r-xl\">\n <div class=\"flex h-full flex-col justify-center gap-2\">\n <div class=\"flex flex-row items-center px-4\">\n <span class=\"text-xs\">{{ subTitle }}</span>\n </div>\n <div class=\"flex grow-0 flex-row justify-center text-sm\">\n <ct-menu-item\n [iconAlone]=\"true\"\n icon=\"list-bullet\"\n link=\"#\"\n type=\"external\"\n submenuPosition=\"vertical\"\n size=\"xs\">\n <ct-menu direction=\"vertical\">\n <ct-menu-item text=\"Item 2\" link=\"#\" type=\"external\" />\n </ct-menu>\n </ct-menu-item>\n </div>\n </div>\n </div>\n</li>\n" }]
  581. }], propDecorators: { header: [{
  582. type: Input
  583. }], subHeader: [{
  584. type: Input
  585. }], avatar: [{
  586. type: Input
  587. }], subTitle: [{
  588. type: Input
  589. }] } });
  590. class ListComponent {
  591. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  592. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: ListComponent, isStandalone: true, selector: "ct-list", ngImport: i0, template: "<ul class=\"flex grow flex-col divide-y divide-primary-400 dark:divide-primary-700\">\n <ng-content />\n</ul>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  593. }
  594. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ListComponent, decorators: [{
  595. type: Component,
  596. args: [{ selector: 'ct-list', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ul class=\"flex grow flex-col divide-y divide-primary-400 dark:divide-primary-700\">\n <ng-content />\n</ul>\n" }]
  597. }] });
  598. class TabPanelDirective {
  599. constructor(elementRef, destroyRef, renderer) {
  600. this.elementRef = elementRef;
  601. this.destroyRef = destroyRef;
  602. this.renderer = renderer;
  603. this.ctTabPanel = '';
  604. this.hide = new EventEmitter();
  605. this.hide.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(hide => {
  606. this.renderer.addClass(this.elementRef.nativeElement, hide ? 'hidden' : 'flex');
  607. this.renderer.removeClass(this.elementRef.nativeElement, hide ? 'flex' : 'hidden');
  608. });
  609. }
  610. ngOnInit() {
  611. this.hide.next(true);
  612. }
  613. show() {
  614. this.renderer.addClass(this.elementRef.nativeElement, 'flex');
  615. this.renderer.removeClass(this.elementRef.nativeElement, 'hidden');
  616. }
  617. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: TabPanelDirective, deps: [{ token: i0.ElementRef }, { token: i0.DestroyRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
  618. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.5", type: TabPanelDirective, isStandalone: true, selector: "[ctTabPanel]", inputs: { ctTabPanel: "ctTabPanel", hide: "hide" }, ngImport: i0 }); }
  619. }
  620. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: TabPanelDirective, decorators: [{
  621. type: Directive,
  622. args: [{
  623. selector: '[ctTabPanel]',
  624. standalone: true,
  625. }]
  626. }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.DestroyRef }, { type: i0.Renderer2 }], propDecorators: { ctTabPanel: [{
  627. type: Input
  628. }], hide: [{
  629. type: Input
  630. }] } });
  631. class TabGroupComponent {
  632. constructor() {
  633. this.destroyRef = inject(DestroyRef);
  634. this.activeTab = '';
  635. }
  636. ngOnChanges(changes) {
  637. if (changes['activeTab'].previousValue !== this.activeTab) {
  638. this.setActiveTab(this.activeTab);
  639. }
  640. }
  641. ngAfterContentInit() {
  642. this.setActiveTab(this.activeTab);
  643. this.buttons.forEach(button => button.clicked.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(key => this.setActiveTab(key)));
  644. }
  645. setActiveTab(key) {
  646. if (this.panels && this.buttons) {
  647. this.panels.forEach(panel => {
  648. if (panel.ctTabPanel === key) {
  649. panel.show();
  650. this.getTabButtonTrigger(panel.ctTabPanel).isActive.set(true);
  651. }
  652. else {
  653. this.getTabButtonTrigger(panel.ctTabPanel).isActive.set(false);
  654. panel.hide.next(true);
  655. }
  656. });
  657. }
  658. }
  659. getTabButtonTrigger(key) {
  660. return this.buttons.find(panel => panel.key === key);
  661. }
  662. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: TabGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  663. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: TabGroupComponent, isStandalone: true, selector: "ct-tab-group", inputs: { activeTab: "activeTab" }, queries: [{ propertyName: "buttons", predicate: TabButtonComponent }, { propertyName: "panels", predicate: TabPanelDirective }], usesOnChanges: true, ngImport: i0, template: "<div\n class=\"my-4 flex flex-row gap-2 border-y border-surface-variant py-2 dark:border-surface-variant-dark dark:text-on-surface-variant-dark\">\n <ng-content select=\"[header]\" />\n</div>\n<ng-content select=\"[body]\" />\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  664. }
  665. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: TabGroupComponent, decorators: [{
  666. type: Component,
  667. args: [{ selector: 'ct-tab-group', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"my-4 flex flex-row gap-2 border-y border-surface-variant py-2 dark:border-surface-variant-dark dark:text-on-surface-variant-dark\">\n <ng-content select=\"[header]\" />\n</div>\n<ng-content select=\"[body]\" />\n" }]
  668. }], propDecorators: { activeTab: [{
  669. type: Input
  670. }], buttons: [{
  671. type: ContentChildren,
  672. args: [TabButtonComponent]
  673. }], panels: [{
  674. type: ContentChildren,
  675. args: [TabPanelDirective]
  676. }] } });
  677. class CardComponent {
  678. constructor() {
  679. this.header = '';
  680. this.subHeader = '';
  681. this.title = '';
  682. this.subTitle = '';
  683. this.avatar = '';
  684. this.image = '';
  685. this.disposition = 'vertical';
  686. this.imageThumbnail = '';
  687. this.withActions = false;
  688. this.acceptButton = new EventEmitter();
  689. this.cancelButton = new EventEmitter();
  690. }
  691. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: CardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  692. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: CardComponent, isStandalone: true, selector: "ct-card", inputs: { header: "header", subHeader: "subHeader", title: "title", subTitle: "subTitle", avatar: "avatar", image: "image", disposition: "disposition", imageThumbnail: "imageThumbnail", withActions: "withActions" }, outputs: { acceptButton: "acceptButton", cancelButton: "cancelButton" }, ngImport: i0, template: "@if (disposition === 'vertical') {\n <div\n class=\"flex w-full flex-col rounded-xl bg-surface font-primary text-on-surface dark:bg-surface-dark dark:text-on-surface-dark\">\n <div class=\"flex flex-row items-center gap-4 px-4 py-2\">\n <div class=\"flex-none\">\n <ct-avatar [picture]=\"avatar\" [title]=\"title\" />\n </div>\n <div class=\"w-fit flex-1\">\n <div class=\"flex flex-col overflow-hidden\">\n @if (header) {\n <span class=\"overflow-hidden text-ellipsis text-lg font-semibold\" [innerHTML]=\"header\"></span>\n }\n @if (subHeader) {\n <span class=\"overflow-hidden text-ellipsis text-sm\" [innerHTML]=\"subHeader\"></span>\n }\n </div>\n </div>\n <div class=\"relative flex-none rounded-r-xl\">\n @if (imageThumbnail) {\n <img class=\"flex max-w-24 rounded-tr-xl object-cover\" [src]=\"imageThumbnail\" [alt]=\"title\" />\n } @else {\n <ng-content select=\"[header-extra]\" />\n }\n </div>\n </div>\n @if (image) {\n <img class=\"size-full object-cover\" [src]=\"image\" [alt]=\"title\" />\n }\n <ng-content select=\"[image-vertical]\" />\n @if (title || subTitle) {\n <div class=\"flex w-full flex-col px-4 py-2\">\n <div class=\"text-xl font-bold\" [innerHTML]=\"title\"></div>\n <div class=\"mb-2 text-base font-semibold\" [innerHTML]=\"subTitle\"></div>\n <div class=\"flex w-fit grow-0\"><ng-content select=\"[body]\" /></div>\n </div>\n }\n @if (withActions) {\n <div class=\"flex flex-row justify-end gap-2 px-4 py-2\">\n <ct-button text=\"test\" variant=\"flat\" (click)=\"acceptButton.emit()\" />\n <ct-button text=\"test\" variant=\"flat\" type=\"neutral\" (click)=\"cancelButton.emit()\" />\n </div>\n }\n </div>\n} @else {\n <div\n class=\"flex w-full flex-row rounded-xl bg-surface font-primary text-on-surface dark:bg-surface-dark dark:text-on-surface-dark\">\n <div class=\"flex w-3/4\">\n @if (image) {\n <img class=\"size-full rounded-l-xl object-cover\" [src]=\"image\" [alt]=\"title\" />\n }\n <ng-content select=\"[image-horizontal]\" />\n </div>\n <div class=\"flex w-1/4 flex-col justify-between\">\n <div class=\"flex flex-row items-center gap-4 px-4 py-2\">\n <div class=\"flex-none\">\n <ct-avatar [picture]=\"avatar\" [title]=\"title\" />\n </div>\n <div class=\"flex w-fit flex-1 flex-col overflow-hidden\">\n @if (header) {\n <span class=\"overflow-hidden text-lg font-semibold\" [innerHTML]=\"header\"></span>\n }\n @if (subHeader) {\n <span class=\"overflow-hidden text-ellipsis text-sm\" [innerHTML]=\"subHeader\"></span>\n }\n </div>\n </div>\n <div class=\"flex w-fit grow\">\n <ng-content select=\"[body-horizontal]\" />\n </div>\n <article class=\"flex flex-col px-4 py-2\">\n <p class=\"text-wrap text-xl font-bold\" [innerHTML]=\"title\"></p>\n <p class=\"mb-2 text-wrap text-base font-semibold\"></p>\n </article>\n </div>\n </div>\n}\n", dependencies: [{ kind: "component", type: AvatarComponent, selector: "ct-avatar", inputs: ["picture", "title"] }, { kind: "component", type: ButtonComponent, selector: "ct-button", inputs: ["text", "icon", "iconPosition", "role", "disabled", "fullSize", "size", "type", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  693. }
  694. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: CardComponent, decorators: [{
  695. type: Component,
  696. args: [{ selector: 'ct-card', standalone: true, imports: [AvatarComponent, ButtonComponent, SafeImagePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (disposition === 'vertical') {\n <div\n class=\"flex w-full flex-col rounded-xl bg-surface font-primary text-on-surface dark:bg-surface-dark dark:text-on-surface-dark\">\n <div class=\"flex flex-row items-center gap-4 px-4 py-2\">\n <div class=\"flex-none\">\n <ct-avatar [picture]=\"avatar\" [title]=\"title\" />\n </div>\n <div class=\"w-fit flex-1\">\n <div class=\"flex flex-col overflow-hidden\">\n @if (header) {\n <span class=\"overflow-hidden text-ellipsis text-lg font-semibold\" [innerHTML]=\"header\"></span>\n }\n @if (subHeader) {\n <span class=\"overflow-hidden text-ellipsis text-sm\" [innerHTML]=\"subHeader\"></span>\n }\n </div>\n </div>\n <div class=\"relative flex-none rounded-r-xl\">\n @if (imageThumbnail) {\n <img class=\"flex max-w-24 rounded-tr-xl object-cover\" [src]=\"imageThumbnail\" [alt]=\"title\" />\n } @else {\n <ng-content select=\"[header-extra]\" />\n }\n </div>\n </div>\n @if (image) {\n <img class=\"size-full object-cover\" [src]=\"image\" [alt]=\"title\" />\n }\n <ng-content select=\"[image-vertical]\" />\n @if (title || subTitle) {\n <div class=\"flex w-full flex-col px-4 py-2\">\n <div class=\"text-xl font-bold\" [innerHTML]=\"title\"></div>\n <div class=\"mb-2 text-base font-semibold\" [innerHTML]=\"subTitle\"></div>\n <div class=\"flex w-fit grow-0\"><ng-content select=\"[body]\" /></div>\n </div>\n }\n @if (withActions) {\n <div class=\"flex flex-row justify-end gap-2 px-4 py-2\">\n <ct-button text=\"test\" variant=\"flat\" (click)=\"acceptButton.emit()\" />\n <ct-button text=\"test\" variant=\"flat\" type=\"neutral\" (click)=\"cancelButton.emit()\" />\n </div>\n }\n </div>\n} @else {\n <div\n class=\"flex w-full flex-row rounded-xl bg-surface font-primary text-on-surface dark:bg-surface-dark dark:text-on-surface-dark\">\n <div class=\"flex w-3/4\">\n @if (image) {\n <img class=\"size-full rounded-l-xl object-cover\" [src]=\"image\" [alt]=\"title\" />\n }\n <ng-content select=\"[image-horizontal]\" />\n </div>\n <div class=\"flex w-1/4 flex-col justify-between\">\n <div class=\"flex flex-row items-center gap-4 px-4 py-2\">\n <div class=\"flex-none\">\n <ct-avatar [picture]=\"avatar\" [title]=\"title\" />\n </div>\n <div class=\"flex w-fit flex-1 flex-col overflow-hidden\">\n @if (header) {\n <span class=\"overflow-hidden text-lg font-semibold\" [innerHTML]=\"header\"></span>\n }\n @if (subHeader) {\n <span class=\"overflow-hidden text-ellipsis text-sm\" [innerHTML]=\"subHeader\"></span>\n }\n </div>\n </div>\n <div class=\"flex w-fit grow\">\n <ng-content select=\"[body-horizontal]\" />\n </div>\n <article class=\"flex flex-col px-4 py-2\">\n <p class=\"text-wrap text-xl font-bold\" [innerHTML]=\"title\"></p>\n <p class=\"mb-2 text-wrap text-base font-semibold\"></p>\n </article>\n </div>\n </div>\n}\n" }]
  697. }], propDecorators: { header: [{
  698. type: Input
  699. }], subHeader: [{
  700. type: Input
  701. }], title: [{
  702. type: Input
  703. }], subTitle: [{
  704. type: Input
  705. }], avatar: [{
  706. type: Input
  707. }], image: [{
  708. type: Input
  709. }], disposition: [{
  710. type: Input
  711. }], imageThumbnail: [{
  712. type: Input
  713. }], withActions: [{
  714. type: Input
  715. }], acceptButton: [{
  716. type: Output
  717. }], cancelButton: [{
  718. type: Output
  719. }] } });
  720. class FormGenericComponent {
  721. constructor(formGroupDirective) {
  722. this.formGroupDirective = formGroupDirective;
  723. this.onChange = () => { };
  724. this.onTouched = () => { };
  725. this.changeDetectorRef = inject(ChangeDetectorRef);
  726. }
  727. hasErrors(formControl) {
  728. return (formControl && /*!formControl.pristine &&*/ formControl.touched && !!formControl.errors);
  729. }
  730. get formControl() {
  731. return this.formGroupDirective && this.formGroupDirective.form.get(this.formControlName);
  732. }
  733. registerOnChange(fn) {
  734. this.onChange = fn;
  735. }
  736. registerOnTouched(fn) {
  737. this.onTouched = fn;
  738. }
  739. triggerChange(value) {
  740. if (value && this.formControl)
  741. this.formControl.markAsDirty();
  742. this.onChange(value);
  743. }
  744. triggerTouched() {
  745. this.onTouched();
  746. }
  747. triggerMarkCheck() {
  748. this.changeDetectorRef.markForCheck();
  749. }
  750. triggerChangeDetection() {
  751. this.changeDetectorRef.detectChanges();
  752. }
  753. }
  754. class FormErrorComponent {
  755. constructor() {
  756. this.size = 'base';
  757. this.hasErrors = false;
  758. this.fullSize = false;
  759. this.helper = '';
  760. this.errorMessages = {};
  761. }
  762. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: FormErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  763. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: FormErrorComponent, isStandalone: true, selector: "ct-form-alert", inputs: { errors: "errors", size: "size", hasErrors: "hasErrors", fullSize: "fullSize", helper: "helper", errorMessages: "errorMessages" }, ngImport: i0, template: "<div\n class=\"flex min-h-4 flex-col justify-between gap-1 font-primary text-xs transition-opacity duration-500 ease-in-out sm:flex-row sm:items-center\"\n [class.w-full]=\"fullSize\"\n [class.w-fit]=\"!fullSize\"\n [class.opacity-0]=\"!hasErrors\"\n [class.opacity-100]=\"hasErrors\">\n @if (hasErrors) {\n <div class=\"flex flex-row items-center gap-1 text-error dark:text-error-variant-dark\">\n <ct-icon icon=\"exclamation-triangle\" size=\"sm\" />\n @for (error of errors | keyvalue; track error; let isLast = $last) {\n <span class=\"after:mx-1 after:inline-block after:content-[','] last:after:content-none\">{{\n errorMessages[error.key] ? errorMessages[error.key] : error.key\n }}</span>\n }\n </div>\n @if (helper) {\n <span>{{ helper }}</span>\n }\n }\n</div>\n", dependencies: [{ kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "component", type: IconComponent, selector: "ct-icon", inputs: ["icon", "fill", "strokeWidth", "strokeColor", "size", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  764. }
  765. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: FormErrorComponent, decorators: [{
  766. type: Component,
  767. args: [{ selector: 'ct-form-alert', standalone: true, imports: [AlertComponent, KeyValuePipe, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"flex min-h-4 flex-col justify-between gap-1 font-primary text-xs transition-opacity duration-500 ease-in-out sm:flex-row sm:items-center\"\n [class.w-full]=\"fullSize\"\n [class.w-fit]=\"!fullSize\"\n [class.opacity-0]=\"!hasErrors\"\n [class.opacity-100]=\"hasErrors\">\n @if (hasErrors) {\n <div class=\"flex flex-row items-center gap-1 text-error dark:text-error-variant-dark\">\n <ct-icon icon=\"exclamation-triangle\" size=\"sm\" />\n @for (error of errors | keyvalue; track error; let isLast = $last) {\n <span class=\"after:mx-1 after:inline-block after:content-[','] last:after:content-none\">{{\n errorMessages[error.key] ? errorMessages[error.key] : error.key\n }}</span>\n }\n </div>\n @if (helper) {\n <span>{{ helper }}</span>\n }\n }\n</div>\n" }]
  768. }], propDecorators: { errors: [{
  769. type: Input,
  770. args: [{ required: true }]
  771. }], size: [{
  772. type: Input
  773. }], hasErrors: [{
  774. type: Input
  775. }], fullSize: [{
  776. type: Input
  777. }], helper: [{
  778. type: Input
  779. }], errorMessages: [{
  780. type: Input
  781. }] } });
  782. class LabelComponent {
  783. constructor() {
  784. this.text = '';
  785. this.type = 'primary';
  786. this.formControlName = '';
  787. this.hasError = false;
  788. this.showError = false;
  789. }
  790. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: LabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  791. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: LabelComponent, isStandalone: true, selector: "ct-form-label", inputs: { text: "text", type: "type", formControlName: "formControlName", hasError: "hasError", showError: "showError" }, ngImport: i0, template: "<label\n class=\"flex font-primary text-sm font-medium\"\n [ngClass]=\"{\n 'text-on-primary dark:text-on-primary-dark': !hasError,\n 'text-error dark:text-error-variant-dark': type === 'error' || (hasError && showError),\n 'text-warning dark:text-warning-variant-dark': type === 'warning'\n }\"\n [for]=\"formControlName\"\n >{{ text }}</label\n>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  792. }
  793. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: LabelComponent, decorators: [{
  794. type: Component,
  795. args: [{ selector: 'ct-form-label', standalone: true, imports: [NgClass], changeDetection: ChangeDetectionStrategy.OnPush, template: "<label\n class=\"flex font-primary text-sm font-medium\"\n [ngClass]=\"{\n 'text-on-primary dark:text-on-primary-dark': !hasError,\n 'text-error dark:text-error-variant-dark': type === 'error' || (hasError && showError),\n 'text-warning dark:text-warning-variant-dark': type === 'warning'\n }\"\n [for]=\"formControlName\"\n >{{ text }}</label\n>\n" }]
  796. }], propDecorators: { text: [{
  797. type: Input,
  798. args: [{ required: true }]
  799. }], type: [{
  800. type: Input
  801. }], formControlName: [{
  802. type: Input
  803. }], hasError: [{
  804. type: Input
  805. }], showError: [{
  806. type: Input
  807. }] } });
  808. class OptionComponent {
  809. constructor() {
  810. this.label = '';
  811. this.icon = '';
  812. }
  813. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: OptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  814. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: OptionComponent, isStandalone: true, selector: "ct-option", inputs: { label: "label", icon: "icon" }, ngImport: i0, template: "<div\n class=\"flex cursor-pointer flex-row rounded-md px-4 py-2 text-sm hover:bg-surface-variant dark:hover:bg-surface-variant-dark\">\n @if (icon) {\n <ct-icon [icon]=\"icon\" />\n }\n {{ label }}\n</div>\n", dependencies: [{ kind: "component", type: IconComponent, selector: "ct-icon", inputs: ["icon", "fill", "strokeWidth", "strokeColor", "size", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  815. }
  816. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: OptionComponent, decorators: [{
  817. type: Component,
  818. args: [{ selector: 'ct-option', standalone: true, imports: [IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"flex cursor-pointer flex-row rounded-md px-4 py-2 text-sm hover:bg-surface-variant dark:hover:bg-surface-variant-dark\">\n @if (icon) {\n <ct-icon [icon]=\"icon\" />\n }\n {{ label }}\n</div>\n" }]
  819. }], propDecorators: { label: [{
  820. type: Input,
  821. args: [{ required: true }]
  822. }], icon: [{
  823. type: Input
  824. }] } });
  825. /**
  826. * Creates a value accessor provider for a form component.
  827. * @param component - The component that implements the NG_VALUE_ACCESSOR interface.
  828. * @returns An ExistingProvider object for the value accessor.
  829. */
  830. const provideValueAccessor = (component) => ({
  831. provide: NG_VALUE_ACCESSOR,
  832. useExisting: forwardRef(() => component),
  833. multi: true,
  834. });
  835. /**
  836. * Creates a control container provider using FormGroupDirective.
  837. * @returns An ExistingProvider object for the control container.
  838. */
  839. const provideControlContainer = () => ({
  840. provide: ControlContainer,
  841. useExisting: FormGroupDirective,
  842. });
  843. class InputComponent extends FormGenericComponent {
  844. onFocusOut() {
  845. this.triggerTouched();
  846. }
  847. constructor(formGroupDirective) {
  848. super(formGroupDirective);
  849. this.formGroupDirective = formGroupDirective;
  850. this.key = '';
  851. this.type = 'text';
  852. this.value = '';
  853. this.label = '';
  854. this.icon = '';
  855. this.helper = '';
  856. this.placeholder = '';
  857. this.symbol = '';
  858. this.canDelete = false;
  859. this.fullSize = true;
  860. this.showError = false;
  861. this.iconPosition = 'left';
  862. this.disposition = 'vertical';
  863. this.typed = new EventEmitter();
  864. this.showDelete$ = new BehaviorSubject(false);
  865. }
  866. input(event) {
  867. const value = event.target.value;
  868. if (this.canDelete) {
  869. this.showDelete$.next(!!value);
  870. }
  871. this.setValue(value);
  872. }
  873. clearValue() {
  874. this.showDelete$.next(false);
  875. this.triggerTouched();
  876. this.setValue(null);
  877. }
  878. setValue(value, propagate = true) {
  879. this.value = value;
  880. if (propagate) {
  881. this.triggerChange(value);
  882. this.typed.emit(value);
  883. }
  884. }
  885. writeValue(value) {
  886. if (value && this.canDelete)
  887. this.showDelete$.next(true);
  888. this.triggerMarkCheck();
  889. this.setValue(value, false);
  890. }
  891. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: InputComponent, deps: [{ token: i1$2.FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
  892. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: InputComponent, isStandalone: true, selector: "ct-input", inputs: { formControlName: "formControlName", key: "key", type: "type", value: "value", label: "label", icon: "icon", helper: "helper", placeholder: "placeholder", symbol: "symbol", canDelete: "canDelete", fullSize: "fullSize", showError: "showError", min: "min", max: "max", iconPosition: "iconPosition", disposition: "disposition" }, outputs: { typed: "typed" }, host: { listeners: { "focusout": "onFocusOut()" } }, providers: [provideValueAccessor(forwardRef(() => InputComponent))], usesInheritance: true, ngImport: i0, template: "<div\n class=\"flex\"\n [ngClass]=\"{\n 'items-center gap-4': disposition === 'horizontal',\n 'flex-col gap-0.5': disposition === 'vertical'\n }\">\n @if (label) {\n <ct-form-label [text]=\"label\" [hasError]=\"hasErrors(formControl)\" [showError]=\"showError\" />\n }\n <div\n class=\"relative inline-block rounded-md text-on-surface dark:text-on-surface-dark\"\n [class.w-fit]=\"!fullSize\"\n [class.w-full]=\"fullSize\">\n <input\n tabindex=\"0\"\n [type]=\"type\"\n [min]=\"min\"\n [max]=\"max\"\n class=\"h-9 rounded-md border bg-surface font-primary text-sm outline-primary hover:border-neutral-600 dark:bg-surface-dark dark:outline-primary-dark focus:dark:border-primary-dark\"\n [class.px-4]=\"!icon || !symbol\"\n [ngClass]=\"{\n 'px-4': !icon,\n 'pr-4 pl-10': icon && iconPosition === 'left',\n 'pl-4 pr-10': (icon && iconPosition === 'right') || symbol || canDelete\n }\"\n [class.w-fit]=\"!fullSize\"\n [class.w-full]=\"fullSize\"\n [class.border-neutral-300]=\"!hasErrors(formControl) || !showError\"\n [class.border-error]=\"hasErrors(formControl) && showError\"\n [class.border-success]=\"formControl && formControl.valid && showError\"\n [value]=\"value\"\n [placeholder]=\"placeholder\"\n (input)=\"input($event)\" />\n @if (icon) {\n <ct-icon\n class=\"absolute top-2\"\n [class.left-3]=\"iconPosition === 'left'\"\n [class.right-3]=\"iconPosition === 'right'\"\n [icon]=\"icon\" />\n }\n @if (symbol) {\n <span class=\"absolute right-3 top-2.5 text-xs text-neutral-600 dark:text-neutral-300\">{{ symbol }}</span>\n }\n @if (showDelete$ | async) {\n <ct-icon class=\"absolute right-3 top-2.5 cursor-pointer\" icon=\"x-mark\" size=\"sm\" (click)=\"clearValue()\" />\n }\n </div>\n @if (formControl) {\n <ct-form-alert\n [fullSize]=\"fullSize\"\n [hasErrors]=\"hasErrors(formControl)\"\n [helper]=\"helper\"\n [errors]=\"formControl.errors ?? {}\"\n size=\"xs\" />\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: LabelComponent, selector: "ct-form-label", inputs: ["text", "type", "formControlName", "hasError", "showError"] }, { kind: "component", type: IconComponent, selector: "ct-icon", inputs: ["icon", "fill", "strokeWidth", "strokeColor", "size", "variant"] }, { kind: "component", type: FormErrorComponent, selector: "ct-form-alert", inputs: ["errors", "size", "hasErrors", "fullSize", "helper", "errorMessages"] }], viewProviders: [provideControlContainer()], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  893. }
  894. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: InputComponent, decorators: [{
  895. type: Component,
  896. args: [{ selector: 'ct-input', standalone: true, imports: [NgClass, AsyncPipe, LabelComponent, IconComponent, FormErrorComponent], providers: [provideValueAccessor(forwardRef(() => InputComponent))], viewProviders: [provideControlContainer()], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"flex\"\n [ngClass]=\"{\n 'items-center gap-4': disposition === 'horizontal',\n 'flex-col gap-0.5': disposition === 'vertical'\n }\">\n @if (label) {\n <ct-form-label [text]=\"label\" [hasError]=\"hasErrors(formControl)\" [showError]=\"showError\" />\n }\n <div\n class=\"relative inline-block rounded-md text-on-surface dark:text-on-surface-dark\"\n [class.w-fit]=\"!fullSize\"\n [class.w-full]=\"fullSize\">\n <input\n tabindex=\"0\"\n [type]=\"type\"\n [min]=\"min\"\n [max]=\"max\"\n class=\"h-9 rounded-md border bg-surface font-primary text-sm outline-primary hover:border-neutral-600 dark:bg-surface-dark dark:outline-primary-dark focus:dark:border-primary-dark\"\n [class.px-4]=\"!icon || !symbol\"\n [ngClass]=\"{\n 'px-4': !icon,\n 'pr-4 pl-10': icon && iconPosition === 'left',\n 'pl-4 pr-10': (icon && iconPosition === 'right') || symbol || canDelete\n }\"\n [class.w-fit]=\"!fullSize\"\n [class.w-full]=\"fullSize\"\n [class.border-neutral-300]=\"!hasErrors(formControl) || !showError\"\n [class.border-error]=\"hasErrors(formControl) && showError\"\n [class.border-success]=\"formControl && formControl.valid && showError\"\n [value]=\"value\"\n [placeholder]=\"placeholder\"\n (input)=\"input($event)\" />\n @if (icon) {\n <ct-icon\n class=\"absolute top-2\"\n [class.left-3]=\"iconPosition === 'left'\"\n [class.right-3]=\"iconPosition === 'right'\"\n [icon]=\"icon\" />\n }\n @if (symbol) {\n <span class=\"absolute right-3 top-2.5 text-xs text-neutral-600 dark:text-neutral-300\">{{ symbol }}</span>\n }\n @if (showDelete$ | async) {\n <ct-icon class=\"absolute right-3 top-2.5 cursor-pointer\" icon=\"x-mark\" size=\"sm\" (click)=\"clearValue()\" />\n }\n </div>\n @if (formControl) {\n <ct-form-alert\n [fullSize]=\"fullSize\"\n [hasErrors]=\"hasErrors(formControl)\"\n [helper]=\"helper\"\n [errors]=\"formControl.errors ?? {}\"\n size=\"xs\" />\n }\n</div>\n" }]
  897. }], ctorParameters: () => [{ type: i1$2.FormGroupDirective, decorators: [{
  898. type: Optional
  899. }] }], propDecorators: { formControlName: [{
  900. type: Input
  901. }], key: [{
  902. type: Input
  903. }], type: [{
  904. type: Input
  905. }], value: [{
  906. type: Input
  907. }], label: [{
  908. type: Input
  909. }], icon: [{
  910. type: Input
  911. }], helper: [{
  912. type: Input
  913. }], placeholder: [{
  914. type: Input
  915. }], symbol: [{
  916. type: Input
  917. }], canDelete: [{
  918. type: Input
  919. }], fullSize: [{
  920. type: Input
  921. }], showError: [{
  922. type: Input
  923. }], min: [{
  924. type: Input
  925. }], max: [{
  926. type: Input
  927. }], iconPosition: [{
  928. type: Input
  929. }], disposition: [{
  930. type: Input
  931. }], typed: [{
  932. type: Output
  933. }], onFocusOut: [{
  934. type: HostListener,
  935. args: ['focusout']
  936. }] } });
  937. class AutocompleteComponent extends FormGenericComponent {
  938. constructor(formGroupDirective) {
  939. super(formGroupDirective);
  940. this.destroyRef = inject(DestroyRef);
  941. this.key = '';
  942. this.options = [];
  943. this.label = '';
  944. this.icon = '';
  945. this.helper = '';
  946. this.placeholder = '';
  947. this.value = '';
  948. this.inputValue = '';
  949. this.iconPosition = 'left';
  950. this.disposition = 'vertical';
  951. this.fullSize = true;
  952. this.multiple = false;
  953. this.showError = false;
  954. this.typed = new EventEmitter();
  955. this.selected = new EventEmitter();
  956. this.focusOut$ = new Subject();
  957. this.inputValue$ = new BehaviorSubject('');
  958. this.focusOut$.pipe(takeUntilDestroyed(this.destroyRef), debounceTime(150)).subscribe(() => {
  959. this.options = [];
  960. this.triggerTouched();
  961. this.triggerMarkCheck();
  962. });
  963. }
  964. input(value) {
  965. if (!value)
  966. this.options = [];
  967. if (this.value && !this.multiple) {
  968. this.setValue(null);
  969. this.inputValue$.next('');
  970. return;
  971. }
  972. if (this.multiple) {
  973. this.inputValue$.next(value);
  974. }
  975. this.typed.emit(value);
  976. }
  977. setValue(value, propagate = true) {
  978. this.value = value;
  979. if (propagate) {
  980. this.triggerChange(value);
  981. this.selected.emit(value);
  982. }
  983. if (value) {
  984. const selectedOption = this.options.find(option => option.key === value);
  985. if (!this.multiple)
  986. this.inputValue$.next(selectedOption ? selectedOption.label : this.placeholder);
  987. else {
  988. const currentWords = this.inputValue$.getValue().split(' ');
  989. // replacing the last word with the current 'label' value
  990. currentWords[currentWords.length - 1] = selectedOption ? selectedOption.label : this.placeholder;
  991. this.inputValue$.next(currentWords.join(' '));
  992. }
  993. }
  994. }
  995. writeValue(value) {
  996. this.triggerMarkCheck();
  997. this.setValue(value, false);
  998. }
  999. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AutocompleteComponent, deps: [{ token: i1$2.FormGroupDirective }], target: i0.ɵɵFactoryTarget.Component }); }
  1000. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: AutocompleteComponent, isStandalone: true, selector: "ct-autocomplete", inputs: { formControlName: "formControlName", key: "key", options: "options", label: "label", icon: "icon", helper: "helper", placeholder: "placeholder", value: "value", inputValue: "inputValue", iconPosition: "iconPosition", disposition: "disposition", fullSize: "fullSize", multiple: "multiple", showError: "showError" }, outputs: { typed: "typed", selected: "selected" }, providers: [provideValueAccessor(forwardRef(() => AutocompleteComponent))], usesInheritance: true, ngImport: i0, template: "<div class=\"flex gap-1 font-primary\" [class.flex-col]=\"disposition === 'vertical'\">\n @if (label) {\n <ct-form-label\n [text]=\"label\"\n [hasError]=\"hasErrors(formControl)\"\n [showError]=\"showError\"\n [formControlName]=\"formControlName\" />\n }\n <div class=\"flex flex-col\" [class.w-full]=\"fullSize\" [class.w-fit]=\"!fullSize\">\n <ct-input\n key=\"autocomplete\"\n [canDelete]=\"true\"\n [helper]=\"helper\"\n [value]=\"inputValue$ | async\"\n [placeholder]=\"placeholder\"\n (typed)=\"input($event)\"\n (focusout)=\"focusOut$.next($event)\" />\n @if (options && options.length > 0) {\n <div class=\"relative flex flex-col\">\n <div\n [class.w-full]=\"fullSize\"\n [class.w-fit]=\"!fullSize\"\n class=\"absolute top-0.5 z-10 flex max-h-72 flex-col overflow-y-auto rounded-md border border-neutral-400 bg-surface text-on-surface shadow-lg dark:bg-surface-dark dark:text-on-surface-dark\">\n @for (option of options; track option) {\n <ct-option (click)=\"setValue(option.key)\" [label]=\"option.label\" [icon]=\"option.icon!\" />\n }\n </div>\n </div>\n }\n </div>\n @if (formControl) {\n <ct-form-alert\n [hasErrors]=\"hasErrors(formControl)\"\n [helper]=\"helper\"\n [errors]=\"formControl.errors ?? {}\"\n size=\"xs\" />\n }\n</div>\n", dependencies: [{ kind: "component", type: FormErrorComponent, selector: "ct-form-alert", inputs: ["errors", "size", "hasErrors", "fullSize", "helper", "errorMessages"] }, { kind: "component", type: LabelComponent, selector: "ct-form-label", inputs: ["text", "type", "formControlName", "hasError", "showError"] }, { kind: "component", type: OptionComponent, selector: "ct-option", inputs: ["label", "icon"] }, { kind: "component", type: InputComponent, selector: "ct-input", inputs: ["formControlName", "key", "type", "value", "label", "icon", "helper", "placeholder", "symbol", "canDelete", "fullSize", "showError", "min", "max", "iconPosition", "disposition"], outputs: ["typed"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], viewProviders: [provideControlContainer()], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  1001. }
  1002. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AutocompleteComponent, decorators: [{
  1003. type: Component,
  1004. args: [{ selector: 'ct-autocomplete', standalone: true, imports: [IconComponent, FormErrorComponent, LabelComponent, OptionComponent, InputComponent, NgClass, AsyncPipe], providers: [provideValueAccessor(forwardRef(() => AutocompleteComponent))], viewProviders: [provideControlContainer()], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex gap-1 font-primary\" [class.flex-col]=\"disposition === 'vertical'\">\n @if (label) {\n <ct-form-label\n [text]=\"label\"\n [hasError]=\"hasErrors(formControl)\"\n [showError]=\"showError\"\n [formControlName]=\"formControlName\" />\n }\n <div class=\"flex flex-col\" [class.w-full]=\"fullSize\" [class.w-fit]=\"!fullSize\">\n <ct-input\n key=\"autocomplete\"\n [canDelete]=\"true\"\n [helper]=\"helper\"\n [value]=\"inputValue$ | async\"\n [placeholder]=\"placeholder\"\n (typed)=\"input($event)\"\n (focusout)=\"focusOut$.next($event)\" />\n @if (options && options.length > 0) {\n <div class=\"relative flex flex-col\">\n <div\n [class.w-full]=\"fullSize\"\n [class.w-fit]=\"!fullSize\"\n class=\"absolute top-0.5 z-10 flex max-h-72 flex-col overflow-y-auto rounded-md border border-neutral-400 bg-surface text-on-surface shadow-lg dark:bg-surface-dark dark:text-on-surface-dark\">\n @for (option of options; track option) {\n <ct-option (click)=\"setValue(option.key)\" [label]=\"option.label\" [icon]=\"option.icon!\" />\n }\n </div>\n </div>\n }\n </div>\n @if (formControl) {\n <ct-form-alert\n [hasErrors]=\"hasErrors(formControl)\"\n [helper]=\"helper\"\n [errors]=\"formControl.errors ?? {}\"\n size=\"xs\" />\n }\n</div>\n" }]
  1005. }], ctorParameters: () => [{ type: i1$2.FormGroupDirective }], propDecorators: { formControlName: [{
  1006. type: Input
  1007. }], key: [{
  1008. type: Input,
  1009. args: [{ required: true }]
  1010. }], options: [{
  1011. type: Input,
  1012. args: [{ required: true }]
  1013. }], label: [{
  1014. type: Input
  1015. }], icon: [{
  1016. type: Input
  1017. }], helper: [{
  1018. type: Input
  1019. }], placeholder: [{
  1020. type: Input
  1021. }], value: [{
  1022. type: Input
  1023. }], inputValue: [{
  1024. type: Input
  1025. }], iconPosition: [{
  1026. type: Input
  1027. }], disposition: [{
  1028. type: Input
  1029. }], fullSize: [{
  1030. type: Input
  1031. }], multiple: [{
  1032. type: Input
  1033. }], showError: [{
  1034. type: Input
  1035. }], typed: [{
  1036. type: Output
  1037. }], selected: [{
  1038. type: Output
  1039. }] } });
  1040. class SelectComponent extends FormGenericComponent {
  1041. constructor(formGroupDirective, destroyRef) {
  1042. super(formGroupDirective);
  1043. this.formGroupDirective = formGroupDirective;
  1044. this.destroyRef = destroyRef;
  1045. this.focusOut$ = new Subject();
  1046. this.isOpen = false;
  1047. this.option = '';
  1048. this.key = '';
  1049. this.options = [];
  1050. this.label = '';
  1051. this.helper = '';
  1052. this.placeholder = '';
  1053. this.value = '';
  1054. this.disposition = 'vertical';
  1055. this.fullSize = true;
  1056. this.showError = false;
  1057. this.selected = new EventEmitter();
  1058. }
  1059. ngOnInit() {
  1060. this.selectOption(this.value, false);
  1061. this.focusOut$.pipe(takeUntilDestroyed(this.destroyRef), debounceTime(200)).subscribe(() => {
  1062. this.triggerMarkCheck();
  1063. this.close();
  1064. });
  1065. }
  1066. toggle() {
  1067. this.isOpen = !this.isOpen;
  1068. if (!this.isOpen) {
  1069. this.triggerTouched();
  1070. }
  1071. }
  1072. close() {
  1073. this.isOpen = false;
  1074. this.triggerTouched();
  1075. }
  1076. selectOption(key, propagate = true) {
  1077. const selectedOption = this.options.find(option => option.key === key);
  1078. this.option = key === null ? this.placeholder : selectedOption?.label;
  1079. if (propagate) {
  1080. this.selected.emit(key);
  1081. this.triggerChange(selectedOption?.key ?? null);
  1082. this.close();
  1083. }
  1084. }
  1085. writeValue(value) {
  1086. this.triggerMarkCheck();
  1087. this.selectOption(value, false);
  1088. }
  1089. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: SelectComponent, deps: [{ token: i1$2.FormGroupDirective, optional: true }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Component }); }
  1090. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: SelectComponent, isStandalone: true, selector: "ct-select", inputs: { formControlName: "formControlName", key: "key", options: "options", label: "label", helper: "helper", placeholder: "placeholder", value: "value", disposition: "disposition", fullSize: "fullSize", showError: "showError" }, outputs: { selected: "selected" }, providers: [provideValueAccessor(forwardRef(() => SelectComponent))], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["triggerElement"], descendants: true }, { propertyName: "panel", first: true, predicate: ["optionsPanel"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"flex gap-1 font-primary\" [class.flex-col]=\"disposition === 'vertical'\">\n @if (label) {\n <ct-form-label [text]=\"label\" [hasError]=\"hasErrors(formControl)\" [showError]=\"showError\" />\n }\n <div class=\"flex flex-col\" [class.w-full]=\"fullSize\" [class.w-fit]=\"!fullSize\">\n <div\n tabindex=\"0\"\n #triggerElement\n class=\"flex cursor-pointer flex-row items-center justify-between rounded-md border bg-surface px-4 py-2 text-sm text-on-surface dark:bg-surface-dark dark:text-on-surface-dark\"\n [class.border-error]=\"hasErrors(formControl) && showError\"\n [class.border-neutral-300]=\"!hasErrors(formControl) || !showError\"\n [class.text-on-surface]=\"option !== placeholder\"\n (focusout)=\"focusOut$.next($event)\"\n (click)=\"toggle()\">\n <span [class.text-neutral-500]=\"option === placeholder\">{{ option }}</span>\n <ct-icon class=\"flex\" [size]=\"'sm'\" [icon]=\"isOpen ? 'chevron-up' : 'chevron-down'\" />\n </div>\n @if (isOpen) {\n <div class=\"relative flex flex-col\">\n <div\n #optionsPanel\n [class.w-full]=\"fullSize\"\n [class.w-fit]=\"!fullSize\"\n class=\"absolute top-0.5 z-10 flex max-h-72 flex-col overflow-y-auto rounded-md border border-neutral-400 bg-surface text-on-surface shadow-lg dark:bg-surface-dark dark:text-on-surface-dark\">\n <ct-option (click)=\"selectOption(null)\" [label]=\"placeholder\" />\n @for (option of options; track option) {\n <ct-option (click)=\"selectOption(option.key)\" [label]=\"option.label\" [icon]=\"option.icon!\" />\n }\n </div>\n </div>\n }\n </div>\n @if (formControl) {\n <ct-form-alert\n [hasErrors]=\"hasErrors(formControl)\"\n [helper]=\"helper\"\n [errors]=\"formControl.errors ?? {}\"\n size=\"xs\" />\n }\n</div>\n", dependencies: [{ kind: "component", type: OptionComponent, selector: "ct-option", inputs: ["label", "icon"] }, { kind: "component", type: IconComponent, selector: "ct-icon", inputs: ["icon", "fill", "strokeWidth", "strokeColor", "size", "variant"] }, { kind: "component", type: LabelComponent, selector: "ct-form-label", inputs: ["text", "type", "formControlName", "hasError", "showError"] }, { kind: "component", type: FormErrorComponent, selector: "ct-form-alert", inputs: ["errors", "size", "hasErrors", "fullSize", "helper", "errorMessages"] }], viewProviders: [provideControlContainer()], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  1091. }
  1092. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: SelectComponent, decorators: [{
  1093. type: Component,
  1094. args: [{ selector: 'ct-select', standalone: true, imports: [OptionComponent, ButtonComponent, IconComponent, LabelComponent, AlertComponent, FormErrorComponent], providers: [provideValueAccessor(forwardRef(() => SelectComponent))], viewProviders: [provideControlContainer()], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex gap-1 font-primary\" [class.flex-col]=\"disposition === 'vertical'\">\n @if (label) {\n <ct-form-label [text]=\"label\" [hasError]=\"hasErrors(formControl)\" [showError]=\"showError\" />\n }\n <div class=\"flex flex-col\" [class.w-full]=\"fullSize\" [class.w-fit]=\"!fullSize\">\n <div\n tabindex=\"0\"\n #triggerElement\n class=\"flex cursor-pointer flex-row items-center justify-between rounded-md border bg-surface px-4 py-2 text-sm text-on-surface dark:bg-surface-dark dark:text-on-surface-dark\"\n [class.border-error]=\"hasErrors(formControl) && showError\"\n [class.border-neutral-300]=\"!hasErrors(formControl) || !showError\"\n [class.text-on-surface]=\"option !== placeholder\"\n (focusout)=\"focusOut$.next($event)\"\n (click)=\"toggle()\">\n <span [class.text-neutral-500]=\"option === placeholder\">{{ option }}</span>\n <ct-icon class=\"flex\" [size]=\"'sm'\" [icon]=\"isOpen ? 'chevron-up' : 'chevron-down'\" />\n </div>\n @if (isOpen) {\n <div class=\"relative flex flex-col\">\n <div\n #optionsPanel\n [class.w-full]=\"fullSize\"\n [class.w-fit]=\"!fullSize\"\n class=\"absolute top-0.5 z-10 flex max-h-72 flex-col overflow-y-auto rounded-md border border-neutral-400 bg-surface text-on-surface shadow-lg dark:bg-surface-dark dark:text-on-surface-dark\">\n <ct-option (click)=\"selectOption(null)\" [label]=\"placeholder\" />\n @for (option of options; track option) {\n <ct-option (click)=\"selectOption(option.key)\" [label]=\"option.label\" [icon]=\"option.icon!\" />\n }\n </div>\n </div>\n }\n </div>\n @if (formControl) {\n <ct-form-alert\n [hasErrors]=\"hasErrors(formControl)\"\n [helper]=\"helper\"\n [errors]=\"formControl.errors ?? {}\"\n size=\"xs\" />\n }\n</div>\n" }]
  1095. }], ctorParameters: () => [{ type: i1$2.FormGroupDirective, decorators: [{
  1096. type: Optional
  1097. }] }, { type: i0.DestroyRef }], propDecorators: { formControlName: [{
  1098. type: Input
  1099. }], key: [{
  1100. type: Input,
  1101. args: [{ required: true }]
  1102. }], options: [{
  1103. type: Input,
  1104. args: [{ required: true }]
  1105. }], label: [{
  1106. type: Input
  1107. }], helper: [{
  1108. type: Input
  1109. }], placeholder: [{
  1110. type: Input
  1111. }], value: [{
  1112. type: Input
  1113. }], disposition: [{
  1114. type: Input
  1115. }], fullSize: [{
  1116. type: Input
  1117. }], showError: [{
  1118. type: Input
  1119. }], selected: [{
  1120. type: Output
  1121. }], trigger: [{
  1122. type: ViewChild,
  1123. args: ['triggerElement']
  1124. }], panel: [{
  1125. type: ViewChild,
  1126. args: ['optionsPanel']
  1127. }] } });
  1128. function integerValidator() {
  1129. return (control) => {
  1130. if (control.value !== null && !Number.isInteger(Number(control.value))) {
  1131. return { notInteger: true };
  1132. }
  1133. return null;
  1134. };
  1135. }
  1136. class InputNumberComponent extends InputComponent {
  1137. constructor(formGroupDirective) {
  1138. super(formGroupDirective);
  1139. this.formGroupDirective = formGroupDirective;
  1140. this.decimalPipe = inject(DecimalPipe);
  1141. this.validate = 'integer';
  1142. }
  1143. onFocusOut() {
  1144. this.formatNumber();
  1145. this.triggerTouched();
  1146. }
  1147. onFocusIn() {
  1148. this.reverseFormatNumber();
  1149. }
  1150. ngOnInit() {
  1151. if (this.formControl && this.validate === 'integer')
  1152. this.formControl.addValidators(integerValidator());
  1153. }
  1154. ngAfterViewInit() {
  1155. this.formatNumber();
  1156. this.triggerChangeDetection();
  1157. }
  1158. formatNumber() {
  1159. try {
  1160. this.value = this.decimalPipe.transform(this.value, '1.0-2') || '';
  1161. }
  1162. catch (_error) {
  1163. return;
  1164. }
  1165. }
  1166. reverseFormatNumber() {
  1167. this.value = !isNaN(parseFloat(this.value.replace(/[^0-9.-]/g, '')))
  1168. ? parseFloat(this.value.replace(/[^0-9.-]/g, ''))
  1169. : '';
  1170. }
  1171. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: InputNumberComponent, deps: [{ token: i1$2.FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
  1172. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: InputNumberComponent, isStandalone: true, selector: "ct-input-number", inputs: { validate: "validate" }, host: { listeners: { "focusout": "onFocusOut()", "focusin": "onFocusIn()" } }, providers: [provideValueAccessor(forwardRef(() => InputNumberComponent)), DecimalPipe], usesInheritance: true, ngImport: i0, template: "<div\n class=\"flex\"\n [ngClass]=\"{\n 'items-center gap-4': disposition === 'horizontal',\n 'flex-col gap-0.5': disposition === 'vertical'\n }\">\n @if (label) {\n <ct-form-label [text]=\"label\" [hasError]=\"hasErrors(formControl)\" [showError]=\"showError\" />\n }\n <div\n class=\"relative inline-block rounded-md text-on-surface dark:text-on-surface-dark\"\n [class.w-fit]=\"!fullSize\"\n [class.w-full]=\"fullSize\">\n <input\n tabindex=\"0\"\n [type]=\"type\"\n [min]=\"min\"\n [max]=\"max\"\n class=\"h-9 rounded-md border bg-surface font-primary text-sm outline-primary hover:border-neutral-600 dark:bg-surface-dark dark:outline-primary-dark focus:dark:border-primary-dark\"\n [class.px-4]=\"!icon || !symbol\"\n [ngClass]=\"{\n 'px-4': !icon,\n 'pr-4 pl-10': icon && iconPosition === 'left',\n 'pl-4 pr-10': (icon && iconPosition === 'right') || symbol || canDelete\n }\"\n [class.w-fit]=\"!fullSize\"\n [class.w-full]=\"fullSize\"\n [class.border-neutral-300]=\"!hasErrors(formControl) || !showError\"\n [class.border-error]=\"hasErrors(formControl) && showError\"\n [class.border-success]=\"formControl && formControl.valid && showError\"\n [value]=\"value\"\n [placeholder]=\"placeholder\"\n (input)=\"input($event)\" />\n @if (icon) {\n <ct-icon\n class=\"absolute top-2\"\n [class.left-3]=\"iconPosition === 'left'\"\n [class.right-3]=\"iconPosition === 'right'\"\n [icon]=\"icon\" />\n }\n @if (symbol) {\n <span class=\"absolute right-3 top-2.5 text-xs text-neutral-600 dark:text-neutral-300\">{{ symbol }}</span>\n }\n @if (showDelete$ | async) {\n <ct-icon class=\"absolute right-3 top-2.5 cursor-pointer\" icon=\"x-mark\" size=\"sm\" (click)=\"clearValue()\" />\n }\n </div>\n @if (formControl) {\n <ct-form-alert\n [fullSize]=\"fullSize\"\n [hasErrors]=\"hasErrors(formControl)\"\n [helper]=\"helper\"\n [errors]=\"formControl.errors ?? {}\"\n size=\"xs\" />\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: LabelComponent, selector: "ct-form-label", inputs: ["text", "type", "formControlName", "hasError", "showError"] }, { kind: "component", type: IconComponent, selector: "ct-icon", inputs: ["icon", "fill", "strokeWidth", "strokeColor", "size", "variant"] }, { kind: "component", type: FormErrorComponent, selector: "ct-form-alert", inputs: ["errors", "size", "hasErrors", "fullSize", "helper", "errorMessages"] }], viewProviders: [provideControlContainer()], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  1173. }
  1174. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: InputNumberComponent, decorators: [{
  1175. type: Component,
  1176. args: [{ selector: 'ct-input-number', standalone: true, imports: [NgClass, AsyncPipe, LabelComponent, IconComponent, FormErrorComponent], providers: [provideValueAccessor(forwardRef(() => InputNumberComponent)), DecimalPipe], viewProviders: [provideControlContainer()], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"flex\"\n [ngClass]=\"{\n 'items-center gap-4': disposition === 'horizontal',\n 'flex-col gap-0.5': disposition === 'vertical'\n }\">\n @if (label) {\n <ct-form-label [text]=\"label\" [hasError]=\"hasErrors(formControl)\" [showError]=\"showError\" />\n }\n <div\n class=\"relative inline-block rounded-md text-on-surface dark:text-on-surface-dark\"\n [class.w-fit]=\"!fullSize\"\n [class.w-full]=\"fullSize\">\n <input\n tabindex=\"0\"\n [type]=\"type\"\n [min]=\"min\"\n [max]=\"max\"\n class=\"h-9 rounded-md border bg-surface font-primary text-sm outline-primary hover:border-neutral-600 dark:bg-surface-dark dark:outline-primary-dark focus:dark:border-primary-dark\"\n [class.px-4]=\"!icon || !symbol\"\n [ngClass]=\"{\n 'px-4': !icon,\n 'pr-4 pl-10': icon && iconPosition === 'left',\n 'pl-4 pr-10': (icon && iconPosition === 'right') || symbol || canDelete\n }\"\n [class.w-fit]=\"!fullSize\"\n [class.w-full]=\"fullSize\"\n [class.border-neutral-300]=\"!hasErrors(formControl) || !showError\"\n [class.border-error]=\"hasErrors(formControl) && showError\"\n [class.border-success]=\"formControl && formControl.valid && showError\"\n [value]=\"value\"\n [placeholder]=\"placeholder\"\n (input)=\"input($event)\" />\n @if (icon) {\n <ct-icon\n class=\"absolute top-2\"\n [class.left-3]=\"iconPosition === 'left'\"\n [class.right-3]=\"iconPosition === 'right'\"\n [icon]=\"icon\" />\n }\n @if (symbol) {\n <span class=\"absolute right-3 top-2.5 text-xs text-neutral-600 dark:text-neutral-300\">{{ symbol }}</span>\n }\n @if (showDelete$ | async) {\n <ct-icon class=\"absolute right-3 top-2.5 cursor-pointer\" icon=\"x-mark\" size=\"sm\" (click)=\"clearValue()\" />\n }\n </div>\n @if (formControl) {\n <ct-form-alert\n [fullSize]=\"fullSize\"\n [hasErrors]=\"hasErrors(formControl)\"\n [helper]=\"helper\"\n [errors]=\"formControl.errors ?? {}\"\n size=\"xs\" />\n }\n</div>\n" }]
  1177. }], ctorParameters: () => [{ type: i1$2.FormGroupDirective, decorators: [{
  1178. type: Optional
  1179. }] }], propDecorators: { validate: [{
  1180. type: Input
  1181. }], onFocusOut: [{
  1182. type: HostListener,
  1183. args: ['focusout']
  1184. }], onFocusIn: [{
  1185. type: HostListener,
  1186. args: ['focusin']
  1187. }] } });
  1188. class ToggleComponent extends FormGenericComponent {
  1189. constructor(formGroupDirective, destroyRef) {
  1190. super(formGroupDirective);
  1191. this.formGroupDirective = formGroupDirective;
  1192. this.destroyRef = destroyRef;
  1193. this.formControlName = '';
  1194. this.checked = false;
  1195. this.label = '';
  1196. this.key = '';
  1197. this.value = '';
  1198. this.showError = false;
  1199. this.disposition = 'horizontal';
  1200. this.wasChecked = new EventEmitter();
  1201. }
  1202. toggle() {
  1203. this.checked = !this.checked;
  1204. this.triggerChange(this.checked);
  1205. this.wasChecked.emit(this.checked);
  1206. }
  1207. writeValue(value) {
  1208. this.triggerMarkCheck();
  1209. this.checked = value;
  1210. }
  1211. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ToggleComponent, deps: [{ token: i1$2.FormGroupDirective, optional: true }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Component }); }
  1212. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: ToggleComponent, isStandalone: true, selector: "ct-toggle", inputs: { formControlName: "formControlName", checked: "checked", label: "label", key: "key", value: "value", showError: "showError", disposition: "disposition" }, outputs: { wasChecked: "wasChecked" }, providers: [provideValueAccessor(forwardRef(() => ToggleComponent))], usesInheritance: true, ngImport: i0, template: "<div\n class=\"flex flex-row gap-4\"\n [class.items-center]=\"disposition === 'horizontal'\"\n [class.flex-col]=\"disposition === 'vertical'\">\n <ct-form-label [text]=\"label\" [hasError]=\"hasErrors(formControl) && showError\" />\n <label class=\"inline-flex cursor-pointer\">\n <input type=\"checkbox\" [value]=\"value\" [checked]=\"checked\" class=\"peer sr-only\" (change)=\"toggle()\" />\n <div\n tabindex=\"0\"\n class=\"peer relative h-6 w-11 rounded-full bg-surface-variant after:absolute after:start-[2px] after:top-[2px] after:size-5 after:rounded-full after:border after:border-transparent after:bg-neutral-50 after:transition-all after:content-[''] peer-checked:bg-primary peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none rtl:peer-checked:after:-translate-x-full dark:bg-surface-variant-dark dark:after:bg-neutral-400 dark:peer-checked:bg-primary-dark\"></div>\n </label>\n</div>\n", dependencies: [{ kind: "component", type: LabelComponent, selector: "ct-form-label", inputs: ["text", "type", "formControlName", "hasError", "showError"] }], viewProviders: [provideControlContainer()], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  1213. }
  1214. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ToggleComponent, decorators: [{
  1215. type: Component,
  1216. args: [{ selector: 'ct-toggle', standalone: true, imports: [LabelComponent], providers: [provideValueAccessor(forwardRef(() => ToggleComponent))], viewProviders: [provideControlContainer()], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"flex flex-row gap-4\"\n [class.items-center]=\"disposition === 'horizontal'\"\n [class.flex-col]=\"disposition === 'vertical'\">\n <ct-form-label [text]=\"label\" [hasError]=\"hasErrors(formControl) && showError\" />\n <label class=\"inline-flex cursor-pointer\">\n <input type=\"checkbox\" [value]=\"value\" [checked]=\"checked\" class=\"peer sr-only\" (change)=\"toggle()\" />\n <div\n tabindex=\"0\"\n class=\"peer relative h-6 w-11 rounded-full bg-surface-variant after:absolute after:start-[2px] after:top-[2px] after:size-5 after:rounded-full after:border after:border-transparent after:bg-neutral-50 after:transition-all after:content-[''] peer-checked:bg-primary peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none rtl:peer-checked:after:-translate-x-full dark:bg-surface-variant-dark dark:after:bg-neutral-400 dark:peer-checked:bg-primary-dark\"></div>\n </label>\n</div>\n" }]
  1217. }], ctorParameters: () => [{ type: i1$2.FormGroupDirective, decorators: [{
  1218. type: Optional
  1219. }] }, { type: i0.DestroyRef }], propDecorators: { formControlName: [{
  1220. type: Input
  1221. }], checked: [{
  1222. type: Input
  1223. }], label: [{
  1224. type: Input
  1225. }], key: [{
  1226. type: Input
  1227. }], value: [{
  1228. type: Input
  1229. }], showError: [{
  1230. type: Input
  1231. }], disposition: [{
  1232. type: Input
  1233. }], wasChecked: [{
  1234. type: Output
  1235. }] } });
  1236. class RadioButtonComponent extends FormGenericComponent {
  1237. constructor(destroyRef, formGroupDirective) {
  1238. super(formGroupDirective);
  1239. this.destroyRef = destroyRef;
  1240. this.formGroupDirective = formGroupDirective;
  1241. this.key = '';
  1242. this.label = '';
  1243. this.checked = false;
  1244. this.formControlName = '';
  1245. this.valueChange = new EventEmitter();
  1246. }
  1247. writeValue(value) {
  1248. this.checked = value;
  1249. this.triggerMarkCheck();
  1250. }
  1251. onValueChange() {
  1252. // this.checked = true;
  1253. this.setValue(this.value);
  1254. this.valueChange.emit(this.value);
  1255. }
  1256. setValue(value) {
  1257. this.triggerChange(value);
  1258. }
  1259. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: RadioButtonComponent, deps: [{ token: i0.DestroyRef }, { token: i1$2.FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
  1260. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: RadioButtonComponent, isStandalone: true, selector: "ct-radio-button", inputs: { key: "key", label: "label", value: "value", checked: "checked", formControlName: "formControlName" }, outputs: { valueChange: "valueChange" }, providers: [provideValueAccessor(forwardRef(() => RadioButtonComponent))], usesInheritance: true, ngImport: i0, template: "<input\n [id]=\"value\"\n class=\"hidden\"\n type=\"radio\"\n [name]=\"key\"\n [value]=\"value\"\n [checked]=\"checked\"\n (change)=\"onValueChange()\" />\n<label class=\"w-full grow cursor-pointer\" [for]=\"value\">\n <ct-button [text]=\"label\" [type]=\"checked ? 'secondary' : 'primary'\" [fullSize]=\"true\" (click)=\"onValueChange()\" />\n</label>\n", dependencies: [{ kind: "component", type: ButtonComponent, selector: "ct-button", inputs: ["text", "icon", "iconPosition", "role", "disabled", "fullSize", "size", "type", "variant"] }], viewProviders: [provideControlContainer()], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  1261. }
  1262. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: RadioButtonComponent, decorators: [{
  1263. type: Component,
  1264. args: [{ selector: 'ct-radio-button', standalone: true, imports: [ButtonComponent], providers: [provideValueAccessor(forwardRef(() => RadioButtonComponent))], viewProviders: [provideControlContainer()], changeDetection: ChangeDetectionStrategy.OnPush, template: "<input\n [id]=\"value\"\n class=\"hidden\"\n type=\"radio\"\n [name]=\"key\"\n [value]=\"value\"\n [checked]=\"checked\"\n (change)=\"onValueChange()\" />\n<label class=\"w-full grow cursor-pointer\" [for]=\"value\">\n <ct-button [text]=\"label\" [type]=\"checked ? 'secondary' : 'primary'\" [fullSize]=\"true\" (click)=\"onValueChange()\" />\n</label>\n" }]
  1265. }], ctorParameters: () => [{ type: i0.DestroyRef }, { type: i1$2.FormGroupDirective, decorators: [{
  1266. type: Optional
  1267. }] }], propDecorators: { key: [{
  1268. type: Input
  1269. }], label: [{
  1270. type: Input
  1271. }], value: [{
  1272. type: Input
  1273. }], checked: [{
  1274. type: Input
  1275. }], formControlName: [{
  1276. type: Input
  1277. }], valueChange: [{
  1278. type: Output
  1279. }] } });
  1280. class RadioGroupComponent extends FormGenericComponent {
  1281. constructor(destroyRef, formGroupDirective) {
  1282. super(formGroupDirective);
  1283. this.destroyRef = destroyRef;
  1284. this.formGroupDirective = formGroupDirective;
  1285. this.formControlName = '';
  1286. this.key = '';
  1287. this.label = '';
  1288. this.value = '';
  1289. this.helper = '';
  1290. this.showError = false;
  1291. this.selected = new EventEmitter();
  1292. }
  1293. ngAfterContentInit() {
  1294. if (this.value)
  1295. this.writeValue(this.value);
  1296. this.radios.forEach(radio => radio.valueChange.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(value => this.setValue(value)));
  1297. }
  1298. writeValue(value) {
  1299. this.value = value;
  1300. if (this.radios)
  1301. this.updateRadios(value);
  1302. }
  1303. setValue(value) {
  1304. this.value = value;
  1305. this.updateRadios(value);
  1306. this.triggerChange(value);
  1307. this.selected.emit(value);
  1308. }
  1309. updateRadios(value) {
  1310. this.radios.forEach(radio => {
  1311. radio.writeValue(radio.value === value);
  1312. });
  1313. }
  1314. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: RadioGroupComponent, deps: [{ token: i0.DestroyRef }, { token: i1$2.FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
  1315. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: RadioGroupComponent, isStandalone: true, selector: "ct-radio-group", inputs: { formControlName: "formControlName", key: "key", label: "label", value: "value", helper: "helper", showError: "showError" }, outputs: { selected: "selected" }, providers: [provideValueAccessor(forwardRef(() => RadioGroupComponent))], queries: [{ propertyName: "radios", predicate: RadioButtonComponent }], usesInheritance: true, ngImport: i0, template: "<div class=\"flex w-full flex-col gap-4\">\n @if (label) {\n <ct-form-label [text]=\"label\" [hasError]=\"hasErrors(formControl)\" [showError]=\"showError\" />\n }\n <div class=\"flex w-full flex-col justify-between gap-4 md:flex-row\">\n <ng-content select=\"ct-radio-button\" />\n </div>\n @if (formControl) {\n <ct-form-alert\n [hasErrors]=\"hasErrors(formControl)\"\n [helper]=\"helper\"\n [errors]=\"formControl.errors ?? {}\"\n size=\"xs\" />\n }\n</div>\n", dependencies: [{ kind: "component", type: LabelComponent, selector: "ct-form-label", inputs: ["text", "type", "formControlName", "hasError", "showError"] }, { kind: "component", type: FormErrorComponent, selector: "ct-form-alert", inputs: ["errors", "size", "hasErrors", "fullSize", "helper", "errorMessages"] }], viewProviders: [provideControlContainer()], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  1316. }
  1317. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: RadioGroupComponent, decorators: [{
  1318. type: Component,
  1319. args: [{ selector: 'ct-radio-group', standalone: true, imports: [LabelComponent, FormErrorComponent], providers: [provideValueAccessor(forwardRef(() => RadioGroupComponent))], viewProviders: [provideControlContainer()], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex w-full flex-col gap-4\">\n @if (label) {\n <ct-form-label [text]=\"label\" [hasError]=\"hasErrors(formControl)\" [showError]=\"showError\" />\n }\n <div class=\"flex w-full flex-col justify-between gap-4 md:flex-row\">\n <ng-content select=\"ct-radio-button\" />\n </div>\n @if (formControl) {\n <ct-form-alert\n [hasErrors]=\"hasErrors(formControl)\"\n [helper]=\"helper\"\n [errors]=\"formControl.errors ?? {}\"\n size=\"xs\" />\n }\n</div>\n" }]
  1320. }], ctorParameters: () => [{ type: i0.DestroyRef }, { type: i1$2.FormGroupDirective, decorators: [{
  1321. type: Optional
  1322. }] }], propDecorators: { formControlName: [{
  1323. type: Input
  1324. }], key: [{
  1325. type: Input
  1326. }], label: [{
  1327. type: Input
  1328. }], value: [{
  1329. type: Input
  1330. }], helper: [{
  1331. type: Input
  1332. }], showError: [{
  1333. type: Input
  1334. }], selected: [{
  1335. type: Output
  1336. }], radios: [{
  1337. type: ContentChildren,
  1338. args: [RadioButtonComponent]
  1339. }] } });
  1340. class FormBase {
  1341. constructor(options = {}) {
  1342. this.value = options.value;
  1343. this.key = options.key || undefined;
  1344. this.label = options.label || '';
  1345. this.placeholder = options.placeholder || '';
  1346. this.required = !!options.required;
  1347. this.controlType = options.controlType || '';
  1348. this.options = options.options || [];
  1349. this.icon = options.icon || '';
  1350. }
  1351. }
  1352. class SelectFormBase extends FormBase {
  1353. constructor() {
  1354. super(...arguments);
  1355. this.controlType = 'select';
  1356. }
  1357. }
  1358. class InputFormBase extends FormBase {
  1359. constructor() {
  1360. super(...arguments);
  1361. this.controlType = 'input';
  1362. }
  1363. }
  1364. class ScreenSizeService {
  1365. constructor() {
  1366. this.destroyRef = inject(DestroyRef);
  1367. this.screenSizeSubject = new BehaviorSubject(this.getScreenSize());
  1368. this.screenSize$ = this.screenSizeSubject.asObservable();
  1369. fromEvent(window, 'resize')
  1370. .pipe(distinctUntilChanged(), debounceTime$1(200), map(() => this.getScreenSize()), startWith(this.getScreenSize()), tap(() => console.log('test updated')), takeUntilDestroyed(this.destroyRef))
  1371. .subscribe(this.screenSizeSubject);
  1372. }
  1373. getScreenSize() {
  1374. const width = window.innerWidth;
  1375. if (width < 640)
  1376. return 'xs';
  1377. if (width >= 640 && width < 768)
  1378. return 'sm';
  1379. if (width >= 768 && width < 1024)
  1380. return 'md';
  1381. if (width >= 1024 && width < 1280)
  1382. return 'lg';
  1383. if (width >= 1280 && width < 1536)
  1384. return 'xl';
  1385. return '2xl';
  1386. }
  1387. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ScreenSizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
  1388. static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ScreenSizeService, providedIn: 'root' }); }
  1389. }
  1390. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ScreenSizeService, decorators: [{
  1391. type: Injectable,
  1392. args: [{
  1393. providedIn: 'root',
  1394. }]
  1395. }], ctorParameters: () => [] });
  1396. /*
  1397. * Public API Surface of circletone
  1398. */
  1399. // Atoms
  1400. /**
  1401. * Generated bundle index. Do not edit.
  1402. */
  1403. export { AccordionComponent, AccordionItemComponent, AccordionRegistryService, AlertComponent, AutocompleteComponent, AvatarComponent, ButtonComponent, CardComponent, FormBase, HeaderComponent, IconComponent, InputComponent, InputFormBase, InputNumberComponent, ListComponent, ListItemComponent, MenuComponent, MenuItemComponent, OverlayDirective, RadioButtonComponent, RadioGroupComponent, SafeImagePipe, ScreenSizeService, SelectComponent, SelectFormBase, TabButtonComponent, TabGroupComponent, TabPanelDirective, ToggleComponent, integerValidator };
  1404. //# sourceMappingURL=circletone.mjs.map