@fluid-topics/ftds-chip-group 2.2.14 → 2.2.15

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.
@@ -22,7 +22,6 @@ export declare class FtdsChipGroup extends FtdsChipGroup_base implements FtdsChi
22
22
  private handleFocusOnChipDeleted;
23
23
  private focusChip;
24
24
  private toggleExtraChips;
25
- private getFamilyIcon;
26
- private getIconVariant;
25
+ private getIconAndVariant;
27
26
  }
28
27
  export {};
@@ -80,7 +80,8 @@ export class FtdsChipGroup extends withI18n(FtdsBase) {
80
80
  `;
81
81
  }
82
82
  renderChip(chip) {
83
- var _a, _b, _c, _d, _e;
83
+ var _a, _b, _c, _d;
84
+ const { icon, iconVariant } = this.getIconAndVariant(chip);
84
85
  return html `
85
86
  <li>
86
87
  <ft-tooltip
@@ -91,11 +92,11 @@ export class FtdsChipGroup extends withI18n(FtdsBase) {
91
92
  exportparts="chip"
92
93
  ?removable=${this.removable}
93
94
  .family=${(_b = chip.family) !== null && _b !== void 0 ? _b : DesignSystemFamily.neutral}
94
- .icon=${(_c = chip.icon) !== null && _c !== void 0 ? _c : this.getFamilyIcon(chip.family)}
95
- .iconVariant=${this.getIconVariant(chip.icon, chip.iconVariant)}
96
- .removeButtonLabel=${(_d = chip.removeLabel) !== null && _d !== void 0 ? _d : chipGroupContext.messages.defaultRemoveLabel()}
95
+ .icon=${icon}
96
+ .iconVariant=${iconVariant}
97
+ .removeButtonLabel=${(_c = chip.removeLabel) !== null && _c !== void 0 ? _c : chipGroupContext.messages.defaultRemoveLabel()}
97
98
  @remove=${() => this.onChipRemoved(chip)}>
98
- ${(_e = chip.label) !== null && _e !== void 0 ? _e : chip.value}
99
+ ${(_d = chip.label) !== null && _d !== void 0 ? _d : chip.value}
99
100
  </ftds-chip>
100
101
  </ft-tooltip>
101
102
  </li>
@@ -128,19 +129,14 @@ export class FtdsChipGroup extends withI18n(FtdsBase) {
128
129
  toggleExtraChips(e) {
129
130
  this.isPopoverOpened = e.detail.opened;
130
131
  }
131
- getFamilyIcon(family) {
132
- switch (family) {
133
- case DesignSystemFamily.warning:
134
- return FtdsIcons.TRIANGLE_EXCLAMATION;
135
- default:
136
- return undefined;
132
+ getIconAndVariant(chip) {
133
+ if (chip.family === DesignSystemFamily.warning) {
134
+ return {
135
+ icon: FtdsIcons.TRIANGLE_EXCLAMATION,
136
+ iconVariant: FtdsIconVariants.solid,
137
+ };
137
138
  }
138
- }
139
- getIconVariant(icon, iconVariant) {
140
- if (icon) {
141
- return iconVariant !== null && iconVariant !== void 0 ? iconVariant : FtdsIconVariants.regular;
142
- }
143
- return FtdsIconVariants.solid;
139
+ return { icon: chip.icon, iconVariant: chip.iconVariant };
144
140
  }
145
141
  }
146
142
  FtdsChipGroup.elementDefinitions = {