@ibragim-dev-org/ui-forge-library 1.2.7 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1110,14 +1110,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
1110
1110
  }]
1111
1111
  }], ctorParameters: () => [{ type: i1.Overlay }, { type: i2$1.Router }] });
1112
1112
 
1113
+ const avatarSizes = ['small', 'medium', 'large'];
1113
1114
  class UiAvatarDirective {
1114
- $class = input.required(...(ngDevMode ? [{ debugName: "$class" }] : []));
1115
+ elementRef;
1116
+ renderer;
1117
+ $size = input('medium', ...(ngDevMode ? [{ debugName: "$size" }] : []));
1118
+ $isRounded = input(false, ...(ngDevMode ? [{ debugName: "$isRounded" }] : []));
1115
1119
  $src = input.required(...(ngDevMode ? [{ debugName: "$src" }] : []));
1116
1120
  $acronym = input.required(...(ngDevMode ? [{ debugName: "$acronym" }] : []));
1117
- $backgroundColor = signal('', ...(ngDevMode ? [{ debugName: "$backgroundColor" }] : []));
1118
1121
  $text = signal('', ...(ngDevMode ? [{ debugName: "$text" }] : []));
1119
1122
  $canShowAvatar = signal(true, ...(ngDevMode ? [{ debugName: "$canShowAvatar" }] : []));
1120
- constructor() {
1123
+ constructor(elementRef, renderer) {
1124
+ this.elementRef = elementRef;
1125
+ this.renderer = renderer;
1121
1126
  effect(() => {
1122
1127
  let acronym = '';
1123
1128
  this.$acronym()
@@ -1125,19 +1130,34 @@ class UiAvatarDirective {
1125
1130
  .forEach((v) => {
1126
1131
  acronym = acronym + v[0];
1127
1132
  });
1128
- this.$backgroundColor.set(stringToHslColor(acronym[0]));
1133
+ this.renderer.setStyle(this.elementRef.nativeElement, 'background-color', stringToHslColor(acronym[0]));
1129
1134
  this.$text.set(acronym);
1130
1135
  });
1136
+ effect(() => {
1137
+ if (this.$isRounded()) {
1138
+ this.renderer.addClass(this.elementRef.nativeElement, 'rounded');
1139
+ }
1140
+ else {
1141
+ this.renderer.removeClass(this.elementRef.nativeElement, 'rounded');
1142
+ }
1143
+ });
1144
+ effect(() => {
1145
+ avatarSizes.forEach((size) => {
1146
+ this.renderer.removeClass(this.elementRef.nativeElement, size);
1147
+ });
1148
+ const size = this.$size();
1149
+ this.renderer.addClass(this.elementRef.nativeElement, size);
1150
+ });
1131
1151
  }
1132
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAvatarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1133
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: UiAvatarDirective, isStandalone: true, selector: "app-ui-avatar", inputs: { $class: { classPropertyName: "$class", publicName: "$class", isSignal: true, isRequired: true, transformFunction: null }, $src: { classPropertyName: "$src", publicName: "$src", isSignal: true, isRequired: true, transformFunction: null }, $acronym: { classPropertyName: "$acronym", publicName: "$acronym", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
1152
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAvatarDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
1153
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: UiAvatarDirective, isStandalone: true, selector: "app-ui-avatar", inputs: { $size: { classPropertyName: "$size", publicName: "$size", isSignal: true, isRequired: false, transformFunction: null }, $isRounded: { classPropertyName: "$isRounded", publicName: "$isRounded", isSignal: true, isRequired: false, transformFunction: null }, $src: { classPropertyName: "$src", publicName: "$src", isSignal: true, isRequired: true, transformFunction: null }, $acronym: { classPropertyName: "$acronym", publicName: "$acronym", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
1134
1154
  }
1135
1155
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAvatarDirective, decorators: [{
1136
1156
  type: Directive,
1137
1157
  args: [{
1138
1158
  selector: 'app-ui-avatar',
1139
1159
  }]
1140
- }], ctorParameters: () => [], propDecorators: { $class: [{ type: i0.Input, args: [{ isSignal: true, alias: "$class", required: true }] }], $src: [{ type: i0.Input, args: [{ isSignal: true, alias: "$src", required: true }] }], $acronym: [{ type: i0.Input, args: [{ isSignal: true, alias: "$acronym", required: true }] }] } });
1160
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { $size: [{ type: i0.Input, args: [{ isSignal: true, alias: "$size", required: false }] }], $isRounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "$isRounded", required: false }] }], $src: [{ type: i0.Input, args: [{ isSignal: true, alias: "$src", required: true }] }], $acronym: [{ type: i0.Input, args: [{ isSignal: true, alias: "$acronym", required: true }] }] } });
1141
1161
 
1142
1162
  class UiDailyCalendarDirective {
1143
1163
  weekDaysEuropean = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];