@vectara/vectara-ui 20.0.0 → 20.1.0

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,31 +1,10 @@
1
1
  import { ReactNode } from "react";
2
- import { FlexSpacing } from "./types";
3
- declare const alignItemsToClassNameMap: {
4
- readonly baseline: "vuiFlexContainer--alignItemsBaseline";
5
- readonly center: "vuiFlexContainer--alignItemsCenter";
6
- readonly end: "vuiFlexContainer--alignItemsEnd";
7
- readonly start: "vuiFlexContainer--alignItemsStart";
8
- readonly stretch: "vuiFlexContainer--alignItemsStretch";
9
- };
10
- declare const directionToClassNameMap: {
11
- readonly column: "vuiFlexContainer--directionColumn";
12
- readonly columnReverse: "vuiFlexContainer--directionColumnReverse";
13
- readonly row: "vuiFlexContainer--directionRow";
14
- readonly rowReverse: "vuiFlexContainer--directionRowReverse";
15
- };
16
- declare const justifyContentToClassNameMap: {
17
- readonly center: "vuiFlexContainer--justifyContentCenter";
18
- readonly end: "vuiFlexContainer--justifyContentEnd";
19
- readonly start: "vuiFlexContainer--justifyContentStart";
20
- readonly spaceAround: "vuiFlexContainer--justifyContentSpaceAround";
21
- readonly spaceBetween: "vuiFlexContainer--justifyContentSpaceBetween";
22
- readonly spaceEvenly: "vuiFlexContainer--justifyContentSpaceEvenly";
23
- };
2
+ import { AlignItemsPosition, FlexDirection, FlexSpacing, JustifyContentPosition } from "./types";
24
3
  export type Props = {
25
4
  children?: ReactNode;
26
- alignItems?: keyof typeof alignItemsToClassNameMap;
27
- direction?: keyof typeof directionToClassNameMap;
28
- justifyContent?: keyof typeof justifyContentToClassNameMap;
5
+ alignItems?: AlignItemsPosition;
6
+ direction?: FlexDirection;
7
+ justifyContent?: JustifyContentPosition;
29
8
  spacing?: FlexSpacing;
30
9
  wrap?: boolean;
31
10
  className?: string;
@@ -33,4 +12,3 @@ export type Props = {
33
12
  inline?: boolean;
34
13
  };
35
14
  export declare const VuiFlexContainer: ({ children, alignItems, direction, justifyContent, spacing, wrap, className, fullWidth, inline, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
36
- export {};
@@ -1,2 +1,8 @@
1
1
  export declare const FLEX_SPACING: readonly ["none", "xxs", "xs", "s", "m", "l", "xl", "xxl"];
2
2
  export type FlexSpacing = (typeof FLEX_SPACING)[number];
3
+ export declare const ALIGN_ITEMS_POSITION: readonly ["baseline", "center", "end", "start", "stretch"];
4
+ export type AlignItemsPosition = (typeof ALIGN_ITEMS_POSITION)[number];
5
+ export declare const FLEX_DIRECTION: readonly ["column", "columnReverse", "row", "rowReverse"];
6
+ export type FlexDirection = (typeof FLEX_DIRECTION)[number];
7
+ export declare const JUSTIFY_CONTENT_POSITION: readonly ["center", "end", "start", "spaceAround", "spaceBetween", "spaceEvenly"];
8
+ export type JustifyContentPosition = (typeof JUSTIFY_CONTENT_POSITION)[number];
@@ -1 +1,11 @@
1
1
  export const FLEX_SPACING = ["none", "xxs", "xs", "s", "m", "l", "xl", "xxl"];
2
+ export const ALIGN_ITEMS_POSITION = ["baseline", "center", "end", "start", "stretch"];
3
+ export const FLEX_DIRECTION = ["column", "columnReverse", "row", "rowReverse"];
4
+ export const JUSTIFY_CONTENT_POSITION = [
5
+ "center",
6
+ "end",
7
+ "start",
8
+ "spaceAround",
9
+ "spaceBetween",
10
+ "spaceEvenly"
11
+ ];
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { Props as VuiTooltipProps } from "../tooltip/Tooltip";
2
3
  export type AnchorSide = "left" | "right" | "rightUp" | "rightDown" | "leftUp" | "leftDown" | "upLeft" | "upRight";
3
4
  export type Props = {
4
5
  button: React.ReactElement;
@@ -12,5 +13,7 @@ export type Props = {
12
13
  anchorSide?: AnchorSide;
13
14
  anchorOffsetX?: number;
14
15
  anchorOffsetY?: number;
16
+ tooltip?: string;
17
+ tooltipProps?: Omit<VuiTooltipProps, "children" | "tip">;
15
18
  };
16
- export declare const VuiPopover: ({ button: originalButton, children, className, header, isOpen, setIsOpen, padding, anchorSide, anchorOffsetX, anchorOffsetY, onClickButton, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const VuiPopover: ({ button: originalButton, children, className, header, isOpen, setIsOpen, padding, anchorSide, anchorOffsetX, anchorOffsetY, onClickButton, tooltip, tooltipProps, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -15,6 +15,7 @@ import classNames from "classnames";
15
15
  import { VuiPortal } from "../portal/Portal";
16
16
  import { FocusOn } from "react-focus-on";
17
17
  import { VuiItemsInput, VuiNumberInput, VuiTextInput } from "../form";
18
+ import { VuiTooltip } from "../tooltip/Tooltip";
18
19
  const calculatePopoverPosition = (button, anchorOptions) => {
19
20
  if (!button)
20
21
  return undefined;
@@ -64,7 +65,7 @@ const calculatePopoverPosition = (button, anchorOptions) => {
64
65
  return { top: `${adjustedTop}px`, right: `${adjustedRight}px` };
65
66
  };
66
67
  export const VuiPopover = (_a) => {
67
- var { button: originalButton, children, className, header, isOpen, setIsOpen, padding, anchorSide = "right", anchorOffsetX = 2, anchorOffsetY = 2, onClickButton } = _a, rest = __rest(_a, ["button", "children", "className", "header", "isOpen", "setIsOpen", "padding", "anchorSide", "anchorOffsetX", "anchorOffsetY", "onClickButton"]);
68
+ var { button: originalButton, children, className, header, isOpen, setIsOpen, padding, anchorSide = "right", anchorOffsetX = 2, anchorOffsetY = 2, onClickButton, tooltip, tooltipProps } = _a, rest = __rest(_a, ["button", "children", "className", "header", "isOpen", "setIsOpen", "padding", "anchorSide", "anchorOffsetX", "anchorOffsetY", "onClickButton", "tooltip", "tooltipProps"]);
68
69
  const returnFocusElRef = useRef(null);
69
70
  const buttonRef = useRef(null);
70
71
  const [, setPositionMarker] = useState(0);
@@ -105,7 +106,8 @@ export const VuiPopover = (_a) => {
105
106
  setIsOpen(!isOpen);
106
107
  };
107
108
  }
108
- const button = cloneElement(originalButton, buttonProps);
109
+ const clonedButton = cloneElement(originalButton, buttonProps);
110
+ const button = tooltip !== undefined ? (_jsx(VuiTooltip, Object.assign({ tip: tooltip }, tooltipProps, { children: clonedButton }))) : (clonedButton);
109
111
  useEffect(() => {
110
112
  const updatePosition = () => {
111
113
  // Force a re-render when the window resizes.
@@ -1,6 +1,9 @@
1
+ import { AlignItemsPosition, FlexSpacing } from "../flex/types";
1
2
  type Props = {
2
3
  status: "error" | "warning" | "success" | "info";
3
4
  label: string;
5
+ gap?: FlexSpacing;
6
+ align?: AlignItemsPosition;
4
7
  };
5
- export declare const VuiStatus: ({ status, label }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const VuiStatus: ({ status, label, gap, align }: Props) => import("react/jsx-runtime").JSX.Element;
6
9
  export {};
@@ -17,8 +17,8 @@ const statusToIcon = {
17
17
  success: _jsx(BiCheck, {}),
18
18
  info: _jsx(BiInfoCircle, {})
19
19
  };
20
- export const VuiStatus = ({ status, label }) => {
20
+ export const VuiStatus = ({ status, label, gap = "xs", align = "center" }) => {
21
21
  const color = statusToColor[status];
22
22
  const icon = statusToIcon[status];
23
- return (_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "xs" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiIcon, Object.assign({ color: color }, { children: icon })) })), _jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiText, { children: _jsx("p", { children: _jsx(VuiTextColor, Object.assign({ color: color }, { children: label })) }) }) }))] })));
23
+ return (_jsxs(VuiFlexContainer, Object.assign({ alignItems: align, spacing: gap }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiIcon, Object.assign({ color: color }, { children: icon })) })), _jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx(VuiText, { children: _jsx("p", { children: _jsx(VuiTextColor, Object.assign({ color: color }, { children: label })) }) }) }))] })));
24
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectara/vectara-ui",
3
- "version": "20.0.0",
3
+ "version": "20.1.0",
4
4
  "homepage": "./",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",
@@ -49,6 +49,7 @@ export const Popover = () => {
49
49
  isOpen={isOpen}
50
50
  setIsOpen={() => setIsOpen(!isOpen)}
51
51
  header="Tribes"
52
+ tooltip="Select a tribe"
52
53
  button={
53
54
  <VuiButtonSecondary
54
55
  color="neutral"
@@ -1,4 +1,4 @@
1
- import { VuiSpacer, VuiStatus } from "../../../lib";
1
+ import { VuiSpacer, VuiStatus, VuiTitle } from "../../../lib";
2
2
 
3
3
  export const Status = () => {
4
4
  return (
@@ -17,7 +17,49 @@ export const Status = () => {
17
17
 
18
18
  <VuiStatus status="info" label="Info" />
19
19
 
20
- <VuiSpacer size="m" />
20
+ <VuiSpacer size="l" />
21
+
22
+ <div style={{ width: "300px" }}>
23
+ <VuiTitle size="s">
24
+ <h3>Multiline message</h3>
25
+ </VuiTitle>
26
+
27
+ <VuiSpacer size="m" />
28
+
29
+ <VuiStatus
30
+ status="error"
31
+ label="A multiline error message. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis placerat sem, ut mattis sapien."
32
+ gap="l"
33
+ align="start"
34
+ />
35
+
36
+ <VuiSpacer size="m" />
37
+
38
+ <VuiStatus
39
+ status="warning"
40
+ label="A multiline warning message. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis placerat sem, ut mattis sapien."
41
+ gap="l"
42
+ align="start"
43
+ />
44
+
45
+ <VuiSpacer size="m" />
46
+
47
+ <VuiStatus
48
+ status="success"
49
+ label="A multiline success message. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis placerat sem, ut mattis sapien."
50
+ gap="l"
51
+ align="start"
52
+ />
53
+
54
+ <VuiSpacer size="m" />
55
+
56
+ <VuiStatus
57
+ status="info"
58
+ label="A multiline info message. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis placerat sem, ut mattis sapien."
59
+ gap="l"
60
+ align="start"
61
+ />
62
+ </div>
21
63
  </>
22
64
  );
23
65
  };