@budibase/bbui 1.0.18 → 1.0.19-alpha.0
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/bbui.es.js +1 -1
- package/dist/bbui.es.js.map +1 -1
- package/package.json +2 -2
- package/src/Form/Core/Dropzone.svelte +124 -94
- package/src/Form/Dropzone.svelte +4 -0
- package/src/Modal/ModalContent.svelte +25 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/bbui",
|
|
3
3
|
"description": "A UI solution used in the different Budibase projects.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.19-alpha.0",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"svelte": "src/index.js",
|
|
7
7
|
"module": "dist/bbui.es.js",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"svelte-flatpickr": "^3.2.3",
|
|
83
83
|
"svelte-portal": "^1.0.0"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "78991939242ca4b1ac5209f2ddf5225f09d080fb"
|
|
86
86
|
}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import { generateID } from "../../utils/helpers"
|
|
7
7
|
import Icon from "../../Icon/Icon.svelte"
|
|
8
8
|
import Link from "../../Link/Link.svelte"
|
|
9
|
+
import Tag from "../../Tags/Tag.svelte"
|
|
10
|
+
import Tags from "../../Tags/Tags.svelte"
|
|
9
11
|
|
|
10
12
|
const BYTES_IN_KB = 1000
|
|
11
13
|
const BYTES_IN_MB = 1000000
|
|
@@ -18,6 +20,8 @@
|
|
|
18
20
|
export let handleFileTooLarge = null
|
|
19
21
|
export let gallery = true
|
|
20
22
|
export let error = null
|
|
23
|
+
export let fileTags = []
|
|
24
|
+
export let maximum = null
|
|
21
25
|
|
|
22
26
|
const dispatch = createEventDispatcher()
|
|
23
27
|
const imageExtensions = [
|
|
@@ -184,103 +188,118 @@
|
|
|
184
188
|
{/each}
|
|
185
189
|
{/if}
|
|
186
190
|
{/if}
|
|
187
|
-
<
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
<
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
<svg
|
|
208
|
-
class="spectrum-IllustratedMessage-illustration"
|
|
209
|
-
width="125"
|
|
210
|
-
height="60"
|
|
211
|
-
viewBox="0 0 199 97.7"
|
|
212
|
-
>
|
|
213
|
-
<defs>
|
|
214
|
-
<style>
|
|
215
|
-
.cls-1,
|
|
216
|
-
.cls-2 {
|
|
217
|
-
fill: none;
|
|
218
|
-
stroke-linecap: round;
|
|
219
|
-
stroke-linejoin: round;
|
|
220
|
-
}
|
|
221
|
-
.cls-1 {
|
|
222
|
-
stroke-width: 3px;
|
|
223
|
-
}
|
|
224
|
-
.cls-2 {
|
|
225
|
-
stroke-width: 2px;
|
|
226
|
-
}
|
|
227
|
-
</style>
|
|
228
|
-
</defs>
|
|
229
|
-
<path
|
|
230
|
-
class="cls-1"
|
|
231
|
-
d="M110.53,85.66,100.26,95.89a1.09,1.09,0,0,1-1.52,0L88.47,85.66"
|
|
191
|
+
{#if !maximum || (maximum && value?.length < maximum)}
|
|
192
|
+
<div
|
|
193
|
+
class="spectrum-Dropzone"
|
|
194
|
+
class:is-invalid={!!error}
|
|
195
|
+
class:disabled
|
|
196
|
+
role="region"
|
|
197
|
+
tabindex="0"
|
|
198
|
+
on:dragover={handleDragOver}
|
|
199
|
+
on:dragleave={handleDragLeave}
|
|
200
|
+
on:dragenter={handleDragOver}
|
|
201
|
+
on:drop={handleDrop}
|
|
202
|
+
class:is-dragged={fileDragged}
|
|
203
|
+
>
|
|
204
|
+
<div class="spectrum-IllustratedMessage spectrum-IllustratedMessage--cta">
|
|
205
|
+
<input
|
|
206
|
+
id={fieldId}
|
|
207
|
+
{disabled}
|
|
208
|
+
type="file"
|
|
209
|
+
multiple
|
|
210
|
+
on:change={handleFile}
|
|
232
211
|
/>
|
|
233
|
-
<
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
212
|
+
<svg
|
|
213
|
+
class="spectrum-IllustratedMessage-illustration"
|
|
214
|
+
width="125"
|
|
215
|
+
height="60"
|
|
216
|
+
viewBox="0 0 199 97.7"
|
|
217
|
+
>
|
|
218
|
+
<defs>
|
|
219
|
+
<style>
|
|
220
|
+
.cls-1,
|
|
221
|
+
.cls-2 {
|
|
222
|
+
fill: none;
|
|
223
|
+
stroke-linecap: round;
|
|
224
|
+
stroke-linejoin: round;
|
|
225
|
+
}
|
|
226
|
+
.cls-1 {
|
|
227
|
+
stroke-width: 3px;
|
|
228
|
+
}
|
|
229
|
+
.cls-2 {
|
|
230
|
+
stroke-width: 2px;
|
|
231
|
+
}
|
|
232
|
+
</style>
|
|
233
|
+
</defs>
|
|
234
|
+
<path
|
|
235
|
+
class="cls-1"
|
|
236
|
+
d="M110.53,85.66,100.26,95.89a1.09,1.09,0,0,1-1.52,0L88.47,85.66"
|
|
237
|
+
/>
|
|
238
|
+
<line class="cls-1" x1="99.5" y1="95.5" x2="99.5" y2="58.5" />
|
|
239
|
+
<path class="cls-1" d="M105.5,73.5h19a2,2,0,0,0,2-2v-43" />
|
|
240
|
+
<path
|
|
241
|
+
class="cls-1"
|
|
242
|
+
d="M126.5,22.5h-19a2,2,0,0,1-2-2V1.5h-31a2,2,0,0,0-2,2v68a2,2,0,0,0,2,2h19"
|
|
243
|
+
/>
|
|
244
|
+
<line class="cls-1" x1="105.5" y1="1.5" x2="126.5" y2="22.5" />
|
|
245
|
+
<path
|
|
246
|
+
class="cls-2"
|
|
247
|
+
d="M47.93,50.49a5,5,0,1,0-4.83-5A4.93,4.93,0,0,0,47.93,50.49Z"
|
|
248
|
+
/>
|
|
249
|
+
<path
|
|
250
|
+
class="cls-2"
|
|
251
|
+
d="M36.6,65.93,42.05,60A2.06,2.06,0,0,1,45,60l12.68,13.2"
|
|
252
|
+
/>
|
|
253
|
+
<path
|
|
254
|
+
class="cls-2"
|
|
255
|
+
d="M3.14,73.23,22.42,53.76a1.65,1.65,0,0,1,2.38,0l19.05,19.7"
|
|
256
|
+
/>
|
|
257
|
+
<path
|
|
258
|
+
class="cls-1"
|
|
259
|
+
d="M139.5,36.5H196A1.49,1.49,0,0,1,197.5,38V72A1.49,1.49,0,0,1,196,73.5H141A1.49,1.49,0,0,1,139.5,72V32A1.49,1.49,0,0,1,141,30.5H154a2.43,2.43,0,0,1,1.67.66l6,5.66"
|
|
260
|
+
/>
|
|
261
|
+
<rect
|
|
262
|
+
class="cls-1"
|
|
263
|
+
x="1.5"
|
|
264
|
+
y="34.5"
|
|
265
|
+
width="58"
|
|
266
|
+
height="39"
|
|
267
|
+
rx="2"
|
|
268
|
+
ry="2"
|
|
269
|
+
/>
|
|
270
|
+
</svg>
|
|
271
|
+
<h2
|
|
272
|
+
class="spectrum-Heading spectrum-Heading--sizeL spectrum-Heading--light spectrum-IllustratedMessage-heading"
|
|
274
273
|
>
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
<
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
274
|
+
Drag and drop your file
|
|
275
|
+
</h2>
|
|
276
|
+
{#if !disabled}
|
|
277
|
+
<p
|
|
278
|
+
class="spectrum-Body spectrum-Body--sizeS spectrum-IllustratedMessage-description"
|
|
279
|
+
>
|
|
280
|
+
<label for={fieldId} class="spectrum-Link">
|
|
281
|
+
Select a file to upload
|
|
282
|
+
</label>
|
|
283
|
+
<br />
|
|
284
|
+
from your computer
|
|
285
|
+
</p>
|
|
286
|
+
{#if fileTags.length}
|
|
287
|
+
<Tags>
|
|
288
|
+
<div class="tags">
|
|
289
|
+
{#each fileTags as tag}
|
|
290
|
+
<div class="tag">
|
|
291
|
+
<Tag>
|
|
292
|
+
{tag}
|
|
293
|
+
</Tag>
|
|
294
|
+
</div>
|
|
295
|
+
{/each}
|
|
296
|
+
</div>
|
|
297
|
+
</Tags>
|
|
298
|
+
{/if}
|
|
299
|
+
{/if}
|
|
300
|
+
</div>
|
|
282
301
|
</div>
|
|
283
|
-
|
|
302
|
+
{/if}
|
|
284
303
|
</div>
|
|
285
304
|
|
|
286
305
|
<style>
|
|
@@ -390,4 +409,15 @@
|
|
|
390
409
|
.disabled .spectrum-Heading--sizeL {
|
|
391
410
|
color: var(--spectrum-alias-text-color-disabled);
|
|
392
411
|
}
|
|
412
|
+
|
|
413
|
+
.tags {
|
|
414
|
+
margin-top: 20px;
|
|
415
|
+
display: flex;
|
|
416
|
+
flex-wrap: wrap;
|
|
417
|
+
justify-content: center;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.tag {
|
|
421
|
+
margin-top: 8px;
|
|
422
|
+
}
|
|
393
423
|
</style>
|
package/src/Form/Dropzone.svelte
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
export let processFiles = undefined
|
|
13
13
|
export let handleFileTooLarge = undefined
|
|
14
14
|
export let gallery = true
|
|
15
|
+
export let fileTags = []
|
|
16
|
+
export let maximum = undefined
|
|
15
17
|
|
|
16
18
|
const dispatch = createEventDispatcher()
|
|
17
19
|
const onChange = e => {
|
|
@@ -29,6 +31,8 @@
|
|
|
29
31
|
{processFiles}
|
|
30
32
|
{handleFileTooLarge}
|
|
31
33
|
{gallery}
|
|
34
|
+
{fileTags}
|
|
35
|
+
{maximum}
|
|
32
36
|
on:change={onChange}
|
|
33
37
|
/>
|
|
34
38
|
</Field>
|
|
@@ -18,10 +18,22 @@
|
|
|
18
18
|
export let disabled = false
|
|
19
19
|
export let showDivider = true
|
|
20
20
|
|
|
21
|
+
export let showSecondaryButton = false
|
|
22
|
+
export let secondaryButtonText = undefined
|
|
23
|
+
export let secondaryAction = undefined
|
|
24
|
+
|
|
21
25
|
const { hide, cancel } = getContext(Context.Modal)
|
|
22
26
|
let loading = false
|
|
23
27
|
$: confirmDisabled = disabled || loading
|
|
24
28
|
|
|
29
|
+
async function secondary() {
|
|
30
|
+
loading = true
|
|
31
|
+
if (!secondaryAction || (await secondaryAction()) !== false) {
|
|
32
|
+
hide()
|
|
33
|
+
}
|
|
34
|
+
loading = false
|
|
35
|
+
}
|
|
36
|
+
|
|
25
37
|
async function confirm() {
|
|
26
38
|
loading = true
|
|
27
39
|
if (!onConfirm || (await onConfirm()) !== false) {
|
|
@@ -73,6 +85,15 @@
|
|
|
73
85
|
class="spectrum-ButtonGroup spectrum-Dialog-buttonGroup spectrum-Dialog-buttonGroup--noFooter"
|
|
74
86
|
>
|
|
75
87
|
<slot name="footer" />
|
|
88
|
+
|
|
89
|
+
{#if showSecondaryButton && secondaryButtonText && secondaryAction}
|
|
90
|
+
<div class="secondary-action">
|
|
91
|
+
<Button group secondary on:click={secondary}
|
|
92
|
+
>{secondaryButtonText}</Button
|
|
93
|
+
>
|
|
94
|
+
</div>
|
|
95
|
+
{/if}
|
|
96
|
+
|
|
76
97
|
{#if showCancelButton}
|
|
77
98
|
<Button group secondary on:click={close}>{cancelText}</Button>
|
|
78
99
|
{/if}
|
|
@@ -136,4 +157,8 @@
|
|
|
136
157
|
display: flex;
|
|
137
158
|
justify-content: space-between;
|
|
138
159
|
}
|
|
160
|
+
|
|
161
|
+
.secondary-action {
|
|
162
|
+
margin-right: auto;
|
|
163
|
+
}
|
|
139
164
|
</style>
|