@budibase/bbui 1.0.19-alpha.0 → 1.0.19-alpha.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/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.19-alpha.0",
4
+ "version": "1.0.19-alpha.1",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.js",
7
7
  "module": "dist/bbui.es.js",
@@ -82,5 +82,5 @@
82
82
  "svelte-flatpickr": "^3.2.3",
83
83
  "svelte-portal": "^1.0.0"
84
84
  },
85
- "gitHead": "78991939242ca4b1ac5209f2ddf5225f09d080fb"
85
+ "gitHead": "5623634c9caf89d0694e57e726b654fbf7ccb69a"
86
86
  }
@@ -80,4 +80,8 @@
80
80
  .active svg {
81
81
  color: var(--spectrum-global-color-blue-600);
82
82
  }
83
+
84
+ .spectrum-ActionButton-label {
85
+ padding-bottom: 2px;
86
+ }
83
87
  </style>
@@ -0,0 +1,59 @@
1
+ <script>
2
+ import { createEventDispatcher } from "svelte"
3
+
4
+ let dispatch = createEventDispatcher()
5
+
6
+ export let type = "info"
7
+ export let icon = "Info"
8
+ export let size = "S"
9
+ export let extraButtonText
10
+ export let extraButtonAction
11
+
12
+ let show = true
13
+
14
+ function clear() {
15
+ show = false
16
+ dispatch("change")
17
+ }
18
+ </script>
19
+
20
+ {#if show}
21
+ <div class="spectrum-Toast spectrum-Toast--{type}">
22
+ <svg
23
+ class="spectrum-Icon spectrum-Icon--size{size} spectrum-Toast-typeIcon"
24
+ focusable="false"
25
+ aria-hidden="true"
26
+ >
27
+ <use xlink:href="#spectrum-icon-18-{icon}" />
28
+ </svg>
29
+ <div class="spectrum-Toast-body">
30
+ <div class="spectrum-Toast-content">
31
+ <slot />
32
+ </div>
33
+ {#if extraButtonText && extraButtonAction}
34
+ <button
35
+ class="spectrum-Button spectrum-Button--sizeM spectrum-Button--overBackground spectrum-Button--quiet"
36
+ on:click={extraButtonAction}
37
+ >
38
+ <span class="spectrum-Button-label">{extraButtonText}</span>
39
+ </button>
40
+ {/if}
41
+ </div>
42
+ <div class="spectrum-Toast-buttons">
43
+ <button
44
+ class="spectrum-ClearButton spectrum-ClearButton--overBackground spectrum-ClearButton--size{size}"
45
+ on:click={clear}
46
+ >
47
+ <div class="spectrum-ClearButton-fill">
48
+ <svg
49
+ class="spectrum-ClearButton-icon spectrum-Icon spectrum-UIIcon-Cross100"
50
+ focusable="false"
51
+ aria-hidden="true"
52
+ >
53
+ <use xlink:href="#spectrum-css-icon-Cross100" />
54
+ </svg>
55
+ </div>
56
+ </button>
57
+ </div>
58
+ </div>
59
+ {/if}
@@ -25,7 +25,9 @@
25
25
  class="spectrum-Switch-input"
26
26
  />
27
27
  <span class="spectrum-Switch-switch" />
28
- <label class="spectrum-Switch-label" for={id}>{text}</label>
28
+ {#if text}
29
+ <label class="spectrum-Switch-label" for={id}>{text}</label>
30
+ {/if}
29
31
  </div>
30
32
 
31
33
  <style>
@@ -7,6 +7,8 @@
7
7
  export let disabled = false
8
8
  export let error = null
9
9
  export let id = null
10
+ export let height = null
11
+ export let minHeight = null
10
12
  export const getCaretPosition = () => ({
11
13
  start: textarea.selectionStart,
12
14
  end: textarea.selectionEnd,
@@ -22,6 +24,8 @@
22
24
  </script>
23
25
 
24
26
  <div
27
+ style={(height ? `height: ${height}px;` : "") +
28
+ (minHeight ? `min-height: ${minHeight}px` : "")}
25
29
  class="spectrum-Textfield spectrum-Textfield--multiline"
26
30
  class:is-invalid={!!error}
27
31
  class:is-disabled={disabled}
@@ -9,6 +9,7 @@
9
9
  export let labelPosition = "above"
10
10
  export let error = null
11
11
  export let options = []
12
+ export let direction = "vertical"
12
13
  export let getOptionLabel = option => extractProperty(option, "label")
13
14
  export let getOptionValue = option => extractProperty(option, "value")
14
15
 
@@ -31,6 +32,7 @@
31
32
  {disabled}
32
33
  {value}
33
34
  {options}
35
+ {direction}
34
36
  {getOptionLabel}
35
37
  {getOptionValue}
36
38
  on:change={onChange}
@@ -10,6 +10,8 @@
10
10
  export let disabled = false
11
11
  export let error = null
12
12
  export let getCaretPosition = null
13
+ export let height = null
14
+ export let minHeight = null
13
15
 
14
16
  const dispatch = createEventDispatcher()
15
17
  const onChange = e => {
@@ -25,6 +27,8 @@
25
27
  {disabled}
26
28
  {value}
27
29
  {placeholder}
30
+ {height}
31
+ {minHeight}
28
32
  on:change={onChange}
29
33
  />
30
34
  </Field>
@@ -9,6 +9,7 @@
9
9
  export let size = "M"
10
10
  export let hoverable = false
11
11
  export let disabled = false
12
+ export let color
12
13
 
13
14
  $: rotation = getRotation(direction)
14
15
 
@@ -25,7 +26,9 @@
25
26
  focusable="false"
26
27
  aria-hidden={hidden}
27
28
  aria-label={name}
28
- style={`transform: rotate(${rotation}deg)`}
29
+ style={`transform: rotate(${rotation}deg); ${
30
+ color ? `color: ${color};` : ""
31
+ }`}
29
32
  >
30
33
  <use xlink:href="#spectrum-icon-18-{name}" />
31
34
  </svg>
@@ -19,6 +19,7 @@
19
19
  <div class="icon-container">
20
20
  <div
21
21
  class="icon"
22
+ class:icon-small={size === "M" || size === "S"}
22
23
  on:mouseover={() => (showTooltip = true)}
23
24
  on:mouseleave={() => (showTooltip = false)}
24
25
  >
@@ -44,6 +45,7 @@
44
45
  }
45
46
  .container {
46
47
  display: flex;
48
+ align-items: center;
47
49
  }
48
50
  .icon-container {
49
51
  position: relative;
@@ -64,4 +66,8 @@
64
66
  .icon {
65
67
  transform: scale(0.75);
66
68
  }
69
+ .icon-small {
70
+ margin-top: -2px;
71
+ margin-bottom: -5px;
72
+ }
67
73
  </style>
@@ -5,7 +5,7 @@
5
5
  export let icon = ""
6
6
 
7
7
  const dispatch = createEventDispatcher()
8
- const selected = getContext("tab")
8
+ let selected = getContext("tab")
9
9
  let tab
10
10
  let tabInfo
11
11
 
@@ -16,8 +16,8 @@
16
16
  // We just need to get this off the main thread to fix this, by using
17
17
  // a 0ms timeout.
18
18
  setTimeout(() => {
19
- tabInfo = tab.getBoundingClientRect()
20
- if ($selected.title === title) {
19
+ tabInfo = tab?.getBoundingClientRect()
20
+ if (tabInfo && $selected.title === title) {
21
21
  $selected.info = tabInfo
22
22
  }
23
23
  }, 0)
@@ -6,9 +6,13 @@
6
6
  export let selected
7
7
  export let vertical = false
8
8
  export let noPadding = false
9
+ // added as a separate option as noPadding is used for vertical padding
10
+ export let noHorizPadding = false
9
11
  export let quiet = false
10
12
  export let emphasized = false
11
13
 
14
+ let thisSelected = undefined
15
+
12
16
  let _id = id()
13
17
  const tab = writable({ title: selected, id: _id, emphasized })
14
18
  setContext("tab", tab)
@@ -18,9 +22,19 @@
18
22
  const dispatch = createEventDispatcher()
19
23
 
20
24
  $: {
21
- if ($tab.title !== selected) {
25
+ if (thisSelected !== selected) {
26
+ thisSelected = selected
27
+ dispatch("select", thisSelected)
28
+ } else if ($tab.title !== thisSelected) {
29
+ thisSelected = $tab.title
22
30
  selected = $tab.title
23
- dispatch("select", selected)
31
+ dispatch("select", thisSelected)
32
+ }
33
+ if ($tab.title !== thisSelected) {
34
+ tab.update(state => {
35
+ state.title = thisSelected
36
+ return state
37
+ })
24
38
  }
25
39
  }
26
40
 
@@ -59,6 +73,7 @@
59
73
  <div
60
74
  bind:this={container}
61
75
  class:quiet
76
+ class:noHorizPadding
62
77
  class="selected-border spectrum-Tabs {quiet &&
63
78
  'spectrum-Tabs--quiet'} spectrum-Tabs--{vertical
64
79
  ? 'vertical'
@@ -99,6 +114,9 @@
99
114
  .spectrum-Tabs--horizontal .spectrum-Tabs-selectionIndicator {
100
115
  bottom: 0 !important;
101
116
  }
117
+ .noHorizPadding {
118
+ padding: 0;
119
+ }
102
120
  .noPadding {
103
121
  margin: 0;
104
122
  }
package/src/index.js CHANGED
@@ -59,6 +59,7 @@ export { default as Badge } from "./Badge/Badge.svelte"
59
59
  export { default as StatusLight } from "./StatusLight/StatusLight.svelte"
60
60
  export { default as ColorPicker } from "./ColorPicker/ColorPicker.svelte"
61
61
  export { default as InlineAlert } from "./InlineAlert/InlineAlert.svelte"
62
+ export { default as Banner } from "./Banner/Banner.svelte"
62
63
 
63
64
  // Typography
64
65
  export { default as Body } from "./Typography/Body.svelte"