UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

124 lines (120 loc) 2.89 kB
'use strict'; var reactCompilerRuntime = require('react-compiler-runtime'); var clsx = require('clsx'); var ThemeProvider = require('./ThemeProvider.js'); var BaseStyles_module = require('./BaseStyles.module.css.js'); require('focus-visible'); var BoxWithFallback = require('./internal/components/BoxWithFallback.js'); var jsxRuntime = require('react/jsx-runtime'); function BaseStyles(t0) { const $ = reactCompilerRuntime.c(27); let children; let className; let color; let fontFamily; let lineHeight; let rest; let style; let t1; if ($[0] !== t0) { ({ children, color, fontFamily, lineHeight, className, as: t1, style, ...rest } = t0); $[0] = t0; $[1] = children; $[2] = className; $[3] = color; $[4] = fontFamily; $[5] = lineHeight; $[6] = rest; $[7] = style; $[8] = t1; } else { children = $[1]; className = $[2]; color = $[3]; fontFamily = $[4]; lineHeight = $[5]; rest = $[6]; style = $[7]; t1 = $[8]; } const Component = t1 === undefined ? "div" : t1; const { colorMode, colorScheme, dayScheme, nightScheme } = ThemeProvider.useTheme(); let t2; if ($[9] !== className) { t2 = clsx.clsx(BaseStyles_module.BaseStyles, className); $[9] = className; $[10] = t2; } else { t2 = $[10]; } const newClassName = t2; let t3; if ($[11] !== color || $[12] !== fontFamily || $[13] !== lineHeight) { t3 = { "--BaseStyles-fgColor": color, "--BaseStyles-fontFamily": fontFamily, "--BaseStyles-lineHeight": lineHeight }; $[11] = color; $[12] = fontFamily; $[13] = lineHeight; $[14] = t3; } else { t3 = $[14]; } const baseStyles = t3; const t4 = colorMode === "auto" ? "auto" : colorScheme !== null && colorScheme !== void 0 && colorScheme.includes("dark") ? "dark" : "light"; let t5; if ($[15] !== baseStyles || $[16] !== style) { t5 = { ...baseStyles, ...style }; $[15] = baseStyles; $[16] = style; $[17] = t5; } else { t5 = $[17]; } let t6; if ($[18] !== Component || $[19] !== children || $[20] !== dayScheme || $[21] !== newClassName || $[22] !== nightScheme || $[23] !== rest || $[24] !== t4 || $[25] !== t5) { t6 = /*#__PURE__*/jsxRuntime.jsx(BoxWithFallback.BoxWithFallback, { as: Component, className: newClassName, "data-portal-root": true, "data-color-mode": t4, "data-light-theme": dayScheme, "data-dark-theme": nightScheme, style: t5, ...rest, children: children }); $[18] = Component; $[19] = children; $[20] = dayScheme; $[21] = newClassName; $[22] = nightScheme; $[23] = rest; $[24] = t4; $[25] = t5; $[26] = t6; } else { t6 = $[26]; } return t6; } module.exports = BaseStyles;