{"version":3,"file":"usitsdasdesign-dds-ng-tags.mjs","sources":["../../src/app/dds/tags/tag/constants.ts","../../src/app/dds/tags/tag/tag.component.ts","../../src/app/dds/tags/tag/tag.component.html","../../src/app/dds/tags/tags/tags.component.ts","../../src/app/dds/tags/tags/tags.component.html","../../src/app/dds/tags/tags.module.ts","../../src/app/dds/tags/usitsdasdesign-dds-ng-tags.ts"],"sourcesContent":["import { ThemeClassesMap, ThemeMapEnum } from '@usitsdasdesign/dds-ng/core/theme';\nimport { Size, Themes } from '@usitsdasdesign/dds-ng/shared';\n\nexport const themeClassesMap: ThemeClassesMap = {\n  [ThemeMapEnum.Size]: {\n    [Size.sm]: 'dds-tag_sm',\n    [Size.lg]: 'dds-tag_lg',\n  },\n  [ThemeMapEnum.Themes]: {\n    [Themes.green]: 'dds-tag_green',\n    [Themes.blue]: 'dds-tag_blue',\n  },\n};\n\nexport const TAG_WRAP_CLASS = 'dds-tag-wrap';\nexport const DEFAULT_REMOVE_BTN_ICON = 'dds-icon_close';\n","import { CommonModule } from '@angular/common';\nimport {\n  AfterViewInit,\n  ChangeDetectionStrategy,\n  ChangeDetectorRef,\n  Component,\n  ElementRef,\n  EventEmitter,\n  HostBinding,\n  Input,\n  Output,\n  Renderer2,\n  ViewChild,\n} from '@angular/core';\nimport { DestroyCtor, DestroyMixin, I18nCtor, I18nMixin } from '@usitsdasdesign/dds-ng/core/common-behaviors';\nimport { FocusHandlerModule } from '@usitsdasdesign/dds-ng/core/focus-handler';\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 { I18nModule, I18nService, ITranslation } from '@usitsdasdesign/dds-ng/shared/i18n';\nimport { DEFAULT_REMOVE_BTN_ICON, TAG_WRAP_CLASS, themeClassesMap } from './constants';\n\nconst TagBase: DestroyCtor & I18nCtor = DestroyMixin(I18nMixin());\n\n@Component({\n  selector: 'dds-tag',\n  templateUrl: './tag.component.html',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [CommonModule, FocusHandlerModule, ThemeModule, I18nModule],\n})\nexport class TagComponent extends TagBase implements AfterViewInit {\n  // Binds the class for wrapping the tag.\n  @HostBinding(`class.${TAG_WRAP_CLASS}`) isWrap = true;\n\n  // Binds the class for the disabled state and accepts an input to control the disabled state.\n  @HostBinding(`class.${AdditionalClass.disabled}`) @Input() disabled: boolean | undefined;\n\n  // Reference to the close button element.\n  @ViewChild('closeBtn') closeBtn: ElementRef<HTMLInputElement>;\n\n  // Reference to the tag element.\n  @ViewChild('tag') tag: ElementRef<HTMLElement>;\n\n  // Reference to the tag text element.\n  @ViewChild('tagText') tagText: ElementRef<HTMLElement>;\n\n  // The theme of the tag, which can be a predefined theme or a custom string.\n  @Input() theme: Themes | string | undefined = this.ddsConfig.getConfig().theme;\n\n  // Indicates whether the tag is in inverse mode.\n  @Input() isInverse: boolean | undefined;\n\n  // Indicates whether the tag is removable.\n  @Input() isRemovable: boolean | undefined;\n\n  // The size of the tag, which can be a predefined size or a custom string.\n  @Input() size: Size | string | undefined = this.ddsConfig.getConfig().size;\n\n  // The icon for the remove button.\n  @Input() removeBtnIcon: string | undefined = DEFAULT_REMOVE_BTN_ICON;\n\n  // Custom CSS class for the tag.\n  @Input() customClass: string | undefined;\n\n  // Indicates whether the tag is in an error state.\n  @Input() isError: boolean | undefined;\n\n  // Event emitted when the tag is removed.\n  @Output() removed = new EventEmitter<Event>();\n\n  // Event emitted when a key is pressed while the tag is focused.\n  @Output() keyPressed = new EventEmitter<KeyboardEvent>();\n\n  // The theme configuration map.\n  public themeConfig: ThemeClassesMap = themeClassesMap;\n\n  // The text for the delete button.\n  public deleteBtnText: string;\n\n  constructor(public cdr: ChangeDetectorRef, public i18n: I18nService, private renderer: Renderer2, private ddsConfig: DdsConfigService) {\n    super();\n  }\n\n  // Lifecycle hook that is called after the component's view has been fully initialized.\n  public ngAfterViewInit(): void {\n    super.ngOnInit();\n  }\n\n  // Handles the keydown event and emits the keyPressed event.\n  public handleKeydown(event: KeyboardEvent): void {\n    this.keyPressed.emit(event);\n  }\n\n  // Sets focus on the close button and adds a keyboard focus class to the tag.\n  public focus(): void {\n    if (this.closeBtn && this.tag) {\n      this.renderer.addClass(this.tag.nativeElement, AdditionalClass.keyboardFocus);\n      this.closeBtn.nativeElement.focus();\n    }\n  }\n\n  // Removes focus from the close button and removes the keyboard focus class from the tag.\n  public blur(): void {\n    if (this.closeBtn && this.tag) {\n      this.renderer.removeClass(this.tag.nativeElement, AdditionalClass.keyboardFocus);\n      this.closeBtn.nativeElement.blur();\n    }\n  }\n\n  // Emits the removed event when the tag is removed.\n  public removedItem(event: Event): void {\n    this.removed.emit(event);\n  }\n\n  // Sets the internationalization texts for the component.\n  protected setI18nTexts(translation: ITranslation): void {\n    const tagText = this.tagText?.nativeElement?.innerText || '';\n    this.deleteBtnText = `${translation.TAG.A11Y.CLOSE_BTN_ARIA_LABEL} ${tagText}`;\n    this.cdr.detectChanges();\n  }\n}\n","<div [ngClass]=\"{\n       'dds-tag_removable': isRemovable,\n       'dds-tag_error': isError,\n       'dds-tag_disabled': disabled,\n       'dds-tag_with-icon': isRemovable,\n       'dds-tag_inverse': isInverse\n     }\"\n     [size]=\"size\"\n     [theme]=\"theme\"\n     [ddsTheme]=\"themeConfig\"\n     [attr.aria-disabled]=\"disabled\"\n     [attr.aria-invalid]=\"isError\"\n     data-qa=\"tag\"\n     role=\"status\"\n     class=\"dds-tag {{customClass}}\">\n  <ng-content select=\"dds-user-pic\"></ng-content>\n  <ng-content select=\"[user-pic]\"></ng-content>\n  <div class=\"dds-tag__content\"\n       #tag>\n    <span class=\"dds-tag__text\"\n          #tagText>\n      <ng-content></ng-content>\n    </span>\n    @if (isRemovable) {\n    <button [disabled]=\"disabled\"\n            [ddsFocus]=\"tag\"\n            [attr.aria-label]=\"deleteBtnText\"\n            data-qa=\"button\"\n            role=\"button\"\n            class=\"dds-tag__icon dds-icon {{removeBtnIcon}}\"\n            (click)=\"removedItem($event)\"\n            (keydown)=\"handleKeydown($event)\"\n            #closeBtn></button>\n    }\n  </div>\n</div>\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\n\n@Component({\n  selector: 'dds-tags',\n  templateUrl: './tags.component.html',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true\n})\nexport class TagsComponent {\n  @Input() customClass: string | undefined;\n}\n","<div class=\"dds-tags {{customClass}}\"\n     data-qa=\"tags\"\n     role=\"group\">\n  <ng-content select=\"dds-tag\"></ng-content>\n</div>","import { NgModule } from '@angular/core';\nimport { TagComponent } from './tag/tag.component';\nimport { TagsComponent } from './tags/tags.component';\n\n@NgModule({\n  declarations: [],\n  imports: [TagsComponent, TagComponent],\n  exports: [TagsComponent, TagComponent],\n})\nexport class TagsModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAGO,MAAM,eAAe,GAAoB;AAC9C,IAAA,CAAC,YAAY,CAAC,IAAI,GAAG;AACnB,QAAA,CAAC,IAAI,CAAC,EAAE,GAAG,YAAY;AACvB,QAAA,CAAC,IAAI,CAAC,EAAE,GAAG,YAAY;AACxB,KAAA;AACD,IAAA,CAAC,YAAY,CAAC,MAAM,GAAG;AACrB,QAAA,CAAC,MAAM,CAAC,KAAK,GAAG,eAAe;AAC/B,QAAA,CAAC,MAAM,CAAC,IAAI,GAAG,cAAc;AAC9B,KAAA;CACF;AAEM,MAAM,cAAc,GAAG,cAAc;AACrC,MAAM,uBAAuB,GAAG,gBAAgB;;ACOvD,MAAM,OAAO,GAA2B,YAAY,CAAC,SAAS,EAAE,CAAC;AAS3D,MAAO,YAAa,SAAQ,OAAO,CAAA;AAiDvC,IAAA,WAAA,CAAmB,GAAsB,EAAS,IAAiB,EAAU,QAAmB,EAAU,SAA2B,EAAA;AACnI,QAAA,KAA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