@oicl/openbridge-webcomponents 2.0.0-next.84 → 2.0.0-next.85

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.
@@ -104492,11 +104492,18 @@ const compentStyle$n = i$7`* {
104492
104492
  color: var(--on-flat-disabled-color);
104493
104493
  }
104494
104494
 
104495
+ .wrapper .badges {
104496
+ display: flex;
104497
+ align-items: center;
104498
+ gap: 4px;
104499
+ position: relative;
104500
+ }
104501
+
104495
104502
  .wrapper .badge {
104496
104503
  position: relative;
104497
104504
  }
104498
104505
 
104499
- .wrapper:not(.hug) .badge {
104506
+ .wrapper:not(.hug) .badges {
104500
104507
  right: 0;
104501
104508
  }
104502
104509
 
@@ -104623,6 +104630,7 @@ let ObcTabItem = class extends i$4 {
104623
104630
  this.hasLeadingIcon = false;
104624
104631
  this.hasTitle = false;
104625
104632
  this.hasDivider = false;
104633
+ this.badges = [];
104626
104634
  this.hasBadge = false;
104627
104635
  this.icon = "placeholder";
104628
104636
  this.title = "Tab title";
@@ -104662,7 +104670,40 @@ let ObcTabItem = class extends i$4 {
104662
104670
  this.handleClick(event);
104663
104671
  }
104664
104672
  }
104673
+ get effectiveBadges() {
104674
+ if (this.badges.length > 0) {
104675
+ return this.badges;
104676
+ }
104677
+ if (!this.hasBadge) {
104678
+ return [];
104679
+ }
104680
+ return [
104681
+ {
104682
+ type: this.badgeType || BadgeType.regular,
104683
+ size: this.badgeSize || BadgeSize.regular,
104684
+ count: this.badgeShowNumber ? this.badgeCount : void 0,
104685
+ showIcon: this.showLeadingBadgeIcon,
104686
+ iconSlotName: this.showLeadingBadgeIcon ? "badge-icon" : void 0
104687
+ }
104688
+ ];
104689
+ }
104690
+ renderBadge(badge) {
104691
+ return b`
104692
+ <obc-badge
104693
+ class="badge"
104694
+ .number=${badge.count ?? 0}
104695
+ .type=${badge.type || BadgeType.regular}
104696
+ .size=${badge.size || BadgeSize.regular}
104697
+ .showNumber=${badge.count !== void 0}
104698
+ .showIcon=${badge.showIcon ?? false}
104699
+ >
104700
+ ${badge.iconSlotName ? b`<slot name=${badge.iconSlotName} slot="badge-icon"></slot>` : A}
104701
+ </obc-badge>
104702
+ `;
104703
+ }
104665
104704
  render() {
104705
+ const badges = this.effectiveBadges;
104706
+ const hasBadge = badges.length > 0;
104666
104707
  const wrapperClasses = {
104667
104708
  wrapper: true,
104668
104709
  hug: this.hug,
@@ -104670,7 +104711,7 @@ let ObcTabItem = class extends i$4 {
104670
104711
  "has-leading-icon": this.hasLeadingIcon,
104671
104712
  "has-title": this.hasTitle,
104672
104713
  "has-divider": this.hasDivider && !this.checked,
104673
- "has-badge": this.hasBadge,
104714
+ "has-badge": hasBadge,
104674
104715
  "has-subtitle": this.showSubtitle,
104675
104716
  disabled: this.disabled,
104676
104717
  "center-content": this.centerContent
@@ -104697,31 +104738,13 @@ let ObcTabItem = class extends i$4 {
104697
104738
  ${this.showSubtitle && this.subtitle ? b`<div class="subtitle">${this.subtitle}</div>` : A}
104698
104739
  </div>
104699
104740
  ` : A}
104700
- ${this.centerContent && this.hasBadge ? b`
104701
- <obc-badge
104702
- class="badge"
104703
- .number=${this.badgeCount}
104704
- .type=${this.badgeType || BadgeType.regular}
104705
- .size=${this.badgeSize || BadgeSize.regular}
104706
- .showNumber=${this.badgeShowNumber}
104707
- .showIcon=${this.showLeadingBadgeIcon}
104708
- >
104709
- ${this.showLeadingBadgeIcon ? b`<slot name="badge-icon" slot="badge-icon"></slot>` : A}
104710
- </obc-badge>
104711
- ` : A}
104741
+ ${this.centerContent && hasBadge ? b`<div class="badges">
104742
+ ${badges.map((badge) => this.renderBadge(badge))}
104743
+ </div>` : A}
104712
104744
  </div>
104713
- ${!this.centerContent && this.hasBadge ? b`
104714
- <obc-badge
104715
- class="badge"
104716
- .number=${this.badgeCount}
104717
- .type=${this.badgeType || BadgeType.regular}
104718
- .size=${this.badgeSize || BadgeSize.regular}
104719
- .showNumber=${this.badgeShowNumber}
104720
- .showIcon=${this.showLeadingBadgeIcon}
104721
- >
104722
- ${this.showLeadingBadgeIcon ? b`<slot name="badge-icon" slot="badge-icon"></slot>` : A}
104723
- </obc-badge>
104724
- ` : A}
104745
+ ${!this.centerContent && hasBadge ? b`<div class="badges">
104746
+ ${badges.map((badge) => this.renderBadge(badge))}
104747
+ </div>` : A}
104725
104748
  ${this.hasClose ? b`
104726
104749
  <obc-icon-button
104727
104750
  class="close-button"
@@ -104758,6 +104781,9 @@ __decorateClass$t1([
104758
104781
  __decorateClass$t1([
104759
104782
  n$3({ type: Boolean, attribute: "has-divider" })
104760
104783
  ], ObcTabItem.prototype, "hasDivider", 2);
104784
+ __decorateClass$t1([
104785
+ n$3({ type: Array, attribute: false })
104786
+ ], ObcTabItem.prototype, "badges", 2);
104761
104787
  __decorateClass$t1([
104762
104788
  n$3({ type: Boolean, attribute: "has-badge" })
104763
104789
  ], ObcTabItem.prototype, "hasBadge", 2);
@@ -104843,6 +104869,7 @@ let ObcTabRow = class extends i$4 {
104843
104869
  this.tabs = [];
104844
104870
  this.selectedTabId = "";
104845
104871
  this.hasClose = false;
104872
+ this.centerContent = false;
104846
104873
  this.hug = false;
104847
104874
  this.showSubtitle = false;
104848
104875
  this.hasAddNewTab = false;
@@ -104887,8 +104914,17 @@ let ObcTabRow = class extends i$4 {
104887
104914
  }
104888
104915
  renderTab(tab, index2) {
104889
104916
  const isFirst = index2 === 0;
104917
+ const previousTabSelected = this.selectedTabId === this.tabs[index2 - 1]?.id;
104890
104918
  const isChecked = tab.id === this.selectedTabId;
104891
104919
  const showSubtitle = tab.showSubtitle ?? this.showSubtitle;
104920
+ const badgeIconSlots = [
104921
+ ...new Set(
104922
+ (tab.badges ?? []).map((badge) => badge.iconSlotName).filter((slotName) => slotName !== void 0)
104923
+ )
104924
+ ];
104925
+ if ((tab.showLeadingBadgeIcon ?? false) && !badgeIconSlots.includes("badge-icon")) {
104926
+ badgeIconSlots.push("badge-icon");
104927
+ }
104892
104928
  return b`
104893
104929
  <obc-tab-item
104894
104930
  .title=${tab.title}
@@ -104898,10 +104934,12 @@ let ObcTabRow = class extends i$4 {
104898
104934
  .hasClose=${this.hasClose}
104899
104935
  .hasLeadingIcon=${tab.hasLeadingIcon ?? true}
104900
104936
  .hasTitle=${true}
104901
- .hasDivider=${!isFirst}
104937
+ .hasDivider=${!isFirst && !previousTabSelected}
104902
104938
  .hug=${this.hug}
104939
+ .centerContent=${this.centerContent}
104903
104940
  .disabled=${tab.disabled || false}
104904
- .hasBadge=${tab.hasBadge || tab.badgeCount !== void 0 && tab.badgeCount > 0}
104941
+ .badges=${tab.badges ?? []}
104942
+ .hasBadge=${tab.hasBadge || false}
104905
104943
  .badgeCount=${tab.badgeCount || 0}
104906
104944
  .badgeType=${tab.badgeType ?? BadgeType.regular}
104907
104945
  .badgeSize=${tab.badgeSize ?? BadgeSize.regular}
@@ -104916,11 +104954,13 @@ let ObcTabRow = class extends i$4 {
104916
104954
  </slot>
104917
104955
  ` : ""}
104918
104956
  <span slot="title">${tab.title}</span>
104919
- ${tab.showLeadingBadgeIcon ? b`
104920
- <slot name="tab-${tab.id}-badge-icon" slot="badge-icon">
104921
- <obi-placeholder></obi-placeholder>
104922
- </slot>
104923
- ` : ""}
104957
+ ${badgeIconSlots.map(
104958
+ (slotName) => b`
104959
+ <slot name="tab-${tab.id}-${slotName}" slot=${slotName}>
104960
+ <obi-placeholder></obi-placeholder>
104961
+ </slot>
104962
+ `
104963
+ )}
104924
104964
  </obc-tab-item>
104925
104965
  `;
104926
104966
  }
@@ -104956,6 +104996,9 @@ __decorateClass$t0([
104956
104996
  __decorateClass$t0([
104957
104997
  n$3({ type: Boolean, attribute: "has-close" })
104958
104998
  ], ObcTabRow.prototype, "hasClose", 2);
104999
+ __decorateClass$t0([
105000
+ n$3({ type: Boolean })
105001
+ ], ObcTabRow.prototype, "centerContent", 2);
104959
105002
  __decorateClass$t0([
104960
105003
  n$3({ type: Boolean })
104961
105004
  ], ObcTabRow.prototype, "hug", 2);