@skeletonlabs/skeleton 2.6.1-dev.c5e85245 → 2.6.1-dev.ea10993e
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.
|
@@ -31,7 +31,7 @@ export let transitionIn = fly;
|
|
|
31
31
|
export let transitionInParams = { duration: 150, opacity: 0, x: 0, y: 100 };
|
|
32
32
|
export let transitionOut = fly;
|
|
33
33
|
export let transitionOutParams = { duration: 150, opacity: 0, x: 0, y: 100 };
|
|
34
|
-
const cBackdrop = "fixed top-0 left-0 right-0 bottom-0";
|
|
34
|
+
const cBackdrop = "fixed top-0 left-0 right-0 bottom-0 overflow-y-auto";
|
|
35
35
|
const cTransitionLayer = "w-full h-fit min-h-full p-4 overflow-y-auto flex justify-center";
|
|
36
36
|
const cModal = "block overflow-y-auto";
|
|
37
37
|
const cModalImage = "w-full h-auto";
|
|
@@ -43,9 +43,6 @@ const buttonTextDefaults = {
|
|
|
43
43
|
};
|
|
44
44
|
let currentComponent;
|
|
45
45
|
let registeredInteractionWithBackdrop = false;
|
|
46
|
-
let modalElement;
|
|
47
|
-
let windowHeight;
|
|
48
|
-
let backdropOverflow = "overflow-y-hidden";
|
|
49
46
|
const modalStore = getModalStore();
|
|
50
47
|
modalStore.subscribe((modals) => {
|
|
51
48
|
if (!modals.length)
|
|
@@ -57,20 +54,6 @@ modalStore.subscribe((modals) => {
|
|
|
57
54
|
buttonTextSubmit = modals[0].buttonTextSubmit || buttonTextDefaults.buttonTextSubmit;
|
|
58
55
|
currentComponent = typeof modals[0].component === "string" ? components[modals[0].component] : modals[0].component;
|
|
59
56
|
});
|
|
60
|
-
function onModalHeightChange(modal) {
|
|
61
|
-
let modalHeight = modal?.clientHeight;
|
|
62
|
-
if (!modalHeight)
|
|
63
|
-
modalHeight = modal?.firstChild?.clientHeight;
|
|
64
|
-
if (!modalHeight)
|
|
65
|
-
return;
|
|
66
|
-
if (modalHeight > windowHeight) {
|
|
67
|
-
backdropOverflow = "overflow-y-auto";
|
|
68
|
-
} else {
|
|
69
|
-
backdropOverflow = "overflow-y-hidden";
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
$:
|
|
73
|
-
onModalHeightChange(modalElement);
|
|
74
57
|
function onBackdropInteractionBegin(event) {
|
|
75
58
|
if (!(event.target instanceof Element))
|
|
76
59
|
return;
|
|
@@ -148,7 +131,7 @@ $:
|
|
|
148
131
|
};
|
|
149
132
|
</script>
|
|
150
133
|
|
|
151
|
-
<svelte:window
|
|
134
|
+
<svelte:window on:keydown={onKeyDown} />
|
|
152
135
|
|
|
153
136
|
{#if $modalStore.length > 0}
|
|
154
137
|
{#key $modalStore}
|
|
@@ -156,7 +139,7 @@ $:
|
|
|
156
139
|
<!-- FIXME: resolve a11y warnings -->
|
|
157
140
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
158
141
|
<div
|
|
159
|
-
class="modal-backdrop {classesBackdrop}
|
|
142
|
+
class="modal-backdrop {classesBackdrop}"
|
|
160
143
|
data-testid="modal-backdrop"
|
|
161
144
|
on:mousedown={onBackdropInteractionBegin}
|
|
162
145
|
on:mouseup={onBackdropInteractionEnd}
|
|
@@ -173,14 +156,7 @@ $:
|
|
|
173
156
|
>
|
|
174
157
|
{#if $modalStore[0].type !== 'component'}
|
|
175
158
|
<!-- Modal: Presets -->
|
|
176
|
-
<div
|
|
177
|
-
class="modal {classesModal}"
|
|
178
|
-
bind:this={modalElement}
|
|
179
|
-
data-testid="modal"
|
|
180
|
-
role="dialog"
|
|
181
|
-
aria-modal="true"
|
|
182
|
-
aria-label={$modalStore[0].title ?? ''}
|
|
183
|
-
>
|
|
159
|
+
<div class="modal {classesModal}" data-testid="modal" role="dialog" aria-modal="true" aria-label={$modalStore[0].title ?? ''}>
|
|
184
160
|
<!-- Header -->
|
|
185
161
|
{#if $modalStore[0]?.title}
|
|
186
162
|
<header class="modal-header {regionHeader}">{@html $modalStore[0].title}</header>
|
|
@@ -220,7 +196,6 @@ $:
|
|
|
220
196
|
<!-- Modal: Components -->
|
|
221
197
|
<!-- Note: keep `contents` class to allow widths from children -->
|
|
222
198
|
<div
|
|
223
|
-
bind:this={modalElement}
|
|
224
199
|
class="modal contents {$modalStore[0]?.modalClasses ?? ''}"
|
|
225
200
|
data-testid="modal-component"
|
|
226
201
|
role="dialog"
|