@dosgato/dialog 0.0.70 → 0.0.72
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
CHANGED
|
@@ -85,7 +85,7 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
|
|
|
85
85
|
section.normal {
|
|
86
86
|
width: 75vw;
|
|
87
87
|
min-width: 250px;
|
|
88
|
-
max-width:
|
|
88
|
+
max-width: 750px;
|
|
89
89
|
}
|
|
90
90
|
section.large {
|
|
91
91
|
width: 90vw;
|
|
@@ -113,13 +113,17 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
|
|
|
113
113
|
|
|
114
114
|
.dialog-content {
|
|
115
115
|
position: relative;
|
|
116
|
-
padding:
|
|
116
|
+
padding: 0 2em;
|
|
117
117
|
min-height: 5em;
|
|
118
118
|
overflow: auto;
|
|
119
119
|
background-color: var(--dg-dialog-content-bg, #f4f4f4);
|
|
120
120
|
max-height: calc(100vh - 7em);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
section.tiny .dialog-content, section.small .dialog-content {
|
|
124
|
+
padding: 0 1em;
|
|
125
|
+
}
|
|
126
|
+
|
|
123
127
|
footer {
|
|
124
128
|
display: flex;
|
|
125
129
|
align-items: center;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>import arrowClockwiseFill from '@iconify-icons/ph/arrow-clockwise-fill';
|
|
2
2
|
import deleteOutline from '@iconify-icons/mdi/delete-outline';
|
|
3
|
+
import xCircle from '@iconify-icons/ph/x-circle';
|
|
3
4
|
import { FORM_CONTEXT, FORM_INHERITED_PATH } from '@txstate-mws/svelte-forms';
|
|
4
5
|
import { getContext } from 'svelte';
|
|
5
6
|
import { isBlank, isNotBlank, randomid } from 'txstate-utils';
|
|
@@ -32,6 +33,7 @@ const finalPath = [inheritedPath, path].filter(isNotBlank).join('.');
|
|
|
32
33
|
const value = formStore.getField(finalPath);
|
|
33
34
|
const chooserClient = getContext(CHOOSER_API_CONTEXT);
|
|
34
35
|
const store = new ChooserStore(chooserClient);
|
|
36
|
+
let urlEntryInput;
|
|
35
37
|
const descid = randomid();
|
|
36
38
|
let modalshown = false;
|
|
37
39
|
async function show() {
|
|
@@ -49,6 +51,10 @@ function onChange(setVal) {
|
|
|
49
51
|
hide();
|
|
50
52
|
};
|
|
51
53
|
}
|
|
54
|
+
function clearUrlEntry() {
|
|
55
|
+
urlEntryInput.value = '';
|
|
56
|
+
urlEntryInput.dispatchEvent(new InputEvent('input'));
|
|
57
|
+
}
|
|
52
58
|
let timer;
|
|
53
59
|
function userUrlEntry() {
|
|
54
60
|
clearTimeout(timer);
|
|
@@ -153,7 +159,7 @@ $: updateSelected($value);
|
|
|
153
159
|
|
|
154
160
|
<FieldStandard bind:id {path} {descid} {label} {defaultValue} {conditional} {required} {related} {helptext} let:value let:messagesid let:helptextid let:valid let:invalid let:id let:onBlur let:setVal>
|
|
155
161
|
{#if selectedAsset?.id}
|
|
156
|
-
<div class="dialog-chooser-container">
|
|
162
|
+
<div class="dialog-chooser-container" class:urlEntry>
|
|
157
163
|
<Thumbnail item={selectedAsset} />
|
|
158
164
|
<div class="dialog-chooser-right">
|
|
159
165
|
<Details item={selectedAsset} singleLine />
|
|
@@ -161,17 +167,20 @@ $: updateSelected($value);
|
|
|
161
167
|
<button type="button" on:click={show} aria-describedby={getDescribedBy([descid, messagesid, helptextid, extradescid])}>
|
|
162
168
|
<Icon icon={arrowClockwiseFill} /> Replace
|
|
163
169
|
</button>
|
|
170
|
+
<button type="button" on:click={() => { selectedAsset = undefined; setVal(undefined) }} aria-describedby={getDescribedBy([descid, messagesid, helptextid, extradescid])}>
|
|
171
|
+
<Icon icon={deleteOutline} inline /> Remove
|
|
172
|
+
</button>
|
|
164
173
|
{/if}
|
|
165
|
-
<button type="button" on:click={() => { selectedAsset = undefined; setVal(undefined) }} aria-describedby={getDescribedBy([descid, messagesid, helptextid, extradescid])}>
|
|
166
|
-
<Icon icon={deleteOutline} /> Remove
|
|
167
|
-
</button>
|
|
168
174
|
</div>
|
|
169
175
|
</div>
|
|
170
176
|
{/if}
|
|
171
177
|
{#if urlEntry || !selectedAsset?.id}
|
|
172
178
|
<div class="dialog-chooser-entry">
|
|
173
179
|
{#if urlEntry}
|
|
174
|
-
<
|
|
180
|
+
<div class="dialog-chooser-entry-input">
|
|
181
|
+
<input bind:this={urlEntryInput} type="text" data-lpignore="true" value={selectedAsset?.url ?? ''} on:change={userUrlEntry} on:input={userUrlEntry}>
|
|
182
|
+
<button type="button" on:click={clearUrlEntry}><Icon icon={xCircle} hiddenLabel="clear input" inline/></button>
|
|
183
|
+
</div>
|
|
175
184
|
{/if}
|
|
176
185
|
<button type="button" on:click={show} aria-describedby={getDescribedBy([descid, messagesid, helptextid, extradescid])}>Select {#if value}New{/if} {#if assets && pages}Link Target{:else if images}Image{:else if assets}Asset{:else}Page{/if}</button>
|
|
177
186
|
</div>
|
|
@@ -190,23 +199,57 @@ $: updateSelected($value);
|
|
|
190
199
|
flex-wrap: wrap;
|
|
191
200
|
margin-bottom: 0.25em;
|
|
192
201
|
font-size: 0.9em;
|
|
202
|
+
align-items: center;
|
|
193
203
|
}
|
|
194
204
|
div.dialog-chooser-container > :global(.dialog-chooser-thumbnail) {
|
|
195
205
|
width: 8em;
|
|
196
206
|
padding-top: 0;
|
|
197
207
|
height: 5em;
|
|
198
208
|
}
|
|
209
|
+
div.dialog-chooser-container.urlEntry > :global(.dialog-chooser-thumbnail) {
|
|
210
|
+
width: 3em;
|
|
211
|
+
padding-top: 0;
|
|
212
|
+
height: 3em;
|
|
213
|
+
}
|
|
199
214
|
.dialog-chooser-right {
|
|
215
|
+
max-width: calc(100% - 8.5em);
|
|
200
216
|
flex-grow: 1;
|
|
201
217
|
}
|
|
202
218
|
.dialog-chooser-right button {
|
|
203
219
|
margin-top: 0.5em;
|
|
220
|
+
border: 0;
|
|
221
|
+
font-weight: bold;
|
|
222
|
+
border-radius: 0.2em;
|
|
223
|
+
cursor: pointer;
|
|
224
|
+
padding: 0.4em;
|
|
225
|
+
background: none;
|
|
226
|
+
}
|
|
227
|
+
.dialog-chooser-right button:hover {
|
|
228
|
+
background-color: #cccccc;
|
|
204
229
|
}
|
|
205
230
|
.dialog-chooser-entry {
|
|
206
231
|
display: flex;
|
|
232
|
+
align-items: flex-start;
|
|
233
|
+
margin-top: 0.2em;
|
|
207
234
|
}
|
|
208
|
-
input {
|
|
235
|
+
.dialog-chooser-entry-input {
|
|
236
|
+
position: relative;
|
|
209
237
|
flex-grow: 1;
|
|
210
238
|
}
|
|
239
|
+
.dialog-chooser-entry-input input {
|
|
240
|
+
width: 100%;
|
|
241
|
+
padding-right: 1.4em;
|
|
242
|
+
}
|
|
243
|
+
.dialog-chooser-entry-input button {
|
|
244
|
+
display: block;
|
|
245
|
+
border: 0;
|
|
246
|
+
background: none;
|
|
247
|
+
position: absolute;
|
|
248
|
+
top: 50%;
|
|
249
|
+
right: 0;
|
|
250
|
+
transform: translateY(-50%);
|
|
251
|
+
cursor: pointer;
|
|
252
|
+
line-height: 1;
|
|
253
|
+
}
|
|
211
254
|
|
|
212
255
|
</style>
|
package/dist/Form.svelte
CHANGED
|
@@ -15,20 +15,22 @@ setContext(CHOOSER_API_CONTEXT, chooserClient);
|
|
|
15
15
|
|
|
16
16
|
<Form bind:store class="{className} dialog-form" {submit} {validate} on:saved {autocomplete} {name} {preload} let:messages let:allMessages let:showingInlineErrors let:saved let:valid let:invalid let:validating let:submitting let:data>
|
|
17
17
|
<slot {messages} {saved} {validating} {submitting} {valid} {invalid} {data} {allMessages} {showingInlineErrors} />
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
{#if messages.length || showingInlineErrors}
|
|
19
|
+
<div class="form-errors" aria-live='assertive'>
|
|
20
|
+
{#if messages.length}
|
|
21
|
+
<ul>
|
|
22
|
+
{#each messages as message}
|
|
23
|
+
<li>{message.message}</li>
|
|
24
|
+
{/each}
|
|
25
|
+
{#if showingInlineErrors}
|
|
26
|
+
<li>More errors. See inline messages for details.</li>
|
|
27
|
+
{/if}
|
|
28
|
+
</ul>
|
|
29
|
+
{:else if showingInlineErrors}
|
|
30
|
+
This form contains validation errors. See inline messages for details.
|
|
31
|
+
{/if}
|
|
32
|
+
</div>
|
|
33
|
+
{/if}
|
|
32
34
|
<slot name="submit" {saved} {validating} {submitting} {valid} {invalid} {allMessages} {showingInlineErrors} />
|
|
33
35
|
</Form>
|
|
34
36
|
|
package/dist/Tab.svelte
CHANGED
|
@@ -31,7 +31,7 @@ const last = idx === $store.tabs.length - 1;
|
|
|
31
31
|
width: 100%;
|
|
32
32
|
min-height: 50vh;
|
|
33
33
|
border: var(--tabs-panel-border, var(--tabs-border, 0));
|
|
34
|
-
padding: var(--tabs-margin-top,
|
|
34
|
+
padding: var(--tabs-margin-top, 1.5em) var(--tabs-padding-hori, 0.7em) 0.5em var(--tabs-padding-hori, 0.7em);
|
|
35
35
|
}
|
|
36
36
|
.tabs-panel.accordion {
|
|
37
37
|
border-left: 0;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import browserIcon from '@iconify-icons/ph/browser';
|
|
2
2
|
import folderIcon from '@iconify-icons/ph/folder';
|
|
3
3
|
import folderNotchOpen from '@iconify-icons/ph/folder-notch-open';
|
|
4
4
|
import { createEventDispatcher, getContext, onMount, setContext } from 'svelte';
|
|
5
|
-
import { isNotBlank, randomid
|
|
5
|
+
import { isNotBlank, randomid } from 'txstate-utils';
|
|
6
6
|
import { Button, Dialog, iconForMime, Tabs, Tree, UploadUI } from '..';
|
|
7
7
|
import { CHOOSER_API_CONTEXT } from './ChooserAPI';
|
|
8
8
|
import { CHOOSER_STORE_CONTEXT, ChooserStore } from './ChooserStore';
|
|
@@ -90,7 +90,7 @@ const previewId = randomid();
|
|
|
90
90
|
<section class="dialog-chooser-chooser">
|
|
91
91
|
{#if $store.initialized}
|
|
92
92
|
<Tree headers={[
|
|
93
|
-
{ label: 'Path', id: 'name', grow: 4, icon: item => ({ icon: item.type === 'asset' ? iconForMime(item.mime) : (item.type === 'folder' ? (item.open ? folderNotchOpen : folderIcon) :
|
|
93
|
+
{ label: 'Path', id: 'name', grow: 4, icon: item => ({ icon: item.type === 'asset' ? iconForMime(item.mime) : (item.type === 'folder' ? (item.open ? folderNotchOpen : folderIcon) : browserIcon) }), get: 'name' }
|
|
94
94
|
]} singleSelect store={treeStore} on:deselect={onDeselect} on:choose={onChoose} />
|
|
95
95
|
{/if}
|
|
96
96
|
</section>
|
|
@@ -58,7 +58,7 @@ export let singleLine = false;
|
|
|
58
58
|
display: flex;
|
|
59
59
|
flex-wrap: wrap;
|
|
60
60
|
justify-content: flex-start;
|
|
61
|
-
gap: 1em
|
|
61
|
+
gap: 1em;
|
|
62
62
|
padding: 0;
|
|
63
63
|
margin: 0;
|
|
64
64
|
list-style: none;
|
|
@@ -76,7 +76,7 @@ export let singleLine = false;
|
|
|
76
76
|
max-width: calc(100% - 9em);
|
|
77
77
|
}
|
|
78
78
|
dl.asset .top-row {
|
|
79
|
-
max-width:
|
|
79
|
+
max-width: 30em;
|
|
80
80
|
white-space: nowrap;
|
|
81
81
|
text-overflow: ellipsis;
|
|
82
82
|
}
|
|
@@ -33,10 +33,8 @@ export let larger = false;
|
|
|
33
33
|
object-fit: scale-down;
|
|
34
34
|
}
|
|
35
35
|
.dialog-chooser-thumbnail :global(svg) {
|
|
36
|
-
width:
|
|
37
|
-
height:
|
|
38
|
-
min-width: 4.5em;
|
|
39
|
-
min-height: 4.5em;
|
|
36
|
+
width: 80%;
|
|
37
|
+
height: 80%;
|
|
40
38
|
object-fit: scale-down;
|
|
41
39
|
}
|
|
42
40
|
.dialog-chooser-thumbnail > :global(*) {
|
package/package.json
CHANGED