@cgi-learning-hub/ui
Version:
@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features
98 lines (97 loc) • 3.41 kB
JavaScript
import "react";
import { jsx as a } from "react/jsx-runtime";
import { P as e } from "./index-B9vkf41S.js";
import { d as y } from "./DefaultPropsProvider-BrmlvPWg.js";
import { X as m, T as b } from "./generateUtilityClasses-B_xKAflz.js";
import { u as d } from "./useTheme-DSA6Ir8k.js";
import { Global as T } from "@emotion/react";
import { e as h } from "./extendSxProp-DGsHTtAe.js";
function E(r) {
return r == null || Object.keys(r).length === 0;
}
function u(r) {
const {
styles: o,
defaultTheme: l = {}
} = r;
return /* @__PURE__ */ a(T, {
styles: typeof o == "function" ? (n) => o(E(n) ? l : n) : o
});
}
process.env.NODE_ENV !== "production" && (u.propTypes = {
defaultTheme: e.object,
styles: e.oneOfType([e.array, e.string, e.object, e.func])
});
function p(r) {
const o = m(r);
return r !== o && o.styles ? (o.styles.match(/^@layer\s+[^{]*$/) || (o.styles = `@layer global{${o.styles}}`), o) : r;
}
function f({
styles: r,
themeId: o,
defaultTheme: l = {}
}) {
const t = d(l), n = o && t[o] || t;
let s = typeof r == "function" ? r(n) : r;
return n.modularCssLayers && (Array.isArray(s) ? s = s.map((i) => p(typeof i == "function" ? i(n) : i)) : s = p(s)), /* @__PURE__ */ a(u, {
styles: s
});
}
process.env.NODE_ENV !== "production" && (f.propTypes = {
// ┌────────────────────────────── Warning ──────────────────────────────┐
// │ These PropTypes are generated from the TypeScript type definitions. │
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
// └─────────────────────────────────────────────────────────────────────┘
/**
* @ignore
*/
defaultTheme: e.object,
/**
* @ignore
*/
styles: e.oneOfType([e.array, e.func, e.number, e.object, e.string, e.bool]),
/**
* @ignore
*/
themeId: e.string
});
function c(r) {
return /* @__PURE__ */ a(f, {
...r,
defaultTheme: y,
themeId: b
});
}
process.env.NODE_ENV !== "production" && (c.propTypes = {
// ┌────────────────────────────── Warning ──────────────────────────────┐
// │ These PropTypes are generated from the TypeScript type definitions. │
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
// └─────────────────────────────────────────────────────────────────────┘
/**
* The styles you want to apply globally.
*/
styles: e.oneOfType([e.array, e.func, e.number, e.object, e.string, e.bool])
});
function j(r) {
return function(l) {
return (
// Pigment CSS `globalCss` support callback with theme inside an object but `GlobalStyles` support theme as a callback value.
/* @__PURE__ */ a(c, {
styles: typeof r == "function" ? (t) => r({
theme: t,
...l
}) : r
})
);
};
}
function D() {
return h;
}
export {
c as G,
f as a,
u as b,
j as g,
D as i
};