@budibase/bbui 0.0.1
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/README.md +42 -0
- package/dist/bbui.es.js +8 -0
- package/dist/bbui.es.js.map +1 -0
- package/package.json +94 -0
- package/src/Accordion/Accordion.svelte +58 -0
- package/src/ActionButton/ActionButton.svelte +132 -0
- package/src/ActionGroup/ActionGroup.svelte +26 -0
- package/src/ActionMenu/ActionMenu.svelte +43 -0
- package/src/Actions/ClickOutside.svench.svx +30 -0
- package/src/Actions/PositionDropdown.svench.svx +81 -0
- package/src/Actions/autoresize_textarea.js +14 -0
- package/src/Actions/click_outside.js +76 -0
- package/src/Actions/position_dropdown.js +116 -0
- package/src/Avatar/Avatar.svelte +63 -0
- package/src/Badge/Badge.svelte +42 -0
- package/src/Banner/Banner.svelte +72 -0
- package/src/Banner/BannerDisplay.svelte +41 -0
- package/src/Button/Button.svelte +118 -0
- package/src/Button/Button.svench +138 -0
- package/src/ButtonGroup/ButtonGroup.svelte +30 -0
- package/src/ClearButton/ClearButton.svelte +19 -0
- package/src/ColorPicker/ColorPicker.svelte +304 -0
- package/src/DetailSummary/DetailSummary.svelte +92 -0
- package/src/Divider/Divider.svelte +28 -0
- package/src/Drawer/Drawer.svelte +113 -0
- package/src/Drawer/Drawer.svench +42 -0
- package/src/Drawer/DrawerContent.svelte +45 -0
- package/src/FancyForm/FancyButton.svelte +30 -0
- package/src/FancyForm/FancyButtonRadio.svelte +70 -0
- package/src/FancyForm/FancyCheckbox.svelte +53 -0
- package/src/FancyForm/FancyField.svelte +126 -0
- package/src/FancyForm/FancyFieldLabel.svelte +25 -0
- package/src/FancyForm/FancyForm.svelte +40 -0
- package/src/FancyForm/FancyInput.svelte +109 -0
- package/src/FancyForm/FancySelect.svelte +147 -0
- package/src/FancyForm/index.js +6 -0
- package/src/Form/Checkbox.svelte +23 -0
- 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 +265 -0
- package/src/Form/Core/Dropzone.svelte +482 -0
- package/src/Form/Core/EnvDropdown.svelte +276 -0
- package/src/Form/Core/File.svelte +115 -0
- package/src/Form/Core/InputDropdown.svelte +235 -0
- package/src/Form/Core/Multiselect.svelte +99 -0
- package/src/Form/Core/Picker.svelte +314 -0
- package/src/Form/Core/PickerDropdown.svelte +431 -0
- package/src/Form/Core/RadioGroup.svelte +65 -0
- package/src/Form/Core/RichTextField.svelte +42 -0
- package/src/Form/Core/Search.svelte +105 -0
- package/src/Form/Core/Select.svelte +90 -0
- package/src/Form/Core/Slider.svelte +86 -0
- package/src/Form/Core/Stepper.svelte +172 -0
- package/src/Form/Core/Switch.svelte +35 -0
- package/src/Form/Core/TextArea.svelte +78 -0
- package/src/Form/Core/TextField.svelte +115 -0
- package/src/Form/Core/index.js +16 -0
- package/src/Form/DatePicker.svelte +46 -0
- package/src/Form/Dropzone.svelte +44 -0
- package/src/Form/EnvDropdown.svelte +50 -0
- package/src/Form/Field.svelte +42 -0
- package/src/Form/FieldLabel.svelte +32 -0
- package/src/Form/File.svelte +37 -0
- package/src/Form/Input.svelte +45 -0
- package/src/Form/InputDropdown.svelte +53 -0
- package/src/Form/Multiselect.svelte +49 -0
- package/src/Form/PickerDropdown.svelte +131 -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 +67 -0
- package/src/Form/Slider.svelte +24 -0
- package/src/Form/Stepper.svelte +45 -0
- package/src/Form/TextArea.svelte +34 -0
- package/src/Form/Toggle.svelte +22 -0
- package/src/Icon/Icon.svelte +94 -0
- package/src/Icon/IconAvatar.svelte +61 -0
- package/src/IconPicker/IconPicker.svelte +184 -0
- package/src/IconSideNav/IconSideNav.svelte +14 -0
- package/src/IconSideNav/IconSideNavItem.svelte +56 -0
- package/src/InlineAlert/InlineAlert.svelte +63 -0
- package/src/Input/CopyInput.svelte +59 -0
- package/src/Label/Label.svelte +31 -0
- package/src/Layout/Layout.svelte +94 -0
- package/src/Layout/Page.svelte +101 -0
- package/src/Link/Link.svelte +27 -0
- package/src/List/List.svelte +28 -0
- package/src/List/ListItem.svelte +93 -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 +94 -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 +6 -0
- package/src/Modal/CustomContent.svelte +37 -0
- package/src/Modal/Modal.svelte +178 -0
- package/src/Modal/Modal.svench +116 -0
- package/src/Modal/ModalContent.svelte +190 -0
- package/src/Modal/QuizModal.svelte +53 -0
- package/src/Notification/Notification.svelte +74 -0
- package/src/Notification/NotificationDisplay.svelte +43 -0
- package/src/Pagination/Pagination.svelte +57 -0
- package/src/Popover/Popover.svelte +95 -0
- package/src/Popover/Popover.svench +120 -0
- package/src/ProgressBar/ProgressBar.svelte +67 -0
- package/src/ProgressCircle/ProgressCircle.svelte +62 -0
- package/src/SideNavigation/Item.svelte +59 -0
- package/src/SideNavigation/Navigation.svelte +12 -0
- package/src/StatusLight/StatusLight.svelte +80 -0
- package/src/Stores/Notifications.svench.svx +78 -0
- package/src/Stores/banner.js +65 -0
- package/src/Stores/notifications.js +84 -0
- package/src/Table/ArrayRenderer.svelte +18 -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 +70 -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 +35 -0
- package/src/Table/SelectEditRenderer.svelte +28 -0
- package/src/Table/StringRenderer.svelte +22 -0
- package/src/Table/Table.svelte +657 -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 +17 -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 +22 -0
- package/src/Typography/Code.svelte +10 -0
- package/src/Typography/Detail.svelte +19 -0
- package/src/Typography/Heading.svelte +24 -0
- package/src/bbui.css +118 -0
- package/src/context.js +4 -0
- package/src/helpers.js +116 -0
- package/src/index.js +109 -0
- package/src/spectrum-icons-rollup.js +31 -0
- package/src/spectrum-icons-vite.js +31 -0
|
@@ -0,0 +1,53 @@
|
|
|
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>
|
|
@@ -0,0 +1,74 @@
|
|
|
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="wrap 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
|
+
.wrap {
|
|
57
|
+
overflow-wrap: anywhere;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.spectrum-Toast {
|
|
61
|
+
pointer-events: all;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.wide {
|
|
65
|
+
width: 100%;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.actionBody {
|
|
69
|
+
justify-content: space-between;
|
|
70
|
+
display: flex;
|
|
71
|
+
width: 100%;
|
|
72
|
+
align-items: center;
|
|
73
|
+
}
|
|
74
|
+
</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>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/popover/dist/index-vars.css"
|
|
3
|
+
import Portal from "svelte-portal"
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
5
|
+
import positionDropdown from "../Actions/position_dropdown"
|
|
6
|
+
import clickOutside from "../Actions/click_outside"
|
|
7
|
+
import { fly } from "svelte/transition"
|
|
8
|
+
import { getContext } from "svelte"
|
|
9
|
+
import Context from "../context"
|
|
10
|
+
|
|
11
|
+
const dispatch = createEventDispatcher()
|
|
12
|
+
|
|
13
|
+
export let anchor
|
|
14
|
+
export let align = "right"
|
|
15
|
+
export let portalTarget
|
|
16
|
+
export let maxWidth
|
|
17
|
+
export let maxHeight
|
|
18
|
+
export let open = false
|
|
19
|
+
export let useAnchorWidth = false
|
|
20
|
+
export let dismissible = true
|
|
21
|
+
export let offset = 5
|
|
22
|
+
export let customHeight
|
|
23
|
+
export let animate = true
|
|
24
|
+
|
|
25
|
+
$: target = portalTarget || getContext(Context.PopoverRoot) || ".spectrum"
|
|
26
|
+
|
|
27
|
+
export const show = () => {
|
|
28
|
+
dispatch("open")
|
|
29
|
+
open = true
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const hide = () => {
|
|
33
|
+
dispatch("close")
|
|
34
|
+
open = false
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const handleOutsideClick = e => {
|
|
38
|
+
if (open) {
|
|
39
|
+
// Stop propagation if the source is the anchor
|
|
40
|
+
let node = e.target
|
|
41
|
+
let fromAnchor = false
|
|
42
|
+
while (!fromAnchor && node && node.parentNode) {
|
|
43
|
+
fromAnchor = node === anchor
|
|
44
|
+
node = node.parentNode
|
|
45
|
+
}
|
|
46
|
+
if (fromAnchor) {
|
|
47
|
+
e.stopPropagation()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Hide the popover
|
|
51
|
+
hide()
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function handleEscape(e) {
|
|
56
|
+
if (open && e.key === "Escape") {
|
|
57
|
+
hide()
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
{#if open}
|
|
63
|
+
<Portal {target}>
|
|
64
|
+
<div
|
|
65
|
+
tabindex="0"
|
|
66
|
+
use:positionDropdown={{
|
|
67
|
+
anchor,
|
|
68
|
+
align,
|
|
69
|
+
maxHeight,
|
|
70
|
+
maxWidth,
|
|
71
|
+
useAnchorWidth,
|
|
72
|
+
offset,
|
|
73
|
+
}}
|
|
74
|
+
use:clickOutside={{
|
|
75
|
+
callback: dismissible ? handleOutsideClick : () => {},
|
|
76
|
+
anchor,
|
|
77
|
+
}}
|
|
78
|
+
on:keydown={handleEscape}
|
|
79
|
+
class="spectrum-Popover is-open"
|
|
80
|
+
role="presentation"
|
|
81
|
+
style="height: {customHeight}"
|
|
82
|
+
transition:fly|local={{ y: -20, duration: animate ? 200 : 0 }}
|
|
83
|
+
>
|
|
84
|
+
<slot />
|
|
85
|
+
</div>
|
|
86
|
+
</Portal>
|
|
87
|
+
{/if}
|
|
88
|
+
|
|
89
|
+
<style>
|
|
90
|
+
.spectrum-Popover {
|
|
91
|
+
min-width: var(--spectrum-global-dimension-size-2000);
|
|
92
|
+
border-color: var(--spectrum-global-color-gray-300);
|
|
93
|
+
overflow: auto;
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { View } from "svench";
|
|
3
|
+
import Popover from "./Popover.svelte";
|
|
4
|
+
import Button from "../Button/Button.svelte";
|
|
5
|
+
import TextButton from "../Button/TextButton.svelte";
|
|
6
|
+
import Icon from "../Icons/Icon.svelte";
|
|
7
|
+
import Input from "../Form/Input.svelte";
|
|
8
|
+
import Select from "../Form/Select.svelte";
|
|
9
|
+
|
|
10
|
+
let anchorRight;
|
|
11
|
+
let anchorLeft;
|
|
12
|
+
let dropdownRight;
|
|
13
|
+
let dropdownLeft;
|
|
14
|
+
|
|
15
|
+
const options = ["Column 1", "Column 2", "Super cool column"];
|
|
16
|
+
const option1s = ["Is", "Is not", "Contains" , "Does not contain"];
|
|
17
|
+
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
.button-group {
|
|
22
|
+
margin-top: var(--spacing-l);
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: flex-end;
|
|
25
|
+
gap: var(--spacing-s);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
h6 {
|
|
29
|
+
font-size: var(--font-size-m);
|
|
30
|
+
margin: 0 0 var(--spacing-l) 0;
|
|
31
|
+
font-weight: 600;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.input-group-column {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
gap: var(--spacing-s);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.input-group-row {
|
|
41
|
+
display: grid;
|
|
42
|
+
grid-template-columns: [boolean-start] 60px [boolean-end property-start] 120px [property-end opererator-start] 110px [operator-end value-start] auto [value-end menu-start] 32px [menu-end];
|
|
43
|
+
gap: var(--spacing-s);
|
|
44
|
+
margin-bottom: var(--spacing-l);
|
|
45
|
+
align-items: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
p {
|
|
49
|
+
margin:0;
|
|
50
|
+
font-size: var(--font-size-xs);
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
53
|
+
|
|
54
|
+
<View name="Simple popover">
|
|
55
|
+
<div bind:this={anchorLeft}>
|
|
56
|
+
<Button text on:click={dropdownLeft.show}>
|
|
57
|
+
<Icon name="view" />
|
|
58
|
+
Add View
|
|
59
|
+
</Button>
|
|
60
|
+
</div>
|
|
61
|
+
<Popover bind:this={dropdownLeft} anchor={anchorLeft} align="left">
|
|
62
|
+
<h6>Add New View</h6>
|
|
63
|
+
<Input thin placeholder="Enter your name" />
|
|
64
|
+
<div class="button-group">
|
|
65
|
+
<Button secondary on:click={() => alert('Clicked!')}>Cancel</Button>
|
|
66
|
+
<Button primary on:click={() => alert('Clicked!')}>Add New View</Button>
|
|
67
|
+
</div>
|
|
68
|
+
</Popover>
|
|
69
|
+
</View>
|
|
70
|
+
|
|
71
|
+
<View name="Stacked columns">
|
|
72
|
+
<div bind:this={anchorRight}>
|
|
73
|
+
<Button text on:click={dropdownRight.show}>
|
|
74
|
+
<Icon name="addrow" />
|
|
75
|
+
Add Row
|
|
76
|
+
</Button>
|
|
77
|
+
</div>
|
|
78
|
+
<Popover bind:this={dropdownRight} anchor={anchorRight}>
|
|
79
|
+
<h6>Add New Row</h6>
|
|
80
|
+
<div class="input-group-column">
|
|
81
|
+
<Input thin placeholder="Enter your string" />
|
|
82
|
+
<Input thin placeholder="Enter your string" />
|
|
83
|
+
<Input thin placeholder="Enter your string" />
|
|
84
|
+
</div>
|
|
85
|
+
<div class="button-group">
|
|
86
|
+
<Button secondary on:click={() => alert('Clicked!')}>Cancel</Button>
|
|
87
|
+
<Button primary on:click={() => alert('Clicked!')}>Add New Row</Button>
|
|
88
|
+
</div>
|
|
89
|
+
</Popover>
|
|
90
|
+
</View>
|
|
91
|
+
|
|
92
|
+
<View name="Multiple inputs in a row">
|
|
93
|
+
<div bind:this={anchorLeft}>
|
|
94
|
+
<Button text on:click={dropdownLeft.show}>
|
|
95
|
+
<Icon name="filter" />
|
|
96
|
+
Add Filter
|
|
97
|
+
</Button>
|
|
98
|
+
</div>
|
|
99
|
+
<Popover bind:this={dropdownLeft} anchor={anchorLeft} align="left">
|
|
100
|
+
<h6>Add New Filter</h6>
|
|
101
|
+
<div class="input-group-row">
|
|
102
|
+
<p>Where</p>
|
|
103
|
+
<Select secondary thin name="Test">
|
|
104
|
+
{#each options as option}
|
|
105
|
+
<option value={option}>{option}</option>
|
|
106
|
+
{/each}
|
|
107
|
+
</Select>
|
|
108
|
+
<Select secondary thin name="Test">
|
|
109
|
+
{#each option1s as option1}
|
|
110
|
+
<option value={option1}>{option1}</option>
|
|
111
|
+
{/each}
|
|
112
|
+
</Select>
|
|
113
|
+
<Input thin placeholder="Enter your name" />
|
|
114
|
+
<Button text on:click={() => alert('Clicked!')}>
|
|
115
|
+
<Icon name="close" />
|
|
116
|
+
</Button>
|
|
117
|
+
</div>
|
|
118
|
+
<Button text on:click={() => alert('Clicked!')}>Add Filter</Button>
|
|
119
|
+
</Popover>
|
|
120
|
+
</View>
|
|
@@ -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,59 @@
|
|
|
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 badge = ""
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<li
|
|
15
|
+
class="spectrum-SideNav-item"
|
|
16
|
+
class:is-selected={selected}
|
|
17
|
+
class:is-disabled={disabled}
|
|
18
|
+
on:click
|
|
19
|
+
>
|
|
20
|
+
{#if heading}
|
|
21
|
+
<h2 class="spectrum-SideNav-heading" id="nav-heading-{heading}">
|
|
22
|
+
{heading}
|
|
23
|
+
</h2>
|
|
24
|
+
{/if}
|
|
25
|
+
<a
|
|
26
|
+
target={external ? "_blank" : ""}
|
|
27
|
+
{href}
|
|
28
|
+
class="spectrum-SideNav-itemLink"
|
|
29
|
+
aria-current="page"
|
|
30
|
+
>
|
|
31
|
+
{#if icon}
|
|
32
|
+
<svg
|
|
33
|
+
class="spectrum-Icon spectrum-Icon--sizeM spectrum-SideNav-itemIcon"
|
|
34
|
+
focusable="false"
|
|
35
|
+
aria-hidden="true"
|
|
36
|
+
>
|
|
37
|
+
<use xlink:href="#spectrum-icon-18-{icon}" />
|
|
38
|
+
</svg>
|
|
39
|
+
{/if}
|
|
40
|
+
<slot />
|
|
41
|
+
{#if badge}
|
|
42
|
+
<div class="badge">
|
|
43
|
+
<Badge active size="S">{badge}</Badge>
|
|
44
|
+
</div>
|
|
45
|
+
{/if}
|
|
46
|
+
</a>
|
|
47
|
+
|
|
48
|
+
{#if multilevel && $$slots.subnav}
|
|
49
|
+
<ul class="spectrum-SideNav">
|
|
50
|
+
<slot name="subnav" />
|
|
51
|
+
</ul>
|
|
52
|
+
{/if}
|
|
53
|
+
</li>
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
.badge {
|
|
57
|
+
margin-left: 10px;
|
|
58
|
+
}
|
|
59
|
+
</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>
|