Add label slot to dialog and drawer

pull/261/head
Cory LaViska 2020-10-15 16:54:38 -04:00
rodzic 272c7df91b
commit 08bb1a088e
3 zmienionych plików z 11 dodań i 4 usunięć

Wyświetl plik

@ -9,6 +9,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis
## Next
- Added `label` slot to `sl-input`, `sl-select`, and `sl-textarea` [#248](https://github.com/shoelace-style/shoelace/issues/248)
- Added `label` slot to `sl-dialog` and `sl-drawer`
- Fixed a bug where initial transitions didn't show in `sl-dialog` and `sl-drawer` [#247](https://github.com/shoelace-style/shoelace/issues/247)
- Fixed a bug where indeterminate checkboxes would maintain the indeterminate state when toggled
- Fixed a bug where concurrent active modals (i.e. dialog, drawer) would try to steal focus from each other

Wyświetl plik

@ -10,6 +10,7 @@ let id = 0;
* @status stable
*
* @slot - The dialog's content.
* @slot label - The dialog's label. Alternatively, you can use the label prop.
* @slot footer - The dialog's footer, usually one or more buttons representing various options.
*
* @part base - The component's base wrapper.
@ -203,8 +204,10 @@ export class Dialog {
{!this.noHeader && (
<header part="header" class="dialog__header">
<span part="title" class="dialog__title" id={`${this.componentId}-title`}>
{/* If there's no label, use an invisible character to prevent the heading from collapsing */}
{this.label || String.fromCharCode(65279)}
<slot name="label">
{/* If there's no label, use an invisible character to prevent the heading from collapsing */}
{this.label || String.fromCharCode(65279)}
</slot>
</span>
<sl-icon-button part="close-button" class="dialog__close" name="x" onClick={this.handleCloseClick} />
</header>

Wyświetl plik

@ -10,6 +10,7 @@ let id = 0;
* @status stable
*
* @slot - The drawer's content.
* @slot label - The dialog's label. Alternatively, you can use the label prop.
* @slot footer - The drawer's footer, usually one or more buttons representing various options.
*
* @part base - The component's base wrapper.
@ -220,8 +221,10 @@ export class Drawer {
{!this.noHeader && (
<header part="header" class="drawer__header">
<span part="title" class="drawer__title" id={`${this.componentId}-title`}>
{/* If there's no label, use an invisible character to prevent the heading from collapsing */}
{this.label || String.fromCharCode(65279)}
<slot name="label">
{/* If there's no label, use an invisible character to prevent the heading from collapsing */}
{this.label || String.fromCharCode(65279)}
</slot>
</span>
<sl-icon-button part="close-button" class="drawer__close" name="x" onClick={this.handleCloseClick} />
</header>