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U,KAAmB,EAAA;AAC3B,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AACb,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,SAAS,KAAe,EAAA;AACtB,IAAA,IAAA,CAAK,IAAO,GAAA,KAAA;AACZ,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,YAAY,KAAe,EAAA;AACzB,IAAA,IAAA,CAAK,OAAU,GAAA,KAAA;AACf,IAAO,OAAA,IAAA;AAAA;AAEX","file":"badge.mjs","sourcesContent":["import { IElement, Element } from '../base';\n\nimport { IconName } from './icon';\n\nexport type BadgeAppearance = 'filled' | 'tint';\nexport type BadgeStyle =\n  | 'default'\n  | 'subtle'\n  | 'informative'\n  | 'accent'\n  | 'good'\n  | 'attention'\n  | 'warning';\n\n/**\n * A badge element to show an icon and/or text in a compact form over a colored background.\n */\nexport interface IBadge extends IElement {\n  type: 'Badge';\n\n  /**\n   * Controls the strength of the background color.\n   */\n  appearance?: BadgeAppearance;\n\n  /**\n   * The name of the icon to display.\n   */\n  icon?: IconName;\n\n  /**\n   * Controls the position of the icon.\n   */\n  iconPosition?: 'before' | 'after';\n\n  /**\n   * Controls the shape of the badge.\n   */\n  shape?: 'square' | 'rounded' | 'circular';\n\n  /**\n   * The size of the badge.\n   */\n  size?: 'medium' | 'large' | 'extraLarge';\n\n  /**\n   * The style of the badge.\n   */\n  style?: BadgeStyle;\n\n  /**\n   * The text to display.\n   */\n  text?: string;\n\n  /**\n   * Controls the tooltip text to display when the badge is hovered over.\n   */\n  tooltip?: string;\n}\n\nexport type BadgeOptions = Omit<IBadge, 'type'>;\n\n/**\n * A badge element to show an icon and/or text in a compact form over a colored background.\n */\nexport class Badge extends Element implements IBadge {\n  type: 'Badge';\n\n  /**\n   * Controls the strength of the background color.\n   */\n  appearance?: BadgeAppearance;\n\n  /**\n   * The name of the icon to display.\n   */\n  icon?: IconName;\n\n  /**\n   * Controls the position of the icon.\n   */\n  iconPosition?: 'before' | 'after';\n\n  /**\n   * Controls the shape of the badge.\n   */\n  shape?: 'square' | 'rounded' | 'circular';\n\n  /**\n   * The size of the badge.\n   */\n  size?: 'medium' | 'large' | 'extraLarge';\n\n  /**\n   * The style of the badge.\n   */\n  style?: BadgeStyle;\n\n  /**\n   * The text to display.\n   */\n  text?: string;\n\n  /**\n   * Controls the tooltip text to display when the badge is hovered over.\n   */\n  tooltip?: string;\n\n  constructor(options: BadgeOptions = {}) {\n    super();\n    this.type = 'Badge';\n    Object.assign(this, options);\n  }\n\n  static from(options: BadgeOptions) {\n    return new Badge(options);\n  }\n\n  withAppearance(value: BadgeAppearance) {\n    this.appearance = value;\n    return this;\n  }\n\n  withIcon(value: IconName, position?: 'before' | 'after') {\n    this.icon = value;\n    this.iconPosition = position;\n    return this;\n  }\n\n  withIconPosition(value: 'before' | 'after') {\n    this.iconPosition = value;\n    return this;\n  }\n\n  withShape(value: 'square' | 'rounded' | 'circular') {\n    this.shape = value;\n    return this;\n  }\n\n  withSize(value: 'medium' | 'large' | 'extraLarge') {\n    this.size = value;\n    return this;\n  }\n\n  withStyle(value: BadgeStyle) {\n    this.style = value;\n    return this;\n  }\n\n  withText(value: string) {\n    this.text = value;\n    return this;\n  }\n\n  withTooltip(value: string) {\n    this.tooltip = value;\n    return this;\n  }\n}\n"]}