UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

97 lines (94 loc) 2.34 kB
import { c } from 'react-compiler-runtime'; import { clsx } from 'clsx'; import styles from './TextInputInnerVisualSlot.module.css.js'; import { jsx, jsxs } from 'react/jsx-runtime'; import StyledSpinner from '../../Spinner/Spinner.js'; const TextInputInnerVisualSlot = t0 => { const $ = c(17); const { children, hasLoadingIndicator, showLoadingIndicator, visualPosition, id } = t0; const isLeading = visualPosition === "leading"; if (!children && !hasLoadingIndicator || isLeading && !children && !showLoadingIndicator) { return null; } if (!hasLoadingIndicator) { let t1; if ($[0] !== children || $[1] !== id) { t1 = /*#__PURE__*/jsx("span", { className: "TextInput-icon", id: id, "aria-hidden": "true", children: children }); $[0] = children; $[1] = id; $[2] = t1; } else { t1 = $[2]; } return t1; } let t1; if ($[3] !== children || $[4] !== showLoadingIndicator) { t1 = children && /*#__PURE__*/jsx("div", { className: clsx(showLoadingIndicator ? styles.SpinnerHidden : styles.SpinnerVisible), children: children }); $[3] = children; $[4] = showLoadingIndicator; $[5] = t1; } else { t1 = $[5]; } const t2 = showLoadingIndicator ? styles.SpinnerVisible : styles.SpinnerHidden; const t3 = children && styles.Spinner; const t4 = children && isLeading && styles.SpinnerLeading; let t5; if ($[6] !== t2 || $[7] !== t3 || $[8] !== t4) { t5 = clsx(t2, t3, t4); $[6] = t2; $[7] = t3; $[8] = t4; $[9] = t5; } else { t5 = $[9]; } const t6 = children ? undefined : "small"; let t7; if ($[10] !== t5 || $[11] !== t6) { t7 = /*#__PURE__*/jsx(StyledSpinner, { srText: null, className: t5, size: t6 }); $[10] = t5; $[11] = t6; $[12] = t7; } else { t7 = $[12]; } let t8; if ($[13] !== id || $[14] !== t1 || $[15] !== t7) { t8 = /*#__PURE__*/jsx("span", { className: "TextInput-icon", children: /*#__PURE__*/jsxs("div", { className: styles.Box, id: id, children: [t1, t7] }) }); $[13] = id; $[14] = t1; $[15] = t7; $[16] = t8; } else { t8 = $[16]; } return t8; }; export { TextInputInnerVisualSlot as default };