@budibase/bbui 1.3.3 → 1.3.4-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": "1.3.3",
4
+ "version": "1.3.4-alpha.2",
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": "^1.3.3",
41
+ "@budibase/string-templates": "1.3.4-alpha.2",
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": "6f8f76a76420f70ed3f365909daa6b3427eac46f"
88
+ "gitHead": "443f0d6360c2a91010d8f13de54a4b35e093a484"
89
89
  }
@@ -1,4 +1,4 @@
1
- export default function positionDropdown(element, { anchor, align }) {
1
+ export default function positionDropdown(element, { anchor, align, maxWidth }) {
2
2
  let positionSide = "top"
3
3
  let maxHeight = 0
4
4
  let dimensions = getDimensions(anchor)
@@ -34,13 +34,24 @@ export default function positionDropdown(element, { anchor, align }) {
34
34
  }
35
35
 
36
36
  function calcLeftPosition() {
37
- return align === "right"
38
- ? dimensions.left + dimensions.width - dimensions.containerWidth
39
- : dimensions.left
37
+ let left
38
+
39
+ if (align == "right") {
40
+ left = dimensions.left + dimensions.width - dimensions.containerWidth
41
+ } else if (align == "right-side") {
42
+ left = dimensions.left + dimensions.width
43
+ } else {
44
+ left = dimensions.left
45
+ }
46
+
47
+ return left
40
48
  }
41
49
 
42
50
  element.style.position = "absolute"
43
51
  element.style.zIndex = "9999"
52
+ if (maxWidth) {
53
+ element.style.maxWidth = `${maxWidth}px`
54
+ }
44
55
  element.style.minWidth = `${dimensions.width}px`
45
56
  element.style.maxHeight = `${maxHeight.toFixed(0)}px`
46
57
  element.style.transformOrigin = `center ${positionSide}`
@@ -54,10 +65,8 @@ export default function positionDropdown(element, { anchor, align }) {
54
65
  element.style.left = `${calcLeftPosition(dimensions).toFixed(0)}px`
55
66
  })
56
67
  })
57
-
58
68
  resizeObserver.observe(anchor)
59
69
  resizeObserver.observe(element)
60
-
61
70
  return {
62
71
  destroy() {
63
72
  resizeObserver.disconnect()
@@ -11,6 +11,7 @@
11
11
  export let align = "right"
12
12
  export let portalTarget
13
13
  export let dataCy
14
+ export let maxWidth
14
15
 
15
16
  export let direction = "bottom"
16
17
  export let showTip = false
@@ -45,7 +46,7 @@
45
46
  <Portal target={portalTarget}>
46
47
  <div
47
48
  tabindex="0"
48
- use:positionDropdown={{ anchor, align }}
49
+ use:positionDropdown={{ anchor, align, maxWidth }}
49
50
  use:clickOutside={hide}
50
51
  on:keydown={handleEscape}
51
52
  class={"spectrum-Popover is-open " + (tooltipClasses || "")}