monkey-style-guide 2.0.123 → 2.0.126

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.
@@ -448,7 +448,7 @@ class MonkeyStyleGuideSnackbarService {
448
448
  this.timeoutBlinkTab = null;
449
449
  this.snackbarElements = new SnackbarElements();
450
450
  this.locationRouter.onUrlChange(() => {
451
- if (this.config && !this.config?.closeOnUrlChange) {
451
+ if (this.config && !this.config?.keepOnUrlChange) {
452
452
  this.closeAll();
453
453
  }
454
454
  });
@@ -500,31 +500,33 @@ 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) {
@@ -560,11 +562,6 @@ class MonkeyStyleGuideSnackbarService {
560
562
  snackbarElement.appendChild(snackbarBodyElement);
561
563
  this.snackbarElements.add(snackbarElement, duration, () => (!keepOpen ? this.close(id) : null), verticalPosition);
562
564
  }
563
- close(id) {
564
- const { snackbarElements } = this;
565
- snackbarElements.remove(id);
566
- this.stopBlinking();
567
- }
568
565
  show(config) {
569
566
  this.config = config;
570
567
  const id = `monkey-snackbar-${MonkeyUtils.getRandomString(30)}`;
@@ -578,11 +575,17 @@ class MonkeyStyleGuideSnackbarService {
578
575
  if (config?.blinkTab) {
579
576
  this.blinkTab();
580
577
  }
578
+ return id;
581
579
  }
582
580
  closeAll() {
583
581
  const { snackbarElements } = this;
584
582
  snackbarElements.removeAll();
585
583
  }
584
+ close(id) {
585
+ const { snackbarElements } = this;
586
+ snackbarElements.remove(id);
587
+ this.stopBlinking();
588
+ }
586
589
  }
587
590
  MonkeyStyleGuideSnackbarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MonkeyStyleGuideSnackbarService, deps: [{ token: i1$1.Location }], target: i0.ɵɵFactoryTarget.Injectable });
588
591
  MonkeyStyleGuideSnackbarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MonkeyStyleGuideSnackbarService });