@budibase/bbui 1.0.49-alpha.0 → 1.0.49-alpha.12
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 +1 -1
- package/dist/bbui.es.js.map +1 -1
- package/package.json +2 -2
- package/src/Form/Core/TextArea.svelte +2 -0
- package/src/Form/Core/TextField.svelte +3 -1
- package/src/Form/Field.svelte +2 -1
- package/src/Form/FieldLabel.svelte +11 -6
- package/src/Form/Select.svelte +2 -1
- package/src/Label/Label.svelte +3 -56
- package/src/Table/InternalRenderer.svelte +28 -3
- package/src/Tooltip/TooltipWrapper.svelte +60 -0
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.0.49-alpha.
|
|
4
|
+
"version": "1.0.49-alpha.12",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"svelte": "src/index.js",
|
|
7
7
|
"module": "dist/bbui.es.js",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"svelte-flatpickr": "^3.2.3",
|
|
83
83
|
"svelte-portal": "^1.0.0"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "77f938b85661b5da74e6f676afed584370ac48e1"
|
|
86
86
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
start: textarea.selectionStart,
|
|
14
14
|
end: textarea.selectionEnd,
|
|
15
15
|
})
|
|
16
|
+
export let align = null
|
|
16
17
|
|
|
17
18
|
let focus = false
|
|
18
19
|
let textarea
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
bind:this={textarea}
|
|
47
48
|
placeholder={placeholder || ""}
|
|
48
49
|
class="spectrum-Textfield-input"
|
|
50
|
+
style={align ? `text-align: ${align}` : ""}
|
|
49
51
|
{disabled}
|
|
50
52
|
{id}
|
|
51
53
|
on:focus={() => (focus = true)}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
export let updateOnChange = true
|
|
13
13
|
export let quiet = false
|
|
14
14
|
export let dataCy
|
|
15
|
+
export let align
|
|
15
16
|
|
|
16
17
|
const dispatch = createEventDispatcher()
|
|
17
18
|
let focus = false
|
|
@@ -92,8 +93,9 @@
|
|
|
92
93
|
on:input={onInput}
|
|
93
94
|
on:keyup={updateValueOnEnter}
|
|
94
95
|
{type}
|
|
95
|
-
inputmode={type === "number" ? "decimal" : "text"}
|
|
96
96
|
class="spectrum-Textfield-input"
|
|
97
|
+
style={align ? `text-align: ${align};` : ""}
|
|
98
|
+
inputmode={type === "number" ? "decimal" : "text"}
|
|
97
99
|
/>
|
|
98
100
|
</div>
|
|
99
101
|
|
package/src/Form/Field.svelte
CHANGED
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
export let label = null
|
|
7
7
|
export let labelPosition = "above"
|
|
8
8
|
export let error = null
|
|
9
|
+
export let tooltip = ""
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<div class="spectrum-Form-item" class:above={labelPosition === "above"}>
|
|
12
13
|
{#if label}
|
|
13
|
-
<FieldLabel forId={id} {label} position={labelPosition} />
|
|
14
|
+
<FieldLabel forId={id} {label} position={labelPosition} {tooltip} />
|
|
14
15
|
{/if}
|
|
15
16
|
<div class="spectrum-Form-itemField">
|
|
16
17
|
<slot />
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import TooltipWrapper from "../Tooltip/TooltipWrapper.svelte"
|
|
3
|
+
|
|
2
4
|
import "@spectrum-css/fieldlabel/dist/index-vars.css"
|
|
3
5
|
|
|
4
6
|
export let forId
|
|
5
7
|
export let label
|
|
6
8
|
export let position = "above"
|
|
9
|
+
export let tooltip = ""
|
|
7
10
|
|
|
8
11
|
$: className = position === "above" ? "" : `spectrum-FieldLabel--${position}`
|
|
9
12
|
</script>
|
|
10
13
|
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
<TooltipWrapper {tooltip} size="S">
|
|
15
|
+
<label
|
|
16
|
+
for={forId}
|
|
17
|
+
class={`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${className}`}
|
|
18
|
+
>
|
|
19
|
+
{label || ""}
|
|
20
|
+
</label>
|
|
21
|
+
</TooltipWrapper>
|
|
17
22
|
|
|
18
23
|
<style>
|
|
19
24
|
label {
|
package/src/Form/Select.svelte
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
export let quiet = false
|
|
18
18
|
export let autoWidth = false
|
|
19
19
|
export let sort = false
|
|
20
|
+
export let tooltip = ""
|
|
20
21
|
|
|
21
22
|
const dispatch = createEventDispatcher()
|
|
22
23
|
const onChange = e => {
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
}
|
|
33
34
|
</script>
|
|
34
35
|
|
|
35
|
-
<Field {label} {labelPosition} {error}>
|
|
36
|
+
<Field {label} {labelPosition} {error} {tooltip}>
|
|
36
37
|
<Select
|
|
37
38
|
{quiet}
|
|
38
39
|
{error}
|
package/src/Label/Label.svelte
CHANGED
|
@@ -1,73 +1,20 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import "@spectrum-css/fieldlabel/dist/index-vars.css"
|
|
3
|
-
import
|
|
4
|
-
import Icon from "../Icon/Icon.svelte"
|
|
3
|
+
import TooltipWrapper from "../Tooltip/TooltipWrapper.svelte"
|
|
5
4
|
|
|
6
5
|
export let size = "M"
|
|
7
6
|
export let tooltip = ""
|
|
8
|
-
export let showTooltip = false
|
|
9
7
|
</script>
|
|
10
8
|
|
|
11
|
-
{
|
|
12
|
-
<div class="container">
|
|
13
|
-
<label
|
|
14
|
-
for=""
|
|
15
|
-
class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}
|
|
16
|
-
>
|
|
17
|
-
<slot />
|
|
18
|
-
</label>
|
|
19
|
-
<div class="icon-container">
|
|
20
|
-
<div
|
|
21
|
-
class="icon"
|
|
22
|
-
class:icon-small={size === "M" || size === "S"}
|
|
23
|
-
on:mouseover={() => (showTooltip = true)}
|
|
24
|
-
on:mouseleave={() => (showTooltip = false)}
|
|
25
|
-
>
|
|
26
|
-
<Icon name="InfoOutline" size="S" disabled={true} />
|
|
27
|
-
</div>
|
|
28
|
-
{#if showTooltip}
|
|
29
|
-
<div class="tooltip">
|
|
30
|
-
<Tooltip textWrapping={true} direction={"bottom"} text={tooltip} />
|
|
31
|
-
</div>
|
|
32
|
-
{/if}
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
{:else}
|
|
9
|
+
<TooltipWrapper {tooltip} {size}>
|
|
36
10
|
<label for="" class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}>
|
|
37
11
|
<slot />
|
|
38
12
|
</label>
|
|
39
|
-
|
|
13
|
+
</TooltipWrapper>
|
|
40
14
|
|
|
41
15
|
<style>
|
|
42
16
|
label {
|
|
43
17
|
padding: 0;
|
|
44
18
|
white-space: nowrap;
|
|
45
19
|
}
|
|
46
|
-
.container {
|
|
47
|
-
display: flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
}
|
|
50
|
-
.icon-container {
|
|
51
|
-
position: relative;
|
|
52
|
-
display: flex;
|
|
53
|
-
justify-content: center;
|
|
54
|
-
margin-top: 1px;
|
|
55
|
-
margin-left: 5px;
|
|
56
|
-
margin-right: 5px;
|
|
57
|
-
}
|
|
58
|
-
.tooltip {
|
|
59
|
-
position: absolute;
|
|
60
|
-
display: flex;
|
|
61
|
-
justify-content: center;
|
|
62
|
-
top: 15px;
|
|
63
|
-
z-index: 1;
|
|
64
|
-
width: 160px;
|
|
65
|
-
}
|
|
66
|
-
.icon {
|
|
67
|
-
transform: scale(0.75);
|
|
68
|
-
}
|
|
69
|
-
.icon-small {
|
|
70
|
-
margin-top: -2px;
|
|
71
|
-
margin-bottom: -5px;
|
|
72
|
-
}
|
|
73
20
|
</style>
|
|
@@ -8,10 +8,35 @@
|
|
|
8
8
|
copyToClipboard(value)
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const copyToClipboard = value => {
|
|
12
|
+
return new Promise(res => {
|
|
13
|
+
if (navigator.clipboard && window.isSecureContext) {
|
|
14
|
+
// Try using the clipboard API first
|
|
15
|
+
navigator.clipboard.writeText(value).then(res)
|
|
16
|
+
} else {
|
|
17
|
+
// Fall back to the textarea hack
|
|
18
|
+
let textArea = document.createElement("textarea")
|
|
19
|
+
textArea.value = value
|
|
20
|
+
textArea.style.position = "fixed"
|
|
21
|
+
textArea.style.left = "-9999px"
|
|
22
|
+
textArea.style.top = "-9999px"
|
|
23
|
+
document.body.appendChild(textArea)
|
|
24
|
+
textArea.focus()
|
|
25
|
+
textArea.select()
|
|
26
|
+
document.execCommand("copy")
|
|
27
|
+
textArea.remove()
|
|
28
|
+
res()
|
|
29
|
+
}
|
|
14
30
|
})
|
|
31
|
+
.then(() => {
|
|
32
|
+
notifications.success("Copied to clipboard")
|
|
33
|
+
})
|
|
34
|
+
.catch(() => {
|
|
35
|
+
notifications.error(
|
|
36
|
+
"Failed to copy to clipboard. Check the dev console for the value."
|
|
37
|
+
)
|
|
38
|
+
console.warn("Failed to copy the value", value)
|
|
39
|
+
})
|
|
15
40
|
}
|
|
16
41
|
</script>
|
|
17
42
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Tooltip from "./Tooltip.svelte"
|
|
3
|
+
import Icon from "../Icon/Icon.svelte"
|
|
4
|
+
|
|
5
|
+
export let tooltip = ""
|
|
6
|
+
export let size = "M"
|
|
7
|
+
|
|
8
|
+
let showTooltip = false
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div class:container={!!tooltip}>
|
|
12
|
+
<slot />
|
|
13
|
+
{#if tooltip}
|
|
14
|
+
<div class="icon-container">
|
|
15
|
+
<div
|
|
16
|
+
class="icon"
|
|
17
|
+
class:icon-small={size === "M" || size === "S"}
|
|
18
|
+
on:mouseover={() => (showTooltip = true)}
|
|
19
|
+
on:mouseleave={() => (showTooltip = false)}
|
|
20
|
+
>
|
|
21
|
+
<Icon name="InfoOutline" size="S" disabled={true} />
|
|
22
|
+
</div>
|
|
23
|
+
{#if showTooltip}
|
|
24
|
+
<div class="tooltip">
|
|
25
|
+
<Tooltip textWrapping={true} direction={"bottom"} text={tooltip} />
|
|
26
|
+
</div>
|
|
27
|
+
{/if}
|
|
28
|
+
</div>
|
|
29
|
+
{/if}
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<style>
|
|
33
|
+
.container {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
}
|
|
37
|
+
.icon-container {
|
|
38
|
+
position: relative;
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
margin-top: 1px;
|
|
42
|
+
margin-left: 5px;
|
|
43
|
+
margin-right: 5px;
|
|
44
|
+
}
|
|
45
|
+
.tooltip {
|
|
46
|
+
position: absolute;
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
top: 15px;
|
|
50
|
+
z-index: 1;
|
|
51
|
+
width: 160px;
|
|
52
|
+
}
|
|
53
|
+
.icon {
|
|
54
|
+
transform: scale(0.75);
|
|
55
|
+
}
|
|
56
|
+
.icon-small {
|
|
57
|
+
margin-top: -2px;
|
|
58
|
+
margin-bottom: -5px;
|
|
59
|
+
}
|
|
60
|
+
</style>
|