@nectary/components 5.51.0 → 5.52.0

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.
package/bundle.js CHANGED
@@ -3687,7 +3687,7 @@ const enableOverscroll = () => {
3687
3687
  document.documentElement.style.removeProperty("overscroll-behavior");
3688
3688
  }
3689
3689
  };
3690
- const templateHTML$Z = '<style>:host{display:contents;position:relative}dialog{position:fixed;left:0;top:0;transform:translate(var(--sinch-pop-offset-x),var(--sinch-pop-offset-y));margin:0;outline:0;padding:0;border:none;box-sizing:border-box;max-width:unset;max-height:unset;z-index:var(--sinch-comp-pop-z-index,1);background:0 0;overflow:visible}dialog:not([open]){display:none}:host(:not([open])) slot[name=content]{display:none}dialog::backdrop{background-color:transparent}#backdrop{display:none;position:fixed;inset:0;margin:0;border:none;padding:0;background:0 0;pointer-events:auto;z-index:0}dialog[data-modal-backdrop] #backdrop{display:block}#content{position:relative;z-index:var(--sinch-comp-pop-z-index,1)}#target-open{display:flex;flex-direction:column;position:absolute;left:0;top:0;z-index:var(--sinch-comp-pop-z-index,1)}#focus{display:none;position:absolute;width:0;height:0}</style><slot id="target" name="target" aria-haspopup="dialog" aria-expanded="false"></slot><div id="focus"></div><dialog id="dialog"><div id="backdrop"></div><div id="target-open"><slot name="target-open"></slot></div><div id="content"><slot name="content"></slot></div></dialog>';
3690
+ const templateHTML$Z = '<style>:host{display:contents;position:relative}dialog{position:fixed;left:0;top:0;margin:0;outline:0;padding:0;border:none;box-sizing:border-box;max-width:unset;max-height:unset;z-index:var(--sinch-comp-pop-z-index,1);background:0 0;overflow:visible}dialog:not([open]){display:none}:host(:not([open])) slot[name=content]{display:none}dialog::backdrop{background-color:transparent}#backdrop{display:none;position:fixed;inset:0;margin:0;border:none;padding:0;background:0 0;pointer-events:auto;z-index:0}dialog[data-modal-backdrop] #backdrop{display:block}#content{position:relative;z-index:var(--sinch-comp-pop-z-index,1);transform:translate(var(--sinch-pop-offset-x),var(--sinch-pop-offset-y))}#target-open{display:flex;flex-direction:column;position:absolute;left:0;top:0;z-index:var(--sinch-comp-pop-z-index,1)}#focus{display:none;position:absolute;width:0;height:0}</style><slot id="target" name="target" aria-haspopup="dialog" aria-expanded="false"></slot><div id="focus"></div><dialog id="dialog"><div id="backdrop"></div><div id="target-open"><slot name="target-open"></slot></div><div id="content"><slot name="content"></slot></div></dialog>';
3691
3691
  const template$Z = document.createElement("template");
3692
3692
  template$Z.innerHTML = templateHTML$Z;
3693
3693
  class Pop extends NectaryElement {
@@ -5150,6 +5150,24 @@ class Tooltip extends NectaryElement {
5150
5150
  });
5151
5151
  }
5152
5152
  };
5153
+ // Pulls an overlap shift back toward zero until the bubble stays inside the viewport.
5154
+ // Never flips the shift or makes it larger than the overlap correction requested.
5155
+ #keepOverlapOffsetInView(offset, start, end, limit) {
5156
+ if (offset === 0) {
5157
+ return 0;
5158
+ }
5159
+ let next = offset;
5160
+ if (start + next < 0) {
5161
+ next = -start;
5162
+ }
5163
+ if (end + next > limit) {
5164
+ next = limit - end;
5165
+ }
5166
+ if (offset > 0) {
5167
+ return Math.min(offset, Math.max(0, next));
5168
+ }
5169
+ return Math.max(offset, Math.min(0, next));
5170
+ }
5153
5171
  #resolveOverlap(placementContext) {
5154
5172
  const orientation = this.orientation;
5155
5173
  const targetRect = toLocalRect(this.#$pop.footprintRect, placementContext);
@@ -5180,6 +5198,10 @@ class Tooltip extends NectaryElement {
5180
5198
  offsetX = targetRight - leftEdge;
5181
5199
  }
5182
5200
  }
5201
+ if (placementContext.transformedAncestor == null && !getBooleanAttribute(this, "allow-scroll")) {
5202
+ offsetX = this.#keepOverlapOffsetInView(offsetX, leftEdge, rightEdge, placementContext.boundsWidth);
5203
+ offsetY = this.#keepOverlapOffsetInView(offsetY, topEdge, bottomEdge, placementContext.boundsHeight);
5204
+ }
5183
5205
  this.#applyContentOffset(offsetX, offsetY);
5184
5206
  return offsetX !== 0 || offsetY !== 0;
5185
5207
  }
@@ -16007,9 +16029,10 @@ class SelectMenuOption extends NectaryElement {
16007
16029
  }
16008
16030
  defineCustomElement("sinch-select-menu-option", SelectMenuOption);
16009
16031
  const isSelectMenuOption = (el) => el.localName === "sinch-select-menu-option";
16010
- const templateHTML$h = '<style>:host{display:block;outline:0}#listbox{overflow-y:auto;max-height:var(--sinch-comp-select-menu-font-max-height)}#search{display:none;margin:10px}#search.active{display:block}#search-clear:not(.active){display:none}#not-found{display:flex;align-items:center;justify-content:center;width:100%;height:30px;margin-bottom:10px;pointer-events:none;user-select:none;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-not-found-text);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-not-found-text-initial)}#not-found:not(.active){display:none}::slotted(.hidden){display:none}::slotted(sinch-title){padding:8px 16px;--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-title-initial)}</style><sinch-input id="search" size="s" placeholder="Search" aria-label="Search"><sinch-icon icons-version="2" name="magnifying-glass" id="icon-search" slot="icon"></sinch-icon><sinch-button id="search-clear" slot="right"><sinch-icon icons-version="2" name="fa-xmark" slot="icon"></sinch-icon></sinch-button></sinch-input><div id="not-found"><sinch-text type="m">No results</sinch-text></div><div id="listbox" role="listbox" tabindex="-1"><slot></slot></div>';
16032
+ const templateHTML$h = '<style>:host{display:block;outline:0}#listbox{overflow-y:auto;max-height:var(--sinch-comp-select-menu-font-max-height)}#search{display:none;margin:10px}#search.active{display:block}#search-clear:not(.active){display:none}#no-results{display:flex;align-items:center;justify-content:center;width:100%;height:30px;margin-bottom:10px;pointer-events:none;user-select:none;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-not-found-text);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-not-found-text-initial)}#no-results:not(.active){display:none}::slotted(.hidden){display:none}::slotted(sinch-title){padding:8px 16px;--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-title-initial)}</style><sinch-input id="search" size="s" placeholder="Search" aria-label="Search"><sinch-icon icons-version="2" name="magnifying-glass" id="icon-search" slot="icon"></sinch-icon><sinch-button id="search-clear" slot="right"><sinch-icon icons-version="2" name="fa-xmark" slot="icon"></sinch-icon></sinch-button></sinch-input><div id="no-results"><sinch-text id="no-results-text" type="m"></sinch-text></div><div id="listbox" role="listbox" tabindex="-1"><slot></slot></div>';
16011
16033
  const ITEM_HEIGHT = 40;
16012
16034
  const DEFAULT_SEARCH_LABEL = "Search";
16035
+ const DEFAULT_NO_RESULTS_TEXT = "No results";
16013
16036
  const template$h = document.createElement("template");
16014
16037
  template$h.innerHTML = templateHTML$h;
16015
16038
  class SelectMenu extends NectaryElement {
@@ -16017,7 +16040,8 @@ class SelectMenu extends NectaryElement {
16017
16040
  #$listbox;
16018
16041
  #$search;
16019
16042
  #$searchClear;
16020
- #$notFound;
16043
+ #$noResults;
16044
+ #$noResultsText;
16021
16045
  #controller = null;
16022
16046
  #searchDebounce;
16023
16047
  #internals;
@@ -16032,7 +16056,8 @@ class SelectMenu extends NectaryElement {
16032
16056
  this.#$listbox = shadowRoot.querySelector("#listbox");
16033
16057
  this.#$search = shadowRoot.querySelector("#search");
16034
16058
  this.#$searchClear = shadowRoot.querySelector("#search-clear");
16035
- this.#$notFound = shadowRoot.querySelector("#not-found");
16059
+ this.#$noResults = shadowRoot.querySelector("#no-results");
16060
+ this.#$noResultsText = shadowRoot.querySelector("#no-results-text");
16036
16061
  this.#searchDebounce = debounceTimeout(200)(this.#updateSearchValue);
16037
16062
  }
16038
16063
  connectedCallback() {
@@ -16043,6 +16068,7 @@ class SelectMenu extends NectaryElement {
16043
16068
  };
16044
16069
  this.setAttribute("role", "group");
16045
16070
  this.tabIndex = 0;
16071
+ this.#updateNoResultsText(this.getAttribute("no-results-text"));
16046
16072
  this.#syncListboxLabel();
16047
16073
  this.addEventListener("keydown", this.#onListboxKeyDown, options);
16048
16074
  this.addEventListener("focus", this.#onFocus, options);
@@ -16119,6 +16145,7 @@ class SelectMenu extends NectaryElement {
16119
16145
  "search-value",
16120
16146
  // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set searchPlaceholder
16121
16147
  "search-placeholder",
16148
+ "no-results-text",
16122
16149
  // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set searchAutocomplete
16123
16150
  "search-autocomplete"
16124
16151
  ];
@@ -16162,6 +16189,10 @@ class SelectMenu extends NectaryElement {
16162
16189
  this.#updateSearchPlaceholder(newVal);
16163
16190
  break;
16164
16191
  }
16192
+ case "no-results-text": {
16193
+ this.#updateNoResultsText(newVal);
16194
+ break;
16195
+ }
16165
16196
  case "search-value": {
16166
16197
  updateAttribute(this.#$search, "value", newVal);
16167
16198
  this.#userManagedSearch = true;
@@ -16231,6 +16262,12 @@ class SelectMenu extends NectaryElement {
16231
16262
  get "search-placeholder"() {
16232
16263
  return getAttribute(this.#$search, "placeholder", "");
16233
16264
  }
16265
+ set "no-results-text"(text) {
16266
+ updateAttribute(this, "no-results-text", text);
16267
+ }
16268
+ get "no-results-text"() {
16269
+ return getAttribute(this, "no-results-text", DEFAULT_NO_RESULTS_TEXT);
16270
+ }
16234
16271
  set "search-value"(value) {
16235
16272
  updateAttribute(this, "search-value", value);
16236
16273
  this.#userManagedSearch = true;
@@ -16312,7 +16349,7 @@ class SelectMenu extends NectaryElement {
16312
16349
  }
16313
16350
  setClass($opt, "hidden", isHidden);
16314
16351
  }
16315
- setClass(this.#$notFound, "active", searchValue.length > 0 && !someFound);
16352
+ setClass(this.#$noResults, "active", searchValue.length > 0 && !someFound);
16316
16353
  this.#selectOption(null);
16317
16354
  };
16318
16355
  #onContextKeyDown = (e) => {
@@ -16374,6 +16411,9 @@ class SelectMenu extends NectaryElement {
16374
16411
  updateAttribute(this.#$search, "aria-label", placeholder === null || placeholder === "" ? DEFAULT_SEARCH_LABEL : placeholder);
16375
16412
  }
16376
16413
  }
16414
+ #updateNoResultsText(text) {
16415
+ this.#$noResultsText.textContent = text ?? DEFAULT_NO_RESULTS_TEXT;
16416
+ }
16377
16417
  #syncListboxChildren = () => {
16378
16418
  for (const $element of this.#$optionSlot.assignedElements()) {
16379
16419
  if (!isSelectMenuOption($element) && getAttribute($element, "aria-hidden") !== "true") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.51.0",
3
+ "version": "5.52.0",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
package/pop/index.js CHANGED
@@ -8,7 +8,7 @@ import { getReactEventHandler } from "../utils/get-react-event-handler.js";
8
8
  import { isTargetEqual } from "../utils/event-target.js";
9
9
  import { getPlacementContext, toLocalRect } from "../utils/placement.js";
10
10
  import { orientationValues, disableOverscroll, enableOverscroll, getAnchorPosition, clampPosition } from "./utils.js";
11
- const templateHTML = '<style>:host{display:contents;position:relative}dialog{position:fixed;left:0;top:0;transform:translate(var(--sinch-pop-offset-x),var(--sinch-pop-offset-y));margin:0;outline:0;padding:0;border:none;box-sizing:border-box;max-width:unset;max-height:unset;z-index:var(--sinch-comp-pop-z-index,1);background:0 0;overflow:visible}dialog:not([open]){display:none}:host(:not([open])) slot[name=content]{display:none}dialog::backdrop{background-color:transparent}#backdrop{display:none;position:fixed;inset:0;margin:0;border:none;padding:0;background:0 0;pointer-events:auto;z-index:0}dialog[data-modal-backdrop] #backdrop{display:block}#content{position:relative;z-index:var(--sinch-comp-pop-z-index,1)}#target-open{display:flex;flex-direction:column;position:absolute;left:0;top:0;z-index:var(--sinch-comp-pop-z-index,1)}#focus{display:none;position:absolute;width:0;height:0}</style><slot id="target" name="target" aria-haspopup="dialog" aria-expanded="false"></slot><div id="focus"></div><dialog id="dialog"><div id="backdrop"></div><div id="target-open"><slot name="target-open"></slot></div><div id="content"><slot name="content"></slot></div></dialog>';
11
+ const templateHTML = '<style>:host{display:contents;position:relative}dialog{position:fixed;left:0;top:0;margin:0;outline:0;padding:0;border:none;box-sizing:border-box;max-width:unset;max-height:unset;z-index:var(--sinch-comp-pop-z-index,1);background:0 0;overflow:visible}dialog:not([open]){display:none}:host(:not([open])) slot[name=content]{display:none}dialog::backdrop{background-color:transparent}#backdrop{display:none;position:fixed;inset:0;margin:0;border:none;padding:0;background:0 0;pointer-events:auto;z-index:0}dialog[data-modal-backdrop] #backdrop{display:block}#content{position:relative;z-index:var(--sinch-comp-pop-z-index,1);transform:translate(var(--sinch-pop-offset-x),var(--sinch-pop-offset-y))}#target-open{display:flex;flex-direction:column;position:absolute;left:0;top:0;z-index:var(--sinch-comp-pop-z-index,1)}#focus{display:none;position:absolute;width:0;height:0}</style><slot id="target" name="target" aria-haspopup="dialog" aria-expanded="false"></slot><div id="focus"></div><dialog id="dialog"><div id="backdrop"></div><div id="target-open"><slot name="target-open"></slot></div><div id="content"><slot name="content"></slot></div></dialog>';
12
12
  const template = document.createElement("template");
13
13
  template.innerHTML = templateHTML;
14
14
  class Pop extends NectaryElement {
@@ -33,6 +33,8 @@ export declare class SelectMenu extends NectaryElement implements Focusable {
33
33
  get 'search-autocomplete'(): string;
34
34
  set 'search-placeholder'(placeholder: string);
35
35
  get 'search-placeholder'(): string;
36
+ set 'no-results-text'(text: string);
37
+ get 'no-results-text'(): string;
36
38
  set 'search-value'(value: string);
37
39
  get 'search-value'(): string;
38
40
  get focusable(): boolean;
@@ -10,9 +10,10 @@ import { debounceTimeout } from "../utils/debounce.js";
10
10
  import { getReactEventHandler } from "../utils/get-react-event-handler.js";
11
11
  import { isTargetEqual } from "../utils/event-target.js";
12
12
  import { setFormValue, CSVToFormData } from "../utils/form.js";
13
- const templateHTML = '<style>:host{display:block;outline:0}#listbox{overflow-y:auto;max-height:var(--sinch-comp-select-menu-font-max-height)}#search{display:none;margin:10px}#search.active{display:block}#search-clear:not(.active){display:none}#not-found{display:flex;align-items:center;justify-content:center;width:100%;height:30px;margin-bottom:10px;pointer-events:none;user-select:none;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-not-found-text);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-not-found-text-initial)}#not-found:not(.active){display:none}::slotted(.hidden){display:none}::slotted(sinch-title){padding:8px 16px;--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-title-initial)}</style><sinch-input id="search" size="s" placeholder="Search" aria-label="Search"><sinch-icon icons-version="2" name="magnifying-glass" id="icon-search" slot="icon"></sinch-icon><sinch-button id="search-clear" slot="right"><sinch-icon icons-version="2" name="fa-xmark" slot="icon"></sinch-icon></sinch-button></sinch-input><div id="not-found"><sinch-text type="m">No results</sinch-text></div><div id="listbox" role="listbox" tabindex="-1"><slot></slot></div>';
13
+ const templateHTML = '<style>:host{display:block;outline:0}#listbox{overflow-y:auto;max-height:var(--sinch-comp-select-menu-font-max-height)}#search{display:none;margin:10px}#search.active{display:block}#search-clear:not(.active){display:none}#no-results{display:flex;align-items:center;justify-content:center;width:100%;height:30px;margin-bottom:10px;pointer-events:none;user-select:none;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-not-found-text);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-not-found-text-initial)}#no-results:not(.active){display:none}::slotted(.hidden){display:none}::slotted(sinch-title){padding:8px 16px;--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-title-initial)}</style><sinch-input id="search" size="s" placeholder="Search" aria-label="Search"><sinch-icon icons-version="2" name="magnifying-glass" id="icon-search" slot="icon"></sinch-icon><sinch-button id="search-clear" slot="right"><sinch-icon icons-version="2" name="fa-xmark" slot="icon"></sinch-icon></sinch-button></sinch-input><div id="no-results"><sinch-text id="no-results-text" type="m"></sinch-text></div><div id="listbox" role="listbox" tabindex="-1"><slot></slot></div>';
14
14
  const ITEM_HEIGHT = 40;
15
15
  const DEFAULT_SEARCH_LABEL = "Search";
16
+ const DEFAULT_NO_RESULTS_TEXT = "No results";
16
17
  const template = document.createElement("template");
17
18
  template.innerHTML = templateHTML;
18
19
  class SelectMenu extends NectaryElement {
@@ -20,7 +21,8 @@ class SelectMenu extends NectaryElement {
20
21
  #$listbox;
21
22
  #$search;
22
23
  #$searchClear;
23
- #$notFound;
24
+ #$noResults;
25
+ #$noResultsText;
24
26
  #controller = null;
25
27
  #searchDebounce;
26
28
  #internals;
@@ -35,7 +37,8 @@ class SelectMenu extends NectaryElement {
35
37
  this.#$listbox = shadowRoot.querySelector("#listbox");
36
38
  this.#$search = shadowRoot.querySelector("#search");
37
39
  this.#$searchClear = shadowRoot.querySelector("#search-clear");
38
- this.#$notFound = shadowRoot.querySelector("#not-found");
40
+ this.#$noResults = shadowRoot.querySelector("#no-results");
41
+ this.#$noResultsText = shadowRoot.querySelector("#no-results-text");
39
42
  this.#searchDebounce = debounceTimeout(200)(this.#updateSearchValue);
40
43
  }
41
44
  connectedCallback() {
@@ -46,6 +49,7 @@ class SelectMenu extends NectaryElement {
46
49
  };
47
50
  this.setAttribute("role", "group");
48
51
  this.tabIndex = 0;
52
+ this.#updateNoResultsText(this.getAttribute("no-results-text"));
49
53
  this.#syncListboxLabel();
50
54
  this.addEventListener("keydown", this.#onListboxKeyDown, options);
51
55
  this.addEventListener("focus", this.#onFocus, options);
@@ -122,6 +126,7 @@ class SelectMenu extends NectaryElement {
122
126
  "search-value",
123
127
  // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set searchPlaceholder
124
128
  "search-placeholder",
129
+ "no-results-text",
125
130
  // eslint-disable-next-line @nectary/observed-attribute-accessor -- baseline backlog: missing set searchAutocomplete
126
131
  "search-autocomplete"
127
132
  ];
@@ -165,6 +170,10 @@ class SelectMenu extends NectaryElement {
165
170
  this.#updateSearchPlaceholder(newVal);
166
171
  break;
167
172
  }
173
+ case "no-results-text": {
174
+ this.#updateNoResultsText(newVal);
175
+ break;
176
+ }
168
177
  case "search-value": {
169
178
  updateAttribute(this.#$search, "value", newVal);
170
179
  this.#userManagedSearch = true;
@@ -234,6 +243,12 @@ class SelectMenu extends NectaryElement {
234
243
  get "search-placeholder"() {
235
244
  return getAttribute(this.#$search, "placeholder", "");
236
245
  }
246
+ set "no-results-text"(text) {
247
+ updateAttribute(this, "no-results-text", text);
248
+ }
249
+ get "no-results-text"() {
250
+ return getAttribute(this, "no-results-text", DEFAULT_NO_RESULTS_TEXT);
251
+ }
237
252
  set "search-value"(value) {
238
253
  updateAttribute(this, "search-value", value);
239
254
  this.#userManagedSearch = true;
@@ -315,7 +330,7 @@ class SelectMenu extends NectaryElement {
315
330
  }
316
331
  setClass($opt, "hidden", isHidden);
317
332
  }
318
- setClass(this.#$notFound, "active", searchValue.length > 0 && !someFound);
333
+ setClass(this.#$noResults, "active", searchValue.length > 0 && !someFound);
319
334
  this.#selectOption(null);
320
335
  };
321
336
  #onContextKeyDown = (e) => {
@@ -377,6 +392,9 @@ class SelectMenu extends NectaryElement {
377
392
  updateAttribute(this.#$search, "aria-label", placeholder === null || placeholder === "" ? DEFAULT_SEARCH_LABEL : placeholder);
378
393
  }
379
394
  }
395
+ #updateNoResultsText(text) {
396
+ this.#$noResultsText.textContent = text ?? DEFAULT_NO_RESULTS_TEXT;
397
+ }
380
398
  #syncListboxChildren = () => {
381
399
  for (const $element of this.#$optionSlot.assignedElements()) {
382
400
  if (!isSelectMenuOption($element) && getAttribute($element, "aria-hidden") !== "true") {
@@ -16,6 +16,8 @@ export type TSinchSelectMenuProps = {
16
16
  'search-autocomplete'?: HTMLInputElement['autocomplete'];
17
17
  /** Text for search bar's placeholder */
18
18
  'search-placeholder'?: string;
19
+ /** Text shown when the search returns no results */
20
+ 'no-results-text'?: string;
19
21
  /** Label that is used for a11y */
20
22
  'aria-label': string;
21
23
  /** Element ID reference that labels the listbox */
package/tooltip/index.js CHANGED
@@ -696,6 +696,24 @@ class Tooltip extends NectaryElement {
696
696
  });
697
697
  }
698
698
  };
699
+ // Pulls an overlap shift back toward zero until the bubble stays inside the viewport.
700
+ // Never flips the shift or makes it larger than the overlap correction requested.
701
+ #keepOverlapOffsetInView(offset, start, end, limit) {
702
+ if (offset === 0) {
703
+ return 0;
704
+ }
705
+ let next = offset;
706
+ if (start + next < 0) {
707
+ next = -start;
708
+ }
709
+ if (end + next > limit) {
710
+ next = limit - end;
711
+ }
712
+ if (offset > 0) {
713
+ return Math.min(offset, Math.max(0, next));
714
+ }
715
+ return Math.max(offset, Math.min(0, next));
716
+ }
699
717
  #resolveOverlap(placementContext) {
700
718
  const orientation = this.orientation;
701
719
  const targetRect = toLocalRect(this.#$pop.footprintRect, placementContext);
@@ -726,6 +744,10 @@ class Tooltip extends NectaryElement {
726
744
  offsetX = targetRight - leftEdge;
727
745
  }
728
746
  }
747
+ if (placementContext.transformedAncestor == null && !getBooleanAttribute(this, "allow-scroll")) {
748
+ offsetX = this.#keepOverlapOffsetInView(offsetX, leftEdge, rightEdge, placementContext.boundsWidth);
749
+ offsetY = this.#keepOverlapOffsetInView(offsetY, topEdge, bottomEdge, placementContext.boundsHeight);
750
+ }
729
751
  this.#applyContentOffset(offsetX, offsetY);
730
752
  return offsetX !== 0 || offsetY !== 0;
731
753
  }