@budibase/bbui 2.9.33-alpha.0 → 2.9.33-alpha.2

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.9.33-alpha.0",
4
+ "version": "2.9.33-alpha.2",
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.9.33-alpha.0",
42
- "@budibase/string-templates": "2.9.33-alpha.0",
41
+ "@budibase/shared-core": "2.9.33-alpha.2",
42
+ "@budibase/string-templates": "2.9.33-alpha.2",
43
43
  "@spectrum-css/accordion": "3.0.24",
44
44
  "@spectrum-css/actionbutton": "1.0.1",
45
45
  "@spectrum-css/actiongroup": "1.0.1",
@@ -106,5 +106,5 @@
106
106
  }
107
107
  }
108
108
  },
109
- "gitHead": "54db09eaafd76cb0b942791ce609650dd7ab23c6"
109
+ "gitHead": "b7243d86d2b0c7871ba08bef072fe964d90662c5"
110
110
  }
@@ -17,6 +17,7 @@ export default function positionDropdown(element, opts) {
17
17
  maxWidth,
18
18
  useAnchorWidth,
19
19
  offset = 5,
20
+ customUpdate,
20
21
  } = opts
21
22
  if (!anchor) {
22
23
  return
@@ -32,33 +33,42 @@ export default function positionDropdown(element, opts) {
32
33
  left: null,
33
34
  top: null,
34
35
  }
35
- // Determine vertical styles
36
- if (align === "right-outside") {
37
- styles.top = anchorBounds.top
38
- } else if (window.innerHeight - anchorBounds.bottom < (maxHeight || 100)) {
39
- styles.top = anchorBounds.top - elementBounds.height - offset
40
- styles.maxHeight = maxHeight || 240
41
- } else {
42
- styles.top = anchorBounds.bottom + offset
43
- styles.maxHeight =
44
- maxHeight || window.innerHeight - anchorBounds.bottom - 20
45
- }
46
36
 
47
- // Determine horizontal styles
48
- if (!maxWidth && useAnchorWidth) {
49
- styles.maxWidth = anchorBounds.width
50
- }
51
- if (useAnchorWidth) {
52
- styles.minWidth = anchorBounds.width
53
- }
54
- if (align === "right") {
55
- styles.left = anchorBounds.left + anchorBounds.width - elementBounds.width
56
- } else if (align === "right-outside") {
57
- styles.left = anchorBounds.right + offset
58
- } else if (align === "left-outside") {
59
- styles.left = anchorBounds.left - elementBounds.width - offset
37
+ if (typeof customUpdate === "function") {
38
+ styles = customUpdate(anchorBounds, elementBounds, styles)
60
39
  } else {
61
- styles.left = anchorBounds.left
40
+ // Determine vertical styles
41
+ if (align === "right-outside") {
42
+ styles.top = anchorBounds.top
43
+ } else if (
44
+ window.innerHeight - anchorBounds.bottom <
45
+ (maxHeight || 100)
46
+ ) {
47
+ styles.top = anchorBounds.top - elementBounds.height - offset
48
+ styles.maxHeight = maxHeight || 240
49
+ } else {
50
+ styles.top = anchorBounds.bottom + offset
51
+ styles.maxHeight =
52
+ maxHeight || window.innerHeight - anchorBounds.bottom - 20
53
+ }
54
+
55
+ // Determine horizontal styles
56
+ if (!maxWidth && useAnchorWidth) {
57
+ styles.maxWidth = anchorBounds.width
58
+ }
59
+ if (useAnchorWidth) {
60
+ styles.minWidth = anchorBounds.width
61
+ }
62
+ if (align === "right") {
63
+ styles.left =
64
+ anchorBounds.left + anchorBounds.width - elementBounds.width
65
+ } else if (align === "right-outside") {
66
+ styles.left = anchorBounds.right + offset
67
+ } else if (align === "left-outside") {
68
+ styles.left = anchorBounds.left - elementBounds.width - offset
69
+ } else {
70
+ styles.left = anchorBounds.left
71
+ }
62
72
  }
63
73
 
64
74
  // Apply styles
@@ -44,7 +44,9 @@
44
44
  align-items: stretch;
45
45
  border-bottom: var(--border-light);
46
46
  }
47
-
47
+ .property-group-container:last-child {
48
+ border-bottom: 0px;
49
+ }
48
50
  .property-group-name {
49
51
  cursor: pointer;
50
52
  display: flex;
@@ -4,6 +4,8 @@
4
4
  import Body from "../Typography/Body.svelte"
5
5
  import Heading from "../Typography/Heading.svelte"
6
6
  import { setContext } from "svelte"
7
+ import { createEventDispatcher } from "svelte"
8
+ import { generate } from "shortid"
7
9
 
8
10
  export let title
9
11
  export let fillWidth
@@ -11,13 +13,17 @@
11
13
  export let width = "calc(100% - 626px)"
12
14
  export let headless = false
13
15
 
16
+ const dispatch = createEventDispatcher()
17
+
14
18
  let visible = false
19
+ let drawerId = generate()
15
20
 
16
21
  export function show() {
17
22
  if (visible) {
18
23
  return
19
24
  }
20
25
  visible = true
26
+ dispatch("drawerShow", drawerId)
21
27
  }
22
28
 
23
29
  export function hide() {
@@ -25,6 +31,7 @@
25
31
  return
26
32
  }
27
33
  visible = false
34
+ dispatch("drawerHide", drawerId)
28
35
  }
29
36
 
30
37
  setContext("drawer-actions", {
@@ -2,8 +2,8 @@
2
2
  import "@spectrum-css/inputgroup/dist/index-vars.css"
3
3
  import "@spectrum-css/popover/dist/index-vars.css"
4
4
  import "@spectrum-css/menu/dist/index-vars.css"
5
- import { fly } from "svelte/transition"
6
5
  import { createEventDispatcher } from "svelte"
6
+ import clickOutside from "../../Actions/click_outside"
7
7
 
8
8
  export let value = null
9
9
  export let id = null
@@ -80,10 +80,11 @@
80
80
  </svg>
81
81
  </button>
82
82
  {#if open}
83
- <div class="overlay" on:mousedown|self={() => (open = false)} />
84
83
  <div
85
- transition:fly|local={{ y: -20, duration: 200 }}
86
84
  class="spectrum-Popover spectrum-Popover--bottom is-open"
85
+ use:clickOutside={() => {
86
+ open = false
87
+ }}
87
88
  >
88
89
  <ul class="spectrum-Menu" role="listbox">
89
90
  {#if options && Array.isArray(options)}
@@ -125,14 +126,6 @@
125
126
  .spectrum-Textfield-input {
126
127
  width: 0;
127
128
  }
128
- .overlay {
129
- position: fixed;
130
- top: 0;
131
- left: 0;
132
- width: 100vw;
133
- height: 100vh;
134
- z-index: 999;
135
- }
136
129
  .spectrum-Popover {
137
130
  max-height: 240px;
138
131
  width: 100%;
@@ -23,6 +23,10 @@
23
23
  export let animate = true
24
24
  export let customZindex
25
25
 
26
+ export let handlePostionUpdate
27
+ export let showPopover = true
28
+ export let clickOutsideOverride = false
29
+
26
30
  $: target = portalTarget || getContext(Context.PopoverRoot) || ".spectrum"
27
31
 
28
32
  export const show = () => {
@@ -44,6 +48,9 @@
44
48
  }
45
49
 
46
50
  const handleOutsideClick = e => {
51
+ if (clickOutsideOverride) {
52
+ return
53
+ }
47
54
  if (open) {
48
55
  // Stop propagation if the source is the anchor
49
56
  let node = e.target
@@ -62,6 +69,9 @@
62
69
  }
63
70
 
64
71
  function handleEscape(e) {
72
+ if (!clickOutsideOverride) {
73
+ return
74
+ }
65
75
  if (open && e.key === "Escape") {
66
76
  hide()
67
77
  }
@@ -79,6 +89,7 @@
79
89
  maxWidth,
80
90
  useAnchorWidth,
81
91
  offset,
92
+ customUpdate: handlePostionUpdate,
82
93
  }}
83
94
  use:clickOutside={{
84
95
  callback: dismissible ? handleOutsideClick : () => {},
@@ -87,6 +98,7 @@
87
98
  on:keydown={handleEscape}
88
99
  class="spectrum-Popover is-open"
89
100
  class:customZindex
101
+ class:hide-popover={open && !showPopover}
90
102
  role="presentation"
91
103
  style="height: {customHeight}; --customZindex: {customZindex};"
92
104
  transition:fly|local={{ y: -20, duration: animate ? 200 : 0 }}
@@ -97,6 +109,10 @@
97
109
  {/if}
98
110
 
99
111
  <style>
112
+ .hide-popover {
113
+ display: contents;
114
+ }
115
+
100
116
  .spectrum-Popover {
101
117
  min-width: var(--spectrum-global-dimension-size-2000);
102
118
  border-color: var(--spectrum-global-color-gray-300);