@budibase/bbui 2.8.1 → 2.8.2-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": "2.8.1",
4
+ "version": "2.8.2-alpha.1",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.js",
7
7
  "module": "dist/bbui.es.js",
@@ -38,8 +38,8 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@adobe/spectrum-css-workflow-icons": "1.2.1",
41
- "@budibase/shared-core": "2.8.1",
42
- "@budibase/string-templates": "2.8.1",
41
+ "@budibase/shared-core": "2.8.2-alpha.1",
42
+ "@budibase/string-templates": "2.8.2-alpha.1",
43
43
  "@spectrum-css/accordion": "3.0.24",
44
44
  "@spectrum-css/actionbutton": "1.0.1",
45
45
  "@spectrum-css/actiongroup": "1.0.1",
@@ -104,5 +104,5 @@
104
104
  }
105
105
  }
106
106
  },
107
- "gitHead": "84eb8be81f1c22165254f5ea0bd0022a59956f22"
107
+ "gitHead": "e03230d63f9550b4d7d923518c9094e889512097"
108
108
  }
@@ -16,8 +16,6 @@
16
16
  export let tooltip = undefined
17
17
  export let newStyles = true
18
18
  export let id
19
-
20
- let showTooltip = false
21
19
  </script>
22
20
 
23
21
  <button
@@ -35,9 +33,6 @@
35
33
  class="spectrum-Button spectrum-Button--size{size.toUpperCase()}"
36
34
  {disabled}
37
35
  on:click|preventDefault
38
- on:mouseover={() => (showTooltip = true)}
39
- on:focus={() => (showTooltip = true)}
40
- on:mouseleave={() => (showTooltip = false)}
41
36
  >
42
37
  {#if icon}
43
38
  <svg
@@ -52,19 +47,7 @@
52
47
  {#if $$slots}
53
48
  <span class="spectrum-Button-label"><slot /></span>
54
49
  {/if}
55
- {#if !disabled && tooltip}
56
- <div class="tooltip-icon">
57
- <svg
58
- class="spectrum-Icon spectrum-Icon--size{size.toUpperCase()}"
59
- focusable="false"
60
- aria-hidden="true"
61
- aria-label="Info"
62
- >
63
- <use xlink:href="#spectrum-icon-18-InfoOutline" />
64
- </svg>
65
- </div>
66
- {/if}
67
- {#if showTooltip && tooltip}
50
+ {#if tooltip}
68
51
  <div class="tooltip">
69
52
  <Tooltip textWrapping={true} direction={"bottom"} text={tooltip} />
70
53
  </div>
@@ -75,7 +58,6 @@
75
58
  button {
76
59
  position: relative;
77
60
  }
78
-
79
61
  .spectrum-Button-label {
80
62
  white-space: nowrap;
81
63
  overflow: hidden;
@@ -93,11 +75,13 @@
93
75
  text-align: center;
94
76
  transform: translateX(-50%);
95
77
  left: 50%;
96
- top: calc(100% - 3px);
78
+ top: 100%;
79
+ opacity: 0;
80
+ transition: opacity 130ms ease-out;
81
+ pointer-events: none;
97
82
  }
98
- .tooltip-icon {
99
- padding-left: var(--spacing-m);
100
- line-height: 0;
83
+ button:hover .tooltip {
84
+ opacity: 1;
101
85
  }
102
86
  .spectrum-Button--primary.new-styles {
103
87
  background: var(--spectrum-global-color-gray-800);
@@ -1,6 +1,7 @@
1
1
  <script>
2
2
  import "@spectrum-css/link/dist/index-vars.css"
3
3
  import { createEventDispatcher } from "svelte"
4
+ import Tooltip from "../Tooltip/Tooltip.svelte"
4
5
 
5
6
  export let href = "#"
6
7
  export let size = "M"
@@ -10,18 +11,61 @@
10
11
  export let overBackground = false
11
12
  export let target
12
13
  export let download
14
+ export let disabled = false
15
+ export let tooltip = null
13
16
 
14
17
  const dispatch = createEventDispatcher()
18
+
19
+ const onClick = e => {
20
+ if (!disabled) {
21
+ dispatch("click")
22
+ e.stopPropagation()
23
+ }
24
+ }
15
25
  </script>
16
26
 
17
27
  <a
18
- on:click={e => dispatch("click") && e.stopPropagation()}
28
+ on:click={onClick}
19
29
  {href}
20
30
  {target}
21
31
  {download}
32
+ class:disabled
22
33
  class:spectrum-Link--primary={primary}
23
34
  class:spectrum-Link--secondary={secondary}
24
35
  class:spectrum-Link--overBackground={overBackground}
25
36
  class:spectrum-Link--quiet={quiet}
26
- class="spectrum-Link spectrum-Link--size{size}"><slot /></a
37
+ class="spectrum-Link spectrum-Link--size{size}"
27
38
  >
39
+ <slot />
40
+ {#if tooltip}
41
+ <div class="tooltip">
42
+ <Tooltip textWrapping direction="bottom" text={tooltip} />
43
+ </div>
44
+ {/if}
45
+ </a>
46
+
47
+ <style>
48
+ a {
49
+ position: relative;
50
+ }
51
+ a.disabled {
52
+ color: var(--spectrum-global-color-gray-500);
53
+ }
54
+ a.disabled:hover {
55
+ text-decoration: none;
56
+ cursor: default;
57
+ }
58
+ .tooltip {
59
+ position: absolute;
60
+ left: 50%;
61
+ top: 100%;
62
+ transform: translateX(-50%);
63
+ opacity: 0;
64
+ transition: 130ms ease-out;
65
+ pointer-events: none;
66
+ z-index: 100;
67
+ }
68
+ a:hover .tooltip {
69
+ opacity: 1;
70
+ }
71
+ </style>
@@ -1,3 +1,7 @@
1
+ <script context="module">
2
+ export const keepOpen = Symbol("keepOpen")
3
+ </script>
4
+
1
5
  <script>
2
6
  import "@spectrum-css/dialog/dist/index-vars.css"
3
7
  import { getContext } from "svelte"
@@ -30,7 +34,7 @@
30
34
 
31
35
  async function secondary(e) {
32
36
  loading = true
33
- if (!secondaryAction || (await secondaryAction(e)) !== false) {
37
+ if (!secondaryAction || (await secondaryAction(e)) !== keepOpen) {
34
38
  hide()
35
39
  }
36
40
  loading = false
@@ -38,7 +42,7 @@
38
42
 
39
43
  async function confirm() {
40
44
  loading = true
41
- if (!onConfirm || (await onConfirm()) !== false) {
45
+ if (!onConfirm || (await onConfirm()) !== keepOpen) {
42
46
  hide()
43
47
  }
44
48
  loading = false
@@ -46,7 +50,7 @@
46
50
 
47
51
  async function close() {
48
52
  loading = true
49
- if (!onCancel || (await onCancel()) !== false) {
53
+ if (!onCancel || (await onCancel()) !== keepOpen) {
50
54
  cancel()
51
55
  }
52
56
  loading = false
@@ -90,6 +90,6 @@
90
90
  .spectrum-Popover {
91
91
  min-width: var(--spectrum-global-dimension-size-2000);
92
92
  border-color: var(--spectrum-global-color-gray-300);
93
- overflow: auto;
93
+ overflow: visible;
94
94
  }
95
95
  </style>
package/src/index.js CHANGED
@@ -42,7 +42,7 @@ export { default as MenuSection } from "./Menu/Section.svelte"
42
42
  export { default as MenuSeparator } from "./Menu/Separator.svelte"
43
43
  export { default as MenuItem } from "./Menu/Item.svelte"
44
44
  export { default as Modal } from "./Modal/Modal.svelte"
45
- export { default as ModalContent } from "./Modal/ModalContent.svelte"
45
+ export { default as ModalContent, keepOpen } from "./Modal/ModalContent.svelte"
46
46
  export { default as NotificationDisplay } from "./Notification/NotificationDisplay.svelte"
47
47
  export { default as Notification } from "./Notification/Notification.svelte"
48
48
  export { default as SideNavigation } from "./SideNavigation/Navigation.svelte"