{"version":3,"file":"daffodil-design-progress-bar.mjs","names":[],"sources":["../../../libs/design/progress-bar/src/progress-bar-label/progress-bar-label.directive.ts","../../../libs/design/progress-bar/src/progress-bar.component.ts","../../../libs/design/progress-bar/src/progress-bar.component.html","../../../libs/design/progress-bar/src/progress-bar.module.ts","../../../libs/design/progress-bar/src/progress-bar.ts"],"sourcesContent":["import { Directive } from '@angular/core';\n\n/**\n * Use label to help users understand what the progress represents.\n *\n * @usage\n * ```html\n * <daff-progress-bar-label>File upload</daff-progress-bar-label>\n * ```\n */\n@Directive({\n  /* eslint-disable-next-line @angular-eslint/directive-selector */\n  selector: 'daff-progress-bar-label',\n})\nexport class DaffProgressBarLabelDirective {}\n","import {\n  Component,\n  ChangeDetectionStrategy,\n  booleanAttribute,\n  input,\n  output,\n  computed,\n  contentChild,\n} from '@angular/core';\n\nimport { DaffColorableDirective } from '@daffodil/design';\n\nimport { DaffProgressBarLabelDirective } from './progress-bar-label/progress-bar-label.directive';\n\nexport const clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\n\nlet daffProgressBarId = 0;\n\n/**\n * A progress bar provides visual feedback about the duration or progress of a task or operation.\n *\n * @usage\n * ```html\n * <daff-progress-bar>\n *  <daff-progress-bar-label>File upload</daff-progress-bar-label>\n * </daff-progress-bar>\n * ```\n */\n@Component({\n  selector: 'daff-progress-bar',\n  templateUrl: './progress-bar.component.html',\n  styleUrl: './progress-bar.component.scss',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  hostDirectives: [\n    {\n      directive: DaffColorableDirective,\n      inputs: ['color'],\n    },\n  ],\n  host: {\n    class: 'daff-progress-bar',\n    '[class.indeterminate]': 'indeterminate()',\n  },\n})\nexport class DaffProgressBarComponent {\n  constructor(\n    private colorable: DaffColorableDirective,\n  ) {\n    this.colorable.defaultColor = 'primary';\n  }\n\n  /**\n   * @docs-private\n   */\n  _label = contentChild(DaffProgressBarLabelDirective);\n\n  /**\n   * Sets the percentage completion of the progression,\n   * expressed as a whole number between 0 and 100.\n   */\n  percentage = input(0, { transform: (val: number) => clamp(val, 0, 100) });\n\n  /**\n   * @docs-private\n   */\n  ariaValueNow = computed(() => this.indeterminate() ? null : this.percentage());\n\n  /**\n   * @docs-private\n   */\n  ariaLabelledBy = computed(() => {\n    if(!this.ariaLabel() && this.id) {\n      return this.id;\n    }\n  });\n\n  /**\n   * @docs-private\n   *\n   * The unique id of the progress bar.\n   */\n  id = 'daff-progress-bar-' + ++daffProgressBarId;\n\n  /**\n   * An `aria-label` for the progress bar.\n   */\n  ariaLabel = input('', { alias: 'aria-label' });\n\n  /**\n   * Property to set the animation of a progress bar to\n   * run for an indefinite amount of time.\n   *\n   * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress\n   **/\n  indeterminate = input(false, { transform: booleanAttribute });\n\n  /**\n   * @docs-private\n   *\n   * Returns the transform style for the determinate progress bar.\n   */\n  _determinateBarTransform(): string {\n    return `scaleX(${this.percentage() / 100})`;\n  }\n\n  /**\n   * An event that emits each time the progression reaches 100%\n   * and the animation is finished.\n   */\n  finished = output<void>();\n\n  /**\n   * @docs-private\n   *\n   * Handles the CSS transition end event.\n   */\n  onTransitionEnd(event: TransitionEvent): void {\n    if (event.propertyName === 'transform' && this.percentage() === 100) {\n      this.finished.emit();\n    }\n  }\n}\n","@if (_label()) {\n\t<div class=\"daff-progress-bar__label\"\n\t\t[attr.id]=\"id\">\n\t\t<ng-content select=\"daff-progress-bar-label\"></ng-content>\n\t</div>\n}\n<div class=\"daff-progress-bar__track\"\n\trole=\"progressbar\"\n\taria-valuemin=\"0\"\n\taria-valuemax=\"100\"\n\t[attr.aria-valuenow]=\"ariaValueNow()\"\n\t[attr.aria-labelledby]=\"ariaLabelledBy()\">\n\t@if (indeterminate()) {\n\t\t<div class=\"daff-progress-bar__fill indeterminate-bar\" aria-hidden=\"true\"></div>\n\t} @else {\n\t\t<div class=\"daff-progress-bar__fill determinate-bar\"\n\t\t\taria-hidden=\"true\"\n\t\t\t[style.transform]=\"_determinateBarTransform()\"\n\t\t\t(transitionend)=\"onTransitionEnd($event)\">\n\t\t</div>\n\t}\n</div>","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { DaffProgressBarLabelDirective } from './progress-bar-label/progress-bar-label.directive';\nimport { DaffProgressBarComponent } from './progress-bar.component';\n\n/**\n * @deprecated in favor of {@link DAFF_PROGRESS_BAR_COMPONENTS}. Deprecated in version 0.78.0. Will be removed in version 1.0.0.\n */\n@NgModule({\n  imports: [\n    CommonModule,\n    DaffProgressBarComponent,\n    DaffProgressBarLabelDirective,\n  ],\n  exports: [\n    DaffProgressBarComponent,\n    DaffProgressBarLabelDirective,\n  ],\n})\nexport class DaffProgressBarModule { }\n","import { DaffProgressBarLabelDirective } from './progress-bar-label/progress-bar-label.directive';\nimport { DaffProgressBarComponent } from './progress-bar.component';\n\n/**\n * @docs-private\n */\nexport const DAFF_PROGRESS_BAR_COMPONENTS = <const> [\n  DaffProgressBarComponent,\n  DaffProgressBarLabelDirective,\n];\n"],"mappings":";;;;;AAcA,IAAa,gCAAb,MAAa,8BAA6B;CAA7B;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA6B,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAA7B;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAA6B,cAAA;GAAA,UAAA;GAAA,UAAA;EAAA,CAAA;CAAA;;AAA7B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA6B,YAAA,CAAA;EAJzC,MAAA;EAAU,MAAA,CAAA,EAET,UAAU,0BACX,CAAA;;;ACCD,MAAa,SAAS,OAAe,KAAa,QAAgB,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;AAEpG,IAAI,oBAAoB;AA4BxB,IAAa,2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