@cgi-learning-hub/ui
Version:
@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features
51 lines (50 loc) • 1.52 kB
JavaScript
import { D as f } from "../../Delete-B5VTV71K.js";
import { F as a } from "../../Folder-BgQP5-Ve.js";
import { jsx as i } from "react/jsx-runtime";
import { c as l } from "../../createSvgIcon-B1E6Wo8z.js";
import { ICON_TYPE as o } from "./types.es.js";
const d = l(/* @__PURE__ */ i("path", {
d: "M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92"
}), "Share"), g = (r, n) => {
if (!r) return a;
if (typeof r != "string") return r;
switch (r) {
case o.SHARE:
return d;
case o.TRASH:
return f;
case o.CUSTOM:
return n || a;
case o.FOLDER:
default:
return a;
}
}, E = (r) => r.internalId, h = (r, n, c = []) => {
for (const t of r) {
const e = [...c, t.internalId];
if (t.internalId === n)
return e;
if (t.children && t.children.length > 0) {
const s = h(
t.children,
n,
e
);
if (s)
return s;
}
}
return null;
}, C = (r) => {
const n = {}, c = (t) => {
var e;
n[t.internalId] = t, (e = t.children) != null && e.length && t.children.forEach(c);
};
return r.forEach(c), n;
};
export {
C as buildItemDataMap,
h as findItemPath,
g as getIconComponent,
E as getItemId
};