{"version":3,"file":"usitsdasdesign-dds-ng-user-pic.mjs","sources":["../../src/app/dds/user-pic/user-pic/constants.ts","../../src/app/dds/user-pic/user-pic/user-pic.component.ts","../../src/app/dds/user-pic/user-pic/user-pic.component.html","../../src/app/dds/user-pic/user-pic.module.ts","../../src/app/dds/user-pic/usitsdasdesign-dds-ng-user-pic.ts"],"sourcesContent":["import { ThemeClassesMap, ThemeMapEnum } from \"@usitsdasdesign/dds-ng/core/theme\";\nimport { Themes } from \"@usitsdasdesign/dds-ng/shared\";\n\nexport const DEFAULT_ICON = 'dds-icon_user';\n\nexport const themeClassesMap: ThemeClassesMap = {\n  [ThemeMapEnum.Themes]: {\n    [Themes.green]: 'dds-user-pic_green',\n    [Themes.blue]: 'dds-user-pic_blue',\n  },\n};\n","import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\nimport { SafeStyleModule } from '@usitsdasdesign/dds-ng/core/safe-style';\nimport { ThemeClassesMap, ThemeModule } from '@usitsdasdesign/dds-ng/core/theme';\nimport { AdditionalClass, Size, Themes } from '@usitsdasdesign/dds-ng/shared';\nimport { DdsConfigService } from '@usitsdasdesign/dds-ng/shared/dds-config';\nimport { DEFAULT_ICON, themeClassesMap } from './constants';\n\n@Component({\n  selector: 'dds-user-pic',\n  templateUrl: './user-pic.component.html',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [CommonModule, SafeStyleModule, ThemeModule],\n})\nexport class UserPicComponent implements OnInit, OnChanges {\n  // Binds a CSS class to the host element when the component is disabled.\n  @HostBinding(`class.${AdditionalClass.disabled}`) @Input() disabled: boolean | undefined;\n\n  // The theme of the user picture. Can be a predefined theme or a custom string.\n  // Defaults to the theme from the DDS configuration.\n  @Input() theme: Themes | string | undefined = this.ddsConfig.getConfig().theme;\n\n  // The width of the user picture.\n  @Input() width: string | undefined;\n\n  // The ARIA label for accessibility.\n  @Input() ariaLabel: string | undefined;\n\n  // The height of the user picture.\n  @Input() height: string | undefined;\n\n  // The size of the user picture. Can be a predefined size or a custom string.\n  // Defaults to the size from the DDS configuration.\n  @Input() size: Size | string | undefined = this.ddsConfig.getConfig().size;\n\n  // The icon to display when no image is available.\n  // Defaults to a predefined icon.\n  @Input() noImageIcon: string | undefined = DEFAULT_ICON;\n\n  // The initials to display when no image is available.\n  @Input() initials: string | undefined;\n\n  // The URL of the user picture image.\n  @Input() imageUrl: string | undefined;\n\n  // Custom CSS class to apply to the user picture.\n  @Input() customClass: string | undefined;\n\n  // Indicates if there is an error with loading the user picture.\n  @Input() isError: boolean | undefined;\n\n  // Indicates if the user picture should be displayed in inverse colors.\n  @Input() isInverse: boolean | undefined;\n\n  // Indicates if the size of the user picture is small.\n  public isSmSize: boolean;\n\n  // The theme configuration map.\n  public themeConfig: ThemeClassesMap = themeClassesMap;\n\n  constructor(private cdr: ChangeDetectorRef, private ddsConfig: DdsConfigService) { }\n\n  public ngOnChanges(changes: SimpleChanges): void {\n    this.checkSize(changes.size);\n  }\n\n  public ngOnInit(): void {\n    this.checkSize(this.size);\n  }\n\n  // Checks the size of the user picture and updates the `isSmSize` property.\n  private checkSize(size: unknown): void {\n    if (size) {\n      this.isSmSize = this.size === Size.sm;\n      this.cdr.markForCheck();\n    }\n  }\n}\n","<div [ngClass]=\"{\n        'dds-user-pic_error': isError,\n        'dds-user-pic_sm': isSmSize,\n        'dds-user-pic_disabled': disabled,\n        'dds-user-pic_inverse': isInverse\n     }\"\n     [ngStyle]=\"{\n         'width': width,\n         'height': height\n     }\"\n     [theme]=\"theme\"\n     [ddsTheme]=\"themeConfig\"\n     class=\"dds-user-pic {{customClass}}\">\n  @if (imageUrl) {\n    <div [style.background-image]=\"'url(' + imageUrl + ')' | safeStyle\"\n         [attr.aria-label]=\"ariaLabel\"\n         [attr.aria-disabled]=\"disabled\"\n         data-qa=\"user pic\"\n         role=\"img\"\n         class=\"dds-user-pic__img\"></div>\n  } @else {\n    @if (initials) {\n      <span [attr.aria-label]=\"ariaLabel\"\n            [attr.aria-disabled]=\"disabled\"\n            data-qa=\"user pic\"\n            role=\"img\"\n            class=\"dds-user-pic__initials\">{{initials}}</span>\n    } @else {\n      <span [attr.aria-label]=\"ariaLabel\"\n            [attr.aria-disabled]=\"disabled\"\n            data-qa=\"user pic\"\n            role=\"img\"\n            class=\"dds-user-pic__icon dds-icon {{ noImageIcon }}\"></span>\n    }\n  }\n\n</div>","import { NgModule } from '@angular/core';\nimport { UserPicComponent } from './user-pic/user-pic.component';\n\n@NgModule({\n  declarations: [],\n  imports: [UserPicComponent],\n  exports: [UserPicComponent],\n})\nexport class UserPicModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;AAGO,MAAM,YAAY,GAAG,eAAe;AAEpC,MAAM,eAAe,GAAoB;AAC9C,IAAA,CAAC,YAAY,CAAC,MAAM,GAAG;AACrB,QAAA,CAAC,MAAM,CAAC,KAAK,GAAG,oBAAoB;AACpC,QAAA,CAAC,MAAM,CAAC,IAAI,GAAG,mBAAmB;AACnC,KAAA;CACF;;MCKY,gBAAgB,CAAA;IA8C3B,WAAA,CAAoB,GAAsB,EAAU,SAA2B,EAAA;QAA3D,IAAA,CAAA,GAAG,GAAH,GAAG;QAA6B,IAAA,CAAA,SAAS,GAAT,SAAS;;;QAxCpD,IAAA,CAAA,KAAK,GAAgC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,KAAK;;;QAarE,IAAA,CAAA,IAAI,GAA8B,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,IAAI;;;QAIjE,IAAA,CAAA,WAAW,GAAuB,YAAY;;QAqBhD,IAAA,CAAA,WAAW,GAAoB,eAAe;IAE8B;AAE5E,IAAA,WAAW,CAAC,OAAsB,EAAA;AACvC,QAAA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9B;IAEO,QAAQ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