{"version":3,"file":"toolbox-messagebox.mjs","sources":["../../../projects/toolbox/messagebox/messagebox-type.ts","../../../projects/toolbox/messagebox/messagebox.service.ts","../../../projects/toolbox/messagebox/toolbox-messagebox.ts"],"sourcesContent":["/** The different types of message boxes. */\r\nexport enum TbxMessageBoxType\r\n{\r\n  /** Do not display the message box. */\r\n  none,\r\n\r\n  /** Display a success message box. */\r\n  success,\r\n\r\n  /** Display an error message box. */\r\n  error,\r\n\r\n  /** Display an informational message box. */\r\n  info,\r\n\r\n  /** Display a warning message box. */\r\n  warning\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { Injectable } from \"@angular/core\";\r\nimport { TbxMessageBoxType } from \"./messagebox-type\";\r\nimport \"sweetalert\";\r\n\r\n/**\r\n * A service to display message boxes on the application using `sweetalert`.\r\n */\r\n@Injectable( { providedIn: \"root\" } )\r\nexport class TbxMessageBoxService\r\n{\r\n  /**\r\n   * Displays a success message box.\r\n   * @param message The message to display in the message box.\r\n   * @param title The title of the message box.\r\n   * @returns The promise containing the message box.\r\n   */\r\n  public async success( message: string, title?: string ): Promise<any>\r\n  {\r\n    return this.show( TbxMessageBoxType.success, message, title );\r\n  }\r\n\r\n  /**\r\n   * Displays an error message box.\r\n   * @param message The message to display in the message box.\r\n   * @param title The title of the message box.\r\n   * @returns The promise containing the message box.\r\n   */\r\n  public async error( message: string, title?: string ): Promise<any>\r\n  {\r\n    return this.show( TbxMessageBoxType.error, message, title );\r\n  }\r\n\r\n  /**\r\n   * Displays an information message box.\r\n   * @param message The message to display in the message box.\r\n   * @param title The title of the message box.\r\n   * @returns The promise containing the message box.\r\n   */\r\n  public async info( message: string, title?: string ): Promise<any>\r\n  {\r\n    return this.show( TbxMessageBoxType.info, message, title );\r\n  }\r\n\r\n  /**\r\n   * Displays a warning message box.\r\n   * @param message The message to display in the message box.\r\n   * @param title The title of the message box.\r\n   * @returns The promise containing the message box.\r\n   */\r\n  public async warning( message: string, title?: string ): Promise<any>\r\n  {\r\n    return this.show( TbxMessageBoxType.warning, message, title );\r\n  }\r\n\r\n  /**\r\n   * Displays a confirmation message box.\r\n   * @param message The message to display in the message box.\r\n   * @param explanation The explanation to show under the title.\r\n   * @returns The promise containing the message box.\r\n   */\r\n  // eslint-disable-next-line class-methods-use-this\r\n  public async confirm( message: string, explanation?: string ): Promise<any>\r\n  {\r\n    return swal( {\r\n      title: message,\r\n      text: explanation,\r\n      closeOnEsc: true,\r\n      closeOnClickOutside: false,\r\n      icon: \"warning\",\r\n      buttons: [\"No\", \"Yes\"],\r\n      dangerMode: true\r\n    } );\r\n  }\r\n\r\n  /**\r\n   * Displays a simple message box with no icons.\r\n   * @param message - The message to display in the message box.\r\n   * @param title - The title of the message box.\r\n   * @returns The promise containing the message box.\r\n   */\r\n  // eslint-disable-next-line class-methods-use-this\r\n  public async message( message: string, title?: string ): Promise<any>\r\n  {\r\n    return swal( {\r\n      title,\r\n      text: message,\r\n      closeOnEsc: true,\r\n      closeOnClickOutside: true\r\n    } );\r\n  }\r\n\r\n  /**\r\n   * Displays a message box.\r\n   * @param type - The message box type.\r\n   * @param message - The message to display in the message box.\r\n   * @param title - The title of the message box.\r\n   * @returns The promise containing the message box.\r\n   */\r\n  // eslint-disable-next-line class-methods-use-this\r\n  public async show(\r\n    type: TbxMessageBoxType, message: string, title?: string ): Promise<any>\r\n  {\r\n    return swal( {\r\n      title,\r\n      text: message,\r\n      closeOnEsc: true,\r\n      closeOnClickOutside: true,\r\n      dangerMode: type === TbxMessageBoxType.error,\r\n      icon: type === TbxMessageBoxType.success ? \"success\" :\r\n            type === TbxMessageBoxType.error   ? \"error\"   :\r\n            type === TbxMessageBoxType.warning ? \"warning\" :\r\n            type === TbxMessageBoxType.info    ? \"info\"    : undefined\r\n    } );\r\n  }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAAA;IACY;AAAZ,CAAA,UAAY,iBAAiB,EAAA;;AAG3B,IAAA,i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