@budibase/bbui 2.5.9 → 2.5.10-alpha.1
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 +2 -8
- package/dist/bbui.es.js.map +1 -1
- package/package.json +5 -5
- package/src/ActionButton/ActionButton.svelte +1 -1
- package/src/Actions/click_outside.js +4 -0
- package/src/Actions/position_dropdown.js +11 -3
- package/src/Form/Core/Dropzone.svelte +22 -1
- package/src/Form/Core/Multiselect.svelte +5 -4
- package/src/Form/Dropzone.svelte +2 -0
- package/src/InlineAlert/InlineAlert.svelte +4 -3
- package/src/Label/Label.svelte +1 -0
- package/src/Layout/Page.svelte +5 -1
- package/src/Popover/Popover.svelte +4 -1
- package/src/Stores/banner.js +3 -1
- package/src/Table/ArrayRenderer.svelte +3 -2
- package/src/Table/Table.svelte +1 -1
- package/src/Typography/Body.svelte +1 -0
- package/src/Typography/Detail.svelte +4 -3
- package/src/Typography/Heading.svelte +1 -0
- package/src/bbui.css +19 -1
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": "2.5.
|
|
4
|
+
"version": "2.5.10-alpha.1",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"svelte": "src/index.js",
|
|
7
7
|
"module": "dist/bbui.es.js",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@adobe/spectrum-css-workflow-icons": "1.2.1",
|
|
41
|
-
"@budibase/shared-core": "
|
|
42
|
-
"@budibase/string-templates": "
|
|
41
|
+
"@budibase/shared-core": "2.5.10-alpha.1",
|
|
42
|
+
"@budibase/string-templates": "2.5.10-alpha.1",
|
|
43
43
|
"@spectrum-css/accordion": "3.0.24",
|
|
44
44
|
"@spectrum-css/actionbutton": "1.0.1",
|
|
45
45
|
"@spectrum-css/actiongroup": "1.0.1",
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
"@spectrum-css/vars": "3.0.1",
|
|
85
85
|
"dayjs": "^1.10.4",
|
|
86
86
|
"easymde": "^2.16.1",
|
|
87
|
-
"svelte-flatpickr": "^3.2
|
|
87
|
+
"svelte-flatpickr": "^3.3.2",
|
|
88
88
|
"svelte-portal": "^1.0.0"
|
|
89
89
|
},
|
|
90
90
|
"resolutions": {
|
|
91
91
|
"loader-utils": "1.4.1"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "9fcfb0a6cd4e4003f0e420b4b180b3b069e93191"
|
|
94
94
|
}
|
|
@@ -6,6 +6,9 @@ let clickHandlers = []
|
|
|
6
6
|
*/
|
|
7
7
|
const handleClick = event => {
|
|
8
8
|
// Ignore click if this is an ignored class
|
|
9
|
+
if (event.target.closest('[data-ignore-click-outside="true"]')) {
|
|
10
|
+
return
|
|
11
|
+
}
|
|
9
12
|
for (let className of ignoredClasses) {
|
|
10
13
|
if (event.target.closest(className)) {
|
|
11
14
|
return
|
|
@@ -29,6 +32,7 @@ const handleClick = event => {
|
|
|
29
32
|
})
|
|
30
33
|
}
|
|
31
34
|
document.documentElement.addEventListener("click", handleClick, true)
|
|
35
|
+
document.documentElement.addEventListener("contextmenu", handleClick, true)
|
|
32
36
|
|
|
33
37
|
/**
|
|
34
38
|
* Adds or updates a click handler
|
|
@@ -10,7 +10,14 @@ export default function positionDropdown(element, opts) {
|
|
|
10
10
|
|
|
11
11
|
// Updates the position of the dropdown
|
|
12
12
|
const updatePosition = opts => {
|
|
13
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
anchor,
|
|
15
|
+
align,
|
|
16
|
+
maxHeight,
|
|
17
|
+
maxWidth,
|
|
18
|
+
useAnchorWidth,
|
|
19
|
+
offset = 5,
|
|
20
|
+
} = opts
|
|
14
21
|
if (!anchor) {
|
|
15
22
|
return
|
|
16
23
|
}
|
|
@@ -31,10 +38,11 @@ export default function positionDropdown(element, opts) {
|
|
|
31
38
|
styles.top = anchorBounds.top
|
|
32
39
|
} else if (window.innerHeight - anchorBounds.bottom < 100) {
|
|
33
40
|
styles.top = anchorBounds.top - elementBounds.height - offset
|
|
34
|
-
styles.maxHeight = 240
|
|
41
|
+
styles.maxHeight = maxHeight || 240
|
|
35
42
|
} else {
|
|
36
43
|
styles.top = anchorBounds.bottom + offset
|
|
37
|
-
styles.maxHeight =
|
|
44
|
+
styles.maxHeight =
|
|
45
|
+
maxHeight || window.innerHeight - anchorBounds.bottom - 20
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
// Determine horizontal styles
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
}
|
|
139
139
|
</script>
|
|
140
140
|
|
|
141
|
-
<div class="container">
|
|
141
|
+
<div class="container" class:compact>
|
|
142
142
|
{#if selectedImage}
|
|
143
143
|
{#if gallery}
|
|
144
144
|
<div class="gallery">
|
|
@@ -355,6 +355,9 @@
|
|
|
355
355
|
input[type="file"] {
|
|
356
356
|
display: none;
|
|
357
357
|
}
|
|
358
|
+
.compact .spectrum-Dropzone {
|
|
359
|
+
padding: 6px 0 !important;
|
|
360
|
+
}
|
|
358
361
|
|
|
359
362
|
.gallery {
|
|
360
363
|
display: flex;
|
|
@@ -379,6 +382,17 @@
|
|
|
379
382
|
object-fit: contain;
|
|
380
383
|
margin: 20px 30px;
|
|
381
384
|
}
|
|
385
|
+
.compact .placeholder,
|
|
386
|
+
.compact img {
|
|
387
|
+
margin: 10px 16px;
|
|
388
|
+
}
|
|
389
|
+
.compact img {
|
|
390
|
+
height: 90px;
|
|
391
|
+
}
|
|
392
|
+
.compact .gallery {
|
|
393
|
+
padding: 6px 10px;
|
|
394
|
+
margin-bottom: 8px;
|
|
395
|
+
}
|
|
382
396
|
.title {
|
|
383
397
|
display: flex;
|
|
384
398
|
flex-direction: row;
|
|
@@ -447,6 +461,13 @@
|
|
|
447
461
|
.disabled .spectrum-Heading--sizeL {
|
|
448
462
|
color: var(--spectrum-alias-text-color-disabled);
|
|
449
463
|
}
|
|
464
|
+
.compact .spectrum-Dropzone {
|
|
465
|
+
padding-top: 8px;
|
|
466
|
+
padding-bottom: 8px;
|
|
467
|
+
}
|
|
468
|
+
.compact .spectrum-IllustratedMessage-description {
|
|
469
|
+
margin: 0;
|
|
470
|
+
}
|
|
450
471
|
|
|
451
472
|
.tags {
|
|
452
473
|
margin-top: 20px;
|
|
@@ -20,12 +20,13 @@
|
|
|
20
20
|
|
|
21
21
|
const dispatch = createEventDispatcher()
|
|
22
22
|
|
|
23
|
-
$:
|
|
23
|
+
$: arrayValue = Array.isArray(value) ? value : [value].filter(x => !!x)
|
|
24
|
+
$: selectedLookupMap = getSelectedLookupMap(arrayValue)
|
|
24
25
|
$: optionLookupMap = getOptionLookupMap(options)
|
|
25
26
|
|
|
26
|
-
$: fieldText = getFieldText(
|
|
27
|
+
$: fieldText = getFieldText(arrayValue, optionLookupMap, placeholder)
|
|
27
28
|
$: isOptionSelected = optionValue => selectedLookupMap[optionValue] === true
|
|
28
|
-
$: toggleOption = makeToggleOption(selectedLookupMap,
|
|
29
|
+
$: toggleOption = makeToggleOption(selectedLookupMap, arrayValue)
|
|
29
30
|
|
|
30
31
|
const getFieldText = (value, map, placeholder) => {
|
|
31
32
|
if (Array.isArray(value) && value.length > 0) {
|
|
@@ -84,7 +85,7 @@
|
|
|
84
85
|
{readonly}
|
|
85
86
|
{fieldText}
|
|
86
87
|
{options}
|
|
87
|
-
isPlaceholder={!
|
|
88
|
+
isPlaceholder={!arrayValue.length}
|
|
88
89
|
{autocomplete}
|
|
89
90
|
bind:fetchTerm
|
|
90
91
|
{useFetch}
|
package/src/Form/Dropzone.svelte
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
export let gallery = true
|
|
17
17
|
export let fileTags = []
|
|
18
18
|
export let maximum = undefined
|
|
19
|
+
export let compact = false
|
|
19
20
|
|
|
20
21
|
const dispatch = createEventDispatcher()
|
|
21
22
|
const onChange = e => {
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
{gallery}
|
|
38
39
|
{fileTags}
|
|
39
40
|
{maximum}
|
|
41
|
+
{compact}
|
|
40
42
|
on:change={onChange}
|
|
41
43
|
/>
|
|
42
44
|
</Field>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export let message = ""
|
|
8
8
|
export let onConfirm = undefined
|
|
9
9
|
export let buttonText = ""
|
|
10
|
-
|
|
10
|
+
export let cta = false
|
|
11
11
|
$: icon = selectIcon(type)
|
|
12
12
|
// if newlines used, convert them to different elements
|
|
13
13
|
$: split = message.split("\n")
|
|
@@ -41,7 +41,9 @@
|
|
|
41
41
|
{/each}
|
|
42
42
|
{#if onConfirm}
|
|
43
43
|
<div class="spectrum-InLineAlert-footer button">
|
|
44
|
-
<Button secondary on:click={onConfirm}
|
|
44
|
+
<Button {cta} secondary={cta ? false : true} on:click={onConfirm}
|
|
45
|
+
>{buttonText || "OK"}</Button
|
|
46
|
+
>
|
|
45
47
|
</div>
|
|
46
48
|
{/if}
|
|
47
49
|
</div>
|
|
@@ -57,7 +59,6 @@
|
|
|
57
59
|
--spectrum-semantic-negative-icon-color: #e34850;
|
|
58
60
|
min-width: 100px;
|
|
59
61
|
margin: 0;
|
|
60
|
-
border-color: var(--spectrum-global-color-gray-400);
|
|
61
62
|
border-width: 1px;
|
|
62
63
|
}
|
|
63
64
|
</style>
|
package/src/Label/Label.svelte
CHANGED
package/src/Layout/Page.svelte
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
export let wide = false
|
|
6
6
|
export let narrow = false
|
|
7
|
+
export let narrower = false
|
|
7
8
|
export let noPadding = false
|
|
8
9
|
|
|
9
10
|
let sidePanelVisble = false
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
|
|
17
18
|
<div class="page">
|
|
18
19
|
<div class="main">
|
|
19
|
-
<div class="content" class:wide class:noPadding class:narrow>
|
|
20
|
+
<div class="content" class:wide class:noPadding class:narrow class:narrower>
|
|
20
21
|
<slot />
|
|
21
22
|
<div class="fix-scroll-padding" />
|
|
22
23
|
</div>
|
|
@@ -70,6 +71,9 @@
|
|
|
70
71
|
.content.narrow {
|
|
71
72
|
max-width: 840px;
|
|
72
73
|
}
|
|
74
|
+
.content.narrower {
|
|
75
|
+
max-width: 700px;
|
|
76
|
+
}
|
|
73
77
|
#side-panel {
|
|
74
78
|
position: absolute;
|
|
75
79
|
right: 0;
|
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
export let align = "right"
|
|
15
15
|
export let portalTarget
|
|
16
16
|
export let maxWidth
|
|
17
|
+
export let maxHeight
|
|
17
18
|
export let open = false
|
|
18
19
|
export let useAnchorWidth = false
|
|
19
20
|
export let dismissible = true
|
|
20
21
|
export let offset = 5
|
|
21
22
|
export let customHeight
|
|
23
|
+
export let animate = true
|
|
22
24
|
|
|
23
25
|
$: target = portalTarget || getContext(Context.PopoverRoot) || ".spectrum"
|
|
24
26
|
|
|
@@ -64,6 +66,7 @@
|
|
|
64
66
|
use:positionDropdown={{
|
|
65
67
|
anchor,
|
|
66
68
|
align,
|
|
69
|
+
maxHeight,
|
|
67
70
|
maxWidth,
|
|
68
71
|
useAnchorWidth,
|
|
69
72
|
offset,
|
|
@@ -76,7 +79,7 @@
|
|
|
76
79
|
class="spectrum-Popover is-open"
|
|
77
80
|
role="presentation"
|
|
78
81
|
style="height: {customHeight}"
|
|
79
|
-
transition:fly|local={{ y: -20, duration: 200 }}
|
|
82
|
+
transition:fly|local={{ y: -20, duration: animate ? 200 : 0 }}
|
|
80
83
|
>
|
|
81
84
|
<slot />
|
|
82
85
|
</div>
|
package/src/Stores/banner.js
CHANGED
|
@@ -3,6 +3,7 @@ import { writable } from "svelte/store"
|
|
|
3
3
|
export const BANNER_TYPES = {
|
|
4
4
|
INFO: "info",
|
|
5
5
|
NEGATIVE: "negative",
|
|
6
|
+
WARNING: "warning",
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export function createBannerStore() {
|
|
@@ -38,7 +39,8 @@ export function createBannerStore() {
|
|
|
38
39
|
const queue = async entries => {
|
|
39
40
|
const priority = {
|
|
40
41
|
[BANNER_TYPES.NEGATIVE]: 0,
|
|
41
|
-
[BANNER_TYPES.
|
|
42
|
+
[BANNER_TYPES.WARNING]: 1,
|
|
43
|
+
[BANNER_TYPES.INFO]: 2,
|
|
42
44
|
}
|
|
43
45
|
banner.update(store => {
|
|
44
46
|
const sorted = [...store.messages, ...entries].sort((a, b) => {
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
const displayLimit = 5
|
|
7
7
|
|
|
8
|
-
$:
|
|
9
|
-
$:
|
|
8
|
+
$: arrayValue = Array.isArray(value) ? value : [value].filter(x => !!x)
|
|
9
|
+
$: badges = arrayValue.slice(0, displayLimit)
|
|
10
|
+
$: leftover = arrayValue.length - badges.length
|
|
10
11
|
</script>
|
|
11
12
|
|
|
12
13
|
{#each badges as badge}
|
package/src/Table/Table.svelte
CHANGED
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
}
|
|
144
144
|
fields?.forEach(field => {
|
|
145
145
|
const fieldSchema = schema[field]
|
|
146
|
-
if (fieldSchema.width) {
|
|
146
|
+
if (fieldSchema.width && typeof fieldSchema.width === "string") {
|
|
147
147
|
style += ` ${fieldSchema.width}`
|
|
148
148
|
} else {
|
|
149
149
|
style += " minmax(auto, 1fr)"
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
export let size = "M"
|
|
5
5
|
export let serif = false
|
|
6
|
+
export let weight = 600
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
9
|
<p
|
|
10
|
+
style={`
|
|
11
|
+
${weight ? `font-weight:${weight};` : ""}
|
|
12
|
+
`}
|
|
9
13
|
class="spectrum-Detail spectrum-Detail--size{size}"
|
|
10
14
|
class:spectrum-Detail--serif={serif}
|
|
11
15
|
>
|
|
@@ -13,7 +17,4 @@
|
|
|
13
17
|
</p>
|
|
14
18
|
|
|
15
19
|
<style>
|
|
16
|
-
p {
|
|
17
|
-
font-weight: 600;
|
|
18
|
-
}
|
|
19
20
|
</style>
|
package/src/bbui.css
CHANGED
|
@@ -97,4 +97,22 @@
|
|
|
97
97
|
|
|
98
98
|
a {
|
|
99
99
|
text-decoration: none;
|
|
100
|
-
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Custom theme additions */
|
|
103
|
+
.spectrum--darkest {
|
|
104
|
+
--drop-shadow: rgba(0, 0, 0, 0.6);
|
|
105
|
+
--spectrum-global-color-blue-100: rgb(28, 33, 43);
|
|
106
|
+
}
|
|
107
|
+
.spectrum--dark {
|
|
108
|
+
--drop-shadow: rgba(0, 0, 0, 0.3);
|
|
109
|
+
--spectrum-global-color-blue-100: rgb(42, 47, 57);
|
|
110
|
+
}
|
|
111
|
+
.spectrum--light {
|
|
112
|
+
--drop-shadow: rgba(0, 0, 0, 0.075);
|
|
113
|
+
--spectrum-global-color-blue-100: rgb(240, 245, 255);
|
|
114
|
+
}
|
|
115
|
+
.spectrum--lightest {
|
|
116
|
+
--drop-shadow: rgba(0, 0, 0, 0.05);
|
|
117
|
+
--spectrum-global-color-blue-100: rgb(240, 244, 255);
|
|
118
|
+
}
|