From ce8c31817facb2dbbfcc0214d3e7553b3d8caf1c Mon Sep 17 00:00:00 2001 From: Davide Mininni <101575400+DavideMininni-Fincons@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:42:10 +0100 Subject: [PATCH] fix(sbb-mini-button): remove useless base class (#3257) BREAKING CHANGE: the `SbbMiniButtonBaseElement` is used only in the `sbb-mini-button-component`, so it can be safely removed to avoid redundant code. --- src/elements/button/mini-button.ts | 1 - .../mini-button/mini-button-base-element.ts | 16 ---------------- src/elements/button/mini-button/mini-button.ts | 17 +++++++++++++---- 3 files changed, 13 insertions(+), 21 deletions(-) delete mode 100644 src/elements/button/mini-button/mini-button-base-element.ts diff --git a/src/elements/button/mini-button.ts b/src/elements/button/mini-button.ts index 379817a955..65b7e88ef6 100644 --- a/src/elements/button/mini-button.ts +++ b/src/elements/button/mini-button.ts @@ -1,2 +1 @@ -export * from './mini-button/mini-button-base-element.js'; export * from './mini-button/mini-button.js'; diff --git a/src/elements/button/mini-button/mini-button-base-element.ts b/src/elements/button/mini-button/mini-button-base-element.ts deleted file mode 100644 index 31a57fda41..0000000000 --- a/src/elements/button/mini-button/mini-button-base-element.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { TemplateResult } from 'lit'; - -import { SbbButtonBaseElement } from '../../core/base-elements.js'; -import { slotState } from '../../core/decorators.js'; -import { SbbNegativeMixin } from '../../core/mixins.js'; -import { SbbIconNameMixin } from '../../icon.js'; - -export -@slotState() -abstract class SbbMiniButtonBaseElement extends SbbNegativeMixin( - SbbIconNameMixin(SbbButtonBaseElement), -) { - protected override renderTemplate(): TemplateResult { - return super.renderIconSlot(); - } -} diff --git a/src/elements/button/mini-button/mini-button.ts b/src/elements/button/mini-button/mini-button.ts index c4ce6c4f71..04c07518a3 100644 --- a/src/elements/button/mini-button/mini-button.ts +++ b/src/elements/button/mini-button/mini-button.ts @@ -1,9 +1,11 @@ -import type { CSSResultGroup } from 'lit'; +import type { CSSResultGroup, TemplateResult } from 'lit'; import { customElement } from 'lit/decorators.js'; -import { SbbDisabledTabIndexActionMixin } from '../../core/mixins.js'; +import { SbbButtonBaseElement } from '../../core/base-elements.js'; +import { slotState } from '../../core/decorators.js'; +import { SbbDisabledTabIndexActionMixin, SbbNegativeMixin } from '../../core/mixins.js'; +import { SbbIconNameMixin } from '../../icon.js'; -import { SbbMiniButtonBaseElement } from './mini-button-base-element.js'; import style from './mini-button.scss?lit&inline'; /** @@ -14,8 +16,15 @@ import style from './mini-button.scss?lit&inline'; */ export @customElement('sbb-mini-button') -class SbbMiniButtonElement extends SbbDisabledTabIndexActionMixin(SbbMiniButtonBaseElement) { +@slotState() +class SbbMiniButtonElement extends SbbDisabledTabIndexActionMixin( + SbbNegativeMixin(SbbIconNameMixin(SbbButtonBaseElement)), +) { public static override styles: CSSResultGroup = style; + + protected override renderTemplate(): TemplateResult { + return super.renderIconSlot(); + } } declare global {