UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

232 lines (229 loc) • 5.17 kB
import { c } from 'react-compiler-runtime'; import React from 'react'; import { clsx } from 'clsx'; import styles from './TextInputWrapper.module.css.js'; import { jsx } from 'react/jsx-runtime'; const TextInputBaseWrapper = /*#__PURE__*/React.forwardRef(function TextInputBaseWrapper(t0, forwardRef) { const $ = c(43); let block; let className; let contrast; let disabled; let hasTrailingAction; let isInputFocused; let maxWidth; let minWidth; let monospace; let restProps; let size; let style; let validationStatus; let variant; let width; if ($[0] !== t0) { ({ className, style, variant, size, isInputFocused, hasTrailingAction, validationStatus, disabled, contrast, monospace, block, width, minWidth, maxWidth, ...restProps } = t0); $[0] = t0; $[1] = block; $[2] = className; $[3] = contrast; $[4] = disabled; $[5] = hasTrailingAction; $[6] = isInputFocused; $[7] = maxWidth; $[8] = minWidth; $[9] = monospace; $[10] = restProps; $[11] = size; $[12] = style; $[13] = validationStatus; $[14] = variant; $[15] = width; } else { block = $[1]; className = $[2]; contrast = $[3]; disabled = $[4]; hasTrailingAction = $[5]; isInputFocused = $[6]; maxWidth = $[7]; minWidth = $[8]; monospace = $[9]; restProps = $[10]; size = $[11]; style = $[12]; validationStatus = $[13]; variant = $[14]; width = $[15]; } let t1; if ($[16] !== width) { t1 = width ? { width } : {}; $[16] = width; $[17] = t1; } else { t1 = $[17]; } let t2; if ($[18] !== minWidth) { t2 = minWidth ? { minWidth } : {}; $[18] = minWidth; $[19] = t2; } else { t2 = $[19]; } let t3; if ($[20] !== maxWidth) { t3 = maxWidth ? { maxWidth } : {}; $[20] = maxWidth; $[21] = t3; } else { t3 = $[21]; } let t4; if ($[22] !== style || $[23] !== t1 || $[24] !== t2 || $[25] !== t3) { t4 = { ...t1, ...t2, ...t3, ...style }; $[22] = style; $[23] = t1; $[24] = t2; $[25] = t3; $[26] = t4; } else { t4 = $[26]; } const memoizedStyle = t4; let t5; if ($[27] !== className) { t5 = clsx(className, styles.TextInputBaseWrapper); $[27] = className; $[28] = t5; } else { t5 = $[28]; } const t6 = block || undefined; const t7 = contrast || undefined; const t8 = disabled || undefined; const t9 = isInputFocused || undefined; const t10 = monospace || undefined; const t11 = size || undefined; const t12 = hasTrailingAction || undefined; const t13 = validationStatus || undefined; const t14 = variant || undefined; let t15; if ($[29] !== forwardRef || $[30] !== memoizedStyle || $[31] !== restProps || $[32] !== t10 || $[33] !== t11 || $[34] !== t12 || $[35] !== t13 || $[36] !== t14 || $[37] !== t5 || $[38] !== t6 || $[39] !== t7 || $[40] !== t8 || $[41] !== t9) { t15 = /*#__PURE__*/jsx("span", { ref: forwardRef, className: t5, "data-block": t6, "data-contrast": t7, "data-disabled": t8, "data-focused": t9, "data-monospace": t10, "data-size": t11, "data-trailing-action": t12, "data-validation": t13, "data-variant": t14, style: memoizedStyle, ...restProps }); $[29] = forwardRef; $[30] = memoizedStyle; $[31] = restProps; $[32] = t10; $[33] = t11; $[34] = t12; $[35] = t13; $[36] = t14; $[37] = t5; $[38] = t6; $[39] = t7; $[40] = t8; $[41] = t9; $[42] = t15; } else { t15 = $[42]; } return t15; }); TextInputBaseWrapper.displayName = 'TextInputBaseWrapper'; const TextInputWrapper = /*#__PURE__*/React.forwardRef(function TextInputWrapper(t0, forwardRef) { const $ = c(13); let className; let hasLeadingVisual; let hasTrailingVisual; let restProps; if ($[0] !== t0) { ({ className, hasLeadingVisual, hasTrailingVisual, ...restProps } = t0); $[0] = t0; $[1] = className; $[2] = hasLeadingVisual; $[3] = hasTrailingVisual; $[4] = restProps; } else { className = $[1]; hasLeadingVisual = $[2]; hasTrailingVisual = $[3]; restProps = $[4]; } let t1; if ($[5] !== className) { t1 = clsx(className, styles.TextInputWrapper); $[5] = className; $[6] = t1; } else { t1 = $[6]; } const t2 = hasLeadingVisual || undefined; const t3 = hasTrailingVisual || undefined; let t4; if ($[7] !== forwardRef || $[8] !== restProps || $[9] !== t1 || $[10] !== t2 || $[11] !== t3) { t4 = /*#__PURE__*/jsx(TextInputBaseWrapper, { ref: forwardRef, className: t1, "data-leading-visual": t2, "data-trailing-visual": t3, ...restProps }); $[7] = forwardRef; $[8] = restProps; $[9] = t1; $[10] = t2; $[11] = t3; $[12] = t4; } else { t4 = $[12]; } return t4; }); export { TextInputBaseWrapper, TextInputWrapper, TextInputWrapper as default };