@spectrum-web-components/progress-circle 0.3.0 → 0.4.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/README.md +7 -7
- package/package.json +4 -4
- package/src/ProgressCircle.d.ts +1 -1
- package/src/ProgressCircle.js +3 -1
- package/src/ProgressCircle.js.map +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ An `<sp-progress-circle>` is used to visually show the progression of a system o
|
|
|
37
37
|
<sp-progress-circle
|
|
38
38
|
label="A small representation of a somewhat completed action"
|
|
39
39
|
progress="71"
|
|
40
|
-
size="
|
|
40
|
+
size="s"
|
|
41
41
|
></sp-progress-circle>
|
|
42
42
|
<sp-progress-circle
|
|
43
43
|
label="A medium representation of a recently started action"
|
|
@@ -46,7 +46,7 @@ An `<sp-progress-circle>` is used to visually show the progression of a system o
|
|
|
46
46
|
<sp-progress-circle
|
|
47
47
|
label="A large representation of an almost completed action"
|
|
48
48
|
progress="86"
|
|
49
|
-
size="
|
|
49
|
+
size="l"
|
|
50
50
|
></sp-progress-circle>
|
|
51
51
|
</div>
|
|
52
52
|
```
|
|
@@ -63,7 +63,7 @@ When a loader needs to be placed on top of a colored background, use the over ba
|
|
|
63
63
|
label="A small representation of a partially completed action"
|
|
64
64
|
progress="42"
|
|
65
65
|
over-background
|
|
66
|
-
size="
|
|
66
|
+
size="s"
|
|
67
67
|
></sp-progress-circle>
|
|
68
68
|
<sp-progress-circle
|
|
69
69
|
label="A medium representation of a barely started action"
|
|
@@ -74,7 +74,7 @@ When a loader needs to be placed on top of a colored background, use the over ba
|
|
|
74
74
|
label="A large representation of a somewhat completed action"
|
|
75
75
|
progress="68"
|
|
76
76
|
over-background
|
|
77
|
-
size="
|
|
77
|
+
size="l"
|
|
78
78
|
></sp-progress-circle>
|
|
79
79
|
</div>
|
|
80
80
|
```
|
|
@@ -90,7 +90,7 @@ A progress circle can be either determinate or indeterminate as signified by `[i
|
|
|
90
90
|
<sp-progress-circle
|
|
91
91
|
label="A small representation of an unclear amount of work"
|
|
92
92
|
indeterminate
|
|
93
|
-
size="
|
|
93
|
+
size="s"
|
|
94
94
|
></sp-progress-circle>
|
|
95
95
|
<sp-progress-circle
|
|
96
96
|
label="A medium representation of an unclear amount of work"
|
|
@@ -99,14 +99,14 @@ A progress circle can be either determinate or indeterminate as signified by `[i
|
|
|
99
99
|
<sp-progress-circle
|
|
100
100
|
label="A large representation of an unclear amount of work"
|
|
101
101
|
indeterminate
|
|
102
|
-
size="
|
|
102
|
+
size="l"
|
|
103
103
|
></sp-progress-circle>
|
|
104
104
|
</div>
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
### Size
|
|
108
108
|
|
|
109
|
-
Progress Circles come in 3 sizes: small (`[size="
|
|
109
|
+
Progress Circles come in 3 sizes: small (`[size="s"]`), medium (`[size="m"]`, default), or large (`[size="l"]`). These are available to fit various contexts. For example, the small loader can be used in place of an icon or in tight spaces, while the large one can be used for full-page loading.
|
|
110
110
|
|
|
111
111
|
## Accessibility
|
|
112
112
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/progress-circle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
"lit-html"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@spectrum-web-components/base": "^0.
|
|
47
|
+
"@spectrum-web-components/base": "^0.5.1",
|
|
48
48
|
"tslib": "^2.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@spectrum-css/progresscircle": "^1.0.
|
|
51
|
+
"@spectrum-css/progresscircle": "^1.0.9"
|
|
52
52
|
},
|
|
53
53
|
"types": "./src/index.d.ts",
|
|
54
54
|
"customElements": "custom-elements.json",
|
|
55
55
|
"sideEffects": [
|
|
56
56
|
"./sp-*.js"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "df3f333ee26a45f9fc247716b6e8ef051dca630b"
|
|
59
59
|
}
|
package/src/ProgressCircle.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
2
|
declare const ProgressCircle_base: typeof SpectrumElement & {
|
|
3
3
|
new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
|
|
4
4
|
prototype: import("@spectrum-web-components/base").SizedElementInterface;
|
package/src/ProgressCircle.js
CHANGED
|
@@ -10,7 +10,9 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
import { __decorate } from "tslib";
|
|
13
|
-
import { html,
|
|
13
|
+
import { html, SizedMixin, SpectrumElement, } from '@spectrum-web-components/base';
|
|
14
|
+
import { property } from '@spectrum-web-components/base/src/decorators.js';
|
|
15
|
+
import { ifDefined } from '@spectrum-web-components/base/src/directives.js';
|
|
14
16
|
import progressCircleStyles from './progress-circle.css.js';
|
|
15
17
|
/**
|
|
16
18
|
* @element sp-progress-circle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressCircle.js","sourceRoot":"","sources":["ProgressCircle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,
|
|
1
|
+
{"version":3,"file":"ProgressCircle.js","sourceRoot":"","sources":["ProgressCircle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EAEJ,UAAU,EACV,eAAe,GAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,i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AC1C,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;YAC5B,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;SAC5C;IACL,CAAC;IAES,OAAO,CAAC,OAAuB;QACrC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAChD,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC1D;aAAM,IAAI,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,EAAE;YAC3C,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;SACzC;QACD,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACpC,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;SAC/C;IACL,CAAC;CACJ;AA9DG;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qDACd;AAG7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACT;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;sDAC3C;AAG9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDACP","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 { property } from '@spectrum-web-components/base/src/decorators.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 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({ type: Number })\n public progress = 0;\n\n private makeRotation(rotation: number): string | undefined {\n return this.indeterminate\n ? undefined\n : `transform: rotate(${rotation}deg);`;\n }\n\n protected 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 <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 firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'progressbar');\n }\n }\n\n protected 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 (this.label && changes.has('label')) {\n this.setAttribute('aria-label', this.label);\n }\n }\n}\n"]}
|