diff --git a/packages/dialog/src/Dialog.ts b/packages/dialog/src/Dialog.ts index 51c311fcc7..cbaf6d32ea 100644 --- a/packages/dialog/src/Dialog.ts +++ b/packages/dialog/src/Dialog.ts @@ -19,6 +19,7 @@ import { query, } from '@spectrum-web-components/base'; +import '@spectrum-web-components/rule/sp-rule.js'; import '@spectrum-web-components/button/sp-action-button.js'; import alertMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-alert-medium.css.js'; import crossLargeStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross-large.css.js'; @@ -36,10 +37,10 @@ import styles from './dialog.css.js'; * * @fires close - Announces that the dialog has been closed. */ -export class Dialog extends ObserveSlotPresence( - SpectrumElement, - '[slot="footer"]' -) { +export class Dialog extends ObserveSlotPresence(SpectrumElement, [ + '[slot="footer"]', + '[slot="button"]', +]) { public static get styles(): CSSResultArray { return [styles, alertMediumStyles, crossLargeStyles]; } @@ -51,18 +52,19 @@ export class Dialog extends ObserveSlotPresence( public error = false; @property({ type: Boolean, reflect: true }) - public dismissible = false; + public dismissable = false; protected get hasFooter(): boolean { - return this.slotContentIsPresent; + return this.getSlotContentPresence('[slot="footer"]'); + } + + protected get hasButtons(): boolean { + return this.getSlotContentPresence('[slot="button"]'); } @property({ type: Boolean, reflect: true, attribute: 'no-divider' }) public noDivider = false; - @property({ type: Boolean, reflect: true }) - public open = false; - @property({ type: String, reflect: true }) public mode?: 'fullscreen' | 'fullscreenTakeover'; @@ -92,7 +94,6 @@ export class Dialog extends ObserveSlotPresence( } public close(): void { - this.open = false; this.dispatchEvent( new Event('close', { bubbles: true, @@ -102,17 +103,17 @@ export class Dialog extends ObserveSlotPresence( protected render(): TemplateResult { return html` - -
- +
+ + ${this.error ? html` - + ${AlertMediumIcon({ hidden: true })} ` : html``} - ${this.dismissible + ${this.dismissable ? html` ` : html``} - ${this.mode + ${this.noDivider + ? html`` + : html` + + `} +
+ +
+ ${this.hasFooter ? html` - + + ` + : html``} + ${this.hasButtons + ? html` + + + ` : html``}
-
- -
- ${!this.mode || this.hasFooter - ? html` - - ` - : html``} `; } diff --git a/packages/dialog/src/DialogWrapper.ts b/packages/dialog/src/DialogWrapper.ts index 69f7e97206..718dbac1b0 100644 --- a/packages/dialog/src/DialogWrapper.ts +++ b/packages/dialog/src/DialogWrapper.ts @@ -24,7 +24,7 @@ import '@spectrum-web-components/underlay/sp-underlay.js'; import '@spectrum-web-components/button/sp-button.js'; import '../sp-dialog.js'; -import styles from './dialog-wrapper.css.js'; +import styles from '@spectrum-web-components/modal/src/modal.css.js'; import { Dialog } from './Dialog.js'; /** @@ -50,7 +50,7 @@ export class DialogWrapper extends SpectrumElement { public confirmLabel = ''; @property({ type: Boolean, reflect: true }) - public dismissible = false; + public dismissable = false; @property() public footer = ''; @@ -159,69 +159,76 @@ export class DialogWrapper extends SpectrumElement { > ` : html``} - - ${this.hero - ? html` - ${ifDefined( - ` - : html``} - ${this.headline - ? html` -

${this.headline}

- ` - : html``} - -
${this.footer}
- ${this.secondaryLabel - ? html` - - ${this.secondaryLabel} - - ` - : html``} - ${this.cancelLabel - ? html` - - ${this.cancelLabel} - - ` - : html``} - ${this.confirmLabel - ? html` - - ${this.confirmLabel} - - ` - : html``} -
+ `; } }