@budibase/bbui 1.0.220-alpha.2 → 1.0.221
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bbui.es.js +35 -35
- package/dist/bbui.es.js.map +1 -1
- package/package.json +5 -4
- package/src/ActionButton/ActionButton.svelte +6 -0
- package/src/Banner/Banner.svelte +22 -16
- package/src/Divider/Divider.svelte +3 -0
- package/src/Drawer/Drawer.svelte +8 -3
- package/src/Form/Core/Picker.svelte +28 -15
- package/src/Form/Core/Search.svelte +3 -0
- package/src/Form/Core/Select.svelte +14 -19
- package/src/Form/Core/Slider.svelte +86 -0
- package/src/Form/Core/index.js +1 -0
- package/src/Form/Search.svelte +2 -0
- package/src/Form/Select.svelte +2 -0
- package/src/Form/Slider.svelte +24 -0
- package/src/Icon/Icon.svelte +1 -1
- package/src/IconSideNav/IconSideNav.svelte +14 -0
- package/src/IconSideNav/IconSideNavItem.svelte +56 -0
- package/src/Notification/NotificationDisplay.svelte +2 -2
- package/src/StatusLight/StatusLight.svelte +23 -0
- package/src/Tabs/Tab.svelte +6 -0
- package/src/Tabs/Tabs.svelte +15 -18
- package/src/Tooltip/Tooltip.svelte +7 -1
- package/src/index.js +3 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/bbui",
|
|
3
3
|
"description": "A UI solution used in the different Budibase projects.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.221",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"svelte": "src/index.js",
|
|
7
7
|
"module": "dist/bbui.es.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
|
|
41
|
-
"@budibase/string-templates": "^1.0.
|
|
41
|
+
"@budibase/string-templates": "^1.0.221",
|
|
42
42
|
"@spectrum-css/actionbutton": "^1.0.1",
|
|
43
43
|
"@spectrum-css/actiongroup": "^1.0.1",
|
|
44
44
|
"@spectrum-css/avatar": "^3.0.2",
|
|
@@ -66,11 +66,12 @@
|
|
|
66
66
|
"@spectrum-css/radio": "^3.0.2",
|
|
67
67
|
"@spectrum-css/search": "^3.0.2",
|
|
68
68
|
"@spectrum-css/sidenav": "^3.0.2",
|
|
69
|
+
"@spectrum-css/slider": "3.0.1",
|
|
69
70
|
"@spectrum-css/statuslight": "^3.0.2",
|
|
70
71
|
"@spectrum-css/stepper": "^3.0.3",
|
|
71
72
|
"@spectrum-css/switch": "^1.0.2",
|
|
72
73
|
"@spectrum-css/table": "^3.0.1",
|
|
73
|
-
"@spectrum-css/tabs": "^3.
|
|
74
|
+
"@spectrum-css/tabs": "^3.2.12",
|
|
74
75
|
"@spectrum-css/tags": "^3.0.2",
|
|
75
76
|
"@spectrum-css/textfield": "^3.0.1",
|
|
76
77
|
"@spectrum-css/toast": "^3.0.1",
|
|
@@ -84,5 +85,5 @@
|
|
|
84
85
|
"svelte-flatpickr": "^3.2.3",
|
|
85
86
|
"svelte-portal": "^1.0.0"
|
|
86
87
|
},
|
|
87
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "4e1904bba3bbec3d6f36827ecd012827b5e76cd8"
|
|
88
89
|
}
|
|
@@ -82,6 +82,12 @@
|
|
|
82
82
|
.active svg {
|
|
83
83
|
color: var(--spectrum-global-color-blue-600);
|
|
84
84
|
}
|
|
85
|
+
:global([dir="ltr"] .spectrum-ActionButton .spectrum-Icon) {
|
|
86
|
+
margin-left: 0;
|
|
87
|
+
}
|
|
88
|
+
.is-selected:not(.spectrum-ActionButton--emphasized) {
|
|
89
|
+
background: var(--spectrum-global-color-gray-300);
|
|
90
|
+
}
|
|
85
91
|
.noPadding {
|
|
86
92
|
padding: 0;
|
|
87
93
|
min-width: 0;
|
package/src/Banner/Banner.svelte
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
export let size = "S"
|
|
9
9
|
export let extraButtonText
|
|
10
10
|
export let extraButtonAction
|
|
11
|
+
export let showCloseButton = true
|
|
11
12
|
|
|
12
13
|
let show = true
|
|
13
14
|
|
|
@@ -39,22 +40,24 @@
|
|
|
39
40
|
</button>
|
|
40
41
|
{/if}
|
|
41
42
|
</div>
|
|
42
|
-
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
{#if showCloseButton}
|
|
44
|
+
<div class="spectrum-Toast-buttons">
|
|
45
|
+
<button
|
|
46
|
+
class="spectrum-ClearButton spectrum-ClearButton--overBackground spectrum-ClearButton--size{size}"
|
|
47
|
+
on:click={clear}
|
|
48
|
+
>
|
|
49
|
+
<div class="spectrum-ClearButton-fill">
|
|
50
|
+
<svg
|
|
51
|
+
class="spectrum-ClearButton-icon spectrum-Icon spectrum-UIIcon-Cross100"
|
|
52
|
+
focusable="false"
|
|
53
|
+
aria-hidden="true"
|
|
54
|
+
>
|
|
55
|
+
<use xlink:href="#spectrum-css-icon-Cross100" />
|
|
56
|
+
</svg>
|
|
57
|
+
</div>
|
|
58
|
+
</button>
|
|
59
|
+
</div>
|
|
60
|
+
{/if}
|
|
58
61
|
</div>
|
|
59
62
|
{/if}
|
|
60
63
|
|
|
@@ -63,4 +66,7 @@
|
|
|
63
66
|
pointer-events: all;
|
|
64
67
|
width: 100%;
|
|
65
68
|
}
|
|
69
|
+
.spectrum-Button {
|
|
70
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
71
|
+
}
|
|
66
72
|
</style>
|
package/src/Drawer/Drawer.svelte
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
export let title
|
|
8
8
|
export let fillWidth
|
|
9
|
+
export let left = "314px"
|
|
10
|
+
export let width = "calc(100% - 576px)"
|
|
9
11
|
|
|
10
12
|
let visible = false
|
|
11
13
|
|
|
@@ -42,7 +44,12 @@
|
|
|
42
44
|
|
|
43
45
|
{#if visible}
|
|
44
46
|
<Portal>
|
|
45
|
-
<section
|
|
47
|
+
<section
|
|
48
|
+
class:fillWidth
|
|
49
|
+
class="drawer"
|
|
50
|
+
transition:slide|local
|
|
51
|
+
style={`width: ${width}; left: ${left};`}
|
|
52
|
+
>
|
|
46
53
|
<header>
|
|
47
54
|
<div class="text">
|
|
48
55
|
<Heading size="XS">{title}</Heading>
|
|
@@ -69,8 +76,6 @@
|
|
|
69
76
|
.drawer {
|
|
70
77
|
position: absolute;
|
|
71
78
|
bottom: 0;
|
|
72
|
-
left: 260px;
|
|
73
|
-
width: calc(100% - 520px);
|
|
74
79
|
background: var(--background);
|
|
75
80
|
border-top: var(--border-light);
|
|
76
81
|
z-index: 2;
|
|
@@ -6,12 +6,15 @@
|
|
|
6
6
|
import { createEventDispatcher } from "svelte"
|
|
7
7
|
import clickOutside from "../../Actions/click_outside"
|
|
8
8
|
import Search from "./Search.svelte"
|
|
9
|
+
import Icon from "../../Icon/Icon.svelte"
|
|
10
|
+
import StatusLight from "../../StatusLight/StatusLight.svelte"
|
|
9
11
|
|
|
10
12
|
export let id = null
|
|
11
13
|
export let disabled = false
|
|
12
14
|
export let error = null
|
|
13
15
|
export let fieldText = ""
|
|
14
16
|
export let fieldIcon = ""
|
|
17
|
+
export let fieldColour = ""
|
|
15
18
|
export let isPlaceholder = false
|
|
16
19
|
export let placeholderOption = null
|
|
17
20
|
export let options = []
|
|
@@ -20,6 +23,7 @@
|
|
|
20
23
|
export let getOptionLabel = option => option
|
|
21
24
|
export let getOptionValue = option => option
|
|
22
25
|
export let getOptionIcon = () => null
|
|
26
|
+
export let getOptionColour = () => null
|
|
23
27
|
export let open = false
|
|
24
28
|
export let readonly = false
|
|
25
29
|
export let quiet = false
|
|
@@ -83,11 +87,10 @@
|
|
|
83
87
|
on:mousedown={onClick}
|
|
84
88
|
>
|
|
85
89
|
{#if fieldIcon}
|
|
86
|
-
<span class="icon
|
|
87
|
-
<
|
|
90
|
+
<span class="option-icon">
|
|
91
|
+
<Icon name={fieldIcon} />
|
|
88
92
|
</span>
|
|
89
93
|
{/if}
|
|
90
|
-
|
|
91
94
|
<span
|
|
92
95
|
class="spectrum-Picker-label"
|
|
93
96
|
class:is-placeholder={isPlaceholder}
|
|
@@ -105,6 +108,11 @@
|
|
|
105
108
|
<use xlink:href="#spectrum-icon-18-Alert" />
|
|
106
109
|
</svg>
|
|
107
110
|
{/if}
|
|
111
|
+
{#if fieldColour}
|
|
112
|
+
<span class="option-colour">
|
|
113
|
+
<StatusLight size="L" color={fieldColour} />
|
|
114
|
+
</span>
|
|
115
|
+
{/if}
|
|
108
116
|
<svg
|
|
109
117
|
class="spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon"
|
|
110
118
|
focusable="false"
|
|
@@ -158,13 +166,8 @@
|
|
|
158
166
|
on:click={() => onSelectOption(getOptionValue(option, idx))}
|
|
159
167
|
>
|
|
160
168
|
{#if getOptionIcon(option, idx)}
|
|
161
|
-
<span class="icon
|
|
162
|
-
<
|
|
163
|
-
src={getOptionIcon(option, idx)}
|
|
164
|
-
alt="icon"
|
|
165
|
-
width="20"
|
|
166
|
-
height="15"
|
|
167
|
-
/>
|
|
169
|
+
<span class="option-icon">
|
|
170
|
+
<Icon name={getOptionIcon(option, idx)} />
|
|
168
171
|
</span>
|
|
169
172
|
{/if}
|
|
170
173
|
<span class="spectrum-Menu-itemLabel">
|
|
@@ -177,6 +180,11 @@
|
|
|
177
180
|
>
|
|
178
181
|
<use xlink:href="#spectrum-css-icon-Checkmark100" />
|
|
179
182
|
</svg>
|
|
183
|
+
{#if getOptionColour(option, idx)}
|
|
184
|
+
<span class="option-colour">
|
|
185
|
+
<StatusLight size="L" color={getOptionColour(option, idx)} />
|
|
186
|
+
</span>
|
|
187
|
+
{/if}
|
|
180
188
|
</li>
|
|
181
189
|
{/each}
|
|
182
190
|
{/if}
|
|
@@ -214,13 +222,18 @@
|
|
|
214
222
|
padding-right: 2px;
|
|
215
223
|
}
|
|
216
224
|
|
|
217
|
-
|
|
218
|
-
|
|
225
|
+
/* Icon and colour alignment */
|
|
226
|
+
.spectrum-Menu-checkmark {
|
|
227
|
+
align-self: center;
|
|
228
|
+
margin-top: 0;
|
|
229
|
+
}
|
|
230
|
+
.option-colour {
|
|
231
|
+
padding-left: 8px;
|
|
219
232
|
}
|
|
220
|
-
.icon
|
|
221
|
-
padding-
|
|
222
|
-
padding-right: 10px;
|
|
233
|
+
.option-icon {
|
|
234
|
+
padding-right: 8px;
|
|
223
235
|
}
|
|
236
|
+
|
|
224
237
|
.spectrum-Popover :global(.spectrum-Search) {
|
|
225
238
|
margin-top: -1px;
|
|
226
239
|
margin-left: -1px;
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
export let id = null
|
|
9
9
|
export let updateOnChange = true
|
|
10
10
|
export let quiet = false
|
|
11
|
+
export let inputRef
|
|
12
|
+
|
|
11
13
|
const dispatch = createEventDispatcher()
|
|
12
14
|
let focus = false
|
|
13
15
|
|
|
@@ -68,6 +70,7 @@
|
|
|
68
70
|
type="search"
|
|
69
71
|
class="spectrum-Textfield-input spectrum-Search-input"
|
|
70
72
|
autocomplete="off"
|
|
73
|
+
bind:this={inputRef}
|
|
71
74
|
/>
|
|
72
75
|
</div>
|
|
73
76
|
<button
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
export let getOptionLabel = option => option
|
|
12
12
|
export let getOptionValue = option => option
|
|
13
13
|
export let getOptionIcon = () => null
|
|
14
|
+
export let getOptionColour = () => null
|
|
14
15
|
export let readonly = false
|
|
15
16
|
export let quiet = false
|
|
16
17
|
export let autoWidth = false
|
|
@@ -20,35 +21,27 @@
|
|
|
20
21
|
const dispatch = createEventDispatcher()
|
|
21
22
|
let open = false
|
|
22
23
|
$: fieldText = getFieldText(value, options, placeholder)
|
|
23
|
-
$: fieldIcon =
|
|
24
|
-
|
|
25
|
-
const getFieldText = (value, options, placeholder) => {
|
|
26
|
-
// Always use placeholder if no value
|
|
27
|
-
if (value == null || value === "") {
|
|
28
|
-
return placeholder || "Choose an option"
|
|
29
|
-
}
|
|
24
|
+
$: fieldIcon = getFieldAttribute(getOptionIcon, value, options)
|
|
25
|
+
$: fieldColour = getFieldAttribute(getOptionColour, value, options)
|
|
30
26
|
|
|
27
|
+
const getFieldAttribute = (getAttribute, value, options) => {
|
|
31
28
|
// Wait for options to load if there is a value but no options
|
|
32
29
|
if (!options?.length) {
|
|
33
30
|
return ""
|
|
34
31
|
}
|
|
35
|
-
|
|
36
|
-
// Render the label if the selected option is found, otherwise raw value
|
|
37
32
|
const index = options.findIndex(
|
|
38
33
|
(option, idx) => getOptionValue(option, idx) === value
|
|
39
34
|
)
|
|
40
|
-
return index !== -1 ?
|
|
35
|
+
return index !== -1 ? getAttribute(options[index], index) : null
|
|
41
36
|
}
|
|
42
37
|
|
|
43
|
-
const
|
|
44
|
-
//
|
|
45
|
-
if (
|
|
46
|
-
return ""
|
|
38
|
+
const getFieldText = (value, options, placeholder) => {
|
|
39
|
+
// Always use placeholder if no value
|
|
40
|
+
if (value == null || value === "") {
|
|
41
|
+
return placeholder || "Choose an option"
|
|
47
42
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)
|
|
51
|
-
return index !== -1 ? getOptionIcon(options[index], index) : null
|
|
43
|
+
|
|
44
|
+
return getFieldAttribute(getOptionLabel, value, options)
|
|
52
45
|
}
|
|
53
46
|
|
|
54
47
|
const selectOption = value => {
|
|
@@ -66,12 +59,14 @@
|
|
|
66
59
|
{disabled}
|
|
67
60
|
{readonly}
|
|
68
61
|
{fieldText}
|
|
62
|
+
{fieldIcon}
|
|
63
|
+
{fieldColour}
|
|
69
64
|
{options}
|
|
70
65
|
{autoWidth}
|
|
71
66
|
{getOptionLabel}
|
|
72
67
|
{getOptionValue}
|
|
73
68
|
{getOptionIcon}
|
|
74
|
-
{
|
|
69
|
+
{getOptionColour}
|
|
75
70
|
{autocomplete}
|
|
76
71
|
{sort}
|
|
77
72
|
isPlaceholder={value == null || value === ""}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import "@spectrum-css/slider/dist/index-vars.css"
|
|
3
|
+
import { createEventDispatcher } from "svelte"
|
|
4
|
+
|
|
5
|
+
export let value = false
|
|
6
|
+
export let id = null
|
|
7
|
+
export let disabled = false
|
|
8
|
+
export let min = 0
|
|
9
|
+
export let max = 100
|
|
10
|
+
export let step = 1
|
|
11
|
+
|
|
12
|
+
const dispatch = createEventDispatcher()
|
|
13
|
+
const onChange = event => {
|
|
14
|
+
dispatch("change", event.target.value)
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<div>
|
|
19
|
+
<input
|
|
20
|
+
type="range"
|
|
21
|
+
{min}
|
|
22
|
+
{max}
|
|
23
|
+
{step}
|
|
24
|
+
{value}
|
|
25
|
+
{disabled}
|
|
26
|
+
{id}
|
|
27
|
+
on:change={onChange}
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<style>
|
|
32
|
+
div {
|
|
33
|
+
display: grid;
|
|
34
|
+
place-items: center;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
input {
|
|
38
|
+
width: 100%;
|
|
39
|
+
padding: 0;
|
|
40
|
+
margin: 0;
|
|
41
|
+
-webkit-appearance: none;
|
|
42
|
+
background: transparent;
|
|
43
|
+
}
|
|
44
|
+
input::-webkit-slider-thumb {
|
|
45
|
+
-webkit-appearance: none;
|
|
46
|
+
}
|
|
47
|
+
input:focus {
|
|
48
|
+
outline: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
input[type="range"]::-webkit-slider-thumb {
|
|
52
|
+
-webkit-appearance: none;
|
|
53
|
+
border: 2px solid var(--spectrum-global-color-gray-700);
|
|
54
|
+
height: 16px;
|
|
55
|
+
width: 16px;
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
background: var(--background);
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
transition: background 130ms ease-out;
|
|
60
|
+
margin-top: -7px;
|
|
61
|
+
}
|
|
62
|
+
input[type="range"]::-moz-range-thumb {
|
|
63
|
+
border: 2px solid var(--spectrum-global-color-gray-700);
|
|
64
|
+
height: 12px;
|
|
65
|
+
width: 12px;
|
|
66
|
+
border-radius: 50%;
|
|
67
|
+
background: var(--background);
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
transition: background 130ms ease-out;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
input[type="range"]::-webkit-slider-runnable-track {
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 2px;
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
background: var(--spectrum-global-color-gray-300);
|
|
77
|
+
border-radius: 2px;
|
|
78
|
+
}
|
|
79
|
+
input[type="range"]::-moz-range-track {
|
|
80
|
+
width: 100%;
|
|
81
|
+
height: 2px;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
background: var(--spectrum-global-color-gray-300);
|
|
84
|
+
border-radius: 2px;
|
|
85
|
+
}
|
|
86
|
+
</style>
|
package/src/Form/Core/index.js
CHANGED
|
@@ -12,3 +12,4 @@ export { default as CoreDatePicker } from "./DatePicker.svelte"
|
|
|
12
12
|
export { default as CoreDropzone } from "./Dropzone.svelte"
|
|
13
13
|
export { default as CoreStepper } from "./Stepper.svelte"
|
|
14
14
|
export { default as CoreRichTextField } from "./RichTextField.svelte"
|
|
15
|
+
export { default as CoreSlider } from "./Slider.svelte"
|
package/src/Form/Search.svelte
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
export let disabled = false
|
|
11
11
|
export let updateOnChange = true
|
|
12
12
|
export let quiet = false
|
|
13
|
+
export let inputRef
|
|
13
14
|
|
|
14
15
|
const dispatch = createEventDispatcher()
|
|
15
16
|
const onChange = e => {
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
{value}
|
|
26
27
|
{placeholder}
|
|
27
28
|
{quiet}
|
|
29
|
+
bind:inputRef
|
|
28
30
|
on:change={onChange}
|
|
29
31
|
on:click
|
|
30
32
|
on:input
|
package/src/Form/Select.svelte
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
export let getOptionLabel = option => extractProperty(option, "label")
|
|
15
15
|
export let getOptionValue = option => extractProperty(option, "value")
|
|
16
16
|
export let getOptionIcon = option => option?.icon
|
|
17
|
+
export let getOptionColour = option => option?.colour
|
|
17
18
|
export let quiet = false
|
|
18
19
|
export let autoWidth = false
|
|
19
20
|
export let sort = false
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
{getOptionLabel}
|
|
48
49
|
{getOptionValue}
|
|
49
50
|
{getOptionIcon}
|
|
51
|
+
{getOptionColour}
|
|
50
52
|
on:change={onChange}
|
|
51
53
|
on:click
|
|
52
54
|
/>
|
|
@@ -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>
|
package/src/Icon/Icon.svelte
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
</svg>
|
|
48
48
|
{#if tooltip && showTooltip}
|
|
49
49
|
<div class="tooltip" in:fade={{ duration: 130, delay: 250 }}>
|
|
50
|
-
<Tooltip textWrapping direction=
|
|
50
|
+
<Tooltip textWrapping direction="bottom" text={tooltip} />
|
|
51
51
|
</div>
|
|
52
52
|
{/if}
|
|
53
53
|
</div>
|
|
@@ -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>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<Portal target=".modal-container">
|
|
10
10
|
<div class="notifications">
|
|
11
11
|
{#each $notifications as { type, icon, message, id, dismissable, action, wide } (id)}
|
|
12
|
-
<div transition:fly={{ y:
|
|
12
|
+
<div transition:fly={{ y: 30 }}>
|
|
13
13
|
<Notification
|
|
14
14
|
{type}
|
|
15
15
|
{icon}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<style>
|
|
28
28
|
.notifications {
|
|
29
29
|
position: fixed;
|
|
30
|
-
|
|
30
|
+
bottom: 40px;
|
|
31
31
|
left: 0;
|
|
32
32
|
right: 0;
|
|
33
33
|
margin: 0 auto;
|
|
@@ -17,10 +17,13 @@
|
|
|
17
17
|
export let negative = false
|
|
18
18
|
export let disabled = false
|
|
19
19
|
export let active = false
|
|
20
|
+
export let color = null
|
|
20
21
|
</script>
|
|
21
22
|
|
|
22
23
|
<div
|
|
23
24
|
class="spectrum-StatusLight spectrum-StatusLight--size{size}"
|
|
25
|
+
class:custom={!!color}
|
|
26
|
+
style={`--color: ${color};`}
|
|
24
27
|
class:spectrum-StatusLight--celery={celery}
|
|
25
28
|
class:spectrum-StatusLight--yellow={yellow}
|
|
26
29
|
class:spectrum-StatusLight--fuchsia={fuchsia}
|
|
@@ -36,6 +39,26 @@
|
|
|
36
39
|
class:spectrum-StatusLight--negative={negative}
|
|
37
40
|
class:spectrum-StatusLight--disabled={disabled}
|
|
38
41
|
class:spectrum-StatusLight--active={active}
|
|
42
|
+
class:withText={!!$$slots.default}
|
|
39
43
|
>
|
|
40
44
|
<slot />
|
|
41
45
|
</div>
|
|
46
|
+
|
|
47
|
+
<style>
|
|
48
|
+
.spectrum-StatusLight {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-items: center;
|
|
53
|
+
--spectrum-statuslight-info-text-gap: 4px;
|
|
54
|
+
min-height: 0;
|
|
55
|
+
padding-top: 0;
|
|
56
|
+
padding-bottom: 0;
|
|
57
|
+
}
|
|
58
|
+
.spectrum-StatusLight.withText::before {
|
|
59
|
+
margin-right: 10px;
|
|
60
|
+
}
|
|
61
|
+
.custom::before {
|
|
62
|
+
background: var(--color) !important;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
package/src/Tabs/Tab.svelte
CHANGED