@budibase/bbui 3.5.2 → 3.5.3
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.mjs +13574 -15472
- package/package.json +2 -2
- package/src/Form/Core/TextArea.svelte +24 -21
- package/src/Form/TextArea.svelte +15 -6
- package/src/Icon/Icon.svelte +1 -1
- package/src/Icon/IconAvatar.svelte +7 -8
- package/src/IconPicker/IconPicker.svelte +16 -11
- package/src/InlineAlert/InlineAlert.svelte +10 -10
- package/src/Input/CopyInput.svelte +13 -11
- package/src/Label/Label.svelte +4 -4
- package/src/Layout/Layout.svelte +14 -9
- package/src/Layout/Page.svelte +6 -6
- package/src/List/List.svelte +2 -2
- package/src/Markdown/MarkdownEditor.svelte +12 -12
- package/src/Markdown/MarkdownViewer.svelte +4 -4
- package/src/Markdown/SpectrumMDE.svelte +11 -11
- package/src/Menu/Item.svelte +7 -7
- package/src/Menu/Menu.svelte +1 -1
- package/src/Menu/Section.svelte +2 -2
- package/src/Modal/Content.svelte +2 -2
- package/src/Modal/CustomContent.svelte +4 -4
- package/src/Modal/Modal.svelte +36 -33
- package/src/Modal/ModalContent.svelte +33 -31
- package/src/Notification/Notification.svelte +9 -9
- package/src/Notification/NotificationDisplay.svelte +1 -1
- package/src/Pagination/Pagination.svelte +6 -8
- package/src/ProgressBar/ProgressBar.svelte +15 -14
- package/src/ProgressCircle/ProgressCircle.svelte +11 -11
- package/src/Tooltip/TooltipWrapper.svelte +1 -1
- package/src/index.ts +0 -3
- package/src/Form/PickerDropdown.svelte +0 -132
- package/src/IconSideNav/IconSideNav.svelte +0 -14
- package/src/IconSideNav/IconSideNavItem.svelte +0 -58
- package/src/Menu/Menu.svench +0 -19
- package/src/Modal/Modal.svench +0 -116
- package/src/Modal/QuizModal.svelte +0 -53
- package/src/Stores/Notifications.svench.svx +0 -78
package/src/Modal/Modal.svench
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { View } from "svench";
|
|
3
|
-
import Modal from "./Modal.svelte";
|
|
4
|
-
import ModalContent from "./ModalContent.svelte";
|
|
5
|
-
import Button from "../Button/Button.svelte";
|
|
6
|
-
import Content from "./Content.svelte";
|
|
7
|
-
import QuizModal from "./QuizModal.svelte";
|
|
8
|
-
import CustomContent from "./CustomContent.svelte";
|
|
9
|
-
|
|
10
|
-
let modal1
|
|
11
|
-
let modal2
|
|
12
|
-
let modal3
|
|
13
|
-
|
|
14
|
-
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
|
15
|
-
async function longTask() {
|
|
16
|
-
await sleep(3000)
|
|
17
|
-
}
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<style>
|
|
21
|
-
p, span {
|
|
22
|
-
font-size: var(--font-size-s);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
code {
|
|
26
|
-
display: inline-block;
|
|
27
|
-
box-sizing: border-box;
|
|
28
|
-
padding: var(--spacing-xs) var(--spacing-s);
|
|
29
|
-
background-color: var(--grey-2);
|
|
30
|
-
color: var(--red-dark);
|
|
31
|
-
border-radius: var(--spacing-xs);
|
|
32
|
-
}
|
|
33
|
-
</style>
|
|
34
|
-
|
|
35
|
-
<h3>Modals</h3>
|
|
36
|
-
<p>
|
|
37
|
-
Modals provide a means to render content in front of everything else on a page.
|
|
38
|
-
</p>
|
|
39
|
-
<p>
|
|
40
|
-
The modal module in BBUI exposes two
|
|
41
|
-
separate components to provide this functionality; a <code>Modal</code> component to control visibility of content,
|
|
42
|
-
and a <code>ModalContent</code> component to quickly construct the typical content - although this is optional.
|
|
43
|
-
</p>
|
|
44
|
-
<p>
|
|
45
|
-
One of the common problems with modals and popups is stale state reappearing after hiding and showing the content
|
|
46
|
-
again, since the state hasn't been garbage collected if a component controls its own visibility. This is handled for
|
|
47
|
-
you when using the <code>Modal</code> component as it will fully unmount child components, properly resetting state
|
|
48
|
-
every time it appears.
|
|
49
|
-
</p>
|
|
50
|
-
|
|
51
|
-
<br/>
|
|
52
|
-
<p>Use ModalContent to render typical modal content.</p>
|
|
53
|
-
<View name="Simple Confirmation Modal">
|
|
54
|
-
<Button primary on:click={modal1.show}>Delete Record</Button>
|
|
55
|
-
<Modal bind:this={modal1}>
|
|
56
|
-
<ModalContent title="Confirm Deletion" confirmText="Delete">
|
|
57
|
-
<span>Are you sure you want to delete this record?</span>
|
|
58
|
-
</ModalContent>
|
|
59
|
-
</Modal>
|
|
60
|
-
</View>
|
|
61
|
-
|
|
62
|
-
<br/>
|
|
63
|
-
<p>
|
|
64
|
-
Width can be specified as a prop to a <code>Modal</code>. Any additional <code>ModalContent</code> props provided
|
|
65
|
-
will be passed to the confirmation button.
|
|
66
|
-
</p>
|
|
67
|
-
<View name="Different Buttons and Width">
|
|
68
|
-
<Button primary on:click={modal3.show}>Open Modal</Button>
|
|
69
|
-
<Modal bind:this={modal3} width="250px">
|
|
70
|
-
<ModalContent
|
|
71
|
-
title="Confirmation Required"
|
|
72
|
-
showCancelButton={false}
|
|
73
|
-
showCloseIcon={false}
|
|
74
|
-
confirmText="I'm sure!"
|
|
75
|
-
green
|
|
76
|
-
large
|
|
77
|
-
wide
|
|
78
|
-
>
|
|
79
|
-
<span>Are you sure you want to do that?</span>
|
|
80
|
-
</ModalContent>
|
|
81
|
-
</Modal>
|
|
82
|
-
</View>
|
|
83
|
-
|
|
84
|
-
<br/>
|
|
85
|
-
<p>Any content can be rendered inside a <code>Modal</code>. Use context to close the modal from your own components.</p>
|
|
86
|
-
<View name="Custom Content">
|
|
87
|
-
<Button primary on:click={modal1.show}>Open Modal</Button>
|
|
88
|
-
<Modal bind:this={modal1} padding={false} border={false}>
|
|
89
|
-
<CustomContent/>
|
|
90
|
-
</Modal>
|
|
91
|
-
</View>
|
|
92
|
-
|
|
93
|
-
<br/>
|
|
94
|
-
<p>Async functions passed in as the onConfirm prop will make the modal wait until the callback is completed.</p>
|
|
95
|
-
<View name="Async Callbacks">
|
|
96
|
-
<Button primary on:click={modal2.show}>Long Task</Button>
|
|
97
|
-
<Modal bind:this={modal2}>
|
|
98
|
-
<ModalContent
|
|
99
|
-
title="Perform Long Task"
|
|
100
|
-
confirmText="Submit"
|
|
101
|
-
onConfirm={longTask}
|
|
102
|
-
>
|
|
103
|
-
<span>Pressing submit will wait 3 seconds before finishing and disable the confirm button until it's done.</span>
|
|
104
|
-
</ModalContent>
|
|
105
|
-
</Modal>
|
|
106
|
-
</View>
|
|
107
|
-
|
|
108
|
-
<br/>
|
|
109
|
-
<p>Returning false from a onConfirm callback will prevent the modal being closed.</p>
|
|
110
|
-
<View name="Callback Failure Handling">
|
|
111
|
-
<Button primary on:click={modal3.show}>Open Quiz</Button>
|
|
112
|
-
<Modal bind:this={modal3}>
|
|
113
|
-
<QuizModal />
|
|
114
|
-
</Modal>
|
|
115
|
-
</View>
|
|
116
|
-
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import ModalContent from "./ModalContent.svelte"
|
|
3
|
-
import Input from "../Form/Input.svelte"
|
|
4
|
-
|
|
5
|
-
let modal
|
|
6
|
-
let answer
|
|
7
|
-
let error
|
|
8
|
-
|
|
9
|
-
export function show() {
|
|
10
|
-
modal.show()
|
|
11
|
-
}
|
|
12
|
-
export function hide() {
|
|
13
|
-
modal.hide
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function resetState() {
|
|
17
|
-
answer = undefined
|
|
18
|
-
error = undefined
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function answerQuiz() {
|
|
22
|
-
const correct = answer === "8"
|
|
23
|
-
error = !correct
|
|
24
|
-
return correct
|
|
25
|
-
}
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<ModalContent
|
|
29
|
-
title="Quick Maths"
|
|
30
|
-
bind:this={modal}
|
|
31
|
-
confirmText="Submit"
|
|
32
|
-
onConfirm={answerQuiz}
|
|
33
|
-
on:show={resetState}
|
|
34
|
-
>
|
|
35
|
-
{#if error}
|
|
36
|
-
<p class="error">Wrong answer! Try again.</p>
|
|
37
|
-
{/if}
|
|
38
|
-
<p>What is 4 + 4?</p>
|
|
39
|
-
<Input label="Answer" bind:value={answer} />
|
|
40
|
-
</ModalContent>
|
|
41
|
-
|
|
42
|
-
<style>
|
|
43
|
-
p {
|
|
44
|
-
margin: 0;
|
|
45
|
-
font-size: var(--font-size-s);
|
|
46
|
-
}
|
|
47
|
-
p.error {
|
|
48
|
-
color: #e26d69;
|
|
49
|
-
background-color: #ffe6e6;
|
|
50
|
-
padding: 8px;
|
|
51
|
-
border-radius: 4px;
|
|
52
|
-
}
|
|
53
|
-
</style>
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { flip } from 'svelte/animate';
|
|
3
|
-
import { fly } from "svelte/transition"
|
|
4
|
-
import { View } from "svench";
|
|
5
|
-
import { notifications } from "./notifications";
|
|
6
|
-
|
|
7
|
-
export let themes = {
|
|
8
|
-
danger: "#E26D69",
|
|
9
|
-
success: "#84C991",
|
|
10
|
-
warning: "#f0ad4e",
|
|
11
|
-
info: "#5bc0de",
|
|
12
|
-
default: "#aaaaaa",
|
|
13
|
-
}
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
## Notification Store
|
|
17
|
-
|
|
18
|
-
This custom can be used to display toast messages. It has 5 different methods: `send`, `danger`, `warning`, `success`, `info`.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<View name="danger">
|
|
22
|
-
<button on:click={() => notifications.error('This is a danger!')}>Danger</button>
|
|
23
|
-
</View>
|
|
24
|
-
<View name="warning">
|
|
25
|
-
<button on:click={() => notifications.warning('This is a warning!')}>Warning</button>
|
|
26
|
-
</View>
|
|
27
|
-
<View name="success">
|
|
28
|
-
<button on:click={() => notifications.success('This is a success!')}>Success</button>
|
|
29
|
-
</View>
|
|
30
|
-
<View name="info">
|
|
31
|
-
<button on:click={() => notifications.info('This is an info toast!')}>Info</button>
|
|
32
|
-
</View>
|
|
33
|
-
|
|
34
|
-
<div class="notifications">
|
|
35
|
-
{#each $notifications as notification (notification.id)}
|
|
36
|
-
<div
|
|
37
|
-
animate:flip
|
|
38
|
-
class="toast"
|
|
39
|
-
style="background: {themes[notification.type]};"
|
|
40
|
-
transition:fly={{ y: -30 }}>
|
|
41
|
-
<div class="content">{notification.message}</div>
|
|
42
|
-
{#if notification.icon}<i class={notification.icon} />{/if}
|
|
43
|
-
</div>
|
|
44
|
-
{/each}
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<style>
|
|
48
|
-
.notifications {
|
|
49
|
-
position: fixed;
|
|
50
|
-
top: 10px;
|
|
51
|
-
left: 0;
|
|
52
|
-
right: 0;
|
|
53
|
-
margin: 0 auto;
|
|
54
|
-
padding: 0;
|
|
55
|
-
z-index: 9999;
|
|
56
|
-
display: flex;
|
|
57
|
-
flex-direction: column;
|
|
58
|
-
justify-content: flex-start;
|
|
59
|
-
align-items: center;
|
|
60
|
-
pointer-events: none;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.toast {
|
|
64
|
-
flex: 0 0 auto;
|
|
65
|
-
margin-bottom: 10px;
|
|
66
|
-
border-radius: var(--border-radius-s);
|
|
67
|
-
/* The toasts now support being auto sized, so this static width could be removed */
|
|
68
|
-
width: 40vw;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.content {
|
|
72
|
-
padding: 10px;
|
|
73
|
-
display: block;
|
|
74
|
-
color: white;
|
|
75
|
-
font-weight: 500;
|
|
76
|
-
}
|
|
77
|
-
</style>
|
|
78
|
-
|