@budibase/bbui 1.0.0 → 1.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 +19 -17
- package/dist/bbui.es.js +2 -0
- package/dist/bbui.es.js.map +1 -0
- package/package.json +68 -26
- package/src/ActionButton/ActionButton.svelte +83 -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 +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/Button/Button.svelte +52 -0
- package/src/Button/Button.svench +138 -0
- package/src/ButtonGroup/ButtonGroup.svelte +19 -0
- package/src/ClearButton/ClearButton.svelte +19 -0
- package/src/ColorPicker/ColorPicker.svelte +292 -0
- package/src/DetailSummary/DetailSummary.svelte +83 -0
- package/src/Divider/Divider.svelte +25 -0
- package/src/Drawer/Drawer.svelte +85 -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 +44 -0
- package/src/Form/Core/Checkbox.svelte +67 -0
- package/src/Form/Core/Combobox.svelte +156 -0
- package/src/Form/Core/DatePicker.svelte +183 -0
- package/src/Form/Core/Dropzone.svelte +393 -0
- package/src/Form/Core/Multiselect.svelte +88 -0
- package/src/Form/Core/Picker.svelte +241 -0
- package/src/Form/Core/RadioGroup.svelte +47 -0
- package/src/Form/Core/Search.svelte +101 -0
- package/src/Form/Core/Select.svelte +81 -0
- package/src/Form/Core/Stepper.svelte +172 -0
- package/src/Form/Core/Switch.svelte +35 -0
- package/src/Form/Core/TextArea.svelte +60 -0
- package/src/Form/Core/TextField.svelte +104 -0
- package/src/Form/Core/index.js +12 -0
- package/src/Form/DatePicker.svelte +33 -0
- package/src/Form/Dropzone.svelte +34 -0
- package/src/Form/Field.svelte +41 -0
- package/src/Form/FieldLabel.svelte +27 -0
- package/src/Form/Input.svelte +38 -45
- package/src/Form/Multiselect.svelte +39 -0
- package/src/Form/RadioGroup.svelte +38 -0
- package/src/Form/Search.svelte +32 -0
- package/src/Form/Select.svelte +45 -43
- package/src/Form/Stepper.svelte +45 -0
- package/src/Form/TextArea.svelte +25 -44
- package/src/Form/Toggle.svelte +23 -0
- package/src/Icon/Icon.svelte +47 -0
- package/src/InlineAlert/InlineAlert.svelte +56 -0
- package/src/Label/Label.svelte +67 -0
- package/src/Layout/Layout.svelte +75 -0
- package/src/Layout/Page.svelte +25 -0
- package/src/Link/Link.svelte +22 -0
- package/src/List/Items/DetailSummary.svench +53 -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 +133 -0
- package/src/Modal/Modal.svench +117 -0
- package/src/Modal/ModalContent.svelte +139 -0
- package/src/Modal/QuizModal.svelte +54 -0
- package/src/Notification/Notification.svelte +20 -0
- package/src/Notification/NotificationDisplay.svelte +36 -0
- package/src/Pagination/Pagination.svelte +57 -0
- package/src/Popover/Popover.svelte +52 -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 +45 -0
- package/src/SideNavigation/Navigation.svelte +12 -0
- package/src/StatusLight/StatusLight.svelte +41 -0
- package/src/Stores/Notifications.svench.svx +78 -0
- package/src/Stores/notifications.js +56 -0
- package/src/Table/ArrayRenderer.svelte +17 -0
- package/src/Table/AttachmentRenderer.svelte +55 -0
- package/src/Table/BooleanRenderer.svelte +42 -0
- package/src/Table/CellRenderer.svelte +37 -0
- package/src/Table/DateTimeRenderer.svelte +13 -0
- package/src/Table/InternalRenderer.svelte +28 -0
- package/src/Table/RelationshipRenderer.svelte +40 -0
- package/src/Table/SelectEditRenderer.svelte +16 -0
- package/src/Table/StringRenderer.svelte +13 -0
- package/src/Table/Table.svelte +506 -0
- package/src/Table/index.js +1 -0
- package/src/Tabs/Tab.svelte +66 -0
- package/src/Tabs/Tabs.svelte +105 -0
- package/src/Tags/Tag.svelte +43 -0
- package/src/Tags/Tags.svelte +7 -0
- package/src/Tooltip/Tooltip.svelte +24 -0
- package/src/TreeView/Item.svelte +41 -0
- package/src/TreeView/Tree.svelte +16 -0
- package/src/Typography/Body.svelte +19 -0
- package/src/Typography/Code.svelte +10 -0
- package/src/Typography/Detail.svelte +15 -0
- package/src/Typography/Heading.svelte +16 -0
- package/src/bbui.css +96 -0
- package/src/context.js +3 -0
- package/src/index.js +75 -10
- package/src/spectrum-icons-rollup.js +31 -0
- package/src/spectrum-icons-vite.js +31 -0
- package/src/utils/helpers.js +8 -0
- package/dist/bundle.css +0 -6
- package/dist/bundle.css.map +0 -18
- package/dist/index.js +0 -919
- package/dist/index.mjs +0 -906
- 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/actions/autoresize_textarea.js +0 -14
- package/src/icons/Contribution.svelte +0 -14
- package/src/index.svench.svx +0 -35
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/fieldlabel/dist/index-vars.css"
|
|
3
|
+
import FieldLabel from "./FieldLabel.svelte"
|
|
4
|
+
|
|
5
|
+
export let id = null
|
|
6
|
+
export let label = null
|
|
7
|
+
export let labelPosition = "above"
|
|
8
|
+
export let error = null
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div class="spectrum-Form-item" class:above={labelPosition === "above"}>
|
|
12
|
+
{#if label}
|
|
13
|
+
<FieldLabel forId={id} {label} position={labelPosition} />
|
|
14
|
+
{/if}
|
|
15
|
+
<div class="spectrum-Form-itemField">
|
|
16
|
+
<slot />
|
|
17
|
+
{#if error}
|
|
18
|
+
<div class="error">{error}</div>
|
|
19
|
+
{/if}
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<style>
|
|
24
|
+
.spectrum-Form-item.above {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
}
|
|
28
|
+
.spectrum-Form-itemField {
|
|
29
|
+
position: relative;
|
|
30
|
+
width: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.error {
|
|
34
|
+
color: var(
|
|
35
|
+
--spectrum-semantic-negative-color-default,
|
|
36
|
+
var(--spectrum-global-color-red-500)
|
|
37
|
+
);
|
|
38
|
+
font-size: var(--spectrum-global-dimension-font-size-75);
|
|
39
|
+
margin-top: var(--spectrum-global-dimension-size-75);
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/fieldlabel/dist/index-vars.css"
|
|
3
|
+
|
|
4
|
+
export let forId
|
|
5
|
+
export let label
|
|
6
|
+
export let position = "above"
|
|
7
|
+
|
|
8
|
+
$: className = position === "above" ? "" : `spectrum-FieldLabel--${position}`
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<label
|
|
12
|
+
for={forId}
|
|
13
|
+
class={`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${className}`}
|
|
14
|
+
>
|
|
15
|
+
{label || ""}
|
|
16
|
+
</label>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
label {
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.spectrum-FieldLabel--right,
|
|
24
|
+
.spectrum-FieldLabel--left {
|
|
25
|
+
padding-right: var(--spectrum-global-dimension-size-200);
|
|
26
|
+
}
|
|
27
|
+
</style>
|
package/src/Form/Input.svelte
CHANGED
|
@@ -1,50 +1,43 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
placeholder,
|
|
6
|
-
validator = () => {};
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<style>
|
|
10
|
-
.container {
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
font-size: 18px;
|
|
14
|
-
font-weight: 500;
|
|
15
|
-
line-height: 1.17;
|
|
16
|
-
}
|
|
2
|
+
import Field from "./Field.svelte"
|
|
3
|
+
import TextField from "./Core/TextField.svelte"
|
|
4
|
+
import { createEventDispatcher } from "svelte"
|
|
17
5
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
padding: 20px;
|
|
30
|
-
margin: 0;
|
|
31
|
-
background-color: white;
|
|
32
|
-
}
|
|
6
|
+
export let value = null
|
|
7
|
+
export let label = null
|
|
8
|
+
export let labelPosition = "above"
|
|
9
|
+
export let placeholder = null
|
|
10
|
+
export let type = "text"
|
|
11
|
+
export let disabled = false
|
|
12
|
+
export let readonly = false
|
|
13
|
+
export let error = null
|
|
14
|
+
export let updateOnChange = true
|
|
15
|
+
export let quiet = false
|
|
16
|
+
export let dataCy
|
|
33
17
|
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
const dispatch = createEventDispatcher()
|
|
19
|
+
const onChange = e => {
|
|
20
|
+
value = e.detail
|
|
21
|
+
dispatch("change", e.detail)
|
|
36
22
|
}
|
|
23
|
+
</script>
|
|
37
24
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
25
|
+
<Field {label} {labelPosition} {error}>
|
|
26
|
+
<TextField
|
|
27
|
+
{dataCy}
|
|
28
|
+
{updateOnChange}
|
|
29
|
+
{error}
|
|
30
|
+
{disabled}
|
|
31
|
+
{readonly}
|
|
32
|
+
{value}
|
|
33
|
+
{placeholder}
|
|
34
|
+
{type}
|
|
35
|
+
{quiet}
|
|
36
|
+
on:change={onChange}
|
|
37
|
+
on:click
|
|
38
|
+
on:input
|
|
39
|
+
on:blur
|
|
40
|
+
on:focus
|
|
41
|
+
on:keyup
|
|
42
|
+
/>
|
|
43
|
+
</Field>
|
|
@@ -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,38 @@
|
|
|
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 getOptionLabel = option => extractProperty(option, "label")
|
|
13
|
+
export let getOptionValue = option => extractProperty(option, "value")
|
|
14
|
+
|
|
15
|
+
const dispatch = createEventDispatcher()
|
|
16
|
+
const onChange = e => {
|
|
17
|
+
value = e.detail
|
|
18
|
+
dispatch("change", e.detail)
|
|
19
|
+
}
|
|
20
|
+
const extractProperty = (value, property) => {
|
|
21
|
+
if (value && typeof value === "object") {
|
|
22
|
+
return value[property]
|
|
23
|
+
}
|
|
24
|
+
return value
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<Field {label} {labelPosition} {error}>
|
|
29
|
+
<RadioGroup
|
|
30
|
+
{error}
|
|
31
|
+
{disabled}
|
|
32
|
+
{value}
|
|
33
|
+
{options}
|
|
34
|
+
{getOptionLabel}
|
|
35
|
+
{getOptionValue}
|
|
36
|
+
on:change={onChange}
|
|
37
|
+
/>
|
|
38
|
+
</Field>
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
|
|
13
|
+
const dispatch = createEventDispatcher()
|
|
14
|
+
const onChange = e => {
|
|
15
|
+
value = e.detail
|
|
16
|
+
dispatch("change", e.detail)
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Field {label} {labelPosition}>
|
|
21
|
+
<Search
|
|
22
|
+
{updateOnChange}
|
|
23
|
+
{disabled}
|
|
24
|
+
{value}
|
|
25
|
+
{placeholder}
|
|
26
|
+
on:change={onChange}
|
|
27
|
+
on:click
|
|
28
|
+
on:input
|
|
29
|
+
on:focus
|
|
30
|
+
on:blur
|
|
31
|
+
/>
|
|
32
|
+
</Field>
|
package/src/Form/Select.svelte
CHANGED
|
@@ -1,50 +1,52 @@
|
|
|
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 quiet = false
|
|
18
|
+
export let autoWidth = false
|
|
19
|
+
export let sort = false
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
const dispatch = createEventDispatcher()
|
|
22
|
+
const onChange = e => {
|
|
23
|
+
value = e.detail
|
|
24
|
+
dispatch("change", e.detail)
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
border: solid 1px var(--grey-medium);
|
|
29
|
-
padding: 20px;
|
|
30
|
-
margin: 0;
|
|
31
|
-
background-color: white;
|
|
27
|
+
const extractProperty = (value, property) => {
|
|
28
|
+
if (value && typeof value === "object") {
|
|
29
|
+
return value[property]
|
|
30
|
+
}
|
|
31
|
+
return value
|
|
32
32
|
}
|
|
33
|
+
</script>
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
<Field {label} {labelPosition} {error}>
|
|
36
|
+
<Select
|
|
37
|
+
{quiet}
|
|
38
|
+
{error}
|
|
39
|
+
{disabled}
|
|
40
|
+
{readonly}
|
|
41
|
+
{value}
|
|
42
|
+
{options}
|
|
43
|
+
{placeholder}
|
|
44
|
+
{autoWidth}
|
|
45
|
+
{sort}
|
|
46
|
+
{getOptionLabel}
|
|
47
|
+
{getOptionValue}
|
|
48
|
+
{getOptionIcon}
|
|
49
|
+
on:change={onChange}
|
|
50
|
+
on:click
|
|
51
|
+
/>
|
|
52
|
+
</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,30 @@
|
|
|
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
|
-
font-size: 18px;
|
|
27
|
-
border-radius: 3px;
|
|
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
|
|
32
13
|
|
|
33
|
-
|
|
34
|
-
|
|
14
|
+
const dispatch = createEventDispatcher()
|
|
15
|
+
const onChange = e => {
|
|
16
|
+
value = e.detail
|
|
17
|
+
dispatch("change", e.detail)
|
|
35
18
|
}
|
|
19
|
+
</script>
|
|
36
20
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<label for={name}>{label}</label>
|
|
48
|
-
<textarea bind:value {placeholder} {name} use:text_area_resize />
|
|
49
|
-
</div>
|
|
21
|
+
<Field {label} {labelPosition} {error}>
|
|
22
|
+
<TextArea
|
|
23
|
+
bind:getCaretPosition
|
|
24
|
+
{error}
|
|
25
|
+
{disabled}
|
|
26
|
+
{value}
|
|
27
|
+
{placeholder}
|
|
28
|
+
on:change={onChange}
|
|
29
|
+
/>
|
|
30
|
+
</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,47 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
export const directions = ["n", "ne", "e", "se", "s", "sw", "w", "nw"]
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export let direction = "n"
|
|
7
|
+
export let name = "Add"
|
|
8
|
+
export let hidden = false
|
|
9
|
+
export let size = "M"
|
|
10
|
+
export let hoverable = false
|
|
11
|
+
export let disabled = false
|
|
12
|
+
|
|
13
|
+
$: rotation = getRotation(direction)
|
|
14
|
+
|
|
15
|
+
const getRotation = direction => {
|
|
16
|
+
return directions.indexOf(direction) * 45
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<svg
|
|
21
|
+
on:click
|
|
22
|
+
class:hoverable
|
|
23
|
+
class:disabled
|
|
24
|
+
class="spectrum-Icon spectrum-Icon--size{size}"
|
|
25
|
+
focusable="false"
|
|
26
|
+
aria-hidden={hidden}
|
|
27
|
+
aria-label={name}
|
|
28
|
+
style={`transform: rotate(${rotation}deg)`}
|
|
29
|
+
>
|
|
30
|
+
<use xlink:href="#spectrum-icon-18-{name}" />
|
|
31
|
+
</svg>
|
|
32
|
+
|
|
33
|
+
<style>
|
|
34
|
+
svg.hoverable {
|
|
35
|
+
pointer-events: all;
|
|
36
|
+
transition: color var(--spectrum-global-animation-duration-100, 130ms);
|
|
37
|
+
}
|
|
38
|
+
svg.hoverable:hover {
|
|
39
|
+
color: var(--spectrum-alias-icon-color-selected-hover);
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
svg.disabled {
|
|
44
|
+
color: var(--spectrum-global-color-gray-500) !important;
|
|
45
|
+
pointer-events: none !important;
|
|
46
|
+
}
|
|
47
|
+
</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,67 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/fieldlabel/dist/index-vars.css"
|
|
3
|
+
import Tooltip from "../Tooltip/Tooltip.svelte"
|
|
4
|
+
import Icon from "../Icon/Icon.svelte"
|
|
5
|
+
|
|
6
|
+
export let size = "M"
|
|
7
|
+
export let tooltip = ""
|
|
8
|
+
export let showTooltip = false
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
{#if tooltip}
|
|
12
|
+
<div class="container">
|
|
13
|
+
<label
|
|
14
|
+
for=""
|
|
15
|
+
class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</label>
|
|
19
|
+
<div class="icon-container">
|
|
20
|
+
<div
|
|
21
|
+
class="icon"
|
|
22
|
+
on:mouseover={() => (showTooltip = true)}
|
|
23
|
+
on:mouseleave={() => (showTooltip = false)}
|
|
24
|
+
>
|
|
25
|
+
<Icon name="InfoOutline" size="S" disabled={true} />
|
|
26
|
+
</div>
|
|
27
|
+
{#if showTooltip}
|
|
28
|
+
<div class="tooltip">
|
|
29
|
+
<Tooltip textWrapping={true} direction={"bottom"} text={tooltip} />
|
|
30
|
+
</div>
|
|
31
|
+
{/if}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
{:else}
|
|
35
|
+
<label for="" class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}>
|
|
36
|
+
<slot />
|
|
37
|
+
</label>
|
|
38
|
+
{/if}
|
|
39
|
+
|
|
40
|
+
<style>
|
|
41
|
+
label {
|
|
42
|
+
padding: 0;
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
}
|
|
45
|
+
.container {
|
|
46
|
+
display: flex;
|
|
47
|
+
}
|
|
48
|
+
.icon-container {
|
|
49
|
+
position: relative;
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
margin-top: 1px;
|
|
53
|
+
margin-left: 5px;
|
|
54
|
+
margin-right: 5px;
|
|
55
|
+
}
|
|
56
|
+
.tooltip {
|
|
57
|
+
position: absolute;
|
|
58
|
+
display: flex;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
top: 15px;
|
|
61
|
+
z-index: 1;
|
|
62
|
+
width: 160px;
|
|
63
|
+
}
|
|
64
|
+
.icon {
|
|
65
|
+
transform: scale(0.75);
|
|
66
|
+
}
|
|
67
|
+
</style>
|