Files
opportunities-extension/src/features/org-chart/icons.js

29 lines
1.9 KiB
JavaScript

function createOrgChartIcons({ environment }) {
// Lucide geometry; license included in src/vendor/lucide/LICENSE.
const paths = {
opportunities: ["M3 7h18v14H3Z", "M8 7V3h8v4", "M3 12h18", "M10 12v3h4v-3"],
contact: ["M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", "M13 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0", "M20 8v6", "M17 11h6"],
chart: ["M12 8v4", "M12 12H5v4", "M12 12h7v4"],
plus: ["M12 5v14", "M5 12h14"],
close: ["m6 6 12 12", "M18 6 6 18"], check: ["m9 12 2 2 4-4"],
down: ["m6 9 6 6 6-6"], up: ["m18 15-6-6-6 6"],
expand: ["m7 10 5-5 5 5", "m7 14 5 5 5-5"], collapse: ["m7 4 5 5 5-5", "m7 20 5-5 5 5"],
minus: ["M5 12h14"], fit: ["M8 3H5a2 2 0 0 0-2 2v3", "M16 3h3a2 2 0 0 1 2 2v3", "M21 16v3a2 2 0 0 1-2 2h-3", "M8 21H5a2 2 0 0 1-2-2v-3"],
save: ["M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12l4 4v12a2 2 0 0 1-2 2", "M7 21v-8h10v8", "M7 3v6h10V3"],
trash: ["M3 6h18", "M19 6v14H5V6", "M10 11v6", "M14 11v6", "M9 6V3h6v3"],
note: ["M12 3H5v18h14V10Z", "M12 3v7h7", "M8 15h8", "M8 18h5"]
};
function icon(name) {
const svg = environment.document.createElementNS("http://www.w3.org/2000/svg", "svg");
for (const [key, value] of Object.entries({ viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "1.8", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true", focusable: "false" })) svg.setAttribute(key, value);
for (const d of paths[name] || paths.chart) { const path = environment.document.createElementNS("http://www.w3.org/2000/svg", "path"); path.setAttribute("d", d); svg.append(path); }
if (name === "chart") for (const [x, y] of [[8, 2], [1, 16], [15, 16]]) {
const rect = environment.document.createElementNS("http://www.w3.org/2000/svg", "rect");
for (const [key, value] of Object.entries({ x, y, width: 8, height: 6, rx: 1 })) rect.setAttribute(key, value);
svg.append(rect);
}
return svg;
}
return { icon };
}