@budibase/bbui 2.3.18-alpha.16 → 2.3.18-alpha.17

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": "2.3.18-alpha.16",
4
+ "version": "2.3.18-alpha.17",
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": "2.3.18-alpha.16",
41
+ "@budibase/string-templates": "2.3.18-alpha.17",
42
42
  "@spectrum-css/accordion": "3.0.24",
43
43
  "@spectrum-css/actionbutton": "1.0.1",
44
44
  "@spectrum-css/actiongroup": "1.0.1",
@@ -89,5 +89,5 @@
89
89
  "resolutions": {
90
90
  "loader-utils": "1.4.1"
91
91
  },
92
- "gitHead": "c350c15ae0869875936c804b89fcd46e4da4d8bb"
92
+ "gitHead": "f703ebb73409290aa949c240c51b95c7ce3826c8"
93
93
  }
@@ -1,6 +1,9 @@
1
1
  <script>
2
2
  import "@spectrum-css/actionbutton/dist/index-vars.css"
3
3
  import { createEventDispatcher } from "svelte"
4
+ import Tooltip from "../Tooltip/Tooltip.svelte"
5
+ import { fade } from "svelte/transition"
6
+
4
7
  const dispatch = createEventDispatcher()
5
8
 
6
9
  export let quiet = false
@@ -13,6 +16,9 @@
13
16
  export let active = false
14
17
  export let fullWidth = false
15
18
  export let noPadding = false
19
+ export let tooltip = ""
20
+
21
+ let showTooltip = false
16
22
 
17
23
  function longPress(element) {
18
24
  if (!longPressable) return
@@ -35,42 +41,54 @@
35
41
  }
36
42
  </script>
37
43
 
38
- <button
39
- use:longPress
40
- class:spectrum-ActionButton--quiet={quiet}
41
- class:spectrum-ActionButton--emphasized={emphasized}
42
- class:is-selected={selected}
43
- class:noPadding
44
- class:fullWidth
45
- class="spectrum-ActionButton spectrum-ActionButton--size{size}"
46
- class:active
47
- {disabled}
48
- on:longPress
49
- on:click|preventDefault
44
+ <span
45
+ class="btn-wrap"
46
+ on:mouseover={() => (showTooltip = true)}
47
+ on:mouseleave={() => (showTooltip = false)}
48
+ on:focus={() => (showTooltip = true)}
50
49
  >
51
- {#if longPressable}
52
- <svg
53
- class="spectrum-Icon spectrum-UIIcon-CornerTriangle100 spectrum-ActionButton-hold"
54
- focusable="false"
55
- aria-hidden="true"
56
- >
57
- <use xlink:href="#spectrum-css-icon-CornerTriangle100" />
58
- </svg>
59
- {/if}
60
- {#if icon}
61
- <svg
62
- class="spectrum-Icon spectrum-Icon--size{size}"
63
- focusable="false"
64
- aria-hidden="true"
65
- aria-label={icon}
66
- >
67
- <use xlink:href="#spectrum-icon-18-{icon}" />
68
- </svg>
69
- {/if}
70
- {#if $$slots}
71
- <span class="spectrum-ActionButton-label"><slot /></span>
72
- {/if}
73
- </button>
50
+ <button
51
+ use:longPress
52
+ class:spectrum-ActionButton--quiet={quiet}
53
+ class:spectrum-ActionButton--emphasized={emphasized}
54
+ class:is-selected={selected}
55
+ class:noPadding
56
+ class:fullWidth
57
+ class="spectrum-ActionButton spectrum-ActionButton--size{size}"
58
+ class:active
59
+ {disabled}
60
+ on:longPress
61
+ on:click|preventDefault
62
+ >
63
+ {#if longPressable}
64
+ <svg
65
+ class="spectrum-Icon spectrum-UIIcon-CornerTriangle100 spectrum-ActionButton-hold"
66
+ focusable="false"
67
+ aria-hidden="true"
68
+ >
69
+ <use xlink:href="#spectrum-css-icon-CornerTriangle100" />
70
+ </svg>
71
+ {/if}
72
+ {#if icon}
73
+ <svg
74
+ class="spectrum-Icon spectrum-Icon--size{size}"
75
+ focusable="false"
76
+ aria-hidden="true"
77
+ aria-label={icon}
78
+ >
79
+ <use xlink:href="#spectrum-icon-18-{icon}" />
80
+ </svg>
81
+ {/if}
82
+ {#if $$slots}
83
+ <span class="spectrum-ActionButton-label"><slot /></span>
84
+ {/if}
85
+ {#if tooltip && showTooltip}
86
+ <div class="tooltip" in:fade={{ duration: 130, delay: 250 }}>
87
+ <Tooltip textWrapping direction="bottom" text={tooltip} />
88
+ </div>
89
+ {/if}
90
+ </button>
91
+ </span>
74
92
 
75
93
  <style>
76
94
  .fullWidth {
@@ -98,4 +116,14 @@
98
116
  .is-selected:not(.emphasized) .spectrum-Icon {
99
117
  color: var(--spectrum-global-color-gray-900);
100
118
  }
119
+ .tooltip {
120
+ position: absolute;
121
+ pointer-events: none;
122
+ left: 50%;
123
+ top: calc(100% + 4px);
124
+ width: 100vw;
125
+ max-width: 150px;
126
+ transform: translateX(-50%);
127
+ text-align: center;
128
+ }
101
129
  </style>
@@ -33,6 +33,9 @@
33
33
  export let sort = false
34
34
  export let fetchTerm = null
35
35
  export let customPopoverHeight
36
+ export let align = "left"
37
+ export let footer = null
38
+
36
39
  const dispatch = createEventDispatcher()
37
40
 
38
41
  let searchTerm = null
@@ -131,7 +134,7 @@
131
134
 
132
135
  <Popover
133
136
  anchor={button}
134
- align="left"
137
+ align={align || "left"}
135
138
  bind:this={popover}
136
139
  {open}
137
140
  on:close={() => (open = false)}
@@ -208,6 +211,12 @@
208
211
  {/each}
209
212
  {/if}
210
213
  </ul>
214
+
215
+ {#if footer}
216
+ <div class="footer">
217
+ {footer}
218
+ </div>
219
+ {/if}
211
220
  </div>
212
221
  </Popover>
213
222
 
@@ -284,4 +293,11 @@
284
293
  .popover-content :global(.spectrum-Search .spectrum-Textfield-icon) {
285
294
  top: 9px;
286
295
  }
296
+
297
+ .footer {
298
+ padding: 4px 12px 12px 12px;
299
+ font-style: italic;
300
+ max-width: 170px;
301
+ font-size: 12px;
302
+ }
287
303
  </style>
@@ -18,6 +18,8 @@
18
18
  export let autoWidth = false
19
19
  export let autocomplete = false
20
20
  export let sort = false
21
+ export let align
22
+ export let footer = null
21
23
 
22
24
  const dispatch = createEventDispatcher()
23
25
 
@@ -41,7 +43,7 @@
41
43
  const getFieldText = (value, options, placeholder) => {
42
44
  // Always use placeholder if no value
43
45
  if (value == null || value === "") {
44
- return placeholder || "Choose an option"
46
+ return placeholder !== false ? "Choose an option" : ""
45
47
  }
46
48
 
47
49
  return getFieldAttribute(getOptionLabel, value, options)
@@ -66,6 +68,8 @@
66
68
  {fieldColour}
67
69
  {options}
68
70
  {autoWidth}
71
+ {align}
72
+ {footer}
69
73
  {getOptionLabel}
70
74
  {getOptionValue}
71
75
  {getOptionIcon}
@@ -74,7 +78,7 @@
74
78
  {autocomplete}
75
79
  {sort}
76
80
  isPlaceholder={value == null || value === ""}
77
- placeholderOption={placeholder}
81
+ placeholderOption={placeholder === false ? null : placeholder}
78
82
  isOptionSelected={option => option === value}
79
83
  onSelectOption={selectOption}
80
84
  />
@@ -22,6 +22,8 @@
22
22
  export let tooltip = ""
23
23
  export let autocomplete = false
24
24
  export let customPopoverHeight
25
+ export let align
26
+ export let footer = null
25
27
 
26
28
  const dispatch = createEventDispatcher()
27
29
  const onChange = e => {
@@ -48,6 +50,8 @@
48
50
  {placeholder}
49
51
  {autoWidth}
50
52
  {sort}
53
+ {align}
54
+ {footer}
51
55
  {getOptionLabel}
52
56
  {getOptionValue}
53
57
  {getOptionIcon}