@cqa-lib/cqa-ui 1.0.52 → 1.0.54

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.
@@ -4207,31 +4207,72 @@ class TailwindOverlayContainer extends OverlayContainer {
4207
4207
  // Also check immediately in case overlays already exist
4208
4208
  requestAnimationFrame(() => this.updateContainerClass());
4209
4209
  }
4210
+ isElementClosing(element) {
4211
+ // Check if element is closing (very low opacity AND shrinking dimensions)
4212
+ const style = window.getComputedStyle(element);
4213
+ const opacity = parseFloat(style.opacity);
4214
+ const rect = element.getBoundingClientRect();
4215
+ // If opacity is very low (< 0.1) AND dimensions are very small, it's likely closing
4216
+ // This helps filter out closing animations while allowing opening animations
4217
+ return opacity < 0.1 && (rect.width < 10 || rect.height < 10);
4218
+ }
4210
4219
  updateContainerClass() {
4211
4220
  if (!this._containerElement)
4212
4221
  return;
4213
4222
  // Count library overlays (dialogs, select panels, datepicker panels)
4214
- // These are library-specific classes that indicate library components
4215
- // Only count overlays that are actually in the DOM (CDK removes them when closed)
4216
- const libraryDialogs = this._containerElement.querySelectorAll('.cqa-dialog-panel').length;
4217
- const libraryBackdrops = this._containerElement.querySelectorAll('.cqa-dialog-backdrop').length;
4218
- const librarySelectPanels = this._containerElement.querySelectorAll('.ctc-select-panel').length;
4219
- const libraryDatePanels = this._containerElement.querySelectorAll('.ctc-date-range-panel').length;
4220
- const totalLibraryOverlays = libraryDialogs + libraryBackdrops + librarySelectPanels + libraryDatePanels;
4223
+ // Count them if they exist in DOM (even during opening animations)
4224
+ // But exclude them if they're clearly closing (very low opacity + small size)
4225
+ // Library dialogs - count if not closing
4226
+ const libraryDialogs = Array.from(this._containerElement.querySelectorAll('.cqa-dialog-panel'));
4227
+ const activeLibraryDialogs = libraryDialogs.filter(dialog => {
4228
+ const style = window.getComputedStyle(dialog);
4229
+ return style.display !== 'none' && !this.isElementClosing(dialog);
4230
+ }).length;
4231
+ // Library backdrops - check if showing (backdrops can be transparent but still present)
4232
+ const libraryBackdrops = Array.from(this._containerElement.querySelectorAll('.cqa-dialog-backdrop'));
4233
+ const activeLibraryBackdrops = libraryBackdrops.filter(backdrop => {
4234
+ const style = window.getComputedStyle(backdrop);
4235
+ // Backdrop is active if it's showing (has the showing class) and not display: none
4236
+ return style.display !== 'none' && backdrop.classList.contains('cdk-overlay-backdrop-showing');
4237
+ }).length;
4238
+ // Select panels - count if not closing
4239
+ const selectPanels = Array.from(this._containerElement.querySelectorAll('.ctc-select-panel'));
4240
+ const activeSelectPanels = selectPanels.filter(panel => {
4241
+ const style = window.getComputedStyle(panel);
4242
+ return style.display !== 'none' && !this.isElementClosing(panel);
4243
+ }).length;
4244
+ // Date panels - count if not closing
4245
+ const datePanels = Array.from(this._containerElement.querySelectorAll('.ctc-date-range-panel'));
4246
+ const activeDatePanels = datePanels.filter(panel => {
4247
+ const style = window.getComputedStyle(panel);
4248
+ return style.display !== 'none' && !this.isElementClosing(panel);
4249
+ }).length;
4250
+ const totalLibraryOverlays = activeLibraryDialogs + activeLibraryBackdrops + activeSelectPanels + activeDatePanels;
4221
4251
  // Check for portal Material dialogs (those without .cqa-dialog-panel class)
4222
4252
  // Portal dialogs use .mat-dialog-container but NOT .cqa-dialog-panel
4223
- const portalDialogs = this._containerElement.querySelectorAll('.mat-dialog-container:not(.cqa-dialog-panel)').length;
4224
- // Decision logic: Only add cqa-ui-root when library overlays are present
4225
- // This ensures portal Material dialogs don't get affected by library CSS
4253
+ // Only count visible portal dialogs to avoid false positives
4254
+ const portalDialogs = Array.from(this._containerElement.querySelectorAll('.mat-dialog-container:not(.cqa-dialog-panel)'));
4255
+ const visiblePortalDialogs = portalDialogs.filter(dialog => {
4256
+ const style = window.getComputedStyle(dialog);
4257
+ const rect = dialog.getBoundingClientRect();
4258
+ return style.display !== 'none' &&
4259
+ parseFloat(style.opacity) > 0.1 &&
4260
+ rect.width > 0 &&
4261
+ rect.height > 0;
4262
+ }).length;
4263
+ // Decision logic: Add cqa-ui-root when library overlays are present (even during opening animations)
4264
+ // Remove it only when library overlays are clearly gone or closing
4265
+ // This ensures library overlays get styles immediately, while portal dialogs don't get affected
4226
4266
  if (totalLibraryOverlays > 0) {
4227
4267
  // Library overlays exist - add the class (they need Tailwind styles scoped to .cqa-ui-root)
4228
4268
  this._containerElement.classList.add('cqa-ui-root');
4229
4269
  }
4230
4270
  else {
4231
- // No library overlays exist - remove the class
4232
- // This handles both cases:
4271
+ // No active library overlays exist - remove the class
4272
+ // This handles:
4233
4273
  // 1. Only portal dialogs exist (should not have cqa-ui-root)
4234
- // 2. No overlays exist at all (clean state)
4274
+ // 2. Library overlays are closing/closed (should not have cqa-ui-root)
4275
+ // 3. No overlays exist at all (clean state)
4235
4276
  this._containerElement.classList.remove('cqa-ui-root');
4236
4277
  }
4237
4278
  // Note: If both library overlays and portal dialogs exist simultaneously,