@cgi-learning-hub/ui
Version:
@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features
89 lines (88 loc) • 2.66 kB
JavaScript
import { jsx as o, jsxs as a } from "react/jsx-runtime";
import { F as c } from "../../Folder-BSZMyA2L.js";
import { M as h } from "../../MoreVert-woCQ0dNf.js";
import { Box as l, CardContent as x } from "@mui/material";
import i from "../EllipsisWithTooltip/EllipsisWithTooltip.es.js";
import { StyledCard as u, SelectedIcon as b } from "../ResourceCard/style.es.js";
import { FolderBodyStyle as P, IconContainerStyle as I, FolderIconStyle as g, TextContainerStyle as D } from "./styles.es.js";
import { titleTypographyProps as F, subtitleTypographyProps as w } from "./types.es.js";
const M = ({
isSelected: e = !1,
onSelect: p = () => {
},
title: d,
subtitle: n,
width: m = "320px",
onClick: t = () => {
},
iconSize: f = "2rem",
hasNoButtonOnFocus: y = !1
}) => {
const s = (r) => r.key === "Enter" || r.key === " ";
return /* @__PURE__ */ o(l, { sx: { width: m }, children: /* @__PURE__ */ a(
u,
{
selected: e,
onClick: t,
onKeyDown: (r) => {
s(r) && (r.preventDefault(), t == null || t());
},
role: "button",
tabIndex: 0,
"aria-labelledby": "folder-title folder-subtitle",
"aria-pressed": e,
children: [
/* @__PURE__ */ o(
b,
{
onClick: (r) => {
r.preventDefault(), r.stopPropagation(), p();
},
onKeyDown: (r) => {
s(r) && (r.preventDefault(), r.stopPropagation(), p());
},
className: "selected-icon",
selected: e,
role: "button",
tabIndex: 0,
"aria-label": e ? "Unselect folder" : "Select folder",
"aria-pressed": e,
hasNoButtonOnFocus: y,
children: /* @__PURE__ */ o(h, {})
}
),
/* @__PURE__ */ a(x, { sx: P, children: [
/* @__PURE__ */ o(l, { fontSize: f, sx: I, children: /* @__PURE__ */ o(
c,
{
color: "primary",
sx: g,
"aria-hidden": "true"
}
) }),
/* @__PURE__ */ a(l, { sx: D, children: [
/* @__PURE__ */ o(
i,
{
typographyProps: F,
tooltipProps: { placement: "bottom", arrow: !0 },
children: d
}
),
n && /* @__PURE__ */ o(
i,
{
typographyProps: w,
tooltipProps: { placement: "bottom", arrow: !0 },
children: n
}
)
] })
] })
]
}
) });
};
export {
M as default
};