@primer/react
Version:
An implementation of GitHub's Primer Design System using React
60 lines (59 loc) • 1.54 kB
JavaScript
import Hidden_module_css_default from "./Hidden.module.css.js";
import { c } from "react-compiler-runtime";
import { clsx } from "clsx";
import { jsx } from "react/jsx-runtime";
//#region src/Hidden/Hidden.tsx
function normalize(hiddenViewports) {
if (Array.isArray(hiddenViewports)) {
const breakpoints = {};
for (const breakpoint of hiddenViewports) breakpoints[breakpoint] = true;
return breakpoints;
}
return { [hiddenViewports]: true };
}
const Hidden = (t0) => {
const $ = c(11);
const { when, className, style, children } = t0;
const normalizedStyles = normalize(when);
let t1;
if ($[0] !== className) {
t1 = clsx(className, Hidden_module_css_default.Hidden);
$[0] = className;
$[1] = t1;
} else t1 = $[1];
const t2 = normalizedStyles.narrow ? "none" : void 0;
const t3 = normalizedStyles.regular ? "none" : void 0;
const t4 = normalizedStyles.wide ? "none" : void 0;
let t5;
if ($[2] !== style || $[3] !== t2 || $[4] !== t3 || $[5] !== t4) {
t5 = {
"--hiddenDisplay-narrow": t2,
"--hiddenDisplay-regular": t3,
"--hiddenDisplay-wide": t4,
...style
};
$[2] = style;
$[3] = t2;
$[4] = t3;
$[5] = t4;
$[6] = t5;
} else t5 = $[6];
const t6 = t5;
let t7;
if ($[7] !== children || $[8] !== t1 || $[9] !== t6) {
t7 = /*#__PURE__*/ jsx("div", {
className: t1,
style: t6,
"data-component": "Hidden",
children
});
$[7] = children;
$[8] = t1;
$[9] = t6;
$[10] = t7;
} else t7 = $[10];
return t7;
};
Hidden.displayName = "Hidden";
//#endregion
export { Hidden };