mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 12:09:26 +00:00
remove slot detection from alert
This commit is contained in:
@@ -9,6 +9,15 @@ layout: ../../../layouts/ComponentLayout.astro
|
||||
<wa-icon slot="icon" name="circle-info" variant="regular"></wa-icon>
|
||||
This is a standard alert. You can customize its content and even the icon.
|
||||
</wa-alert>
|
||||
|
||||
<wa-alert open>
|
||||
<wa-icon slot="icon" name="circle-info" variant="regular"></wa-icon>
|
||||
<div style="border: solid 2px tomato; height: 2rem;"></div>
|
||||
</wa-alert>
|
||||
|
||||
<wa-alert open>
|
||||
<div style="border: solid 2px tomato; height: 2rem;"></div>
|
||||
</wa-alert>
|
||||
```
|
||||
|
||||
```jsx:react
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { animateTo, stopAnimations } from '../../internal/animate.js';
|
||||
import { classMap } from 'lit/directives/class-map.js';
|
||||
import { getAnimation, setDefaultAnimation } from '../../utilities/animation-registry.js';
|
||||
import { HasSlotController } from '../../internal/slot.js';
|
||||
import { html } from 'lit';
|
||||
import { LocalizeController } from '../../utilities/localize.js';
|
||||
import { property, query } from 'lit/decorators.js';
|
||||
@@ -55,7 +54,6 @@ export default class WaAlert extends WebAwesomeElement {
|
||||
static dependencies = { 'wa-icon-button': WaIconButton };
|
||||
|
||||
private autoHideTimeout: number;
|
||||
private readonly hasSlotController = new HasSlotController(this, 'icon', 'suffix');
|
||||
private readonly localize = new LocalizeController(this);
|
||||
|
||||
@query('[part~="base"]') base: HTMLElement;
|
||||
@@ -198,7 +196,6 @@ export default class WaAlert extends WebAwesomeElement {
|
||||
alert: true,
|
||||
'alert--open': this.open,
|
||||
'alert--closable': this.closable,
|
||||
'alert--has-icon': this.hasSlotController.test('icon'),
|
||||
'alert--brand': this.variant === 'brand',
|
||||
'alert--success': this.variant === 'success',
|
||||
'alert--neutral': this.variant === 'neutral',
|
||||
|
||||
@@ -56,10 +56,10 @@ export default css`
|
||||
border-width: var(--border-width);
|
||||
color: var(--content-color);
|
||||
font: inherit;
|
||||
padding: var(--padding);
|
||||
margin: inherit;
|
||||
}
|
||||
|
||||
.alert:not(.alert--has-icon) .alert__icon,
|
||||
.alert:not(.alert--closable) .alert__close-button {
|
||||
display: none;
|
||||
}
|
||||
@@ -70,13 +70,15 @@ export default css`
|
||||
align-items: center;
|
||||
color: var(--icon-color);
|
||||
font-size: var(--icon-size);
|
||||
padding-inline-start: var(--padding);
|
||||
}
|
||||
|
||||
.alert__icon ::slotted(*) {
|
||||
margin-inline-end: var(--padding) !important;
|
||||
}
|
||||
|
||||
.alert__message {
|
||||
flex: 1 1 auto;
|
||||
display: block;
|
||||
padding: var(--padding);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -86,7 +88,7 @@ export default css`
|
||||
align-items: center;
|
||||
color: currentColor;
|
||||
font-size: var(--wa-font-size-m);
|
||||
padding-inline-end: var(--padding);
|
||||
padding-inline-start: var(--padding);
|
||||
}
|
||||
|
||||
.alert__close-button:hover::part(base) {
|
||||
|
||||
Reference in New Issue
Block a user