@vonage/vivid 4.12.0 → 4.12.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/custom-elements.json +851 -60
- package/lib/accordion/accordion.d.ts +21 -2
- package/lib/accordion-item/accordion-item.d.ts +6 -2
- package/lib/calendar/calendar.d.ts +1 -1
- package/lib/date-picker/date-picker.d.ts +1 -0
- package/lib/radio/radio.d.ts +12 -2
- package/lib/radio/radio.form-associated.d.ts +10 -0
- package/lib/radio-group/radio-group.d.ts +20 -2
- package/lib/tab/tab.d.ts +3 -2
- package/lib/tab-panel/tab-panel.d.ts +2 -2
- package/lib/tabs/tabs.d.ts +30 -9
- package/package.json +1 -1
- package/shared/date-picker/date-picker-base.d.ts +1 -0
- package/shared/definition.cjs +29 -72
- package/shared/definition.js +30 -73
- package/shared/definition16.cjs +1 -2
- package/shared/definition16.js +1 -2
- package/shared/definition17.cjs +2 -2
- package/shared/definition17.js +2 -2
- package/shared/definition18.cjs +6 -1
- package/shared/definition18.js +6 -1
- package/shared/definition19.cjs +17 -8
- package/shared/definition19.js +17 -8
- package/shared/definition2.cjs +154 -187
- package/shared/definition2.js +157 -190
- package/shared/definition20.cjs +1 -1
- package/shared/definition20.js +1 -1
- package/shared/definition29.cjs +2 -2
- package/shared/definition29.js +2 -2
- package/shared/definition35.cjs +1 -1
- package/shared/definition35.js +1 -1
- package/shared/definition40.cjs +226 -399
- package/shared/definition40.js +229 -402
- package/shared/definition42.cjs +3 -2
- package/shared/definition42.js +3 -2
- package/shared/definition43.cjs +1 -0
- package/shared/definition43.js +1 -0
- package/shared/definition44.cjs +1 -1
- package/shared/definition44.js +1 -1
- package/shared/definition47.cjs +3 -2
- package/shared/definition47.js +3 -2
- package/shared/definition49.cjs +1 -1
- package/shared/definition49.js +1 -1
- package/shared/definition5.cjs +1 -1
- package/shared/definition5.js +1 -1
- package/shared/definition50.cjs +1 -11
- package/shared/definition50.js +1 -11
- package/shared/definition51.cjs +4 -14
- package/shared/definition51.js +5 -15
- package/shared/definition52.cjs +269 -19
- package/shared/definition52.js +273 -23
- package/shared/definition57.cjs +26 -4
- package/shared/definition57.js +27 -5
- package/shared/definition61.cjs +1 -1
- package/shared/definition61.js +1 -1
- package/shared/definition62.cjs +17 -8
- package/shared/definition62.js +17 -8
- package/shared/form-associated.cjs +1 -1
- package/shared/form-associated.js +1 -1
- package/shared/icon.cjs +1 -1
- package/shared/icon.js +1 -1
- package/shared/index.cjs +1 -0
- package/shared/index.js +1 -1
- package/shared/key-codes.cjs +1 -94
- package/shared/key-codes.js +2 -89
- package/shared/key-codes2.cjs +87 -1
- package/shared/key-codes2.js +83 -2
- package/shared/listbox.cjs +6 -7
- package/shared/listbox.js +3 -4
- package/shared/numbers.cjs +0 -12
- package/shared/numbers.js +1 -12
- package/shared/presentationDate.cjs +14 -0
- package/shared/presentationDate.js +15 -1
- package/shared/radio.cjs +92 -117
- package/shared/radio.js +93 -118
- package/shared/slider.template.cjs +2 -15
- package/shared/slider.template.js +2 -14
- package/shared/strings.cjs +26 -0
- package/shared/strings.js +25 -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/styles/tokens/vivid-2-compat.css +1 -1
package/shared/definition19.js
CHANGED
|
@@ -132,6 +132,22 @@ let DateRangePicker = class extends DatePickerBase {
|
|
|
132
132
|
currentEndChanged() {
|
|
133
133
|
this.end = this.currentEnd;
|
|
134
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* @internal
|
|
137
|
+
*/
|
|
138
|
+
_updatePresentationValue() {
|
|
139
|
+
if (this.start && this.end) {
|
|
140
|
+
this._presentationValue = formatPresentationDateRange(
|
|
141
|
+
{
|
|
142
|
+
start: this.start,
|
|
143
|
+
end: this.end
|
|
144
|
+
},
|
|
145
|
+
this.locale.datePicker
|
|
146
|
+
);
|
|
147
|
+
} else {
|
|
148
|
+
this._presentationValue = "";
|
|
149
|
+
}
|
|
150
|
+
}
|
|
135
151
|
/**
|
|
136
152
|
* @internal
|
|
137
153
|
*/
|
|
@@ -333,18 +349,11 @@ handleChangedValues_fn = function() {
|
|
|
333
349
|
__privateMethod(this, _DateRangePicker_instances, updateValues_fn).call(this, { start: this.end, end: this.start });
|
|
334
350
|
return;
|
|
335
351
|
}
|
|
336
|
-
this._presentationValue = formatPresentationDateRange(
|
|
337
|
-
{
|
|
338
|
-
start: this.start,
|
|
339
|
-
end: this.end
|
|
340
|
-
},
|
|
341
|
-
this.locale.datePicker
|
|
342
|
-
);
|
|
343
352
|
this.value = formatRange(this.start, this.end);
|
|
344
353
|
} else {
|
|
345
354
|
this.value = "";
|
|
346
|
-
this._presentationValue = "";
|
|
347
355
|
}
|
|
356
|
+
this._updatePresentationValue();
|
|
348
357
|
const dateToEnsureVisibilityOf = this.start || this.end;
|
|
349
358
|
if (dateToEnsureVisibilityOf) {
|
|
350
359
|
this._adjustSelectedMonthToEnsureVisibilityOf(dateToEnsureVisibilityOf);
|
package/shared/definition2.cjs
CHANGED
|
@@ -7,201 +7,161 @@ const numbers = require('./numbers.cjs');
|
|
|
7
7
|
const slotted = require('./slotted.cjs');
|
|
8
8
|
const classNames = require('./class-names.cjs');
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const styles = ".base{display:flex;box-sizing:border-box;flex-direction:column}::slotted(:not(:only-of-type)){border-bottom:1px solid var(--vvd-color-neutral-200)}";
|
|
11
|
+
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
14
|
+
var result = void 0 ;
|
|
15
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16
|
+
if (decorator = decorators[i])
|
|
17
|
+
result = (decorator(target, key, result) ) || result;
|
|
18
|
+
if (result) __defProp(target, key, result);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
14
21
|
const AccordionExpandMode = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Designates only a single {@link @microsoft/fast-foundation#(AccordionItem:class) } can be open a time.
|
|
24
|
+
*/
|
|
25
|
+
single: "single",
|
|
26
|
+
/**
|
|
27
|
+
* Designates multiple {@link @microsoft/fast-foundation#(AccordionItem:class) | AccordionItems} can be open simultaneously.
|
|
28
|
+
*/
|
|
29
|
+
multi: "multi"
|
|
23
30
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.change = () => {
|
|
49
|
-
this.$emit("change", this.activeid);
|
|
50
|
-
};
|
|
51
|
-
this.setItems = () => {
|
|
52
|
-
var _a;
|
|
53
|
-
if (this.accordionItems.length === 0) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
this.accordionIds = this.getItemIds();
|
|
57
|
-
this.accordionItems.forEach((item, index) => {
|
|
58
|
-
if (item instanceof definition.AccordionItem) {
|
|
59
|
-
item.addEventListener("change", this.activeItemChange);
|
|
60
|
-
if (this.isSingleExpandMode()) {
|
|
61
|
-
this.activeItemIndex !== index
|
|
62
|
-
? (item.expanded = false)
|
|
63
|
-
: (item.expanded = true);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const itemId = this.accordionIds[index];
|
|
67
|
-
item.setAttribute("id", typeof itemId !== "string" ? `accordion-${index + 1}` : itemId);
|
|
68
|
-
this.activeid = this.accordionIds[this.activeItemIndex];
|
|
69
|
-
item.addEventListener("keydown", this.handleItemKeyDown);
|
|
70
|
-
item.addEventListener("focus", this.handleItemFocus);
|
|
71
|
-
});
|
|
72
|
-
if (this.isSingleExpandMode()) {
|
|
73
|
-
const expandedItem = (_a = this.findExpandedItem()) !== null && _a !== void 0 ? _a : this.accordionItems[0];
|
|
74
|
-
expandedItem.setAttribute("aria-disabled", "true");
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
this.removeItemListeners = (oldValue) => {
|
|
78
|
-
oldValue.forEach((item, index) => {
|
|
79
|
-
item.removeEventListener("change", this.activeItemChange);
|
|
80
|
-
item.removeEventListener("keydown", this.handleItemKeyDown);
|
|
81
|
-
item.removeEventListener("focus", this.handleItemFocus);
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
this.activeItemChange = (event) => {
|
|
85
|
-
if (event.defaultPrevented || event.target !== event.currentTarget) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
event.preventDefault();
|
|
89
|
-
const selectedItem = event.target;
|
|
90
|
-
this.activeid = selectedItem.getAttribute("id");
|
|
91
|
-
if (this.isSingleExpandMode()) {
|
|
92
|
-
this.resetItems();
|
|
93
|
-
selectedItem.expanded = true;
|
|
94
|
-
selectedItem.setAttribute("aria-disabled", "true");
|
|
95
|
-
this.accordionItems.forEach((item) => {
|
|
96
|
-
if (!item.hasAttribute("disabled") && item.id !== this.activeid) {
|
|
97
|
-
item.removeAttribute("aria-disabled");
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
this.activeItemIndex = Array.from(this.accordionItems).indexOf(selectedItem);
|
|
102
|
-
this.change();
|
|
103
|
-
};
|
|
104
|
-
this.handleItemKeyDown = (event) => {
|
|
105
|
-
// only handle the keydown if the event target is the accordion item
|
|
106
|
-
// prevents arrow keys from moving focus to accordion headers when focus is on accordion item panel content
|
|
107
|
-
if (event.target !== event.currentTarget) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
this.accordionIds = this.getItemIds();
|
|
111
|
-
switch (event.key) {
|
|
112
|
-
case keyCodes.keyArrowUp:
|
|
113
|
-
event.preventDefault();
|
|
114
|
-
this.adjust(-1);
|
|
115
|
-
break;
|
|
116
|
-
case keyCodes.keyArrowDown:
|
|
117
|
-
event.preventDefault();
|
|
118
|
-
this.adjust(1);
|
|
119
|
-
break;
|
|
120
|
-
case keyCodes.keyHome:
|
|
121
|
-
this.activeItemIndex = 0;
|
|
122
|
-
this.focusItem();
|
|
123
|
-
break;
|
|
124
|
-
case keyCodes.keyEnd:
|
|
125
|
-
this.activeItemIndex = this.accordionItems.length - 1;
|
|
126
|
-
this.focusItem();
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
this.handleItemFocus = (event) => {
|
|
131
|
-
// update the active item index if the focus moves to an accordion item via a different method other than the up and down arrow key actions
|
|
132
|
-
// only do so if the focus is actually on the accordion item and not on any of its children
|
|
133
|
-
if (event.target === event.currentTarget) {
|
|
134
|
-
const focusedItem = event.target;
|
|
135
|
-
const focusedIndex = (this.activeItemIndex = Array.from(this.accordionItems).indexOf(focusedItem));
|
|
136
|
-
if (this.activeItemIndex !== focusedIndex && focusedIndex !== -1) {
|
|
137
|
-
this.activeItemIndex = focusedIndex;
|
|
138
|
-
this.activeid = this.accordionIds[this.activeItemIndex];
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* @internal
|
|
145
|
-
*/
|
|
146
|
-
accordionItemsChanged(oldValue, newValue) {
|
|
147
|
-
if (this.$fastController.isConnected) {
|
|
148
|
-
this.removeItemListeners(oldValue);
|
|
149
|
-
this.setItems();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
findExpandedItem() {
|
|
153
|
-
for (let item = 0; item < this.accordionItems.length; item++) {
|
|
154
|
-
if (this.accordionItems[item].getAttribute("expanded") === "true") {
|
|
155
|
-
return this.accordionItems[item];
|
|
31
|
+
class Accordion extends index.FoundationElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
/* eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value */
|
|
35
|
+
this.expandmode = AccordionExpandMode.single;
|
|
36
|
+
this.activeItemIndex = 0;
|
|
37
|
+
this.change = () => {
|
|
38
|
+
this.$emit("change", this.activeid);
|
|
39
|
+
};
|
|
40
|
+
this.setItems = () => {
|
|
41
|
+
if (this.accordionItems.length === 0) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.accordionIds = this.getItemIds();
|
|
45
|
+
this.activeid = this.accordionIds[this.activeItemIndex];
|
|
46
|
+
this.accordionItems.forEach((item, index) => {
|
|
47
|
+
if (item instanceof definition.AccordionItem) {
|
|
48
|
+
item.addEventListener("change", this.activeItemChange);
|
|
49
|
+
if (this.isSingleExpandMode()) {
|
|
50
|
+
const expandedItem = this.findExpandedItem();
|
|
51
|
+
if (expandedItem === null && index === 0) {
|
|
52
|
+
item.expanded = true;
|
|
53
|
+
} else {
|
|
54
|
+
item !== this.findExpandedItem() ? item.expanded = false : item.expanded = true;
|
|
156
55
|
}
|
|
56
|
+
}
|
|
157
57
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
58
|
+
const itemId = this.accordionIds[index];
|
|
59
|
+
item.setAttribute(
|
|
60
|
+
"id",
|
|
61
|
+
typeof itemId !== "string" ? `accordion-${index + 1}` : itemId
|
|
62
|
+
);
|
|
63
|
+
item.addEventListener("keydown", this.handleItemKeyDown);
|
|
64
|
+
});
|
|
65
|
+
if (this.isSingleExpandMode()) {
|
|
66
|
+
const expandedItem = this.findExpandedItem() ?? this.accordionItems[0];
|
|
67
|
+
expandedItem.setAttribute("aria-disabled", "true");
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
this.removeItemListeners = (oldValue) => {
|
|
71
|
+
oldValue.forEach((item) => {
|
|
72
|
+
item.removeEventListener("change", this.activeItemChange);
|
|
73
|
+
item.removeEventListener("keydown", this.handleItemKeyDown);
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
this.activeItemChange = (event) => {
|
|
77
|
+
if (event.defaultPrevented || event.target !== event.currentTarget) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
const selectedItem = event.target;
|
|
82
|
+
this.activeid = selectedItem.getAttribute("id");
|
|
83
|
+
if (this.isSingleExpandMode()) {
|
|
84
|
+
this.resetItems();
|
|
85
|
+
selectedItem.expanded = true;
|
|
86
|
+
selectedItem.setAttribute("aria-disabled", "true");
|
|
87
|
+
this.accordionItems.forEach((item) => {
|
|
88
|
+
if (!item.hasAttribute("disabled") && item.id !== this.activeid) {
|
|
89
|
+
item.removeAttribute("aria-disabled");
|
|
90
|
+
}
|
|
168
91
|
});
|
|
92
|
+
}
|
|
93
|
+
this.activeItemIndex = Array.from(this.accordionItems).indexOf(
|
|
94
|
+
selectedItem
|
|
95
|
+
);
|
|
96
|
+
this.change();
|
|
97
|
+
};
|
|
98
|
+
this.handleItemKeyDown = (event) => {
|
|
99
|
+
if (event.target !== event.currentTarget) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
this.accordionIds = this.getItemIds();
|
|
103
|
+
switch (event.key) {
|
|
104
|
+
case keyCodes.keyArrowUp:
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
this.adjust(event.target, -1);
|
|
107
|
+
break;
|
|
108
|
+
case keyCodes.keyArrowDown:
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
this.adjust(event.target, 1);
|
|
111
|
+
break;
|
|
112
|
+
case keyCodes.keyHome:
|
|
113
|
+
this.focusItem(0);
|
|
114
|
+
break;
|
|
115
|
+
case keyCodes.keyEnd:
|
|
116
|
+
this.focusItem(this.accordionItems.length - 1);
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
accordionItemsChanged(oldValue) {
|
|
125
|
+
if (this.$fastController.isConnected) {
|
|
126
|
+
this.removeItemListeners(oldValue);
|
|
127
|
+
this.setItems();
|
|
169
128
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
129
|
+
}
|
|
130
|
+
findExpandedItem() {
|
|
131
|
+
for (let item = 0; item < this.accordionItems.length; item++) {
|
|
132
|
+
if (this.accordionItems[item].hasAttribute("expanded") === true) {
|
|
133
|
+
return this.accordionItems[item];
|
|
134
|
+
}
|
|
176
135
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
resetItems() {
|
|
139
|
+
this.accordionItems.forEach((item) => {
|
|
140
|
+
item.expanded = false;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
getItemIds() {
|
|
144
|
+
return this.accordionItems.map((accordionItem) => {
|
|
145
|
+
return accordionItem.getAttribute("id");
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
isSingleExpandMode() {
|
|
149
|
+
return this.expandmode !== AccordionExpandMode.multi;
|
|
150
|
+
}
|
|
151
|
+
adjust(item, adjustment) {
|
|
152
|
+
this.focusItem(
|
|
153
|
+
numbers.wrapInBounds(
|
|
154
|
+
0,
|
|
155
|
+
this.accordionItems.length - 1,
|
|
156
|
+
this.accordionItems.indexOf(item) + adjustment
|
|
157
|
+
)
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
focusItem(index) {
|
|
161
|
+
const element = this.accordionItems[index];
|
|
162
|
+
if (element instanceof definition.AccordionItem) {
|
|
163
|
+
element.expandbutton.focus();
|
|
182
164
|
}
|
|
183
|
-
};
|
|
184
|
-
index.__decorate([
|
|
185
|
-
index.attr({ attribute: "expand-mode" })
|
|
186
|
-
], Accordion$1.prototype, "expandmode", void 0);
|
|
187
|
-
index.__decorate([
|
|
188
|
-
index.observable
|
|
189
|
-
], Accordion$1.prototype, "accordionItems", void 0);
|
|
190
|
-
|
|
191
|
-
const styles = ".base{display:flex;box-sizing:border-box;flex-direction:column}::slotted(:not(:only-of-type)){border-bottom:1px solid var(--vvd-color-neutral-200)}";
|
|
192
|
-
|
|
193
|
-
class Accordion extends Accordion$1 {
|
|
194
|
-
constructor() {
|
|
195
|
-
super(...arguments);
|
|
196
|
-
/**
|
|
197
|
-
* Controls the expand mode of the Accordion, either allowing
|
|
198
|
-
* single or multiple item expansion.
|
|
199
|
-
* @public
|
|
200
|
-
*
|
|
201
|
-
* @remarks
|
|
202
|
-
* HTML attribute: expand-mode
|
|
203
|
-
*/
|
|
204
|
-
this.expandmode = AccordionExpandMode.single;
|
|
205
165
|
}
|
|
206
166
|
closeAll() {
|
|
207
167
|
if (this.expandmode === AccordionExpandMode.multi) {
|
|
@@ -211,6 +171,13 @@ class Accordion extends Accordion$1 {
|
|
|
211
171
|
}
|
|
212
172
|
}
|
|
213
173
|
}
|
|
174
|
+
__decorateClass([
|
|
175
|
+
index.attr({ attribute: "expand-mode" })
|
|
176
|
+
], Accordion.prototype, "expandmode");
|
|
177
|
+
// @ts-expect-error Type is incorrectly non-optional
|
|
178
|
+
__decorateClass([
|
|
179
|
+
index.observable
|
|
180
|
+
], Accordion.prototype, "accordionItems");
|
|
214
181
|
|
|
215
182
|
const getClasses = (_) => classNames.classNames("base");
|
|
216
183
|
const AccordionTemplate = () => index.html`
|