@cqa-lib/cqa-ui 1.0.53 → 1.0.55

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,59 +4207,75 @@ class TailwindOverlayContainer extends OverlayContainer {
4207
4207
  // Also check immediately in case overlays already exist
4208
4208
  requestAnimationFrame(() => this.updateContainerClass());
4209
4209
  }
4210
- isElementVisible(element) {
4210
+ isElementClosing(element) {
4211
+ // Check if element is closing (very low opacity AND shrinking dimensions)
4211
4212
  const style = window.getComputedStyle(element);
4212
- // Check if element is visible (not display: none, not opacity: 0, not visibility: hidden)
4213
- const isDisplayed = style.display !== 'none';
4214
- const isOpaque = parseFloat(style.opacity) > 0.01; // Allow for very small opacity values during animations
4215
- const isVisible = style.visibility !== 'hidden';
4216
- // Also check if element has dimensions (width/height > 0)
4213
+ const opacity = parseFloat(style.opacity);
4217
4214
  const rect = element.getBoundingClientRect();
4218
- const hasSize = rect.width > 0 && rect.height > 0;
4219
- return isDisplayed && isOpaque && isVisible && hasSize;
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);
4220
4218
  }
4221
4219
  updateContainerClass() {
4222
4220
  if (!this._containerElement)
4223
4221
  return;
4224
4222
  // Count library overlays (dialogs, select panels, datepicker panels)
4225
- // Only count overlays that are actually visible/active (not hidden or closing)
4226
- // Library dialogs - check visibility
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
4227
4226
  const libraryDialogs = Array.from(this._containerElement.querySelectorAll('.cqa-dialog-panel'));
4228
- const visibleLibraryDialogs = libraryDialogs.filter(dialog => this.isElementVisible(dialog)).length;
4229
- // Library backdrops - check visibility (backdrops can be transparent but still present)
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)
4230
4232
  const libraryBackdrops = Array.from(this._containerElement.querySelectorAll('.cqa-dialog-backdrop'));
4231
- const visibleLibraryBackdrops = libraryBackdrops.filter(backdrop => {
4232
- // Backdrops might have low opacity but should still be considered if they're showing
4233
+ const activeLibraryBackdrops = libraryBackdrops.filter(backdrop => {
4233
4234
  const style = window.getComputedStyle(backdrop);
4235
+ // Backdrop is active if it's showing (has the showing class) and not display: none
4234
4236
  return style.display !== 'none' && backdrop.classList.contains('cdk-overlay-backdrop-showing');
4235
4237
  }).length;
4236
- // Select panels - check visibility
4238
+ // Select panels - count if not closing
4237
4239
  const selectPanels = Array.from(this._containerElement.querySelectorAll('.ctc-select-panel'));
4238
- const visibleSelectPanels = selectPanels.filter(panel => this.isElementVisible(panel)).length;
4239
- // Date panels - check visibility
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
4240
4245
  const datePanels = Array.from(this._containerElement.querySelectorAll('.ctc-date-range-panel'));
4241
- const visibleDatePanels = datePanels.filter(panel => this.isElementVisible(panel)).length;
4242
- const totalLibraryOverlays = visibleLibraryDialogs + visibleLibraryBackdrops + visibleSelectPanels + visibleDatePanels;
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;
4243
4251
  // Check for portal Material dialogs (those without .cqa-dialog-panel class)
4244
4252
  // Portal dialogs use .mat-dialog-container but NOT .cqa-dialog-panel
4253
+ // Only count visible portal dialogs to avoid false positives
4245
4254
  const portalDialogs = Array.from(this._containerElement.querySelectorAll('.mat-dialog-container:not(.cqa-dialog-panel)'));
4246
- const visiblePortalDialogs = portalDialogs.filter(dialog => this.isElementVisible(dialog)).length;
4247
- // Decision logic: Only add cqa-ui-root when VISIBLE library overlays are present
4248
- // This ensures portal Material dialogs don't get affected by library CSS
4249
- // even if library overlays are in the DOM but closing/hidden
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
4250
4266
  if (totalLibraryOverlays > 0) {
4251
- // Visible library overlays exist - add the class (they need Tailwind styles scoped to .cqa-ui-root)
4267
+ // Library overlays exist - add the class (they need Tailwind styles scoped to .cqa-ui-root)
4252
4268
  this._containerElement.classList.add('cqa-ui-root');
4253
4269
  }
4254
4270
  else {
4255
- // No visible library overlays exist - remove the class
4271
+ // No active library overlays exist - remove the class
4256
4272
  // This handles:
4257
4273
  // 1. Only portal dialogs exist (should not have cqa-ui-root)
4258
- // 2. Library overlays are closing/hidden (should not have cqa-ui-root)
4274
+ // 2. Library overlays are closing/closed (should not have cqa-ui-root)
4259
4275
  // 3. No overlays exist at all (clean state)
4260
4276
  this._containerElement.classList.remove('cqa-ui-root');
4261
4277
  }
4262
- // Note: If both library overlays and portal dialogs exist simultaneously and are visible,
4278
+ // Note: If both library overlays and portal dialogs exist simultaneously,
4263
4279
  // the class will be present because library overlays need it. In this case,
4264
4280
  // portal dialogs may be affected by library CSS. To avoid this, ensure library
4265
4281
  // overlays are closed before opening portal dialogs, or use CSS specificity