@spectrum-web-components/progress-circle 0.41.2 → 0.42.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/progress-circle",
3
- "version": "0.41.2",
3
+ "version": "0.42.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -57,11 +57,11 @@
57
57
  "lit-html"
58
58
  ],
59
59
  "dependencies": {
60
- "@spectrum-web-components/base": "^0.41.2",
61
- "@spectrum-web-components/shared": "^0.41.2"
60
+ "@spectrum-web-components/base": "^0.42.1",
61
+ "@spectrum-web-components/shared": "^0.42.1"
62
62
  },
63
63
  "devDependencies": {
64
- "@spectrum-css/progresscircle": "^2.2.1"
64
+ "@spectrum-css/progresscircle": "^2.2.3"
65
65
  },
66
66
  "types": "./src/index.d.ts",
67
67
  "customElements": "custom-elements.json",
@@ -69,5 +69,5 @@
69
69
  "./sp-*.js",
70
70
  "./**/*.dev.js"
71
71
  ],
72
- "gitHead": "78c3f16b08c9133c9e5ca88d0c9fef5ea7d2ab87"
72
+ "gitHead": "c7ab5516e86d20194e92114afd04affa490b7248"
73
73
  }
@@ -102,7 +102,7 @@ export class ProgressCircle extends SizedMixin(SpectrumElement, {
102
102
  if (changes.has("label")) {
103
103
  if (this.label.length) {
104
104
  this.setAttribute("aria-label", this.label);
105
- } else {
105
+ } else if (changes.get("label") === this.getAttribute("aria-label")) {
106
106
  this.removeAttribute("aria-label");
107
107
  }
108
108
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["ProgressCircle.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\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';\nimport { getLabelFromSlot } from '@spectrum-web-components/shared/src/get-label-from-slot.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport progressCircleStyles from './progress-circle.css.js';\n\n/**\n * @element sp-progress-circle\n */\nexport class ProgressCircle extends SizedMixin(SpectrumElement, {\n validSizes: ['s', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [progressCircleStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String })\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'over-background' })\n public overBackground = false;\n\n @property({ reflect: true })\n public static?: 'white';\n\n @property({ type: Number })\n public progress = 0;\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n private makeRotation(rotation: number): string | undefined {\n return this.indeterminate\n ? undefined\n : `transform: rotate(${rotation}deg);`;\n }\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n if (changes.has('overBackground')) {\n // Apply \"static\" from \"overBackground\", preferring \"static\",\n // until the deprecation period is over.\n this.static = this.overBackground\n ? 'white'\n : this.static || undefined;\n if (window.__swc.DEBUG) {\n if (this.overBackground) {\n window.__swc.warn(\n this,\n `<${this.localName}> element will stop accepting the \"over-background\" attribute, and its related \"overBackground\" property in a future release. Use the \"static\" attribute/property with a value of \"white\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#static',\n { level: 'deprecation' }\n );\n }\n }\n }\n }\n\n protected override render(): TemplateResult {\n const styles = [\n this.makeRotation(-180 + (180 / 50) * Math.min(this.progress, 50)),\n this.makeRotation(\n -180 + (180 / 50) * Math.max(this.progress - 50, 0)\n ),\n ];\n const masks = ['Mask1', 'Mask2'];\n return html`\n <slot @slotchange=${this.handleSlotchange}></slot>\n <div class=\"track\"></div>\n <div class=\"fills\">\n ${masks.map(\n (mask, index) => html`\n <div class=\"fill${mask}\">\n <div\n class=\"fillSub${mask}\"\n style=${ifDefined(styles[index])}\n >\n <div class=\"fill\"></div>\n </div>\n </div>\n `\n )}\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 (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n } else if (this.hasAttribute('aria-valuenow')) {\n this.removeAttribute('aria-valuenow');\n }\n if (changes.has('label')) {\n if (this.label.length) {\n this.setAttribute('aria-label', this.label);\n } else {\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.slotEl.assignedNodes().length\n ) {\n window.__swc.warn(\n this,\n '<sp-progress-circle> elements need one of the following to be accessible:',\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#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,EAEA;AAAA,EACA;AA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A,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAVjB,eAWF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,kBAAkB,CAAC;AAAA,GAb/D,eAcF;AAGA;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAhBlB,eAiBF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAnBjB,eAoBF;AAGC;AAAA,EADP,MAAM,MAAM;AAAA,GAtBJ,eAuBD;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\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';\nimport { getLabelFromSlot } from '@spectrum-web-components/shared/src/get-label-from-slot.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport progressCircleStyles from './progress-circle.css.js';\n\n/**\n * @element sp-progress-circle\n */\nexport class ProgressCircle extends SizedMixin(SpectrumElement, {\n validSizes: ['s', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [progressCircleStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String })\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'over-background' })\n public overBackground = false;\n\n @property({ reflect: true })\n public static?: 'white';\n\n @property({ type: Number })\n public progress = 0;\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n private makeRotation(rotation: number): string | undefined {\n return this.indeterminate\n ? undefined\n : `transform: rotate(${rotation}deg);`;\n }\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n if (changes.has('overBackground')) {\n // Apply \"static\" from \"overBackground\", preferring \"static\",\n // until the deprecation period is over.\n this.static = this.overBackground\n ? 'white'\n : this.static || undefined;\n if (window.__swc.DEBUG) {\n if (this.overBackground) {\n window.__swc.warn(\n this,\n `<${this.localName}> element will stop accepting the \"over-background\" attribute, and its related \"overBackground\" property in a future release. Use the \"static\" attribute/property with a value of \"white\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#static',\n { level: 'deprecation' }\n );\n }\n }\n }\n }\n\n protected override render(): TemplateResult {\n const styles = [\n this.makeRotation(-180 + (180 / 50) * Math.min(this.progress, 50)),\n this.makeRotation(\n -180 + (180 / 50) * Math.max(this.progress - 50, 0)\n ),\n ];\n const masks = ['Mask1', 'Mask2'];\n return html`\n <slot @slotchange=${this.handleSlotchange}></slot>\n <div class=\"track\"></div>\n <div class=\"fills\">\n ${masks.map(\n (mask, index) => html`\n <div class=\"fill${mask}\">\n <div\n class=\"fillSub${mask}\"\n style=${ifDefined(styles[index])}\n >\n <div class=\"fill\"></div>\n </div>\n </div>\n `\n )}\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 (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n } else if (this.hasAttribute('aria-valuenow')) {\n this.removeAttribute('aria-valuenow');\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.slotEl.assignedNodes().length\n ) {\n window.__swc.warn(\n this,\n '<sp-progress-circle> elements need one of the following to be accessible:',\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#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,EAEA;AAAA,EACA;AAAA,OAEG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAE1B,OAAO,0BAA0B;AAK1B,aAAM,uBAAuB,WAAW,iBAAiB;AAAA,EAC5D,YAAY,CAAC,KAAK,KAAK,GAAG;AAC9B,CAAC,EAAE;AAAA,EAFI;AAAA;AAQH,SAAO,gBAAgB;AAGvB,SAAO,QAAQ;AAGf,SAAO,iBAAiB;AAMxB,SAAO,WAAW;AAAA;AAAA,EAjBlB,WAA2B,SAAyB;AAChD,WAAO,CAAC,oBAAoB;AAAA,EAChC;AAAA,EAoBQ,aAAa,UAAsC;AACvD,WAAO,KAAK,gBACN,SACA,qBAAqB,QAAQ;AAAA,EACvC;AAAA,EAEmB,WAAW,SAAqC;AAC/D,QAAI,QAAQ,IAAI,gBAAgB,GAAG;AAG/B,WAAK,SAAS,KAAK,iBACb,UACA,KAAK,UAAU;AACrB,UAAI,MAAoB;AACpB,YAAI,KAAK,gBAAgB;AACrB,iBAAO,MAAM;AAAA,YACT;AAAA,YACA,IAAI,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;AACnB,aAAK,aAAa,cAAc,KAAK,KAAK;AAAA,MAC9C,WACI,QAAQ,IAAI,OAAO,MAAM,KAAK,aAAa,YAAY,GACzD;AACE,aAAK,gBAAgB,YAAY;AAAA,MACrC;AAAA,IACJ;AAEA,QAAI,MAAoB;AACpB,UACI,CAAC,KAAK,SACN,CAAC,KAAK,aAAa,YAAY,KAC/B,CAAC,KAAK,aAAa,iBAAiB,KACpC,CAAC,KAAK,OAAO,cAAc,EAAE,QAC/B;AACE,eAAO,MAAM;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,YACI,MAAM;AAAA,YACN,QAAQ;AAAA,cACJ;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YACJ;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;AA9HW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAPjC,eAQF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAVjB,eAWF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,kBAAkB,CAAC;AAAA,GAb/D,eAcF;AAGA;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAhBlB,eAiBF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAnBjB,eAoBF;AAGC;AAAA,EADP,MAAM,MAAM;AAAA,GAtBJ,eAuBD;",
6
6
  "names": []
7
7
  }
@@ -13,5 +13,5 @@
13
13
  </div>
14
14
  `)}
15
15
  </div>
16
- `}handleSlotchange(){const e=m(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),!this.indeterminate&&e.has("progress")?this.setAttribute("aria-valuenow",""+this.progress):this.hasAttribute("aria-valuenow")&&this.removeAttribute("aria-valuenow"),e.has("label")&&(this.label.length?this.setAttribute("aria-label",this.label):this.removeAttribute("aria-label"))}}i([a({type:Boolean,reflect:!0})],ProgressCircle.prototype,"indeterminate",2),i([a({type:String})],ProgressCircle.prototype,"label",2),i([a({type:Boolean,reflect:!0,attribute:"over-background"})],ProgressCircle.prototype,"overBackground",2),i([a({reflect:!0})],ProgressCircle.prototype,"static",2),i([a({type:Number})],ProgressCircle.prototype,"progress",2),i([b("slot")],ProgressCircle.prototype,"slotEl",2);
16
+ `}handleSlotchange(){const e=m(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),!this.indeterminate&&e.has("progress")?this.setAttribute("aria-valuenow",""+this.progress):this.hasAttribute("aria-valuenow")&&this.removeAttribute("aria-valuenow"),e.has("label")&&(this.label.length?this.setAttribute("aria-label",this.label):e.get("label")===this.getAttribute("aria-label")&&this.removeAttribute("aria-label"))}}i([a({type:Boolean,reflect:!0})],ProgressCircle.prototype,"indeterminate",2),i([a({type:String})],ProgressCircle.prototype,"label",2),i([a({type:Boolean,reflect:!0,attribute:"over-background"})],ProgressCircle.prototype,"overBackground",2),i([a({reflect:!0})],ProgressCircle.prototype,"static",2),i([a({type:Number})],ProgressCircle.prototype,"progress",2),i([b("slot")],ProgressCircle.prototype,"slotEl",2);
17
17
  //# sourceMappingURL=ProgressCircle.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["ProgressCircle.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\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';\nimport { getLabelFromSlot } from '@spectrum-web-components/shared/src/get-label-from-slot.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport progressCircleStyles from './progress-circle.css.js';\n\n/**\n * @element sp-progress-circle\n */\nexport class ProgressCircle extends SizedMixin(SpectrumElement, {\n validSizes: ['s', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [progressCircleStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String })\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'over-background' })\n public overBackground = false;\n\n @property({ reflect: true })\n public static?: 'white';\n\n @property({ type: Number })\n public progress = 0;\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n private makeRotation(rotation: number): string | undefined {\n return this.indeterminate\n ? undefined\n : `transform: rotate(${rotation}deg);`;\n }\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n if (changes.has('overBackground')) {\n // Apply \"static\" from \"overBackground\", preferring \"static\",\n // until the deprecation period is over.\n this.static = this.overBackground\n ? 'white'\n : this.static || undefined;\n if (window.__swc.DEBUG) {\n if (this.overBackground) {\n window.__swc.warn(\n this,\n `<${this.localName}> element will stop accepting the \"over-background\" attribute, and its related \"overBackground\" property in a future release. Use the \"static\" attribute/property with a value of \"white\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#static',\n { level: 'deprecation' }\n );\n }\n }\n }\n }\n\n protected override render(): TemplateResult {\n const styles = [\n this.makeRotation(-180 + (180 / 50) * Math.min(this.progress, 50)),\n this.makeRotation(\n -180 + (180 / 50) * Math.max(this.progress - 50, 0)\n ),\n ];\n const masks = ['Mask1', 'Mask2'];\n return html`\n <slot @slotchange=${this.handleSlotchange}></slot>\n <div class=\"track\"></div>\n <div class=\"fills\">\n ${masks.map(\n (mask, index) => html`\n <div class=\"fill${mask}\">\n <div\n class=\"fillSub${mask}\"\n style=${ifDefined(styles[index])}\n >\n <div class=\"fill\"></div>\n </div>\n </div>\n `\n )}\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 (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n } else if (this.hasAttribute('aria-valuenow')) {\n this.removeAttribute('aria-valuenow');\n }\n if (changes.has('label')) {\n if (this.label.length) {\n this.setAttribute('aria-label', this.label);\n } else {\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.slotEl.assignedNodes().length\n ) {\n window.__swc.warn(\n this,\n '<sp-progress-circle> elements need one of the following to be accessible:',\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#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,EAEA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,oBAAAC,MAAwB,6DACjC,OAAS,aAAAC,MAAiB,kDAE1B,O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AAK,QAAQ,EAC9C,KAAK,aAAa,eAAe,GACxC,KAAK,gBAAgB,eAAe,EAEpCA,EAAQ,IAAI,OAAO,IACf,KAAK,MAAM,OACX,KAAK,aAAa,aAAc,KAAK,KAAK,EAE1C,KAAK,gBAAgB,YAAY,EA2B7C,CACJ,CA5HWM,EAAA,CADNZ,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAPjC,eAQF,6BAGAY,EAAA,CADNZ,EAAS,CAAE,KAAM,MAAO,CAAC,GAVjB,eAWF,qBAGAY,EAAA,CADNZ,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,iBAAkB,CAAC,GAb/D,eAcF,8BAGAY,EAAA,CADNZ,EAAS,CAAE,QAAS,EAAK,CAAC,GAhBlB,eAiBF,sBAGAY,EAAA,CADNZ,EAAS,CAAE,KAAM,MAAO,CAAC,GAnBjB,eAoBF,wBAGCY,EAAA,CADPX,EAAM,MAAM,GAtBJ,eAuBD",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\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';\nimport { getLabelFromSlot } from '@spectrum-web-components/shared/src/get-label-from-slot.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport progressCircleStyles from './progress-circle.css.js';\n\n/**\n * @element sp-progress-circle\n */\nexport class ProgressCircle extends SizedMixin(SpectrumElement, {\n validSizes: ['s', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [progressCircleStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n @property({ type: String })\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'over-background' })\n public overBackground = false;\n\n @property({ reflect: true })\n public static?: 'white';\n\n @property({ type: Number })\n public progress = 0;\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n private makeRotation(rotation: number): string | undefined {\n return this.indeterminate\n ? undefined\n : `transform: rotate(${rotation}deg);`;\n }\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n if (changes.has('overBackground')) {\n // Apply \"static\" from \"overBackground\", preferring \"static\",\n // until the deprecation period is over.\n this.static = this.overBackground\n ? 'white'\n : this.static || undefined;\n if (window.__swc.DEBUG) {\n if (this.overBackground) {\n window.__swc.warn(\n this,\n `<${this.localName}> element will stop accepting the \"over-background\" attribute, and its related \"overBackground\" property in a future release. Use the \"static\" attribute/property with a value of \"white\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#static',\n { level: 'deprecation' }\n );\n }\n }\n }\n }\n\n protected override render(): TemplateResult {\n const styles = [\n this.makeRotation(-180 + (180 / 50) * Math.min(this.progress, 50)),\n this.makeRotation(\n -180 + (180 / 50) * Math.max(this.progress - 50, 0)\n ),\n ];\n const masks = ['Mask1', 'Mask2'];\n return html`\n <slot @slotchange=${this.handleSlotchange}></slot>\n <div class=\"track\"></div>\n <div class=\"fills\">\n ${masks.map(\n (mask, index) => html`\n <div class=\"fill${mask}\">\n <div\n class=\"fillSub${mask}\"\n style=${ifDefined(styles[index])}\n >\n <div class=\"fill\"></div>\n </div>\n </div>\n `\n )}\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 (!this.indeterminate && changes.has('progress')) {\n this.setAttribute('aria-valuenow', '' + this.progress);\n } else if (this.hasAttribute('aria-valuenow')) {\n this.removeAttribute('aria-valuenow');\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.slotEl.assignedNodes().length\n ) {\n window.__swc.warn(\n this,\n '<sp-progress-circle> elements need one of the following to be accessible:',\n 'https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#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,EAEA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,oBAAAC,MAAwB,6DACjC,OAAS,aAAAC,MAAiB,kDAE1B,OAAOC,MAA0B,2BAK1B,aAAM,uBAAuBN,EAAWC,EAAiB,CAC5D,WAAY,CAAC,IAAK,IAAK,GAAG,CAC9B,CAAC,CAAE,CAFI,kCAQH,KAAO,cAAgB,GAGvB,KAAO,MAAQ,GAGf,KAAO,eAAiB,GAMxB,KAAO,SAAW,EAjBlB,WAA2B,QAAyB,CAChD,MAAO,CAACK,CAAoB,CAChC,CAoBQ,aAAaC,EAAsC,CACvD,OAAO,KAAK,cACN,OACA,qBAAqBA,CAAQ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,6BAGAY,EAAA,CADNZ,EAAS,CAAE,KAAM,MAAO,CAAC,GAVjB,eAWF,qBAGAY,EAAA,CADNZ,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,iBAAkB,CAAC,GAb/D,eAcF,8BAGAY,EAAA,CADNZ,EAAS,CAAE,QAAS,EAAK,CAAC,GAhBlB,eAiBF,sBAGAY,EAAA,CADNZ,EAAS,CAAE,KAAM,MAAO,CAAC,GAnBjB,eAoBF,wBAGCY,EAAA,CADPX,EAAM,MAAM,GAtBJ,eAuBD",
6
6
  "names": ["html", "SizedMixin", "SpectrumElement", "property", "query", "getLabelFromSlot", "ifDefined", "progressCircleStyles", "rotation", "changes", "styles", "masks", "mask", "index", "labelFromSlot", "__decorateClass"]
7
7
  }
@@ -82,5 +82,32 @@ describe("ProgressCircle", () => {
82
82
  });
83
83
  consoleWarnStub.restore();
84
84
  });
85
+ it("accepts `aria-label`", async () => {
86
+ const el = await fixture(html`
87
+ <sp-progress-circle aria-label="Loading"></sp-progress-circle>
88
+ `);
89
+ await elementUpdated(el);
90
+ expect(el.hasAttribute("aria-label")).to.be.true;
91
+ expect(el.getAttribute("aria-label")).to.equal("Loading");
92
+ });
93
+ it("sets `aria-label` to equal `label` if `label` is set", async () => {
94
+ const el = await fixture(html`
95
+ <sp-progress-circle label="Loading"></sp-progress-circle>
96
+ `);
97
+ await elementUpdated(el);
98
+ expect(el.hasAttribute("aria-label")).to.be.true;
99
+ expect(el.getAttribute("aria-label")).to.equal("Loading");
100
+ });
101
+ it("does not remove `aria-label` if set independently of `label`", async () => {
102
+ const el = await fixture(html`
103
+ <sp-progress-circle
104
+ label=""
105
+ aria-label="Loading"
106
+ ></sp-progress-circle>
107
+ `);
108
+ await elementUpdated(el);
109
+ expect(el.hasAttribute("aria-label")).to.be.true;
110
+ expect(el.getAttribute("aria-label")).to.equal("Loading");
111
+ });
85
112
  });
86
113
  //# sourceMappingURL=progress-circle.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["progress-circle.test.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nimport '@spectrum-web-components/progress-circle/sp-progress-circle.js';\nimport { ProgressCircle } from '@spectrum-web-components/progress-circle';\nimport { stub } from 'sinon';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('ProgressCircle', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<ProgressCircle>(html`\n <sp-progress-circle label=\"Loading\"></sp-progress-circle>\n `)\n );\n it('loads', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle label=\"Loading\"></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('loads - [indeterminate]', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle\n indeterminate\n label=\"Loading\"\n ></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('accepts label from `slot`', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle role=\"progressbar\">\n Label From Slot\n </sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(el.getAttribute('aria-label')).to.equal('Label From Slot');\n });\n it('accepts user `role`', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle\n role=\"progressbar\"\n label=\"With user role\"\n ></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(el.getAttribute('role')).to.equal('progressbar');\n });\n it('returns to indeterminate', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle\n progress=\"50\"\n label=\"Will be indeterminate\"\n ></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(el.hasAttribute('aria-valuenow')).to.be.true;\n expect(el.getAttribute('aria-valuenow')).to.equal('50');\n\n el.indeterminate = true;\n\n await elementUpdated(el);\n\n expect(el.hasAttribute('aria-valuenow')).to.be.false;\n });\n it('warns in Dev Mode when accessible attributes are not leveraged', async () => {\n const consoleWarnStub = stub(console, 'warn');\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle progress=\"50\"></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(consoleWarnStub.called).to.be.true;\n const spyCall = consoleWarnStub.getCall(0);\n expect(\n spyCall.args.at(0).includes('accessible'),\n 'confirm accessibility-centric message'\n ).to.be.true;\n expect(spyCall.args.at(-1), 'confirm `data` shape').to.deep.equal({\n data: {\n localName: 'sp-progress-circle',\n type: 'accessibility',\n level: 'default',\n },\n });\n consoleWarnStub.restore();\n });\n});\n"],
5
- "mappings": ";AAYA,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AAEtD,OAAO;AAEP,SAAS,YAAY;AACrB,SAAS,6BAA6B;AAEtC,SAAS,kBAAkB,MAAM;AAC7B;AAAA,IACI,YACI,MAAM,QAAwB;AAAA;AAAA,aAE7B;AAAA,EACT;AACA,KAAG,SAAS,YAAY;AACpB,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA,SAExC;AAED,UAAM,eAAe,EAAE;AACvB,WAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AAErB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,2BAA2B,YAAY;AACtC,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA;AAAA;AAAA;AAAA,SAKxC;AAED,UAAM,eAAe,EAAE;AACvB,WAAO,EAAE,EAA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AAA,MAC9D,MAAM;AAAA,QACF,WAAW;AAAA,QACX,MAAM;AAAA,QACN,OAAO;AAAA,MACX;AAAA,IACJ,CAAC;AACD,oBAAgB,QAAQ;AAAA,EAC5B,CAAC;AACL,CAAC;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nimport '@spectrum-web-components/progress-circle/sp-progress-circle.js';\nimport { ProgressCircle } from '@spectrum-web-components/progress-circle';\nimport { stub } from 'sinon';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('ProgressCircle', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<ProgressCircle>(html`\n <sp-progress-circle label=\"Loading\"></sp-progress-circle>\n `)\n );\n it('loads', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle label=\"Loading\"></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('loads - [indeterminate]', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle\n indeterminate\n label=\"Loading\"\n ></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('accepts label from `slot`', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle role=\"progressbar\">\n Label From Slot\n </sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(el.getAttribute('aria-label')).to.equal('Label From Slot');\n });\n it('accepts user `role`', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle\n role=\"progressbar\"\n label=\"With user role\"\n ></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(el.getAttribute('role')).to.equal('progressbar');\n });\n it('returns to indeterminate', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle\n progress=\"50\"\n label=\"Will be indeterminate\"\n ></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(el.hasAttribute('aria-valuenow')).to.be.true;\n expect(el.getAttribute('aria-valuenow')).to.equal('50');\n\n el.indeterminate = true;\n\n await elementUpdated(el);\n\n expect(el.hasAttribute('aria-valuenow')).to.be.false;\n });\n it('warns in Dev Mode when accessible attributes are not leveraged', async () => {\n const consoleWarnStub = stub(console, 'warn');\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle progress=\"50\"></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(consoleWarnStub.called).to.be.true;\n const spyCall = consoleWarnStub.getCall(0);\n expect(\n spyCall.args.at(0).includes('accessible'),\n 'confirm accessibility-centric message'\n ).to.be.true;\n expect(spyCall.args.at(-1), 'confirm `data` shape').to.deep.equal({\n data: {\n localName: 'sp-progress-circle',\n type: 'accessibility',\n level: 'default',\n },\n });\n consoleWarnStub.restore();\n });\n it('accepts `aria-label`', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle aria-label=\"Loading\"></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(el.hasAttribute('aria-label')).to.be.true;\n expect(el.getAttribute('aria-label')).to.equal('Loading');\n });\n it('sets `aria-label` to equal `label` if `label` is set', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle label=\"Loading\"></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(el.hasAttribute('aria-label')).to.be.true;\n expect(el.getAttribute('aria-label')).to.equal('Loading');\n });\n it('does not remove `aria-label` if set independently of `label`', async () => {\n const el = await fixture<ProgressCircle>(html`\n <sp-progress-circle\n label=\"\"\n aria-label=\"Loading\"\n ></sp-progress-circle>\n `);\n\n await elementUpdated(el);\n\n expect(el.hasAttribute('aria-label')).to.be.true;\n expect(el.getAttribute('aria-label')).to.equal('Loading');\n });\n});\n"],
5
+ "mappings": ";AAYA,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AAEtD,OAAO;AAEP,SAAS,YAAY;AACrB,SAAS,6BAA6B;AAEtC,SAAS,kBAAkB,MAAM;AAC7B;AAAA,IACI,YACI,MAAM,QAAwB;AAAA;AAAA,aAE7B;AAAA,EACT;AACA,KAAG,SAAS,YAAY;AACpB,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA,SAExC;AAED,UAAM,eAAe,EAAE;AACvB,WAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AAErB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,2BAA2B,YAAY;AACtC,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA;AAAA;AAAA;AAAA,SAKxC;AAED,UAAM,eAAe,EAAE;AACvB,WAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AAErB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,6BAA6B,YAAY;AACxC,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA;AAAA;AAAA,SAIxC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,aAAa,YAAY,CAAC,EAAE,GAAG,MAAM,iBAAiB;AAAA,EACpE,CAAC;AACD,KAAG,uBAAuB,YAAY;AAClC,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA;AAAA;AAAA;AAAA,SAKxC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,aAAa,MAAM,CAAC,EAAE,GAAG,MAAM,aAAa;AAAA,EAC1D,CAAC;AACD,KAAG,4BAA4B,YAAY;AACvC,UAAM,KAAK,MAAM,QAAwB;AAAA;AAAA;AAAA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