cortex-react-components 2.26.5 → 2.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-VRE6VCHX.mjs → chunk-2BR55L74.mjs} +1 -1
- package/dist/{chunk-FYQBRCQM.mjs → chunk-2BRDNDUB.mjs} +1 -1
- package/dist/{chunk-HTS3KCJL.mjs → chunk-2O54GV6Q.mjs} +1 -1
- package/dist/chunk-32G45Z2G.mjs +1 -0
- package/dist/{chunk-2OOJ4ZFB.mjs → chunk-3HNU2NYP.mjs} +1 -1
- package/dist/{chunk-HDKHF3EA.mjs → chunk-3NRXQBBS.mjs} +1 -1
- package/dist/{chunk-FEWOSBUJ.mjs → chunk-3Y7QG6VP.mjs} +1 -1
- package/dist/{chunk-GULRIPMU.mjs → chunk-4FEVXBNU.mjs} +1 -1
- package/dist/{chunk-MO4HRQEL.mjs → chunk-5MWZTJYP.mjs} +1 -1
- package/dist/{chunk-BQQ4V4PX.mjs → chunk-75F3LJMX.mjs} +1 -1
- package/dist/{chunk-EFNFK7TR.mjs → chunk-7NWIK57W.mjs} +1 -1
- package/dist/{chunk-4SRUEQTP.mjs → chunk-7R47MHQE.mjs} +1 -1
- package/dist/{chunk-PTZT4QJW.mjs → chunk-AJQHGVZ5.mjs} +1 -1
- package/dist/chunk-B7RZ4K6Y.mjs +1 -0
- package/dist/{chunk-HKMNAXLM.mjs → chunk-C4RWEPVF.mjs} +1 -1
- package/dist/{chunk-7OMPPFGG.mjs → chunk-CXOVEABI.mjs} +1 -1
- package/dist/{chunk-R6AYIVIR.mjs → chunk-EM3T2XYC.mjs} +1 -1
- package/dist/{chunk-UTJZH3X5.mjs → chunk-EPJJKGCG.mjs} +1 -1
- package/dist/{chunk-PNUBVBSR.mjs → chunk-FE7ZGUPU.mjs} +1 -1
- package/dist/{chunk-KBLVWXLK.mjs → chunk-FZX3ZPEU.mjs} +1 -1
- package/dist/chunk-G6OGEIN4.mjs +4 -0
- package/dist/{chunk-F64CA5CH.mjs → chunk-GHOL5L32.mjs} +1 -1
- package/dist/{chunk-P6OSMPUQ.mjs → chunk-GTZJWMZR.mjs} +1 -1
- package/dist/{chunk-JVTCOOUV.mjs → chunk-I75OOO4H.mjs} +1 -1
- package/dist/{chunk-NXAQ6ESJ.mjs → chunk-JDIPWJBD.mjs} +1 -1
- package/dist/{chunk-BGQC6IQK.mjs → chunk-KEK763EH.mjs} +1 -1
- package/dist/chunk-KQRQXBJ3.mjs +9 -0
- package/dist/{chunk-CKU2T3AN.mjs → chunk-LAP57E2L.mjs} +1 -1
- package/dist/{chunk-O24GFE6Q.mjs → chunk-LJXTXROJ.mjs} +1 -1
- package/dist/{chunk-QUMUO63J.mjs → chunk-NBJLXJQ3.mjs} +1 -1
- package/dist/{chunk-U3FYDDE2.mjs → chunk-NINFDOV5.mjs} +1 -1
- package/dist/{chunk-5EM6P7SU.mjs → chunk-OQBCIB4L.mjs} +1 -1
- package/dist/{chunk-AN744MXS.mjs → chunk-OWL3KUE3.mjs} +1 -1
- package/dist/{chunk-RIRZRO6U.mjs → chunk-P55W6AFU.mjs} +1 -1
- package/dist/{chunk-GETYSIZV.mjs → chunk-RGOKBIQ5.mjs} +1 -1
- package/dist/{chunk-GAZHKHGB.mjs → chunk-RJGYVDOU.mjs} +1 -1
- package/dist/{chunk-T5HJS6OF.mjs → chunk-RSDUFAIB.mjs} +1 -1
- package/dist/chunk-SOTCQX2G.mjs +1 -0
- package/dist/{chunk-CMU5JFUC.mjs → chunk-SWE754OC.mjs} +1 -1
- package/dist/{chunk-WH6JZSIA.mjs → chunk-TJZVV3XH.mjs} +1 -1
- package/dist/{chunk-ZG5N4C4S.mjs → chunk-TTWEHUP5.mjs} +1 -1
- package/dist/{chunk-KVLUT4U2.mjs → chunk-TVTTUSWM.mjs} +1 -1
- package/dist/{chunk-SRUG246N.mjs → chunk-TXVA6XJT.mjs} +1 -1
- package/dist/{chunk-FMXCT6LU.mjs → chunk-TYARLEAC.mjs} +1 -1
- package/dist/{chunk-VATGKKXW.mjs → chunk-UJITFLIZ.mjs} +1 -1
- package/dist/{chunk-IO5ZSALG.mjs → chunk-VKCDLKYH.mjs} +1 -1
- package/dist/{chunk-2GM2LPLB.mjs → chunk-WIRQ5IRT.mjs} +1 -1
- package/dist/{chunk-UZSBX5GO.mjs → chunk-X3JZSN3W.mjs} +1 -1
- package/dist/{chunk-VNYUNZ3M.mjs → chunk-XGIYNUGC.mjs} +1 -1
- package/dist/{chunk-VTFO5GXK.mjs → chunk-XMYXQR5W.mjs} +1 -1
- package/dist/{chunk-3ANJOET7.mjs → chunk-ZEALRBXW.mjs} +1 -1
- package/dist/components/AdvancedComponents/index.d.ts +1 -0
- package/dist/components/AdvancedComponents/index.js +12 -1
- package/dist/components/AdvancedComponents/index.mjs +1 -1
- package/dist/components/AdvancedComponents/org-chart-component/OrgChart.d.ts +15 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgChart.js +12 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgChart.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgNode.d.ts +3 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgNode.js +9 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgNode.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgTree.d.ts +10 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgTree.js +12 -0
- package/dist/components/AdvancedComponents/org-chart-component/OrgTree.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/examples/PayloadIntegration.js +233 -0
- package/dist/components/AdvancedComponents/org-chart-component/examples/PayloadIntegration.mjs +233 -0
- package/dist/components/AdvancedComponents/org-chart-component/index.d.ts +4 -0
- package/dist/components/AdvancedComponents/org-chart-component/index.js +12 -0
- package/dist/components/AdvancedComponents/org-chart-component/index.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/mockData.d.ts +7 -0
- package/dist/components/AdvancedComponents/org-chart-component/mockData.js +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/mockData.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/types/index.d.ts +33 -0
- package/dist/components/AdvancedComponents/org-chart-component/types/index.js +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/types/index.mjs +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/utils.d.ts +13 -0
- package/dist/components/AdvancedComponents/org-chart-component/utils.js +1 -0
- package/dist/components/AdvancedComponents/org-chart-component/utils.mjs +1 -0
- package/dist/components/Blocks/Banner.mjs +1 -1
- package/dist/components/Blocks/CallToAction.mjs +1 -1
- package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
- package/dist/components/Blocks/Content.mjs +1 -1
- package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
- package/dist/components/Blocks/ImageBlock.mjs +1 -1
- package/dist/components/Blocks/MediaBlock.mjs +1 -1
- package/dist/components/Blocks/OrgChart.mjs +3 -1
- package/dist/components/Blocks/RelatedPosts.mjs +1 -1
- package/dist/components/Blocks/RenderBlocks.mjs +1 -1
- package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
- package/dist/components/Blocks/index.d.ts +0 -1
- package/dist/components/Blocks/index.js +1 -1
- package/dist/components/Blocks/index.mjs +1 -1
- package/dist/components/Cards/ContentCard.mjs +1 -1
- package/dist/components/Cards/FeatureCard.mjs +1 -1
- package/dist/components/Cards/index.mjs +1 -1
- package/dist/components/Chat/ChatInterface.mjs +1 -1
- package/dist/components/Chat/CopilotInterface.mjs +1 -1
- package/dist/components/Chat/PartTypes/MessageHandler.mjs +1 -1
- package/dist/components/Chat/PartTypes/index.mjs +1 -1
- package/dist/components/Chat/demo-long-messages.mjs +1 -1
- package/dist/components/Chat/demo-tests.mjs +1 -1
- package/dist/components/Chat/demo.mjs +1 -1
- package/dist/components/Chat/example-usage.mjs +1 -1
- package/dist/components/Chat/example-with-vercel-ai.mjs +1 -1
- package/dist/components/Chat/index.mjs +1 -1
- package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
- package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
- package/dist/components/DigitalColleagues/index.mjs +1 -1
- package/dist/components/Foundary/MainPage.mjs +1 -1
- package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
- package/dist/components/Foundary/RichText/index.mjs +1 -1
- package/dist/components/Foundary/RichText/plugins/toolbar-plugin.mjs +1 -1
- package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -1
- package/dist/components/Foundary/Views/index.mjs +1 -1
- package/dist/components/Foundary/document-edit.mjs +1 -1
- package/dist/components/Foundary/document-preview-examples.mjs +1 -1
- package/dist/components/Foundary/document-preview.mjs +1 -1
- package/dist/components/Foundary/file-edit.mjs +1 -1
- package/dist/components/Foundary/index.mjs +1 -1
- package/dist/components/Foundary/knowledge-browser.mjs +1 -1
- package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
- package/dist/components/HeaderFooter/VideoHeader.mjs +1 -1
- package/dist/components/HeaderFooter/index.mjs +1 -1
- package/dist/components/Heros/HighImpact/index.mjs +1 -1
- package/dist/components/Heros/LowImpact/index.mjs +1 -1
- package/dist/components/Heros/MediumImpact/index.mjs +1 -1
- package/dist/components/Heros/RenderHero.mjs +1 -1
- package/dist/components/Heros/SectionHero/index.mjs +1 -1
- package/dist/components/Heros/index.mjs +1 -1
- package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
- package/dist/components/Layouts/Print.mjs +1 -1
- package/dist/components/Layouts/SlideShow.mjs +1 -1
- package/dist/components/Layouts/index.mjs +1 -1
- package/dist/components/Other/index.mjs +1 -1
- package/dist/components/Payload/CollectionArchive/index.mjs +1 -1
- package/dist/components/Payload/Media/index.mjs +1 -1
- package/dist/components/Payload/PayloadCard/index.mjs +1 -1
- package/dist/components/Payload/RichText/index.mjs +1 -1
- package/dist/components/Payload/RichText/serialize.mjs +1 -1
- package/dist/components/Payload/index.mjs +1 -1
- package/dist/components/Projects/FileView.mjs +1 -1
- package/dist/components/Projects/KanbanBoardView.mjs +1 -1
- package/dist/components/Projects/ProjectPage.mjs +1 -1
- package/dist/components/Projects/ProjectView.mjs +1 -1
- package/dist/components/Projects/TaskDetailsModal.mjs +1 -1
- package/dist/components/Projects/file-list.mjs +1 -1
- package/dist/components/Projects/index.mjs +1 -1
- package/dist/components/dc-temp/index.mjs +1 -1
- package/dist/components/index.js +30 -19
- package/dist/components/index.mjs +1 -1
- package/dist/globals.css +1 -1
- package/dist/index.js +42 -31
- package/dist/index.mjs +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/pages/Blog.mjs +1 -1
- package/dist/pages/Documentation.mjs +1 -1
- package/dist/pages/IndexPage.mjs +1 -1
- package/dist/pages/Intranet.mjs +1 -1
- package/dist/pages/LandingPage.mjs +1 -1
- package/dist/pages/Page.mjs +1 -1
- package/dist/pages/Publish.mjs +1 -1
- package/dist/pages/Website.mjs +1 -1
- package/dist/sections/AboutSection.mjs +1 -1
- package/dist/sections/BlogDetail.mjs +1 -1
- package/dist/sections/BlogList.mjs +1 -1
- package/dist/sections/ContactSection.mjs +1 -1
- package/dist/sections/PageSections.mjs +1 -1
- package/dist/sections/PricingSection.mjs +1 -1
- package/dist/sections/ServiceDetail.mjs +1 -1
- package/dist/sections/ServiceDetailSection.mjs +1 -1
- package/dist/sections/ServiceSection.mjs +1 -1
- package/dist/sections/form/index.mjs +1 -1
- package/dist/sections/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-53QLSQCO.mjs +0 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=(r,t)=>{for(var a in t)s(r,a,{get:t[a],enumerable:!0})},x=(r,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of b(t))!p.call(r,o)&&o!==a&&s(r,o,{get:()=>t[o],enumerable:!(n=u(t,o))||n.enumerable});return r};var h=r=>x(s({},"__esModule",{value:!0}),r);var v={};f(v,{OrgNode:()=>C});module.exports=h(v);function l(r){if(!r)return"?";let t=r.trim().split(/\s+/);return t.length===1?t[0].substring(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}function d(r){return r&&{P:"bg-primary/20 text-primary border-primary/30",SM:"bg-accent/20 text-accent border-accent/30",M:"bg-accent/15 text-accent border-accent/25",SC2:"bg-card text-card-foreground border-border",SC1:"bg-card text-card-foreground border-border",C3:"bg-muted text-muted-foreground border-border",C2:"bg-muted text-muted-foreground border-border",C1:"bg-muted text-muted-foreground border-border"}[r]||"bg-muted text-muted-foreground"}var c={C1:"Consultant 1",C2:"Consultant 2",C3:"Consultant 3",SC1:"Senior Consultant 1",SC2:"Senior Consultant 2",M:"Manager",SM:"Senior Manager",P:"Partner"};var e=require("react/jsx-runtime"),C=({node:r,onNodeClick:t,expandable:a=!1,isExpanded:n=!0,onToggleExpand:o})=>{let i=r.children.length>0,g=a&&i;return(0,e.jsxs)("div",{className:"flex flex-col items-center",children:[(0,e.jsxs)("div",{className:`
|
|
2
|
+
relative bg-card border border-border rounded-lg shadow-sm
|
|
3
|
+
transition-all duration-200 hover:shadow-md hover:border-primary/50
|
|
4
|
+
${t?"cursor-pointer":""}
|
|
5
|
+
w-64 p-4
|
|
6
|
+
`,onClick:()=>t?.(r),children:[(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)("div",{className:"flex-shrink-0",children:r.profilePicture?.url?(0,e.jsx)("img",{src:r.profilePicture.url,alt:r.profilePicture.alt||r.name,className:"w-12 h-12 rounded-full object-cover border-2 border-primary/20"}):(0,e.jsx)("div",{className:"w-12 h-12 rounded-full bg-primary/10 border-2 border-primary/20 flex items-center justify-center",children:(0,e.jsx)("span",{className:"text-sm font-semibold text-primary",children:l(r.name)})})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("h3",{className:"font-semibold text-card-foreground text-sm truncate",children:r.name}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:r.email}),r.jobRole&&(0,e.jsx)("div",{className:"mt-2",children:(0,e.jsx)("span",{className:`
|
|
7
|
+
inline-block px-2 py-0.5 rounded text-xs font-medium border
|
|
8
|
+
${d(r.jobRole)}
|
|
9
|
+
`,children:c[r.jobRole]})})]})]}),r.about&&(0,e.jsx)("div",{className:"mt-3 pt-3 border-t border-border",children:(0,e.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2",children:r.about})}),g&&(0,e.jsx)("button",{onClick:m=>{m.stopPropagation(),o?.()},className:"absolute -bottom-3 left-1/2 -translate-x-1/2 w-6 h-6 rounded-full bg-card border-2 border-border hover:border-primary/50 flex items-center justify-center transition-colors","aria-label":n?"Collapse":"Expand",children:(0,e.jsx)("svg",{className:`w-3 h-3 text-muted-foreground transition-transform ${n?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),i&&n&&(0,e.jsx)("div",{className:"w-0.5 h-8 bg-border"})]})};0&&(module.exports={OrgNode});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../../chunk-KQRQXBJ3.mjs";import"../../../chunk-SOTCQX2G.mjs";import"../../../chunk-32G45Z2G.mjs";import"../../../chunk-YEKQJ4YC.mjs";export{a as OrgNode};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { OrgChartNode, User } from './types';
|
|
3
|
+
interface OrgTreeProps {
|
|
4
|
+
nodes: OrgChartNode[];
|
|
5
|
+
onNodeClick?: (user: User) => void;
|
|
6
|
+
expandable?: boolean;
|
|
7
|
+
initiallyExpanded?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const OrgTree: React.FC<OrgTreeProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";var g=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var y=(e,r)=>{for(var n in r)g(e,n,{get:r[n],enumerable:!0})},O=(e,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of C(r))!N.call(e,a)&&a!==n&&g(e,a,{get:()=>r[a],enumerable:!(s=v(r,a))||s.enumerable});return e};var P=e=>O(g({},"__esModule",{value:!0}),e);var R={};y(R,{OrgTree:()=>w});module.exports=P(R);var x=require("react");function p(e){if(!e)return"?";let r=e.trim().split(/\s+/);return r.length===1?r[0].substring(0,2).toUpperCase():(r[0][0]+r[r.length-1][0]).toUpperCase()}function u(e){return e&&{P:"bg-primary/20 text-primary border-primary/30",SM:"bg-accent/20 text-accent border-accent/30",M:"bg-accent/15 text-accent border-accent/25",SC2:"bg-card text-card-foreground border-border",SC1:"bg-card text-card-foreground border-border",C3:"bg-muted text-muted-foreground border-border",C2:"bg-muted text-muted-foreground border-border",C1:"bg-muted text-muted-foreground border-border"}[e]||"bg-muted text-muted-foreground"}var b={C1:"Consultant 1",C2:"Consultant 2",C3:"Consultant 3",SC1:"Senior Consultant 1",SC2:"Senior Consultant 2",M:"Manager",SM:"Senior Manager",P:"Partner"};var t=require("react/jsx-runtime"),f=({node:e,onNodeClick:r,expandable:n=!1,isExpanded:s=!0,onToggleExpand:a})=>{let l=e.children.length>0,i=n&&l;return(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsxs)("div",{className:`
|
|
2
|
+
relative bg-card border border-border rounded-lg shadow-sm
|
|
3
|
+
transition-all duration-200 hover:shadow-md hover:border-primary/50
|
|
4
|
+
${r?"cursor-pointer":""}
|
|
5
|
+
w-64 p-4
|
|
6
|
+
`,onClick:()=>r?.(e),children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:e.profilePicture?.url?(0,t.jsx)("img",{src:e.profilePicture.url,alt:e.profilePicture.alt||e.name,className:"w-12 h-12 rounded-full object-cover border-2 border-primary/20"}):(0,t.jsx)("div",{className:"w-12 h-12 rounded-full bg-primary/10 border-2 border-primary/20 flex items-center justify-center",children:(0,t.jsx)("span",{className:"text-sm font-semibold text-primary",children:p(e.name)})})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h3",{className:"font-semibold text-card-foreground text-sm truncate",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.email}),e.jobRole&&(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)("span",{className:`
|
|
7
|
+
inline-block px-2 py-0.5 rounded text-xs font-medium border
|
|
8
|
+
${u(e.jobRole)}
|
|
9
|
+
`,children:b[e.jobRole]})})]})]}),e.about&&(0,t.jsx)("div",{className:"mt-3 pt-3 border-t border-border",children:(0,t.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.about})}),i&&(0,t.jsx)("button",{onClick:d=>{d.stopPropagation(),a?.()},className:"absolute -bottom-3 left-1/2 -translate-x-1/2 w-6 h-6 rounded-full bg-card border-2 border-border hover:border-primary/50 flex items-center justify-center transition-colors","aria-label":s?"Collapse":"Expand",children:(0,t.jsx)("svg",{className:`w-3 h-3 text-muted-foreground transition-transform ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),l&&s&&(0,t.jsx)("div",{className:"w-0.5 h-8 bg-border"})]})};var w=({nodes:e,onNodeClick:r,expandable:n=!1,initiallyExpanded:s=!0})=>(0,t.jsx)("div",{className:"flex flex-col items-center gap-0",children:e.map((a,l)=>(0,t.jsx)(h,{node:a,onNodeClick:r,expandable:n,initiallyExpanded:s,isLast:l===e.length-1},a.id))}),h=({node:e,onNodeClick:r,expandable:n,initiallyExpanded:s=!0,isLast:a=!1})=>{let[l,i]=(0,x.useState)(s),d=e.children.length>0;return(0,t.jsxs)("div",{className:`flex flex-col items-center ${a?"":"mb-8"}`,children:[(0,t.jsx)(f,{node:e,onNodeClick:r,expandable:n,isExpanded:l,onToggleExpand:()=>i(!l)}),d&&l&&(0,t.jsxs)("div",{className:"flex flex-col items-center mt-0",children:[e.children.length>1&&(0,t.jsx)("div",{className:"relative w-full flex justify-center",children:(0,t.jsxs)("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-full max-w-[800px]",children:[(0,t.jsx)("div",{className:"absolute top-0 left-0 right-0 h-0.5 bg-border"}),(0,t.jsx)("div",{className:"flex justify-around",children:e.children.map((c,m)=>(0,t.jsx)("div",{className:"w-0.5 h-8 bg-border"},m))})]})}),(0,t.jsx)("div",{className:`
|
|
10
|
+
flex gap-8 mt-8
|
|
11
|
+
${e.children.length===1?"flex-col items-center":"flex-row items-start justify-center flex-wrap"}
|
|
12
|
+
`,children:e.children.map((c,m)=>(0,t.jsx)(h,{node:c,onNodeClick:r,expandable:n,initiallyExpanded:s,isLast:m===e.children.length-1},c.id))})]})]})};0&&(module.exports={OrgTree});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../../chunk-G6OGEIN4.mjs";import"../../../chunk-KQRQXBJ3.mjs";import"../../../chunk-SOTCQX2G.mjs";import"../../../chunk-32G45Z2G.mjs";import"../../../chunk-YEKQJ4YC.mjs";export{a as OrgTree};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
var a=`
|
|
2
|
+
\`\`\`js
|
|
3
|
+
/**
|
|
4
|
+
* Example: Integrating OrgChart with PayloadCMS3
|
|
5
|
+
*
|
|
6
|
+
* This example shows how to fetch user data from Payload using the client SDK
|
|
7
|
+
* and render it in the OrgChart component.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { OrgChart } from '../OrgChart';
|
|
12
|
+
import type { User } from '../types';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Server Component Example (Next.js App Router)
|
|
16
|
+
*
|
|
17
|
+
* Use this approach in a server component to fetch data at build/request time.
|
|
18
|
+
*/
|
|
19
|
+
export async function OrgChartServerComponent() {
|
|
20
|
+
// Import Payload config (adjust path to your project structure)
|
|
21
|
+
const { getPayload } = await import('payload');
|
|
22
|
+
const config = await import('@/payload.config').then((m) => m.default);
|
|
23
|
+
|
|
24
|
+
// Get Payload instance
|
|
25
|
+
const payload = await getPayload({ config });
|
|
26
|
+
|
|
27
|
+
// Fetch all users with manager relationships
|
|
28
|
+
const usersResponse = await payload.find({
|
|
29
|
+
collection: 'users',
|
|
30
|
+
depth: 2, // Include manager relationship data
|
|
31
|
+
limit: 1000, // Adjust based on your org size
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Transform Payload data to OrgChart format
|
|
35
|
+
const users: User[] = usersResponse.docs.map((doc) => ({
|
|
36
|
+
id: doc.id,
|
|
37
|
+
name: doc.name || '',
|
|
38
|
+
email: doc.email,
|
|
39
|
+
jobRole: doc.jobRole,
|
|
40
|
+
manager: doc.manager,
|
|
41
|
+
about: doc.about,
|
|
42
|
+
profilePicture: doc.profilePicture
|
|
43
|
+
? {
|
|
44
|
+
url: typeof doc.profilePicture === 'object'
|
|
45
|
+
? doc.profilePicture.url
|
|
46
|
+
: doc.profilePicture,
|
|
47
|
+
alt: doc.name,
|
|
48
|
+
}
|
|
49
|
+
: undefined,
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div className="container mx-auto py-8">
|
|
54
|
+
<h1 className="text-3xl font-bold mb-8">Organization Chart</h1>
|
|
55
|
+
<OrgChart
|
|
56
|
+
users={users}
|
|
57
|
+
expandable={true}
|
|
58
|
+
initiallyExpanded={true}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Client Component Example (with Server Action or API Route)
|
|
66
|
+
*
|
|
67
|
+
* Use this approach when you need client-side interactivity.
|
|
68
|
+
*/
|
|
69
|
+
'use client';
|
|
70
|
+
|
|
71
|
+
interface OrgChartClientComponentProps {
|
|
72
|
+
initialUsers: User[];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function OrgChartClientComponent({ initialUsers }: OrgChartClientComponentProps) {
|
|
76
|
+
const [users, setUsers] = React.useState<User[]>(initialUsers);
|
|
77
|
+
const [selectedUser, setSelectedUser] = React.useState<User | null>(null);
|
|
78
|
+
|
|
79
|
+
const handleNodeClick = (user: User) => {
|
|
80
|
+
setSelectedUser(user);
|
|
81
|
+
// You could also navigate to a user detail page here
|
|
82
|
+
// router.push(\`/team/\${user.id}\`);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<div className="container mx-auto py-8">
|
|
87
|
+
<div className="mb-8">
|
|
88
|
+
<h1 className="text-3xl font-bold">Organization Chart</h1>
|
|
89
|
+
<p className="text-muted-foreground mt-2">
|
|
90
|
+
Click on any team member to view details
|
|
91
|
+
</p>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
95
|
+
{/* Org Chart */}
|
|
96
|
+
<div className="lg:col-span-2">
|
|
97
|
+
<OrgChart
|
|
98
|
+
users={users}
|
|
99
|
+
onNodeClick={handleNodeClick}
|
|
100
|
+
expandable={true}
|
|
101
|
+
initiallyExpanded={true}
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
{/* Selected User Details */}
|
|
106
|
+
<div className="lg:col-span-1">
|
|
107
|
+
{selectedUser ? (
|
|
108
|
+
<div className="bg-card border border-border rounded-lg p-6 sticky top-8">
|
|
109
|
+
<h2 className="text-xl font-semibold mb-4">Team Member Details</h2>
|
|
110
|
+
<div className="space-y-4">
|
|
111
|
+
<div>
|
|
112
|
+
<label className="text-sm text-muted-foreground">Name</label>
|
|
113
|
+
<p className="font-medium">{selectedUser.name}</p>
|
|
114
|
+
</div>
|
|
115
|
+
<div>
|
|
116
|
+
<label className="text-sm text-muted-foreground">Email</label>
|
|
117
|
+
<p className="font-medium">{selectedUser.email}</p>
|
|
118
|
+
</div>
|
|
119
|
+
{selectedUser.jobRole && (
|
|
120
|
+
<div>
|
|
121
|
+
<label className="text-sm text-muted-foreground">Role</label>
|
|
122
|
+
<p className="font-medium">{selectedUser.jobRole}</p>
|
|
123
|
+
</div>
|
|
124
|
+
)}
|
|
125
|
+
{selectedUser.about && (
|
|
126
|
+
<div>
|
|
127
|
+
<label className="text-sm text-muted-foreground">About</label>
|
|
128
|
+
<p className="text-sm">{selectedUser.about}</p>
|
|
129
|
+
</div>
|
|
130
|
+
)}
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
) : (
|
|
134
|
+
<div className="bg-muted/50 border border-border rounded-lg p-6 text-center">
|
|
135
|
+
<p className="text-muted-foreground">
|
|
136
|
+
Select a team member to view details
|
|
137
|
+
</p>
|
|
138
|
+
</div>
|
|
139
|
+
)}
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* API Route Example (Next.js App Router)
|
|
148
|
+
*
|
|
149
|
+
* Create this file at: app/api/org-chart/route.ts
|
|
150
|
+
*/
|
|
151
|
+
export async function GET() {
|
|
152
|
+
const { getPayload } = await import('payload');
|
|
153
|
+
const config = await import('@/payload.config').then((m) => m.default);
|
|
154
|
+
|
|
155
|
+
const payload = await getPayload({ config });
|
|
156
|
+
|
|
157
|
+
const usersResponse = await payload.find({
|
|
158
|
+
collection: 'users',
|
|
159
|
+
depth: 2,
|
|
160
|
+
limit: 1000,
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const users: User[] = usersResponse.docs.map((doc) => ({
|
|
164
|
+
id: doc.id,
|
|
165
|
+
name: doc.name || '',
|
|
166
|
+
email: doc.email,
|
|
167
|
+
jobRole: doc.jobRole,
|
|
168
|
+
manager: doc.manager,
|
|
169
|
+
about: doc.about,
|
|
170
|
+
profilePicture: doc.profilePicture
|
|
171
|
+
? {
|
|
172
|
+
url: typeof doc.profilePicture === 'object'
|
|
173
|
+
? doc.profilePicture.url
|
|
174
|
+
: doc.profilePicture,
|
|
175
|
+
alt: doc.name,
|
|
176
|
+
}
|
|
177
|
+
: undefined,
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
return Response.json({ users });
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Server Action Example (Next.js App Router)
|
|
185
|
+
*
|
|
186
|
+
* Create this file at: app/actions/getOrgChartData.ts
|
|
187
|
+
*/
|
|
188
|
+
'use server';
|
|
189
|
+
|
|
190
|
+
export async function getOrgChartData(): Promise<User[]> {
|
|
191
|
+
const { getPayload } = await import('payload');
|
|
192
|
+
const config = await import('@/payload.config').then((m) => m.default);
|
|
193
|
+
|
|
194
|
+
const payload = await getPayload({ config });
|
|
195
|
+
|
|
196
|
+
const usersResponse = await payload.find({
|
|
197
|
+
collection: 'users',
|
|
198
|
+
depth: 2,
|
|
199
|
+
limit: 1000,
|
|
200
|
+
// Optional: Add sorting
|
|
201
|
+
sort: 'name',
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
return usersResponse.docs.map((doc) => ({
|
|
205
|
+
id: doc.id,
|
|
206
|
+
name: doc.name || '',
|
|
207
|
+
email: doc.email,
|
|
208
|
+
jobRole: doc.jobRole,
|
|
209
|
+
manager: doc.manager,
|
|
210
|
+
about: doc.about,
|
|
211
|
+
profilePicture: doc.profilePicture
|
|
212
|
+
? {
|
|
213
|
+
url: typeof doc.profilePicture === 'object'
|
|
214
|
+
? doc.profilePicture.url
|
|
215
|
+
: doc.profilePicture,
|
|
216
|
+
alt: doc.name,
|
|
217
|
+
}
|
|
218
|
+
: undefined,
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Usage in a page component:
|
|
224
|
+
*
|
|
225
|
+
* import { getOrgChartData } from '@/app/actions/getOrgChartData';
|
|
226
|
+
* import { OrgChartClientComponent } from '@/components/OrgChartClientComponent';
|
|
227
|
+
*
|
|
228
|
+
* export default async function OrgChartPage() {
|
|
229
|
+
* const users = await getOrgChartData();
|
|
230
|
+
* return <OrgChartClientComponent initialUsers={users} />;
|
|
231
|
+
* }
|
|
232
|
+
*/
|
|
233
|
+
\`\`\``;
|
package/dist/components/AdvancedComponents/org-chart-component/examples/PayloadIntegration.mjs
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import"../../../../chunk-YEKQJ4YC.mjs";var a=`
|
|
2
|
+
\`\`\`js
|
|
3
|
+
/**
|
|
4
|
+
* Example: Integrating OrgChart with PayloadCMS3
|
|
5
|
+
*
|
|
6
|
+
* This example shows how to fetch user data from Payload using the client SDK
|
|
7
|
+
* and render it in the OrgChart component.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { OrgChart } from '../OrgChart';
|
|
12
|
+
import type { User } from '../types';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Server Component Example (Next.js App Router)
|
|
16
|
+
*
|
|
17
|
+
* Use this approach in a server component to fetch data at build/request time.
|
|
18
|
+
*/
|
|
19
|
+
export async function OrgChartServerComponent() {
|
|
20
|
+
// Import Payload config (adjust path to your project structure)
|
|
21
|
+
const { getPayload } = await import('payload');
|
|
22
|
+
const config = await import('@/payload.config').then((m) => m.default);
|
|
23
|
+
|
|
24
|
+
// Get Payload instance
|
|
25
|
+
const payload = await getPayload({ config });
|
|
26
|
+
|
|
27
|
+
// Fetch all users with manager relationships
|
|
28
|
+
const usersResponse = await payload.find({
|
|
29
|
+
collection: 'users',
|
|
30
|
+
depth: 2, // Include manager relationship data
|
|
31
|
+
limit: 1000, // Adjust based on your org size
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Transform Payload data to OrgChart format
|
|
35
|
+
const users: User[] = usersResponse.docs.map((doc) => ({
|
|
36
|
+
id: doc.id,
|
|
37
|
+
name: doc.name || '',
|
|
38
|
+
email: doc.email,
|
|
39
|
+
jobRole: doc.jobRole,
|
|
40
|
+
manager: doc.manager,
|
|
41
|
+
about: doc.about,
|
|
42
|
+
profilePicture: doc.profilePicture
|
|
43
|
+
? {
|
|
44
|
+
url: typeof doc.profilePicture === 'object'
|
|
45
|
+
? doc.profilePicture.url
|
|
46
|
+
: doc.profilePicture,
|
|
47
|
+
alt: doc.name,
|
|
48
|
+
}
|
|
49
|
+
: undefined,
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div className="container mx-auto py-8">
|
|
54
|
+
<h1 className="text-3xl font-bold mb-8">Organization Chart</h1>
|
|
55
|
+
<OrgChart
|
|
56
|
+
users={users}
|
|
57
|
+
expandable={true}
|
|
58
|
+
initiallyExpanded={true}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Client Component Example (with Server Action or API Route)
|
|
66
|
+
*
|
|
67
|
+
* Use this approach when you need client-side interactivity.
|
|
68
|
+
*/
|
|
69
|
+
'use client';
|
|
70
|
+
|
|
71
|
+
interface OrgChartClientComponentProps {
|
|
72
|
+
initialUsers: User[];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function OrgChartClientComponent({ initialUsers }: OrgChartClientComponentProps) {
|
|
76
|
+
const [users, setUsers] = React.useState<User[]>(initialUsers);
|
|
77
|
+
const [selectedUser, setSelectedUser] = React.useState<User | null>(null);
|
|
78
|
+
|
|
79
|
+
const handleNodeClick = (user: User) => {
|
|
80
|
+
setSelectedUser(user);
|
|
81
|
+
// You could also navigate to a user detail page here
|
|
82
|
+
// router.push(\`/team/\${user.id}\`);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<div className="container mx-auto py-8">
|
|
87
|
+
<div className="mb-8">
|
|
88
|
+
<h1 className="text-3xl font-bold">Organization Chart</h1>
|
|
89
|
+
<p className="text-muted-foreground mt-2">
|
|
90
|
+
Click on any team member to view details
|
|
91
|
+
</p>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
95
|
+
{/* Org Chart */}
|
|
96
|
+
<div className="lg:col-span-2">
|
|
97
|
+
<OrgChart
|
|
98
|
+
users={users}
|
|
99
|
+
onNodeClick={handleNodeClick}
|
|
100
|
+
expandable={true}
|
|
101
|
+
initiallyExpanded={true}
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
{/* Selected User Details */}
|
|
106
|
+
<div className="lg:col-span-1">
|
|
107
|
+
{selectedUser ? (
|
|
108
|
+
<div className="bg-card border border-border rounded-lg p-6 sticky top-8">
|
|
109
|
+
<h2 className="text-xl font-semibold mb-4">Team Member Details</h2>
|
|
110
|
+
<div className="space-y-4">
|
|
111
|
+
<div>
|
|
112
|
+
<label className="text-sm text-muted-foreground">Name</label>
|
|
113
|
+
<p className="font-medium">{selectedUser.name}</p>
|
|
114
|
+
</div>
|
|
115
|
+
<div>
|
|
116
|
+
<label className="text-sm text-muted-foreground">Email</label>
|
|
117
|
+
<p className="font-medium">{selectedUser.email}</p>
|
|
118
|
+
</div>
|
|
119
|
+
{selectedUser.jobRole && (
|
|
120
|
+
<div>
|
|
121
|
+
<label className="text-sm text-muted-foreground">Role</label>
|
|
122
|
+
<p className="font-medium">{selectedUser.jobRole}</p>
|
|
123
|
+
</div>
|
|
124
|
+
)}
|
|
125
|
+
{selectedUser.about && (
|
|
126
|
+
<div>
|
|
127
|
+
<label className="text-sm text-muted-foreground">About</label>
|
|
128
|
+
<p className="text-sm">{selectedUser.about}</p>
|
|
129
|
+
</div>
|
|
130
|
+
)}
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
) : (
|
|
134
|
+
<div className="bg-muted/50 border border-border rounded-lg p-6 text-center">
|
|
135
|
+
<p className="text-muted-foreground">
|
|
136
|
+
Select a team member to view details
|
|
137
|
+
</p>
|
|
138
|
+
</div>
|
|
139
|
+
)}
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* API Route Example (Next.js App Router)
|
|
148
|
+
*
|
|
149
|
+
* Create this file at: app/api/org-chart/route.ts
|
|
150
|
+
*/
|
|
151
|
+
export async function GET() {
|
|
152
|
+
const { getPayload } = await import('payload');
|
|
153
|
+
const config = await import('@/payload.config').then((m) => m.default);
|
|
154
|
+
|
|
155
|
+
const payload = await getPayload({ config });
|
|
156
|
+
|
|
157
|
+
const usersResponse = await payload.find({
|
|
158
|
+
collection: 'users',
|
|
159
|
+
depth: 2,
|
|
160
|
+
limit: 1000,
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const users: User[] = usersResponse.docs.map((doc) => ({
|
|
164
|
+
id: doc.id,
|
|
165
|
+
name: doc.name || '',
|
|
166
|
+
email: doc.email,
|
|
167
|
+
jobRole: doc.jobRole,
|
|
168
|
+
manager: doc.manager,
|
|
169
|
+
about: doc.about,
|
|
170
|
+
profilePicture: doc.profilePicture
|
|
171
|
+
? {
|
|
172
|
+
url: typeof doc.profilePicture === 'object'
|
|
173
|
+
? doc.profilePicture.url
|
|
174
|
+
: doc.profilePicture,
|
|
175
|
+
alt: doc.name,
|
|
176
|
+
}
|
|
177
|
+
: undefined,
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
return Response.json({ users });
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Server Action Example (Next.js App Router)
|
|
185
|
+
*
|
|
186
|
+
* Create this file at: app/actions/getOrgChartData.ts
|
|
187
|
+
*/
|
|
188
|
+
'use server';
|
|
189
|
+
|
|
190
|
+
export async function getOrgChartData(): Promise<User[]> {
|
|
191
|
+
const { getPayload } = await import('payload');
|
|
192
|
+
const config = await import('@/payload.config').then((m) => m.default);
|
|
193
|
+
|
|
194
|
+
const payload = await getPayload({ config });
|
|
195
|
+
|
|
196
|
+
const usersResponse = await payload.find({
|
|
197
|
+
collection: 'users',
|
|
198
|
+
depth: 2,
|
|
199
|
+
limit: 1000,
|
|
200
|
+
// Optional: Add sorting
|
|
201
|
+
sort: 'name',
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
return usersResponse.docs.map((doc) => ({
|
|
205
|
+
id: doc.id,
|
|
206
|
+
name: doc.name || '',
|
|
207
|
+
email: doc.email,
|
|
208
|
+
jobRole: doc.jobRole,
|
|
209
|
+
manager: doc.manager,
|
|
210
|
+
about: doc.about,
|
|
211
|
+
profilePicture: doc.profilePicture
|
|
212
|
+
? {
|
|
213
|
+
url: typeof doc.profilePicture === 'object'
|
|
214
|
+
? doc.profilePicture.url
|
|
215
|
+
: doc.profilePicture,
|
|
216
|
+
alt: doc.name,
|
|
217
|
+
}
|
|
218
|
+
: undefined,
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Usage in a page component:
|
|
224
|
+
*
|
|
225
|
+
* import { getOrgChartData } from '@/app/actions/getOrgChartData';
|
|
226
|
+
* import { OrgChartClientComponent } from '@/components/OrgChartClientComponent';
|
|
227
|
+
*
|
|
228
|
+
* export default async function OrgChartPage() {
|
|
229
|
+
* const users = await getOrgChartData();
|
|
230
|
+
* return <OrgChartClientComponent initialUsers={users} />;
|
|
231
|
+
* }
|
|
232
|
+
*/
|
|
233
|
+
\`\`\``;export{a as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";var f=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var k=(e,r)=>{for(var o in r)f(e,o,{get:r[o],enumerable:!0})},R=(e,r,o,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of P(r))!w.call(e,t)&&t!==o&&f(e,t,{get:()=>r[t],enumerable:!(i=y(r,t))||i.enumerable});return e};var E=e=>R(f({},"__esModule",{value:!0}),e);var U={};k(U,{OrgChart:()=>O,OrgNode:()=>m,OrgTree:()=>p,buildOrgTree:()=>b,getInitials:()=>x,getRoleBadgeColor:()=>h});module.exports=E(U);function b(e){let r=new Map,o=[];e.forEach(t=>{r.set(t.id,{...t,children:[],level:0})}),e.forEach(t=>{let a=r.get(t.id);if(!a)return;let d=typeof t.manager=="string"?t.manager:t.manager?.id;if(d){let c=r.get(d);c?(c.children.push(a),a.level=c.level+1):o.push(a)}else o.push(a)});let i=(t,a)=>{t.level=a,t.children.forEach(d=>i(d,a+1))};return o.forEach(t=>i(t,0)),o}function x(e){if(!e)return"?";let r=e.trim().split(/\n+/);return r.length===1?r[0].substring(0,2).toUpperCase():(r[0][0]+r[r.length-1][0]).toUpperCase()}function h(e){return e&&{P:"bg-primary/20 text-primary border-primary/30",SM:"bg-accent/20 text-accent border-accent/30",M:"bg-accent/15 text-accent border-accent/25",SC2:"bg-card text-card-foreground border-border",SC1:"bg-card text-card-foreground border-border",C3:"bg-muted text-muted-foreground border-border",C2:"bg-muted text-muted-foreground border-border",C1:"bg-muted text-muted-foreground border-border"}[e]||"bg-muted text-muted-foreground"}var N=require("react");var v={C1:"Consultant 1",C2:"Consultant 2",C3:"Consultant 3",SC1:"Senior Consultant 1",SC2:"Senior Consultant 2",M:"Manager",SM:"Senior Manager",P:"Partner"};var n=require("react/jsx-runtime"),m=({node:e,onNodeClick:r,expandable:o=!1,isExpanded:i=!0,onToggleExpand:t})=>{let a=e.children.length>0,d=o&&a;return(0,n.jsxs)("div",{className:"flex flex-col items-center",children:[(0,n.jsxs)("div",{className:`
|
|
2
|
+
relative bg-card border border-border rounded-lg shadow-sm
|
|
3
|
+
transition-all duration-200 hover:shadow-md hover:border-primary/50
|
|
4
|
+
${r?"cursor-pointer":""}
|
|
5
|
+
w-64 p-4
|
|
6
|
+
`,onClick:()=>r?.(e),children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:e.profilePicture?.url?(0,n.jsx)("img",{src:e.profilePicture.url,alt:e.profilePicture.alt||e.name,className:"w-12 h-12 rounded-full object-cover border-2 border-primary/20"}):(0,n.jsx)("div",{className:"w-12 h-12 rounded-full bg-primary/10 border-2 border-primary/20 flex items-center justify-center",children:(0,n.jsx)("span",{className:"text-sm font-semibold text-primary",children:x(e.name)})})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("h3",{className:"font-semibold text-card-foreground text-sm truncate",children:e.name}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.email}),e.jobRole&&(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)("span",{className:`
|
|
7
|
+
inline-block px-2 py-0.5 rounded text-xs font-medium border
|
|
8
|
+
${h(e.jobRole)}
|
|
9
|
+
`,children:v[e.jobRole]})})]})]}),e.about&&(0,n.jsx)("div",{className:"mt-3 pt-3 border-t border-border",children:(0,n.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.about})}),d&&(0,n.jsx)("button",{onClick:c=>{c.stopPropagation(),t?.()},className:"absolute -bottom-3 left-1/2 -translate-x-1/2 w-6 h-6 rounded-full bg-card border-2 border-border hover:border-primary/50 flex items-center justify-center transition-colors","aria-label":i?"Collapse":"Expand",children:(0,n.jsx)("svg",{className:`w-3 h-3 text-muted-foreground transition-transform ${i?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a&&i&&(0,n.jsx)("div",{className:"w-0.5 h-8 bg-border"})]})};var p=({nodes:e,onNodeClick:r,expandable:o=!1,initiallyExpanded:i=!0})=>(0,n.jsx)("div",{className:"flex flex-col items-center gap-0",children:e.map((t,a)=>(0,n.jsx)(C,{node:t,onNodeClick:r,expandable:o,initiallyExpanded:i,isLast:a===e.length-1},t.id))}),C=({node:e,onNodeClick:r,expandable:o,initiallyExpanded:i=!0,isLast:t=!1})=>{let[a,d]=(0,N.useState)(i),c=e.children.length>0;return(0,n.jsxs)("div",{className:`flex flex-col items-center ${t?"":"mb-8"}`,children:[(0,n.jsx)(m,{node:e,onNodeClick:r,expandable:o,isExpanded:a,onToggleExpand:()=>d(!a)}),c&&a&&(0,n.jsxs)("div",{className:"flex flex-col items-center mt-0",children:[e.children.length>1&&(0,n.jsx)("div",{className:"relative w-full flex justify-center",children:(0,n.jsxs)("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-full max-w-[800px]",children:[(0,n.jsx)("div",{className:"absolute top-0 left-0 right-0 h-0.5 bg-border"}),(0,n.jsx)("div",{className:"flex justify-around",children:e.children.map((g,u)=>(0,n.jsx)("div",{className:"w-0.5 h-8 bg-border"},u))})]})}),(0,n.jsx)("div",{className:`
|
|
10
|
+
flex gap-8 mt-8
|
|
11
|
+
${e.children.length===1?"flex-col items-center":"flex-row items-start justify-center flex-wrap"}
|
|
12
|
+
`,children:e.children.map((g,u)=>(0,n.jsx)(C,{node:g,onNodeClick:r,expandable:o,initiallyExpanded:i,isLast:u===e.children.length-1},g.id))})]})]})};var O=({users:e,onNodeClick:r,className:o="",expandable:i=!1,initiallyExpanded:t=!0})=>{let a=b(e);return e.length===0?(0,n.jsx)("div",{className:`flex items-center justify-center p-8 ${o}`,children:(0,n.jsx)("div",{className:"text-center",children:(0,n.jsx)("p",{className:"text-muted-foreground",children:"No users to display"})})}):a.length===0?(0,n.jsx)("div",{className:`flex items-center justify-center p-8 ${o}`,children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("p",{className:"text-muted-foreground",children:"Unable to build organization tree"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Check that manager relationships are properly configured"})]})}):(0,n.jsx)("div",{className:`org-chart w-full overflow-x-auto ${o}`,children:(0,n.jsx)("div",{className:"inline-block min-w-full p-8",children:(0,n.jsx)(p,{nodes:a,onNodeClick:r,expandable:i,initiallyExpanded:t})})})};0&&(module.exports={OrgChart,OrgNode,OrgTree,buildOrgTree,getInitials,getRoleBadgeColor});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as f}from"../../../chunk-B7RZ4K6Y.mjs";import{a as e}from"../../../chunk-G6OGEIN4.mjs";import{a as d}from"../../../chunk-KQRQXBJ3.mjs";import"../../../chunk-SOTCQX2G.mjs";import{a,b,c}from"../../../chunk-32G45Z2G.mjs";import"../../../chunk-YEKQJ4YC.mjs";export{f as OrgChart,d as OrgNode,e as OrgTree,a as buildOrgTree,b as getInitials,c as getRoleBadgeColor};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { User } from './types';
|
|
2
|
+
export declare const smallTeamData: User[];
|
|
3
|
+
export declare const mediumTeamData: User[];
|
|
4
|
+
export declare const singlePersonData: User[];
|
|
5
|
+
export declare const deepHierarchyData: User[];
|
|
6
|
+
export declare const wideHierarchyData: User[];
|
|
7
|
+
export declare const emptyData: User[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var m=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var c=(e,a)=>{for(var n in a)m(e,n,{get:a[n],enumerable:!0})},s=(e,a,n,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of t(a))!l.call(e,o)&&o!==n&&m(e,o,{get:()=>a[o],enumerable:!(r=i(a,o))||r.enumerable});return e};var u=e=>s(m({},"__esModule",{value:!0}),e);var C={};c(C,{deepHierarchyData:()=>p,emptyData:()=>h,mediumTeamData:()=>d,singlePersonData:()=>g,smallTeamData:()=>b,wideHierarchyData:()=>y});module.exports=u(C);var b=[{id:"1",name:"Sarah Chen",email:"sarah.chen@company.com",jobRole:"P",manager:null,about:"Partner leading the consulting practice",profilePicture:void 0},{id:"2",name:"Michael Roberts",email:"michael.roberts@company.com",jobRole:"SM",manager:"1",about:"Senior Manager overseeing client delivery"},{id:"3",name:"Emily Watson",email:"emily.watson@company.com",jobRole:"M",manager:"2",about:"Manager focused on digital transformation projects"},{id:"4",name:"David Kim",email:"david.kim@company.com",jobRole:"SC1",manager:"3",about:"Senior Consultant specializing in cloud architecture"},{id:"5",name:"Lisa Anderson",email:"lisa.anderson@company.com",jobRole:"SC2",manager:"3",about:"Senior Consultant with expertise in data analytics"},{id:"6",name:"James Taylor",email:"james.taylor@company.com",jobRole:"C3",manager:"3",about:"Consultant working on enterprise solutions"}],d=[{id:"1",name:"Alexandra Martinez",email:"alexandra.martinez@company.com",jobRole:"P",manager:null,about:"Partner and Managing Director"},{id:"2",name:"Robert Chang",email:"robert.chang@company.com",jobRole:"SM",manager:"1",about:"Senior Manager - Technology Practice"},{id:"3",name:"Jennifer Williams",email:"jennifer.williams@company.com",jobRole:"SM",manager:"1",about:"Senior Manager - Strategy Practice"},{id:"4",name:"Thomas Brown",email:"thomas.brown@company.com",jobRole:"M",manager:"2",about:"Manager - Cloud Solutions"},{id:"5",name:"Maria Garcia",email:"maria.garcia@company.com",jobRole:"M",manager:"2",about:"Manager - Application Development"},{id:"6",name:"Christopher Lee",email:"christopher.lee@company.com",jobRole:"M",manager:"3",about:"Manager - Business Strategy"},{id:"7",name:"Amanda White",email:"amanda.white@company.com",jobRole:"SC2",manager:"4",about:"Senior Consultant - DevOps"},{id:"8",name:"Daniel Harris",email:"daniel.harris@company.com",jobRole:"SC1",manager:"4",about:"Senior Consultant - Infrastructure"},{id:"9",name:"Rachel Thompson",email:"rachel.thompson@company.com",jobRole:"C3",manager:"4",about:"Consultant - Cloud Migration"},{id:"10",name:"Kevin Martinez",email:"kevin.martinez@company.com",jobRole:"SC2",manager:"5",about:"Senior Consultant - Full Stack Development"},{id:"11",name:"Sophie Anderson",email:"sophie.anderson@company.com",jobRole:"C2",manager:"5",about:"Consultant - Frontend Development"},{id:"12",name:"Marcus Johnson",email:"marcus.johnson@company.com",jobRole:"C1",manager:"5",about:"Consultant - Backend Development"},{id:"13",name:"Olivia Davis",email:"olivia.davis@company.com",jobRole:"SC1",manager:"6",about:"Senior Consultant - Market Analysis"},{id:"14",name:"Nathan Wilson",email:"nathan.wilson@company.com",jobRole:"C3",manager:"6",about:"Consultant - Strategic Planning"}],g=[{id:"1",name:"Victoria Sterling",email:"victoria.sterling@company.com",jobRole:"P",manager:null,about:"Founder and CEO"}],p=[{id:"1",name:"William Thompson",email:"william.thompson@company.com",jobRole:"P",manager:null,about:"Partner"},{id:"2",name:"Elizabeth Moore",email:"elizabeth.moore@company.com",jobRole:"SM",manager:"1",about:"Senior Manager"},{id:"3",name:"Charles Jackson",email:"charles.jackson@company.com",jobRole:"M",manager:"2",about:"Manager"},{id:"4",name:"Margaret Taylor",email:"margaret.taylor@company.com",jobRole:"SC2",manager:"3",about:"Senior Consultant"},{id:"5",name:"Henry Adams",email:"henry.adams@company.com",jobRole:"C3",manager:"4",about:"Consultant"},{id:"6",name:"Catherine Wright",email:"catherine.wright@company.com",jobRole:"C1",manager:"5",about:"Junior Consultant"}],y=[{id:"1",name:"Richard Foster",email:"richard.foster@company.com",jobRole:"P",manager:null,about:"Partner"},{id:"2",name:"Anna Peterson",email:"anna.peterson@company.com",jobRole:"M",manager:"1",about:"Manager - Team A"},{id:"3",name:"Brian Collins",email:"brian.collins@company.com",jobRole:"SC2",manager:"2",about:"Senior Consultant"},{id:"4",name:"Caroline Hughes",email:"caroline.hughes@company.com",jobRole:"SC1",manager:"2",about:"Senior Consultant"},{id:"5",name:"Derek Murphy",email:"derek.murphy@company.com",jobRole:"C3",manager:"2",about:"Consultant"},{id:"6",name:"Emma Richardson",email:"emma.richardson@company.com",jobRole:"C2",manager:"2",about:"Consultant"},{id:"7",name:"Frank Cooper",email:"frank.cooper@company.com",jobRole:"C1",manager:"2",about:"Consultant"},{id:"8",name:"Grace Bennett",email:"grace.bennett@company.com",jobRole:"C1",manager:"2",about:"Consultant"}],h=[];0&&(module.exports={deepHierarchyData,emptyData,mediumTeamData,singlePersonData,smallTeamData,wideHierarchyData});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../../chunk-YEKQJ4YC.mjs";var a=[{id:"1",name:"Sarah Chen",email:"sarah.chen@company.com",jobRole:"P",manager:null,about:"Partner leading the consulting practice",profilePicture:void 0},{id:"2",name:"Michael Roberts",email:"michael.roberts@company.com",jobRole:"SM",manager:"1",about:"Senior Manager overseeing client delivery"},{id:"3",name:"Emily Watson",email:"emily.watson@company.com",jobRole:"M",manager:"2",about:"Manager focused on digital transformation projects"},{id:"4",name:"David Kim",email:"david.kim@company.com",jobRole:"SC1",manager:"3",about:"Senior Consultant specializing in cloud architecture"},{id:"5",name:"Lisa Anderson",email:"lisa.anderson@company.com",jobRole:"SC2",manager:"3",about:"Senior Consultant with expertise in data analytics"},{id:"6",name:"James Taylor",email:"james.taylor@company.com",jobRole:"C3",manager:"3",about:"Consultant working on enterprise solutions"}],e=[{id:"1",name:"Alexandra Martinez",email:"alexandra.martinez@company.com",jobRole:"P",manager:null,about:"Partner and Managing Director"},{id:"2",name:"Robert Chang",email:"robert.chang@company.com",jobRole:"SM",manager:"1",about:"Senior Manager - Technology Practice"},{id:"3",name:"Jennifer Williams",email:"jennifer.williams@company.com",jobRole:"SM",manager:"1",about:"Senior Manager - Strategy Practice"},{id:"4",name:"Thomas Brown",email:"thomas.brown@company.com",jobRole:"M",manager:"2",about:"Manager - Cloud Solutions"},{id:"5",name:"Maria Garcia",email:"maria.garcia@company.com",jobRole:"M",manager:"2",about:"Manager - Application Development"},{id:"6",name:"Christopher Lee",email:"christopher.lee@company.com",jobRole:"M",manager:"3",about:"Manager - Business Strategy"},{id:"7",name:"Amanda White",email:"amanda.white@company.com",jobRole:"SC2",manager:"4",about:"Senior Consultant - DevOps"},{id:"8",name:"Daniel Harris",email:"daniel.harris@company.com",jobRole:"SC1",manager:"4",about:"Senior Consultant - Infrastructure"},{id:"9",name:"Rachel Thompson",email:"rachel.thompson@company.com",jobRole:"C3",manager:"4",about:"Consultant - Cloud Migration"},{id:"10",name:"Kevin Martinez",email:"kevin.martinez@company.com",jobRole:"SC2",manager:"5",about:"Senior Consultant - Full Stack Development"},{id:"11",name:"Sophie Anderson",email:"sophie.anderson@company.com",jobRole:"C2",manager:"5",about:"Consultant - Frontend Development"},{id:"12",name:"Marcus Johnson",email:"marcus.johnson@company.com",jobRole:"C1",manager:"5",about:"Consultant - Backend Development"},{id:"13",name:"Olivia Davis",email:"olivia.davis@company.com",jobRole:"SC1",manager:"6",about:"Senior Consultant - Market Analysis"},{id:"14",name:"Nathan Wilson",email:"nathan.wilson@company.com",jobRole:"C3",manager:"6",about:"Consultant - Strategic Planning"}],o=[{id:"1",name:"Victoria Sterling",email:"victoria.sterling@company.com",jobRole:"P",manager:null,about:"Founder and CEO"}],n=[{id:"1",name:"William Thompson",email:"william.thompson@company.com",jobRole:"P",manager:null,about:"Partner"},{id:"2",name:"Elizabeth Moore",email:"elizabeth.moore@company.com",jobRole:"SM",manager:"1",about:"Senior Manager"},{id:"3",name:"Charles Jackson",email:"charles.jackson@company.com",jobRole:"M",manager:"2",about:"Manager"},{id:"4",name:"Margaret Taylor",email:"margaret.taylor@company.com",jobRole:"SC2",manager:"3",about:"Senior Consultant"},{id:"5",name:"Henry Adams",email:"henry.adams@company.com",jobRole:"C3",manager:"4",about:"Consultant"},{id:"6",name:"Catherine Wright",email:"catherine.wright@company.com",jobRole:"C1",manager:"5",about:"Junior Consultant"}],m=[{id:"1",name:"Richard Foster",email:"richard.foster@company.com",jobRole:"P",manager:null,about:"Partner"},{id:"2",name:"Anna Peterson",email:"anna.peterson@company.com",jobRole:"M",manager:"1",about:"Manager - Team A"},{id:"3",name:"Brian Collins",email:"brian.collins@company.com",jobRole:"SC2",manager:"2",about:"Senior Consultant"},{id:"4",name:"Caroline Hughes",email:"caroline.hughes@company.com",jobRole:"SC1",manager:"2",about:"Senior Consultant"},{id:"5",name:"Derek Murphy",email:"derek.murphy@company.com",jobRole:"C3",manager:"2",about:"Consultant"},{id:"6",name:"Emma Richardson",email:"emma.richardson@company.com",jobRole:"C2",manager:"2",about:"Consultant"},{id:"7",name:"Frank Cooper",email:"frank.cooper@company.com",jobRole:"C1",manager:"2",about:"Consultant"},{id:"8",name:"Grace Bennett",email:"grace.bennett@company.com",jobRole:"C1",manager:"2",about:"Consultant"}],r=[];export{n as deepHierarchyData,r as emptyData,e as mediumTeamData,o as singlePersonData,a as smallTeamData,m as wideHierarchyData};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type JobRole = 'C1' | 'C2' | 'C3' | 'SC1' | 'SC2' | 'M' | 'SM' | 'P';
|
|
2
|
+
export interface ProfilePicture {
|
|
3
|
+
url: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface User {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
email: string;
|
|
10
|
+
jobRole?: JobRole;
|
|
11
|
+
manager?: User | string | null;
|
|
12
|
+
about?: string;
|
|
13
|
+
profilePicture?: ProfilePicture;
|
|
14
|
+
}
|
|
15
|
+
export interface OrgChartNode extends User {
|
|
16
|
+
children: OrgChartNode[];
|
|
17
|
+
level: number;
|
|
18
|
+
}
|
|
19
|
+
export interface OrgChartProps {
|
|
20
|
+
users: User[];
|
|
21
|
+
onNodeClick?: (user: User) => void;
|
|
22
|
+
className?: string;
|
|
23
|
+
expandable?: boolean;
|
|
24
|
+
initiallyExpanded?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface OrgNodeProps {
|
|
27
|
+
node: OrgChartNode;
|
|
28
|
+
onNodeClick?: (user: User) => void;
|
|
29
|
+
expandable?: boolean;
|
|
30
|
+
isExpanded?: boolean;
|
|
31
|
+
onToggleExpand?: () => void;
|
|
32
|
+
}
|
|
33
|
+
export declare const jobRoleLabels: Record<JobRole, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var d=(r,e)=>{for(var n in e)t(r,n,{get:e[n],enumerable:!0})},C=(r,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!s.call(r,o)&&o!==n&&t(r,o,{get:()=>e[o],enumerable:!(a=i(e,o))||a.enumerable});return r};var g=r=>C(t({},"__esModule",{value:!0}),r);var u={};d(u,{jobRoleLabels:()=>p});module.exports=g(u);var p={C1:"Consultant 1",C2:"Consultant 2",C3:"Consultant 3",SC1:"Senior Consultant 1",SC2:"Senior Consultant 2",M:"Manager",SM:"Senior Manager",P:"Partner"};0&&(module.exports={jobRoleLabels});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../../../chunk-SOTCQX2G.mjs";import"../../../../chunk-YEKQJ4YC.mjs";export{a as jobRoleLabels};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { User, OrgChartNode } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Build a hierarchical tree structure from flat user list
|
|
4
|
+
*/
|
|
5
|
+
export declare function buildOrgTree(users: User[]): OrgChartNode[];
|
|
6
|
+
/**
|
|
7
|
+
* Get initials from name for avatar fallback
|
|
8
|
+
*/
|
|
9
|
+
export declare function getInitials(name: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Get color class based on job role level
|
|
12
|
+
*/
|
|
13
|
+
export declare function getRoleBadgeColor(jobRole?: string): string;
|