UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

94 lines (90 loc) 2.27 kB
'use strict'; var reactCompilerRuntime = require('react-compiler-runtime'); var octiconsReact = require('@primer/octicons-react'); var InputValidation_module = require('./InputValidation.module.css.js'); var clsx = require('clsx'); var jsxRuntime = require('react/jsx-runtime'); var Text = require('../../Text/Text.js'); const validationIconMap = { success: octiconsReact.CheckCircleFillIcon, error: octiconsReact.AlertFillIcon }; const InputValidation = t0 => { const $ = reactCompilerRuntime.c(14); const { children, className, id, validationStatus, sx } = t0; const IconComponent = validationStatus ? validationIconMap[validationStatus] : undefined; let t1; if ($[0] !== className) { t1 = clsx.clsx(className, InputValidation_module.InputValidation); $[0] = className; $[1] = t1; } else { t1 = $[1]; } let t2; if ($[2] !== IconComponent) { t2 = IconComponent ? /*#__PURE__*/jsxRuntime.jsx("span", { "aria-hidden": "true", className: InputValidation_module.ValidationIcon, style: { "--inputValidation-iconSize": 16 }, children: /*#__PURE__*/jsxRuntime.jsx(IconComponent, { size: 12, fill: "currentColor" }) }) : null; $[2] = IconComponent; $[3] = t2; } else { t2 = $[3]; } let t3; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { t3 = { "--inputValidation-lineHeight": 1.3333333333333333 }; $[4] = t3; } else { t3 = $[4]; } let t4; if ($[5] !== children || $[6] !== id) { t4 = /*#__PURE__*/jsxRuntime.jsx("span", { id: id, className: InputValidation_module.ValidationText, style: t3, children: children }); $[5] = children; $[6] = id; $[7] = t4; } else { t4 = $[7]; } let t5; if ($[8] !== sx || $[9] !== t1 || $[10] !== t2 || $[11] !== t4 || $[12] !== validationStatus) { t5 = /*#__PURE__*/jsxRuntime.jsxs(Text, { className: t1, "data-validation-status": validationStatus, sx: sx, children: [t2, t4] }); $[8] = sx; $[9] = t1; $[10] = t2; $[11] = t4; $[12] = validationStatus; $[13] = t5; } else { t5 = $[13]; } return t5; }; module.exports = InputValidation;