@primer/react
Version:
An implementation of GitHub's Primer Design System using React
58 lines (57 loc) • 1.44 kB
JavaScript
import ValidationAnimationContainer_module_css_default from "./ValidationAnimationContainer.module.css.js";
import { c } from "react-compiler-runtime";
import { jsx } from "react/jsx-runtime";
import { useEffect, useState } from "react";
//#region src/internal/components/ValidationAnimationContainer.tsx
const ValidationAnimationContainer = (t0) => {
const $ = c(10);
const { show, children } = t0;
const [shouldRender, setRender] = useState(show);
let t1;
let t2;
if ($[0] !== show) {
t1 = () => {
if (show) setRender(true);
};
t2 = [show];
$[0] = show;
$[1] = t1;
$[2] = t2;
} else {
t1 = $[1];
t2 = $[2];
}
useEffect(t1, t2);
let t3;
if ($[3] !== show) {
t3 = () => {
if (!show) setRender(false);
};
$[3] = show;
$[4] = t3;
} else t3 = $[4];
const onAnimationEnd = t3;
let t4;
if ($[5] !== children || $[6] !== onAnimationEnd || $[7] !== shouldRender || $[8] !== show) {
t4 = shouldRender ? /*#__PURE__*/ jsx("div", {
style: {
height: show ? "auto" : 0,
overflow: "hidden"
},
children: /*#__PURE__*/ jsx("div", {
"data-show": show ? "" : void 0,
onAnimationEnd,
className: ValidationAnimationContainer_module_css_default.Animation,
children
})
}) : null;
$[5] = children;
$[6] = onAnimationEnd;
$[7] = shouldRender;
$[8] = show;
$[9] = t4;
} else t4 = $[9];
return t4;
};
//#endregion
export { ValidationAnimationContainer as default };