@cqa-lib/cqa-ui 1.0.68 → 1.0.70

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.
@@ -4274,12 +4274,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
4274
4274
  }] } });
4275
4275
 
4276
4276
  /**
4277
- * Ensures Angular CDK overlay content (e.g., MatSelect, Datepicker panels, library dialogs)
4278
- * is nested under an element with class="cqa-ui-root" so Tailwind utilities
4279
- * configured with important: '.cqa-ui-root' are applied inside overlays.
4277
+ * Custom overlay container that adds 'cqa-ui-root' class to individual overlay panes
4278
+ * containing library components, rather than to the entire container.
4280
4279
  *
4281
- * IMPORTANT: Only sets class="cqa-ui-root" when library overlays are present.
4282
- * Portal Material dialogs should NOT have this class to prevent library CSS from affecting them.
4280
+ * This ensures library CSS (scoped with .cqa-ui-root) only affects library overlays,
4281
+ * not portal overlays that may be open simultaneously.
4283
4282
  */
4284
4283
  class TailwindOverlayContainer extends OverlayContainer {
4285
4284
  constructor() {
@@ -4289,13 +4288,13 @@ class TailwindOverlayContainer extends OverlayContainer {
4289
4288
  _createContainer() {
4290
4289
  super._createContainer();
4291
4290
  if (this._containerElement) {
4292
- // Don't set class initially - we'll set it dynamically when library overlays are created
4291
+ // Never add cqa-ui-root to the container itself
4293
4292
  this._containerElement.classList.remove('cqa-ui-root');
4294
- // Use MutationObserver to detect when library overlays are created/destroyed
4295
- this.observeLibraryOverlays();
4293
+ // Use MutationObserver to detect when overlay panes are created/destroyed
4294
+ this.observeOverlayPanes();
4296
4295
  }
4297
4296
  }
4298
- observeLibraryOverlays() {
4297
+ observeOverlayPanes() {
4299
4298
  if (!this._containerElement)
4300
4299
  return;
4301
4300
  const observer = new MutationObserver(() => {
@@ -4304,49 +4303,44 @@ class TailwindOverlayContainer extends OverlayContainer {
4304
4303
  cancelAnimationFrame(this.updateTimeout);
4305
4304
  }
4306
4305
  this.updateTimeout = requestAnimationFrame(() => {
4307
- this.updateContainerClass();
4306
+ this.updateOverlayPaneClasses();
4308
4307
  this.updateTimeout = null;
4309
4308
  });
4310
4309
  });
4311
4310
  observer.observe(this._containerElement, {
4312
4311
  childList: true,
4313
4312
  subtree: true,
4313
+ attributes: true,
4314
+ attributeFilter: ['class']
4314
4315
  });
4315
4316
  // Also check immediately in case overlays already exist
4316
- requestAnimationFrame(() => this.updateContainerClass());
4317
+ requestAnimationFrame(() => this.updateOverlayPaneClasses());
4317
4318
  }
4318
- updateContainerClass() {
4319
+ updateOverlayPaneClasses() {
4319
4320
  if (!this._containerElement)
4320
4321
  return;
4321
- // Count library overlays (dialogs, select panels, datepicker panels)
4322
- // These are library-specific classes that indicate library components
4323
- // Only count overlays that are actually in the DOM (CDK removes them when closed)
4324
- const libraryDialogs = this._containerElement.querySelectorAll('.cqa-dialog-panel').length;
4325
- const libraryBackdrops = this._containerElement.querySelectorAll('.cqa-dialog-backdrop').length;
4326
- const librarySelectPanels = this._containerElement.querySelectorAll('.ctc-select-panel').length;
4327
- const libraryDatePanels = this._containerElement.querySelectorAll('.ctc-date-range-panel').length;
4328
- const totalLibraryOverlays = libraryDialogs + libraryBackdrops + librarySelectPanels + libraryDatePanels;
4329
- // Check for portal Material dialogs (those without .cqa-dialog-panel class)
4330
- // Portal dialogs use .mat-dialog-container but NOT .cqa-dialog-panel
4331
- const portalDialogs = this._containerElement.querySelectorAll('.mat-dialog-container:not(.cqa-dialog-panel)').length;
4332
- // Decision logic: Only add cqa-ui-root when library overlays are present
4333
- // This ensures portal Material dialogs don't get affected by library CSS
4334
- if (totalLibraryOverlays > 0) {
4335
- // Library overlays exist - add the class (they need Tailwind styles scoped to .cqa-ui-root)
4336
- this._containerElement.classList.add('cqa-ui-root');
4337
- }
4338
- else {
4339
- // No library overlays exist - remove the class
4340
- // This handles both cases:
4341
- // 1. Only portal dialogs exist (should not have cqa-ui-root)
4342
- // 2. No overlays exist at all (clean state)
4343
- this._containerElement.classList.remove('cqa-ui-root');
4344
- }
4345
- // Note: If both library overlays and portal dialogs exist simultaneously,
4346
- // the class will be present because library overlays need it. In this case,
4347
- // portal dialogs may be affected by library CSS. To avoid this, ensure library
4348
- // overlays are closed before opening portal dialogs, or use CSS specificity
4349
- // to override library styles within portal dialogs.
4322
+ // Find all overlay panes in the container
4323
+ const allPanes = this._containerElement.querySelectorAll('.cdk-overlay-pane');
4324
+ allPanes.forEach((pane) => {
4325
+ // Check if this pane itself has library component classes
4326
+ // These classes are added via panelClass property in library components
4327
+ const hasLibraryDialog = pane.classList.contains('cqa-dialog-panel');
4328
+ const hasLibraryBackdrop = pane.classList.contains('cqa-dialog-backdrop');
4329
+ const hasLibrarySelect = pane.classList.contains('ctc-select-panel');
4330
+ const hasLibraryDatePicker = pane.classList.contains('ctc-date-range-panel');
4331
+ // Also check for library components inside the pane (for dialogs that use mat-dialog-container)
4332
+ const hasLibraryDialogInside = pane.querySelector('.cqa-dialog-panel') !== null;
4333
+ const isLibraryOverlay = hasLibraryDialog || hasLibraryBackdrop || hasLibrarySelect ||
4334
+ hasLibraryDatePicker || hasLibraryDialogInside;
4335
+ if (isLibraryOverlay) {
4336
+ // This is a library overlay - add the class
4337
+ pane.classList.add('cqa-ui-root');
4338
+ }
4339
+ else {
4340
+ // This is NOT a library overlay (e.g., portal dialog) - ensure class is removed
4341
+ pane.classList.remove('cqa-ui-root');
4342
+ }
4343
+ });
4350
4344
  }
4351
4345
  }
4352
4346
  TailwindOverlayContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TailwindOverlayContainer, deps: null, target: i0.ɵɵFactoryTarget.Injectable });