@budibase/bbui 2.0.30-alpha.7 → 2.0.30-alpha.9

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.0.30-alpha.7",
4
+ "version": "2.0.30-alpha.9",
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.0.30-alpha.7",
41
+ "@budibase/string-templates": "2.0.30-alpha.9",
42
42
  "@spectrum-css/actionbutton": "^1.0.1",
43
43
  "@spectrum-css/actiongroup": "^1.0.1",
44
44
  "@spectrum-css/avatar": "^3.0.2",
@@ -85,5 +85,5 @@
85
85
  "svelte-flatpickr": "^3.2.3",
86
86
  "svelte-portal": "^1.0.0"
87
87
  },
88
- "gitHead": "74511ef9396141daf6d0154eec2b7abc4e884470"
88
+ "gitHead": "60085b201ed6b960e92c57e236d4e88e5cac4977"
89
89
  }
@@ -1,18 +1,18 @@
1
1
  export default function clickOutside(element, callbackFunction) {
2
2
  function onClick(event) {
3
3
  if (!element.contains(event.target)) {
4
- callbackFunction()
4
+ callbackFunction(event)
5
5
  }
6
6
  }
7
7
 
8
- document.body.addEventListener("mousedown", onClick, true)
8
+ document.body.addEventListener("click", onClick, true)
9
9
 
10
10
  return {
11
11
  update(newCallbackFunction) {
12
12
  callbackFunction = newCallbackFunction
13
13
  },
14
14
  destroy() {
15
- document.body.removeEventListener("mousedown", onClick, true)
15
+ document.body.removeEventListener("click", onClick, true)
16
16
  },
17
17
  }
18
18
  }
@@ -33,6 +33,13 @@
33
33
  open = false
34
34
  }
35
35
 
36
+ const handleOutsideClick = e => {
37
+ if (open) {
38
+ e.stopPropagation()
39
+ hide()
40
+ }
41
+ }
42
+
36
43
  let open = null
37
44
 
38
45
  function handleEscape(e) {
@@ -47,7 +54,7 @@
47
54
  <div
48
55
  tabindex="0"
49
56
  use:positionDropdown={{ anchor, align, maxWidth }}
50
- use:clickOutside={hide}
57
+ use:clickOutside={handleOutsideClick}
51
58
  on:keydown={handleEscape}
52
59
  class={"spectrum-Popover is-open " + (tooltipClasses || "")}
53
60
  role="presentation"