@vonage/vivid 3.30.0 → 3.32.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/alert/index.js +2 -1
- package/checkbox/index.js +2 -1
- package/combobox/index.js +2 -1
- package/custom-elements.json +811 -18
- package/date-picker/index.js +35 -0
- package/dialog/index.js +1 -1
- package/divider/index.js +1 -1
- package/empty-state/index.js +1 -1
- package/fab/index.js +1 -1
- package/file-picker/index.js +3 -2
- package/header/index.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +48 -46
- package/layout/index.js +1 -1
- package/lib/button/button.d.ts +2 -0
- package/lib/components.d.ts +20 -19
- package/lib/date-picker/calendar/calendarGrid.d.ts +17 -0
- package/lib/date-picker/calendar/dateStr.d.ts +6 -0
- package/lib/date-picker/calendar/month.d.ts +11 -0
- package/lib/date-picker/calendar/monthPickerGrid.d.ts +10 -0
- package/lib/date-picker/calendar/presentationDate.d.ts +4 -0
- package/lib/date-picker/date-picker.d.ts +16 -0
- package/lib/date-picker/date-picker.template.d.ts +4 -0
- package/lib/date-picker/definition.d.ts +3 -0
- package/lib/date-picker/index.d.ts +1 -0
- package/lib/date-picker/locale.d.ts +21 -0
- package/lib/nav-disclosure/nav-disclosure.d.ts +1 -0
- package/lib/pagination/definition.d.ts +1 -0
- package/lib/pagination/pagination.d.ts +3 -1
- package/lib/select/select.d.ts +4 -2
- package/listbox/index.js +3 -2
- package/locales/en-GB.d.ts +3 -0
- package/locales/en-GB.js +25 -0
- package/locales/en-US.d.ts +3 -0
- package/locales/en-US.js +25 -0
- package/locales/ja-JP.d.ts +3 -0
- package/locales/ja-JP.js +25 -0
- package/locales/zh-CN.d.ts +3 -0
- package/locales/zh-CN.js +25 -0
- package/menu/index.js +2 -2
- package/menu-item/index.js +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.js +1 -1
- package/note/index.js +3 -2
- package/number-field/index.js +4 -3
- package/option/index.js +2 -1
- package/package.json +2 -1
- package/pagination/index.js +1 -1
- package/progress/index.js +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.js +1 -1
- package/select/index.js +3 -2
- package/shared/definition.js +1 -1
- package/shared/definition10.js +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition14.js +1 -1
- package/shared/definition15.js +1 -1
- package/shared/definition16.js +1 -1
- package/shared/definition17.js +1 -1
- package/shared/definition18.js +2 -2
- package/shared/definition19.js +2 -2
- package/shared/definition2.js +1 -1
- package/shared/definition21.js +3 -3
- package/shared/definition22.js +2 -2
- package/shared/definition23.js +5750 -189
- package/shared/definition24.js +116 -68
- package/shared/definition25.js +68 -38
- package/shared/definition26.js +222 -74
- package/shared/definition27.js +33 -2282
- package/shared/definition28.js +76 -47
- package/shared/definition29.js +2287 -38
- package/shared/definition30.js +39 -417
- package/shared/definition31.js +38 -364
- package/shared/definition32.js +427 -12
- package/shared/definition33.js +351 -53
- package/shared/definition34.js +12 -26
- package/shared/definition35.js +67 -31
- package/shared/definition36.js +20 -431
- package/shared/definition37.js +34 -181
- package/shared/definition38.js +427 -45
- package/shared/definition39.js +195 -33
- package/shared/definition4.js +1 -1
- package/shared/definition40.js +53 -425
- package/shared/definition41.js +29 -645
- package/shared/definition42.js +420 -73
- package/shared/definition43.js +549 -444
- package/shared/definition44.js +68 -90
- package/shared/definition45.js +501 -79
- package/shared/definition46.js +84 -45
- package/shared/definition47.js +131 -17
- package/shared/definition48.js +44 -471
- package/shared/definition49.js +21 -108
- package/shared/definition5.js +1 -1
- package/shared/definition50.js +487 -15
- package/shared/definition51.js +92 -255
- package/shared/definition52.js +16 -115
- package/shared/definition53.js +264 -115
- package/shared/definition54.js +91 -82
- package/shared/definition55.js +111 -65
- package/shared/definition56.js +64 -291
- package/shared/definition57.js +303 -0
- package/shared/definition6.js +2 -2
- package/shared/definition7.js +10 -3
- package/shared/definition9.js +1 -1
- package/shared/{form-elements.js → index2.js} +14 -2
- package/shared/localization/Locale.d.ts +4 -0
- package/shared/localization/index.d.ts +7 -0
- package/shared/patterns/form-elements/form-elements.d.ts +4 -4
- package/shared/patterns/index.d.ts +1 -0
- package/shared/patterns/localized.d.ts +4 -0
- package/shared/text-field.js +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.js +1 -1
- package/styles/core/all.css +25 -3
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +25 -3
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +14 -0
- package/switch/index.js +3 -2
- package/tab/index.js +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +3 -3
- package/tag/index.js +1 -1
- package/tag-group/index.js +1 -1
- package/text-area/index.js +3 -2
- package/text-field/index.js +3 -2
- package/toggletip/index.js +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.js +1 -1
- package/vivid.api.json +262 -0
package/shared/definition39.js
CHANGED
|
@@ -1,43 +1,205 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { a as Size, S as Shape, B as Button, b as buttonRegistries } from './definition7.js';
|
|
2
|
+
import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, o as observable, v as volatile, h as html, r as registerFactory } from './index.js';
|
|
3
|
+
import { e as elements } from './node-observation.js';
|
|
4
|
+
import { r as ref } from './ref.js';
|
|
5
|
+
import { c as children } from './children.js';
|
|
6
|
+
import { r as repeat } from './repeat.js';
|
|
6
7
|
import { c as classNames } from './class-names.js';
|
|
8
|
+
import { w as when } from './when.js';
|
|
7
9
|
|
|
8
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on
|
|
10
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 22 Aug 2023 13:37:39 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.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}";
|
|
11
|
+
|
|
12
|
+
const MAX_DIGITS_AND_PLACEHOLDERS = 7;
|
|
13
|
+
const totalConverter = {
|
|
14
|
+
fromView: value => parseInt(value, 10),
|
|
15
|
+
toView: value => value.toString()
|
|
16
|
+
};
|
|
17
|
+
class Pagination extends FoundationElement {
|
|
18
|
+
get pagesList() {
|
|
19
|
+
return new Array(this.total < MAX_DIGITS_AND_PLACEHOLDERS ? this.total : MAX_DIGITS_AND_PLACEHOLDERS).fill(0).map((_, i, arr) => {
|
|
20
|
+
if (i === 0) return 1;
|
|
21
|
+
if (i === arr.length - 1) return this.total;
|
|
22
|
+
if (this.selectedIndex !== undefined && this.total > MAX_DIGITS_AND_PLACEHOLDERS) {
|
|
23
|
+
if (this.selectedIndex < 4) {
|
|
24
|
+
if (i === MAX_DIGITS_AND_PLACEHOLDERS - 2) return '...';
|
|
25
|
+
}
|
|
26
|
+
if (this.selectedIndex >= 4 && this.selectedIndex <= this.total - 5) {
|
|
27
|
+
if (i > 1 && i < MAX_DIGITS_AND_PLACEHOLDERS - 2) return this.selectedIndex + (i - 2);
|
|
28
|
+
if (i === 1 || i === MAX_DIGITS_AND_PLACEHOLDERS - 2) return '...';
|
|
29
|
+
}
|
|
30
|
+
if (this.selectedIndex > this.total - 5) {
|
|
31
|
+
if (i > 1) return this.total - (6 - i);
|
|
32
|
+
if (i === 1) return '...';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return i + 1;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
this.navIcons = false;
|
|
41
|
+
this.total = 0;
|
|
42
|
+
this.selectedIndex = 0;
|
|
43
|
+
this.addEventListener('tabpressed', e => {
|
|
44
|
+
const {
|
|
45
|
+
value: currentLabel,
|
|
46
|
+
shiftKey
|
|
47
|
+
} = e.detail;
|
|
48
|
+
const index = this.paginationButtons.findIndex(button => Number(button.label) === currentLabel);
|
|
49
|
+
const focusDirection = shiftKey ? -1 : 1;
|
|
50
|
+
const newIndex = index + focusDirection;
|
|
51
|
+
if (newIndex < 0) {
|
|
52
|
+
return this.prevButton.focus();
|
|
53
|
+
}
|
|
54
|
+
if (newIndex > this.paginationButtons.length - 1) {
|
|
55
|
+
return this.nextButton.focus();
|
|
56
|
+
}
|
|
57
|
+
this.paginationButtons && this.paginationButtons[index + focusDirection].focus();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
totalChanged(_, newValue) {
|
|
61
|
+
if (newValue < 0) {
|
|
62
|
+
this.total = 0;
|
|
63
|
+
}
|
|
64
|
+
this.selectedIndex = 0;
|
|
65
|
+
}
|
|
66
|
+
selectedIndexChanged(oldValue, newValue) {
|
|
67
|
+
if (oldValue === undefined) return;
|
|
68
|
+
this.$emit('pagination-change', {
|
|
69
|
+
selectedIndex: newValue,
|
|
70
|
+
total: this.total,
|
|
71
|
+
oldIndex: oldValue
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
paginationButtonsChanged(_, newValue) {
|
|
75
|
+
newValue.forEach(button => {
|
|
76
|
+
button.shadowRoot.querySelector('button').classList.add('icon-only');
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
__decorate([attr, __metadata("design:type", String)], Pagination.prototype, "size", void 0);
|
|
81
|
+
__decorate([attr, __metadata("design:type", String)], Pagination.prototype, "shape", void 0);
|
|
82
|
+
__decorate([observable, __metadata("design:type", Array)], Pagination.prototype, "paginationButtons", void 0);
|
|
83
|
+
__decorate([observable, __metadata("design:type", Function)], Pagination.prototype, "prevButton", void 0);
|
|
84
|
+
__decorate([observable, __metadata("design:type", Function)], Pagination.prototype, "nextButton", void 0);
|
|
85
|
+
__decorate([attr({
|
|
86
|
+
attribute: 'nav-icons',
|
|
87
|
+
mode: 'boolean'
|
|
88
|
+
}), __metadata("design:type", Object)], Pagination.prototype, "navIcons", void 0);
|
|
89
|
+
__decorate([volatile, __metadata("design:type", Object), __metadata("design:paramtypes", [])], Pagination.prototype, "pagesList", null);
|
|
90
|
+
__decorate([attr({
|
|
91
|
+
mode: 'reflect',
|
|
92
|
+
converter: totalConverter
|
|
93
|
+
}), __metadata("design:type", Number)], Pagination.prototype, "total", void 0);
|
|
94
|
+
__decorate([attr({
|
|
95
|
+
mode: 'reflect',
|
|
96
|
+
converter: totalConverter,
|
|
97
|
+
attribute: 'selected-index'
|
|
98
|
+
}), __metadata("design:type", Object)], Pagination.prototype, "selectedIndex", void 0);
|
|
9
99
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
100
|
+
const ALLOWED_SIZES = [Size.SuperCondensed, Size.Condensed, Size.Normal];
|
|
101
|
+
const ALLOWED_SHAPES = [Shape.Rounded, Shape.Pill];
|
|
102
|
+
const handleSelection = (value, {
|
|
103
|
+
parent: x
|
|
104
|
+
}) => {
|
|
105
|
+
return x.selectedIndex = Number(value) - 1;
|
|
106
|
+
};
|
|
107
|
+
const handleKeyDown = (value, {
|
|
108
|
+
event,
|
|
109
|
+
parent
|
|
110
|
+
}) => {
|
|
111
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
112
|
+
handleSelection(value, {
|
|
113
|
+
parent
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (event.key === 'Tab') {
|
|
117
|
+
event.target.dispatchEvent(new CustomEvent('tabpressed', {
|
|
118
|
+
detail: {
|
|
119
|
+
value,
|
|
120
|
+
shiftKey: event.shiftKey
|
|
121
|
+
},
|
|
122
|
+
bubbles: true,
|
|
123
|
+
composed: true
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const getClasses = _ => classNames('control');
|
|
128
|
+
function getButtonAppearance(value, {
|
|
129
|
+
parent
|
|
130
|
+
}) {
|
|
131
|
+
return parent.selectedIndex === Number(value) - 1 ? 'filled' : 'ghost';
|
|
132
|
+
}
|
|
133
|
+
const paginationButtonRenderer = buttonTag => html`
|
|
134
|
+
${when(value => value !== '...', html`
|
|
135
|
+
<${buttonTag} class="vwc-pagination-button"
|
|
136
|
+
label="${value => value}"
|
|
137
|
+
appearance="${getButtonAppearance}"
|
|
138
|
+
size="${(_, {
|
|
139
|
+
parent: x
|
|
140
|
+
}) => getPaginationSize(x)}"
|
|
141
|
+
shape="${(_, {
|
|
142
|
+
parent: x
|
|
143
|
+
}) => getPaginationShape(x)}"
|
|
144
|
+
tabindex="0"
|
|
145
|
+
aria-pressed="${(value, {
|
|
146
|
+
parent
|
|
147
|
+
}) => parent.selectedIndex === Number(value) - 1}"
|
|
148
|
+
@click="${handleSelection}"
|
|
149
|
+
@keydown="${handleKeyDown}"
|
|
150
|
+
</${buttonTag}>
|
|
151
|
+
`)}
|
|
152
|
+
${when(value => value === '...', html`<div class="dots size-${getPaginationSize} shape-${getPaginationShape}">...</div>`)}`;
|
|
153
|
+
const getPaginationSize = x => {
|
|
154
|
+
if (!x.size || !ALLOWED_SIZES.includes(x.size)) {
|
|
155
|
+
return Size.SuperCondensed;
|
|
156
|
+
}
|
|
157
|
+
return x.size;
|
|
158
|
+
};
|
|
159
|
+
const getPaginationShape = x => {
|
|
160
|
+
if (!x.shape || !ALLOWED_SHAPES.includes(x.shape)) {
|
|
161
|
+
return Shape.Rounded;
|
|
162
|
+
}
|
|
163
|
+
return x.shape;
|
|
164
|
+
};
|
|
165
|
+
const PaginationTemplate = context => {
|
|
166
|
+
const buttonTag = context.tagFor(Button);
|
|
167
|
+
const paginationButtonTemplate = paginationButtonRenderer(buttonTag);
|
|
18
168
|
return html`
|
|
19
|
-
<div class="${getClasses}"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
169
|
+
<div class="${getClasses}">
|
|
170
|
+
<${buttonTag} class="prev-button" ${ref('prevButton')}
|
|
171
|
+
label="${x => !x.navIcons ? 'Previous' : null}"
|
|
172
|
+
icon="${x => x.navIcons ? 'chevron-left-line' : null}"
|
|
173
|
+
size="${getPaginationSize}"
|
|
174
|
+
shape="${getPaginationShape}"
|
|
175
|
+
?disabled="${x => x.total === 0 || x.selectedIndex === 0}"
|
|
176
|
+
@click="${x => x.selectedIndex !== undefined && x.selectedIndex--}"
|
|
177
|
+
></${buttonTag}>
|
|
178
|
+
<div id="buttons-wrapper" class="buttons-wrapper" ${children({
|
|
179
|
+
property: 'paginationButtons',
|
|
180
|
+
filter: elements(buttonTag)
|
|
181
|
+
})}>
|
|
182
|
+
${repeat(x => x.pagesList, paginationButtonTemplate, {
|
|
183
|
+
positioning: true
|
|
184
|
+
})}
|
|
29
185
|
</div>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
186
|
+
<${buttonTag} class="next-button" ${ref('nextButton')}
|
|
187
|
+
label="${x => !x.navIcons ? 'Next' : null}"
|
|
188
|
+
icon="${x => x.navIcons ? 'chevron-right-line' : null}"
|
|
189
|
+
size="${getPaginationSize}"
|
|
190
|
+
shape="${getPaginationShape}"
|
|
191
|
+
?disabled="${x => x.total === 0 || x.selectedIndex === x.total - 1}"
|
|
192
|
+
@click="${x => x.selectedIndex !== undefined && x.selectedIndex++}"
|
|
193
|
+
></${buttonTag}>
|
|
194
|
+
</div>`;
|
|
33
195
|
};
|
|
34
196
|
|
|
35
|
-
const
|
|
36
|
-
baseName: '
|
|
37
|
-
template:
|
|
197
|
+
const paginationDefinition = Pagination.compose({
|
|
198
|
+
baseName: 'pagination',
|
|
199
|
+
template: PaginationTemplate,
|
|
38
200
|
styles: css_248z
|
|
39
201
|
});
|
|
40
|
-
const
|
|
41
|
-
const
|
|
202
|
+
const paginationRegistries = [paginationDefinition(), buttonRegistries];
|
|
203
|
+
const registerPagination = registerFactory(paginationRegistries);
|
|
42
204
|
|
|
43
|
-
export {
|
|
205
|
+
export { paginationRegistries as a, paginationDefinition as p, registerPagination as r };
|
package/shared/definition4.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { F as Focus } from './focus.js';
|
|
3
3
|
|
|
4
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on
|
|
4
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 22 Aug 2023 13:37:39 GMT\n */\n:host {\n display: contents;\n border-radius: inherit;\n}\n\n.control {\n position: absolute;\n z-index: 1;\n box-sizing: border-box;\n border-radius: inherit;\n box-shadow: inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);\n inset: var(--focus-inset, 0);\n outline: 2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));\n outline-offset: -2px;\n}";
|
|
5
5
|
|
|
6
6
|
const focusTemplate = () => html`
|
|
7
7
|
<span class="control"></span>`;
|