{"version":3,"file":"odx-angular-components-icon.mjs","sources":["../../../../libs/angular/components/icon/src/lib/models/icon-set.ts","../../../../libs/angular/components/icon/src/lib/models/icon-size.ts","../../../../libs/angular/components/icon/src/lib/helpers/unpack-icon-identifier.ts","../../../../libs/angular/components/icon/src/lib/icon.component.ts","../../../../libs/angular/components/icon/src/lib/icon.config.ts","../../../../libs/angular/components/icon/src/odx-angular-components-icon.ts"],"sourcesContent":["export type IconSet = (typeof IconSet)[keyof typeof IconSet];\n\n/**\n * @deprecated Use `OdxIconSet` from `@odx/icons` instead. This type is retained for backward compatibility and will be removed in future releases.\n */\nexport const IconSet = {\n  CORE: 'core',\n  MEDICAL: 'medical',\n  SAFETY: 'safety',\n  UIB_LEGACY: 'uib-legacy',\n} as const;\n","export type IconSize = (typeof IconSize)[keyof typeof IconSize];\n\nexport const IconSize = {\n  /**\n   * @deprecated Use `sm` instead.\n   */\n  SMALL: 'small',\n  SM: 'sm',\n\n  /**\n   * @deprecated Use `md` instead.\n   */\n  MEDIUM: 'medium',\n  MD: 'md',\n\n  /**\n   * @deprecated Use `lg` instead.\n   */\n  LARGE: 'large',\n  LG: 'lg',\n\n  XS: 'xs',\n\n  XL: 'xl',\n\n  /**\n   * @deprecated Use `xxl` instead.\n   */\n  XLARGE: 'xlarge',\n  XXL: 'xxl',\n  INLINE: 'inline',\n} as const;\n","import { IconSet } from '../models';\n\n/**\n * Unpacks a combined icon identifier string into separate icon set and icon name components.\n * The identifier is expected to follow the format \"iconSet::iconName\". If the \"iconName\" part is\n * missing, the function assumes the icon belongs to the 'core' set.\n *\n * @param {string} value The combined identifier string in the format \"iconSet::iconName\".\n * @returns {[iconSet: string, iconName: string]} A tuple containing the icon set and icon name as two separate strings. Defaults to 'core'\n *          if the iconName is omitted in the input.\n *\n * @example\n * ```ts\n * unpackIconIdentifier(\"menu\")       // returns ['core', 'menu']\n * ```\n */\nexport function unpackIconIdentifier(value: string): [iconSet: IconSet, iconName: string] {\n  const [iconSet, iconName] = value.split('::');\n  if (!iconName) return [IconSet.CORE, iconSet];\n  const set: IconSet = isIconSet(iconSet) ? iconSet : IconSet.CORE;\n  return [set, iconName];\n}\n\n/**\n * Determines if a given string is a valid icon set.\n *\n * @param {string} value The value to check if it is a valid icon set.\n * @returns {boolean} Whether the value is a valid icon set.\n *\n * @example\n * ```ts\n * isIconSet('core')       // returns true\n * isIconSet('custom')     // returns false\n * ```\n */\nexport function isIconSet(value: string): value is IconSet {\n  return Object.values(IconSet).includes(value as IconSet);\n}\n","import { Component, Input } from '@angular/core';\nimport { injectElement, setAttribute } from '@odx/angular/utils';\nimport { OdxIconName, OdxIconSet } from '@odx/icons';\nimport { unpackIconIdentifier } from './helpers';\nimport { IconSize } from './models';\n\n/**\n * Represents an icon component that can dynamically display various icons based on input properties. This component\n * leverages CSS for styling and is designed to be easily embedded within other components and views.\n *\n * It allows for specifying icon sets and individual icon names, supporting flexible usage across different contexts\n * and themes. The component is also optimized for performance with Angular's OnPush change detection strategy.\n */\n@Component({\n  selector: 'odx-icon',\n  standalone: true,\n  host: {\n    '[class.odx-icon]': 'true',\n    '[attr.size]': 'size',\n    translate: 'no',\n  },\n  template: '',\n})\nexport class IconComponent {\n  public readonly element = injectElement();\n\n  /**\n   * Specifies the size of the icon, which can be adjusted using predefined sizes from the IconSize enum.\n   *\n   * @type {IconSize}\n   * @default IconSize.MEDIUM\n   */\n  @Input()\n  public set size(value: IconSize) {\n    setAttribute(this.element.nativeElement, 'size', value);\n  }\n  public get size(): IconSize | null {\n    return (this.element.nativeElement.getAttribute('size') as IconSize) || IconSize.MD;\n  }\n\n  /**\n   * The name of the icon to be displayed, which corresponds to specific icons within a given icon set.\n   *\n   * @type {OdxIconName | null}\n   * @default null\n   */\n  @Input()\n  public set name(value: OdxIconName | (string & {}) | null) {\n    setAttribute(this.element.nativeElement, 'name', value);\n  }\n  public get name(): OdxIconName | (string & {}) | null {\n    return this.element.nativeElement.getAttribute('name') || null;\n  }\n\n  /**\n   * Specifies the icon set that the icon belongs to. The default set can be injected from the icon configuration.\n   *\n   * @type {OdxIconSet | null}\n   */\n  @Input()\n  public set set(value: OdxIconSet | (string & {}) | null) {\n    setAttribute(this.element.nativeElement, 'set', value);\n  }\n  public get set(): OdxIconSet | (string & {}) | null {\n    return this.element.nativeElement.getAttribute('set') as OdxIconSet | null;\n  }\n\n  /**\n   * Allows for setting both the icon set and icon name via a single identifier, typically formatted as 'set::name'.\n   * Unpacking this identifier sets both `name` and `set` properties.\n   *\n   * @param {string | null | undefined} value - The identifier to unpack.\n   * @deprecated Use `name` and `set` properties directly instead of the `identifier` input for better clarity and separation of concerns.\n   */\n  @Input()\n  public set identifier(value: string | null | undefined) {\n    const [set, name] = value ? unpackIconIdentifier(value) : [null, null];\n    this.name = name;\n    this.set = set;\n  }\n}\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { OdxIconSet } from '@odx/icons';\n\n/**\n * Represents the configuration options for icons in the application, specifying defaults\n * and configurations for the icon components used across the system.\n *\n * @typedef {Object} IconConfig\n * @property {OdxIconSet} defaultIconSet - The default set of icons to use if no specific set is provided.\n *\n * @deprecated The `defaultIconSet` property is deprecated and will be removed in future versions. Please specify the icon set directly on the component.\n */\nexport interface IconConfig {\n  defaultIconSet: OdxIconSet;\n}\n\n/**\n * Utility functions generated to handle the injection and provision of the `IconConfig`.\n * These include tokens and functions for accessing and providing icon configurations.\n *\n * - `IconConfig`: A type representing the shape of the icon configuration object.\n * - `IconDefaultConfig`: The default configuration which sets 'core' as the default icon set.\n * - `injectIconConfig`: A function to inject the icon configuration, usable in Angular components or services.\n * - `provideIconConfig`: A function to provide the icon configuration, typically used in Angular module providers.\n *\n * @example\n * ```ts\n * // To inject icon configuration in a component or service\n * const config = injectIconConfig();\n * console.log(config.defaultIconSet); // Outputs: 'core'\n *\n * // To provide icon configuration in a module\n * provideIconConfig({ defaultIconSet: 'custom' });\n * ```\n *\n * @deprecated The `defaultIconSet` property in the configuration is deprecated. Please specify the icon set directly on the component instead of relying on a default configuration.\n */\nexport const { IconConfig, IconDefaultConfig, injectIconConfig, provideIconConfig } = createConfigTokens('Icon', '@odx/angular/components/icon', {\n  defaultIconSet: 'core',\n} as IconConfig);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAEA;;AAEG;AACI,MAAM,OAAO,GAAG;AACrB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,UAAU,EAAE,YAAY;;;ACPnB,MAAM,QAAQ,GAAG;AACtB;;AAEG;AACH,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,EAAE,EAAE,IAAI;AAER;;AAEG;AACH,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,EAAE,EAAE,IAAI;AAER;;AAEG;AACH,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,EAAE,EAAE,IAAI;AAER,IAAA,EAAE,EAAE,IAAI;AAER,IAAA,EAAE,EAAE,IAAI;AAER;;AAEG;AACH,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,MAAM,EAAE,QAAQ;;;AC5BlB;;;;;;;;;;;;;AAaG;AACG,SAAU,oBAAoB,CAAC,KAAa,EAAA;AAChD,IAAA,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;AAC7C,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;AAC7C,IAAA,MAAM,GAAG,GAAY,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI;AAChE,IAAA,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC;AACxB;AAEA;;;;;;;;;;;AAWG;AACG,SAAU,SAAS,CAAC,KAAa,EAAA;IACrC,OAAO,MAAM,CAAC,MAAM,CAAC,OA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