@db-ux/wc-core-components 4.7.0-tabs-34782eb → 4.7.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/CHANGELOG.md +5 -0
- package/agent/Tabs.md +30 -30
- package/dist/cjs/db-accordion-item.cjs.entry.js +2 -2
- package/dist/cjs/db-accordion.cjs.entry.js +1 -1
- package/dist/cjs/db-badge.cjs.entry.js +1 -1
- package/dist/cjs/db-brand.cjs.entry.js +1 -1
- package/dist/cjs/db-button.cjs.entry.js +1 -1
- package/dist/cjs/db-card.cjs.entry.js +2 -2
- package/dist/cjs/db-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/db-custom-button.cjs.entry.js +2 -2
- package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js +9 -9
- package/dist/cjs/db-custom-select-form-field.cjs.entry.js +2 -2
- package/dist/cjs/db-custom-select.cjs.entry.js +5 -5
- package/dist/cjs/db-divider.cjs.entry.js +1 -1
- package/dist/cjs/db-drawer.cjs.entry.js +3 -3
- package/dist/cjs/db-header.cjs.entry.js +2 -2
- package/dist/cjs/db-icon.cjs.entry.js +1 -1
- package/dist/cjs/db-infotext.cjs.entry.js +1 -1
- package/dist/cjs/db-link.cjs.entry.js +1 -1
- package/dist/cjs/db-navigation-item.cjs.entry.js +1 -1
- package/dist/cjs/db-navigation.cjs.entry.js +2 -2
- package/dist/cjs/db-notification.cjs.entry.js +2 -2
- package/dist/cjs/db-page.cjs.entry.js +2 -2
- package/dist/cjs/db-popover.cjs.entry.js +2 -2
- package/dist/cjs/db-radio.cjs.entry.js +1 -1
- package/dist/cjs/db-section.cjs.entry.js +2 -2
- package/dist/cjs/db-select.cjs.entry.js +2 -2
- package/dist/cjs/db-stack.cjs.entry.js +2 -2
- package/dist/cjs/db-switch.cjs.entry.js +2 -2
- package/dist/cjs/db-tab-item_3.cjs.entry.js +67 -133
- package/dist/cjs/db-tabs.cjs.entry.js +123 -373
- package/dist/cjs/db-textarea.cjs.entry.js +2 -2
- package/dist/cjs/db-tooltip.cjs.entry.js +4 -3
- package/dist/cjs/db-ux.cjs.js +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/accordion/accordion.js +1 -1
- package/dist/collection/components/accordion-item/accordion-item.js +2 -2
- package/dist/collection/components/badge/badge.js +1 -1
- package/dist/collection/components/brand/brand.js +1 -1
- package/dist/collection/components/button/button.js +1 -1
- package/dist/collection/components/card/card.js +2 -2
- package/dist/collection/components/checkbox/checkbox.js +2 -2
- package/dist/collection/components/custom-button/custom-button.js +2 -2
- package/dist/collection/components/custom-select/custom-select.js +5 -5
- package/dist/collection/components/custom-select-dropdown/custom-select-dropdown.js +2 -2
- package/dist/collection/components/custom-select-form-field/custom-select-form-field.js +2 -2
- package/dist/collection/components/custom-select-list/custom-select-list.js +2 -2
- package/dist/collection/components/custom-select-list-item/custom-select-list-item.js +1 -1
- package/dist/collection/components/divider/divider.js +1 -1
- package/dist/collection/components/drawer/drawer.js +3 -3
- package/dist/collection/components/header/header.js +2 -2
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/infotext/infotext.js +1 -1
- package/dist/collection/components/input/input.js +2 -2
- package/dist/collection/components/link/link.js +1 -1
- package/dist/collection/components/navigation/navigation.js +2 -2
- package/dist/collection/components/navigation-item/navigation-item.js +1 -1
- package/dist/collection/components/notification/notification.js +2 -2
- package/dist/collection/components/page/page.js +2 -2
- package/dist/collection/components/popover/popover.js +2 -2
- package/dist/collection/components/radio/radio.js +1 -1
- package/dist/collection/components/section/section.js +2 -2
- package/dist/collection/components/select/select.js +2 -2
- package/dist/collection/components/stack/stack.js +2 -2
- package/dist/collection/components/switch/switch.js +2 -2
- package/dist/collection/components/tab-item/tab-item.js +129 -198
- package/dist/collection/components/tab-list/tab-list.js +12 -74
- package/dist/collection/components/tab-panel/tab-panel.js +2 -80
- package/dist/collection/components/tabs/tabs.js +167 -504
- package/dist/collection/components/tag/tag.js +2 -2
- package/dist/collection/components/textarea/textarea.js +2 -2
- package/dist/collection/components/tooltip/tooltip.js +4 -3
- package/dist/collection/shared/model.js +1 -1
- package/dist/custom-elements.json +2998 -3898
- package/dist/db-ux/db-ux.esm.js +1 -1
- package/dist/db-ux/index.esm.js +1 -1
- package/dist/db-ux/{p-9b518eb4.entry.js → p-0e0c3c72.entry.js} +1 -1
- package/dist/db-ux/{p-61784f7a.entry.js → p-12a2c502.entry.js} +1 -1
- package/dist/db-ux/{p-b7087f0b.entry.js → p-13157b54.entry.js} +1 -1
- package/dist/db-ux/p-202323c2.entry.js +1 -0
- package/dist/db-ux/p-21068628.entry.js +1 -0
- package/dist/db-ux/{p-b06fe221.entry.js → p-212bde1e.entry.js} +1 -1
- package/dist/db-ux/{p-01c278b9.entry.js → p-2355324e.entry.js} +1 -1
- package/dist/db-ux/p-377987d0.entry.js +1 -0
- package/dist/db-ux/p-3d5d49ff.entry.js +1 -0
- package/dist/db-ux/p-452a8b6b.entry.js +1 -0
- package/dist/db-ux/p-4de2c697.entry.js +1 -0
- package/dist/db-ux/{p-f08b14d9.entry.js → p-5cb74480.entry.js} +1 -1
- package/dist/db-ux/{p-071ae423.entry.js → p-5f5eb78d.entry.js} +1 -1
- package/dist/db-ux/p-605013f0.entry.js +1 -0
- package/dist/db-ux/p-6f9e146e.entry.js +1 -0
- package/dist/db-ux/{p-328faf6b.entry.js → p-70823b80.entry.js} +1 -1
- package/dist/db-ux/{p-70e6d32f.entry.js → p-761c9ddf.entry.js} +1 -1
- package/dist/db-ux/p-7fa91164.entry.js +1 -0
- package/dist/db-ux/p-8e84712d.entry.js +1 -0
- package/dist/db-ux/{p-ffe614c8.entry.js → p-980a6afe.entry.js} +1 -1
- package/dist/db-ux/{p-6c26b0ba.entry.js → p-a65d0d23.entry.js} +1 -1
- package/dist/db-ux/p-a9efbb0b.entry.js +1 -0
- package/dist/db-ux/{p-07c7ecc9.entry.js → p-abb0885d.entry.js} +1 -1
- package/dist/db-ux/{p-9a895c18.entry.js → p-ba8464d2.entry.js} +1 -1
- package/dist/db-ux/p-bd66d144.entry.js +1 -0
- package/dist/db-ux/{p-74a45768.entry.js → p-bed8d029.entry.js} +1 -1
- package/dist/db-ux/{p-ee43015b.entry.js → p-c76089f6.entry.js} +1 -1
- package/dist/db-ux/{p-44a0407b.entry.js → p-c7bf8d05.entry.js} +1 -1
- package/dist/db-ux/{p-43a9623f.entry.js → p-d85b1c15.entry.js} +1 -1
- package/dist/db-ux/{p-d93b9d58.entry.js → p-d8b38722.entry.js} +1 -1
- package/dist/db-ux/p-dd08f6e4.entry.js +1 -0
- package/dist/esm/db-accordion-item.entry.js +2 -2
- package/dist/esm/db-accordion.entry.js +1 -1
- package/dist/esm/db-badge.entry.js +1 -1
- package/dist/esm/db-brand.entry.js +1 -1
- package/dist/esm/db-button.entry.js +1 -1
- package/dist/esm/db-card.entry.js +2 -2
- package/dist/esm/db-checkbox.entry.js +2 -2
- package/dist/esm/db-custom-button.entry.js +2 -2
- package/dist/esm/db-custom-select-dropdown_5.entry.js +9 -9
- package/dist/esm/db-custom-select-form-field.entry.js +2 -2
- package/dist/esm/db-custom-select.entry.js +5 -5
- package/dist/esm/db-divider.entry.js +1 -1
- package/dist/esm/db-drawer.entry.js +3 -3
- package/dist/esm/db-header.entry.js +2 -2
- package/dist/esm/db-icon.entry.js +1 -1
- package/dist/esm/db-infotext.entry.js +1 -1
- package/dist/esm/db-link.entry.js +1 -1
- package/dist/esm/db-navigation-item.entry.js +1 -1
- package/dist/esm/db-navigation.entry.js +2 -2
- package/dist/esm/db-notification.entry.js +2 -2
- package/dist/esm/db-page.entry.js +2 -2
- package/dist/esm/db-popover.entry.js +2 -2
- package/dist/esm/db-radio.entry.js +1 -1
- package/dist/esm/db-section.entry.js +2 -2
- package/dist/esm/db-select.entry.js +2 -2
- package/dist/esm/db-stack.entry.js +2 -2
- package/dist/esm/db-switch.entry.js +2 -2
- package/dist/esm/db-tab-item_3.entry.js +68 -134
- package/dist/esm/db-tabs.entry.js +123 -373
- package/dist/esm/db-textarea.entry.js +2 -2
- package/dist/esm/db-tooltip.entry.js +5 -4
- package/dist/esm/db-ux.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/tab-item/model.d.ts +11 -28
- package/dist/types/components/tab-item/tab-item.d.ts +20 -22
- package/dist/types/components/tab-list/model.d.ts +5 -15
- package/dist/types/components/tab-list/tab-list.d.ts +1 -4
- package/dist/types/components/tab-panel/model.d.ts +3 -13
- package/dist/types/components/tab-panel/tab-panel.d.ts +0 -3
- package/dist/types/components/tabs/model.d.ts +17 -51
- package/dist/types/components/tabs/tabs.d.ts +16 -35
- package/dist/types/components.d.ts +30 -80
- package/dist/types/shared/model.d.ts +5 -5
- package/dist/vscode.html-custom-data.json +59 -147
- package/dist/web-types.json +135 -289
- package/package.json +3 -3
- package/dist/db-ux/p-10869bfa.entry.js +0 -1
- package/dist/db-ux/p-1427bb15.entry.js +0 -1
- package/dist/db-ux/p-397bc590.entry.js +0 -1
- package/dist/db-ux/p-68835a75.entry.js +0 -1
- package/dist/db-ux/p-68a995df.entry.js +0 -1
- package/dist/db-ux/p-6e898a58.entry.js +0 -1
- package/dist/db-ux/p-71868bb5.entry.js +0 -1
- package/dist/db-ux/p-9b4d0c18.entry.js +0 -1
- package/dist/db-ux/p-a927fe88.entry.js +0 -1
- package/dist/db-ux/p-a93ca690.entry.js +0 -1
- package/dist/db-ux/p-d97c0787.entry.js +0 -1
- package/dist/db-ux/p-efde1b6e.entry.js +0 -1
- package/dist/db-ux/p-f92cbbae.entry.js +0 -1
|
@@ -5,322 +5,131 @@ const DBTabs = class {
|
|
|
5
5
|
constructor(hostRef) {
|
|
6
6
|
registerInstance(this, hostRef);
|
|
7
7
|
this.indexChange = createEvent(this, "indexChange");
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.tabItemWidth = "auto";
|
|
11
|
-
this.scrollStartLabel = "Scroll start";
|
|
12
|
-
this.scrollEndLabel = "Scroll end";
|
|
13
|
-
this._generatedId = "tabs-" + uuid();
|
|
14
|
-
this._generatedName = uuid();
|
|
15
|
-
this.activeTabIndex = 0;
|
|
8
|
+
this.tabSelect = createEvent(this, "tabSelect");
|
|
9
|
+
this._name = "";
|
|
16
10
|
this.initialized = false;
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this._pendingRafId = null;
|
|
22
|
-
this._scrollListener = null;
|
|
23
|
-
this._cachedTabs = [];
|
|
11
|
+
this.showScrollLeft = false;
|
|
12
|
+
this.showScrollRight = false;
|
|
13
|
+
this.scrollContainer = null;
|
|
14
|
+
this._resizeObserver = undefined;
|
|
24
15
|
}
|
|
25
|
-
|
|
26
|
-
return this.id || this._generatedId;
|
|
27
|
-
}
|
|
28
|
-
_name() {
|
|
29
|
-
return "tabs-" + (this.name || this._generatedName);
|
|
30
|
-
}
|
|
31
|
-
getTabId(index) {
|
|
32
|
-
return `${this._name()}-tab-${index}`;
|
|
33
|
-
}
|
|
34
|
-
getPanelId(index) {
|
|
35
|
-
return `${this._name()}-tab-panel-${index}`;
|
|
36
|
-
}
|
|
37
|
-
activateTab(index) {
|
|
38
|
-
var _a, _b, _c;
|
|
39
|
-
// Prevent activating a disabled tab
|
|
40
|
-
if (this._ref) {
|
|
41
|
-
const tabList = this._ref.querySelector('[role="tablist"]');
|
|
42
|
-
if (tabList) {
|
|
43
|
-
const tabs = Array.from(tabList.querySelectorAll('[role="tab"]'));
|
|
44
|
-
const tab = tabs[index];
|
|
45
|
-
if ((tab === null || tab === void 0 ? void 0 : tab.disabled) || (tab === null || tab === void 0 ? void 0 : tab.getAttribute("aria-disabled")) === "true") {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (this.activeTabIndex !== index) {
|
|
51
|
-
this.activeTabIndex = index;
|
|
52
|
-
if (this.indexChange) {
|
|
53
|
-
this.indexChange.emit(index);
|
|
54
|
-
}
|
|
55
|
-
// Emit value of the newly active tab item if value props are set
|
|
56
|
-
if (this.valueChange) {
|
|
57
|
-
const tabList = (_a = this._ref) === null || _a === void 0 ? void 0 : _a.querySelector('[role="tablist"]');
|
|
58
|
-
const tabs = tabList
|
|
59
|
-
? Array.from(tabList.querySelectorAll('[role="tab"]'))
|
|
60
|
-
: [];
|
|
61
|
-
const value = (_c = (_b = tabs[index]) === null || _b === void 0 ? void 0 : _b.dataset) === null || _c === void 0 ? void 0 : _c["value"];
|
|
62
|
-
this.valueChange.emit(value);
|
|
63
|
-
}
|
|
64
|
-
this.initTabs(index);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
handleClick(event) {
|
|
68
|
-
var _a;
|
|
69
|
-
// In props-mode (props.tabs), tab activation is handled via onClick on each DBTabItem directly.
|
|
70
|
-
// In slot-mode (!props.tabs), clicks bubble up and are handled here via DOM traversal.
|
|
71
|
-
if (this.tabs) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const target = event.target;
|
|
75
|
-
const button = target.closest('[role="tab"]');
|
|
76
|
-
if (!button || !this._ref)
|
|
77
|
-
return;
|
|
78
|
-
const tabList = (_a = this._ref) === null || _a === void 0 ? void 0 : _a.querySelector('[role="tablist"]');
|
|
79
|
-
if (!tabList)
|
|
80
|
-
return;
|
|
81
|
-
const buttons = Array.from(tabList.querySelectorAll('[role="tab"]'));
|
|
82
|
-
const index = buttons.indexOf(button);
|
|
83
|
-
if (index !== -1) {
|
|
84
|
-
event.preventDefault();
|
|
85
|
-
this.activateTab(index);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
handleKeyDown(event) {
|
|
89
|
-
var _a;
|
|
90
|
-
if (!this._ref)
|
|
91
|
-
return;
|
|
92
|
-
const key = event.key;
|
|
93
|
-
const navigationKeys = [
|
|
94
|
-
"ArrowRight",
|
|
95
|
-
"ArrowDown",
|
|
96
|
-
"ArrowLeft",
|
|
97
|
-
"ArrowUp",
|
|
98
|
-
"Home",
|
|
99
|
-
"End",
|
|
100
|
-
"Enter",
|
|
101
|
-
" ",
|
|
102
|
-
];
|
|
103
|
-
if (!navigationKeys.includes(key)) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const tabList = this._ref.querySelector('[role="tablist"]');
|
|
107
|
-
if (!tabList)
|
|
108
|
-
return;
|
|
109
|
-
const buttons = Array.from(tabList.querySelectorAll('[role="tab"]'));
|
|
110
|
-
// find currently focused element within the buttons list
|
|
111
|
-
let currentIndex = -1;
|
|
112
|
-
if (typeof document !== "undefined") {
|
|
113
|
-
// Traverse Shadow DOM boundaries to find the truly focused element.
|
|
114
|
-
// document.activeElement only returns the shadow host when focus is inside a Shadow DOM,
|
|
115
|
-
// so we must walk through each shadowRoot to reach the actual focused element.
|
|
116
|
-
let activeEl = document.activeElement;
|
|
117
|
-
while ((_a = activeEl === null || activeEl === void 0 ? void 0 : activeEl.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement) {
|
|
118
|
-
activeEl = activeEl.shadowRoot.activeElement;
|
|
119
|
-
}
|
|
120
|
-
if (activeEl) {
|
|
121
|
-
const focusedButton = activeEl.closest('[role="tab"]');
|
|
122
|
-
if (focusedButton) {
|
|
123
|
-
currentIndex = buttons.indexOf(focusedButton);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (currentIndex === -1) {
|
|
128
|
-
currentIndex = this.activeTabIndex;
|
|
129
|
-
}
|
|
130
|
-
if (buttons.length > 0) {
|
|
131
|
-
// handle activation (enter / space) -> change panel
|
|
132
|
-
if (key === "Enter" || key === " ") {
|
|
133
|
-
event.preventDefault();
|
|
134
|
-
this.activateTab(currentIndex);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
// handle navigation (arrows) -> moves focus
|
|
138
|
-
let nextIndex;
|
|
139
|
-
const length = buttons.length;
|
|
140
|
-
if (key === "ArrowRight" || key === "ArrowDown") {
|
|
141
|
-
nextIndex = (currentIndex + 1) % length;
|
|
142
|
-
}
|
|
143
|
-
else if (key === "ArrowLeft" || key === "ArrowUp") {
|
|
144
|
-
nextIndex = (currentIndex - 1 + length) % length;
|
|
145
|
-
}
|
|
146
|
-
else if (key === "Home") {
|
|
147
|
-
nextIndex = 0;
|
|
148
|
-
}
|
|
149
|
-
else if (key === "End") {
|
|
150
|
-
nextIndex = length - 1;
|
|
151
|
-
}
|
|
152
|
-
if (nextIndex !== undefined) {
|
|
153
|
-
event.preventDefault();
|
|
154
|
-
// Skip disabled tabs when navigating with arrow keys
|
|
155
|
-
const isForward = key === "ArrowRight" || key === "ArrowDown";
|
|
156
|
-
const maxAttempts = length;
|
|
157
|
-
for (let i = 0; i < maxAttempts; i++) {
|
|
158
|
-
const candidate = buttons[nextIndex];
|
|
159
|
-
if (!(candidate === null || candidate === void 0 ? void 0 : candidate.disabled) &&
|
|
160
|
-
(candidate === null || candidate === void 0 ? void 0 : candidate.getAttribute("aria-disabled")) !== "true") {
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
if (isForward) {
|
|
164
|
-
nextIndex = (nextIndex + 1) % length;
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
nextIndex = (nextIndex - 1 + length) % length;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
// do not activateTab here for manual activation, just move the focus
|
|
171
|
-
const nextButton = buttons[nextIndex];
|
|
172
|
-
if (nextButton &&
|
|
173
|
-
!nextButton.disabled &&
|
|
174
|
-
nextButton.getAttribute("aria-disabled") !== "true") {
|
|
175
|
-
nextButton.focus();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
isIndexActive(index) {
|
|
181
|
-
return this.activeTabIndex === Number(index);
|
|
182
|
-
}
|
|
183
|
-
getTabItemTabIndex(index) {
|
|
184
|
-
const i = Number(index);
|
|
185
|
-
// only the active tab should be reachable via Tab key
|
|
186
|
-
return this.activeTabIndex === i || (this.activeTabIndex === -1 && i === 0)
|
|
187
|
-
? 0
|
|
188
|
-
: -1;
|
|
189
|
-
}
|
|
190
|
-
_updateCachedTabs() {
|
|
16
|
+
convertTabs() {
|
|
191
17
|
try {
|
|
192
18
|
if (typeof this.tabs === "string") {
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
else if (this.tabs) {
|
|
196
|
-
this._cachedTabs = this.tabs;
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
this._cachedTabs = [];
|
|
19
|
+
return JSON.parse(this.tabs);
|
|
200
20
|
}
|
|
21
|
+
return this.tabs;
|
|
201
22
|
}
|
|
202
23
|
catch (error) {
|
|
203
24
|
console.error(error);
|
|
204
|
-
this._cachedTabs = [];
|
|
205
25
|
}
|
|
206
|
-
|
|
207
|
-
_getScrollContainer() {
|
|
208
|
-
var _a, _b;
|
|
209
|
-
return (_b = (_a = this._ref) === null || _a === void 0 ? void 0 : _a.querySelector('[role="tablist"]')) !== null && _b !== void 0 ? _b : null;
|
|
210
|
-
}
|
|
211
|
-
_isRtl() {
|
|
212
|
-
const container = this._getScrollContainer();
|
|
213
|
-
return (!!container &&
|
|
214
|
-
typeof getComputedStyle !== "undefined" &&
|
|
215
|
-
getComputedStyle(container).direction === "rtl");
|
|
26
|
+
return [];
|
|
216
27
|
}
|
|
217
28
|
evaluateScrollButtons(tList) {
|
|
218
29
|
const needsScroll = tList.scrollWidth > tList.clientWidth;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
const scrollPos = Math.abs(tList.scrollLeft);
|
|
225
|
-
const maxScroll = tList.scrollWidth - tList.clientWidth;
|
|
226
|
-
const tolerance = 2;
|
|
227
|
-
// scrollPos=0 means "at inline-start" in both LTR and RTL
|
|
228
|
-
this.showScrollStart = scrollPos > tolerance;
|
|
229
|
-
this.showScrollEnd = scrollPos < maxScroll - tolerance;
|
|
30
|
+
this.showScrollLeft = needsScroll && tList.scrollLeft > 1;
|
|
31
|
+
this.showScrollRight =
|
|
32
|
+
needsScroll && tList.scrollLeft < tList.scrollWidth - tList.clientWidth;
|
|
230
33
|
}
|
|
231
|
-
scroll(
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
let step = Number(this.arrowScrollDistance) || 120;
|
|
237
|
-
const isLeft = !!toStart;
|
|
238
|
-
const isRtl = this._isRtl();
|
|
239
|
-
// Map logical direction (start/end) to physical direction.
|
|
240
|
-
// In LTR: toStart=true → scroll left (negative), toEnd → scroll right (positive).
|
|
241
|
-
// In RTL: directions are inverted physically.
|
|
242
|
-
if (isLeft !== isRtl) {
|
|
34
|
+
scroll(left) {
|
|
35
|
+
var _a;
|
|
36
|
+
let step = Number(this.arrowScrollDistance) || 100;
|
|
37
|
+
if (left) {
|
|
243
38
|
step *= -1;
|
|
244
39
|
}
|
|
245
|
-
|
|
40
|
+
(_a = this.scrollContainer) === null || _a === void 0 ? void 0 : _a.scrollBy({
|
|
41
|
+
top: 0,
|
|
246
42
|
left: step,
|
|
247
43
|
behavior: "smooth",
|
|
248
44
|
});
|
|
249
45
|
}
|
|
250
46
|
initTabList() {
|
|
251
|
-
var _a, _b;
|
|
252
47
|
if (this._ref) {
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
container.removeEventListener("scroll", _listener.fn);
|
|
263
|
-
this._scrollListener = null;
|
|
264
|
-
}
|
|
265
|
-
const onScroll = () => this.evaluateScrollButtons(container);
|
|
266
|
-
this._scrollListener = {
|
|
267
|
-
fn: onScroll,
|
|
268
|
-
};
|
|
269
|
-
container.addEventListener("scroll", onScroll);
|
|
270
|
-
if (!this._resizeObserver) {
|
|
271
|
-
const observer = new ResizeObserver(() => {
|
|
48
|
+
const tabList = this._ref.querySelector(".db-tab-list");
|
|
49
|
+
if (tabList) {
|
|
50
|
+
const container = tabList.querySelector('[role="tablist"]');
|
|
51
|
+
if (container) {
|
|
52
|
+
container.setAttribute("aria-orientation", this.orientation || "horizontal");
|
|
53
|
+
if (this.behavior === "arrows") {
|
|
54
|
+
this.scrollContainer = container;
|
|
55
|
+
this.evaluateScrollButtons(container);
|
|
56
|
+
container.addEventListener("scroll", () => {
|
|
272
57
|
this.evaluateScrollButtons(container);
|
|
273
58
|
});
|
|
274
|
-
|
|
275
|
-
this._resizeObserver
|
|
59
|
+
// Use ResizeObserver to re-evaluate scroll buttons because it provides more accurate, container-specific resize detection than global window resize events.
|
|
60
|
+
if (!this._resizeObserver) {
|
|
61
|
+
const observer = new ResizeObserver(() => {
|
|
62
|
+
this.evaluateScrollButtons(container);
|
|
63
|
+
});
|
|
64
|
+
observer.observe(container);
|
|
65
|
+
this._resizeObserver = observer;
|
|
66
|
+
}
|
|
276
67
|
}
|
|
277
68
|
}
|
|
278
|
-
if (this.name && !container.getAttribute("aria-label")) {
|
|
279
|
-
container.setAttribute("aria-label", (_b = this.name) !== null && _b !== void 0 ? _b : "");
|
|
280
|
-
}
|
|
281
69
|
}
|
|
282
70
|
}
|
|
283
71
|
}
|
|
284
|
-
initTabs(
|
|
285
|
-
var _a, _b;
|
|
286
|
-
const currentIndex = activeIndex !== undefined ? activeIndex : this.activeTabIndex;
|
|
72
|
+
initTabs(init) {
|
|
287
73
|
if (this._ref) {
|
|
288
|
-
const
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
button.dispatchEvent(new CustomEvent("aria-selected-changed", {
|
|
305
|
-
detail: {
|
|
306
|
-
selected: isSelected,
|
|
307
|
-
tabIndex: currentIndex === index || (currentIndex === -1 && index === 0)
|
|
308
|
-
? 0
|
|
309
|
-
: -1,
|
|
310
|
-
},
|
|
311
|
-
}));
|
|
312
|
-
if (panel) {
|
|
313
|
-
if (!panel.id) {
|
|
314
|
-
panel.id = panelId;
|
|
74
|
+
const tabItems = Array.from(this._ref.getElementsByClassName("db-tab-item"));
|
|
75
|
+
const tabPanels = Array.from(this._ref.querySelectorAll(":is(:scope > .db-tab-panel, :scope > db-tab-panel > .db-tab-panel)"));
|
|
76
|
+
for (const tabItem of tabItems) {
|
|
77
|
+
const index = tabItems.indexOf(tabItem);
|
|
78
|
+
const label = tabItem.querySelector("label");
|
|
79
|
+
const input = tabItem.querySelector("input");
|
|
80
|
+
if (input && label) {
|
|
81
|
+
if (!input.id) {
|
|
82
|
+
const tabId = `${this._name}-tab-${index}`;
|
|
83
|
+
label.setAttribute("for", tabId);
|
|
84
|
+
input.id = tabId;
|
|
85
|
+
input.setAttribute("name", this._name);
|
|
86
|
+
if (tabPanels.length > index) {
|
|
87
|
+
input.setAttribute("aria-controls", `${this._name}-tab-panel-${index}`);
|
|
88
|
+
}
|
|
315
89
|
}
|
|
316
|
-
if (
|
|
317
|
-
|
|
318
|
-
|
|
90
|
+
if (init) {
|
|
91
|
+
// Auto select
|
|
92
|
+
const autoSelect = !this.initialSelectedMode || this.initialSelectedMode === "auto";
|
|
93
|
+
const shouldAutoSelect = (this.initialSelectedIndex == null && index === 0) ||
|
|
94
|
+
Number(this.initialSelectedIndex) === index;
|
|
95
|
+
if (autoSelect && shouldAutoSelect) {
|
|
96
|
+
input.click();
|
|
97
|
+
}
|
|
319
98
|
}
|
|
320
|
-
// toggle visibility
|
|
321
|
-
panel.hidden = !isSelected;
|
|
322
99
|
}
|
|
323
|
-
}
|
|
100
|
+
}
|
|
101
|
+
for (const panel of tabPanels) {
|
|
102
|
+
if (panel.id)
|
|
103
|
+
continue;
|
|
104
|
+
const index = tabPanels.indexOf(panel);
|
|
105
|
+
panel.id = `${this._name}-tab-panel-${index}`;
|
|
106
|
+
panel.setAttribute("aria-labelledby", `${this._name}-tab-${index}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
handleChange(event) {
|
|
111
|
+
var _a;
|
|
112
|
+
event.stopPropagation();
|
|
113
|
+
if (event.target) {
|
|
114
|
+
const target = event.target;
|
|
115
|
+
const parent = target.parentElement;
|
|
116
|
+
if (parent &&
|
|
117
|
+
parent.parentElement &&
|
|
118
|
+
((_a = parent.parentElement) === null || _a === void 0 ? void 0 : _a.nodeName) === "LI") {
|
|
119
|
+
const tabItem = parent.parentElement.parentElement;
|
|
120
|
+
if (tabItem) {
|
|
121
|
+
const list = tabItem.parentElement;
|
|
122
|
+
if (list) {
|
|
123
|
+
const tabIndex = Array.from(list.children).indexOf(tabItem);
|
|
124
|
+
if (this.indexChange) {
|
|
125
|
+
this.indexChange.emit(tabIndex);
|
|
126
|
+
}
|
|
127
|
+
if (this.tabSelect) {
|
|
128
|
+
this.tabSelect.emit(event);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
324
133
|
}
|
|
325
134
|
}
|
|
326
135
|
/**
|
|
@@ -360,113 +169,54 @@ const DBTabs = class {
|
|
|
360
169
|
}
|
|
361
170
|
}
|
|
362
171
|
watch0Fn() {
|
|
363
|
-
this.
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
watch1() {
|
|
377
|
-
this.watch1Fn();
|
|
378
|
-
}
|
|
379
|
-
componentDidLoad() {
|
|
380
|
-
this.enableAttributePassing(this._ref, "db-tabs");
|
|
381
|
-
// 1. Calculate final start index synchronously to avoid race conditions
|
|
382
|
-
let startIndex = 0;
|
|
383
|
-
if (this.initialSelectedIndex !== undefined) {
|
|
384
|
-
const parsedIndex = Number(this.initialSelectedIndex);
|
|
385
|
-
startIndex = isNaN(parsedIndex) ? 0 : parsedIndex;
|
|
386
|
-
}
|
|
387
|
-
else if (this.initialSelectedMode === "manually") {
|
|
388
|
-
startIndex = -1;
|
|
389
|
-
}
|
|
390
|
-
// 2. Support deep linking: URL hash takes precedence over initial index
|
|
391
|
-
if (typeof window !== "undefined" && window.location.hash) {
|
|
392
|
-
const hashId = window.location.hash.substring(1);
|
|
393
|
-
const name = this.name ? "tabs-" + this.name : this._name();
|
|
394
|
-
const prefix = `${name}-tab-`;
|
|
395
|
-
if (hashId.startsWith(prefix)) {
|
|
396
|
-
const indexStr = hashId.replace(prefix, "");
|
|
397
|
-
const index = parseInt(indexStr, 10);
|
|
398
|
-
if (!isNaN(index)) {
|
|
399
|
-
startIndex = index;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
// 3. Set initial state synchronously
|
|
404
|
-
this.activeTabIndex = startIndex;
|
|
405
|
-
this.initialized = true;
|
|
406
|
-
this._updateCachedTabs();
|
|
407
|
-
// 4. Trigger single initial DOM update after paint
|
|
408
|
-
if (typeof window !== "undefined") {
|
|
409
|
-
requestAnimationFrame(() => {
|
|
410
|
-
this.initTabList();
|
|
411
|
-
this.initTabs(startIndex);
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
if (this._ref) {
|
|
415
|
-
const tabListEl = this._ref.querySelector('[role="tablist"]');
|
|
416
|
-
if (tabListEl) {
|
|
417
|
-
const observer = new MutationObserver(() => {
|
|
418
|
-
const rafId = this._pendingRafId;
|
|
419
|
-
if (rafId !== null)
|
|
420
|
-
cancelAnimationFrame(rafId);
|
|
421
|
-
this._pendingRafId = requestAnimationFrame(() => {
|
|
422
|
-
this._pendingRafId = null;
|
|
423
|
-
this.initTabList();
|
|
424
|
-
this.initTabs(this.activeTabIndex);
|
|
172
|
+
if (this._ref && this.initialized) {
|
|
173
|
+
this.initTabList();
|
|
174
|
+
this.initTabs(true);
|
|
175
|
+
const tabList = this._ref.querySelector(".db-tab-list");
|
|
176
|
+
if (tabList) {
|
|
177
|
+
const observer = new MutationObserver((mutations) => {
|
|
178
|
+
mutations.forEach((mutation) => {
|
|
179
|
+
if (mutation.removedNodes.length || mutation.addedNodes.length) {
|
|
180
|
+
this.initTabList();
|
|
181
|
+
this.initTabs();
|
|
182
|
+
}
|
|
425
183
|
});
|
|
426
184
|
});
|
|
427
|
-
|
|
428
|
-
// re-evaluations when user content inside panels changes.
|
|
429
|
-
// childList only – attribute changes (set by initTabs) are not observed, preventing infinite loops.
|
|
430
|
-
observer.observe(tabListEl, {
|
|
185
|
+
observer.observe(tabList, {
|
|
431
186
|
childList: true,
|
|
432
187
|
subtree: true,
|
|
433
188
|
});
|
|
434
|
-
this._observer = observer;
|
|
435
189
|
}
|
|
190
|
+
this.initialized = false;
|
|
436
191
|
}
|
|
192
|
+
}
|
|
193
|
+
watch0() {
|
|
194
|
+
this.watch0Fn();
|
|
195
|
+
}
|
|
196
|
+
componentDidLoad() {
|
|
197
|
+
this.enableAttributePassing(this._ref, "db-tabs");
|
|
198
|
+
this._name = `tabs-${this.name || uuid()}`;
|
|
199
|
+
this.initialized = true;
|
|
437
200
|
this.watch0Fn();
|
|
438
|
-
this.watch1Fn();
|
|
439
201
|
}
|
|
440
202
|
disconnectedCallback() {
|
|
441
|
-
var _a
|
|
442
|
-
const rafId = this._pendingRafId;
|
|
443
|
-
if (rafId !== null) {
|
|
444
|
-
cancelAnimationFrame(rafId);
|
|
445
|
-
this._pendingRafId = null;
|
|
446
|
-
}
|
|
447
|
-
const _listener = this._scrollListener;
|
|
448
|
-
const _container = this._getScrollContainer();
|
|
449
|
-
if (_listener && _container) {
|
|
450
|
-
_container.removeEventListener("scroll", _listener.fn);
|
|
451
|
-
}
|
|
203
|
+
var _a;
|
|
452
204
|
(_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
453
|
-
this._resizeObserver =
|
|
454
|
-
(_b = this._observer) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
455
|
-
this._observer = null;
|
|
205
|
+
this._resizeObserver = undefined;
|
|
456
206
|
}
|
|
457
207
|
render() {
|
|
458
|
-
var _a, _b, _c, _d, _e;
|
|
459
|
-
return (h("div", { key: '
|
|
208
|
+
var _a, _b, _c, _d, _e, _f;
|
|
209
|
+
return (h("div", { key: '20d8d662866ff60717de87ad4deb98a3b647672a', class: cls("db-tabs", this.className), ref: (el) => {
|
|
460
210
|
this._ref = el;
|
|
461
|
-
}, id: (
|
|
462
|
-
|
|
211
|
+
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-orientation": this.orientation, "data-scroll-behavior": this.behavior, "data-alignment": (_c = this.alignment) !== null && _c !== void 0 ? _c : "start", "data-width": (_d = this.width) !== null && _d !== void 0 ? _d : "auto", onInput: (event) => this.handleChange(event), onChange: (event) => this.handleChange(event) }, this.showScrollLeft ? (h("db-button", { class: "tabs-scroll-left", variant: "ghost", icon: "chevron_left", type: "button", noText: true, onClick: () => this.scroll(true) }, "Scroll left")) : null, this.tabs ? (h(Fragment, null, h("db-tab-list", null, (_e = this.convertTabs()) === null || _e === void 0 ? void 0 : _e.map((tab, index) => (h("db-tab-item", { key: this.name + "tab-item" + index, active: tab.active, label: tab.label, iconTrailing: tab.iconTrailing, icon: tab.icon, noText: tab.noText })))), (_f = this.convertTabs()) === null || _f === void 0 ? void 0 :
|
|
212
|
+
_f.map((tab, index) => (h("db-tab-panel", { key: this.name + "tab-panel" + index, content: tab.content }, tab.children))))) : null, this.showScrollRight ? (h("db-button", { class: "tabs-scroll-right", variant: "ghost", icon: "chevron_right", type: "button", noText: true, onClick: () => this.scroll() }, "Scroll right")) : null, h("slot", { key: 'f9803a647f9a01adc0b20eb6bdb999f38c3602af' })));
|
|
463
213
|
}
|
|
464
214
|
static get watchers() { return {
|
|
465
|
-
"
|
|
215
|
+
"_ref": [{
|
|
466
216
|
"watch0": 0
|
|
467
217
|
}],
|
|
468
|
-
"
|
|
469
|
-
"
|
|
218
|
+
"initialized": [{
|
|
219
|
+
"watch0": 0
|
|
470
220
|
}]
|
|
471
221
|
}; }
|
|
472
222
|
};
|
|
@@ -199,10 +199,10 @@ const DBTextarea = class {
|
|
|
199
199
|
}
|
|
200
200
|
render() {
|
|
201
201
|
var _a, _b, _c, _d, _e, _f;
|
|
202
|
-
return (h("div", { key: '
|
|
202
|
+
return (h("div", { key: 'e6c64857826bf80558d0b402594a66418e62ef57', class: cls("db-textarea", this.className), "data-variant": this.variant, "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-hide-label": getHideProp(this.showLabel) }, h("label", { key: '38f6ce12d40275dd6fa5cfa64c6d2ca4c17fab8f', htmlFor: this._id }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL), h("textarea", { key: '6d11324a4cfce9eeed9e1bcafe0a7edb1ee6c8ce', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, "data-field-sizing": this.fieldSizing, ref: (el) => {
|
|
203
203
|
this._ref = el;
|
|
204
204
|
}, id: this._id, "data-resize": this.resize, "data-hide-resizer": getHideProp((_b = this.showResizer) !== null && _b !== void 0 ? _b : true), disabled: getBoolean(this.disabled, "disabled"), required: getBoolean(this.required, "required"), readOnly: getBoolean(this.readOnly, "readOnly") ||
|
|
205
|
-
getBoolean(this.readonly, "readonly"), form: this.form, maxLength: getNumber(this.maxLength, this.maxlength), minLength: getNumber(this.minLength, this.minlength), name: this.name, wrap: this.wrap, spellcheck: this.spellCheck, autocomplete: this.autocomplete, onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), value: (_d = (_c = this.value) !== null && _c !== void 0 ? _c : this._value) !== null && _d !== void 0 ? _d : "", "aria-describedby": (_e = this.ariaDescribedBy) !== null && _e !== void 0 ? _e : this._descByIds, placeholder: (_f = this.placeholder) !== null && _f !== void 0 ? _f : DEFAULT_PLACEHOLDER, rows: getNumber(this.rows, DEFAULT_ROWS), cols: getNumber(this.cols) }), stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '
|
|
205
|
+
getBoolean(this.readonly, "readonly"), form: this.form, maxLength: getNumber(this.maxLength, this.maxlength), minLength: getNumber(this.minLength, this.minlength), name: this.name, wrap: this.wrap, spellcheck: this.spellCheck, autocomplete: this.autocomplete, onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), value: (_d = (_c = this.value) !== null && _c !== void 0 ? _c : this._value) !== null && _d !== void 0 ? _d : "", "aria-describedby": (_e = this.ariaDescribedBy) !== null && _e !== void 0 ? _e : this._descByIds, placeholder: (_f = this.placeholder) !== null && _f !== void 0 ? _f : DEFAULT_PLACEHOLDER, rows: getNumber(this.rows, DEFAULT_ROWS), cols: getNumber(this.cols) }), stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '16d43aeea87f6e3597c95847c037faa194875b94', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '8b407f9a60c61ac4af26d6ec5a9571d5f37ae915', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
206
206
|
}
|
|
207
207
|
static get watchers() { return {
|
|
208
208
|
"id": [{
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { r as registerInstance, h } from './index-K4o-AcjZ.js';
|
|
2
|
-
import {
|
|
2
|
+
import { D as DEFAULT_ID } from './constants-BdL-nI5y.js';
|
|
3
|
+
import { d as delay, u as uuid, g as getBooleanAsString, c as cls } from './index-xkoBSP8R.js';
|
|
3
4
|
import { D as DocumentScrollListener } from './document-scroll-listener-DOBe3Oa9.js';
|
|
4
5
|
import { b as handleFixedPopover } from './floating-components-DOPXnIzL.js';
|
|
5
6
|
|
|
6
7
|
const DBTooltip = class {
|
|
7
8
|
constructor(hostRef) {
|
|
8
9
|
registerInstance(this, hostRef);
|
|
9
|
-
this._id =
|
|
10
|
+
this._id = DEFAULT_ID;
|
|
10
11
|
this.initialized = false;
|
|
11
12
|
this._documentScrollListenerCallbackId = undefined;
|
|
12
13
|
this._observer = undefined;
|
|
@@ -155,9 +156,9 @@ const DBTooltip = class {
|
|
|
155
156
|
}
|
|
156
157
|
render() {
|
|
157
158
|
var _a, _b;
|
|
158
|
-
return (h("i", { key: '
|
|
159
|
+
return (h("i", { key: 'df7b27f485e4029f51329dd73e50603f6965efb8', class: cls("db-tooltip", this.className), role: "tooltip", "aria-hidden": "true", "data-gap": "true", ref: (el) => {
|
|
159
160
|
this._ref = el;
|
|
160
|
-
}, id: this._id, "data-emphasis": this.emphasis, "data-wrap": getBooleanAsString(this.wrap), "data-animation": getBooleanAsString((_a = this.animation) !== null && _a !== void 0 ? _a : true), "data-delay": this.delay, "data-width": this.width, "data-show-arrow": getBooleanAsString((_b = this.showArrow) !== null && _b !== void 0 ? _b : true), "data-placement": this.placement, onClick: (event) => this.handleClick(event) }, h("slot", { key: '
|
|
161
|
+
}, id: this._id, "data-emphasis": this.emphasis, "data-wrap": getBooleanAsString(this.wrap), "data-animation": getBooleanAsString((_a = this.animation) !== null && _a !== void 0 ? _a : true), "data-delay": this.delay, "data-width": this.width, "data-show-arrow": getBooleanAsString((_b = this.showArrow) !== null && _b !== void 0 ? _b : true), "data-placement": this.placement, onClick: (event) => this.handleClick(event) }, h("slot", { key: '7c1aee92a530f8b0899231f55122f6109c72bc46' })));
|
|
161
162
|
}
|
|
162
163
|
static get watchers() { return {
|
|
163
164
|
"id": [{
|