UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

162 lines (159 loc) 3.35 kB
import { c } from 'react-compiler-runtime'; import { clsx } from 'clsx'; import classes from './IssueLabel.module.css.js'; import { readableColor } from 'color2k'; import { jsx } from 'react/jsx-runtime'; function IssueLabel(t0) { const $ = c(36); let children; let className; let fillColor; let props; let style; let t1; if ($[0] !== t0) { ({ children, className, fillColor, style, variant: t1, ...props } = t0); $[0] = t0; $[1] = children; $[2] = className; $[3] = fillColor; $[4] = props; $[5] = style; $[6] = t1; } else { children = $[1]; className = $[2]; fillColor = $[3]; props = $[4]; style = $[5]; t1 = $[6]; } const variant = t1 === undefined ? "gray" : t1; let t2; if ($[7] !== className) { t2 = clsx(className, classes.IssueLabel); $[7] = className; $[8] = t2; } else { t2 = $[8]; } const t3 = fillColor ? undefined : variant; let t4; if ($[9] !== fillColor || $[10] !== style) { t4 = fillColor ? { ...style, backgroundColor: fillColor, color: readableColor(fillColor) } : style; $[9] = fillColor; $[10] = style; $[11] = t4; } else { t4 = $[11]; } let t5; if ($[12] !== t2 || $[13] !== t3 || $[14] !== t4) { t5 = { className: t2, "data-variant": t3, style: t4 }; $[12] = t2; $[13] = t3; $[14] = t4; $[15] = t5; } else { t5 = $[15]; } const sharedProps = t5; if ("as" in props && props.as) { let BaseComponent; let rest; if ($[16] !== props) { ({ as: BaseComponent, ...rest } = props); $[16] = props; $[17] = BaseComponent; $[18] = rest; } else { BaseComponent = $[17]; rest = $[18]; } let t6; if ($[19] !== BaseComponent || $[20] !== children || $[21] !== rest || $[22] !== sharedProps) { t6 = /*#__PURE__*/jsx(BaseComponent, { ...rest, ...sharedProps, children: children }); $[19] = BaseComponent; $[20] = children; $[21] = rest; $[22] = sharedProps; $[23] = t6; } else { t6 = $[23]; } return t6; } if ("href" in props) { let t6; if ($[24] !== children || $[25] !== props || $[26] !== sharedProps) { t6 = /*#__PURE__*/jsx("a", { ...props, ...sharedProps, children: children }); $[24] = children; $[25] = props; $[26] = sharedProps; $[27] = t6; } else { t6 = $[27]; } return t6; } if ("onClick" in props) { let t6; if ($[28] !== children || $[29] !== props || $[30] !== sharedProps) { t6 = /*#__PURE__*/jsx("button", { type: "button", ...props, ...sharedProps, children: children }); $[28] = children; $[29] = props; $[30] = sharedProps; $[31] = t6; } else { t6 = $[31]; } return t6; } let t6; if ($[32] !== children || $[33] !== props || $[34] !== sharedProps) { t6 = /*#__PURE__*/jsx("span", { ...props, ...sharedProps, children: children }); $[32] = children; $[33] = props; $[34] = sharedProps; $[35] = t6; } else { t6 = $[35]; } return t6; } export { IssueLabel };