{"version":3,"file":"moxa-formoxa-mx-infotip.mjs","sources":["../../../../libs/formoxa/mx-infotip/src/lib/services/mx-infotip-intl.service.ts","../../../../libs/formoxa/mx-infotip/src/lib/components/mx-infotip.component.ts","../../../../libs/formoxa/mx-infotip/src/moxa-formoxa-mx-infotip.ts"],"sourcesContent":["import { Injectable, Optional, Provider, SkipSelf } from '@angular/core';\nimport { TranslationService } from '@moxa/formoxa/mx-shared';\nimport { MxInfotipIntlLabels } from '../models/mx-infotip-intl.model';\n\n@Injectable({ providedIn: 'root' })\nexport class MxInfotipIntlService extends TranslationService<MxInfotipIntlLabels> {\n  defaultLabels: MxInfotipIntlLabels = {\n    infoTipTitleLabel: 'Info',\n    errorTipTitleLabel: 'Error',\n    successTipTitleLabel: 'Success',\n    warningTipTitleLabel: 'Warning'\n  };\n\n  constructor() {\n    super();\n    this.registerTranslations('en', this.defaultLabels);\n  }\n}\n\nfunction MX_INFOTIP_TRIGGER_INTL_PROVIDER_FACTORY(parent: MxInfotipIntlService): MxInfotipIntlService {\n  return parent || new MxInfotipIntlService();\n}\n\nexport const MX_INFOTIP_TRIGGER_INTL_PROVIDER: Provider = {\n  provide: MxInfotipIntlService,\n  useFactory: MX_INFOTIP_TRIGGER_INTL_PROVIDER_FACTORY,\n  deps: [[new Optional(), new SkipSelf(), MxInfotipIntlService]]\n};\n","import { ChangeDetectorRef, Component, ElementRef, inject, input } from '@angular/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MX_INFOTIP_TRIGGER_INTL_PROVIDER, MxInfotipIntlService } from '../services/mx-infotip-intl.service';\n\nexport type MxTipSelectorTypes = 'mx-warning-tip' | 'mx-info-tip' | 'mx-error-tip' | 'mx-success-tip';\nexport const MX_TIP_VARIANTS: { attribute: MxTipSelectorTypes; classes: string[] }[] = [\n  {\n    attribute: 'mx-warning-tip',\n    classes: ['mx-infotip--warning']\n  },\n  {\n    attribute: 'mx-info-tip',\n    classes: ['mx-infotip--info']\n  },\n  {\n    attribute: 'mx-error-tip',\n    classes: ['mx-infotip--error']\n  },\n  {\n    attribute: 'mx-success-tip',\n    classes: ['mx-infotip--success']\n  }\n];\n@Component({\n  selector: 'mx-infotip, div[mx-warning-tip], div[mx-info-tip], div[mx-error-tip], div[mx-success-tip]',\n  imports: [MatIconModule],\n  template: `\n    <div class=\"mx-infotip\">\n      <mat-icon [svgIcon]=\"iconName\" class=\"mx-infotip__icon\"></mat-icon>\n      <div>\n        @if (title()) {\n          <div class=\"mx-infotip__title\">{{ title() }}</div>\n        }\n        <div class=\"mx-infotip__content\"><ng-content></ng-content></div>\n      </div>\n    </div>\n  `,\n  styleUrls: ['./mx-infotip.component.scss'],\n  providers: [MX_INFOTIP_TRIGGER_INTL_PROVIDER]\n})\nexport class MxInfotipComponent {\n  #elRef = inject(ElementRef);\n  #element = this.#elRef.nativeElement as HTMLElement;\n  #classList = this.#element.classList;\n\n  cd = inject(ChangeDetectorRef);\n  intl = inject(MxInfotipIntlService);\n\n  tipType: MxTipSelectorTypes = 'mx-info-tip';\n\n  /**\n   * Optional title displayed above the content\n   */\n  title = input<string>('');\n\n  get iconName(): string {\n    if (this.tipType === 'mx-warning-tip') return 'icon:emergency_home';\n    if (this.tipType === 'mx-error-tip') return 'icon:dangerous';\n    if (this.tipType === 'mx-success-tip') return 'icon:check_circle';\n    return 'icon:mx-info_slab_circle';\n  }\n\n  constructor() {\n    for (const { attribute, classes } of MX_TIP_VARIANTS) {\n      if (this.#element.hasAttribute(attribute)) {\n        this.#classList.add(...classes);\n        this.tipType = attribute;\n      } else {\n        this.#classList.add(...(MX_TIP_VARIANTS.find((f) => f.attribute === this.tipType)?.classes ?? []));\n      }\n    }\n  }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAKM,MAAO,oBAAqB,SAAQ,kBAAuC,CAAA;AAQ/E,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;AART,QAAA,IAAA,CAAA,aAAa,GAAwB;AACnC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