UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

40 lines (39 loc) 1.42 kB
import cl from "clsx"; import React from "react"; import { AkselColor } from "../types/index.js"; import { AsChildProps } from "../util/types/index.js"; type RenameCSSContext = { /** * Extends `clsx` with custom className handler */ cn: (...inputs: Parameters<typeof cl>) => ReturnType<typeof cl>; }; declare const useRenameCSS: <S extends boolean = true>(strict?: S) => S extends true ? RenameCSSContext : RenameCSSContext | undefined; export declare const compositeClassFunction: (...inputs: Parameters<typeof cl>) => string; type ThemeContext = { /** * Color theme * @default Inherits parent theme, or "light" if root */ theme?: "light" | "dark"; color?: AkselColor; /** * Indicates if Theme-component is used or not. * @default false */ isDarkside: boolean; }; declare const useThemeInternal: <S extends boolean = true>(strict?: S) => S extends true ? ThemeContext : ThemeContext | undefined; export type ThemeProps = { className?: string; /** * Sets default background when enabled */ hasBackground?: boolean; /** * Sets default 'base'-color for application */ "data-color"?: AkselColor; } & Omit<ThemeContext, "color" | "isDarkside"> & AsChildProps; declare const Theme: React.ForwardRefExoticComponent<ThemeProps & React.RefAttributes<HTMLDivElement>>; export { Theme, useRenameCSS, useThemeInternal };