@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
1 lines • 1.23 kB
Source Map (JSON)
{"version":3,"file":"use-inject-vars.cjs","names":["injectVars","cssProps"],"sources":["../../../../src/core/css/use-inject-vars.ts"],"sourcesContent":["\"use client\"\n\nimport type { Dict } from \"../../utils\"\nimport type { CSSObject, CSSProperties } from \"./index.types\"\nimport { useMemo, useRef } from \"react\"\nimport { cssProps } from \"../components\"\nimport { injectVars } from \"../system\"\n\nexport function useInjectVarsIntoCss(\n css: CSSObject | CSSObject[] | undefined,\n targets: { [key in CSSProperties]?: string },\n) {\n const targetsRef = useRef(targets)\n\n return useMemo(() => injectVars(css, targetsRef.current), [css])\n}\n\nexport function useInjectVarsIntoProps<Y extends Dict | undefined>(\n props: Y,\n targets: { [key in CSSProperties]?: string },\n) {\n const targetsRef = useRef(targets)\n\n return useMemo(\n () => injectVars(props, targetsRef.current, (prop) => !cssProps.has(prop)),\n [props],\n )\n}\n"],"mappings":";;;;;;;;;;AAQA,SAAgB,qBACd,KACA,SACA;CACA,MAAM,+BAAoB,QAAQ;AAElC,iCAAqBA,uBAAW,KAAK,WAAW,QAAQ,EAAE,CAAC,IAAI,CAAC;;AAGlE,SAAgB,uBACd,OACA,SACA;CACA,MAAM,+BAAoB,QAAQ;AAElC,iCACQA,uBAAW,OAAO,WAAW,UAAU,SAAS,CAACC,uBAAS,IAAI,KAAK,CAAC,EAC1E,CAAC,MAAM,CACR"}