@budibase/bbui 1.1.0 → 1.1.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/LICENSE +375 -0
- package/README.md +19 -17
- package/dist/bbui.es.js +210 -0
- package/dist/bbui.es.js.map +1 -0
- package/package.json +71 -26
- package/src/ActionButton/ActionButton.svelte +95 -0
- package/src/ActionGroup/ActionGroup.svelte +26 -0
- package/src/ActionMenu/ActionMenu.svelte +44 -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 +18 -0
- package/src/Actions/position_dropdown.js +66 -0
- package/src/Avatar/Avatar.svelte +49 -0
- package/src/Badge/Badge.svelte +29 -0
- package/src/Banner/Banner.svelte +72 -0
- package/src/Banner/BannerDisplay.svelte +31 -0
- package/src/Button/Button.svelte +114 -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 +297 -0
- package/src/DetailSummary/DetailSummary.svelte +83 -0
- package/src/Divider/Divider.svelte +28 -0
- package/src/Drawer/Drawer.svelte +112 -0
- package/src/Drawer/Drawer.svench +42 -0
- package/src/Drawer/DrawerContent.svelte +46 -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 +242 -0
- package/src/Form/Core/Dropzone.svelte +438 -0
- package/src/Form/Core/Multiselect.svelte +88 -0
- package/src/Form/Core/Picker.svelte +256 -0
- package/src/Form/Core/RadioGroup.svelte +47 -0
- package/src/Form/Core/RichTextField.svelte +42 -0
- package/src/Form/Core/Search.svelte +105 -0
- package/src/Form/Core/Select.svelte +76 -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 +37 -0
- package/src/Form/Dropzone.svelte +40 -0
- package/src/Form/Field.svelte +42 -0
- package/src/Form/FieldLabel.svelte +32 -0
- package/src/Form/Input.svelte +40 -45
- package/src/Form/Multiselect.svelte +39 -0
- package/src/Form/RadioGroup.svelte +40 -0
- package/src/Form/RichTextField.svelte +36 -0
- package/src/Form/Search.svelte +36 -0
- package/src/Form/Select.svelte +48 -43
- package/src/Form/Slider.svelte +24 -0
- package/src/Form/Stepper.svelte +45 -0
- package/src/Form/TextArea.svelte +29 -44
- package/src/Form/Toggle.svelte +23 -0
- package/src/Icon/Icon.svelte +86 -0
- package/src/IconSideNav/IconSideNav.svelte +14 -0
- package/src/IconSideNav/IconSideNavItem.svelte +56 -0
- package/src/InlineAlert/InlineAlert.svelte +56 -0
- package/src/Label/Label.svelte +20 -0
- package/src/Layout/Layout.svelte +94 -0
- package/src/Layout/Page.svelte +32 -0
- package/src/Link/Link.svelte +22 -0
- package/src/List/Items/DetailSummary.svench +46 -8
- 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 +45 -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 +38 -0
- package/src/Modal/Modal.svelte +142 -0
- package/src/Modal/Modal.svench +117 -0
- package/src/Modal/ModalContent.svelte +190 -0
- package/src/Modal/QuizModal.svelte +54 -0
- 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 +77 -0
- package/src/Popover/Popover.svench +121 -0
- package/src/ProgressBar/ProgressBar.svelte +54 -0
- package/src/ProgressCircle/ProgressCircle.svelte +62 -0
- package/src/SideNavigation/Item.svelte +47 -0
- package/src/SideNavigation/Navigation.svelte +12 -0
- package/src/StatusLight/StatusLight.svelte +64 -0
- package/src/Stores/Notifications.svench.svx +78 -0
- package/src/Stores/banner.js +37 -0
- package/src/Stores/notifications.js +84 -0
- package/src/Table/ArrayRenderer.svelte +17 -0
- package/src/Table/AttachmentRenderer.svelte +60 -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 +631 -0
- package/src/Table/index.js +1 -0
- package/src/Tabs/Tab.svelte +88 -0
- package/src/Tabs/Tabs.svelte +125 -0
- package/src/Tags/Tag.svelte +43 -0
- package/src/Tags/Tags.svelte +7 -0
- package/src/Tooltip/Tooltip.svelte +30 -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/src/bbui.css +96 -0
- package/src/context.js +3 -0
- package/src/helpers.js +134 -0
- package/src/index.js +91 -11
- package/src/spectrum-icons-rollup.js +31 -0
- package/src/spectrum-icons-vite.js +31 -0
- package/dist/bundle.css +0 -7
- package/dist/bundle.css.map +0 -20
- package/dist/index.js +0 -1043
- package/dist/index.mjs +0 -1029
- package/src/Branding/Budibase-logo.svelte +0 -68
- package/src/Branding/Logo.svelte +0 -16
- package/src/Branding/Logo.svench +0 -8
- package/src/Form/Button.svelte +0 -52
- package/src/Form/Button.svench +0 -26
- package/src/Form/Input.svench +0 -8
- package/src/Form/Select.svench +0 -8
- package/src/Form/TextArea.svench +0 -8
- package/src/Links/Home.svelte +0 -49
- package/src/Links/Home.svench +0 -19
- package/src/List/Items/DetailSummary.svelte +0 -68
- package/src/actions/autoresize_textarea.js +0 -14
- package/src/icons/Contribution.svelte +0 -14
- package/src/index.svench.svx +0 -35
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { createEventDispatcher } from "svelte"
|
|
3
|
+
import Multiselect from "./Core/Multiselect.svelte"
|
|
4
|
+
import Field from "./Field.svelte"
|
|
5
|
+
|
|
6
|
+
export let value = []
|
|
7
|
+
export let label = null
|
|
8
|
+
export let disabled = false
|
|
9
|
+
export let readonly = false
|
|
10
|
+
export let labelPosition = "above"
|
|
11
|
+
export let error = null
|
|
12
|
+
export let placeholder = null
|
|
13
|
+
export let options = []
|
|
14
|
+
export let getOptionLabel = option => option
|
|
15
|
+
export let getOptionValue = option => option
|
|
16
|
+
export let sort = false
|
|
17
|
+
|
|
18
|
+
const dispatch = createEventDispatcher()
|
|
19
|
+
const onChange = e => {
|
|
20
|
+
value = e.detail
|
|
21
|
+
dispatch("change", e.detail)
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<Field {label} {labelPosition} {error}>
|
|
26
|
+
<Multiselect
|
|
27
|
+
{error}
|
|
28
|
+
{disabled}
|
|
29
|
+
{readonly}
|
|
30
|
+
{value}
|
|
31
|
+
{options}
|
|
32
|
+
{placeholder}
|
|
33
|
+
{sort}
|
|
34
|
+
{getOptionLabel}
|
|
35
|
+
{getOptionValue}
|
|
36
|
+
on:change={onChange}
|
|
37
|
+
on:click
|
|
38
|
+
/>
|
|
39
|
+
</Field>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Field from "./Field.svelte"
|
|
3
|
+
import RadioGroup from "./Core/RadioGroup.svelte"
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
5
|
+
|
|
6
|
+
export let value = null
|
|
7
|
+
export let label = null
|
|
8
|
+
export let disabled = false
|
|
9
|
+
export let labelPosition = "above"
|
|
10
|
+
export let error = null
|
|
11
|
+
export let options = []
|
|
12
|
+
export let direction = "vertical"
|
|
13
|
+
export let getOptionLabel = option => extractProperty(option, "label")
|
|
14
|
+
export let getOptionValue = option => extractProperty(option, "value")
|
|
15
|
+
|
|
16
|
+
const dispatch = createEventDispatcher()
|
|
17
|
+
const onChange = e => {
|
|
18
|
+
value = e.detail
|
|
19
|
+
dispatch("change", e.detail)
|
|
20
|
+
}
|
|
21
|
+
const extractProperty = (value, property) => {
|
|
22
|
+
if (value && typeof value === "object") {
|
|
23
|
+
return value[property]
|
|
24
|
+
}
|
|
25
|
+
return value
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<Field {label} {labelPosition} {error}>
|
|
30
|
+
<RadioGroup
|
|
31
|
+
{error}
|
|
32
|
+
{disabled}
|
|
33
|
+
{value}
|
|
34
|
+
{options}
|
|
35
|
+
{direction}
|
|
36
|
+
{getOptionLabel}
|
|
37
|
+
{getOptionValue}
|
|
38
|
+
on:change={onChange}
|
|
39
|
+
/>
|
|
40
|
+
</Field>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Field from "./Field.svelte"
|
|
3
|
+
import RichTextField from "./Core/RichTextField.svelte"
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
5
|
+
|
|
6
|
+
export let value = null
|
|
7
|
+
export let label = null
|
|
8
|
+
export let labelPosition = "above"
|
|
9
|
+
export let placeholder = null
|
|
10
|
+
export let disabled = false
|
|
11
|
+
export let error = null
|
|
12
|
+
export let height = null
|
|
13
|
+
export let id = null
|
|
14
|
+
export let fullScreenOffset = null
|
|
15
|
+
export let easyMDEOptions = null
|
|
16
|
+
|
|
17
|
+
const dispatch = createEventDispatcher()
|
|
18
|
+
const onChange = e => {
|
|
19
|
+
value = e.detail
|
|
20
|
+
dispatch("change", e.detail)
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Field {label} {labelPosition} {error}>
|
|
25
|
+
<RichTextField
|
|
26
|
+
{error}
|
|
27
|
+
{disabled}
|
|
28
|
+
{value}
|
|
29
|
+
{placeholder}
|
|
30
|
+
{height}
|
|
31
|
+
{id}
|
|
32
|
+
{fullScreenOffset}
|
|
33
|
+
{easyMDEOptions}
|
|
34
|
+
on:change={onChange}
|
|
35
|
+
/>
|
|
36
|
+
</Field>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Field from "./Field.svelte"
|
|
3
|
+
import Search from "./Core/Search.svelte"
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
5
|
+
|
|
6
|
+
export let value = null
|
|
7
|
+
export let label = null
|
|
8
|
+
export let labelPosition = "above"
|
|
9
|
+
export let placeholder = null
|
|
10
|
+
export let disabled = false
|
|
11
|
+
export let updateOnChange = true
|
|
12
|
+
export let quiet = false
|
|
13
|
+
export let inputRef
|
|
14
|
+
|
|
15
|
+
const dispatch = createEventDispatcher()
|
|
16
|
+
const onChange = e => {
|
|
17
|
+
value = e.detail
|
|
18
|
+
dispatch("change", e.detail)
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Field {label} {labelPosition}>
|
|
23
|
+
<Search
|
|
24
|
+
{updateOnChange}
|
|
25
|
+
{disabled}
|
|
26
|
+
{value}
|
|
27
|
+
{placeholder}
|
|
28
|
+
{quiet}
|
|
29
|
+
bind:inputRef
|
|
30
|
+
on:change={onChange}
|
|
31
|
+
on:click
|
|
32
|
+
on:input
|
|
33
|
+
on:focus
|
|
34
|
+
on:blur
|
|
35
|
+
/>
|
|
36
|
+
</Field>
|
package/src/Form/Select.svelte
CHANGED
|
@@ -1,50 +1,55 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
placeholder,
|
|
6
|
-
validator = () => {};
|
|
7
|
-
</script>
|
|
2
|
+
import Field from "./Field.svelte"
|
|
3
|
+
import Select from "./Core/Select.svelte"
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
export let value = null
|
|
7
|
+
export let label = undefined
|
|
8
|
+
export let disabled = false
|
|
9
|
+
export let readonly = false
|
|
10
|
+
export let labelPosition = "above"
|
|
11
|
+
export let error = null
|
|
12
|
+
export let placeholder = "Choose an option"
|
|
13
|
+
export let options = []
|
|
14
|
+
export let getOptionLabel = option => extractProperty(option, "label")
|
|
15
|
+
export let getOptionValue = option => extractProperty(option, "value")
|
|
16
|
+
export let getOptionIcon = option => option?.icon
|
|
17
|
+
export let getOptionColour = option => option?.colour
|
|
18
|
+
export let quiet = false
|
|
19
|
+
export let autoWidth = false
|
|
20
|
+
export let sort = false
|
|
21
|
+
export let tooltip = ""
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
const dispatch = createEventDispatcher()
|
|
24
|
+
const onChange = e => {
|
|
25
|
+
value = e.detail
|
|
26
|
+
dispatch("change", e.detail)
|
|
21
27
|
}
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
border: solid 1px var(--grey-medium);
|
|
29
|
-
padding: 20px;
|
|
30
|
-
margin: 0;
|
|
31
|
-
background-color: white;
|
|
29
|
+
const extractProperty = (value, property) => {
|
|
30
|
+
if (value && typeof value === "object") {
|
|
31
|
+
return value[property]
|
|
32
|
+
}
|
|
33
|
+
return value
|
|
32
34
|
}
|
|
35
|
+
</script>
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
<Field {label} {labelPosition} {error} {tooltip}>
|
|
38
|
+
<Select
|
|
39
|
+
{quiet}
|
|
40
|
+
{error}
|
|
41
|
+
{disabled}
|
|
42
|
+
{readonly}
|
|
43
|
+
{value}
|
|
44
|
+
{options}
|
|
45
|
+
{placeholder}
|
|
46
|
+
{autoWidth}
|
|
47
|
+
{sort}
|
|
48
|
+
{getOptionLabel}
|
|
49
|
+
{getOptionValue}
|
|
50
|
+
{getOptionIcon}
|
|
51
|
+
{getOptionColour}
|
|
52
|
+
on:change={onChange}
|
|
53
|
+
on:click
|
|
54
|
+
/>
|
|
55
|
+
</Field>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Field from "./Field.svelte"
|
|
3
|
+
import Slider from "./Core/Slider.svelte"
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
5
|
+
|
|
6
|
+
export let value = null
|
|
7
|
+
export let label = null
|
|
8
|
+
export let labelPosition = "above"
|
|
9
|
+
export let min = 0
|
|
10
|
+
export let max = 100
|
|
11
|
+
export let step = 1
|
|
12
|
+
export let disabled = false
|
|
13
|
+
export let error = null
|
|
14
|
+
|
|
15
|
+
const dispatch = createEventDispatcher()
|
|
16
|
+
const onChange = e => {
|
|
17
|
+
value = e.detail
|
|
18
|
+
dispatch("change", e.detail)
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Field {label} {labelPosition} {error}>
|
|
23
|
+
<Slider {disabled} {value} {min} {max} {step} on:change={onChange} />
|
|
24
|
+
</Field>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Field from "./Field.svelte"
|
|
3
|
+
import Stepper from "./Core/Stepper.svelte"
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
5
|
+
|
|
6
|
+
export let value = null
|
|
7
|
+
export let label = null
|
|
8
|
+
export let labelPosition = "above"
|
|
9
|
+
export let placeholder = null
|
|
10
|
+
export let disabled = false
|
|
11
|
+
export let readonly = false
|
|
12
|
+
export let error = null
|
|
13
|
+
export let updateOnChange = true
|
|
14
|
+
export let quiet = false
|
|
15
|
+
export let min = null
|
|
16
|
+
export let max = null
|
|
17
|
+
export let step = 1
|
|
18
|
+
|
|
19
|
+
const dispatch = createEventDispatcher()
|
|
20
|
+
const onChange = e => {
|
|
21
|
+
value = e.detail
|
|
22
|
+
dispatch("change", e.detail)
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<Field {label} {labelPosition} {error}>
|
|
27
|
+
<Stepper
|
|
28
|
+
{updateOnChange}
|
|
29
|
+
{error}
|
|
30
|
+
{disabled}
|
|
31
|
+
{readonly}
|
|
32
|
+
{value}
|
|
33
|
+
{placeholder}
|
|
34
|
+
{quiet}
|
|
35
|
+
{min}
|
|
36
|
+
{max}
|
|
37
|
+
{step}
|
|
38
|
+
on:change={onChange}
|
|
39
|
+
on:click
|
|
40
|
+
on:input
|
|
41
|
+
on:blur
|
|
42
|
+
on:focus
|
|
43
|
+
on:keyup
|
|
44
|
+
/>
|
|
45
|
+
</Field>
|
package/src/Form/TextArea.svelte
CHANGED
|
@@ -1,49 +1,34 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value,
|
|
6
|
-
placeholder,
|
|
7
|
-
validator = () => {};
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<style>
|
|
11
|
-
.container {
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
font-size: 18px;
|
|
15
|
-
font-weight: 500;
|
|
16
|
-
line-height: 1.17;
|
|
17
|
-
}
|
|
2
|
+
import Field from "./Field.svelte"
|
|
3
|
+
import TextArea from "./Core/TextArea.svelte"
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
18
5
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
border: solid 1px var(--grey-medium);
|
|
29
|
-
padding: 20px;
|
|
30
|
-
margin: 0;
|
|
31
|
-
}
|
|
6
|
+
export let value = null
|
|
7
|
+
export let label = null
|
|
8
|
+
export let labelPosition = "above"
|
|
9
|
+
export let placeholder = null
|
|
10
|
+
export let disabled = false
|
|
11
|
+
export let error = null
|
|
12
|
+
export let getCaretPosition = null
|
|
13
|
+
export let height = null
|
|
14
|
+
export let minHeight = null
|
|
32
15
|
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
const dispatch = createEventDispatcher()
|
|
17
|
+
const onChange = e => {
|
|
18
|
+
value = e.detail
|
|
19
|
+
dispatch("change", e.detail)
|
|
35
20
|
}
|
|
21
|
+
</script>
|
|
36
22
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</div>
|
|
23
|
+
<Field {label} {labelPosition} {error}>
|
|
24
|
+
<TextArea
|
|
25
|
+
bind:getCaretPosition
|
|
26
|
+
{error}
|
|
27
|
+
{disabled}
|
|
28
|
+
{value}
|
|
29
|
+
{placeholder}
|
|
30
|
+
{height}
|
|
31
|
+
{minHeight}
|
|
32
|
+
on:change={onChange}
|
|
33
|
+
/>
|
|
34
|
+
</Field>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Field from "./Field.svelte"
|
|
3
|
+
import Switch from "./Core/Switch.svelte"
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
5
|
+
|
|
6
|
+
export let value = null
|
|
7
|
+
export let label = null
|
|
8
|
+
export let labelPosition = "above"
|
|
9
|
+
export let text = null
|
|
10
|
+
export let disabled = false
|
|
11
|
+
export let error = null
|
|
12
|
+
export let dataCy = null
|
|
13
|
+
|
|
14
|
+
const dispatch = createEventDispatcher()
|
|
15
|
+
const onChange = e => {
|
|
16
|
+
value = e.detail
|
|
17
|
+
dispatch("change", e.detail)
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Field {label} {labelPosition} {error}>
|
|
22
|
+
<Switch {dataCy} {error} {disabled} {text} {value} on:change={onChange} />
|
|
23
|
+
</Field>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
export const directions = ["n", "ne", "e", "se", "s", "sw", "w", "nw"]
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import Tooltip from "../Tooltip/Tooltip.svelte"
|
|
7
|
+
import { fade } from "svelte/transition"
|
|
8
|
+
|
|
9
|
+
export let direction = "n"
|
|
10
|
+
export let name = "Add"
|
|
11
|
+
export let hidden = false
|
|
12
|
+
export let size = "M"
|
|
13
|
+
export let hoverable = false
|
|
14
|
+
export let disabled = false
|
|
15
|
+
export let color
|
|
16
|
+
export let tooltip
|
|
17
|
+
|
|
18
|
+
$: rotation = getRotation(direction)
|
|
19
|
+
|
|
20
|
+
let showTooltip = false
|
|
21
|
+
|
|
22
|
+
const getRotation = direction => {
|
|
23
|
+
return directions.indexOf(direction) * 45
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<div
|
|
28
|
+
class="icon"
|
|
29
|
+
on:mouseover={() => (showTooltip = true)}
|
|
30
|
+
on:focus={() => (showTooltip = true)}
|
|
31
|
+
on:mouseleave={() => (showTooltip = false)}
|
|
32
|
+
on:click={() => (showTooltip = false)}
|
|
33
|
+
>
|
|
34
|
+
<svg
|
|
35
|
+
on:click
|
|
36
|
+
class:hoverable
|
|
37
|
+
class:disabled
|
|
38
|
+
class="spectrum-Icon spectrum-Icon--size{size}"
|
|
39
|
+
focusable="false"
|
|
40
|
+
aria-hidden={hidden}
|
|
41
|
+
aria-label={name}
|
|
42
|
+
style={`transform: rotate(${rotation}deg); ${
|
|
43
|
+
color ? `color: ${color};` : ""
|
|
44
|
+
}`}
|
|
45
|
+
>
|
|
46
|
+
<use style="pointer-events: none;" xlink:href="#spectrum-icon-18-{name}" />
|
|
47
|
+
</svg>
|
|
48
|
+
{#if tooltip && showTooltip}
|
|
49
|
+
<div class="tooltip" in:fade={{ duration: 130, delay: 250 }}>
|
|
50
|
+
<Tooltip textWrapping direction="bottom" text={tooltip} />
|
|
51
|
+
</div>
|
|
52
|
+
{/if}
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
.icon {
|
|
57
|
+
position: relative;
|
|
58
|
+
display: grid;
|
|
59
|
+
place-items: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
svg.hoverable {
|
|
63
|
+
pointer-events: all;
|
|
64
|
+
transition: color var(--spectrum-global-animation-duration-100, 130ms);
|
|
65
|
+
}
|
|
66
|
+
svg.hoverable:hover {
|
|
67
|
+
color: var(--spectrum-alias-icon-color-selected-hover);
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
svg.disabled {
|
|
72
|
+
color: var(--spectrum-global-color-gray-500) !important;
|
|
73
|
+
pointer-events: none !important;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.tooltip {
|
|
77
|
+
position: absolute;
|
|
78
|
+
pointer-events: none;
|
|
79
|
+
left: 50%;
|
|
80
|
+
top: calc(100% + 4px);
|
|
81
|
+
width: 100vw;
|
|
82
|
+
max-width: 150px;
|
|
83
|
+
transform: translateX(-50%);
|
|
84
|
+
text-align: center;
|
|
85
|
+
}
|
|
86
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Icon from "../Icon/Icon.svelte"
|
|
3
|
+
import Tooltip from "../Tooltip/Tooltip.svelte"
|
|
4
|
+
import { fade } from "svelte/transition"
|
|
5
|
+
|
|
6
|
+
export let icon
|
|
7
|
+
export let active = false
|
|
8
|
+
export let tooltip
|
|
9
|
+
|
|
10
|
+
let showTooltip = false
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
class="icon-side-nav-item"
|
|
15
|
+
class:active
|
|
16
|
+
on:mouseover={() => (showTooltip = true)}
|
|
17
|
+
on:focus={() => (showTooltip = true)}
|
|
18
|
+
on:mouseleave={() => (showTooltip = false)}
|
|
19
|
+
on:click
|
|
20
|
+
>
|
|
21
|
+
<Icon name={icon} hoverable />
|
|
22
|
+
{#if tooltip && showTooltip}
|
|
23
|
+
<div class="tooltip" in:fade={{ duration: 130, delay: 250 }}>
|
|
24
|
+
<Tooltip textWrapping direction="right" text={tooltip} />
|
|
25
|
+
</div>
|
|
26
|
+
{/if}
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<style>
|
|
30
|
+
.icon-side-nav-item {
|
|
31
|
+
width: 36px;
|
|
32
|
+
height: 36px;
|
|
33
|
+
display: grid;
|
|
34
|
+
place-items: center;
|
|
35
|
+
border-radius: 4px;
|
|
36
|
+
position: relative;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
transition: background 130ms ease-out;
|
|
39
|
+
}
|
|
40
|
+
.icon-side-nav-item:hover :global(svg),
|
|
41
|
+
.active :global(svg) {
|
|
42
|
+
color: var(--spectrum-global-color-gray-900);
|
|
43
|
+
}
|
|
44
|
+
.active {
|
|
45
|
+
background: var(--spectrum-global-color-gray-300);
|
|
46
|
+
}
|
|
47
|
+
.tooltip {
|
|
48
|
+
position: absolute;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
left: calc(100% - 4px);
|
|
51
|
+
top: 50%;
|
|
52
|
+
white-space: nowrap;
|
|
53
|
+
transform: translateY(-50%);
|
|
54
|
+
z-index: 1;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/inlinealert/dist/index-vars.css"
|
|
3
|
+
import Button from "../Button/Button.svelte"
|
|
4
|
+
|
|
5
|
+
export let type = "info"
|
|
6
|
+
export let header = ""
|
|
7
|
+
export let message = ""
|
|
8
|
+
export let onConfirm = undefined
|
|
9
|
+
|
|
10
|
+
$: icon = selectIcon(type)
|
|
11
|
+
// if newlines used, convert them to different elements
|
|
12
|
+
$: split = message.split("\n")
|
|
13
|
+
|
|
14
|
+
function selectIcon(alertType) {
|
|
15
|
+
switch (alertType) {
|
|
16
|
+
case "error":
|
|
17
|
+
case "negative":
|
|
18
|
+
return "Alert"
|
|
19
|
+
case "success":
|
|
20
|
+
return "CheckmarkCircle"
|
|
21
|
+
case "help":
|
|
22
|
+
return "Help"
|
|
23
|
+
default:
|
|
24
|
+
return "Info"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<div class="spectrum-InLineAlert spectrum-InLineAlert--{type}">
|
|
30
|
+
<svg
|
|
31
|
+
class="spectrum-Icon spectrum-Icon--sizeM spectrum-InLineAlert-icon"
|
|
32
|
+
focusable="false"
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
>
|
|
35
|
+
<use xlink:href="#spectrum-icon-18-{icon}" />
|
|
36
|
+
</svg>
|
|
37
|
+
<div class="spectrum-InLineAlert-header">{header}</div>
|
|
38
|
+
{#each split as splitMsg}
|
|
39
|
+
<div class="spectrum-InLineAlert-content">{splitMsg}</div>
|
|
40
|
+
{/each}
|
|
41
|
+
{#if onConfirm}
|
|
42
|
+
<div class="spectrum-InLineAlert-footer">
|
|
43
|
+
<Button secondary on:click={onConfirm}>OK</Button>
|
|
44
|
+
</div>
|
|
45
|
+
{/if}
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<style>
|
|
49
|
+
.spectrum-InLineAlert {
|
|
50
|
+
--spectrum-semantic-negative-border-color: #e34850;
|
|
51
|
+
--spectrum-semantic-positive-border-color: #2d9d78;
|
|
52
|
+
--spectrum-semantic-positive-icon-color: #2d9d78;
|
|
53
|
+
--spectrum-semantic-negative-icon-color: #e34850;
|
|
54
|
+
min-width: 100px;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/fieldlabel/dist/index-vars.css"
|
|
3
|
+
import TooltipWrapper from "../Tooltip/TooltipWrapper.svelte"
|
|
4
|
+
|
|
5
|
+
export let size = "M"
|
|
6
|
+
export let tooltip = ""
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<TooltipWrapper {tooltip} {size}>
|
|
10
|
+
<label for="" class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}>
|
|
11
|
+
<slot />
|
|
12
|
+
</label>
|
|
13
|
+
</TooltipWrapper>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
label {
|
|
17
|
+
padding: 0;
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
}
|
|
20
|
+
</style>
|