@vonage/vivid 3.14.0 → 3.16.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/checkbox/index.js +3 -0
- package/custom-elements.json +250 -27
- package/empty-state/index.js +14 -0
- package/fab/index.js +1 -1
- package/header/index.js +1 -1
- package/index.js +31 -29
- package/layout/index.js +1 -1
- package/lib/checkbox/checkbox.d.ts +6 -3
- package/lib/components.d.ts +2 -0
- package/lib/data-grid/data-grid-cell.d.ts +2 -0
- package/lib/data-grid/data-grid-row.d.ts +1 -0
- package/lib/data-grid/data-grid.d.ts +1 -1
- package/lib/empty-state/definition.d.ts +3 -0
- package/lib/empty-state/empty-state.d.ts +5 -0
- package/lib/empty-state/empty-state.template.d.ts +4 -0
- package/lib/empty-state/index.d.ts +1 -0
- package/listbox/index.js +1 -1
- 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 +1 -1
- package/number-field/index.js +1 -1
- package/package.json +1 -1
- package/pagination/index.js +14 -232
- package/progress/index.js +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.js +1 -1
- package/select/index.js +1 -1
- 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 +23 -8
- package/shared/definition19.js +1 -1
- package/shared/definition2.js +1 -1
- package/shared/definition21.js +1 -1
- package/shared/definition22.js +114 -40
- package/shared/definition23.js +1 -1
- package/shared/definition24.js +1 -1
- package/shared/definition25.js +39 -76
- package/shared/definition26.js +76 -47
- package/shared/definition27.js +46 -36
- package/shared/definition28.js +39 -49
- package/shared/definition29.js +48 -344
- package/shared/definition30.js +272 -291
- package/shared/definition31.js +366 -14
- package/shared/definition32.js +13 -67
- package/shared/definition33.js +66 -21
- package/shared/definition34.js +21 -39
- package/shared/definition35.js +31 -432
- package/shared/definition36.js +432 -76
- package/shared/definition37.js +223 -34
- package/shared/definition38.js +82 -425
- package/shared/definition39.js +30 -635
- package/shared/definition4.js +1 -1
- package/shared/definition40.js +420 -73
- package/shared/definition41.js +530 -484
- package/shared/definition42.js +76 -133
- package/shared/definition43.js +577 -40
- package/shared/definition44.js +135 -20
- package/shared/definition45.js +42 -423
- package/shared/definition46.js +22 -112
- package/shared/definition47.js +440 -18
- package/shared/definition48.js +92 -247
- package/shared/definition49.js +20 -112
- package/shared/definition5.js +1 -1
- package/shared/definition50.js +259 -590
- package/shared/definition51.js +110 -91
- package/shared/definition52.js +626 -67
- package/shared/definition53.js +111 -292
- package/shared/definition54.js +80 -0
- package/shared/definition55.js +305 -0
- package/shared/definition6.js +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition9.js +1 -1
- package/shared/form-elements.js +1 -1
- package/shared/icon.js +1 -1
- package/shared/patterns/form-elements/form-elements.d.ts +4 -4
- package/shared/text-field.js +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.js +1 -1
- 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/switch/index.js +1 -1
- 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 +1 -1
- package/text-field/index.js +1 -1
- 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 +210 -0
package/shared/definition37.js
CHANGED
|
@@ -1,45 +1,234 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
import { B as Button, b as buttonRegistries } from './definition7.js';
|
|
2
|
+
import { x as global$1, j as fails$1, i as functionUncurryThis, G as _export, F as FoundationElement, _ as __decorate, a as attr, b as __metadata, o as observable, W as volatile, h as html, r as registerFactory } from './index.js';
|
|
3
|
+
import { t as toString$1 } from './to-string.js';
|
|
4
|
+
import { w as whitespaces$1, s as stringTrim } from './string-trim.js';
|
|
5
|
+
import './es.regexp.to-string.js';
|
|
6
|
+
import './es.string.includes.js';
|
|
7
|
+
import { a as Size } from './enums.js';
|
|
8
|
+
import { e as elements } from './node-observation.js';
|
|
9
|
+
import { r as ref } from './ref.js';
|
|
10
|
+
import { r as repeat } from './repeat.js';
|
|
11
|
+
import { c as children } from './children.js';
|
|
6
12
|
import { c as classNames } from './class-names.js';
|
|
13
|
+
import { w as when } from './when.js';
|
|
14
|
+
|
|
15
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 07 Jun 2023 09:55:04 GMT\n */\n.control {\n display: inline-flex;\n justify-content: space-between;\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}";
|
|
16
|
+
|
|
17
|
+
var global = global$1;
|
|
18
|
+
var fails = fails$1;
|
|
19
|
+
var uncurryThis = functionUncurryThis;
|
|
20
|
+
var toString = toString$1;
|
|
21
|
+
var trim = stringTrim.trim;
|
|
22
|
+
var whitespaces = whitespaces$1;
|
|
7
23
|
|
|
8
|
-
var
|
|
24
|
+
var $parseInt$1 = global.parseInt;
|
|
25
|
+
var Symbol = global.Symbol;
|
|
26
|
+
var ITERATOR = Symbol && Symbol.iterator;
|
|
27
|
+
var hex = /^[+-]?0x/i;
|
|
28
|
+
var exec = uncurryThis(hex.exec);
|
|
29
|
+
var FORCED = $parseInt$1(whitespaces + '08') !== 8 || $parseInt$1(whitespaces + '0x16') !== 22
|
|
30
|
+
// MS Edge 18- broken with boxed symbols
|
|
31
|
+
|| (ITERATOR && !fails(function () { $parseInt$1(Object(ITERATOR)); }));
|
|
9
32
|
|
|
10
|
-
|
|
33
|
+
// `parseInt` method
|
|
34
|
+
// https://tc39.es/ecma262/#sec-parseint-string-radix
|
|
35
|
+
var numberParseInt = FORCED ? function parseInt(string, radix) {
|
|
36
|
+
var S = trim(toString(string));
|
|
37
|
+
return $parseInt$1(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
|
|
38
|
+
} : $parseInt$1;
|
|
39
|
+
|
|
40
|
+
var $ = _export;
|
|
41
|
+
var $parseInt = numberParseInt;
|
|
42
|
+
|
|
43
|
+
// `parseInt` method
|
|
44
|
+
// https://tc39.es/ecma262/#sec-parseint-string-radix
|
|
45
|
+
$({ global: true, forced: parseInt != $parseInt }, {
|
|
46
|
+
parseInt: $parseInt
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const MAX_DIGITS_AND_PLACEHOLDERS = 7;
|
|
50
|
+
const totalConverter = {
|
|
51
|
+
fromView: value => parseInt(value, 10),
|
|
52
|
+
toView: value => value.toString()
|
|
53
|
+
};
|
|
54
|
+
class Pagination extends FoundationElement {
|
|
55
|
+
constructor() {
|
|
56
|
+
super();
|
|
57
|
+
this.navIcons = false;
|
|
58
|
+
this.total = 0;
|
|
59
|
+
this.selectedIndex = 0;
|
|
60
|
+
this.addEventListener('tabpressed', e => {
|
|
61
|
+
const {
|
|
62
|
+
value: currentLabel,
|
|
63
|
+
shiftKey
|
|
64
|
+
} = e.detail;
|
|
65
|
+
const index = this.paginationButtons.findIndex(button => Number(button.label) === currentLabel);
|
|
66
|
+
const focusDirection = shiftKey ? -1 : 1;
|
|
67
|
+
const newIndex = index + focusDirection;
|
|
68
|
+
if (newIndex < 0) {
|
|
69
|
+
return this.prevButton.focus();
|
|
70
|
+
}
|
|
71
|
+
if (newIndex > this.paginationButtons.length - 1) {
|
|
72
|
+
return this.nextButton.focus();
|
|
73
|
+
}
|
|
74
|
+
this.paginationButtons && this.paginationButtons[index + focusDirection].focus();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
get pagesList() {
|
|
78
|
+
return new Array(this.total < MAX_DIGITS_AND_PLACEHOLDERS ? this.total : MAX_DIGITS_AND_PLACEHOLDERS).fill(0).map((_, i, arr) => {
|
|
79
|
+
if (i === 0) return 1;
|
|
80
|
+
if (i === arr.length - 1) return this.total;
|
|
81
|
+
if (this.selectedIndex !== undefined && this.total > MAX_DIGITS_AND_PLACEHOLDERS) {
|
|
82
|
+
if (this.selectedIndex < 4) {
|
|
83
|
+
if (i === MAX_DIGITS_AND_PLACEHOLDERS - 2) return '...';
|
|
84
|
+
}
|
|
85
|
+
if (this.selectedIndex >= 4 && this.selectedIndex <= this.total - 5) {
|
|
86
|
+
if (i > 1 && i < MAX_DIGITS_AND_PLACEHOLDERS - 2) return this.selectedIndex + (i - 2);
|
|
87
|
+
if (i === 1 || i === MAX_DIGITS_AND_PLACEHOLDERS - 2) return '...';
|
|
88
|
+
}
|
|
89
|
+
if (this.selectedIndex > this.total - 5) {
|
|
90
|
+
if (i > 1) return this.total - (6 - i);
|
|
91
|
+
if (i === 1) return '...';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return i + 1;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
totalChanged(_, newValue) {
|
|
98
|
+
if (newValue < 0) {
|
|
99
|
+
this.total = 0;
|
|
100
|
+
}
|
|
101
|
+
this.selectedIndex = 0;
|
|
102
|
+
}
|
|
103
|
+
selectedIndexChanged(oldValue, newValue) {
|
|
104
|
+
if (oldValue === undefined) return;
|
|
105
|
+
this.$emit('pagination-change', {
|
|
106
|
+
selectedIndex: newValue,
|
|
107
|
+
total: this.total,
|
|
108
|
+
oldIndex: oldValue
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
paginationButtonsChanged(_, newValue) {
|
|
112
|
+
newValue.forEach(button => {
|
|
113
|
+
button.shadowRoot.querySelector('button').classList.add('icon-only');
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
__decorate([attr, __metadata("design:type", String)], Pagination.prototype, "size", void 0);
|
|
118
|
+
__decorate([observable, __metadata("design:type", Array)], Pagination.prototype, "paginationButtons", void 0);
|
|
119
|
+
__decorate([observable, __metadata("design:type", Function)], Pagination.prototype, "prevButton", void 0);
|
|
120
|
+
__decorate([observable, __metadata("design:type", Function)], Pagination.prototype, "nextButton", void 0);
|
|
121
|
+
__decorate([attr({
|
|
122
|
+
attribute: 'nav-icons',
|
|
123
|
+
mode: 'boolean'
|
|
124
|
+
}), __metadata("design:type", Object)], Pagination.prototype, "navIcons", void 0);
|
|
125
|
+
__decorate([volatile, __metadata("design:type", Object), __metadata("design:paramtypes", [])], Pagination.prototype, "pagesList", null);
|
|
126
|
+
__decorate([attr({
|
|
127
|
+
mode: 'reflect',
|
|
128
|
+
converter: totalConverter
|
|
129
|
+
}), __metadata("design:type", Number)], Pagination.prototype, "total", void 0);
|
|
130
|
+
__decorate([attr({
|
|
131
|
+
mode: 'reflect',
|
|
132
|
+
converter: totalConverter,
|
|
133
|
+
attribute: 'selected-index'
|
|
134
|
+
}), __metadata("design:type", Object)], Pagination.prototype, "selectedIndex", void 0);
|
|
135
|
+
|
|
136
|
+
let _2 = t => t,
|
|
11
137
|
_t,
|
|
12
|
-
_t2
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
138
|
+
_t2,
|
|
139
|
+
_t3,
|
|
140
|
+
_t4;
|
|
141
|
+
const ALLOWED_SIZES = [Size.SuperCondensed, Size.Condensed, Size.Normal];
|
|
142
|
+
const handleSelection = (value, {
|
|
143
|
+
parent: x
|
|
144
|
+
}) => {
|
|
145
|
+
return x.selectedIndex = Number(value) - 1;
|
|
146
|
+
};
|
|
147
|
+
const handleKeyDown = (value, {
|
|
148
|
+
event,
|
|
149
|
+
parent
|
|
150
|
+
}) => {
|
|
151
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
152
|
+
handleSelection(value, {
|
|
153
|
+
parent
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (event.key === 'Tab') {
|
|
157
|
+
event.target.dispatchEvent(new CustomEvent('tabpressed', {
|
|
158
|
+
detail: {
|
|
159
|
+
value,
|
|
160
|
+
shiftKey: event.shiftKey
|
|
161
|
+
},
|
|
162
|
+
bubbles: true,
|
|
163
|
+
composed: true
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const getClasses = _ => classNames('control');
|
|
168
|
+
function getButtonAppearance(value, {
|
|
169
|
+
parent
|
|
170
|
+
}) {
|
|
171
|
+
return parent.selectedIndex === Number(value) - 1 ? 'filled' : 'ghost';
|
|
172
|
+
}
|
|
173
|
+
const paginationButtonRenderer = buttonTag => html(_t || (_t = _2`
|
|
174
|
+
${0}
|
|
175
|
+
${0}`), when(value => value !== '...', html(_t2 || (_t2 = _2`
|
|
176
|
+
<${0} class="vwc-pagination-button"
|
|
177
|
+
label="${0}"
|
|
178
|
+
appearance="${0}"
|
|
179
|
+
size="${0}"
|
|
180
|
+
tabindex="0"
|
|
181
|
+
aria-pressed="${0}"
|
|
182
|
+
@click="${0}"
|
|
183
|
+
@keydown="${0}"
|
|
184
|
+
</${0}>
|
|
185
|
+
`), buttonTag, value => value, getButtonAppearance, (_, {
|
|
186
|
+
parent: x
|
|
187
|
+
}) => getPaginationSize(x), (value, {
|
|
188
|
+
parent
|
|
189
|
+
}) => parent.selectedIndex === Number(value) - 1, handleSelection, handleKeyDown, buttonTag)), when(value => value === '...', html(_t3 || (_t3 = _2`<div class="dots size-${0}">...</div>`), getPaginationSize)));
|
|
190
|
+
const getPaginationSize = x => {
|
|
191
|
+
if (!x.size || !ALLOWED_SIZES.includes(x.size)) {
|
|
192
|
+
return Size.SuperCondensed;
|
|
193
|
+
}
|
|
194
|
+
return x.size;
|
|
195
|
+
};
|
|
196
|
+
const PaginationTemplate = context => {
|
|
197
|
+
const buttonTag = context.tagFor(Button);
|
|
198
|
+
const paginationButtonTemplate = paginationButtonRenderer(buttonTag);
|
|
199
|
+
return html(_t4 || (_t4 = _2`
|
|
200
|
+
<div class="${0}">
|
|
201
|
+
<${0} class="prev-button" ${0}
|
|
202
|
+
label="${0}"
|
|
203
|
+
icon="${0}"
|
|
204
|
+
size="${0}"
|
|
205
|
+
?disabled="${0}"
|
|
206
|
+
@click="${0}"
|
|
207
|
+
></${0}>
|
|
208
|
+
<div id="buttons-wrapper" class="buttons-wrapper" ${0}>
|
|
30
209
|
${0}
|
|
31
210
|
</div>
|
|
32
|
-
${0}
|
|
33
|
-
|
|
34
|
-
|
|
211
|
+
<${0} class="next-button" ${0}
|
|
212
|
+
label="${0}"
|
|
213
|
+
icon="${0}"
|
|
214
|
+
size="${0}"
|
|
215
|
+
?disabled="${0}"
|
|
216
|
+
@click="${0}"
|
|
217
|
+
></${0}>
|
|
218
|
+
</div>`), getClasses, buttonTag, ref('prevButton'), x => !x.navIcons ? 'Previous' : null, x => x.navIcons ? 'chevron-left-line' : null, getPaginationSize, x => x.total === 0 || x.selectedIndex === 0, x => x.selectedIndex !== undefined && x.selectedIndex--, buttonTag, children({
|
|
219
|
+
property: 'paginationButtons',
|
|
220
|
+
filter: elements(buttonTag)
|
|
221
|
+
}), repeat(x => x.pagesList, paginationButtonTemplate, {
|
|
222
|
+
positioning: true
|
|
223
|
+
}), buttonTag, ref('nextButton'), x => !x.navIcons ? 'Next' : null, x => x.navIcons ? 'chevron-right-line' : null, getPaginationSize, x => x.total === 0 || x.selectedIndex === x.total - 1, x => x.selectedIndex !== undefined && x.selectedIndex++, buttonTag);
|
|
35
224
|
};
|
|
36
225
|
|
|
37
|
-
const
|
|
38
|
-
baseName: '
|
|
39
|
-
template:
|
|
226
|
+
const paginationDefinition = Pagination.compose({
|
|
227
|
+
baseName: 'pagination',
|
|
228
|
+
template: PaginationTemplate,
|
|
40
229
|
styles: css_248z
|
|
41
230
|
});
|
|
42
|
-
const
|
|
43
|
-
const
|
|
231
|
+
const paginationRegistries = [paginationDefinition(), buttonRegistries];
|
|
232
|
+
const registerPagination = registerFactory(paginationRegistries);
|
|
44
233
|
|
|
45
|
-
export {
|
|
234
|
+
export { paginationRegistries as a, paginationDefinition as p, registerPagination as r };
|