@vonage/vivid 4.14.2 → 4.14.3
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 +371 -27
- 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/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/definition2.cjs +9 -4
- package/shared/definition2.js +9 -5
- package/shared/definition25.cjs +25 -18
- package/shared/definition25.js +26 -19
- package/shared/definition29.cjs +12 -30
- package/shared/definition29.js +12 -30
- 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 +3 -2
- package/shared/definition5.js +3 -2
- 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 +22 -3
- package/shared/listbox.js +21 -2
- 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.js
CHANGED
|
@@ -1,409 +1,14 @@
|
|
|
1
1
|
import { t as tabDefinition } from './definition50.js';
|
|
2
2
|
import { t as tabPanelDefinition } from './definition49.js';
|
|
3
|
-
import {
|
|
4
|
-
import { i as keyArrowRight
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { a as applyMixins } from './apply-mixins2.js';
|
|
8
|
-
import { a as keyArrowRight, b as keyArrowLeft, c as keyArrowDown, d as keyArrowUp, e as keyEnd, f as keyHome } from './key-codes2.js';
|
|
9
|
-
import { u as uniqueId$1 } from './strings.js';
|
|
10
|
-
import { l as limit$1 } from './numbers.js';
|
|
3
|
+
import { V as VividElement, a as attr, o as observable, h as html, d as defineVividComponent, f as createRegisterFunction } from './vivid-element.js';
|
|
4
|
+
import { i as keyArrowRight, h as keyArrowLeft, f as keyArrowDown, e as keyArrowUp, d as keyEnd, g as keyHome } from './key-codes.js';
|
|
5
|
+
import { u as uniqueId } from './strings.js';
|
|
6
|
+
import { l as limit } from './numbers.js';
|
|
11
7
|
import { r as ref } from './ref.js';
|
|
12
8
|
import { s as slotted } from './slotted.js';
|
|
13
9
|
import { w as when } from './when.js';
|
|
14
10
|
import { c as classNames } from './class-names.js';
|
|
15
11
|
|
|
16
|
-
/**
|
|
17
|
-
* This method keeps a given value within the bounds of a min and max value. If the value
|
|
18
|
-
* is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
|
|
19
|
-
* the maximum will be returned. Otherwise, the value is returned un-changed.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
|
|
23
|
-
* If value is greater than max, max will be returned.
|
|
24
|
-
*/
|
|
25
|
-
function limit(min, max, value) {
|
|
26
|
-
return Math.min(Math.max(value, min), max);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let uniqueIdCounter = 0;
|
|
30
|
-
/**
|
|
31
|
-
* Generates a unique ID based on incrementing a counter.
|
|
32
|
-
*/
|
|
33
|
-
function uniqueId(prefix = "") {
|
|
34
|
-
return `${prefix}${uniqueIdCounter++}`;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* The orientation of the {@link @microsoft/fast-foundation#(Tabs:class)} component
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
const TabsOrientation = {
|
|
42
|
-
vertical: "vertical",
|
|
43
|
-
horizontal: "horizontal",
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* A Tabs Custom HTML Element.
|
|
47
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#tablist | ARIA tablist }.
|
|
48
|
-
*
|
|
49
|
-
* @slot start - Content which can be provided before the tablist element
|
|
50
|
-
* @slot end - Content which can be provided after the tablist element
|
|
51
|
-
* @slot tab - The slot for tabs
|
|
52
|
-
* @slot tabpanel - The slot for tabpanels
|
|
53
|
-
* @csspart tablist - The element wrapping for the tabs
|
|
54
|
-
* @csspart tab - The tab slot
|
|
55
|
-
* @csspart activeIndicator - The visual indicator
|
|
56
|
-
* @csspart tabpanel - The tabpanel slot
|
|
57
|
-
* @fires change - Fires a custom 'change' event when a tab is clicked or during keyboard navigation
|
|
58
|
-
*
|
|
59
|
-
* @public
|
|
60
|
-
*/
|
|
61
|
-
let Tabs$1 = class Tabs extends FoundationElement {
|
|
62
|
-
constructor() {
|
|
63
|
-
super(...arguments);
|
|
64
|
-
/**
|
|
65
|
-
* The orientation
|
|
66
|
-
* @public
|
|
67
|
-
* @remarks
|
|
68
|
-
* HTML Attribute: orientation
|
|
69
|
-
*/
|
|
70
|
-
this.orientation = TabsOrientation.horizontal;
|
|
71
|
-
/**
|
|
72
|
-
* Whether or not to show the active indicator
|
|
73
|
-
* @public
|
|
74
|
-
* @remarks
|
|
75
|
-
* HTML Attribute: activeindicator
|
|
76
|
-
*/
|
|
77
|
-
this.activeindicator = true;
|
|
78
|
-
/**
|
|
79
|
-
* @internal
|
|
80
|
-
*/
|
|
81
|
-
this.showActiveIndicator = true;
|
|
82
|
-
this.prevActiveTabIndex = 0;
|
|
83
|
-
this.activeTabIndex = 0;
|
|
84
|
-
this.ticking = false;
|
|
85
|
-
this.change = () => {
|
|
86
|
-
this.$emit("change", this.activetab);
|
|
87
|
-
};
|
|
88
|
-
this.isDisabledElement = (el) => {
|
|
89
|
-
return el.getAttribute("aria-disabled") === "true";
|
|
90
|
-
};
|
|
91
|
-
this.isHiddenElement = (el) => {
|
|
92
|
-
return el.hasAttribute("hidden");
|
|
93
|
-
};
|
|
94
|
-
this.isFocusableElement = (el) => {
|
|
95
|
-
return !this.isDisabledElement(el) && !this.isHiddenElement(el);
|
|
96
|
-
};
|
|
97
|
-
this.setTabs = () => {
|
|
98
|
-
const gridHorizontalProperty = "gridColumn";
|
|
99
|
-
const gridVerticalProperty = "gridRow";
|
|
100
|
-
const gridProperty = this.isHorizontal()
|
|
101
|
-
? gridHorizontalProperty
|
|
102
|
-
: gridVerticalProperty;
|
|
103
|
-
this.activeTabIndex = this.getActiveIndex();
|
|
104
|
-
this.showActiveIndicator = false;
|
|
105
|
-
this.tabs.forEach((tab, index) => {
|
|
106
|
-
if (tab.slot === "tab") {
|
|
107
|
-
const isActiveTab = this.activeTabIndex === index && this.isFocusableElement(tab);
|
|
108
|
-
if (this.activeindicator && this.isFocusableElement(tab)) {
|
|
109
|
-
this.showActiveIndicator = true;
|
|
110
|
-
}
|
|
111
|
-
const tabId = this.tabIds[index];
|
|
112
|
-
const tabpanelId = this.tabpanelIds[index];
|
|
113
|
-
tab.setAttribute("id", tabId);
|
|
114
|
-
tab.setAttribute("aria-selected", isActiveTab ? "true" : "false");
|
|
115
|
-
tab.setAttribute("aria-controls", tabpanelId);
|
|
116
|
-
tab.addEventListener("click", this.handleTabClick);
|
|
117
|
-
tab.addEventListener("keydown", this.handleTabKeyDown);
|
|
118
|
-
tab.setAttribute("tabindex", isActiveTab ? "0" : "-1");
|
|
119
|
-
if (isActiveTab) {
|
|
120
|
-
this.activetab = tab;
|
|
121
|
-
this.activeid = tabId;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// If the original property isn't emptied out,
|
|
125
|
-
// the next set will morph into a grid-area style setting that is not what we want
|
|
126
|
-
tab.style[gridHorizontalProperty] = "";
|
|
127
|
-
tab.style[gridVerticalProperty] = "";
|
|
128
|
-
tab.style[gridProperty] = `${index + 1}`;
|
|
129
|
-
!this.isHorizontal()
|
|
130
|
-
? tab.classList.add("vertical")
|
|
131
|
-
: tab.classList.remove("vertical");
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
this.setTabPanels = () => {
|
|
135
|
-
this.tabpanels.forEach((tabpanel, index) => {
|
|
136
|
-
const tabId = this.tabIds[index];
|
|
137
|
-
const tabpanelId = this.tabpanelIds[index];
|
|
138
|
-
tabpanel.setAttribute("id", tabpanelId);
|
|
139
|
-
tabpanel.setAttribute("aria-labelledby", tabId);
|
|
140
|
-
this.activeTabIndex !== index
|
|
141
|
-
? tabpanel.setAttribute("hidden", "")
|
|
142
|
-
: tabpanel.removeAttribute("hidden");
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
this.handleTabClick = (event) => {
|
|
146
|
-
const selectedTab = event.currentTarget;
|
|
147
|
-
if (selectedTab.nodeType === 1 && this.isFocusableElement(selectedTab)) {
|
|
148
|
-
this.prevActiveTabIndex = this.activeTabIndex;
|
|
149
|
-
this.activeTabIndex = this.tabs.indexOf(selectedTab);
|
|
150
|
-
this.setComponent();
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
this.handleTabKeyDown = (event) => {
|
|
154
|
-
if (this.isHorizontal()) {
|
|
155
|
-
switch (event.key) {
|
|
156
|
-
case keyArrowLeft:
|
|
157
|
-
event.preventDefault();
|
|
158
|
-
this.adjustBackward(event);
|
|
159
|
-
break;
|
|
160
|
-
case keyArrowRight:
|
|
161
|
-
event.preventDefault();
|
|
162
|
-
this.adjustForward(event);
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
switch (event.key) {
|
|
168
|
-
case keyArrowUp:
|
|
169
|
-
event.preventDefault();
|
|
170
|
-
this.adjustBackward(event);
|
|
171
|
-
break;
|
|
172
|
-
case keyArrowDown:
|
|
173
|
-
event.preventDefault();
|
|
174
|
-
this.adjustForward(event);
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
switch (event.key) {
|
|
179
|
-
case keyHome:
|
|
180
|
-
event.preventDefault();
|
|
181
|
-
this.adjust(-this.activeTabIndex);
|
|
182
|
-
break;
|
|
183
|
-
case keyEnd:
|
|
184
|
-
event.preventDefault();
|
|
185
|
-
this.adjust(this.tabs.length - this.activeTabIndex - 1);
|
|
186
|
-
break;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
this.adjustForward = (e) => {
|
|
190
|
-
const group = this.tabs;
|
|
191
|
-
let index = 0;
|
|
192
|
-
index = this.activetab ? group.indexOf(this.activetab) + 1 : 1;
|
|
193
|
-
if (index === group.length) {
|
|
194
|
-
index = 0;
|
|
195
|
-
}
|
|
196
|
-
while (index < group.length && group.length > 1) {
|
|
197
|
-
if (this.isFocusableElement(group[index])) {
|
|
198
|
-
this.moveToTabByIndex(group, index);
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
else if (this.activetab && index === group.indexOf(this.activetab)) {
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
else if (index + 1 >= group.length) {
|
|
205
|
-
index = 0;
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
index += 1;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
this.adjustBackward = (e) => {
|
|
213
|
-
const group = this.tabs;
|
|
214
|
-
let index = 0;
|
|
215
|
-
index = this.activetab ? group.indexOf(this.activetab) - 1 : 0;
|
|
216
|
-
index = index < 0 ? group.length - 1 : index;
|
|
217
|
-
while (index >= 0 && group.length > 1) {
|
|
218
|
-
if (this.isFocusableElement(group[index])) {
|
|
219
|
-
this.moveToTabByIndex(group, index);
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
222
|
-
else if (index - 1 < 0) {
|
|
223
|
-
index = group.length - 1;
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
index -= 1;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
this.moveToTabByIndex = (group, index) => {
|
|
231
|
-
const tab = group[index];
|
|
232
|
-
this.activetab = tab;
|
|
233
|
-
this.prevActiveTabIndex = this.activeTabIndex;
|
|
234
|
-
this.activeTabIndex = index;
|
|
235
|
-
tab.focus();
|
|
236
|
-
this.setComponent();
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* @internal
|
|
241
|
-
*/
|
|
242
|
-
orientationChanged() {
|
|
243
|
-
if (this.$fastController.isConnected) {
|
|
244
|
-
this.setTabs();
|
|
245
|
-
this.setTabPanels();
|
|
246
|
-
this.handleActiveIndicatorPosition();
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* @internal
|
|
251
|
-
*/
|
|
252
|
-
activeidChanged(oldValue, newValue) {
|
|
253
|
-
if (this.$fastController.isConnected &&
|
|
254
|
-
this.tabs.length <= this.tabpanels.length) {
|
|
255
|
-
this.prevActiveTabIndex = this.tabs.findIndex((item) => item.id === oldValue);
|
|
256
|
-
this.setTabs();
|
|
257
|
-
this.setTabPanels();
|
|
258
|
-
this.handleActiveIndicatorPosition();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* @internal
|
|
263
|
-
*/
|
|
264
|
-
tabsChanged() {
|
|
265
|
-
if (this.$fastController.isConnected &&
|
|
266
|
-
this.tabs.length <= this.tabpanels.length) {
|
|
267
|
-
this.tabIds = this.getTabIds();
|
|
268
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
269
|
-
this.setTabs();
|
|
270
|
-
this.setTabPanels();
|
|
271
|
-
this.handleActiveIndicatorPosition();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* @internal
|
|
276
|
-
*/
|
|
277
|
-
tabpanelsChanged() {
|
|
278
|
-
if (this.$fastController.isConnected &&
|
|
279
|
-
this.tabpanels.length <= this.tabs.length) {
|
|
280
|
-
this.tabIds = this.getTabIds();
|
|
281
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
282
|
-
this.setTabs();
|
|
283
|
-
this.setTabPanels();
|
|
284
|
-
this.handleActiveIndicatorPosition();
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
getActiveIndex() {
|
|
288
|
-
const id = this.activeid;
|
|
289
|
-
if (id !== undefined) {
|
|
290
|
-
return this.tabIds.indexOf(this.activeid) === -1
|
|
291
|
-
? 0
|
|
292
|
-
: this.tabIds.indexOf(this.activeid);
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
return 0;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
getTabIds() {
|
|
299
|
-
return this.tabs.map((tab) => {
|
|
300
|
-
var _a;
|
|
301
|
-
return (_a = tab.getAttribute("id")) !== null && _a !== void 0 ? _a : `tab-${uniqueId()}`;
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
getTabPanelIds() {
|
|
305
|
-
return this.tabpanels.map((tabPanel) => {
|
|
306
|
-
var _a;
|
|
307
|
-
return (_a = tabPanel.getAttribute("id")) !== null && _a !== void 0 ? _a : `panel-${uniqueId()}`;
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
setComponent() {
|
|
311
|
-
if (this.activeTabIndex !== this.prevActiveTabIndex) {
|
|
312
|
-
this.activeid = this.tabIds[this.activeTabIndex];
|
|
313
|
-
this.focusTab();
|
|
314
|
-
this.change();
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
isHorizontal() {
|
|
318
|
-
return this.orientation === TabsOrientation.horizontal;
|
|
319
|
-
}
|
|
320
|
-
handleActiveIndicatorPosition() {
|
|
321
|
-
// Ignore if we click twice on the same tab
|
|
322
|
-
if (this.showActiveIndicator &&
|
|
323
|
-
this.activeindicator &&
|
|
324
|
-
this.activeTabIndex !== this.prevActiveTabIndex) {
|
|
325
|
-
if (this.ticking) {
|
|
326
|
-
this.ticking = false;
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
329
|
-
this.ticking = true;
|
|
330
|
-
this.animateActiveIndicator();
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
animateActiveIndicator() {
|
|
335
|
-
this.ticking = true;
|
|
336
|
-
const gridProperty = this.isHorizontal() ? "gridColumn" : "gridRow";
|
|
337
|
-
const translateProperty = this.isHorizontal()
|
|
338
|
-
? "translateX"
|
|
339
|
-
: "translateY";
|
|
340
|
-
const offsetProperty = this.isHorizontal() ? "offsetLeft" : "offsetTop";
|
|
341
|
-
const prev = this.activeIndicatorRef[offsetProperty];
|
|
342
|
-
this.activeIndicatorRef.style[gridProperty] = `${this.activeTabIndex + 1}`;
|
|
343
|
-
const next = this.activeIndicatorRef[offsetProperty];
|
|
344
|
-
this.activeIndicatorRef.style[gridProperty] = `${this.prevActiveTabIndex + 1}`;
|
|
345
|
-
const dif = next - prev;
|
|
346
|
-
this.activeIndicatorRef.style.transform = `${translateProperty}(${dif}px)`;
|
|
347
|
-
this.activeIndicatorRef.classList.add("activeIndicatorTransition");
|
|
348
|
-
this.activeIndicatorRef.addEventListener("transitionend", () => {
|
|
349
|
-
this.ticking = false;
|
|
350
|
-
this.activeIndicatorRef.style[gridProperty] = `${this.activeTabIndex + 1}`;
|
|
351
|
-
this.activeIndicatorRef.style.transform = `${translateProperty}(0px)`;
|
|
352
|
-
this.activeIndicatorRef.classList.remove("activeIndicatorTransition");
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* The adjust method for FASTTabs
|
|
357
|
-
* @public
|
|
358
|
-
* @remarks
|
|
359
|
-
* This method allows the active index to be adjusted by numerical increments
|
|
360
|
-
*/
|
|
361
|
-
adjust(adjustment) {
|
|
362
|
-
const focusableTabs = this.tabs.filter(t => this.isFocusableElement(t));
|
|
363
|
-
const currentActiveTabIndex = focusableTabs.indexOf(this.activetab);
|
|
364
|
-
const nextTabIndex = limit(0, focusableTabs.length - 1, currentActiveTabIndex + adjustment);
|
|
365
|
-
// the index of the next focusable tab within the context of all available tabs
|
|
366
|
-
const nextIndex = this.tabs.indexOf(focusableTabs[nextTabIndex]);
|
|
367
|
-
if (nextIndex > -1) {
|
|
368
|
-
this.moveToTabByIndex(this.tabs, nextIndex);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
focusTab() {
|
|
372
|
-
this.tabs[this.activeTabIndex].focus();
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* @internal
|
|
376
|
-
*/
|
|
377
|
-
connectedCallback() {
|
|
378
|
-
super.connectedCallback();
|
|
379
|
-
this.tabIds = this.getTabIds();
|
|
380
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
381
|
-
this.activeTabIndex = this.getActiveIndex();
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
__decorate([
|
|
385
|
-
attr
|
|
386
|
-
], Tabs$1.prototype, "orientation", void 0);
|
|
387
|
-
__decorate([
|
|
388
|
-
attr
|
|
389
|
-
], Tabs$1.prototype, "activeid", void 0);
|
|
390
|
-
__decorate([
|
|
391
|
-
observable
|
|
392
|
-
], Tabs$1.prototype, "tabs", void 0);
|
|
393
|
-
__decorate([
|
|
394
|
-
observable
|
|
395
|
-
], Tabs$1.prototype, "tabpanels", void 0);
|
|
396
|
-
__decorate([
|
|
397
|
-
attr({ mode: "boolean" })
|
|
398
|
-
], Tabs$1.prototype, "activeindicator", void 0);
|
|
399
|
-
__decorate([
|
|
400
|
-
observable
|
|
401
|
-
], Tabs$1.prototype, "activeIndicatorRef", void 0);
|
|
402
|
-
__decorate([
|
|
403
|
-
observable
|
|
404
|
-
], Tabs$1.prototype, "showActiveIndicator", void 0);
|
|
405
|
-
applyMixins(Tabs$1, StartEnd);
|
|
406
|
-
|
|
407
12
|
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}";
|
|
408
13
|
|
|
409
14
|
var __defProp = Object.defineProperty;
|
|
@@ -417,6 +22,10 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
417
22
|
};
|
|
418
23
|
const ACTIVE_TAB_WIDTH = "--_tabs-active-tab-inline-size";
|
|
419
24
|
const TABLIST_COLUMN = "--_tabs-tablist-column";
|
|
25
|
+
const TabsOrientation = {
|
|
26
|
+
vertical: "vertical",
|
|
27
|
+
horizontal: "horizontal"
|
|
28
|
+
};
|
|
420
29
|
class Tabs extends VividElement {
|
|
421
30
|
constructor() {
|
|
422
31
|
super(...arguments);
|
|
@@ -508,33 +117,33 @@ class Tabs extends VividElement {
|
|
|
508
117
|
this.#handleTabKeyDown = (event) => {
|
|
509
118
|
if (this.#isHorizontal()) {
|
|
510
119
|
switch (event.key) {
|
|
511
|
-
case keyArrowLeft
|
|
120
|
+
case keyArrowLeft:
|
|
512
121
|
event.preventDefault();
|
|
513
122
|
this.adjustBackward(event);
|
|
514
123
|
break;
|
|
515
|
-
case keyArrowRight
|
|
124
|
+
case keyArrowRight:
|
|
516
125
|
event.preventDefault();
|
|
517
126
|
this.adjustForward(event);
|
|
518
127
|
break;
|
|
519
128
|
}
|
|
520
129
|
} else {
|
|
521
130
|
switch (event.key) {
|
|
522
|
-
case keyArrowUp
|
|
131
|
+
case keyArrowUp:
|
|
523
132
|
event.preventDefault();
|
|
524
133
|
this.adjustBackward(event);
|
|
525
134
|
break;
|
|
526
|
-
case keyArrowDown
|
|
135
|
+
case keyArrowDown:
|
|
527
136
|
event.preventDefault();
|
|
528
137
|
this.adjustForward(event);
|
|
529
138
|
break;
|
|
530
139
|
}
|
|
531
140
|
}
|
|
532
141
|
switch (event.key) {
|
|
533
|
-
case keyHome
|
|
142
|
+
case keyHome:
|
|
534
143
|
event.preventDefault();
|
|
535
144
|
this.adjust(-this.activeTabIndex);
|
|
536
145
|
break;
|
|
537
|
-
case keyEnd
|
|
146
|
+
case keyEnd:
|
|
538
147
|
event.preventDefault();
|
|
539
148
|
this.adjust(this.tabs.length - this.activeTabIndex - 1);
|
|
540
149
|
break;
|
|
@@ -630,12 +239,12 @@ class Tabs extends VividElement {
|
|
|
630
239
|
}
|
|
631
240
|
getTabIds() {
|
|
632
241
|
return this.tabs.map((tab) => {
|
|
633
|
-
return tab.getAttribute("id") ?? `tab-${uniqueId
|
|
242
|
+
return tab.getAttribute("id") ?? `tab-${uniqueId()}`;
|
|
634
243
|
});
|
|
635
244
|
}
|
|
636
245
|
getTabPanelIds() {
|
|
637
246
|
return this.tabpanels.map((tabPanel) => {
|
|
638
|
-
return tabPanel.getAttribute("id") ?? `panel-${uniqueId
|
|
247
|
+
return tabPanel.getAttribute("id") ?? `panel-${uniqueId()}`;
|
|
639
248
|
});
|
|
640
249
|
}
|
|
641
250
|
setComponent() {
|
|
@@ -656,7 +265,7 @@ class Tabs extends VividElement {
|
|
|
656
265
|
adjust(adjustment) {
|
|
657
266
|
const focusableTabs = this.tabs.filter((t) => this.isFocusableElement(t));
|
|
658
267
|
const currentActiveTabIndex = focusableTabs.indexOf(this.activetab);
|
|
659
|
-
const nextTabIndex = limit
|
|
268
|
+
const nextTabIndex = limit(
|
|
660
269
|
0,
|
|
661
270
|
focusableTabs.length - 1,
|
|
662
271
|
currentActiveTabIndex + adjustment
|
package/shared/definition54.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as iconDefinition } from './definition27.js';
|
|
2
|
-
import { V as VividElement, a as attr,
|
|
2
|
+
import { V as VividElement, a as attr, o as observable, n as nullableNumberConverter, h as html, d as defineVividComponent, f as createRegisterFunction } from './vivid-element.js';
|
|
3
3
|
import { R as Reflector, D as DelegatesARIATextbox } from './text-field2.js';
|
|
4
4
|
import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
|
|
5
5
|
import { F as FormAssociated } from './form-associated.js';
|
package/shared/definition56.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as textFieldDefinition } from './definition55.js';
|
|
2
2
|
import { P as Popup, p as popupDefinition } from './definition63.js';
|
|
3
3
|
import { B as Button, b as buttonDefinition } from './definition11.js';
|
|
4
|
-
import { V as VividElement, O as Observable, i as defaultExecutionContext, D as DOM, a as attr,
|
|
4
|
+
import { V as VividElement, O as Observable, i as defaultExecutionContext, D as DOM, a as attr, v as volatile, o as observable, n as nullableNumberConverter, h as html, d as defineVividComponent, f as createRegisterFunction } from './vivid-element.js';
|
|
5
5
|
import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
|
|
6
6
|
import { h as handleEscapeKeyAndStopPropogation } from './index.js';
|
|
7
7
|
import { s as scrollIntoView } from './scrollIntoView.js';
|
package/shared/direction.cjs
CHANGED
|
@@ -9,23 +9,9 @@ exports.Direction = void 0;
|
|
|
9
9
|
Direction["rtl"] = "rtl";
|
|
10
10
|
})(exports.Direction || (exports.Direction = {}));
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Expose ltr and rtl strings
|
|
14
|
-
*/
|
|
15
|
-
var Direction;
|
|
16
|
-
(function (Direction) {
|
|
17
|
-
Direction["ltr"] = "ltr";
|
|
18
|
-
Direction["rtl"] = "rtl";
|
|
19
|
-
})(Direction || (Direction = {}));
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* a method to determine the current localization direction of the view
|
|
23
|
-
* @param rootNode - the HTMLElement to begin the query from, usually "this" when used in a component controller
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
12
|
const getDirection = (rootNode) => {
|
|
27
|
-
|
|
28
|
-
|
|
13
|
+
const dirNode = rootNode.closest("[dir]");
|
|
14
|
+
return dirNode !== null && dirNode.dir === "rtl" ? exports.Direction.rtl : exports.Direction.ltr;
|
|
29
15
|
};
|
|
30
16
|
|
|
31
17
|
exports.getDirection = getDirection;
|
package/shared/direction.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expose ltr and rtl strings
|
|
3
|
-
*/
|
|
4
|
-
var Direction$1;
|
|
5
|
-
(function (Direction) {
|
|
6
|
-
Direction["ltr"] = "ltr";
|
|
7
|
-
Direction["rtl"] = "rtl";
|
|
8
|
-
})(Direction$1 || (Direction$1 = {}));
|
|
9
|
-
|
|
10
1
|
/**
|
|
11
2
|
* Expose ltr and rtl strings
|
|
12
3
|
*/
|
|
@@ -16,14 +7,9 @@ var Direction;
|
|
|
16
7
|
Direction["rtl"] = "rtl";
|
|
17
8
|
})(Direction || (Direction = {}));
|
|
18
9
|
|
|
19
|
-
/**
|
|
20
|
-
* a method to determine the current localization direction of the view
|
|
21
|
-
* @param rootNode - the HTMLElement to begin the query from, usually "this" when used in a component controller
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
10
|
const getDirection = (rootNode) => {
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
const dirNode = rootNode.closest("[dir]");
|
|
12
|
+
return dirNode !== null && dirNode.dir === "rtl" ? Direction.rtl : Direction.ltr;
|
|
27
13
|
};
|
|
28
14
|
|
|
29
|
-
export { Direction
|
|
15
|
+
export { Direction as D, getDirection as g };
|
package/shared/listbox.cjs
CHANGED
|
@@ -4,7 +4,6 @@ const option = require('./option.cjs');
|
|
|
4
4
|
const vividElement = require('./vivid-element.cjs');
|
|
5
5
|
const keyCodes = require('./key-codes.cjs');
|
|
6
6
|
const strings = require('./strings.cjs');
|
|
7
|
-
const applyMixins = require('./apply-mixins2.cjs');
|
|
8
7
|
const ariaGlobal = require('./aria-global.cjs');
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -23,6 +22,26 @@ function findLastIndex(array, predicate) {
|
|
|
23
22
|
return -1;
|
|
24
23
|
}
|
|
25
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Apply mixins to a constructor.
|
|
27
|
+
* Sourced from {@link https://www.typescriptlang.org/docs/handbook/mixins.html | TypeScript Documentation }.
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
function applyMixins(derivedCtor, ...baseCtors) {
|
|
31
|
+
const derivedAttributes = vividElement.AttributeConfiguration.locate(derivedCtor);
|
|
32
|
+
baseCtors.forEach(baseCtor => {
|
|
33
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
34
|
+
if (name !== "constructor") {
|
|
35
|
+
Object.defineProperty(derivedCtor.prototype, name,
|
|
36
|
+
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
37
|
+
Object.getOwnPropertyDescriptor(baseCtor.prototype, name));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const baseAttributes = vividElement.AttributeConfiguration.locate(baseCtor);
|
|
41
|
+
baseAttributes.forEach(x => derivedAttributes.push(x));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
26
45
|
var __defProp = Object.defineProperty;
|
|
27
46
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
28
47
|
var result = void 0 ;
|
|
@@ -490,7 +509,7 @@ __decorateClass([
|
|
|
490
509
|
__decorateClass([
|
|
491
510
|
vividElement.observable
|
|
492
511
|
], DelegatesARIAListbox.prototype, "ariaMultiSelectable");
|
|
493
|
-
applyMixins
|
|
494
|
-
applyMixins
|
|
512
|
+
applyMixins(DelegatesARIAListbox, ariaGlobal.ARIAGlobalStatesAndProperties);
|
|
513
|
+
applyMixins(Listbox, DelegatesARIAListbox);
|
|
495
514
|
|
|
496
515
|
exports.Listbox = Listbox;
|
package/shared/listbox.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { i as isListboxOption } from './option.js';
|
|
2
|
-
import { V as VividElement, O as Observable, a as attr, o as observable } from './vivid-element.js';
|
|
2
|
+
import { A as AttributeConfiguration, V as VividElement, O as Observable, a as attr, o as observable } from './vivid-element.js';
|
|
3
3
|
import { a as keySpace, b as keyEscape, k as keyEnter, c as keyTab, d as keyEnd, e as keyArrowUp, f as keyArrowDown, g as keyHome } from './key-codes.js';
|
|
4
4
|
import { u as uniqueId } from './strings.js';
|
|
5
|
-
import { a as applyMixins } from './apply-mixins2.js';
|
|
6
5
|
import { A as ARIAGlobalStatesAndProperties } from './aria-global.js';
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -21,6 +20,26 @@ function findLastIndex(array, predicate) {
|
|
|
21
20
|
return -1;
|
|
22
21
|
}
|
|
23
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Apply mixins to a constructor.
|
|
25
|
+
* Sourced from {@link https://www.typescriptlang.org/docs/handbook/mixins.html | TypeScript Documentation }.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
function applyMixins(derivedCtor, ...baseCtors) {
|
|
29
|
+
const derivedAttributes = AttributeConfiguration.locate(derivedCtor);
|
|
30
|
+
baseCtors.forEach(baseCtor => {
|
|
31
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
32
|
+
if (name !== "constructor") {
|
|
33
|
+
Object.defineProperty(derivedCtor.prototype, name,
|
|
34
|
+
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
35
|
+
Object.getOwnPropertyDescriptor(baseCtor.prototype, name));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const baseAttributes = AttributeConfiguration.locate(baseCtor);
|
|
39
|
+
baseAttributes.forEach(x => derivedAttributes.push(x));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
24
43
|
var __defProp = Object.defineProperty;
|
|
25
44
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
26
45
|
var result = void 0 ;
|
package/shared/text-anchor.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const vividElement = require('./vivid-element.cjs');
|
|
3
4
|
const affix = require('./affix.cjs');
|
|
4
5
|
const applyMixins = require('./apply-mixins.cjs');
|
|
5
6
|
const anchor = require('./anchor.cjs');
|
|
6
|
-
const vividElement = require('./vivid-element.cjs');
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
9
9
|
var __decorateClass = (decorators, target, key, kind) => {
|
package/shared/text-anchor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { V as VividElement, a as attr } from './vivid-element.js';
|
|
1
2
|
import { b as AffixIcon } from './affix.js';
|
|
2
3
|
import { a as applyMixins } from './apply-mixins.js';
|
|
3
4
|
import { A as Anchor } from './anchor.js';
|
|
4
|
-
import { V as VividElement, a as attr } from './vivid-element.js';
|
|
5
5
|
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
7
7
|
var __decorateClass = (decorators, target, key, kind) => {
|