@vonage/vivid 4.12.0 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +851 -60
- package/lib/accordion/accordion.d.ts +21 -2
- package/lib/accordion-item/accordion-item.d.ts +6 -2
- package/lib/calendar/calendar.d.ts +1 -1
- package/lib/date-picker/date-picker.d.ts +1 -0
- package/lib/radio/radio.d.ts +12 -2
- package/lib/radio/radio.form-associated.d.ts +10 -0
- package/lib/radio-group/radio-group.d.ts +20 -2
- package/lib/tab/tab.d.ts +3 -2
- package/lib/tab-panel/tab-panel.d.ts +2 -2
- package/lib/tabs/tabs.d.ts +30 -9
- package/package.json +1 -1
- package/shared/date-picker/date-picker-base.d.ts +1 -0
- package/shared/definition.cjs +29 -72
- package/shared/definition.js +30 -73
- package/shared/definition16.cjs +1 -2
- package/shared/definition16.js +1 -2
- package/shared/definition17.cjs +2 -2
- package/shared/definition17.js +2 -2
- package/shared/definition18.cjs +6 -1
- package/shared/definition18.js +6 -1
- package/shared/definition19.cjs +17 -8
- package/shared/definition19.js +17 -8
- package/shared/definition2.cjs +154 -187
- package/shared/definition2.js +157 -190
- package/shared/definition20.cjs +1 -1
- package/shared/definition20.js +1 -1
- package/shared/definition29.cjs +2 -2
- package/shared/definition29.js +2 -2
- package/shared/definition35.cjs +1 -1
- package/shared/definition35.js +1 -1
- package/shared/definition40.cjs +226 -399
- package/shared/definition40.js +229 -402
- package/shared/definition42.cjs +3 -2
- package/shared/definition42.js +3 -2
- package/shared/definition43.cjs +1 -0
- package/shared/definition43.js +1 -0
- package/shared/definition44.cjs +1 -1
- package/shared/definition44.js +1 -1
- package/shared/definition47.cjs +3 -2
- package/shared/definition47.js +3 -2
- package/shared/definition49.cjs +1 -1
- package/shared/definition49.js +1 -1
- package/shared/definition5.cjs +1 -1
- package/shared/definition5.js +1 -1
- package/shared/definition50.cjs +1 -11
- package/shared/definition50.js +1 -11
- package/shared/definition51.cjs +4 -14
- package/shared/definition51.js +5 -15
- package/shared/definition52.cjs +269 -19
- package/shared/definition52.js +273 -23
- package/shared/definition57.cjs +26 -4
- package/shared/definition57.js +27 -5
- package/shared/definition61.cjs +1 -1
- package/shared/definition61.js +1 -1
- package/shared/definition62.cjs +17 -8
- package/shared/definition62.js +17 -8
- package/shared/form-associated.cjs +1 -1
- package/shared/form-associated.js +1 -1
- package/shared/icon.cjs +1 -1
- package/shared/icon.js +1 -1
- package/shared/index.cjs +1 -0
- package/shared/index.js +1 -1
- package/shared/key-codes.cjs +1 -94
- package/shared/key-codes.js +2 -89
- package/shared/key-codes2.cjs +87 -1
- package/shared/key-codes2.js +83 -2
- package/shared/listbox.cjs +6 -7
- package/shared/listbox.js +3 -4
- package/shared/numbers.cjs +0 -12
- package/shared/numbers.js +1 -12
- package/shared/presentationDate.cjs +14 -0
- package/shared/presentationDate.js +15 -1
- package/shared/radio.cjs +92 -117
- package/shared/radio.js +93 -118
- package/shared/slider.template.cjs +2 -15
- package/shared/slider.template.js +2 -14
- package/shared/strings.cjs +26 -0
- package/shared/strings.js +25 -1
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
package/shared/definition43.cjs
CHANGED
package/shared/definition43.js
CHANGED
package/shared/definition44.cjs
CHANGED
|
@@ -11,7 +11,7 @@ const applyMixins = require('./apply-mixins.cjs');
|
|
|
11
11
|
const formAssociated = require('./form-associated.cjs');
|
|
12
12
|
const select_options = require('./select.options.cjs');
|
|
13
13
|
const strings = require('./strings.cjs');
|
|
14
|
-
const keyCodes = require('./key-
|
|
14
|
+
const keyCodes = require('./key-codes2.cjs');
|
|
15
15
|
const formElements = require('./form-elements.cjs');
|
|
16
16
|
const affix = require('./affix.cjs');
|
|
17
17
|
const definition$2 = require('./definition11.cjs');
|
package/shared/definition44.js
CHANGED
|
@@ -9,7 +9,7 @@ import { a as applyMixins } from './apply-mixins.js';
|
|
|
9
9
|
import { F as FormAssociated } from './form-associated.js';
|
|
10
10
|
import { S as SelectPosition } from './select.options.js';
|
|
11
11
|
import { u as uniqueId } from './strings.js';
|
|
12
|
-
import { c as keyTab, b as keyEscape, k as keyEnter, d as keyEnd, g as keyHome, a as keySpace, f as keyArrowDown, e as keyArrowUp } from './key-
|
|
12
|
+
import { c as keyTab, b as keyEscape, k as keyEnter, d as keyEnd, g as keyHome, a as keySpace, f as keyArrowDown, e as keyArrowUp } from './key-codes2.js';
|
|
13
13
|
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, g as getFeedbackTemplate } from './form-elements.js';
|
|
14
14
|
import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
15
15
|
import { d as chevronTemplateFactory } from './definition11.js';
|
package/shared/definition47.cjs
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
4
|
const definition = require('./definition64.cjs');
|
|
5
|
-
const keyCodes = require('./key-
|
|
5
|
+
const keyCodes = require('./key-codes.cjs');
|
|
6
6
|
const slider_template = require('./slider.template.cjs');
|
|
7
7
|
const formAssociated = require('./form-associated.cjs');
|
|
8
8
|
const aria = require('./aria.cjs');
|
|
9
9
|
const direction = require('./direction.cjs');
|
|
10
|
+
const numbers = require('./numbers.cjs');
|
|
10
11
|
const applyMixins = require('./apply-mixins.cjs');
|
|
11
12
|
const localized = require('./localized.cjs');
|
|
12
13
|
|
|
@@ -395,7 +396,7 @@ class Slider extends FormAssociatedSlider {
|
|
|
395
396
|
return slider_template.lerp(this.min, this.max, slider_template.inverseLerp(minPos, maxPos, valuePos));
|
|
396
397
|
}
|
|
397
398
|
#roundToNearestStep(value) {
|
|
398
|
-
return
|
|
399
|
+
return numbers.limit(
|
|
399
400
|
this.min,
|
|
400
401
|
this.max,
|
|
401
402
|
slider_template.roundToStepValue(value - this.min, this.step) + this.min
|
package/shared/definition47.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { F as FoundationElement, a as attr, o as observable, n as nullableNumberConverter, v as volatile, r as registerFactory } from './index.js';
|
|
2
2
|
import { p as popupRegistries } from './definition64.js';
|
|
3
|
-
import {
|
|
4
|
-
import { i as inverseLerp, l as lerp,
|
|
3
|
+
import { b as keyHome, a as keyEnd, c as keyArrowDown, e as keyArrowLeft, d as keyArrowUp, f as keyArrowRight } from './key-codes.js';
|
|
4
|
+
import { i as inverseLerp, l as lerp, r as roundToStepValue, S as SliderTemplate } from './slider.template.js';
|
|
5
5
|
import { F as FormAssociated } from './form-associated.js';
|
|
6
6
|
import { O as Orientation } from './aria.js';
|
|
7
7
|
import { g as getDirection } from './direction.js';
|
|
8
|
+
import { l as limit } from './numbers.js';
|
|
8
9
|
import { a as applyMixins } from './apply-mixins.js';
|
|
9
10
|
import { L as Localized } from './localized.js';
|
|
10
11
|
|
package/shared/definition49.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
4
|
const definition = require('./definition27.cjs');
|
|
5
5
|
const formAssociated = require('./form-associated.cjs');
|
|
6
|
-
const keyCodes = require('./key-
|
|
6
|
+
const keyCodes = require('./key-codes2.cjs');
|
|
7
7
|
const when = require('./when.cjs');
|
|
8
8
|
const classNames = require('./class-names.cjs');
|
|
9
9
|
|
package/shared/definition49.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { F as FoundationElement, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { a as iconRegistries } from './definition27.js';
|
|
3
3
|
import { C as CheckableFormAssociated } from './form-associated.js';
|
|
4
|
-
import { a as keySpace, k as keyEnter } from './key-
|
|
4
|
+
import { a as keySpace, k as keyEnter } from './key-codes2.js';
|
|
5
5
|
import { w as when } from './when.js';
|
|
6
6
|
import { c as classNames } from './class-names.js';
|
|
7
7
|
|
package/shared/definition5.cjs
CHANGED
|
@@ -13,7 +13,7 @@ const when = require('./when.cjs');
|
|
|
13
13
|
const repeat = require('./repeat.cjs');
|
|
14
14
|
const classNames = require('./class-names.cjs');
|
|
15
15
|
|
|
16
|
-
const styles = ":host{display:block}.wrapper{container-type:inline-size}.base{display:inline-flex;box-sizing:border-box;align-items:center;padding:8px;color:var(--vvd-color-canvas-text);gap:16px;inline-size:100%;user-select:none}.base .slider{flex:1;grid-area:slider}.base .controls{display:flex;align-items:center;justify-content:center;gap:8px;grid-area:controls}.base .time-stamp{display:inline-flex}.base .time-stamp .current-time,.base .time-stamp .total-time{margin-inline:6px;min-inline-size:32px}.base .playback-button{grid-area:playback}@container (max-width: 500px){.base.two-lines{display:inline-grid;grid-template:auto auto/1fr;grid-template-areas:\"slider\" \"controls\";inline-size:100%;row-gap:4px}.base.two-lines .time-stamp{margin-inline:auto 2px}.base.two-lines.playback{grid-template-areas:\"slider slider\" \"controls playback\";grid-template-columns:1fr auto}.base.two-lines.playback .time-stamp{margin-inline:auto}.base .slider{box-sizing:border-box;min-inline-size:auto;padding-inline:2px}}";
|
|
16
|
+
const styles = ":host{display:block}.wrapper{container-type:inline-size}.base{display:inline-flex;box-sizing:border-box;align-items:center;padding:8px;color:var(--vvd-color-canvas-text);gap:16px;inline-size:100%;user-select:none}.base.disabled{color:var(--vvd-color-neutral-300)}.base .slider{flex:1;grid-area:slider}.base .controls{display:flex;align-items:center;justify-content:center;gap:8px;grid-area:controls}.base .time-stamp{display:inline-flex}.base .time-stamp .current-time,.base .time-stamp .total-time{margin-inline:6px;min-inline-size:32px}.base .playback-button{grid-area:playback}@container (max-width: 500px){.base.two-lines{display:inline-grid;grid-template:auto auto/1fr;grid-template-areas:\"slider\" \"controls\";inline-size:100%;row-gap:4px}.base.two-lines .time-stamp{margin-inline:auto 2px}.base.two-lines.playback{grid-template-areas:\"slider slider\" \"controls playback\";grid-template-columns:1fr auto}.base.two-lines.playback .time-stamp{margin-inline:auto}.base .slider{box-sizing:border-box;min-inline-size:auto;padding-inline:2px}}";
|
|
17
17
|
|
|
18
18
|
var __defProp = Object.defineProperty;
|
|
19
19
|
var __decorateClass = (decorators, target, key, kind) => {
|
package/shared/definition5.js
CHANGED
|
@@ -11,7 +11,7 @@ import { w as when } from './when.js';
|
|
|
11
11
|
import { r as repeat } from './repeat.js';
|
|
12
12
|
import { c as classNames } from './class-names.js';
|
|
13
13
|
|
|
14
|
-
const styles = ":host{display:block}.wrapper{container-type:inline-size}.base{display:inline-flex;box-sizing:border-box;align-items:center;padding:8px;color:var(--vvd-color-canvas-text);gap:16px;inline-size:100%;user-select:none}.base .slider{flex:1;grid-area:slider}.base .controls{display:flex;align-items:center;justify-content:center;gap:8px;grid-area:controls}.base .time-stamp{display:inline-flex}.base .time-stamp .current-time,.base .time-stamp .total-time{margin-inline:6px;min-inline-size:32px}.base .playback-button{grid-area:playback}@container (max-width: 500px){.base.two-lines{display:inline-grid;grid-template:auto auto/1fr;grid-template-areas:\"slider\" \"controls\";inline-size:100%;row-gap:4px}.base.two-lines .time-stamp{margin-inline:auto 2px}.base.two-lines.playback{grid-template-areas:\"slider slider\" \"controls playback\";grid-template-columns:1fr auto}.base.two-lines.playback .time-stamp{margin-inline:auto}.base .slider{box-sizing:border-box;min-inline-size:auto;padding-inline:2px}}";
|
|
14
|
+
const styles = ":host{display:block}.wrapper{container-type:inline-size}.base{display:inline-flex;box-sizing:border-box;align-items:center;padding:8px;color:var(--vvd-color-canvas-text);gap:16px;inline-size:100%;user-select:none}.base.disabled{color:var(--vvd-color-neutral-300)}.base .slider{flex:1;grid-area:slider}.base .controls{display:flex;align-items:center;justify-content:center;gap:8px;grid-area:controls}.base .time-stamp{display:inline-flex}.base .time-stamp .current-time,.base .time-stamp .total-time{margin-inline:6px;min-inline-size:32px}.base .playback-button{grid-area:playback}@container (max-width: 500px){.base.two-lines{display:inline-grid;grid-template:auto auto/1fr;grid-template-areas:\"slider\" \"controls\";inline-size:100%;row-gap:4px}.base.two-lines .time-stamp{margin-inline:auto 2px}.base.two-lines.playback{grid-template-areas:\"slider slider\" \"controls playback\";grid-template-columns:1fr auto}.base.two-lines.playback .time-stamp{margin-inline:auto}.base .slider{box-sizing:border-box;min-inline-size:auto;padding-inline:2px}}";
|
|
15
15
|
|
|
16
16
|
var __defProp = Object.defineProperty;
|
|
17
17
|
var __decorateClass = (decorators, target, key, kind) => {
|
package/shared/definition50.cjs
CHANGED
|
@@ -2,17 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* A TabPanel Component to be used with {@link @microsoft/fast-foundation#(Tabs:class)}
|
|
7
|
-
*
|
|
8
|
-
* @slot - The default slot for the tabpanel content
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
let TabPanel$1 = class TabPanel extends index.FoundationElement {
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
class TabPanel extends TabPanel$1 {
|
|
5
|
+
class TabPanel extends index.FoundationElement {
|
|
16
6
|
}
|
|
17
7
|
|
|
18
8
|
function TabPanelTemplate() {
|
package/shared/definition50.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { F as FoundationElement, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* A TabPanel Component to be used with {@link @microsoft/fast-foundation#(Tabs:class)}
|
|
5
|
-
*
|
|
6
|
-
* @slot - The default slot for the tabpanel content
|
|
7
|
-
*
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
let TabPanel$1 = class TabPanel extends FoundationElement {
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
class TabPanel extends TabPanel$1 {
|
|
3
|
+
class TabPanel extends FoundationElement {
|
|
14
4
|
}
|
|
15
5
|
|
|
16
6
|
function TabPanelTemplate() {
|
package/shared/definition51.cjs
CHANGED
|
@@ -7,19 +7,6 @@ const applyMixins = require('./apply-mixins.cjs');
|
|
|
7
7
|
const localized = require('./localized.cjs');
|
|
8
8
|
const classNames = require('./class-names.cjs');
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* A Tab Component to be used with {@link @microsoft/fast-foundation#(Tabs:class)}
|
|
12
|
-
*
|
|
13
|
-
* @slot - The default slot for the tab content
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
let Tab$1 = class Tab extends index.FoundationElement {
|
|
18
|
-
};
|
|
19
|
-
index.__decorate([
|
|
20
|
-
index.attr({ mode: "boolean" })
|
|
21
|
-
], Tab$1.prototype, "disabled", void 0);
|
|
22
|
-
|
|
23
10
|
const styles = ":host{--_vvd-tab-accent-firm-wrapper: var( --vvd-tab-accent-firm );--_vvd-tab-cta-firm-wrapper: var( --vvd-tab-cta-firm )}.base{--vvd-tab-accent-firm: var( --_vvd-tab-accent-firm-wrapper, var(--vvd-tab-accent-primary) );--vvd-tab-cta-firm: var( --_vvd-tab-cta-firm-wrapper, var(--vvd-tab-cta-primary) )}:host(.vertical){justify-content:end;grid-column:1/auto}:host([disabled]){cursor:not-allowed}:host([removable]){position:relative}:host(:focus-visible){outline:none}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base.connotation-cta{--_connotation-color-primary-text: var(--vvd-tab-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-firm: var(--vvd-tab-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-tab-cta-faint, var(--vvd-color-cta-50));--_connotation-color-fierce: var(--vvd-tab-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-pale: var(--vvd-tab-cta-pale, var(--vvd-color-cta-300));--_connotation-color-soft: var(--vvd-tab-cta-soft, var(--vvd-color-cta-100))}.base:not(.connotation-cta){--_connotation-color-primary-text: var(--vvd-tab-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-firm: var(--vvd-tab-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-tab-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-fierce: var(--vvd-tab-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-pale: var(--vvd-tab-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-soft: var(--vvd-tab-accent-soft, var(--vvd-color-neutral-100))}.base{position:relative;display:flex;box-sizing:border-box;align-items:center;padding:var(--_tabs-tablist-gutter);background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base-bold);gap:var(--_tabs-tablist-gutter);min-block-size:40px;vertical-align:middle;white-space:nowrap}@supports (user-select: none){.base{user-select:none}}.base:not(.shape-sharp){border-radius:8px}.base:not(.disabled){cursor:pointer}.base.disabled{pointer-events:none}.base.removable{padding-inline-end:40px}:host(:focus-visible) .base{--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}:host(.vertical) .base{margin-inline-start:var(--_tabs-active-indicator-stroke-width)}slot[name=icon]{font-size:20px;line-height:1}.icon-trailing slot[name=icon]{display:inline-block;order:1;margin-inline-start:auto}.close{position:absolute;display:flex;align-items:center;justify-content:center;block-size:24px;inline-size:24px;inset-block-start:50%;inset-inline-end:4px;transform:translateY(-50%)}.close vwc-icon{font-size:12px}.close .icon{display:flex;align-items:center;justify-content:center}";
|
|
24
11
|
|
|
25
12
|
var __defProp = Object.defineProperty;
|
|
@@ -31,7 +18,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
31
18
|
if (result) __defProp(target, key, result);
|
|
32
19
|
return result;
|
|
33
20
|
};
|
|
34
|
-
class Tab extends
|
|
21
|
+
class Tab extends index.FoundationElement {
|
|
35
22
|
constructor() {
|
|
36
23
|
super(...arguments);
|
|
37
24
|
this.removable = false;
|
|
@@ -49,6 +36,9 @@ class Tab extends Tab$1 {
|
|
|
49
36
|
return false;
|
|
50
37
|
}
|
|
51
38
|
}
|
|
39
|
+
__decorateClass([
|
|
40
|
+
index.attr({ mode: "boolean" })
|
|
41
|
+
], Tab.prototype, "disabled");
|
|
52
42
|
__decorateClass([
|
|
53
43
|
index.attr
|
|
54
44
|
], Tab.prototype, "connotation");
|
package/shared/definition51.js
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import { F as FoundationElement,
|
|
1
|
+
import { F as FoundationElement, a as attr, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { a as iconRegistries } from './definition27.js';
|
|
3
3
|
import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
4
4
|
import { a as applyMixins } from './apply-mixins.js';
|
|
5
5
|
import { L as Localized } from './localized.js';
|
|
6
6
|
import { c as classNames } from './class-names.js';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* A Tab Component to be used with {@link @microsoft/fast-foundation#(Tabs:class)}
|
|
10
|
-
*
|
|
11
|
-
* @slot - The default slot for the tab content
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
let Tab$1 = class Tab extends FoundationElement {
|
|
16
|
-
};
|
|
17
|
-
__decorate([
|
|
18
|
-
attr({ mode: "boolean" })
|
|
19
|
-
], Tab$1.prototype, "disabled", void 0);
|
|
20
|
-
|
|
21
8
|
const styles = ":host{--_vvd-tab-accent-firm-wrapper: var( --vvd-tab-accent-firm );--_vvd-tab-cta-firm-wrapper: var( --vvd-tab-cta-firm )}.base{--vvd-tab-accent-firm: var( --_vvd-tab-accent-firm-wrapper, var(--vvd-tab-accent-primary) );--vvd-tab-cta-firm: var( --_vvd-tab-cta-firm-wrapper, var(--vvd-tab-cta-primary) )}:host(.vertical){justify-content:end;grid-column:1/auto}:host([disabled]){cursor:not-allowed}:host([removable]){position:relative}:host(:focus-visible){outline:none}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base.connotation-cta{--_connotation-color-primary-text: var(--vvd-tab-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-firm: var(--vvd-tab-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-tab-cta-faint, var(--vvd-color-cta-50));--_connotation-color-fierce: var(--vvd-tab-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-pale: var(--vvd-tab-cta-pale, var(--vvd-color-cta-300));--_connotation-color-soft: var(--vvd-tab-cta-soft, var(--vvd-color-cta-100))}.base:not(.connotation-cta){--_connotation-color-primary-text: var(--vvd-tab-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-firm: var(--vvd-tab-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-tab-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-fierce: var(--vvd-tab-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-pale: var(--vvd-tab-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-soft: var(--vvd-tab-accent-soft, var(--vvd-color-neutral-100))}.base{position:relative;display:flex;box-sizing:border-box;align-items:center;padding:var(--_tabs-tablist-gutter);background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base-bold);gap:var(--_tabs-tablist-gutter);min-block-size:40px;vertical-align:middle;white-space:nowrap}@supports (user-select: none){.base{user-select:none}}.base:not(.shape-sharp){border-radius:8px}.base:not(.disabled){cursor:pointer}.base.disabled{pointer-events:none}.base.removable{padding-inline-end:40px}:host(:focus-visible) .base{--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}:host(.vertical) .base{margin-inline-start:var(--_tabs-active-indicator-stroke-width)}slot[name=icon]{font-size:20px;line-height:1}.icon-trailing slot[name=icon]{display:inline-block;order:1;margin-inline-start:auto}.close{position:absolute;display:flex;align-items:center;justify-content:center;block-size:24px;inline-size:24px;inset-block-start:50%;inset-inline-end:4px;transform:translateY(-50%)}.close vwc-icon{font-size:12px}.close .icon{display:flex;align-items:center;justify-content:center}";
|
|
22
9
|
|
|
23
10
|
var __defProp = Object.defineProperty;
|
|
@@ -29,7 +16,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
29
16
|
if (result) __defProp(target, key, result);
|
|
30
17
|
return result;
|
|
31
18
|
};
|
|
32
|
-
class Tab extends
|
|
19
|
+
class Tab extends FoundationElement {
|
|
33
20
|
constructor() {
|
|
34
21
|
super(...arguments);
|
|
35
22
|
this.removable = false;
|
|
@@ -47,6 +34,9 @@ class Tab extends Tab$1 {
|
|
|
47
34
|
return false;
|
|
48
35
|
}
|
|
49
36
|
}
|
|
37
|
+
__decorateClass([
|
|
38
|
+
attr({ mode: "boolean" })
|
|
39
|
+
], Tab.prototype, "disabled");
|
|
50
40
|
__decorateClass([
|
|
51
41
|
attr
|
|
52
42
|
], Tab.prototype, "connotation");
|
package/shared/definition52.cjs
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
4
|
const definition = require('./definition51.cjs');
|
|
5
5
|
const definition$1 = require('./definition50.cjs');
|
|
6
|
+
const keyCodes$1 = require('./key-codes.cjs');
|
|
6
7
|
const startEnd = require('./start-end.cjs');
|
|
7
8
|
const applyMixins = require('./apply-mixins.cjs');
|
|
8
|
-
const keyCodes = require('./key-
|
|
9
|
+
const keyCodes = require('./key-codes2.cjs');
|
|
9
10
|
const strings = require('./strings.cjs');
|
|
10
11
|
const numbers = require('./numbers.cjs');
|
|
11
12
|
const ref = require('./ref.cjs');
|
|
@@ -340,7 +341,7 @@ let Tabs$1 = class Tabs extends index.FoundationElement {
|
|
|
340
341
|
adjust(adjustment) {
|
|
341
342
|
const focusableTabs = this.tabs.filter(t => this.isFocusableElement(t));
|
|
342
343
|
const currentActiveTabIndex = focusableTabs.indexOf(this.activetab);
|
|
343
|
-
const nextTabIndex =
|
|
344
|
+
const nextTabIndex = strings.limit(0, focusableTabs.length - 1, currentActiveTabIndex + adjustment);
|
|
344
345
|
// the index of the next focusable tab within the context of all available tabs
|
|
345
346
|
const nextIndex = this.tabs.indexOf(focusableTabs[nextTabIndex]);
|
|
346
347
|
if (nextIndex > -1) {
|
|
@@ -383,6 +384,14 @@ index.__decorate([
|
|
|
383
384
|
], Tabs$1.prototype, "showActiveIndicator", void 0);
|
|
384
385
|
applyMixins.applyMixins(Tabs$1, startEnd.StartEnd);
|
|
385
386
|
|
|
387
|
+
let uniqueIdCounter = 0;
|
|
388
|
+
/**
|
|
389
|
+
* Generates a unique ID based on incrementing a counter.
|
|
390
|
+
*/
|
|
391
|
+
function uniqueId(prefix = "") {
|
|
392
|
+
return `${prefix}${uniqueIdCounter++}`;
|
|
393
|
+
}
|
|
394
|
+
|
|
386
395
|
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: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.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-columns:auto;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}.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}.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}";
|
|
387
396
|
|
|
388
397
|
var __defProp = Object.defineProperty;
|
|
@@ -395,43 +404,260 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
395
404
|
return result;
|
|
396
405
|
};
|
|
397
406
|
const ACTIVE_TAB_WIDTH = "--_tabs-active-tab-inline-size";
|
|
398
|
-
class Tabs extends
|
|
407
|
+
class Tabs extends index.FoundationElement {
|
|
399
408
|
constructor() {
|
|
400
|
-
super();
|
|
409
|
+
super(...arguments);
|
|
410
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
411
|
+
this.orientation = TabsOrientation.horizontal;
|
|
412
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
413
|
+
this.activeindicator = true;
|
|
414
|
+
this.showActiveIndicator = true;
|
|
415
|
+
this.prevActiveTabIndex = 0;
|
|
416
|
+
this.activeTabIndex = 0;
|
|
417
|
+
this.tabIds = [];
|
|
418
|
+
this.tabpanelIds = [];
|
|
419
|
+
this.change = () => {
|
|
420
|
+
this.$emit("change", this.activetab);
|
|
421
|
+
};
|
|
422
|
+
this.isDisabledElement = (el) => {
|
|
423
|
+
return el.getAttribute("aria-disabled") === "true";
|
|
424
|
+
};
|
|
425
|
+
this.isHiddenElement = (el) => {
|
|
426
|
+
return el.hasAttribute("hidden");
|
|
427
|
+
};
|
|
428
|
+
this.isFocusableElement = (el) => {
|
|
429
|
+
return !this.isDisabledElement(el) && !this.isHiddenElement(el);
|
|
430
|
+
};
|
|
431
|
+
this.setTabs = () => {
|
|
432
|
+
const gridHorizontalProperty = "gridColumn";
|
|
433
|
+
const gridVerticalProperty = "gridRow";
|
|
434
|
+
const gridProperty = this.isHorizontal() ? gridHorizontalProperty : gridVerticalProperty;
|
|
435
|
+
this.activeTabIndex = this.getActiveIndex();
|
|
436
|
+
this.showActiveIndicator = false;
|
|
437
|
+
this.tabs.forEach((tab, index) => {
|
|
438
|
+
if (tab.slot === "tab") {
|
|
439
|
+
const isActiveTab = this.activeTabIndex === index && this.isFocusableElement(tab);
|
|
440
|
+
if (this.activeindicator && this.isFocusableElement(tab)) {
|
|
441
|
+
this.showActiveIndicator = true;
|
|
442
|
+
}
|
|
443
|
+
const tabId = this.tabIds[index];
|
|
444
|
+
const tabpanelId = this.tabpanelIds[index];
|
|
445
|
+
tab.setAttribute("id", tabId);
|
|
446
|
+
tab.setAttribute("aria-selected", isActiveTab ? "true" : "false");
|
|
447
|
+
tab.setAttribute("aria-controls", tabpanelId);
|
|
448
|
+
tab.addEventListener("click", this.handleTabClick);
|
|
449
|
+
tab.addEventListener("keydown", this.handleTabKeyDown);
|
|
450
|
+
tab.setAttribute("tabindex", isActiveTab ? "0" : "-1");
|
|
451
|
+
if (isActiveTab) {
|
|
452
|
+
this.activetab = tab;
|
|
453
|
+
this.activeid = tabId;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
tab.style[gridHorizontalProperty] = "";
|
|
457
|
+
tab.style[gridVerticalProperty] = "";
|
|
458
|
+
tab.style[gridProperty] = `${index + 1}`;
|
|
459
|
+
!this.isHorizontal() ? tab.classList.add("vertical") : tab.classList.remove("vertical");
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
this.setTabPanels = () => {
|
|
463
|
+
this.tabpanels.forEach((tabpanel, index) => {
|
|
464
|
+
const tabId = this.tabIds[index];
|
|
465
|
+
const tabpanelId = this.tabpanelIds[index];
|
|
466
|
+
tabpanel.setAttribute("id", tabpanelId);
|
|
467
|
+
tabpanel.setAttribute("aria-labelledby", tabId);
|
|
468
|
+
this.activeTabIndex !== index ? tabpanel.setAttribute("hidden", "") : tabpanel.removeAttribute("hidden");
|
|
469
|
+
});
|
|
470
|
+
};
|
|
471
|
+
this.handleTabClick = (event) => {
|
|
472
|
+
const selectedTab = event.currentTarget;
|
|
473
|
+
if (selectedTab.nodeType === 1 && this.isFocusableElement(selectedTab)) {
|
|
474
|
+
this.prevActiveTabIndex = this.activeTabIndex;
|
|
475
|
+
this.activeTabIndex = this.tabs.indexOf(selectedTab);
|
|
476
|
+
this.setComponent();
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
this.handleTabKeyDown = (event) => {
|
|
480
|
+
if (this.isHorizontal()) {
|
|
481
|
+
switch (event.key) {
|
|
482
|
+
case keyCodes$1.keyArrowLeft:
|
|
483
|
+
event.preventDefault();
|
|
484
|
+
this.adjustBackward(event);
|
|
485
|
+
break;
|
|
486
|
+
case keyCodes$1.keyArrowRight:
|
|
487
|
+
event.preventDefault();
|
|
488
|
+
this.adjustForward(event);
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
} else {
|
|
492
|
+
switch (event.key) {
|
|
493
|
+
case keyCodes$1.keyArrowUp:
|
|
494
|
+
event.preventDefault();
|
|
495
|
+
this.adjustBackward(event);
|
|
496
|
+
break;
|
|
497
|
+
case keyCodes$1.keyArrowDown:
|
|
498
|
+
event.preventDefault();
|
|
499
|
+
this.adjustForward(event);
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
switch (event.key) {
|
|
504
|
+
case keyCodes$1.keyHome:
|
|
505
|
+
event.preventDefault();
|
|
506
|
+
this.adjust(-this.activeTabIndex);
|
|
507
|
+
break;
|
|
508
|
+
case keyCodes$1.keyEnd:
|
|
509
|
+
event.preventDefault();
|
|
510
|
+
this.adjust(this.tabs.length - this.activeTabIndex - 1);
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
this.adjustForward = (_) => {
|
|
515
|
+
this.#moveToNextTab(1);
|
|
516
|
+
};
|
|
517
|
+
this.adjustBackward = (_) => {
|
|
518
|
+
this.#moveToNextTab(-1);
|
|
519
|
+
};
|
|
520
|
+
this.moveToTabByIndex = (group, index) => {
|
|
521
|
+
const tab = group[index];
|
|
522
|
+
this.activetab = tab;
|
|
523
|
+
this.prevActiveTabIndex = this.activeTabIndex;
|
|
524
|
+
this.activeTabIndex = index;
|
|
525
|
+
tab.focus();
|
|
526
|
+
this.setComponent();
|
|
527
|
+
};
|
|
401
528
|
this.scrollablePanel = false;
|
|
402
529
|
this._actionItemsSlottedContent = [];
|
|
403
|
-
this.handleActiveIndicatorPosition = () => this.#handleActiveIndicatorPosition();
|
|
404
|
-
this.animateActiveIndicator = () => this.#animateActiveIndicator();
|
|
405
|
-
}
|
|
406
|
-
connotationChanged() {
|
|
407
|
-
this.#updateTabsConnotation();
|
|
408
530
|
}
|
|
531
|
+
/**
|
|
532
|
+
* @internal
|
|
533
|
+
*/
|
|
409
534
|
orientationChanged() {
|
|
410
|
-
|
|
535
|
+
if (this.$fastController.isConnected) {
|
|
536
|
+
this.setTabs();
|
|
537
|
+
this.setTabPanels();
|
|
538
|
+
this.handleActiveIndicatorPosition();
|
|
539
|
+
}
|
|
411
540
|
this.patchIndicatorStyleTransition();
|
|
412
541
|
if (!this.activeIndicatorRef) return;
|
|
413
542
|
if (this.orientation === TabsOrientation.vertical) {
|
|
414
543
|
this.activeIndicatorRef.style.removeProperty(ACTIVE_TAB_WIDTH);
|
|
415
544
|
}
|
|
416
545
|
}
|
|
417
|
-
|
|
418
|
-
|
|
546
|
+
/**
|
|
547
|
+
* @internal
|
|
548
|
+
*/
|
|
549
|
+
activeidChanged(oldValue, _) {
|
|
550
|
+
if (this.$fastController.isConnected && this.tabs.length <= this.tabpanels.length) {
|
|
551
|
+
this.prevActiveTabIndex = this.tabs.findIndex(
|
|
552
|
+
(item) => item.id === oldValue
|
|
553
|
+
);
|
|
554
|
+
this.setTabs();
|
|
555
|
+
this.setTabPanels();
|
|
556
|
+
this.handleActiveIndicatorPosition();
|
|
557
|
+
}
|
|
419
558
|
this.patchIndicatorStyleTransition();
|
|
420
559
|
this.#updateTabsConnotation();
|
|
421
560
|
this.#scrollToIndex(this.activeTabIndex);
|
|
422
561
|
}
|
|
562
|
+
/**
|
|
563
|
+
* @internal
|
|
564
|
+
*/
|
|
423
565
|
tabsChanged() {
|
|
424
|
-
|
|
566
|
+
if (this.$fastController.isConnected && this.tabs.length <= this.tabpanels.length) {
|
|
567
|
+
this.tabIds = this.getTabIds();
|
|
568
|
+
this.tabpanelIds = this.getTabPanelIds();
|
|
569
|
+
this.setTabs();
|
|
570
|
+
this.setTabPanels();
|
|
571
|
+
this.handleActiveIndicatorPosition();
|
|
572
|
+
}
|
|
425
573
|
this.patchIndicatorStyleTransition();
|
|
426
574
|
this.#updateScrollStatus();
|
|
427
575
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
576
|
+
/**
|
|
577
|
+
* @internal
|
|
578
|
+
*/
|
|
431
579
|
tabpanelsChanged() {
|
|
432
|
-
|
|
580
|
+
if (this.$fastController.isConnected && this.tabpanels.length <= this.tabs.length) {
|
|
581
|
+
this.tabIds = this.getTabIds();
|
|
582
|
+
this.tabpanelIds = this.getTabPanelIds();
|
|
583
|
+
this.setTabs();
|
|
584
|
+
this.setTabPanels();
|
|
585
|
+
this.handleActiveIndicatorPosition();
|
|
586
|
+
}
|
|
433
587
|
this.patchIndicatorStyleTransition();
|
|
434
588
|
}
|
|
589
|
+
getActiveIndex() {
|
|
590
|
+
const id = this.activeid;
|
|
591
|
+
if (id !== void 0) {
|
|
592
|
+
return this.tabIds.indexOf(this.activeid) === -1 ? 0 : this.tabIds.indexOf(this.activeid);
|
|
593
|
+
} else {
|
|
594
|
+
return 0;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
getTabIds() {
|
|
598
|
+
return this.tabs.map((tab) => {
|
|
599
|
+
return tab.getAttribute("id") ?? `tab-${uniqueId()}`;
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
getTabPanelIds() {
|
|
603
|
+
return this.tabpanels.map((tabPanel) => {
|
|
604
|
+
return tabPanel.getAttribute("id") ?? `panel-${uniqueId()}`;
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
setComponent() {
|
|
608
|
+
if (this.activeTabIndex !== this.prevActiveTabIndex) {
|
|
609
|
+
this.activeid = this.tabIds[this.activeTabIndex];
|
|
610
|
+
this.focusTab();
|
|
611
|
+
this.change();
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
isHorizontal() {
|
|
615
|
+
return this.orientation === TabsOrientation.horizontal;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* The adjust method for FASTTabs
|
|
619
|
+
* @public
|
|
620
|
+
* @remarks
|
|
621
|
+
* This method allows the active index to be adjusted by numerical increments
|
|
622
|
+
*/
|
|
623
|
+
adjust(adjustment) {
|
|
624
|
+
const focusableTabs = this.tabs.filter((t) => this.isFocusableElement(t));
|
|
625
|
+
const currentActiveTabIndex = focusableTabs.indexOf(this.activetab);
|
|
626
|
+
const nextTabIndex = numbers.limit(
|
|
627
|
+
0,
|
|
628
|
+
focusableTabs.length - 1,
|
|
629
|
+
currentActiveTabIndex + adjustment
|
|
630
|
+
);
|
|
631
|
+
const nextIndex = this.tabs.indexOf(focusableTabs[nextTabIndex]);
|
|
632
|
+
if (nextIndex > -1) {
|
|
633
|
+
this.moveToTabByIndex(this.tabs, nextIndex);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
#moveToNextTab(direction) {
|
|
637
|
+
const activeIndex = this.tabs.indexOf(this.activetab);
|
|
638
|
+
for (let offset = 1; offset < this.tabs.length; offset++) {
|
|
639
|
+
const index = (activeIndex + direction * offset + this.tabs.length) % this.tabs.length;
|
|
640
|
+
if (this.isFocusableElement(this.tabs[index])) {
|
|
641
|
+
this.moveToTabByIndex(this.tabs, index);
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
focusTab() {
|
|
647
|
+
this.tabs[this.activeTabIndex].focus();
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* @internal
|
|
651
|
+
*/
|
|
652
|
+
connotationChanged() {
|
|
653
|
+
this.#updateTabsConnotation();
|
|
654
|
+
}
|
|
655
|
+
#updateScrollStatus() {
|
|
656
|
+
this.tablist.parentElement.dispatchEvent(new Event("scroll"));
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* @internal
|
|
660
|
+
*/
|
|
435
661
|
patchIndicatorStyleTransition() {
|
|
436
662
|
if (!this.activetab || !this.activeIndicatorRef) return;
|
|
437
663
|
if (this.orientation === TabsOrientation.vertical || !this.showActiveIndicator)
|
|
@@ -441,6 +667,9 @@ class Tabs extends Tabs$1 {
|
|
|
441
667
|
}
|
|
442
668
|
connectedCallback() {
|
|
443
669
|
super.connectedCallback();
|
|
670
|
+
this.tabIds = this.getTabIds();
|
|
671
|
+
this.tabpanelIds = this.getTabPanelIds();
|
|
672
|
+
this.activeTabIndex = this.getActiveIndex();
|
|
444
673
|
requestAnimationFrame(() => this.#updateScrollStatus());
|
|
445
674
|
const scrollWrapper = this.tablist.parentElement;
|
|
446
675
|
this.#resizeObserver = new ResizeObserver(() => {
|
|
@@ -496,12 +725,12 @@ class Tabs extends Tabs$1 {
|
|
|
496
725
|
#getTranslateProperty() {
|
|
497
726
|
return this.isHorizontal() ? "translateX" : "translateY";
|
|
498
727
|
}
|
|
499
|
-
|
|
728
|
+
handleActiveIndicatorPosition() {
|
|
500
729
|
if (this.showActiveIndicator && this.activeindicator) {
|
|
501
730
|
this.animateActiveIndicator();
|
|
502
731
|
}
|
|
503
732
|
}
|
|
504
|
-
|
|
733
|
+
animateActiveIndicator() {
|
|
505
734
|
const offsetProperty = this.isHorizontal() ? "offsetLeft" : "offsetTop";
|
|
506
735
|
const currentOffset = this.activeIndicatorRef[offsetProperty];
|
|
507
736
|
const currentGridValue = this.activeIndicatorRef.style[this.#getGridProperty()];
|
|
@@ -523,6 +752,27 @@ class Tabs extends Tabs$1 {
|
|
|
523
752
|
});
|
|
524
753
|
}
|
|
525
754
|
}
|
|
755
|
+
__decorateClass([
|
|
756
|
+
index.attr
|
|
757
|
+
], Tabs.prototype, "orientation");
|
|
758
|
+
__decorateClass([
|
|
759
|
+
index.attr
|
|
760
|
+
], Tabs.prototype, "activeid");
|
|
761
|
+
__decorateClass([
|
|
762
|
+
index.observable
|
|
763
|
+
], Tabs.prototype, "tabs");
|
|
764
|
+
__decorateClass([
|
|
765
|
+
index.observable
|
|
766
|
+
], Tabs.prototype, "tabpanels");
|
|
767
|
+
__decorateClass([
|
|
768
|
+
index.attr({ mode: "boolean" })
|
|
769
|
+
], Tabs.prototype, "activeindicator");
|
|
770
|
+
__decorateClass([
|
|
771
|
+
index.observable
|
|
772
|
+
], Tabs.prototype, "activeIndicatorRef");
|
|
773
|
+
__decorateClass([
|
|
774
|
+
index.observable
|
|
775
|
+
], Tabs.prototype, "showActiveIndicator");
|
|
526
776
|
__decorateClass([
|
|
527
777
|
index.observable
|
|
528
778
|
], Tabs.prototype, "tablist");
|