@vonage/vivid 4.14.2 → 4.14.4
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 +1361 -1017
- package/index.cjs +1 -0
- package/index.js +1 -1
- package/lib/accordion/definition.d.ts +5 -1
- package/lib/combobox/combobox.d.ts +5 -1
- package/lib/file-picker/file-picker.d.ts +1 -0
- package/lib/menu-item/definition.d.ts +1 -1
- package/lib/menu-item/menu-item-role.d.ts +7 -0
- package/lib/menu-item/menu-item.d.ts +1 -7
- package/lib/number-field/number-field.d.ts +1 -1
- package/lib/option/option.d.ts +6 -0
- package/lib/radio/radio.d.ts +2 -2
- package/lib/searchable-select/option-tag.d.ts +2 -2
- package/lib/select/select.form-associated.d.ts +1 -1
- package/lib/switch/switch.d.ts +1 -0
- package/lib/tabs/tabs.d.ts +5 -1
- package/lib/text-anchor/text-anchor.d.ts +1 -1
- package/lib/tree-item/tree-item.d.ts +1 -1
- package/lib/tree-view/tree-view.d.ts +1 -1
- package/package.json +1 -1
- package/shared/applyMixinsWithObservables.cjs +1 -1
- package/shared/applyMixinsWithObservables.js +1 -1
- package/shared/definition11.cjs +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition16.cjs +63 -30
- package/shared/definition16.js +61 -28
- package/shared/definition17.cjs +2 -2
- package/shared/definition17.js +2 -2
- package/shared/definition2.cjs +11 -6
- package/shared/definition2.js +11 -7
- package/shared/definition25.cjs +25 -18
- package/shared/definition25.js +26 -19
- package/shared/definition29.cjs +12 -33
- package/shared/definition29.js +12 -33
- package/shared/definition33.cjs +1 -1
- package/shared/definition33.js +1 -1
- package/shared/definition34.cjs +4 -294
- package/shared/definition34.js +4 -294
- package/shared/definition41.cjs +1 -1
- package/shared/definition41.js +1 -1
- package/shared/definition42.cjs +1 -2
- package/shared/definition42.js +1 -2
- package/shared/definition43.cjs +1 -2
- package/shared/definition43.js +1 -2
- package/shared/definition46.cjs +2 -2
- package/shared/definition46.js +3 -3
- package/shared/definition48.cjs +22 -15
- package/shared/definition48.js +22 -15
- package/shared/definition5.cjs +4 -3
- package/shared/definition5.js +4 -3
- package/shared/definition51.cjs +11 -402
- package/shared/definition51.js +17 -408
- package/shared/definition54.js +1 -1
- package/shared/definition56.js +1 -1
- package/shared/direction.cjs +2 -16
- package/shared/direction.js +3 -17
- package/shared/foundation/utilities/direction.d.ts +2 -0
- package/shared/listbox.cjs +1 -1
- package/shared/listbox.js +1 -1
- package/shared/text-anchor.cjs +1 -1
- package/shared/text-anchor.js +1 -1
- package/shared/text-field2.js +1 -1
- package/shared/vivid-element.cjs +0 -2
- package/shared/vivid-element.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/styles/tokens/vivid-2-compat.css +1 -1
- package/vivid.api.json +70 -3
- package/shared/apply-mixins2.cjs +0 -25
- package/shared/apply-mixins2.js +0 -23
- package/shared/form-associated2.cjs +0 -383
- package/shared/form-associated2.js +0 -381
- package/shared/foundation-element.cjs +0 -1417
- package/shared/foundation-element.js +0 -1414
- package/shared/key-codes2.cjs +0 -96
- package/shared/key-codes2.js +0 -88
- package/shared/start-end.cjs +0 -52
- package/shared/start-end.js +0 -50
package/shared/definition51.cjs
CHANGED
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
const definition = require('./definition50.cjs');
|
|
4
4
|
const definition$1 = require('./definition49.cjs');
|
|
5
5
|
const vividElement = require('./vivid-element.cjs');
|
|
6
|
-
const keyCodes
|
|
7
|
-
const foundationElement = require('./foundation-element.cjs');
|
|
8
|
-
const startEnd = require('./start-end.cjs');
|
|
9
|
-
const applyMixins = require('./apply-mixins2.cjs');
|
|
10
|
-
const keyCodes = require('./key-codes2.cjs');
|
|
6
|
+
const keyCodes = require('./key-codes.cjs');
|
|
11
7
|
const strings = require('./strings.cjs');
|
|
12
8
|
const numbers = require('./numbers.cjs');
|
|
13
9
|
const ref = require('./ref.cjs');
|
|
@@ -15,397 +11,6 @@ const slotted = require('./slotted.cjs');
|
|
|
15
11
|
const when = require('./when.cjs');
|
|
16
12
|
const classNames = require('./class-names.cjs');
|
|
17
13
|
|
|
18
|
-
/**
|
|
19
|
-
* This method keeps a given value within the bounds of a min and max value. If the value
|
|
20
|
-
* is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
|
|
21
|
-
* the maximum will be returned. Otherwise, the value is returned un-changed.
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
|
|
25
|
-
* If value is greater than max, max will be returned.
|
|
26
|
-
*/
|
|
27
|
-
function limit(min, max, value) {
|
|
28
|
-
return Math.min(Math.max(value, min), max);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
let uniqueIdCounter = 0;
|
|
32
|
-
/**
|
|
33
|
-
* Generates a unique ID based on incrementing a counter.
|
|
34
|
-
*/
|
|
35
|
-
function uniqueId(prefix = "") {
|
|
36
|
-
return `${prefix}${uniqueIdCounter++}`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* The orientation of the {@link @microsoft/fast-foundation#(Tabs:class)} component
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
const TabsOrientation = {
|
|
44
|
-
vertical: "vertical",
|
|
45
|
-
horizontal: "horizontal",
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* A Tabs Custom HTML Element.
|
|
49
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#tablist | ARIA tablist }.
|
|
50
|
-
*
|
|
51
|
-
* @slot start - Content which can be provided before the tablist element
|
|
52
|
-
* @slot end - Content which can be provided after the tablist element
|
|
53
|
-
* @slot tab - The slot for tabs
|
|
54
|
-
* @slot tabpanel - The slot for tabpanels
|
|
55
|
-
* @csspart tablist - The element wrapping for the tabs
|
|
56
|
-
* @csspart tab - The tab slot
|
|
57
|
-
* @csspart activeIndicator - The visual indicator
|
|
58
|
-
* @csspart tabpanel - The tabpanel slot
|
|
59
|
-
* @fires change - Fires a custom 'change' event when a tab is clicked or during keyboard navigation
|
|
60
|
-
*
|
|
61
|
-
* @public
|
|
62
|
-
*/
|
|
63
|
-
let Tabs$1 = class Tabs extends foundationElement.FoundationElement {
|
|
64
|
-
constructor() {
|
|
65
|
-
super(...arguments);
|
|
66
|
-
/**
|
|
67
|
-
* The orientation
|
|
68
|
-
* @public
|
|
69
|
-
* @remarks
|
|
70
|
-
* HTML Attribute: orientation
|
|
71
|
-
*/
|
|
72
|
-
this.orientation = TabsOrientation.horizontal;
|
|
73
|
-
/**
|
|
74
|
-
* Whether or not to show the active indicator
|
|
75
|
-
* @public
|
|
76
|
-
* @remarks
|
|
77
|
-
* HTML Attribute: activeindicator
|
|
78
|
-
*/
|
|
79
|
-
this.activeindicator = true;
|
|
80
|
-
/**
|
|
81
|
-
* @internal
|
|
82
|
-
*/
|
|
83
|
-
this.showActiveIndicator = true;
|
|
84
|
-
this.prevActiveTabIndex = 0;
|
|
85
|
-
this.activeTabIndex = 0;
|
|
86
|
-
this.ticking = false;
|
|
87
|
-
this.change = () => {
|
|
88
|
-
this.$emit("change", this.activetab);
|
|
89
|
-
};
|
|
90
|
-
this.isDisabledElement = (el) => {
|
|
91
|
-
return el.getAttribute("aria-disabled") === "true";
|
|
92
|
-
};
|
|
93
|
-
this.isHiddenElement = (el) => {
|
|
94
|
-
return el.hasAttribute("hidden");
|
|
95
|
-
};
|
|
96
|
-
this.isFocusableElement = (el) => {
|
|
97
|
-
return !this.isDisabledElement(el) && !this.isHiddenElement(el);
|
|
98
|
-
};
|
|
99
|
-
this.setTabs = () => {
|
|
100
|
-
const gridHorizontalProperty = "gridColumn";
|
|
101
|
-
const gridVerticalProperty = "gridRow";
|
|
102
|
-
const gridProperty = this.isHorizontal()
|
|
103
|
-
? gridHorizontalProperty
|
|
104
|
-
: gridVerticalProperty;
|
|
105
|
-
this.activeTabIndex = this.getActiveIndex();
|
|
106
|
-
this.showActiveIndicator = false;
|
|
107
|
-
this.tabs.forEach((tab, index) => {
|
|
108
|
-
if (tab.slot === "tab") {
|
|
109
|
-
const isActiveTab = this.activeTabIndex === index && this.isFocusableElement(tab);
|
|
110
|
-
if (this.activeindicator && this.isFocusableElement(tab)) {
|
|
111
|
-
this.showActiveIndicator = true;
|
|
112
|
-
}
|
|
113
|
-
const tabId = this.tabIds[index];
|
|
114
|
-
const tabpanelId = this.tabpanelIds[index];
|
|
115
|
-
tab.setAttribute("id", tabId);
|
|
116
|
-
tab.setAttribute("aria-selected", isActiveTab ? "true" : "false");
|
|
117
|
-
tab.setAttribute("aria-controls", tabpanelId);
|
|
118
|
-
tab.addEventListener("click", this.handleTabClick);
|
|
119
|
-
tab.addEventListener("keydown", this.handleTabKeyDown);
|
|
120
|
-
tab.setAttribute("tabindex", isActiveTab ? "0" : "-1");
|
|
121
|
-
if (isActiveTab) {
|
|
122
|
-
this.activetab = tab;
|
|
123
|
-
this.activeid = tabId;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
// If the original property isn't emptied out,
|
|
127
|
-
// the next set will morph into a grid-area style setting that is not what we want
|
|
128
|
-
tab.style[gridHorizontalProperty] = "";
|
|
129
|
-
tab.style[gridVerticalProperty] = "";
|
|
130
|
-
tab.style[gridProperty] = `${index + 1}`;
|
|
131
|
-
!this.isHorizontal()
|
|
132
|
-
? tab.classList.add("vertical")
|
|
133
|
-
: tab.classList.remove("vertical");
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
this.setTabPanels = () => {
|
|
137
|
-
this.tabpanels.forEach((tabpanel, index) => {
|
|
138
|
-
const tabId = this.tabIds[index];
|
|
139
|
-
const tabpanelId = this.tabpanelIds[index];
|
|
140
|
-
tabpanel.setAttribute("id", tabpanelId);
|
|
141
|
-
tabpanel.setAttribute("aria-labelledby", tabId);
|
|
142
|
-
this.activeTabIndex !== index
|
|
143
|
-
? tabpanel.setAttribute("hidden", "")
|
|
144
|
-
: tabpanel.removeAttribute("hidden");
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
this.handleTabClick = (event) => {
|
|
148
|
-
const selectedTab = event.currentTarget;
|
|
149
|
-
if (selectedTab.nodeType === 1 && this.isFocusableElement(selectedTab)) {
|
|
150
|
-
this.prevActiveTabIndex = this.activeTabIndex;
|
|
151
|
-
this.activeTabIndex = this.tabs.indexOf(selectedTab);
|
|
152
|
-
this.setComponent();
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
this.handleTabKeyDown = (event) => {
|
|
156
|
-
if (this.isHorizontal()) {
|
|
157
|
-
switch (event.key) {
|
|
158
|
-
case keyCodes.keyArrowLeft:
|
|
159
|
-
event.preventDefault();
|
|
160
|
-
this.adjustBackward(event);
|
|
161
|
-
break;
|
|
162
|
-
case keyCodes.keyArrowRight:
|
|
163
|
-
event.preventDefault();
|
|
164
|
-
this.adjustForward(event);
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
switch (event.key) {
|
|
170
|
-
case keyCodes.keyArrowUp:
|
|
171
|
-
event.preventDefault();
|
|
172
|
-
this.adjustBackward(event);
|
|
173
|
-
break;
|
|
174
|
-
case keyCodes.keyArrowDown:
|
|
175
|
-
event.preventDefault();
|
|
176
|
-
this.adjustForward(event);
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
switch (event.key) {
|
|
181
|
-
case keyCodes.keyHome:
|
|
182
|
-
event.preventDefault();
|
|
183
|
-
this.adjust(-this.activeTabIndex);
|
|
184
|
-
break;
|
|
185
|
-
case keyCodes.keyEnd:
|
|
186
|
-
event.preventDefault();
|
|
187
|
-
this.adjust(this.tabs.length - this.activeTabIndex - 1);
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
this.adjustForward = (e) => {
|
|
192
|
-
const group = this.tabs;
|
|
193
|
-
let index = 0;
|
|
194
|
-
index = this.activetab ? group.indexOf(this.activetab) + 1 : 1;
|
|
195
|
-
if (index === group.length) {
|
|
196
|
-
index = 0;
|
|
197
|
-
}
|
|
198
|
-
while (index < group.length && group.length > 1) {
|
|
199
|
-
if (this.isFocusableElement(group[index])) {
|
|
200
|
-
this.moveToTabByIndex(group, index);
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
else if (this.activetab && index === group.indexOf(this.activetab)) {
|
|
204
|
-
break;
|
|
205
|
-
}
|
|
206
|
-
else if (index + 1 >= group.length) {
|
|
207
|
-
index = 0;
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
index += 1;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
this.adjustBackward = (e) => {
|
|
215
|
-
const group = this.tabs;
|
|
216
|
-
let index = 0;
|
|
217
|
-
index = this.activetab ? group.indexOf(this.activetab) - 1 : 0;
|
|
218
|
-
index = index < 0 ? group.length - 1 : index;
|
|
219
|
-
while (index >= 0 && group.length > 1) {
|
|
220
|
-
if (this.isFocusableElement(group[index])) {
|
|
221
|
-
this.moveToTabByIndex(group, index);
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
else if (index - 1 < 0) {
|
|
225
|
-
index = group.length - 1;
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
index -= 1;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
this.moveToTabByIndex = (group, index) => {
|
|
233
|
-
const tab = group[index];
|
|
234
|
-
this.activetab = tab;
|
|
235
|
-
this.prevActiveTabIndex = this.activeTabIndex;
|
|
236
|
-
this.activeTabIndex = index;
|
|
237
|
-
tab.focus();
|
|
238
|
-
this.setComponent();
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* @internal
|
|
243
|
-
*/
|
|
244
|
-
orientationChanged() {
|
|
245
|
-
if (this.$fastController.isConnected) {
|
|
246
|
-
this.setTabs();
|
|
247
|
-
this.setTabPanels();
|
|
248
|
-
this.handleActiveIndicatorPosition();
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* @internal
|
|
253
|
-
*/
|
|
254
|
-
activeidChanged(oldValue, newValue) {
|
|
255
|
-
if (this.$fastController.isConnected &&
|
|
256
|
-
this.tabs.length <= this.tabpanels.length) {
|
|
257
|
-
this.prevActiveTabIndex = this.tabs.findIndex((item) => item.id === oldValue);
|
|
258
|
-
this.setTabs();
|
|
259
|
-
this.setTabPanels();
|
|
260
|
-
this.handleActiveIndicatorPosition();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* @internal
|
|
265
|
-
*/
|
|
266
|
-
tabsChanged() {
|
|
267
|
-
if (this.$fastController.isConnected &&
|
|
268
|
-
this.tabs.length <= this.tabpanels.length) {
|
|
269
|
-
this.tabIds = this.getTabIds();
|
|
270
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
271
|
-
this.setTabs();
|
|
272
|
-
this.setTabPanels();
|
|
273
|
-
this.handleActiveIndicatorPosition();
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* @internal
|
|
278
|
-
*/
|
|
279
|
-
tabpanelsChanged() {
|
|
280
|
-
if (this.$fastController.isConnected &&
|
|
281
|
-
this.tabpanels.length <= this.tabs.length) {
|
|
282
|
-
this.tabIds = this.getTabIds();
|
|
283
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
284
|
-
this.setTabs();
|
|
285
|
-
this.setTabPanels();
|
|
286
|
-
this.handleActiveIndicatorPosition();
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
getActiveIndex() {
|
|
290
|
-
const id = this.activeid;
|
|
291
|
-
if (id !== undefined) {
|
|
292
|
-
return this.tabIds.indexOf(this.activeid) === -1
|
|
293
|
-
? 0
|
|
294
|
-
: this.tabIds.indexOf(this.activeid);
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
return 0;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
getTabIds() {
|
|
301
|
-
return this.tabs.map((tab) => {
|
|
302
|
-
var _a;
|
|
303
|
-
return (_a = tab.getAttribute("id")) !== null && _a !== void 0 ? _a : `tab-${uniqueId()}`;
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
getTabPanelIds() {
|
|
307
|
-
return this.tabpanels.map((tabPanel) => {
|
|
308
|
-
var _a;
|
|
309
|
-
return (_a = tabPanel.getAttribute("id")) !== null && _a !== void 0 ? _a : `panel-${uniqueId()}`;
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
setComponent() {
|
|
313
|
-
if (this.activeTabIndex !== this.prevActiveTabIndex) {
|
|
314
|
-
this.activeid = this.tabIds[this.activeTabIndex];
|
|
315
|
-
this.focusTab();
|
|
316
|
-
this.change();
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
isHorizontal() {
|
|
320
|
-
return this.orientation === TabsOrientation.horizontal;
|
|
321
|
-
}
|
|
322
|
-
handleActiveIndicatorPosition() {
|
|
323
|
-
// Ignore if we click twice on the same tab
|
|
324
|
-
if (this.showActiveIndicator &&
|
|
325
|
-
this.activeindicator &&
|
|
326
|
-
this.activeTabIndex !== this.prevActiveTabIndex) {
|
|
327
|
-
if (this.ticking) {
|
|
328
|
-
this.ticking = false;
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
this.ticking = true;
|
|
332
|
-
this.animateActiveIndicator();
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
animateActiveIndicator() {
|
|
337
|
-
this.ticking = true;
|
|
338
|
-
const gridProperty = this.isHorizontal() ? "gridColumn" : "gridRow";
|
|
339
|
-
const translateProperty = this.isHorizontal()
|
|
340
|
-
? "translateX"
|
|
341
|
-
: "translateY";
|
|
342
|
-
const offsetProperty = this.isHorizontal() ? "offsetLeft" : "offsetTop";
|
|
343
|
-
const prev = this.activeIndicatorRef[offsetProperty];
|
|
344
|
-
this.activeIndicatorRef.style[gridProperty] = `${this.activeTabIndex + 1}`;
|
|
345
|
-
const next = this.activeIndicatorRef[offsetProperty];
|
|
346
|
-
this.activeIndicatorRef.style[gridProperty] = `${this.prevActiveTabIndex + 1}`;
|
|
347
|
-
const dif = next - prev;
|
|
348
|
-
this.activeIndicatorRef.style.transform = `${translateProperty}(${dif}px)`;
|
|
349
|
-
this.activeIndicatorRef.classList.add("activeIndicatorTransition");
|
|
350
|
-
this.activeIndicatorRef.addEventListener("transitionend", () => {
|
|
351
|
-
this.ticking = false;
|
|
352
|
-
this.activeIndicatorRef.style[gridProperty] = `${this.activeTabIndex + 1}`;
|
|
353
|
-
this.activeIndicatorRef.style.transform = `${translateProperty}(0px)`;
|
|
354
|
-
this.activeIndicatorRef.classList.remove("activeIndicatorTransition");
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* The adjust method for FASTTabs
|
|
359
|
-
* @public
|
|
360
|
-
* @remarks
|
|
361
|
-
* This method allows the active index to be adjusted by numerical increments
|
|
362
|
-
*/
|
|
363
|
-
adjust(adjustment) {
|
|
364
|
-
const focusableTabs = this.tabs.filter(t => this.isFocusableElement(t));
|
|
365
|
-
const currentActiveTabIndex = focusableTabs.indexOf(this.activetab);
|
|
366
|
-
const nextTabIndex = limit(0, focusableTabs.length - 1, currentActiveTabIndex + adjustment);
|
|
367
|
-
// the index of the next focusable tab within the context of all available tabs
|
|
368
|
-
const nextIndex = this.tabs.indexOf(focusableTabs[nextTabIndex]);
|
|
369
|
-
if (nextIndex > -1) {
|
|
370
|
-
this.moveToTabByIndex(this.tabs, nextIndex);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
focusTab() {
|
|
374
|
-
this.tabs[this.activeTabIndex].focus();
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* @internal
|
|
378
|
-
*/
|
|
379
|
-
connectedCallback() {
|
|
380
|
-
super.connectedCallback();
|
|
381
|
-
this.tabIds = this.getTabIds();
|
|
382
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
383
|
-
this.activeTabIndex = this.getActiveIndex();
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
foundationElement.__decorate([
|
|
387
|
-
vividElement.attr
|
|
388
|
-
], Tabs$1.prototype, "orientation", void 0);
|
|
389
|
-
foundationElement.__decorate([
|
|
390
|
-
vividElement.attr
|
|
391
|
-
], Tabs$1.prototype, "activeid", void 0);
|
|
392
|
-
foundationElement.__decorate([
|
|
393
|
-
vividElement.observable
|
|
394
|
-
], Tabs$1.prototype, "tabs", void 0);
|
|
395
|
-
foundationElement.__decorate([
|
|
396
|
-
vividElement.observable
|
|
397
|
-
], Tabs$1.prototype, "tabpanels", void 0);
|
|
398
|
-
foundationElement.__decorate([
|
|
399
|
-
vividElement.attr({ mode: "boolean" })
|
|
400
|
-
], Tabs$1.prototype, "activeindicator", void 0);
|
|
401
|
-
foundationElement.__decorate([
|
|
402
|
-
vividElement.observable
|
|
403
|
-
], Tabs$1.prototype, "activeIndicatorRef", void 0);
|
|
404
|
-
foundationElement.__decorate([
|
|
405
|
-
vividElement.observable
|
|
406
|
-
], Tabs$1.prototype, "showActiveIndicator", void 0);
|
|
407
|
-
applyMixins.applyMixins(Tabs$1, startEnd.StartEnd);
|
|
408
|
-
|
|
409
14
|
const styles = ":host{display:block}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base.connotation-cta{--_connotation-color-firm: var(--vvd-tabs-cta-firm, var(--vvd-color-cta-600))}.base:not(.connotation-cta){--_connotation-color-firm: var(--vvd-tabs-accent-firm, var(--vvd-color-canvas-text))}.base{--_tabs-tablist-gutter: 8px;--_tabs-active-indicator-stroke-width: 2px;display:grid;box-sizing:border-box}.base.orientation-vertical{overflow:hidden;block-size:inherit;grid-template-columns:auto 1fr;grid-template-rows:1fr}.base:not(.orientation-vertical){grid-template-columns:1fr;grid-template-rows:auto 1fr;max-block-size:100%}.base.layout-stretch .scroll-shadow{flex:1}.base:not(.orientation-vertical) .scroll-shadow{position:relative;overflow:hidden;isolation:isolate}.base:not(.orientation-vertical) .scroll-shadow.start-scroll:before,.base:not(.orientation-vertical) .scroll-shadow.start-scroll:after,.base:not(.orientation-vertical) .scroll-shadow.end-scroll:before,.base:not(.orientation-vertical) .scroll-shadow.end-scroll:after{position:absolute;content:\"\";inline-size:10px;inset-block:0;opacity:0;transition:opacity .1s}.base:not(.orientation-vertical) .scroll-shadow.start-scroll:before{z-index:1;box-shadow:inset 7px 1px 5px -3px var(--vvd-color-neutral-950);inset-inline-start:0;opacity:.2}.base:not(.orientation-vertical) .scroll-shadow.end-scroll:after{box-shadow:inset -7px 1px 5px -3px var(--vvd-color-neutral-950);inset-inline-end:0;opacity:.2}.tabs{display:flex;overflow:hidden}.base.orientation-vertical .tabs{flex-direction:column;box-shadow:1px 0 0 0 var(--vvd-color-neutral-300)}.base.orientation-horizontal .tabs{flex-direction:row;border-bottom:1px solid var(--vvd-color-neutral-300)}.tablist{position:relative;display:grid;box-sizing:border-box;color:var(--_appearance-color-text)}.base.layout-stretch .tablist{--_tab-justify-content: center;--_tabs-tablist-column: 1fr}.tablist .base:not(.layout-stretch){--_tabs-tablist-column: auto}.base.orientation-vertical .tablist{padding:var(--_tabs-tablist-gutter);grid-row:1/2;grid-template-columns:auto 1fr;grid-template-rows:auto;inline-size:100%;place-self:flex-start end;row-gap:var(--_tabs-tablist-gutter)}.base:not(.orientation-vertical) .tablist{justify-content:flex-start;column-gap:var(--_tabs-tablist-gutter);grid-auto-flow:column;grid-template-rows:auto auto;inline-size:100%;padding-inline:var(--_tabs-tablist-gutter)}.base.has-action-items.orientation-vertical .tablist{padding-block-end:0}.base.has-action-items:not(.orientation-vertical) .tablist{padding-inline-end:0}.tablist-wrapper{--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.tablist-wrapper{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.tablist-wrapper ::-webkit-scrollbar{width:4px}.tablist-wrapper ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.tablist-wrapper ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-thumb-color)}.base:not(.orientation-vertical) .tablist-wrapper{overflow:auto hidden;align-self:end;inline-size:100%}.base.orientation-vertical .tablist-wrapper{overflow:hidden auto;block-size:100%}.tablist-wrapper::-webkit-scrollbar{display:none}slot[name=action-items]{display:flex}.base.has-action-items.orientation-horizontal slot[name=action-items]{align-items:center;margin-inline:var(--_tabs-tablist-gutter)}.base.has-action-items.orientation-vertical slot[name=action-items]{margin-block:var(--_tabs-tablist-gutter)}.tabpanel{box-sizing:border-box;block-size:100%;min-block-size:0;min-inline-size:0}.base.scroll .tabpanel{overflow-y:auto;--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.base.scroll .tabpanel{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.base.scroll .tabpanel ::-webkit-scrollbar{width:4px}.base.scroll .tabpanel ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.base.scroll .tabpanel ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-thumb-color)}.base.gutters-small .tabpanel{padding:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)) - (1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2))))}.active-indicator{background:currentColor;margin-inline-start:calc(var(--_tabs-tablist-gutter) * -1)}.base.orientation-vertical .active-indicator{align-self:center;border-radius:2px;block-size:80%;grid-area:1/1/auto/auto;inline-size:var(--_tabs-active-indicator-stroke-width)}.base:not(.orientation-vertical) .active-indicator{position:absolute;z-index:1;border-radius:2px;block-size:var(--_tabs-active-indicator-stroke-width);grid-column:1/auto;inline-size:calc(var(--_tabs-active-tab-inline-size));inset-block-end:0;inset-inline-start:8px}.activeIndicatorTransition{transition:transform .2s ease-out 0s,inline-size .2s ease-out 0s}";
|
|
410
15
|
|
|
411
16
|
var __defProp = Object.defineProperty;
|
|
@@ -419,6 +24,10 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
419
24
|
};
|
|
420
25
|
const ACTIVE_TAB_WIDTH = "--_tabs-active-tab-inline-size";
|
|
421
26
|
const TABLIST_COLUMN = "--_tabs-tablist-column";
|
|
27
|
+
const TabsOrientation = {
|
|
28
|
+
vertical: "vertical",
|
|
29
|
+
horizontal: "horizontal"
|
|
30
|
+
};
|
|
422
31
|
class Tabs extends vividElement.VividElement {
|
|
423
32
|
constructor() {
|
|
424
33
|
super(...arguments);
|
|
@@ -510,33 +119,33 @@ class Tabs extends vividElement.VividElement {
|
|
|
510
119
|
this.#handleTabKeyDown = (event) => {
|
|
511
120
|
if (this.#isHorizontal()) {
|
|
512
121
|
switch (event.key) {
|
|
513
|
-
case keyCodes
|
|
122
|
+
case keyCodes.keyArrowLeft:
|
|
514
123
|
event.preventDefault();
|
|
515
124
|
this.adjustBackward(event);
|
|
516
125
|
break;
|
|
517
|
-
case keyCodes
|
|
126
|
+
case keyCodes.keyArrowRight:
|
|
518
127
|
event.preventDefault();
|
|
519
128
|
this.adjustForward(event);
|
|
520
129
|
break;
|
|
521
130
|
}
|
|
522
131
|
} else {
|
|
523
132
|
switch (event.key) {
|
|
524
|
-
case keyCodes
|
|
133
|
+
case keyCodes.keyArrowUp:
|
|
525
134
|
event.preventDefault();
|
|
526
135
|
this.adjustBackward(event);
|
|
527
136
|
break;
|
|
528
|
-
case keyCodes
|
|
137
|
+
case keyCodes.keyArrowDown:
|
|
529
138
|
event.preventDefault();
|
|
530
139
|
this.adjustForward(event);
|
|
531
140
|
break;
|
|
532
141
|
}
|
|
533
142
|
}
|
|
534
143
|
switch (event.key) {
|
|
535
|
-
case keyCodes
|
|
144
|
+
case keyCodes.keyHome:
|
|
536
145
|
event.preventDefault();
|
|
537
146
|
this.adjust(-this.activeTabIndex);
|
|
538
147
|
break;
|
|
539
|
-
case keyCodes
|
|
148
|
+
case keyCodes.keyEnd:
|
|
540
149
|
event.preventDefault();
|
|
541
150
|
this.adjust(this.tabs.length - this.activeTabIndex - 1);
|
|
542
151
|
break;
|