{"version":3,"names":["ProgressErrors","adsProgressCss","AdsProgressStyle0","AdsProgress","constructor","hostRef","this","el","setAttribute","identifier","generateId","component","handleIdentifierChange","newValue","onProgressChanged","undefined","max","showErrorMessage","INVALID_VALUE","componentDidLoad","Pipeline.addComponent","disconnectedCallback","Pipeline.removeComponent","render","classes","hasGradient","push","attributes","isNullOrUndefinedOrEmpty","srLabel","value","h","Object","assign","key","class","join","dir"],"sources":["src/components/ads-progress/ads-progress.types.ts","src/components/ads-progress/ads-progress.scss?tag=ads-progress&encapsulation=shadow","src/components/ads-progress/ads-progress.tsx"],"sourcesContent":["/**\n * Collection of progress errors\n */\nexport enum ProgressErrors {\n INVALID_VALUE = 'Invalid value. Value must be an inclusive number between 0 and max (defaults to 100)',\n}\n","@import 'core';\n\n/**\n * @prop --ads-progress-background-color: Background color\n * @prop --ads-progress-bar-background-color: Bar background color\n * @prop --ads-progress-bar-gradient-start-color: Gradient start color\n * @prop --ads-progress-border-color: Border color\n * @prop --ads-progress-width: Width\n * @prop --ads-progress-height: Height\n */\n\n:host {\n display: block;\n line-height: 0;\n}\n\n:host([theme='default']) {\n @include ads-vars-component-progress-default;\n}\n\n:host([theme='dark']) {\n @include ads-vars-component-progress-dark;\n}\n\n.c-progress {\n @include ads-progress;\n}\n","import { Component, Element, Prop, VNode, Watch, h } from '@stencil/core';\n\nimport * as Pipeline from '../core/utils/pipeline';\nimport { BaseComponent } from '../core/interfaces/BaseComponent';\nimport { ProgressErrors } from './ads-progress.types';\nimport { Theme } from '../core/types/globalTypes';\nimport { generateId, showErrorMessage } from '../core/utils/components';\nimport { isNullOrUndefinedOrEmpty } from 'utils/collection';\n\n/**\n * Progress bars are a way of conveying to the user how far along a process they are, or the state of a process behind the scenes.\n * They act as a native `` element does, and can have a gradient enabled via the has-gradient property.\n * @tag ``\n * @example \n */\n@Component({\n tag: 'ads-progress',\n styleUrl: 'ads-progress.scss',\n shadow: true,\n})\nexport class AdsProgress implements BaseComponent {\n /**\n * @hidden\n */\n public component: string;\n\n constructor() {\n this.el.setAttribute('id', this.identifier || generateId('ads-progress'));\n this.component = 'ads-progress';\n }\n\n @Element() private el: HTMLAdsProgressElement;\n\n /**\n * The unique identifier (optional)\n */\n @Prop({ attribute: 'id' }) identifier?: string;\n\n /**\n * The theme for this component instance (optional)\n * Values: \"default\", \"dark\"\n */\n @Prop({ reflect: true }) theme?: Theme;\n\n /**\n * The value for the aria-label, to describe the purpose of the progress (optional)\n */\n @Prop({ reflect: true }) srLabel?: string;\n\n /**\n * The progress of the bar, with a max of maxValue (optional)\n * @default 0\n */\n @Prop({ reflect: true }) value = 0;\n\n /**\n * The maximum possible value of the 'value' prop (optional)\n * @default 100\n */\n @Prop({ reflect: true }) max = 100;\n\n /**\n * Whether the progress bar has a gradient colour (optional)\n * @default false\n */\n @Prop({ reflect: true }) hasGradient = false;\n\n /**\n * Handle identifier property changes\n * @param {string} newValue The new value for \"identifier\"\n * @hidden\n */\n @Watch('identifier')\n handleIdentifierChange(newValue: string): void {\n this.el.setAttribute('id', newValue || generateId('ads-progress'));\n }\n\n /**\n * Called when value prop changes\n * @param {number} newValue new value\n * @hidden\n */\n @Watch('value')\n onProgressChanged(newValue: number): void {\n if ((newValue !== undefined || newValue !== null) && (newValue < 0 || newValue > this.max)) {\n showErrorMessage(ProgressErrors.INVALID_VALUE, this.el);\n }\n }\n\n protected componentDidLoad(): void {\n Pipeline.addComponent(this.el);\n }\n\n protected disconnectedCallback(): void {\n Pipeline.removeComponent(this.el);\n }\n\n protected render(): VNode {\n const classes = ['c-progress'];\n this.hasGradient ? classes.push('has-gradient') : null;\n\n const attributes = {\n 'aria-label': !isNullOrUndefinedOrEmpty(this.srLabel) ? this.srLabel : null,\n 'aria-valuenow': this.value,\n 'aria-valuemin': 0,\n 'aria-valuemax': this.max,\n };\n\n return () as VNode;\n }\n}\n"],"mappings":"kKAGA,IAAYA,GAAZ,SAAYA,GACVA,EAAA,uGACD,EAFD,CAAYA,MAAc,KCH1B,MAAMC,EAAiB,mhEACvB,MAAAC,EAAeD,E,MCmBFE,EAAW,MAMtB,WAAAC,CAAAC,G,2FA2BiC,E,SAMF,I,iBAMQ,MAtCrCC,KAAKC,GAAGC,aAAa,KAAMF,KAAKG,YAAcC,EAAW,iBACzDJ,KAAKK,UAAY,c,CA6CnB,sBAAAC,CAAuBC,GACrBP,KAAKC,GAAGC,aAAa,KAAMK,GAAYH,EAAW,gB,CASpD,iBAAAI,CAAkBD,GAChB,IAAKA,IAAaE,WAAaF,IAAa,QAAUA,EAAW,GAAKA,EAAWP,KAAKU,KAAM,CAC1FC,EAAiBjB,EAAekB,cAAeZ,KAAKC,G,EAI9C,gBAAAY,GACRC,EAAsBd,KAAKC,G,CAGnB,oBAAAc,GACRC,EAAyBhB,KAAKC,G,CAGtB,MAAAgB,GACR,MAAMC,EAAU,CAAC,cACjBlB,KAAKmB,YAAcD,EAAQE,KAAK,gBAAkB,KAElD,MAAMC,EAAa,CACjB,cAAeC,EAAyBtB,KAAKuB,SAAWvB,KAAKuB,QAAU,KACvE,gBAAiBvB,KAAKwB,MACtB,gBAAiB,EACjB,gBAAiBxB,KAAKU,KAGxB,OAAQe,EAAA,WAAAC,OAAAC,OAAA,CAAAC,IAAA,2CAAUC,MAAOX,EAAQY,KAAK,KAAMC,IAAI,MAAMP,MAAOxB,KAAKwB,MAAOd,IAAKV,KAAKU,KAASW,G","ignoreList":[]}