@rivet-health/design-system 41.1.0 → 41.1.2

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.
@@ -651,8 +651,9 @@ i0.ɵɵngDeclareClassMetadata({
651
651
  }]
652
652
  });
653
653
  var LockScrollDirective = class LockScrollDirective {
654
- constructor(context) {
654
+ constructor(context, documentRef) {
655
655
  this.context = context;
656
+ this.documentRef = documentRef;
656
657
  this.lock = false;
657
658
  }
658
659
  ngOnInit() {
@@ -670,16 +671,20 @@ var LockScrollDirective = class LockScrollDirective {
670
671
  }
671
672
  }
672
673
  lockScroll() {
673
- this.context.scrollPosition = document.documentElement.scrollTop;
674
- document.body.style.position = "fixed";
675
- document.body.style.overflow = "hidden";
676
- document.body.style.width = "100%";
677
- document.body.style.height = "100%";
678
- document.body.style.top = `${this.context.scrollPosition * -1}px`;
674
+ const body = this.documentRef.body;
675
+ if (!body) return;
676
+ this.context.scrollPosition = this.documentRef.documentElement.scrollTop;
677
+ body.style.position = "fixed";
678
+ body.style.overflow = "hidden";
679
+ body.style.width = "100%";
680
+ body.style.height = "100%";
681
+ body.style.top = `${this.context.scrollPosition * -1}px`;
679
682
  }
680
683
  unlockScroll() {
681
- document.body.removeAttribute("style");
682
- document.documentElement.scrollTop = this.context.scrollPosition;
684
+ const body = this.documentRef.body;
685
+ if (!body) return;
686
+ body.removeAttribute("style");
687
+ this.documentRef.documentElement.scrollTop = this.context.scrollPosition;
683
688
  }
684
689
  static {
685
690
  this.ɵfac = i0.ɵɵngDeclareFactory({
@@ -687,7 +692,7 @@ var LockScrollDirective = class LockScrollDirective {
687
692
  version: "22.2.4",
688
693
  ngImport: i0,
689
694
  type: LockScrollDirective,
690
- deps: [{ token: LockScrollContextService }],
695
+ deps: [{ token: LockScrollContextService }, { token: DOCUMENT }],
691
696
  target: i0.ɵɵFactoryTarget.Directive
692
697
  });
693
698
  }
@@ -715,7 +720,13 @@ i0.ɵɵngDeclareClassMetadata({
715
720
  standalone: false
716
721
  }]
717
722
  }],
718
- ctorParameters: () => [{ type: LockScrollContextService }],
723
+ ctorParameters: () => [{ type: LockScrollContextService }, {
724
+ type: Document,
725
+ decorators: [{
726
+ type: Inject,
727
+ args: [DOCUMENT]
728
+ }]
729
+ }],
719
730
  propDecorators: { lock: [{
720
731
  type: Input,
721
732
  args: ["rivLockScroll"]
@@ -6127,11 +6138,16 @@ var DateComponent = class DateComponent extends InputLabelComponent {
6127
6138
  }
6128
6139
  onDocumentMouseDown(target) {
6129
6140
  if (!this.open$.getValue() || !(target instanceof Element)) return;
6130
- if (this.host.nativeElement.contains(target)) return;
6131
- if (target.closest(".callout, .scrim, .overlay-container")) return;
6141
+ if (this.isInsidePicker(target)) return;
6132
6142
  this.open$.next(false);
6133
6143
  this.cdr.markForCheck();
6134
6144
  }
6145
+ isInsidePicker(target) {
6146
+ const host = this.host.nativeElement;
6147
+ if (host.contains(target)) return true;
6148
+ const layer = target.closest(".callout, .scrim, .overlay-container");
6149
+ return !!layer && !layer.contains(host);
6150
+ }
6135
6151
  clearValue() {
6136
6152
  this.commit(void 0);
6137
6153
  this.open$.next(false);
@@ -6162,7 +6178,7 @@ var DateComponent = class DateComponent extends InputLabelComponent {
6162
6178
  else this.syncInputText();
6163
6179
  this.previewValue = void 0;
6164
6180
  const nextTarget = event?.relatedTarget;
6165
- if (!(nextTarget instanceof Element && (this.host.nativeElement.contains(nextTarget) || !!nextTarget.closest(".callout, .scrim, .overlay-container")))) this.open$.next(false);
6181
+ if (!(nextTarget instanceof Element && this.isInsidePicker(nextTarget))) this.open$.next(false);
6166
6182
  this.cdr.markForCheck();
6167
6183
  }
6168
6184
  onDateSelect(date) {
@@ -12774,7 +12790,7 @@ i0.ɵɵngDeclareClassMetadata({
12774
12790
  "select:not([disabled])",
12775
12791
  "textarea:not([disabled])",
12776
12792
  "[contenteditable=\"true\"]"
12777
- ].map((field) => `.body ${field}`).join(", ");
12793
+ ].map((field) => `.body ${field}:not([aria-haspopup])`).join(", ");
12778
12794
  function focusInitial(dialog) {
12779
12795
  if (!dialog.contains(document.activeElement)) (dialog.querySelector(initialFocusSelector) ?? dialog).focus();
12780
12796
  }