@spectrum-web-components/progress-bar 1.11.2 → 1.11.3-next.20260216102310

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,6 +120,16 @@
120
120
  "text": "void"
121
121
  }
122
122
  }
123
+ },
124
+ {
125
+ "kind": "method",
126
+ "name": "formatProgress",
127
+ "privacy": "private",
128
+ "return": {
129
+ "type": {
130
+ "text": "string"
131
+ }
132
+ }
123
133
  }
124
134
  ],
125
135
  "attributes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/progress-bar",
3
- "version": "1.11.2",
3
+ "version": "1.11.3-next.20260216102310",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -64,10 +64,10 @@
64
64
  "css"
65
65
  ],
66
66
  "dependencies": {
67
- "@spectrum-web-components/base": "1.11.2",
68
- "@spectrum-web-components/field-label": "1.11.2",
69
- "@spectrum-web-components/reactive-controllers": "1.11.2",
70
- "@spectrum-web-components/shared": "1.11.2"
67
+ "@spectrum-web-components/base": "1.11.3-next.20260216102310",
68
+ "@spectrum-web-components/field-label": "1.11.3-next.20260216102310",
69
+ "@spectrum-web-components/reactive-controllers": "1.11.3-next.20260216102310",
70
+ "@spectrum-web-components/shared": "1.11.3-next.20260216102310"
71
71
  },
72
72
  "types": "./src/index.d.ts",
73
73
  "customElements": "custom-elements.json",
@@ -12,8 +12,8 @@
12
12
  import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
13
13
  import '@spectrum-web-components/field-label/sp-field-label.js';
14
14
  declare const ProgressBar_base: typeof SpectrumElement & {
15
- new (...args: any[]): import("@spectrum-web-components/core/shared/observe-slot-text.js").SlotTextObservingInterface;
16
- prototype: import("@spectrum-web-components/core/shared/observe-slot-text.js").SlotTextObservingInterface;
15
+ new (...args: any[]): import("@spectrum-web-components/shared").SlotTextObservingInterface;
16
+ prototype: import("@spectrum-web-components/shared").SlotTextObservingInterface;
17
17
  } & {
18
18
  new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
19
19
  prototype: import("@spectrum-web-components/base").SizedElementInterface;
@@ -36,6 +36,7 @@ export declare class ProgressBar extends ProgressBar_base {
36
36
  protected render(): TemplateResult;
37
37
  protected handleSlotchange(): void;
38
38
  protected firstUpdated(changes: PropertyValues): void;
39
+ private formatProgress;
39
40
  protected updated(changes: PropertyValues): void;
40
41
  }
41
42
  export {};
@@ -21,7 +21,10 @@ import {
21
21
  } from "@spectrum-web-components/base/src/decorators.js";
22
22
  import { getLabelFromSlot } from "@spectrum-web-components/shared/src/get-label-from-slot.js";
23
23
  import { ObserveSlotText } from "@spectrum-web-components/shared/src/observe-slot-text.js";
24
- import { LanguageResolutionController } from "@spectrum-web-components/reactive-controllers/src/LanguageResolution.js";
24
+ import {
25
+ LanguageResolutionController,
26
+ languageResolverUpdatedSymbol
27
+ } from "@spectrum-web-components/reactive-controllers/src/LanguageResolution.js";
25
28
  import "@spectrum-web-components/field-label/sp-field-label.js";
26
29
  import styles from "./progress-bar.css.js";
27
30
  export class ProgressBar extends SizedMixin(
@@ -76,13 +79,7 @@ export class ProgressBar extends SizedMixin(
76
79
  size=${this.size}
77
80
  class="percentage"
78
81
  >
79
- ${new Intl.NumberFormat(
80
- this.languageResolver.language,
81
- {
82
- style: "percent",
83
- unitDisplay: "narrow"
84
- }
85
- ).format(this.progress / 100)}
82
+ ${this.formatProgress()}
86
83
  </sp-field-label>
87
84
  `}
88
85
  ` : nothing}
@@ -106,6 +103,12 @@ export class ProgressBar extends SizedMixin(
106
103
  this.setAttribute("role", "progressbar");
107
104
  }
108
105
  }
106
+ formatProgress() {
107
+ return new Intl.NumberFormat(this.languageResolver.language, {
108
+ style: "percent",
109
+ unitDisplay: "narrow"
110
+ }).format(this.progress / 100);
111
+ }
109
112
  updated(changes) {
110
113
  super.updated(changes);
111
114
  if (changes.has("indeterminate")) {
@@ -113,13 +116,20 @@ export class ProgressBar extends SizedMixin(
113
116
  this.removeAttribute("aria-valuemin");
114
117
  this.removeAttribute("aria-valuemax");
115
118
  this.removeAttribute("aria-valuenow");
119
+ this.removeAttribute("aria-valuetext");
116
120
  } else {
117
121
  this.setAttribute("aria-valuemin", "0");
118
122
  this.setAttribute("aria-valuemax", "100");
123
+ this.setAttribute("aria-valuenow", "" + this.progress);
124
+ this.setAttribute("aria-valuetext", this.formatProgress());
119
125
  }
120
126
  }
121
127
  if (!this.indeterminate && changes.has("progress")) {
122
128
  this.setAttribute("aria-valuenow", "" + this.progress);
129
+ this.setAttribute("aria-valuetext", this.formatProgress());
130
+ }
131
+ if (!this.indeterminate && changes.has(languageResolverUpdatedSymbol)) {
132
+ this.setAttribute("aria-valuetext", this.formatProgress());
123
133
  }
124
134
  if (changes.has("label")) {
125
135
  if (this.label.length) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["ProgressBar.ts"],
4
- "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\n\nimport { getLabelFromSlot } from '@spectrum-web-components/shared/src/get-label-from-slot.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport { LanguageResolutionController } from '@spectrum-web-components/reactive-controllers/src/LanguageResolution.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport styles from './progress-bar.css.js';\n\n/**\n * @element sp-progress-bar\n */\nexport class ProgressBar extends SizedMixin(\n ObserveSlotText(SpectrumElement, ''),\n {\n noDefaultSize: true,\n }\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String, reflect: true })\n public label = '';\n\n private languageResolver = new LanguageResolutionController(this);\n\n @property({ type: Boolean, attribute: 'over-background' })\n public get overBackground(): string {\n return this._overBackground ? 'over-background' : '';\n }\n public set overBackground(overBackground: boolean) {\n if (overBackground === true) {\n this.removeAttribute('over-background');\n this.staticColor = 'white';\n\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"over-background\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-bar/#variants',\n {\n level: 'deprecation',\n }\n );\n }\n }\n }\n private _overBackground: boolean = false;\n\n @property({ type: Boolean, reflect: true, attribute: 'side-label' })\n public sideLabel = false;\n\n @property({ type: Number })\n public progress = 0;\n\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'white';\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n protected override render(): TemplateResult {\n return html`\n ${this.slotHasContent || this.label\n ? html`\n <sp-field-label size=${this.size} class=\"label\">\n ${this.slotHasContent ? html`` : this.label}\n\n <slot @slotchange=${this.handleSlotchange}></slot>\n </sp-field-label>\n `\n : html``}\n ${this.label\n ? html`\n ${this.indeterminate\n ? nothing\n : html`\n <sp-field-label\n size=${this.size}\n class=\"percentage\"\n >\n ${new Intl.NumberFormat(\n this.languageResolver.language,\n {\n style: 'percent',\n unitDisplay: 'narrow',\n }\n ).format(this.progress / 100)}\n </sp-field-label>\n `}\n `\n : nothing}\n <div class=\"track\">\n <div\n class=\"fill\"\n style=\"transform: scaleX(calc(${this.progress} / 100));\"\n ></div>\n </div>\n `;\n }\n\n protected handleSlotchange(): void {\n const labelFromSlot = getLabelFromSlot(this.label, this.slotEl);\n if (labelFromSlot) {\n this.label = labelFromSlot;\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'progressbar');\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('indeterminate')) {\n if (this.indeterminate) {\n this.removeAttribute('aria-valuemin');\n this.removeAttribute('aria-valuemax');\n this.removeAttribute('aria-valuenow');\n } else {\n this.setAttribute('aria-valuemin', '0');\n this.setAttribute('aria-valuemax', '100');\n }\n }\n if (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n }\n if (changes.has('label')) {\n if (this.label.length) {\n this.setAttribute('aria-label', this.label);\n } else if (\n changes.get('label') === this.getAttribute('aria-label')\n ) {\n this.removeAttribute('aria-label');\n }\n }\n\n if (window.__swc?.DEBUG) {\n if (\n !this.label &&\n !this.getAttribute('aria-label') &&\n !this.getAttribute('aria-labelledby') &&\n !this.slotHasContent\n ) {\n window.__swc.warn(\n this,\n '<sp-progress-bar> elements need one of the following to be accessible:',\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-bar/#accessibility',\n {\n type: 'accessibility',\n issues: [\n 'value supplied to the \"label\" attribute, which will be displayed visually as part of the element, or',\n 'text content supplied directly to the <sp-progress-circle> element, or',\n 'value supplied to the \"aria-label\" attribute, which will only be provided to screen readers, or',\n 'an element ID reference supplied to the \"aria-labelledby\" attribute, which will be provided by screen readers and will need to be managed manually by the parent application.',\n ],\n }\n );\n }\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OAEG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAEP,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,oCAAoC;AAC7C,OAAO;AACP,OAAO,YAAY;AAKZ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A,YACJ;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;AAjJW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAVjC,YAWF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAbhC,YAcF;AAKI;AAAA,EADV,SAAS,EAAE,MAAM,SAAS,WAAW,kBAAkB,CAAC;AAAA,GAlBhD,YAmBE;AAuBJ;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,aAAa,CAAC;AAAA,GAzC1D,YA0CF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GA5CjB,YA6CF;AAGA;AAAA,EADN,SAAS,EAAE,SAAS,MAAM,WAAW,eAAe,CAAC;AAAA,GA/C7C,YAgDF;AAGC;AAAA,EADP,MAAM,MAAM;AAAA,GAlDJ,YAmDD;",
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\n\nimport { getLabelFromSlot } from '@spectrum-web-components/shared/src/get-label-from-slot.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport {\n LanguageResolutionController,\n languageResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/LanguageResolution.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport styles from './progress-bar.css.js';\n\n/**\n * @element sp-progress-bar\n */\nexport class ProgressBar extends SizedMixin(\n ObserveSlotText(SpectrumElement, ''),\n {\n noDefaultSize: true,\n }\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String, reflect: true })\n public label = '';\n\n private languageResolver = new LanguageResolutionController(this);\n\n @property({ type: Boolean, attribute: 'over-background' })\n public get overBackground(): string {\n return this._overBackground ? 'over-background' : '';\n }\n public set overBackground(overBackground: boolean) {\n if (overBackground === true) {\n this.removeAttribute('over-background');\n this.staticColor = 'white';\n\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"over-background\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-bar/#variants',\n {\n level: 'deprecation',\n }\n );\n }\n }\n }\n private _overBackground: boolean = false;\n\n @property({ type: Boolean, reflect: true, attribute: 'side-label' })\n public sideLabel = false;\n\n @property({ type: Number })\n public progress = 0;\n\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'white';\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n protected override render(): TemplateResult {\n return html`\n ${this.slotHasContent || this.label\n ? html`\n <sp-field-label size=${this.size} class=\"label\">\n ${this.slotHasContent ? html`` : this.label}\n\n <slot @slotchange=${this.handleSlotchange}></slot>\n </sp-field-label>\n `\n : html``}\n ${this.label\n ? html`\n ${this.indeterminate\n ? nothing\n : html`\n <sp-field-label\n size=${this.size}\n class=\"percentage\"\n >\n ${this.formatProgress()}\n </sp-field-label>\n `}\n `\n : nothing}\n <div class=\"track\">\n <div\n class=\"fill\"\n style=\"transform: scaleX(calc(${this.progress} / 100));\"\n ></div>\n </div>\n `;\n }\n\n protected handleSlotchange(): void {\n const labelFromSlot = getLabelFromSlot(this.label, this.slotEl);\n if (labelFromSlot) {\n this.label = labelFromSlot;\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'progressbar');\n }\n }\n\n private formatProgress(): string {\n return new Intl.NumberFormat(this.languageResolver.language, {\n style: 'percent',\n unitDisplay: 'narrow',\n }).format(this.progress / 100);\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('indeterminate')) {\n if (this.indeterminate) {\n this.removeAttribute('aria-valuemin');\n this.removeAttribute('aria-valuemax');\n this.removeAttribute('aria-valuenow');\n this.removeAttribute('aria-valuetext');\n } else {\n this.setAttribute('aria-valuemin', '0');\n this.setAttribute('aria-valuemax', '100');\n this.setAttribute('aria-valuenow', '' + this.progress);\n this.setAttribute('aria-valuetext', this.formatProgress());\n }\n }\n if (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n this.setAttribute('aria-valuetext', this.formatProgress());\n }\n if (!this.indeterminate && changes.has(languageResolverUpdatedSymbol)) {\n this.setAttribute('aria-valuetext', this.formatProgress());\n }\n if (changes.has('label')) {\n if (this.label.length) {\n this.setAttribute('aria-label', this.label);\n } else if (\n changes.get('label') === this.getAttribute('aria-label')\n ) {\n this.removeAttribute('aria-label');\n }\n }\n\n if (window.__swc?.DEBUG) {\n if (\n !this.label &&\n !this.getAttribute('aria-label') &&\n !this.getAttribute('aria-labelledby') &&\n !this.slotHasContent\n ) {\n window.__swc.warn(\n this,\n '<sp-progress-bar> elements need one of the following to be accessible:',\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-bar/#accessibility',\n {\n type: 'accessibility',\n issues: [\n 'value supplied to the \"label\" attribute, which will be displayed visually as part of the element, or',\n 'text content supplied directly to the <sp-progress-circle> element, or',\n 'value supplied to the \"aria-label\" attribute, which will only be provided to screen readers, or',\n 'an element ID reference supplied to the \"aria-labelledby\" attribute, which will be provided by screen readers and will need to be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[]
7
7
  }
@@ -1,26 +1,26 @@
1
- "use strict";var b=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var t=(o,a,e,s)=>{for(var i=s>1?void 0:s?d(a,e):a,n=o.length-1,p;n>=0;n--)(p=o[n])&&(i=(s?p(a,e,i):p(i))||i);return s&&i&&b(a,e,i),i};import{html as l,nothing as u,SizedMixin as c,SpectrumElement as h}from"@spectrum-web-components/base";import{property as r,query as m}from"@spectrum-web-components/base/src/decorators.js";import{getLabelFromSlot as v}from"@spectrum-web-components/shared/src/get-label-from-slot.js";import{ObserveSlotText as f}from"@spectrum-web-components/shared/src/observe-slot-text.js";import{LanguageResolutionController as g}from"@spectrum-web-components/reactive-controllers/src/LanguageResolution.js";import"@spectrum-web-components/field-label/sp-field-label.js";import w from"./progress-bar.css.js";export class ProgressBar extends c(f(h,""),{noDefaultSize:!0}){constructor(){super(...arguments);this.indeterminate=!1;this.label="";this.languageResolver=new g(this);this._overBackground=!1;this.sideLabel=!1;this.progress=0}static get styles(){return[w]}get overBackground(){return this._overBackground?"over-background":""}set overBackground(e){e===!0&&(this.removeAttribute("over-background"),this.staticColor="white")}render(){return l`
2
- ${this.slotHasContent||this.label?l`
1
+ "use strict";var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var t=(o,l,e,s)=>{for(var i=s>1?void 0:s?d(l,e):l,n=o.length-1,u;n>=0;n--)(u=o[n])&&(i=(s?u(l,e,i):u(i))||i);return s&&i&&p(l,e,i),i};import{html as r,nothing as b,SizedMixin as h,SpectrumElement as c}from"@spectrum-web-components/base";import{property as a,query as m}from"@spectrum-web-components/base/src/decorators.js";import{getLabelFromSlot as v}from"@spectrum-web-components/shared/src/get-label-from-slot.js";import{ObserveSlotText as f}from"@spectrum-web-components/shared/src/observe-slot-text.js";import{LanguageResolutionController as g,languageResolverUpdatedSymbol as w}from"@spectrum-web-components/reactive-controllers/src/LanguageResolution.js";import"@spectrum-web-components/field-label/sp-field-label.js";import y from"./progress-bar.css.js";export class ProgressBar extends h(f(c,""),{noDefaultSize:!0}){constructor(){super(...arguments);this.indeterminate=!1;this.label="";this.languageResolver=new g(this);this._overBackground=!1;this.sideLabel=!1;this.progress=0}static get styles(){return[y]}get overBackground(){return this._overBackground?"over-background":""}set overBackground(e){e===!0&&(this.removeAttribute("over-background"),this.staticColor="white")}render(){return r`
2
+ ${this.slotHasContent||this.label?r`
3
3
  <sp-field-label size=${this.size} class="label">
4
- ${this.slotHasContent?l``:this.label}
4
+ ${this.slotHasContent?r``:this.label}
5
5
 
6
6
  <slot @slotchange=${this.handleSlotchange}></slot>
7
7
  </sp-field-label>
8
- `:l``}
9
- ${this.label?l`
10
- ${this.indeterminate?u:l`
8
+ `:r``}
9
+ ${this.label?r`
10
+ ${this.indeterminate?b:r`
11
11
  <sp-field-label
12
12
  size=${this.size}
13
13
  class="percentage"
14
14
  >
15
- ${new Intl.NumberFormat(this.languageResolver.language,{style:"percent",unitDisplay:"narrow"}).format(this.progress/100)}
15
+ ${this.formatProgress()}
16
16
  </sp-field-label>
17
17
  `}
18
- `:u}
18
+ `:b}
19
19
  <div class="track">
20
20
  <div
21
21
  class="fill"
22
22
  style="transform: scaleX(calc(${this.progress} / 100));"
23
23
  ></div>
24
24
  </div>
25
- `}handleSlotchange(){const e=v(this.label,this.slotEl);e&&(this.label=e)}firstUpdated(e){super.firstUpdated(e),this.hasAttribute("role")||this.setAttribute("role","progressbar")}updated(e){super.updated(e),e.has("indeterminate")&&(this.indeterminate?(this.removeAttribute("aria-valuemin"),this.removeAttribute("aria-valuemax"),this.removeAttribute("aria-valuenow")):(this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax","100"))),!this.indeterminate&&e.has("progress")&&this.setAttribute("aria-valuenow",""+this.progress),e.has("label")&&(this.label.length?this.setAttribute("aria-label",this.label):e.get("label")===this.getAttribute("aria-label")&&this.removeAttribute("aria-label"))}}t([r({type:Boolean,reflect:!0})],ProgressBar.prototype,"indeterminate",2),t([r({type:String,reflect:!0})],ProgressBar.prototype,"label",2),t([r({type:Boolean,attribute:"over-background"})],ProgressBar.prototype,"overBackground",1),t([r({type:Boolean,reflect:!0,attribute:"side-label"})],ProgressBar.prototype,"sideLabel",2),t([r({type:Number})],ProgressBar.prototype,"progress",2),t([r({reflect:!0,attribute:"static-color"})],ProgressBar.prototype,"staticColor",2),t([m("slot")],ProgressBar.prototype,"slotEl",2);
25
+ `}handleSlotchange(){const e=v(this.label,this.slotEl);e&&(this.label=e)}firstUpdated(e){super.firstUpdated(e),this.hasAttribute("role")||this.setAttribute("role","progressbar")}formatProgress(){return new Intl.NumberFormat(this.languageResolver.language,{style:"percent",unitDisplay:"narrow"}).format(this.progress/100)}updated(e){super.updated(e),e.has("indeterminate")&&(this.indeterminate?(this.removeAttribute("aria-valuemin"),this.removeAttribute("aria-valuemax"),this.removeAttribute("aria-valuenow"),this.removeAttribute("aria-valuetext")):(this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax","100"),this.setAttribute("aria-valuenow",""+this.progress),this.setAttribute("aria-valuetext",this.formatProgress()))),!this.indeterminate&&e.has("progress")&&(this.setAttribute("aria-valuenow",""+this.progress),this.setAttribute("aria-valuetext",this.formatProgress())),!this.indeterminate&&e.has(w)&&this.setAttribute("aria-valuetext",this.formatProgress()),e.has("label")&&(this.label.length?this.setAttribute("aria-label",this.label):e.get("label")===this.getAttribute("aria-label")&&this.removeAttribute("aria-label"))}}t([a({type:Boolean,reflect:!0})],ProgressBar.prototype,"indeterminate",2),t([a({type:String,reflect:!0})],ProgressBar.prototype,"label",2),t([a({type:Boolean,attribute:"over-background"})],ProgressBar.prototype,"overBackground",1),t([a({type:Boolean,reflect:!0,attribute:"side-label"})],ProgressBar.prototype,"sideLabel",2),t([a({type:Number})],ProgressBar.prototype,"progress",2),t([a({reflect:!0,attribute:"static-color"})],ProgressBar.prototype,"staticColor",2),t([m("slot")],ProgressBar.prototype,"slotEl",2);
26
26
  //# sourceMappingURL=ProgressBar.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["ProgressBar.ts"],
4
- "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\n\nimport { getLabelFromSlot } from '@spectrum-web-components/shared/src/get-label-from-slot.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport { LanguageResolutionController } from '@spectrum-web-components/reactive-controllers/src/LanguageResolution.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport styles from './progress-bar.css.js';\n\n/**\n * @element sp-progress-bar\n */\nexport class ProgressBar extends SizedMixin(\n ObserveSlotText(SpectrumElement, ''),\n {\n noDefaultSize: true,\n }\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String, reflect: true })\n public label = '';\n\n private languageResolver = new LanguageResolutionController(this);\n\n @property({ type: Boolean, attribute: 'over-background' })\n public get overBackground(): string {\n return this._overBackground ? 'over-background' : '';\n }\n public set overBackground(overBackground: boolean) {\n if (overBackground === true) {\n this.removeAttribute('over-background');\n this.staticColor = 'white';\n\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"over-background\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-bar/#variants',\n {\n level: 'deprecation',\n }\n );\n }\n }\n }\n private _overBackground: boolean = false;\n\n @property({ type: Boolean, reflect: true, attribute: 'side-label' })\n public sideLabel = false;\n\n @property({ type: Number })\n public progress = 0;\n\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'white';\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n protected override render(): TemplateResult {\n return html`\n ${this.slotHasContent || this.label\n ? html`\n <sp-field-label size=${this.size} class=\"label\">\n ${this.slotHasContent ? html`` : this.label}\n\n <slot @slotchange=${this.handleSlotchange}></slot>\n </sp-field-label>\n `\n : html``}\n ${this.label\n ? html`\n ${this.indeterminate\n ? nothing\n : html`\n <sp-field-label\n size=${this.size}\n class=\"percentage\"\n >\n ${new Intl.NumberFormat(\n this.languageResolver.language,\n {\n style: 'percent',\n unitDisplay: 'narrow',\n }\n ).format(this.progress / 100)}\n </sp-field-label>\n `}\n `\n : nothing}\n <div class=\"track\">\n <div\n class=\"fill\"\n style=\"transform: scaleX(calc(${this.progress} / 100));\"\n ></div>\n </div>\n `;\n }\n\n protected handleSlotchange(): void {\n const labelFromSlot = getLabelFromSlot(this.label, this.slotEl);\n if (labelFromSlot) {\n this.label = labelFromSlot;\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'progressbar');\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('indeterminate')) {\n if (this.indeterminate) {\n this.removeAttribute('aria-valuemin');\n this.removeAttribute('aria-valuemax');\n this.removeAttribute('aria-valuenow');\n } else {\n this.setAttribute('aria-valuemin', '0');\n this.setAttribute('aria-valuemax', '100');\n }\n }\n if (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n }\n if (changes.has('label')) {\n if (this.label.length) {\n this.setAttribute('aria-label', this.label);\n } else if (\n changes.get('label') === this.getAttribute('aria-label')\n ) {\n this.removeAttribute('aria-label');\n }\n }\n\n if (window.__swc?.DEBUG) {\n if (\n !this.label &&\n !this.getAttribute('aria-label') &&\n !this.getAttribute('aria-labelledby') &&\n !this.slotHasContent\n ) {\n window.__swc.warn(\n this,\n '<sp-progress-bar> elements need one of the following to be accessible:',\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-bar/#accessibility',\n {\n type: 'accessibility',\n issues: [\n 'value supplied to the \"label\" attribute, which will be displayed visually as part of the element, or',\n 'text content supplied directly to the <sp-progress-circle> element, or',\n 'value supplied to the \"aria-label\" attribute, which will only be provided to screen readers, or',\n 'an element ID reference supplied to the \"aria-labelledby\" attribute, which will be provided by screen readers and will need to be managed manually by the parent application.',\n ],\n }\n );\n }\n }\n }\n}\n"],
5
- "mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,EAEA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDAEP,OAAS,oBAAAC,MAAwB,6DACjC,OAAS,mBAAAC,MAAuB,2DAChC,OAAS,gCAAAC,MAAoC,0EAC7C,MAAO,yDACP,OAAOC,MAAY,wBAKZ,aAAM,oBAAoBP,EAC7BK,EAAgBJ,EAAiB,EAAE,EACnC,CACI,cAAe,EACnB,CACJ,CAAE,CALK,kCAWH,KAAO,cAAgB,GAGvB,KAAO,MAAQ,GAEf,KAAQ,iBAAmB,IAAIK,EAA6B,IAAI,EAuBhE,KAAQ,gBAA2B,GAGnC,KAAO,UAAY,GAGnB,KAAO,SAAW,EAvClB,WAA2B,QAAyB,CAChD,MAAO,CAACC,CAAM,CAClB,CAWA,IAAW,gBAAyB,CAChC,OAAO,KAAK,gBAAkB,kBAAoB,EACtD,CACA,IAAW,eAAeC,EAAyB,CAC3CA,IAAmB,KACnB,KAAK,gBAAgB,iBAAiB,EACtC,KAAK,YAAc,QAa3B,CAemB,QAAyB,CACxC,OAAOV;AAAA,cACD,KAAK,gBAAkB,KAAK,MACxBA;AAAA,6CAC2B,KAA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AGAS,EAAA,CADNT,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAbhC,YAcF,qBAKIS,EAAA,CADVT,EAAS,CAAE,KAAM,QAAS,UAAW,iBAAkB,CAAC,GAlBhD,YAmBE,8BAuBJS,EAAA,CADNT,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,YAAa,CAAC,GAzC1D,YA0CF,yBAGAS,EAAA,CADNT,EAAS,CAAE,KAAM,MAAO,CAAC,GA5CjB,YA6CF,wBAGAS,EAAA,CADNT,EAAS,CAAE,QAAS,GAAM,UAAW,cAAe,CAAC,GA/C7C,YAgDF,2BAGCS,EAAA,CADPR,EAAM,MAAM,GAlDJ,YAmDD",
6
- "names": ["html", "nothing", "SizedMixin", "SpectrumElement", "property", "query", "getLabelFromSlot", "ObserveSlotText", "LanguageResolutionController", "styles", "overBackground", "labelFromSlot", "changes", "__decorateClass"]
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\n\nimport { getLabelFromSlot } from '@spectrum-web-components/shared/src/get-label-from-slot.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport {\n LanguageResolutionController,\n languageResolverUpdatedSymbol,\n} from '@spectrum-web-components/reactive-controllers/src/LanguageResolution.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport styles from './progress-bar.css.js';\n\n/**\n * @element sp-progress-bar\n */\nexport class ProgressBar extends SizedMixin(\n ObserveSlotText(SpectrumElement, ''),\n {\n noDefaultSize: true,\n }\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String, reflect: true })\n public label = '';\n\n private languageResolver = new LanguageResolutionController(this);\n\n @property({ type: Boolean, attribute: 'over-background' })\n public get overBackground(): string {\n return this._overBackground ? 'over-background' : '';\n }\n public set overBackground(overBackground: boolean) {\n if (overBackground === true) {\n this.removeAttribute('over-background');\n this.staticColor = 'white';\n\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"over-background\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-bar/#variants',\n {\n level: 'deprecation',\n }\n );\n }\n }\n }\n private _overBackground: boolean = false;\n\n @property({ type: Boolean, reflect: true, attribute: 'side-label' })\n public sideLabel = false;\n\n @property({ type: Number })\n public progress = 0;\n\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'white';\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n protected override render(): TemplateResult {\n return html`\n ${this.slotHasContent || this.label\n ? html`\n <sp-field-label size=${this.size} class=\"label\">\n ${this.slotHasContent ? html`` : this.label}\n\n <slot @slotchange=${this.handleSlotchange}></slot>\n </sp-field-label>\n `\n : html``}\n ${this.label\n ? html`\n ${this.indeterminate\n ? nothing\n : html`\n <sp-field-label\n size=${this.size}\n class=\"percentage\"\n >\n ${this.formatProgress()}\n </sp-field-label>\n `}\n `\n : nothing}\n <div class=\"track\">\n <div\n class=\"fill\"\n style=\"transform: scaleX(calc(${this.progress} / 100));\"\n ></div>\n </div>\n `;\n }\n\n protected handleSlotchange(): void {\n const labelFromSlot = getLabelFromSlot(this.label, this.slotEl);\n if (labelFromSlot) {\n this.label = labelFromSlot;\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'progressbar');\n }\n }\n\n private formatProgress(): string {\n return new Intl.NumberFormat(this.languageResolver.language, {\n style: 'percent',\n unitDisplay: 'narrow',\n }).format(this.progress / 100);\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('indeterminate')) {\n if (this.indeterminate) {\n this.removeAttribute('aria-valuemin');\n this.removeAttribute('aria-valuemax');\n this.removeAttribute('aria-valuenow');\n this.removeAttribute('aria-valuetext');\n } else {\n this.setAttribute('aria-valuemin', '0');\n this.setAttribute('aria-valuemax', '100');\n this.setAttribute('aria-valuenow', '' + this.progress);\n this.setAttribute('aria-valuetext', this.formatProgress());\n }\n }\n if (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n this.setAttribute('aria-valuetext', this.formatProgress());\n }\n if (!this.indeterminate && changes.has(languageResolverUpdatedSymbol)) {\n this.setAttribute('aria-valuetext', this.formatProgress());\n }\n if (changes.has('label')) {\n if (this.label.length) {\n this.setAttribute('aria-label', this.label);\n } else if (\n changes.get('label') === this.getAttribute('aria-label')\n ) {\n this.removeAttribute('aria-label');\n }\n }\n\n if (window.__swc?.DEBUG) {\n if (\n !this.label &&\n !this.getAttribute('aria-label') &&\n !this.getAttribute('aria-labelledby') &&\n !this.slotHasContent\n ) {\n window.__swc.warn(\n this,\n '<sp-progress-bar> elements need one of the following to be accessible:',\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-bar/#accessibility',\n {\n type: 'accessibility',\n issues: [\n 'value supplied to the \"label\" attribute, which will be displayed visually as part of the element, or',\n 'text content supplied directly to the <sp-progress-circle> element, or',\n 'value supplied to the \"aria-label\" attribute, which will only be provided to screen readers, or',\n 'an element ID reference supplied to the \"aria-labelledby\" attribute, which will be provided by screen readers and will need to be managed manually by the parent application.',\n ],\n }\n );\n }\n }\n }\n}\n"],
5
+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BAuBJU,EAAA,CADNV,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,YAAa,CAAC,GAzC1D,YA0CF,yBAGAU,EAAA,CADNV,EAAS,CAAE,KAAM,MAAO,CAAC,GA5CjB,YA6CF,wBAGAU,EAAA,CADNV,EAAS,CAAE,QAAS,GAAM,UAAW,cAAe,CAAC,GA/C7C,YAgDF,2BAGCU,EAAA,CADPT,EAAM,MAAM,GAlDJ,YAmDD",
6
+ "names": ["html", "nothing", "SizedMixin", "SpectrumElement", "property", "query", "getLabelFromSlot", "ObserveSlotText", "LanguageResolutionController", "languageResolverUpdatedSymbol", "styles", "overBackground", "labelFromSlot", "changes", "__decorateClass"]
7
7
  }
@@ -1,2 +1,2 @@
1
- declare const styles: import("@spectrum-web-components/base").CSSResult;
1
+ declare const styles: import("lit").CSSResult;
2
2
  export default styles;
@@ -1,2 +1,2 @@
1
- declare const styles: import("@spectrum-web-components/base").CSSResult;
1
+ declare const styles: import("lit").CSSResult;
2
2
  export default styles;
@@ -1,2 +1,2 @@
1
- declare const styles: import("@spectrum-web-components/base").CSSResult;
1
+ declare const styles: import("lit").CSSResult;
2
2
  export default styles;