@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
62 lines (61 loc) • 2.32 kB
TypeScript
/**
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { type HTMLAttributes, type PropsWithChildren } from 'react';
type ThemeContextType = 'light' | 'dark';
export declare const ThemeContext: React.Context<ThemeContextType | undefined>;
type TokensContextType = {
[key: string]: any;
};
export declare const TokensContext: React.Context<TokensContextType | undefined>;
type NeedleThemeHook = () => {
theme: ThemeContextType;
/**
* A classname that can be used to scope
* elements that are portal-ed like
* Modals, Popovers, etc.
*/
themeClassName: string;
tokens?: TokensContextType;
};
/**
* Hook to access the current theme effortlessly
*/
export declare const useNeedleTheme: NeedleThemeHook;
interface NeedleThemeProviderProps extends PropsWithChildren {
theme?: 'dark' | 'light';
tokens?: TokensContextType;
children: any;
/**
* Nested theme providers will receive a wrapping `span` tag
* in order to set correctly the default text `color` that all nested
* children will inherit by adding the respective class `ndl-theme-{theme}`.
*
* If an extra wrapper is not desired, pass `{ isWrappingChildren : false }`.
* This requires child components accept and consumer className prop.
*
*/
wrapperProps?: HTMLAttributes<HTMLElement> & {
isWrappingChildren?: boolean;
};
}
export declare const NeedleThemeProvider: ({ theme, tokens, children, wrapperProps, }: NeedleThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
export {};
//# sourceMappingURL=ThemeProvider.d.ts.map