@budibase/bbui 2.33.13 → 3.0.0

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.
@@ -27,7 +27,7 @@
27
27
 
28
28
  const onClick = () => {
29
29
  if (actionMenu && !noClose) {
30
- actionMenu.hide()
30
+ actionMenu.hideAll()
31
31
  }
32
32
  dispatch("click")
33
33
  }
@@ -35,7 +35,7 @@
35
35
 
36
36
  <!-- svelte-ignore a11y-click-events-have-key-events -->
37
37
  <li
38
- on:click|preventDefault={disabled ? null : onClick}
38
+ on:click={disabled ? null : onClick}
39
39
  class="spectrum-Menu-item"
40
40
  class:is-disabled={disabled}
41
41
  role="menuitem"
@@ -47,8 +47,9 @@
47
47
  </div>
48
48
  {/if}
49
49
  <span class="spectrum-Menu-itemLabel"><slot /></span>
50
- {#if keys?.length}
50
+ {#if keys?.length || $$slots.right}
51
51
  <div class="keys">
52
+ <slot name="right" />
52
53
  {#each keys as key}
53
54
  <div class="key">
54
55
  {#if key.startsWith("!")}
@@ -30,7 +30,9 @@
30
30
  export let custom = false
31
31
 
32
32
  const { hide, cancel } = getContext(Context.Modal)
33
+
33
34
  let loading = false
35
+
34
36
  $: confirmDisabled = disabled || loading
35
37
 
36
38
  async function secondary(e) {
@@ -90,7 +92,7 @@
90
92
 
91
93
  <!-- TODO: Remove content-grid class once Layout components are in bbui -->
92
94
  <section class="spectrum-Dialog-content content-grid">
93
- <slot />
95
+ <slot {loading} />
94
96
  </section>
95
97
  {#if showCancelButton || showConfirmButton || $$slots.footer}
96
98
  <div
@@ -145,6 +147,9 @@
145
147
  .spectrum-Dialog--extraLarge {
146
148
  width: 1000px;
147
149
  }
150
+ .spectrum-Dialog--medium {
151
+ width: 540px;
152
+ }
148
153
 
149
154
  .content-grid {
150
155
  display: grid;
@@ -27,11 +27,7 @@
27
27
  <div class="spectrum-Toast-body" class:actionBody={!!action}>
28
28
  <div class="wrap spectrum-Toast-content">{message || ""}</div>
29
29
  {#if action}
30
- <ActionButton
31
- quiet
32
- emphasized
33
- on:click={() => action(() => dispatch("dismiss"))}
34
- >
30
+ <ActionButton quiet on:click={() => action(() => dispatch("dismiss"))}>
35
31
  <div style="color: white; font-weight: 600;">{actionMessage}</div>
36
32
  </ActionButton>
37
33
  {/if}
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  import "@spectrum-css/popover/dist/index-vars.css"
3
3
  import Portal from "svelte-portal"
4
- import { createEventDispatcher, getContext } from "svelte"
4
+ import { createEventDispatcher, getContext, onDestroy } from "svelte"
5
5
  import positionDropdown from "../Actions/position_dropdown"
6
6
  import clickOutside from "../Actions/click_outside"
7
7
  import { fly } from "svelte/transition"
@@ -28,7 +28,24 @@
28
28
  export let resizable = true
29
29
  export let wrap = false
30
30
 
31
+ const animationDuration = 260
32
+
33
+ let timeout
34
+ let blockPointerEvents = false
35
+
31
36
  $: target = portalTarget || getContext(Context.PopoverRoot) || ".spectrum"
37
+ $: {
38
+ // Disable pointer events for the initial part of the animation, because we
39
+ // fly from top to bottom and initially can be positioned under the cursor,
40
+ // causing a flashing hover state in the content
41
+ if (open && animate) {
42
+ blockPointerEvents = true
43
+ clearTimeout(timeout)
44
+ timeout = setTimeout(() => {
45
+ blockPointerEvents = false
46
+ }, animationDuration / 2)
47
+ }
48
+ }
32
49
 
33
50
  export const show = () => {
34
51
  dispatch("open")
@@ -77,6 +94,10 @@
77
94
  hide()
78
95
  }
79
96
  }
97
+
98
+ onDestroy(() => {
99
+ clearTimeout(timeout)
100
+ })
80
101
  </script>
81
102
 
82
103
  {#if open}
@@ -104,9 +125,13 @@
104
125
  class="spectrum-Popover is-open"
105
126
  class:customZindex
106
127
  class:hidden={!showPopover}
128
+ class:blockPointerEvents
107
129
  role="presentation"
108
130
  style="height: {customHeight}; --customZindex: {customZindex};"
109
- transition:fly|local={{ y: -20, duration: animate ? 260 : 0 }}
131
+ transition:fly|local={{
132
+ y: -20,
133
+ duration: animate ? animationDuration : 0,
134
+ }}
110
135
  on:mouseenter
111
136
  on:mouseleave
112
137
  >
@@ -121,6 +146,12 @@
121
146
  border-color: var(--spectrum-global-color-gray-300);
122
147
  overflow: auto;
123
148
  transition: opacity 260ms ease-out;
149
+ filter: none;
150
+ -webkit-filter: none;
151
+ box-shadow: 0 1px 4px var(--drop-shadow);
152
+ }
153
+ .blockPointerEvents {
154
+ pointer-events: none;
124
155
  }
125
156
  .hidden {
126
157
  opacity: 0;
package/src/helpers.js CHANGED
@@ -228,3 +228,13 @@ export const getDateDisplayValue = (
228
228
  return value.format(`${localeDateFormat} HH:mm`)
229
229
  }
230
230
  }
231
+
232
+ export const hexToRGBA = (color, opacity) => {
233
+ if (color.includes("#")) {
234
+ color = color.replace("#", "")
235
+ }
236
+ const r = parseInt(color.substring(0, 2), 16)
237
+ const g = parseInt(color.substring(2, 4), 16)
238
+ const b = parseInt(color.substring(4, 6), 16)
239
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`
240
+ }
package/src/index.js CHANGED
@@ -21,6 +21,7 @@ export { default as EnvDropdown } from "./Form/EnvDropdown.svelte"
21
21
  export { default as Multiselect } from "./Form/Multiselect.svelte"
22
22
  export { default as Search } from "./Form/Search.svelte"
23
23
  export { default as RichTextField } from "./Form/RichTextField.svelte"
24
+ export { default as FieldLabel } from "./Form/FieldLabel.svelte"
24
25
  export { default as Slider } from "./Form/Slider.svelte"
25
26
  export { default as File } from "./Form/File.svelte"
26
27
 
@@ -39,6 +40,7 @@ export { default as ActionGroup } from "./ActionGroup/ActionGroup.svelte"
39
40
  export { default as ActionMenu } from "./ActionMenu/ActionMenu.svelte"
40
41
  export { default as Button } from "./Button/Button.svelte"
41
42
  export { default as ButtonGroup } from "./ButtonGroup/ButtonGroup.svelte"
43
+ export { default as CollapsedButtonGroup } from "./ButtonGroup/CollapsedButtonGroup.svelte"
42
44
  export { default as ClearButton } from "./ClearButton/ClearButton.svelte"
43
45
  export { default as Icon } from "./Icon/Icon.svelte"
44
46
  export { default as IconAvatar } from "./Icon/IconAvatar.svelte"