@spectrum-web-components/progress-bar 1.11.0-preview-eac97a2a.20251202192923 → 1.11.0-snapshot-test.20260127090232
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/custom-elements.json +203 -0
- package/package.json +5 -5
- package/src/ProgressBar.dev.js.map +2 -2
- package/src/ProgressBar.js.map +1 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "sp-progress-bar.js",
|
|
8
|
+
"declarations": [],
|
|
9
|
+
"exports": [
|
|
10
|
+
{
|
|
11
|
+
"kind": "custom-element-definition",
|
|
12
|
+
"name": "sp-progress-bar",
|
|
13
|
+
"declaration": {
|
|
14
|
+
"name": "ProgressBar",
|
|
15
|
+
"module": "/src/ProgressBar.js"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "javascript-module",
|
|
22
|
+
"path": "src/ProgressBar.js",
|
|
23
|
+
"declarations": [
|
|
24
|
+
{
|
|
25
|
+
"kind": "class",
|
|
26
|
+
"description": "",
|
|
27
|
+
"name": "ProgressBar",
|
|
28
|
+
"members": [
|
|
29
|
+
{
|
|
30
|
+
"kind": "field",
|
|
31
|
+
"name": "indeterminate",
|
|
32
|
+
"type": {
|
|
33
|
+
"text": "boolean"
|
|
34
|
+
},
|
|
35
|
+
"privacy": "public",
|
|
36
|
+
"default": "false",
|
|
37
|
+
"attribute": "indeterminate",
|
|
38
|
+
"reflects": true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"kind": "field",
|
|
42
|
+
"name": "label",
|
|
43
|
+
"type": {
|
|
44
|
+
"text": "string"
|
|
45
|
+
},
|
|
46
|
+
"privacy": "public",
|
|
47
|
+
"default": "''",
|
|
48
|
+
"attribute": "label",
|
|
49
|
+
"reflects": true
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"kind": "field",
|
|
53
|
+
"name": "languageResolver",
|
|
54
|
+
"privacy": "private",
|
|
55
|
+
"default": "new LanguageResolutionController(this)"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"kind": "field",
|
|
59
|
+
"name": "overBackground",
|
|
60
|
+
"type": {
|
|
61
|
+
"text": "string"
|
|
62
|
+
},
|
|
63
|
+
"privacy": "public",
|
|
64
|
+
"attribute": "over-background"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"kind": "field",
|
|
68
|
+
"name": "_overBackground",
|
|
69
|
+
"type": {
|
|
70
|
+
"text": "boolean"
|
|
71
|
+
},
|
|
72
|
+
"privacy": "private",
|
|
73
|
+
"default": "false"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"kind": "field",
|
|
77
|
+
"name": "sideLabel",
|
|
78
|
+
"type": {
|
|
79
|
+
"text": "boolean"
|
|
80
|
+
},
|
|
81
|
+
"privacy": "public",
|
|
82
|
+
"default": "false",
|
|
83
|
+
"attribute": "side-label",
|
|
84
|
+
"reflects": true
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"kind": "field",
|
|
88
|
+
"name": "progress",
|
|
89
|
+
"type": {
|
|
90
|
+
"text": "number"
|
|
91
|
+
},
|
|
92
|
+
"privacy": "public",
|
|
93
|
+
"default": "0",
|
|
94
|
+
"attribute": "progress"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"kind": "field",
|
|
98
|
+
"name": "staticColor",
|
|
99
|
+
"type": {
|
|
100
|
+
"text": "'white' | undefined"
|
|
101
|
+
},
|
|
102
|
+
"privacy": "public",
|
|
103
|
+
"attribute": "static-color",
|
|
104
|
+
"reflects": true
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"kind": "field",
|
|
108
|
+
"name": "slotEl",
|
|
109
|
+
"type": {
|
|
110
|
+
"text": "HTMLSlotElement"
|
|
111
|
+
},
|
|
112
|
+
"privacy": "private"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"kind": "method",
|
|
116
|
+
"name": "handleSlotchange",
|
|
117
|
+
"privacy": "protected",
|
|
118
|
+
"return": {
|
|
119
|
+
"type": {
|
|
120
|
+
"text": "void"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"attributes": [
|
|
126
|
+
{
|
|
127
|
+
"name": "indeterminate",
|
|
128
|
+
"type": {
|
|
129
|
+
"text": "boolean"
|
|
130
|
+
},
|
|
131
|
+
"default": "false",
|
|
132
|
+
"fieldName": "indeterminate"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "label",
|
|
136
|
+
"type": {
|
|
137
|
+
"text": "string"
|
|
138
|
+
},
|
|
139
|
+
"default": "''",
|
|
140
|
+
"fieldName": "label"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "over-background",
|
|
144
|
+
"type": {
|
|
145
|
+
"text": "string"
|
|
146
|
+
},
|
|
147
|
+
"fieldName": "overBackground"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "side-label",
|
|
151
|
+
"type": {
|
|
152
|
+
"text": "boolean"
|
|
153
|
+
},
|
|
154
|
+
"default": "false",
|
|
155
|
+
"fieldName": "sideLabel"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"name": "progress",
|
|
159
|
+
"type": {
|
|
160
|
+
"text": "number"
|
|
161
|
+
},
|
|
162
|
+
"default": "0",
|
|
163
|
+
"fieldName": "progress"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "static-color",
|
|
167
|
+
"type": {
|
|
168
|
+
"text": "'white' | undefined"
|
|
169
|
+
},
|
|
170
|
+
"fieldName": "staticColor"
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
"mixins": [
|
|
174
|
+
{
|
|
175
|
+
"name": "SizedMixin",
|
|
176
|
+
"package": "@spectrum-web-components/base"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"name": "ObserveSlotText",
|
|
180
|
+
"package": "@spectrum-web-components/shared/src/observe-slot-text.js"
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"superclass": {
|
|
184
|
+
"name": "SpectrumElement",
|
|
185
|
+
"package": "@spectrum-web-components/base"
|
|
186
|
+
},
|
|
187
|
+
"tagName": "sp-progress-bar",
|
|
188
|
+
"customElement": true
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"exports": [
|
|
192
|
+
{
|
|
193
|
+
"kind": "js",
|
|
194
|
+
"name": "ProgressBar",
|
|
195
|
+
"declaration": {
|
|
196
|
+
"name": "ProgressBar",
|
|
197
|
+
"module": "src/ProgressBar.js"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/progress-bar",
|
|
3
|
-
"version": "1.11.0-
|
|
3
|
+
"version": "1.11.0-snapshot-test.20260127090232",
|
|
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.0-
|
|
68
|
-
"@spectrum-web-components/field-label": "1.11.0-
|
|
69
|
-
"@spectrum-web-components/reactive-controllers": "1.11.0-
|
|
70
|
-
"@spectrum-web-components/shared": "1.11.0-
|
|
67
|
+
"@spectrum-web-components/base": "1.11.0-snapshot-test.20260127090232",
|
|
68
|
+
"@spectrum-web-components/field-label": "1.11.0-snapshot-test.20260127090232",
|
|
69
|
+
"@spectrum-web-components/reactive-controllers": "1.11.0-snapshot-test.20260127090232",
|
|
70
|
+
"@spectrum-web-components/shared": "1.11.0-snapshot-test.20260127090232"
|
|
71
71
|
},
|
|
72
72
|
"types": "./src/index.d.ts",
|
|
73
73
|
"customElements": "custom-elements.json",
|
|
@@ -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
|
|
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,aAAM,oBAAoB;AAAA,EAC7B,gBAAgB,iBAAiB,EAAE;AAAA,EACnC;AAAA,IACI,eAAe;AAAA,EACnB;AACJ,EAAE;AAAA,EALK;AAAA;AAWH,SAAO,gBAAgB;AAGvB,SAAO,QAAQ;AAEf,SAAQ,mBAAmB,IAAI,6BAA6B,IAAI;AAuBhE,SAAQ,kBAA2B;AAGnC,SAAO,YAAY;AAGnB,SAAO,WAAW;AAAA;AAAA,EAvClB,WAA2B,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAWA,IAAW,iBAAyB;AAChC,WAAO,KAAK,kBAAkB,oBAAoB;AAAA,EACtD;AAAA,EACA,IAAW,eAAe,gBAAyB;AAC/C,QAAI,mBAAmB,MAAM;AACzB,WAAK,gBAAgB,iBAAiB;AACtC,WAAK,cAAc;AAEnB,UAAI,
|
|
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.',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I,MAAqB;AACrB,UACI,CAAC,KAAK,SACN,CAAC,KAAK,aAAa,YAAY,KAC/B,CAAC,KAAK,aAAa,iBAAiB,KACpC,CAAC,KAAK,gBACR;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;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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/ProgressBar.js.map
CHANGED
|
@@ -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
|
|
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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EAAM,MAAM,GAlDJ,YAmDD",
|
|
6
6
|
"names": ["html", "nothing", "SizedMixin", "SpectrumElement", "property", "query", "getLabelFromSlot", "ObserveSlotText", "LanguageResolutionController", "styles", "overBackground", "labelFromSlot", "changes", "__decorateClass"]
|
|
7
7
|
}
|