@budibase/bbui 2.2.12-alpha.27 → 2.2.12-alpha.29

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.2.12-alpha.27",
4
+ "version": "2.2.12-alpha.29",
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.2.12-alpha.27",
41
+ "@budibase/string-templates": "2.2.12-alpha.29",
42
42
  "@spectrum-css/actionbutton": "1.0.1",
43
43
  "@spectrum-css/actiongroup": "1.0.1",
44
44
  "@spectrum-css/avatar": "3.0.2",
@@ -88,5 +88,5 @@
88
88
  "resolutions": {
89
89
  "loader-utils": "1.4.1"
90
90
  },
91
- "gitHead": "2c90339d637c0a49ea7a006c0060d07d4e3435aa"
91
+ "gitHead": "88e2460b18855a2ec115953f51ac470dc812202b"
92
92
  }
@@ -45,7 +45,9 @@
45
45
  getOptionLabel
46
46
  )
47
47
 
48
- const onClick = () => {
48
+ const onClick = e => {
49
+ e.preventDefault()
50
+ e.stopPropagation()
49
51
  dispatch("click")
50
52
  if (readonly) {
51
53
  return
@@ -88,7 +90,6 @@
88
90
  class:is-open={open}
89
91
  aria-haspopup="listbox"
90
92
  on:click={onClick}
91
- use:clickOutside={() => (open = false)}
92
93
  bind:this={button}
93
94
  >
94
95
  {#if fieldIcon}
@@ -130,14 +131,17 @@
130
131
  <Popover
131
132
  anchor={button}
132
133
  align="left"
133
- portalTarget={document.documentElement}
134
134
  bind:this={popover}
135
135
  {open}
136
136
  on:close={() => (open = false)}
137
137
  useAnchorWidth={!autoWidth}
138
138
  maxWidth={autoWidth ? 400 : null}
139
139
  >
140
- <div class="popover-content" class:auto-width={autoWidth}>
140
+ <div
141
+ class="popover-content"
142
+ class:auto-width={autoWidth}
143
+ use:clickOutside={() => (open = false)}
144
+ >
141
145
  {#if autocomplete}
142
146
  <Search
143
147
  value={searchTerm}
@@ -5,6 +5,8 @@
5
5
  import positionDropdown from "../Actions/position_dropdown"
6
6
  import clickOutside from "../Actions/click_outside"
7
7
  import { fly } from "svelte/transition"
8
+ import { getContext } from "svelte"
9
+ import Context from "../context"
8
10
 
9
11
  const dispatch = createEventDispatcher()
10
12
 
@@ -24,6 +26,7 @@
24
26
  $: tooltipClasses = showTip
25
27
  ? `spectrum-Popover--withTip spectrum-Popover--${direction}`
26
28
  : ""
29
+ $: target = portalTarget || getContext(Context.PopoverRoot) || ".spectrum"
27
30
 
28
31
  export const show = () => {
29
32
  dispatch("open")
@@ -61,7 +64,7 @@
61
64
  </script>
62
65
 
63
66
  {#if open}
64
- <Portal target={portalTarget}>
67
+ <Portal {target}>
65
68
  <div
66
69
  tabindex="0"
67
70
  use:positionDropdown={{ anchor, align, maxWidth, useAnchorWidth }}
package/src/context.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export default {
2
2
  Modal: "bbui-modal",
3
+ PopoverRoot: "bbui-popover-root",
3
4
  }