monkey-style-guide 2.0.125 → 2.0.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -500,43 +500,49 @@ class MonkeyStyleGuideSnackbarService {
500
500
  buildAction(id) {
501
501
  const { config: { type, action }, } = this;
502
502
  if (action) {
503
- const { style, confirm, cancel } = action;
503
+ const { confirm, cancel } = action;
504
504
  const actionElement = document.createElement('div');
505
505
  let actionCancelElement = null, actionConfirmElement = null;
506
- if (style === 'link') {
507
- if (cancel) {
508
- actionCancelElement = document.createElement('a');
509
- actionCancelElement.href = 'javascript:void(0)';
510
- actionCancelElement.innerText = cancel.label;
511
- }
512
- if (confirm) {
506
+ if (confirm) {
507
+ const { style, label } = confirm;
508
+ if (style === 'link') {
513
509
  actionConfirmElement = document.createElement('a');
514
510
  actionConfirmElement.href = 'javascript:void(0)';
515
- actionConfirmElement.innerText = confirm.label;
511
+ actionConfirmElement.innerText = label;
512
+ }
513
+ else {
514
+ actionConfirmElement = document.createElement('button');
515
+ actionConfirmElement.className = `mecx-button-primary mecx-button-primary__${type}`;
516
+ actionConfirmElement.innerText = label;
516
517
  }
517
518
  }
518
- else {
519
- if (cancel) {
519
+ if (cancel) {
520
+ const { style, label } = cancel;
521
+ if (style === 'link') {
522
+ actionCancelElement = document.createElement('a');
523
+ actionCancelElement.href = 'javascript:void(0)';
524
+ actionCancelElement.innerText = label;
525
+ }
526
+ else {
520
527
  actionCancelElement = document.createElement('button');
521
528
  actionCancelElement.className = `mecx-button-tertiary mecx-button-tertiary__${type}`;
522
- actionCancelElement.innerText = cancel.label;
523
- }
524
- if (confirm) {
525
- actionConfirmElement = document.createElement('button');
526
- actionConfirmElement.className = `mecx-button-primary mecx-button-primary__${type}`;
527
- actionConfirmElement.innerText = confirm.label;
529
+ actionCancelElement.innerText = label;
528
530
  }
529
531
  }
530
532
  if (actionCancelElement) {
531
533
  actionCancelElement.addEventListener('click', () => {
532
- this.close(id);
534
+ if (!cancel?.keepOnAction) {
535
+ this.close(id);
536
+ }
533
537
  cancel.action();
534
538
  });
535
539
  actionElement.appendChild(actionCancelElement);
536
540
  }
537
541
  if (actionConfirmElement) {
538
542
  actionConfirmElement.addEventListener('click', () => {
539
- this.close(id);
543
+ if (!confirm?.keepOnAction) {
544
+ this.close(id);
545
+ }
540
546
  confirm.action();
541
547
  });
542
548
  actionElement.appendChild(actionConfirmElement);