@vonage/vivid 4.14.0 → 4.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +130 -23
- package/lib/elevation/elevation.d.ts +1 -0
- package/lib/radio/radio.form-associated.d.ts +2 -0
- package/lib/tabs/tabs.d.ts +0 -5
- package/lib/text-anchor/text-anchor.d.ts +2 -2
- package/lib/tree-item/tree-item.d.ts +2 -2
- package/lib/tree-view/tree-view.d.ts +2 -2
- package/listbox/index.cjs +4 -4
- package/listbox/index.js +1 -1
- package/package.json +1 -1
- package/shared/affix.cjs +8 -8
- package/shared/affix.js +1 -1
- package/shared/anchor.cjs +10 -10
- package/shared/anchor.js +1 -1
- package/shared/anchored.cjs +6 -6
- package/shared/anchored.js +1 -1
- package/shared/apply-mixins.cjs +3 -3
- package/shared/apply-mixins.js +1 -1
- package/shared/apply-mixins2.cjs +3 -3
- package/shared/apply-mixins2.js +1 -1
- package/shared/applyMixinsWithObservables.cjs +3 -3
- package/shared/applyMixinsWithObservables.js +1 -1
- package/shared/aria-global.cjs +20 -20
- package/shared/aria-global.js +1 -1
- package/shared/aria-global2.cjs +40 -40
- package/shared/aria-global2.js +2 -2
- package/shared/base-progress.cjs +7 -8
- package/shared/base-progress.js +2 -3
- package/shared/breadcrumb-item.cjs +2 -3
- package/shared/breadcrumb-item.js +1 -2
- package/shared/button.cjs +10 -11
- package/shared/button.js +1 -2
- package/shared/calendar-event.cjs +7 -8
- package/shared/calendar-event.js +1 -2
- package/shared/children.cjs +2 -2
- package/shared/children.js +1 -1
- package/shared/definition.cjs +14 -15
- package/shared/definition.js +1 -2
- package/shared/definition10.cjs +5 -6
- package/shared/definition10.js +1 -2
- package/shared/definition11.cjs +29 -29
- package/shared/definition11.js +1 -1
- package/shared/definition12.cjs +6 -6
- package/shared/definition12.js +1 -1
- package/shared/definition13.cjs +13 -14
- package/shared/definition13.js +1 -2
- package/shared/definition14.cjs +23 -24
- package/shared/definition14.js +1 -2
- package/shared/definition15.cjs +15 -16
- package/shared/definition15.js +1 -2
- package/shared/definition16.cjs +20 -19
- package/shared/definition16.js +3 -2
- package/shared/definition17.cjs +53 -54
- package/shared/definition17.js +1 -2
- package/shared/definition18.cjs +4 -4
- package/shared/definition18.js +1 -1
- package/shared/definition19.cjs +12 -12
- package/shared/definition19.js +1 -1
- package/shared/definition2.cjs +6 -7
- package/shared/definition2.js +1 -2
- package/shared/definition20.cjs +20 -21
- package/shared/definition20.js +1 -2
- package/shared/definition21.cjs +27 -28
- package/shared/definition21.js +3 -4
- package/shared/definition22.cjs +5 -6
- package/shared/definition22.js +1 -2
- package/shared/definition23.cjs +10 -11
- package/shared/definition23.js +1 -2
- package/shared/definition24.cjs +8 -8
- package/shared/definition24.js +2 -2
- package/shared/definition25.cjs +13 -14
- package/shared/definition25.js +1 -2
- package/shared/definition26.cjs +5 -6
- package/shared/definition26.js +1 -2
- package/shared/definition27.cjs +11 -12
- package/shared/definition27.js +1 -2
- package/shared/definition28.cjs +9 -10
- package/shared/definition28.js +2 -3
- package/shared/definition29.cjs +44 -45
- package/shared/definition29.js +2 -3
- package/shared/definition3.cjs +8 -9
- package/shared/definition3.js +1 -2
- package/shared/definition30.cjs +9 -10
- package/shared/definition30.js +1 -2
- package/shared/definition31.cjs +5 -5
- package/shared/definition31.js +1 -1
- package/shared/definition32.cjs +3 -4
- package/shared/definition32.js +1 -2
- package/shared/definition33.cjs +6 -7
- package/shared/definition33.js +1 -2
- package/shared/definition34.cjs +50 -52
- package/shared/definition34.js +2 -4
- package/shared/definition35.cjs +24 -25
- package/shared/definition35.js +1 -2
- package/shared/definition36.cjs +15 -16
- package/shared/definition36.js +1 -2
- package/shared/definition37.cjs +9 -9
- package/shared/definition37.js +1 -1
- package/shared/definition38.cjs +10 -10
- package/shared/definition38.js +1 -1
- package/shared/definition39.cjs +12 -13
- package/shared/definition39.js +1 -2
- package/shared/definition4.cjs +19 -20
- package/shared/definition4.js +1 -2
- package/shared/definition40.cjs +61 -13
- package/shared/definition40.js +52 -4
- package/shared/definition41.cjs +29 -30
- package/shared/definition41.js +1 -2
- package/shared/definition42.cjs +53 -54
- package/shared/definition42.js +2 -3
- package/shared/definition43.cjs +31 -31
- package/shared/definition43.js +1 -1
- package/shared/definition44.cjs +14 -15
- package/shared/definition44.js +1 -2
- package/shared/definition45.cjs +9 -10
- package/shared/definition45.js +1 -2
- package/shared/definition46.cjs +26 -27
- package/shared/definition46.js +1 -2
- package/shared/definition47.cjs +17 -18
- package/shared/definition47.js +1 -2
- package/shared/definition48.cjs +9 -10
- package/shared/definition48.js +1 -2
- package/shared/definition49.cjs +3 -4
- package/shared/definition49.js +1 -2
- package/shared/definition5.cjs +30 -31
- package/shared/definition5.js +1 -2
- package/shared/definition50.cjs +12 -13
- package/shared/definition50.js +1 -2
- package/shared/definition51.cjs +87 -72
- package/shared/definition51.js +56 -41
- package/shared/definition52.cjs +4 -5
- package/shared/definition52.js +1 -2
- package/shared/definition53.cjs +15 -16
- package/shared/definition53.js +1 -2
- package/shared/definition54.cjs +20 -21
- package/shared/definition54.js +1 -2
- package/shared/definition55.cjs +5 -5
- package/shared/definition55.js +1 -1
- package/shared/definition56.cjs +18 -19
- package/shared/definition56.js +1 -2
- package/shared/definition57.cjs +10 -11
- package/shared/definition57.js +1 -2
- package/shared/definition58.cjs +7 -8
- package/shared/definition58.js +1 -2
- package/shared/definition59.cjs +16 -17
- package/shared/definition59.js +2 -3
- package/shared/definition6.cjs +11 -12
- package/shared/definition6.js +1 -2
- package/shared/definition60.cjs +9 -10
- package/shared/definition60.js +2 -3
- package/shared/definition61.cjs +27 -30
- package/shared/definition61.js +17 -20
- package/shared/definition62.cjs +12 -9
- package/shared/definition62.js +8 -5
- package/shared/definition63.cjs +13 -14
- package/shared/definition63.js +1 -2
- package/shared/definition7.cjs +9 -10
- package/shared/definition7.js +1 -2
- package/shared/definition8.cjs +14 -15
- package/shared/definition8.js +1 -2
- package/shared/definition9.cjs +7 -7
- package/shared/definition9.js +1 -1
- package/shared/form-associated.cjs +14 -14
- package/shared/form-associated.js +1 -1
- package/shared/form-associated2.cjs +10 -10
- package/shared/form-associated2.js +1 -1
- package/shared/form-elements.cjs +13 -13
- package/shared/form-elements.js +1 -1
- package/shared/foundation/progress/base-progress.d.ts +2 -2
- package/shared/key-codes2.cjs +1416 -3
- package/shared/key-codes2.js +1413 -2
- package/shared/listbox.cjs +12 -13
- package/shared/listbox.js +1 -2
- package/shared/listbox2.cjs +59 -60
- package/shared/listbox2.js +2 -3
- package/shared/localized.cjs +2 -2
- package/shared/localized.js +1 -1
- package/shared/presentationDate.cjs +42 -43
- package/shared/presentationDate.js +1 -2
- package/shared/ref.cjs +2 -2
- package/shared/ref.js +1 -1
- package/shared/repeat.cjs +15 -15
- package/shared/repeat.js +1 -1
- package/shared/slider.template.cjs +4 -4
- package/shared/slider.template.js +1 -1
- package/shared/slotted.cjs +4 -4
- package/shared/slotted.js +1 -1
- package/shared/text-anchor.cjs +5 -6
- package/shared/text-anchor.js +2 -3
- package/shared/text-anchor.template.cjs +2 -2
- package/shared/text-anchor.template.js +1 -1
- package/shared/text-field2.cjs +23 -24
- package/shared/text-field2.js +1 -2
- package/shared/vivid-element.cjs +2610 -2
- package/shared/vivid-element.js +2591 -2
- package/styles/core/all.css +40 -1
- package/styles/core/theme.css +40 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +25 -4
- package/styles/tokens/theme-light.css +25 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/text-anchor/index.cjs +3 -3
- package/text-anchor/index.js +1 -1
- package/shared/defineVividComponent.cjs +0 -2612
- package/shared/defineVividComponent.js +0 -2592
- package/shared/foundation-element.cjs +0 -1417
- package/shared/foundation-element.js +0 -1414
package/shared/definition5.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { B as Button, b as buttonDefinition } from './definition11.js';
|
|
2
2
|
import { S as Slider, s as sliderDefinition } from './definition46.js';
|
|
3
3
|
import { d as Menu, e as MenuItem, b as menuDefinition, m as menuItemDefinition } from './definition29.js';
|
|
4
|
-
import { O as Observable, a as attr, h as html, d as defineVividComponent, f as createRegisterFunction } from './
|
|
4
|
+
import { V as VividElement, O as Observable, a as attr, h as html, d as defineVividComponent, f as createRegisterFunction } from './vivid-element.js';
|
|
5
5
|
import { M as MediaSkipBy } from './enums.js';
|
|
6
6
|
import { a as applyMixins } from './apply-mixins.js';
|
|
7
|
-
import { V as VividElement } from './vivid-element.js';
|
|
8
7
|
import { L as Localized } from './localized.js';
|
|
9
8
|
import { g as getPlaybackRatesArray } from './playbackRates.js';
|
|
10
9
|
import { w as when } from './when.js';
|
package/shared/definition50.cjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const definition = require('./definition27.cjs');
|
|
4
|
-
const
|
|
4
|
+
const vividElement = require('./vivid-element.cjs');
|
|
5
5
|
const applyMixins = require('./apply-mixins.cjs');
|
|
6
6
|
const affix = require('./affix.cjs');
|
|
7
|
-
const vividElement = require('./vivid-element.cjs');
|
|
8
7
|
const localized = require('./localized.cjs');
|
|
9
8
|
const classNames = require('./class-names.cjs');
|
|
10
9
|
|
|
@@ -38,25 +37,25 @@ class Tab extends vividElement.VividElement {
|
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
__decorateClass([
|
|
41
|
-
|
|
40
|
+
vividElement.attr({ mode: "boolean" })
|
|
42
41
|
], Tab.prototype, "disabled");
|
|
43
42
|
__decorateClass([
|
|
44
|
-
|
|
43
|
+
vividElement.attr
|
|
45
44
|
], Tab.prototype, "connotation");
|
|
46
45
|
__decorateClass([
|
|
47
|
-
|
|
46
|
+
vividElement.attr
|
|
48
47
|
], Tab.prototype, "shape");
|
|
49
48
|
__decorateClass([
|
|
50
|
-
|
|
49
|
+
vividElement.attr
|
|
51
50
|
], Tab.prototype, "label");
|
|
52
51
|
__decorateClass([
|
|
53
|
-
|
|
52
|
+
vividElement.attr({ mode: "boolean" })
|
|
54
53
|
], Tab.prototype, "removable");
|
|
55
54
|
__decorateClass([
|
|
56
|
-
|
|
55
|
+
vividElement.attr({ mode: "fromView" })
|
|
57
56
|
], Tab.prototype, "tabIndex");
|
|
58
57
|
__decorateClass([
|
|
59
|
-
|
|
58
|
+
vividElement.attr({ attribute: "aria-selected" })
|
|
60
59
|
], Tab.prototype, "ariaSelected");
|
|
61
60
|
applyMixins.applyMixins(Tab, affix.AffixIconWithTrailing);
|
|
62
61
|
applyMixins.applyMixins(Tab, localized.Localized);
|
|
@@ -82,7 +81,7 @@ const getClasses = ({
|
|
|
82
81
|
);
|
|
83
82
|
function renderDismissButton(context) {
|
|
84
83
|
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
85
|
-
return
|
|
84
|
+
return vividElement.html` <span
|
|
86
85
|
aria-label="${(x) => x.locale.tab.dismissButtonLabel}"
|
|
87
86
|
class="close"
|
|
88
87
|
id="close-btn"
|
|
@@ -93,7 +92,7 @@ function renderDismissButton(context) {
|
|
|
93
92
|
}
|
|
94
93
|
const TabTemplate = (context) => {
|
|
95
94
|
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
96
|
-
return
|
|
95
|
+
return vividElement.html`
|
|
97
96
|
<template
|
|
98
97
|
slot="tab"
|
|
99
98
|
role="tab"
|
|
@@ -109,7 +108,7 @@ const TabTemplate = (context) => {
|
|
|
109
108
|
`;
|
|
110
109
|
};
|
|
111
110
|
|
|
112
|
-
const tabDefinition =
|
|
111
|
+
const tabDefinition = vividElement.defineVividComponent(
|
|
113
112
|
"tab",
|
|
114
113
|
Tab,
|
|
115
114
|
TabTemplate,
|
|
@@ -118,7 +117,7 @@ const tabDefinition = defineVividComponent.defineVividComponent(
|
|
|
118
117
|
styles
|
|
119
118
|
}
|
|
120
119
|
);
|
|
121
|
-
const registerTab =
|
|
120
|
+
const registerTab = vividElement.createRegisterFunction(tabDefinition);
|
|
122
121
|
|
|
123
122
|
exports.registerTab = registerTab;
|
|
124
123
|
exports.tabDefinition = tabDefinition;
|
package/shared/definition50.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { i as iconDefinition } from './definition27.js';
|
|
2
|
-
import { a as attr, h as html, d as defineVividComponent, f as createRegisterFunction } from './
|
|
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
4
|
import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
5
|
-
import { V as VividElement } from './vivid-element.js';
|
|
6
5
|
import { L as Localized } from './localized.js';
|
|
7
6
|
import { c as classNames } from './class-names.js';
|
|
8
7
|
|
package/shared/definition51.cjs
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const definition = require('./definition50.cjs');
|
|
4
4
|
const definition$1 = require('./definition49.cjs');
|
|
5
|
-
const defineVividComponent = require('./defineVividComponent.cjs');
|
|
6
|
-
const keyCodes$1 = require('./key-codes.cjs');
|
|
7
5
|
const vividElement = require('./vivid-element.cjs');
|
|
8
|
-
const
|
|
6
|
+
const keyCodes$1 = require('./key-codes.cjs');
|
|
9
7
|
const keyCodes = require('./key-codes2.cjs');
|
|
10
8
|
const applyMixins = require('./apply-mixins2.cjs');
|
|
11
9
|
const strings = require('./strings2.cjs');
|
|
@@ -40,7 +38,7 @@ const TabsOrientation = {
|
|
|
40
38
|
*
|
|
41
39
|
* @public
|
|
42
40
|
*/
|
|
43
|
-
let Tabs$1 = class Tabs extends
|
|
41
|
+
let Tabs$1 = class Tabs extends keyCodes.FoundationElement {
|
|
44
42
|
constructor() {
|
|
45
43
|
super(...arguments);
|
|
46
44
|
/**
|
|
@@ -363,26 +361,26 @@ let Tabs$1 = class Tabs extends foundationElement.FoundationElement {
|
|
|
363
361
|
this.activeTabIndex = this.getActiveIndex();
|
|
364
362
|
}
|
|
365
363
|
};
|
|
366
|
-
|
|
367
|
-
|
|
364
|
+
keyCodes.__decorate([
|
|
365
|
+
vividElement.attr
|
|
368
366
|
], Tabs$1.prototype, "orientation", void 0);
|
|
369
|
-
|
|
370
|
-
|
|
367
|
+
keyCodes.__decorate([
|
|
368
|
+
vividElement.attr
|
|
371
369
|
], Tabs$1.prototype, "activeid", void 0);
|
|
372
|
-
|
|
373
|
-
|
|
370
|
+
keyCodes.__decorate([
|
|
371
|
+
vividElement.observable
|
|
374
372
|
], Tabs$1.prototype, "tabs", void 0);
|
|
375
|
-
|
|
376
|
-
|
|
373
|
+
keyCodes.__decorate([
|
|
374
|
+
vividElement.observable
|
|
377
375
|
], Tabs$1.prototype, "tabpanels", void 0);
|
|
378
|
-
|
|
379
|
-
|
|
376
|
+
keyCodes.__decorate([
|
|
377
|
+
vividElement.attr({ mode: "boolean" })
|
|
380
378
|
], Tabs$1.prototype, "activeindicator", void 0);
|
|
381
|
-
|
|
382
|
-
|
|
379
|
+
keyCodes.__decorate([
|
|
380
|
+
vividElement.observable
|
|
383
381
|
], Tabs$1.prototype, "activeIndicatorRef", void 0);
|
|
384
|
-
|
|
385
|
-
|
|
382
|
+
keyCodes.__decorate([
|
|
383
|
+
vividElement.observable
|
|
386
384
|
], Tabs$1.prototype, "showActiveIndicator", void 0);
|
|
387
385
|
applyMixins.applyMixins(Tabs$1, keyCodes.StartEnd);
|
|
388
386
|
|
|
@@ -404,6 +402,11 @@ class Tabs extends vividElement.VividElement {
|
|
|
404
402
|
super(...arguments);
|
|
405
403
|
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
406
404
|
this.orientation = TabsOrientation.horizontal;
|
|
405
|
+
this.#isLastTabSelectedAfterRemove = (oldValue, newValue, isTab = true) => {
|
|
406
|
+
return oldValue.length > newValue.length && this.activetab.id === oldValue[oldValue.length - 1].getAttribute(
|
|
407
|
+
isTab ? "id" : "aria-labelledby"
|
|
408
|
+
);
|
|
409
|
+
};
|
|
407
410
|
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
408
411
|
this.activeindicator = true;
|
|
409
412
|
this.showActiveIndicator = true;
|
|
@@ -426,10 +429,10 @@ class Tabs extends vividElement.VividElement {
|
|
|
426
429
|
this.setTabs = () => {
|
|
427
430
|
const gridHorizontalProperty = "gridColumn";
|
|
428
431
|
const gridVerticalProperty = "gridRow";
|
|
429
|
-
const gridProperty = this
|
|
432
|
+
const gridProperty = this.#isHorizontal() ? gridHorizontalProperty : gridVerticalProperty;
|
|
430
433
|
this.activeTabIndex = this.getActiveIndex();
|
|
431
434
|
this.showActiveIndicator = false;
|
|
432
|
-
if (this
|
|
435
|
+
if (this.#isHorizontal()) {
|
|
433
436
|
this.tablist.style.setProperty(
|
|
434
437
|
"grid-template-columns",
|
|
435
438
|
`repeat(${this.tabs.length}, var(${TABLIST_COLUMN}))`
|
|
@@ -449,7 +452,7 @@ class Tabs extends vividElement.VividElement {
|
|
|
449
452
|
tab.setAttribute("aria-selected", isActiveTab ? "true" : "false");
|
|
450
453
|
tab.setAttribute("aria-controls", tabpanelId);
|
|
451
454
|
tab.addEventListener("click", this.handleTabClick);
|
|
452
|
-
tab.addEventListener("keydown", this
|
|
455
|
+
tab.addEventListener("keydown", this.#handleTabKeyDown);
|
|
453
456
|
tab.setAttribute("tabindex", isActiveTab ? "0" : "-1");
|
|
454
457
|
if (isActiveTab) {
|
|
455
458
|
this.activetab = tab;
|
|
@@ -459,7 +462,7 @@ class Tabs extends vividElement.VividElement {
|
|
|
459
462
|
tab.style[gridHorizontalProperty] = "";
|
|
460
463
|
tab.style[gridVerticalProperty] = "";
|
|
461
464
|
tab.style[gridProperty] = `${index + 1}`;
|
|
462
|
-
!this
|
|
465
|
+
!this.#isHorizontal() ? tab.classList.add("vertical") : tab.classList.remove("vertical");
|
|
463
466
|
});
|
|
464
467
|
};
|
|
465
468
|
this.setTabPanels = () => {
|
|
@@ -479,8 +482,11 @@ class Tabs extends vividElement.VividElement {
|
|
|
479
482
|
this.setComponent();
|
|
480
483
|
}
|
|
481
484
|
};
|
|
482
|
-
this
|
|
483
|
-
|
|
485
|
+
this.#isHorizontal = () => {
|
|
486
|
+
return this.orientation === TabsOrientation.horizontal;
|
|
487
|
+
};
|
|
488
|
+
this.#handleTabKeyDown = (event) => {
|
|
489
|
+
if (this.#isHorizontal()) {
|
|
484
490
|
switch (event.key) {
|
|
485
491
|
case keyCodes$1.keyArrowLeft:
|
|
486
492
|
event.preventDefault();
|
|
@@ -520,7 +526,7 @@ class Tabs extends vividElement.VividElement {
|
|
|
520
526
|
this.adjustBackward = (_) => {
|
|
521
527
|
this.#moveToNextTab(-1);
|
|
522
528
|
};
|
|
523
|
-
this
|
|
529
|
+
this.#moveToTabByIndex = (group, index) => {
|
|
524
530
|
const tab = group[index];
|
|
525
531
|
this.activetab = tab;
|
|
526
532
|
this.prevActiveTabIndex = this.activeTabIndex;
|
|
@@ -538,9 +544,9 @@ class Tabs extends vividElement.VividElement {
|
|
|
538
544
|
if (this.$fastController.isConnected) {
|
|
539
545
|
this.setTabs();
|
|
540
546
|
this.setTabPanels();
|
|
541
|
-
this
|
|
547
|
+
this.#handleActiveIndicatorPosition();
|
|
542
548
|
}
|
|
543
|
-
this
|
|
549
|
+
this.#patchIndicatorStyleTransition();
|
|
544
550
|
if (!this.activeIndicatorRef) return;
|
|
545
551
|
if (this.orientation === TabsOrientation.vertical) {
|
|
546
552
|
this.activeIndicatorRef.style.removeProperty(ACTIVE_TAB_WIDTH);
|
|
@@ -556,38 +562,43 @@ class Tabs extends vividElement.VividElement {
|
|
|
556
562
|
);
|
|
557
563
|
this.setTabs();
|
|
558
564
|
this.setTabPanels();
|
|
559
|
-
this
|
|
565
|
+
this.#handleActiveIndicatorPosition();
|
|
560
566
|
}
|
|
561
|
-
this
|
|
567
|
+
this.#patchIndicatorStyleTransition();
|
|
562
568
|
this.#updateTabsConnotation();
|
|
563
569
|
this.#scrollToIndex(this.activeTabIndex);
|
|
564
570
|
}
|
|
571
|
+
#isLastTabSelectedAfterRemove;
|
|
565
572
|
/**
|
|
566
573
|
* @internal
|
|
567
574
|
*/
|
|
568
|
-
tabsChanged() {
|
|
575
|
+
tabsChanged(oldValue, newValue) {
|
|
569
576
|
if (this.$fastController.isConnected && this.tabs.length <= this.tabpanels.length) {
|
|
570
577
|
this.tabIds = this.getTabIds();
|
|
571
578
|
this.tabpanelIds = this.getTabPanelIds();
|
|
572
579
|
this.setTabs();
|
|
573
580
|
this.setTabPanels();
|
|
574
|
-
this
|
|
581
|
+
this.#handleActiveIndicatorPosition(
|
|
582
|
+
!this.#isLastTabSelectedAfterRemove(oldValue, newValue)
|
|
583
|
+
);
|
|
575
584
|
}
|
|
576
|
-
this
|
|
585
|
+
this.#patchIndicatorStyleTransition();
|
|
577
586
|
this.#updateScrollStatus();
|
|
578
587
|
}
|
|
579
588
|
/**
|
|
580
589
|
* @internal
|
|
581
590
|
*/
|
|
582
|
-
tabpanelsChanged() {
|
|
591
|
+
tabpanelsChanged(oldValue, newValue) {
|
|
583
592
|
if (this.$fastController.isConnected && this.tabpanels.length <= this.tabs.length) {
|
|
584
593
|
this.tabIds = this.getTabIds();
|
|
585
594
|
this.tabpanelIds = this.getTabPanelIds();
|
|
586
595
|
this.setTabs();
|
|
587
596
|
this.setTabPanels();
|
|
588
|
-
this
|
|
597
|
+
this.#handleActiveIndicatorPosition(
|
|
598
|
+
!this.#isLastTabSelectedAfterRemove(oldValue, newValue, false)
|
|
599
|
+
);
|
|
589
600
|
}
|
|
590
|
-
this
|
|
601
|
+
this.#patchIndicatorStyleTransition();
|
|
591
602
|
}
|
|
592
603
|
getActiveIndex() {
|
|
593
604
|
const id = this.activeid;
|
|
@@ -614,9 +625,8 @@ class Tabs extends vividElement.VividElement {
|
|
|
614
625
|
this.change();
|
|
615
626
|
}
|
|
616
627
|
}
|
|
617
|
-
isHorizontal
|
|
618
|
-
|
|
619
|
-
}
|
|
628
|
+
#isHorizontal;
|
|
629
|
+
#handleTabKeyDown;
|
|
620
630
|
/**
|
|
621
631
|
* The adjust method for FASTTabs
|
|
622
632
|
* @public
|
|
@@ -633,7 +643,7 @@ class Tabs extends vividElement.VividElement {
|
|
|
633
643
|
);
|
|
634
644
|
const nextIndex = this.tabs.indexOf(focusableTabs[nextTabIndex]);
|
|
635
645
|
if (nextIndex > -1) {
|
|
636
|
-
this
|
|
646
|
+
this.#moveToTabByIndex(this.tabs, nextIndex);
|
|
637
647
|
}
|
|
638
648
|
}
|
|
639
649
|
#moveToNextTab(direction) {
|
|
@@ -641,11 +651,12 @@ class Tabs extends vividElement.VividElement {
|
|
|
641
651
|
for (let offset = 1; offset < this.tabs.length; offset++) {
|
|
642
652
|
const index = (activeIndex + direction * offset + this.tabs.length) % this.tabs.length;
|
|
643
653
|
if (this.isFocusableElement(this.tabs[index])) {
|
|
644
|
-
this
|
|
654
|
+
this.#moveToTabByIndex(this.tabs, index);
|
|
645
655
|
break;
|
|
646
656
|
}
|
|
647
657
|
}
|
|
648
658
|
}
|
|
659
|
+
#moveToTabByIndex;
|
|
649
660
|
focusTab() {
|
|
650
661
|
this.tabs[this.activeTabIndex].focus();
|
|
651
662
|
}
|
|
@@ -658,13 +669,13 @@ class Tabs extends vividElement.VividElement {
|
|
|
658
669
|
#updateScrollStatus() {
|
|
659
670
|
this.tablist.parentElement.dispatchEvent(new Event("scroll"));
|
|
660
671
|
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
patchIndicatorStyleTransition() {
|
|
665
|
-
if (!this
|
|
666
|
-
if (this.orientation === TabsOrientation.vertical || !this.showActiveIndicator)
|
|
672
|
+
get #shouldMoveIndicator() {
|
|
673
|
+
return !(!this.activetab || !this.activeIndicatorRef || this.orientation === TabsOrientation.vertical || !this.showActiveIndicator);
|
|
674
|
+
}
|
|
675
|
+
#patchIndicatorStyleTransition() {
|
|
676
|
+
if (!this.#shouldMoveIndicator) {
|
|
667
677
|
return;
|
|
678
|
+
}
|
|
668
679
|
const width = this.activetab.getBoundingClientRect().width;
|
|
669
680
|
this.activeIndicatorRef.style.setProperty(ACTIVE_TAB_WIDTH, `${width}px`);
|
|
670
681
|
}
|
|
@@ -677,7 +688,7 @@ class Tabs extends vividElement.VividElement {
|
|
|
677
688
|
const scrollWrapper = this.tablist.parentElement;
|
|
678
689
|
this.#resizeObserver = new ResizeObserver(() => {
|
|
679
690
|
this.#updateScrollStatus();
|
|
680
|
-
this
|
|
691
|
+
this.#patchIndicatorStyleTransition();
|
|
681
692
|
});
|
|
682
693
|
this.#resizeObserver.observe(scrollWrapper);
|
|
683
694
|
}
|
|
@@ -723,18 +734,18 @@ class Tabs extends vividElement.VividElement {
|
|
|
723
734
|
this.#tabListWrapper.scrollTo({ top, left, behavior: "smooth" });
|
|
724
735
|
}
|
|
725
736
|
#getGridProperty() {
|
|
726
|
-
return this
|
|
737
|
+
return this.#isHorizontal() ? "gridColumn" : "gridRow";
|
|
727
738
|
}
|
|
728
739
|
#getTranslateProperty() {
|
|
729
|
-
return this
|
|
740
|
+
return this.#isHorizontal() ? "translateX" : "translateY";
|
|
730
741
|
}
|
|
731
|
-
handleActiveIndicatorPosition() {
|
|
742
|
+
#handleActiveIndicatorPosition(animate = true) {
|
|
732
743
|
if (this.showActiveIndicator && this.activeindicator) {
|
|
733
|
-
this
|
|
744
|
+
this.#animateActiveIndicator(animate);
|
|
734
745
|
}
|
|
735
746
|
}
|
|
736
|
-
animateActiveIndicator() {
|
|
737
|
-
const offsetProperty = this
|
|
747
|
+
#animateActiveIndicator(animate) {
|
|
748
|
+
const offsetProperty = this.#isHorizontal() ? "offsetLeft" : "offsetTop";
|
|
738
749
|
const currentOffset = this.activeIndicatorRef[offsetProperty];
|
|
739
750
|
const currentGridValue = this.activeIndicatorRef.style[this.#getGridProperty()];
|
|
740
751
|
this.activeIndicatorRef.style[this.#getGridProperty()] = `${this.activeTabIndex + 1}`;
|
|
@@ -742,7 +753,11 @@ class Tabs extends vividElement.VividElement {
|
|
|
742
753
|
this.activeIndicatorRef.style[this.#getGridProperty()] = currentGridValue;
|
|
743
754
|
const relativeOffset = targetOffset - currentOffset;
|
|
744
755
|
this.activeIndicatorRef.style.transform = `${this.#getTranslateProperty()}(${relativeOffset}px)`;
|
|
745
|
-
|
|
756
|
+
if (animate) {
|
|
757
|
+
this.activeIndicatorRef.classList.add("activeIndicatorTransition");
|
|
758
|
+
} else {
|
|
759
|
+
this.activeIndicatorRef.classList.remove("activeIndicatorTransition");
|
|
760
|
+
}
|
|
746
761
|
}
|
|
747
762
|
/**
|
|
748
763
|
* @internal
|
|
@@ -756,43 +771,43 @@ class Tabs extends vividElement.VividElement {
|
|
|
756
771
|
}
|
|
757
772
|
}
|
|
758
773
|
__decorateClass([
|
|
759
|
-
|
|
774
|
+
vividElement.attr
|
|
760
775
|
], Tabs.prototype, "orientation");
|
|
761
776
|
__decorateClass([
|
|
762
|
-
|
|
777
|
+
vividElement.attr
|
|
763
778
|
], Tabs.prototype, "activeid");
|
|
764
779
|
__decorateClass([
|
|
765
|
-
|
|
780
|
+
vividElement.observable
|
|
766
781
|
], Tabs.prototype, "tabs");
|
|
767
782
|
__decorateClass([
|
|
768
|
-
|
|
783
|
+
vividElement.observable
|
|
769
784
|
], Tabs.prototype, "tabpanels");
|
|
770
785
|
__decorateClass([
|
|
771
|
-
|
|
786
|
+
vividElement.attr({ mode: "boolean" })
|
|
772
787
|
], Tabs.prototype, "activeindicator");
|
|
773
788
|
__decorateClass([
|
|
774
|
-
|
|
789
|
+
vividElement.observable
|
|
775
790
|
], Tabs.prototype, "activeIndicatorRef");
|
|
776
791
|
__decorateClass([
|
|
777
|
-
|
|
792
|
+
vividElement.observable
|
|
778
793
|
], Tabs.prototype, "showActiveIndicator");
|
|
779
794
|
__decorateClass([
|
|
780
|
-
|
|
795
|
+
vividElement.observable
|
|
781
796
|
], Tabs.prototype, "tablist");
|
|
782
797
|
__decorateClass([
|
|
783
|
-
|
|
798
|
+
vividElement.attr
|
|
784
799
|
], Tabs.prototype, "connotation");
|
|
785
800
|
__decorateClass([
|
|
786
|
-
|
|
801
|
+
vividElement.attr
|
|
787
802
|
], Tabs.prototype, "gutters");
|
|
788
803
|
__decorateClass([
|
|
789
|
-
|
|
804
|
+
vividElement.attr({ mode: "boolean", attribute: "scrollable-panel" })
|
|
790
805
|
], Tabs.prototype, "scrollablePanel");
|
|
791
806
|
__decorateClass([
|
|
792
|
-
|
|
807
|
+
vividElement.attr({ attribute: "tabs-layout" })
|
|
793
808
|
], Tabs.prototype, "tabsLayout");
|
|
794
809
|
__decorateClass([
|
|
795
|
-
|
|
810
|
+
vividElement.observable
|
|
796
811
|
], Tabs.prototype, "_actionItemsSlottedContent");
|
|
797
812
|
|
|
798
813
|
const getClasses = ({
|
|
@@ -829,7 +844,7 @@ function addEndShadow(scrollShadow, scrollWrapper) {
|
|
|
829
844
|
);
|
|
830
845
|
}
|
|
831
846
|
function setShadowWhenScrollTabs(_, { event }) {
|
|
832
|
-
const scrollWrapper = event.
|
|
847
|
+
const scrollWrapper = event.currentTarget;
|
|
833
848
|
const scrollShadow = scrollWrapper.parentElement;
|
|
834
849
|
if (setNoScrollState(scrollShadow, scrollWrapper)) {
|
|
835
850
|
return;
|
|
@@ -837,7 +852,7 @@ function setShadowWhenScrollTabs(_, { event }) {
|
|
|
837
852
|
addStartShadow(scrollShadow, scrollWrapper);
|
|
838
853
|
addEndShadow(scrollShadow, scrollWrapper);
|
|
839
854
|
}
|
|
840
|
-
const TabsTemplate =
|
|
855
|
+
const TabsTemplate = vividElement.html`
|
|
841
856
|
<template>
|
|
842
857
|
<div class="${getClasses}">
|
|
843
858
|
<div class="tabs">
|
|
@@ -847,7 +862,7 @@ const TabsTemplate = defineVividComponent.html`
|
|
|
847
862
|
<slot name="tab" ${slotted.slotted("tabs")}></slot>
|
|
848
863
|
${when.when(
|
|
849
864
|
(x) => x.showActiveIndicator,
|
|
850
|
-
|
|
865
|
+
vividElement.html`
|
|
851
866
|
<div
|
|
852
867
|
${ref.ref("activeIndicatorRef")}
|
|
853
868
|
class="active-indicator"
|
|
@@ -869,7 +884,7 @@ const TabsTemplate = defineVividComponent.html`
|
|
|
869
884
|
</template>
|
|
870
885
|
`;
|
|
871
886
|
|
|
872
|
-
const tabsDefinition =
|
|
887
|
+
const tabsDefinition = vividElement.defineVividComponent(
|
|
873
888
|
"tabs",
|
|
874
889
|
Tabs,
|
|
875
890
|
TabsTemplate,
|
|
@@ -878,7 +893,7 @@ const tabsDefinition = defineVividComponent.defineVividComponent(
|
|
|
878
893
|
styles
|
|
879
894
|
}
|
|
880
895
|
);
|
|
881
|
-
const registerTabs =
|
|
896
|
+
const registerTabs = vividElement.createRegisterFunction(tabsDefinition);
|
|
882
897
|
|
|
883
898
|
exports.registerTabs = registerTabs;
|
|
884
899
|
exports.tabsDefinition = tabsDefinition;
|