UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

26 lines (25 loc) 1.46 kB
import React 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?: React.RefObject<HTMLDivElement>; children: React.ReactNode; style?: React.CSSProperties & { [key: `--${string}`]: string | number; }; }; type IsolatedStyleScopeContextValue = { generatedScopeHash: string; scopeElementRef: React.RefObject<HTMLDivElement>; internalKeys: Set<string>; parentContextMap?: Map<string, IsolatedStyleScopeContextValue>; } & Pick<IsolatedStyleScopeProps, 'scopeHash' | 'disableCoreStyleWrapper' | 'style'>; export declare const IsolatedStyleScopeContext: React.Context<IsolatedStyleScopeContextValue>; export default function IsolatedStyleScope(props: IsolatedStyleScopeProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.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; };