@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
26 lines (25 loc) • 1.5 kB
TypeScript
import type { CSSProperties, ReactNode, RefObject } from 'react';
import { getStyleScopeHash } from '../plugins/postcss-isolated-style-scope/plugin-scope-hash.js';
export { getStyleScopeHash };
export type IsolatedStyleScopeProps = {
scopeHash?: string | 'auto';
disableCoreStyleWrapper?: boolean;
uniqueKey?: string | false;
ref?: RefObject<HTMLDivElement>;
children: ReactNode;
style?: CSSProperties & {
[key: `--${string}`]: string | number;
};
};
type IsolatedStyleScopeContextValue = {
generatedScopeHash: string;
scopeElementRef: RefObject<HTMLDivElement>;
internalKeys: Set<string>;
parentContextMap?: Map<string, IsolatedStyleScopeContextValue>;
} & Pick<IsolatedStyleScopeProps, 'scopeHash' | 'disableCoreStyleWrapper' | 'style'>;
export declare const IsolatedStyleScopeContext: import("react").Context<IsolatedStyleScopeContextValue>;
export default function IsolatedStyleScope(props: IsolatedStyleScopeProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode>> | import("react/jsx-runtime").JSX.Element;
export declare function getCurrentStyleScopeElement(currentElement: HTMLElement, scopeHash?: string, fallback?: any): any;
export declare function useIsolatedStyleScope(scopeHash?: string): {
getScopeElement: () => HTMLDivElement;
};