UNPKG

@mskcc/carbon-react

Version:

Carbon react components for the MSKCC DSM

60 lines (59 loc) 2.13 kB
/** * MSKCC 2021, 2023 */ import PropTypes from 'prop-types'; import React, { ElementType, type PropsWithChildren } from 'react'; import { PolymorphicProps } from '../../types/common'; export type ThemeTypes = 'light' | 'dark'; export interface GlobalThemeProps { theme?: ThemeTypes; } export declare const ThemeContext: React.Context<GlobalThemeProps>; export declare function GlobalTheme({ children, theme, }: PropsWithChildren<GlobalThemeProps>): JSX.Element; export declare namespace GlobalTheme { var propTypes: { /** * Provide child elements to be rendered inside of `GlobalTheme`, this is * typically the root of your app */ children: PropTypes.Requireable<PropTypes.ReactNodeLike>; /** * Specify the global theme for your app */ theme: PropTypes.Requireable<string>; }; } export type ThemeBaseProps = GlobalThemeProps & { className?: string; }; export type ThemeProps<E extends ElementType> = PolymorphicProps<E, ThemeBaseProps>; /** * Specify the theme to be applied to a page, or a region in a page */ export declare function Theme<E extends ElementType = 'div'>({ as: BaseComponent, className: customClassName, theme, ...rest }: ThemeProps<E>): JSX.Element; export declare namespace Theme { var propTypes: { /** * Specify a custom component or element to be rendered as the top-level * element in the component */ as: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactComponentLike | null | undefined>>; /** * Provide child elements to be rendered inside of `Theme` */ children: PropTypes.Requireable<PropTypes.ReactNodeLike>; /** * Provide a custom class name to be used on the outermost element rendered by * the component */ className: PropTypes.Requireable<string>; /** * Specify the theme */ theme: PropTypes.Requireable<string>; }; } /** * Get access to the current theme */ export declare function useTheme(): GlobalThemeProps;