import React$1, { MutableRefObject, ReactNode } from 'react'; import { ColorTokens } from '@contentful/f36-tokens'; interface PortalProps { children: React.ReactElement; /** * Container element for Portal */ container?: Document | HTMLElement; } declare function Portal({ children, container: containerElement, }: PortalProps): React.ReactPortal | null; interface UseKeyboardProps { /** * Object of key names and handlers defines which key to look for i.e. `ArrowUp`, `Escape`, `Shift` * value is a callback function to be called when key matches */ keys: { [key: string]: (e: KeyboardEvent) => void; }; /** * Defines the attached event type * @default 'keydown' */ event?: 'keyup' | 'keypress' | 'keydown'; /** * React reference to attach the event to its current element */ ref?: MutableRefObject; } /** * * @description hook to attach a handler keyboard event listener to `document` or `HTMLElements` with garbage collection * @example * useKeyboard({ * event: 'keydown', // Optional, default is `keydown` * ref: yourReactRef, // Optional, by default event is attached to document * keys: { * ArrowUp: (e) => handleArrowUp(e), * Tab: (e) => handleTab(e) * } * }) */ declare const useKeyboard: (props: UseKeyboardProps) => void; interface MatchObj { before: string; match: string; after: string; } /** * Function that can be used to find a substring inside another string. * It needs two strings, the second one will be used in a Regex expression * to be matched to the first one. * The function will return an object containing the match, what comes before the match, * and what comes after the match in the base string * * @param base * @param match */ declare function getStringMatch(base: string, match: string): MatchObj; /** * Converts a hex color to rgba * @param hex - Hex color * @param alpha - Alpha value @default 1 * @returns rgba color * @example * hexToRGBA('#000000', 0.5) */ declare function hexToRGBA(hex: string, alpha?: number): string; /** * Recursively extracts text and numbers from React children to return as a * combined string. * * @param children - React node to extract text from * @returns String with all child nodes' text combined */ declare function getTextFromChildren(children: ReactNode): string; type Density = 'low' | 'high'; /** * Use this hook to adapt your component styling/rendering based on the density. * The density is retrieved from the `DensityProvider`. */ declare const useDensity: () => Density; declare const DensityProvider: React$1.Provider; type Variant = 'primary' | 'secondary' | 'positive' | 'negative' | 'transparent' | 'muted' | 'white' | 'premium' | 'warning' | 'primary-filled' | 'featured' | 'neutral'; /** * Universal icon color mapping by variant for all components. * Components can use this directly or extend/override as needed. */ declare const iconColorByVariant: Record; /** * Returns the color token for a given variant using the provided mapping. * @param variant - The variant key (e.g., 'primary', 'negative', etc.) * @param mapping - An object mapping variants to color tokens * @returns The color token string */ /** * Returns the color token for a given variant using the provided mapping. * Accepts a partial mapping so components only need to specify the variants they use. * Throws an error if the variant is not found in the mapping. */ declare function getIconColorToken(variant: Variant, mapping: Partial>): ColorTokens; export { type Density, DensityProvider, Portal, type PortalProps, type UseKeyboardProps, type Variant, getIconColorToken, getStringMatch, getTextFromChildren, hexToRGBA, iconColorByVariant, useDensity, useKeyboard };