UNPKG

@cgi-learning-hub/ui

Version:

@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features

159 lines (158 loc) 5.09 kB
import * as P from "react"; import { P as a } from "./index-B9vkf41S.js"; import { F as h, G as b, n as u, H as g, A as f } from "./generateUtilityClasses-B_xKAflz.js"; import { u as w } from "./useTheme-0AkY41zn.js"; import { jsx as T } from "react/jsx-runtime"; import { u as $, s as x, c as C } from "./DefaultPropsProvider-BrmlvPWg.js"; import { m as O } from "./memoTheme-C-PaH-Cy.js"; import { c as N } from "./chainPropTypes-D9lkm76m.js"; import { i as R } from "./integerPropType-BihGt2aU.js"; function j(e) { return b("MuiPaper", e); } const F = h("MuiPaper", ["root", "rounded", "outlined", "elevation", "elevation0", "elevation1", "elevation2", "elevation3", "elevation4", "elevation5", "elevation6", "elevation7", "elevation8", "elevation9", "elevation10", "elevation11", "elevation12", "elevation13", "elevation14", "elevation15", "elevation16", "elevation17", "elevation18", "elevation19", "elevation20", "elevation21", "elevation22", "elevation23", "elevation24"]), E = (e) => { const { square: o, elevation: t, variant: s, classes: r } = e, i = { root: ["root", s, !o && "rounded", s === "elevation" && `elevation${t}`] }; return C(i, j, r); }, M = x("div", { name: "MuiPaper", slot: "Root", overridesResolver: (e, o) => { const { ownerState: t } = e; return [o.root, o[t.variant], !t.square && o.rounded, t.variant === "elevation" && o[`elevation${t.elevation}`]]; } })(O(({ theme: e }) => ({ backgroundColor: (e.vars || e).palette.background.paper, color: (e.vars || e).palette.text.primary, transition: e.transitions.create("box-shadow"), variants: [{ props: ({ ownerState: o }) => !o.square, style: { borderRadius: e.shape.borderRadius } }, { props: { variant: "outlined" }, style: { border: `1px solid ${(e.vars || e).palette.divider}` } }, { props: { variant: "elevation" }, style: { boxShadow: "var(--Paper-shadow)", backgroundImage: "var(--Paper-overlay)" } }] }))), U = /* @__PURE__ */ P.forwardRef(function(o, t) { var c; const s = $({ props: o, name: "MuiPaper" }), r = w(), { className: i, component: l = "div", elevation: n = 1, square: m = !1, variant: v = "elevation", ...p } = s, d = { ...s, component: l, elevation: n, square: m, variant: v }, y = E(d); return process.env.NODE_ENV !== "production" && r.shadows[n] === void 0 && console.error([`MUI: The elevation provided <Paper elevation={${n}}> is not available in the theme.`, `Please make sure that \`theme.shadows[${n}]\` is defined.`].join(` `)), /* @__PURE__ */ T(M, { as: l, ownerState: d, className: g(y.root, i), ref: t, ...p, style: { ...v === "elevation" && { "--Paper-shadow": (r.vars || r).shadows[n], ...r.vars && { "--Paper-overlay": (c = r.vars.overlays) == null ? void 0 : c[n] }, ...!r.vars && r.palette.mode === "dark" && { "--Paper-overlay": `linear-gradient(${u("#fff", f(n))}, ${u("#fff", f(n))})` } }, ...p.style } }); }); process.env.NODE_ENV !== "production" && (U.propTypes = { // ┌────────────────────────────── Warning ──────────────────────────────┐ // │ These PropTypes are generated from the TypeScript type definitions. │ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │ // └─────────────────────────────────────────────────────────────────────┘ /** * The content of the component. */ children: a.node, /** * Override or extend the styles applied to the component. */ classes: a.object, /** * @ignore */ className: a.string, /** * The component used for the root node. * Either a string to use a HTML element or a component. */ component: a.elementType, /** * Shadow depth, corresponds to `dp` in the spec. * It accepts values between 0 and 24 inclusive. * @default 1 */ elevation: N(R, (e) => { const { elevation: o, variant: t } = e; return o > 0 && t === "outlined" ? new Error(`MUI: Combining \`elevation={${o}}\` with \`variant="${t}"\` has no effect. Either use \`elevation={0}\` or use a different \`variant\`.`) : null; }), /** * If `true`, rounded corners are disabled. * @default false */ square: a.bool, /** * @ignore */ style: a.object, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object]), /** * The variant to use. * @default 'elevation' */ variant: a.oneOfType([a.oneOf(["elevation", "outlined"]), a.string]) }); export { U as P, j as g, F as p };