@primer/react
Version:
An implementation of GitHub's Primer Design System using React
203 lines (200 loc) • 4.87 kB
JavaScript
import { c } from 'react-compiler-runtime';
import React from 'react';
import { clsx } from 'clsx';
import styles from './TextInputWrapper.module.css.js';
import { BoxWithFallback } from './BoxWithFallback.js';
import { jsx } from 'react/jsx-runtime';
const TextInputBaseWrapper = /*#__PURE__*/React.forwardRef(function TextInputBaseWrapper(t0, forwardRef) {
const $ = c(37);
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] !== className) {
t1 = clsx(className, styles.TextInputBaseWrapper);
$[16] = className;
$[17] = t1;
} else {
t1 = $[17];
}
const t2 = block || undefined;
const t3 = contrast || undefined;
const t4 = disabled || undefined;
const t5 = isInputFocused || undefined;
const t6 = monospace || undefined;
const t7 = size || undefined;
const t8 = hasTrailingAction || undefined;
const t9 = validationStatus || undefined;
const t10 = variant || undefined;
let t11;
if ($[18] !== maxWidth || $[19] !== minWidth || $[20] !== style || $[21] !== width) {
t11 = typeof width === "string" || typeof minWidth === "string" || typeof maxWidth === "string" ? {
width,
maxWidth,
minWidth,
...style
} : style;
$[18] = maxWidth;
$[19] = minWidth;
$[20] = style;
$[21] = width;
$[22] = t11;
} else {
t11 = $[22];
}
let t12;
if ($[23] !== forwardRef || $[24] !== restProps || $[25] !== t1 || $[26] !== t10 || $[27] !== t11 || $[28] !== t2 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5 || $[32] !== t6 || $[33] !== t7 || $[34] !== t8 || $[35] !== t9) {
t12 = /*#__PURE__*/jsx(BoxWithFallback, {
as: "span",
ref: forwardRef,
className: t1,
"data-block": t2,
"data-contrast": t3,
"data-disabled": t4,
"data-focused": t5,
"data-monospace": t6,
"data-size": t7,
"data-trailing-action": t8,
"data-validation": t9,
"data-variant": t10,
style: t11,
...restProps
});
$[23] = forwardRef;
$[24] = restProps;
$[25] = t1;
$[26] = t10;
$[27] = t11;
$[28] = t2;
$[29] = t3;
$[30] = t4;
$[31] = t5;
$[32] = t6;
$[33] = t7;
$[34] = t8;
$[35] = t9;
$[36] = t12;
} else {
t12 = $[36];
}
return t12;
});
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 };