Skip to content

Commit ae3d64f

Browse files
authored
fix(toast): remove boolean toast attribute (#1761)
* fix(alert): removed deprecated toast property * chore(alert): add changeset * chore(alert): update changeset
1 parent 7c7182c commit ae3d64f

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

.changeset/odd-bugs-repair.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
"@rhds/elements": minor
3+
---
4+
5+
`<rh-alert>`: removed deprecated toast boolean attribute
6+
7+
Before:
8+
```html
9+
<rh-alert toast>
10+
<h3 slot="header">Default</h3>
11+
<p>
12+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eleifend
13+
elit sed est egestas, a sollicitudin mauris tincidunt.
14+
</p>
15+
</rh-alert>
16+
```
17+
18+
After:
19+
```html
20+
<rh-alert variant="toast">
21+
<h3 slot="header">Default</h3>
22+
<p>
23+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eleifend
24+
elit sed est egestas, a sollicitudin mauris tincidunt.
25+
</p>
26+
</rh-alert>
27+
```

elements/rh-alert/rh-alert.ts

-14
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ export class RhAlert extends LitElement {
8585
*/
8686
@property({ reflect: true }) variant?: 'alternate' | 'toast' | 'inline';
8787

88-
/** @deprecated */
89-
@property({ reflect: true, type: Boolean }) toast = false;
90-
9188
/**
9289
* Alert variants have different rules regarding their ability to be dismissed by a user.
9390
* Default, Info, and Success Inline alerts can be dismissed by a user selecting the close button.
@@ -105,17 +102,6 @@ export class RhAlert extends LitElement {
105102
}
106103
}
107104

108-
willUpdate(changed: PropertyValues<this>) {
109-
// toast as a boolean attr is deprecated, so this replicates the previous behaviour
110-
if (changed.has('toast') && this.toast) {
111-
this.variant = 'toast';
112-
}
113-
// variant as a boolean attr is deprecated, so this replicates the previous behaviour
114-
if (changed.has('variant') && (this.variant as unknown as boolean) === false) {
115-
this.variant = undefined;
116-
}
117-
}
118-
119105
render() {
120106
const hasActions = this.#slots.hasSlotted('actions');
121107
const hasBody = this.#slots.hasSlotted(SlotController.anonymous as unknown as string);

0 commit comments

Comments
 (0)