@cal.macconnachie/web-components 1.2.0 → 1.2.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.
Files changed (2) hide show
  1. package/dist/index.js +14 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5845,13 +5845,15 @@ let Z = class extends U {
5845
5845
  queryAndRegisterTabs() {
5846
5846
  const e = this.querySelectorAll("base-tab"), t = [];
5847
5847
  e.forEach((r) => {
5848
- const o = {
5848
+ if (r.parentElement?.closest("base-tabs") !== this)
5849
+ return;
5850
+ const i = {
5849
5851
  id: r.id,
5850
5852
  label: r.getAttribute("label") || "",
5851
5853
  badge: r.hasAttribute("badge") ? Number(r.getAttribute("badge")) : void 0,
5852
5854
  icon: r.getAttribute("icon") || void 0
5853
5855
  };
5854
- o.id && !this.tabs.find((i) => i.id === o.id) && t.push(o);
5856
+ i.id && !this.tabs.find((s) => s.id === i.id) && t.push(i);
5855
5857
  }), t.length > 0 && (this.tabs = [...this.tabs, ...t]);
5856
5858
  }
5857
5859
  willUpdate(e) {
@@ -5868,20 +5870,24 @@ let Z = class extends U {
5868
5870
  super.updated(e), e.has("activeTab") && this.updateChildTabs();
5869
5871
  }
5870
5872
  handleTabRegister(e) {
5873
+ if (e.target.parentElement?.closest("base-tabs") !== this)
5874
+ return;
5871
5875
  e.stopPropagation();
5872
- const t = e.detail;
5873
- this.tabs.find((r) => r.id === t.id) || (this.tabs = [...this.tabs, t]);
5876
+ const o = e.detail;
5877
+ this.tabs.find((i) => i.id === o.id) || (this.tabs = [...this.tabs, o]);
5874
5878
  }
5875
5879
  handleTabBadgeUpdate(e) {
5880
+ if (e.target.parentElement?.closest("base-tabs") !== this)
5881
+ return;
5876
5882
  e.stopPropagation();
5877
- const { id: t, badge: r } = e.detail, o = this.tabs.findIndex((i) => i.id === t);
5878
- o !== -1 && (this.tabs = this.tabs.map(
5879
- (i, s) => s === o ? { ...i, badge: r } : i
5883
+ const { id: o, badge: i } = e.detail, s = this.tabs.findIndex((a) => a.id === o);
5884
+ s !== -1 && (this.tabs = this.tabs.map(
5885
+ (a, n) => n === s ? { ...a, badge: i } : a
5880
5886
  ));
5881
5887
  }
5882
5888
  updateChildTabs() {
5883
5889
  this.querySelectorAll("base-tab").forEach((t) => {
5884
- t.active = t.id === this.activeTab;
5890
+ t.parentElement?.closest("base-tabs") === this && (t.active = t.id === this.activeTab);
5885
5891
  });
5886
5892
  }
5887
5893
  handleHashChange() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cal.macconnachie/web-components",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Web components hosted on a CDN",
5
5
  "keywords": [
6
6
  "web-components",