UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

123 lines (120 loc) 2.8 kB
import { c } from 'react-compiler-runtime'; import { AlertFillIcon, CheckCircleFillIcon } from '@primer/octicons-react'; import classes from './InputValidation.module.css.js'; import { clsx } from 'clsx'; import { jsxs, jsx } from 'react/jsx-runtime'; import Text from '../../Text/Text.js'; 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] : undefined; let t1; if ($[8] !== className) { t1 = clsx(className, classes.InputValidation); $[8] = className; $[9] = t1; } else { t1 = $[9]; } let t2; if ($[10] !== IconComponent) { t2 = IconComponent ? /*#__PURE__*/jsx("span", { "aria-hidden": "true", className: classes.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: id, className: classes.ValidationText, style: t3, children: 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, { ...rest, className: t1, "data-validation-status": validationStatus, style: 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; }; export { InputValidation as default };