UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

119 lines (116 loc) 2.54 kB
import { c } from 'react-compiler-runtime'; import { useFormControlContext } from './_FormControlContext.js'; import { InputLabel } from '../internal/components/InputLabel.js'; import { jsx } from 'react/jsx-runtime'; const FormControlLabel = t0 => { const $ = c(27); let as; let children; let className; let htmlFor; let id; let props; let requiredText; let sx; let t1; let visuallyHidden; if ($[0] !== t0) { ({ as, children, htmlFor, id, visuallyHidden, requiredIndicator: t1, requiredText, sx, className, ...props } = t0); $[0] = t0; $[1] = as; $[2] = children; $[3] = className; $[4] = htmlFor; $[5] = id; $[6] = props; $[7] = requiredText; $[8] = sx; $[9] = t1; $[10] = visuallyHidden; } else { as = $[1]; children = $[2]; className = $[3]; htmlFor = $[4]; id = $[5]; props = $[6]; requiredText = $[7]; sx = $[8]; t1 = $[9]; visuallyHidden = $[10]; } const requiredIndicator = t1 === undefined ? true : t1; const { disabled, id: formControlId, required } = useFormControlContext(); let t2; if ($[11] !== as || $[12] !== className || $[13] !== disabled || $[14] !== formControlId || $[15] !== htmlFor || $[16] !== id || $[17] !== props || $[18] !== required || $[19] !== requiredIndicator || $[20] !== requiredText || $[21] !== sx || $[22] !== visuallyHidden) { t2 = as === "legend" || as === "span" ? { as, id, className, visuallyHidden, required, requiredText, requiredIndicator, disabled, sx, ...props } : { as, id, className, visuallyHidden, htmlFor: htmlFor || formControlId, required, requiredText, requiredIndicator, disabled, sx, ...props }; $[11] = as; $[12] = className; $[13] = disabled; $[14] = formControlId; $[15] = htmlFor; $[16] = id; $[17] = props; $[18] = required; $[19] = requiredIndicator; $[20] = requiredText; $[21] = sx; $[22] = visuallyHidden; $[23] = t2; } else { t2 = $[23]; } const labelProps = t2; let t3; if ($[24] !== children || $[25] !== labelProps) { t3 = /*#__PURE__*/jsx(InputLabel, { ...labelProps, children: children }); $[24] = children; $[25] = labelProps; $[26] = t3; } else { t3 = $[26]; } return t3; }; export { FormControlLabel as default };