@budibase/bbui 2.7.35 → 2.7.36-alpha.2
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 +3 -3
- package/dist/bbui.es.js.map +1 -1
- package/package.json +4 -4
- package/src/FancyForm/FancyCheckbox.svelte +17 -3
- package/src/FancyForm/FancyCheckboxGroup.svelte +69 -0
- package/src/FancyForm/FancyField.svelte +11 -4
- package/src/FancyForm/index.js +1 -0
- package/src/Form/Core/Checkbox.svelte +2 -0
- package/src/Modal/Modal.svelte +2 -1
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.7.
|
|
4
|
+
"version": "2.7.36-alpha.2",
|
|
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": "2.7.
|
|
42
|
-
"@budibase/string-templates": "2.7.
|
|
41
|
+
"@budibase/shared-core": "2.7.36-alpha.2",
|
|
42
|
+
"@budibase/string-templates": "2.7.36-alpha.2",
|
|
43
43
|
"@spectrum-css/accordion": "3.0.24",
|
|
44
44
|
"@spectrum-css/actionbutton": "1.0.1",
|
|
45
45
|
"@spectrum-css/actiongroup": "1.0.1",
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "9e73358c0b5d945e052a08f6a9277a4d263eec01"
|
|
108
108
|
}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
export let disabled = false
|
|
9
9
|
export let error = null
|
|
10
10
|
export let validate = null
|
|
11
|
+
export let indeterminate = false
|
|
12
|
+
export let compact = false
|
|
11
13
|
|
|
12
14
|
const dispatch = createEventDispatcher()
|
|
13
15
|
|
|
@@ -21,11 +23,19 @@
|
|
|
21
23
|
}
|
|
22
24
|
</script>
|
|
23
25
|
|
|
24
|
-
<FancyField
|
|
26
|
+
<FancyField
|
|
27
|
+
{error}
|
|
28
|
+
{value}
|
|
29
|
+
{validate}
|
|
30
|
+
{disabled}
|
|
31
|
+
{compact}
|
|
32
|
+
clickable
|
|
33
|
+
on:click={onChange}
|
|
34
|
+
>
|
|
25
35
|
<span>
|
|
26
|
-
<Checkbox {disabled} {value} />
|
|
36
|
+
<Checkbox {disabled} {value} {indeterminate} />
|
|
27
37
|
</span>
|
|
28
|
-
<div class="text">
|
|
38
|
+
<div class="text" class:compact>
|
|
29
39
|
{#if text}
|
|
30
40
|
{text}
|
|
31
41
|
{/if}
|
|
@@ -47,6 +57,10 @@
|
|
|
47
57
|
line-clamp: 2;
|
|
48
58
|
-webkit-box-orient: vertical;
|
|
49
59
|
}
|
|
60
|
+
.text.compact {
|
|
61
|
+
font-size: 13px;
|
|
62
|
+
line-height: 15px;
|
|
63
|
+
}
|
|
50
64
|
.text > :global(*) {
|
|
51
65
|
font-size: inherit !important;
|
|
52
66
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import FancyCheckbox from "./FancyCheckbox.svelte"
|
|
3
|
+
import FancyForm from "./FancyForm.svelte"
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
5
|
+
|
|
6
|
+
export let options = []
|
|
7
|
+
export let selected = []
|
|
8
|
+
export let showSelectAll = true
|
|
9
|
+
export let selectAllText = "Select all"
|
|
10
|
+
|
|
11
|
+
let selectedBooleans = reset()
|
|
12
|
+
const dispatch = createEventDispatcher()
|
|
13
|
+
|
|
14
|
+
$: updateSelected(selectedBooleans)
|
|
15
|
+
$: allSelected = selected?.length === options.length
|
|
16
|
+
$: noneSelected = !selected?.length
|
|
17
|
+
|
|
18
|
+
function reset() {
|
|
19
|
+
return Array(options.length).fill(true)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function updateSelected(selectedArr) {
|
|
23
|
+
const array = []
|
|
24
|
+
for (let [i, isSelected] of Object.entries(selectedArr)) {
|
|
25
|
+
if (isSelected) {
|
|
26
|
+
array.push(options[i])
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
selected = array
|
|
30
|
+
dispatch("change", selected)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function toggleSelectAll() {
|
|
34
|
+
if (allSelected === true) {
|
|
35
|
+
selectedBooleans = []
|
|
36
|
+
} else {
|
|
37
|
+
selectedBooleans = reset()
|
|
38
|
+
}
|
|
39
|
+
dispatch("change", selected)
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
{#if options && Array.isArray(options)}
|
|
44
|
+
<div class="checkbox-group" class:has-select-all={showSelectAll}>
|
|
45
|
+
<FancyForm on:change>
|
|
46
|
+
{#if showSelectAll}
|
|
47
|
+
<FancyCheckbox
|
|
48
|
+
bind:value={allSelected}
|
|
49
|
+
on:change={toggleSelectAll}
|
|
50
|
+
text={selectAllText}
|
|
51
|
+
indeterminate={!allSelected && !noneSelected}
|
|
52
|
+
compact
|
|
53
|
+
/>
|
|
54
|
+
{/if}
|
|
55
|
+
{#each options as option, i}
|
|
56
|
+
<FancyCheckbox bind:value={selectedBooleans[i]} text={option} compact />
|
|
57
|
+
{/each}
|
|
58
|
+
</FancyForm>
|
|
59
|
+
</div>
|
|
60
|
+
{/if}
|
|
61
|
+
|
|
62
|
+
<style>
|
|
63
|
+
.checkbox-group.has-select-all :global(.fancy-field:first-of-type) {
|
|
64
|
+
background: var(--spectrum-global-color-gray-100);
|
|
65
|
+
}
|
|
66
|
+
.checkbox-group.has-select-all :global(.fancy-field:first-of-type:hover) {
|
|
67
|
+
background: var(--spectrum-global-color-gray-200);
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
export let value
|
|
12
12
|
export let ref
|
|
13
13
|
export let autoHeight
|
|
14
|
+
export let compact = false
|
|
14
15
|
|
|
15
16
|
const formContext = getContext("fancy-form")
|
|
16
17
|
const id = Math.random()
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
class:disabled
|
|
43
44
|
class:focused
|
|
44
45
|
class:clickable
|
|
46
|
+
class:compact
|
|
45
47
|
class:auto-height={autoHeight}
|
|
46
48
|
>
|
|
47
49
|
<div class="content" on:click>
|
|
@@ -61,7 +63,6 @@
|
|
|
61
63
|
|
|
62
64
|
<style>
|
|
63
65
|
.fancy-field {
|
|
64
|
-
max-width: 400px;
|
|
65
66
|
background: var(--spectrum-global-color-gray-75);
|
|
66
67
|
border: 1px solid var(--spectrum-global-color-gray-300);
|
|
67
68
|
border-radius: 4px;
|
|
@@ -69,6 +70,12 @@
|
|
|
69
70
|
transition: border-color 130ms ease-out, background 130ms ease-out,
|
|
70
71
|
background 130ms ease-out;
|
|
71
72
|
color: var(--spectrum-global-color-gray-800);
|
|
73
|
+
--padding: 16px;
|
|
74
|
+
--height: 64px;
|
|
75
|
+
}
|
|
76
|
+
.fancy-field.compact {
|
|
77
|
+
--padding: 8px;
|
|
78
|
+
--height: 36px;
|
|
72
79
|
}
|
|
73
80
|
.fancy-field:hover {
|
|
74
81
|
border-color: var(--spectrum-global-color-gray-400);
|
|
@@ -91,8 +98,8 @@
|
|
|
91
98
|
}
|
|
92
99
|
.content {
|
|
93
100
|
position: relative;
|
|
94
|
-
height:
|
|
95
|
-
padding: 0
|
|
101
|
+
height: var(--height);
|
|
102
|
+
padding: 0 var(--padding);
|
|
96
103
|
}
|
|
97
104
|
.fancy-field.auto-height .content {
|
|
98
105
|
height: auto;
|
|
@@ -103,7 +110,7 @@
|
|
|
103
110
|
flex-direction: row;
|
|
104
111
|
justify-content: flex-start;
|
|
105
112
|
align-items: center;
|
|
106
|
-
gap:
|
|
113
|
+
gap: var(--padding);
|
|
107
114
|
}
|
|
108
115
|
.field {
|
|
109
116
|
flex: 1 1 auto;
|
package/src/FancyForm/index.js
CHANGED
|
@@ -4,4 +4,5 @@ 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 FancyCheckboxGroup } from "./FancyCheckboxGroup.svelte"
|
|
7
8
|
export { default as ErrorMessage } from "./ErrorMessage.svelte"
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
export let text = null
|
|
10
10
|
export let disabled = false
|
|
11
11
|
export let size
|
|
12
|
+
export let indeterminate = false
|
|
12
13
|
|
|
13
14
|
const dispatch = createEventDispatcher()
|
|
14
15
|
const onChange = event => {
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
class="spectrum-Checkbox spectrum-Checkbox--emphasized {sizeClass}"
|
|
23
24
|
class:is-invalid={!!error}
|
|
24
25
|
class:checked={value}
|
|
26
|
+
class:is-indeterminate={indeterminate}
|
|
25
27
|
>
|
|
26
28
|
<input
|
|
27
29
|
checked={value}
|
package/src/Modal/Modal.svelte
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
export let fixed = false
|
|
10
10
|
export let inline = false
|
|
11
|
+
export let disableCancel = false
|
|
11
12
|
|
|
12
13
|
const dispatch = createEventDispatcher()
|
|
13
14
|
let visible = fixed || inline
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export function cancel() {
|
|
41
|
-
if (!visible) {
|
|
42
|
+
if (!visible || disableCancel) {
|
|
42
43
|
return
|
|
43
44
|
}
|
|
44
45
|
dispatch("cancel")
|