UNPKG

koval-ui

Version:

React components collection with minimalistic design. Supports theming, layout, and input validation.

1 lines 825 B
{"version":3,"file":"useInternalRef.cjs","sources":["../../../../src/internal/hooks/useInternalRef.ts"],"sourcesContent":["import type {ForwardedRef} from 'react';\nimport {useImperativeHandle, useRef} from 'react';\n\n/** This hook allows to use forwarded ref inside component even if it's not provided. */\nexport const useInternalRef = <TElement = HTMLElement>(outerRef: ForwardedRef<TElement>) => {\n const innerRef = useRef<TElement | null>(null);\n useImperativeHandle<TElement | null, TElement | null>(outerRef, () => innerRef.current, [\n innerRef,\n ]);\n return innerRef;\n};\n"],"names":["useInternalRef","outerRef","innerRef","useRef","useImperativeHandle"],"mappings":"sHAIaA,EAA0CC,GAAqC,CAClF,MAAAC,EAAWC,SAAwB,IAAI,EACSC,OAAAA,EAAAA,oBAAAH,EAAU,IAAMC,EAAS,QAAS,CACpFA,CAAA,CACH,EACMA,CACX"}