@dosgato/dialog 1.0.3 → 1.0.5
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 +11 -1
- package/dist/FieldIdentifier.svelte +12 -1
- package/dist/Tabs.svelte +17 -2
- package/dist/chooser/Chooser.svelte +5 -85
- package/dist/chooser/ChooserPreview.svelte +145 -0
- package/dist/chooser/ChooserPreview.svelte.d.ts +21 -0
- package/dist/chooser/Details.svelte +1 -1
- package/dist/chooser/Thumbnail.svelte +1 -1
- package/dist/chooser/Thumbnail.svelte.d.ts +1 -1
- package/dist/colorpicker/FieldColorPicker.svelte +35 -19
- package/package.json +3 -3
package/dist/Dialog.svelte
CHANGED
|
@@ -65,7 +65,7 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
|
|
|
65
65
|
<Button cancel {describedby} on:click={() => dispatch('escape')}>{cancelText}</Button>
|
|
66
66
|
{/if}
|
|
67
67
|
{#if isNotBlank(continueText)}
|
|
68
|
-
<Button class="primary" disabled={disabled || (hasRequired && !ignoreTabs)} {describedby} on:click={() => dispatch('continue')}><Icon icon={continueIcon} inline />{continueText}</Button>
|
|
68
|
+
<Button class="primary" disabled={disabled || (hasRequired && !ignoreTabs)} {describedby} on:click={() => dispatch('continue')}><Icon icon={continueIcon} inline /> {continueText}</Button>
|
|
69
69
|
{/if}
|
|
70
70
|
{#if nextTitle && !ignoreTabs}
|
|
71
71
|
<Button class="next" disabled={!nextTitle} on:click={onNext}>Next<ScreenReaderOnly> Tab ({nextTitle})</ScreenReaderOnly> <Icon width="1.2em" icon={arrowRightLight} inline /></Button>
|
|
@@ -106,6 +106,16 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
|
|
|
106
106
|
max-width: 2000px;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
@media (max-width: 430px) {
|
|
110
|
+
section.tiny, section.small, section.normal, section.large, section.xl {
|
|
111
|
+
width: 95vw;
|
|
112
|
+
max-width: 2000px;
|
|
113
|
+
}
|
|
114
|
+
button.expand {
|
|
115
|
+
display: none;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
109
119
|
header {
|
|
110
120
|
display: flex;
|
|
111
121
|
align-items: center;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
<script>import { Field, nullableSerialize, nullableDeserialize } from '@txstate-mws/svelte-forms';
|
|
2
2
|
import { randomid } from 'txstate-utils';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
3
4
|
export let path;
|
|
4
5
|
export let conditional = undefined;
|
|
5
6
|
export let length = 10;
|
|
7
|
+
let val, stVal;
|
|
8
|
+
function updateValue(valu, sVal) {
|
|
9
|
+
val = valu;
|
|
10
|
+
stVal = sVal;
|
|
11
|
+
}
|
|
12
|
+
onMount(() => {
|
|
13
|
+
if (!val)
|
|
14
|
+
stVal(randomid(length));
|
|
15
|
+
});
|
|
6
16
|
</script>
|
|
7
17
|
|
|
8
|
-
<Field {path} {conditional} defaultValue={randomid(length)} serialize={nullableSerialize} deserialize={nullableDeserialize} let:value>
|
|
18
|
+
<Field {path} {conditional} defaultValue={randomid(length)} serialize={nullableSerialize} deserialize={nullableDeserialize} let:value let:setVal>
|
|
19
|
+
{@const _ = updateValue(value, setVal)}
|
|
9
20
|
<input type="hidden" name={path} {value}>
|
|
10
21
|
</Field>
|
package/dist/Tabs.svelte
CHANGED
|
@@ -143,7 +143,22 @@ onMount(reactToCurrent);
|
|
|
143
143
|
font-weight: 700;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
.
|
|
146
|
+
li.active span {
|
|
147
|
+
position: relative;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
li.active span:after {
|
|
151
|
+
content: '';
|
|
152
|
+
position: absolute;
|
|
153
|
+
height: 3px;
|
|
154
|
+
background-color: var(--dg-tabs-active, var(--dg-button-bg, #501214));
|
|
155
|
+
width: 100%;
|
|
156
|
+
left: 0;
|
|
157
|
+
bottom: -3px;
|
|
158
|
+
border-radius: 2px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* .tabs-active {
|
|
147
162
|
background: var(--dg-tabs-active, var(--dg-button-bg, #501214));
|
|
148
163
|
height: 3px;
|
|
149
164
|
border-radius: 2px;
|
|
@@ -157,6 +172,6 @@ onMount(reactToCurrent);
|
|
|
157
172
|
.tabs-active {
|
|
158
173
|
transition: none;
|
|
159
174
|
}
|
|
160
|
-
}
|
|
175
|
+
} */
|
|
161
176
|
|
|
162
177
|
</style>
|
|
@@ -8,6 +8,7 @@ import { CHOOSER_API_CONTEXT } from './ChooserAPI';
|
|
|
8
8
|
import { CHOOSER_STORE_CONTEXT, ChooserStore } from './ChooserStore';
|
|
9
9
|
import Details from './Details.svelte';
|
|
10
10
|
import Thumbnail from './Thumbnail.svelte';
|
|
11
|
+
import ChooserPreview from './ChooserPreview.svelte';
|
|
11
12
|
const chooserClient = getContext(CHOOSER_API_CONTEXT);
|
|
12
13
|
export let label = undefined;
|
|
13
14
|
export let images = false;
|
|
@@ -84,11 +85,11 @@ let thumbnailExpanded = false;
|
|
|
84
85
|
|
|
85
86
|
<Dialog size="xl" ignoreTabs title={label} on:escape continueText="Choose" disabled={!$preview && required} cancelText="Cancel">
|
|
86
87
|
<section class="dialog-chooser-window">
|
|
88
|
+
{#if $sources.length > 1}
|
|
87
89
|
<header class="dialog-chooser-controls">
|
|
88
|
-
{
|
|
89
|
-
<Tabs bind:store={tabStore} tabs={$sources.map(s => ({ name: s.name, title: s.label ?? s.name }))} active={$preview?.source ?? $selected?.source ?? $source?.name ?? initialSource} accordionOnMobile={false}/>
|
|
90
|
-
{/if}
|
|
90
|
+
<Tabs bind:store={tabStore} tabs={$sources.map(s => ({ name: s.name, title: s.label ?? s.name }))} active={$preview?.source ?? $selected?.source ?? $source?.name ?? initialSource} accordionOnMobile={false}/>
|
|
91
91
|
</header>
|
|
92
|
+
{/if}
|
|
92
93
|
<section class="dialog-chooser-chooser">
|
|
93
94
|
{#if $store.initialized}
|
|
94
95
|
<Tree headers={[
|
|
@@ -96,22 +97,7 @@ let thumbnailExpanded = false;
|
|
|
96
97
|
]} singleSelect store={treeStore} on:deselect={onDeselect} on:choose={onChoose} />
|
|
97
98
|
{/if}
|
|
98
99
|
</section>
|
|
99
|
-
<
|
|
100
|
-
{#if $preview}
|
|
101
|
-
<Thumbnail item={$preview} larger expandable expanded={thumbnailExpanded} on:thumbnailsizechage={() => { thumbnailExpanded = !thumbnailExpanded }}/>
|
|
102
|
-
{#if !thumbnailExpanded}<Details item={$preview} />{/if}
|
|
103
|
-
{:else}
|
|
104
|
-
<section class="placeholder">
|
|
105
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 371 181">
|
|
106
|
-
<g id="Group_2845" data-name="Group 2845" transform="translate(-34 -94)">
|
|
107
|
-
<rect id="Rectangle_2035" data-name="Rectangle 2035" width="371" height="181" transform="translate(34 94)" fill="#d8d8d8"/>
|
|
108
|
-
<path id="Icon_awesome-image" data-name="Icon awesome-image" d="M145.453,124.875H15.047A15.047,15.047,0,0,1,0,109.828V19.547A15.047,15.047,0,0,1,15.047,4.5H145.453A15.047,15.047,0,0,1,160.5,19.547v90.281A15.047,15.047,0,0,1,145.453,124.875ZM35.109,22.055A17.555,17.555,0,1,0,52.664,39.609,17.555,17.555,0,0,0,35.109,22.055ZM20.063,104.813H140.438V69.7L113,42.269a3.762,3.762,0,0,0-5.32,0L65.2,84.75l-17.4-17.4a3.762,3.762,0,0,0-5.32,0L20.063,89.766Z" transform="translate(139 119.5)" fill="#c7c7c7"/>
|
|
109
|
-
</g>
|
|
110
|
-
</svg>
|
|
111
|
-
<p>Select an item to preview it here.</p>
|
|
112
|
-
</section>
|
|
113
|
-
{/if}
|
|
114
|
-
</section>
|
|
100
|
+
<ChooserPreview {thumbnailExpanded} {previewId} {store} on:thumbnailsizechange={() => { thumbnailExpanded = !thumbnailExpanded }}/>
|
|
115
101
|
</section>
|
|
116
102
|
<svelte:fragment slot="buttons" let:describedby>
|
|
117
103
|
{#if chooserClient.upload && $source?.type === 'asset'}
|
|
@@ -148,17 +134,6 @@ let thumbnailExpanded = false;
|
|
|
148
134
|
background-color: white;
|
|
149
135
|
overflow: auto;
|
|
150
136
|
}
|
|
151
|
-
.dialog-chooser-preview {
|
|
152
|
-
width: 25%;
|
|
153
|
-
max-width: 21em;
|
|
154
|
-
height: calc(100% - 4em);
|
|
155
|
-
padding: 0 1em 1em 1em;
|
|
156
|
-
overflow-y: auto;
|
|
157
|
-
overflow-x: hidden;
|
|
158
|
-
}
|
|
159
|
-
.dialog-chooser-preview :global(.dialog-chooser-thumbnail button) {
|
|
160
|
-
display: none;
|
|
161
|
-
}
|
|
162
137
|
.dialog-chooser-controls {
|
|
163
138
|
position: relative;
|
|
164
139
|
width: 100%;
|
|
@@ -166,21 +141,6 @@ let thumbnailExpanded = false;
|
|
|
166
141
|
:global(footer.actions .upload) {
|
|
167
142
|
margin-right: auto;
|
|
168
143
|
}
|
|
169
|
-
.placeholder {
|
|
170
|
-
position: relative;
|
|
171
|
-
}
|
|
172
|
-
.placeholder p {
|
|
173
|
-
position: absolute;
|
|
174
|
-
left: 50%;
|
|
175
|
-
top: 50%;
|
|
176
|
-
transform: translate(-50%, -50%);
|
|
177
|
-
font-weight: 600;
|
|
178
|
-
width: 90%;
|
|
179
|
-
margin: 0;
|
|
180
|
-
display: flex;
|
|
181
|
-
justify-content: center;
|
|
182
|
-
text-align: center;
|
|
183
|
-
}
|
|
184
144
|
@container dosgato-dialog-chooser-window (max-width: 800px) {
|
|
185
145
|
.dialog-chooser-controls {
|
|
186
146
|
order: 2;
|
|
@@ -190,46 +150,6 @@ let thumbnailExpanded = false;
|
|
|
190
150
|
width: 100%;
|
|
191
151
|
height: 50%;
|
|
192
152
|
}
|
|
193
|
-
.dialog-chooser-preview {
|
|
194
|
-
order: 1;
|
|
195
|
-
width: 100%;
|
|
196
|
-
max-width: unset;
|
|
197
|
-
padding: 0;
|
|
198
|
-
height: unset;
|
|
199
|
-
display: flex;
|
|
200
|
-
overflow: hidden;
|
|
201
|
-
}
|
|
202
|
-
.dialog-chooser-preview.image {
|
|
203
|
-
height: 25vh;
|
|
204
|
-
}
|
|
205
|
-
.dialog-chooser-preview :global(.dialog-chooser-thumbnail) {
|
|
206
|
-
max-width: 50%;
|
|
207
|
-
}
|
|
208
|
-
.dialog-chooser-preview :global(.dialog-chooser-thumbnail.expanded) {
|
|
209
|
-
max-width: unset;
|
|
210
|
-
}
|
|
211
|
-
.dialog-chooser-preview :global(.dialog-chooser-thumbnail img) {
|
|
212
|
-
object-fit: cover;
|
|
213
|
-
object-position: center;
|
|
214
|
-
}
|
|
215
|
-
.dialog-chooser-preview :global(.dialog-chooser-thumbnail.expanded img) {
|
|
216
|
-
object-fit: scale-down;
|
|
217
|
-
width: unset;
|
|
218
|
-
}
|
|
219
|
-
.dialog-chooser-preview :global(.dialog-chooser-thumbnail button) {
|
|
220
|
-
display: block;
|
|
221
|
-
}
|
|
222
|
-
.dialog-chooser-preview :global(.dialog-chooser-info) {
|
|
223
|
-
width: 50%;
|
|
224
|
-
flex-direction: column;
|
|
225
|
-
flex-wrap: nowrap;
|
|
226
|
-
overflow-y: scroll;
|
|
227
|
-
}
|
|
228
|
-
.dialog-chooser-preview :global(.placeholder) {
|
|
229
|
-
width: 100%;
|
|
230
|
-
display: flex;
|
|
231
|
-
justify-content: center;
|
|
232
|
-
}
|
|
233
153
|
}
|
|
234
154
|
|
|
235
155
|
</style>
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<script>import Thumbnail from './Thumbnail.svelte';
|
|
2
|
+
import Details from './Details.svelte';
|
|
3
|
+
import { createEventDispatcher } from 'svelte';
|
|
4
|
+
export let previewId;
|
|
5
|
+
export let store;
|
|
6
|
+
const { preview } = store;
|
|
7
|
+
export let thumbnailExpanded;
|
|
8
|
+
const dispatch = createEventDispatcher();
|
|
9
|
+
function reactToPreview(_preview) {
|
|
10
|
+
if (thumbnailExpanded)
|
|
11
|
+
dispatch('thumbnailsizechange');
|
|
12
|
+
}
|
|
13
|
+
$: reactToPreview($preview);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<section id={previewId} class="dialog-chooser-preview" class:image={$preview?.type === 'asset' && $preview.image} class:collapsed={!thumbnailExpanded} tabindex="-1">
|
|
17
|
+
{#if $preview}
|
|
18
|
+
{#if $preview?.type === 'asset' && $preview.image}
|
|
19
|
+
<div class="mobile-name">
|
|
20
|
+
<div class="label">Name:</div>
|
|
21
|
+
<div>{$preview.name}</div>
|
|
22
|
+
</div>
|
|
23
|
+
{/if}
|
|
24
|
+
<div class="preview-container">
|
|
25
|
+
<Thumbnail item={$preview} larger expandable expanded={thumbnailExpanded} on:thumbnailsizechange />
|
|
26
|
+
{#if !thumbnailExpanded}<Details item={$preview} />{/if}
|
|
27
|
+
</div>
|
|
28
|
+
{:else}
|
|
29
|
+
<section class="placeholder">
|
|
30
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 371 181">
|
|
31
|
+
<g id="Group_2845" data-name="Group 2845" transform="translate(-34 -94)">
|
|
32
|
+
<rect id="Rectangle_2035" data-name="Rectangle 2035" width="371" height="181" transform="translate(34 94)" fill="#d8d8d8"/>
|
|
33
|
+
<path id="Icon_awesome-image" data-name="Icon awesome-image" d="M145.453,124.875H15.047A15.047,15.047,0,0,1,0,109.828V19.547A15.047,15.047,0,0,1,15.047,4.5H145.453A15.047,15.047,0,0,1,160.5,19.547v90.281A15.047,15.047,0,0,1,145.453,124.875ZM35.109,22.055A17.555,17.555,0,1,0,52.664,39.609,17.555,17.555,0,0,0,35.109,22.055ZM20.063,104.813H140.438V69.7L113,42.269a3.762,3.762,0,0,0-5.32,0L65.2,84.75l-17.4-17.4a3.762,3.762,0,0,0-5.32,0L20.063,89.766Z" transform="translate(139 119.5)" fill="#c7c7c7"/>
|
|
34
|
+
</g>
|
|
35
|
+
</svg>
|
|
36
|
+
<p>Select an item to preview it here.</p>
|
|
37
|
+
</section>
|
|
38
|
+
{/if}
|
|
39
|
+
</section>
|
|
40
|
+
|
|
41
|
+
<style>
|
|
42
|
+
.dialog-chooser-preview {
|
|
43
|
+
width: 25%;
|
|
44
|
+
max-width: 21em;
|
|
45
|
+
height: calc(100% - 4em);
|
|
46
|
+
padding: 0 1em 1em 1em;
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
overflow-x: hidden;
|
|
49
|
+
}
|
|
50
|
+
.dialog-chooser-preview :global(.dialog-chooser-thumbnail button) {
|
|
51
|
+
display: none;
|
|
52
|
+
}
|
|
53
|
+
.preview-container {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
width: 100%;
|
|
57
|
+
}
|
|
58
|
+
.placeholder {
|
|
59
|
+
position: relative;
|
|
60
|
+
}
|
|
61
|
+
.placeholder svg {
|
|
62
|
+
width: 100%;
|
|
63
|
+
}
|
|
64
|
+
.placeholder p {
|
|
65
|
+
position: absolute;
|
|
66
|
+
left: 50%;
|
|
67
|
+
top: 50%;
|
|
68
|
+
transform: translate(-50%, -50%);
|
|
69
|
+
font-weight: 600;
|
|
70
|
+
width: 90%;
|
|
71
|
+
margin: 0;
|
|
72
|
+
display: flex;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
text-align: center;
|
|
75
|
+
}
|
|
76
|
+
.mobile-name {
|
|
77
|
+
display: none;
|
|
78
|
+
}
|
|
79
|
+
.mobile-name .label {
|
|
80
|
+
font-weight: bold;
|
|
81
|
+
}
|
|
82
|
+
@container dosgato-dialog-chooser-window (max-width: 800px) {
|
|
83
|
+
.dialog-chooser-preview {
|
|
84
|
+
order: 1;
|
|
85
|
+
width: 100%;
|
|
86
|
+
max-width: unset;
|
|
87
|
+
padding: 0;
|
|
88
|
+
height: unset;
|
|
89
|
+
display: flex;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
}
|
|
92
|
+
.dialog-chooser-preview.image.collapsed {
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
gap: 0.75em;
|
|
95
|
+
}
|
|
96
|
+
.preview-container {
|
|
97
|
+
flex-direction: row;
|
|
98
|
+
height: 25vh;
|
|
99
|
+
}
|
|
100
|
+
.dialog-chooser-preview :global(.dialog-chooser-thumbnail) {
|
|
101
|
+
max-width: 50%;
|
|
102
|
+
}
|
|
103
|
+
.dialog-chooser-preview :global(.dialog-chooser-thumbnail.expanded) {
|
|
104
|
+
max-width: unset;
|
|
105
|
+
}
|
|
106
|
+
.dialog-chooser-preview :global(.dialog-chooser-thumbnail img) {
|
|
107
|
+
object-fit: cover;
|
|
108
|
+
object-position: center;
|
|
109
|
+
}
|
|
110
|
+
.dialog-chooser-preview :global(.dialog-chooser-thumbnail.expanded img) {
|
|
111
|
+
object-fit: scale-down;
|
|
112
|
+
width: unset;
|
|
113
|
+
}
|
|
114
|
+
.dialog-chooser-preview:not(.image) .dialog-chooser-thumbnail :global(svg) {
|
|
115
|
+
height: 8em;
|
|
116
|
+
width: 8em;
|
|
117
|
+
}
|
|
118
|
+
.dialog-chooser-preview .placeholder {
|
|
119
|
+
width: 100%;
|
|
120
|
+
display: flex;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
}
|
|
123
|
+
.dialog-chooser-preview :global(.dialog-chooser-thumbnail button) {
|
|
124
|
+
display: block;
|
|
125
|
+
}
|
|
126
|
+
.dialog-chooser-preview:not(.image) :global(.preview-container) {
|
|
127
|
+
height: unset;
|
|
128
|
+
}
|
|
129
|
+
.dialog-chooser-preview.collapsed .mobile-name {
|
|
130
|
+
display: block;
|
|
131
|
+
font-size: 0.75em;
|
|
132
|
+
}
|
|
133
|
+
.dialog-chooser-preview :global(.dialog-chooser-info) {
|
|
134
|
+
width: 50%;
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
flex-wrap: nowrap;
|
|
137
|
+
overflow-y: scroll;
|
|
138
|
+
font-size: 0.75em;
|
|
139
|
+
}
|
|
140
|
+
.dialog-chooser-preview.image :global(.dialog-chooser-info .name){
|
|
141
|
+
display: none;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { ChooserStore } from './ChooserStore';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
previewId: string;
|
|
6
|
+
store: ChooserStore;
|
|
7
|
+
thumbnailExpanded: boolean;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
thumbnailsizechange: CustomEvent<any>;
|
|
11
|
+
} & {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {};
|
|
15
|
+
};
|
|
16
|
+
export type ChooserPreviewProps = typeof __propDef.props;
|
|
17
|
+
export type ChooserPreviewEvents = typeof __propDef.events;
|
|
18
|
+
export type ChooserPreviewSlots = typeof __propDef.slots;
|
|
19
|
+
export default class ChooserPreview extends SvelteComponentTyped<ChooserPreviewProps, ChooserPreviewEvents, ChooserPreviewSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -11,7 +11,7 @@ export let expandable = false;
|
|
|
11
11
|
export let expanded = false;
|
|
12
12
|
const dispatch = createEventDispatcher();
|
|
13
13
|
function toggleThumbnailSize() {
|
|
14
|
-
dispatch('
|
|
14
|
+
dispatch('thumbnailsizechange');
|
|
15
15
|
}
|
|
16
16
|
</script>
|
|
17
17
|
<div class="dialog-chooser-thumbnail" class:expanded>
|
|
@@ -34,34 +34,50 @@ onMount(reactToOptions);
|
|
|
34
34
|
|
|
35
35
|
<FieldStandard bind:id descid={groupid} {path} {label} {required} {defaultValue} {conditional} {helptext} let:value let:valid let:invalid let:onBlur let:onChange let:messagesid let:helptextid let:setVal>
|
|
36
36
|
{@const _ = updateValue(value, setVal)}
|
|
37
|
-
<div class="
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
37
|
+
<div class="container-query-wrapper">
|
|
38
|
+
<div class="color-container {className}" role="radiogroup" aria-labelledby={groupid} class:invalid class:valid>
|
|
39
|
+
{#if addAllOption}
|
|
40
|
+
<label for={`${path}.alt`} class="colorsel alternating">
|
|
41
|
+
<Radio id={`${path}.alt`} name={path} value="alternating" selected={value === 'alternating'} {onChange} {onBlur} {helptextid}/>
|
|
42
|
+
<span class="alternating-bg">
|
|
43
|
+
{#each options as option (option.value)}
|
|
44
|
+
<span style:background-color={option.color}></span>
|
|
45
|
+
{/each}
|
|
46
|
+
</span>
|
|
47
|
+
<span class="picker-text">Alternating</span>
|
|
48
|
+
</label>
|
|
49
|
+
{/if}
|
|
50
|
+
{#each options as option, idx (option.value) }
|
|
51
|
+
{@const radioid = `${path}.${idx}`}
|
|
52
|
+
<label for={radioid} class="colorsel">
|
|
53
|
+
<Radio id={radioid} name={path} value={option.value} selected={value === option.value} {onChange} {onBlur} {helptextid}/>
|
|
54
|
+
<span class="picker-text" style:background-color={option.color} class:dark={shouldUseWhiteText(option.color)}>{option.name || option.value}</span>
|
|
55
|
+
</label>
|
|
56
|
+
{/each}
|
|
57
|
+
</div>
|
|
56
58
|
</div>
|
|
57
59
|
</FieldStandard>
|
|
58
60
|
|
|
59
61
|
<style>
|
|
62
|
+
.container-query-wrapper {
|
|
63
|
+
container-type: inline-size;
|
|
64
|
+
container-name: color-picker-container;
|
|
65
|
+
}
|
|
60
66
|
.color-container {
|
|
61
67
|
display: grid;
|
|
62
68
|
grid-gap: 10px;
|
|
63
69
|
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
64
70
|
}
|
|
71
|
+
@container color-picker-container (max-width: 600px) {
|
|
72
|
+
.color-container {
|
|
73
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
@container color-picker-container (max-width: 350px) {
|
|
77
|
+
.color-container {
|
|
78
|
+
grid-template-columns: 1fr 1fr;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
65
81
|
|
|
66
82
|
label.colorsel :global(input[type="radio"]) {
|
|
67
83
|
border: 0;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dosgato/dialog",
|
|
3
3
|
"description": "A component library for building forms that edit a JSON document.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.5",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepublishOnly": "svelte-package",
|
|
7
7
|
"dev": "vite dev --force",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@iconify/svelte": "^3.0.0",
|
|
27
27
|
"@iconify-icons/mdi": "^1.2.22",
|
|
28
28
|
"@iconify-icons/ph": "^1.2.2",
|
|
29
|
-
"@txstate-mws/svelte-components": "^1.5.
|
|
30
|
-
"@txstate-mws/svelte-forms": "^1.3.
|
|
29
|
+
"@txstate-mws/svelte-components": "^1.5.5",
|
|
30
|
+
"@txstate-mws/svelte-forms": "^1.3.16",
|
|
31
31
|
"codemirror": "^6.0.1",
|
|
32
32
|
"txstate-utils": "^1.8.0"
|
|
33
33
|
},
|