@budibase/bbui 1.58.13 → 2.0.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/LICENSE +375 -0
- package/dist/bbui.es.js +14 -0
- package/dist/bbui.es.js.map +1 -0
- package/package.json +68 -32
- package/src/ActionButton/ActionButton.svelte +102 -0
- package/src/ActionGroup/ActionGroup.svelte +26 -0
- package/src/ActionMenu/ActionMenu.svelte +44 -0
- package/src/Actions/autoresize_textarea.js +9 -9
- package/src/Actions/click_outside.js +5 -5
- package/src/Actions/position_dropdown.js +46 -37
- package/src/Avatar/Avatar.svelte +62 -0
- package/src/Badge/Badge.svelte +29 -0
- package/src/Banner/Banner.svelte +72 -0
- package/src/Banner/BannerDisplay.svelte +41 -0
- package/src/Button/Button.svelte +102 -200
- package/src/ButtonGroup/ButtonGroup.svelte +30 -0
- package/src/ClearButton/ClearButton.svelte +19 -0
- package/src/ColorPicker/ColorPicker.svelte +297 -0
- package/src/DetailSummary/DetailSummary.svelte +83 -0
- package/src/Divider/Divider.svelte +28 -0
- package/src/Drawer/Drawer.svelte +76 -51
- package/src/Drawer/DrawerContent.svelte +46 -0
- package/src/Form/Checkbox.svelte +21 -132
- package/src/Form/Combobox.svelte +45 -0
- package/src/Form/Core/Checkbox.svelte +69 -0
- package/src/Form/Core/CheckboxGroup.svelte +68 -0
- package/src/Form/Core/Combobox.svelte +142 -0
- package/src/Form/Core/DatePicker.svelte +257 -0
- package/src/Form/Core/Dropzone.svelte +453 -0
- package/src/Form/Core/InputDropdown.svelte +228 -0
- package/src/Form/Core/Multiselect.svelte +90 -0
- package/src/Form/Core/Picker.svelte +259 -0
- package/src/Form/Core/PickerDropdown.svelte +415 -0
- package/src/Form/Core/RadioGroup.svelte +48 -0
- package/src/Form/Core/RichTextField.svelte +42 -0
- package/src/Form/Core/Search.svelte +105 -0
- package/src/Form/Core/Select.svelte +75 -0
- package/src/Form/Core/Slider.svelte +86 -0
- package/src/Form/Core/Stepper.svelte +172 -0
- package/src/Form/Core/Switch.svelte +37 -0
- package/src/Form/Core/TextArea.svelte +78 -0
- package/src/Form/Core/TextField.svelte +119 -0
- package/src/Form/Core/index.js +15 -0
- package/src/Form/DatePicker.svelte +39 -0
- package/src/Form/Dropzone.svelte +42 -0
- package/src/Form/Field.svelte +42 -0
- package/src/Form/FieldLabel.svelte +32 -0
- package/src/Form/Input.svelte +41 -187
- package/src/Form/InputDropdown.svelte +55 -0
- package/src/Form/Multiselect.svelte +36 -320
- package/src/Form/PickerDropdown.svelte +132 -0
- package/src/Form/RadioGroup.svelte +42 -0
- package/src/Form/RichTextField.svelte +36 -0
- package/src/Form/Search.svelte +36 -0
- package/src/Form/Select.svelte +48 -88
- package/src/Form/Slider.svelte +16 -91
- package/src/Form/Stepper.svelte +45 -0
- package/src/Form/TextArea.svelte +30 -128
- package/src/Form/Toggle.svelte +20 -110
- package/src/Icon/Icon.svelte +91 -0
- package/src/Icon/IconAvatar.svelte +58 -0
- package/src/IconPicker/IconPicker.svelte +177 -0
- package/src/IconSideNav/IconSideNav.svelte +14 -0
- package/src/IconSideNav/IconSideNavItem.svelte +56 -0
- package/src/InlineAlert/InlineAlert.svelte +60 -0
- package/src/Label/Label.svelte +29 -0
- package/src/Layout/Layout.svelte +94 -0
- package/src/Layout/Page.svelte +32 -0
- package/src/Link/Link.svelte +24 -0
- package/src/List/List.svelte +28 -0
- package/src/List/ListItem.svelte +90 -0
- package/src/Markdown/MarkdownEditor.svelte +60 -0
- package/src/Markdown/MarkdownViewer.svelte +70 -0
- package/src/Markdown/SpectrumMDE.svelte +184 -0
- package/src/Menu/Item.svelte +96 -0
- package/src/Menu/Menu.svelte +7 -0
- package/src/Menu/Menu.svench +19 -0
- package/src/Menu/Section.svelte +10 -0
- package/src/Menu/Separator.svelte +1 -0
- package/src/Modal/Content.svelte +0 -11
- package/src/Modal/CustomContent.svelte +9 -6
- package/src/Modal/Modal.svelte +104 -51
- package/src/Modal/ModalContent.svelte +131 -73
- package/src/Modal/QuizModal.svelte +16 -17
- package/src/Notification/Notification.svelte +70 -0
- package/src/Notification/NotificationDisplay.svelte +43 -0
- package/src/Pagination/Pagination.svelte +57 -0
- package/src/Popover/Popover.svelte +43 -33
- package/src/ProgressBar/ProgressBar.svelte +67 -0
- package/src/ProgressCircle/ProgressCircle.svelte +62 -0
- package/src/SideNavigation/Item.svelte +61 -0
- package/src/SideNavigation/Navigation.svelte +12 -0
- package/src/StatusLight/StatusLight.svelte +80 -0
- package/src/Stores/Notifications.svench.svx +1 -1
- package/src/Stores/banner.js +65 -0
- package/src/Stores/notifications.js +75 -38
- package/src/Table/ArrayRenderer.svelte +17 -0
- package/src/Table/AttachmentRenderer.svelte +73 -0
- package/src/Table/BoldRenderer.svelte +15 -0
- package/src/Table/BooleanRenderer.svelte +42 -0
- package/src/Table/CellRenderer.svelte +69 -0
- package/src/Table/CodeRenderer.svelte +14 -0
- package/src/Table/DateTimeRenderer.svelte +29 -0
- package/src/Table/InternalRenderer.svelte +24 -0
- package/src/Table/RelationshipRenderer.svelte +40 -0
- package/src/Table/SelectEditRenderer.svelte +28 -0
- package/src/Table/StringRenderer.svelte +14 -0
- package/src/Table/Table.svelte +635 -0
- package/src/Table/index.js +1 -0
- package/src/Tabs/Tab.svelte +88 -0
- package/src/Tabs/Tabs.svelte +130 -0
- package/src/Tags/Tag.svelte +43 -0
- package/src/Tags/Tags.svelte +7 -0
- package/src/Tooltip/Tooltip.svelte +34 -0
- package/src/Tooltip/TooltipWrapper.svelte +60 -0
- package/src/TreeView/Item.svelte +41 -0
- package/src/TreeView/Tree.svelte +16 -0
- package/src/Typography/Body.svelte +21 -0
- package/src/Typography/Code.svelte +10 -0
- package/src/Typography/Detail.svelte +19 -0
- package/src/Typography/Heading.svelte +17 -0
- package/{dist → src}/bbui.css +2 -99
- package/src/context.js +1 -1
- package/src/helpers.js +134 -0
- package/src/index.js +95 -40
- package/src/spectrum-icons-rollup.js +31 -0
- package/src/spectrum-icons-vite.js +31 -0
- package/dist/dist/bundle.css +0 -42
- package/dist/dist/bundle.css.map +0 -64
- package/dist/index.js +0 -36193
- package/dist/index.mjs +0 -36147
- package/src/Button/Close.svelte +0 -59
- package/src/Button/Close.svench +0 -36
- package/src/Button/TextButton.svelte +0 -128
- package/src/Button/TextButton.svench +0 -69
- package/src/DatePicker/DatePicker.svelte +0 -45
- package/src/DatePicker/DatePicker.svench +0 -17
- package/src/DropdownMenu/DropdownMenu.svelte +0 -77
- package/src/DropdownMenu/DropdownMenu.svench +0 -161
- package/src/Dropzone/Dropzone.svelte +0 -294
- package/src/Dropzone/Dropzone.svench +0 -17
- package/src/Dropzone/fileTypes.js +0 -5
- package/src/Form/Checkbox.svench.svx +0 -67
- package/src/Form/DataList.svelte +0 -158
- package/src/Form/DataList.svench +0 -57
- package/src/Form/Input.svench +0 -62
- package/src/Form/Multiselect.svench +0 -63
- package/src/Form/Radio.svelte +0 -133
- package/src/Form/Radio.svench.svx +0 -64
- package/src/Form/RichText.svelte +0 -61
- package/src/Form/RichText.svench.svx +0 -40
- package/src/Form/Select.svench +0 -62
- package/src/Form/Slider.svench +0 -26
- package/src/Form/TextArea.svench +0 -30
- package/src/Form/Toggle.svench +0 -21
- package/src/Icons/Contribution.svelte +0 -14
- package/src/Icons/Icon.svelte +0 -36
- package/src/Icons/Icon.svench +0 -109
- package/src/Icons/icon-paths.js +0 -136
- package/src/Links/Home.svelte +0 -51
- package/src/Links/Home.svench +0 -19
- package/src/List/Items/DetailSummary.svelte +0 -85
- package/src/List/Items/DetailSummary.svench +0 -53
- package/src/List/Search.svelte +0 -34
- package/src/List/Search.svench +0 -8
- package/src/Spacer/Spacer.svelte +0 -50
- package/src/Spacer/Spacer.svench +0 -51
- package/src/Styleguide/Body.svelte +0 -72
- package/src/Styleguide/Borders.svench +0 -175
- package/src/Styleguide/Budibase-logo.svelte +0 -68
- package/src/Styleguide/Color.svench +0 -201
- package/src/Styleguide/Heading.svelte +0 -74
- package/src/Styleguide/Label.svelte +0 -70
- package/src/Styleguide/Logo.svelte +0 -16
- package/src/Styleguide/Logo.svench +0 -8
- package/src/Styleguide/Spacing.svench +0 -191
- package/src/Styleguide/Typography.svench +0 -227
- package/src/Switcher/Switcher.svelte +0 -47
- package/src/Switcher/Switcher.svench +0 -27
- package/src/index.svench.svx +0 -35
- package/src/utils/buildStyle.js +0 -14
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import Input from "../Form/Input.svelte";
|
|
2
|
+
import ModalContent from "./ModalContent.svelte"
|
|
3
|
+
import Input from "../Form/Input.svelte"
|
|
5
4
|
|
|
6
5
|
let modal
|
|
7
6
|
let answer
|
|
@@ -26,20 +25,6 @@
|
|
|
26
25
|
}
|
|
27
26
|
</script>
|
|
28
27
|
|
|
29
|
-
<style>
|
|
30
|
-
p {
|
|
31
|
-
margin: 0;
|
|
32
|
-
font-family: var(--font-sans);
|
|
33
|
-
font-size: var(--font-size-s);
|
|
34
|
-
}
|
|
35
|
-
p.error {
|
|
36
|
-
color: #e26d69;
|
|
37
|
-
background-color: #ffe6e6;
|
|
38
|
-
padding: 8px;
|
|
39
|
-
border-radius: 4px;
|
|
40
|
-
}
|
|
41
|
-
</style>
|
|
42
|
-
|
|
43
28
|
<ModalContent
|
|
44
29
|
title="Quick Maths"
|
|
45
30
|
bind:this={modal}
|
|
@@ -53,3 +38,17 @@
|
|
|
53
38
|
<p>What is 4 + 4?</p>
|
|
54
39
|
<Input label="Answer" bind:value={answer} />
|
|
55
40
|
</ModalContent>
|
|
41
|
+
|
|
42
|
+
<style>
|
|
43
|
+
p {
|
|
44
|
+
margin: 0;
|
|
45
|
+
font-family: var(--font-sans);
|
|
46
|
+
font-size: var(--font-size-s);
|
|
47
|
+
}
|
|
48
|
+
p.error {
|
|
49
|
+
color: #e26d69;
|
|
50
|
+
background-color: #ffe6e6;
|
|
51
|
+
padding: 8px;
|
|
52
|
+
border-radius: 4px;
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { ActionButton } from "../"
|
|
3
|
+
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
5
|
+
|
|
6
|
+
export let type = "info"
|
|
7
|
+
export let icon = "Info"
|
|
8
|
+
export let message = ""
|
|
9
|
+
export let dismissable = false
|
|
10
|
+
export let actionMessage = null
|
|
11
|
+
export let action = null
|
|
12
|
+
export let wide = false
|
|
13
|
+
|
|
14
|
+
const dispatch = createEventDispatcher()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div class="spectrum-Toast spectrum-Toast--{type}" class:wide>
|
|
18
|
+
{#if icon}
|
|
19
|
+
<svg
|
|
20
|
+
class="spectrum-Icon spectrum-Icon--sizeM spectrum-Toast-typeIcon"
|
|
21
|
+
focusable="false"
|
|
22
|
+
aria-hidden="true"
|
|
23
|
+
>
|
|
24
|
+
<use xlink:href="#spectrum-icon-18-{icon}" />
|
|
25
|
+
</svg>
|
|
26
|
+
{/if}
|
|
27
|
+
<div class="spectrum-Toast-body" class:actionBody={!!action}>
|
|
28
|
+
<div class="spectrum-Toast-content">{message || ""}</div>
|
|
29
|
+
{#if action}
|
|
30
|
+
<ActionButton quiet emphasized on:click={action}>
|
|
31
|
+
<div style="color: white; font-weight: 600;">{actionMessage}</div>
|
|
32
|
+
</ActionButton>
|
|
33
|
+
{/if}
|
|
34
|
+
</div>
|
|
35
|
+
{#if dismissable}
|
|
36
|
+
<div class="spectrum-Toast-buttons">
|
|
37
|
+
<button
|
|
38
|
+
class="spectrum-ClearButton spectrum-ClearButton--overBackground spectrum-ClearButton--sizeM"
|
|
39
|
+
on:click={() => dispatch("dismiss")}
|
|
40
|
+
>
|
|
41
|
+
<div class="spectrum-ClearButton-fill">
|
|
42
|
+
<svg
|
|
43
|
+
class="spectrum-ClearButton-icon spectrum-Icon spectrum-UIIcon-Cross100"
|
|
44
|
+
focusable="false"
|
|
45
|
+
aria-hidden="true"
|
|
46
|
+
>
|
|
47
|
+
<use xlink:href="#spectrum-css-icon-Cross100" />
|
|
48
|
+
</svg>
|
|
49
|
+
</div>
|
|
50
|
+
</button>
|
|
51
|
+
</div>
|
|
52
|
+
{/if}
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
.spectrum-Toast {
|
|
57
|
+
pointer-events: all;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.wide {
|
|
61
|
+
width: 100%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.actionBody {
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
display: flex;
|
|
67
|
+
width: 100%;
|
|
68
|
+
align-items: center;
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/toast/dist/index-vars.css"
|
|
3
|
+
import Portal from "svelte-portal"
|
|
4
|
+
import { notifications } from "../Stores/notifications"
|
|
5
|
+
import Notification from "./Notification.svelte"
|
|
6
|
+
import { fly } from "svelte/transition"
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Portal target=".modal-container">
|
|
10
|
+
<div class="notifications">
|
|
11
|
+
{#each $notifications as { type, icon, message, id, dismissable, action, wide } (id)}
|
|
12
|
+
<div transition:fly={{ y: 30 }}>
|
|
13
|
+
<Notification
|
|
14
|
+
{type}
|
|
15
|
+
{icon}
|
|
16
|
+
{message}
|
|
17
|
+
{dismissable}
|
|
18
|
+
{action}
|
|
19
|
+
{wide}
|
|
20
|
+
on:dismiss={() => notifications.dismiss(id)}
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
{/each}
|
|
24
|
+
</div>
|
|
25
|
+
</Portal>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
.notifications {
|
|
29
|
+
position: fixed;
|
|
30
|
+
bottom: 40px;
|
|
31
|
+
left: 0;
|
|
32
|
+
right: 0;
|
|
33
|
+
margin: 0 auto;
|
|
34
|
+
padding: 0;
|
|
35
|
+
z-index: 9999;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
justify-content: flex-start;
|
|
39
|
+
align-items: center;
|
|
40
|
+
pointer-events: none;
|
|
41
|
+
gap: 10px;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/pagination/dist/index-vars.css"
|
|
3
|
+
import "@spectrum-css/actionbutton/dist/index-vars.css"
|
|
4
|
+
import "@spectrum-css/typography/dist/index-vars.css"
|
|
5
|
+
|
|
6
|
+
export let page
|
|
7
|
+
export let goToPrevPage
|
|
8
|
+
export let goToNextPage
|
|
9
|
+
export let hasPrevPage = true
|
|
10
|
+
export let hasNextPage = true
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<nav class="spectrum-Pagination spectrum-Pagination--explicit">
|
|
14
|
+
<div
|
|
15
|
+
href="#"
|
|
16
|
+
class="spectrum-ActionButton spectrum-ActionButton--sizeM spectrum-ActionButton--quiet spectrum-Pagination-prevButton"
|
|
17
|
+
on:click={hasPrevPage ? goToPrevPage : null}
|
|
18
|
+
class:is-disabled={!hasPrevPage}
|
|
19
|
+
>
|
|
20
|
+
<svg
|
|
21
|
+
class="spectrum-Icon spectrum-UIIcon-ChevronLeft100"
|
|
22
|
+
focusable="false"
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
aria-label="ChevronLeft"
|
|
25
|
+
>
|
|
26
|
+
<use xlink:href="#spectrum-css-icon-Chevron100" />
|
|
27
|
+
</svg>
|
|
28
|
+
</div>
|
|
29
|
+
<span class="spectrum-Body--secondary spectrum-Pagination-counter">
|
|
30
|
+
Page {page}
|
|
31
|
+
</span>
|
|
32
|
+
<div
|
|
33
|
+
href="#"
|
|
34
|
+
class="spectrum-ActionButton spectrum-ActionButton--sizeM spectrum-ActionButton--quiet spectrum-Pagination-nextButton"
|
|
35
|
+
on:click={hasNextPage ? goToNextPage : null}
|
|
36
|
+
class:is-disabled={!hasNextPage}
|
|
37
|
+
>
|
|
38
|
+
<svg
|
|
39
|
+
class="spectrum-Icon spectrum-UIIcon-ChevronRight100"
|
|
40
|
+
focusable="false"
|
|
41
|
+
aria-hidden="true"
|
|
42
|
+
aria-label="ChevronLeft"
|
|
43
|
+
>
|
|
44
|
+
<use xlink:href="#spectrum-css-icon-Chevron100" />
|
|
45
|
+
</svg>
|
|
46
|
+
</div>
|
|
47
|
+
</nav>
|
|
48
|
+
|
|
49
|
+
<style>
|
|
50
|
+
.spectrum-Pagination-counter {
|
|
51
|
+
margin-left: 0;
|
|
52
|
+
user-select: none;
|
|
53
|
+
}
|
|
54
|
+
.is-disabled:hover {
|
|
55
|
+
cursor: initial;
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
@@ -1,69 +1,79 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import
|
|
2
|
+
import "@spectrum-css/popover/dist/index-vars.css"
|
|
3
|
+
import Portal from "svelte-portal"
|
|
3
4
|
import { createEventDispatcher } from "svelte"
|
|
4
|
-
import positionDropdown from
|
|
5
|
-
import clickOutside from
|
|
5
|
+
import positionDropdown from "../Actions/position_dropdown"
|
|
6
|
+
import clickOutside from "../Actions/click_outside"
|
|
7
|
+
|
|
6
8
|
const dispatch = createEventDispatcher()
|
|
7
9
|
|
|
8
10
|
export let anchor
|
|
9
11
|
export let align = "right"
|
|
10
|
-
let
|
|
12
|
+
export let portalTarget
|
|
13
|
+
export let dataCy
|
|
14
|
+
export let maxWidth
|
|
15
|
+
|
|
16
|
+
export let direction = "bottom"
|
|
17
|
+
export let showTip = false
|
|
18
|
+
|
|
19
|
+
let tipSvg =
|
|
20
|
+
'<svg xmlns="http://www.w3.org/svg/2000" width="23" height="12" class="spectrum-Popover-tip" > <path class="spectrum-Popover-tip-triangle" d="M 0.7071067811865476 0 L 11.414213562373096 10.707106781186548 L 22.121320343559645 0" /> </svg>'
|
|
21
|
+
|
|
22
|
+
$: tooltipClasses = showTip
|
|
23
|
+
? `spectrum-Popover--withTip spectrum-Popover--${direction}`
|
|
24
|
+
: ""
|
|
11
25
|
|
|
12
26
|
export const show = () => {
|
|
27
|
+
dispatch("open")
|
|
13
28
|
open = true
|
|
14
|
-
dispatch("show")
|
|
15
29
|
}
|
|
16
30
|
|
|
17
31
|
export const hide = () => {
|
|
32
|
+
dispatch("close")
|
|
18
33
|
open = false
|
|
19
|
-
dispatch("hide")
|
|
20
34
|
}
|
|
21
35
|
|
|
36
|
+
let open = null
|
|
37
|
+
|
|
22
38
|
function handleEscape(e) {
|
|
23
39
|
if (open && e.key === "Escape") {
|
|
24
40
|
hide()
|
|
25
41
|
}
|
|
26
42
|
}
|
|
27
|
-
|
|
28
43
|
</script>
|
|
29
44
|
|
|
30
45
|
{#if open}
|
|
31
|
-
<Portal>
|
|
46
|
+
<Portal target={portalTarget}>
|
|
32
47
|
<div
|
|
33
48
|
tabindex="0"
|
|
34
|
-
|
|
35
|
-
use:positionDropdown={{anchor, align}}
|
|
49
|
+
use:positionDropdown={{ anchor, align, maxWidth }}
|
|
36
50
|
use:clickOutside={hide}
|
|
37
51
|
on:keydown={handleEscape}
|
|
38
|
-
class="
|
|
39
|
-
|
|
52
|
+
class={"spectrum-Popover is-open " + (tooltipClasses || "")}
|
|
53
|
+
role="presentation"
|
|
54
|
+
data-cy={dataCy}
|
|
55
|
+
>
|
|
56
|
+
{#if showTip}
|
|
57
|
+
{@html tipSvg}
|
|
58
|
+
{/if}
|
|
59
|
+
|
|
60
|
+
<slot />
|
|
40
61
|
</div>
|
|
41
62
|
</Portal>
|
|
42
63
|
{/if}
|
|
43
64
|
|
|
44
65
|
<style>
|
|
45
|
-
.
|
|
46
|
-
|
|
66
|
+
.spectrum-Popover {
|
|
67
|
+
min-width: var(--spectrum-global-dimension-size-2000);
|
|
68
|
+
border-color: var(--spectrum-global-color-gray-300);
|
|
69
|
+
}
|
|
70
|
+
.spectrum-Popover.is-open.spectrum-Popover--withTip {
|
|
47
71
|
margin-top: var(--spacing-xs);
|
|
48
|
-
|
|
49
|
-
outline: none;
|
|
50
|
-
box-sizing: border-box;
|
|
51
|
-
opacity: 0;
|
|
52
|
-
min-width: 400px;
|
|
53
|
-
z-index: 2;
|
|
54
|
-
color: var(--ink);
|
|
55
|
-
height: fit-content !important;
|
|
56
|
-
border: var(--border-dark);
|
|
57
|
-
border-radius: var(--border-radius-m);
|
|
58
|
-
transform: scale(0);
|
|
59
|
-
transition: opacity 0.13s linear, transform 0.12s cubic-bezier(0, 0, 0.2, 1);
|
|
60
|
-
overflow-y: auto;
|
|
61
|
-
background-color: var(--background);
|
|
62
|
-
box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15);
|
|
72
|
+
margin-left: var(--spacing-xl);
|
|
63
73
|
}
|
|
64
|
-
|
|
65
|
-
.
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
:global(.spectrum-Popover--bottom .spectrum-Popover-tip),
|
|
75
|
+
:global(.spectrum-Popover--top .spectrum-Popover-tip) {
|
|
76
|
+
left: 90%;
|
|
77
|
+
margin-left: calc(var(--spectrum-global-dimension-size-150) * -1);
|
|
68
78
|
}
|
|
69
79
|
</style>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/progressbar/dist/index-vars.css"
|
|
3
|
+
import { tweened } from "svelte/motion"
|
|
4
|
+
import { cubicOut } from "svelte/easing"
|
|
5
|
+
|
|
6
|
+
export let value = false
|
|
7
|
+
export let easing = cubicOut
|
|
8
|
+
export let duration = 1000
|
|
9
|
+
export let width = false
|
|
10
|
+
export let sideLabel = false
|
|
11
|
+
export let hidePercentage = true
|
|
12
|
+
export let color // red, green, default = blue
|
|
13
|
+
|
|
14
|
+
export let size = "M"
|
|
15
|
+
|
|
16
|
+
const progress = tweened(0, {
|
|
17
|
+
duration: duration,
|
|
18
|
+
easing: easing,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
$: if (value || value === 0) $progress = value
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div
|
|
25
|
+
class:spectrum-ProgressBar--indeterminate={!value && value !== 0}
|
|
26
|
+
class:spectrum-ProgressBar--sideLabel={sideLabel}
|
|
27
|
+
class="spectrum-ProgressBar spectrum-ProgressBar--size{size}"
|
|
28
|
+
value={$progress}
|
|
29
|
+
role="progressbar"
|
|
30
|
+
aria-valuenow={$progress}
|
|
31
|
+
aria-valuemin="0"
|
|
32
|
+
aria-valuemax="100"
|
|
33
|
+
style={width ? `width: ${width};` : ""}
|
|
34
|
+
>
|
|
35
|
+
{#if $$slots}
|
|
36
|
+
<div
|
|
37
|
+
class="spectrum-FieldLabel spectrum-ProgressBar-label spectrum-FieldLabel--size{size}"
|
|
38
|
+
>
|
|
39
|
+
<slot />
|
|
40
|
+
</div>
|
|
41
|
+
{/if}
|
|
42
|
+
{#if !hidePercentage && (value || value === 0)}
|
|
43
|
+
<div
|
|
44
|
+
class="spectrum-FieldLabel spectrum-ProgressBar-percentage spectrum-FieldLabel--size{size}"
|
|
45
|
+
>
|
|
46
|
+
{Math.round($progress)}%
|
|
47
|
+
</div>
|
|
48
|
+
{/if}
|
|
49
|
+
<div class="spectrum-ProgressBar-track">
|
|
50
|
+
<div
|
|
51
|
+
class="spectrum-ProgressBar-fill"
|
|
52
|
+
class:color-green={color === "green"}
|
|
53
|
+
class:color-red={color === "red"}
|
|
54
|
+
style={value || value === 0 ? `width: ${$progress}%` : ""}
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="spectrum-ProgressBar-label" hidden="" />
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<style>
|
|
61
|
+
.color-green {
|
|
62
|
+
background: #009562;
|
|
63
|
+
}
|
|
64
|
+
.color-red {
|
|
65
|
+
background: #dd2019;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/progresscircle/dist/index-vars.css"
|
|
3
|
+
|
|
4
|
+
export let size = "M"
|
|
5
|
+
function convertSize(size) {
|
|
6
|
+
switch (size) {
|
|
7
|
+
case "S":
|
|
8
|
+
return "small"
|
|
9
|
+
case "L":
|
|
10
|
+
return "large"
|
|
11
|
+
default:
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export let value = null
|
|
17
|
+
export let minValue = 0
|
|
18
|
+
export let maxValue = 100
|
|
19
|
+
|
|
20
|
+
let subMask1Style
|
|
21
|
+
let subMask2Style
|
|
22
|
+
$: calculateSubMasks(value)
|
|
23
|
+
|
|
24
|
+
function calculateSubMasks(value) {
|
|
25
|
+
if (value) {
|
|
26
|
+
let percentage = ((value - minValue) / (maxValue - minValue)) * 100
|
|
27
|
+
let angle
|
|
28
|
+
if (percentage > 0 && percentage <= 50) {
|
|
29
|
+
angle = -180 + (percentage / 50) * 180
|
|
30
|
+
subMask1Style = `transform: rotate(${angle}deg);`
|
|
31
|
+
subMask2Style = "transform: rotate(-180deg);"
|
|
32
|
+
} else if (percentage > 50) {
|
|
33
|
+
angle = -180 + ((percentage - 50) / 50) * 180
|
|
34
|
+
subMask1Style = "transform: rotate(0deg);"
|
|
35
|
+
subMask2Style = `transform: rotate(${angle}deg);`
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export let overBackground
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<div
|
|
44
|
+
on:click
|
|
45
|
+
class:spectrum-ProgressCircle--indeterminate={value == null}
|
|
46
|
+
class:spectrum-ProgressCircle--overBackground={overBackground}
|
|
47
|
+
class="spectrum-ProgressCircle spectrum-ProgressCircle--{convertSize(size)}"
|
|
48
|
+
>
|
|
49
|
+
<div class="spectrum-ProgressCircle-track" />
|
|
50
|
+
<div class="spectrum-ProgressCircle-fills">
|
|
51
|
+
<div class="spectrum-ProgressCircle-fillMask1">
|
|
52
|
+
<div class="spectrum-ProgressCircle-fillSubMask1" style={subMask1Style}>
|
|
53
|
+
<div class="spectrum-ProgressCircle-fill" />
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="spectrum-ProgressCircle-fillMask2">
|
|
57
|
+
<div class="spectrum-ProgressCircle-fillSubMask2" style={subMask2Style}>
|
|
58
|
+
<div class="spectrum-ProgressCircle-fill" />
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { getContext } from "svelte"
|
|
3
|
+
const multilevel = getContext("sidenav-type")
|
|
4
|
+
import Badge from "../Badge/Badge.svelte"
|
|
5
|
+
export let href = ""
|
|
6
|
+
export let external = false
|
|
7
|
+
export let heading = ""
|
|
8
|
+
export let icon = ""
|
|
9
|
+
export let selected = false
|
|
10
|
+
export let disabled = false
|
|
11
|
+
export let dataCy
|
|
12
|
+
export let badge = ""
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<li
|
|
16
|
+
class="spectrum-SideNav-item"
|
|
17
|
+
class:is-selected={selected}
|
|
18
|
+
class:is-disabled={disabled}
|
|
19
|
+
on:click
|
|
20
|
+
data-cy={dataCy}
|
|
21
|
+
>
|
|
22
|
+
{#if heading}
|
|
23
|
+
<h2 class="spectrum-SideNav-heading" id="nav-heading-{heading}">
|
|
24
|
+
{heading}
|
|
25
|
+
</h2>
|
|
26
|
+
{/if}
|
|
27
|
+
<a
|
|
28
|
+
target={external ? "_blank" : ""}
|
|
29
|
+
{href}
|
|
30
|
+
class="spectrum-SideNav-itemLink"
|
|
31
|
+
aria-current="page"
|
|
32
|
+
>
|
|
33
|
+
{#if icon}
|
|
34
|
+
<svg
|
|
35
|
+
class="spectrum-Icon spectrum-Icon--sizeM spectrum-SideNav-itemIcon"
|
|
36
|
+
focusable="false"
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
>
|
|
39
|
+
<use xlink:href="#spectrum-icon-18-{icon}" />
|
|
40
|
+
</svg>
|
|
41
|
+
{/if}
|
|
42
|
+
<slot />
|
|
43
|
+
{#if badge}
|
|
44
|
+
<div class="badge">
|
|
45
|
+
<Badge active size="S">{badge}</Badge>
|
|
46
|
+
</div>
|
|
47
|
+
{/if}
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
{#if multilevel && $$slots.subnav}
|
|
51
|
+
<ul class="spectrum-SideNav">
|
|
52
|
+
<slot name="subnav" />
|
|
53
|
+
</ul>
|
|
54
|
+
{/if}
|
|
55
|
+
</li>
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
.badge {
|
|
59
|
+
margin-left: 10px;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { setContext } from "svelte"
|
|
3
|
+
import "@spectrum-css/sidenav/dist/index-vars.css"
|
|
4
|
+
export let multilevel = false
|
|
5
|
+
setContext("sidenav-type", multilevel)
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<nav>
|
|
9
|
+
<ul class="spectrum-SideNav" class:spectrum-SideNav--multiLevel={multilevel}>
|
|
10
|
+
<slot />
|
|
11
|
+
</ul>
|
|
12
|
+
</nav>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/statuslight"
|
|
3
|
+
|
|
4
|
+
export let size = "M"
|
|
5
|
+
export let celery = false
|
|
6
|
+
export let yellow = false
|
|
7
|
+
export let fuchsia = false
|
|
8
|
+
export let indigo = false
|
|
9
|
+
export let seafoam = false
|
|
10
|
+
export let chartreuse = false
|
|
11
|
+
export let magenta = false
|
|
12
|
+
export let purple = false
|
|
13
|
+
export let neutral = false
|
|
14
|
+
export let info = false
|
|
15
|
+
export let positive = false
|
|
16
|
+
export let notice = false
|
|
17
|
+
export let negative = false
|
|
18
|
+
export let disabled = false
|
|
19
|
+
export let active = false
|
|
20
|
+
export let color = null
|
|
21
|
+
export let square = false
|
|
22
|
+
export let hoverable = false
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div
|
|
26
|
+
on:click
|
|
27
|
+
class="spectrum-StatusLight spectrum-StatusLight--size{size}"
|
|
28
|
+
class:custom={!!color}
|
|
29
|
+
class:square
|
|
30
|
+
class:hoverable
|
|
31
|
+
style={`--color: ${color};`}
|
|
32
|
+
class:spectrum-StatusLight--celery={celery}
|
|
33
|
+
class:spectrum-StatusLight--yellow={yellow}
|
|
34
|
+
class:spectrum-StatusLight--fuchsia={fuchsia}
|
|
35
|
+
class:spectrum-StatusLight--indigo={indigo}
|
|
36
|
+
class:spectrum-StatusLight--seafoam={seafoam}
|
|
37
|
+
class:spectrum-StatusLight--chartreuse={chartreuse}
|
|
38
|
+
class:spectrum-StatusLight--magenta={magenta}
|
|
39
|
+
class:spectrum-StatusLight--purple={purple}
|
|
40
|
+
class:spectrum-StatusLight--neutral={neutral}
|
|
41
|
+
class:spectrum-StatusLight--info={info}
|
|
42
|
+
class:spectrum-StatusLight--positive={positive}
|
|
43
|
+
class:spectrum-StatusLight--notice={notice}
|
|
44
|
+
class:spectrum-StatusLight--negative={negative}
|
|
45
|
+
class:spectrum-StatusLight--disabled={disabled}
|
|
46
|
+
class:spectrum-StatusLight--active={active}
|
|
47
|
+
class:withText={!!$$slots.default}
|
|
48
|
+
>
|
|
49
|
+
<slot />
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
.spectrum-StatusLight {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: row;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
align-items: center;
|
|
58
|
+
--spectrum-statuslight-info-text-gap: 4px;
|
|
59
|
+
min-height: 0;
|
|
60
|
+
padding-top: 0;
|
|
61
|
+
padding-bottom: 0;
|
|
62
|
+
transition: color ease-out 130ms;
|
|
63
|
+
}
|
|
64
|
+
.spectrum-StatusLight.withText::before {
|
|
65
|
+
margin-right: 10px;
|
|
66
|
+
}
|
|
67
|
+
.custom::before {
|
|
68
|
+
background: var(--color) !important;
|
|
69
|
+
}
|
|
70
|
+
.square::before {
|
|
71
|
+
width: 14px;
|
|
72
|
+
height: 14px;
|
|
73
|
+
border-radius: 4px;
|
|
74
|
+
margin: 0;
|
|
75
|
+
}
|
|
76
|
+
.hoverable:hover {
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
color: var(--spectrum-global-color-gray-900);
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -19,7 +19,7 @@ This custom can be used to display toast messages. It has 5 different methods: `
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
<View name="danger">
|
|
22
|
-
<button on:click={() => notifications.
|
|
22
|
+
<button on:click={() => notifications.error('This is a danger!')}>Danger</button>
|
|
23
23
|
</View>
|
|
24
24
|
<View name="warning">
|
|
25
25
|
<button on:click={() => notifications.warning('This is a warning!')}>Warning</button>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { writable } from "svelte/store"
|
|
2
|
+
|
|
3
|
+
export const BANNER_TYPES = {
|
|
4
|
+
INFO: "info",
|
|
5
|
+
NEGATIVE: "negative",
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function createBannerStore() {
|
|
9
|
+
const DEFAULT_CONFIG = {
|
|
10
|
+
messages: [],
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const banner = writable(DEFAULT_CONFIG)
|
|
14
|
+
|
|
15
|
+
const show = async (
|
|
16
|
+
// eslint-disable-next-line
|
|
17
|
+
config = { message, type, extraButtonText, extraButtonAction, onChange }
|
|
18
|
+
) => {
|
|
19
|
+
banner.update(store => {
|
|
20
|
+
return {
|
|
21
|
+
...store,
|
|
22
|
+
...config,
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const showStatus = async () => {
|
|
28
|
+
const config = {
|
|
29
|
+
message: "Some systems are experiencing issues",
|
|
30
|
+
type: BANNER_TYPES.NEGATIVE,
|
|
31
|
+
extraButtonText: "View Status",
|
|
32
|
+
extraButtonAction: () => window.open("https://status.budibase.com/"),
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
await queue([config])
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const queue = async entries => {
|
|
39
|
+
const priority = {
|
|
40
|
+
[BANNER_TYPES.NEGATIVE]: 0,
|
|
41
|
+
[BANNER_TYPES.INFO]: 1,
|
|
42
|
+
}
|
|
43
|
+
banner.update(store => {
|
|
44
|
+
const sorted = [...store.messages, ...entries].sort((a, b) => {
|
|
45
|
+
if (priority[a.type] == priority[b.type]) {
|
|
46
|
+
return 0
|
|
47
|
+
}
|
|
48
|
+
return priority[a.type] < priority[b.type] ? -1 : 1
|
|
49
|
+
})
|
|
50
|
+
return {
|
|
51
|
+
...store,
|
|
52
|
+
messages: sorted,
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
subscribe: banner.subscribe,
|
|
59
|
+
showStatus,
|
|
60
|
+
show,
|
|
61
|
+
queue,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const banner = createBannerStore()
|