Adds cancelLabel option to the Confirm Modal

Also localized the fallback labels for "Cancel" and "Confirm".
This commit is contained in:
leekelleher
2024-05-07 18:04:28 +01:00
parent 3d307e0fa0
commit 0ae05ccf7b
2 changed files with 8 additions and 3 deletions

View File

@@ -24,13 +24,17 @@ export class UmbConfirmModalElement extends UmbLitElement {
<uui-dialog-layout class="uui-text" .headline=${this.data?.headline || null}>
${this.data?.content}
<uui-button slot="actions" id="cancel" label="Cancel" @click="${this._handleCancel}"></uui-button>
<uui-button
slot="actions"
id="cancel"
label=${this.data?.cancelLabel || this.localize.term('buttons_confirmActionCancel')}
@click=${this._handleCancel}></uui-button>
<uui-button
slot="actions"
id="confirm"
color="${this.data?.color || 'positive'}"
color=${this.data?.color || 'positive'}
look="primary"
label="${this.data?.confirmLabel || 'Confirm'}"
label=${this.data?.confirmLabel || this.localize.term('buttons_confirmActionConfirm')}
@click=${this._handleConfirm}
${umbFocus()}></uui-button>
</uui-dialog-layout>

View File

@@ -5,6 +5,7 @@ export interface UmbConfirmModalData {
headline: string;
content: TemplateResult | string;
color?: 'positive' | 'danger';
cancelLabel?: string;
confirmLabel?: string;
}