{"version":3,"file":"daffodil-design-progress-bar.mjs","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","../../../libs/design/progress-bar/src/daffodil-design-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  Input,\n  ChangeDetectionStrategy,\n  Output,\n  EventEmitter,\n  ChangeDetectorRef,\n  booleanAttribute,\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  styleUrls: ['./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 _changeDetectorRef: ChangeDetectorRef,\n    private colorable: DaffColorableDirective,\n  ) {\n    this.colorable.defaultColor = 'primary';\n  }\n\n  private _percentage = 0;\n\n  /**\n   * @docs-private\n   */\n  @ContentChild(DaffProgressBarLabelDirective) _label: DaffProgressBarLabelDirective;\n\n  /**\n   * Sets the percentage completion of the progression,\n   * expressed as a whole number between 0 and 100.\n   */\n  @Input() get percentage(): number {\n    return this._percentage;\n  };\n  set percentage(val: number) {\n    this._percentage = clamp(val, 0, 100);\n    this._changeDetectorRef.markForCheck();\n  }\n\n  /**\n   * @docs-private\n   */\n  get ariaValueNow() {\n    return this.indeterminate ? null : this.percentage;\n  }\n\n  /**\n   * @docs-private\n   */\n  get ariaLabelledBy() {\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  @Input('aria-label') ariaLabel = '';\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  @Input({ transform: booleanAttribute }) indeterminate = false;\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  @Output() finished: EventEmitter<void> = new EventEmitter();\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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAEA;;;;;;;AAOG;MAKU,6BAA6B,CAAA;iIAA7B,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;qHAA7B,6BAA6B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,yBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAA7B,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAJzC,SAAS;AAAC,YAAA,IAAA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