@sinequa/galactik 2.1.0 → 2.1.1

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.
@@ -20803,7 +20803,7 @@ var DialogContentComponent = class DialogContentComponent {
20803
20803
  labelledby = input(...ngDevMode ? [void 0, { debugName: "labelledby" }] : /* istanbul ignore next */ []);
20804
20804
  class = input(...ngDevMode ? [void 0, { debugName: "class" }] : /* istanbul ignore next */ []);
20805
20805
  titleId = signal(void 0, ...ngDevMode ? [{ debugName: "titleId" }] : /* istanbul ignore next */ []);
20806
- variants = computed(() => cn(MODAL_CLASS, modalVariants({ size: this.size() }), "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-1100 max-h-[calc(100dvh-2rem)]", this.class()), ...ngDevMode ? [{ debugName: "variants" }] : /* istanbul ignore next */ []);
20806
+ variants = computed(() => cn(MODAL_CLASS, modalVariants({ size: this.size() }), "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-1100 max-h-[calc(100dvh-2rem)] outline-none", this.class()), ...ngDevMode ? [{ debugName: "variants" }] : /* istanbul ignore next */ []);
20807
20807
  static ɵfac = i0.ɵɵngDeclareFactory({
20808
20808
  minVersion: "12.0.0",
20809
20809
  version: "22.2.1",
@@ -20845,7 +20845,8 @@ var DialogContentComponent = class DialogContentComponent {
20845
20845
  attributes: {
20846
20846
  "data-slot": "dialog-content",
20847
20847
  "role": "dialog",
20848
- "aria-modal": "true"
20848
+ "aria-modal": "true",
20849
+ "tabindex": "-1"
20849
20850
  },
20850
20851
  properties: {
20851
20852
  "attr.aria-labelledby": "labelledby() ?? titleId()",
@@ -20877,6 +20878,7 @@ i0.ɵɵngDeclareClassMetadata({
20877
20878
  "data-slot": "dialog-content",
20878
20879
  role: "dialog",
20879
20880
  "aria-modal": "true",
20881
+ tabindex: "-1",
20880
20882
  "[attr.aria-labelledby]": "labelledby() ?? titleId()",
20881
20883
  "[class]": "variants()"
20882
20884
  }
@@ -21025,6 +21027,16 @@ i0.ɵɵngDeclareClassMetadata({
21025
21027
  }]
21026
21028
  }
21027
21029
  });
21030
+ const INERT_EXEMPT = "[aria-live], [role='status'], [role='alert'], [data-sonner-toasters], [data-inert-ignore]";
21031
+ function inertOutside(host) {
21032
+ const marked = [];
21033
+ for (let node = host; node !== document.body && node.parentElement; node = node.parentElement) for (const sibling of Array.from(node.parentElement.children)) {
21034
+ if (sibling === node || sibling.hasAttribute("inert") || sibling.matches(INERT_EXEMPT)) continue;
21035
+ sibling.setAttribute("inert", "");
21036
+ marked.push(sibling);
21037
+ }
21038
+ return () => marked.forEach((element) => element.removeAttribute("inert"));
21039
+ }
21028
21040
  var DialogComponent = class DialogComponent {
21029
21041
  dialog = inject(ElementRef).nativeElement;
21030
21042
  closed = output();
@@ -21032,6 +21044,12 @@ var DialogComponent = class DialogComponent {
21032
21044
  isOpen = signal(false, ...ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []);
21033
21045
  isPopover = signal(false, ...ngDevMode ? [{ debugName: "isPopover" }] : /* istanbul ignore next */ []);
21034
21046
  isModal = signal(false, ...ngDevMode ? [{ debugName: "isModal" }] : /* istanbul ignore next */ []);
21047
+ injector = inject(Injector);
21048
+ opener = null;
21049
+ releaseInert = null;
21050
+ constructor() {
21051
+ inject(DestroyRef).onDestroy(() => this.releaseBackground());
21052
+ }
21035
21053
  open() {
21036
21054
  this.showModal();
21037
21055
  }
@@ -21044,12 +21062,28 @@ var DialogComponent = class DialogComponent {
21044
21062
  this.dialog?.show();
21045
21063
  }
21046
21064
  showModal() {
21065
+ const wasOpen = this.isOpen();
21047
21066
  this.isOpen.set(true);
21048
21067
  this.isPopover.set(false);
21049
21068
  if (this.dialog.tagName === "DIALOG") {
21050
21069
  this.dialog?.showModal();
21051
21070
  this.isModal.set(true);
21052
- }
21071
+ } else if (!wasOpen) this.holdBackground();
21072
+ }
21073
+ holdBackground() {
21074
+ this.opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;
21075
+ this.releaseInert = inertOutside(this.dialog);
21076
+ afterNextRender(() => {
21077
+ if (!this.isOpen() || this.isPopover()) return;
21078
+ (this.dialog.querySelector("[autofocus]") ?? this.dialog.querySelector("[data-slot='dialog-content']"))?.focus({ preventScroll: true });
21079
+ }, { injector: this.injector });
21080
+ }
21081
+ releaseBackground() {
21082
+ this.releaseInert?.();
21083
+ this.releaseInert = null;
21084
+ const opener = this.opener;
21085
+ this.opener = null;
21086
+ if (opener?.isConnected) opener.focus({ preventScroll: true });
21053
21087
  }
21054
21088
  showPopover() {
21055
21089
  this.isOpen.set(true);
@@ -21061,6 +21095,7 @@ var DialogComponent = class DialogComponent {
21061
21095
  this.isOpen.set(false);
21062
21096
  this.isPopover.set(false);
21063
21097
  if (this.dialog.tagName === "DIALOG") this.dialog?.close(eventType);
21098
+ this.releaseBackground();
21064
21099
  this.closed.emit(eventType);
21065
21100
  document.dispatchEvent(new Event(eventType));
21066
21101
  }
@@ -21193,6 +21228,7 @@ i0.ɵɵngDeclareClassMetadata({
21193
21228
  imports: [DialogHeaderComponent, DialogContentComponent]
21194
21229
  }]
21195
21230
  }],
21231
+ ctorParameters: () => [],
21196
21232
  propDecorators: {
21197
21233
  closed: [{
21198
21234
  type: i0.Output,