{"version":3,"sources":["jsdelivr-header.js","/npm/@rapid-platform/use-css-variables@1.0.0/esm/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCNS,cAAiB,eAQnB,SAAS,gBAAgB,EAAK,EAAQ,GACzC,WACA,WACI,IAAI,EAAI,EACR,IAAK,IAAQ,EACT,OACJ,IAAK,MAAO,EAAK,KAAU,OAAO,QAAQ,GAClC,QACuB,QAAtB,EAAK,EAAI,eAA4B,IAAP,GAAyB,EAAG,MAAM,YAAY,KAAK,IAAO,SAGlE,QAAtB,EAAK,EAAI,eAA4B,IAAP,GAAyB,EAAG,MAAM,YAAY,KAAK,IAAO,EAGrG,GAb2B,EAc/B","file":"/npm/@rapid-platform/use-css-variables@1.0.0/esm/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@rapid-platform/use-css-variables@1.0.0/esm/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { useEffect } from \"react\";\n/**\n * Adds CSS variables to the supplied ref\n *\n * @param {React.MutableRefObject<any>} ref - react mutable ref object for element to add varibales too\n * @param {S extends Record<string, string, number, undefined>} styles - object to map to css variables\n * @param {React.DependencyList} [deps] - A list of dependencies that when changed, re-compute class names.\n */\nexport function useCssVariables(ref, styles, deps) {\n    useEffect(onStylesChanged, deps);\n    function onStylesChanged() {\n        var _a, _b;\n        if (!ref || !styles)\n            return;\n        for (const [key, value] of Object.entries(styles)) {\n            if (value === undefined || value === null) {\n                (_a = ref.current) === null || _a === void 0 ? void 0 : _a.style.setProperty(`--${key}`, \"unset\");\n            }\n            else {\n                (_b = ref.current) === null || _b === void 0 ? void 0 : _b.style.setProperty(`--${key}`, value);\n            }\n        }\n    }\n}\n"]}