@budibase/bbui 0.9.187 → 0.9.190-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/LICENSE +371 -7
- package/dist/bbui.es.js +1 -1
- package/dist/bbui.es.js.map +1 -1
- package/package.json +4 -3
- package/src/Form/Combobox.svelte +4 -0
- package/src/Form/Core/Checkbox.svelte +11 -0
- package/src/Form/Core/Combobox.svelte +13 -4
- package/src/Form/Core/TextField.svelte +6 -4
- package/src/Form/Input.svelte +2 -0
- package/src/InlineAlert/InlineAlert.svelte +56 -0
- package/src/Label/Label.svelte +54 -3
- package/src/Tooltip/Tooltip.svelte +15 -5
- package/src/index.js +1 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/bbui",
|
|
3
3
|
"description": "A UI solution used in the different Budibase projects.",
|
|
4
|
-
"version": "0.9.
|
|
5
|
-
"license": "
|
|
4
|
+
"version": "0.9.190-alpha.1",
|
|
5
|
+
"license": "MPL-2.0",
|
|
6
6
|
"svelte": "src/index.js",
|
|
7
7
|
"module": "dist/bbui.es.js",
|
|
8
8
|
"exports": {
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"@spectrum-css/fieldlabel": "^3.0.1",
|
|
52
52
|
"@spectrum-css/icon": "^3.0.1",
|
|
53
53
|
"@spectrum-css/illustratedmessage": "^3.0.2",
|
|
54
|
+
"@spectrum-css/inlinealert": "^2.0.1",
|
|
54
55
|
"@spectrum-css/inputgroup": "^3.0.2",
|
|
55
56
|
"@spectrum-css/label": "^2.0.10",
|
|
56
57
|
"@spectrum-css/link": "^3.1.1",
|
|
@@ -81,5 +82,5 @@
|
|
|
81
82
|
"svelte-flatpickr": "^3.2.3",
|
|
82
83
|
"svelte-portal": "^1.0.0"
|
|
83
84
|
},
|
|
84
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "b585fe964293c4016848f850dd561982162e0896"
|
|
85
86
|
}
|
package/src/Form/Combobox.svelte
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export let value = null
|
|
7
7
|
export let label = undefined
|
|
8
8
|
export let disabled = false
|
|
9
|
+
export let readonly = false
|
|
9
10
|
export let labelPosition = "above"
|
|
10
11
|
export let error = null
|
|
11
12
|
export let placeholder = "Choose an option or type"
|
|
@@ -33,8 +34,11 @@
|
|
|
33
34
|
{value}
|
|
34
35
|
{options}
|
|
35
36
|
{placeholder}
|
|
37
|
+
{readonly}
|
|
36
38
|
{getOptionLabel}
|
|
37
39
|
{getOptionValue}
|
|
38
40
|
on:change={onChange}
|
|
41
|
+
on:pick
|
|
42
|
+
on:type
|
|
39
43
|
/>
|
|
40
44
|
</Field>
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
<label
|
|
22
22
|
class="spectrum-Checkbox spectrum-Checkbox--emphasized {sizeClass}"
|
|
23
23
|
class:is-invalid={!!error}
|
|
24
|
+
class:checked={value}
|
|
24
25
|
>
|
|
25
26
|
<input
|
|
26
27
|
checked={value}
|
|
@@ -50,6 +51,16 @@
|
|
|
50
51
|
</label>
|
|
51
52
|
|
|
52
53
|
<style>
|
|
54
|
+
.spectrum-Checkbox--sizeL .spectrum-Checkbox-checkmark {
|
|
55
|
+
transform: scale(1.1);
|
|
56
|
+
left: 55%;
|
|
57
|
+
top: 55%;
|
|
58
|
+
}
|
|
59
|
+
.spectrum-Checkbox--sizeXL .spectrum-Checkbox-checkmark {
|
|
60
|
+
transform: scale(1.2);
|
|
61
|
+
left: 60%;
|
|
62
|
+
top: 60%;
|
|
63
|
+
}
|
|
53
64
|
.spectrum-Checkbox-input {
|
|
54
65
|
opacity: 0;
|
|
55
66
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
export let id = null
|
|
10
10
|
export let placeholder = "Choose an option or type"
|
|
11
11
|
export let disabled = false
|
|
12
|
+
export let readonly = false
|
|
12
13
|
export let error = null
|
|
13
14
|
export let options = []
|
|
14
15
|
export let getOptionLabel = option => option
|
|
@@ -40,8 +41,15 @@
|
|
|
40
41
|
open = false
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
const
|
|
44
|
-
|
|
44
|
+
const onType = e => {
|
|
45
|
+
const value = e.target.value
|
|
46
|
+
dispatch("type", value)
|
|
47
|
+
selectOption(value)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const onPick = value => {
|
|
51
|
+
dispatch("pick", value)
|
|
52
|
+
selectOption(value)
|
|
45
53
|
}
|
|
46
54
|
</script>
|
|
47
55
|
|
|
@@ -62,10 +70,11 @@
|
|
|
62
70
|
type="text"
|
|
63
71
|
on:focus={() => (focus = true)}
|
|
64
72
|
on:blur={() => (focus = false)}
|
|
65
|
-
on:change={
|
|
73
|
+
on:change={onType}
|
|
66
74
|
value={value || ""}
|
|
67
75
|
placeholder={placeholder || ""}
|
|
68
76
|
{disabled}
|
|
77
|
+
{readonly}
|
|
69
78
|
class="spectrum-Textfield-input spectrum-InputGroup-input"
|
|
70
79
|
/>
|
|
71
80
|
</div>
|
|
@@ -99,7 +108,7 @@
|
|
|
99
108
|
role="option"
|
|
100
109
|
aria-selected="true"
|
|
101
110
|
tabindex="0"
|
|
102
|
-
on:click={() =>
|
|
111
|
+
on:click={() => onPick(getOptionValue(option))}
|
|
103
112
|
>
|
|
104
113
|
<span class="spectrum-Menu-itemLabel"
|
|
105
114
|
>{getOptionLabel(option)}</span
|
|
@@ -11,19 +11,20 @@
|
|
|
11
11
|
export let readonly = false
|
|
12
12
|
export let updateOnChange = true
|
|
13
13
|
export let quiet = false
|
|
14
|
+
export let dataCy
|
|
14
15
|
|
|
15
16
|
const dispatch = createEventDispatcher()
|
|
16
17
|
let focus = false
|
|
17
18
|
|
|
18
|
-
const updateValue =
|
|
19
|
+
const updateValue = newValue => {
|
|
19
20
|
if (readonly) {
|
|
20
21
|
return
|
|
21
22
|
}
|
|
22
23
|
if (type === "number") {
|
|
23
|
-
const float = parseFloat(
|
|
24
|
-
|
|
24
|
+
const float = parseFloat(newValue)
|
|
25
|
+
newValue = isNaN(float) ? null : float
|
|
25
26
|
}
|
|
26
|
-
dispatch("change",
|
|
27
|
+
dispatch("change", newValue)
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
const onFocus = () => {
|
|
@@ -78,6 +79,7 @@
|
|
|
78
79
|
{disabled}
|
|
79
80
|
{readonly}
|
|
80
81
|
{id}
|
|
82
|
+
data-cy={dataCy}
|
|
81
83
|
value={value || ""}
|
|
82
84
|
placeholder={placeholder || ""}
|
|
83
85
|
on:click
|
package/src/Form/Input.svelte
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
export let error = null
|
|
14
14
|
export let updateOnChange = true
|
|
15
15
|
export let quiet = false
|
|
16
|
+
export let dataCy
|
|
16
17
|
|
|
17
18
|
const dispatch = createEventDispatcher()
|
|
18
19
|
const onChange = e => {
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
|
|
24
25
|
<Field {label} {labelPosition} {error}>
|
|
25
26
|
<TextField
|
|
27
|
+
{dataCy}
|
|
26
28
|
{updateOnChange}
|
|
27
29
|
{error}
|
|
28
30
|
{disabled}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/inlinealert/dist/index-vars.css"
|
|
3
|
+
import Button from "../Button/Button.svelte"
|
|
4
|
+
|
|
5
|
+
export let type = "info"
|
|
6
|
+
export let header = ""
|
|
7
|
+
export let message = ""
|
|
8
|
+
export let onConfirm = undefined
|
|
9
|
+
|
|
10
|
+
$: icon = selectIcon(type)
|
|
11
|
+
// if newlines used, convert them to different elements
|
|
12
|
+
$: split = message.split("\n")
|
|
13
|
+
|
|
14
|
+
function selectIcon(alertType) {
|
|
15
|
+
switch (alertType) {
|
|
16
|
+
case "error":
|
|
17
|
+
case "negative":
|
|
18
|
+
return "Alert"
|
|
19
|
+
case "success":
|
|
20
|
+
return "CheckmarkCircle"
|
|
21
|
+
case "help":
|
|
22
|
+
return "Help"
|
|
23
|
+
default:
|
|
24
|
+
return "Info"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<div class="spectrum-InLineAlert spectrum-InLineAlert--{type}">
|
|
30
|
+
<svg
|
|
31
|
+
class="spectrum-Icon spectrum-Icon--sizeM spectrum-InLineAlert-icon"
|
|
32
|
+
focusable="false"
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
>
|
|
35
|
+
<use xlink:href="#spectrum-icon-18-{icon}" />
|
|
36
|
+
</svg>
|
|
37
|
+
<div class="spectrum-InLineAlert-header">{header}</div>
|
|
38
|
+
{#each split as splitMsg}
|
|
39
|
+
<div class="spectrum-InLineAlert-content">{splitMsg}</div>
|
|
40
|
+
{/each}
|
|
41
|
+
{#if onConfirm}
|
|
42
|
+
<div class="spectrum-InLineAlert-footer">
|
|
43
|
+
<Button secondary on:click={onConfirm}>OK</Button>
|
|
44
|
+
</div>
|
|
45
|
+
{/if}
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<style>
|
|
49
|
+
.spectrum-InLineAlert {
|
|
50
|
+
--spectrum-semantic-negative-border-color: #e34850;
|
|
51
|
+
--spectrum-semantic-positive-border-color: #2d9d78;
|
|
52
|
+
--spectrum-semantic-positive-icon-color: #2d9d78;
|
|
53
|
+
--spectrum-semantic-negative-icon-color: #e34850;
|
|
54
|
+
min-width: 100px;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
package/src/Label/Label.svelte
CHANGED
|
@@ -1,16 +1,67 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import "@spectrum-css/fieldlabel/dist/index-vars.css"
|
|
3
|
+
import Tooltip from "../Tooltip/Tooltip.svelte"
|
|
4
|
+
import Icon from "../Icon/Icon.svelte"
|
|
3
5
|
|
|
4
6
|
export let size = "M"
|
|
7
|
+
export let tooltip = ""
|
|
8
|
+
export let showTooltip = false
|
|
5
9
|
</script>
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
11
|
+
{#if tooltip}
|
|
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
|
+
on:mouseover={() => (showTooltip = true)}
|
|
23
|
+
on:mouseleave={() => (showTooltip = false)}
|
|
24
|
+
>
|
|
25
|
+
<Icon name="InfoOutline" size="S" disabled={true} />
|
|
26
|
+
</div>
|
|
27
|
+
{#if showTooltip}
|
|
28
|
+
<div class="tooltip">
|
|
29
|
+
<Tooltip textWrapping={true} direction={"bottom"} text={tooltip} />
|
|
30
|
+
</div>
|
|
31
|
+
{/if}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
{:else}
|
|
35
|
+
<label for="" class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}>
|
|
36
|
+
<slot />
|
|
37
|
+
</label>
|
|
38
|
+
{/if}
|
|
10
39
|
|
|
11
40
|
<style>
|
|
12
41
|
label {
|
|
13
42
|
padding: 0;
|
|
14
43
|
white-space: nowrap;
|
|
15
44
|
}
|
|
45
|
+
.container {
|
|
46
|
+
display: flex;
|
|
47
|
+
}
|
|
48
|
+
.icon-container {
|
|
49
|
+
position: relative;
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
margin-top: 1px;
|
|
53
|
+
margin-left: 5px;
|
|
54
|
+
margin-right: 5px;
|
|
55
|
+
}
|
|
56
|
+
.tooltip {
|
|
57
|
+
position: absolute;
|
|
58
|
+
display: flex;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
top: 15px;
|
|
61
|
+
z-index: 1;
|
|
62
|
+
width: 160px;
|
|
63
|
+
}
|
|
64
|
+
.icon {
|
|
65
|
+
transform: scale(0.75);
|
|
66
|
+
}
|
|
16
67
|
</style>
|
|
@@ -3,12 +3,22 @@
|
|
|
3
3
|
|
|
4
4
|
export let direction = "top"
|
|
5
5
|
export let text = ""
|
|
6
|
+
export let textWrapping = false
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<
|
|
9
|
+
<!-- Showing / Hiding a text wrapped tooltip should be handled outside the component -->
|
|
10
|
+
{#if textWrapping}
|
|
11
|
+
<span class="spectrum-Tooltip spectrum-Tooltip--{direction} is-open">
|
|
11
12
|
<span class="spectrum-Tooltip-label">{text}</span>
|
|
12
13
|
<span class="spectrum-Tooltip-tip" />
|
|
13
|
-
</
|
|
14
|
-
|
|
14
|
+
</span>
|
|
15
|
+
{:else}
|
|
16
|
+
<!-- The default show on hover tooltip does not support text wrapping -->
|
|
17
|
+
<span class="u-tooltip-showOnHover tooltip">
|
|
18
|
+
<slot />
|
|
19
|
+
<div class={`spectrum-Tooltip spectrum-Tooltip--${direction}`}>
|
|
20
|
+
<span class="spectrum-Tooltip-label">{text}</span>
|
|
21
|
+
<span class="spectrum-Tooltip-tip" />
|
|
22
|
+
</div>
|
|
23
|
+
</span>
|
|
24
|
+
{/if}
|
package/src/index.js
CHANGED
|
@@ -58,6 +58,7 @@ export { default as Pagination } from "./Pagination/Pagination.svelte"
|
|
|
58
58
|
export { default as Badge } from "./Badge/Badge.svelte"
|
|
59
59
|
export { default as StatusLight } from "./StatusLight/StatusLight.svelte"
|
|
60
60
|
export { default as ColorPicker } from "./ColorPicker/ColorPicker.svelte"
|
|
61
|
+
export { default as InlineAlert } from "./InlineAlert/InlineAlert.svelte"
|
|
61
62
|
|
|
62
63
|
// Typography
|
|
63
64
|
export { default as Body } from "./Typography/Body.svelte"
|