@vectara/vectara-ui 13.14.0 → 13.14.1

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.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- export type AnchorSide = "left" | "right" | "rightUp";
2
+ export type AnchorSide = "left" | "right" | "rightUp" | "leftUp" | "upLeft" | "upRight";
3
3
  export type Props = {
4
4
  button: React.ReactElement;
5
5
  children?: React.ReactNode;
@@ -26,6 +26,23 @@ const calculatePopoverPosition = (button, anchorSide) => {
26
26
  const adjustedLeft = left + width + 26;
27
27
  return { top: `${adjustedTop}px`, left: `${adjustedLeft}px` };
28
28
  }
29
+ if (anchorSide === "leftUp") {
30
+ // Anchor popover to the left side of the button, extending upwards.
31
+ const adjustedTop = top + height + document.documentElement.scrollTop;
32
+ const adjustedRight = document.documentElement.clientWidth - left + 26;
33
+ return { top: `${adjustedTop}px`, right: `${adjustedRight}px` };
34
+ }
35
+ if (anchorSide === "upLeft") {
36
+ // Anchor popover above the button, aligned to the left edge.
37
+ const adjustedBottom = document.documentElement.clientHeight - top + 2;
38
+ return { bottom: `${adjustedBottom}px`, left: `${left}px` };
39
+ }
40
+ if (anchorSide === "upRight") {
41
+ // Anchor popover above the button, aligned to the right edge.
42
+ const adjustedBottom = document.documentElement.clientHeight - top + 2;
43
+ const adjustedRight = document.documentElement.clientWidth - right;
44
+ return { bottom: `${adjustedBottom}px`, right: `${adjustedRight}px` };
45
+ }
29
46
  const adjustedTop = bottom + 2 + document.documentElement.scrollTop;
30
47
  if (anchorSide === "left") {
31
48
  return { top: `${adjustedTop}px`, left: `${left}px` };
@@ -115,7 +132,10 @@ export const VuiPopover = (_a) => {
115
132
  const position = calculatePopoverPosition(buttonRef.current, anchorSide);
116
133
  const classes = classNames("vuiPopover", className, {
117
134
  "vuiPopover-isLoaded": showTransition,
118
- "vuiPopover--rightUp": anchorSide === "rightUp"
135
+ "vuiPopover--rightUp": anchorSide === "rightUp",
136
+ "vuiPopover--leftUp": anchorSide === "leftUp",
137
+ "vuiPopover--upLeft": anchorSide === "upLeft",
138
+ "vuiPopover--upRight": anchorSide === "upRight"
119
139
  });
120
140
  const contentClasses = classNames("vuiPopoverContent", {
121
141
  "vuiPopoverContent--padding": padding
@@ -16,10 +16,16 @@
16
16
  overflow: visible;
17
17
  }
18
18
 
19
- .vuiPopover--rightUp {
19
+ .vuiPopover--rightUp,
20
+ .vuiPopover--leftUp {
20
21
  transform: translateY(-100%) !important;
21
22
  }
22
23
 
24
+ .vuiPopover--upLeft,
25
+ .vuiPopover--upRight {
26
+ transform: translateY($sizeXs);
27
+ }
28
+
23
29
  .vuiPopover-isLoaded {
24
30
  visibility: visible;
25
31
  opacity: 1;
@@ -4222,10 +4222,16 @@ h2.react-datepicker__current-month {
4222
4222
  overflow: visible;
4223
4223
  }
4224
4224
 
4225
- .vuiPopover--rightUp {
4225
+ .vuiPopover--rightUp,
4226
+ .vuiPopover--leftUp {
4226
4227
  transform: translateY(-100%) !important;
4227
4228
  }
4228
4229
 
4230
+ .vuiPopover--upLeft,
4231
+ .vuiPopover--upRight {
4232
+ transform: translateY(8px);
4233
+ }
4234
+
4229
4235
  .vuiPopover-isLoaded {
4230
4236
  visibility: visible;
4231
4237
  opacity: 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectara/vectara-ui",
3
- "version": "13.14.0",
3
+ "version": "13.14.1",
4
4
  "homepage": "./",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",