import * as React from 'react' ; import { useLayoutEffect } from '@radix-ui/react-use-layout-effect' ; const useReactId = ( React as any ) [ 'useId' . toString ( ) ] || ( ( ) => undefined ) ; let count = 0 ; function useId ( deterministicId ? ) { const [ id , setId ] = React . useState < string | undefined > ( useReactId ( ) ) ; useLayoutEffect ( ( ) => { if ( ! deterministicId ) setId ( ( reactId ) => reactId ?? String ( count ++ ) ) ; } , [ deterministicId ] ) ; return deterministicId || ( id ? `radix-${ id }` : '' ) ; } function IdProvider ( { children } ) { React . useEffect ( ( ) => { if ( process . env . NODE_ENV === 'development' ) { console . warn ( ID_PROVIDER_DEPRECATED ) ; } } , [ ] ) ; return < > { children } < />; } const ID_PROVIDER_DEPRECATED = `Warning: The \`IdProvider\` has been deprecated. For details, see https://radix-ui.com/docs/primitives/utilities/id-provider` ; export { IdProvider , useId } ;