@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.
- package/lib/components/app/appSideNav/AppSideNavLink.d.ts +1 -1
- package/lib/components/context/Context.d.ts +3 -1
- package/lib/components/context/Context.js +2 -2
- package/lib/components/portal/Portal.js +6 -2
- package/lib/components/tabs/_index.scss +1 -1
- package/lib/components/typography/_textColor.scss +1 -1
- package/lib/styles/index.css +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TreeItem } from "../types";
|
|
2
|
-
export declare const VuiAppSideNavLink: import("react").ForwardRefExoticComponent<Pick<TreeItem, "className" | "
|
|
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
|
-
|
|
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
|
};
|
|
@@ -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
|
);
|
package/lib/styles/index.css
CHANGED
|
@@ -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 {
|