@ascentgl/ads-ui 21.4.0 → 21.5.0

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.
@@ -6016,7 +6016,6 @@ class AdsSnackbarComponent {
6016
6016
  this.snackBarRef = inject(MatSnackBarRef);
6017
6017
  this.defaultButtonCaption = 'Close';
6018
6018
  this.PanelClass = PanelClass;
6019
- this.indexedDB = indexedDB;
6020
6019
  }
6021
6020
  get buttonPanelClass() {
6022
6021
  const panelClass = this.snackBarRef.containerInstance.snackBarConfig.panelClass;
@@ -6032,6 +6031,33 @@ class AdsSnackbarComponent {
6032
6031
  if (overlayWrapper) {
6033
6032
  overlayWrapper.style.zIndex = '1100';
6034
6033
  }
6034
+ this.setupAutoCloseTimer();
6035
+ }
6036
+ /**
6037
+ * Sets up the auto-close timer if required.
6038
+ * If autoCloseDuration is 0, null, or undefined, disables auto-close even for 'success'.
6039
+ */
6040
+ setupAutoCloseTimer() {
6041
+ const panelClass = this.snackBarRef.containerInstance.snackBarConfig.panelClass;
6042
+ // If autoCloseDuration is explicitly set to 0, null, or undefined, do not auto-close
6043
+ if (this.data.autoCloseDuration === 0) {
6044
+ return;
6045
+ }
6046
+ // If autoCloseDuration is set and > 0, use it for any panel class
6047
+ if (typeof this.data.autoCloseDuration === 'number' && this.data.autoCloseDuration > 0) {
6048
+ this.autoCloseTimeoutId = window.setTimeout(() => this.snackBarRef.dismiss(), this.data.autoCloseDuration);
6049
+ return;
6050
+ }
6051
+ // If panel class is Success and no explicit duration, default to 4000ms
6052
+ if (panelClass === PanelClass.Success) {
6053
+ this.autoCloseTimeoutId = window.setTimeout(() => this.snackBarRef.dismiss(), 4000);
6054
+ }
6055
+ }
6056
+ /** @ignore */
6057
+ ngOnDestroy() {
6058
+ if (this.autoCloseTimeoutId) {
6059
+ clearTimeout(this.autoCloseTimeoutId);
6060
+ }
6035
6061
  }
6036
6062
  /** @ignore */
6037
6063
  onSnackbarClick() {