@primer/react
Version:
An implementation of GitHub's Primer Design System using React
351 lines (347 loc) • 7.17 kB
JavaScript
'use strict';
var reactCompilerRuntime = require('react-compiler-runtime');
var clsx = require('clsx');
require('react');
var BlankslateContext = require('./BlankslateContext.js');
var Blankslate_module = require('./Blankslate.module.css.js');
var jsxRuntime = require('react/jsx-runtime');
var Button = require('../Button/Button.js');
var Link = require('../Link/Link.js');
function Blankslate(t0) {
const $ = reactCompilerRuntime.c(25);
let border;
let children;
let className;
let narrow;
let rest;
let spacious;
let t1;
if ($[0] !== t0) {
({
border,
children,
narrow,
spacious,
className,
size: t1,
...rest
} = t0);
$[0] = t0;
$[1] = border;
$[2] = children;
$[3] = className;
$[4] = narrow;
$[5] = rest;
$[6] = spacious;
$[7] = t1;
} else {
border = $[1];
children = $[2];
className = $[3];
narrow = $[4];
rest = $[5];
spacious = $[6];
t1 = $[7];
}
const size = t1 === undefined ? "medium" : t1;
let t2;
let t3;
if ($[8] !== size) {
t3 = {
size
};
$[8] = size;
$[9] = t3;
} else {
t3 = $[9];
}
t2 = t3;
const value = t2;
let t4;
if ($[10] !== className) {
t4 = clsx.clsx(Blankslate_module.Blankslate, className);
$[10] = className;
$[11] = t4;
} else {
t4 = $[11];
}
const t5 = border ? "" : undefined;
const t6 = narrow ? "" : undefined;
const t7 = spacious ? "" : undefined;
let t8;
if ($[12] !== children || $[13] !== size || $[14] !== t4 || $[15] !== t5 || $[16] !== t6 || $[17] !== t7) {
t8 = /*#__PURE__*/jsxRuntime.jsx("div", {
className: t4,
"data-border": t5,
"data-narrow": t6,
"data-spacious": t7,
"data-size": size,
children: children
});
$[12] = children;
$[13] = size;
$[14] = t4;
$[15] = t5;
$[16] = t6;
$[17] = t7;
$[18] = t8;
} else {
t8 = $[18];
}
let t9;
if ($[19] !== rest || $[20] !== t8) {
t9 = /*#__PURE__*/jsxRuntime.jsx("div", {
...rest,
className: Blankslate_module.Container,
children: t8
});
$[19] = rest;
$[20] = t8;
$[21] = t9;
} else {
t9 = $[21];
}
let t10;
if ($[22] !== t9 || $[23] !== value) {
t10 = /*#__PURE__*/jsxRuntime.jsx(BlankslateContext.Provider, {
value: value,
children: t9
});
$[22] = t9;
$[23] = value;
$[24] = t10;
} else {
t10 = $[24];
}
return t10;
}
function Visual(t0) {
const $ = reactCompilerRuntime.c(10);
let children;
let className;
let rest;
if ($[0] !== t0) {
({
children,
className,
...rest
} = t0);
$[0] = t0;
$[1] = children;
$[2] = className;
$[3] = rest;
} else {
children = $[1];
className = $[2];
rest = $[3];
}
let t1;
if ($[4] !== className) {
t1 = clsx.clsx("Blankslate-Visual", Blankslate_module.Visual, className);
$[4] = className;
$[5] = t1;
} else {
t1 = $[5];
}
let t2;
if ($[6] !== children || $[7] !== rest || $[8] !== t1) {
t2 = /*#__PURE__*/jsxRuntime.jsx("span", {
...rest,
className: t1,
children: children
});
$[6] = children;
$[7] = rest;
$[8] = t1;
$[9] = t2;
} else {
t2 = $[9];
}
return t2;
}
function Heading(t0) {
const $ = reactCompilerRuntime.c(12);
let children;
let className;
let rest;
let t1;
if ($[0] !== t0) {
({
as: t1,
children,
className,
...rest
} = t0);
$[0] = t0;
$[1] = children;
$[2] = className;
$[3] = rest;
$[4] = t1;
} else {
children = $[1];
className = $[2];
rest = $[3];
t1 = $[4];
}
const Component = t1 === undefined ? "h2" : t1;
let t2;
if ($[5] !== className) {
t2 = clsx.clsx("Blankslate-Heading", Blankslate_module.Heading, className);
$[5] = className;
$[6] = t2;
} else {
t2 = $[6];
}
let t3;
if ($[7] !== Component || $[8] !== children || $[9] !== rest || $[10] !== t2) {
t3 = /*#__PURE__*/jsxRuntime.jsx(Component, {
...rest,
className: t2,
children: children
});
$[7] = Component;
$[8] = children;
$[9] = rest;
$[10] = t2;
$[11] = t3;
} else {
t3 = $[11];
}
return t3;
}
function Description(t0) {
const $ = reactCompilerRuntime.c(10);
let children;
let className;
let rest;
if ($[0] !== t0) {
({
children,
className,
...rest
} = t0);
$[0] = t0;
$[1] = children;
$[2] = className;
$[3] = rest;
} else {
children = $[1];
className = $[2];
rest = $[3];
}
let t1;
if ($[4] !== className) {
t1 = clsx.clsx("Blankslate-Description", Blankslate_module.Description, className);
$[4] = className;
$[5] = t1;
} else {
t1 = $[5];
}
let t2;
if ($[6] !== children || $[7] !== rest || $[8] !== t1) {
t2 = /*#__PURE__*/jsxRuntime.jsx("p", {
...rest,
className: t1,
children: children
});
$[6] = children;
$[7] = rest;
$[8] = t1;
$[9] = t2;
} else {
t2 = $[9];
}
return t2;
}
function PrimaryAction(t0) {
const $ = reactCompilerRuntime.c(11);
let children;
let href;
let props;
if ($[0] !== t0) {
({
children,
href,
...props
} = t0);
$[0] = t0;
$[1] = children;
$[2] = href;
$[3] = props;
} else {
children = $[1];
href = $[2];
props = $[3];
}
const {
size
} = BlankslateContext.useBlankslate();
let t1;
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
t1 = clsx.clsx("Blankslate-Action", Blankslate_module.Action);
$[4] = t1;
} else {
t1 = $[4];
}
const t2 = href ? "a" : "button";
const t3 = size === "small" ? "small" : undefined;
let t4;
if ($[5] !== children || $[6] !== href || $[7] !== props || $[8] !== t2 || $[9] !== t3) {
t4 = /*#__PURE__*/jsxRuntime.jsx("div", {
className: t1,
children: /*#__PURE__*/jsxRuntime.jsx(Button.ButtonComponent, {
...props,
as: t2,
href: href,
variant: "primary",
size: t3,
children: children
})
});
$[5] = children;
$[6] = href;
$[7] = props;
$[8] = t2;
$[9] = t3;
$[10] = t4;
} else {
t4 = $[10];
}
return t4;
}
function SecondaryAction(t0) {
const $ = reactCompilerRuntime.c(4);
const {
children,
href
} = t0;
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t1 = clsx.clsx("Blankslate-Action", Blankslate_module.Action);
$[0] = t1;
} else {
t1 = $[0];
}
let t2;
if ($[1] !== children || $[2] !== href) {
t2 = /*#__PURE__*/jsxRuntime.jsx("div", {
className: t1,
children: /*#__PURE__*/jsxRuntime.jsx(Link, {
href: href,
children: children
})
});
$[1] = children;
$[2] = href;
$[3] = t2;
} else {
t2 = $[3];
}
return t2;
}
exports.Blankslate = Blankslate;
exports.Description = Description;
exports.Heading = Heading;
exports.PrimaryAction = PrimaryAction;
exports.SecondaryAction = SecondaryAction;
exports.Visual = Visual;