@cgi-learning-hub/ui
Version:
@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features
132 lines (131 loc) • 3.58 kB
JavaScript
import * as i from "react";
import { P as s } from "./index-B9vkf41S.js";
import { F as h, G as y, H as L } from "./generateUtilityClasses-B_xKAflz.js";
import { jsx as v, jsxs as x } from "react/jsx-runtime";
import { u as C, s as P, c as N } from "./DefaultPropsProvider-BrmlvPWg.js";
const p = /* @__PURE__ */ i.createContext({});
process.env.NODE_ENV !== "production" && (p.displayName = "ListContext");
function T(e) {
return y("MuiList", e);
}
const U = h("MuiList", ["root", "padding", "dense", "subheader"]), j = (e) => {
const {
classes: o,
disablePadding: t,
dense: a,
subheader: n
} = e;
return N({
root: ["root", !t && "padding", a && "dense", n && "subheader"]
}, T, o);
}, M = P("ul", {
name: "MuiList",
slot: "Root",
overridesResolver: (e, o) => {
const {
ownerState: t
} = e;
return [o.root, !t.disablePadding && o.padding, t.dense && o.dense, t.subheader && o.subheader];
}
})({
listStyle: "none",
margin: 0,
padding: 0,
position: "relative",
variants: [{
props: ({
ownerState: e
}) => !e.disablePadding,
style: {
paddingTop: 8,
paddingBottom: 8
}
}, {
props: ({
ownerState: e
}) => e.subheader,
style: {
paddingTop: 0
}
}]
}), O = /* @__PURE__ */ i.forwardRef(function(o, t) {
const a = C({
props: o,
name: "MuiList"
}), {
children: n,
className: d,
component: l = "ul",
dense: r = !1,
disablePadding: u = !1,
subheader: m,
...b
} = a, f = i.useMemo(() => ({
dense: r
}), [r]), c = {
...a,
component: l,
dense: r,
disablePadding: u
}, g = j(c);
return /* @__PURE__ */ v(p.Provider, {
value: f,
children: /* @__PURE__ */ x(M, {
as: l,
className: L(g.root, d),
ref: t,
ownerState: c,
...b,
children: [m, n]
})
});
});
process.env.NODE_ENV !== "production" && (O.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: s.node,
/**
* Override or extend the styles applied to the component.
*/
classes: s.object,
/**
* @ignore
*/
className: s.string,
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component: s.elementType,
/**
* If `true`, compact vertical padding designed for keyboard and mouse input is used for
* the list and list items.
* The prop is available to descendant components as the `dense` context.
* @default false
*/
dense: s.bool,
/**
* If `true`, vertical padding is removed from the list.
* @default false
*/
disablePadding: s.bool,
/**
* The content of the subheader, normally `ListSubheader`.
*/
subheader: s.node,
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx: s.oneOfType([s.arrayOf(s.oneOfType([s.func, s.object, s.bool])), s.func, s.object])
});
export {
O as L,
p as a,
T as g,
U as l
};