@budibase/bbui 2.2.12-alpha.50 → 2.2.12-alpha.52
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/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.2.12-alpha.
|
|
4
|
+
"version": "2.2.12-alpha.52",
|
|
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": "2.2.12-alpha.
|
|
41
|
+
"@budibase/string-templates": "2.2.12-alpha.52",
|
|
42
42
|
"@spectrum-css/accordion": "3.0.24",
|
|
43
43
|
"@spectrum-css/actionbutton": "1.0.1",
|
|
44
44
|
"@spectrum-css/actiongroup": "1.0.1",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"resolutions": {
|
|
90
90
|
"loader-utils": "1.4.1"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "7fe5659e27feb384be4488add2e7a8e5ca4b0d63"
|
|
93
93
|
}
|
|
@@ -3,6 +3,9 @@ export default function positionDropdown(
|
|
|
3
3
|
{ anchor, align, maxWidth, useAnchorWidth }
|
|
4
4
|
) {
|
|
5
5
|
const update = () => {
|
|
6
|
+
if (!anchor) {
|
|
7
|
+
return
|
|
8
|
+
}
|
|
6
9
|
const anchorBounds = anchor.getBoundingClientRect()
|
|
7
10
|
const elementBounds = element.getBoundingClientRect()
|
|
8
11
|
let styles = {
|
|
@@ -13,6 +16,8 @@ export default function positionDropdown(
|
|
|
13
16
|
top: null,
|
|
14
17
|
}
|
|
15
18
|
|
|
19
|
+
let popoverLeftPad = 20
|
|
20
|
+
|
|
16
21
|
// Determine vertical styles
|
|
17
22
|
if (window.innerHeight - anchorBounds.bottom < 100) {
|
|
18
23
|
styles.top = anchorBounds.top - elementBounds.height - 5
|
|
@@ -29,7 +34,13 @@ export default function positionDropdown(
|
|
|
29
34
|
styles.minWidth = anchorBounds.width
|
|
30
35
|
}
|
|
31
36
|
if (align === "right") {
|
|
32
|
-
|
|
37
|
+
let left =
|
|
38
|
+
anchorBounds.left + anchorBounds.width / 2 - elementBounds.width
|
|
39
|
+
// Accommodate margin on popover: 1.25rem; ~20px
|
|
40
|
+
if (left + elementBounds.width + popoverLeftPad > window.innerWidth) {
|
|
41
|
+
left -= 20
|
|
42
|
+
}
|
|
43
|
+
styles.left = left
|
|
33
44
|
} else if (align === "right-side") {
|
|
34
45
|
styles.left = anchorBounds.left + anchorBounds.width
|
|
35
46
|
} else {
|
|
@@ -54,8 +65,11 @@ export default function positionDropdown(
|
|
|
54
65
|
const resizeObserver = new ResizeObserver(entries => {
|
|
55
66
|
entries.forEach(update)
|
|
56
67
|
})
|
|
57
|
-
|
|
68
|
+
if (anchor) {
|
|
69
|
+
resizeObserver.observe(anchor)
|
|
70
|
+
}
|
|
58
71
|
resizeObserver.observe(element)
|
|
72
|
+
resizeObserver.observe(document.body)
|
|
59
73
|
|
|
60
74
|
document.addEventListener("scroll", update, true)
|
|
61
75
|
|
package/src/Button/Button.svelte
CHANGED
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
export let tooltip = undefined
|
|
16
16
|
export let dataCy
|
|
17
17
|
export let newStyles = true
|
|
18
|
+
export let id
|
|
18
19
|
|
|
19
20
|
let showTooltip = false
|
|
20
21
|
</script>
|
|
21
22
|
|
|
22
23
|
<button
|
|
24
|
+
{id}
|
|
23
25
|
class:spectrum-Button--cta={cta}
|
|
24
26
|
class:spectrum-Button--primary={primary}
|
|
25
27
|
class:spectrum-Button--secondary={secondary}
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
export let showTip = false
|
|
20
20
|
export let open = false
|
|
21
21
|
export let useAnchorWidth = false
|
|
22
|
-
|
|
23
|
-
let tipSvg =
|
|
24
|
-
'<svg xmlns="http://www.w3.org/svg/2000" width="23" height="12" class="spectrum-Popover-tip" > <path class="spectrum-Popover-tip-triangle" d="M 0.7071067811865476 0 L 11.414213562373096 10.707106781186548 L 22.121320343559645 0" /> </svg>'
|
|
22
|
+
export let dismissible = true
|
|
25
23
|
|
|
26
24
|
$: tooltipClasses = showTip
|
|
27
25
|
? `spectrum-Popover--withTip spectrum-Popover--${direction}`
|
|
@@ -67,9 +65,15 @@
|
|
|
67
65
|
<Portal {target}>
|
|
68
66
|
<div
|
|
69
67
|
tabindex="0"
|
|
70
|
-
use:positionDropdown={{
|
|
68
|
+
use:positionDropdown={{
|
|
69
|
+
anchor,
|
|
70
|
+
align,
|
|
71
|
+
maxWidth,
|
|
72
|
+
useAnchorWidth,
|
|
73
|
+
showTip: false,
|
|
74
|
+
}}
|
|
71
75
|
use:clickOutside={{
|
|
72
|
-
callback: handleOutsideClick,
|
|
76
|
+
callback: dismissible ? handleOutsideClick : () => {},
|
|
73
77
|
anchor,
|
|
74
78
|
}}
|
|
75
79
|
on:keydown={handleEscape}
|
|
@@ -78,10 +82,6 @@
|
|
|
78
82
|
data-cy={dataCy}
|
|
79
83
|
transition:fly|local={{ y: -20, duration: 200 }}
|
|
80
84
|
>
|
|
81
|
-
{#if showTip}
|
|
82
|
-
{@html tipSvg}
|
|
83
|
-
{/if}
|
|
84
|
-
|
|
85
85
|
<slot />
|
|
86
86
|
</div>
|
|
87
87
|
</Portal>
|
package/src/Tabs/Tab.svelte
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import Portal from "svelte-portal"
|
|
4
4
|
export let title
|
|
5
5
|
export let icon = ""
|
|
6
|
+
export let id
|
|
6
7
|
|
|
7
8
|
const dispatch = createEventDispatcher()
|
|
8
9
|
let selected = getContext("tab")
|
|
@@ -31,10 +32,7 @@
|
|
|
31
32
|
$: {
|
|
32
33
|
if ($selected.title === title && tab_internal) {
|
|
33
34
|
if ($selected.info?.left !== tab_internal.getBoundingClientRect().left) {
|
|
34
|
-
|
|
35
|
-
...$selected,
|
|
36
|
-
info: tab_internal.getBoundingClientRect(),
|
|
37
|
-
}
|
|
35
|
+
setTabInfo()
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
}
|
|
@@ -50,6 +48,7 @@
|
|
|
50
48
|
</script>
|
|
51
49
|
|
|
52
50
|
<div
|
|
51
|
+
{id}
|
|
53
52
|
bind:this={tab_internal}
|
|
54
53
|
on:click={onClick}
|
|
55
54
|
class:is-selected={$selected.title === title}
|