@vectara/vectara-ui 12.0.0 → 12.0.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.
@@ -1,4 +1,4 @@
1
1
  import { TreeItem } from "../types";
2
- export declare const VuiAppSideNavLink: import("react").ForwardRefExoticComponent<Pick<TreeItem, "className" | "name" | "path" | "isSelected" | "iconBefore" | "iconAfter"> & {
2
+ export declare const VuiAppSideNavLink: import("react").ForwardRefExoticComponent<Pick<TreeItem, "className" | "path" | "name" | "isSelected" | "iconBefore" | "iconAfter"> & {
3
3
  onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
4
4
  } & import("react").RefAttributes<HTMLAnchorElement | null>>;
@@ -8,6 +8,7 @@ interface VuiContextType {
8
8
  getPath: PathProvider;
9
9
  DrawerTitle: keyof JSX.IntrinsicElements;
10
10
  getThemeStyle: (theme: "dark" | "light") => Record<string, string>;
11
+ portalContainer?: HTMLElement;
11
12
  }
12
13
  type Props = {
13
14
  children: ReactNode;
@@ -16,7 +17,8 @@ type Props = {
16
17
  drawerTitle?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
17
18
  theme?: Theme;
18
19
  isThemeIsolated?: boolean;
20
+ portalContainer?: HTMLElement;
19
21
  };
20
- export declare const VuiContextProvider: ({ children, linkProvider, pathProvider, drawerTitle, theme, isThemeIsolated }: Props) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const VuiContextProvider: ({ children, linkProvider, pathProvider, drawerTitle, theme, portalContainer, isThemeIsolated }: Props) => import("react/jsx-runtime").JSX.Element;
21
23
  export declare const useVuiContext: () => VuiContextType;
22
24
  export {};
@@ -13,7 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { createContext, useContext, useMemo, useEffect } from "react";
14
14
  import { LIGHT_THEME, DARK_THEME, toStyle } from "./Theme";
15
15
  const VuiContext = createContext(undefined);
16
- export const VuiContextProvider = ({ children, linkProvider, pathProvider, drawerTitle = "h2", theme = LIGHT_THEME, isThemeIsolated }) => {
16
+ export const VuiContextProvider = ({ children, linkProvider, pathProvider, drawerTitle = "h2", theme = LIGHT_THEME, portalContainer = document.body, isThemeIsolated }) => {
17
17
  const createLink = (linkConfig) => {
18
18
  if (linkProvider)
19
19
  return linkProvider(linkConfig);
@@ -44,7 +44,7 @@ export const VuiContextProvider = ({ children, linkProvider, pathProvider, drawe
44
44
  return toStyle(LIGHT_THEME);
45
45
  };
46
46
  const themedChildren = isThemeIsolated ? _jsx("div", Object.assign({ style: cssVariables }, { children: children })) : children;
47
- return (_jsx(VuiContext.Provider, Object.assign({ value: { createLink, getPath, DrawerTitle, getThemeStyle } }, { children: themedChildren })));
47
+ return (_jsx(VuiContext.Provider, Object.assign({ value: { createLink, getPath, DrawerTitle, getThemeStyle, portalContainer } }, { children: themedChildren })));
48
48
  };
49
49
  export const useVuiContext = () => {
50
50
  const context = useContext(VuiContext);
@@ -1,15 +1,19 @@
1
1
  import { useEffect, useRef } from "react";
2
2
  import { createPortal } from "react-dom";
3
+ import { useVuiContext } from "../context/Context";
3
4
  export const VuiPortal = ({ children }) => {
4
5
  // Initialize ref synchronously during the first render, ensuring portalRef.current
5
6
  // is immediately available for createPortal.
6
7
  const portalRef = useRef(document.createElement("div"));
8
+ const { portalContainer } = useVuiContext();
7
9
  useEffect(() => {
8
- document.body.appendChild(portalRef.current);
10
+ if (!portalContainer)
11
+ return;
12
+ portalContainer.appendChild(portalRef.current);
9
13
  return () => {
10
14
  var _a;
11
15
  (_a = portalRef.current.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(portalRef.current);
12
16
  };
13
- }, []);
17
+ }, [portalContainer]);
14
18
  return createPortal(children, portalRef.current);
15
19
  };
@@ -65,7 +65,7 @@
65
65
  white-space: nowrap;
66
66
  flex-grow: 0;
67
67
  flex-shrink: 0;
68
- color: var(--vui-color-subdued);
68
+ color: var(--vui-color-subdued-shade);
69
69
  text-decoration: none;
70
70
  cursor: pointer;
71
71
 
@@ -4,7 +4,7 @@ $color: (
4
4
  success: var(--vui-color-success-shade),
5
5
  warning: var(--vui-color-warning-shade),
6
6
  danger: var(--vui-color-danger-shade),
7
- subdued: var(--vui-color-subdued),
7
+ subdued: var(--vui-color-subdued-shade),
8
8
  neutral: var(--vui-color-text),
9
9
  empty: var(--vui-color-empty-shade)
10
10
  );
@@ -5111,7 +5111,7 @@ h2.react-datepicker__current-month {
5111
5111
  white-space: nowrap;
5112
5112
  flex-grow: 0;
5113
5113
  flex-shrink: 0;
5114
- color: var(--vui-color-subdued);
5114
+ color: var(--vui-color-subdued-shade);
5115
5115
  text-decoration: none;
5116
5116
  cursor: pointer;
5117
5117
  }
@@ -5664,7 +5664,7 @@ h2.react-datepicker__current-month {
5664
5664
  }
5665
5665
 
5666
5666
  .vuiTextColor--subdued {
5667
- color: var(--vui-color-subdued) !important;
5667
+ color: var(--vui-color-subdued-shade) !important;
5668
5668
  }
5669
5669
 
5670
5670
  .vuiTextColor--neutral {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectara/vectara-ui",
3
- "version": "12.0.0",
3
+ "version": "12.0.2",
4
4
  "homepage": "./",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",