@haiilo/catalyst 12.0.0 → 12.2.0
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/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/{p-6a54965a.entry.js → p-e65bb6a0.entry.js} +2 -2
- package/dist/catalyst/p-e65bb6a0.entry.js.map +1 -0
- package/dist/cjs/cat-alert_30.cjs.entry.js +18 -12
- package/dist/cjs/cat-alert_30.cjs.entry.js.map +1 -1
- package/dist/collection/components/cat-tabs/cat-tabs.js +20 -14
- package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
- package/dist/components/cat-tabs.js +18 -12
- package/dist/components/cat-tabs.js.map +1 -1
- package/dist/esm/cat-alert_30.entry.js +18 -12
- package/dist/esm/cat-alert_30.entry.js.map +1 -1
- package/dist/types/components/cat-tabs/cat-tabs.d.ts +1 -0
- package/dist/types/components.d.ts +2 -2
- package/package.json +2 -2
- package/dist/catalyst/p-6a54965a.entry.js.map +0 -1
|
@@ -11286,7 +11286,7 @@ const CatTabs = class {
|
|
|
11286
11286
|
}
|
|
11287
11287
|
onActiveTabChange(id) {
|
|
11288
11288
|
const index = this.tabs.findIndex(tab => tab.id === id);
|
|
11289
|
-
this.catChange.emit({ id, index });
|
|
11289
|
+
this.catChange.emit({ id, index, fromDropdown: !!this.hiddenTabs.find(tab => tab.id === id) });
|
|
11290
11290
|
}
|
|
11291
11291
|
onKeydown(event) {
|
|
11292
11292
|
if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key)) {
|
|
@@ -11326,7 +11326,7 @@ const CatTabs = class {
|
|
|
11326
11326
|
}
|
|
11327
11327
|
render() {
|
|
11328
11328
|
this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
|
|
11329
|
-
return (index.h(index.Host, { key: '
|
|
11329
|
+
return (index.h(index.Host, { key: '7465fe19c1c67bd0f2c83ae15ed4d31e1e7610b7' }, index.h("div", { key: '3d0f4c19edd3549d3c9c8f83685b0c852770f594', role: "tablist", class: "cat-tab-list" }, this.tabs.map((tab, index$1) => {
|
|
11330
11330
|
return (index.h("cat-button", { buttonId: tab.id, part: "tab", class: {
|
|
11331
11331
|
'cat-tab': true,
|
|
11332
11332
|
'cat-tab-active': tab.id === this.activeTab,
|
|
@@ -11365,17 +11365,18 @@ const CatTabs = class {
|
|
|
11365
11365
|
if (this.moreButton) {
|
|
11366
11366
|
this.moreButton.style.display = 'inline-flex';
|
|
11367
11367
|
}
|
|
11368
|
-
const MORE_WIDTH = this.moreButton?.
|
|
11368
|
+
const MORE_WIDTH = this.moreButton?.getBoundingClientRect().width || 0;
|
|
11369
11369
|
const visibleTabsIndexes = [];
|
|
11370
|
+
const containerWidth = this.hostElement.clientWidth;
|
|
11370
11371
|
let fittingWidth = 0;
|
|
11371
11372
|
const stickyTabIndex = this.tabs.findIndex(tab => tab.sticky);
|
|
11372
|
-
const stickyTabWidth = tabs.item(stickyTabIndex)?.
|
|
11373
|
-
const stickyTabIsVisible = stickyTabIndex > -1 && stickyTabWidth <=
|
|
11373
|
+
const stickyTabWidth = tabs.item(stickyTabIndex)?.getBoundingClientRect().width || 0;
|
|
11374
|
+
const stickyTabIsVisible = stickyTabIndex > -1 && stickyTabWidth + MORE_WIDTH <= containerWidth;
|
|
11374
11375
|
const activeTabIndex = this.tabs.findIndex(tab => tab.id === this.activeTab);
|
|
11375
|
-
const activeTabWidth = tabs.item(activeTabIndex)?.
|
|
11376
|
+
const activeTabWidth = tabs.item(activeTabIndex)?.getBoundingClientRect().width || 0;
|
|
11376
11377
|
const activeTabIsVisible = this.activeTabAlwaysVisible &&
|
|
11377
11378
|
activeTabIndex > -1 &&
|
|
11378
|
-
activeTabWidth + stickyTabWidth <=
|
|
11379
|
+
activeTabWidth + stickyTabWidth + MORE_WIDTH <= containerWidth;
|
|
11379
11380
|
if (stickyTabIsVisible) {
|
|
11380
11381
|
fittingWidth += stickyTabWidth;
|
|
11381
11382
|
visibleTabsIndexes.push(stickyTabIndex.toString());
|
|
@@ -11388,12 +11389,13 @@ const CatTabs = class {
|
|
|
11388
11389
|
if ((activeTabIsVisible && index === activeTabIndex) || (stickyTabIsVisible && index === stickyTabIndex)) {
|
|
11389
11390
|
continue;
|
|
11390
11391
|
}
|
|
11391
|
-
|
|
11392
|
+
const tabWidth = tab.getBoundingClientRect().width;
|
|
11393
|
+
if (fittingWidth + tabWidth <= containerWidth) {
|
|
11392
11394
|
// tab fits within tabs parent
|
|
11393
|
-
fittingWidth +=
|
|
11395
|
+
fittingWidth += tabWidth;
|
|
11394
11396
|
visibleTabsIndexes.push(index.toString());
|
|
11395
11397
|
}
|
|
11396
|
-
else if (fittingWidth + MORE_WIDTH <=
|
|
11398
|
+
else if (fittingWidth + MORE_WIDTH <= containerWidth) {
|
|
11397
11399
|
// tab doesn't fit, but more button does
|
|
11398
11400
|
break;
|
|
11399
11401
|
}
|
|
@@ -11422,7 +11424,9 @@ const CatTabs = class {
|
|
|
11422
11424
|
syncTabs() {
|
|
11423
11425
|
this.tabs = Array.from(this.hostElement.querySelectorAll('cat-tab'));
|
|
11424
11426
|
this.activeTab = this.activeTab || this.tabs.filter(tab => this.canActivate(tab) && !tab.noActive)[0]?.id;
|
|
11425
|
-
this.
|
|
11427
|
+
if (this.adaptive) {
|
|
11428
|
+
this.adjustAdaptiveTabs();
|
|
11429
|
+
}
|
|
11426
11430
|
}
|
|
11427
11431
|
click(tab) {
|
|
11428
11432
|
if (this.canActivate(tab)) {
|
|
@@ -11439,7 +11443,9 @@ const CatTabs = class {
|
|
|
11439
11443
|
else if (this.canActivate(tab)) {
|
|
11440
11444
|
this.activeTab = tab.id;
|
|
11441
11445
|
}
|
|
11442
|
-
this.
|
|
11446
|
+
if (this.adaptive) {
|
|
11447
|
+
this.adjustAdaptiveTabs();
|
|
11448
|
+
}
|
|
11443
11449
|
}
|
|
11444
11450
|
canActivate(tab) {
|
|
11445
11451
|
return !tab.deactivated && !tab.url && tab.id !== this.activeTab;
|