@vonage/vivid 4.14.1 → 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 +393 -201
- 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/divider/divider.d.ts +1 -1
- package/lib/divider/divider.template.d.ts +1 -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/affix.js +1 -1
- package/shared/applyMixinsWithObservables.cjs +1 -1
- package/shared/applyMixinsWithObservables.js +1 -1
- package/shared/definition.js +1 -1
- package/shared/definition11.cjs +1 -1
- package/shared/definition11.js +2 -2
- package/shared/definition16.cjs +64 -32
- package/shared/definition16.js +62 -30
- package/shared/definition17.cjs +9 -7
- package/shared/definition17.js +9 -7
- package/shared/definition2.cjs +9 -4
- package/shared/definition2.js +9 -5
- package/shared/definition22.cjs +2 -1
- package/shared/definition22.js +2 -1
- package/shared/definition24.js +1 -1
- package/shared/definition25.cjs +25 -18
- package/shared/definition25.js +26 -19
- package/shared/definition27.cjs +1 -1
- package/shared/definition27.js +1 -1
- package/shared/definition29.cjs +12 -30
- package/shared/definition29.js +13 -31
- package/shared/definition30.js +1 -1
- package/shared/definition31.js +1 -1
- package/shared/definition33.cjs +1 -1
- package/shared/definition33.js +2 -2
- package/shared/definition34.cjs +7 -228
- package/shared/definition34.js +5 -226
- package/shared/definition35.cjs +2 -201
- package/shared/definition35.js +4 -201
- package/shared/definition4.js +1 -1
- package/shared/definition41.cjs +1 -1
- package/shared/definition41.js +1 -1
- package/shared/definition42.cjs +2 -3
- package/shared/definition42.js +3 -4
- package/shared/definition43.cjs +10 -11
- package/shared/definition43.js +6 -7
- package/shared/definition46.cjs +2 -2
- package/shared/definition46.js +3 -3
- package/shared/definition47.js +1 -1
- 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/definition50.js +1 -1
- package/shared/definition51.cjs +14 -383
- package/shared/definition51.js +17 -386
- package/shared/definition53.js +1 -1
- package/shared/definition54.js +1 -1
- package/shared/definition56.js +1 -1
- package/shared/definition59.js +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.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 +25 -6
- package/shared/listbox.js +22 -3
- package/shared/option.cjs +205 -0
- package/shared/option.js +202 -0
- package/shared/text-anchor.cjs +1 -1
- package/shared/text-anchor.js +2 -2
- package/shared/text-field2.js +2 -2
- 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/lib/listbox/definition.d.ts +0 -2
- package/lib/listbox/listbox.d.ts +0 -14
- package/lib/listbox/listbox.template.d.ts +0 -2
- package/listbox/index.cjs +0 -54
- package/listbox/index.js +0 -52
- package/shared/apply-mixins2.cjs +0 -25
- package/shared/apply-mixins2.js +0 -23
- package/shared/aria-global2.cjs +0 -75
- package/shared/aria-global2.js +0 -73
- package/shared/form-associated2.cjs +0 -383
- package/shared/form-associated2.js +0 -381
- package/shared/key-codes2.cjs +0 -1565
- package/shared/key-codes2.js +0 -1551
- package/shared/listbox2.cjs +0 -1267
- package/shared/listbox2.js +0 -1264
- package/shared/strings2.cjs +0 -37
- package/shared/strings2.js +0 -33
package/shared/definition51.js
CHANGED
|
@@ -1,387 +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 { u as uniqueId, l as limit } from './strings2.js';
|
|
8
|
-
import { u as uniqueId$1 } from './strings.js';
|
|
9
|
-
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';
|
|
10
7
|
import { r as ref } from './ref.js';
|
|
11
8
|
import { s as slotted } from './slotted.js';
|
|
12
9
|
import { w as when } from './when.js';
|
|
13
10
|
import { c as classNames } from './class-names.js';
|
|
14
11
|
|
|
15
|
-
/**
|
|
16
|
-
* The orientation of the {@link @microsoft/fast-foundation#(Tabs:class)} component
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
const TabsOrientation = {
|
|
20
|
-
vertical: "vertical",
|
|
21
|
-
horizontal: "horizontal",
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* A Tabs Custom HTML Element.
|
|
25
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#tablist | ARIA tablist }.
|
|
26
|
-
*
|
|
27
|
-
* @slot start - Content which can be provided before the tablist element
|
|
28
|
-
* @slot end - Content which can be provided after the tablist element
|
|
29
|
-
* @slot tab - The slot for tabs
|
|
30
|
-
* @slot tabpanel - The slot for tabpanels
|
|
31
|
-
* @csspart tablist - The element wrapping for the tabs
|
|
32
|
-
* @csspart tab - The tab slot
|
|
33
|
-
* @csspart activeIndicator - The visual indicator
|
|
34
|
-
* @csspart tabpanel - The tabpanel slot
|
|
35
|
-
* @fires change - Fires a custom 'change' event when a tab is clicked or during keyboard navigation
|
|
36
|
-
*
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
let Tabs$1 = class Tabs extends FoundationElement {
|
|
40
|
-
constructor() {
|
|
41
|
-
super(...arguments);
|
|
42
|
-
/**
|
|
43
|
-
* The orientation
|
|
44
|
-
* @public
|
|
45
|
-
* @remarks
|
|
46
|
-
* HTML Attribute: orientation
|
|
47
|
-
*/
|
|
48
|
-
this.orientation = TabsOrientation.horizontal;
|
|
49
|
-
/**
|
|
50
|
-
* Whether or not to show the active indicator
|
|
51
|
-
* @public
|
|
52
|
-
* @remarks
|
|
53
|
-
* HTML Attribute: activeindicator
|
|
54
|
-
*/
|
|
55
|
-
this.activeindicator = true;
|
|
56
|
-
/**
|
|
57
|
-
* @internal
|
|
58
|
-
*/
|
|
59
|
-
this.showActiveIndicator = true;
|
|
60
|
-
this.prevActiveTabIndex = 0;
|
|
61
|
-
this.activeTabIndex = 0;
|
|
62
|
-
this.ticking = false;
|
|
63
|
-
this.change = () => {
|
|
64
|
-
this.$emit("change", this.activetab);
|
|
65
|
-
};
|
|
66
|
-
this.isDisabledElement = (el) => {
|
|
67
|
-
return el.getAttribute("aria-disabled") === "true";
|
|
68
|
-
};
|
|
69
|
-
this.isHiddenElement = (el) => {
|
|
70
|
-
return el.hasAttribute("hidden");
|
|
71
|
-
};
|
|
72
|
-
this.isFocusableElement = (el) => {
|
|
73
|
-
return !this.isDisabledElement(el) && !this.isHiddenElement(el);
|
|
74
|
-
};
|
|
75
|
-
this.setTabs = () => {
|
|
76
|
-
const gridHorizontalProperty = "gridColumn";
|
|
77
|
-
const gridVerticalProperty = "gridRow";
|
|
78
|
-
const gridProperty = this.isHorizontal()
|
|
79
|
-
? gridHorizontalProperty
|
|
80
|
-
: gridVerticalProperty;
|
|
81
|
-
this.activeTabIndex = this.getActiveIndex();
|
|
82
|
-
this.showActiveIndicator = false;
|
|
83
|
-
this.tabs.forEach((tab, index) => {
|
|
84
|
-
if (tab.slot === "tab") {
|
|
85
|
-
const isActiveTab = this.activeTabIndex === index && this.isFocusableElement(tab);
|
|
86
|
-
if (this.activeindicator && this.isFocusableElement(tab)) {
|
|
87
|
-
this.showActiveIndicator = true;
|
|
88
|
-
}
|
|
89
|
-
const tabId = this.tabIds[index];
|
|
90
|
-
const tabpanelId = this.tabpanelIds[index];
|
|
91
|
-
tab.setAttribute("id", tabId);
|
|
92
|
-
tab.setAttribute("aria-selected", isActiveTab ? "true" : "false");
|
|
93
|
-
tab.setAttribute("aria-controls", tabpanelId);
|
|
94
|
-
tab.addEventListener("click", this.handleTabClick);
|
|
95
|
-
tab.addEventListener("keydown", this.handleTabKeyDown);
|
|
96
|
-
tab.setAttribute("tabindex", isActiveTab ? "0" : "-1");
|
|
97
|
-
if (isActiveTab) {
|
|
98
|
-
this.activetab = tab;
|
|
99
|
-
this.activeid = tabId;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
// If the original property isn't emptied out,
|
|
103
|
-
// the next set will morph into a grid-area style setting that is not what we want
|
|
104
|
-
tab.style[gridHorizontalProperty] = "";
|
|
105
|
-
tab.style[gridVerticalProperty] = "";
|
|
106
|
-
tab.style[gridProperty] = `${index + 1}`;
|
|
107
|
-
!this.isHorizontal()
|
|
108
|
-
? tab.classList.add("vertical")
|
|
109
|
-
: tab.classList.remove("vertical");
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
this.setTabPanels = () => {
|
|
113
|
-
this.tabpanels.forEach((tabpanel, index) => {
|
|
114
|
-
const tabId = this.tabIds[index];
|
|
115
|
-
const tabpanelId = this.tabpanelIds[index];
|
|
116
|
-
tabpanel.setAttribute("id", tabpanelId);
|
|
117
|
-
tabpanel.setAttribute("aria-labelledby", tabId);
|
|
118
|
-
this.activeTabIndex !== index
|
|
119
|
-
? tabpanel.setAttribute("hidden", "")
|
|
120
|
-
: tabpanel.removeAttribute("hidden");
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
this.handleTabClick = (event) => {
|
|
124
|
-
const selectedTab = event.currentTarget;
|
|
125
|
-
if (selectedTab.nodeType === 1 && this.isFocusableElement(selectedTab)) {
|
|
126
|
-
this.prevActiveTabIndex = this.activeTabIndex;
|
|
127
|
-
this.activeTabIndex = this.tabs.indexOf(selectedTab);
|
|
128
|
-
this.setComponent();
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
this.handleTabKeyDown = (event) => {
|
|
132
|
-
if (this.isHorizontal()) {
|
|
133
|
-
switch (event.key) {
|
|
134
|
-
case keyArrowLeft:
|
|
135
|
-
event.preventDefault();
|
|
136
|
-
this.adjustBackward(event);
|
|
137
|
-
break;
|
|
138
|
-
case keyArrowRight:
|
|
139
|
-
event.preventDefault();
|
|
140
|
-
this.adjustForward(event);
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
switch (event.key) {
|
|
146
|
-
case keyArrowUp:
|
|
147
|
-
event.preventDefault();
|
|
148
|
-
this.adjustBackward(event);
|
|
149
|
-
break;
|
|
150
|
-
case keyArrowDown:
|
|
151
|
-
event.preventDefault();
|
|
152
|
-
this.adjustForward(event);
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
switch (event.key) {
|
|
157
|
-
case keyHome:
|
|
158
|
-
event.preventDefault();
|
|
159
|
-
this.adjust(-this.activeTabIndex);
|
|
160
|
-
break;
|
|
161
|
-
case keyEnd:
|
|
162
|
-
event.preventDefault();
|
|
163
|
-
this.adjust(this.tabs.length - this.activeTabIndex - 1);
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
this.adjustForward = (e) => {
|
|
168
|
-
const group = this.tabs;
|
|
169
|
-
let index = 0;
|
|
170
|
-
index = this.activetab ? group.indexOf(this.activetab) + 1 : 1;
|
|
171
|
-
if (index === group.length) {
|
|
172
|
-
index = 0;
|
|
173
|
-
}
|
|
174
|
-
while (index < group.length && group.length > 1) {
|
|
175
|
-
if (this.isFocusableElement(group[index])) {
|
|
176
|
-
this.moveToTabByIndex(group, index);
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
else if (this.activetab && index === group.indexOf(this.activetab)) {
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
else if (index + 1 >= group.length) {
|
|
183
|
-
index = 0;
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
index += 1;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
this.adjustBackward = (e) => {
|
|
191
|
-
const group = this.tabs;
|
|
192
|
-
let index = 0;
|
|
193
|
-
index = this.activetab ? group.indexOf(this.activetab) - 1 : 0;
|
|
194
|
-
index = index < 0 ? group.length - 1 : index;
|
|
195
|
-
while (index >= 0 && group.length > 1) {
|
|
196
|
-
if (this.isFocusableElement(group[index])) {
|
|
197
|
-
this.moveToTabByIndex(group, index);
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
else if (index - 1 < 0) {
|
|
201
|
-
index = group.length - 1;
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
index -= 1;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
this.moveToTabByIndex = (group, index) => {
|
|
209
|
-
const tab = group[index];
|
|
210
|
-
this.activetab = tab;
|
|
211
|
-
this.prevActiveTabIndex = this.activeTabIndex;
|
|
212
|
-
this.activeTabIndex = index;
|
|
213
|
-
tab.focus();
|
|
214
|
-
this.setComponent();
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* @internal
|
|
219
|
-
*/
|
|
220
|
-
orientationChanged() {
|
|
221
|
-
if (this.$fastController.isConnected) {
|
|
222
|
-
this.setTabs();
|
|
223
|
-
this.setTabPanels();
|
|
224
|
-
this.handleActiveIndicatorPosition();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* @internal
|
|
229
|
-
*/
|
|
230
|
-
activeidChanged(oldValue, newValue) {
|
|
231
|
-
if (this.$fastController.isConnected &&
|
|
232
|
-
this.tabs.length <= this.tabpanels.length) {
|
|
233
|
-
this.prevActiveTabIndex = this.tabs.findIndex((item) => item.id === oldValue);
|
|
234
|
-
this.setTabs();
|
|
235
|
-
this.setTabPanels();
|
|
236
|
-
this.handleActiveIndicatorPosition();
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* @internal
|
|
241
|
-
*/
|
|
242
|
-
tabsChanged() {
|
|
243
|
-
if (this.$fastController.isConnected &&
|
|
244
|
-
this.tabs.length <= this.tabpanels.length) {
|
|
245
|
-
this.tabIds = this.getTabIds();
|
|
246
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
247
|
-
this.setTabs();
|
|
248
|
-
this.setTabPanels();
|
|
249
|
-
this.handleActiveIndicatorPosition();
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* @internal
|
|
254
|
-
*/
|
|
255
|
-
tabpanelsChanged() {
|
|
256
|
-
if (this.$fastController.isConnected &&
|
|
257
|
-
this.tabpanels.length <= this.tabs.length) {
|
|
258
|
-
this.tabIds = this.getTabIds();
|
|
259
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
260
|
-
this.setTabs();
|
|
261
|
-
this.setTabPanels();
|
|
262
|
-
this.handleActiveIndicatorPosition();
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
getActiveIndex() {
|
|
266
|
-
const id = this.activeid;
|
|
267
|
-
if (id !== undefined) {
|
|
268
|
-
return this.tabIds.indexOf(this.activeid) === -1
|
|
269
|
-
? 0
|
|
270
|
-
: this.tabIds.indexOf(this.activeid);
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
return 0;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
getTabIds() {
|
|
277
|
-
return this.tabs.map((tab) => {
|
|
278
|
-
var _a;
|
|
279
|
-
return (_a = tab.getAttribute("id")) !== null && _a !== void 0 ? _a : `tab-${uniqueId()}`;
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
getTabPanelIds() {
|
|
283
|
-
return this.tabpanels.map((tabPanel) => {
|
|
284
|
-
var _a;
|
|
285
|
-
return (_a = tabPanel.getAttribute("id")) !== null && _a !== void 0 ? _a : `panel-${uniqueId()}`;
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
setComponent() {
|
|
289
|
-
if (this.activeTabIndex !== this.prevActiveTabIndex) {
|
|
290
|
-
this.activeid = this.tabIds[this.activeTabIndex];
|
|
291
|
-
this.focusTab();
|
|
292
|
-
this.change();
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
isHorizontal() {
|
|
296
|
-
return this.orientation === TabsOrientation.horizontal;
|
|
297
|
-
}
|
|
298
|
-
handleActiveIndicatorPosition() {
|
|
299
|
-
// Ignore if we click twice on the same tab
|
|
300
|
-
if (this.showActiveIndicator &&
|
|
301
|
-
this.activeindicator &&
|
|
302
|
-
this.activeTabIndex !== this.prevActiveTabIndex) {
|
|
303
|
-
if (this.ticking) {
|
|
304
|
-
this.ticking = false;
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
this.ticking = true;
|
|
308
|
-
this.animateActiveIndicator();
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
animateActiveIndicator() {
|
|
313
|
-
this.ticking = true;
|
|
314
|
-
const gridProperty = this.isHorizontal() ? "gridColumn" : "gridRow";
|
|
315
|
-
const translateProperty = this.isHorizontal()
|
|
316
|
-
? "translateX"
|
|
317
|
-
: "translateY";
|
|
318
|
-
const offsetProperty = this.isHorizontal() ? "offsetLeft" : "offsetTop";
|
|
319
|
-
const prev = this.activeIndicatorRef[offsetProperty];
|
|
320
|
-
this.activeIndicatorRef.style[gridProperty] = `${this.activeTabIndex + 1}`;
|
|
321
|
-
const next = this.activeIndicatorRef[offsetProperty];
|
|
322
|
-
this.activeIndicatorRef.style[gridProperty] = `${this.prevActiveTabIndex + 1}`;
|
|
323
|
-
const dif = next - prev;
|
|
324
|
-
this.activeIndicatorRef.style.transform = `${translateProperty}(${dif}px)`;
|
|
325
|
-
this.activeIndicatorRef.classList.add("activeIndicatorTransition");
|
|
326
|
-
this.activeIndicatorRef.addEventListener("transitionend", () => {
|
|
327
|
-
this.ticking = false;
|
|
328
|
-
this.activeIndicatorRef.style[gridProperty] = `${this.activeTabIndex + 1}`;
|
|
329
|
-
this.activeIndicatorRef.style.transform = `${translateProperty}(0px)`;
|
|
330
|
-
this.activeIndicatorRef.classList.remove("activeIndicatorTransition");
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* The adjust method for FASTTabs
|
|
335
|
-
* @public
|
|
336
|
-
* @remarks
|
|
337
|
-
* This method allows the active index to be adjusted by numerical increments
|
|
338
|
-
*/
|
|
339
|
-
adjust(adjustment) {
|
|
340
|
-
const focusableTabs = this.tabs.filter(t => this.isFocusableElement(t));
|
|
341
|
-
const currentActiveTabIndex = focusableTabs.indexOf(this.activetab);
|
|
342
|
-
const nextTabIndex = limit(0, focusableTabs.length - 1, currentActiveTabIndex + adjustment);
|
|
343
|
-
// the index of the next focusable tab within the context of all available tabs
|
|
344
|
-
const nextIndex = this.tabs.indexOf(focusableTabs[nextTabIndex]);
|
|
345
|
-
if (nextIndex > -1) {
|
|
346
|
-
this.moveToTabByIndex(this.tabs, nextIndex);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
focusTab() {
|
|
350
|
-
this.tabs[this.activeTabIndex].focus();
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* @internal
|
|
354
|
-
*/
|
|
355
|
-
connectedCallback() {
|
|
356
|
-
super.connectedCallback();
|
|
357
|
-
this.tabIds = this.getTabIds();
|
|
358
|
-
this.tabpanelIds = this.getTabPanelIds();
|
|
359
|
-
this.activeTabIndex = this.getActiveIndex();
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
__decorate([
|
|
363
|
-
attr
|
|
364
|
-
], Tabs$1.prototype, "orientation", void 0);
|
|
365
|
-
__decorate([
|
|
366
|
-
attr
|
|
367
|
-
], Tabs$1.prototype, "activeid", void 0);
|
|
368
|
-
__decorate([
|
|
369
|
-
observable
|
|
370
|
-
], Tabs$1.prototype, "tabs", void 0);
|
|
371
|
-
__decorate([
|
|
372
|
-
observable
|
|
373
|
-
], Tabs$1.prototype, "tabpanels", void 0);
|
|
374
|
-
__decorate([
|
|
375
|
-
attr({ mode: "boolean" })
|
|
376
|
-
], Tabs$1.prototype, "activeindicator", void 0);
|
|
377
|
-
__decorate([
|
|
378
|
-
observable
|
|
379
|
-
], Tabs$1.prototype, "activeIndicatorRef", void 0);
|
|
380
|
-
__decorate([
|
|
381
|
-
observable
|
|
382
|
-
], Tabs$1.prototype, "showActiveIndicator", void 0);
|
|
383
|
-
applyMixins(Tabs$1, StartEnd);
|
|
384
|
-
|
|
385
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}";
|
|
386
13
|
|
|
387
14
|
var __defProp = Object.defineProperty;
|
|
@@ -395,6 +22,10 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
395
22
|
};
|
|
396
23
|
const ACTIVE_TAB_WIDTH = "--_tabs-active-tab-inline-size";
|
|
397
24
|
const TABLIST_COLUMN = "--_tabs-tablist-column";
|
|
25
|
+
const TabsOrientation = {
|
|
26
|
+
vertical: "vertical",
|
|
27
|
+
horizontal: "horizontal"
|
|
28
|
+
};
|
|
398
29
|
class Tabs extends VividElement {
|
|
399
30
|
constructor() {
|
|
400
31
|
super(...arguments);
|
|
@@ -486,33 +117,33 @@ class Tabs extends VividElement {
|
|
|
486
117
|
this.#handleTabKeyDown = (event) => {
|
|
487
118
|
if (this.#isHorizontal()) {
|
|
488
119
|
switch (event.key) {
|
|
489
|
-
case keyArrowLeft
|
|
120
|
+
case keyArrowLeft:
|
|
490
121
|
event.preventDefault();
|
|
491
122
|
this.adjustBackward(event);
|
|
492
123
|
break;
|
|
493
|
-
case keyArrowRight
|
|
124
|
+
case keyArrowRight:
|
|
494
125
|
event.preventDefault();
|
|
495
126
|
this.adjustForward(event);
|
|
496
127
|
break;
|
|
497
128
|
}
|
|
498
129
|
} else {
|
|
499
130
|
switch (event.key) {
|
|
500
|
-
case keyArrowUp
|
|
131
|
+
case keyArrowUp:
|
|
501
132
|
event.preventDefault();
|
|
502
133
|
this.adjustBackward(event);
|
|
503
134
|
break;
|
|
504
|
-
case keyArrowDown
|
|
135
|
+
case keyArrowDown:
|
|
505
136
|
event.preventDefault();
|
|
506
137
|
this.adjustForward(event);
|
|
507
138
|
break;
|
|
508
139
|
}
|
|
509
140
|
}
|
|
510
141
|
switch (event.key) {
|
|
511
|
-
case keyHome
|
|
142
|
+
case keyHome:
|
|
512
143
|
event.preventDefault();
|
|
513
144
|
this.adjust(-this.activeTabIndex);
|
|
514
145
|
break;
|
|
515
|
-
case keyEnd
|
|
146
|
+
case keyEnd:
|
|
516
147
|
event.preventDefault();
|
|
517
148
|
this.adjust(this.tabs.length - this.activeTabIndex - 1);
|
|
518
149
|
break;
|
|
@@ -608,12 +239,12 @@ class Tabs extends VividElement {
|
|
|
608
239
|
}
|
|
609
240
|
getTabIds() {
|
|
610
241
|
return this.tabs.map((tab) => {
|
|
611
|
-
return tab.getAttribute("id") ?? `tab-${uniqueId
|
|
242
|
+
return tab.getAttribute("id") ?? `tab-${uniqueId()}`;
|
|
612
243
|
});
|
|
613
244
|
}
|
|
614
245
|
getTabPanelIds() {
|
|
615
246
|
return this.tabpanels.map((tabPanel) => {
|
|
616
|
-
return tabPanel.getAttribute("id") ?? `panel-${uniqueId
|
|
247
|
+
return tabPanel.getAttribute("id") ?? `panel-${uniqueId()}`;
|
|
617
248
|
});
|
|
618
249
|
}
|
|
619
250
|
setComponent() {
|
|
@@ -634,7 +265,7 @@ class Tabs extends VividElement {
|
|
|
634
265
|
adjust(adjustment) {
|
|
635
266
|
const focusableTabs = this.tabs.filter((t) => this.isFocusableElement(t));
|
|
636
267
|
const currentActiveTabIndex = focusableTabs.indexOf(this.activetab);
|
|
637
|
-
const nextTabIndex = limit
|
|
268
|
+
const nextTabIndex = limit(
|
|
638
269
|
0,
|
|
639
270
|
focusableTabs.length - 1,
|
|
640
271
|
currentActiveTabIndex + adjustment
|
package/shared/definition53.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { I as Icon, i as iconDefinition } from './definition27.js';
|
|
2
2
|
import { V as VividElement, a as attr, h as html, d as defineVividComponent, f as createRegisterFunction } from './vivid-element.js';
|
|
3
3
|
import { a as applyMixins } from './apply-mixins.js';
|
|
4
|
-
import {
|
|
4
|
+
import { b as AffixIcon, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
5
5
|
import { w as when } from './when.js';
|
|
6
6
|
import { c as classNames } from './class-names.js';
|
|
7
7
|
|
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/definition59.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { I as Icon, i as iconDefinition } from './definition27.js';
|
|
2
2
|
import { V as VividElement, a as attr, o as observable, h as html, d as defineVividComponent, f as createRegisterFunction } from './vivid-element.js';
|
|
3
3
|
import { a as applyMixins } from './apply-mixins.js';
|
|
4
|
-
import {
|
|
4
|
+
import { b as AffixIcon, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
5
5
|
import { i as isHTMLElement } from './dom.js';
|
|
6
6
|
import { e as elements, s as slotted } from './slotted.js';
|
|
7
7
|
import { c as children } from './children.js';
|
package/shared/definition7.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { V as VividElement, a as attr, h as html, d as defineVividComponent, f as createRegisterFunction } from './vivid-element.js';
|
|
2
2
|
import { i as iconDefinition } from './definition27.js';
|
|
3
|
-
import {
|
|
3
|
+
import { A as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
4
4
|
import { a as applyMixins } from './apply-mixins.js';
|
|
5
5
|
import { w as when } from './when.js';
|
|
6
6
|
import { c as classNames } from './class-names.js';
|
package/shared/definition8.js
CHANGED
|
@@ -3,7 +3,7 @@ import { i as iconDefinition } from './definition27.js';
|
|
|
3
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
4
|
import { a as applyMixins } from './apply-mixins.js';
|
|
5
5
|
import { C as Connotation } from './enums.js';
|
|
6
|
-
import {
|
|
6
|
+
import { b as AffixIcon, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
7
7
|
import { L as Localized } from './localized.js';
|
|
8
8
|
import { s as slotted } from './slotted.js';
|
|
9
9
|
import { w as when } from './when.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
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
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 ;
|
|
@@ -108,7 +127,7 @@ const _Listbox = class _Listbox extends vividElement.VividElement {
|
|
|
108
127
|
* @param n - element to filter
|
|
109
128
|
* @public
|
|
110
129
|
*/
|
|
111
|
-
this.slottedOptionFilter = (n) =>
|
|
130
|
+
this.slottedOptionFilter = (n) => option.isListboxOption(n) && !n.hidden;
|
|
112
131
|
}
|
|
113
132
|
static {
|
|
114
133
|
/**
|
|
@@ -419,7 +438,7 @@ const _Listbox = class _Listbox extends vividElement.VividElement {
|
|
|
419
438
|
*/
|
|
420
439
|
slottedOptionsChanged(_, next) {
|
|
421
440
|
this.options = next.reduce((options, item) => {
|
|
422
|
-
if (
|
|
441
|
+
if (option.isListboxOption(item)) {
|
|
423
442
|
options.push(item);
|
|
424
443
|
}
|
|
425
444
|
return options;
|
|
@@ -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;
|