/** * Replaces the colons in a React 18-style `useId()` value (e.g. `:r1:`) with * `«` / `»` so the result is a valid CSS identifier. * * React 18 uses colons as delimiters which are invalid in CSS selectors. * React 19.2+ switched to underscores (`_R__`) so no replacement is * needed there, but this function is still applied for safety — if the input * contains no colons it is returned unchanged. * * @internal */ export declare function sanitizeReactId(id: string): string; /** * Custom hook to generate a sanitized react useId for use in DOM selectors. * * React's `useId()` may return IDs containing colons (e.g., `:r1:`), which are valid in HTML * but **not valid CSS identifiers**. This can cause issues when using `querySelector` or when * libraries like `nwsapi` attempt to parse selectors, especially in test environments like jest * with jsdom. * * This hook replaces colons with a safe, reversible encoding (`«` and `»`) to ensure the ID * remains unique and usable in CSS selectors. The characters are chosen to be the same as in the * react 19.2+ implementation. * * Background: * - React previously used colons in generated IDs to avoid collisions. * - This caused parsing errors in selector engines like `nwsapi` when used in test environments. * - React addressed this in [facebook/react#32001](https://github.com/facebook/react/pull/32001) in React 19.2+. * * This hook provides a workaround for environments still using older React versions or needing * compatibility with selector engines that strictly enforce CSS syntax. * * @returns A sanitized ID string safe for use in `querySelector` and CSS selectors. * @public */ export declare function useId(): string; //# sourceMappingURL=useId.d.ts.map