@budibase/bbui 1.3.19-alpha.0 → 1.3.19-alpha.2
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 +3 -3
- package/dist/bbui.es.js.map +1 -1
- package/package.json +3 -3
- package/src/Banner/BannerDisplay.svelte +17 -7
- package/src/InlineAlert/InlineAlert.svelte +6 -2
- package/src/ProgressBar/ProgressBar.svelte +14 -1
- package/src/SideNavigation/Item.svelte +14 -0
- package/src/Stores/banner.js +31 -3
- package/src/Tooltip/TooltipWrapper.svelte +3 -3
- package/src/index.js +2 -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": "1.3.19-alpha.
|
|
4
|
+
"version": "1.3.19-alpha.2",
|
|
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.19-alpha.
|
|
41
|
+
"@budibase/string-templates": "1.3.19-alpha.2",
|
|
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": "6c8550e2fb5c824819ee6f5b4fa432219efe45e4"
|
|
89
89
|
}
|
|
@@ -4,22 +4,32 @@
|
|
|
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"
|
|
7
8
|
</script>
|
|
8
9
|
|
|
9
10
|
<Portal target=".banner-container">
|
|
10
11
|
<div class="banner">
|
|
11
|
-
{#
|
|
12
|
+
{#each $banner.messages as message}
|
|
12
13
|
<div transition:fly={{ y: -30 }}>
|
|
13
14
|
<Banner
|
|
14
|
-
type={
|
|
15
|
-
extraButtonText={
|
|
16
|
-
extraButtonAction={
|
|
17
|
-
on:change={
|
|
15
|
+
type={message.type}
|
|
16
|
+
extraButtonText={message.extraButtonText}
|
|
17
|
+
extraButtonAction={message.extraButtonAction}
|
|
18
|
+
on:change={() => {
|
|
19
|
+
if (message.onChange) {
|
|
20
|
+
message.onChange()
|
|
21
|
+
}
|
|
22
|
+
}}
|
|
23
|
+
showCloseButton={typeof message.showCloseButton === "boolean"
|
|
24
|
+
? message.showCloseButton
|
|
25
|
+
: true}
|
|
18
26
|
>
|
|
19
|
-
{
|
|
27
|
+
<TooltipWrapper tooltip={message.tooltip} disabled={false}>
|
|
28
|
+
{message.message}
|
|
29
|
+
</TooltipWrapper>
|
|
20
30
|
</Banner>
|
|
21
31
|
</div>
|
|
22
|
-
{/
|
|
32
|
+
{/each}
|
|
23
33
|
</div>
|
|
24
34
|
</Portal>
|
|
25
35
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export let header = ""
|
|
7
7
|
export let message = ""
|
|
8
8
|
export let onConfirm = undefined
|
|
9
|
+
export let buttonText = ""
|
|
9
10
|
|
|
10
11
|
$: icon = selectIcon(type)
|
|
11
12
|
// if newlines used, convert them to different elements
|
|
@@ -39,13 +40,16 @@
|
|
|
39
40
|
<div class="spectrum-InLineAlert-content">{splitMsg}</div>
|
|
40
41
|
{/each}
|
|
41
42
|
{#if onConfirm}
|
|
42
|
-
<div class="spectrum-InLineAlert-footer">
|
|
43
|
-
<Button secondary on:click={onConfirm}>OK</Button>
|
|
43
|
+
<div class="spectrum-InLineAlert-footer button">
|
|
44
|
+
<Button secondary on:click={onConfirm}>{buttonText || "OK"}</Button>
|
|
44
45
|
</div>
|
|
45
46
|
{/if}
|
|
46
47
|
</div>
|
|
47
48
|
|
|
48
49
|
<style>
|
|
50
|
+
.button {
|
|
51
|
+
margin-top: 10px;
|
|
52
|
+
}
|
|
49
53
|
.spectrum-InLineAlert {
|
|
50
54
|
--spectrum-semantic-negative-border-color: #e34850;
|
|
51
55
|
--spectrum-semantic-positive-border-color: #2d9d78;
|
|
@@ -8,6 +8,8 @@
|
|
|
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
|
|
11
13
|
|
|
12
14
|
export let size = "M"
|
|
13
15
|
|
|
@@ -37,7 +39,7 @@
|
|
|
37
39
|
<slot />
|
|
38
40
|
</div>
|
|
39
41
|
{/if}
|
|
40
|
-
{#if value || value === 0}
|
|
42
|
+
{#if !hidePercentage && (value || value === 0)}
|
|
41
43
|
<div
|
|
42
44
|
class="spectrum-FieldLabel spectrum-ProgressBar-percentage spectrum-FieldLabel--size{size}"
|
|
43
45
|
>
|
|
@@ -47,8 +49,19 @@
|
|
|
47
49
|
<div class="spectrum-ProgressBar-track">
|
|
48
50
|
<div
|
|
49
51
|
class="spectrum-ProgressBar-fill"
|
|
52
|
+
class:color-green={color === "green"}
|
|
53
|
+
class:color-red={color === "red"}
|
|
50
54
|
style={value || value === 0 ? `width: ${$progress}%` : ""}
|
|
51
55
|
/>
|
|
52
56
|
</div>
|
|
53
57
|
<div class="spectrum-ProgressBar-label" hidden="" />
|
|
54
58
|
</div>
|
|
59
|
+
|
|
60
|
+
<style>
|
|
61
|
+
.color-green {
|
|
62
|
+
background: #009562;
|
|
63
|
+
}
|
|
64
|
+
.color-red {
|
|
65
|
+
background: #dd2019;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext } from "svelte"
|
|
3
3
|
const multilevel = getContext("sidenav-type")
|
|
4
|
+
import Badge from "../Badge/Badge.svelte"
|
|
4
5
|
export let href = ""
|
|
5
6
|
export let external = false
|
|
6
7
|
export let heading = ""
|
|
@@ -8,6 +9,7 @@
|
|
|
8
9
|
export let selected = false
|
|
9
10
|
export let disabled = false
|
|
10
11
|
export let dataCy
|
|
12
|
+
export let badge = ""
|
|
11
13
|
</script>
|
|
12
14
|
|
|
13
15
|
<li
|
|
@@ -38,10 +40,22 @@
|
|
|
38
40
|
</svg>
|
|
39
41
|
{/if}
|
|
40
42
|
<slot />
|
|
43
|
+
{#if badge}
|
|
44
|
+
<div class="badge">
|
|
45
|
+
<Badge active size="S">{badge}</Badge>
|
|
46
|
+
</div>
|
|
47
|
+
{/if}
|
|
41
48
|
</a>
|
|
49
|
+
|
|
42
50
|
{#if multilevel && $$slots.subnav}
|
|
43
51
|
<ul class="spectrum-SideNav">
|
|
44
52
|
<slot name="subnav" />
|
|
45
53
|
</ul>
|
|
46
54
|
{/if}
|
|
47
55
|
</li>
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
.badge {
|
|
59
|
+
margin-left: 10px;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
package/src/Stores/banner.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { writable } from "svelte/store"
|
|
2
2
|
|
|
3
|
+
export const BANNER_TYPES = {
|
|
4
|
+
INFO: "info",
|
|
5
|
+
NEGATIVE: "negative",
|
|
6
|
+
}
|
|
7
|
+
|
|
3
8
|
export function createBannerStore() {
|
|
4
|
-
const DEFAULT_CONFIG = {
|
|
9
|
+
const DEFAULT_CONFIG = {
|
|
10
|
+
messages: [],
|
|
11
|
+
}
|
|
5
12
|
|
|
6
13
|
const banner = writable(DEFAULT_CONFIG)
|
|
7
14
|
|
|
@@ -20,17 +27,38 @@ export function createBannerStore() {
|
|
|
20
27
|
const showStatus = async () => {
|
|
21
28
|
const config = {
|
|
22
29
|
message: "Some systems are experiencing issues",
|
|
23
|
-
type:
|
|
30
|
+
type: BANNER_TYPES.NEGATIVE,
|
|
24
31
|
extraButtonText: "View Status",
|
|
25
32
|
extraButtonAction: () => window.open("https://status.budibase.com/"),
|
|
26
33
|
}
|
|
27
34
|
|
|
28
|
-
await
|
|
35
|
+
await queue([config])
|
|
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
|
+
})
|
|
29
55
|
}
|
|
30
56
|
|
|
31
57
|
return {
|
|
32
58
|
subscribe: banner.subscribe,
|
|
33
59
|
showStatus,
|
|
60
|
+
show,
|
|
61
|
+
queue,
|
|
34
62
|
}
|
|
35
63
|
}
|
|
36
64
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
export let tooltip = ""
|
|
6
6
|
export let size = "M"
|
|
7
|
+
export let disabled = true
|
|
7
8
|
|
|
8
9
|
let showTooltip = false
|
|
9
10
|
</script>
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
on:mouseleave={() => (showTooltip = false)}
|
|
20
21
|
on:focus
|
|
21
22
|
>
|
|
22
|
-
<Icon name="InfoOutline" size="S" disabled
|
|
23
|
+
<Icon name="InfoOutline" size="S" {disabled} />
|
|
23
24
|
</div>
|
|
24
25
|
{#if showTooltip}
|
|
25
26
|
<div class="tooltip">
|
|
@@ -54,7 +55,6 @@
|
|
|
54
55
|
transform: scale(0.75);
|
|
55
56
|
}
|
|
56
57
|
.icon-small {
|
|
57
|
-
margin-
|
|
58
|
-
margin-bottom: -5px;
|
|
58
|
+
margin-bottom: -2px;
|
|
59
59
|
}
|
|
60
60
|
</style>
|
package/src/index.js
CHANGED
|
@@ -34,6 +34,7 @@ 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"
|
|
37
38
|
export { default as Menu } from "./Menu/Menu.svelte"
|
|
38
39
|
export { default as MenuSection } from "./Menu/Section.svelte"
|
|
39
40
|
export { default as MenuSeparator } from "./Menu/Separator.svelte"
|
|
@@ -94,7 +95,7 @@ export { default as clickOutside } from "./Actions/click_outside"
|
|
|
94
95
|
|
|
95
96
|
// Stores
|
|
96
97
|
export { notifications, createNotificationStore } from "./Stores/notifications"
|
|
97
|
-
export { banner } from "./Stores/banner"
|
|
98
|
+
export { banner, BANNER_TYPES } from "./Stores/banner"
|
|
98
99
|
|
|
99
100
|
// Helpers
|
|
100
101
|
export * as Helpers from "./helpers"
|