@cgi-learning-hub/ui
Version:
@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features
307 lines (306 loc) • 8.1 kB
JavaScript
import { Y as A, Z as V, Q as W, _ as Y, U as Z, V as j, I as G, K as J, u as X, T as ee } from "./identifier-PWESmBq6.js";
import * as I from "react";
import { P as x } from "./index-Sy88PpwE.js";
import { jsx as te } from "react/jsx-runtime";
function Ne(e, n, t = void 0) {
const o = {};
for (const r in e) {
const u = e[r];
let i = "", s = !0;
for (let d = 0; d < u.length; d += 1) {
const c = u[d];
c && (i += (s === !0 ? "" : " ") + n(c), s = !1, t && t[c] && (i += " " + t[c]));
}
o[r] = i;
}
return o;
}
function z(e, n = "") {
return e.displayName || e.name || n;
}
function k(e, n, t) {
const o = z(n);
return e.displayName || (o !== "" ? `${t}(${o})` : t);
}
function ne(e) {
if (e != null) {
if (typeof e == "string")
return e;
if (typeof e == "function")
return z(e, "Component");
if (typeof e == "object")
switch (e.$$typeof) {
case A.ForwardRef:
return k(e, e.render, "ForwardRef");
case A.Memo:
return k(e, e.type, "memo");
default:
return;
}
}
}
function re(e) {
const {
variants: n,
...t
} = e, o = {
variants: n,
style: V(t),
isProcessed: !0
};
return o.style === t || n && n.forEach((r) => {
typeof r.style != "function" && (r.style = V(r.style));
}), o;
}
const oe = W();
function b(e) {
return e !== "ownerState" && e !== "theme" && e !== "sx" && e !== "as";
}
function se(e) {
return e ? (n, t) => t[e] : null;
}
function ie(e, n, t) {
e.theme = fe(e.theme) ? t : e.theme[n] || e.theme;
}
function O(e, n) {
const t = typeof n == "function" ? n(e) : n;
if (Array.isArray(t))
return t.flatMap((o) => O(e, o));
if (Array.isArray(t == null ? void 0 : t.variants)) {
let o;
if (t.isProcessed)
o = t.style;
else {
const {
variants: r,
...u
} = t;
o = u;
}
return H(e, t.variants, [o]);
}
return t != null && t.isProcessed ? t.style : t;
}
function H(e, n, t = []) {
var r;
let o;
e: for (let u = 0; u < n.length; u += 1) {
const i = n[u];
if (typeof i.props == "function") {
if (o ?? (o = {
...e,
...e.ownerState,
ownerState: e.ownerState
}), !i.props(o))
continue;
} else
for (const s in i.props)
if (e[s] !== i.props[s] && ((r = e.ownerState) == null ? void 0 : r[s]) !== i.props[s])
continue e;
typeof i.style == "function" ? (o ?? (o = {
...e,
...e.ownerState,
ownerState: e.ownerState
}), t.push(i.style(o))) : t.push(i.style);
}
return t;
}
function ue(e = {}) {
const {
themeId: n,
defaultTheme: t = oe,
rootShouldForwardProp: o = b,
slotShouldForwardProp: r = b
} = e;
function u(s) {
ie(s, n, t);
}
return (s, d = {}) => {
Y(s, (a) => a.filter((f) => f !== j));
const {
name: c,
slot: y,
skipVariantsResolver: F,
skipSx: M,
// TODO v6: remove `lowercaseFirstLetter()` in the next major release
// For more details: https://github.com/mui/material-ui/pull/37908
overridesResolver: _ = se(K(y)),
...q
} = d, B = F !== void 0 ? F : (
// TODO v6: remove `Root` in the next major release
// For more details: https://github.com/mui/material-ui/pull/37908
y && y !== "Root" && y !== "root" || !1
), C = M || !1;
let P = b;
y === "Root" || y === "root" ? P = o : y ? P = r : le(s) && (P = void 0);
const T = Z(s, {
shouldForwardProp: P,
label: ce(c, y),
...q
}), Q = (a) => {
if (a.__emotion_real === a)
return a;
if (typeof a == "function")
return function(S) {
return O(S, a);
};
if (G(a)) {
const f = re(a);
return f.variants ? function(m) {
return O(m, f);
} : f.style;
}
return a;
}, g = (...a) => {
const f = [], S = a.map(Q), m = [];
if (f.push(u), c && _ && m.push(function(p) {
var w, D;
const l = (D = (w = p.theme.components) == null ? void 0 : w[c]) == null ? void 0 : D.styleOverrides;
if (!l)
return null;
const v = {};
for (const $ in l)
v[$] = O(p, l[$]);
return _(p, v);
}), c && !B && m.push(function(p) {
var v, w;
const h = p.theme, l = (w = (v = h == null ? void 0 : h.components) == null ? void 0 : v[c]) == null ? void 0 : w.variants;
return l ? H(p, l) : null;
}), C || m.push(j), Array.isArray(S[0])) {
const N = S.shift(), p = new Array(f.length).fill(""), h = new Array(m.length).fill("");
let l;
l = [...p, ...N, ...h], l.raw = [...p, ...N.raw, ...h], f.unshift(l);
}
const U = [...f, ...S, ...m], R = T(...U);
return s.muiName && (R.muiName = s.muiName), process.env.NODE_ENV !== "production" && (R.displayName = ae(c, y, s)), R;
};
return T.withConfig && (g.withConfig = T.withConfig), g;
};
}
function ae(e, n, t) {
return e ? `${e}${J(n || "")}` : `Styled(${ne(t)})`;
}
function ce(e, n) {
let t;
return process.env.NODE_ENV !== "production" && e && (t = `${e}-${K(n || "Root")}`), t;
}
function fe(e) {
for (const n in e)
return !1;
return !0;
}
function le(e) {
return typeof e == "string" && // 96 is one less than the char code
// for "a" so this is checking that
// it's a lowercase character
e.charCodeAt(0) > 96;
}
function K(e) {
return e && e.charAt(0).toLowerCase() + e.slice(1);
}
function E(e, n) {
const t = {
...n
};
for (const o in e)
if (Object.prototype.hasOwnProperty.call(e, o)) {
const r = o;
if (r === "components" || r === "slots")
t[r] = {
...e[r],
...t[r]
};
else if (r === "componentsProps" || r === "slotProps") {
const u = e[r], i = n[r];
if (!i)
t[r] = u || {};
else if (!u)
t[r] = i;
else {
t[r] = {
...i
};
for (const s in u)
if (Object.prototype.hasOwnProperty.call(u, s)) {
const d = s;
t[r][d] = E(u[d], i[d]);
}
}
} else t[r] === void 0 && (t[r] = e[r]);
}
return t;
}
const L = /* @__PURE__ */ I.createContext(void 0);
function de({
value: e,
children: n
}) {
return /* @__PURE__ */ te(L.Provider, {
value: e,
children: n
});
}
process.env.NODE_ENV !== "production" && (de.propTypes = {
// ┌────────────────────────────── Warning ──────────────────────────────┐
// │ These PropTypes are generated from the TypeScript type definitions. │
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
// └─────────────────────────────────────────────────────────────────────┘
/**
* @ignore
*/
children: x.node,
/**
* @ignore
*/
value: x.object
});
function ye(e) {
const {
theme: n,
name: t,
props: o
} = e;
if (!n || !n.components || !n.components[t])
return o;
const r = n.components[t];
return r.defaultProps ? E(r.defaultProps, o) : !r.styleOverrides && !r.variants ? E(r, o) : o;
}
function pe({
props: e,
name: n
}) {
const t = I.useContext(L);
return ye({
props: e,
name: n,
theme: {
components: t
}
});
}
const me = X();
function he(e) {
return e !== "ownerState" && e !== "theme" && e !== "sx" && e !== "as";
}
const Se = (e) => he(e) && e !== "classes", Oe = ue({
themeId: ee,
defaultTheme: me,
rootShouldForwardProp: Se
});
process.env.NODE_ENV !== "production" && (x.node, x.object.isRequired);
function xe(e) {
return pe(e);
}
export {
de as D,
ue as a,
E as b,
Ne as c,
me as d,
he as e,
b as f,
re as p,
Se as r,
Oe as s,
xe as u
};