@budibase/bbui 2.6.22 → 2.6.24-alpha.0
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 +8 -2
- package/dist/bbui.es.js.map +1 -1
- package/package.json +18 -4
- package/src/ActionButton/ActionButton.svelte +3 -1
- package/src/Actions/position_dropdown.js +2 -0
- package/src/Avatar/Avatar.svelte +10 -8
- package/src/Button/Button.svelte +3 -0
- package/src/Drawer/Drawer.svelte +26 -12
- package/src/FancyForm/ErrorMessage.svelte +19 -0
- package/src/FancyForm/FancyField.svelte +2 -11
- package/src/FancyForm/index.js +1 -0
- package/src/Form/Core/DatePicker.svelte +13 -3
- package/src/Form/Core/Dropzone.svelte +2 -2
- package/src/Tabs/Tabs.svelte +13 -3
- package/src/Tooltip/Tooltip.svelte +8 -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": "2.6.
|
|
4
|
+
"version": "2.6.24-alpha.0",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"svelte": "src/index.js",
|
|
7
7
|
"module": "dist/bbui.es.js",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@adobe/spectrum-css-workflow-icons": "1.2.1",
|
|
41
|
-
"@budibase/shared-core": "
|
|
42
|
-
"@budibase/string-templates": "
|
|
41
|
+
"@budibase/shared-core": "2.6.24-alpha.0",
|
|
42
|
+
"@budibase/string-templates": "2.6.24-alpha.0",
|
|
43
43
|
"@spectrum-css/accordion": "3.0.24",
|
|
44
44
|
"@spectrum-css/actionbutton": "1.0.1",
|
|
45
45
|
"@spectrum-css/actiongroup": "1.0.1",
|
|
@@ -90,5 +90,19 @@
|
|
|
90
90
|
"resolutions": {
|
|
91
91
|
"loader-utils": "1.4.1"
|
|
92
92
|
},
|
|
93
|
-
"
|
|
93
|
+
"nx": {
|
|
94
|
+
"targets": {
|
|
95
|
+
"build": {
|
|
96
|
+
"dependsOn": [
|
|
97
|
+
{
|
|
98
|
+
"projects": [
|
|
99
|
+
"@budibase/string-templates"
|
|
100
|
+
],
|
|
101
|
+
"target": "build"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"gitHead": "71a9558d12c55e7d9ef87b82995c62497662acf8"
|
|
94
108
|
}
|
|
@@ -102,7 +102,9 @@
|
|
|
102
102
|
margin-left: 0;
|
|
103
103
|
transition: color ease-out 130ms;
|
|
104
104
|
}
|
|
105
|
-
.is-selected:not(.spectrum-ActionButton--emphasized):not(
|
|
105
|
+
.is-selected:not(.spectrum-ActionButton--emphasized):not(
|
|
106
|
+
.spectrum-ActionButton--quiet
|
|
107
|
+
) {
|
|
106
108
|
background: var(--spectrum-global-color-gray-300);
|
|
107
109
|
border-color: var(--spectrum-global-color-gray-500);
|
|
108
110
|
}
|
|
@@ -56,6 +56,8 @@ export default function positionDropdown(element, opts) {
|
|
|
56
56
|
styles.left = anchorBounds.left + anchorBounds.width - elementBounds.width
|
|
57
57
|
} else if (align === "right-outside") {
|
|
58
58
|
styles.left = anchorBounds.right + offset
|
|
59
|
+
} else if (align === "left-outside") {
|
|
60
|
+
styles.left = anchorBounds.left - elementBounds.width - offset
|
|
59
61
|
} else {
|
|
60
62
|
styles.left = anchorBounds.left
|
|
61
63
|
}
|
package/src/Avatar/Avatar.svelte
CHANGED
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
export let url = ""
|
|
14
14
|
export let disabled = false
|
|
15
15
|
export let initials = "JD"
|
|
16
|
+
export let color = null
|
|
16
17
|
|
|
17
18
|
const DefaultColor = "#3aab87"
|
|
18
19
|
|
|
19
|
-
$:
|
|
20
|
+
$: avatarColor = color || getColor(initials)
|
|
21
|
+
$: style = getStyle(size, avatarColor)
|
|
20
22
|
|
|
21
23
|
const getColor = initials => {
|
|
22
24
|
if (!initials?.length) {
|
|
@@ -26,6 +28,12 @@
|
|
|
26
28
|
const hue = ((code % 26) / 26) * 360
|
|
27
29
|
return `hsl(${hue}, 50%, 50%)`
|
|
28
30
|
}
|
|
31
|
+
|
|
32
|
+
const getStyle = (sizeKey, color) => {
|
|
33
|
+
const size = `var(${sizes.get(sizeKey)})`
|
|
34
|
+
const fontSize = `calc(${size} / 2)`
|
|
35
|
+
return `width:${size}; height:${size}; font-size:${fontSize}; background:${color};`
|
|
36
|
+
}
|
|
29
37
|
</script>
|
|
30
38
|
|
|
31
39
|
{#if url}
|
|
@@ -37,13 +45,7 @@
|
|
|
37
45
|
style="width: var({sizes.get(size)}); height: var({sizes.get(size)});"
|
|
38
46
|
/>
|
|
39
47
|
{:else}
|
|
40
|
-
<div
|
|
41
|
-
class="spectrum-Avatar"
|
|
42
|
-
class:is-disabled={disabled}
|
|
43
|
-
style="width: var({sizes.get(size)}); height: var({sizes.get(
|
|
44
|
-
size
|
|
45
|
-
)}); font-size: calc(var({sizes.get(size)}) / 2); background: {color};"
|
|
46
|
-
>
|
|
48
|
+
<div class="spectrum-Avatar" class:is-disabled={disabled} {style}>
|
|
47
49
|
{initials || ""}
|
|
48
50
|
</div>
|
|
49
51
|
{/if}
|
package/src/Button/Button.svelte
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import "@spectrum-css/button/dist/index-vars.css"
|
|
3
3
|
import Tooltip from "../Tooltip/Tooltip.svelte"
|
|
4
4
|
|
|
5
|
+
export let type
|
|
5
6
|
export let disabled = false
|
|
6
7
|
export let size = "M"
|
|
7
8
|
export let cta = false
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
|
|
22
23
|
<button
|
|
23
24
|
{id}
|
|
25
|
+
{type}
|
|
24
26
|
class:spectrum-Button--cta={cta}
|
|
25
27
|
class:spectrum-Button--primary={primary}
|
|
26
28
|
class:spectrum-Button--secondary={secondary}
|
|
@@ -73,6 +75,7 @@
|
|
|
73
75
|
button {
|
|
74
76
|
position: relative;
|
|
75
77
|
}
|
|
78
|
+
|
|
76
79
|
.spectrum-Button-label {
|
|
77
80
|
white-space: nowrap;
|
|
78
81
|
overflow: hidden;
|
package/src/Drawer/Drawer.svelte
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
import Button from "../Button/Button.svelte"
|
|
4
4
|
import Body from "../Typography/Body.svelte"
|
|
5
5
|
import Heading from "../Typography/Heading.svelte"
|
|
6
|
+
import { setContext } from "svelte"
|
|
6
7
|
|
|
7
8
|
export let title
|
|
8
9
|
export let fillWidth
|
|
9
10
|
export let left = "314px"
|
|
10
11
|
export let width = "calc(100% - 626px)"
|
|
12
|
+
export let headless = false
|
|
11
13
|
|
|
12
14
|
let visible = false
|
|
13
15
|
|
|
@@ -25,6 +27,11 @@
|
|
|
25
27
|
visible = false
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
setContext("drawer-actions", {
|
|
31
|
+
hide,
|
|
32
|
+
show,
|
|
33
|
+
})
|
|
34
|
+
|
|
28
35
|
const easeInOutQuad = x => {
|
|
29
36
|
return x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2
|
|
30
37
|
}
|
|
@@ -47,27 +54,34 @@
|
|
|
47
54
|
<section
|
|
48
55
|
class:fillWidth
|
|
49
56
|
class="drawer"
|
|
57
|
+
class:headless
|
|
50
58
|
transition:slide|local
|
|
51
59
|
style={`width: ${width}; left: ${left};`}
|
|
52
60
|
>
|
|
53
|
-
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
{#if !headless}
|
|
62
|
+
<header>
|
|
63
|
+
<div class="text">
|
|
64
|
+
<Heading size="XS">{title}</Heading>
|
|
65
|
+
<Body size="S">
|
|
66
|
+
<slot name="description" />
|
|
67
|
+
</Body>
|
|
68
|
+
</div>
|
|
69
|
+
<div class="buttons">
|
|
70
|
+
<Button secondary quiet on:click={hide}>Cancel</Button>
|
|
71
|
+
<slot name="buttons" />
|
|
72
|
+
</div>
|
|
73
|
+
</header>
|
|
74
|
+
{/if}
|
|
65
75
|
<slot name="body" />
|
|
66
76
|
</section>
|
|
67
77
|
</Portal>
|
|
68
78
|
{/if}
|
|
69
79
|
|
|
70
80
|
<style>
|
|
81
|
+
.drawer.headless :global(.drawer-contents) {
|
|
82
|
+
height: calc(40vh + 75px);
|
|
83
|
+
}
|
|
84
|
+
|
|
71
85
|
.buttons {
|
|
72
86
|
display: flex;
|
|
73
87
|
gap: var(--spacing-m);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { slide } from "svelte/transition"
|
|
3
|
+
|
|
4
|
+
export let error = null
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div transition:slide|local={{ duration: 130 }} class="error-message">
|
|
8
|
+
{error}
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<style>
|
|
12
|
+
.error-message {
|
|
13
|
+
background: var(--spectrum-global-color-red-400);
|
|
14
|
+
color: white;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
padding: 6px 16px;
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import Icon from "../Icon/Icon.svelte"
|
|
3
3
|
import { getContext, onMount } from "svelte"
|
|
4
|
-
import
|
|
4
|
+
import ErrorMessage from "./ErrorMessage.svelte"
|
|
5
5
|
|
|
6
6
|
export let disabled = false
|
|
7
7
|
export let error = null
|
|
@@ -55,9 +55,7 @@
|
|
|
55
55
|
{/if}
|
|
56
56
|
</div>
|
|
57
57
|
{#if error}
|
|
58
|
-
<
|
|
59
|
-
{error}
|
|
60
|
-
</div>
|
|
58
|
+
<ErrorMessage {error} />
|
|
61
59
|
{/if}
|
|
62
60
|
</div>
|
|
63
61
|
|
|
@@ -110,13 +108,6 @@
|
|
|
110
108
|
.field {
|
|
111
109
|
flex: 1 1 auto;
|
|
112
110
|
}
|
|
113
|
-
.error-message {
|
|
114
|
-
background: var(--spectrum-global-color-red-400);
|
|
115
|
-
color: white;
|
|
116
|
-
font-size: 14px;
|
|
117
|
-
padding: 6px 16px;
|
|
118
|
-
font-weight: 500;
|
|
119
|
-
}
|
|
120
111
|
.error-icon {
|
|
121
112
|
flex: 0 0 auto;
|
|
122
113
|
}
|
package/src/FancyForm/index.js
CHANGED
|
@@ -4,3 +4,4 @@ export { default as FancySelect } from "./FancySelect.svelte"
|
|
|
4
4
|
export { default as FancyButton } from "./FancyButton.svelte"
|
|
5
5
|
export { default as FancyForm } from "./FancyForm.svelte"
|
|
6
6
|
export { default as FancyButtonRadio } from "./FancyButtonRadio.svelte"
|
|
7
|
+
export { default as ErrorMessage } from "./ErrorMessage.svelte"
|
|
@@ -18,10 +18,14 @@
|
|
|
18
18
|
export let ignoreTimezones = false
|
|
19
19
|
export let time24hr = false
|
|
20
20
|
export let range = false
|
|
21
|
+
export let flatpickr
|
|
22
|
+
export let useKeyboardShortcuts = true
|
|
23
|
+
|
|
21
24
|
const dispatch = createEventDispatcher()
|
|
22
25
|
const flatpickrId = `${uuid()}-wrapper`
|
|
26
|
+
|
|
23
27
|
let open = false
|
|
24
|
-
let
|
|
28
|
+
let flatpickrOptions
|
|
25
29
|
|
|
26
30
|
// Another classic flatpickr issue. Errors were randomly being thrown due to
|
|
27
31
|
// flatpickr internal code. Making sure that "destroy" is a valid function
|
|
@@ -59,6 +63,8 @@
|
|
|
59
63
|
dispatch("change", timestamp.toISOString())
|
|
60
64
|
}
|
|
61
65
|
},
|
|
66
|
+
onOpen: () => dispatch("open"),
|
|
67
|
+
onClose: () => dispatch("close"),
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
$: redrawOptions = {
|
|
@@ -113,12 +119,16 @@
|
|
|
113
119
|
|
|
114
120
|
const onOpen = () => {
|
|
115
121
|
open = true
|
|
116
|
-
|
|
122
|
+
if (useKeyboardShortcuts) {
|
|
123
|
+
document.addEventListener("keyup", clearDateOnBackspace)
|
|
124
|
+
}
|
|
117
125
|
}
|
|
118
126
|
|
|
119
127
|
const onClose = () => {
|
|
120
128
|
open = false
|
|
121
|
-
|
|
129
|
+
if (useKeyboardShortcuts) {
|
|
130
|
+
document.removeEventListener("keyup", clearDateOnBackspace)
|
|
131
|
+
}
|
|
122
132
|
|
|
123
133
|
// Manually blur all input fields since flatpickr creates a second
|
|
124
134
|
// duplicate input field.
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
{/if}
|
|
166
166
|
{#if !disabled}
|
|
167
167
|
<div class="delete-button" on:click={removeFile}>
|
|
168
|
-
<Icon name="
|
|
168
|
+
<Icon name="Delete" />
|
|
169
169
|
</div>
|
|
170
170
|
{/if}
|
|
171
171
|
</div>
|
|
@@ -209,7 +209,7 @@
|
|
|
209
209
|
{/if}
|
|
210
210
|
{#if !disabled}
|
|
211
211
|
<div class="delete-button" on:click={removeFile}>
|
|
212
|
-
<Icon name="
|
|
212
|
+
<Icon name="Delete" />
|
|
213
213
|
</div>
|
|
214
214
|
{/if}
|
|
215
215
|
</div>
|
package/src/Tabs/Tabs.svelte
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
export let emphasized = false
|
|
13
13
|
export let onTop = false
|
|
14
14
|
export let size = "M"
|
|
15
|
+
export let beforeSwitch = null
|
|
15
16
|
|
|
16
17
|
let thisSelected = undefined
|
|
17
18
|
|
|
@@ -28,9 +29,18 @@
|
|
|
28
29
|
thisSelected = selected
|
|
29
30
|
dispatch("select", thisSelected)
|
|
30
31
|
} else if ($tab.title !== thisSelected) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
if (typeof beforeSwitch == "function") {
|
|
33
|
+
const proceed = beforeSwitch($tab.title)
|
|
34
|
+
if (proceed) {
|
|
35
|
+
thisSelected = $tab.title
|
|
36
|
+
selected = $tab.title
|
|
37
|
+
dispatch("select", thisSelected)
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
thisSelected = $tab.title
|
|
41
|
+
selected = $tab.title
|
|
42
|
+
dispatch("select", thisSelected)
|
|
43
|
+
}
|
|
34
44
|
}
|
|
35
45
|
if ($tab.title !== thisSelected) {
|
|
36
46
|
tab.update(state => {
|
|
@@ -31,4 +31,12 @@
|
|
|
31
31
|
.spectrum-Tooltip-tip {
|
|
32
32
|
border-top-color: var(--spectrum-global-color-gray-500);
|
|
33
33
|
}
|
|
34
|
+
.spectrum-Tooltip {
|
|
35
|
+
max-width: 280px;
|
|
36
|
+
}
|
|
37
|
+
.spectrum-Tooltip-label {
|
|
38
|
+
text-overflow: ellipsis;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
}
|
|
34
42
|
</style>
|