@geoffcox/sterling-svelte 2.0.16 → 2.0.17
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/dist/Dialog.svelte +32 -59
- package/dist/Select.svelte +7 -1
- package/package.json +2 -2
package/dist/Dialog.svelte
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { onMount, setContext, tick } from 'svelte';
|
|
5
|
-
import type { FormEventHandler } from 'svelte/elements';
|
|
6
5
|
import Button from './Button.svelte';
|
|
7
6
|
import { STERLING_PORTAL_CONTEXT_ID } from './Portal.constants';
|
|
8
7
|
import type { PortalContext } from './Portal.types';
|
|
@@ -25,7 +24,6 @@
|
|
|
25
24
|
|
|
26
25
|
let dialogRef: HTMLDialogElement;
|
|
27
26
|
let contentRef: HTMLDivElement;
|
|
28
|
-
let formRef: HTMLFormElement;
|
|
29
27
|
|
|
30
28
|
// svelte-ignore non_reactive_update
|
|
31
29
|
let closing = false;
|
|
@@ -103,29 +101,6 @@
|
|
|
103
101
|
return false;
|
|
104
102
|
};
|
|
105
103
|
|
|
106
|
-
const onSubmit: FormEventHandler<HTMLFormElement> = (event) => {
|
|
107
|
-
// Submitting a form instantly hides the dialog.
|
|
108
|
-
// The dialog.close event is not cancellable, but form.submit is.
|
|
109
|
-
// To allow animation with closeDialog, this event is canceled.
|
|
110
|
-
// The form is resubmitted after the dialog closes to ensure the form is in the correct state.
|
|
111
|
-
const anyEvent = event as unknown as any;
|
|
112
|
-
if (anyEvent?.submitter.type === 'submit') {
|
|
113
|
-
if (dialogRef.open) {
|
|
114
|
-
const eventSubmitter = anyEvent?.submitter;
|
|
115
|
-
returnValue = eventSubmitter?.value ?? '';
|
|
116
|
-
closeDialog();
|
|
117
|
-
setTimeout(() => {
|
|
118
|
-
formRef.requestSubmit(eventSubmitter);
|
|
119
|
-
}, dialogFadeDuration);
|
|
120
|
-
event.preventDefault();
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
event.preventDefault();
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
104
|
$effect(() => {
|
|
130
105
|
updateDialog(open);
|
|
131
106
|
});
|
|
@@ -153,39 +128,37 @@
|
|
|
153
128
|
class:closing
|
|
154
129
|
{...rest}
|
|
155
130
|
>
|
|
156
|
-
<
|
|
157
|
-
|
|
158
|
-
{
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
{
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
{#if headerTitle}
|
|
167
|
-
{
|
|
168
|
-
|
|
169
|
-
{
|
|
170
|
-
{@render headerTitle()}
|
|
171
|
-
{/if}
|
|
131
|
+
<div class="content" bind:this={contentRef}>
|
|
132
|
+
{#if content}
|
|
133
|
+
{@render content()}
|
|
134
|
+
{:else}
|
|
135
|
+
<div class="header">
|
|
136
|
+
{#if header}
|
|
137
|
+
{@render header()}
|
|
138
|
+
{:else}
|
|
139
|
+
<div class="title">
|
|
140
|
+
{#if headerTitle}
|
|
141
|
+
{#if typeof headerTitle === 'string'}
|
|
142
|
+
{headerTitle}
|
|
143
|
+
{:else}
|
|
144
|
+
{@render headerTitle()}
|
|
172
145
|
{/if}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
</
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
</
|
|
146
|
+
{/if}
|
|
147
|
+
</div>
|
|
148
|
+
<div class="close">
|
|
149
|
+
<Button class="circular tool" onclick={() => closeDialog()}>
|
|
150
|
+
<div class="close-x"></div>
|
|
151
|
+
</Button>
|
|
152
|
+
</div>
|
|
153
|
+
{/if}
|
|
154
|
+
</div>
|
|
155
|
+
<div class="body">
|
|
156
|
+
{@render body?.()}
|
|
157
|
+
</div>
|
|
158
|
+
<div class="separator"></div>
|
|
159
|
+
<div class="footer">
|
|
160
|
+
{@render footer?.()}
|
|
161
|
+
</div>
|
|
162
|
+
{/if}
|
|
163
|
+
</div>
|
|
191
164
|
</dialog>
|
package/dist/Select.svelte
CHANGED
|
@@ -222,7 +222,13 @@
|
|
|
222
222
|
<div class="chevron"></div>
|
|
223
223
|
{/if}
|
|
224
224
|
</div>
|
|
225
|
-
<Popover
|
|
225
|
+
<Popover
|
|
226
|
+
id={popoverId}
|
|
227
|
+
placement="bottom-start"
|
|
228
|
+
reference={selectRef}
|
|
229
|
+
bind:open
|
|
230
|
+
conditionalRender={false}
|
|
231
|
+
>
|
|
226
232
|
<div class={['sterling-select-popup-content', 'sterling-select-content', _class]}>
|
|
227
233
|
<List
|
|
228
234
|
bind:this={listRef}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geoffcox/sterling-svelte",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"author": "Geoff Cox",
|
|
5
5
|
"description": "A modern, accessible, and lightweight component library for Svelte.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@eslint/js": "^9.18.0",
|
|
75
75
|
"@fontsource/atkinson-hyperlegible": "^5.1.1",
|
|
76
76
|
"@fontsource/source-code-pro": "^4.5.14",
|
|
77
|
-
"@geoffcox/sterling-svelte-themes": "^2.0.
|
|
77
|
+
"@geoffcox/sterling-svelte-themes": "^2.0.16",
|
|
78
78
|
"@sveltejs/adapter-static": "^3.0.8",
|
|
79
79
|
"@sveltejs/kit": "^2.16.0",
|
|
80
80
|
"@sveltejs/package": "^2.0.0",
|