@nectary/components 5.50.1 → 5.50.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.
- package/bundle.js +20 -15
- package/input/index.d.ts +1 -1
- package/input/index.js +2 -2
- package/package.json +1 -1
- package/pop/index.js +15 -10
- package/popover/index.js +1 -1
- package/select-menu/index.js +2 -2
package/bundle.js
CHANGED
|
@@ -3683,7 +3683,7 @@ const enableOverscroll = () => {
|
|
|
3683
3683
|
document.documentElement.style.removeProperty("overscroll-behavior");
|
|
3684
3684
|
}
|
|
3685
3685
|
};
|
|
3686
|
-
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}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>';
|
|
3686
|
+
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>';
|
|
3687
3687
|
const template$Z = document.createElement("template");
|
|
3688
3688
|
template$Z.innerHTML = templateHTML$Z;
|
|
3689
3689
|
class Pop extends NectaryElement {
|
|
@@ -3962,8 +3962,11 @@ class Pop extends NectaryElement {
|
|
|
3962
3962
|
this.#$targetWrapper.style.removeProperty("width");
|
|
3963
3963
|
this.#$targetWrapper.style.removeProperty("height");
|
|
3964
3964
|
}
|
|
3965
|
+
#getScrollTrackingElement() {
|
|
3966
|
+
return getFirstSlotElement(this.#$targetSlot, true) ?? getFirstSlotElement(this.#$targetOpenSlot, true) ?? this;
|
|
3967
|
+
}
|
|
3965
3968
|
#subscribeScrollTracking() {
|
|
3966
|
-
this.#scrollableParents = getScrollableParents(this.#
|
|
3969
|
+
this.#scrollableParents = getScrollableParents(this.#getScrollTrackingElement());
|
|
3967
3970
|
this.#scrollableParents.forEach((el) => {
|
|
3968
3971
|
el.addEventListener("scroll", this.#onScrollableParentScroll, { passive: true, capture: true });
|
|
3969
3972
|
});
|
|
@@ -4027,7 +4030,7 @@ class Pop extends NectaryElement {
|
|
|
4027
4030
|
this.#$focus.setAttribute("tabindex", "-1");
|
|
4028
4031
|
this.#$focus.style.display = "block";
|
|
4029
4032
|
this.#$focus.addEventListener("focus", this.#captureRelatedActiveElement);
|
|
4030
|
-
this.#$focus.focus();
|
|
4033
|
+
this.#$focus.focus({ preventScroll: true });
|
|
4031
4034
|
this.#$focus.removeEventListener("focus", this.#captureRelatedActiveElement);
|
|
4032
4035
|
this.#$targetSlot.removeEventListener("blur", this.#stopEventPropagation, true);
|
|
4033
4036
|
this.#$focus.removeAttribute("tabindex");
|
|
@@ -4042,7 +4045,7 @@ class Pop extends NectaryElement {
|
|
|
4042
4045
|
this.#updateOrientation();
|
|
4043
4046
|
this.#resizeObserver.observe(this.#$dialog);
|
|
4044
4047
|
if (this.modal) {
|
|
4045
|
-
getFirstFocusableElement(this.#$contentSlot)?.focus();
|
|
4048
|
+
getFirstFocusableElement(this.#$contentSlot)?.focus({ preventScroll: true });
|
|
4046
4049
|
} else {
|
|
4047
4050
|
if (!effectiveAllowScroll) {
|
|
4048
4051
|
this.#prepareTransferredTarget();
|
|
@@ -4051,13 +4054,13 @@ class Pop extends NectaryElement {
|
|
|
4051
4054
|
activeSlot.addEventListener("keydown", this.#onTargetKeydown);
|
|
4052
4055
|
if (this.#targetActiveElement !== null) {
|
|
4053
4056
|
activeSlot.addEventListener("focus", this.#stopEventPropagation, true);
|
|
4054
|
-
this.#targetActiveElement.focus();
|
|
4057
|
+
this.#targetActiveElement.focus({ preventScroll: true });
|
|
4055
4058
|
activeSlot.removeEventListener("focus", this.#stopEventPropagation, true);
|
|
4056
4059
|
if (!isElementFocused(this.#targetActiveElement)) {
|
|
4057
4060
|
requestAnimationFrame(() => {
|
|
4058
4061
|
if (this.isDomConnected && this.#$dialog.open) {
|
|
4059
4062
|
activeSlot.addEventListener("focus", this.#stopEventPropagation, true);
|
|
4060
|
-
this.#targetActiveElement.focus();
|
|
4063
|
+
this.#targetActiveElement.focus({ preventScroll: true });
|
|
4061
4064
|
activeSlot.removeEventListener("focus", this.#stopEventPropagation, true);
|
|
4062
4065
|
}
|
|
4063
4066
|
});
|
|
@@ -4066,9 +4069,8 @@ class Pop extends NectaryElement {
|
|
|
4066
4069
|
}
|
|
4067
4070
|
if (!effectiveAllowScroll) {
|
|
4068
4071
|
disableOverscroll();
|
|
4069
|
-
} else {
|
|
4070
|
-
this.#subscribeScrollTracking();
|
|
4071
4072
|
}
|
|
4073
|
+
this.#subscribeScrollTracking();
|
|
4072
4074
|
if (!openAsModal) {
|
|
4073
4075
|
this.#subscribeDocumentDismiss();
|
|
4074
4076
|
}
|
|
@@ -4098,6 +4100,10 @@ class Pop extends NectaryElement {
|
|
|
4098
4100
|
}
|
|
4099
4101
|
this.#syncModalBackdrop(false);
|
|
4100
4102
|
this.#$dialog.close();
|
|
4103
|
+
this.#$dialog.style.removeProperty("left");
|
|
4104
|
+
this.#$dialog.style.removeProperty("top");
|
|
4105
|
+
this.#$dialog.style.removeProperty("width");
|
|
4106
|
+
this.#$dialog.style.removeProperty("visibility");
|
|
4101
4107
|
this.#$targetWrapper.setAttribute("aria-expanded", "false");
|
|
4102
4108
|
if (usesShowClosePath) {
|
|
4103
4109
|
activeSlot.removeEventListener("blur", this.#captureActiveElement, true);
|
|
@@ -4126,9 +4132,8 @@ class Pop extends NectaryElement {
|
|
|
4126
4132
|
this.#unsubscribeDocumentDismiss();
|
|
4127
4133
|
if (!effectiveAllowScroll) {
|
|
4128
4134
|
enableOverscroll();
|
|
4129
|
-
} else {
|
|
4130
|
-
this.#unsubscribeScrollTracking();
|
|
4131
4135
|
}
|
|
4136
|
+
this.#unsubscribeScrollTracking();
|
|
4132
4137
|
this.#resizeThrottle.cancel();
|
|
4133
4138
|
this.#scrollPositionThrottle.cancel();
|
|
4134
4139
|
window.removeEventListener("resize", this.#onResize);
|
|
@@ -7175,8 +7180,8 @@ class Input extends NectaryElement {
|
|
|
7175
7180
|
get focusable() {
|
|
7176
7181
|
return true;
|
|
7177
7182
|
}
|
|
7178
|
-
focus() {
|
|
7179
|
-
this.#$input.focus();
|
|
7183
|
+
focus(options) {
|
|
7184
|
+
this.#$input.focus(options);
|
|
7180
7185
|
}
|
|
7181
7186
|
blur() {
|
|
7182
7187
|
this.#$input.blur();
|
|
@@ -7607,7 +7612,7 @@ const getPopOrientation = (orientation) => {
|
|
|
7607
7612
|
}
|
|
7608
7613
|
return orientation;
|
|
7609
7614
|
};
|
|
7610
|
-
const templateHTML$S = '<style>:host{display:contents}#content-wrapper{position:relative;padding-top:4px;width:fit-content;min-width:100%}:host([tip]) #content-wrapper{padding-top:12px;filter:drop-shadow(var(--sinch-comp-popover-shadow))}:host([orientation^=top]) #content-wrapper{padding-top:0;padding-bottom:4px}:host([orientation=left]) #content-wrapper{padding-top:0;padding-right:4px}:host([orientation=right]) #content-wrapper{padding-top:0;padding-left:4px}:host([orientation^=top][tip]) #content-wrapper{padding-top:0;padding-bottom:12px}:host([orientation=left][tip]) #content-wrapper{padding-top:0;padding-right:12px}:host([orientation=right][tip]) #content-wrapper{padding-top:0;padding-left:12px}#content{background-color:var(--sinch-comp-popover-color-default-background-initial);border:1px solid var(--sinch-comp-popover-color-default-border-initial);border-radius:var(--sinch-comp-popover-shape-radius);box-shadow:var(--sinch-comp-popover-shadow);overflow:hidden}:host([tip]) #content{box-shadow:none}#tip{position:absolute;left:50%;top:13px;transform:translateX(-50%) rotate(180deg);transform-origin:top center;fill:var(--sinch-comp-popover-color-default-background-initial);stroke:var(--sinch-comp-popover-color-default-border-initial);stroke-linecap:square;pointer-events:none;display:none}:host([orientation^=top]) #tip{transform:translateX(-50%) rotate(0);top:calc(100% - 13px)}:host([orientation=left]) #tip{transform:translateX(-50%) rotate(-90deg);top:calc(50%);left:calc(100% - 13px)}:host([orientation=right]) #tip{transform:translateX(-50%) rotate(90deg);top:calc(50%);left:13px}:host([tip]) #tip:not(.hidden){display:block}</style><sinch-pop id="pop" inset="4"><slot name="target" slot="target"></slot><div id="content-wrapper" slot="content"><div id="content"><slot name="content"></slot></div><svg id="tip" width="16" height="9" aria-hidden="true"><path d="m0 0 8 8 8 -8"/></svg></div></sinch-pop>';
|
|
7615
|
+
const templateHTML$S = '<style>:host{display:contents}:host(:not([open])) ::slotted([slot=content]){display:none}#content-wrapper{position:relative;padding-top:4px;width:fit-content;min-width:100%}:host([tip]) #content-wrapper{padding-top:12px;filter:drop-shadow(var(--sinch-comp-popover-shadow))}:host([orientation^=top]) #content-wrapper{padding-top:0;padding-bottom:4px}:host([orientation=left]) #content-wrapper{padding-top:0;padding-right:4px}:host([orientation=right]) #content-wrapper{padding-top:0;padding-left:4px}:host([orientation^=top][tip]) #content-wrapper{padding-top:0;padding-bottom:12px}:host([orientation=left][tip]) #content-wrapper{padding-top:0;padding-right:12px}:host([orientation=right][tip]) #content-wrapper{padding-top:0;padding-left:12px}#content{background-color:var(--sinch-comp-popover-color-default-background-initial);border:1px solid var(--sinch-comp-popover-color-default-border-initial);border-radius:var(--sinch-comp-popover-shape-radius);box-shadow:var(--sinch-comp-popover-shadow);overflow:hidden}:host([tip]) #content{box-shadow:none}#tip{position:absolute;left:50%;top:13px;transform:translateX(-50%) rotate(180deg);transform-origin:top center;fill:var(--sinch-comp-popover-color-default-background-initial);stroke:var(--sinch-comp-popover-color-default-border-initial);stroke-linecap:square;pointer-events:none;display:none}:host([orientation^=top]) #tip{transform:translateX(-50%) rotate(0);top:calc(100% - 13px)}:host([orientation=left]) #tip{transform:translateX(-50%) rotate(-90deg);top:calc(50%);left:calc(100% - 13px)}:host([orientation=right]) #tip{transform:translateX(-50%) rotate(90deg);top:calc(50%);left:13px}:host([tip]) #tip:not(.hidden){display:block}</style><sinch-pop id="pop" inset="4"><slot name="target" slot="target"></slot><div id="content-wrapper" slot="content"><div id="content"><slot name="content"></slot></div><svg id="tip" width="16" height="9" aria-hidden="true"><path d="m0 0 8 8 8 -8"/></svg></div></sinch-pop>';
|
|
7611
7616
|
const TIP_SIZE = 16;
|
|
7612
7617
|
const template$S = document.createElement("template");
|
|
7613
7618
|
const isFocusableContent = (element) => {
|
|
@@ -16180,7 +16185,7 @@ class SelectMenu extends NectaryElement {
|
|
|
16180
16185
|
return;
|
|
16181
16186
|
}
|
|
16182
16187
|
this.#$search.getBoundingClientRect();
|
|
16183
|
-
this.#$search.focus();
|
|
16188
|
+
this.#$search.focus({ preventScroll: true });
|
|
16184
16189
|
}
|
|
16185
16190
|
#onListboxBlur = () => {
|
|
16186
16191
|
this.#selectOption(null);
|
|
@@ -16212,7 +16217,7 @@ class SelectMenu extends NectaryElement {
|
|
|
16212
16217
|
} else {
|
|
16213
16218
|
this.#updateSearchValue("");
|
|
16214
16219
|
}
|
|
16215
|
-
this.#$search.focus();
|
|
16220
|
+
this.#$search.focus({ preventScroll: true });
|
|
16216
16221
|
setClass(this.#$searchClear, "active", false);
|
|
16217
16222
|
};
|
|
16218
16223
|
#updateSearchValue = (newValue) => {
|
package/input/index.d.ts
CHANGED
|
@@ -41,6 +41,6 @@ export declare class Input extends NectaryElement {
|
|
|
41
41
|
set selectionDirection(value: HTMLInputElement['selectionDirection']);
|
|
42
42
|
setSelectionRange(selectionStart: number, selectionEnd: number): void;
|
|
43
43
|
get focusable(): boolean;
|
|
44
|
-
focus(): void;
|
|
44
|
+
focus(options?: FocusOptions): void;
|
|
45
45
|
blur(): void;
|
|
46
46
|
}
|
package/input/index.js
CHANGED
package/package.json
CHANGED
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}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;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>';
|
|
12
12
|
const template = document.createElement("template");
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
14
|
class Pop extends NectaryElement {
|
|
@@ -287,8 +287,11 @@ class Pop extends NectaryElement {
|
|
|
287
287
|
this.#$targetWrapper.style.removeProperty("width");
|
|
288
288
|
this.#$targetWrapper.style.removeProperty("height");
|
|
289
289
|
}
|
|
290
|
+
#getScrollTrackingElement() {
|
|
291
|
+
return getFirstSlotElement(this.#$targetSlot, true) ?? getFirstSlotElement(this.#$targetOpenSlot, true) ?? this;
|
|
292
|
+
}
|
|
290
293
|
#subscribeScrollTracking() {
|
|
291
|
-
this.#scrollableParents = getScrollableParents(this.#
|
|
294
|
+
this.#scrollableParents = getScrollableParents(this.#getScrollTrackingElement());
|
|
292
295
|
this.#scrollableParents.forEach((el) => {
|
|
293
296
|
el.addEventListener("scroll", this.#onScrollableParentScroll, { passive: true, capture: true });
|
|
294
297
|
});
|
|
@@ -352,7 +355,7 @@ class Pop extends NectaryElement {
|
|
|
352
355
|
this.#$focus.setAttribute("tabindex", "-1");
|
|
353
356
|
this.#$focus.style.display = "block";
|
|
354
357
|
this.#$focus.addEventListener("focus", this.#captureRelatedActiveElement);
|
|
355
|
-
this.#$focus.focus();
|
|
358
|
+
this.#$focus.focus({ preventScroll: true });
|
|
356
359
|
this.#$focus.removeEventListener("focus", this.#captureRelatedActiveElement);
|
|
357
360
|
this.#$targetSlot.removeEventListener("blur", this.#stopEventPropagation, true);
|
|
358
361
|
this.#$focus.removeAttribute("tabindex");
|
|
@@ -367,7 +370,7 @@ class Pop extends NectaryElement {
|
|
|
367
370
|
this.#updateOrientation();
|
|
368
371
|
this.#resizeObserver.observe(this.#$dialog);
|
|
369
372
|
if (this.modal) {
|
|
370
|
-
getFirstFocusableElement(this.#$contentSlot)?.focus();
|
|
373
|
+
getFirstFocusableElement(this.#$contentSlot)?.focus({ preventScroll: true });
|
|
371
374
|
} else {
|
|
372
375
|
if (!effectiveAllowScroll) {
|
|
373
376
|
this.#prepareTransferredTarget();
|
|
@@ -376,13 +379,13 @@ class Pop extends NectaryElement {
|
|
|
376
379
|
activeSlot.addEventListener("keydown", this.#onTargetKeydown);
|
|
377
380
|
if (this.#targetActiveElement !== null) {
|
|
378
381
|
activeSlot.addEventListener("focus", this.#stopEventPropagation, true);
|
|
379
|
-
this.#targetActiveElement.focus();
|
|
382
|
+
this.#targetActiveElement.focus({ preventScroll: true });
|
|
380
383
|
activeSlot.removeEventListener("focus", this.#stopEventPropagation, true);
|
|
381
384
|
if (!isElementFocused(this.#targetActiveElement)) {
|
|
382
385
|
requestAnimationFrame(() => {
|
|
383
386
|
if (this.isDomConnected && this.#$dialog.open) {
|
|
384
387
|
activeSlot.addEventListener("focus", this.#stopEventPropagation, true);
|
|
385
|
-
this.#targetActiveElement.focus();
|
|
388
|
+
this.#targetActiveElement.focus({ preventScroll: true });
|
|
386
389
|
activeSlot.removeEventListener("focus", this.#stopEventPropagation, true);
|
|
387
390
|
}
|
|
388
391
|
});
|
|
@@ -391,9 +394,8 @@ class Pop extends NectaryElement {
|
|
|
391
394
|
}
|
|
392
395
|
if (!effectiveAllowScroll) {
|
|
393
396
|
disableOverscroll();
|
|
394
|
-
} else {
|
|
395
|
-
this.#subscribeScrollTracking();
|
|
396
397
|
}
|
|
398
|
+
this.#subscribeScrollTracking();
|
|
397
399
|
if (!openAsModal) {
|
|
398
400
|
this.#subscribeDocumentDismiss();
|
|
399
401
|
}
|
|
@@ -423,6 +425,10 @@ class Pop extends NectaryElement {
|
|
|
423
425
|
}
|
|
424
426
|
this.#syncModalBackdrop(false);
|
|
425
427
|
this.#$dialog.close();
|
|
428
|
+
this.#$dialog.style.removeProperty("left");
|
|
429
|
+
this.#$dialog.style.removeProperty("top");
|
|
430
|
+
this.#$dialog.style.removeProperty("width");
|
|
431
|
+
this.#$dialog.style.removeProperty("visibility");
|
|
426
432
|
this.#$targetWrapper.setAttribute("aria-expanded", "false");
|
|
427
433
|
if (usesShowClosePath) {
|
|
428
434
|
activeSlot.removeEventListener("blur", this.#captureActiveElement, true);
|
|
@@ -451,9 +457,8 @@ class Pop extends NectaryElement {
|
|
|
451
457
|
this.#unsubscribeDocumentDismiss();
|
|
452
458
|
if (!effectiveAllowScroll) {
|
|
453
459
|
enableOverscroll();
|
|
454
|
-
} else {
|
|
455
|
-
this.#unsubscribeScrollTracking();
|
|
456
460
|
}
|
|
461
|
+
this.#unsubscribeScrollTracking();
|
|
457
462
|
this.#resizeThrottle.cancel();
|
|
458
463
|
this.#scrollPositionThrottle.cancel();
|
|
459
464
|
window.removeEventListener("resize", this.#onResize);
|
package/popover/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { defineCustomElement, NectaryElement } from "../utils/element.js";
|
|
|
5
5
|
import { rectOverlap } from "../utils/rect.js";
|
|
6
6
|
import { getReactEventHandler } from "../utils/get-react-event-handler.js";
|
|
7
7
|
import { getPopOrientation, orientationValues } from "./utils.js";
|
|
8
|
-
const templateHTML = '<style>:host{display:contents}#content-wrapper{position:relative;padding-top:4px;width:fit-content;min-width:100%}:host([tip]) #content-wrapper{padding-top:12px;filter:drop-shadow(var(--sinch-comp-popover-shadow))}:host([orientation^=top]) #content-wrapper{padding-top:0;padding-bottom:4px}:host([orientation=left]) #content-wrapper{padding-top:0;padding-right:4px}:host([orientation=right]) #content-wrapper{padding-top:0;padding-left:4px}:host([orientation^=top][tip]) #content-wrapper{padding-top:0;padding-bottom:12px}:host([orientation=left][tip]) #content-wrapper{padding-top:0;padding-right:12px}:host([orientation=right][tip]) #content-wrapper{padding-top:0;padding-left:12px}#content{background-color:var(--sinch-comp-popover-color-default-background-initial);border:1px solid var(--sinch-comp-popover-color-default-border-initial);border-radius:var(--sinch-comp-popover-shape-radius);box-shadow:var(--sinch-comp-popover-shadow);overflow:hidden}:host([tip]) #content{box-shadow:none}#tip{position:absolute;left:50%;top:13px;transform:translateX(-50%) rotate(180deg);transform-origin:top center;fill:var(--sinch-comp-popover-color-default-background-initial);stroke:var(--sinch-comp-popover-color-default-border-initial);stroke-linecap:square;pointer-events:none;display:none}:host([orientation^=top]) #tip{transform:translateX(-50%) rotate(0);top:calc(100% - 13px)}:host([orientation=left]) #tip{transform:translateX(-50%) rotate(-90deg);top:calc(50%);left:calc(100% - 13px)}:host([orientation=right]) #tip{transform:translateX(-50%) rotate(90deg);top:calc(50%);left:13px}:host([tip]) #tip:not(.hidden){display:block}</style><sinch-pop id="pop" inset="4"><slot name="target" slot="target"></slot><div id="content-wrapper" slot="content"><div id="content"><slot name="content"></slot></div><svg id="tip" width="16" height="9" aria-hidden="true"><path d="m0 0 8 8 8 -8"/></svg></div></sinch-pop>';
|
|
8
|
+
const templateHTML = '<style>:host{display:contents}:host(:not([open])) ::slotted([slot=content]){display:none}#content-wrapper{position:relative;padding-top:4px;width:fit-content;min-width:100%}:host([tip]) #content-wrapper{padding-top:12px;filter:drop-shadow(var(--sinch-comp-popover-shadow))}:host([orientation^=top]) #content-wrapper{padding-top:0;padding-bottom:4px}:host([orientation=left]) #content-wrapper{padding-top:0;padding-right:4px}:host([orientation=right]) #content-wrapper{padding-top:0;padding-left:4px}:host([orientation^=top][tip]) #content-wrapper{padding-top:0;padding-bottom:12px}:host([orientation=left][tip]) #content-wrapper{padding-top:0;padding-right:12px}:host([orientation=right][tip]) #content-wrapper{padding-top:0;padding-left:12px}#content{background-color:var(--sinch-comp-popover-color-default-background-initial);border:1px solid var(--sinch-comp-popover-color-default-border-initial);border-radius:var(--sinch-comp-popover-shape-radius);box-shadow:var(--sinch-comp-popover-shadow);overflow:hidden}:host([tip]) #content{box-shadow:none}#tip{position:absolute;left:50%;top:13px;transform:translateX(-50%) rotate(180deg);transform-origin:top center;fill:var(--sinch-comp-popover-color-default-background-initial);stroke:var(--sinch-comp-popover-color-default-border-initial);stroke-linecap:square;pointer-events:none;display:none}:host([orientation^=top]) #tip{transform:translateX(-50%) rotate(0);top:calc(100% - 13px)}:host([orientation=left]) #tip{transform:translateX(-50%) rotate(-90deg);top:calc(50%);left:calc(100% - 13px)}:host([orientation=right]) #tip{transform:translateX(-50%) rotate(90deg);top:calc(50%);left:13px}:host([tip]) #tip:not(.hidden){display:block}</style><sinch-pop id="pop" inset="4"><slot name="target" slot="target"></slot><div id="content-wrapper" slot="content"><div id="content"><slot name="content"></slot></div><svg id="tip" width="16" height="9" aria-hidden="true"><path d="m0 0 8 8 8 -8"/></svg></div></sinch-pop>';
|
|
9
9
|
const TIP_SIZE = 16;
|
|
10
10
|
const template = document.createElement("template");
|
|
11
11
|
const isFocusableContent = (element) => {
|
package/select-menu/index.js
CHANGED
|
@@ -258,7 +258,7 @@ class SelectMenu extends NectaryElement {
|
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
260
|
this.#$search.getBoundingClientRect();
|
|
261
|
-
this.#$search.focus();
|
|
261
|
+
this.#$search.focus({ preventScroll: true });
|
|
262
262
|
}
|
|
263
263
|
#onListboxBlur = () => {
|
|
264
264
|
this.#selectOption(null);
|
|
@@ -290,7 +290,7 @@ class SelectMenu extends NectaryElement {
|
|
|
290
290
|
} else {
|
|
291
291
|
this.#updateSearchValue("");
|
|
292
292
|
}
|
|
293
|
-
this.#$search.focus();
|
|
293
|
+
this.#$search.focus({ preventScroll: true });
|
|
294
294
|
setClass(this.#$searchClear, "active", false);
|
|
295
295
|
};
|
|
296
296
|
#updateSearchValue = (newValue) => {
|