@vonage/vivid 3.40.0 → 3.41.0
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/accordion/index.js +2 -2
- package/accordion-item/index.js +2 -2
- package/alert/index.js +6 -5
- package/audio-player/index.js +33 -0
- package/avatar/index.js +2 -2
- package/badge/index.js +2 -2
- package/banner/index.js +8 -5
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +3 -3
- package/button/index.js +4 -4
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +4 -3
- package/checkbox/index.js +3 -3
- package/combobox/index.js +8 -8
- package/custom-elements.json +330 -38
- package/data-grid/index.js +2 -2
- package/date-picker/index.js +9 -9
- package/date-range-picker/index.js +8 -8
- package/dialog/index.js +6 -6
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +3 -3
- package/file-picker/index.js +5 -5
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +57 -56
- package/layout/index.js +1 -1
- package/lib/alert/alert.d.ts +3 -1
- package/lib/alert/locale.d.ts +3 -0
- package/lib/audio-player/audio-player.d.ts +17 -0
- package/lib/audio-player/audio-player.template.d.ts +4 -0
- package/lib/audio-player/definition.d.ts +4 -0
- package/lib/audio-player/locale.d.ts +5 -0
- package/lib/banner/banner.d.ts +3 -1
- package/lib/banner/locale.d.ts +3 -0
- package/lib/card/card.d.ts +3 -0
- package/lib/card/card.template.d.ts +1 -1
- package/lib/card/definition.d.ts +1 -0
- package/lib/checkbox/checkbox.d.ts +1 -0
- package/lib/components.d.ts +1 -0
- package/lib/enums.d.ts +2 -1
- package/lib/selectable-box/selectable-box.d.ts +1 -2
- package/lib/split-button/locale.d.ts +3 -0
- package/lib/split-button/split-button.d.ts +3 -1
- package/listbox/index.js +4 -4
- package/locales/en-GB.js +14 -0
- package/locales/en-US.js +14 -0
- package/locales/ja-JP.js +14 -0
- package/locales/zh-CN.js +14 -0
- package/menu/index.js +8 -8
- package/menu-item/index.js +3 -3
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +3 -3
- package/nav-item/index.js +3 -3
- package/note/index.js +2 -2
- package/number-field/index.js +6 -6
- package/option/index.js +3 -3
- package/package.json +1 -1
- package/pagination/index.js +5 -5
- package/popup/index.js +6 -6
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +2 -2
- package/select/index.js +8 -8
- package/selectable-box/index.js +5 -5
- package/shared/definition.js +3 -3
- package/shared/definition10.js +90 -159
- package/shared/definition11.js +151 -29
- package/shared/definition12.js +37 -766
- package/shared/definition13.js +747 -106
- package/shared/definition14.js +121 -198
- package/shared/definition15.js +156 -664
- package/shared/definition16.js +576 -1137
- package/shared/definition17.js +1278 -143
- package/shared/definition18.js +64 -305
- package/shared/definition19.js +357 -218
- package/shared/definition2.js +1 -1
- package/shared/definition20.js +259 -67
- package/shared/definition21.js +66 -58
- package/shared/definition22.js +43 -84
- package/shared/definition23.js +76 -2353
- package/shared/definition24.js +2362 -45
- package/shared/definition25.js +63 -27
- package/shared/definition26.js +24 -51
- package/shared/definition27.js +36 -822
- package/shared/definition28.js +837 -49
- package/shared/definition29.js +52 -89
- package/shared/definition3.js +1 -1
- package/shared/definition30.js +88 -24
- package/shared/definition31.js +25 -12
- package/shared/definition32.js +12 -52
- package/shared/definition33.js +28 -502
- package/shared/definition34.js +442 -197
- package/shared/definition35.js +260 -186
- package/shared/definition36.js +186 -75
- package/shared/definition37.js +70 -54
- package/shared/definition38.js +65 -421
- package/shared/definition39.js +437 -38
- package/shared/definition4.js +43 -16
- package/shared/definition40.js +32 -680
- package/shared/definition41.js +654 -105
- package/shared/definition42.js +105 -77
- package/shared/definition43.js +74 -567
- package/shared/definition44.js +568 -102
- package/shared/definition45.js +110 -135
- package/shared/definition46.js +153 -17
- package/shared/definition47.js +16 -79
- package/shared/definition48.js +53 -475
- package/shared/definition49.js +493 -25
- package/shared/definition5.js +160 -44
- package/shared/definition50.js +22 -121
- package/shared/definition51.js +113 -271
- package/shared/definition52.js +249 -243
- package/shared/definition53.js +270 -109
- package/shared/definition54.js +84 -74
- package/shared/definition55.js +114 -69
- package/shared/definition56.js +81 -292
- package/shared/definition57.js +302 -13
- package/shared/definition58.js +11 -41
- package/shared/definition59.js +20 -154
- package/shared/definition6.js +43 -33
- package/shared/definition60.js +181 -0
- package/shared/definition7.js +39 -106
- package/shared/definition8.js +122 -38
- package/shared/definition9.js +56 -89
- package/shared/enums.js +1 -0
- package/shared/icon.js +2 -2
- package/shared/index2.js +1 -1
- package/shared/listbox.js +1 -1
- package/shared/localization/Locale.d.ts +8 -0
- package/shared/patterns/form-elements/form-elements.d.ts +6 -6
- package/shared/presentationDate.js +5 -5
- package/shared/text-field.js +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.js +3 -3
- package/split-button/index.js +6 -3
- package/style.css +248 -208
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.js +3 -3
- package/tab/index.js +3 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +5 -5
- package/tag/index.js +3 -3
- package/tag-group/index.js +1 -1
- package/text-area/index.js +3 -3
- package/text-field/index.js +3 -3
- package/toggletip/index.js +7 -7
- package/tooltip/index.js +7 -7
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/vivid.api.json +251 -0
package/shared/definition36.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { B as Button, a as buttonRegistries } from './definition11.js';
|
|
2
|
+
import { a as attr, F as FoundationElement, o as observable, v as volatile, h as html, r as registerFactory } from './index.js';
|
|
3
|
+
import { b as Size, S as Shape } from './enums.js';
|
|
4
|
+
import { e as elements } from './slotted.js';
|
|
5
|
+
import { r as ref } from './ref.js';
|
|
6
|
+
import { c as children } from './children.js';
|
|
7
|
+
import { r as repeat } from './repeat.js';
|
|
4
8
|
import { c as classNames } from './class-names.js';
|
|
9
|
+
import { w as when } from './when.js';
|
|
5
10
|
|
|
6
|
-
const styles = "/**\n * Do not edit directly\n * Generated on Wed,
|
|
11
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Wed, 22 Nov 2023 16:09:43 GMT\n */\n.control {\n display: inline-flex;\n justify-content: space-between;\n}\n.control:not(.shape-pill) {\n border-radius: 4px;\n}\n.control.shape-pill {\n border-radius: 14px;\n}\n\n.buttons-wrapper {\n display: flex;\n column-gap: 4px;\n}\n\n.vwc-pagination-button[size=super-condensed] {\n --base-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.vwc-pagination-button[size=condensed] {\n --base-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n}\n.vwc-pagination-button[size=normal] {\n --base-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}\n.vwc-pagination-button::part(button) {\n padding-inline: 0;\n}\n\n.dots {\n align-self: center;\n text-align: center;\n}\n.dots:not(.size-super-condensed) {\n font: var(--vvd-typography-base-bold);\n}\n.dots.size-super-condensed {\n font: var(--vvd-typography-base-condensed-bold);\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.dots.size-condensed {\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n}\n.dots.size-normal {\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}";
|
|
7
12
|
|
|
8
13
|
var __defProp = Object.defineProperty;
|
|
9
14
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -16,89 +21,195 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
16
21
|
__defProp(target, key, result);
|
|
17
22
|
return result;
|
|
18
23
|
};
|
|
19
|
-
|
|
24
|
+
const MAX_DIGITS_AND_PLACEHOLDERS = 7;
|
|
25
|
+
const totalConverter = {
|
|
26
|
+
fromView: (value) => parseInt(value, 10),
|
|
27
|
+
toView: (value) => value.toString()
|
|
28
|
+
};
|
|
29
|
+
class Pagination extends FoundationElement {
|
|
20
30
|
constructor() {
|
|
21
|
-
super(
|
|
22
|
-
this.
|
|
31
|
+
super();
|
|
32
|
+
this.navIcons = false;
|
|
33
|
+
this.total = 0;
|
|
34
|
+
this.selectedIndex = 0;
|
|
35
|
+
this.addEventListener("tabpressed", (e) => {
|
|
36
|
+
const { value: currentLabel, shiftKey } = e.detail;
|
|
37
|
+
const index = this.paginationButtons.findIndex((button) => Number(button.label) === currentLabel);
|
|
38
|
+
const focusDirection = shiftKey ? -1 : 1;
|
|
39
|
+
const newIndex = index + focusDirection;
|
|
40
|
+
if (newIndex < 0) {
|
|
41
|
+
return this.prevButton.focus();
|
|
42
|
+
}
|
|
43
|
+
if (newIndex > this.paginationButtons.length - 1) {
|
|
44
|
+
return this.nextButton.focus();
|
|
45
|
+
}
|
|
46
|
+
this.paginationButtons && this.paginationButtons[index + focusDirection].focus();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
get pagesList() {
|
|
50
|
+
return new Array(this.total < MAX_DIGITS_AND_PLACEHOLDERS ? this.total : MAX_DIGITS_AND_PLACEHOLDERS).fill(0).map((_, i, arr) => {
|
|
51
|
+
if (i === 0)
|
|
52
|
+
return 1;
|
|
53
|
+
if (i === arr.length - 1)
|
|
54
|
+
return this.total;
|
|
55
|
+
if (this.selectedIndex !== void 0 && this.total > MAX_DIGITS_AND_PLACEHOLDERS) {
|
|
56
|
+
if (this.selectedIndex < 4) {
|
|
57
|
+
if (i === MAX_DIGITS_AND_PLACEHOLDERS - 2)
|
|
58
|
+
return "...";
|
|
59
|
+
}
|
|
60
|
+
if (this.selectedIndex >= 4 && this.selectedIndex <= this.total - 5) {
|
|
61
|
+
if (i > 1 && i < MAX_DIGITS_AND_PLACEHOLDERS - 2)
|
|
62
|
+
return this.selectedIndex + (i - 2);
|
|
63
|
+
if (i === 1 || i === MAX_DIGITS_AND_PLACEHOLDERS - 2)
|
|
64
|
+
return "...";
|
|
65
|
+
}
|
|
66
|
+
if (this.selectedIndex > this.total - 5) {
|
|
67
|
+
if (i > 1)
|
|
68
|
+
return this.total - (6 - i);
|
|
69
|
+
if (i === 1)
|
|
70
|
+
return "...";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return i + 1;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
totalChanged(_, newValue) {
|
|
77
|
+
if (newValue < 0) {
|
|
78
|
+
this.total = 0;
|
|
79
|
+
}
|
|
80
|
+
this.selectedIndex = 0;
|
|
81
|
+
}
|
|
82
|
+
selectedIndexChanged(oldValue, newValue) {
|
|
83
|
+
if (oldValue === void 0)
|
|
84
|
+
return;
|
|
85
|
+
this.$emit("pagination-change", { selectedIndex: newValue, total: this.total, oldIndex: oldValue });
|
|
86
|
+
}
|
|
87
|
+
paginationButtonsChanged(_, newValue) {
|
|
88
|
+
newValue.forEach((button) => {
|
|
89
|
+
button.shadowRoot.querySelector("button").setAttribute("part", "button");
|
|
90
|
+
});
|
|
23
91
|
}
|
|
24
92
|
}
|
|
25
|
-
__decorateClass([
|
|
26
|
-
attr({ attribute: "aria-label" })
|
|
27
|
-
], ProgressRing.prototype, "ariaLabel", 2);
|
|
28
93
|
__decorateClass([
|
|
29
94
|
attr
|
|
30
|
-
],
|
|
95
|
+
], Pagination.prototype, "size", 2);
|
|
31
96
|
__decorateClass([
|
|
32
97
|
attr
|
|
33
|
-
],
|
|
98
|
+
], Pagination.prototype, "shape", 2);
|
|
99
|
+
__decorateClass([
|
|
100
|
+
observable
|
|
101
|
+
], Pagination.prototype, "paginationButtons", 2);
|
|
102
|
+
__decorateClass([
|
|
103
|
+
observable
|
|
104
|
+
], Pagination.prototype, "prevButton", 2);
|
|
105
|
+
__decorateClass([
|
|
106
|
+
observable
|
|
107
|
+
], Pagination.prototype, "nextButton", 2);
|
|
108
|
+
__decorateClass([
|
|
109
|
+
attr({ attribute: "nav-icons", mode: "boolean" })
|
|
110
|
+
], Pagination.prototype, "navIcons", 2);
|
|
111
|
+
__decorateClass([
|
|
112
|
+
volatile
|
|
113
|
+
], Pagination.prototype, "pagesList", 1);
|
|
114
|
+
__decorateClass([
|
|
115
|
+
attr({ mode: "reflect", converter: totalConverter })
|
|
116
|
+
], Pagination.prototype, "total", 2);
|
|
117
|
+
__decorateClass([
|
|
118
|
+
attr({ mode: "reflect", converter: totalConverter, attribute: "selected-index" })
|
|
119
|
+
], Pagination.prototype, "selectedIndex", 2);
|
|
34
120
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
(
|
|
121
|
+
const ALLOWED_SIZES = [Size.SuperCondensed, Size.Condensed, Size.Normal];
|
|
122
|
+
const ALLOWED_SHAPES = [Shape.Rounded, Shape.Pill];
|
|
123
|
+
const handleSelection = (value, { parent: x }) => {
|
|
124
|
+
return x.selectedIndex = Number(value) - 1;
|
|
125
|
+
};
|
|
126
|
+
const handleKeyDown = (value, { event, parent }) => {
|
|
127
|
+
if (event.key === " " || event.key === "Enter") {
|
|
128
|
+
handleSelection(value, { parent });
|
|
129
|
+
}
|
|
130
|
+
if (event.key === "Tab") {
|
|
131
|
+
event.target.dispatchEvent(
|
|
132
|
+
new CustomEvent("tabpressed", { detail: { value, shiftKey: event.shiftKey }, bubbles: true, composed: true })
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const getClasses = (_) => classNames("control");
|
|
137
|
+
function getButtonAppearance(value, { parent }) {
|
|
138
|
+
return parent.selectedIndex === Number(value) - 1 ? "filled" : "ghost";
|
|
139
|
+
}
|
|
140
|
+
const paginationButtonRenderer = (buttonTag) => html`
|
|
141
|
+
${when(
|
|
142
|
+
(value) => value !== "...",
|
|
53
143
|
html`
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
style="stroke-dasharray: ${(x) => progressSegments * x.percentComplete / 100}px ${progressSegments}px"
|
|
67
|
-
cx="8px"
|
|
68
|
-
cy="8px"
|
|
69
|
-
r="7px"
|
|
70
|
-
></circle>
|
|
71
|
-
</svg>
|
|
72
|
-
`
|
|
144
|
+
<${buttonTag} class="vwc-pagination-button"
|
|
145
|
+
label="${(value) => value}"
|
|
146
|
+
appearance="${getButtonAppearance}"
|
|
147
|
+
size="${(_, { parent: x }) => getPaginationSize(x)}"
|
|
148
|
+
shape="${(_, { parent: x }) => getPaginationShape(x)}"
|
|
149
|
+
style="inline-size: ${(value) => getPaginationButtonWidth(value)};"
|
|
150
|
+
tabindex="0"
|
|
151
|
+
aria-current="${(value, { parent }) => parent.selectedIndex === Number(value) - 1}"
|
|
152
|
+
@click="${handleSelection}"
|
|
153
|
+
@keydown="${handleKeyDown}">
|
|
154
|
+
</${buttonTag}>
|
|
155
|
+
`
|
|
73
156
|
)}
|
|
74
|
-
|
|
75
|
-
(
|
|
157
|
+
${when(
|
|
158
|
+
(value) => value === "...",
|
|
76
159
|
html`
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
160
|
+
<div
|
|
161
|
+
class="dots size-${(_, { parent: x }) => getPaginationSize(x)}">
|
|
162
|
+
...
|
|
163
|
+
</div>`
|
|
164
|
+
)}`;
|
|
165
|
+
const getPaginationSize = (x) => {
|
|
166
|
+
if (!x.size || !ALLOWED_SIZES.includes(x.size)) {
|
|
167
|
+
return Size.SuperCondensed;
|
|
168
|
+
}
|
|
169
|
+
return x.size;
|
|
170
|
+
};
|
|
171
|
+
const getPaginationShape = (x) => {
|
|
172
|
+
if (!x.shape || !ALLOWED_SHAPES.includes(x.shape)) {
|
|
173
|
+
return Shape.Rounded;
|
|
174
|
+
}
|
|
175
|
+
return x.shape;
|
|
176
|
+
};
|
|
177
|
+
const getPaginationButtonWidth = (value) => {
|
|
178
|
+
return `calc(var(--base-size) + ${String(value).length - 1}ch)`;
|
|
179
|
+
};
|
|
180
|
+
const PaginationTemplate = (context) => {
|
|
181
|
+
const buttonTag = context.tagFor(Button);
|
|
182
|
+
const paginationButtonTemplate = paginationButtonRenderer(buttonTag);
|
|
183
|
+
return html`
|
|
184
|
+
<div class="${getClasses}">
|
|
185
|
+
<${buttonTag} class="prev-button" ${ref("prevButton")}
|
|
186
|
+
label="${(x) => !x.navIcons ? "Previous" : null}"
|
|
187
|
+
icon="${(x) => x.navIcons ? "chevron-left-line" : null}"
|
|
188
|
+
size="${getPaginationSize}"
|
|
189
|
+
shape="${getPaginationShape}"
|
|
190
|
+
?disabled="${(x) => x.total === 0 || x.selectedIndex === 0}"
|
|
191
|
+
@click="${(x) => x.selectedIndex !== void 0 && x.selectedIndex--}"
|
|
192
|
+
></${buttonTag}>
|
|
193
|
+
<div id="buttons-wrapper" class="buttons-wrapper" ${children({ property: "paginationButtons", filter: elements(buttonTag) })}>
|
|
194
|
+
${repeat((x) => x.pagesList, paginationButtonTemplate, { positioning: true })}
|
|
195
|
+
</div>
|
|
196
|
+
<${buttonTag} class="next-button" ${ref("nextButton")}
|
|
197
|
+
label="${(x) => !x.navIcons ? "Next" : null}"
|
|
198
|
+
icon="${(x) => x.navIcons ? "chevron-right-line" : null}"
|
|
199
|
+
size="${getPaginationSize}"
|
|
200
|
+
shape="${getPaginationShape}"
|
|
201
|
+
?disabled="${(x) => x.total === 0 || x.selectedIndex === x.total - 1}"
|
|
202
|
+
@click="${(x) => x.selectedIndex !== void 0 && x.selectedIndex++}"
|
|
203
|
+
></${buttonTag}>
|
|
204
|
+
</div>`;
|
|
205
|
+
};
|
|
95
206
|
|
|
96
|
-
const
|
|
97
|
-
baseName: "
|
|
98
|
-
template:
|
|
207
|
+
const paginationDefinition = Pagination.compose({
|
|
208
|
+
baseName: "pagination",
|
|
209
|
+
template: PaginationTemplate,
|
|
99
210
|
styles
|
|
100
211
|
});
|
|
101
|
-
const
|
|
102
|
-
const
|
|
212
|
+
const paginationRegistries = [paginationDefinition(), buttonRegistries];
|
|
213
|
+
const registerPagination = registerFactory(paginationRegistries);
|
|
103
214
|
|
|
104
|
-
export {
|
|
215
|
+
export { paginationRegistries as a, paginationDefinition as p, registerPagination as r };
|
package/shared/definition37.js
CHANGED
|
@@ -3,7 +3,7 @@ import { B as BaseProgress } from './base-progress.js';
|
|
|
3
3
|
import { w as when } from './when.js';
|
|
4
4
|
import { c as classNames } from './class-names.js';
|
|
5
5
|
|
|
6
|
-
const styles = "/**\n * Do not edit directly\n * Generated on Wed,
|
|
6
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Wed, 22 Nov 2023 16:09:43 GMT\n */\n.base {\n align-items: center;\n block-size: var(--_size);\n color: var(--_appearance-color-text);\n inline-size: var(--_size);\n outline: none;\n}\n.base.connotation-cta {\n /* @cssprop [--vvd-progress-ring-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-progress-ring-cta-primary, var(--vvd-color-cta-500));\n}\n.base.connotation-alert {\n /* @cssprop [--vvd-progress-ring-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-progress-ring-alert-primary, var(--vvd-color-alert-500));\n}\n.base.connotation-success {\n /* @cssprop [--vvd-progress-ring-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-progress-ring-success-primary, var(--vvd-color-success-500));\n}\n.base:not(.connotation-cta, .connotation-alert, .connotation-success) {\n /* @cssprop [--vvd-progress-ring-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-progress-ring-accent-primary, var(--vvd-color-canvas-text));\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.size--6 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)) - 1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.base.size--5 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n}\n.base.size--4 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.base.size--3 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 12));\n}\n.base.size--2 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n}\n.base.size--1 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 4));\n}\n.base.size-1 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 4));\n}\n.base.size-2 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 8));\n}\n.base.size-3 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 12));\n}\n.base.size-4 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 16));\n}\n.base.size-5 {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 20));\n}\n.base:not(.size--6, .size--5, .size--4, .size--3, .size--2, .size--1, .size-1, .size-2, .size-3, .size-4, .size-5) {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}\n\n.progress {\n width: 100%;\n height: 100%;\n}\n\n.background {\n fill: none;\n stroke: transparent;\n stroke-width: 1px;\n}\n\n.determinate {\n fill: none;\n stroke: currentColor;\n stroke-linecap: round;\n stroke-width: 1px;\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: currentColor;\n stroke-linecap: round;\n stroke-width: 1px;\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}\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}";
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
9
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -16,73 +16,89 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
16
16
|
__defProp(target, key, result);
|
|
17
17
|
return result;
|
|
18
18
|
};
|
|
19
|
-
class
|
|
19
|
+
class ProgressRing extends BaseProgress {
|
|
20
20
|
constructor() {
|
|
21
21
|
super(...arguments);
|
|
22
22
|
this.ariaLabel = null;
|
|
23
|
-
this.reverse = false;
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
__decorateClass([
|
|
27
26
|
attr({ attribute: "aria-label" })
|
|
28
|
-
],
|
|
27
|
+
], ProgressRing.prototype, "ariaLabel", 2);
|
|
29
28
|
__decorateClass([
|
|
30
|
-
attr
|
|
31
|
-
],
|
|
29
|
+
attr
|
|
30
|
+
], ProgressRing.prototype, "connotation", 2);
|
|
32
31
|
__decorateClass([
|
|
33
|
-
attr
|
|
34
|
-
],
|
|
35
|
-
__decorateClass([
|
|
36
|
-
attr({ mode: "boolean" })
|
|
37
|
-
], Progress.prototype, "reverse", 2);
|
|
32
|
+
attr
|
|
33
|
+
], ProgressRing.prototype, "size", 2);
|
|
38
34
|
|
|
39
|
-
const getClasses = ({
|
|
40
|
-
connotation,
|
|
41
|
-
shape,
|
|
42
|
-
reverse,
|
|
43
|
-
paused
|
|
44
|
-
}) => classNames(
|
|
35
|
+
const getClasses = ({ connotation, size, paused }) => classNames(
|
|
45
36
|
"base",
|
|
46
|
-
[
|
|
47
|
-
[`
|
|
48
|
-
[
|
|
49
|
-
["paused", Boolean(paused)]
|
|
37
|
+
["disabled", !!paused],
|
|
38
|
+
[`connotation-${connotation}`, !!connotation],
|
|
39
|
+
[`size-${size}`, !!size]
|
|
50
40
|
);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</span>`;
|
|
61
|
-
}
|
|
62
|
-
const ProgressTemplate = (_) => {
|
|
63
|
-
return html`<template role="${(x) => x.ariaLabel ? "presentation" : null}">
|
|
64
|
-
<div
|
|
65
|
-
role="progressbar"
|
|
66
|
-
aria-label="${(x) => x.ariaLabel}"
|
|
67
|
-
aria-valuenow="${(x) => x.value}"
|
|
68
|
-
aria-valuemin="${(x) => x.min}"
|
|
69
|
-
aria-valuemax="${(x) => x.max}"
|
|
70
|
-
class="${getClasses}"
|
|
41
|
+
const progressSegments = 44;
|
|
42
|
+
const ProgressRingTemplate = (_) => html`<template role="${(x) => x.ariaLabel ? "presentation" : null}">
|
|
43
|
+
<div
|
|
44
|
+
role="progressbar"
|
|
45
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
46
|
+
aria-valuenow="${(x) => x.value}"
|
|
47
|
+
aria-valuemin="${(x) => x.min}"
|
|
48
|
+
aria-valuemax="${(x) => x.max}"
|
|
49
|
+
class="${(x) => x.paused ? "paused" : ""} ${getClasses}"
|
|
71
50
|
>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
51
|
+
${when(
|
|
52
|
+
(x) => typeof x.value === "number",
|
|
53
|
+
html`
|
|
54
|
+
<svg
|
|
55
|
+
class="progress"
|
|
56
|
+
viewBox="0 0 16 16"
|
|
57
|
+
>
|
|
58
|
+
<circle
|
|
59
|
+
class="background"
|
|
60
|
+
cx="8px"
|
|
61
|
+
cy="8px"
|
|
62
|
+
r="7px"
|
|
63
|
+
></circle>
|
|
64
|
+
<circle
|
|
65
|
+
class="determinate"
|
|
66
|
+
style="stroke-dasharray: ${(x) => progressSegments * x.percentComplete / 100}px ${progressSegments}px"
|
|
67
|
+
cx="8px"
|
|
68
|
+
cy="8px"
|
|
69
|
+
r="7px"
|
|
70
|
+
></circle>
|
|
71
|
+
</svg>
|
|
72
|
+
`
|
|
73
|
+
)}
|
|
74
|
+
${when(
|
|
75
|
+
(x) => typeof x.value !== "number",
|
|
76
|
+
html`
|
|
77
|
+
<svg class="progress" viewBox="0 0 16 16">
|
|
78
|
+
<circle
|
|
79
|
+
class="background"
|
|
80
|
+
cx="8px"
|
|
81
|
+
cy="8px"
|
|
82
|
+
r="7px"
|
|
83
|
+
></circle>
|
|
84
|
+
<circle
|
|
85
|
+
class="indeterminate-indicator-1"
|
|
86
|
+
cx="8px"
|
|
87
|
+
cy="8px"
|
|
88
|
+
r="7px"
|
|
89
|
+
></circle>
|
|
90
|
+
</svg>
|
|
91
|
+
`
|
|
92
|
+
)}
|
|
93
|
+
</div>
|
|
94
|
+
</template>`;
|
|
79
95
|
|
|
80
|
-
const
|
|
81
|
-
baseName: "progress",
|
|
82
|
-
template:
|
|
96
|
+
const progressRingDefinition = ProgressRing.compose({
|
|
97
|
+
baseName: "progress-ring",
|
|
98
|
+
template: ProgressRingTemplate,
|
|
83
99
|
styles
|
|
84
100
|
});
|
|
85
|
-
const
|
|
86
|
-
const
|
|
101
|
+
const progressRingRegistries = [progressRingDefinition()];
|
|
102
|
+
const registerProgressRing = registerFactory(progressRingRegistries);
|
|
87
103
|
|
|
88
|
-
export {
|
|
104
|
+
export { ProgressRing as P, progressRingRegistries as a, progressRingDefinition as p, registerProgressRing as r };
|