@budibase/bbui 1.0.192-alpha.6 → 1.0.192-alpha.7
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 +12 -12
- package/dist/bbui.es.js.map +1 -1
- package/package.json +3 -3
- package/src/ActionButton/ActionButton.svelte +25 -1
- package/src/Form/Combobox.svelte +2 -0
- package/src/Form/Core/Combobox.svelte +15 -18
- package/src/Form/Core/Multiselect.svelte +2 -0
- package/src/Form/Core/Picker.svelte +28 -1
- package/src/Form/Core/Select.svelte +2 -0
- package/src/Form/Multiselect.svelte +2 -0
- package/src/Form/Select.svelte +2 -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.192-alpha.
|
|
4
|
+
"version": "1.0.192-alpha.7",
|
|
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": "^1.0.192-alpha.
|
|
41
|
+
"@budibase/string-templates": "^1.0.192-alpha.7",
|
|
42
42
|
"@spectrum-css/actionbutton": "^1.0.1",
|
|
43
43
|
"@spectrum-css/actiongroup": "^1.0.1",
|
|
44
44
|
"@spectrum-css/avatar": "^3.0.2",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"svelte-flatpickr": "^3.2.3",
|
|
85
85
|
"svelte-portal": "^1.0.0"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "83638579205c42dcfd6a5465f57263736eb24a69"
|
|
88
88
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import "@spectrum-css/actionbutton/dist/index-vars.css"
|
|
3
|
-
import { createEventDispatcher } from "svelte"
|
|
3
|
+
import { createEventDispatcher, getContext } from "svelte"
|
|
4
4
|
const dispatch = createEventDispatcher()
|
|
5
|
+
const context = getContext("builderFocus")
|
|
5
6
|
|
|
6
7
|
export let quiet = false
|
|
7
8
|
export let emphasized = false
|
|
@@ -13,6 +14,14 @@
|
|
|
13
14
|
export let size = "M"
|
|
14
15
|
export let active = false
|
|
15
16
|
export let fullWidth = false
|
|
17
|
+
export let autofocus = false
|
|
18
|
+
|
|
19
|
+
let focus = false
|
|
20
|
+
let actionButton
|
|
21
|
+
$: focus = autofocus && actionButton !== undefined
|
|
22
|
+
$: if (focus) {
|
|
23
|
+
actionButton.focus()
|
|
24
|
+
}
|
|
16
25
|
|
|
17
26
|
function longPress(element) {
|
|
18
27
|
if (!longPressable) return
|
|
@@ -37,6 +46,7 @@
|
|
|
37
46
|
|
|
38
47
|
<button
|
|
39
48
|
data-cy={dataCy}
|
|
49
|
+
bind:this={actionButton}
|
|
40
50
|
use:longPress
|
|
41
51
|
class:spectrum-ActionButton--quiet={quiet}
|
|
42
52
|
class:spectrum-ActionButton--emphasized={emphasized}
|
|
@@ -44,9 +54,17 @@
|
|
|
44
54
|
class:fullWidth
|
|
45
55
|
class="spectrum-ActionButton spectrum-ActionButton--size{size}"
|
|
46
56
|
class:active
|
|
57
|
+
class:is-focused={focus}
|
|
47
58
|
{disabled}
|
|
48
59
|
on:longPress
|
|
49
60
|
on:click|preventDefault
|
|
61
|
+
on:focus={() => {
|
|
62
|
+
focus = true
|
|
63
|
+
}}
|
|
64
|
+
on:blur={() => {
|
|
65
|
+
focus = false
|
|
66
|
+
if (context) context.clear()
|
|
67
|
+
}}
|
|
50
68
|
>
|
|
51
69
|
{#if longPressable}
|
|
52
70
|
<svg
|
|
@@ -80,4 +98,10 @@
|
|
|
80
98
|
.active svg {
|
|
81
99
|
color: var(--spectrum-global-color-blue-600);
|
|
82
100
|
}
|
|
101
|
+
button.is-focused {
|
|
102
|
+
border-color: var(
|
|
103
|
+
--spectrum-textfield-m-border-color-down,
|
|
104
|
+
var(--spectrum-alias-border-color-mouse-focus)
|
|
105
|
+
);
|
|
106
|
+
}
|
|
83
107
|
</style>
|
package/src/Form/Combobox.svelte
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
export let options = []
|
|
14
14
|
export let getOptionLabel = option => extractProperty(option, "label")
|
|
15
15
|
export let getOptionValue = option => extractProperty(option, "value")
|
|
16
|
+
export let autofocus = false
|
|
16
17
|
|
|
17
18
|
const dispatch = createEventDispatcher()
|
|
18
19
|
const onChange = e => {
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
{options}
|
|
36
37
|
{placeholder}
|
|
37
38
|
{readonly}
|
|
39
|
+
{autofocus}
|
|
38
40
|
{getOptionLabel}
|
|
39
41
|
{getOptionValue}
|
|
40
42
|
on:change={onChange}
|
|
@@ -3,37 +3,28 @@
|
|
|
3
3
|
import "@spectrum-css/popover/dist/index-vars.css"
|
|
4
4
|
import "@spectrum-css/menu/dist/index-vars.css"
|
|
5
5
|
import { fly } from "svelte/transition"
|
|
6
|
-
import { createEventDispatcher } from "svelte"
|
|
6
|
+
import { createEventDispatcher, getContext } from "svelte"
|
|
7
7
|
|
|
8
8
|
export let value = null
|
|
9
9
|
export let id = null
|
|
10
10
|
export let placeholder = "Choose an option or type"
|
|
11
11
|
export let disabled = false
|
|
12
12
|
export let readonly = false
|
|
13
|
+
export let autofocus = false
|
|
13
14
|
export let error = null
|
|
14
15
|
export let options = []
|
|
15
16
|
export let getOptionLabel = option => option
|
|
16
17
|
export let getOptionValue = option => option
|
|
17
18
|
|
|
19
|
+
const context = getContext("builderFocus")
|
|
18
20
|
const dispatch = createEventDispatcher()
|
|
19
21
|
let open = false
|
|
20
22
|
let focus = false
|
|
21
|
-
|
|
23
|
+
let comboInput
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return placeholder || "Choose an option or type"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Wait for options to load if there is a value but no options
|
|
30
|
-
if (!options?.length) {
|
|
31
|
-
return ""
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Render the label if the selected option is found, otherwise raw value
|
|
35
|
-
const selected = options.find(option => getOptionValue(option) === value)
|
|
36
|
-
return selected ? getOptionLabel(selected) : value
|
|
25
|
+
$: focus = autofocus && comboInput !== undefined
|
|
26
|
+
$: if (focus) {
|
|
27
|
+
comboInput.focus()
|
|
37
28
|
}
|
|
38
29
|
|
|
39
30
|
const selectOption = value => {
|
|
@@ -66,10 +57,16 @@
|
|
|
66
57
|
class:is-focused={open || focus}
|
|
67
58
|
>
|
|
68
59
|
<input
|
|
60
|
+
bind:this={comboInput}
|
|
69
61
|
{id}
|
|
70
62
|
type="text"
|
|
71
|
-
on:focus={() =>
|
|
72
|
-
|
|
63
|
+
on:focus={() => {
|
|
64
|
+
focus = true
|
|
65
|
+
}}
|
|
66
|
+
on:blur={() => {
|
|
67
|
+
focus = false
|
|
68
|
+
context.clear()
|
|
69
|
+
}}
|
|
73
70
|
on:change={onType}
|
|
74
71
|
value={value || ""}
|
|
75
72
|
placeholder={placeholder || ""}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
export let readonly = false
|
|
14
14
|
export let autocomplete = false
|
|
15
15
|
export let sort = false
|
|
16
|
+
export let autofocus = false
|
|
16
17
|
|
|
17
18
|
const dispatch = createEventDispatcher()
|
|
18
19
|
$: selectedLookupMap = getSelectedLookupMap(value)
|
|
@@ -85,4 +86,5 @@
|
|
|
85
86
|
{getOptionValue}
|
|
86
87
|
onSelectOption={toggleOption}
|
|
87
88
|
{sort}
|
|
89
|
+
{autofocus}
|
|
88
90
|
/>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import "@spectrum-css/popover/dist/index-vars.css"
|
|
4
4
|
import "@spectrum-css/menu/dist/index-vars.css"
|
|
5
5
|
import { fly } from "svelte/transition"
|
|
6
|
-
import { createEventDispatcher } from "svelte"
|
|
6
|
+
import { createEventDispatcher, getContext } from "svelte"
|
|
7
7
|
import clickOutside from "../../Actions/click_outside"
|
|
8
8
|
import Search from "./Search.svelte"
|
|
9
9
|
|
|
@@ -26,9 +26,18 @@
|
|
|
26
26
|
export let autoWidth = false
|
|
27
27
|
export let autocomplete = false
|
|
28
28
|
export let sort = false
|
|
29
|
+
export let autofocus = false
|
|
29
30
|
|
|
31
|
+
const context = getContext("builderFocus")
|
|
30
32
|
const dispatch = createEventDispatcher()
|
|
31
33
|
let searchTerm = null
|
|
34
|
+
let focus = false
|
|
35
|
+
let pickerButton
|
|
36
|
+
|
|
37
|
+
$: focus = autofocus && pickerButton !== undefined
|
|
38
|
+
$: if (focus) {
|
|
39
|
+
pickerButton.focus()
|
|
40
|
+
}
|
|
32
41
|
|
|
33
42
|
$: sortedOptions = getSortedOptions(options, getOptionLabel, sort)
|
|
34
43
|
$: filteredOptions = getFilteredOptions(
|
|
@@ -80,7 +89,24 @@
|
|
|
80
89
|
class:is-invalid={!!error}
|
|
81
90
|
class:is-open={open}
|
|
82
91
|
aria-haspopup="listbox"
|
|
92
|
+
class:is-focused={focus}
|
|
93
|
+
bind:this={pickerButton}
|
|
83
94
|
on:mousedown={onClick}
|
|
95
|
+
on:keydown={e => {
|
|
96
|
+
var keycode = e.key
|
|
97
|
+
if (focus) {
|
|
98
|
+
if (keycode === "Enter") {
|
|
99
|
+
onClick(e)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}}
|
|
103
|
+
on:focus={() => {
|
|
104
|
+
focus = true
|
|
105
|
+
}}
|
|
106
|
+
on:blur={() => {
|
|
107
|
+
focus = false
|
|
108
|
+
if (context) context.clear()
|
|
109
|
+
}}
|
|
84
110
|
>
|
|
85
111
|
{#if fieldIcon}
|
|
86
112
|
<span class="icon-Placeholder-Padding">
|
|
@@ -199,6 +225,7 @@
|
|
|
199
225
|
}
|
|
200
226
|
.spectrum-Picker {
|
|
201
227
|
width: 100%;
|
|
228
|
+
box-shadow: none;
|
|
202
229
|
}
|
|
203
230
|
.spectrum-Picker-label:not(.auto-width) {
|
|
204
231
|
overflow: hidden;
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
export let autoWidth = false
|
|
17
17
|
export let autocomplete = false
|
|
18
18
|
export let sort = false
|
|
19
|
+
export let autofocus = false
|
|
19
20
|
|
|
20
21
|
const dispatch = createEventDispatcher()
|
|
21
22
|
let open = false
|
|
@@ -74,6 +75,7 @@
|
|
|
74
75
|
{fieldIcon}
|
|
75
76
|
{autocomplete}
|
|
76
77
|
{sort}
|
|
78
|
+
{autofocus}
|
|
77
79
|
isPlaceholder={value == null || value === ""}
|
|
78
80
|
placeholderOption={placeholder}
|
|
79
81
|
isOptionSelected={option => option === value}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
export let getOptionLabel = option => option
|
|
15
15
|
export let getOptionValue = option => option
|
|
16
16
|
export let sort = false
|
|
17
|
+
export let autofocus = false
|
|
17
18
|
|
|
18
19
|
const dispatch = createEventDispatcher()
|
|
19
20
|
const onChange = e => {
|
|
@@ -35,5 +36,6 @@
|
|
|
35
36
|
{getOptionValue}
|
|
36
37
|
on:change={onChange}
|
|
37
38
|
on:click
|
|
39
|
+
{autofocus}
|
|
38
40
|
/>
|
|
39
41
|
</Field>
|
package/src/Form/Select.svelte
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
export let autoWidth = false
|
|
19
19
|
export let sort = false
|
|
20
20
|
export let tooltip = ""
|
|
21
|
+
export let autofocus = false
|
|
21
22
|
|
|
22
23
|
const dispatch = createEventDispatcher()
|
|
23
24
|
const onChange = e => {
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
{placeholder}
|
|
45
46
|
{autoWidth}
|
|
46
47
|
{sort}
|
|
48
|
+
{autofocus}
|
|
47
49
|
{getOptionLabel}
|
|
48
50
|
{getOptionValue}
|
|
49
51
|
{getOptionIcon}
|