@budibase/bbui 1.3.21 → 1.3.22-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 +3 -199
- package/dist/bbui.es.js.map +1 -1
- package/package.json +3 -3
- package/src/Actions/position_dropdown.js +15 -6
- package/src/Banner/BannerDisplay.svelte +17 -7
- package/src/InlineAlert/InlineAlert.svelte +6 -2
- package/src/Label/Label.svelte +10 -1
- package/src/Modal/ModalContent.svelte +1 -3
- package/src/Popover/Popover.svelte +2 -1
- 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.
|
|
4
|
+
"version": "1.3.22-alpha.1",
|
|
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": "
|
|
41
|
+
"@budibase/string-templates": "1.3.22-alpha.1",
|
|
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": "db762e7c2d25e6b39b73d0c99ce883bda863ed39"
|
|
89
89
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function positionDropdown(element, { anchor, align }) {
|
|
1
|
+
export default function positionDropdown(element, { anchor, align, maxWidth }) {
|
|
2
2
|
let positionSide = "top"
|
|
3
3
|
let maxHeight = 0
|
|
4
4
|
let dimensions = getDimensions(anchor)
|
|
@@ -34,13 +34,24 @@ export default function positionDropdown(element, { anchor, align }) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function calcLeftPosition() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
let left
|
|
38
|
+
|
|
39
|
+
if (align == "right") {
|
|
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
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
element.style.position = "absolute"
|
|
43
51
|
element.style.zIndex = "9999"
|
|
52
|
+
if (maxWidth) {
|
|
53
|
+
element.style.maxWidth = `${maxWidth}px`
|
|
54
|
+
}
|
|
44
55
|
element.style.minWidth = `${dimensions.width}px`
|
|
45
56
|
element.style.maxHeight = `${maxHeight.toFixed(0)}px`
|
|
46
57
|
element.style.transformOrigin = `center ${positionSide}`
|
|
@@ -54,10 +65,8 @@ export default function positionDropdown(element, { anchor, align }) {
|
|
|
54
65
|
element.style.left = `${calcLeftPosition(dimensions).toFixed(0)}px`
|
|
55
66
|
})
|
|
56
67
|
})
|
|
57
|
-
|
|
58
68
|
resizeObserver.observe(anchor)
|
|
59
69
|
resizeObserver.observe(element)
|
|
60
|
-
|
|
61
70
|
return {
|
|
62
71
|
destroy() {
|
|
63
72
|
resizeObserver.disconnect()
|
|
@@ -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;
|
package/src/Label/Label.svelte
CHANGED
|
@@ -4,10 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
export let size = "M"
|
|
6
6
|
export let tooltip = ""
|
|
7
|
+
export let muted
|
|
7
8
|
</script>
|
|
8
9
|
|
|
9
10
|
<TooltipWrapper {tooltip} {size}>
|
|
10
|
-
<label
|
|
11
|
+
<label
|
|
12
|
+
class:muted
|
|
13
|
+
for=""
|
|
14
|
+
class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}
|
|
15
|
+
>
|
|
11
16
|
<slot />
|
|
12
17
|
</label>
|
|
13
18
|
</TooltipWrapper>
|
|
@@ -17,4 +22,8 @@
|
|
|
17
22
|
padding: 0;
|
|
18
23
|
white-space: nowrap;
|
|
19
24
|
}
|
|
25
|
+
|
|
26
|
+
.muted {
|
|
27
|
+
opacity: 0.5;
|
|
28
|
+
}
|
|
20
29
|
</style>
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
export let secondaryAction = undefined
|
|
25
25
|
export let secondaryButtonWarning = false
|
|
26
26
|
export let dataCy = null
|
|
27
|
-
|
|
28
27
|
const { hide, cancel } = getContext(Context.Modal)
|
|
29
28
|
let loading = false
|
|
30
29
|
$: confirmDisabled = disabled || loading
|
|
@@ -88,12 +87,11 @@
|
|
|
88
87
|
<section class="spectrum-Dialog-content content-grid">
|
|
89
88
|
<slot />
|
|
90
89
|
</section>
|
|
91
|
-
{#if showCancelButton || showConfirmButton}
|
|
90
|
+
{#if showCancelButton || showConfirmButton || $$slots.footer}
|
|
92
91
|
<div
|
|
93
92
|
class="spectrum-ButtonGroup spectrum-Dialog-buttonGroup spectrum-Dialog-buttonGroup--noFooter"
|
|
94
93
|
>
|
|
95
94
|
<slot name="footer" />
|
|
96
|
-
|
|
97
95
|
{#if showSecondaryButton && secondaryButtonText && secondaryAction}
|
|
98
96
|
<div class="secondary-action">
|
|
99
97
|
<Button
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
export let align = "right"
|
|
12
12
|
export let portalTarget
|
|
13
13
|
export let dataCy
|
|
14
|
+
export let maxWidth
|
|
14
15
|
|
|
15
16
|
export let direction = "bottom"
|
|
16
17
|
export let showTip = false
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
<Portal target={portalTarget}>
|
|
46
47
|
<div
|
|
47
48
|
tabindex="0"
|
|
48
|
-
use:positionDropdown={{ anchor, align }}
|
|
49
|
+
use:positionDropdown={{ anchor, align, maxWidth }}
|
|
49
50
|
use:clickOutside={hide}
|
|
50
51
|
on:keydown={handleEscape}
|
|
51
52
|
class={"spectrum-Popover is-open " + (tooltipClasses || "")}
|
|
@@ -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"
|