@vonage/vivid 3.0.0-next.4 → 3.0.0-next.5
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.
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { FoundationElementDefinition } from '@microsoft/fast-foundation';
|
|
2
|
+
export declare const vividProgressRing: (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<FoundationElementDefinition> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<FoundationElementDefinition, import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseProgress } from '@microsoft/fast-foundation';
|
|
2
|
+
import type { Connotation } from '../enums';
|
|
3
|
+
export declare type ProgressRingConnotation = Connotation.Primary | Connotation.Success | Connotation.Alert | Connotation.CTA;
|
|
4
|
+
export declare class ProgressRing extends BaseProgress {
|
|
5
|
+
connotation?: ProgressRingConnotation;
|
|
6
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ViewTemplate } from '@microsoft/fast-element';
|
|
2
|
+
import type { ElementDefinitionContext, FoundationElementDefinition } from '@microsoft/fast-foundation';
|
|
3
|
+
import type { ProgressRing } from './progress-ring';
|
|
4
|
+
export declare const ProgressRingTemplate: (context: ElementDefinitionContext, definition: FoundationElementDefinition) => ViewTemplate<ProgressRing>;
|
package/package.json
CHANGED
package/progress/index.js
CHANGED
|
@@ -1,71 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
|
|
2
2
|
import { s as styleInject } from '../shared/style-inject.es.js';
|
|
3
3
|
import { h as classofRaw, _ as _export, f as functionUncurryThis } from '../shared/web.dom-collections.iterator.js';
|
|
4
|
+
import { B as BaseProgress } from '../shared/base-progress.js';
|
|
4
5
|
import { w as when } from '../shared/when.js';
|
|
5
6
|
import { c as classNames } from '../shared/class-names.js';
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
-
* An Progress HTML Element.
|
|
9
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#progressbar | ARIA progressbar }.
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
class BaseProgress extends FoundationElement {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
/**
|
|
17
|
-
* Indicates progress in %
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
this.percentComplete = 0;
|
|
21
|
-
}
|
|
22
|
-
valueChanged() {
|
|
23
|
-
if (this.$fastController.isConnected) {
|
|
24
|
-
this.updatePercentComplete();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
minChanged() {
|
|
28
|
-
if (this.$fastController.isConnected) {
|
|
29
|
-
this.updatePercentComplete();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
maxChanged() {
|
|
33
|
-
if (this.$fastController.isConnected) {
|
|
34
|
-
this.updatePercentComplete();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
connectedCallback() {
|
|
41
|
-
super.connectedCallback();
|
|
42
|
-
this.updatePercentComplete();
|
|
43
|
-
}
|
|
44
|
-
updatePercentComplete() {
|
|
45
|
-
const min = typeof this.min === "number" ? this.min : 0;
|
|
46
|
-
const max = typeof this.max === "number" ? this.max : 100;
|
|
47
|
-
const value = typeof this.value === "number" ? this.value : 0;
|
|
48
|
-
const range = max - min;
|
|
49
|
-
this.percentComplete =
|
|
50
|
-
range === 0 ? 0 : Math.fround(((value - min) / range) * 100);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
__decorate([
|
|
54
|
-
attr({ converter: nullableNumberConverter })
|
|
55
|
-
], BaseProgress.prototype, "value", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
attr({ converter: nullableNumberConverter })
|
|
58
|
-
], BaseProgress.prototype, "min", void 0);
|
|
59
|
-
__decorate([
|
|
60
|
-
attr({ converter: nullableNumberConverter })
|
|
61
|
-
], BaseProgress.prototype, "max", void 0);
|
|
62
|
-
__decorate([
|
|
63
|
-
attr({ mode: "boolean" })
|
|
64
|
-
], BaseProgress.prototype, "paused", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
observable
|
|
67
|
-
], BaseProgress.prototype, "percentComplete", void 0);
|
|
68
|
-
|
|
69
8
|
var css_248z = ".base {\n height: 6px;\n align-items: center;\n margin: 0;\n outline: none;\n}\n.base.connotation-cta {\n --connotation: var(--vvd-color-cta);\n --on-connotation: var(--vvd-color-on-cta);\n}\n\n.base:not(.connotation-pacific):not(.connotation-cta):not(.connotation-alert):not(.connotation-success) {\n --connotation: var(--vvd-color-primary);\n --on-connotation: var(--vvd-color-on-primary);\n}\n\n.base.connotation-alert {\n --connotation: var(--vvd-color-alert);\n --on-connotation: var(--vvd-color-on-alert);\n}\n\n.base.connotation-success {\n --connotation: var(--vvd-color-success);\n --on-connotation: var(--vvd-color-on-success);\n}\n\n.base.connotation-pacific {\n --connotation: linear-gradient(to right, var(--vvd-color-info-30), var(--vvd-color-cta-70));\n}\n\n.indeterminate {\n display: flex;\n overflow: hidden;\n width: 100%;\n height: 100%;\n border-radius: 3px;\n}\n\n.progress {\n position: relative;\n display: flex;\n align-items: center;\n background-color: var(--vvd-color-neutral-20);\n block-size: 100%;\n inline-size: 100%;\n}\n.progress .indeterminate {\n background-color: var(--connotation);\n}\n\n.determinate {\n background-color: var(--connotation);\n block-size: 100%;\n border-radius: 3px;\n transition: all 0.2s ease-in-out;\n}\n.connotation-pacific .determinate {\n background-image: var(--connotation);\n}\n\n.indeterminate-indicator-1, .indeterminate-indicator-2 {\n position: absolute;\n animation: indeterminate-1 2s infinite;\n animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);\n background-color: var(--vvd-color-neutral-20);\n block-size: 100%;\n inline-size: 30%;\n opacity: 0;\n}\n\n.indeterminate-indicator-2 {\n animation: indeterminate-2 2s infinite;\n inline-size: 60%;\n}\n\n.connotation-pacific .indeterminate-indicator-1, .connotation-pacific .indeterminate-indicator-2 {\n background-image: var(--connotation);\n}\n\n.reverse .indeterminate-indicator-1, .reverse .indeterminate-indicator-2 {\n animation-direction: reverse;\n}\n.reverse .determinate {\n position: absolute;\n right: 0;\n}\n\n.base.shape-sharp .determinate, .base.shape-sharp .indeterminate {\n border-radius: 0;\n}\n\n.base.paused .indeterminate-indicator-1,\n.base.paused .indeterminate-indicator-2 {\n animation-play-state: paused;\n background-color: var(--connotation);\n}\n\n.base.paused .determinate {\n background-color: var(--vvd-color-neutral-40);\n}\n\n@keyframes indeterminate-1 {\n 0% {\n opacity: 1;\n transform: translateX(-100%);\n }\n 70% {\n opacity: 1;\n transform: translateX(300%);\n }\n 70.01% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n transform: translateX(300%);\n }\n}\n@keyframes indeterminate-2 {\n 0% {\n opacity: 0;\n transform: translateX(-150%);\n }\n 29.99% {\n opacity: 0;\n }\n 30% {\n opacity: 1;\n transform: translateX(-150%);\n }\n 100% {\n opacity: 1;\n transform: translateX(166.66%);\n }\n}";
|
|
70
9
|
styleInject(css_248z);
|
|
71
10
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
|
|
2
|
+
import { s as styleInject } from '../shared/style-inject.es.js';
|
|
3
|
+
import { B as BaseProgress } from '../shared/base-progress.js';
|
|
4
|
+
import { w as when } from '../shared/when.js';
|
|
5
|
+
import { c as classNames } from '../shared/class-names.js';
|
|
6
|
+
|
|
7
|
+
var css_248z = ".base {\n width: 36px;\n height: 36px;\n align-items: center;\n outline: none;\n}\n.base.connotation-cta {\n --connotation: var(--vvd-color-cta);\n --on-connotation: var(--vvd-color-on-cta);\n}\n\n.base:not(.connotation-cta):not(.connotation-alert):not(.connotation-success) {\n --connotation: var(--vvd-color-primary);\n --on-connotation: var(--vvd-color-on-primary);\n}\n\n.base.connotation-alert {\n --connotation: var(--vvd-color-alert);\n --on-connotation: var(--vvd-color-on-alert);\n}\n\n.base.connotation-success {\n --connotation: var(--vvd-color-success);\n --on-connotation: var(--vvd-color-on-success);\n}\n\n.base.base-large {\n width: 48px;\n height: 48px;\n}\n\n.base.base-small {\n width: 24px;\n height: 24px;\n}\n\n.progress {\n width: 100%;\n height: 100%;\n}\n\n.background {\n fill: none;\n stroke: transparent;\n stroke-width: 2px;\n}\n\n.determinate {\n fill: none;\n stroke: var(--connotation);\n stroke-linecap: round;\n stroke-width: 2px;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: all 0.2s ease-in-out;\n}\n\n.indeterminate-indicator-1 {\n animation: spin-infinite 2s linear infinite;\n fill: none;\n stroke: var(--connotation);\n stroke-linecap: round;\n stroke-width: 2px;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: all 0.2s ease-in-out;\n}\n\n.base.paused .indeterminate-indicator-1 {\n animation-play-state: paused;\n stroke: var(--vvd-color-neutral);\n}\n\n.base.paused .determinate {\n stroke: var(--vvd-color-neutral);\n}\n\n@keyframes spin-infinite {\n 0% {\n stroke-dasharray: 0.01px 43.97px;\n transform: rotate(0deg);\n }\n 50% {\n stroke-dasharray: 21.99px 21.99px;\n transform: rotate(450deg);\n }\n 100% {\n stroke-dasharray: 0.01px 43.97px;\n transform: rotate(1080deg);\n }\n}";
|
|
8
|
+
styleInject(css_248z);
|
|
9
|
+
|
|
10
|
+
class ProgressRing extends BaseProgress {}
|
|
11
|
+
|
|
12
|
+
__decorate([attr(), __metadata("design:type", String)], ProgressRing.prototype, "connotation", void 0);
|
|
13
|
+
|
|
14
|
+
let _2 = t => t,
|
|
15
|
+
_t,
|
|
16
|
+
_t2,
|
|
17
|
+
_t3;
|
|
18
|
+
|
|
19
|
+
const getClasses = _ => classNames('base', [`connotation-${_.connotation}`, !!_.connotation]);
|
|
20
|
+
|
|
21
|
+
const progressSegments = 44;
|
|
22
|
+
const ProgressRingTemplate = _ => html(_t || (_t = _2`
|
|
23
|
+
<div
|
|
24
|
+
role="progressbar"
|
|
25
|
+
aria-valuenow="${0}"
|
|
26
|
+
aria-valuemin="${0}"
|
|
27
|
+
aria-valuemax="${0}"
|
|
28
|
+
class="${0} ${0}"
|
|
29
|
+
>
|
|
30
|
+
${0}
|
|
31
|
+
${0}
|
|
32
|
+
</div>
|
|
33
|
+
`), x => x.value, x => x.min, x => x.max, x => x.paused ? 'paused' : '', getClasses, when(x => typeof x.value === 'number', html(_t2 || (_t2 = _2`
|
|
34
|
+
<svg
|
|
35
|
+
class="progress"
|
|
36
|
+
viewBox="0 0 16 16"
|
|
37
|
+
>
|
|
38
|
+
<circle
|
|
39
|
+
class="background"
|
|
40
|
+
cx="8px"
|
|
41
|
+
cy="8px"
|
|
42
|
+
r="7px"
|
|
43
|
+
></circle>
|
|
44
|
+
<circle
|
|
45
|
+
class="determinate"
|
|
46
|
+
style="stroke-dasharray: ${0}px ${0}px"
|
|
47
|
+
cx="8px"
|
|
48
|
+
cy="8px"
|
|
49
|
+
r="7px"
|
|
50
|
+
></circle>
|
|
51
|
+
</svg>
|
|
52
|
+
`), x => progressSegments * x.percentComplete / 100, progressSegments)), when(x => typeof x.value !== 'number', html(_t3 || (_t3 = _2`
|
|
53
|
+
<svg class="progress" viewBox="0 0 16 16">
|
|
54
|
+
<circle
|
|
55
|
+
class="background"
|
|
56
|
+
cx="8px"
|
|
57
|
+
cy="8px"
|
|
58
|
+
r="7px"
|
|
59
|
+
></circle>
|
|
60
|
+
<circle
|
|
61
|
+
class="indeterminate-indicator-1"
|
|
62
|
+
cx="8px"
|
|
63
|
+
cy="8px"
|
|
64
|
+
r="7px"
|
|
65
|
+
></circle>
|
|
66
|
+
</svg>
|
|
67
|
+
`))));
|
|
68
|
+
|
|
69
|
+
const vividProgressRing = ProgressRing.compose({
|
|
70
|
+
baseName: 'progress-ring',
|
|
71
|
+
template: ProgressRingTemplate,
|
|
72
|
+
styles: css_248z
|
|
73
|
+
});
|
|
74
|
+
designSystem.register(vividProgressRing());
|
|
75
|
+
|
|
76
|
+
export { vividProgressRing };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, n as nullableNumberConverter, o as observable } from './index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An Progress HTML Element.
|
|
5
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#progressbar | ARIA progressbar }.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
class BaseProgress extends FoundationElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
/**
|
|
13
|
+
* Indicates progress in %
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
this.percentComplete = 0;
|
|
17
|
+
}
|
|
18
|
+
valueChanged() {
|
|
19
|
+
if (this.$fastController.isConnected) {
|
|
20
|
+
this.updatePercentComplete();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
minChanged() {
|
|
24
|
+
if (this.$fastController.isConnected) {
|
|
25
|
+
this.updatePercentComplete();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
maxChanged() {
|
|
29
|
+
if (this.$fastController.isConnected) {
|
|
30
|
+
this.updatePercentComplete();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
super.connectedCallback();
|
|
38
|
+
this.updatePercentComplete();
|
|
39
|
+
}
|
|
40
|
+
updatePercentComplete() {
|
|
41
|
+
const min = typeof this.min === "number" ? this.min : 0;
|
|
42
|
+
const max = typeof this.max === "number" ? this.max : 100;
|
|
43
|
+
const value = typeof this.value === "number" ? this.value : 0;
|
|
44
|
+
const range = max - min;
|
|
45
|
+
this.percentComplete =
|
|
46
|
+
range === 0 ? 0 : Math.fround(((value - min) / range) * 100);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
__decorate([
|
|
50
|
+
attr({ converter: nullableNumberConverter })
|
|
51
|
+
], BaseProgress.prototype, "value", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
attr({ converter: nullableNumberConverter })
|
|
54
|
+
], BaseProgress.prototype, "min", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
attr({ converter: nullableNumberConverter })
|
|
57
|
+
], BaseProgress.prototype, "max", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
attr({ mode: "boolean" })
|
|
60
|
+
], BaseProgress.prototype, "paused", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
observable
|
|
63
|
+
], BaseProgress.prototype, "percentComplete", void 0);
|
|
64
|
+
|
|
65
|
+
export { BaseProgress as B };
|