@vectara/vectara-ui 19.4.0 → 19.5.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.
@@ -5,6 +5,7 @@ type Props = {
5
5
  email: string;
6
6
  info?: InfoListType;
7
7
  options?: OptionListItem<string>[];
8
+ after?: React.ReactNode;
8
9
  };
9
- export declare const VuiAccountButton: ({ userName, email, info, options, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const VuiAccountButton: ({ userName, email, info, options, after, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
10
11
  export {};
@@ -24,13 +24,13 @@ const Button = forwardRef((_a, ref) => {
24
24
  return (_jsx("button", Object.assign({ className: classes, type: "button" }, rest, { ref: ref, "aria-expanded": isSelected, "aria-haspopup": "menu" }, { children: children })));
25
25
  });
26
26
  export const VuiAccountButton = (_a) => {
27
- var { userName, email, info, options } = _a, rest = __rest(_a, ["userName", "email", "info", "options"]);
27
+ var { userName, email, info, options, after } = _a, rest = __rest(_a, ["userName", "email", "info", "options", "after"]);
28
28
  const [isOpen, setIsOpen] = useState(false);
29
29
  const areUnique = userName && email && userName !== email;
30
30
  const primaryLabel = areUnique ? userName : email;
31
31
  const secondaryLabel = areUnique ? email : null;
32
32
  const button = (_jsxs(Button, Object.assign({ isSelected: isOpen }, rest, { children: [_jsxs("div", Object.assign({ className: "vuiAccountButton__labels" }, { children: [_jsx("div", Object.assign({ className: "vuiAccountButton__primaryLabel" }, { children: primaryLabel })), secondaryLabel && _jsx("div", Object.assign({ className: "vuiAccountButton__secondaryLabel" }, { children: secondaryLabel }))] })), _jsx(VuiIcon, Object.assign({ size: "s", color: "neutral", className: "vuiAccountButton__icon" }, { children: _jsx(BiExpandVertical, {}) }))] })));
33
- return (_jsx(VuiInfoMenu, Object.assign({ isOpen: isOpen, setIsOpen: setIsOpen, button: button, info: info, anchorSide: "rightUp" }, { children: options && (_jsx(VuiOptionsList, { size: "l", onSelectOption: () => {
33
+ return (_jsx(VuiInfoMenu, Object.assign({ isOpen: isOpen, setIsOpen: setIsOpen, button: button, info: info, infoAfter: after, anchorSide: "rightUp" }, { children: options && (_jsx(VuiOptionsList, { size: "l", onSelectOption: () => {
34
34
  setIsOpen(false);
35
35
  }, options: options })) })));
36
36
  };
@@ -2,6 +2,7 @@ import { InfoListType } from "../infoList/InfoList";
2
2
  import { Props as PopoverProps } from "../popover/Popover";
3
3
  type Props = PopoverProps & {
4
4
  info?: InfoListType;
5
+ infoAfter?: React.ReactNode;
5
6
  };
6
- export declare const VuiInfoMenu: ({ isOpen, setIsOpen, button, info, children, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const VuiInfoMenu: ({ isOpen, setIsOpen, button, info, infoAfter, children, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -9,11 +9,11 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { VuiInfoList } from "../infoList/InfoList";
14
14
  import { VuiPopover } from "../popover/Popover";
15
15
  export const VuiInfoMenu = (_a) => {
16
- var { isOpen, setIsOpen, button, info, children } = _a, rest = __rest(_a, ["isOpen", "setIsOpen", "button", "info", "children"]);
16
+ var { isOpen, setIsOpen, button, info, infoAfter, children } = _a, rest = __rest(_a, ["isOpen", "setIsOpen", "button", "info", "infoAfter", "children"]);
17
17
  return (_jsx(VuiPopover, Object.assign({ className: "vuiInfoMenu", isOpen: isOpen, setIsOpen: () => setIsOpen(!isOpen), button: button, header: info &&
18
- info.length > 0 && (_jsx("div", Object.assign({ className: "vuiInfoMenuHeader" }, { children: _jsx(VuiInfoList, { info: info }) }))) }, rest, { children: children })));
18
+ info.length > 0 && (_jsxs("div", Object.assign({ className: "vuiInfoMenuHeader" }, { children: [_jsx(VuiInfoList, { info: info }), infoAfter] }))) }, rest, { children: children })));
19
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectara/vectara-ui",
3
- "version": "19.4.0",
3
+ "version": "19.5.0",
4
4
  "homepage": "./",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",
@@ -1,16 +1,24 @@
1
- import { BiLogOut, BiUser } from "react-icons/bi";
2
- import { OptionListItem, VuiAccountButton, VuiCopyButton, VuiFlexContainer, VuiFlexItem, VuiIcon } from "../../../lib";
1
+ import { BiLogOut, BiTransferAlt, BiUser } from "react-icons/bi";
2
+ import {
3
+ OptionListItem,
4
+ VuiAccountButton,
5
+ VuiButtonSecondary,
6
+ VuiCopyButton,
7
+ VuiFlexContainer,
8
+ VuiFlexItem,
9
+ VuiIcon
10
+ } from "../../../lib";
3
11
 
4
12
  export const AccountButton = () => {
5
13
  const options: OptionListItem<string>[] = [
6
14
  {
7
- value: "edit",
8
- label: "Manage account",
15
+ value: "switch",
16
+ label: "Switch accounts",
9
17
  color: "primary",
10
- testId: "profileOption",
18
+ testId: "switchOption",
11
19
  icon: (
12
20
  <VuiIcon>
13
- <BiUser />
21
+ <BiTransferAlt />
14
22
  </VuiIcon>
15
23
  )
16
24
  },
@@ -42,5 +50,29 @@ export const AccountButton = () => {
42
50
  }
43
51
  ];
44
52
 
45
- return <VuiAccountButton userName="Falcor" email="falcor@neverendingstory.com" options={options} info={info} />;
53
+ return (
54
+ <VuiAccountButton
55
+ userName="Falcor"
56
+ email="falcor@neverendingstory.com"
57
+ options={options}
58
+ info={info}
59
+ after={
60
+ <div style={{ paddingTop: "12px" }}>
61
+ <VuiButtonSecondary
62
+ fullWidth
63
+ size="s"
64
+ color="neutral"
65
+ onClick={() => console.log("Clicked")}
66
+ icon={
67
+ <VuiIcon>
68
+ <BiUser />
69
+ </VuiIcon>
70
+ }
71
+ >
72
+ Manage account
73
+ </VuiButtonSecondary>
74
+ </div>
75
+ }
76
+ />
77
+ );
46
78
  };