@primer/react
Version:
An implementation of GitHub's Primer Design System using React
101 lines (100 loc) • 2.69 kB
JavaScript
import Text_default from "../../Text/Text.js";
import InputValidation_module_css_default from "./InputValidation.module.css.js";
import { c } from "react-compiler-runtime";
import { clsx } from "clsx";
import { jsx, jsxs } from "react/jsx-runtime";
import { AlertFillIcon, CheckCircleFillIcon } from "@primer/octicons-react";
//#region src/internal/components/InputValidation.tsx
const validationIconMap = {
success: CheckCircleFillIcon,
error: AlertFillIcon
};
const InputValidation = (t0) => {
const $ = c(24);
let children;
let className;
let dataComponent;
let id;
let rest;
let style;
let validationStatus;
if ($[0] !== t0) {
({children, className, id, validationStatus, style, "data-component": dataComponent, ...rest} = t0);
$[0] = t0;
$[1] = children;
$[2] = className;
$[3] = dataComponent;
$[4] = id;
$[5] = rest;
$[6] = style;
$[7] = validationStatus;
} else {
children = $[1];
className = $[2];
dataComponent = $[3];
id = $[4];
rest = $[5];
style = $[6];
validationStatus = $[7];
}
const IconComponent = validationStatus ? validationIconMap[validationStatus] : void 0;
let t1;
if ($[8] !== className) {
t1 = clsx(className, InputValidation_module_css_default.InputValidation);
$[8] = className;
$[9] = t1;
} else t1 = $[9];
let t2;
if ($[10] !== IconComponent) {
t2 = IconComponent ? /*#__PURE__*/ jsx("span", {
"aria-hidden": "true",
className: InputValidation_module_css_default.ValidationIcon,
style: { "--inputValidation-iconSize": 16 },
children: /*#__PURE__*/ jsx(IconComponent, {
size: 12,
fill: "currentColor"
})
}) : null;
$[10] = IconComponent;
$[11] = t2;
} else t2 = $[11];
let t3;
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
t3 = { "--inputValidation-lineHeight": 1.3333333333333333 };
$[12] = t3;
} else t3 = $[12];
let t4;
if ($[13] !== children || $[14] !== id) {
t4 = /*#__PURE__*/ jsx("span", {
id,
className: InputValidation_module_css_default.ValidationText,
style: t3,
children
});
$[13] = children;
$[14] = id;
$[15] = t4;
} else t4 = $[15];
let t5;
if ($[16] !== dataComponent || $[17] !== rest || $[18] !== style || $[19] !== t1 || $[20] !== t2 || $[21] !== t4 || $[22] !== validationStatus) {
t5 = /*#__PURE__*/ jsxs(Text_default, {
...rest,
className: t1,
"data-validation-status": validationStatus,
style,
"data-component": dataComponent,
children: [t2, t4]
});
$[16] = dataComponent;
$[17] = rest;
$[18] = style;
$[19] = t1;
$[20] = t2;
$[21] = t4;
$[22] = validationStatus;
$[23] = t5;
} else t5 = $[23];
return t5;
};
//#endregion
export { InputValidation as default };