@budibase/bbui 1.3.21-alpha.1 → 1.3.21
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 +199 -3
- package/dist/bbui.es.js.map +1 -1
- package/package.json +3 -3
- package/src/Actions/position_dropdown.js +6 -15
- package/src/Banner/BannerDisplay.svelte +7 -17
- package/src/InlineAlert/InlineAlert.svelte +2 -6
- package/src/Label/Label.svelte +1 -10
- package/src/Modal/ModalContent.svelte +3 -1
- package/src/Popover/Popover.svelte +1 -2
- package/src/ProgressBar/ProgressBar.svelte +1 -14
- package/src/SideNavigation/Item.svelte +0 -14
- package/src/Stores/banner.js +3 -31
- package/src/Tooltip/TooltipWrapper.svelte +3 -3
- package/src/index.js +1 -2
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.3.21
|
|
4
|
+
"version": "1.3.21",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"svelte": "src/index.js",
|
|
7
7
|
"module": "dist/bbui.es.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
|
|
41
|
-
"@budibase/string-templates": "1.3.21
|
|
41
|
+
"@budibase/string-templates": "^1.3.21",
|
|
42
42
|
"@spectrum-css/actionbutton": "^1.0.1",
|
|
43
43
|
"@spectrum-css/actiongroup": "^1.0.1",
|
|
44
44
|
"@spectrum-css/avatar": "^3.0.2",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"svelte-flatpickr": "^3.2.3",
|
|
86
86
|
"svelte-portal": "^1.0.0"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "19ed43cb817a650c859e9d237c5053cd3ee54526"
|
|
89
89
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function positionDropdown(element, { anchor, align
|
|
1
|
+
export default function positionDropdown(element, { anchor, align }) {
|
|
2
2
|
let positionSide = "top"
|
|
3
3
|
let maxHeight = 0
|
|
4
4
|
let dimensions = getDimensions(anchor)
|
|
@@ -34,24 +34,13 @@ export default function positionDropdown(element, { anchor, align, maxWidth }) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function calcLeftPosition() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
left = dimensions.left + dimensions.width - dimensions.containerWidth
|
|
41
|
-
} else if (align == "right-side") {
|
|
42
|
-
left = dimensions.left + dimensions.width
|
|
43
|
-
} else {
|
|
44
|
-
left = dimensions.left
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return left
|
|
37
|
+
return align === "right"
|
|
38
|
+
? dimensions.left + dimensions.width - dimensions.containerWidth
|
|
39
|
+
: dimensions.left
|
|
48
40
|
}
|
|
49
41
|
|
|
50
42
|
element.style.position = "absolute"
|
|
51
43
|
element.style.zIndex = "9999"
|
|
52
|
-
if (maxWidth) {
|
|
53
|
-
element.style.maxWidth = `${maxWidth}px`
|
|
54
|
-
}
|
|
55
44
|
element.style.minWidth = `${dimensions.width}px`
|
|
56
45
|
element.style.maxHeight = `${maxHeight.toFixed(0)}px`
|
|
57
46
|
element.style.transformOrigin = `center ${positionSide}`
|
|
@@ -65,8 +54,10 @@ export default function positionDropdown(element, { anchor, align, maxWidth }) {
|
|
|
65
54
|
element.style.left = `${calcLeftPosition(dimensions).toFixed(0)}px`
|
|
66
55
|
})
|
|
67
56
|
})
|
|
57
|
+
|
|
68
58
|
resizeObserver.observe(anchor)
|
|
69
59
|
resizeObserver.observe(element)
|
|
60
|
+
|
|
70
61
|
return {
|
|
71
62
|
destroy() {
|
|
72
63
|
resizeObserver.disconnect()
|
|
@@ -4,32 +4,22 @@
|
|
|
4
4
|
import { banner } from "../Stores/banner"
|
|
5
5
|
import Banner from "./Banner.svelte"
|
|
6
6
|
import { fly } from "svelte/transition"
|
|
7
|
-
import TooltipWrapper from "../Tooltip/TooltipWrapper.svelte"
|
|
8
7
|
</script>
|
|
9
8
|
|
|
10
9
|
<Portal target=".banner-container">
|
|
11
10
|
<div class="banner">
|
|
12
|
-
{#
|
|
11
|
+
{#if $banner.message}
|
|
13
12
|
<div transition:fly={{ y: -30 }}>
|
|
14
13
|
<Banner
|
|
15
|
-
type={
|
|
16
|
-
extraButtonText={
|
|
17
|
-
extraButtonAction={
|
|
18
|
-
on:change={
|
|
19
|
-
if (message.onChange) {
|
|
20
|
-
message.onChange()
|
|
21
|
-
}
|
|
22
|
-
}}
|
|
23
|
-
showCloseButton={typeof message.showCloseButton === "boolean"
|
|
24
|
-
? message.showCloseButton
|
|
25
|
-
: true}
|
|
14
|
+
type={$banner.type}
|
|
15
|
+
extraButtonText={$banner.extraButtonText}
|
|
16
|
+
extraButtonAction={$banner.extraButtonAction}
|
|
17
|
+
on:change={$banner.onChange}
|
|
26
18
|
>
|
|
27
|
-
|
|
28
|
-
{message.message}
|
|
29
|
-
</TooltipWrapper>
|
|
19
|
+
{$banner.message}
|
|
30
20
|
</Banner>
|
|
31
21
|
</div>
|
|
32
|
-
{/
|
|
22
|
+
{/if}
|
|
33
23
|
</div>
|
|
34
24
|
</Portal>
|
|
35
25
|
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
export let header = ""
|
|
7
7
|
export let message = ""
|
|
8
8
|
export let onConfirm = undefined
|
|
9
|
-
export let buttonText = ""
|
|
10
9
|
|
|
11
10
|
$: icon = selectIcon(type)
|
|
12
11
|
// if newlines used, convert them to different elements
|
|
@@ -40,16 +39,13 @@
|
|
|
40
39
|
<div class="spectrum-InLineAlert-content">{splitMsg}</div>
|
|
41
40
|
{/each}
|
|
42
41
|
{#if onConfirm}
|
|
43
|
-
<div class="spectrum-InLineAlert-footer
|
|
44
|
-
<Button secondary on:click={onConfirm}>
|
|
42
|
+
<div class="spectrum-InLineAlert-footer">
|
|
43
|
+
<Button secondary on:click={onConfirm}>OK</Button>
|
|
45
44
|
</div>
|
|
46
45
|
{/if}
|
|
47
46
|
</div>
|
|
48
47
|
|
|
49
48
|
<style>
|
|
50
|
-
.button {
|
|
51
|
-
margin-top: 10px;
|
|
52
|
-
}
|
|
53
49
|
.spectrum-InLineAlert {
|
|
54
50
|
--spectrum-semantic-negative-border-color: #e34850;
|
|
55
51
|
--spectrum-semantic-positive-border-color: #2d9d78;
|
package/src/Label/Label.svelte
CHANGED
|
@@ -4,15 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
export let size = "M"
|
|
6
6
|
export let tooltip = ""
|
|
7
|
-
export let muted
|
|
8
7
|
</script>
|
|
9
8
|
|
|
10
9
|
<TooltipWrapper {tooltip} {size}>
|
|
11
|
-
<label
|
|
12
|
-
class:muted
|
|
13
|
-
for=""
|
|
14
|
-
class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}
|
|
15
|
-
>
|
|
10
|
+
<label for="" class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}>
|
|
16
11
|
<slot />
|
|
17
12
|
</label>
|
|
18
13
|
</TooltipWrapper>
|
|
@@ -22,8 +17,4 @@
|
|
|
22
17
|
padding: 0;
|
|
23
18
|
white-space: nowrap;
|
|
24
19
|
}
|
|
25
|
-
|
|
26
|
-
.muted {
|
|
27
|
-
opacity: 0.5;
|
|
28
|
-
}
|
|
29
20
|
</style>
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
export let secondaryAction = undefined
|
|
25
25
|
export let secondaryButtonWarning = false
|
|
26
26
|
export let dataCy = null
|
|
27
|
+
|
|
27
28
|
const { hide, cancel } = getContext(Context.Modal)
|
|
28
29
|
let loading = false
|
|
29
30
|
$: confirmDisabled = disabled || loading
|
|
@@ -87,11 +88,12 @@
|
|
|
87
88
|
<section class="spectrum-Dialog-content content-grid">
|
|
88
89
|
<slot />
|
|
89
90
|
</section>
|
|
90
|
-
{#if showCancelButton || showConfirmButton
|
|
91
|
+
{#if showCancelButton || showConfirmButton}
|
|
91
92
|
<div
|
|
92
93
|
class="spectrum-ButtonGroup spectrum-Dialog-buttonGroup spectrum-Dialog-buttonGroup--noFooter"
|
|
93
94
|
>
|
|
94
95
|
<slot name="footer" />
|
|
96
|
+
|
|
95
97
|
{#if showSecondaryButton && secondaryButtonText && secondaryAction}
|
|
96
98
|
<div class="secondary-action">
|
|
97
99
|
<Button
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
export let align = "right"
|
|
12
12
|
export let portalTarget
|
|
13
13
|
export let dataCy
|
|
14
|
-
export let maxWidth
|
|
15
14
|
|
|
16
15
|
export let direction = "bottom"
|
|
17
16
|
export let showTip = false
|
|
@@ -46,7 +45,7 @@
|
|
|
46
45
|
<Portal target={portalTarget}>
|
|
47
46
|
<div
|
|
48
47
|
tabindex="0"
|
|
49
|
-
use:positionDropdown={{ anchor, align
|
|
48
|
+
use:positionDropdown={{ anchor, align }}
|
|
50
49
|
use:clickOutside={hide}
|
|
51
50
|
on:keydown={handleEscape}
|
|
52
51
|
class={"spectrum-Popover is-open " + (tooltipClasses || "")}
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
export let duration = 1000
|
|
9
9
|
export let width = false
|
|
10
10
|
export let sideLabel = false
|
|
11
|
-
export let hidePercentage = true
|
|
12
|
-
export let color // red, green, default = blue
|
|
13
11
|
|
|
14
12
|
export let size = "M"
|
|
15
13
|
|
|
@@ -39,7 +37,7 @@
|
|
|
39
37
|
<slot />
|
|
40
38
|
</div>
|
|
41
39
|
{/if}
|
|
42
|
-
{#if
|
|
40
|
+
{#if value || value === 0}
|
|
43
41
|
<div
|
|
44
42
|
class="spectrum-FieldLabel spectrum-ProgressBar-percentage spectrum-FieldLabel--size{size}"
|
|
45
43
|
>
|
|
@@ -49,19 +47,8 @@
|
|
|
49
47
|
<div class="spectrum-ProgressBar-track">
|
|
50
48
|
<div
|
|
51
49
|
class="spectrum-ProgressBar-fill"
|
|
52
|
-
class:color-green={color === "green"}
|
|
53
|
-
class:color-red={color === "red"}
|
|
54
50
|
style={value || value === 0 ? `width: ${$progress}%` : ""}
|
|
55
51
|
/>
|
|
56
52
|
</div>
|
|
57
53
|
<div class="spectrum-ProgressBar-label" hidden="" />
|
|
58
54
|
</div>
|
|
59
|
-
|
|
60
|
-
<style>
|
|
61
|
-
.color-green {
|
|
62
|
-
background: #009562;
|
|
63
|
-
}
|
|
64
|
-
.color-red {
|
|
65
|
-
background: #dd2019;
|
|
66
|
-
}
|
|
67
|
-
</style>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext } from "svelte"
|
|
3
3
|
const multilevel = getContext("sidenav-type")
|
|
4
|
-
import Badge from "../Badge/Badge.svelte"
|
|
5
4
|
export let href = ""
|
|
6
5
|
export let external = false
|
|
7
6
|
export let heading = ""
|
|
@@ -9,7 +8,6 @@
|
|
|
9
8
|
export let selected = false
|
|
10
9
|
export let disabled = false
|
|
11
10
|
export let dataCy
|
|
12
|
-
export let badge = ""
|
|
13
11
|
</script>
|
|
14
12
|
|
|
15
13
|
<li
|
|
@@ -40,22 +38,10 @@
|
|
|
40
38
|
</svg>
|
|
41
39
|
{/if}
|
|
42
40
|
<slot />
|
|
43
|
-
{#if badge}
|
|
44
|
-
<div class="badge">
|
|
45
|
-
<Badge active size="S">{badge}</Badge>
|
|
46
|
-
</div>
|
|
47
|
-
{/if}
|
|
48
41
|
</a>
|
|
49
|
-
|
|
50
42
|
{#if multilevel && $$slots.subnav}
|
|
51
43
|
<ul class="spectrum-SideNav">
|
|
52
44
|
<slot name="subnav" />
|
|
53
45
|
</ul>
|
|
54
46
|
{/if}
|
|
55
47
|
</li>
|
|
56
|
-
|
|
57
|
-
<style>
|
|
58
|
-
.badge {
|
|
59
|
-
margin-left: 10px;
|
|
60
|
-
}
|
|
61
|
-
</style>
|
package/src/Stores/banner.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { writable } from "svelte/store"
|
|
2
2
|
|
|
3
|
-
export const BANNER_TYPES = {
|
|
4
|
-
INFO: "info",
|
|
5
|
-
NEGATIVE: "negative",
|
|
6
|
-
}
|
|
7
|
-
|
|
8
3
|
export function createBannerStore() {
|
|
9
|
-
const DEFAULT_CONFIG = {
|
|
10
|
-
messages: [],
|
|
11
|
-
}
|
|
4
|
+
const DEFAULT_CONFIG = {}
|
|
12
5
|
|
|
13
6
|
const banner = writable(DEFAULT_CONFIG)
|
|
14
7
|
|
|
@@ -27,38 +20,17 @@ export function createBannerStore() {
|
|
|
27
20
|
const showStatus = async () => {
|
|
28
21
|
const config = {
|
|
29
22
|
message: "Some systems are experiencing issues",
|
|
30
|
-
type:
|
|
23
|
+
type: "negative",
|
|
31
24
|
extraButtonText: "View Status",
|
|
32
25
|
extraButtonAction: () => window.open("https://status.budibase.com/"),
|
|
33
26
|
}
|
|
34
27
|
|
|
35
|
-
await
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const queue = async entries => {
|
|
39
|
-
const priority = {
|
|
40
|
-
[BANNER_TYPES.NEGATIVE]: 0,
|
|
41
|
-
[BANNER_TYPES.INFO]: 1,
|
|
42
|
-
}
|
|
43
|
-
banner.update(store => {
|
|
44
|
-
const sorted = [...store.messages, ...entries].sort((a, b) => {
|
|
45
|
-
if (priority[a.type] == priority[b.type]) {
|
|
46
|
-
return 0
|
|
47
|
-
}
|
|
48
|
-
return priority[a.type] < priority[b.type] ? -1 : 1
|
|
49
|
-
})
|
|
50
|
-
return {
|
|
51
|
-
...store,
|
|
52
|
-
messages: sorted,
|
|
53
|
-
}
|
|
54
|
-
})
|
|
28
|
+
await show(config)
|
|
55
29
|
}
|
|
56
30
|
|
|
57
31
|
return {
|
|
58
32
|
subscribe: banner.subscribe,
|
|
59
33
|
showStatus,
|
|
60
|
-
show,
|
|
61
|
-
queue,
|
|
62
34
|
}
|
|
63
35
|
}
|
|
64
36
|
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
export let tooltip = ""
|
|
6
6
|
export let size = "M"
|
|
7
|
-
export let disabled = true
|
|
8
7
|
|
|
9
8
|
let showTooltip = false
|
|
10
9
|
</script>
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
on:mouseleave={() => (showTooltip = false)}
|
|
21
20
|
on:focus
|
|
22
21
|
>
|
|
23
|
-
<Icon name="InfoOutline" size="S" {
|
|
22
|
+
<Icon name="InfoOutline" size="S" disabled={true} />
|
|
24
23
|
</div>
|
|
25
24
|
{#if showTooltip}
|
|
26
25
|
<div class="tooltip">
|
|
@@ -55,6 +54,7 @@
|
|
|
55
54
|
transform: scale(0.75);
|
|
56
55
|
}
|
|
57
56
|
.icon-small {
|
|
58
|
-
margin-
|
|
57
|
+
margin-top: -2px;
|
|
58
|
+
margin-bottom: -5px;
|
|
59
59
|
}
|
|
60
60
|
</style>
|
package/src/index.js
CHANGED
|
@@ -34,7 +34,6 @@ export { default as Layout } from "./Layout/Layout.svelte"
|
|
|
34
34
|
export { default as Page } from "./Layout/Page.svelte"
|
|
35
35
|
export { default as Link } from "./Link/Link.svelte"
|
|
36
36
|
export { default as Tooltip } from "./Tooltip/Tooltip.svelte"
|
|
37
|
-
export { default as TooltipWrapper } from "./Tooltip/TooltipWrapper.svelte"
|
|
38
37
|
export { default as Menu } from "./Menu/Menu.svelte"
|
|
39
38
|
export { default as MenuSection } from "./Menu/Section.svelte"
|
|
40
39
|
export { default as MenuSeparator } from "./Menu/Separator.svelte"
|
|
@@ -95,7 +94,7 @@ export { default as clickOutside } from "./Actions/click_outside"
|
|
|
95
94
|
|
|
96
95
|
// Stores
|
|
97
96
|
export { notifications, createNotificationStore } from "./Stores/notifications"
|
|
98
|
-
export { banner
|
|
97
|
+
export { banner } from "./Stores/banner"
|
|
99
98
|
|
|
100
99
|
// Helpers
|
|
101
100
|
export * as Helpers from "./helpers"
|